mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-28 02:53:11 +00:00
Server build date and revision.
Can now see the current compilation date and revision: * In the Dream Daemon log output. * By using the "Show Server Revision" client verb which also links you to the commit in question.
This commit is contained in:
@@ -149,6 +149,7 @@
|
|||||||
#include "code\datums\diseases\advance\symptoms\weight.dm"
|
#include "code\datums\diseases\advance\symptoms\weight.dm"
|
||||||
#include "code\datums\helper_datums\construction_datum.dm"
|
#include "code\datums\helper_datums\construction_datum.dm"
|
||||||
#include "code\datums\helper_datums\events.dm"
|
#include "code\datums\helper_datums\events.dm"
|
||||||
|
#include "code\datums\helper_datums\getrev.dm"
|
||||||
#include "code\datums\helper_datums\global_iterator.dm"
|
#include "code\datums\helper_datums\global_iterator.dm"
|
||||||
#include "code\datums\helper_datums\teleport.dm"
|
#include "code\datums\helper_datums\teleport.dm"
|
||||||
#include "code\datums\helper_datums\topic_input.dm"
|
#include "code\datums\helper_datums\topic_input.dm"
|
||||||
|
|||||||
@@ -325,3 +325,47 @@ proc/tg_list2text(list/list, glue=",")
|
|||||||
. = 0
|
. = 0
|
||||||
else
|
else
|
||||||
. = max(0, min(255, 138.5177312231 * log(temp - 10) - 305.0447927307))
|
. = max(0, min(255, 138.5177312231 * log(temp - 10) - 305.0447927307))
|
||||||
|
|
||||||
|
// Very ugly, BYOND doesn't support unix time and rounding errors make it really hard to convert it to BYOND time.
|
||||||
|
// returns "YYYY-MM-DD" by default
|
||||||
|
/proc/unix2date(timestamp, seperator = "-")
|
||||||
|
if(timestamp < 0)
|
||||||
|
return 0 //Do not accept negative values
|
||||||
|
|
||||||
|
var/const/dayInSeconds = 86400 //60secs*60mins*24hours
|
||||||
|
var/const/daysInYear = 365 //Non Leap Year
|
||||||
|
var/const/daysInLYear = daysInYear + 1//Leap year
|
||||||
|
var/days = round(timestamp / dayInSeconds) //Days passed since UNIX Epoc
|
||||||
|
var/year = 1970 //Unix Epoc begins 1970-01-01
|
||||||
|
var/tmpDays = days + 1 //If passed (timestamp < dayInSeconds), it will return 0, so add 1
|
||||||
|
var/monthsInDays = list() //Months will be in here ***Taken from the PHP source code***
|
||||||
|
var/month = 1 //This will be the returned MONTH NUMBER.
|
||||||
|
var/day //This will be the returned day number.
|
||||||
|
|
||||||
|
while(tmpDays > daysInYear) //Start adding years to 1970
|
||||||
|
year++
|
||||||
|
if(isLeap(year))
|
||||||
|
tmpDays -= daysInLYear
|
||||||
|
else
|
||||||
|
tmpDays -= daysInYear
|
||||||
|
|
||||||
|
if(isLeap(year)) //The year is a leap year
|
||||||
|
monthsInDays = list(-1,30,59,90,120,151,181,212,243,273,304,334)
|
||||||
|
else
|
||||||
|
monthsInDays = list(0,31,59,90,120,151,181,212,243,273,304,334)
|
||||||
|
|
||||||
|
var/mDays = 0;
|
||||||
|
var/monthIndex = 0;
|
||||||
|
|
||||||
|
for(var/m in monthsInDays)
|
||||||
|
monthIndex++
|
||||||
|
if(tmpDays > m)
|
||||||
|
mDays = m
|
||||||
|
month = monthIndex
|
||||||
|
|
||||||
|
day = tmpDays - mDays //Setup the date
|
||||||
|
|
||||||
|
return "[year][seperator][((month < 10) ? "0[month]" : month)][seperator][((day < 10) ? "0[day]" : day)]"
|
||||||
|
|
||||||
|
/proc/isLeap(y)
|
||||||
|
return ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
|
||||||
|
|||||||
@@ -90,6 +90,7 @@
|
|||||||
var/banappeals
|
var/banappeals
|
||||||
var/wikiurl
|
var/wikiurl
|
||||||
var/forumurl
|
var/forumurl
|
||||||
|
var/githuburl
|
||||||
|
|
||||||
//Alert level description
|
//Alert level description
|
||||||
var/alert_desc_green = "All threats to the station have passed. Security may not have weapons visible, privacy laws are once again fully enforced."
|
var/alert_desc_green = "All threats to the station have passed. Security may not have weapons visible, privacy laws are once again fully enforced."
|
||||||
@@ -376,6 +377,9 @@
|
|||||||
if ("forumurl")
|
if ("forumurl")
|
||||||
config.forumurl = value
|
config.forumurl = value
|
||||||
|
|
||||||
|
if ("githuburl")
|
||||||
|
config.githuburl = value
|
||||||
|
|
||||||
if ("guest_jobban")
|
if ("guest_jobban")
|
||||||
config.guest_jobban = 1
|
config.guest_jobban = 1
|
||||||
|
|
||||||
|
|||||||
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
|
||||||
@@ -177,6 +177,9 @@ GUEST_BAN
|
|||||||
## Wiki address
|
## Wiki address
|
||||||
# WIKIURL http://example.com
|
# WIKIURL http://example.com
|
||||||
|
|
||||||
|
## GitHub address
|
||||||
|
# GITHUBURL https://github.com/example-user/example-repository
|
||||||
|
|
||||||
## Ban appeals URL - usually for a forum or wherever people should go to contact your admins.
|
## Ban appeals URL - usually for a forum or wherever people should go to contact your admins.
|
||||||
# BANAPPEALS http://example.com
|
# BANAPPEALS http://example.com
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user