Overhauls and 2/28 sync (#244)

* map tweaks/shuttle engines

* helpers and defines

* global/onclick

* controllers and datums

* mapping

* game folder

* some other stuff

* some modules

* modules that aren't mobs

* some mob stuff

* new player stuff

* mob living

* silicon stuff

* simple animal things

* carbon/ayylmao

* update_icons

* carbon/human

* sounds and tools

* icons and stuff

* hippie grinder changes + tgui

* kitchen.dmi

* compile issues fixed

* mapfix

* Mapfixes 2.0

* mapedit2.0

* mapmerger pls

* Revert "mapedit2.0"

This reverts commit 74139a3cacea10df7aafca06c0a10bd3daf3a481.

* clean up vore folder + 2 hotfixes

* admin ticket refinement

* Blob tweaks and LAZYADD

* LAZYADD IS LAZY

* Magic strings purged

* DEFINES NEED HIGHER PRIORITIES

* Only a sleepless idiot deals in absolute TRUE|FALSE

* u h g

* progress bar fix

* reverts ticket logs

* there's always that one guy

* fixes and stuff

* 2/27 fixes

* game folder stuff

* stats

* some modules again

* clothing stuff

gets vg clothing out of the main files

* everything not mobs again

* mob stuff

* maps, tgui, sql stuff

* icons

* additional fixes and compile errors

* don't need this anymore

* Oh right this isn't needed anymore

* maint bar re-added

* that doesn't need to be here

* stupid events

* wtfeven

* probably makes Travis happy

* don't care to fix the grinder atm

* fixes vending sprites, changes turret

* lethal, not lethals

* overylays are finicky creatures

* lazy fix for bleeding edgy (#252)

* map tweaks/shuttle engines

* helpers and defines

* global/onclick

* controllers and datums

* mapping

* game folder

* some other stuff

* some modules

* modules that aren't mobs

* some mob stuff

* new player stuff

* mob living

* silicon stuff

* simple animal things

* carbon/ayylmao

* update_icons

* carbon/human

* sounds and tools

* icons and stuff

* hippie grinder changes + tgui

* kitchen.dmi

* compile issues fixed

* mapfix

* Mapfixes 2.0

* mapedit2.0

* mapmerger pls

* Revert "mapedit2.0"

This reverts commit 74139a3cacea10df7aafca06c0a10bd3daf3a481.

* clean up vore folder + 2 hotfixes

* admin ticket refinement

* Blob tweaks and LAZYADD

* LAZYADD IS LAZY

* Magic strings purged

* DEFINES NEED HIGHER PRIORITIES

* Only a sleepless idiot deals in absolute TRUE|FALSE

* u h g

* progress bar fix

* reverts ticket logs

* there's always that one guy

* fixes and stuff

* 2/27 fixes

* game folder stuff

* stats

* some modules again

* clothing stuff

gets vg clothing out of the main files

* everything not mobs again

* mob stuff

* maps, tgui, sql stuff

* icons

* additional fixes and compile errors

* don't need this anymore

* Oh right this isn't needed anymore

* maint bar re-added

* that doesn't need to be here

* stupid events

* wtfeven

* probably makes Travis happy

* don't care to fix the grinder atm

* fixes vending sprites, changes turret

* lethal, not lethals

* overylays are finicky creatures
This commit is contained in:
Poojawa
2017-02-28 09:30:49 -06:00
committed by GitHub
parent 93782cf716
commit 0bca862419
544 changed files with 309981 additions and 81206 deletions
+7 -10
View File
@@ -10,6 +10,9 @@
var/autoadmin = 0
var/autoadmin_rank = "Game Admin"
/datum/protected_configuration/SDQL_update()
return FALSE
/datum/protected_configuration/vv_get_var(var_name)
return debug_variable(var_name, "SECRET", 0, src)
@@ -76,6 +79,7 @@
var/forumurl = "http://tgstation13.org/phpBB/index.php" //default forums
var/rulesurl = "http://www.tgstation13.org/wiki/Rules" // default rules
var/githuburl = "https://www.github.com/tgstation/-tg-station" //default github
var/githubrepoid
var/forbid_singulo_possession = 0
var/useircbot = 0
@@ -247,15 +251,6 @@
var/error_silence_time = 6000 // How long a unique error will be silenced for
var/error_msg_delay = 50 // How long to wait between messaging admins about occurrences of a unique error
var/mentors_mobname_only = 0 // Only display mob name to mentors in mentorhelps
var/mentor_legacy_system = 0 // Whether to use the legacy mentor system (flat file) instead of SQL
// Discord crap.
var/discord_url = "hfdksjhfa.com"
var/discord_password
var/announce_watchlist = 0
var/announce_adminhelps = 0
/datum/configuration/New()
gamemode_cache = typecacheof(/datum/game_mode,TRUE)
for(var/T in gamemode_cache)
@@ -367,7 +362,7 @@
if("servername")
config.server_name = value
if("serversqlname")
config.server_sql_name = 1
config.server_sql_name = value
if("stationname")
config.station_name = value
if("hostedby")
@@ -384,6 +379,8 @@
config.rulesurl = value
if("githuburl")
config.githuburl = value
if("githubrepoid")
config.githubrepoid = value
if("guest_jobban")
config.guest_jobban = 1
if("guest_ban")
@@ -0,0 +1,8 @@
/datum/configuration
var/mentors_mobname_only = 0 // Only display mob name to mentors in mentorhelps
var/mentor_legacy_system = 0 // Whether to use the legacy mentor system (flat file) instead of SQL
// Discord crap.
var/discord_url = "hfdksjhfa.com"
var/discord_password
var/announce_watchlist = 0
var/announce_adminhelps = 0
+26 -5
View File
@@ -39,6 +39,7 @@ var/CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
var/make_runtime = 0
var/initializations_finished_with_no_players_logged_in //I wonder what this could be?
// Has round started? (So we know what subsystems to run)
var/round_started = 0
@@ -49,6 +50,7 @@ var/CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
var/datum/subsystem/queue_tail //End of queue linked list (used for appending to the list)
var/queue_priority_count = 0 //Running total so that we don't have to loop thru the queue each run to split up the tick
var/queue_priority_count_bg = 0 //Same, but for background subsystems
var/map_loading = FALSE //Are we loading in a new map?
/datum/controller/master/New()
// Highlander-style: there can only be one! Kill off the old and replace it with the new.
@@ -129,24 +131,29 @@ var/CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
// Sort subsystems by init_order, so they initialize in the correct order.
sortTim(subsystems, /proc/cmp_subsystem_init)
var/start_timeofday = REALTIMEOFDAY
// Initialize subsystems.
CURRENT_TICKLIMIT = config.tick_limit_mc_init
for (var/datum/subsystem/SS in subsystems)
if (SS.flags & SS_NO_INIT)
continue
SS.Initialize(world.timeofday)
SS.Initialize(REALTIMEOFDAY)
CHECK_TICK
CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
var/time = (REALTIMEOFDAY - start_timeofday) / 10
world << "<span class='boldannounce'>Initializations complete!</span>"
log_world("Initializations complete.")
var/msg = "Initializations complete within [time] second[time == 1 ? "" : "s"]!"
world << "<span class='boldannounce'>[msg]</span>"
log_world(msg)
// Sort subsystems by display setting for easy access.
sortTim(subsystems, /proc/cmp_subsystem_display)
// Set world options.
world.sleep_offline = 1
world.fps = config.fps
var/initialized_tod = REALTIMEOFDAY
sleep(1)
initializations_finished_with_no_players_logged_in = initialized_tod < REALTIMEOFDAY - 10
// Loop.
Master.StartProcessing(0)
@@ -224,7 +231,7 @@ var/CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
normalsubsystems += tickersubsystems
lobbysubsystems += tickersubsystems
init_timeofday = world.timeofday
init_timeofday = REALTIMEOFDAY
init_time = world.time
iteration = 1
@@ -233,7 +240,7 @@ var/CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
var/list/subsystems_to_check
//the actual loop.
while (1)
tickdrift = max(0, MC_AVERAGE_FAST(tickdrift, (((world.timeofday - init_timeofday) - (world.time - init_time)) / world.tick_lag)))
tickdrift = max(0, MC_AVERAGE_FAST(tickdrift, (((REALTIMEOFDAY - init_timeofday) - (world.time - init_time)) / world.tick_lag)))
if (processing <= 0)
CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
sleep(10)
@@ -496,3 +503,17 @@ var/CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING
stat("Byond:", "(FPS:[world.fps]) (TickCount:[world.time/world.tick_lag]) (TickDrift:[round(Master.tickdrift,1)]([round((Master.tickdrift/(world.time/world.tick_lag))*100,0.1)]%))")
stat("Master Controller:", statclick.update("(TickRate:[Master.processing]) (Iteration:[Master.iteration])"))
/datum/controller/master/proc/StartLoadingMap()
//disallow more than one map to load at once, multithreading it will just cause race conditions
while(map_loading)
stoplag()
for(var/S in subsystems)
var/datum/subsystem/SS = S
SS.StartLoadingMap()
map_loading = TRUE
/datum/controller/master/proc/StopLoadingMap(bounds = null)
map_loading = FALSE
for(var/S in subsystems)
var/datum/subsystem/SS = S
SS.StopLoadingMap()
+8 -3
View File
@@ -154,8 +154,8 @@
//used to initialize the subsystem AFTER the map has loaded
/datum/subsystem/proc/Initialize(start_timeofday)
var/time = (world.timeofday - start_timeofday) / 10
var/msg = "Initialized [name] subsystem within [time] seconds!"
var/time = (REALTIMEOFDAY - start_timeofday) / 10
var/msg = "Initialized [name] subsystem within [time] second[time == 1 ? "" : "s"]!"
world << "<span class='boldannounce'>[msg]</span>"
log_world(msg)
return time
@@ -167,7 +167,7 @@
if(can_fire)
if(can_fire && !(SS_NO_FIRE in flags))
msg = "[round(cost,1)]ms|[round(tick_usage,1)]%|[round(ticks,0.1)]\t[msg]"
else
msg = "OFFLINE\t[msg]"
@@ -211,3 +211,8 @@
return 0
. = ..()
//when we enter dmm_suite.load_map
/datum/subsystem/proc/StartLoadingMap()
//when we exit dmm_suite.load_map
/datum/subsystem/proc/StopLoadingMap()
+1 -2
View File
@@ -34,8 +34,7 @@ var/datum/subsystem/acid/SSacid
if(O.acid_level && O.acid_processing())
else
O.overlays -= acid_overlay
O.priority_overlays -= acid_overlay
O.cut_overlay(acid_overlay, TRUE)
processing -= O
if (MC_TICK_CHECK)
+2 -2
View File
@@ -268,11 +268,11 @@ var/datum/subsystem/air/SSair
else
T.requires_activation = TRUE
/datum/subsystem/air/proc/begin_map_load()
/datum/subsystem/air/StartLoadingMap()
LAZYINITLIST(queued_for_activation)
map_loading = TRUE
/datum/subsystem/air/proc/end_map_load()
/datum/subsystem/air/StopLoadingMap()
map_loading = FALSE
for(var/T in queued_for_activation)
add_to_active(T)
+104
View File
@@ -0,0 +1,104 @@
var/datum/subsystem/atoms/SSatoms
#define INITIALIZATION_INSSATOMS 0 //New should not call Initialize
#define INITIALIZATION_INNEW_MAPLOAD 1 //New should call Initialize(TRUE)
#define INITIALIZATION_INNEW_REGULAR 2 //New should call Initialize(FALSE)
/datum/subsystem/atoms
name = "Atoms"
init_order = 11
flags = SS_NO_FIRE
var/initialized = INITIALIZATION_INSSATOMS
var/old_initialized
/datum/subsystem/atoms/New()
NEW_SS_GLOBAL(SSatoms)
/datum/subsystem/atoms/Initialize(timeofday)
fire_overlay.appearance_flags = RESET_COLOR
setupGenetics() //to set the mutations' place in structural enzymes, so monkey.initialize() knows where to put the monkey mutation.
initialized = INITIALIZATION_INNEW_MAPLOAD
InitializeAtoms()
return ..()
/datum/subsystem/atoms/proc/InitializeAtoms(list/atoms = null)
if(initialized == INITIALIZATION_INSSATOMS)
return
var/list/late_loaders
initialized = INITIALIZATION_INNEW_MAPLOAD
if(atoms)
for(var/I in atoms)
var/atom/A = I
if(!A.initialized) //this check is to make sure we don't call it twice on an object that was created in a previous Initialize call
var/start_tick = world.time
if(A.Initialize(TRUE))
LAZYADD(late_loaders, A)
if(start_tick != world.time)
WARNING("[A]: [A.type] slept during it's Initialize!")
CHECK_TICK
testing("Initialized [atoms.len] atoms")
else
#ifdef TESTING
var/count = 0
#endif
for(var/atom/A in world)
if(!A.initialized) //this check is to make sure we don't call it twice on an object that was created in a previous Initialize call
var/start_tick = world.time
if(A.Initialize(TRUE))
LAZYADD(late_loaders, A)
#ifdef TESTING
else
++count
#endif TESTING
if(start_tick != world.time)
WARNING("[A]: [A.type] slept during it's Initialize!")
CHECK_TICK
testing("Roundstart initialized [count] atoms")
initialized = INITIALIZATION_INNEW_REGULAR
if(late_loaders)
for(var/I in late_loaders)
var/atom/A = I
var/start_tick = world.time
A.Initialize(FALSE)
if(start_tick != world.time)
WARNING("[A]: [A.type] slept during it's Initialize!")
CHECK_TICK
testing("Late-initialized [late_loaders.len] atoms")
/datum/subsystem/atoms/proc/map_loader_begin()
old_initialized = initialized
initialized = INITIALIZATION_INSSATOMS
/datum/subsystem/atoms/proc/map_loader_stop()
initialized = old_initialized
/datum/subsystem/atoms/Recover()
initialized = SSatoms.initialized
if(initialized == INITIALIZATION_INNEW_MAPLOAD)
InitializeAtoms()
old_initialized = SSatoms.old_initialized
/datum/subsystem/atoms/proc/setupGenetics()
var/list/avnums = new /list(DNA_STRUC_ENZYMES_BLOCKS)
for(var/i=1, i<=DNA_STRUC_ENZYMES_BLOCKS, i++)
avnums[i] = i
CHECK_TICK
for(var/A in subtypesof(/datum/mutation/human))
var/datum/mutation/human/B = new A()
if(B.dna_block == NON_SCANNABLE)
continue
B.dna_block = pick_n_take(avnums)
if(B.quality == POSITIVE)
good_mutations |= B
else if(B.quality == NEGATIVE)
bad_mutations |= B
else if(B.quality == MINOR_NEGATIVE)
not_good_mutations |= B
CHECK_TICK
+5 -12
View File
@@ -24,6 +24,7 @@ var/datum/subsystem/garbage_collector/SSgarbage
var/list/didntgc = list() // list of all types that have failed to GC associated with the number of times that's happened.
// the types are stored as strings
var/list/sleptDestroy = list() //Same as above but these are paths that slept during their Destroy call
var/list/noqdelhint = list()// list of all types that do not return a QDEL_HINT
// all types that did not respect qdel(A, force=TRUE) and returned one
@@ -168,13 +169,17 @@ var/datum/subsystem/garbage_collector/SSgarbage
del(D)
else if(isnull(D.gc_destroyed))
D.gc_destroyed = GC_CURRENTLY_BEING_QDELETED
var/start_time = world.time
var/hint = D.Destroy(force) // Let our friend know they're about to get fucked up.
if(world.time != start_time)
SSgarbage.sleptDestroy["[D.type]"]++
if(!D)
return
switch(hint)
if (QDEL_HINT_QUEUE) //qdel should queue the object for deletion.
SSgarbage.QueueForQueuing(D)
if (QDEL_HINT_IWILLGC)
D.gc_destroyed = world.time
return
if (QDEL_HINT_LETMELIVE) //qdel should let the object live after calling destory.
if(!force)
@@ -346,8 +351,6 @@ var/datum/subsystem/garbage_collector/SSgarbage
//if find_references isn't working for some datum
//update this list using tools/DMTreeToGlobalsList
/datum/proc/find_references_in_globals()
SearchVar(last_irc_status)
SearchVar(failed_db_connections)
SearchVar(nextmap)
SearchVar(mapchanging)
SearchVar(rebootingpendingmapchange)
@@ -554,12 +557,6 @@ var/datum/subsystem/garbage_collector/SSgarbage
SearchVar(ruin_landmarks)
SearchVar(awaydestinations)
SearchVar(sortedAreas)
SearchVar(map_templates)
SearchVar(ruins_templates)
SearchVar(space_ruins_templates)
SearchVar(lava_ruins_templates)
SearchVar(shuttle_templates)
SearchVar(shelter_templates)
SearchVar(transit_markers)
SearchVar(clients)
SearchVar(admins)
@@ -684,8 +681,6 @@ var/datum/subsystem/garbage_collector/SSgarbage
SearchVar(wire_colors)
SearchVar(wire_color_directory)
SearchVar(wire_name_directory)
SearchVar(possiblethemes)
SearchVar(max_secret_rooms)
SearchVar(blood_splatter_icons)
SearchVar(all_radios)
SearchVar(radiochannels)
@@ -796,7 +791,6 @@ var/datum/subsystem/garbage_collector/SSgarbage
SearchVar(brass_recipes)
SearchVar(disposalpipeID2State)
SearchVar(RPD_recipes)
SearchVar(highlander_claymores)
SearchVar(biblenames)
SearchVar(biblestates)
SearchVar(bibleitemstates)
@@ -842,7 +836,6 @@ var/datum/subsystem/garbage_collector/SSgarbage
SearchVar(pipenetwarnings)
SearchVar(the_gateway)
SearchVar(potentialRandomZlevels)
SearchVar(maploader)
SearchVar(use_preloader)
SearchVar(_preloader)
SearchVar(swapmaps_iconcache)
+73 -3
View File
@@ -2,13 +2,21 @@ var/datum/subsystem/mapping/SSmapping
/datum/subsystem/mapping
name = "Mapping"
init_order = 13
init_order = 12
flags = SS_NO_FIRE
display_order = 50
var/list/nuke_tiles = list()
var/list/nuke_threats = list()
var/list/map_templates = list()
var/list/ruins_templates = list()
var/list/space_ruins_templates = list()
var/list/lava_ruins_templates = list()
var/list/shuttle_templates = list()
var/list/shelter_templates = list()
/datum/subsystem/mapping/New()
NEW_SS_GLOBAL(SSmapping)
@@ -25,8 +33,6 @@ var/datum/subsystem/mapping/SSmapping
if (mining_type == "lavaland")
seedRuins(list(5), config.lavaland_budget, /area/lavaland/surface/outdoors, lava_ruins_templates)
spawn_rivers()
else
make_mining_asteroid_secrets()
// deep space ruins
var/space_zlevels = list()
@@ -68,3 +74,67 @@ var/datum/subsystem/mapping/SSmapping
/datum/subsystem/mapping/Recover()
flags |= SS_NO_INIT
map_templates = SSmapping.map_templates
ruins_templates = SSmapping.ruins_templates
space_ruins_templates = SSmapping.space_ruins_templates
lava_ruins_templates = SSmapping.lava_ruins_templates
shuttle_templates = SSmapping.shuttle_templates
shelter_templates = SSmapping.shelter_templates
/datum/subsystem/mapping/proc/preloadTemplates(path = "_maps/templates/") //see master controller setup
var/list/filelist = flist(path)
for(var/map in filelist)
var/datum/map_template/T = new(path = "[path][map]", rename = "[map]")
map_templates[T.name] = T
preloadRuinTemplates()
preloadShuttleTemplates()
preloadShelterTemplates()
/datum/subsystem/mapping/proc/preloadRuinTemplates()
// Still supporting bans by filename
var/list/banned = generateMapList("config/lavaruinblacklist.txt")
banned += generateMapList("config/spaceruinblacklist.txt")
for(var/item in subtypesof(/datum/map_template/ruin))
var/datum/map_template/ruin/ruin_type = item
// screen out the abstract subtypes
if(!initial(ruin_type.id))
continue
var/datum/map_template/ruin/R = new ruin_type()
if(banned.Find(R.mappath))
continue
map_templates[R.name] = R
ruins_templates[R.name] = R
if(istype(R, /datum/map_template/ruin/lavaland))
lava_ruins_templates[R.name] = R
else if(istype(R, /datum/map_template/ruin/space))
space_ruins_templates[R.name] = R
/datum/subsystem/mapping/proc/preloadShuttleTemplates()
var/list/unbuyable = generateMapList("config/unbuyableshuttles.txt")
for(var/item in subtypesof(/datum/map_template/shuttle))
var/datum/map_template/shuttle/shuttle_type = item
if(!(initial(shuttle_type.suffix)))
continue
var/datum/map_template/shuttle/S = new shuttle_type()
if(unbuyable.Find(S.mappath))
S.can_be_bought = FALSE
shuttle_templates[S.shuttle_id] = S
map_templates[S.shuttle_id] = S
/datum/subsystem/mapping/proc/preloadShelterTemplates()
for(var/item in subtypesof(/datum/map_template/shelter))
var/datum/map_template/shelter/shelter_type = item
if(!(initial(shelter_type.mappath)))
continue
var/datum/map_template/shelter/S = new shelter_type()
shelter_templates[S.shelter_id] = S
map_templates[S.shelter_id] = S
@@ -1,89 +1,17 @@
var/datum/subsystem/objects/SSobj
#define INITIALIZATION_INSSOBJ 0 //New should not call Initialize
#define INITIALIZATION_INNEW_MAPLOAD 1 //New should call Initialize(TRUE)
#define INITIALIZATION_INNEW_REGULAR 2 //New should call Initialize(FALSE)
/datum/subsystem/objects
name = "Objects"
init_order = 12
priority = 40
flags = SS_NO_INIT
var/initialized = INITIALIZATION_INSSOBJ
var/old_initialized
var/list/processing = list()
var/list/currentrun = list()
/datum/subsystem/objects/New()
NEW_SS_GLOBAL(SSobj)
/datum/subsystem/objects/Initialize(timeofdayl)
fire_overlay.appearance_flags = RESET_COLOR
setupGenetics() //to set the mutations' place in structural enzymes, so monkey.initialize() knows where to put the monkey mutation.
initialized = INITIALIZATION_INNEW_MAPLOAD
InitializeAtoms()
. = ..()
/datum/subsystem/objects/proc/InitializeAtoms(list/objects = null)
if(initialized == INITIALIZATION_INSSOBJ)
return
var/list/late_loaders
initialized = INITIALIZATION_INNEW_MAPLOAD
if(objects)
for(var/I in objects)
var/atom/A = I
if(!A.initialized) //this check is to make sure we don't call it twice on an object that was created in a previous Initialize call
var/start_tick = world.time
if(A.Initialize(TRUE))
LAZYADD(late_loaders, A)
if(start_tick != world.time)
WARNING("[A]: [A.type] slept during it's Initialize!")
CHECK_TICK
testing("Initialized [objects.len] atoms")
else
#ifdef TESTING
var/count = 0
#endif
for(var/atom/A in world)
if(!A.initialized) //this check is to make sure we don't call it twice on an object that was created in a previous Initialize call
var/start_tick = world.time
if(A.Initialize(TRUE))
LAZYADD(late_loaders, A)
#ifdef TESTING
else
++count
#endif TESTING
if(start_tick != world.time)
WARNING("[A]: [A.type] slept during it's Initialize!")
CHECK_TICK
testing("Roundstart initialized [count] atoms")
initialized = INITIALIZATION_INNEW_REGULAR
if(late_loaders)
for(var/I in late_loaders)
var/atom/A = I
var/start_tick = world.time
A.Initialize(FALSE)
if(start_tick != world.time)
WARNING("[A]: [A.type] slept during it's Initialize!")
CHECK_TICK
testing("Late-initialized [late_loaders.len] atoms")
/datum/subsystem/objects/proc/map_loader_begin()
old_initialized = initialized
initialized = INITIALIZATION_INSSOBJ
/datum/subsystem/objects/proc/map_loader_stop()
initialized = old_initialized
/datum/subsystem/objects/stat_entry()
..("P:[processing.len]")
/datum/subsystem/objects/fire(resumed = 0)
if (!resumed)
src.currentrun = processing.Copy()
@@ -101,10 +29,4 @@ var/datum/subsystem/objects/SSobj
return
/datum/subsystem/objects/Recover()
initialized = SSobj.initialized
if(initialized == INITIALIZATION_INNEW_MAPLOAD)
InitializeAtoms()
old_initialized = SSobj.old_initialized
if (istype(SSobj.processing))
processing = SSobj.processing
processing = SSobj.processing
@@ -0,0 +1,183 @@
var/datum/subsystem/processing/overlays/SSoverlays
/datum/subsystem/processing/overlays
name = "Overlay"
flags = SS_TICKER|SS_FIRE_IN_LOBBY
wait = 1
priority = 500
init_order = -6
stat_tag = "Ov"
currentrun = null
var/list/overlay_icon_state_caches
var/initialized = FALSE
/datum/subsystem/processing/overlays/New()
NEW_SS_GLOBAL(SSoverlays)
LAZYINITLIST(overlay_icon_state_caches)
/datum/subsystem/processing/overlays/Initialize()
initialized = TRUE
for(var/I in processing)
var/atom/A = I
A.compile_overlays()
CHECK_TICK
processing.Cut()
..()
/datum/subsystem/processing/overlays/Recover()
overlay_icon_state_caches = SSoverlays.overlay_icon_state_caches
processing = SSoverlays.processing
/datum/subsystem/processing/overlays/fire()
while(processing.len)
var/atom/thing = processing[processing.len]
processing.len--
if(thing)
thing.compile_overlays(FALSE)
if(MC_TICK_CHECK)
break
/atom/proc/compile_overlays()
if(LAZYLEN(priority_overlays) && LAZYLEN(our_overlays))
overlays = our_overlays + priority_overlays
else if(LAZYLEN(our_overlays))
overlays = our_overlays
else if(LAZYLEN(priority_overlays))
overlays = priority_overlays
else
overlays.Cut()
flags &= ~OVERLAY_QUEUED
/atom/proc/iconstate2appearance(iconstate)
var/static/image/stringbro = new()
var/list/icon_states_cache = SSoverlays.overlay_icon_state_caches
var/list/cached_icon = icon_states_cache[icon]
if (cached_icon)
var/cached_appearance = cached_icon["[iconstate]"]
if (cached_appearance)
return cached_appearance
stringbro.icon = icon
stringbro.icon_state = iconstate
if (!cached_icon) //not using the macro to save an associated lookup
cached_icon = list()
icon_states_cache[icon] = cached_icon
var/cached_appearance = stringbro.appearance
cached_icon["[iconstate]"] = cached_appearance
return cached_appearance
#define NOT_QUEUED_ALREADY (!(flags & OVERLAY_QUEUED))
#define QUEUE_FOR_COMPILE flags |= OVERLAY_QUEUED; SSoverlays.processing += src;
/atom/proc/cut_overlays(priority = FALSE)
var/list/cached_overlays = our_overlays
var/list/cached_priority = priority_overlays
var/need_compile = FALSE
if(LAZYLEN(cached_overlays)) //don't queue empty lists, don't cut priority overlays
cached_overlays.Cut() //clear regular overlays
need_compile = TRUE
if(priority && LAZYLEN(cached_priority))
cached_priority.Cut()
need_compile = TRUE
if(NOT_QUEUED_ALREADY && need_compile)
QUEUE_FOR_COMPILE
/atom/proc/cut_overlay(list/overlays, priority)
var/static/image/appearance_bro = new()
if(!overlays)
return
if (!islist(overlays))
overlays = list(overlays)
else
listclearnulls(overlays)
for (var/i in 1 to length(overlays))
if (istext(overlays[i]))
overlays[i] = iconstate2appearance(overlays[i])
else
var/image/I = overlays[i]
appearance_bro.appearance = overlays[i]
appearance_bro.dir = I.dir
overlays[i] = appearance_bro.appearance
var/list/cached_overlays = our_overlays //sanic
var/list/cached_priority = priority_overlays
var/init_o_len = LAZYLEN(cached_overlays)
var/init_p_len = LAZYLEN(cached_priority) //starter pokemon
LAZYREMOVE(cached_overlays, overlays)
if(priority)
LAZYREMOVE(cached_priority, overlays)
if(NOT_QUEUED_ALREADY && ((init_o_len != LAZYLEN(cached_priority)) || (init_p_len != LAZYLEN(cached_overlays))))
QUEUE_FOR_COMPILE
/atom/proc/add_overlay(list/overlays, priority = FALSE)
var/static/image/appearance_bro = new()
if(!overlays)
return
if (!islist(overlays))
overlays = list(overlays)
else
listclearnulls(overlays)
for (var/i in 1 to length(overlays))
if (istext(overlays[i]))
overlays[i] = iconstate2appearance(overlays[i])
else
var/image/I = overlays[i]
appearance_bro.appearance = overlays[i]
appearance_bro.dir = I.dir
overlays[i] = appearance_bro.appearance
LAZYINITLIST(our_overlays) //always initialized after this point
LAZYINITLIST(priority_overlays)
var/list/cached_overlays = our_overlays //sanic
var/list/cached_priority = priority_overlays
var/init_o_len = cached_overlays.len
var/init_p_len = cached_priority.len //starter pokemon
var/need_compile
if(priority)
cached_priority += overlays //or in the image. Can we use [image] = image?
need_compile = init_p_len != cached_priority.len
else
cached_overlays += overlays
need_compile = init_o_len != cached_overlays.len
if(NOT_QUEUED_ALREADY && need_compile) //have we caught more pokemon?
QUEUE_FOR_COMPILE
/atom/proc/copy_overlays(atom/other, cut_old = FALSE) //copys our_overlays from another atom
if(!other)
if(cut_old)
cut_overlays()
return
var/list/cached_other = other.our_overlays
if(cached_other)
if(cut_old)
our_overlays = cached_other.Copy()
else
our_overlays |= cached_other
if(NOT_QUEUED_ALREADY)
QUEUE_FOR_COMPILE
else if(cut_old)
cut_overlays()
#undef NOT_QUEUED_ALREADY
#undef QUEUE_FOR_COMPILE
//TODO: Better solution for these?
/image/proc/add_overlay(x)
overlays += x
/image/proc/cut_overlay(x)
overlays -= x
/image/proc/cut_overlays(x)
overlays.Cut()
+37 -11
View File
@@ -1,10 +1,12 @@
#define ROUND_START_MUSIC_LIST "strings/round_start_sounds.txt"
var/round_start_time = 0
var/datum/subsystem/ticker/ticker
/datum/subsystem/ticker
name = "Ticker"
init_order = 0
init_order = 13
priority = 200
flags = SS_FIRE_IN_LOBBY|SS_KEEP_TIMING
@@ -39,7 +41,8 @@ var/datum/subsystem/ticker/ticker
var/tipped = 0 //Did we broadcast the tip of the day yet?
var/selected_tip // What will be the tip of the day?
var/timeLeft = 1200 //pregame timer
var/timeLeft //pregame timer
var/start_at
var/totalPlayers = 0 //used for pregame stats on statpanel
var/totalPlayersReady = 0 //used for pregame stats on statpanel
@@ -57,30 +60,36 @@ var/datum/subsystem/ticker/ticker
/datum/subsystem/ticker/New()
NEW_SS_GLOBAL(ticker)
login_music = pickweight(list('sound/ambience/title2.ogg' = 15, 'sound/ambience/title1.ogg' =15, 'sound/ambience/title3.ogg' =14, 'sound/ambience/title4.ogg' =14, 'sound/misc/i_did_not_grief_them.ogg' =14, 'sound/ambience/clown.ogg' = 9)) // choose title music!
if(SSevent.holidays && SSevent.holidays[APRIL_FOOLS])
login_music = 'sound/ambience/clown.ogg'
else
var/list/music = file2list(ROUND_START_MUSIC_LIST, "\n")
login_music = pick(music)
/datum/subsystem/ticker/Initialize(timeofday)
var/list/music = file2list(ROUND_START_MUSIC_LIST, "\n")
login_music = pick(music)
if(!syndicate_code_phrase)
syndicate_code_phrase = generate_code_phrase()
if(!syndicate_code_response)
syndicate_code_response = generate_code_phrase()
..()
start_at = world.time + (config.lobby_countdown * 10)
/datum/subsystem/ticker/fire()
switch(current_state)
if(GAME_STATE_STARTUP)
timeLeft = config.lobby_countdown * 10
world << "<span class='boldnotice'>Welcome to [station_name()]!</span>"
world << "Please set up your character and select \"Ready\". The game will start in [config.lobby_countdown] seconds."
current_state = GAME_STATE_PREGAME
if(Master.initializations_finished_with_no_players_logged_in)
start_at = world.time + (config.lobby_countdown * 10)
for(var/client/C in clients)
window_flash(C, ignorepref = TRUE) //let them know lobby has opened up.
world << "<span class='boldnotice'>Welcome to [station_name()]!</span>"
current_state = GAME_STATE_PREGAME
fire()
if(GAME_STATE_PREGAME)
//lobby stats for statpanels
if(isnull(timeLeft))
timeLeft = max(0,start_at - world.time)
totalPlayers = 0
totalPlayersReady = 0
for(var/mob/new_player/player in player_list)
@@ -96,7 +105,7 @@ var/datum/subsystem/ticker/ticker
return
timeLeft -= wait
if(timeLeft <= 1200 && !modevoted) //Vote for the round type
if(timeLeft <= config.lobby_countdown && !modevoted) //Vote for the round type
send_gamemode_vote()
modevoted = TRUE
@@ -551,11 +560,17 @@ var/datum/subsystem/ticker/ticker
CHECK_TICK
//Adds the del() log to world.log in a format condensable by the runtime condenser found in tools
if(SSgarbage.didntgc.len)
if(SSgarbage.didntgc.len || SSgarbage.sleptDestroy.len)
var/dellog = ""
for(var/path in SSgarbage.didntgc)
dellog += "Path : [path] \n"
dellog += "Failures : [SSgarbage.didntgc[path]] \n"
if(path in SSgarbage.sleptDestroy)
dellog += "Sleeps : [SSgarbage.sleptDestroy[path]] \n"
SSgarbage.sleptDestroy -= path
for(var/path in SSgarbage.sleptDestroy)
dellog += "Path : [path] \n"
dellog += "Sleeps : [SSgarbage.sleptDestroy[path]] \n"
log_world(dellog)
CHECK_TICK
@@ -716,3 +731,14 @@ var/datum/subsystem/ticker/ticker
if(news_message)
send2otherserver(news_source, news_message,"News_Report")
/datum/subsystem/ticker/proc/GetTimeLeft()
if(isnull(ticker.timeLeft))
return max(0, start_at - world.time)
return timeLeft
/datum/subsystem/ticker/proc/SetTimeLeft(newtime)
if(newtime >= 0 && isnull(timeLeft)) //remember, negative means delayed
start_at = world.time + newtime
else
timeLeft = newtime
+29 -18
View File
@@ -40,20 +40,18 @@ var/datum/subsystem/timer/SStimer
..("B:[bucket_count] P:[length(processing)] H:[length(hashes)] C:[length(clienttime_timers)]")
/datum/subsystem/timer/fire(resumed = FALSE)
if (length(clienttime_timers))
for (var/thing in clienttime_timers)
var/datum/timedevent/ctime_timer = thing
if (ctime_timer.spent)
qdel(ctime_timer)
continue
if (ctime_timer.timeToRun <= REALTIMEOFDAY)
var/datum/callback/callBack = ctime_timer.callBack
ctime_timer.spent = TRUE
callBack.InvokeAsync()
qdel(ctime_timer)
if (MC_TICK_CHECK)
return
while(length(clienttime_timers))
var/datum/timedevent/ctime_timer = clienttime_timers[clienttime_timers.len]
if (ctime_timer.timeToRun <= REALTIMEOFDAY)
--clienttime_timers.len
var/datum/callback/callBack = ctime_timer.callBack
ctime_timer.spent = TRUE
callBack.InvokeAsync()
qdel(ctime_timer)
else
break //None of the rest are ready to run
if (MC_TICK_CHECK)
return
var/static/list/spent = list()
var/static/datum/timedevent/timer
@@ -208,11 +206,24 @@ var/datum/subsystem/timer/SStimer
SStimer.timer_id_dict["timerid[id]"] = src
if (callBack.object != GLOBAL_PROC)
LAZYINITLIST(callBack.object.active_timers)
callBack.object.active_timers += src
LAZYADD(callBack.object.active_timers, src)
if (flags & TIMER_CLIENT_TIME)
SStimer.clienttime_timers += src
//sorted insert
var/list/ctts = SStimer.clienttime_timers
var/cttl = length(ctts)
if(cttl)
var/datum/timedevent/Last = ctts[cttl]
if(Last.timeToRun >= timeToRun)
ctts += src
else if(cttl > 1)
for(var/I in cttl to 1)
var/datum/timedevent/E = ctts[I]
if(E.timeToRun <= timeToRun)
ctts.Insert(src, I)
break
else
ctts += src
return
//get the list of buckets
@@ -345,4 +356,4 @@ proc/addtimer(datum/callback/callback, wait, flags)
#undef BUCKET_LEN
#undef BUCKET_POS
#undef BUCKET_POS