MantisBT - Zandronum
View Issue Details
0002400Zandronum[All Projects] Suggestionpublic2015-08-10 17:392018-09-30 22:21
Hypnotoad 
Dusk 
normalfeaturehave not tried
closedfixed 
 
3.03.0 
0002400: Simple current date server variable that can be overwritten
Following on from here:'http://zandronum.com/tracker/view.php?id=1853#c10622 [^]'

I spoke to Torr about this last night and explained how kpatch already has a simple read only DDMMYY date variable in place. I proposed that a similar variable, but that isn't read only so that hosts can override it, should be added to Zandronum. Being able to override it allows individuals to overcome any attempt by some project to lock down their mod after a certain date.

After speaking to Blzut3 who was the main opponent of being able to get the current time/date initially, he agrees that this server variable approach is okay since using getcvar is already indeterminate so it doesn't add additional determinism problems.
No tags attached.
related to 0001853closed  Ability to access time (but not date/year to prevent abuse) in ACS. 
Issue History
2015-08-10 17:39HypnotoadNew Issue
2015-08-10 17:41Blzut3Relationship addedrelated to 0001853
2015-08-25 23:33DuskAssigned To => Dusk
2015-08-25 23:33DuskStatusnew => assigned
2015-08-25 23:36StrikerMan780Note Added: 0013280
2015-08-25 23:37StrikerMan780Note Edited: 0013280bug_revision_view_page.php?bugnote_id=13280#r7950
2015-08-26 00:25CatastropheNote Added: 0013281
2015-08-26 01:33DuskNote Added: 0013282
2015-08-26 01:33DuskStatusassigned => needs review
2015-08-26 01:36DuskNote Edited: 0013282bug_revision_view_page.php?bugnote_id=13282#r7952
2015-08-26 02:26WaTaKiDNote Added: 0013283
2015-08-26 02:30DuskNote Edited: 0013282bug_revision_view_page.php?bugnote_id=13282#r7953
2015-08-26 02:33DuskNote Edited: 0013282bug_revision_view_page.php?bugnote_id=13282#r7954
2015-08-26 02:41WaTaKiDNote Edited: 0013283bug_revision_view_page.php?bugnote_id=13283#r7956
2015-08-28 23:07IvanNote Added: 0013302
2015-08-30 20:53cobaltStatusneeds review => needs testing
2015-08-30 20:53cobaltTarget Version => 3.0
2015-08-30 20:53cobaltDescription Updatedbug_revision_view_page.php?rev_id=7985#r7985
2015-08-30 20:53cobaltNote Added: 0013336
2015-09-05 15:06DuskNote Added: 0013423
2015-09-05 15:06DuskStatusneeds testing => resolved
2015-09-05 15:06DuskFixed in Version => 3.0
2015-09-05 15:06DuskResolutionopen => fixed
2018-09-30 22:21Blzut3Statusresolved => closed

Notes
(0013280)
StrikerMan780   
2015-08-25 23:36   
(edited on: 2015-08-25 23:37)
I really don't think anyone is so stupid as to lock down their mod by date. And if they do, their loss by cutting off their own playerbase. Chances are if someone does that, it isn't a mod worth playing anyhow.

(0013281)
Catastrophe   
2015-08-26 00:25   
Yes. I have a working money system in-place for a certain mod, and it'd be nice to give automated discounts during halloween, christmas, etc.
(0013282)
Dusk   
2015-08-26 01:33   
(edited on: 2015-08-26 02:33)
Here goes..

I added 3 new ACS functions to read in system time stuff:

SystemTime() - returns a timestamp
GetTimeProperty (timestamp, which[, utc=false]) - returns a single localized property of the timestamp
Strftime (timestamp, format, [utc=false]) - returns a string representation of the date


The override mechanism takes the form of the CCMD acstime, which is an interface to the CVAR acstimestamp (so that it gets written to the ini):

acstime -- no arguments, prints override status
acstime yy-mm-dd [hh:mm] -- sets override
acstime clear -- clears override


Stuff for zspecial.acs/zdefs.acs:

special -127:SystemTime( 0 ),
    -128:GetTimeProperty( 2, 3 ),
    -129:Strftime( 2, 3 );

// The following can be used with the "which" parameter of GetTimeProperty
#define TM_SECOND 0
#define TM_MINUTE 1
#define TM_HOUR 2
#define TM_DAY 3
#define TM_MONTH 4
#define TM_YEAR 5
#define TM_WEEKDAY 6


The format parameter of strftime is naturally the format parameter of the real thing. (I'm supposing this is safe to just pass to the real strftime function unmodified.) This website seems like a pretty decent online strftime calculator.

(0013283)
WaTaKiD   
2015-08-26 02:26   
(edited on: 2015-08-26 02:41)
this build can be used to test:'https://www.dropbox.com/s/64yvcfs32pf9ih0/zandronum-3.0-r150826-0225-85291ed-windows.zip?dl=0 [^]'

(0013302)
Ivan   
2015-08-28 23:07   
I used this simple test pk3 to test the features. All seem to work seamlessly offline and online.'https://www.dropbox.com/s/y21ary6qxale7ph/timetest.pk3?dl=0 [^]'
(0013336)
cobalt   
2015-08-30 20:53   
Issue addressed by commit cbc13f76b8f1: Added ACS date and time functions SystemTime, GetTimeProperty and Strftime and added a ccmd to override the result value of SystemTime (addresses 2400)
Committed by Teemu Piippo [Dusk] on Sunday 30 August 2015 23:43:28

Changes in files:

 docs/zandronum-history.txt | 1 +
 src/p_acs.cpp | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 123 insertions(+), 0 deletions(-)

(0013423)
Dusk   
2015-09-05 15:06   
Was tested prior to merge