a029a49392
Misc: +Fixes unreported issue with initializing lighting on a specific zlevel +Fixes two similar issues with moveElement and moveRange. Where fromIndex or toIndex could be adjusted incorrectly in certain conditions. Potentially causing bad-sorts, or out of bound errors. +Rewrites listclearnulls(list/L) to no longer iterate through L.len elements for every null in the list (plus 1). i.e. went from L.len*(number_of_nulls+1) list-element reads (best-case), to L.len list-element reads (worst-case) +New proc/getElementByVar(list/L, varname, value) which finds the first datum in a list, with a variable named varname, which equals value. You can also feed it atoms instead of lists due to the way the in operator functions. +Fixes an unreported issue with Yota's list2text rewrite. Under certain conditions, the first element would not be converted into a string. Causing type-mismatch runtimes. +New global map_ready variable. This is not fully implemented yet, but will be used to avoid duplicate calls to initialize() for map objects. +All turfs now maintain references to all lights currently illuminating them. This will mean higher memory use unfortunately, due to the huge number of turfs. However, it will speed up updateAffectingLights significantly. I've used list husbandry to reduce baseline memory usage, so it shouldn't be any worse than some past atmos modifications memory-wise. -Removed 'quadratic lighting', can add this back at some point. Sorry. +modified the way lum() works slightly, to allow turfs to have overridden delta-lumen. i.e. space cannot be illuminated more than its default ambiance. This allowed removal of some iffy special-snowflake lighting areas implemented by somebody else. +Lighting images in the dmi can now use arbitrary naming schemes. It is reliant on order now. This allows the dmi to be replaced by simply dropping in a new dmi. -Removed all subtypes of /area/shuttle. Shuttles now create duplicate 'rooms' of /area/shuttle. (More on this later). This will conflict with most maps. Guide on how to fix to follow. +All verbs/tools relating to world.tick_lag were refactored to use world.fps. However old config text for setting tick_lag will still work (it converts the value to fps for you) +MC stats improved using smoothing. They now have their own tab so they dont get in the way when you're playing as an admin. -removed the push_mob_back stuff due to conflicting changes. Sorry Giacom. _OK, NOW THE ACTUAL INTERESTING STUFF_ Following systems moved over to subsystem datums: air_master garbage_manager lighting_controller process_mobs (aka Life()) nanomanager power sun pipenets AFK kick loops shuttle_controller (aka emergency shuttle/pods), supply_shuttle and other shuttles voting bots radio diseases events jobs objects ticker Subsystems hooks and variables should be commented fairly in-depth. If anything isn't particularly clear, please make an issue. Many system-specific global variables have been refactored into All tickers which previously used world.timeofday now use world.time some subsystems can iterate before round start. this resolves the issue with votes not working pregame
120 lines
4.2 KiB
Plaintext
120 lines
4.2 KiB
Plaintext
//this datum is used by the events controller to dictate how it selects events
|
|
/datum/round_event_control
|
|
var/name //The name human-readable name of the event
|
|
var/typepath //The typepath of the event datum /datum/round_event
|
|
|
|
var/weight = 10 //The weight this event has in the random-selection process.
|
|
//Higher weights are more likely to be picked.
|
|
//10 is the default weight. 20 is twice more likely; 5 is half as likely as this default.
|
|
|
|
var/earliest_start = 12000 //The earliest world.time that an event can start (round-duration in deciseconds) default: 20 mins
|
|
|
|
var/occurrences = 0 //How many times this event has occured
|
|
var/max_occurrences = 20 //The maximum number of times this event can occur (naturally), it can still be forced.
|
|
//By setting this to 0 you can effectively disable an event.
|
|
|
|
var/holidayID //string which should match the events.holiday variable if you wish this event to be holiday-specific
|
|
//anything with a (non-null) holidayID which does not match holiday, cannot run.
|
|
var/wizardevent = 0
|
|
|
|
/datum/round_event_control/wizard
|
|
wizardevent = 1
|
|
|
|
/datum/round_event_control/proc/runEvent()
|
|
if(!ispath(typepath,/datum/round_event))
|
|
return PROCESS_KILL
|
|
var/datum/round_event/E = new typepath()
|
|
E.control = src
|
|
occurrences++
|
|
|
|
testing("[time2text(world.time, "hh:mm:ss")] [E.type]")
|
|
|
|
return E
|
|
|
|
/datum/round_event //NOTE: Times are measured in master controller ticks!
|
|
var/processing = 1
|
|
var/datum/round_event_control/control
|
|
|
|
var/startWhen = 0 //When in the lifetime to call start().
|
|
var/announceWhen = 0 //When in the lifetime to call announce(). Set an event's announceWhen to >0 if there is an announcement.
|
|
var/endWhen = 0 //When in the lifetime the event should end.
|
|
|
|
var/activeFor = 0 //How long the event has existed. You don't need to change this.
|
|
|
|
//Called first before processing.
|
|
//Allows you to setup your event, such as randomly
|
|
//setting the startWhen and or announceWhen variables.
|
|
//Only called once.
|
|
//EDIT: if there's anything you want to override within the new() call, it will not be overridden by the time this proc is called.
|
|
//It will only have been overridden by the time we get to announce() start() tick() or end() (anything but setup basically).
|
|
//This is really only for setting defaults which can be overridden later when New() finishes.
|
|
/datum/round_event/proc/setup()
|
|
return
|
|
|
|
//Called when the tick is equal to the startWhen variable.
|
|
//Allows you to start before announcing or vice versa.
|
|
//Only called once.
|
|
/datum/round_event/proc/start()
|
|
return
|
|
|
|
//Called when the tick is equal to the announceWhen variable.
|
|
//Allows you to announce before starting or vice versa.
|
|
//Only called once.
|
|
/datum/round_event/proc/announce()
|
|
return
|
|
|
|
//Called on or after the tick counter is equal to startWhen.
|
|
//You can include code related to your event or add your own
|
|
//time stamped events.
|
|
//Called more than once.
|
|
/datum/round_event/proc/tick()
|
|
return
|
|
|
|
//Called on or after the tick is equal or more than endWhen
|
|
//You can include code related to the event ending.
|
|
//Do not place spawn() in here, instead use tick() to check for
|
|
//the activeFor variable.
|
|
//For example: if(activeFor == myOwnVariable + 30) doStuff()
|
|
//Only called once.
|
|
/datum/round_event/proc/end()
|
|
return
|
|
|
|
|
|
|
|
//Do not override this proc, instead use the appropiate procs.
|
|
//This proc will handle the calls to the appropiate procs.
|
|
/datum/round_event/proc/process()
|
|
if(!processing)
|
|
return
|
|
|
|
if(activeFor == startWhen)
|
|
start()
|
|
|
|
if(activeFor == announceWhen)
|
|
announce()
|
|
|
|
if(startWhen < activeFor && activeFor < endWhen)
|
|
tick()
|
|
|
|
if(activeFor == endWhen)
|
|
end()
|
|
|
|
// Everything is done, let's clean up.
|
|
if(activeFor >= endWhen && activeFor >= announceWhen && activeFor >= startWhen)
|
|
kill()
|
|
|
|
activeFor++
|
|
|
|
|
|
//Garbage collects the event by removing it from the global events list,
|
|
//which should be the only place it's referenced.
|
|
//Called when start(), announce() and end() has all been called.
|
|
/datum/round_event/proc/kill()
|
|
SSevent.running -= src
|
|
|
|
|
|
//Sets up the event then adds the event to the the list of running events
|
|
/datum/round_event/New()
|
|
setup()
|
|
SSevent.running += src
|
|
return ..() |