mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Fuck this shit
Merge branch 'release' of https://github.com/VOREStation/VOREStation # Conflicts: # code/controllers/autotransfer.dm # code/controllers/subsystems/inactivity.dm # code/game/area/Away Mission areas.dm # code/game/area/Space Station 13 areas.dm # code/game/jobs/job/captain.dm # code/game/jobs/job/civilian.dm # code/game/jobs/job/security.dm # code/game/jobs/jobs.dm # code/game/machinery/air_alarm.dm # code/game/machinery/suit_storage_unit.dm # code/game/machinery/suit_storage_unit_vr.dm # code/game/mecha/combat/gorilla.dm # code/game/turfs/simulated/dungeon/wall.dm # code/game/turfs/simulated/wall_types.dm # code/modules/client/preference_setup/loadout/loadout_utility_vr.dm # code/modules/clothing/glasses/glasses.dm # code/modules/clothing/spacesuits/rig/rig_pieces_vr.dm # code/modules/clothing/spacesuits/void/void_vr.dm # code/modules/clothing/under/accessories/holster.dm # code/modules/mob/language/station_vr.dm # code/modules/mob/living/carbon/human/emote_vr.dm # code/modules/mob/living/carbon/human/species/station/station_vr.dm # code/modules/mob/living/carbon/human/species/station/traits_vr/positive.dm # code/modules/mob/new_player/sprite_accessories_vr.dm # code/modules/power/apc.dm # code/modules/power/lighting.dm # code/modules/resleeving/machines.dm # config/jobwhitelist.txt # icons/mob/species/seromi/head.dmi # icons/mob/species/seromi/suit.dmi # icons/mob/species/vulpkanin/helmet.dmi # icons/mob/species/vulpkanin/suit.dmi # maps/tether/submaps/_tether_submaps.dm # maps/tether/tether_areas2.dm # maps/tether/tether_defines.dm # maps/tether/tether_shuttles.dm # nano/templates/apc.tmpl # vorestation.dme
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
|
||||
// We manually initialize the alarm handlers instead of looping over all existing types
|
||||
// to make it possible to write: camera.triggerAlarm() rather than alarm_manager.managers[datum/alarm_handler/camera].triggerAlarm() or a variant thereof.
|
||||
/var/global/datum/alarm_handler/atmosphere/atmosphere_alarm = new()
|
||||
/var/global/datum/alarm_handler/camera/camera_alarm = new()
|
||||
/var/global/datum/alarm_handler/fire/fire_alarm = new()
|
||||
/var/global/datum/alarm_handler/motion/motion_alarm = new()
|
||||
/var/global/datum/alarm_handler/power/power_alarm = new()
|
||||
|
||||
// Alarm Manager, the manager for alarms.
|
||||
var/datum/controller/process/alarm/alarm_manager
|
||||
|
||||
/datum/controller/process/alarm
|
||||
var/list/datum/alarm/all_handlers = list()
|
||||
|
||||
/datum/controller/process/alarm/setup()
|
||||
name = "alarm"
|
||||
schedule_interval = 20 // every 2 seconds
|
||||
all_handlers = list(atmosphere_alarm, camera_alarm, fire_alarm, motion_alarm, power_alarm)
|
||||
alarm_manager = src
|
||||
|
||||
/datum/controller/process/alarm/doWork()
|
||||
for(last_object in all_handlers)
|
||||
var/datum/alarm_handler/AH = last_object
|
||||
AH.process()
|
||||
SCHECK
|
||||
|
||||
/datum/controller/process/alarm/proc/active_alarms()
|
||||
var/list/all_alarms = new
|
||||
for(var/datum/alarm_handler/AH in all_handlers)
|
||||
var/list/alarms = AH.alarms
|
||||
all_alarms += alarms
|
||||
|
||||
return all_alarms
|
||||
|
||||
/datum/controller/process/alarm/proc/number_of_active_alarms()
|
||||
var/list/alarms = active_alarms()
|
||||
return alarms.len
|
||||
|
||||
/datum/controller/process/alarm/statProcess()
|
||||
..()
|
||||
stat(null, "[number_of_active_alarms()] alarm\s")
|
||||
@@ -9,17 +9,17 @@ datum/controller/transfer_controller/New()
|
||||
timerbuffer = config.vote_autotransfer_initial
|
||||
shift_hard_end = config.vote_autotransfer_initial + (config.vote_autotransfer_interval * config.vote_autotransfer_amount) //YW Edit: made that '1' a config //VOREStation Edit //Change this "1" to how many extend votes you want there to be.
|
||||
shift_last_vote = shift_hard_end - config.vote_autotransfer_interval //VOREStation Edit
|
||||
START_PROCESSING(SSobj, src)
|
||||
START_PROCESSING(SSprocessing, src)
|
||||
|
||||
datum/controller/transfer_controller/Destroy()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
|
||||
datum/controller/transfer_controller/process()
|
||||
currenttick = currenttick + 1
|
||||
//VOREStation Edit START
|
||||
if (round_duration_in_ticks >= shift_last_vote - 2 MINUTES)
|
||||
shift_last_vote = 999999999999 //Setting to a stupidly high number since it'll be not used again.
|
||||
world << "Warning: This upcoming round-extend vote will be your ONLY extend vote. Wrap up your scenes in the next 4 fuckin hours if the round is extended." //YAWN EDIT NIGGA VOREStation Edit
|
||||
to_world("Warning: This upcoming round-extend vote will be your ONLY extend vote. Wrap up your scenes in the next 4 fuckin hours if the round is extended.") //YAWN EDIT NIGGA VOREStation Edit
|
||||
if (round_duration_in_ticks >= shift_hard_end - 1 MINUTE)
|
||||
init_shift_change(null, 1)
|
||||
shift_hard_end = timerbuffer + config.vote_autotransfer_interval //If shuttle somehow gets recalled, let's force it to call again next time a vote would occur.
|
||||
|
||||
@@ -31,6 +31,7 @@ var/list/gamemode_cache = list()
|
||||
var/allow_admin_jump = 1 // allows admin jumping
|
||||
var/allow_admin_spawning = 1 // allows admin item spawning
|
||||
var/allow_admin_rev = 1 // allows admin revives
|
||||
var/pregame_time = 180 // pregame time in seconds
|
||||
var/vote_delay = 6000 // minimum time between voting sessions (deciseconds, 10 minute default)
|
||||
var/vote_period = 600 // length of voting period (deciseconds, default 1 minute)
|
||||
var/vote_autotransfer_initial = 108000 // Length of time before the first autotransfer vote is called
|
||||
@@ -264,6 +265,10 @@ var/list/gamemode_cache = list()
|
||||
var/sqlite_feedback_cooldown = 0 // How long one must wait, in days, to submit another feedback form. Used to help prevent spam, especially with privacy active. 0 = No limit.
|
||||
var/sqlite_feedback_min_age = 0 // Used to block new people from giving feedback. This metric is very bad but it can help slow down spammers.
|
||||
|
||||
// disables the annoying "You have already logged in this round, disconnect or be banned" popup for multikeying, because it annoys the shit out of me when testing.
|
||||
var/disable_cid_warn_popup = FALSE
|
||||
|
||||
|
||||
/datum/configuration/New()
|
||||
var/list/L = typesof(/datum/game_mode) - /datum/game_mode
|
||||
for (var/T in L)
|
||||
@@ -421,6 +426,9 @@ var/list/gamemode_cache = list()
|
||||
if ("default_no_vote")
|
||||
config.vote_no_default = 1
|
||||
|
||||
if ("pregame_time")
|
||||
config.pregame_time = text2num(value)
|
||||
|
||||
if ("vote_delay")
|
||||
config.vote_delay = text2num(value)
|
||||
|
||||
@@ -873,7 +881,8 @@ var/list/gamemode_cache = list()
|
||||
if("sqlite_feedback_cooldown")
|
||||
config.sqlite_feedback_cooldown = text2num(value)
|
||||
|
||||
|
||||
if("disable_cid_warn_popup")
|
||||
config.disable_cid_warn_popup = TRUE
|
||||
|
||||
else
|
||||
log_misc("Unknown setting in configuration: '[name]'")
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
var/global/datum/emergency_shuttle_controller/emergency_shuttle
|
||||
|
||||
/datum/emergency_shuttle_controller
|
||||
var/datum/shuttle/ferry/emergency/shuttle
|
||||
var/datum/shuttle/autodock/ferry/emergency/shuttle // Set in shuttle_emergency.dm TODO - is it really?
|
||||
var/list/escape_pods
|
||||
|
||||
var/launch_time //the time at which the shuttle will be launched
|
||||
@@ -36,8 +36,8 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
|
||||
if (!shuttle.location) //leaving from the station
|
||||
//launch the pods!
|
||||
for (var/EP in escape_pods)
|
||||
var/datum/shuttle/ferry/escape_pod/pod
|
||||
if(istype(escape_pods[EP], /datum/shuttle/ferry/escape_pod))
|
||||
var/datum/shuttle/autodock/ferry/escape_pod/pod
|
||||
if(istype(escape_pods[EP], /datum/shuttle/autodock/ferry/escape_pod))
|
||||
pod = escape_pods[EP]
|
||||
else
|
||||
continue
|
||||
@@ -63,8 +63,8 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
|
||||
//arm the escape pods
|
||||
if (evac)
|
||||
for (var/EP in escape_pods)
|
||||
var/datum/shuttle/ferry/escape_pod/pod
|
||||
if(istype(escape_pods[EP], /datum/shuttle/ferry/escape_pod))
|
||||
var/datum/shuttle/autodock/ferry/escape_pod/pod
|
||||
if(istype(escape_pods[EP], /datum/shuttle/autodock/ferry/escape_pod))
|
||||
pod = escape_pods[EP]
|
||||
else
|
||||
continue
|
||||
@@ -215,11 +215,11 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
|
||||
|
||||
//returns 1 if the shuttle is currently in transit (or just leaving) to the station
|
||||
/datum/emergency_shuttle_controller/proc/going_to_station()
|
||||
return (!shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE)
|
||||
return shuttle && (!shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE)
|
||||
|
||||
//returns 1 if the shuttle is currently in transit (or just leaving) to centcom
|
||||
/datum/emergency_shuttle_controller/proc/going_to_centcom()
|
||||
return (shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE)
|
||||
return shuttle && (shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE)
|
||||
|
||||
|
||||
/datum/emergency_shuttle_controller/proc/get_status_panel_eta()
|
||||
|
||||
@@ -52,6 +52,7 @@ var/datum/controller/failsafe/Failsafe
|
||||
if(Master.processing && Master.iteration)
|
||||
// Check if processing is done yet.
|
||||
if(Master.iteration == master_iteration)
|
||||
log_debug("DEFCON [defcon]: Master.iteration=[Master.iteration] Master.last_run=[Master.last_run] world.time=[world.time]")
|
||||
switch(defcon)
|
||||
if(4,5)
|
||||
--defcon
|
||||
@@ -71,7 +72,7 @@ var/datum/controller/failsafe/Failsafe
|
||||
master_iteration = 0
|
||||
to_chat(admins, "<span class='adminnotice'>MC restarted successfully</span>")
|
||||
else if(rtn < 0)
|
||||
log_game("FailSafe: Could not restart MC, runtime encountered. Entering defcon 0")
|
||||
log_world("FailSafe: Could not restart MC, runtime encountered. Entering defcon 0")
|
||||
to_chat(admins, "<span class='boldannounce'>ERROR: DEFCON [defcon_pretty()]. Could not restart MC, runtime encountered. I will silently keep retrying.</span>")
|
||||
//if the return number was 0, it just means the mc was restarted too recently, and it just needs some time before we try again
|
||||
//no need to handle that specially when defcon 0 can handle it
|
||||
|
||||
@@ -50,6 +50,8 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
|
||||
|
||||
var/current_runlevel //for scheduling different subsystems for different stages of the round
|
||||
|
||||
var/dbg_is_running_subsystem = FALSE // TEMPORARY DEBUGGING - true only while we are actually waiting on a subsystem
|
||||
|
||||
var/static/restart_clear = 0
|
||||
var/static/restart_timeout = 0
|
||||
var/static/restart_count = 0
|
||||
@@ -198,7 +200,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
|
||||
#else
|
||||
world.sleep_offline = 1
|
||||
#endif
|
||||
world.fps = config.fps
|
||||
world.change_fps(config.fps)
|
||||
var/initialized_tod = REALTIMEOFDAY
|
||||
sleep(1)
|
||||
initializations_finished_with_no_players_logged_in = initialized_tod < REALTIMEOFDAY - 10
|
||||
@@ -223,10 +225,12 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
|
||||
//loop ended, restart the mc
|
||||
log_game("MC crashed or runtimed, restarting")
|
||||
message_admins("MC crashed or runtimed, restarting")
|
||||
log_world("MC crashed or runtimed, restarting")
|
||||
var/rtn2 = Recreate_MC()
|
||||
if (rtn2 <= 0)
|
||||
log_game("Failed to recreate MC (Error code: [rtn2]), it's up to the failsafe now")
|
||||
message_admins("Failed to recreate MC (Error code: [rtn2]), it's up to the failsafe now")
|
||||
log_world("Failed to recreate MC (Error code: [rtn2]), it's up to the failsafe now")
|
||||
Failsafe.defcon = 2
|
||||
|
||||
// Main loop.
|
||||
@@ -338,6 +342,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
|
||||
subsystems_to_check = tickersubsystems
|
||||
|
||||
if (CheckQueue(subsystems_to_check) <= 0)
|
||||
log_world("MC: CheckQueue(subsystems_to_check) exited uncleanly, SoftReset (error_level=[error_level]")
|
||||
if (!SoftReset(tickersubsystems, runlevel_sorted_subsystems))
|
||||
log_world("MC: SoftReset() failed, crashing")
|
||||
return
|
||||
@@ -350,6 +355,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
|
||||
|
||||
if (queue_head)
|
||||
if (RunQueue() <= 0)
|
||||
log_world("MC: RunQueue() exited uncleanly, running SoftReset (error_level=[error_level]")
|
||||
if (!SoftReset(tickersubsystems, runlevel_sorted_subsystems))
|
||||
log_world("MC: SoftReset() failed, crashing")
|
||||
return
|
||||
@@ -472,9 +478,11 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
|
||||
|
||||
queue_node.state = SS_RUNNING
|
||||
|
||||
dbg_is_running_subsystem = TRUE // TEMPORARY DEBUGGING
|
||||
tick_usage = TICK_USAGE
|
||||
var/state = queue_node.ignite(queue_node_paused)
|
||||
tick_usage = TICK_USAGE - tick_usage
|
||||
dbg_is_running_subsystem = FALSE // TEMPORARY DEBUGGING
|
||||
|
||||
if (state == SS_RUNNING)
|
||||
state = SS_IDLE
|
||||
|
||||
@@ -25,7 +25,7 @@ SUBSYSTEM_DEF(ai)
|
||||
// var/mob/living/L = currentrun[currentrun.len]
|
||||
var/datum/ai_holder/A = currentrun[currentrun.len]
|
||||
--currentrun.len
|
||||
if(!A || QDELETED(A)) // Doesn't exist or won't exist soon.
|
||||
if(!A || QDELETED(A) || A.busy) // Doesn't exist or won't exist soon or not doing it this tick
|
||||
continue
|
||||
if(times_fired % 4 == 0 && A.holder.stat != DEAD)
|
||||
A.handle_strategicals()
|
||||
|
||||
@@ -38,7 +38,7 @@ SUBSYSTEM_DEF(air)
|
||||
|
||||
current_cycle = 0
|
||||
var/simulated_turf_count = 0
|
||||
for(var/turf/simulated/S in turfs)
|
||||
for(var/turf/simulated/S in world)
|
||||
simulated_turf_count++
|
||||
S.update_air_properties()
|
||||
CHECK_TICK
|
||||
|
||||
45
code/controllers/subsystems/alarm.dm
Normal file
45
code/controllers/subsystems/alarm.dm
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
// We manually initialize the alarm handlers instead of looping over all existing types
|
||||
// to make it possible to write: camera_alarm.triggerAlarm() rather than SSalarm.managers[datum/alarm_handler/camera].triggerAlarm() or a variant thereof.
|
||||
/var/global/datum/alarm_handler/atmosphere/atmosphere_alarm = new()
|
||||
/var/global/datum/alarm_handler/camera/camera_alarm = new()
|
||||
/var/global/datum/alarm_handler/fire/fire_alarm = new()
|
||||
/var/global/datum/alarm_handler/motion/motion_alarm = new()
|
||||
/var/global/datum/alarm_handler/power/power_alarm = new()
|
||||
|
||||
SUBSYSTEM_DEF(alarm)
|
||||
name = "Alarm"
|
||||
wait = 2 SECONDS
|
||||
priority = FIRE_PRIORITY_ALARM
|
||||
init_order = INIT_ORDER_ALARM
|
||||
var/list/datum/alarm/all_handlers
|
||||
var/tmp/list/currentrun = null
|
||||
var/static/list/active_alarm_cache = list()
|
||||
|
||||
/datum/controller/subsystem/alarm/Initialize()
|
||||
all_handlers = list(atmosphere_alarm, camera_alarm, fire_alarm, motion_alarm, power_alarm)
|
||||
. = ..()
|
||||
|
||||
/datum/controller/subsystem/alarm/fire(resumed = FALSE)
|
||||
if(!resumed)
|
||||
src.currentrun = all_handlers.Copy()
|
||||
active_alarm_cache.Cut()
|
||||
|
||||
var/list/currentrun = src.currentrun // Cache for sanic speed
|
||||
while (currentrun.len)
|
||||
var/datum/alarm_handler/AH = currentrun[currentrun.len]
|
||||
currentrun.len--
|
||||
AH.process()
|
||||
active_alarm_cache += AH.alarms
|
||||
|
||||
if (MC_TICK_CHECK)
|
||||
return
|
||||
|
||||
/datum/controller/subsystem/alarm/proc/active_alarms()
|
||||
return active_alarm_cache.Copy()
|
||||
|
||||
/datum/controller/subsystem/alarm/proc/number_of_active_alarms()
|
||||
return active_alarm_cache.len
|
||||
|
||||
/datum/controller/subsystem/alarm/stat_entry()
|
||||
..("[number_of_active_alarms()] alarm\s")
|
||||
@@ -8,9 +8,9 @@ SUBSYSTEM_DEF(atoms)
|
||||
init_order = INIT_ORDER_ATOMS
|
||||
flags = SS_NO_FIRE
|
||||
|
||||
var/initialized = INITIALIZATION_INSSATOMS
|
||||
var/static/initialized = INITIALIZATION_INSSATOMS
|
||||
// var/list/created_atoms // This is never used, so don't bother. ~Leshana
|
||||
var/old_initialized
|
||||
var/static/old_initialized
|
||||
|
||||
var/list/late_loaders
|
||||
var/list/created_atoms
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
#define SSBELLIES_PROCESSED 1
|
||||
#define SSBELLIES_IGNORED 2
|
||||
|
||||
//
|
||||
// Bellies subsystem - Process vore bellies
|
||||
//
|
||||
|
||||
SUBSYSTEM_DEF(bellies)
|
||||
name = "Bellies"
|
||||
priority = 5
|
||||
wait = 1 SECONDS
|
||||
flags = SS_KEEP_TIMING|SS_NO_INIT
|
||||
runlevels = RUNLEVEL_GAME|RUNLEVEL_POSTGAME
|
||||
|
||||
var/static/list/belly_list = list()
|
||||
var/list/currentrun = list()
|
||||
var/ignored_bellies = 0
|
||||
|
||||
/datum/controller/subsystem/bellies/stat_entry()
|
||||
..("#: [belly_list.len] | P: [ignored_bellies]")
|
||||
|
||||
/datum/controller/subsystem/bellies/fire(resumed = 0)
|
||||
if (!resumed)
|
||||
ignored_bellies = 0
|
||||
src.currentrun = belly_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/obj/belly/B = currentrun[currentrun.len]
|
||||
currentrun.len--
|
||||
|
||||
if(QDELETED(B))
|
||||
belly_list -= B
|
||||
else
|
||||
if(B.process_belly(times_fired,wait) == SSBELLIES_IGNORED)
|
||||
ignored_bellies++
|
||||
|
||||
if (MC_TICK_CHECK)
|
||||
return
|
||||
@@ -1,6 +1,8 @@
|
||||
SUBSYSTEM_DEF(events)
|
||||
name = "Events"
|
||||
wait = 20
|
||||
wait = 2 SECONDS
|
||||
|
||||
var/tmp/list/currentrun = null
|
||||
|
||||
var/list/datum/event/active_events = list()
|
||||
var/list/datum/event/finished_events = list()
|
||||
@@ -11,23 +13,37 @@ SUBSYSTEM_DEF(events)
|
||||
var/datum/event_meta/new_event = new
|
||||
|
||||
/datum/controller/subsystem/events/Initialize()
|
||||
allEvents = typesof(/datum/event) - /datum/event
|
||||
event_containers = list(
|
||||
EVENT_LEVEL_MUNDANE = new/datum/event_container/mundane,
|
||||
EVENT_LEVEL_MODERATE = new/datum/event_container/moderate,
|
||||
EVENT_LEVEL_MAJOR = new/datum/event_container/major
|
||||
)
|
||||
allEvents = typesof(/datum/event) - /datum/event
|
||||
if(global.using_map.use_overmap)
|
||||
GLOB.overmap_event_handler.create_events(global.using_map.overmap_z, global.using_map.overmap_size, global.using_map.overmap_event_areas)
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/events/fire(resumed)
|
||||
for(var/datum/event/E in active_events)
|
||||
if (!resumed)
|
||||
src.currentrun = active_events.Copy()
|
||||
|
||||
//cache for sanic speed (lists are references anyways)
|
||||
var/list/currentrun = src.currentrun
|
||||
while (currentrun.len)
|
||||
var/datum/event/E = currentrun[currentrun.len]
|
||||
currentrun.len--
|
||||
if(E.processing_active)
|
||||
E.process()
|
||||
if (MC_TICK_CHECK)
|
||||
return
|
||||
|
||||
for(var/i = EVENT_LEVEL_MUNDANE to EVENT_LEVEL_MAJOR)
|
||||
var/list/datum/event_container/EC = event_containers[i]
|
||||
EC.process()
|
||||
|
||||
/datum/controller/subsystem/events/stat_entry()
|
||||
..("E:[active_events.len]")
|
||||
|
||||
/datum/controller/subsystem/events/Recover()
|
||||
if(SSevents.active_events)
|
||||
active_events |= SSevents.active_events
|
||||
@@ -35,6 +51,8 @@ SUBSYSTEM_DEF(events)
|
||||
finished_events |= SSevents.finished_events
|
||||
|
||||
/datum/controller/subsystem/events/proc/event_complete(var/datum/event/E)
|
||||
active_events -= E
|
||||
|
||||
if(!E.event_meta || !E.severity) // datum/event is used here and there for random reasons, maintaining "backwards compatibility"
|
||||
log_debug("Event of '[E.type]' with missing meta-data has completed.")
|
||||
return
|
||||
@@ -50,7 +68,7 @@ SUBSYSTEM_DEF(events)
|
||||
log_debug("Event '[EM.name]' has completed at [stationtime2text()].")
|
||||
|
||||
/datum/controller/subsystem/events/proc/delay_events(var/severity, var/delay)
|
||||
var/list/datum/event_container/EC = event_containers[severity]
|
||||
var/datum/event_container/EC = event_containers[severity]
|
||||
EC.next_event_time += delay
|
||||
|
||||
/datum/controller/subsystem/events/proc/RoundEnd()
|
||||
|
||||
@@ -15,8 +15,7 @@ SUBSYSTEM_DEF(inactivity)
|
||||
while(client_list.len)
|
||||
var/client/C = client_list[client_list.len]
|
||||
client_list.len--
|
||||
if(!C.holder && C.is_afk(config.kick_inactive MINUTES) && !isobserver(C.mob))
|
||||
|
||||
if(C.is_afk(config.kick_inactive MINUTES) && can_kick(C))
|
||||
to_chat(C, "<span class='warning'>You have been inactive for more than [config.kick_inactive] minute\s and have been disconnected.</span>")
|
||||
|
||||
var/information
|
||||
@@ -34,6 +33,9 @@ SUBSYSTEM_DEF(inactivity)
|
||||
if(job)
|
||||
information = " while [job]."
|
||||
|
||||
else if(isobserver(C.mob))
|
||||
information = " while a ghost."
|
||||
|
||||
else if(issilicon(C.mob))
|
||||
information = " while a silicon."
|
||||
if(isAI(C.mob))
|
||||
@@ -55,4 +57,8 @@ SUBSYSTEM_DEF(inactivity)
|
||||
return
|
||||
|
||||
/datum/controller/subsystem/inactivity/stat_entry()
|
||||
..("Kicked: [number_kicked]")
|
||||
..("Kicked: [number_kicked]")
|
||||
|
||||
/datum/controller/subsystem/inactivity/proc/can_kick(var/client/C)
|
||||
if(C.holder) return FALSE //VOREStation Add - Don't kick admins.
|
||||
return TRUE
|
||||
|
||||
142
code/controllers/subsystems/job.dm
Normal file
142
code/controllers/subsystems/job.dm
Normal file
@@ -0,0 +1,142 @@
|
||||
SUBSYSTEM_DEF(job)
|
||||
name = "Job"
|
||||
init_order = INIT_ORDER_JOB
|
||||
flags = SS_NO_FIRE
|
||||
|
||||
var/list/occupations = list() //List of all jobs
|
||||
var/list/datum/job/name_occupations = list() //Dict of all jobs, keys are titles
|
||||
var/list/type_occupations = list() //Dict of all jobs, keys are types
|
||||
|
||||
var/list/department_datums = list()
|
||||
var/debug_messages = FALSE
|
||||
|
||||
|
||||
/datum/controller/subsystem/job/Initialize(timeofday)
|
||||
if(!department_datums.len)
|
||||
setup_departments()
|
||||
if(!occupations.len)
|
||||
setup_occupations()
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/job/proc/setup_occupations(faction = "Station")
|
||||
occupations = list()
|
||||
var/list/all_jobs = subtypesof(/datum/job)
|
||||
if(!all_jobs.len)
|
||||
to_chat(world, span("warning", "Error setting up jobs, no job datums found"))
|
||||
return FALSE
|
||||
|
||||
for(var/J in all_jobs)
|
||||
var/datum/job/job = new J()
|
||||
if(!job)
|
||||
continue
|
||||
if(job.faction != faction)
|
||||
continue
|
||||
occupations += job
|
||||
name_occupations[job.title] = job
|
||||
type_occupations[J] = job
|
||||
if(LAZYLEN(job.departments))
|
||||
add_to_departments(job)
|
||||
|
||||
sortTim(occupations, /proc/cmp_job_datums)
|
||||
for(var/D in department_datums)
|
||||
var/datum/department/dept = department_datums[D]
|
||||
sortTim(dept.jobs, /proc/cmp_job_datums, TRUE)
|
||||
sortTim(dept.primary_jobs, /proc/cmp_job_datums, TRUE)
|
||||
|
||||
return TRUE
|
||||
|
||||
/datum/controller/subsystem/job/proc/add_to_departments(datum/job/J)
|
||||
// Adds to the regular job lists in the departments, which allow multiple departments for a job.
|
||||
for(var/D in J.departments)
|
||||
var/datum/department/dept = LAZYACCESS(department_datums, D)
|
||||
if(!istype(dept))
|
||||
job_debug_message("Job '[J.title]' is defined as being inside department '[D]', but it does not exist.")
|
||||
continue
|
||||
dept.jobs[J.title] = J
|
||||
|
||||
// Now for the 'primary' department for a job, which is defined as being the first department in the list for a job.
|
||||
// This results in no duplicates, which can be useful in some situations.
|
||||
if(LAZYLEN(J.departments))
|
||||
var/primary_department = J.departments[1]
|
||||
var/datum/department/dept = LAZYACCESS(department_datums, primary_department)
|
||||
if(!istype(dept))
|
||||
job_debug_message("Job '[J.title]' has their primary department be '[primary_department]', but it does not exist.")
|
||||
else
|
||||
dept.primary_jobs[J.title] = J
|
||||
|
||||
/datum/controller/subsystem/job/proc/setup_departments()
|
||||
for(var/t in subtypesof(/datum/department))
|
||||
var/datum/department/D = new t()
|
||||
department_datums[D.name] = D
|
||||
|
||||
sortTim(department_datums, /proc/cmp_department_datums, TRUE)
|
||||
|
||||
/datum/controller/subsystem/job/proc/get_all_department_datums()
|
||||
var/list/dept_datums = list()
|
||||
for(var/D in department_datums)
|
||||
dept_datums += department_datums[D]
|
||||
return dept_datums
|
||||
|
||||
/datum/controller/subsystem/job/proc/get_job(rank)
|
||||
if(!occupations.len)
|
||||
setup_occupations()
|
||||
return name_occupations[rank]
|
||||
|
||||
/datum/controller/subsystem/job/proc/get_job_type(jobtype)
|
||||
if(!occupations.len)
|
||||
setup_occupations()
|
||||
return type_occupations[jobtype]
|
||||
|
||||
// Determines if a job title is inside of a specific department.
|
||||
// Useful to replace the old `if(job_title in command_positions)` code.
|
||||
/datum/controller/subsystem/job/proc/is_job_in_department(rank, target_department_name)
|
||||
var/datum/department/D = LAZYACCESS(department_datums, target_department_name)
|
||||
if(istype(D))
|
||||
return LAZYFIND(D.jobs, rank) ? TRUE : FALSE
|
||||
return FALSE
|
||||
|
||||
// Returns a list of all job names in a specific department.
|
||||
/datum/controller/subsystem/job/proc/get_job_titles_in_department(target_department_name)
|
||||
var/datum/department/D = LAZYACCESS(department_datums, target_department_name)
|
||||
if(istype(D))
|
||||
var/list/job_titles = list()
|
||||
for(var/J in D.jobs)
|
||||
job_titles += J
|
||||
return job_titles
|
||||
|
||||
job_debug_message("Was asked to get job titles for a non-existant department '[target_department_name]'.")
|
||||
return list()
|
||||
|
||||
// Returns a reference to the primary department datum that a job is in.
|
||||
// Can receive job datum refs, typepaths, or job title strings.
|
||||
/datum/controller/subsystem/job/proc/get_primary_department_of_job(datum/job/J)
|
||||
if(!istype(J, /datum/job))
|
||||
if(ispath(J))
|
||||
J = get_job_type(J)
|
||||
else if(istext(J))
|
||||
J = get_job(J)
|
||||
|
||||
if(!istype(J))
|
||||
job_debug_message("Was asked to get department for job '[J]', but input could not be resolved into a job datum.")
|
||||
return
|
||||
|
||||
if(!LAZYLEN(J.departments))
|
||||
return
|
||||
|
||||
var/primary_department = J.departments[1]
|
||||
var/datum/department/dept = LAZYACCESS(department_datums, primary_department)
|
||||
if(!istype(dept))
|
||||
job_debug_message("Job '[J.title]' has their primary department be '[primary_department]', but it does not exist.")
|
||||
return
|
||||
|
||||
return department_datums[primary_department]
|
||||
|
||||
// Someday it might be good to port code/game/jobs/job_controller.dm to here and clean it up.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/datum/controller/subsystem/job/proc/job_debug_message(message)
|
||||
if(debug_messages)
|
||||
log_debug("JOB DEBUG: [message]")
|
||||
@@ -1,30 +1,29 @@
|
||||
// Handles map-related tasks, mostly here to ensure it does so after the MC initializes.
|
||||
SUBSYSTEM_DEF(mapping)
|
||||
name = "Mapping"
|
||||
init_order = INIT_ORDER_MAPPING
|
||||
flags = SS_NO_FIRE
|
||||
|
||||
var/list/map_templates = list()
|
||||
var/dmm_suite/maploader = null
|
||||
|
||||
/datum/controller/subsystem/mapping/Initialize(timeofday)
|
||||
if(subsystem_initialized)
|
||||
return
|
||||
world.max_z_changed() // This is to set up the player z-level list, maxz hasn't actually changed (probably)
|
||||
maploader = new()
|
||||
load_map_templates()
|
||||
|
||||
if(config.generate_map)
|
||||
// Map-gen is still very specific to the map, however putting it here should ensure it loads in the correct order.
|
||||
if(using_map.perform_map_generation())
|
||||
using_map.refresh_mining_turfs()
|
||||
|
||||
|
||||
/datum/controller/subsystem/mapping/proc/load_map_templates()
|
||||
for(var/T in subtypesof(/datum/map_template))
|
||||
var/datum/map_template/template = T
|
||||
if(!(initial(template.mappath))) // If it's missing the actual path its probably a base type or being used for inheritence.
|
||||
continue
|
||||
template = new T()
|
||||
map_templates[template.name] = template
|
||||
return TRUE
|
||||
// Handles map-related tasks, mostly here to ensure it does so after the MC initializes.
|
||||
SUBSYSTEM_DEF(mapping)
|
||||
name = "Mapping"
|
||||
init_order = INIT_ORDER_MAPPING
|
||||
flags = SS_NO_FIRE
|
||||
|
||||
var/list/map_templates = list()
|
||||
var/dmm_suite/maploader = null
|
||||
|
||||
/datum/controller/subsystem/mapping/Initialize(timeofday)
|
||||
if(subsystem_initialized)
|
||||
return
|
||||
world.max_z_changed() // This is to set up the player z-level list, maxz hasn't actually changed (probably)
|
||||
maploader = new()
|
||||
load_map_templates()
|
||||
|
||||
if(config.generate_map)
|
||||
// Map-gen is still very specific to the map, however putting it here should ensure it loads in the correct order.
|
||||
using_map.perform_map_generation()
|
||||
|
||||
|
||||
/datum/controller/subsystem/mapping/proc/load_map_templates()
|
||||
for(var/T in subtypesof(/datum/map_template))
|
||||
var/datum/map_template/template = T
|
||||
if(!(initial(template.mappath))) // If it's missing the actual path its probably a base type or being used for inheritence.
|
||||
continue
|
||||
template = new T()
|
||||
map_templates[template.name] = template
|
||||
return TRUE
|
||||
|
||||
@@ -27,8 +27,7 @@ SUBSYSTEM_DEF(mapping)
|
||||
|
||||
if(config.generate_map)
|
||||
// Map-gen is still very specific to the map, however putting it here should ensure it loads in the correct order.
|
||||
if(using_map.perform_map_generation())
|
||||
using_map.refresh_mining_turfs()
|
||||
using_map.perform_map_generation()
|
||||
|
||||
loadEngine()
|
||||
preloadShelterTemplates()
|
||||
|
||||
@@ -36,15 +36,13 @@ SUBSYSTEM_DEF(persist)
|
||||
|
||||
// Try and detect job and department of mob
|
||||
var/datum/job/J = detect_job(M)
|
||||
if(!istype(J) || !J.department || !J.timeoff_factor)
|
||||
if(!istype(J) || !J.pto_type || !J.timeoff_factor)
|
||||
if (MC_TICK_CHECK)
|
||||
return
|
||||
continue
|
||||
|
||||
// Do not collect useless PTO
|
||||
var/department_earning = J.department
|
||||
if(J.department == "Command")
|
||||
department_earning = "Civilian"
|
||||
var/department_earning = J.pto_type
|
||||
clear_unused_pto(M)
|
||||
|
||||
// Update client whatever
|
||||
@@ -90,6 +88,6 @@ SUBSYSTEM_DEF(persist)
|
||||
/datum/controller/subsystem/persist/proc/clear_unused_pto(var/mob/M)
|
||||
var/client/C = M.client
|
||||
LAZYINITLIST(C.department_hours)
|
||||
if(C.department_hours["Command"])
|
||||
C.department_hours["Command"] = null
|
||||
C.department_hours.Remove("Command")
|
||||
if(C.department_hours[DEPARTMENT_COMMAND])
|
||||
C.department_hours[DEPARTMENT_COMMAND] = null
|
||||
C.department_hours.Remove(DEPARTMENT_COMMAND)
|
||||
20
code/controllers/subsystems/processing/bellies_vr.dm
Normal file
20
code/controllers/subsystems/processing/bellies_vr.dm
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Bellies subsystem - Process vore bellies
|
||||
//
|
||||
|
||||
PROCESSING_SUBSYSTEM_DEF(bellies)
|
||||
name = "Bellies"
|
||||
wait = 6 SECONDS
|
||||
flags = SS_KEEP_TIMING|SS_NO_INIT
|
||||
runlevels = RUNLEVEL_GAME|RUNLEVEL_POSTGAME
|
||||
|
||||
/datum/controller/subsystem/processing/bellies/Recover()
|
||||
log_debug("[name] subsystem Recover().")
|
||||
if(SSbellies.current_thing)
|
||||
log_debug("current_thing was: (\ref[SSbellies.current_thing])[SSbellies.current_thing]([SSbellies.current_thing.type]) - currentrun: [SSbellies.currentrun.len] vs total: [SSbellies.processing.len]")
|
||||
var/list/old_processing = SSbellies.processing.Copy()
|
||||
for(var/datum/D in old_processing)
|
||||
if(!isbelly(D))
|
||||
log_debug("[name] subsystem Recover() found inappropriate item in list: [D.type]")
|
||||
if(CHECK_BITFIELD(D.datum_flags, DF_ISPROCESSING))
|
||||
processing |= D
|
||||
@@ -8,6 +8,14 @@ PROCESSING_SUBSYSTEM_DEF(chemistry)
|
||||
var/list/chemical_reagents = list()
|
||||
|
||||
/datum/controller/subsystem/processing/chemistry/Recover()
|
||||
log_debug("[name] subsystem Recover().")
|
||||
if(SSchemistry.current_thing)
|
||||
log_debug("current_thing was: (\ref[SSchemistry.current_thing])[SSchemistry.current_thing]([SSchemistry.current_thing.type]) - currentrun: [SSchemistry.currentrun.len] vs total: [SSchemistry.processing.len]")
|
||||
var/list/old_processing = SSchemistry.processing.Copy()
|
||||
for(var/datum/D in old_processing)
|
||||
if(CHECK_BITFIELD(D.datum_flags, DF_ISPROCESSING))
|
||||
processing |= D
|
||||
|
||||
chemical_reactions = SSchemistry.chemical_reactions
|
||||
chemical_reagents = SSchemistry.chemical_reagents
|
||||
|
||||
|
||||
@@ -4,3 +4,12 @@ PROCESSING_SUBSYSTEM_DEF(fastprocess)
|
||||
name = "Fast Processing"
|
||||
wait = 2
|
||||
stat_tag = "FP"
|
||||
|
||||
/datum/controller/subsystem/processing/fastprocess/Recover()
|
||||
log_debug("[name] subsystem Recover().")
|
||||
if(SSfastprocess.current_thing)
|
||||
log_debug("current_thing was: (\ref[SSfastprocess.current_thing])[SSfastprocess.current_thing]([SSfastprocess.current_thing.type]) - currentrun: [SSfastprocess.currentrun.len] vs total: [SSfastprocess.processing.len]")
|
||||
var/list/old_processing = SSfastprocess.processing.Copy()
|
||||
for(var/datum/D in old_processing)
|
||||
if(CHECK_BITFIELD(D.datum_flags, DF_ISPROCESSING))
|
||||
processing |= D
|
||||
@@ -3,3 +3,14 @@ PROCESSING_SUBSYSTEM_DEF(obj)
|
||||
priority = FIRE_PRIORITY_OBJ
|
||||
flags = SS_NO_INIT
|
||||
wait = 20
|
||||
|
||||
/datum/controller/subsystem/processing/obj/Recover()
|
||||
log_debug("[name] subsystem Recover().")
|
||||
if(SSobj.current_thing)
|
||||
log_debug("current_thing was: (\ref[SSobj.current_thing])[SSobj.current_thing]([SSobj.current_thing.type]) - currentrun: [SSobj.currentrun.len] vs total: [SSobj.processing.len]")
|
||||
var/list/old_processing = SSobj.processing.Copy()
|
||||
for(var/datum/D in old_processing)
|
||||
if(!isobj(D))
|
||||
log_debug("[name] subsystem Recover() found inappropriate item in list: [D.type]")
|
||||
if(CHECK_BITFIELD(D.datum_flags, DF_ISPROCESSING))
|
||||
processing |= D
|
||||
@@ -13,6 +13,16 @@ SUBSYSTEM_DEF(processing)
|
||||
|
||||
var/debug_last_thing
|
||||
var/debug_original_process_proc // initial() does not work with procs
|
||||
var/datum/current_thing
|
||||
|
||||
/datum/controller/subsystem/processing/Recover()
|
||||
log_debug("[name] subsystem Recover().")
|
||||
if(SSprocessing.current_thing)
|
||||
log_debug("current_thing was: (\ref[SSprocessing.current_thing])[SSprocessing.current_thing]([SSprocessing.current_thing.type]) - currentrun: [SSprocessing.currentrun.len] vs total: [SSprocessing.processing.len]")
|
||||
var/list/old_processing = SSprocessing.processing.Copy()
|
||||
for(var/datum/D in old_processing)
|
||||
if(CHECK_BITFIELD(D.datum_flags, DF_ISPROCESSING))
|
||||
processing |= D
|
||||
|
||||
/datum/controller/subsystem/processing/stat_entry()
|
||||
..("[stat_tag]:[processing.len]")
|
||||
@@ -24,16 +34,19 @@ SUBSYSTEM_DEF(processing)
|
||||
var/list/current_run = currentrun
|
||||
|
||||
while(current_run.len)
|
||||
var/datum/thing = current_run[current_run.len]
|
||||
current_thing = current_run[current_run.len]
|
||||
current_run.len--
|
||||
if(QDELETED(thing))
|
||||
processing -= thing
|
||||
else if(thing.process(wait) == PROCESS_KILL)
|
||||
if(QDELETED(current_thing))
|
||||
processing -= current_thing
|
||||
else if(current_thing.process(wait) == PROCESS_KILL)
|
||||
// fully stop so that a future START_PROCESSING will work
|
||||
STOP_PROCESSING(src, thing)
|
||||
STOP_PROCESSING(src, current_thing)
|
||||
if (MC_TICK_CHECK)
|
||||
current_thing = null
|
||||
return
|
||||
|
||||
current_thing = null
|
||||
|
||||
/datum/controller/subsystem/processing/proc/toggle_debug()
|
||||
if(!check_rights(R_DEBUG))
|
||||
return
|
||||
|
||||
@@ -8,6 +8,15 @@ PROCESSING_SUBSYSTEM_DEF(projectiles)
|
||||
var/global_pixel_speed = 2
|
||||
var/global_iterations_per_move = 16
|
||||
|
||||
/datum/controller/subsystem/processing/projectiles/Recover()
|
||||
log_debug("[name] subsystem Recover().")
|
||||
if(SSprojectiles.current_thing)
|
||||
log_debug("current_thing was: (\ref[SSprojectiles.current_thing])[SSprojectiles.current_thing]([SSprojectiles.current_thing.type]) - currentrun: [SSprojectiles.currentrun.len] vs total: [SSprojectiles.processing.len]")
|
||||
var/list/old_processing = SSprojectiles.processing.Copy()
|
||||
for(var/datum/D in old_processing)
|
||||
if(CHECK_BITFIELD(D.datum_flags, DF_ISPROCESSING))
|
||||
processing |= D
|
||||
|
||||
/datum/controller/subsystem/processing/projectiles/proc/set_pixel_speed(new_speed)
|
||||
global_pixel_speed = new_speed
|
||||
for(var/i in processing)
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
PROCESSING_SUBSYSTEM_DEF(turfs)
|
||||
name = "Turf Processing"
|
||||
wait = 20
|
||||
|
||||
/datum/controller/subsystem/processing/turfs/Recover()
|
||||
log_debug("[name] subsystem Recover().")
|
||||
if(SSturfs.current_thing)
|
||||
log_debug("current_thing was: (\ref[SSturfs.current_thing])[SSturfs.current_thing]([SSturfs.current_thing.type]) - currentrun: [SSturfs.currentrun.len] vs total: [SSturfs.processing.len]")
|
||||
var/list/old_processing = SSturfs.processing.Copy()
|
||||
for(var/datum/D in old_processing)
|
||||
if(!isturf(D))
|
||||
log_debug("[name] subsystem Recover() found inappropriate item in list: [D.type]")
|
||||
if(CHECK_BITFIELD(D.datum_flags, DF_ISPROCESSING))
|
||||
processing |= D
|
||||
@@ -1,6 +1,8 @@
|
||||
//
|
||||
// SSshuttles subsystem - Handles initialization and processing of shuttles.
|
||||
//
|
||||
// Also handles initialization and processing of overmap sectors.
|
||||
//
|
||||
|
||||
// This global variable exists for legacy support so we don't have to rename every shuttle_controller to SSshuttles yet.
|
||||
var/global/datum/controller/subsystem/shuttles/shuttle_controller
|
||||
@@ -13,71 +15,164 @@ SUBSYSTEM_DEF(shuttles)
|
||||
flags = SS_KEEP_TIMING|SS_NO_TICK_CHECK
|
||||
runlevels = RUNLEVEL_GAME|RUNLEVEL_POSTGAME
|
||||
|
||||
var/list/shuttles = list() // Maps shuttle tags to shuttle datums, so that they can be looked up.
|
||||
var/list/process_shuttles = list() // Simple list of shuttles, for processing
|
||||
var/list/current_run = list() // Shuttles remaining to process this fire() tick
|
||||
var/list/docks_init_callbacks // List of callbacks to run when we finish setting up shuttle docks.
|
||||
var/docks_initialized = FALSE
|
||||
var/overmap_halted = FALSE // Whether ships can move on the overmap; used for adminbus.
|
||||
var/list/ships = list() // List of all ships.
|
||||
|
||||
var/list/shuttles = list() // Maps shuttle tags to shuttle datums, so that they can be looked up.
|
||||
var/list/process_shuttles = list() // Simple list of shuttles, for processing
|
||||
|
||||
var/list/registered_shuttle_landmarks = list() // Maps shuttle landmark tags to instances
|
||||
var/last_landmark_registration_time // world.time of most recent addition to registered_shuttle_landmarks
|
||||
var/list/shuttle_logs = list() // (Not Implemented) Keeps records of shuttle movement, format is list(datum/shuttle = datum/shuttle_log)
|
||||
var/list/shuttle_areas = list() // All the areas of all shuttles.
|
||||
var/list/docking_registry = list() // Docking controller tag -> docking controller program, mostly for init purposes.
|
||||
|
||||
var/list/landmarks_awaiting_sector = list() // Stores automatic landmarks that are waiting for a sector to finish loading.
|
||||
var/list/landmarks_still_needed = list() // Stores landmark_tags that need to be assigned to the sector (landmark_tag = sector) when registered.
|
||||
var/list/shuttles_to_initialize // A queue for shuttles to initialize at the appropriate time.
|
||||
var/list/sectors_to_initialize // Used to find all sector objects at the appropriate time.
|
||||
var/block_init_queue = TRUE // Block initialization of new shuttles/sectors
|
||||
|
||||
var/tmp/list/current_run // Shuttles remaining to process this fire() tick
|
||||
|
||||
/datum/controller/subsystem/shuttles/PreInit()
|
||||
global.shuttle_controller = src // TODO - Remove this! Change everything to point at SSshuttles intead
|
||||
|
||||
/datum/controller/subsystem/shuttles/Initialize(timeofday)
|
||||
global.shuttle_controller = src
|
||||
setup_shuttle_docks()
|
||||
for(var/I in docks_init_callbacks)
|
||||
var/datum/callback/cb = I
|
||||
cb.InvokeAsync()
|
||||
LAZYCLEARLIST(docks_init_callbacks)
|
||||
docks_init_callbacks = null
|
||||
last_landmark_registration_time = world.time
|
||||
// Find all declared shuttle datums and initailize them. (Okay, queue them for initialization a few lines further down)
|
||||
for(var/shuttle_type in subtypesof(/datum/shuttle)) // This accounts for most shuttles, though away maps can queue up more.
|
||||
var/datum/shuttle/shuttle = shuttle_type
|
||||
if(initial(shuttle.category) == shuttle_type)
|
||||
continue // Its an "abstract class" datum, not for a real shuttle.
|
||||
if(!initial(shuttle.defer_initialisation)) // Skip if it asks not to be initialized at startup.
|
||||
LAZYDISTINCTADD(shuttles_to_initialize, shuttle_type)
|
||||
block_init_queue = FALSE
|
||||
process_init_queues()
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/shuttles/fire(resumed = 0)
|
||||
do_process_shuttles(resumed)
|
||||
|
||||
/datum/controller/subsystem/shuttles/stat_entry()
|
||||
var/msg = list()
|
||||
msg += "AS:[shuttles.len]|"
|
||||
msg += "PS:[process_shuttles.len]|"
|
||||
..(jointext(msg, null))
|
||||
|
||||
/datum/controller/subsystem/shuttles/proc/do_process_shuttles(resumed = 0)
|
||||
if (!resumed)
|
||||
src.current_run = process_shuttles.Copy()
|
||||
|
||||
var/list/current_run = src.current_run // Cache for sanic speed
|
||||
while(current_run.len)
|
||||
var/datum/shuttle/S = current_run[current_run.len]
|
||||
current_run.len--
|
||||
if(istype(S) && !QDELETED(S))
|
||||
if(istype(S, /datum/shuttle/ferry)) // Ferry shuttles get special treatment
|
||||
var/datum/shuttle/ferry/F = S
|
||||
if(F.process_state || F.always_process)
|
||||
F.process()
|
||||
else
|
||||
S.process()
|
||||
else
|
||||
var/list/working_shuttles = src.current_run // Cache for sanic speed
|
||||
while(working_shuttles.len)
|
||||
var/datum/shuttle/S = working_shuttles[working_shuttles.len]
|
||||
working_shuttles.len--
|
||||
if(!istype(S) || QDELETED(S))
|
||||
error("Bad entry in SSshuttles.process_shuttles - [log_info_line(S)] ")
|
||||
process_shuttles -= S
|
||||
continue
|
||||
// NOTE - In old system, /datum/shuttle/ferry was processed only if (F.process_state || F.always_process)
|
||||
if(S.process_state && (S.process(wait, times_fired, src) == PROCESS_KILL))
|
||||
process_shuttles -= S
|
||||
|
||||
if(MC_TICK_CHECK)
|
||||
return
|
||||
|
||||
// This should be called after all the machines and radio frequencies have been properly initialized
|
||||
/datum/controller/subsystem/shuttles/proc/setup_shuttle_docks()
|
||||
// Find all declared shuttle datums and initailize them.
|
||||
for(var/shuttle_type in subtypesof(/datum/shuttle))
|
||||
var/datum/shuttle/shuttle = shuttle_type
|
||||
if(initial(shuttle.category) == shuttle_type)
|
||||
continue
|
||||
/datum/controller/subsystem/shuttles/proc/process_init_queues()
|
||||
if(block_init_queue)
|
||||
return
|
||||
initialize_shuttles()
|
||||
initialize_sectors()
|
||||
|
||||
// Initializes all shuttles in shuttles_to_initialize
|
||||
/datum/controller/subsystem/shuttles/proc/initialize_shuttles()
|
||||
var/list/shuttles_made = list()
|
||||
for(var/shuttle_type in shuttles_to_initialize)
|
||||
var/shuttle = initialize_shuttle(shuttle_type)
|
||||
if(shuttle)
|
||||
shuttles_made += shuttle
|
||||
hook_up_motherships(shuttles_made)
|
||||
shuttles_to_initialize = null
|
||||
|
||||
/datum/controller/subsystem/shuttles/proc/initialize_sectors()
|
||||
for(var/sector in sectors_to_initialize)
|
||||
initialize_sector(sector)
|
||||
sectors_to_initialize = null
|
||||
|
||||
/datum/controller/subsystem/shuttles/proc/register_landmark(shuttle_landmark_tag, obj/effect/shuttle_landmark/shuttle_landmark)
|
||||
if (registered_shuttle_landmarks[shuttle_landmark_tag])
|
||||
CRASH("Attempted to register shuttle landmark with tag [shuttle_landmark_tag], but it is already registered!")
|
||||
if (istype(shuttle_landmark))
|
||||
registered_shuttle_landmarks[shuttle_landmark_tag] = shuttle_landmark
|
||||
last_landmark_registration_time = world.time
|
||||
|
||||
var/obj/effect/overmap/visitable/O = landmarks_still_needed[shuttle_landmark_tag]
|
||||
if(O) //These need to be added to sectors, which we handle.
|
||||
try_add_landmark_tag(shuttle_landmark_tag, O)
|
||||
landmarks_still_needed -= shuttle_landmark_tag
|
||||
else if(istype(shuttle_landmark, /obj/effect/shuttle_landmark/automatic)) //These find their sector automatically
|
||||
O = map_sectors["[shuttle_landmark.z]"]
|
||||
O ? O.add_landmark(shuttle_landmark, shuttle_landmark.shuttle_restricted) : (landmarks_awaiting_sector += shuttle_landmark)
|
||||
|
||||
/datum/controller/subsystem/shuttles/proc/get_landmark(var/shuttle_landmark_tag)
|
||||
return registered_shuttle_landmarks[shuttle_landmark_tag]
|
||||
|
||||
//Checks if the given sector's landmarks have initialized; if so, registers them with the sector, if not, marks them for assignment after they come in.
|
||||
//Also adds automatic landmarks that were waiting on their sector to spawn.
|
||||
/datum/controller/subsystem/shuttles/proc/initialize_sector(obj/effect/overmap/visitable/given_sector)
|
||||
given_sector.populate_sector_objects() // This is a late init operation that sets up the sector's map_z and does non-overmap-related init tasks.
|
||||
|
||||
for(var/landmark_tag in given_sector.initial_generic_waypoints)
|
||||
if(!try_add_landmark_tag(landmark_tag, given_sector))
|
||||
landmarks_still_needed[landmark_tag] = given_sector // Landmark isn't registered yet, queue it to be added once it is.
|
||||
|
||||
for(var/shuttle_name in given_sector.initial_restricted_waypoints)
|
||||
for(var/landmark_tag in given_sector.initial_restricted_waypoints[shuttle_name])
|
||||
if(!try_add_landmark_tag(landmark_tag, given_sector))
|
||||
landmarks_still_needed[landmark_tag] = given_sector // Landmark isn't registered yet, queue it to be added once it is.
|
||||
|
||||
var/landmarks_to_check = landmarks_awaiting_sector.Copy()
|
||||
for(var/thing in landmarks_to_check)
|
||||
var/obj/effect/shuttle_landmark/automatic/landmark = thing
|
||||
if(landmark.z in given_sector.map_z)
|
||||
given_sector.add_landmark(landmark, landmark.shuttle_restricted)
|
||||
landmarks_awaiting_sector -= landmark
|
||||
|
||||
// Attempts to add a landmark instance with a sector (returns false if landmark isn't registered yet)
|
||||
/datum/controller/subsystem/shuttles/proc/try_add_landmark_tag(landmark_tag, obj/effect/overmap/visitable/given_sector)
|
||||
var/obj/effect/shuttle_landmark/landmark = get_landmark(landmark_tag)
|
||||
if(!landmark)
|
||||
return
|
||||
|
||||
if(landmark.landmark_tag in given_sector.initial_generic_waypoints)
|
||||
given_sector.add_landmark(landmark)
|
||||
. = 1
|
||||
for(var/shuttle_name in given_sector.initial_restricted_waypoints)
|
||||
if(landmark.landmark_tag in given_sector.initial_restricted_waypoints[shuttle_name])
|
||||
given_sector.add_landmark(landmark, shuttle_name)
|
||||
. = 1
|
||||
|
||||
/datum/controller/subsystem/shuttles/proc/initialize_shuttle(var/shuttle_type)
|
||||
var/datum/shuttle/shuttle = shuttle_type
|
||||
if(initial(shuttle.category) != shuttle_type) // Skip if its an "abstract class" datum
|
||||
shuttle = new shuttle()
|
||||
shuttle.init_docking_controllers()
|
||||
shuttle.dock() //makes all shuttles docked to something at round start go into the docked state
|
||||
CHECK_TICK
|
||||
shuttle_areas |= shuttle.shuttle_area
|
||||
log_debug("Initialized shuttle [shuttle] ([shuttle.type])")
|
||||
return shuttle
|
||||
// Historical note: No need to call shuttle.init_docking_controllers(), controllers register themselves
|
||||
// and shuttles fetch refs in New(). Shuttles also dock() themselves in new if they want.
|
||||
|
||||
for(var/obj/machinery/embedded_controller/C in machines)
|
||||
if(istype(C.program, /datum/computer/file/embedded_program/docking))
|
||||
C.program.tag = null //clear the tags, 'cause we don't need 'em anymore
|
||||
docks_initialized = TRUE
|
||||
// TODO - Leshana to hook up more of this when overmap is ported.
|
||||
/datum/controller/subsystem/shuttles/proc/hook_up_motherships(shuttles_list)
|
||||
for(var/datum/shuttle/S in shuttles_list)
|
||||
if(S.mothershuttle && !S.motherdock)
|
||||
var/datum/shuttle/mothership = shuttles[S.mothershuttle]
|
||||
if(mothership)
|
||||
S.motherdock = S.current_location.landmark_tag
|
||||
mothership.shuttle_area |= S.shuttle_area
|
||||
else
|
||||
error("Shuttle [S] was unable to find mothership [mothership]!")
|
||||
|
||||
// Register a callback that will be invoked once the shuttles have been initialized
|
||||
/datum/controller/subsystem/shuttles/proc/OnDocksInitialized(datum/callback/cb)
|
||||
if(!docks_initialized)
|
||||
LAZYADD(docks_init_callbacks, cb)
|
||||
else
|
||||
cb.InvokeAsync()
|
||||
// Admin command to halt/resume overmap
|
||||
/datum/controller/subsystem/shuttles/proc/toggle_overmap(new_setting)
|
||||
if(overmap_halted == new_setting)
|
||||
return
|
||||
overmap_halted = !overmap_halted
|
||||
for(var/ship in ships)
|
||||
var/obj/effect/overmap/visitable/ship/ship_effect = ship
|
||||
overmap_halted ? ship_effect.halt() : ship_effect.unhalt()
|
||||
|
||||
/datum/controller/subsystem/shuttles/stat_entry()
|
||||
..("Shuttles:[process_shuttles.len]/[shuttles.len], Ships:[ships.len], L:[registered_shuttle_landmarks.len][overmap_halted ? ", HALT" : ""]")
|
||||
|
||||
135
code/controllers/subsystems/skybox.dm
Normal file
135
code/controllers/subsystems/skybox.dm
Normal file
@@ -0,0 +1,135 @@
|
||||
|
||||
//Exists to handle a few global variables that change enough to justify this. Technically a parallax, but it exhibits a skybox effect.
|
||||
SUBSYSTEM_DEF(skybox)
|
||||
name = "Space skybox"
|
||||
init_order = INIT_ORDER_SKYBOX
|
||||
flags = SS_NO_FIRE
|
||||
var/static/list/skybox_cache = list()
|
||||
|
||||
var/static/list/dust_cache = list()
|
||||
var/static/list/speedspace_cache = list()
|
||||
var/static/list/mapedge_cache = list()
|
||||
var/static/list/phase_shift_by_x = list()
|
||||
var/static/list/phase_shift_by_y = list()
|
||||
|
||||
/datum/controller/subsystem/skybox/PreInit()
|
||||
//Static
|
||||
for (var/i in 0 to 25)
|
||||
var/image/im = image('icons/turf/space_dust.dmi', "[i]")
|
||||
im.plane = DUST_PLANE
|
||||
im.alpha = 128 //80
|
||||
im.blend_mode = BLEND_ADD
|
||||
dust_cache["[i]"] = im
|
||||
//Moving
|
||||
for (var/i in 0 to 14)
|
||||
// NORTH/SOUTH
|
||||
var/image/im = image('icons/turf/space_dust_transit.dmi', "speedspace_ns_[i]")
|
||||
im.plane = DUST_PLANE
|
||||
im.blend_mode = BLEND_ADD
|
||||
speedspace_cache["NS_[i]"] = im
|
||||
// EAST/WEST
|
||||
im = image('icons/turf/space_dust_transit.dmi', "speedspace_ew_[i]")
|
||||
im.plane = DUST_PLANE
|
||||
im.blend_mode = BLEND_ADD
|
||||
speedspace_cache["EW_[i]"] = im
|
||||
//Over-the-edge images
|
||||
for (var/dir in alldirs)
|
||||
var/image/I = image('icons/turf/space.dmi', "white")
|
||||
var/matrix/M = matrix()
|
||||
var/horizontal = (dir & (WEST|EAST))
|
||||
var/vertical = (dir & (NORTH|SOUTH))
|
||||
M.Scale(horizontal ? 8 : 1, vertical ? 8 : 1)
|
||||
I.transform = M
|
||||
I.appearance_flags = KEEP_APART | TILE_BOUND
|
||||
I.plane = SPACE_PLANE
|
||||
I.layer = 0
|
||||
|
||||
if(dir & NORTH)
|
||||
I.pixel_y = 112
|
||||
else if(dir & SOUTH)
|
||||
I.pixel_y = -112
|
||||
|
||||
if(dir & EAST)
|
||||
I.pixel_x = 112
|
||||
else if(dir & WEST)
|
||||
I.pixel_x = -112
|
||||
|
||||
mapedge_cache["[dir]"] = I
|
||||
|
||||
//Shuffle some lists
|
||||
phase_shift_by_x = get_cross_shift_list(15)
|
||||
phase_shift_by_y = get_cross_shift_list(15)
|
||||
|
||||
. = ..()
|
||||
|
||||
/datum/controller/subsystem/skybox/Initialize()
|
||||
. = ..()
|
||||
|
||||
/datum/controller/subsystem/skybox/proc/get_skybox(z)
|
||||
if(!skybox_cache["[z]"])
|
||||
skybox_cache["[z]"] = generate_skybox(z)
|
||||
if(global.using_map.use_overmap)
|
||||
var/obj/effect/overmap/visitable/O = map_sectors["[z]"]
|
||||
if(istype(O))
|
||||
for(var/zlevel in O.map_z)
|
||||
skybox_cache["[zlevel]"] = skybox_cache["[z]"]
|
||||
return skybox_cache["[z]"]
|
||||
|
||||
/datum/controller/subsystem/skybox/proc/generate_skybox(z)
|
||||
var/datum/skybox_settings/settings = global.using_map.get_skybox_datum(z)
|
||||
|
||||
var/image/res = image(settings.icon)
|
||||
res.appearance_flags = KEEP_TOGETHER
|
||||
|
||||
var/image/base = image(settings.icon, settings.icon_state)
|
||||
base.color = settings.color
|
||||
|
||||
if(settings.use_stars)
|
||||
var/image/stars = image(settings.icon, settings.star_state)
|
||||
stars.appearance_flags = RESET_COLOR
|
||||
base.overlays += stars
|
||||
|
||||
res.overlays += base
|
||||
|
||||
if(global.using_map.use_overmap && settings.use_overmap_details)
|
||||
var/obj/effect/overmap/visitable/O = map_sectors["[z]"]
|
||||
if(istype(O))
|
||||
var/image/overmap = image(settings.icon)
|
||||
overmap.overlays += O.generate_skybox()
|
||||
for(var/obj/effect/overmap/visitable/other in O.loc)
|
||||
if(other != O)
|
||||
overmap.overlays += other.get_skybox_representation()
|
||||
overmap.appearance_flags = RESET_COLOR
|
||||
res.overlays += overmap
|
||||
|
||||
// Allow events to apply custom overlays to skybox! (Awesome!)
|
||||
for(var/datum/event/E in SSevents.active_events)
|
||||
if(E.has_skybox_image && E.isRunning && (z in E.affecting_z))
|
||||
res.overlays += E.get_skybox_image()
|
||||
|
||||
return res
|
||||
|
||||
/datum/controller/subsystem/skybox/proc/rebuild_skyboxes(var/list/zlevels)
|
||||
for(var/z in zlevels)
|
||||
skybox_cache["[z]"] = generate_skybox(z)
|
||||
|
||||
for(var/client/C)
|
||||
C.update_skybox(1)
|
||||
|
||||
// Settings datum that maps can override to play with their skyboxes
|
||||
/datum/skybox_settings
|
||||
var/icon = 'icons/skybox/skybox.dmi' //Path to our background. Lets us use anything we damn well please. Skyboxes need to be 736x736
|
||||
var/icon_state = "dyable"
|
||||
var/color
|
||||
var/random_color = FALSE
|
||||
|
||||
var/use_stars = TRUE
|
||||
var/star_icon = 'icons/skybox/skybox.dmi'
|
||||
var/star_state = "stars"
|
||||
|
||||
var/use_overmap_details = TRUE //Do we try to draw overmap visitables in our sector on the map?
|
||||
|
||||
/datum/skybox_settings/New()
|
||||
..()
|
||||
if(random_color)
|
||||
color = rgb(rand(0,255), rand(0,255), rand(0,255))
|
||||
@@ -1,36 +1,15 @@
|
||||
//Config stuff
|
||||
#define SUPPLY_DOCKZ 2 //Z-level of the Dock.
|
||||
#define SUPPLY_STATIONZ 1 //Z-level of the Station.
|
||||
#define SUPPLY_STATION_AREATYPE "/area/supply/station" //Type of the supply shuttle area for station
|
||||
#define SUPPLY_DOCK_AREATYPE "/area/supply/dock" //Type of the supply shuttle area for dock
|
||||
|
||||
//Supply packs are in /code/datums/supplypacks
|
||||
//Computers are in /code/game/machinery/computer/supply.dm
|
||||
SUBSYSTEM_DEF(supply)
|
||||
name = "Supply"
|
||||
wait = 20 SECONDS
|
||||
priority = FIRE_PRIORITY_SUPPLY
|
||||
//Initializes at default time
|
||||
flags = SS_NO_TICK_CHECK
|
||||
|
||||
/datum/supply_order
|
||||
var/ordernum // Unfabricatable index
|
||||
var/index // Fabricatable index
|
||||
var/datum/supply_pack/object = null
|
||||
var/cost // Cost of the supply pack (Fabricatable) (Changes not reflected when purchasing supply packs, this is cosmetic only)
|
||||
var/name // Name of the supply pack datum (Fabricatable)
|
||||
var/ordered_by = null // Who requested the order
|
||||
var/comment = null // What reason was given for the order
|
||||
var/approved_by = null // Who approved the order
|
||||
var/ordered_at // Date and time the order was requested at
|
||||
var/approved_at // Date and time the order was approved at
|
||||
var/status // [Requested, Accepted, Denied, Shipped]
|
||||
|
||||
/datum/exported_crate
|
||||
var/name
|
||||
var/value
|
||||
var/list/contents
|
||||
|
||||
var/datum/controller/supply/supply_controller = new()
|
||||
|
||||
/datum/controller/supply
|
||||
//supply points
|
||||
var/points = 50
|
||||
var/points_per_process = 1.5
|
||||
var/points_per_process = 1.0 // Processes every 20 seconds, so this is 3 per minute
|
||||
var/points_per_slip = 2
|
||||
var/points_per_money = 0.02 // 1 point for $50
|
||||
//control
|
||||
@@ -43,15 +22,16 @@ var/datum/controller/supply/supply_controller = new()
|
||||
var/list/adm_export_history = list() // Complete history of all crates sent back on the shuttle, for admin use
|
||||
//shuttle movement
|
||||
var/movetime = 1200
|
||||
var/datum/shuttle/ferry/supply/shuttle
|
||||
var/datum/shuttle/autodock/ferry/supply/shuttle
|
||||
var/list/material_points_conversion = list( // Any materials not named in this list are worth 0 points
|
||||
"phoron" = 5,
|
||||
"platinum" = 5
|
||||
)
|
||||
|
||||
/datum/controller/supply/New()
|
||||
/datum/controller/subsystem/supply/Initialize()
|
||||
ordernum = rand(1,9000)
|
||||
|
||||
// build master supply list
|
||||
for(var/typepath in subtypesof(/datum/supply_pack))
|
||||
var/datum/supply_pack/P = new typepath()
|
||||
if(P.name)
|
||||
@@ -59,20 +39,18 @@ var/datum/controller/supply/supply_controller = new()
|
||||
else
|
||||
qdel(P)
|
||||
|
||||
/datum/controller/process/supply/setup()
|
||||
name = "supply controller"
|
||||
schedule_interval = 300 // every 30 seconds
|
||||
// TODO - Auto-build material_points_conversion from material datums
|
||||
. = ..()
|
||||
|
||||
/datum/controller/process/supply/doWork()
|
||||
supply_controller.process()
|
||||
|
||||
// Supply shuttle ticker - handles supply point regeneration
|
||||
// This is called by the process scheduler every thirty seconds
|
||||
/datum/controller/supply/process()
|
||||
// Supply shuttle ticker - handles supply point regeneration. Just add points over time.
|
||||
/datum/controller/subsystem/supply/fire()
|
||||
points += points_per_process
|
||||
|
||||
/datum/controller/subsystem/supply/stat_entry()
|
||||
..("Points: [points]")
|
||||
|
||||
//To stop things being sent to CentCom which should not be sent to centcomm. Recursively checks for these types.
|
||||
/datum/controller/supply/proc/forbidden_atoms_check(atom/A)
|
||||
/datum/controller/subsystem/supply/proc/forbidden_atoms_check(atom/A)
|
||||
if(isliving(A))
|
||||
return 1
|
||||
if(istype(A,/obj/item/weapon/disk/nuclear))
|
||||
@@ -89,87 +67,102 @@ var/datum/controller/supply/supply_controller = new()
|
||||
return 1
|
||||
|
||||
//Selling
|
||||
/datum/controller/supply/proc/sell()
|
||||
var/area/area_shuttle = shuttle.get_location_area()
|
||||
if(!area_shuttle)
|
||||
return
|
||||
/datum/controller/subsystem/supply/proc/sell()
|
||||
// Loop over each area in the supply shuttle
|
||||
for(var/area/subarea in shuttle.shuttle_area)
|
||||
callHook("sell_shuttle", list(subarea));
|
||||
for(var/atom/movable/MA in subarea)
|
||||
if(MA.anchored)
|
||||
continue
|
||||
|
||||
callHook("sell_shuttle", list(area_shuttle));
|
||||
var/datum/exported_crate/EC = new /datum/exported_crate()
|
||||
EC.name = "\proper[MA.name]"
|
||||
EC.value = 0
|
||||
EC.contents = list()
|
||||
var/base_value = 0
|
||||
|
||||
for(var/atom/movable/MA in area_shuttle)
|
||||
if(MA.anchored)
|
||||
continue
|
||||
// Must be in a crate!
|
||||
if(istype(MA,/obj/structure/closet/crate))
|
||||
var/obj/structure/closet/crate/CR = MA
|
||||
callHook("sell_crate", list(CR, subarea))
|
||||
|
||||
var/datum/exported_crate/EC = new /datum/exported_crate()
|
||||
EC.name = "\proper[MA.name]"
|
||||
EC.value = 0
|
||||
EC.contents = list()
|
||||
var/base_value = 0
|
||||
points += CR.points_per_crate
|
||||
if(CR.points_per_crate)
|
||||
base_value = CR.points_per_crate
|
||||
var/find_slip = 1
|
||||
|
||||
// Must be in a crate!
|
||||
if(istype(MA,/obj/structure/closet/crate))
|
||||
var/obj/structure/closet/crate/CR = MA
|
||||
callHook("sell_crate", list(CR, area_shuttle))
|
||||
for(var/atom/A in CR)
|
||||
EC.contents[++EC.contents.len] = list(
|
||||
"object" = "\proper[A.name]",
|
||||
"value" = 0,
|
||||
"quantity" = 1
|
||||
)
|
||||
|
||||
points += CR.points_per_crate
|
||||
if(CR.points_per_crate)
|
||||
base_value = CR.points_per_crate
|
||||
var/find_slip = 1
|
||||
// Sell manifests
|
||||
if(find_slip && istype(A,/obj/item/weapon/paper/manifest))
|
||||
var/obj/item/weapon/paper/manifest/slip = A
|
||||
if(!slip.is_copy && slip.stamped && slip.stamped.len) //yes, the clown stamp will work. clown is the highest authority on the station, it makes sense
|
||||
points += points_per_slip
|
||||
EC.contents[EC.contents.len]["value"] = points_per_slip
|
||||
find_slip = 0
|
||||
continue
|
||||
|
||||
for(var/atom/A in CR)
|
||||
EC.contents[++EC.contents.len] = list(
|
||||
"object" = "\proper[A.name]",
|
||||
"value" = 0,
|
||||
"quantity" = 1
|
||||
// Sell phoron and platinum
|
||||
if(istype(A, /obj/item/stack))
|
||||
var/obj/item/stack/P = A
|
||||
if(material_points_conversion[P.get_material_name()])
|
||||
EC.contents[EC.contents.len]["value"] = P.get_amount() * material_points_conversion[P.get_material_name()]
|
||||
EC.contents[EC.contents.len]["quantity"] = P.get_amount()
|
||||
EC.value += EC.contents[EC.contents.len]["value"]
|
||||
|
||||
//Sell spacebucks
|
||||
if(istype(A, /obj/item/weapon/spacecash))
|
||||
var/obj/item/weapon/spacecash/cashmoney = A
|
||||
EC.contents[EC.contents.len]["value"] = cashmoney.worth * points_per_money
|
||||
EC.contents[EC.contents.len]["quantity"] = cashmoney.worth
|
||||
EC.value += EC.contents[EC.contents.len]["value"]
|
||||
|
||||
|
||||
|
||||
// Make a log of it, but it wasn't shipped properly, and so isn't worth anything
|
||||
else
|
||||
EC.contents = list(
|
||||
"error" = "Error: Product was improperly packaged. Payment rendered null under terms of agreement."
|
||||
)
|
||||
|
||||
// Sell manifests
|
||||
if(find_slip && istype(A,/obj/item/weapon/paper/manifest))
|
||||
var/obj/item/weapon/paper/manifest/slip = A
|
||||
if(!slip.is_copy && slip.stamped && slip.stamped.len) //yes, the clown stamp will work. clown is the highest authority on the station, it makes sense
|
||||
points += points_per_slip
|
||||
EC.contents[EC.contents.len]["value"] = points_per_slip
|
||||
find_slip = 0
|
||||
exported_crates += EC
|
||||
points += EC.value
|
||||
EC.value += base_value
|
||||
|
||||
// Duplicate the receipt for the admin-side log
|
||||
var/datum/exported_crate/adm = new()
|
||||
adm.name = EC.name
|
||||
adm.value = EC.value
|
||||
adm.contents = deepCopyList(EC.contents)
|
||||
adm_export_history += adm
|
||||
|
||||
qdel(MA)
|
||||
|
||||
/datum/controller/subsystem/supply/proc/get_clear_turfs()
|
||||
var/list/clear_turfs = list()
|
||||
|
||||
for(var/area/subarea in shuttle.shuttle_area)
|
||||
for(var/turf/T in subarea)
|
||||
if(T.density)
|
||||
continue
|
||||
var/occupied = 0
|
||||
for(var/atom/A in T.contents)
|
||||
if(!A.simulated)
|
||||
continue
|
||||
occupied = 1
|
||||
break
|
||||
if(!occupied)
|
||||
clear_turfs += T
|
||||
|
||||
// Sell phoron and platinum
|
||||
if(istype(A, /obj/item/stack))
|
||||
var/obj/item/stack/P = A
|
||||
if(material_points_conversion[P.get_material_name()])
|
||||
EC.contents[EC.contents.len]["value"] = P.get_amount() * material_points_conversion[P.get_material_name()]
|
||||
EC.contents[EC.contents.len]["quantity"] = P.get_amount()
|
||||
EC.value += EC.contents[EC.contents.len]["value"]
|
||||
|
||||
//Sell spacebucks
|
||||
if(istype(A, /obj/item/weapon/spacecash))
|
||||
var/obj/item/weapon/spacecash/cashmoney = A
|
||||
EC.contents[EC.contents.len]["value"] = cashmoney.worth * points_per_money
|
||||
EC.contents[EC.contents.len]["quantity"] = cashmoney.worth
|
||||
EC.value += EC.contents[EC.contents.len]["value"]
|
||||
|
||||
|
||||
|
||||
// Make a log of it, but it wasn't shipped properly, and so isn't worth anything
|
||||
else
|
||||
EC.contents = list(
|
||||
"error" = "Error: Product was improperly packaged. Payment rendered null under terms of agreement."
|
||||
)
|
||||
|
||||
exported_crates += EC
|
||||
points += EC.value
|
||||
EC.value += base_value
|
||||
|
||||
// Duplicate the receipt for the admin-side log
|
||||
var/datum/exported_crate/adm = new()
|
||||
adm.name = EC.name
|
||||
adm.value = EC.value
|
||||
adm.contents = deepCopyList(EC.contents)
|
||||
adm_export_history += adm
|
||||
|
||||
qdel(MA)
|
||||
return clear_turfs
|
||||
|
||||
//Buying
|
||||
/datum/controller/supply/proc/buy()
|
||||
/datum/controller/subsystem/supply/proc/buy()
|
||||
var/list/shoppinglist = list()
|
||||
for(var/datum/supply_order/SO in order_history)
|
||||
if(SO.status == SUP_ORDER_APPROVED)
|
||||
@@ -177,26 +170,9 @@ var/datum/controller/supply/supply_controller = new()
|
||||
|
||||
if(!shoppinglist.len)
|
||||
return
|
||||
|
||||
var/orderedamount = shoppinglist.len
|
||||
|
||||
var/area/area_shuttle = shuttle.get_location_area()
|
||||
if(!area_shuttle)
|
||||
return
|
||||
|
||||
var/list/clear_turfs = list()
|
||||
|
||||
for(var/turf/T in area_shuttle)
|
||||
if(T.density)
|
||||
continue
|
||||
var/contcount
|
||||
for(var/atom/A in T.contents)
|
||||
if(!A.simulated)
|
||||
continue
|
||||
contcount++
|
||||
if(contcount)
|
||||
continue
|
||||
clear_turfs += T
|
||||
var/list/clear_turfs = get_clear_turfs()
|
||||
|
||||
for(var/datum/supply_order/SO in shoppinglist)
|
||||
if(!clear_turfs.len)
|
||||
@@ -265,9 +241,9 @@ var/datum/controller/supply/supply_controller = new()
|
||||
return
|
||||
|
||||
// Will attempt to purchase the specified order, returning TRUE on success, FALSE on failure
|
||||
/datum/controller/supply/proc/approve_order(var/datum/supply_order/O, var/mob/user)
|
||||
/datum/controller/subsystem/supply/proc/approve_order(var/datum/supply_order/O, var/mob/user)
|
||||
// Not enough points to purchase the crate
|
||||
if(supply_controller.points <= O.object.cost)
|
||||
if(points <= O.object.cost)
|
||||
return FALSE
|
||||
|
||||
// Based on the current model, there shouldn't be any entries in order_history, requestlist, or shoppinglist, that aren't matched in adm_order_history
|
||||
@@ -294,11 +270,11 @@ var/datum/controller/supply/supply_controller = new()
|
||||
adm_order.approved_at = stationdate2text() + " - " + stationtime2text()
|
||||
|
||||
// Deduct cost
|
||||
supply_controller.points -= O.object.cost
|
||||
points -= O.object.cost
|
||||
return TRUE
|
||||
|
||||
// Will deny the specified order. Only useful if the order is currently requested, but available at any status
|
||||
/datum/controller/supply/proc/deny_order(var/datum/supply_order/O, var/mob/user)
|
||||
/datum/controller/subsystem/supply/proc/deny_order(var/datum/supply_order/O, var/mob/user)
|
||||
// Based on the current model, there shouldn't be any entries in order_history, requestlist, or shoppinglist, that aren't matched in adm_order_history
|
||||
var/datum/supply_order/adm_order
|
||||
for(var/datum/supply_order/temp in adm_order_history)
|
||||
@@ -324,22 +300,22 @@ var/datum/controller/supply/supply_controller = new()
|
||||
return
|
||||
|
||||
// Will deny all requested orders
|
||||
/datum/controller/supply/proc/deny_all_pending(var/mob/user)
|
||||
/datum/controller/subsystem/supply/proc/deny_all_pending(var/mob/user)
|
||||
for(var/datum/supply_order/O in order_history)
|
||||
if(O.status == SUP_ORDER_REQUESTED)
|
||||
deny_order(O, user)
|
||||
|
||||
// Will delete the specified order from the user-side list
|
||||
/datum/controller/supply/proc/delete_order(var/datum/supply_order/O, var/mob/user)
|
||||
/datum/controller/subsystem/supply/proc/delete_order(var/datum/supply_order/O, var/mob/user)
|
||||
// Making sure they know what they're doing
|
||||
if(alert(user, "Are you sure you want to delete this record? If it has been approved, cargo points will NOT be refunded!", "Delete Record","No","Yes") == "Yes")
|
||||
if(alert(user, "Are you really sure? There is no way to recover the order once deleted.", "Delete Record", "No", "Yes") == "Yes")
|
||||
log_admin("[key_name(user)] has deleted supply order \ref[O] [O] from the user-side order history.")
|
||||
supply_controller.order_history -= O
|
||||
order_history -= O
|
||||
return
|
||||
|
||||
// Will generate a new, requested order, for the given supply pack type
|
||||
/datum/controller/supply/proc/create_order(var/datum/supply_pack/S, var/mob/user, var/reason)
|
||||
/datum/controller/subsystem/supply/proc/create_order(var/datum/supply_pack/S, var/mob/user, var/reason)
|
||||
var/datum/supply_order/new_order = new()
|
||||
var/datum/supply_order/adm_order = new() // Admin-recorded order must be a separate copy in memory, or user-made edits will corrupt it
|
||||
|
||||
@@ -374,16 +350,16 @@ var/datum/controller/supply/supply_controller = new()
|
||||
adm_order_history += adm_order
|
||||
|
||||
// Will delete the specified export receipt from the user-side list
|
||||
/datum/controller/supply/proc/delete_export(var/datum/exported_crate/E, var/mob/user)
|
||||
/datum/controller/subsystem/supply/proc/delete_export(var/datum/exported_crate/E, var/mob/user)
|
||||
// Making sure they know what they're doing
|
||||
if(alert(user, "Are you sure you want to delete this record?", "Delete Record","No","Yes") == "Yes")
|
||||
if(alert(user, "Are you really sure? There is no way to recover the receipt once deleted.", "Delete Record", "No", "Yes") == "Yes")
|
||||
log_admin("[key_name(user)] has deleted export receipt \ref[E] [E] from the user-side export history.")
|
||||
supply_controller.exported_crates -= E
|
||||
exported_crates -= E
|
||||
return
|
||||
|
||||
// Will add an item entry to the specified export receipt on the user-side list
|
||||
/datum/controller/supply/proc/add_export_item(var/datum/exported_crate/E, var/mob/user)
|
||||
/datum/controller/subsystem/supply/proc/add_export_item(var/datum/exported_crate/E, var/mob/user)
|
||||
var/new_name = input(user, "Name", "Please enter the name of the item.") as null|text
|
||||
if(!new_name)
|
||||
return
|
||||
@@ -401,3 +377,21 @@ var/datum/controller/supply/supply_controller = new()
|
||||
"quantity" = new_quantity,
|
||||
"value" = new_value
|
||||
)
|
||||
|
||||
/datum/exported_crate
|
||||
var/name
|
||||
var/value
|
||||
var/list/contents
|
||||
|
||||
/datum/supply_order
|
||||
var/ordernum // Unfabricatable index
|
||||
var/index // Fabricatable index
|
||||
var/datum/supply_pack/object = null
|
||||
var/cost // Cost of the supply pack (Fabricatable) (Changes not reflected when purchasing supply packs, this is cosmetic only)
|
||||
var/name // Name of the supply pack datum (Fabricatable)
|
||||
var/ordered_by = null // Who requested the order
|
||||
var/comment = null // What reason was given for the order
|
||||
var/approved_by = null // Who approved the order
|
||||
var/ordered_at // Date and time the order was requested at
|
||||
var/approved_at // Date and time the order was approved at
|
||||
var/status // [Requested, Accepted, Denied, Shipped]
|
||||
@@ -27,8 +27,6 @@ SUBSYSTEM_DEF(timer)
|
||||
var/last_invoke_tick = 0
|
||||
var/static/last_invoke_warning = 0
|
||||
var/static/bucket_auto_reset = TRUE
|
||||
var/static/datum/timedevent/timer // VOREStation Edit - For debugging this goes here.
|
||||
var/super_debug = FALSE // VOREStation Edit - Temporary Debugging
|
||||
|
||||
/datum/controller/subsystem/timer/PreInit()
|
||||
bucket_list.len = BUCKET_LEN
|
||||
@@ -104,13 +102,11 @@ SUBSYSTEM_DEF(timer)
|
||||
if (next_clienttime_timer_index)
|
||||
clienttime_timers.Cut(1, next_clienttime_timer_index+1)
|
||||
|
||||
var/pre_state = src.state
|
||||
if (MC_TICK_CHECK)
|
||||
log_world("Timer bailing before execution at world.time=[world.time] with LIT=[last_invoke_tick], TICK_USAGE=[TICK_USAGE], current_ticklimit=[Master.current_ticklimit], state=[pre_state] -> [src.state], queued_priority=[queued_priority] tick_overrun=[tick_overrun]") // VOREStation Edit - Debugging
|
||||
return
|
||||
|
||||
var/static/list/spent = list()
|
||||
// var/static/datum/timedevent/timer VOREStation Edit - for debugging purpose putting this as datum scope
|
||||
var/static/datum/timedevent/timer
|
||||
if (practical_offset > BUCKET_LEN)
|
||||
head_offset += TICKS2DS(BUCKET_LEN)
|
||||
practical_offset = 1
|
||||
@@ -143,15 +139,8 @@ SUBSYSTEM_DEF(timer)
|
||||
last_invoke_tick = world.time
|
||||
|
||||
if (MC_TICK_CHECK)
|
||||
if (super_debug) log_world("Bailing from execution with practical_offset=[practical_offset] and timer=[timer]") // VOREStation Edit - Super Debug
|
||||
return
|
||||
|
||||
// VOREStation Edit Start - Debugging
|
||||
if (timer.next == timer && timer.next != head)
|
||||
log_world("Self-looping out of bucket timer failure condition X occurred")
|
||||
CRASH("Invalid timer: [get_timer_debug_string(timer)] world.time: [world.time], head_offset: [head_offset], practical_offset: [practical_offset]")
|
||||
// VOREStation Edit End - Debugging
|
||||
|
||||
timer = timer.next
|
||||
if (timer == head)
|
||||
break
|
||||
@@ -246,11 +235,6 @@ SUBSYSTEM_DEF(timer)
|
||||
|
||||
/datum/controller/subsystem/timer/proc/reset_buckets()
|
||||
var/list/bucket_list = src.bucket_list
|
||||
// VOREStation Edit Start - Debugging
|
||||
log_world("Beginning Timer bucket reset. bucket_list.len=[length(bucket_list)], BUCKET_LEN=[BUCKET_LEN], \
|
||||
world.tick_lag = [world.tick_lag], bucket_resolution=[bucket_resolution], world.time: [world.time], \
|
||||
head_offset: [head_offset], practical_offset: [practical_offset]")
|
||||
// VOREStation Edit End - Debugging
|
||||
var/list/alltimers = list()
|
||||
//collect the timers currently in the bucket
|
||||
for (var/bucket_head in bucket_list)
|
||||
@@ -272,11 +256,6 @@ SUBSYSTEM_DEF(timer)
|
||||
|
||||
alltimers += second_queue
|
||||
if (!length(alltimers))
|
||||
// VOREStation Edit Start - Debugging
|
||||
log_world("Finished Timer bucket reset. bucket_list.len=[length(bucket_list)], BUCKET_LEN=[BUCKET_LEN], \
|
||||
world.tick_lag = [world.tick_lag], bucket_resolution=[bucket_resolution], world.time: [world.time], \
|
||||
head_offset: [head_offset], practical_offset: [practical_offset] (NO TIMERS)")
|
||||
// VOREStation Edit End - Debugging
|
||||
return
|
||||
|
||||
sortTim(alltimers, /proc/cmp_timer)
|
||||
@@ -323,11 +302,7 @@ SUBSYSTEM_DEF(timer)
|
||||
alltimers.Cut(1, i+1)
|
||||
second_queue = alltimers
|
||||
bucket_count = new_bucket_count
|
||||
// VOREStation Edit Start - Debugging
|
||||
log_world("Finished Timer bucket reset. bucket_list.len=[length(bucket_list)], BUCKET_LEN=[BUCKET_LEN], \
|
||||
world.tick_lag = [world.tick_lag], bucket_resolution=[bucket_resolution], world.time: [world.time], \
|
||||
head_offset: [head_offset], practical_offset: [practical_offset]")
|
||||
// VOREStation Edit End - Debugging
|
||||
|
||||
|
||||
/datum/controller/subsystem/timer/Recover()
|
||||
second_queue |= SStimer.second_queue
|
||||
@@ -421,8 +396,6 @@ SUBSYSTEM_DEF(timer)
|
||||
var/datum/timedevent/buckethead
|
||||
if(bucketpos > 0)
|
||||
buckethead = bucket_list[bucketpos]
|
||||
else // VOREStation Edit - Debugging
|
||||
log_world("WARNING: non-positive bucket pos [bucketpos] for [src]! next=[next ? next : "NULL"] prev=[prev ? prev : "NULL"]") // VOREStation Edit - Debugging
|
||||
if(buckethead == src)
|
||||
bucket_list[bucketpos] = next
|
||||
SStimer.bucket_count--
|
||||
|
||||
@@ -191,7 +191,7 @@ SUBSYSTEM_DEF(vote)
|
||||
|
||||
/datum/controller/subsystem/vote/proc/initiate_vote(vote_type, initiator_key, automatic = FALSE, time = config.vote_period)
|
||||
if(!mode)
|
||||
if(started_time != null && !(check_rights(R_ADMIN) || automatic))
|
||||
if(started_time != null && !(check_rights(R_ADMIN|R_EVENT) || automatic))
|
||||
var/next_allowed_time = (started_time + config.vote_delay)
|
||||
if(next_allowed_time > world.time)
|
||||
return 0
|
||||
@@ -213,7 +213,7 @@ SUBSYSTEM_DEF(vote)
|
||||
additional_text.Add("<td align = 'center'>[M.required_players]</td>")
|
||||
gamemode_names["secret"] = "Secret"
|
||||
if(VOTE_CREW_TRANSFER)
|
||||
if(!check_rights(R_ADMIN|R_MOD, 0)) // The gods care not for the affairs of the mortals
|
||||
if(!check_rights(R_ADMIN|R_MOD|R_EVENT, 0)) // The gods care not for the affairs of the mortals
|
||||
if(get_security_level() == "red" || get_security_level() == "delta")
|
||||
to_chat(initiator_key, "The current alert status is too high to call for a crew transfer!")
|
||||
return 0
|
||||
@@ -269,7 +269,7 @@ SUBSYSTEM_DEF(vote)
|
||||
return
|
||||
var/admin = FALSE
|
||||
if(C.holder)
|
||||
if(C.holder.rights & R_ADMIN)
|
||||
if(C.holder.rights & R_ADMIN|R_EVENT)
|
||||
admin = TRUE
|
||||
|
||||
. = "<html><head><title>Voting Panel</title></head><body>"
|
||||
|
||||
@@ -30,7 +30,7 @@ SUBSYSTEM_DEF(xenoarch)
|
||||
. = ..()
|
||||
|
||||
/datum/controller/subsystem/xenoarch/proc/SetupXenoarch()
|
||||
for(var/turf/simulated/mineral/M in turfs)
|
||||
for(var/turf/simulated/mineral/M in world)
|
||||
if(!M.density || M.z in using_map.xenoarch_exempt_levels)
|
||||
continue
|
||||
|
||||
|
||||
@@ -94,14 +94,12 @@
|
||||
options["LEGACY: air_master"] = air_master
|
||||
options["LEGACY: job_master"] = job_master
|
||||
options["LEGACY: radio_controller"] = radio_controller
|
||||
options["LEGACY: supply_controller"] = supply_controller
|
||||
options["LEGACY: emergency_shuttle"] = emergency_shuttle
|
||||
options["LEGACY: paiController"] = paiController
|
||||
options["LEGACY: cameranet"] = cameranet
|
||||
options["LEGACY: transfer_controller"] = transfer_controller
|
||||
options["LEGACY: gas_data"] = gas_data
|
||||
options["LEGACY: plant_controller"] = plant_controller
|
||||
options["LEGACY: alarm_manager"] = alarm_manager
|
||||
|
||||
var/pick = input(mob, "Choose a controller to debug/view variables of.", "VV controller:") as null|anything in options
|
||||
if(!pick)
|
||||
|
||||
Reference in New Issue
Block a user