Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modular Evacuation #818

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
4f60d6a
move autotransfer into main code
DTraitor Jan 23, 2024
a54711f
save the changes
DTraitor Jan 23, 2024
f046192
And another save before solving hundreds of errors
DTraitor Jan 23, 2024
6ed5bd0
Almost done Pt. 1
DTraitor Jan 30, 2024
b084e4c
God save us all
DTraitor Feb 2, 2024
380485d
huge refactor
DTraitor Feb 2, 2024
8750037
I expected more problems after the refactor tbh
DTraitor Feb 2, 2024
38eac62
almost done with compiling
DTraitor Feb 3, 2024
e155726
emergency shuttle changes
DTraitor Feb 4, 2024
0ceb355
comm console
DTraitor Feb 4, 2024
69567fa
emergency shuttle
DTraitor Feb 5, 2024
0cf9598
whoops, shouldn't have commited it
DTraitor Feb 9, 2024
8d3cff9
evac panel
DTraitor Feb 10, 2024
315aba7
almost done
DTraitor Feb 20, 2024
419e686
Guess I am done with the project...
DTraitor Feb 20, 2024
b3fb68b
Merge remote-tracking branch 'DaedalusDock/master' into evacuation-da…
DTraitor Feb 20, 2024
0c1088e
remove some unused stuff
DTraitor Feb 20, 2024
32e3683
Merge branch 'master' into evacuation-datums
DTraitor Feb 21, 2024
7eb04ba
Update code/controllers/configuration/entries/game_options.dm
DTraitor Feb 24, 2024
05f9360
removed some leftover code
DTraitor Feb 24, 2024
f446dfa
Merge branch 'master' into evacuation-datums
DTraitor Feb 24, 2024
52f50cd
Arrival and recall time fixes
DTraitor Mar 3, 2024
6775a73
Merge branch 'master' into evacuation-datums
DTraitor Mar 3, 2024
420e61d
Merge branch 'master' into evacuation-datums
DTraitor Mar 6, 2024
dda6026
requested
DTraitor Mar 11, 2024
42e7bd0
Merge remote-tracking branch 'DaedalusDock/master' into evacuation-da…
DTraitor Mar 11, 2024
5639942
Merge branch 'evacuation-datums' of https://github.com/DTraitor/DS13-…
DTraitor Mar 11, 2024
236d17d
made stack traces better
DTraitor Mar 24, 2024
c1323b7
includes IDs now
DTraitor Mar 25, 2024
b567cb1
done
DTraitor Mar 25, 2024
d2f6f0e
Merge branch 'master' into evacuation-datums
DTraitor Apr 3, 2024
ed564a3
oopsie
DTraitor Apr 3, 2024
1b3ae0b
naming
DTraitor Apr 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/__DEFINES/evacuation.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define EVACUATION_STATE_IDLE 0
#define EVACUATION_STATE_INITIATED 1 // Evacuation has begun, but it can be cancelled
#define EVACUATION_STATE_AWAITING 2 // Awaiting players to board the shuttle/pods/etc, can't be cancelled but can be delayed
#define EVACUATION_STATE_NORETURN 3 // Shuttle/pods/etc have departed, can't be cancelled nor delayed
#define EVACUATION_STATE_EVACUATED 3 // Shuttle/pods/etc have departed, can't be cancelled nor delayed
#define EVACUATION_STATE_FINISHED 4

// Reasons for automatic evacuation
Expand Down
42 changes: 27 additions & 15 deletions code/controllers/subsystem/evacuation.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ SUBSYSTEM_DEF(evacuation)
/datum/controller/subsystem/evacuation/proc/can_evac(mob/caller, controller_id)
var/datum/evacuation_controller/controller = controllers[controller_id]
if(!controller)
stack_trace("Invalid controller ID")
DTraitor marked this conversation as resolved.
Show resolved Hide resolved
return "Error 500. Please contact your system administrator."
for(var/identifier in controllers)
if(controllers[identifier].state >= EVACUATION_STATE_AWAITING)
Expand All @@ -64,7 +65,7 @@ SUBSYSTEM_DEF(evacuation)
/datum/controller/subsystem/evacuation/proc/request_evacuation(mob/caller, reason, controller_id, admin = FALSE)
var/datum/evacuation_controller/controller = controllers[controller_id]
if(!controller)
return
CRASH("Invalid controller ID")
for(var/identifier in controllers)
if(controllers[identifier].state >= EVACUATION_STATE_AWAITING)
to_chat(caller, "Evacuation is already in progress.")
Expand All @@ -74,13 +75,13 @@ SUBSYSTEM_DEF(evacuation)
/datum/controller/subsystem/evacuation/proc/can_cancel(mob/caller, controller_id)
var/datum/evacuation_controller/controller = controllers[controller_id]
if(!controller)
return FALSE
CRASH("Invalid controller ID")
return controller.can_cancel(caller)

/datum/controller/subsystem/evacuation/proc/request_cancel(mob/caller, controller_id)
var/datum/evacuation_controller/controller = controllers[controller_id]
if(!controller)
return
CRASH("Invalid controller ID")
controller.trigger_cancel_evacuation(caller)

/datum/controller/subsystem/evacuation/proc/add_evacuation_blocker(datum/bad)
Expand All @@ -96,20 +97,24 @@ SUBSYSTEM_DEF(evacuation)
controllers[identifier].evacuation_unblocked()

/datum/controller/subsystem/evacuation/proc/disable_evacuation(controller_id)
if(controllers[controller_id])
controllers[controller_id].disable_evacuation()
if(!controllers[controller_id])
CRASH("Invalid controller ID")
controllers[controller_id].disable_evacuation()

/datum/controller/subsystem/evacuation/proc/enable_evacuation(controller_id)
if(controllers[controller_id])
controllers[controller_id].enable_evacuation()
if(!controllers[controller_id])
CRASH("Invalid controller ID")
controllers[controller_id].enable_evacuation()

/datum/controller/subsystem/evacuation/proc/block_cancel(controller_id)
if(controllers[controller_id])
controllers[controller_id].block_cancel()
if(!controllers[controller_id])
CRASH("Invalid controller ID")
controllers[controller_id].block_cancel()

/datum/controller/subsystem/evacuation/proc/unblock_cancel(controller_id)
if(controllers[controller_id])
controllers[controller_id].unblock_cancel()
if(!controllers[controller_id])
CRASH("Invalid controller ID")
controllers[controller_id].unblock_cancel()

//Perhaps move it to SShuttle?
/datum/controller/subsystem/evacuation/proc/get_customizable_shuttles()
Expand All @@ -123,7 +128,7 @@ SUBSYSTEM_DEF(evacuation)
for(var/identifier in controllers)
var/datum/evacuation_controller/controller = controllers[identifier]
// We only want to add the areas if the controller is in a state where evacuation has finished
if(controller.state >= EVACUATION_STATE_NORETURN)
if(controller.state >= EVACUATION_STATE_EVACUATED)
areas += controller.get_endgame_areas()
return areas

Expand All @@ -145,15 +150,22 @@ SUBSYSTEM_DEF(evacuation)
return TRUE
return FALSE

/datum/controller/subsystem/evacuation/proc/evacuation_can_be_cancelled()
for(var/identifier in controllers)
if(!controllers[identifier].can_cancel(null))
return FALSE
return TRUE

/datum/controller/subsystem/evacuation/proc/station_evacuated()
for(var/identifier in controllers)
if(controllers[identifier].state >= EVACUATION_STATE_NORETURN)
if(controllers[identifier].state >= EVACUATION_STATE_EVACUATED)
return TRUE
return FALSE

/datum/controller/subsystem/evacuation/proc/delay_evacuation(identifier, delay)
if(controllers[identifier])
controllers[identifier].delay_evacuation(delay)
if(!controllers[identifier])
CRASH("Invalid controller ID")
controllers[identifier].delay_evacuation(delay)

/datum/controller/subsystem/evacuation/proc/get_controllers_names(active_only = FALSE)
var/list/names = list()
Expand Down
6 changes: 3 additions & 3 deletions code/datums/evacuation_controllers/emergency_shuttle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ GLOBAL_DATUM(backup_shuttle, /obj/docking_port/mobile/emergency)
return "Emergency shuttle is on the way to the station. ETA: [emergency.getTimerStr()]"
if(EVACUATION_STATE_AWAITING)
return "Emergency shuttle is docked at the station. Awaiting crew. ETD: [emergency.getTimerStr()]"
if(EVACUATION_STATE_NORETURN)
if(EVACUATION_STATE_EVACUATED)
return "Emergency shuttle has left the station. ETA: [emergency.getTimerStr()]"
if(EVACUATION_STATE_FINISHED)
return "Emergency shuttle has arrived at CentCom"
Expand Down Expand Up @@ -145,7 +145,7 @@ GLOBAL_DATUM(backup_shuttle, /obj/docking_port/mobile/emergency)
priority_announce("Engines spooling up. Prepare for resonance jump.", "LRSV Icarus Announcement", do_not_modify = TRUE)

/datum/evacuation_controller/emergency_shuttle/proc/on_emergency_shuttle_departed(datum/source)
state = EVACUATION_STATE_NORETURN
state = EVACUATION_STATE_EVACUATED
UnregisterSignal(emergency, list(COMSIG_EMERGENCYSHUTTLE_DEPARTING, COMSIG_EMERGENCYSHUTTLE_ANNOUNCE))
RegisterSignal(emergency, COMSIG_EMERGENCYSHUTTLE_RETURNED, PROC_REF(on_emergency_shuttle_returned))
priority_announce("The Icarus has entered the resonance gate and is enroute to it's destination. Estimate [emergency.timeLeft(600)] minutes until the shuttle docks at Sector Control.", "LRSV Icarus Announcement")
Expand All @@ -159,7 +159,7 @@ GLOBAL_DATUM(backup_shuttle, /obj/docking_port/mobile/emergency)
/datum/evacuation_controller/emergency_shuttle/can_cancel(mob/user)
// Point of no return after 50% of the time has passed
if(emergency.timeLeft(1) < emergency_call_time * get_sec_level_modifier() * 0.5)
return
return FALSE
return ..()

/datum/evacuation_controller/emergency_shuttle/cancel_evacuation(mob/user)
Expand Down
4 changes: 2 additions & 2 deletions code/datums/evacuation_controllers/evacuation_controller.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
return "Initiadited"
if(EVACUATION_STATE_AWAITING)
return "Awaiting crew"
if(EVACUATION_STATE_NORETURN)
if(EVACUATION_STATE_EVACUATED)
return "Past point of no return"
if(EVACUATION_STATE_FINISHED)
return "Finished"
Expand Down Expand Up @@ -78,7 +78,7 @@
return FALSE
if(delayed_until > world.time)
return FALSE
if(state == EVACUATION_STATE_IDLE || state >= EVACUATION_STATE_NORETURN)
if(state == EVACUATION_STATE_IDLE || state >= EVACUATION_STATE_EVACUATED)
return FALSE
return TRUE

Expand Down
4 changes: 4 additions & 0 deletions code/game/gamemodes/dynamic/dynamic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,10 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1)
var/midround_injection_cooldown_middle = 0.5*(midround_delay_max + midround_delay_min)
midround_injection_cooldown = (round(clamp(EXP_DISTRIBUTION(midround_injection_cooldown_middle), midround_delay_min, midround_delay_max)) + world.time)

// Time to inject some threat into the round
if(SSevacuation.station_evacuated()) // Unless the shuttle is past the point of no return
DTraitor marked this conversation as resolved.
Show resolved Hide resolved
return

message_admins("DYNAMIC: Checking for midround injection.")
log_game("DYNAMIC: Checking for midround injection.")

Expand Down
3 changes: 0 additions & 3 deletions code/modules/antagonists/highlander/highlander.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
steal_objective.owner = owner
steal_objective.set_target(new /datum/objective_item/steal/nukedisc)
objectives += steal_objective
// var/datum/objective/elimination/highlander/elimination_objective = new
// elimination_objective.owner = owner
// objectives += elimination_objective

/datum/antagonist/highlander/on_gain()
forge_objectives()
Expand Down
16 changes: 2 additions & 14 deletions code/modules/antagonists/revolution/enemy_of_the_state.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
exile_choice.objective_name = "Choice"
objectives += exile_choice

// var/datum/objective/hijack/hijack_choice = new
// hijack_choice.owner = owner
// hijack_choice.objective_name = "Choice"
// objectives += hijack_choice

/datum/antagonist/enemy_of_the_state/on_gain()
owner.special_role = "exiled headrev"
forge_objectives()
Expand All @@ -44,23 +39,16 @@
//needs to complete only one objective, not all

var/option_chosen = FALSE
var/badass = FALSE
if(objectives.len)
report += printobjectives(objectives)
for(var/datum/objective/objective in objectives)
if(objective.check_completion())
option_chosen = TRUE
//if(istype(objective, /datum/objective/hijack))
// badass = TRUE
break

if(objectives.len == 0 || option_chosen)
if(badass)
report += "<span class='greentext big'>Major [name] Victory</span>"
report += "<B>[name] chose the badass option, and hijacked the shuttle!</B>"
else
report += "<span class='greentext big'>Minor [name] Victory</span>"
report += "<B>[name] has survived as an exile!</B>"
report += "<span class='greentext big'>[name] Victory</span>"
report += "<B>[name] has survived as an exile!</B>"
else
report += "<span class='redtext big'>The [name] has failed!</span>"

Expand Down
4 changes: 1 addition & 3 deletions code/modules/antagonists/wishgranter/wishgranter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
suicide_cry = "HAHAHAHAHA!!"

/datum/antagonist/wishgranter/proc/forge_objectives()
// var/datum/objective/hijack/hijack = new
// hijack.owner = owner
// objectives += hijack
CRASH("Tried to forge wishgranter objective.")

/datum/antagonist/wishgranter/on_gain()
owner.special_role = "Avatar of the Wish Granter"
Expand Down
3 changes: 2 additions & 1 deletion code/modules/mob/dead/new_player/new_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@
GLOB.joined_player_list += character.ckey

if(CONFIG_GET(flag/allow_latejoin_antagonists) && humanc) //Borgs aren't allowed to be antags. Will need to be tweaked if we get true latejoin ais.
SSticker.mode.make_antag_chance(humanc)
if(SSevacuation.evacuation_can_be_cancelled())
SSticker.mode.make_antag_chance(humanc)

if((job.job_flags & JOB_ASSIGN_QUIRKS) && humanc && CONFIG_GET(flag/roundstart_traits))
SSquirks.AssignQuirks(humanc, humanc.client)
Expand Down