mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-19 02:54:41 +01:00
Merge branch 'master' into hook-kill-v10-final-ultimate-final
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#define AFK_WARNED 1
|
||||
#define AFK_CRYOD 2
|
||||
#define AFK_WARNED 1
|
||||
#define AFK_CRYOD 2
|
||||
#define AFK_ADMINS_WARNED 3
|
||||
|
||||
SUBSYSTEM_DEF(afk)
|
||||
name = "AFK Watcher"
|
||||
@@ -7,24 +8,28 @@ SUBSYSTEM_DEF(afk)
|
||||
flags = SS_BACKGROUND
|
||||
offline_implications = "Players will no longer be marked as AFK. No immediate action is needed."
|
||||
var/list/afk_players = list() // Associative list. ckey as key and AFK state as value
|
||||
var/list/non_cryo_antags
|
||||
|
||||
|
||||
/datum/controller/subsystem/afk/Initialize()
|
||||
if(config.warn_afk_minimum <= 0 || config.auto_cryo_afk <= 0 || config.auto_despawn_afk <= 0)
|
||||
flags |= SS_NO_FIRE
|
||||
if(config.warn_afk_minimum <= 0 || config.auto_cryo_afk <= 0 || config.auto_despawn_afk <= 0)
|
||||
flags |= SS_NO_FIRE
|
||||
else
|
||||
non_cryo_antags = list(SPECIAL_ROLE_ABDUCTOR_AGENT, SPECIAL_ROLE_ABDUCTOR_SCIENTIST, \
|
||||
SPECIAL_ROLE_SHADOWLING, SPECIAL_ROLE_WIZARD, SPECIAL_ROLE_WIZARD_APPRENTICE, SPECIAL_ROLE_NUKEOPS)
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/afk/fire()
|
||||
var/list/toRemove = list()
|
||||
for(var/mob/living/carbon/human/H in GLOB.living_mob_list)
|
||||
if(!H.ckey) // Useless non ckey creatures
|
||||
for(var/mob/living/carbon/human/H in GLOB.alive_mob_list)
|
||||
if(!H?.ckey) // Useless non ckey creatures
|
||||
continue
|
||||
|
||||
var/turf/T
|
||||
// Only players and players with the AFK watch enabled
|
||||
// No dead, unconcious, restrained, people without jobs, people on other Z levels than the station or antags
|
||||
// No dead, unconcious, restrained, people without jobs or people on other Z levels than the station
|
||||
if(!H.client || !H.client.prefs.afk_watch || !H.mind || \
|
||||
H.stat || H.restrained() || !H.job || H.mind.special_role || \
|
||||
!is_station_level((T = get_turf(H)).z)) // Assign the turf as last. Small optimization
|
||||
H.stat || H.restrained() || !H.job || !is_station_level((T = get_turf(H)).z)) // Assign the turf as last. Small optimization
|
||||
if(afk_players[H.ckey])
|
||||
toRemove += H.ckey
|
||||
continue
|
||||
@@ -45,19 +50,26 @@ SUBSYSTEM_DEF(afk)
|
||||
if(A.fast_despawn)
|
||||
toRemove += H.ckey
|
||||
warn(H, "<span class='danger'>You are have been despawned after being AFK for [mins_afk] minutes. You have been despawned instantly due to you being in a secure area.</span>")
|
||||
msg_admins(H, mins_afk, T, "forcefully despawned", "AFK in a fast despawn area")
|
||||
log_afk_action(H, mins_afk, T, "despawned", "AFK in a fast despawn area")
|
||||
force_cryo_human(H)
|
||||
else if(cryo_ssd(H))
|
||||
afk_players[H.ckey] = AFK_CRYOD
|
||||
msg_admins(H, mins_afk, T, "put into cryostorage")
|
||||
warn(H, "<span class='danger'>You are AFK for [mins_afk] minutes and have been moved to cryostorage. After being AFK for [config.auto_despawn_afk] total minutes you will be fully despawned. Please eject yourself (right click, eject) out of the cryostorage if you want to avoid being despawned.</span>")
|
||||
else
|
||||
if(!(H.mind.special_role in non_cryo_antags))
|
||||
if(cryo_ssd(H))
|
||||
H.create_log(MISC_LOG, "Put into cryostorage by the AFK subsystem")
|
||||
afk_players[H.ckey] = AFK_CRYOD
|
||||
log_afk_action(H, mins_afk, T, "put into cryostorage")
|
||||
warn(H, "<span class='danger'>You are AFK for [mins_afk] minutes and have been moved to cryostorage. \
|
||||
After being AFK for another [config.auto_despawn_afk] minutes you will be fully despawned. \
|
||||
Please eject yourself (right click, eject) out of the cryostorage if you want to avoid being despawned.</span>")
|
||||
else
|
||||
message_admins("[key_name_admin(H)] at ([get_area(T).name] [ADMIN_JMP(T)]) is AFK for [mins_afk] and can't be automatically cryod due to it's antag status: ([H.mind.special_role]).")
|
||||
afk_players[H.ckey] = AFK_ADMINS_WARNED
|
||||
|
||||
else if(mins_afk >= config.auto_despawn_afk)
|
||||
var/obj/machinery/cryopod/P = H.loc
|
||||
msg_admins(H, mins_afk, T, "forcefully despawned")
|
||||
else if(afk_players[H.ckey] != AFK_ADMINS_WARNED && mins_afk >= config.auto_despawn_afk)
|
||||
log_afk_action(H, mins_afk, T, "despawned")
|
||||
warn(H, "<span class='danger'>You are have been despawned after being AFK for [mins_afk] minutes.</span>")
|
||||
toRemove += H.ckey
|
||||
P.despawn_occupant()
|
||||
force_cryo_human(H)
|
||||
|
||||
removeFromWatchList(toRemove)
|
||||
|
||||
@@ -67,9 +79,8 @@ SUBSYSTEM_DEF(afk)
|
||||
if(H.client)
|
||||
window_flash(H.client)
|
||||
|
||||
/datum/controller/subsystem/afk/proc/msg_admins(mob/living/carbon/human/H, mins_afk, turf/location, action, info)
|
||||
/datum/controller/subsystem/afk/proc/log_afk_action(mob/living/carbon/human/H, mins_afk, turf/location, action, info)
|
||||
log_admin("[key_name(H)] has been [action] by the AFK Watcher subsystem after being AFK for [mins_afk] minutes.[info ? " Extra info:" + info : ""]")
|
||||
message_admins("[key_name_admin(H)] at ([get_area(location).name] [ADMIN_JMP(location)]) has been [action] by the AFK Watcher subsystem after being AFK for [mins_afk] minutes.[info ? " Extra info:" + info : ""]")
|
||||
|
||||
/datum/controller/subsystem/afk/proc/removeFromWatchList(list/toRemove)
|
||||
for(var/C in toRemove)
|
||||
@@ -80,3 +91,4 @@ SUBSYSTEM_DEF(afk)
|
||||
|
||||
#undef AFK_WARNED
|
||||
#undef AFK_CRYOD
|
||||
#undef AFK_ADMINS_WARNED
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
PROCESSING_SUBSYSTEM_DEF(dcs)
|
||||
name = "Datum Component System"
|
||||
flags = SS_NO_INIT
|
||||
|
||||
var/list/elements_by_type = list()
|
||||
|
||||
/datum/controller/subsystem/processing/dcs/Recover()
|
||||
comp_lookup = SSdcs.comp_lookup
|
||||
|
||||
/datum/controller/subsystem/processing/dcs/proc/GetElement(list/arguments)
|
||||
var/datum/element/eletype = arguments[1]
|
||||
var/element_id = eletype
|
||||
|
||||
if(!ispath(eletype, /datum/element))
|
||||
CRASH("Attempted to instantiate [eletype] as a /datum/element")
|
||||
|
||||
if(initial(eletype.element_flags) & ELEMENT_BESPOKE)
|
||||
element_id = GetIdFromArguments(arguments)
|
||||
|
||||
. = elements_by_type[element_id]
|
||||
if(.)
|
||||
return
|
||||
. = elements_by_type[element_id] = new eletype
|
||||
|
||||
/****
|
||||
* Generates an id for bespoke elements when given the argument list
|
||||
* Generating the id here is a bit complex because we need to support named arguments
|
||||
* Named arguments can appear in any order and we need them to appear after ordered arguments
|
||||
* We assume that no one will pass in a named argument with a value of null
|
||||
**/
|
||||
/datum/controller/subsystem/processing/dcs/proc/GetIdFromArguments(list/arguments)
|
||||
var/datum/element/eletype = arguments[1]
|
||||
var/list/fullid = list("[eletype]")
|
||||
var/list/named_arguments = list()
|
||||
for(var/i in initial(eletype.id_arg_index) to length(arguments))
|
||||
var/key = arguments[i]
|
||||
var/value
|
||||
if(istext(key))
|
||||
value = arguments[key]
|
||||
if(!(istext(key) || isnum(key)))
|
||||
key = "\ref[key]"
|
||||
key = "[key]" // Key is stringified so numbers dont break things
|
||||
if(!isnull(value))
|
||||
if(!(istext(value) || isnum(value)))
|
||||
value = "\ref[value]"
|
||||
named_arguments["[key]"] = value
|
||||
else
|
||||
fullid += "[key]"
|
||||
|
||||
if(length(named_arguments))
|
||||
named_arguments = sortList(named_arguments)
|
||||
fullid += named_arguments
|
||||
return list2params(fullid)
|
||||
@@ -121,3 +121,8 @@ SUBSYSTEM_DEF(input)
|
||||
for(var/i in 1 to clients.len)
|
||||
var/client/C = clients[i]
|
||||
C.keyLoop()
|
||||
|
||||
/datum/controller/subsystem/input/Recover()
|
||||
macro_sets = SSinput.macro_sets
|
||||
movement_keys = SSinput.movement_keys
|
||||
alt_movement_keys = SSinput.alt_movement_keys
|
||||
|
||||
@@ -497,13 +497,14 @@ SUBSYSTEM_DEF(jobs)
|
||||
job.after_spawn(H)
|
||||
|
||||
//Gives glasses to the vision impaired
|
||||
if(H.disabilities & DISABILITY_FLAG_NEARSIGHTED)
|
||||
if(NEARSIGHTED in H.mutations)
|
||||
var/equipped = H.equip_to_slot_or_del(new /obj/item/clothing/glasses/regular(H), slot_glasses)
|
||||
if(equipped != 1)
|
||||
var/obj/item/clothing/glasses/G = H.glasses
|
||||
if(istype(G) && !G.prescription)
|
||||
G.prescription = 1
|
||||
G.prescription = TRUE
|
||||
G.name = "prescription [G.name]"
|
||||
H.update_nearsighted_effects()
|
||||
return H
|
||||
|
||||
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
GLOBAL_LIST_EMPTY(lighting_update_lights) // List of lighting sources queued for update.
|
||||
GLOBAL_LIST_EMPTY(lighting_update_corners) // List of lighting corners queued for update.
|
||||
GLOBAL_LIST_EMPTY(lighting_update_objects) // List of lighting objects queued for update.
|
||||
|
||||
SUBSYSTEM_DEF(lighting)
|
||||
name = "Lighting"
|
||||
wait = 2
|
||||
init_order = INIT_ORDER_LIGHTING
|
||||
flags = SS_TICKER
|
||||
offline_implications = "Lighting will no longer update. Shuttle call recommended."
|
||||
var/static/list/sources_queue = list() // List of lighting sources queued for update.
|
||||
var/static/list/corners_queue = list() // List of lighting corners queued for update.
|
||||
var/static/list/objects_queue = list() // List of lighting objects queued for update.
|
||||
|
||||
/datum/controller/subsystem/lighting/stat_entry()
|
||||
..("L:[GLOB.lighting_update_lights.len]|C:[GLOB.lighting_update_corners.len]|O:[GLOB.lighting_update_objects.len]")
|
||||
..("L:[length(sources_queue)]|C:[length(corners_queue)]|O:[length(objects_queue)]")
|
||||
|
||||
/datum/controller/subsystem/lighting/Initialize(timeofday)
|
||||
if(!initialized)
|
||||
@@ -31,9 +30,10 @@ SUBSYSTEM_DEF(lighting)
|
||||
MC_SPLIT_TICK_INIT(3)
|
||||
if(!init_tick_checks)
|
||||
MC_SPLIT_TICK
|
||||
var/list/queue = sources_queue
|
||||
var/i = 0
|
||||
for(i in 1 to GLOB.lighting_update_lights.len)
|
||||
var/datum/light_source/L = GLOB.lighting_update_lights[i]
|
||||
for(i in 1 to length(queue))
|
||||
var/datum/light_source/L = queue[i]
|
||||
|
||||
L.update_corners()
|
||||
|
||||
@@ -44,14 +44,15 @@ SUBSYSTEM_DEF(lighting)
|
||||
else if(MC_TICK_CHECK)
|
||||
break
|
||||
if(i)
|
||||
GLOB.lighting_update_lights.Cut(1, i+1)
|
||||
queue.Cut(1, i + 1)
|
||||
i = 0
|
||||
|
||||
if(!init_tick_checks)
|
||||
MC_SPLIT_TICK
|
||||
|
||||
for (i in 1 to GLOB.lighting_update_corners.len)
|
||||
var/datum/lighting_corner/C = GLOB.lighting_update_corners[i]
|
||||
queue = corners_queue
|
||||
for(i in 1 to length(queue))
|
||||
var/datum/lighting_corner/C = queue[i]
|
||||
|
||||
C.update_objects()
|
||||
C.needs_update = FALSE
|
||||
@@ -60,15 +61,16 @@ SUBSYSTEM_DEF(lighting)
|
||||
else if(MC_TICK_CHECK)
|
||||
break
|
||||
if(i)
|
||||
GLOB.lighting_update_corners.Cut(1, i+1)
|
||||
queue.Cut(1, i + 1)
|
||||
i = 0
|
||||
|
||||
|
||||
if(!init_tick_checks)
|
||||
MC_SPLIT_TICK
|
||||
|
||||
for (i in 1 to GLOB.lighting_update_objects.len)
|
||||
var/atom/movable/lighting_object/O = GLOB.lighting_update_objects[i]
|
||||
queue = objects_queue
|
||||
for(i in 1 to length(queue))
|
||||
var/atom/movable/lighting_object/O = queue[i]
|
||||
|
||||
if(QDELETED(O))
|
||||
continue
|
||||
@@ -80,7 +82,7 @@ SUBSYSTEM_DEF(lighting)
|
||||
else if(MC_TICK_CHECK)
|
||||
break
|
||||
if(i)
|
||||
GLOB.lighting_update_objects.Cut(1, i+1)
|
||||
queue.Cut(1, i + 1)
|
||||
|
||||
|
||||
/datum/controller/subsystem/lighting/Recover()
|
||||
|
||||
@@ -11,7 +11,7 @@ SUBSYSTEM_DEF(mobs)
|
||||
var/static/list/cubemonkeys = list()
|
||||
|
||||
/datum/controller/subsystem/mobs/stat_entry()
|
||||
..("P:[GLOB.mob_list.len]")
|
||||
..("P:[GLOB.mob_living_list.len]")
|
||||
|
||||
/datum/controller/subsystem/mobs/Initialize(start_timeofday)
|
||||
clients_by_zlevel = new /list(world.maxz,0)
|
||||
@@ -21,17 +21,17 @@ SUBSYSTEM_DEF(mobs)
|
||||
/datum/controller/subsystem/mobs/fire(resumed = 0)
|
||||
var/seconds = wait * 0.1
|
||||
if(!resumed)
|
||||
src.currentrun = GLOB.mob_list.Copy()
|
||||
src.currentrun = GLOB.mob_living_list.Copy()
|
||||
|
||||
//cache for sanic speed (lists are references anyways)
|
||||
var/list/currentrun = src.currentrun
|
||||
var/times_fired = src.times_fired
|
||||
while(currentrun.len)
|
||||
var/mob/M = currentrun[currentrun.len]
|
||||
var/mob/living/L = currentrun[currentrun.len]
|
||||
currentrun.len--
|
||||
if(M)
|
||||
M.Life(seconds, times_fired)
|
||||
if(L)
|
||||
L.Life(seconds, times_fired)
|
||||
else
|
||||
GLOB.mob_list.Remove(M)
|
||||
GLOB.mob_living_list.Remove(L)
|
||||
if(MC_TICK_CHECK)
|
||||
return
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
SUBSYSTEM_DEF(statistics)
|
||||
name = "Statistics"
|
||||
wait = 6000 // 10 minute delay between fires
|
||||
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME // Only count time actually ingame to avoid logging pre-round dips
|
||||
offline_implications = "Player count and admin count statistics will no longer be logged to the database. No immediate action is needed."
|
||||
|
||||
|
||||
/datum/controller/subsystem/statistics/Initialize(start_timeofday)
|
||||
if(!config.sql_enabled)
|
||||
flags |= SS_NO_FIRE // Disable firing if SQL is disabled
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/statistics/fire(resumed = 0)
|
||||
sql_poll_players()
|
||||
|
||||
/datum/controller/subsystem/statistics/proc/sql_poll_players()
|
||||
if(!config.sql_enabled)
|
||||
return
|
||||
var/playercount = GLOB.clients.len
|
||||
var/admincount = GLOB.admins.len
|
||||
if(!GLOB.dbcon.IsConnected())
|
||||
log_game("SQL ERROR during player polling. Failed to connect.")
|
||||
else
|
||||
var/sqltime = time2text(world.realtime, "YYYY-MM-DD hh:mm:ss")
|
||||
var/DBQuery/query = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("legacy_population")] (playercount, admincount, time) VALUES ([playercount], [admincount], '[sqltime]')")
|
||||
if(!query.Execute())
|
||||
var/err = query.ErrorMsg()
|
||||
log_game("SQL ERROR during playercount polling. Error: \[[err]\]\n")
|
||||
@@ -29,7 +29,7 @@ SUBSYSTEM_DEF(ticker)
|
||||
var/pregame_timeleft // This is used for calculations
|
||||
var/delay_end = 0 //if set to nonzero, the round will not restart on it's own
|
||||
var/triai = 0//Global holder for Triumvirate
|
||||
var/initialtpass = 0 //holder for inital autotransfer vote timer
|
||||
var/next_autotransfer = 0 //holder for inital autotransfer vote timer
|
||||
var/obj/screen/cinematic = null //used for station explosion cinematic
|
||||
var/round_end_announced = 0 // Spam Prevention. Announce round end only once.
|
||||
var/ticker_going = TRUE // This used to be in the unused globals, but it turns out its actually used in a load of places. Its now a ticker var because its related to round stuff, -aa
|
||||
@@ -90,6 +90,11 @@ SUBSYSTEM_DEF(ticker)
|
||||
delay_end = 0 // reset this in case round start was delayed
|
||||
mode.process()
|
||||
mode.process_job_tasks()
|
||||
|
||||
if(world.time > next_autotransfer)
|
||||
SSvote.autotransfer()
|
||||
next_autotransfer = world.time + config.vote_autotransfer_interval
|
||||
|
||||
var/game_finished = SSshuttle.emergency.mode >= SHUTTLE_ENDGAME || mode.station_was_nuked
|
||||
if(config.continuous_rounds)
|
||||
mode.check_finished() // some modes contain var-changing code in here, so call even if we don't uses result
|
||||
@@ -111,19 +116,6 @@ SUBSYSTEM_DEF(ticker)
|
||||
else
|
||||
world.Reboot("Round ended.", "end_proper", "proper completion")
|
||||
|
||||
|
||||
/datum/controller/subsystem/ticker/proc/votetimer()
|
||||
var/timerbuffer = 0
|
||||
if(initialtpass == 0)
|
||||
timerbuffer = config.vote_autotransfer_initial
|
||||
else
|
||||
timerbuffer = config.vote_autotransfer_interval
|
||||
spawn(timerbuffer)
|
||||
SSvote.autotransfer()
|
||||
initialtpass = 1
|
||||
votetimer()
|
||||
|
||||
|
||||
/datum/controller/subsystem/ticker/proc/setup()
|
||||
cultdat = setupcult()
|
||||
//Create and announce mode
|
||||
@@ -288,11 +280,8 @@ SUBSYSTEM_DEF(ticker)
|
||||
auto_toggle_ooc(0) // Turn it off
|
||||
round_start_time = world.time
|
||||
|
||||
if(config.sql_enabled)
|
||||
spawn(3000)
|
||||
statistic_cycle() // Polls population totals regularly and stores them in an SQL DB
|
||||
|
||||
votetimer()
|
||||
// Sets the auto shuttle vote to happen after the config duration
|
||||
next_autotransfer = world.time + config.vote_autotransfer_initial
|
||||
|
||||
for(var/mob/new_player/N in GLOB.mob_list)
|
||||
if(N.client)
|
||||
|
||||
@@ -160,7 +160,7 @@ SUBSYSTEM_DEF(timer)
|
||||
|
||||
if(timer.timeToRun < head_offset)
|
||||
bucket_resolution = null //force bucket recreation
|
||||
CRASH("[i] Invalid timer state: Timer in long run queue with a time to run less then head_offset. [get_timer_debug_string(timer)] world.time: [world.time], head_offset: [head_offset], practical_offset: [practical_offset]")
|
||||
stack_trace("[i] Invalid timer state: Timer in long run queue with a time to run less then head_offset. [get_timer_debug_string(timer)] world.time: [world.time], head_offset: [head_offset], practical_offset: [practical_offset]")
|
||||
|
||||
if(timer.callBack && !timer.spent)
|
||||
timer.callBack.InvokeAsync()
|
||||
@@ -172,7 +172,7 @@ SUBSYSTEM_DEF(timer)
|
||||
|
||||
if(timer.timeToRun < head_offset + TICKS2DS(practical_offset-1))
|
||||
bucket_resolution = null //force bucket recreation
|
||||
CRASH("[i] Invalid timer state: Timer in long run queue that would require a backtrack to transfer to short run queue. [get_timer_debug_string(timer)] world.time: [world.time], head_offset: [head_offset], practical_offset: [practical_offset]")
|
||||
stack_trace("[i] Invalid timer state: Timer in long run queue that would require a backtrack to transfer to short run queue. [get_timer_debug_string(timer)] world.time: [world.time], head_offset: [head_offset], practical_offset: [practical_offset]")
|
||||
if(timer.callBack && !timer.spent)
|
||||
timer.callBack.InvokeAsync()
|
||||
spent += timer
|
||||
|
||||
@@ -20,7 +20,7 @@ SUBSYSTEM_DEF(weather)
|
||||
var/datum/weather/W = V
|
||||
if(W.aesthetic || W.stage != MAIN_STAGE)
|
||||
continue
|
||||
for(var/i in GLOB.living_mob_list)
|
||||
for(var/i in GLOB.mob_living_list)
|
||||
var/mob/living/L = i
|
||||
if(W.can_weather_act(L))
|
||||
W.weather_act(L)
|
||||
@@ -57,7 +57,6 @@ SUBSYSTEM_DEF(weather)
|
||||
break
|
||||
if(!ispath(weather_datum_type, /datum/weather))
|
||||
CRASH("run_weather called with invalid weather_datum_type: [weather_datum_type || "null"]")
|
||||
return
|
||||
|
||||
if(isnull(z_levels))
|
||||
z_levels = levels_by_trait(initial(weather_datum_type.target_trait))
|
||||
@@ -65,7 +64,6 @@ SUBSYSTEM_DEF(weather)
|
||||
z_levels = list(z_levels)
|
||||
else if(!islist(z_levels))
|
||||
CRASH("run_weather called with invalid z_levels: [z_levels || "null"]")
|
||||
return
|
||||
|
||||
var/datum/weather/W = new weather_datum_type(z_levels)
|
||||
W.telegraph()
|
||||
|
||||
Reference in New Issue
Block a user