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

Hostile Survivor Rework #6308

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from 19 commits
Commits
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
6 changes: 6 additions & 0 deletions code/__DEFINES/__game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@
#define PLAY_SYNTH (1<<5)
#define PLAY_MISC (1<<6)

//toggles_survivor
#define PLAY_SURVIVOR_HOSTILE (1<<0)
#define PLAY_SURVIVOR_NON_HOSTILE (1<<1)

//toggles_admin
/// Splits admin tabs in Statpanel
#define SPLIT_ADMIN_TABS (1<<0)
Expand All @@ -165,6 +169,8 @@

#define TOGGLES_ERT_DEFAULT (PLAY_LEADER|PLAY_MEDIC|PLAY_ENGINEER|PLAY_HEAVY|PLAY_SMARTGUNNER|PLAY_SYNTH|PLAY_MISC)

#define TOGGLES_SURVIVOR_DEFAULT (PLAY_SURVIVOR_HOSTILE|PLAY_SURVIVOR_NON_HOSTILE)

#define TOGGLES_ADMIN_DEFAULT (NONE)

// Game Intents
Expand Down
4 changes: 2 additions & 2 deletions code/__DEFINES/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ GLOBAL_LIST_INIT(job_squad_roles, JOB_SQUAD_ROLES_LIST)
#define ENGINEERING_SURVIVOR "Engineering Survivor"
#define CORPORATE_SURVIVOR "Corporate Survivor"
#define HOSTILE_SURVIVOR "Hostile Survivor" //AKA Marine Killers assuming they survive. Will do cultist survivor at some point.
#define SURVIVOR_VARIANT_LIST list(ANY_SURVIVOR = "Any", CIVILIAN_SURVIVOR = "Civ", SECURITY_SURVIVOR = "Sec", SCIENTIST_SURVIVOR = "Sci", MEDICAL_SURVIVOR = "Med", ENGINEERING_SURVIVOR = "Eng", CORPORATE_SURVIVOR = "W-Y", HOSTILE_SURVIVOR = "CLF")
#define SURVIVOR_VARIANT_LIST list(ANY_SURVIVOR = "Any", CIVILIAN_SURVIVOR = "Civ", SECURITY_SURVIVOR = "Sec", SCIENTIST_SURVIVOR = "Sci", MEDICAL_SURVIVOR = "Med", ENGINEERING_SURVIVOR = "Eng", CORPORATE_SURVIVOR = "W-Y")

//-1 is infinite amount, these are soft caps and can be bypassed by randomization
#define MAX_SURVIVOR_PER_TYPE list(ANY_SURVIVOR = -1, CIVILIAN_SURVIVOR = -1, SECURITY_SURVIVOR = 2, SCIENTIST_SURVIVOR = 2, MEDICAL_SURVIVOR = 3, ENGINEERING_SURVIVOR = 4, CORPORATE_SURVIVOR = 2, HOSTILE_SURVIVOR = 1)
#define MAX_SURVIVOR_PER_TYPE list(ANY_SURVIVOR = -1, CIVILIAN_SURVIVOR = -1, SECURITY_SURVIVOR = 2, SCIENTIST_SURVIVOR = 2, MEDICAL_SURVIVOR = 3, ENGINEERING_SURVIVOR = 4, CORPORATE_SURVIVOR = 2)

#define SPAWN_PRIORITY_VERY_HIGH 1
#define SPAWN_PRIORITY_HIGH 2
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/nightmare.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#define NIGHTMARE_CTX_GROUND "ground"
/// Ship Map Context: Performs actions relevant to the ship map
#define NIGHTMARE_CTX_SHIP "ship"
/// Hostile Survivor Scenarios
#define NIGHTMARE_SCENARIO_HOSTILE_SURVIVOR list("lvevent" = list("fallen_ship", "clfship"), "riot_in_progress" = list("clfship"), "panic_room" = list("clfship"))

// File names for use in context configs
#define NIGHTMARE_FILE_SCENARIO "scenario.json"
Expand Down
12 changes: 12 additions & 0 deletions code/controllers/subsystem/nightmare.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ SUBSYSTEM_DEF(nightmare)
var/list/contexts = list()
/// List of parsed file nodes
var/list/roots = list()
/// Associated list of scenarios that indicate hostile survivor spawning
var/list/hostile_survivor_scenarios = NIGHTMARE_SCENARIO_HOSTILE_SURVIVOR

/datum/controller/subsystem/nightmare/Initialize(start_timeofday)
var/global_nightmare_path = CONFIG_GET(string/nightmare_path)
Expand Down Expand Up @@ -139,3 +141,13 @@ SUBSYSTEM_DEF(nightmare)
else
CRASH("Tried to instanciate an invalid node type")

/// Returns whether the ground context indicates a hostile survivor scenario
/datum/controller/subsystem/nightmare/proc/get_scenario_is_hostile_survivor()
// Assumption: Only ground context is relevant
var/datum/nmcontext/ground_context = contexts[NIGHTMARE_CTX_GROUND]
for(var/key in hostile_survivor_scenarios)
var/scenario = ground_context.get_scenario_value(key)
for(var/value in hostile_survivor_scenarios[key])
if(scenario == value)
return TRUE
return FALSE
16 changes: 16 additions & 0 deletions code/game/jobs/job/civilians/other/survivors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
"
to_chat_spaced(survivor, html = entrydisplay)

/datum/job/civilian/survivor/can_play_role_in_scenario(client/client)
. = ..()
if(!.)
return .

if(SSnightmare.get_scenario_is_hostile_survivor())
return HAS_FLAG(client.prefs?.toggles_survivor, PLAY_SURVIVOR_HOSTILE)
else
return HAS_FLAG(client.prefs?.toggles_survivor, PLAY_SURVIVOR_NON_HOSTILE)

/datum/job/civilian/survivor/spawn_in_player(mob/new_player/NP)
. = ..()
var/mob/living/carbon/human/H = .
Expand All @@ -44,6 +54,12 @@
potential_spawners += spawner
if(length(potential_spawners))
break
if(!length(potential_spawners))
// Generally this shouldn't happen since role authority shouldn't be rolling us for a survivor in a hostile scenario
message_admins("Failed to spawn_in_player [key_name_admin(H)] as a survivor! This likely means NIGHTMARE_SCENARIO_HOSTILE_SURVIVOR is incorrect for this map!")
H.send_to_lobby()
qdel(H)
return null
var/obj/effect/landmark/survivor_spawner/picked_spawner = pick(potential_spawners)
H.forceMove(get_turf(picked_spawner))

Expand Down
4 changes: 4 additions & 0 deletions code/game/jobs/job/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@

return TRUE

/// Whether the client passes requirements for the scenario
/datum/job/proc/can_play_role_in_scenario(client/client)
return TRUE

/datum/job/proc/get_role_requirements(client/C)
var/list/return_requirements = list()
for(var/prereq in minimum_playtimes)
Expand Down
2 changes: 2 additions & 0 deletions code/game/jobs/role_authority.dm
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ I hope it's easier to tell what the heck this proc is even doing, unlike previou
return FALSE
if(!J.can_play_role(M.client))
return FALSE
if(!J.can_play_role_in_scenario(M.client))
return FALSE
if(!J.check_whitelist_status(M))
return FALSE
if(J.total_positions != -1 && J.get_total_positions(latejoin) <= J.current_positions)
Expand Down
6 changes: 6 additions & 0 deletions code/game/objects/effects/landmarks/survivor_spawner.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
// prevents stacking survivors on top of eachother
if(locate(/mob/living/carbon/human) in loc)
return FALSE
if(!survivor)
return FALSE
if(hostile && !HAS_FLAG(survivor.client?.prefs?.toggles_survivor, PLAY_SURVIVOR_HOSTILE))
return FALSE
if(!hostile && !HAS_FLAG(survivor.client?.prefs?.toggles_survivor, PLAY_SURVIVOR_NON_HOSTILE))
return FALSE
return TRUE

/obj/effect/landmark/survivor_spawner/lv624_crashed_clf
Expand Down
17 changes: 17 additions & 0 deletions code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ GLOBAL_LIST_INIT(bgstate_options, list(
var/toggles_sound = TOGGLES_SOUND_DEFAULT
var/toggles_flashing = TOGGLES_FLASHING_DEFAULT
var/toggles_ert = TOGGLES_ERT_DEFAULT
var/toggles_survivor = TOGGLES_SURVIVOR_DEFAULT
var/chat_display_preferences = CHAT_TYPE_ALL
var/item_animation_pref_level = SHOW_ITEM_ANIMATIONS_ALL
var/pain_overlay_pref_level = PAIN_OVERLAY_BLURRY
Expand Down Expand Up @@ -646,6 +647,12 @@ GLOBAL_LIST_INIT(bgstate_options, list(
dat += "<b>Spawn as Miscellaneous:</b> <a href='?_src_=prefs;preference=toggles_ert;flag=[PLAY_MISC]'><b>[toggles_ert & PLAY_MISC ? "Yes" : "No"]</b></a><br>"
dat += "</div>"

dat += "<div id='column2'>"
dat += "<h2><b><u>Survivor Settings:</u></b></h2>"
dat += "<b>Spawn as Hostile:</b> <a href='?_src_=prefs;preference=toggles_survivor;flag=[PLAY_SURVIVOR_HOSTILE]'><b>[toggles_survivor & PLAY_SURVIVOR_HOSTILE ? "Yes" : "No"]</b></a><br>"
dat += "<b>Spawn as Non-Hostile:</b> <a href='?_src_=prefs;preference=toggles_survivor;flag=[PLAY_SURVIVOR_NON_HOSTILE]'><b>[toggles_survivor & PLAY_SURVIVOR_NON_HOSTILE ? "Yes" : "No"]</b></a><br>"
dat += "</div>"

dat += "</div></body>"

winshow(user, "preferencewindow", TRUE)
Expand Down Expand Up @@ -1892,6 +1899,16 @@ GLOBAL_LIST_INIT(bgstate_options, list(
var/flag = text2num(href_list["flag"])
toggles_ert ^= flag

if("toggles_survivor")
var/flag = text2num(href_list["flag"])
toggles_survivor ^= flag
if(!HAS_FLAG(toggles_survivor, PLAY_SURVIVOR_HOSTILE|PLAY_SURVIVOR_NON_HOSTILE))
// Neither hostile nor non-hostile: Invert the other
if(flag == PLAY_SURVIVOR_NON_HOSTILE)
toggles_survivor ^= PLAY_SURVIVOR_HOSTILE
else
toggles_survivor ^= PLAY_SURVIVOR_NON_HOSTILE

if("ambientocclusion")
toggle_prefs ^= TOGGLE_AMBIENT_OCCLUSION
var/atom/movable/screen/plane_master/game_world/plane_master = locate() in user?.client.screen
Expand Down
3 changes: 3 additions & 0 deletions code/modules/client/preferences_savefile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
S["dual_wield_pref"] >> dual_wield_pref
S["toggles_flashing"] >> toggles_flashing
S["toggles_ert"] >> toggles_ert
S["toggles_survivor"] >> toggles_survivor
S["toggles_admin"] >> toggles_admin
S["UI_style"] >> UI_style
S["tgui_say"] >> tgui_say
Expand Down Expand Up @@ -230,6 +231,7 @@
dual_wield_pref = sanitize_integer(dual_wield_pref, 0, 2, initial(dual_wield_pref))
toggles_flashing= sanitize_integer(toggles_flashing, 0, SHORT_REAL_LIMIT, initial(toggles_flashing))
toggles_ert = sanitize_integer(toggles_ert, 0, SHORT_REAL_LIMIT, initial(toggles_ert))
toggles_survivor = sanitize_integer(toggles_survivor, 0, SHORT_REAL_LIMIT, initial(toggles_survivor))
toggles_admin = sanitize_integer(toggles_admin, 0, SHORT_REAL_LIMIT, initial(toggles_admin))
UI_style_color = sanitize_hexcolor(UI_style_color, initial(UI_style_color))
UI_style_alpha = sanitize_integer(UI_style_alpha, 0, 255, initial(UI_style_alpha))
Expand Down Expand Up @@ -345,6 +347,7 @@
S["dual_wield_pref"] << dual_wield_pref
S["toggles_flashing"] << toggles_flashing
S["toggles_ert"] << toggles_ert
S["toggles_survivor"] << toggles_survivor
S["toggles_admin"] << toggles_admin
S["window_skin"] << window_skin
S["fps"] << fps
Expand Down
13 changes: 10 additions & 3 deletions maps/Nightmare/maps/BigRed/nightmare.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[
{ "type": "map_sprinkle", "path": "sprinkles/" },
{ "type": "pick", "chance": 0.40, "choices": [
{ "type": "map_insert", "landmark": "crashlanding-offices", "path": "standalone/crashlanding-offices.dmm" },
{ "type": "map_insert", "landmark": "crashlanding-eva", "path": "standalone/crashlanding-eva.dmm" }
{ "type": "map_insert", "landmark": "crashlanding-offices", "path": "standalone/crashlanding-offices.dmm", "when": { "lvevent": "none" } },
{ "type": "map_insert", "landmark": "crashlanding-eva", "path": "standalone/crashlanding-eva.dmm", "when": { "lvevent": "none" } }
]},
{ "type": "map_insert", "chance": 0.50, "landmark": "lambda-graveyard", "path": "standalone/lambda-graveyard.dmm" },
{ "type": "pick", "chance": 0.50, "choices": [
Expand All @@ -12,5 +12,12 @@
{ "type": "pick", "chance": 0.50, "choices": [
{ "weight": 3, "type": "map_insert", "landmark": "medbay-passage", "path": "standalone/medbay-passage.dmm" },
{ "weight": 1, "type": "map_insert", "landmark": "medbay-v3", "path": "standalone/medbay-v3.dmm" }
]}
]},
{
"type": "map_insert",
"landmark": "clfship",
"chance": 1.0,
"path": "standalone/clfship.dmm",
"when": { "lvevent": "fallen_ship" }
}
]
11 changes: 10 additions & 1 deletion maps/Nightmare/maps/BigRed/scenario.json
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
[]
[
{
"type": "pick", "name": "Big Red Global Event",
"choices": [
{ "weight": 9, "type": "def", "values": { "lvevent": "none" } },
{ "weight": 1, "type": "def", "values": { "lvevent": "fallen_ship" } }
]
}

]
7 changes: 7 additions & 0 deletions maps/Nightmare/maps/DesertDam/nightmare.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,12 @@
"chance": 1.0,
"path": "standalone/crashlanding-upp-alt1.dmm",
"when": { "lvevent": "uppcrash" }
},
{
"type": "map_insert",
"landmark": "clfship",
"chance": 1.0,
"path": "standalone/clfship.dmm",
"when": { "lvevent": "clfship" }
}
]
5 changes: 3 additions & 2 deletions maps/Nightmare/maps/DesertDam/scenario.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
{
"type": "pick", "name": "uppcrash",
"choices": [
{ "weight": 10, "type": "def", "values": { "lvevent": "none" } },
{ "weight": 4, "type": "def", "values": { "lvevent": "uppcrash" } }
{ "weight": 5, "type": "def", "values": { "lvevent": "none" } },
{ "weight": 4, "type": "def", "values": { "lvevent": "uppcrash" } },
{ "weight": 1, "type": "def", "values": { "lvevent": "clfship" } }
]
}
]
9 changes: 8 additions & 1 deletion maps/Nightmare/maps/FOP_v3_Sciannex/nightmare.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
"landmark": "riot_control",
"chance": 0.5,
"path": "standalone/riot_in_progress.dmm",
"when": { "riot_in_progress": "true" }
"when": { "riot_in_progress": "riot" }
},
{
"type": "map_insert",
"landmark": "clfship",
"chance": 1.0,
"path": "standalone/clfship.dmm",
"when": { "riot_in_progress": "clfship" }
}
]
5 changes: 3 additions & 2 deletions maps/Nightmare/maps/FOP_v3_Sciannex/scenario.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
{
"type": "pick", "name": "Riot Control",
"choices": [
{ "weight": 4, "type": "def", "values": { "riot_in_progress": "none" } },
{ "weight": 2, "type": "def", "values": { "riot_in_progress": "true" } }
{ "weight": 6, "type": "def", "values": { "riot_in_progress": "none" } },
{ "weight": 3, "type": "def", "values": { "riot_in_progress": "riot" } },
{ "weight": 1, "type": "def", "values": { "riot_in_progress": "clfship" } }
]
}
]
7 changes: 7 additions & 0 deletions maps/Nightmare/maps/Ice_Colony_v3/nightmare.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,12 @@
"chance": 0.5,
"path": "standalone/panic_room_hold.dmm",
"when": { "panic_room": "full" }
},
{
"type": "map_insert",
"landmark": "clfship",
"chance": 1.0,
"path": "standalone/clfship.dmm",
"when": { "panic_room": "clfship" }
}
]
6 changes: 4 additions & 2 deletions maps/Nightmare/maps/Ice_Colony_v3/scenario.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
{
"type": "pick", "name": "Panic Room",
"choices": [
{ "weight": 10, "type": "def", "values": { "panic_room": "none"} },
{ "weight": 3, "type": "def", "values": { "panic_room": "full"} }
{ "weight": 6, "type": "def", "values": { "panic_room": "none"} },
{ "weight": 3, "type": "def", "values": { "panic_room": "full"} },
{ "weight": 1, "type": "def", "values": { "panic_room": "clfship"} }
]
}

]

9 changes: 8 additions & 1 deletion maps/Nightmare/maps/Kutjevo/nightmare.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,12 @@
{
"type": "map_sprinkle",
"path": "sprinkles/"
}
},
{
"type": "map_insert",
"landmark": "clfship",
"chance": 1.0,
"path": "standalone/clfship.dmm",
"when": { "lvevent": "clfship" }
}
]
10 changes: 9 additions & 1 deletion maps/Nightmare/maps/Kutjevo/scenario.json
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
[]
[
{
"type": "pick", "name": "event",
"choices": [
{ "weight": 9, "type": "def", "values": { "lvevent": "none" } },
{ "weight": 1, "type": "def", "values": { "lvevent": "clfship" } }
]
}
]
2 changes: 1 addition & 1 deletion maps/Nightmare/maps/LV624/nightmare.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"type": "map_insert",
"landmark": "clfship",
"chance": 0.2,
"chance": 0.5,
"path": "standalone/clfship.dmm",
"when": { "lvevent": "fallen_ship" }
},
Expand Down
13 changes: 13 additions & 0 deletions maps/Nightmare/maps/New_Varadero/nightmare.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{
"type": "map_sprinkle",
"path": "sprinkles/"
},
{
"type": "map_insert",
"landmark": "clfship",
"chance": 1.0,
"path": "standalone/clfship.dmm",
"when": { "lvevent": "clfship" }
}
]
9 changes: 9 additions & 0 deletions maps/Nightmare/maps/New_Varadero/scenario.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"type": "pick", "name": "event",
"choices": [
{ "weight": 9, "type": "def", "values": { "lvevent": "none" } },
{ "weight": 1, "type": "def", "values": { "lvevent": "clfship" } }
]
}
]
9 changes: 8 additions & 1 deletion maps/Nightmare/maps/Sorokyne_Strata/nightmare.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,12 @@
{
"type": "map_sprinkle",
"path": "sprinkles/"
}
},
{
"type": "map_insert",
"landmark": "clfship",
"chance": 1.0,
"path": "standalone/clfship.dmm",
"when": { "lvevent": "clfship" }
}
]
10 changes: 9 additions & 1 deletion maps/Nightmare/maps/Sorokyne_Strata/scenario.json
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
[]
[
{
"type": "pick", "name": "event",
"choices": [
{ "weight": 9, "type": "def", "values": { "lvevent": "none" } },
{ "weight": 1, "type": "def", "values": { "lvevent": "clfship" } }
]
}
]
Loading
Loading