mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 11:13:16 +00:00
Merge remote-tracking branch 'upstream/dev' into span_class=notice
Conflicts: code/game/antagonist/station/rogue_ai.dm code/game/machinery/OpTable.dm code/game/machinery/floodlight.dm code/game/machinery/spaceheater.dm
This commit is contained in:
39
code/datums/helper_datums/getrev.dm
Normal file
39
code/datums/helper_datums/getrev.dm
Normal file
@@ -0,0 +1,39 @@
|
||||
var/global/datum/getrev/revdata = new()
|
||||
|
||||
/datum/getrev
|
||||
var/revision
|
||||
var/date
|
||||
var/showinfo
|
||||
|
||||
/datum/getrev/New()
|
||||
var/list/head_log = file2list(".git/logs/HEAD", "\n")
|
||||
for(var/line=head_log.len, line>=1, line--)
|
||||
if(head_log[line])
|
||||
var/list/last_entry = text2list(head_log[line], " ")
|
||||
if(last_entry.len < 2) continue
|
||||
revision = last_entry[2]
|
||||
// Get date/time
|
||||
if(last_entry.len >= 5)
|
||||
var/unix_time = text2num(last_entry[5])
|
||||
if(unix_time)
|
||||
date = unix2date(unix_time)
|
||||
break
|
||||
world.log << "Running revision:"
|
||||
world.log << date
|
||||
world.log << revision
|
||||
return
|
||||
|
||||
client/verb/showrevinfo()
|
||||
set category = "OOC"
|
||||
set name = "Show Server Revision"
|
||||
set desc = "Check the current server code revision"
|
||||
|
||||
if(revdata.revision)
|
||||
src << "<b>Server revision:</b> [revdata.date]"
|
||||
if(config.githuburl)
|
||||
src << "<a href='[config.githuburl]/commit/[revdata.revision]'>[revdata.revision]</a>"
|
||||
else
|
||||
src << revdata.revision
|
||||
else
|
||||
src << "Revision unknown"
|
||||
return
|
||||
Reference in New Issue
Block a user