diff --git a/_maps/voidcrew/RandomRuins/BeachRuins/fishing_hut.dmm b/_maps/voidcrew/RandomRuins/BeachRuins/fishing_hut.dmm
index 8f5cad05fc2..1905f78ca0a 100644
--- a/_maps/voidcrew/RandomRuins/BeachRuins/fishing_hut.dmm
+++ b/_maps/voidcrew/RandomRuins/BeachRuins/fishing_hut.dmm
@@ -372,7 +372,7 @@
/turf/template_noop,
/area/template_noop)
"qU" = (
-/mob/living/basic/trooper/pirate/melee,
+/obj/effect/spawner/human_npc/ruin/pirate,
/obj/structure/chair/stool/directional/west,
/turf/open/floor/bamboo/tatami,
/area/ruin/powered{
@@ -853,7 +853,7 @@
/turf/open/misc/asteroid/sand/beach,
/area/overmap_encounter/planetoid/beach)
"Mn" = (
-/mob/living/basic/trooper/pirate/ranged,
+/obj/effect/spawner/human_npc/ruin/pirate/gunner,
/obj/structure/chair/stool/directional/east,
/turf/open/floor/bamboo/tatami,
/area/ruin/powered{
diff --git a/_maps/voidcrew/RandomRuins/BeachRuins/push_it.dmm b/_maps/voidcrew/RandomRuins/BeachRuins/push_it.dmm
index 611652c7469..74926bbff22 100644
--- a/_maps/voidcrew/RandomRuins/BeachRuins/push_it.dmm
+++ b/_maps/voidcrew/RandomRuins/BeachRuins/push_it.dmm
@@ -157,7 +157,7 @@
/area/overmap_encounter/planetoid/beach)
"dG" = (
/obj/structure/chair,
-/mob/living/basic/trooper/russian/ranged,
+/obj/effect/spawner/human_npc/ruin/russian/gunner,
/obj/effect/turf_decal/siding/thinplating_new/dark{
dir = 8
},
@@ -244,7 +244,7 @@
/obj/structure/chair{
dir = 4
},
-/mob/living/basic/trooper/russian/ranged,
+/obj/effect/spawner/human_npc/ruin/russian/gunner,
/turf/open/floor/iron/dark,
/area/ruin/powered)
"ia" = (
@@ -338,7 +338,7 @@
/turf/template_noop,
/area/template_noop)
"mf" = (
-/mob/living/basic/trooper/russian,
+/obj/effect/spawner/human_npc/ruin/russian,
/turf/open/floor/carpet/neon/simple/violet/nodots,
/area/ruin/powered)
"ms" = (
@@ -365,7 +365,7 @@
/turf/open/floor/carpet/neon/simple/violet,
/area/ruin/powered)
"mK" = (
-/mob/living/basic/trooper/russian,
+/obj/effect/spawner/human_npc/ruin/russian,
/obj/effect/turf_decal/siding/thinplating_new/dark{
dir = 1
},
@@ -532,7 +532,7 @@
/area/ruin/powered)
"sv" = (
/obj/structure/chair/stool/directional/north,
-/mob/living/basic/trooper/russian,
+/obj/effect/spawner/human_npc/ruin/russian,
/turf/open/floor/carpet/neon/simple/violet/nodots,
/area/ruin/powered)
"sP" = (
@@ -602,7 +602,7 @@
/area/ruin/powered)
"ve" = (
/obj/structure/toilet,
-/mob/living/basic/trooper/russian,
+/obj/effect/spawner/human_npc/ruin/russian,
/obj/machinery/light/small/directional/north,
/turf/open/floor/iron/dark/smooth_large,
/area/ruin/powered)
@@ -738,7 +738,7 @@
/obj/structure/chair/sofa/corp/right{
dir = 1
},
-/mob/living/basic/trooper/russian/ranged,
+/obj/effect/spawner/human_npc/ruin/russian/gunner,
/turf/open/floor/carpet/neon/simple/violet,
/area/ruin/powered)
"Cz" = (
@@ -817,7 +817,7 @@
/obj/effect/turf_decal/siding/thinplating_new/dark{
dir = 1
},
-/mob/living/basic/trooper/russian/ranged,
+/obj/effect/spawner/human_npc/ruin/russian/gunner,
/turf/open/floor/iron/dark/smooth_large,
/area/ruin/powered)
"Fw" = (
@@ -1065,7 +1065,7 @@
/turf/open/floor/iron/dark,
/area/ruin/powered)
"Pl" = (
-/mob/living/basic/trooper/russian/ranged,
+/obj/effect/spawner/human_npc/ruin/russian/gunner,
/turf/open/floor/light/colour_cycle/dancefloor_a,
/area/ruin/powered)
"Pq" = (
@@ -1085,7 +1085,7 @@
/area/template_noop)
"Qw" = (
/obj/structure/chair/sofa/corp/corner,
-/mob/living/basic/trooper/russian,
+/obj/effect/spawner/human_npc/ruin/russian,
/turf/open/floor/carpet/neon/simple/violet,
/area/ruin/powered)
"QN" = (
@@ -1169,7 +1169,7 @@
"SV" = (
/obj/structure/mirror/directional/north,
/obj/structure/sink/directional/south,
-/mob/living/basic/trooper/russian/ranged,
+/obj/effect/spawner/human_npc/ruin/russian/gunner,
/obj/machinery/light/blacklight/directional/west,
/turf/open/floor/iron/dark/smooth_large,
/area/ruin/powered)
@@ -1218,7 +1218,7 @@
/turf/open/floor/carpet/neon/simple/violet,
/area/ruin/powered)
"Ux" = (
-/mob/living/basic/trooper/russian,
+/obj/effect/spawner/human_npc/ruin/russian,
/turf/open/floor/light/colour_cycle/dancefloor_a,
/area/ruin/powered)
"UU" = (
@@ -1257,7 +1257,7 @@
/obj/structure/chair/sofa/corp/corner{
dir = 8
},
-/mob/living/basic/trooper/russian,
+/obj/effect/spawner/human_npc/ruin/russian,
/turf/open/floor/iron/dark/smooth_large,
/area/ruin/powered)
"VX" = (
@@ -1292,7 +1292,7 @@
/obj/structure/chair{
dir = 1
},
-/mob/living/basic/trooper/russian,
+/obj/effect/spawner/human_npc/ruin/russian,
/obj/effect/turf_decal/siding/thinplating_new/dark{
dir = 8
},
diff --git a/_maps/voidcrew/RandomRuins/IceRuins/icemoon_underground_syndielab.dmm b/_maps/voidcrew/RandomRuins/IceRuins/icemoon_underground_syndielab.dmm
index 384d19ad3bf..4bb94e40177 100644
--- a/_maps/voidcrew/RandomRuins/IceRuins/icemoon_underground_syndielab.dmm
+++ b/_maps/voidcrew/RandomRuins/IceRuins/icemoon_underground_syndielab.dmm
@@ -18,13 +18,13 @@
/turf/open/floor/mineral/plastitanium/red,
/area/ruin/syndielab)
"ae" = (
-/mob/living/basic/trooper/syndicate/ranged,
+/obj/effect/spawner/human_npc/ruin/syndicate/gunner,
/obj/structure/cable/layer1,
/turf/open/floor/iron/dark/textured,
/area/ruin/syndielab)
"af" = (
/obj/structure/chair/sofa/corp/right,
-/mob/living/basic/trooper/syndicate/ranged,
+/obj/effect/spawner/human_npc/ruin/syndicate/gunner,
/obj/machinery/light/warm/directional/north,
/obj/structure/cable/layer1,
/turf/open/floor/iron/dark/textured,
diff --git a/_maps/voidcrew/RandomRuins/JungleRuins/jungle_pirate.dmm b/_maps/voidcrew/RandomRuins/JungleRuins/jungle_pirate.dmm
index c702a41efa4..3dc2f3b3ac2 100644
--- a/_maps/voidcrew/RandomRuins/JungleRuins/jungle_pirate.dmm
+++ b/_maps/voidcrew/RandomRuins/JungleRuins/jungle_pirate.dmm
@@ -167,7 +167,7 @@
/obj/structure/railing{
dir = 4
},
-/mob/living/basic/trooper/pirate/ranged,
+/obj/effect/spawner/human_npc/ruin/pirate/gunner,
/turf/open/floor/wood,
/area/ruin/unpowered)
"rc" = (
@@ -242,11 +242,11 @@
/turf/open/floor/wood,
/area/ruin/unpowered)
"DH" = (
-/mob/living/basic/trooper/pirate/ranged/space,
+/obj/effect/spawner/human_npc/ruin/pirate/space/gunner,
/turf/open/floor/carpet/red,
/area/ruin/unpowered)
"DS" = (
-/mob/living/basic/trooper/pirate/ranged,
+/obj/effect/spawner/human_npc/ruin/pirate/gunner,
/turf/open/floor/wood,
/area/ruin/unpowered)
"DV" = (
@@ -296,7 +296,7 @@
/turf/open/floor/wood,
/area/ruin/unpowered)
"LT" = (
-/mob/living/basic/trooper/pirate/melee,
+/obj/effect/spawner/human_npc/ruin/pirate,
/obj/structure/chair/wood,
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/wood,
@@ -366,7 +366,7 @@
/turf/open/misc/dirt/jungle,
/area/ruin/unpowered)
"UX" = (
-/mob/living/basic/trooper/pirate/melee,
+/obj/effect/spawner/human_npc/ruin/pirate,
/turf/open/floor/wood,
/area/ruin/unpowered)
"Vf" = (
@@ -396,7 +396,7 @@
/turf/open/floor/carpet/red,
/area/ruin/unpowered)
"XA" = (
-/mob/living/basic/trooper/pirate/melee,
+/obj/effect/spawner/human_npc/ruin/pirate,
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/wood,
/area/ruin/unpowered)
diff --git a/_maps/voidcrew/RandomRuins/JungleRuins/jungle_syndicate.dmm b/_maps/voidcrew/RandomRuins/JungleRuins/jungle_syndicate.dmm
index 22c2ce8c137..1d7fb523f84 100644
--- a/_maps/voidcrew/RandomRuins/JungleRuins/jungle_syndicate.dmm
+++ b/_maps/voidcrew/RandomRuins/JungleRuins/jungle_syndicate.dmm
@@ -129,7 +129,7 @@
/area/ruin/powered)
"G" = (
/obj/structure/cable,
-/mob/living/basic/trooper/syndicate,
+/obj/effect/spawner/human_npc/ruin/syndicate,
/turf/open/floor/plating,
/area/ruin/powered)
"H" = (
@@ -148,7 +148,7 @@
/area/ruin/unpowered)
"K" = (
/obj/structure/chair/plastic,
-/mob/living/basic/trooper/syndicate/ranged,
+/obj/effect/spawner/human_npc/ruin/syndicate/gunner,
/turf/open/floor/plating,
/area/ruin/powered)
"M" = (
diff --git a/_maps/voidcrew/RandomRuins/SpaceRuins/bounty_lair_mafia_club.dmm b/_maps/voidcrew/RandomRuins/SpaceRuins/bounty_lair_mafia_club.dmm
index ffeabbd76bb..67b2d679367 100644
--- a/_maps/voidcrew/RandomRuins/SpaceRuins/bounty_lair_mafia_club.dmm
+++ b/_maps/voidcrew/RandomRuins/SpaceRuins/bounty_lair_mafia_club.dmm
@@ -1749,7 +1749,7 @@
/area/ruin/space/has_grav/powered/mafia_club/back_office)
"FW" = (
/obj/effect/landmark/bounty_lair_gatekeeper{
- gatekeeper_type = /mob/living/basic/trooper/russian/mafia/lieutenant
+ gatekeeper_type = /mob/living/carbon/human/npc/bounty_mafia/lieutenant
},
/turf/open/floor/carpet/red,
/area/ruin/space/has_grav/powered/mafia_club/back_office)
@@ -2653,7 +2653,7 @@
/area/ruin/space/has_grav/powered/mafia_club/staff)
"ZX" = (
/obj/effect/landmark/bounty_lair_gatekeeper{
- gatekeeper_type = /mob/living/basic/trooper/russian/mafia/lieutenant
+ gatekeeper_type = /mob/living/carbon/human/npc/bounty_mafia/lieutenant
},
/turf/open/floor/iron/dark/textured,
/area/ruin/space/has_grav/powered/mafia_club/back_office)
diff --git a/_maps/voidcrew/RandomRuins/SpaceRuins/caravanambush.dmm b/_maps/voidcrew/RandomRuins/SpaceRuins/caravanambush.dmm
index 0189b72e62b..9c3bd502369 100644
--- a/_maps/voidcrew/RandomRuins/SpaceRuins/caravanambush.dmm
+++ b/_maps/voidcrew/RandomRuins/SpaceRuins/caravanambush.dmm
@@ -29,9 +29,7 @@
/area/template_noop)
"ah" = (
/obj/structure/lattice/catwalk,
-/mob/living/basic/trooper/pirate/ranged/space{
- environment_smash = 0
- },
+/obj/effect/spawner/human_npc/ruin/pirate/space/gunner,
/turf/template_noop,
/area/template_noop)
"ai" = (
@@ -60,7 +58,7 @@
/area/shuttle/ruin/caravan/freighter2)
"al" = (
/obj/effect/decal/cleanable/dirt,
-/mob/living/basic/trooper/syndicate/ranged/space,
+/obj/effect/spawner/human_npc/ruin/syndicate/commando/gunner,
/turf/open/floor/iron/airless,
/area/shuttle/ruin/caravan/freighter3)
"am" = (
@@ -74,7 +72,7 @@
dir = 4
},
/obj/effect/decal/cleanable/dirt,
-/mob/living/basic/trooper/syndicate/ranged/space,
+/obj/effect/spawner/human_npc/ruin/syndicate/commando/gunner,
/turf/open/floor/iron/airless,
/area/shuttle/ruin/caravan/freighter3)
"ao" = (
@@ -85,7 +83,7 @@
/obj/effect/turf_decal/box/white/corners{
dir = 4
},
-/mob/living/basic/trooper/syndicate/ranged/space,
+/obj/effect/spawner/human_npc/ruin/syndicate/commando/gunner,
/turf/open/floor/iron/dark/airless,
/area/shuttle/ruin/caravan/freighter3)
"aD" = (
@@ -623,9 +621,7 @@
dir = 4
},
/obj/effect/decal/cleanable/dirt,
-/mob/living/basic/trooper/pirate/ranged/space{
- environment_smash = 0
- },
+/obj/effect/spawner/human_npc/ruin/pirate/space/gunner,
/turf/open/floor/iron/airless,
/area/shuttle/ruin/caravan/freighter2)
"wC" = (
@@ -755,9 +751,7 @@
/area/ruin/space/has_grav)
"Fr" = (
/obj/effect/decal/cleanable/dirt,
-/mob/living/basic/trooper/pirate/ranged/space{
- environment_smash = 0
- },
+/obj/effect/spawner/human_npc/ruin/pirate/space/gunner,
/turf/open/floor/plating/airless,
/area/shuttle/ruin/caravan/freighter2)
"FG" = (
@@ -956,9 +950,7 @@
"Nm" = (
/obj/machinery/atmospherics/components/unary/vent_pump/on,
/obj/effect/decal/cleanable/dirt,
-/mob/living/basic/trooper/pirate/ranged/space{
- environment_smash = 0
- },
+/obj/effect/spawner/human_npc/ruin/pirate/space/gunner,
/turf/open/floor/iron/airless,
/area/shuttle/ruin/caravan/freighter2)
"NJ" = (
diff --git a/_maps/voidcrew/RandomRuins/SpaceRuins/derelict_construction.dmm b/_maps/voidcrew/RandomRuins/SpaceRuins/derelict_construction.dmm
index cfaca1c8c3b..9dc7a53c439 100644
--- a/_maps/voidcrew/RandomRuins/SpaceRuins/derelict_construction.dmm
+++ b/_maps/voidcrew/RandomRuins/SpaceRuins/derelict_construction.dmm
@@ -36,7 +36,7 @@
/area/ruin/space/has_grav/derelictconstruction)
"fa" = (
/obj/structure/lattice,
-/mob/living/basic/trooper/pirate/ranged/space,
+/obj/effect/spawner/human_npc/ruin/pirate/space/gunner,
/turf/template_noop,
/area/space/nearstation)
"gi" = (
@@ -438,7 +438,7 @@
/turf/open/floor/plating,
/area/ruin/space/has_grav/derelictconstruction)
"Za" = (
-/mob/living/basic/trooper/pirate/melee/space,
+/obj/effect/spawner/human_npc/ruin/pirate/space,
/obj/structure/lattice/catwalk,
/turf/template_noop,
/area/ruin/space/has_grav/derelictconstruction)
diff --git a/_maps/voidcrew/RandomRuins/SpaceRuins/forgottenship.dmm b/_maps/voidcrew/RandomRuins/SpaceRuins/forgottenship.dmm
index 9e743c22eb0..fd8752ec4a3 100644
--- a/_maps/voidcrew/RandomRuins/SpaceRuins/forgottenship.dmm
+++ b/_maps/voidcrew/RandomRuins/SpaceRuins/forgottenship.dmm
@@ -168,7 +168,7 @@
/turf/open/floor/mineral/plastitanium,
/area/ruin/space/has_grav/syndicate_forgotten_ship)
"aG" = (
-/mob/living/basic/trooper/nanotrasen/ranged,
+/obj/effect/spawner/human_npc/ruin/nanotrasen,
/turf/open/floor/mineral/plastitanium/red,
/area/ruin/space/has_grav/syndicate_forgotten_ship)
"aH" = (
@@ -190,7 +190,7 @@
dir = 10
},
/obj/item/wrench,
-/mob/living/basic/trooper/nanotrasen/ranged,
+/obj/effect/spawner/human_npc/ruin/nanotrasen,
/turf/open/floor/mineral/plastitanium/red,
/area/ruin/space/has_grav/syndicate_forgotten_ship)
"aK" = (
@@ -214,7 +214,7 @@
/area/ruin/space/has_grav/syndicate_forgotten_ship)
"aN" = (
/obj/machinery/light/directional/south,
-/mob/living/basic/trooper/nanotrasen/ranged,
+/obj/effect/spawner/human_npc/ruin/nanotrasen,
/turf/open/floor/iron/dark,
/area/ruin/space/has_grav/syndicate_forgotten_ship)
"aO" = (
@@ -299,7 +299,7 @@
/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
dir = 4
},
-/mob/living/basic/trooper/nanotrasen/ranged,
+/obj/effect/spawner/human_npc/ruin/nanotrasen,
/turf/open/floor/mineral/plastitanium,
/area/ruin/space/has_grav/syndicate_forgotten_ship)
"bd" = (
diff --git a/_maps/voidcrew/RandomRuins/SpaceRuins/garbagetruck2.dmm b/_maps/voidcrew/RandomRuins/SpaceRuins/garbagetruck2.dmm
index fd128120432..d16dfe16136 100644
--- a/_maps/voidcrew/RandomRuins/SpaceRuins/garbagetruck2.dmm
+++ b/_maps/voidcrew/RandomRuins/SpaceRuins/garbagetruck2.dmm
@@ -262,7 +262,7 @@
/turf/open/floor/plating,
/area/ruin/space/has_grav/garbagetruck/medicalwaste)
"wh" = (
-/mob/living/basic/trooper/syndicate/ranged,
+/obj/effect/spawner/human_npc/ruin/syndicate/gunner,
/turf/open/floor/plating,
/area/ruin/space/has_grav/garbagetruck/medicalwaste)
"wk" = (
diff --git a/_maps/voidcrew/RandomRuins/SpaceRuins/garbagetruck3.dmm b/_maps/voidcrew/RandomRuins/SpaceRuins/garbagetruck3.dmm
index 6575a90d588..a9db1cac58f 100644
--- a/_maps/voidcrew/RandomRuins/SpaceRuins/garbagetruck3.dmm
+++ b/_maps/voidcrew/RandomRuins/SpaceRuins/garbagetruck3.dmm
@@ -708,7 +708,7 @@
"JR" = (
/obj/effect/decal/cleanable/ash,
/obj/effect/decal/cleanable/blood/splatter/oil,
-/mob/living/basic/trooper/russian,
+/obj/effect/spawner/human_npc/ruin/russian,
/turf/open/floor/plating/dumpsterair,
/area/ruin/space/has_grav/garbagetruck/squat)
"JW" = (
diff --git a/_maps/voidcrew/RandomRuins/SpaceRuins/rare_pirate_cove.dmm b/_maps/voidcrew/RandomRuins/SpaceRuins/rare_pirate_cove.dmm
index 070986d9901..81402127f2c 100644
--- a/_maps/voidcrew/RandomRuins/SpaceRuins/rare_pirate_cove.dmm
+++ b/_maps/voidcrew/RandomRuins/SpaceRuins/rare_pirate_cove.dmm
@@ -68,7 +68,7 @@
/turf/open/floor/plating,
/area/ruin/space/has_grav/powered)
"ao" = (
-/mob/living/basic/trooper/pirate/melee/space,
+/obj/effect/spawner/human_npc/ruin/pirate/space,
/turf/open/misc/asteroid,
/area/ruin/space/has_grav/powered)
"ap" = (
@@ -176,7 +176,7 @@
/turf/open/misc/asteroid,
/area/ruin/space/has_grav/powered)
"aL" = (
-/mob/living/basic/trooper/pirate/ranged,
+/obj/effect/spawner/human_npc/ruin/pirate/gunner,
/turf/open/misc/asteroid,
/area/ruin/space/has_grav/powered)
"aM" = (
@@ -406,7 +406,7 @@
/turf/open/floor/wood,
/area/ruin/space/has_grav/powered)
"pn" = (
-/mob/living/basic/trooper/pirate/ranged,
+/obj/effect/spawner/human_npc/ruin/pirate/gunner,
/turf/open/floor/wood,
/area/ruin/space/has_grav/powered)
"rS" = (
@@ -523,7 +523,7 @@
/turf/open/floor/wood,
/area/ruin/space/has_grav/powered)
"Ej" = (
-/mob/living/basic/trooper/pirate/melee,
+/obj/effect/spawner/human_npc/ruin/pirate,
/turf/open/floor/wood,
/area/ruin/space/has_grav/powered)
"Fd" = (
@@ -541,7 +541,7 @@
/turf/open/floor/wood,
/area/ruin/space/has_grav/powered)
"Hx" = (
-/mob/living/basic/trooper/pirate/ranged/space,
+/obj/effect/spawner/human_npc/ruin/pirate/space/gunner,
/turf/open/floor/plating,
/area/ruin/space/has_grav/powered)
"JH" = (
@@ -640,7 +640,7 @@
/turf/open/floor/plating,
/area/ruin/space/has_grav/powered)
"Uv" = (
-/mob/living/basic/trooper/pirate/ranged,
+/obj/effect/spawner/human_npc/ruin/pirate/gunner,
/turf/open/floor/plating,
/area/ruin/space/has_grav/powered)
"UQ" = (
diff --git a/_maps/voidcrew/RandomRuins/SpaceRuins/the_faceoff.dmm b/_maps/voidcrew/RandomRuins/SpaceRuins/the_faceoff.dmm
index f2e9240f637..a19a80247cc 100644
--- a/_maps/voidcrew/RandomRuins/SpaceRuins/the_faceoff.dmm
+++ b/_maps/voidcrew/RandomRuins/SpaceRuins/the_faceoff.dmm
@@ -189,7 +189,7 @@
pixel_x = -1;
pixel_y = 5
},
-/mob/living/basic/trooper/syndicate/melee/space,
+/obj/effect/spawner/human_npc/ruin/syndicate/commando,
/turf/open/floor/iron/dark/airless,
/area/ruin/space)
"eU" = (
diff --git a/_maps/voidcrew/RandomRuins/SpaceRuins/waystation.dmm b/_maps/voidcrew/RandomRuins/SpaceRuins/waystation.dmm
index 6faae6d9085..ca04e714348 100644
--- a/_maps/voidcrew/RandomRuins/SpaceRuins/waystation.dmm
+++ b/_maps/voidcrew/RandomRuins/SpaceRuins/waystation.dmm
@@ -18,7 +18,7 @@
/turf/open/floor/iron,
/area/ruin/space/has_grav/waystation/cargobay)
"ad" = (
-/mob/living/basic/trooper/syndicate/ranged/space,
+/obj/effect/spawner/human_npc/ruin/syndicate/commando/gunner,
/obj/item/ammo_casing/shotgun/buckshot/spent{
pixel_x = 3;
pixel_y = 10
@@ -35,14 +35,14 @@
/area/ruin/space/has_grav/waystation/dorms)
"ae" = (
/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden/layer4,
-/mob/living/basic/trooper/syndicate/ranged/space,
+/obj/effect/spawner/human_npc/ruin/syndicate/commando/gunner,
/obj/structure/cable,
/turf/open/floor/iron,
/area/ruin/space/has_grav/waystation/cargooffice)
"af" = (
/obj/effect/turf_decal/loading_area/red,
/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden/layer4,
-/mob/living/basic/trooper/syndicate/ranged/space,
+/obj/effect/spawner/human_npc/ruin/syndicate/commando/gunner,
/obj/structure/cable,
/turf/open/floor/iron,
/area/ruin/space/has_grav/waystation/cargobay)
@@ -98,11 +98,11 @@
/turf/open/floor/iron/dark,
/area/ruin/space/has_grav/waystation/securestorage)
"ah" = (
-/mob/living/basic/trooper/syndicate/melee/space,
+/obj/effect/spawner/human_npc/ruin/syndicate/commando,
/turf/open/floor/iron/dark,
/area/ruin/space/has_grav/waystation/securestorage)
"ai" = (
-/mob/living/basic/trooper/syndicate/ranged/space,
+/obj/effect/spawner/human_npc/ruin/syndicate/commando/gunner,
/turf/open/floor/iron,
/area/ruin/space/has_grav/waystation/cargobay)
"aj" = (
diff --git a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_fortress_of_solitide.dmm b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_fortress_of_solitide.dmm
index 7c2663ddb2e..a65c7b18f99 100644
--- a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_fortress_of_solitide.dmm
+++ b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_fortress_of_solitide.dmm
@@ -2017,7 +2017,7 @@
/obj/structure/chair/wood{
dir = 8
},
-/mob/living/basic/trooper/russian{
+/obj/effect/spawner/human_npc/ruin/russian{
dir = 8
},
/turf/open/floor/wood,
diff --git a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_pod.dmm b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_pod.dmm
index 986dda90c83..9cc06996557 100644
--- a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_pod.dmm
+++ b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_pod.dmm
@@ -81,7 +81,7 @@
/area/overmap_encounter/planetoid/wasteland)
"K" = (
/obj/effect/decal/cleanable/dirt,
-/mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter,
+/obj/effect/spawner/human_npc/ruin/hermit/hunter,
/turf/open/floor/pod/dark,
/area/overmap_encounter/planetoid/wasteland)
"M" = (
diff --git a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_soviet.dmm b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_soviet.dmm
index 0d6dae8b6c3..fc1decc8833 100644
--- a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_soviet.dmm
+++ b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_soviet.dmm
@@ -101,7 +101,7 @@
"sr" = (
/obj/effect/decal/cleanable/wrapping,
/obj/structure/cable,
-/mob/living/basic/trooper/russian,
+/obj/effect/spawner/human_npc/ruin/russian,
/turf/open/floor/plating/rust,
/area/ruin)
"sV" = (
@@ -191,7 +191,7 @@
/area/ruin)
"Fg" = (
/obj/structure/chair/comfy/beige,
-/mob/living/basic/trooper/russian/ranged,
+/obj/effect/spawner/human_npc/ruin/russian/gunner,
/obj/structure/closet/crate/zone_loot/armory,
/turf/open/floor/wood,
/area/ruin)
@@ -265,7 +265,7 @@
/turf/open/misc/wasteland/lit,
/area/overmap_encounter/planetoid/wasteland)
"VS" = (
-/mob/living/basic/trooper/russian/ranged,
+/obj/effect/spawner/human_npc/ruin/russian/gunner,
/turf/open/floor/plating,
/area/ruin)
"WB" = (
diff --git a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_camp_adobe.dmm b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_camp_adobe.dmm
index 60616fa2f46..254293218d9 100644
--- a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_camp_adobe.dmm
+++ b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_camp_adobe.dmm
@@ -22,8 +22,8 @@
/turf/open/floor/plating/rust,
/area/ruin/unpowered)
"af" = (
-/mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter{
- faction = list("adobe")
+/obj/effect/spawner/human_npc/ruin/hermit/hunter{
+ npc_faction = list("adobe")
},
/turf/open/floor/plating/rust,
/area/ruin/unpowered)
@@ -50,9 +50,9 @@
/turf/open/floor/plating,
/area/ruin/unpowered)
"al" = (
-/mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter{
+/obj/effect/spawner/human_npc/ruin/hermit/hunter{
dir = 4;
- faction = list("adobe")
+ npc_faction = list("adobe")
},
/turf/open/floor/plating/rust,
/area/ruin/unpowered)
@@ -104,17 +104,17 @@
/turf/open/floor/plating/rust,
/area/ruin/unpowered)
"aw" = (
-/mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter{
+/obj/effect/spawner/human_npc/ruin/hermit/hunter{
dir = 4;
- faction = list("adobe")
+ npc_faction = list("adobe")
},
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/plating,
/area/ruin/unpowered)
"ax" = (
-/mob/living/simple_animal/hostile/asteroid/hermit/survivor{
+/obj/effect/spawner/human_npc/ruin/hermit{
dir = 4;
- faction = list("adobe")
+ npc_faction = list("adobe")
},
/turf/open/misc/wasteland/lit,
/area/overmap_encounter/planetoid/wasteland)
@@ -144,23 +144,23 @@
/area/ruin/unpowered)
"aC" = (
/obj/structure/chair/plastic,
-/mob/living/simple_animal/hostile/asteroid/hermit/survivor{
- faction = list("adobe")
+/obj/effect/spawner/human_npc/ruin/hermit{
+ npc_faction = list("adobe")
},
/obj/effect/decal/cleanable/dirt,
/turf/open/misc/wasteland/lit,
/area/overmap_encounter/planetoid/wasteland)
"aD" = (
-/mob/living/simple_animal/hostile/asteroid/hermit/ranged/gunslinger{
+/obj/effect/spawner/human_npc/ruin/hermit/gunslinger{
dir = 4;
- faction = list("adobe")
+ npc_faction = list("adobe")
},
/turf/open/floor/plating/rust,
/area/ruin/unpowered)
"aE" = (
-/mob/living/simple_animal/hostile/asteroid/hermit/survivor{
+/obj/effect/spawner/human_npc/ruin/hermit{
dir = 1;
- faction = list("adobe")
+ npc_faction = list("adobe")
},
/obj/effect/decal/cleanable/dirt,
/obj/structure/closet/crate/zone_loot/wardrobe,
@@ -215,9 +215,9 @@
/obj/structure/chair/plastic{
dir = 4
},
-/mob/living/simple_animal/hostile/asteroid/hermit/survivor{
+/obj/effect/spawner/human_npc/ruin/hermit{
dir = 4;
- faction = list("adobe")
+ npc_faction = list("adobe")
},
/obj/effect/decal/cleanable/dirt,
/turf/open/misc/wasteland/lit,
diff --git a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_camp_drugstore.dmm b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_camp_drugstore.dmm
index d5efef03e0c..71ad41c0cac 100644
--- a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_camp_drugstore.dmm
+++ b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_camp_drugstore.dmm
@@ -54,7 +54,7 @@
/turf/open/floor/wood,
/area/ruin/unpowered)
"n" = (
-/mob/living/simple_animal/hostile/asteroid/hermit/survivor{
+/obj/effect/spawner/human_npc/ruin/hermit{
dir = 4
},
/turf/open/floor/wood{
diff --git a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_camp_saloon.dmm b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_camp_saloon.dmm
index 74e10504e99..1d83e0ededd 100644
--- a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_camp_saloon.dmm
+++ b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_camp_saloon.dmm
@@ -121,9 +121,9 @@
"hL" = (
/obj/effect/decal/cleanable/dirt,
/obj/effect/decal/cleanable/blood/old,
-/mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter{
- faction = list("saloon");
- name = "Whitesands Bartender"
+/obj/effect/spawner/human_npc/ruin/hermit/hunter{
+ npc_faction = list("saloon");
+ npc_name = "Whitesands Bartender"
},
/turf/open/floor/wood{
broken = 1
@@ -191,9 +191,9 @@
/area/ruin/unpowered)
"mr" = (
/obj/structure/chair/stool/bar,
-/mob/living/simple_animal/hostile/asteroid/hermit/survivor{
+/obj/effect/spawner/human_npc/ruin/hermit{
dir = 8;
- faction = list("saloon")
+ npc_faction = list("saloon")
},
/turf/open/floor/wood{
broken = 1
@@ -205,9 +205,9 @@
/area/ruin/unpowered)
"nE" = (
/obj/structure/chair/stool/bar,
-/mob/living/simple_animal/hostile/asteroid/hermit/survivor{
+/obj/effect/spawner/human_npc/ruin/hermit{
dir = 1;
- faction = list("saloon")
+ npc_faction = list("saloon")
},
/turf/open/floor/wood,
/area/ruin/unpowered)
@@ -477,9 +477,9 @@
"Ov" = (
/obj/structure/chair/stool/bar,
/obj/effect/decal/cleanable/dirt,
-/mob/living/simple_animal/hostile/asteroid/hermit/survivor{
+/obj/effect/spawner/human_npc/ruin/hermit{
dir = 8;
- faction = list("saloon")
+ npc_faction = list("saloon")
},
/turf/open/floor/wood,
/area/ruin/unpowered)
@@ -559,9 +559,9 @@
/area/ruin/unpowered)
"Xb" = (
/obj/item/chair/stool/bar,
-/mob/living/simple_animal/hostile/asteroid/hermit/survivor{
+/obj/effect/spawner/human_npc/ruin/hermit{
dir = 1;
- faction = list("saloon")
+ npc_faction = list("saloon")
},
/turf/open/floor/wood,
/area/ruin/unpowered)
diff --git a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_chokepoint.dmm b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_chokepoint.dmm
index 349d0f5e9f0..1ffa9ecc108 100644
--- a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_chokepoint.dmm
+++ b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_chokepoint.dmm
@@ -31,10 +31,8 @@
"g" = (
/obj/structure/bed,
/obj/item/bedsheet/hos,
-/mob/living/basic/trooper/nanotrasen/ranged{
- atmos_requirements = list("min_oxy" = 5, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 999, "min_n2" = 0, "max_n2" = 0);
- damage_coeff = list("brute" = 1, "fire" = 1, "toxin" = 1, "clone" = 1, "stamina" = 0, "oxygen" = 0);
- name = "\improper NanoTrasen Stranded Security Officer"
+/obj/effect/spawner/human_npc/ruin/nanotrasen{
+ npc_name = "NanoTrasen Stranded Security Officer"
},
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/plating{
@@ -42,11 +40,9 @@
},
/area/ruin/unpowered)
"h" = (
-/mob/living/basic/trooper/nanotrasen/ranged{
- atmos_requirements = list("min_oxy" = 5, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 999, "min_n2" = 0, "max_n2" = 0);
- damage_coeff = list("brute" = 1, "fire" = 1, "toxin" = 1, "clone" = 1, "stamina" = 0, "oxygen" = 0);
+/obj/effect/spawner/human_npc/ruin/nanotrasen{
dir = 4;
- name = "\improper NanoTrasen Stranded Security Officer"
+ npc_name = "NanoTrasen Stranded Security Officer"
},
/turf/open/misc/wasteland/lit,
/area/overmap_encounter/planetoid/wasteland)
@@ -75,11 +71,9 @@
/turf/open/misc/dust/lit,
/area/overmap_encounter/planetoid/wasteland)
"v" = (
-/mob/living/basic/trooper/nanotrasen/ranged{
- atmos_requirements = list("min_oxy" = 5, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 999, "min_n2" = 0, "max_n2" = 0);
- damage_coeff = list("brute" = 1, "fire" = 1, "toxin" = 1, "clone" = 1, "stamina" = 0, "oxygen" = 0);
+/obj/effect/spawner/human_npc/ruin/nanotrasen{
dir = 8;
- name = "\improper NanoTrasen Stranded Security Officer"
+ npc_name = "NanoTrasen Stranded Security Officer"
},
/turf/open/misc/wasteland/lit,
/area/overmap_encounter/planetoid/wasteland)
diff --git a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_crash_bar.dmm b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_crash_bar.dmm
index 28d2c66731e..f4832b7e84d 100644
--- a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_crash_bar.dmm
+++ b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_crash_bar.dmm
@@ -1,8 +1,7 @@
//MAP CONVERTED BY dmm2tgm.py THIS HEADER COMMENT PREVENTS RECONVERSION, DO NOT REMOVE
"aa" = (
-/mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter{
- desc = "One of the few survivors on the planet with working weaponry. Doesn't seem as friendly as the bartenders you're used to.";
- faction = list("saloon")
+/obj/effect/spawner/human_npc/ruin/hermit/hunter{
+ npc_faction = list("saloon")
},
/turf/open/floor/wood{
broken = 1
@@ -51,8 +50,8 @@
/obj/machinery/atmospherics/pipe/smart/simple/scrubbers/hidden/layer4{
dir = 10
},
-/mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter{
- faction = list("saloon")
+/obj/effect/spawner/human_npc/ruin/hermit/hunter{
+ npc_faction = list("saloon")
},
/turf/open/floor/plating{
burnt = 1
@@ -220,8 +219,8 @@
/turf/open/floor/plating,
/area/ruin/unpowered)
"hm" = (
-/mob/living/simple_animal/hostile/asteroid/hermit/survivor{
- faction = list("saloon")
+/obj/effect/spawner/human_npc/ruin/hermit{
+ npc_faction = list("saloon")
},
/turf/open/floor/plating,
/area/ruin/unpowered)
@@ -430,8 +429,8 @@
},
/area/ruin/unpowered)
"vR" = (
-/mob/living/simple_animal/hostile/asteroid/hermit/survivor{
- faction = list("saloon")
+/obj/effect/spawner/human_npc/ruin/hermit{
+ npc_faction = list("saloon")
},
/turf/open/floor/iron/dark,
/area/ruin/unpowered)
@@ -443,8 +442,8 @@
/area/ruin/unpowered)
"wL" = (
/obj/effect/decal/cleanable/dirt,
-/mob/living/simple_animal/hostile/asteroid/hermit/survivor{
- faction = list("saloon")
+/obj/effect/spawner/human_npc/ruin/hermit{
+ npc_faction = list("saloon")
},
/turf/open/floor/plating,
/area/ruin/unpowered)
@@ -1039,8 +1038,8 @@
/turf/open/floor/wood,
/area/ruin/unpowered)
"ZU" = (
-/mob/living/simple_animal/hostile/asteroid/hermit/survivor{
- faction = list("saloon")
+/obj/effect/spawner/human_npc/ruin/hermit{
+ npc_faction = list("saloon")
},
/turf/open/floor/plating{
broken = 1
diff --git a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_crash_cargo.dmm b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_crash_cargo.dmm
index 473b45b1284..eef0eeed63d 100644
--- a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_crash_cargo.dmm
+++ b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_crash_cargo.dmm
@@ -111,7 +111,7 @@
/turf/open/floor/plating,
/area/ruin/unpowered)
"kO" = (
-/mob/living/basic/trooper/pirate/melee,
+/obj/effect/spawner/human_npc/ruin/pirate,
/turf/open/floor/plating{
burnt = 1
},
@@ -424,7 +424,7 @@
/turf/open/floor/iron/dark,
/area/ruin/unpowered)
"Gs" = (
-/mob/living/basic/trooper/pirate/melee,
+/obj/effect/spawner/human_npc/ruin/pirate,
/turf/open/floor/plating{
broken = 1
},
@@ -461,7 +461,7 @@
dir = 8
},
/obj/structure/cable,
-/mob/living/basic/trooper/pirate/ranged,
+/obj/effect/spawner/human_npc/ruin/pirate/gunner,
/turf/open/floor/plating,
/area/ruin/unpowered)
"Iv" = (
@@ -483,7 +483,7 @@
/turf/open/floor/plating,
/area/ruin/unpowered)
"Ku" = (
-/mob/living/basic/trooper/pirate/melee,
+/obj/effect/spawner/human_npc/ruin/pirate,
/turf/open/floor/mineral/titanium{
broken = 1
},
@@ -639,7 +639,7 @@
/area/ruin/unpowered)
"RQ" = (
/obj/effect/decal/cleanable/dirt/dust,
-/mob/living/basic/trooper/pirate/ranged,
+/obj/effect/spawner/human_npc/ruin/pirate/gunner,
/turf/open/floor/iron/dark,
/area/ruin/unpowered)
"RV" = (
diff --git a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_onlyaspoonful.dmm b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_onlyaspoonful.dmm
index 729906e4db5..b3f7d1cbf67 100644
--- a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_onlyaspoonful.dmm
+++ b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_onlyaspoonful.dmm
@@ -26,7 +26,7 @@
pixel_y = 9
},
/obj/effect/decal/cleanable/blood/tracks,
-/mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter,
+/obj/effect/spawner/human_npc/ruin/hermit/hunter,
/turf/open/floor/plastic,
/area/ruin/powered)
"ae" = (
@@ -92,7 +92,7 @@
/area/ruin/powered)
"ew" = (
/obj/effect/decal/cleanable/dirt/dust,
-/mob/living/simple_animal/hostile/asteroid/hermit/survivor,
+/obj/effect/spawner/human_npc/ruin/hermit,
/turf/open/floor/plastic,
/area/ruin/powered)
"eH" = (
@@ -184,7 +184,7 @@
/turf/open/floor/plastic,
/area/ruin/powered)
"hw" = (
-/mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter,
+/obj/effect/spawner/human_npc/ruin/hermit/hunter,
/turf/open/floor/plastic,
/area/ruin/powered)
"hA" = (
@@ -470,7 +470,7 @@
/turf/open/floor/material,
/area/ruin/powered)
"EC" = (
-/mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter,
+/obj/effect/spawner/human_npc/ruin/hermit/hunter,
/turf/open/misc/wasteland/lit,
/area/overmap_encounter/planetoid/wasteland)
"Fi" = (
@@ -596,7 +596,7 @@
/area/ruin/powered)
"NU" = (
/obj/effect/decal/cleanable/dirt/dust,
-/mob/living/simple_animal/hostile/asteroid/hermit/survivor,
+/obj/effect/spawner/human_npc/ruin/hermit,
/turf/open/floor/material,
/area/ruin/powered)
"Oo" = (
diff --git a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_starfurycrash.dmm b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_starfurycrash.dmm
index 6e0af1a52f6..fddbbd2cf2f 100644
--- a/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_starfurycrash.dmm
+++ b/_maps/voidcrew/RandomRuins/WastelandRuins/wasteland_surface_starfurycrash.dmm
@@ -27,7 +27,7 @@
/turf/open/floor/plating,
/area/ruin/unpowered)
"ag" = (
-/mob/living/basic/trooper/syndicate/ranged/space,
+/obj/effect/spawner/human_npc/ruin/syndicate/commando/gunner,
/turf/open/floor/iron/dark,
/area/ruin/unpowered)
"ah" = (
@@ -42,7 +42,7 @@
},
/area/ruin/unpowered)
"ai" = (
-/mob/living/basic/trooper/syndicate/ranged/space,
+/obj/effect/spawner/human_npc/ruin/syndicate/commando/gunner,
/turf/open/misc/dust/lit,
/area/overmap_encounter/planetoid/wasteland)
"aj" = (
@@ -191,7 +191,7 @@
/turf/closed/wall/r_wall/plastitanium/syndicate/nodiagonal,
/area/ruin/unpowered)
"CW" = (
-/mob/living/basic/trooper/syndicate/ranged/space,
+/obj/effect/spawner/human_npc/ruin/syndicate/commando/gunner,
/turf/open/floor/plating,
/area/ruin/unpowered)
"Dz" = (
diff --git a/_maps/voidcrew/ships/ship_hightide.dmm b/_maps/voidcrew/ships/ship_hightide.dmm
index 4fe02ee2122..724818b48d5 100644
--- a/_maps/voidcrew/ships/ship_hightide.dmm
+++ b/_maps/voidcrew/ships/ship_hightide.dmm
@@ -976,11 +976,7 @@
/turf/open/floor/plating,
/area/shuttle/voidcrew/hightide/maintenance/cargo)
"RI" = (
-/mob/living/basic/trooper/pirate/ranged{
- desc = "Timmy is a classic pirate cosplayer. He was locked in this room by the previous owner. He's survived by eating the rats, this is why there are ZERO rats in the universe.";
- health = 25;
- name = "Timothy"
- },
+/obj/effect/spawner/human_npc/ruin/pirate/cosplayer,
/obj/effect/decal/cleanable/dirt/dust,
/obj/effect/decal/cleanable/greenglow,
/turf/open/floor/plating,
diff --git a/_maps/voidcrew/shuttles/ruin_caravan_victim.dmm b/_maps/voidcrew/shuttles/ruin_caravan_victim.dmm
new file mode 100644
index 00000000000..46e644d1e04
--- /dev/null
+++ b/_maps/voidcrew/shuttles/ruin_caravan_victim.dmm
@@ -0,0 +1,1225 @@
+//MAP CONVERTED BY dmm2tgm.py THIS HEADER COMMENT PREVENTS RECONVERSION, DO NOT REMOVE
+"aj" = (
+/obj/effect/turf_decal/box/white/corners{
+ dir = 8
+ },
+/obj/structure/closet/crate,
+/obj/item/stack/sheet/plasteel/twenty,
+/obj/item/stack/sheet/plasteel/twenty,
+/obj/effect/mapping_helpers/broken_floor,
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"co" = (
+/turf/closed/wall/mineral/titanium/nodiagonal,
+/area/shuttle/ruin/caravan/freighter1)
+"cu" = (
+/obj/effect/spawner/human_npc/ruin/syndicate/commando/smg,
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"cC" = (
+/obj/machinery/firealarm/directional/north,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 1
+ },
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"cJ" = (
+/obj/structure/table,
+/obj/item/storage/toolbox/mechanical,
+/obj/item/multitool,
+/obj/effect/decal/cleanable/dirt,
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"dv" = (
+/obj/machinery/power/shuttle_engine/propulsion/burst/right{
+ dir = 8
+ },
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"ex" = (
+/obj/structure/lattice,
+/obj/item/stack/sheet/mineral/titanium,
+/turf/template_noop,
+/area/shuttle/ruin/caravan/freighter1)
+"eN" = (
+/obj/effect/turf_decal/box/white/corners{
+ dir = 4
+ },
+/obj/effect/mapping_helpers/broken_floor,
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"fJ" = (
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 10
+ },
+/obj/effect/decal/cleanable/blood,
+/obj/effect/turf_decal/tile/yellow/half/contrasted{
+ dir = 1
+ },
+/turf/open/floor/iron{
+ initial_gas_mix = "TEMP=2.7"
+ },
+/area/shuttle/ruin/caravan/freighter1)
+"fR" = (
+/obj/effect/turf_decal/bot,
+/obj/machinery/atmospherics/components/tank/air{
+ dir = 4
+ },
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"hM" = (
+/obj/structure/rack,
+/obj/item/tank/internals/oxygen,
+/obj/item/radio,
+/obj/item/clothing/mask/gas,
+/obj/effect/turf_decal/tile/blue{
+ dir = 4
+ },
+/turf/open/floor/iron{
+ initial_gas_mix = "TEMP=2.7"
+ },
+/area/shuttle/ruin/caravan/freighter1)
+"hS" = (
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"hZ" = (
+/obj/machinery/door/firedoor,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/obj/machinery/door/airlock/command{
+ name = "Bridge"
+ },
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"iB" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/obj/effect/mapping_helpers/burnt_floor,
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"jz" = (
+/obj/structure/closet/crate,
+/obj/item/stack/sheet/mineral/silver{
+ amount = 25
+ },
+/obj/item/stack/sheet/mineral/silver{
+ amount = 25
+ },
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"jQ" = (
+/obj/structure/table,
+/obj/machinery/cell_charger,
+/obj/machinery/firealarm/directional/north,
+/obj/item/stack/cable_coil{
+ pixel_x = 12;
+ pixel_y = 4
+ },
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"kg" = (
+/obj/machinery/door/poddoor{
+ id = "caravantrade1_cargo";
+ name = "Cargo Blast Door"
+ },
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"ll" = (
+/obj/machinery/power/port_gen/pacman{
+ anchored = 1
+ },
+/obj/item/wrench,
+/obj/machinery/power/terminal,
+/obj/effect/turf_decal/stripes/line{
+ dir = 5
+ },
+/obj/effect/decal/cleanable/dirt,
+/obj/structure/cable,
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"lD" = (
+/obj/structure/closet/crate/preopen,
+/obj/item/stack/sheet/iron/fifty,
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"lK" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/obj/effect/turf_decal/tile/yellow{
+ dir = 4
+ },
+/turf/open/floor/iron{
+ initial_gas_mix = "TEMP=2.7"
+ },
+/area/shuttle/ruin/caravan/freighter1)
+"mb" = (
+/obj/machinery/light/small/directional/south,
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/obj/effect/turf_decal/tile/yellow/half/contrasted{
+ dir = 1
+ },
+/turf/open/floor/iron{
+ initial_gas_mix = "TEMP=2.7"
+ },
+/area/shuttle/ruin/caravan/freighter1)
+"mx" = (
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"nj" = (
+/obj/machinery/airalarm/directional/west,
+/obj/effect/mapping_helpers/airalarm/all_access,
+/obj/effect/decal/cleanable/dirt,
+/obj/effect/decal/cleanable/blood,
+/obj/machinery/atmospherics/components/unary/vent_pump/on,
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"nI" = (
+/turf/template_noop,
+/area/shuttle/ruin/caravan/freighter1)
+"nO" = (
+/obj/machinery/airalarm/directional/east,
+/obj/effect/mapping_helpers/airalarm/all_access,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden,
+/obj/effect/mapping_helpers/broken_floor,
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"oJ" = (
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 1
+ },
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"pj" = (
+/obj/machinery/suit_storage_unit/standard_unit,
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"px" = (
+/obj/machinery/light/directional/north,
+/obj/structure/table,
+/obj/item/stack/package_wrap,
+/obj/item/crowbar,
+/obj/item/flashlight{
+ pixel_x = 1;
+ pixel_y = 5
+ },
+/obj/machinery/airalarm/directional/north,
+/obj/effect/mapping_helpers/airalarm/all_access,
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"rt" = (
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden,
+/obj/effect/turf_decal/tile/blue/half/contrasted{
+ dir = 4
+ },
+/turf/open/floor/iron{
+ initial_gas_mix = "TEMP=2.7"
+ },
+/area/shuttle/ruin/caravan/freighter1)
+"rz" = (
+/obj/effect/turf_decal/box/white/corners{
+ dir = 4
+ },
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"rC" = (
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"su" = (
+/obj/structure/table,
+/obj/machinery/microwave{
+ pixel_y = 5
+ },
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"sJ" = (
+/obj/effect/decal/cleanable/dirt,
+/obj/structure/table/reinforced,
+/obj/item/paper_bin{
+ pixel_x = 6;
+ pixel_y = 6
+ },
+/obj/item/pen{
+ pixel_x = 6;
+ pixel_y = 6
+ },
+/obj/item/folder/yellow{
+ pixel_x = -6
+ },
+/obj/effect/turf_decal/tile/blue/anticorner/contrasted,
+/turf/open/floor/iron/dark{
+ initial_gas_mix = "TEMP=2.7"
+ },
+/area/shuttle/ruin/caravan/freighter1)
+"tp" = (
+/obj/machinery/door/airlock{
+ id_tag = "caravantrade1_cabin1";
+ name = "Cabin 1"
+ },
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden,
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"tH" = (
+/obj/structure/chair/stool/directional/west,
+/obj/effect/turf_decal/tile/yellow/half/contrasted{
+ dir = 4
+ },
+/turf/open/floor/iron{
+ initial_gas_mix = "TEMP=2.7"
+ },
+/area/shuttle/ruin/caravan/freighter1)
+"tT" = (
+/obj/machinery/door/poddoor{
+ id = "caravantrade1_cargo";
+ name = "Cargo Blast Door"
+ },
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"uE" = (
+/obj/structure/table,
+/obj/item/storage/box/donkpockets{
+ pixel_x = 6;
+ pixel_y = 6
+ },
+/obj/item/plate{
+ pixel_x = -5;
+ pixel_y = -3
+ },
+/obj/effect/decal/cleanable/dirt,
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"uZ" = (
+/obj/effect/turf_decal/box/white/corners{
+ dir = 1
+ },
+/obj/structure/closet/crate,
+/obj/item/stack/sheet/mineral/uranium{
+ amount = 10
+ },
+/obj/item/stack/sheet/mineral/uranium{
+ amount = 10
+ },
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"vG" = (
+/obj/structure/table/reinforced,
+/obj/machinery/button/door{
+ id = "caravantrade1_bridge";
+ name = "Ship Blast Door Control"
+ },
+/obj/effect/turf_decal/tile/blue/anticorner/contrasted{
+ dir = 4
+ },
+/turf/open/floor/iron/dark{
+ initial_gas_mix = "TEMP=2.7"
+ },
+/area/shuttle/ruin/caravan/freighter1)
+"wC" = (
+/obj/effect/turf_decal/box/white/corners{
+ dir = 4
+ },
+/obj/effect/decal/cleanable/dirt,
+/obj/structure/closet/crate,
+/obj/item/stack/sheet/mineral/gold{
+ amount = 25
+ },
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"yv" = (
+/obj/effect/turf_decal/bot_white,
+/obj/structure/closet/emcloset,
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"zV" = (
+/obj/structure/lattice,
+/obj/structure/broken_flooring/singular/directional/south,
+/turf/template_noop,
+/area/shuttle/ruin/caravan/freighter1)
+"Bh" = (
+/obj/machinery/power/shuttle_engine/heater{
+ dir = 8
+ },
+/obj/structure/window/reinforced/spawner/directional/east,
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"Bp" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 10
+ },
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"BC" = (
+/obj/structure/lattice,
+/turf/template_noop,
+/area/shuttle/ruin/caravan/freighter1)
+"BY" = (
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 8
+ },
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"CA" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 8
+ },
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"Da" = (
+/obj/machinery/door/poddoor{
+ id = "caravantrade1_cargo";
+ name = "Cargo Blast Door"
+ },
+/obj/effect/decal/cleanable/dirt,
+/obj/effect/mapping_helpers/broken_floor,
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"Dg" = (
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/computer/camera_advanced/shuttle_docker/caravan/trade1{
+ dir = 8
+ },
+/obj/effect/turf_decal/tile/blue/anticorner/contrasted{
+ dir = 1
+ },
+/turf/open/floor/iron/dark{
+ initial_gas_mix = "TEMP=2.7"
+ },
+/area/shuttle/ruin/caravan/freighter1)
+"DV" = (
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/computer/shuttle/caravan/trade1{
+ dir = 8
+ },
+/obj/effect/turf_decal/tile/blue/anticorner/contrasted{
+ dir = 8
+ },
+/turf/open/floor/iron/dark{
+ initial_gas_mix = "TEMP=2.7"
+ },
+/area/shuttle/ruin/caravan/freighter1)
+"Eh" = (
+/obj/effect/turf_decal/box/white/corners{
+ dir = 1
+ },
+/obj/effect/mapping_helpers/broken_floor,
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"EO" = (
+/obj/effect/spawner/structure/window/reinforced/shuttle,
+/obj/machinery/door/poddoor{
+ id = "caravantrade1_bridge"
+ },
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/freighter1)
+"Fb" = (
+/obj/machinery/light/small/directional/east,
+/obj/machinery/firealarm/directional/east,
+/obj/effect/decal/cleanable/blood,
+/obj/machinery/atmospherics/components/unary/vent_pump/on{
+ dir = 8
+ },
+/obj/effect/spawner/human_npc/ruin/syndicate/commando/smg,
+/obj/effect/turf_decal/tile/yellow{
+ dir = 4
+ },
+/turf/open/floor/iron{
+ initial_gas_mix = "TEMP=2.7"
+ },
+/area/shuttle/ruin/caravan/freighter1)
+"Fu" = (
+/obj/effect/decal/cleanable/blood,
+/obj/effect/spawner/human_npc/ruin/syndicate/stormtrooper/sword,
+/obj/effect/turf_decal/tile/blue{
+ dir = 4
+ },
+/turf/open/floor/iron/dark{
+ initial_gas_mix = "TEMP=2.7"
+ },
+/area/shuttle/ruin/caravan/freighter1)
+"FQ" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 8
+ },
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"Gq" = (
+/obj/structure/girder,
+/obj/effect/mapping_helpers/broken_floor,
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"He" = (
+/obj/machinery/door/airlock{
+ id_tag = "caravantrade1_cabin2";
+ name = "Cabin 2"
+ },
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden,
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"Hz" = (
+/obj/machinery/door/firedoor,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden,
+/obj/structure/door_assembly/door_assembly_min{
+ anchored = 1;
+ density = 0;
+ name = "broken airlock"
+ },
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"HF" = (
+/obj/effect/turf_decal/box/white/corners{
+ dir = 8
+ },
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"HY" = (
+/obj/machinery/light/small/directional/west,
+/obj/machinery/firealarm/directional/west,
+/obj/effect/decal/cleanable/dirt,
+/obj/structure/rack,
+/obj/item/storage/toolbox/emergency,
+/obj/item/wrench,
+/obj/effect/turf_decal/tile/blue/anticorner/contrasted{
+ dir = 1
+ },
+/turf/open/floor/iron/dark{
+ initial_gas_mix = "TEMP=2.7"
+ },
+/area/shuttle/ruin/caravan/freighter1)
+"Id" = (
+/obj/structure/rack,
+/obj/item/storage/belt/utility,
+/obj/structure/extinguisher_cabinet/directional/north,
+/obj/effect/decal/cleanable/dirt,
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"Ix" = (
+/obj/machinery/light/small/directional/south,
+/obj/structure/bed{
+ dir = 4
+ },
+/obj/item/bedsheet{
+ dir = 4
+ },
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/airalarm/directional/east,
+/obj/effect/mapping_helpers/airalarm/all_access,
+/obj/machinery/atmospherics/components/unary/vent_pump/on{
+ dir = 1
+ },
+/obj/machinery/button/door/directional/west{
+ id = "caravantrade1_cabin2";
+ name = "Cabin Bolt Control";
+ normaldoorcontrol = 1;
+ specialfunctions = 4
+ },
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"IA" = (
+/obj/machinery/atmospherics/components/unary/vent_pump/on,
+/obj/machinery/button/door/directional/west{
+ id = "caravantrade1_bolt";
+ name = "External Bolt Control";
+ normaldoorcontrol = 1;
+ pixel_y = 8;
+ specialfunctions = 4
+ },
+/obj/effect/turf_decal/tile/blue,
+/turf/open/floor/iron{
+ initial_gas_mix = "TEMP=2.7"
+ },
+/area/shuttle/ruin/caravan/freighter1)
+"IY" = (
+/obj/machinery/door/airlock{
+ name = "Restroom"
+ },
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron/showroomfloor{
+ initial_gas_mix = "TEMP=2.7"
+ },
+/area/shuttle/ruin/caravan/freighter1)
+"Jv" = (
+/turf/template_noop,
+/area/template_noop)
+"JH" = (
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"JU" = (
+/obj/item/stack/sheet/iron/fifty,
+/obj/effect/mapping_helpers/burnt_floor,
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"JW" = (
+/turf/closed/wall/mineral/titanium,
+/area/shuttle/ruin/caravan/freighter1)
+"KD" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/obj/effect/spawner/human_npc/ruin/syndicate/commando/smg,
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"Ld" = (
+/obj/effect/decal/cleanable/dirt,
+/obj/effect/mapping_helpers/broken_floor,
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"Lo" = (
+/obj/effect/turf_decal/box/white/corners{
+ dir = 1
+ },
+/obj/structure/closet/crate,
+/obj/item/stack/sheet/rglass{
+ amount = 20
+ },
+/obj/item/stack/sheet/rglass{
+ amount = 20
+ },
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"LI" = (
+/obj/machinery/airalarm/directional/north,
+/obj/effect/mapping_helpers/airalarm/all_access,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 1
+ },
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"LL" = (
+/obj/machinery/power/shuttle_engine/propulsion/burst{
+ dir = 8
+ },
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"LO" = (
+/obj/effect/turf_decal/box/white/corners{
+ dir = 8
+ },
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"Mc" = (
+/obj/machinery/light/small/directional/west,
+/obj/structure/sign/warning/vacuum/directional/east,
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/freighter1)
+"Mr" = (
+/obj/machinery/light/small/directional/north,
+/obj/machinery/airalarm/directional/north,
+/obj/effect/mapping_helpers/airalarm/all_access,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"ME" = (
+/obj/effect/turf_decal/box/white/corners,
+/obj/structure/closet/crate,
+/obj/item/stack/sheet/glass/fifty,
+/obj/item/stack/sheet/glass/fifty,
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"Ni" = (
+/obj/machinery/light/small/directional/south,
+/obj/structure/bed,
+/obj/item/bedsheet,
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/airalarm/directional/east,
+/obj/effect/mapping_helpers/airalarm/all_access,
+/obj/machinery/atmospherics/components/unary/vent_pump/on{
+ dir = 1
+ },
+/obj/machinery/button/door/directional/west{
+ id = "caravantrade1_cabin1";
+ name = "Cabin Bolt Control";
+ normaldoorcontrol = 1;
+ specialfunctions = 4
+ },
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"NQ" = (
+/obj/effect/mapping_helpers/airlock/cyclelink_helper{
+ dir = 1
+ },
+/obj/effect/mapping_helpers/airlock/locked,
+/obj/machinery/door/airlock/external/ruin{
+ id_tag = "caravantrade1_bolt"
+ },
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/freighter1)
+"Op" = (
+/obj/machinery/door/firedoor,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/obj/machinery/door/airlock/engineering{
+ name = "Engine Room"
+ },
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"OW" = (
+/obj/structure/chair/comfy/shuttle{
+ dir = 4
+ },
+/obj/effect/decal/cleanable/dirt,
+/obj/effect/mob_spawn/corpse/human/cargo_tech,
+/obj/effect/decal/cleanable/blood,
+/obj/effect/turf_decal/tile/blue,
+/turf/open/floor/iron/dark{
+ initial_gas_mix = "TEMP=2.7"
+ },
+/area/shuttle/ruin/caravan/freighter1)
+"Pf" = (
+/obj/machinery/light/small/directional/east,
+/obj/machinery/power/apc/auto_name/directional/east,
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden,
+/obj/structure/cable,
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"Qi" = (
+/obj/machinery/airalarm/directional/west,
+/obj/effect/mapping_helpers/airalarm/all_access,
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden,
+/obj/effect/mob_spawn/corpse/human/cargo_tech,
+/obj/effect/decal/cleanable/blood,
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"Ql" = (
+/obj/machinery/light/small/directional/south,
+/obj/effect/turf_decal/box/white/corners,
+/obj/structure/closet/crate,
+/obj/item/stack/sheet/mineral/diamond{
+ amount = 5
+ },
+/obj/machinery/button/door/directional/south{
+ id = "caravantrade1_cargo";
+ name = "Cargo Blast Door Control"
+ },
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"Qu" = (
+/obj/machinery/door/airlock{
+ name = "Crew Quarters"
+ },
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"QH" = (
+/obj/effect/turf_decal/bot,
+/obj/machinery/space_heater,
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/atmospherics/components/unary/vent_pump/on{
+ dir = 4
+ },
+/obj/effect/mapping_helpers/broken_floor,
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"Rv" = (
+/obj/effect/decal/cleanable/dirt,
+/obj/effect/mapping_helpers/broken_floor,
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"Tb" = (
+/obj/machinery/power/smes,
+/obj/effect/turf_decal/stripes/line{
+ dir = 4
+ },
+/obj/structure/cable,
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"To" = (
+/obj/machinery/door/airlock{
+ name = "Crew Cabins"
+ },
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"Tq" = (
+/obj/structure/closet/crate,
+/obj/item/stack/sheet/mineral/titanium{
+ amount = 20
+ },
+/obj/item/stack/sheet/mineral/titanium{
+ amount = 20
+ },
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"Tu" = (
+/obj/effect/mapping_helpers/airlock/cyclelink_helper,
+/obj/effect/mapping_helpers/airlock/locked,
+/obj/machinery/door/airlock/external/ruin{
+ id_tag = "caravantrade1_bolt"
+ },
+/obj/docking_port/mobile{
+ callTime = 250;
+ dir = 2;
+ shuttle_id = "caravantrade1";
+ movement_force = list("KNOCKDOWN" = 0, "THROW" = 0);
+ name = "Small Freighter";
+ port_direction = 8;
+ preferred_direction = 4
+ },
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/freighter1)
+"Tx" = (
+/obj/machinery/light/small/directional/west,
+/obj/effect/decal/cleanable/dirt,
+/obj/structure/rack,
+/obj/item/storage/medkit/regular,
+/obj/effect/turf_decal/tile/blue/anticorner/contrasted{
+ dir = 8
+ },
+/turf/open/floor/iron/dark{
+ initial_gas_mix = "TEMP=2.7"
+ },
+/area/shuttle/ruin/caravan/freighter1)
+"TY" = (
+/obj/machinery/atmospherics/components/unary/vent_pump/on{
+ dir = 1
+ },
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"Uz" = (
+/obj/structure/toilet{
+ dir = 4
+ },
+/obj/structure/sink/directional/south,
+/obj/machinery/light/small/directional/south,
+/obj/effect/decal/cleanable/dirt,
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron/showroomfloor{
+ initial_gas_mix = "TEMP=2.7"
+ },
+/area/shuttle/ruin/caravan/freighter1)
+"UK" = (
+/obj/structure/closet/secure_closet/freezer{
+ locked = 0;
+ name = "fridge"
+ },
+/obj/item/reagent_containers/cup/glass/bottle/beer{
+ pixel_x = -3;
+ pixel_y = 3
+ },
+/obj/item/reagent_containers/cup/glass/bottle/beer,
+/obj/item/reagent_containers/cup/glass/bottle/beer{
+ pixel_x = 3;
+ pixel_y = -3
+ },
+/obj/item/reagent_containers/cup/glass/waterbottle{
+ pixel_x = -3;
+ pixel_y = 3
+ },
+/obj/item/reagent_containers/cup/glass/waterbottle,
+/obj/item/reagent_containers/cup/glass/waterbottle{
+ pixel_x = 3;
+ pixel_y = -3
+ },
+/obj/item/food/pizzaslice/margherita{
+ pixel_x = -3;
+ pixel_y = 3
+ },
+/obj/item/food/pizzaslice/margherita,
+/obj/item/food/chocolatebar,
+/obj/effect/turf_decal/tile/yellow/anticorner/contrasted{
+ dir = 4
+ },
+/turf/open/floor/iron{
+ initial_gas_mix = "TEMP=2.7"
+ },
+/area/shuttle/ruin/caravan/freighter1)
+"VA" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 9
+ },
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"Xq" = (
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden,
+/obj/machinery/meter,
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"XE" = (
+/obj/machinery/light/small/directional/south,
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"XM" = (
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"XN" = (
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"Yt" = (
+/obj/item/stack/sheet/mineral/titanium,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/obj/effect/mapping_helpers/broken_floor,
+/turf/open/floor/iron/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"YG" = (
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden,
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"Zq" = (
+/obj/structure/closet/crate,
+/obj/item/stack/sheet/iron/twenty,
+/obj/item/stack/sheet/glass{
+ amount = 10
+ },
+/obj/item/stack/rods/ten,
+/obj/item/storage/box/lights/bulbs,
+/obj/effect/decal/cleanable/dirt,
+/obj/effect/turf_decal/stripes/line{
+ dir = 6
+ },
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"ZA" = (
+/obj/effect/turf_decal/bot_white,
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/atmospherics/components/unary/vent_pump/on{
+ dir = 1
+ },
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark/airless,
+/area/shuttle/ruin/caravan/freighter1)
+"ZG" = (
+/obj/machinery/power/shuttle_engine/propulsion/burst/left{
+ dir = 8
+ },
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/freighter1)
+
+(1,1,1) = {"
+Jv
+ZG
+LL
+LL
+LL
+dv
+JW
+Jv
+Jv
+Jv
+Jv
+"}
+(2,1,1) = {"
+JW
+Bh
+Bh
+Bh
+Bh
+Bh
+co
+ZG
+LL
+dv
+Jv
+"}
+(3,1,1) = {"
+co
+QH
+ll
+Tb
+Zq
+fR
+co
+Bh
+Bh
+Bh
+JW
+"}
+(4,1,1) = {"
+co
+oJ
+YG
+Pf
+nO
+Xq
+co
+uZ
+jz
+HF
+co
+"}
+(5,1,1) = {"
+co
+Op
+co
+co
+co
+Op
+co
+wC
+rC
+Ql
+co
+"}
+(6,1,1) = {"
+co
+cC
+He
+Ix
+co
+Bp
+BY
+TY
+cu
+XM
+kg
+"}
+(7,1,1) = {"
+EO
+XE
+co
+co
+co
+Id
+iB
+Lo
+hS
+LO
+Da
+"}
+(8,1,1) = {"
+co
+LI
+tp
+Ni
+JW
+px
+JH
+rz
+hS
+ME
+tT
+"}
+(9,1,1) = {"
+co
+To
+co
+co
+co
+jQ
+KD
+JU
+Tq
+Rv
+kg
+"}
+(10,1,1) = {"
+co
+lK
+co
+Uz
+co
+cJ
+mx
+Eh
+lD
+aj
+tT
+"}
+(11,1,1) = {"
+EO
+mb
+co
+IY
+co
+co
+iB
+eN
+Rv
+BC
+Ld
+"}
+(12,1,1) = {"
+EO
+fJ
+Qi
+FQ
+CA
+Hz
+Yt
+ZA
+zV
+nI
+ex
+"}
+(13,1,1) = {"
+EO
+UK
+tH
+Fb
+JH
+co
+yv
+XN
+BC
+nI
+nI
+"}
+(14,1,1) = {"
+co
+su
+uE
+co
+Qu
+co
+co
+Gq
+nI
+nI
+Jv
+"}
+(15,1,1) = {"
+co
+co
+co
+co
+Mr
+pj
+co
+Jv
+Jv
+Jv
+Jv
+"}
+(16,1,1) = {"
+Tu
+Mc
+NQ
+IA
+rt
+hM
+EO
+Jv
+Jv
+Jv
+Jv
+"}
+(17,1,1) = {"
+JW
+co
+co
+co
+hZ
+co
+co
+Jv
+Jv
+Jv
+Jv
+"}
+(18,1,1) = {"
+Jv
+co
+Tx
+nj
+VA
+HY
+co
+Jv
+Jv
+Jv
+Jv
+"}
+(19,1,1) = {"
+Jv
+EO
+sJ
+Fu
+OW
+vG
+EO
+Jv
+Jv
+Jv
+Jv
+"}
+(20,1,1) = {"
+Jv
+EO
+EO
+Dg
+DV
+EO
+EO
+Jv
+Jv
+Jv
+Jv
+"}
+(21,1,1) = {"
+Jv
+Jv
+EO
+EO
+EO
+EO
+Jv
+Jv
+Jv
+Jv
+Jv
+"}
diff --git a/_maps/voidcrew/shuttles/ruin_pirate_cutter.dmm b/_maps/voidcrew/shuttles/ruin_pirate_cutter.dmm
new file mode 100644
index 00000000000..1007292411e
--- /dev/null
+++ b/_maps/voidcrew/shuttles/ruin_pirate_cutter.dmm
@@ -0,0 +1,1177 @@
+//MAP CONVERTED BY dmm2tgm.py THIS HEADER COMMENT PREVENTS RECONVERSION, DO NOT REMOVE
+"cf" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 1
+ },
+/turf/open/floor/iron/white/side{
+ dir = 1
+ },
+/area/shuttle/ruin/caravan/pirate)
+"co" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/obj/effect/turf_decal/tile/red/half/contrasted,
+/turf/open/floor/iron,
+/area/shuttle/ruin/caravan/pirate)
+"dS" = (
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"es" = (
+/obj/machinery/power/port_gen/pacman{
+ anchored = 1
+ },
+/obj/item/wrench,
+/obj/effect/turf_decal/stripes/line{
+ dir = 6
+ },
+/obj/structure/cable,
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"fb" = (
+/obj/structure/table,
+/obj/item/reagent_containers/cup/glass/bottle/rum{
+ pixel_x = 3;
+ pixel_y = 6
+ },
+/obj/item/reagent_containers/cup/glass/bottle/rum,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"ge" = (
+/obj/machinery/atmospherics/components/unary/vent_pump/on,
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron,
+/area/shuttle/ruin/caravan/pirate)
+"gS" = (
+/obj/structure/closet{
+ name = "pirate outfits"
+ },
+/obj/item/clothing/head/collectable/pirate,
+/obj/item/clothing/suit/costume/pirate,
+/obj/item/clothing/under/costume/pirate,
+/obj/item/clothing/shoes/jackboots,
+/obj/item/clothing/head/costume/pirate/bandana,
+/turf/open/floor/iron/dark/side{
+ dir = 5
+ },
+/area/shuttle/ruin/caravan/pirate)
+"hi" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/obj/machinery/button/door/directional/south{
+ id = "caravanpirate_bolt_starboard";
+ name = "External Bolt Control";
+ normaldoorcontrol = 1;
+ specialfunctions = 4
+ },
+/obj/effect/turf_decal/tile/red/half/contrasted,
+/turf/open/floor/iron,
+/area/shuttle/ruin/caravan/pirate)
+"iM" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden,
+/obj/structure/cable,
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"iN" = (
+/obj/effect/spawner/human_npc/ruin/pirate,
+/turf/open/floor/iron,
+/area/shuttle/ruin/caravan/pirate)
+"jc" = (
+/obj/machinery/light/small/directional/east,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 9
+ },
+/obj/effect/turf_decal/tile/red/half/contrasted,
+/turf/open/floor/iron,
+/area/shuttle/ruin/caravan/pirate)
+"jk" = (
+/obj/structure/table/reinforced,
+/obj/machinery/recharger,
+/obj/item/melee/baton,
+/obj/effect/turf_decal/tile/red,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"jn" = (
+/obj/machinery/power/shuttle_engine/propulsion/burst/left{
+ dir = 8
+ },
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/pirate)
+"jx" = (
+/obj/machinery/suit_storage_unit/open,
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"ka" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/obj/machinery/door/firedoor,
+/obj/machinery/door/airlock/security{
+ name = "Armory"
+ },
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron,
+/area/shuttle/ruin/caravan/pirate)
+"kU" = (
+/obj/machinery/atmospherics/components/unary/vent_pump/on{
+ dir = 1
+ },
+/turf/open/floor/iron,
+/area/shuttle/ruin/caravan/pirate)
+"lD" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden,
+/obj/effect/turf_decal/tile/red/half/contrasted,
+/turf/open/floor/iron,
+/area/shuttle/ruin/caravan/pirate)
+"lN" = (
+/obj/structure/chair/office{
+ dir = 4
+ },
+/obj/machinery/turretid{
+ icon_state = "control_kill";
+ lethal = 1;
+ locked = 0;
+ pixel_y = -30;
+ req_access = null
+ },
+/obj/effect/spawner/human_npc/ruin/pirate/gunner,
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"me" = (
+/obj/effect/mapping_helpers/airlock/cyclelink_helper,
+/obj/effect/mapping_helpers/airlock/locked,
+/obj/machinery/door/airlock/external/ruin{
+ id_tag = "caravanpirate_bolt_starboard"
+ },
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"ms" = (
+/obj/structure/table,
+/obj/item/storage/fancy/donut_box{
+ pixel_y = 18
+ },
+/obj/item/storage/box/donkpockets{
+ pixel_x = -3;
+ pixel_y = 7
+ },
+/obj/item/storage/box/donkpockets{
+ pixel_x = -6
+ },
+/obj/item/reagent_containers/cup/glass/bottle/rum{
+ pixel_x = 8;
+ pixel_y = 3
+ },
+/obj/structure/sign/poster/contraband/red_rum/directional/east,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"nN" = (
+/obj/structure/table,
+/obj/item/retractor,
+/obj/item/hemostat,
+/turf/open/floor/iron/white,
+/area/shuttle/ruin/caravan/pirate)
+"nT" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden,
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"pe" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/obj/effect/turf_decal/tile/red/anticorner/contrasted{
+ dir = 8
+ },
+/turf/open/floor/iron,
+/area/shuttle/ruin/caravan/pirate)
+"pg" = (
+/obj/structure/closet{
+ name = "pirate outfits"
+ },
+/obj/item/clothing/head/collectable/pirate,
+/obj/item/clothing/suit/costume/pirate,
+/obj/item/clothing/under/costume/pirate,
+/obj/item/clothing/shoes/jackboots,
+/obj/item/clothing/head/costume/pirate/bandana,
+/obj/effect/turf_decal/tile/red{
+ dir = 1
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"ph" = (
+/obj/machinery/door/poddoor{
+ id = "caravanpirate_bridge"
+ },
+/obj/effect/spawner/structure/window/reinforced/plasma/plastitanium,
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"pR" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"qB" = (
+/obj/effect/mapping_helpers/airlock/cyclelink_helper{
+ dir = 1
+ },
+/obj/effect/mapping_helpers/airlock/locked,
+/obj/machinery/door/airlock/external/ruin{
+ id_tag = "caravanpirate_bolt_starboard"
+ },
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"qU" = (
+/obj/structure/table,
+/obj/machinery/light/small/directional/west,
+/obj/item/stack/spacecash/c200,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"se" = (
+/obj/machinery/light/small/directional/east,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden,
+/obj/structure/cable,
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"sR" = (
+/obj/structure/table,
+/obj/machinery/microwave{
+ pixel_y = 5
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"sW" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/obj/machinery/button/door/directional/north{
+ id = "caravanpirate_bolt_port";
+ name = "External Bolt Control";
+ normaldoorcontrol = 1;
+ specialfunctions = 4
+ },
+/turf/open/floor/iron/white/side{
+ dir = 1
+ },
+/area/shuttle/ruin/caravan/pirate)
+"ti" = (
+/obj/structure/table,
+/obj/machinery/cell_charger,
+/obj/item/stack/cable_coil,
+/obj/item/stock_parts/power_store/cell/high,
+/obj/effect/turf_decal/bot,
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"ua" = (
+/obj/structure/table,
+/obj/item/storage/box/lethalshot,
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"ug" = (
+/obj/machinery/porta_turret/syndicate/pod{
+ dir = 10;
+ faction = list("pirate")
+ },
+/turf/closed/wall/mineral/plastitanium,
+/area/shuttle/ruin/caravan/pirate)
+"uV" = (
+/obj/structure/reagent_dispensers/watertank,
+/obj/item/reagent_containers/cup/bucket,
+/obj/item/mop,
+/obj/effect/turf_decal/stripes/line{
+ dir = 5
+ },
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"vT" = (
+/obj/structure/table,
+/obj/item/circular_saw,
+/obj/item/scalpel{
+ pixel_y = 12
+ },
+/obj/item/cautery{
+ pixel_x = 4
+ },
+/obj/machinery/light/small/directional/west,
+/turf/open/floor/iron/white/side{
+ dir = 8
+ },
+/area/shuttle/ruin/caravan/pirate)
+"wg" = (
+/obj/machinery/light/small/directional/east,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden,
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"wh" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"wE" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/obj/machinery/door/firedoor,
+/obj/machinery/door/airlock/medical/glass{
+ name = "Medbay"
+ },
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron,
+/area/shuttle/ruin/caravan/pirate)
+"wP" = (
+/obj/structure/closet/crate/freezer/surplus_limbs,
+/obj/effect/turf_decal/bot,
+/turf/open/floor/iron/white,
+/area/shuttle/ruin/caravan/pirate)
+"wR" = (
+/obj/machinery/porta_turret/syndicate/pod{
+ dir = 5;
+ faction = list("pirate")
+ },
+/turf/closed/wall/mineral/plastitanium,
+/area/shuttle/ruin/caravan/pirate)
+"wV" = (
+/obj/machinery/light/small/directional/north,
+/obj/structure/bed,
+/obj/item/bedsheet/pirate,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"xb" = (
+/obj/machinery/atmospherics/components/unary/vent_pump/on{
+ dir = 4
+ },
+/obj/machinery/space_heater,
+/obj/effect/turf_decal/stripes/line{
+ dir = 6
+ },
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"xq" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden,
+/obj/machinery/airalarm/directional/east,
+/obj/effect/mapping_helpers/airalarm/all_access,
+/obj/structure/cable,
+/obj/machinery/power/apc/auto_name/directional/west,
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"ya" = (
+/obj/structure/table/reinforced,
+/obj/machinery/button/door{
+ id = "caravanpirate_bridge";
+ name = "Bridge Blast Door Control";
+ pixel_x = -16
+ },
+/obj/effect/turf_decal/tile/red/half/contrasted,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"yR" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"Aj" = (
+/obj/machinery/computer/shuttle/caravan/pirate{
+ dir = 8
+ },
+/obj/effect/turf_decal/tile/red/half/contrasted{
+ dir = 8
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"An" = (
+/obj/item/stack/sheet/mineral/gold{
+ amount = 25
+ },
+/obj/item/stack/sheet/mineral/bananium{
+ amount = 5
+ },
+/obj/item/stack/sheet/mineral/silver{
+ amount = 25
+ },
+/obj/item/stack/sheet/mineral/uranium{
+ amount = 10
+ },
+/obj/item/stack/sheet/mineral/diamond{
+ amount = 5
+ },
+/obj/structure/closet/crate,
+/obj/item/coin/silver,
+/obj/item/coin/silver,
+/obj/item/coin/silver,
+/obj/item/coin/gold,
+/obj/item/coin/gold,
+/obj/effect/turf_decal/tile/blue,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"AS" = (
+/obj/machinery/porta_turret/syndicate/pod{
+ dir = 9;
+ faction = list("pirate")
+ },
+/turf/closed/wall/mineral/plastitanium,
+/area/shuttle/ruin/caravan/pirate)
+"AW" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 6
+ },
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron,
+/area/shuttle/ruin/caravan/pirate)
+"BX" = (
+/obj/structure/closet/crate/secure/loot,
+/obj/machinery/airalarm/directional/north,
+/obj/effect/mapping_helpers/airalarm/all_access,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"CI" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 9
+ },
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"Di" = (
+/obj/structure/table,
+/obj/item/storage/medkit/brute{
+ pixel_x = 3;
+ pixel_y = 3
+ },
+/obj/item/storage/medkit/fire,
+/obj/machinery/firealarm/directional/south,
+/turf/open/floor/iron/white,
+/area/shuttle/ruin/caravan/pirate)
+"DQ" = (
+/obj/structure/reagent_dispensers/fueltank,
+/obj/effect/turf_decal/stripes/line{
+ dir = 4
+ },
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"Eh" = (
+/obj/machinery/atmospherics/components/unary/vent_pump/on,
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"Fn" = (
+/obj/machinery/light/small/directional/west,
+/obj/effect/turf_decal/tile/red/half/contrasted{
+ dir = 8
+ },
+/turf/open/floor/iron,
+/area/shuttle/ruin/caravan/pirate)
+"FB" = (
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron,
+/area/shuttle/ruin/caravan/pirate)
+"FI" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/obj/machinery/door/firedoor,
+/obj/machinery/door/airlock/engineering{
+ name = "Engineering"
+ },
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"FX" = (
+/obj/machinery/power/shuttle_engine/propulsion/burst/right{
+ dir = 8
+ },
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/pirate)
+"Gj" = (
+/obj/structure/tank_dispenser/oxygen,
+/obj/machinery/firealarm/directional/north,
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"GL" = (
+/obj/structure/bed{
+ dir = 4
+ },
+/obj/item/bedsheet/pirate{
+ dir = 4
+ },
+/obj/machinery/airalarm/directional/west,
+/obj/effect/mapping_helpers/airalarm/all_access,
+/obj/effect/turf_decal/tile/red{
+ dir = 8
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"Ha" = (
+/obj/machinery/light/small/directional/south,
+/obj/structure/bed,
+/obj/item/bedsheet/pirate,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"Hb" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 5
+ },
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron,
+/area/shuttle/ruin/caravan/pirate)
+"Hl" = (
+/obj/machinery/porta_turret/syndicate/pod{
+ dir = 6;
+ faction = list("pirate")
+ },
+/turf/closed/wall/mineral/plastitanium,
+/area/shuttle/ruin/caravan/pirate)
+"Hu" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/obj/machinery/door/firedoor,
+/obj/machinery/door/airlock/command{
+ name = "Bridge"
+ },
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"Ir" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 8
+ },
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"Iu" = (
+/obj/structure/table,
+/obj/machinery/door/window/right/directional/south{
+ name = "Weapon Storage"
+ },
+/obj/item/gun/energy/laser,
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"Jv" = (
+/turf/template_noop,
+/area/template_noop)
+"JJ" = (
+/obj/structure/table/optable,
+/obj/effect/turf_decal/bot,
+/turf/open/floor/iron/white,
+/area/shuttle/ruin/caravan/pirate)
+"JP" = (
+/obj/machinery/computer/camera_advanced/shuttle_docker/caravan/pirate,
+/obj/effect/turf_decal/tile/red/half/contrasted{
+ dir = 1
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"Kc" = (
+/turf/closed/wall/mineral/plastitanium/nodiagonal,
+/area/shuttle/ruin/caravan/pirate)
+"KL" = (
+/obj/machinery/power/shuttle_engine/propulsion/burst{
+ dir = 8
+ },
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/pirate)
+"Ll" = (
+/obj/structure/rack,
+/obj/item/storage/toolbox/emergency,
+/obj/item/weldingtool,
+/obj/effect/turf_decal/tile/red{
+ dir = 4
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"Mk" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/obj/effect/turf_decal/tile/red/half/contrasted{
+ dir = 8
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"Ms" = (
+/obj/effect/mapping_helpers/airlock/cyclelink_helper,
+/obj/effect/mapping_helpers/airlock/locked,
+/obj/machinery/door/airlock/external/ruin{
+ id_tag = "caravanpirate_bolt_port"
+ },
+/obj/docking_port/mobile{
+ callTime = 150;
+ dir = 2;
+ shuttle_id = "caravanpirate";
+ movement_force = list("KNOCKDOWN"=0,"THROW"=0);
+ name = "Pirate Cutter";
+ port_direction = 8;
+ preferred_direction = 4
+ },
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"Ns" = (
+/obj/machinery/light/small/directional/east,
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 10
+ },
+/turf/open/floor/iron/white/side{
+ dir = 1
+ },
+/area/shuttle/ruin/caravan/pirate)
+"Oo" = (
+/obj/machinery/light/small/directional/west,
+/obj/structure/sign/warning/vacuum/directional/west,
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"Or" = (
+/obj/structure/chair/office{
+ dir = 8
+ },
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"OO" = (
+/obj/machinery/sleeper{
+ dir = 1
+ },
+/obj/effect/turf_decal/delivery,
+/obj/machinery/airalarm/directional/south,
+/obj/effect/mapping_helpers/airalarm/all_access,
+/turf/open/floor/iron/white,
+/area/shuttle/ruin/caravan/pirate)
+"Po" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/turf/open/floor/iron/dark/side{
+ dir = 4
+ },
+/area/shuttle/ruin/caravan/pirate)
+"PC" = (
+/obj/machinery/power/terminal{
+ dir = 1
+ },
+/obj/structure/closet/crate,
+/obj/item/stack/sheet/iron/twenty,
+/obj/item/stack/sheet/glass{
+ amount = 10
+ },
+/obj/item/storage/toolbox/mechanical,
+/obj/item/flashlight{
+ pixel_x = 3;
+ pixel_y = 3
+ },
+/obj/item/stack/sheet/mineral/plasma{
+ amount = 20
+ },
+/obj/effect/turf_decal/stripes/line{
+ dir = 4
+ },
+/obj/structure/cable,
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"Qb" = (
+/obj/structure/sign/departments/medbay/alt,
+/turf/closed/wall/mineral/plastitanium/nodiagonal,
+/area/shuttle/ruin/caravan/pirate)
+"Rb" = (
+/obj/structure/table,
+/obj/structure/window/reinforced/spawner/directional/west,
+/obj/machinery/door/window/left/directional/south{
+ name = "Weapon Storage"
+ },
+/obj/item/grenade/smokebomb{
+ pixel_x = -4
+ },
+/obj/item/grenade/smokebomb{
+ pixel_x = 2
+ },
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"Ry" = (
+/obj/structure/rack,
+/obj/item/storage/bag/money/vault,
+/mob/living/basic/parrot{
+ faction = list("pirate");
+ name = "Pegwing"
+ },
+/obj/effect/turf_decal/tile/blue{
+ dir = 4
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"SU" = (
+/obj/machinery/power/shuttle_engine/heater{
+ dir = 8
+ },
+/obj/structure/window/reinforced/spawner/directional/east,
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/pirate)
+"UH" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/obj/effect/turf_decal/tile/blue/half/contrasted{
+ dir = 4
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"Vh" = (
+/obj/structure/sign/departments/engineering,
+/turf/closed/wall/mineral/plastitanium/nodiagonal,
+/area/shuttle/ruin/caravan/pirate)
+"Vs" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/turf/open/floor/iron/white/side{
+ dir = 1
+ },
+/area/shuttle/ruin/caravan/pirate)
+"Vz" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 9
+ },
+/obj/machinery/firealarm/directional/south,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"VF" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 4
+ },
+/turf/open/floor/iron/white/side{
+ dir = 9
+ },
+/area/shuttle/ruin/caravan/pirate)
+"We" = (
+/obj/machinery/power/smes/super/full,
+/obj/effect/turf_decal/stripes/line{
+ dir = 5
+ },
+/obj/structure/cable,
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"Wi" = (
+/obj/effect/mapping_helpers/airlock/cyclelink_helper{
+ dir = 1
+ },
+/obj/effect/mapping_helpers/airlock/locked,
+/obj/machinery/door/airlock/external/ruin{
+ id_tag = "caravanpirate_bolt_port"
+ },
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"Wo" = (
+/obj/machinery/light/small/directional/west,
+/obj/structure/closet/crate/secure/loot,
+/obj/machinery/atmospherics/components/unary/vent_pump/on{
+ dir = 4
+ },
+/obj/structure/extinguisher_cabinet{
+ pixel_x = -27
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"WV" = (
+/obj/effect/decal/cleanable/dirt,
+/obj/effect/spawner/human_npc/ruin/pirate/gunner,
+/turf/open/floor/iron,
+/area/shuttle/ruin/caravan/pirate)
+"Xw" = (
+/obj/structure/table,
+/obj/machinery/airalarm/directional/north,
+/obj/effect/mapping_helpers/airalarm/all_access,
+/obj/item/ammo_box/a40mm,
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"XF" = (
+/obj/structure/table,
+/obj/item/coin/gold,
+/obj/item/coin/silver,
+/obj/item/coin/silver,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"Yc" = (
+/turf/closed/wall/mineral/plastitanium,
+/area/shuttle/ruin/caravan/pirate)
+"Ye" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 10
+ },
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/pirate)
+"Yi" = (
+/obj/effect/spawner/structure/window/reinforced/plasma/plastitanium,
+/obj/machinery/door/poddoor{
+ id = "caravanpirate_bridge"
+ },
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"Yy" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 8
+ },
+/obj/machinery/meter,
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"Zp" = (
+/obj/machinery/atmospherics/components/tank/air,
+/obj/effect/turf_decal/bot,
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+"Zq" = (
+/obj/structure/bed{
+ dir = 4
+ },
+/obj/item/bedsheet/pirate{
+ dir = 4
+ },
+/obj/machinery/firealarm/directional/west,
+/turf/open/floor/iron/dark/side{
+ dir = 6
+ },
+/area/shuttle/ruin/caravan/pirate)
+"ZU" = (
+/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden{
+ dir = 5
+ },
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/pirate)
+
+(1,1,1) = {"
+Jv
+Jv
+Jv
+jn
+KL
+FX
+Jv
+jn
+KL
+FX
+Jv
+Jv
+Jv
+"}
+(2,1,1) = {"
+Jv
+Jv
+Yc
+SU
+SU
+SU
+Kc
+SU
+SU
+SU
+Yc
+Jv
+Jv
+"}
+(3,1,1) = {"
+Jv
+AS
+Kc
+uV
+DQ
+xb
+Kc
+We
+PC
+es
+Kc
+ug
+Jv
+"}
+(4,1,1) = {"
+Jv
+Kc
+Zp
+Yy
+wg
+pR
+xq
+iM
+se
+ZU
+ti
+Kc
+Jv
+"}
+(5,1,1) = {"
+Jv
+Kc
+Kc
+FI
+Vh
+Kc
+Kc
+Kc
+Vh
+FI
+Kc
+Kc
+Jv
+"}
+(6,1,1) = {"
+Jv
+Kc
+jx
+VF
+vT
+nN
+Kc
+ua
+Fn
+pe
+jx
+Kc
+Jv
+"}
+(7,1,1) = {"
+Yc
+Kc
+Kc
+Vs
+FB
+JJ
+Kc
+Xw
+WV
+co
+Kc
+Kc
+Yc
+"}
+(8,1,1) = {"
+Ms
+Oo
+Wi
+cf
+kU
+Di
+Kc
+Gj
+ge
+lD
+me
+Oo
+qB
+"}
+(9,1,1) = {"
+Yc
+Kc
+Kc
+sW
+FB
+OO
+Kc
+Rb
+iN
+hi
+Kc
+Kc
+Yc
+"}
+(10,1,1) = {"
+Jv
+Yi
+jx
+Ns
+Hb
+wP
+Kc
+Iu
+AW
+jc
+jx
+ph
+Jv
+"}
+(11,1,1) = {"
+Jv
+Yc
+Kc
+Qb
+wE
+Kc
+Kc
+Kc
+ka
+Kc
+Kc
+Yc
+Jv
+"}
+(12,1,1) = {"
+Jv
+Jv
+Kc
+gS
+Po
+Zq
+Wo
+GL
+Mk
+pg
+Kc
+Jv
+Jv
+"}
+(13,1,1) = {"
+Jv
+Jv
+Kc
+wV
+Ye
+nT
+wh
+Ir
+CI
+Ha
+Kc
+Jv
+Jv
+"}
+(14,1,1) = {"
+Jv
+Jv
+wR
+Kc
+sR
+ms
+An
+UH
+Ry
+Kc
+Hl
+Jv
+Jv
+"}
+(15,1,1) = {"
+Jv
+Jv
+Jv
+Yc
+Kc
+Kc
+Kc
+Hu
+Kc
+Yc
+Jv
+Jv
+Jv
+"}
+(16,1,1) = {"
+Jv
+Jv
+Jv
+Jv
+Kc
+fb
+qU
+yR
+Kc
+Jv
+Jv
+Jv
+Jv
+"}
+(17,1,1) = {"
+Jv
+Jv
+Jv
+Jv
+Kc
+XF
+Or
+yR
+Kc
+Jv
+Jv
+Jv
+Jv
+"}
+(18,1,1) = {"
+Jv
+Jv
+Jv
+Jv
+Kc
+BX
+Eh
+Vz
+Kc
+Jv
+Jv
+Jv
+Jv
+"}
+(19,1,1) = {"
+Jv
+Jv
+Jv
+Jv
+Kc
+Ll
+dS
+jk
+Kc
+Jv
+Jv
+Jv
+Jv
+"}
+(20,1,1) = {"
+Jv
+Jv
+Jv
+Jv
+ph
+JP
+lN
+ya
+Yi
+Jv
+Jv
+Jv
+Jv
+"}
+(21,1,1) = {"
+Jv
+Jv
+Jv
+Jv
+Yi
+Yi
+Aj
+Yi
+Yi
+Jv
+Jv
+Jv
+Jv
+"}
+(22,1,1) = {"
+Jv
+Jv
+Jv
+Jv
+Jv
+Yi
+Yi
+Yi
+Jv
+Jv
+Jv
+Jv
+Jv
+"}
diff --git a/_maps/voidcrew/shuttles/ruin_syndicate_dropship.dmm b/_maps/voidcrew/shuttles/ruin_syndicate_dropship.dmm
new file mode 100644
index 00000000000..31ca89403cd
--- /dev/null
+++ b/_maps/voidcrew/shuttles/ruin_syndicate_dropship.dmm
@@ -0,0 +1,620 @@
+//MAP CONVERTED BY dmm2tgm.py THIS HEADER COMMENT PREVENTS RECONVERSION, DO NOT REMOVE
+"bh" = (
+/obj/machinery/door/airlock/hatch{
+ id_tag = "caravansyndicate3_bolt_port";
+ name = "External Airlock";
+ normalspeed = 0
+ },
+/obj/docking_port/mobile{
+ dir = 2;
+ shuttle_id = "caravansyndicate3";
+ name = "Syndicate Drop Ship";
+ port_direction = 8;
+ preferred_direction = 4
+ },
+/obj/effect/mapping_helpers/airlock/cyclelink_helper,
+/obj/effect/mapping_helpers/airlock/access/all/syndicate/general,
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/syndicate3)
+"bt" = (
+/obj/effect/turf_decal/stripes/line{
+ dir = 8
+ },
+/obj/structure/sign/warning/vacuum/directional/south,
+/obj/effect/decal/cleanable/dirt,
+/obj/structure/closet/syndicate{
+ anchored = 1
+ },
+/obj/item/clothing/under/syndicate/combat,
+/obj/item/storage/belt/military,
+/turf/open/floor/mineral/plastitanium,
+/area/shuttle/ruin/caravan/syndicate3)
+"bX" = (
+/obj/machinery/porta_turret/syndicate/energy{
+ dir = 1
+ },
+/turf/closed/wall/mineral/plastitanium/nodiagonal,
+/area/shuttle/ruin/caravan/syndicate3)
+"co" = (
+/obj/machinery/power/shuttle_engine/heater{
+ dir = 8
+ },
+/obj/structure/window/reinforced/spawner/directional/east,
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/syndicate3)
+"dt" = (
+/obj/effect/turf_decal/stripes/line{
+ dir = 6
+ },
+/obj/machinery/power/port_gen/pacman{
+ anchored = 1
+ },
+/obj/item/wrench,
+/obj/effect/decal/cleanable/dirt,
+/obj/structure/cable,
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/syndicate3)
+"dy" = (
+/obj/effect/turf_decal/stripes/line{
+ dir = 8
+ },
+/obj/structure/closet/syndicate{
+ anchored = 1
+ },
+/obj/structure/sign/warning/vacuum/directional/north,
+/obj/effect/decal/cleanable/dirt,
+/obj/item/clothing/shoes/sneakers/black,
+/turf/open/floor/mineral/plastitanium,
+/area/shuttle/ruin/caravan/syndicate3)
+"eV" = (
+/obj/machinery/power/shuttle_engine/propulsion/burst/left{
+ dir = 8
+ },
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/syndicate3)
+"fU" = (
+/obj/machinery/power/shuttle_engine/propulsion/burst{
+ dir = 8
+ },
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/syndicate3)
+"gv" = (
+/obj/structure/table/reinforced,
+/obj/machinery/recharger,
+/obj/machinery/light/small/directional/west,
+/obj/effect/turf_decal/tile/red/anticorner/contrasted{
+ dir = 8
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"gz" = (
+/obj/structure/table/reinforced,
+/obj/item/storage/toolbox/emergency,
+/obj/item/wrench,
+/obj/machinery/light/small/directional/west,
+/obj/effect/decal/cleanable/dirt,
+/obj/effect/decal/cleanable/dirt,
+/obj/effect/turf_decal/tile/red/anticorner/contrasted{
+ dir = 1
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"id" = (
+/obj/effect/turf_decal/stripes/line{
+ dir = 10
+ },
+/obj/structure/closet/syndicate{
+ anchored = 1
+ },
+/obj/item/clothing/under/syndicate/combat,
+/turf/open/floor/mineral/plastitanium,
+/area/shuttle/ruin/caravan/syndicate3)
+"im" = (
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/computer/camera_advanced/shuttle_docker/caravan/syndicate3{
+ dir = 8
+ },
+/obj/effect/turf_decal/tile/red/anticorner/contrasted{
+ dir = 8
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"iN" = (
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"kc" = (
+/obj/effect/decal/cleanable/dirt,
+/obj/effect/turf_decal/tile/red/half/contrasted,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"kk" = (
+/obj/effect/spawner/structure/window/reinforced/plasma/plastitanium,
+/obj/machinery/door/poddoor{
+ id = "caravansyndicate3_bridge"
+ },
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/syndicate3)
+"kR" = (
+/obj/effect/turf_decal/stripes/line{
+ dir = 8
+ },
+/obj/machinery/light/small/directional/east,
+/obj/structure/closet/syndicate{
+ anchored = 1
+ },
+/obj/item/clothing/under/syndicate,
+/obj/item/clothing/glasses/night,
+/turf/open/floor/mineral/plastitanium,
+/area/shuttle/ruin/caravan/syndicate3)
+"mq" = (
+/obj/effect/turf_decal/stripes/line{
+ dir = 10
+ },
+/obj/effect/decal/cleanable/dirt,
+/obj/structure/closet/syndicate{
+ anchored = 1
+ },
+/obj/item/clothing/under/syndicate/combat,
+/obj/item/clothing/shoes/jackboots,
+/obj/item/storage/belt/military,
+/obj/item/crowbar/red,
+/turf/open/floor/mineral/plastitanium,
+/area/shuttle/ruin/caravan/syndicate3)
+"nv" = (
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"oW" = (
+/obj/machinery/light/small/directional/west,
+/obj/machinery/button/door/directional/west{
+ id = "caravansyndicate3_bolt_port";
+ name = "External Bolt Control";
+ normaldoorcontrol = 1;
+ req_access = list("syndicate");
+ specialfunctions = 4
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"pY" = (
+/obj/structure/chair/comfy/shuttle{
+ dir = 1
+ },
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/light/small/directional/south,
+/turf/open/floor/pod/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"rQ" = (
+/obj/effect/turf_decal/stripes/line{
+ dir = 9
+ },
+/obj/effect/decal/cleanable/dirt,
+/obj/structure/closet/syndicate{
+ anchored = 1
+ },
+/obj/item/clothing/under/syndicate,
+/obj/item/clothing/shoes/sneakers/black,
+/turf/open/floor/mineral/plastitanium,
+/area/shuttle/ruin/caravan/syndicate3)
+"sk" = (
+/obj/structure/chair/comfy/shuttle{
+ dir = 4
+ },
+/obj/effect/turf_decal/tile/red,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"ts" = (
+/obj/machinery/airalarm/directional/west,
+/obj/effect/mapping_helpers/airalarm/syndicate_access,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"uv" = (
+/obj/structure/chair/comfy/shuttle{
+ dir = 4
+ },
+/obj/effect/spawner/human_npc/ruin/syndicate/gunner/pilot,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"uI" = (
+/turf/closed/wall/mineral/plastitanium/nodiagonal,
+/area/shuttle/ruin/caravan/syndicate3)
+"wl" = (
+/obj/machinery/airalarm/directional/west,
+/obj/effect/mapping_helpers/airalarm/syndicate_access,
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"wS" = (
+/obj/machinery/door/airlock/hatch{
+ id_tag = "caravansyndicate3_bolt_starboard";
+ name = "External Airlock";
+ normalspeed = 0
+ },
+/obj/effect/mapping_helpers/airlock/cyclelink_helper{
+ dir = 1
+ },
+/obj/effect/mapping_helpers/airlock/access/all/syndicate/general,
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/syndicate3)
+"zB" = (
+/obj/structure/chair/comfy/shuttle,
+/obj/machinery/light/small/directional/north,
+/obj/machinery/power/apc/auto_name/directional/west,
+/obj/effect/mapping_helpers/apc/syndicate_access,
+/obj/effect/decal/cleanable/dirt,
+/obj/structure/cable,
+/turf/open/floor/pod/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"zP" = (
+/obj/machinery/computer/crew{
+ dir = 8
+ },
+/obj/effect/decal/cleanable/dirt,
+/obj/effect/turf_decal/tile/red/anticorner/contrasted{
+ dir = 1
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"DF" = (
+/obj/machinery/computer/shuttle/caravan/syndicate3{
+ dir = 8
+ },
+/obj/effect/turf_decal/tile/red/half/contrasted{
+ dir = 8
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"GU" = (
+/obj/effect/decal/cleanable/dirt,
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"HI" = (
+/obj/effect/turf_decal/stripes/line{
+ dir = 4
+ },
+/obj/structure/closet/crate,
+/obj/machinery/power/terminal{
+ dir = 1
+ },
+/obj/item/stack/sheet/iron/twenty,
+/obj/item/stack/sheet/glass{
+ amount = 10
+ },
+/obj/item/stack/sheet/mineral/plastitanium{
+ amount = 20
+ },
+/obj/item/storage/box/lights/bulbs,
+/obj/item/storage/toolbox/mechanical,
+/obj/item/stack/sheet/mineral/plasma{
+ amount = 20
+ },
+/obj/structure/cable,
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/syndicate3)
+"Ib" = (
+/obj/effect/turf_decal/tile/red/half/contrasted{
+ dir = 1
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"Ie" = (
+/obj/structure/table/reinforced,
+/obj/machinery/button/door{
+ id = "caravansyndicate3_bridge";
+ name = "Bridge Blast Door Control";
+ pixel_x = -16;
+ pixel_y = 5;
+ req_access = list("syndicate")
+ },
+/obj/machinery/button/door{
+ id = "caravansyndicate3_bolt_bridge";
+ name = "Bridge Bolt Control";
+ normaldoorcontrol = 1;
+ pixel_x = -16;
+ pixel_y = -5;
+ req_access = list("syndicate");
+ specialfunctions = 4
+ },
+/obj/effect/decal/cleanable/dirt,
+/obj/effect/turf_decal/tile/red/anticorner/contrasted,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"Jv" = (
+/turf/template_noop,
+/area/template_noop)
+"JK" = (
+/obj/effect/turf_decal/stripes/line{
+ dir = 8
+ },
+/obj/machinery/light/small/directional/east,
+/obj/effect/decal/cleanable/dirt,
+/obj/effect/decal/cleanable/dirt,
+/obj/structure/closet/syndicate{
+ anchored = 1
+ },
+/obj/item/storage/box/syndie_kit/chameleon,
+/obj/item/crowbar/red,
+/turf/open/floor/mineral/plastitanium,
+/area/shuttle/ruin/caravan/syndicate3)
+"JT" = (
+/obj/machinery/light/small/directional/west,
+/obj/machinery/button/door/directional/west{
+ id = "caravansyndicate3_bolt_starboard";
+ name = "External Bolt Control";
+ normaldoorcontrol = 1;
+ req_access = list("syndicate");
+ specialfunctions = 4
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"KN" = (
+/obj/machinery/firealarm/directional/west,
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"KW" = (
+/turf/closed/wall/mineral/plastitanium,
+/area/shuttle/ruin/caravan/syndicate3)
+"LF" = (
+/obj/structure/chair/comfy/shuttle,
+/obj/machinery/airalarm/directional/north,
+/obj/effect/mapping_helpers/airalarm/syndicate_access,
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/pod/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"Mc" = (
+/obj/effect/turf_decal/tile/red/half/contrasted,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"Nn" = (
+/obj/structure/chair/comfy/shuttle{
+ dir = 1
+ },
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/pod/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"Oe" = (
+/obj/machinery/power/smes/super/full,
+/obj/effect/turf_decal/stripes/line{
+ dir = 5
+ },
+/obj/effect/decal/cleanable/dirt,
+/obj/effect/decal/cleanable/dirt,
+/obj/structure/cable,
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/syndicate3)
+"Pp" = (
+/obj/effect/turf_decal/stripes/line{
+ dir = 9
+ },
+/obj/effect/decal/cleanable/dirt,
+/obj/structure/closet/syndicate{
+ anchored = 1
+ },
+/obj/item/clothing/shoes/jackboots,
+/obj/item/crowbar/red,
+/turf/open/floor/mineral/plastitanium,
+/area/shuttle/ruin/caravan/syndicate3)
+"Ry" = (
+/obj/machinery/door/airlock/hatch{
+ name = "Ready Room"
+ },
+/obj/effect/mapping_helpers/airlock/cyclelink_helper{
+ dir = 4
+ },
+/obj/effect/mapping_helpers/airlock/access/all/syndicate/general,
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"RT" = (
+/obj/effect/decal/cleanable/dirt,
+/obj/structure/cable,
+/obj/effect/turf_decal/tile/red/half/contrasted{
+ dir = 1
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"SU" = (
+/obj/effect/mapping_helpers/airlock/locked,
+/obj/machinery/door/airlock/hatch{
+ id_tag = "caravansyndicate3_bolt_bridge";
+ name = "Bridge"
+ },
+/obj/effect/mapping_helpers/airlock/cyclelink_helper{
+ dir = 8
+ },
+/obj/effect/mapping_helpers/airlock/access/all/syndicate/general,
+/obj/effect/turf_decal/tile/neutral/fourcorners,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"Te" = (
+/obj/machinery/power/shuttle_engine/propulsion/burst/right{
+ dir = 8
+ },
+/turf/open/floor/plating/airless,
+/area/shuttle/ruin/caravan/syndicate3)
+"TT" = (
+/obj/machinery/turretid{
+ ailock = 1;
+ desc = "A specially designed set of turret controls. Looks to be covered in protective casing to prevent AI interfacing.";
+ icon_state = "control_kill";
+ lethal = 1;
+ name = "Shuttle turret control";
+ pixel_y = 34;
+ req_access = list("syndicate")
+ },
+/obj/structure/chair/comfy/shuttle{
+ dir = 4
+ },
+/obj/effect/turf_decal/tile/red{
+ dir = 4
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"UI" = (
+/obj/machinery/porta_turret/syndicate/energy,
+/turf/closed/wall/mineral/plastitanium/nodiagonal,
+/area/shuttle/ruin/caravan/syndicate3)
+"UV" = (
+/obj/structure/table/reinforced,
+/obj/item/storage/medkit/regular,
+/obj/item/assembly/flash/handheld,
+/obj/effect/decal/cleanable/dirt,
+/obj/effect/turf_decal/tile/red/anticorner/contrasted{
+ dir = 4
+ },
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"Vh" = (
+/obj/structure/chair/comfy/shuttle,
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/pod/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"Vp" = (
+/obj/machinery/firealarm/directional/west,
+/turf/open/floor/iron/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+"ZF" = (
+/obj/structure/chair/comfy/shuttle{
+ dir = 1
+ },
+/obj/machinery/firealarm/directional/south,
+/obj/effect/decal/cleanable/dirt,
+/turf/open/floor/pod/dark,
+/area/shuttle/ruin/caravan/syndicate3)
+
+(1,1,1) = {"
+Jv
+eV
+fU
+fU
+fU
+Te
+Jv
+"}
+(2,1,1) = {"
+KW
+co
+co
+co
+co
+co
+KW
+"}
+(3,1,1) = {"
+uI
+uI
+Oe
+HI
+dt
+uI
+uI
+"}
+(4,1,1) = {"
+uI
+zB
+RT
+nv
+Mc
+pY
+uI
+"}
+(5,1,1) = {"
+uI
+LF
+Ib
+iN
+Mc
+ZF
+uI
+"}
+(6,1,1) = {"
+uI
+Vh
+Ib
+iN
+kc
+Nn
+uI
+"}
+(7,1,1) = {"
+uI
+kR
+mq
+iN
+rQ
+JK
+uI
+"}
+(8,1,1) = {"
+bX
+uI
+uI
+Ry
+uI
+uI
+UI
+"}
+(9,1,1) = {"
+bh
+oW
+wl
+iN
+Vp
+JT
+wS
+"}
+(10,1,1) = {"
+uI
+dy
+id
+GU
+Pp
+bt
+uI
+"}
+(11,1,1) = {"
+uI
+uI
+uI
+SU
+uI
+uI
+uI
+"}
+(12,1,1) = {"
+uI
+gv
+ts
+iN
+KN
+gz
+uI
+"}
+(13,1,1) = {"
+kk
+Ie
+TT
+uv
+sk
+UV
+kk
+"}
+(14,1,1) = {"
+kk
+kk
+im
+DF
+zP
+kk
+kk
+"}
+(15,1,1) = {"
+Jv
+kk
+kk
+kk
+kk
+kk
+Jv
+"}
diff --git a/_maps/voidcrew/shuttles/ruin_syndicate_fighter_shiv.dmm b/_maps/voidcrew/shuttles/ruin_syndicate_fighter_shiv.dmm
new file mode 100644
index 00000000000..9ca923f4561
--- /dev/null
+++ b/_maps/voidcrew/shuttles/ruin_syndicate_fighter_shiv.dmm
@@ -0,0 +1,156 @@
+//MAP CONVERTED BY dmm2tgm.py THIS HEADER COMMENT PREVENTS RECONVERSION, DO NOT REMOVE
+"cZ" = (
+/obj/machinery/porta_turret/syndicate/energy{
+ dir = 4
+ },
+/turf/closed/wall/mineral/plastitanium,
+/area/shuttle/ruin/caravan/syndicate1)
+"dc" = (
+/obj/structure/chair/comfy/shuttle{
+ dir = 4
+ },
+/obj/machinery/turretid{
+ ailock = 1;
+ desc = "A specially designed set of turret controls. Looks to be covered in protective casing to prevent AI interfacing.";
+ icon_state = "control_kill";
+ lethal = 1;
+ name = "Shuttle turret control";
+ pixel_x = 32;
+ pixel_y = -28;
+ req_access = list("syndicate")
+ },
+/obj/structure/cable,
+/obj/effect/spawner/human_npc/ruin/syndicate/gunner/pilot,
+/turf/open/floor/mineral/plastitanium/red,
+/area/shuttle/ruin/caravan/syndicate1)
+"ie" = (
+/turf/closed/wall/mineral/plastitanium,
+/area/shuttle/ruin/caravan/syndicate1)
+"qe" = (
+/obj/effect/decal/cleanable/dirt,
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/computer/shuttle/caravan/syndicate1{
+ dir = 8
+ },
+/turf/open/floor/mineral/plastitanium/red,
+/area/shuttle/ruin/caravan/syndicate1)
+"qu" = (
+/turf/closed/wall/mineral/plastitanium/nodiagonal,
+/area/shuttle/ruin/caravan/syndicate1)
+"tO" = (
+/obj/effect/decal/cleanable/dirt,
+/obj/machinery/computer/camera_advanced/shuttle_docker/caravan/syndicate1,
+/obj/machinery/button/door/directional/west{
+ id = "caravansyndicate1_bolt";
+ name = "External Bolt Control";
+ normaldoorcontrol = 1;
+ req_access = list("syndicate");
+ specialfunctions = 4
+ },
+/turf/open/floor/mineral/plastitanium/red,
+/area/shuttle/ruin/caravan/syndicate1)
+"Jv" = (
+/turf/template_noop,
+/area/template_noop)
+"UZ" = (
+/obj/machinery/power/shuttle_engine/propulsion/burst{
+ dir = 8
+ },
+/turf/closed/wall/mineral/plastitanium,
+/area/shuttle/ruin/caravan/syndicate1)
+"Ve" = (
+/obj/machinery/camera/xray/directional/west{
+ c_tag = "External View";
+ network = list("caravansyndicate1");
+ pixel_x = 32
+ },
+/turf/closed/wall/mineral/plastitanium/nodiagonal,
+/area/shuttle/ruin/caravan/syndicate1)
+"Yi" = (
+/obj/effect/mapping_helpers/airlock/locked,
+/obj/machinery/door/airlock/hatch{
+ id_tag = "caravansyndicate1_bolt";
+ name = "External Airlock";
+ normalspeed = 0
+ },
+/obj/effect/decal/cleanable/dirt,
+/obj/docking_port/mobile{
+ callTime = 50;
+ dir = 4;
+ shuttle_id = "caravansyndicate1";
+ ignitionTime = 25;
+ name = "Syndicate Fighter";
+ port_direction = 2;
+ preferred_direction = 4
+ },
+/obj/structure/cable,
+/obj/effect/mapping_helpers/airlock/access/all/syndicate/general,
+/turf/open/floor/plating,
+/area/shuttle/ruin/caravan/syndicate1)
+"YY" = (
+/obj/machinery/power/apc/auto_name/directional/west,
+/obj/effect/mapping_helpers/apc/syndicate_access,
+/obj/effect/mapping_helpers/apc/cell_10k,
+/obj/machinery/computer/security{
+ dir = 1;
+ network = list("caravansyndicate1")
+ },
+/obj/structure/cable,
+/turf/open/floor/mineral/plastitanium/red,
+/area/shuttle/ruin/caravan/syndicate1)
+
+(1,1,1) = {"
+Jv
+Jv
+UZ
+qu
+Yi
+qu
+UZ
+Jv
+Jv
+"}
+(2,1,1) = {"
+Jv
+UZ
+qu
+tO
+dc
+YY
+qu
+UZ
+Jv
+"}
+(3,1,1) = {"
+ie
+qu
+qu
+qu
+qe
+qu
+qu
+qu
+ie
+"}
+(4,1,1) = {"
+qu
+ie
+Jv
+cZ
+Ve
+cZ
+Jv
+ie
+qu
+"}
+(5,1,1) = {"
+cZ
+Jv
+Jv
+Jv
+Jv
+Jv
+Jv
+Jv
+cZ
+"}
diff --git a/code/controllers/subsystem/weather.dm b/code/controllers/subsystem/weather.dm
index ffd151171cc..b2c35e62947 100644
--- a/code/controllers/subsystem/weather.dm
+++ b/code/controllers/subsystem/weather.dm
@@ -38,7 +38,8 @@ SUBSYSTEM_DEF(weather)
mobs_by_z_cache_fire = times_fired
for(var/mob/living/candidate as anything in GLOB.mob_living_list)
// Weather is player-facing; ordinary planetary fauna should never enter its work list.
- if(!candidate.mind && !candidate.ever_had_mind)
+ // Human NPCs (voidcrew/modules/human_npcs/) are people: weathered like players while awake.
+ if(!candidate.mind && !candidate.ever_had_mind && !human_npc_weathered(candidate))
continue
var/candidate_z = candidate.z
if(!candidate_z) // contained mobs report z = 0
diff --git a/code/datums/weather/weather.dm b/code/datums/weather/weather.dm
index b1820c4d40b..cf6f55fec98 100644
--- a/code/datums/weather/weather.dm
+++ b/code/datums/weather/weather.dm
@@ -425,7 +425,8 @@
// VOIDCREW EDIT START - PR #123: ship systems and overmap integration.
/datum/weather/proc/can_weather_act_mob(mob/living/mob_to_check)
// Preserve effects on abandoned player bodies while excluding ordinary fauna.
- if(!mob_to_check.mind && !mob_to_check.ever_had_mind)
+ // Human NPCs (voidcrew/modules/human_npcs/) are weathered like players while awake.
+ if(!mob_to_check.mind && !mob_to_check.ever_had_mind && !human_npc_weathered(mob_to_check))
return
var/turf/mob_turf = get_turf(mob_to_check)
diff --git a/code/modules/mob/living/basic/trooper/trooper.dm b/code/modules/mob/living/basic/trooper/trooper.dm
index 32829923d23..779c2469457 100644
--- a/code/modules/mob/living/basic/trooper/trooper.dm
+++ b/code/modules/mob/living/basic/trooper/trooper.dm
@@ -32,8 +32,7 @@
/mob/living/basic/trooper/Initialize(mapload)
. = ..()
- if(use_dynamic_appearance) // VOIDCREW EDIT
- apply_dynamic_human_appearance(src, mob_spawn_path = mob_spawner, r_hand = r_hand, l_hand = l_hand) // VOIDCREW EDIT: trooper appearance integration: respect static fork sprites (voidcrew/edits/modules/mob/living/basic/trooper/trooper.dm)
+ apply_dynamic_human_appearance(src, mob_spawn_path = mob_spawner, r_hand = r_hand, l_hand = l_hand) // VOIDCREW EDIT CHANGE: unconditional again; the static-sprite opt-out went with the human NPC migration (voidcrew/modules/human_npcs)
if(LAZYLEN(loot) || corpse)
LAZYOR(loot, corpse)
loot = string_list(loot)
diff --git a/code/modules/unit_tests/simple_animal_freeze.dm b/code/modules/unit_tests/simple_animal_freeze.dm
index daefc29f871..457b208f62e 100644
--- a/code/modules/unit_tests/simple_animal_freeze.dm
+++ b/code/modules/unit_tests/simple_animal_freeze.dm
@@ -33,12 +33,6 @@
// mob set, grandfathered here so the freeze still catches genuinely new
// simple animals. They are queued for the basic mob refactor like the rest.
// VOIDCREW EDIT START: unit_tests retains the existing mining fauna during basic-mob migration.
- /mob/living/simple_animal/hostile/asteroid/hermit,
- /mob/living/simple_animal/hostile/asteroid/hermit/ranged,
- /mob/living/simple_animal/hostile/asteroid/hermit/ranged/gunslinger,
- /mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter,
- /mob/living/simple_animal/hostile/asteroid/hermit/survivor,
- /mob/living/simple_animal/hostile/asteroid/hermit/survivor/random,
/mob/living/simple_animal/hostile/asteroid/old_demon,
// VOIDCREW EDIT END
/mob/living/simple_animal/hostile/asteroid/polarbear,
diff --git a/code/modules/unit_tests/surgeries.dm b/code/modules/unit_tests/surgeries.dm
index 8d2901bf77f..3af5e2df669 100644
--- a/code/modules/unit_tests/surgeries.dm
+++ b/code/modules/unit_tests/surgeries.dm
@@ -130,4 +130,14 @@
basic_brute_heal.success(user, naked_patient, BODY_ZONE_CHEST)
basic_brute_heal.success(user, clothed_patient, BODY_ZONE_CHEST)
- TEST_ASSERT(naked_patient.getBruteLoss() < clothed_patient.getBruteLoss(), "Naked patient did not heal more from wounds tending than a clothed patient")
+ // VOIDCREW EDIT CHANGE START: Voidcrew's tend wounds works through clothing (VOIDCREW EDIT REMOVAL in
+ // code/modules/surgery/healing.dm), so both heal alike. Compared as raw limb damage: the tended limb is
+ // picked at random, and limbs count less towards getBruteLoss() than the head and chest.
+ var/naked_brute = 0
+ for(var/obj/item/bodypart/part as anything in naked_patient.bodyparts)
+ naked_brute += part.brute_dam
+ var/clothed_brute = 0
+ for(var/obj/item/bodypart/part as anything in clothed_patient.bodyparts)
+ clothed_brute += part.brute_dam
+ TEST_ASSERT(abs(naked_brute - clothed_brute) < 0.5, "Tending wounds healed a clothed patient differently from a naked one ([naked_brute] vs [clothed_brute] brute left)")
+ // VOIDCREW EDIT CHANGE END
diff --git a/tgstation.dme b/tgstation.dme
index 6b0995a5b1d..a6cfdf18a82 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -6697,6 +6697,7 @@
#include "voidcrew\_DEFINES\flags.dm"
#include "voidcrew\_DEFINES\gun_feel.dm"
#include "voidcrew\_DEFINES\hud.dm"
+#include "voidcrew\_DEFINES\human_npcs.dm"
#include "voidcrew\_DEFINES\job_categories.dm"
#include "voidcrew\_DEFINES\keybindings.dm"
#include "voidcrew\_DEFINES\lich.dm"
@@ -6924,13 +6925,13 @@
#include "voidcrew\edits\modules\mob\mob.dm"
#include "voidcrew\edits\modules\mob\mob_defines.dm"
#include "voidcrew\edits\modules\mob\living\basic\lavaland\legion\spawn_legions.dm"
-#include "voidcrew\edits\modules\mob\living\basic\trooper\trooper.dm"
#include "voidcrew\edits\modules\mob\living\carbon\inventory.dm"
#include "voidcrew\edits\modules\mod\modules\modules_supply.dm"
#include "voidcrew\edits\modules\modular_computers\file_system\programs\budgetordering.dm"
#include "voidcrew\edits\modules\power\supermatter_anomalies.dm"
#include "voidcrew\edits\modules\power\turbine\turbine.dm"
#include "voidcrew\edits\modules\projectiles\boxes_magazines\_box_magazine.dm"
+#include "voidcrew\edits\modules\projectiles\projectile_npc_allies.dm"
#include "voidcrew\edits\modules\projectiles\projectile\beams.dm"
#include "voidcrew\edits\modules\research\designs.dm"
#include "voidcrew\edits\modules\research\designs\comp_board_designs.dm"
@@ -7060,6 +7061,7 @@
#include "voidcrew\modules\ambient_npcs\planet_peddler.dm"
#include "voidcrew\modules\ambient_npcs\planet_sites.dm"
#include "voidcrew\modules\ambient_npcs\recruit.dm"
+#include "voidcrew\modules\ambient_npcs\rescue_reputation.dm"
#include "voidcrew\modules\ambient_npcs\stranded.dm"
#include "voidcrew\modules\ambient_npcs\stranded_lifeboat.dm"
#include "voidcrew\modules\anomalies\core_rewards.dm"
@@ -7102,6 +7104,7 @@
#include "voidcrew\modules\bounties\bounty_activities.dm"
#include "voidcrew\modules\bounties\bounty_admin.dm"
#include "voidcrew\modules\bounties\bounty_ai.dm"
+#include "voidcrew\modules\bounties\bounty_ai_human.dm"
#include "voidcrew\modules\bounties\bounty_ai_meek.dm"
#include "voidcrew\modules\bounties\bounty_ai_normal.dm"
#include "voidcrew\modules\bounties\bounty_board.dm"
@@ -7116,10 +7119,13 @@
#include "voidcrew\modules\bounties\bounty_lair_maps.dm"
#include "voidcrew\modules\bounties\bounty_lair_types.dm"
#include "voidcrew\modules\bounties\bounty_looks.dm"
+#include "voidcrew\modules\bounties\bounty_outfits.dm"
#include "voidcrew\modules\bounties\bounty_outpost.dm"
#include "voidcrew\modules\bounties\bounty_placement.dm"
#include "voidcrew\modules\bounties\bounty_posting.dm"
#include "voidcrew\modules\bounties\bounty_restraints.dm"
+#include "voidcrew\modules\bounties\bounty_styles.dm"
+#include "voidcrew\modules\bounties\bounty_suits.dm"
#include "voidcrew\modules\bounties\bounty_turn_in.dm"
#include "voidcrew\modules\bounties\bounty_types.dm"
#include "voidcrew\modules\bounties\bounty_weapons.dm"
@@ -7251,6 +7257,24 @@
#include "voidcrew\modules\gun_feel\npc_blood.dm"
#include "voidcrew\modules\gun_feel\sounds.dm"
#include "voidcrew\modules\holopads\ship_holocall.dm"
+#include "voidcrew\modules\human_npcs\human_npc.dm"
+#include "voidcrew\modules\human_npcs\human_npc_admin.dm"
+#include "voidcrew\modules\human_npcs\human_npc_ai.dm"
+#include "voidcrew\modules\human_npcs\human_npc_barks.dm"
+#include "voidcrew\modules\human_npcs\human_npc_combat_sense.dm"
+#include "voidcrew\modules\human_npcs\human_npc_gear.dm"
+#include "voidcrew\modules\human_npcs\human_npc_outfits.dm"
+#include "voidcrew\modules\human_npcs\human_npc_outfits_pirates.dm"
+#include "voidcrew\modules\human_npcs\human_npc_samples.dm"
+#include "voidcrew\modules\human_npcs\human_npc_soft_crit.dm"
+#include "voidcrew\modules\human_npcs\human_npc_spawning.dm"
+#include "voidcrew\modules\human_npcs\human_npc_spike_harness.dm"
+#include "voidcrew\modules\human_npcs\human_npc_states.dm"
+#include "voidcrew\modules\human_npcs\human_npc_surrender.dm"
+#include "voidcrew\modules\human_npcs\ruins\ruin_npc_base.dm"
+#include "voidcrew\modules\human_npcs\ruins\ruin_npc_hermits.dm"
+#include "voidcrew\modules\human_npcs\ruins\ruin_npc_spawners.dm"
+#include "voidcrew\modules\human_npcs\ruins\ruin_npc_troopers.dm"
#include "voidcrew\modules\hyperviolence\_core.dm"
#include "voidcrew\modules\hyperviolence\blood\_blood_defines.dm"
#include "voidcrew\modules\hyperviolence\blood\blood_pools.dm"
@@ -7314,6 +7338,7 @@
#include "voidcrew\modules\loot\loot_guns.dm"
#include "voidcrew\modules\loot\zone_loot.dm"
#include "voidcrew\modules\loot\zone_mobs.dm"
+#include "voidcrew\modules\loot\zone_mobs_arrival.dm"
#include "voidcrew\modules\loot\zone_resolution.dm"
#include "voidcrew\modules\loot\themes\_theme.dm"
#include "voidcrew\modules\loot\themes\armory.dm"
@@ -7401,7 +7426,6 @@
#include "voidcrew\modules\mob\living\simple_animal\hostile\hivebot.dm"
#include "voidcrew\modules\mob\living\simple_animal\hostile\killertomato.dm"
#include "voidcrew\modules\mob\living\simple_animal\hostile\mushroom.dm"
-#include "voidcrew\modules\mob\living\simple_animal\hostile\pirate.dm"
#include "voidcrew\modules\mob\living\simple_animal\hostile\wumborian_fugu.dm"
#include "voidcrew\modules\mob\living\simple_animal\hostile\jungle\mega_arachnid.dm"
#include "voidcrew\modules\mob\living\simple_animal\hostile\mining_mobs\basilisk.dm"
@@ -7410,7 +7434,6 @@
#include "voidcrew\modules\mob\living\simple_animal\hostile\mining_mobs\ice_demon.dm"
#include "voidcrew\modules\mob\living\simple_animal\hostile\mining_mobs\polarbear.dm"
#include "voidcrew\modules\mob\living\simple_animal\hostile\mining_mobs\wolf.dm"
-#include "voidcrew\modules\mob\living\simple_animal\hostile\wasteland\hermits.dm"
#include "voidcrew\modules\mob\living\simple_animal\slime\slime.dm"
#include "voidcrew\modules\mob_spawn\corpses\wasteland_corpses.dm"
#include "voidcrew\modules\mob_spawn\ghost_roles\skeleton_roles.dm"
@@ -7462,6 +7485,8 @@
#include "voidcrew\modules\npc_ships\code\overmap_pathfinding.dm"
#include "voidcrew\modules\npc_ships\code\pirate_crew.dm"
#include "voidcrew\modules\npc_ships\code\pirate_crew_ai.dm"
+#include "voidcrew\modules\npc_ships\code\pirate_crew_combat_sense.dm"
+#include "voidcrew\modules\npc_ships\code\pirate_crew_human.dm"
#include "voidcrew\modules\npc_ships\code\pirate_guns.dm"
#include "voidcrew\modules\npc_ships\code\ship_key.dm"
#include "voidcrew\modules\npc_ships\code\spawner_subsystem.dm"
@@ -7473,6 +7498,7 @@
#include "voidcrew\modules\npc_ships\code\faction_pirates\faction_pirate_bosses.dm"
#include "voidcrew\modules\npc_ships\code\faction_pirates\faction_pirate_corpses.dm"
#include "voidcrew\modules\npc_ships\code\faction_pirates\faction_pirate_equipment.dm"
+#include "voidcrew\modules\npc_ships\code\faction_pirates\faction_pirate_humans.dm"
#include "voidcrew\modules\npc_ships\code\faction_pirates\faction_pirate_mobs.dm"
#include "voidcrew\modules\npc_ships\code\faction_pirates\faction_pirate_ships.dm"
#include "voidcrew\modules\npc_ships\code\faction_pirates\nt_patrol.dm"
@@ -7562,6 +7588,7 @@
#include "voidcrew\modules\player_outposts\outpost_prison_ambience.dm"
#include "voidcrew\modules\player_outposts\outpost_prison_boss_moves.dm"
#include "voidcrew\modules\player_outposts\outpost_prison_bounty.dm"
+#include "voidcrew\modules\player_outposts\outpost_prison_breach.dm"
#include "voidcrew\modules\player_outposts\outpost_prison_breakout.dm"
#include "voidcrew\modules\player_outposts\outpost_prison_capture.dm"
#include "voidcrew\modules\player_outposts\outpost_prison_changeling.dm"
@@ -7573,10 +7600,12 @@
#include "voidcrew\modules\player_outposts\outpost_prison_dialogue.dm"
#include "voidcrew\modules\player_outposts\outpost_prison_doors.dm"
#include "voidcrew\modules\player_outposts\outpost_prison_economy.dm"
+#include "voidcrew\modules\player_outposts\outpost_prison_experiment_forms.dm"
#include "voidcrew\modules\player_outposts\outpost_prison_experiments.dm"
#include "voidcrew\modules\player_outposts\outpost_prison_extension.dm"
#include "voidcrew\modules\player_outposts\outpost_prison_extras.dm"
#include "voidcrew\modules\player_outposts\outpost_prison_fixtures.dm"
+#include "voidcrew\modules\player_outposts\outpost_prison_guard_combat_sense.dm"
#include "voidcrew\modules\player_outposts\outpost_prison_guard_routine.dm"
#include "voidcrew\modules\player_outposts\outpost_prison_guards.dm"
#include "voidcrew\modules\player_outposts\outpost_prison_horror.dm"
@@ -7584,6 +7613,7 @@
#include "voidcrew\modules\player_outposts\outpost_prison_leads.dm"
#include "voidcrew\modules\player_outposts\outpost_prison_life.dm"
#include "voidcrew\modules\player_outposts\outpost_prison_mail.dm"
+#include "voidcrew\modules\player_outposts\outpost_prison_npc_bodies.dm"
#include "voidcrew\modules\player_outposts\outpost_prison_panic.dm"
#include "voidcrew\modules\player_outposts\outpost_prison_pastimes.dm"
#include "voidcrew\modules\player_outposts\outpost_prison_prisoner.dm"
diff --git a/voidcrew/_DEFINES/ambient_npcs.dm b/voidcrew/_DEFINES/ambient_npcs.dm
index 96b157d6c1e..39afd5ce9f0 100644
--- a/voidcrew/_DEFINES/ambient_npcs.dm
+++ b/voidcrew/_DEFINES/ambient_npcs.dm
@@ -12,6 +12,10 @@
/// Trait source for everything the core puts on an ambient NPC
#define AMBIENT_NPC_TRAIT "ambient_npc"
+/// On an item an ambient NPC holds only for show (a mop, a parcel): it goes when they put it away
+#define TRAIT_AMBIENT_PROP "ambient_prop"
+/// Units poured into an ambient NPC's glass
+#define AMBIENT_DRINK_POUR 30
// ===== SUBSYSTEM =====
@@ -24,8 +28,8 @@
#define AMBIENT_OUTPOST_TRANSIENT_CAP 8
/// While players are on a concourse, someone steps off the lift at most this often (to replace someone who left)
#define AMBIENT_OUTPOST_ARRIVAL_EVERY (10 SECONDS)
-/// People made in place at the trader outposts per tick of SSambient_npcs, all outposts together
-#define AMBIENT_OUTPOST_SETTLE_PER_FIRE 2
+/// People made in place at the trader outposts per tick of SSambient_npcs, all outposts together. One: a human body costs about 11 ms to build.
+#define AMBIENT_OUTPOST_SETTLE_PER_FIRE 1
/// Nobody is made in place until this long after the round starts, out of its busiest moments
#define AMBIENT_OUTPOST_SETTLE_DELAY (20 SECONDS)
/// Random tiles tried when looking for somewhere to make someone, or to set them going
@@ -41,7 +45,7 @@
#define AMBIENT_OUTPOST_KILLED_SLOT_TIME (20 MINUTES)
/// Most cash the people of one trader outpost drop when killed, all of them together, in a round
#define AMBIENT_OUTPOST_CASH_CAP 300
-/// A body at a trader outpost is taken away this long after death while players are there; at once when nobody is
+/// A body at a trader outpost may be taken away this long after death, once nobody is near it (SShuman_npcs corpse rules)
#define AMBIENT_OUTPOST_BODY_TIME (5 MINUTES)
// ===== DEATH =====
@@ -88,9 +92,7 @@
#define AMBIENT_SITE_EDGE_MARGIN 5
/// Random turfs tried when looking for a site's spot
#define AMBIENT_SITE_SPOT_TRIES 60
-/// A planet NPC's health is scaled by band at the spawn site, never on the type
-#define AMBIENT_HEALTH_MULT_YELLOW 1.25
-#define AMBIENT_HEALTH_MULT_RED 1.5
+// No health multipliers by band: planet NPCs get tougher through the kit their outfit tables give them.
/// A site whose NPCs are not out right now; they come back on the next visit
#define AMBIENT_SITE_DORMANT "dormant"
@@ -111,6 +113,13 @@
#define AMBIENT_RECRUITS_PENDING_PER_SHIP 1
/// Strays one ship may take aboard in a round
#define AMBIENT_RECRUITS_PER_SHIP_ROUND 2
+/// A rescued stray's thank-you gifts, after the one they give on coming aboard, come this far apart...
+#define AMBIENT_STRAY_GIFT_LOW (75 MINUTES)
+#define AMBIENT_STRAY_GIFT_HIGH (120 MINUTES)
+/// ...and stop after this many
+#define AMBIENT_STRAY_GIFTS_MAX 3
+/// With no crew about when one is due, they look again this much later
+#define AMBIENT_STRAY_GIFT_RETRY (3 MINUTES)
// ===== DIALOGUE (2.3) =====
diff --git a/voidcrew/_DEFINES/bounties.dm b/voidcrew/_DEFINES/bounties.dm
index e4413b2c683..7eb625ce9a0 100644
--- a/voidcrew/_DEFINES/bounties.dm
+++ b/voidcrew/_DEFINES/bounties.dm
@@ -28,12 +28,14 @@
#define BOUNTY_ARCHETYPE_BOSS "boss"
// ===== FIGHTING STYLES =====
-// A normal criminal fights in one of the first six; a meek one always carries the holdout.
+// A normal criminal fights in one of the first eight; a meek one always carries the holdout.
#define BOUNTY_STYLE_BRAWLER "brawler"
#define BOUNTY_STYLE_KNIFE "knife"
#define BOUNTY_STYLE_PISTOL "pistol"
#define BOUNTY_STYLE_SHOTGUN "shotgun"
+#define BOUNTY_STYLE_SMG "smg"
+#define BOUNTY_STYLE_REVOLVER "revolver"
#define BOUNTY_STYLE_CLUB "club"
#define BOUNTY_STYLE_BOTTLE "bottle"
#define BOUNTY_STYLE_HOLDOUT "holdout"
@@ -70,10 +72,10 @@
// What capture_state() (P2) returns, listed in the order it checks them. The pad pays by these (P5).
#define BOUNTY_STATE_DEAD "dead"
-/// At or below the downed line, cuffed or not
+/// In crit (tg's TRAIT_CRITICAL_CONDITION, soft or hard), cuffed or not
#define BOUNTY_STATE_DOWNED "downed"
#define BOUNTY_STATE_RESTRAINED "restrained"
-/// Stamina crit, knocked down, paralysed, or surrendered (TRAIT_BOUNTY_SURRENDERED)
+/// Stamina crit, knocked down, stunned, paralysed (tg's *surrender too), unconscious or asleep
#define BOUNTY_STATE_STUNNED "stunned"
/// Standing and free: the pad refuses it
#define BOUNTY_STATE_FREE "free"
@@ -117,14 +119,12 @@
/// Trait source for everything the bounty packages put on a mob
#define BOUNTY_TRAIT "bounty"
-/// A normal criminal has given up (P3): it can't attack, and capture_state() (P2) reads it as BOUNTY_STATE_STUNNED
-#define TRAIT_BOUNTY_SURRENDERED "bounty_surrendered"
// ===== SIGNALS =====
-/// Sent by P2 on a criminal when its health falls to the downed line: ()
+/// Sent by P2 on a criminal when it goes into tg's crit (soft or hard): ()
#define COMSIG_BOUNTY_CRIMINAL_DOWNED "bounty_criminal_downed"
-/// Sent by P2 on a criminal when it gets back up after the recovery time: ()
+/// Sent by P2 on a criminal when it comes out of crit, or gets up from stamina crit: ()
#define COMSIG_BOUNTY_CRIMINAL_RECOVERED "bounty_criminal_recovered"
/// Sent by P2 on a criminal when restraints go on: (mob/user)
#define COMSIG_BOUNTY_CRIMINAL_RESTRAINED "bounty_criminal_restrained"
diff --git a/voidcrew/_DEFINES/bounty_ai.dm b/voidcrew/_DEFINES/bounty_ai.dm
index 9aa30f159d7..ed0c93adcae 100644
--- a/voidcrew/_DEFINES/bounty_ai.dm
+++ b/voidcrew/_DEFINES/bounty_ai.dm
@@ -1,24 +1,9 @@
// # Bounty hunting: criminal AI defines
//
// Owner: P3 AI (voidcrew/modules/bounties/bounty_ai.dm, bounty_ai_meek.dm, bounty_ai_normal.dm,
-// bounty_activities.dm, bounty_companions.dm). Only P3 edits this file. The shared enums are in
-// bounties.dm. The numbers come from balance/combat.md section 6 and spec section 12.3 (C4, C6,
-// C7); the rest are the spec's section 3 values.
-
-// ===== TRAITS =====
-
-// P2 declares these two in bounty_criminals.dm with the same values. The guarded copies here let this
-// package build on its own; once both are merged, these can go.
-#ifndef TRAIT_BOUNTY_SPRINTING
-/// A meek criminal running flat out, not winded, cornered or aiming. P2's projectile dodge reads it.
-#define TRAIT_BOUNTY_SPRINTING "bounty_sprinting"
-#endif
-#ifndef TRAIT_BOUNTY_HELD
-/// Restrained or downed (P2): the AI plans nothing
-#define TRAIT_BOUNTY_HELD "bounty_held"
-#endif
-/// Trait source for what the criminal AI puts on a mob (TRAIT_BOUNTY_SPRINTING)
-#define BOUNTY_AI_TRAIT "bounty_ai"
+// bounty_styles.dm, bounty_activities.dm, bounty_companions.dm). Only P3 edits this file. The shared
+// enums are in bounties.dm. Criminals and companions are real human bodies (voidcrew/modules/human_npcs/):
+// nothing here sets health, stamina or speed. A pace is only a walk or a run (ai_set_pace()).
// ===== WHAT THEY ARE DOING =====
@@ -37,7 +22,7 @@
/// In a locker or a crate
#define BOUNTY_HIDE_CONTAINER "container"
-/// Passing as a potted plant
+/// Holding up a potted plant (tg's own disguise: the plant's tactical component)
#define BOUNTY_HIDE_PLANT "plant"
/// Standing still on a dark tile
#define BOUNTY_HIDE_DARK "dark"
@@ -52,18 +37,27 @@
#define BB_BOUNTY_LEADER "bb_bounty_leader"
/// Their fighting style's key (BOUNTY_STYLE_*)
#define BB_BOUNTY_STYLE "bb_bounty_style"
-/// The real item they fight with (a typepath: bounty_real_weapon()), or null for bare fists
-#define BB_BOUNTY_WEAPON "bb_bounty_weapon"
-/// Rounds left in the magazine
-#define BB_BOUNTY_AMMO "bb_bounty_ammo"
-/// world.time a reload ends
-#define BB_BOUNTY_RELOAD_UNTIL "bb_bounty_reload_until"
/// world.time the current wind-up ends
#define BB_BOUNTY_WINDUP_UNTIL "bb_bounty_windup_until"
-/// world.time of the last shot
+/// world.time the current wind-up began
+#define BB_BOUNTY_WINDUP_FROM "bb_bounty_windup_from"
+/// Their stamina loss when the wind-up began: more by the end of it and they fumble
+#define BB_BOUNTY_WINDUP_STAMINA "bb_bounty_windup_stamina"
+/// world.time they last took a hit
+#define BB_BOUNTY_HIT_AT "bb_bounty_hit_at"
+/// world.time of the last shot or throw
#define BB_BOUNTY_LAST_SHOT "bb_bounty_last_shot"
+/// world.time they may next pull the trigger or throw
+#define BB_BOUNTY_NEXT_SHOT "bb_bounty_next_shot"
/// world.time a ranged fighter may next step back from someone too close
#define BB_BOUNTY_BACKSTEP_AT "bb_bounty_backstep_at"
+/// Trigger pulls still to come in the burst under way (a burst is that many separate pulls, bounty_styles.dm)
+#define BB_BOUNTY_BURST_LEFT "bb_bounty_burst_left"
+/// world.time their style's gun last came out of its holster, off their back or out of a bag (the draw)
+#define BB_BOUNTY_DRAWN_AT "bb_bounty_drawn_at"
+/// Shots fired in the pistol's current string, and the magazine they came from (a new one starts the count again)
+#define BB_BOUNTY_STRING_SHOTS "bb_bounty_string_shots"
+#define BB_BOUNTY_STRING_MAGAZINE "bb_bounty_string_magazine"
// ===== ACTIVITY STEPS =====
@@ -76,8 +70,11 @@
// ===== SHARED =====
-/// Speed while going about their business, and while blended in (the fugitive and every decoy move alike)
+/// The pace while going about their business, and while blended in (the fugitive and every decoy walk
+/// alike). Anything quicker than this is a run (ai_set_pace()).
#define BOUNTY_CALM_SPEED 2.5
+/// The pace of anyone running: running, as a person runs. There is no faster sprint.
+#define BOUNTY_RUN_SPEED 1.5
/// How often they look around for hunters
#define BOUNTY_NOTICE_INTERVAL (0.5 SECONDS)
/// Held items at least this strong count as a weapon drawn
@@ -96,29 +93,23 @@
#define BOUNTY_ACTIVITY_RANGE 8
/// How far exploring looks for things to look at
#define BOUNTY_EXPLORE_RANGE 10
-/// Glasses a criminal leaves on tables at the bar before a finished glass just goes
+/// Glasses a criminal leaves about at the bar (on a table or the floor) before a finished glass just goes
#define BOUNTY_BAR_GLASSES_MAX 2
+/// Drunk this much (tg's drunkenness), they nurse their drink instead of drinking it
+#define BOUNTY_BAR_SOBER_LIMIT 30
/// Spots an activity remembers as out of reach
#define BOUNTY_FAILED_SPOTS_MAX 8
/// How long a trader outpost's public floor is reused between its patrons before it is worked out again
#define BOUNTY_OUTPOST_FLOOR_CACHE (1 MINUTES)
+/// A wind-up left this long past its end is stale: the next shot telegraphs again
+#define BOUNTY_WINDUP_STALE (1 SECONDS)
+/// After a fumble, this long before they try again
+#define BOUNTY_FUMBLE_PAUSE (1 SECONDS)
// ===== MEEK (combat.md 6.1, spec C6) =====
-/// Speed while sprinting: the tg trooper's, faster than a running person (1.5)
-#define BOUNTY_MEEK_SPRINT_SPEED 1.1
-/// A lizard sprints a little faster (spec section 2)
-#define BOUNTY_MEEK_LIZARD_SPRINT_BONUS 0.1
-/// Speed while winded: clearly slower than a runner
-#define BOUNTY_MEEK_WINDED_SPEED 2.2
-/// How long they sprint before they are winded
-#define BOUNTY_MEEK_SPRINT_TIME (8 SECONDS)
-/// Resting still, the sprint comes back in this long
-#define BOUNTY_MEEK_REST_TIME (8 SECONDS)
-/// Sprint back per second spent hidden (full in about 5 s)
-#define BOUNTY_MEEK_RECOVER_HIDDEN 1.5
-/// Sprint back per second spent unseen but not hidden
-#define BOUNTY_MEEK_RECOVER_WALKING 0.3
+/// Stamina loss at which tg's own slowdown starts (human updatehealth(): 40): they are winded
+#define BOUNTY_MEEK_WINDED_STAMINA 40
/// Someone armed, cuffs or a warrant in hand this close is noticed
#define BOUNTY_MEEK_NOTICE_RANGE 6
/// Someone running straight at them this close is noticed
@@ -149,7 +140,7 @@
#define BOUNTY_MEEK_CORNERED_TIME (0.8 SECONDS)
/// The aim before the shots: the telegraph
#define BOUNTY_MEEK_PISTOL_WINDUP (0.5 SECONDS)
-/// Shots in the holdout's volley, a magazine at most
+/// Trigger pulls in the holdout's volley, a magazine at most
#define BOUNTY_MEEK_PISTOL_SHOTS 8
/// Between them
#define BOUNTY_MEEK_PISTOL_GAP (0.2 SECONDS)
@@ -169,9 +160,6 @@
// ===== NORMAL (combat.md 6.2, spec C7) =====
-/// Speed in a fight, by style
-#define BOUNTY_NORMAL_SPEED_MELEE 1.25
-#define BOUNTY_NORMAL_SPEED_RANGED 1.4
/// Noticed at this range (someone armed, cuffs or a warrant in hand)
#define BOUNTY_NORMAL_NOTICE_RANGE 6
/// Someone with a weapon drawn this close, while they are aware of them, starts the fight
@@ -180,22 +168,21 @@
#define BOUNTY_NORMAL_AWARE_FORGET (15 SECONDS)
/// Fighting, but nobody on the grudge list seen for this long: the fight is over
#define BOUNTY_NORMAL_CALM_AFTER (30 SECONDS)
-/// Share of max health at or below which they may give up
+/// Surrender (defaults CR-10, /datum/human_npc_surrender/bounty): at or below this share of health,
#define BOUNTY_SURRENDER_BELOW 0.4
-/// Percent chance on the hit that crosses the line
+/// a percent chance on the first roll of a fight,
#define BOUNTY_SURRENDER_CHANCE 60
-/// Less for each companion still standing
+/// less this for each companion still standing,
#define BOUNTY_SURRENDER_PER_COMPANION 20
-/// Percent chance on later hits
+/// then this on later rolls,
#define BOUNTY_SURRENDER_RETRY 25
-/// At most this often
+/// at most this often,
#define BOUNTY_SURRENDER_RETRY_GAP (5 SECONDS)
-/// Hunters needed around them
+/// with this many hunters around them,
#define BOUNTY_SURRENDER_HUNTERS 2
-/// Within this range, in view
+/// within this range, in view
#define BOUNTY_SURRENDER_HUNTER_RANGE 7
-/// Below this share of health with no hunter near, they break off and retreat. The spec's 25% is the
-/// downed line, so a standing criminal is never below it; the surrender line is used instead.
+/// Below this share of health with no hunter near, they break off and retreat
#define BOUNTY_NORMAL_RETREAT_BELOW 0.4
/// How far they try to get away when retreating
#define BOUNTY_NORMAL_RETREAT_DISTANCE 10
@@ -204,58 +191,71 @@
#define BOUNTY_COMPANIONS_MIN 0
#define BOUNTY_COMPANIONS_MAX 2
-/// Health before the style's multiplier
-#define BOUNTY_COMPANION_HEALTH 110
/// Below this share of health a companion may run (a BOUNTY_COMPANION_FLEE_CHANCE roll, once)
#define BOUNTY_COMPANION_FLEE_BELOW 0.3
#define BOUNTY_COMPANION_FLEE_CHANCE 50
+/// Up from a stamina crit with hunters around: the chance a companion gives up rather than runs
+#define BOUNTY_COMPANION_GIVE_UP_CHANCE 50
/// How far a companion keeps from its criminal while nothing is happening
#define BOUNTY_COMPANION_FOLLOW 2
/// How often a companion calls the rest of the gang in (the trooper's 30 s)
#define BOUNTY_REINFORCE_COOLDOWN (30 SECONDS)
-// ===== STYLES (combat.md 6.2) =====
-// Every blow and shot is the real weapon's (bounty_weapons.dm): the item in their hand is each
-// style's held_look, and a Wanted criminal carries its heavy_look where it has one.
+// ===== STYLES (combat.md 6.2, bounty_styles.dm) =====
+// Every style is a real item the fighter carries and draws: blows and shots are the item's own, through
+// the fighter's hands. These only set the timing: how often they pull the trigger or throw, the
+// telegraph, and the distance they keep.
-#define BOUNTY_BRAWLER_HEALTH 1.2
-#define BOUNTY_BRAWLER_STAMINA 0.8
-#define BOUNTY_BRAWLER_INTERVAL (1 SECONDS)
-/// Chance a punch shoves the target back a tile and staggers them for a second
+/// Chance a brawler's blow is a real shove instead of a punch
#define BOUNTY_BRAWLER_SHOVE_CHANCE 20
-#define BOUNTY_BRAWLER_STAGGER (1 SECONDS)
-#define BOUNTY_KNIFE_HEALTH 1
-#define BOUNTY_KNIFE_INTERVAL (0.8 SECONDS)
+/// Getting a holstered or slung gun out at the start of a fight: the line, then at least this long before the first shot
+#define BOUNTY_DRAW_TIME (0.6 SECONDS)
+/// A burst whose next pull is this late was cut off (the AI stopped meanwhile): what is left of it never fires
+#define BOUNTY_BURST_STALE (0.5 SECONDS)
-#define BOUNTY_PISTOL_HEALTH 0.9
-#define BOUNTY_PISTOL_INTERVAL (0.25 SECONDS)
+/// Between trigger pulls: the Stechkin set to single shots with its own fire selector, twice a second
+#define BOUNTY_PISTOL_INTERVAL (0.5 SECONDS)
+/// Every bounty pistol (criminals, companions, the kingpin's goons, Club Volga's mobsters and the don) fires strings of this many shots...
+#define BOUNTY_PISTOL_STRING_SHOTS 6
+/// ...with this pause on top of the interval before the next string. A reload after an empty magazine is separate.
+#define BOUNTY_PISTOL_STRING_PAUSE (1.5 SECONDS)
/// Keeps about this far away
#define BOUNTY_PISTOL_RANGE 5
#define BOUNTY_PISTOL_MIN_RANGE 3
-/// The reload: the window to close in
-#define BOUNTY_PISTOL_RELOAD (2 SECONDS)
/// Raising the gun before the first shot of a string
#define BOUNTY_PISTOL_WINDUP (0.2 SECONDS)
/// Shots further apart than this start a new string
#define BOUNTY_PISTOL_STRING_GAP (3 SECONDS)
-#define BOUNTY_SHOTGUN_HEALTH 1
+/// The WT-550 at every tier: a burst is this many trigger pulls...
+#define BOUNTY_SMG_BURST 4
+/// ...this far apart, the gun's own full-auto rate
+#define BOUNTY_SMG_BURST_GAP (0.3 SECONDS)
+/// From a burst's last round to the next burst's spin-up
+#define BOUNTY_SMG_INTERVAL (0.5 SECONDS)
+/// The gun brought up level before each burst
+#define BOUNTY_SMG_WINDUP (0.3 SECONDS)
+#define BOUNTY_SMG_MIN_RANGE 2
+
+/// A .38 revolver: one heavy shot a second, six in the cylinder, a speedloader to reload
+#define BOUNTY_REVOLVER_INTERVAL (1 SECONDS)
+#define BOUNTY_REVOLVER_MIN_RANGE 3
+/// The hammer thumbed back before the first shot of a string
+#define BOUNTY_REVOLVER_WINDUP (0.3 SECONDS)
+
#define BOUNTY_SHOTGUN_INTERVAL (1.2 SECONDS)
#define BOUNTY_SHOTGUN_RANGE 2
/// The pump before each blast
#define BOUNTY_SHOTGUN_WINDUP (0.3 SECONDS)
-/// Loading the tube again: the window to close in
-#define BOUNTY_SHOTGUN_RELOAD (3 SECONDS)
-
-#define BOUNTY_CLUB_HEALTH 1.1
-#define BOUNTY_CLUB_INTERVAL (1.1 SECONDS)
+/// Spare shells on the bandolier
+#define BOUNTY_SHOTGUN_SHELLS 8
-#define BOUNTY_BOTTLE_HEALTH 0.9
#define BOUNTY_BOTTLE_INTERVAL (1.2 SECONDS)
#define BOUNTY_BOTTLE_RANGE 4
#define BOUNTY_BOTTLE_MIN_RANGE 2
-/// Tiles a bottle flies
-#define BOUNTY_BOTTLE_REACH 6
/// The throwing arc before each throw
#define BOUNTY_BOTTLE_WINDUP (0.3 SECONDS)
+/// Bottles in the bag, by tier: Petty, and above
+#define BOUNTY_BOTTLES_PETTY 4
+#define BOUNTY_BOTTLES_WANTED 6
diff --git a/voidcrew/_DEFINES/bounty_bosses.dm b/voidcrew/_DEFINES/bounty_bosses.dm
index 67ac1ea79c1..b647004b3fd 100644
--- a/voidcrew/_DEFINES/bounty_bosses.dm
+++ b/voidcrew/_DEFINES/bounty_bosses.dm
@@ -1,30 +1,32 @@
// # Bounty hunting: mini-boss defines
//
// Owner: P4 bosses (voidcrew/modules/bounties/bounty_boss.dm, bounty_boss_kits.dm). Only P4 edits
-// this file. The shared enums are in bounties.dm. The numbers are the combat balance review's
+// this file. The shared enums are in bounties.dm. The ability numbers are the combat balance review's
// (balance/combat.md section 6.3, folded into spec.md 12.3 C8). A number marked (P4) is not in the
-// review and was picked by P4.
+// review and was picked by P4; one marked (phase D) came with the move to real human bodies and is a
+// starting value for the balance pass (defaults 1.16).
+//
+// A boss is a real human (voidcrew/modules/human_npcs/): its health, stamina and stuns are tg's. There
+// are no health tables, stamina pools or damage coefficients here, and there must never be.
// ===== COMMON RULES =====
-/// Percent of max health at or below which a boss is tired: stamina works fully, it slows, its cooldowns stretch, and it can be stunned
-#define BOUNTY_BOSS_TIRED_BELOW 40
-/// Stamina damage coefficient while fresh (the Heavy's is BOUNTY_HEAVY_STAMINA_FRESH). 0 after review H3: combat.md's 0.2 only slowed a fresh boss under steady disabler fire and pre-loaded its pool, so capture took one hit instead of five.
-#define BOUNTY_BOSS_STAMINA_FRESH 0
-/// Stamina damage coefficient once tired
-#define BOUNTY_BOSS_STAMINA_TIRED 1
-/// Stamina damage it takes to stamina-crit a tired boss (the Heavy's is BOUNTY_HEAVY_STAMINA), counted from zero when it tires. max_stamina stays P2's 100 because of the stamcrit removal quirk; the pool is folded into the coefficient instead.
-#define BOUNTY_BOSS_STAMINA 150
+/// Brute and burn a boss takes, as a multiple of a person's, through its physiology (npc_damage_taken, defaults 1.5). Its armour does the rest. (phase D)
+#define BOUNTY_BOSS_DAMAGE_TAKEN 0.6
+/// Its combat stimulant: one at the start of a fight, a second for its second wind (defaults 1.6, CR-4). Ephedrine: baton resistance, speed and quicker recovery from stuns, never immunity, so a crew can still stun and cuff a worn-out boss. (phase D)
+#define BOUNTY_BOSS_STIMULANT /obj/item/reagent_containers/hypospray/medipen/stimpack
+/// How many of BOUNTY_BOSS_STIMULANT it carries. (phase D)
+#define BOUNTY_BOSS_STIMULANTS 2
+/// Worn out: stamina loss over this share of its max stamina... (phase D, CB-2)
+#define BOUNTY_BOSS_WORN_OUT_STAMINA 0.5
+/// ...or health under this share of its max health. (phase D, CB-2)
+#define BOUNTY_BOSS_WORN_OUT_HEALTH 0.4
+/// Worn out, it falls back from its target this long before its second wind. (phase D)
+#define BOUNTY_BOSS_FALLBACK_TIME (8 SECONDS)
/// Below this pressure (kPa) on either side, a wall, window or door is not interior (P4)
#define BOUNTY_BOSS_INTERIOR_MIN_PRESSURE 20
/// More than this pressure difference (kPa) between its sides, and a wall, window or door is not interior (P4)
#define BOUNTY_BOSS_INTERIOR_MAX_PRESSURE_GAP 50
-/// A dodge or miss message is shown at most this often (P4)
-#define BOUNTY_BOSS_MESSAGE_COOLDOWN (1 SECONDS)
-/// How much slower a tired boss moves
-#define BOUNTY_BOSS_TIRED_SLOWDOWN 0.3
-/// Ability cooldowns are this much longer while tired (P4: the spec says "longer" and gives no number)
-#define BOUNTY_BOSS_TIRED_COOLDOWN_MULT 1.5
/// Pause after one ability before the next may start, so telegraphs never overlap
#define BOUNTY_BOSS_ABILITY_GAP_MIN (1 SECONDS)
#define BOUNTY_BOSS_ABILITY_GAP_MAX (2 SECONDS)
@@ -45,6 +47,19 @@
/// A hunter who hit the boss this recently is its first choice of target (P4)
#define BOUNTY_BOSS_REVENGE_TIME (10 SECONDS)
+// ===== THE POSSE (OC-8): ONE MORE COMPANION PER EXTRA HUNTER =====
+
+/// Most companions a posse brings in for one boss (four or more hunters). (phase D)
+#define BOUNTY_BOSS_REINFORCEMENTS_MAX 3
+/// Time between two companions coming in, and between tries to find a spot out of view. (phase D)
+#define BOUNTY_BOSS_REINFORCE_DELAY (6 SECONDS)
+/// A companion comes in at least this far from the boss... (phase D)
+#define BOUNTY_BOSS_REINFORCE_MIN_DIST 5
+/// ...and no further than this. (phase D)
+#define BOUNTY_BOSS_REINFORCE_MAX_DIST 14
+/// A spot any player within this many tiles can see is in view. (phase D)
+#define BOUNTY_BOSS_REINFORCE_SIGHT 13
+
// ===== SUMMONED THINGS: CAPS AND LIFETIMES (P4) =====
/// Fire pools (flamer floors and molotovs) burning at once, server-wide
@@ -57,22 +72,11 @@
#define BOUNTY_BOSS_BARRICADES_PER_BOSS 2
/// How long a Heavy barricade stands before it folds away
#define BOUNTY_BOSS_BARRICADE_LIFE (90 SECONDS)
+/// Fire stacks (tg's) a boss's burning floor adds every second to anyone standing in it. (phase D, CB-8)
+#define BOUNTY_BOSS_FIRE_TICK_STACKS 1
// ===== JUGGERNAUT =====
-/// Health for 1, 2, 3 and 4+ engaged hunters
-#define BOUNTY_JUGGERNAUT_HEALTH_1 300
-#define BOUNTY_JUGGERNAUT_HEALTH_2 950
-#define BOUNTY_JUGGERNAUT_HEALTH_3 1600
-#define BOUNTY_JUGGERNAUT_HEALTH_4 2300
-#define BOUNTY_JUGGERNAUT_BRUTE_MOD 0.7
-#define BOUNTY_JUGGERNAUT_BURN_MOD 0.8
-#define BOUNTY_JUGGERNAUT_SPEED 1.9
-/// Its fists
-#define BOUNTY_JUGGERNAUT_MELEE_MIN 20
-#define BOUNTY_JUGGERNAUT_MELEE_MAX 26
-#define BOUNTY_JUGGERNAUT_MELEE_AP 15
-#define BOUNTY_JUGGERNAUT_MELEE_COOLDOWN (1.1 SECONDS)
/// Charge: a roar, a stamp and a cracked-floor line
#define BOUNTY_JUGGERNAUT_CHARGE_WINDUP (0.8 SECONDS)
#define BOUNTY_JUGGERNAUT_CHARGE_COOLDOWN (8 SECONDS)
@@ -82,11 +86,15 @@
#define BOUNTY_JUGGERNAUT_CHARGE_STEP 1
#define BOUNTY_JUGGERNAUT_CHARGE_DAMAGE 25
#define BOUNTY_JUGGERNAUT_CHARGE_KNOCKDOWN (2 SECONDS)
+/// Armour penetration of the charge
+#define BOUNTY_JUGGERNAUT_CHARGE_AP 15
/// Percent chance that someone else in the way is caught too
#define BOUNTY_JUGGERNAUT_CHARGE_BYSTANDER 25
-/// Charged into something it can't break: it stands reeling this long, taking more damage
-#define BOUNTY_JUGGERNAUT_WALL_STAGGER (2 SECONDS)
-#define BOUNTY_JUGGERNAUT_WALL_VULNERABLE 1.25
+/// Charged into something it can't break: brute to its head through its helmet, stamina, a moment's paralysis and a knockdown, as tg's tackle splat does (CB-6). (phase D)
+#define BOUNTY_JUGGERNAUT_WALL_BRUTE 15
+#define BOUNTY_JUGGERNAUT_WALL_STAMINA 30
+#define BOUNTY_JUGGERNAUT_WALL_PARALYZE (1 SECONDS)
+#define BOUNTY_JUGGERNAUT_WALL_KNOCKDOWN (3 SECONDS)
/// Slam: both fists up, a red ring
#define BOUNTY_JUGGERNAUT_SLAM_WINDUP (0.7 SECONDS)
#define BOUNTY_JUGGERNAUT_SLAM_COOLDOWN (7 SECONDS)
@@ -95,19 +103,8 @@
// ===== PYROMANIAC =====
-#define BOUNTY_PYROMANIAC_HEALTH_1 580
-#define BOUNTY_PYROMANIAC_HEALTH_2 1300
-#define BOUNTY_PYROMANIAC_HEALTH_3 1950
-#define BOUNTY_PYROMANIAC_HEALTH_4 2550
-/// Fireproof, not laser-proof: fire and heat can't hurt it, and lasers (BURN) hit it at this
-#define BOUNTY_PYROMANIAC_BRUTE_MOD 0.9
-#define BOUNTY_PYROMANIAC_BURN_MOD 0.9
-#define BOUNTY_PYROMANIAC_SPEED 1.8
-/// Its torch: burn damage
-#define BOUNTY_PYROMANIAC_MELEE_MIN 10
-#define BOUNTY_PYROMANIAC_MELEE_MAX 14
-#define BOUNTY_PYROMANIAC_MELEE_AP 15
-#define BOUNTY_PYROMANIAC_MELEE_COOLDOWN (1 SECONDS)
+/// Its torch: lit, and it never goes out (a real tg torch, held from the start: it doesn't holster)
+#define BOUNTY_PYROMANIAC_TORCH /obj/item/flashlight/flare/torch/everburning
/// Flamer: a pilot light hiss, an orange cone
#define BOUNTY_PYROMANIAC_FLAMER_WINDUP (0.5 SECONDS)
#define BOUNTY_PYROMANIAC_FLAMER_COOLDOWN (5 SECONDS)
@@ -115,6 +112,8 @@
/// Full width of the cone, in degrees
#define BOUNTY_PYROMANIAC_FLAMER_ARC 90
#define BOUNTY_PYROMANIAC_FLAMER_DAMAGE 18
+/// Fire stacks (tg's) the jet puts on anyone in the cone. (phase D, CB-8)
+#define BOUNTY_PYROMANIAC_FLAMER_STACKS 4
/// How long the floor the cone covered keeps burning
#define BOUNTY_PYROMANIAC_FLAMER_FLOOR (4 SECONDS)
/// Molotov: a lit rag, the throw, a ring where it lands
@@ -122,23 +121,14 @@
#define BOUNTY_PYROMANIAC_MOLOTOV_COOLDOWN (7 SECONDS)
#define BOUNTY_PYROMANIAC_MOLOTOV_RANGE 7
#define BOUNTY_PYROMANIAC_MOLOTOV_DAMAGE 10
+/// Fire stacks (tg's) the bursting bottle puts on anyone it splashes. (phase D, CB-8)
+#define BOUNTY_PYROMANIAC_MOLOTOV_STACKS 3
#define BOUNTY_PYROMANIAC_MOLOTOV_POOL (8 SECONDS)
-/// Set alight by a boss's fire: burn damage every second for this long, renewed while standing in the flames
-#define BOUNTY_BOSS_BURNING_TIME (4 SECONDS)
-#define BOUNTY_BOSS_BURNING_DAMAGE 3
// ===== DEMOLITIONIST =====
-#define BOUNTY_DEMOLITIONIST_HEALTH_1 870
-#define BOUNTY_DEMOLITIONIST_HEALTH_2 1750
-#define BOUNTY_DEMOLITIONIST_HEALTH_3 2300
-#define BOUNTY_DEMOLITIONIST_HEALTH_4 2850
-#define BOUNTY_DEMOLITIONIST_BRUTE_MOD 0.85
-#define BOUNTY_DEMOLITIONIST_BURN_MOD 0.85
-#define BOUNTY_DEMOLITIONIST_SPEED 1.7
-/// Its crowbar: the look in its hand and every number of its blows (bounty_real_weapon())
-#define BOUNTY_DEMOLITIONIST_CROWBAR /obj/item/crowbar/red
-#define BOUNTY_DEMOLITIONIST_MELEE_COOLDOWN (1 SECONDS)
+/// Its crowbar: carried in its bag until the fight starts
+#define BOUNTY_DEMOLITIONIST_CROWBAR /obj/item/crowbar/large
/// It keeps this far from its target unless someone is right on it
#define BOUNTY_DEMOLITIONIST_KEEP_MIN 4
#define BOUNTY_DEMOLITIONIST_KEEP_MAX 6
@@ -148,9 +138,8 @@
#define BOUNTY_DEMOLITIONIST_GRENADE_COOLDOWN (4 SECONDS)
#define BOUNTY_DEMOLITIONIST_GRENADE_RANGE 8
#define BOUNTY_DEMOLITIONIST_GRENADE_RADIUS 2
-/// Brute to anyone caught, against bomb armour
+/// Damage to a mech's hull it catches, against bomb armour. People in the ring take tg's light explosion (CB-10).
#define BOUNTY_DEMOLITIONIST_GRENADE_DAMAGE 35
-#define BOUNTY_DEMOLITIONIST_GRENADE_KNOCKDOWN (1 SECONDS)
/// Damage to structures within BOUNTY_DEMOLITIONIST_GRENADE_OBJECT_RADIUS
#define BOUNTY_DEMOLITIONIST_GRENADE_OBJECT_DAMAGE 60
#define BOUNTY_DEMOLITIONIST_GRENADE_OBJECT_RADIUS 1
@@ -160,79 +149,54 @@
#define BOUNTY_DEMOLITIONIST_BREACH_WINDUP (0.6 SECONDS)
#define BOUNTY_DEMOLITIONIST_BREACH_FUSE (5 SECONDS)
#define BOUNTY_DEMOLITIONIST_BREACH_COOLDOWN (18 SECONDS)
+/// Damage to a mech's hull beside the charge. People beside it take tg's light explosion (CB-10).
#define BOUNTY_DEMOLITIONIST_BREACH_DAMAGE 25
/// It breaches toward a target it can't see within this range
#define BOUNTY_DEMOLITIONIST_BREACH_RANGE 8
// ===== GHOST =====
-#define BOUNTY_GHOST_HEALTH_1 250
-#define BOUNTY_GHOST_HEALTH_2 850
-#define BOUNTY_GHOST_HEALTH_3 1700
-#define BOUNTY_GHOST_HEALTH_4 2450
-#define BOUNTY_GHOST_BRUTE_MOD 1
-#define BOUNTY_GHOST_BURN_MOD 1
-#define BOUNTY_GHOST_SPEED 1.2
-/// Its blade: the look in its hand and every number of its blows (bounty_real_weapon())
+/// Its blade: a real combat knife, carried in a pocket until the fight starts, and every cut it lands is the knife's (CB-9)
#define BOUNTY_GHOST_KNIFE /obj/item/knife/combat
-#define BOUNTY_GHOST_MELEE_COOLDOWN (0.7 SECONDS)
-/// Each cut bleeds this much brute a second for BOUNTY_GHOST_BLEED_TIME, up to BOUNTY_GHOST_BLEED_CAP a second
-#define BOUNTY_GHOST_BLEED_PER_CUT 1
-#define BOUNTY_GHOST_BLEED_CAP 2
-#define BOUNTY_GHOST_BLEED_TIME (12 SECONDS)
-/// Dash: a blur line to the target
+/// Dash: a blur line to the target, the Cascade lattice firing as it goes (OC-6 ruling)
#define BOUNTY_GHOST_DASH_WINDUP (0.3 SECONDS)
#define BOUNTY_GHOST_DASH_COOLDOWN (5 SECONDS)
#define BOUNTY_GHOST_DASH_RANGE 5
-/// The dash's cut, its biggest hit (P4: combat.md B4 asks for the dash to be the biggest hit), and its armour penetration
-#define BOUNTY_GHOST_DASH_DAMAGE 20
-#define BOUNTY_GHOST_DASH_AP 10
-/// Cloak: a shimmer, then a faint distortion
+/// Cloak: a shimmer, then a faint distortion. Only how it looks: nothing misses it for it (OC-6 ruling, CB-12)
#define BOUNTY_GHOST_CLOAK_WINDUP (0.3 SECONDS)
#define BOUNTY_GHOST_CLOAK_TIME (6 SECONDS)
#define BOUNTY_GHOST_CLOAK_COOLDOWN (12 SECONDS)
#define BOUNTY_GHOST_CLOAK_ALPHA 50
-/// Percent of hits that miss it while it is cloaked
-#define BOUNTY_GHOST_CLOAK_MISS 50
-/// Percent of projectiles it dodges while moving
-#define BOUNTY_GHOST_DODGE 30
-/// It counts as moving for this long after a step
-#define BOUNTY_GHOST_MOVING_WINDOW (1 SECONDS)
/// Hit and run: after this many cuts it breaks off for a while
#define BOUNTY_GHOST_CUTS_BEFORE_BREAKOFF 2
#define BOUNTY_GHOST_BREAKOFF_TIME (4 SECONDS)
// ===== HEAVY =====
-#define BOUNTY_HEAVY_HEALTH_1 340
-#define BOUNTY_HEAVY_HEALTH_2 970
-#define BOUNTY_HEAVY_HEALTH_3 1400
-#define BOUNTY_HEAVY_HEALTH_4 1850
-#define BOUNTY_HEAVY_BRUTE_MOD 0.55
-#define BOUNTY_HEAVY_BURN_MOD 0.65
-#define BOUNTY_HEAVY_SPEED 2.2
-/// 0 after review H3, as BOUNTY_BOSS_STAMINA_FRESH (combat.md had 0.15)
-#define BOUNTY_HEAVY_STAMINA_FRESH 0
-#define BOUNTY_HEAVY_STAMINA 180
-/// Its belt-fed gun: the look in its hand, the rounds of its burst and the blow of its butt (bounty_real_weapon())
-#define BOUNTY_HEAVY_GUN /obj/item/gun/ballistic/automatic/l6_saw
-#define BOUNTY_HEAVY_MELEE_COOLDOWN (1.1 SECONDS)
+/// Its belt-fed gun: a real L6 held from the start (it has no sling, so it never holsters), with a real spare box (CB-13)
+#define BOUNTY_HEAVY_GUN /obj/item/gun/ballistic/automatic/l6_saw/unrestricted
+/// Its spare box magazine
+#define BOUNTY_HEAVY_SPARE_AMMO /obj/item/ammo_box/magazine/m7mm
/// Suppressive burst: a spin-up whirr, a laser sight and a red cone
#define BOUNTY_HEAVY_BURST_WINDUP (0.7 SECONDS)
#define BOUNTY_HEAVY_BURST_COOLDOWN (4 SECONDS)
#define BOUNTY_HEAVY_BURST_RANGE 8
#define BOUNTY_HEAVY_BURST_SHOTS 10
-/// How long the burst takes to fire
-#define BOUNTY_HEAVY_BURST_TIME (1.5 SECONDS)
+/// How long the burst takes to fire. Each pull is a click, at least 2 deciseconds apart (a mob clicks once a decisecond at most). (phase D)
+#define BOUNTY_HEAVY_BURST_TIME (2 SECONDS)
/// Full width of the cone the rounds go into, in degrees
#define BOUNTY_HEAVY_BURST_ARC 30
/// Extra width, in degrees, of the cone marked on the floor, so edge tiles a round can cross are marked too (P4)
#define BOUNTY_HEAVY_BURST_MARK_MARGIN 10
-/// The rounds' damage to windows, grilles, tables and barricades it may break, as a share of their damage (none to anything else)
-#define BOUNTY_HEAVY_BURST_DEMOLITION 0.25
-/// Barricade: tg's security barrier, dropped in front of it
+/// A hit of at least this much damage while it aims makes it fumble the burst. (phase D, CB-13)
+#define BOUNTY_HEAVY_FUMBLE_DAMAGE 8
+/// Barricade: a real barrier grenade, thrown in front of it (CB-26)
#define BOUNTY_HEAVY_BARRICADE_WINDUP (0.6 SECONDS)
#define BOUNTY_HEAVY_BARRICADE_COOLDOWN (20 SECONDS)
+/// Barrier grenades it carries. (phase D)
+#define BOUNTY_HEAVY_BARRIERS 2
+/// Its barrier grenades' fuse, set short. (phase D)
+#define BOUNTY_HEAVY_BARRIER_FUSE (1 SECONDS)
/// Percent of projectiles that pass its barricade (combat.md's number; tg's barrier lets 20 through)
#define BOUNTY_HEAVY_BARRICADE_PASS 50
@@ -246,3 +210,7 @@
#define BB_BOUNTY_BOSS_PREY "BB_bounty_boss_prey"
/// world.time it looks for prey again
#define BB_BOUNTY_BOSS_HUNT_AT "BB_bounty_boss_hunt_at"
+/// Who it falls back from while worn out
+#define BB_BOUNTY_BOSS_FALL_BACK_FROM "BB_bounty_boss_fall_back_from"
+/// world.time a Heavy's belt change in progress gives up
+#define BB_BOUNTY_BOSS_RELOAD_UNTIL "BB_bounty_boss_reload_until"
diff --git a/voidcrew/_DEFINES/bounty_criminals.dm b/voidcrew/_DEFINES/bounty_criminals.dm
index e3e81d76cb4..bf663b5999e 100644
--- a/voidcrew/_DEFINES/bounty_criminals.dm
+++ b/voidcrew/_DEFINES/bounty_criminals.dm
@@ -1,137 +1,22 @@
// # Bounty hunting: criminal body defines
//
-// Owner: P2 body (voidcrew/modules/bounties/bounty_criminal.dm, bounty_restraints.dm). Only P2 edits
-// this file. The shared enums are in bounties.dm. The numbers are balance/combat.md section 6, as
-// consolidated in spec.md section 12.3 (C1-C9).
+// Owner: P2 body (voidcrew/modules/bounties/bounty_criminal.dm, bounty_restraints.dm, bounty_outfits.dm,
+// bounty_ai_human.dm). Only P2 edits this file. The shared enums are in bounties.dm.
+//
+// A criminal is a real human NPC (human NPC migration, phase D): its health, stamina, crit, cuffs and
+// breakout times are tg's, so there are no health pools, stamina pools, downed lines, recovery timers
+// or slip times here, and there must never be.
//
// Unit tests compile before voidcrew/_DEFINES and cannot see these: a test uses the literal value,
// with a comment naming the define.
// ===== TRAITS =====
-/**
- * On a criminal while it is restrained or downed: its AI must plan nothing. P3's controller can
- * check it in its first subtree. P2 also adds TRAIT_AI_PAUSED under BOUNTY_BODY_HELD_TRAIT at the
- * same time, which stops the controller outright.
- */
-#define TRAIT_BOUNTY_HELD "bounty_held"
-/// A meek criminal sprinting, and neither winded nor cornered: P3 adds and removes it (source BOUNTY_TRAIT). P2 dodges projectiles while it is on (BOUNTY_MEEK_DODGE).
-#define TRAIT_BOUNTY_SPRINTING "bounty_sprinting"
-/**
- * A script is walking the criminal somewhere on purpose (a walk-out, a cutscene): the leash lets its
- * steps through. Godmode counts the same, which covers P6's walk out to the hangar lift.
- */
+/// A script is walking the criminal somewhere on purpose (a cutscene): the leash lets its steps through. Walking out (npc_walk_out()) counts the same.
#define TRAIT_BOUNTY_SCRIPTED_MOVE "bounty_scripted_move"
-/// Trait source for what the body always has (no teleports, no mob swaps)
+/// Trait source for what the body always has (no teleports, no mob swaps). A convict a crew talks down loses them.
#define BOUNTY_BODY_TRAIT "bounty_body"
-/// Trait source for being downed: floored, incapacitated, immobilized
-#define BOUNTY_BODY_DOWNED_TRAIT "bounty_body_downed"
-/// Trait source for the restraints holding a criminal still
-#define BOUNTY_BODY_CUFFS_TRAIT "bounty_body_cuffs"
-/// Trait source for TRAIT_BOUNTY_HELD and TRAIT_AI_PAUSED while restrained or downed
-#define BOUNTY_BODY_HELD_TRAIT "bounty_body_held"
-
-// ===== BODY =====
-
-/// sentience_type of every criminal: no sentience potion, no ghost role
-#define BOUNTY_CRIMINAL_NO_SENTIENCE 0
-
-/// Health of a meek criminal, every tier
-#define BOUNTY_MEEK_HEALTH 120
-/// Health of a normal criminal by tier, before the style's multiplier (C7)
-#define BOUNTY_NORMAL_HEALTH_PETTY 140
-#define BOUNTY_NORMAL_HEALTH_WANTED 180
-#define BOUNTY_NORMAL_HEALTH_MOST 220
-/// P0's name for the normal criminal's health: the Wanted value
-#define BOUNTY_NORMAL_HEALTH BOUNTY_NORMAL_HEALTH_WANTED
-
-/// Health multiplier by fighting style (combat.md 6.2)
-#define BOUNTY_STYLE_HEALTH_BRAWLER 1.2
-#define BOUNTY_STYLE_HEALTH_KNIFE 1
-#define BOUNTY_STYLE_HEALTH_PISTOL 0.9
-#define BOUNTY_STYLE_HEALTH_SHOTGUN 1
-#define BOUNTY_STYLE_HEALTH_CLUB 1.1
-#define BOUNTY_STYLE_HEALTH_BOTTLE 0.9
-/// A brawler takes stamina damage x this
-#define BOUNTY_STYLE_STAMINA_BRAWLER 0.8
-
-/// Fire and heat (L3): a criminal on fire, or hotter than this, burns like a suited person, BOUNTY_CRIMINAL_BURN_DAMAGE a second. The mercy line and the automated floor still hold it. Mini-bosses keep P4's own fire rules.
-#define BOUNTY_CRIMINAL_MAX_TEMP SPACE_SUIT_MAX_TEMP_PROTECT
-#define BOUNTY_CRIMINAL_BURN_DAMAGE 3
-
-/// An explosion counts as a player's when the explosive was last touched by one, or someone with a mind stands within this many tiles
-#define BOUNTY_EXPLOSION_WITNESS_RANGE 7
-
-/// Pace of a meek criminal: its sprint (P3 slows it while winded)
-#define BOUNTY_BODY_MEEK_SPEED 1.1
-/// Pace of a normal criminal with a melee style, and with a ranged one (pistol, bottle)
-#define BOUNTY_BODY_NORMAL_SPEED_MELEE 1.25
-#define BOUNTY_BODY_NORMAL_SPEED_RANGED 1.4
-
-// ===== STAMINA =====
-// max_stamina stays at 100 on every criminal: basic mobs leave stamina crit by comparing raw stamina
-// with a percentage (stamcrit.dm), which only agree at 100. A pool of any other size is the stamina
-// damage coefficient: 100 / pool.
-
-#define BOUNTY_CRIMINAL_MAX_STAMINA 100
-/// Stamina crit at this much stamina: a hair under 100, so a pool that divides evenly (three 30-point disabler shots on a 90 pool) still crits through float rounding
-#define BOUNTY_CRIMINAL_STAMCRIT_AT 99.9
-/// A meek criminal's stamina pool: three disabler shots or two batons (C5)
-#define BOUNTY_MEEK_STAMINA 90
-/// A meek criminal's slowdown with no stamina left (tg's is 3): one hit must not end the chase (C5)
-#define BOUNTY_MEEK_STAMINA_SLOWDOWN 0.5
-/// How long stamina crit lasts after the last stamina hit: meek (C5), and everyone else (tg's default, as simulated)
-#define BOUNTY_MEEK_STAMCRIT_TIME (12 SECONDS)
-#define BOUNTY_NORMAL_STAMCRIT_TIME (10 SECONDS)
-/// P0's name for the stamina crit time
-#define BOUNTY_STAMCRIT_TIME BOUNTY_NORMAL_STAMCRIT_TIME
-/// P0's names for the stamina coefficients. The pool sets the real one (100 / pool); these stay 1.
-#define BOUNTY_MEEK_STAMINA_COEFF 1
-#define BOUNTY_NORMAL_STAMINA_COEFF 1
-
-/// Percent of projectiles a sprinting meek criminal ducks (C5)
-#define BOUNTY_MEEK_DODGE 50
-/// No ducking within this long of being shot
-#define BOUNTY_MEEK_DODGE_AFTER_HIT (1 SECONDS)
-
-// ===== DOWNED AND RECOVERY (C1, C3) =====
-
-/// Percent of max health at or below which a criminal is downed
-#define BOUNTY_DOWNED_BELOW 25
-/// P0's name for the downed line, as a fraction
-#define BOUNTY_DOWNED_FRACTION (BOUNTY_DOWNED_BELOW / 100)
-/// Percent of max health a downed criminal gets up with (more if it was healed while down)
-#define BOUNTY_RECOVER_TO 35
-/// How long a downed, uncuffed criminal stays down, by archetype
-#define BOUNTY_RECOVER_TIME_MEEK (60 SECONDS)
-#define BOUNTY_RECOVER_TIME_NORMAL (75 SECONDS)
-#define BOUNTY_RECOVER_TIME_BOSS (45 SECONDS)
-/// The last stretch of the recovery, when it groans and tries to rise
-#define BOUNTY_BODY_STIRRING_TELL (10 SECONDS)
-/// A mini-boss that gets up shrugs off stamina for this long (C1); P4 shows it
-#define BOUNTY_BODY_RALLY_TIME (20 SECONDS)
-
-// ===== AUTOMATED DAMAGE (AR-D3) =====
-
-/// On its site, damage with nobody's mind behind it (turrets, traps, fire, fauna) stops at this percent of max health
-#define BOUNTY_AUTOMATED_FLOOR 40
-
-// ===== RESTRAINTS (C2) =====
-
-/// Putting restraints on a downed, stunned or surrendered criminal
-#define BOUNTY_CUFF_TIME (2 SECONDS)
-/// Taking them off
-#define BOUNTY_UNCUFF_TIME (2 SECONDS)
-/// Cable restraints and zipties slip after this long; handcuffs never do
-#define BOUNTY_CABLE_SLIP (3 MINUTES)
-#define BOUNTY_ZIPTIE_SLIP (5 MINUTES)
-/// Joke cuffs and zipties
-#define BOUNTY_FAKE_CUFF_SLIP (5 SECONDS)
-/// A mini-boss gets out of cable and zipties in this share of the time (combat.md 6.4)
-#define BOUNTY_BOSS_SLIP_MULT 0.5
-/// The visible struggle starts this long before they slip
-#define BOUNTY_SLIP_WARNING (20 SECONDS)
// ===== LEASH AND TARGETS (AR-D1, AR-D2) =====
@@ -141,3 +26,28 @@
#define BOUNTY_BODY_FALLBACK_LEASH 40
/// Most mobs a criminal remembers as fair game; the oldest go first
#define BOUNTY_GRUDGE_MAX 12
+
+// ===== CUFFS, TOUGHNESS, SELF-TREATMENT =====
+
+/// A criminal answers a reach for its wrists this long after tg's cuffing starts: a person's reaction, and inside tg's 4 second do_after, so stepping away breaks it
+#define BOUNTY_CUFF_REACTION_DELAY (0.5 SECONDS)
+/// Sent on a criminal when someone starts putting cuffs on it, before its own reaction: (mob/living/user). Return COMPONENT_BOUNTY_CUFF_HANDLED to take the reaction over.
+#define COMSIG_BOUNTY_CUFF_REACHED "bounty_cuff_reached"
+ #define COMPONENT_BOUNTY_CUFF_HANDLED (1<<0)
+/// A cuffed criminal that started working at its cuffs this recently and then lost them got itself out
+#define BOUNTY_SELF_FREED_WINDOW (2 MINUTES)
+/// Brute and burn a criminal takes, as a multiple of a person's (physiology, npc_damage_taken), by tier. Armour does the rest.
+#define BOUNTY_TOUGHNESS_PETTY 1
+#define BOUNTY_TOUGHNESS_WANTED 0.9
+#define BOUNTY_TOUGHNESS_MOST_WANTED 0.8
+/// A bounty NPC treats itself when its health is at or below this share of its max, with nothing it can see attacking it
+#define BOUNTY_TREAT_SELF_BELOW 0.7
+/// Between two goes at treating itself
+#define BOUNTY_TREAT_SELF_COOLDOWN (20 SECONDS)
+/// Blackboard key: the medical stack it is using on itself has been clicked on it once this go (bounty_ai_human.dm)
+#define BB_BOUNTY_TREAT_APPLIED "bounty_treat_applied"
+
+// ===== SUITS (bounty_suits.dm) =====
+
+/// Open tiles of a planet site, picked at random, whose air is read when a criminal is made there: any one that would hurt a person dresses it for that
+#define BOUNTY_SITE_AIR_SAMPLES 6
diff --git a/voidcrew/_DEFINES/bounty_kingpin.dm b/voidcrew/_DEFINES/bounty_kingpin.dm
index 5ebae7d5de0..e87faf04ce7 100644
--- a/voidcrew/_DEFINES/bounty_kingpin.dm
+++ b/voidcrew/_DEFINES/bounty_kingpin.dm
@@ -23,16 +23,11 @@
// ===== HIS BODY =====
-#define BOUNTY_KINGPIN_HEALTH 200
-/// Stamina damage that stamcrits him: 5 disabler hits in 10 seconds, or 3 baton hits
-#define BOUNTY_KINGPIN_STAMINA 150
-/// Downed to up, uncuffed (the 10 s stirring tell is P2's, inside this)
-#define BOUNTY_KINGPIN_RECOVERY (60 SECONDS)
-/// After he gets up: stamina does nothing to him and he won't surrender (combat.md 5.6)
-#define BOUNTY_KINGPIN_RALLY (20 SECONDS)
-/// Below this percent of his health, with his crew down, he may surrender
+/// Brute and burn he takes, as a multiple of a person's (the human NPC base's npc_damage_taken, boss rank). His armoured coat does the rest.
+#define BOUNTY_KINGPIN_DAMAGE_TAKEN 0.6
+/// At or below this percent of his health, with his crew down and a hunter in sight, he may give up
#define BOUNTY_KINGPIN_SURRENDER_BELOW 40
-/// Percent chance on the hit that crosses the line, and on each later hit
+/// Percent chance on his first roll, and on each later one
#define BOUNTY_KINGPIN_SURRENDER_FIRST 60
#define BOUNTY_KINGPIN_SURRENDER_LATER 25
/// At most one surrender roll per this
@@ -40,13 +35,14 @@
// ===== HIS REVOLVER =====
-/// The revolver in his hand: its look, its rounds and its cylinder (bounty_real_weapon())
+/// The revolver he carries in his holster: a real .357, drawn when the guns come out
#define BOUNTY_KINGPIN_REVOLVER /obj/item/gun/ballistic/revolver
+/// His spare rounds: real .357 speedloaders, two in the holster and one in a pocket
+#define BOUNTY_KINGPIN_SPEEDLOADER /obj/item/ammo_box/a357
/// The aim line before each shot; he never fires without it
#define BOUNTY_KINGPIN_REVOLVER_AIM (0.5 SECONDS)
/// From one aim to the next
#define BOUNTY_KINGPIN_REVOLVER_COOLDOWN (1.2 SECONDS)
-#define BOUNTY_KINGPIN_REVOLVER_RELOAD (3 SECONDS)
// ===== THE SHOOTOUT =====
@@ -75,53 +71,48 @@
/// A fixed crew of six (kingpin.md 3.4), one per map post
#define BOUNTY_KINGPIN_GOONS 6
-#define BOUNTY_GOON_HEALTH 150
-/// A goon's stamina pool, the way P2 sets a criminal's: max_stamina 100, with a coefficient of 100 / BOUNTY_GOON_HEALTH, so 5 disabler hits stamcrit him. tg's basic mobs compare raw points with this percentage when the crit ends, so it must be 100.
-#define BOUNTY_GOON_MAX_STAMINA 100
-/// Percent of it that stamcrits him. Just under 100, for float rounding.
-#define BOUNTY_GOON_STAMCRIT_AT 99.9
#define BOUNTY_GOON_WEAPON_PISTOL "pistol"
#define BOUNTY_GOON_WEAPON_SMG "smg"
#define BOUNTY_GOON_WEAPON_SHOTGUN "shotgun"
-/// The guns in the goons' hands: their looks, their rounds and their magazines (bounty_real_weapon())
+/// The real guns the goons carry, and their real spares
#define BOUNTY_GOON_PISTOL_GUN /obj/item/gun/ballistic/automatic/pistol/aps
+#define BOUNTY_GOON_PISTOL_MAG /obj/item/ammo_box/magazine/m9mm_aps
#define BOUNTY_GOON_SMG_GUN /obj/item/gun/ballistic/automatic/mini_uzi
-#define BOUNTY_GOON_SHOTGUN_GUN /obj/item/gun/ballistic/shotgun/automatic/combat
-/// What the shotguns are loaded with
+#define BOUNTY_GOON_SMG_MAG /obj/item/ammo_box/magazine/uzim9mm
+/// The combat shotgun, its tube loaded with buckshot (bounty_kingpin.dm)
+#define BOUNTY_GOON_SHOTGUN_GUN /obj/item/gun/ballistic/shotgun/automatic/combat/bounty_kingpin
+/// What the shotguns are loaded with, and the loose shells a shotgun goon carries in his bandolier
#define BOUNTY_GOON_SHOTGUN_AMMO /obj/item/ammo_casing/shotgun/buckshot
+#define BOUNTY_GOON_SHOTGUN_SHELLS 8
-#define BOUNTY_GOON_PISTOL_COOLDOWN (0.3 SECONDS)
-#define BOUNTY_GOON_PISTOL_RELOAD (2 SECONDS)
+/// Between two trigger pulls of a goon's pistol: the Stechkin set to single shots with its own selector, in strings of
+/// BOUNTY_PISTOL_STRING_SHOTS with BOUNTY_PISTOL_STRING_PAUSE on top between them, as every bounty pistol fires
+#define BOUNTY_GOON_PISTOL_COOLDOWN (0.5 SECONDS)
-/// Shots in a burst, and the gap between them
-#define BOUNTY_GOON_SMG_BURST 5
-#define BOUNTY_GOON_SMG_BURST_GAP (0.1 SECONDS)
+/// Trigger pulls in a burst (each pull is the Uzi's own two-round burst), and the gap between them
+#define BOUNTY_GOON_SMG_BURST 2
+#define BOUNTY_GOON_SMG_BURST_GAP (0.3 SECONDS)
/// The spin-up: the gun comes up level, with a sound
#define BOUNTY_GOON_SMG_WINDUP (0.3 SECONDS)
#define BOUNTY_GOON_SMG_COOLDOWN (1 SECONDS)
-#define BOUNTY_GOON_SMG_RELOAD (2.5 SECONDS)
/// Tiles: he walks in to this before he fires
#define BOUNTY_GOON_SHOTGUN_RANGE 2
/// The pump before each blast
#define BOUNTY_GOON_SHOTGUN_WINDUP (0.3 SECONDS)
#define BOUNTY_GOON_SHOTGUN_COOLDOWN (1.2 SECONDS)
-#define BOUNTY_GOON_SHOTGUN_RELOAD (3 SECONDS)
-/// Tiles from the sofa a goon ever walks
+/// Tiles from the sofa a goon ever walks while his crew holds the lounge
#define BOUNTY_GOON_LEASH 7
-/// Percent of the goons left who flee when he falls (downed, cuffed, surrendered or dead)
+/// Percent of the goons left who run when he falls (in crit, cuffed, given up or dead)
#define BOUNTY_GOON_FLEE_ON_BOSS 50
-/// A fleeing goon is gone after this
-#define BOUNTY_GOON_FLEE_TIME (6 SECONDS)
-/// A goon's body fades after this (the outpost never unloads)
-#define BOUNTY_GOON_FADE (60 SECONDS)
-/// How long a goon's body takes to fade, and a leaving goon to walk out
-#define BOUNTY_GOON_FADE_OUT (2 SECONDS)
-#define BOUNTY_GOON_LEAVE_TIME (5 SECONDS)
-/// Between a goon's steps in a fight
+/// The quickest a goon takes a step in a fight; his own body's slowdown (wounds, armour) can make it slower
#define BOUNTY_GOON_STEP (0.35 SECONDS)
+/// A reload by hand gives up after this: a tube is fed a shell at a time
+#define BOUNTY_KINGPIN_RELOAD_GIVE_UP (15 SECONDS)
+/// Blackboard key on him and his goons: their guns are out (the crew is drawing or fighting), so a spent gun is reloaded
+#define BB_BOUNTY_KINGPIN_ARMED "bounty_kingpin_armed"
// ===== TALKING =====
@@ -158,7 +149,7 @@
#define BOUNTY_KINGPIN_PAY_MAX 3500
/// Vouchers on a full-share turn-in; red adds BOUNTY_RED_VOUCHER_BONUS
#define BOUNTY_KINGPIN_VOUCHERS 1
-/// Wanted dead or alive: restrained, stunned or downed is alive
+/// Wanted dead or alive: alive pays in full however he is brought in (cuffed, stunned or in crit); dead pays 80%
#define BOUNTY_KINGPIN_PAY_ALIVE 100
#define BOUNTY_KINGPIN_PAY_DEAD 80
/// He goes on the board no earlier than 45 minutes into the round, and only with 3+ active ships
diff --git a/voidcrew/_DEFINES/bounty_lairs.dm b/voidcrew/_DEFINES/bounty_lairs.dm
index 1044e6fdab2..be54e560c2f 100644
--- a/voidcrew/_DEFINES/bounty_lairs.dm
+++ b/voidcrew/_DEFINES/bounty_lairs.dm
@@ -58,9 +58,12 @@
/// A second pass that keeps the goons in their rooms, once every zone_mobs marker has had time to spawn (its resolver retries for up to a minute)
#define BOUNTY_LAIR_GOON_LEASH_DELAY (65 SECONDS)
-// ===== P12 =====
+/// ===== P12 =====
// The mafia club's people (bounty_lair_mafia.dm): balance/lairs.md sections 3-5 and 10, spec section 15.
// Unit tests can't see these; they use the literal values with the define named in a comment.
+// The goons, the lieutenants and the don are real human NPCs (voidcrew/modules/human_npcs/): their health is a
+// person's, their toughness is what they wear and npc_damage_taken, and they fire the real guns in their hands.
+// Only the don's mech is a mob of its own.
/// The faction every club mob shares: goons, lieutenants, the mech and the don
#define BOUNTY_MAFIA_FACTION "bounty_mafia"
@@ -71,8 +74,10 @@
#define BOUNTY_MAFIA_BARK_COOLDOWN (12 SECONDS)
/// Chance a second, per mob, that an idle goon says something while players are about
#define BOUNTY_MAFIA_IDLE_BARK_CHANCE 1
+/// After someone starts cuffing a club member who can still move, how long before it steps away (tg's cuffing takes 4 seconds)
+#define BOUNTY_MAFIA_CUFF_REACTION (0.6 SECONDS)
-/// Sent on the mech as the don climbs out, before the mech's death: (mob/living/basic/bounty_lair_boss/mafia_don/don)
+/// Sent on the mech as the don climbs out, before the mech's death: (mob/living/carbon/human/npc/bounty_mafia/don/don)
#define COMSIG_BOUNTY_MAFIA_DON_EJECTED "bounty_mafia_don_ejected"
/// Sent on the don when his trophy drops: (obj/item/bounty_proof/trophy/mafia_don/trophy)
#define COMSIG_BOUNTY_MAFIA_TROPHY_DROPPED "bounty_mafia_trophy_dropped"
@@ -81,30 +86,30 @@
#define BB_BOUNTY_MAFIA_MOVE_TO "BB_bounty_mafia_move_to"
// ----- mobsters -----
-// Every blow and round is the real item's in their hand (bounty_real_weapon()): its look, damage and magazine.
+// A volley is one aim (if the gun has one), then VOLLEY pulls of the trigger VOLLEY_GAP apart, then a pause before
+// the next. The gun's own burst and fire rate apply to every pull: an Uzi pull is its two-round burst. A pistol's
+// volley is a string of single shots, as every bounty pistol fires: the Stechkin is set to single fire with its own
+// selector, BOUNTY_PISTOL_STRING_SHOTS shots BOUNTY_PISTOL_INTERVAL apart, then BOUNTY_PISTOL_STRING_PAUSE on top.
#define BOUNTY_MOBSTER_KNIFE /obj/item/knife/kitchen
-#define BOUNTY_MOBSTER_KNIFE_HEALTH 120
-#define BOUNTY_MOBSTER_KNIFE_COOLDOWN (0.8 SECONDS)
-#define BOUNTY_MOBSTER_KNIFE_SPEED 1.2
#define BOUNTY_MOBSTER_PISTOL_GUN /obj/item/gun/ballistic/automatic/pistol/aps
-#define BOUNTY_MOBSTER_PISTOL_HEALTH 120
-/// A pistol fires this many shots each time it fires, this far apart; a goon only decides to shoot every half second
-#define BOUNTY_MOBSTER_PISTOL_BURST 2
-#define BOUNTY_MOBSTER_PISTOL_BURST_GAP (0.25 SECONDS)
-#define BOUNTY_MOBSTER_PISTOL_COOLDOWN (0.5 SECONDS)
-#define BOUNTY_MOBSTER_PISTOL_RELOAD (2 SECONDS)
-#define BOUNTY_MOBSTER_PISTOL_SPEED 1.4
+#define BOUNTY_MOBSTER_PISTOL_MAGAZINE /obj/item/ammo_box/magazine/m9mm_aps
+#define BOUNTY_MOBSTER_PISTOL_VOLLEY BOUNTY_PISTOL_STRING_SHOTS
+#define BOUNTY_MOBSTER_PISTOL_VOLLEY_GAP BOUNTY_PISTOL_INTERVAL
+/// From a string's last shot to the next string's first
+#define BOUNTY_MOBSTER_PISTOL_STRING_PAUSE (BOUNTY_PISTOL_INTERVAL + BOUNTY_PISTOL_STRING_PAUSE)
+/// Between the human NPC base's own shots for a club member (an elite firing wild from the floor)
+#define BOUNTY_MOBSTER_PISTOL_COOLDOWN (0.8 SECONDS)
#define BOUNTY_MOBSTER_SMG_GUN /obj/item/gun/ballistic/automatic/mini_uzi
-#define BOUNTY_MOBSTER_SMG_HEALTH 150
-#define BOUNTY_MOBSTER_SMG_BURST 5
-#define BOUNTY_MOBSTER_SMG_BURST_GAP (0.1 SECONDS)
+#define BOUNTY_MOBSTER_SMG_MAGAZINE /obj/item/ammo_box/magazine/uzim9mm
+/// The SMG spins up before each volley ("aiming!"), and a hit then spoils it
#define BOUNTY_MOBSTER_SMG_WINDUP (0.3 SECONDS)
+/// Each pull is the Uzi's two-round burst
+#define BOUNTY_MOBSTER_SMG_VOLLEY 3
+#define BOUNTY_MOBSTER_SMG_VOLLEY_GAP (0.3 SECONDS)
#define BOUNTY_MOBSTER_SMG_COOLDOWN (1 SECONDS)
-#define BOUNTY_MOBSTER_SMG_RELOAD (2.5 SECONDS)
-#define BOUNTY_MOBSTER_SMG_SPEED 1.4
/// The shout before a room's first shot
#define BOUNTY_MOBSTER_ALERT (0.5 SECONDS)
@@ -125,25 +130,20 @@
// ----- lieutenants -----
+/// Both lieutenants take this much of any brute or burn, through their bodies (elite rank), on top of their armour
+#define BOUNTY_LIEUTENANT_DAMAGE_TAKEN 0.8
+
#define BOUNTY_LIEUTENANT_TOMMY_GUN /obj/item/gun/ballistic/automatic/tommygun
-#define BOUNTY_LIEUTENANT_TOMMY_HEALTH 350
-#define BOUNTY_LIEUTENANT_TOMMY_BURST 6
-#define BOUNTY_LIEUTENANT_TOMMY_BURST_GAP (0.1 SECONDS)
+#define BOUNTY_LIEUTENANT_TOMMY_MAGAZINE /obj/item/ammo_box/magazine/tommygunm45
#define BOUNTY_LIEUTENANT_TOMMY_WINDUP (0.3 SECONDS)
+/// Each pull is one round of the Thompson
+#define BOUNTY_LIEUTENANT_TOMMY_VOLLEY 6
+#define BOUNTY_LIEUTENANT_TOMMY_VOLLEY_GAP (0.1 SECONDS)
#define BOUNTY_LIEUTENANT_TOMMY_COOLDOWN (1 SECONDS)
-#define BOUNTY_LIEUTENANT_TOMMY_RELOAD (3 SECONDS)
-#define BOUNTY_LIEUTENANT_TOMMY_SPEED 1.4
-/// Brute fights with his fists: a human's punch
-#define BOUNTY_LIEUTENANT_BRUTE_HEALTH 400
-#define BOUNTY_LIEUTENANT_BRUTE_COOLDOWN (1 SECONDS)
-/// Percent chance a blow knocks the hunter down
+/// Brute fights with his fists: a person's punch. A landed punch knocks the hunter down this often (percent), for this long.
#define BOUNTY_LIEUTENANT_BRUTE_KNOCKDOWN_CHANCE 25
#define BOUNTY_LIEUTENANT_BRUTE_KNOCKDOWN (1 SECONDS)
-#define BOUNTY_LIEUTENANT_BRUTE_SPEED 1.2
-
-/// Both lieutenants take this much of any brute or burn damage
-#define BOUNTY_LIEUTENANT_DAMAGE_MOD 0.8
/// The lieutenants' names for the role var
#define BOUNTY_LIEUTENANT_TOMMY "tommy"
@@ -171,10 +171,11 @@
#define BOUNTY_MECH_STOMP_THROW 3
#define BOUNTY_MECH_STOMP_THROW_SPEED 2
-/// The lock-on: a marker under each hunter it can see, then one rocket per marker
+/// The lock-on: a marker under each hunter it can see, then one rocket per marker. Each burst is tg's light blast
+/// (ex_act(EXPLODE_LIGHT)) on everyone standing on its marker, and nothing else: no explosion(), no breach.
#define BOUNTY_MECH_ROCKET_LOCK (0.8 SECONDS)
+/// A rocket's damage to what it hits in flight in the arena (a table, a window, a door), before BOUNTY_MECH_ROCKET_DEMOLITION
#define BOUNTY_MECH_ROCKET_DAMAGE 70
-#define BOUNTY_MECH_ROCKET_KNOCKDOWN (1 SECONDS)
#define BOUNTY_MECH_ROCKET_COOLDOWN (9 SECONDS)
/// Damage a rocket does to a table, window or door it hits in the arena, as a multiple of its damage
#define BOUNTY_MECH_ROCKET_DEMOLITION 8
@@ -210,12 +211,19 @@
/// His name when his posting's record gives none: the name P10's card shows for Club Volga
#define BOUNTY_DON_NAME "Arkady Sokolov"
-/// His gold pistol: its look, its rounds and its magazine (bounty_real_weapon()); he fires strings of BOUNTY_MOBSTER_PISTOL_BURST as a goon does
+/// The don takes this much of any brute or burn, through his body (boss rank)
+#define BOUNTY_DON_DAMAGE_TAKEN 0.6
+/// His gold pistol, and the magazines he carries for it
#define BOUNTY_DON_GUN /obj/item/gun/ballistic/automatic/pistol/deagle/gold
-#define BOUNTY_DON_HEALTH 250
-#define BOUNTY_DON_COOLDOWN (0.5 SECONDS)
-#define BOUNTY_DON_RELOAD (2 SECONDS)
-/// He raises the pistol this long before each string of shots
+#define BOUNTY_DON_MAGAZINE /obj/item/ammo_box/magazine/m50
+/// He raises the pistol this long before the first string of each magazine
#define BOUNTY_DON_RAISE (0.2 SECONDS)
-#define BOUNTY_DON_SPEED 1.4
+/// Strings of single shots, as every bounty pistol fires (the gold Desert Eagle has no burst)
+#define BOUNTY_DON_VOLLEY BOUNTY_PISTOL_STRING_SHOTS
+#define BOUNTY_DON_VOLLEY_GAP BOUNTY_PISTOL_INTERVAL
+/// From a string's last shot to the next string's first
+#define BOUNTY_DON_STRING_PAUSE (BOUNTY_PISTOL_INTERVAL + BOUNTY_PISTOL_STRING_PAUSE)
+/// Between the human NPC base's own shots for him (firing wild from the floor)
+#define BOUNTY_DON_COOLDOWN (0.5 SECONDS)
+/// Climbing out of the wreck, he takes this long to get his bearings before he acts
#define BOUNTY_DON_EJECT_STAGGER (2 SECONDS)
diff --git a/voidcrew/_DEFINES/bounty_outpost.dm b/voidcrew/_DEFINES/bounty_outpost.dm
index 97017714e57..faa545816d5 100644
--- a/voidcrew/_DEFINES/bounty_outpost.dm
+++ b/voidcrew/_DEFINES/bounty_outpost.dm
@@ -17,12 +17,8 @@
#define BOUNTY_DECOY_FLEE_DISTANCE 5
/// How long a decoy keeps backing off
#define BOUNTY_DECOY_FLEE_TIME (4 SECONDS)
-/// Move delay of someone walking out to the hangar: a walk, not a run
-#define BOUNTY_OUTPOST_EXIT_DELAY 4
-/// Anyone still walking out after this fades where they are
-#define BOUNTY_OUTPOST_EXIT_TIMEOUT (45 SECONDS)
-/// How long the fade out takes
-#define BOUNTY_OUTPOST_FADE_TIME (1 SECONDS)
+// Walking out to the hangar lift is the human NPC base's npc_walk_out() (human_npc_states.dm): a walk
+// at the body's own pace, with no timeout and no fade. They leave on the lift or out of sight.
/// Trait source for everything P6 puts on a mob
#define BOUNTY_OUTPOST_TRAIT "bounty_outpost"
diff --git a/voidcrew/_DEFINES/human_npcs.dm b/voidcrew/_DEFINES/human_npcs.dm
new file mode 100644
index 00000000000..f638a23ad71
--- /dev/null
+++ b/voidcrew/_DEFINES/human_npcs.dm
@@ -0,0 +1,163 @@
+// Human NPCs: real /mob/living/carbon/human bodies driven by an AI (voidcrew/modules/human_npcs/).
+// Unit tests are included before voidcrew/_DEFINES, so nothing here is visible to them.
+
+/// Returns TRUE if `thing` is a human NPC body.
+#define ishumannpc(thing) istype(thing, /mob/living/carbon/human/npc)
+
+// npc_rank: who may land hyperviolence aimed crits and gun executions (owner decision D4).
+/// An ordinary NPC. Its hits never become aimed crits or executions.
+#define HUMAN_NPC_RANK_REGULAR 0
+/// An elite NPC. Lands aimed crits and executions the way a player does.
+#define HUMAN_NPC_RANK_ELITE 1
+/// A boss NPC. Lands aimed crits and executions the way a player does.
+#define HUMAN_NPC_RANK_BOSS 2
+
+/// On every item locked to a human NPC's body (human_npc_gear.dm).
+#define TRAIT_HUMAN_NPC_GEAR "human_npc_gear"
+/// On a consumable issued to a human NPC: it may leave the body, but never becomes loot (human_npc_gear.dm).
+#define TRAIT_HUMAN_NPC_CONSUMABLE "human_npc_consumable"
+/// On locked gear that went somewhere it may not be, and is deleted on the next tick unless it comes back.
+#define TRAIT_HUMAN_NPC_GEAR_LOST "human_npc_gear_lost"
+
+/// Default for how far a human NPC spots hostiles, in tiles (BB_AGGRO_RANGE).
+#define HUMAN_NPC_SIGHT_RANGE 9
+
+/// Human NPCs the spawn queue makes per fire of SShuman_npcs. One human costs about 11 ms to make.
+#define HUMAN_NPC_SPAWNS_PER_FIRE 1
+/// How often SShuman_npcs looks over the corpses it tracks.
+#define HUMAN_NPC_CORPSE_SWEEP_INTERVAL (30 SECONDS)
+/// Default time a human NPC corpse lies before it may be cleaned up (npc_corpse_lifetime).
+#define HUMAN_NPC_CORPSE_LIFETIME (10 MINUTES)
+/// A corpse or loose body part with a player this close is never cleaned up.
+#define HUMAN_NPC_CORPSE_WATCH_RANGE 10
+/// Corpses deleted per fire at most, so a big sweep doesn't stall a tick.
+#define HUMAN_NPC_CORPSE_DELETES_PER_FIRE 2
+
+// Blackboard keys (human_npc_ai.dm).
+/// Deciseconds between two pulls of the trigger.
+#define BB_HUMAN_NPC_SHOT_DELAY "human_npc_shot_delay"
+/// world.time the NPC may next pull the trigger.
+#define BB_HUMAN_NPC_NEXT_SHOT "human_npc_next_shot"
+/// Furthest a gunner shoots from, in tiles. Further than this it closes in.
+#define BB_HUMAN_NPC_FIRE_RANGE "human_npc_fire_range"
+/// A gunner steps back from a target closer than this, in tiles. 0 never steps back.
+#define BB_HUMAN_NPC_KEEP_AWAY "human_npc_keep_away"
+/// world.time the NPC may next try to reload or change weapons, after a try that got nowhere.
+#define BB_HUMAN_NPC_ARMING_RETRY_AT "human_npc_arming_retry_at"
+/// world.time a reload in progress gives up.
+#define BB_HUMAN_NPC_RELOAD_UNTIL "human_npc_reload_until"
+/// The item the NPC is drawing (human_npc_draw).
+#define BB_HUMAN_NPC_DRAW_ITEM "human_npc_draw_item"
+
+// ===== Phase A2: shared pieces for pirates, ruin NPCs, hermits and criminals =====
+
+// npc_target_stat: the worst state a target can be in and still get attacked (BB_TARGET_MINIMUM_STAT).
+/// Pirates, troopers, hermits, raiders, NT customs: keep shooting someone in crit, as tg troopers do.
+#define HUMAN_NPC_FINISHES_DOWNED HARD_CRIT
+/// Criminals, companions, bosses, prisoners, guards: stop once a target is in crit.
+#define HUMAN_NPC_SPARES_DOWNED CONSCIOUS
+
+// Bark kinds (human_npc_barks.dm). Families supply the lines through a /datum/human_npc_voice.
+/// Entered crit. Whispered in soft crit; hard crit gets the emote only.
+#define HUMAN_NPC_BARK_DOWNED "downed"
+/// Left crit, or got up from stamcrit.
+#define HUMAN_NPC_BARK_RECOVER "recover"
+/// Now and then while it crawls in soft crit. Falls back to the downed lines.
+#define HUMAN_NPC_BARK_PLEAD "plead"
+/// Handcuffs went on.
+#define HUMAN_NPC_BARK_CUFFED "cuffed"
+/// Started working at its cuffs (tg's cuff_resist).
+#define HUMAN_NPC_BARK_SLIPPING "slipping_cuffs"
+/// Its cuffs came off, by its own work or someone else's.
+#define HUMAN_NPC_BARK_UNCUFFED "uncuffed"
+/// Broke out of a grab or off someone's shoulders by resisting.
+#define HUMAN_NPC_BARK_PULLED_FREE "pulled_free"
+/// Gave up (human_npc_surrender.dm). Always said.
+#define HUMAN_NPC_BARK_SURRENDER "surrender"
+/// Died. Emote only: the dead don't talk.
+#define HUMAN_NPC_BARK_DEATH "death"
+/// Default seconds between two barks from one NPC.
+#define HUMAN_NPC_BARK_COOLDOWN (4 SECONDS)
+/// How often an NPC crawling in soft crit pleads, at most.
+#define HUMAN_NPC_PLEAD_INTERVAL (12 SECONDS)
+
+// Sites (human_npc_outfits.dm): what the air where an NPC is dressed asks of its kit.
+/// Too little pressure to live in: a sealed suit and helmet and its own air.
+#define HUMAN_NPC_SITE_VACUUM (1<<0)
+/// Pressure is fine but the air isn't: a mask and a tank.
+#define HUMAN_NPC_SITE_BAD_AIR (1<<1)
+/// Cold enough to freeze an unprotected person: cold-weather wear.
+#define HUMAN_NPC_SITE_COLD (1<<2)
+/// Air colder than this, in kelvin, is a cold site.
+#define HUMAN_NPC_SITE_COLD_TEMP (T0C - 10)
+/// Oxygen partial pressure below this, in kPa, is not breathable (tg's safe minimum).
+#define HUMAN_NPC_SITE_MIN_OXYGEN 16
+/// How much better than its lungs' limits (kPa) the air must be before an NPC on internals closes its valve.
+#define HUMAN_NPC_AIR_MARGIN 2
+/// A queued NPC dressed by an outfit table waits this long for its spawn zone to resolve, then takes green.
+#define HUMAN_NPC_ZONE_WAIT (60 SECONDS)
+
+// Leaving (human_npc_states.dm).
+/// How often SShuman_npcs checks whether an NPC walking out may be deleted.
+#define HUMAN_NPC_LEAVER_SWEEP_INTERVAL (1 SECONDS)
+
+// Signals sent on a human NPC.
+/// It gave up: tg's *surrender is running. ()
+#define COMSIG_HUMAN_NPC_SURRENDERED "human_npc_surrendered"
+/// Its surrender's paralysis ended and nobody had cuffed it. ()
+#define COMSIG_HUMAN_NPC_SURRENDER_ENDED "human_npc_surrender_ended"
+/// It entered crit. ()
+#define COMSIG_HUMAN_NPC_DOWNED "human_npc_downed"
+/// It left crit, or got up from stamcrit. ()
+#define COMSIG_HUMAN_NPC_RECOVERED "human_npc_recovered"
+/// It walked out and is about to be deleted (human_npc_states.dm). ()
+#define COMSIG_HUMAN_NPC_LEFT "human_npc_left"
+
+// More blackboard keys.
+/// A mob it is running from (surrender flight, soft-crit crawl).
+#define BB_HUMAN_NPC_FLEE_FROM "human_npc_flee_from"
+/// world.time it stops fleeing after deciding not to give up again.
+#define BB_HUMAN_NPC_FLEE_UNTIL "human_npc_flee_until"
+/// The item it is using on itself (human_npc_treat_self).
+#define BB_HUMAN_NPC_TREAT_ITEM "human_npc_treat_item"
+/// world.time it may next treat itself.
+#define BB_HUMAN_NPC_NEXT_TREAT "human_npc_next_treat"
+/// The turf it is walking out to (npc_walk_out()).
+#define BB_HUMAN_NPC_EXIT "human_npc_exit"
+
+// ===== Combat sense (human_npc_combat_sense.dm) =====
+// Armed hostile NPCs that opt in (npc_combat_sense) inject a stimulant they carry when they tire, and
+// stop standing in the open when they are hit by stun fire. Defaults for /datum/npc_combat_sense.
+
+/// Stamina loss, as a share of what stamcrits the body, at which it reaches for a stimulant it carries.
+#define HUMAN_NPC_SENSE_STIM_SHARE 0.5
+/// How long after its last stun hit it keeps reacting to stun fire.
+#define HUMAN_NPC_SENSE_REACT_TIME (8 SECONDS)
+/// The furthest it walks to cover, in steps.
+#define HUMAN_NPC_SENSE_COVER_STEPS 4
+/// How long it keeps its head down in cover before it looks out again.
+#define HUMAN_NPC_SENSE_PEEK_AFTER (2.5 SECONDS)
+/// The longest it stays in cover while it is winded (stamina loss past the stimulant share).
+#define HUMAN_NPC_SENSE_MAX_HOLD (10 SECONDS)
+/// How many times it runs for cover in one exchange of fire before it stands and fights.
+#define HUMAN_NPC_SENSE_COVER_MOVES 3
+/// A fighter that hits from this many tiles or fewer closes in on a stun shooter instead of taking cover.
+#define HUMAN_NPC_SENSE_CLOSE_IN_REACH 3
+/// It gives up on reaching its cover after this long per step of the way, plus a second.
+#define HUMAN_NPC_SENSE_COVER_STEP_TIME (0.6 SECONDS)
+/// How long it leaves its stimulants alone after a try that got nowhere (no hand free, the pen gone).
+#define HUMAN_NPC_SENSE_STIM_RETRY (5 SECONDS)
+
+/// Blackboard: the cover turf it is walking to.
+#define BB_HUMAN_NPC_COVER "human_npc_cover"
+/// Blackboard: the stimulant pen it is using on itself.
+#define BB_HUMAN_NPC_STIM_ITEM "human_npc_stim_item"
+/// Blackboard: whoever shot it with stun fire, for the close-in.
+#define BB_HUMAN_NPC_STUN_SHOOTER "human_npc_stun_shooter"
+
+/// Bark kind: it injects a stimulant it carries (faction pirate voices already have emotes for it).
+#define HUMAN_NPC_BARK_STIMULANT "stimulant"
+/// Bark kind: it runs for cover from stun fire.
+#define HUMAN_NPC_BARK_TAKE_COVER "take_cover"
+/// Bark kind: it charges whoever shot it with stun fire.
+#define HUMAN_NPC_BARK_CHARGE "charge"
diff --git a/voidcrew/_DEFINES/missions.dm b/voidcrew/_DEFINES/missions.dm
index 5f3388d0b53..add1428d01a 100644
--- a/voidcrew/_DEFINES/missions.dm
+++ b/voidcrew/_DEFINES/missions.dm
@@ -97,3 +97,10 @@
/obj/effect/zone_mobs/undead = 3,\
/obj/effect/zone_mobs/bug = 3,\
)
+
+/// zone_mobs wave arrivals: a drop pod lands the mob
+#define ZONE_MOBS_ARRIVE_POD "pod"
+/// zone_mobs wave arrivals: the mob digs up out of the ground
+#define ZONE_MOBS_ARRIVE_EMERGE "emerge"
+/// How far a wave's arrivals scatter from the spot that called them
+#define ZONE_MOBS_WAVE_SCATTER 4
diff --git a/voidcrew/_DEFINES/outpost_prison_boss_moves.dm b/voidcrew/_DEFINES/outpost_prison_boss_moves.dm
index 906ab86a8cd..82ad61d7f76 100644
--- a/voidcrew/_DEFINES/outpost_prison_boss_moves.dm
+++ b/voidcrew/_DEFINES/outpost_prison_boss_moves.dm
@@ -59,13 +59,12 @@
/// Cuffed this long before they start on the cuffs
#define PRISON_BOSS_SLIP_DELAY (3 SECONDS)
-/// Working at the cuffs
+/// The telegraph before they work at the cuffs (tg breakout time follows)
#define PRISON_BOSS_SLIP_TIME (5 SECONDS)
/// Stopped before they were free: they may try again after this
#define PRISON_BOSS_SLIP_RETRY (15 SECONDS)
-/// The shimmer afterwards (field cloak: 6 seconds, half of all hits miss)
+/// The shimmer afterwards: a look only; a Ghost dodges with real chrome
#define PRISON_BOSS_SHIMMER_TIME (6 SECONDS)
-#define PRISON_BOSS_SHIMMER_MISS 50
#define PRISON_BOSS_SHIMMER_ALPHA 90
// ===== HEAVY: A BARRICADE =====
diff --git a/voidcrew/_DEFINES/outpost_prison_bounty.dm b/voidcrew/_DEFINES/outpost_prison_bounty.dm
index 96787c78a25..053ff4c8ba6 100644
--- a/voidcrew/_DEFINES/outpost_prison_bounty.dm
+++ b/voidcrew/_DEFINES/outpost_prison_bounty.dm
@@ -43,23 +43,15 @@
// ===== BODY =====
-/// A bounty prisoner's health, by tier. The stamina pool follows it.
-#define BOUNTY_PRISONER_HEALTH_PETTY 100
-#define BOUNTY_PRISONER_HEALTH_WANTED 120
-#define BOUNTY_PRISONER_HEALTH_MOST_WANTED 150
+/// How much of a blow a bounty prisoner takes, by tier (human NPC npc_damage_taken, through physiology; defaults PR-16)
+#define BOUNTY_PRISONER_DAMAGE_TAKEN_PETTY 1
+#define BOUNTY_PRISONER_DAMAGE_TAKEN_WANTED 0.9
+#define BOUNTY_PRISONER_DAMAGE_TAKEN_MOST_WANTED 0.8
/// A bounty prisoner arrives hurt as they were caught, but with at least this percent of their health (spec 12.3 C11): downed deliveries otherwise crash wings.
#define BOUNTY_PRISONER_MIN_ARRIVAL_HEALTH 50
// ===== DANGER, BY TIER =====
-/// Multiplier on their punches
-#define BOUNTY_PRISON_PUNCH_MULT_PETTY 1
-#define BOUNTY_PRISON_PUNCH_MULT_WANTED 1.25
-#define BOUNTY_PRISON_PUNCH_MULT_MOST_WANTED 1.5
-/// Multiplier on their shiv blows
-#define BOUNTY_PRISON_SHIV_MULT_PETTY 1
-#define BOUNTY_PRISON_SHIV_MULT_WANTED 1.15
-#define BOUNTY_PRISON_SHIV_MULT_MOST_WANTED 1.3
/// Multiplier on their mood losses
#define BOUNTY_PRISON_MOOD_SCALE_PETTY 1
#define BOUNTY_PRISON_MOOD_SCALE_WANTED 1.1
@@ -76,10 +68,6 @@
#define BOUNTY_PRISON_BREAKOUT_MULT_PETTY 1
#define BOUNTY_PRISON_BREAKOUT_MULT_WANTED 1.25
#define BOUNTY_PRISON_BREAKOUT_MULT_MOST_WANTED 1.5
-/// Multiplier on how long cuffing them takes
-#define BOUNTY_PRISON_CUFF_MULT_PETTY 1
-#define BOUNTY_PRISON_CUFF_MULT_WANTED 1
-#define BOUNTY_PRISON_CUFF_MULT_MOST_WANTED 1
/// How much likelier a Wanted or Most Wanted prisoner who is not meek is to hit back when hit (like a grumpy one)
#define BOUNTY_PRISON_HIT_BACK_MULT_WANTED 1.5
#define BOUNTY_PRISON_HIT_BACK_MULT_MOST_WANTED 1.5
@@ -112,5 +100,3 @@
#define BOUNTY_PRISON_MEEK_DART_STEP 2
/// Steps a dart takes at most, waits for the door to swing open or for someone to get out of the way included, before they give up on it
#define BOUNTY_PRISON_MEEK_DART_STEPS 10
-/// Their speed while loose (others keep their own, 2)
-#define BOUNTY_PRISON_MEEK_LOOSE_SPEED 1.6
diff --git a/voidcrew/_DEFINES/outpost_prison_changeling.dm b/voidcrew/_DEFINES/outpost_prison_changeling.dm
index 85ef0049b44..09f9a24ca23 100644
--- a/voidcrew/_DEFINES/outpost_prison_changeling.dm
+++ b/voidcrew/_DEFINES/outpost_prison_changeling.dm
@@ -20,6 +20,8 @@
#define OUTPOST_CHANGELING_EARLY_BURST 3
/// Seconds a host may spend out of the cell block before the specimen is lost
#define OUTPOST_CHANGELING_HOST_LOST_AFTER 60
+/// A host with a body, down on their bunk, is knocked flat this long by each heave of the specimen
+#define OUTPOST_CHANGELING_HOST_KNOCKDOWN (6 SECONDS)
/// The host's sentence is held at least this long, so they are not released mid-incubation
#define OUTPOST_CHANGELING_HOST_SENTENCE_HOLD 600
diff --git a/voidcrew/_DEFINES/outpost_prison_conditions.dm b/voidcrew/_DEFINES/outpost_prison_conditions.dm
index c60ed91ded9..257ee6f7797 100644
--- a/voidcrew/_DEFINES/outpost_prison_conditions.dm
+++ b/voidcrew/_DEFINES/outpost_prison_conditions.dm
@@ -66,9 +66,6 @@
#define PRISON_RAT_AFTER (3 MINUTES)
#define PRISON_RAT_CHANCE 20
#define PRISON_RAT_MAX 2
-/// Brute per 5 seconds on unsafe air, never below PRISON_AIR_HEALTH_FLOOR percent health
-#define PRISON_AIR_DAMAGE 1
-#define PRISON_AIR_HEALTH_FLOOR 30
/// Unsafe air: pressure (kPa), temperature (K) and plasma (mol) limits
#define PRISON_AIR_PRESSURE_MIN 60
#define PRISON_AIR_PRESSURE_MAX 150
diff --git a/voidcrew/_DEFINES/outpost_prison_experiments.dm b/voidcrew/_DEFINES/outpost_prison_experiments.dm
index 44cc40a73c0..32cf9e414f1 100644
--- a/voidcrew/_DEFINES/outpost_prison_experiments.dm
+++ b/voidcrew/_DEFINES/outpost_prison_experiments.dm
@@ -131,74 +131,50 @@
/// How long a rioter who runs has to get away before they riot on
#define OUTPOST_PANIC_RETREAT_TIME (15 SECONDS)
-// ----- Creatures: health grows with the crew on the level when they appear -----
-/// Most extra players counted
-#define OUTPOST_EXPERIMENT_EXTRA_PLAYERS_MAX 3
+// ----- The serum's forms (outpost_prison_experiment_forms.dm) -----
+// The subject's own body changed by tg's genes and species. Their toughness is physiology
+// (npc_damage_taken: brute and burn taken as a multiple of a person's), never health, and never
+// scaled by who is on the level.
-// Hulk
-#define OUTPOST_HULK_HEALTH 350
-#define OUTPOST_HULK_HEALTH_PER_PLAYER 100
-#define OUTPOST_HULK_SPEED 1.8
-#define OUTPOST_HULK_EXHAUSTED_SPEED 2.5
-#define OUTPOST_HULK_PUNCH_MIN 18
-#define OUTPOST_HULK_PUNCH_MAX 22
-#define OUTPOST_HULK_PUNCH_COOLDOWN (1.5 SECONDS)
-/// Percent chance a punch throws its target OUTPOST_HULK_THROW_RANGE tiles
+/// How Kessler finds a creature it comes for (outpost_experiment_down_state()): dead; alive on the
+/// floor and held (cuffed or asleep), which pays the subdued rate; or on the floor or held but not both
+#define OUTPOST_EXPERIMENT_DOWN_DEAD "dead"
+#define OUTPOST_EXPERIMENT_DOWN_SUBDUED "subdued"
+#define OUTPOST_EXPERIMENT_DOWN_DOWN "down"
+/// Units of chloral hydrate in a Kessler agent's dart (owner ruling OC-3)
+#define OUTPOST_KESSLER_DART_DOSE 15
+
+// Hulk: tg's hulk gene and gigantism
+#define OUTPOST_HULK_DAMAGE_TAKEN 0.6
+/// Percent chance a punch that lands throws someone OUTPOST_HULK_THROW_RANGE tiles; a standing prisoner is knocked down instead
#define OUTPOST_HULK_THROW_CHANCE 25
#define OUTPOST_HULK_THROW_RANGE 2
+#define OUTPOST_HULK_KNOCKDOWN (2 SECONDS)
/// The charge: wind-up, range, damage, knockdown, cooldown
#define OUTPOST_HULK_CHARGE_WINDUP (1.5 SECONDS)
#define OUTPOST_HULK_CHARGE_RANGE 6
#define OUTPOST_HULK_CHARGE_DAMAGE 20
#define OUTPOST_HULK_CHARGE_KNOCKDOWN (2 SECONDS)
#define OUTPOST_HULK_CHARGE_COOLDOWN (12 SECONDS)
-/// Charging into a wall with nobody caught: stunned this long, taking this much more damage meanwhile
+/// Charging into a wall with nobody caught: stunned this long
#define OUTPOST_HULK_WALL_STUN (2 SECONDS)
-#define OUTPOST_HULK_WALL_VULNERABLE 1.25
-/// Tearing through an interior wall, and forcing a door
-#define OUTPOST_HULK_TEAR_TIME (3 SECONDS)
+/// Forcing a door
#define OUTPOST_HULK_DOOR_TIME (4 SECONDS)
-/// Worn down to this percent of health, it stops charging and a baton or disabler can put it down
-#define OUTPOST_HULK_EXHAUSTED_AT 25
-/// Stamina it can take once exhausted: two baton hits or four disabler shots
-#define OUTPOST_HULK_STAMINA 110
-// Nightmare
-#define OUTPOST_NIGHTMARE_HEALTH 225
-#define OUTPOST_NIGHTMARE_HEALTH_PER_PLAYER 75
-#define OUTPOST_NIGHTMARE_DARK_SPEED 1.5
-#define OUTPOST_NIGHTMARE_LIGHT_SPEED 2.5
-#define OUTPOST_NIGHTMARE_DAMAGE 20
-#define OUTPOST_NIGHTMARE_ATTACK_COOLDOWN (1.2 SECONDS)
+// Nightmare: tg's nightmare species and organs
+#define OUTPOST_NIGHTMARE_DAMAGE_TAKEN 0.8
#define OUTPOST_NIGHTMARE_ARMOUR_PENETRATION 20
-/// Percent chance a hit burns out a flashlight the target holds (never flares or glowsticks)
-#define OUTPOST_NIGHTMARE_BURNOUT_CHANCE 35
-/// Light level below which it is in the dark (SHADOW_SPECIES_LIGHT_THRESHOLD)
-#define OUTPOST_NIGHTMARE_DARK 0.2
-/// Health per second: regained in the dark, lost in the light
-#define OUTPOST_NIGHTMARE_REGEN 2
-#define OUTPOST_NIGHTMARE_BURN 2
-/// Percent of shots it sidesteps in the dark
-#define OUTPOST_NIGHTMARE_DODGE 60
/// The shadow jaunt: cooldown, the ripple that warns of it, what it does
#define OUTPOST_NIGHTMARE_JAUNT_COOLDOWN (12 SECONDS)
#define OUTPOST_NIGHTMARE_JAUNT_RIPPLE (1 SECONDS)
#define OUTPOST_NIGHTMARE_JAUNT_DAMAGE 25
#define OUTPOST_NIGHTMARE_JAUNT_KNOCKDOWN (1 SECONDS)
-/// A handheld flash: burn and stagger
-#define OUTPOST_NIGHTMARE_FLASH_DAMAGE 20
-#define OUTPOST_NIGHTMARE_FLASH_STAGGER (2 SECONDS)
/// Seconds it spends breaking the lights first, ignoring people who leave it alone
#define OUTPOST_NIGHTMARE_OPENING_MIN 30
#define OUTPOST_NIGHTMARE_OPENING_MAX 45
-// Fly person
-#define OUTPOST_FLY_HEALTH 60
-/// Its move delay: faster than a running person (1.5)
-#define OUTPOST_FLY_SPEED 0.7
-/// Percent of shots it jinks out of the way of while flying freely (not knocked down, held or subdued)
-#define OUTPOST_FLY_DODGE 40
-#define OUTPOST_FLY_BITE 5
+// Fly person: tg's fly species and a Slipwire implant
+#define OUTPOST_FLY_DAMAGE_TAKEN 1
/// It darts away from anyone this close
#define OUTPOST_FLY_FLEE_RANGE 3
/// Its darts: tiles, the pause between random ones, and how long one may take before it gives up on it
@@ -209,16 +185,6 @@
#define OUTPOST_FLY_DART_TIMEOUT (1.5 SECONDS)
/// How long it keeps away from whoever last hit it
#define OUTPOST_FLY_FLIT_TIME (3 SECONDS)
-/// Trait source for its flight
-#define OUTPOST_FLY_TRAIT "outpost_fly"
-/// Seconds between throwing up, and the percent chance it gets someone beside it
-#define OUTPOST_FLY_VOMIT_MIN 6
-#define OUTPOST_FLY_VOMIT_MAX 10
-#define OUTPOST_FLY_VOMIT_ON_CHANCE 25
-/// A flyswatter hits it this many times harder, as it does tg's fly people
-#define OUTPOST_FLY_SWATTER_MULT 30
-/// Stamina it can take: two baton hits
-#define OUTPOST_FLY_STAMINA 100
// ----- Trait sources and timings shared by the experiment files -----
/// Seconds a creature may chase its current target with no progress (not closer, not adjacent)
@@ -236,5 +202,10 @@
#define OUTPOST_KESSLER_TEAM_TIME (5 SECONDS)
/// How long a Kessler beam takes, in and out
#define OUTPOST_KESSLER_BEAM_TIME (3 SECONDS)
+/// From a real hit on Kessler staff to Kessler's beam taking them out ("I'm leaving!")
+#define OUTPOST_KESSLER_ASSAULT_BEAM_DELAY (2 SECONDS)
+/// Seconds before Kessler sends anyone again after its researcher was killed on a visit
+#define OUTPOST_KESSLER_KILLED_WAIT_MIN (90 * 60)
+#define OUTPOST_KESSLER_KILLED_WAIT_MAX (120 * 60)
/// The creatures' sentience type: it matches no potion, lazarus injector or ghost role (the spec's SENTIENCE_NONE)
#define OUTPOST_EXPERIMENT_NO_SENTIENCE 0
diff --git a/voidcrew/_DEFINES/outpost_prison_guards.dm b/voidcrew/_DEFINES/outpost_prison_guards.dm
index e5018024dee..b73c94b41f4 100644
--- a/voidcrew/_DEFINES/outpost_prison_guards.dm
+++ b/voidcrew/_DEFINES/outpost_prison_guards.dm
@@ -10,15 +10,16 @@
#define OUTPOST_GUARD_WAGE 2
/// Wages skipped in a row (the treasury could not cover them) before the guards walk off
#define OUTPOST_GUARD_UNPAID_LEAVE 2
-#define OUTPOST_GUARD_HEALTH 120
-/// Health at which a guard goes down (godmode, lying) instead of taking more damage
-#define OUTPOST_GUARD_DOWN_AT 30
-/// From going down to beaming out
+/// From going into crit to the corrections service's medevac of the body
#define OUTPOST_GUARD_RECALL_DELAY (10 SECONDS)
+/// From a guard's death to the corrections service collecting the body
+#define OUTPOST_GUARD_BODY_COLLECT_DELAY (60 SECONDS)
+/// A guard whose baton went flat is back with a charged one after this
+#define OUTPOST_GUARD_SHIFT_SWAP_TIME (1 MINUTES)
+/// A guard with this much brute and burn damage or more patches up from the office first-aid kit when nothing is going on
+#define OUTPOST_GUARD_TREAT_ABOVE 20
/// A downed or recalled guard comes back free after this, if still hired and a member is home
#define OUTPOST_GUARD_RETURN_TIME (10 MINUTES)
-/// Stamina damage per baton strike: prisoners crit at 100, so three strikes
-#define OUTPOST_GUARD_BATON_STAMINA 35
#define OUTPOST_GUARD_BATON_COOLDOWN (2 SECONDS)
/// Percent chance a guard arriving at an argument ends it with words
#define OUTPOST_GUARD_TALKDOWN_CHANCE 60
@@ -56,11 +57,6 @@
#define OUTPOST_GUARD_SPAT_VIEW 7
/// How close to a member in the cell block a guard stays during a riot
#define OUTPOST_GUARD_FOLLOW_RANGE 2
-/// Health a guard gets back per minute while not in a riot and not down
-#define OUTPOST_GUARD_HEAL_PER_MINUTE 12
-/// Movement: an unhurried walk on routine, a hurry on a response (basic mob speed)
-#define OUTPOST_GUARD_SPEED_WALK 2
-#define OUTPOST_GUARD_SPEED_HURRY 1
/// How long a prisoner is left alone after a guard checked on them or they greeted a guard
#define OUTPOST_GUARD_CHECK_ON_GAP (5 MINUTES)
@@ -97,5 +93,5 @@
/// Trait source for the beam holding a guard still
#define OUTPOST_GUARD_BEAM_TRAIT "outpost_guard_beam"
-/// Trait source for a guard lying down, out of it
-#define OUTPOST_GUARD_DOWN_TRAIT "outpost_guard_down"
+/// Trait source for what a guard on their feet refuses (lockers, bags)
+#define OUTPOST_GUARD_UPRIGHT_TRAIT "outpost_guard_upright"
diff --git a/voidcrew/_DEFINES/outpost_prison_needs.dm b/voidcrew/_DEFINES/outpost_prison_needs.dm
index a75776cdf87..fc0e603b607 100644
--- a/voidcrew/_DEFINES/outpost_prison_needs.dm
+++ b/voidcrew/_DEFINES/outpost_prison_needs.dm
@@ -17,8 +17,6 @@
#define PRISONER_INJURED_BELOW 90
/// Below this health percent an untreated prisoner leaves the odd drip of blood
#define PRISONER_BLEED_BELOW 50
-/// How long stamina crit holds after the last stamina hit, long enough to drag one to a cell
-#define PRISONER_STAMCRIT_TIME (20 SECONDS)
/// Percent chance per minute that a prisoner drops some mess
#define OUTPOST_PRISON_MESS_CHANCE 4
/// Pause between spontaneous prisoner lines anywhere in one wing (deciseconds)
@@ -37,7 +35,7 @@
#define PRISONER_MOOD_CLEAN_UNIFORM 8
#define PRISONER_MOOD_TREATED 8
-// Where a prisoner is in their stay (/mob/living/basic/outpost_prisoner/var/phase)
+// Where a prisoner is in their stay (/mob/living/carbon/human/npc/outpost_prisoner/var/phase)
/// Being beamed into their cell
#define PRISONER_ARRIVING "arriving"
/// In the wing, serving their sentence
@@ -45,7 +43,7 @@
/// Being beamed out, released or collected
#define PRISONER_LEAVING "leaving"
-// What /mob/living/basic/outpost_prisoner/proc/try_reach() found
+// What /mob/living/carbon/human/npc/outpost_prisoner/proc/try_reach() found
#define PRISONER_REACH_FAILED 0
#define PRISONER_REACH_OK 1
/// Their side of a serving hatch is opening
diff --git a/voidcrew/_DEFINES/outpost_prison_trouble.dm b/voidcrew/_DEFINES/outpost_prison_trouble.dm
index f8a4942d809..7b102d3be93 100644
--- a/voidcrew/_DEFINES/outpost_prison_trouble.dm
+++ b/voidcrew/_DEFINES/outpost_prison_trouble.dm
@@ -77,22 +77,6 @@
#define PRISONER_THREAT_COOLDOWN 20
/// Seconds a decided swing waits for them to close in before it is dropped
#define PRISONER_SWING_TIMEOUT 6
-/// Brute damage of a punch at staff: blunt, and it never wounds
-#define PRISONER_PUNCH_MIN 5
-#define PRISONER_PUNCH_MAX 8
-/// Brute damage of a shiv at staff or anyone else who is not a prisoner (tg's glass shiv is force 8).
-/// Each blow is a stab or a slash, so it can leave a puncture or a cut that bleeds.
-#define PRISONER_SHIV_MIN 10
-#define PRISONER_SHIV_MAX 15
-/// The shiv's wounding, as tg's glass shiv has it in someone's hand. Four blows in five land on the
-/// chest, which resists wounds; the rest on an arm, a leg or now and then the head (tg's
-/// attack_zone_randomiser). On a bare body about two blows in five wound. An armour vest takes a
-/// third off chest blows and stops nearly every wound there, leaving about one in five.
-#define PRISONER_SHIV_WOUND_BONUS 5
-#define PRISONER_SHIV_EXPOSED_WOUND_BONUS 15
-/// Brute damage of a shiv at another prisoner (a stabbing, outpost_prison_incidents.dm), never a killing blow
-#define PRISONER_STAB_MIN 7
-#define PRISONER_STAB_MAX 10
// A player's blow on a prisoner on their feet: they hit back, or back off
/// Seconds they go after the attacker before letting it drop
@@ -139,10 +123,7 @@
#define PRISONER_FIGHT_COOLDOWN 300
/// Seconds between any two fights in the wing
#define PRISON_FIGHT_GAP 180
-/// Brute of a blow in a fight between prisoners
-#define PRISONER_FIGHT_HIT_MIN 3
-#define PRISONER_FIGHT_HIT_MAX 6
-/// Health percent at which a fighter yields, and seconds they stay down
+/// Health percent at which a losing fighter gives up, and seconds they then stay lying down by choice
#define PRISONER_FIGHT_YIELD 40
#define PRISONER_FIGHT_YIELD_TIME 20
/// Below this mood two prisoners near each other may argue without blows, at most once per PRISON_SPAT_GAP in the wing
@@ -152,11 +133,8 @@
#define PRISON_SPAT_CHANCE 8
// Beaten down
-/// At or below this health percent a prisoner collapses
-#define PRISONER_BEATEN_BELOW 15
-/// Seconds they lie beaten, unless treated above PRISONER_RECOVER_ABOVE percent first
-#define PRISONER_BEATEN_TIME 120
-#define PRISONER_RECOVER_ABOVE 40
+/// How long something that slams a prisoner on their feet to the floor knocks them down (collapse(), a real tg Knockdown)
+#define PRISONER_COLLAPSE_KNOCKDOWN (4 SECONDS)
// Riots
/// Below these moods each personality joins a riot; if nobody does, the unhappiest starts it alone.
@@ -223,8 +201,6 @@
#define PRISON_LOOSE_PING_2 60
/// Mood of a recaptured prisoner
#define PRISONER_RECAPTURED_MOOD 35
-/// Damage a loose prisoner does to doors and machines per blow (normal airlocks shrug off under 21)
-#define PRISONER_LOOSE_OBJ_DAMAGE 25
// Lock-in
/// Confined this many seconds at mood PRISONER_WRECK_MOOD or less, a prisoner wrecks the cell; the bolts shear PRISONER_WRECK_TIME seconds later
@@ -233,8 +209,7 @@
#define PRISONER_WRECK_TIME 180
// Cuffs (outpost_prison_capture.dm)
-/// Seconds cuffing takes: a prisoner who is down, and one on their feet and out of trouble
-#define PRISONER_CUFF_TIME_DOWN (2 SECONDS)
+/// How long a prisoner holds still for tg's cuffing (its handcuffs take 4 seconds)
#define PRISONER_CUFF_TIME_STANDING (4 SECONDS)
/// Seconds taking the cuffs off takes
#define PRISONER_UNCUFF_TIME (2 SECONDS)
@@ -252,7 +227,7 @@
/// Seconds out of a cell, on their feet and uncuffed, before a prisoner who owes lockdown riots again
#define PRISON_LOCKDOWN_GRACE 30
-// What trouble a prisoner is in (/mob/living/basic/outpost_prisoner/var/trouble); null is none
+// What trouble a prisoner is in (/mob/living/carbon/human/npc/outpost_prisoner/var/trouble); null is none
#define PRISONER_TROUBLE_FIGHT "fight"
#define PRISONER_TROUBLE_RIOT "riot"
/// Rioting after the riot turned into a breakout: going for the exits
diff --git a/voidcrew/_HELPERS/hostile_creatures.dm b/voidcrew/_HELPERS/hostile_creatures.dm
index 22dc386a234..0561a69e0c2 100644
--- a/voidcrew/_HELPERS/hostile_creatures.dm
+++ b/voidcrew/_HELPERS/hostile_creatures.dm
@@ -65,17 +65,19 @@ GLOBAL_LIST_INIT(turret_retaliating_subtrees, typecacheof(list(
* GLOB.ai_subtrees, so this is a handful of list lookups.
*/
/proc/is_hostile_creature(mob/living/creature)
+ // Prison experiment creatures (outpost_prison_experiment_forms.dm, outpost_prison_horror.dm): fair game
+ // anywhere while up, like the headslug, whose stock AI already reads as hostile. Their custom AI does
+ // not. First: a body the serum took is still a prisoner's body.
+ if(is_outpost_experiment_creature(creature))
+ return is_outpost_experiment_turret_target(creature)
// Outpost prisoners (outpost_prison_*.dm): left alone inside their wing, rioting or not;
// once loose outside it they are fair game. Turrets players build use outpost_prison_security.dm instead.
- if(istype(creature, /mob/living/basic/outpost_prisoner))
+ if(istype(creature, /mob/living/carbon/human/npc/outpost_prisoner))
return is_loose_outpost_prisoner(creature)
- // Prison experiment creatures (outpost_prison_creatures.dm): fair game anywhere, like the
- // headslug, whose stock AI already reads as hostile. Their custom AI does not.
- if(istype(creature, /mob/living/basic/outpost_experiment))
- return is_outpost_experiment_turret_target(creature)
- // Bounty criminals, decoys and companions (voidcrew/modules/bounties/bounty_criminal.dm): trader-outpost
- // turrets leave them to the hunters, and no turret shoots a criminal already down, stunned or cuffed.
- if(istype(creature, /mob/living/basic/bounty_criminal) || istype(creature, /mob/living/basic/bounty_companion))
+ // Bounty criminals, decoys and companions (voidcrew/modules/bounties/bounty_criminal.dm), real human bodies:
+ // trader-outpost turrets leave them to the hunters, and no turret shoots a criminal already in crit,
+ // stunned or cuffed (tg's states).
+ if(istype(creature, /mob/living/carbon/human/npc/bounty_criminal) || istype(creature, /mob/living/carbon/human/npc/bounty_companion))
if(bounty_turret_ignores(creature, istype(get_area(creature), /area/voidcrew/trader_outpost)))
return FALSE
// Bees from an outpost's own apiary never sting anyone (outpost_apiary.dm), but their
diff --git a/voidcrew/controllers/subsystem/planet_mobs.dm b/voidcrew/controllers/subsystem/planet_mobs.dm
index ba6718aa84a..f772ec5db19 100644
--- a/voidcrew/controllers/subsystem/planet_mobs.dm
+++ b/voidcrew/controllers/subsystem/planet_mobs.dm
@@ -351,7 +351,7 @@ SUBSYSTEM_DEF(planet_mobs)
continue
var/datum/npc_spawn_context/context = new(tracker, tracker.zone_band, source_turf = candidate)
- spawn_npc_in_zone(mob_type, candidate, context)
+ spawn_npc_in_zone_or_queue(mob_type, candidate, context)
spawned++
total_managed_mobs++
diff --git a/voidcrew/datums/mapgen/PlanetGenerator.dm b/voidcrew/datums/mapgen/PlanetGenerator.dm
index 4bfb47df656..9b5c02e7fa1 100644
--- a/voidcrew/datums/mapgen/PlanetGenerator.dm
+++ b/voidcrew/datums/mapgen/PlanetGenerator.dm
@@ -552,7 +552,7 @@
if(can_spawn)
var/datum/npc_spawn_context/context = new(src, zone_band, "auto", source_turf = target_turf)
- spawn_npc_in_zone(picked_mob, target_turf, context)
+ spawn_npc_in_zone_or_queue(picked_mob, target_turf, context)
spawned_something = TRUE
// The expensive half of a planet build - every iteration runs several range()
// scans - and the one that most needs to stop hogging the tick. See
diff --git a/voidcrew/datums/mapgen/biomes/_biome.dm b/voidcrew/datums/mapgen/biomes/_biome.dm
index 6ef081c4196..80c1637c63d 100644
--- a/voidcrew/datums/mapgen/biomes/_biome.dm
+++ b/voidcrew/datums/mapgen/biomes/_biome.dm
@@ -126,7 +126,7 @@
if(can_spawn)
var/datum/npc_spawn_context/context = new(src, source_turf = new_turf)
- spawn_npc_in_zone(picked_mob, new_turf, context)
+ spawn_npc_in_zone_or_queue(picked_mob, new_turf, context)
new_turf.flags_1 |= NO_LAVA_GEN
diff --git a/voidcrew/datums/mapgen/biomes/beach_biomes.dm b/voidcrew/datums/mapgen/biomes/beach_biomes.dm
index 6b7d8ffa634..ce3af2a53ca 100644
--- a/voidcrew/datums/mapgen/biomes/beach_biomes.dm
+++ b/voidcrew/datums/mapgen/biomes/beach_biomes.dm
@@ -94,7 +94,7 @@
dangerous_mob_spawn_list = list(
/mob/living/basic/carp/beach = 3,
/mob/living/basic/carp/mega/beach = 1,
- /mob/living/basic/trooper/pirate/melee/beach/boat = 1,
+ /mob/living/carbon/human/npc/ruin/trooper/pirate/beach = 1,
)
flora_spawn_list = list(
/obj/structure/flora/rock/beach = 1,
@@ -111,12 +111,12 @@
/mob/living/basic/carp/beach = 6,
/mob/living/basic/carp/beach/small = 5,
/mob/living/basic/carp/mega/beach = 2,
- /mob/living/basic/trooper/pirate/melee/beach/boat = 3,
- /mob/living/basic/trooper/pirate/ranged/beach/boat = 1
+ /mob/living/carbon/human/npc/ruin/trooper/pirate/beach = 3,
+ /mob/living/carbon/human/npc/ruin/trooper/pirate/beach/gunner = 1
)
dangerous_mob_spawn_list = list(
/mob/living/basic/carp/mega/beach = 2,
- /mob/living/basic/trooper/pirate/ranged/beach/boat = 1,
+ /mob/living/carbon/human/npc/ruin/trooper/pirate/beach/gunner = 1,
)
feature_spawn_chance = 0.1
feature_spawn_list = list(
diff --git a/voidcrew/datums/mapgen/biomes/wasteland_biomes.dm b/voidcrew/datums/mapgen/biomes/wasteland_biomes.dm
index 2a0736c2fba..c2ff36d4115 100644
--- a/voidcrew/datums/mapgen/biomes/wasteland_biomes.dm
+++ b/voidcrew/datums/mapgen/biomes/wasteland_biomes.dm
@@ -24,14 +24,14 @@
feature_spawn_chance = 3
mob_spawn_chance = 7
mob_spawn_list = list(
- /mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter = 10,
+ /mob/living/carbon/human/npc/ruin/hermit/hunter = 10,
/mob/living/basic/spider/giant/wasteland = 1,
/mob/living/basic/spider/giant/tarantula/wasteland = 1,
/mob/living/basic/mining/legion/wasteland = 3
)
// Meaner tier for dangerous-zone planets (see dangerous_mob_spawn_list)
dangerous_mob_spawn_list = list(
- /mob/living/simple_animal/hostile/asteroid/hermit/ranged/gunslinger = 5,
+ /mob/living/carbon/human/npc/ruin/hermit/gunslinger = 5,
/mob/living/basic/mining/legion/wasteland = 3,
/mob/living/basic/spider/giant/tarantula/wasteland = 2,
/mob/living/basic/spider/giant/wasteland = 2,
@@ -92,13 +92,13 @@
flora_spawn_list = list(/obj/structure/flora/rock/wasteland = 30, /obj/effect/decal/cleanable/greenglow = 30, /obj/structure/elite_tumor = 1)
mob_spawn_chance = 20
mob_spawn_list = list(
- /mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter = 17,
+ /mob/living/carbon/human/npc/ruin/hermit/hunter = 17,
/mob/living/basic/hivebot/range = 5,
/mob/living/basic/spider/giant/wasteland = 1,
/mob/living/basic/spider/giant/tarantula/wasteland = 1
)
dangerous_mob_spawn_list = list(
- /mob/living/simple_animal/hostile/asteroid/hermit/ranged/gunslinger = 7,
+ /mob/living/carbon/human/npc/ruin/hermit/gunslinger = 7,
/mob/living/basic/hivebot/rapid/wasteland = 3,
/mob/living/basic/spider/giant/tarantula/wasteland = 1,
)
diff --git a/voidcrew/edits/mobs/ladder_outfits.dm b/voidcrew/edits/mobs/ladder_outfits.dm
index c2925461fe3..6a6f83726c6 100644
--- a/voidcrew/edits/mobs/ladder_outfits.dm
+++ b/voidcrew/edits/mobs/ladder_outfits.dm
@@ -20,6 +20,11 @@
. = ..()
ladder_add_survival_knife()
+// The combat-ready kit fills its bag already: equip() below hands the knife over instead.
+/datum/outfit/job/miner/equipped/combat/pre_equip(mob/living/carbon/human/H, visuals_only = FALSE)
+ . = ..()
+ backpack_contents -= /obj/item/knife/combat/survival
+
/datum/outfit/job/security/pre_equip(mob/living/carbon/human/H, visuals_only = FALSE)
. = ..()
ladder_add_survival_knife()
@@ -59,10 +64,11 @@
// Corpse and ghost-role outfits are also fixed starting placements.
// Appearance dummies are left alone: get_dynamic_human_appearance() dresses one through the
// spawner to draw an NPC's look (a gunner holding its gun) and deletes it straight after, so
-// nothing on it can ever be picked up.
+// nothing on it can ever be picked up. Human NPCs (voidcrew/modules/human_npcs/) are left alone
+// too: their kit is locked to the body and never becomes loot, and it's what they fight with.
/obj/effect/mob_spawn/equip(mob/living/spawned_mob)
. = ..()
- if(ishuman(spawned_mob) && !istype(spawned_mob, /mob/living/carbon/human/dummy))
+ if(ishuman(spawned_mob) && !istype(spawned_mob, /mob/living/carbon/human/dummy) && !ishumannpc(spawned_mob))
remove_ladder_starting_weapons(spawned_mob, list())
/datum/voucher_set/mining/crusher_kit
diff --git a/voidcrew/edits/mobs/weapon_drops.dm b/voidcrew/edits/mobs/weapon_drops.dm
index 077bbe65666..ecf94506ea9 100644
--- a/voidcrew/edits/mobs/weapon_drops.dm
+++ b/voidcrew/edits/mobs/weapon_drops.dm
@@ -59,8 +59,7 @@
if(istype(src, /mob/living/basic/trooper/nanotrasen/ranged))
if((zone == ZONE_GREEN && (istype(src, /mob/living/basic/trooper/nanotrasen/ranged/smg) || istype(src, /mob/living/basic/trooper/nanotrasen/ranged/assault))) || (zone != ZONE_RED && istype(src, /mob/living/basic/trooper/nanotrasen/ranged/elite)))
pistol_type = /mob/living/basic/trooper/nanotrasen/ranged
- if(zone != ZONE_RED && (istype(src, /mob/living/basic/trooper/nanotrasen/ranged/smg/customs) || istype(src, /mob/living/basic/trooper/nanotrasen/ranged/assault/customs)))
- pistol_type = /mob/living/basic/trooper/nanotrasen/ranged
+ // NT customs are human NPCs now: their ladder pistol is in their outfit table (faction_pirates/nt_patrol.dm)
else if(istype(src, /mob/living/basic/trooper/syndicate/ranged))
if(zone != ZONE_RED && (istype(src, /mob/living/basic/trooper/syndicate/ranged/smg) || istype(src, /mob/living/basic/trooper/syndicate/ranged/shotgun) || (zone == ZONE_GREEN && istype(src, /mob/living/basic/trooper/syndicate/ranged/space/stormtrooper))))
pistol_type = /mob/living/basic/trooper/syndicate/ranged
@@ -76,8 +75,7 @@
r_hand = /obj/item/knife/combat/survival
l_hand = null
set_light(0)
- if(use_dynamic_appearance)
- apply_dynamic_human_appearance(src, mob_spawn_path = mob_spawner, r_hand = r_hand)
+ apply_dynamic_human_appearance(src, mob_spawn_path = mob_spawner, r_hand = r_hand)
return TRUE
/mob/living/basic/trooper/proc/use_ladder_pistol(mob/living/basic/trooper/profile)
@@ -102,8 +100,7 @@
QDEL_NULL(ai_controller)
ai_controller = new /datum/ai_controller/basic_controller/trooper/ranged(src)
r_hand = initial(profile.r_hand)
- if(use_dynamic_appearance)
- apply_dynamic_human_appearance(src, mob_spawn_path = mob_spawner, r_hand = r_hand, l_hand = l_hand)
+ apply_dynamic_human_appearance(src, mob_spawn_path = mob_spawner, r_hand = r_hand, l_hand = l_hand)
// Copy both lists before trimming them: crusher kills must use the very same
// construction-time roll, and must keep trophies and the mining accelerator.
diff --git a/voidcrew/edits/modules/mob/living/basic/trooper/trooper.dm b/voidcrew/edits/modules/mob/living/basic/trooper/trooper.dm
deleted file mode 100644
index 595da62d1af..00000000000
--- a/voidcrew/edits/modules/mob/living/basic/trooper/trooper.dm
+++ /dev/null
@@ -1,5 +0,0 @@
-// Voidcrew extensions to code/modules/mob/living/basic/trooper/trooper.dm.
-
-/mob/living/basic/trooper
- /// VOIDCREW EDIT: subtypes with bespoke static sprites (e.g. boat pirates) set this FALSE to keep their own icon.
- var/use_dynamic_appearance = TRUE
diff --git a/voidcrew/edits/modules/projectiles/projectile_npc_allies.dm b/voidcrew/edits/modules/projectiles/projectile_npc_allies.dm
new file mode 100644
index 00000000000..840f3821b9d
--- /dev/null
+++ b/voidcrew/edits/modules/projectiles/projectile_npc_allies.dm
@@ -0,0 +1,54 @@
+// Voidcrew extension to code/modules/projectiles/projectile.dm: NPCs shoot past their own side.
+
+/obj/projectile
+ /// Set before fire() to keep an NPC's shot hitting its own side in the way (the mafia lair's machine).
+ var/npc_shot_hits_allies = FALSE
+ /// The NPC whose side this shot passes over. A shot reflected or parried by someone else stops passing over them.
+ var/datum/weakref/npc_side_shooter
+
+/**
+ * A shot fired by an NPC (a mob nobody is playing) passes over anyone on its side, as tg's turrets already
+ * do, through tg's own ignored_factions check in can_hit_target(). The mob it was aimed at is always hit,
+ * whichever side it is on. Every NPC fires through here: human NPCs' guns (casing to projectile, shotgun
+ * pellets included), basic mobs' ranged_attacks and simple mobs' Shoot().
+ *
+ * A player's shots are unchanged. The shared "neutral" faction is left out, so an NPC never shoots
+ * through bystanders just because nobody gave them a side.
+ */
+/obj/projectile/fire(fire_angle, atom/direct_target)
+ if(isnull(ignored_factions) && !npc_shot_hits_allies && ismob(firer))
+ var/mob/firer_mob = firer
+ if(!firer_mob.ckey && length(firer_mob.faction))
+ var/list/sides = firer_mob.faction - FACTION_NEUTRAL
+ if(length(sides))
+ ignored_factions = sides
+ npc_side_shooter = WEAKREF(firer_mob)
+ return ..()
+
+// A reflected, parried or deflected shot takes a new firer: it stops sparing the NPC's side.
+// An ally held by the other side is a shield, not an ally: the shot can hit them (see npc_shot_shield()).
+/obj/projectile/can_hit_target(atom/target, direct_target = FALSE, ignore_loc = FALSE, cross_failed = FALSE)
+ if(npc_side_shooter && firer && firer.weak_reference != npc_side_shooter)
+ npc_side_shooter = null
+ ignored_factions = null
+ if(npc_side_shooter && npc_shot_shield(target))
+ var/list/sides = ignored_factions
+ ignored_factions = null
+ . = ..()
+ ignored_factions = sides
+ return .
+ return ..()
+
+/**
+ * Whether `target` is one of the NPC's side held in an aggressive grab or tighter by a living mob that is
+ * not on that side. tg's grab states are the only test: a passive pull (dragging a body or a cuffed
+ * prisoner) is not a shield. tg's own rules still pass over a held body that is dead or lying helpless.
+ */
+/obj/projectile/proc/npc_shot_shield(atom/target)
+ if(!isliving(target) || !length(ignored_factions))
+ return FALSE
+ var/mob/living/held = target
+ var/mob/living/holder = held.pulledby
+ if(!isliving(holder) || holder.grab_state < GRAB_AGGRESSIVE)
+ return FALSE
+ return faction_check(held.faction, ignored_factions) && !faction_check(holder.faction, ignored_factions)
diff --git a/voidcrew/edits/ship_access.dm b/voidcrew/edits/ship_access.dm
index fdc8fa05b19..82d596f97a1 100644
--- a/voidcrew/edits/ship_access.dm
+++ b/voidcrew/edits/ship_access.dm
@@ -161,8 +161,8 @@ GLOBAL_LIST_EMPTY(crew_locked_ships)
/obj/structure/overmap/ship/proc/is_npc_ship_crew(mob/living/npc)
if(is_ship_crew(npc))
return TRUE
- if(istype(npc, /mob/living/basic/ambient_npc/stray))
- var/mob/living/basic/ambient_npc/stray/stray = npc
+ if(istype(npc, /mob/living/carbon/human/npc/ambient_npc/stray))
+ var/mob/living/carbon/human/npc/ambient_npc/stray/stray = npc
return !stray.is_wild() && stray.get_ship() == src
var/list/friends = npc.ai_controller?.blackboard[BB_FRIENDS_LIST]
for(var/mob/friend as anything in friends)
diff --git a/voidcrew/machinery/ship_defense_turret.dm b/voidcrew/machinery/ship_defense_turret.dm
index 13c244dcdc6..a0223d00be2 100644
--- a/voidcrew/machinery/ship_defense_turret.dm
+++ b/voidcrew/machinery/ship_defense_turret.dm
@@ -284,21 +284,25 @@
* which is the whole job.
*/
/obj/machinery/porta_turret/ship_defense/proc/valid_target(mob/living/creature)
- if(creature.stat == DEAD)
+ // Dead, in crit or cuffed: out of the fight (human_npc_out_of_fight(), owner ruling OC-7), so a
+ // boarder the crew has taken down or captured is left alone. A basic mob is out only once dead.
+ if(human_npc_out_of_fight(creature))
return FALSE
if(creature.client || creature.mind) // Anything a player is driving, or was driving.
return FALSE
- if(iscarbon(creature) || issilicon(creature)) // People, monkeys, xenos, borgs, pAIs.
+ // People, monkeys, xenos, borgs, pAIs. Human NPCs (voidcrew/modules/human_npcs/) are bodies no
+ // player drives, the human boarders that replace troopers, so they are fair game like them.
+ if(issilicon(creature) || (iscarbon(creature) && !ishumannpc(creature)))
return FALSE
if(creature.invisibility > SEE_INVISIBLE_LIVING)
return FALSE
if(in_faction(creature)) // Bots, pets and other turrets.
return FALSE
// With wildlife targeting off the turret only watches for boarding parties, which are
- // all trooper-type humanoids (pirates and their kin). Lets the crew hunt the local
+ // all trooper-type humanoids or human NPCs (pirates and their kin). Lets the crew hunt the local
// fauna themselves without the turret stealing every kill.
// Escaped outpost prisoners count as boarders (outpost_prison_riot.dm).
- if(!target_wildlife && !istype(creature, /mob/living/basic/trooper) && !is_loose_outpost_prisoner(creature))
+ if(!target_wildlife && !istype(creature, /mob/living/basic/trooper) && !ishumannpc(creature) && !is_loose_outpost_prisoner(creature))
return FALSE
if(!is_hostile_creature(creature)) // Livestock, pets and passive fauna get left alone.
return FALSE
diff --git a/voidcrew/modules/ambient_npcs/_ambient_types.dm b/voidcrew/modules/ambient_npcs/_ambient_types.dm
index 0808f0ed83e..9866da3e5d2 100644
--- a/voidcrew/modules/ambient_npcs/_ambient_types.dm
+++ b/voidcrew/modules/ambient_npcs/_ambient_types.dm
@@ -27,64 +27,49 @@ GLOBAL_LIST_EMPTY(ambient_npcs)
// =========================================================================
/**
- * A person who lives in the world: dressed as a random person in an outfit, protected against
- * being dragged, boxed, teleported or turned into something else, environment-proof, kept to a
- * leash, talking from a dialogue file and going about a routine of activities.
+ * A person who lives in the world: a real human body (voidcrew/modules/human_npcs/) with one random
+ * face for life (outpost_npc_looks.dm), dressed in an outfit whose kit is locked to them (owner
+ * decision D3), kept to a leash, talking from a dialogue file and going about a routine of
+ * activities. What they hold for an activity (a mop, a lit welder, a drink) is a real item in
+ * their hand.
*
- * Anyone can be killed. A body drops a little cash (`death_cash_low` to `death_cash_high`, capped
- * by their place) and any `death_loot`, once: never again after a revive. Hurting one at a trader
- * outpost is violence there, like hurting a visitor.
+ * Anyone can be killed, and their body is a person's: crit, bleeding, revival, carrying, bags and
+ * surgery work on it as on a player. A living, conscious one won't stay grabbed, buckled, cuffed or
+ * shut in a closet (their AI resists, as a person would), and at a trader outpost they refuse
+ * teleports. A body drops a little cash (`death_cash_low` to `death_cash_high`, capped by their
+ * place) and any `death_loot`, once: never again after a revive. Hurting one at a trader outpost is
+ * violence there, like hurting a visitor. They breathe and feel the cold like anyone: their outfit
+ * carries what their place needs (the base's site layers add a sealed suit and air where needed).
*/
-/mob/living/basic/ambient_npc
+/mob/living/carbon/human/npc/ambient_npc
name = "spacer"
desc = "Someone passing through."
- icon = 'icons/mob/simple/simple_human.dmi'
- icon_state = ""
gender = MALE
- unique_name = FALSE
- combat_mode = FALSE
- mob_biotypes = MOB_ORGANIC | MOB_HUMANOID
- sentience_type = SENTIENCE_HUMANOID
- // Nobody drags them off, and nobody pulls them out of their room
- move_resist = MOVE_FORCE_VERY_STRONG
- density = TRUE
- // A body stays where it fell (the planet sweep takes it with the fauna)
- basic_mob_flags = NONE
- maxHealth = 80
- health = 80
- // An unhurried walk
- speed = 2.5
- melee_damage_lower = 0
- melee_damage_upper = 0
- // Airless or frozen ground must not kill them in forty seconds (basic mob defaults do)
- unsuitable_atmos_damage = 0
- unsuitable_cold_damage = 0
- unsuitable_heat_damage = 0
- speak_emote = list("says")
- response_help_continuous = "talks to"
- response_help_simple = "talk to"
+ faction = list(FACTION_NEUTRAL)
ai_controller = /datum/ai_controller/basic_controller/ambient_npc
+ // The ones that fight back (planet fighters) stop once someone is down
+ npc_target_stat = HUMAN_NPC_SPARES_DOWNED
// ----- Look -----
- /// The outfit whose worn look they wear
+ /// The outfit they wear, its kit locked to them. Null for one picked by their npc_outfit_table.
var/outfit = /datum/outfit/job/assistant
/// If set, one of these is picked for `outfit` when they are made
var/list/outfit_choices
- /// Which person in that outfit (outpost_npc_looks.dm); random when null
- var/look_number
+ /// Their face for life: skin, hair and eyes (outpost_npc_looks.dm). Rolled when they are made, unless given.
+ var/datum/outpost_npc_look/person
/// Pick a random gender when made
var/random_gender = TRUE
/// Give them a random real name when made; a fixed `name` otherwise
var/random_name = TRUE
- /// "idle", "weld" and "tool" looks, for NPCs that do work (built when `work_weights` is set)
- var/list/work_looks
- /// What they hold, drawn in their hand as part of their look: an /obj/item type, or null
+ /// The item type they hold for show (a mop, a paper bag): a real one is put in their hand. Null for none.
var/held_visual
- /// "weld", "tool" or "carry": the work look shown now (null for none)
+ /// "weld", "tool" or "carry": what they hold for the work they do now (null for none)
var/work_look
- /// Bumped by every look build; an async build applies only if it is still the latest one
- var/look_serial = 0
- /// A real item they carry for an activity (a drink), in their contents, never dropped by a hit
+ /// The real item in their hand for `held_visual` or `work_look`, locked to them like their kit
+ var/obj/item/held_prop
+ /// The slot `held_prop` came off when it is their own (a belt pickaxe), where it goes back; NONE for a prop or a bag
+ var/held_prop_slot = NONE
+ /// A real item they carry for an activity (a drink): in their hand while they have it, not locked
var/obj/item/held_item
// ----- Death -----
@@ -164,7 +149,7 @@ GLOBAL_LIST_EMPTY(ambient_npcs)
/// Short text for the admin verb
var/name = "standing around"
/// Who is doing it
- var/mob/living/basic/ambient_npc/doer
+ var/mob/living/carbon/human/npc/ambient_npc/doer
/// Weakref to what it happens at, if anything
var/datum/weakref/anchor_ref
/// Where to go, or null where they stand
@@ -199,7 +184,7 @@ GLOBAL_LIST_EMPTY(ambient_npcs)
/// Short text for the admin verb
var/name = "somewhere"
/// The NPCs here, dead or alive, until they are deleted
- var/list/mob/living/basic/ambient_npc/npcs = list()
+ var/list/mob/living/carbon/human/npc/ambient_npc/npcs = list()
/// world.time anyone here may say a spontaneous line
var/next_line_at = 0
/// The zone band (ZONE_*) it lies in, if known
diff --git a/voidcrew/modules/ambient_npcs/ambient_activity.dm b/voidcrew/modules/ambient_npcs/ambient_activity.dm
index 4e0244be391..f0844a4b0ad 100644
--- a/voidcrew/modules/ambient_npcs/ambient_activity.dm
+++ b/voidcrew/modules/ambient_npcs/ambient_activity.dm
@@ -36,7 +36,7 @@
* current activity is finished and replaced. Returns the activity, or null if it could not be set
* up here or was outranked; a refused activity is deleted.
*/
-/mob/living/basic/ambient_npc/proc/start_activity(datum/ambient_activity/new_activity)
+/mob/living/carbon/human/npc/ambient_npc/proc/start_activity(datum/ambient_activity/new_activity)
if(QDELETED(new_activity))
return null
if(fading || stat == DEAD || (activity && activity.priority > new_activity.priority))
@@ -52,7 +52,7 @@
return new_activity
/// Stops their activity: it puts everything back and goes
-/mob/living/basic/ambient_npc/proc/end_activity()
+/mob/living/carbon/human/npc/ambient_npc/proc/end_activity()
if(!activity)
return
var/datum/ambient_activity/old = activity
@@ -61,7 +61,7 @@
qdel(old)
/// Their activity, or a new one from their routine. Null while they wait after a failure.
-/mob/living/basic/ambient_npc/proc/next_activity()
+/mob/living/carbon/human/npc/ambient_npc/proc/next_activity()
if(activity)
return activity
if(world.time < activity_retry_at)
@@ -75,7 +75,7 @@
* can be set up, then standing around. Override to choose by other rules (time spent, a bar, a
* stall). Returns the started activity or null.
*/
-/mob/living/basic/ambient_npc/proc/pick_activity()
+/mob/living/carbon/human/npc/ambient_npc/proc/pick_activity()
var/list/weights = routine?.Copy()
while(length(weights))
var/activity_type = pick_weight(weights)
@@ -85,7 +85,7 @@
return start_activity(new /datum/ambient_activity/idle(src))
/// One step of their activity where they stand: arriving the first time, then its business. Returns AMBIENT_STEP_*.
-/mob/living/basic/ambient_npc/proc/activity_step(seconds)
+/mob/living/carbon/human/npc/ambient_npc/proc/activity_step(seconds)
if(!activity)
return AMBIENT_STEP_DONE
if(!activity.arrived)
@@ -98,7 +98,7 @@
return activity.act(seconds)
/// A walk to their activity's spot ended stuck
-/mob/living/basic/ambient_npc/proc/travel_failed()
+/mob/living/carbon/human/npc/ambient_npc/proc/travel_failed()
if(++travel_failures < AMBIENT_TRAVEL_FAILURES_MAX)
return
travel_failures = 0
@@ -115,7 +115,7 @@
* activity; if nothing could be set up they stand somewhere out of the way, and their routine
* starts when someone comes. Override to start them at something in particular (settle_at()).
*/
-/mob/living/basic/ambient_npc/proc/settle_in()
+/mob/living/carbon/human/npc/ambient_npc/proc/settle_in()
// Where they were made is only somewhere on the floor: first somewhere they may stand
move_to_settle_tile()
for(var/attempt in 1 to AMBIENT_SETTLE_TRIES)
@@ -131,7 +131,7 @@
* (within `radius` of `near`, if given), then from others, up to `tries` places in all. For
* activities that look round where the NPC stands (the work loop). TRUE if settled.
*/
-/mob/living/basic/ambient_npc/proc/settle_at(activity_type, atom/anchor, tries = AMBIENT_SETTLE_TRIES, atom/near, radius = 6)
+/mob/living/carbon/human/npc/ambient_npc/proc/settle_at(activity_type, atom/anchor, tries = AMBIENT_SETTLE_TRIES, atom/near, radius = 6)
if(near || !standable(get_turf(src)))
move_to_settle_tile(near, radius)
for(var/attempt in 1 to tries)
@@ -147,7 +147,7 @@
* (arrive()) and sets it part-way in (settle()). Their leash is anchored where they end up. FALSE
* when they have no activity or its spot is taken.
*/
-/mob/living/basic/ambient_npc/proc/settle_here()
+/mob/living/carbon/human/npc/ambient_npc/proc/settle_here()
if(!activity)
return FALSE
if(!activity.at_spot())
@@ -168,7 +168,7 @@
return TRUE
/// Moves them (with nobody watching) to a free tile of their place's floor they could stand on, within `radius` of `near` if given. FALSE if there is none.
-/mob/living/basic/ambient_npc/proc/move_to_settle_tile(atom/near, radius = 6)
+/mob/living/carbon/human/npc/ambient_npc/proc/move_to_settle_tile(atom/near, radius = 6)
var/turf/tile = place?.settle_turf(src, near, radius)
if(!tile)
return FALSE
@@ -185,7 +185,7 @@
* where their place lets activities send them (an outpost's public floor). `ignore_floor` skips
* the place's floor (taking cover). Spots in `avoid` are skipped.
*/
-/mob/living/basic/ambient_npc/proc/standable(turf/tile, list/avoid, ignore_floor = FALSE)
+/mob/living/carbon/human/npc/ambient_npc/proc/standable(turf/tile, list/avoid, ignore_floor = FALSE)
if(!isturf(tile) || LAZYACCESS(avoid, tile))
return FALSE
if(!isopenturf(tile) || isspaceturf(tile) || isgroundlessturf(tile) || islava(tile) || ischasm(tile))
@@ -197,7 +197,7 @@
return ignore_floor || !place || place.spot_allowed(tile, src)
/// Whether they could stand about on `tile`: standable, and their place's loiter rules. `ignore` is not counted in the crowd (their chat partner).
-/mob/living/basic/ambient_npc/proc/loiter_spot_ok(turf/tile, list/avoid, atom/ignore)
+/mob/living/carbon/human/npc/ambient_npc/proc/loiter_spot_ok(turf/tile, list/avoid, atom/ignore)
return standable(tile, avoid) && (!place || place.loiter_ok(tile, src, ignore))
/**
@@ -205,7 +205,7 @@
* null. Right beside it (distance 1), nothing may stand between them (Adjacent(): no wall, glass or
* rail), since they use it from there.
*/
-/mob/living/basic/ambient_npc/proc/free_tile_beside(atom/thing, distance = 1, list/avoid, ignore_floor = FALSE)
+/mob/living/carbon/human/npc/ambient_npc/proc/free_tile_beside(atom/thing, distance = 1, list/avoid, ignore_floor = FALSE)
var/turf/center = get_turf(thing)
if(!center)
return null
@@ -223,7 +223,7 @@
return best
/// A random free tile within `radius` of `center` in the same area, or null
-/mob/living/basic/ambient_npc/proc/random_tile_near(turf/center, radius, list/avoid)
+/mob/living/carbon/human/npc/ambient_npc/proc/random_tile_near(turf/center, radius, list/avoid)
center = get_turf(center)
if(!center)
return null
@@ -239,7 +239,7 @@
* tiles, a couple of points for one with a wall, a table or a dense anchored machine at its side
* (somewhere to lean on). Or null.
*/
-/mob/living/basic/ambient_npc/proc/find_loiter_spot(atom/near, radius = AMBIENT_LOITER_RANGE, list/avoid)
+/mob/living/carbon/human/npc/ambient_npc/proc/find_loiter_spot(atom/near, radius = AMBIENT_LOITER_RANGE, list/avoid)
var/turf/center = get_turf(near)
if(!center)
return null
@@ -257,7 +257,7 @@
return best
/// A table right beside `thing`, or null
-/mob/living/basic/ambient_npc/proc/table_beside(atom/thing)
+/mob/living/carbon/human/npc/ambient_npc/proc/table_beside(atom/thing)
var/turf/center = get_turf(thing)
if(!center)
return null
@@ -271,7 +271,7 @@
* Whether they could sit on `seat`: loose on the floor, nobody on it, where they may go. Stools
* (bar stools too) refuse people by default; they are sat on with a forced buckle all the same.
*/
-/mob/living/basic/ambient_npc/proc/seat_usable(obj/structure/chair/seat, list/avoid)
+/mob/living/carbon/human/npc/ambient_npc/proc/seat_usable(obj/structure/chair/seat, list/avoid)
if(QDELETED(seat) || !isturf(seat.loc) || istype(seat, /obj/structure/chair/e_chair))
return FALSE
if(seat.has_buckled_mobs() && !(src in seat.buckled_mobs))
@@ -283,7 +283,7 @@
return seat.loc == loc || standable(seat.loc, avoid)
/// A random one of the three nearest seats within `range` of `near` they could sit on, beside a table if `needs_table`, in sight of `near`
-/mob/living/basic/ambient_npc/proc/find_seat(atom/near, range = AMBIENT_ACTIVITY_RANGE, needs_table = FALSE, list/avoid)
+/mob/living/carbon/human/npc/ambient_npc/proc/find_seat(atom/near, range = AMBIENT_ACTIVITY_RANGE, needs_table = FALSE, list/avoid)
var/turf/center = get_turf(near) || get_turf(src)
if(!center)
return null
@@ -302,7 +302,7 @@
return pick(nearest)
/// The nearest table within `range` of `near`, in sight of it, with room to stand at, or null
-/mob/living/basic/ambient_npc/proc/find_table(atom/near, range = AMBIENT_ACTIVITY_RANGE, list/avoid)
+/mob/living/carbon/human/npc/ambient_npc/proc/find_table(atom/near, range = AMBIENT_ACTIVITY_RANGE, list/avoid)
var/turf/center = get_turf(near) || get_turf(src)
if(!center)
return null
@@ -318,12 +318,12 @@
return best
/// Another ambient NPC within `range`, in sight, who is free to talk (awake, unplayed, doing nothing that can't wait, standing somewhere not already crowded), or null
-/mob/living/basic/ambient_npc/proc/find_chat_partner(range = AMBIENT_ACTIVITY_RANGE)
+/mob/living/carbon/human/npc/ambient_npc/proc/find_chat_partner(range = AMBIENT_ACTIVITY_RANGE)
var/turf/here = get_turf(src)
if(!here)
return null
var/list/options = list()
- for(var/mob/living/basic/ambient_npc/other in range(range, here))
+ for(var/mob/living/carbon/human/npc/ambient_npc/other in range(range, here))
if(other == src || other.client || !other.can_act())
continue
if(other.activity && !other.activity.accepts_company)
@@ -358,7 +358,8 @@
/**
* An ambient NPC's brain: passive (no targeting, so trader outpost turrets read it as harmless),
- * long paths for crossing a concourse, and nothing at all while idle (nobody near).
+ * long paths for crossing a concourse, and nothing at all while idle (nobody near). First it gets
+ * free of anything holding it, the way a person would.
*/
/datum/ai_controller/basic_controller/ambient_npc
blackboard = list()
@@ -366,7 +367,39 @@
ai_movement = /datum/ai_movement/jps/ambient
idle_behavior = null
max_target_distance = AMBIENT_PATH_LENGTH
- planning_subtrees = list(/datum/ai_planning_subtree/ambient_routine)
+ planning_subtrees = list(
+ /datum/ai_planning_subtree/ambient_escape,
+ /datum/ai_planning_subtree/ambient_routine,
+ )
+
+// The basic controller's check, except that cuffs don't stop them: a cuffed person works at the cuffs
+// (the human NPC base's rule, voidcrew/modules/human_npcs/human_npc_soft_crit.dm)
+/datum/ai_controller/basic_controller/ambient_npc/get_able_to_run()
+ return human_npc_ai_able_to_run(src)
+
+/**
+ * Getting free, as a person does with Resist: out of a grab, a buckle they didn't choose (their own
+ * seat or boat is fine), a closet or a crate, cuffs, or flames (stop, drop and roll). Only awake and
+ * up; anyone down is just a body.
+ */
+/datum/ai_planning_subtree/ambient_escape
+
+/datum/ai_planning_subtree/ambient_escape/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/carbon/human/npc/ambient_npc/npc = controller.pawn
+ if(!istype(npc) || npc.stat != CONSCIOUS || HAS_TRAIT(npc, TRAIT_INCAPACITATED) || LAZYLEN(npc.do_afters))
+ return
+ if(!ambient_wants_free(npc))
+ return
+ controller.queue_behavior(/datum/ai_behavior/resist)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/// Whether `npc` is held somewhere it doesn't want to be: grabbed, buckled to something not its own, shut in, cuffed or on fire
+/proc/ambient_wants_free(mob/living/carbon/human/npc/ambient_npc/npc)
+ if(npc.on_fire || npc.pulledby || HAS_TRAIT(npc, TRAIT_RESTRAINED))
+ return TRUE
+ if(npc.buckled && !npc.own_buckle(npc.buckled))
+ return TRUE
+ return !isturf(npc.loc) && !ismob(npc.loc)
// Their AI time, for the Ambient NPCs line in the MC tab (SSambient_npcs.note_ai_cost())
/datum/ai_controller/basic_controller/ambient_npc/SelectBehaviors(seconds_per_tick)
@@ -387,7 +420,7 @@
/datum/ai_planning_subtree/ambient_routine
/datum/ai_planning_subtree/ambient_routine/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/ambient_npc/npc = controller.pawn
+ var/mob/living/carbon/human/npc/ambient_npc/npc = controller.pawn
if(!istype(npc) || controller.ai_status != AI_STATUS_ON || !npc.can_act())
return
npc.check_leash()
@@ -396,6 +429,10 @@
var/datum/ambient_activity/current = npc.next_activity()
if(!current)
return
+ // A spot can be someone they follow, who may be gone by now
+ if(current.spot && QDELETED(current.spot))
+ current.spot_unreachable()
+ return
if(!current.at_spot())
controller.set_blackboard_key(BB_AMBIENT_DESTINATION, current.spot)
controller.queue_behavior(current.spot_distance ? /datum/ai_behavior/travel_towards/ambient/adjacent : /datum/ai_behavior/travel_towards/ambient, BB_AMBIENT_DESTINATION)
@@ -423,7 +460,7 @@
var/atom/target = controller.blackboard[target_key]
var/stuck = !succeeded && controller.consecutive_pathing_attempts > 0 && target && controller.current_movement_target == target
. = ..()
- var/mob/living/basic/ambient_npc/npc = controller.pawn
+ var/mob/living/carbon/human/npc/ambient_npc/npc = controller.pawn
if(!istype(npc))
return
if(succeeded)
@@ -441,11 +478,11 @@
behavior_flags = AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
/datum/ai_behavior/ambient_activity/setup(datum/ai_controller/controller)
- var/mob/living/basic/ambient_npc/npc = controller.pawn
+ var/mob/living/carbon/human/npc/ambient_npc/npc = controller.pawn
return istype(npc) && !!npc.activity
/datum/ai_behavior/ambient_activity/perform(seconds_per_tick, datum/ai_controller/controller)
- var/mob/living/basic/ambient_npc/npc = controller.pawn
+ var/mob/living/carbon/human/npc/ambient_npc/npc = controller.pawn
var/datum/ambient_activity/current = npc.activity
if(!current)
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED
@@ -463,7 +500,7 @@
// THE ACTIVITY BASE
// =========================================================================
-/datum/ambient_activity/New(mob/living/basic/ambient_npc/new_doer, atom/anchor)
+/datum/ambient_activity/New(mob/living/carbon/human/npc/ambient_npc/new_doer, atom/anchor)
. = ..()
doer = new_doer
anchor_ref = anchor ? WEAKREF(anchor) : null
@@ -771,8 +808,8 @@
set_duration()
lines_left = rand(3, 6)
// An NPC partner drops what it was doing and answers. `responding` is set before its setup runs, so it never invites back.
- if(istype(partner, /mob/living/basic/ambient_npc))
- var/mob/living/basic/ambient_npc/other = partner
+ if(istype(partner, /mob/living/carbon/human/npc/ambient_npc))
+ var/mob/living/carbon/human/npc/ambient_npc/other = partner
var/datum/ambient_activity/chat/answer = new(other, doer)
answer.responding = TRUE
answer.ends_at = ends_at + 10 SECONDS
@@ -822,7 +859,7 @@
return AMBIENT_STEP_DONE
if(responding)
// Only while the one who started it is still talking to them
- var/mob/living/basic/ambient_npc/starter = partner
+ var/mob/living/carbon/human/npc/ambient_npc/starter = partner
var/datum/ambient_activity/chat/their_chat = istype(starter) ? starter.activity : null
if(!istype(their_chat) || their_chat.partner() != doer)
return AMBIENT_STEP_DONE
@@ -840,7 +877,7 @@
if(lines_left-- <= 0)
return AMBIENT_STEP_DONE
next_line = world.time + rand(7 SECONDS, 12 SECONDS)
- var/mob/living/basic/ambient_npc/other = istype(partner, /mob/living/basic/ambient_npc) ? partner : null
+ var/mob/living/carbon/human/npc/ambient_npc/other = istype(partner, /mob/living/carbon/human/npc/ambient_npc) ? partner : null
var/list/conversation = opened ? null : doer.pick_conversation()
opened = TRUE
if(conversation)
@@ -871,7 +908,7 @@
if(!length(weights) || !isturf(doer.loc))
return FALSE
// Its room is worked out around where they stand now, and it keeps them in it until the job is done
- worker = doer.AddComponent(/datum/component/outpost_ambient_worker, weights, TRUE, CALLBACK(doer, TYPE_PROC_REF(/mob/living/basic/ambient_npc, show_work_look)))
+ worker = doer.AddComponent(/datum/component/outpost_ambient_worker, weights, TRUE, CALLBACK(doer, TYPE_PROC_REF(/mob/living/carbon/human/npc/ambient_npc, show_work_look)))
// A job whose spot they keep off (a doorway, a counter's reach) is skipped for the next one found
var/list/job
for(var/attempt in 1 to AMBIENT_WORK_FIND_TRIES)
@@ -955,7 +992,7 @@
/// world.time they give up walking and fade where they are
var/give_up_at = 0
-/datum/ambient_activity/leave/New(mob/living/basic/ambient_npc/new_doer, atom/anchor, delay = 0)
+/datum/ambient_activity/leave/New(mob/living/carbon/human/npc/ambient_npc/new_doer, atom/anchor, delay = 0)
. = ..()
wait_until = world.time + delay
@@ -1059,7 +1096,7 @@
/// How long the storm lasts
var/duration = 2 MINUTES
-/datum/ambient_activity/shelter/New(mob/living/basic/ambient_npc/new_doer, atom/anchor, duration)
+/datum/ambient_activity/shelter/New(mob/living/carbon/human/npc/ambient_npc/new_doer, atom/anchor, duration)
. = ..()
if(duration)
src.duration = duration
diff --git a/voidcrew/modules/ambient_npcs/ambient_admin.dm b/voidcrew/modules/ambient_npcs/ambient_admin.dm
index c41cf1527bc..bc78c3ca540 100644
--- a/voidcrew/modules/ambient_npcs/ambient_admin.dm
+++ b/voidcrew/modules/ambient_npcs/ambient_admin.dm
@@ -14,8 +14,8 @@ ADMIN_VERB(ambient_npc_spawn, R_ADMIN|R_DEBUG, "Ambient NPCs: Spawn", "Spawn an
to_chat(user, span_warning("You need a physical location to spawn at."))
return
var/list/choices = list()
- for(var/npc_type in subtypesof(/mob/living/basic/ambient_npc) + /mob/living/basic/ambient_npc)
- choices["NPC: [replacetext("[npc_type]", "/mob/living/basic/ambient_npc", "ambient_npc")]"] = npc_type
+ for(var/npc_type in subtypesof(/mob/living/carbon/human/npc/ambient_npc) + /mob/living/carbon/human/npc/ambient_npc)
+ choices["NPC: [replacetext("[npc_type]", "/mob/living/carbon/human/npc/ambient_npc", "ambient_npc")]"] = npc_type
for(var/datum/ambient_outpost_role/role as anything in SSambient_npcs.get_outpost_roles())
if(role.npc_type)
choices["Role: [role.name] ([role.type])"] = role
@@ -28,8 +28,8 @@ ADMIN_VERB(ambient_npc_spawn, R_ADMIN|R_DEBUG, "Ambient NPCs: Spawn", "Spawn an
var/obj/structure/overmap/trader_outpost/outpost = get_trader_outpost_for_turf(here)
var/datum/ambient_place/outpost/outpost_place = outpost ? SSambient_npcs.outpost_place(outpost) : null
var/result
- if(ispath(picked, /mob/living/basic/ambient_npc))
- var/mob/living/basic/ambient_npc/npc = new picked(here)
+ if(ispath(picked, /mob/living/carbon/human/npc/ambient_npc))
+ var/mob/living/carbon/human/npc/ambient_npc/npc = new picked(here)
npc.set_place(outpost_place)
result = npc
else if(istype(picked, /datum/ambient_outpost_role))
@@ -63,7 +63,7 @@ ADMIN_VERB(ambient_npc_list_sites, R_ADMIN|R_DEBUG, "Ambient NPCs: List Sites",
for(var/outpost in SSambient_npcs.outposts)
var/datum/ambient_place/outpost/place = SSambient_npcs.outposts[outpost]
lines += " [place.describe()]"
- for(var/mob/living/basic/ambient_npc/npc as anything in place.living_npcs())
+ for(var/mob/living/carbon/human/npc/ambient_npc/npc as anything in place.living_npcs())
lines += " [npc] ([npc.type]): [npc.activity?.name || "nothing"] [ADMIN_JMP(npc)]"
lines += "Planets"
for(var/key in SSambient_npcs.planets)
diff --git a/voidcrew/modules/ambient_npcs/ambient_npc.dm b/voidcrew/modules/ambient_npcs/ambient_npc.dm
index b7462a0d103..7de4be10de8 100644
--- a/voidcrew/modules/ambient_npcs/ambient_npc.dm
+++ b/voidcrew/modules/ambient_npcs/ambient_npc.dm
@@ -1,174 +1,324 @@
/**
* # World population: the base NPC
*
- * Owner: P0 seams (frozen). Packages subtype /mob/living/basic/ambient_npc in their own files and
- * override the procs marked "Override" below; they never edit this file.
+ * Owner: P0 seams. Packages subtype /mob/living/carbon/human/npc/ambient_npc in their own files and
+ * override the procs marked "Override" below.
*
- * What every ambient NPC gets (spec 2.2, 2.3, 2.5):
- * - a look: a random person in their outfit (outpost_npc_looks.dm), with working looks when they
- * do work at objects;
- * - protections: no dragging (a body neither), buckling, closets, crates or bags; no teleports,
- * polymorph or type change; SENTIENCE_HUMANOID (sentience, transference and lazarus refuse them);
- * immune to air, cold, heat and weather damage; a leash they walk back to, or fade from;
- * - killable: a body lies down and drops a little cash (and any `death_loot`) once, never again
- * after a revive; at a trader outpost, hurting one is violence there (the outpost's strikes, and
+ * Every ambient NPC is a real human body (voidcrew/modules/human_npcs/, phase E1 of the human NPC
+ * migration): wounds, bleeding, crit, death, revival, cuffs, stuns, drink and drugs work on them as
+ * on a player, through the same tg code. What every ambient NPC gets (spec 2.2, 2.3, 2.5):
+ * - a face for life (outpost_npc_looks.dm) and an outfit, its kit locked to them (owner decision D3);
+ * what they hold for an activity is a real item in their hand (set_held(), show_work_look());
+ * - a person's resistance: while awake and up, their AI breaks grabs, gets out of buckles it didn't
+ * choose, works at cuffs and climbs out of closets (/datum/ai_planning_subtree/ambient_escape); in
+ * crit or dead they are an ordinary body that can be dragged, carried, bagged and operated on. At a
+ * trader outpost a living one refuses teleports; nobody can polymorph them or change their type;
+ * - a leash they walk back to, or walk out from (they never vanish in front of players);
+ * - killable: a body drops a little cash (and any `death_loot`) once, never again after a revive. It
+ * lies until nobody is watching (SShuman_npcs' corpse rules; a trader outpost takes it sooner, as
+ * carried off). At a trader outpost, hurting one is violence there (the outpost's strikes, and
* everyone near ducks), and turrets never shoot them (FACTION_TURRET while they belong to it);
* - a passive AI: no targeting subtree, so outpost turrets never read them as wild hostiles;
* - dialogue from a JSON file with per-NPC and per-place cooldowns, replies to other NPCs, and an
- * answer for a player who talks to them (an empty hand);
+ * answer for a player who talks to them (an empty hand), which falls through to tg's help (shaking
+ * awake, patting out flames, helping up) while they are down, on fire or asleep;
* - reactions: being attacked, a fight at their outpost, the kingpin's shootout, a storm, the convoy.
*
+ * Documented deviation from a player (AM-17, a performance rule like the base's dormancy): at a trader
+ * outpost nobody is on, the living hold still. Their AI is off and their Life() does nothing
+ * (pause_routine()), so nothing about them moves on until someone comes.
+ *
* The routine (what they do from moment to moment) is in ambient_activity.dm.
*/
-/// What a hauling worker's carried look shows in hand
+/// What a hauling worker carries in hand
#define AMBIENT_CARRY_LOOK /obj/item/delivery/big
-/mob/living/basic/ambient_npc/Initialize(mapload)
- if(random_gender)
- gender = pick(MALE, FEMALE)
+/**
+ * `order` is the human NPC base's spawn order (ambient_build_npc()). Its look may carry an identity
+ * (a stray's stray_identity(): list("name", "gender", "outfit", "person")) that makes them someone
+ * who was here before.
+ */
+/mob/living/carbon/human/npc/ambient_npc/Initialize(mapload, datum/human_npc_order/order)
+ var/list/identity = order?.look
+ if(islist(identity))
+ order.look = null
+ take_identity(identity)
+ if(person)
+ gender = person.gender
+ else
+ if(random_gender)
+ gender = pick(MALE, FEMALE)
+ person = new_outpost_npc_person(gender)
if(length(outfit_choices))
outfit = pick(outfit_choices)
- if(isnull(look_number))
- look_number = random_outpost_npc_look_number()
+ else if(isnull(outfit) && ispath(npc_outfit_table, /datum/human_npc_outfit_table))
+ // Their kit by band (AM-1): a camp's yellow and red people are better kitted, never given more health
+ var/datum/human_npc_outfit_table/table = human_npc_singleton(npc_outfit_table)
+ outfit = table.pick_outfit(src, order ? order.resolve_zone() : (get_zone_type_for_player_turf(get_turf(src)) || ZONE_GREEN))
+ if(outfit)
+ npc_outfit = outfit
+ npc_name = random_name ? generate_random_name(gender) : name
. = ..()
- if(random_name)
- name = generate_random_name(gender)
- real_name = name
home = get_turf(src)
GLOB.ambient_npcs += src
- // A closet sweeps its tile without asking the drag path (#131); bags and boxes ask this trait
- add_traits(list(TRAIT_NO_CONTAINMENT, TRAIT_NO_STORAGE_INSERT, TRAIT_WEATHER_IMMUNE), AMBIENT_NPC_TRAIT)
- RegisterSignal(src, COMSIG_MOUSEDROP_ONTO, PROC_REF(refuse_drag))
RegisterSignal(src, COMSIG_MOVABLE_TELEPORTING, PROC_REF(refuse_teleport))
RegisterSignal(src, COMSIG_LIVING_PRE_WABBAJACKED, PROC_REF(refuse_polymorph))
RegisterSignal(src, COMSIG_PRE_MOB_CHANGED_TYPE, PROC_REF(refuse_type_change))
RegisterSignal(src, COMSIG_ATOM_WAS_ATTACKED, PROC_REF(on_attacked))
AddElement(/datum/element/relay_attackers)
- AddElement(/datum/element/footstep, footstep_type = FOOTSTEP_MOB_SHOE)
+ set_pace(running = FALSE)
next_line_at = world.time + rand(AMBIENT_SPEECH_COOLDOWN_LOW, AMBIENT_SPEECH_COOLDOWN_HIGH) * speech_pace
- // Dressing a dummy can sleep
- INVOKE_ASYNC(src, PROC_REF(build_look))
+ refresh_hands()
-/mob/living/basic/ambient_npc/Destroy()
+/mob/living/carbon/human/npc/ambient_npc/Destroy()
end_activity()
- set_held(null)
+ QDEL_NULL(held_prop)
QDEL_NULL(held_item)
seat_ref = null
set_place(null)
GLOB.ambient_npcs -= src
home = null
leash_bounds = null
+ person = null
return ..()
+/// Becomes the person `identity` describes (stray_identity()): their face, gender, outfit and name. Before Initialize's parent.
+/mob/living/carbon/human/npc/ambient_npc/proc/take_identity(list/identity)
+ var/datum/outpost_npc_look/face = identity["person"]
+ if(istype(face))
+ person = face.copy()
+ random_gender = FALSE
+ else if(identity["gender"] == MALE || identity["gender"] == FEMALE)
+ random_gender = FALSE
+ gender = identity["gender"]
+ if(ispath(identity["outfit"], /datum/outfit))
+ outfit_choices = null
+ outfit = identity["outfit"]
+ if(istext(identity["name"]))
+ random_name = FALSE
+ name = identity["name"]
+
+/// Who they are, to make the same person again later (spawn_npc(identity =))
+/mob/living/carbon/human/npc/ambient_npc/proc/ambient_identity()
+ return list("name" = real_name, "gender" = gender, "outfit" = outfit, "person" = person?.copy())
+
+// Their own face, for life, rather than a new random one
+/mob/living/carbon/human/npc/ambient_npc/npc_apply_random_look()
+ dna.initialize_dna(newblood_type = random_human_blood_type(), create_mutation_blocks = FALSE, randomize_features = TRUE)
+ person ||= new_outpost_npc_person(gender)
+ person.apply_to(src)
+
+// What they are, after what anyone can see of them (their kit and their body)
+/mob/living/carbon/human/npc/ambient_npc/examine(mob/user)
+ . = ..()
+ if(desc && stat != DEAD)
+ . += span_notice(desc)
+
// =========================================================================
-// LOOK
+// WHAT THEY HOLD
// =========================================================================
/**
- * Dresses them as person `look_number` of their gender in `outfit`, holding whatever `work_look`
- * or `held_visual` calls for, the way a player holds an item: a dummy built in the same outfit,
- * with a real item in hand, cached (outpost_npc_looks.dm). Can sleep.
+ * Puts what their work (`work_look`) or their activity (`held_visual`) calls for in their hand, as a
+ * real item: a lit welder with any welding visor down, a wrench, a parcel, a mop, a weapon. A weapon
+ * or tool they carry on them (a belt, a pocket, a bag) is taken out and put back later; anything else
+ * is a prop, locked to them like their kit and deleted when they put it away. Their drink
+ * (`held_item`) stays in its own hand.
*/
-/mob/living/basic/ambient_npc/proc/build_look()
+/mob/living/carbon/human/npc/ambient_npc/proc/refresh_hands()
if(QDELETED(src))
return
- var/serial = ++look_serial
- if(length(work_weights))
- work_looks = get_outpost_worker_looks(outfit, gender, look_number)
- var/look
- if((work_look == "weld" || work_look == "tool") && work_looks)
- look = work_looks[work_look]
+ var/wanted_type
+ switch(work_look)
+ if("weld")
+ wanted_type = /obj/item/weldingtool
+ if("tool")
+ wanted_type = /obj/item/wrench
+ if("carry")
+ wanted_type = AMBIENT_CARRY_LOOK
+ wanted_type ||= held_visual
+ set_outpost_worker_visors(src, up = work_look != "weld")
+ if(held_prop && (QDELETED(held_prop) || !is_holding(held_prop)))
+ held_prop = null
+ held_prop_slot = NONE
+ if(held_prop && wanted_type && istype(held_prop, wanted_type))
+ light_prop(held_prop)
+ return
+ put_away_prop()
+ if(!wanted_type)
+ return
+ // Already in a hand (a spear or a cleaver their outfit put there)
+ for(var/obj/item/in_hand in held_items)
+ if(istype(in_hand, wanted_type) && in_hand != held_item)
+ held_prop = in_hand
+ light_prop(in_hand)
+ return
+ var/obj/item/carried = carried_item_of(wanted_type)
+ var/carried_slot = carried ? get_slot_by_item(carried) : NONE
+ if(carried && human_npc_take_in_hand(src, carried))
+ held_prop = carried
+ held_prop_slot = carried_slot
else
- var/hand = (work_look == "carry") ? AMBIENT_CARRY_LOOK : held_visual
- if(hand)
- look = get_outpost_held_look(outfit, gender, look_number, hand)
- else if(work_looks)
- look = work_looks["idle"]
- else
- look = get_outpost_npc_look(outfit, gender, look_number)
- // A later build already landed while this one slept; leave its look alone.
- if(QDELETED(src) || serial != look_serial)
+ var/obj/item/prop = new wanted_type(src)
+ if(!put_in_hands(prop))
+ qdel(prop)
+ return
+ npc_lock_item(prop)
+ ADD_TRAIT(prop, TRAIT_AMBIENT_PROP, AMBIENT_NPC_TRAIT)
+ held_prop = prop
+ light_prop(held_prop)
+
+/// Something of `item_type` they carry on them but don't hold (a belt, a pocket, a bag), or null
+/mob/living/carbon/human/npc/ambient_npc/proc/carried_item_of(item_type)
+ for(var/obj/item/thing as anything in get_all_contents_type(item_type))
+ if(is_holding(thing) || thing == held_item || !human_npc_can_draw(src, thing))
+ continue
+ return thing
+ return null
+
+/// A welder for welding is lit; any other prop is left as it is
+/mob/living/carbon/human/npc/ambient_npc/proc/light_prop(obj/item/prop)
+ var/obj/item/weldingtool/welder = prop
+ if(istype(welder) && welder.welding != (work_look == "weld"))
+ welder.set_welding(work_look == "weld")
+ welder.update_appearance()
+
+/// Puts down what they held for show: a prop goes, something of their own goes back where it came from
+/mob/living/carbon/human/npc/ambient_npc/proc/put_away_prop()
+ var/obj/item/prop = held_prop
+ var/home_slot = held_prop_slot
+ held_prop = null
+ held_prop_slot = NONE
+ if(QDELETED(prop))
+ return
+ if(HAS_TRAIT(prop, TRAIT_AMBIENT_PROP))
+ qdel(prop)
return
- apply_outpost_npc_look(src, look)
- // Applying a look wipes every overlay, sparks included: put the work loop's back.
- var/datum/component/outpost_ambient_worker/worker = GetComponent(/datum/component/outpost_ambient_worker)
- if(worker?.work_overlay)
- add_overlay(worker.work_overlay)
-
-/// Redresses them in `new_outfit` (a new job, a disguise). Can be called from anywhere; the look is built async.
-/mob/living/basic/ambient_npc/proc/set_outfit(new_outfit)
- outfit = new_outfit
- work_looks = null
- INVOKE_ASYNC(src, PROC_REF(build_look))
+ var/obj/item/weldingtool/welder = prop
+ if(istype(welder) && welder.welding)
+ welder.set_welding(FALSE)
+ if(is_holding(prop) && !(home_slot && equip_to_slot_if_possible(prop, home_slot, disable_warning = TRUE)))
+ prop.equip_to_best_slot(src)
/// Shows them holding what `look` needs ("weld", "tool", "carry"), or their held item / empty hands for null. The worker component calls this.
-/mob/living/basic/ambient_npc/proc/show_work_look(look)
+/mob/living/carbon/human/npc/ambient_npc/proc/show_work_look(look)
+ if(work_look == look)
+ return
work_look = look
- INVOKE_ASYNC(src, PROC_REF(build_look))
+ refresh_hands()
-/// Shows `look` (an item type, or an item instance) in their hand as part of their look; null shows empty hands. A change that ends up the same item type is not rebuilt.
-/mob/living/basic/ambient_npc/proc/set_held(look)
+/**
+ * Holds `look` (an item type, or an item instance) for show; null shows empty hands. Their own
+ * drink (`held_item`) goes into their hand as it is. A change that ends up the same item type keeps
+ * the item they already hold.
+ */
+/mob/living/carbon/human/npc/ambient_npc/proc/set_held(look)
+ if(isitem(look) && look == held_item)
+ var/obj/item/drink = held_item
+ if(!QDELETED(drink) && !is_holding(drink))
+ if(drink.loc == src)
+ temporarilyRemoveItemFromInventory(drink, force = TRUE)
+ if(!put_in_hands(drink))
+ drink.forceMove(src)
+ look = null
var/new_held = ambient_held_look_type(look)
- if(new_held == held_visual)
+ if(new_held == held_visual && (!new_held || held_prop))
return
held_visual = new_held
- INVOKE_ASYNC(src, PROC_REF(build_look))
+ refresh_hands()
+
+/// Walking (an unhurried pace about their business) or running (a fight, getting away)
+/mob/living/carbon/human/npc/ambient_npc/proc/set_pace(running)
+ var/wanted = running ? MOVE_INTENT_RUN : MOVE_INTENT_WALK
+ if(move_intent != wanted)
+ move_intent = wanted
+ update_move_intent_slowdown()
/// Fades in where they stand, as someone stepping off the lift
-/mob/living/basic/ambient_npc/proc/fade_in()
+/mob/living/carbon/human/npc/ambient_npc/proc/fade_in()
alpha = 0
animate(src, alpha = 255, time = AMBIENT_FADE_TIME)
/**
- * Gone: they fade and are deleted (walked off, took the lift, slipped away). Nothing starts once
- * this has. `instant` deletes them now, for places nobody is watching.
+ * Gone (walked off, took the lift, slipped away), if they may go now: up and free, and on their way
+ * out tile or out of every player's sight (npc_may_vanish_now()). They fade over AMBIENT_FADE_TIME and
+ * are deleted; anything that puts them down, grabs or buckles them meanwhile stops it (no godmode: a
+ * shot still lands). One who may not go yet (a player is watching them away from the exit) walks out
+ * instead. `instant` deletes them now, for places nobody is watching. Returns TRUE if they are going.
*/
-/mob/living/basic/ambient_npc/proc/fade_out(instant = FALSE)
+/mob/living/carbon/human/npc/ambient_npc/proc/fade_out(instant = FALSE)
if(fading || QDELETED(src))
- return
+ return fading
+ if(instant)
+ fading = TRUE
+ end_activity()
+ qdel(src)
+ return TRUE
+ if(!npc_may_vanish_now())
+ if(stat == CONSCIOUS && !istype(activity, /datum/ambient_activity/leave))
+ start_activity(new /datum/ambient_activity/leave(src))
+ return FALSE
fading = TRUE
end_activity()
ADD_TRAIT(src, TRAIT_AI_PAUSED, AMBIENT_NPC_TRAIT)
- if(instant)
- qdel(src)
- return
- ADD_TRAIT(src, TRAIT_GODMODE, AMBIENT_NPC_TRAIT)
animate(src, alpha = 0, time = AMBIENT_FADE_TIME)
- QDEL_IN(src, AMBIENT_FADE_TIME)
+ addtimer(CALLBACK(src, PROC_REF(finish_fade)), AMBIENT_FADE_TIME, TIMER_DELETE_ME)
+ return TRUE
-/// Scales their health by `multiplier` (a planet NPC by band at its spawn site, never on the type)
-/mob/living/basic/ambient_npc/proc/scale_health(multiplier)
- if(multiplier <= 0 || multiplier == 1)
+/// The end of a fade: gone, unless something stopped them on the way
+/mob/living/carbon/human/npc/ambient_npc/proc/finish_fade()
+ if(QDELETED(src))
+ return
+ if(stat == CONSCIOUS && !human_npc_out_of_fight(src) && !pulledby && (!buckled || own_buckle(buckled)) && isturf(loc))
+ npc_drop_not_gear()
+ qdel(src)
return
- maxHealth = round(maxHealth * multiplier)
- health = maxHealth
- updatehealth()
+ // Shot, grabbed or put down on the way: they are still here
+ fading = FALSE
+ REMOVE_TRAIT(src, TRAIT_AI_PAUSED, AMBIENT_NPC_TRAIT)
+ animate(src, alpha = 255, time = 0.2 SECONDS)
+
+/**
+ * Whether they may slip away right now (the base's rule for anyone walking out, N8): awake, up and
+ * free (not in crit, cuffed, stunned, pulled, buckled to anything but their own seat, or carried),
+ * and on their place's way out or out of every player's sight.
+ */
+/mob/living/carbon/human/npc/ambient_npc/proc/npc_may_vanish_now()
+ if(stat != CONSCIOUS || human_npc_out_of_fight(src) || INCAPACITATED_IGNORING(src, NONE))
+ return FALSE
+ if(pulledby || !isturf(loc) || (buckled && !own_buckle(buckled)))
+ return FALSE
+ var/turf/exit = place?.exit_turf(src)
+ if(exit && get_dist(src, exit) <= 1)
+ return TRUE
+ return !human_npc_watched(src)
// =========================================================================
// PROTECTIONS
// =========================================================================
-/// Nobody drag-drops them onto a bed, into a crate, a disposal unit or a vehicle
-/mob/living/basic/ambient_npc/proc/refuse_drag(datum/source, atom/over, mob/user)
- SIGNAL_HANDLER
- return COMPONENT_CANCEL_MOUSEDROP_ONTO
-
-/// Teleports of any kind, forced ones included, leave them where they are
-/mob/living/basic/ambient_npc/proc/refuse_teleport(datum/source, atom/destination, channel)
+/// At a trader outpost, a living person's teleports of any kind, forced ones too, leave them where they are
+/mob/living/carbon/human/npc/ambient_npc/proc/refuse_teleport(datum/source, atom/destination, channel)
SIGNAL_HANDLER
+ if(stat == DEAD || !istype(place, /datum/ambient_place/outpost))
+ return NONE
return TRUE
-/mob/living/basic/ambient_npc/proc/refuse_polymorph(datum/source, what_to_randomize)
+/mob/living/carbon/human/npc/ambient_npc/proc/refuse_polymorph(datum/source, what_to_randomize)
SIGNAL_HANDLER
return STOP_WABBAJACK
-/mob/living/basic/ambient_npc/proc/refuse_type_change(datum/source)
+/mob/living/carbon/human/npc/ambient_npc/proc/refuse_type_change(datum/source)
SIGNAL_HANDLER
return COMPONENT_BLOCK_MOB_CHANGE
+/// Whether being buckled to `thing` is their own doing (the seat they sat on), so their AI leaves it be. Override (a boat).
+/mob/living/carbon/human/npc/ambient_npc/proc/own_buckle(atom/thing)
+ return !isnull(thing) && thing == seat_ref?.resolve()
+
// Their own steps stay on the leash. Dragged, thrown, buckled or walked by a script, they go where they are taken.
-/mob/living/basic/ambient_npc/Move(atom/newloc, direct, glide_size_override)
+/mob/living/carbon/human/npc/ambient_npc/Move(atom/newloc, direct, glide_size_override)
if(!own_step_allowed(newloc))
return FALSE
return ..()
@@ -177,7 +327,7 @@
* Whether a step of their own onto `newloc` is allowed: onto their leash always; off it from on it
* never; already off it (shoved, thrown), anywhere safe, so they can walk back.
*/
-/mob/living/basic/ambient_npc/proc/own_step_allowed(atom/newloc)
+/mob/living/carbon/human/npc/ambient_npc/proc/own_step_allowed(atom/newloc)
if(!isturf(newloc) || !isturf(loc) || pulledby || buckled || throwing || stat == DEAD)
return TRUE
var/turf/destination = newloc
@@ -192,7 +342,7 @@
* on their place's ground (an outpost's concourse, a planet's ground above its dock strip).
* Override for a leash of another shape.
*/
-/mob/living/basic/ambient_npc/proc/leash_ok(turf/tile)
+/mob/living/carbon/human/npc/ambient_npc/proc/leash_ok(turf/tile)
tile = get_turf(tile)
if(!tile)
return FALSE
@@ -207,7 +357,7 @@
* AMBIENT_LEASH_GIVE_UP, or somewhere they cannot walk back from, they give up (give_up_leash()).
* TRUE while they are off it.
*/
-/mob/living/basic/ambient_npc/proc/check_leash()
+/mob/living/carbon/human/npc/ambient_npc/proc/check_leash()
var/turf/here = get_turf(src)
if(!here || leash_ok(here))
leash_broken_at = 0
@@ -225,7 +375,7 @@
return TRUE
/// They cannot get back to their leash: they slip away. Override to put them home instead.
-/mob/living/basic/ambient_npc/proc/give_up_leash()
+/mob/living/carbon/human/npc/ambient_npc/proc/give_up_leash()
fade_out()
// =========================================================================
@@ -233,7 +383,7 @@
// =========================================================================
/// Moves them to `new_place` (or none), keeping both places' lists right
-/mob/living/basic/ambient_npc/proc/set_place(datum/ambient_place/new_place)
+/mob/living/carbon/human/npc/ambient_npc/proc/set_place(datum/ambient_place/new_place)
if(place == new_place)
return
var/datum/ambient_place/old_place = place
@@ -241,9 +391,10 @@
old_place?.remove_npc(src)
new_place?.add_npc(src)
-/// Whether they can do anything: awake, on their feet or in a seat, not fading
-/mob/living/basic/ambient_npc/proc/can_act()
- return stat == CONSCIOUS && !fading && !HAS_TRAIT(src, TRAIT_INCAPACITATED)
+/// Whether they can go about their business: awake, on their feet or in a seat, not cuffed, not fading
+/mob/living/carbon/human/npc/ambient_npc/proc/can_act()
+ return stat == CONSCIOUS && !fading && !HAS_TRAIT(src, TRAIT_INCAPACITATED) && !HAS_TRAIT(src, TRAIT_RESTRAINED)
+
// =========================================================================
// HOLDING STILL (nobody at their outpost)
@@ -251,24 +402,25 @@
/**
* Nobody is at their outpost: they stop where they are, mid-whatever. Their AI goes off
- * (TRAIT_AI_PAUSED), and resume_routine() later moves everything they wait for on by as long as
- * they stood, so nothing they do runs on while nobody watches. Override to put away anything that
- * would tick on by itself; call the parent.
+ * (TRAIT_AI_PAUSED) and their Life() does nothing, and resume_routine() later moves everything they
+ * wait for on by as long as they stood, so nothing they do runs on while nobody watches. Override to
+ * put away anything that would tick on by itself; call the parent.
*/
-/mob/living/basic/ambient_npc/proc/pause_routine()
+/mob/living/carbon/human/npc/ambient_npc/proc/pause_routine()
if(paused_at)
return
paused_at = max(world.time, 1)
ADD_TRAIT(src, TRAIT_AI_PAUSED, AMBIENT_PAUSED_TRAIT)
-// Holding still at an empty outpost: nothing about them moves on (they are proof against air, cold and heat anyway)
-/mob/living/basic/ambient_npc/Life(seconds_per_tick = SSMOBS_DT, times_fired)
- if(paused_at && !client)
- return
+// Holding still at an empty outpost: nothing about the living moves on (a documented performance rule,
+// AM-17, like the base's dormancy). A body runs its Life() as any other NPC corpse does.
+/mob/living/carbon/human/npc/ambient_npc/Life(seconds_per_tick = SSMOBS_DT, times_fired)
+ if(paused_at && !client && stat != DEAD)
+ return FALSE
return ..()
/// Someone is back: they carry on from where they stopped. Override to bring back what pause_routine() put away; call the parent.
-/mob/living/basic/ambient_npc/proc/resume_routine()
+/mob/living/carbon/human/npc/ambient_npc/proc/resume_routine()
if(!paused_at)
return
var/stood = world.time - paused_at
@@ -281,7 +433,7 @@
* They stood still for `delay`: every world.time they wait for (their next line, the end of their
* visit, their activity's steps) moves on by as much. Override for your own; call the parent.
*/
-/mob/living/basic/ambient_npc/proc/shift_times(delay)
+/mob/living/carbon/human/npc/ambient_npc/proc/shift_times(delay)
next_line_at = ambient_shifted(next_line_at, delay)
activity_retry_at = ambient_shifted(activity_retry_at, delay)
leash_broken_at = ambient_shifted(leash_broken_at, delay)
@@ -291,21 +443,38 @@
// DEATH
// =========================================================================
-/mob/living/basic/ambient_npc/death(gibbed)
+/mob/living/carbon/human/npc/ambient_npc/death(gibbed)
var/was_alive = stat != DEAD
+ if(was_alive)
+ // Before the base starts counting: a trader outpost carries its dead off sooner
+ npc_corpse_lifetime = corpse_lifetime()
. = ..()
- if(!was_alive)
+ if(!was_alive || stat != DEAD)
return
end_activity()
- set_held(null)
- SEND_SIGNAL(src, COMSIG_AMBIENT_NPC_DIED, place)
+ if(crouching)
+ crouching = FALSE
+ remove_offsets(AMBIENT_NPC_TRAIT)
if(!death_counted)
death_counted = TRUE
+ SEND_SIGNAL(src, COMSIG_AMBIENT_NPC_DIED, place)
place?.npc_died(src)
drop_loot()
+/**
+ * How long their body lies before SShuman_npcs may take it, once nobody is near (its corpse rules,
+ * N9): a trader outpost's dead go after AMBIENT_OUTPOST_BODY_TIME, as if carried off; a ship's
+ * deckhands stay with their crew; anyone else as any NPC corpse does.
+ */
+/mob/living/carbon/human/npc/ambient_npc/proc/corpse_lifetime()
+ if(istype(place, /datum/ambient_place/outpost))
+ return AMBIENT_OUTPOST_BODY_TIME
+ if(istype(place, /datum/ambient_place/ship))
+ return 0
+ return HUMAN_NPC_CORPSE_LIFETIME
+
/// Their cash and death loot, once: a revived NPC killed again drops nothing
-/mob/living/basic/ambient_npc/proc/drop_loot()
+/mob/living/carbon/human/npc/ambient_npc/proc/drop_loot()
if(loot_dropped)
return
loot_dropped = TRUE
@@ -320,17 +489,6 @@
for(var/item_type in death_loot)
new item_type(drop_turf)
-// A body lies down, and gets up again if they are revived. Types that turn as they lie (rotate_on_lying) turn by themselves.
-/mob/living/basic/ambient_npc/look_dead()
- . = ..()
- if(!rotate_on_lying)
- transform = matrix().Turn(90)
-
-/mob/living/basic/ambient_npc/look_alive()
- . = ..()
- if(!rotate_on_lying)
- transform = matrix()
-
// =========================================================================
// DIALOGUE
// =========================================================================
@@ -364,7 +522,7 @@
* The lines they have for `context`: their own section, then their file's "any" section, then the
* core file's "default" section. Override to add lines from elsewhere (a trader's shop).
*/
-/mob/living/basic/ambient_npc/proc/get_lines(context)
+/mob/living/carbon/human/npc/ambient_npc/proc/get_lines(context)
var/list/lines = ambient_dialogue_lines(dialogue_file, dialogue_section, context)
if(!length(lines))
lines = ambient_dialogue_lines(dialogue_file, "any", context)
@@ -375,7 +533,7 @@
return lines
/// A random two-person exchange from their section's "conversations": list(opener, reply), or null
-/mob/living/basic/ambient_npc/proc/pick_conversation()
+/mob/living/carbon/human/npc/ambient_npc/proc/pick_conversation()
var/list/entry = ambient_dialogue_section(dialogue_file, dialogue_section)
var/list/conversations = entry?["conversations"]
if(!length(conversations))
@@ -387,17 +545,17 @@
return list(conversation["opener"], length(replies) ? pick(replies) : null)
/// Their first name, as someone would call them
-/mob/living/basic/ambient_npc/proc/speech_name()
+/mob/living/carbon/human/npc/ambient_npc/proc/speech_name()
var/list/parts = splittext(real_name || name, " ")
return length(parts) ? parts[1] : name
/// Fills a line's placeholders: {name} their first name, {other} who they talk to, {place} where they are
-/mob/living/basic/ambient_npc/proc/fill_line(line, atom/other)
+/mob/living/carbon/human/npc/ambient_npc/proc/fill_line(line, atom/other)
line = replacetext(line, "{name}", speech_name())
if(findtext(line, "{other}"))
var/other_name = "friend"
- if(istype(other, /mob/living/basic/ambient_npc))
- var/mob/living/basic/ambient_npc/other_npc = other
+ if(istype(other, /mob/living/carbon/human/npc/ambient_npc))
+ var/mob/living/carbon/human/npc/ambient_npc/other_npc = other
other_name = other_npc.speech_name()
else if(ismob(other))
var/mob/other_mob = other
@@ -410,7 +568,7 @@
* Says a line for `context` (to `other`, if given). A spontaneous line waits out their own pause and
* the pause shared by their place; `force` skips both (replies, reactions). TRUE if they spoke.
*/
-/mob/living/basic/ambient_npc/proc/speak_context(context, atom/other, force = FALSE)
+/mob/living/carbon/human/npc/ambient_npc/proc/speak_context(context, atom/other, force = FALSE)
if(stat != CONSCIOUS || fading)
return FALSE
if(!force && (world.time < next_line_at || (place && world.time < place.next_line_at)))
@@ -425,7 +583,7 @@
return TRUE
/// Says `line` now and starts their pauses. Never sleeps.
-/mob/living/basic/ambient_npc/proc/say_line(line)
+/mob/living/carbon/human/npc/ambient_npc/proc/say_line(line)
if(!line || stat != CONSCIOUS)
return
next_line_at = world.time + rand(AMBIENT_SPEECH_COOLDOWN_LOW, AMBIENT_SPEECH_COOLDOWN_HIGH) * speech_pace
@@ -437,10 +595,10 @@
* Answers `speaker` a moment from now: `line` if given, otherwise a line for `context`. Only if
* they are still awake and near each other then.
*/
-/mob/living/basic/ambient_npc/proc/reply_to(atom/movable/speaker, context = AMBIENT_LINE_REPLY, line)
+/mob/living/carbon/human/npc/ambient_npc/proc/reply_to(atom/movable/speaker, context = AMBIENT_LINE_REPLY, line)
addtimer(CALLBACK(src, PROC_REF(do_reply), WEAKREF(speaker), context, line), rand(AMBIENT_REPLY_DELAY_LOW, AMBIENT_REPLY_DELAY_HIGH), TIMER_DELETE_ME)
-/mob/living/basic/ambient_npc/proc/do_reply(datum/weakref/speaker_ref, context, line)
+/mob/living/carbon/human/npc/ambient_npc/proc/do_reply(datum/weakref/speaker_ref, context, line)
var/atom/movable/speaker = speaker_ref?.resolve()
if(QDELETED(speaker) || stat != CONSCIOUS || fading || get_dist(src, speaker) > 3)
return
@@ -455,15 +613,21 @@
// PLAYERS
// =========================================================================
-// An empty hand talks to them; combat mode or a right click is the usual attack or shove
-/mob/living/basic/ambient_npc/attack_hand(mob/living/carbon/human/user, list/modifiers)
- if(!user.combat_mode && !LAZYACCESS(modifiers, RIGHT_CLICK) && can_act())
+// An empty hand talks to them while they are up and about; down, on fire or asleep it is tg's help
+// (helping them up, patting out the flames, shaking them awake, CPR). Combat mode or a right click is
+// the usual attack or shove.
+/mob/living/carbon/human/npc/ambient_npc/attack_hand(mob/living/carbon/human/user, list/modifiers)
+ if(!user.combat_mode && !LAZYACCESS(modifiers, RIGHT_CLICK) && can_be_talked_to())
talked_to(user)
return TRUE
return ..()
+/// Whether an empty hand talks to them now, rather than tg's help: up and about, and not on fire
+/mob/living/carbon/human/npc/ambient_npc/proc/can_be_talked_to()
+ return can_act() && !on_fire && body_position == STANDING_UP
+
/// Whether `user` may have another answer yet, and starts their wait if so
-/mob/living/basic/ambient_npc/proc/talk_ready(mob/user)
+/mob/living/carbon/human/npc/ambient_npc/proc/talk_ready(mob/user)
var/key = REF(user)
if(LAZYACCESS(talk_cooldowns, key) > world.time)
return FALSE
@@ -474,7 +638,7 @@
return TRUE
/// `user` talked to them (an empty hand). Override for a menu (a stray's "Come with us").
-/mob/living/basic/ambient_npc/proc/talked_to(mob/living/user)
+/mob/living/carbon/human/npc/ambient_npc/proc/talked_to(mob/living/user)
if(!talk_ready(user))
return
if(!buckled)
@@ -486,13 +650,13 @@
// =========================================================================
/// Whether a reaction of `kind` may happen now, and starts its cooldown if so
-/mob/living/basic/ambient_npc/proc/reaction_ready(kind, cooldown = AMBIENT_REACTION_COOLDOWN)
+/mob/living/carbon/human/npc/ambient_npc/proc/reaction_ready(kind, cooldown = AMBIENT_REACTION_COOLDOWN)
if(LAZYACCESS(reaction_cooldowns, kind) > world.time)
return FALSE
LAZYSET(reaction_cooldowns, kind, world.time + cooldown)
return TRUE
-/mob/living/basic/ambient_npc/proc/on_attacked(datum/source, atom/attacker, attack_flags)
+/mob/living/carbon/human/npc/ambient_npc/proc/on_attacked(datum/source, atom/attacker, attack_flags)
SIGNAL_HANDLER
if(!(attack_flags & (ATTACKER_DAMAGING_ATTACK | ATTACKER_STAMINA_ATTACK | ATTACKER_SHOVING)))
return
@@ -504,7 +668,7 @@
* Someone went for them. Override: a planet NPC fights back or runs (PB). The default is a line,
* and at a trader outpost they duck out to the lift. Never sleeps.
*/
-/mob/living/basic/ambient_npc/proc/react_attacked(atom/attacker)
+/mob/living/carbon/human/npc/ambient_npc/proc/react_attacked(atom/attacker)
if(stat != CONSCIOUS || fading || !reaction_ready("attacked"))
return
speak_context(AMBIENT_LINE_ATTACKED, attacker, force = TRUE)
@@ -515,7 +679,7 @@
* A fight broke out near them at their outpost (COMSIG_TRADER_OUTPOST_VIOLENCE): they duck, then
* head for the lift and leave. Override to stay (a barkeep). Never sleeps.
*/
-/mob/living/basic/ambient_npc/proc/react_violence(mob/living/offender)
+/mob/living/carbon/human/npc/ambient_npc/proc/react_violence(mob/living/offender)
if(stat != CONSCIOUS || fading || istype(activity, /datum/ambient_activity/leave) || !reaction_ready("violence"))
return
// Leaving first: starting it finishes what they were doing, which stands them up
@@ -528,7 +692,7 @@
speak_context(AMBIENT_LINE_VIOLENCE, offender, force = TRUE)
/// The kingpin's crew is fighting: they head for `refuge` and keep their heads down. Never sleeps.
-/mob/living/basic/ambient_npc/proc/react_shootout(turf/refuge)
+/mob/living/carbon/human/npc/ambient_npc/proc/react_shootout(turf/refuge)
if(stat != CONSCIOUS || fading || istype(activity, /datum/ambient_activity/leave))
return
if(prob(40))
@@ -536,7 +700,7 @@
start_activity(new /datum/ambient_activity/take_cover(src, refuge))
/// The shootout is over: back to what they were doing
-/mob/living/basic/ambient_npc/proc/shootout_over()
+/mob/living/carbon/human/npc/ambient_npc/proc/shootout_over()
if(istype(activity, /datum/ambient_activity/take_cover))
end_activity()
@@ -544,7 +708,7 @@
* A storm is coming to their planet (COMSIG_WEATHER_TELEGRAPH): a shouted warning, which doubles
* as a telegraph for players, then shelter or a crouch until it passes. Never sleeps.
*/
-/mob/living/basic/ambient_npc/proc/react_storm(datum/weather/storm)
+/mob/living/carbon/human/npc/ambient_npc/proc/react_storm(datum/weather/storm)
if(stat != CONSCIOUS || fading || !reaction_ready("storm", 2 MINUTES))
return
speak_context(AMBIENT_LINE_STORM, null, force = TRUE)
@@ -555,7 +719,7 @@
start_activity(new /datum/ambient_activity/shelter(src, istype(site) ? site.shelter : null, duration))
/// The supply convoy arrived at their outpost (COMSIG_TRADER_OUTPOST_CONVOY). Override: the dock workers (PA).
-/mob/living/basic/ambient_npc/proc/react_convoy(obj/structure/overmap/trader_outpost/outpost)
+/mob/living/carbon/human/npc/ambient_npc/proc/react_convoy(obj/structure/overmap/trader_outpost/outpost)
return
// =========================================================================
@@ -563,7 +727,7 @@
// =========================================================================
/// Sits on `seat` from its tile
-/mob/living/basic/ambient_npc/proc/sit_on(obj/structure/chair/seat)
+/mob/living/carbon/human/npc/ambient_npc/proc/sit_on(obj/structure/chair/seat)
if(QDELETED(seat))
return FALSE
if(buckled == seat)
@@ -576,15 +740,15 @@
seat_ref = WEAKREF(seat)
return TRUE
-/// Down on the floor: sitting, or ducking
-/mob/living/basic/ambient_npc/proc/crouch()
- if(crouching || buckled)
+/// Down on the floor: sitting, or ducking (a pixel shift; their body stays up)
+/mob/living/carbon/human/npc/ambient_npc/proc/crouch()
+ if(crouching || buckled || body_position == LYING_DOWN)
return
crouching = TRUE
add_offsets(AMBIENT_NPC_TRAIT, y_add = -4)
/// Up from their seat or the floor. Only a seat they sat on themselves: never out of one someone put them in.
-/mob/living/basic/ambient_npc/proc/stand_up()
+/mob/living/carbon/human/npc/ambient_npc/proc/stand_up()
if(crouching)
crouching = FALSE
remove_offsets(AMBIENT_NPC_TRAIT)
@@ -592,35 +756,41 @@
seat_ref = null
if(seat && buckled == seat)
seat.unbuckle_mob(src, force = TRUE)
+ if(resting && stat == CONSCIOUS)
+ set_resting(FALSE, silent = TRUE)
-/// A drink in hand, poured for the occasion: a real glass in their contents
-/mob/living/basic/ambient_npc/proc/take_drink(reagent_type = /datum/reagent/consumable/ethanol/beer)
+/// A drink in hand, poured for them where they got it: a real glass, held in a hand
+/mob/living/carbon/human/npc/ambient_npc/proc/take_drink(reagent_type = /datum/reagent/consumable/ethanol/beer)
var/obj/item/reagent_containers/cup/glass/drinkingglass/glass = held_item
- if(!istype(glass) || QDELETED(glass))
+ if(!istype(glass) || QDELETED(glass) || !(glass in get_all_contents()))
glass = new(src)
- glass.reagents.add_reagent(reagent_type, 25)
+ glass.reagents.add_reagent(reagent_type, AMBIENT_DRINK_POUR)
held_item = glass
set_held(glass)
return glass
-/// A sip of their drink; an empty glass is filled again. FALSE with no drink in hand.
-/mob/living/basic/ambient_npc/proc/sip()
+/**
+ * A gulp of their drink, swallowed as anyone swallows one (the glass's own drinking: the reagents go
+ * into them, so drink makes them drunk and whatever else is in it does what it does). An empty glass
+ * is poured again. FALSE with no drink in hand, or when they can't drink (a mask over the mouth).
+ */
+/mob/living/carbon/human/npc/ambient_npc/proc/sip()
var/obj/item/reagent_containers/cup/glass/drinkingglass/glass = held_item
- if(!istype(glass) || QDELETED(glass) || glass.loc != src)
+ if(!istype(glass) || QDELETED(glass) || !is_holding(glass))
return FALSE
if(!glass.reagents.total_volume)
- glass.reagents.add_reagent(/datum/reagent/consumable/ethanol/beer, 25)
- else
- glass.reagents.remove_all(5)
- playsound(src, 'sound/items/drink.ogg', 20, TRUE, -4)
- set_held(glass)
+ glass.reagents.add_reagent(/datum/reagent/consumable/ethanol/beer, AMBIENT_DRINK_POUR)
+ return TRUE
+ if(!glass.canconsume(src, src))
+ return FALSE
+ glass.attack(src, src)
return TRUE
/**
* Sets their drink down on `table` if it is right there, up to AMBIENT_GLASSES_MAX glasses of
* theirs and AMBIENT_TABLE_GLASSES_MAX on the table; otherwise it just goes.
*/
-/mob/living/basic/ambient_npc/proc/put_drink_down(obj/structure/table/table)
+/mob/living/carbon/human/npc/ambient_npc/proc/put_drink_down(obj/structure/table/table)
var/obj/item/glass = held_item
held_item = null
set_held(null)
@@ -630,9 +800,8 @@
var/on_table = 0
for(var/obj/item/reagent_containers/cup/glass/other in table.loc)
on_table++
- if(on_table < AMBIENT_TABLE_GLASSES_MAX)
+ if(on_table < AMBIENT_TABLE_GLASSES_MAX && transferItemToLoc(glass, table.loc, force = TRUE))
glasses_left++
- glass.forceMove(table.loc)
glass.pixel_x = rand(-6, 6)
glass.pixel_y = rand(0, 6)
return
diff --git a/voidcrew/modules/ambient_npcs/ambient_subsystem.dm b/voidcrew/modules/ambient_npcs/ambient_subsystem.dm
index 1006d68e601..e99e2d4e547 100644
--- a/voidcrew/modules/ambient_npcs/ambient_subsystem.dm
+++ b/voidcrew/modules/ambient_npcs/ambient_subsystem.dm
@@ -190,13 +190,11 @@ SUBSYSTEM_DEF(ambient_npcs)
if(place.players)
if(!place.occupied)
wake_outpost(place)
- clear_bodies(place)
if(world.time >= place.arrivals_at && arrive_next(place, roles))
place.arrivals_at = world.time + AMBIENT_OUTPOST_ARRIVAL_EVERY
return 0
if(place.occupied)
still_outpost(place)
- clear_bodies(place)
// A killed person's place has opened again
if(place.refill_at && world.time >= place.refill_at)
place.refill_at = 0
@@ -206,7 +204,7 @@ SUBSYSTEM_DEF(ambient_npcs)
/// A player reached `place`'s concourse: everyone there carries on from where they stopped
/datum/controller/subsystem/ambient_npcs/proc/wake_outpost(datum/ambient_place/outpost/place)
place.occupied = TRUE
- for(var/mob/living/basic/ambient_npc/npc as anything in place.npcs)
+ for(var/mob/living/carbon/human/npc/ambient_npc/npc as anything in place.npcs)
if(!QDELETED(npc))
npc.resume_routine()
var/obj/structure/overmap/trader_outpost/outpost = place.outpost()
@@ -218,27 +216,13 @@ SUBSYSTEM_DEF(ambient_npcs)
place.occupied = FALSE
// Anyone who went while players were here is made up in place
place.needs_settling = TRUE
- for(var/mob/living/basic/ambient_npc/npc as anything in place.npcs)
+ for(var/mob/living/carbon/human/npc/ambient_npc/npc as anything in place.npcs)
if(!QDELETED(npc))
npc.pause_routine()
var/obj/structure/overmap/trader_outpost/outpost = place.outpost()
if(outpost)
SEND_SIGNAL(outpost, COMSIG_AMBIENT_OUTPOST_EMPTIED, place)
-/**
- * Takes the bodies at `place` away: at once while nobody is on the concourse to see, or
- * AMBIENT_OUTPOST_BODY_TIME after the death while players are (they fade, as if carried off).
- * Never one an admin is in.
- */
-/datum/controller/subsystem/ambient_npcs/proc/clear_bodies(datum/ambient_place/outpost/place)
- for(var/mob/living/basic/ambient_npc/npc as anything in place.npcs.Copy())
- if(QDELETED(npc) || npc.stat != DEAD || npc.fading || npc.ckey)
- continue
- if(!place.occupied)
- npc.fade_out(instant = TRUE)
- else if(world.time >= npc.timeofdeath + AMBIENT_OUTPOST_BODY_TIME)
- npc.fade_out()
-
/**
* The next person off the lift at `place`: one role that is due (short of its count, less anyone
* killed lately, and past its gap), weighted, while the outpost is under
@@ -307,11 +291,11 @@ SUBSYSTEM_DEF(ambient_npcs)
var/turf/refuge = ambient_kingpin_refuge(place.outpost())
if(refuge && !place.shootout_refuge)
place.shootout_refuge = refuge
- for(var/mob/living/basic/ambient_npc/npc as anything in place.living_npcs())
+ for(var/mob/living/carbon/human/npc/ambient_npc/npc as anything in place.living_npcs())
npc.react_shootout(refuge)
else if(!refuge && place.shootout_refuge)
place.shootout_refuge = null
- for(var/mob/living/basic/ambient_npc/npc as anything in place.living_npcs())
+ for(var/mob/living/carbon/human/npc/ambient_npc/npc as anything in place.living_npcs())
npc.shootout_over()
/**
@@ -529,7 +513,7 @@ SUBSYSTEM_DEF(ambient_npcs)
if(!storm_hits(record, storm))
continue
for(var/datum/ambient_place/site/site as anything in record.sites)
- for(var/mob/living/basic/ambient_npc/npc as anything in site.living_npcs())
+ for(var/mob/living/carbon/human/npc/ambient_npc/npc as anything in site.living_npcs())
npc.react_storm(storm)
/// Whether `storm` falls on `record`'s planet: its weather site when it came from one, its level otherwise
@@ -546,49 +530,49 @@ SUBSYSTEM_DEF(ambient_npcs)
// =========================================================================
/datum/ambient_place/Destroy()
- for(var/mob/living/basic/ambient_npc/npc as anything in npcs.Copy())
+ for(var/mob/living/carbon/human/npc/ambient_npc/npc as anything in npcs.Copy())
if(npc.place == src)
npc.place = null
npcs.Cut()
return ..()
-/// `npc` belongs here now. Use /mob/living/basic/ambient_npc/proc/set_place(), which calls this.
-/datum/ambient_place/proc/add_npc(mob/living/basic/ambient_npc/npc)
+/// `npc` belongs here now. Use /mob/living/carbon/human/npc/ambient_npc/proc/set_place(), which calls this.
+/datum/ambient_place/proc/add_npc(mob/living/carbon/human/npc/ambient_npc/npc)
npcs |= npc
/// `npc` is gone from here (deleted, or moved elsewhere)
-/datum/ambient_place/proc/remove_npc(mob/living/basic/ambient_npc/npc)
+/datum/ambient_place/proc/remove_npc(mob/living/carbon/human/npc/ambient_npc/npc)
npcs -= npc
/// `npc` died here
-/datum/ambient_place/proc/npc_died(mob/living/basic/ambient_npc/npc)
+/datum/ambient_place/proc/npc_died(mob/living/carbon/human/npc/ambient_npc/npc)
return
/// `attacker` went for `npc` here (`attack_flags`: ATTACKER_*), the blow already landed. Override. Never sleeps.
-/datum/ambient_place/proc/npc_attacked(mob/living/basic/ambient_npc/npc, atom/attacker, attack_flags)
+/datum/ambient_place/proc/npc_attacked(mob/living/carbon/human/npc/ambient_npc/npc, atom/attacker, attack_flags)
return
/// How much of `amount` cash `npc` drops, killed here. Override to cap it.
-/datum/ambient_place/proc/cash_for(mob/living/basic/ambient_npc/npc, amount)
+/datum/ambient_place/proc/cash_for(mob/living/carbon/human/npc/ambient_npc/npc, amount)
return amount
/// Its NPCs who are alive and not leaving
/datum/ambient_place/proc/living_npcs()
. = list()
- for(var/mob/living/basic/ambient_npc/npc as anything in npcs)
+ for(var/mob/living/carbon/human/npc/ambient_npc/npc as anything in npcs)
if(!QDELETED(npc) && npc.stat != DEAD && !npc.fading)
. += npc
/// Whether its NPCs may be on `tile` by their own steps (their leash). Override.
-/datum/ambient_place/proc/leash_ok(turf/tile, mob/living/basic/ambient_npc/npc)
+/datum/ambient_place/proc/leash_ok(turf/tile, mob/living/carbon/human/npc/ambient_npc/npc)
return TRUE
/// Whether an activity may send `npc` to `tile` (an outpost's public floor). Override.
-/datum/ambient_place/proc/spot_allowed(turf/tile, mob/living/basic/ambient_npc/npc)
+/datum/ambient_place/proc/spot_allowed(turf/tile, mob/living/carbon/human/npc/ambient_npc/npc)
return TRUE
/// Whether `npc` may stand about on `tile` here (idle, a stroll, a queue). Override.
-/datum/ambient_place/proc/loiter_ok(turf/tile, mob/living/basic/ambient_npc/npc, atom/ignore)
+/datum/ambient_place/proc/loiter_ok(turf/tile, mob/living/carbon/human/npc/ambient_npc/npc, atom/ignore)
return TRUE
/**
@@ -596,11 +580,11 @@ SUBSYSTEM_DEF(ambient_npcs)
* yet), within AMBIENT_CROWD_RADIUS of `tile`; `asker` and `ignore` are never counted. INFINITY if
* anyone is on `tile` itself.
*/
-/datum/ambient_place/proc/crowd_count(turf/tile, mob/living/basic/ambient_npc/asker, atom/ignore)
+/datum/ambient_place/proc/crowd_count(turf/tile, mob/living/carbon/human/npc/ambient_npc/asker, atom/ignore)
if(!tile)
return INFINITY
var/nearby = 0
- for(var/mob/living/basic/ambient_npc/npc as anything in living_npcs())
+ for(var/mob/living/carbon/human/npc/ambient_npc/npc as anything in living_npcs())
if(npc == asker || npc == ignore)
continue
var/datum/ambient_activity/current = npc.activity
@@ -614,11 +598,11 @@ SUBSYSTEM_DEF(ambient_npcs)
return nearby
/// Whether `tile` is crowded for `asker`: someone on it, or AMBIENT_CROWD_MAX or more of its NPCs within AMBIENT_CROWD_RADIUS
-/datum/ambient_place/proc/crowded(turf/tile, mob/living/basic/ambient_npc/asker, atom/ignore)
+/datum/ambient_place/proc/crowded(turf/tile, mob/living/carbon/human/npc/ambient_npc/asker, atom/ignore)
return crowd_count(tile, asker, ignore) >= AMBIENT_CROWD_MAX
/// Where `npc` leaves from (a lift), or null to fade where they stand. Override.
-/datum/ambient_place/proc/exit_turf(mob/living/basic/ambient_npc/npc)
+/datum/ambient_place/proc/exit_turf(mob/living/carbon/human/npc/ambient_npc/npc)
return null
/**
@@ -626,18 +610,9 @@ SUBSYSTEM_DEF(ambient_npcs)
* stand there if given; within `radius` of `near` if given. Override: places with no floor to settle
* on have none.
*/
-/datum/ambient_place/proc/settle_turf(mob/living/basic/ambient_npc/npc, atom/near, radius = 6)
+/datum/ambient_place/proc/settle_turf(mob/living/carbon/human/npc/ambient_npc/npc, atom/near, radius = 6)
return null
-/// The band's health multiplier for a killable NPC here
-/datum/ambient_place/proc/health_multiplier()
- switch(band)
- if(ZONE_YELLOW)
- return AMBIENT_HEALTH_MULT_YELLOW
- if(ZONE_RED)
- return AMBIENT_HEALTH_MULT_RED
- return 1
-
/// One line for the admin verb
/datum/ambient_place/proc/describe()
return "[name]: [length(living_npcs())] out"
@@ -662,7 +637,7 @@ SUBSYSTEM_DEF(ambient_npcs)
var/obj/structure/overmap/trader_outpost/outpost = outpost()
if(outpost)
UnregisterSignal(outpost, list(COMSIG_TRADER_OUTPOST_VIOLENCE, COMSIG_TRADER_OUTPOST_CONVOY, COMSIG_QDELETING))
- for(var/mob/living/basic/ambient_npc/npc as anything in npcs.Copy())
+ for(var/mob/living/carbon/human/npc/ambient_npc/npc as anything in npcs.Copy())
if(!QDELETED(npc))
qdel(npc)
public_floor = null
@@ -685,7 +660,7 @@ SUBSYSTEM_DEF(ambient_npcs)
/// A fight at the outpost: everyone near it ducks and heads off
/datum/ambient_place/outpost/proc/on_violence(datum/source, mob/living/offender)
SIGNAL_HANDLER
- for(var/mob/living/basic/ambient_npc/npc as anything in living_npcs())
+ for(var/mob/living/carbon/human/npc/ambient_npc/npc as anything in living_npcs())
if(get_dist(npc, offender) <= AMBIENT_VIOLENCE_RANGE)
npc.react_violence(offender)
@@ -695,25 +670,25 @@ SUBSYSTEM_DEF(ambient_npcs)
if(!occupied)
return
var/obj/structure/overmap/trader_outpost/outpost = outpost()
- for(var/mob/living/basic/ambient_npc/npc as anything in living_npcs())
+ for(var/mob/living/carbon/human/npc/ambient_npc/npc as anything in living_npcs())
npc.react_convoy(outpost)
// Its turrets never shoot its own people; with nobody on the concourse, whoever joins holds still until someone comes
-/datum/ambient_place/outpost/add_npc(mob/living/basic/ambient_npc/npc)
+/datum/ambient_place/outpost/add_npc(mob/living/carbon/human/npc/ambient_npc/npc)
. = ..()
npc.faction |= FACTION_TURRET
if(!occupied)
npc.pause_routine()
// Gone from here (moved elsewhere): none of this place's cover any more
-/datum/ambient_place/outpost/remove_npc(mob/living/basic/ambient_npc/npc)
+/datum/ambient_place/outpost/remove_npc(mob/living/carbon/human/npc/ambient_npc/npc)
. = ..()
if(!QDELETED(npc))
npc.faction -= FACTION_TURRET
npc.resume_routine()
// Killed here: their place in their role stays empty a good while (AMBIENT_OUTPOST_KILLED_SLOT_TIME)
-/datum/ambient_place/outpost/npc_died(mob/living/basic/ambient_npc/npc)
+/datum/ambient_place/outpost/npc_died(mob/living/carbon/human/npc/ambient_npc/npc)
if(!npc.role)
return
var/opens_at = world.time + AMBIENT_OUTPOST_KILLED_SLOT_TIME
@@ -725,14 +700,14 @@ SUBSYSTEM_DEF(ambient_npcs)
refill_at = refill_at ? min(refill_at, opens_at) : opens_at
// A real blow is violence at the outpost, as against a visitor: its strikes, and everyone near ducks (register_aggression())
-/datum/ambient_place/outpost/npc_attacked(mob/living/basic/ambient_npc/npc, atom/attacker, attack_flags)
+/datum/ambient_place/outpost/npc_attacked(mob/living/carbon/human/npc/ambient_npc/npc, atom/attacker, attack_flags)
if(!(attack_flags & ATTACKER_DAMAGING_ATTACK) || !isliving(attacker))
return
var/obj/structure/overmap/trader_outpost/outpost = outpost()
outpost?.register_aggression(attacker)
// Its people drop no more than AMBIENT_OUTPOST_CASH_CAP between them in a round
-/datum/ambient_place/outpost/cash_for(mob/living/basic/ambient_npc/npc, amount)
+/datum/ambient_place/outpost/cash_for(mob/living/carbon/human/npc/ambient_npc/npc, amount)
. = clamp(AMBIENT_OUTPOST_CASH_CAP - cash_dropped, 0, amount)
cash_dropped += .
@@ -763,7 +738,7 @@ SUBSYSTEM_DEF(ambient_npcs)
/// How many of its living NPCs came as role `role_type`
/datum/ambient_place/outpost/proc/count_role(role_type)
. = 0
- for(var/mob/living/basic/ambient_npc/npc as anything in living_npcs())
+ for(var/mob/living/carbon/human/npc/ambient_npc/npc as anything in living_npcs())
if(npc.role == role_type)
.++
@@ -827,11 +802,11 @@ SUBSYSTEM_DEF(ambient_npcs)
return loiter_floor
// On the concourse: the lift alcove included, so someone just off the lift is not off their leash
-/datum/ambient_place/outpost/leash_ok(turf/tile, mob/living/basic/ambient_npc/npc)
+/datum/ambient_place/outpost/leash_ok(turf/tile, mob/living/carbon/human/npc/ambient_npc/npc)
return ambient_in_bounds(tile, concourse_bounds())
// The public floor, never the lift itself (it carries off whoever stands on it)
-/datum/ambient_place/outpost/spot_allowed(turf/tile, mob/living/basic/ambient_npc/npc)
+/datum/ambient_place/outpost/spot_allowed(turf/tile, mob/living/carbon/human/npc/ambient_npc/npc)
var/obj/structure/overmap/trader_outpost/outpost = outpost()
if(!outpost || (tile in outpost.lobby_alcove_turfs))
return FALSE
@@ -839,14 +814,14 @@ SUBSYSTEM_DEF(ambient_npcs)
return !!floor[tile]
// The loiter floor, less anyone standing about within AMBIENT_CROWD_RADIUS. Sites keep the base TRUE.
-/datum/ambient_place/outpost/loiter_ok(turf/tile, mob/living/basic/ambient_npc/npc, atom/ignore)
+/datum/ambient_place/outpost/loiter_ok(turf/tile, mob/living/carbon/human/npc/ambient_npc/npc, atom/ignore)
return !!get_loiter_floor()[tile] && !crowded(tile, npc, ignore)
-/datum/ambient_place/outpost/exit_turf(mob/living/basic/ambient_npc/npc)
+/datum/ambient_place/outpost/exit_turf(mob/living/carbon/human/npc/ambient_npc/npc)
return bounty_outpost_exit_turf(npc, outpost())
/// Whether `tile` is free to settle someone on: real ground, nothing on it, not on or right beside the lift (people step off there), and standable for `npc` if given
-/datum/ambient_place/outpost/proc/settle_free(turf/tile, obj/structure/overmap/trader_outpost/outpost, mob/living/basic/ambient_npc/npc)
+/datum/ambient_place/outpost/proc/settle_free(turf/tile, obj/structure/overmap/trader_outpost/outpost, mob/living/carbon/human/npc/ambient_npc/npc)
if(!tile || !ambient_ground_ok(tile) || tile.is_blocked_turf(exclude_mobs = FALSE))
return FALSE
for(var/turf/alcove as anything in outpost.lobby_alcove_turfs)
@@ -859,7 +834,7 @@ SUBSYSTEM_DEF(ambient_npcs)
* least crowded free loiter tile seen if none is uncrowded, and the old public-floor sampling
* (tiny test rooms and odd maps) only when the loiter floor itself is empty.
*/
-/datum/ambient_place/outpost/settle_turf(mob/living/basic/ambient_npc/npc, atom/near, radius = 6)
+/datum/ambient_place/outpost/settle_turf(mob/living/carbon/human/npc/ambient_npc/npc, atom/near, radius = 6)
var/obj/structure/overmap/trader_outpost/outpost = outpost()
var/list/floor = get_public_floor()
if(!outpost || !length(floor))
@@ -922,13 +897,13 @@ SUBSYSTEM_DEF(ambient_npcs)
data.Cut()
return ..()
-/datum/ambient_place/site/remove_npc(mob/living/basic/ambient_npc/npc)
+/datum/ambient_place/site/remove_npc(mob/living/carbon/human/npc/ambient_npc/npc)
. = ..()
if(state == AMBIENT_SITE_ACTIVE && !length(living_npcs()))
state = AMBIENT_SITE_DORMANT
/// One of its NPCs was killed: once they all are, it is spent for the round
-/datum/ambient_place/site/npc_died(mob/living/basic/ambient_npc/npc)
+/datum/ambient_place/site/npc_died(mob/living/carbon/human/npc/ambient_npc/npc)
dead++
if(dead >= npc_total)
state = AMBIENT_SITE_SPENT
@@ -940,14 +915,19 @@ SUBSYSTEM_DEF(ambient_npcs)
return 0
return max(0, npc_total - dead - length(living_npcs()))
-/// Makes one of its NPCs, of `npc_type`, at `where`: theirs, leashed here, health scaled by band when killable
-/datum/ambient_place/site/proc/spawn_npc(npc_type, turf/where)
+/**
+ * Makes one of its NPCs, of `npc_type`, at `where`: theirs and leashed here, dressed for the site's
+ * band (the kit their outfit table gives in yellow and red, and whatever the air there needs).
+ * `identity` (a stray's stray_identity()) makes them someone who was here before.
+ */
+/datum/ambient_place/site/proc/spawn_npc(npc_type, turf/where, list/identity)
where = get_turf(where) || center
- if(!where || !ispath(npc_type, /mob/living/basic/ambient_npc))
+ if(!where || !ispath(npc_type, /mob/living/carbon/human/npc/ambient_npc))
+ return null
+ var/mob/living/carbon/human/npc/ambient_npc/npc = ambient_build_npc(npc_type, where, band, identity)
+ if(QDELETED(npc))
return null
- var/mob/living/basic/ambient_npc/npc = new npc_type(where)
npc.set_place(src)
- npc.scale_health(health_multiplier())
state = AMBIENT_SITE_ACTIVE
return npc
@@ -966,7 +946,7 @@ SUBSYSTEM_DEF(ambient_npcs)
return null
// On its planet's ground above the dock strip and off any ship; on a field, on the field
-/datum/ambient_place/site/leash_ok(turf/tile, mob/living/basic/ambient_npc/npc)
+/datum/ambient_place/site/leash_ok(turf/tile, mob/living/carbon/human/npc/ambient_npc/npc)
if(!tile || istype(get_area(tile), /area/shuttle))
return FALSE
if(planet)
@@ -1070,7 +1050,7 @@ SUBSYSTEM_DEF(ambient_npcs)
return TRUE
/// One of `site`'s NPCs was killed. Override.
-/datum/ambient_site_kind/proc/on_npc_died(datum/ambient_place/site/site, mob/living/basic/ambient_npc/npc)
+/datum/ambient_site_kind/proc/on_npc_died(datum/ambient_place/site/site, mob/living/carbon/human/npc/ambient_npc/npc)
return
/// The planet was swept: `site`'s NPCs are gone until the next visit (a fire burns down). Override.
@@ -1093,7 +1073,7 @@ SUBSYSTEM_DEF(ambient_npcs)
/datum/ambient_outpost_role/proc/arrive(datum/ambient_place/outpost/place, turf/where)
if(!npc_type)
return null
- var/mob/living/basic/ambient_npc/npc = new npc_type(where)
+ var/mob/living/carbon/human/npc/ambient_npc/npc = new npc_type(where)
npc.role = type
npc.set_place(place)
npc.fade_in()
@@ -1113,7 +1093,7 @@ SUBSYSTEM_DEF(ambient_npcs)
var/turf/start = place.settle_turf()
if(!start)
return null
- var/mob/living/basic/ambient_npc/npc = new npc_type(start)
+ var/mob/living/carbon/human/npc/ambient_npc/npc = new npc_type(start)
npc.role = type
npc.set_place(place)
npc.settle_in()
@@ -1123,6 +1103,23 @@ SUBSYSTEM_DEF(ambient_npcs)
// HELPERS
// =========================================================================
+/**
+ * Builds an ambient NPC of `npc_type` at `where` now, through the human NPC base's spawn order
+ * (voidcrew/modules/human_npcs/human_npc_spawning.dm), dressed for `zone` (ZONE_*, or null for the
+ * zone of `where`). `identity` (a stray's stray_identity()) rides in the order's look and makes them
+ * someone who was here before. Built at once rather than queued, since every caller sets them up
+ * straight after; the callers bound how many come at once (AMBIENT_PLANET_NPCS_MAX for a planet, one
+ * a fire for an outpost). Returns the NPC, or null.
+ */
+/proc/ambient_build_npc(npc_type, turf/where, zone, list/identity)
+ if(!ispath(npc_type, /mob/living/carbon/human/npc/ambient_npc) || isnull(get_turf(where)))
+ return null
+ var/datum/human_npc_order/order = new /datum/human_npc_order(npc_type, where)
+ order.zone = zone
+ if(islist(identity))
+ order.look = identity
+ return order.fulfil()
+
/// `deadline` (a world.time) brought forward to somewhere between a quarter and all of what is left of it: someone who has been at it a while
/proc/ambient_part_way(deadline)
var/left = deadline - world.time
diff --git a/voidcrew/modules/ambient_npcs/convict.dm b/voidcrew/modules/ambient_npcs/convict.dm
index 79bf0667f63..f7e8296213c 100644
--- a/voidcrew/modules/ambient_npcs/convict.dm
+++ b/voidcrew/modules/ambient_npcs/convict.dm
@@ -7,24 +7,35 @@
* inside the existing two-offer limit, paid by the existing capture rules; recruiting them
* withdraws it unpaid.
*
- * The convict (spec 5.4) is the bounty module's meek criminal in prison orange, with its own AI:
- * camping at a small fire on a planet, or looking round a space ruin; sprinting and hiding from
- * anyone who comes at them armed; a holdout when cornered. This file only calls the bounty
- * module's procs; it edits nothing there.
- * - Sighted: the first time someone of a ship crew comes into view, they put their hands up
- * ("Don't shoot!") and a private petty bounty on them is posted to that crew's ship, if the board
- * would offer that ship another private bounty now (under BOUNTY_PRIVATE_MAX, and not in the gap
- * after its last one ended). Only ever one bounty per convict. The crew cuff them and use
- * their pad, and the bounty pays by the usual rules.
+ * The convict (spec 5.4) is the bounty module's meek criminal, a real human body
+ * (voidcrew/modules/human_npcs/), in prison orange, with the meek AI: camping at a small fire on a
+ * planet, or looking round a space ruin; running and hiding from anyone who comes at them armed; a
+ * holdout pistol when cornered. This file only calls the bounty module's procs; it edits nothing there.
+ * - Sighted: the first time someone of a ship crew comes into view, they give up the way a person
+ * does (npc_surrender(): the weapon put away, "Don't shoot!", tg's *surrender, a real 20 second
+ * Paralyze), and a private petty bounty on them is posted to that crew's ship, if the board would
+ * offer that ship another private bounty now (under BOUNTY_PRIVATE_MAX, and not in the gap after its
+ * last one ended). Only ever one bounty per convict. The crew cuff them and use their pad, and the
+ * bounty pays on their condition there by the usual rules.
* - Talked down: an empty hand from a crew member while they are calm, and they ask to come along.
- * "Come with us" turns them into a stray following that crew (recruit.dm), wearing the same face,
- * and withdraws their bounty unpaid. A convict who is fleeing, hiding, down or cuffed won't talk.
+ * "Come with us" and the SAME body goes with that crew (defaults 1.9, AM-6): its bounty is withdrawn
+ * unpaid, it is taken off the board for good (no posting, no leash, no teleport block, no sweep
+ * protection, off the convict count), and its AI and faction change: a small follower AI of its own
+ * (below) walks after whoever asked, keeps out of fights, and stays aboard once it has stepped onto
+ * their ship. Wounds, blood and everything else about the body carry on. A convict who is fleeing,
+ * hiding, down, stunned or cuffed won't talk.
* - Left alone: when a bounty on a free convict ends unclaimed, they stay where they are, off the
* board for good.
* Where they turn up: a planet site (/datum/ambient_site_kind/convict, yellow and red space) or,
* rolled once per space ruin per round by SSambient_strays (stranded_lifeboat.dm), a loaded ruin
* a crew has docked at. At most one per AMBIENT_CONVICT_SHIPS_PER active crews, and never more than
* AMBIENT_CONVICTS_MAX alive.
+ *
+ * A talked-down convict is still a /bounty_criminal type: a mob can't change type and stay the same
+ * body. What reads the posting (the pad, the board, proof of death, pay) leaves it alone, since it has
+ * none. What reads the type alone still counts it as a bounty body: other criminals never pick it as a
+ * target, and the core's transporter, bag-fold and contract-pad checks still refuse it while it is alive
+ * (see the PHASE D CORE REQUEST below). Turrets leave it be: its follower AI has no target finding.
*/
/// How far a convict sees a crew member coming
@@ -37,8 +48,33 @@
#define CONVICT_TALK_COOLDOWN (4 SECONDS)
/// The reason a convict's bounty closes when a crew takes them in
#define CONVICT_CLOSE_RECRUITED "recruited"
-
-/// Weakrefs to every escaped convict's body (weakrefs: the bounty body's own Destroy() is not overridden here)
+/// Beyond this many tiles (or off the level, or dead) a follower's leader is out of reach
+#define CONVICT_FOLLOW_RANGE 12
+/// A leader out of reach this long is lost: the follower waits where it is
+#define CONVICT_LOST_TIME (60 SECONDS)
+/// Further than this behind its leader, a follower runs to catch up
+#define CONVICT_RUN_DISTANCE 4
+/// How long a follower keeps clear of someone who hit it
+#define CONVICT_SHY_TIME (10 SECONDS)
+/// How close a fight has to be for a follower to back off from it
+#define CONVICT_FIGHT_RANGE 5
+/// Between a follower's idle lines aboard, while somebody is near
+#define CONVICT_IDLE_LINE_LOW (90 SECONDS)
+#define CONVICT_IDLE_LINE_HIGH (180 SECONDS)
+/// Contexts a talked-down convict says from the strays file's deckhand section first
+#define CONVICT_DECKHAND_CONTEXTS list("talk", "idle", "follow", "wait")
+
+/// Blackboard: who a talked-down convict follows (null: it stays where it is)
+#define BB_CONVICT_LEADER "convict_leader"
+/// Blackboard: world.time its leader went out of reach, or null
+#define BB_CONVICT_LOST_SINCE "convict_lost_since"
+/// Blackboard: whoever last hit it, and the world.time it stops keeping clear of them
+#define BB_CONVICT_HIT_BY "convict_hit_by"
+#define BB_CONVICT_HIT_UNTIL "convict_hit_until"
+/// Blackboard: what it is backing away from now (run_away_from_target clears it)
+#define BB_CONVICT_AVOID "convict_avoid"
+
+/// Weakrefs to every escaped convict's body still on the board (weakrefs: the bounty body's own Destroy() is not overridden here)
GLOBAL_LIST_EMPTY(ambient_convicts)
// =========================================================================
@@ -62,7 +98,7 @@ GLOBAL_LIST_EMPTY(ambient_convicts)
/proc/ambient_live_convicts()
. = 0
for(var/datum/weakref/ref as anything in GLOB.ambient_convicts.Copy())
- var/mob/living/basic/bounty_criminal/meek/convict/convict = ref?.resolve()
+ var/mob/living/carbon/human/npc/bounty_criminal/meek/convict/convict = ref?.resolve()
if(QDELETED(convict))
GLOB.ambient_convicts -= ref
continue
@@ -78,7 +114,8 @@ GLOBAL_LIST_EMPTY(ambient_convicts)
/**
* A new convict at `where`, on site `site` (the overmap planet or ruin, or null), for a
* `placement_kind` (BOUNTY_PLACEMENT_PLANET or _RUIN) site: `record`'s person, or someone new. They
- * camp on a planet and look round a ruin. Returns the convict, or null.
+ * camp on a planet and look round a ruin. One body, wanted back at once, so it is built now rather
+ * than queued, in its record's face and name. Returns the convict, or null.
*/
/proc/ambient_spawn_convict(turf/where, obj/structure/overmap/site, placement_kind = BOUNTY_PLACEMENT_PLANET, datum/bounty_record/record)
where = get_turf(where)
@@ -87,7 +124,11 @@ GLOBAL_LIST_EMPTY(ambient_convicts)
record ||= generate_bounty_record(BOUNTY_TIER_PETTY, BOUNTY_ARCHETYPE_MEEK, placement_kind)
if(!record)
return null
- var/mob/living/basic/bounty_criminal/meek/convict/convict = new(where)
+ var/datum/human_npc_order/order = spawn_human_npc(/mob/living/carbon/human/npc/bounty_criminal/meek/convict, where, look = record, name = record.name, immediate = TRUE)
+ var/mob/living/carbon/human/npc/bounty_criminal/meek/convict/convict = order?.spawned_ref?.resolve()
+ qdel(order)
+ if(QDELETED(convict))
+ return null
convict.body_setup(record, null)
if(site)
convict.body_set_site(site)
@@ -167,7 +208,7 @@ GLOBAL_LIST_EMPTY(ambient_convicts)
if(site.data["taken"] || site.state == AMBIENT_SITE_SPENT)
return FALSE
var/datum/weakref/convict_ref = site.data["convict"]
- var/mob/living/basic/bounty_criminal/meek/convict/convict = convict_ref?.resolve()
+ var/mob/living/carbon/human/npc/bounty_criminal/meek/convict/convict = convict_ref?.resolve()
if(!QDELETED(convict))
return FALSE
if(!has_room())
@@ -190,7 +231,24 @@ GLOBAL_LIST_EMPTY(ambient_convicts)
// THE CONVICT
// =========================================================================
-/mob/living/basic/bounty_criminal/meek/convict
+/**
+ * Prison orange and the escapee's shiv, with the meek criminal's kit (bounty_styles.dm's holdout): the
+ * little Makarov in a pocket, its spare magazine and the stimpack they bolt on in a fanny pack. They run
+ * and hide, and only shoot when cornered. Their own name stays on them: no prisoner number.
+ */
+/datum/outfit/prisoner/bounty_convict
+ name = "Escaped convict"
+ l_pocket = /obj/item/gun/ballistic/automatic/pistol
+ belt = /obj/item/storage/belt/fannypack
+ belt_contents = list(
+ /obj/item/ammo_box/magazine/m9mm = 1,
+ /obj/item/reagent_containers/hypospray/medipen/stimpack = 1,
+ )
+
+/datum/outfit/prisoner/bounty_convict/post_equip(mob/living/carbon/human/prisoner, visuals_only = FALSE)
+ return
+
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict
name = "escaped convict"
desc = "Someone in prison orange, a long way from any prison."
/// Weakref to the planet site (/datum/ambient_place/site) that keeps them, if any
@@ -205,16 +263,25 @@ GLOBAL_LIST_EMPTY(ambient_convicts)
var/convict_next_line = 0
/// REF of a player -> world.time they may talk to them again
var/list/convict_talk_cooldowns
-
-/mob/living/basic/bounty_criminal/meek/convict/Initialize(mapload)
+ /// Talked down: off the board, going with a crew (the same body, a follower AI)
+ var/convict_recruited = FALSE
+ /// Weakref to the ship whose crew took them in
+ var/datum/weakref/convict_ship_ref
+ /// They have stepped aboard that ship, and stay aboard from now on
+ var/convict_aboard = FALSE
+ /// world.time of their next idle line aboard
+ var/convict_next_idle_line = 0
+
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/Initialize(mapload, datum/human_npc_order/order)
. = ..()
GLOB.ambient_convicts += WEAKREF(src)
-// Prison orange, wherever they are
-/mob/living/basic/bounty_criminal/meek/convict/bounty_outfit()
- return /datum/outfit/prisoner
+// Prison orange, wherever they are (the human NPC base adds a sealed suit and air, a mask or warm
+// clothes on top where the spot needs them)
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/bounty_build_outfit(zone)
+ return /datum/outfit/prisoner/bounty_convict
-/mob/living/basic/bounty_criminal/meek/convict/death(gibbed)
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/death(gibbed)
var/was_alive = stat != DEAD
. = ..()
if(!was_alive)
@@ -224,7 +291,7 @@ GLOBAL_LIST_EMPTY(ambient_convicts)
site.npc_died(src)
/// Their planet site knows they are gone for good (a bounty took them over, or a crew took them in)
-/mob/living/basic/bounty_criminal/meek/convict/proc/convict_mark_site_taken()
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_mark_site_taken()
var/datum/ambient_place/site/site = convict_site_ref?.resolve()
if(!site || QDELETED(site))
return
@@ -233,38 +300,63 @@ GLOBAL_LIST_EMPTY(ambient_convicts)
// ----- their own lines -----
+/**
+ * Their lines for `context` from the strays file: the convict section, and once a crew has taken them
+ * in the deckhand section too (first for its everyday contexts, CONVICT_DECKHAND_CONTEXTS).
+ */
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_lines(context)
+ var/list/sections = list("convict")
+ if(convict_recruited)
+ if(context in CONVICT_DECKHAND_CONTEXTS)
+ sections.Insert(1, "deckhand")
+ else
+ sections += "deckhand"
+ for(var/section in sections)
+ var/list/lines = ambient_dialogue_lines(AMBIENT_STRINGS_STRAYS, section, context)
+ if(length(lines))
+ return lines
+ return list()
+
/// Says a line for `context` from the strays file, now and then; `force` skips the wait. TRUE if they spoke.
-/mob/living/basic/bounty_criminal/meek/convict/proc/convict_say(context, force = FALSE)
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_say(context, force = FALSE)
if(stat != CONSCIOUS || (!force && world.time < convict_next_line))
return FALSE
- var/list/lines = ambient_dialogue_lines(AMBIENT_STRINGS_STRAYS, "convict", context)
+ var/list/lines = convict_lines(context)
if(!length(lines))
return FALSE
convict_next_line = world.time + CONVICT_LINE_COOLDOWN
INVOKE_ASYNC(src, TYPE_PROC_REF(/atom/movable, say), pick(lines))
return TRUE
-// Their own words where the strays file has them (at the camp, cornered, cuffed), the bounty module's otherwise
-/mob/living/basic/bounty_criminal/meek/convict/bounty_say(context, list/values, force = FALSE)
- if(!length(ambient_dialogue_lines(AMBIENT_STRINGS_STRAYS, "convict", context)))
- return ..()
+// Their own words where the strays file has them (seen and giving up, at the camp, cornered, cuffed),
+// the bounty module's otherwise
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/bounty_say(context, list/values, force = FALSE)
+ // The human NPC base's surrender bark: theirs is "Don't shoot! I'm not armed."
+ if(context == HUMAN_NPC_BARK_SURRENDER)
+ context = "sighted"
+ if(!length(convict_lines(context)))
+ return ..(context, values, force)
return convict_say(context, force)
// ----- being seen -----
-// Each look round for hunters is also a look for crews they have not seen yet
-/mob/living/basic/bounty_criminal/meek/convict/ai_look_around()
- convict_look_for_crews()
+// Each look round for hunters is also a look for crews they have not seen yet. Giving up to one, they
+// notice nobody else this look: they are lying there with their hands on their head.
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/ai_look_around()
+ if(convict_recruited)
+ return null
+ if(convict_look_for_crews() || npc_surrendering)
+ return null
return ..()
-/// The first time someone of a ship crew comes into view: hands up, and maybe their bounty
-/mob/living/basic/bounty_criminal/meek/convict/proc/convict_look_for_crews()
- if(world.time < convict_next_look || hidden || !ai_can_act())
- return
+/// The first time someone of a ship crew comes into view: they give up, and maybe their bounty. TRUE if they saw a new crew.
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_look_for_crews()
+ if(convict_recruited || world.time < convict_next_look || hidden || !ai_can_act())
+ return FALSE
convict_next_look = world.time + CONVICT_LOOK_INTERVAL
var/turf/here = get_turf(src)
if(!here)
- return
+ return FALSE
for(var/mob/living/person in SSspatial_grid.orthogonal_range_search(here, SPATIAL_GRID_CONTENTS_TYPE_CLIENTS, CONVICT_SIGHT_RANGE))
if(!bounty_ai_is_hunter(person))
continue
@@ -276,16 +368,21 @@ GLOBAL_LIST_EMPTY(ambient_convicts)
continue
LAZYADD(convict_seen_by, key)
INVOKE_ASYNC(src, PROC_REF(convict_sighted), person, ship)
- return
+ return TRUE
+ return FALSE
-/// `person` of `ship` saw them
-/mob/living/basic/bounty_criminal/meek/convict/proc/convict_sighted(mob/living/person, obj/structure/overmap/ship/ship)
- if(QDELETED(src) || stat != CONSCIOUS)
+/**
+ * `person` of `ship` saw them. They give up the way a person does (npc_surrender(): whatever weapon is
+ * in their hands goes in a pocket, "Don't shoot!", tg's *surrender, a real 20 second Paralyze, the cuff
+ * window), and that crew may get a private bounty on them. If nobody cuffs them before they get up, the
+ * meek AI carries on: calm, they can be talked to; at someone armed, they run.
+ */
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_sighted(mob/living/person, obj/structure/overmap/ship/ship)
+ if(QDELETED(src) || stat != CONSCIOUS || convict_recruited)
return
if(!QDELETED(person))
face_atom(person)
- manual_emote("puts [p_their()] hands up.")
- convict_say("sighted", force = TRUE)
+ npc_surrender()
convict_post_bounty(ship)
/**
@@ -293,8 +390,8 @@ GLOBAL_LIST_EMPTY(ambient_convicts)
* private offer. board_post() rolls a record of its own, so the posting takes theirs instead, and
* the card shows who the crew actually saw. Returns the posting, or null.
*/
-/mob/living/basic/bounty_criminal/meek/convict/proc/convict_post_bounty(obj/structure/overmap/ship/ship)
- if(convict_posted || QDELETED(ship) || !record || posting() || stat == DEAD)
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_post_bounty(obj/structure/overmap/ship/ship)
+ if(convict_posted || convict_recruited || QDELETED(ship) || !record || posting() || stat == DEAD)
return null
// Inside the board's own rules for private offers: at most BOUNTY_PRIVATE_MAX open, and none during the gap after one ends
if(SScriminal_bounties.board_private_count(ship) >= BOUNTY_PRIVATE_MAX || world.time < SScriminal_bounties.board_private_next[WEAKREF(ship)])
@@ -329,15 +426,15 @@ GLOBAL_LIST_EMPTY(ambient_convicts)
/**
* Their bounty closed. Claimed, the pad has them. Anything else while they are free on their own
- * ground (not dead, down, cuffed or aboard a ship): they stay where they are, off the board.
+ * ground (not dead, in crit, cuffed or aboard a ship): they stay where they are, off the board.
*/
-/mob/living/basic/bounty_criminal/meek/convict/proc/convict_on_posting_closed(datum/source, reason, obj/structure/overmap/ship/winner)
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_on_posting_closed(datum/source, reason, obj/structure/overmap/ship/winner)
SIGNAL_HANDLER
UnregisterSignal(source, COMSIG_BOUNTY_POSTING_CLOSED)
var/datum/criminal_bounty/posting = source
if(reason == BOUNTY_CLOSE_CLAIMED || QDELETED(src) || posting.criminal() != src)
return
- if(stat == DEAD || downed || is_restrained() || get_ship_from_atom(src))
+ if(stat == DEAD || is_downed() || is_restrained() || get_ship_from_atom(src))
return
posting.board_detach_criminal()
posting_ref = null
@@ -345,20 +442,28 @@ GLOBAL_LIST_EMPTY(ambient_convicts)
// ----- being talked down -----
-/// Whether they would talk: awake, calm, on their feet, not hidden or cuffed
-/mob/living/basic/bounty_criminal/meek/convict/proc/convict_can_talk()
- if(stat != CONSCIOUS || hidden || downed || is_restrained() || HAS_TRAIT(src, TRAIT_BOUNTY_REMOVED))
+/// Whether they would talk: awake, calm, on their feet, not hidden, stunned or cuffed, and not taken in already
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_can_talk()
+ if(convict_recruited || stat != CONSCIOUS || hidden || is_downed() || is_restrained() || HAS_TRAIT(src, TRAIT_BOUNTY_REMOVED))
return FALSE
return ai_can_act() && ai_mode == BOUNTY_AI_CALM
-/mob/living/basic/bounty_criminal/meek/convict/attack_hand(mob/living/carbon/human/user, list/modifiers)
- if(istype(user) && !user.combat_mode && !LAZYACCESS(modifiers, RIGHT_CLICK) && convict_can_talk())
- INVOKE_ASYNC(src, PROC_REF(convict_talk), user)
- return TRUE
+// An empty hand: the plea while they are wild, follow or stay once a crew has them. Anything else (they
+// are down, asleep or on fire) is tg's own help: CPR, shaking them awake, patting them out.
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/attack_hand(mob/living/carbon/human/user, list/modifiers)
+ if(istype(user) && !user.combat_mode && !LAZYACCESS(modifiers, RIGHT_CLICK))
+ if(convict_recruited)
+ var/obj/structure/overmap/ship/ship = convict_ship()
+ if(ship && convict_follower_can_talk() && ambient_crew_ship(user) == ship)
+ INVOKE_ASYNC(src, PROC_REF(convict_crew_menu), user)
+ return TRUE
+ else if(convict_can_talk())
+ INVOKE_ASYNC(src, PROC_REF(convict_talk), user)
+ return TRUE
return ..()
/// A word with `user`, and to a crew member with room aboard, the plea. Sleeps.
-/mob/living/basic/bounty_criminal/meek/convict/proc/convict_talk(mob/living/user)
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_talk(mob/living/user)
var/key = REF(user)
if(LAZYACCESS(convict_talk_cooldowns, key) > world.time)
return
@@ -384,68 +489,370 @@ GLOBAL_LIST_EMPTY(ambient_convicts)
convict_say("refused", force = TRUE)
/**
- * They go with `leader` to `ship`: a stray with the same name and face takes their place, following
- * `leader` (recruit.dm), and their bounty is withdrawn unpaid. Returns the stray, or null.
+ * They go with `leader` to `ship`, in the same body (defaults 1.9): their bounty is withdrawn unpaid,
+ * they come off the board for good, their side changes to the people's (FACTION_NEUTRAL, as a player's)
+ * and their AI to the follower's, set on `leader`. The ship counts them as one of the strays it took this
+ * round (recruit.dm's limits). Returns them, or null if they can't go now.
*/
-/mob/living/basic/bounty_criminal/meek/convict/proc/convict_join(mob/living/leader, obj/structure/overmap/ship/ship)
- var/turf/here = get_turf(src)
- if(!here || QDELETED(ship) || QDELETED(leader))
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_join(mob/living/leader, obj/structure/overmap/ship/ship)
+ if(convict_recruited || stat == DEAD || !isturf(loc) || QDELETED(ship) || QDELETED(leader))
return null
- var/mob/living/basic/ambient_npc/stray/convict/stray = new(here, list("name" = real_name, "gender" = gender), record)
- stray.setDir(dir)
- // Their face, carried over at once; build_look() puts the same one back on from the record
- stray.icon = icon
- stray.icon_state = icon_state
- stray.appearance_flags |= KEEP_TOGETHER
- stray.copy_overlays(src, cut_old = TRUE)
+ // Off its posting first, so closing it takes nobody away
var/datum/criminal_bounty/posting = posting()
if(posting)
UnregisterSignal(posting, COMSIG_BOUNTY_POSTING_CLOSED)
posting.board_detach_criminal()
+ posting_ref = null
convict_mark_site_taken()
+ convict_site_ref = null
ai_put_out_camp()
- // Gone on purpose: no proof of death, nothing to turn in
- body_mark_removed()
- ADD_TRAIT(src, TRAIT_BOUNTY_REMOVED, BOUNTY_PAD_TRAIT)
+ ai_end_activity()
+ // Withdrawn unpaid: the crew who saw them are told, as for any offer that ends
posting?.close(CONVICT_CLOSE_RECRUITED)
- ambient_offer_recruit(stray)
- stray.accept_offer(leader, ship)
+ convict_leave_board()
+ convict_recruited = TRUE
+ convict_ship_ref = WEAKREF(ship)
+ var/datum/ambient_place/ship/deck = ambient_ship_place(ship)
+ if(deck)
+ deck.taken++
+ faction = list(FACTION_NEUTRAL)
+ new /datum/ai_controller/basic_controller/convict_follower(src)
+ convict_follow(leader)
+ convict_say("accepted", force = TRUE)
log_game("AMBIENT: the escaped convict [real_name] went with the [ship.name], talked down by [key_name(leader)]")
- qdel(src)
- return stray
+ return src
+
+/**
+ * Takes the bounty body's rules off them, for a convict who is no criminal any more: the sweep
+ * protection, the teleport and mob-swap block, the body's signal hooks (teleport, polymorph and
+ * type-change refusals, grudges), any container's teleport block, the leash and the grudge list. Off the
+ * convict count. Its corpse is an ordinary human NPC's from now on: the corpse sweep may clear it.
+ */
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_leave_board()
+ REMOVE_TRAIT(src, TRAIT_MISSION_FIELD_MOB, BOUNTY_TRAIT)
+ remove_traits(list(TRAIT_NO_TELEPORT, TRAIT_NOMOBSWAP), BOUNTY_BODY_TRAIT)
+ qdel(GetComponent(/datum/component/bounty_body))
+ body_set_holder(null)
+ body_set_site(null)
+ grudge.Cut()
+ ai_set_mode(BOUNTY_AI_CALM)
+ GLOB.ambient_convicts -= WEAKREF(src)
+ npc_corpse_lifetime = HUMAN_NPC_CORPSE_LIFETIME
+
+// Taken in, nothing they sit in is held back from a teleport any more
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/body_set_holder(atom/movable/holder)
+ return ..(convict_recruited ? null : holder)
+
+// Taken in, they let their own crew cuff them
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/body_on_cuff_attempt(mob/living/user)
+ if(convict_recruited)
+ return
+ return ..()
// =========================================================================
-// THE CONVICT WHO JOINED A CREW
+// THE CONVICT WHO WENT WITH A CREW
// =========================================================================
-/// A convict who went with a crew: the same face, a stray now (recruit.dm)
-/mob/living/basic/ambient_npc/stray/convict
- name = "escaped convict"
- desc = "Someone in prison orange who has decided not to go back."
- outfit = /datum/outfit/prisoner
- dialogue_section = "convict"
- random_name = FALSE
- /// Who they are (/datum/bounty_record): their face comes from it
- var/datum/bounty_record/bounty_record
-
-/mob/living/basic/ambient_npc/stray/convict/Initialize(mapload, list/identity, datum/bounty_record/from_record)
- bounty_record = from_record
- return ..(mapload, identity)
-
-/mob/living/basic/ambient_npc/stray/convict/Destroy()
- bounty_record = null
- return ..()
+/// The ship whose crew took them in, if it is still there
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_ship()
+ var/obj/structure/overmap/ship/ship = convict_ship_ref?.resolve()
+ return QDELETED(ship) ? null : ship
+
+/// That ship's deckhand place (recruit.dm), if any
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_deck()
+ var/obj/structure/overmap/ship/ship = convict_ship()
+ return ship ? ambient_ship_place(ship, create = FALSE) : null
+
+/// Whether `spot` is aboard the ship that took them in
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_on_ship(turf/spot)
+ var/datum/ambient_place/ship/deck = convict_deck()
+ return !!deck?.aboard(get_turf(spot))
+
+/// Who they follow, or null while they stay where they are
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_leader()
+ var/mob/living/leader = ai_controller?.blackboard[BB_CONVICT_LEADER]
+ return QDELETED(leader) ? null : leader
+
+/// They follow `leader` from now on. TRUE if they will.
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_follow(mob/living/leader)
+ if(!isliving(leader) || QDELETED(leader) || !istype(ai_controller, /datum/ai_controller/basic_controller/convict_follower))
+ return FALSE
+ ai_controller.set_blackboard_key(BB_CONVICT_LEADER, leader)
+ ai_controller.clear_blackboard_key(BB_CONVICT_LOST_SINCE)
+ return TRUE
+
+/// They stay where they are
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_stay()
+ ai_controller?.clear_blackboard_key(BB_CONVICT_LEADER)
+ ai_controller?.clear_blackboard_key(BB_CONVICT_LOST_SINCE)
+
+/// Their leader has been out of reach too long: they wait where they are for someone of the crew
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_lose_leader()
+ convict_stay()
+ convict_say("lost", force = TRUE)
-/mob/living/basic/ambient_npc/stray/convict/build_look()
- if(QDELETED(src))
+/// Whether `leader` can still be followed: alive, on this level, near enough
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_leader_in_reach(mob/living/leader)
+ var/turf/there = get_turf(leader)
+ return !QDELETED(leader) && leader.stat != DEAD && there && isturf(loc) && there.z == z && get_dist(src, there) <= CONVICT_FOLLOW_RANGE
+
+/// Whether they would answer a crew member: awake and on their feet
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_follower_can_talk()
+ return stat == CONSCIOUS && !body_is_stunned()
+
+/// Follow or stay, for `user` of their ship. Sleeps.
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_crew_menu(mob/living/user)
+ var/key = REF(user)
+ if(LAZYACCESS(convict_talk_cooldowns, key) > world.time)
return
- if(bounty_record)
- apply_bounty_look(src, bounty_record, /datum/outfit/prisoner)
+ LAZYSET(convict_talk_cooldowns, key, world.time + CONVICT_TALK_COOLDOWN)
+ if(!buckled)
+ face_atom(user)
+ convict_say("talk", force = TRUE)
+ var/list/choices = list()
+ if(convict_leader() == user)
+ choices["Stay here"] = image(icon = 'icons/hud/radial.dmi', icon_state = "guard")
+ else
+ choices["Follow me"] = image(icon = 'icons/hud/radial.dmi', icon_state = "move")
+ var/choice = show_radial_menu(user, src, choices, require_near = TRUE, tooltips = TRUE, autopick_single_option = FALSE)
+ if(QDELETED(src) || QDELETED(user) || !convict_follower_can_talk() || ambient_crew_ship(user) != convict_ship())
+ return
+ switch(choice)
+ if("Follow me")
+ if(convict_follow(user))
+ convict_say("follow", force = TRUE)
+ if("Stay here")
+ convict_stay()
+ convict_say("wait", force = TRUE)
+
+/// The first time they stand aboard their crew's ship: the line, and they live aboard from now on. TRUE if they just stepped aboard.
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_board_if_aboard()
+ if(!convict_recruited || convict_aboard || !convict_on_ship(get_turf(src)))
+ return FALSE
+ convict_aboard = TRUE
+ convict_next_idle_line = world.time + rand(CONVICT_IDLE_LINE_LOW, CONVICT_IDLE_LINE_HIGH)
+ convict_say("aboard", force = TRUE)
+ var/obj/structure/overmap/ship/ship = convict_ship()
+ log_game("AMBIENT: the escaped convict [real_name] came aboard the [ship?.name || "ship"]")
+ return TRUE
+
+/// Aboard, now and then a word while somebody is near
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_idle_chatter()
+ if(!convict_aboard || world.time < convict_next_idle_line)
+ return
+ convict_next_idle_line = world.time + rand(CONVICT_IDLE_LINE_LOW, CONVICT_IDLE_LINE_HIGH)
+ var/turf/here = get_turf(src)
+ if(here && ambient_any_player_near(here, 5))
+ convict_say("idle")
+
+/// Hit by someone of the crew they follow: they stop following and say so
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_hit_by(mob/living/attacker)
+ if(QDELETED(src) || stat != CONSCIOUS || !isliving(attacker))
return
+ var/obj/structure/overmap/ship/ship = convict_ship()
+ if(!ship || ambient_crew_ship(attacker) != ship || !convict_leader())
+ return
+ convict_stay()
+ convict_say("attacked", force = TRUE)
+
+/// Where they may take a step of their own: never into lava, a chasm or the like; aboard, never off the ship; never out into no air without a sealed suit, unless they are out in it already
+/mob/living/carbon/human/npc/bounty_criminal/meek/convict/proc/convict_may_step(turf/next)
+ next = get_turf(next)
+ if(!next)
+ return TRUE
+ if(!next.can_cross_safely(src))
+ return FALSE
+ var/turf/here = get_turf(src)
+ if(convict_aboard && convict_on_ship(here) && !convict_on_ship(next))
+ return FALSE
+ if(!is_atmos_sealed() && convict_airless(next) && !convict_airless(here))
+ return FALSE
+ return TRUE
+
+/// Whether `spot` has too little air to stand in unsuited (read only: never materialises a planet turf's air)
+/proc/convict_airless(turf/spot)
+ if(!isopenturf(spot))
+ return FALSE
+ var/datum/gas_mixture/air = spot.return_air_readonly()
+ return isnull(air) || air.return_pressure() < HAZARD_LOW_PRESSURE
+
+// =========================================================================
+// THE FOLLOWER'S AI
+// =========================================================================
+
+/**
+ * A talked-down convict's AI: a human pawn (human_npc_ai_able_to_run(), so it stops while stunned,
+ * knocked down or out, and in soft crit only crawls, pleads and uses a medipen). It never picks a fight:
+ * no target finding at all, so turrets read it as harmless. It backs off from whoever hit it and from
+ * anything fighting it or its leader, and otherwise walks after its leader (running to catch up), by a
+ * pathfinder that keeps out of hazards and airless ground and, once it is aboard, on the ship.
+ */
+/datum/ai_controller/basic_controller/convict_follower
+ ai_movement = /datum/ai_movement/jps/convict_follower
+ planning_subtrees = list(
+ /datum/ai_planning_subtree/human_npc_soft_crit,
+ /datum/ai_planning_subtree/convict_keep_clear,
+ /datum/ai_planning_subtree/convict_follow,
+ )
+
+/datum/ai_controller/basic_controller/convict_follower/TryPossessPawn(atom/new_pawn)
+ if(!istype(new_pawn, /mob/living/carbon/human/npc/bounty_criminal/meek/convict))
+ return AI_CONTROLLER_INCOMPATIBLE
+ new_pawn.AddElement(/datum/element/relay_attackers)
+ RegisterSignal(new_pawn, COMSIG_ATOM_WAS_ATTACKED, PROC_REF(on_pawn_attacked))
+ return ..()
+
+/datum/ai_controller/basic_controller/convict_follower/UnpossessPawn(destroy)
+ if(pawn)
+ UnregisterSignal(pawn, COMSIG_ATOM_WAS_ATTACKED)
return ..()
+/datum/ai_controller/basic_controller/convict_follower/get_able_to_run()
+ return human_npc_ai_able_to_run(src)
+
+/datum/ai_controller/basic_controller/convict_follower/on_stat_changed(mob/living/source, new_stat)
+ . = ..()
+ human_npc_ai_stat_changed(src, new_stat)
+
+/// Someone hit it: it keeps clear of them for a while, and if it was its own crew, it stops following
+/datum/ai_controller/basic_controller/convict_follower/proc/on_pawn_attacked(mob/living/source, atom/attacker, attack_flags)
+ SIGNAL_HANDLER
+ if(source == attacker || !isliving(attacker) || !(attack_flags & (ATTACKER_DAMAGING_ATTACK | ATTACKER_STAMINA_ATTACK | ATTACKER_SHOVING)))
+ return
+ set_blackboard_key(BB_CONVICT_HIT_BY, attacker)
+ set_blackboard_key(BB_CONVICT_HIT_UNTIL, world.time + CONVICT_SHY_TIME)
+ INVOKE_ASYNC(source, TYPE_PROC_REF(/mob/living/carbon/human/npc/bounty_criminal/meek/convict, convict_hit_by), attacker)
+
+/// Backs off from a fight near it: whoever hit it lately, or anything set on it or its leader
+/datum/ai_planning_subtree/convict_keep_clear
+
+/datum/ai_planning_subtree/convict_keep_clear/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/carbon/human/npc/bounty_criminal/meek/convict/convict = controller.pawn
+ if(!istype(convict) || convict.stat != CONSCIOUS)
+ return
+ var/mob/living/threat = convict_nearest_fight(controller)
+ if(isnull(threat))
+ return
+ controller.set_blackboard_key(BB_CONVICT_AVOID, threat)
+ controller.queue_behavior(/datum/ai_behavior/run_away_from_target, BB_CONVICT_AVOID)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/// The fight `controller`'s pawn should keep clear of, or null
+/proc/convict_nearest_fight(datum/ai_controller/controller)
+ var/mob/living/pawn = controller.pawn
+ var/mob/living/hitter = controller.blackboard[BB_CONVICT_HIT_BY]
+ if(isliving(hitter) && !QDELETED(hitter) && hitter.stat == CONSCIOUS && world.time < controller.blackboard[BB_CONVICT_HIT_UNTIL] && can_see(pawn, hitter, CONVICT_FIGHT_RANGE))
+ return hitter
+ var/mob/living/leader = controller.blackboard[BB_CONVICT_LEADER]
+ var/mob/living/closest
+ var/closest_distance = INFINITY
+ for(var/mob/living/other in oview(CONVICT_FIGHT_RANGE, pawn))
+ var/datum/ai_controller/their_ai = other.ai_controller
+ if(other.stat != CONSCIOUS || other.client || !istype(their_ai))
+ continue
+ var/atom/their_target = their_ai.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
+ if(isnull(their_target) || (their_target != pawn && their_target != leader))
+ continue
+ var/distance = get_dist(pawn, other)
+ if(distance < closest_distance)
+ closest = other
+ closest_distance = distance
+ return closest
+
+/// Walks after its leader, says its line on stepping aboard, and loses a leader out of reach too long
+/datum/ai_planning_subtree/convict_follow
+
+/datum/ai_planning_subtree/convict_follow/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/carbon/human/npc/bounty_criminal/meek/convict/convict = controller.pawn
+ if(!istype(convict) || convict.stat != CONSCIOUS)
+ return
+ convict.convict_board_if_aboard()
+ var/mob/living/leader = controller.blackboard[BB_CONVICT_LEADER]
+ if(isnull(leader))
+ convict.convict_idle_chatter()
+ return
+ if(!convict.convict_leader_in_reach(leader))
+ var/lost_since = controller.blackboard[BB_CONVICT_LOST_SINCE]
+ if(!lost_since)
+ controller.set_blackboard_key(BB_CONVICT_LOST_SINCE, world.time)
+ else if(world.time - lost_since >= CONVICT_LOST_TIME)
+ convict.convict_lose_leader()
+ return
+ controller.clear_blackboard_key(BB_CONVICT_LOST_SINCE)
+ var/distance = get_dist(convict, leader)
+ var/run = distance > CONVICT_RUN_DISTANCE
+ if((convict.move_intent == MOVE_INTENT_RUN) != run)
+ convict.toggle_move_intent()
+ if(distance <= 2)
+ if(!convict.buckled)
+ convict.face_atom(leader)
+ convict.convict_idle_chatter()
+ return
+ // Aboard, it stays aboard: it waits for a leader who has gone off the ship
+ if(convict.convict_aboard && !convict.convict_on_ship(get_turf(leader)))
+ return
+ controller.queue_behavior(/datum/ai_behavior/convict_follow, BB_CONVICT_LEADER)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/// Walks to its leader's side, following them as they move
+/datum/ai_behavior/convict_follow
+ required_distance = 1
+ action_cooldown = 0.5 SECONDS
+ behavior_flags = AI_BEHAVIOR_REQUIRE_MOVEMENT | AI_BEHAVIOR_MOVE_AND_PERFORM | AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
+
+/datum/ai_behavior/convict_follow/setup(datum/ai_controller/controller, leader_key)
+ . = ..()
+ var/atom/leader = controller.blackboard[leader_key]
+ if(QDELETED(leader))
+ return FALSE
+ set_movement_target(controller, leader)
+
+/datum/ai_behavior/convict_follow/perform(seconds_per_tick, datum/ai_controller/controller, leader_key)
+ var/mob/living/leader = controller.blackboard[leader_key]
+ if(QDELETED(leader) || leader.stat == DEAD)
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ if(get_dist(controller.pawn, leader) <= 1)
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
+ return AI_BEHAVIOR_DELAY
+
+/// Smart pathing that keeps a follower out of hazards and airless ground, and aboard once it lives there
+/datum/ai_movement/jps/convict_follower
+
+/datum/ai_movement/jps/convict_follower/allowed_to_move(datum/move_loop/has_target/jps/source)
+ . = ..()
+ if(!.)
+ return
+ var/list/path = source.movement_path
+ if(!length(path))
+ return
+ var/mob/living/carbon/human/npc/bounty_criminal/meek/convict/convict = source.moving
+ if(istype(convict) && !convict.convict_may_step(path[1]))
+ return FALSE
+
+/*
+ * PHASE D CORE REQUEST: bounty_blocks_transport(), bounty_holds_living_criminal() and
+ * bounty_blocks_bag_fold() (bounty_turn_in.dm) and bounty_is_gang_body() (bounty_criminal.dm) go by type
+ * alone, so a talked-down convict (still a /bounty_criminal type, posting_ref null, convict_recruited TRUE)
+ * can't ride a transporter beam, be sent on a contract pad or be folded into a bluespace body bag while it
+ * lives, and other criminals never take it for a target. A shared "is this body wanted on anything" check
+ * (a posting, or not a recruited convict) in those procs would fix it; this file can't reach them.
+ */
+
#undef CONVICT_SIGHT_RANGE
#undef CONVICT_LOOK_INTERVAL
#undef CONVICT_LINE_COOLDOWN
#undef CONVICT_TALK_COOLDOWN
#undef CONVICT_CLOSE_RECRUITED
+#undef CONVICT_FOLLOW_RANGE
+#undef CONVICT_LOST_TIME
+#undef CONVICT_RUN_DISTANCE
+#undef CONVICT_SHY_TIME
+#undef CONVICT_FIGHT_RANGE
+#undef CONVICT_IDLE_LINE_LOW
+#undef CONVICT_IDLE_LINE_HIGH
+#undef CONVICT_DECKHAND_CONTEXTS
+#undef BB_CONVICT_LEADER
+#undef BB_CONVICT_LOST_SINCE
+#undef BB_CONVICT_HIT_BY
+#undef BB_CONVICT_HIT_UNTIL
+#undef BB_CONVICT_AVOID
diff --git a/voidcrew/modules/ambient_npcs/faction_recruiters.dm b/voidcrew/modules/ambient_npcs/faction_recruiters.dm
index dfb0c09c7bf..462a22ed463 100644
--- a/voidcrew/modules/ambient_npcs/faction_recruiters.dm
+++ b/voidcrew/modules/ambient_npcs/faction_recruiters.dm
@@ -5,7 +5,7 @@
*
* Owner decision D2: recruiters are flavour only. Pamphlets and talk; nothing is recorded, no pin,
* no stored choice, no sign-up. PD builds here (spec 3.5): the two recruiters as
- * /mob/living/basic/ambient_npc subtypes with their /datum/ambient_outpost_role subtypes (which
+ * /mob/living/carbon/human/npc/ambient_npc subtypes with their /datum/ambient_outpost_role subtypes (which
* outposts), their pamphlets and posters (capped per outpost), their barbs at Quartermain, and
* their lines in strings/faction_recruiters.json (AMBIENT_STRINGS_RECRUITERS).
*
@@ -42,7 +42,7 @@
* and trades barbs with the rival recruiter when one is nearby. Talking to them gets a pitch and,
* once per ten minutes, a pamphlet. Nothing about a player is kept afterwards (D2).
*/
-/mob/living/basic/ambient_npc/recruiter
+/mob/living/carbon/human/npc/ambient_npc/recruiter
name = "recruiter"
desc = "Someone working the crowd with a clipboard and a smile."
dialogue_file = AMBIENT_STRINGS_RECRUITERS
@@ -64,12 +64,12 @@
/// REF of a player -> world.time they may have another pamphlet
var/list/pamphlet_cooldowns
-/mob/living/basic/ambient_npc/recruiter/Destroy()
+/mob/living/carbon/human/npc/ambient_npc/recruiter/Destroy()
pamphlet_cooldowns = null
return ..()
/// Already at their post when players come: a few steps from the lift lobby, working the crowd
-/mob/living/basic/ambient_npc/recruiter/settle_in()
+/mob/living/carbon/human/npc/ambient_npc/recruiter/settle_in()
var/datum/ambient_place/outpost/outpost_place = place
var/obj/structure/overmap/trader_outpost/outpost = istype(outpost_place) ? outpost_place.outpost() : null
var/turf/post = length(outpost?.lobby_alcove_turfs) ? ambient_waiting_spot(src, pick(outpost.lobby_alcove_turfs), 3, 6) : null
@@ -81,7 +81,7 @@
return !!start_activity(new /datum/ambient_activity/idle(src)) && settle_here()
// An empty hand gets a pitch, and a pamphlet once every ten minutes
-/mob/living/basic/ambient_npc/recruiter/talked_to(mob/living/user)
+/mob/living/carbon/human/npc/ambient_npc/recruiter/talked_to(mob/living/user)
if(!talk_ready(user))
return
if(!buckled)
@@ -91,7 +91,7 @@
addtimer(CALLBACK(src, PROC_REF(offer_pamphlet), WEAKREF(user)), rand(AMBIENT_REPLY_DELAY_LOW, AMBIENT_REPLY_DELAY_HIGH), TIMER_DELETE_ME)
/// Whether `user` may have another pamphlet yet, and starts their wait if so
-/mob/living/basic/ambient_npc/recruiter/proc/pamphlet_ready(mob/living/user)
+/mob/living/carbon/human/npc/ambient_npc/recruiter/proc/pamphlet_ready(mob/living/user)
var/key = REF(user)
if(LAZYACCESS(pamphlet_cooldowns, key) > world.time)
return FALSE
@@ -101,7 +101,7 @@
pamphlet_cooldowns.Cut(1, 2)
return TRUE
-/mob/living/basic/ambient_npc/recruiter/proc/offer_pamphlet(datum/weakref/user_ref)
+/mob/living/carbon/human/npc/ambient_npc/recruiter/proc/offer_pamphlet(datum/weakref/user_ref)
var/mob/living/user = user_ref?.resolve()
if(QDELETED(user) || stat != CONSCIOUS || fading || get_dist(src, user) > 3)
return
@@ -110,7 +110,7 @@
user.put_in_hands(leaflet)
/// A random two-line barb from their section's "barbs": opener said by this side, reply in the rival's voice
-/mob/living/basic/ambient_npc/recruiter/proc/pick_barb()
+/mob/living/carbon/human/npc/ambient_npc/recruiter/proc/pick_barb()
var/list/entry = ambient_dialogue_section(dialogue_file, dialogue_section)
var/list/barbs = entry?["barbs"]
if(!length(barbs))
@@ -122,11 +122,11 @@
return list(barb["opener"], length(replies) ? pick(replies) : null)
// The supply convoy arrived: a comment, not a reaction
-/mob/living/basic/ambient_npc/recruiter/react_convoy(obj/structure/overmap/trader_outpost/outpost)
+/mob/living/carbon/human/npc/ambient_npc/recruiter/react_convoy(obj/structure/overmap/trader_outpost/outpost)
speak_context("convoy", outpost, force = TRUE)
/// The nearest poster of `types` within `range`, or null
-/mob/living/basic/ambient_npc/recruiter/proc/find_poster(list/types, range = AMBIENT_ACTIVITY_RANGE)
+/mob/living/carbon/human/npc/ambient_npc/recruiter/proc/find_poster(list/types, range = AMBIENT_ACTIVITY_RANGE)
if(!length(types))
return null
var/turf/here = get_turf(src)
@@ -138,7 +138,7 @@
return null
/// How many of this side's posters are already up within `range`
-/mob/living/basic/ambient_npc/recruiter/proc/count_own_posters(range = AMBIENT_ACTIVITY_RANGE)
+/mob/living/carbon/human/npc/ambient_npc/recruiter/proc/count_own_posters(range = AMBIENT_ACTIVITY_RANGE)
. = 0
if(!length(poster_types))
return
@@ -150,7 +150,7 @@
.++
/// A bare wall within `range` with room for a poster and a floor tile to stand beside it, or null
-/mob/living/basic/ambient_npc/recruiter/proc/find_bare_wall(range = AMBIENT_ACTIVITY_RANGE)
+/mob/living/carbon/human/npc/ambient_npc/recruiter/proc/find_bare_wall(range = AMBIENT_ACTIVITY_RANGE)
var/turf/here = get_turf(src)
if(!here)
return null
@@ -183,7 +183,7 @@
var/datum/weakref/target_ref
/datum/ambient_activity/recruit_poster/setup()
- var/mob/living/basic/ambient_npc/recruiter/recruiter = doer
+ var/mob/living/carbon/human/npc/ambient_npc/recruiter/recruiter = doer
if(!istype(recruiter))
return FALSE
var/obj/structure/sign/poster/rival = recruiter.find_poster(recruiter.rival_poster_types)
@@ -211,7 +211,7 @@
return TRUE
/datum/ambient_activity/recruit_poster/arrive()
- var/mob/living/basic/ambient_npc/recruiter/recruiter = doer
+ var/mob/living/carbon/human/npc/ambient_npc/recruiter/recruiter = doer
var/atom/target = target_ref?.resolve()
if(QDELETED(target))
return
@@ -236,10 +236,10 @@
var/datum/weakref/rival_ref
/datum/ambient_activity/recruit_barb/setup()
- var/mob/living/basic/ambient_npc/recruiter/recruiter = doer
+ var/mob/living/carbon/human/npc/ambient_npc/recruiter/recruiter = doer
if(!istype(recruiter) || !recruiter.rival_type)
return FALSE
- var/mob/living/basic/ambient_npc/recruiter/rival = find_rival(recruiter)
+ var/mob/living/carbon/human/npc/ambient_npc/recruiter/rival = find_rival(recruiter)
if(!rival)
return FALSE
rival_ref = WEAKREF(rival)
@@ -250,11 +250,11 @@
set_duration()
return TRUE
-/datum/ambient_activity/recruit_barb/proc/find_rival(mob/living/basic/ambient_npc/recruiter/recruiter)
+/datum/ambient_activity/recruit_barb/proc/find_rival(mob/living/carbon/human/npc/ambient_npc/recruiter/recruiter)
var/turf/here = get_turf(recruiter)
if(!here)
return null
- for(var/mob/living/basic/ambient_npc/recruiter/other in range(AMBIENT_ACTIVITY_RANGE, here))
+ for(var/mob/living/carbon/human/npc/ambient_npc/recruiter/other in range(AMBIENT_ACTIVITY_RANGE, here))
if(other == recruiter || other.place != recruiter.place || !istype(other, recruiter.rival_type))
continue
if(other.stat != CONSCIOUS || istype(other.activity, /datum/ambient_activity/leave))
@@ -263,8 +263,8 @@
return null
/datum/ambient_activity/recruit_barb/arrive()
- var/mob/living/basic/ambient_npc/recruiter/recruiter = doer
- var/mob/living/basic/ambient_npc/recruiter/rival = rival_ref?.resolve()
+ var/mob/living/carbon/human/npc/ambient_npc/recruiter/recruiter = doer
+ var/mob/living/carbon/human/npc/ambient_npc/recruiter/rival = rival_ref?.resolve()
if(QDELETED(rival))
return
if(!doer.buckled)
@@ -279,13 +279,13 @@
// OUTFITS (plain clothes, nothing worth stripping)
// =========================================================================
-/datum/outfit/ambient/recruiter_nanotrasen
+/datum/outfit/ambient_recruiter_nanotrasen
name = "Nanotrasen recruiter"
uniform = /obj/item/clothing/under/rank/civilian/head_of_personnel/suit
neck = /obj/item/clothing/neck/tie/blue
shoes = /obj/item/clothing/shoes/laceup
-/datum/outfit/ambient/recruiter_syndicate
+/datum/outfit/ambient_recruiter_syndicate
name = "Syndicate recruiter"
uniform = /obj/item/clothing/under/rank/civilian/lawyer/black
neck = /obj/item/clothing/neck/tie/black/tied
@@ -296,10 +296,10 @@
// NANOTRASEN
// =========================================================================
-/mob/living/basic/ambient_npc/recruiter/nanotrasen
+/mob/living/carbon/human/npc/ambient_npc/recruiter/nanotrasen
name = "Nanotrasen recruiter"
desc = "A neatly pressed suit and a stack of pamphlets."
- outfit = /datum/outfit/ambient/recruiter_nanotrasen
+ outfit = /datum/outfit/ambient_recruiter_nanotrasen
dialogue_section = "nanotrasen"
pamphlet_type = /obj/item/paper/pamphlet/nanotrasen
poster_types = list(
@@ -311,11 +311,11 @@
/obj/structure/sign/poster/contraband/syndicate_recruitment,
/obj/structure/sign/poster/contraband/gorlex_recruitment,
)
- rival_type = /mob/living/basic/ambient_npc/recruiter/syndicate
+ rival_type = /mob/living/carbon/human/npc/ambient_npc/recruiter/syndicate
/datum/ambient_outpost_role/recruiter/nanotrasen
name = "Nanotrasen recruiter"
- npc_type = /mob/living/basic/ambient_npc/recruiter/nanotrasen
+ npc_type = /mob/living/carbon/human/npc/ambient_npc/recruiter/nanotrasen
outpost_types = list(
/obj/structure/overmap/trader_outpost/general,
/obj/structure/overmap/trader_outpost/outfitter,
@@ -326,10 +326,10 @@
// SYNDICATE
// =========================================================================
-/mob/living/basic/ambient_npc/recruiter/syndicate
+/mob/living/carbon/human/npc/ambient_npc/recruiter/syndicate
name = "sharp-dressed stranger"
desc = "A dark suit, dark glasses, and a way of not quite looking at the cameras."
- outfit = /datum/outfit/ambient/recruiter_syndicate
+ outfit = /datum/outfit/ambient_recruiter_syndicate
dialogue_section = "syndicate"
pamphlet_type = /obj/item/paper/pamphlet/syndicate
poster_types = list(
@@ -341,11 +341,11 @@
/obj/structure/sign/poster/official/enlist,
/obj/structure/sign/poster/official/nanotrasen_logo,
)
- rival_type = /mob/living/basic/ambient_npc/recruiter/nanotrasen
+ rival_type = /mob/living/carbon/human/npc/ambient_npc/recruiter/nanotrasen
/datum/ambient_outpost_role/recruiter/syndicate
name = "Syndicate recruiter"
- npc_type = /mob/living/basic/ambient_npc/recruiter/syndicate
+ npc_type = /mob/living/carbon/human/npc/ambient_npc/recruiter/syndicate
outpost_types = list(
/obj/structure/overmap/trader_outpost/outfitter,
/obj/structure/overmap/trader_outpost/black_market,
diff --git a/voidcrew/modules/ambient_npcs/outpost_angler.dm b/voidcrew/modules/ambient_npcs/outpost_angler.dm
index 15f30fc0608..a2d7060255a 100644
--- a/voidcrew/modules/ambient_npcs/outpost_angler.dm
+++ b/voidcrew/modules/ambient_npcs/outpost_angler.dm
@@ -38,16 +38,16 @@
gloves = /obj/item/clothing/gloves/fishing
shoes = /obj/item/clothing/shoes/galoshes
-/// Camo trousers, an old field jacket and a battered fishing hat
+/// Camo trousers, an old field jacket and a green cap (the legendary fishing hat only goes on a master angler)
/datum/outfit/ambient_angler/camo
name = "Pond angler (field jacket)"
uniform = /obj/item/clothing/under/pants/camo
suit = /obj/item/clothing/suit/jacket/miljacket
- head = /obj/item/clothing/head/soft/fishing_hat
+ head = /obj/item/clothing/head/soft/green
gloves = null
shoes = /obj/item/clothing/shoes/workboots
-/mob/living/basic/ambient_npc/outpost/angler
+/mob/living/carbon/human/npc/ambient_npc/outpost/angler
desc = "Here for the fish, and the quiet."
dialogue_file = AMBIENT_STRINGS_WORKERS
dialogue_section = "angler"
@@ -75,11 +75,11 @@
/// Weakrefs to the players whose fishing they follow
var/list/watched
-/mob/living/basic/ambient_npc/outpost/angler/Initialize(mapload)
+/mob/living/carbon/human/npc/ambient_npc/outpost/angler/Initialize(mapload)
. = ..()
leave_at = world.time + rand(ANGLER_VISIT_LOW, ANGLER_VISIT_HIGH)
-/mob/living/basic/ambient_npc/outpost/angler/Destroy()
+/mob/living/carbon/human/npc/ambient_npc/outpost/angler/Destroy()
for(var/datum/weakref/ref as anything in watched)
var/mob/living/player = ref.resolve()
if(player)
@@ -93,7 +93,7 @@
fishing_spot = null
return ..()
-/mob/living/basic/ambient_npc/outpost/angler/pick_activity()
+/mob/living/carbon/human/npc/ambient_npc/outpost/angler/pick_activity()
if(world.time >= leave_at)
if(prob(40))
speak_context(AMBIENT_LINE_LEAVE)
@@ -111,7 +111,7 @@
return start_activity(new /datum/ambient_activity/pond_sit(src))
/// Here a while already: at the pond's edge in their chair with a line out, part-way through their stay
-/mob/living/basic/ambient_npc/outpost/angler/settle_in()
+/mob/living/carbon/human/npc/ambient_npc/outpost/angler/settle_in()
leave_at = ambient_part_way(leave_at)
if(find_pond_spot())
// PB's fishing, anchored on the water (planet_fishers.dm)
@@ -122,14 +122,14 @@
return TRUE
return ..()
-/mob/living/basic/ambient_npc/outpost/angler/shift_times(delay)
+/mob/living/carbon/human/npc/ambient_npc/outpost/angler/shift_times(delay)
. = ..()
leave_at = ambient_shifted(leave_at, delay)
next_watch_at = ambient_shifted(next_watch_at, delay)
next_show_at = ambient_shifted(next_show_at, delay)
/// Whether `tile` is a place at the pond's edge they could fish from into `pond`
-/mob/living/basic/ambient_npc/outpost/angler/proc/fishing_spot_ok(turf/tile, turf/open/water/pond)
+/mob/living/carbon/human/npc/ambient_npc/outpost/angler/proc/fishing_spot_ok(turf/tile, turf/open/water/pond)
if(!tile || !istype(pond) || !isopenturf(tile) || istype(tile, /turf/open/water))
return FALSE
if(tile != loc && !standable(tile))
@@ -141,7 +141,7 @@
* tile on the concourse floor. An empty chair already there is theirs to use; otherwise they bring
* a folding chair, once a visit. FALSE when there is no pond or no room at it.
*/
-/mob/living/basic/ambient_npc/outpost/angler/proc/find_pond_spot()
+/mob/living/carbon/human/npc/ambient_npc/outpost/angler/proc/find_pond_spot()
if(water && fishing_spot && fishing_spot_ok(fishing_spot, water))
return TRUE
var/datum/ambient_place/outpost/outpost_place = place
@@ -166,7 +166,7 @@
return FALSE
/// A chair at `stand`: an empty one already there, their own folding chair moved over, or a new folding chair (once a visit)
-/mob/living/basic/ambient_npc/outpost/angler/proc/take_chair(turf/stand, turf/pond)
+/mob/living/carbon/human/npc/ambient_npc/outpost/angler/proc/take_chair(turf/stand, turf/pond)
var/obj/structure/chair/seat = locate() in stand
if(seat && seat_usable(seat))
chair_ref = WEAKREF(seat)
@@ -185,7 +185,7 @@
return folding
/// Sits in their chair if they are at it
-/mob/living/basic/ambient_npc/outpost/angler/proc/sit_in_chair()
+/mob/living/carbon/human/npc/ambient_npc/outpost/angler/proc/sit_in_chair()
if(buckled || fading)
return
var/obj/structure/chair/seat = chair_ref?.resolve()
@@ -193,11 +193,11 @@
sit_on(seat)
/// Faces the water
-/mob/living/basic/ambient_npc/outpost/angler/proc/face_water()
+/mob/living/carbon/human/npc/ambient_npc/outpost/angler/proc/face_water()
if(water && !buckled && loc != water)
face_atom(water)
-/mob/living/basic/ambient_npc/outpost/angler/activity_step(seconds)
+/mob/living/carbon/human/npc/ambient_npc/outpost/angler/activity_step(seconds)
. = ..()
if(world.time >= next_watch_at)
next_watch_at = world.time + ANGLER_WATCH_EVERY
@@ -207,7 +207,7 @@
sit_in_chair()
/// Starts following the fishing of players near them, and stops for the ones who went
-/mob/living/basic/ambient_npc/outpost/angler/proc/watch_players()
+/mob/living/carbon/human/npc/ambient_npc/outpost/angler/proc/watch_players()
for(var/datum/weakref/ref as anything in watched?.Copy())
var/mob/living/player = ref.resolve()
if(QDELETED(player) || get_dist(src, player) > ANGLER_WATCH_RANGE + 3)
@@ -215,11 +215,11 @@
UnregisterSignal(player, COMSIG_MOB_COMPLETE_FISHING)
LAZYREMOVE(watched, ref)
for(var/mob/living/player in view(ANGLER_WATCH_RANGE, src))
- if(player.client && !istype(player, /mob/living/basic/ambient_npc))
+ if(player.client && !istype(player, /mob/living/carbon/human/npc/ambient_npc))
watch_player(player)
/// Follows `player`'s fishing
-/mob/living/basic/ambient_npc/outpost/angler/proc/watch_player(mob/living/player)
+/mob/living/carbon/human/npc/ambient_npc/outpost/angler/proc/watch_player(mob/living/player)
for(var/datum/weakref/ref as anything in watched)
if(ref.resolve() == player)
return
@@ -227,7 +227,7 @@
LAZYADD(watched, WEAKREF(player))
/// A player near them finished reeling in: a word about the fish, or about the one that got away
-/mob/living/basic/ambient_npc/outpost/angler/proc/on_player_fished(mob/living/source, datum/fishing_challenge/challenge, win)
+/mob/living/carbon/human/npc/ambient_npc/outpost/angler/proc/on_player_fished(mob/living/source, datum/fishing_challenge/challenge, win)
SIGNAL_HANDLER
if(stat != CONSCIOUS || fading || get_dist(src, source) > ANGLER_WATCH_RANGE + 1 || !reaction_ready("player_fish", 20 SECONDS))
return
@@ -237,7 +237,7 @@
* A fish to hold up: a type from the pond's own fish table, weighted as the pond would weigh it.
* Only the picture is used; nothing is caught and the pond's stock is never touched.
*/
-/mob/living/basic/ambient_npc/outpost/angler/proc/pond_fish_picture()
+/mob/living/carbon/human/npc/ambient_npc/outpost/angler/proc/pond_fish_picture()
var/turf/open/water/pond = water
if(!istype(pond) || !pond.fishing_datum)
return /obj/item/fish/goldfish
@@ -261,7 +261,7 @@
duration_high = 4 MINUTES
/datum/ambient_activity/pond_sit/setup()
- var/mob/living/basic/ambient_npc/outpost/angler/angler = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/angler/angler = doer
if(!istype(angler) || !angler.fishing_spot)
return FALSE
go_to(angler.fishing_spot)
@@ -270,7 +270,7 @@
return TRUE
/datum/ambient_activity/pond_sit/arrive()
- var/mob/living/basic/ambient_npc/outpost/angler/angler = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/angler/angler = doer
angler.face_water()
angler.sit_in_chair()
doer.set_held(/obj/item/fishing_rod)
@@ -287,7 +287,7 @@
/// Could not get to their spot: they look for another next time instead of sitting down wherever they are
/datum/ambient_activity/pond_sit/spot_unreachable()
. = ..()
- var/mob/living/basic/ambient_npc/outpost/angler/angler = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/angler/angler = doer
if(istype(angler))
angler.fishing_spot = null
ends_at = world.time
@@ -308,7 +308,7 @@
var/next_step_at = 0
/datum/ambient_activity/show_catch/setup()
- var/mob/living/basic/ambient_npc/outpost/angler/angler = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/angler/angler = doer
if(!istype(angler))
return FALSE
var/mob/living/basic/outpost_trader/pike = ambient_outpost_trader_of(doer.place, /datum/outpost_shop/vendor/bait_shop)
@@ -328,7 +328,7 @@
return ..()
/datum/ambient_activity/show_catch/arrive()
- var/mob/living/basic/ambient_npc/outpost/angler/angler = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/angler/angler = doer
var/mob/living/basic/outpost_trader/pike = pike_ref?.resolve()
switch(stage)
if(0)
@@ -347,7 +347,7 @@
next_step_at = world.time + rand(1 SECONDS, 2 SECONDS)
/datum/ambient_activity/show_catch/act(seconds)
- var/mob/living/basic/ambient_npc/outpost/angler/angler = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/angler/angler = doer
if(world.time < next_step_at)
return AMBIENT_STEP_CONTINUE
switch(stage)
@@ -365,7 +365,7 @@
/// Back into the pond it goes
/datum/ambient_activity/show_catch/proc/release()
- var/mob/living/basic/ambient_npc/outpost/angler/angler = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/angler/angler = doer
playsound(angler.water || doer, 'sound/effects/fish_splash.ogg', 30, TRUE, -3)
doer.set_held(null)
if(prob(50))
@@ -387,7 +387,7 @@
/// One angler at Halcyon's pond
/datum/ambient_outpost_role/angler
name = "angler"
- npc_type = /mob/living/basic/ambient_npc/outpost/angler
+ npc_type = /mob/living/carbon/human/npc/ambient_npc/outpost/angler
outpost_types = list(/obj/structure/overmap/trader_outpost/general)
max_count = 1
weight = 2
diff --git a/voidcrew/modules/ambient_npcs/outpost_dancer.dm b/voidcrew/modules/ambient_npcs/outpost_dancer.dm
index 8a927ec22a0..76e884a9402 100644
--- a/voidcrew/modules/ambient_npcs/outpost_dancer.dm
+++ b/voidcrew/modules/ambient_npcs/outpost_dancer.dm
@@ -81,7 +81,7 @@
// =========================================================================
/// Dances on the pole for the crowd, and screams and runs if the kingpin's crew starts trouble
-/mob/living/basic/ambient_npc/outpost/dancer
+/mob/living/carbon/human/npc/ambient_npc/outpost/dancer
desc = "Dances on the pole for the crowd."
dialogue_file = "outpost_dancer.json"
dialogue_section = "dancer"
@@ -98,7 +98,7 @@
var/back_to_pole = FALSE
/// Dances at the pole, with the odd break at the bar or a nearby seat. Straight back to the pole after trouble.
-/mob/living/basic/ambient_npc/outpost/dancer/pick_activity()
+/mob/living/carbon/human/npc/ambient_npc/outpost/dancer/pick_activity()
if(back_to_pole)
back_to_pole = FALSE
if(start_activity(new /datum/ambient_activity/dance_pole(src)))
@@ -108,13 +108,13 @@
return pick_anchored(routine, bar_spot, list(/datum/ambient_activity/sit))
/// Found mid-dance, up on the pole
-/mob/living/basic/ambient_npc/outpost/dancer/settle_in()
+/mob/living/carbon/human/npc/ambient_npc/outpost/dancer/settle_in()
if(settle_at(/datum/ambient_activity/dance_pole))
return TRUE
return ..()
/// The Undertow's suplexed rod, if there is one
-/mob/living/basic/ambient_npc/outpost/dancer/proc/find_pole()
+/mob/living/carbon/human/npc/ambient_npc/outpost/dancer/proc/find_pole()
return ambient_outpost_find(get_outpost(), /obj/structure/festivus/anchored)
/**
@@ -123,7 +123,7 @@
* is the dance's own check for that one tile: open ground on her leash, not in `avoid`, and nobody
* else on it, standing or lying.
*/
-/mob/living/basic/ambient_npc/outpost/dancer/proc/pole_free(turf/tile, list/avoid)
+/mob/living/carbon/human/npc/ambient_npc/outpost/dancer/proc/pole_free(turf/tile, list/avoid)
if(!isturf(tile) || LAZYACCESS(avoid, tile))
return FALSE
if(!isopenturf(tile) || isspaceturf(tile) || isgroundlessturf(tile) || islava(tile) || ischasm(tile))
@@ -134,7 +134,7 @@
return leash_ok(tile)
/// A fight at the outpost: she gets clear of it and keeps her head down until it has been quiet a while, screaming if it is right by the kingpin. She never leaves over it.
-/mob/living/basic/ambient_npc/outpost/dancer/react_violence(mob/living/offender)
+/mob/living/carbon/human/npc/ambient_npc/outpost/dancer/react_violence(mob/living/offender)
if(stat != CONSCIOUS || fading || istype(activity, /datum/ambient_activity/leave) || istype(activity, /datum/ambient_activity/take_cover))
return
// Already hiding: it is still going on
@@ -150,7 +150,7 @@
speak_context(AMBIENT_LINE_VIOLENCE, offender, force = TRUE)
/// Hit herself: she screams and gets clear, and goes back to her pole once it is quiet
-/mob/living/basic/ambient_npc/outpost/dancer/react_attacked(atom/attacker)
+/mob/living/carbon/human/npc/ambient_npc/outpost/dancer/react_attacked(atom/attacker)
if(stat != CONSCIOUS || fading || istype(activity, /datum/ambient_activity/leave))
return
if(still_hiding())
@@ -161,7 +161,7 @@
scream()
/// The kingpin's crew is shooting: she screams and runs for cover, and goes back to her pole once it is over (shootout_over(), inherited)
-/mob/living/basic/ambient_npc/outpost/dancer/react_shootout(turf/refuge)
+/mob/living/carbon/human/npc/ambient_npc/outpost/dancer/react_shootout(turf/refuge)
if(stat != CONSCIOUS || fading || istype(activity, /datum/ambient_activity/leave) || istype(activity, /datum/ambient_activity/take_cover))
return
if(start_activity(new /datum/ambient_activity/take_cover(src, refuge)))
@@ -169,14 +169,14 @@
scream()
/// Starts her hiding from `threat`. TRUE if she is.
-/mob/living/basic/ambient_npc/outpost/dancer/proc/hide_from(atom/threat)
+/mob/living/carbon/human/npc/ambient_npc/outpost/dancer/proc/hide_from(atom/threat)
if(!start_activity(new /datum/ambient_activity/dancer_hide(src, threat)))
return FALSE
back_to_pole = TRUE
return TRUE
/// If she is hiding, more trouble means it is not quiet yet, so she stays hidden longer. TRUE if she is hiding.
-/mob/living/basic/ambient_npc/outpost/dancer/proc/still_hiding()
+/mob/living/carbon/human/npc/ambient_npc/outpost/dancer/proc/still_hiding()
var/datum/ambient_activity/dancer_hide/hiding = activity
if(!istype(hiding))
return FALSE
@@ -184,7 +184,7 @@
return TRUE
/// A free tile within DANCER_HIDE_RANGE of her, further from `threat` than she is and as far as she can find; null to stay put
-/mob/living/basic/ambient_npc/outpost/dancer/proc/hiding_spot(atom/threat, list/avoid)
+/mob/living/carbon/human/npc/ambient_npc/outpost/dancer/proc/hiding_spot(atom/threat, list/avoid)
var/turf/here = get_turf(src)
var/turf/danger = get_turf(threat)
if(!here || !danger || danger.z != here.z)
@@ -203,17 +203,9 @@
best_distance = distance
return best
-/// A woman's scream. Never sleeps.
-/mob/living/basic/ambient_npc/outpost/dancer/proc/scream()
- var/static/list/screams = list(
- 'sound/mobs/humanoids/human/scream/femalescream_1.ogg',
- 'sound/mobs/humanoids/human/scream/femalescream_2.ogg',
- 'sound/mobs/humanoids/human/scream/femalescream_3.ogg',
- 'sound/mobs/humanoids/human/scream/femalescream_4.ogg',
- 'sound/mobs/humanoids/human/scream/femalescream_5.ogg',
- )
- manual_emote("screams!")
- playsound(src, pick(screams), 50, TRUE)
+/// A scream, her own (tg's *scream). Never sleeps.
+/mob/living/carbon/human/npc/ambient_npc/outpost/dancer/proc/scream()
+ INVOKE_ASYNC(src, TYPE_PROC_REF(/mob, emote), "scream")
/**
* Keeping clear of a fight: she runs a few steps away from it and crouches, until nothing has
@@ -229,7 +221,7 @@
var/calm_at = 0
/datum/ambient_activity/dancer_hide/setup()
- var/mob/living/basic/ambient_npc/outpost/dancer/dancer = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/dancer/dancer = doer
if(!istype(dancer))
return FALSE
set_duration()
@@ -282,7 +274,7 @@
var/side = SOUTH
/datum/ambient_activity/dance_pole/setup()
- var/mob/living/basic/ambient_npc/outpost/dancer/dancer = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/dancer/dancer = doer
if(!istype(dancer))
return FALSE
var/obj/structure/festivus/anchored/pole = dancer.find_pole()
@@ -346,7 +338,7 @@
/datum/ambient_activity/dance_pole/proc/try_climb()
if(on_pole)
return TRUE
- var/mob/living/basic/ambient_npc/outpost/dancer/dancer = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/dancer/dancer = doer
if(!pole() || doer.buckled || get_dist(doer, pole_turf) > 1 || !dancer.pole_free(pole_turf))
return FALSE
if(doer.loc != pole_turf)
@@ -498,7 +490,7 @@
/// One dancer at the Undertow
/datum/ambient_outpost_role/dancer
name = "dancer"
- npc_type = /mob/living/basic/ambient_npc/outpost/dancer
+ npc_type = /mob/living/carbon/human/npc/ambient_npc/outpost/dancer
outpost_types = list(/obj/structure/overmap/trader_outpost/black_market)
max_count = 1
weight = 3
diff --git a/voidcrew/modules/ambient_npcs/outpost_patrons.dm b/voidcrew/modules/ambient_npcs/outpost_patrons.dm
index 78f33a7124c..62a2cfe1755 100644
--- a/voidcrew/modules/ambient_npcs/outpost_patrons.dm
+++ b/voidcrew/modules/ambient_npcs/outpost_patrons.dm
@@ -2,7 +2,7 @@
* # World population: customers and drinkers at the trader outposts (owner items 2 and 3)
*
* Built here (spec 3.1, 3.2):
- * - /mob/living/basic/ambient_npc/outpost: the base for everyone PA brings to a trader outpost
+ * - /mob/living/carbon/human/npc/ambient_npc/outpost: the base for everyone PA brings to a trader outpost
* (customers, drinkers, the staff in outpost_workers.dm, the angler in outpost_angler.dm). They
* keep out of the pond, doorways, the lift's mouth, the kingpin's lounge and the bees.
* - Customers: to one or two counters, a line for that trader and the trader's answer in the
@@ -20,7 +20,7 @@
* mess for the janitor.
* Lines are in strings/outpost_patrons.json (AMBIENT_STRINGS_PATRONS).
*
- * Seams (P0, frozen): /mob/living/basic/ambient_npc (speak_context(), reply_to(), talked_to(),
+ * Seams (P0, frozen): /mob/living/carbon/human/npc/ambient_npc (speak_context(), reply_to(), talked_to(),
* react_violence(), react_shootout(), react_convoy(), pick_activity(), `routine`), the activities
* in ambient_activity.dm (idle, wander, sit, drink, chat, work, leave), /datum/ambient_outpost_role
* (npc_type, outpost_types, max_count, weight, gap_low/gap_high, wanted(), arrive()),
@@ -45,19 +45,27 @@
#define PATRON_SERVE_HIGH (15 SECONDS)
/// How far from the bar a drinker looks for a seat
#define PATRON_BAR_RANGE 14
-/// Sips of something strong per drunk stage
-#define PATRON_SIPS_PER_STAGE 2
-/// The stage at which they pass out
+/// How drunk (tg's get_drunk_amount()) a drinker is at each stage: chatty, loud, swaying, and done for
+/// (tg's own lines: 6 is drunk not tipsy, 16 slurs, 41 brings dizziness and confusion)
+#define PATRON_DRUNK_CHATTY 6
+#define PATRON_DRUNK_LOUD 16
+#define PATRON_DRUNK_SWAYING 31
+#define PATRON_DRUNK_DONE 41
+/// Drunk enough to be sick (tg's own line for it)
+#define PATRON_DRUNK_SICK 51
+/// The stage at which they are done for and sleep it off
#define PATRON_DRUNK_MAX 4
-/// A drinker sips this often
-#define PATRON_SIP_LOW (20 SECONDS)
-#define PATRON_SIP_HIGH (40 SECONDS)
+/// Gulps a drinker who was here before anyone came has already had, per round of drinks
+#define PATRON_GULPS_PER_ROUND 3
+/// A drinker takes a gulp this often
+#define PATRON_SIP_LOW (15 SECONDS)
+#define PATRON_SIP_HIGH (30 SECONDS)
/// Coffee sips at the crew room before something stronger
#define PATRON_COFFEE_SIPS 2
/// How long a drinker sleeps it off before going
#define PATRON_SLEEP_LOW (2 MINUTES)
#define PATRON_SLEEP_HIGH (4 MINUTES)
-/// Chance, when a drinker reaches stage 3 or 4, that they are sick on the floor (once)
+/// Chance, when a drinker drunk enough to be sick reaches a new stage, that they are (once)
#define PATRON_VOMIT_CHANCE 20
/// Least time between two drinks handed to one drinker
#define PATRON_HANDED_COOLDOWN (20 SECONDS)
@@ -83,7 +91,7 @@
* activities never send them into the pond, into or beside a doorway, into the lift's mouth, into
* the kingpin's lounge or near an apiary.
*/
-/mob/living/basic/ambient_npc/outpost
+/mob/living/carbon/human/npc/ambient_npc/outpost
desc = "Someone off one of the ships."
dialogue_file = AMBIENT_STRINGS_PATRONS
dialogue_section = "customer"
@@ -97,7 +105,7 @@
* ambient_outpost_tile_avoided() lists: the pond, doorways, the lift's mouth, the kingpin's lounge,
* the hives, and a counter's reach unless they have business there and nobody is being served.
*/
-/mob/living/basic/ambient_npc/outpost/standable(turf/tile, list/avoid, ignore_floor = FALSE)
+/mob/living/carbon/human/npc/ambient_npc/outpost/standable(turf/tile, list/avoid, ignore_floor = FALSE)
if(!isturf(tile) || LAZYACCESS(avoid, tile))
return FALSE
if(!isopenturf(tile) || isspaceturf(tile) || isgroundlessturf(tile) || islava(tile) || ischasm(tile))
@@ -112,7 +120,7 @@
return FALSE
return !ambient_outpost_tile_avoided(tile, place, counter_business)
-/mob/living/basic/ambient_npc/outpost/seat_usable(obj/structure/chair/seat, list/avoid)
+/mob/living/carbon/human/npc/ambient_npc/outpost/seat_usable(obj/structure/chair/seat, list/avoid)
. = ..()
if(!.)
return
@@ -127,7 +135,7 @@
* can be set up, then standing about: P0's pick_activity() with an anchor. The types in
* `anchored_types` (all of them when null) are made with `anchor`, the rest without.
*/
-/mob/living/basic/ambient_npc/outpost/proc/pick_anchored(list/weights, atom/anchor, list/anchored_types)
+/mob/living/carbon/human/npc/ambient_npc/outpost/proc/pick_anchored(list/weights, atom/anchor, list/anchored_types)
var/list/options = weights?.Copy()
while(length(options))
var/activity_type = pick_weight(options)
@@ -138,12 +146,12 @@
return start_activity(new /datum/ambient_activity/idle(src))
/// The trader outpost they are at, if any
-/mob/living/basic/ambient_npc/outpost/proc/get_outpost()
+/mob/living/carbon/human/npc/ambient_npc/outpost/proc/get_outpost()
var/datum/ambient_place/outpost/outpost_place = place
return istype(outpost_place) ? outpost_place.outpost() : null
/// A line for `context` from `section` of their file, said now to `other`. TRUE if said.
-/mob/living/basic/ambient_npc/outpost/proc/say_from(section, context, atom/other)
+/mob/living/carbon/human/npc/ambient_npc/outpost/proc/say_from(section, context, atom/other)
var/list/lines = ambient_dialogue_lines(dialogue_file, section, context)
if(!length(lines) || stat != CONSCIOUS || fading)
return FALSE
@@ -264,7 +272,7 @@
if(!trader)
return null
for(var/mob/living/customer in range(PATRON_COUNTER_RANGE, trader))
- if(customer.stat == DEAD || istype(customer, /mob/living/basic/ambient_npc) || istype(customer, /mob/living/basic/outpost_trader))
+ if(customer.stat == DEAD || istype(customer, /mob/living/carbon/human/npc/ambient_npc) || istype(customer, /mob/living/basic/outpost_trader))
continue
if(customer.client || ishuman(customer))
return customer
@@ -273,7 +281,7 @@
/// How many ambient NPCs stand or sit within reach of `trader`, not counting `exclude`
/proc/ambient_counter_crowd(mob/living/basic/outpost_trader/trader, mob/living/exclude)
. = 0
- for(var/mob/living/basic/ambient_npc/npc in range(PATRON_COUNTER_RANGE, trader))
+ for(var/mob/living/carbon/human/npc/ambient_npc/npc in range(PATRON_COUNTER_RANGE, trader))
if(npc != exclude && npc.stat != DEAD && !npc.fading)
.++
@@ -282,12 +290,12 @@
* tiles out with the counter (a table) in between, so never on the trader's own side. A trader with
* no counter at all is served from anywhere within reach.
*/
-/proc/ambient_counter_spots(mob/living/basic/ambient_npc/npc, mob/living/basic/outpost_trader/trader, list/avoid)
+/proc/ambient_counter_spots(mob/living/carbon/human/npc/ambient_npc/npc, mob/living/basic/outpost_trader/trader, list/avoid)
. = list()
var/turf/center = get_turf(trader)
if(!center || !npc)
return
- var/mob/living/basic/ambient_npc/outpost/visitor = npc
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/visitor = npc
if(istype(visitor))
visitor.counter_business = TRUE
var/list/open_spots = list()
@@ -329,7 +337,7 @@
* With `loiter` (default), only loiter spots count, so a crowded or bad queue gives up the
* spot instead of stacking. Null if none.
*/
-/proc/ambient_waiting_spot(mob/living/basic/ambient_npc/npc, atom/center, low = 3, high = 4, list/avoid, loiter = TRUE)
+/proc/ambient_waiting_spot(mob/living/carbon/human/npc/ambient_npc/npc, atom/center, low = 3, high = 4, list/avoid, loiter = TRUE)
var/turf/middle = get_turf(center)
if(!middle || !npc)
return null
@@ -512,7 +520,7 @@
/proc/ambient_outpost_report_mess(datum/ambient_place/outpost/place, obj/effect/decal/cleanable/mess)
if(!istype(place) || !ambient_is_mess(mess))
return
- for(var/mob/living/basic/ambient_npc/outpost/worker/janitor/janitor in place.living_npcs())
+ for(var/mob/living/carbon/human/npc/ambient_npc/outpost/worker/janitor/janitor in place.living_npcs())
if(janitor.notice_mess(mess))
return
@@ -591,7 +599,7 @@
// =========================================================================
/// Someone off one of the berthed ships, doing their shopping
-/mob/living/basic/ambient_npc/outpost/customer
+/mob/living/carbon/human/npc/ambient_npc/outpost/customer
desc = "Someone off one of the ships, doing their shopping."
dialogue_section = "customer"
outfit_choices = list(
@@ -617,16 +625,16 @@
/// Weakrefs to the traders they already bought from
var/list/visited
-/mob/living/basic/ambient_npc/outpost/customer/Initialize(mapload)
+/mob/living/carbon/human/npc/ambient_npc/outpost/customer/Initialize(mapload)
. = ..()
leave_at = world.time + rand(PATRON_VISIT_LOW, PATRON_VISIT_HIGH)
stalls_left = rand(1, PATRON_STALLS_MAX)
-/mob/living/basic/ambient_npc/outpost/customer/Destroy()
+/mob/living/carbon/human/npc/ambient_npc/outpost/customer/Destroy()
visited = null
return ..()
-/mob/living/basic/ambient_npc/outpost/customer/pick_activity()
+/mob/living/carbon/human/npc/ambient_npc/outpost/customer/pick_activity()
if(world.time >= leave_at)
if(prob(30))
speak_context(AMBIENT_LINE_LEAVE)
@@ -639,26 +647,26 @@
return ..()
/// Here a while already: part-way through their visit, at a counter, or done there with a bag in hand
-/mob/living/basic/ambient_npc/outpost/customer/settle_in()
+/mob/living/carbon/human/npc/ambient_npc/outpost/customer/settle_in()
leave_at = ambient_part_way(leave_at)
if(prob(40))
stalls_left--
set_held(/obj/item/storage/box/papersack)
return ..()
-/mob/living/basic/ambient_npc/outpost/customer/shift_times(delay)
+/mob/living/carbon/human/npc/ambient_npc/outpost/customer/shift_times(delay)
. = ..()
leave_at = ambient_shifted(leave_at, delay)
/// Whether they already bought from `trader` this visit
-/mob/living/basic/ambient_npc/outpost/customer/proc/has_visited(mob/living/basic/outpost_trader/trader)
+/mob/living/carbon/human/npc/ambient_npc/outpost/customer/proc/has_visited(mob/living/basic/outpost_trader/trader)
for(var/datum/weakref/ref as anything in visited)
if(ref.resolve() == trader)
return TRUE
return FALSE
/// The convoy came in: now and then a word about it
-/mob/living/basic/ambient_npc/outpost/customer/react_convoy(obj/structure/overmap/trader_outpost/outpost)
+/mob/living/carbon/human/npc/ambient_npc/outpost/customer/react_convoy(obj/structure/overmap/trader_outpost/outpost)
if(stat == CONSCIOUS && !fading && prob(30) && reaction_ready("convoy", 1 MINUTES))
speak_context("convoy")
@@ -699,7 +707,7 @@
/// A trader at their place to visit: one they have not bought from, whose counter is not crowded with NPCs
/datum/ambient_activity/shop_visit/proc/pick_trader()
- var/mob/living/basic/ambient_npc/outpost/customer/shopper = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/customer/shopper = doer
var/list/options = list()
for(var/mob/living/basic/outpost_trader/trader as anything in ambient_outpost_traders(doer.place))
if(!ambient_trader_section(trader))
@@ -791,7 +799,7 @@
/// Served: off with a paper bag
/datum/ambient_activity/shop_visit/proc/served(mob/living/basic/outpost_trader/trader)
doer.set_held(/obj/item/storage/box/papersack)
- var/mob/living/basic/ambient_npc/outpost/customer/shopper = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/customer/shopper = doer
if(istype(shopper))
LAZYADD(shopper.visited, WEAKREF(trader))
@@ -812,7 +820,7 @@
// =========================================================================
/// Off duty and at the bar, and it shows more with every drink
-/mob/living/basic/ambient_npc/outpost/drinker
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker
desc = "Someone off one of the ships, off duty."
dialogue_section = "drinker"
outfit_choices = list(
@@ -830,11 +838,9 @@
var/datum/weakref/barkeep_ref
/// Their bar's section of AMBIENT_STRINGS_PATRONS (PATRON_BAR_*)
var/bar_section
- /// 0 sober to PATRON_DRUNK_MAX passed out
+ /// How far gone they are, 0 sober to PATRON_DRUNK_MAX done for: read from tg's drunkenness (drunk_stage())
var/drunk = 0
- /// Sips of something strong since the last stage
- var/strong_sips = 0
- /// Sips of coffee (the crew room starts with coffee)
+ /// Gulps of coffee (the crew room starts with coffee)
var/coffee_sips = 0
/// They ordered at the bar
var/ordered = FALSE
@@ -842,21 +848,20 @@
var/cut_off = FALSE
/// They were sick on the floor (once)
var/vomited = FALSE
- /// They slept it off: next stop, the lift
+ /// They slept it off, or have had their fill: next stop, the lift
var/slept = FALSE
- /// Lying down and snoring
- var/asleep = FALSE
- /// Their transform before they lay down
- var/matrix/standing_transform
-/mob/living/basic/ambient_npc/outpost/drinker/Destroy()
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/Initialize(mapload, datum/human_npc_order/order)
+ . = ..()
+ RegisterSignal(src, COMSIG_CARBON_VOMITED, PROC_REF(on_vomited))
+
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/Destroy()
bar_ref = null
barkeep_ref = null
- standing_transform = null
return ..()
/// Finds their outpost's bar. FALSE when it has none.
-/mob/living/basic/ambient_npc/outpost/drinker/proc/find_bar()
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/proc/find_bar()
var/list/bar = ambient_outpost_bar(place)
if(!length(bar))
return FALSE
@@ -864,23 +869,23 @@
return TRUE
/// Sets their bar: `where` it is, its `barkeep` (or null), its `section` (PATRON_BAR_*)
-/mob/living/basic/ambient_npc/outpost/drinker/proc/set_bar(atom/where, mob/living/basic/outpost_trader/barkeep, section)
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/proc/set_bar(atom/where, mob/living/basic/outpost_trader/barkeep, section)
bar_ref = where ? WEAKREF(where) : null
barkeep_ref = barkeep ? WEAKREF(barkeep) : null
bar_section = section
/// Their bar, if it is still there
-/mob/living/basic/ambient_npc/outpost/drinker/proc/get_bar()
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/proc/get_bar()
var/atom/bar = bar_ref?.resolve()
return QDELETED(bar) ? null : bar
/// Their barkeep, if still at the bar
-/mob/living/basic/ambient_npc/outpost/drinker/proc/get_barkeep()
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/proc/get_barkeep()
var/mob/living/basic/outpost_trader/barkeep = barkeep_ref?.resolve()
return QDELETED(barkeep) ? null : barkeep
/// What is poured for them at their bar
-/mob/living/basic/ambient_npc/outpost/drinker/proc/bar_drink()
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/proc/bar_drink()
switch(bar_section)
if(PATRON_BAR_CREW_ROOM)
return /datum/reagent/consumable/coffee
@@ -888,7 +893,8 @@
return pick(/datum/reagent/consumable/ethanol/whiskey, /datum/reagent/consumable/ethanol/rum, /datum/reagent/consumable/ethanol/beer)
return /datum/reagent/consumable/ethanol/beer
-/mob/living/basic/ambient_npc/outpost/drinker/pick_activity()
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/pick_activity()
+ update_drunk_stage()
if(slept)
return start_activity(new /datum/ambient_activity/leave(src))
if(drunk >= PATRON_DRUNK_MAX)
@@ -906,58 +912,57 @@
/**
* Here a while already: in a seat near the bar (or at a table) with a glass in hand, having ordered
- * long ago, and some of them a stage or two in. With no seat or table to be had, their routine
- * starts when someone comes.
+ * long ago, and some of them a few drinks in: those gulps are swallowed now, while nobody is there
+ * to see, and the drink works on them as it would on anyone once people come. With no seat or table
+ * to be had, their routine starts when someone comes.
*/
-/mob/living/basic/ambient_npc/outpost/drinker/settle_in()
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/settle_in()
if(!get_bar() && !find_bar())
return ..()
ordered = TRUE
if(!start_activity(new /datum/ambient_activity/drink/bar(src, get_bar())) || !settle_here())
end_activity()
return ..()
- var/stages = pick(0, 1, 1, 2)
- if(stages && bar_section == PATRON_BAR_CREW_ROOM)
+ var/rounds = pick(0, 1, 1, 2)
+ if(rounds && bar_section == PATRON_BAR_CREW_ROOM)
// Off the coffee and onto something stronger already
- var/obj/item/reagent_containers/cup/glass/drinkingglass/glass = held_item
- if(istype(glass))
- glass.reagents.clear_reagents()
- glass.reagents.add_reagent(/datum/reagent/consumable/ethanol/beer, 25)
- set_held(glass)
- coffee_sips = -INFINITY
- if(stages)
- get_drunker(stages)
- strong_sips = rand(0, PATRON_SIPS_PER_STAGE - 1)
+ switch_to_strong(quiet = TRUE)
+ for(var/gulp in 1 to rounds * PATRON_GULPS_PER_ROUND)
+ if(!sip())
+ break
return TRUE
-// Slurring would wear off by itself while they sit still
-/mob/living/basic/ambient_npc/outpost/drinker/pause_routine()
- . = ..()
- remove_status_effect(/datum/status_effect/speech/slurring/generic)
-
-/mob/living/basic/ambient_npc/outpost/drinker/resume_routine()
- . = ..()
- if(drunk >= 3)
- set_slurring_if_lower(10 MINUTES)
-
/// Their lines for being talked to depend on how far gone they are
-/mob/living/basic/ambient_npc/outpost/drinker/get_lines(context)
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/get_lines(context)
if(context == AMBIENT_LINE_TALK)
- var/list/staged = ambient_dialogue_lines(dialogue_file, dialogue_section, asleep ? "talk_asleep" : "talk_[drunk]")
+ var/list/staged = ambient_dialogue_lines(dialogue_file, dialogue_section, "talk_[drunk]")
if(length(staged))
return staged
return ..()
+/// How far gone they are, from tg's drunkenness: 0 sober, 1 chatty, 2 loud, 3 swaying, PATRON_DRUNK_MAX done for
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/proc/drunk_stage()
+ var/amount = get_drunk_amount()
+ if(amount >= PATRON_DRUNK_DONE)
+ return PATRON_DRUNK_MAX
+ if(amount >= PATRON_DRUNK_SWAYING)
+ return 3
+ if(amount >= PATRON_DRUNK_LOUD)
+ return 2
+ if(amount >= PATRON_DRUNK_CHATTY)
+ return 1
+ return 0
+
/**
- * One stage drunker (or `amount`; negative sobers them). Stage 1 is chatty, stage 2 loud, stage 3
- * slurring and swaying, stage 4 done: the barkeep cuts them off and they go and lie down.
+ * Catches their stage up with how drunk they are. Stage 1 is chatty, stage 2 loud, stage 3 slurring
+ * and swaying (tg's drunkenness does the slurring), stage 4 done: the barkeep cuts them off and they
+ * go and sleep it off. A heavy drinker may be sick on the floor, once.
*/
-/mob/living/basic/ambient_npc/outpost/drinker/proc/get_drunker(amount = 1)
- var/old_stage = drunk
- drunk = clamp(drunk + amount, 0, PATRON_DRUNK_MAX)
- if(drunk == old_stage)
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/proc/update_drunk_stage()
+ var/stage = drunk_stage()
+ if(stage == drunk)
return
- strong_sips = 0
+ drunk = stage
switch(drunk)
if(0)
speech_pace = 1
@@ -967,17 +972,13 @@
speech_pace = 0.6
else
speech_pace = 0.7
- if(drunk >= 3)
- set_slurring_if_lower(10 MINUTES)
- else
- remove_status_effect(/datum/status_effect/speech/slurring/generic)
- if(drunk >= 3 && !vomited && prob(PATRON_VOMIT_CHANCE))
+ if(drunk >= 3 && !vomited && get_drunk_amount() >= PATRON_DRUNK_SICK && prob(PATRON_VOMIT_CHANCE))
be_sick()
if(drunk >= PATRON_DRUNK_MAX)
cut_off()
/// The barkeep has seen enough (once)
-/mob/living/basic/ambient_npc/outpost/drinker/proc/cut_off()
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/proc/cut_off()
if(cut_off)
return
cut_off = TRUE
@@ -985,49 +986,59 @@
if(barkeep)
ambient_trader_reply(barkeep, src, AMBIENT_STRINGS_PATRONS, bar_section, "cutoff", 10)
-/// Sick on the floor beside them, once. The janitor hears about it.
-/mob/living/basic/ambient_npc/outpost/drinker/proc/be_sick()
+/**
+ * Sick on the floor, once: tg's own vomiting. Human NPCs have TRAIT_NOHUNGER (the base's performance
+ * rule), which stops tg's drunk vomiting, so this is the drunk's own heave, at tg's own drunkenness
+ * for it (PATRON_DRUNK_SICK).
+ */
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/proc/be_sick()
vomited = TRUE
- var/turf/spot = free_tile_beside(src, 1) || get_turf(src)
- if(!spot)
- return
- var/obj/effect/decal/cleanable/vomit/mess = new(spot)
- playsound(src, 'sound/effects/splat.ogg', 30, TRUE, -3)
- INVOKE_ASYNC(src, TYPE_PROC_REF(/atom, manual_emote), "throws up.")
- if(!QDELETED(mess))
- ambient_outpost_report_mess(place, mess)
+ vomit(VOMIT_CATEGORY_DEFAULT | MOB_VOMIT_FORCE)
+
+/// They threw up: the janitor hears about the mess
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/proc/on_vomited(datum/source, distance, force)
+ SIGNAL_HANDLER
+ vomited = TRUE
+ // The decal goes down after the signal: report it next tick
+ addtimer(CALLBACK(src, PROC_REF(report_vomit), get_turf(src), dir), 1, TIMER_DELETE_ME)
+
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/proc/report_vomit(turf/where, facing)
+ for(var/turf/tile in list(where, get_step(where, facing)))
+ var/obj/effect/decal/cleanable/vomit/mess = locate() in tile
+ if(mess)
+ ambient_outpost_report_mess(place, mess)
+ return
/**
- * A sip was had from their glass: it counts towards the next stage when it was something strong.
- * At the crew room the first sips are coffee, then something stronger.
+ * A gulp was had from their glass. At the crew room the first gulps are coffee, then something
+ * stronger; drink works on them by itself, and their stage follows it.
*/
-/mob/living/basic/ambient_npc/outpost/drinker/proc/on_sip(strong)
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/proc/on_sip(strong)
if(!strong)
coffee_sips++
if(bar_section == PATRON_BAR_CREW_ROOM && coffee_sips >= PATRON_COFFEE_SIPS)
switch_to_strong()
- return
- if(++strong_sips >= PATRON_SIPS_PER_STAGE)
- get_drunker(1)
+ update_drunk_stage()
/// Coffee's done; something stronger in the same glass
-/mob/living/basic/ambient_npc/outpost/drinker/proc/switch_to_strong()
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/proc/switch_to_strong(quiet = FALSE)
var/obj/item/reagent_containers/cup/glass/drinkingglass/glass = held_item
if(!istype(glass))
return
glass.reagents.clear_reagents()
- glass.reagents.add_reagent(/datum/reagent/consumable/ethanol/beer, 25)
+ glass.reagents.add_reagent(/datum/reagent/consumable/ethanol/beer, AMBIENT_DRINK_POUR)
set_held(glass)
coffee_sips = -INFINITY
- say_from(bar_section, "stronger")
+ if(!quiet)
+ say_from(bar_section, "stronger")
/// Whether their glass holds something strong right now
-/mob/living/basic/ambient_npc/outpost/drinker/proc/glass_is_strong()
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/proc/glass_is_strong()
var/obj/item/reagent_containers/cup/glass/drinkingglass/glass = held_item
return istype(glass) && glass.reagents?.has_reagent(/datum/reagent/consumable/ethanol, check_subtypes = TRUE)
/// A word for the stage they are at: the bar's own lines early on, songs at stage 2, a pair talk with another drinker
-/mob/living/basic/ambient_npc/outpost/drinker/proc/drunk_chatter()
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/proc/drunk_chatter()
if(world.time < next_line_at || (place && world.time < place.next_line_at))
return
if(drunk >= 1 && prob(35) && pair_talk())
@@ -1039,12 +1050,12 @@
speak_context("stage_[drunk]")
/// An exchange with another drinker at their bar within a few tiles. TRUE if one started.
-/mob/living/basic/ambient_npc/outpost/drinker/proc/pair_talk()
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/proc/pair_talk()
var/list/conversation = pick_conversation()
if(length(conversation) < 2)
return FALSE
- for(var/mob/living/basic/ambient_npc/outpost/drinker/other in range(3, src))
- if(other == src || other.asleep || !other.can_act() || other.bar_section != bar_section)
+ for(var/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/other in range(3, src))
+ if(other == src || !other.can_act() || other.bar_section != bar_section)
continue
if(!istype(other.activity, /datum/ambient_activity/drink/bar))
continue
@@ -1053,45 +1064,27 @@
return TRUE
return FALSE
-/// Down on the sofa (or the floor), out cold
-/mob/living/basic/ambient_npc/outpost/drinker/proc/lie_down()
- if(asleep)
- return
- asleep = TRUE
- standing_transform = matrix(transform)
- var/matrix/lying = matrix(transform)
- lying.Turn(90)
- animate(src, transform = lying, time = 0.4 SECONDS)
-
-/// Up again
-/mob/living/basic/ambient_npc/outpost/drinker/proc/wake_up()
- if(!asleep)
- return
- asleep = FALSE
- // Killed where they slept: a body stays down
- if(stat != DEAD)
- animate(src, transform = standing_transform || matrix(), time = 0.4 SECONDS)
- standing_transform = null
-
/**
- * A drink handed to them: they drink from it. Something strong takes them a stage further,
- * anything else sobers them a little; poison they will not touch. The drink stays in the giver's hand.
+ * A drink handed to them: they take a gulp from it, as anyone does (the glass's own drinking: what
+ * is in it goes into them). They turn down only what anyone could tell by looking: a glass of
+ * something that isn't a drink, or a known poison. Poisoning one at a trader outpost is violence
+ * there, like hitting them. The drink stays in the giver's hand.
*/
-/mob/living/basic/ambient_npc/outpost/drinker/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
. = ..()
if(. || user.combat_mode)
return
if(!istype(tool, /obj/item/reagent_containers/cup/glass) && !istype(tool, /obj/item/reagent_containers/cup/soda_cans))
return
+ // Awake and up, they answer it themselves (a gulp, or a refusal); otherwise it is tg's feeding
+ if(!can_act() || fading)
+ return
accept_drink(user, tool)
return ITEM_INTERACT_SUCCESS
/// `user` hands them `drink`. TRUE if they drank from it.
-/mob/living/basic/ambient_npc/outpost/drinker/proc/accept_drink(mob/living/user, obj/item/reagent_containers/drink)
- if(stat != CONSCIOUS || fading)
- return FALSE
- if(asleep)
- INVOKE_ASYNC(src, TYPE_PROC_REF(/atom, manual_emote), "snores on.")
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/proc/accept_drink(mob/living/user, obj/item/reagent_containers/cup/drink)
+ if(!can_act() || fading)
return FALSE
if(!reaction_ready("handed", PATRON_HANDED_COOLDOWN))
return FALSE
@@ -1100,18 +1093,23 @@
if(!drink.reagents?.total_volume || !drink.is_drainable())
speak_context("handed_empty", user, force = TRUE)
return FALSE
- if(drink.reagents.has_reagent(/datum/reagent/toxin, check_subtypes = TRUE))
+ var/datum/reagent/looks_like = drink.reagents.get_master_reagent()
+ if(!istype(looks_like, /datum/reagent/consumable) || istype(looks_like, /datum/reagent/toxin))
speak_context("handed_refuse", user, force = TRUE)
return FALSE
+ if(!drink.canconsume(src, src))
+ return FALSE
var/strong = drink.reagents.has_reagent(/datum/reagent/consumable/ethanol, check_subtypes = TRUE)
- drink.reagents.remove_all(20)
- playsound(src, 'sound/items/drink.ogg', 30, TRUE, -4)
+ var/poisoned = drink.reagents.has_reagent(/datum/reagent/toxin, check_subtypes = TRUE)
+ log_combat(user, src, "handed a drink to", drink, "containing [drink.reagents.get_reagent_log_string()]")
+ drink.attack(src, src)
+ if(poisoned)
+ place?.npc_attacked(src, user, ATTACKER_DAMAGING_ATTACK)
if(strong)
- get_drunker(1)
speak_context(prob(30) ? "handed_gossip" : "handed", user, force = TRUE)
else
- get_drunker(-1)
speak_context("handed_sober", user, force = TRUE)
+ update_drunk_stage()
return TRUE
/// Ordering at the bar: up to the barkeep's counter ("the usual"), or a cup from the crew room's coffee machine
@@ -1125,7 +1123,7 @@
var/done_at = 0
/datum/ambient_activity/bar_order/setup()
- var/mob/living/basic/ambient_npc/outpost/drinker/drinker = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/drinker = doer
var/atom/bar = anchor()
if(!istype(drinker) || !bar)
return FALSE
@@ -1151,7 +1149,7 @@
done_at = world.time + rand(4 SECONDS, 7 SECONDS)
/datum/ambient_activity/bar_order/act(seconds)
- var/mob/living/basic/ambient_npc/outpost/drinker/drinker = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/drinker = doer
var/atom/bar = anchor()
if(!bar || !istype(drinker))
return AMBIENT_STEP_DONE
@@ -1189,7 +1187,7 @@
var/next_sway = 0
/datum/ambient_activity/drink/bar/setup()
- var/mob/living/basic/ambient_npc/outpost/drinker/drinker = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/drinker = doer
if(!istype(drinker))
return FALSE
reagent_type = drinker.bar_drink()
@@ -1234,9 +1232,12 @@
next_sip = world.time + rand(8 SECONDS, 15 SECONDS)
/datum/ambient_activity/drink/bar/act(seconds)
- var/mob/living/basic/ambient_npc/outpost/drinker/drinker = doer
- // Done for (a drink handed over can do it between sips)
- if(!istype(drinker) || drinker.drunk >= PATRON_DRUNK_MAX)
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/drinker = doer
+ if(!istype(drinker))
+ return AMBIENT_STEP_DONE
+ drinker.update_drunk_stage()
+ // Done for (a drink handed over can do it between gulps)
+ if(drinker.drunk >= PATRON_DRUNK_MAX)
return AMBIENT_STEP_DONE
if(world.time >= next_sip)
next_sip = world.time + rand(PATRON_SIP_LOW, PATRON_SIP_HIGH)
@@ -1248,20 +1249,23 @@
return AMBIENT_STEP_DONE
if(drinker.drunk >= 3 && world.time >= next_sway)
next_sway = world.time + rand(30 SECONDS, 60 SECONDS)
- drinker.Shake(2, 0, 0.6 SECONDS)
drinker.manual_emote(pick("sways.", "hiccups.", "grabs the edge of the table.", "nearly slides off the seat."))
if(world.time >= next_line)
next_line = world.time + rand(25 SECONDS, 50 SECONDS)
drinker.drunk_chatter()
return AMBIENT_STEP_CONTINUE
-/// The glass is finished before it goes down, so the barback can take it
+/// The glass is finished before it goes down, so the barback can take it. A night that ran its length
+/// without them getting done for ends with them heading home.
/datum/ambient_activity/drink/bar/finish()
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/drinker = doer
var/obj/item/reagent_containers/cup/glass/drinkingglass/glass = doer?.held_item
if(istype(glass))
glass.reagents?.clear_reagents()
if(!QDELETED(doer) && !ambient_outpost_has_barback(doer.place))
table_ref = null
+ if(istype(drinker) && !QDELETED(drinker) && ends_at && world.time >= ends_at && drinker.drunk < PATRON_DRUNK_MAX)
+ drinker.slept = TRUE
return ..()
/datum/ambient_activity/drink/bar/shift_times(delay)
@@ -1269,18 +1273,19 @@
next_sway = ambient_shifted(next_sway, delay)
/**
- * Sleeping it off: over to a sofa if there is one near (the floor if not), down, and snoring for a
- * few minutes. Then they wake and go, unless the barback walks them out first.
+ * Sleeping it off: over to a sofa if there is one near (the floor if not), down, and asleep for a
+ * few minutes, as anyone falls asleep (tg's Sleeping: they snore by themselves, and can be shaken
+ * awake). Then they wake and go, unless the barback shakes them awake and walks them out first.
*/
/datum/ambient_activity/sleep_it_off
name = "sleeping it off"
duration_low = PATRON_SLEEP_LOW
duration_high = PATRON_SLEEP_HIGH
var/datum/weakref/sofa_ref
- /// world.time of the next snore
- var/next_snore = 0
- /// world.time the barback is asked to come
+ /// world.time the barback comes for them, if one is free (half the time); 0 once asked
var/escort_at = 0
+ /// They have dropped off
+ var/slept_yet = FALSE
/datum/ambient_activity/sleep_it_off/setup()
var/obj/structure/chair/sofa/sofa = find_sofa()
@@ -1306,31 +1311,30 @@
return best
/datum/ambient_activity/sleep_it_off/arrive()
- var/mob/living/basic/ambient_npc/outpost/drinker/drinker = doer
var/obj/structure/chair/sofa/sofa = sofa_ref?.resolve()
if(sofa)
doer.sit_on(sofa)
- if(istype(drinker))
- drinker.lie_down()
- next_snore = world.time + rand(5 SECONDS, 15 SECONDS)
- escort_at = world.time + rand(30 SECONDS, 60 SECONDS)
+ else
+ doer.set_resting(TRUE, silent = TRUE)
+ doer.manual_emote(pick("slumps back, eyes closing.", "settles in for a nap."))
+ slept_yet = TRUE
+ escort_at = prob(50) ? world.time + rand(30 SECONDS, 60 SECONDS) : 0
+ doer.Sleeping(max(1 SECONDS, ends_at - world.time))
+// They only act once awake again: the sleep ran out, or someone shook them
/datum/ambient_activity/sleep_it_off/act(seconds)
- if(world.time >= next_snore)
- next_snore = world.time + rand(15 SECONDS, 30 SECONDS)
- doer.manual_emote(pick("snores.", "snores loudly.", "mumbles in their sleep.", "snores, and turns over."))
- if(escort_at && world.time >= escort_at)
- escort_at = 0
- ambient_outpost_call_escort(doer.place, doer)
- return AMBIENT_STEP_CONTINUE
+ if(doer.IsSleeping())
+ return AMBIENT_STEP_CONTINUE
+ return AMBIENT_STEP_DONE
/datum/ambient_activity/sleep_it_off/finish()
- var/mob/living/basic/ambient_npc/outpost/drinker/drinker = doer
- if(istype(drinker) && !QDELETED(drinker))
- drinker.wake_up()
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/drinker = doer
+ if(istype(drinker) && !QDELETED(drinker) && slept_yet)
drinker.slept = TRUE
- if(!drinker.fading && prob(50))
- drinker.speak_context("wake", null, force = TRUE)
+ if(drinker.stat == CONSCIOUS)
+ drinker.set_resting(FALSE, silent = TRUE)
+ if(!drinker.fading && prob(50))
+ drinker.speak_context("wake", null, force = TRUE)
return ..()
/datum/ambient_activity/sleep_it_off/spot_unreachable()
@@ -1339,14 +1343,25 @@
/datum/ambient_activity/sleep_it_off/shift_times(delay)
. = ..()
- next_snore = ambient_shifted(next_snore, delay)
escort_at = ambient_shifted(escort_at, delay)
+/// A drinker at `place` sleeping it off whom the barback should come and walk out now, or null. Once each.
+/proc/ambient_outpost_drunk_to_walk_out(datum/ambient_place/outpost/place)
+ if(!istype(place))
+ return null
+ for(var/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/drunk in place.npcs)
+ var/datum/ambient_activity/sleep_it_off/nap = drunk.activity
+ if(QDELETED(drunk) || drunk.stat == DEAD || drunk.fading || !istype(nap) || !nap.escort_at || world.time < nap.escort_at)
+ continue
+ nap.escort_at = 0
+ return drunk
+ return null
+
/// Someone at `place` could walk `drunk` to the lift: a free barback there, half the time
-/proc/ambient_outpost_call_escort(datum/ambient_place/outpost/place, mob/living/basic/ambient_npc/drunk)
+/proc/ambient_outpost_call_escort(datum/ambient_place/outpost/place, mob/living/carbon/human/npc/ambient_npc/drunk)
if(!istype(place) || QDELETED(drunk) || !prob(50))
return FALSE
- for(var/mob/living/basic/ambient_npc/outpost/worker/barback/barback in place.living_npcs())
+ for(var/mob/living/carbon/human/npc/ambient_npc/outpost/worker/barback/barback in place.living_npcs())
if(barback.activity?.priority > AMBIENT_PRIORITY_ROUTINE)
continue
if(barback.start_activity(new /datum/ambient_activity/escort(barback, drunk)))
@@ -1360,7 +1375,7 @@
/// Customers at every trader outpost: two at a time (one at the Undertow), one every minute or so
/datum/ambient_outpost_role/customer
name = "customer"
- npc_type = /mob/living/basic/ambient_npc/outpost/customer
+ npc_type = /mob/living/carbon/human/npc/ambient_npc/outpost/customer
outpost_types = list(
/obj/structure/overmap/trader_outpost/general,
/obj/structure/overmap/trader_outpost/outfitter,
@@ -1382,7 +1397,7 @@
/// One drinker at each outpost's bar
/datum/ambient_outpost_role/drinker
name = "drinker"
- npc_type = /mob/living/basic/ambient_npc/outpost/drinker
+ npc_type = /mob/living/carbon/human/npc/ambient_npc/outpost/drinker
outpost_types = list(
/obj/structure/overmap/trader_outpost/general,
/obj/structure/overmap/trader_outpost/outfitter,
@@ -1398,7 +1413,7 @@
/datum/ambient_outpost_role/drinker/arrive(datum/ambient_place/outpost/place, turf/where)
. = ..()
- var/mob/living/basic/ambient_npc/outpost/drinker/drinker = .
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/drinker = .
if(istype(drinker))
drinker.find_bar()
@@ -1411,7 +1426,12 @@
#undef PATRON_SERVE_LOW
#undef PATRON_SERVE_HIGH
#undef PATRON_BAR_RANGE
-#undef PATRON_SIPS_PER_STAGE
+#undef PATRON_DRUNK_CHATTY
+#undef PATRON_DRUNK_LOUD
+#undef PATRON_DRUNK_SWAYING
+#undef PATRON_DRUNK_DONE
+#undef PATRON_DRUNK_SICK
+#undef PATRON_GULPS_PER_ROUND
#undef PATRON_DRUNK_MAX
#undef PATRON_SIP_LOW
#undef PATRON_SIP_HIGH
diff --git a/voidcrew/modules/ambient_npcs/outpost_regulars.dm b/voidcrew/modules/ambient_npcs/outpost_regulars.dm
index 5873d7cb129..a61b56273b6 100644
--- a/voidcrew/modules/ambient_npcs/outpost_regulars.dm
+++ b/voidcrew/modules/ambient_npcs/outpost_regulars.dm
@@ -13,7 +13,7 @@
// =========================================================================
/// Reuses the mechanic outfits and work loop; always mid-job at a rack, pipe or panel
-/mob/living/basic/ambient_npc/outpost/worker/mechanic
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/mechanic
desc = "Permanently mid-job. Nobody has ever seen the job finished."
dialogue_section = "mechanic"
outfit_choices = list(
@@ -37,7 +37,7 @@
)
/// Found mid-job: at work on something
-/mob/living/basic/ambient_npc/outpost/worker/mechanic/settle_in()
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/mechanic/settle_in()
if(settle_at(/datum/ambient_activity/work))
return TRUE
return ..()
@@ -45,7 +45,7 @@
/// One mechanic at Halcyon
/datum/ambient_outpost_role/mechanic
name = "mechanic"
- npc_type = /mob/living/basic/ambient_npc/outpost/worker/mechanic
+ npc_type = /mob/living/carbon/human/npc/ambient_npc/outpost/worker/mechanic
outpost_types = list(/obj/structure/overmap/trader_outpost/general)
max_count = 1
weight = 3
@@ -63,13 +63,13 @@
back = /obj/item/claymore/cutlass
/// A drinker flavour: their own lines while sober, the drinker's staged lines once they've had a few
-/mob/living/basic/ambient_npc/outpost/drinker/off_duty_pirate
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/off_duty_pirate
desc = "Off duty, and about as relaxed as a pirate gets. The cutlass is mostly decorative."
outfit_choices = list(/datum/outfit/outpost_off_duty_pirate/ambient)
/// Their own lines, tried before the drinker's
var/flavour_section = "off_duty_pirate"
-/mob/living/basic/ambient_npc/outpost/drinker/off_duty_pirate/get_lines(context)
+/mob/living/carbon/human/npc/ambient_npc/outpost/drinker/off_duty_pirate/get_lines(context)
if(context == AMBIENT_LINE_IDLE || context == AMBIENT_LINE_ATTACKED || (context == AMBIENT_LINE_TALK && drunk == 0))
var/list/lines = ambient_dialogue_lines(dialogue_file, flavour_section, context)
if(length(lines))
@@ -79,7 +79,7 @@
/// One off-duty pirate at the Undertow, inheriting the drinker's wanted() and arrive()
/datum/ambient_outpost_role/drinker/off_duty_pirate
name = "off-duty pirate"
- npc_type = /mob/living/basic/ambient_npc/outpost/drinker/off_duty_pirate
+ npc_type = /mob/living/carbon/human/npc/ambient_npc/outpost/drinker/off_duty_pirate
outpost_types = list(/obj/structure/overmap/trader_outpost/black_market)
max_count = 1
weight = 2
diff --git a/voidcrew/modules/ambient_npcs/outpost_staff_door.dm b/voidcrew/modules/ambient_npcs/outpost_staff_door.dm
index 7921f501881..8fd8b6b614f 100644
--- a/voidcrew/modules/ambient_npcs/outpost_staff_door.dm
+++ b/voidcrew/modules/ambient_npcs/outpost_staff_door.dm
@@ -9,7 +9,7 @@
/// Whether `thing` is one of the ambient NPCs this door keeps out
/proc/outpost_staff_door_blocks(atom/thing)
- return istype(thing, /mob/living/basic/ambient_npc)
+ return istype(thing, /mob/living/carbon/human/npc/ambient_npc)
/obj/machinery/door/airlock/centcom/outpost_staff/CanAStarPass(to_dir, datum/can_pass_info/pass_info)
if(outpost_staff_door_blocks(pass_info.requester_ref?.resolve()))
diff --git a/voidcrew/modules/ambient_npcs/outpost_workers.dm b/voidcrew/modules/ambient_npcs/outpost_workers.dm
index fec79e7269c..936ffde5a88 100644
--- a/voidcrew/modules/ambient_npcs/outpost_workers.dm
+++ b/voidcrew/modules/ambient_npcs/outpost_workers.dm
@@ -58,12 +58,12 @@
// =========================================================================
/// Someone who works at the outpost. They duck when a fight starts and then carry on.
-/mob/living/basic/ambient_npc/outpost/worker
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker
desc = "Works here."
dialogue_file = AMBIENT_STRINGS_WORKERS
dialogue_section = "janitor"
-/mob/living/basic/ambient_npc/outpost/worker/react_violence(mob/living/offender)
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/react_violence(mob/living/offender)
if(stat != CONSCIOUS || fading || istype(activity, /datum/ambient_activity/leave) || !reaction_ready("violence"))
return
if(!start_activity(new /datum/ambient_activity/duck(src, offender)))
@@ -75,7 +75,7 @@
speak_context(AMBIENT_LINE_VIOLENCE, offender, force = TRUE)
/// Staff take a swing with a word and stay at work
-/mob/living/basic/ambient_npc/outpost/worker/react_attacked(atom/attacker)
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/react_attacked(atom/attacker)
if(stat != CONSCIOUS || fading || !reaction_ready("attacked"))
return
speak_context(AMBIENT_LINE_ATTACKED, attacker, force = TRUE)
@@ -126,7 +126,7 @@
. += thing
/// Where `npc` stands to use `thing`: on its tile if they can stand there (a wall-hung sink), beside it otherwise
-/proc/ambient_use_spot(mob/living/basic/ambient_npc/npc, atom/thing, list/avoid)
+/proc/ambient_use_spot(mob/living/carbon/human/npc/ambient_npc/npc, atom/thing, list/avoid)
var/turf/tile = get_turf(thing)
if(!tile)
return null
@@ -153,7 +153,7 @@
suit = /obj/item/clothing/suit/apron/overalls
head = /obj/item/clothing/head/beanie
-/mob/living/basic/ambient_npc/outpost/worker/janitor
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/janitor
desc = "Keeps the floors clean, more or less."
dialogue_section = "janitor"
outfit_choices = list(
@@ -173,30 +173,30 @@
/// Mess they could not get to: turf -> world.time they may try again
var/list/unreachable
-/mob/living/basic/ambient_npc/outpost/worker/janitor/Initialize(mapload)
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/janitor/Initialize(mapload)
. = ..()
set_held(/obj/item/mop)
-/mob/living/basic/ambient_npc/outpost/worker/janitor/Destroy()
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/janitor/Destroy()
mopped = null
unreachable = null
return ..()
/// They could not get to the mess on `tile`: it is left alone for a few minutes
-/mob/living/basic/ambient_npc/outpost/worker/janitor/proc/give_up_on(turf/tile)
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/janitor/proc/give_up_on(turf/tile)
if(!tile)
return
LAZYSET(unreachable, tile, world.time + WORKER_REMOP_TIME)
if(length(unreachable) > 12)
unreachable.Cut(1, 2)
-/mob/living/basic/ambient_npc/outpost/worker/janitor/pick_activity()
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/janitor/pick_activity()
// What was on the floor before anyone looked is the map's, not a mess
ambient_outpost_mark_decor(place)
return ..()
/// Found mid-job: mopping somewhere on the floor
-/mob/living/basic/ambient_npc/outpost/worker/janitor/settle_in()
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/janitor/settle_in()
ambient_outpost_mark_decor(place)
if(settle_at(/datum/ambient_activity/work/janitor))
return TRUE
@@ -224,7 +224,7 @@
. += junk
/// Where to stand to mop `tile`: beside it, or on it
-/mob/living/basic/ambient_npc/outpost/worker/janitor/proc/mop_spot(turf/tile, list/avoid)
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/janitor/proc/mop_spot(turf/tile, list/avoid)
if(!tile || !leash_ok(tile) || LAZYACCESS(unreachable, tile) > world.time)
return null
var/turf/stand = free_tile_beside(tile, 1, avoid)
@@ -236,7 +236,7 @@
* The nearest tile with mess on it they could get to, or null. However much mess is about, no more
* than WORKER_MESS_SPOT_CHECKS tiles are checked for a place to stand, nearest first.
*/
-/mob/living/basic/ambient_npc/outpost/worker/janitor/proc/find_mess()
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/janitor/proc/find_mess()
var/turf/here = get_turf(src)
if(!here)
return null
@@ -272,7 +272,7 @@
* Someone made `mess` near them: they come and mop it, unless they are busy with something that
* matters more or it is too far. TRUE if they are on their way.
*/
-/mob/living/basic/ambient_npc/outpost/worker/janitor/proc/notice_mess(obj/effect/decal/cleanable/mess)
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/janitor/proc/notice_mess(obj/effect/decal/cleanable/mess)
if(!can_act() || QDELETED(mess) || get_dist(src, mess) > WORKER_MESS_RANGE * 2)
return FALSE
if(istype(activity, /datum/ambient_activity/mop_mess) || activity?.priority > AMBIENT_PRIORITY_ROUTINE)
@@ -280,7 +280,7 @@
return !!start_activity(new /datum/ambient_activity/mop_mess(src, mess))
/// Cleans `tile`: its fresh mess and wrappers go, nothing else is touched
-/mob/living/basic/ambient_npc/outpost/worker/janitor/proc/clean_tile(turf/tile)
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/janitor/proc/clean_tile(turf/tile)
for(var/atom/movable/mess as anything in ambient_outpost_mess_on(tile))
qdel(mess)
LAZYSET(mopped, tile, world.time)
@@ -288,7 +288,7 @@
mopped.Cut(1, 2)
/// Whether they mopped `tile` a little while ago
-/mob/living/basic/ambient_npc/outpost/worker/janitor/proc/mopped_recently(turf/tile)
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/janitor/proc/mopped_recently(turf/tile)
return LAZYACCESS(mopped, tile) && world.time - mopped[tile] < WORKER_REMOP_TIME
/**
@@ -312,7 +312,7 @@
var/wetted = FALSE
/datum/ambient_activity/mop_mess/setup()
- var/mob/living/basic/ambient_npc/outpost/worker/janitor/janitor = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/worker/janitor/janitor = doer
if(!istype(janitor))
return FALSE
var/turf/tile = get_turf(anchor())
@@ -333,7 +333,7 @@
return ..()
/datum/ambient_activity/mop_mess/arrive()
- var/mob/living/basic/ambient_npc/outpost/worker/janitor/janitor = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/worker/janitor/janitor = doer
if(!mess_tile)
return
if(mess_tile != get_turf(doer) && !doer.buckled)
@@ -347,7 +347,7 @@
/// A wet floor sign on the mess, if they have one left
/datum/ambient_activity/mop_mess/proc/put_sign()
- var/mob/living/basic/ambient_npc/outpost/worker/janitor/janitor = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/worker/janitor/janitor = doer
if(janitor.signs_left <= 0 || !isopenturf(mess_tile) || mess_tile.is_blocked_turf(exclude_mobs = TRUE))
return
janitor.signs_left--
@@ -367,7 +367,7 @@
doer.setDir(turn(get_dir(doer, mess_tile) || doer.dir, pick(90, -90)))
return AMBIENT_STEP_CONTINUE
mopped = TRUE
- var/mob/living/basic/ambient_npc/outpost/worker/janitor/janitor = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/worker/janitor/janitor = doer
janitor.clean_tile(mess_tile)
// Wet only under their own sign, and never in or at a doorway
var/obj/item/clothing/suit/caution/sign = sign_ref?.resolve()
@@ -393,7 +393,7 @@
wetted = FALSE
var/turf/open/floor = mess_tile
floor.MakeDry(TURF_WET_WATER, TRUE)
- var/mob/living/basic/ambient_npc/outpost/worker/janitor/janitor = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/worker/janitor/janitor = doer
if(!QDELETED(sign) && isturf(sign.loc) && get_dist(sign, doer) <= 2)
qdel(sign)
if(istype(janitor))
@@ -409,7 +409,7 @@
/datum/ambient_activity/mop_mess/spot_unreachable()
. = ..()
- var/mob/living/basic/ambient_npc/outpost/worker/janitor/janitor = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/worker/janitor/janitor = doer
if(istype(janitor))
janitor.give_up_on(mess_tile)
mess_tile = null
@@ -445,7 +445,7 @@
head = /obj/item/clothing/head/flatcap
shoes = /obj/item/clothing/shoes/galoshes
-/mob/living/basic/ambient_npc/outpost/worker/gardener
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/gardener
desc = "Looks after the outpost's plants."
dialogue_section = "gardener"
outfit_choices = list(
@@ -463,30 +463,30 @@
/// Weakrefs to the trays they watered last
var/list/tended
-/mob/living/basic/ambient_npc/outpost/worker/gardener/Initialize(mapload)
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/gardener/Initialize(mapload)
. = ..()
can_water = rand(1, WORKER_CAN_POURS)
set_held(/obj/item/reagent_containers/cup/watering_can)
-/mob/living/basic/ambient_npc/outpost/worker/gardener/Destroy()
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/gardener/Destroy()
tended = null
return ..()
/// Found mid-job: at one of the outpost's trays with the watering can
-/mob/living/basic/ambient_npc/outpost/worker/gardener/settle_in()
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/gardener/settle_in()
if(settle_at(/datum/ambient_activity/tend_plants, null, 1))
return TRUE
return ..()
/// Whether they watered `tray` lately
-/mob/living/basic/ambient_npc/outpost/worker/gardener/proc/tended_lately(obj/machinery/hydroponics/tray)
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/gardener/proc/tended_lately(obj/machinery/hydroponics/tray)
for(var/datum/weakref/ref as anything in tended)
if(ref.resolve() == tray)
return TRUE
return FALSE
/// Remembers watering `tray`
-/mob/living/basic/ambient_npc/outpost/worker/gardener/proc/remember_tray(obj/machinery/hydroponics/tray)
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/gardener/proc/remember_tray(obj/machinery/hydroponics/tray)
LAZYADD(tended, WEAKREF(tray))
if(length(tended) > WORKER_TENDED_MEMORY)
tended.Cut(1, 2)
@@ -495,7 +495,7 @@
* The next of the outpost's own trays to water: the driest one they did not just water, and could
* stand beside (never near a hive). Trays a player brought or built are left alone.
*/
-/mob/living/basic/ambient_npc/outpost/worker/gardener/proc/find_tray(list/avoid)
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/gardener/proc/find_tray(list/avoid)
var/obj/structure/overmap/trader_outpost/outpost = get_outpost()
var/obj/machinery/hydroponics/best
var/best_score = INFINITY
@@ -511,7 +511,7 @@
return best
/// The nearest sink they could fill the can at, or null
-/mob/living/basic/ambient_npc/outpost/worker/gardener/proc/find_sink(list/avoid)
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/gardener/proc/find_sink(list/avoid)
var/obj/structure/sink/best
var/best_distance = INFINITY
for(var/obj/structure/sink/sink as anything in ambient_outpost_find_all(get_outpost(), /obj/structure/sink))
@@ -535,7 +535,7 @@
var/done_at = 0
/datum/ambient_activity/tend_plants/setup()
- var/mob/living/basic/ambient_npc/outpost/worker/gardener/gardener = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/worker/gardener/gardener = doer
if(!istype(gardener))
return FALSE
var/atom/target
@@ -574,7 +574,7 @@
doer.speak_context("water")
/datum/ambient_activity/tend_plants/act(seconds)
- var/mob/living/basic/ambient_npc/outpost/worker/gardener/gardener = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/worker/gardener/gardener = doer
var/atom/target = target_ref?.resolve()
if(QDELETED(target) || !istype(gardener))
return AMBIENT_STEP_DONE
@@ -599,7 +599,7 @@
*/
/datum/ambient_activity/tend_plants/spot_unreachable()
. = ..()
- var/mob/living/basic/ambient_npc/outpost/worker/gardener/gardener = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/worker/gardener/gardener = doer
var/obj/machinery/hydroponics/tray = target_ref?.resolve()
target_ref = null
if(!istype(gardener))
@@ -630,7 +630,7 @@
uniform = /obj/item/clothing/under/color/grey
head = /obj/item/clothing/head/beanie
-/mob/living/basic/ambient_npc/outpost/worker/barback
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/barback
desc = "Clears the glasses, wipes the tables and walks out whoever can't walk."
dialogue_section = "barback"
outfit_choices = list(
@@ -645,12 +645,16 @@
/datum/ambient_activity/chat = 1,
)
/// Empty glasses on their tray
- var/glasses = 0
+ var/tray_glasses = 0
-/mob/living/basic/ambient_npc/outpost/worker/barback/pick_activity()
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/barback/pick_activity()
+ // A drinker sleeping it off who has been there long enough: shaken awake and walked out
+ var/mob/living/carbon/human/npc/ambient_npc/drunk = ambient_outpost_drunk_to_walk_out(place)
+ if(drunk && start_activity(new /datum/ambient_activity/escort(src, drunk)))
+ return activity
var/list/bar = ambient_outpost_bar(place)
var/atom/bar_spot = length(bar) ? bar[1] : null
- if(glasses >= WORKER_TRAY_MAX || (glasses > 0 && prob(30)))
+ if(tray_glasses >= WORKER_TRAY_MAX || (tray_glasses > 0 && prob(30)))
var/datum/ambient_activity/wash = start_activity(new /datum/ambient_activity/wash_glasses(src, bar_spot))
if(wash)
return wash
@@ -658,7 +662,7 @@
return pick_anchored(routine, bar_spot, list(/datum/ambient_activity/collect_glasses, /datum/ambient_activity/wander))
/// Found mid-job: wiping down tables round the bar
-/mob/living/basic/ambient_npc/outpost/worker/barback/settle_in()
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/barback/settle_in()
var/list/bar = ambient_outpost_bar(place)
var/atom/bar_spot = length(bar) ? bar[1] : null
if(bar_spot && settle_at(/datum/ambient_activity/work/barback, null, AMBIENT_SETTLE_TRIES, bar_spot))
@@ -666,7 +670,7 @@
return ..()
/// An empty drinking glass left on a table or the floor near `center` that they could reach, or null
-/mob/living/basic/ambient_npc/outpost/worker/barback/proc/find_glass(atom/center, list/avoid)
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/barback/proc/find_glass(atom/center, list/avoid)
var/turf/middle = get_turf(center) || get_turf(src)
if(!middle)
return null
@@ -693,8 +697,8 @@
var/pick_at = 0
/datum/ambient_activity/collect_glasses/setup()
- var/mob/living/basic/ambient_npc/outpost/worker/barback/barback = doer
- if(!istype(barback) || barback.glasses >= WORKER_TRAY_MAX)
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/worker/barback/barback = doer
+ if(!istype(barback) || barback.tray_glasses >= WORKER_TRAY_MAX)
return FALSE
var/obj/item/reagent_containers/cup/glass/drinkingglass/glass = barback.find_glass(anchor(), failed_spots)
if(!glass)
@@ -714,7 +718,7 @@
pick_at = world.time + rand(1 SECONDS, 2 SECONDS)
/datum/ambient_activity/collect_glasses/act(seconds)
- var/mob/living/basic/ambient_npc/outpost/worker/barback/barback = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/worker/barback/barback = doer
var/obj/item/reagent_containers/cup/glass/drinkingglass/glass = glass_ref?.resolve()
if(!ambient_glass_is_empty(glass) || !istype(barback))
return AMBIENT_STEP_DONE
@@ -723,12 +727,12 @@
var/turf/spot = glass.loc
var/on_floor = !(locate(/obj/structure/table) in spot)
for(var/obj/item/reagent_containers/cup/glass/drinkingglass/empty in spot.contents.Copy())
- if(barback.glasses >= WORKER_TRAY_MAX)
+ if(barback.tray_glasses >= WORKER_TRAY_MAX)
break
if(!ambient_glass_is_empty(empty))
continue
qdel(empty)
- barback.glasses++
+ barback.tray_glasses++
playsound(barback, 'sound/items/handling/drinkglass_pickup.ogg', 30, TRUE, -4)
barback.set_held(/obj/item/storage/bag/tray)
if(prob(40))
@@ -754,8 +758,8 @@
var/done_at = 0
/datum/ambient_activity/wash_glasses/setup()
- var/mob/living/basic/ambient_npc/outpost/worker/barback/barback = doer
- if(!istype(barback) || barback.glasses <= 0)
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/worker/barback/barback = doer
+ if(!istype(barback) || barback.tray_glasses <= 0)
return FALSE
var/atom/bar = anchor()
var/turf/center = get_turf(bar) || get_turf(doer)
@@ -777,7 +781,7 @@
target = stand ? barkeep : null
if(!target)
// Nowhere to take them: they go out the back with the rest
- barback.glasses = 0
+ barback.tray_glasses = 0
barback.set_held(null)
return FALSE
target_ref = WEAKREF(target)
@@ -795,7 +799,7 @@
done_at = world.time + rand(4 SECONDS, 7 SECONDS)
/datum/ambient_activity/wash_glasses/act(seconds)
- var/mob/living/basic/ambient_npc/outpost/worker/barback/barback = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/worker/barback/barback = doer
var/atom/target = target_ref?.resolve()
if(QDELETED(target) || !istype(barback))
return AMBIENT_STEP_DONE
@@ -803,7 +807,7 @@
if(prob(50))
playsound(barback, istype(target, /obj/structure/sink) ? 'sound/machines/sink-faucet.ogg' : 'sound/items/handling/drinkglass_drop.ogg', 20, TRUE, -4)
return AMBIENT_STEP_CONTINUE
- barback.glasses = 0
+ barback.tray_glasses = 0
barback.set_held(null)
return AMBIENT_STEP_DONE
@@ -811,9 +815,9 @@
/datum/ambient_activity/wash_glasses/spot_unreachable()
. = ..()
target_ref = null
- var/mob/living/basic/ambient_npc/outpost/worker/barback/barback = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/worker/barback/barback = doer
if(istype(barback))
- barback.glasses = 0
+ barback.tray_glasses = 0
barback.set_held(null)
/datum/ambient_activity/wash_glasses/shift_times(delay)
@@ -826,8 +830,8 @@
work_weights = list(/datum/outpost_ambient_work/wipe = 1)
/**
- * Walking a passed-out drinker to the lift: over to them, a word to wake them, and beside them all
- * the way while they leave.
+ * Walking a passed-out drinker to the lift: over to them, a shake to wake them (tg's help: an empty
+ * hand on someone asleep), a word, and beside them all the way while they leave.
*/
/datum/ambient_activity/escort
name = "walking someone out"
@@ -837,29 +841,36 @@
var/woke = FALSE
/datum/ambient_activity/escort/setup()
- var/mob/living/basic/ambient_npc/drunk = anchor()
- if(!istype(drunk) || drunk.stat != CONSCIOUS || drunk.fading)
+ var/mob/living/carbon/human/npc/ambient_npc/drunk = anchor()
+ if(!istype(drunk) || drunk.stat == DEAD || drunk.fading || HAS_TRAIT(drunk, TRAIT_CRITICAL_CONDITION))
return FALSE
go_to(get_turf(drunk), 1)
set_duration()
return TRUE
-/datum/ambient_activity/escort/arrive()
- var/mob/living/basic/ambient_npc/drunk = anchor()
- if(!drunk || woke)
- return
- woke = TRUE
- if(!doer.buckled)
- doer.face_atom(drunk)
- doer.speak_context("escort", drunk, force = TRUE)
- drunk.start_activity(new /datum/ambient_activity/leave(drunk))
-
/datum/ambient_activity/escort/act(seconds)
- var/mob/living/basic/ambient_npc/drunk = anchor()
- if(!drunk || drunk.fading || drunk.stat != CONSCIOUS || !istype(drunk.activity, /datum/ambient_activity/leave))
+ var/mob/living/carbon/human/npc/ambient_npc/drunk = anchor()
+ if(!drunk || drunk.fading || drunk.stat == DEAD || HAS_TRAIT(drunk, TRAIT_CRITICAL_CONDITION))
+ return AMBIENT_STEP_DONE
+ if(!woke)
+ if(get_dist(doer, drunk) > 1)
+ go_to(get_turf(drunk), 1)
+ return AMBIENT_STEP_MOVE
+ if(!doer.buckled)
+ doer.face_atom(drunk)
+ if(drunk.stat != CONSCIOUS)
+ // A shake, as anyone wakes a sleeper (an empty hand)
+ human_npc_ready_empty_hand(doer)
+ doer.ai_controller?.ai_interact(drunk, combat_mode = FALSE)
+ return AMBIENT_STEP_CONTINUE
+ woke = TRUE
+ doer.speak_context("escort", drunk, force = TRUE)
+ drunk.start_activity(new /datum/ambient_activity/leave(drunk))
+ return AMBIENT_STEP_CONTINUE
+ if(drunk.stat != CONSCIOUS || !istype(drunk.activity, /datum/ambient_activity/leave))
return AMBIENT_STEP_DONE
// They can manage the last few steps to the lift; the barback stays off it, and on this side of the checkpoint
- var/mob/living/basic/ambient_npc/outpost/barback = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/barback = doer
var/obj/structure/overmap/trader_outpost/outpost = istype(barback) ? barback.get_outpost() : null
if(length(outpost?.checkpoints) && !outpost.is_secured_turf(get_turf(drunk)))
return AMBIENT_STEP_DONE
@@ -892,7 +903,7 @@
uniform = /obj/item/clothing/under/misc/overalls
head = /obj/item/clothing/head/utility/hardhat
-/mob/living/basic/ambient_npc/outpost/worker/dock
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/dock
desc = "Moves the depot's freight, one crate at a time."
dialogue_section = "dock_worker"
outfit_choices = list(
@@ -907,12 +918,12 @@
/datum/ambient_activity/chat = 1,
)
-/mob/living/basic/ambient_npc/outpost/worker/dock/pick_activity()
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/dock/pick_activity()
// The coffee break is taken by the crew room's machine
return pick_anchored(routine, ambient_outpost_find(get_outpost(), /obj/machinery/vending/coffee), list(/datum/ambient_activity/drink/coffee))
/// Found mid-job hauling freight, or else on a coffee break by the crew room's machine
-/mob/living/basic/ambient_npc/outpost/worker/dock/settle_in()
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/dock/settle_in()
if(settle_at(/datum/ambient_activity/work/dock))
return TRUE
var/obj/machinery/vending/coffee/machine = ambient_outpost_find(get_outpost(), /obj/machinery/vending/coffee)
@@ -921,7 +932,7 @@
return ..()
/// The convoy is in: everything down, and the crates come off the lift
-/mob/living/basic/ambient_npc/outpost/worker/dock/react_convoy(obj/structure/overmap/trader_outpost/outpost)
+/mob/living/carbon/human/npc/ambient_npc/outpost/worker/dock/react_convoy(obj/structure/overmap/trader_outpost/outpost)
if(stat != CONSCIOUS || fading || istype(activity, /datum/ambient_activity/convoy_unload))
return
start_activity(new /datum/ambient_activity/convoy_unload(src))
@@ -974,7 +985,7 @@
var/wait_until = 0
/datum/ambient_activity/convoy_unload/setup()
- var/mob/living/basic/ambient_npc/outpost/worker/dock/worker = doer
+ var/mob/living/carbon/human/npc/ambient_npc/outpost/worker/dock/worker = doer
var/obj/structure/overmap/trader_outpost/outpost = istype(worker) ? worker.get_outpost() : null
if(!outpost)
return FALSE
@@ -1058,7 +1069,7 @@
/// A janitor at Quartermain
/datum/ambient_outpost_role/janitor
name = "janitor"
- npc_type = /mob/living/basic/ambient_npc/outpost/worker/janitor
+ npc_type = /mob/living/carbon/human/npc/ambient_npc/outpost/worker/janitor
outpost_types = list(/obj/structure/overmap/trader_outpost/outfitter)
max_count = 1
weight = 3
@@ -1068,7 +1079,7 @@
/// A gardener for Halcyon's conservatory and dome
/datum/ambient_outpost_role/gardener
name = "gardener"
- npc_type = /mob/living/basic/ambient_npc/outpost/worker/gardener
+ npc_type = /mob/living/carbon/human/npc/ambient_npc/outpost/worker/gardener
outpost_types = list(/obj/structure/overmap/trader_outpost/general)
max_count = 1
weight = 3
@@ -1078,7 +1089,7 @@
/// A barback at the Dregs
/datum/ambient_outpost_role/barback
name = "barback"
- npc_type = /mob/living/basic/ambient_npc/outpost/worker/barback
+ npc_type = /mob/living/carbon/human/npc/ambient_npc/outpost/worker/barback
outpost_types = list(/obj/structure/overmap/trader_outpost/black_market)
max_count = 1
weight = 3
@@ -1088,7 +1099,7 @@
/// A dock worker at Quartermain
/datum/ambient_outpost_role/dock_worker
name = "dock worker"
- npc_type = /mob/living/basic/ambient_npc/outpost/worker/dock
+ npc_type = /mob/living/carbon/human/npc/ambient_npc/outpost/worker/dock
outpost_types = list(/obj/structure/overmap/trader_outpost/outfitter)
max_count = 1
weight = 3
diff --git a/voidcrew/modules/ambient_npcs/planet_fishers.dm b/voidcrew/modules/ambient_npcs/planet_fishers.dm
index a0e179457ec..f05eca6a344 100644
--- a/voidcrew/modules/ambient_npcs/planet_fishers.dm
+++ b/voidcrew/modules/ambient_npcs/planet_fishers.dm
@@ -89,7 +89,7 @@
var/catches = 0
var/misses = 0
-/datum/ambient_activity/fish/New(mob/living/basic/ambient_npc/new_doer, atom/water)
+/datum/ambient_activity/fish/New(mob/living/carbon/human/npc/ambient_npc/new_doer, atom/water)
. = ..()
if(!water)
water = find_water()
@@ -251,7 +251,7 @@
. = ..()
if(QDELETED(doer))
return
- var/mob/living/basic/ambient_npc/planet/planet_npc = doer
+ var/mob/living/carbon/human/npc/ambient_npc/planet/planet_npc = doer
if(istype(planet_npc))
planet_npc.show_idle_held()
else
@@ -306,11 +306,23 @@
shoes = /obj/item/clothing/shoes/workboots/mining
gloves = /obj/item/clothing/gloves/color/black
glasses = /obj/item/clothing/glasses/meson
+ belt = /obj/item/pickaxe
-/mob/living/basic/ambient_npc/planet/lava_fisher
+/// Red: a goliath hide cloak over the scorched overalls
+/datum/outfit/ambient_lava_fisher/cloak
+ name = "Ambient NPC: lava fisher in a hide cloak"
+ suit = /obj/item/clothing/suit/hooded/cloak/goliath
+
+/// Lava fishers by band (AM-1)
+/datum/human_npc_outfit_table/ambient_lava_fisher
+ green = list(/datum/outfit/ambient_lava_fisher = 1)
+ red = list(/datum/outfit/ambient_lava_fisher/cloak = 1)
+
+/mob/living/carbon/human/npc/ambient_npc/planet/lava_fisher
name = "lava fisher"
desc = "A miner in a scorched coat, fishing the lava on a long steel line."
- outfit = /datum/outfit/ambient_lava_fisher
+ outfit = null
+ npc_outfit_table = /datum/human_npc_outfit_table/ambient_lava_fisher
dialogue_section = "lava_fisher"
speech_pace = 1.2
fights_back = TRUE
@@ -325,7 +337,7 @@
)
// Once per crew: a fillet off the hot rock
-/mob/living/basic/ambient_npc/planet/lava_fisher/talked_to(mob/living/user)
+/mob/living/carbon/human/npc/ambient_npc/planet/lava_fisher/talked_to(mob/living/user)
if(!talk_ready(user))
return
if(!buckled)
@@ -375,7 +387,7 @@
chair.setDir(get_dir(site.center, lava))
ensure_prop(site, /obj/effect/ambient_camp_prop/lamp, ambient_free_turf_near(site.center, 1))
for(var/i in 1 to missing)
- var/mob/living/basic/ambient_npc/planet/lava_fisher/fisher = site.spawn_npc(npc_type, ambient_free_turf_near(site.center, 1) || site.center)
+ var/mob/living/carbon/human/npc/ambient_npc/planet/lava_fisher/fisher = site.spawn_npc(npc_type, ambient_free_turf_near(site.center, 1) || site.center)
if(fisher)
fisher.leash_bounds = ambient_square_bounds(site.center, 8)
return TRUE
@@ -419,9 +431,19 @@
name = "Ambient NPC: boat fisher"
uniform = /obj/item/clothing/under/color/blue
suit = /obj/item/clothing/suit/jacket/puffer/vest
- head = /obj/item/clothing/head/soft/fishing_hat
+ head = /obj/item/clothing/head/soft/blue // the legendary fishing hat only stays on a master angler
shoes = /obj/item/clothing/shoes/workboots
+/// Red: a flak vest instead of the puffer
+/datum/outfit/ambient_boat_fisher/vest
+ name = "Ambient NPC: boat fisher in a flak vest"
+ suit = /obj/item/clothing/suit/armor/vest
+
+/// Boat fishers by band (AM-1)
+/datum/human_npc_outfit_table/ambient_boat_fisher
+ green = list(/datum/outfit/ambient_boat_fisher = 1)
+ red = list(/datum/outfit/ambient_boat_fisher/vest = 1)
+
/**
* A hide boat out on the water: scenery with a seat. The fisher sits in it; it floats (nothing in
* it is drawn under the water) and rows with them in it. Nobody can pull the fisher out or wreck it.
@@ -439,16 +461,17 @@
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ACID_PROOF | UNACIDABLE
layer = BELOW_MOB_LAYER
-// The fisher stays in their boat while they live
+// The fisher stays in their boat while awake; one who is down or dead can be pulled out like anyone
/obj/structure/ambient_boat/user_unbuckle_mob(mob/living/buckled_mob, mob/user)
- if(istype(buckled_mob, /mob/living/basic/ambient_npc) && buckled_mob.stat != DEAD)
+ if(istype(buckled_mob, /mob/living/carbon/human/npc/ambient_npc) && buckled_mob.stat == CONSCIOUS)
return null
return ..()
-/mob/living/basic/ambient_npc/planet/boat_fisher
+/mob/living/carbon/human/npc/ambient_npc/planet/boat_fisher
name = "fisher"
desc = "A weathered fisher in a hide boat, line in the water."
- outfit = /datum/outfit/ambient_boat_fisher
+ outfit = null
+ npc_outfit_table = /datum/human_npc_outfit_table/ambient_boat_fisher
dialogue_section = "boat_fisher"
speech_pace = 1.2
watches = TRUE
@@ -461,17 +484,21 @@
/// world.time they next row somewhere else
var/next_row_at = 0
-/mob/living/basic/ambient_npc/planet/boat_fisher/Initialize(mapload)
+/mob/living/carbon/human/npc/ambient_npc/planet/boat_fisher/Initialize(mapload)
. = ..()
next_row_at = world.time + rand(AMBIENT_BOAT_ROW_LOW, AMBIENT_BOAT_ROW_HIGH)
+// Their boat is their own seat: they don't try to get out of it
+/mob/living/carbon/human/npc/ambient_npc/planet/boat_fisher/own_buckle(atom/thing)
+ return istype(thing, /obj/structure/ambient_boat) || ..()
+
/// The boat they sit in, if any
-/mob/living/basic/ambient_npc/planet/boat_fisher/proc/boat()
+/mob/living/carbon/human/npc/ambient_npc/planet/boat_fisher/proc/boat()
var/obj/structure/ambient_boat/boat = buckled
return istype(boat) ? boat : null
// Every few minutes, a new spot
-/mob/living/basic/ambient_npc/planet/boat_fisher/pick_activity()
+/mob/living/carbon/human/npc/ambient_npc/planet/boat_fisher/pick_activity()
if(world.time >= next_row_at && boat())
next_row_at = world.time + rand(AMBIENT_BOAT_ROW_LOW, AMBIENT_BOAT_ROW_HIGH)
if(start_activity(new /datum/ambient_activity/row(src)))
@@ -479,7 +506,7 @@
return ..()
// Stuck in a boat: a shout, and they row away
-/mob/living/basic/ambient_npc/planet/boat_fisher/react_attacked(atom/attacker)
+/mob/living/carbon/human/npc/ambient_npc/planet/boat_fisher/react_attacked(atom/attacker)
if(stat != CONSCIOUS || fading)
return
if(reaction_ready("attacked", 4 SECONDS))
@@ -488,7 +515,7 @@
start_activity(new /datum/ambient_activity/row(src, attacker))
// Sharks near the boat get shouted at
-/mob/living/basic/ambient_npc/planet/boat_fisher/watch(list/players)
+/mob/living/carbon/human/npc/ambient_npc/planet/boat_fisher/watch(list/players)
if(!reaction_ready("sharks", 90 SECONDS))
return
for(var/mob/living/basic/carp/shark in range(6, src))
@@ -502,7 +529,7 @@
LAZYSET(reaction_cooldowns, "sharks", world.time + 10 SECONDS)
// Once per crew: a fish thrown over to them
-/mob/living/basic/ambient_npc/planet/boat_fisher/talked_to(mob/living/user)
+/mob/living/carbon/human/npc/ambient_npc/planet/boat_fisher/talked_to(mob/living/user)
if(!talk_ready(user))
return
if(!first_for_crew(user, "fish_thrown"))
@@ -539,7 +566,7 @@
/// Where the boat is going
var/turf/destination
-/datum/ambient_activity/row/New(mob/living/basic/ambient_npc/new_doer, atom/threat)
+/datum/ambient_activity/row/New(mob/living/carbon/human/npc/ambient_npc/new_doer, atom/threat)
. = ..()
threat_ref = threat ? WEAKREF(threat) : null
@@ -578,11 +605,19 @@
continue
if(istype(site) && site.center && get_dist(target, site.center) > 12)
continue
- if(locate(/mob/living/basic/trooper/pirate) in range(5, target))
+ if(ambient_pirate_near(target, 5))
continue
return target
return null
+/// Whether a living pirate is within `distance` of `spot`: any human NPC on the pirate side (a ruin's
+/// pirates, a faction's crew or raiders).
+/proc/ambient_pirate_near(turf/spot, distance)
+ for(var/mob/living/carbon/human/npc/npc in range(distance, spot))
+ if(npc.stat != DEAD && (FACTION_PIRATE in npc.faction))
+ return TRUE
+ return FALSE
+
/datum/ambient_activity/row/act(seconds)
var/obj/structure/ambient_boat/boat = boat()
if(!boat || !destination || get_turf(boat) == destination)
@@ -629,7 +664,7 @@
boat = make_prop(site, /obj/structure/ambient_boat, site.center)
var/turf/where = get_turf(boat) || site.center
for(var/i in 1 to missing)
- var/mob/living/basic/ambient_npc/planet/boat_fisher/fisher = site.spawn_npc(npc_type, where)
+ var/mob/living/carbon/human/npc/ambient_npc/planet/boat_fisher/fisher = site.spawn_npc(npc_type, where)
if(fisher && boat && !boat.has_buckled_mobs())
boat.buckle_mob(fisher, force = TRUE)
return TRUE
diff --git a/voidcrew/modules/ambient_npcs/planet_jungle.dm b/voidcrew/modules/ambient_npcs/planet_jungle.dm
index 46ea36847a4..17656288cfd 100644
--- a/voidcrew/modules/ambient_npcs/planet_jungle.dm
+++ b/voidcrew/modules/ambient_npcs/planet_jungle.dm
@@ -90,6 +90,24 @@
uniform = /obj/item/clothing/under/color/grey/ancient
suit = /obj/item/clothing/suit/apron/chef
shoes = /obj/item/clothing/shoes/sandal
+ r_hand = /obj/item/knife/butcher
+
+/// Yellow: a skull for a helmet
+/datum/outfit/ambient_cannibal/skull
+ name = "Ambient NPC: cannibal in a skull"
+ head = /obj/item/clothing/head/helmet/skull
+
+/// Red: the skull, and bone armour for the apron
+/datum/outfit/ambient_cannibal/bone
+ name = "Ambient NPC: cannibal in bone"
+ head = /obj/item/clothing/head/helmet/skull
+ suit = /obj/item/clothing/suit/armor/bone
+
+/// The cannibal by band (AM-1)
+/datum/human_npc_outfit_table/ambient_cannibal
+ green = list(/datum/outfit/ambient_cannibal = 1)
+ yellow = list(/datum/outfit/ambient_cannibal/skull = 1)
+ red = list(/datum/outfit/ambient_cannibal/bone = 1)
/// Dinner: a dead stranger in rags, already carved
/datum/outfit/ambient_victim
@@ -101,16 +119,18 @@
outfit = /datum/outfit/ambient_victim
brute_damage = 60
-/mob/living/basic/ambient_npc/planet/cannibal
+/mob/living/carbon/human/npc/ambient_npc/planet/cannibal
name = "cannibal"
desc = "A gaunt man in a stained apron. He smells of smoke and cooked meat."
random_name = FALSE
random_gender = FALSE
gender = MALE
- outfit = /datum/outfit/ambient_cannibal
+ outfit = null
+ npc_outfit_table = /datum/human_npc_outfit_table/ambient_cannibal
dialogue_section = "cannibal"
fights_back = TRUE
weapon_type = /obj/item/knife/butcher
+ idle_held = /obj/item/knife/butcher
watches = TRUE
death_loot = list(/obj/item/knife/butcher, /obj/item/food/meat/steak/plain/human)
routine = list(
@@ -127,7 +147,7 @@
/// REF of a stranger -> TRUE once they were warned this time in sight
var/list/warned = list()
-/mob/living/basic/ambient_npc/planet/cannibal/Destroy()
+/mob/living/carbon/human/npc/ambient_npc/planet/cannibal/Destroy()
seen = null
invited = null
warned = null
@@ -137,7 +157,7 @@
* Strangers in sight: an invitation; a second, colder one and the cleaver after a while; then an
* attack on anyone within two tiles or in sight for half a minute. Out of sight resets the clock.
*/
-/mob/living/basic/ambient_npc/planet/cannibal/watch(list/players)
+/mob/living/carbon/human/npc/ambient_npc/planet/cannibal/watch(list/players)
if(istype(activity, /datum/ambient_activity/fight))
return
players = players || ambient_players_near(src, AMBIENT_CANNIBAL_SIGHT)
@@ -223,7 +243,7 @@
site.data["camp_built"] = TRUE
build_camp(site)
for(var/i in 1 to missing)
- var/mob/living/basic/ambient_npc/planet/cannibal/cannibal = site.spawn_npc(npc_type, ambient_free_turf_near(site.center, 2) || site.center)
+ var/mob/living/carbon/human/npc/ambient_npc/planet/cannibal/cannibal = site.spawn_npc(npc_type, ambient_free_turf_near(site.center, 2) || site.center)
if(cannibal)
cannibal.leash_bounds = ambient_square_bounds(site.center, 10)
// Dressing a body can sleep
@@ -272,6 +292,7 @@
name = "Ambient NPC: hunter"
uniform = /obj/item/clothing/under/costume/loincloth
shoes = /obj/item/clothing/shoes/sandal
+ r_hand = /obj/item/spear/bamboospear
/datum/outfit/ambient_tribal/bone
name = "Ambient NPC: hunter in bone"
@@ -282,11 +303,27 @@
name = "Ambient NPC: hunter in a hide cloak"
suit = /obj/item/clothing/suit/hooded/cloak/goliath
-/mob/living/basic/ambient_npc/planet/tribal
+/// Red: bone bracers too
+/datum/outfit/ambient_tribal/bone/bracers
+ name = "Ambient NPC: hunter in bone and bracers"
+ gloves = /obj/item/clothing/gloves/bracer
+
+/datum/outfit/ambient_tribal/cloak/bracers
+ name = "Ambient NPC: hunter in a hide cloak and bracers"
+ gloves = /obj/item/clothing/gloves/bracer
+
+/// Hunters by band (AM-1): bone and hide further out, never more health
+/datum/human_npc_outfit_table/ambient_tribal
+ green = list(/datum/outfit/ambient_tribal = 2, /datum/outfit/ambient_tribal/bone = 1, /datum/outfit/ambient_tribal/cloak = 1)
+ yellow = list(/datum/outfit/ambient_tribal/bone = 1, /datum/outfit/ambient_tribal/cloak = 1)
+ red = list(/datum/outfit/ambient_tribal/bone/bracers = 1, /datum/outfit/ambient_tribal/cloak/bracers = 1)
+
+/mob/living/carbon/human/npc/ambient_npc/planet/tribal
name = "hunter"
desc = "A lean hunter in hide and bone, a bamboo spear in hand."
random_name = FALSE
- outfit_choices = list(/datum/outfit/ambient_tribal, /datum/outfit/ambient_tribal/bone, /datum/outfit/ambient_tribal/cloak)
+ outfit = null
+ npc_outfit_table = /datum/human_npc_outfit_table/ambient_tribal
dialogue_section = "tribal"
speech_pace = 1.5
fights_back = TRUE
@@ -305,66 +342,82 @@
/datum/ambient_activity/chat = 2,
/datum/ambient_activity/wander = 1,
)
- /// Their spear is in their hand (not stuck in the ground somewhere)
- var/has_spear = TRUE
- /// Where their thrown spear stuck, if it did
+ /// The spear they threw, while it lies where it came down
var/datum/weakref/thrown_spear_ref
/// world.time their drawn-back spear flies, while winding up a throw
var/throw_windup_until = 0
-/mob/living/basic/ambient_npc/planet/tribal/Initialize(mapload)
+/mob/living/carbon/human/npc/ambient_npc/planet/tribal/Initialize(mapload, datum/human_npc_order/order)
. = ..()
if(prob(25))
death_loot = death_loot + /obj/item/clothing/suit/armor/bone
-/mob/living/basic/ambient_npc/planet/tribal/Destroy()
+/mob/living/carbon/human/npc/ambient_npc/planet/tribal/Destroy()
drop_thrown_spear()
return ..()
-// The spear left in the ground goes too: the one they carried drops with them
-/mob/living/basic/ambient_npc/planet/tribal/death(gibbed)
+// The spear they threw goes too: nobody fetches it now
+/mob/living/carbon/human/npc/ambient_npc/planet/tribal/death(gibbed)
drop_thrown_spear()
return ..()
-/// Their thrown spear, if it is still stuck somewhere
-/mob/living/basic/ambient_npc/planet/tribal/proc/thrown_spear()
- var/obj/effect/ambient_thrown_spear/stuck = thrown_spear_ref?.resolve()
- return QDELETED(stuck) ? null : stuck
+/// Whether they have a spear on them (in hand, or slung)
+/mob/living/carbon/human/npc/ambient_npc/planet/tribal/proc/has_spear()
+ return length(get_all_contents_type(/obj/item/spear)) > 0
-/// Forgets and removes the spear they threw
-/mob/living/basic/ambient_npc/planet/tribal/proc/drop_thrown_spear()
- var/obj/effect/ambient_thrown_spear/stuck = thrown_spear()
+/// The spear they threw, while it still lies loose where it came down
+/mob/living/carbon/human/npc/ambient_npc/planet/tribal/proc/thrown_spear()
+ var/obj/item/spear/thrown = thrown_spear_ref?.resolve()
+ if(QDELETED(thrown) || !isturf(thrown.loc))
+ return null
+ return thrown
+
+/// Forgets the spear they threw, and takes it away if it still lies loose (a camp's spears are its own)
+/mob/living/carbon/human/npc/ambient_npc/planet/tribal/proc/drop_thrown_spear()
+ var/obj/item/spear/thrown = thrown_spear()
thrown_spear_ref = null
- if(stuck)
- qdel(stuck)
+ if(thrown)
+ qdel(thrown)
-/// A spear back in hand
-/mob/living/basic/ambient_npc/planet/tribal/proc/rearm()
- drop_thrown_spear()
- has_spear = TRUE
+/**
+ * A spear back in hand: the one they threw, picked up off the ground beside them, or, when it is
+ * gone, a spare off the camp's rack (`from_rack`). The camp's spears stay theirs (locked to them, the
+ * base's consumables rule: it never becomes anyone else's).
+ */
+/mob/living/carbon/human/npc/ambient_npc/planet/tribal/proc/rearm(from_rack = FALSE)
+ var/obj/item/spear/thrown = thrown_spear()
+ thrown_spear_ref = null
+ if(thrown && get_dist(src, thrown) <= 1)
+ put_in_hands(thrown)
+ else if(from_rack && !has_spear())
+ var/obj/item/spear/bamboospear/spare = new(src)
+ if(!put_in_hands(spare))
+ qdel(spare)
+ else
+ npc_lock_item(spare)
idle_held = /obj/item/spear/bamboospear
- arm(/obj/item/spear/bamboospear)
set_held(/obj/item/spear/bamboospear)
// Without a spear the first thing they do is get it back
-/mob/living/basic/ambient_npc/planet/tribal/pick_activity()
- if(!has_spear && start_activity(new /datum/ambient_activity/fetch_spear(src)))
+/mob/living/carbon/human/npc/ambient_npc/planet/tribal/pick_activity()
+ if(!has_spear() && start_activity(new /datum/ambient_activity/fetch_spear(src)))
return activity
return ..()
-/mob/living/basic/ambient_npc/planet/tribal/throw_reach()
- return has_spear ? 6 : 0
+/mob/living/carbon/human/npc/ambient_npc/planet/tribal/throw_reach()
+ return has_spear() ? 6 : 0
/**
- * A thrown spear: from three to six tiles, in plain sight, one throw at a time for the whole camp.
- * The spear is drawn back first (a wind-up anyone can see) and flies on their next beat.
+ * A thrown spear: from three to six tiles, in plain sight, one throw at a time for the whole camp,
+ * and never with one of their own camp in the way. The spear is drawn back first (a wind-up anyone
+ * can see) and flies on their next beat.
*/
-/mob/living/basic/ambient_npc/planet/tribal/try_ranged(mob/living/target)
- if(!has_spear)
+/mob/living/carbon/human/npc/ambient_npc/planet/tribal/try_ranged(mob/living/target)
+ if(!has_spear())
return FALSE
var/distance = get_dist(src, target)
if(throw_windup_until)
- if(distance > 6 || !bounty_ai_can_see(src, target, 6))
+ if(distance > 6 || !bounty_ai_can_see(src, target, 6) || ambient_camp_mate_in_line(src, target))
throw_windup_until = 0
return FALSE
face_atom(target)
@@ -372,7 +425,7 @@
throw_windup_until = 0
throw_spear(target)
return TRUE
- if(distance < 3 || distance > 6 || !bounty_ai_can_see(src, target, 6))
+ if(distance < 3 || distance > 6 || !bounty_ai_can_see(src, target, 6) || ambient_camp_mate_in_line(src, target))
return FALSE
var/list/visit = ambient_site_visit(place)
if(visit["next_throw"] > world.time)
@@ -383,36 +436,35 @@
visible_message(span_danger("[src] draws back a spear!"))
return TRUE
-/// Throws their spear at `target`: the spear's own throw, and it sticks where it lands
-/mob/living/basic/ambient_npc/planet/tribal/proc/throw_spear(mob/living/target)
- var/turf/start = get_turf(src)
- if(!start)
+/// Throws the spear in their hand at `target`, as anyone throws a held item (tg's throw)
+/mob/living/carbon/human/npc/ambient_npc/planet/tribal/proc/throw_spear(mob/living/target)
+ var/obj/item/spear/spear = held_weapon()
+ if(!istype(spear))
+ set_held(/obj/item/spear/bamboospear)
+ spear = held_weapon()
+ if(!istype(spear) || !isturf(loc))
+ return
+ if(HAS_TRAIT(spear, TRAIT_WIELDED))
+ spear.attack_self(src) // let go with one hand to throw
+ human_npc_ready_item(src, spear)
+ if(!throw_item(target))
return
- var/obj/projectile/ambient_spear/spear = new(start)
- var/datum/bounty_real_weapon/weapon = bounty_real_weapon(/obj/item/spear/bamboospear)
- weapon.load_thrown(spear)
- spear.firer = src
- spear.fired_from = src
- spear.aim_projectile(target, src)
- if(QDELETED(spear))
+ if(spear.loc == src || is_holding(spear))
return
- has_spear = FALSE
+ thrown_spear_ref = WEAKREF(spear)
+ held_prop = null
idle_held = null
- arm(null)
- set_held(null)
- do_attack_animation(target)
playsound(src, 'sound/items/weapons/thudswoosh.ogg', 40, TRUE)
- spear.fire()
/**
* The camp's lookout (the first of them awake) watches the ring: a warning for anyone who
* crosses it, the whole camp on anyone who stays armed, and someone to walk up to anyone who
* comes empty-handed.
*/
-/mob/living/basic/ambient_npc/planet/tribal/watch(list/players)
+/mob/living/carbon/human/npc/ambient_npc/planet/tribal/watch(list/players)
// Their own spear, if they are standing by it
- var/obj/effect/ambient_thrown_spear/stuck = thrown_spear()
- if(!has_spear && stuck && get_dist(src, stuck) <= 1 && !istype(activity, /datum/ambient_activity/fight))
+ var/obj/item/spear/thrown = thrown_spear()
+ if(thrown && !has_spear() && get_dist(src, thrown) <= 1 && !istype(activity, /datum/ambient_activity/fight))
manual_emote("pulls a spear out of the ground.")
rearm()
var/datum/ambient_place/site/site = place
@@ -442,7 +494,7 @@
// A warning first, once a minute each
if(warned[key] < world.time)
warned[key] = world.time + 1 MINUTES
- var/mob/living/basic/ambient_npc/planet/tribal/shouter = nearest_awake(player)
+ var/mob/living/carbon/human/npc/ambient_npc/planet/tribal/shouter = nearest_awake(player)
if(shouter)
shouter.face_atom(player)
shouter.speak_context("warn", player, force = TRUE)
@@ -457,18 +509,18 @@
entered -= key
/// The first of the camp who is awake and not already off somewhere: the one who keeps watch
-/mob/living/basic/ambient_npc/planet/tribal/proc/camp_lookout()
- for(var/mob/living/basic/ambient_npc/planet/tribal/hunter in place?.npcs)
- if(hunter.stat == CONSCIOUS && !hunter.fading && !hunter.sleeping)
+/mob/living/carbon/human/npc/ambient_npc/planet/tribal/proc/camp_lookout()
+ for(var/mob/living/carbon/human/npc/ambient_npc/planet/tribal/hunter in place?.npcs)
+ if(hunter.stat == CONSCIOUS && !hunter.fading && !hunter.IsSleeping())
return hunter
return null
/// The hunter awake and nearest to `who`, or null
-/mob/living/basic/ambient_npc/planet/tribal/proc/nearest_awake(atom/who)
- var/mob/living/basic/ambient_npc/planet/tribal/best
+/mob/living/carbon/human/npc/ambient_npc/planet/tribal/proc/nearest_awake(atom/who)
+ var/mob/living/carbon/human/npc/ambient_npc/planet/tribal/best
var/best_distance = INFINITY
- for(var/mob/living/basic/ambient_npc/planet/tribal/hunter in place?.living_npcs())
- if(hunter.sleeping)
+ for(var/mob/living/carbon/human/npc/ambient_npc/planet/tribal/hunter in place?.living_npcs())
+ if(hunter.IsSleeping())
continue
var/distance = get_dist(hunter, who)
if(distance < best_distance)
@@ -477,29 +529,29 @@
return best
/// The whole camp goes for `target`, sleepers included
-/mob/living/basic/ambient_npc/planet/tribal/proc/camp_attack(mob/living/target)
+/mob/living/carbon/human/npc/ambient_npc/planet/tribal/proc/camp_attack(mob/living/target)
var/shouted = FALSE
- for(var/mob/living/basic/ambient_npc/planet/tribal/hunter in place?.living_npcs())
+ for(var/mob/living/carbon/human/npc/ambient_npc/planet/tribal/hunter in place?.living_npcs())
if(istype(hunter.activity, /datum/ambient_activity/fight))
continue
- if(!shouted && !hunter.sleeping)
+ if(!shouted && !hunter.IsSleeping())
shouted = TRUE
hunter.speak_context("attack", target, force = TRUE)
hunter.engage(target)
/// Someone walks up to an empty-handed visitor to trade, unless someone already is
-/mob/living/basic/ambient_npc/planet/tribal/proc/offer_trade(mob/living/visitor)
+/mob/living/carbon/human/npc/ambient_npc/planet/tribal/proc/offer_trade(mob/living/visitor)
var/list/visit = ambient_site_visit(place)
if(visit["offer_until"] > world.time)
return
- var/mob/living/basic/ambient_npc/planet/tribal/trader = nearest_awake(visitor)
+ var/mob/living/carbon/human/npc/ambient_npc/planet/tribal/trader = nearest_awake(visitor)
if(!trader || istype(trader.activity, /datum/ambient_activity/fight) || trader.activity?.priority > AMBIENT_PRIORITY_ROUTINE)
return
if(trader.start_activity(new /datum/ambient_activity/tribal_offer(trader, visitor)))
visit["offer_until"] = world.time + 90 SECONDS
/// A hide or meat for a bone spear, once per crew
-/mob/living/basic/ambient_npc/planet/tribal/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
+/mob/living/carbon/human/npc/ambient_npc/planet/tribal/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(user.combat_mode || !can_act() || !(istype(tool, /obj/item/stack/sheet/animalhide) || istype(tool, /obj/item/food/meat/slab)))
return ..()
face_atom(user)
@@ -523,105 +575,49 @@
end_activity()
return ITEM_INTERACT_SUCCESS
-// ----- the thrown spear -----
-
-/// A bamboo spear in flight: the spear's own throw, never at the thrower's own camp; it sticks where it lands
-/obj/projectile/ambient_spear
- name = "bamboo spear"
- icon = 'icons/obj/weapons/spear.dmi'
- icon_state = "bamboo_spear0"
- damage_type = BRUTE
- armor_flag = MELEE
- speed = 0.6
- range = 7
- hitsound = 'sound/items/weapons/pierce.ogg'
- /// It has stuck somewhere already
- var/landed = FALSE
-
-/obj/projectile/ambient_spear/can_hit_target(atom/target, direct_target = FALSE, ignore_loc = FALSE, cross_failed = FALSE)
- . = ..()
- if(!. || !istype(target, /mob/living/basic/ambient_npc))
- return
- var/mob/living/basic/ambient_npc/thrower = firer
- var/mob/living/basic/ambient_npc/other = target
- if(istype(thrower) && other.place == thrower.place)
- return FALSE
-
-/obj/projectile/ambient_spear/on_hit(atom/target, blocked = 0, pierce_hit)
- . = ..()
- land()
-
-/obj/projectile/ambient_spear/on_range()
- land()
- return ..()
-
-/// Sticks in the ground where it came down, for its thrower to fetch
-/obj/projectile/ambient_spear/proc/land()
- if(landed)
- return
- landed = TRUE
- var/turf/where = get_turf(src)
- var/mob/living/basic/ambient_npc/planet/tribal/thrower = firer
- if(!istype(thrower) || QDELETED(thrower) || thrower.stat == DEAD || !where || !ambient_ground_ok(where))
- return
- thrower.drop_thrown_spear()
- var/obj/effect/ambient_thrown_spear/stuck = new(where)
- thrower.thrown_spear_ref = WEAKREF(stuck)
-
-/// A thrown spear stuck in the ground. Its thrower pulls it out again; nobody else can take it.
-/obj/effect/ambient_thrown_spear
- name = "bamboo spear"
- desc = "A bamboo spear, stuck point-first in the ground."
- icon = 'icons/obj/weapons/spear.dmi'
- icon_state = "bamboo_spear0"
- anchored = TRUE
- density = FALSE
- layer = OBJ_LAYER
-
-/obj/effect/ambient_thrown_spear/Initialize(mapload)
- . = ..()
- transform = matrix().Turn(45)
- // Nobody came back for it. Our own callback, so deleting it early takes the timer with it.
- addtimer(CALLBACK(src, PROC_REF(rot)), 5 MINUTES, TIMER_DELETE_ME)
-
-/obj/effect/ambient_thrown_spear/proc/rot()
- qdel(src)
-
// ----- activities -----
-/// Getting their spear back: pulled out of the ground where it stuck, or a spare off the rack
+/// Getting their spear back: picked up where it came down, or a spare off the camp's rack
/datum/ambient_activity/fetch_spear
name = "fetching a spear"
/datum/ambient_activity/fetch_spear/setup()
- var/mob/living/basic/ambient_npc/planet/tribal/hunter = doer
- if(!istype(hunter) || hunter.has_spear)
+ var/mob/living/carbon/human/npc/ambient_npc/planet/tribal/hunter = doer
+ if(!istype(hunter) || hunter.has_spear())
return FALSE
- var/atom/target = hunter.thrown_spear()
- if(!target)
- var/datum/ambient_place/site/site = hunter.place
- target = istype(site) ? site.get_prop(/obj/effect/ambient_camp_prop/spear_rack) : null
+ var/atom/target = hunter.thrown_spear() || camp_rack()
if(!target)
- hunter.rearm()
return FALSE
go_to(get_turf(target), 1)
return TRUE
+/// Their camp's spear rack, if it has one
+/datum/ambient_activity/fetch_spear/proc/camp_rack()
+ var/datum/ambient_place/site/site = doer.place
+ return istype(site) ? site.get_prop(/obj/effect/ambient_camp_prop/spear_rack) : null
+
/datum/ambient_activity/fetch_spear/arrive()
- var/mob/living/basic/ambient_npc/planet/tribal/hunter = doer
- if(!istype(hunter) || hunter.has_spear)
+ var/mob/living/carbon/human/npc/ambient_npc/planet/tribal/hunter = doer
+ if(!istype(hunter) || hunter.has_spear())
+ return
+ var/obj/item/spear/thrown = hunter.thrown_spear()
+ if(thrown && get_dist(hunter, thrown) <= 1)
+ hunter.manual_emote("pulls a spear out of the ground.")
+ hunter.rearm()
return
- hunter.manual_emote(hunter.thrown_spear() ? "pulls a spear out of the ground." : "takes a spear from the rack.")
- hunter.rearm()
+ var/atom/rack = camp_rack()
+ if(rack && get_dist(hunter, rack) <= 1)
+ hunter.manual_emote("takes a spear from the rack.")
+ hunter.rearm(from_rack = TRUE)
/datum/ambient_activity/fetch_spear/act(seconds)
return AMBIENT_STEP_DONE
/datum/ambient_activity/fetch_spear/spot_unreachable()
- var/mob/living/basic/ambient_npc/planet/tribal/hunter = doer
- // It fell somewhere they cannot get to: a spare from the rack
+ var/mob/living/carbon/human/npc/ambient_npc/planet/tribal/hunter = doer
+ // It came down somewhere they can't get to: the rack, next time round
if(istype(hunter))
- hunter.rearm()
+ hunter.thrown_spear_ref = null
spot = null
arrived = TRUE
@@ -632,7 +628,7 @@
duration_high = 60 SECONDS
var/datum/weakref/visitor_ref
-/datum/ambient_activity/tribal_offer/New(mob/living/basic/ambient_npc/new_doer, atom/visitor)
+/datum/ambient_activity/tribal_offer/New(mob/living/carbon/human/npc/ambient_npc/new_doer, atom/visitor)
. = ..()
visitor_ref = WEAKREF(visitor)
@@ -672,7 +668,7 @@
/datum/ambient_activity/tribal_offer/finish()
. = ..()
- var/mob/living/basic/ambient_npc/planet/tribal/hunter = doer
+ var/mob/living/carbon/human/npc/ambient_npc/planet/tribal/hunter = doer
if(istype(hunter) && !QDELETED(hunter))
hunter.show_idle_held()
@@ -702,8 +698,8 @@
return FALSE
go_to(hide)
// A partner, if one is free
- for(var/mob/living/basic/ambient_npc/planet/tribal/mate in site.living_npcs())
- if(mate == doer || mate.sleeping || (mate.activity && !mate.activity.accepts_company))
+ for(var/mob/living/carbon/human/npc/ambient_npc/planet/tribal/mate in site.living_npcs())
+ if(mate == doer || mate.IsSleeping() || (mate.activity && !mate.activity.accepts_company))
continue
if(mate.start_activity(new /datum/ambient_activity/follow(mate, doer, 2, 3 MINUTES)))
break
@@ -742,7 +738,7 @@
/datum/ambient_activity/tribal_hunt/finish()
. = ..()
- var/mob/living/basic/ambient_npc/planet/tribal/hunter = doer
+ var/mob/living/carbon/human/npc/ambient_npc/planet/tribal/hunter = doer
if(istype(hunter) && !QDELETED(hunter))
hunter.show_idle_held()
@@ -778,8 +774,8 @@
var/atom/fire = prop()
if(!fire)
return
- for(var/mob/living/basic/ambient_npc/planet/tribal/mate in doer.place?.living_npcs())
- if(mate != doer && !mate.sleeping && get_dist(mate, fire) <= 3 && prob(50))
+ for(var/mob/living/carbon/human/npc/ambient_npc/planet/tribal/mate in doer.place?.living_npcs())
+ if(mate != doer && !mate.IsSleeping() && get_dist(mate, fire) <= 3 && prob(50))
mate.manual_emote("joins the chant.")
// ----- the camp -----
@@ -791,7 +787,7 @@
new_visit(site)
build_camp(site)
for(var/i in 1 to missing)
- var/mob/living/basic/ambient_npc/planet/tribal/hunter = site.spawn_npc(npc_type, ambient_free_turf_near(site.center, 2) || site.center)
+ var/mob/living/carbon/human/npc/ambient_npc/planet/tribal/hunter = site.spawn_npc(npc_type, ambient_free_turf_near(site.center, 2) || site.center)
if(hunter)
hunter.leash_bounds = ambient_square_bounds(site.center, AMBIENT_TRIBAL_RING_RADIUS + AMBIENT_TRIBAL_CHASE_PAST_RING)
return TRUE
diff --git a/voidcrew/modules/ambient_npcs/planet_miner.dm b/voidcrew/modules/ambient_npcs/planet_miner.dm
index 6ac8e021e11..524dedf4266 100644
--- a/voidcrew/modules/ambient_npcs/planet_miner.dm
+++ b/voidcrew/modules/ambient_npcs/planet_miner.dm
@@ -8,7 +8,7 @@
*
* - /datum/ambient_activity/mine: dig one ore wall for real. Shared: the lava fisher
* (planet_fishers.dm) digs with it too. See its doc comment for the API.
- * - /mob/living/basic/ambient_npc/planet/miner: a prospector with a small camp (a folding chair, a
+ * - /mob/living/carbon/human/npc/ambient_npc/planet/miner: a prospector with a small camp (a folding chair, a
* lantern, a crate) who swings at a rock face for half a minute or more, digs it out, scoops the
* ore into a satchel, and every few walls sits down at camp with a flask. Hand them food or a
* drink and they trade a little ore from the satchel. Attacked, they fight with the pickaxe and run
@@ -162,7 +162,7 @@
. = ..()
if(QDELETED(doer))
return
- var/mob/living/basic/ambient_npc/planet/planet_npc = doer
+ var/mob/living/carbon/human/npc/ambient_npc/planet/planet_npc = doer
if(istype(planet_npc))
planet_npc.show_idle_held()
else
@@ -201,20 +201,39 @@
shoes = /obj/item/clothing/shoes/workboots/mining
gloves = /obj/item/clothing/gloves/color/black
head = /obj/item/clothing/head/utility/hardhat/orange
+ belt = /obj/item/pickaxe
/datum/outfit/ambient_miner/winter
name = "Ambient NPC: prospector in a coat"
suit = /obj/item/clothing/suit/hooded/wintercoat/miner
+/// Yellow: rougher ground, an explorer suit
+/datum/outfit/ambient_miner/explorer
+ name = "Ambient NPC: prospector in an explorer suit"
+ suit = /obj/item/clothing/suit/hooded/explorer
+
+/// Red: the explorer suit and its mask, and a drill
+/datum/outfit/ambient_miner/explorer/red
+ name = "Ambient NPC: prospector with a drill"
+ mask = /obj/item/clothing/mask/gas/explorer
+ belt = /obj/item/pickaxe/drill
+
/datum/outfit/ambient_miner/void
name = "Ambient NPC: asteroid miner"
suit = /obj/item/clothing/suit/space/eva
head = /obj/item/clothing/head/helmet/space/eva
-/mob/living/basic/ambient_npc/planet/miner
+/// Miners by band (AM-1): kit, not health, makes the red zone's harder to put down
+/datum/human_npc_outfit_table/ambient_miner
+ green = list(/datum/outfit/ambient_miner = 1, /datum/outfit/ambient_miner/winter = 1)
+ yellow = list(/datum/outfit/ambient_miner/explorer = 1)
+ red = list(/datum/outfit/ambient_miner/explorer/red = 1)
+
+/mob/living/carbon/human/npc/ambient_npc/planet/miner
name = "miner"
desc = "A prospector in dusty overalls, working the rock by hand."
- outfit_choices = list(/datum/outfit/ambient_miner, /datum/outfit/ambient_miner/winter)
+ outfit = null
+ npc_outfit_table = /datum/human_npc_outfit_table/ambient_miner
dialogue_section = "miner"
speech_pace = 1.2
fights_back = TRUE
@@ -231,18 +250,18 @@
/// The satchel the ore goes into; dropped with them
var/obj/item/storage/bag/ore/ore_bag
-/mob/living/basic/ambient_npc/planet/miner/Initialize(mapload)
+/mob/living/carbon/human/npc/ambient_npc/planet/miner/Initialize(mapload)
. = ..()
ore_bag = new(src)
if(prob(50))
death_loot = death_loot + /obj/item/mining_scanner
-/mob/living/basic/ambient_npc/planet/miner/Destroy()
+/mob/living/carbon/human/npc/ambient_npc/planet/miner/Destroy()
QDEL_NULL(ore_bag)
return ..()
// The satchel with what they dug goes down with them, once
-/mob/living/basic/ambient_npc/planet/miner/drop_loot()
+/mob/living/carbon/human/npc/ambient_npc/planet/miner/drop_loot()
var/first_time = !loot_dropped
. = ..()
if(!first_time || QDELETED(ore_bag))
@@ -253,7 +272,7 @@
ore_bag = null
/// Units of ore in their satchel
-/mob/living/basic/ambient_npc/planet/miner/proc/ore_carried()
+/mob/living/carbon/human/npc/ambient_npc/planet/miner/proc/ore_carried()
. = 0
for(var/obj/item/stack/ore/ore in ore_bag)
. += ore.amount
@@ -262,14 +281,14 @@
* The barter: a bite to eat or something to drink for a little ore from the satchel. Only what they
* dug on this rock, and only a few trades a visit for the whole camp.
*/
-/mob/living/basic/ambient_npc/planet/miner/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
+/mob/living/carbon/human/npc/ambient_npc/planet/miner/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(user.combat_mode || !can_act() || !ambient_is_refreshment(tool))
return ..()
barter(user, tool)
return ITEM_INTERACT_SUCCESS
/// Trades `refreshment` from `user` for one to three ore. TRUE if the trade was made.
-/mob/living/basic/ambient_npc/planet/miner/proc/barter(mob/living/user, obj/item/refreshment)
+/mob/living/carbon/human/npc/ambient_npc/planet/miner/proc/barter(mob/living/user, obj/item/refreshment)
if(!buckled)
face_atom(user)
var/datum/ambient_place/site/site = place
@@ -306,7 +325,7 @@
return FALSE
/// Out on an asteroid, in a suit
-/mob/living/basic/ambient_npc/planet/miner/void
+/mob/living/carbon/human/npc/ambient_npc/planet/miner/void
desc = "A prospector in a patched suit, chipping at the asteroid."
outfit_choices = null
outfit = /datum/outfit/ambient_miner/void
@@ -346,10 +365,10 @@
return FALSE
new_visit(site)
build_camp(site)
- var/miner_type = site.field_ref ? /mob/living/basic/ambient_npc/planet/miner/void : npc_type
+ var/miner_type = site.field_ref ? /mob/living/carbon/human/npc/ambient_npc/planet/miner/void : npc_type
for(var/i in 1 to missing)
var/turf/where = ambient_free_turf_near(site.center, 2) || site.center
- var/mob/living/basic/ambient_npc/planet/miner/miner = site.spawn_npc(miner_type, where)
+ var/mob/living/carbon/human/npc/ambient_npc/planet/miner/miner = site.spawn_npc(miner_type, where)
if(miner)
miner.leash_bounds = ambient_square_bounds(site.center, 12)
return TRUE
diff --git a/voidcrew/modules/ambient_npcs/planet_peddler.dm b/voidcrew/modules/ambient_npcs/planet_peddler.dm
index 11b76dfed0e..9166309eb5d 100644
--- a/voidcrew/modules/ambient_npcs/planet_peddler.dm
+++ b/voidcrew/modules/ambient_npcs/planet_peddler.dm
@@ -68,11 +68,21 @@
shoes = /obj/item/clothing/shoes/laceup
back = /obj/item/storage/backpack/satchel/leather
+/// Yellow and red: a flak vest under the poncho's place
+/datum/outfit/ambient_peddler/vest
+ name = "Ambient NPC: peddler in a flak vest"
+ suit = /obj/item/clothing/suit/armor/vest
+
+/// The peddler by band (AM-1)
+/datum/human_npc_outfit_table/ambient_peddler
+ green = list(/datum/outfit/ambient_peddler = 1)
+ yellow = list(/datum/outfit/ambient_peddler/vest = 1)
+
/**
* What a walking trader carries: survival basics a crew forgot, one odd thing, one weapon, credits
* only, and about a quarter cheaper than a counter, because crews rarely meet one. The ledger buys a few planetary goods at AMBIENT_PEDDLER_BUYBACK_RATE of an outpost's price,
* never for vouchers. One shop per peddler, fresh each visit, but for the weapon, which stays with
- * the site (/mob/living/basic/ambient_npc/planet/peddler/proc/load_weapon()).
+ * the site (/mob/living/carbon/human/npc/ambient_npc/planet/peddler/proc/load_weapon()).
*/
/datum/outpost_shop/vendor/peddler
outpost_name = "Peddler's pack"
@@ -422,12 +432,13 @@
* waypoints; "camps", the waypoints it camps at; "leg", the last one reached). Killable like
* anyone; a trader carries more cash than most, and the shop dies with them.
*/
-/mob/living/basic/ambient_npc/planet/peddler
+/mob/living/carbon/human/npc/ambient_npc/planet/peddler
name = "peddler"
desc = "A walking trader under a wide hat, bags hanging off every strap."
death_cash_low = 30
death_cash_high = 80
- outfit = /datum/outfit/ambient_peddler
+ outfit = null
+ npc_outfit_table = /datum/human_npc_outfit_table/ambient_peddler
dialogue_section = "peddler"
speech_pace = 0.8
ai_controller = /datum/ai_controller/basic_controller/ambient_npc/roaming
@@ -444,13 +455,13 @@
var/hold_until = 0
COOLDOWN_DECLARE(trade_line_cooldown)
-/mob/living/basic/ambient_npc/planet/peddler/Initialize(mapload)
+/mob/living/carbon/human/npc/ambient_npc/planet/peddler/Initialize(mapload)
. = ..()
shop = new(null)
shop.trader_name = real_name
shop_ui = new(src)
-/mob/living/basic/ambient_npc/planet/peddler/Destroy()
+/mob/living/carbon/human/npc/ambient_npc/planet/peddler/Destroy()
save_ledger()
QDEL_NULL(shop_ui)
QDEL_NULL(shop)
@@ -461,7 +472,7 @@
* away and brought back next visit is not a fresh market for the same goods or a fresh pack (load_ledger()
* puts them back).
*/
-/mob/living/basic/ambient_npc/planet/peddler/proc/save_ledger()
+/mob/living/carbon/human/npc/ambient_npc/planet/peddler/proc/save_ledger()
var/datum/ambient_place/site/site = place
if(!istype(site) || !shop)
return
@@ -473,7 +484,7 @@
site.data["weapon_left"] = shop.weapon.stock
/// Takes up the ledger and the pack where the last visit's peddler left them
-/mob/living/basic/ambient_npc/planet/peddler/proc/load_ledger()
+/mob/living/carbon/human/npc/ambient_npc/planet/peddler/proc/load_ledger()
var/datum/ambient_place/site/site = place
if(!istype(site) || !shop)
return
@@ -486,7 +497,7 @@
buyback.demand = demand[buyback.type]
/// The site's one weapon: picked the first time from what its zone carries, then only ever the same one, while it has not sold
-/mob/living/basic/ambient_npc/planet/peddler/proc/load_weapon(datum/ambient_place/site/site)
+/mob/living/carbon/human/npc/ambient_npc/planet/peddler/proc/load_weapon(datum/ambient_place/site/site)
if(!site.data["weapon"])
site.data["weapon"] = pick(ambient_peddler_weapons(site.band))
site.data["weapon_left"] = 1
@@ -494,7 +505,7 @@
shop.stock_weapon(site.data["weapon"])
/// A line from the shop's own lines (the shop window calls this, as it does on a trader)
-/mob/living/basic/ambient_npc/planet/peddler/proc/speak_line(category)
+/mob/living/carbon/human/npc/ambient_npc/planet/peddler/proc/speak_line(category)
var/line = shop?.get_line(category)
if(!line || !COOLDOWN_FINISHED(src, trade_line_cooldown))
return
@@ -502,17 +513,17 @@
say_line(line)
/// The "no" noise (the shop window calls this, as it does on a trader)
-/mob/living/basic/ambient_npc/planet/peddler/proc/play_denial()
+/mob/living/carbon/human/npc/ambient_npc/planet/peddler/proc/play_denial()
playsound(src, 'sound/machines/buzz/buzz-sigh.ogg', 30, TRUE)
// A customer: the Trade and Talk radial, and the caravan waits for them
-/mob/living/basic/ambient_npc/planet/peddler/talked_to(mob/living/user)
+/mob/living/carbon/human/npc/ambient_npc/planet/peddler/talked_to(mob/living/user)
if(!talk_ready(user))
return
hold_until = world.time + AMBIENT_PEDDLER_HOLD
INVOKE_ASYNC(src, PROC_REF(open_menu), user)
-/mob/living/basic/ambient_npc/planet/peddler/proc/open_menu(mob/living/user)
+/mob/living/carbon/human/npc/ambient_npc/planet/peddler/proc/open_menu(mob/living/user)
face_atom(user)
var/list/options = list(
"Trade" = image(icon = 'icons/hud/radial.dmi', icon_state = "radial_buy"),
@@ -529,15 +540,15 @@
chat_with(user)
/// Whether `user` can still do business: near, awake, in sight
-/mob/living/basic/ambient_npc/planet/peddler/proc/menu_ok(mob/living/user)
+/mob/living/carbon/human/npc/ambient_npc/planet/peddler/proc/menu_ok(mob/living/user)
return istype(user) && !IS_DEAD_OR_INCAP(user) && can_act() && get_dist(src, user) <= 2 && (src in view(2, user))
/// The shop window and every sale ask this of their host, as of a trader: a customer still here, and a pack to sell from
-/mob/living/basic/ambient_npc/planet/peddler/proc/check_menu(mob/living/user)
+/mob/living/carbon/human/npc/ambient_npc/planet/peddler/proc/check_menu(mob/living/user)
return !shop_closed && menu_ok(user)
/// Opens the shop window for `user`, unless the stock went down with the pony
-/mob/living/basic/ambient_npc/planet/peddler/proc/open_shop(mob/living/user)
+/mob/living/carbon/human/npc/ambient_npc/planet/peddler/proc/open_shop(mob/living/user)
if(shop_closed || !shop)
speak_context("pack_lost", user, force = TRUE)
return
@@ -545,7 +556,7 @@
speak_line(TRADER_LINE_GREETING)
/// A word; the first time for a crew, where the nearest ruin on this planet lies
-/mob/living/basic/ambient_npc/planet/peddler/proc/chat_with(mob/living/user)
+/mob/living/carbon/human/npc/ambient_npc/planet/peddler/proc/chat_with(mob/living/user)
var/turf/ruin = ruin_to_tell()
if(ruin && first_for_crew(user, "ruin_tip"))
var/list/lines = get_lines("ruin_tip")
@@ -556,7 +567,7 @@
speak_context(AMBIENT_LINE_TALK, user, force = TRUE)
/// A ruin on their planet, looked for once (a few hundred random tiles) and remembered by the site, or null
-/mob/living/basic/ambient_npc/planet/peddler/proc/ruin_to_tell()
+/mob/living/carbon/human/npc/ambient_npc/planet/peddler/proc/ruin_to_tell()
var/datum/ambient_place/site/site = place
if(!istype(site) || length(site.planet?.bounds) < 5)
return null
@@ -573,7 +584,7 @@
return null
/// The pony is dead: the stock went with it
-/mob/living/basic/ambient_npc/planet/peddler/proc/lose_pack()
+/mob/living/carbon/human/npc/ambient_npc/planet/peddler/proc/lose_pack()
if(shop_closed)
return
shop_closed = TRUE
@@ -581,7 +592,7 @@
speak_context("pack_lost", null, force = TRUE)
// A word, the guard deals with it, and the peddler gets out of the way
-/mob/living/basic/ambient_npc/planet/peddler/react_attacked(atom/attacker)
+/mob/living/carbon/human/npc/ambient_npc/planet/peddler/react_attacked(atom/attacker)
if(stat != CONSCIOUS || fading || !reaction_ready("attacked"))
return
speak_context(AMBIENT_LINE_ATTACKED, attacker, force = TRUE)
@@ -590,7 +601,7 @@
run_from(attacker)
// Killed: the shop goes with them. Its stock is a ledger, never items on the body.
-/mob/living/basic/ambient_npc/planet/peddler/death(gibbed)
+/mob/living/carbon/human/npc/ambient_npc/planet/peddler/death(gibbed)
var/was_alive = stat != DEAD
. = ..()
if(!was_alive)
@@ -602,7 +613,7 @@
* The caravan's next move: camp at a camp stop not yet camped at, walk to the next waypoint (jumped
* on the way, maybe), or walk off the planet at the end of the route.
*/
-/mob/living/basic/ambient_npc/planet/peddler/pick_activity()
+/mob/living/carbon/human/npc/ambient_npc/planet/peddler/pick_activity()
var/datum/ambient_place/site/site = place
var/list/route = istype(site) ? site.data["route"] : null
if(!length(route) || world.time < hold_until)
@@ -630,7 +641,7 @@
return start_activity(new /datum/ambient_activity/caravan_walk(src, route[leg + 1], leg + 1))
/// The end of the road: the caravan walks off, and the site is done for the round
-/mob/living/basic/ambient_npc/planet/peddler/proc/leave_planet()
+/mob/living/carbon/human/npc/ambient_npc/planet/peddler/proc/leave_planet()
var/datum/ambient_place/site/site = place
speak_context("farewell", null, force = TRUE)
if(!istype(site))
@@ -638,75 +649,94 @@
return
// Spent before anyone goes, so nobody comes back on the next visit
site.state = AMBIENT_SITE_SPENT
- for(var/mob/living/basic/ambient_npc/member as anything in site.living_npcs())
+ for(var/mob/living/carbon/human/npc/ambient_npc/member as anything in site.living_npcs())
member.fade_out()
/**
- * The pack pony. Killable; a dead pony closes the shop. It follows the peddler, and runs a little
- * way when hit.
+ * The pack pony. An animal, so it stays a basic mob (tg's pony) when the people of the caravan are
+ * human bodies: it isn't one of the site's NPCs, but the caravan's beast, kept in the site's data
+ * ("pony") and brought back with it on a later visit. Killable; a dead pony closes the shop. It
+ * follows the peddler, and runs a little way when hit.
*/
-/mob/living/basic/ambient_npc/planet/pack_pony
+/mob/living/basic/pony/ambient_pack
name = "pack pony"
desc = "A sturdy pony under a mountain of bags and bundles."
- icon = 'icons/mob/simple/animal.dmi'
- icon_state = "pony"
- icon_living = "pony"
- icon_dead = "pony_dead"
- greyscale_config = /datum/greyscale_config/pony
- random_name = FALSE
- random_gender = FALSE
- mob_biotypes = MOB_ORGANIC | MOB_BEAST
- maxHealth = 60
health = 60
- // A pony carries bags, not a purse
- death_cash_low = 0
- death_cash_high = 0
- speak_emote = list("neighs")
- ai_controller = /datum/ai_controller/basic_controller/ambient_npc/roaming
- routine = list(/datum/ambient_activity/idle = 1)
+ maxHealth = 60
+ gold_core_spawnable = NO_SPAWN
+ ai_controller = /datum/ai_controller/basic_controller/ambient_pack_pony
+ /// The caravan's site
+ var/datum/weakref/site_ref
-/mob/living/basic/ambient_npc/planet/pack_pony/Initialize(mapload)
+/mob/living/basic/pony/ambient_pack/Initialize(mapload, datum/ambient_place/site/site)
. = ..()
+ // tg's pony already remembers who hit it (ai_retaliate), which its flee subtree reads
set_greyscale(colors = list("#8a5a3c", "#3b2a1e"))
+ if(istype(site))
+ site_ref = WEAKREF(site)
+ site.data["pony"] = WEAKREF(src)
-// A pony, not a person: no human look
-/mob/living/basic/ambient_npc/planet/pack_pony/build_look()
- return
-
-// It lies as its own sprite does
-/mob/living/basic/ambient_npc/planet/pack_pony/look_dead()
- . = ..()
- transform = matrix()
-
-// Snorts and whickers instead of words
-/mob/living/basic/ambient_npc/planet/pack_pony/speak_context(context, atom/other, force = FALSE)
- if(stat != CONSCIOUS || fading)
- return FALSE
- if(!force && world.time < next_line_at)
- return FALSE
- next_line_at = world.time + rand(60 SECONDS, 120 SECONDS)
- manual_emote(pick("snorts.", "whickers.", "stamps a hoof.", "flicks its ears."))
- playsound(src, 'sound/mobs/non-humanoids/pony/snort.ogg', 30, TRUE, -3)
- return TRUE
-
-/mob/living/basic/ambient_npc/planet/pack_pony/pick_activity()
- var/mob/living/basic/ambient_npc/planet/peddler/leader = caravan_leader(src)
- if(leader && start_activity(new /datum/ambient_activity/follow(src, leader, 2)))
- return activity
+/mob/living/basic/pony/ambient_pack/Destroy()
+ site_ref = null
return ..()
+// No saddle and no rider: it carries the stock
+/mob/living/basic/pony/ambient_pack/tamed(mob/living/tamer, atom/food)
+ return
+
// The stock was on its back
-/mob/living/basic/ambient_npc/planet/pack_pony/death(gibbed)
+/mob/living/basic/pony/ambient_pack/death(gibbed)
var/was_alive = stat != DEAD
. = ..()
if(!was_alive)
return
- var/datum/ambient_place/site/site = place
- if(istype(site))
- site.data["pack_lost"] = TRUE
- var/mob/living/basic/ambient_npc/planet/peddler/leader = caravan_leader(src)
+ var/datum/ambient_place/site/site = site_ref?.resolve()
+ if(!istype(site))
+ return
+ site.data["pack_lost"] = TRUE
+ var/mob/living/carbon/human/npc/ambient_npc/planet/peddler/leader = caravan_leader_of(site)
leader?.lose_pack()
+/// Keeps near the caravan's peddler; runs from whoever hits it
+/datum/ai_controller/basic_controller/ambient_pack_pony
+ blackboard = list(
+ BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
+ )
+ ai_traits = PASSIVE_AI_FLAGS
+ ai_movement = /datum/ai_movement/basic_avoidance
+ idle_behavior = null
+ // Walking with players anywhere on the level, as the caravan does
+ can_idle = FALSE
+ planning_subtrees = list(
+ /datum/ai_planning_subtree/find_nearest_thing_which_attacked_me_to_flee,
+ /datum/ai_planning_subtree/flee_target,
+ /datum/ai_planning_subtree/ambient_pony_follow,
+ )
+
+/// Walks after the caravan's peddler when more than two tiles behind
+/datum/ai_planning_subtree/ambient_pony_follow
+
+/datum/ai_planning_subtree/ambient_pony_follow/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/basic/pony/ambient_pack/pony = controller.pawn
+ if(!istype(pony))
+ return
+ var/mob/living/leader = caravan_leader_of(pony.site_ref?.resolve())
+ if(!leader || leader.z != pony.z || get_dist(pony, leader) <= 2)
+ return
+ controller.set_blackboard_key(BB_AMBIENT_DESTINATION, leader)
+ controller.queue_behavior(/datum/ai_behavior/travel_towards/stop_on_arrival, BB_AMBIENT_DESTINATION)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/// The caravan's pack pony on `site`, if it is still alive
+/proc/caravan_pony(datum/ambient_place/site/site)
+ if(!istype(site))
+ return null
+ var/datum/weakref/pony_ref = site.data["pony"]
+ var/mob/living/basic/pony/ambient_pack/pony = pony_ref?.resolve()
+ if(QDELETED(pony) || pony.stat == DEAD)
+ return null
+ return pony
+
/datum/outfit/ambient_caravan_guard
name = "Ambient NPC: caravan guard"
uniform = /obj/item/clothing/under/pants/camo
@@ -714,12 +744,24 @@
head = /obj/item/clothing/head/soft/black
shoes = /obj/item/clothing/shoes/jackboots
mask = /obj/item/clothing/mask/bandana/red
+ r_hand = /obj/item/melee/baseball_bat
+
+/// Red: a helmet for the cap
+/datum/outfit/ambient_caravan_guard/helmet
+ name = "Ambient NPC: caravan guard in a helmet"
+ head = /obj/item/clothing/head/helmet
+
+/// The caravan guard by band (AM-1): only out in yellow and red
+/datum/human_npc_outfit_table/ambient_caravan_guard
+ green = list(/datum/outfit/ambient_caravan_guard = 1)
+ red = list(/datum/outfit/ambient_caravan_guard/helmet = 1)
/// The hired guard, in yellow and red: follows the peddler, fights anyone who goes for the caravan and the pack that jumps it
-/mob/living/basic/ambient_npc/planet/caravan_guard
+/mob/living/carbon/human/npc/ambient_npc/planet/caravan_guard
name = "caravan guard"
desc = "A hired guard in a flak vest, a bat over one shoulder."
- outfit = /datum/outfit/ambient_caravan_guard
+ outfit = null
+ npc_outfit_table = /datum/human_npc_outfit_table/ambient_caravan_guard
dialogue_section = "caravan_guard"
fights_back = TRUE
joins_camp_fights = TRUE
@@ -730,14 +772,14 @@
ai_controller = /datum/ai_controller/basic_controller/ambient_npc/roaming
routine = list(/datum/ambient_activity/idle = 1)
-/mob/living/basic/ambient_npc/planet/caravan_guard/pick_activity()
- var/mob/living/basic/ambient_npc/planet/peddler/leader = caravan_leader(src)
+/mob/living/carbon/human/npc/ambient_npc/planet/caravan_guard/pick_activity()
+ var/mob/living/carbon/human/npc/ambient_npc/planet/peddler/leader = caravan_leader(src)
if(leader && start_activity(new /datum/ambient_activity/follow(src, leader, 3)))
return activity
return ..()
// The pack that jumped the caravan
-/mob/living/basic/ambient_npc/planet/caravan_guard/watch(list/players)
+/mob/living/carbon/human/npc/ambient_npc/planet/caravan_guard/watch(list/players)
if(istype(activity, /datum/ambient_activity/fight))
return
var/list/pack = ambient_site_visit(place)["pack"]
@@ -748,8 +790,12 @@
return
/// The peddler leading `member`'s caravan, if they are still about
-/proc/caravan_leader(mob/living/basic/ambient_npc/member)
- for(var/mob/living/basic/ambient_npc/planet/peddler/leader in member?.place?.living_npcs())
+/proc/caravan_leader(mob/living/carbon/human/npc/ambient_npc/member)
+ return caravan_leader_of(member?.place)
+
+/// The peddler leading the caravan on `site`, if they are still about
+/proc/caravan_leader_of(datum/ambient_place/site)
+ for(var/mob/living/carbon/human/npc/ambient_npc/planet/peddler/leader in site?.living_npcs())
return leader
return null
@@ -773,7 +819,7 @@
/// world.time they started waiting for the others, or 0
var/waiting_since = 0
-/datum/ambient_activity/caravan_walk/New(mob/living/basic/ambient_npc/new_doer, turf/goal, leg_index)
+/datum/ambient_activity/caravan_walk/New(mob/living/carbon/human/npc/ambient_npc/new_doer, turf/goal, leg_index)
. = ..()
src.goal = goal
src.leg_index = leg_index
@@ -834,7 +880,7 @@
if(get_dist(doer, goal) <= 2)
reached()
return AMBIENT_STEP_DONE
- var/mob/living/basic/ambient_npc/planet/peddler/peddler = doer
+ var/mob/living/carbon/human/npc/ambient_npc/planet/peddler/peddler = doer
if(istype(peddler) && world.time < peddler.hold_until)
return AMBIENT_STEP_CONTINUE
// The others catch up first, for a while
@@ -854,7 +900,7 @@
/// Whether the pony or the guard has fallen well behind
/datum/ambient_activity/caravan_walk/proc/others_behind()
- for(var/mob/living/basic/ambient_npc/member in doer.place?.living_npcs())
+ for(var/mob/living/carbon/human/npc/ambient_npc/member in doer.place?.living_npcs())
if(member != doer && get_dist(member, doer) > 5)
return TRUE
return FALSE
@@ -926,11 +972,15 @@
var/give_up_at = 0
/// The pack (weakrefs)
var/list/pack = list()
+ /// Spawn orders for raiders not built yet (human pirates come through the human NPC queue)
+ var/list/datum/human_npc_order/orders = list()
+ /// Where the pack came from: what is left of it walks back out that way
+ var/turf/landing
/datum/ambient_activity/caravan_ambush/setup()
go_to(null)
pack_at = world.time + AMBIENT_AMBUSH_WARNING
- var/mob/living/basic/ambient_npc/shouter = locate(/mob/living/basic/ambient_npc/planet/caravan_guard) in doer.place?.living_npcs()
+ var/mob/living/carbon/human/npc/ambient_npc/shouter = locate(/mob/living/carbon/human/npc/ambient_npc/planet/caravan_guard) in doer.place?.living_npcs()
shouter = shouter || doer
shouter.speak_context("ambush", null, force = TRUE)
return TRUE
@@ -941,6 +991,8 @@
if(raider)
UnregisterSignal(raider, COMSIG_ATOM_WAS_ATTACKED)
pack = null
+ QDEL_LIST(orders)
+ landing = null
return ..()
/datum/ambient_activity/caravan_ambush/arrive()
@@ -956,9 +1008,14 @@
return AMBIENT_STEP_DONE
return AMBIENT_STEP_CONTINUE
var/alive = 0
+ for(var/datum/human_npc_order/order as anything in orders.Copy())
+ if(QDELETED(order) || order.done)
+ orders -= order
+ else
+ alive++
for(var/datum/weakref/ref as anything in pack)
var/mob/living/raider = ref?.resolve()
- if(!QDELETED(raider) && raider.stat != DEAD)
+ if(!QDELETED(raider) && !human_npc_out_of_fight(raider))
alive++
if(!alive)
doer.speak_context("ambush_over", null, force = TRUE)
@@ -967,17 +1024,21 @@
return AMBIENT_STEP_DONE
return AMBIENT_STEP_CONTINUE
-// Whatever is left of the pack slinks off when it is over
+// Whatever is left of the pack heads back out the way it came, and is gone once out of sight
/datum/ambient_activity/caravan_ambush/finish()
+ QDEL_LIST(orders)
for(var/datum/weakref/ref as anything in pack)
- var/mob/living/raider = ref?.resolve()
- if(!QDELETED(raider) && raider.stat != DEAD && !raider.client)
- qdel(raider)
+ var/mob/living/carbon/human/npc/raider = ref?.resolve()
+ if(!ishumannpc(raider) || QDELETED(raider) || raider.client || human_npc_out_of_fight(raider))
+ continue
+ qdel(raider.GetComponent(/datum/component/leash))
+ raider.ai_controller?.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET)
+ raider.npc_walk_out(landing || get_ranged_target_turf(raider, get_dir(doer, raider) || pick(GLOB.alldirs), AMBIENT_AMBUSH_DISTANCE))
var/list/visit = ambient_site_visit(doer?.place)
visit -= "pack"
return ..()
-/// How many pirates jump a caravan in `band`: none in green
+/// How many jump the caravan in `band`
/proc/ambient_ambush_size(band)
switch(band)
if(ZONE_RED)
@@ -986,9 +1047,18 @@
return 2
return 0
+/// Open ground on `site` AMBIENT_AMBUSH_DISTANCE from `here` in some direction, where the pack comes from, or null
+/datum/ambient_activity/caravan_ambush/proc/find_landing(datum/ambient_place/site/site, turf/here)
+ for(var/attempt in 1 to 6)
+ var/turf/far = get_ranged_target_turf(here, pick(GLOB.alldirs), AMBIENT_AMBUSH_DISTANCE)
+ if(far && site.leash_ok(far) && ambient_ground_ok(far))
+ return far
+ return null
+
/**
- * Makes the pack out of what the planet's budget has left, ten tiles off, turns it on the caravan
- * and keeps it near it. Returns how many came.
+ * Sends for the pack out of what the planet's budget has left, ten tiles off: real human pirates,
+ * built a body a tick through the human NPC queue, turned on the caravan and kept near it as they
+ * come (raider_built()). Returns how many were sent for.
*/
/datum/ambient_activity/caravan_ambush/proc/spawn_pack()
var/datum/ambient_place/site/site = doer.place
@@ -1003,42 +1073,30 @@
if(count <= 0)
return 0
var/turf/here = get_turf(doer)
- var/turf/landing
- for(var/attempt in 1 to 6)
- var/turf/far = get_ranged_target_turf(here, pick(GLOB.alldirs), AMBIENT_AMBUSH_DISTANCE)
- if(far && site.leash_ok(far) && ambient_ground_ok(far))
- landing = far
- break
+ landing = find_landing(site, here)
if(!landing)
return 0
- var/mob/living/bait = locate(/mob/living/basic/ambient_npc/planet/pack_pony) in site.living_npcs()
- bait = bait || locate(/mob/living/basic/ambient_npc/planet/caravan_guard) in site.living_npcs()
- var/list/visit = ambient_site_visit(site)
- var/list/pack_refs = list()
+ var/mob/living/bait = caravan_pony(site) || locate(/mob/living/carbon/human/npc/ambient_npc/planet/caravan_guard) in site.living_npcs()
+ ambient_site_visit(site)["pack"] = list()
var/static/list/raiders = list(
- /mob/living/basic/trooper/pirate/faction/grey/melee = 2,
- /mob/living/basic/trooper/pirate/faction/skeleton/melee = 2,
- /mob/living/basic/trooper/pirate/faction/grey/ranged = 1,
+ /mob/living/carbon/human/npc/faction_pirate/grey/melee = 2,
+ /mob/living/carbon/human/npc/faction_pirate/skeleton/melee = 2,
+ /mob/living/carbon/human/npc/faction_pirate/grey/ranged = 1,
)
for(var/i in 1 to count)
var/turf/where = ambient_free_turf_near(landing, 2) || landing
- var/raider_type = i == 3 ? /mob/living/basic/trooper/pirate/faction/grey/ranged : pick_weight(raiders - /mob/living/basic/trooper/pirate/faction/grey/ranged)
- var/mob/living/raider = spawn_raider(raider_type, where, bait)
- var/datum/weakref/ref = WEAKREF(raider)
- pack += ref
- pack_refs += ref
- visit["pack"] = pack_refs
+ var/raider_type = i == 3 ? /mob/living/carbon/human/npc/faction_pirate/grey/ranged : pick_weight(raiders - /mob/living/carbon/human/npc/faction_pirate/grey/ranged)
+ var/datum/npc_spawn_context/context = new(site, site.band, source_turf = here)
+ orders += spawn_human_npc(raider_type, where, CALLBACK(src, PROC_REF(raider_built), WEAKREF(bait)), context = context)
if(tracker)
tracker.spawned_count += count
SSplanet_mobs.total_managed_mobs += count
return count
-/// Ready each ambusher against the caravan site before applying its profile.
-/datum/ambient_activity/caravan_ambush/proc/spawn_raider(raider_type, turf/where, mob/living/bait)
- var/datum/ambient_place/site/site = doer.place
- var/datum/npc_spawn_context/context = new(site, site.band, source_turf = get_turf(doer))
- var/mob/living/raider = spawn_npc_in_zone(raider_type, where, context, FALSE)
- // Not the planet's own: it comes for the caravan, and is kept near it.
+/// A raider of the pack is built: not the planet's own, it comes for the caravan and is kept near it
+/datum/ambient_activity/caravan_ambush/proc/raider_built(datum/weakref/bait_ref, mob/living/raider)
+ if(QDELETED(src) || QDELETED(doer) || QDELETED(raider))
+ return
var/list/kept = list()
for(var/faction_token in raider.faction)
if(!findtext("[faction_token]", "planetary_"))
@@ -1047,15 +1105,22 @@
raider.AddComponent(/datum/component/leash, doer, AMBIENT_AMBUSH_LEASH)
raider.AddElement(/datum/element/relay_attackers)
RegisterSignal(raider, COMSIG_ATOM_WAS_ATTACKED, PROC_REF(on_pack_attacked))
- if(bait)
+ var/mob/living/bait = bait_ref?.resolve()
+ if(!QDELETED(bait) && bait.stat != DEAD)
raider.ai_controller?.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, bait)
- context.finalize()
- return raider
+ var/datum/weakref/ref = WEAKREF(raider)
+ pack += ref
+ var/list/visit = ambient_site_visit(doer.place)
+ var/list/pack_refs = visit["pack"]
+ if(!islist(pack_refs))
+ pack_refs = list()
+ visit["pack"] = pack_refs
+ pack_refs += ref
/// Someone hit the pack: their crew gets the helpers' price
/datum/ambient_activity/caravan_ambush/proc/on_pack_attacked(datum/source, atom/attacker, attack_flags)
SIGNAL_HANDLER
- var/mob/living/basic/ambient_npc/planet/peddler/peddler = doer
+ var/mob/living/carbon/human/npc/ambient_npc/planet/peddler/peddler = doer
if(!istype(peddler) || !peddler.shop || !ismob(attacker))
return
var/obj/structure/overmap/ship/ship = get_crew_ship(attacker)
@@ -1068,7 +1133,7 @@
/**
* Brings the caravan out: plans its route the first time, then puts whoever is missing (and was
- * not killed) where it last got to.
+ * not killed) where it last got to, and the pony with them while it lives.
*/
/datum/ambient_site_kind/planet/peddler/realize(datum/ambient_place/site/site)
var/missing = site.npcs_missing()
@@ -1082,10 +1147,10 @@
if(!ambient_ground_ok(start))
start = ambient_free_turf_near(start, 3) || site.center
var/list/killed = site.data["killed"] || list()
- var/list/wanted = list(/mob/living/basic/ambient_npc/planet/peddler, /mob/living/basic/ambient_npc/planet/pack_pony)
- if(site.npc_total >= 3)
- wanted += /mob/living/basic/ambient_npc/planet/caravan_guard
- for(var/mob/living/basic/ambient_npc/present as anything in site.living_npcs())
+ var/list/wanted = list(/mob/living/carbon/human/npc/ambient_npc/planet/peddler)
+ if(site.npc_total >= 2)
+ wanted += /mob/living/carbon/human/npc/ambient_npc/planet/caravan_guard
+ for(var/mob/living/carbon/human/npc/ambient_npc/present as anything in site.living_npcs())
wanted -= present.type
var/spawned = 0
for(var/member_type in wanted)
@@ -1094,7 +1159,7 @@
if(spawned >= missing)
break
var/turf/where = spawned ? (ambient_free_turf_near(start, 2) || start) : start
- var/mob/living/basic/ambient_npc/planet/peddler/member = site.spawn_npc(member_type, where)
+ var/mob/living/carbon/human/npc/ambient_npc/planet/peddler/member = site.spawn_npc(member_type, where)
if(!member)
continue
spawned++
@@ -1102,9 +1167,18 @@
member.load_ledger()
if(site.data["pack_lost"])
member.shop_closed = TRUE
+ if(spawned && !site.data["pack_lost"] && !caravan_pony(site))
+ new /mob/living/basic/pony/ambient_pack(ambient_free_turf_near(start, 2) || start, site)
return spawned > 0
-/datum/ambient_site_kind/planet/peddler/on_npc_died(datum/ambient_place/site/site, mob/living/basic/ambient_npc/npc)
+// The pony goes with the caravan when the planet is swept, and comes back with it
+/datum/ambient_site_kind/planet/peddler/on_depopulated(datum/ambient_place/site/site)
+ var/mob/living/basic/pony/ambient_pack/pony = caravan_pony(site)
+ if(pony)
+ qdel(pony)
+ return ..()
+
+/datum/ambient_site_kind/planet/peddler/on_npc_died(datum/ambient_place/site/site, mob/living/carbon/human/npc/ambient_npc/npc)
var/list/killed = site.data["killed"]
if(!islist(killed))
killed = list()
diff --git a/voidcrew/modules/ambient_npcs/planet_sites.dm b/voidcrew/modules/ambient_npcs/planet_sites.dm
index cf47c7d4bb5..fcb45ceb15d 100644
--- a/voidcrew/modules/ambient_npcs/planet_sites.dm
+++ b/voidcrew/modules/ambient_npcs/planet_sites.dm
@@ -12,7 +12,7 @@
* - /datum/ambient_site_kind/planet and its subtypes: which camps roll on which planet types and
* how often (spec 4.1), and how many people they have. The spot finders the core's does not
* cover (a rock face with ore, a lava bank, open water) sit beside each camp's realize().
- * - /mob/living/basic/ambient_npc/planet: the killable planet person every PB NPC builds on. Loot
+ * - /mob/living/carbon/human/npc/ambient_npc/planet: the killable planet person every PB NPC builds on. Loot
* drops once, the body falls over, they fight back (or run) when attacked, a camp fights
* together, and a camp that watches for strangers does it in watch().
* - Shared activities: fight, flee, follow, camp_chore and nap.
@@ -129,14 +129,14 @@
)
field_chance = 10
spot_room = 1
- npc_type = /mob/living/basic/ambient_npc/planet/miner
+ npc_type = /mob/living/carbon/human/npc/ambient_npc/planet/miner
/// Owner item 7: a cannibal cooking a man over a fire. Jungle worlds.
/datum/ambient_site_kind/planet/cannibal
name = "cannibal's fire"
planet_chances = list(/datum/overmap/planet/jungle = 8)
spot_room = 2
- npc_type = /mob/living/basic/ambient_npc/planet/cannibal
+ npc_type = /mob/living/carbon/human/npc/ambient_npc/planet/cannibal
/// Owner item 8: a band of hunters with spears. Jungle worlds; bigger bands deeper out.
/datum/ambient_site_kind/planet/tribal
@@ -145,7 +145,7 @@
min_npcs = 3
max_npcs = 5
spot_room = 3
- npc_type = /mob/living/basic/ambient_npc/planet/tribal
+ npc_type = /mob/living/carbon/human/npc/ambient_npc/planet/tribal
/datum/ambient_site_kind/planet/tribal/npc_count(band)
switch(band)
@@ -159,14 +159,14 @@
/datum/ambient_site_kind/planet/lava_fisher
name = "lava fisher's bank"
planet_chances = list(/datum/overmap/planet/lava = 15)
- npc_type = /mob/living/basic/ambient_npc/planet/lava_fisher
+ npc_type = /mob/living/carbon/human/npc/ambient_npc/planet/lava_fisher
/// Owner item 10: a fisher in a boat out on the ocean. Beach worlds.
/datum/ambient_site_kind/planet/boat_fisher
name = "fishing boat"
planet_chances = list(/datum/overmap/planet/beach = 18)
spot_on_water = TRUE
- npc_type = /mob/living/basic/ambient_npc/planet/boat_fisher
+ npc_type = /mob/living/carbon/human/npc/ambient_npc/planet/boat_fisher
/// Owner item 11: a peddler crossing the planet with a pack pony, and a guard deeper out.
/datum/ambient_site_kind/planet/peddler
@@ -178,14 +178,15 @@
/datum/overmap/planet/ice = 6,
/datum/overmap/planet/wasteland = 6,
)
- min_npcs = 2
- max_npcs = 3
+ min_npcs = 1
+ max_npcs = 2
spot_room = 1
- npc_type = /mob/living/basic/ambient_npc/planet/peddler
+ npc_type = /mob/living/carbon/human/npc/ambient_npc/planet/peddler
-// The peddler and the pony; a guard joins them in yellow and red
+// The peddler; a guard joins them in yellow and red. The pony is an animal, not one of the site's people
+// (planet_peddler.dm, caravan_pony()).
/datum/ambient_site_kind/planet/peddler/npc_count(band)
- return (band == ZONE_YELLOW || band == ZONE_RED) ? 3 : 2
+ return (band == ZONE_YELLOW || band == ZONE_RED) ? 2 : 1
// =========================================================================
// HELPERS
@@ -198,7 +199,7 @@
if(!middle || !islist(SSmobs.clients_by_zlevel) || middle.z > length(SSmobs.clients_by_zlevel))
return
for(var/mob/living/player in SSmobs.clients_by_zlevel[middle.z])
- if(player.stat == DEAD || !player.client || istype(player, /mob/living/basic/ambient_npc))
+ if(player.stat == DEAD || !player.client || istype(player, /mob/living/carbon/human/npc/ambient_npc))
continue
var/turf/where = get_turf(player)
if(where && get_dist(where, middle) <= range)
@@ -223,6 +224,24 @@
var/area/tile_area = get_area(tile)
return !tile_area || istype(tile_area, /area/ruin) || istype(tile_area, /area/shuttle)
+/**
+ * Whether one of `thrower`'s own camp (an ambient NPC of the same place) stands between them and
+ * `target`, so a throw or a shot would hit them first. Nobody passes through a thrown spear: they
+ * hold it instead. Bodies lying down are passed over, as a throw passes over them.
+ */
+/proc/ambient_camp_mate_in_line(mob/living/carbon/human/npc/ambient_npc/thrower, atom/target)
+ var/turf/start = get_turf(thrower)
+ var/turf/finish = get_turf(target)
+ if(!start || !finish || !thrower.place)
+ return FALSE
+ for(var/turf/line_turf as anything in get_line(start, finish))
+ if(line_turf == start || line_turf == finish)
+ continue
+ for(var/mob/living/carbon/human/npc/ambient_npc/other in line_turf)
+ if(other != thrower && other.place == thrower.place && other.stat != DEAD && other.body_position == STANDING_UP)
+ return TRUE
+ return FALSE
+
/// A square leash of `radius` around `center`, as list(min x, min y, max x, max y, z)
/proc/ambient_square_bounds(turf/center, radius)
center = get_turf(center)
@@ -235,12 +254,12 @@
// =========================================================================
/**
- * Someone living on a planet or an asteroid: killable (health scaled by band where they spawn,
- * site.spawn_npc()), their loot dropped once, their body falling over. Fighters fight back when
- * attacked and their camp joins in; everyone else runs. A camp that watches for strangers does it
- * in watch(), about every two seconds while they are awake.
+ * Someone living on a planet or an asteroid: a real body, dressed by band where they spawn (their
+ * outfit table's kit in yellow and red, site.spawn_npc()), their loot dropped once. Fighters fight
+ * back with the real weapon they carry and their camp joins in; everyone else runs. A camp that
+ * watches for strangers does it in watch(), about every two seconds while they are awake.
*/
-/mob/living/basic/ambient_npc/planet
+/mob/living/carbon/human/npc/ambient_npc/planet
name = "drifter"
desc = "Someone living rough."
dialogue_file = AMBIENT_STRINGS_PLANETS
@@ -253,7 +272,7 @@
var/fights_back = FALSE
/// Joins in when someone at their camp is attacked
var/joins_camp_fights = FALSE
- /// The real item they fight with (its numbers, bounty_real_weapon()); null for fists
+ /// The type of the real weapon they fight with, which their outfit gives them (a belt, a hand); null for fists
var/weapon_type
/// What they hold when nothing is going on (a spear, a club), or null
var/idle_held
@@ -263,38 +282,29 @@
var/flee_below = 0
/// Their camp looks out for strangers (watch())
var/watches = FALSE
- /// Asleep: they see nothing until woken
- var/sleeping = FALSE
-/mob/living/basic/ambient_npc/planet/Initialize(mapload)
+/mob/living/carbon/human/npc/ambient_npc/planet/Initialize(mapload, datum/human_npc_order/order)
. = ..()
- arm(weapon_type)
show_idle_held()
-/// Their blows hit like `item_type` (null: fists), and it is the weapon they show in a fight
-/mob/living/basic/ambient_npc/planet/proc/arm(item_type)
- weapon_type = item_type
- var/datum/bounty_real_weapon/weapon = bounty_real_weapon(item_type)
- weapon.apply_melee(src)
-
-/// Back to holding what they hold when nothing is going on
-/mob/living/basic/ambient_npc/planet/proc/show_idle_held()
+/// Back to holding what they hold when nothing is going on, putting their weapon away
+/mob/living/carbon/human/npc/ambient_npc/planet/proc/show_idle_held()
if(stat == DEAD)
return
set_held(idle_held)
-// A body lies down, and gets up again if they are revived
-/mob/living/basic/ambient_npc/planet/look_dead()
- . = ..()
- transform = matrix().Turn(90)
-
-/mob/living/basic/ambient_npc/planet/look_alive()
- . = ..()
- transform = matrix()
+/// The weapon they fight with, if they have it in hand
+/mob/living/carbon/human/npc/ambient_npc/planet/proc/held_weapon()
+ if(!weapon_type)
+ return null
+ for(var/obj/item/held in held_items)
+ if(istype(held, weapon_type))
+ return held
+ return null
-/mob/living/basic/ambient_npc/planet/Life(seconds_per_tick = SSMOBS_DT, times_fired)
+/mob/living/carbon/human/npc/ambient_npc/planet/Life(seconds_per_tick = SSMOBS_DT, times_fired)
. = ..()
- if(!watches || sleeping || stat != CONSCIOUS || fading || !place || HAS_TRAIT(src, TRAIT_AI_PAUSED))
+ if(!watches || IsSleeping() || stat != CONSCIOUS || fading || !place || HAS_TRAIT(src, TRAIT_AI_PAUSED))
return
watch()
@@ -302,23 +312,24 @@
* Looks out for strangers: `players`, or the players near them when null (tests pass their own).
* Override. Runs from Life(), so it must not sleep.
*/
-/mob/living/basic/ambient_npc/planet/proc/watch(list/players)
+/mob/living/carbon/human/npc/ambient_npc/planet/proc/watch(list/players)
return
-/// Wakes them from a nap
-/mob/living/basic/ambient_npc/planet/proc/wake_up()
- if(!sleeping)
+/// Done napping, if they are awake: up off the mat. Sleep itself only ends as anyone's does (tg's
+/// Sleeping running out, or someone shaking them awake).
+/mob/living/carbon/human/npc/ambient_npc/planet/proc/wake_up()
+ if(IsSleeping())
return
- sleeping = FALSE
if(istype(activity, /datum/ambient_activity/nap))
end_activity()
-/// Whether they could go after `target`: someone alive and near, never one of their own camp
-/mob/living/basic/ambient_npc/planet/proc/can_fight(mob/living/target)
- if(!fights_back || QDELETED(target) || !isliving(target) || target.stat == DEAD || target == src)
+/// Whether they could go after `target`: someone up and near, never one of their own camp
+/mob/living/carbon/human/npc/ambient_npc/planet/proc/can_fight(mob/living/target)
+ // Someone already down is left there (npc_target_stat): they fight people, they don't finish them
+ if(!fights_back || QDELETED(target) || !isliving(target) || target.stat > npc_target_stat || target == src)
return FALSE
- if(istype(target, /mob/living/basic/ambient_npc))
- var/mob/living/basic/ambient_npc/other = target
+ if(istype(target, /mob/living/carbon/human/npc/ambient_npc))
+ var/mob/living/carbon/human/npc/ambient_npc/other = target
if(other.place == place)
return FALSE
var/turf/here = get_turf(src)
@@ -326,7 +337,7 @@
return here && there && here.z == there.z && get_dist(here, there) <= PLANET_NPC_CHASE_RANGE
/// Goes after `target`, unless already fighting them. Returns the fight, or null.
-/mob/living/basic/ambient_npc/planet/proc/engage(mob/living/target)
+/mob/living/carbon/human/npc/ambient_npc/planet/proc/engage(mob/living/target)
if(!can_fight(target))
return null
var/datum/ambient_activity/fight/current = activity
@@ -336,36 +347,41 @@
return start_activity(new /datum/ambient_activity/fight(src, target))
/// Everyone at their camp who fights joins them against `target`
-/mob/living/basic/ambient_npc/planet/proc/camp_alert(mob/living/target)
+/mob/living/carbon/human/npc/ambient_npc/planet/proc/camp_alert(mob/living/target)
if(!place)
return
- for(var/mob/living/basic/ambient_npc/planet/mate in place.living_npcs())
+ for(var/mob/living/carbon/human/npc/ambient_npc/planet/mate in place.living_npcs())
if(mate == src || !mate.joins_camp_fights || istype(mate.activity, /datum/ambient_activity/fight))
continue
mate.engage(target)
-/// One blow at `target`, with their weapon's own numbers and one of its verbs
-/mob/living/basic/ambient_npc/planet/proc/strike(mob/living/target)
- var/datum/bounty_real_weapon/weapon = bounty_real_weapon(weapon_type)
- weapon.pick_verb(src)
- melee_attack(target, null, TRUE)
+/// One blow at `target`: a click with the weapon in hand (or a fist), through the real attack chain
+/mob/living/carbon/human/npc/ambient_npc/planet/proc/strike(mob/living/target)
+ var/obj/item/weapon = held_weapon()
+ if(weapon)
+ human_npc_ready_item(src, weapon)
+ human_npc_ready_weapon(src, weapon)
+ else if(!human_npc_ready_empty_hand(src))
+ return
+ zone_selected = human_npc_pick_aim_zone()
+ ai_controller?.ai_interact(target, combat_mode = TRUE)
/// How far they could throw something right now (their spear), or 0
-/mob/living/basic/ambient_npc/planet/proc/throw_reach()
+/mob/living/carbon/human/npc/ambient_npc/planet/proc/throw_reach()
return 0
/// A try at hitting `target` from where they stand (a thrown spear). TRUE if they did something.
-/mob/living/basic/ambient_npc/planet/proc/try_ranged(mob/living/target)
+/mob/living/carbon/human/npc/ambient_npc/planet/proc/try_ranged(mob/living/target)
return FALSE
/// Runs from `threat`
-/mob/living/basic/ambient_npc/planet/proc/run_from(atom/threat)
+/mob/living/carbon/human/npc/ambient_npc/planet/proc/run_from(atom/threat)
if(istype(activity, /datum/ambient_activity/flee))
return activity
return start_activity(new /datum/ambient_activity/flee(src, threat))
// Fighters fight and their camp joins in; everyone else says something and gets away
-/mob/living/basic/ambient_npc/planet/react_attacked(atom/attacker)
+/mob/living/carbon/human/npc/ambient_npc/planet/react_attacked(atom/attacker)
if(stat != CONSCIOUS || fading)
return
var/mob/living/foe = isliving(attacker) ? attacker : null
@@ -381,7 +397,7 @@
camp_alert(foe)
// No sheltering from the weather in the middle of a fight
-/mob/living/basic/ambient_npc/planet/react_storm(datum/weather/storm)
+/mob/living/carbon/human/npc/ambient_npc/planet/react_storm(datum/weather/storm)
if(istype(activity, /datum/ambient_activity/fight) || istype(activity, /datum/ambient_activity/flee))
return
return ..()
@@ -390,7 +406,7 @@
* Whether `user`'s crew has had `what` from this site yet; marks it if not. TRUE only the first
* time for a crew, for as long as the site lasts (the planet's life).
*/
-/mob/living/basic/ambient_npc/planet/proc/first_for_crew(mob/user, what)
+/mob/living/carbon/human/npc/ambient_npc/planet/proc/first_for_crew(mob/user, what)
var/datum/ambient_place/site/site = place
if(!istype(site) || !user)
return FALSE
@@ -425,7 +441,7 @@
/// The walk to the target failed too often: they give up
var/gave_up = FALSE
-/datum/ambient_activity/fight/New(mob/living/basic/ambient_npc/new_doer, atom/target)
+/datum/ambient_activity/fight/New(mob/living/carbon/human/npc/ambient_npc/new_doer, atom/target)
. = ..()
target_ref = WEAKREF(target)
@@ -437,11 +453,12 @@
return target
/datum/ambient_activity/fight/setup()
- var/mob/living/basic/ambient_npc/planet/fighter = doer
+ var/mob/living/carbon/human/npc/ambient_npc/planet/fighter = doer
var/mob/living/target = target()
if(!istype(fighter) || !target || !fighter.can_fight(target))
return FALSE
fighter.stand_up()
+ fighter.set_pace(running = TRUE)
fighter.set_held(fighter.weapon_type)
next_blow = world.time + PLANET_NPC_FIRST_BLOW_DELAY
last_reachable = world.time
@@ -450,11 +467,11 @@
/// Heads for the target: near enough to throw for someone who can, right beside them otherwise
/datum/ambient_activity/fight/proc/chase(mob/living/target)
- var/mob/living/basic/ambient_npc/planet/fighter = doer
+ var/mob/living/carbon/human/npc/ambient_npc/planet/fighter = doer
go_to(target, max(1, fighter.throw_reach()))
/datum/ambient_activity/fight/act(seconds)
- var/mob/living/basic/ambient_npc/planet/fighter = doer
+ var/mob/living/carbon/human/npc/ambient_npc/planet/fighter = doer
var/mob/living/target = target()
if(gave_up || !target || !fighter.can_fight(target))
return AMBIENT_STEP_DONE
@@ -486,10 +503,11 @@
arrived = FALSE
/datum/ambient_activity/fight/finish()
- var/mob/living/basic/ambient_npc/planet/fighter = doer
+ var/mob/living/carbon/human/npc/ambient_npc/planet/fighter = doer
. = ..()
if(istype(fighter) && !QDELETED(fighter))
fighter.show_idle_held()
+ fighter.set_pace(running = FALSE)
/// Running from something: well away from it, a breather, and away again if it follows
/datum/ambient_activity/flee
@@ -500,7 +518,7 @@
/// What they run from
var/datum/weakref/threat_ref
-/datum/ambient_activity/flee/New(mob/living/basic/ambient_npc/new_doer, atom/threat)
+/datum/ambient_activity/flee/New(mob/living/carbon/human/npc/ambient_npc/new_doer, atom/threat)
. = ..()
threat_ref = WEAKREF(threat)
@@ -510,6 +528,7 @@
set_duration()
doer.stand_up()
doer.speak_context("flee", threat_ref?.resolve(), force = TRUE)
+ doer.set_pace(running = TRUE)
return TRUE
/// Sends them somewhere away from the threat they could get to. FALSE when there is nowhere.
@@ -538,6 +557,11 @@
doer.setDir(pick(GLOB.cardinals))
return AMBIENT_STEP_CONTINUE
+/datum/ambient_activity/flee/finish()
+ if(!QDELETED(doer))
+ doer.set_pace(running = FALSE)
+ return ..()
+
/**
* Keeping near someone (a caravan's leader, a hunting partner) until they are gone or it ends.
* `keep` is how near; `duration` 0 follows for as long as the leader is there.
@@ -548,7 +572,7 @@
/// How near they keep
var/keep = 2
-/datum/ambient_activity/follow/New(mob/living/basic/ambient_npc/new_doer, atom/leader, keep = 2, duration = 0)
+/datum/ambient_activity/follow/New(mob/living/carbon/human/npc/ambient_npc/new_doer, atom/leader, keep = 2, duration = 0)
. = ..()
src.keep = keep
if(duration)
@@ -559,7 +583,7 @@
var/mob/living/leader = anchor()
if(!isliving(leader) || leader.stat == DEAD)
return null
- var/mob/living/basic/ambient_npc/npc_leader = leader
+ var/mob/living/carbon/human/npc/ambient_npc/npc_leader = leader
if(istype(npc_leader) && npc_leader.fading)
return null
return leader
@@ -693,7 +717,7 @@
. = ..()
if(QDELETED(doer))
return
- var/mob/living/basic/ambient_npc/planet/planet_npc = doer
+ var/mob/living/carbon/human/npc/ambient_npc/planet/planet_npc = doer
if(istype(planet_npc))
planet_npc.show_idle_held()
else if(held_look)
@@ -737,25 +761,25 @@
best_distance = distance
return best
+// They lie down and go to sleep, as anyone does (tg's resting and Sleeping): asleep they snore by
+// themselves, see nothing, and wake when the sleep runs out or someone shakes them.
/datum/ambient_activity/nap/arrive()
- var/mob/living/basic/ambient_npc/planet/sleeper = doer
doer.set_held(null)
doer.manual_emote("lies down.")
- animate(doer, transform = matrix().Turn(90), time = 0.5 SECONDS)
- if(istype(sleeper))
- sleeper.sleeping = TRUE
+ doer.set_resting(TRUE, silent = TRUE)
+ doer.Sleeping(max(1 SECONDS, ends_at - world.time))
+// Awake again before it is over (shaken, or the sleep ran out early): a turn over, and up
/datum/ambient_activity/nap/act(seconds)
- if(prob(4))
- doer.manual_emote(pick("snores.", "turns over."))
+ if(!doer.IsSleeping())
+ if(prob(30))
+ doer.manual_emote("turns over.")
+ return AMBIENT_STEP_DONE
return AMBIENT_STEP_CONTINUE
/datum/ambient_activity/nap/finish()
- var/mob/living/basic/ambient_npc/planet/sleeper = doer
- if(istype(sleeper) && !QDELETED(sleeper))
- sleeper.sleeping = FALSE
- if(sleeper.stat != DEAD)
- animate(sleeper, transform = matrix(), time = 0.5 SECONDS)
+ if(!QDELETED(doer) && doer.stat == CONSCIOUS)
+ doer.set_resting(FALSE, silent = TRUE)
return ..()
// =========================================================================
diff --git a/voidcrew/modules/ambient_npcs/recruit.dm b/voidcrew/modules/ambient_npcs/recruit.dm
index e4b9a61554d..4f092de56de 100644
--- a/voidcrew/modules/ambient_npcs/recruit.dm
+++ b/voidcrew/modules/ambient_npcs/recruit.dm
@@ -5,7 +5,7 @@
*
* Owner decision D1: recruits are AI deckhands only. No ghost poll, no ghost role, no body swap.
*
- * A stray (/mob/living/basic/ambient_npc/stray: the stranded survivor, the lifeboat survivor, a
+ * A stray (/mob/living/carbon/human/npc/ambient_npc/stray: the stranded survivor, the lifeboat survivor, a
* convict who was talked down) goes through three states:
* - wild: where they were found. An empty hand from a member of a ship crew is a plea and a
* choice, "Come with us" or "Not now". They wave down crew members they see.
@@ -20,7 +20,9 @@
* AMBIENT_RECRUITS_PER_SHIP_ROUND taken aboard in a round. A stray taken aboard spends the site they
* came from, so it never brings them back.
*
- * Nothing here pays anything, and a deckhand drops nothing when killed.
+ * A stray rescued from being stranded (`gives_gifts`: the crashed pod and lifeboat survivors)
+ * hands whoever brought them aboard a random ship part, then every AMBIENT_STRAY_GIFT_LOW to _HIGH
+ * walks up to someone of the crew with another, up to AMBIENT_STRAY_GIFTS_MAX. Nothing else here pays anything, and a deckhand drops nothing when killed.
*/
/// Where they were found, open to an offer
@@ -57,8 +59,8 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
* Lets a crew member ask `stray` to come with them: opens a stray to offers, and the flow above
* runs from their talked_to(). Returns TRUE for a stray, FALSE for anyone else.
*/
-/proc/ambient_offer_recruit(mob/living/basic/ambient_npc/stray)
- var/mob/living/basic/ambient_npc/stray/recruit = stray
+/proc/ambient_offer_recruit(mob/living/carbon/human/npc/ambient_npc/stray)
+ var/mob/living/carbon/human/npc/ambient_npc/stray/recruit = stray
if(!istype(recruit) || QDELETED(recruit))
return FALSE
recruit.recruit_open = TRUE
@@ -135,7 +137,7 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
/// The stray on their way aboard, if they still are
/datum/ambient_place/ship/proc/pending()
- var/mob/living/basic/ambient_npc/stray/stray = pending_ref?.resolve()
+ var/mob/living/carbon/human/npc/ambient_npc/stray/stray = pending_ref?.resolve()
if(QDELETED(stray) || stray.stat == DEAD || !stray.is_following())
pending_ref = null
return null
@@ -160,10 +162,10 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
return istype(outpost) ? outpost : null
// Aboard, and nowhere else
-/datum/ambient_place/ship/leash_ok(turf/tile, mob/living/basic/ambient_npc/npc)
+/datum/ambient_place/ship/leash_ok(turf/tile, mob/living/carbon/human/npc/ambient_npc/npc)
return aboard(tile)
-/datum/ambient_place/ship/spot_allowed(turf/tile, mob/living/basic/ambient_npc/npc)
+/datum/ambient_place/ship/spot_allowed(turf/tile, mob/living/carbon/human/npc/ambient_npc/npc)
return aboard(tile)
/datum/ambient_place/ship/describe()
@@ -172,7 +174,7 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
/// The ship is gone: so are the strays who lived on it
/datum/ambient_place/ship/proc/on_ship_deleted(datum/source)
SIGNAL_HANDLER
- for(var/mob/living/basic/ambient_npc/npc as anything in npcs.Copy())
+ for(var/mob/living/carbon/human/npc/ambient_npc/npc as anything in npcs.Copy())
if(!QDELETED(npc) && !npc.ckey)
npc.fade_out(instant = TRUE)
qdel(src)
@@ -186,12 +188,11 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
* (not even cash: a crew's own deckhands are no purse).
* Subtypes set their look, their dialogue section and what they do while wild.
*/
-/mob/living/basic/ambient_npc/stray
+/mob/living/carbon/human/npc/ambient_npc/stray
name = "stranded spacer"
desc = "Someone a long way from anywhere."
death_cash_low = 0
death_cash_high = 0
- rotate_on_lying = TRUE
dialogue_file = AMBIENT_STRINGS_STRAYS
dialogue_section = "stranded"
routine = list(
@@ -216,6 +217,12 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
/// Tries left to walk back aboard, and when the next may start
var/rehome_tries = 0
var/rehome_at = 0
+ /// Rescued from being stranded: they thank the crew with ship parts
+ var/gives_gifts = FALSE
+ /// Gifts handed over since they came aboard, the first one included
+ var/gifts_given = 0
+ /// world.time their next gift is due
+ var/next_gift_at = 0
/// What they do aboard as a deckhand
var/list/deckhand_routine = list(
/datum/ambient_activity/idle = 2,
@@ -228,27 +235,13 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
/datum/ambient_activity/stray_crew = 1,
)
-/**
- * `identity` (from stray_identity()) makes them the same person they were on an earlier visit:
- * list("name", "gender", "outfit", "look").
- */
-/mob/living/basic/ambient_npc/stray/Initialize(mapload, list/identity)
- if(islist(identity))
- if(identity["gender"] == MALE || identity["gender"] == FEMALE)
- random_gender = FALSE
- gender = identity["gender"]
- if(ispath(identity["outfit"], /datum/outfit))
- outfit_choices = null
- outfit = identity["outfit"]
- if(isnum(identity["look"]))
- look_number = identity["look"]
+// An identity from stray_identity(), riding in the spawn order (ambient_build_npc()), makes them the
+// same person they were on an earlier visit: the base takes it (take_identity()).
+/mob/living/carbon/human/npc/ambient_npc/stray/Initialize(mapload, datum/human_npc_order/order)
origin_section = dialogue_section
- . = ..()
- if(islist(identity) && istext(identity["name"]))
- name = identity["name"]
- real_name = name
+ return ..()
-/mob/living/basic/ambient_npc/stray/Destroy()
+/mob/living/carbon/human/npc/ambient_npc/stray/Destroy()
release_pending()
leader_ref = null
ship_ref = null
@@ -256,36 +249,36 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
return ..()
/// Who they are, to make the same person again later
-/mob/living/basic/ambient_npc/stray/proc/stray_identity()
- return list("name" = real_name, "gender" = gender, "outfit" = outfit, "look" = look_number)
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/stray_identity()
+ return ambient_identity()
-/mob/living/basic/ambient_npc/stray/proc/is_wild()
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/is_wild()
return stray_state == STRAY_WILD
-/mob/living/basic/ambient_npc/stray/proc/is_following()
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/is_following()
return stray_state == STRAY_FOLLOWING
-/mob/living/basic/ambient_npc/stray/proc/is_deckhand()
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/is_deckhand()
return stray_state == STRAY_DECKHAND
/// The ship they joined, if it is still there
-/mob/living/basic/ambient_npc/stray/proc/get_ship()
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/get_ship()
var/obj/structure/overmap/ship/ship = ship_ref?.resolve()
return QDELETED(ship) ? null : ship
/// Who they follow, if anyone
-/mob/living/basic/ambient_npc/stray/proc/get_leader()
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/get_leader()
var/mob/living/leader = leader_ref?.resolve()
return QDELETED(leader) ? null : leader
/// Frees their ship's place for someone else, if they were on their way aboard
-/mob/living/basic/ambient_npc/stray/proc/release_pending()
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/release_pending()
var/obj/structure/overmap/ship/ship = get_ship()
var/datum/ambient_place/ship/deck = ship && ambient_ship_place(ship, create = FALSE)
if(deck && deck.pending_ref?.resolve() == src)
deck.pending_ref = null
-/mob/living/basic/ambient_npc/stray/Life(seconds_per_tick = SSMOBS_DT, times_fired)
+/mob/living/carbon/human/npc/ambient_npc/stray/Life(seconds_per_tick = SSMOBS_DT, times_fired)
. = ..()
if(stat != CONSCIOUS || fading || QDELETED(src))
return
@@ -297,12 +290,16 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
lose_leader()
else if(deck.aboard(get_turf(src)))
board(ship)
+ if(STRAY_DECKHAND)
+ if(gives_gifts && gifts_given <= AMBIENT_STRAY_GIFTS_MAX && world.time >= next_gift_at)
+ next_gift_at = world.time + AMBIENT_STRAY_GIFT_RETRY
+ start_activity(new /datum/ambient_activity/stray_crew/gift(src))
if(STRAY_WILD)
if(recruit_open && world.time >= next_look)
next_look = world.time + STRAY_LOOK_INTERVAL
look_for_crew()
-/mob/living/basic/ambient_npc/stray/death(gibbed)
+/mob/living/carbon/human/npc/ambient_npc/stray/death(gibbed)
. = ..()
release_pending()
leader_ref = null
@@ -310,14 +307,14 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
// ----- leash -----
// Following, they go wherever their leader leads that they can cross; aboard, the ship's place keeps them there
-/mob/living/basic/ambient_npc/stray/leash_ok(turf/tile)
+/mob/living/carbon/human/npc/ambient_npc/stray/leash_ok(turf/tile)
if(stray_state == STRAY_FOLLOWING && istype(activity, /datum/ambient_activity/stray_follow))
tile = get_turf(tile)
return !!tile?.can_cross_safely(src)
return ..()
// A deckhand off their ship walks back aboard if they can, a couple of times, before they give up
-/mob/living/basic/ambient_npc/stray/give_up_leash()
+/mob/living/carbon/human/npc/ambient_npc/stray/give_up_leash()
if(stray_state == STRAY_DECKHAND && rehome_tries < STRAY_REHOME_TRIES)
if(world.time < rehome_at)
return
@@ -332,7 +329,7 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
return ..()
// Aboard, where they are now is home
-/mob/living/basic/ambient_npc/stray/pick_activity()
+/mob/living/carbon/human/npc/ambient_npc/stray/pick_activity()
if(stray_state == STRAY_DECKHAND && leash_ok(loc))
home = get_turf(src)
rehome_tries = 0
@@ -340,7 +337,7 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
// ----- talking -----
-/mob/living/basic/ambient_npc/stray/talked_to(mob/living/user)
+/mob/living/carbon/human/npc/ambient_npc/stray/talked_to(mob/living/user)
if(!talk_ready(user))
return
if(!buckled)
@@ -358,7 +355,7 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
INVOKE_ASYNC(src, PROC_REF(crew_menu), user)
/// "Come with us" or "Not now", for `user` of `ship`. Sleeps.
-/mob/living/basic/ambient_npc/stray/proc/offer_menu(mob/living/user, obj/structure/overmap/ship/ship)
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/offer_menu(mob/living/user, obj/structure/overmap/ship/ship)
var/list/choices = list(
"Come with us" = image(icon = 'icons/hud/radial.dmi', icon_state = "radial_yes"),
"Not now" = image(icon = 'icons/hud/radial.dmi', icon_state = "radial_no"),
@@ -374,7 +371,7 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
speak_context("refused", user, force = TRUE)
/// Follow or stay, and at a trader outpost, going their own way: for `user` of their ship. Sleeps.
-/mob/living/basic/ambient_npc/stray/proc/crew_menu(mob/living/user)
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/crew_menu(mob/living/user)
var/list/choices = list()
if(get_leader() == user && istype(activity, /datum/ambient_activity/stray_follow))
choices["Stay here"] = image(icon = 'icons/hud/radial.dmi', icon_state = "guard")
@@ -402,7 +399,7 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
* They agree to join `ship`, and follow `leader` there. Returns TRUE, or FALSE if they can't now
* (not wild, not open to offers, or the ship has no room).
*/
-/mob/living/basic/ambient_npc/stray/proc/accept_offer(mob/living/leader, obj/structure/overmap/ship/ship)
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/accept_offer(mob/living/leader, obj/structure/overmap/ship/ship)
if(stray_state != STRAY_WILD || !recruit_open || !can_act() || QDELETED(ship) || QDELETED(leader))
return FALSE
var/datum/ambient_place/ship/deck = ambient_ship_place(ship)
@@ -411,30 +408,31 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
ship_ref = WEAKREF(ship)
deck.pending_ref = WEAKREF(src)
stray_state = STRAY_FOLLOWING
- // Out through the airlock and across to the ship, whatever lies between
- ADD_TRAIT(src, TRAIT_SPACEWALK, STRAY_TRAIT)
+ // Out through the airlock and across to the ship: their jet harness on, if they wear one
+ ready_for_space(TRUE)
if(!start_follow(leader))
release_pending()
ship_ref = null
leader_ref = null
stray_state = STRAY_WILD
- REMOVE_TRAIT(src, TRAIT_SPACEWALK, STRAY_TRAIT)
+ ready_for_space(FALSE)
return FALSE
exempt_npc_zone()
+ note_rescue_zone()
on_joined(ship)
speak_context("accepted", leader, force = TRUE)
log_game("AMBIENT: [src] agreed to join the [ship.name], asked by [key_name(leader)] at [AREACOORD(src)]")
return TRUE
/// They agreed to join `ship`. Override (the lifeboat stops calling).
-/mob/living/basic/ambient_npc/stray/proc/on_joined(obj/structure/overmap/ship/ship)
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/on_joined(obj/structure/overmap/ship/ship)
return
/**
* They stepped aboard `ship`: a deckhand now, living there under its place, and the site they came
* from is spent. Returns TRUE.
*/
-/mob/living/basic/ambient_npc/stray/proc/board(obj/structure/overmap/ship/ship)
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/board(obj/structure/overmap/ship/ship)
var/datum/ambient_place/ship/deck = ambient_ship_place(ship)
if(!deck)
return FALSE
@@ -447,7 +445,9 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
old_site.data["taken"] = TRUE
old_site.state = AMBIENT_SITE_SPENT
stray_state = STRAY_DECKHAND
+ ready_for_space(FALSE)
ship_ref = WEAKREF(ship)
+ var/mob/living/leader = get_leader()
leader_ref = null
end_activity()
set_place(deck)
@@ -455,21 +455,59 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
leash_bounds = null
routine = deckhand_routine.Copy()
dialogue_section = "deckhand"
- var/list/lines = ambient_dialogue_lines(dialogue_file, origin_section, "aboard")
- if(length(lines))
- say_line(fill_line(pick(lines)))
log_game("AMBIENT: [src] came aboard the [ship.name] as a deckhand")
+ note_rescuers(ship)
+ // Rescued: a thank-you for whoever brought them in, and more now and then
+ var/context = "aboard"
+ if(gives_gifts && !gifts_given)
+ give_gift(leader)
+ context = "rescued"
+ var/list/lines = ambient_dialogue_lines(dialogue_file, origin_section, context)
+ if(length(lines))
+ say_line(fill_line(pick(lines), leader))
return TRUE
+/// Their jet harness on for the crossing to a ship, or off again, if they wear one (as a person works their own)
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/ready_for_space(on)
+ var/obj/item/tank/jetpack/harness = back
+ if(!istype(harness) || harness.on == !!on)
+ return
+ if(on)
+ harness.turn_on(src)
+ else
+ harness.turn_off(src)
+
+/**
+ * Hands `receiver` a random ship part, or sets it down if they are out of reach or their hands are
+ * full, and schedules the next one. Returns the part.
+ */
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/give_gift(mob/living/receiver)
+ var/static/list/part_types = list(
+ /obj/item/ship_parts/combat,
+ /obj/item/ship_parts/science,
+ /obj/item/ship_parts/trade,
+ /obj/item/ship_parts/misc,
+ )
+ var/part_type = pick(part_types)
+ var/obj/item/ship_parts/part = new part_type(drop_location())
+ gifts_given++
+ next_gift_at = world.time + rand(AMBIENT_STRAY_GIFT_LOW, AMBIENT_STRAY_GIFT_HIGH)
+ if(!QDELETED(receiver) && get_dist(src, receiver) <= 2 && receiver.put_in_hands(part))
+ manual_emote("hands [receiver] [part].")
+ else
+ manual_emote("sets down [part].")
+ log_game("AMBIENT: [src] gave [part] ([gifts_given] given) to [receiver ? key_name(receiver) : "nobody"] at [AREACOORD(src)]")
+ return part
+
/// They follow `leader` from now on. Returns the activity, or null.
-/mob/living/basic/ambient_npc/stray/proc/start_follow(mob/living/leader)
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/start_follow(mob/living/leader)
if(QDELETED(leader))
return null
leader_ref = WEAKREF(leader)
return start_activity(new /datum/ambient_activity/stray_follow(src, leader))
/// They stop following whoever it was
-/mob/living/basic/ambient_npc/stray/proc/stop_follow()
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/stop_follow()
leader_ref = null
if(istype(activity, /datum/ambient_activity/stray_follow))
end_activity()
@@ -478,20 +516,25 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
* Their leader is out of reach. A follower on the way to a ship goes back to being wild (and walks
* back to where they were found, or slips away); a deckhand stays where they are.
*/
-/mob/living/basic/ambient_npc/stray/proc/lose_leader()
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/lose_leader()
leader_ref = null
if(stray_state == STRAY_FOLLOWING)
release_pending()
ship_ref = null
stray_state = STRAY_WILD
- REMOVE_TRAIT(src, TRAIT_SPACEWALK, STRAY_TRAIT)
+ ready_for_space(FALSE)
if(istype(activity, /datum/ambient_activity/stray_follow))
end_activity()
speak_context("lost", null, force = TRUE)
/// Let go at a trader outpost by `user`: a goodbye, and they are off
-/mob/living/basic/ambient_npc/stray/proc/dismiss(mob/living/user)
- speak_context("dismissed", user, force = TRUE)
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/dismiss(mob/living/user)
+ // Rescued and brought somewhere safe: their crew is owed for it (rescue_reputation.dm)
+ var/list/lines = claim_rescue(user) ? ambient_dialogue_lines(dialogue_file, origin_section, "delivered") : null
+ if(length(lines))
+ say_line(fill_line(pick(lines), user))
+ else
+ speak_context("dismissed", user, force = TRUE)
var/obj/structure/overmap/ship/ship = get_ship()
log_game("AMBIENT: [src] left the [ship?.name || "ship"], let go by [key_name(user)]")
start_activity(new /datum/ambient_activity/leave(src, null, 3 SECONDS))
@@ -499,7 +542,7 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
// ----- reactions -----
// Hit by the crew they are following, they stop following
-/mob/living/basic/ambient_npc/stray/react_attacked(atom/attacker)
+/mob/living/carbon/human/npc/ambient_npc/stray/react_attacked(atom/attacker)
var/was_ready = LAZYACCESS(reaction_cooldowns, "attacked") <= world.time
. = ..()
if(!was_ready || stat != CONSCIOUS || stray_state != STRAY_FOLLOWING)
@@ -511,7 +554,7 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
// ----- waving crew down -----
/// Waves down a crew member they can see and have not greeted yet
-/mob/living/basic/ambient_npc/stray/proc/look_for_crew()
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/look_for_crew()
if(!can_act() || activity?.priority >= AMBIENT_PRIORITY_REACTION)
return FALSE
var/turf/here = get_turf(src)
@@ -568,7 +611,7 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
return FALSE
/datum/ambient_activity/stray_follow/act(seconds)
- var/mob/living/basic/ambient_npc/stray/stray = doer
+ var/mob/living/carbon/human/npc/ambient_npc/stray/stray = doer
var/mob/living/leader = anchor()
if(!in_reach(leader))
if(!lost_since)
@@ -783,7 +826,7 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
var/spoke = FALSE
/datum/ambient_activity/stray_crew/setup()
- var/mob/living/basic/ambient_npc/stray/stray = doer
+ var/mob/living/carbon/human/npc/ambient_npc/stray/stray = doer
var/obj/structure/overmap/ship/ship = istype(stray) ? stray.get_ship() : null
var/turf/here = get_turf(doer)
if(!ship || !here)
@@ -826,6 +869,26 @@ GLOBAL_LIST_EMPTY(ambient_ship_places)
ends_at = min(ends_at, world.time + 6 SECONDS)
return AMBIENT_STEP_CONTINUE
+/// Walking up to someone of the crew with a ship part for them
+/datum/ambient_activity/stray_crew/gift
+ name = "bringing the crew something"
+ duration_low = 40 SECONDS
+ duration_high = 40 SECONDS
+
+/datum/ambient_activity/stray_crew/gift/act(seconds)
+ var/mob/living/person = anchor()
+ var/mob/living/carbon/human/npc/ambient_npc/stray/stray = doer
+ if(!istype(stray) || !person || person.stat != CONSCIOUS || get_dist(doer, person) > 1)
+ return AMBIENT_STEP_DONE
+ if(!doer.buckled)
+ doer.face_atom(person)
+ if(!spoke)
+ spoke = TRUE
+ stray.give_gift(person)
+ doer.speak_context("gift", person, force = TRUE)
+ ends_at = min(ends_at, world.time + 6 SECONDS)
+ return AMBIENT_STEP_CONTINUE
+
#undef STRAY_WILD
#undef STRAY_FOLLOWING
#undef STRAY_DECKHAND
diff --git a/voidcrew/modules/ambient_npcs/rescue_reputation.dm b/voidcrew/modules/ambient_npcs/rescue_reputation.dm
new file mode 100644
index 00000000000..48ece9cb7b7
--- /dev/null
+++ b/voidcrew/modules/ambient_npcs/rescue_reputation.dm
@@ -0,0 +1,83 @@
+/**
+ * # Rescued strays raise the crew's reputation when let go at an outpost
+ *
+ * A stray rescued from being stranded (`gives_gifts`: the crashed pod and lifeboat survivors) remembers
+ * the overmap zone they were found in, and the ship and crew that took them aboard. Let go at a trader
+ * outpost by that ship's crew ("Time to go" in crew_menu(), which runs dismiss()), the rescuing crew gets
+ * reputation through claim_zone_work(): green pays as easy work (1), yellow as medium (2), red as hard
+ * (3), under the same zone ceilings as every other job.
+ *
+ * Abuse limits:
+ * - Once per person: `rescue_paid`, plus a one-off receipt key on the crew record.
+ * - Only strays who came from a real stranded site (their place was a site when they agreed to come),
+ * so a stray made outside the site flow (admin spawn, tests) pays nothing.
+ * - The zone is their site's (where the pod or lifeboat came down), not where they stand, and is fixed once
+ * they come aboard.
+ * - Only the crew that took them aboard is paid, and only while the ship they live on is still that
+ * crew's. Nobody else can let a deckhand go (crew_menu() checks the ship).
+ * - Living and able to walk off only (can_act()); a body pays nothing. Never while a player controls them.
+ */
+
+/// Hands out one-off receipt keys for rescues
+GLOBAL_VAR_INIT(ambient_rescue_serial, 0)
+
+/mob/living/carbon/human/npc/ambient_npc/stray
+ /// The overmap zone (ZONE_GREEN/YELLOW/RED) they were found in, or null if they were never rescued
+ var/rescue_zone
+ /// The ship that took them aboard
+ var/datum/weakref/rescue_ship_ref
+ /// The crew record of that ship when they came aboard
+ var/datum/weakref/rescue_crew_ref
+ /// The receipt key their drop-off is claimed under
+ var/rescue_receipt
+ /// Their drop-off has paid out (or was spent)
+ var/rescue_paid = FALSE
+
+/// The zone of the site they were found at: its centre's overmap tile now (a lifeboat drifts), else the band it was
+/// made in. Never where they stand, so dragging them off somewhere worse before asking them along changes nothing.
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/rescue_site_zone(datum/ambient_place/site/site)
+ var/zone = get_zone_type_for_player_turf(site.center)
+ if(!(zone in list(ZONE_GREEN, ZONE_YELLOW, ZONE_RED)))
+ zone = site.band
+ return (zone in list(ZONE_GREEN, ZONE_YELLOW, ZONE_RED)) ? zone : null
+
+/// They agreed to come along: a rescued stray from a stranded site remembers the zone they were found in
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/note_rescue_zone()
+ var/datum/ambient_place/site/site = place
+ if(!gives_gifts || rescue_receipt || !istype(site))
+ return
+ rescue_zone = rescue_site_zone(site)
+
+/// They came aboard `ship`: the ship and its crew are who rescued them
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/note_rescuers(obj/structure/overmap/ship/ship)
+ if(!gives_gifts || !rescue_zone || rescue_receipt || QDELETED(ship))
+ return
+ var/datum/voidcrew_crew_record/crew = ship.get_crew_record()
+ if(QDELETED(crew))
+ return
+ rescue_ship_ref = WEAKREF(ship)
+ rescue_crew_ref = WEAKREF(crew)
+ rescue_receipt = "rescue:[++GLOB.ambient_rescue_serial]"
+
+/**
+ * Let go by `user` at the trader outpost their ship is docked at: the crew that rescued them gets
+ * reputation for the zone they were found in. Returns the reputation added (0 for none). Never yields.
+ */
+/mob/living/carbon/human/npc/ambient_npc/stray/proc/claim_rescue(mob/living/user)
+ if(rescue_paid || !rescue_receipt || !rescue_zone || ckey || stat != CONSCIOUS || !is_deckhand())
+ return 0
+ var/obj/structure/overmap/ship/ship = get_ship()
+ if(!ship || rescue_ship_ref?.resolve() != ship)
+ return 0
+ var/datum/ambient_place/ship/deck = place
+ if(!istype(deck) || !deck.docked_outpost())
+ return 0
+ var/datum/voidcrew_crew_record/crew = rescue_crew_ref?.resolve()
+ if(QDELETED(crew) || ship.get_crew_record() != crew)
+ return 0
+ rescue_paid = TRUE
+ var/permission_before = crew.get_zone_permission()
+ var/gain = crew.claim_zone_work(rescue_zone, rescue_zone, rescue_receipt)
+ record_zone_work_rows(ship, type, rescue_zone, zone_work_reward(rescue_zone), gain, permission_before, crew.get_zone_permission(), user, list("rescue" = real_name))
+ log_game("AMBIENT: [src], rescued in zone [rescue_zone], was let go at an outpost by [key_name(user)] of the [ship.name]: +[gain] reputation")
+ return gain
diff --git a/voidcrew/modules/ambient_npcs/stranded.dm b/voidcrew/modules/ambient_npcs/stranded.dm
index bb0efe1d8a7..c8b908ee16d 100644
--- a/voidcrew/modules/ambient_npcs/stranded.dm
+++ b/voidcrew/modules/ambient_npcs/stranded.dm
@@ -31,7 +31,7 @@
)
chance = 5
spot_room = 2
- npc_type = /mob/living/basic/ambient_npc/stray/stranded
+ npc_type = /mob/living/carbon/human/npc/ambient_npc/stray/stranded
// Oceanic planets see a few more pods come down (spec 4.1)
/datum/ambient_site_kind/stranded/chance_on(datum/ambient_planet/record)
@@ -44,10 +44,9 @@
return FALSE
var/atom/fire = build_camp(site)
var/turf/where = (fire && ambient_free_turf_near(get_turf(fire), 1)) || ambient_free_turf_near(site.center, 2) || site.center
- var/mob/living/basic/ambient_npc/stray/stranded/npc = new npc_type(where, site.data["identity"])
- npc.set_place(site)
- npc.scale_health(site.health_multiplier())
- site.state = AMBIENT_SITE_ACTIVE
+ var/mob/living/carbon/human/npc/ambient_npc/stray/stranded/npc = site.spawn_npc(npc_type, where, site.data["identity"])
+ if(!npc)
+ return FALSE
site.data["identity"] = npc.stray_identity()
ambient_offer_recruit(npc)
return TRUE
@@ -158,15 +157,13 @@
// THE STRANDED SURVIVOR
// =========================================================================
-/mob/living/basic/ambient_npc/stray/stranded
+/mob/living/carbon/human/npc/ambient_npc/stray/stranded
name = "stranded spacer"
desc = "Sunburnt, grubby and very glad to see a ship."
- outfit_choices = list(
- /datum/outfit/ambient_stranded,
- /datum/outfit/ambient_stranded/hauler,
- /datum/outfit/ambient_stranded/engineer,
- )
+ outfit = null
+ npc_outfit_table = /datum/human_npc_outfit_table/ambient_stranded
dialogue_section = "stranded"
+ gives_gifts = TRUE
routine = list(
/datum/ambient_activity/stray_fire = 3,
/datum/ambient_activity/stray_flare = 1,
@@ -194,6 +191,20 @@
uniform = /obj/item/clothing/under/rank/engineering/engineer
suit = null
+/// Further out, an armour vest pulled off the wreck
+/datum/outfit/ambient_stranded/vest
+ name = "Stranded Spacer in a vest"
+ suit = /obj/item/clothing/suit/armor/vest
+
+/datum/outfit/ambient_stranded/hauler/vest
+ name = "Stranded Hauler in a vest"
+ suit = /obj/item/clothing/suit/armor/vest
+
+/// The stranded by band (AM-1)
+/datum/human_npc_outfit_table/ambient_stranded
+ green = list(/datum/outfit/ambient_stranded = 1, /datum/outfit/ambient_stranded/hauler = 1, /datum/outfit/ambient_stranded/engineer = 1)
+ red = list(/datum/outfit/ambient_stranded/vest = 1, /datum/outfit/ambient_stranded/hauler/vest = 1)
+
// =========================================================================
// WHAT THEY DO
// =========================================================================
diff --git a/voidcrew/modules/ambient_npcs/stranded_lifeboat.dm b/voidcrew/modules/ambient_npcs/stranded_lifeboat.dm
index 24bf0a15020..35909af1c6d 100644
--- a/voidcrew/modules/ambient_npcs/stranded_lifeboat.dm
+++ b/voidcrew/modules/ambient_npcs/stranded_lifeboat.dm
@@ -105,7 +105,7 @@
quiet_timer = null
clear_fleet_waypoint()
QDEL_NULL(radio)
- var/mob/living/basic/ambient_npc/stray/lifeboat/survivor = survivor_ref?.resolve()
+ var/mob/living/carbon/human/npc/ambient_npc/stray/lifeboat/survivor = survivor_ref?.resolve()
if(survivor)
survivor.lifeboat_ref = null
survivor_ref = null
@@ -143,7 +143,7 @@
/// Its survivor on their landmark, unless they are already out
/obj/structure/overmap/space_ruin/ambient_lifeboat/proc/place_survivor()
- var/mob/living/basic/ambient_npc/stray/lifeboat/survivor = survivor_ref?.resolve()
+ var/mob/living/carbon/human/npc/ambient_npc/stray/lifeboat/survivor = survivor_ref?.resolve()
if(!QDELETED(survivor) && survivor.stat != DEAD)
return survivor
var/turf/spot = survivor_spot()
@@ -167,7 +167,9 @@
/// Its survivor at `spot`: the same person as before, leashed to the lifeboat until a crew takes them
/obj/structure/overmap/space_ruin/ambient_lifeboat/proc/spawn_survivor(turf/spot)
- var/mob/living/basic/ambient_npc/stray/lifeboat/survivor = new(spot, survivor_identity)
+ var/mob/living/carbon/human/npc/ambient_npc/stray/lifeboat/survivor = ambient_build_npc(/mob/living/carbon/human/npc/ambient_npc/stray/lifeboat, spot, null, survivor_identity)
+ if(QDELETED(survivor))
+ return null
survivor_identity = survivor.stray_identity()
survivor.lifeboat_ref = WEAKREF(src)
survivor.leash_bounds = interior_bounds()
@@ -247,11 +249,12 @@
// THE SURVIVOR
// =========================================================================
-/mob/living/basic/ambient_npc/stray/lifeboat
+/mob/living/carbon/human/npc/ambient_npc/stray/lifeboat
name = "lifeboat survivor"
desc = "Pale, thin and still in an emergency softsuit."
outfit = /datum/outfit/ambient_lifeboat
dialogue_section = "lifeboat"
+ gives_gifts = TRUE
routine = list(
/datum/ambient_activity/stray_rest = 2,
/datum/ambient_activity/lifeboat_canister = 1,
@@ -263,17 +266,12 @@
/// The lifeboat they were found on
var/datum/weakref/lifeboat_ref
-/mob/living/basic/ambient_npc/stray/lifeboat/Initialize(mapload, list/identity)
- . = ..()
- // Their softsuit: across open space to a ship, and about a ship's hull
- ADD_TRAIT(src, TRAIT_SPACEWALK, AMBIENT_NPC_TRAIT)
-
-/mob/living/basic/ambient_npc/stray/lifeboat/Destroy()
+/mob/living/carbon/human/npc/ambient_npc/stray/lifeboat/Destroy()
lifeboat_ref = null
return ..()
// Killed where they were found, they are not there again on the next load
-/mob/living/basic/ambient_npc/stray/lifeboat/death(gibbed)
+/mob/living/carbon/human/npc/ambient_npc/stray/lifeboat/death(gibbed)
var/was_alive = stat != DEAD
. = ..()
if(!was_alive || !is_wild())
@@ -282,16 +280,20 @@
if(!QDELETED(lifeboat))
lifeboat.survivor_died()
-/mob/living/basic/ambient_npc/stray/lifeboat/on_joined(obj/structure/overmap/ship/ship)
+/mob/living/carbon/human/npc/ambient_npc/stray/lifeboat/on_joined(obj/structure/overmap/ship/ship)
var/obj/structure/overmap/space_ruin/ambient_lifeboat/lifeboat = lifeboat_ref?.resolve()
if(!QDELETED(lifeboat))
lifeboat.survivor_joined()
-/// A freighter hand in the softsuit from the lifeboat's locker
+/// A freighter hand in the softsuit from the lifeboat's locker, with its helmet and a jet harness of air: enough to cross to a ship
/datum/outfit/ambient_lifeboat
name = "Lifeboat Survivor"
uniform = /obj/item/clothing/under/color/grey
suit = /obj/item/clothing/suit/space/fragile
+ head = /obj/item/clothing/head/helmet/space/fragile
+ mask = /obj/item/clothing/mask/breath
+ back = /obj/item/tank/jetpack/oxygen/harness
+ internals_slot = ITEM_SLOT_BACK
shoes = /obj/item/clothing/shoes/sneakers/black
/// Tapping the gauge on the air canister
diff --git a/voidcrew/modules/ambient_npcs/strings/strays.json b/voidcrew/modules/ambient_npcs/strings/strays.json
index 04f410e5048..fc60875d3e8 100644
--- a/voidcrew/modules/ambient_npcs/strings/strays.json
+++ b/voidcrew/modules/ambient_npcs/strings/strays.json
@@ -31,6 +31,14 @@
"Real walls. I forgot what walls looked like.",
"It smells like people in here. I missed that."
],
+ "rescued": [
+ "Real walls. I forgot what walls looked like. Here, {other}, I pulled this out of the pod. It's yours.",
+ "Thank you. I mean it. Take this, it's the only thing off the pod worth keeping."
+ ],
+ "delivered": [
+ "Solid ground. I'll tell them who pulled me out of that pod.",
+ "Thanks, {other}. They'll hear your crew's name from me."
+ ],
"fire": [
"Don't you go out on me.",
"Last of the dry stuff."
@@ -81,6 +89,14 @@
"Gravity. Real air. Thank you.",
"I'm never getting in one of those things again."
],
+ "rescued": [
+ "Gravity. Real air. Here, {other}, take this. It came off the lifeboat.",
+ "I owe you. Start with this."
+ ],
+ "delivered": [
+ "A real dock. Thank you, {other}.",
+ "Everyone here's going to hear who picked up that lifeboat."
+ ],
"canister": [
"Still a third. Still a third.",
"Come on, hold."
@@ -167,6 +183,11 @@
"{other}, where are we off to next?",
"You look tired, {other}."
],
+ "gift": [
+ "{other}. Found this behind a panel. Figured you'd want it.",
+ "Here, {other}. I fixed it up in my spare time.",
+ "For you, {other}. Still paying off that rescue."
+ ],
"wash": [
"Hot water. Unbelievable."
],
diff --git a/voidcrew/modules/bounties/bounty_activities.dm b/voidcrew/modules/bounties/bounty_activities.dm
index 894fd6f1026..48da60a175a 100644
--- a/voidcrew/modules/bounties/bounty_activities.dm
+++ b/voidcrew/modules/bounties/bounty_activities.dm
@@ -4,13 +4,14 @@
* Owner: P3 AI. Do not edit this file outside P3.
*
* What it owns: the idle activities (spec section 3), each with real objects:
- * - bar: a stool or chair beside a table or counter, a drink in hand, sipped now and then;
+ * - bar: a stool or chair beside a table or counter (sat on: a real buckle), a real glass in hand,
+ * drunk from now and then (a real gulp: the drink goes into them, and they stop once they are tipsy);
* - chat: turns at talking with a companion (or whoever is at hand);
* - trade: at a trader's counter or a vending machine, haggling out loud;
* - explore: three to five things on the site to walk up to and look over;
* - loot: lockers and crates (zone loot first) opened, gone through and shut again;
* - camp: a small camp made once (a fire, or a fixed lamp where a fire won't burn; a mattress; a
- * crate), sat at, with errands;
+ * crate), sat at on the ground (tg's resting), with errands;
* - blend: the routine a trader-outpost fugitive and every one of its decoys share (AR-C6/C7): the
* same steps, weights, speed and lines, so nothing in how they act gives the fugitive away.
* An activity scans for what it uses once, when it starts (or a blend step starts), never per tick.
@@ -18,14 +19,14 @@
* they could not walk to is not picked again while the activity lasts, and at a trader outpost the
* blend routine only picks spots on the public floor (L5).
* It runs while they are calm; a flight or a fight puts it away, and it is set up again after.
- * The decoy's AI (/mob/living/basic/bounty_criminal/decoy: blend, and getting out of the way when
+ * The decoy's AI (/mob/living/carbon/human/npc/bounty_criminal/decoy: blend, and getting out of the way when
* hit) is here too; what a decoy does when accused is P6's.
*
* The shared vars are declared in bounty_types.dm and nowhere else; a var only P3 uses has an
* `ai_` prefix.
*/
-/mob/living/basic/bounty_criminal
+/mob/living/carbon/human/npc/bounty_criminal
/// What they are doing now (/datum/bounty_activity), if anything
var/datum/bounty_activity/ai_activity
/// The kind start_activity() set (BOUNTY_ACTIVITY_*), kept so they go back to it once calm
@@ -34,17 +35,17 @@
var/datum/weakref/ai_activity_anchor
/// world.time before which an activity that could not be set up is not tried again
var/ai_activity_retry_at = 0
- /// The drink in their hand, held in their contents
+ /// The glass in their hand at the bar
var/obj/item/reagent_containers/cup/glass/drinkingglass/ai_drink
/// Weakref to the seat they sat down on, so only that one is ever left
var/datum/weakref/ai_seat_ref
- /// Sitting on the floor
+ /// Sitting on the floor: lying down by their own choice (tg's resting), which they get up from themselves
var/ai_crouching = FALSE
/// Weakrefs to the camp they made: the fire or lamp, the mattress, the crate
var/list/ai_camp
/// The mattress and crate were made; only the fire is ever made again
var/ai_camp_made = FALSE
- /// Glasses left on tables at the bar; past BOUNTY_BAR_GLASSES_MAX the glass just goes (M4)
+ /// Glasses left on tables at the bar; past BOUNTY_BAR_GLASSES_MAX a finished glass just goes (M4)
var/ai_glasses_left = 0
/// Spots they could not walk to (turf = TRUE), not picked again until the activity changes (L5)
var/list/ai_failed_spots
@@ -57,7 +58,7 @@
* null to find one nearby. BOUNTY_ACTIVITY_BLEND also makes them a blended patron. Returns the
* activity, or null if nothing could be set up (they stand around and try again later).
*/
-/mob/living/basic/bounty_criminal/proc/start_activity(kind, atom/anchor)
+/mob/living/carbon/human/npc/bounty_criminal/proc/start_activity(kind, atom/anchor)
ai_suspend_activity()
ai_activity_kind = kind
ai_activity_anchor = anchor ? WEAKREF(anchor) : null
@@ -73,7 +74,7 @@
return ai_resume_activity()
/// Their activity, set up again if it was put away. Falls back to standing around when it can't be set up.
-/mob/living/basic/bounty_criminal/proc/ai_resume_activity()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_resume_activity()
if(ai_activity)
return ai_activity
if(!ai_activity_kind || world.time < ai_activity_retry_at)
@@ -92,7 +93,7 @@
return activity
/// The activity datum for `kind`
-/mob/living/basic/bounty_criminal/proc/ai_activity_type(kind)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_activity_type(kind)
switch(kind)
if(BOUNTY_ACTIVITY_BAR)
return /datum/bounty_activity/bar
@@ -111,13 +112,13 @@
return /datum/bounty_activity/loiter
/// A meek criminal never loots: it looks around instead
-/mob/living/basic/bounty_criminal/meek/ai_activity_type(kind)
+/mob/living/carbon/human/npc/bounty_criminal/meek/ai_activity_type(kind)
if(kind == BOUNTY_ACTIVITY_LOOT)
return /datum/bounty_activity/explore
return ..()
/// Puts their activity away (drink down, up from the seat), keeping its kind to go back to
-/mob/living/basic/bounty_criminal/proc/ai_suspend_activity()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_suspend_activity()
if(!ai_activity)
return
var/datum/bounty_activity/old = ai_activity
@@ -126,13 +127,13 @@
qdel(old)
/// Stops their activity for good
-/mob/living/basic/bounty_criminal/proc/ai_end_activity()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_end_activity()
ai_activity_kind = null
ai_activity_anchor = null
ai_suspend_activity()
/// One step of their activity, where they stand: arriving the first time, then its business. Returns BOUNTY_STEP_*.
-/mob/living/basic/bounty_criminal/proc/ai_activity_step(seconds)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_activity_step(seconds)
if(!ai_activity)
return BOUNTY_STEP_DONE
if(!ai_activity.arrived)
@@ -142,8 +143,8 @@
// ===== BLENDING IN =====
-/// A patron now: moves like every other, can't be pulled, and shots aimed at someone else pass through them
-/mob/living/basic/bounty_criminal/proc/ai_start_blend()
+/// A patron now: walks like every other patron, and does what every other patron does (the blend routine)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_start_blend()
blended = TRUE
ai_set_pace(BOUNTY_CALM_SPEED)
@@ -152,7 +153,7 @@
* (the component's stop_blending(): pulls, containers and the turrets' faction back to normal), so
* `blended` and the act never disagree (C1).
*/
-/mob/living/basic/bounty_criminal/proc/ai_end_blend()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_end_blend()
var/datum/component/bounty_outpost_blend/act = GetComponent(/datum/component/bounty_outpost_blend)
act?.stop_blending()
blended = FALSE
@@ -161,8 +162,8 @@
// ===== SEATS, DRINKS, SPOTS =====
-/// Sits on `seat` from its tile
-/mob/living/basic/bounty_criminal/proc/ai_sit_on(obj/structure/chair/seat)
+/// Sits on `seat` from its tile: buckled to it, as anyone sitting down is
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_sit_on(obj/structure/chair/seat)
if(QDELETED(seat))
return FALSE
if(buckled == seat)
@@ -175,68 +176,98 @@
ai_seat_ref = WEAKREF(seat)
return TRUE
-/// Sits down on the floor
-/mob/living/basic/bounty_criminal/proc/ai_crouch()
- if(ai_crouching || buckled)
+/// Sits down on the floor: tg's resting, as a player lies down
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_crouch()
+ if(ai_crouching || buckled || resting)
return
ai_crouching = TRUE
- add_offsets(BOUNTY_AI_TRAIT, y_add = -4)
+ set_resting(TRUE, silent = TRUE)
-/// Up from their seat or the floor. Only a seat they sat on themselves: never out of a bed or a chair someone put them in.
-/mob/living/basic/bounty_criminal/proc/ai_stand_up()
+/// Up from their seat or the floor. Only a seat they sat on themselves, and only the floor they lay down on themselves: never out of a bed or a chair someone put them in.
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_stand_up()
if(ai_crouching)
ai_crouching = FALSE
- remove_offsets(BOUNTY_AI_TRAIT)
+ if(resting)
+ set_resting(FALSE, silent = TRUE)
var/obj/structure/chair/seat = ai_seat_ref?.resolve()
ai_seat_ref = null
if(seat && buckled == seat)
seat.unbuckle_mob(src, force = TRUE)
-/// A drink in hand, poured for the occasion
-/mob/living/basic/bounty_criminal/proc/ai_take_drink()
- if(!QDELETED(ai_drink))
+/// A glass of something in hand, poured for them at the bar: a real drinking glass in a free hand. Null with no hand free.
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_take_drink()
+ if(!QDELETED(ai_drink) && is_holding(ai_drink))
return ai_drink
- var/obj/item/reagent_containers/cup/glass/drinkingglass/glass = new(src)
- glass.reagents.add_reagent(pick(/datum/reagent/consumable/ethanol/beer, /datum/reagent/consumable/ethanol/whiskey, /datum/reagent/consumable/ethanol/rum), 25)
- ai_drink = glass
- ai_hand = bounty_ai_update_held(src, ai_hand, glass)
- return glass
+ ai_drink = bounty_ai_pour_drink(src)
+ return ai_drink
-/// A sip; an empty glass gets filled again after a while
-/mob/living/basic/bounty_criminal/proc/ai_sip()
- if(QDELETED(ai_drink))
- return FALSE
- if(!ai_drink.reagents.total_volume)
- ai_drink.reagents.add_reagent(/datum/reagent/consumable/ethanol/beer, 25)
- visible_message(span_notice("[src] gets another drink."), vision_distance = 5)
- else
- ai_drink.reagents.remove_all(5)
- visible_message(span_notice("[src] takes a sip from [p_their()] glass."), vision_distance = 5)
- playsound(src, 'sound/items/drink.ogg', 20, TRUE, -4)
- ai_hand = bounty_ai_update_held(src, ai_hand, ai_drink)
- return TRUE
+/// A gulp from their glass, a real one (the drink goes into them); an empty glass gets filled again after a while. Tipsy, they only nurse it.
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_sip()
+ return bounty_ai_sip(src, ai_drink)
/**
* Sets the drink down on `table` if it is right there (on their side of any glass), up to
* BOUNTY_BAR_GLASSES_MAX glasses (M4); otherwise, or with no table, it goes.
*/
-/mob/living/basic/bounty_criminal/proc/ai_put_drink_down(obj/structure/table/table)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_put_drink_down(obj/structure/table/table)
var/obj/item/glass = ai_drink
ai_drink = null
- ai_hand = bounty_ai_update_held(src, ai_hand, null)
if(QDELETED(glass))
return
- if(stat == CONSCIOUS && ai_glasses_left < BOUNTY_BAR_GLASSES_MAX && !QDELETED(table) && isturf(table.loc) && isturf(loc) && Adjacent(table))
+ if(stat == CONSCIOUS && ai_glasses_left < BOUNTY_BAR_GLASSES_MAX && bounty_ai_set_glass_down(src, glass, table))
ai_glasses_left++
- glass.forceMove(table.loc)
- glass.pixel_x = rand(-6, 6)
- glass.pixel_y = rand(0, 6)
- visible_message(span_notice("[src] puts [glass] down on [table]."), vision_distance = 5)
return
qdel(glass)
+/// The drinks a bar patron is poured. The first glass is any of these; another is a beer.
+GLOBAL_LIST_INIT(bounty_bar_drinks, list(
+ /datum/reagent/consumable/ethanol/beer,
+ /datum/reagent/consumable/ethanol/whiskey,
+ /datum/reagent/consumable/ethanol/rum,
+))
+
+/// A fresh glass of something poured into a free hand of `drinker` (a criminal or a companion). Returns it, or null with no hand free.
+/proc/bounty_ai_pour_drink(mob/living/carbon/human/drinker)
+ if(QDELETED(drinker) || !length(drinker.get_empty_held_indexes()))
+ return null
+ var/obj/item/reagent_containers/cup/glass/drinkingglass/glass = new(drinker.drop_location())
+ glass.reagents.add_reagent(pick(GLOB.bounty_bar_drinks), 25)
+ if(!drinker.put_in_hands(glass))
+ qdel(glass)
+ return null
+ return glass
+
+/**
+ * A gulp from `glass`: the glass's own drink proc on `drinker` themselves, as a player drinking does, so
+ * the drink goes into them (and its alcohol is theirs to deal with). Tipsy (BOUNTY_BAR_SOBER_LIMIT),
+ * they only nurse it. An empty glass gets another beer.
+ */
+/proc/bounty_ai_sip(mob/living/carbon/human/drinker, obj/item/reagent_containers/cup/glass/glass)
+ if(QDELETED(glass) || !drinker.is_holding(glass) || drinker.stat != CONSCIOUS)
+ return FALSE
+ if(!glass.reagents.total_volume)
+ glass.reagents.add_reagent(/datum/reagent/consumable/ethanol/beer, 25)
+ drinker.visible_message(span_notice("[drinker] gets another drink."), vision_distance = 5)
+ return TRUE
+ if(drinker.get_drunk_amount() >= BOUNTY_BAR_SOBER_LIMIT)
+ return FALSE
+ drinker.visible_message(span_notice("[drinker] takes a sip from [drinker.p_their()] glass."), vision_distance = 5)
+ glass.attack(drinker, drinker)
+ return TRUE
+
+/// Sets `glass` down on `table` from right beside it (on their side of any window), as anyone puts a glass down. Returns TRUE if it is on the table.
+/proc/bounty_ai_set_glass_down(mob/living/carbon/human/drinker, obj/item/glass, obj/structure/table/table)
+ if(QDELETED(table) || !isturf(table.loc) || !isturf(drinker.loc) || !drinker.Adjacent(table) || !drinker.is_holding(glass))
+ return FALSE
+ if(!drinker.transferItemToLoc(glass, table.loc))
+ return FALSE
+ glass.pixel_x = rand(-6, 6)
+ glass.pixel_y = rand(0, 6)
+ drinker.visible_message(span_notice("[drinker] puts [glass] down on [table]."), vision_distance = 5)
+ return TRUE
+
/// A floor tile they can stand on: not space, lava or a chasm, free, on their site
-/mob/living/basic/bounty_criminal/proc/ai_standable(turf/tile)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_standable(turf/tile)
if(!isopenturf(tile) || isspaceturf(tile) || isgroundlessturf(tile) || islava(tile) || ischasm(tile))
return FALSE
if(tile != loc && tile.is_blocked_turf(source_atom = src))
@@ -244,13 +275,13 @@
return leash_ok(tile)
/// Whether an activity may send them to `tile`: not a spot they failed to reach, and on the floor it is kept to (L5)
-/mob/living/basic/bounty_criminal/proc/ai_spot_allowed(turf/tile)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_spot_allowed(turf/tile)
if(LAZYACCESS(ai_failed_spots, tile))
return FALSE
return !ai_allowed_floor || ai_allowed_floor[tile]
/// Remembers `tile` as somewhere they could not walk to, for as long as the activity lasts (a few at most)
-/mob/living/basic/bounty_criminal/proc/ai_spot_failed(turf/tile)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_spot_failed(turf/tile)
if(!isturf(tile))
return
LAZYSET(ai_failed_spots, tile, TRUE)
@@ -262,7 +293,7 @@
* Right beside it (distance 1), nothing may stand between the tile and the thing (Adjacent(): no
* wall, glass or rail), since they will use it from there.
*/
-/mob/living/basic/bounty_criminal/proc/ai_free_tile_beside(atom/thing, distance = 1)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_free_tile_beside(atom/thing, distance = 1)
var/turf/center = get_turf(thing)
if(!center)
return null
@@ -280,7 +311,7 @@
return best
/// A random free tile within `radius` of `center`, in the same area, or null
-/mob/living/basic/bounty_criminal/proc/ai_random_tile_near(turf/center, radius)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_random_tile_near(turf/center, radius)
if(!center)
return null
var/area/here = get_area(src)
@@ -291,7 +322,7 @@
return null
/// A table beside `thing`, or null
-/mob/living/basic/bounty_criminal/proc/ai_table_beside(atom/thing)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_table_beside(atom/thing)
var/turf/center = get_turf(thing)
if(!center)
return null
@@ -305,7 +336,7 @@
* Whether they could sit on `seat`: loose on the floor, nobody on it, on their site. Stools (bar
* stools too) have can_buckle off for people; they are sat on with a forced buckle all the same.
*/
-/mob/living/basic/bounty_criminal/proc/ai_seat_usable(obj/structure/chair/seat)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_seat_usable(obj/structure/chair/seat)
if(QDELETED(seat) || !isturf(seat.loc) || istype(seat, /obj/structure/chair/e_chair))
return FALSE
if(seat.has_buckled_mobs() && !(src in seat.buckled_mobs))
@@ -316,7 +347,7 @@
return leash_ok(seat.loc) && (seat.loc == loc || ai_spot_allowed(seat.loc))
/// The nearest seat within `range` of `near` they could sit on, beside a table if `needs_table`
-/mob/living/basic/bounty_criminal/proc/ai_find_seat(atom/near, range = BOUNTY_ACTIVITY_RANGE, needs_table = TRUE)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_find_seat(atom/near, range = BOUNTY_ACTIVITY_RANGE, needs_table = TRUE)
var/turf/center = get_turf(near) || get_turf(src)
if(!center)
return null
@@ -332,7 +363,7 @@
return best
/// The nearest table within `range` of `near` with room to stand at, or null
-/mob/living/basic/bounty_criminal/proc/ai_find_table(atom/near, range = BOUNTY_ACTIVITY_RANGE)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_find_table(atom/near, range = BOUNTY_ACTIVITY_RANGE)
var/turf/center = get_turf(near) || get_turf(src)
if(!center)
return null
@@ -348,7 +379,7 @@
return best
/// The nearest trader or vending machine within `range`: somewhere to look at goods and haggle
-/mob/living/basic/bounty_criminal/proc/ai_find_stall(range = BOUNTY_ACTIVITY_RANGE)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_find_stall(range = BOUNTY_ACTIVITY_RANGE)
var/turf/center = get_turf(src)
if(!center)
return null
@@ -370,22 +401,22 @@
* Someone to talk to within `range`: their own companions first; otherwise someone at hand who is
* awake and not played (a patron, an outpost regular, another blended patron, one of their own faction).
*/
-/mob/living/basic/bounty_criminal/proc/ai_find_chat_partner(range = BOUNTY_ACTIVITY_RANGE, patrons_only = FALSE)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_find_chat_partner(range = BOUNTY_ACTIVITY_RANGE, patrons_only = FALSE)
var/turf/here = get_turf(src)
if(!here)
return null
if(!patrons_only)
- for(var/mob/living/basic/bounty_companion/buddy as anything in ai_companions())
+ for(var/mob/living/carbon/human/npc/bounty_companion/buddy as anything in ai_companions())
if(buddy.stat == CONSCIOUS && get_dist(src, buddy) <= range)
return buddy
var/list/options = list()
- for(var/mob/living/basic/other in range(range, here))
- if(other == src || other.stat != CONSCIOUS || other.client)
+ for(var/mob/living/other in range(range, here))
+ if(other == src || other.stat != CONSCIOUS || other.client || other.mind)
continue
- if(istype(other, /mob/living/basic/ambient_npc))
+ if(istype(other, /mob/living/carbon/human/npc/ambient_npc))
options += other
- else if(istype(other, /mob/living/basic/bounty_criminal))
- var/mob/living/basic/bounty_criminal/patron = other
+ else if(istype(other, /mob/living/carbon/human/npc/bounty_criminal))
+ var/mob/living/carbon/human/npc/bounty_criminal/patron = other
if(patron.blended || !patrons_only)
options += other
else if(!patrons_only && (other.mob_biotypes & MOB_HUMANOID) && faction_check_atom(other))
@@ -412,7 +443,7 @@
return is_type_in_typecache(thing, interesting) && isturf(thing.loc) && !thing.invisibility
/// Three to five things to look at around `anchor`, spread out, or spots on open ground when there is little; as weakrefs
-/mob/living/basic/bounty_criminal/proc/ai_find_points_of_interest(atom/anchor)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_find_points_of_interest(atom/anchor)
var/turf/center = get_turf(anchor) || get_turf(src)
. = list()
if(!center)
@@ -444,7 +475,7 @@
. += WEAKREF(point)
/// Whether they could go through `box`: loose, not locked or welded, not outpost property, not a body bag, on their site
-/mob/living/basic/bounty_criminal/proc/ai_can_rummage(obj/structure/closet/box)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_can_rummage(obj/structure/closet/box)
if(QDELETED(box) || !isturf(box.loc) || box.locked || box.welded)
return FALSE
if(istype(box, /obj/structure/closet/body_bag) || box.wall_mounted || (box.resistance_flags & INDESTRUCTIBLE))
@@ -452,7 +483,7 @@
return leash_ok(box.loc)
/// Up to four containers to go through around `anchor`, zone loot caches first; as weakrefs
-/mob/living/basic/bounty_criminal/proc/ai_find_containers(atom/anchor)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_find_containers(atom/anchor)
var/turf/center = get_turf(anchor) || get_turf(src)
. = list()
if(!center)
@@ -475,7 +506,7 @@
break
/// Shuts `box` after going through it, from right beside it, unless someone is standing in it
-/mob/living/basic/bounty_criminal/proc/ai_close_container(obj/structure/closet/box)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_close_container(obj/structure/closet/box)
if(QDELETED(box) || !box.opened || !isturf(loc) || !Adjacent(box))
return
if(locate(/mob/living) in box.loc)
@@ -489,7 +520,7 @@
* again, and one that is gone is replaced. The fire is solid, so no walk, flight or fight takes
* anyone through the flames (L4). Returns the fire or lamp, or null.
*/
-/mob/living/basic/bounty_criminal/proc/ai_make_camp(turf/center)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_make_camp(turf/center)
var/atom/fire = ai_camp_fire()
if(fire)
var/obj/structure/bonfire/bonfire = fire
@@ -528,7 +559,7 @@
return fire
/// Their camp's fire or lamp, if it is still there where they put it (one carried off is gone, L4)
-/mob/living/basic/bounty_criminal/proc/ai_camp_fire()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_camp_fire()
var/atom/movable/fire = ai_camp_piece(/obj/structure/bonfire) || ai_camp_piece(/obj/structure/bounty_camp_lamp)
return (fire && isturf(fire.loc)) ? fire : null
@@ -550,13 +581,13 @@
light_color = "#ffcc66"
/// They are gone: the camp stays as it is, but the fire burns down
-/mob/living/basic/bounty_criminal/proc/ai_put_out_camp()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_put_out_camp()
var/obj/structure/bonfire/bonfire = ai_camp_piece(/obj/structure/bonfire)
if(bonfire?.burning)
bonfire.extinguish()
/// A piece of their camp of `piece_type`, if it is still there
-/mob/living/basic/bounty_criminal/proc/ai_camp_piece(piece_type)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_camp_piece(piece_type)
for(var/datum/weakref/ref as anything in ai_camp)
var/atom/piece = ref?.resolve()
if(!QDELETED(piece) && istype(piece, piece_type))
@@ -564,7 +595,7 @@
return null
/// The patron they are talking to answers them, a moment after they spoke
-/mob/living/basic/bounty_criminal/proc/ai_get_reply(datum/weakref/partner_ref)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_get_reply(datum/weakref/partner_ref)
var/mob/living/partner = partner_ref?.resolve()
if(partner && stat == CONSCIOUS && get_dist(src, partner) <= 2)
bounty_ai_reply(partner, src)
@@ -573,10 +604,10 @@
/proc/bounty_ai_reply(mob/living/partner, mob/living/speaker)
if(QDELETED(partner) || partner.stat != CONSCIOUS)
return
- if(istype(partner, /mob/living/basic/bounty_companion))
+ if(istype(partner, /mob/living/carbon/human/npc/bounty_companion))
partner.face_atom(speaker)
INVOKE_ASYNC(partner, TYPE_PROC_REF(/mob/living, bounty_say), "companion_reply")
- else if(istype(partner, /mob/living/basic/bounty_criminal))
+ else if(istype(partner, /mob/living/carbon/human/npc/bounty_criminal))
partner.face_atom(speaker)
INVOKE_ASYNC(partner, TYPE_PROC_REF(/mob/living, bounty_say), "idle_chat")
@@ -586,7 +617,7 @@
/datum/ai_planning_subtree/bounty_activity
/datum/ai_planning_subtree/bounty_activity/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/bounty_criminal/criminal = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = controller.pawn
if(!istype(criminal) || criminal.ai_mode != BOUNTY_AI_CALM || criminal.hidden || !criminal.ai_can_act())
return
var/datum/bounty_activity/activity = criminal.ai_activity || criminal.ai_resume_activity()
@@ -606,11 +637,11 @@
behavior_flags = AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
/datum/ai_behavior/bounty_activity/setup(datum/ai_controller/controller)
- var/mob/living/basic/bounty_criminal/criminal = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = controller.pawn
return istype(criminal) && !!criminal.ai_activity
/datum/ai_behavior/bounty_activity/perform(seconds_per_tick, datum/ai_controller/controller)
- var/mob/living/basic/bounty_criminal/criminal = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = controller.pawn
var/datum/bounty_activity/activity = criminal.ai_activity
if(!activity || criminal.ai_mode != BOUNTY_AI_CALM)
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED
@@ -635,7 +666,7 @@
/datum/bounty_activity
/// Short text for the admin panel
var/name = "standing around"
- var/mob/living/basic/bounty_criminal/doer
+ var/mob/living/carbon/human/npc/bounty_criminal/doer
var/datum/weakref/anchor_ref
/// Where they are headed, or null where they are
var/turf/spot
@@ -646,7 +677,7 @@
/// world.time of the next line
var/next_line = 0
-/datum/bounty_activity/New(mob/living/basic/bounty_criminal/new_doer, atom/anchor)
+/datum/bounty_activity/New(mob/living/carbon/human/npc/bounty_criminal/new_doer, atom/anchor)
. = ..()
doer = new_doer
anchor_ref = anchor ? WEAKREF(anchor) : null
@@ -1276,7 +1307,7 @@
if(prob(step_kind == "chat" ? 70 : 30))
doer.ai_bark("idle_chat")
if(step_kind == "chat" && isliving(target))
- addtimer(CALLBACK(doer, TYPE_PROC_REF(/mob/living/basic/bounty_criminal, ai_get_reply), WEAKREF(target)), rand(3, 6) SECONDS, TIMER_DELETE_ME)
+ addtimer(CALLBACK(doer, TYPE_PROC_REF(/mob/living/carbon/human/npc/bounty_criminal, ai_get_reply), WEAKREF(target)), rand(3, 6) SECONDS, TIMER_DELETE_ME)
return BOUNTY_STEP_CONTINUE
/// Ends the step: the glass goes with them (never left on the bar, M4), up from the seat
@@ -1298,7 +1329,7 @@
* as turf = TRUE), shared for BOUNTY_OUTPOST_FLOOR_CACHE between everyone there; null anywhere else,
* or when the outpost has none (a broken load).
*/
-/proc/bounty_ai_outpost_floor(mob/living/basic/bounty_criminal/patron)
+/proc/bounty_ai_outpost_floor(mob/living/carbon/human/npc/bounty_criminal/patron)
var/datum/component/bounty_outpost_blend/act = patron?.GetComponent(/datum/component/bounty_outpost_blend)
var/obj/structure/overmap/trader_outpost/outpost = act?.outpost_ref?.resolve()
if(!istype(outpost))
@@ -1336,22 +1367,25 @@
* this controller is only the default for a decoy made some other way. Every criminal tree carries
* bounty_flee_and_calm, so a decoy that runs on any of them runs and then calms down (M3).
*/
-/mob/living/basic/bounty_criminal/decoy
+/mob/living/carbon/human/npc/bounty_criminal/decoy
ai_controller = /datum/ai_controller/basic_controller/bounty/criminal/decoy
/datum/ai_controller/basic_controller/bounty/criminal/decoy
planning_subtrees = list(
+ /datum/ai_planning_subtree/human_npc_soft_crit,
+ /datum/ai_planning_subtree/bounty_escape_captivity,
+ /datum/ai_planning_subtree/human_npc_walk_out,
/datum/ai_planning_subtree/bounty_gate,
/datum/ai_planning_subtree/bounty_flee_and_calm,
/datum/ai_planning_subtree/bounty_activity,
)
/// Always a patron
-/mob/living/basic/bounty_criminal/decoy/ai_expose()
+/mob/living/carbon/human/npc/bounty_criminal/decoy/ai_expose()
return
/// Made to react (P6, or a decoy no longer blending in): they back away, then go back to their evening
-/mob/living/basic/bounty_criminal/decoy/ai_react(mob/living/threat, bark)
+/mob/living/carbon/human/npc/bounty_criminal/decoy/ai_react(mob/living/threat, bark)
ai_flee_from(threat)
/**
@@ -1363,7 +1397,7 @@
/datum/ai_planning_subtree/bounty_flee_and_calm
/datum/ai_planning_subtree/bounty_flee_and_calm/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/bounty_criminal/criminal = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = controller.pawn
if(!istype(criminal) || criminal.ai_mode != BOUNTY_AI_FLEEING)
return
var/seen = criminal.ai_sees_threat(BOUNTY_FLEE_DISTANCE)
diff --git a/voidcrew/modules/bounties/bounty_admin.dm b/voidcrew/modules/bounties/bounty_admin.dm
index 721a17dfc7e..28b4629f4db 100644
--- a/voidcrew/modules/bounties/bounty_admin.dm
+++ b/voidcrew/modules/bounties/bounty_admin.dm
@@ -12,8 +12,7 @@
*
* It changes other packages' state only through their procs:
* - P1: generate_bounty_record(), make_decoy_record();
- * - P2: spawn_bounty_criminal(), body_apply_cuffs(), body_remove_cuffs(), body_downed_line(),
- * body_stand_up(), capture_state();
+ * - P2: spawn_bounty_criminal(), capture_state();
* - P3: start_activity();
* - P5: post_criminal_bounty(), close(), relist(), hunt() (forced), print_warrant(),
* SScriminal_bounties.board_fast_forward() and
@@ -21,8 +20,10 @@
* - P6: the decoy's outpost_become() and the outpost's display name, description and outfit;
* - P7: bounty_pool_add(), bounty_pool_remove(), bounty_pool_clear(), the prison's
* bounty_admit_record().
- * The one direct write is a criminal's worst_state back to free (force_free()): no package has a
- * proc that makes a worst state better, and the admin's "Free" exists to try a full-pay turn-in again.
+ * A criminal is a real human body (voidcrew/modules/human_npcs/), so the forced capture states are
+ * tg's own, put on through tg's procs (CR-21): real brute on the chest to just past its crit line, a
+ * real Paralyze, real handcuffs in the cuff slot, death(), and for "Free" tg's revive(HEAL_ALL) with the
+ * cuffs taken off and every stun ended. No stand-in states; the pad reads them as it reads anyone's.
*
* Everything goes through /datum/bounty_admin_panel. The menu procs (menu_*) ask the questions; the
* action procs (admin_*) take plain arguments, check the admin again, act and log, so a unit test can
@@ -43,6 +44,10 @@
#define BOUNTY_ADMIN_TICK_SECONDS 10
/// How long a forced stun lasts
#define BOUNTY_ADMIN_STUN_TIME (30 SECONDS)
+/// Most hits "force downed" lands to get a tough body past its crit line (its toughness cuts each one)
+#define BOUNTY_ADMIN_DOWN_HITS 20
+/// The brute of "force downed"'s first hit, which learns how much of a hit the body takes before the rest are sized
+#define BOUNTY_ADMIN_DOWN_PROBE 10
/// Most questions one opening of the panel asks before it closes itself: a guard, never reached by hand
#define BOUNTY_ADMIN_MAX_STEPS 200
/// Who the pool's test records say brought them in
@@ -205,7 +210,7 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a
var/share_choice = ask_list(user, "The decoy shares how much of their look?", "Spawn a decoy", shares)
if(!share_choice || !authorized(user))
return
- var/mob/living/basic/bounty_criminal/wanted = wanted_ref.resolve()
+ var/mob/living/carbon/human/npc/bounty_criminal/wanted = wanted_ref.resolve()
if(QDELETED(wanted))
refuse(user, "That criminal is gone.")
return
@@ -353,12 +358,12 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a
"Stunned" = BOUNTY_STATE_STUNNED,
"Restrained (cuffs on)" = BOUNTY_STATE_RESTRAINED,
"Dead" = BOUNTY_STATE_DEAD,
- "Free (up, healed, uncuffed, worst state cleared)" = BOUNTY_STATE_FREE,
+ "Free (alive, healed, uncuffed)" = BOUNTY_STATE_FREE,
)
var/state_choice = ask_list(user, "Which state?", "Force a capture state", states)
if(!state_choice || !authorized(user))
return
- var/mob/living/basic/bounty_criminal/criminal = criminal_ref.resolve()
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = criminal_ref.resolve()
if(QDELETED(criminal))
refuse(user, "That criminal is gone.")
return
@@ -454,7 +459,7 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a
/// The live criminal the admin picks (never a decoy), or null
/datum/bounty_admin_panel/proc/pick_criminal(mob/user, message)
var/list/choices = list()
- for(var/mob/living/basic/bounty_criminal/criminal as anything in live_criminals())
+ for(var/mob/living/carbon/human/npc/bounty_criminal/criminal as anything in live_criminals())
choices[unique_label(choices, criminal_label(criminal))] = WEAKREF(criminal)
if(!length(choices))
return refuse(user, "No bounty criminals are about. Spawn one first.")
@@ -462,7 +467,7 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a
if(!choice || !authorized(user))
return null
var/datum/weakref/criminal_ref = choices[choice]
- var/mob/living/basic/bounty_criminal/criminal = criminal_ref?.resolve()
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = criminal_ref?.resolve()
if(QDELETED(criminal))
return refuse(user, "That criminal is gone.")
return criminal
@@ -500,10 +505,10 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a
/// Every live bounty criminal in the world, decoys only if asked for
/datum/bounty_admin_panel/proc/live_criminals(include_decoys = FALSE)
var/list/found = list()
- for(var/mob/living/basic/bounty_criminal/criminal in GLOB.mob_living_list)
+ for(var/mob/living/carbon/human/npc/bounty_criminal/criminal in GLOB.mob_living_list)
if(QDELETED(criminal))
continue
- if(!include_decoys && istype(criminal, /mob/living/basic/bounty_criminal/decoy))
+ if(!include_decoys && istype(criminal, /mob/living/carbon/human/npc/bounty_criminal/decoy))
continue
found += criminal
return found
@@ -546,6 +551,8 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a
"Knife" = BOUNTY_STYLE_KNIFE,
"Pistol" = BOUNTY_STYLE_PISTOL,
"Shotgun" = BOUNTY_STYLE_SHOTGUN,
+ "SMG" = BOUNTY_STYLE_SMG,
+ "Revolver" = BOUNTY_STYLE_REVOLVER,
"Club" = BOUNTY_STYLE_CLUB,
"Bottle thrower" = BOUNTY_STYLE_BOTTLE,
)
@@ -682,7 +689,7 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a
// ===== DESCRIPTIONS =====
-/datum/bounty_admin_panel/proc/criminal_name(mob/living/basic/bounty_criminal/criminal)
+/datum/bounty_admin_panel/proc/criminal_name(mob/living/carbon/human/npc/bounty_criminal/criminal)
if(!criminal)
return "nobody"
return criminal.record?.name || criminal.real_name || criminal.name
@@ -694,7 +701,7 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a
var/variant = record.kit || record.style
return "[bounty_tier_name(record.tier)] [record.archetype || "criminal"][variant ? " ([variant])" : ""]"
-/datum/bounty_admin_panel/proc/criminal_label(mob/living/basic/bounty_criminal/criminal)
+/datum/bounty_admin_panel/proc/criminal_label(mob/living/carbon/human/npc/bounty_criminal/criminal)
var/area/place = get_area(criminal)
return "[criminal_name(criminal)]: [record_kind(criminal.record)], [criminal.capture_state()], in [place?.name || "nowhere"]"
@@ -739,7 +746,7 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a
var/datum/bounty_record/record = posting.record
var/obj/structure/overmap/site = posting.site()
var/obj/structure/overmap/ship/private_ship = posting.offered_to()
- var/mob/living/basic/bounty_criminal/criminal = posting.criminal()
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = posting.criminal()
var/location = criminal ? "[ADMIN_VERBOSEJMP(criminal)], [criminal.capture_state()]" : absent_reason(posting)
return list(
"tier" = bounty_tier_name(record?.tier),
@@ -829,7 +836,7 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a
record.kit = null
if(variant)
record.style = variant
- var/mob/living/basic/bounty_criminal/criminal = spawn_bounty_criminal(record, where, null)
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = spawn_bounty_criminal(record, where, null)
if(QDELETED(criminal))
return refuse(user, "The criminal did not spawn.")
if(activity)
@@ -845,11 +852,11 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a
* the alert and it walks out when the posting ends; anywhere else it stands alone, with the black
* market's look. A decoy is never linked to a posting through posting_ref (P6). Returns the decoy.
*/
-/datum/bounty_admin_panel/proc/admin_spawn_decoy(mob/user, mob/living/basic/bounty_criminal/wanted, shared = 1)
+/datum/bounty_admin_panel/proc/admin_spawn_decoy(mob/user, mob/living/carbon/human/npc/bounty_criminal/wanted, shared = 1)
error = null
if(!authorized(user))
return null
- if(QDELETED(wanted) || istype(wanted, /mob/living/basic/bounty_criminal/decoy))
+ if(QDELETED(wanted) || istype(wanted, /mob/living/carbon/human/npc/bounty_criminal/decoy))
return refuse(user, "Pick a wanted criminal, not a decoy.")
if(!wanted.record)
return refuse(user, "[criminal_name(wanted)] has no record to copy.")
@@ -868,8 +875,12 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a
var/datum/criminal_bounty/posting = wanted.posting()
if(posting && (posting.placement_kind != BOUNTY_PLACEMENT_TRADER_OUTPOST || posting.outpost_site?.resolve() != outpost))
posting = null
- var/datum/npc_spawn_context/context = wanted.bounty_profile_context()
- var/mob/living/basic/bounty_criminal/decoy/decoy = spawn_npc_in_zone(/mob/living/basic/bounty_criminal/decoy, decoy_spot(center), context, FALSE)
+ // One body, wanted back at once: built now rather than queued, in the decoy record's face
+ var/datum/human_npc_order/order = spawn_human_npc(/mob/living/carbon/human/npc/bounty_criminal/decoy, decoy_spot(center), look = decoy_record, immediate = TRUE)
+ var/mob/living/carbon/human/npc/bounty_criminal/decoy/decoy = order?.spawned_ref?.resolve()
+ qdel(order)
+ if(QDELETED(decoy))
+ return refuse(user, "The decoy did not spawn.")
decoy.outpost_become(wanted, decoy_record, posting, outpost, bounty_outpost_display_name(outpost), bounty_outpost_display_desc(outpost), bounty_outpost_outfit(outpost))
if(posting)
posting.decoys += WEAKREF(decoy)
@@ -1012,7 +1023,7 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a
return "not spawned yet"
/// Moves the admin to `criminal`. Returns TRUE if they moved.
-/datum/bounty_admin_panel/proc/admin_jump(mob/user, mob/living/basic/bounty_criminal/criminal, datum/criminal_bounty/posting)
+/datum/bounty_admin_panel/proc/admin_jump(mob/user, mob/living/carbon/human/npc/bounty_criminal/criminal, datum/criminal_bounty/posting)
error = null
if(!authorized(user))
return FALSE
@@ -1024,7 +1035,7 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a
return TRUE
/// Brings `criminal` to the admin's tile, out of any locker or crate. Returns TRUE if they came.
-/datum/bounty_admin_panel/proc/admin_bring(mob/user, mob/living/basic/bounty_criminal/criminal, datum/criminal_bounty/posting)
+/datum/bounty_admin_panel/proc/admin_bring(mob/user, mob/living/carbon/human/npc/bounty_criminal/criminal, datum/criminal_bounty/posting)
error = null
if(!authorized(user))
return FALSE
@@ -1043,11 +1054,12 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a
// ===== CAPTURE STATES =====
/**
- * Puts `criminal` in capture state `state` (BOUNTY_STATE_*) through P2's own procs: damage to its
- * downed line, a stun, real handcuffs put on by nobody (so nobody lands on its grudge list), death,
- * or taking all of that off again. Returns TRUE if capture_state() now reads `state`.
+ * Puts `criminal` in capture state `state` (BOUNTY_STATE_*) the way tg does it to anyone (CR-21): real
+ * brute to just past its crit line, a real Paralyze, real handcuffs put on by nobody (so nobody lands on
+ * its grudge list), death(), or for free a revive with all of that taken off again. Returns TRUE if it
+ * was done; what capture_state() reads then is reported to the admin.
*/
-/datum/bounty_admin_panel/proc/admin_force_state(mob/user, mob/living/basic/bounty_criminal/criminal, state)
+/datum/bounty_admin_panel/proc/admin_force_state(mob/user, mob/living/carbon/human/npc/bounty_criminal/criminal, state)
error = null
if(!authorized(user))
return FALSE
@@ -1070,7 +1082,7 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a
if(!done)
return FALSE
var/now = criminal.capture_state()
- log_action(user, "force [criminal_name(criminal)] to [state] (capture state now [now], worst [criminal.worst_state])")
+ log_action(user, "force [criminal_name(criminal)] to [state] (capture state now [now])")
if(now != state)
// Stunned or cuffed while down still reads as downed, as the pad would pay it
tell(user, span_notice("[criminal_name(criminal)] is [state], but reads as [now]: [now] comes first."))
@@ -1078,21 +1090,42 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a
tell(user, span_notice("[criminal_name(criminal)] is now [now]."))
return TRUE
-/// Damage straight to P2's downed line, past the mercy rule and armour; P2 downs it from there
-/datum/bounty_admin_panel/proc/force_downed(mob/user, mob/living/basic/bounty_criminal/criminal)
+/**
+ * Real brute on its chest until it is just in crit: health a point under its crit line (tg's
+ * crit_threshold, HEALTH_THRESHOLD_CRIT; the hard-crit line for a body that has no soft crit). No
+ * armour roll and no wound. How much of a hit it takes (its toughness, a species' weak or tough
+ * limbs) is learned from a small first hit, and each hit after is sized by what the last one took
+ * off, so a body that takes more than a person's doesn't overshoot into hard crit.
+ */
+/datum/bounty_admin_panel/proc/force_downed(mob/user, mob/living/carbon/human/npc/bounty_criminal/criminal)
if(criminal.stat == DEAD)
return refuse(user, "[criminal_name(criminal)] is dead.")
if(criminal.is_downed())
return refuse(user, "[criminal_name(criminal)] is already down.")
- var/excess = criminal.health - criminal.body_downed_line()
- if(excess > 0)
- criminal.adjust_health(excess, TRUE, TRUE)
+ var/line = (HAS_TRAIT(criminal, TRAIT_NOSOFTCRIT) ? criminal.hardcrit_threshold : criminal.crit_threshold) - 1
+ var/taken = 1
+ for(var/hit in 1 to BOUNTY_ADMIN_DOWN_HITS)
+ if(criminal.is_downed() || criminal.stat == DEAD)
+ break
+ var/excess = criminal.health - line
+ if(excess <= 0)
+ break
+ var/amount = excess / taken
+ if(hit == 1)
+ amount = min(amount, BOUNTY_ADMIN_DOWN_PROBE)
+ var/before = criminal.health
+ if(!criminal.apply_damage(amount, BRUTE, BODY_ZONE_CHEST, wound_bonus = CANT_WOUND))
+ break
+ var/dropped = before - criminal.health
+ if(dropped <= 0)
+ break
+ taken = dropped / amount
if(!criminal.is_downed())
- return refuse(user, "[criminal_name(criminal)] did not go down ([criminal.health] health, line [criminal.body_downed_line()]).")
+ return refuse(user, "[criminal_name(criminal)] did not go down ([criminal.health] health).")
return TRUE
-/// A long paralysis, past stun immunity
-/datum/bounty_admin_panel/proc/force_stunned(mob/user, mob/living/basic/bounty_criminal/criminal)
+/// A long tg paralysis, past stun immunity
+/datum/bounty_admin_panel/proc/force_stunned(mob/user, mob/living/carbon/human/npc/bounty_criminal/criminal)
if(criminal.stat == DEAD)
return refuse(user, "[criminal_name(criminal)] is dead.")
criminal.Paralyze(BOUNTY_ADMIN_STUN_TIME, TRUE)
@@ -1100,20 +1133,27 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a
return refuse(user, "[criminal_name(criminal)] shrugged the stun off.")
return TRUE
-/// A new pair of real handcuffs, put on at once through P2's body_apply_cuffs() by nobody: held still, its AI paused, and no one on its grudge list
-/datum/bounty_admin_panel/proc/force_restrained(mob/user, mob/living/basic/bounty_criminal/criminal)
+/**
+ * A new pair of real handcuffs in its cuff slot, put on the way tg's apply_cuffs() does it, by nobody:
+ * no cuffing do_after for it to answer, and no one on its grudge list. It can work at them as at
+ * anyone's.
+ */
+/datum/bounty_admin_panel/proc/force_restrained(mob/user, mob/living/carbon/human/npc/bounty_criminal/criminal)
if(criminal.stat == DEAD)
- return refuse(user, "[criminal_name(criminal)] is dead: the cuffs would only fall off.")
+ return refuse(user, "[criminal_name(criminal)] is dead.")
if(criminal.is_restrained())
- return refuse(user, "[criminal_name(criminal)] is already cuffed.")
+ return refuse(user, "[criminal_name(criminal)] is already restrained.")
+ if(!criminal.canBeHandcuffed())
+ return refuse(user, "[criminal_name(criminal)] has no wrists to cuff.")
var/obj/item/restraints/handcuffs/cuffs = new(criminal.drop_location())
- if(!criminal.body_apply_cuffs(cuffs, null))
+ criminal.equip_to_slot(cuffs, ITEM_SLOT_HANDCUFFED)
+ if(criminal.handcuffed != cuffs)
if(!QDELETED(cuffs) && cuffs.loc != criminal)
qdel(cuffs)
return refuse(user, "The cuffs did not go on [criminal_name(criminal)].")
return TRUE
-/datum/bounty_admin_panel/proc/force_dead(mob/user, mob/living/basic/bounty_criminal/criminal)
+/datum/bounty_admin_panel/proc/force_dead(mob/user, mob/living/carbon/human/npc/bounty_criminal/criminal)
if(criminal.stat == DEAD)
return refuse(user, "[criminal_name(criminal)] is already dead.")
criminal.death()
@@ -1122,27 +1162,20 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a
return TRUE
/**
- * Takes every capture state off: the cuffs come off through P2's body_remove_cuffs() (they drop at
- * its feet), the surrender ends, stuns end, all damage heals, a downed one gets back up through P2's
- * body_stand_up() (a mini-boss rallies, as it would), and the worst state goes back to free, so a
- * full-pay turn-in can be tried again. The dead stay dead: a criminal can't be revived.
+ * Takes every capture state off, through tg (CR-21): revive(HEAL_ALL) heals every hurt (damage, wounds,
+ * organs, blood, stamina, stuns) and brings a dead one back if its body can live; the cuffs come off
+ * through tg's uncuff() (they drop at its feet), and any stun left ends, a surrender with it. So a
+ * full-pay turn-in can be tried again, or a dead criminal brought back for another go.
*/
-/datum/bounty_admin_panel/proc/force_free(mob/user, mob/living/basic/bounty_criminal/criminal)
+/datum/bounty_admin_panel/proc/force_free(mob/user, mob/living/carbon/human/npc/bounty_criminal/criminal)
+ criminal.revive(HEAL_ALL)
if(criminal.stat == DEAD)
- return refuse(user, "[criminal_name(criminal)] is dead, and the dead stay dead.")
- criminal.body_remove_cuffs(null)
- REMOVE_TRAIT(criminal, TRAIT_BOUNTY_SURRENDERED, BOUNTY_TRAIT)
- criminal.SetParalyzed(0, TRUE)
- criminal.SetKnockdown(0, TRUE)
- criminal.SetStun(0, TRUE)
- criminal.SetImmobilized(0, TRUE)
+ return refuse(user, "[criminal_name(criminal)] could not be brought back.")
+ if(criminal.handcuffed || criminal.legcuffed)
+ criminal.uncuff()
+ criminal.SetAllImmobility(0)
+ criminal.SetSleeping(0)
criminal.remove_status_effect(/datum/status_effect/incapacitating/stamcrit)
- criminal.fully_heal(HEAL_DAMAGE)
- if(criminal.is_downed())
- criminal.body_cancel_recovery()
- criminal.body_stand_up()
- // No proc makes a worst state better: this is the panel's one direct write (see the file's header)
- criminal.worst_state = BOUNTY_STATE_FREE
if(criminal.capture_state() != BOUNTY_STATE_FREE)
return refuse(user, "[criminal_name(criminal)] still reads as [criminal.capture_state()].")
return TRUE
@@ -1164,7 +1197,7 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a
return refuse(user, "That prison is gone.")
if(!prison.free_slots())
return refuse(user, "[prison_name(prison)] has no free cell.")
- var/mob/living/basic/outpost_prisoner/prisoner = prison.bounty_admit_record(record)
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = prison.bounty_admit_record(record)
if(QDELETED(prisoner))
return refuse(user, "[prison_name(prison)] took nobody: no cell there has room for an arrival.")
log_action(user, "admit bounty record [record.name] ([record_kind(record)]) into cell [prisoner.cell?.number] of [prison_name(prison)]")
@@ -1335,6 +1368,8 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a
#undef BOUNTY_ADMIN_MAX_TICKS
#undef BOUNTY_ADMIN_TICK_SECONDS
#undef BOUNTY_ADMIN_STUN_TIME
+#undef BOUNTY_ADMIN_DOWN_HITS
+#undef BOUNTY_ADMIN_DOWN_PROBE
#undef BOUNTY_ADMIN_MAX_STEPS
#undef BOUNTY_ADMIN_TEST_CAPTOR
#undef BOUNTY_ADMIN_RELIST_REASON
diff --git a/voidcrew/modules/bounties/bounty_ai.dm b/voidcrew/modules/bounties/bounty_ai.dm
index 7efeb9db2b1..41ee248a3b8 100644
--- a/voidcrew/modules/bounties/bounty_ai.dm
+++ b/voidcrew/modules/bounties/bounty_ai.dm
@@ -1,22 +1,30 @@
/**
* # Bounty hunting: criminal AI, shared parts
*
- * Owner: P3 AI. Owns this file, bounty_ai_meek.dm, bounty_ai_normal.dm, bounty_activities.dm,
- * bounty_companions.dm, voidcrew/_DEFINES/bounty_ai.dm and the tests in
+ * Owner: P3 AI. Owns this file, bounty_ai_meek.dm, bounty_ai_normal.dm, bounty_styles.dm,
+ * bounty_activities.dm, bounty_companions.dm, voidcrew/_DEFINES/bounty_ai.dm and the tests in
* voidcrew/modules/unit_tests/voidcrew_bounty_ai.dm. Do not edit this file outside P3.
*
- * What it owns: the criminal AI's own system (decision 11: never the prison AI). This file holds
- * what meek, normal, decoys and companions share:
- * - the controller base, which hooks the mob's signals from the controller (a separate datum, so
- * nothing here collides with the body's own registrations in bounty_criminal.dm);
- * - who they may fight (/datum/targeting_strategy/basic/bounty: the body's may_attack(), never
- * their own gang, never a downed hunter), and movement that stays on their site (leash_ok());
- * - the planning gate: nothing is planned while dead, downed, restrained or surrendered, and a
- * hidden criminal only keeps still;
- * - noticing hunters (a spatial grid lookup of player mobs, once a second, never view());
- * - being attacked, confronted, downed, getting up, cuffed and uncuffed;
- * - what they hold in their hand and over their head (drawn in vis_contents, so a look rebuilt
- * over their overlays never wipes it), and their pace.
+ * Criminals and their companions are real human bodies (voidcrew/modules/human_npcs/, phase D of the
+ * human NPC migration). Their crit, stamina, stuns, cuffs, wounds and death are tg's; this AI only
+ * chooses what the body does, and the body does it the way a player would: it walks or runs, draws
+ * a weapon it carries, clicks with it (controller.ai_interact()), throws, shoves, sits on a chair,
+ * lies down, climbs into a locker, injects a pen it carries.
+ *
+ * This file holds what meek, normal, decoys and companions share:
+ * - the controller base (/datum/ai_controller/basic_controller/bounty), which runs on a human pawn
+ * (contract 2.4: the human NPC run check, soft crit, the core's bounty_escape_captivity) and hooks
+ * the pawn's attack signals from the controller (a separate datum, so nothing here collides with the
+ * body's own registrations in bounty_criminal.dm);
+ * - who they may fight (/datum/targeting_strategy/basic/bounty: the body's may_attack(), never their
+ * own gang, never someone who is down), and movement that stays on their site
+ * (/datum/ai_movement/jps/bounty: the body's own leash rule, body_move_allowed()). There is no body
+ * Move() override: the leash is the AI's, so anyone can still drag, carry or shove them anywhere;
+ * - the planning gate: nothing is planned while they are dead, in crit, restrained, stunned or giving
+ * up, and a hidden criminal only keeps still;
+ * - noticing hunters (a spatial grid lookup of player mobs, twice a second, never view());
+ * - being attacked, confronted, downed, getting up, cuffed and uncuffed, giving up;
+ * - their pace: a walk or a run (ai_set_pace()), as a person moves.
* P4 overrides on_confronted() for bosses in its own files, on the /boss subtype.
*
* The shared vars are declared in bounty_types.dm and nowhere else; a var only P3 uses has an
@@ -25,7 +33,7 @@
// ===== STATE ON THE CRIMINAL =====
-/mob/living/basic/bounty_criminal
+/mob/living/carbon/human/npc/bounty_criminal
ai_controller = /datum/ai_controller/basic_controller/bounty/criminal
/// BOUNTY_AI_CALM, _AWARE, _FLEEING, _FIGHTING or _RETREATING
var/ai_mode = BOUNTY_AI_CALM
@@ -37,12 +45,8 @@
var/ai_next_notice = 0
/// How far off each person was at the last look around, by REF(), to spot someone running at them
var/list/ai_seen_distances
- /// The speed they move at now; see ai_set_pace()
+ /// The pace they asked for last (ai_set_pace()): calm or slower is a walk, anything quicker a run
var/ai_pace
- /// What they hold in their hand, drawn in their vis_contents
- var/obj/effect/abstract/bounty_held/ai_hand
- /// What shows over their head (hands up), drawn in their vis_contents
- var/obj/effect/abstract/bounty_held/ai_over_head
/// A walk that keeps failing: how many times, so they give up on it
var/ai_travel_failures = 0
@@ -50,10 +54,10 @@
/// The criminal a mob fights for: the criminal itself, or a companion's criminal. Null for anyone else.
/proc/bounty_ai_side_of(atom/movable/thing)
- if(istype(thing, /mob/living/basic/bounty_criminal))
+ if(istype(thing, /mob/living/carbon/human/npc/bounty_criminal))
return thing
- if(istype(thing, /mob/living/basic/bounty_companion))
- var/mob/living/basic/bounty_companion/companion = thing
+ if(istype(thing, /mob/living/carbon/human/npc/bounty_companion))
+ var/mob/living/carbon/human/npc/bounty_companion/companion = thing
return companion.ai_leader()
return null
@@ -61,7 +65,7 @@
/proc/bounty_ai_same_gang(atom/movable/first, atom/movable/second)
if(first == second)
return TRUE
- var/mob/living/basic/bounty_criminal/side = bounty_ai_side_of(first)
+ var/mob/living/carbon/human/npc/bounty_criminal/side = bounty_ai_side_of(first)
return !isnull(side) && side == bounty_ai_side_of(second)
/// Whether `person` counts as a hunter: someone played, awake, and not a criminal or one of their friends
@@ -70,7 +74,7 @@
return FALSE
if(!person.mind && !person.client)
return FALSE
- if(istype(person, /mob/living/basic/bounty_criminal) || istype(person, /mob/living/basic/bounty_companion))
+ if(istype(person, /mob/living/carbon/human/npc/bounty_criminal) || istype(person, /mob/living/carbon/human/npc/bounty_companion))
return FALSE
return TRUE
@@ -83,10 +87,10 @@
/proc/bounty_ai_may_hit(atom/movable/fighter, atom/target)
if(QDELETED(target) || bounty_ai_same_gang(fighter, target))
return FALSE
- if(istype(fighter, /mob/living/basic/bounty_criminal))
- var/mob/living/basic/bounty_criminal/criminal = fighter
+ if(istype(fighter, /mob/living/carbon/human/npc/bounty_criminal))
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = fighter
return criminal.may_attack(target)
- var/mob/living/basic/bounty_criminal/leader = bounty_ai_side_of(fighter)
+ var/mob/living/carbon/human/npc/bounty_criminal/leader = bounty_ai_side_of(fighter)
return !leader || leader.may_attack_scope(target)
/// Tiles between `first` and `second` by the turfs they stand on, so a pilot counts as where their mech is (H4); INFINITY across z-levels
@@ -150,65 +154,10 @@
continue
.++
-// ===== HELD THINGS =====
-
-/**
- * Something drawn in a mob's hand or over its head. It lives in the mob's vis_contents rather than
- * its overlays: the look builder replaces the overlays wholesale, and would wipe it.
- */
-/obj/effect/abstract/bounty_held
- name = ""
- mouse_opacity = MOUSE_OPACITY_TRANSPARENT
- appearance_flags = KEEP_APART | RESET_COLOR | RESET_TRANSFORM | PIXEL_SCALE
- vis_flags = VIS_INHERIT_PLANE
- layer = ABOVE_MOB_LAYER
- /// Over the head rather than in the hand
- var/over_head = FALSE
- /// Drawn with the item's own in-hand sprite, which turns with the holder, rather than its item icon
- var/inhand = FALSE
-
-/**
- * Draws `look` in `owner`'s hand (or over their head), reusing `holder`: `look` is an atom, whose
- * appearance is copied, or an atom typepath, whose icon is used. An item with an in-hand sprite is
- * drawn with that instead, the way a player holds it, so it points the way they face. A null `look`
- * takes it away. Returns the holder to keep, or null.
- */
-/proc/bounty_ai_update_held(mob/living/owner, obj/effect/abstract/bounty_held/holder, look, over_head = FALSE)
- if(isnull(look) || QDELETED(owner))
- if(holder)
- owner?.vis_contents -= holder
- qdel(holder)
- return null
- if(!holder)
- holder = new(null)
- owner.vis_contents += holder
- var/list/inhand_look = over_head ? null : npc_inhand_look(look)
- if(inhand_look)
- holder.appearance = mutable_appearance(inhand_look[1], inhand_look[2])
- else if(ispath(look, /atom))
- var/atom/look_type = look
- holder.appearance = mutable_appearance(initial(look_type.icon), initial(look_type.icon_state))
- else if(isatom(look))
- var/atom/look_atom = look
- holder.appearance = look_atom.appearance
- holder.name = ""
- holder.over_head = over_head
- holder.inhand = !!inhand_look
- holder.mouse_opacity = MOUSE_OPACITY_TRANSPARENT
- holder.appearance_flags = KEEP_APART | RESET_COLOR | RESET_TRANSFORM | PIXEL_SCALE
- holder.vis_flags = VIS_INHERIT_PLANE
- holder.layer = ABOVE_MOB_LAYER
- holder.alpha = 255
- holder.dir = SOUTH
- holder.pixel_x = 0
- holder.pixel_y = 0
- bounty_ai_place_held(owner, holder)
- return holder
-
/**
* The right-hand sprite of `look` (an item or item typepath) as list(file, state), or null when it
- * has none: what a player holding it shows. Drawn on an NPC's body it turns with them, as a player's
- * does. Used by bounty NPCs and the prison's prisoners and guards.
+ * has none: what a player holding it shows. The prison's prisoners and guards draw it on their bodies
+ * (outpost_prison_prisoner.dm); bounty NPCs now hold the real item.
*/
/proc/npc_inhand_look(look)
var/hand_file
@@ -225,45 +174,54 @@
return null
return list(hand_file, state)
-/// Puts a held thing in the hand on the side they face (`facing`, or the way they face now), or over their head
-/proc/bounty_ai_place_held(mob/living/owner, obj/effect/abstract/bounty_held/holder, facing)
- if(!holder || !owner)
- return
- // An in-hand sprite is drawn for a whole body: full size, no offset, facing their way
- if(holder.inhand)
- holder.transform = matrix()
- holder.pixel_w = 0
- holder.pixel_z = 0
- holder.dir = facing || owner.dir
- return
- holder.transform = matrix().Scale(0.6)
- if(holder.over_head)
- holder.pixel_w = 0
- holder.pixel_z = 22
+/**
+ * Sets the pace of `body` (a criminal or a companion): calm or slower walks, anything quicker runs,
+ * through tg's own move intent. A person can't go faster than a run.
+ */
+/proc/bounty_ai_set_pace(mob/living/carbon/human/body, new_speed)
+ if(QDELETED(body))
return
- var/facing_dir = facing || owner.dir
- // The same hand whichever way they face: to the right facing south or east, the left facing north or west
- holder.pixel_w = ((facing_dir & WEST) || facing_dir == NORTH) ? -7 : 7
- holder.pixel_z = -4
-
-/// What a fighter holds, by whichever of the two types it is
-/proc/bounty_ai_hold(mob/living/basic/fighter, look)
- if(istype(fighter, /mob/living/basic/bounty_criminal))
- var/mob/living/basic/bounty_criminal/criminal = fighter
- criminal.ai_hand = bounty_ai_update_held(criminal, criminal.ai_hand, look)
- else if(istype(fighter, /mob/living/basic/bounty_companion))
- var/mob/living/basic/bounty_companion/companion = fighter
- companion.ai_hand = bounty_ai_update_held(companion, companion.ai_hand, look)
+ var/want_run = !isnull(new_speed) && new_speed < BOUNTY_CALM_SPEED
+ if(want_run != (body.move_intent == MOVE_INTENT_RUN))
+ body.toggle_move_intent()
+
+/**
+ * A step `mover` (a criminal or a companion) takes by hand, outside the AI's pathing: never off its
+ * side's leash (the criminal's own body_move_allowed(); a companion its criminal's leash_ok()), into
+ * lava or a chasm. Returns TRUE if it moved. Every direct step in the bounty AI goes through here.
+ */
+/proc/bounty_ai_step(mob/living/mover, turf/destination)
+ if(QDELETED(mover) || !isturf(mover.loc) || !isturf(destination) || get_dist(mover, destination) != 1)
+ return FALSE
+ if(islava(destination) || ischasm(destination) || destination.is_blocked_turf(source_atom = mover))
+ return FALSE
+ if(!bounty_ai_step_allowed(mover, destination))
+ return FALSE
+ var/turf/was = mover.loc
+ mover.Move(destination, get_dir(mover, destination))
+ return mover.loc != was
+
+/// Whether `mover`'s own step onto `destination` keeps to its leash (see bounty_ai_step())
+/proc/bounty_ai_step_allowed(mob/living/mover, turf/destination)
+ if(istype(mover, /mob/living/carbon/human/npc/bounty_criminal))
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = mover
+ return criminal.body_move_allowed(destination)
+ var/mob/living/carbon/human/npc/bounty_criminal/leader = bounty_ai_side_of(mover)
+ if(!leader || leader.leash_ok(destination))
+ return TRUE
+ // Already off its criminal's ground (dragged, carried, woken elsewhere): it may walk about, but never onto danger
+ return !leader.leash_ok(get_turf(mover)) && destination.can_cross_safely(mover)
// ===== THE CRIMINAL'S SIDE OF IT =====
/**
- * `user` confronted them: showed the warrant, or accused them. A meek criminal bolts, a normal one
- * fights; a boss starts its fight (P4 overrides this on /boss); P6 decides what a decoy does. This
- * and P6's exposure (which ends its act, then calls this) are the only ways out of blending in:
- * anything else that happens to a blended patron shows nothing (C1).
+ * `user` confronted them: showed the warrant, accused them, reached for their wrists (the core's cuff
+ * reaction calls this). A meek criminal bolts, a normal one fights; a boss starts its fight (P4
+ * overrides this on /boss); P6 decides what a decoy does. This and P6's exposure (which ends its act,
+ * then calls this) are the only ways out of blending in: anything else that happens to a blended
+ * patron shows nothing (C1).
*/
-/mob/living/basic/bounty_criminal/proc/on_confronted(mob/user)
+/mob/living/carbon/human/npc/bounty_criminal/proc/on_confronted(mob/user)
if(stat != CONSCIOUS || !isliving(user) || QDELETED(user))
return
ai_add_grudge(user)
@@ -278,58 +236,58 @@
* What they do about `threat`: a meek criminal runs, a normal one fights, a decoy gets out of the
* way. `bark` is the dialogue context to use instead of the usual one, or null.
*/
-/mob/living/basic/bounty_criminal/proc/ai_react(mob/living/threat, bark)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_react(mob/living/threat, bark)
return
/// Something about `hunter` made them look twice (armed, cuffs, a warrant, running at them)
-/mob/living/basic/bounty_criminal/proc/ai_notice(mob/living/hunter)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_notice(mob/living/hunter)
return
/// How far they notice hunters
-/mob/living/basic/bounty_criminal/proc/ai_notice_range()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_notice_range()
return BOUNTY_NORMAL_NOTICE_RANGE
/// Their fighting style's key, BOUNTY_STYLE_*, or null for a mob that never fights
-/mob/living/basic/bounty_criminal/proc/ai_wanted_style()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_wanted_style()
return null
/// Whether they carry their style's heavier weapon: every tier above Petty. A 9mm is a 9mm; the tier only picks the gun.
-/mob/living/basic/bounty_criminal/proc/ai_heavy_weapon()
- return record?.tier != BOUNTY_TIER_PETTY
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_heavy_weapon()
+ return !isnull(record?.tier) && record.tier != BOUNTY_TIER_PETTY
-/// Puts their style on them, once the record says which it is. Cheap when nothing changed.
-/mob/living/basic/bounty_criminal/proc/ai_update_style()
+/// Puts their style on their AI, once the record says which it is. Cheap when nothing changed. The weapon itself is what they carry (bounty_build_outfit()).
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_update_style()
var/key = ai_wanted_style()
if(!key || QDELETED(ai_controller) || ai_controller.blackboard[BB_BOUNTY_STYLE] == key)
return
- bounty_ai_apply_style(src, key, ai_heavy_weapon())
+ bounty_ai_apply_style(src, key)
/**
- * Whether they can do anything at all: alive, on their feet, free and not giving up. Knocked down,
- * stunned or in stamina crit (P2's body_is_stunned()) is the cuff window: no blows, no shots, no
- * climbing into hiding (H2).
+ * Whether they can do anything at all: alive, out of crit, on their feet, free and not giving up.
+ * Knocked down, stunned, in stamina crit or lying there with their hands on their head (tg's
+ * *surrender) is the cuff window: no blows, no shots, no climbing into hiding (H2). All read from tg.
*/
-/mob/living/basic/bounty_criminal/proc/ai_can_act()
- if(stat != CONSCIOUS || HAS_TRAIT(src, TRAIT_BOUNTY_HELD) || HAS_TRAIT(src, TRAIT_FLOORED) || is_downed() || is_restrained())
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_can_act()
+ if(stat != CONSCIOUS || npc_surrendering || HAS_TRAIT(src, TRAIT_FLOORED) || is_downed() || is_restrained())
return FALSE
return !body_is_stunned()
/// Says a line for `context`, never from inside a signal handler's stack. `force` skips the cooldown, for a moment that must be heard.
-/mob/living/basic/bounty_criminal/proc/ai_bark(context, force = FALSE)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_bark(context, force = FALSE)
INVOKE_ASYNC(src, TYPE_PROC_REF(/mob/living, bounty_say), context, null, force)
/// Puts `who` on the list of people they may fight, by P2's rules (the cap, never another criminal or a companion)
-/mob/living/basic/bounty_criminal/proc/ai_add_grudge(mob/living/who)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_add_grudge(mob/living/who)
if(!isliving(who) || bounty_ai_same_gang(src, who))
return
body_add_grudge(who)
/// Whether `who` is on their grudge list
-/mob/living/basic/bounty_criminal/proc/ai_has_grudge(mob/living/who)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_has_grudge(mob/living/who)
return body_has_grudge(who)
/// The nearest person on their grudge list they can see (a pilot through their mech), or null
-/mob/living/basic/bounty_criminal/proc/ai_nearest_grudge(range = BOUNTY_FIGHT_VISION)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_nearest_grudge(range = BOUNTY_FIGHT_VISION)
var/mob/living/best
var/best_distance = INFINITY
for(var/datum/weakref/ref as anything in grudge)
@@ -345,16 +303,16 @@
return best
/// Who they are wary of, running from or fighting, if they still exist
-/mob/living/basic/bounty_criminal/proc/ai_threat()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_threat()
var/mob/living/threat = ai_threat_ref?.resolve()
return QDELETED(threat) ? null : threat
-/mob/living/basic/bounty_criminal/proc/ai_set_threat(mob/living/threat)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_set_threat(mob/living/threat)
ai_threat_ref = threat ? WEAKREF(threat) : null
ai_threat_seen_at = world.time
/// Whether they can see their threat now (a pilot through their mech); seeing it restarts the clock on losing it
-/mob/living/basic/bounty_criminal/proc/ai_sees_threat(range = BOUNTY_FIGHT_VISION)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_sees_threat(range = BOUNTY_FIGHT_VISION)
var/mob/living/threat = ai_threat()
var/turf/threat_turf = get_turf(threat)
if(!threat || threat_turf?.z != z || !bounty_ai_can_see(src, threat, range))
@@ -362,21 +320,20 @@
ai_threat_seen_at = world.time
return TRUE
-/mob/living/basic/bounty_criminal/proc/ai_set_mode(new_mode)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_set_mode(new_mode)
ai_mode = new_mode
-/// Moves at `new_speed` from now on. Compared with the speed they have, not a cache: the body sets speed too (L3).
-/mob/living/basic/bounty_criminal/proc/ai_set_pace(new_speed)
+/// Walks (calm, BOUNTY_CALM_SPEED or slower) or runs (anything quicker) from now on: tg's move intent, nothing faster.
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_set_pace(new_speed)
ai_pace = new_speed
- if(speed != new_speed)
- set_varspeed(new_speed)
+ bounty_ai_set_pace(src, new_speed)
/**
* Takes them out of blending in: P6's act ends with it, and they never go back to the routine (a
* P6 exposure has already cleared `blended` by the time on_confronted() runs). Not for decoys, who
* are always patrons (bounty_activities.dm).
*/
-/mob/living/basic/bounty_criminal/proc/ai_expose()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_expose()
ai_end_blend()
/**
@@ -385,7 +342,7 @@
* pathfinder's own step check), and never leaves their site. Built once per flight, never per tick
* (H1). get_path_to() can't be used here: it sleeps, and planning must not.
*/
-/mob/living/basic/bounty_criminal/proc/ai_reachable_turfs(radius)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_reachable_turfs(radius)
. = list()
var/turf/start = get_turf(src)
if(!start)
@@ -407,10 +364,10 @@
queue += next
/// Gets out of the way of `threat` without looking for somewhere to hide (a decoy that stopped blending in)
-/mob/living/basic/bounty_criminal/proc/ai_flee_from(mob/living/threat)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_flee_from(mob/living/threat)
if(!isliving(threat) || !ai_flee_event(threat, null, seek_hiding = FALSE, quiet = TRUE))
return FALSE
- ai_set_pace(BOUNTY_NORMAL_SPEED_MELEE)
+ ai_set_pace(BOUNTY_RUN_SPEED)
return TRUE
/**
@@ -420,7 +377,7 @@
* blended in (a fugitive at a trader outpost only reacts to a warrant or a blow), fleeing or
* fighting. Returns the nearest one found, or null.
*/
-/mob/living/basic/bounty_criminal/proc/ai_look_around()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_look_around()
if(blended || ai_mode == BOUNTY_AI_FLEEING || ai_mode == BOUNTY_AI_FIGHTING)
return null
if(world.time < ai_next_notice)
@@ -459,7 +416,7 @@
* - Friendly fire from their own side of the site with nobody playing it (the pirates they are
* aboard with, the site's fauna) is let go (M1).
*/
-/mob/living/basic/bounty_criminal/proc/ai_attacked_by(mob/living/attacker)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_attacked_by(mob/living/attacker)
if(stat == DEAD || blended || !isliving(attacker) || bounty_ai_same_gang(src, attacker))
return
if(bounty_ai_friendly_fire(src, attacker))
@@ -476,88 +433,95 @@
ai_react(attacker, null)
/// Attacked while already running or fighting
-/mob/living/basic/bounty_criminal/proc/ai_attacked_again(mob/living/attacker)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_attacked_again(mob/living/attacker)
return
/// Someone touched them without attacking: a hider is found by it
-/mob/living/basic/bounty_criminal/proc/ai_touched_by(mob/living/toucher)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_touched_by(mob/living/toucher)
if(hidden && ai_hide_mode != BOUNTY_HIDE_CONTAINER)
ai_reveal(toucher, "touched")
/// Someone walked into them: a hider is found by it
-/mob/living/basic/bounty_criminal/proc/ai_bumped_by(mob/living/bumper)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_bumped_by(mob/living/bumper)
if(hidden && ai_hide_mode != BOUNTY_HIDE_CONTAINER && bounty_ai_is_hunter(bumper))
ai_reveal(bumper, "bumped")
-/// They are about to take damage. Inside a signal handler: must not sleep.
-/mob/living/basic/bounty_criminal/proc/ai_took_damage(damage, damagetype)
+/// They took a hit of `damage` `damagetype`. Inside a signal handler: must not sleep.
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_took_damage(damage, damagetype)
return
-/// Down at the downed line (P2's COMSIG_BOUNTY_CRIMINAL_DOWNED): they drop everything, a shot or a wind-up included. The body says the line (body_go_down()).
-/mob/living/basic/bounty_criminal/proc/ai_on_downed()
+/// Into crit (the core's COMSIG_BOUNTY_CRIMINAL_DOWNED): whatever they were doing stops, a shot or a wind-up included. The body says the line.
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_on_downed()
ai_let_go()
if(!QDELETED(ai_controller))
ai_controller.CancelActions()
ai_companions_lose_heart()
/**
- * Back up after the recovery time (P2's COMSIG_BOUNTY_CRIMINAL_RECOVERED): they run or fight again.
+ * Out of crit or back up from stamina crit (COMSIG_BOUNTY_CRIMINAL_RECOVERED): they run or fight again.
* Blended in, they only go back to the blend routine, like any patron (M2).
*/
-/mob/living/basic/bounty_criminal/proc/ai_on_recovered()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_on_recovered()
if(blended || !ai_can_act())
return
ai_react(ai_threat() || ai_nearest_grudge(), "recover")
-/// Cuffed (P2's COMSIG_BOUNTY_CRIMINAL_RESTRAINED). The body says the line (body_apply_cuffs()).
-/mob/living/basic/bounty_criminal/proc/ai_on_restrained(mob/living/user)
+/// Cuffed (COMSIG_BOUNTY_CRIMINAL_RESTRAINED). The body says the line.
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_on_restrained(mob/living/user)
ai_let_go()
if(!QDELETED(ai_controller))
ai_controller.CancelActions()
ai_add_grudge(user)
ai_companions_lose_heart()
-/// Cuffs off (P2's COMSIG_BOUNTY_CRIMINAL_UNRESTRAINED): if they slipped them, they make a break for it
-/mob/living/basic/bounty_criminal/proc/ai_on_unrestrained(mob/living/user)
+/// Cuffs off (COMSIG_BOUNTY_CRIMINAL_UNRESTRAINED): if they got out of them themselves, they make a break for it
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_on_unrestrained(mob/living/user)
if(user)
return
- REMOVE_TRAIT(src, TRAIT_BOUNTY_SURRENDERED, BOUNTY_TRAIT)
- ai_over_head = bounty_ai_update_held(src, ai_over_head, null)
if(!blended && ai_can_act())
ai_react(ai_nearest_grudge(), null)
+/// They gave up (tg's *surrender, run by the human NPC base): hands on their head, the fight dropped, their friends lose heart
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_on_surrendered()
+ visible_message(span_notice("[src] raises [p_their()] hands and gives up."))
+ ai_stop_aiming()
+ ai_suspend_activity()
+ if(!QDELETED(ai_controller))
+ ai_controller.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET)
+ ai_controller.clear_blackboard_key(BB_BOUNTY_DESTINATION)
+ ai_controller.ai_movement?.stop_moving_towards(ai_controller)
+ ai_companions_lose_heart()
+
/// Dead: they let go of everything, and a disguise comes off, so the body looks like them
-/mob/living/basic/bounty_criminal/proc/ai_on_death()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_on_death()
ai_let_go()
- ai_over_head = bounty_ai_update_held(src, ai_over_head, null)
/**
* Drops everything they are doing: out of hiding (looks restored), no aim, the activity put away
- * (drink down, standing up), nothing in their hand, not sprinting. Safe to call at any time,
+ * (drink down, up from a seat or the floor). What they hold stays in their hands: their gear is locked
+ * to them (D3), and a person who is down or cuffed can't holster anything. Safe to call at any time,
* including while they are being deleted.
*/
-/mob/living/basic/bounty_criminal/proc/ai_let_go()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_let_go()
if(hidden)
ai_unhide()
ai_stop_aiming()
ai_suspend_activity()
// Off the floor from a retreat's rest too, not only an activity's (L9)
ai_stand_up()
- ai_hand = bounty_ai_update_held(src, ai_hand, null)
- REMOVE_TRAIT(src, TRAIT_BOUNTY_SPRINTING, BOUNTY_AI_TRAIT)
if(!QDELETED(ai_controller))
ai_controller.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET)
ai_controller.clear_blackboard_key(BB_BASIC_MOB_FLEE_TARGET)
ai_controller.clear_blackboard_key(BB_BOUNTY_HIDE_SPOT)
ai_controller.clear_blackboard_key(BB_BOUNTY_DESTINATION)
-/// Nothing is after them any more: back to what they were doing, at an easy pace
-/mob/living/basic/bounty_criminal/proc/ai_calm_down()
+/// Nothing is after them any more: weapon away, back to what they were doing, at a walk
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_calm_down()
ai_set_mode(BOUNTY_AI_CALM)
ai_set_threat(null)
ai_stop_aiming()
- REMOVE_TRAIT(src, TRAIT_BOUNTY_SPRINTING, BOUNTY_AI_TRAIT)
- ai_hand = bounty_ai_update_held(src, ai_hand, null)
+ if(ai_can_act() && !HAS_TRAIT(src, TRAIT_HANDS_BLOCKED))
+ bounty_ai_holster(src)
ai_set_pace(BOUNTY_CALM_SPEED)
if(!QDELETED(ai_controller))
ai_controller.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET)
@@ -566,7 +530,7 @@
ai_controller.clear_blackboard_key(BB_BOUNTY_DESTINATION)
/// A walk the AI set up failed; after a few, they give up on it
-/mob/living/basic/bounty_criminal/proc/ai_travel_failed()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_travel_failed()
if(++ai_travel_failures < BOUNTY_TRAVEL_GIVE_UP)
return
ai_travel_failures = 0
@@ -579,39 +543,44 @@
ai_activity?.spot_unreachable()
/// Their companions, as mobs that still exist
-/mob/living/basic/bounty_criminal/proc/ai_companions()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_companions()
. = list()
for(var/datum/weakref/ref as anything in companions)
- var/mob/living/basic/bounty_companion/buddy = ref?.resolve()
+ var/mob/living/carbon/human/npc/bounty_companion/buddy = ref?.resolve()
if(!QDELETED(buddy))
. += buddy
/// Tells every companion to go for `target`: the trooper reinforcement pattern, without a view() scan
-/mob/living/basic/bounty_criminal/proc/ai_rally_companions(mob/living/target)
- for(var/mob/living/basic/bounty_companion/buddy as anything in ai_companions())
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_rally_companions(mob/living/target)
+ for(var/mob/living/carbon/human/npc/bounty_companion/buddy as anything in ai_companions())
buddy.ai_join_fight(target)
/// Their criminal is down, cuffed or gave up: each companion may run for it
-/mob/living/basic/bounty_criminal/proc/ai_companions_lose_heart()
- for(var/mob/living/basic/bounty_companion/buddy as anything in ai_companions())
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_companions_lose_heart()
+ for(var/mob/living/carbon/human/npc/bounty_companion/buddy as anything in ai_companions())
buddy.ai_lose_heart()
/// Whether they may fire at `target` now. A meek criminal only fires its cornered volley.
-/mob/living/basic/bounty_criminal/proc/ai_may_shoot(atom/target)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_may_shoot(atom/target)
return TRUE
// ===== TARGETING AND MOVEMENT =====
/**
* Who a criminal or a companion may fight: tg's rules (in sight, not in godmode), plus
- * bounty_ai_may_hit() (the body's rules on who is fair game, never their own gang), and never a
- * downed hunter (BB_TARGET_MINIMUM_STAT is CONSCIOUS, spec C4). A pilot is fought through their
- * mech (H4): tg's own mech branch tests the pilot with no sight range and never passes, so a mech
- * is judged here, as P4 does for bosses.
+ * bounty_ai_may_hit() (the body's rules on who is fair game, never their own gang), and never someone
+ * who is down (BB_TARGET_MINIMUM_STAT is CONSCIOUS: the human NPC base's HUMAN_NPC_SPARES_DOWNED, spec
+ * C4). A check made without a range uses the sight range (BB_AGGRO_RANGE), as the human NPC base's
+ * targeting does, and never picks someone in another packed encounter. This is the only gate on whom
+ * a blow or a shot is aimed at: the body then clicks the target like a player. A pilot is fought
+ * through their mech (H4): tg's own mech branch tests the pilot with no sight range and never
+ * passes, so a mech is judged here, as P4 does for bosses.
*/
/datum/targeting_strategy/basic/bounty
/datum/targeting_strategy/basic/bounty/can_attack(mob/living/living_mob, atom/the_target, vision_range)
+ if(isnull(vision_range))
+ vision_range = living_mob.ai_controller?.blackboard[BB_AGGRO_RANGE] || BOUNTY_FIGHT_VISION
if(ismecha(the_target))
return mech_attackable(living_mob, the_target, vision_range)
. = ..()
@@ -620,6 +589,8 @@
var/mob/living/person = the_target
if(isliving(person) && ismecha(person.loc))
return FALSE
+ if(map_region_excludes_turf(map_region_for_turf(get_turf(living_mob)), get_turf(the_target)))
+ return FALSE
return bounty_ai_may_hit(living_mob, the_target)
/// A mech in sight with someone awake aboard who is fair game
@@ -634,9 +605,11 @@
return FALSE
/**
- * Smart pathing that stays on their site (AR-E1): a step off the leash (P2's leash_ok(): the site's
- * bounds, never a ship, hangar or player outpost) is refused. Paths are bounded by
- * AI_MAX_PATH_LENGTH like any jps mover.
+ * Smart pathing that stays on their site (AR-E1, CR-19): a step the body's leash refuses is never
+ * taken (body_move_allowed(): onto the site always, off it never, and an off-site body only back
+ * toward it and never into a hazard or another ship). This is the leash; the body has no Move()
+ * override, so drags, carries and shoves are tg's. Paths are bounded by AI_MAX_PATH_LENGTH like any
+ * jps mover.
*/
/datum/ai_movement/jps/bounty
@@ -647,8 +620,8 @@
var/list/path = source.movement_path
if(!length(path))
return
- var/mob/living/basic/bounty_criminal/leash_holder = bounty_ai_side_of(source.moving)
- if(leash_holder && !leash_holder.leash_ok(path[1]))
+ var/mob/living/mover = source.moving
+ if(isliving(mover) && !bounty_ai_step_allowed(mover, path[1]))
return FALSE
/// Now and then a step in some direction, while nothing else is planned: never off the leash, never while hiding, cuffed or down
@@ -658,39 +631,36 @@
/datum/idle_behavior/bounty_wander/perform_idle_behavior(seconds_per_tick, datum/ai_controller/controller)
. = ..()
- var/mob/living/basic/wanderer = controller.pawn
- if(!istype(wanderer) || !isturf(wanderer.loc) || wanderer.buckled || wanderer.pulledby || LAZYLEN(wanderer.do_afters))
+ var/mob/living/carbon/human/wanderer = controller.pawn
+ if(!istype(wanderer) || wanderer.stat != CONSCIOUS || !isturf(wanderer.loc) || wanderer.buckled || wanderer.pulledby || wanderer.resting || LAZYLEN(wanderer.do_afters))
return
if(!(wanderer.mobility_flags & MOBILITY_MOVE) || !SPT_PROB(walk_chance, seconds_per_tick))
return
- if(istype(wanderer, /mob/living/basic/bounty_criminal))
- var/mob/living/basic/bounty_criminal/criminal = wanderer
+ if(istype(wanderer, /mob/living/carbon/human/npc/bounty_criminal))
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = wanderer
if(criminal.hidden || !criminal.ai_can_act() || criminal.ai_activity)
return
- else if(istype(wanderer, /mob/living/basic/bounty_companion))
- var/mob/living/basic/bounty_companion/companion = wanderer
- if(companion.ai_gave_up)
+ else if(istype(wanderer, /mob/living/carbon/human/npc/bounty_companion))
+ var/mob/living/carbon/human/npc/bounty_companion/companion = wanderer
+ if(!companion.ai_can_fight())
return
- var/mob/living/basic/bounty_criminal/side = bounty_ai_side_of(wanderer)
- var/move_dir = pick(GLOB.alldirs)
- var/turf/destination = get_step(wanderer, move_dir)
+ var/turf/destination = get_step(wanderer, pick(GLOB.alldirs))
if(!destination?.can_cross_safely(wanderer))
return
- if(side && !side.leash_ok(destination))
- return
- wanderer.Move(destination, move_dir)
+ bounty_ai_step(wanderer, destination)
// ===== PLANNING =====
/**
- * First in every criminal's tree. Nothing is planned while they are dead, downed, restrained or
- * surrendered; a hidden criminal only keeps still (and checks whether it has been found); one
- * shut in something they can't get out of waits.
+ * First of a criminal's own subtrees, after the human NPC base's soft crit and the core's
+ * bounty_escape_captivity. Nothing is planned while they can't act (in crit, cuffed, stunned, giving
+ * up); a hidden criminal only keeps still (and checks whether it has been found); one shut in
+ * something they can't get out of waits.
*/
/datum/ai_planning_subtree/bounty_gate
/datum/ai_planning_subtree/bounty_gate/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/bounty_criminal/criminal = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = controller.pawn
if(!istype(criminal))
return
if(!criminal.ai_can_act())
@@ -706,7 +676,7 @@
/datum/ai_planning_subtree/bounty_notice
/datum/ai_planning_subtree/bounty_notice/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/bounty_criminal/criminal = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = controller.pawn
var/mob/living/hunter = criminal.ai_look_around()
if(hunter)
criminal.ai_notice(hunter)
@@ -716,11 +686,11 @@
action_cooldown = 1 SECONDS
/datum/ai_behavior/bounty_stay_hidden/setup(datum/ai_controller/controller)
- var/mob/living/basic/bounty_criminal/criminal = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = controller.pawn
return istype(criminal) && criminal.hidden
/datum/ai_behavior/bounty_stay_hidden/perform(seconds_per_tick, datum/ai_controller/controller)
- var/mob/living/basic/bounty_criminal/criminal = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = controller.pawn
if(!criminal.hidden)
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED
criminal.ai_hidden_tick()
@@ -732,9 +702,9 @@
behavior_flags = AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
/datum/ai_behavior/bounty_watch/perform(seconds_per_tick, datum/ai_controller/controller)
- var/mob/living/basic/bounty_criminal/criminal = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = controller.pawn
var/mob/living/threat = istype(criminal) ? criminal.ai_threat() : null
- if(threat && bounty_ai_dist(criminal, threat) <= BOUNTY_FIGHT_VISION)
+ if(threat && bounty_ai_dist(criminal, threat) <= BOUNTY_FIGHT_VISION && !criminal.buckled)
criminal.face_atom(bounty_ai_target_for(threat))
return AI_BEHAVIOR_DELAY
@@ -760,7 +730,7 @@
var/atom/target = controller.blackboard[target_key]
var/stuck = !succeeded && controller.consecutive_pathing_attempts > 0 && target && controller.current_movement_target == target
. = ..()
- var/mob/living/basic/bounty_criminal/criminal = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = controller.pawn
if(!istype(criminal))
return
if(succeeded)
@@ -775,74 +745,69 @@
// ===== CONTROLLERS =====
/**
- * What every bounty fighter's controller shares, criminals and companions alike: who they may
- * fight, smart pathing on the leash, and the signal hooks for styles and for being attacked. The
- * hooks are registered by the controller, never by the mob on itself, so they never collide with
- * the body's own registrations (a second RegisterSignal from the same datum replaces the first).
- *
- * Attacks are read from the attack signals themselves (items, hands, mobs, shots that landed,
- * thrown things) rather than relay_attackers, whose projectile hook fires even for a shot that
- * passes through a blended patron.
+ * What every bounty fighter's controller shares, criminals and companions alike, on a human pawn
+ * (contract 2.4): the human NPC base's run check (cuffs and soft crit don't switch the AI off, so it can
+ * work at its cuffs and crawl), who they may fight, smart pathing on the leash, and the signal hooks for
+ * being attacked. The hooks are registered by the controller, never by the mob on itself, so they
+ * never collide with the body's own registrations (a second RegisterSignal from the same datum
+ * replaces the first).
*
* Who they fight comes from their grudge list and retaliation only, filtered by the body's
* may_attack() and their own gang, so faction is ignored in targeting: a criminal shares
* FACTION_NEUTRAL with players until the placement sets otherwise, and would never hit back.
+ *
+ * Every planning list starts with the human NPC base's soft-crit subtree, then the core's
+ * bounty_escape_captivity (it works at its cuffs and breaks grabs, but never climbs out of a locker it
+ * hid in or off a chair it sat on).
*/
/datum/ai_controller/basic_controller/bounty
blackboard = list(
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/bounty,
- BB_TARGET_MINIMUM_STAT = CONSCIOUS,
+ BB_TARGET_MINIMUM_STAT = HUMAN_NPC_SPARES_DOWNED,
+ BB_AGGRO_RANGE = BOUNTY_FIGHT_VISION,
BB_BASIC_MOB_FLEE_DISTANCE = BOUNTY_FLEE_DISTANCE,
BB_ALWAYS_IGNORE_FACTION = TRUE,
)
ai_movement = /datum/ai_movement/jps/bounty
idle_behavior = /datum/idle_behavior/bounty_wander
- /// Whether the mob carries a ranged_attacks component, for a ranged style or the holdout. A tree with a ranged subtree needs it at init.
- var/armed = TRUE
/datum/ai_controller/basic_controller/bounty/TryPossessPawn(atom/new_pawn)
- if(!isbasicmob(new_pawn))
+ if(!ishumannpc(new_pawn))
return AI_CONTROLLER_INCOMPATIBLE
- var/mob/living/basic/fighter = new_pawn
- if(armed)
- fighter.AddComponent(/datum/component/ranged_attacks, projectile_type = /obj/projectile/bullet/bounty)
- RegisterSignal(fighter, COMSIG_HOSTILE_PRE_ATTACKINGTARGET, PROC_REF(on_pre_melee))
- RegisterSignal(fighter, COMSIG_HOSTILE_POST_ATTACKINGTARGET, PROC_REF(on_post_melee))
- RegisterSignal(fighter, COMSIG_BASICMOB_PRE_ATTACK_RANGED, PROC_REF(on_pre_ranged))
- RegisterSignal(fighter, COMSIG_BASICMOB_POST_ATTACK_RANGED, PROC_REF(on_post_ranged))
- RegisterSignal(fighter, COMSIG_PROJECTILE_FIRER_BEFORE_FIRE, PROC_REF(on_fire))
- RegisterSignal(fighter, COMSIG_ATOM_DIR_CHANGE, PROC_REF(on_turned))
+ var/mob/living/carbon/human/npc/fighter = new_pawn
RegisterSignal(fighter, COMSIG_ATOM_AFTER_ATTACKEDBY, PROC_REF(on_attacked_by_item))
RegisterSignal(fighter, COMSIG_ATOM_ATTACK_HAND, PROC_REF(on_touched))
- // A basic mob's blow reaches attack_animal() too, so this one signal covers both kinds of mob
- RegisterSignal(fighter, COMSIG_ATOM_ATTACK_ANIMAL, PROC_REF(on_attacked_by_mob))
+ RegisterSignals(fighter, list(COMSIG_ATOM_ATTACK_ANIMAL, COMSIG_ATOM_ATTACK_BASIC_MOB), PROC_REF(on_attacked_by_mob))
RegisterSignal(fighter, COMSIG_ATOM_ATTACK_MECH, PROC_REF(on_attacked_by_mech))
RegisterSignal(fighter, COMSIG_ATOM_BULLET_ACT, PROC_REF(on_shot))
RegisterSignal(fighter, COMSIG_ATOM_HITBY, PROC_REF(on_hit_by_thrown))
- RegisterSignal(fighter, COMSIG_MOB_APPLY_DAMAGE, PROC_REF(on_damage))
+ RegisterSignal(fighter, COMSIG_MOB_AFTER_APPLY_DAMAGE, PROC_REF(on_damage))
RegisterSignal(fighter, SIGNAL_ADDTRAIT(TRAIT_FLOORED), PROC_REF(on_floored))
return ..()
/datum/ai_controller/basic_controller/bounty/UnpossessPawn(destroy)
if(pawn)
UnregisterSignal(pawn, list(
- COMSIG_HOSTILE_PRE_ATTACKINGTARGET,
- COMSIG_HOSTILE_POST_ATTACKINGTARGET,
- COMSIG_BASICMOB_PRE_ATTACK_RANGED,
- COMSIG_BASICMOB_POST_ATTACK_RANGED,
- COMSIG_PROJECTILE_FIRER_BEFORE_FIRE,
- COMSIG_ATOM_DIR_CHANGE,
COMSIG_ATOM_AFTER_ATTACKEDBY,
COMSIG_ATOM_ATTACK_HAND,
COMSIG_ATOM_ATTACK_ANIMAL,
+ COMSIG_ATOM_ATTACK_BASIC_MOB,
COMSIG_ATOM_ATTACK_MECH,
COMSIG_ATOM_BULLET_ACT,
COMSIG_ATOM_HITBY,
- COMSIG_MOB_APPLY_DAMAGE,
+ COMSIG_MOB_AFTER_APPLY_DAMAGE,
SIGNAL_ADDTRAIT(TRAIT_FLOORED),
))
return ..()
+// The basic controller's own check, except that cuffs and soft crit don't stop us (human NPC base, contract 2.4)
+/datum/ai_controller/basic_controller/bounty/get_able_to_run()
+ return human_npc_ai_able_to_run(src)
+
+/datum/ai_controller/basic_controller/bounty/on_stat_changed(mob/living/source, new_stat)
+ . = ..()
+ human_npc_ai_stat_changed(src, new_stat)
+
/// Whether the pawn may land a blow or a shot on `target` (a companion fights on when its criminal is down, H3)
/datum/ai_controller/basic_controller/bounty/proc/may_strike(atom/target)
return bounty_ai_may_hit(pawn, target)
@@ -859,50 +824,10 @@
/datum/ai_controller/basic_controller/bounty/proc/pawn_touched(mob/living/toucher)
return
-/// The pawn is about to take `damage` of `damagetype`. Called inside the signal handler: must not sleep.
+/// The pawn just took `damage` of `damagetype` (its health already shows it). Inside the signal handler: must not sleep.
/datum/ai_controller/basic_controller/bounty/proc/pawn_damaged(damage, damagetype)
return
-/// Moves what the pawn holds to the hand on the side it is turning to (`facing`)
-/datum/ai_controller/basic_controller/bounty/proc/place_held(facing)
- return
-
-/datum/ai_controller/basic_controller/bounty/proc/on_pre_melee(mob/living/basic/source, atom/target, proximity, list/modifiers)
- SIGNAL_HANDLER
- if(!may_strike(target))
- return COMPONENT_HOSTILE_NO_ATTACK
- // Each swing picks one of the weapon's own verbs, as a player's does
- bounty_ai_real_weapon(source)?.pick_verb(source)
- return NONE
-
-/datum/ai_controller/basic_controller/bounty/proc/on_post_melee(mob/living/basic/source, atom/target, result)
- SIGNAL_HANDLER
- if(!result || !isliving(target))
- return
- var/datum/bounty_style/style = bounty_ai_style(source)
- if(style)
- INVOKE_ASYNC(style, TYPE_PROC_REF(/datum/bounty_style, on_melee_hit), source, target)
-
-/datum/ai_controller/basic_controller/bounty/proc/on_pre_ranged(mob/living/basic/source, atom/target, list/modifiers)
- SIGNAL_HANDLER
- return may_shoot(target) ? NONE : COMPONENT_CANCEL_RANGED_ATTACK
-
-/datum/ai_controller/basic_controller/bounty/proc/on_post_ranged(mob/living/basic/source, atom/target, list/modifiers)
- SIGNAL_HANDLER
- var/datum/bounty_style/style = bounty_ai_style(source)
- style?.after_shot(source)
-
-/datum/ai_controller/basic_controller/bounty/proc/on_fire(mob/living/basic/source, obj/projectile/shot, atom/fired_from, atom/original)
- SIGNAL_HANDLER
- var/datum/bounty_style/style = bounty_ai_style(source)
- style?.prepare_projectile(source, shot)
-
-/// Sent before the turn lands, so the new direction is passed on rather than read off the mob
-/datum/ai_controller/basic_controller/bounty/proc/on_turned(atom/source, old_dir, new_dir)
- SIGNAL_HANDLER
- if(old_dir != new_dir)
- place_held(new_dir)
-
/datum/ai_controller/basic_controller/bounty/proc/on_attacked_by_item(atom/source, obj/item/weapon, mob/living/attacker, list/modifiers)
SIGNAL_HANDLER
if(weapon?.force && isliving(attacker))
@@ -919,12 +844,8 @@
/datum/ai_controller/basic_controller/bounty/proc/on_attacked_by_mob(atom/source, mob/living/attacker)
SIGNAL_HANDLER
- if(!isliving(attacker))
+ if(!isliving(attacker) || attacker.melee_damage_upper <= 0)
return
- if(isbasicmob(attacker))
- var/mob/living/basic/basic_attacker = attacker
- if(basic_attacker.melee_damage_upper <= 0)
- return
INVOKE_ASYNC(src, PROC_REF(pawn_attacked), attacker)
/// A mech's blow is its pilot's (H4)
@@ -934,7 +855,7 @@
if(attacker)
INVOKE_ASYNC(src, PROC_REF(pawn_attacked), attacker)
-/// Only a shot that actually hit: one that passed through a blended patron never gets here. A mech's gunfire is its pilot's (H4).
+/// A shot that hit them. A mech's gunfire is its pilot's (H4).
/datum/ai_controller/basic_controller/bounty/proc/on_shot(atom/source, obj/projectile/shot, def_zone, piercing_hit, blocked)
SIGNAL_HANDLER
if(!shot.is_hostile_projectile())
@@ -961,8 +882,12 @@
if(isliving(thrower))
INVOKE_ASYNC(src, PROC_REF(pawn_attacked), thrower)
+/// Any damage landed: the hit is noted (a wind-up it lands in is fumbled, bounty_styles.dm)
/datum/ai_controller/basic_controller/bounty/proc/on_damage(atom/source, damage, damagetype, def_zone, blocked, wound_bonus, exposed_wound_bonus, sharpness, attack_direction, attacking_item)
SIGNAL_HANDLER
+ if(damage <= 0)
+ return
+ set_blackboard_key(BB_BOUNTY_HIT_AT, world.time)
pawn_damaged(damage, damagetype)
/**
@@ -971,23 +896,25 @@
* bounty_activities.dm). can_idle stays TRUE, as for every basic mob.
*/
/datum/ai_controller/basic_controller/bounty/criminal
- armed = FALSE
planning_subtrees = list(
+ /datum/ai_planning_subtree/human_npc_soft_crit,
+ /datum/ai_planning_subtree/bounty_escape_captivity,
+ /datum/ai_planning_subtree/human_npc_walk_out,
/datum/ai_planning_subtree/bounty_gate,
/datum/ai_planning_subtree/bounty_activity,
)
/datum/ai_controller/basic_controller/bounty/criminal/TryPossessPawn(atom/new_pawn)
- if(!istype(new_pawn, /mob/living/basic/bounty_criminal))
+ if(!istype(new_pawn, /mob/living/carbon/human/npc/bounty_criminal))
return AI_CONTROLLER_INCOMPATIBLE
- var/mob/living/basic/bounty_criminal/criminal = new_pawn
- RegisterSignal(criminal, COMSIG_PROJECTILE_PREHIT, PROC_REF(on_prehit))
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = new_pawn
RegisterSignal(criminal, COMSIG_ATOM_CAN_BE_PULLED, PROC_REF(on_pull_check))
RegisterSignal(criminal, COMSIG_ATOM_BUMPED, PROC_REF(on_bumped))
RegisterSignal(criminal, COMSIG_BOUNTY_CRIMINAL_DOWNED, PROC_REF(on_downed))
RegisterSignal(criminal, COMSIG_BOUNTY_CRIMINAL_RECOVERED, PROC_REF(on_recovered))
RegisterSignal(criminal, COMSIG_BOUNTY_CRIMINAL_RESTRAINED, PROC_REF(on_restrained))
RegisterSignal(criminal, COMSIG_BOUNTY_CRIMINAL_UNRESTRAINED, PROC_REF(on_unrestrained))
+ RegisterSignal(criminal, COMSIG_HUMAN_NPC_SURRENDERED, PROC_REF(on_surrendered))
criminal.ai_set_pace(BOUNTY_CALM_SPEED)
// Spec section 3: they don't fight the hostiles native to their site. The placement adds the
// site's own factions (pirates) on top.
@@ -998,100 +925,85 @@
return ..()
/datum/ai_controller/basic_controller/bounty/criminal/UnpossessPawn(destroy)
- var/mob/living/basic/bounty_criminal/criminal = pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = pawn
if(istype(criminal))
UnregisterSignal(criminal, list(
- COMSIG_PROJECTILE_PREHIT,
COMSIG_ATOM_CAN_BE_PULLED,
COMSIG_ATOM_BUMPED,
COMSIG_BOUNTY_CRIMINAL_DOWNED,
COMSIG_BOUNTY_CRIMINAL_RECOVERED,
COMSIG_BOUNTY_CRIMINAL_RESTRAINED,
COMSIG_BOUNTY_CRIMINAL_UNRESTRAINED,
+ COMSIG_HUMAN_NPC_SURRENDERED,
))
- // Anything they hold goes, and a disguise comes off: this runs before the mob's contents are deleted.
+ // A disguise comes off, a hiding place is left: this runs before the mob's contents are deleted.
criminal.ai_let_go()
- criminal.ai_over_head = bounty_ai_update_held(criminal, criminal.ai_over_head, null)
// Their camp stays as it is, but the fire burns down
criminal.ai_put_out_camp()
return ..()
/datum/ai_controller/basic_controller/bounty/criminal/on_stat_changed(mob/living/source, new_stat)
. = ..()
- var/mob/living/basic/bounty_criminal/criminal = pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = pawn
if(istype(criminal) && criminal.stat == DEAD)
criminal.ai_on_death()
/// No blow from someone giving up, cuffed, down, hidden or passing as a patron
/datum/ai_controller/basic_controller/bounty/criminal/may_strike(atom/target)
- var/mob/living/basic/bounty_criminal/criminal = pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = pawn
if(!istype(criminal) || !criminal.ai_can_act() || criminal.hidden || criminal.blended)
return FALSE
return ..()
/datum/ai_controller/basic_controller/bounty/criminal/may_shoot(atom/target)
- var/mob/living/basic/bounty_criminal/criminal = pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = pawn
if(!istype(criminal) || !criminal.ai_may_shoot(target))
return FALSE
return ..()
/datum/ai_controller/basic_controller/bounty/criminal/pawn_attacked(mob/living/attacker)
- var/mob/living/basic/bounty_criminal/criminal = pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = pawn
if(istype(criminal))
criminal.ai_attacked_by(attacker)
/datum/ai_controller/basic_controller/bounty/criminal/pawn_touched(mob/living/toucher)
- var/mob/living/basic/bounty_criminal/criminal = pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = pawn
if(istype(criminal))
criminal.ai_touched_by(toucher)
/datum/ai_controller/basic_controller/bounty/criminal/pawn_damaged(damage, damagetype)
- var/mob/living/basic/bounty_criminal/criminal = pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = pawn
if(istype(criminal))
criminal.ai_took_damage(damage, damagetype)
-/datum/ai_controller/basic_controller/bounty/criminal/place_held(facing)
- var/mob/living/basic/bounty_criminal/criminal = pawn
- if(istype(criminal))
- bounty_ai_place_held(criminal, criminal.ai_hand, facing)
-
-/// A shot passes through a blended patron (the fugitive or a decoy) it was not aimed at (AR-C7)
-/datum/ai_controller/basic_controller/bounty/criminal/proc/on_prehit(mob/living/basic/bounty_criminal/source, obj/projectile/shot)
+/// Pulling at a hider finds them (CR-8: the pull itself is tg's and goes ahead)
+/datum/ai_controller/basic_controller/bounty/criminal/proc/on_pull_check(mob/living/carbon/human/npc/bounty_criminal/source, mob/living/user)
SIGNAL_HANDLER
- if(source.blended && shot.original != source)
- return PROJECTILE_INTERRUPT_HIT_PHASE
+ if(source.hidden && isliving(user))
+ INVOKE_ASYNC(source, TYPE_PROC_REF(/mob/living/carbon/human/npc/bounty_criminal, ai_reveal), user, "pulled")
return NONE
-/**
- * Pulling at a hider finds them (P2 sends the signal before its own refusal, L1). Who may pull a
- * blended patron is P2's rule (body_can_be_dragged(): a downed one can be dragged, AR-C7) and P6's
- * act, never decided here.
- */
-/datum/ai_controller/basic_controller/bounty/criminal/proc/on_pull_check(mob/living/basic/bounty_criminal/source, mob/living/user)
+/datum/ai_controller/basic_controller/bounty/criminal/proc/on_bumped(mob/living/carbon/human/npc/bounty_criminal/source, atom/movable/bumper)
SIGNAL_HANDLER
- if(source.hidden)
- if(isliving(user))
- INVOKE_ASYNC(source, TYPE_PROC_REF(/mob/living/basic/bounty_criminal, ai_reveal), user, "pulled")
- return COMSIG_ATOM_CANT_PULL
- return NONE
+ if(source.hidden && isliving(bumper))
+ INVOKE_ASYNC(source, TYPE_PROC_REF(/mob/living/carbon/human/npc/bounty_criminal, ai_bumped_by), bumper)
-/datum/ai_controller/basic_controller/bounty/criminal/proc/on_bumped(mob/living/basic/bounty_criminal/source, atom/movable/bumper)
+/datum/ai_controller/basic_controller/bounty/criminal/proc/on_downed(mob/living/carbon/human/npc/bounty_criminal/source)
SIGNAL_HANDLER
- if(source.hidden && isliving(bumper))
- INVOKE_ASYNC(source, TYPE_PROC_REF(/mob/living/basic/bounty_criminal, ai_bumped_by), bumper)
+ INVOKE_ASYNC(source, TYPE_PROC_REF(/mob/living/carbon/human/npc/bounty_criminal, ai_on_downed))
-/datum/ai_controller/basic_controller/bounty/criminal/proc/on_downed(mob/living/basic/bounty_criminal/source)
+/datum/ai_controller/basic_controller/bounty/criminal/proc/on_recovered(mob/living/carbon/human/npc/bounty_criminal/source)
SIGNAL_HANDLER
- INVOKE_ASYNC(source, TYPE_PROC_REF(/mob/living/basic/bounty_criminal, ai_on_downed))
+ INVOKE_ASYNC(source, TYPE_PROC_REF(/mob/living/carbon/human/npc/bounty_criminal, ai_on_recovered))
-/datum/ai_controller/basic_controller/bounty/criminal/proc/on_recovered(mob/living/basic/bounty_criminal/source)
+/datum/ai_controller/basic_controller/bounty/criminal/proc/on_restrained(mob/living/carbon/human/npc/bounty_criminal/source, mob/living/user)
SIGNAL_HANDLER
- INVOKE_ASYNC(source, TYPE_PROC_REF(/mob/living/basic/bounty_criminal, ai_on_recovered))
+ INVOKE_ASYNC(source, TYPE_PROC_REF(/mob/living/carbon/human/npc/bounty_criminal, ai_on_restrained), user)
-/datum/ai_controller/basic_controller/bounty/criminal/proc/on_restrained(mob/living/basic/bounty_criminal/source, mob/living/user)
+/datum/ai_controller/basic_controller/bounty/criminal/proc/on_unrestrained(mob/living/carbon/human/npc/bounty_criminal/source, mob/living/user)
SIGNAL_HANDLER
- INVOKE_ASYNC(source, TYPE_PROC_REF(/mob/living/basic/bounty_criminal, ai_on_restrained), user)
+ INVOKE_ASYNC(source, TYPE_PROC_REF(/mob/living/carbon/human/npc/bounty_criminal, ai_on_unrestrained), user)
-/datum/ai_controller/basic_controller/bounty/criminal/proc/on_unrestrained(mob/living/basic/bounty_criminal/source, mob/living/user)
+/datum/ai_controller/basic_controller/bounty/criminal/proc/on_surrendered(mob/living/carbon/human/npc/bounty_criminal/source)
SIGNAL_HANDLER
- INVOKE_ASYNC(source, TYPE_PROC_REF(/mob/living/basic/bounty_criminal, ai_on_unrestrained), user)
+ INVOKE_ASYNC(source, TYPE_PROC_REF(/mob/living/carbon/human/npc/bounty_criminal, ai_on_surrendered))
diff --git a/voidcrew/modules/bounties/bounty_ai_human.dm b/voidcrew/modules/bounties/bounty_ai_human.dm
new file mode 100644
index 00000000000..ba71cdb90f2
--- /dev/null
+++ b/voidcrew/modules/bounties/bounty_ai_human.dm
@@ -0,0 +1,210 @@
+/**
+ * # Bounty hunting: AI pieces for human bodies
+ *
+ * Owner: P2 body. Shared by every bounty AI controller (criminals, companions, decoys, mini-bosses,
+ * the kingpin's crew, the mafia club), whose pawns are real humans (voidcrew/modules/human_npcs/).
+ *
+ * - Breaking free (bounty_escape_captivity): tg's escape_captivity, without the cases that would undo
+ * what a criminal chose to do: it never resists out of a chair it sat down on or a locker it hid in.
+ * It works at its cuffs (tg's breakout times), breaks grabs by anyone it may fight, and squirms off a
+ * carrier's shoulders, the way a player does.
+ * - Self-treatment (N6, bounty_treat_self): hurt, with nothing it can see attacking it, it uses what it
+ * carries on itself the way a player does: a medipen through the human NPC base's
+ * human_npc_treat_self ("use in hand"), a bruise pack, ointment, suture or mesh clicked on itself on its
+ * worst limb (tg's own self-treatment delay). No heal comes from anywhere else.
+ * - Injectors (bounty_ai_use_injector()): a boss's stimulant at the start of a fight, a meek criminal's
+ * stimpack as it bolts: a real pen, used on itself.
+ */
+
+// ===== BREAKING FREE =====
+
+/datum/ai_planning_subtree/bounty_escape_captivity
+ /// Blackboard key of the targeting strategy that says whose grab it fights
+ var/targeting_strategy_key = BB_TARGETING_STRATEGY
+
+/datum/ai_planning_subtree/bounty_escape_captivity/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/carbon/pawn = controller.pawn
+ if(!iscarbon(pawn) || pawn.stat != CONSCIOUS)
+ return
+ if(HAS_TRAIT(pawn, TRAIT_RESTRAINED))
+ controller.queue_behavior(/datum/ai_behavior/resist)
+ return SUBTREE_RETURN_FINISH_PLANNING
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = istype(pawn, /mob/living/carbon/human/npc/bounty_criminal) ? pawn : null
+ // Shut in something it didn't choose to hide in: it gets out the way a person does.
+ if(!isturf(pawn.loc) && !ismob(pawn.loc) && !criminal?.hidden)
+ controller.queue_behavior(/datum/ai_behavior/resist)
+ return SUBTREE_RETURN_FINISH_PLANNING
+ var/datum/targeting_strategy/strategy = GET_TARGETING_STRATEGY(controller.blackboard[targeting_strategy_key])
+ var/mob/living/puller = pawn.pulledby
+ if(puller && puller.grab_state > GRAB_PASSIVE && bounty_ai_fights_holder(pawn, puller, strategy))
+ controller.queue_behavior(/datum/ai_behavior/resist)
+ return SUBTREE_RETURN_FINISH_PLANNING
+ // Over someone's shoulders, or on a buckle it didn't sit down on, it gets off.
+ if(ismob(pawn.buckled))
+ if(bounty_ai_fights_holder(pawn, pawn.buckled, strategy))
+ controller.queue_behavior(/datum/ai_behavior/resist)
+ return SUBTREE_RETURN_FINISH_PLANNING
+ else if(pawn.buckled?.buckle_requires_restraints)
+ controller.queue_behavior(/datum/ai_behavior/resist)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/// Whether `pawn` fights its way out of `holder`'s hold: someone it may fight, or any player while it is wanted
+/proc/bounty_ai_fights_holder(mob/living/pawn, mob/living/holder, datum/targeting_strategy/strategy)
+ if(!isliving(holder) || holder == pawn || pawn.faction_check_atom(holder))
+ return FALSE
+ if(strategy?.can_attack(pawn, holder))
+ return TRUE
+ return !isnull(holder.mind) || !isnull(holder.client)
+
+// ===== SELF-TREATMENT (N6) =====
+
+/**
+ * Hurt and unthreatened, it treats itself with what it carries. Put it after the fight subtrees: it
+ * only plans when nothing before it did, and never with a living hostile in sight that has hurt it.
+ */
+/datum/ai_planning_subtree/bounty_treat_self
+
+/datum/ai_planning_subtree/bounty_treat_self/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/carbon/pawn = controller.pawn
+ if(!iscarbon(pawn) || pawn.stat != CONSCIOUS || HAS_TRAIT(pawn, TRAIT_HANDS_BLOCKED) || LAZYLEN(pawn.do_afters))
+ return
+ if(world.time < controller.blackboard[BB_HUMAN_NPC_NEXT_TREAT])
+ return
+ if(pawn.health > pawn.maxHealth * BOUNTY_TREAT_SELF_BELOW)
+ return
+ if(controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET))
+ return
+ if(bounty_ai_queue_treat_self(controller))
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/**
+ * Queues the best treatment `controller`'s pawn carries for itself: a medipen with something in it, else
+ * a medical stack that suits its worst hurt. Returns TRUE if it queued one. For a retreat that wants to
+ * patch up where it sits.
+ */
+/proc/bounty_ai_queue_treat_self(datum/ai_controller/controller)
+ var/mob/living/carbon/pawn = controller.pawn
+ if(!iscarbon(pawn) || world.time < controller.blackboard[BB_HUMAN_NPC_NEXT_TREAT])
+ return FALSE
+ var/obj/item/reagent_containers/hypospray/medipen/pen = bounty_ai_find_medipen(pawn)
+ if(pen)
+ controller.set_blackboard_key(BB_HUMAN_NPC_TREAT_ITEM, pen)
+ controller.queue_behavior(/datum/ai_behavior/human_npc_treat_self, BB_HUMAN_NPC_TREAT_ITEM)
+ return TRUE
+ var/obj/item/stack/medical/stack = bounty_ai_find_medical_stack(pawn)
+ if(stack)
+ controller.set_blackboard_key(BB_HUMAN_NPC_TREAT_ITEM, stack)
+ controller.queue_behavior(/datum/ai_behavior/bounty_apply_medical, BB_HUMAN_NPC_TREAT_ITEM)
+ return TRUE
+ // Nothing to use: it doesn't look again for a while.
+ controller.set_blackboard_key(BB_HUMAN_NPC_NEXT_TREAT, world.time + BOUNTY_TREAT_SELF_COOLDOWN)
+ return FALSE
+
+/// A medipen it carries with something healing in it (not a stimulant: those are for a fight), that it can reach
+/proc/bounty_ai_find_medipen(mob/living/carbon/pawn)
+ for(var/obj/item/reagent_containers/hypospray/medipen/pen in pawn.get_all_contents_type(/obj/item/reagent_containers/hypospray/medipen))
+ if(pen.used_up || !pen.reagents?.total_volume || bounty_ai_is_stimulant(pen))
+ continue
+ if(pawn.is_holding(pen) || human_npc_can_draw(pawn, pen))
+ return pen
+ return null
+
+/// Whether `pen` is a stimulant (a fight drug), not a treatment
+/proc/bounty_ai_is_stimulant(obj/item/reagent_containers/hypospray/medipen/pen)
+ return istype(pen, /obj/item/reagent_containers/hypospray/medipen/stimpack) || istype(pen, /obj/item/reagent_containers/hypospray/medipen/stimulants) || istype(pen, /obj/item/reagent_containers/hypospray/medipen/methamphetamine)
+
+/// A medical stack it carries and can reach that treats the kind of hurt it has most of
+/proc/bounty_ai_find_medical_stack(mob/living/carbon/pawn)
+ var/burnt = pawn.getFireLoss() > pawn.getBruteLoss()
+ var/obj/item/stack/medical/fallback
+ for(var/obj/item/stack/medical/stack in pawn.get_all_contents_type(/obj/item/stack/medical))
+ if(stack.amount <= 0 || !(pawn.is_holding(stack) || human_npc_can_draw(pawn, stack)))
+ continue
+ if((burnt && stack.heal_burn > 0) || (!burnt && stack.heal_brute > 0))
+ return stack
+ fallback ||= stack
+ return fallback
+
+/// The limb of `pawn` with the most brute and burn on it, or the chest
+/proc/bounty_ai_worst_limb(mob/living/carbon/pawn)
+ var/obj/item/bodypart/worst
+ var/worst_damage = 0
+ for(var/obj/item/bodypart/limb as anything in pawn.bodyparts)
+ var/damage = limb.brute_dam + limb.burn_dam
+ if(damage > worst_damage)
+ worst = limb
+ worst_damage = damage
+ return worst?.body_zone || BODY_ZONE_CHEST
+
+/**
+ * Applies a medical stack to itself the way a player does: takes it in hand (holstering its gun if both
+ * hands are full), aims at its worst limb and clicks itself with it. tg's own self-treatment do_after
+ * runs; the AI waits through it.
+ */
+/datum/ai_behavior/bounty_apply_medical
+ action_cooldown = 1 SECONDS
+ behavior_flags = AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
+
+/datum/ai_behavior/bounty_apply_medical/perform(seconds_per_tick, datum/ai_controller/controller, item_key)
+ var/mob/living/carbon/pawn = controller.pawn
+ var/obj/item/stack/medical/stack = controller.blackboard[item_key]
+ if(!istype(stack) || QDELETED(stack) || human_npc_holding(stack) != pawn || pawn.stat != CONSCIOUS)
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ if(LAZYLEN(pawn.do_afters))
+ return AI_BEHAVIOR_DELAY
+ if(pawn.health > pawn.maxHealth * BOUNTY_TREAT_SELF_BELOW && !pawn.is_holding(stack))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
+ if(!pawn.is_holding(stack))
+ if(!length(pawn.get_empty_held_indexes()))
+ var/obj/item/gun/gun = human_npc_held_gun(pawn)
+ var/obj/item/stowed = gun || human_npc_held_melee_weapon(pawn)
+ if(isnull(stowed) || !stowed.equip_to_best_slot(pawn))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ return AI_BEHAVIOR_DELAY
+ if(!human_npc_take_in_hand(pawn, stack))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ return AI_BEHAVIOR_DELAY
+ // One application per go; it puts the rest away after.
+ if(controller.blackboard[BB_BOUNTY_TREAT_APPLIED])
+ if(!stack.equip_to_best_slot(pawn))
+ pawn.dropItemToGround(stack)
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
+ if(!human_npc_ready_item(pawn, stack) || pawn.next_move > world.time)
+ return AI_BEHAVIOR_DELAY
+ pawn.zone_selected = bounty_ai_worst_limb(pawn)
+ controller.set_blackboard_key(BB_BOUNTY_TREAT_APPLIED, TRUE)
+ controller.ai_interact(target = pawn, combat_mode = FALSE)
+ return AI_BEHAVIOR_DELAY
+
+/datum/ai_behavior/bounty_apply_medical/finish_action(datum/ai_controller/controller, succeeded, item_key)
+ . = ..()
+ controller.clear_blackboard_key(item_key)
+ controller.clear_blackboard_key(BB_BOUNTY_TREAT_APPLIED)
+ controller.set_blackboard_key(BB_HUMAN_NPC_NEXT_TREAT, world.time + BOUNTY_TREAT_SELF_COOLDOWN)
+
+// ===== INJECTORS =====
+
+/**
+ * Has `controller`'s pawn inject `pen` (a medipen or autoinjector it carries) into itself, with a
+ * visible emote first: a boss's combat stimulant, a meek criminal's stimpack as it bolts. A real pen and
+ * a real dose; what it does is the reagent's. Returns TRUE if the injection is queued.
+ */
+/proc/bounty_ai_use_injector(datum/ai_controller/controller, obj/item/reagent_containers/hypospray/medipen/pen)
+ var/mob/living/carbon/pawn = controller?.pawn
+ if(!iscarbon(pawn) || !istype(pen) || QDELETED(pen) || pen.used_up || !pen.reagents?.total_volume)
+ return FALSE
+ if(human_npc_holding(pen) != pawn || !(pawn.is_holding(pen) || human_npc_can_draw(pawn, pen)))
+ return FALSE
+ pawn.visible_message(span_warning("[pawn] pulls out [pen]."))
+ controller.set_blackboard_key(BB_HUMAN_NPC_TREAT_ITEM, pen)
+ controller.queue_behavior(/datum/ai_behavior/human_npc_treat_self, BB_HUMAN_NPC_TREAT_ITEM)
+ return TRUE
+
+/// The first unused pen of `pen_type` that `pawn` carries and can reach, or null
+/proc/bounty_ai_find_injector(mob/living/carbon/pawn, pen_type = /obj/item/reagent_containers/hypospray/medipen)
+ for(var/obj/item/reagent_containers/hypospray/medipen/pen in pawn.get_all_contents_type(pen_type))
+ if(pen.used_up || !pen.reagents?.total_volume)
+ continue
+ if(pawn.is_holding(pen) || human_npc_can_draw(pawn, pen))
+ return pen
+ return null
diff --git a/voidcrew/modules/bounties/bounty_ai_meek.dm b/voidcrew/modules/bounties/bounty_ai_meek.dm
index b27ae351772..798ace46139 100644
--- a/voidcrew/modules/bounties/bounty_ai_meek.dm
+++ b/voidcrew/modules/bounties/bounty_ai_meek.dm
@@ -3,26 +3,32 @@
*
* Owner: P3 AI. Do not edit this file outside P3.
*
- * What it owns: the meek archetype (spec section 3, C6):
- * - sprinting faster than a runner, getting winded, and getting the sprint back by resting or
- * hiding (TRAIT_BOUNTY_SPRINTING while running flat out, for the body's dodge);
+ * What it owns: the meek archetype (spec section 3, C6, defaults CR-14):
+ * - running at a person's run, nothing faster. When they bolt they jab the stimpack they carry (a real
+ * pen, ephedrine and coffee) if they still have it; worn out (tg's own stamina slowdown) they say so.
+ * Their dodge is a real Slipwire implant (npc_cyberware), the shared dodge arbiter's, which an EMP
+ * stops; it burns out when they die;
* - noticing hunters, and choosing the best hiding place ONCE per flight within
- * BOUNTY_MEEK_HIDE_RADIUS, on their site: a locker or crate (in, and shut), a potted plant (they
- * take it and pass as it), a dark tile (they stand still, faded);
- * - being found (the container opened; bumped, touched, pulled, hit or examined up close; a light
- * coming near), which shoves the finder back a tile and sends them running again;
+ * BOUNTY_MEEK_HIDE_RADIUS, on their site: a locker or crate (in, and shut: a real move into it), a
+ * potted plant (picked up and held in both hands: tg's own disguise, the plant's tactical
+ * component, which makes whoever holds it look and read like the plant), a dark tile (they stand
+ * still, faded);
+ * - being found (the container opened; bumped, touched, pulled, hit or examined up close; the plant
+ * knocked out of their hands; a light coming near), which shoves the finder (a real shove) and sends
+ * them running again;
* - a restless tell while hidden a long time, so a search can end;
- * - cornered: a shout, a short aim with the holdout (the telegraph), a quick volley, then
- * running again. A stamina hit during the aim makes them fumble it; each shot checks they can
- * still shoot.
- * It never loots and never attacks first.
+ * - cornered: a shout, the holdout out of their pocket and aimed (the telegraph), then a quick volley
+ * of real trigger pulls, then the gun goes back in the pocket and they run again. A hit during the
+ * aim makes them fumble it; each pull checks they can still shoot.
+ * It never loots and never attacks first. It wears plain clothes for its zone, its tier's armour, the
+ * holdout and its spare magazine, and the stimpack.
*
* The shared vars (`hidden` and the rest) are declared in bounty_types.dm and nowhere else; a var
* only P3 uses has an `ai_` prefix. The hiding procs sit on the base type so the shared hooks
* (attacked, touched, pulled, dead, deleted) can undo them for anyone.
*/
-/mob/living/basic/bounty_criminal
+/mob/living/carbon/human/npc/bounty_criminal
/// How they are hidden while `hidden`: BOUNTY_HIDE_CONTAINER, _PLANT or _DARK
var/ai_hide_mode
/// Weakref to what they hide in or as: the closet, the plant or the turf
@@ -37,14 +43,12 @@
var/ai_next_restless = 0
/// world.time they next check whether it is quiet enough to come out
var/ai_next_quiet_check = 0
- /// Their own look, kept while they pass as a plant or stand faded in the dark
- var/list/ai_disguise_saved
- /// Deciseconds of sprint left
- var/ai_sprint_left = BOUNTY_MEEK_SPRINT_TIME
- /// Out of breath: slow until the sprint is all back
+ /// Their alpha before they stood faded in the dark
+ var/ai_saved_alpha
+ /// Out of breath (tg's stamina slowdown), and said so
var/ai_winded = FALSE
- /// world.time the sprint was last worked out
- var/ai_sprint_checked_at = 0
+ /// A fresh flight: they jab their stimpack, if they still have one
+ var/ai_bolting = FALSE
/// world.time this cornering began, or 0
var/ai_cornered_since = 0
/// world.time running away last failed, or 0
@@ -53,29 +57,33 @@
var/ai_holdout_ready_at = 0
/// Aiming the holdout: world.time the shots go off, or 0
var/ai_aim_until = 0
+ /// world.time the aim began
+ var/ai_aim_from = 0
/// Their stamina loss when the aim began: any more at the shot and they fumble it
var/ai_aim_stamina = 0
/// Weakref to who they aim at
var/datum/weakref/ai_aim_ref
- /// Shots of the volley still to fire, and when the next goes
+ /// Trigger pulls of the volley still to come, and when the next goes
var/ai_volley_left = 0
var/ai_next_volley_shot = 0
/// Weakref to who the volley is at
var/datum/weakref/ai_volley_ref
- /// Set only while a volley shot is being fired, so no other shot gets out
- var/ai_firing = FALSE
#ifdef UNIT_TESTS
/// Unit tests only: turfs that read as dark. The test room is fullbright, so nothing is dark there otherwise.
GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
#endif
-/mob/living/basic/bounty_criminal/meek
+/mob/living/carbon/human/npc/bounty_criminal/meek
ai_controller = /datum/ai_controller/basic_controller/bounty/criminal/meek
+ // OC-6 ruling: their dodge is real chrome, the shared arbiter's (voidcrew/modules/cyberware/ware_pro_combat.dm)
+ npc_cyberware = list(/obj/item/organ/cyberimp/cyberware/slipwire)
/datum/ai_controller/basic_controller/bounty/criminal/meek
- armed = TRUE
planning_subtrees = list(
+ /datum/ai_planning_subtree/human_npc_soft_crit,
+ /datum/ai_planning_subtree/bounty_escape_captivity,
+ /datum/ai_planning_subtree/human_npc_walk_out,
/datum/ai_planning_subtree/bounty_gate,
/datum/ai_planning_subtree/bounty_meek_volley,
/datum/ai_planning_subtree/bounty_notice,
@@ -85,27 +93,31 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
/datum/ai_planning_subtree/bounty_activity,
)
-/mob/living/basic/bounty_criminal/meek/ai_notice_range()
+/mob/living/carbon/human/npc/bounty_criminal/meek/ai_notice_range()
return BOUNTY_MEEK_NOTICE_RANGE
-/mob/living/basic/bounty_criminal/meek/ai_wanted_style()
+/mob/living/carbon/human/npc/bounty_criminal/meek/ai_wanted_style()
return BOUNTY_STYLE_HOLDOUT
/// The holdout is the same little gun whatever the tier
-/mob/living/basic/bounty_criminal/meek/ai_heavy_weapon()
+/mob/living/carbon/human/npc/bounty_criminal/meek/ai_heavy_weapon()
return FALSE
-/mob/living/basic/bounty_criminal/meek/ai_sprints()
+/// Plain clothes for their zone, their tier's armour, the holdout and its spare, and the stimpack they bolt on
+/mob/living/carbon/human/npc/bounty_criminal/meek/bounty_build_outfit(zone)
+ return bounty_fighter_outfit(BOUNTY_ARCHETYPE_MEEK, zone, record?.tier, BOUNTY_STYLE_HOLDOUT, FALSE, /obj/item/reagent_containers/hypospray/medipen/stimpack)
+
+/mob/living/carbon/human/npc/bounty_criminal/meek/ai_sprints()
return TRUE
-/mob/living/basic/bounty_criminal/meek/ai_notice(mob/living/hunter)
+/mob/living/carbon/human/npc/bounty_criminal/meek/ai_notice(mob/living/hunter)
ai_flee_event(hunter, "noticed")
-/mob/living/basic/bounty_criminal/meek/ai_react(mob/living/threat, bark)
+/mob/living/carbon/human/npc/bounty_criminal/meek/ai_react(mob/living/threat, bark)
ai_flee_event(threat, bark)
/// Hit while running: they run from whoever is closer
-/mob/living/basic/bounty_criminal/meek/ai_attacked_again(mob/living/attacker)
+/mob/living/carbon/human/npc/bounty_criminal/meek/ai_attacked_again(mob/living/attacker)
var/mob/living/threat = ai_threat()
if(!threat || bounty_ai_dist(src, attacker) < bounty_ai_dist(src, threat))
ai_set_threat(attacker)
@@ -113,16 +125,16 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
ai_bark("hurt")
/// Anything that hurts a hider finds them
-/mob/living/basic/bounty_criminal/meek/ai_took_damage(damage, damagetype)
+/mob/living/carbon/human/npc/bounty_criminal/meek/ai_took_damage(damage, damagetype)
if(hidden && damage > 0)
INVOKE_ASYNC(src, PROC_REF(ai_reveal), null, "hurt")
/// Only the cornered volley gets a shot out: they never attack first
-/mob/living/basic/bounty_criminal/meek/ai_may_shoot(atom/target)
- return ai_firing
+/mob/living/carbon/human/npc/bounty_criminal/meek/ai_may_shoot(atom/target)
+ return ai_aim_until || ai_volley_left
-/// Passing as a plant, they look and read like the plant; up close, looking at them gives them away
-/mob/living/basic/bounty_criminal/meek/examine(mob/user)
+/// Behind the plant, they read as the plant; up close, looking at them gives them away
+/mob/living/carbon/human/npc/bounty_criminal/meek/examine(mob/user)
if(!hidden || ai_hide_mode == BOUNTY_HIDE_CONTAINER)
return ..()
if(user && get_dist(user, src) <= 1 && bounty_ai_is_hunter(user))
@@ -135,8 +147,8 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
// ===== RUNNING =====
-/// Whether they sprint and tire (only the meek)
-/mob/living/basic/bounty_criminal/proc/ai_sprints()
+/// Whether they run and hide (only the meek)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_sprints()
return FALSE
/**
@@ -144,7 +156,7 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
* the best hiding place in reach, once for this whole flight. `bark` is the line to shout, or
* null for the usual one on a fresh flight (none if `quiet`).
*/
-/mob/living/basic/bounty_criminal/proc/ai_flee_event(mob/living/threat, bark, seek_hiding = TRUE, quiet = FALSE)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_flee_event(mob/living/threat, bark, seek_hiding = TRUE, quiet = FALSE)
if(!ai_can_act() || hidden)
return FALSE
var/fresh = ai_mode != BOUNTY_AI_FLEEING
@@ -173,70 +185,43 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
else if(fresh && !quiet)
ai_bark("flee")
if(ai_sprints())
- ai_update_sprint()
+ ai_set_pace(BOUNTY_RUN_SPEED)
+ if(fresh && seek_hiding)
+ ai_bolting = TRUE
return TRUE
-/// Their sprint speed: a lizard's is a little quicker
-/mob/living/basic/bounty_criminal/proc/ai_sprint_speed()
- if(ispath(record?.species, /datum/species/lizard))
- return BOUNTY_MEEK_SPRINT_SPEED - BOUNTY_MEEK_LIZARD_SPRINT_BONUS
- return BOUNTY_MEEK_SPRINT_SPEED
-
-/**
- * Works out their sprint since the last time: running in sight of the hunter uses it up, and then
- * they are winded (slow) until it is all back. It comes back fastest hidden, slowly while out of
- * sight but still on the run, and at a rest in BOUNTY_MEEK_REST_TIME. Sets their pace and
- * TRAIT_BOUNTY_SPRINTING while running flat out (never winded, cornered or shooting).
- */
-/mob/living/basic/bounty_criminal/proc/ai_update_sprint()
- var/now = world.time
- var/elapsed = ai_sprint_checked_at ? min(now - ai_sprint_checked_at, 5 SECONDS) : 0
- ai_sprint_checked_at = now
- var/running = ai_mode == BOUNTY_AI_FLEEING && !hidden && !ai_aim_until && !ai_volley_left && !ai_cornered_since && (now - ai_threat_seen_at) <= 1 SECONDS
- if(running)
- if(!ai_winded)
- ai_sprint_left -= elapsed
- else if(hidden)
- ai_sprint_left += elapsed * BOUNTY_MEEK_RECOVER_HIDDEN
- else if(ai_mode == BOUNTY_AI_FLEEING)
- ai_sprint_left += elapsed * BOUNTY_MEEK_RECOVER_WALKING
- else
- ai_sprint_left += elapsed * (BOUNTY_MEEK_SPRINT_TIME / BOUNTY_MEEK_REST_TIME)
- ai_sprint_left = clamp(ai_sprint_left, 0, BOUNTY_MEEK_SPRINT_TIME)
- if(!ai_winded && ai_sprint_left <= 0)
- ai_winded = TRUE
+/// Out of breath: tg's own stamina slowdown has them. They say so once, and again only after getting their breath back.
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_check_winded()
+ var/winded = getStaminaLoss() >= BOUNTY_MEEK_WINDED_STAMINA
+ if(winded == ai_winded)
+ return
+ ai_winded = winded
+ if(winded && stat == CONSCIOUS)
visible_message(span_notice("[src] is out of breath."))
ai_bark("winded")
- else if(ai_winded && ai_sprint_left >= BOUNTY_MEEK_SPRINT_TIME)
- ai_winded = FALSE
- if(running && !ai_winded)
- ADD_TRAIT(src, TRAIT_BOUNTY_SPRINTING, BOUNTY_AI_TRAIT)
- else
- REMOVE_TRAIT(src, TRAIT_BOUNTY_SPRINTING, BOUNTY_AI_TRAIT)
- if(ai_mode == BOUNTY_AI_FLEEING)
- ai_set_pace(ai_winded ? BOUNTY_MEEK_WINDED_SPEED : ai_sprint_speed())
/**
- * The run: to the hiding place chosen for this flight if there is one and it is still good, else
- * away from the hunter while they can see them, else still and catching their breath. Cornered,
- * the holdout comes out. Out of sight long enough, they calm down.
+ * The run: their stimpack first on a fresh flight, then to the hiding place chosen for this flight if
+ * there is one and it is still good, else away from the hunter while they can see them, else still and
+ * catching their breath. Cornered, the holdout comes out. Out of sight long enough, they calm down.
*/
/datum/ai_planning_subtree/bounty_meek_flee
/datum/ai_planning_subtree/bounty_meek_flee/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/bounty_criminal/criminal = controller.pawn
- // A decoy given this tree (P6 gives decoys their fugitive's controller) never sprints, hides or
- // draws: bounty_flee_and_calm, next in the tree, runs it (L6).
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = controller.pawn
+ // A decoy given this tree (P6 gives decoys their fugitive's controller) never hides or draws:
+ // bounty_flee_and_calm, next in the tree, runs it (L6).
if(!criminal.ai_sprints())
return
var/seen = criminal.ai_mode == BOUNTY_AI_FLEEING && criminal.ai_sees_threat(BOUNTY_MEEK_HIDE_RADIUS)
- criminal.ai_update_sprint()
+ criminal.ai_check_winded()
if(criminal.ai_mode != BOUNTY_AI_FLEEING)
return
var/mob/living/threat = criminal.ai_threat()
if(!threat || world.time - criminal.ai_threat_seen_at > BOUNTY_MEEK_CALM_AFTER)
criminal.ai_calm_down()
return
+ criminal.ai_plan_stimpack(controller)
if(seen && criminal.ai_check_cornered(threat))
controller.queue_behavior(/datum/ai_behavior/bounty_holdout_volley)
return SUBTREE_RETURN_FINISH_PLANNING
@@ -263,6 +248,21 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
controller.queue_behavior(/datum/ai_behavior/bounty_watch)
return SUBTREE_RETURN_FINISH_PLANNING
+/**
+ * Bolting: the stimpack they carry, jabbed in as they run (the core's bounty_ai_use_injector(), the human
+ * NPC base's "use in hand"), once per pen. Kept in the plan until the pen is spent.
+ */
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_plan_stimpack(datum/ai_controller/controller)
+ var/obj/item/reagent_containers/hypospray/medipen/pen = controller.blackboard[BB_HUMAN_NPC_TREAT_ITEM]
+ if(istype(pen, /obj/item/reagent_containers/hypospray/medipen/stimpack) && !pen.used_up)
+ controller.queue_behavior(/datum/ai_behavior/human_npc_treat_self, BB_HUMAN_NPC_TREAT_ITEM)
+ return TRUE
+ if(!ai_bolting)
+ return FALSE
+ ai_bolting = FALSE
+ pen = bounty_ai_find_injector(src, /obj/item/reagent_containers/hypospray/medipen/stimpack)
+ return pen && bounty_ai_use_injector(controller, pen)
+
/**
* tg's run away, staying on the site: a leg never goes off the leash, into lava or into a chasm
* (D-A9). When no leg works, the criminal is cornered (ai_run_failed_at).
@@ -273,21 +273,21 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
/datum/ai_behavior/run_away_from_target/bounty/setup(datum/ai_controller/controller, target_key, hiding_location_key)
. = ..()
if(!.)
- var/mob/living/basic/bounty_criminal/criminal = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = controller.pawn
if(istype(criminal))
criminal.ai_run_failed_at = world.time
/datum/ai_behavior/run_away_from_target/bounty/perform(seconds_per_tick, datum/ai_controller/controller, target_key, hiding_location_key)
. = ..()
if(. & AI_BEHAVIOR_FAILED)
- var/mob/living/basic/bounty_criminal/criminal = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = controller.pawn
if(istype(criminal))
criminal.ai_run_failed_at = world.time
/datum/ai_behavior/run_away_from_target/bounty/get_furthest_turf(atom/source, angle, atom/target)
var/turf/return_turf
var/list/airlocks = SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/airlock)
- var/mob/living/basic/bounty_criminal/leash_holder = bounty_ai_side_of(source)
+ var/mob/living/carbon/human/npc/bounty_criminal/leash_holder = bounty_ai_side_of(source)
for(var/i in 1 to run_distance)
var/turf/test_destination = get_ranged_target_turf_direct(source, target, range = i, offset = angle)
if(test_destination.is_blocked_turf(source_atom = source, ignore_atoms = airlocks))
@@ -308,7 +308,7 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
// ===== CORNERED =====
/// How many ways out lead away from `threat`: free, on the leash, and further from them
-/mob/living/basic/bounty_criminal/proc/ai_ways_out(mob/living/threat)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_ways_out(mob/living/threat)
. = 0
var/turf/here = get_turf(src)
if(!here || !threat)
@@ -323,10 +323,9 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
/**
* Whether they are cornered by `threat`, and have been for BOUNTY_MEEK_CORNERED_TIME: the hunter
* close, with running away failing or fewer than two ways out. Once it has lasted, and the holdout
- * is ready, the aim starts. Returns TRUE when it did. Being held no longer counts: a free criminal
- * pulls away from any hand (P2), so a grab only happens while it is stunned and can't act (H2).
+ * is ready, the aim starts. Returns TRUE when it did.
*/
-/mob/living/basic/bounty_criminal/proc/ai_check_cornered(mob/living/threat)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_check_cornered(mob/living/threat)
if(!ai_sprints() || world.time < ai_holdout_ready_at || !threat || !ai_can_act())
ai_cornered_since = 0
return FALSE
@@ -347,73 +346,100 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
return FALSE
return ai_start_aim(threat)
-/// The aim: the holdout in hand, a mark where it points, a shout. The shots start BOUNTY_MEEK_PISTOL_WINDUP later. Never from the floor (H2).
-/mob/living/basic/bounty_criminal/proc/ai_start_aim(mob/living/target)
- if(!ai_sprints() || ai_aim_until || ai_volley_left || !ai_can_act() || !isturf(loc) || !isliving(target))
+/// The holdout they carry (in hand, a pocket or the fanny pack), or null
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_holdout()
+ var/datum/bounty_style/style = GLOB.bounty_styles[BOUNTY_STYLE_HOLDOUT]
+ for(var/obj/item/gun/ballistic/gun as anything in get_all_contents_type(style.weapon_type))
+ if(is_holding(gun) || human_npc_can_draw(src, gun))
+ return gun
+ return null
+
+/**
+ * The aim: the holdout out of their pocket and into their hand, a mark where it points, a shout. The
+ * shots start BOUNTY_MEEK_PISTOL_WINDUP later. Never from the floor (H2), never with an empty gun.
+ */
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_start_aim(mob/living/target)
+ if(!ai_sprints() || ai_aim_until || ai_volley_left || !ai_can_act() || !isturf(loc) || !isliving(target) || HAS_TRAIT(src, TRAIT_HANDS_BLOCKED))
return FALSE
ai_update_style()
+ var/obj/item/gun/ballistic/gun = ai_holdout()
+ if(!gun || !(gun.can_shoot() || human_npc_gun_needs_rack(gun)))
+ return FALSE
+ if(!is_holding(gun))
+ if(!length(get_empty_held_indexes()))
+ bounty_ai_free_other_hand(src, null)
+ if(!human_npc_take_in_hand(src, gun))
+ return FALSE
+ if(human_npc_gun_needs_rack(gun))
+ human_npc_ready_item(src, gun)
+ gun.attack_self(src)
ai_aim_ref = WEAKREF(target)
ai_aim_until = world.time + BOUNTY_MEEK_PISTOL_WINDUP
- ai_aim_stamina = staminaloss
+ ai_aim_from = world.time
+ ai_aim_stamina = getStaminaLoss()
ai_cornered_since = 0
- REMOVE_TRAIT(src, TRAIT_BOUNTY_SPRINTING, BOUNTY_AI_TRAIT)
face_atom(bounty_ai_target_for(target))
- ai_hand = bounty_ai_update_held(src, ai_hand, bounty_ai_held_look(src) || /obj/item/gun/ballistic/automatic/pistol)
new /obj/effect/temp_visual/telegraphing/bounty_aim(get_turf(target))
- visible_message(span_danger("[src] pulls out a small pistol and aims it at [target]!"))
+ visible_message(span_danger("[src] pulls out [gun] and aims it at [target]!"))
to_chat(target, span_userdanger("[src] is aiming a pistol at you!"))
playsound(src, 'sound/items/weapons/gun/pistol/rack_small.ogg', 50, TRUE)
- // Forced: the draw is a one-second warning, and a meek criminal has just said "cornered" or "hurt"
+ // Forced: the draw is a half-second warning, and a meek criminal has just said "cornered" or "hurt"
ai_bark("draw_gun", TRUE)
return TRUE
/**
- * The aim is up: the volley starts, BOUNTY_MEEK_PISTOL_SHOTS shots (never more than the holdout's
- * magazine) BOUNTY_MEEK_PISTOL_GAP apart, the first one now. A stamina hit or a stun during the aim
- * makes them fumble it instead. Returns TRUE if the first shot went.
+ * The aim is up: the volley starts, BOUNTY_MEEK_PISTOL_SHOTS trigger pulls (never more than the gun
+ * holds) BOUNTY_MEEK_PISTOL_GAP apart, the first one now. A hit, more stamina loss or a stun during the
+ * aim makes them fumble it instead. Returns TRUE if the first shot went.
*/
-/mob/living/basic/bounty_criminal/proc/ai_fire_holdout()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_fire_holdout()
var/mob/living/target = ai_aim_ref?.resolve()
- var/stunned = !ai_can_act() || staminaloss > ai_aim_stamina + 1 || HAS_TRAIT(src, TRAIT_INCAPACITATED)
+ var/hit_at = ai_controller?.blackboard[BB_BOUNTY_HIT_AT]
+ var/spoiled = !ai_can_act() || getStaminaLoss() > ai_aim_stamina + 1 || HAS_TRAIT(src, TRAIT_INCAPACITATED) || (hit_at && hit_at >= ai_aim_from)
ai_aim_until = 0
ai_aim_ref = null
ai_holdout_ready_at = world.time + BOUNTY_MEEK_PISTOL_COOLDOWN
ai_run_failed_at = 0
- if(stunned)
+ if(spoiled)
ai_fumble()
return FALSE
if(!ai_volley_target_ok(target))
ai_put_gun_away()
return FALSE
- var/datum/bounty_real_weapon/holdout = bounty_ai_real_weapon(src)
- ai_volley_left = holdout?.magazine ? min(BOUNTY_MEEK_PISTOL_SHOTS, holdout.magazine) : BOUNTY_MEEK_PISTOL_SHOTS
+ var/obj/item/gun/ballistic/gun = ai_holdout()
+ var/rounds = istype(gun) ? gun.get_ammo(TRUE) : 0
+ ai_volley_left = clamp(rounds, 0, BOUNTY_MEEK_PISTOL_SHOTS)
ai_volley_ref = WEAKREF(target)
return ai_volley_shot()
/// Whether the volley may go on at `target`: awake (downed hunters are left alone, C4), close and in sight
-/mob/living/basic/bounty_criminal/proc/ai_volley_target_ok(mob/living/target)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_volley_target_ok(mob/living/target)
return !QDELETED(target) && target.stat == CONSCIOUS && bounty_ai_can_see(src, target, BOUNTY_MEEK_PISTOL_RANGE)
/**
- * One shot of the volley, if they can still shoot (on their feet, not hidden) and the target is
- * still there. Returns TRUE if a shot left the gun; a shot the gun refused ends the volley.
+ * One trigger pull of the volley, the player's way (a click with the gun in hand), if they can still
+ * shoot (on their feet, not hidden, the gun in hand and loaded) and the target is still there and
+ * nobody they may not hit stands in the way. Returns TRUE if a round left the gun; a pull that didn't
+ * fire ends the volley.
*/
-/mob/living/basic/bounty_criminal/proc/ai_volley_shot()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_volley_shot()
var/mob/living/target = ai_volley_ref?.resolve()
- if(!ai_volley_left || !ai_can_act() || hidden || !isturf(loc) || !ai_volley_target_ok(target))
+ if(!ai_volley_left || !ai_can_act() || hidden || !isturf(loc) || !ai_volley_target_ok(target) || QDELETED(ai_controller))
ai_end_volley()
return FALSE
- var/datum/component/ranged_attacks/gun = GetComponent(/datum/component/ranged_attacks)
- if(!gun)
+ var/obj/item/gun/ballistic/gun = ai_holdout()
+ if(!istype(gun) || !is_holding(gun) || !gun.can_shoot() || HAS_TRAIT(src, TRAIT_HANDS_BLOCKED))
ai_end_volley()
return FALSE
- face_atom(bounty_ai_target_for(target))
- var/cooldown_before = gun.fire_cooldown
- ai_firing = TRUE
- RangedAttack(bounty_ai_target_for(target))
- ai_firing = FALSE
- // The gun starts its cooldown only when it fires: a refused shot leaves it as it was
- if(gun.fire_cooldown == cooldown_before || gun.fire_cooldown <= world.time)
+ var/atom/aim_at = bounty_ai_target_for(target)
+ face_atom(aim_at)
+ if(bounty_ai_line_blocked(src, aim_at) || !human_npc_ready_item(src, gun))
+ ai_end_volley()
+ return FALSE
+ var/rounds_before = gun.get_ammo(TRUE)
+ zone_selected = human_npc_pick_aim_zone()
+ ai_controller.ai_interact(target = aim_at, combat_mode = TRUE)
+ if(QDELETED(gun) || gun.get_ammo(TRUE) >= rounds_before)
ai_end_volley()
return FALSE
ai_volley_left--
@@ -422,38 +448,41 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
ai_end_volley()
return TRUE
-/// The volley is over (or cut short): the gun goes away a moment later
-/mob/living/basic/bounty_criminal/proc/ai_end_volley()
+/// The volley is over (or cut short): the gun goes back in the pocket a moment later
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_end_volley()
ai_volley_left = 0
ai_volley_ref = null
addtimer(CALLBACK(src, PROC_REF(ai_put_gun_away)), 0.5 SECONDS, TIMER_DELETE_ME)
-/// A stamina hit or a stun during the aim: the volley never happens and they run
-/mob/living/basic/bounty_criminal/proc/ai_fumble()
+/// A hit, more stamina loss or a stun during the aim: the volley never happens and they run
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_fumble()
ai_aim_until = 0
ai_aim_ref = null
ai_volley_left = 0
ai_volley_ref = null
ai_holdout_ready_at = max(ai_holdout_ready_at, world.time + BOUNTY_MEEK_PISTOL_COOLDOWN)
- ai_hand = bounty_ai_update_held(src, ai_hand, null)
- if(stat != DEAD)
- visible_message(span_notice("[src] fumbles the pistol!"))
+ if(stat == DEAD)
+ return
+ visible_message(span_notice("[src] fumbles the pistol!"))
+ ai_put_gun_away()
-/// Puts the holdout away after the volley
-/mob/living/basic/bounty_criminal/proc/ai_put_gun_away()
- if(ai_aim_until || ai_volley_left || ai_mode == BOUNTY_AI_FIGHTING)
+/// Puts the holdout back in a pocket after the volley, when they can
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_put_gun_away()
+ if(ai_aim_until || ai_volley_left || ai_mode == BOUNTY_AI_FIGHTING || HAS_TRAIT(src, TRAIT_HANDS_BLOCKED))
return
- ai_hand = bounty_ai_update_held(src, ai_hand, null)
+ var/obj/item/gun/gun = ai_holdout()
+ if(gun && is_holding(gun))
+ gun.equip_to_best_slot(src)
/// Drops the aim and the volley without a word: they calmed down, hid, were cuffed, died
-/mob/living/basic/bounty_criminal/proc/ai_stop_aiming()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_stop_aiming()
if(!ai_aim_until && !ai_volley_left)
return
ai_aim_until = 0
ai_aim_ref = null
ai_volley_left = 0
ai_volley_ref = null
- ai_hand = bounty_ai_update_held(src, ai_hand, null)
+ ai_put_gun_away()
/// The mark where a cornered criminal aims, for the length of the aim
/obj/effect/temp_visual/telegraphing/bounty_aim
@@ -461,25 +490,24 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
/// The volley: first in a meek criminal's tree while an aim or a volley is on
/datum/ai_planning_subtree/bounty_meek_volley
- operational_datums = list(/datum/component/ranged_attacks)
/datum/ai_planning_subtree/bounty_meek_volley/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/bounty_criminal/criminal = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = controller.pawn
if(!criminal.ai_aim_until && !criminal.ai_volley_left)
return
controller.queue_behavior(/datum/ai_behavior/bounty_holdout_volley)
return SUBTREE_RETURN_FINISH_PLANNING
-/// Holds the aim, then fires the volley shot by shot. Cancelled (a stun stops the AI), the aim is fumbled or the volley cut short.
+/// Holds the aim, then fires the volley pull by pull. Cancelled (a stun stops the AI), the aim is fumbled or the volley cut short.
/datum/ai_behavior/bounty_holdout_volley
- action_cooldown = 0.2 SECONDS
+ action_cooldown = 0.1 SECONDS
/datum/ai_behavior/bounty_holdout_volley/setup(datum/ai_controller/controller)
- var/mob/living/basic/bounty_criminal/criminal = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = controller.pawn
return istype(criminal) && (criminal.ai_aim_until || criminal.ai_volley_left)
/datum/ai_behavior/bounty_holdout_volley/perform(seconds_per_tick, datum/ai_controller/controller)
- var/mob/living/basic/bounty_criminal/criminal = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = controller.pawn
if(criminal.ai_aim_until)
if(world.time < criminal.ai_aim_until)
var/mob/living/target = criminal.ai_aim_ref?.resolve()
@@ -499,7 +527,7 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
. = ..()
if(succeeded)
return
- var/mob/living/basic/bounty_criminal/criminal = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = controller.pawn
if(!istype(criminal))
return
if(criminal.ai_aim_until)
@@ -517,7 +545,7 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
* them and out of the hunter's sight is better. Never where they were just found, never off their
* site. Null if nothing will do.
*/
-/mob/living/basic/bounty_criminal/proc/ai_pick_hide_spot(mob/living/threat)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_pick_hide_spot(mob/living/threat)
var/turf/center = get_turf(src)
if(!center)
return null
@@ -553,7 +581,7 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
best = thing
best_score = score
best_stand = stand
- var/dark_bonus = BOUNTY_HIDE_SCORE_DARK + (ispath(record?.species, /datum/species/moth) ? BOUNTY_HIDE_SCORE_MOTH_DARK : 0)
+ var/dark_bonus = BOUNTY_HIDE_SCORE_DARK + (ismoth(src) ? BOUNTY_HIDE_SCORE_MOTH_DARK : 0)
for(var/turf/tile as anything in ai_dark_candidates(reachable))
if(tile == last)
continue
@@ -569,7 +597,7 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
return best
/// How good `spot` is to hide from `threat`, or null if it is no good at all
-/mob/living/basic/bounty_criminal/proc/ai_score_hide_spot(atom/spot, mob/living/threat)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_score_hide_spot(atom/spot, mob/living/threat)
var/turf/spot_turf = get_turf(spot)
if(!spot_turf || spot_turf.z != z)
return null
@@ -587,7 +615,7 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
. += BOUNTY_HIDE_SCORE_UNSEEN
/// Up to `samples` dark tiles they could stand in, sampled once from `reachable` (turf = TRUE, the floor they can walk to)
-/mob/living/basic/bounty_criminal/proc/ai_dark_candidates(list/reachable, samples = BOUNTY_MEEK_DARK_SAMPLES)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_dark_candidates(list/reachable, samples = BOUNTY_MEEK_DARK_SAMPLES)
. = list()
var/list/pool = list()
for(var/turf/tile as anything in reachable)
@@ -602,7 +630,7 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
* Whether `tile` is dark enough to hide in. A turf with no lighting object (planet ground, lit by
* its area's ambient light) reads its area's base light instead, which tg's lumcount skips (L2).
*/
-/mob/living/basic/bounty_criminal/proc/ai_tile_is_dark(turf/tile)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_tile_is_dark(turf/tile)
if(!isturf(tile))
return FALSE
#ifdef UNIT_TESTS
@@ -614,7 +642,7 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
return (tile_area.base_lighting_alpha / 255) + tile.dynamic_lumcount < BOUNTY_MEEK_DARK_LUMCOUNT
return tile.get_lumcount() < BOUNTY_MEEK_DARK_LUMCOUNT
-/mob/living/basic/bounty_criminal/proc/ai_hide_spot_usable(atom/spot)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_hide_spot_usable(atom/spot)
if(QDELETED(spot))
return FALSE
if(istype(spot, /obj/structure/closet))
@@ -629,7 +657,7 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
* A locker or crate they fit in: on the floor, unlocked, not welded, not full, not outpost property,
* not a body bag, and nobody standing in it (shutting it would take them along).
*/
-/mob/living/basic/bounty_criminal/proc/ai_container_usable(obj/structure/closet/container)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_container_usable(obj/structure/closet/container)
if(QDELETED(container) || !isturf(container.loc) || container.locked || container.welded)
return FALSE
if(istype(container, /obj/structure/closet/body_bag) || container.wall_mounted || (container.resistance_flags & INDESTRUCTIBLE))
@@ -647,7 +675,7 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
return leash_ok(get_turf(container))
/// A potted plant on the floor, loose, with nobody standing on it
-/mob/living/basic/bounty_criminal/proc/ai_plant_usable(obj/item/kirbyplants/plant)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_plant_usable(obj/item/kirbyplants/plant)
if(QDELETED(plant) || !isturf(plant.loc) || plant.anchored)
return FALSE
var/turf/plant_turf = plant.loc
@@ -659,15 +687,15 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
return leash_ok(plant_turf)
/// A dark floor tile they can stand on: not space, lava or a chasm, free, on their site
-/mob/living/basic/bounty_criminal/proc/ai_dark_usable(turf/tile)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_dark_usable(turf/tile)
if(!isopenturf(tile) || isspaceturf(tile) || isgroundlessturf(tile) || islava(tile) || ischasm(tile))
return FALSE
if(tile != loc && tile.is_blocked_turf(source_atom = src))
return FALSE
return leash_ok(tile) && ai_tile_is_dark(tile)
-/// Whether they can hide in or as `spot` from where they stand: on the dark tile, or right beside the closet or plant with nothing between (H1)
-/mob/living/basic/bounty_criminal/proc/ai_at_hide_spot(atom/spot)
+/// Whether they can hide in or as `spot` from where they stand: on the dark tile or the plant's, or right beside the closet or plant with nothing between (H1)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_at_hide_spot(atom/spot)
if(!isturf(loc))
return FALSE
if(isturf(spot))
@@ -677,7 +705,7 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
return Adjacent(spot)
/// Where they walk to to hide at `spot`: beside a closet on their side of it (the tile picked with it), onto a plant or a dark tile. Null if there is nowhere.
-/mob/living/basic/bounty_criminal/proc/ai_hide_approach(atom/spot)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_hide_approach(atom/spot)
if(istype(spot, /obj/structure/closet))
if(ai_hide_stand && (ai_hide_stand == loc || ai_standable(ai_hide_stand)) && ai_hide_stand.Adjacent(spot))
return ai_hide_stand
@@ -688,7 +716,7 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
* The tile to stand on to climb into `container`: beside it, free, with no wall, window or rail
* between (so Adjacent() holds from it), and in `reachable` when that is given. Nearest to them.
*/
-/mob/living/basic/bounty_criminal/proc/ai_container_approach(obj/structure/closet/container, list/reachable)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_container_approach(obj/structure/closet/container, list/reachable)
var/turf/container_turf = get_turf(container)
if(!container_turf)
return null
@@ -710,7 +738,7 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
action_cooldown = 0.5 SECONDS
/datum/ai_behavior/bounty_hide/perform(seconds_per_tick, datum/ai_controller/controller, spot_key)
- var/mob/living/basic/bounty_criminal/criminal = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = controller.pawn
var/atom/spot = controller.blackboard[spot_key]
if(QDELETED(spot) || !criminal.ai_hide_in(spot))
controller.clear_blackboard_key(spot_key)
@@ -718,17 +746,15 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED
/**
- * Hides in or as `spot`, from beside it: a closet (in, and shut), a potted plant (theirs now, and
- * so is its look) or a dark turf (still and faded). Returns TRUE if they are hidden.
+ * Hides in or as `spot`, from beside it: a closet (in, and shut), a potted plant (picked up and held
+ * up in front of them) or a dark turf (still and faded). Returns TRUE if they are hidden.
*/
-/mob/living/basic/bounty_criminal/proc/ai_hide_in(atom/spot)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_hide_in(atom/spot)
// Never from the floor: a knockdown is a cuff window (H2)
if(hidden || !ai_can_act() || QDELETED(spot) || !isturf(loc))
return FALSE
ai_suspend_activity()
ai_stop_aiming()
- ai_hand = bounty_ai_update_held(src, ai_hand, null)
- ai_over_head = bounty_ai_update_held(src, ai_over_head, null)
var/done = FALSE
if(istype(spot, /obj/structure/closet))
done = ai_hide_in_container(spot)
@@ -743,7 +769,6 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
ai_next_restless = world.time + BOUNTY_MEEK_RESTLESS_AFTER
ai_next_quiet_check = world.time + BOUNTY_MEEK_COME_OUT_AFTER
ai_cornered_since = 0
- REMOVE_TRAIT(src, TRAIT_BOUNTY_SPRINTING, BOUNTY_AI_TRAIT)
if(!QDELETED(ai_controller))
ai_controller.clear_blackboard_key(BB_BOUNTY_HIDE_SPOT)
ai_controller.clear_blackboard_key(BB_BOUNTY_DESTINATION)
@@ -752,11 +777,12 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
return TRUE
/**
- * In a locker or a crate: opens it if shut, gets in, and shuts it from inside. A crate won't take
- * a standing person the ordinary way, so it is straight insertion for both, then close(). Only
- * from right beside it, with no wall or window between (H1).
+ * In a locker or a crate: opens it if shut, gets in (a real move into it), and pulls it shut from
+ * inside. A crate won't take a standing person the ordinary way, so it is straight in for both, then
+ * close(). Only from right beside it, with no wall or window between (H1). Getting out is the
+ * container opening, as anyone gets out.
*/
-/mob/living/basic/bounty_criminal/proc/ai_hide_in_container(obj/structure/closet/container)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_hide_in_container(obj/structure/closet/container)
if(!ai_container_usable(container) || !Adjacent(container))
return FALSE
ai_stand_up()
@@ -777,10 +803,12 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
return TRUE
/**
- * As a potted plant: they step onto its tile (a real step, from right beside it: H1), take it, keep
- * their own look aside, and wear the plant's: name, description, icon, overlays and layer.
+ * Behind a potted plant: they step onto its tile (a real step, from right beside it: H1), put away what
+ * is in their hands, and pick it up in both hands. The plant's own tactical component (tg's disguise:
+ * whoever holds it up looks like the plant to everyone and goes by its name) does the rest; nothing of
+ * their own look is touched. The plant knocked out of their hands, or put down, gives them away.
*/
-/mob/living/basic/bounty_criminal/proc/ai_hide_as_plant(obj/item/kirbyplants/plant)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_hide_as_plant(obj/item/kirbyplants/plant)
if(!ai_plant_usable(plant))
return FALSE
var/turf/plant_turf = plant.loc
@@ -788,42 +816,28 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
if(!Adjacent(plant))
return FALSE
ai_stand_up()
- Move(plant_turf, get_dir(src, plant_turf))
- if(loc != plant_turf)
+ if(!bounty_ai_step(src, plant_turf) || loc != plant_turf)
return FALSE
ai_stand_up()
- ai_disguise_saved = list(
- "plant_turf" = plant_turf,
- "name" = name,
- "desc" = desc,
- "icon" = icon,
- "icon_state" = icon_state,
- "overlays" = overlays.Copy(),
- "underlays" = underlays.Copy(),
- "layer" = layer,
- "alpha" = alpha,
- )
- plant.forceMove(src)
- if(plant.loc != src)
- ai_disguise_saved = null
- return FALSE
- name = plant.name
- desc = plant.desc
- icon = plant.icon
- icon_state = plant.icon_state
- overlays = plant.overlays.Copy()
- underlays = null
- layer = plant.layer
+ bounty_ai_holster(src)
+ if(length(get_empty_held_indexes()) < 2)
+ bounty_ai_free_other_hand(src, null)
+ if(length(get_empty_held_indexes()) < 2 || !put_in_hands(plant))
+ return FALSE
+ if(!is_holding(plant))
+ return FALSE
+ RegisterSignal(plant, COMSIG_ITEM_DROPPED, PROC_REF(ai_on_plant_dropped))
+ RegisterSignal(plant, COMSIG_QDELETING, PROC_REF(ai_on_plant_dropped))
ai_hide_mode = BOUNTY_HIDE_PLANT
ai_hide_ref = WEAKREF(plant)
return TRUE
/// In the dark: on the tile, still, faded
-/mob/living/basic/bounty_criminal/proc/ai_hide_in_dark(turf/tile)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_hide_in_dark(turf/tile)
if(loc != tile || !ai_dark_usable(tile))
return FALSE
ai_stand_up()
- ai_disguise_saved = list("alpha" = alpha)
+ ai_saved_alpha = alpha
alpha = BOUNTY_MEEK_DARK_ALPHA
setDir(pick(GLOB.cardinals))
ai_hide_mode = BOUNTY_HIDE_DARK
@@ -831,11 +845,10 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
return TRUE
/**
- * Stops hiding: out of the closet if it opens, the plant put back where it stood and their own look
- * back, the fade gone. Welded or locked in, they stay in (and hidden, so opening it later finds
- * them) and it returns FALSE.
+ * Stops hiding: out of the closet if it opens, the plant put down at their feet, the fade gone. Welded
+ * or locked in, they stay in (and hidden, so opening it later finds them) and it returns FALSE.
*/
-/mob/living/basic/bounty_criminal/proc/ai_unhide()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_unhide()
var/atom/spot = ai_hide_ref?.resolve()
switch(ai_hide_mode)
if(BOUNTY_HIDE_CONTAINER)
@@ -850,54 +863,40 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
RegisterSignal(container, COMSIG_QDELETING, PROC_REF(ai_on_container_gone))
return FALSE
if(BOUNTY_HIDE_PLANT)
- // Back where it stood (L8): the outpost's decor stays where the outpost put it
- var/turf/plant_turf = ai_disguise_saved?["plant_turf"]
- ai_restore_look()
var/obj/item/kirbyplants/plant = spot
- if(istype(plant) && plant.loc == src)
- var/atom/put_down = isturf(plant_turf) ? plant_turf : drop_location()
- if(put_down)
- plant.forceMove(put_down)
- else
- qdel(plant)
+ if(istype(plant))
+ UnregisterSignal(plant, list(COMSIG_ITEM_DROPPED, COMSIG_QDELETING))
+ if(is_holding(plant))
+ dropItemToGround(plant)
if(BOUNTY_HIDE_DARK)
- ai_restore_look()
+ if(!isnull(ai_saved_alpha))
+ alpha = ai_saved_alpha
+ ai_saved_alpha = null
hidden = FALSE
ai_hide_mode = null
ai_hide_ref = null
- ai_sprint_checked_at = world.time
return TRUE
-/// Their own look back after passing as a plant or standing faded
-/mob/living/basic/bounty_criminal/proc/ai_restore_look()
- var/list/saved = ai_disguise_saved
- ai_disguise_saved = null
- if(!saved)
- return
- if("icon" in saved)
- name = saved["name"]
- desc = saved["desc"]
- icon = saved["icon"]
- icon_state = saved["icon_state"]
- overlays = saved["overlays"]
- underlays = saved["underlays"]
- layer = saved["layer"]
- alpha = saved["alpha"]
-
-/mob/living/basic/bounty_criminal/proc/ai_on_container_opened(obj/structure/closet/source, mob/living/user, force)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_on_container_opened(obj/structure/closet/source, mob/living/user, force)
SIGNAL_HANDLER
INVOKE_ASYNC(src, PROC_REF(ai_reveal), isliving(user) ? user : null, "opened")
-/mob/living/basic/bounty_criminal/proc/ai_on_container_gone(obj/structure/closet/source)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_on_container_gone(obj/structure/closet/source)
SIGNAL_HANDLER
INVOKE_ASYNC(src, PROC_REF(ai_reveal), null, "opened")
+/// The plant left their hands (knocked away, shoved out of them, broken): they are found
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_on_plant_dropped(obj/item/kirbyplants/source)
+ SIGNAL_HANDLER
+ UnregisterSignal(source, list(COMSIG_ITEM_DROPPED, COMSIG_QDELETING))
+ INVOKE_ASYNC(src, PROC_REF(ai_reveal), null, "dropped")
+
/**
- * Found: out of hiding, a word, the finder shoved back a tile if they are right there (M4), and
- * off again, to a new hiding place. `finder` may be null (a light came, the closet broke). Welded
- * or locked in, they can't get out and stay hidden. Returns TRUE if they came out.
+ * Found: out of hiding, a word, the finder shoved if they are right there (M4, a real shove), and off
+ * again, to a new hiding place. `finder` may be null (a light came, the closet broke). Welded or locked
+ * in, they can't get out and stay hidden. Returns TRUE if they came out.
*/
-/mob/living/basic/bounty_criminal/proc/ai_reveal(mob/living/finder, reason)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_reveal(mob/living/finder, reason)
if(!hidden)
return FALSE
var/mode = ai_hide_mode
@@ -925,30 +924,22 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
ai_flee_event(isliving(finder) ? finder : ai_threat(), "found")
return TRUE
-/// Shoves `finder` back a tile, without a stun, to get a head start; never onto lava, into a chasm or out into space (M5)
-/mob/living/basic/bounty_criminal/proc/ai_shove_away(mob/living/finder)
- bounty_ai_shove_back(src, finder)
- visible_message(span_warning("[src] shoves [finder] back and bolts!"))
- playsound(finder, 'sound/items/weapons/shove.ogg', 50, TRUE)
-
-/// Pushes `victim` a tile away from `shover`, if the tile behind them is safe to stand on (M5). Returns TRUE if they moved.
-/proc/bounty_ai_shove_back(atom/shover, mob/living/victim)
- var/shove_dir = get_dir(shover, victim)
- var/turf/behind = shove_dir && get_step(victim, shove_dir)
- if(!behind || behind.is_blocked_turf(source_atom = victim))
+/// Shoves `finder`, a real shove with an empty hand (tg's own, which may knock them into a wall), to get a head start
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_shove_away(mob/living/finder)
+ if(QDELETED(ai_controller) || !ai_can_act() || !human_npc_ready_empty_hand(src))
return FALSE
- if(isspaceturf(behind) || isopenspaceturf(behind) || isgroundlessturf(behind) || islava(behind) || ischasm(behind) || !behind.can_cross_safely(victim))
- return FALSE
- return victim.Move(behind, shove_dir)
+ face_atom(finder)
+ return ai_controller.ai_interact(target = finder, combat_mode = TRUE, modifiers = list(RIGHT_CLICK = TRUE))
/**
* About once a second while hidden: whether they have been found out (let out of the closet, a
- * light on them), the restless tell, and coming out when it has been quiet for long enough.
+ * light on them, the plant gone from their hands), the restless tell, and coming out when it has been
+ * quiet for long enough.
*/
-/mob/living/basic/bounty_criminal/proc/ai_hidden_tick()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_hidden_tick()
if(!hidden)
return
- ai_update_sprint()
+ ai_check_winded()
var/atom/spot = ai_hide_ref?.resolve()
switch(ai_hide_mode)
if(BOUNTY_HIDE_CONTAINER)
@@ -956,6 +947,10 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
if(!istype(container) || loc != container || container.opened)
ai_reveal(null, "opened")
return
+ if(BOUNTY_HIDE_PLANT)
+ if(!spot || !is_holding(spot))
+ ai_reveal(null, "dropped")
+ return
if(BOUNTY_HIDE_DARK)
if(!ai_tile_is_dark(get_turf(src)))
ai_reveal(null, "light")
@@ -972,7 +967,7 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
* The restless tell (M2): after a while hidden, a noise and a shake of the hiding place every
* BOUNTY_MEEK_RESTLESS_GAP, heard within BOUNTY_MEEK_RESTLESS_RANGE, and now and then a mutter.
*/
-/mob/living/basic/bounty_criminal/proc/ai_restless_tell()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_restless_tell()
var/atom/shaken = src
var/message
switch(ai_hide_mode)
@@ -990,7 +985,7 @@ GLOBAL_LIST_EMPTY(bounty_ai_test_dark_turfs)
ai_bark("hide")
/// Quiet for long enough: they come out and carry on with what they were doing
-/mob/living/basic/bounty_criminal/proc/ai_come_out()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_come_out()
var/mode = ai_hide_mode
var/atom/spot = ai_hide_ref?.resolve()
if(!ai_unhide() || !isturf(loc))
diff --git a/voidcrew/modules/bounties/bounty_ai_normal.dm b/voidcrew/modules/bounties/bounty_ai_normal.dm
index 70aa025207e..6630df3e905 100644
--- a/voidcrew/modules/bounties/bounty_ai_normal.dm
+++ b/voidcrew/modules/bounties/bounty_ai_normal.dm
@@ -7,49 +7,55 @@
* - noticing someone armed (aware: up from what they were doing, watching them), and fighting when
* attacked, confronted, or when someone with a weapon drawn comes within
* BOUNTY_NORMAL_THREAT_RANGE while they are aware;
- * - fighting by style, with its companions called in;
- * - surrendering (TRAIT_BOUNTY_SURRENDERED, source BOUNTY_TRAIT, which P2's capture_state() reads):
- * rolled on the hit that crosses BOUNTY_SURRENDER_BELOW and on later hits, with two hunters near;
- * - breaking off and retreating when badly hurt with nobody near. They never regenerate.
- * It also owns the fighting styles every bounty fighter uses (criminals, companions, the meek's
- * holdout): /datum/bounty_style and their projectiles. Every blow and shot is the real weapon's
- * (bounty_weapons.dm).
+ * - fighting by style with the real weapon they carry (bounty_styles.dm), their companions called in;
+ * - giving up (CR-10): an AI choice followed by tg's *surrender, through the human NPC base
+ * (/datum/human_npc_surrender/bounty below: hurt, with hunters around them, less likely for each
+ * companion still standing). tg's 20 second paralysis is the cuff window; nobody cuffs them in it and
+ * they decide again: give up again, run, or fight on;
+ * - breaking off and retreating when badly hurt with nobody near: they sit down there and patch
+ * themselves up with what they carry (N6), and nothing else heals them;
+ * - what they wear: plain clothes for their zone, their tier's armour, their style's weapon and spares,
+ * and a bruise pack.
*
* The shared vars are declared in bounty_types.dm and nowhere else; a var only P3 uses has an
* `ai_` prefix.
*/
-/mob/living/basic/bounty_criminal
- /// Whether the roll on the hit that crosses the surrender line has been made
- var/ai_surrender_rolled = FALSE
- /// world.time the next surrender roll on a later hit may be made
- var/ai_next_surrender_roll = 0
-
-/mob/living/basic/bounty_criminal/normal
+/mob/living/carbon/human/npc/bounty_criminal/normal
ai_controller = /datum/ai_controller/basic_controller/bounty/criminal/normal
+ npc_surrender = /datum/human_npc_surrender/bounty
/datum/ai_controller/basic_controller/bounty/criminal/normal
- armed = TRUE
planning_subtrees = list(
+ /datum/ai_planning_subtree/human_npc_soft_crit,
+ /datum/ai_planning_subtree/bounty_escape_captivity,
+ /datum/ai_planning_subtree/human_npc_walk_out,
+ /datum/ai_planning_subtree/human_npc_surrender,
/datum/ai_planning_subtree/bounty_gate,
/datum/ai_planning_subtree/bounty_notice,
/datum/ai_planning_subtree/bounty_fight_target,
- /datum/ai_planning_subtree/basic_ranged_attack_subtree/bounty,
- /datum/ai_planning_subtree/basic_melee_attack_subtree/bounty,
+ /datum/ai_planning_subtree/bounty_arm,
+ /datum/ai_planning_subtree/bounty_ranged,
+ /datum/ai_planning_subtree/bounty_melee,
/datum/ai_planning_subtree/bounty_retreat,
+ /datum/ai_planning_subtree/bounty_treat_self,
/datum/ai_planning_subtree/bounty_aware,
// For a decoy on this tree (P6 gives decoys their fugitive's controller): run, then calm down (M3)
/datum/ai_planning_subtree/bounty_flee_and_calm,
/datum/ai_planning_subtree/bounty_activity,
)
-/mob/living/basic/bounty_criminal/normal/ai_wanted_style()
+/mob/living/carbon/human/npc/bounty_criminal/normal/ai_wanted_style()
var/key = record?.style
if(key && key != BOUNTY_STYLE_HOLDOUT && GLOB.bounty_styles[key])
return key
return BOUNTY_STYLE_BRAWLER
-/mob/living/basic/bounty_criminal/normal/ai_notice(mob/living/hunter)
+/// Plain clothes for their zone, their tier's armour, their style's weapon and spares, and a bruise pack
+/mob/living/carbon/human/npc/bounty_criminal/normal/bounty_build_outfit(zone)
+ return bounty_fighter_outfit(BOUNTY_ARCHETYPE_NORMAL, zone, record?.tier, ai_wanted_style(), ai_heavy_weapon(), /obj/item/stack/medical/bruise_pack)
+
+/mob/living/carbon/human/npc/bounty_criminal/normal/ai_notice(mob/living/hunter)
var/mob/living/watched = ai_threat()
if(ai_mode == BOUNTY_AI_CALM || ai_mode == BOUNTY_AI_RETREATING)
ai_become_aware(hunter)
@@ -58,7 +64,7 @@
if(ai_mode == BOUNTY_AI_AWARE && bounty_ai_dist(src, hunter) <= BOUNTY_NORMAL_THREAT_RANGE && bounty_ai_is_armed(hunter, weapons_only = TRUE))
ai_start_fight(hunter)
-/mob/living/basic/bounty_criminal/normal/ai_react(mob/living/threat, bark)
+/mob/living/carbon/human/npc/bounty_criminal/normal/ai_react(mob/living/threat, bark)
if(!ai_can_act())
return
threat = threat || ai_nearest_grudge()
@@ -69,7 +75,7 @@
ai_start_fight(threat, bark)
/// Hit in a fight by someone new: they turn on whoever is closer (a pilot through their mech, H4)
-/mob/living/basic/bounty_criminal/normal/ai_attacked_again(mob/living/attacker)
+/mob/living/carbon/human/npc/bounty_criminal/normal/ai_attacked_again(mob/living/attacker)
if(ai_mode == BOUNTY_AI_FIGHTING)
ai_rally_companions(attacker)
var/mob/living/threat = ai_threat()
@@ -81,13 +87,10 @@
return
ai_start_fight(attacker)
-/mob/living/basic/bounty_criminal/normal/ai_took_damage(damage, damagetype)
- ai_check_surrender(damage, damagetype)
-
// ===== AWARE =====
/// Someone armed caught their eye: they stop what they are doing and keep an eye on them
-/mob/living/basic/bounty_criminal/proc/ai_become_aware(mob/living/hunter)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_become_aware(mob/living/hunter)
if(!ai_can_act())
return
ai_suspend_activity()
@@ -101,7 +104,7 @@
/datum/ai_planning_subtree/bounty_aware
/datum/ai_planning_subtree/bounty_aware/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/bounty_criminal/criminal = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = controller.pawn
if(criminal.ai_mode != BOUNTY_AI_AWARE)
return
criminal.ai_sees_threat(BOUNTY_FIGHT_VISION)
@@ -113,8 +116,12 @@
// ===== FIGHTING =====
-/// Starts (or keeps) fighting `target`: up, weapon out, companions called in, a line for it. A pilot is fought through their mech (H4).
-/mob/living/basic/bounty_criminal/proc/ai_start_fight(mob/living/target, bark)
+/**
+ * Starts (or keeps) fighting `target`: up, at a run, companions called in, a line for it. The weapon
+ * comes out of its holster, pocket or bag through the arm subtree (bounty_styles.dm). A pilot is fought
+ * through their mech (H4).
+ */
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_start_fight(mob/living/target, bark)
if(!ai_can_act() || !isliving(target) || QDELETED(ai_controller))
return FALSE
ai_update_style()
@@ -124,9 +131,7 @@
ai_set_mode(BOUNTY_AI_FIGHTING)
ai_set_threat(target)
ai_add_grudge(target)
- var/datum/bounty_style/style = bounty_ai_style(src)
- ai_set_pace(style?.speed || BOUNTY_NORMAL_SPEED_MELEE)
- ai_hand = bounty_ai_update_held(src, ai_hand, bounty_ai_held_look(src))
+ ai_set_pace(BOUNTY_RUN_SPEED)
if(fresh)
ai_bark(bark || "fight_start")
ai_rally_companions(target)
@@ -137,7 +142,7 @@
* The nearest valid target on their grudge list, keeping the current one while it is still good.
* Someone in a mech is fought through the mech (H4): tg's melee can't reach a pilot inside.
*/
-/mob/living/basic/bounty_criminal/proc/ai_pick_fight_target()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_pick_fight_target()
if(QDELETED(ai_controller))
return null
var/datum/targeting_strategy/strategy = GET_TARGETING_STRATEGY(ai_controller.blackboard[BB_TARGETING_STRATEGY])
@@ -160,7 +165,7 @@
return best
/// The fight is over: nobody on their grudge list seen for a while
-/mob/living/basic/bounty_criminal/proc/ai_fight_over()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_fight_over()
if(ai_should_retreat())
ai_start_retreat(ai_threat())
return
@@ -173,7 +178,7 @@
/datum/ai_planning_subtree/bounty_fight_target
/datum/ai_planning_subtree/bounty_fight_target/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/bounty_criminal/criminal = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = controller.pawn
if(criminal.ai_mode != BOUNTY_AI_FIGHTING)
return
var/atom/target = criminal.ai_pick_fight_target()
@@ -190,201 +195,78 @@
controller.queue_behavior(/datum/ai_behavior/bounty_watch)
return SUBTREE_RETURN_FINISH_PLANNING
-/// Whether a pawn is in a fight it can take part in: a criminal fighting, or a companion that has not broken
-/proc/bounty_ai_fighting(mob/living/basic/fighter)
- if(istype(fighter, /mob/living/basic/bounty_criminal))
- var/mob/living/basic/bounty_criminal/criminal = fighter
- return criminal.ai_mode == BOUNTY_AI_FIGHTING && criminal.ai_can_act()
- if(istype(fighter, /mob/living/basic/bounty_companion))
- var/mob/living/basic/bounty_companion/companion = fighter
- return companion.ai_can_fight()
- return FALSE
-
-/// tg's melee subtree, for melee styles only, and only in a fight
-/datum/ai_planning_subtree/basic_melee_attack_subtree/bounty
-
-/datum/ai_planning_subtree/basic_melee_attack_subtree/bounty/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/datum/bounty_style/style = GLOB.bounty_styles[controller.blackboard[BB_BOUNTY_STYLE]]
- if(!style || style.ranged || !bounty_ai_fighting(controller.pawn))
- return
- return ..()
-
-/// tg's ranged subtree, for ranged styles only, and only in a fight: each style keeps its own distance
-/datum/ai_planning_subtree/basic_ranged_attack_subtree/bounty
- ranged_attack_behavior = /datum/ai_behavior/basic_ranged_attack/bounty
-
-/datum/ai_planning_subtree/basic_ranged_attack_subtree/bounty/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/datum/bounty_style/style = GLOB.bounty_styles[controller.blackboard[BB_BOUNTY_STYLE]]
- if(!style?.ranged || !bounty_ai_fighting(controller.pawn))
- return
- if(!controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET))
- return
- controller.queue_behavior(style.ranged_behavior, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETING_STRATEGY, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION)
- return SUBTREE_RETURN_FINISH_PLANNING
+// ===== SURRENDER (CR-10) =====
/**
- * tg's ranged attack, with the style doing the shooting: its wind-up telegraph, its magazine and
- * reload, through the mob's ranged_attacks component. The pistol keeps BOUNTY_PISTOL_RANGE off and
- * backs off a step when someone gets inside its style's min_range. Planning carries on meanwhile,
- * so a new target, a retreat or a call for help is picked up mid-fight.
+ * When a normal criminal or a companion gives up (defaults CR-10, 1.3): at or below 40% of its health,
+ * with two hunters within seven tiles that it can see; 60% on its first roll of a fight, less 20 for
+ * each companion still standing with it, then 25% every 5 seconds. Through the human NPC base's
+ * human_npc_surrender subtree, which stows the weapon, says the line and runs tg's *surrender.
*/
-/datum/ai_behavior/basic_ranged_attack/bounty
- // Often enough that the pistol fires at its own pace, and its wind-up is never stretched; each tick walks the line of fire (L10)
- action_cooldown = 0.1 SECONDS
- behavior_flags = AI_BEHAVIOR_REQUIRE_MOVEMENT | AI_BEHAVIOR_MOVE_AND_PERFORM | AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
- required_distance = BOUNTY_PISTOL_RANGE
- chase_range = BOUNTY_FIGHT_VISION
- avoid_friendly_fire = TRUE
-
-/datum/ai_behavior/basic_ranged_attack/bounty/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key)
- var/mob/living/basic/fighter = controller.pawn
- var/atom/target = controller.blackboard[target_key]
- var/datum/targeting_strategy/strategy = GET_TARGETING_STRATEGY(controller.blackboard[targeting_strategy_key])
- if(!strategy.can_attack(fighter, target, chase_range))
- return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
- var/datum/bounty_style/style = bounty_ai_style(fighter)
- if(!style?.ranged)
- return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
- if(!can_see(fighter, target, required_distance))
- return AI_BEHAVIOR_INSTANT
- if(style.min_range && get_dist(fighter, target) < style.min_range && !controller.blackboard[BB_BOUNTY_WINDUP_UNTIL])
- back_off(controller, fighter, target)
- if(avoid_friendly_fire && check_friendly_in_path(fighter, target, strategy))
- adjust_position(fighter, target)
- return AI_BEHAVIOR_DELAY
- return style.ranged_tick(fighter, target)
-
-/// tg's sidestep out of a friend's line of fire, never off the leash, into lava or into a chasm (L11)
-/datum/ai_behavior/basic_ranged_attack/bounty/adjust_position(mob/living/living_pawn, atom/target)
- var/turf/our_turf = get_turf(living_pawn)
- if(!our_turf)
+/datum/human_npc_surrender/bounty
+ chance = BOUNTY_SURRENDER_CHANCE
+ retry_chance = BOUNTY_SURRENDER_RETRY
+ ally_penalty = BOUNTY_SURRENDER_PER_COMPANION
+ health_share = BOUNTY_SURRENDER_BELOW
+ hostiles_needed = BOUNTY_SURRENDER_HUNTERS
+ range = BOUNTY_SURRENDER_HUNTER_RANGE
+ retry_delay = BOUNTY_SURRENDER_RETRY_GAP
+
+/// The hunters near it that can see it: a spatial grid lookup of player mobs, as the criminal AI looks around
+/datum/human_npc_surrender/bounty/hostiles_near(mob/living/carbon/human/npc/npc)
+ . = list()
+ var/turf/here = get_turf(npc)
+ if(!here)
return
- var/mob/living/basic/bounty_criminal/leash_holder = bounty_ai_side_of(living_pawn)
- var/list/possible_turfs = list()
- for(var/direction in GLOB.alldirs)
- var/turf/target_turf = get_step(our_turf, direction)
- if(isnull(target_turf) || target_turf.is_blocked_turf() || get_dist(target_turf, target) > get_dist(living_pawn, target))
- continue
- if(islava(target_turf) || ischasm(target_turf) || !target_turf.can_cross_safely(living_pawn))
+ for(var/mob/living/person in SSspatial_grid.orthogonal_range_search(here, SPATIAL_GRID_CONTENTS_TYPE_CLIENTS, range))
+ if(!bounty_ai_is_hunter(person) || get_dist(here, person) > range || !can_see(person, here, range))
continue
- if(leash_holder && !leash_holder.leash_ok(target_turf))
- continue
- possible_turfs += target_turf
- if(!length(possible_turfs))
- return
- var/turf/picked_turf = get_closest_atom(/turf, possible_turfs, target)
- living_pawn.Move(picked_turf, get_dir(living_pawn, picked_turf))
+ . += person
-/// A wind-up cut short never carries over: the next shot telegraphs again
-/datum/ai_behavior/basic_ranged_attack/bounty/finish_action(datum/ai_controller/controller, succeeded, target_key, targeting_strategy_key, hiding_location_key)
- . = ..()
- controller.clear_blackboard_key(BB_BOUNTY_WINDUP_UNTIL)
-
-/// A step back from `target`, now and then, never off the leash
-/datum/ai_behavior/basic_ranged_attack/bounty/proc/back_off(datum/ai_controller/controller, mob/living/basic/fighter, atom/target)
- if(world.time < controller.blackboard[BB_BOUNTY_BACKSTEP_AT] || !isturf(fighter.loc))
- return
- controller.set_blackboard_key(BB_BOUNTY_BACKSTEP_AT, world.time + BOUNTY_BACKSTEP_GAP)
- var/away_dir = get_dir(target, fighter)
- var/turf/away = get_step(fighter, away_dir)
- if(!away_dir || !away || away.is_blocked_turf(source_atom = fighter) || islava(away) || ischasm(away))
- return
- var/mob/living/basic/bounty_criminal/leash_holder = bounty_ai_side_of(fighter)
- if(leash_holder && !leash_holder.leash_ok(away))
+/// The companions still standing with it (a companion counts its criminal's other companions)
+/datum/human_npc_surrender/bounty/allies_near(mob/living/carbon/human/npc/npc)
+ . = list()
+ var/mob/living/carbon/human/npc/bounty_criminal/side = bounty_ai_side_of(npc)
+ if(!side)
return
- fighter.Move(away, away_dir)
- fighter.face_atom(target)
-
-/// The shotgun closes in to BOUNTY_SHOTGUN_RANGE
-/datum/ai_behavior/basic_ranged_attack/bounty/close
- required_distance = BOUNTY_SHOTGUN_RANGE
-
-/// The bottle thrower stays BOUNTY_BOTTLE_RANGE off
-/datum/ai_behavior/basic_ranged_attack/bounty/throw
- required_distance = BOUNTY_BOTTLE_RANGE
-
-// ===== SURRENDER =====
-
-/**
- * Rolls to give up as a hit is about to land (combat.md N2): BOUNTY_SURRENDER_CHANCE on the hit that
- * crosses BOUNTY_SURRENDER_BELOW, less BOUNTY_SURRENDER_PER_COMPANION for each companion still up,
- * then BOUNTY_SURRENDER_RETRY on later hits at most every BOUNTY_SURRENDER_RETRY_GAP. Only with
- * BOUNTY_SURRENDER_HUNTERS hunters near. Rolled before the damage lands, so the body's mercy rule
- * can see TRAIT_BOUNTY_SURRENDERED on that same hit. Must not sleep: it runs in a signal handler.
- */
-/mob/living/basic/bounty_criminal/proc/ai_check_surrender(damage, damagetype)
- if(damage <= 0 || blended || !(damagetype in list(BRUTE, BURN)) || !ai_can_act())
+ for(var/mob/living/carbon/human/npc/bounty_companion/buddy as anything in side.ai_companions())
+ if(buddy != npc && buddy.ai_can_fight() && buddy.body_position == STANDING_UP)
+ . += buddy
+
+/// Not while blended in at a trader outpost (nothing gives the fugitive away but P6's rules, C1)
+/datum/human_npc_surrender/bounty/should_consider(mob/living/carbon/human/npc/npc, list/hostiles, list/allies)
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = npc
+ if(istype(criminal) && criminal.blended)
return FALSE
- var/line = maxHealth * BOUNTY_SURRENDER_BELOW
- var/coeff = damage_coeff?[damagetype]
- var/after = health - damage * (isnull(coeff) ? 1 : coeff)
- var/chance
- if(health > line && after <= line && !ai_surrender_rolled)
- ai_surrender_rolled = TRUE
- chance = ai_surrender_chance()
- else if(health <= line && world.time >= ai_next_surrender_roll)
- chance = BOUNTY_SURRENDER_RETRY
- else
- return FALSE
- ai_next_surrender_roll = world.time + BOUNTY_SURRENDER_RETRY_GAP
- if(bounty_ai_hunters_near(src, BOUNTY_SURRENDER_HUNTER_RANGE) < BOUNTY_SURRENDER_HUNTERS || !prob(chance))
- return FALSE
- ai_surrender()
- return TRUE
+ return ..()
-/// The chance on the crossing hit: less for each companion still standing with them
-/mob/living/basic/bounty_criminal/proc/ai_surrender_chance()
- var/standing = 0
- for(var/mob/living/basic/bounty_companion/buddy as anything in ai_companions())
- if(buddy.ai_can_fight())
- standing++
- return max(0, BOUNTY_SURRENDER_CHANCE - standing * BOUNTY_SURRENDER_PER_COMPANION)
+/// The chance on the first roll of a fight: less for each companion still standing with them
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_surrender_chance()
+ var/datum/human_npc_surrender/rules = npc_surrender_rules() || human_npc_singleton(/datum/human_npc_surrender/bounty)
+ return rules.odds(src, list(src), rules.allies_near(src), TRUE)
/**
- * They give up: hands up (an overhead mark), no more attacks, cuffable in 2 s, and a full share at
- * the pad until cuffed (P2's capture_state() reads the trait as STUNNED). Hitting them afterwards
- * does not undo it. Their companions may lose heart.
+ * Gives up now: the human NPC base's npc_surrender() (the weapon stowed, the line, tg's *surrender).
+ * Returns TRUE if they are lying there with their hands on their head. Its AI side
+ * (ai_on_surrendered()) runs from the base's COMSIG_HUMAN_NPC_SURRENDERED.
*/
-/mob/living/basic/bounty_criminal/proc/ai_surrender()
- if(HAS_TRAIT(src, TRAIT_BOUNTY_SURRENDERED) || stat == DEAD)
- return
- ADD_TRAIT(src, TRAIT_BOUNTY_SURRENDERED, BOUNTY_TRAIT)
- body_note_state()
- ai_stop_aiming()
- ai_suspend_activity()
- ai_set_mode(BOUNTY_AI_CALM)
- ai_hand = bounty_ai_update_held(src, ai_hand, null)
- ai_over_head = bounty_ai_update_held(src, ai_over_head, /obj/effect/abstract/bounty_surrender_mark, over_head = TRUE)
- REMOVE_TRAIT(src, TRAIT_BOUNTY_SPRINTING, BOUNTY_AI_TRAIT)
- if(!QDELETED(ai_controller))
- ai_controller.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET)
- ai_controller.clear_blackboard_key(BB_BOUNTY_DESTINATION)
- ai_controller.ai_movement?.stop_moving_towards(ai_controller)
- ai_controller.CancelActions()
- visible_message(span_notice("[src] raises [p_their()] hands and gives up."))
- // Forced: it usually comes right after a "hurt" line, inside that line's cooldown (BUG-1)
- ai_bark("surrender", TRUE)
- ai_companions_lose_heart()
-
-/// Only its look is used: the hands-up mark over a surrendered criminal's head
-/obj/effect/abstract/bounty_surrender_mark
- icon = 'icons/hud/screen_alert.dmi'
- icon_state = "surrender"
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_surrender()
+ return npc_surrender()
// ===== RETREAT =====
/// Badly hurt with no hunter near: they break off rather than wait to be found
-/mob/living/basic/bounty_criminal/proc/ai_should_retreat()
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_should_retreat()
if(!ai_can_act() || health > maxHealth * BOUNTY_NORMAL_RETREAT_BELOW)
return FALSE
return !bounty_ai_hunters_near(src, BOUNTY_SURRENDER_HUNTER_RANGE)
/**
* Gets away from `from` (or where they stand) to somewhere about BOUNTY_NORMAL_RETREAT_DISTANCE
- * off on their site, picked from a handful of random tiles once, and sits it out there. They do not
- * heal; a hunter coming close starts the fight again.
+ * off on their site, picked from a handful of random tiles once, and sits it out there, patching
+ * themselves up with what they carry. A hunter coming close starts the fight again.
*/
-/mob/living/basic/bounty_criminal/proc/ai_start_retreat(mob/living/from)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_start_retreat(mob/living/from)
if(!ai_can_act() || QDELETED(ai_controller))
return FALSE
var/turf/here = get_turf(src)
@@ -401,8 +283,8 @@
best_distance = distance
ai_suspend_activity()
ai_set_mode(BOUNTY_AI_RETREATING)
- ai_hand = bounty_ai_update_held(src, ai_hand, null)
- ai_set_pace(BOUNTY_NORMAL_SPEED_RANGED)
+ bounty_ai_holster(src)
+ ai_set_pace(BOUNTY_RUN_SPEED)
ai_controller.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET)
if(best)
ai_controller.set_blackboard_key(BB_BOUNTY_DESTINATION, best)
@@ -411,11 +293,11 @@
ai_bark("hurt")
return TRUE
-/// Walks to where they retreat to, then sits down there, winded and hurt
+/// Walks to where they retreat to, then sits down on the floor there and treats themselves (N6)
/datum/ai_planning_subtree/bounty_retreat
/datum/ai_planning_subtree/bounty_retreat/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/bounty_criminal/criminal = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = controller.pawn
if(criminal.ai_mode != BOUNTY_AI_RETREATING)
return
var/turf/destination = controller.blackboard[BB_BOUNTY_DESTINATION]
@@ -427,411 +309,7 @@
criminal.ai_set_pace(BOUNTY_CALM_SPEED)
criminal.ai_crouch()
criminal.visible_message(span_notice("[criminal] sits down heavily, catching [criminal.p_their()] breath."))
+ if(criminal.health < criminal.maxHealth && bounty_ai_queue_treat_self(controller))
+ return SUBTREE_RETURN_FINISH_PLANNING
controller.queue_behavior(/datum/ai_behavior/bounty_watch)
return SUBTREE_RETURN_FINISH_PLANNING
-
-// ===== STYLES =====
-
-/// Every fighting style by key (BOUNTY_STYLE_*), one datum each
-GLOBAL_LIST_INIT(bounty_styles, init_bounty_styles())
-
-/proc/init_bounty_styles()
- var/list/styles = list()
- for(var/datum/bounty_style/style_type as anything in subtypesof(/datum/bounty_style))
- var/datum/bounty_style/style = new style_type
- if(style.key)
- styles[style.key] = style
- return styles
-
-/// A fighter's style: from its controller's blackboard
-/proc/bounty_ai_style(mob/living/basic/fighter)
- var/datum/ai_controller/controller = fighter?.ai_controller
- if(QDELETED(controller))
- return null
- return GLOB.bounty_styles[controller.blackboard[BB_BOUNTY_STYLE]]
-
-/// The item a fighter fights with and shows in their hand (a typepath), or null for bare fists
-/proc/bounty_ai_held_look(mob/living/basic/fighter)
- var/datum/ai_controller/controller = fighter?.ai_controller
- if(QDELETED(controller))
- return null
- return controller.blackboard[BB_BOUNTY_WEAPON]
-
-/// The real weapon a fighter fights with: the item in their hand, loaded as their style loads it. Null with no style.
-/proc/bounty_ai_real_weapon(mob/living/basic/fighter)
- var/datum/bounty_style/style = bounty_ai_style(fighter)
- if(!style)
- return null
- return bounty_real_weapon(bounty_ai_held_look(fighter), style.ammo_type)
-
-// A style's health multiplier is P2's bounty_style_health_mult() (bounty_criminal.dm), from the combat.md defines.
-
-/// Stamina damage multiplier of a style (the brawler shrugs off some): P2 folds it into damage_coeff[STAMINA]
-/proc/bounty_style_stamina_mult(style_key)
- var/datum/bounty_style/style = GLOB.bounty_styles[style_key]
- return style ? style.stamina_mult : 1
-
-/**
- * Puts style `key` on `fighter`: its weapon (the style's heavy_look if `heavy` and it has one), a
- * full magazine, and the blow and the gun that weapon gives.
- */
-/proc/bounty_ai_apply_style(mob/living/basic/fighter, key, heavy = FALSE)
- var/datum/bounty_style/style = GLOB.bounty_styles[key]
- var/datum/ai_controller/controller = fighter?.ai_controller
- if(!style || QDELETED(controller))
- return FALSE
- var/weapon_type = (heavy && style.heavy_look) || style.held_look
- var/datum/bounty_real_weapon/weapon = bounty_real_weapon(weapon_type, style.ammo_type)
- controller.set_blackboard_key(BB_BOUNTY_STYLE, key)
- if(weapon_type)
- controller.set_blackboard_key(BB_BOUNTY_WEAPON, weapon_type)
- else
- controller.clear_blackboard_key(BB_BOUNTY_WEAPON)
- controller.set_blackboard_key(BB_BOUNTY_AMMO, weapon.magazine)
- controller.clear_blackboard_key(BB_BOUNTY_RELOAD_UNTIL)
- controller.clear_blackboard_key(BB_BOUNTY_WINDUP_UNTIL)
- style.apply(fighter, weapon)
- return TRUE
-
-/**
- * How someone fights (combat.md 6.2). Criminals, companions and the meek's holdout share these.
- * Every blow and shot is the real weapon's (bounty_weapons.dm): the item the style puts in their
- * hand gives its damage, wounds, armour penetration, rounds and magazine, so a 9mm is a 9mm
- * whoever fires it. The style only sets the timing: how fast they swing or fire, the telegraph, the
- * reload and the distance they keep. Melee styles hit through the mob's own melee attack; ranged
- * ones shoot through its ranged_attacks component. Nothing is spawned for the fight, and nothing
- * drops.
- */
-/datum/bounty_style
- /// BOUNTY_STYLE_*
- var/key
- /// Fights at range
- var/ranged = FALSE
- /// Health multiplier (P2 applies it to a criminal; companions apply it themselves)
- var/health_mult = 1
- /// Stamina damage multiplier (P2 applies it to a criminal)
- var/stamina_mult = 1
- /// Between attacks
- var/interval = 1.4 SECONDS
- /// Speed in a fight
- var/speed = BOUNTY_NORMAL_SPEED_MELEE
- /// The real item they fight with, shown in their hand (a typepath; null for bare fists)
- var/held_look
- /// The heavier real item a Wanted criminal carries instead, if the style has one
- var/heavy_look
- /// What a gun is loaded with instead of what it comes with (a shotgun's buckshot)
- var/ammo_type
- /// Ranged: the NPCs' own projectile a round flies as, and the sound of a throw (a gun sounds like itself)
- var/projectile_type
- var/projectile_sound
- /// The ranged behavior that keeps this style's distance
- var/ranged_behavior = /datum/ai_behavior/basic_ranged_attack/bounty
- /// Anyone closer than this and they step back (0: never)
- var/min_range = 0
- /// The telegraph before a shot or throw, and what it says and sounds like
- var/windup = 0
- var/windup_message
- var/windup_sound
- /// How long a reload takes once the magazine is spent, and what it sounds like
- var/reload_time = 0
- var/reload_sound
-
-/// Sets `weapon`'s blow and gun on `fighter`, at this style's pace
-/datum/bounty_style/proc/apply(mob/living/basic/fighter, datum/bounty_real_weapon/weapon)
- fighter.melee_attack_cooldown = interval
- weapon.apply_melee(fighter)
- var/datum/component/ranged_attacks/gun = fighter.GetComponent(/datum/component/ranged_attacks)
- if(!gun || !projectile_type)
- return
- gun.casing_type = null
- gun.projectile_type = projectile_type
- gun.projectile_sound = weapon.fire_sound || projectile_sound
- gun.cooldown_time = interval
- gun.burst_shots = null
- gun.burst_intervals = 0
-
-/// Anything extra a melee hit does
-/datum/bounty_style/proc/on_melee_hit(mob/living/basic/fighter, mob/living/target)
- return
-
-/// Whether this shot needs the telegraph first
-/datum/bounty_style/proc/needs_windup(datum/ai_controller/controller)
- return windup > 0
-
-/// The telegraph: what they say, show and sound like before the shot
-/datum/bounty_style/proc/telegraph(mob/living/basic/fighter, atom/target)
- fighter.face_atom(target)
- var/look = bounty_ai_held_look(fighter)
- if(look)
- bounty_ai_hold(fighter, look)
- if(windup_message)
- fighter.visible_message(span_warning(replacetext(windup_message, "%USER", "[fighter]")))
- if(windup_sound)
- playsound(fighter, windup_sound, 50, TRUE)
-
-/**
- * One tick of a ranged fight: reloading, winding up, or firing through the ranged_attacks
- * component when it is ready. Returns the AI behavior flags.
- */
-/datum/bounty_style/proc/ranged_tick(mob/living/basic/fighter, atom/target)
- var/datum/ai_controller/controller = fighter.ai_controller
- var/datum/bounty_real_weapon/weapon = bounty_ai_real_weapon(fighter)
- var/magazine = weapon?.magazine
- var/now = world.time
- var/reload_until = controller.blackboard[BB_BOUNTY_RELOAD_UNTIL]
- if(reload_until)
- if(now < reload_until)
- return AI_BEHAVIOR_DELAY
- controller.clear_blackboard_key(BB_BOUNTY_RELOAD_UNTIL)
- controller.set_blackboard_key(BB_BOUNTY_AMMO, magazine)
- if(magazine && controller.blackboard[BB_BOUNTY_AMMO] <= 0)
- controller.set_blackboard_key(BB_BOUNTY_RELOAD_UNTIL, now + reload_time)
- fighter.visible_message(span_notice("[fighter] reloads."))
- if(reload_sound)
- playsound(fighter, reload_sound, 50, TRUE)
- return AI_BEHAVIOR_DELAY
- var/datum/component/ranged_attacks/gun = fighter.GetComponent(/datum/component/ranged_attacks)
- if(!gun)
- return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED
- var/windup_until = controller.blackboard[BB_BOUNTY_WINDUP_UNTIL]
- if(windup_until && now > windup_until + 1 SECONDS)
- // A wind-up left over from an interrupted fight: it has to be done again
- controller.clear_blackboard_key(BB_BOUNTY_WINDUP_UNTIL)
- windup_until = null
- if(!windup_until)
- if(gun.fire_cooldown > now + windup)
- return AI_BEHAVIOR_DELAY
- if(needs_windup(controller))
- controller.set_blackboard_key(BB_BOUNTY_WINDUP_UNTIL, now + windup)
- telegraph(fighter, target)
- return AI_BEHAVIOR_DELAY
- else if(now < windup_until)
- fighter.face_atom(target)
- return AI_BEHAVIOR_DELAY
- controller.clear_blackboard_key(BB_BOUNTY_WINDUP_UNTIL)
- fighter.RangedAttack(target)
- return AI_BEHAVIOR_DELAY
-
-/// After each shot: the magazine and the clock for the next string
-/datum/bounty_style/proc/after_shot(mob/living/basic/fighter)
- var/datum/ai_controller/controller = fighter.ai_controller
- if(QDELETED(controller))
- return
- controller.set_blackboard_key(BB_BOUNTY_LAST_SHOT, world.time)
- var/datum/bounty_real_weapon/weapon = bounty_ai_real_weapon(fighter)
- if(weapon?.magazine)
- controller.set_blackboard_key(BB_BOUNTY_AMMO, max(0, controller.blackboard[BB_BOUNTY_AMMO] - 1))
-
-/**
- * Loads a shot as it leaves the gun: the real round's numbers and its spread, and the rest of a
- * shell's pellets fired alongside it (one shell, one shot from the magazine). A thrown bottle
- * takes the bottle's throw. Called inside the projectile's fire(): must not sleep.
- */
-/datum/bounty_style/proc/prepare_projectile(mob/living/basic/fighter, obj/projectile/shot)
- var/datum/bounty_real_weapon/weapon = bounty_ai_real_weapon(fighter)
- if(!weapon)
- return
- if(istype(shot, /obj/projectile/bounty_bottle))
- weapon.load_thrown(shot)
- return
- var/obj/projectile/bullet/bounty/bullet = shot
- if(!istype(bullet) || bullet.round_loaded)
- return
- bullet.round_loaded = TRUE
- if(!weapon.load(bullet))
- return
- bullet.set_angle(bullet.angle + weapon.shot_spread())
- for(var/pellet in 2 to weapon.pellets)
- INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(bounty_ai_fire_pellet), fighter, weapon, bullet.type, bullet.original)
-
-/// Another pellet of the shell `fighter` just fired at `target`, with its own spread
-/proc/bounty_ai_fire_pellet(mob/living/basic/fighter, datum/bounty_real_weapon/weapon, shot_type, atom/target)
- var/turf/start = get_turf(fighter)
- if(!start || QDELETED(fighter) || QDELETED(target))
- return null
- var/obj/projectile/bullet/bounty/pellet = new shot_type(start)
- pellet.round_loaded = TRUE
- weapon.load(pellet)
- pellet.firer = fighter
- pellet.fired_from = fighter
- pellet.aim_projectile(target, fighter, null, weapon.shot_spread())
- if(QDELETED(pellet))
- return null
- pellet.fire()
- return pellet
-
-/// Bare fists: a human's punch
-/datum/bounty_style/brawler
- key = BOUNTY_STYLE_BRAWLER
- health_mult = BOUNTY_BRAWLER_HEALTH
- stamina_mult = BOUNTY_BRAWLER_STAMINA
- interval = BOUNTY_BRAWLER_INTERVAL
-
-/// Now and then a punch shoves them back a tile (never onto lava, into a chasm or out into space, M5) and staggers them; no stun
-/datum/bounty_style/brawler/on_melee_hit(mob/living/basic/fighter, mob/living/target)
- if(target.stat != CONSCIOUS || !prob(BOUNTY_BRAWLER_SHOVE_CHANCE))
- return
- bounty_ai_shove_back(fighter, target)
- target.apply_status_effect(/datum/status_effect/staggered, BOUNTY_BRAWLER_STAGGER)
- fighter.visible_message(span_warning("[fighter] shoves [target] back!"))
- playsound(target, 'sound/items/weapons/shove.ogg', 50, TRUE)
-
-/// The blade's own cuts bleed, as a real one's do
-/datum/bounty_style/knife
- key = BOUNTY_STYLE_KNIFE
- health_mult = BOUNTY_KNIFE_HEALTH
- interval = BOUNTY_KNIFE_INTERVAL
- held_look = /obj/item/knife/kitchen
- heavy_look = /obj/item/knife/combat
-
-/datum/bounty_style/club
- key = BOUNTY_STYLE_CLUB
- health_mult = BOUNTY_CLUB_HEALTH
- interval = BOUNTY_CLUB_INTERVAL
- held_look = /obj/item/melee/baseball_bat
- heavy_look = /obj/item/melee/baseball_bat/ablative
-
-/// A bat knocks them back a tile or two, gently, as tg's bat does; never onto lava, into a chasm or out into space
-/datum/bounty_style/club/on_melee_hit(mob/living/basic/fighter, mob/living/target)
- if(QDELETED(target) || target.stat == DEAD)
- return
- bounty_throw_back(fighter, target, rand(1, 2), prob(60) ? 1 : 4, gentle = TRUE)
-
-/datum/bounty_style/pistol
- key = BOUNTY_STYLE_PISTOL
- ranged = TRUE
- health_mult = BOUNTY_PISTOL_HEALTH
- interval = BOUNTY_PISTOL_INTERVAL
- speed = BOUNTY_NORMAL_SPEED_RANGED
- held_look = /obj/item/gun/ballistic/automatic/pistol/aps
- projectile_type = /obj/projectile/bullet/bounty
- windup = BOUNTY_PISTOL_WINDUP
- windup_message = "%USER raises a pistol."
- windup_sound = 'sound/items/weapons/gun/pistol/rack_small.ogg'
- min_range = BOUNTY_PISTOL_MIN_RANGE
- reload_time = BOUNTY_PISTOL_RELOAD
- reload_sound = 'sound/items/weapons/gun/pistol/mag_insert.ogg'
-
-/// Only the first shot of a string needs the gun raised
-/datum/bounty_style/pistol/needs_windup(datum/ai_controller/controller)
- var/last_shot = controller.blackboard[BB_BOUNTY_LAST_SHOT]
- return !last_shot || world.time - last_shot > BOUNTY_PISTOL_STRING_GAP
-
-/// A reload starts a new string
-/datum/bounty_style/pistol/ranged_tick(mob/living/basic/fighter, atom/target)
- var/datum/ai_controller/controller = fighter.ai_controller
- if(controller.blackboard[BB_BOUNTY_RELOAD_UNTIL] && world.time >= controller.blackboard[BB_BOUNTY_RELOAD_UNTIL])
- controller.clear_blackboard_key(BB_BOUNTY_LAST_SHOT)
- return ..()
-
-/// Buckshot: every pellet of a shell, one shell a shot
-/datum/bounty_style/shotgun
- key = BOUNTY_STYLE_SHOTGUN
- ranged = TRUE
- health_mult = BOUNTY_SHOTGUN_HEALTH
- interval = BOUNTY_SHOTGUN_INTERVAL
- speed = BOUNTY_NORMAL_SPEED_RANGED
- held_look = /obj/item/gun/ballistic/shotgun
- heavy_look = /obj/item/gun/ballistic/shotgun/automatic/combat
- ammo_type = /obj/item/ammo_casing/shotgun/buckshot
- projectile_type = /obj/projectile/bullet/bounty
- ranged_behavior = /datum/ai_behavior/basic_ranged_attack/bounty/close
- windup = BOUNTY_SHOTGUN_WINDUP
- windup_message = "%USER pumps the shotgun."
- windup_sound = 'sound/items/weapons/gun/shotgun/rack.ogg'
- reload_time = BOUNTY_SHOTGUN_RELOAD
- reload_sound = 'sound/items/weapons/gun/shotgun/insert_shell.ogg'
-
-/// A beer bottle, thrown: it hits with the bottle's throwforce, and breaks
-/datum/bounty_style/bottle
- key = BOUNTY_STYLE_BOTTLE
- ranged = TRUE
- health_mult = BOUNTY_BOTTLE_HEALTH
- interval = BOUNTY_BOTTLE_INTERVAL
- speed = BOUNTY_NORMAL_SPEED_RANGED
- held_look = /obj/item/reagent_containers/cup/glass/bottle/beer
- projectile_type = /obj/projectile/bounty_bottle
- projectile_sound = 'sound/items/weapons/punchmiss.ogg'
- ranged_behavior = /datum/ai_behavior/basic_ranged_attack/bounty/throw
- min_range = BOUNTY_BOTTLE_MIN_RANGE
- windup = BOUNTY_BOTTLE_WINDUP
- windup_message = "%USER winds up to throw a bottle."
-
-/**
- * The meek's little gun: a quick volley when cornered, once per cornering. The volley is fired
- * one shot at a time by the meek AI (bounty_ai_meek.dm), each shot checking they can still shoot,
- * so the gun here only has to be ready again between shots.
- */
-/datum/bounty_style/holdout
- key = BOUNTY_STYLE_HOLDOUT
- ranged = TRUE
- interval = BOUNTY_MEEK_PISTOL_GAP * 0.8
- speed = BOUNTY_MEEK_SPRINT_SPEED
- held_look = /obj/item/gun/ballistic/automatic/pistol
- projectile_type = /obj/projectile/bullet/bounty/holdout
-
-// ===== WHAT THEY FIRE =====
-
-/**
- * A criminal's bullet or pellet: the real round's numbers are put on it as it is fired
- * (/datum/bounty_style/proc/prepare_projectile()), embedding and all. It never hits the shooter's
- * own gang, and off their site or at a trader outpost it passes anyone the body's rules leave alone
- * (AR-C8, AR-D1; bounty_ai_may_hit(), so a companion's shots don't depend on its criminal being up,
- * H3): only a direct target is hit regardless.
- */
-/obj/projectile/bullet/bounty
- name = "bullet"
- /// The round's numbers are on it already: a pellet fired alongside a shell's first
- var/round_loaded = FALSE
-
-/obj/projectile/bullet/bounty/can_hit_target(atom/target, direct_target = FALSE, ignore_loc = FALSE, cross_failed = FALSE)
- . = ..()
- if(!. || direct_target || !isliving(target) || !firer)
- return
- if(!bounty_ai_may_hit(firer, target))
- return FALSE
-
-/// The meek's holdout fires these
-/obj/projectile/bullet/bounty/holdout
- name = "small bullet"
-
-/**
- * A thrown bottle: it flies slower than a bullet, hits with the bottle's throw, and smashes where it
- * lands, leaving broken glass on the floor (a decal, never a weapon).
- */
-/obj/projectile/bounty_bottle
- name = "bottle"
- icon = 'icons/obj/drinks/bottles.dmi'
- icon_state = "beer"
- damage_type = BRUTE
- armor_flag = MELEE
- speed = 0.6
- range = BOUNTY_BOTTLE_REACH
- hitsound = 'sound/effects/glass/glassbr1.ogg'
- hitsound_wall = 'sound/effects/glass/glassbr2.ogg'
- /// Smashed already, so it leaves glass once
- var/smashed = FALSE
-
-/obj/projectile/bounty_bottle/can_hit_target(atom/target, direct_target = FALSE, ignore_loc = FALSE, cross_failed = FALSE)
- . = ..()
- if(!. || direct_target || !isliving(target) || !firer)
- return
- if(!bounty_ai_may_hit(firer, target))
- return FALSE
-
-/obj/projectile/bounty_bottle/on_hit(atom/target, blocked = 0, pierce_hit)
- . = ..()
- smash(get_turf(target))
-
-/obj/projectile/bounty_bottle/on_range()
- smash(get_turf(src))
- return ..()
-
-/// Broken glass where it landed
-/obj/projectile/bounty_bottle/proc/smash(turf/where)
- if(smashed || !where)
- return
- smashed = TRUE
- if(!isgroundlessturf(where) && !isspaceturf(where))
- new /obj/effect/decal/cleanable/glass(where)
- playsound(where, 'sound/effects/glass/glassbr3.ogg', 50, TRUE)
diff --git a/voidcrew/modules/bounties/bounty_board.dm b/voidcrew/modules/bounties/bounty_board.dm
index 7f17d045fe0..28617021795 100644
--- a/voidcrew/modules/bounties/bounty_board.dm
+++ b/voidcrew/modules/bounties/bounty_board.dm
@@ -186,7 +186,7 @@ SUBSYSTEM_DEF(criminal_bounties)
/datum/controller/subsystem/criminal_bounties/proc/board_live_criminals()
var/count = 0
for(var/datum/criminal_bounty/posting as anything in GLOB.criminal_bounties)
- var/mob/living/basic/bounty_criminal/criminal = posting.criminal()
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = posting.criminal()
if(criminal && criminal.stat != DEAD)
count++
return count
diff --git a/voidcrew/modules/bounties/bounty_boss.dm b/voidcrew/modules/bounties/bounty_boss.dm
index 94d389fabdf..8c4b1680f80 100644
--- a/voidcrew/modules/bounties/bounty_boss.dm
+++ b/voidcrew/modules/bounties/bounty_boss.dm
@@ -5,32 +5,42 @@
* the tests in voidcrew/modules/unit_tests/voidcrew_bounty_bosses.dm. Do not edit this file
* outside P4.
*
- * What it owns: /mob/living/basic/bounty_criminal/boss (its body, built-in values and AI tree), the
- * bounty ability base with its wind-up, telegraph and stale-serial guard (a port of the prison
- * horror's pattern, not a reuse of its type), health that grows with the posse, tiredness below
- * BOUNTY_BOSS_TIRED_BELOW percent, the limits on what it may break, and on_confronted() for bosses
- * (spec section 5, 12.3 C8).
+ * What it owns: /mob/living/carbon/human/npc/bounty_criminal/boss (its body's built-in values, its gear
+ * and its AI), the bounty ability base with its wind-up, telegraph and stale-serial guard (a port of
+ * the prison horror's pattern), the posse and its reinforcements, the limits on what it may break, its
+ * scripted fire and blasts, and on_confronted() for bosses (spec section 5, 12.3 C8).
*
- * The shared vars are declared in bounty_types.dm and nowhere else; a var only P4 uses goes here
- * with a `boss_` prefix, or on the /boss subtypes.
+ * A boss is a real human (the human NPC base, voidcrew/modules/human_npcs/; owner decision D5). Its
+ * crit, stamina, stamcrit, stuns, cuffs, wounds, bleeding and death are tg's, exactly as a player's:
+ * - Toughness is real armour from its kit (locked to its body, D3) and npc_damage_taken
+ * (BOUNTY_BOSS_DAMAGE_TAKEN), fixed whatever the posse (defaults 1.5, OC-8). Never health.
+ * - Resistance to stuns is its armour and a real stimulant pen it carries and injects, with a visible
+ * emote, when its fight starts (defaults 1.6). A second pen is its second wind.
+ * - "Worn out" is its AI reading real state (stamina loss over half its pool, or health under 40%): it
+ * says so, falls back, and then takes its second pen if it has one (CB-2, CR-4).
+ * - It fights with what it holds (real knives, a real torch, a real gun, its fists) through its hands,
+ * the way a player does (controller.ai_interact()).
+ * - It never surrenders. Bosses execute nobody this phase (the core's hv_can_execute(), OC-9).
*
* How a fight goes:
* - A boss waits (its activity, if P3 gives it one) until it spots a hunter, is attacked or is
* confronted. Then it turns hostile: every player within BOUNTY_BOSS_POSSE_RANGE who can see it
- * joins its posse, and its health is set from the kit's table for that many hunters. Anyone who
- * hurts it later joins too, raising its health again (never lowering it).
- * - Its AI: nothing while busy or disabled; a target; an ability, never the same one twice in a
- * row; the kit's way of closing in or keeping away; its melee attack; and with nobody in sight,
- * the hunt for the nearest hunter still on its site. It calms down after BOUNTY_BOSS_CALM_TIME
- * with nobody around.
+ * joins its posse. Each hunter in the posse beyond the first brings one more companion in from out of
+ * their view, one at a time (OC-8, CB-1), up to BOUNTY_BOSS_REINFORCEMENTS_MAX.
+ * - Its AI: soft crit and breaking free first (the human NPC base's and the core's); nothing while
+ * busy or disabled; worn out, it falls back; its stimulant; a target; its kit's gear; an ability,
+ * never the same one twice in a row; the kit's way of closing in or keeping away; its melee; patching
+ * itself up with nobody about; and with nobody in sight, the hunt for the nearest hunter still on its
+ * site. It calms down after BOUNTY_BOSS_CALM_TIME with nobody around.
* - Every ability winds up first, where everyone can see and hear it (telegraph()), and does its
- * harm only when the wind-up is over (effect()). Downed, restrained, stunned or dead in between,
- * and nothing happens.
- * - Below BOUNTY_BOSS_TIRED_BELOW percent health it tires: slower, longer cooldowns, and stamina
- * weapons work fully, so it can be stunned and cuffed. That is the capture window.
+ * harm only when the wind-up is over (effect()). Downed, restrained, stunned, knocked down or dead
+ * in between (tg's states, CB-24), and nothing happens.
+ * - Who it chooses to go after is never someone already down (npc_target_stat, its targeting). What
+ * its fire and blasts catch is whoever stands there, down or not (CB-11, defaults 1.11).
* - What it breaks is scripted, never a real explosion or atmos fire: tables, chairs, windows and
* grilles, and at most BOUNTY_BOSS_WALL_BUDGET walls or doors a fight, only indoors on its own
- * site, never anything with space, the outdoors or another place on its far side.
+ * site, never anything with space, the outdoors or another place on its far side. People its fire
+ * reaches burn with tg's fire stacks; people its blasts reach take tg's light explosion.
*/
/// Trait source for standing still while busy with an ability
@@ -47,41 +57,47 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
/proc/bounty_boss_is_hunter(mob/living/candidate)
if(!isliving(candidate) || QDELETED(candidate) || candidate.stat == DEAD)
return FALSE
- if(istype(candidate, /mob/living/basic/bounty_criminal) || istype(candidate, /mob/living/basic/bounty_companion))
+ if(bounty_is_gang_body(candidate))
return FALSE
return !isnull(candidate.mind) || !isnull(candidate.client)
+/**
+ * Whether a boss's fire or blast catches `thing`, whatever state it is in (CB-11): a person who isn't
+ * on the boss's side (`side`, its factions), or a mech with one in it. Never a criminal or a companion,
+ * never anyone in godmode. Where it reaches is the caller's business (boss_reach_ok()).
+ */
+/proc/bounty_boss_effect_victim(atom/thing, list/side)
+ if(QDELETED(thing))
+ return FALSE
+ if(ismecha(thing))
+ var/obj/vehicle/sealed/mecha/mech = thing
+ for(var/mob/living/pilot in mech.occupants)
+ if(bounty_boss_effect_person(pilot, side))
+ return TRUE
+ return FALSE
+ var/mob/living/person = thing
+ // A pilot is reached through the mech's hull.
+ return isliving(person) && !ismecha(person.loc) && bounty_boss_effect_person(person, side)
+
+/// Whether `person` is someone a boss's fire and blasts catch: anyone not on its side, down, dead or standing
+/proc/bounty_boss_effect_person(mob/living/person, list/side)
+ if(!isliving(person) || QDELETED(person) || HAS_TRAIT(person, TRAIT_GODMODE) || bounty_is_gang_body(person))
+ return FALSE
+ return !length(side) || !faction_check(side, person.faction)
+
// ===== THE BOSS =====
-/mob/living/basic/bounty_criminal/boss
+/mob/living/carbon/human/npc/bounty_criminal/boss
name = "wanted criminal"
desc = "Someone with a big price on their head, and the gear to keep it."
- maxHealth = BOUNTY_JUGGERNAUT_HEALTH_1
- health = BOUNTY_JUGGERNAUT_HEALTH_1
- // Fresh, it shrugs off stuns and knockdowns; boss_update_tired() adds them back once it tires.
- status_flags = CANPUSH
- move_resist = MOVE_FORCE_STRONG
- mob_size = MOB_SIZE_HUMAN
- combat_mode = TRUE
- // The placement adds the site's own factions (spec section 3), so the site's hostiles leave it be.
- faction = list(FACTION_HOSTILE)
- environment_smash = ENVIRONMENT_SMASH_NONE
- // max_stamina and the stamina crit threshold are P2's (100 and 99.9). Stamina never slows a boss:
- // the tired slowdown is the only one the spec asks for, so steady disabler fire can't pin it (H3).
- max_stamina_slowdown = 0
- damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 1, STAMINA = BOUNTY_BOSS_STAMINA_FRESH * 100 / BOUNTY_BOSS_STAMINA, OXY = 1)
- melee_damage_lower = 10
- melee_damage_upper = 14
- melee_attack_cooldown = 1.5 SECONDS
- attack_verb_continuous = "hits"
- attack_verb_simple = "hit"
- attack_sound = 'sound/items/weapons/punch4.ogg'
- attack_vis_effect = ATTACK_EFFECT_PUNCH
ai_controller = /datum/ai_controller/basic_controller/bounty_boss
+ // Aimed crits like a player's (D4); executions stay off for every bounty NPC (the core's hv_can_execute()).
+ npc_rank = HUMAN_NPC_RANK_BOSS
+ // Fixed toughness, whatever its tier or posse (defaults 1.5, OC-8). Its armour does the rest.
+ npc_damage_taken = BOUNTY_BOSS_DAMAGE_TAKEN
+ body_tier_toughness = FALSE
/// BOUNTY_KIT_*: which kit it is, and the prefix of its dialogue contexts
var/boss_kit
- /// The real item in its hand it strikes with (bounty_real_weapon()): its blows are that item's. Null keeps the kit's own blow.
- var/boss_weapon
/// The ability types it is given
var/list/boss_ability_types = list()
/// Its abilities (/datum/action/cooldown/mob_cooldown/bounty_boss), granted at Initialize
@@ -92,26 +108,23 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
var/boss_strict_rotation = BOUNTY_BOSS_STRICT_ROTATION
/// world.time the next ability may start
var/boss_next_ability_at = 0
- /// What keeps it still with its AI quiet ("windup", "charge", "dash", "burst", "stagger"), or null
+ /// What keeps it still with its AI quiet ("windup", "charge", "dash", "burst"), or null
var/boss_busy
/// Goes up each time it becomes busy, so a stale timer knows to do nothing
var/boss_busy_serial = 0
var/boss_busy_timer
/// The ability winding up now, whose telegraph goes if it is interrupted
var/datum/weakref/boss_winding_ref
- /// Stamina damage it takes to crit it once tired, and its coefficient while fresh
- var/boss_stamina_pool = BOUNTY_BOSS_STAMINA
- var/boss_stamina_fresh = BOUNTY_BOSS_STAMINA_FRESH
- /// At or below BOUNTY_BOSS_TIRED_BELOW percent health
- var/boss_tired = FALSE
- /// Its speed while fresh, and its brute and burn coefficients (a stagger's weakness puts them back)
- var/boss_base_speed
- var/boss_brute_coeff = 1
- var/boss_burn_coeff = 1
/// Turned hostile: it spotted a hunter, or someone attacked or confronted it
var/boss_hostile = FALSE
- /// REF() of each hunter in its posse -> TRUE; its health follows how many
+ /// REF() of each hunter in its posse -> TRUE
var/list/boss_engaged = list()
+ /// Companions its posse has brought in (OC-8), and how many more are owed and not yet called
+ var/boss_reinforcements_sent = 0
+ var/boss_reinforcements_owed = 0
+ var/boss_reinforce_timer
+ /// Weakrefs to the companions that came in for it
+ var/list/boss_reinforcement_refs
/// Walls and doors it may still break this fight
var/boss_walls_left = BOUNTY_BOSS_WALL_BUDGET
/// Whoever hurt it last (a person, or the mech they are in), and when
@@ -119,54 +132,56 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
var/boss_last_attacked_at = 0
/// world.time it calms down if it still finds no hunter on its site
var/boss_calm_at = 0
-
-/mob/living/basic/bounty_criminal/boss/Initialize(mapload)
+ /// Worn out (boss_is_worn_out(), read by its AI): said so, and falls back until boss_fallback_until
+ var/boss_worn_out = FALSE
+ var/boss_fallback_until = 0
+ /// Stimulant pens it has used: the first when its fight starts, the second for its second wind
+ var/boss_stimulants_used = 0
+ /// Its fall back is over and it is still worn out: its next plan takes the second pen
+ var/boss_second_wind_due = FALSE
+
+/mob/living/carbon/human/npc/bounty_criminal/boss/Initialize(mapload, datum/human_npc_order/order)
. = ..()
- if(boss_weapon)
- bounty_real_weapon(boss_weapon).apply_melee(src)
- damage_coeff = damage_coeff.Copy()
- boss_brute_coeff = damage_coeff[BRUTE]
- boss_burn_coeff = damage_coeff[BURN]
- boss_base_speed = speed
for(var/ability_type in boss_ability_types)
var/datum/action/cooldown/mob_cooldown/bounty_boss/ability = new ability_type(src)
ability.Grant(src)
boss_abilities += ability
- AddElement(/datum/element/relay_attackers)
AddComponent(/datum/component/bounty_boss_signals)
- boss_update_tired(silent = TRUE, force = TRUE)
- // Dressed by the spawner when it has a record; an admin spawn with none gets the kit's look.
- addtimer(CALLBACK(src, PROC_REF(boss_dress_fallback)), 1, TIMER_DELETE_ME)
-/mob/living/basic/bounty_criminal/boss/Destroy()
+/mob/living/carbon/human/npc/bounty_criminal/boss/Destroy()
boss_interrupt()
QDEL_LIST(boss_abilities)
deltimer(boss_busy_timer)
boss_busy_timer = null
+ deltimer(boss_reinforce_timer)
+ boss_reinforce_timer = null
+ boss_reinforcement_refs = null
boss_winding_ref = null
boss_last_attacker = null
return ..()
-/mob/living/basic/bounty_criminal/boss/death(gibbed)
+/mob/living/carbon/human/npc/bounty_criminal/boss/death(gibbed)
boss_interrupt()
- . = ..()
- boss_update_hold()
+ deltimer(boss_reinforce_timer)
+ boss_reinforce_timer = null
+ boss_reinforcements_owed = 0
+ return ..()
-/mob/living/basic/bounty_criminal/boss/examine(mob/user)
+/mob/living/carbon/human/npc/bounty_criminal/boss/examine(mob/user)
. = ..()
- if(stat == DEAD)
+ if(stat == DEAD || hidden)
return
var/gear = boss_gear_text()
if(gear)
. += span_warning(gear)
- if(boss_tired)
+ if(boss_worn_out)
. += span_notice("[p_They()] look[p_s()] worn out.")
/**
* `user` confronted them: showed the warrant, or accused them. A boss doesn't run or argue. It
* starts its fight, with `user` first on its list.
*/
-/mob/living/basic/bounty_criminal/boss/on_confronted(mob/user)
+/mob/living/carbon/human/npc/bounty_criminal/boss/on_confronted(mob/user)
if(stat != CONSCIOUS || !isliving(user))
return
body_add_grudge(user)
@@ -175,135 +190,94 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
if(boss_valid_target(target))
ai_controller?.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, target)
-/**
- * Its blows land on a mech's hull in full (H2): tg's mech defence scales a mob's blow by how much it
- * smashes, and a boss smashes nothing, so every blow would do nothing.
- */
-/mob/living/basic/bounty_criminal/boss/melee_attack(atom/target, list/modifiers, ignore_cooldown = FALSE)
- // Each swing picks one of the weapon's own verbs, as a player's does
- if(boss_weapon)
- bounty_real_weapon(boss_weapon).pick_verb(src)
- if(!ismecha(target))
- return ..()
- if(!early_melee_attack(target, modifiers, ignore_cooldown))
- return FALSE
- do_attack_animation(target, attack_vis_effect)
- if(attack_sound)
- playsound(target, attack_sound, 50, TRUE)
- target.visible_message(span_danger("[src] [attack_verb_continuous] [target]!"))
- boss_hit(target, rand(melee_damage_lower, melee_damage_upper), melee_damage_type, MELEE, 0, armour_penetration, TRUE)
- SEND_SIGNAL(src, COMSIG_HOSTILE_POST_ATTACKINGTARGET, target, TRUE)
- if(!ignore_cooldown)
- changeNext_move(melee_attack_cooldown)
- return TRUE
-
// ----- its kit -----
-/// Health for 1, 2, 3 and 4+ engaged hunters. Each kit has its own.
-/mob/living/basic/bounty_criminal/boss/proc/boss_health_table()
- return list(initial(maxHealth))
-
-/// The outfit its look is built in: each kit has one, so the five read differently at a glance. P2's look uses it.
-/mob/living/basic/bounty_criminal/boss/boss_kit_outfit()
- return /datum/outfit/bounty_boss
+// What each kit wears and carries (bounty_boss_kits.dm): real armour, its weapon carried or held, spare
+// ammunition, its stimulants and something to patch itself up with. The base adds vacuum and cold layers.
+/mob/living/carbon/human/npc/bounty_criminal/boss/bounty_build_outfit(zone)
+ return boss_supplies(bounty_outfit_instance(/datum/outfit/bounty_boss))
-/// With no record to dress it from (an admin spawn), the kit's look on a stock face
-/mob/living/basic/bounty_criminal/boss/proc/boss_dress_fallback()
- if(QDELETED(src) || record)
- return
- apply_dynamic_human_appearance(src, boss_kit_outfit(), /datum/species/human)
+/**
+ * Packs what every boss carries into `outfit`, an instance: BOUNTY_BOSS_STIMULANTS combat stimulants
+ * and a bruise pack, in a bag on its back (one is added if it wears none). Returns the outfit.
+ */
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_supplies(datum/outfit/outfit)
+ if(!istype(outfit))
+ return outfit
+ outfit.back ||= /obj/item/storage/backpack
+ LAZYINITLIST(outfit.backpack_contents)
+ outfit.backpack_contents[BOUNTY_BOSS_STIMULANT] = (outfit.backpack_contents[BOUNTY_BOSS_STIMULANT] || 0) + BOUNTY_BOSS_STIMULANTS
+ outfit.backpack_contents[/obj/item/stack/medical/bruise_pack] = (outfit.backpack_contents[/obj/item/stack/medical/bruise_pack] || 0) + 1
+ return outfit
/// A line on examine about its gear, if the kit has one
-/mob/living/basic/bounty_criminal/boss/proc/boss_gear_text()
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_gear_text()
return null
/**
* Says a line for "_", or for "_" if there is none for it. Async, so a
* signal handler can call it.
*/
-/mob/living/basic/bounty_criminal/boss/proc/boss_bark(suffix, fallback)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_bark(suffix, fallback)
if(!boss_kit || stat != CONSCIOUS)
return
INVOKE_ASYNC(src, PROC_REF(boss_bark_now), suffix, fallback)
-/mob/living/basic/bounty_criminal/boss/proc/boss_bark_now(suffix, fallback)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_bark_now(suffix, fallback)
if(QDELETED(src) || stat != CONSCIOUS)
return FALSE
if(bounty_say("[boss_kit]_[suffix]"))
return TRUE
return fallback ? bounty_say("[boss_kit]_[fallback]") : FALSE
-// ----- state -----
+// ----- state, all tg's -----
-/// Downed: P2's state, read from the shared var too so a test can set it
-/mob/living/basic/bounty_criminal/boss/proc/boss_is_downed()
- return downed || is_downed()
-
-/// Restrained: P2's state, read from the shared var too so a test can set it
-/mob/living/basic/bounty_criminal/boss/proc/boss_is_restrained()
- return !isnull(restraints) || is_restrained()
-
-/// Whether it can act at all: alive and awake, not downed, restrained, given up, stunned or knocked down
-/mob/living/basic/bounty_criminal/boss/proc/boss_can_act()
+/// Whether it can act at all: alive and awake, not in crit, restrained, stunned, knocked down or in stamina crit
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_can_act()
if(QDELETED(src) || stat != CONSCIOUS || !isturf(loc))
return FALSE
- if(boss_is_downed() || boss_is_restrained() || HAS_TRAIT(src, TRAIT_BOUNTY_SURRENDERED))
+ if(is_downed() || is_restrained() || npc_surrendering)
return FALSE
return !HAS_TRAIT(src, TRAIT_INCAPACITATED) && !HAS_TRAIT(src, TRAIT_FLOORED)
-/// Whether it may start an ability now: able, not busy, and past the gap since the last one
-/mob/living/basic/bounty_criminal/boss/proc/boss_can_use_ability()
- return boss_can_act() && !boss_busy && world.time >= boss_next_ability_at
-
-/// Its cooldowns stretch once it tires
-/mob/living/basic/bounty_criminal/boss/proc/boss_cooldown_mult()
- return boss_tired ? BOUNTY_BOSS_TIRED_COOLDOWN_MULT : 1
-
-/// Pulled by anyone once it is dead, downed or cuffed; hard to shift otherwise
-/mob/living/basic/bounty_criminal/boss/proc/boss_update_hold()
- move_resist = (stat == DEAD || boss_is_downed() || boss_is_restrained()) ? MOVE_RESIST_DEFAULT : initial(move_resist)
+/// Whether it may start an ability now: able, not busy, not falling back, and past the gap since the last one
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_can_use_ability()
+ return boss_can_act() && !boss_busy && world.time >= boss_next_ability_at && world.time >= boss_fallback_until
/**
- * Tired at or below BOUNTY_BOSS_TIRED_BELOW percent health: stamina weapons work fully, stuns and
- * knockdowns land, it moves slower and its cooldowns stretch. Healed back above the line, it is
- * fresh again. Returns TRUE if that changed. P2's rally calls it with `force` when the rally ends.
- *
- * On tiring, its stamina loss starts again from zero, so the capture takes its whole pool
- * (BOUNTY_BOSS_STAMINA: five disabler hits) whatever was thrown at it while it was fresh (H3).
+ * Worn out, read from its body (CB-2): stamina loss over BOUNTY_BOSS_WORN_OUT_STAMINA of its pool, or
+ * health under BOUNTY_BOSS_WORN_OUT_HEALTH of its max. tg's own slowdown from both does the rest.
*/
-/mob/living/basic/bounty_criminal/boss/boss_update_tired(silent = FALSE, force = FALSE)
- var/now_tired = stat != DEAD && maxHealth > 0 && health <= maxHealth * BOUNTY_BOSS_TIRED_BELOW / 100
- if(now_tired == boss_tired && !force)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_is_worn_out()
+ if(stat == DEAD)
return FALSE
- var/was_tired = boss_tired
- boss_tired = now_tired
- damage_coeff[STAMINA] = boss_stamina_coefficient()
- if(boss_tired && !was_tired && staminaloss > 0)
- adjustStaminaLoss(-staminaloss, forced = TRUE)
- status_flags &= ~(CANSTUN | CANKNOCKDOWN)
- if(boss_tired)
- status_flags |= CANSTUN | CANKNOCKDOWN
- set_varspeed(boss_base_speed + (boss_tired ? BOUNTY_BOSS_TIRED_SLOWDOWN : 0))
- if(boss_tired && !silent)
- visible_message(span_warning("[src] is breathing hard and slowing down. [p_They()] look[p_s()] worn out."))
- // The stun window is open: the balloon says so where the fight is, not only in chat (P4 polish)
- body_alert_hunters("worn out")
- boss_bark("exhausted")
- return TRUE
+ return getStaminaLoss() > max_stamina * BOUNTY_BOSS_WORN_OUT_STAMINA || health < maxHealth * BOUNTY_BOSS_WORN_OUT_HEALTH
-/// Stamina damage coefficient now: the fresh or tired one, folded against its pool, as max_stamina stays 100
-/mob/living/basic/bounty_criminal/boss/proc/boss_stamina_coefficient()
- var/coefficient = boss_tired ? BOUNTY_BOSS_STAMINA_TIRED : boss_stamina_fresh
- return coefficient * max_stamina / max(boss_stamina_pool, 1)
+/// It has just worn out: it says so where the fight is, drops what it was winding up and falls back for a while
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_wear_out()
+ boss_worn_out = TRUE
+ boss_second_wind_due = FALSE
+ boss_fallback_until = world.time + BOUNTY_BOSS_FALLBACK_TIME
+ boss_interrupt()
+ visible_message(span_warning("[src] is breathing hard and slowing down. [p_They()] look[p_s()] worn out."))
+ body_alert_hunters("worn out")
+ boss_bark("exhausted")
+
+/// Whether its next plan should take a stimulant: the first when its fight starts, the second for its second wind
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_wants_stimulant()
+ if(!boss_hostile || boss_stimulants_used >= BOUNTY_BOSS_STIMULANTS)
+ return FALSE
+ return !boss_stimulants_used || boss_second_wind_due
// ----- busy -----
/**
- * Busy with `state`, its AI quiet. `immobile` keeps it standing still (a wind-up, a stagger); a
- * charge or dash moves it itself. With a `duration` it ends on its own. Returns the serial a timer
- * checks against, so a stale one does nothing.
+ * Busy with `state`, its AI quiet. `immobile` keeps it standing still (a wind-up, a burst); a charge or
+ * dash moves it itself. A wind-up is a telegraph: tg's stuns, knockdowns, stamcrit, crit and cuffs
+ * interrupt it (the bounty_boss_signals component, and boss_can_act() when it ends; CB-24). With a
+ * `duration` it ends on its own. Returns the serial a timer checks against, so a stale one does nothing.
*/
-/mob/living/basic/bounty_criminal/boss/proc/boss_set_busy(state, duration, immobile = TRUE)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_set_busy(state, duration, immobile = TRUE)
boss_busy = state
boss_busy_serial++
deltimer(boss_busy_timer)
@@ -318,7 +292,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
return boss_busy_serial
/// Free again, unless `serial` is stale
-/mob/living/basic/bounty_criminal/boss/proc/boss_clear_busy(serial)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_clear_busy(serial)
if(serial && serial != boss_busy_serial)
return FALSE
boss_busy = null
@@ -328,11 +302,11 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
return TRUE
/// Whether it is still busy with `state` under `serial`: what a charge or burst checks before each step
-/mob/living/basic/bounty_criminal/boss/proc/boss_still(state, serial)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_still(state, serial)
return !QDELETED(src) && boss_busy == state && boss_busy_serial == serial && boss_can_act()
/// Knocked out of whatever it was doing: a wind-up's telegraph goes, and nothing lands
-/mob/living/basic/bounty_criminal/boss/proc/boss_interrupt()
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_interrupt()
var/datum/action/cooldown/mob_cooldown/bounty_boss/winding = boss_winding_ref?.resolve()
boss_winding_ref = null
winding?.cancel_windup()
@@ -341,23 +315,14 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
boss_on_interrupted()
/// A kit's own clean-up when it is interrupted, downed or killed
-/mob/living/basic/bounty_criminal/boss/proc/boss_on_interrupted()
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_on_interrupted()
return
-/// Reeling for `duration` (charged into a wall): still, quiet, and taking `vulnerable` times the damage. Not a stun, so it can't be cuffed for it.
-/mob/living/basic/bounty_criminal/boss/proc/boss_stagger(duration, vulnerable = 1)
- if(stat != CONSCIOUS)
- return
- boss_set_busy("stagger", duration)
- Shake(2, 1, duration)
- if(vulnerable != 1)
- damage_coeff[BRUTE] = boss_brute_coeff * vulnerable
- damage_coeff[BURN] = boss_burn_coeff * vulnerable
- addtimer(CALLBACK(src, PROC_REF(boss_end_vulnerable)), duration, TIMER_UNIQUE | TIMER_OVERRIDE | TIMER_DELETE_ME)
-
-/mob/living/basic/bounty_criminal/boss/proc/boss_end_vulnerable()
- damage_coeff[BRUTE] = boss_brute_coeff
- damage_coeff[BURN] = boss_burn_coeff
+/// The ability winding up now, if any
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_winding()
+ if(boss_busy != "windup")
+ return null
+ return boss_winding_ref?.resolve()
// ----- abilities -----
@@ -366,7 +331,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
* while another is ready. With BOUNTY_BOSS_STRICT_ROTATION (boss_strict_rotation) the last one is
* never picked again straight away, even when it is the only one ready.
*/
-/mob/living/basic/bounty_criminal/boss/proc/boss_choose_ability(atom/target)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_choose_ability(atom/target)
if(QDELETED(target) || !boss_can_use_ability())
return null
var/list/options = list()
@@ -383,7 +348,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
return boss_strict_rotation ? null : last_one
/// Starts `ability`'s wind-up. Returns the serial its timer checks, or 0 if it can't start now.
-/mob/living/basic/bounty_criminal/boss/proc/boss_begin_ability(datum/action/cooldown/mob_cooldown/bounty_boss/ability)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_begin_ability(datum/action/cooldown/mob_cooldown/bounty_boss/ability)
if(!boss_can_use_ability())
return 0
boss_last_ability = ability.type
@@ -392,7 +357,11 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
return boss_set_busy("windup", ability.windup + 1 SECONDS)
/// The kit's way of fighting after abilities: keep range, break off. Returns TRUE if it queued something.
-/mob/living/basic/bounty_criminal/boss/proc/boss_engage_plan(datum/ai_controller/controller, atom/target)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_engage_plan(datum/ai_controller/controller, atom/target)
+ return FALSE
+
+/// The kit's own gear to see to before it fights on (a Heavy's belt change). Returns TRUE if it queued something.
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_gear_plan(datum/ai_controller/controller)
return FALSE
// ----- the posse and turning hostile -----
@@ -402,7 +371,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
* count (boss_counts_for_posse()). The first time, everyone who counts within
* BOUNTY_BOSS_POSSE_RANGE and can see it joins too, mech pilots included, and it says its intro line.
*/
-/mob/living/basic/bounty_criminal/boss/proc/boss_turn_hostile(mob/living/instigator)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_turn_hostile(mob/living/instigator)
if(stat == DEAD)
return FALSE
boss_calm_at = world.time + BOUNTY_BOSS_CALM_TIME
@@ -418,12 +387,11 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
for(var/obj/vehicle/sealed/mecha/mech in view(BOUNTY_BOSS_POSSE_RANGE, src))
for(var/mob/living/pilot in mech.occupants)
boss_engage(pilot, announce = FALSE)
- boss_apply_posse_health(announce = FALSE)
boss_bark("intro")
return TRUE
-/// With no hunter left on its site, it stops hunting and waits again. Its posse and health stay.
-/mob/living/basic/bounty_criminal/boss/proc/boss_calm_down()
+/// With no hunter left on its site, it stops hunting and waits again. Its posse stays.
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_calm_down()
boss_hostile = FALSE
ai_controller?.clear_blackboard_key(BB_BOUNTY_BOSS_PREY)
@@ -432,7 +400,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
* confronted or cuffed it), or one whose ship is hunting its bounty. Being seen or targeted alone
* doesn't count.
*/
-/mob/living/basic/bounty_criminal/boss/proc/boss_counts_for_posse(mob/living/hunter)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_counts_for_posse(mob/living/hunter)
if(!bounty_boss_is_hunter(hunter))
return FALSE
if(body_has_grudge(hunter))
@@ -445,55 +413,109 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
return TRUE
return FALSE
-/// Adds `hunter` to its posse if they count, raising its health for the bigger posse. Returns TRUE if they are new.
-/mob/living/basic/bounty_criminal/boss/proc/boss_engage(mob/living/hunter, announce = TRUE)
+/**
+ * Adds `hunter` to its posse if they count. Each hunter beyond the first owes it one more companion
+ * (OC-8); with `announce`, it sizes the bigger posse up out loud. Returns TRUE if they are new.
+ */
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_engage(mob/living/hunter, announce = TRUE)
if(stat == DEAD || !boss_counts_for_posse(hunter))
return FALSE
var/key = REF(hunter)
if(boss_engaged[key])
return FALSE
boss_engaged[key] = TRUE
- boss_apply_posse_health(announce)
- return TRUE
-
-/**
- * Max health for the posse it has: the kit's table entry for that many hunters (never more than the
- * 4+ entry), raised and never lowered (M4).
- * - Fresh, current health rises by the same step (spec: "raised, current health too").
- * - Tired, it keeps the same share of its health, so a newcomer never heals it out of its capture
- * window.
- * - Downed or cuffed, the raise waits; it is applied when it gets up (on_freed), keeping its share.
- * Returns TRUE if max health rose.
- */
-/mob/living/basic/bounty_criminal/boss/proc/boss_apply_posse_health(announce = TRUE)
- if(stat == DEAD || boss_is_downed() || boss_is_restrained())
- return FALSE
- var/list/table = boss_health_table()
var/count = length(boss_engaged)
- if(!length(table) || !count)
- return FALSE
- var/wanted = table[clamp(count, 1, length(table))]
- var/raw_health = wanted
- wanted *= npc_zone_health_factor
- if(wanted <= maxHealth)
- return FALSE
- npc_zone_original_max_health = raw_health
- var/share = maxHealth > 0 ? health / maxHealth : 1
- setMaxHealth(wanted)
- if(boss_tired)
- // Basic mobs keep all their damage as bruteloss. Not rounded, so it never lands over the tired line.
- bruteloss = wanted * (1 - share)
- updatehealth()
- boss_update_tired(silent = TRUE)
+ boss_owe_reinforcements(count)
if(announce && count > 1)
visible_message(span_warning("[src] looks over the [count] of you and squares up."))
boss_bark("posse", "intro")
return TRUE
+/// A posse of `count` hunters owes one companion for each beyond the first, up to BOUNTY_BOSS_REINFORCEMENTS_MAX, called one at a time
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_owe_reinforcements(count)
+ var/wanted = clamp(count - 1, 0, BOUNTY_BOSS_REINFORCEMENTS_MAX)
+ var/more = wanted - boss_reinforcements_sent - boss_reinforcements_owed
+ if(more <= 0)
+ return
+ boss_reinforcements_owed += more
+ boss_schedule_reinforcement()
+
+/// The next companion comes after BOUNTY_BOSS_REINFORCE_DELAY, never two at once
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_schedule_reinforcement()
+ if(boss_reinforce_timer || boss_reinforcements_owed <= 0 || stat == DEAD)
+ return
+ boss_reinforce_timer = addtimer(CALLBACK(src, PROC_REF(boss_reinforce_tick)), BOUNTY_BOSS_REINFORCE_DELAY, TIMER_STOPPABLE | TIMER_DELETE_ME)
+
+/// Calls the next companion owed, from somewhere no player can see; tries again later if there is nowhere yet
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_reinforce_tick()
+ boss_reinforce_timer = null
+ if(QDELETED(src) || stat == DEAD || !boss_hostile || boss_reinforcements_owed <= 0)
+ return
+ var/turf/spot = boss_reinforcement_spot()
+ if(spot)
+ boss_send_reinforcement(spot)
+ boss_schedule_reinforcement()
+
+/**
+ * Calls one companion owed in at `where` (the criminal-AI package's bounty_spawn_companion(): a queued,
+ * throttled human NPC joined to it). Returns what that returns.
+ */
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_send_reinforcement(turf/where)
+ if(boss_reinforcements_owed <= 0 || !isturf(where))
+ return null
+ boss_reinforcements_owed--
+ boss_reinforcements_sent++
+ return bounty_spawn_companion(src, where, CALLBACK(src, PROC_REF(boss_reinforcement_arrived)))
+
+/// A companion it called is here: it goes after whoever the boss is fighting
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_reinforcement_arrived(mob/living/carbon/human/npc/companion)
+ if(QDELETED(src) || !ismob(companion) || QDELETED(companion))
+ return
+ LAZYADD(boss_reinforcement_refs, WEAKREF(companion))
+ var/atom/target = ai_controller?.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
+ if(!QDELETED(target))
+ companion.ai_controller?.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, target)
+
+/**
+ * A spot for a companion to come in at: open ground on its site, BOUNTY_BOSS_REINFORCE_MIN_DIST to
+ * _MAX_DIST tiles off, where no player within BOUNTY_BOSS_REINFORCE_SIGHT can see. Null if there is none.
+ */
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_reinforcement_spot()
+ var/turf/here = get_turf(src)
+ if(!here)
+ return null
+ var/list/watchers = list()
+ if(here.z <= length(SSmobs.clients_by_zlevel))
+ for(var/mob/living/person as anything in SSmobs.clients_by_zlevel[here.z])
+ if(person.stat != DEAD && get_dist(person, here) <= BOUNTY_BOSS_REINFORCE_MAX_DIST + BOUNTY_BOSS_REINFORCE_SIGHT)
+ watchers += person
+ var/list/candidates = list()
+ for(var/turf/open/spot in RANGE_TURFS(BOUNTY_BOSS_REINFORCE_MAX_DIST, here))
+ if(get_dist(spot, here) < BOUNTY_BOSS_REINFORCE_MIN_DIST)
+ continue
+ if(isspaceturf(spot) || isgroundlessturf(spot) || islava(spot) || ischasm(spot) || spot.is_blocked_turf())
+ continue
+ if(!leash_ok(spot) || !boss_reach_ok(spot))
+ continue
+ candidates += spot
+ shuffle_inplace(candidates)
+ var/tries = 0
+ for(var/turf/spot as anything in candidates)
+ if(++tries > 40)
+ break
+ var/seen = FALSE
+ for(var/mob/living/watcher as anything in watchers)
+ if(get_dist(watcher, spot) <= BOUNTY_BOSS_REINFORCE_SIGHT && can_see(watcher, spot, BOUNTY_BOSS_REINFORCE_SIGHT))
+ seen = TRUE
+ break
+ if(!seen)
+ return spot
+ return null
+
// ----- targets -----
/// The people behind `thing`: the person, or everyone in the mech
-/mob/living/basic/bounty_criminal/boss/proc/boss_people_in(atom/thing)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_people_in(atom/thing)
. = list()
if(isliving(thing))
. += thing
@@ -503,60 +525,65 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
. += pilot
/// What to go after for `who`: the mech they sit in, or them
-/mob/living/basic/bounty_criminal/boss/proc/boss_target_for(atom/who)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_target_for(atom/who)
var/mob/living/person = who
if(isliving(person) && ismecha(person.loc))
return person.loc
return who
-/// Whether it goes after `target`: a hunter, or a mech with a hunter in it, that it may hurt
-/mob/living/basic/bounty_criminal/boss/proc/boss_valid_target(atom/target)
- return boss_can_hurt(target)
-
/**
- * Whether it and its abilities may hurt `victim` (C4, H2, M2, L1):
- * - an awake hunter not on its side, or a mech with one in it (a pilot is hurt through the mech);
- * - standing on its site, and never in a ship, a hangar or an outpost;
- * - someone it may attack from where it is (P2's may_attack()).
- * Never a criminal, one of their friends, fauna or anyone else on the site.
+ * Whether it chooses to go after `target` (C4, H2, M2, L1): an awake hunter not on its side, or a mech
+ * with one in it (a pilot is hurt through the mech); standing on its site, never in a ship, a hangar or
+ * an outpost; someone it may attack from where it is (P2's may_attack()). This is its choice of target
+ * only: what its fire and blasts catch is boss_effect_hits() (CB-11).
*/
-/mob/living/basic/bounty_criminal/boss/proc/boss_can_hurt(atom/victim)
- if(QDELETED(victim) || victim == src)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_valid_target(atom/target)
+ if(QDELETED(target) || target == src)
return FALSE
- if(!boss_reach_ok(get_turf(victim)))
+ if(!boss_reach_ok(get_turf(target)))
return FALSE
- if(ismecha(victim))
- var/obj/vehicle/sealed/mecha/mech = victim
+ if(ismecha(target))
+ var/obj/vehicle/sealed/mecha/mech = target
return boss_hunter_aboard(mech) && may_attack(mech)
- var/mob/living/person = victim
+ var/mob/living/person = target
if(!isliving(person) || ismecha(person.loc) || !boss_hunter_awake(person))
return FALSE
return may_attack(person)
-/// An awake hunter not on its side
-/mob/living/basic/bounty_criminal/boss/proc/boss_hunter_awake(mob/living/person)
+/// An awake hunter not on its side: who it picks to fight. Never used for what its fire and blasts catch.
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_hunter_awake(mob/living/person)
return bounty_boss_is_hunter(person) && person.stat == CONSCIOUS && !HAS_TRAIT(person, TRAIT_GODMODE) && !faction_check_atom(person)
/// Whether an awake hunter not on its side sits in `mech`
-/mob/living/basic/bounty_criminal/boss/proc/boss_hunter_aboard(obj/vehicle/sealed/mecha/mech)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_hunter_aboard(obj/vehicle/sealed/mecha/mech)
for(var/mob/living/pilot in mech.occupants)
if(boss_hunter_awake(pilot))
return TRUE
return FALSE
-/// Everyone on `turfs` its abilities may hurt: hunters, and mechs with hunters in them
-/mob/living/basic/bounty_criminal/boss/proc/boss_victims_on(list/turfs)
+/**
+ * Whether its fire, blasts, charge or slam catch `victim` where it stands: anywhere its abilities may
+ * reach (boss_reach_ok()), anyone not on its side, in whatever state (CB-11: down, cuffed or standing).
+ */
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_effect_hits(atom/victim)
+ if(QDELETED(victim) || victim == src)
+ return FALSE
+ return boss_reach_ok(get_turf(victim)) && bounty_boss_effect_victim(victim, faction)
+
+/// Everyone on `turfs` its abilities catch: people not on its side, in any state, and mechs with one in them
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_victims_on(list/turfs)
. = list()
for(var/turf/spot as anything in turfs)
for(var/atom/movable/thing as anything in spot)
- if((isliving(thing) || ismecha(thing)) && boss_can_hurt(thing))
+ if((isliving(thing) || ismecha(thing)) && boss_effect_hits(thing))
. += thing
/**
- * One hit from an ability on `victim`: `damage` of `damage_type` against `armour_flag` armour, and
- * a knockdown. A mech takes it on its hull (H2).
+ * One scripted hit from an ability (a charge or a slam) on `victim`: `damage` of `damage_type` against
+ * `armour_flag` armour on the chest, and a knockdown, both through tg (CB-25). A mech takes it on its
+ * hull (H2). `already_scaled` is for the zone-damage helper, which leaves human bosses at a person's.
*/
-/mob/living/basic/bounty_criminal/boss/proc/boss_hit(atom/victim, damage, damage_type = BRUTE, armour_flag = MELEE, knockdown = 0, armour_penetration = 0, already_scaled = FALSE)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_hit(atom/victim, damage, damage_type = BRUTE, armour_flag = MELEE, knockdown = 0, armour_penetration = 0, already_scaled = FALSE)
damage = npc_zone_damage(damage, src, already_scaled)
if(ismecha(victim))
var/obj/vehicle/sealed/mecha/mech = victim
@@ -572,7 +599,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
return TRUE
/// Whoever hurt it within BOUNTY_BOSS_REVENGE_TIME (their mech, if they were in one), if it may still go after them
-/mob/living/basic/bounty_criminal/boss/proc/boss_revenge_target()
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_revenge_target()
if(world.time > boss_last_attacked_at + BOUNTY_BOSS_REVENGE_TIME)
return null
var/atom/attacker = boss_target_for(boss_last_attacker?.resolve())
@@ -582,7 +609,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
* `attacker` went for it: a person, or a mech and everyone in it (H2). The hunters behind it go on
* its grudge list and into its posse, it turns hostile, and it remembers whom to turn on.
*/
-/mob/living/basic/bounty_criminal/boss/proc/boss_note_attacker(atom/attacker)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_note_attacker(atom/attacker)
if(stat == DEAD || QDELETED(attacker) || attacker == src)
return FALSE
var/list/hunters = list()
@@ -599,7 +626,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
return TRUE
/// The nearest hunter (or their mech) still on its site within BOUNTY_BOSS_HUNT_RANGE, for the hunt. Only players with a client count, from SSmobs' list for its level.
-/mob/living/basic/bounty_criminal/boss/proc/boss_nearest_hunter()
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_nearest_hunter()
var/turf/here = get_turf(src)
if(!here || here.z > length(SSmobs.clients_by_zlevel))
return null
@@ -621,7 +648,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
// ----- where it may reach, and what it may break -----
/// Whether an ability's effect may reach `spot` (M2): on its site, and never in a ship (other than the one it is wanted aboard), a hangar or an outpost
-/mob/living/basic/bounty_criminal/boss/proc/boss_reach_ok(turf/spot)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_reach_ok(turf/spot)
spot = get_turf(spot)
return !isnull(spot) && body_on_site(spot) && !body_forbidden_turf(spot)
@@ -630,24 +657,24 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
* P2's environment_damage_allowed(): its own site, never a trader outpost, and never within
* BOUNTY_ENV_SAFE_RANGE tiles of a player ship, a hangar, a player outpost or a planet's dock strip.
*/
-/mob/living/basic/bounty_criminal/boss/proc/boss_environment_allowed(turf/spot)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_environment_allowed(turf/spot)
spot = get_turf(spot)
if(!spot || spot.z != z)
return FALSE
return environment_damage_allowed(spot)
/// Whether a thrown or fired ability may be aimed at `spot` (M2): somewhere it could walk itself, and allowed for environment damage
-/mob/living/basic/bounty_criminal/boss/proc/boss_landing_ok(turf/spot)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_landing_ok(turf/spot)
spot = get_turf(spot)
return !isnull(spot) && leash_ok(spot) && boss_environment_allowed(spot)
/// The air pressure on `spot`, in kPa
-/mob/living/basic/bounty_criminal/boss/proc/boss_turf_pressure(turf/spot)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_turf_pressure(turf/spot)
var/datum/gas_mixture/air = spot?.return_air()
return air ? air.return_pressure() : 0
/// Whether `spot` holds an airlock with space, another ship or somewhere off its site on one side: an outer airlock
-/mob/living/basic/bounty_criminal/boss/proc/boss_outer_airlock_turf(turf/spot)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_outer_airlock_turf(turf/spot)
if(!(locate(/obj/machinery/door/airlock) in spot))
return FALSE
for(var/direction in GLOB.cardinals)
@@ -661,7 +688,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
* another ship, a hangar or an outpost, with air in it. A ship's tile counts only if nothing around
* it is space, off its site, another ship, or an outer airlock.
*/
-/mob/living/basic/bounty_criminal/boss/proc/boss_indoor_turf(turf/spot)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_indoor_turf(turf/spot)
if(!spot || isspaceturf(spot) || isgroundlessturf(spot) || islava(spot) || ischasm(spot))
return FALSE
var/area/spot_area = get_area(spot)
@@ -682,7 +709,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
* than BOUNTY_BOSS_INTERIOR_MAX_PRESSURE_GAP between their pressures (L2). Never a hull, never an
* outside wall, never a window onto space, the outdoors, a vacuum or another ship.
*/
-/mob/living/basic/bounty_criminal/boss/proc/boss_interior_spot(turf/spot)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_interior_spot(turf/spot)
if(!spot)
return FALSE
var/list/open_sides = list()
@@ -712,15 +739,16 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
/**
* Whether its abilities may damage `thing`: allowed there (boss_environment_allowed(), and P2's
- * may_attack(), which refuses structures off its site), indoors on both sides, and a kind it breaks
- * (tables, chairs, windows, grilles, barricades; plain walls and doors only while its
- * BOUNTY_BOSS_WALL_BUDGET lasts). Never anything indestructible or outpost property.
+ * may_attack_scope(), which refuses structures off its site), indoors on both sides, and a kind it
+ * breaks (tables, chairs, windows, grilles, barricades; plain walls and doors only while its
+ * BOUNTY_BOSS_WALL_BUDGET lasts). Never anything indestructible or outpost property. It is about the
+ * place and the thing, not about the boss's own state: a grenade already thrown still lands.
*/
-/mob/living/basic/bounty_criminal/boss/proc/boss_may_break(atom/thing)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_may_break(atom/thing)
if(QDELETED(thing))
return FALSE
var/turf/spot = get_turf(thing)
- if(!boss_environment_allowed(spot) || !may_attack(thing) || !boss_interior_spot(spot))
+ if(!boss_environment_allowed(spot) || !may_attack_scope(thing) || !boss_interior_spot(spot))
return FALSE
if(isturf(thing))
if(!iswallturf(thing) || istype(thing, /turf/closed/wall/r_wall) || isindestructiblewall(thing))
@@ -741,7 +769,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
* with its frame, so the way through really opens; either spends the fight's wall budget, as does a
* door that damage alone destroys. Returns TRUE if it did damage.
*/
-/mob/living/basic/bounty_criminal/boss/proc/boss_damage_structure(atom/thing, damage, list/tally, damage_flag = MELEE)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_damage_structure(atom/thing, damage, list/tally, damage_flag = MELEE)
if(length(tally) && tally[1] <= 0)
return FALSE
if(!boss_may_break(thing))
@@ -772,156 +800,112 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
boss_walls_left--
return TRUE
-/// With its boss gone, whom its leftover fire or blast may still hurt: awake hunters, and mechs with one in them
-/proc/bounty_boss_orphan_victim(atom/thing)
- if(ismecha(thing))
- var/obj/vehicle/sealed/mecha/mech = thing
- for(var/mob/living/pilot in mech.occupants)
- if(bounty_boss_is_hunter(pilot) && pilot.stat == CONSCIOUS)
- return TRUE
- return FALSE
- var/mob/living/person = thing
- return isliving(person) && !ismecha(person.loc) && person.stat == CONSCIOUS && bounty_boss_is_hunter(person)
-
// ===== SIGNALS =====
/**
* The boss's signal hooks, on a component of their own so they never replace a handler P2 or P3
- * registers on the same mob for the same signal. Each one hands over to a boss proc.
+ * registers on the same mob for the same signal. Each one hands over to a boss proc. Being disabled is
+ * read from tg's own state changes: crit, cuffs, stamcrit, stuns and knockdowns (CB-24).
*/
/datum/component/bounty_boss_signals
/datum/component/bounty_boss_signals/Initialize()
- if(!istype(parent, /mob/living/basic/bounty_criminal/boss))
+ if(!istype(parent, /mob/living/carbon/human/npc/bounty_criminal/boss))
return COMPONENT_INCOMPATIBLE
/datum/component/bounty_boss_signals/RegisterWithParent()
- RegisterSignal(parent, COMSIG_LIVING_HEALTH_UPDATE, PROC_REF(on_health))
RegisterSignal(parent, COMSIG_ATOM_WAS_ATTACKED, PROC_REF(on_attacked))
RegisterSignal(parent, COMSIG_AI_BLACKBOARD_KEY_SET(BB_BASIC_MOB_CURRENT_TARGET), PROC_REF(on_target))
RegisterSignals(parent, list(
- COMSIG_BOUNTY_CRIMINAL_DOWNED,
- COMSIG_BOUNTY_CRIMINAL_RESTRAINED,
- COMSIG_LIVING_ENTER_STAMCRIT,
+ SIGNAL_ADDTRAIT(TRAIT_CRITICAL_CONDITION),
+ SIGNAL_ADDTRAIT(TRAIT_RESTRAINED),
SIGNAL_ADDTRAIT(TRAIT_INCAPACITATED),
SIGNAL_ADDTRAIT(TRAIT_FLOORED),
- SIGNAL_ADDTRAIT(TRAIT_BOUNTY_SURRENDERED),
+ COMSIG_LIVING_ENTER_STAMCRIT,
), PROC_REF(on_disabled))
- RegisterSignals(parent, list(COMSIG_BOUNTY_CRIMINAL_RECOVERED, COMSIG_BOUNTY_CRIMINAL_UNRESTRAINED), PROC_REF(on_freed))
RegisterSignal(parent, COMSIG_PROJECTILE_PREHIT, PROC_REF(on_prehit))
- RegisterSignal(parent, COMSIG_LIVING_CHECK_BLOCK, PROC_REF(on_check_block))
RegisterSignal(parent, COMSIG_MOB_AFTER_APPLY_DAMAGE, PROC_REF(on_damaged))
RegisterSignal(parent, COMSIG_ATOM_ATTACKBY, PROC_REF(on_attackby))
RegisterSignal(parent, COMSIG_MOB_FLASHED, PROC_REF(on_flashed))
- RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
+ RegisterSignal(parent, COMSIG_MOB_ITEM_ATTACK, PROC_REF(on_item_attack))
/datum/component/bounty_boss_signals/UnregisterFromParent()
UnregisterSignal(parent, list(
- COMSIG_LIVING_HEALTH_UPDATE,
COMSIG_ATOM_WAS_ATTACKED,
COMSIG_AI_BLACKBOARD_KEY_SET(BB_BASIC_MOB_CURRENT_TARGET),
- COMSIG_BOUNTY_CRIMINAL_DOWNED,
- COMSIG_BOUNTY_CRIMINAL_RESTRAINED,
- COMSIG_LIVING_ENTER_STAMCRIT,
+ SIGNAL_ADDTRAIT(TRAIT_CRITICAL_CONDITION),
+ SIGNAL_ADDTRAIT(TRAIT_RESTRAINED),
SIGNAL_ADDTRAIT(TRAIT_INCAPACITATED),
SIGNAL_ADDTRAIT(TRAIT_FLOORED),
- SIGNAL_ADDTRAIT(TRAIT_BOUNTY_SURRENDERED),
- COMSIG_BOUNTY_CRIMINAL_RECOVERED,
- COMSIG_BOUNTY_CRIMINAL_UNRESTRAINED,
+ COMSIG_LIVING_ENTER_STAMCRIT,
COMSIG_PROJECTILE_PREHIT,
- COMSIG_LIVING_CHECK_BLOCK,
COMSIG_MOB_AFTER_APPLY_DAMAGE,
COMSIG_ATOM_ATTACKBY,
COMSIG_MOB_FLASHED,
- COMSIG_MOVABLE_MOVED,
+ COMSIG_MOB_ITEM_ATTACK,
))
-/datum/component/bounty_boss_signals/proc/on_health(mob/living/basic/bounty_criminal/boss/source)
- SIGNAL_HANDLER
- source.boss_update_tired()
-
// A person or a mech (relay_attackers reports mech melee with the mech as the attacker).
-/datum/component/bounty_boss_signals/proc/on_attacked(mob/living/basic/bounty_criminal/boss/source, atom/attacker, attack_flags)
+/datum/component/bounty_boss_signals/proc/on_attacked(mob/living/carbon/human/npc/bounty_criminal/boss/source, atom/attacker, attack_flags)
SIGNAL_HANDLER
if(!(attack_flags & (ATTACKER_DAMAGING_ATTACK | ATTACKER_STAMINA_ATTACK)))
return
source.boss_note_attacker(attacker)
-/datum/component/bounty_boss_signals/proc/on_target(mob/living/basic/bounty_criminal/boss/source)
+/datum/component/bounty_boss_signals/proc/on_target(mob/living/carbon/human/npc/bounty_criminal/boss/source)
SIGNAL_HANDLER
var/atom/target = source.ai_controller?.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
for(var/mob/living/person as anything in source.boss_people_in(target))
if(bounty_boss_is_hunter(person))
source.boss_turn_hostile(person)
-/datum/component/bounty_boss_signals/proc/on_disabled(mob/living/basic/bounty_criminal/boss/source)
+/datum/component/bounty_boss_signals/proc/on_disabled(mob/living/carbon/human/npc/bounty_criminal/boss/source)
SIGNAL_HANDLER
source.boss_interrupt()
- source.boss_update_hold()
-
-/datum/component/bounty_boss_signals/proc/on_freed(mob/living/basic/bounty_criminal/boss/source)
- SIGNAL_HANDLER
- source.boss_update_hold()
- // Not forced: P2's rally may have just set the stamina coefficient for itself.
- source.boss_update_tired(silent = TRUE)
- // Hunters who joined while it was down or cuffed count now, keeping its share of health (M4).
- source.boss_apply_posse_health(announce = FALSE)
-/datum/component/bounty_boss_signals/proc/on_prehit(mob/living/basic/bounty_criminal/boss/source, obj/projectile/shot)
+/datum/component/bounty_boss_signals/proc/on_prehit(mob/living/carbon/human/npc/bounty_criminal/boss/source, obj/projectile/shot)
SIGNAL_HANDLER
// relay_attackers drops shots whose firer isn't a mob, so a mech's gunfire is noted here (H2).
if(ismecha(shot.firer) && shot.is_hostile_projectile())
source.boss_note_attacker(shot.firer)
- return source.boss_projectile_prehit(shot)
-
-/datum/component/bounty_boss_signals/proc/on_check_block(mob/living/basic/bounty_criminal/boss/source, atom/hit_by, damage, attack_text, attack_type, armour_penetration, damage_type)
- SIGNAL_HANDLER
- return source.boss_check_block(hit_by, attack_text, attack_type)
+ return NONE
-/datum/component/bounty_boss_signals/proc/on_damaged(mob/living/basic/bounty_criminal/boss/source, damage, damagetype)
+/datum/component/bounty_boss_signals/proc/on_damaged(mob/living/carbon/human/npc/bounty_criminal/boss/source, damage, damagetype)
SIGNAL_HANDLER
if(damage > 0)
source.boss_took_damage(damage, damagetype)
-/datum/component/bounty_boss_signals/proc/on_attackby(mob/living/basic/bounty_criminal/boss/source, obj/item/attacking_item, mob/living/user)
+/datum/component/bounty_boss_signals/proc/on_attackby(mob/living/carbon/human/npc/bounty_criminal/boss/source, obj/item/attacking_item, mob/living/user)
SIGNAL_HANDLER
var/obj/item/assembly/flash/flash = attacking_item
if(istype(flash) && !flash.burnt_out && isliving(user))
source.boss_flashed(user)
return NONE
-/datum/component/bounty_boss_signals/proc/on_flashed(mob/living/basic/bounty_criminal/boss/source)
+/datum/component/bounty_boss_signals/proc/on_flashed(mob/living/carbon/human/npc/bounty_criminal/boss/source)
SIGNAL_HANDLER
source.boss_flashed()
-/datum/component/bounty_boss_signals/proc/on_moved(mob/living/basic/bounty_criminal/boss/source)
+/datum/component/bounty_boss_signals/proc/on_item_attack(mob/living/carbon/human/npc/bounty_criminal/boss/source, mob/living/target, mob/living/user)
SIGNAL_HANDLER
- source.boss_moved()
-
-// Kit hooks for those signals. None of them may sleep.
-
-/// A projectile is about to hit it: return PROJECTILE_INTERRUPT_HIT_PHASE to dodge it
-/mob/living/basic/bounty_criminal/boss/proc/boss_projectile_prehit(obj/projectile/shot)
- SHOULD_NOT_SLEEP(TRUE)
+ if(user == source && isliving(target) && target != source)
+ source.boss_landed_blow(target, source.get_active_held_item())
return NONE
-/// A blow or a thrown thing is about to land: return SUCCESSFUL_BLOCK to make it miss
-/mob/living/basic/bounty_criminal/boss/proc/boss_check_block(atom/hit_by, attack_text, attack_type)
- SHOULD_NOT_SLEEP(TRUE)
- return NONE
+// Kit hooks for those signals. None of them may sleep.
/// Damage landed on it
-/mob/living/basic/bounty_criminal/boss/proc/boss_took_damage(damage, damagetype)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_took_damage(damage, damagetype)
SHOULD_NOT_SLEEP(TRUE)
return
/// Flashed, by a handheld flash (`user`) or a flash going off near it
-/mob/living/basic/bounty_criminal/boss/proc/boss_flashed(mob/living/user)
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_flashed(mob/living/user)
SHOULD_NOT_SLEEP(TRUE)
return
-/// It took a step
-/mob/living/basic/bounty_criminal/boss/proc/boss_moved()
+/// It swung `weapon` at `victim` with its own hand
+/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_landed_blow(mob/living/victim, obj/item/weapon)
SHOULD_NOT_SLEEP(TRUE)
return
@@ -967,7 +951,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
. = ..()
if(!.)
return FALSE
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
return istype(boss) && boss.boss_can_use_ability()
/// Whether it is worth using on `target` now: in range, in sight, and so on
@@ -980,17 +964,17 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
/// Whether a thrown or fired ability may be aimed at where `target` stands (M2)
/datum/action/cooldown/mob_cooldown/bounty_boss/proc/landing_ok(atom/target)
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
return istype(boss) && boss.boss_landing_ok(get_turf(target))
/datum/action/cooldown/mob_cooldown/bounty_boss/Activate(atom/target)
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
if(!istype(boss) || QDELETED(target))
return FALSE
var/serial = boss.boss_begin_ability(src)
if(!serial)
return FALSE
- StartCooldown(cooldown_time * boss.boss_cooldown_mult())
+ StartCooldown(cooldown_time)
pending_serial = serial
pending_target = WEAKREF(target)
// Marks left lingering from the last use look after themselves.
@@ -1012,7 +996,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
pending_serial = 0
pending_target = null
clear_telegraphs()
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
if(!istype(boss) || boss.boss_busy != "windup" || boss.boss_busy_serial != serial || !boss.boss_can_act())
return FALSE
boss.boss_winding_ref = null
@@ -1066,7 +1050,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
/// Damages `thing` as part of this use, within its cap and the fight's wall budget
/datum/action/cooldown/mob_cooldown/bounty_boss/proc/break_thing(atom/thing, damage, damage_flag = MELEE)
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
if(!istype(boss))
return FALSE
if(!structure_tally)
@@ -1147,10 +1131,13 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
/**
* A patch of a boss's fire: flames on `turfs` for `lifetime`, only where its boss's abilities may
- * reach (never off its site or in a ship, hangar or outpost, M2). A hunter it may hurt who stands in
- * them is set alight (/datum/status_effect/bounty_boss_burning) every second; a mech with a hunter
- * in it takes the burn on its hull. Effect-only fire: no gas, no hotspots, nothing flammable set
- * burning, no fire alarms. Capped at BOUNTY_BOSS_FIRE_POOL_CAP server-wide.
+ * reach (never off its site or in a ship, hangar or outpost, M2). The patch itself is scripted: it
+ * makes no gas and no hotspot and lights nothing, so it never spreads or sets off fire alarms (site
+ * safety). Whoever it catches burns for real (CB-8): `landing_damage` burn against fire armour where it
+ * first lands, then tg's own fire stacks and ignite_mob() (`new_landing_stacks` on landing,
+ * BOUNTY_BOSS_FIRE_TICK_STACKS every second they stand in it), whatever state they are in. From then on
+ * it is tg's fire on them: firesuits, stop-drop-and-roll, extinguishers, showers and wet clothes all
+ * work. A mech with someone in it takes the burn on its hull. Capped at BOUNTY_BOSS_FIRE_POOL_CAP.
*/
/obj/effect/bounty_boss_fire_pool
name = "fire"
@@ -1162,16 +1149,23 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
light_color = LIGHT_COLOR_FIRE
/// The tiles burning
var/list/turfs
- /// The boss whose fire it is, for who it may hurt
+ /// The boss whose fire it is, for who it catches
var/datum/weakref/boss_ref
+ /// Its boss's factions when it was lit: its fire never catches its own side, even with the boss gone
+ var/list/side_factions
+ /// Its boss's zone damage factor when it was lit (1 for a human boss)
var/damage_factor = 1
+ /// Fire stacks it puts on whoever it catches where it first lands
+ var/landing_stacks = BOUNTY_BOSS_FIRE_TICK_STACKS
-/obj/effect/bounty_boss_fire_pool/Initialize(mapload, list/fire_turfs, lifetime, mob/living/basic/bounty_criminal/boss/boss, landing_damage = 0)
+/obj/effect/bounty_boss_fire_pool/Initialize(mapload, list/fire_turfs, lifetime, mob/living/carbon/human/npc/bounty_criminal/boss/boss, landing_damage = 0, new_landing_stacks)
. = ..()
if(length(GLOB.bounty_boss_fire_pools) >= BOUNTY_BOSS_FIRE_POOL_CAP)
return INITIALIZE_HINT_QDEL
GLOB.bounty_boss_fire_pools += src
lifetime = lifetime || 4 SECONDS
+ if(!isnull(new_landing_stacks))
+ landing_stacks = new_landing_stacks
turfs = list()
for(var/turf/spot as anything in fire_turfs)
if(isturf(spot) && !isclosedturf(spot) && (!boss || boss.boss_reach_ok(spot)))
@@ -1179,6 +1173,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
if(!length(turfs))
return INITIALIZE_HINT_QDEL
boss_ref = boss ? WEAKREF(boss) : null
+ side_factions = boss ? boss.faction.Copy() : null
damage_factor = boss ? boss.get_npc_zone_damage_factor() : 1
// Invisible, but the light comes from here: sit it where the fire is.
var/turf/middle = turfs[round((length(turfs) + 1) / 2)]
@@ -1186,7 +1181,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
forceMove(middle)
for(var/turf/spot as anything in turfs)
new /obj/effect/temp_visual/bounty_boss_flames(spot, lifetime)
- scorch(landing_damage)
+ scorch(landing_damage, landing_stacks)
addtimer(CALLBACK(src, PROC_REF(scorch)), 1 SECONDS, TIMER_LOOP | TIMER_DELETE_ME)
addtimer(CALLBACK(src, PROC_REF(burn_out)), lifetime, TIMER_DELETE_ME)
@@ -1194,111 +1189,96 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
GLOB.bounty_boss_fire_pools -= src
turfs = null
boss_ref = null
+ side_factions = null
return ..()
-/// Whether it may burn `victim`: its boss's rules, or with the boss gone, awake hunters and their mechs
+/// Whether it catches `victim`: its boss's rules, or with the boss gone, anyone not on the boss's side. Never by the victim's state (CB-11).
/obj/effect/bounty_boss_fire_pool/proc/may_burn(atom/victim)
- var/mob/living/basic/bounty_criminal/boss/boss = boss_ref?.resolve()
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = boss_ref?.resolve()
if(!QDELETED(boss))
- return boss.boss_can_hurt(victim)
- return bounty_boss_orphan_victim(victim)
+ return boss.boss_effect_hits(victim)
+ return bounty_boss_effect_victim(victim, side_factions)
-/// Sets alight everyone it may burn in the flames, with `damage` burn first if given; mechs take the burn on the hull
-/obj/effect/bounty_boss_fire_pool/proc/scorch(damage = 0)
+/**
+ * Catches everyone in the flames: `damage` burn against fire armour if given (the jet or the bottle
+ * landing), then `stacks` of tg's fire stacks and ignite_mob(). Mechs take the burn on the hull.
+ */
+/obj/effect/bounty_boss_fire_pool/proc/scorch(damage = 0, stacks = BOUNTY_BOSS_FIRE_TICK_STACKS)
for(var/turf/spot as anything in turfs)
for(var/atom/movable/thing as anything in spot)
if(!(isliving(thing) || ismecha(thing)) || !may_burn(thing))
continue
if(ismecha(thing))
var/obj/vehicle/sealed/mecha/mech = thing
- mech.take_damage(npc_zone_damage(max(damage, BOUNTY_BOSS_BURNING_DAMAGE), damage_factor), BURN, FIRE, FALSE)
+ mech.take_damage(npc_zone_damage(max(damage, 3), damage_factor), BURN, FIRE, FALSE)
continue
var/mob/living/victim = thing
if(damage > 0)
victim.apply_damage(npc_zone_damage(damage, damage_factor), BURN, blocked = victim.run_armor_check(null, FIRE, silent = TRUE), spread_damage = TRUE)
to_chat(victim, span_userdanger("You're caught in the flames!"))
- victim.apply_status_effect(/datum/status_effect/bounty_boss_burning, damage_factor)
+ if(stacks > 0)
+ victim.adjust_fire_stacks(stacks)
+ victim.ignite_mob()
/obj/effect/bounty_boss_fire_pool/proc/burn_out()
qdel(src)
-/**
- * Set alight by a boss's fire: BOUNTY_BOSS_BURNING_DAMAGE burn a second, against fire armour, for
- * BOUNTY_BOSS_BURNING_TIME, renewed while standing in the flames. It goes out once they are down
- * (C4, M3). Scripted: it never lights the air or anything else.
- */
-/datum/status_effect/bounty_boss_burning
- id = "bounty_boss_burning"
- duration = BOUNTY_BOSS_BURNING_TIME
- tick_interval = 1 SECONDS
- status_type = STATUS_EFFECT_REFRESH
- alert_type = null
- /// The flames on them
- var/mutable_appearance/flames
- var/damage_factor = 1
-
-/datum/status_effect/bounty_boss_burning/on_creation(mob/living/new_owner, factor = 1)
- damage_factor = factor
- return ..()
-
-/datum/status_effect/bounty_boss_burning/refresh(mob/living/new_owner, factor = 1)
- damage_factor = factor
- return ..()
-
-/datum/status_effect/bounty_boss_burning/on_apply()
- if(owner.stat != CONSCIOUS || HAS_TRAIT(owner, TRAIT_NOFIRE))
- return FALSE
- flames = mutable_appearance('icons/mob/effects/onfire.dmi', ishuman(owner) ? "human_small_fire" : "generic_fire", -HIGHEST_LAYER, appearance_flags = RESET_COLOR | KEEP_APART)
- owner.add_overlay(flames)
- return TRUE
-
-/datum/status_effect/bounty_boss_burning/tick(seconds_between_ticks)
- if(owner.stat != CONSCIOUS)
- qdel(src)
- return
- owner.apply_damage(npc_zone_damage(BOUNTY_BOSS_BURNING_DAMAGE, damage_factor), BURN, blocked = owner.run_armor_check(null, FIRE, silent = TRUE), spread_damage = TRUE)
-
-/datum/status_effect/bounty_boss_burning/on_remove()
- if(flames)
- owner.cut_overlay(flames)
- flames = null
-
// ===== THE MIND =====
/**
- * Its planning: nothing while it is busy or can't act; its target; an ability; the kit's way of
- * closing in or keeping away; its melee attack; and with nobody in sight, the hunt for the nearest
- * hunter still on its site.
- *
- * TODO(P3 integration): if start_activity() needs a planning subtree to run, add it to the end of
- * this list, so a boss waiting for hunters does its activity.
+ * Its planning, on a real human body (contract 2.4): soft crit and breaking free first; nothing while
+ * it is busy or can't act; worn out, it falls back; its stimulant; its target; its kit's gear; drawing
+ * its weapon once its fight has started; an ability; the kit's way of closing in or keeping away; its
+ * melee with what it holds; patching itself up with nobody about; and with nobody in sight, the hunt
+ * for the nearest hunter still on its site. Bosses never surrender.
*/
/datum/ai_controller/basic_controller/bounty_boss
blackboard = list(
- BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/bounty_boss,
- BB_TARGET_MINIMUM_STAT = CONSCIOUS,
+ BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/human_npc/bounty_boss,
+ BB_TARGET_MINIMUM_STAT = HUMAN_NPC_SPARES_DOWNED,
BB_AGGRO_RANGE = BOUNTY_BOSS_POSSE_RANGE,
)
- ai_movement = /datum/ai_movement/jps
+ ai_movement = /datum/ai_movement/jps/bounty
idle_behavior = null
planning_subtrees = list(
+ /datum/ai_planning_subtree/human_npc_soft_crit,
+ /datum/ai_planning_subtree/bounty_escape_captivity,
/datum/ai_planning_subtree/bounty_boss_busy,
+ /datum/ai_planning_subtree/bounty_boss_worn_out,
+ /datum/ai_planning_subtree/bounty_boss_stimulant,
/datum/ai_planning_subtree/bounty_boss_target,
/datum/ai_planning_subtree/simple_find_target,
+ /datum/ai_planning_subtree/bounty_boss_gear,
+ /datum/ai_planning_subtree/human_npc_arm/bounty_boss,
/datum/ai_planning_subtree/bounty_boss_abilities,
/datum/ai_planning_subtree/bounty_boss_engage,
- /datum/ai_planning_subtree/basic_melee_attack_subtree,
+ /datum/ai_planning_subtree/human_npc_melee,
+ /datum/ai_planning_subtree/bounty_treat_self,
/datum/ai_planning_subtree/bounty_boss_hunt,
)
+/datum/ai_controller/basic_controller/bounty_boss/TryPossessPawn(atom/new_pawn)
+ if(!ishumannpc(new_pawn))
+ return AI_CONTROLLER_INCOMPATIBLE
+ return ..()
+
+// Cuffs and soft crit don't stop it (the human NPC base's run check), so it can work at its cuffs and crawl.
+/datum/ai_controller/basic_controller/bounty_boss/get_able_to_run()
+ return human_npc_ai_able_to_run(src)
+
+/datum/ai_controller/basic_controller/bounty_boss/on_stat_changed(mob/living/source, new_stat)
+ . = ..()
+ human_npc_ai_stat_changed(src, new_stat)
+
/**
- * Hunters it may hurt, and mechs with one in them (H2); never anyone already down (C4). tg's own mech
- * branch would test the pilot, whom it only hurts through the mech, so a mech is judged here.
+ * Hunters it may go after, and mechs with one in them (H2); never anyone already down (C4,
+ * npc_target_stat). tg's own mech branch would test the pilot, whom it only hurts through the mech, so
+ * a mech is judged here.
*/
-/datum/targeting_strategy/basic/bounty_boss
+/datum/targeting_strategy/basic/human_npc/bounty_boss
-/datum/targeting_strategy/basic/bounty_boss/can_attack(mob/living/living_mob, atom/the_target, vision_range)
- var/mob/living/basic/bounty_criminal/boss/boss = living_mob
+/datum/targeting_strategy/basic/human_npc/bounty_boss/can_attack(mob/living/living_mob, atom/the_target, vision_range)
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = living_mob
if(!istype(boss) || !boss.boss_valid_target(the_target))
return FALSE
if(ismecha(the_target))
@@ -1306,19 +1286,81 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
return isturf(boss.loc) && the_target.z == boss.z && get_dist(boss, the_target) <= range && can_see(boss, the_target, range)
return ..()
-/// Nothing at all while it winds up, charges or reels, or while it can't act
+/// Nothing at all while it winds up, charges or bursts, or while it can't act (tg's states)
/datum/ai_planning_subtree/bounty_boss_busy
/datum/ai_planning_subtree/bounty_boss_busy/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/bounty_criminal/boss/boss = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = controller.pawn
if(!istype(boss) || boss.boss_busy || !boss.boss_can_act())
return SUBTREE_RETURN_FINISH_PLANNING
+/**
+ * Worn out (boss_is_worn_out(), its body's real state): the first time, it says so and shows it to
+ * the hunters (boss_wear_out()); then it falls back from whoever it was fighting for
+ * BOUNTY_BOSS_FALLBACK_TIME, and after that its second wind is due (bounty_boss_stimulant). Back above
+ * the line (healed, or its stamina back), it is fresh again.
+ */
+/datum/ai_planning_subtree/bounty_boss_worn_out
+
+/datum/ai_planning_subtree/bounty_boss_worn_out/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = controller.pawn
+ if(!istype(boss) || !boss.boss_hostile)
+ return
+ if(!boss.boss_is_worn_out())
+ boss.boss_worn_out = FALSE
+ boss.boss_fallback_until = 0
+ return
+ if(!boss.boss_worn_out)
+ boss.boss_wear_out()
+ if(world.time >= boss.boss_fallback_until)
+ if(boss.boss_fallback_until && boss.boss_stimulants_used < BOUNTY_BOSS_STIMULANTS)
+ boss.boss_second_wind_due = TRUE
+ boss.boss_fallback_until = 0
+ return
+ var/atom/threat = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET] || boss.boss_revenge_target()
+ if(QDELETED(threat))
+ return
+ controller.set_blackboard_key(BB_BOUNTY_BOSS_FALL_BACK_FROM, threat)
+ controller.queue_behavior(/datum/ai_behavior/run_away_from_target, BB_BOUNTY_BOSS_FALL_BACK_FROM)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/**
+ * Its combat stimulant (defaults 1.6, CR-4): the first pen as its fight starts, the second for its
+ * second wind once a fall back is over, each a real pen it carries, used on itself the player's way
+ * through the core's bounty_ai_use_injector() (a visible emote first). The second comes with its
+ * "recover" line ("Round two."). While a pen is going in, it keeps at it.
+ */
+/datum/ai_planning_subtree/bounty_boss_stimulant
+
+/datum/ai_planning_subtree/bounty_boss_stimulant/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = controller.pawn
+ if(!istype(boss) || !boss.boss_hostile)
+ return
+ var/obj/item/reagent_containers/hypospray/medipen/using = controller.blackboard[BB_HUMAN_NPC_TREAT_ITEM]
+ if(istype(using) && !QDELETED(using) && !using.used_up && bounty_ai_is_stimulant(using))
+ controller.queue_behavior(/datum/ai_behavior/human_npc_treat_self, BB_HUMAN_NPC_TREAT_ITEM)
+ return SUBTREE_RETURN_FINISH_PLANNING
+ if(!boss.boss_wants_stimulant())
+ return
+ var/obj/item/reagent_containers/hypospray/medipen/pen = bounty_ai_find_injector(boss, BOUNTY_BOSS_STIMULANT)
+ if(isnull(pen))
+ // Nothing left to take: it fights on as it is.
+ boss.boss_stimulants_used = BOUNTY_BOSS_STIMULANTS
+ boss.boss_second_wind_due = FALSE
+ return
+ if(!bounty_ai_use_injector(controller, pen))
+ return
+ boss.boss_stimulants_used++
+ if(boss.boss_second_wind_due)
+ boss.boss_second_wind_due = FALSE
+ INVOKE_ASYNC(boss, TYPE_PROC_REF(/mob/living, bounty_say), "recover", null, TRUE)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
/// Drops a target it may no longer go after, and turns on whoever hurt it last when it has none
/datum/ai_planning_subtree/bounty_boss_target
/datum/ai_planning_subtree/bounty_boss_target/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/bounty_criminal/boss/boss = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = controller.pawn
var/datum/targeting_strategy/strategy = GET_TARGETING_STRATEGY(controller.blackboard[BB_TARGETING_STRATEGY])
var/atom/current = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
if(current && !strategy?.can_attack(boss, current, BOUNTY_BOSS_POSSE_RANGE))
@@ -1330,11 +1372,30 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
if(avenge && strategy?.can_attack(boss, avenge, BOUNTY_BOSS_POSSE_RANGE))
controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, avenge)
+/// The kit's own gear, once its fight is on: a Heavy changing the belt in its gun
+/datum/ai_planning_subtree/bounty_boss_gear
+
+/datum/ai_planning_subtree/bounty_boss_gear/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = controller.pawn
+ if(!istype(boss) || !boss.boss_hostile)
+ return
+ if(boss.boss_gear_plan(controller))
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/// The human NPC base's arming (reload or draw what it carries), only once its fight has started: until then its weapon stays where it carries it
+/datum/ai_planning_subtree/human_npc_arm/bounty_boss
+
+/datum/ai_planning_subtree/human_npc_arm/bounty_boss/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = controller.pawn
+ if(!istype(boss) || !boss.boss_hostile)
+ return
+ return ..()
+
/// One ability, if one is ready, worth it, and not the one it used last
/datum/ai_planning_subtree/bounty_boss_abilities
/datum/ai_planning_subtree/bounty_boss_abilities/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/bounty_criminal/boss/boss = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = controller.pawn
var/atom/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
if(QDELETED(target))
return
@@ -1349,7 +1410,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
/datum/ai_behavior/bounty_boss_ability
/datum/ai_behavior/bounty_boss_ability/perform(seconds_per_tick, datum/ai_controller/controller, ability_key, target_key)
- var/mob/living/basic/bounty_criminal/boss/boss = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = controller.pawn
var/datum/action/cooldown/mob_cooldown/bounty_boss/ability = controller.blackboard[ability_key]
var/atom/target = controller.blackboard[target_key]
if(QDELETED(ability) || QDELETED(target))
@@ -1366,13 +1427,34 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
/datum/ai_planning_subtree/bounty_boss_engage
/datum/ai_planning_subtree/bounty_boss_engage/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/bounty_criminal/boss/boss = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = controller.pawn
var/atom/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
if(QDELETED(target))
return
if(boss.boss_engage_plan(controller, target))
return SUBTREE_RETURN_FINISH_PLANNING
+/**
+ * One real step away from `target_key`'s target, onto ground its leash allows (P2's
+ * body_step_away_from()): tg's step_away walks on a movement that knows nothing of the leash.
+ */
+/datum/ai_behavior/bounty_boss_back_off
+ action_cooldown = 0.3 SECONDS
+ behavior_flags = AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
+
+// No quicker than its body walks: armour, wounds and stamina slow it as they slow anyone.
+/datum/ai_behavior/bounty_boss_back_off/get_cooldown(datum/ai_controller/cooldown_for)
+ var/mob/living/pawn = cooldown_for?.pawn
+ return max(action_cooldown, pawn?.cached_multiplicative_slowdown || 0)
+
+/datum/ai_behavior/bounty_boss_back_off/perform(seconds_per_tick, datum/ai_controller/controller, target_key)
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = controller.pawn
+ var/atom/target = controller.blackboard[target_key]
+ if(!istype(boss) || QDELETED(target) || !boss.boss_can_act())
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ boss.face_atom(target)
+ return boss.body_step_away_from(target) ? (AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED) : (AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED)
+
/**
* Nobody in sight while hostile: it goes after the nearest hunter still on its site, looking again
* every BOUNTY_BOSS_HUNT_INTERVAL. With nobody on the site for BOUNTY_BOSS_CALM_TIME it calms down.
@@ -1380,7 +1462,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
/datum/ai_planning_subtree/bounty_boss_hunt
/datum/ai_planning_subtree/bounty_boss_hunt/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/bounty_criminal/boss/boss = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = controller.pawn
if(!boss.boss_hostile || controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET))
return
var/atom/prey = controller.blackboard[BB_BOUNTY_BOSS_PREY]
@@ -1401,7 +1483,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades)
// ===== LOOKS =====
-/// A mini-boss's look before its kit's: plain dark clothes
+/// A mini-boss's clothes before its kit's: plain dark clothes
/datum/outfit/bounty_boss
name = "Bounty mini-boss"
uniform = /obj/item/clothing/under/color/black
diff --git a/voidcrew/modules/bounties/bounty_boss_kits.dm b/voidcrew/modules/bounties/bounty_boss_kits.dm
index 22bfcd86bb2..3e6d485036f 100644
--- a/voidcrew/modules/bounties/bounty_boss_kits.dm
+++ b/voidcrew/modules/bounties/bounty_boss_kits.dm
@@ -4,22 +4,32 @@
* Owner: P4 bosses. Do not edit this file outside P4.
*
* What it owns: the Juggernaut, Pyromaniac, Demolitionist, Ghost and Heavy
- * (/mob/living/basic/bounty_criminal/boss/, BOUNTY_KIT_*): their health, armour, weapon and
- * two abilities each (spec section 5, 12.3 C8). No kit drops real loot: the guns, grenades and
- * flamers are scripted, and the gear exists only in the look.
+ * (/mob/living/carbon/human/npc/bounty_criminal/boss/, BOUNTY_KIT_*): what each wears and carries,
+ * and its two abilities (spec section 5, 12.3 C8). Every kit is a real human in real gear, locked to its
+ * body (D3): its armour protects by tg's rules and its weapon is a real item it fights with. Its
+ * stimulants and bruise pack are packed by boss_supplies(). Nothing it carries is ever loot.
*
- * - Juggernaut: riot plates. Charges in a line, smashing tables, chairs and plain windows and
- * tearing through an interior wall; bounces off anything else and reels. Slams the floor around
- * it when someone is close.
- * - Pyromaniac: a fire suit and a flamer. Sweeps a cone of fire, and throws molotovs that leave a
- * burning patch. Fire can't hurt it; lasers can.
- * - Demolitionist: a bandolier of grenades. Keeps its distance and lobs grenades with a visible
- * fuse, and blows a hole through an interior wall or door to get at someone behind cover.
- * - Ghost: a dark cloak and a knife. Dashes in along a line, cuts that bleed, cloaks into a faint
- * shimmer that a flash or a hit breaks, dodges shots while moving, and backs off after a couple of
+ * - Juggernaut: riot armour and a body grown huge (tg's gigantism gene). Charges in a line, smashing
+ * tables, chairs and plain windows and tearing through an interior wall; running into anything else
+ * hurts it and knocks it down, as running into a wall does anyone (CB-6). Slams the floor around it
+ * when someone is close. Fights with its fists.
+ * - Pyromaniac: a real firefighter suit and helmet (tg's thermal protection, CB-7) and a lit torch.
+ * Sweeps a cone of fire and throws molotovs that leave a burning patch; whoever it catches burns with
+ * tg's fire stacks (CB-8).
+ * - Demolitionist: a hard hat, a hi-vis vest, a bandolier and a crowbar in its bag. Keeps its distance
+ * and lobs grenades with a visible fuse, and blows a hole through an interior wall or door to get at
+ * someone behind cover. Whoever a blast catches takes tg's light explosion (CB-10).
+ * - Ghost: a dark hood, a real combat knife and real chrome (Slipwire, Cascade; the OC-6 ruling).
+ * Dashes in along a line with its Cascade lattice firing and stabs at the end of it (CB-9); fades
+ * into a shimmer that is only a look, broken by a hit or a flash (CB-12); backs off after a couple of
* cuts.
- * - Heavy: heavy armour and a belt-fed gun. A laser sight and a spin-up, then a burst into a cone;
- * drops a folding barrier for cover. Slow.
+ * - Heavy: SWAT armour and a real L6 with a spare box. A laser sight and a spin-up, then a burst of
+ * real rounds into a cone (a hit while it aims spoils the shot); throws real barrier grenades for
+ * cover (CB-26); changes its own belts. Slow.
+ *
+ * Where the air would kill it, each kit seals up in its own space suit, in the armour class of what it
+ * wears in good air (bounty_sealed_gear(), bounty_suits.dm): the Juggernaut and the Heavy in armoured
+ * ones, the Pyromaniac, the Demolitionist and the Ghost in soft ones.
*
* The shared vars are declared in bounty_types.dm and nowhere else; a var only P4 uses goes here
* with a `boss_` prefix, or on the /boss subtypes.
@@ -27,40 +37,31 @@
// ===== JUGGERNAUT =====
-/mob/living/basic/bounty_criminal/boss/juggernaut
+/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut
name = "armoured criminal"
desc = "A huge criminal in riot plates, built like a door."
- maxHealth = BOUNTY_JUGGERNAUT_HEALTH_1
- health = BOUNTY_JUGGERNAUT_HEALTH_1
- mob_size = MOB_SIZE_LARGE
- speed = BOUNTY_JUGGERNAUT_SPEED
- damage_coeff = list(BRUTE = BOUNTY_JUGGERNAUT_BRUTE_MOD, BURN = BOUNTY_JUGGERNAUT_BURN_MOD, TOX = 1, STAMINA = BOUNTY_BOSS_STAMINA_FRESH * 100 / BOUNTY_BOSS_STAMINA, OXY = 1)
- melee_damage_lower = BOUNTY_JUGGERNAUT_MELEE_MIN
- melee_damage_upper = BOUNTY_JUGGERNAUT_MELEE_MAX
- armour_penetration = BOUNTY_JUGGERNAUT_MELEE_AP
- melee_attack_cooldown = BOUNTY_JUGGERNAUT_MELEE_COOLDOWN
- attack_verb_continuous = "pounds"
- attack_verb_simple = "pound"
- attack_sound = 'sound/effects/hit_punch.ogg'
- attack_vis_effect = ATTACK_EFFECT_SMASH
boss_kit = BOUNTY_KIT_JUGGERNAUT
boss_ability_types = list(
/datum/action/cooldown/mob_cooldown/bounty_boss/charge,
/datum/action/cooldown/mob_cooldown/bounty_boss/slam,
)
-/mob/living/basic/bounty_criminal/boss/juggernaut/Initialize(mapload)
+/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut/Initialize(mapload, datum/human_npc_order/order)
. = ..()
- update_transform(1.15)
+ // Its size is a real gene (CB-21, PI-21): mutadone shrinks it back like anyone else.
+ dna?.add_mutation(/datum/mutation/gigantism, MUTATION_SOURCE_ACTIVATED)
-/mob/living/basic/bounty_criminal/boss/juggernaut/boss_health_table()
- return list(BOUNTY_JUGGERNAUT_HEALTH_1, BOUNTY_JUGGERNAUT_HEALTH_2, BOUNTY_JUGGERNAUT_HEALTH_3, BOUNTY_JUGGERNAUT_HEALTH_4)
+/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut/bounty_build_outfit(zone)
+ return boss_supplies(bounty_outfit_instance(/datum/outfit/bounty_boss/juggernaut))
-/mob/living/basic/bounty_criminal/boss/juggernaut/boss_kit_outfit()
- return /datum/outfit/bounty_boss/juggernaut
+/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut/boss_gear_text()
+ if(istype(wear_suit, /obj/item/clothing/suit/armor/riot))
+ return "Riot plates cover [p_them()] from neck to boots."
+ return "[p_They()] [p_are()] built like a door."
-/mob/living/basic/bounty_criminal/boss/juggernaut/boss_gear_text()
- return "Riot plates cover [p_them()] from neck to boots."
+// Out where the air kills: a black and red space suit, as heavy as its riot plates
+/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut/bounty_sealed_gear()
+ return list(/obj/item/clothing/suit/space/syndicate/black/red, /obj/item/clothing/head/helmet/space/syndicate/black/red)
/datum/outfit/bounty_boss/juggernaut
name = "Bounty mini-boss: Juggernaut"
@@ -71,11 +72,11 @@
shoes = /obj/item/clothing/shoes/jackboots
/**
- * Charge: a roar, a stamp and a line on the floor, then a run down that line. The first hunter in
+ * Charge: a roar, a stamp and a line on the floor, then a run down that line. The first person in
* the way is slammed and knocked down (anyone else in the way only BOUNTY_JUGGERNAUT_CHARGE_BYSTANDER
* percent of the time). Tables, chairs, plain windows and grilles on the line are smashed. With
* nobody caught, it tears through an interior wall at the end of the line if its budget allows;
- * anything else stops it dead, reeling and open to damage.
+ * anything else stops it dead, hurt and on the floor (bounce()).
*/
/datum/action/cooldown/mob_cooldown/bounty_boss/charge
name = "Charge"
@@ -131,7 +132,7 @@
mark_turfs(path, "#c8a060")
/datum/action/cooldown/mob_cooldown/bounty_boss/charge/effect(atom/target)
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
if(!istype(boss) || !length(path))
path = null
return
@@ -145,7 +146,7 @@
/// One tile of the charge
/datum/action/cooldown/mob_cooldown/bounty_boss/charge/proc/charge_step(serial)
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
if(!istype(boss) || !boss.boss_still("charge", serial))
end_charge(serial)
return
@@ -158,9 +159,9 @@
if(!boss.leash_ok(next) || isspaceturf(next) || isgroundlessturf(next) || islava(next) || ischasm(next))
end_charge(serial)
return
- // Someone in the way: a hunter, or a mech with one in it, is slammed rather than bounced off (H2).
+ // Someone in the way: a person, or a mech with one in it, is slammed rather than bounced off (H2).
for(var/atom/movable/thing as anything in next)
- if(!thing.density || !(isliving(thing) || ismecha(thing)) || !boss.boss_can_hurt(thing))
+ if(!thing.density || !(isliving(thing) || ismecha(thing)) || !boss.boss_effect_hits(thing))
continue
if(thing == charge_target?.resolve() || prob(BOUNTY_JUGGERNAUT_CHARGE_BYSTANDER))
slam_into(thing)
@@ -217,8 +218,8 @@
playsound(spot, is_window ? 'sound/effects/glass/glassbr1.ogg' : 'sound/effects/woodhit.ogg', 70, TRUE)
return QDELETED(thing) || !thing.density
-/// Steps onto `next`; a plain directional window on its own tile facing that way is smashed first. Returns TRUE if it moved.
-/datum/action/cooldown/mob_cooldown/bounty_boss/charge/proc/try_step(mob/living/basic/bounty_criminal/boss/boss, turf/next)
+/// Steps onto `next` (its leash checked by charge_step()); a plain directional window on its own tile facing that way is smashed first. Returns TRUE if it moved.
+/datum/action/cooldown/mob_cooldown/bounty_boss/charge/proc/try_step(mob/living/carbon/human/npc/bounty_criminal/boss/boss, turf/next)
var/direction = get_dir(boss, next)
if(boss.Move(next, direction))
return TRUE
@@ -233,34 +234,43 @@
return FALSE
return boss.Move(next, direction)
-/// Slams into `victim`, a hunter or a mech: brute through armour, and a hunter is knocked down
+/// Slams into `victim`, a person or a mech: brute through armour, and a person is knocked down (CB-25)
/datum/action/cooldown/mob_cooldown/bounty_boss/charge/proc/slam_into(atom/victim)
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
victim.visible_message(span_danger("[boss] slams into [victim]!"), span_userdanger("[boss] slams into you!"))
playsound(victim, 'sound/effects/meteorimpact.ogg', 70, TRUE)
- boss.boss_hit(victim, BOUNTY_JUGGERNAUT_CHARGE_DAMAGE, BRUTE, MELEE, BOUNTY_JUGGERNAUT_CHARGE_KNOCKDOWN, BOUNTY_JUGGERNAUT_MELEE_AP)
+ boss.boss_hit(victim, BOUNTY_JUGGERNAUT_CHARGE_DAMAGE, BRUTE, MELEE, BOUNTY_JUGGERNAUT_CHARGE_KNOCKDOWN, BOUNTY_JUGGERNAUT_CHARGE_AP)
-/// Ran into something it can't break: stopped dead, reeling
+/**
+ * Ran into something it can't break: stopped dead, and it hurts, the way running into a wall at full
+ * tilt hurts anyone (tg's tackle splat, CB-6): brute to its head through its helmet, a blow to its
+ * stamina, a moment's paralysis and a knockdown, all tg's. No damage multiplier: on the floor it is
+ * simply easier to hit, and to cuff.
+ */
/datum/action/cooldown/mob_cooldown/bounty_boss/charge/proc/bounce(atom/obstacle, serial)
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
end_charge(serial)
if(!istype(boss) || boss.stat != CONSCIOUS)
return
boss.visible_message(span_danger("[boss] slams into [obstacle] and reels!"))
playsound(boss, 'sound/effects/bang.ogg', 80, TRUE)
- boss.boss_stagger(BOUNTY_JUGGERNAUT_WALL_STAGGER, BOUNTY_JUGGERNAUT_WALL_VULNERABLE)
+ boss.Shake(2, 1, BOUNTY_JUGGERNAUT_WALL_KNOCKDOWN)
+ boss.apply_damage(BOUNTY_JUGGERNAUT_WALL_BRUTE, BRUTE, BODY_ZONE_HEAD, boss.run_armor_check(BODY_ZONE_HEAD, MELEE, silent = TRUE))
+ boss.apply_damage(BOUNTY_JUGGERNAUT_WALL_STAMINA, STAMINA)
+ boss.Paralyze(BOUNTY_JUGGERNAUT_WALL_PARALYZE)
+ boss.Knockdown(BOUNTY_JUGGERNAUT_WALL_KNOCKDOWN)
/datum/action/cooldown/mob_cooldown/bounty_boss/charge/proc/end_charge(serial)
path = null
charge_target = null
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
if(istype(boss) && boss.boss_busy == "charge" && boss.boss_busy_serial == serial)
boss.boss_clear_busy(serial)
/**
- * Slam: both fists up and a red ring on the floor around it, then down. Every hunter it may hurt in
- * the ring takes brute through armour and is knocked down; a mech takes it on its hull. Only when
- * someone is next to it.
+ * Slam: both fists up and a red ring on the floor around it, then down. Everyone it catches in the
+ * ring, standing or not, takes brute through armour and is knocked down; a mech takes it on its hull.
+ * Only when someone is next to it.
*/
/datum/action/cooldown/mob_cooldown/bounty_boss/slam
name = "Ground Slam"
@@ -282,7 +292,7 @@
animate(transform = rest, time = 0.2 SECONDS)
/datum/action/cooldown/mob_cooldown/bounty_boss/slam/effect(atom/target)
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
boss.visible_message(span_danger("[boss] brings both fists down on the floor!"))
playsound(boss, 'sound/effects/meteorimpact.ogg', 80, TRUE)
for(var/atom/victim as anything in boss.boss_victims_on(RANGE_TURFS(1, boss)))
@@ -292,43 +302,29 @@
// ===== PYROMANIAC =====
-/mob/living/basic/bounty_criminal/boss/pyromaniac
+/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac
name = "scorched criminal"
- desc = "A criminal in a blackened fire suit, with a fuel tank on their back and a lit torch in hand."
- maxHealth = BOUNTY_PYROMANIAC_HEALTH_1
- health = BOUNTY_PYROMANIAC_HEALTH_1
- speed = BOUNTY_PYROMANIAC_SPEED
- damage_coeff = list(BRUTE = BOUNTY_PYROMANIAC_BRUTE_MOD, BURN = BOUNTY_PYROMANIAC_BURN_MOD, TOX = 1, STAMINA = BOUNTY_BOSS_STAMINA_FRESH * 100 / BOUNTY_BOSS_STAMINA, OXY = 1)
- melee_damage_lower = BOUNTY_PYROMANIAC_MELEE_MIN
- melee_damage_upper = BOUNTY_PYROMANIAC_MELEE_MAX
- armour_penetration = BOUNTY_PYROMANIAC_MELEE_AP
- melee_damage_type = BURN
- melee_attack_cooldown = BOUNTY_PYROMANIAC_MELEE_COOLDOWN
- attack_verb_continuous = "burns"
- attack_verb_simple = "burn"
- attack_sound = 'sound/items/weapons/sear.ogg'
- attack_vis_effect = ATTACK_EFFECT_SMASH
- // Fireproof, not laser-proof: no heat damage and no fire stacks, but BURN still lands.
- unsuitable_heat_damage = 0
+ desc = "A criminal in a blackened fire suit, with a lit torch in hand."
boss_kit = BOUNTY_KIT_PYROMANIAC
boss_ability_types = list(
/datum/action/cooldown/mob_cooldown/bounty_boss/flamer,
/datum/action/cooldown/mob_cooldown/bounty_boss/molotov,
)
-/mob/living/basic/bounty_criminal/boss/pyromaniac/Initialize(mapload)
- . = ..()
- add_traits(list(TRAIT_NOFIRE, TRAIT_RESISTHEAT), BOUNTY_TRAIT)
+/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/bounty_build_outfit(zone)
+ return boss_supplies(bounty_outfit_instance(/datum/outfit/bounty_boss/pyromaniac))
-/mob/living/basic/bounty_criminal/boss/pyromaniac/boss_health_table()
- return list(BOUNTY_PYROMANIAC_HEALTH_1, BOUNTY_PYROMANIAC_HEALTH_2, BOUNTY_PYROMANIAC_HEALTH_3, BOUNTY_PYROMANIAC_HEALTH_4)
+/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/boss_gear_text()
+ if(istype(wear_suit, /obj/item/clothing/suit/utility/fire))
+ return "[p_Their()] fire suit is scorched black."
+ return "[p_They()] reek[p_s()] of fuel."
-/mob/living/basic/bounty_criminal/boss/pyromaniac/boss_kit_outfit()
- return /datum/outfit/bounty_boss/pyromaniac
-
-/mob/living/basic/bounty_criminal/boss/pyromaniac/boss_gear_text()
- return "[p_Their()] fire suit is scorched black."
+// Out where the air kills: an EVA suit, as light as its fire suit. Nothing burns in vacuum.
+/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/bounty_sealed_gear()
+ return list(/obj/item/clothing/suit/space/eva, /obj/item/clothing/head/helmet/space/eva)
+// The firefighter suit and helmet are what keep its own fire off it (tg's thermal protection, CB-7). The torch
+// doesn't holster, so it is in hand from the start.
/datum/outfit/bounty_boss/pyromaniac
name = "Bounty mini-boss: Pyromaniac"
uniform = /obj/item/clothing/under/color/black
@@ -336,12 +332,12 @@
head = /obj/item/clothing/head/utility/hardhat/red
gloves = /obj/item/clothing/gloves/color/black
shoes = /obj/item/clothing/shoes/workboots
- r_hand = /obj/item/flamethrower
+ r_hand = BOUNTY_PYROMANIAC_TORCH
/**
* Flamer: the pilot light hisses and an orange cone shows on the floor, then a jet of fire sweeps
- * it. Everyone it may hurt in the cone takes BOUNTY_PYROMANIAC_FLAMER_DAMAGE burn and is set
- * alight; the floor burns on for BOUNTY_PYROMANIAC_FLAMER_FLOOR.
+ * it. Everyone it catches in the cone takes BOUNTY_PYROMANIAC_FLAMER_DAMAGE burn and catches fire
+ * (tg's fire stacks); the floor burns on for BOUNTY_PYROMANIAC_FLAMER_FLOOR.
*/
/datum/action/cooldown/mob_cooldown/bounty_boss/flamer
name = "Flamer"
@@ -359,7 +355,7 @@
return aimable(target) && get_dist(owner, target) <= BOUNTY_PYROMANIAC_FLAMER_RANGE && can_see(owner, target, BOUNTY_PYROMANIAC_FLAMER_RANGE) && landing_ok(target)
/datum/action/cooldown/mob_cooldown/bounty_boss/flamer/telegraph(atom/target)
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
cone = list()
// Only where its fire may reach: never off its site or into a ship (M2).
for(var/turf/spot as anything in cone_turfs(target, BOUNTY_PYROMANIAC_FLAMER_RANGE, BOUNTY_PYROMANIAC_FLAMER_ARC))
@@ -376,12 +372,12 @@
return
owner.visible_message(span_danger("[owner] sweeps a jet of fire across the floor!"))
playsound(owner, 'sound/items/weapons/fwoosh.ogg', 80, TRUE)
- new /obj/effect/bounty_boss_fire_pool(get_turf(owner), fire_turfs, BOUNTY_PYROMANIAC_FLAMER_FLOOR, owner, BOUNTY_PYROMANIAC_FLAMER_DAMAGE)
+ new /obj/effect/bounty_boss_fire_pool(get_turf(owner), fire_turfs, BOUNTY_PYROMANIAC_FLAMER_FLOOR, owner, BOUNTY_PYROMANIAC_FLAMER_DAMAGE, BOUNTY_PYROMANIAC_FLAMER_STACKS)
/**
* Molotov: it lights the rag on a bottle and a ring shows where it will land, then it throws. The
* bottle breaks into a 3x3 patch of fire (not through walls) for BOUNTY_PYROMANIAC_MOLOTOV_POOL:
- * BOUNTY_PYROMANIAC_MOLOTOV_DAMAGE burn to anyone it may hurt there, and set alight.
+ * BOUNTY_PYROMANIAC_MOLOTOV_DAMAGE burn to anyone it catches there, and they catch fire.
*/
/datum/action/cooldown/mob_cooldown/bounty_boss/molotov
name = "Molotov"
@@ -411,7 +407,7 @@
/// The 3x3 around `center` that a bottle bursting there reaches: open floor, not through walls, and only where its fire may reach (M2)
/datum/action/cooldown/mob_cooldown/bounty_boss/molotov/proc/splash_turfs(turf/center)
. = list()
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
if(!center || !istype(boss))
return
for(var/turf/spot as anything in RANGE_TURFS(1, center))
@@ -433,7 +429,7 @@
if(QDELETED(owner))
return
playsound(spot, 'sound/effects/glass/glassbr3.ogg', 70, TRUE)
- new /obj/effect/bounty_boss_fire_pool(spot, splash_turfs(spot), BOUNTY_PYROMANIAC_MOLOTOV_POOL, owner, BOUNTY_PYROMANIAC_MOLOTOV_DAMAGE)
+ new /obj/effect/bounty_boss_fire_pool(spot, splash_turfs(spot), BOUNTY_PYROMANIAC_MOLOTOV_POOL, owner, BOUNTY_PYROMANIAC_MOLOTOV_DAMAGE, BOUNTY_PYROMANIAC_MOLOTOV_STACKS)
/// Something thrown, flying from where it starts to `destination`
/obj/effect/temp_visual/bounty_boss_thrown
@@ -454,45 +450,39 @@
// ===== DEMOLITIONIST =====
-/mob/living/basic/bounty_criminal/boss/demolitionist
+/mob/living/carbon/human/npc/bounty_criminal/boss/demolitionist
name = "criminal in a hard hat"
- desc = "A criminal in a hard hat and a hi-vis vest, with a bandolier of grenades across their chest."
- maxHealth = BOUNTY_DEMOLITIONIST_HEALTH_1
- health = BOUNTY_DEMOLITIONIST_HEALTH_1
- speed = BOUNTY_DEMOLITIONIST_SPEED
- damage_coeff = list(BRUTE = BOUNTY_DEMOLITIONIST_BRUTE_MOD, BURN = BOUNTY_DEMOLITIONIST_BURN_MOD, TOX = 1, STAMINA = BOUNTY_BOSS_STAMINA_FRESH * 100 / BOUNTY_BOSS_STAMINA, OXY = 1)
- melee_attack_cooldown = BOUNTY_DEMOLITIONIST_MELEE_COOLDOWN
- attack_vis_effect = ATTACK_EFFECT_SMASH
+ desc = "A criminal in a hard hat and a hi-vis vest, with a bandolier across their chest."
boss_kit = BOUNTY_KIT_DEMOLITIONIST
- boss_weapon = BOUNTY_DEMOLITIONIST_CROWBAR
boss_ability_types = list(
/datum/action/cooldown/mob_cooldown/bounty_boss/grenade,
/datum/action/cooldown/mob_cooldown/bounty_boss/breach,
)
-/mob/living/basic/bounty_criminal/boss/demolitionist/boss_health_table()
- return list(BOUNTY_DEMOLITIONIST_HEALTH_1, BOUNTY_DEMOLITIONIST_HEALTH_2, BOUNTY_DEMOLITIONIST_HEALTH_3, BOUNTY_DEMOLITIONIST_HEALTH_4)
-
-/mob/living/basic/bounty_criminal/boss/demolitionist/boss_kit_outfit()
- return /datum/outfit/bounty_boss/demolitionist
+/mob/living/carbon/human/npc/bounty_criminal/boss/demolitionist/bounty_build_outfit(zone)
+ return boss_supplies(bounty_outfit_instance(/datum/outfit/bounty_boss/demolitionist))
-/mob/living/basic/bounty_criminal/boss/demolitionist/boss_gear_text()
+/mob/living/carbon/human/npc/bounty_criminal/boss/demolitionist/boss_gear_text()
return "A bandolier of grenades is slung across [p_their()] chest."
+// Out where the air kills: a plain grey space suit over its work clothes
+/mob/living/carbon/human/npc/bounty_criminal/boss/demolitionist/bounty_sealed_gear()
+ return list(/obj/item/clothing/suit/space, /obj/item/clothing/head/helmet/space)
+
/**
* It keeps BOUNTY_DEMOLITIONIST_KEEP_MIN to _MAX tiles from its target while it has something it
* could throw from there. It fights hand to hand when someone is right on it, or when nothing is
* ready for this target (out of its sight with no breach possible, or the strict rotation ruling
* out the grenade), rather than standing idle.
*/
-/mob/living/basic/bounty_criminal/boss/demolitionist/boss_engage_plan(datum/ai_controller/controller, atom/target)
+/mob/living/carbon/human/npc/bounty_criminal/boss/demolitionist/boss_engage_plan(datum/ai_controller/controller, atom/target)
if(!isliving(target) && !ismecha(target))
return FALSE
var/distance = get_dist(src, target)
if(distance <= 1 || !boss_has_next_throw(target))
return FALSE
if(distance < BOUNTY_DEMOLITIONIST_KEEP_MIN)
- controller.queue_behavior(/datum/ai_behavior/step_away, BB_BASIC_MOB_CURRENT_TARGET)
+ controller.queue_behavior(/datum/ai_behavior/bounty_boss_back_off, BB_BASIC_MOB_CURRENT_TARGET)
return TRUE
if(distance > BOUNTY_DEMOLITIONIST_KEEP_MAX)
controller.queue_behavior(/datum/ai_behavior/pursue_to_range, BB_BASIC_MOB_CURRENT_TARGET, BOUNTY_DEMOLITIONIST_KEEP_MAX)
@@ -504,7 +494,7 @@
* Whether the rotation leaves it an ability it could use on `target` from its band. Cooldowns are
* ignored on purpose, so it holds its range between grenades instead of stepping in and out.
*/
-/mob/living/basic/bounty_criminal/boss/demolitionist/proc/boss_has_next_throw(atom/target)
+/mob/living/carbon/human/npc/bounty_criminal/boss/demolitionist/proc/boss_has_next_throw(atom/target)
for(var/datum/action/cooldown/mob_cooldown/bounty_boss/ability as anything in boss_abilities)
if(QDELETED(ability) || (boss_strict_rotation && ability.type == boss_last_ability))
continue
@@ -517,6 +507,7 @@
return TRUE
return FALSE
+// Its crowbar rides in its bag until the fight starts; welding goggles keep a flash out of its eyes (tg's flash protection).
/datum/outfit/bounty_boss/demolitionist
name = "Bounty mini-boss: Demolitionist"
uniform = /obj/item/clothing/under/misc/overalls
@@ -526,7 +517,8 @@
glasses = /obj/item/clothing/glasses/welding
gloves = /obj/item/clothing/gloves/color/black
shoes = /obj/item/clothing/shoes/workboots
- r_hand = BOUNTY_DEMOLITIONIST_CROWBAR
+ back = /obj/item/storage/backpack/industrial
+ backpack_contents = list(BOUNTY_DEMOLITIONIST_CROWBAR = 1)
/**
* Grenade: it pulls the pin and a mark shows where it is aiming, then it throws. The grenade lands
@@ -567,7 +559,7 @@
throw_grenade(spot)
if(!prob(BOUNTY_DEMOLITIONIST_SECOND_GRENADE))
return
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
var/list/near = list()
for(var/turf/other as anything in RANGE_TURFS(2, spot))
if(other != spot && !isclosedturf(other) && boss.boss_reach_ok(other) && bounty_boss_clear_line(get_turf(owner), other))
@@ -577,7 +569,7 @@
/// Throws one grenade at `spot`: it flies, lands and starts its fuse
/datum/action/cooldown/mob_cooldown/bounty_boss/grenade/proc/throw_grenade(turf/spot)
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
// The second grenade comes half a second later: not if it was downed, cuffed or stunned meanwhile.
if(!istype(boss) || !boss.boss_can_act() || !spot)
return
@@ -610,7 +602,7 @@
return ..()
/datum/action/cooldown/mob_cooldown/bounty_boss/breach/worth_using(atom/target)
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
if(!aimable(target) || !istype(boss) || boss.boss_walls_left <= 0)
return FALSE
if(get_dist(boss, target) > BOUNTY_DEMOLITIONIST_BREACH_RANGE)
@@ -622,7 +614,7 @@
/// The interior wall or door beside it that leads toward `target`, if it may break one
/datum/action/cooldown/mob_cooldown/bounty_boss/breach/proc/breach_spot(atom/target)
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
var/toward = get_dir(boss, target)
for(var/direction in list(toward, turn(toward, 45), turn(toward, -45)))
var/turf/spot = get_step(boss, direction)
@@ -645,7 +637,7 @@
mark_turfs(list(get_turf(spot)), COLOR_RED)
/datum/action/cooldown/mob_cooldown/bounty_boss/breach/effect(atom/target)
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
var/atom/spot = breach_ref?.resolve()
breach_ref = null
if(!istype(boss) || QDELETED(spot) || !boss.boss_may_break(spot))
@@ -654,11 +646,13 @@
boss.visible_message(span_danger("The charge on [spot] starts beeping!"))
/**
- * A boss's grenade or breaching charge: a fuse with a blinking red ring and beeping, then a
- * scripted blast. No explosion(), no fire: brute against bomb armour and a knockdown to everyone
- * the boss may hurt within `radius` (not through walls), and damage to structures within
- * `object_radius` through the boss's rules (boss_damage_structure()). Capped at
- * BOUNTY_BOSS_EXPLOSIVE_CAP server-wide. With its boss gone, it still goes off but breaks nothing.
+ * A boss's grenade or breaching charge: a fuse with a blinking red ring and beeping, then a blast.
+ * The object is scripted so nothing breaches a hull: no explosion() and no fire, and structures within
+ * `object_radius` take damage only through the boss's rules (boss_damage_structure()). Whoever the blast
+ * catches within `radius` (not through walls), standing or down, takes tg's own light explosion
+ * (ex_act(EXPLODE_LIGHT), CB-10): bomb armour, knockdown, ears, wounds and limbs are all tg's. A mech
+ * with someone in it takes `damage` on its hull. Capped at BOUNTY_BOSS_EXPLOSIVE_CAP server-wide. With
+ * its boss gone, it still goes off but breaks nothing.
*/
/obj/effect/bounty_boss_explosive
name = "grenade"
@@ -669,12 +663,17 @@
layer = ABOVE_OBJ_LAYER
/// The boss who threw it
var/datum/weakref/boss_ref
+ /// Its boss's factions when it was thrown: its blast never catches its own side, even with the boss gone
+ var/list/side_factions
var/fuse = BOUNTY_DEMOLITIONIST_GRENADE_FUSE
- /// Who it catches, and how hard
+ /// Who it catches
var/radius = BOUNTY_DEMOLITIONIST_GRENADE_RADIUS
+ /// What it does to a mech's hull
var/damage = BOUNTY_DEMOLITIONIST_GRENADE_DAMAGE
+ /// Its boss's zone damage factor when it was thrown (1 for a human boss)
var/damage_factor = 1
- var/knockdown = BOUNTY_DEMOLITIONIST_GRENADE_KNOCKDOWN
+ /// Unused by the field kit (people get tg's own knockdown from the explosion); the prison's rigged charge sets it
+ var/knockdown = 0
/// What it breaks, and how hard
var/object_radius = BOUNTY_DEMOLITIONIST_GRENADE_OBJECT_RADIUS
var/object_damage = BOUNTY_DEMOLITIONIST_GRENADE_OBJECT_DAMAGE
@@ -683,12 +682,13 @@
/// Its ring
var/obj/effect/temp_visual/bounty_boss_mark/ring
-/obj/effect/bounty_boss_explosive/Initialize(mapload, mob/living/basic/bounty_criminal/boss/boss)
+/obj/effect/bounty_boss_explosive/Initialize(mapload, mob/living/carbon/human/npc/bounty_criminal/boss/boss)
. = ..()
if(length(GLOB.bounty_boss_explosives) >= BOUNTY_BOSS_EXPLOSIVE_CAP)
return INITIALIZE_HINT_QDEL
GLOB.bounty_boss_explosives += src
boss_ref = boss ? WEAKREF(boss) : null
+ side_factions = boss ? boss.faction.Copy() : null
damage_factor = boss ? boss.get_npc_zone_damage_factor() : 1
structure_tally = list(BOUNTY_BOSS_ABILITY_STRUCTURE_CAP)
ring = new(get_turf(src), fuse, COLOR_RED, "target_circle")
@@ -701,6 +701,7 @@
/obj/effect/bounty_boss_explosive/Destroy()
GLOB.bounty_boss_explosives -= src
boss_ref = null
+ side_factions = null
structure_tally = null
if(!QDELETED(ring))
qdel(ring)
@@ -710,18 +711,18 @@
/obj/effect/bounty_boss_explosive/proc/beep()
playsound(src, 'sound/machines/beep/beep.ogg', 30, TRUE)
-/// Whether the blast may hurt `victim`: its boss's rules, or with the boss gone, awake hunters and their mechs
-/obj/effect/bounty_boss_explosive/proc/may_hit(atom/victim, mob/living/basic/bounty_criminal/boss/boss)
+/// Whether the blast catches `victim`: its boss's rules, or with the boss gone, anyone not on the boss's side. Never by the victim's state (CB-11).
+/obj/effect/bounty_boss_explosive/proc/may_hit(atom/victim, mob/living/carbon/human/npc/bounty_criminal/boss/boss)
if(!QDELETED(boss))
- return boss.boss_can_hurt(victim)
- return bounty_boss_orphan_victim(victim)
+ return boss.boss_effect_hits(victim)
+ return bounty_boss_effect_victim(victim, side_factions)
/obj/effect/bounty_boss_explosive/proc/detonate()
var/turf/here = get_turf(src)
if(!here)
qdel(src)
return
- var/mob/living/basic/bounty_criminal/boss/boss = boss_ref?.resolve()
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = boss_ref?.resolve()
if(QDELETED(boss))
boss = null
blast_structures(boss, here)
@@ -730,19 +731,21 @@
for(var/atom/movable/victim in range(radius, here))
if(!(isliving(victim) || ismecha(victim)) || !may_hit(victim, boss) || !bounty_boss_clear_line(here, get_turf(victim)))
continue
- if(boss)
- boss.boss_hit(victim, npc_zone_damage(damage, damage_factor), BRUTE, BOMB, knockdown, already_scaled = TRUE)
- else if(ismecha(victim))
- victim.take_damage(npc_zone_damage(damage, damage_factor), BRUTE, BOMB, FALSE)
- else
- var/mob/living/person = victim
- person.apply_damage(npc_zone_damage(damage, damage_factor), BRUTE, BODY_ZONE_CHEST, person.run_armor_check(BODY_ZONE_CHEST, BOMB, silent = TRUE))
- if(knockdown)
- person.Knockdown(knockdown)
+ blast(victim)
qdel(src)
+/// Catches `victim` in the blast: a mech on its hull, a person by tg's light explosion
+/obj/effect/bounty_boss_explosive/proc/blast(atom/movable/victim)
+ if(ismecha(victim))
+ var/obj/vehicle/sealed/mecha/mech = victim
+ mech.take_damage(npc_zone_damage(damage, damage_factor), BRUTE, BOMB, FALSE, get_dir(mech, src))
+ return
+ var/mob/living/person = victim
+ EX_ACT(person, EXPLODE_LIGHT)
+ shake_camera(person, 3, 2)
+
/// Structures in reach take the blast, through the boss's rules
-/obj/effect/bounty_boss_explosive/proc/blast_structures(mob/living/basic/bounty_criminal/boss/boss, turf/here)
+/obj/effect/bounty_boss_explosive/proc/blast_structures(mob/living/carbon/human/npc/bounty_criminal/boss/boss, turf/here)
if(!boss || object_damage <= 0)
return
for(var/obj/thing in range(object_radius, here))
@@ -758,13 +761,12 @@
fuse = BOUNTY_DEMOLITIONIST_BREACH_FUSE
radius = 1
damage = BOUNTY_DEMOLITIONIST_BREACH_DAMAGE
- knockdown = 0
object_radius = 0
object_damage = 0
/// The wall or door it is on
var/datum/weakref/breach_ref
-/obj/effect/bounty_boss_explosive/breach/Initialize(mapload, mob/living/basic/bounty_criminal/boss/boss, atom/breach_target)
+/obj/effect/bounty_boss_explosive/breach/Initialize(mapload, mob/living/carbon/human/npc/bounty_criminal/boss/boss, atom/breach_target)
. = ..()
breach_ref = breach_target ? WEAKREF(breach_target) : null
@@ -775,7 +777,7 @@
/obj/effect/bounty_boss_explosive/breach/beep()
playsound(src, 'sound/machines/beep/beep.ogg', 60, TRUE)
-/obj/effect/bounty_boss_explosive/breach/blast_structures(mob/living/basic/bounty_criminal/boss/boss, turf/here)
+/obj/effect/bounty_boss_explosive/breach/blast_structures(mob/living/carbon/human/npc/bounty_criminal/boss/boss, turf/here)
var/atom/target = breach_ref?.resolve()
if(!boss || QDELETED(target))
return
@@ -783,46 +785,43 @@
// ===== GHOST =====
-/mob/living/basic/bounty_criminal/boss/ghost
+/mob/living/carbon/human/npc/bounty_criminal/boss/ghost
name = "hooded criminal"
- desc = "A lean criminal in a dark hooded cloak, holding a long knife low."
- maxHealth = BOUNTY_GHOST_HEALTH_1
- health = BOUNTY_GHOST_HEALTH_1
- speed = BOUNTY_GHOST_SPEED
- damage_coeff = list(BRUTE = BOUNTY_GHOST_BRUTE_MOD, BURN = BOUNTY_GHOST_BURN_MOD, TOX = 1, STAMINA = BOUNTY_BOSS_STAMINA_FRESH * 100 / BOUNTY_BOSS_STAMINA, OXY = 1)
- melee_attack_cooldown = BOUNTY_GHOST_MELEE_COOLDOWN
- attack_vis_effect = ATTACK_EFFECT_SLASH
+ desc = "A lean criminal in a dark hooded cloak, a knife at the ready."
boss_kit = BOUNTY_KIT_GHOST
- boss_weapon = BOUNTY_GHOST_KNIFE
+ // Its quickness is real chrome (the OC-6 ruling): a Slipwire shunt and a Cascade lattice. An EMP or a
+ // brownout takes it away as it would from a player, and it burns out when the Ghost dies.
+ npc_cyberware = list(
+ /obj/item/organ/cyberimp/cyberware/slipwire,
+ /obj/item/organ/cyberimp/cyberware/cascade,
+ )
boss_ability_types = list(
/datum/action/cooldown/mob_cooldown/bounty_boss/dash,
/datum/action/cooldown/mob_cooldown/bounty_boss/cloak,
)
- /// Cloaked: faint, and hard to hit, until a flash, a hit or the time runs out
+ /// Shimmering: only a look (alpha and blur), until a flash, a hit or the time runs out
var/boss_cloaked = FALSE
var/boss_cloak_timer
- /// world.time of its last step, for dodging while moving
- var/boss_last_moved = 0
/// Cuts since it last broke off, and when it may close in again
var/boss_cuts = 0
var/boss_breakoff_until = 0
- /// Its dodge and miss messages show at most every BOUNTY_BOSS_MESSAGE_COOLDOWN (L5)
- COOLDOWN_DECLARE(boss_message_cooldown)
-/mob/living/basic/bounty_criminal/boss/ghost/Destroy()
+/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/Destroy()
deltimer(boss_cloak_timer)
boss_cloak_timer = null
return ..()
-/mob/living/basic/bounty_criminal/boss/ghost/boss_health_table()
- return list(BOUNTY_GHOST_HEALTH_1, BOUNTY_GHOST_HEALTH_2, BOUNTY_GHOST_HEALTH_3, BOUNTY_GHOST_HEALTH_4)
+/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/bounty_build_outfit(zone)
+ return boss_supplies(bounty_outfit_instance(/datum/outfit/bounty_boss/ghost))
-/mob/living/basic/bounty_criminal/boss/ghost/boss_kit_outfit()
- return /datum/outfit/bounty_boss/ghost
-
-/mob/living/basic/bounty_criminal/boss/ghost/boss_gear_text()
+/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/boss_gear_text()
return "[p_They()] move[p_s()] quick and light, and the knife is never still."
+// Out where the air kills: a dark red voidsuit, no more armour than its hood
+/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/bounty_sealed_gear()
+ return list(/obj/item/clothing/suit/space/nasavoid, /obj/item/clothing/head/helmet/space/nasavoid)
+
+// The hood goes up as the outfit is put on (tg's hooded suits do that). The knife rides in a pocket until the fight starts.
/datum/outfit/bounty_boss/ghost
name = "Bounty mini-boss: Ghost"
uniform = /obj/item/clothing/under/color/black
@@ -830,81 +829,66 @@
mask = /obj/item/clothing/mask/bandana/black
gloves = /obj/item/clothing/gloves/color/black
shoes = /obj/item/clothing/shoes/sneakers/black
- r_hand = BOUNTY_GHOST_KNIFE
+ l_pocket = BOUNTY_GHOST_KNIFE
-/// Its cuts bleed, and after a couple of them it breaks off for a while
-/mob/living/basic/bounty_criminal/boss/ghost/melee_attack(atom/target, list/modifiers, ignore_cooldown = FALSE)
- . = ..()
- if(!. || !isliving(target))
- return
- boss_cut(target)
+/// The knife it holds, if it has one in hand
+/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/proc/boss_knife()
+ for(var/obj/item/knife/blade in held_items)
+ return blade
+ return null
+
+/**
+ * Stabs `victim` with the knife it holds, as a player would: the knife in its active hand, a body
+ * zone picked, and a click through controller.ai_interact(). Damage, armour, wounds and bleeding are
+ * the knife's and tg's (CB-9). Returns TRUE if it swung.
+ */
+/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/proc/boss_knife_attack(atom/victim)
+ var/obj/item/knife/blade = boss_knife()
+ if(isnull(blade) || isnull(ai_controller) || next_move > world.time || !human_npc_ready_item(src, blade))
+ return FALSE
+ victim.visible_message(span_danger("[src] darts in and slashes [victim]!"), span_userdanger("[src] darts in and slashes you!"))
+ playsound(victim, 'sound/items/weapons/bladeslice.ogg', 70, TRUE)
+ zone_selected = human_npc_pick_aim_zone()
+ return ai_controller.ai_interact(target = victim, combat_mode = TRUE)
-/// A cut on `victim`: it bleeds, and the hit-and-run count goes up
-/mob/living/basic/bounty_criminal/boss/ghost/proc/boss_cut(mob/living/victim)
- if(QDELETED(victim) || victim.stat == DEAD)
+// Every knife blow it lands counts toward its hit and run: after a couple, it breaks off for a while.
+/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/boss_landed_blow(mob/living/victim, obj/item/weapon)
+ if(!istype(weapon, /obj/item/knife))
return
- victim.apply_status_effect(/datum/status_effect/bounty_boss_bleed, get_npc_zone_damage_factor())
boss_cuts++
if(boss_cuts >= BOUNTY_GHOST_CUTS_BEFORE_BREAKOFF)
boss_cuts = 0
boss_breakoff_until = world.time + BOUNTY_GHOST_BREAKOFF_TIME
/// Breaking off: it backs away from its target for a while
-/mob/living/basic/bounty_criminal/boss/ghost/boss_engage_plan(datum/ai_controller/controller, atom/target)
+/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/boss_engage_plan(datum/ai_controller/controller, atom/target)
if(world.time >= boss_breakoff_until || !(isliving(target) || ismecha(target)) || get_dist(src, target) > 4)
return FALSE
- controller.queue_behavior(/datum/ai_behavior/step_away, BB_BASIC_MOB_CURRENT_TARGET)
+ controller.queue_behavior(/datum/ai_behavior/bounty_boss_back_off, BB_BASIC_MOB_CURRENT_TARGET)
return TRUE
-/mob/living/basic/bounty_criminal/boss/ghost/boss_moved()
- boss_last_moved = world.time
-
-/// Whether it is on the move, for dodging
-/mob/living/basic/bounty_criminal/boss/ghost/proc/boss_moving()
- return world.time <= boss_last_moved + BOUNTY_GHOST_MOVING_WINDOW && boss_can_act()
-
-/// It dodges some shots while moving, and cloaked, half of them miss
-/mob/living/basic/bounty_criminal/boss/ghost/boss_projectile_prehit(obj/projectile/shot)
- if(shot.firer == src || stat != CONSCIOUS)
- return NONE
- var/hit_chance = 100
- if(boss_moving())
- hit_chance *= (100 - BOUNTY_GHOST_DODGE) / 100
- if(boss_cloaked)
- hit_chance *= (100 - BOUNTY_GHOST_CLOAK_MISS) / 100
- if(prob(hit_chance))
- return NONE
- boss_miss_message(span_warning("[src] slips aside from [shot]!"))
- return PROJECTILE_INTERRUPT_HIT_PHASE
-
-/// A dodge or miss message, at most every BOUNTY_BOSS_MESSAGE_COOLDOWN so automatic fire doesn't flood chat (L5)
-/mob/living/basic/bounty_criminal/boss/ghost/proc/boss_miss_message(message)
- if(!COOLDOWN_FINISHED(src, boss_message_cooldown))
- return
- COOLDOWN_START(src, boss_message_cooldown, BOUNTY_BOSS_MESSAGE_COOLDOWN)
- visible_message(message)
-
-/// Cloaked, half the blows find nothing
-/mob/living/basic/bounty_criminal/boss/ghost/boss_check_block(atom/hit_by, attack_text, attack_type)
- if(!boss_cloaked || stat != CONSCIOUS || !prob(BOUNTY_GHOST_CLOAK_MISS))
- return NONE
- boss_miss_message(span_warning("[attack_text] swings through the shimmer where [src] was!"))
- return SUCCESSFUL_BLOCK
+/// Fires its Cascade lattice (the chrome's own action), if it is ready. Returns TRUE if it fired.
+/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/proc/boss_surge()
+ for(var/obj/item/organ/cyberimp/cyberware/cascade/lattice in organs)
+ for(var/datum/action/cooldown/cyberware/cascade_surge/surge in lattice.actions)
+ if(surge.IsAvailable())
+ return surge.Trigger()
+ return FALSE
-/mob/living/basic/bounty_criminal/boss/ghost/boss_took_damage(damage, damagetype)
+/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/boss_took_damage(damage, damagetype)
if(boss_cloaked)
boss_uncloak("A hit breaks the shimmer around [src].")
-/mob/living/basic/bounty_criminal/boss/ghost/boss_flashed(mob/living/user)
+/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/boss_flashed(mob/living/user)
if(boss_cloaked)
boss_uncloak("The flash burns away the shimmer around [src]!")
-/mob/living/basic/bounty_criminal/boss/ghost/boss_on_interrupted()
+/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/boss_on_interrupted()
if(boss_cloaked)
boss_uncloak()
-/// Fades to a faint shimmer for BOUNTY_GHOST_CLOAK_TIME
-/mob/living/basic/bounty_criminal/boss/ghost/proc/boss_cloak()
+/// Fades to a faint shimmer for BOUNTY_GHOST_CLOAK_TIME: a look only, nothing misses it for it (CB-12)
+/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/proc/boss_cloak()
if(stat != CONSCIOUS)
return FALSE
boss_cloaked = TRUE
@@ -914,8 +898,8 @@
boss_cloak_timer = addtimer(CALLBACK(src, PROC_REF(boss_uncloak), "The shimmer around [src] fades."), BOUNTY_GHOST_CLOAK_TIME, TIMER_STOPPABLE | TIMER_DELETE_ME)
return TRUE
-/// Plain to see again, with `message` if something broke the cloak
-/mob/living/basic/bounty_criminal/boss/ghost/proc/boss_uncloak(message)
+/// Plain to see again, with `message` if something broke the shimmer
+/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/proc/boss_uncloak(message)
if(!boss_cloaked)
return FALSE
boss_cloaked = FALSE
@@ -928,8 +912,8 @@
return TRUE
/**
- * Dash: it crouches and a blurred line shows on the floor to its target, then it darts down it,
- * leaving after-images, and cuts at the end: BOUNTY_GHOST_DASH_DAMAGE and a bleed.
+ * Dash: it crouches and a blurred line shows on the floor to its target, then it darts down it with
+ * its Cascade lattice firing, leaving after-images, and stabs at the end with the knife it holds.
*/
/datum/action/cooldown/mob_cooldown/bounty_boss/dash
name = "Dash"
@@ -949,7 +933,8 @@
return ..()
/datum/action/cooldown/mob_cooldown/bounty_boss/dash/worth_using(atom/target)
- if(!aimable(target))
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/boss = owner
+ if(!aimable(target) || !istype(boss) || isnull(boss.boss_knife()))
return FALSE
var/distance = get_dist(owner, target)
return distance >= 2 && distance <= BOUNTY_GHOST_DASH_RANGE + 1 && bounty_boss_clear_line(get_turf(owner), get_turf(target))
@@ -970,11 +955,13 @@
mark_turfs(path, "#9a9ab8")
/datum/action/cooldown/mob_cooldown/bounty_boss/dash/effect(atom/target)
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/boss = owner
if(!istype(boss))
return
dash_target = aimable(target) ? WEAKREF(target) : null
step_index = 0
+ // The lattice fires as it goes (the OC-6 ruling): real chrome, with its own crash after.
+ boss.boss_surge()
if(!length(path))
cut_at_end(target)
return
@@ -983,7 +970,7 @@
dash_step(serial)
/datum/action/cooldown/mob_cooldown/bounty_boss/dash/proc/dash_step(serial)
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
if(!istype(boss) || !boss.boss_still("dash", serial))
end_dash(serial, FALSE)
return
@@ -1003,7 +990,7 @@
addtimer(CALLBACK(src, PROC_REF(dash_step), serial), 1, TIMER_DELETE_ME)
/datum/action/cooldown/mob_cooldown/bounty_boss/dash/proc/end_dash(serial, cut)
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
path = null
var/atom/victim = dash_target?.resolve()
dash_target = null
@@ -1012,30 +999,25 @@
if(cut)
cut_at_end(victim)
-/// The cut at the end of the dash, if its target (a hunter, or a mech) is within reach
+/**
+ * The cut at the end of the dash: a real knife attack on whoever it dashed at, if they are within
+ * reach, standing or not (CB-11). Returns TRUE if it swung.
+ */
/datum/action/cooldown/mob_cooldown/bounty_boss/dash/proc/cut_at_end(atom/victim)
- var/mob/living/basic/bounty_criminal/boss/ghost/boss = owner
- if(!istype(boss) || !boss.boss_can_act() || !aimable(victim) || !boss.Adjacent(victim) || !boss.boss_can_hurt(victim))
- return
- boss.do_attack_animation(victim, ATTACK_EFFECT_SLASH)
- playsound(victim, 'sound/items/weapons/bladeslice.ogg', 70, TRUE)
- victim.visible_message(span_danger("[boss] darts in and slashes [victim]!"), span_userdanger("[boss] darts in and slashes you!"))
- if(ismecha(victim))
- boss.boss_hit(victim, BOUNTY_GHOST_DASH_DAMAGE, BRUTE, MELEE, 0, BOUNTY_GHOST_DASH_AP)
- return
- var/mob/living/person = victim
- person.apply_damage(npc_zone_damage(BOUNTY_GHOST_DASH_DAMAGE, boss), BRUTE, BODY_ZONE_CHEST, person.run_armor_check(BODY_ZONE_CHEST, MELEE, armour_penetration = BOUNTY_GHOST_DASH_AP, silent = TRUE), sharpness = SHARP_EDGED)
- boss.boss_cut(person)
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/boss = owner
+ if(!istype(boss) || !boss.boss_can_act() || !aimable(victim) || !boss.Adjacent(victim) || !boss.boss_effect_hits(victim))
+ return FALSE
+ return boss.boss_knife_attack(victim)
-/// Cloak: the air around it shimmers, then it fades to a faint distortion that half of all hits miss
+/// Cloak: the air around it shimmers, then it fades to a faint distortion. A look only (CB-12).
/datum/action/cooldown/mob_cooldown/bounty_boss/cloak
name = "Cloak"
- desc = "Fade into a shimmer that is hard to hit."
+ desc = "Fade into a shimmer."
cooldown_time = BOUNTY_GHOST_CLOAK_COOLDOWN
windup = BOUNTY_GHOST_CLOAK_WINDUP
/datum/action/cooldown/mob_cooldown/bounty_boss/cloak/worth_using(atom/target)
- var/mob/living/basic/bounty_criminal/boss/ghost/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/boss = owner
return aimable(target) && istype(boss) && !boss.boss_cloaked
/datum/action/cooldown/mob_cooldown/bounty_boss/cloak/telegraph(atom/target)
@@ -1045,75 +1027,33 @@
animate(alpha = 255, time = windup / 2)
/datum/action/cooldown/mob_cooldown/bounty_boss/cloak/effect(atom/target)
- var/mob/living/basic/bounty_criminal/boss/ghost/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/boss = owner
if(istype(boss) && boss.boss_cloak())
boss.visible_message(span_warning("[boss] fades into a faint shimmer!"))
-/**
- * The Ghost's cuts: BOUNTY_GHOST_BLEED_PER_CUT brute a second for each cut, up to
- * BOUNTY_GHOST_BLEED_CAP, for BOUNTY_GHOST_BLEED_TIME after the last one, with the blood to show it.
- * It stops once they are down (C4, M3).
- */
-/datum/status_effect/bounty_boss_bleed
- id = "bounty_boss_bleed"
- duration = BOUNTY_GHOST_BLEED_TIME
- tick_interval = 1 SECONDS
- status_type = STATUS_EFFECT_REFRESH
- alert_type = null
- /// Cuts bleeding
- var/cuts = 1
- var/damage_factor = 1
-
-/datum/status_effect/bounty_boss_bleed/on_creation(mob/living/new_owner, factor = 1)
- damage_factor = factor
- return ..()
-
-/datum/status_effect/bounty_boss_bleed/on_apply()
- return owner.stat == CONSCIOUS
-
-/datum/status_effect/bounty_boss_bleed/refresh(mob/living/new_owner, factor = 1)
- damage_factor = factor
- . = ..()
- cuts++
-
-/datum/status_effect/bounty_boss_bleed/tick(seconds_between_ticks)
- if(owner.stat != CONSCIOUS)
- qdel(src)
- return
- var/rate = min(cuts * BOUNTY_GHOST_BLEED_PER_CUT, BOUNTY_GHOST_BLEED_CAP)
- owner.apply_damage(npc_zone_damage(rate, damage_factor), BRUTE, spread_damage = TRUE)
- owner.bleed(rate)
-
// ===== HEAVY =====
-/mob/living/basic/bounty_criminal/boss/heavy
+/mob/living/carbon/human/npc/bounty_criminal/boss/heavy
name = "heavily armed criminal"
desc = "A big criminal in heavy armour, carrying a belt-fed gun."
- maxHealth = BOUNTY_HEAVY_HEALTH_1
- health = BOUNTY_HEAVY_HEALTH_1
- mob_size = MOB_SIZE_LARGE
- speed = BOUNTY_HEAVY_SPEED
- damage_coeff = list(BRUTE = BOUNTY_HEAVY_BRUTE_MOD, BURN = BOUNTY_HEAVY_BURN_MOD, TOX = 1, STAMINA = BOUNTY_HEAVY_STAMINA_FRESH * 100 / BOUNTY_HEAVY_STAMINA, OXY = 1)
- melee_attack_cooldown = BOUNTY_HEAVY_MELEE_COOLDOWN
- attack_vis_effect = ATTACK_EFFECT_SMASH
boss_kit = BOUNTY_KIT_HEAVY
- boss_weapon = BOUNTY_HEAVY_GUN
- boss_stamina_pool = BOUNTY_HEAVY_STAMINA
- boss_stamina_fresh = BOUNTY_HEAVY_STAMINA_FRESH
boss_ability_types = list(
/datum/action/cooldown/mob_cooldown/bounty_boss/burst,
/datum/action/cooldown/mob_cooldown/bounty_boss/barricade,
)
-/mob/living/basic/bounty_criminal/boss/heavy/boss_health_table()
- return list(BOUNTY_HEAVY_HEALTH_1, BOUNTY_HEAVY_HEALTH_2, BOUNTY_HEAVY_HEALTH_3, BOUNTY_HEAVY_HEALTH_4)
-
-/mob/living/basic/bounty_criminal/boss/heavy/boss_kit_outfit()
- return /datum/outfit/bounty_boss/heavy
+/mob/living/carbon/human/npc/bounty_criminal/boss/heavy/bounty_build_outfit(zone)
+ return boss_supplies(bounty_outfit_instance(/datum/outfit/bounty_boss/heavy))
-/mob/living/basic/bounty_criminal/boss/heavy/boss_gear_text()
+/mob/living/carbon/human/npc/bounty_criminal/boss/heavy/boss_gear_text()
return "[p_They()] [p_are()] in heavy armour."
+// Out where the air kills: a black space suit as heavy as its SWAT armour, under its own SWAT helmet, which already holds pressure
+/mob/living/carbon/human/npc/bounty_criminal/boss/heavy/bounty_sealed_gear()
+ return list(/obj/item/clothing/suit/space/syndicate/black, null)
+
+// The L6 has no sling and won't holster, so it is in hand from the start, its other hand free to fire it.
+// A spare box rides in the bag; a barrier grenade in each pocket.
/datum/outfit/bounty_boss/heavy
name = "Bounty mini-boss: Heavy"
uniform = /obj/item/clothing/under/syndicate/combat
@@ -1122,14 +1062,128 @@
gloves = /obj/item/clothing/gloves/combat
shoes = /obj/item/clothing/shoes/jackboots
r_hand = BOUNTY_HEAVY_GUN
+ l_pocket = /obj/item/grenade/barrier/bounty_boss
+ r_pocket = /obj/item/grenade/barrier/bounty_boss
+ back = /obj/item/storage/backpack
+ backpack_contents = list(BOUNTY_HEAVY_SPARE_AMMO = 1)
+
+/// The belt-fed gun it holds, if it holds one
+/mob/living/carbon/human/npc/bounty_criminal/boss/heavy/proc/boss_gun()
+ for(var/obj/item/gun/ballistic/automatic/l6_saw/gun in held_items)
+ return gun
+ return null
+
+/**
+ * Whether `gun` is the only thing in its hands. tg fires a heavy gun only with the other hand empty,
+ * whichever hand is active now: the gun may sit in either, and is made the active one to fire.
+ */
+/mob/living/carbon/human/npc/bounty_criminal/boss/heavy/proc/boss_hands_free_for(obj/item/gun/gun)
+ for(var/obj/item/held in held_items)
+ if(held != gun)
+ return FALSE
+ return !isnull(gun) && is_holding(gun)
+
+/// A barrier grenade it carries, not yet thrown
+/mob/living/carbon/human/npc/bounty_criminal/boss/heavy/proc/boss_barrier()
+ for(var/obj/item/grenade/barrier/bounty_boss/barrier in get_all_contents_type(/obj/item/grenade/barrier/bounty_boss))
+ if(!barrier.active && (is_holding(barrier) || human_npc_can_draw(src, barrier)))
+ return barrier
+ return null
+
+// Its gun's belt runs out: it changes it the way a player does (bounty_heavy_reload), if it has a spare.
+/mob/living/carbon/human/npc/bounty_criminal/boss/heavy/boss_gear_plan(datum/ai_controller/controller)
+ if(world.time < controller.blackboard[BB_HUMAN_NPC_ARMING_RETRY_AT] || HAS_TRAIT(src, TRAIT_HANDS_BLOCKED))
+ return FALSE
+ var/obj/item/gun/ballistic/automatic/l6_saw/gun = boss_gun()
+ if(isnull(gun) || (gun.can_shoot() && !gun.cover_open))
+ return FALSE
+ if(!gun.cover_open && isnull(human_npc_find_ammo(src, gun)))
+ return FALSE
+ controller.queue_behavior(/datum/ai_behavior/bounty_heavy_reload)
+ return TRUE
+
+// A hit while it aims spoils the burst (CB-13).
+/mob/living/carbon/human/npc/bounty_criminal/boss/heavy/boss_took_damage(damage, damagetype)
+ var/datum/action/cooldown/mob_cooldown/bounty_boss/burst/aiming = boss_winding()
+ if(!istype(aiming) || damage < BOUNTY_HEAVY_FUMBLE_DAMAGE)
+ return
+ visible_message(span_warning("[src] fumbles the shot."))
+ boss_interrupt()
+
+/**
+ * Changes the belt in its L6 the way a player does, one step per action: open the feed cover, pull
+ * the empty box with its free hand and let it fall, take the spare from its bag, click the gun with it,
+ * close the cover. tg's own sounds and procs throughout. Gives up after a while and fights on.
+ */
+/datum/ai_behavior/bounty_heavy_reload
+ action_cooldown = 0.8 SECONDS
+
+/datum/ai_behavior/bounty_heavy_reload/setup(datum/ai_controller/controller)
+ . = ..()
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/heavy/heavy = controller.pawn
+ var/obj/item/gun/ballistic/automatic/l6_saw/gun = istype(heavy) ? heavy.boss_gun() : null
+ if(isnull(gun))
+ return FALSE
+ controller.set_blackboard_key(BB_BOUNTY_BOSS_RELOAD_UNTIL, world.time + 12 SECONDS)
+ if(!gun.cover_open)
+ heavy.visible_message(span_notice("[heavy] flips open the feed cover on [gun]."))
+
+/datum/ai_behavior/bounty_heavy_reload/perform(seconds_per_tick, datum/ai_controller/controller)
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/heavy/heavy = controller.pawn
+ var/obj/item/gun/ballistic/automatic/l6_saw/gun = istype(heavy) ? heavy.boss_gun() : null
+ if(isnull(gun) || world.time >= controller.blackboard[BB_BOUNTY_BOSS_RELOAD_UNTIL] || HAS_TRAIT(heavy, TRAIT_HANDS_BLOCKED))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ if(heavy.next_move > world.time)
+ return AI_BEHAVIOR_DELAY
+ var/obj/item/spent = human_npc_spent_ammo_in_hand(heavy, gun)
+ if(spent)
+ heavy.dropItemToGround(spent, force = TRUE)
+ return AI_BEHAVIOR_DELAY
+ if(gun.magazine && gun.can_shoot())
+ if(gun.cover_open)
+ gun.click_alt(heavy)
+ return AI_BEHAVIOR_DELAY
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
+ if(!gun.cover_open)
+ gun.click_alt(heavy)
+ return AI_BEHAVIOR_DELAY
+ if(gun.magazine)
+ // The empty box comes out into its free hand.
+ if(!human_npc_ready_empty_hand(heavy))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ controller.ai_interact(target = gun, combat_mode = FALSE)
+ return AI_BEHAVIOR_DELAY
+ var/obj/item/ammo = human_npc_find_ammo(heavy, gun)
+ if(isnull(ammo))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ if(!heavy.is_holding(ammo))
+ if(!human_npc_take_in_hand(heavy, ammo))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ return AI_BEHAVIOR_DELAY
+ if(!human_npc_ready_item(heavy, ammo))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ controller.ai_interact(target = gun, combat_mode = FALSE)
+ return AI_BEHAVIOR_DELAY
+
+/datum/ai_behavior/bounty_heavy_reload/finish_action(datum/ai_controller/controller, succeeded)
+ . = ..()
+ controller.clear_blackboard_key(BB_BOUNTY_BOSS_RELOAD_UNTIL)
+ if(succeeded)
+ return
+ // A change that got nowhere: the cover goes back down and it fights on with what it has for a while.
+ controller.set_blackboard_key(BB_HUMAN_NPC_ARMING_RETRY_AT, world.time + 10 SECONDS)
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/heavy/heavy = controller.pawn
+ var/obj/item/gun/ballistic/automatic/l6_saw/gun = istype(heavy) ? heavy.boss_gun() : null
+ if(gun?.cover_open)
+ gun.click_alt(heavy)
/**
* Suppressive burst: the gun spins up with a whirr, a red laser sight settles on the target's tile
- * and a red cone shows on the floor, staying there until the last round (L3). Then
- * BOUNTY_HEAVY_BURST_SHOTS rounds go into that cone over BOUNTY_HEAVY_BURST_TIME, where it aimed, not
- * where the target went, and no further than the cone is marked. The rounds damage only windows,
- * grilles, tables and barricades the boss may break (interior, on its site), at
- * BOUNTY_HEAVY_BURST_DEMOLITION of their damage (M5).
+ * and a red cone shows on the floor, staying there until the last round (L3). Then it pulls the
+ * trigger of the real gun it holds BOUNTY_HEAVY_BURST_SHOTS times over BOUNTY_HEAVY_BURST_TIME, at the
+ * far edge of the cone where it aimed, not where the target went (CB-13). Real rounds from its real
+ * belt: when the belt runs dry the burst stops and it changes belts. It holds its fire for a round
+ * with one of its own side in the way. A hit while it aims spoils the burst (boss_took_damage()).
*/
/datum/action/cooldown/mob_cooldown/bounty_boss/burst
name = "Suppressive Burst"
@@ -1148,7 +1202,12 @@
return ..()
/datum/action/cooldown/mob_cooldown/bounty_boss/burst/worth_using(atom/target)
- if(!aimable(target))
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/heavy/boss = owner
+ if(!aimable(target) || !istype(boss))
+ return FALSE
+ var/obj/item/gun/gun = boss.boss_gun()
+ // Its gun loaded, its other hand free to fire it.
+ if(isnull(gun) || !gun.can_shoot() || !boss.boss_hands_free_for(gun))
return FALSE
var/distance = get_dist(owner, target)
return distance >= 2 && distance <= BOUNTY_HEAVY_BURST_RANGE && can_see(owner, target, BOUNTY_HEAVY_BURST_RANGE) && landing_ok(target)
@@ -1166,7 +1225,7 @@
mark_turfs(cone_turfs(target, BOUNTY_HEAVY_BURST_RANGE, BOUNTY_HEAVY_BURST_ARC + BOUNTY_HEAVY_BURST_MARK_MARGIN), "#ff2020", linger = BOUNTY_HEAVY_BURST_TIME)
/datum/action/cooldown/mob_cooldown/bounty_boss/burst/effect(atom/target)
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
if(!istype(boss) || !aim_turf)
return
shots_left = BOUNTY_HEAVY_BURST_SHOTS
@@ -1174,65 +1233,54 @@
var/serial = boss.boss_set_busy("burst", effect_time + 1 SECONDS)
fire_round(serial)
-/// One round of the burst, and the next after it
+/// Where one round goes: a tile at the cone's far edge, somewhere within its arc
+/datum/action/cooldown/mob_cooldown/bounty_boss/burst/proc/round_spot()
+ var/turf/origin = get_turf(owner)
+ if(!origin)
+ return null
+ var/angle = aim_angle + rand(-BOUNTY_HEAVY_BURST_ARC / 2, BOUNTY_HEAVY_BURST_ARC / 2)
+ return locate(
+ clamp(origin.x + round(BOUNTY_HEAVY_BURST_RANGE * sin(angle)), 1, world.maxx),
+ clamp(origin.y + round(BOUNTY_HEAVY_BURST_RANGE * cos(angle)), 1, world.maxy),
+ origin.z,
+ )
+
+/// One pull of the trigger, and the next after it
/datum/action/cooldown/mob_cooldown/bounty_boss/burst/proc/fire_round(serial)
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/heavy/boss = owner
if(!istype(boss) || !boss.boss_still("burst", serial) || shots_left <= 0 || !aim_turf)
end_burst(serial)
return
+ var/obj/item/gun/gun = boss.boss_gun()
+ if(isnull(gun) || !gun.can_shoot())
+ // Out of belt: it changes it on its next plan.
+ end_burst(serial)
+ return
shots_left--
- var/turf/origin = get_turf(boss)
- var/obj/projectile/bullet/bounty_boss_heavy/bullet = new(origin)
- // Its gun's own rounds, no further than the marked cone
- bounty_real_weapon(BOUNTY_HEAVY_GUN).load(bullet)
- bullet.range = BOUNTY_HEAVY_BURST_RANGE
- bullet.maximum_range = BOUNTY_HEAVY_BURST_RANGE
- bullet.firer = boss
- bullet.fired_from = boss
- bullet.ignored_factions = boss.faction.Copy()
- bullet.aim_projectile(aim_turf, boss)
- if(!QDELETED(bullet))
- bullet.fire(aim_angle + rand(-BOUNTY_HEAVY_BURST_ARC / 2, BOUNTY_HEAVY_BURST_ARC / 2))
- playsound(boss, 'sound/items/weapons/gun/l6/shot.ogg', 60, TRUE)
+ var/turf/spot = round_spot()
+ if(spot && !human_npc_ally_in_line(boss, spot) && boss.boss_hands_free_for(gun) && human_npc_ready_item(boss, gun))
+ boss.ai_controller?.ai_interact(target = spot, combat_mode = TRUE)
if(shots_left <= 0)
end_burst(serial)
return
- addtimer(CALLBACK(src, PROC_REF(fire_round), serial), max(1, round(BOUNTY_HEAVY_BURST_TIME / BOUNTY_HEAVY_BURST_SHOTS)), TIMER_DELETE_ME)
+ addtimer(CALLBACK(src, PROC_REF(fire_round), serial), max(2, round(BOUNTY_HEAVY_BURST_TIME / BOUNTY_HEAVY_BURST_SHOTS)), TIMER_DELETE_ME)
/datum/action/cooldown/mob_cooldown/bounty_boss/burst/proc/end_burst(serial)
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
shots_left = 0
aim_turf = null
if(istype(boss) && boss.boss_busy == "burst" && boss.boss_busy_serial == serial)
boss.boss_clear_busy(serial)
/**
- * The Heavy's rounds: its belt-fed gun's own (BOUNTY_HEAVY_GUN, loaded as they are fired), no
- * further than the marked cone, and hard on structures only where the boss may break them
- */
-/obj/projectile/bullet/bounty_boss_heavy
- name = "heavy round"
- range = BOUNTY_HEAVY_BURST_RANGE
- demolition_mod = 0
-
-// Judged at what it hits, not where it was fired from (M5): never a window onto space, never off the site.
-// A mech is a target, not a structure: it takes the round in full.
-/obj/projectile/bullet/bounty_boss_heavy/get_demolition_modifier(obj/target)
- if(ismecha(target))
- return 1
- var/mob/living/basic/bounty_criminal/boss/boss = firer
- if(!istype(boss) || QDELETED(boss) || !istype(target) || istype(target, /obj/machinery/door))
- return 0
- return boss.boss_may_break(target) ? BOUNTY_HEAVY_BURST_DEMOLITION : 0
-
-/**
- * Barricade: it unslings a folding barrier and drops it on the tile in front of it, toward its
- * target: tg's security barrier (/obj/structure/barricade/security/bounty_boss). It keeps
- * BOUNTY_BOSS_BARRICADES_PER_BOSS standing; each folds away after BOUNTY_BOSS_BARRICADE_LIFE.
+ * Barricade: it unslings a folded barrier, arms a real barrier grenade it carries and tosses it onto
+ * the tile in front of it, toward its target (CB-26). The grenade opens into the Heavy's folding barrier
+ * (/obj/structure/barricade/security/bounty_boss). It keeps BOUNTY_BOSS_BARRICADES_PER_BOSS standing;
+ * each folds away after BOUNTY_BOSS_BARRICADE_LIFE. Two grenades, two barriers: then it has none left.
*/
/datum/action/cooldown/mob_cooldown/bounty_boss/barricade
name = "Deploy Barricade"
- desc = "Drop a folding barrier in front of you."
+ desc = "Toss a barrier grenade in front of you."
cooldown_time = BOUNTY_HEAVY_BARRICADE_COOLDOWN
windup = BOUNTY_HEAVY_BARRICADE_WINDUP
/// Where it will stand, from the telegraph
@@ -1246,14 +1294,17 @@
return ..()
/datum/action/cooldown/mob_cooldown/bounty_boss/barricade/worth_using(atom/target)
- if(!aimable(target) || length(GLOB.bounty_boss_barricades) >= BOUNTY_BOSS_BARRICADE_CAP)
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/heavy/boss = owner
+ if(!aimable(target) || !istype(boss) || length(GLOB.bounty_boss_barricades) >= BOUNTY_BOSS_BARRICADE_CAP)
+ return FALSE
+ if(isnull(boss.boss_barrier()) || !length(boss.get_empty_held_indexes()))
return FALSE
var/distance = get_dist(owner, target)
return distance >= 3 && distance <= 9 && !isnull(find_spot(target))
/// The open tile in front of it toward `target`, on its site, with no barrier on it
/datum/action/cooldown/mob_cooldown/bounty_boss/barricade/proc/find_spot(atom/target)
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner
if(!istype(boss))
return null
var/turf/spot = get_step(boss, get_dir(boss, target))
@@ -1273,16 +1324,26 @@
/datum/action/cooldown/mob_cooldown/bounty_boss/barricade/effect(atom/target)
var/turf/spot = barricade_spot
barricade_spot = null
- var/mob/living/basic/bounty_criminal/boss/boss = owner
+ var/mob/living/carbon/human/npc/bounty_criminal/boss/heavy/boss = owner
if(!istype(boss) || !spot || spot.is_blocked_turf() || (locate(/obj/structure/barricade) in spot) || !boss.boss_environment_allowed(spot))
return
if(length(GLOB.bounty_boss_barricades) >= BOUNTY_BOSS_BARRICADE_CAP)
return
- var/obj/structure/barricade/security/bounty_boss/barrier = new(spot)
+ var/obj/item/grenade/barrier/bounty_boss/grenade = boss.boss_barrier()
+ if(isnull(grenade) || !human_npc_take_in_hand(boss, grenade) || !human_npc_ready_item(boss, grenade))
+ return
+ grenade.ability_ref = WEAKREF(src)
+ // The player's way: pull the pin in hand, then throw it.
+ grenade.attack_self(boss)
+ boss.throw_mode_on(THROW_MODE_TOGGLE)
+ if(!boss.throw_item(spot))
+ boss.throw_mode_off(THROW_MODE_TOGGLE)
+ boss.dropItemToGround(grenade)
+
+/// One of its barriers went up: it keeps count of it
+/datum/action/cooldown/mob_cooldown/bounty_boss/barricade/proc/note_barrier(obj/structure/barricade/security/bounty_boss/barrier)
if(QDELETED(barrier))
return
- boss.visible_message(span_warning("[boss] slams a barrier down in front of [boss.p_them()]."))
- playsound(spot, 'sound/effects/bang.ogg', 50, TRUE)
barriers += WEAKREF(barrier)
prune_barriers()
@@ -1297,6 +1358,39 @@
var/obj/structure/barricade/security/bounty_boss/barrier = oldest.resolve()
barrier?.fold_away()
+/**
+ * The Heavy's barrier grenades: tg's barrier grenade on a short fuse, that opens into its folding
+ * barrier instead of a standing one. Issued as a consumable (it may leave the Heavy's body, thrown, but
+ * in anyone else's hands it is gone).
+ */
+/obj/item/grenade/barrier/bounty_boss
+ det_time = BOUNTY_HEAVY_BARRIER_FUSE
+ /// The Heavy's barricade ability that threw it, to count the barrier it makes
+ var/datum/weakref/ability_ref
+
+/obj/item/grenade/barrier/bounty_boss/Destroy()
+ ability_ref = null
+ return ..()
+
+// tg's barrier grenade, but what it makes is the folding barrier (and only ever the one).
+/obj/item/grenade/barrier/bounty_boss/detonate(mob/living/lanced_by)
+ if(dud_flags)
+ active = FALSE
+ update_appearance()
+ return FALSE
+ dud_flags |= GRENADE_USED
+ SEND_SIGNAL(src, COMSIG_GRENADE_DETONATE, lanced_by)
+ var/turf/spot = get_turf(src)
+ if(spot && !(locate(/obj/structure/barricade) in spot))
+ var/obj/structure/barricade/security/bounty_boss/barrier = new(spot)
+ if(!QDELETED(barrier))
+ spot.visible_message(span_warning("[src] snaps open into a barrier."))
+ playsound(spot, 'sound/effects/bang.ogg', 50, TRUE)
+ var/datum/action/cooldown/mob_cooldown/bounty_boss/barricade/ability = ability_ref?.resolve()
+ ability?.note_barrier(barrier)
+ qdel(src)
+ return TRUE
+
/// The Heavy's folding barrier: tg's security barrier that folds itself away after BOUNTY_BOSS_BARRICADE_LIFE. Drops nothing.
/obj/structure/barricade/security/bounty_boss
name = "folding barrier"
diff --git a/voidcrew/modules/bounties/bounty_companions.dm b/voidcrew/modules/bounties/bounty_companions.dm
index 909d993cbd6..af7be6123ef 100644
--- a/voidcrew/modules/bounties/bounty_companions.dm
+++ b/voidcrew/modules/bounties/bounty_companions.dm
@@ -3,179 +3,243 @@
*
* Owner: P3 AI. Do not edit this file outside P3.
*
- * What it owns: /mob/living/basic/bounty_companion (its body, its built-in values and its AI) and
- * spawn_companions(). Companions (0-2, spec C7) keep a criminal company: they sit at the bar with
- * them, take turns in their talk, sit round their camp, and fight beside them with a style of their
- * own (BOUNTY_COMPANION_HEALTH x the style's health; its weapon hits as the real one does). The
- * AI is the trooper's peaceful pattern: retaliation, then calling the rest of the gang in, then the
- * attack, then going to whoever called. A badly hurt companion may run; when their criminal goes
- * down, is cuffed or gives up, each may run; a stamina-crit companion gives up for good.
+ * What it owns: /mob/living/carbon/human/npc/bounty_companion (its built-in values, its outfit and its
+ * AI), bounty_spawn_companion() and spawn_companions(). Companions (0-2, spec C7) keep a criminal
+ * company: they sit at the bar with them (a real chair and a real glass), take turns in their talk, sit
+ * round their camp, and fight beside them with a style of their own: a real weapon they carry and draw
+ * (bounty_styles.dm). They are real human bodies (CR-11): a person's health and stamina, toughness 1,
+ * no multipliers. The AI is the trooper's peaceful pattern: retaliation, then calling the rest of the
+ * gang in, then the attack, then going to whoever called. Badly hurt, a companion may run; when their
+ * criminal goes down, is cuffed or gives up, each may run; up from a real stamina crit with hunters
+ * around, it gives up (tg's *surrender) or runs. It gives up the way its criminal does
+ * (/datum/human_npc_surrender/bounty).
*
- * They are not bounties, pay nothing, drop nothing and carry no real weapon (what is in their hand
- * is only a picture, though its blows and shots are the real item's). P5 deletes them when the posting closes; deleting one at any time
- * is safe.
+ * They are not bounties, pay nothing and drop nothing (their kit is locked to them, D3). P5 deletes
+ * them when the posting closes; deleting one at any time is safe.
+ *
+ * Who they are (A1): people of every species criminals come from (GLOB.bounty_species_weights), in rough
+ * clothes picked by their criminal's site (bounty_company_clothes()), and dressed for what their criminal
+ * was dressed for, so they are sealed up wherever it is (bounty_suits.dm). They are made with their
+ * criminal's spawn context (/datum/npc_spawn_context/bounty_company), which is how they know all that
+ * before they are dressed.
*
* The shared vars are declared in bounty_types.dm and nowhere else (leader_ref); the rest here
* have an `ai_` prefix.
*/
-/mob/living/basic/bounty_companion
+/mob/living/carbon/human/npc/bounty_companion
name = "associate"
- desc = "Someone keeping bad company."
- icon = 'icons/mob/simple/simple_human.dmi'
- unique_name = FALSE
- maxHealth = BOUNTY_COMPANION_HEALTH
- health = BOUNTY_COMPANION_HEALTH
- speed = BOUNTY_CALM_SPEED
- mob_biotypes = MOB_ORGANIC | MOB_HUMANOID
- sentience_type = SENTIENCE_HUMANOID
- status_flags = CANPUSH | CANSTUN | CANKNOCKDOWN
- basic_mob_flags = NONE
- // Stamina crit compares raw loss with a percentage when it ends; a pool of 100 keeps the two the same.
- max_stamina = 100
- max_stamina_slowdown = 1
- // Dressed for the site, as their criminal is: no dying of the air or the cold on the way.
- unsuitable_atmos_damage = 0
- unsuitable_cold_damage = 0
- unsuitable_heat_damage = 0
- blood_volume = BLOOD_VOLUME_NORMAL
- mobility_flags = MOBILITY_FLAGS_REST_CAPABLE_DEFAULT
- rotate_on_lying = TRUE
- death_message = "seizes up and falls limp, their eyes dead and lifeless..."
- response_help_continuous = "pats"
- response_help_simple = "pat"
faction = list(FACTION_HOSTILE)
ai_controller = /datum/ai_controller/basic_controller/bounty/companion
- /// What they hold, drawn in their vis_contents
- var/obj/effect/abstract/bounty_held/ai_hand
- /// Hands up, over their head, once they give up
- var/obj/effect/abstract/bounty_held/ai_over_head
- /// Put their hands up (stamina crit): out of it for good
- var/ai_gave_up = FALSE
+ npc_outfit_table = /datum/human_npc_outfit_table/bounty
+ npc_surrender = /datum/human_npc_surrender/bounty
+ // They stop once their target is down, as their criminal does (spec C4)
+ npc_target_stat = HUMAN_NPC_SPARES_DOWNED
+ // A person's toughness: no multipliers (CR-11)
+ npc_damage_taken = 1
+ /// Their fighting style (BOUNTY_STYLE_*), picked when they are dressed
+ var/ai_style
/// Ran off: out of it for good
var/ai_fled = FALSE
/// The one roll to run when badly hurt has been made
var/ai_flee_rolled = FALSE
- /// In the fight now (weapon out, fighting pace)
+ /// In the fight now (weapon out, at a run)
var/ai_in_fight = FALSE
- /// Their drink at the bar, in their contents
+ /// Went into a real stamina crit, and hasn't decided yet what to do about it
+ var/ai_stamcritted = FALSE
+ /// Their glass at the bar
var/obj/item/reagent_containers/cup/glass/drinkingglass/ai_drink
/// Weakref to the seat they sat on
var/datum/weakref/ai_seat_ref
- /// Sitting on the floor
+ /// Sitting on the floor (tg's resting, of their own choosing)
var/ai_crouching = FALSE
/// Where they mean to be while nothing is happening, and when that is next thought about
var/turf/ai_idle_spot
var/ai_next_idle_think = 0
/// world.time of their next word in the conversation
var/ai_next_reply = 0
+ /// BOUNTY_PLACEMENT_* of their criminal's site, known as they are made (Initialize()), or null
+ var/company_site_kind
+ /// The /datum/outfit their rough clothes came from (bounty_site_clothes()), or null for their plain ones
+ var/company_clothes
+
+/mob/living/carbon/human/npc/bounty_companion/Initialize(mapload, datum/human_npc_order/order)
+ // Before the base dresses them: where their criminal is, and what it was dressed for, so they are too
+ var/datum/npc_spawn_context/bounty_company/company = order?.context
+ var/mob/living/carbon/human/npc/bounty_criminal/leader = istype(company) ? company.company_leader_ref?.resolve() : null
+ if(!QDELETED(leader))
+ company_site_kind = leader.posting()?.placement_kind
+ npc_always_site |= leader.npc_site
+ else
+ npc_always_site |= bounty_site_dress_for(order?.context)
+ company_site_kind ||= bounty_site_kind_of(order?.context)
+ return ..()
-/mob/living/basic/bounty_companion/Destroy()
+/mob/living/carbon/human/npc/bounty_companion/Destroy()
ai_let_go()
- ai_over_head = bounty_ai_update_held(src, ai_over_head, null)
ai_idle_spot = null
leader_ref = null
return ..()
-/mob/living/basic/bounty_companion/death(gibbed)
+/mob/living/carbon/human/npc/bounty_companion/death(gibbed)
ai_let_go()
- ai_over_head = bounty_ai_update_held(src, ai_over_head, null)
return ..()
-/// Their criminal, if still around
-/mob/living/basic/bounty_companion/proc/ai_leader()
- var/mob/living/basic/bounty_criminal/leader = leader_ref?.resolve()
- return QDELETED(leader) ? null : leader
-
-/// Whether they can still fight: awake, on their feet (a knockdown is a cuff window, H2), not run off, not given up
-/mob/living/basic/bounty_companion/proc/ai_can_fight()
- return stat == CONSCIOUS && !ai_gave_up && !ai_fled && !HAS_TRAIT(src, TRAIT_INCAPACITATED) && !HAS_TRAIT(src, TRAIT_FLOORED)
-
/**
- * Joins `leader`: their faction, a style of their own, a look for the site, and a name. Called by
- * spawn_companions().
+ * What they wear: plain clothes for the zone they are made in, their style's weapon (never a Wanted
+ * criminal's heavier one) and its spares, and a bruise pack. The style is picked here, as they are
+ * dressed, so the weapon they carry is the one they fight with.
*/
-/mob/living/basic/bounty_companion/proc/ai_join(mob/living/basic/bounty_criminal/leader)
- leader_ref = WEAKREF(leader)
- faction = leader.faction.Copy()
- gender = pick(MALE, FEMALE)
- name = generate_random_name_species_based(gender, TRUE, /datum/species/human)
- real_name = name
- ai_controller?.set_blackboard_key(BB_BOUNTY_LEADER, leader)
- ai_take_style(pick_weight(list(
+/mob/living/carbon/human/npc/bounty_companion/bounty_build_outfit(zone)
+ ai_style ||= pick_weight(list(
BOUNTY_STYLE_BRAWLER = 3,
BOUNTY_STYLE_KNIFE = 2,
BOUNTY_STYLE_CLUB = 2,
BOUNTY_STYLE_PISTOL = 1,
BOUNTY_STYLE_BOTTLE = 1,
BOUNTY_STYLE_SHOTGUN = 1,
- )))
- INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(set_outpost_npc_look), src, bounty_companion_outfit(leader), gender, random_outpost_npc_look_number())
+ BOUNTY_STYLE_SMG = 1,
+ BOUNTY_STYLE_REVOLVER = 1,
+ ))
+ return bounty_fighter_outfit(BOUNTY_ARCHETYPE_NORMAL, zone, BOUNTY_TIER_PETTY, ai_style, FALSE, /obj/item/stack/medical/bruise_pack)
+
+// Someone of any species a criminal can be, with a face from the criminals' own look builder and a name of their species
+/mob/living/carbon/human/npc/bounty_companion/npc_apply_random_look()
+ var/species = bounty_company_species()
+ npc_apply_bounty_look(bounty_roll_look(species, pick(MALE, FEMALE)))
+ real_name = generate_random_name_species_based(gender, TRUE, dna.species.type)
+ name = real_name
+
+/// A species for a companion, weighted as for criminals (GLOB.bounty_species_weights)
+/proc/bounty_company_species()
+ return pick_weight(GLOB.bounty_species_weights)
+
+// Their plain clothes give way to rough ones picked by their criminal's site
+/mob/living/carbon/human/npc/bounty_companion/bounty_site_clothes(outfit)
+ var/list/choices = bounty_company_clothes(company_site_kind)
+ if(!length(choices) || isnull(outfit))
+ return outfit
+ company_clothes = pick_weight(choices)
+ return bounty_wear_clothes_of(outfit, company_clothes)
-/// Takes style `key`: health BOUNTY_COMPANION_HEALTH x the style's, and the style's own weapon (never a Wanted criminal's heavier one)
-/mob/living/basic/bounty_companion/proc/ai_take_style(key)
- var/datum/bounty_style/style = GLOB.bounty_styles[key]
- if(!style)
- return FALSE
- maxHealth = round(BOUNTY_COMPANION_HEALTH * style.health_mult)
- health = maxHealth
- damage_coeff = damage_coeff.Copy()
- damage_coeff[STAMINA] = style.stamina_mult
- return bounty_ai_apply_style(src, key)
-
-/// What a companion of `leader` wears, by where the criminal is
-/proc/bounty_companion_outfit(mob/living/basic/bounty_criminal/leader)
- var/datum/criminal_bounty/posting = leader?.posting()
- switch(posting?.placement_kind)
+/**
+ * Rough clothes for a criminal's company at a site of `site_kind` (BOUNTY_PLACEMENT_*), each a /datum/outfit
+ * typepath => weight, so no two crews look alike; null where they keep their plain clothes for the zone.
+ * Only the clothes are taken from these (bounty_wear_clothes_of()), never what they carry.
+ */
+/proc/bounty_company_clothes(site_kind)
+ switch(site_kind)
if(BOUNTY_PLACEMENT_NPC_SHIP)
- return /datum/outfit/outpost_off_duty_pirate
- if(BOUNTY_PLACEMENT_TRADER_OUTPOST)
- return /datum/outfit/job/assistant/greytide
- return pick(/datum/outfit/hermit/survivor, /datum/outfit/hermit/survivor/hunter)
+ return list(
+ /datum/outfit/outpost_off_duty_pirate = 1,
+ /datum/outfit/bounty_criminal/hauler = 1,
+ /datum/outfit/bounty_criminal/tough = 1,
+ /datum/outfit/bounty_criminal/drifter = 1,
+ )
+ if(BOUNTY_PLACEMENT_PLANET, BOUNTY_PLACEMENT_RUIN)
+ return list(
+ /datum/outfit/hermit/survivor = 2,
+ /datum/outfit/bounty_criminal/spacer = 1,
+ /datum/outfit/bounty_criminal/hauler = 1,
+ /datum/outfit/bounty_criminal/drifter = 1,
+ /datum/outfit/bounty_criminal/tough = 1,
+ )
+ return null
+
+/**
+ * `outfit` (a typepath or an instance) in the clothes of `clothes_type`: its uniform, suit, hat, mask,
+ * glasses, gloves, shoes and neck, empty where that outfit leaves them empty. Weapons, bags, belts, pockets
+ * and anything in hand stay as they were. Returns an instance (one passed in is changed in place).
+ */
+/proc/bounty_wear_clothes_of(outfit, datum/outfit/clothes_type)
+ var/datum/outfit/dressed = ispath(outfit, /datum/outfit) ? new outfit() : outfit
+ if(!istype(dressed) || !ispath(clothes_type, /datum/outfit))
+ return outfit
+ dressed.uniform = initial(clothes_type.uniform)
+ dressed.suit = initial(clothes_type.suit)
+ dressed.head = initial(clothes_type.head)
+ dressed.mask = initial(clothes_type.mask)
+ dressed.glasses = initial(clothes_type.glasses)
+ dressed.gloves = initial(clothes_type.gloves)
+ dressed.shoes = initial(clothes_type.shoes)
+ dressed.neck = initial(clothes_type.neck)
+ return dressed
+
+/// Their criminal, if still around
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_leader()
+ var/mob/living/carbon/human/npc/bounty_criminal/leader = leader_ref?.resolve()
+ return QDELETED(leader) ? null : leader
+
+/**
+ * Whether they can still fight: awake, out of crit, on their feet (a knockdown is a cuff window, H2),
+ * free, not giving up and not run off. All read from tg.
+ */
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_can_fight()
+ if(stat != CONSCIOUS || ai_fled || npc_surrendering || HAS_TRAIT(src, TRAIT_CRITICAL_CONDITION) || HAS_TRAIT(src, TRAIT_RESTRAINED))
+ return FALSE
+ return !HAS_TRAIT(src, TRAIT_INCAPACITATED) && !HAS_TRAIT(src, TRAIT_FLOORED)
+
+/**
+ * Joins `leader`: their faction, the style they were dressed for, and a place on the criminal's and
+ * the posting's list of companions (whoever spawned them). Called by bounty_spawn_companion().
+ */
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_join(mob/living/carbon/human/npc/bounty_criminal/leader)
+ if(QDELETED(leader))
+ return FALSE
+ leader_ref = WEAKREF(leader)
+ faction = leader.faction.Copy()
+ ai_controller?.set_blackboard_key(BB_BOUNTY_LEADER, leader)
+ bounty_ai_apply_style(src, ai_style || BOUNTY_STYLE_BRAWLER)
+ var/datum/weakref/our_ref = WEAKREF(src)
+ leader.companions |= our_ref
+ var/datum/criminal_bounty/posting = leader.posting()
+ if(posting)
+ posting.companions |= our_ref
+ bounty_ai_set_pace(src, BOUNTY_CALM_SPEED)
+ return TRUE
/// Called in by their criminal: `target` is theirs to fight too
-/mob/living/basic/bounty_companion/proc/ai_join_fight(mob/living/target)
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_join_fight(mob/living/target)
if(!ai_can_fight() || !isliving(target) || QDELETED(ai_controller) || bounty_ai_same_gang(src, target))
return
ai_mark_enemy(target)
- var/mob/living/basic/bounty_criminal/leader = ai_leader()
+ var/mob/living/carbon/human/npc/bounty_criminal/leader = ai_leader()
if(leader && get_dist(src, leader) > 4)
ai_controller.set_blackboard_key(BB_BASIC_MOB_REINFORCEMENT_TARGET, leader)
ai_enter_fight()
-/// Weapon out, up from their seat, fighting pace
-/mob/living/basic/bounty_companion/proc/ai_enter_fight()
+/// Up from their seat, drink down, at a run. The weapon comes out through the arm subtree (bounty_styles.dm).
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_enter_fight()
if(ai_in_fight)
return
ai_in_fight = TRUE
ai_put_drink_away()
ai_stand_up()
- var/datum/bounty_style/style = bounty_ai_style(src)
- set_varspeed(style?.speed || BOUNTY_NORMAL_SPEED_MELEE)
- ai_hand = bounty_ai_update_held(src, ai_hand, bounty_ai_held_look(src))
+ bounty_ai_set_pace(src, BOUNTY_RUN_SPEED)
-/// The fight is over for them: weapon away, easy pace
-/mob/living/basic/bounty_companion/proc/ai_leave_fight()
+/// The fight is over for them: weapon away, at a walk
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_leave_fight()
if(!ai_in_fight)
return
ai_in_fight = FALSE
- set_varspeed(BOUNTY_CALM_SPEED)
- ai_hand = bounty_ai_update_held(src, ai_hand, null)
+ bounty_ai_set_pace(src, BOUNTY_CALM_SPEED)
+ bounty_ai_holster(src)
/// Their criminal is down, cuffed or gave up: half the time they run for it
-/mob/living/basic/bounty_companion/proc/ai_lose_heart()
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_lose_heart()
if(!ai_can_fight() || !prob(50))
return
var/mob/living/threat = ai_controller?.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
ai_run_off(isliving(threat) ? threat : null)
/// Runs off, out of the fight for good
-/mob/living/basic/bounty_companion/proc/ai_run_off(mob/living/threat)
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_run_off(mob/living/threat)
if(ai_fled || stat != CONSCIOUS)
return
ai_fled = TRUE
ai_let_go()
- set_varspeed(BOUNTY_NORMAL_SPEED_MELEE)
+ bounty_ai_holster(src)
+ bounty_ai_set_pace(src, BOUNTY_RUN_SPEED)
visible_message(span_notice("[src] backs off and runs for it."))
if(QDELETED(ai_controller))
return
@@ -186,25 +250,36 @@
ai_controller.set_blackboard_key(BB_BASIC_MOB_FLEE_TARGET, bounty_ai_target_for(threat))
ai_controller.CancelActions()
-/// Stamina crit: hands up, done with it
-/mob/living/basic/bounty_companion/proc/ai_give_up()
- if(ai_gave_up || stat == DEAD)
- return
- ai_gave_up = TRUE
- ai_let_go()
- ai_over_head = bounty_ai_update_held(src, ai_over_head, /obj/effect/abstract/bounty_surrender_mark, over_head = TRUE)
+/// They gave up (tg's *surrender, through the human NPC base): the fight dropped
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_on_surrendered()
visible_message(span_notice("[src] puts [p_their()] hands up."))
+ ai_let_go()
if(QDELETED(ai_controller))
return
ai_controller.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET)
ai_controller.clear_blackboard_key(BB_BASIC_MOB_RETALIATE_LIST)
- ai_controller.CancelActions()
+
+/**
+ * Up from a real stamina crit (CR-11): with hunters around, they give up (tg's *surrender) or run;
+ * with nobody about, they get back to it.
+ */
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_after_stamcrit()
+ ai_stamcritted = FALSE
+ if(!ai_can_fight())
+ return
+ var/datum/human_npc_surrender/rules = npc_surrender_rules()
+ var/list/hostiles = rules?.hostiles_near(src)
+ if(!length(hostiles))
+ return
+ if(prob(BOUNTY_COMPANION_GIVE_UP_CHANCE) && npc_surrender())
+ return
+ ai_run_off(get_closest_atom(/mob/living, hostiles, src))
/**
* `enemy` is someone to fight: onto their retaliation list, and the mech they sit in with them (H4:
* the targeting takes the mech while they are in it, and them once they climb out).
*/
-/mob/living/basic/bounty_companion/proc/ai_mark_enemy(mob/living/enemy)
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_mark_enemy(mob/living/enemy)
if(QDELETED(ai_controller) || !isliving(enemy))
return
ai_controller.insert_blackboard_key_lazylist(BB_BASIC_MOB_RETALIATE_LIST, enemy)
@@ -218,8 +293,8 @@
* blow from their own side of the site with nobody playing it is let go (M1). Knocked down, they
* still remember who did it, and fight once up.
*/
-/mob/living/basic/bounty_companion/proc/ai_attacked_by(mob/living/attacker)
- if(stat == DEAD || ai_gave_up || ai_fled || !isliving(attacker) || bounty_ai_same_gang(src, attacker))
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_attacked_by(mob/living/attacker)
+ if(stat == DEAD || ai_fled || !isliving(attacker) || bounty_ai_same_gang(src, attacker))
return
if(bounty_ai_friendly_fire(src, attacker))
return
@@ -228,24 +303,24 @@
ai_enter_fight()
ai_leader()?.ai_ally_attacked(attacker)
-/// About to take damage: badly hurt, they may run (one roll)
-/mob/living/basic/bounty_companion/proc/ai_took_damage(damage, damagetype)
+/// They took a hit: badly hurt (a person's health, read after the hit), they may run (one roll)
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_took_damage(damage, damagetype)
if(ai_flee_rolled || damage <= 0 || !ai_can_fight() || !(damagetype in list(BRUTE, BURN)))
return
- if(health - damage > maxHealth * BOUNTY_COMPANION_FLEE_BELOW)
+ if(health > maxHealth * BOUNTY_COMPANION_FLEE_BELOW)
return
ai_flee_rolled = TRUE
if(prob(BOUNTY_COMPANION_FLEE_CHANCE))
var/mob/living/threat = ai_controller?.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
INVOKE_ASYNC(src, PROC_REF(ai_run_off), isliving(threat) ? threat : null)
-/// Everything down: drink, seat, weapon
-/mob/living/basic/bounty_companion/proc/ai_let_go()
+/// Everything down: drink, seat or the floor. What they hold stays held (D3).
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_let_go()
ai_put_drink_away()
ai_stand_up()
- ai_hand = bounty_ai_update_held(src, ai_hand, null)
-/mob/living/basic/bounty_companion/proc/ai_sit_on(obj/structure/chair/seat)
+/// Sits on `seat` from its tile: buckled to it, as anyone sitting down is
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_sit_on(obj/structure/chair/seat)
if(QDELETED(seat) || loc != seat.loc || (seat.has_buckled_mobs() && buckled != seat))
return FALSE
if(buckled == seat)
@@ -256,40 +331,49 @@
ai_seat_ref = WEAKREF(seat)
return TRUE
-/mob/living/basic/bounty_companion/proc/ai_crouch()
- if(ai_crouching || buckled)
+/// Sits down on the ground: tg's resting
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_crouch()
+ if(ai_crouching || buckled || resting)
return
ai_crouching = TRUE
- add_offsets(BOUNTY_AI_TRAIT, y_add = -4)
+ set_resting(TRUE, silent = TRUE)
-/// Up from a seat they sat on themselves, or the floor
-/mob/living/basic/bounty_companion/proc/ai_stand_up()
+/// Up from a seat they sat on themselves, or the floor they lay down on themselves
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_stand_up()
if(ai_crouching)
ai_crouching = FALSE
- remove_offsets(BOUNTY_AI_TRAIT)
+ if(resting)
+ set_resting(FALSE, silent = TRUE)
var/obj/structure/chair/seat = ai_seat_ref?.resolve()
ai_seat_ref = null
if(seat && buckled == seat)
seat.unbuckle_mob(src, force = TRUE)
-/mob/living/basic/bounty_companion/proc/ai_take_drink()
- if(!QDELETED(ai_drink))
+/// A glass of something poured into a free hand
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_take_drink()
+ if(!QDELETED(ai_drink) && is_holding(ai_drink))
+ return ai_drink
+ ai_drink = bounty_ai_pour_drink(src)
+ return ai_drink
+
+/// The glass goes: on the table beside them if there is one, else it is gone (M4, L7)
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_put_drink_away()
+ if(QDELETED(ai_drink))
+ ai_drink = null
return
- ai_drink = new(src)
- ai_drink.reagents.add_reagent(/datum/reagent/consumable/ethanol/beer, 25)
- ai_hand = bounty_ai_update_held(src, ai_hand, ai_drink)
-
-/mob/living/basic/bounty_companion/proc/ai_put_drink_away()
- if(ai_drink)
- QDEL_NULL(ai_drink)
- ai_hand = bounty_ai_update_held(src, ai_hand, null)
+ var/obj/item/glass = ai_drink
+ ai_drink = null
+ var/obj/structure/table/table = locate() in range(1, src)
+ if(stat == CONSCIOUS && bounty_ai_set_glass_down(src, glass, table))
+ return
+ qdel(glass)
/**
* Where they mean to be while nothing is happening, thought about every few seconds rather than
* every plan: beside their criminal when they talk, on a seat near them at the bar, beside the fire
* at the camp, otherwise within BOUNTY_COMPANION_FOLLOW of them. Null means right where they are.
*/
-/mob/living/basic/bounty_companion/proc/ai_pick_idle_spot(mob/living/basic/bounty_criminal/leader)
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_pick_idle_spot(mob/living/carbon/human/npc/bounty_criminal/leader)
var/datum/bounty_activity/activity = leader.ai_activity
if(istype(activity, /datum/bounty_activity/chat))
var/datum/bounty_activity/chat/talk = activity
@@ -312,9 +396,9 @@
return ai_free_tile_near(leader, BOUNTY_COMPANION_FOLLOW)
/// The nearest free tile within `distance` of `thing` (not its own), on their criminal's site
-/mob/living/basic/bounty_companion/proc/ai_free_tile_near(atom/thing, distance)
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_free_tile_near(atom/thing, distance)
var/turf/center = get_turf(thing)
- var/mob/living/basic/bounty_criminal/leader = ai_leader()
+ var/mob/living/carbon/human/npc/bounty_criminal/leader = ai_leader()
if(!center)
return null
var/turf/best
@@ -334,18 +418,22 @@
/**
* Hanging out with their criminal, about once a second: sat down where there is a seat (with a
- * drink at the bar), sat by the fire at the camp, facing them, and now and then a word back.
+ * drink at the bar, which they really drink now and then), sat by the fire at the camp, facing them,
+ * and now and then a word back.
*/
-/mob/living/basic/bounty_companion/proc/ai_hang_out()
- var/mob/living/basic/bounty_criminal/leader = ai_leader()
+/mob/living/carbon/human/npc/bounty_companion/proc/ai_hang_out()
+ var/mob/living/carbon/human/npc/bounty_criminal/leader = ai_leader()
if(!leader)
return
var/obj/structure/chair/seat = locate() in loc
if(seat && istype(leader.buckled, /obj/structure/chair) && ai_sit_on(seat))
- ai_take_drink()
+ if(QDELETED(ai_drink))
+ ai_take_drink()
+ else if(prob(5))
+ bounty_ai_sip(src, ai_drink)
else if(istype(leader.ai_activity, /datum/bounty_activity/camp))
ai_crouch()
- if(!buckled && get_dist(src, leader) <= 3)
+ if(!buckled && !resting && get_dist(src, leader) <= 3)
face_atom(leader)
if(world.time < ai_next_reply || leader.ai_mode != BOUNTY_AI_CALM || get_dist(src, leader) > 3)
return
@@ -353,14 +441,64 @@
if(prob(50) && !istype(leader.ai_activity, /datum/bounty_activity/chat))
INVOKE_ASYNC(src, TYPE_PROC_REF(/mob/living, bounty_say), "companion_reply")
+// ===== SPAWNING =====
+
+/**
+ * Queues one companion for `leader` at `where` (the human NPC spawn queue: never a room of humans in
+ * one tick), who joins them as it is made: their faction, their side, their posting's list. Then
+ * `on_spawned` is called with it. If the criminal is gone by then, the companion is not kept.
+ * `immediate` builds it now (tests, admin tools). Returns the spawn order (qdel() cancels it). It is
+ * made with its criminal's spawn context, so it is dressed for where they are.
+ */
+/proc/bounty_spawn_companion(mob/living/carbon/human/npc/bounty_criminal/leader, turf/where, datum/callback/on_spawned, immediate = FALSE)
+ where = get_turf(where)
+ if(QDELETED(leader) || !where)
+ return null
+ var/datum/npc_spawn_context/bounty_company/company = new(leader, null, "ordinary")
+ company.company_leader_ref = WEAKREF(leader)
+ return spawn_human_npc(/mob/living/carbon/human/npc/bounty_companion, where, CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(bounty_companion_spawned), WEAKREF(leader), on_spawned), context = company, immediate = immediate)
+
+/**
+ * A companion's spawn context: its criminal's own (the site, zone and source it inherits from the
+ * criminal it is made from), and which criminal that is, for the companion to read as it is dressed.
+ */
+/datum/npc_spawn_context/bounty_company
+ /// Weakref to the criminal the companion is made for
+ var/datum/weakref/company_leader_ref
+
+/datum/npc_spawn_context/bounty_company/Destroy()
+ company_leader_ref = null
+ return ..()
+
+/**
+ * Whether a criminal may hide aboard `npc_ship` (board_pick_npc_ship()): a crew of ordinary people, the
+ * grey tide's salvagers, Interdyne's rogue researchers or a crew with no faction. Never a themed crew's
+ * (skeletons, geodes, lizard nobles, knights, customs and the like).
+ */
+/proc/bounty_ship_hides_criminals(obj/structure/overmap/ship/npc/pirate/npc_ship)
+ if(!istype(npc_ship))
+ return FALSE
+ return !npc_ship.pirate_faction || (npc_ship.pirate_faction in list("grey", "interdyne"))
+
+/// A queued companion is made: it joins its criminal, or goes if its criminal is gone
+/proc/bounty_companion_spawned(datum/weakref/leader_ref, datum/callback/on_spawned, mob/living/carbon/human/npc/bounty_companion/companion)
+ var/mob/living/carbon/human/npc/bounty_criminal/leader = leader_ref?.resolve()
+ if(QDELETED(companion))
+ return
+ if(QDELETED(leader) || !companion.ai_join(leader))
+ qdel(companion)
+ return
+ on_spawned?.Invoke(companion)
+
// ===== THE CRIMINAL'S SIDE =====
/**
* Spawns `count` companions (clamped to BOUNTY_COMPANIONS_MIN-BOUNTY_COMPANIONS_MAX) on free tiles
- * beside them, remembered in their own `companions`. Returns the companions spawned: the caller
- * (P5) puts them on the posting, and keeps to the global cap on live companions.
+ * beside them, through the human NPC spawn queue (bounty_spawn_companion()). Each joins them, and their
+ * posting, as it is made. Returns the companions already made: only with `immediate` (tests, admin
+ * tools), otherwise an empty list.
*/
-/mob/living/basic/bounty_criminal/proc/spawn_companions(count)
+/mob/living/carbon/human/npc/bounty_criminal/proc/spawn_companions(count, immediate = FALSE)
. = list()
count = clamp(count, BOUNTY_COMPANIONS_MIN, BOUNTY_COMPANIONS_MAX)
var/turf/home = get_turf(src)
@@ -377,16 +515,16 @@
for(var/i in 1 to count)
if(!length(spots))
break
- var/mob/living/basic/bounty_companion/buddy = new(pick_n_take(spots))
- buddy.ai_join(src)
- companions |= WEAKREF(buddy)
- . += buddy
+ var/datum/human_npc_order/order = bounty_spawn_companion(src, pick_n_take(spots), null, immediate)
+ var/mob/living/carbon/human/npc/bounty_companion/buddy = order?.spawned_ref?.resolve()
+ if(!QDELETED(buddy))
+ . += buddy
/**
* One of their companions was attacked by `attacker`: it goes on their grudge list, and the gang
* turns on them. Never while blended in (C1), and never over friendly fire (M1).
*/
-/mob/living/basic/bounty_criminal/proc/ai_ally_attacked(mob/living/attacker)
+/mob/living/carbon/human/npc/bounty_criminal/proc/ai_ally_attacked(mob/living/attacker)
if(blended || !isliving(attacker) || bounty_ai_same_gang(src, attacker) || bounty_ai_friendly_fire(src, attacker))
return
ai_add_grudge(attacker)
@@ -397,18 +535,25 @@
// ===== AI =====
/**
- * A companion's controller: the trooper's peaceful pattern (retaliate, call the others in,
- * attack by style, go to whoever called), then hanging out with their criminal.
+ * A companion's controller: the trooper's peaceful pattern (retaliate, call the others in, attack by
+ * style with the real weapon, go to whoever called), patching themselves up when it is quiet (N6), then
+ * hanging out with their criminal. It gives up as its criminal does (human_npc_surrender).
*/
/datum/ai_controller/basic_controller/bounty/companion
planning_subtrees = list(
+ /datum/ai_planning_subtree/human_npc_soft_crit,
+ /datum/ai_planning_subtree/bounty_escape_captivity,
+ /datum/ai_planning_subtree/human_npc_walk_out,
+ /datum/ai_planning_subtree/human_npc_surrender,
/datum/ai_planning_subtree/bounty_companion_gate,
/datum/ai_planning_subtree/flee_target/bounty,
/datum/ai_planning_subtree/target_retaliate/bounty,
/datum/ai_planning_subtree/call_reinforcements/bounty,
- /datum/ai_planning_subtree/basic_ranged_attack_subtree/bounty,
- /datum/ai_planning_subtree/basic_melee_attack_subtree/bounty,
+ /datum/ai_planning_subtree/bounty_arm,
+ /datum/ai_planning_subtree/bounty_ranged,
+ /datum/ai_planning_subtree/bounty_melee,
/datum/ai_planning_subtree/travel_to_point/and_clear_target/reinforce/bounty,
+ /datum/ai_planning_subtree/bounty_treat_self,
/datum/ai_planning_subtree/bounty_companion_idle,
)
@@ -418,53 +563,61 @@
* takes a pilot's mech on with them (H4).
*/
/datum/ai_controller/basic_controller/bounty/companion/TryPossessPawn(atom/new_pawn)
- if(!istype(new_pawn, /mob/living/basic/bounty_companion))
+ if(!istype(new_pawn, /mob/living/carbon/human/npc/bounty_companion))
return AI_CONTROLLER_INCOMPATIBLE
- var/mob/living/basic/bounty_companion/companion = new_pawn
+ var/mob/living/carbon/human/npc/bounty_companion/companion = new_pawn
RegisterSignal(companion, COMSIG_LIVING_ENTER_STAMCRIT, PROC_REF(on_stamcrit))
+ RegisterSignal(companion, COMSIG_HUMAN_NPC_RECOVERED, PROC_REF(on_recovered))
+ RegisterSignal(companion, COMSIG_HUMAN_NPC_SURRENDERED, PROC_REF(on_surrendered))
return ..()
/datum/ai_controller/basic_controller/bounty/companion/UnpossessPawn(destroy)
if(pawn)
- UnregisterSignal(pawn, COMSIG_LIVING_ENTER_STAMCRIT)
+ UnregisterSignal(pawn, list(COMSIG_LIVING_ENTER_STAMCRIT, COMSIG_HUMAN_NPC_RECOVERED, COMSIG_HUMAN_NPC_SURRENDERED))
return ..()
/datum/ai_controller/basic_controller/bounty/companion/may_shoot(atom/target)
- var/mob/living/basic/bounty_companion/companion = pawn
+ var/mob/living/carbon/human/npc/bounty_companion/companion = pawn
return istype(companion) && companion.ai_can_fight() && ..()
/datum/ai_controller/basic_controller/bounty/companion/may_strike(atom/target)
- var/mob/living/basic/bounty_companion/companion = pawn
+ var/mob/living/carbon/human/npc/bounty_companion/companion = pawn
return istype(companion) && companion.ai_can_fight() && ..()
/datum/ai_controller/basic_controller/bounty/companion/pawn_attacked(mob/living/attacker)
- var/mob/living/basic/bounty_companion/companion = pawn
+ var/mob/living/carbon/human/npc/bounty_companion/companion = pawn
if(istype(companion))
companion.ai_attacked_by(attacker)
/datum/ai_controller/basic_controller/bounty/companion/pawn_damaged(damage, damagetype)
- var/mob/living/basic/bounty_companion/companion = pawn
+ var/mob/living/carbon/human/npc/bounty_companion/companion = pawn
if(istype(companion))
companion.ai_took_damage(damage, damagetype)
-/datum/ai_controller/basic_controller/bounty/companion/place_held(facing)
- var/mob/living/basic/bounty_companion/companion = pawn
- if(istype(companion))
- bounty_ai_place_held(companion, companion.ai_hand, facing)
+/datum/ai_controller/basic_controller/bounty/companion/proc/on_stamcrit(mob/living/carbon/human/npc/bounty_companion/source)
+ SIGNAL_HANDLER
+ source.ai_stamcritted = TRUE
+
+/// Back up: from a real stamina crit, they decide whether to give up or run
+/datum/ai_controller/basic_controller/bounty/companion/proc/on_recovered(mob/living/carbon/human/npc/bounty_companion/source)
+ SIGNAL_HANDLER
+ if(source.ai_stamcritted && source.stat == CONSCIOUS)
+ INVOKE_ASYNC(source, TYPE_PROC_REF(/mob/living/carbon/human/npc/bounty_companion, ai_after_stamcrit))
-/datum/ai_controller/basic_controller/bounty/companion/proc/on_stamcrit(mob/living/basic/bounty_companion/source)
+/datum/ai_controller/basic_controller/bounty/companion/proc/on_surrendered(mob/living/carbon/human/npc/bounty_companion/source)
SIGNAL_HANDLER
- INVOKE_ASYNC(source, TYPE_PROC_REF(/mob/living/basic/bounty_companion, ai_give_up))
+ INVOKE_ASYNC(source, TYPE_PROC_REF(/mob/living/carbon/human/npc/bounty_companion, ai_on_surrendered))
/**
- * First in a companion's tree: nothing while given up or down; one that ran off only runs, and
- * once clear of whoever it ran from, stays out of it.
+ * A companion's own subtrees start here, after soft crit, breaking free and giving up: nothing while
+ * it can't act (in crit, cuffed, stunned, giving up); one that ran off only runs, and once clear of
+ * whoever it ran from, stays out of it.
*/
/datum/ai_planning_subtree/bounty_companion_gate
/datum/ai_planning_subtree/bounty_companion_gate/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/bounty_companion/companion = controller.pawn
- if(!istype(companion) || companion.stat != CONSCIOUS || companion.ai_gave_up)
+ var/mob/living/carbon/human/npc/bounty_companion/companion = controller.pawn
+ if(!istype(companion) || companion.stat != CONSCIOUS || companion.npc_surrendering || HAS_TRAIT(companion, TRAIT_RESTRAINED))
return SUBTREE_RETURN_FINISH_PLANNING
// Knocked down or stunned: nothing at all until they are up (H2)
if(HAS_TRAIT(companion, TRAIT_FLOORED) || HAS_TRAIT(companion, TRAIT_INCAPACITATED))
@@ -497,7 +650,7 @@
/datum/ai_behavior/call_reinforcements/bounty/perform(seconds_per_tick, datum/ai_controller/controller)
var/mob/living/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
- var/mob/living/basic/bounty_criminal/leader = bounty_ai_side_of(controller.pawn)
+ var/mob/living/carbon/human/npc/bounty_criminal/leader = bounty_ai_side_of(controller.pawn)
if(leader && isliving(target))
leader.ai_ally_attacked(target)
controller.set_blackboard_key(BB_BASIC_MOB_REINFORCEMENTS_COOLDOWN, world.time + BOUNTY_REINFORCE_COOLDOWN)
@@ -514,10 +667,10 @@
/datum/ai_planning_subtree/bounty_companion_idle
/datum/ai_planning_subtree/bounty_companion_idle/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/bounty_companion/companion = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_companion/companion = controller.pawn
if(!companion.ai_can_fight())
return
- var/mob/living/basic/bounty_criminal/leader = companion.ai_leader()
+ var/mob/living/carbon/human/npc/bounty_criminal/leader = companion.ai_leader()
if(companion.ai_in_fight && !controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET) && leader?.ai_mode != BOUNTY_AI_FIGHTING)
companion.ai_leave_fight()
if(!leader)
@@ -541,7 +694,7 @@
behavior_flags = AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
/datum/ai_behavior/bounty_companion_hang_out/perform(seconds_per_tick, datum/ai_controller/controller)
- var/mob/living/basic/bounty_companion/companion = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_companion/companion = controller.pawn
if(!istype(companion) || !companion.ai_can_fight())
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED
companion.ai_hang_out()
diff --git a/voidcrew/modules/bounties/bounty_criminal.dm b/voidcrew/modules/bounties/bounty_criminal.dm
index e8f95e0702f..e9849f8b481 100644
--- a/voidcrew/modules/bounties/bounty_criminal.dm
+++ b/voidcrew/modules/bounties/bounty_criminal.dm
@@ -5,97 +5,48 @@
* bounty exemption line in voidcrew/_HELPERS/hostile_creatures.dm and the tests in
* voidcrew/modules/unit_tests/voidcrew_bounty_criminal.dm. Do not edit this file outside P2.
*
- * What it owns: the criminal mob's body (health, stamina, status flags and the built-in values of
- * /mob/living/basic/bounty_criminal, /meek and /normal), the downed state and its mercy rule and
- * recovery, capture_state(), refusing teleports and polymorph, the planet-sweep protection,
- * spawn_bounty_criminal(), the leash and who it may attack (spec sections 4 and 12).
+ * A criminal is a real human (/mob/living/carbon/human/npc, voidcrew/modules/human_npcs/), so its body
+ * is a player's: tg's soft and hard crit, stamina and stamcrit, stuns, wounds, bleeding, cuffs, grabs,
+ * fireman carries, fire, cold, suffocation, death and revival (owner decision D5, no stand-ins). What
+ * this file adds on top is the bounty's own rules:
+ * - Who it is (record, posting) and its look: its record's face (the human NPC base applies it), in the
+ * outfit its archetype and tier give it (bounty_outfits.dm). Toughness is the armour it wears and
+ * npc_damage_taken by tier (body_toughness()), never health.
+ * - capture_state(), read from tg at the moment it is asked: dead; in crit (soft or hard, even
+ * cuffed); restrained (tg's TRAIT_RESTRAINED: handcuffs, cable, zipties, a straitjacket); stunned
+ * (stamcrit, knockdown, stun, paralysis including tg's *surrender, unconscious, asleep); free. The pad
+ * pays on the state at the press (owner ruling 2026-11-08: no worst-state ratchet).
+ * - What it says: npc_bark() speaks through bounty_say() and strings/bounty_criminals.json, so the human
+ * NPC base's reactions (crit, getting up, cuffs, working the cuffs, breaking a grab, giving up) use the
+ * criminal lines.
+ * - Its site and leash (AR-D2, H1, M3): the site's rectangle, or the pirate ship it is wanted aboard,
+ * less every ship, hangar, player outpost and dock strip inside it. Its AI's movement keeps to it
+ * (/datum/ai_movement/jps/bounty); anyone can drag, carry or shove it anywhere. Off its site, and
+ * anywhere at a trader outpost, it fights only those on its grudge list and never structures.
+ * - No teleports (the pad deletes it), and a container it is in can't be teleported either; no fultons,
+ * no polymorph, no type change (M2). Turrets read its tg state (bounty_turret_ignores()).
+ * - Its body is the proof (AR-A5): a corpse is turned in for the dead share; a body destroyed with its
+ * posting open (gibbed, dusted, lost in a chasm or lava) leaves an evidence tag through P5's
+ * bounty_drop_proof(), unless it was removed on purpose (TRAIT_BOUNTY_REMOVED, or body_mark_removed()).
+ * A live body deleted never does. It can be revived like anyone; it pays by its condition when it
+ * reaches the pad.
+ * Cuffs and the reaction to a reach for its wrists are in bounty_restraints.dm.
*
- * The body, in short:
- * - Health: meek BOUNTY_MEEK_HEALTH; normal by tier times its style; mini-bosses per kit (P4).
- * - Stamina: max_stamina is always 100 (tg's basic mobs leave stamina crit by comparing raw points
- * with a percentage), so a pool of another size is the stamina damage coefficient, 100 / pool.
- * - Downed at BOUNTY_DOWNED_BELOW percent: floored, harmless and draggable. A hit on one still on its
- * feet stops just under the line (the mercy rule), so killing it is always a choice; a hit on one
- * that is down can kill. It gets up after its recovery time, groaning for the last
- * BOUNTY_BODY_STIRRING_TELL, at BOUNTY_RECOVER_TO percent. Cuffed, it stays down; healing does not
- * stand it up; a stamina hit starts the clock again (C1). A mini-boss that gets up rallies for
- * BOUNTY_BODY_RALLY_TIME: stamina does nothing to it.
- * - On its site, damage with nobody's mind behind it (turrets, traps, fire, fauna) stops at
- * BOUNTY_AUTOMATED_FLOOR percent. /datum/component/bounty_body keeps the ledger (AR-D3): a hit is a
- * player's when someone with a mind made it, fired it (a mech's or vehicle's shot counts its pilot),
- * last touched the explosive, or stands near an explosion.
- * - Fire and heat burn it like a suited person (L3), within the mercy line and the floor.
- * - worst_state only ever gets worse (spec 12.1); P5 pays on it, and carries it to a respawned copy
- * with body_restore_worst_state().
- * - On the floor and draggable (down, stunned, cuffed or dead), it can be fireman carried like a
- * person. It squirms off the carrier's shoulders once it can't be dragged any more.
- * - Dead, the body stays and can't be revived (AR-A5). A dead body destroyed with its posting open
- * (gibbed, dusted, lost in a chasm) asks P5's bounty_drop_proof() for proof of death, unless it was
- * removed on purpose (P5's TRAIT_BOUNTY_REMOVED, or body_mark_removed()). A live one deleted never
- * does. P5 decides where the proof goes.
- * - Its site: the site's rectangle (or the pirate ship it is wanted aboard), less every ship, hangar,
- * player outpost and planet dock strip inside it (H1). Leashed to it (AR-D2): its own feet never
- * take it off, nor onto a trader outpost's lift alcove, lava, a chasm or space. Once off (woken
- * aboard a ship, dragged away), it may walk about where it is and back, but never on into another
- * ship or hangar or into a player outpost (M3). Anyone can still drag it anywhere, and a scripted
- * walk (TRAIT_BOUNTY_SCRIPTED_MOVE, or godmode) goes where it is sent. Off its site, and anywhere at
- * a trader outpost, it fights only those on its grudge list and never structures (AR-D1, AR-C8).
- * - No teleports (the pad deletes it), and a container it is in can't be teleported either; no
- * fultons, no polymorph, no type change, no sentience (M2). Turrets at trader outposts leave it
- * alone, and no turret shoots one that is down, stunned or restrained (bounty_turret_ignores()).
- * Restraints are in bounty_restraints.dm.
- *
- * The shared vars are declared in bounty_types.dm and nowhere else; a var only P2 uses goes here
- * with a `body_` prefix.
+ * What differs from a player's body is only the human NPC base's documented list (dormancy off-z, no
+ * mood or hunger, locked gear). The shared vars are declared in bounty_types.dm and nowhere else; a var
+ * only P2 uses goes here with a `body_` prefix.
*/
// ===== BUILT-IN VALUES =====
-/mob/living/basic/bounty_criminal
+/mob/living/carbon/human/npc/bounty_criminal
name = "criminal"
- desc = "Someone with a price on their head."
- icon = 'icons/mob/simple/simple_human.dmi'
- unique_name = FALSE
- maxHealth = BOUNTY_NORMAL_HEALTH_WANTED
- health = BOUNTY_NORMAL_HEALTH_WANTED
- speed = BOUNTY_BODY_NORMAL_SPEED_MELEE
- mob_biotypes = MOB_ORGANIC | MOB_HUMANOID
- mob_size = MOB_SIZE_HUMAN
- sentience_type = BOUNTY_CRIMINAL_NO_SENTIENCE
- density = TRUE
- // Too heavy to shove about while free and on its feet; see body_update_drag().
- move_resist = MOVE_FORCE_VERY_STRONG
- // No DEL_ON_DEATH: the body is the proof (AR-A5).
- basic_mob_flags = NONE
- // Batons knock them down, as they do people.
- status_flags = CANPUSH | CANSTUN | CANKNOCKDOWN
- max_stamina = BOUNTY_CRIMINAL_MAX_STAMINA
- stamina_crit_threshold = BOUNTY_CRIMINAL_STAMCRIT_AT
- stamina_regen_time = BOUNTY_NORMAL_STAMCRIT_TIME
- // Downed, stunned or dead, they lie on the floor like a person.
- mobility_flags = MOBILITY_FLAGS_REST_CAPABLE_DEFAULT
- rotate_on_lying = TRUE
- blood_volume = BLOOD_VOLUME_NORMAL
- // Dressed for out there: vacuum and cold don't hurt them (D-A9). Weapons, lava, chasms and fire do;
- // fire and heat through Life(), not tg's element, so the mercy line holds.
- unsuitable_atmos_damage = 0
- unsuitable_cold_damage = 0
- unsuitable_heat_damage = 0
- // tg's human deathgasp
- death_message = "seizes up and falls limp, their eyes dead and lifeless..."
- response_help_continuous = "taps"
- response_help_simple = "tap"
- /// Runs while it is down: the stirring tell, then getting up
- var/body_recovery_timer
- /// Down, and groaning as it tries to get up
- var/body_stirring = FALSE
- /// Its recovery came due while it was cuffed: it gets up once the cuffs are off
- var/body_recovery_due = FALSE
- /// world.time until which a mini-boss that just got up shrugs off stamina, and the timer that ends it
- var/body_rally_until = 0
- var/body_rally_timer
- /// world.time a projectile last got through to it, for the meek's dodge
- var/body_last_shot_at = -1
+ faction = list(FACTION_HOSTILE)
+ // Criminals stop once their target is down (spec C4, defaults 1.13). Their area effects still hit whoever stands there.
+ npc_target_stat = HUMAN_NPC_SPARES_DOWNED
+ // The body is the proof: its posting decides when it goes (bounty_posting.dm), never the corpse sweep.
+ npc_corpse_lifetime = 0
+ npc_outfit_table = /datum/human_npc_outfit_table/bounty
/// Removed on purpose (beamed out by the pad, cleaned up by its posting, its site unloading): being deleted is not a death, so it leaves no proof
var/body_removed = FALSE
/// Its proof of death is down already
@@ -104,59 +55,41 @@
var/datum/weakref/body_site_ref
/// The top row of its planet's dock strip, or null
var/body_dock_top_y
- /// Someone is putting restraints on it or taking them off (bounty_restraints.dm)
- var/body_cuff_work = FALSE
- /// The timers for its restraints slipping: the visible struggle, then the slip (bounty_restraints.dm)
- var/body_slip_warn_timer
- var/body_slip_timer
/// Weakref to the container holding it (a locker, a crate, a body bag), kept from being teleported while it is inside
var/datum/weakref/body_holder_ref
/// The last balloon floated over it for hunters (body_alert_hunters()): "worn out"
var/body_last_alert
-
-/mob/living/basic/bounty_criminal/meek
- maxHealth = BOUNTY_MEEK_HEALTH
- health = BOUNTY_MEEK_HEALTH
- speed = BOUNTY_BODY_MEEK_SPEED
- max_stamina_slowdown = BOUNTY_MEEK_STAMINA_SLOWDOWN
- stamina_regen_time = BOUNTY_MEEK_STAMCRIT_TIME
-
-/mob/living/basic/bounty_criminal/Initialize(mapload)
+ /// Its toughness comes from its record's tier (body_toughness()). A subtype with a fixed toughness of its own (a mini-boss, the kingpin) turns this off.
+ var/body_tier_toughness = TRUE
+
+/mob/living/carbon/human/npc/bounty_criminal/Initialize(mapload, datum/human_npc_order/order)
+ // Who it is must be known before the base dresses it: the outfit table reads the record (bounty_outfits.dm).
+ if(istype(order?.look, /datum/bounty_record))
+ record = order.look
+ // So must where it is: at a space ruin, or on a planet with air that would hurt it, it is dressed for that wherever it stands (bounty_suits.dm)
+ npc_always_site |= bounty_site_dress_for(order?.context)
. = ..()
- // Its own copy: the stamina pool here, and a mini-boss's armour (P4), change it per mob.
- damage_coeff = damage_coeff.Copy()
- body_update_stamina_coeff()
- // TRAIT_CAN_MOUNT_HUMANS: someone can carry it over their shoulders (body_can_be_carried())
- add_traits(list(TRAIT_NO_TELEPORT, TRAIT_NOMOBSWAP, TRAIT_CAN_MOUNT_HUMANS), BOUNTY_BODY_TRAIT)
+ add_traits(list(TRAIT_NO_TELEPORT, TRAIT_NOMOBSWAP), BOUNTY_BODY_TRAIT)
AddComponent(/datum/component/bounty_body)
- AddElement(/datum/element/footstep, footstep_type = FOOTSTEP_MOB_SHOE)
+ body_hook_cuffs()
+ body_toughness()
-/mob/living/basic/bounty_criminal/Destroy()
+/mob/living/carbon/human/npc/bounty_criminal/Destroy()
if(body_leaves_proof())
body_drop_proof()
- deltimer(body_recovery_timer)
- body_recovery_timer = null
- body_remove_cuffs()
body_set_holder(null)
grudge?.Cut()
body_site_ref = null
return ..()
-// Fire and heat burn it like a suited person (L3). Not forced, so the mercy line and the automated floor hold. Mini-bosses keep P4's own fire rules.
-/mob/living/basic/bounty_criminal/Life(seconds_per_tick = SSMOBS_DT, times_fired)
- . = ..()
- if(stat == DEAD || istype(src, /mob/living/basic/bounty_criminal/boss))
- return
- if(on_fire || bodytemperature > BOUNTY_CRIMINAL_MAX_TEMP)
- adjustFireLoss(BOUNTY_CRIMINAL_BURN_DAMAGE * seconds_per_tick)
-
// ===== SPAWNING =====
/**
* Spawns the criminal for `record` at `where`, wanted on `posting` (or on nothing, for an admin
- * spawn): the subtype for its archetype and kit, with the body for its tier and style, leashed to the
- * posting's site, protected from the planet sweep and dressed in its look. Returns the mob. Decoys
- * are made by P6 directly.
+ * spawn): a real human of the subtype for its archetype and kit, built now (one body, so it doesn't
+ * wait in the human NPC queue), in its record's face and name, dressed for its archetype, tier and
+ * site, leashed to the posting's site and protected from the planet sweep. Returns the mob. Decoys are
+ * made by P6 directly.
*/
/proc/spawn_bounty_criminal(datum/bounty_record/record, turf/where, datum/criminal_bounty/posting)
where = get_turf(where)
@@ -165,9 +98,12 @@
var/criminal_type = bounty_criminal_type(record, posting)
var/atom/site = posting?.site_ref?.resolve()
var/datum/npc_spawn_context/context = new(site || where, null, "ordinary", source_turf = site ? get_turf(site) : where)
- var/mob/living/basic/bounty_criminal/criminal = spawn_npc_in_zone(criminal_type, where, context, FALSE)
+ var/datum/human_npc_order/order = spawn_human_npc(criminal_type, where, look = record, name = record?.name, context = context, immediate = TRUE)
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = order?.spawned_ref?.resolve()
+ qdel(order)
+ if(QDELETED(criminal))
+ return null
criminal.body_setup(record, posting)
- context.finalize()
return criminal
/// The criminal type for `record` wanted on `posting`: meek, normal, or the mini-boss of its kit. A mini-boss never goes to a trader outpost; a normal criminal stands in (D-A8).
@@ -177,138 +113,81 @@
archetype = BOUNTY_ARCHETYPE_NORMAL
switch(archetype)
if(BOUNTY_ARCHETYPE_MEEK)
- return /mob/living/basic/bounty_criminal/meek
+ return /mob/living/carbon/human/npc/bounty_criminal/meek
if(BOUNTY_ARCHETYPE_BOSS)
switch(record.kit)
if(BOUNTY_KIT_JUGGERNAUT)
- return /mob/living/basic/bounty_criminal/boss/juggernaut
+ return /mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut
if(BOUNTY_KIT_PYROMANIAC)
- return /mob/living/basic/bounty_criminal/boss/pyromaniac
+ return /mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac
if(BOUNTY_KIT_DEMOLITIONIST)
- return /mob/living/basic/bounty_criminal/boss/demolitionist
+ return /mob/living/carbon/human/npc/bounty_criminal/boss/demolitionist
if(BOUNTY_KIT_GHOST)
- return /mob/living/basic/bounty_criminal/boss/ghost
+ return /mob/living/carbon/human/npc/bounty_criminal/boss/ghost
if(BOUNTY_KIT_HEAVY)
- return /mob/living/basic/bounty_criminal/boss/heavy
+ return /mob/living/carbon/human/npc/bounty_criminal/boss/heavy
return pick(
- /mob/living/basic/bounty_criminal/boss/juggernaut,
- /mob/living/basic/bounty_criminal/boss/pyromaniac,
- /mob/living/basic/bounty_criminal/boss/demolitionist,
- /mob/living/basic/bounty_criminal/boss/ghost,
- /mob/living/basic/bounty_criminal/boss/heavy,
+ /mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut,
+ /mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac,
+ /mob/living/carbon/human/npc/bounty_criminal/boss/demolitionist,
+ /mob/living/carbon/human/npc/bounty_criminal/boss/ghost,
+ /mob/living/carbon/human/npc/bounty_criminal/boss/heavy,
)
- return /mob/living/basic/bounty_criminal/normal
+ return /mob/living/carbon/human/npc/bounty_criminal/normal
/**
- * Makes it the person in `new_record`, wanted on `new_posting` (either may be null): name, the body
- * for its tier and style, the leash to the posting's site, the planet-sweep protection, and its look,
- * put on in the background. spawn_bounty_criminal() calls it once, right after making the mob.
+ * Makes it the person in `new_record`, wanted on `new_posting` (either may be null): name, toughness
+ * for its tier, the leash to the posting's site and the planet-sweep protection. spawn_bounty_criminal()
+ * calls it once, right after making the mob; its face and clothes are already on (the human NPC base
+ * dresses it from the record as it is made).
*/
-/mob/living/basic/bounty_criminal/proc/body_setup(datum/bounty_record/new_record, datum/criminal_bounty/new_posting)
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_setup(datum/bounty_record/new_record, datum/criminal_bounty/new_posting)
record = new_record
posting_ref = new_posting ? WEAKREF(new_posting) : null
- if(record?.name)
- name = record.name
- real_name = record.name
- if(record?.gender == MALE || record?.gender == FEMALE)
- gender = record.gender
- var/tier_health = body_tier_health()
- if(tier_health)
- maxHealth = tier_health
- updatehealth()
- if(istype(src, /mob/living/basic/bounty_criminal/normal))
- var/ranged = record?.style == BOUNTY_STYLE_PISTOL || record?.style == BOUNTY_STYLE_BOTTLE
- set_varspeed(ranged ? BOUNTY_BODY_NORMAL_SPEED_RANGED : BOUNTY_BODY_NORMAL_SPEED_MELEE)
- body_update_stamina_coeff()
+ if(record?.name && real_name != record.name)
+ fully_replace_character_name(real_name, record.name)
+ body_toughness()
body_set_site(new_posting?.site_ref?.resolve())
if(new_posting)
// The planet's fauna sweep leaves it be while it is wanted (missions/objectives/combat.dm). P5 takes it off when the posting ends.
ADD_TRAIT(src, TRAIT_MISSION_FIELD_MOB, BOUNTY_TRAIT)
- INVOKE_ASYNC(src, PROC_REF(body_dress))
-/// A normal criminal's health: its tier's, times its style's. Null for anyone else, who keeps their built-in health.
-/mob/living/basic/bounty_criminal/proc/body_tier_health()
- if(!istype(src, /mob/living/basic/bounty_criminal/normal))
- return null
- var/base = BOUNTY_NORMAL_HEALTH_WANTED
+/**
+ * How much brute and burn it takes, as a multiple of a person's, through its physiology (the human
+ * NPC base's npc_damage_taken): by its record's tier, meek criminals at a person's. A subtype with a
+ * fixed value of its own sets body_tier_toughness = FALSE. Its armour does the rest.
+ */
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_toughness()
+ if(!body_tier_toughness)
+ return
+ var/wanted = BOUNTY_TOUGHNESS_PETTY
switch(record?.tier)
- if(BOUNTY_TIER_PETTY)
- base = BOUNTY_NORMAL_HEALTH_PETTY
+ if(BOUNTY_TIER_WANTED)
+ wanted = BOUNTY_TOUGHNESS_WANTED
if(BOUNTY_TIER_MOST_WANTED)
- base = BOUNTY_NORMAL_HEALTH_MOST
- return round(base * bounty_style_health_mult(record?.style), 1)
-
-/// How much tougher or frailer than its tier a fighting style makes a normal criminal
-/proc/bounty_style_health_mult(style)
- switch(style)
- if(BOUNTY_STYLE_BRAWLER)
- return BOUNTY_STYLE_HEALTH_BRAWLER
- if(BOUNTY_STYLE_KNIFE)
- return BOUNTY_STYLE_HEALTH_KNIFE
- if(BOUNTY_STYLE_PISTOL)
- return BOUNTY_STYLE_HEALTH_PISTOL
- if(BOUNTY_STYLE_SHOTGUN)
- return BOUNTY_STYLE_HEALTH_SHOTGUN
- if(BOUNTY_STYLE_CLUB)
- return BOUNTY_STYLE_HEALTH_CLUB
- if(BOUNTY_STYLE_BOTTLE)
- return BOUNTY_STYLE_HEALTH_BOTTLE
- return 1
-
-/// How much stamina damage stamina-crits it: a meek criminal's pool, or anyone else's health
-/mob/living/basic/bounty_criminal/proc/body_stamina_pool()
- if(istype(src, /mob/living/basic/bounty_criminal/meek))
- return BOUNTY_MEEK_STAMINA
- return maxHealth
-
-/// Sets its stamina damage coefficient from its pool (max_stamina / pool), times its style's. A mini-boss's is P4's.
-/mob/living/basic/bounty_criminal/proc/body_update_stamina_coeff()
- if(istype(src, /mob/living/basic/bounty_criminal/boss))
- return
- var/pool = body_stamina_pool()
- if(pool <= 0)
- return
- var/style_mult = record?.style == BOUNTY_STYLE_BRAWLER ? BOUNTY_STYLE_STAMINA_BRAWLER : 1
- damage_coeff[STAMINA] = style_mult * max_stamina / pool
+ wanted = BOUNTY_TOUGHNESS_MOST_WANTED
+ if(istype(src, /mob/living/carbon/human/npc/bounty_criminal/meek))
+ wanted = BOUNTY_TOUGHNESS_PETTY
+ if(wanted != npc_damage_taken)
+ set_npc_toughness(wanted)
/**
- * Gives it the same body as `other`: health, pace and stamina. For a trader-outpost decoy (P6), which
- * must be as tough and as quick as the fugitive it stands in for (AR-C6).
+ * Gives it the same toughness and pace as `other`: a trader-outpost decoy (P6) must be as hard to put
+ * down and as quick as the fugitive it stands in for (AR-C6). Its armour comes from its own clothes.
+ * The fugitive's chrome is part of its pace (a meek criminal's Slipwire), so the same pieces go into
+ * this body too, real chrome that an EMP stops and that burns out when it dies.
*/
-/mob/living/basic/bounty_criminal/proc/body_match(mob/living/basic/bounty_criminal/other)
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_match(mob/living/carbon/human/npc/bounty_criminal/other)
if(QDELETED(other) || other == src)
return
- // Copy raw stats before finalizing the inherited profile, never its scaled pool.
- var/datum/npc_spawn_context/context = npc_spawn_context
- if(!context || context.source_id != other.npc_spawn_context?.source_id)
- context = other.bounty_profile_context()
- if(npc_zone_applied)
- UnregisterSignal(src, COMSIG_PROJECTILE_FIRER_BEFORE_FIRE)
- melee_damage_lower = npc_zone_original_melee_lower
- melee_damage_upper = npc_zone_original_melee_upper
- npc_zone_applied = FALSE
- npc_zone_health_factor = 1
- npc_zone_damage_factor = 1
- npc_spawn_context = context
- maxHealth = other.npc_zone_applied ? other.npc_zone_original_max_health : other.maxHealth
- var/health_share = other.maxHealth > 0 ? other.health / other.maxHealth : 1
- setBruteLoss(maxHealth * (1 - health_share))
- updatehealth()
- context.bodies |= WEAKREF(src)
- context.finalize()
- set_varspeed(other.speed)
- damage_coeff[STAMINA] = other.damage_coeff[STAMINA]
- stamina_regen_time = other.stamina_regen_time
- if(max_stamina_slowdown != other.max_stamina_slowdown)
- // The same arguments make_stamina_slowable() added it with, or the element is not found.
- RemoveElement(/datum/element/basic_stamina_slowdown, minium_stamina_threshold = max_stamina / 3, maximum_stamina = max_stamina, maximum_slowdown = max_stamina_slowdown)
- max_stamina_slowdown = other.max_stamina_slowdown
- make_stamina_slowable()
-
-/// Decoys use the source's selected role before construction, including named boss bodies.
-/mob/living/basic/bounty_criminal/proc/bounty_profile_context()
- var/role = npc_zone_role || (npc_zone_boss_type(type) ? "boss" : npc_spawn_context?.role || "ordinary")
- return new /datum/npc_spawn_context(src, null, role)
+ if(npc_damage_taken != other.npc_damage_taken)
+ set_npc_toughness(other.npc_damage_taken)
+ if(move_intent != other.move_intent)
+ toggle_move_intent()
+ for(var/obj/item/organ/ware as anything in other.organs)
+ if(!ware.GetComponent(/datum/component/cyberware) || (locate(ware.type) in organs))
+ continue
+ npc_install_cyberware(ware.type)
// ===== THE SITE =====
@@ -317,7 +196,7 @@
* site's rectangle, or for a pirate ship the hull itself. A site with no rectangle to read gets a box
* around where it stands. With no site at all (an admin spawn) it has no leash.
*/
-/mob/living/basic/bounty_criminal/proc/body_set_site(atom/site)
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_set_site(atom/site)
body_site_ref = site ? WEAKREF(site) : null
site_bounds = bounty_site_bounds(site)
body_dock_top_y = bounty_site_dock_top(site)
@@ -356,17 +235,17 @@
return planet.get_dock_strip_top_y(level)
/// The overmap object of its site: the one it was spawned for, else its posting's
-/mob/living/basic/bounty_criminal/proc/body_site()
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_site()
var/obj/structure/overmap/site = body_site_ref?.resolve() || posting()?.site_ref?.resolve()
return (istype(site) && !QDELETED(site)) ? site : null
/// The pirate ship that is its site, if it is wanted aboard one
-/mob/living/basic/bounty_criminal/proc/body_site_ship()
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_site_ship()
var/obj/structure/overmap/ship/site_ship = body_site()
return istype(site_ship) ? site_ship : null
/// Whether it has a site to be leashed to
-/mob/living/basic/bounty_criminal/proc/body_has_site()
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_has_site()
return !!site_bounds || !!body_site_ship()
/**
@@ -374,7 +253,7 @@
* on), and not part of a ship, a hangar, a player outpost or a planet's dock strip that happens to lie
* inside that rectangle (H1). With no site, anywhere but those is.
*/
-/mob/living/basic/bounty_criminal/proc/body_on_site(turf/place)
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_on_site(turf/place)
place = get_turf(place)
if(!place || body_forbidden_turf(place))
return FALSE
@@ -386,14 +265,14 @@
return TRUE
/// Whether `place` is never its ground: a ship (other than the pirate ship it is wanted aboard), a hangar, a player outpost, or its planet's dock strip
-/mob/living/basic/bounty_criminal/proc/body_forbidden_turf(turf/place)
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_forbidden_turf(turf/place)
return !!body_hold(place) || body_on_dock_strip(place)
/**
* The ship, hangar or player outpost `place` is part of, or null: the pirate ship it is wanted aboard
* is its site, not a hold. A ship is known by its docking port, so every room aboard is one hold.
*/
-/mob/living/basic/bounty_criminal/proc/body_hold(turf/place)
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_hold(turf/place)
var/area/place_area = get_area(place)
if(istype(place_area, /area/shuttle))
var/obj/structure/overmap/ship/site_ship = body_site_ship()
@@ -406,22 +285,22 @@
return null
/// Whether `place` is on its planet's dock strip, where ships land (L1)
-/mob/living/basic/bounty_criminal/proc/body_on_dock_strip(turf/place)
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_on_dock_strip(turf/place)
if(isnull(body_dock_top_y) || !place)
return FALSE
return (!site_bounds || place.z == site_bounds[5]) && place.y <= body_dock_top_y
/// Whether it is at a trader outpost, wanted there or standing in one: there it fights only its grudge list (AR-C8)
-/mob/living/basic/bounty_criminal/proc/body_at_trader_outpost()
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_at_trader_outpost()
return posting()?.placement_kind == BOUNTY_PLACEMENT_TRADER_OUTPOST || istype(get_area(src), /area/voidcrew/trader_outpost)
/**
* Whether it may go onto `destination` by itself (AR-D2, AR-E1, L1): on its site (so never a ship, a
* hangar, a player outpost or a dock strip), never a lift alcove that would carry it off, and never
- * lava, a chasm or open space. P3 checks hiding spots and flight paths with it; its own steps are held
- * to it too (Move()).
+ * lava, a chasm or open space. P3 checks hiding spots and flight paths with it, and its AI's movement
+ * holds its own steps to it (body_move_allowed()).
*/
-/mob/living/basic/bounty_criminal/proc/leash_ok(turf/destination)
+/mob/living/carbon/human/npc/bounty_criminal/proc/leash_ok(turf/destination)
destination = get_turf(destination)
if(!destination || !body_on_site(destination))
return FALSE
@@ -430,23 +309,19 @@
return FALSE
return destination.can_cross_safely(src)
-// Its own steps stay on the leash (M3). Dragged, carried along, thrown or walked by a script, it goes where it is taken.
-/mob/living/basic/bounty_criminal/Move(atom/newloc, direct, glide_size_override)
- if(!body_move_allowed(newloc))
- return FALSE
- return ..()
-
-/// Whether a script is walking it on purpose: TRAIT_BOUNTY_SCRIPTED_MOVE, or godmode (P6's walk out to the lift)
-/mob/living/basic/bounty_criminal/proc/body_scripted()
- return HAS_TRAIT(src, TRAIT_BOUNTY_SCRIPTED_MOVE) || HAS_TRAIT(src, TRAIT_GODMODE)
+/// Whether a script is walking it on purpose (TRAIT_BOUNTY_SCRIPTED_MOVE), or it is walking out (the human NPC base's npc_walk_out())
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_scripted()
+ return HAS_TRAIT(src, TRAIT_BOUNTY_SCRIPTED_MOVE) || !isnull(npc_exit)
/**
- * Whether a step of its own onto `newloc` is allowed. Onto its leash, always. Off it from on it,
- * never. Already off it (woken aboard a ship, dragged off its site, carried somewhere), it may walk
- * about and back toward its site, but never into a hazard and never on into a ship, hangar or player
- * outpost other than the one it is already in (M3).
+ * Whether a step of its own onto `newloc` is allowed: the leash its AI's movement keeps to
+ * (/datum/ai_movement/jps/bounty, and any step the AI takes by hand). Onto its leash, always. Off it
+ * from on it, never. Already off it (woken aboard a ship, dragged off its site, carried somewhere), it
+ * may walk about and back toward its site, but never into a hazard and never on into a ship, hangar or
+ * player outpost other than the one it is already in (M3). Its body is never held back: anyone can drag,
+ * carry, throw or shove it anywhere.
*/
-/mob/living/basic/bounty_criminal/proc/body_move_allowed(atom/newloc)
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_move_allowed(atom/newloc)
if(!isturf(newloc) || !isturf(loc) || pulledby || buckled || throwing || stat == DEAD || body_scripted())
return TRUE
var/turf/destination = newloc
@@ -463,7 +338,7 @@
* BOUNTY_ENV_SAFE_RANGE tiles of a ship (other than the pirate ship it is aboard), a hangar, a player
* outpost or a planet's dock strip.
*/
-/mob/living/basic/bounty_criminal/proc/environment_damage_allowed(turf/target_turf)
+/mob/living/carbon/human/npc/bounty_criminal/proc/environment_damage_allowed(turf/target_turf)
target_turf = get_turf(target_turf)
if(!target_turf || !body_on_site(target_turf) || body_at_trader_outpost())
return FALSE
@@ -482,15 +357,16 @@
// ===== WHO IT FIGHTS =====
/**
- * Whether it may attack `target` (AR-D1, AR-C8, C4). Never while down, restrained or surrendered,
- * never someone who is down, and never its own side. Off its site, and anywhere at a trader outpost,
- * only those on its grudge list, and no structures. On its site it may break structures that are on
- * its site and not part of a ship, a hangar or an outpost. Its melee and ranged attacks are held to it.
+ * Whether it may attack `target` (AR-D1, AR-C8, C4). Never while it can't fight (dead, in crit,
+ * restrained, lying there with its hands on its head after giving up), and never someone who is down,
+ * or its own side. Off its site, and anywhere at a trader outpost, only those on its grudge list, and no
+ * structures. On its site it may break structures that are on its site and not part of a ship, a hangar
+ * or an outpost. Its AI's targeting is held to it.
*/
-/mob/living/basic/bounty_criminal/proc/may_attack(atom/target)
+/mob/living/carbon/human/npc/bounty_criminal/proc/may_attack(atom/target)
if(QDELETED(target) || target == src)
return FALSE
- if(stat != CONSCIOUS || downed || is_restrained() || HAS_TRAIT(src, TRAIT_BOUNTY_SURRENDERED))
+ if(stat != CONSCIOUS || is_downed() || is_restrained() || npc_surrendering)
return FALSE
return may_attack_scope(target)
@@ -500,7 +376,7 @@
* grudge list off its site and at a trader outpost, structures only on its own ground. Its
* companions go by this alone, so they fight on when it is down, cuffed, dead or has given up.
*/
-/mob/living/basic/bounty_criminal/proc/may_attack_scope(atom/target)
+/mob/living/carbon/human/npc/bounty_criminal/proc/may_attack_scope(atom/target)
if(QDELETED(target) || target == src)
return FALSE
// A ship, hangar, outpost or dock strip inside the site's rectangle is not its site (H1)
@@ -520,15 +396,19 @@
var/turf/target_turf = get_turf(target)
return body_on_site(target_turf) && !body_forbidden_turf(target_turf)
for(var/mob/living/person as anything in people)
- if(person.stat != CONSCIOUS || istype(person, /mob/living/basic/bounty_criminal) || istype(person, /mob/living/basic/bounty_companion))
+ if(person.stat != CONSCIOUS || bounty_is_gang_body(person))
continue
if(!limited || body_has_grudge(person))
return TRUE
return FALSE
+/// Whether `thing` is a bounty criminal or a companion: never on anyone's grudge list, never counted as a player
+/proc/bounty_is_gang_body(atom/thing)
+ return istype(thing, /mob/living/carbon/human/npc/bounty_criminal) || istype(thing, /mob/living/carbon/human/npc/bounty_companion)
+
/// Remembers `who` as someone it may fight anywhere: they attacked it, confronted it or cuffed it. P3 calls it when someone confronts it.
-/mob/living/basic/bounty_criminal/proc/body_add_grudge(mob/living/who)
- if(!isliving(who) || who == src || istype(who, /mob/living/basic/bounty_criminal) || istype(who, /mob/living/basic/bounty_companion))
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_add_grudge(mob/living/who)
+ if(!isliving(who) || who == src || bounty_is_gang_body(who))
return
var/datum/weakref/who_ref = WEAKREF(who)
if(who_ref in grudge)
@@ -538,26 +418,25 @@
grudge.Cut(1, 2)
/// Whether `who` is on its grudge list
-/mob/living/basic/bounty_criminal/proc/body_has_grudge(mob/living/who)
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_has_grudge(mob/living/who)
return !isnull(who?.weak_reference) && (who.weak_reference in grudge)
-// Its own fists follow may_attack().
-/mob/living/basic/bounty_criminal/early_melee_attack(atom/target, list/modifiers, ignore_cooldown = FALSE)
- if(!may_attack(target))
- return FALSE
- return ..()
+// Bounty NPCs never land a gun execution this phase: a boss's deliberate, telegraphed execution (OC-9)
+// isn't built yet, and an accidental point-blank head shot must not stand in for it. Aimed crits still
+// follow npc_rank (D4).
+/mob/living/carbon/human/npc/bounty_criminal/hv_can_execute()
+ return !!client
// ===== CAPTURE STATE =====
/**
- * What the pad pays on (BOUNTY_STATE_*), checked in order (AR-A3): dead; downed (even if cuffed or
- * healed); restrained with its own restraints; stunned (stamina crit, knocked down, stunned,
- * paralysed, unconscious, or surrendered); free.
+ * What the pad pays on (BOUNTY_STATE_*), read from tg in this order (AR-A3): dead; in crit, soft or hard,
+ * even if cuffed; restrained; stunned; free. The pad reads it once, at the press.
*/
-/mob/living/basic/bounty_criminal/proc/capture_state()
+/mob/living/carbon/human/npc/bounty_criminal/proc/capture_state()
if(stat == DEAD)
return BOUNTY_STATE_DEAD
- if(downed)
+ if(is_downed())
return BOUNTY_STATE_DOWNED
if(is_restrained())
return BOUNTY_STATE_RESTRAINED
@@ -565,17 +444,20 @@
return BOUNTY_STATE_STUNNED
return BOUNTY_STATE_FREE
-/// Whether it is down and alive: floored and harmless until it recovers
-/mob/living/basic/bounty_criminal/proc/is_downed()
- return downed && stat != DEAD
+/// Whether it is alive and in crit (tg's TRAIT_CRITICAL_CONDITION: soft or hard crit)
+/mob/living/carbon/human/npc/bounty_criminal/proc/is_downed()
+ return stat != DEAD && HAS_TRAIT(src, TRAIT_CRITICAL_CONDITION)
-/// Whether its own restraints are on it
-/mob/living/basic/bounty_criminal/proc/is_restrained()
- return !QDELETED(restraints) && restraints.loc == src
+/// Whether it is restrained: tg's handcuffs, cable or zipties, or a straitjacket
+/mob/living/carbon/human/npc/bounty_criminal/proc/is_restrained()
+ return HAS_TRAIT(src, TRAIT_RESTRAINED)
-/// Whether it is stunned: stamina crit, knocked down, stunned, paralysed, out cold, or surrendered (TRAIT_BOUNTY_SURRENDERED)
-/mob/living/basic/bounty_criminal/proc/body_is_stunned()
- if(HAS_TRAIT(src, TRAIT_BOUNTY_SURRENDERED) || has_status_effect(/datum/status_effect/incapacitating/stamcrit))
+/**
+ * Whether it is stunned: stamina crit, knocked down, stunned, paralysed (tg's *surrender is a 20 second
+ * paralysis), unconscious or asleep (a sedative dart counts).
+ */
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_is_stunned()
+ if(stat == UNCONSCIOUS || has_status_effect(/datum/status_effect/incapacitating/stamcrit))
return TRUE
return IsKnockdown() || IsStun() || IsParalyzed() || IsUnconscious() || IsSleeping()
@@ -590,192 +472,49 @@
return 3
return 4
-/// Records its capture state in worst_state if it is as bad or worse: once downed or dead, it never gets better (spec 12.1)
-/mob/living/basic/bounty_criminal/proc/body_note_state()
- var/state = capture_state()
- if(state != BOUNTY_STATE_FREE)
- posting()?.board_note_work_zone(src)
- if(bounty_state_rank(state) <= bounty_state_rank(worst_state))
- worst_state = state
-
/**
- * Carries a worst state over from an earlier copy of this criminal (M4): P5 respawns the same record
- * when its site loads again, and pay must not forget that it was downed or killed before. Only ever
- * makes worst_state worse. Returns the worst state now.
+ * Something about its state may have changed (stat, crit, cuffs, a stun): the first catch or death
+ * binds the zone the bounty's reputation counts in. Nothing else is remembered; the pad reads the
+ * body when it is pressed.
*/
-/mob/living/basic/bounty_criminal/proc/body_restore_worst_state(state)
- if(state && bounty_state_rank(state) < bounty_state_rank(worst_state))
- worst_state = state
- return worst_state
-
-/// Something about its state changed: worst_state, and whether it can be dragged or carried
-/mob/living/basic/bounty_criminal/proc/body_state_changed()
- body_note_state()
- body_update_drag()
- body_update_carry()
-
-/mob/living/basic/bounty_criminal/set_stat(new_stat)
- . = ..()
- body_state_changed()
-
-/mob/living/basic/bounty_criminal/on_floored_trait_gain(datum/source)
- . = ..()
- body_state_changed()
-
-/mob/living/basic/bounty_criminal/on_floored_trait_loss(datum/source)
- . = ..()
- body_state_changed()
-
-/mob/living/basic/bounty_criminal/on_incapacitated_trait_gain(datum/source)
- . = ..()
- body_state_changed()
-
-/mob/living/basic/bounty_criminal/on_incapacitated_trait_loss(datum/source)
- . = ..()
- body_state_changed()
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_state_changed()
+ if(capture_state() != BOUNTY_STATE_FREE)
+ posting()?.board_note_work_zone(src)
-// ===== DRAGGING =====
+// ===== WHAT IT SAYS =====
-/**
- * Whether it can be dragged: dead, downed, restrained or stunned. Blending in at a trader outpost it
- * shakes off any hand until it is down or cuffed (AR-C7), the same for the fugitive and its decoys.
- * Free and on its feet it pulls away.
- */
-/mob/living/basic/bounty_criminal/proc/body_can_be_dragged()
- if(stat == DEAD || downed || is_restrained())
- return TRUE
- if(blended)
- return FALSE
- return body_is_stunned()
-
-/// Too heavy to shove while free; ordinary once it can be dragged. Anyone dragging it loses their grip when it can't be.
-/mob/living/basic/bounty_criminal/proc/body_update_drag()
- var/draggable = body_can_be_dragged()
- move_resist = draggable ? MOVE_RESIST_DEFAULT : MOVE_FORCE_VERY_STRONG
- if(draggable || !pulledby)
- return
- visible_message(span_warning("[src] pulls free of [pulledby]."))
- pulledby.stop_pulling()
-
-/mob/living/basic/bounty_criminal/can_be_pulled(user, force)
- if(!body_can_be_dragged())
- // P3 REVIEW ROUND (L1): the pull attempt is still announced before it is refused, so P3 hears
- // it (pulling at a hider finds it) and P6's blend hooks see it. A hider shows no balloon: it
- // is being found instead.
- SEND_SIGNAL(src, COMSIG_ATOM_CAN_BE_PULLED, user)
- if(ismob(user) && !hidden)
- balloon_alert(user, "[p_they()] pull[p_s()] away!")
+// The human NPC base's reactions (human_npc_barks.dm) speak the criminal's own lines (strings/bounty_criminals.json).
+/mob/living/carbon/human/npc/bounty_criminal/npc_bark(kind, force = FALSE)
+ if(QDELETED(src) || !istext(kind))
return FALSE
- body_update_drag()
- return ..()
-
-// ===== CARRYING =====
-
-/// Whether someone can lift it over their shoulders (a fireman carry): on the floor, and in a state to be dragged
-/mob/living/basic/bounty_criminal/proc/body_can_be_carried()
- return body_position == LYING_DOWN && body_can_be_dragged()
-
-/// Carried, and no longer in a state to be dragged (it came round, or got up): it gets off whoever is carrying it
-/mob/living/basic/bounty_criminal/proc/body_update_carry()
- if(!ishuman(buckled) || body_can_be_dragged())
- return
- var/mob/living/carrier = buckled
- carrier.unbuckle_mob(src, force = TRUE)
- visible_message(span_warning("[src] squirms off [carrier]'s shoulders."))
-
-/**
- * Turns `body` flat when it lies down out of a chair or off someone's shoulders (set_lying_down()).
- * tg turns only carbons there (/mob/living/carbon/on_lying_down()); any other mob gets its angle from
- * on_floored_start(), which is skipped while a chair holds it up. Without this, a criminal or a goon
- * unbuckled while down or dead lies down but still looks like it is standing.
- */
-/proc/bounty_body_lie_flat(mob/living/body, new_lying_angle)
- if(!body.rotate_on_lying || body.body_position != LYING_DOWN || body.lying_angle)
- return
- if(body.buckled && body.buckled.buckle_lying == 0)
- return
- body.set_lying_angle(new_lying_angle || pick(LYING_ANGLE_EAST, LYING_ANGLE_WEST))
+ // Crawling in soft crit it pleads with its downed lines.
+ if(kind == HUMAN_NPC_BARK_PLEAD)
+ kind = HUMAN_NPC_BARK_DOWNED
+ // The capture's moments are always heard, past the line cooldown (BUG-1): the cuffs go on moments after a fall.
+ if(kind == HUMAN_NPC_BARK_CUFFED)
+ force = TRUE
+ npc_last_bark = kind
+ INVOKE_ASYNC(src, TYPE_PROC_REF(/mob/living, bounty_say), kind, null, force)
+ return TRUE
-/mob/living/basic/bounty_criminal/set_lying_down(new_lying_angle)
+/mob/living/carbon/human/npc/bounty_criminal/npc_on_downed()
+ visible_message(span_danger("[src] collapses."))
. = ..()
- bounty_body_lie_flat(src, new_lying_angle)
-
-// A criminal lying on the floor can be carried like a person, as long as it can be dragged
-/mob/living/carbon/human/can_be_firemanned(mob/living/carbon/target)
- if(istype(target, /mob/living/basic/bounty_criminal))
- var/mob/living/basic/bounty_criminal/criminal = target
- return criminal.body_can_be_carried()
- return ..()
-
-// ===== DOWNED, MERCY AND RECOVERY =====
-
-/// Its health at the downed line
-/mob/living/basic/bounty_criminal/proc/body_downed_line()
- return maxHealth * BOUNTY_DOWNED_BELOW / 100
-
-// Every kind of damage a basic mob takes comes through here: the mercy rule and the automated floor hold it back.
-/mob/living/basic/bounty_criminal/adjust_health(amount, updating_health = TRUE, forced = FALSE)
- if(amount > 0 && !forced && stat != DEAD)
- amount = body_allowed_damage(amount)
- return ..(amount, updating_health, forced)
-
-/**
- * How much of `amount` damage gets through. On its feet (stamina crit counts), a hit stops at 1 under
- * the downed line: the rest is dropped. On its site, damage with no mind behind it stops at
- * BOUNTY_AUTOMATED_FLOOR percent. Down, its own side's blows miss it entirely. Anything else gets through.
- */
-/mob/living/basic/bounty_criminal/proc/body_allowed_damage(amount)
- var/datum/component/bounty_body/ledger = GetComponent(/datum/component/bounty_body)
- var/player_hit = ledger?.player_hit_now()
- if(downed && !player_hit && ledger?.own_side_hit_now())
- return 0
- var/floor = downed ? 0 : body_downed_line() - 1
- if(!player_hit && body_has_site() && body_on_site(get_turf(src)))
- floor = max(floor, maxHealth * BOUNTY_AUTOMATED_FLOOR / 100)
- var/health_left = maxHealth - bruteloss
- if(health_left - amount >= floor)
- return amount
- return max(0, health_left - floor)
-
-// An explosion names no attacker; the ledger works out whose it was before the blast lands (M1).
-/mob/living/basic/bounty_criminal/ex_act(severity, target, origin)
- var/datum/component/bounty_body/ledger = GetComponent(/datum/component/bounty_body)
- ledger?.note_explosion(origin)
- return ..()
+ body_state_changed()
+ SEND_SIGNAL(src, COMSIG_BOUNTY_CRIMINAL_DOWNED)
-/mob/living/basic/bounty_criminal/updatehealth()
+/mob/living/carbon/human/npc/bounty_criminal/npc_on_recovered()
+ if(stat == CONSCIOUS && !is_restrained())
+ visible_message(span_warning("[src] gets back up."))
. = ..()
- body_check_downed()
-
-/// Downs it once its health reaches the downed line
-/mob/living/basic/bounty_criminal/proc/body_check_downed()
- if(downed || stat == DEAD || QDELETED(src) || health > body_downed_line())
- return
- body_go_down()
-
-/// Down: floored, harmless, draggable, its AI paused, and its recovery clock running. The line is forced: it is the moment the fight ends (BUG-1).
-/mob/living/basic/bounty_criminal/proc/body_go_down()
- downed = TRUE
- body_recovery_due = FALSE
- body_rally_until = 0
- deltimer(body_rally_timer)
- body_rally_timer = null
- add_traits(list(TRAIT_FLOORED, TRAIT_INCAPACITATED, TRAIT_IMMOBILIZED), BOUNTY_BODY_DOWNED_TRAIT)
- body_update_held()
- ai_controller?.CancelActions()
- if(pulling)
- stop_pulling()
- body_start_recovery()
body_state_changed()
- visible_message(span_danger("[src] collapses."))
- SEND_SIGNAL(src, COMSIG_BOUNTY_CRIMINAL_DOWNED)
- INVOKE_ASYNC(src, TYPE_PROC_REF(/mob/living, bounty_say), "downed", null, TRUE)
+ SEND_SIGNAL(src, COMSIG_BOUNTY_CRIMINAL_RECOVERED)
/**
* Floats `text` over it for every hunter who can see it (bounty_ai_is_hunter()), and nobody else.
* Kept in body_last_alert. Returns how many hunters saw it.
*/
-/mob/living/basic/bounty_criminal/proc/body_alert_hunters(text)
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_alert_hunters(text)
. = 0
body_last_alert = text
for(var/mob/living/viewer in get_hearers_in_view(DEFAULT_MESSAGE_RANGE, src, RECURSIVE_CONTENTS_CLIENT_MOBS))
@@ -784,130 +523,19 @@
balloon_alert(viewer, text)
.++
-/// Restrained or down, its AI plans nothing: TRAIT_BOUNTY_HELD for P3's controller, and TRAIT_AI_PAUSED
-/mob/living/basic/bounty_criminal/proc/body_update_held()
- if(downed || is_restrained())
- add_traits(list(TRAIT_BOUNTY_HELD, TRAIT_AI_PAUSED), BOUNTY_BODY_HELD_TRAIT)
- else
- remove_traits(list(TRAIT_BOUNTY_HELD, TRAIT_AI_PAUSED), BOUNTY_BODY_HELD_TRAIT)
-
-/// How long it stays down: meek, normal or mini-boss
-/mob/living/basic/bounty_criminal/proc/body_recovery_time()
- if(istype(src, /mob/living/basic/bounty_criminal/boss))
- return BOUNTY_RECOVER_TIME_BOSS
- if(istype(src, /mob/living/basic/bounty_criminal/meek))
- return BOUNTY_RECOVER_TIME_MEEK
- return BOUNTY_RECOVER_TIME_NORMAL
-
-/// (Re)starts its recovery clock from the top: on going down, and on every stamina hit while down, cuffed or not (L4)
-/mob/living/basic/bounty_criminal/proc/body_start_recovery()
- deltimer(body_recovery_timer)
- body_stirring = FALSE
- body_recovery_due = FALSE
- body_recovery_timer = addtimer(CALLBACK(src, PROC_REF(body_stir)), max(0, body_recovery_time() - BOUNTY_BODY_STIRRING_TELL), TIMER_STOPPABLE | TIMER_DELETE_ME)
-
-/// Stops its recovery clock
-/mob/living/basic/bounty_criminal/proc/body_cancel_recovery()
- deltimer(body_recovery_timer)
- body_recovery_timer = null
- body_stirring = FALSE
-
-/// The tell before it gets up: it groans and tries to rise, and is up BOUNTY_BODY_STIRRING_TELL later. Cuffed, it waits for the cuffs to come off.
-/mob/living/basic/bounty_criminal/proc/body_stir()
- body_recovery_timer = null
- if(!downed || stat == DEAD || QDELETED(src))
- return
- if(is_restrained())
- body_recovery_due = TRUE
- return
- body_stirring = TRUE
- visible_message(span_warning("[src] groans and tries to get up."))
- Shake(1, 0, 0.5 SECONDS)
- body_recovery_timer = addtimer(CALLBACK(src, PROC_REF(body_stand_up)), BOUNTY_BODY_STIRRING_TELL, TIMER_STOPPABLE | TIMER_DELETE_ME)
-
-/**
- * Up again at BOUNTY_RECOVER_TO percent of its health, or more if it was healed while down. A
- * mini-boss rallies. Cuffed, it stays down until the cuffs come off (C1). Returns TRUE if it got up.
- */
-/mob/living/basic/bounty_criminal/proc/body_stand_up()
- body_recovery_timer = null
- body_stirring = FALSE
- if(!downed || stat == DEAD || QDELETED(src))
- return FALSE
- if(is_restrained())
- body_recovery_due = TRUE
- return FALSE
- var/stand_health = maxHealth * BOUNTY_RECOVER_TO / 100
- var/health_now = maxHealth - bruteloss
- if(health_now < stand_health)
- adjust_health(health_now - stand_health, forced = TRUE)
- downed = FALSE
- body_recovery_due = FALSE
- remove_traits(list(TRAIT_FLOORED, TRAIT_INCAPACITATED, TRAIT_IMMOBILIZED), BOUNTY_BODY_DOWNED_TRAIT)
- body_update_held()
- var/rally = body_rally_time()
- if(rally > 0)
- body_rally_until = world.time + rally
- deltimer(body_rally_timer)
- body_rally_timer = addtimer(CALLBACK(src, PROC_REF(body_end_rally)), rally, TIMER_STOPPABLE | TIMER_DELETE_ME)
- body_state_changed()
- visible_message(span_warning("[src] gets back up."))
- SEND_SIGNAL(src, COMSIG_BOUNTY_CRIMINAL_RECOVERED)
- INVOKE_ASYNC(src, TYPE_PROC_REF(/mob/living, bounty_say), "recover")
- return TRUE
+// ===== DEATH AND PROOF =====
-/// How long it rallies after getting up: a mini-boss only (C1). P4 may override it per kit.
-/mob/living/basic/bounty_criminal/proc/body_rally_time()
- return istype(src, /mob/living/basic/bounty_criminal/boss) ? BOUNTY_BODY_RALLY_TIME : 0
-
-/// Whether it is rallying after getting up: stamina does nothing, and it won't surrender (P3)
-/mob/living/basic/bounty_criminal/proc/body_is_rallying()
- return world.time < body_rally_until
-
-/// The rally is over: stamina works on it again, as far as its tiredness lets it (P4's boss_update_tired())
-/mob/living/basic/bounty_criminal/proc/body_end_rally()
- body_rally_timer = null
- body_rally_until = 0
- if(QDELETED(src) || stat == DEAD)
- return
- boss_update_tired(force = TRUE)
-
-/**
- * A mini-boss re-reads how tired it is: its stamina coefficient and stun flags (P4). Nothing for
- * anyone else. P4 overrides it on /boss; the override must not repeat the `proc/` keyword.
- */
-/mob/living/basic/bounty_criminal/proc/boss_update_tired(silent = FALSE, force = FALSE)
- return
-
-// A stamina hit while it is down starts its recovery over; rallying, it shrugs stamina off.
-/mob/living/basic/bounty_criminal/adjustStaminaLoss(amount, updating_stamina = TRUE, forced = FALSE, required_biotype)
- if(amount > 0 && !forced && stat != DEAD)
- if(body_is_rallying())
- return 0
- if(downed)
- body_start_recovery()
- return ..()
-
-// ===== DEATH =====
-
-// The body stays as proof; the cuffs come off it.
-/mob/living/basic/bounty_criminal/death(gibbed)
- body_cancel_recovery()
+// The body stays as proof. Fallen into a chasm, it is in the chasm's depths for good: P5 puts the proof on
+// safe ground beside the chasm (get_turf() here is the chasm itself).
+/mob/living/carbon/human/npc/bounty_criminal/death(gibbed)
. = ..()
- if(QDELETED(src))
+ if(QDELETED(src) || stat != DEAD)
return
- body_remove_cuffs()
body_state_changed()
- // Fallen into a chasm: the body is in the chasm's depths for good. P5 puts the proof on safe ground
- // beside the chasm (get_turf() here is the chasm itself).
if(istype(loc, /obj/effect/abstract/chasm_storage) && body_leaves_proof())
body_drop_proof()
-// Nothing brings it back: dead is the dead share (AR-A5).
-/mob/living/basic/bounty_criminal/can_be_revived()
- return FALSE
-
-/mob/living/basic/bounty_criminal/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change = TRUE)
+/mob/living/carbon/human/npc/bounty_criminal/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change = TRUE)
. = ..()
body_set_holder(isturf(loc) ? null : loc)
// A body dragged into a chasm is gone for good too; P5 puts the proof beside it.
@@ -917,9 +545,11 @@
/**
* Keeps whatever holds it (`holder`, the outermost thing it is inside, or null on a turf) from being
* teleported while it is inside (M2): a ship's transporter can't beam up a locker, crate or body bag
- * with a criminal in it, any more than the criminal itself. Moves the block when it changes hands.
+ * with a criminal in it, any more than the criminal itself, and a person carrying a folded body bag
+ * with one inside can't teleport with it. Moves the block when it changes hands. (Carried over the
+ * shoulders it isn't inside anyone: it stands on the carrier's tile.)
*/
-/mob/living/basic/bounty_criminal/proc/body_set_holder(atom/movable/holder)
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_set_holder(atom/movable/holder)
while(ismovable(holder?.loc))
holder = holder.loc
var/atom/movable/old_holder = body_holder_ref?.resolve()
@@ -938,7 +568,7 @@
* no proof. P5 marks removals with TRAIT_BOUNTY_REMOVED instead (the pad, closing, relisting, a site
* unloading); this is for anything else that takes a criminal away on purpose.
*/
-/mob/living/basic/bounty_criminal/proc/body_mark_removed()
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_mark_removed()
body_removed = TRUE
/**
@@ -946,171 +576,55 @@
* first; a live one deleted is never a death, M5), not removed on purpose, and its posting still open.
* P5's bounty_drop_proof() makes the final call (a site unloading, a relist) and places the proof.
*/
-/mob/living/basic/bounty_criminal/proc/body_leaves_proof()
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_leaves_proof()
if(stat != DEAD || body_removed || body_proof_dropped || HAS_TRAIT(src, TRAIT_BOUNTY_REMOVED))
return FALSE
var/datum/criminal_bounty/wanted_on = posting()
return wanted_on?.status == BOUNTY_POSTING_OPEN
/// Leaves proof of death through P5's bounty_drop_proof(), once
-/mob/living/basic/bounty_criminal/proc/body_drop_proof()
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_drop_proof()
body_proof_dropped = TRUE
bounty_drop_proof(src)
-// ===== LOOKS =====
-
-/// Puts its look on: its record's face in the outfit for its archetype and zone. Sleeps.
-/mob/living/basic/bounty_criminal/proc/body_dress()
- var/outfit = bounty_outfit()
- if(record)
- apply_bounty_look(src, record, outfit)
- else
- set_outpost_npc_look(src, outfit, gender, 1)
- if(QDELETED(src))
- return
- update_appearance(UPDATE_OVERLAYS)
-
-/// The outfit it wears: a mini-boss its kit's (boss_kit_outfit(), P4), anyone else plain clothes for their archetype and the zone of their site
-/mob/living/basic/bounty_criminal/proc/bounty_outfit()
- if(istype(src, /mob/living/basic/bounty_criminal/boss))
- return boss_kit_outfit() || boss_outfit()
- var/meek = istype(src, /mob/living/basic/bounty_criminal/meek)
- switch(body_zone())
- if(ZONE_RED)
- return meek ? /datum/outfit/bounty_criminal/drifter : /datum/outfit/bounty_criminal/tough
- if(ZONE_YELLOW)
- return meek ? /datum/outfit/bounty_criminal/spacer : /datum/outfit/bounty_criminal/hauler
- return meek ? /datum/outfit/bounty_criminal : /datum/outfit/bounty_criminal/local
-
-/// A mini-boss's kit outfit, or null. P4 overrides it on /boss; the override must not repeat the `proc/` keyword.
-/mob/living/basic/bounty_criminal/proc/boss_kit_outfit()
- return null
-
-/// What a mini-boss wears when its kit has no outfit: plain rough clothes
-/mob/living/basic/bounty_criminal/proc/boss_outfit()
- return /datum/outfit/bounty_criminal/tough
-
-/// ZONE_GREEN, ZONE_YELLOW or ZONE_RED for where its site is (or where it stands), green if unknown
-/mob/living/basic/bounty_criminal/proc/body_zone()
- var/atom/site = body_site_ref?.resolve()
- var/zone = site ? SSovermap_zones?.get_zone_type(get_turf(site)) : SSovermap_zones?.get_zone_type_anywhere(get_turf(src))
- return zone || ZONE_GREEN
-
-/mob/living/basic/bounty_criminal/update_overlays()
- . = ..()
- if(is_restrained() && !hidden)
- // tg's own cuff overlay, as people wear it
- . += mutable_appearance('icons/mob/simple/mob.dmi', "handcuff1")
-
-/// Plain clothes for a meek criminal in green space
-/datum/outfit/bounty_criminal
- name = "Bounty criminal: civilian"
- uniform = /obj/item/clothing/under/pants/jeans
- suit = /obj/item/clothing/suit/toggle/jacket/sweater
- shoes = /obj/item/clothing/shoes/sneakers/brown
-
-/// A meek criminal in yellow space
-/datum/outfit/bounty_criminal/spacer
- name = "Bounty criminal: spacer"
- uniform = /obj/item/clothing/under/color/grey
- suit = /obj/item/clothing/suit/jacket/bomber
- shoes = /obj/item/clothing/shoes/workboots
- head = /obj/item/clothing/head/beanie
-
-/// A meek criminal in red space
-/datum/outfit/bounty_criminal/drifter
- name = "Bounty criminal: drifter"
- uniform = /obj/item/clothing/under/color/black
- suit = /obj/item/clothing/suit/jacket/leather
- shoes = /obj/item/clothing/shoes/jackboots
- head = /obj/item/clothing/head/soft/grey
-
-/// A normal criminal in green space
-/datum/outfit/bounty_criminal/local
- name = "Bounty criminal: local"
- uniform = /obj/item/clothing/under/costume/buttondown/slacks
- suit = /obj/item/clothing/suit/jacket/letterman
- shoes = /obj/item/clothing/shoes/sneakers/black
-
-/// A normal criminal in yellow space
-/datum/outfit/bounty_criminal/hauler
- name = "Bounty criminal: hauler"
- uniform = /obj/item/clothing/under/pants/jeans
- suit = /obj/item/clothing/suit/jacket/miljacket
- gloves = /obj/item/clothing/gloves/fingerless
- shoes = /obj/item/clothing/shoes/workboots
-
-/// A normal criminal in red space, and the fallback for a mini-boss
-/datum/outfit/bounty_criminal/tough
- name = "Bounty criminal: tough"
- uniform = /obj/item/clothing/under/color/black
- suit = /obj/item/clothing/suit/jacket/leather/biker
- gloves = /obj/item/clothing/gloves/fingerless
- shoes = /obj/item/clothing/shoes/jackboots
-
// ===== EXAMINE =====
/**
- * How hurt it looks, its distinguishing features, and whether it is restrained, down or has given up.
- * Blending in, the fugitive and its decoys show one layout: how hurt, then the features. Hidden (a
- * disguise, a locker), it adds nothing.
+ * Its distinguishing features, and whether it has given up. How hurt it is, whether it is restrained
+ * and whether it is down are tg's own human examine. Hidden (a disguise, a locker), it adds nothing.
*/
-/mob/living/basic/bounty_criminal/examine(mob/user)
+/mob/living/carbon/human/npc/bounty_criminal/examine(mob/user)
. = ..()
if(hidden)
return
- if(stat != DEAD)
- . += body_health_line()
for(var/line in record?.feature_lines())
. += span_notice(line)
- if(blended || stat == DEAD)
+ if(blended || stat != CONSCIOUS)
return
- if(is_restrained())
- . += span_warning("[p_They()] [p_are()] restrained with [restraints].")
- if(downed)
- if(body_stirring)
- . += span_warning("[p_They()] [p_are()] trying to get up.")
- else
- . += span_notice("[p_They()] [p_are()] down.")
- else if(HAS_TRAIT(src, TRAIT_BOUNTY_SURRENDERED))
+ if(npc_surrendering && IsParalyzed())
. += span_notice("[p_They()] [p_have()] given up.")
-/// One line on how hurt it looks
-/mob/living/basic/bounty_criminal/proc/body_health_line()
- var/fraction = maxHealth > 0 ? health / maxHealth : 0
- if(fraction >= 0.9)
- return span_notice("[p_They()] look[p_s()] unhurt.")
- if(fraction >= 0.6)
- return span_warning("[p_They()] [p_have()] a few cuts and bruises.")
- if(fraction > BOUNTY_DOWNED_BELOW / 100)
- return span_warning("[p_They()] [p_are()] badly hurt.")
- return span_danger("[p_They()] [p_are()] barely conscious.")
-
-// ===== THE LEDGER AND THE BODY'S SIGNALS =====
+// ===== THE BODY'S SIGNALS =====
/**
- * Who has been hurting a criminal, and the rest of the body's signal hooks, kept on a component so the
- * AI packages can register the same signals on the mob without clashing. The ledger (in the style of
- * experiment_damage_ledger) tells a hit with someone's mind behind it from one without, so turrets,
- * traps, fire and fauna can't finish off a criminal on its site (AR-D3), and puts attackers on its
- * grudge list. Damage and the attack report arrive in the same tick: a projectile's pre-hit and an item
- * attack's attackby come before the damage, so the tick's attacker is known when the damage lands.
- * It also refuses teleports, polymorph and type changes, lets a sprinting meek criminal duck shots,
- * holds ranged attacks to may_attack(), and stops a free criminal being dragged onto things.
+ * The body's own signal hooks, kept on a component so the AI packages can register the same signals on
+ * the mob without clashing:
+ * - who has been attacking it (tg's relay_attackers, an item's attackby, a projectile's firer, a mech's
+ * or a vehicle's pilot) goes on its grudge list;
+ * - teleports, polymorph and type changes are refused;
+ * - any change of tg state that capture_state() reads tells the body (body_state_changed());
+ * - a hunter reaching through the strip menu with a pressure suit or helmet for a slot its own locked piece
+ * fills may put theirs on instead (bounty_suits.dm, suits_strip_reach()).
*/
/datum/component/bounty_body
dupe_mode = COMPONENT_DUPE_UNIQUE
- /// world.time someone with a mind behind them last attacked it
- var/player_hit_at = -1
- /// world.time another criminal or a companion last attacked it
- var/own_side_hit_at = -1
/datum/component/bounty_body/Initialize()
- if(!istype(parent, /mob/living/basic/bounty_criminal))
+ if(!istype(parent, /mob/living/carbon/human/npc/bounty_criminal))
return COMPONENT_INCOMPATIBLE
/datum/component/bounty_body/RegisterWithParent()
- var/mob/living/basic/bounty_criminal/criminal = parent
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = parent
criminal.AddElement(/datum/element/relay_attackers)
RegisterSignal(criminal, COMSIG_ATOM_WAS_ATTACKED, PROC_REF(on_attacked))
RegisterSignal(criminal, COMSIG_ATOM_ATTACKBY, PROC_REF(on_attackby))
@@ -1118,11 +632,18 @@
RegisterSignal(criminal, COMSIG_MOVABLE_TELEPORTING, PROC_REF(refuse_teleport))
RegisterSignal(criminal, COMSIG_LIVING_PRE_WABBAJACKED, PROC_REF(refuse_polymorph))
RegisterSignal(criminal, COMSIG_PRE_MOB_CHANGED_TYPE, PROC_REF(refuse_type_change))
- RegisterSignal(criminal, COMSIG_BASICMOB_PRE_ATTACK_RANGED, PROC_REF(on_pre_ranged_attack))
- RegisterSignal(criminal, COMSIG_MOUSEDROP_ONTO, PROC_REF(on_mousedrop))
- RegisterSignals(criminal, list(SIGNAL_ADDTRAIT(TRAIT_BOUNTY_SURRENDERED), SIGNAL_REMOVETRAIT(TRAIT_BOUNTY_SURRENDERED)), PROC_REF(on_state_signal))
+ RegisterSignal(criminal, COMSIG_MOB_STATCHANGE, PROC_REF(on_state_signal))
+ RegisterSignals(criminal, list(
+ SIGNAL_ADDTRAIT(TRAIT_CRITICAL_CONDITION),
+ SIGNAL_REMOVETRAIT(TRAIT_CRITICAL_CONDITION),
+ SIGNAL_ADDTRAIT(TRAIT_FLOORED),
+ SIGNAL_REMOVETRAIT(TRAIT_FLOORED),
+ SIGNAL_ADDTRAIT(TRAIT_INCAPACITATED),
+ SIGNAL_REMOVETRAIT(TRAIT_INCAPACITATED),
+ ), PROC_REF(on_state_signal))
// A stun's traits land before the stun is on its list, so the trait handlers alone would miss it.
RegisterSignals(criminal, list(COMSIG_LIVING_STATUS_APPLIED, COMSIG_LIVING_STATUS_REMOVED), PROC_REF(on_state_signal))
+ RegisterSignal(criminal, COMSIG_BEING_STRIPPED, PROC_REF(on_being_stripped))
/datum/component/bounty_body/UnregisterFromParent()
UnregisterSignal(parent, list(
@@ -1132,29 +653,21 @@
COMSIG_MOVABLE_TELEPORTING,
COMSIG_LIVING_PRE_WABBAJACKED,
COMSIG_PRE_MOB_CHANGED_TYPE,
- COMSIG_BASICMOB_PRE_ATTACK_RANGED,
- COMSIG_MOUSEDROP_ONTO,
- SIGNAL_ADDTRAIT(TRAIT_BOUNTY_SURRENDERED),
- SIGNAL_REMOVETRAIT(TRAIT_BOUNTY_SURRENDERED),
+ COMSIG_MOB_STATCHANGE,
+ SIGNAL_ADDTRAIT(TRAIT_CRITICAL_CONDITION),
+ SIGNAL_REMOVETRAIT(TRAIT_CRITICAL_CONDITION),
+ SIGNAL_ADDTRAIT(TRAIT_FLOORED),
+ SIGNAL_REMOVETRAIT(TRAIT_FLOORED),
+ SIGNAL_ADDTRAIT(TRAIT_INCAPACITATED),
+ SIGNAL_REMOVETRAIT(TRAIT_INCAPACITATED),
COMSIG_LIVING_STATUS_APPLIED,
COMSIG_LIVING_STATUS_REMOVED,
+ COMSIG_BEING_STRIPPED,
))
-/// Whether someone with a mind behind them attacked it this tick
-/datum/component/bounty_body/proc/player_hit_now()
- return player_hit_at == world.time
-
-/// Whether its own side (another criminal, a companion) attacked it this tick
-/datum/component/bounty_body/proc/own_side_hit_now()
- return own_side_hit_at == world.time
-
-/// `attacker` went for it: noted for the ledger, and they go on its grudge list
+/// `attacker` went for it: they go on its grudge list (a vehicle's pilots for a vehicle)
/datum/component/bounty_body/proc/note_attacker(atom/attacker)
- var/mob/living/basic/bounty_criminal/criminal = parent
- if(bounty_player_behind(attacker))
- player_hit_at = world.time
- if(istype(attacker, /mob/living/basic/bounty_criminal) || istype(attacker, /mob/living/basic/bounty_companion))
- own_side_hit_at = world.time
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = parent
if(istype(attacker, /obj/vehicle/sealed))
var/obj/vehicle/sealed/vehicle = attacker
for(var/mob/living/pilot in vehicle.occupants)
@@ -1162,60 +675,35 @@
else if(isliving(attacker))
criminal.body_add_grudge(attacker)
-/**
- * An explosion is about to hit it (M1). ex_act() carries no attacker, so the blast counts as a
- * player's when the explosive was last handled by one (`origin`'s last fingerprints: a grenade
- * someone threw or set), or when someone with a mind stands within BOUNTY_EXPLOSION_WITNESS_RANGE
- * tiles. Anything else is automated, like fire.
- */
-/datum/component/bounty_body/proc/note_explosion(atom/origin)
- var/mob/living/basic/bounty_criminal/criminal = parent
- if(isatom(origin) && origin.fingerprintslast)
- player_hit_at = world.time
- return
- var/turf/here = get_turf(criminal)
- if(!here)
- return
- for(var/mob/living/person in range(BOUNTY_EXPLOSION_WITNESS_RANGE, here))
- if(bounty_player_behind(person))
- player_hit_at = world.time
- return
-
/datum/component/bounty_body/proc/on_attacked(datum/source, atom/attacker, attack_flags)
SIGNAL_HANDLER
if(!(attack_flags & (ATTACKER_DAMAGING_ATTACK | ATTACKER_STAMINA_ATTACK | ATTACKER_SHOVING)))
return
note_attacker(attacker)
-// Before an item's damage lands (relay_attackers only reports it after), so the ledger knows whose it is.
/datum/component/bounty_body/proc/on_attackby(datum/source, obj/item/attacking_item, mob/living/user, list/modifiers, list/attack_modifiers)
SIGNAL_HANDLER
if(attacking_item?.force > 0 || user?.combat_mode)
note_attacker(user)
-/// Whose shot it is, even a mech's or a vehicle's (relay_attackers only reports mobs, M1); and a sprinting meek criminal ducks some shots (C5), though one that gets through spoils the next second's dodging
+/// Whose shot it is, even a mech's or a vehicle's (relay_attackers only reports mobs, M1)
/datum/component/bounty_body/proc/on_projectile_prehit(datum/source, obj/projectile/shot)
SIGNAL_HANDLER
- var/mob/living/basic/bounty_criminal/criminal = parent
if(shot?.firer && shot.is_hostile_projectile())
note_attacker(shot.firer)
- if(prob(criminal.body_dodge_chance()))
- criminal.visible_message(span_warning("[criminal] ducks out of the way of [shot]!"))
- return PROJECTILE_INTERRUPT_HIT_PHASE
- criminal.body_last_shot_at = world.time
return NONE
/// The pad deletes a criminal; nothing teleports one (D-A10)
/datum/component/bounty_body/proc/refuse_teleport(datum/source, atom/destination, channel)
SIGNAL_HANDLER
- var/mob/living/basic/bounty_criminal/criminal = parent
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = parent
if(isturf(criminal.loc))
criminal.visible_message(span_notice("[criminal] flickers for a moment, but stays where [criminal.p_they()] [criminal.p_are()]."))
return TRUE
/datum/component/bounty_body/proc/refuse_polymorph(datum/source, what_to_randomize)
SIGNAL_HANDLER
- var/mob/living/basic/bounty_criminal/criminal = parent
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = parent
criminal.visible_message(span_notice("[criminal] shimmers for a moment, then looks the same as before."))
return STOP_WABBAJACK
@@ -1223,51 +711,36 @@
SIGNAL_HANDLER
return COMPONENT_BLOCK_MOB_CHANGE
-/datum/component/bounty_body/proc/on_pre_ranged_attack(datum/source, atom/target, modifiers)
+/// Its stat, crit, a stun, a knockdown or stamina crit came or went: its capture state may have changed
+/datum/component/bounty_body/proc/on_state_signal(datum/source)
SIGNAL_HANDLER
- var/mob/living/basic/bounty_criminal/criminal = parent
- if(!criminal.may_attack(target))
- return COMPONENT_CANCEL_RANGED_ATTACK
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = parent
+ if(!QDELING(criminal))
+ criminal.body_state_changed()
-/datum/component/bounty_body/proc/on_mousedrop(datum/source, atom/over, mob/user)
+/// Someone reaches for a piece of it through the strip menu: a hunter's pressure suit may go on in place of its own (bounty_suits.dm)
+/datum/component/bounty_body/proc/on_being_stripped(datum/source, mob/user, obj/item/item)
SIGNAL_HANDLER
- var/mob/living/basic/bounty_criminal/criminal = parent
- if(!criminal.body_can_be_dragged())
- return COMPONENT_CANCEL_MOUSEDROP_ONTO
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = parent
+ return criminal.suits_strip_reach(user, item)
-/// It surrendered or stopped, or a stun, knockdown or stamina crit came or went: its capture state may have changed
-/datum/component/bounty_body/proc/on_state_signal(datum/source)
- SIGNAL_HANDLER
- var/mob/living/basic/bounty_criminal/criminal = parent
- criminal.body_state_changed()
-
-/// The chance, in percent, that it ducks a shot now: a meek criminal sprinting freely (TRAIT_BOUNTY_SPRINTING, from P3), not shot in the last second
-/mob/living/basic/bounty_criminal/proc/body_dodge_chance()
- if(!istype(src, /mob/living/basic/bounty_criminal/meek) || !HAS_TRAIT(src, TRAIT_BOUNTY_SPRINTING))
- return 0
- if(stat != CONSCIOUS || downed || is_restrained() || !isturf(loc) || pulledby || buckled)
- return 0
- if(HAS_TRAIT(src, TRAIT_INCAPACITATED) || HAS_TRAIT(src, TRAIT_IMMOBILIZED) || HAS_TRAIT(src, TRAIT_FLOORED))
- return 0
- if(world.time - body_last_shot_at < BOUNTY_MEEK_DODGE_AFTER_HIT)
- return 0
- return BOUNTY_MEEK_DODGE
+// ===== TURRETS AND PLAYERS =====
/**
- * Whether a turret leaves `creature` alone for being part of a bounty (L2; hostile_creatures.dm).
+ * Whether a turret leaves `creature` alone for being part of a bounty (L2, AM-11; hostile_creatures.dm).
* `at_trader_outpost`: it stands in a trader outpost's concourse. There, criminals, decoys and
- * companions are left to the hunters (spec 4). Anywhere else a criminal is left alone only once it is
- * down, stunned, restrained or dead, so a crew's own turrets don't finish off their catch; a free one,
- * and any companion, is judged like any other creature.
+ * companions are left to the hunters (spec 4), unless an exposed fugitive hurt a bystander (P6's
+ * outpost_turret_target()). Anywhere else a criminal is left alone once it is in crit, stunned,
+ * restrained or dead (tg's states), so a crew's own turrets don't finish off their catch; a free one, and
+ * any companion, is judged like any other creature.
*/
/proc/bounty_turret_ignores(mob/living/creature, at_trader_outpost)
- var/mob/living/basic/bounty_criminal/criminal = creature
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = creature
if(istype(criminal))
- // At a trader outpost, turrets leave it alone unless an exposed fugitive hurt someone outside its grudge list (AR-C8, P6's outpost_turret_target()).
if(at_trader_outpost)
return !criminal.outpost_turret_target()
return criminal.capture_state() != BOUNTY_STATE_FREE
- return at_trader_outpost && istype(creature, /mob/living/basic/bounty_companion)
+ return at_trader_outpost && istype(creature, /mob/living/carbon/human/npc/bounty_companion)
/// Whether someone with a mind is behind `attacker`: a person, a borg, or the pilot of a mech or other vehicle. Criminals and their companions never count.
/proc/bounty_player_behind(atom/attacker)
@@ -1278,6 +751,6 @@
return TRUE
return FALSE
var/mob/living/person = attacker
- if(!istype(person) || istype(person, /mob/living/basic/bounty_criminal) || istype(person, /mob/living/basic/bounty_companion))
+ if(!istype(person) || bounty_is_gang_body(person))
return FALSE
return !isnull(person.mind) || !isnull(person.ckey)
diff --git a/voidcrew/modules/bounties/bounty_identity.dm b/voidcrew/modules/bounties/bounty_identity.dm
index 43e82826b77..8ed130ed47b 100644
--- a/voidcrew/modules/bounties/bounty_identity.dm
+++ b/voidcrew/modules/bounties/bounty_identity.dm
@@ -47,6 +47,8 @@ GLOBAL_LIST_INIT(bounty_species_weights, list(
*
* - No archetype: rolled from the tier (spec section 2).
* - A mini-boss is never placed at a trader outpost (D-A8): there it becomes a normal criminal.
+ * - A trader-outpost fugitive fights only in a style whose weapon it can hide while it passes as a
+ * customer (bounty_roll_style()).
* - At a trader outpost the record also gets an old look for its mugshot (make_old_look(), AR-C1).
* - `species` forces a species (tests, admins); otherwise it is rolled from the pool.
*
@@ -70,7 +72,7 @@ GLOBAL_LIST_INIT(bounty_species_weights, list(
if(BOUNTY_ARCHETYPE_MEEK)
record.style = BOUNTY_STYLE_HOLDOUT
if(BOUNTY_ARCHETYPE_NORMAL)
- record.style = bounty_roll_style()
+ record.style = bounty_roll_style(concealed = (placement_kind == BOUNTY_PLACEMENT_TRADER_OUTPOST))
if(BOUNTY_ARCHETYPE_BOSS)
record.kit = bounty_roll_kit()
record.alias = bounty_roll_alias(record)
@@ -90,17 +92,29 @@ GLOBAL_LIST_INIT(bounty_species_weights, list(
return prob(BOUNTY_WANTED_MEEK_CHANCE) ? BOUNTY_ARCHETYPE_MEEK : BOUNTY_ARCHETYPE_NORMAL
return prob(BOUNTY_PETTY_MEEK_CHANCE) ? BOUNTY_ARCHETYPE_MEEK : BOUNTY_ARCHETYPE_NORMAL
-/// A fighting style for a normal criminal, weighted
-/proc/bounty_roll_style()
+/**
+ * A fighting style for a normal criminal, weighted. `concealed`: only the styles whose weapon nobody sees
+ * while it is carried (the style's concealable), for a fugitive passing as a customer at a trader outpost.
+ */
+/proc/bounty_roll_style(concealed = FALSE)
var/static/list/weights = list(
- BOUNTY_STYLE_BRAWLER = 20,
- BOUNTY_STYLE_PISTOL = 20,
- BOUNTY_STYLE_KNIFE = 18,
- BOUNTY_STYLE_CLUB = 15,
- BOUNTY_STYLE_BOTTLE = 15,
- BOUNTY_STYLE_SHOTGUN = 12,
+ BOUNTY_STYLE_BRAWLER = 18,
+ BOUNTY_STYLE_PISTOL = 14,
+ BOUNTY_STYLE_KNIFE = 16,
+ BOUNTY_STYLE_CLUB = 14,
+ BOUNTY_STYLE_BOTTLE = 12,
+ BOUNTY_STYLE_SHOTGUN = 10,
+ BOUNTY_STYLE_SMG = 8,
+ BOUNTY_STYLE_REVOLVER = 8,
)
- return pick_weight(weights)
+ if(!concealed)
+ return pick_weight(weights)
+ var/list/hidden = list()
+ for(var/key in weights)
+ var/datum/bounty_style/style = GLOB.bounty_styles[key]
+ if(style?.concealable)
+ hidden[key] = weights[key]
+ return length(hidden) ? pick_weight(hidden) : BOUNTY_STYLE_BRAWLER
/// A mini-boss kit, weighted
/proc/bounty_roll_kit()
@@ -710,22 +724,22 @@ GLOBAL_LIST_INIT(bounty_species_weights, list(
/mob/living/proc/identity_line_values()
return null
-/mob/living/basic/bounty_criminal/identity_voice()
+/mob/living/carbon/human/npc/bounty_criminal/identity_voice()
// Blended in at a trader outpost, the fugitive talks exactly like its decoys (AR-C6).
if(blended)
return null
return record?.archetype
-/mob/living/basic/bounty_criminal/identity_line_values()
+/mob/living/carbon/human/npc/bounty_criminal/identity_line_values()
// A Most Wanted crime is no line to toss off ("All this over the Corvina Station massacre?").
if(!record?.crime || record.tier == BOUNTY_TIER_MOST_WANTED)
return null
return list("{crime}" = record.crime)
/// A decoy is an innocent patron: always the shared, neutral lines, whether or not it is blended in
-/mob/living/basic/bounty_criminal/decoy/identity_voice()
+/mob/living/carbon/human/npc/bounty_criminal/decoy/identity_voice()
return null
/// A decoy has no crime to own up to
-/mob/living/basic/bounty_criminal/decoy/identity_line_values()
+/mob/living/carbon/human/npc/bounty_criminal/decoy/identity_line_values()
return null
diff --git a/voidcrew/modules/bounties/bounty_kingpin.dm b/voidcrew/modules/bounties/bounty_kingpin.dm
index 29ab4fe6b61..21d3a97b198 100644
--- a/voidcrew/modules/bounties/bounty_kingpin.dm
+++ b/voidcrew/modules/bounties/bounty_kingpin.dm
@@ -21,32 +21,37 @@
* ckey), and anyone aboard for themselves, can never hunt him or turn him in, and his goons treat
* them as guests. One run at a time (the job's mission_limit, counting the one he holds). He won't
* hire drifters or crews who fought his people.
- * - His posting (/datum/criminal_bounty/kingpin): P5's posting with his own shares (alive 100%,
- * downed counts as alive, dead 80%), his own card lines and a clock that pauses during a shootout.
+ * - His posting (/datum/criminal_bounty/kingpin): P5's posting with his own shares (alive 100%
+ * however he is brought in, dead 80%), his own card lines and a clock that pauses during a shootout.
* It goes up only on the clock (no earlier than 45 minutes in with 3+ active ships, the next 60-90
* minutes after the last resolves) or from the admin panel; a shootout never puts him on the
* board. It adopts him wherever he is, alive (never a second body), so a crew that grabbed him
* early can turn him in once he is posted; with his crew at ease every empty goon post gets a new
- * goon. Killed before any posting, he is gone with nothing to claim, and his body fades. Closed
- * unclaimed (run out, withdrawn), it leaves him in the lounge, alive, uncuffed and in business,
- * when he is alive within his goons' leash of the sofa; otherwise he is removed as any criminal is,
- * and gone.
+ * goon. Killed before any posting, he is gone with nothing to claim: his body is an ordinary corpse
+ * that the human NPC corpse sweep takes in time. Closed unclaimed (run out, withdrawn), it leaves
+ * him in the lounge, alive, uncuffed and in business, when he is alive within his goons' leash of
+ * the sofa; otherwise he is removed as any criminal is, and gone.
* - Talking: a radial on him. "We're here for you" and "Walk away" only show once that crew's
* ship has taken his open posting from the board; the first gets his confront line and starts the
- * shootout. Any attack on him or a goon starts it too. A warrant shown to him, or a reach for his
- * wrists, only gets the confront line.
+ * shootout. Any attack on him or a goon starts it too. A warrant shown to him only gets the
+ * confront line; a reach for his wrists while he can still move gets the line and a shove.
* - The shootout (/datum/bounty_kingpin_crew): a 0.6 s telegraph where nobody fires ("the goons
- * reach for their guns"), then first shots spread over half a second, at most two goons on one
- * hunter in cover. He never leaves the sofa and fires a revolver after a visible 0.5 s aim. Goons
- * stay within 7 tiles of the sofa, never shoot anyone who is down, and half of those left flee once
- * he falls. The barkeep shouts, the turret ignores both sides, and hunters
- * fighting his crew take no outpost property strikes (one marked hook in outpost.dm). His crew
- * lives as long as he does.
- * - His body is P2's (/mob/living/basic/bounty_criminal), with or without a posting: downed at 25%,
- * up again after 60 s unless cuffed, and P2's capture rules and P5's pad apply. He surrenders only
- * once his crew is down.
- * - Goons (/mob/living/basic/bounty_kingpin_goon) are not bounties: 150 health, no loot, no real
- * guns, and their bodies fade after 60 s.
+ * reach for their guns", and they really draw them), then first shots spread over half a second,
+ * at most two goons on one hunter in cover. Every shot is a real trigger pull of the real gun in a
+ * hand, through that body's AI controller (ai_interact(), a player's click), and every reload is
+ * the player's reload from the spares they carry. Nobody in his crew fires through someone they
+ * aren't fighting: a bystander, a guest or one of their own in the line holds the shot. He never
+ * leaves the sofa and fires his revolver after a visible 0.5 s aim that a hit spoils. Goons stay
+ * within 7 tiles of the sofa, never shoot anyone who is down, and half of those left walk out once
+ * he falls. The barkeep shouts, the turret ignores both sides, and hunters fighting his crew take
+ * no outpost property strikes (one marked hook in outpost.dm). His crew lives as long as he does.
+ * - His body is P2's (/mob/living/carbon/human/npc/bounty_criminal), a real human with or without a
+ * posting: tg's crit, stamina, cuffs and death, P2's capture rules and P5's pad. A boss (aimed crits),
+ * tougher by physiology (BOUNTY_KINGPIN_DAMAGE_TAKEN) and an armoured coat. He gives up (tg's
+ * *surrender) only once his crew is down and he is badly hurt.
+ * - Goons (/mob/living/carbon/human/npc/bounty_kingpin_goon) are not bounties: real humans in armour
+ * vests with real pistols, SMGs and shotguns and real spare magazines and shells. Their gear is
+ * locked to them (D3), so nothing they carry is loot; their bodies go with the human NPC corpse sweep.
*
* A var this file adds to a shared type carries a `kingpin_` prefix.
*/
@@ -182,65 +187,92 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
// LOOKS
// =========================================================================
-/// The kingpin: a charcoal suit, a red tie, a fedora and a cigar
+/**
+ * The kingpin: a charcoal suit under an armoured trenchcoat, a red tie, a fedora and a cigar. His .357
+ * and two speedloaders ride in the shoulder holster under the coat, a third speedloader and an
+ * epinephrine pen in his pockets. Locked to him (D3): none of it is loot.
+ */
/datum/outfit/bounty_kingpin
name = "Bounty kingpin"
uniform = /obj/item/clothing/under/suit/charcoal
- suit = /obj/item/clothing/suit/toggle/lawyer/black
+ suit = /obj/item/clothing/suit/armor/hos/trenchcoat
neck = /obj/item/clothing/neck/tie/red/tied
gloves = /obj/item/clothing/gloves/color/black
shoes = /obj/item/clothing/shoes/laceup
head = /obj/item/clothing/head/fedora
mask = /obj/item/cigarette/cigar/havana
-
-/// The kingpin in a shootout: the same, with his revolver out (worn look only; he carries no real gun)
-/datum/outfit/bounty_kingpin/armed
- name = "Bounty kingpin: armed"
- r_hand = BOUNTY_KINGPIN_REVOLVER
-
-/// A goon at ease: black suit, black tie, sunglasses
+ belt = /obj/item/storage/belt/holster/detective
+ belt_contents = list(
+ BOUNTY_KINGPIN_REVOLVER = 1,
+ BOUNTY_KINGPIN_SPEEDLOADER = 2,
+ )
+ l_pocket = BOUNTY_KINGPIN_SPEEDLOADER
+ r_pocket = /obj/item/reagent_containers/hypospray/medipen
+
+/// A goon: black suit and tie under an armour vest, sunglasses. The subtypes carry the gun and its spares.
/datum/outfit/bounty_kingpin_goon
name = "Kingpin goon"
uniform = /obj/item/clothing/under/suit/black
- suit = /obj/item/clothing/suit/toggle/lawyer/black
+ suit = /obj/item/clothing/suit/armor/vest
neck = /obj/item/clothing/neck/tie/black/tied
glasses = /obj/item/clothing/glasses/sunglasses
gloves = /obj/item/clothing/gloves/color/black
shoes = /obj/item/clothing/shoes/laceup
-/// Goons with their guns out (worn looks only; goons carry no real guns and drop none)
+/// A Stechkin in the holster under the vest, with two spare magazines beside it
/datum/outfit/bounty_kingpin_goon/pistol
name = "Kingpin goon: pistol"
- r_hand = BOUNTY_GOON_PISTOL_GUN
+ belt = /obj/item/storage/belt/holster/detective
+ belt_contents = list(
+ BOUNTY_GOON_PISTOL_GUN = 1,
+ BOUNTY_GOON_PISTOL_MAG = 2,
+ )
+/// An Uzi on the vest, a spare magazine in each pocket
/datum/outfit/bounty_kingpin_goon/smg
name = "Kingpin goon: SMG"
- r_hand = BOUNTY_GOON_SMG_GUN
+ suit_store = BOUNTY_GOON_SMG_GUN
+ l_pocket = BOUNTY_GOON_SMG_MAG
+ r_pocket = BOUNTY_GOON_SMG_MAG
+/// A combat shotgun on the back, a bandolier of buckshot
/datum/outfit/bounty_kingpin_goon/shotgun
name = "Kingpin goon: shotgun"
- r_hand = BOUNTY_GOON_SHOTGUN_GUN
+ back = BOUNTY_GOON_SHOTGUN_GUN
+ belt = /obj/item/storage/belt/bandolier
+ belt_contents = list(BOUNTY_GOON_SHOTGUN_AMMO = BOUNTY_GOON_SHOTGUN_SHELLS)
+
+/// The goons' combat shotgun: tg's, with its tube loaded with buckshot instead of rubber
+/obj/item/gun/ballistic/shotgun/automatic/combat/bounty_kingpin
+ spawn_magazine_type = /obj/item/ammo_box/magazine/internal/shot/com/bounty_kingpin
+
+/obj/item/ammo_box/magazine/internal/shot/com/bounty_kingpin
+ ammo_type = BOUNTY_GOON_SHOTGUN_AMMO
// =========================================================================
// THE KINGPIN
// =========================================================================
/**
- * The kingpin: P2's criminal body with his own numbers. He sits on the sofa and never leaves it,
- * talks across the table, and in a shootout fires a revolver after a visible aim. His crew
- * (kingpin_crew) runs the goons, the room and his business. He may be on a posting or on none.
+ * The kingpin: P2's criminal body, a real human. He sits on the sofa and never leaves it, talks across
+ * the table, and in a shootout draws his real revolver and fires it after a visible aim. His crew
+ * (kingpin_crew) runs the goons, the room, his shots and his business; his own AI controller only
+ * does what his body does by itself (soft crit, breaking free, giving up, reloading, his medipen). He
+ * may be on a posting or on none.
*/
-/mob/living/basic/bounty_criminal/kingpin
+/mob/living/carbon/human/npc/bounty_criminal/kingpin
name = "kingpin"
desc = "Sharp suit, cold eyes. He runs this lounge, and his people are never far away."
- maxHealth = BOUNTY_KINGPIN_HEALTH
- health = BOUNTY_KINGPIN_HEALTH
- // His crew drives him; no criminal AI (P3) is ever put on him.
- ai_controller = null
+ ai_controller = /datum/ai_controller/basic_controller/human_npc/bounty_kingpin
+ npc_rank = HUMAN_NPC_RANK_BOSS
+ npc_damage_taken = BOUNTY_KINGPIN_DAMAGE_TAKEN
+ // A boss's toughness is his own, not his record's tier (bounty_criminal.dm body_toughness())
+ body_tier_toughness = FALSE
+ npc_surrender = /datum/human_npc_surrender/bounty_kingpin
+ // Killed before any posting he is an ordinary corpse; on an open posting the sweep leaves him for the pad (npc_corpse_expired())
+ npc_corpse_lifetime = HUMAN_NPC_CORPSE_LIFETIME
/// His goons, the shootout, the room and the job he holds (/datum/bounty_kingpin_crew). He deletes it.
var/datum/bounty_kingpin_crew/kingpin_crew
- /// Rounds left in his revolver (a full cylinder at Initialize)
- var/kingpin_rounds = 0
/// world.time he may start his next aim
var/kingpin_next_aim_at = 0
/// The timer that fires the aimed shot, while he aims
@@ -251,65 +283,51 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
var/datum/weakref/kingpin_aim_target
/// Weakref of anyone who hit him -> how many times: he shoots whoever hurt him most
var/list/kingpin_hits = list()
- /// world.time of his next surrender roll
- var/kingpin_next_surrender_roll = 0
- /// The timer fading his body out, when no posting holds it (kingpin_start_fade())
- var/kingpin_fade_timer
/// Between two of his lines
COOLDOWN_DECLARE(kingpin_say_cooldown)
-/mob/living/basic/bounty_criminal/kingpin/Initialize(mapload)
- . = ..()
- kingpin_rounds = bounty_kingpin_revolver().magazine
-
-/mob/living/basic/bounty_criminal/kingpin/Destroy()
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/Destroy()
kingpin_cancel_aim()
- deltimer(kingpin_fade_timer)
- kingpin_fade_timer = null
QDEL_NULL(kingpin_crew)
kingpin_hits.Cut()
- // Deleted for any reason (the pad, a posting's cleanup, an admin): he is gone for the round
+ // Deleted for any reason (the pad, a posting's cleanup, the corpse sweep, an admin): he is gone for the round
SSbounty_kingpin.kingpin_removed(src)
return ..()
-// Dead is gone for the round. On the board, his body is there to bring in; killed off it, there is nothing to claim and it fades.
-/mob/living/basic/bounty_criminal/kingpin/death(gibbed)
+// Dead is gone for the round. On the board, his body is there to bring in; killed off it, there is nothing to claim.
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/death(gibbed)
. = ..()
SSbounty_kingpin.kingpin_died(src)
if(QDELETED(src))
return
+ kingpin_cancel_aim()
// A chair holds a body upright: he slumps off his sofa
if(istype(buckled, /obj/structure/chair))
buckled.unbuckle_mob(src, force = TRUE)
- if(!kingpin_posting())
- kingpin_start_fade()
-
-// His numbers on P2's body
-/mob/living/basic/bounty_criminal/kingpin/body_recovery_time()
- return BOUNTY_KINGPIN_RECOVERY
-
-/mob/living/basic/bounty_criminal/kingpin/body_rally_time()
- return BOUNTY_KINGPIN_RALLY
-/mob/living/basic/bounty_criminal/kingpin/body_stamina_pool()
- return BOUNTY_KINGPIN_STAMINA
+// The corpse sweep never takes the body an open posting pays for; with no posting he is an ordinary corpse
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/npc_corpse_expired()
+ if(kingpin_posting()?.is_open())
+ return FALSE
+ return ..()
-/mob/living/basic/bounty_criminal/kingpin/bounty_outfit()
- return kingpin_crew?.crew_armed ? /datum/outfit/bounty_kingpin/armed : /datum/outfit/bounty_kingpin
+// He dresses as himself, whatever the zone: the outfit table asks (bounty_outfits.dm)
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/bounty_build_outfit(zone)
+ return /datum/outfit/bounty_kingpin
// He is always at the sofa; nothing else sets what he is doing.
-/mob/living/basic/bounty_criminal/kingpin/start_activity(kind, atom/anchor)
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/start_activity(kind, atom/anchor)
return
-// Shown a warrant, or someone reached for his wrists: his confront line, and nothing more (P6, P2)
-/mob/living/basic/bounty_criminal/kingpin/on_confronted(mob/user)
+// Shown a warrant: his confront line, and nothing more (P6, P2)
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/on_confronted(mob/user)
INVOKE_ASYNC(src, PROC_REF(kingpin_confronted), user)
-/mob/living/basic/bounty_criminal/kingpin/identity_voice()
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/identity_voice()
return BOUNTY_ARCHETYPE_KINGPIN
/// His lines come from his own dialogue file first; anything it has no lines for goes to P1's
-/mob/living/basic/bounty_criminal/kingpin/bounty_say(context, list/values, force = FALSE)
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/bounty_say(context, list/values, force = FALSE)
if(QDELETED(src) || stat == DEAD || !istext(context))
return FALSE
if(!length(bounty_kingpin_lines("kingpin", context)))
@@ -326,28 +344,46 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
say(line, forced = "bounty kingpin")
return TRUE
-/mob/living/basic/bounty_criminal/kingpin/examine(mob/user)
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/examine(mob/user)
. = ..()
if(kingpin_can_talk())
. += span_notice("[p_They()] look[p_s()] ready to talk business.")
-// Every hit that gets through: with his crew down, he may give up
-/mob/living/basic/bounty_criminal/kingpin/adjust_health(amount, updating_health = TRUE, forced = FALSE)
- var/health_before = health
- . = ..()
- if(amount > 0 && !forced)
- kingpin_consider_surrender(health_before)
- // Hurt while his crew is at ease, by anything at all: they find out who
- kingpin_crew?.member_hurt(src)
+/**
+ * Someone reaches for his wrists. A man on his sofa doesn't step away: while he can still move he
+ * shoves them off a moment later (a real shove, which breaks their cuffing) and says his confront line.
+ * Paralysed after giving up, stamcritted, knocked down or in crit, he can't, and the cuffs go on.
+ */
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/body_on_cuff_attempt(mob/living/user)
+ if(!kingpin_able())
+ return
+ body_add_grudge(user)
+ addtimer(CALLBACK(src, PROC_REF(kingpin_answer_cuffs), WEAKREF(user)), BOUNTY_CUFF_REACTION_DELAY, TIMER_DELETE_ME)
+
+/// A moment after the reach: his line, and a shove for whoever is at his wrists, if he still can
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_answer_cuffs(datum/weakref/user_ref)
+ var/mob/living/user = user_ref?.resolve()
+ if(QDELETED(src) || QDELETED(user) || !kingpin_able() || !Adjacent(user))
+ return
+ INVOKE_ASYNC(src, PROC_REF(kingpin_confronted), user)
+ bounty_kingpin_shove(src, user)
+
+// He gives up the way a person does (the human NPC base): his aim drops, his hands go up, then tg's *surrender
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/npc_surrender()
+ if(stat != CONSCIOUS || HAS_TRAIT(src, TRAIT_RESTRAINED) || npc_surrendering)
+ return FALSE
+ kingpin_cancel_aim()
+ visible_message(span_notice("[src] puts [p_their()] hands up."), vision_distance = BOUNTY_KINGPIN_SIGHT)
+ return ..()
// An open hand in reach of him starts the talk
-/mob/living/basic/bounty_criminal/kingpin/attack_hand(mob/living/carbon/human/user, list/modifiers)
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/attack_hand(mob/living/carbon/human/user, list/modifiers)
if(istype(user) && !user.combat_mode && !LAZYACCESS(modifiers, RIGHT_CLICK) && !is_restrained() && kingpin_can_talk())
INVOKE_ASYNC(src, PROC_REF(kingpin_open_talk), user)
return TRUE
return ..()
-/mob/living/basic/bounty_criminal/kingpin/ranged_attack_hand(mob/living/user, list/modifiers)
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/ranged_attack_hand(mob/living/user, list/modifiers)
if(!kingpin_in_talk_range(user))
return FALSE
if(!kingpin_can_talk())
@@ -357,72 +393,54 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
return TRUE
/// His posting, if he is on one (/datum/criminal_bounty/kingpin): none while he just sits in his lounge
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_posting()
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_posting()
RETURN_TYPE(/datum/criminal_bounty/kingpin)
var/datum/criminal_bounty/kingpin/posting = posting()
return istype(posting) ? posting : null
/// Whether he is in his lounge: on a turf (not in a locker or a bag) within his goons' leash of his seat
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_on_leash()
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_on_leash()
var/turf/seat = kingpin_crew?.crew_seat
var/turf/here = get_turf(src)
if(!seat || !here || !isturf(loc))
return FALSE
return here.z == seat.z && get_dist(here, seat) <= BOUNTY_GOON_LEASH
-/// A posting let go of him in his lounge: his people see to him. The cuffs come off (onto the floor) and he stops giving up; a downed one gets up in his own time.
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_back_to_business()
- if(is_restrained())
- body_remove_cuffs()
- REMOVE_TRAIT(src, TRAIT_BOUNTY_SURRENDERED, BOUNTY_TRAIT)
-
-/// His body, with no posting to bring it in for, fades after BOUNTY_GOON_FADE as a goon's does (once)
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_start_fade()
- if(kingpin_fade_timer || stat != DEAD || QDELETED(src))
- return
- kingpin_fade_timer = addtimer(CALLBACK(src, PROC_REF(kingpin_fade_out)), BOUNTY_GOON_FADE, TIMER_STOPPABLE | TIMER_DELETE_ME)
-
-/// The body fades away, unless a posting holds it for the pad. Taken away, not destroyed: no proof of death.
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_fade_out()
- kingpin_fade_timer = null
- if(QDELETED(src) || kingpin_posting())
- return
- ADD_TRAIT(src, TRAIT_BOUNTY_REMOVED, BOUNTY_KINGPIN_TRAIT)
- pulledby?.stop_pulling()
- animate(src, alpha = 0, time = BOUNTY_GOON_FADE_OUT)
- QDEL_IN(src, BOUNTY_GOON_FADE_OUT)
+/// A posting let go of him in his lounge: his people see to him. The cuffs come off (onto the floor); anything else he is in, crit included, he gets over in his own time.
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_back_to_business()
+ if(handcuffed || legcuffed)
+ uncuff()
/**
* Takes him back to his sofa when he's been moved off it and is free again: a step at a time within
- * his crew's leash, a walk from further off, and put straight back from another level or too far to
- * walk, when nobody is watching him (L5).
+ * his crew's leash, a real walk from further off, and put straight back from another level or too
+ * far to walk only when no player is near enough to see it (human_npc_watched(), CB-19, L5).
*/
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_go_home()
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_go_home()
var/turf/seat = kingpin_crew?.crew_seat
var/turf/here = get_turf(src)
if(!seat || !here || here == seat || buckled || !kingpin_able() || !isturf(loc) || pulledby)
return FALSE
if(here.z == seat.z && get_dist(here, seat) <= BOUNTY_GOON_LEASH)
var/turf/next = get_step_to(src, seat)
- if(next)
+ if(next && body_move_allowed(next))
Move(next, get_dir(src, next))
return TRUE
if(here.z == seat.z && get_dist(here, seat) <= BOUNTY_KINGPIN_WALK_HOME_MAX)
if(world.time >= kingpin_crew.crew_next_home_walk)
kingpin_crew.crew_next_home_walk = world.time + BOUNTY_KINGPIN_WALK_HOME_GAP
- GLOB.move_manager.jps_move(src, seat, delay = 3, timeout = BOUNTY_KINGPIN_WALK_HOME_GAP, repath_delay = 2 SECONDS, max_path_length = BOUNTY_KINGPIN_WALK_HOME_MAX * 2, simulated_only = TRUE, priority = MOVEMENT_ABOVE_SPACE_PRIORITY)
+ GLOB.move_manager.jps_move(src, seat, delay = max(3, cached_multiplicative_slowdown), timeout = BOUNTY_KINGPIN_WALK_HOME_GAP, repath_delay = 2 SECONDS, max_path_length = BOUNTY_KINGPIN_WALK_HOME_MAX * 2, simulated_only = TRUE, priority = MOVEMENT_ABOVE_SPACE_PRIORITY)
return TRUE
- for(var/mob/living/watcher in viewers(world.view, src))
- if(watcher.client && watcher != src)
- return FALSE
+ if(human_npc_watched(src))
+ return FALSE
forceMove(seat)
return kingpin_sit()
/// Sits him on the sofa at his seat, facing the way it faces. TRUE if he is sitting there now.
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_sit()
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_sit()
if(buckled)
return istype(buckled, /obj/structure/chair)
- if(stat != CONSCIOUS || downed || is_restrained() || body_is_stunned())
+ if(stat != CONSCIOUS || is_downed() || is_restrained() || body_is_stunned())
return FALSE
var/turf/seat = kingpin_crew?.crew_seat || get_turf(src)
if(get_turf(src) != seat)
@@ -438,30 +456,30 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
// ===== TALKING =====
/// Whether he'll talk now: awake, free, on his feet, and no shootout on
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_can_talk()
- if(stat != CONSCIOUS || downed || is_restrained() || body_is_stunned())
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_can_talk()
+ if(stat != CONSCIOUS || is_downed() || is_restrained() || body_is_stunned() || npc_surrendering)
return FALSE
return kingpin_crew?.crew_state == BOUNTY_KINGPIN_CALM
/// Whether `user` is close enough to talk to him: across the table, in sight, awake
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_in_talk_range(mob/living/user)
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_in_talk_range(mob/living/user)
if(!isliving(user) || QDELETED(user) || user.stat != CONSCIOUS || user.z != z)
return FALSE
return get_dist(src, user) <= BOUNTY_KINGPIN_TALK_RANGE && can_see(user, src, BOUNTY_KINGPIN_TALK_RANGE)
/// The radial's validity check
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_talk_check(mob/living/user)
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_talk_check(mob/living/user)
return kingpin_can_talk() && kingpin_in_talk_range(user)
/// Whether `user`'s crew has a live reason to confront him: his posting is up and open, and their ship took it from the board
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_confrontable(mob/living/user)
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_confrontable(mob/living/user)
var/datum/criminal_bounty/kingpin/posting = kingpin_posting()
if(!posting?.is_open())
return FALSE
return posting.is_hunting(get_crew_ship(user))
/// The talk radial for `user`. "We're here for you" and "Walk away" only while their crew is hunting him; "I'll take it" only while he has offered their crew his job. Sleeps.
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_open_talk(mob/living/user)
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_open_talk(mob/living/user)
if(!kingpin_talk_check(user))
return
var/list/options = list()
@@ -487,7 +505,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
* starts, his job is offered or taken, or nothing happens. Returns TRUE if he listened. Making a job
* can sleep.
*/
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_talk(mob/living/user, option)
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_talk(mob/living/user, option)
if(!kingpin_can_talk() || QDELETED(user))
return FALSE
bounty_kingpin_hunter_says(user, option)
@@ -508,7 +526,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
return TRUE
/// Shown a warrant or reached for: his confront line, and no fight
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_confronted(mob/living/user)
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_confronted(mob/living/user)
if(!kingpin_can_talk() || QDELETED(user))
return
bounty_say("confront", force = TRUE)
@@ -516,7 +534,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
// ===== HIS BUSINESS =====
/// The name he goes by on his jobs: his alias, else his name ("The Accountant")
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_job_name()
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_job_name()
return capitalize(record?.alias || record?.name || name)
/**
@@ -525,7 +543,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
* fought his people, someone is already running his job, or he has none to give. May make his job,
* which can sleep.
*/
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_work_refusal(mob/living/user)
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_work_refusal(mob/living/user)
var/datum/bounty_kingpin_crew/crew = kingpin_crew
if(!crew)
return "no_work"
@@ -546,7 +564,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
return null
/// "Got any work?": he offers `user`'s crew the job he holds, for BOUNTY_KINGPIN_OFFER_TIME, or says why not. Returns TRUE if he offered it. Sleeps.
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_offer_work(mob/living/user)
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_offer_work(mob/living/user)
var/refusal = kingpin_work_refusal(user)
var/datum/bounty_kingpin_crew/crew = kingpin_crew
if(QDELETED(src) || !crew)
@@ -566,7 +584,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
* (SSbounty_kingpin.kingpin_bind()): none of them can hunt him or turn him in. He makes another job
* if the round's limit allows. Returns the job, or null. Sleeps.
*/
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_take_job(mob/living/user)
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_take_job(mob/living/user)
var/datum/bounty_kingpin_crew/crew = kingpin_crew
var/obj/structure/overmap/ship/ship = get_crew_ship(user)
var/datum/mission/job = crew?.job()
@@ -605,29 +623,32 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
// ===== HIS REVOLVER =====
-/// His revolver: the one in his hand, whose rounds and cylinder are his (bounty_real_weapon())
-/proc/bounty_kingpin_revolver()
- return bounty_real_weapon(BOUNTY_KINGPIN_REVOLVER)
-
-/// Whether he can shoot now: awake, not down, not cuffed, not stunned, not given up
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_able()
- if(stat != CONSCIOUS || downed || is_restrained() || body_is_stunned())
+/// Whether he can shoot now: awake, not in crit, not cuffed, not stunned, not lying there having given up, hands free
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_able()
+ if(stat != CONSCIOUS || is_downed() || is_restrained() || body_is_stunned() || npc_surrendering)
return FALSE
- return !HAS_TRAIT(src, TRAIT_INCAPACITATED)
+ return !HAS_TRAIT(src, TRAIT_INCAPACITATED) && !HAS_TRAIT(src, TRAIT_HANDS_BLOCKED)
-/// He thumbs the hammer back and aims at `target`: a visible line for BOUNTY_KINGPIN_REVOLVER_AIM, then the shot
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_start_aim(mob/living/target)
+/// He thumbs the hammer back and aims at `target`: a visible line for BOUNTY_KINGPIN_REVOLVER_AIM, then the shot. Needs a loaded gun in his hand.
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_start_aim(mob/living/target)
kingpin_cancel_aim()
+ if(!human_npc_loaded_gun(src))
+ return FALSE
kingpin_next_aim_at = world.time + BOUNTY_KINGPIN_REVOLVER_COOLDOWN
kingpin_aim_target = WEAKREF(target)
var/atom/aim_at = kingpin_crew?.shot_target(target) || target
+ face_atom(aim_at)
kingpin_aim_beam = Beam(aim_at, icon_state = "infrared", time = BOUNTY_KINGPIN_REVOLVER_AIM, beam_color = COLOR_RED)
visible_message(span_danger("[src] thumbs the hammer back and aims at [target]!"), vision_distance = BOUNTY_KINGPIN_SIGHT)
playsound(src, 'sound/items/weapons/gun/general/ballistic_click.ogg', 60, TRUE)
kingpin_aim_timer = addtimer(CALLBACK(src, PROC_REF(kingpin_fire)), BOUNTY_KINGPIN_REVOLVER_AIM, TIMER_STOPPABLE | TIMER_DELETE_ME)
+ return TRUE
-/// The aim is done: he fires if he still can and still sees them. A stun in the meantime spoils it.
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_fire()
+/**
+ * The aim is done: he pulls the trigger of the revolver in his hand, if he still can, still sees them
+ * and nobody he isn't fighting stands in the line. A stun in the meantime spoils it.
+ */
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_fire()
kingpin_aim_timer = null
var/mob/living/target = kingpin_aim_target?.resolve()
kingpin_aim_target = null
@@ -641,32 +662,45 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
return FALSE
if(!crew.valid_target(target) || !bounty_kingpin_clear_shot(src, target))
return FALSE
- kingpin_rounds--
- bounty_kingpin_shoot(src, crew.shot_target(target), bounty_kingpin_revolver(), crew)
+ var/atom/aim_at = crew.shot_target(target)
+ if(crew.line_blocked(src, aim_at))
+ return FALSE
+ var/obj/item/gun/gun = human_npc_loaded_gun(src)
+ if(!gun)
+ return FALSE
+ return crew.pull_trigger(src, gun, aim_at)
+
+/// A hit while he aims: the shot is spoiled
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_fumble()
+ if(!kingpin_aim_timer)
+ return FALSE
+ kingpin_cancel_aim()
+ if(stat == CONSCIOUS)
+ visible_message(span_notice("[src] fumbles the shot."), vision_distance = COMBAT_MESSAGE_RANGE)
return TRUE
/// Drops his aim, if he has one
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_cancel_aim()
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_cancel_aim()
if(kingpin_aim_timer)
deltimer(kingpin_aim_timer)
kingpin_aim_timer = null
kingpin_aim_target = null
QDEL_NULL(kingpin_aim_beam)
-/// He reloads: BOUNTY_KINGPIN_REVOLVER_RELOAD with nothing fired, a window for the hunters
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_reload()
- kingpin_rounds = bounty_kingpin_revolver().magazine
- kingpin_next_aim_at = world.time + BOUNTY_KINGPIN_REVOLVER_RELOAD
+/// His reload starts (his AI's reload, the player's way: a speedloader into the cylinder): his line, and the room hears him ask for cover
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_reload_tell()
+ kingpin_cancel_aim()
visible_message(span_notice("[src] breaks open [p_their()] revolver and reloads."), vision_distance = COMBAT_MESSAGE_RANGE)
- playsound(src, 'sound/items/weapons/gun/revolver/load_bullet.ogg', 50, TRUE)
INVOKE_ASYNC(src, TYPE_PROC_REF(/mob/living, bounty_say), "reload")
-/// He picks who to shoot among `visible`: whoever hit him most, else the nearest
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_choose_target(list/visible)
+/// He picks who to shoot among `visible`: whoever hit him most, else the nearest, among those he has a clear line to
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_choose_target(list/visible)
var/mob/living/best
var/best_hits = -1
var/best_dist = INFINITY
for(var/mob/living/candidate as anything in visible)
+ if(kingpin_crew?.line_blocked(src, kingpin_crew.shot_target(candidate)))
+ continue
var/hits = kingpin_hits[candidate.weak_reference] || 0
var/dist = get_dist(src, candidate)
if(hits > best_hits || (hits == best_hits && dist < best_dist))
@@ -676,48 +710,51 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
return best
/// Someone hit him: they count toward who he shoots first
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_note_hit(mob/living/attacker)
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/proc/kingpin_note_hit(mob/living/attacker)
if(!isliving(attacker))
return
var/datum/weakref/ref = WEAKREF(attacker)
kingpin_hits[ref] = (kingpin_hits[ref] || 0) + 1
-// ===== GIVING UP =====
+// ===== GIVING UP (CB-14) =====
/**
- * After a hit that got through: with his crew down and his health at or below
- * BOUNTY_KINGPIN_SURRENDER_BELOW percent, he may give up. BOUNTY_KINGPIN_SURRENDER_FIRST on the hit
- * that crosses the line, BOUNTY_KINGPIN_SURRENDER_LATER on later hits, one roll per
- * BOUNTY_KINGPIN_SURRENDER_GAP. Never while rallying. Doesn't sleep.
+ * His surrender rules for the human NPC base's surrender subtree: only once his crew is down (no goon
+ * still in the fight) and he is at or below BOUNTY_KINGPIN_SURRENDER_BELOW percent of his health, with
+ * a hunter in sight. BOUNTY_KINGPIN_SURRENDER_FIRST on his first roll, BOUNTY_KINGPIN_SURRENDER_LATER
+ * after, one roll per BOUNTY_KINGPIN_SURRENDER_GAP. He holsters the revolver, says his line, puts his
+ * hands up and runs tg's *surrender; then tg's cuffs. He never runs from the sofa.
*/
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_consider_surrender(health_before)
- if(stat != CONSCIOUS || downed || is_restrained() || HAS_TRAIT(src, TRAIT_BOUNTY_SURRENDERED) || body_is_rallying())
- return FALSE
- if(!kingpin_crew?.crew_down())
- return FALSE
- var/line = maxHealth * BOUNTY_KINGPIN_SURRENDER_BELOW / 100
- if(health > line)
- return FALSE
- var/chance = BOUNTY_KINGPIN_SURRENDER_FIRST
- if(health_before <= line)
- if(world.time < kingpin_next_surrender_roll)
- return FALSE
- chance = BOUNTY_KINGPIN_SURRENDER_LATER
- kingpin_next_surrender_roll = world.time + BOUNTY_KINGPIN_SURRENDER_GAP
- if(!prob(chance))
+/datum/human_npc_surrender/bounty_kingpin
+ chance = BOUNTY_KINGPIN_SURRENDER_FIRST
+ retry_chance = BOUNTY_KINGPIN_SURRENDER_LATER
+ ally_penalty = 0
+ health_share = BOUNTY_KINGPIN_SURRENDER_BELOW / 100
+ hostiles_needed = 1
+ range = BOUNTY_KINGPIN_SIGHT
+ retry_delay = BOUNTY_KINGPIN_SURRENDER_GAP
+ flees = FALSE
+
+/datum/human_npc_surrender/bounty_kingpin/hurt_enough(mob/living/carbon/human/npc/npc)
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = npc
+ if(!istype(kingpin) || !kingpin.kingpin_crew?.crew_down())
return FALSE
- kingpin_surrender()
- return TRUE
+ return ..()
-/// He gives up: P2 reads it as stunned, so he can be cuffed, and he fires no more
-/mob/living/basic/bounty_criminal/kingpin/proc/kingpin_surrender()
- if(HAS_TRAIT(src, TRAIT_BOUNTY_SURRENDERED))
+// Who he gives up to: the hunters his crew is fighting that he can see
+/datum/human_npc_surrender/bounty_kingpin/hostiles_near(mob/living/carbon/human/npc/npc)
+ . = list()
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = npc
+ var/datum/bounty_kingpin_crew/crew = istype(kingpin) ? kingpin.kingpin_crew : null
+ if(!crew)
return
- kingpin_cancel_aim()
- ADD_TRAIT(src, TRAIT_BOUNTY_SURRENDERED, BOUNTY_TRAIT)
- body_note_state()
- visible_message(span_notice("[src] puts [p_their()] hands up."), vision_distance = BOUNTY_KINGPIN_SIGHT)
- INVOKE_ASYNC(src, TYPE_PROC_REF(/mob/living, bounty_say), "surrender", null, TRUE)
+ for(var/mob/living/hunter as anything in crew.live_hunters())
+ if(can_see(npc, hunter, range))
+ . += hunter
+
+// His crew is down by the time he thinks about it: nobody's left to count
+/datum/human_npc_surrender/bounty_kingpin/allies_near(mob/living/carbon/human/npc/npc)
+ return list()
// =========================================================================
// THE GOONS
@@ -726,42 +763,23 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
/**
* # Kingpin goon
*
- * One of the kingpin's crew: not a bounty, pays nothing, carries nothing. Before a shootout they
- * idle at their posts (smoke, drink, murmur, watch the room); in one, their crew
- * (/datum/bounty_kingpin_crew) moves them and fires their simulated guns. Turrets leave them alone
- * (FACTION_TURRET). Their bodies fade after BOUNTY_GOON_FADE.
+ * One of the kingpin's crew: not a bounty, pays nothing. A real human in a suit and an armour vest,
+ * with a real gun and its spares carried on the body (the subtype picks which: three pistols, two
+ * shotguns and an SMG in the lounge). Their gear is locked to them (D3), so none of it is loot. Before
+ * a shootout they idle at their posts (smoke, drink, murmur, watch the room); in one, their crew
+ * (/datum/bounty_kingpin_crew) picks their targets, moves them, and pulls the triggers of the guns
+ * in their hands through their AI controllers; their own AI reloads, breaks free, crawls in crit and
+ * walks out. Turrets leave them alone (FACTION_TURRET). Their bodies go with the human NPC corpse sweep.
*/
-/mob/living/basic/bounty_kingpin_goon
+/mob/living/carbon/human/npc/bounty_kingpin_goon
name = "goon"
- desc = "One of the kingpin's people. Good suit, bad attitude."
- icon = 'icons/mob/simple/simple_human.dmi'
- unique_name = FALSE
- maxHealth = BOUNTY_GOON_HEALTH
- health = BOUNTY_GOON_HEALTH
- speed = 1
- mob_biotypes = MOB_ORGANIC | MOB_HUMANOID
- mob_size = MOB_SIZE_HUMAN
- sentience_type = SENTIENCE_BOSS
+ npc_name = "goon"
faction = list(FACTION_BOUNTY_KINGPIN, FACTION_TURRET)
- density = TRUE
- move_resist = MOVE_FORCE_VERY_STRONG
- // The body stays until it fades; nothing drops
- basic_mob_flags = NONE
- status_flags = CANPUSH | CANSTUN | CANKNOCKDOWN
- // P2's pattern: a pool of 100 and a coefficient, or the stamcrit ends the moment it starts (M1)
- max_stamina = BOUNTY_GOON_MAX_STAMINA
- stamina_crit_threshold = BOUNTY_GOON_STAMCRIT_AT
- mobility_flags = MOBILITY_FLAGS_REST_CAPABLE_DEFAULT
- rotate_on_lying = TRUE
- blood_volume = BLOOD_VOLUME_NORMAL
- unsuitable_atmos_damage = 0
- unsuitable_cold_damage = 0
- unsuitable_heat_damage = 0
- death_message = "seizes up and falls limp, their eyes dead and lifeless..."
- response_help_continuous = "taps"
- response_help_simple = "tap"
- ai_controller = null
- /// BOUNTY_GOON_WEAPON_*
+ ai_controller = /datum/ai_controller/basic_controller/human_npc/bounty_kingpin_goon
+ npc_outfit_table = /datum/human_npc_outfit_table/bounty
+ // Like the criminals, his people never shoot someone who is down (defaults 1.13)
+ npc_target_stat = HUMAN_NPC_SPARES_DOWNED
+ /// BOUNTY_GOON_WEAPON_*: what they carry
var/goon_weapon = BOUNTY_GOON_WEAPON_PISTOL
/// Where they stand, or sit, when there is no fight
var/turf/goon_post
@@ -771,9 +789,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
var/datum/weakref/goon_crew_ref
/// Weakref to who they are shooting at
var/datum/weakref/goon_target_ref
- /// Rounds (or shells) left before a reload
- var/goon_rounds = 0
- /// world.time they may fire next
+ /// world.time they may pull the trigger next
var/goon_next_fire_at = 0
/// world.time a fumble ends
var/goon_fumbled_until = 0
@@ -781,70 +797,59 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
var/goon_windup_timer
/// world.time of their next step
var/goon_next_move_at = 0
- /// Running away: he fell and they don't want to die for him
+ /// Running away: he fell and they don't want to die for him (they walk out, npc_walk_out())
var/goon_fleeing = FALSE
- /// Walking out: their crew is gone
- var/goon_leaving = FALSE
- /// Their gun is out (their worn look)
- var/goon_armed = FALSE
- /// Which of the look pool's faces they have
- var/goon_look_number = 1
- /// The timer fading their body out
- var/goon_fade_timer
/// Weakref to the chair at their post, if they sit
var/datum/weakref/goon_chair_ref
+ /// Pistol shots in the current string, and a weakref to the magazine they came from (a new one starts the count again)
+ var/goon_string_shots = 0
+ var/datum/weakref/goon_string_magazine
+
+/mob/living/carbon/human/npc/bounty_kingpin_goon/pistol
+
+/mob/living/carbon/human/npc/bounty_kingpin_goon/smg
+ goon_weapon = BOUNTY_GOON_WEAPON_SMG
+
+/mob/living/carbon/human/npc/bounty_kingpin_goon/shotgun
+ goon_weapon = BOUNTY_GOON_WEAPON_SHOTGUN
-/mob/living/basic/bounty_kingpin_goon/Initialize(mapload)
+/// The goon type that carries `weapon` (BOUNTY_GOON_WEAPON_*)
+/proc/bounty_kingpin_goon_type(weapon)
+ switch(weapon)
+ if(BOUNTY_GOON_WEAPON_SMG)
+ return /mob/living/carbon/human/npc/bounty_kingpin_goon/smg
+ if(BOUNTY_GOON_WEAPON_SHOTGUN)
+ return /mob/living/carbon/human/npc/bounty_kingpin_goon/shotgun
+ return /mob/living/carbon/human/npc/bounty_kingpin_goon/pistol
+
+/mob/living/carbon/human/npc/bounty_kingpin_goon/Initialize(mapload, datum/human_npc_order/order)
. = ..()
- // Their own copy: 5 disabler hits (30 each) fill the pool of BOUNTY_GOON_MAX_STAMINA
- damage_coeff = damage_coeff.Copy()
- damage_coeff[STAMINA] = BOUNTY_GOON_MAX_STAMINA / BOUNTY_GOON_HEALTH
- gender = prob(75) ? MALE : FEMALE
- goon_look_number = random_outpost_npc_look_number()
add_traits(list(TRAIT_NO_TELEPORT, TRAIT_NOMOBSWAP), BOUNTY_KINGPIN_TRAIT)
- AddElement(/datum/element/relay_attackers)
- AddElement(/datum/element/footstep, footstep_type = FOOTSTEP_MOB_SHOE)
- INVOKE_ASYNC(src, PROC_REF(goon_dress))
-/mob/living/basic/bounty_kingpin_goon/Destroy()
+/mob/living/carbon/human/npc/bounty_kingpin_goon/Destroy()
goon_cancel_windup()
- deltimer(goon_fade_timer)
- goon_fade_timer = null
goon_post = null
goon_crew_ref = null
goon_target_ref = null
goon_chair_ref = null
return ..()
+// The outfit table asks what they wear: the suit and vest, and the gun of their post with its spares
+/mob/living/carbon/human/npc/bounty_kingpin_goon/bounty_build_outfit(zone)
+ switch(goon_weapon)
+ if(BOUNTY_GOON_WEAPON_SMG)
+ return /datum/outfit/bounty_kingpin_goon/smg
+ if(BOUNTY_GOON_WEAPON_SHOTGUN)
+ return /datum/outfit/bounty_kingpin_goon/shotgun
+ return /datum/outfit/bounty_kingpin_goon/pistol
+
/// Their crew, if it still exists
-/mob/living/basic/bounty_kingpin_goon/proc/goon_crew()
+/mob/living/carbon/human/npc/bounty_kingpin_goon/proc/goon_crew()
var/datum/bounty_kingpin_crew/crew = goon_crew_ref?.resolve()
return QDELETED(crew) ? null : crew
-/// Puts their look on: at ease, or with their gun out. Sleeps.
-/mob/living/basic/bounty_kingpin_goon/proc/goon_dress()
- var/outfit = /datum/outfit/bounty_kingpin_goon
- if(goon_armed)
- switch(goon_weapon)
- if(BOUNTY_GOON_WEAPON_SMG)
- outfit = /datum/outfit/bounty_kingpin_goon/smg
- if(BOUNTY_GOON_WEAPON_SHOTGUN)
- outfit = /datum/outfit/bounty_kingpin_goon/shotgun
- else
- outfit = /datum/outfit/bounty_kingpin_goon/pistol
- set_outpost_npc_look(src, outfit, gender, goon_look_number)
- if(!QDELETED(src))
- update_appearance(UPDATE_OVERLAYS)
-
-/// Their gun comes out, or goes away
-/mob/living/basic/bounty_kingpin_goon/proc/goon_arm(armed)
- if(goon_armed == armed)
- return
- goon_armed = armed
- INVOKE_ASYNC(src, PROC_REF(goon_dress))
-
/// Says a line from the goons' dialogue, out loud or under their breath
-/mob/living/basic/bounty_kingpin_goon/proc/goon_say(context, whisper = FALSE)
+/mob/living/carbon/human/npc/bounty_kingpin_goon/proc/goon_say(context, whisper = FALSE)
if(stat != CONSCIOUS)
return FALSE
var/line = bounty_kingpin_line("goon", context)
@@ -856,110 +861,241 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
say(line, forced = "bounty kingpin goon")
return TRUE
-/// Whether they can fight now: awake, on their feet, not stunned, not leaving
-/mob/living/basic/bounty_kingpin_goon/proc/goon_able()
- if(stat != CONSCIOUS || goon_fleeing || goon_leaving)
+/// Whether they can fight now: awake, on their feet, hands free, not cuffed, not running, not leaving
+/mob/living/carbon/human/npc/bounty_kingpin_goon/proc/goon_able()
+ if(stat != CONSCIOUS || goon_fleeing || !isnull(npc_exit))
+ return FALSE
+ if(HAS_TRAIT(src, TRAIT_RESTRAINED) || HAS_TRAIT(src, TRAIT_HANDS_BLOCKED))
return FALSE
return !HAS_TRAIT(src, TRAIT_INCAPACITATED) && !HAS_TRAIT(src, TRAIT_FLOORED)
+/// Counts a pistol shot just fired from `pistol` towards his string. TRUE when it ends one with rounds still in the gun.
+/mob/living/carbon/human/npc/bounty_kingpin_goon/proc/goon_string_shot(obj/item/gun/ballistic/pistol)
+ if(!istype(pistol) || !pistol.magazine)
+ return FALSE
+ goon_string_shots = goon_string_magazine?.resolve() == pistol.magazine ? goon_string_shots + 1 : 1
+ goon_string_magazine = WEAKREF(pistol.magazine)
+ if(goon_string_shots < BOUNTY_PISTOL_STRING_SHOTS || bounty_gun_live_rounds(pistol) <= 0)
+ return FALSE
+ goon_string_shots = 0
+ return TRUE
+
/// Drops a burst or a blast that was winding up
-/mob/living/basic/bounty_kingpin_goon/proc/goon_cancel_windup()
+/mob/living/carbon/human/npc/bounty_kingpin_goon/proc/goon_cancel_windup()
if(goon_windup_timer)
deltimer(goon_windup_timer)
goon_windup_timer = null
-/// A goon's gun by BOUNTY_GOON_WEAPON_*: the one in his hand, loaded as it is (bounty_real_weapon())
-/proc/bounty_kingpin_goon_gun(weapon)
- switch(weapon)
- if(BOUNTY_GOON_WEAPON_SMG)
- return bounty_real_weapon(BOUNTY_GOON_SMG_GUN)
- if(BOUNTY_GOON_WEAPON_SHOTGUN)
- return bounty_real_weapon(BOUNTY_GOON_SHOTGUN_GUN, BOUNTY_GOON_SHOTGUN_AMMO)
- return bounty_real_weapon(BOUNTY_GOON_PISTOL_GUN)
-
-/// A full magazine (or tube) for their gun
-/proc/bounty_kingpin_goon_mag(weapon)
- var/datum/bounty_real_weapon/gun = bounty_kingpin_goon_gun(weapon)
- return gun.magazine
-
-/// How long their gun takes to reload
-/proc/bounty_kingpin_goon_reload(weapon)
- switch(weapon)
- if(BOUNTY_GOON_WEAPON_SMG)
- return BOUNTY_GOON_SMG_RELOAD
- if(BOUNTY_GOON_WEAPON_SHOTGUN)
- return BOUNTY_GOON_SHOTGUN_RELOAD
- return BOUNTY_GOON_PISTOL_RELOAD
+/mob/living/carbon/human/npc/bounty_kingpin_goon/examine(mob/user)
+ . = ..()
+ if(stat == DEAD || human_npc_held_gun(src))
+ return
+ . += span_notice("[p_They()] keep[p_s()] a hand near [p_their()] jacket.")
-/mob/living/basic/bounty_kingpin_goon/examine(mob/user)
+// Killed in a chair, they slump out of it
+/mob/living/carbon/human/npc/bounty_kingpin_goon/death(gibbed)
+ goon_cancel_windup()
. = ..()
- if(stat == DEAD)
+ if(QDELETED(src) || stat != DEAD)
return
- if(goon_armed)
- . += span_warning("[p_They()] [p_have()] a gun out.")
- else
- . += span_notice("[p_They()] keep[p_s()] a hand near [p_their()] jacket.")
+ if(istype(buckled, /obj/structure/chair))
+ buckled.unbuckle_mob(src, force = TRUE)
-// Hurt while their crew is at ease, by anything at all: the crew finds out who (H1)
-/mob/living/basic/bounty_kingpin_goon/adjust_health(amount, updating_health = TRUE, forced = FALSE)
+/**
+ * They broke someone's hold on them by resisting (the human NPC base's reactions): the grab answer
+ * (CB-22). A word, the grabber told, and a real shove if they're still in reach and have a hand free.
+ */
+/mob/living/carbon/human/npc/bounty_kingpin_goon/npc_check_pulled_free(atom/movable/holder, within = 0)
+ var/mob/living/grabber = npc_resisted_hold?.resolve()
+ var/freed = npc_resisted_at && world.time <= npc_resisted_at + within && (!holder || grabber == holder)
. = ..()
- if(amount > 0 && !forced)
- goon_crew()?.member_hurt(src)
+ if(!freed || !isliving(grabber) || QDELETED(grabber) || stat != CONSCIOUS)
+ return
+ INVOKE_ASYNC(src, PROC_REF(goon_shove_off), grabber)
-// Alive, they don't get dragged off anywhere; a body can be.
-/mob/living/basic/bounty_kingpin_goon/can_be_pulled(user, force)
- if(stat != DEAD)
- if(ismob(user))
- balloon_alert(user, "[p_they()] shove[p_s()] you off!")
+/// "Hands off.", and a shove for `grabber`. Sleeps.
+/mob/living/carbon/human/npc/bounty_kingpin_goon/proc/goon_shove_off(mob/living/grabber)
+ if(QDELETED(src) || QDELETED(grabber) || stat != CONSCIOUS)
+ return
+ balloon_alert(grabber, "[p_they()] shove[p_s()] you off!")
+ goon_say("shoved")
+ bounty_kingpin_shove(src, grabber)
+
+/**
+ * `shover` gives `target` a real shove: an empty hand, a right click on them, tg's shove (a step back,
+ * or a stagger against something solid). Nothing if they're out of reach or both hands are full.
+ * Returns TRUE if it was tried.
+ */
+/proc/bounty_kingpin_shove(mob/living/carbon/human/shover, mob/living/target)
+ if(QDELETED(shover) || QDELETED(target) || !shover.Adjacent(target) || !shover.ai_controller)
return FALSE
- return ..()
+ if(HAS_TRAIT(shover, TRAIT_HANDS_BLOCKED) || HAS_TRAIT(shover, TRAIT_INCAPACITATED))
+ return FALSE
+ if(!human_npc_ready_empty_hand(shover))
+ return FALSE
+ INVOKE_ASYNC(shover.ai_controller, TYPE_PROC_REF(/datum/ai_controller, ai_interact), target, TRUE, list(RIGHT_CLICK = TRUE))
+ return TRUE
-// Out of a chair while down or dead, they lie flat as the criminals do
-/mob/living/basic/bounty_kingpin_goon/set_lying_down(new_lying_angle)
- . = ..()
- bounty_body_lie_flat(src, new_lying_angle)
+// ===== THEIR HANDS AND THEIR GUNS =====
-// A goon's body stays for BOUNTY_GOON_FADE, then fades. Nothing drops.
-/mob/living/basic/bounty_kingpin_goon/death(gibbed)
- goon_cancel_windup()
- . = ..()
- if(QDELETED(src))
- return
- // A chair holds a body upright: they slump out of it
- if(istype(buckled, /obj/structure/chair))
- buckled.unbuckle_mob(src, force = TRUE)
- // A body can be dragged about
- move_resist = MOVE_RESIST_DEFAULT
- deltimer(goon_fade_timer)
- goon_fade_timer = addtimer(CALLBACK(src, PROC_REF(goon_fade_out)), BOUNTY_GOON_FADE, TIMER_STOPPABLE | TIMER_DELETE_ME)
-
-/// Their body fades away
-/mob/living/basic/bounty_kingpin_goon/proc/goon_fade_out()
- goon_fade_timer = null
- if(QDELETED(src))
+/// A gun `npc` carries on its body and can draw in a moment (holster, belt, suit storage, back, a pocket): a loaded one first
+/proc/bounty_kingpin_carried_gun(mob/living/carbon/npc)
+ var/obj/item/gun/found
+ for(var/obj/item/gun/gun in npc.get_all_contents_type(/obj/item/gun))
+ if(npc.is_holding(gun) || !human_npc_can_draw(npc, gun))
+ continue
+ if(gun.can_shoot())
+ return gun
+ found ||= gun
+ return found
+
+/// `npc` draws its gun into a free hand, as a person does, and readies it. Returns the gun in its hand, or null.
+/proc/bounty_kingpin_draw_gun(mob/living/carbon/npc)
+ var/obj/item/gun/gun = human_npc_held_gun(npc)
+ if(gun)
+ return gun
+ if(HAS_TRAIT(npc, TRAIT_HANDS_BLOCKED) || HAS_TRAIT(npc, TRAIT_INCAPACITATED))
+ return null
+ gun = bounty_kingpin_carried_gun(npc)
+ if(!gun || !human_npc_take_in_hand(npc, gun))
+ return null
+ human_npc_ready_weapon(npc, gun)
+ human_npc_ready_item(npc, gun)
+ return gun
+
+/// `npc` puts the guns in its hands away on its body (D3: never on the floor)
+/proc/bounty_kingpin_holster_guns(mob/living/carbon/npc)
+ for(var/obj/item/gun/gun in npc.held_items)
+ gun.equip_to_best_slot(npc)
+
+/// Tells `member`'s AI whether its crew's guns are out, so a spent one gets reloaded (and a holstered one drawn again)
+/proc/bounty_kingpin_set_armed(mob/living/member, armed)
+ var/datum/ai_controller/controller = member?.ai_controller
+ if(!controller)
return
- pulledby?.stop_pulling()
- animate(src, alpha = 0, time = BOUNTY_GOON_FADE_OUT)
- addtimer(CALLBACK(src, PROC_REF(goon_gone)), BOUNTY_GOON_FADE_OUT, TIMER_DELETE_ME)
+ if(armed)
+ controller.set_blackboard_key(BB_BOUNTY_KINGPIN_ARMED, TRUE)
+ else
+ controller.clear_blackboard_key(BB_BOUNTY_KINGPIN_ARMED)
+ controller.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET)
-/mob/living/basic/bounty_kingpin_goon/proc/goon_gone()
- qdel(src)
+// =========================================================================
+// THEIR AI
+// =========================================================================
+
+/**
+ * The kingpin's own AI: what his body does by itself. His crew aims and fires for him. First the human
+ * NPC base's soft crit and breaking free (never out of his sofa: P2's bounty_escape_captivity leaves
+ * a chair he sat in alone), then giving up (his surrender rules), keeping his revolver loaded while the
+ * guns are out, and his medipen when he is hurt and nobody is on him. He doesn't wander.
+ */
+/datum/ai_controller/basic_controller/human_npc/bounty_kingpin
+ idle_behavior = null
+ planning_subtrees = list(
+ /datum/ai_planning_subtree/human_npc_soft_crit,
+ /datum/ai_planning_subtree/bounty_escape_captivity,
+ /datum/ai_planning_subtree/human_npc_surrender,
+ /datum/ai_planning_subtree/bounty_kingpin_crew_arms,
+ /datum/ai_planning_subtree/bounty_treat_self,
+ )
/**
- * They leave: their crew is gone (the posting closed), or they ran. They walk toward `exit` and fade
- * out after `time`. Nobody can hurt them on the way out. A body is left to fade on its own.
+ * A goon's own AI: soft crit, breaking free of cuffs, carriers and hard grabs (P2's), the grab answer
+ * for anyone else holding them (CB-22), walking out when they leave, and keeping their gun loaded while
+ * the guns are out. Their crew does the rest. They don't wander.
*/
-/mob/living/basic/bounty_kingpin_goon/proc/goon_leave(turf/exit, time = BOUNTY_GOON_LEAVE_TIME)
- if(goon_leaving || stat == DEAD || QDELETED(src))
+/datum/ai_controller/basic_controller/human_npc/bounty_kingpin_goon
+ idle_behavior = null
+ planning_subtrees = list(
+ /datum/ai_planning_subtree/human_npc_soft_crit,
+ /datum/ai_planning_subtree/bounty_escape_captivity,
+ /datum/ai_planning_subtree/bounty_kingpin_goon_grabbed,
+ /datum/ai_planning_subtree/human_npc_walk_out,
+ /datum/ai_planning_subtree/bounty_kingpin_crew_arms,
+ )
+
+/// Held by anyone outside the crew, even a gentle pull: they resist, and break free with a word and a shove (npc_check_pulled_free())
+/datum/ai_planning_subtree/bounty_kingpin_goon_grabbed
+
+/datum/ai_planning_subtree/bounty_kingpin_goon_grabbed/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon = controller.pawn
+ if(!istype(goon) || goon.stat != CONSCIOUS || HAS_TRAIT(goon, TRAIT_RESTRAINED))
return
- goon_leaving = TRUE
- goon_cancel_windup()
- goon_target_ref = null
- ADD_TRAIT(src, TRAIT_GODMODE, BOUNTY_KINGPIN_TRAIT)
- buckled?.unbuckle_mob(src, force = TRUE)
- if(exit && isturf(loc))
- GLOB.move_manager.jps_move(src, exit, delay = BOUNTY_GOON_STEP, timeout = time, repath_delay = 2 SECONDS, max_path_length = 60, simulated_only = TRUE, priority = MOVEMENT_ABOVE_SPACE_PRIORITY)
- addtimer(CALLBACK(src, PROC_REF(goon_fade_out)), time, TIMER_DELETE_ME)
+ var/mob/living/grabber = goon.pulledby
+ if(!isliving(grabber) || goon.goon_crew()?.is_member(grabber))
+ return
+ controller.queue_behavior(/datum/ai_behavior/resist)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/**
+ * While the crew's guns are out (BB_BOUNTY_KINGPIN_ARMED): a spent gun in hand is reloaded the player's
+ * way from the spares carried, and an empty hand draws the gun again (after giving up, say). Nothing
+ * while at ease: the guns stay holstered.
+ */
+/datum/ai_planning_subtree/bounty_kingpin_crew_arms
+
+/datum/ai_planning_subtree/bounty_kingpin_crew_arms/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/carbon/pawn = controller.pawn
+ if(pawn.stat != CONSCIOUS || HAS_TRAIT(pawn, TRAIT_HANDS_BLOCKED) || LAZYLEN(pawn.do_afters))
+ return
+ if(!controller.blackboard[BB_BOUNTY_KINGPIN_ARMED] || world.time < controller.blackboard[BB_HUMAN_NPC_ARMING_RETRY_AT])
+ return
+ if(ishumannpc(pawn))
+ var/mob/living/carbon/human/npc/npc = pawn
+ if(npc.npc_surrendering)
+ return
+ var/obj/item/gun/gun = human_npc_held_gun(pawn)
+ if(gun?.can_shoot())
+ return
+ if(gun)
+ if(!human_npc_can_reload(pawn, gun))
+ return
+ controller.queue_behavior(/datum/ai_behavior/human_npc_reload/bounty_kingpin_crew)
+ return SUBTREE_RETURN_FINISH_PLANNING
+ var/obj/item/gun/carried = bounty_kingpin_carried_gun(pawn)
+ if(!carried)
+ return
+ controller.set_blackboard_key(BB_HUMAN_NPC_DRAW_ITEM, carried)
+ controller.queue_behavior(/datum/ai_behavior/human_npc_draw, BB_HUMAN_NPC_DRAW_ITEM)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/**
+ * The human NPC base's reload (a spare from a pocket, belt or bag into the free hand, the gun clicked
+ * with it, racked, the empty dropped), with the crew's own line as it starts. A tube or cylinder is
+ * fed what it takes before it is racked, as a person feeds shells one by one.
+ */
+/datum/ai_behavior/human_npc_reload/bounty_kingpin_crew
+ give_up_after = BOUNTY_KINGPIN_RELOAD_GIVE_UP
+
+// Its own start instead of the base's: the same checks and give-up time, with the kingpin's or the goon's line
+/datum/ai_behavior/human_npc_reload/bounty_kingpin_crew/setup(datum/ai_controller/controller)
+ var/mob/living/carbon/npc = controller.pawn
+ var/obj/item/gun/ballistic/gun = human_npc_held_gun(npc)
+ if(!istype(gun))
+ return FALSE
+ controller.set_blackboard_key(BB_HUMAN_NPC_RELOAD_UNTIL, world.time + give_up_after)
+ if(istype(npc, /mob/living/carbon/human/npc/bounty_criminal/kingpin))
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = npc
+ kingpin.kingpin_reload_tell()
+ else
+ npc.visible_message(span_notice("[npc] reloads."), vision_distance = COMBAT_MESSAGE_RANGE)
+ return TRUE
+
+/datum/ai_behavior/human_npc_reload/bounty_kingpin_crew/perform(seconds_per_tick, datum/ai_controller/controller)
+ var/mob/living/carbon/npc = controller.pawn
+ var/obj/item/gun/ballistic/gun = human_npc_held_gun(npc)
+ // Shell by shell into a tube with room left, while there's time to rack it after
+ if(istype(gun) && gun.internal_magazine && gun.magazine && world.time < controller.blackboard[BB_HUMAN_NPC_RELOAD_UNTIL] - 3 SECONDS)
+ if(!human_npc_spent_ammo_in_hand(npc, gun) && human_npc_live_rounds(gun.magazine) < gun.magazine.max_ammo)
+ var/obj/item/ammo = human_npc_find_ammo(npc, gun)
+ if(ammo)
+ if(!npc.is_holding(ammo))
+ if(human_npc_take_in_hand(npc, ammo))
+ return AI_BEHAVIOR_DELAY
+ else if(human_npc_ready_item(npc, ammo))
+ controller.ai_interact(target = gun, combat_mode = FALSE)
+ return AI_BEHAVIOR_DELAY
+ return ..()
// =========================================================================
// HIS CREW: THE ROOM AND THE SHOOTOUT
@@ -972,7 +1108,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
* shootout, and the job he holds for a crew. Owned by the kingpin and deleted with
* him: it lives as long as he does, posting or none. Holds its mobs by weakref. Processes on
* SSfastprocess: at ease it keeps the room lively and watches for known hunters; in a shootout it
- * moves the goons and fires their guns and his.
+ * picks targets, moves the goons and pulls the triggers of the real guns in their hands, and his.
*/
/datum/bounty_kingpin_crew
/// Weakref to the kingpin
@@ -981,6 +1117,10 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
var/turf/crew_seat
/// The goon posts he sat down with, list(list(turf, BOUNTY_GOON_WEAPON_*), ...): an empty one is filled again when he goes on the board
var/list/crew_posts = list()
+ /// Goons on their way to a post (human NPCs are built a body at a time): post turf -> /datum/human_npc_order
+ var/list/crew_pending = list()
+ /// Build new goons at once instead of queueing them (the unit tests)
+ var/crew_immediate = FALSE
/// The job he holds for a crew (a BOUNTY_KINGPIN_JOB mission, not yet taken), or null
var/datum/mission/crew_job
/// Weakref of a ship he offered crew_job to -> world.time the offer lapses
@@ -991,7 +1131,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
var/crew_facing = NORTH
/// Where bystanders and leaving goons go: the lounge's refuge mark, out of the room and away from the lift
var/turf/crew_refuge
- /// Weakrefs to the goons (/mob/living/basic/bounty_kingpin_goon)
+ /// Weakrefs to the goons (/mob/living/carbon/human/npc/bounty_kingpin_goon)
var/list/crew_goons = list()
/// Weakrefs to everyone the crew is fighting: whoever confronted him, attacked any of them, or came with them
var/list/crew_hunters = list()
@@ -1032,20 +1172,20 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
var/crew_next_calm_at = 0
var/crew_next_home_walk = 0
var/crew_next_table_warning = 0
- /// Shots the crew has fired (the unit tests read it)
+ /// Trigger pulls the crew has made (the unit tests read it)
var/crew_shots = 0
-/datum/bounty_kingpin_crew/New(mob/living/basic/bounty_criminal/kingpin/kingpin, turf/seat)
+/datum/bounty_kingpin_crew/New(mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin, turf/seat, immediate = FALSE)
. = ..()
kingpin_ref = WEAKREF(kingpin)
crew_seat = seat || get_turf(kingpin)
+ crew_immediate = immediate
var/obj/structure/chair/sofa = locate(/obj/structure/chair) in crew_seat
if(sofa)
crew_facing = sofa.dir
GLOB.bounty_kingpin_crews += src
- RegisterSignal(kingpin, COMSIG_ATOM_WAS_ATTACKED, PROC_REF(on_member_attacked))
- RegisterSignal(kingpin, COMSIG_PROJECTILE_PREHIT, PROC_REF(on_member_shot))
- RegisterSignals(kingpin, list(COMSIG_BOUNTY_CRIMINAL_DOWNED, COMSIG_LIVING_DEATH, SIGNAL_ADDTRAIT(TRAIT_BOUNTY_SURRENDERED)), PROC_REF(on_boss_fell))
+ watch_member(kingpin)
+ RegisterSignals(kingpin, list(COMSIG_BOUNTY_CRIMINAL_DOWNED, COMSIG_LIVING_DEATH, COMSIG_HUMAN_NPC_SURRENDERED), PROC_REF(on_boss_fell))
RegisterSignal(kingpin, COMSIG_BOUNTY_CRIMINAL_RESTRAINED, PROC_REF(on_boss_restrained))
crew_next_idle_at = world.time + rand(BOUNTY_GOON_IDLE_MIN, BOUNTY_GOON_IDLE_MAX)
crew_next_boss_idle_at = world.time + rand(BOUNTY_KINGPIN_IDLE_MIN, BOUNTY_KINGPIN_IDLE_MAX)
@@ -1054,14 +1194,22 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
/datum/bounty_kingpin_crew/Destroy()
STOP_PROCESSING(SSfastprocess, src)
GLOB.bounty_kingpin_crews -= src
+ // Goons still on their way never arrive
+ for(var/post in crew_pending)
+ qdel(crew_pending[post])
+ crew_pending.Cut()
// The job he held goes with him
drop_job()
restore_room(TRUE)
- // Whoever is still standing leaves; bodies fade on their own
- for(var/mob/living/basic/bounty_kingpin_goon/goon as anything in goons())
+ // Whoever is still alive walks out, for real, as soon as they can; bodies are the corpse sweep's
+ for(var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon as anything in goons())
goon.goon_crew_ref = null
- if(goon.stat != DEAD)
- goon.goon_leave(exit_turf(goon))
+ goon.goon_cancel_windup()
+ if(goon.stat == DEAD)
+ continue
+ bounty_kingpin_set_armed(goon, FALSE)
+ bounty_kingpin_holster_guns(goon)
+ goon_walk_out(goon)
crew_goons.Cut()
crew_hunters.Cut()
crew_hostile_ships.Cut()
@@ -1080,29 +1228,43 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
crew_barkeep_ref = null
return ..()
+/// Listens to `member` (him or a goon) for attacks, shots from things that aren't people, and any damage at all
+/datum/bounty_kingpin_crew/proc/watch_member(mob/living/member)
+ RegisterSignal(member, COMSIG_ATOM_WAS_ATTACKED, PROC_REF(on_member_attacked))
+ RegisterSignal(member, COMSIG_PROJECTILE_PREHIT, PROC_REF(on_member_shot))
+ RegisterSignal(member, COMSIG_MOB_AFTER_APPLY_DAMAGE, PROC_REF(on_member_damaged))
+ RegisterSignals(member, list(COMSIG_LIVING_ADJUST_BRUTE_DAMAGE, COMSIG_LIVING_ADJUST_BURN_DAMAGE), PROC_REF(on_member_adjusted))
+
// ===== WHO IS WHO =====
/// The kingpin, if he still exists
/datum/bounty_kingpin_crew/proc/kingpin()
- RETURN_TYPE(/mob/living/basic/bounty_criminal/kingpin)
- var/mob/living/basic/bounty_criminal/kingpin/kingpin = kingpin_ref?.resolve()
+ RETURN_TYPE(/mob/living/carbon/human/npc/bounty_criminal/kingpin)
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = kingpin_ref?.resolve()
return QDELETED(kingpin) ? null : kingpin
/// The goons that still exist, dead or alive
/datum/bounty_kingpin_crew/proc/goons()
. = list()
for(var/datum/weakref/ref as anything in crew_goons.Copy())
- var/mob/living/basic/bounty_kingpin_goon/goon = ref?.resolve()
+ var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon = ref?.resolve()
if(QDELETED(goon))
crew_goons -= ref
continue
. += goon
-/// The goons still in the fight: alive, not running, not leaving
+/// The goons still in the fight: not dead, in crit or cuffed (human_npc_out_of_fight()), not running, not leaving
/datum/bounty_kingpin_crew/proc/standing_goons()
. = list()
- for(var/mob/living/basic/bounty_kingpin_goon/goon as anything in goons())
- if(goon.stat != DEAD && !goon.goon_fleeing && !goon.goon_leaving)
+ for(var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon as anything in goons())
+ if(!goon.goon_fleeing && isnull(goon.npc_exit) && !human_npc_out_of_fight(goon))
+ . += goon
+
+/// The goons still at their posts, whatever state they are in: alive, not running, not leaving
+/datum/bounty_kingpin_crew/proc/present_goons()
+ . = list()
+ for(var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon as anything in goons())
+ if(goon.stat != DEAD && !goon.goon_fleeing && isnull(goon.npc_exit))
. += goon
/// His crew is down: no goon still in the fight
@@ -1115,7 +1277,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
return FALSE
if(thing == kingpin())
return TRUE
- var/mob/living/basic/bounty_kingpin_goon/goon = thing
+ var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon = thing
return istype(goon) && goon.goon_crew_ref?.resolve() == src
/// Whether the crew is fighting `who`
@@ -1135,7 +1297,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
/datum/bounty_kingpin_crew/proc/add_hunter(mob/living/who)
if(!isliving(who) || QDELETED(who) || is_member(who))
return FALSE
- if(istype(who, /mob/living/basic/bounty_criminal) || istype(who, /mob/living/basic/bounty_companion))
+ if(istype(who, /mob/living/carbon/human/npc/bounty_criminal) || istype(who, /mob/living/carbon/human/npc/bounty_companion))
return FALSE
var/datum/weakref/ref = WEAKREF(who)
if(ref in crew_hunters)
@@ -1233,18 +1395,44 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
// ===== THE GOONS =====
-/// A goon with `weapon` at `post`, sitting if there is a chair there, facing the talk spot
-/datum/bounty_kingpin_crew/proc/spawn_goon(turf/post, weapon = BOUNTY_GOON_WEAPON_PISTOL)
+/**
+ * A goon with `weapon` (BOUNTY_GOON_WEAPON_*) for `post`, sitting if there is a chair there, facing
+ * the talk spot. A real human, so it goes through the human NPC spawn queue: `immediate` builds it now
+ * and returns it, else it is queued (one post at a time) and joins the crew when it is built, and this
+ * returns null.
+ */
+/datum/bounty_kingpin_crew/proc/spawn_goon(turf/post, weapon = BOUNTY_GOON_WEAPON_PISTOL, immediate = TRUE)
if(!post)
return null
- var/mob/living/basic/bounty_criminal/kingpin/kingpin = kingpin_ref?.resolve()
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = kingpin_ref?.resolve()
var/datum/npc_spawn_context/context = new(kingpin || post, null, "ordinary", source_turf = post)
- var/mob/living/basic/bounty_kingpin_goon/goon = spawn_npc_in_zone(/mob/living/basic/bounty_kingpin_goon, post, context, FALSE)
+ var/goon_type = bounty_kingpin_goon_type(weapon)
+ if(!immediate)
+ if(crew_pending[post])
+ return null
+ crew_pending[post] = spawn_human_npc(goon_type, post, CALLBACK(src, PROC_REF(goon_arrived), post, weapon), context = context)
+ return null
+ var/datum/human_npc_order/order = spawn_human_npc(goon_type, post, context = context, immediate = TRUE)
+ var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon = order?.spawned_ref?.resolve()
+ qdel(order)
+ if(QDELETED(goon))
+ return null
+ goon_joined(goon, post, weapon)
+ return goon
+
+/// A queued goon for `post` has been built: he takes his post
+/datum/bounty_kingpin_crew/proc/goon_arrived(turf/post, weapon, mob/living/carbon/human/npc/bounty_kingpin_goon/goon)
+ crew_pending -= post
+ if(QDELETED(goon))
+ return
+ goon_joined(goon, post, weapon)
+
+/// `goon` takes `post` with `weapon`: in its chair, or facing the talk spot, one of the crew. A fight on already: he draws.
+/datum/bounty_kingpin_crew/proc/goon_joined(mob/living/carbon/human/npc/bounty_kingpin_goon/goon, turf/post, weapon)
goon.goon_weapon = weapon
goon.goon_post = post
- goon.goon_rounds = bounty_kingpin_goon_mag(weapon)
if(crew_seat && get_dist(post, crew_seat) <= 3)
- goon.name = "bodyguard"
+ goon.fully_replace_character_name(goon.real_name, "bodyguard")
var/obj/structure/chair/chair = locate(/obj/structure/chair) in post
if(chair && !chair.has_buckled_mobs() && chair.buckle_mob(goon, force = TRUE))
goon.goon_chair_ref = WEAKREF(chair)
@@ -1258,15 +1446,14 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
goon.goon_post_dir = facing || SOUTH
goon.setDir(goon.goon_post_dir)
add_goon(goon)
- context.finalize()
- return goon
+ if(is_fighting())
+ goon_draw(goon)
/// Makes `goon` one of the crew
-/datum/bounty_kingpin_crew/proc/add_goon(mob/living/basic/bounty_kingpin_goon/goon)
+/datum/bounty_kingpin_crew/proc/add_goon(mob/living/carbon/human/npc/bounty_kingpin_goon/goon)
goon.goon_crew_ref = WEAKREF(src)
crew_goons |= WEAKREF(goon)
- RegisterSignal(goon, COMSIG_ATOM_WAS_ATTACKED, PROC_REF(on_member_attacked))
- RegisterSignal(goon, COMSIG_PROJECTILE_PREHIT, PROC_REF(on_member_shot))
+ watch_member(goon)
/// Where hunters stand to talk to him: two tiles out from the sofa, across the table
/datum/bounty_kingpin_crew/proc/talk_spot()
@@ -1275,12 +1462,23 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
var/turf/front = get_step(crew_seat, crew_facing)
return front ? (get_step(front, crew_facing) || front) : crew_seat
+/// `goon` walks out of the lounge for real (the human NPC base's npc_walk_out()): gone at the exit, or once nobody can see him
+/datum/bounty_kingpin_crew/proc/goon_walk_out(mob/living/carbon/human/npc/bounty_kingpin_goon/goon, turf/exit)
+ exit ||= exit_turf(goon)
+ if(!exit || goon.stat == DEAD)
+ return FALSE
+ goon.goon_cancel_windup()
+ goon.goon_target_ref = null
+ if(istype(goon.buckled, /obj/structure/chair))
+ goon.buckled.unbuckle_mob(goon)
+ return goon.npc_walk_out(exit)
+
// ===== THE ROOM =====
/**
* Finds the room around the sofa: the coffee table in front of it and the tables at the goons' posts
* (breakable while he is here, and put back if missing), the barkeep who can see the
- * sofa, and the refuge.
+ * sofa, and the refuge. Reads the posts, not the goons: they may still be on their way.
*/
/datum/bounty_kingpin_crew/proc/find_room()
if(!crew_seat)
@@ -1293,9 +1491,10 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
if(spot)
coffee_spots += spot
var/list/table_spots = coffee_spots.Copy()
- for(var/mob/living/basic/bounty_kingpin_goon/goon as anything in goons())
+ for(var/list/post as anything in crew_posts)
+ var/turf/post_turf = post[1]
for(var/direction in GLOB.cardinals)
- var/turf/spot = get_step(goon.goon_post, direction)
+ var/turf/spot = get_step(post_turf, direction)
if(spot && !(spot in table_spots))
table_spots += spot
for(var/turf/spot as anything in table_spots)
@@ -1377,11 +1576,14 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
else
make_table_breakable(table)
-/// Somewhere out of the lounge for `mover` to walk to: the refuge mark, never the hangar lift (M5)
+/// Somewhere out of the lounge for `mover` to walk to: the refuge mark, never the hangar lift (M5). With no refuge (a test room): straight on out from the sofa past them.
/datum/bounty_kingpin_crew/proc/exit_turf(atom/mover)
if(crew_refuge)
return crew_refuge
- return null
+ var/turf/here = get_turf(mover)
+ if(!crew_seat || !here || here == crew_seat || here.z != crew_seat.z)
+ return null
+ return get_ranged_target_turf_direct(crew_seat, here, BOUNTY_KINGPIN_SIGHT + BOUNTY_GOON_LEASH)
// ===== HIS BUSINESS =====
@@ -1426,7 +1628,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
qdel(job)
crew_job_retry_at = world.time + BOUNTY_KINGPIN_JOB_RETRY
return null
- var/mob/living/basic/bounty_criminal/kingpin/kingpin = kingpin()
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = kingpin()
if(kingpin)
job.author = kingpin.kingpin_job_name()
job.update_text()
@@ -1494,20 +1696,21 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
/**
* He goes on the board with his crew at ease: every post he sat down with whose goon is dead or gone
- * (fled, walked out) gets a new goon. Nothing mid-fight. Returns the goons it placed.
+ * (fled, walked out) gets a new goon, through the human NPC spawn queue (at once in the tests).
+ * Nothing mid-fight. Returns the goons it placed at once.
*/
/datum/bounty_kingpin_crew/proc/restaff()
. = list()
if(crew_state != BOUNTY_KINGPIN_CALM)
return
var/list/manned = list()
- for(var/mob/living/basic/bounty_kingpin_goon/goon as anything in standing_goons())
+ for(var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon as anything in present_goons())
manned |= goon.goon_post
for(var/list/post as anything in crew_posts)
var/turf/spot = post[1]
- if(!spot || (spot in manned))
+ if(!spot || (spot in manned) || crew_pending[spot])
continue
- var/mob/living/basic/bounty_kingpin_goon/goon = spawn_goon(spot, post[2])
+ var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon = spawn_goon(spot, post[2], crew_immediate)
if(goon)
manned |= spot
. += goon
@@ -1521,9 +1724,9 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
if(!length(people))
return
if(!(attack_flags & (ATTACKER_DAMAGING_ATTACK | ATTACKER_STAMINA_ATTACK)))
- if((attack_flags & ATTACKER_SHOVING) && istype(source, /mob/living/basic/bounty_kingpin_goon))
- var/mob/living/basic/bounty_kingpin_goon/goon = source
- INVOKE_ASYNC(goon, TYPE_PROC_REF(/mob/living/basic/bounty_kingpin_goon, goon_say), "shoved")
+ if((attack_flags & ATTACKER_SHOVING) && istype(source, /mob/living/carbon/human/npc/bounty_kingpin_goon))
+ var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon = source
+ INVOKE_ASYNC(goon, TYPE_PROC_REF(/mob/living/carbon/human/npc/bounty_kingpin_goon, goon_say), "shoved")
return
member_attacked(source, people)
@@ -1540,6 +1743,18 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
if(length(people))
member_attacked(source, people)
+/// Him or a goon took brute or burn through tg's apply_damage (a hit to a limb, a bullet, a blade)
+/datum/bounty_kingpin_crew/proc/on_member_damaged(mob/living/source, damage, damagetype, def_zone, blocked)
+ SIGNAL_HANDLER
+ if(damage > 0 && (damagetype == BRUTE || damagetype == BURN))
+ member_hurt(source)
+
+/// Him or a goon took brute or burn straight to the body (fire, a blast, a chemical)
+/datum/bounty_kingpin_crew/proc/on_member_adjusted(mob/living/source, damagetype, amount, forced)
+ SIGNAL_HANDLER
+ if(amount > 0 && !forced)
+ member_hurt(source)
+
/// A hunter fired: at his crew, it's part of the fight (their stray shots take no outpost strike)
/datum/bounty_kingpin_crew/proc/on_hunter_fired(mob/living/source, obj/projectile/shot, atom/fired_from, atom/original)
SIGNAL_HANDLER
@@ -1556,11 +1771,11 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
/**
* `member` (him or a goon) was attacked by `people`: they are hunters now, a goon drawing or
- * winding up fumbles, and if all was calm the shootout starts. Someone the crew won't fight (another
- * criminal) sets nothing off (L6). Doesn't sleep.
+ * winding up fumbles, his aim is spoiled, and if all was calm the shootout starts. Someone the crew
+ * won't fight (another criminal) sets nothing off (L6). Doesn't sleep.
*/
/datum/bounty_kingpin_crew/proc/member_attacked(atom/member, list/people)
- var/mob/living/basic/bounty_criminal/kingpin/kingpin = kingpin()
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = kingpin()
var/mob/living/first
for(var/mob/living/person as anything in people)
if(QDELETED(person) || is_member(person))
@@ -1573,8 +1788,11 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
kingpin.kingpin_note_hit(person)
if(!first)
return
- if(istype(member, /mob/living/basic/bounty_kingpin_goon))
+ if(istype(member, /mob/living/carbon/human/npc/bounty_kingpin_goon))
goon_hit(member)
+ else if(member == kingpin)
+ // A hit while he aims: "[src] fumbles the shot."
+ kingpin.kingpin_fumble()
if(crew_state == BOUNTY_KINGPIN_CALM)
start_shootout(first, FALSE)
@@ -1596,7 +1814,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
for(var/mob/living/person in range(BOUNTY_GOON_LEASH, member))
if(person.stat != CONSCIOUS || !(person.mind || person.client) || is_member(person))
continue
- if(istype(person, /mob/living/basic/bounty_criminal) || istype(person, /mob/living/basic/bounty_companion))
+ if(istype(person, /mob/living/carbon/human/npc/bounty_criminal) || istype(person, /mob/living/carbon/human/npc/bounty_companion))
continue
if(SSbounty_kingpin.kingpin_mind_bound(person.mind) && !is_hunter(person))
continue
@@ -1607,7 +1825,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
if(suspect)
member_attacked(member, list(suspect))
-/// He fell (downed, gave up, died): his aim drops, and half the goons left run (once a fight)
+/// He fell (in crit, gave up, died): his aim drops, and half the goons left run (once a fight)
/datum/bounty_kingpin_crew/proc/on_boss_fell(datum/source)
SIGNAL_HANDLER
kingpin()?.kingpin_cancel_aim()
@@ -1630,7 +1848,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
var/list/standing = sortTim(standing_goons(), GLOBAL_PROC_REF(cmp_bounty_kingpin_goon_health))
var/fleeing = floor(length(standing) * BOUNTY_GOON_FLEE_ON_BOSS / 100)
for(var/i in 1 to fleeing)
- var/mob/living/basic/bounty_kingpin_goon/goon = standing[i]
+ var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon = standing[i]
goon_flee(goon)
. += goon
@@ -1638,27 +1856,32 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
/proc/cmp_bounty_kingpin_goon_health(mob/living/first, mob/living/second)
return first.health - second.health
-/// `goon` runs for it: away from the nearest hunter, and gone after BOUNTY_GOON_FLEE_TIME
-/datum/bounty_kingpin_crew/proc/goon_flee(mob/living/basic/bounty_kingpin_goon/goon)
+/**
+ * `goon` runs for it (CB-16): his gun goes away, his line, and he walks out for real (npc_walk_out()),
+ * to the refuge, else away from the nearest hunter. Shots still land on the way; he is gone only on
+ * the exit tile or once nobody can see him.
+ */
+/datum/bounty_kingpin_crew/proc/goon_flee(mob/living/carbon/human/npc/bounty_kingpin_goon/goon)
if(goon.goon_fleeing || goon.stat == DEAD)
return
goon.goon_fleeing = TRUE
goon.goon_cancel_windup()
goon.goon_target_ref = null
- INVOKE_ASYNC(goon, TYPE_PROC_REF(/mob/living/basic/bounty_kingpin_goon, goon_say), "flee")
- var/mob/living/nearest
- for(var/mob/living/hunter as anything in live_hunters())
- if(!nearest || get_dist(goon, hunter) < get_dist(goon, nearest))
- nearest = hunter
- if(nearest && isturf(goon.loc))
- GLOB.move_manager.move_away(goon, nearest, BOUNTY_KINGPIN_SIGHT + BOUNTY_GOON_LEASH, BOUNTY_GOON_STEP, BOUNTY_GOON_FLEE_TIME, priority = MOVEMENT_ABOVE_SPACE_PRIORITY)
- else
- goon.goon_leave(exit_turf(goon), BOUNTY_GOON_FLEE_TIME)
- return
- addtimer(CALLBACK(goon, TYPE_PROC_REF(/mob/living/basic/bounty_kingpin_goon, goon_leave), null, 1), BOUNTY_GOON_FLEE_TIME, TIMER_DELETE_ME)
+ bounty_kingpin_set_armed(goon, FALSE)
+ bounty_kingpin_holster_guns(goon)
+ INVOKE_ASYNC(goon, TYPE_PROC_REF(/mob/living/carbon/human/npc/bounty_kingpin_goon, goon_say), "flee")
+ var/turf/exit = crew_refuge
+ if(!exit)
+ var/mob/living/nearest
+ for(var/mob/living/hunter as anything in live_hunters())
+ if(!nearest || get_dist(goon, hunter) < get_dist(goon, nearest))
+ nearest = hunter
+ if(nearest && get_turf(nearest) != get_turf(goon))
+ exit = get_ranged_target_turf_direct(goon, nearest, BOUNTY_KINGPIN_SIGHT + BOUNTY_GOON_LEASH, 180)
+ goon_walk_out(goon, exit)
/// A goon was hit: drawing, he fumbles his first shot; winding up, he loses the burst or the blast
-/datum/bounty_kingpin_crew/proc/goon_hit(mob/living/basic/bounty_kingpin_goon/goon)
+/datum/bounty_kingpin_crew/proc/goon_hit(mob/living/carbon/human/npc/bounty_kingpin_goon/goon)
if(goon.stat != CONSCIOUS)
return
if(crew_state == BOUNTY_KINGPIN_DRAWING)
@@ -1675,7 +1898,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
/datum/bounty_kingpin_crew/proc/can_fight()
if(kingpin()?.kingpin_able())
return TRUE
- for(var/mob/living/basic/bounty_kingpin_goon/goon as anything in standing_goons())
+ for(var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon as anything in standing_goons())
if(goon.stat == CONSCIOUS)
return TRUE
return FALSE
@@ -1683,10 +1906,10 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
/**
* The shootout starts, set off by `instigator` ("We're here for you" when `confronted`, else an
* attack): the telegraph. For BOUNTY_KINGPIN_TELEGRAPH nobody in the crew fires: the goons reach
- * for their guns, the table goons flip their tables, he kicks the coffee table over and the
- * barkeep shouts. The instigator and their shipmates nearby are hunters now. It
- * puts nobody on the board. Nothing starts when the crew won't fight the instigator (L6) or nobody
- * can shoot. Doesn't sleep. Returns TRUE if it started.
+ * for their guns (and draw them), the table goons flip their tables, he draws his and kicks the
+ * coffee table over and the barkeep shouts. The instigator and their shipmates nearby are hunters
+ * now. It puts nobody on the board. Nothing starts when the crew won't fight the instigator (L6) or
+ * nobody can shoot. Doesn't sleep. Returns TRUE if it started.
*/
/datum/bounty_kingpin_crew/proc/start_shootout(mob/living/instigator, confronted = FALSE)
add_hunter(instigator)
@@ -1698,38 +1921,41 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
crew_last_contact_at = world.time
crew_lead = null
crew_boss_fell = FALSE
- var/mob/living/basic/bounty_criminal/kingpin/kingpin = kingpin()
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = kingpin()
if(kingpin?.stat == CONSCIOUS)
kingpin.kingpin_cancel_aim()
INVOKE_ASYNC(kingpin, TYPE_PROC_REF(/mob/living, bounty_say), confronted ? "confront" : "attacked", null, TRUE)
crew_seat?.visible_message(span_userdanger("The goons reach for their guns!"), vision_distance = BOUNTY_KINGPIN_SIGHT)
crew_armed = TRUE
if(kingpin)
- INVOKE_ASYNC(kingpin, TYPE_PROC_REF(/mob/living/basic/bounty_criminal, body_dress))
kingpin.kingpin_next_aim_at = crew_draw_ends_at
- for(var/mob/living/basic/bounty_kingpin_goon/goon as anything in standing_goons())
+ bounty_kingpin_set_armed(kingpin, TRUE)
+ if(kingpin.kingpin_able())
+ bounty_kingpin_draw_gun(kingpin)
+ for(var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon as anything in standing_goons())
goon_draw(goon)
kick_table()
clear_room()
log_game("BOUNTY: [key_name(instigator)] started a shootout with [kingpin || "the kingpin's crew"] at [AREACOORD(crew_seat)] ([confronted ? "a confrontation" : "an attack"])")
return TRUE
-/// `goon` reaches for his gun: the telegraph box, the sound, out of his chair, his table over
-/datum/bounty_kingpin_crew/proc/goon_draw(mob/living/basic/bounty_kingpin_goon/goon)
- goon.goon_arm(TRUE)
+/// `goon` reaches for his gun: the telegraph box, the sound, out of his chair, the real gun into his hand, his table over
+/datum/bounty_kingpin_crew/proc/goon_draw(mob/living/carbon/human/npc/bounty_kingpin_goon/goon)
goon.goon_cancel_windup()
goon.goon_target_ref = null
- goon.goon_rounds = bounty_kingpin_goon_mag(goon.goon_weapon)
goon.goon_next_fire_at = crew_draw_ends_at
+ bounty_kingpin_set_armed(goon, TRUE)
var/turf/spot = get_turf(goon)
if(spot)
new /obj/effect/temp_visual/telegraphing/bounty_kingpin(spot)
playsound(goon, 'sound/items/weapons/gun/pistol/rack.ogg', 50, TRUE)
if(goon.buckled)
goon.buckled.unbuckle_mob(goon, force = TRUE)
+ if(goon.goon_able())
+ bounty_kingpin_draw_gun(goon)
goon_flip_table(goon)
if(prob(40))
- INVOKE_ASYNC(goon, TYPE_PROC_REF(/mob/living/basic/bounty_kingpin_goon, goon_say), "draw")
+ INVOKE_ASYNC(goon, TYPE_PROC_REF(/mob/living/carbon/human/npc/bounty_kingpin_goon, goon_say), "draw")
/// Flips `table` toward `direction`: a table someone else knocked over the wrong way is set up first (H2)
/datum/bounty_kingpin_crew/proc/flip_our_way(obj/structure/table/table, direction)
@@ -1745,7 +1971,9 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
return TRUE
/// A goon at a table kicks it over for cover, away from himself. Never the coffee table: that's his.
-/datum/bounty_kingpin_crew/proc/goon_flip_table(mob/living/basic/bounty_kingpin_goon/goon)
+/datum/bounty_kingpin_crew/proc/goon_flip_table(mob/living/carbon/human/npc/bounty_kingpin_goon/goon)
+ if(!goon.goon_able())
+ return null
for(var/direction in GLOB.cardinals)
var/turf/spot = get_step(goon, direction)
var/obj/structure/table/table = locate(/obj/structure/table) in spot
@@ -1759,7 +1987,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
/// He kicks the coffee table over, toward the hunters: his shots go over it, theirs hit it
/datum/bounty_kingpin_crew/proc/kick_table()
- var/mob/living/basic/bounty_criminal/kingpin/kingpin = kingpin()
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = kingpin()
if(!kingpin?.kingpin_able())
return FALSE
var/kicked = FALSE
@@ -1795,7 +2023,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
var/list/goons = shuffle(standing_goons())
var/count = length(goons)
for(var/i in 1 to count)
- var/mob/living/basic/bounty_kingpin_goon/goon = goons[i]
+ var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon = goons[i]
var/offset = count > 1 ? round(BOUNTY_KINGPIN_FIRST_SHOT_SPREAD * (i - 1) / (count - 1), 1) : 0
goon.goon_next_fire_at = max(crew_draw_ends_at + offset, goon.goon_fumbled_until)
goon.goon_target_ref = null
@@ -1806,26 +2034,28 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
crew_lead = null
crew_armed = FALSE
crew_engaged.Cut()
- var/mob/living/basic/bounty_criminal/kingpin/kingpin = kingpin()
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = kingpin()
if(kingpin)
kingpin.kingpin_cancel_aim()
- INVOKE_ASYNC(kingpin, TYPE_PROC_REF(/mob/living/basic/bounty_criminal, body_dress))
+ bounty_kingpin_set_armed(kingpin, FALSE)
+ bounty_kingpin_holster_guns(kingpin)
if(kingpin.kingpin_able())
INVOKE_ASYNC(kingpin, TYPE_PROC_REF(/mob/living, bounty_say), "stand_down", null, TRUE)
- for(var/mob/living/basic/bounty_kingpin_goon/goon as anything in standing_goons())
+ for(var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon as anything in present_goons())
goon.goon_cancel_windup()
goon.goon_target_ref = null
- goon.goon_arm(FALSE)
+ bounty_kingpin_set_armed(goon, FALSE)
+ bounty_kingpin_holster_guns(goon)
restore_room()
log_game("BOUNTY: [kingpin || "the kingpin's crew"] stood down at [AREACOORD(crew_seat)]")
/**
* With him gone (padded or deleted) or carried off his leash, there is nobody left to guard: the
- * goons still standing walk out. Cuffed or dead on his sofa, they stay with him (M2). Returns TRUE if
- * they left.
+ * goons still standing walk out, for real. Cuffed, in crit or dead on his sofa, they stay with him
+ * (M2). Returns TRUE if they left.
*/
/datum/bounty_kingpin_crew/proc/dismiss_if_boss_gone()
- var/mob/living/basic/bounty_criminal/kingpin/kingpin = kingpin()
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = kingpin()
if(kingpin)
var/turf/here = get_turf(kingpin)
var/on_leash = here && crew_seat && here.z == crew_seat.z && get_dist(here, crew_seat) <= BOUNTY_GOON_LEASH
@@ -1834,25 +2064,24 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
var/list/leaving = standing_goons()
if(!length(leaving))
return FALSE
- for(var/mob/living/basic/bounty_kingpin_goon/goon as anything in leaving)
- goon.goon_leave(exit_turf(goon))
- return TRUE
+ . = FALSE
+ for(var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon as anything in leaving)
+ bounty_kingpin_set_armed(goon, FALSE)
+ bounty_kingpin_holster_guns(goon)
+ if(goon_walk_out(goon))
+ . = TRUE
// ===== THE TICK =====
/datum/bounty_kingpin_crew/process(seconds_per_tick)
- var/mob/living/basic/bounty_criminal/kingpin/kingpin = kingpin()
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = kingpin()
if(!kingpin)
return PROCESS_KILL
- if(!kingpin.kingpin_posting())
- // With no posting to answer for him (L10): nowhere at all (nullspace) is gone for good
- if(!get_turf(kingpin))
- log_game("BOUNTY: [kingpin] was cleared away from nowhere")
- qdel(kingpin)
- return PROCESS_KILL
- // A body nobody can bring in (killed off the board, or its proof went up at a chasm's edge) fades
- if(kingpin.stat == DEAD)
- kingpin.kingpin_start_fade()
+ // With no posting to answer for him (L10): nowhere at all (nullspace) is gone for good
+ if(!kingpin.kingpin_posting() && !get_turf(kingpin))
+ log_game("BOUNTY: [kingpin] was cleared away from nowhere")
+ qdel(kingpin)
+ return PROCESS_KILL
// The pad is taking him, or a posting is clearing him away
if(HAS_TRAIT(kingpin, TRAIT_BOUNTY_REMOVED))
return
@@ -1871,10 +2100,10 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
/datum/bounty_kingpin_crew/proc/fight_tick()
var/list/hunters = live_hunters()
var/contact = FALSE
- for(var/mob/living/basic/bounty_kingpin_goon/goon as anything in standing_goons())
+ for(var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon as anything in standing_goons())
if(goon_tick(goon, hunters))
contact = TRUE
- var/mob/living/basic/bounty_criminal/kingpin/kingpin = kingpin()
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = kingpin()
if(kingpin && boss_tick(kingpin, hunters))
contact = TRUE
if(contact)
@@ -1896,7 +2125,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
crew_lead_at = world.time
/// One goon's turn: pick a target, close in or shoot, or go looking. Returns TRUE if he sees a hunter.
-/datum/bounty_kingpin_crew/proc/goon_tick(mob/living/basic/bounty_kingpin_goon/goon, list/hunters)
+/datum/bounty_kingpin_crew/proc/goon_tick(mob/living/carbon/human/npc/bounty_kingpin_goon/goon, list/hunters)
if(goon.stat != CONSCIOUS)
goon.goon_cancel_windup()
return FALSE
@@ -1921,10 +2150,10 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
return length(visible) > 0
/// Whether `goon` is one of the BOUNTY_KINGPIN_MAX_ON_ONE goons nearest the lead, the ones who go looking
-/datum/bounty_kingpin_crew/proc/goon_is_seeker(mob/living/basic/bounty_kingpin_goon/goon)
+/datum/bounty_kingpin_crew/proc/goon_is_seeker(mob/living/carbon/human/npc/bounty_kingpin_goon/goon)
var/my_dist = get_dist(goon, crew_lead)
var/closer = 0
- for(var/mob/living/basic/bounty_kingpin_goon/other as anything in standing_goons())
+ for(var/mob/living/carbon/human/npc/bounty_kingpin_goon/other as anything in standing_goons())
if(other == goon || !other.goon_able())
continue
if(get_dist(other, crew_lead) < my_dist)
@@ -1936,7 +2165,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
* opening volley, and whenever a hunter is in cover, at most BOUNTY_KINGPIN_MAX_ON_ONE goons draw
* on one hunter.
*/
-/datum/bounty_kingpin_crew/proc/goon_choose_target(mob/living/basic/bounty_kingpin_goon/goon, list/visible)
+/datum/bounty_kingpin_crew/proc/goon_choose_target(mob/living/carbon/human/npc/bounty_kingpin_goon/goon, list/visible)
if(!length(visible))
return null
var/opening = world.time < crew_draw_ends_at + BOUNTY_KINGPIN_FIRST_SHOT_SPREAD
@@ -1955,22 +2184,25 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
return best
/// Whether enough other goons are drawing on `hunter` already that `goon` should pick someone else
-/datum/bounty_kingpin_crew/proc/target_full(mob/living/hunter, mob/living/basic/bounty_kingpin_goon/goon, opening)
+/datum/bounty_kingpin_crew/proc/target_full(mob/living/hunter, mob/living/carbon/human/npc/bounty_kingpin_goon/goon, opening)
if(!opening && !in_cover(hunter))
return FALSE
return goons_on(hunter, goon) >= BOUNTY_KINGPIN_MAX_ON_ONE
/// How many goons other than `except` are drawing on `hunter`
-/datum/bounty_kingpin_crew/proc/goons_on(mob/living/hunter, mob/living/basic/bounty_kingpin_goon/except)
+/datum/bounty_kingpin_crew/proc/goons_on(mob/living/hunter, mob/living/carbon/human/npc/bounty_kingpin_goon/except)
var/count = 0
- for(var/mob/living/basic/bounty_kingpin_goon/goon as anything in standing_goons())
+ for(var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon as anything in standing_goons())
if(goon != except && goon.goon_target_ref?.resolve() == hunter)
count++
return count
-/// One step for `goon` toward `destination`, never past his leash from the sofa. Returns TRUE if he moved.
-/datum/bounty_kingpin_crew/proc/goon_step_toward(mob/living/basic/bounty_kingpin_goon/goon, turf/destination)
- if(!destination || !crew_seat || world.time < goon.goon_next_move_at || goon.buckled || !isturf(goon.loc))
+/**
+ * One real step for `goon` toward `destination`, never past his leash from the sofa, and never faster
+ * than his body walks (wounds, armour and stamina slow him as they slow anyone). Returns TRUE if he moved.
+ */
+/datum/bounty_kingpin_crew/proc/goon_step_toward(mob/living/carbon/human/npc/bounty_kingpin_goon/goon, turf/destination)
+ if(!destination || !crew_seat || world.time < goon.goon_next_move_at || goon.buckled || !isturf(goon.loc) || goon.pulledby)
return FALSE
if(get_turf(goon) == destination)
return FALSE
@@ -1979,24 +2211,42 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
return FALSE
if(next.z != crew_seat.z || get_dist(next, crew_seat) > BOUNTY_GOON_LEASH)
return FALSE
- goon.goon_next_move_at = world.time + BOUNTY_GOON_STEP
+ goon.goon_next_move_at = world.time + max(BOUNTY_GOON_STEP, goon.cached_multiplicative_slowdown)
return goon.Move(next, get_dir(goon, next))
+/// A sidestep for a clear line on `target`: an open tile next to `goon`, no further from them, from which nobody he isn't fighting is in the way
+/datum/bounty_kingpin_crew/proc/goon_sidestep(mob/living/carbon/human/npc/bounty_kingpin_goon/goon, atom/target)
+ var/turf/here = get_turf(goon)
+ var/turf/there = get_turf(target)
+ if(!here || !there)
+ return FALSE
+ var/list/spots = list()
+ for(var/direction in GLOB.alldirs)
+ var/turf/spot = get_step(here, direction)
+ if(!spot || spot == there || spot.is_blocked_turf(exclude_mobs = FALSE) || get_dist(spot, there) > get_dist(here, there))
+ continue
+ if(line_blocked(spot, target))
+ continue
+ spots += spot
+ if(!length(spots))
+ return FALSE
+ return goon_step_toward(goon, pick(spots))
+
/**
- * `goon` tries to shoot `target`. Nobody fires while the crew is drawing. A pistol fires at once; an
- * SMG spins up (BOUNTY_GOON_SMG_WINDUP) and a shotgun pumps (BOUNTY_GOON_SHOTGUN_WINDUP) first, and
- * a hit in the meantime spoils it. An empty gun reloads. Returns TRUE if a shot or a wind-up started.
+ * `goon` tries to shoot `target`. Nobody fires while the crew is drawing, and only with a loaded gun
+ * in hand: a spent one is his AI's to reload. A pistol fires at once; an SMG spins up
+ * (BOUNTY_GOON_SMG_WINDUP) and a shotgun pumps (BOUNTY_GOON_SHOTGUN_WINDUP) first, and a hit in the
+ * meantime spoils it. Returns TRUE if a shot or a wind-up started.
*/
-/datum/bounty_kingpin_crew/proc/goon_try_attack(mob/living/basic/bounty_kingpin_goon/goon, mob/living/target)
+/datum/bounty_kingpin_crew/proc/goon_try_attack(mob/living/carbon/human/npc/bounty_kingpin_goon/goon, mob/living/target)
if(crew_state != BOUNTY_KINGPIN_FIGHTING || !goon.goon_able() || !valid_target(target))
return FALSE
if(goon.goon_windup_timer || world.time < goon.goon_next_fire_at || world.time < goon.goon_fumbled_until)
return FALSE
- if(goon.goon_rounds <= 0)
- goon.goon_rounds = bounty_kingpin_goon_mag(goon.goon_weapon)
- goon.goon_next_fire_at = world.time + bounty_kingpin_goon_reload(goon.goon_weapon)
- goon.visible_message(span_notice("[goon] reloads."), vision_distance = COMBAT_MESSAGE_RANGE)
- playsound(goon, 'sound/items/weapons/gun/general/magazine_insert_full.ogg', 40, TRUE)
+ if(!human_npc_loaded_gun(goon))
+ return FALSE
+ if(line_blocked(goon, shot_target(target)))
+ goon_sidestep(goon, target)
return FALSE
switch(goon.goon_weapon)
if(BOUNTY_GOON_WEAPON_SMG)
@@ -2010,13 +2260,18 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
goon.visible_message(span_warning("[goon] pumps [goon.p_their()] shotgun."), vision_distance = COMBAT_MESSAGE_RANGE)
goon.goon_windup_timer = addtimer(CALLBACK(src, PROC_REF(goon_finish_windup), WEAKREF(goon), WEAKREF(target)), BOUNTY_GOON_SHOTGUN_WINDUP, TIMER_STOPPABLE | TIMER_DELETE_ME)
else
+ // Single shots off the Stechkin's own selector, in strings with a pause between them; an empty magazine reloads instead
+ var/obj/item/gun/ballistic/pistol = human_npc_loaded_gun(goon)
+ bounty_gun_single_fire(goon, pistol)
goon.goon_next_fire_at = world.time + BOUNTY_GOON_PISTOL_COOLDOWN
- goon_fire(goon, target)
+ var/rounds = bounty_gun_live_rounds(pistol)
+ if(goon_fire(goon, target) && bounty_gun_live_rounds(pistol) < rounds && goon.goon_string_shot(pistol))
+ goon.goon_next_fire_at += BOUNTY_PISTOL_STRING_PAUSE
return TRUE
/// The wind-up is done: the SMG's burst or the shotgun's blast, if he still can and still sees them
/datum/bounty_kingpin_crew/proc/goon_finish_windup(datum/weakref/goon_ref, datum/weakref/target_ref)
- var/mob/living/basic/bounty_kingpin_goon/goon = goon_ref?.resolve()
+ var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon = goon_ref?.resolve()
if(QDELETED(goon))
return
goon.goon_windup_timer = null
@@ -2027,27 +2282,70 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
if(get_dist(goon, target) <= BOUNTY_GOON_SHOTGUN_RANGE)
goon_fire(goon, target)
return
- goon_fire(goon, target)
- for(var/shot in 2 to BOUNTY_GOON_SMG_BURST)
- addtimer(CALLBACK(src, PROC_REF(goon_burst_shot), goon_ref, target_ref), (shot - 1) * BOUNTY_GOON_SMG_BURST_GAP, TIMER_DELETE_ME)
+ if(!goon_fire(goon, target))
+ return
+ for(var/pull in 2 to BOUNTY_GOON_SMG_BURST)
+ addtimer(CALLBACK(src, PROC_REF(goon_burst_shot), goon_ref, target_ref), (pull - 1) * BOUNTY_GOON_SMG_BURST_GAP, TIMER_DELETE_ME)
-/// The rest of an SMG burst, one shot at a time
+/// The rest of an SMG burst, a trigger pull at a time
/datum/bounty_kingpin_crew/proc/goon_burst_shot(datum/weakref/goon_ref, datum/weakref/target_ref)
- var/mob/living/basic/bounty_kingpin_goon/goon = goon_ref?.resolve()
+ var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon = goon_ref?.resolve()
var/mob/living/target = target_ref?.resolve()
if(QDELETED(goon) || crew_state != BOUNTY_KINGPIN_FIGHTING || !goon.goon_able() || !valid_target(target) || !bounty_kingpin_clear_shot(goon, target))
return
goon_fire(goon, target)
-/// One round from `goon`'s gun at `target` (at the mech they drive, if they drive one), if one is left: every pellet of a shell
-/datum/bounty_kingpin_crew/proc/goon_fire(mob/living/basic/bounty_kingpin_goon/goon, mob/living/target)
- if(goon.goon_rounds <= 0)
- return null
- goon.goon_rounds--
- return bounty_kingpin_shoot(goon, shot_target(target), bounty_kingpin_goon_gun(goon.goon_weapon), src)
+/**
+ * One pull of the trigger of the loaded gun in `goon`'s hand at `target` (at the mech they drive, if
+ * they drive one), unless someone he isn't fighting is in the line: then he steps aside instead.
+ * Returns TRUE if he pulled it.
+ */
+/datum/bounty_kingpin_crew/proc/goon_fire(mob/living/carbon/human/npc/bounty_kingpin_goon/goon, mob/living/target)
+ var/obj/item/gun/gun = human_npc_loaded_gun(goon)
+ if(!gun || QDELETED(target))
+ return FALSE
+ var/atom/aim_at = shot_target(target)
+ if(line_blocked(goon, aim_at))
+ goon_sidestep(goon, target)
+ return FALSE
+ return pull_trigger(goon, gun, aim_at)
-/// The kingpin's turn: aim at whoever hurt him most, or reload. Never while drawing. Returns TRUE if he sees a hunter.
-/datum/bounty_kingpin_crew/proc/boss_tick(mob/living/basic/bounty_criminal/kingpin/kingpin, list/hunters)
+/**
+ * `shooter` pulls the trigger of `gun` (in their hand) at `aim_at`, the way a player does: the gun made
+ * the active hand, a body zone picked, and a click through the body's AI controller (ai_interact()), so
+ * the gun's own fire path runs (fire delay, burst, recoil, spread, casing, sound, wounds). No projectile
+ * is ever made here. Returns TRUE if the click was made.
+ */
+/datum/bounty_kingpin_crew/proc/pull_trigger(mob/living/carbon/human/shooter, obj/item/gun/gun, atom/aim_at)
+ var/datum/ai_controller/controller = shooter?.ai_controller
+ if(!controller || QDELETED(aim_at) || !human_npc_ready_item(shooter, gun))
+ return FALSE
+ shooter.zone_selected = human_npc_pick_aim_zone()
+ INVOKE_ASYNC(controller, TYPE_PROC_REF(/datum/ai_controller, ai_interact), aim_at, TRUE)
+ crew_shots++
+ return TRUE
+
+/**
+ * Whether someone the crew isn't fighting stands between `from` and `target`: a bystander, a guest,
+ * another criminal, or one of the crew itself. A shot from them would hit that person, so it isn't
+ * taken (CB-11, CB-13: no round passes through anyone). Shots go over anyone lying down.
+ */
+/datum/bounty_kingpin_crew/proc/line_blocked(atom/from, atom/target)
+ var/turf/start = get_turf(from)
+ var/turf/end = get_turf(target)
+ if(!start || !end || start == end)
+ return FALSE
+ for(var/turf/line_turf as anything in get_line(start, end))
+ if(line_turf == start || line_turf == end)
+ continue
+ for(var/mob/living/other in line_turf)
+ if(other.stat == DEAD || other.body_position == LYING_DOWN || is_hunter(other))
+ continue
+ return TRUE
+ return FALSE
+
+/// The kingpin's turn: aim at whoever hurt him most. Never while drawing; a spent revolver is his AI's to reload. Returns TRUE if he sees a hunter.
+/datum/bounty_kingpin_crew/proc/boss_tick(mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin, list/hunters)
if(kingpin.stat != CONSCIOUS)
kingpin.kingpin_cancel_aim()
return FALSE
@@ -2057,8 +2355,8 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
return length(visible) > 0
if(crew_state != BOUNTY_KINGPIN_FIGHTING || kingpin.kingpin_aim_timer || world.time < kingpin.kingpin_next_aim_at)
return length(visible) > 0
- if(kingpin.kingpin_rounds <= 0)
- kingpin.kingpin_reload()
+ if(!human_npc_loaded_gun(kingpin))
+ // Holstered (he gave up and thought better of it): his AI draws it again while the guns are out
return length(visible) > 0
var/mob/living/target = kingpin.kingpin_choose_target(visible)
if(target)
@@ -2078,10 +2376,10 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
return
if(watch_for_trouble())
return
- var/mob/living/basic/bounty_criminal/kingpin/kingpin = kingpin()
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = kingpin()
if(kingpin && !kingpin.buckled && kingpin.kingpin_able() && !kingpin.kingpin_sit())
kingpin.kingpin_go_home()
- for(var/mob/living/basic/bounty_kingpin_goon/goon as anything in standing_goons())
+ for(var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon as anything in standing_goons())
goon_calm_tick(goon)
right_the_tables()
prune_job_offers()
@@ -2099,7 +2397,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
* started.
*/
/datum/bounty_kingpin_crew/proc/watch_for_trouble()
- var/mob/living/basic/bounty_criminal/kingpin/kingpin = kingpin()
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = kingpin()
var/mob/living/puller = kingpin?.pulledby
if(isliving(puller) && !is_member(puller))
member_attacked(kingpin, list(puller))
@@ -2132,8 +2430,8 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
var/obj/structure/table/table = ref?.resolve()
if(QDELETED(table) || !table.is_flipped)
continue
- var/mob/living/basic/bounty_kingpin_goon/nearest
- for(var/mob/living/basic/bounty_kingpin_goon/goon as anything in goons)
+ var/mob/living/carbon/human/npc/bounty_kingpin_goon/nearest
+ for(var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon as anything in goons)
if(goon.goon_able() && (!nearest || get_dist(goon, table) < get_dist(nearest, table)))
nearest = goon
if(!nearest)
@@ -2141,13 +2439,13 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
table.unflip_table()
nearest.visible_message(span_notice("[nearest] sets [table] back on its legs."), vision_distance = COMBAT_MESSAGE_RANGE)
righted = TRUE
- var/mob/living/basic/bounty_criminal/kingpin/kingpin = kingpin()
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = kingpin()
if(righted && world.time >= crew_next_table_warning && kingpin?.kingpin_can_talk())
crew_next_table_warning = world.time + BOUNTY_KINGPIN_TABLE_WARN_GAP
INVOKE_ASYNC(kingpin, TYPE_PROC_REF(/mob/living, bounty_say), "furniture", null, TRUE)
/// A goon at ease: back to his post and into his chair, and watching whoever is closest
-/datum/bounty_kingpin_crew/proc/goon_calm_tick(mob/living/basic/bounty_kingpin_goon/goon)
+/datum/bounty_kingpin_crew/proc/goon_calm_tick(mob/living/carbon/human/npc/bounty_kingpin_goon/goon)
if(!goon.goon_able())
return
if(goon.goon_post && get_turf(goon) != goon.goon_post)
@@ -2173,7 +2471,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
/// Someone came up to the table: a goon warns him, he says hello. Each visitor once per BOUNTY_KINGPIN_GREET_GAP.
/datum/bounty_kingpin_crew/proc/greet_visitors()
- var/mob/living/basic/bounty_criminal/kingpin/kingpin = kingpin()
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = kingpin()
if(!kingpin?.kingpin_can_talk() || !crew_seat)
return
for(var/mob/living/carbon/human/visitor in range(3, crew_seat))
@@ -2186,8 +2484,8 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
crew_greeted[ref] = world.time
var/list/goons = standing_goons()
if(length(goons))
- var/mob/living/basic/bounty_kingpin_goon/goon = pick(goons)
- INVOKE_ASYNC(goon, TYPE_PROC_REF(/mob/living/basic/bounty_kingpin_goon, goon_say), "company")
+ var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon = pick(goons)
+ INVOKE_ASYNC(goon, TYPE_PROC_REF(/mob/living/carbon/human/npc/bounty_kingpin_goon, goon_say), "company")
var/context = "greet"
if(is_hunter(visitor))
context = "greet_hostile"
@@ -2199,14 +2497,14 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
/// One goon does something: a quiet word, a smoke, a drink, the cards
/datum/bounty_kingpin_crew/proc/goon_idle()
var/list/at_ease = list()
- for(var/mob/living/basic/bounty_kingpin_goon/goon as anything in standing_goons())
+ for(var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon as anything in standing_goons())
if(goon.goon_able())
at_ease += goon
if(!length(at_ease))
return
- var/mob/living/basic/bounty_kingpin_goon/goon = pick(at_ease)
+ var/mob/living/carbon/human/npc/bounty_kingpin_goon/goon = pick(at_ease)
if(prob(40))
- INVOKE_ASYNC(goon, TYPE_PROC_REF(/mob/living/basic/bounty_kingpin_goon, goon_say), "idle", TRUE)
+ INVOKE_ASYNC(goon, TYPE_PROC_REF(/mob/living/carbon/human/npc/bounty_kingpin_goon, goon_say), "idle", TRUE)
return
var/context = "actions"
var/turf/spot = get_turf(goon)
@@ -2225,7 +2523,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
/// He says something to nobody in particular, or puffs his cigar
/datum/bounty_kingpin_crew/proc/boss_idle()
- var/mob/living/basic/bounty_criminal/kingpin/kingpin = kingpin()
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = kingpin()
if(!kingpin?.kingpin_can_talk())
return
if(prob(50))
@@ -2247,58 +2545,11 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
duration = BOUNTY_KINGPIN_TELEGRAPH
/**
- * # A shot from the kingpin's crew
- *
- * The real round of the gun that fires it (bounty_kingpin_shoot()). It passes through anyone the
- * crew isn't fighting (bystanders, the crew itself, those who work for him): only a hunter it
- * reaches can be hit.
- */
-/obj/projectile/bullet/bounty_kingpin
- name = "bullet"
- /// Weakref to the crew whose shot it is (/datum/bounty_kingpin_crew)
- var/datum/weakref/kingpin_crew_ref
-
-/obj/projectile/bullet/bounty_kingpin/can_hit_target(atom/target, direct_target = FALSE, ignore_loc = FALSE, cross_failed = FALSE)
- if(isliving(target) && !direct_target)
- var/datum/bounty_kingpin_crew/crew = kingpin_crew_ref?.resolve()
- if(!crew?.is_hunter(target))
- return FALSE
- return ..()
-
-/**
- * `shooter` fires one round of `weapon` (a /datum/bounty_real_weapon) at `target` for `crew`: every
- * pellet of a shell, each with the real round's numbers and spread. Returns the first projectile.
- */
-/proc/bounty_kingpin_shoot(mob/living/shooter, atom/target, datum/bounty_real_weapon/weapon, datum/bounty_kingpin_crew/crew)
- var/turf/start = get_turf(shooter)
- if(!start || !target || !weapon)
- return null
- var/obj/projectile/bullet/bounty_kingpin/first
- for(var/pellet in 1 to weapon.pellets)
- var/obj/projectile/bullet/bounty_kingpin/bullet = new(start)
- weapon.load(bullet)
- bullet.kingpin_crew_ref = crew ? WEAKREF(crew) : null
- bullet.starting = start
- bullet.firer = shooter
- bullet.fired_from = shooter
- bullet.yo = target.y - start.y
- bullet.xo = target.x - start.x
- bullet.original = target
- bullet.aim_projectile(target, shooter, null, weapon.shot_spread())
- if(QDELETED(bullet))
- continue
- first ||= bullet
- INVOKE_ASYNC(bullet, TYPE_PROC_REF(/obj/projectile, fire))
- if(weapon.fire_sound)
- playsound(shooter, weapon.fire_sound, 60, TRUE)
- if(crew)
- crew.crew_shots++
- return first
-
-/**
- * Whether a shot from `from` would reach `target`: in range, on the same level, and nothing in the
- * way that stops a bullet (walls, windows, closed doors, machines; tables only when flipped toward
- * the shot). People in the way don't count: the crew's shots pass through anyone but a hunter.
+ * Whether `from` has a line of sight and fire on `target` for the crew's choice of who to shoot: in
+ * range, on the same level, and nothing in the way that stops a bullet (walls, windows, closed doors,
+ * machines; tables only when flipped toward the shot, as tg's flipped tables let shots from behind
+ * through). People in the way are the trigger's business (line_blocked()): a goon doesn't fire
+ * through anyone he isn't fighting.
*/
/proc/bounty_kingpin_clear_shot(atom/from, atom/target, range = BOUNTY_KINGPIN_SIGHT)
var/turf/start = get_turf(from)
@@ -2340,7 +2591,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
/**
* # The kingpin's posting
*
- * P5's posting with his rules: "wanted dead or alive" (alive 100% however he got there, dead 80%),
+ * P5's posting with his rules: "wanted dead or alive" (alive 100% however he is brought in, dead 80%),
* a clock that stops during a shootout, no relisting (he is only ever on his sofa), and no place
* under the board's live-criminal cap. It never spawns him: it adopts the seated kingpin wherever he
* is (bounty_kingpin_post()). Nobody who works for him (SSbounty_kingpin's bindings) can hunt him or
@@ -2351,11 +2602,11 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
/// Every crew has been told he is wanted: once, when it went up (L7)
var/kingpin_announced = FALSE
-// Wanted dead or alive: restrained, stunned or downed is alive and pays in full; dead pays 80%
-/datum/criminal_bounty/kingpin/board_share_for(state, worst_state)
+// Wanted dead or alive (CB-28), on his condition at the pad: alive pays in full, cuffed, stunned or in crit alike; dead pays 80%. Free is refused.
+/datum/criminal_bounty/kingpin/board_share_for(state)
if(!bounty_state_share(state))
return 0
- if(state == BOUNTY_STATE_DEAD || worst_state == BOUNTY_STATE_DEAD)
+ if(state == BOUNTY_STATE_DEAD)
return BOUNTY_KINGPIN_PAY_DEAD
return BOUNTY_KINGPIN_PAY_ALIVE
@@ -2369,7 +2620,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
// The clock stops while his crew is fighting; a hunt doesn't stop it
/datum/criminal_bounty/kingpin/board_clock_held(now = world.time)
- var/mob/living/basic/bounty_criminal/kingpin/kingpin = criminal()
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = criminal()
if(!kingpin)
return !board_proof() && !board_relisting
return istype(kingpin) && !!kingpin.kingpin_crew?.is_fighting()
@@ -2427,7 +2678,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
if(reason == BOUNTY_CLOSE_CLAIMED)
SSbounty_kingpin.kingpin_set_gone("claimed")
else
- var/mob/living/basic/bounty_criminal/kingpin/kingpin = criminal()
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = criminal()
if(kingpin_stays(kingpin))
kingpin_let_go(kingpin)
. = ..()
@@ -2435,13 +2686,13 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
SSbounty_kingpin.kingpin_resolved()
/// Whether `kingpin` stays when it closes unclaimed: alive, with his crew, in his lounge (within his goons' leash of the sofa)
-/datum/criminal_bounty/kingpin/proc/kingpin_stays(mob/living/basic/bounty_criminal/kingpin/kingpin)
+/datum/criminal_bounty/kingpin/proc/kingpin_stays(mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin)
if(!istype(kingpin) || QDELETED(kingpin) || kingpin.stat == DEAD || !kingpin.kingpin_crew || HAS_TRAIT(kingpin, TRAIT_BOUNTY_REMOVED))
return FALSE
return kingpin.kingpin_on_leash()
/// Lets go of `kingpin`, who stays in his lounge: no longer its criminal, on no posting, and back to business
-/datum/criminal_bounty/kingpin/proc/kingpin_let_go(mob/living/basic/bounty_criminal/kingpin/kingpin)
+/datum/criminal_bounty/kingpin/proc/kingpin_let_go(mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin)
board_detach_criminal()
kingpin.posting_ref = null
REMOVE_TRAIT(kingpin, TRAIT_MISSION_FIELD_MOB, BOUNTY_TRAIT)
@@ -2468,24 +2719,30 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
/**
* The kingpin in `record`'s face at `seat` (on its sofa), on no posting, with a goon at each of
* `posts` (list(list(turf, BOUNTY_GOON_WEAPON_*), ...)), and his crew knowing the room. Leashed to
- * the trader outpost the seat is in, if it is in one. Returns him.
+ * the trader outpost the seat is in, if it is in one. He is built at once (one body); his goons come
+ * through the human NPC spawn queue a body at a time, unless `immediate_goons` (the unit tests).
+ * Returns him.
*/
-/proc/bounty_kingpin_setup(turf/seat, list/posts, datum/bounty_record/record)
+/proc/bounty_kingpin_setup(turf/seat, list/posts, datum/bounty_record/record, immediate_goons = FALSE)
if(!seat)
return null
var/datum/npc_spawn_context/context = new(seat, null, "boss")
- var/mob/living/basic/bounty_criminal/kingpin/kingpin = spawn_npc_in_zone(/mob/living/basic/bounty_criminal/kingpin, seat, context, FALSE)
- kingpin.kingpin_crew = new /datum/bounty_kingpin_crew(kingpin, seat)
+ var/datum/human_npc_order/order = spawn_human_npc(/mob/living/carbon/human/npc/bounty_criminal/kingpin, seat, look = record, name = record?.name, context = context, immediate = TRUE)
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = order?.spawned_ref?.resolve()
+ qdel(order)
+ if(QDELETED(kingpin))
+ return null
+ kingpin.kingpin_crew = new /datum/bounty_kingpin_crew(kingpin, seat, immediate_goons)
kingpin.body_setup(record, null)
var/obj/structure/overmap/trader_outpost/outpost = get_trader_outpost_for_turf(seat)
if(outpost)
kingpin.body_set_site(outpost)
kingpin.kingpin_sit()
- context.finalize()
for(var/list/post as anything in posts)
kingpin.kingpin_crew.crew_posts += list(post.Copy())
- kingpin.kingpin_crew.spawn_goon(post[1], post[2])
kingpin.kingpin_crew.find_room()
+ for(var/list/post as anything in posts)
+ kingpin.kingpin_crew.spawn_goon(post[1], post[2], immediate_goons)
return kingpin
/// A new record for a kingpin: Most Wanted, his own archetype, a boss's alias and crime, a base value from his band
@@ -2542,7 +2799,7 @@ GLOBAL_LIST_EMPTY(bounty_kingpin_marks)
* SSbounty_kingpin.kingpin_post() is the way in (the clock and the admin panel). Doesn't sleep.
* Returns the posting, or null.
*/
-/proc/bounty_kingpin_post(mob/living/basic/bounty_criminal/kingpin/kingpin)
+/proc/bounty_kingpin_post(mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin)
if(!istype(kingpin) || QDELETED(kingpin) || HAS_TRAIT(kingpin, TRAIT_BOUNTY_REMOVED) || kingpin.kingpin_posting() || bounty_kingpin_open_posting())
return null
var/obj/structure/overmap/trader_outpost/outpost = kingpin.kingpin_crew?.crew_outpost()
@@ -2605,7 +2862,7 @@ SUBSYSTEM_DEF(bounty_kingpin)
/// Whether it seats and posts him on its own. Off in tests, which seat and post their own.
var/kingpin_auto_post = TRUE
#endif
- /// Weakref to the round's kingpin (/mob/living/basic/bounty_criminal/kingpin), once seated
+ /// Weakref to the round's kingpin (/mob/living/carbon/human/npc/bounty_criminal/kingpin), once seated
var/datum/weakref/kingpin_ref
/// He died, was deleted or was claimed at a pad: nobody seats or posts him again this round
var/kingpin_gone = FALSE
@@ -2631,12 +2888,12 @@ SUBSYSTEM_DEF(bounty_kingpin)
/// This round's kingpin, if he is seated and his mob still exists (dead or alive)
/datum/controller/subsystem/bounty_kingpin/proc/kingpin()
- RETURN_TYPE(/mob/living/basic/bounty_criminal/kingpin)
- var/mob/living/basic/bounty_criminal/kingpin/kingpin = kingpin_ref?.resolve()
+ RETURN_TYPE(/mob/living/carbon/human/npc/bounty_criminal/kingpin)
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = kingpin_ref?.resolve()
return QDELETED(kingpin) ? null : kingpin
/// Makes `kingpin` this round's kingpin
-/datum/controller/subsystem/bounty_kingpin/proc/kingpin_track(mob/living/basic/bounty_criminal/kingpin/kingpin)
+/datum/controller/subsystem/bounty_kingpin/proc/kingpin_track(mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin)
kingpin_ref = (istype(kingpin) && !QDELETED(kingpin)) ? WEAKREF(kingpin) : null
/// Seats him at the black market once it has loaded, unless he sits there already or is gone for the round. Returns him, or null.
@@ -2656,7 +2913,7 @@ SUBSYSTEM_DEF(bounty_kingpin)
/datum/controller/subsystem/bounty_kingpin/proc/kingpin_seat(obj/structure/overmap/trader_outpost/outpost)
if(kingpin_gone)
return null
- var/mob/living/basic/bounty_criminal/kingpin/kingpin = kingpin()
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = kingpin()
if(kingpin)
return kingpin
for(var/datum/bounty_kingpin_crew/crew as anything in GLOB.bounty_kingpin_crews)
@@ -2711,7 +2968,7 @@ SUBSYSTEM_DEF(bounty_kingpin)
/datum/controller/subsystem/bounty_kingpin/proc/kingpin_post()
if(kingpin_gone)
return null
- var/mob/living/basic/bounty_criminal/kingpin/kingpin = kingpin()
+ var/mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin = kingpin()
if(!kingpin || kingpin.stat == DEAD)
return null
var/datum/criminal_bounty/kingpin/posting = bounty_kingpin_post(kingpin)
@@ -2720,11 +2977,11 @@ SUBSYSTEM_DEF(bounty_kingpin)
return posting
/// `kingpin` died: he is gone for the round. A posting already up holds his body for the dead share; none goes up for it.
-/datum/controller/subsystem/bounty_kingpin/proc/kingpin_died(mob/living/basic/bounty_criminal/kingpin/kingpin)
+/datum/controller/subsystem/bounty_kingpin/proc/kingpin_died(mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin)
kingpin_set_gone(kingpin?.kingpin_posting() ? "died on the board" : "died off the board, nothing to claim")
/// `kingpin`'s mob is being deleted: he is gone for the round
-/datum/controller/subsystem/bounty_kingpin/proc/kingpin_removed(mob/living/basic/bounty_criminal/kingpin/kingpin)
+/datum/controller/subsystem/bounty_kingpin/proc/kingpin_removed(mob/living/carbon/human/npc/bounty_criminal/kingpin/kingpin)
if(kingpin_ref && kingpin_ref == kingpin?.weak_reference)
kingpin_ref = null
kingpin_set_gone("deleted")
@@ -2942,5 +3199,5 @@ SUBSYSTEM_DEF(bounty_kingpin)
return "post the kingpin bounty on [posting.record?.name || "nobody"] at [posting.board_site_name || "the black market"]"
/// His lounge faction stays neutral; his explicit boss encounter is still profiled.
-/mob/living/basic/bounty_criminal/kingpin/is_npc_zone_exempt()
+/mob/living/carbon/human/npc/bounty_criminal/kingpin/is_npc_zone_exempt()
return npc_zone_exempt || npc_spawn_context?.exempt || client || mind
diff --git a/voidcrew/modules/bounties/bounty_lair.dm b/voidcrew/modules/bounties/bounty_lair.dm
index d8173490d96..0cb5f3338b1 100644
--- a/voidcrew/modules/bounties/bounty_lair.dm
+++ b/voidcrew/modules/bounties/bounty_lair.dm
@@ -22,9 +22,10 @@
* rooms a crew clears stay cleared: the zone_mobs markers delete themselves after spawning and are never stamped
* again. On its first load it indexes its own footprint once: it spawns the boss and the gatekeepers on their
* landmarks, finds its gate poddoors (id BOUNTY_LAIR_GATE_ID), and keeps the boss, the gatekeepers and the goons to
- * the rooms they started in. When the last gatekeeper dies, the gate opens. When the last boss dies (the mech, then
- * the don who climbs out of it), the trophy drops where he fell, unless the boss's own death dropped it through
- * bounty_lair_drop_trophy().
+ * the rooms they started in. Gatekeepers that are human NPCs are queued (spawn_human_npc(), a body or two a tick);
+ * until each order has built its body, it counts as a gatekeeper standing, so the gate never opens on an empty back
+ * office. When the last gatekeeper dies, the gate opens. When the last boss dies (the mech, then the don who climbs
+ * out of it), the trophy drops where he fell, unless the boss's own death dropped it through bounty_lair_drop_trophy().
*
* ## The lair clock (SSbounty_lairs)
*
@@ -88,8 +89,8 @@
close(BOUNTY_CLOSE_LAIR_GONE)
return FALSE
-/// Dead, and only dead: the trophy pays in full, anything else pays nothing
-/datum/criminal_bounty/kill_only/board_share_for(state, worst_state)
+/// Dead, and only dead: the trophy pays in full, anything else pays nothing (a boss brought in cuffed pays nothing: his trophy pays)
+/datum/criminal_bounty/kill_only/board_share_for(state)
return state == BOUNTY_STATE_DEAD ? 100 : 0
/// The pad takes its trophy only: the one it dropped, or any trophy bound to it, lying on the pad's own tile
@@ -274,12 +275,33 @@
return FALSE
return TRUE
+/// Whether `candidate` is a lair boss: a /mob/living/basic/bounty_lair_boss (the don's mech), or the don on foot (a person)
+/proc/bounty_is_lair_boss(mob/living/candidate)
+ return istype(candidate, /mob/living/basic/bounty_lair_boss) || istype(candidate, /mob/living/carbon/human/npc/bounty_mafia/don)
+
+/// The weakref to the posting a lair boss is wanted on, or null (not a lair boss, or an admin spawn)
+/proc/bounty_lair_boss_posting_ref(mob/living/boss)
+ if(istype(boss, /mob/living/basic/bounty_lair_boss))
+ var/mob/living/basic/bounty_lair_boss/machine = boss
+ return machine.posting_ref
+ if(istype(boss, /mob/living/carbon/human/npc/bounty_mafia/don))
+ var/mob/living/carbon/human/npc/bounty_mafia/don/person = boss
+ return person.posting_ref
+ return null
+
+/// Makes `boss` wanted on the posting `posting_ref` points at. Does nothing to a mob that isn't a lair boss.
+/proc/bounty_lair_set_boss_posting(mob/living/boss, datum/weakref/posting_ref)
+ if(istype(boss, /mob/living/basic/bounty_lair_boss))
+ var/mob/living/basic/bounty_lair_boss/machine = boss
+ machine.posting_ref = posting_ref
+ else if(istype(boss, /mob/living/carbon/human/npc/bounty_mafia/don))
+ var/mob/living/carbon/human/npc/bounty_mafia/don/person = boss
+ person.posting_ref = posting_ref
+
/// The open kill-only bounty a lair boss is wanted on (its posting_ref), or null
/proc/bounty_kill_posting_of(mob/living/boss)
- if(!istype(boss, /mob/living/basic/bounty_lair_boss))
- return null
- var/mob/living/basic/bounty_lair_boss/lair_boss = boss
- var/datum/criminal_bounty/kill_only/posting = lair_boss.posting_ref?.resolve()
+ var/datum/weakref/posting_ref = bounty_lair_boss_posting_ref(boss)
+ var/datum/criminal_bounty/kill_only/posting = posting_ref?.resolve()
if(!istype(posting) || !posting.is_open())
return null
return posting
@@ -329,6 +351,11 @@
var/list/lair_gate_doors = list()
/// Weakrefs to its living gatekeepers; the gate opens when the last one is gone
var/list/lair_gatekeepers = list()
+ /// Gatekeepers still in the human NPC spawn queue: a key per order -> the order (/datum/human_npc_order). Each counts
+ /// as a gatekeeper standing until it has built its body (or failed to).
+ var/list/lair_pending_gatekeepers = list()
+ /// Makes the keys of lair_pending_gatekeepers
+ var/lair_spawn_serial = 0
/// Weakrefs to the bosses it is waiting on (the mech, then the don who climbs out of it)
var/list/lair_bosses = list()
/// The gate is open: it stays open, and the gatekeepers never come back
@@ -357,6 +384,7 @@
/obj/structure/overmap/space_ruin/bounty_lair/Destroy()
lair_unhook_mobs()
+ lair_cancel_pending_gatekeepers()
lair_clear_timers()
if(lair_release_timer)
deltimer(lair_release_timer)
@@ -550,9 +578,15 @@
log_mapping("BOUNTY LAIR: [name] has a boss landmark with no mob type at [AREACOORD(home)]")
continue
var/datum/npc_spawn_context/context = new(src, null, "boss")
- var/mob/living/boss = spawn_npc_in_zone(boss_type, home, context, FALSE)
+ var/mob/living/boss
+ if(ispath(boss_type, /mob/living/carbon/human/npc))
+ // One body, wanted before the fight can start: built now
+ var/datum/human_npc_order/order = spawn_human_npc(boss_type, home, context = context, immediate = TRUE)
+ boss = order?.spawned_ref?.resolve()
+ else
+ boss = spawn_npc_in_zone(boss_type, home, context, FALSE)
+ context.finalize()
lair_adopt_boss(boss)
- context.finalize()
for(var/obj/effect/landmark/bounty_lair_gatekeeper/mark as anything in keeper_marks)
if(QDELETED(mark))
@@ -566,17 +600,24 @@
log_mapping("BOUNTY LAIR: [name] has a gatekeeper landmark with no mob type at [AREACOORD(home)]")
continue
var/datum/npc_spawn_context/context = new(src, null, "boss")
+ if(ispath(keeper_type, /mob/living/carbon/human/npc))
+ // People are queued, never a room of them in one tick: it holds the gate from now, and is watched once built
+ lair_spawn_serial++
+ var/key = "[lair_spawn_serial]"
+ var/datum/human_npc_order/order = spawn_human_npc(keeper_type, home, CALLBACK(src, PROC_REF(lair_on_gatekeeper_built), key), context = context)
+ lair_pending_gatekeepers[key] = order
+ continue
var/mob/living/keeper = spawn_npc_in_zone(keeper_type, home, context, FALSE)
lair_add_gatekeeper(keeper)
context.finalize()
lair_leash_goons()
- lair_goon_timer = addtimer(CALLBACK(src, PROC_REF(lair_leash_goons)), BOUNTY_LAIR_GOON_LEASH_DELAY, TIMER_STOPPABLE)
+ lair_goon_timer = addtimer(CALLBACK(src, PROC_REF(lair_settle)), BOUNTY_LAIR_GOON_LEASH_DELAY, TIMER_STOPPABLE)
// Nobody left to hold the gate (none mapped, or it was opened before a reload): it stands open
- if(lair_gate_open || !length(lair_gatekeepers))
+ if(lair_gate_open || (!length(lair_gatekeepers) && !lair_pending_gatekeeper_count()))
lair_open_gate(silent = TRUE)
lair_link_done = TRUE
- log_game("BOUNTY: [name] linked its interior: [length(lair_bosses)] boss(es), [length(lair_gatekeepers)] gatekeeper(s), [length(lair_gate_doors)] gate door(s)")
+ log_game("BOUNTY: [name] linked its interior: [length(lair_bosses)] boss(es), [length(lair_gatekeepers)] gatekeeper(s) and [lair_pending_gatekeeper_count()] on their way, [length(lair_gate_doors)] gate door(s)")
/**
* The interior is being given back while the bounty is open (nothing does this while it is mission-locked, so this is
@@ -585,6 +626,7 @@
/obj/structure/overmap/space_ruin/bounty_lair/proc/lair_on_unloading(datum/source)
SIGNAL_HANDLER
lair_unhook_mobs()
+ lair_cancel_pending_gatekeepers()
lair_clear_timers()
lair_gate_doors = list()
lair_last_death_spot = null
@@ -599,9 +641,7 @@
/obj/structure/overmap/space_ruin/bounty_lair/proc/lair_adopt_boss(mob/living/boss)
if(QDELETED(boss))
return FALSE
- if(istype(boss, /mob/living/basic/bounty_lair_boss))
- var/mob/living/basic/bounty_lair_boss/lair_boss = boss
- lair_boss.posting_ref = posting_ref
+ bounty_lair_set_boss_posting(boss, posting_ref)
lair_bosses |= WEAKREF(boss)
lair_watch(boss, PROC_REF(lair_on_boss_gone))
lair_leash(boss)
@@ -637,7 +677,7 @@
if(!posting || lair_boss_killed)
return
var/standing = FALSE
- for(var/mob/living/basic/bounty_lair_boss/boss as anything in lair_bosses_inside())
+ for(var/mob/living/boss as anything in lair_bosses_inside())
if(boss.stat == DEAD)
continue
if(!boss.weak_reference || !(boss.weak_reference in lair_bosses))
@@ -673,13 +713,13 @@
log_game("BOUNTY: [name]'s boss is dead but there was no safe floor for its trophy; closing its bounty")
posting.close(BOUNTY_CLOSE_LAIR_GONE)
-/// Every lair boss standing in its footprint
+/// Every lair boss standing in its footprint (bounty_is_lair_boss())
/obj/structure/overmap/space_ruin/bounty_lair/proc/lair_bosses_inside()
. = list()
if(!footprint)
return
- for(var/mob/living/basic/bounty_lair_boss/boss in GLOB.mob_living_list)
- if(!QDELETED(boss) && footprint.contains_turf(get_turf(boss)))
+ for(var/mob/living/boss as anything in GLOB.mob_living_list)
+ if(!QDELETED(boss) && bounty_is_lair_boss(boss) && footprint.contains_turf(get_turf(boss)))
. += boss
/// A trophy already bound to `posting` near where the boss fell (a boss's death that made its own)
@@ -699,8 +739,8 @@
if(QDELETED(keeper))
return FALSE
lair_gatekeepers |= WEAKREF(keeper)
- // Troopers delete themselves on death and leave a corpse spawner: either signal counts, whichever comes first.
- // An admin deleting one counts as gone too: a gate that never opens is worse.
+ // A person dies in place (COMSIG_LIVING_DEATH); a mob deleted on death, or by an admin, counts as gone too, whichever
+ // signal comes first: a gate that never opens is worse.
lair_watch(keeper, PROC_REF(lair_on_gatekeeper_gone))
lair_leash(keeper)
return TRUE
@@ -713,7 +753,7 @@
lair_gatekeepers -= source.weak_reference
lair_check_gate()
-/// Opens the gate if no gatekeeper is left standing. Returns TRUE if it opened now.
+/// Opens the gate if no gatekeeper is left standing, and none is still on its way. Returns TRUE if it opened now.
/obj/structure/overmap/space_ruin/bounty_lair/proc/lair_check_gate()
if(lair_gate_open)
return FALSE
@@ -723,9 +763,48 @@
lair_gatekeepers -= ref
continue
return FALSE
+ if(lair_pending_gatekeeper_count())
+ return FALSE
lair_open_gate()
return TRUE
+/**
+ * How many queued gatekeepers are still to be built. An order that was cancelled, or built nothing, is dropped here;
+ * one that built its body has already moved to lair_gatekeepers (lair_on_gatekeeper_built()).
+ */
+/obj/structure/overmap/space_ruin/bounty_lair/proc/lair_pending_gatekeeper_count()
+ . = 0
+ for(var/key in lair_pending_gatekeepers.Copy())
+ var/datum/human_npc_order/order = lair_pending_gatekeepers[key]
+ if(QDELETED(order) || order.done)
+ lair_pending_gatekeepers -= key
+ continue
+ .++
+
+/// A queued gatekeeper (`key`) was built: it holds the gate from now, kept to its room, unless the gate opened meanwhile
+/obj/structure/overmap/space_ruin/bounty_lair/proc/lair_on_gatekeeper_built(key, mob/living/keeper)
+ if(QDELETED(src))
+ return
+ var/known = !isnull(lair_pending_gatekeepers[key])
+ lair_pending_gatekeepers -= key
+ if(QDELETED(keeper))
+ lair_check_gate()
+ return
+ lair_leash(keeper)
+ if(!known || lair_gate_open || !lair_posting())
+ return
+ lair_add_gatekeeper(keeper)
+
+/// Calls off every gatekeeper still in the spawn queue (the interior is going, or the lair is)
+/obj/structure/overmap/space_ruin/bounty_lair/proc/lair_cancel_pending_gatekeepers()
+ var/list/orders = list()
+ for(var/key in lair_pending_gatekeepers)
+ orders += lair_pending_gatekeepers[key]
+ lair_pending_gatekeepers = list()
+ for(var/datum/human_npc_order/order as anything in orders)
+ if(!QDELETED(order) && !order.done)
+ qdel(order)
+
/// Opens its gate poddoors, the ones in its own footprint only, and tells everyone inside unless `silent`
/obj/structure/overmap/space_ruin/bounty_lair/proc/lair_open_gate(silent = FALSE)
lair_gate_open = TRUE
@@ -757,9 +836,15 @@
lair_mob.AddElement(/datum/element/bounty_lair_room_leash, home.type)
return TRUE
+/// Once every marker has spawned (the zone resolver retries for up to a minute, then the people are queued): the late goons
+/// are kept to their rooms, and a gatekeeper order that never built a body stops holding the gate
+/obj/structure/overmap/space_ruin/bounty_lair/proc/lair_settle()
+ lair_goon_timer = null
+ lair_leash_goons()
+ lair_check_gate()
+
/// Keeps every living goon of its kind in the room it stands in. Runs at the link, and again once every marker has spawned.
/obj/structure/overmap/space_ruin/bounty_lair/proc/lair_leash_goons()
- lair_goon_timer = null
var/goon_type = lair_kind?.goon_type
if(!goon_type || !footprint || !loaded)
return 0
@@ -774,13 +859,16 @@
/**
* Keeps a lair mob in the room (area) it started in: it won't step out of it on its own, so it fights from the
* doorway and a fight never drags the next room in (balance/lairs.md 9.2). Moves it doesn't make itself are never
- * stopped (pulled, thrown, or dead), and once it is out of its room it walks freely, so it can never be stuck.
+ * stopped (pulled, carried or wheeled on what it is buckled to, thrown, shoved, or dead), and once it is out of its
+ * room it walks freely, so it can never be stuck.
*/
/datum/element/bounty_lair_room_leash
element_flags = ELEMENT_BESPOKE
argument_hash_start_idx = 2
/// The area type it is kept to. A type, not the area: a lair's areas are per-load instances, and no ref is held.
var/home_area_type
+ /// REF() of each mob shoved -> the world.time of the shove: the push of a shove is someone else's move
+ var/list/shoved_at = list()
/datum/element/bounty_lair_room_leash/Attach(datum/target, home_area_type)
. = ..()
@@ -788,14 +876,20 @@
return ELEMENT_INCOMPATIBLE
src.home_area_type = home_area_type
RegisterSignal(target, COMSIG_MOVABLE_PRE_MOVE, PROC_REF(on_pre_move), override = TRUE)
+ RegisterSignal(target, COMSIG_LIVING_DISARM_HIT, PROC_REF(on_shoved), override = TRUE)
/datum/element/bounty_lair_room_leash/Detach(datum/source)
- UnregisterSignal(source, COMSIG_MOVABLE_PRE_MOVE)
+ UnregisterSignal(source, list(COMSIG_MOVABLE_PRE_MOVE, COMSIG_LIVING_DISARM_HIT))
+ shoved_at -= REF(source)
return ..()
+/datum/element/bounty_lair_room_leash/proc/on_shoved(mob/living/source, mob/living/attacker, zone, obj/item/weapon)
+ SIGNAL_HANDLER
+ shoved_at[REF(source)] = world.time
+
/datum/element/bounty_lair_room_leash/proc/on_pre_move(mob/living/source, atom/new_location)
SIGNAL_HANDLER
- if(source.stat == DEAD || source.pulledby || source.throwing)
+ if(source.stat == DEAD || source.pulledby || source.buckled || source.throwing || shoved_at[REF(source)] == world.time)
return NONE
var/area/here = get_area(source)
if(here?.type != home_area_type)
@@ -916,7 +1010,7 @@
trophy_type = /obj/item/bounty_proof/trophy/mafia_don
mugshot_icon = 'icons/mob/rideables/mecha.dmi'
mugshot_state = "mauler"
- goon_type = /mob/living/basic/trooper/russian/mafia
+ goon_type = /mob/living/carbon/human/npc/bounty_mafia
gate_message = "The garage door grinds open."
/**
diff --git a/voidcrew/modules/bounties/bounty_lair_mafia.dm b/voidcrew/modules/bounties/bounty_lair_mafia.dm
index 796e4eb45f9..a95fbb281f5 100644
--- a/voidcrew/modules/bounties/bounty_lair_mafia.dm
+++ b/voidcrew/modules/bounties/bounty_lair_mafia.dm
@@ -8,42 +8,54 @@
* declared in bounty_lair_types.dm; this file sets their values and behaviour. Its numbers are in the P12
* section of voidcrew/_DEFINES/bounty_lairs.dm, its lines in strings/bounty_lair_mafia.json.
*
+ * The goons, the lieutenants and the don are real human NPCs (voidcrew/modules/human_npcs/, phase D of the human NPC
+ * migration): a person's body, crit, wounds, cuffs and death, dressed in their Club Volga clothes, holding real guns
+ * with real spare magazines, reloading them by hand. Their kit is locked to them (owner decision D3), so a corpse
+ * leaves no gun. Only the don's mech is a mob of its own: it is a machine (owner call OC-5).
+ *
* How the club fights:
- * - **Goons** (/mob/living/basic/trooper/russian/mafia: knife, /pistol, /smg) keep to the room (area) they
- * spawned in: they never walk out of it, and come to its door to get a line. A room is alerted by what its
- * own goons see or what hits them: the one who spots a hunter shouts, the room's first shots follow a
+ * - **Goons** (/mob/living/carbon/human/npc/bounty_mafia: a kitchen knife, /pistol a Stechkin, /smg an Uzi) keep to
+ * the room (area) they spawned in: they never walk out of it, and come to its door to get a line. A room is alerted
+ * by what its own goons see or what hits them: the one who spots a hunter shouts, the room's first shots follow a
* second later and spread over another second, and gunmen kick a wood table over for cover. At most
* BOUNTY_MOBSTER_MAX_ON_ONE goons of a room go after one hunter standing in a doorway, however many are shot at.
- * Grabbed, a goon breaks free and fights its grabber; dragged or thrown out of its room it still fights, and
- * only walks back once there's nobody to fight. Nobody in the club targets a hunter who is down. Polymorph and
- * type changes are refused. They leave a corpse in club clothes and never a gun.
- * - **Lieutenants** (/lieutenant, /lieutenant/tommy, /lieutenant/brute) are tougher goons that hold the
- * arena gate. The base type takes whichever role its room doesn't have yet, so two plain gatekeeper
- * landmarks give one of each. They die like any trooper: COMSIG_LIVING_DEATH, then deletion.
- * - **The mech** (/mob/living/basic/bounty_lair_boss/mafia_mech) is a mob that looks like a Mauler, not a tg
- * mecha and not /mob/living/basic/boss. Its health follows the hunters engaged (P4's posse rule), counting
- * exosuit pilots and harmless shots such as ion bolts. Anyone who hurts it is fair game at any range: it closes
- * in as far as its arena lets it and answers from there, so it can't be sniped from past its sight. Every
- * ability winds up where everyone can see it: the rocket volley puts a marker under each hunter it sees,
- * then fires one non-breaching rocket per marker; the LMG shows a red cone out to its target that stays until
- * the burst ends. An EMP stalls it (the ability it cut off is ready again as the stall ends) rather than
- * killing it. With nobody left to fight for BOUNTY_MECH_RESET_AFTER it resets. It never leaves its arena.
- * - **The don** (/mob/living/basic/bounty_lair_boss/mafia_don) climbs out when the mech breaks, next to a
- * burnt-out wreck he uses for cover, holding the mech's grudges. He can't be cuffed and fights to the death;
- * his death drops the gold signet ring (/obj/item/bounty_proof/trophy/mafia_don) with the posting on it, which
- * P10 pays on.
+ * Grabbed, a goon resists the tg way and fights its grabber; dragged, carried, shoved or thrown out of its room it
+ * still fights, and only walks back once there's nobody to fight. Someone starting to cuff a goon who can still
+ * move sees it step away. Nobody in the club picks a hunter who is down as a target (only the choice: a round in
+ * flight hits whoever is in the way). Polymorph and type changes are refused.
+ * - **Lieutenants** (/lieutenant, /lieutenant/tommy, /lieutenant/brute) are elite goons in real armour that hold the
+ * arena gate. The base type takes whichever role its room doesn't have yet, so two plain gatekeeper landmarks give
+ * one of each. They die in place like anyone: P10 opens the gate on COMSIG_LIVING_DEATH. Tommy fires a Thompson;
+ * Brute punches, and a landed punch now and then knocks the hunter down (a tg Knockdown).
+ * - **The mech** (/mob/living/basic/bounty_lair_boss/mafia_mech) is a mob that looks like a Mauler, not a tg mecha
+ * and not /mob/living/basic/boss. Its health follows the hunters engaged (P4's posse rule), counting exosuit pilots
+ * and harmless shots such as ion bolts. Anyone who hurts it is fair game at any range: it closes in as far as its
+ * arena lets it and answers from there, so it can't be sniped from past its sight. Every ability winds up where
+ * everyone can see it: the rocket volley puts a marker under each hunter it sees, then fires one rocket per marker,
+ * whose burst is tg's light blast on everyone standing there, whatever their state, and never explosion(); the LMG
+ * shows a red cone out to its target that stays until the burst ends, and its rounds hit whoever is in the way. An
+ * EMP stalls it (the ability it cut off is ready again as the stall ends) rather than killing it. With nobody left
+ * to fight for BOUNTY_MECH_RESET_AFTER it repairs itself. It never leaves its arena.
+ * - **The don** (/mob/living/carbon/human/npc/bounty_mafia/don) climbs out when the mech breaks, next to a burnt-out
+ * wreck he uses for cover while he reloads, holding the mech's grudges. He never gives up: someone starting to cuff
+ * him while he can still move hears about it and sees him step away; cuffed, he works at the cuffs. A cuffed don
+ * still pays nothing: the lair is kill-only, and only his ring pays. His death drops the gold signet ring
+ * (/obj/item/bounty_proof/trophy/mafia_don) with the posting on it, once, which P10 pays on.
+ *
+ * For P10: a gatekeeper's death is COMSIG_LIVING_DEATH (watch COMSIG_QDELETING too, for an admin delete). The mech
+ * hands its posting_ref to the don and sends COMSIG_BOUNTY_MAFIA_DON_EJECTED with him before its own death; the don's
+ * death drops the ring through P10's bounty_lair_drop_trophy() and sends COMSIG_BOUNTY_MAFIA_TROPHY_DROPPED with it.
+ * Everyone keeps to their room by bounty_mafia_leash_allows(), the same rule as P10's
+ * /datum/element/bounty_lair_room_leash, which a lair also puts on its mobs.
*
- * For P10: a gatekeeper's death is COMSIG_LIVING_DEATH (the lieutenant is deleted right after, so watch
- * COMSIG_QDELETING too for an admin delete). The mech hands its posting_ref to the don and sends
- * COMSIG_BOUNTY_MAFIA_DON_EJECTED with him before its own death; the don's death drops the ring through P10's
- * bounty_lair_drop_trophy() and sends COMSIG_BOUNTY_MAFIA_TROPHY_DROPPED with it. Everyone keeps to their room by
- * bounty_mafia_leash_allows(), the same rule as P10's /datum/element/bounty_lair_room_leash.
+ * The club is built a body at a time (spawn_human_npc(), queued): its markers queue their goons, the lair queues the
+ * lieutenants, and only the don, one body the fight needs at once, is built on the spot.
*
* Nothing here scans turfs on a tick: targets come from SSmobs' list of players on the level, and every
* telegraph and timer is tracked and cleaned up.
*/
-/// Trait source for a club mob standing still while it winds up, fires or reels
+/// Trait source for the mech standing still while it winds up, fires or reels
#define BOUNTY_MAFIA_BUSY_TRAIT "bounty_mafia_busy"
// ===== SHARED =====
@@ -59,7 +71,10 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
return FALSE
return !isnull(candidate.mind) || !isnull(candidate.client)
-/// Whether a club mob may shoot or hit `target` now: a hunter on their feet, never anyone already down (spec 12.3 C4)
+/**
+ * Whether a club mob may pick `target` to go after: a hunter on their feet, never anyone already down (spec 12.3 C4).
+ * Only the choice of target: what is fired hits whoever it hits (defaults 1.11, CB-11).
+ */
/proc/bounty_mafia_may_hurt(mob/living/target)
if(!bounty_mafia_is_hunter(target) || target.stat != CONSCIOUS)
return FALSE
@@ -89,9 +104,15 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
var/list/lines = GLOB.string_cache?[BOUNTY_MAFIA_STRINGS_FILE]?[context]
return length(lines) ? pick(lines) : null
-/// `speaker` says a line for `context`, off the caller's stack (safe from signal handlers). TRUE if there was one.
+/**
+ * `speaker` says a line for `context`, off the caller's stack (safe from signal handlers). TRUE if there was one.
+ * A person speaks on their feet or whispers in soft crit (tg's say() does the whisper), never deeper down.
+ */
/proc/bounty_mafia_say(mob/living/speaker, context)
- if(QDELETED(speaker) || speaker.stat != CONSCIOUS)
+ if(QDELETED(speaker))
+ return FALSE
+ var/can_talk = ishuman(speaker) ? human_npc_can_talk(speaker) : (speaker.stat == CONSCIOUS)
+ if(!can_talk)
return FALSE
var/line = bounty_mafia_line(context)
if(!line)
@@ -99,46 +120,15 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
INVOKE_ASYNC(speaker, TYPE_PROC_REF(/atom/movable, say), line)
return TRUE
-/**
- * Fires one round of `weapon` (a /datum/bounty_real_weapon) from `shooter` at `target` (a mob or a turf) as
- * `projectile_type`: every pellet of a shell, each with the real round's numbers and spread, plus `spread` degrees
- * more (full width) if given, and no farther than `max_range` tiles if given. The club's own faction is never hit by
- * it. Returns the first projectile still flying, or null.
- */
-/proc/bounty_mafia_shoot(mob/living/shooter, projectile_type, atom/target, datum/bounty_real_weapon/weapon, spread = 0, max_range)
- var/turf/start = get_turf(shooter)
- var/turf/aim = get_turf(target)
- if(!start || !aim || start == aim || !weapon)
- return null
- var/obj/projectile/first
- for(var/pellet in 1 to weapon.pellets)
- var/obj/projectile/bullet = new projectile_type(start)
- weapon.load(bullet)
- if(max_range)
- bullet.range = max_range
- bullet.maximum_range = max_range
- bullet.firer = shooter
- bullet.fired_from = shooter
- bullet.ignored_factions = shooter.faction?.Copy()
- bullet.spread = spread
- bullet.aim_projectile(target, shooter, null, weapon.shot_spread())
- if(QDELETED(bullet))
- continue
- bullet.fire()
- if(!first && !QDELETED(bullet))
- first = bullet
- if(weapon.fire_sound)
- playsound(shooter, weapon.fire_sound, 60, TRUE)
- return first
-
/**
* Whether `mover`, kept to the room (area) `home`, may step onto `new_loc` on its own: anywhere in its room, never
* out of it, so it fights from its doorway and a fight never drags the next room in (lairs.md 9.2). The same rule as
* P10's /datum/element/bounty_lair_room_leash, which a lair also puts on its mobs at load, so the two always agree:
- * moves it doesn't make itself (pulled, thrown, dead) are never stopped, and once out of its room it walks freely.
+ * moves it doesn't make itself (pulled, carried or wheeled on what it is buckled to, thrown, `shoved`, dead) are never
+ * stopped, and once out of its room it walks freely.
*/
-/proc/bounty_mafia_leash_allows(mob/living/mover, area/home, atom/new_loc)
- if(!home || !new_loc || mover.stat == DEAD || mover.pulledby || mover.throwing)
+/proc/bounty_mafia_leash_allows(mob/living/mover, area/home, atom/new_loc, shoved = FALSE)
+ if(!home || !new_loc || mover.stat == DEAD || mover.pulledby || mover.buckled || mover.throwing || shoved)
return TRUE
if(get_area(mover) != home)
return TRUE
@@ -172,14 +162,14 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
if(!at)
return null
var/static/list/crews = list(
- "foyer" = list(/mob/living/basic/trooper/russian/mafia = 2, /mob/living/basic/trooper/russian/mafia/pistol = 1),
- "cloakroom" = list(/mob/living/basic/trooper/russian/mafia/pistol = 1, /mob/living/basic/trooper/russian/mafia = 1, /mob/living/basic/trooper/russian/mafia/smg = 1),
- "casino" = list(/mob/living/basic/trooper/russian/mafia/pistol = 2, /mob/living/basic/trooper/russian/mafia = 2, /mob/living/basic/trooper/russian/mafia/smg = 1),
- "bar" = list(/mob/living/basic/trooper/russian/mafia/pistol = 2, /mob/living/basic/trooper/russian/mafia/smg = 1, /mob/living/basic/trooper/russian/mafia = 1),
- "kitchen" = list(/mob/living/basic/trooper/russian/mafia = 2, /mob/living/basic/trooper/russian/mafia/pistol = 1),
- "vip" = list(/mob/living/basic/trooper/russian/mafia/smg = 1, /mob/living/basic/trooper/russian/mafia/pistol = 2, /mob/living/basic/trooper/russian/mafia = 1),
- "counting" = list(/mob/living/basic/trooper/russian/mafia/pistol = 1, /mob/living/basic/trooper/russian/mafia = 1, /mob/living/basic/trooper/russian/mafia/smg = 1),
- "back_office" = list(/mob/living/basic/trooper/russian/mafia/pistol = 1),
+ "foyer" = list(/mob/living/carbon/human/npc/bounty_mafia = 2, /mob/living/carbon/human/npc/bounty_mafia/pistol = 1),
+ "cloakroom" = list(/mob/living/carbon/human/npc/bounty_mafia/pistol = 1, /mob/living/carbon/human/npc/bounty_mafia = 1, /mob/living/carbon/human/npc/bounty_mafia/smg = 1),
+ "casino" = list(/mob/living/carbon/human/npc/bounty_mafia/pistol = 2, /mob/living/carbon/human/npc/bounty_mafia = 2, /mob/living/carbon/human/npc/bounty_mafia/smg = 1),
+ "bar" = list(/mob/living/carbon/human/npc/bounty_mafia/pistol = 2, /mob/living/carbon/human/npc/bounty_mafia/smg = 1, /mob/living/carbon/human/npc/bounty_mafia = 1),
+ "kitchen" = list(/mob/living/carbon/human/npc/bounty_mafia = 2, /mob/living/carbon/human/npc/bounty_mafia/pistol = 1),
+ "vip" = list(/mob/living/carbon/human/npc/bounty_mafia/smg = 1, /mob/living/carbon/human/npc/bounty_mafia/pistol = 2, /mob/living/carbon/human/npc/bounty_mafia = 1),
+ "counting" = list(/mob/living/carbon/human/npc/bounty_mafia/pistol = 1, /mob/living/carbon/human/npc/bounty_mafia = 1, /mob/living/carbon/human/npc/bounty_mafia/smg = 1),
+ "back_office" = list(/mob/living/carbon/human/npc/bounty_mafia/pistol = 1),
)
return crews[copytext(type_text, at + length(marker))]
@@ -213,7 +203,7 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
var/room_key
/// Its area
var/datum/weakref/area_ref
- /// Weakrefs to its goons (/mob/living/basic/trooper/russian/mafia)
+ /// Weakrefs to its goons (/mob/living/carbon/human/npc/bounty_mafia)
var/list/members = list()
/// Someone has seen or been hit by a hunter: the shout has gone up
var/alerted = FALSE
@@ -271,26 +261,26 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
break
return room_exits
-/datum/bounty_mafia_room/proc/join(mob/living/basic/trooper/russian/mafia/goon)
+/datum/bounty_mafia_room/proc/join(mob/living/carbon/human/npc/bounty_mafia/goon)
members |= WEAKREF(goon)
-/datum/bounty_mafia_room/proc/leave(mob/living/basic/trooper/russian/mafia/goon)
+/datum/bounty_mafia_room/proc/leave(mob/living/carbon/human/npc/bounty_mafia/goon)
members -= WEAKREF(goon)
if(!length(members))
qdel(src)
-/// Its goons still standing
+/// Its goons still alive
/datum/bounty_mafia_room/proc/goons()
. = list()
for(var/datum/weakref/ref as anything in members)
- var/mob/living/basic/trooper/russian/mafia/goon = ref.resolve()
+ var/mob/living/carbon/human/npc/bounty_mafia/goon = ref.resolve()
if(!QDELETED(goon) && goon.stat != DEAD)
. += goon
/// How many of its goons, besides `except`, are going after `hunter`
/datum/bounty_mafia_room/proc/attackers_on(mob/living/hunter, mob/living/except)
. = 0
- for(var/mob/living/basic/trooper/russian/mafia/goon as anything in goons())
+ for(var/mob/living/carbon/human/npc/bounty_mafia/goon as anything in goons())
if(goon != except && goon.ai_controller?.blackboard[BB_BASIC_MOB_CURRENT_TARGET] == hunter)
.++
@@ -304,221 +294,28 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
* BOUNTY_MOBSTER_ALERT, the others spread over the next BOUNTY_MOBSTER_FIRST_SHOT_SPREAD. Returns TRUE if this
* alerted it.
*/
-/datum/bounty_mafia_room/proc/raise_alarm(mob/living/basic/trooper/russian/mafia/spotter, mob/living/hunter)
+/datum/bounty_mafia_room/proc/raise_alarm(mob/living/carbon/human/npc/bounty_mafia/spotter, mob/living/hunter)
if(hunter)
hunter_ref = WEAKREF(hunter)
if(alerted)
return FALSE
alerted = TRUE
- for(var/mob/living/basic/trooper/russian/mafia/goon as anything in goons())
+ for(var/mob/living/carbon/human/npc/bounty_mafia/goon as anything in goons())
goon.mafia_on_alarm(spotter, goon == spotter ? 0 : rand(0, BOUNTY_MOBSTER_FIRST_SHOT_SPREAD), hunter)
return TRUE
-// ===== GUNS =====
-
-/**
- * A club mob's gun, simulated: no item, nothing to drop, but every round is the real gun's
- * (`gun_type`, bounty_real_weapon()): its damage, wounds, armour penetration, spread and magazine.
- * try_fire() spins it up first if it has a wind-up, then fires a burst of real projectiles, and
- * reloads when the magazine is spent. A hit during the wind-up can spoil it (fumble()). Its timers
- * check `serial`, so a cancelled shot does nothing.
- */
-/datum/bounty_mafia_gun
- /// What it's called in messages
- var/gun_name = "pistol"
- /// The real gun: the one in its owner's hand
- var/gun_type = BOUNTY_MOBSTER_PISTOL_GUN
- var/projectile_type = /obj/projectile/bullet/bounty_mafia
- /// Shots in one burst, and the time between them. A pistol fires a quick string of shots each time.
- var/burst = BOUNTY_MOBSTER_PISTOL_BURST
- var/burst_delay = BOUNTY_MOBSTER_PISTOL_BURST_GAP
- /// From the start of one burst (or wind-up) to the next
- var/cooldown = BOUNTY_MOBSTER_PISTOL_COOLDOWN
- var/reload_time = BOUNTY_MOBSTER_PISTOL_RELOAD
- /// The spin-up before a burst, if any
- var/windup = 0
- /// The wind-up comes once per magazine (the don raises his pistol before each string), not before every burst
- var/windup_once_per_magazine = FALSE
- var/windup_sound
- var/reload_sound = 'sound/items/weapons/gun/pistol/mag_insert.ogg'
- /// Dialogue context its owner may say on reloading, and the chance they do
- var/reload_context = "goon_reload"
- var/reload_bark_chance = 35
- /// A hit during the wind-up spoils it
- var/fumbles = FALSE
- /// The real gun's numbers (/datum/bounty_real_weapon)
- var/datum/bounty_real_weapon/weapon
- /// Rounds in a full magazine: the real gun's
- var/magazine = 0
- /// Rounds left in the magazine
- var/ammo
- /// world.time it may start the next burst or wind-up
- var/next_fire_at = 0
- /// world.time the reload is done
- var/reloading_until = 0
- /// Spinning up now
- var/winding = FALSE
- /// Raised this magazine (windup_once_per_magazine)
- var/raised = FALSE
- /// Goes up with every burst or wind-up, and on a fumble, so stale timers do nothing
- var/serial = 0
- /// Its owner (/mob/living)
- var/datum/weakref/owner_ref
- /// What it's aimed at
- var/datum/weakref/aim_ref
-
-/datum/bounty_mafia_gun/New(mob/living/owner)
- . = ..()
- owner_ref = WEAKREF(owner)
- weapon = bounty_real_weapon(gun_type)
- magazine = max(1, weapon.magazine)
- ammo = magazine
-
-/datum/bounty_mafia_gun/Destroy()
- serial++
- owner_ref = null
- aim_ref = null
- weapon = null
- return ..()
-
-/datum/bounty_mafia_gun/proc/owner()
- var/mob/living/owner = owner_ref?.resolve()
- return QDELETED(owner) ? null : owner
-
-/// Ready to start a burst or a wind-up
-/datum/bounty_mafia_gun/proc/ready()
- return !winding && world.time >= next_fire_at
-
-/datum/bounty_mafia_gun/proc/is_reloading()
- return world.time < reloading_until
-
-/datum/bounty_mafia_gun/proc/owner_can_fire(mob/living/owner)
- return owner && owner.stat == CONSCIOUS && isturf(owner.loc) && !HAS_TRAIT(owner, TRAIT_INCAPACITATED)
-
-/// Starts a burst at `target`, after the wind-up if it has one. Returns TRUE if it started.
-/datum/bounty_mafia_gun/proc/try_fire(atom/target)
- var/mob/living/owner = owner()
- if(!owner_can_fire(owner) || !ready() || QDELETED(target))
- return FALSE
- aim_ref = WEAKREF(target)
- serial++
- owner.face_atom(target)
- if(windup && !(windup_once_per_magazine && raised))
- winding = TRUE
- next_fire_at = world.time + windup + cooldown
- if(windup_sound)
- playsound(owner, windup_sound, 50, TRUE)
- owner.balloon_alert_to_viewers("aiming!")
- addtimer(CALLBACK(src, PROC_REF(finish_windup), serial), windup, TIMER_DELETE_ME)
- return TRUE
- fire_burst()
- return TRUE
-
-/// The wind-up under `fire_serial` is over: the burst goes, unless it was spoiled. Returns TRUE if it fired.
-/datum/bounty_mafia_gun/proc/finish_windup(fire_serial)
- if(fire_serial != serial || !winding)
- return FALSE
- winding = FALSE
- raised = TRUE
- if(!owner_can_fire(owner()))
- return FALSE
- fire_burst()
- return TRUE
-
-/// A burst: as many of its shots as the magazine has rounds left, then a reload if it's spent
-/datum/bounty_mafia_gun/proc/fire_burst()
- var/shots = clamp(burst, 1, ammo)
- ammo -= shots
- next_fire_at = max(next_fire_at, world.time + cooldown)
- var/fire_serial = serial
- shoot_once(fire_serial)
- for(var/i in 2 to shots)
- addtimer(CALLBACK(src, PROC_REF(shoot_once), fire_serial), (i - 1) * burst_delay, TIMER_DELETE_ME)
- if(ammo <= 0)
- start_reload((shots - 1) * burst_delay)
-
-/// One shot of the burst under `fire_serial`. Never at someone who went down meanwhile.
-/datum/bounty_mafia_gun/proc/shoot_once(fire_serial)
- if(fire_serial != serial)
- return null
- var/mob/living/owner = owner()
- var/atom/target = aim_ref?.resolve()
- if(!owner_can_fire(owner) || QDELETED(target))
- return null
- if(isliving(target) && !bounty_mafia_may_hurt(target))
- return null
- owner.face_atom(target)
- return bounty_mafia_shoot(owner, projectile_type, target, weapon)
-
-/// A fresh magazine, ready `delay` + reload_time from now
-/datum/bounty_mafia_gun/proc/start_reload(delay = 0)
- ammo = magazine
- raised = FALSE
- reloading_until = world.time + delay + reload_time
- next_fire_at = max(next_fire_at, reloading_until)
- var/mob/living/owner = owner()
- if(!owner)
- return
- if(reload_sound)
- playsound(owner, reload_sound, 40, TRUE)
- if(reload_context && prob(reload_bark_chance))
- bounty_mafia_say(owner, reload_context)
-
-/// The wind-up is spoiled: nothing fires, and the next try waits `delay`
-/datum/bounty_mafia_gun/proc/fumble(delay)
- serial++
- winding = FALSE
- next_fire_at = max(next_fire_at, world.time + delay)
-
-/datum/bounty_mafia_gun/smg
- gun_name = "SMG"
- gun_type = BOUNTY_MOBSTER_SMG_GUN
- burst = BOUNTY_MOBSTER_SMG_BURST
- burst_delay = BOUNTY_MOBSTER_SMG_BURST_GAP
- cooldown = BOUNTY_MOBSTER_SMG_COOLDOWN
- reload_time = BOUNTY_MOBSTER_SMG_RELOAD
- windup = BOUNTY_MOBSTER_SMG_WINDUP
- windup_sound = 'sound/items/weapons/gun/smg/smgrack.ogg'
- reload_sound = 'sound/items/weapons/gun/general/magazine_insert_full.ogg'
- fumbles = TRUE
-
-/datum/bounty_mafia_gun/tommy
- gun_name = "Tommy gun"
- gun_type = BOUNTY_LIEUTENANT_TOMMY_GUN
- burst = BOUNTY_LIEUTENANT_TOMMY_BURST
- burst_delay = BOUNTY_LIEUTENANT_TOMMY_BURST_GAP
- cooldown = BOUNTY_LIEUTENANT_TOMMY_COOLDOWN
- reload_time = BOUNTY_LIEUTENANT_TOMMY_RELOAD
- windup = BOUNTY_LIEUTENANT_TOMMY_WINDUP
- windup_sound = 'sound/items/weapons/gun/smg/smgrack.ogg'
- reload_sound = 'sound/items/weapons/gun/general/magazine_insert_full.ogg'
-
-/datum/bounty_mafia_gun/don
- gun_name = "gold pistol"
- gun_type = BOUNTY_DON_GUN
- cooldown = BOUNTY_DON_COOLDOWN
- reload_time = BOUNTY_DON_RELOAD
- windup = BOUNTY_DON_RAISE
- windup_once_per_magazine = TRUE
- windup_sound = 'sound/items/weapons/gun/pistol/rack_small.ogg'
- reload_context = "don_reload"
- reload_bark_chance = 50
-
-// ===== PROJECTILES =====
-
-/// A club bullet: the real round of the gun that fires it (bounty_mafia_shoot())
-/obj/projectile/bullet/bounty_mafia
- name = "bullet"
+// ===== THE MECH'S ROUNDS =====
+// The club's people fire the real guns in their hands; only the machine fires rounds of its own.
/// The mech's machine gun: its real exosuit gun's rounds (BOUNTY_MECH_LMG_GUN), which barely scratch furniture
-/obj/projectile/bullet/bounty_mafia/lmg
+/obj/projectile/bullet/bounty_mafia_lmg
name = "machine gun round"
demolition_mod = BOUNTY_MECH_LMG_DEMOLITION
/**
* The mech's rocket: the cyberware buster's pattern, never tg's rocket and never explosion(). It flies through
- * people to the marker it was fired at, and there does BOUNTY_MECH_ROCKET_DAMAGE brute and a knockdown to each
- * hunter still standing on it, once a volley each. A player's exosuit in its way takes
+ * people to the marker it was fired at, and there it bursts: tg's light blast (ex_act(EXPLODE_LIGHT)) on everyone
+ * standing on it, whatever their state, once a volley each. A player's exosuit in its way takes
* BOUNTY_MECH_ROCKET_EXOSUIT_DAMAGE, never the anti-structure multiplier. It bursts harmlessly on a wall, a pillar
* or anything else in its way; it breaks tables, windows and doors only inside the club's garage.
*/
@@ -535,7 +332,7 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
projectile_phasing = PASSMOB
/// The marker it flies to
var/turf/rocket_target
- /// REF() of each hunter this volley has hit -> TRUE, shared by the volley's rockets
+ /// REF() of each mob this volley has hit -> TRUE, shared by the volley's rockets
var/list/rocket_volley
/// The arena (/area), the only place it breaks things
var/datum/weakref/rocket_area_ref
@@ -590,7 +387,7 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
return FALSE
return get_area(spot) == arena
-/// The bang, and nothing else: the fake explosion and its sound
+/// The look and sound of the burst, and nothing else
/obj/projectile/bullet/bounty_mafia_rocket/proc/rocket_burst(turf/spot)
if(rocket_done || !spot)
return FALSE
@@ -599,53 +396,46 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
playsound(spot, 'sound/effects/explosion/explosion1.ogg', 60, TRUE)
return TRUE
-/// It reached its marker on `spot`: the bang, and the hit on each hunter standing there not yet hit this volley. Returns who it hit.
+/**
+ * It reached its marker on `spot`: the burst, and tg's light blast on each mob standing there that this volley hasn't
+ * caught yet, whatever its state (CB-10: the blast is ex_act's, which spreads the damage, wounds, deafens and knocks
+ * down by the victim's bomb armour; no explosion(), so nothing is breached). Returns who it caught.
+ */
/obj/projectile/bullet/bounty_mafia_rocket/proc/rocket_detonate(turf/spot)
. = list()
if(rocket_done || !spot)
return
rocket_burst(spot)
for(var/mob/living/victim in spot)
- if(!bounty_mafia_may_hurt(victim))
+ if(victim == firer)
continue
var/key = REF(victim)
if(rocket_volley?[key])
continue
if(rocket_volley)
rocket_volley[key] = TRUE
- var/blocked = victim.run_armor_check(BODY_ZONE_CHEST, BULLET, silent = TRUE)
- victim.apply_damage(npc_zone_damage(damage, npc_zone_damage_factor, npc_zone_damage_scaled), BRUTE, BODY_ZONE_CHEST, blocked)
- victim.Knockdown(BOUNTY_MECH_ROCKET_KNOCKDOWN)
+ victim.ex_act(EXPLODE_LIGHT, null, src)
to_chat(victim, span_userdanger("A rocket bursts right at your feet!"))
. += victim
if(!QDELETED(src))
qdel(src)
-// ===== GOONS =====
+// ===== THE CLUB'S PEOPLE =====
/**
- * A club mobster. The base is the knife man; /pistol and /smg carry guns. Every blow and round is the real
- * item's in its hand (`r_hand`, bounty_real_weapon()), at the club's own pace (lairs.md 3.1).
+ * A club mobster, a person. The base is the knife man; /pistol and /smg carry guns, /lieutenant holds the gate and
+ * /don runs the family. Each holds its real weapon from the start (they are on the clock in a mob club), with its
+ * spare magazines in its pockets, and fights with it through its hands (the AI's clicks).
*/
-/mob/living/basic/trooper/russian/mafia
- name = "mobster"
- desc = "A heavy in a tracksuit, working for the family that runs this club. He has a knife out."
- maxHealth = BOUNTY_MOBSTER_KNIFE_HEALTH
- health = BOUNTY_MOBSTER_KNIFE_HEALTH
- speed = BOUNTY_MOBSTER_KNIFE_SPEED
- melee_attack_cooldown = BOUNTY_MOBSTER_KNIFE_COOLDOWN
+/mob/living/carbon/human/npc/bounty_mafia
+ npc_name = "mobster"
+ npc_look = /obj/effect/mob_spawn/corpse/human/bounty_mafia
+ npc_outfit = /datum/outfit/bounty_mafia_goon/armed
+ npc_target_stat = HUMAN_NPC_SPARES_DOWNED
faction = list(FACTION_RUSSIAN, BOUNTY_MAFIA_FACTION)
- sentience_type = SENTIENCE_BOSS
- // They talk to the hunters, so they speak Common
- initial_language_holder = /datum/language_holder/atom_basic
- mob_spawner = /obj/effect/mob_spawn/corpse/human/bounty_mafia
- corpse = /obj/effect/mob_spawn/corpse/human/bounty_mafia
- r_hand = BOUNTY_MOBSTER_KNIFE
- loot = null
ai_controller = /datum/ai_controller/basic_controller/bounty_mafia
- /// The gun it fights with (a /datum/bounty_mafia_gun type), or null for a knife
- var/mafia_gun_type
- var/datum/bounty_mafia_gun/mafia_gun
+ /// A line on examine: who they are, never how to fight them
+ var/mafia_examine_line = "He works for the family that runs this club."
/// Its room: the area it spawned in, which it never walks out of
var/datum/weakref/mafia_home_ref
/// Where it spawned, to walk back to if it's ever pushed out of its room
@@ -658,46 +448,97 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
var/mafia_next_bark_at = 0
/// Prefix of its dialogue contexts; lines it has none of come from "goon"
var/mafia_voice = "goon"
+ /// It chats about the club while nobody is fighting (the don doesn't)
+ var/mafia_idle_chatter = TRUE
+ /// Percent chance it says something when it's hurt
+ var/mafia_hurt_bark_chance = 20
/// world.time it first found itself out of its room with nobody to fight, or 0
var/mafia_away_since = 0
/// It has kicked a table over for cover this fight
var/mafia_took_cover = FALSE
-
-/mob/living/basic/trooper/russian/mafia/Initialize(mapload)
+ /// world.time someone last shoved it: that tick's push is someone else's move, which its room never holds back
+ var/mafia_shoved_at = -1
+
+ // ----- how it fires its gun (a volley: the aim, then the pulls, then a pause) -----
+ /// The aim before a volley ("aiming!"), or 0 for none
+ var/mafia_windup = 0
+ /// The aim comes once per magazine (the don raises his pistol before the first string), not before every volley
+ var/mafia_windup_once = FALSE
+ var/mafia_windup_sound
+ /// A hit during the aim spoils it
+ var/mafia_fumbles = FALSE
+ /// Pulls of the trigger in a volley, and the time between them
+ var/mafia_volley = BOUNTY_MOBSTER_PISTOL_VOLLEY
+ var/mafia_volley_gap = BOUNTY_MOBSTER_PISTOL_VOLLEY_GAP
+ /// From the end of one volley to the start of the next
+ var/mafia_cooldown = BOUNTY_MOBSTER_PISTOL_STRING_PAUSE
+ /// Its gun is set to single shots with its own fire selector before it fires (a pistol: a string of single shots)
+ var/mafia_single_fire = FALSE
+ /// What it says as it reloads ("[voice]_[context]"), how often, and the sound of its hand going for a magazine
+ var/mafia_reload_context = "reload"
+ var/mafia_reload_chance = 35
+ var/mafia_reload_sound = 'sound/items/weapons/gun/pistol/mag_insert.ogg'
+ /// world.time the aim under way is done, or 0
+ var/mafia_aim_until = 0
+ /// A hit spoiled the aim under way
+ var/mafia_aim_spoiled = FALSE
+ /// Raised this magazine (mafia_windup_once)
+ var/mafia_raised = FALSE
+ /// Pulls left in the volley under way
+ var/mafia_volley_left = 0
+ /// world.time of its next pull in the volley, and of its next volley
+ var/mafia_next_pull_at = 0
+ var/mafia_next_volley_at = 0
+
+/mob/living/carbon/human/npc/bounty_mafia/Initialize(mapload, datum/human_npc_order/order)
. = ..()
- // Its blows are the real item's in its hand (bare fists without one)
- bounty_real_weapon(r_hand).apply_melee(src)
- if(mafia_gun_type)
- mafia_gun = new mafia_gun_type(src)
- mafia_home_turf = get_turf(src)
- var/area/home = get_area(src)
- if(home)
- mafia_home_ref = WEAKREF(home)
- mafia_room_key = REF(home)
- var/datum/bounty_mafia_room/room = bounty_mafia_room_for(home)
- room.join(src)
+ mafia_settle_home()
AddElement(/datum/element/relay_attackers)
- RegisterSignal(src, COMSIG_ATOM_WAS_ATTACKED, PROC_REF(mafia_on_attacked))
- RegisterSignal(src, COMSIG_ATOM_BULLET_ACT, PROC_REF(mafia_on_bullet_act))
- RegisterSignal(src, COMSIG_MOVABLE_PRE_MOVE, PROC_REF(mafia_on_pre_move))
- RegisterSignal(src, COMSIG_MOB_AFTER_APPLY_DAMAGE, PROC_REF(mafia_on_damaged))
- // A polymorph or a type change deletes it without a death: a free kill, and for a lieutenant a free gate
- RegisterSignal(src, COMSIG_LIVING_PRE_WABBAJACKED, PROC_REF(mafia_refuse_polymorph))
- RegisterSignal(src, COMSIG_PRE_MOB_CHANGED_TYPE, PROC_REF(mafia_refuse_type_change))
+ AddElement(/datum/element/bounty_mafia_body)
-/mob/living/basic/trooper/russian/mafia/Destroy()
+/mob/living/carbon/human/npc/bounty_mafia/Destroy()
var/datum/bounty_mafia_room/room = mafia_room()
room?.leave(src)
- QDEL_NULL(mafia_gun)
mafia_home_ref = null
mafia_home_turf = null
- // The shout's "!" (do_alert_animation) forgets itself on a timer that dies with us: let it go now, or it hard-deletes
- update_on_z = null
+ // The shout's "!" (do_alert_animation) forgets itself on a timer that dies with us: let it go now
+ for(var/atom/movable/flick_visual/visual in update_on_z)
+ LAZYREMOVE(update_on_z, visual)
return ..()
-/mob/living/basic/trooper/russian/mafia/Life(seconds_per_tick = SSMOBS_DT, times_fired)
+/// Takes the room it stands in as its home: its leash, its shout and its doorway cap
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_settle_home()
+ mafia_home_turf = get_turf(src)
+ var/area/home = get_area(src)
+ if(!home)
+ return
+ mafia_home_ref = WEAKREF(home)
+ mafia_room_key = REF(home)
+ bounty_mafia_room_for(home).join(src)
+
+// Club Volga's men: the face and hair of their look, always a man's build
+/mob/living/carbon/human/npc/bounty_mafia/npc_apply_spawner_look(obj/effect/mob_spawn/spawner)
+ . = ..()
+ if(gender == MALE)
+ return
+ gender = MALE
+ physique = MALE
+ update_body(is_creating = TRUE)
+
+/mob/living/carbon/human/npc/bounty_mafia/examine(mob/user)
+ . = ..()
+ if(mafia_examine_line && stat != DEAD)
+ . += span_notice(mafia_examine_line)
+
+// OC-9: no deliberate executions are built this phase, so the club never executes anyone by accident
+/mob/living/carbon/human/npc/bounty_mafia/hv_can_execute()
+ return !isnull(client)
+
+/mob/living/carbon/human/npc/bounty_mafia/Life(seconds_per_tick = SSMOBS_DT, times_fired)
. = ..()
- if(stat != CONSCIOUS || world.time < mafia_next_bark_at || !SPT_PROB(BOUNTY_MAFIA_IDLE_BARK_CHANCE, seconds_per_tick))
+ if(!mafia_idle_chatter || stat != CONSCIOUS || npc_dormant())
+ return
+ if(world.time < mafia_next_bark_at || !SPT_PROB(BOUNTY_MAFIA_IDLE_BARK_CHANCE, seconds_per_tick))
return
var/datum/bounty_mafia_room/room = mafia_room()
if(room?.alerted || !mafia_player_nearby())
@@ -705,7 +546,7 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
mafia_bark("idle")
/// Whether a player is close enough to hear it chat
-/mob/living/basic/trooper/russian/mafia/proc/mafia_player_nearby()
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_player_nearby()
var/turf/here = get_turf(src)
if(!here || here.z > length(SSmobs.clients_by_zlevel))
return FALSE
@@ -715,28 +556,112 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
return FALSE
/// Its room (/datum/bounty_mafia_room), or null
-/mob/living/basic/trooper/russian/mafia/proc/mafia_room()
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_room()
return mafia_room_key ? GLOB.bounty_mafia_rooms[mafia_room_key] : null
/// Says a line for "_" (or the plain goon one) unless it spoke recently or `force`. TRUE if it spoke.
-/mob/living/basic/trooper/russian/mafia/proc/mafia_bark(context, force = FALSE)
- if(stat != CONSCIOUS || (!force && world.time < mafia_next_bark_at))
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_bark(context, force = FALSE)
+ if(!human_npc_can_talk(src) || (!force && world.time < mafia_next_bark_at))
return FALSE
if(!bounty_mafia_say(src, "[mafia_voice]_[context]") && (mafia_voice == "goon" || !bounty_mafia_say(src, "goon_[context]")))
return FALSE
mafia_next_bark_at = world.time + BOUNTY_MAFIA_BARK_COOLDOWN
return TRUE
-/mob/living/basic/trooper/russian/mafia/proc/mafia_refuse_polymorph(datum/source, what_to_randomize)
- SIGNAL_HANDLER
- return STOP_WABBAJACK
+/**
+ * The base reactions (human_npc_barks.dm) speak the club's lines: going down is a hurt line, breaking a grab is
+ * "Hands off." Everything else they react to (cuffs on and off, working at them, death) is left to tg's messages.
+ */
+/mob/living/carbon/human/npc/bounty_mafia/npc_bark(kind, force = FALSE)
+ switch(kind)
+ if(HUMAN_NPC_BARK_DOWNED)
+ return mafia_bark("hurt", force = TRUE)
+ if(HUMAN_NPC_BARK_PULLED_FREE)
+ return mafia_bark("shoved", force = TRUE)
+ return FALSE
-/mob/living/basic/trooper/russian/mafia/proc/mafia_refuse_type_change(datum/source)
- SIGNAL_HANDLER
- return COMPONENT_BLOCK_MOB_CHANGE
+// It broke a hunter's grab by resisting: the hunter feels it shove them off
+/mob/living/carbon/human/npc/bounty_mafia/npc_check_pulled_free(atom/movable/holder, within = 0)
+ var/broke_free = npc_resisted_at && world.time <= npc_resisted_at + within
+ var/mob/living/resisted = npc_resisted_hold?.resolve()
+ . = ..()
+ if(!broke_free || !isliving(resisted) || (holder && resisted != holder))
+ return
+ balloon_alert(resisted, "[p_they()] shove[p_s()] you off!")
+
+// ----- what happens to it (/datum/element/bounty_mafia_body relays these) -----
+
+/**
+ * `attacker` (a player, or an exosuit's pilots) went for it: its room is alerted, and it turns on them if it has no
+ * one else, and only while the doorway cap has room (so shooting a goon held back never pulls it in).
+ */
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_answer_attack(atom/attacker)
+ if(stat == DEAD || !attacker)
+ return
+ for(var/mob/living/hunter as anything in bounty_mafia_attackers(attacker))
+ mafia_raise_alarm(hunter)
+ if(ai_controller && !ai_controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET) && mafia_target_ok(hunter) && mafia_room_has_space(hunter))
+ ai_controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, hunter)
+
+/**
+ * A hunter has hold of it (a grab, a carry, the cuffs coming out): that's an attack. The room is alerted and the
+ * hunter is its target, doorway cap or not. Its AI resists the hold the tg way (escape_captivity). TRUE if it answered.
+ */
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_answer_grab(mob/living/grabber)
+ if(stat == DEAD || !bounty_mafia_is_hunter(grabber) || faction_check_atom(grabber))
+ return FALSE
+ mafia_raise_alarm(grabber)
+ if(ai_controller && ai_controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET] != grabber && mafia_target_ok(grabber))
+ ai_controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, grabber)
+ return TRUE
+
+/// Whether it can still answer cuffs on its own feet: up, awake, free, and nobody holding it
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_can_answer_cuffs()
+ if(stat != CONSCIOUS || !isturf(loc) || buckled || pulledby || body_position != STANDING_UP)
+ return FALSE
+ return !HAS_TRAIT(src, TRAIT_INCAPACITATED) && !HAS_TRAIT(src, TRAIT_FLOORED) && !HAS_TRAIT(src, TRAIT_IMMOBILIZED) && !HAS_TRAIT(src, TRAIT_RESTRAINED)
+
+/**
+ * tg's attempt_to_cuff() has begun on it (COMSIG_CARBON_CUFF_ATTEMPTED, defaults 1.4, CB-15). The cuffer is its target,
+ * and if it can still move it says so and, a moment into the cuffer's four seconds, steps away: a real step, which
+ * breaks their do_after. Down, paralysed or held, it can't, and the cuffs go on. Never COMSIG_CARBON_CUFF_PREVENT.
+ */
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_on_cuff_attempt(mob/living/user)
+ if(stat == DEAD || !isliving(user))
+ return
+ mafia_answer_grab(user)
+ if(!mafia_can_answer_cuffs())
+ return
+ mafia_bark("cuffed", force = TRUE)
+ addtimer(CALLBACK(src, PROC_REF(mafia_dodge_cuffs), WEAKREF(user)), BOUNTY_MAFIA_CUFF_REACTION, TIMER_DELETE_ME)
+
+/// One step away from `user_ref`'s cuffer, if it still can. TRUE if it stepped.
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_dodge_cuffs(datum/weakref/user_ref)
+ var/mob/living/user = user_ref?.resolve()
+ if(QDELETED(user) || !mafia_can_answer_cuffs() || !Adjacent(user))
+ return FALSE
+ var/turf/here = get_turf(src)
+ var/away = get_dir(user, src) || pick(GLOB.cardinals)
+ for(var/direction in list(away, turn(away, 45), turn(away, -45), turn(away, 90), turn(away, -90)))
+ var/turf/spot = get_step(here, direction)
+ if(!spot || spot.is_blocked_turf())
+ continue
+ // A real step: its room's leash and everything else on a move apply
+ if(Move(spot, direction) && get_turf(src) == spot)
+ return TRUE
+ return FALSE
+
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_on_damaged(damage, damagetype)
+ if(damage <= 0 || stat != CONSCIOUS)
+ return
+ if(mafia_fumbles && mafia_aim_until && !mafia_aim_spoiled)
+ mafia_aim_spoiled = TRUE
+ visible_message(span_notice("[src] flinches and loses [p_their()] aim."))
+ if(prob(mafia_hurt_bark_chance))
+ mafia_bark("hurt")
/// Its room was alerted by `spotter` over `hunter`; it may attack `delay` after the shout, and a gunman takes cover
-/mob/living/basic/trooper/russian/mafia/proc/mafia_on_alarm(mob/living/basic/trooper/russian/mafia/spotter, delay = 0, mob/living/hunter)
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_on_alarm(mob/living/carbon/human/npc/bounty_mafia/spotter, delay = 0, mob/living/hunter)
mafia_ready_at = world.time + BOUNTY_MOBSTER_ALERT + delay
if(spotter == src)
do_alert_animation()
@@ -748,8 +673,8 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
* A gunman kicks over a wood table beside it, on its side toward `hunter`, once a fight (lairs.md 3.1). The table's
* top faces the hunter, so their shots hit it and the gunman's pass over it. Returns the table, or null.
*/
-/mob/living/basic/trooper/russian/mafia/proc/mafia_take_cover(mob/living/hunter)
- if(mafia_took_cover || !mafia_gun || stat != CONSCIOUS || QDELETED(hunter))
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_take_cover(mob/living/hunter)
+ if(mafia_took_cover || !human_npc_held_gun(src) || !mafia_can_act() || QDELETED(hunter))
return null
var/turf/here = get_turf(src)
var/toward = here ? get_dir(here, hunter) : NONE
@@ -777,7 +702,7 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
return cover
/// Raises its room's alarm over `hunter`, or just its own with no room. TRUE if this raised it.
-/mob/living/basic/trooper/russian/mafia/proc/mafia_raise_alarm(mob/living/hunter)
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_raise_alarm(mob/living/hunter)
var/datum/bounty_mafia_room/room = mafia_room()
if(room?.raise_alarm(src, hunter))
return TRUE
@@ -787,34 +712,28 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
mafia_on_alarm(room ? null : src, room ? rand(0, BOUNTY_MOBSTER_FIRST_SHOT_SPREAD) : 0)
return TRUE
-/// Whether it can do anything at all
-/mob/living/basic/trooper/russian/mafia/proc/mafia_can_act()
+/// Whether it can do anything at all on its feet
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_can_act()
return !QDELETED(src) && stat == CONSCIOUS && isturf(loc) && !HAS_TRAIT(src, TRAIT_INCAPACITATED)
// ----- its room -----
/// Whether it stands in its own room
-/mob/living/basic/trooper/russian/mafia/proc/mafia_at_home()
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_at_home()
var/area/home = mafia_home_ref?.resolve()
return !home || get_area(src) == home
/// Whether it may step onto `spot` on its own: anywhere in its room, never out of it (bounty_mafia_leash_allows())
-/mob/living/basic/trooper/russian/mafia/proc/mafia_leash_allows(turf/spot)
- return bounty_mafia_leash_allows(src, mafia_home_ref?.resolve(), spot)
-
-/mob/living/basic/trooper/russian/mafia/proc/mafia_on_pre_move(datum/source, atom/new_loc)
- SIGNAL_HANDLER
- if(!mafia_leash_allows(get_turf(new_loc)))
- return COMPONENT_MOVABLE_BLOCK_PRE_MOVE
- return NONE
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_leash_allows(turf/spot)
+ return bounty_mafia_leash_allows(src, mafia_home_ref?.resolve(), spot, mafia_shoved_at == world.time)
/// Whether its next step toward `target` stays in its room
-/mob/living/basic/trooper/russian/mafia/proc/mafia_step_ok(atom/target)
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_step_ok(atom/target)
var/turf/next = get_step_towards(src, target)
return next && mafia_leash_allows(next)
/// Its room's door tile nearest `target`: where it goes to get a line on someone outside, when a straight step won't do
-/mob/living/basic/trooper/russian/mafia/proc/mafia_exit_toward(atom/target)
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_exit_toward(atom/target)
var/datum/bounty_mafia_room/room = mafia_room()
if(!room || !target)
return null
@@ -831,7 +750,7 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
* Out of its room with nobody to fight: it walks back. If it hasn't made it in BOUNTY_MOBSTER_ROOM_GIVE_UP (another
* leash keeps it where it is), the room it stands in becomes its room. Returns the turf it walks to, or null.
*/
-/mob/living/basic/trooper/russian/mafia/proc/mafia_head_home()
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_head_home()
if(mafia_at_home())
mafia_away_since = 0
return null
@@ -843,7 +762,7 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
return mafia_home_turf
/// `new_home` is its room from now on: its leash, its shout and its doorway cap
-/mob/living/basic/trooper/russian/mafia/proc/mafia_adopt_room(area/new_home)
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_adopt_room(area/new_home)
if(!new_home)
return
var/datum/bounty_mafia_room/old_room = mafia_room()
@@ -857,14 +776,14 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
// ----- targets -----
/// Whether it may go after `target`: a hunter on their feet, on its level and near
-/mob/living/basic/trooper/russian/mafia/proc/mafia_target_ok(mob/living/target)
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_target_ok(mob/living/target)
if(!bounty_mafia_may_hurt(target) || faction_check_atom(target))
return FALSE
var/turf/spot = get_turf(target)
return spot && spot.z == z && get_dist(src, spot) <= BOUNTY_MOBSTER_CHASE
/// Whether `hunter` is in a doorway as its room sees it: outside the room, or on a door tile
-/mob/living/basic/trooper/russian/mafia/proc/mafia_in_doorway(mob/living/hunter)
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_in_doorway(mob/living/hunter)
var/turf/spot = get_turf(hunter)
if(!spot)
return FALSE
@@ -874,7 +793,7 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
return !isnull(locate(/obj/machinery/door) in spot)
/// Whether it may take `hunter` on: fewer than BOUNTY_MOBSTER_MAX_ON_ONE of its room already on a hunter in a doorway
-/mob/living/basic/trooper/russian/mafia/proc/mafia_room_has_space(mob/living/hunter)
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_room_has_space(mob/living/hunter)
if(!mafia_in_doorway(hunter))
return TRUE
var/datum/bounty_mafia_room/room = mafia_room()
@@ -885,7 +804,7 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
* room's alarm), else the one its alerted room knows about, to get a line on from inside the room. Only
* players on its level with a client are looked at, from SSmobs' list.
*/
-/mob/living/basic/trooper/russian/mafia/proc/mafia_find_target()
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_find_target()
var/datum/ai_controller/controller = ai_controller
if(!controller)
return null
@@ -921,130 +840,114 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, best)
return best
-/**
- * A hunter is pulling or grabbing it: that's an attack. The room is alerted and the grabber is its target, doorway cap
- * or not. Returns TRUE while it is held, so it resists before anything else.
- */
-/mob/living/basic/trooper/russian/mafia/proc/mafia_answer_grab()
- var/mob/living/grabber = pulledby
- if(!bounty_mafia_is_hunter(grabber) || faction_check_atom(grabber))
- return FALSE
- mafia_raise_alarm(grabber)
- if(ai_controller && ai_controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET] != grabber && mafia_target_ok(grabber))
- ai_controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, grabber)
- return TRUE
-
/// Whether it's past the shout and may attack
-/mob/living/basic/trooper/russian/mafia/proc/mafia_is_ready()
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_is_ready()
var/datum/bounty_mafia_room/room = mafia_room()
if(room && !room.alerted)
return FALSE
return mafia_ready_at && world.time >= mafia_ready_at
-/// One attack on `target`: a burst if it has a gun and a line, a stab if it's next to them. TRUE if it attacked.
-/mob/living/basic/trooper/russian/mafia/proc/mafia_attack(mob/living/target)
- if(!mafia_can_act() || !mafia_is_ready() || !mafia_target_ok(target))
+// ----- fighting, through its hands -----
+
+/**
+ * Queues its next move against `target` on `controller`: a reload from its pockets when its gun is dry, a volley
+ * when it has a loaded gun and a line, its knife or fists when it's next to them. TRUE if it queued one (or is
+ * between volleys, standing its ground); FALSE if it has to move to get at them.
+ */
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_plan_attack(datum/ai_controller/controller, mob/living/target)
+ if(HAS_TRAIT(src, TRAIT_HANDS_BLOCKED))
return FALSE
- face_atom(target)
- if(mafia_gun)
- if(!can_see(src, target, BOUNTY_MOBSTER_SIGHT))
+ var/obj/item/gun/gun = human_npc_held_gun(src)
+ if(gun && !gun.can_shoot() && !LAZYLEN(do_afters) && world.time >= controller.blackboard[BB_HUMAN_NPC_ARMING_RETRY_AT] && human_npc_can_reload(src, gun))
+ controller.queue_behavior(/datum/ai_behavior/human_npc_reload/bounty_mafia)
+ return TRUE
+ if(human_npc_loaded_gun(src))
+ if(!can_see(src, target, mafia_sight()))
return FALSE
- return mafia_gun.try_fire(target)
- if(!Adjacent(target) || world.time < next_move)
+ controller.queue_behavior(/datum/ai_behavior/bounty_mafia_fire, BB_BASIC_MOB_CURRENT_TARGET)
+ return TRUE
+ if(!Adjacent(target))
return FALSE
- return melee_attack(target)
-
-// ----- what happens to it -----
-
-/mob/living/basic/trooper/russian/mafia/proc/mafia_on_attacked(datum/source, atom/attacker, attack_flags)
- SIGNAL_HANDLER
- if(!(attack_flags & (ATTACKER_DAMAGING_ATTACK | ATTACKER_STAMINA_ATTACK)))
- return
- mafia_answer_attack(attacker)
-
-// Every shot that hits it, the ones relay_attackers skips too: an exosuit's guns fire as the suit
-/mob/living/basic/trooper/russian/mafia/proc/mafia_on_bullet_act(datum/source, obj/projectile/shot, def_zone, piercing_hit, blocked)
- SIGNAL_HANDLER
- mafia_answer_attack(shot?.firer)
+ controller.queue_behavior(mafia_melee_behavior(), BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETING_STRATEGY, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION)
+ return TRUE
-/**
- * `attacker` (a player, or an exosuit's pilots) went for it: its room is alerted, and it turns on them if it has no
- * one else, and only while the doorway cap has room (so shooting a goon held back never pulls it in).
- */
-/mob/living/basic/trooper/russian/mafia/proc/mafia_answer_attack(atom/attacker)
- if(stat == DEAD || !attacker)
- return
- for(var/mob/living/hunter as anything in bounty_mafia_attackers(attacker))
- mafia_raise_alarm(hunter)
- if(ai_controller && !ai_controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET) && mafia_target_ok(hunter) && mafia_room_has_space(hunter))
- ai_controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, hunter)
+/// How far it sees and shoots
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_sight()
+ return BOUNTY_MOBSTER_SIGHT
-/mob/living/basic/trooper/russian/mafia/proc/mafia_on_damaged(datum/source, damage, damagetype)
- SIGNAL_HANDLER
- if(damage <= 0 || stat != CONSCIOUS)
- return
- if(mafia_gun?.fumbles && mafia_gun.winding)
- mafia_gun.fumble(BOUNTY_MOBSTER_FUMBLE)
- visible_message(span_notice("[src] flinches and loses [p_their()] aim."))
- if(prob(20))
- mafia_bark("hurt")
+/// The behaviour it hits with up close: tg's melee, with the best thing it holds or its fist
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_melee_behavior()
+ return /datum/ai_behavior/basic_melee_attack/human_npc
-/// A gunman with a pistol
-/mob/living/basic/trooper/russian/mafia/pistol
- name = "mobster gunman"
- desc = "A heavy in a balaclava and a leather jacket, working for the family that runs this club. He has a pistol."
- maxHealth = BOUNTY_MOBSTER_PISTOL_HEALTH
- health = BOUNTY_MOBSTER_PISTOL_HEALTH
- speed = BOUNTY_MOBSTER_PISTOL_SPEED
- mob_spawner = /obj/effect/mob_spawn/corpse/human/bounty_mafia/pistol
- corpse = /obj/effect/mob_spawn/corpse/human/bounty_mafia/pistol
- r_hand = BOUNTY_MOBSTER_PISTOL_GUN
- attack_vis_effect = ATTACK_EFFECT_PUNCH
- mafia_gun_type = /datum/bounty_mafia_gun
-
-/// An enforcer with an SMG that spins up before each burst
-/mob/living/basic/trooper/russian/mafia/smg
- name = "mobster enforcer"
- desc = "A heavy in a balaclava and a leather jacket, working for the family that runs this club. He has an SMG."
- maxHealth = BOUNTY_MOBSTER_SMG_HEALTH
- health = BOUNTY_MOBSTER_SMG_HEALTH
- speed = BOUNTY_MOBSTER_SMG_SPEED
- mob_spawner = /obj/effect/mob_spawn/corpse/human/bounty_mafia/smg
- corpse = /obj/effect/mob_spawn/corpse/human/bounty_mafia/smg
- r_hand = BOUNTY_MOBSTER_SMG_GUN
- attack_vis_effect = ATTACK_EFFECT_PUNCH
- mafia_gun_type = /datum/bounty_mafia_gun/smg
+/// It starts aiming at `target`: the "aiming!" telegraph, its gun's sound, and nothing fires until mafia_aim_until
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_start_aim(atom/target)
+ mafia_aim_until = world.time + mafia_windup
+ mafia_aim_spoiled = FALSE
+ face_atom(target)
+ if(mafia_windup_sound)
+ playsound(src, mafia_windup_sound, 50, TRUE)
+ balloon_alert_to_viewers("aiming!")
+
+/// It reaches for a fresh magazine (its AI's reload, human_npc_reload): the sound, maybe a line, and the next magazine needs raising again
+/mob/living/carbon/human/npc/bounty_mafia/proc/mafia_on_reload()
+ mafia_raised = FALSE
+ if(mafia_reload_sound)
+ playsound(src, mafia_reload_sound, 40, TRUE)
+ if(mafia_reload_context && prob(mafia_reload_chance))
+ mafia_bark(mafia_reload_context)
+
+/// A gunman with a Stechkin, fired a single shot at a time
+/mob/living/carbon/human/npc/bounty_mafia/pistol
+ npc_name = "mobster gunman"
+ npc_look = /obj/effect/mob_spawn/corpse/human/bounty_mafia/pistol
+ npc_outfit = /datum/outfit/bounty_mafia_goon/pistol/armed
+ mafia_single_fire = TRUE
+
+/// An enforcer with an Uzi that spins up before each volley
+/mob/living/carbon/human/npc/bounty_mafia/smg
+ npc_name = "mobster enforcer"
+ npc_look = /obj/effect/mob_spawn/corpse/human/bounty_mafia/smg
+ npc_outfit = /datum/outfit/bounty_mafia_goon/smg/armed
+ mafia_windup = BOUNTY_MOBSTER_SMG_WINDUP
+ mafia_windup_sound = 'sound/items/weapons/gun/smg/smgrack.ogg'
+ mafia_fumbles = TRUE
+ mafia_volley = BOUNTY_MOBSTER_SMG_VOLLEY
+ mafia_volley_gap = BOUNTY_MOBSTER_SMG_VOLLEY_GAP
+ mafia_cooldown = BOUNTY_MOBSTER_SMG_COOLDOWN
+ mafia_reload_sound = 'sound/items/weapons/gun/general/magazine_insert_full.ogg'
// ===== LIEUTENANTS =====
/**
- * The two who hold the arena gate: "Tommy" with a Tommy gun and "Brute" with his fists. Both take
- * BOUNTY_LIEUTENANT_DAMAGE_MOD of any brute or burn. The base type takes the role its room doesn't have yet,
- * so the first is Tommy and the second Brute; /tommy and /brute fix it. P10 opens the gate on their deaths
- * (COMSIG_LIVING_DEATH; they are deleted right after, as troopers are).
+ * The two who hold the arena gate: "Tommy" with a Thompson and "Brute" with his fists. Elites (aimed crits, fire
+ * from the floor), in real armour, and they take BOUNTY_LIEUTENANT_DAMAGE_TAKEN of any brute or burn through their
+ * bodies. The base type takes the role its room doesn't have yet, so the first is Tommy and the second Brute;
+ * /tommy and /brute fix it. P10 opens the gate on their deaths (COMSIG_LIVING_DEATH).
*/
-/mob/living/basic/trooper/russian/mafia/lieutenant
- name = "lieutenant"
- desc = "One of the don's lieutenants."
- maxHealth = BOUNTY_LIEUTENANT_TOMMY_HEALTH
- health = BOUNTY_LIEUTENANT_TOMMY_HEALTH
+/mob/living/carbon/human/npc/bounty_mafia/lieutenant
+ npc_name = "lieutenant"
+ npc_rank = HUMAN_NPC_RANK_ELITE
+ npc_damage_taken = BOUNTY_LIEUTENANT_DAMAGE_TAKEN
+ mafia_examine_line = "One of the don's lieutenants."
/// BOUNTY_LIEUTENANT_TOMMY or BOUNTY_LIEUTENANT_BRUTE; null picks one at Initialize
var/mafia_lieutenant_role
+ /// Percent chance a punch of Brute's that lands knocks them down
+ var/mafia_punch_knockdown_chance = BOUNTY_LIEUTENANT_BRUTE_KNOCKDOWN_CHANCE
-/mob/living/basic/trooper/russian/mafia/lieutenant/Initialize(mapload)
+/mob/living/carbon/human/npc/bounty_mafia/lieutenant/Initialize(mapload, datum/human_npc_order/order)
if(!mafia_lieutenant_role)
mafia_lieutenant_role = mafia_pick_lieutenant_role()
mafia_apply_lieutenant_role()
return ..()
/// The role its room doesn't have yet: Tommy first, then Brute
-/mob/living/basic/trooper/russian/mafia/lieutenant/proc/mafia_pick_lieutenant_role()
+/mob/living/carbon/human/npc/bounty_mafia/lieutenant/proc/mafia_pick_lieutenant_role()
var/area/home = get_area(loc)
var/datum/bounty_mafia_room/room = home ? GLOB.bounty_mafia_rooms[REF(home)] : null
var/has_tommy = FALSE
var/has_brute = FALSE
if(room)
- for(var/mob/living/basic/trooper/russian/mafia/lieutenant/other in room.goons())
+ for(var/mob/living/carbon/human/npc/bounty_mafia/lieutenant/other in room.goons())
if(other.mafia_lieutenant_role == BOUNTY_LIEUTENANT_TOMMY)
has_tommy = TRUE
else if(other.mafia_lieutenant_role == BOUNTY_LIEUTENANT_BRUTE)
@@ -1057,94 +960,187 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
return pick(BOUNTY_LIEUTENANT_TOMMY, BOUNTY_LIEUTENANT_BRUTE)
return BOUNTY_LIEUTENANT_TOMMY
-/// Its role's body, gun and look. Before the parent Initialize, which dresses it and makes its AI.
-/mob/living/basic/trooper/russian/mafia/lieutenant/proc/mafia_apply_lieutenant_role()
- damage_coeff = list(BRUTE = BOUNTY_LIEUTENANT_DAMAGE_MOD, BURN = BOUNTY_LIEUTENANT_DAMAGE_MOD, TOX = 1, STAMINA = 1, OXY = 1)
+/// Its role's look, clothes, gun and voice. Before the parent Initialize, which dresses it and makes its AI.
+/mob/living/carbon/human/npc/bounty_mafia/lieutenant/proc/mafia_apply_lieutenant_role()
if(mafia_lieutenant_role == BOUNTY_LIEUTENANT_BRUTE)
- name = "Brute"
- desc = "A mountain of a man in a tracksuit and a bear-pelt hat, knuckles taped for work. The family's muscle."
- maxHealth = BOUNTY_LIEUTENANT_BRUTE_HEALTH
- health = BOUNTY_LIEUTENANT_BRUTE_HEALTH
- speed = BOUNTY_LIEUTENANT_BRUTE_SPEED
- melee_attack_cooldown = BOUNTY_LIEUTENANT_BRUTE_COOLDOWN
- attack_vis_effect = ATTACK_EFFECT_PUNCH
- mafia_gun_type = null
- mob_spawner = /obj/effect/mob_spawn/corpse/human/bounty_mafia/brute
- corpse = /obj/effect/mob_spawn/corpse/human/bounty_mafia/brute
- r_hand = null
+ npc_name = "Brute"
+ npc_look = /obj/effect/mob_spawn/corpse/human/bounty_mafia/brute
+ npc_outfit = /datum/outfit/bounty_mafia_brute/armed
+ mafia_examine_line = "One of the don's lieutenants: the family's muscle, knuckles taped for work."
mafia_voice = "brute"
return
mafia_lieutenant_role = BOUNTY_LIEUTENANT_TOMMY
- name = "Tommy"
- desc = "A lieutenant in a long coat and a fedora, with a drum-fed Tommy gun. He runs the back office."
- maxHealth = BOUNTY_LIEUTENANT_TOMMY_HEALTH
- health = BOUNTY_LIEUTENANT_TOMMY_HEALTH
- speed = BOUNTY_LIEUTENANT_TOMMY_SPEED
- attack_vis_effect = ATTACK_EFFECT_PUNCH
- mafia_gun_type = /datum/bounty_mafia_gun/tommy
- mob_spawner = /obj/effect/mob_spawn/corpse/human/bounty_mafia/tommy
- corpse = /obj/effect/mob_spawn/corpse/human/bounty_mafia/tommy
- r_hand = BOUNTY_LIEUTENANT_TOMMY_GUN
+ npc_name = "Tommy"
+ npc_look = /obj/effect/mob_spawn/corpse/human/bounty_mafia/tommy
+ npc_outfit = /datum/outfit/bounty_mafia_tommy/armed
+ mafia_examine_line = "One of the don's lieutenants. He runs the back office."
mafia_voice = "tommy"
+ mafia_windup = BOUNTY_LIEUTENANT_TOMMY_WINDUP
+ mafia_windup_sound = 'sound/items/weapons/gun/smg/smgrack.ogg'
+ mafia_volley = BOUNTY_LIEUTENANT_TOMMY_VOLLEY
+ mafia_volley_gap = BOUNTY_LIEUTENANT_TOMMY_VOLLEY_GAP
+ mafia_cooldown = BOUNTY_LIEUTENANT_TOMMY_COOLDOWN
+ mafia_reload_sound = 'sound/items/weapons/gun/general/magazine_insert_full.ogg'
+
+/mob/living/carbon/human/npc/bounty_mafia/lieutenant/mafia_melee_behavior()
+ if(mafia_lieutenant_role == BOUNTY_LIEUTENANT_BRUTE)
+ return /datum/ai_behavior/basic_melee_attack/human_npc/bounty_mafia_brute
+ return ..()
-// Brute's blows knock people down now and then
-/mob/living/basic/trooper/russian/mafia/lieutenant/melee_attack(atom/target, list/modifiers, ignore_cooldown = FALSE)
- . = ..()
- if(!. || mafia_lieutenant_role != BOUNTY_LIEUTENANT_BRUTE || !isliving(target))
+/**
+ * Brute's punch landed on `victim` (COMSIG_HUMAN_GOT_PUNCHED, which his melee listens to on its target for the length
+ * of the blow): now and then it knocks them off their feet. A designed weapon effect, through tg's Knockdown.
+ */
+/mob/living/carbon/human/npc/bounty_mafia/lieutenant/proc/mafia_on_punch_landed(mob/living/carbon/human/victim, mob/living/attacker, damage, attack_type, obj/item/bodypart/affecting, final_armor_block, kicking, limb_sharpness)
+ SIGNAL_HANDLER
+ if(attacker != src || mafia_lieutenant_role != BOUNTY_LIEUTENANT_BRUTE || QDELETED(victim) || victim.stat == DEAD)
return
- if(!prob(BOUNTY_LIEUTENANT_BRUTE_KNOCKDOWN_CHANCE))
+ if(!prob(mafia_punch_knockdown_chance))
return
- var/mob/living/victim = target
victim.Knockdown(BOUNTY_LIEUTENANT_BRUTE_KNOCKDOWN)
victim.visible_message(span_danger("[src]'s punch knocks [victim] off [victim.p_their()] feet!"), span_userdanger("[src]'s punch knocks you off your feet!"))
-/mob/living/basic/trooper/russian/mafia/lieutenant/tommy
- name = "Tommy"
+/mob/living/carbon/human/npc/bounty_mafia/lieutenant/tommy
+ npc_name = "Tommy"
mafia_lieutenant_role = BOUNTY_LIEUTENANT_TOMMY
-/mob/living/basic/trooper/russian/mafia/lieutenant/brute
- name = "Brute"
- maxHealth = BOUNTY_LIEUTENANT_BRUTE_HEALTH
- health = BOUNTY_LIEUTENANT_BRUTE_HEALTH
+/mob/living/carbon/human/npc/bounty_mafia/lieutenant/brute
+ npc_name = "Brute"
mafia_lieutenant_role = BOUNTY_LIEUTENANT_BRUTE
+/**
+ * Listens to a club member's body for it: hits, shots, steps, damage, grabs, cuffs, shoves, and the polymorph and
+ * type changes it refuses. An element, so nothing else registering the same signals on the mob replaces these.
+ */
+/datum/element/bounty_mafia_body
+ element_flags = ELEMENT_DETACH_ON_HOST_DESTROY
+
+/datum/element/bounty_mafia_body/Attach(datum/target)
+ . = ..()
+ if(!istype(target, /mob/living/carbon/human/npc/bounty_mafia))
+ return ELEMENT_INCOMPATIBLE
+ RegisterSignal(target, COMSIG_ATOM_WAS_ATTACKED, PROC_REF(on_attacked))
+ RegisterSignal(target, COMSIG_ATOM_BULLET_ACT, PROC_REF(on_bullet_act))
+ RegisterSignal(target, COMSIG_MOVABLE_PRE_MOVE, PROC_REF(on_pre_move))
+ RegisterSignal(target, COMSIG_MOB_AFTER_APPLY_DAMAGE, PROC_REF(on_damaged))
+ RegisterSignal(target, COMSIG_LIVING_GET_PULLED, PROC_REF(on_grabbed))
+ RegisterSignal(target, COMSIG_CARBON_CUFF_ATTEMPTED, PROC_REF(on_cuff_attempt))
+ RegisterSignal(target, COMSIG_LIVING_DISARM_HIT, PROC_REF(on_shoved))
+ // A polymorph or a type change deletes it without a death: a free kill, and for a lieutenant a free gate
+ RegisterSignal(target, COMSIG_LIVING_PRE_WABBAJACKED, PROC_REF(refuse_polymorph))
+ RegisterSignal(target, COMSIG_PRE_MOB_CHANGED_TYPE, PROC_REF(refuse_type_change))
+
+/datum/element/bounty_mafia_body/Detach(datum/source)
+ UnregisterSignal(source, list(
+ COMSIG_ATOM_WAS_ATTACKED,
+ COMSIG_ATOM_BULLET_ACT,
+ COMSIG_MOVABLE_PRE_MOVE,
+ COMSIG_MOB_AFTER_APPLY_DAMAGE,
+ COMSIG_LIVING_GET_PULLED,
+ COMSIG_CARBON_CUFF_ATTEMPTED,
+ COMSIG_LIVING_DISARM_HIT,
+ COMSIG_LIVING_PRE_WABBAJACKED,
+ COMSIG_PRE_MOB_CHANGED_TYPE,
+ ))
+ return ..()
+
+/datum/element/bounty_mafia_body/proc/on_attacked(mob/living/carbon/human/npc/bounty_mafia/source, atom/attacker, attack_flags)
+ SIGNAL_HANDLER
+ if(attack_flags & (ATTACKER_DAMAGING_ATTACK | ATTACKER_STAMINA_ATTACK))
+ source.mafia_answer_attack(attacker)
+
+// Every shot that hits it, the ones relay_attackers skips too: an exosuit's guns fire as the suit
+/datum/element/bounty_mafia_body/proc/on_bullet_act(mob/living/carbon/human/npc/bounty_mafia/source, obj/projectile/shot, def_zone, piercing_hit, blocked)
+ SIGNAL_HANDLER
+ source.mafia_answer_attack(shot?.firer)
+
+/datum/element/bounty_mafia_body/proc/on_pre_move(mob/living/carbon/human/npc/bounty_mafia/source, atom/new_loc)
+ SIGNAL_HANDLER
+ if(!source.mafia_leash_allows(get_turf(new_loc)))
+ return COMPONENT_MOVABLE_BLOCK_PRE_MOVE
+ return NONE
+
+/datum/element/bounty_mafia_body/proc/on_damaged(mob/living/carbon/human/npc/bounty_mafia/source, damage, damagetype)
+ SIGNAL_HANDLER
+ source.mafia_on_damaged(damage, damagetype)
+
+/datum/element/bounty_mafia_body/proc/on_grabbed(mob/living/carbon/human/npc/bounty_mafia/source, mob/living/puller)
+ SIGNAL_HANDLER
+ source.mafia_answer_grab(puller)
+
+/datum/element/bounty_mafia_body/proc/on_cuff_attempt(mob/living/carbon/human/npc/bounty_mafia/source, mob/living/user)
+ SIGNAL_HANDLER
+ source.mafia_on_cuff_attempt(user)
+ return NONE
+
+/datum/element/bounty_mafia_body/proc/on_shoved(mob/living/carbon/human/npc/bounty_mafia/source, mob/living/attacker, zone, obj/item/weapon)
+ SIGNAL_HANDLER
+ source.mafia_shoved_at = world.time
+
+/datum/element/bounty_mafia_body/proc/refuse_polymorph(datum/source, what_to_randomize)
+ SIGNAL_HANDLER
+ return STOP_WABBAJACK
+
+/datum/element/bounty_mafia_body/proc/refuse_type_change(datum/source)
+ SIGNAL_HANDLER
+ return COMPONENT_BLOCK_MOB_CHANGE
+
// ===== THE ROOM SPAWNER =====
/**
* The club's goons. On P11's map every room has one of these; its room (the marker's area) fixes the crew
- * (bounty_mafia_room_crew()). Each marker rolls 1-2 from its room's weighted roster. Goons
- * only spawn on tiles of the marker's own room.
+ * (bounty_mafia_room_crew()). Each marker rolls 1-2 from its room's weighted roster, anywhere else 1-2 from its zone
+ * table. Goons only spawn on tiles of the marker's own room. They are people, so they are queued
+ * (spawn_human_npc()): a club of two dozen is built a body at a time, never in one tick.
*/
/obj/effect/zone_mobs/mafia
name = "zone mob spawner (mafia)"
scatter_radius = 3
mobs_green = list(
- /mob/living/basic/trooper/russian/mafia = 4,
- /mob/living/basic/trooper/russian/mafia/pistol = 3,
- /mob/living/basic/trooper/russian/mafia/smg = 1,
+ /mob/living/carbon/human/npc/bounty_mafia = 4,
+ /mob/living/carbon/human/npc/bounty_mafia/pistol = 3,
+ /mob/living/carbon/human/npc/bounty_mafia/smg = 1,
)
mobs_yellow = list(
- /mob/living/basic/trooper/russian/mafia = 3,
- /mob/living/basic/trooper/russian/mafia/pistol = 4,
- /mob/living/basic/trooper/russian/mafia/smg = 2,
+ /mob/living/carbon/human/npc/bounty_mafia = 3,
+ /mob/living/carbon/human/npc/bounty_mafia/pistol = 4,
+ /mob/living/carbon/human/npc/bounty_mafia/smg = 2,
)
mobs_red = list(
- /mob/living/basic/trooper/russian/mafia = 2,
- /mob/living/basic/trooper/russian/mafia/pistol = 4,
- /mob/living/basic/trooper/russian/mafia/smg = 3,
+ /mob/living/carbon/human/npc/bounty_mafia = 2,
+ /mob/living/carbon/human/npc/bounty_mafia/pistol = 4,
+ /mob/living/carbon/human/npc/bounty_mafia/smg = 3,
)
+/// Queues its goons. Returns their orders (/datum/human_npc_order).
/obj/effect/zone_mobs/mafia/do_spawn(zone_type)
+ . = list()
var/area/room = get_area(src)
var/list/crew = room ? bounty_mafia_room_crew(room.type) : null
- if(!crew)
- return ..()
+ var/amount
+ if(crew)
+ amount = rand(1, 2)
+ else
+ var/list/count_range = count_green
+ crew = mobs_green
+ switch(zone_type)
+ if(ZONE_YELLOW)
+ crew = mobs_yellow || crew
+ count_range = count_yellow
+ if(ZONE_RED)
+ crew = mobs_red || mobs_yellow || crew
+ count_range = count_red
+ amount = rand(count_range[1], count_range[2])
+ if(!length(crew) || amount < 1)
+ return
var/list/open_turfs = get_scatter_turfs()
- for(var/i in 1 to rand(1, 2))
+ for(var/i in 1 to amount)
var/mob_path = pick_weight(crew)
+ if(!ispath(mob_path, /mob/living/carbon/human/npc))
+ continue
var/turf/spot = length(open_turfs) ? pick_n_take(open_turfs) : get_turf(src)
var/datum/npc_spawn_context/context = new(src, zone_type, "ordinary")
- spawn_npc_in_zone(mob_path, spot, context)
+ . += spawn_human_npc(mob_path, spot, context = context)
/obj/effect/zone_mobs/mafia/get_scatter_turfs()
var/area/room = get_area(src)
@@ -1153,9 +1149,10 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
if(get_area(spot) == room)
. += spot
-// ===== LOOKS AND CORPSES =====
-// The goons wear what the corpse leaves behind: club clothes, and never a gun (the gun in the living mob's
-// hand is only a picture).
+// ===== CLOTHES AND LOOKS =====
+// The club's clothes, as their corpses used to wear them; the /armed outfits are what the living wear: the same
+// clothes, their real gun or knife in hand and spare magazines in their pockets, and the lieutenants' real armour.
+// All of it is locked to them (D3): none of it is loot.
/// A Ratnik tracksuit and an ushanka: the doormen and knife men
/datum/outfit/bounty_mafia_goon
@@ -1165,12 +1162,22 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
gloves = /obj/item/clothing/gloves/color/black
shoes = /obj/item/clothing/shoes/sneakers/black
+/datum/outfit/bounty_mafia_goon/armed
+ name = "Club Volga mobster (armed)"
+ r_hand = BOUNTY_MOBSTER_KNIFE
+
/// The gunmen hide their faces under the ushanka and keep a leather jacket over the tracksuit
/datum/outfit/bounty_mafia_goon/pistol
name = "Club Volga gunman"
suit = /obj/item/clothing/suit/jacket/leather
mask = /obj/item/clothing/mask/russian_balaclava
+/datum/outfit/bounty_mafia_goon/pistol/armed
+ name = "Club Volga gunman (armed)"
+ r_hand = BOUNTY_MOBSTER_PISTOL_GUN
+ l_pocket = BOUNTY_MOBSTER_PISTOL_MAGAZINE
+ r_pocket = BOUNTY_MOBSTER_PISTOL_MAGAZINE
+
/// The enforcers: a military tracksuit, a black balaclava, heavy boots
/datum/outfit/bounty_mafia_goon/smg
name = "Club Volga enforcer"
@@ -1180,6 +1187,12 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
suit = /obj/item/clothing/suit/jacket/leather
shoes = /obj/item/clothing/shoes/russian
+/datum/outfit/bounty_mafia_goon/smg/armed
+ name = "Club Volga enforcer (armed)"
+ r_hand = BOUNTY_MOBSTER_SMG_GUN
+ l_pocket = BOUNTY_MOBSTER_SMG_MAGAZINE
+ r_pocket = BOUNTY_MOBSTER_SMG_MAGAZINE
+
/// Tommy dresses like the old films: a black suit, a long coat, a fedora
/datum/outfit/bounty_mafia_tommy
name = "Club Volga lieutenant (Tommy)"
@@ -1189,6 +1202,14 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
gloves = /obj/item/clothing/gloves/color/black
shoes = /obj/item/clothing/shoes/laceup
+/// His long coat is a lined noir trenchcoat (real armour), the Thompson in his hands and two drums in his pockets
+/datum/outfit/bounty_mafia_tommy/armed
+ name = "Club Volga lieutenant (Tommy, armed)"
+ suit = /obj/item/clothing/suit/toggle/jacket/det_trench/noir
+ r_hand = BOUNTY_LIEUTENANT_TOMMY_GUN
+ l_pocket = BOUNTY_LIEUTENANT_TOMMY_MAGAZINE
+ r_pocket = BOUNTY_LIEUTENANT_TOMMY_MAGAZINE
+
/// Brute: a tracksuit, a bear-pelt hat and taped knuckles
/datum/outfit/bounty_mafia_brute
name = "Club Volga lieutenant (Brute)"
@@ -1197,6 +1218,11 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
gloves = /obj/item/clothing/gloves/color/black
shoes = /obj/item/clothing/shoes/russian
+/// And a bulletproof vest over the tracksuit (real armour)
+/datum/outfit/bounty_mafia_brute/armed
+ name = "Club Volga lieutenant (Brute, armed)"
+ suit = /obj/item/clothing/suit/armor/vest/russian
+
/// The don: a black suit, a fur coat, a gold chain and dark glasses
/datum/outfit/bounty_mafia_don
name = "Club Volga don"
@@ -1207,6 +1233,13 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
gloves = /obj/item/clothing/gloves/color/black
shoes = /obj/item/clothing/shoes/laceup
+/datum/outfit/bounty_mafia_don/armed
+ name = "Club Volga don (armed)"
+ r_hand = BOUNTY_DON_GUN
+ l_pocket = BOUNTY_DON_MAGAZINE
+ r_pocket = BOUNTY_DON_MAGAZINE
+
+// The club's looks: hair and faces for the people (npc_look), and the plain clothes outfits above
/obj/effect/mob_spawn/corpse/human/bounty_mafia
name = "Club Volga mobster"
outfit = /datum/outfit/bounty_mafia_goon
@@ -1295,7 +1328,7 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
/// What its volley fires: never tg's rocket (explosion()), always this
var/mech_rocket_type = /obj/projectile/bullet/bounty_mafia_rocket
/// What its machine gun fires
- var/mech_lmg_type = /obj/projectile/bullet/bounty_mafia/lmg
+ var/mech_lmg_type = /obj/projectile/bullet/bounty_mafia_lmg
/// What keeps it still with its AI quiet ("rockets", "lmg_windup", "lmg_fire", "stall"), or null
var/mech_busy
/// Goes up each time it becomes busy, so a stale timer does nothing
@@ -1399,7 +1432,7 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
return COMPONENT_MOVABLE_BLOCK_PRE_MOVE
return NONE
-/// Dragged or thrown out of its arena somehow: it's put back where it started
+/// Dragged or thrown out of its arena somehow: the machine is put back where it started (OC-5)
/mob/living/basic/bounty_lair_boss/mafia_mech/proc/mech_check_home()
var/area/arena = mech_home_ref?.resolve()
if(!arena || !mech_home_turf || get_area(src) == arena)
@@ -1575,7 +1608,7 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
/**
* After BOUNTY_MECH_RESET_AFTER with nobody in its arena, in sight or shooting at it, a fight it was in resets:
* full health, the one-hunter table and an empty posse, so a second crew never finishes a wounded mech (lairs.md
- * 9.5). Its Life() calls this. TRUE if it reset.
+ * 9.5). A machine with repair arms (OC-5, CB-18). Its Life() calls this. TRUE if it reset.
*/
/mob/living/basic/bounty_lair_boss/mafia_mech/proc/mech_check_reset()
if(stat == DEAD)
@@ -1695,9 +1728,10 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
return FALSE
/**
- * The rocket volley's lock-on: a red marker under each of `targets` (by default each hunter it can see), a
- * rising tone, and BOUNTY_MECH_ROCKET_LOCK later one rocket per marker (mech_fire_rockets()). Nothing is hurt
- * before then. Returns the serial the launch checks, or 0 if it didn't start.
+ * The rocket volley's lock-on: a red marker under each of `targets` (by default each hunter it can see; it never
+ * picks one who is down), a rising tone, and BOUNTY_MECH_ROCKET_LOCK later one rocket per marker
+ * (mech_fire_rockets()). Nothing is hurt before then, and the burst then catches whoever stands on the marker.
+ * Returns the serial the launch checks, or 0 if it didn't start.
*/
/mob/living/basic/bounty_lair_boss/mafia_mech/proc/mech_start_rockets(list/targets)
if(!mech_can_start_ability())
@@ -1754,7 +1788,7 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
rocket.rocket_area_ref = mech_home_ref
rocket.firer = src
rocket.fired_from = src
- rocket.ignored_factions = faction.Copy()
+ rocket.npc_shot_hits_allies = TRUE
rocket.range = get_dist(start, spot) + 3
rocket.maximum_range = rocket.range
rocket.aim_projectile(spot, src)
@@ -1805,7 +1839,39 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
/mob/living/basic/bounty_lair_boss/mafia_mech/proc/mech_lmg_round(serial)
if(!mech_still("lmg_fire", serial) || !mech_lmg_aim)
return null
- return bounty_mafia_shoot(src, mech_lmg_type, mech_lmg_aim, bounty_real_weapon(BOUNTY_MECH_LMG_GUN), BOUNTY_MECH_LMG_ARC, mech_lmg_range + 1)
+ return mech_shoot_round(mech_lmg_aim, bounty_real_weapon(BOUNTY_MECH_LMG_GUN), BOUNTY_MECH_LMG_ARC, mech_lmg_range + 1)
+
+/**
+ * The machine fires one round of `weapon` (a /datum/bounty_real_weapon, its exosuit gun) at `target` (a turf):
+ * every pellet with the real round's numbers and spread, `spread` degrees more (full width), no farther than
+ * `max_range` tiles. A real round from a machine: it hits whoever is in its way, the club's own people included.
+ * Returns the first projectile still flying, or null.
+ */
+/mob/living/basic/bounty_lair_boss/mafia_mech/proc/mech_shoot_round(atom/target, datum/bounty_real_weapon/weapon, spread = 0, max_range)
+ var/turf/start = get_turf(src)
+ var/turf/aim = get_turf(target)
+ if(!start || !aim || start == aim || !weapon)
+ return null
+ var/obj/projectile/first
+ for(var/pellet in 1 to weapon.pellets)
+ var/obj/projectile/bullet = new mech_lmg_type(start)
+ weapon.load(bullet)
+ if(max_range)
+ bullet.range = max_range
+ bullet.maximum_range = max_range
+ bullet.firer = src
+ bullet.fired_from = src
+ bullet.npc_shot_hits_allies = TRUE
+ bullet.spread = spread
+ bullet.aim_projectile(target, src, null, weapon.shot_spread())
+ if(QDELETED(bullet))
+ continue
+ bullet.fire()
+ if(!first && !QDELETED(bullet))
+ first = bullet
+ if(weapon.fire_sound)
+ playsound(src, weapon.fire_sound, 60, TRUE)
+ return first
/**
* A stomp on someone right next to it, which throws them (their exosuit and all) BOUNTY_MECH_STOMP_THROW tiles
@@ -1862,7 +1928,8 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
/**
* The mech breaks: a burnt-out wreck where it stood (decoration and cover, nothing to salvage) and the don
- * climbing out beside it, on the side away from the hunters, with the mech's posting. Returns the don.
+ * climbing out beside it, on the side away from the hunters, with the mech's posting. He is one body the fight
+ * needs at once, so he is built now (spawn_human_npc(immediate = TRUE)). Returns the don.
*/
/mob/living/basic/bounty_lair_boss/mafia_mech/proc/mech_eject()
if(mech_ejected)
@@ -1877,22 +1944,21 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
var/obj/structure/bounty_mafia_wreck/wreck = new(spot)
wreck.setDir(dir)
var/turf/exit = mech_exit_turf(spot)
+ var/datum/criminal_bounty/posting = posting_ref?.resolve()
var/datum/npc_spawn_context/context = new(src, null, "boss")
- var/mob/living/basic/bounty_lair_boss/mafia_don/don = spawn_npc_in_zone(/mob/living/basic/bounty_lair_boss/mafia_don, exit || spot, context, FALSE)
+ var/datum/human_npc_order/order = spawn_human_npc(/mob/living/carbon/human/npc/bounty_mafia/don, exit || spot, name = posting?.record?.name, context = context, immediate = TRUE)
+ var/mob/living/carbon/human/npc/bounty_mafia/don/don = order?.spawned_ref?.resolve()
+ if(QDELETED(don))
+ return null
don.posting_ref = posting_ref
don.don_wreck_ref = WEAKREF(wreck)
// Whoever broke his machine, he knows
don.don_grudge = mech_grudge.Copy()
if(mech_home_ref)
- don.don_home_ref = mech_home_ref
- don.don_home_turf = mech_home_turf
- var/datum/criminal_bounty/posting = posting_ref?.resolve()
- if(posting?.record?.name)
- don.name = posting.record.name
- don.real_name = posting.record.name
+ don.mafia_home_ref = mech_home_ref
+ don.mafia_home_turf = mech_home_turf
SEND_SIGNAL(src, COMSIG_BOUNTY_MAFIA_DON_EJECTED, don)
don.don_on_eject()
- context.finalize()
return don
/// The open tile beside `wreck_spot`, in its arena, farthest from the hunters
@@ -1933,155 +1999,78 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
// ===== THE DON =====
/**
- * The don on foot (phase two), out of his wreck. A pistol, the wreck for cover while he reloads, and no
- * surrender: cuffs are refused and he fights until he dies. His death drops the gold signet ring with his
- * posting on it and leaves a corpse in his clothes.
+ * The don on foot (phase two), out of his wreck: a person, the boss of the club. His gold Desert Eagle and two
+ * spare magazines, the wreck for cover while he reloads, and no surrender: he fights until he dies, and resists
+ * cuffs the tg way. Dragged out of his garage he can be taken anywhere; on his feet with nobody to fight he walks
+ * back. His death drops the gold signet ring with his posting on it, once, and leaves his body in his clothes.
*/
-/mob/living/basic/bounty_lair_boss/mafia_don
- name = BOUNTY_DON_NAME
- desc = "The don himself, head of the family that runs this club: a fur coat, a gold chain, and a gold pistol in his hand. He looks furious."
- icon = 'icons/mob/simple/simple_human.dmi'
- gender = MALE
- // Nobody drags the don out of his garage
- move_resist = MOVE_FORCE_STRONG
- mob_biotypes = MOB_ORGANIC|MOB_HUMANOID
- maxHealth = BOUNTY_DON_HEALTH
- health = BOUNTY_DON_HEALTH
- speed = BOUNTY_DON_SPEED
- melee_attack_cooldown = 1.2 SECONDS
- attack_vis_effect = ATTACK_EFFECT_PUNCH
- combat_mode = TRUE
- faction = list(FACTION_RUSSIAN, BOUNTY_MAFIA_FACTION)
- sentience_type = SENTIENCE_BOSS
- basic_mob_flags = DEL_ON_DEATH
- initial_language_holder = /datum/language_holder/atom_basic
- unsuitable_atmos_damage = 7.5
- unsuitable_cold_damage = 7.5
- unsuitable_heat_damage = 7.5
- ai_controller = /datum/ai_controller/basic_controller/bounty_mafia_don
- /// His gold pistol (/datum/bounty_mafia_gun/don)
- var/datum/bounty_mafia_gun/don/don_gun
- /// His arena, which he never leaves, and where he's put back if dragged out
- var/datum/weakref/don_home_ref
- var/turf/don_home_turf
+/mob/living/carbon/human/npc/bounty_mafia/don
+ npc_name = BOUNTY_DON_NAME
+ npc_look = /obj/effect/mob_spawn/corpse/human/bounty_mafia/don
+ npc_outfit = /datum/outfit/bounty_mafia_don/armed
+ npc_rank = HUMAN_NPC_RANK_BOSS
+ npc_damage_taken = BOUNTY_DON_DAMAGE_TAKEN
+ ai_controller = /datum/ai_controller/basic_controller/bounty_mafia/don
+ mafia_examine_line = "The don himself, head of the family that runs this club. He looks furious."
+ mafia_voice = "don"
+ mafia_idle_chatter = FALSE
+ mafia_hurt_bark_chance = 15
+ mafia_windup = BOUNTY_DON_RAISE
+ mafia_windup_once = TRUE
+ mafia_windup_sound = 'sound/items/weapons/gun/pistol/rack_small.ogg'
+ mafia_volley = BOUNTY_DON_VOLLEY
+ mafia_volley_gap = BOUNTY_DON_VOLLEY_GAP
+ mafia_cooldown = BOUNTY_DON_STRING_PAUSE
+ mafia_single_fire = TRUE
+ mafia_reload_chance = 50
/// The wreck he hides behind (/obj/structure/bounty_mafia_wreck)
var/datum/weakref/don_wreck_ref
- /// What keeps him still with his AI quiet ("stagger"), or null
- var/don_busy
- var/don_busy_serial = 0
- var/don_busy_timer
- /// The ring has dropped
- var/don_trophy_dropped = FALSE
- /// world.time he may say another line
- var/don_next_bark_at = 0
/// Weakrefs to the hunters who have hurt him or his mech: fair game at any range, seen or not
var/list/don_grudge = list()
+ /// world.time he has his bearings after climbing out of the wreck
+ var/don_dazed_until = 0
+ /// The ring has dropped
+ var/don_trophy_dropped = FALSE
-/mob/living/basic/bounty_lair_boss/mafia_don/Initialize(mapload)
- . = ..()
- don_gun = new(src)
- // Up close he pistol-whips with it, as hard as the real thing
- bounty_real_weapon(BOUNTY_DON_GUN).apply_melee(src)
- apply_dynamic_human_appearance(src, mob_spawn_path = /obj/effect/mob_spawn/corpse/human/bounty_mafia/don, r_hand = BOUNTY_DON_GUN)
- AddElement(/datum/element/death_drops, string_list(list(/obj/effect/mob_spawn/corpse/human/bounty_mafia/don)))
- AddElement(/datum/element/footstep, footstep_type = FOOTSTEP_MOB_SHOE)
- AddElement(/datum/element/relay_attackers)
- RegisterSignal(src, COMSIG_ATOM_WAS_ATTACKED, PROC_REF(don_on_attacked))
- RegisterSignal(src, COMSIG_ATOM_BULLET_ACT, PROC_REF(don_on_bullet_act))
- RegisterSignal(src, COMSIG_MOVABLE_PRE_MOVE, PROC_REF(don_on_pre_move))
- RegisterSignal(src, COMSIG_MOB_AFTER_APPLY_DAMAGE, PROC_REF(don_on_damaged))
- RegisterSignal(src, COMSIG_LIVING_PRE_WABBAJACKED, PROC_REF(don_refuse_polymorph))
- RegisterSignal(src, COMSIG_PRE_MOB_CHANGED_TYPE, PROC_REF(don_refuse_type_change))
- ban_from_containment()
- don_home_turf = get_turf(src)
- var/area/home = get_area(src)
- if(home)
- don_home_ref = WEAKREF(home)
-
-/mob/living/basic/bounty_lair_boss/mafia_don/Destroy()
- QDEL_NULL(don_gun)
- deltimer(don_busy_timer)
- don_busy_timer = null
- don_home_ref = null
- don_home_turf = null
+/mob/living/carbon/human/npc/bounty_mafia/don/Destroy()
don_wreck_ref = null
don_grudge = null
return ..()
-/mob/living/basic/bounty_lair_boss/mafia_don/Life(seconds_per_tick = SSMOBS_DT, times_fired)
- . = ..()
- if(stat == DEAD)
- return
- var/area/arena = don_home_ref?.resolve()
- if(arena && don_home_turf && get_area(src) != arena)
- forceMove(don_home_turf)
-
-/mob/living/basic/bounty_lair_boss/mafia_don/death(gibbed)
- if(stat != DEAD)
- don_clear_busy()
- don_drop_trophy()
- return ..()
+// His garage is his arena: no room, no shout, no doorway cap
+/mob/living/carbon/human/npc/bounty_mafia/don/mafia_settle_home()
+ mafia_home_turf = get_turf(src)
+ var/area/home = get_area(src)
+ if(home)
+ mafia_home_ref = WEAKREF(home)
-// He won't be taken alive (kill-only, spec 14.1)
-/mob/living/basic/bounty_lair_boss/mafia_don/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
- if(istype(tool, /obj/item/restraints))
- if(stat != DEAD)
- balloon_alert(user, "he won't be taken alive!")
- return ITEM_INTERACT_BLOCKING
- return ..()
+/mob/living/carbon/human/npc/bounty_mafia/don/mafia_is_ready()
+ return TRUE
-/mob/living/basic/bounty_lair_boss/mafia_don/proc/don_refuse_polymorph(datum/source, what_to_randomize)
- SIGNAL_HANDLER
- return STOP_WABBAJACK
+/mob/living/carbon/human/npc/bounty_mafia/don/mafia_raise_alarm(mob/living/hunter)
+ return FALSE
-/mob/living/basic/bounty_lair_boss/mafia_don/proc/don_refuse_type_change(datum/source)
- SIGNAL_HANDLER
- return COMPONENT_BLOCK_MOB_CHANGE
+/mob/living/carbon/human/npc/bounty_mafia/don/mafia_sight()
+ return BOUNTY_MECH_SIGHT
-/// Says a line for "don_" unless he spoke recently or `force`
-/mob/living/basic/bounty_lair_boss/mafia_don/proc/don_bark(context, force = FALSE)
- if(stat != CONSCIOUS || (!force && world.time < don_next_bark_at))
- return FALSE
- if(!bounty_mafia_say(src, "don_[context]"))
- return FALSE
- don_next_bark_at = world.time + BOUNTY_MAFIA_BARK_COOLDOWN
- return TRUE
+/mob/living/carbon/human/npc/bounty_mafia/don/death(gibbed)
+ var/was_alive = stat != DEAD
+ . = ..()
+ if(was_alive && stat == DEAD)
+ don_drop_trophy()
-/// Climbing out of the wreck: dazed for BOUNTY_DON_EJECT_STAGGER, and a word about his machine
-/mob/living/basic/bounty_lair_boss/mafia_don/proc/don_on_eject()
- don_set_busy("stagger", BOUNTY_DON_EJECT_STAGGER)
+/// Climbing out of the wreck: he takes BOUNTY_DON_EJECT_STAGGER to get his bearings, and has a word about his machine
+/mob/living/carbon/human/npc/bounty_mafia/don/proc/don_on_eject()
+ don_dazed_until = world.time + BOUNTY_DON_EJECT_STAGGER
Shake(2, 1, BOUNTY_DON_EJECT_STAGGER)
visible_message(span_danger("The canopy blows off the wreck and [src] climbs out, coughing!"))
- don_bark("eject", force = TRUE)
-
-/mob/living/basic/bounty_lair_boss/mafia_don/proc/don_set_busy(state, duration)
- don_busy = state
- don_busy_serial++
- deltimer(don_busy_timer)
- don_busy_timer = null
- ADD_TRAIT(src, TRAIT_IMMOBILIZED, BOUNTY_MAFIA_BUSY_TRAIT)
- ai_controller?.CancelActions()
- if(duration)
- don_busy_timer = addtimer(CALLBACK(src, PROC_REF(don_clear_busy), don_busy_serial), duration, TIMER_STOPPABLE | TIMER_DELETE_ME)
- return don_busy_serial
-
-/mob/living/basic/bounty_lair_boss/mafia_don/proc/don_clear_busy(serial)
- if(serial && serial != don_busy_serial)
- return FALSE
- don_busy = null
- deltimer(don_busy_timer)
- don_busy_timer = null
- REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, BOUNTY_MAFIA_BUSY_TRAIT)
- return TRUE
-
-/mob/living/basic/bounty_lair_boss/mafia_don/proc/don_can_act()
- return !QDELETED(src) && stat == CONSCIOUS && isturf(loc) && !HAS_TRAIT(src, TRAIT_INCAPACITATED)
+ mafia_bark("eject", force = TRUE)
/**
- * The trophy: the gold signet ring, where he fell, with his posting and its record on it. Once only.
- * Returns the ring, or null.
+ * The trophy: the gold signet ring, where he fell, with his posting and its record on it. Once only, however often
+ * he dies. A designed death drop: it is not his gear. Returns the ring, or null.
*/
-/mob/living/basic/bounty_lair_boss/mafia_don/proc/don_drop_trophy()
+/mob/living/carbon/human/npc/bounty_mafia/don/proc/don_drop_trophy()
if(don_trophy_dropped)
return null
var/turf/spot = get_turf(src)
@@ -2102,39 +2091,23 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
SEND_SIGNAL(src, COMSIG_BOUNTY_MAFIA_TROPHY_DROPPED, ring)
return ring
-/mob/living/basic/bounty_lair_boss/mafia_don/proc/don_on_pre_move(datum/source, atom/new_loc)
- SIGNAL_HANDLER
- if(!bounty_mafia_leash_allows(src, don_home_ref?.resolve(), new_loc))
- return COMPONENT_MOVABLE_BLOCK_PRE_MOVE
- return NONE
-
-/mob/living/basic/bounty_lair_boss/mafia_don/proc/don_on_attacked(datum/source, atom/attacker, attack_flags)
- SIGNAL_HANDLER
- if(!(attack_flags & (ATTACKER_DAMAGING_ATTACK | ATTACKER_STAMINA_ATTACK)))
- return
- don_answer_attack(attacker)
-
-// Every shot that hits him, the ones relay_attackers skips too (an exosuit's guns fire as the suit)
-/mob/living/basic/bounty_lair_boss/mafia_don/proc/don_on_bullet_act(datum/source, obj/projectile/shot, def_zone, piercing_hit, blocked)
- SIGNAL_HANDLER
- don_answer_attack(shot?.firer)
-
-/// `attacker` (a player, or an exosuit's pilots) went for him, from any range: a grudge, and his target if he has none
-/mob/living/basic/bounty_lair_boss/mafia_don/proc/don_answer_attack(atom/attacker)
+// He holds a grudge against whoever hurts him, from any range, and takes them on if he has nobody else
+/mob/living/carbon/human/npc/bounty_mafia/don/mafia_answer_attack(atom/attacker)
if(stat == DEAD || !attacker)
return
for(var/mob/living/hunter as anything in bounty_mafia_attackers(attacker))
don_grudge |= WEAKREF(hunter)
- if(ai_controller && !ai_controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET) && don_target_ok(hunter))
+ if(ai_controller && !ai_controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET) && mafia_target_ok(hunter))
ai_controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, hunter)
-/mob/living/basic/bounty_lair_boss/mafia_don/proc/don_on_damaged(datum/source, damage, damagetype)
- SIGNAL_HANDLER
- if(damage > 0 && stat == CONSCIOUS && prob(15))
- don_bark("hurt")
+/mob/living/carbon/human/npc/bounty_mafia/don/mafia_answer_grab(mob/living/grabber)
+ if(stat == DEAD || !bounty_mafia_is_hunter(grabber) || faction_check_atom(grabber))
+ return FALSE
+ don_grudge |= WEAKREF(grabber)
+ return ..()
/// Whether he may go after `target`: a hunter on their feet in his arena, in his sight, or who has hurt him or his mech (any range up to BOUNTY_MECH_GRUDGE_RANGE)
-/mob/living/basic/bounty_lair_boss/mafia_don/proc/don_target_ok(mob/living/target)
+/mob/living/carbon/human/npc/bounty_mafia/don/mafia_target_ok(mob/living/target)
if(!bounty_mafia_may_hurt(target) || faction_check_atom(target))
return FALSE
var/turf/spot = get_turf(target)
@@ -2145,16 +2118,16 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
return TRUE
if(distance > BOUNTY_MECH_SIGHT)
return FALSE
- var/area/arena = don_home_ref?.resolve()
+ var/area/arena = mafia_home_ref?.resolve()
return (arena && get_area(spot) == arena) || can_see(src, target, BOUNTY_MECH_SIGHT)
-/// His target: the one he has while they're fair game, else the nearest he can see, else the nearest in his arena
-/mob/living/basic/bounty_lair_boss/mafia_don/proc/don_find_target()
+/// His target: the one he has while they're fair game, else the nearest he can see, else the nearest in his arena or holding his grudge
+/mob/living/carbon/human/npc/bounty_mafia/don/mafia_find_target()
var/datum/ai_controller/controller = ai_controller
if(!controller)
return null
var/mob/living/current = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
- if(don_target_ok(current))
+ if(mafia_target_ok(current))
return current
current = null
var/turf/here = get_turf(src)
@@ -2167,7 +2140,7 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
if(grudged)
candidates |= grudged
for(var/mob/living/person in candidates)
- if(!don_target_ok(person))
+ if(!mafia_target_ok(person))
continue
var/seen = can_see(src, person, BOUNTY_MECH_SIGHT)
var/distance = get_dist(src, person)
@@ -2182,7 +2155,7 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
return current
/// The tile behind his wreck from `threat`, if it's open and in his arena
-/mob/living/basic/bounty_lair_boss/mafia_don/proc/don_cover_turf(atom/threat)
+/mob/living/carbon/human/npc/bounty_mafia/don/proc/don_cover_turf(atom/threat)
var/obj/structure/bounty_mafia_wreck/wreck = don_wreck_ref?.resolve()
if(QDELETED(wreck) || !threat)
return null
@@ -2190,7 +2163,7 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
var/away = get_dir(threat, wreck_spot)
if(!wreck_spot || !away)
return null
- var/area/arena = don_home_ref?.resolve()
+ var/area/arena = mafia_home_ref?.resolve()
for(var/direction in list(away, turn(away, 45), turn(away, -45)))
var/turf/spot = get_step(wreck_spot, direction)
if(!spot || isclosedturf(spot) || spot.is_blocked_turf(exclude_mobs = TRUE))
@@ -2200,16 +2173,11 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
return spot
return null
-/// One attack on `target`: a shot if he has a line, the pistol butt if he's next to them. TRUE if he attacked.
-/mob/living/basic/bounty_lair_boss/mafia_don/proc/don_attack(mob/living/target)
- if(!don_can_act() || don_busy || !don_target_ok(target))
- return FALSE
- face_atom(target)
- if(don_gun.ready() && can_see(src, target, BOUNTY_MECH_SIGHT) && don_gun.try_fire(target))
- return TRUE
- if(Adjacent(target) && world.time >= next_move && !don_gun.winding)
- return melee_attack(target)
- return FALSE
+/// Out of his garage on his own feet with nobody to fight: he walks back to where he climbed out. Returns that turf, or null.
+/mob/living/carbon/human/npc/bounty_mafia/don/proc/don_head_home()
+ if(mafia_at_home() || !mafia_home_turf)
+ return null
+ return mafia_home_turf
// ===== THE TROPHY =====
@@ -2245,30 +2213,166 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
. = ..()
controller.clear_blackboard_key(target_key)
+/**
+ * A club gunman's volley at its target, through its hands: the aim first if its gun has one (mafia_start_aim(),
+ * "aiming!"), then mafia_volley pulls of the trigger (controller.ai_interact(), the gun's own fire path, burst and
+ * fire rate) mafia_volley_gap apart, then mafia_cooldown before the next. A hit during the aim spoils it for a gun
+ * that fumbles. It checks its line of fire before each pull and steps aside rather than shoot through a friend.
+ */
+/datum/ai_behavior/bounty_mafia_fire
+ action_cooldown = 0.1 SECONDS
+ behavior_flags = AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
+
+/datum/ai_behavior/bounty_mafia_fire/setup(datum/ai_controller/controller, target_key)
+ . = ..()
+ var/mob/living/carbon/human/npc/bounty_mafia/shooter = controller.pawn
+ var/atom/target = controller.blackboard[target_key]
+ if(!istype(shooter) || QDELETED(target) || isnull(human_npc_loaded_gun(shooter)))
+ return FALSE
+ if(world.time < shooter.mafia_next_volley_at)
+ return FALSE
+ shooter.mafia_aim_until = 0
+ shooter.mafia_aim_spoiled = FALSE
+ shooter.mafia_volley_left = 0
+ shooter.mafia_next_pull_at = 0
+ if(shooter.mafia_windup && !(shooter.mafia_windup_once && shooter.mafia_raised))
+ shooter.mafia_start_aim(target)
+ else
+ shooter.mafia_volley_left = shooter.mafia_volley
+ return TRUE
+
+/datum/ai_behavior/bounty_mafia_fire/perform(seconds_per_tick, datum/ai_controller/controller, target_key)
+ var/mob/living/carbon/human/npc/bounty_mafia/shooter = controller.pawn
+ var/atom/target = controller.blackboard[target_key]
+ if(QDELETED(target) || !shooter.mafia_can_act() || HAS_TRAIT(shooter, TRAIT_HANDS_BLOCKED))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ shooter.face_atom(target)
+ if(shooter.mafia_aim_until)
+ if(shooter.mafia_aim_spoiled)
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ if(world.time < shooter.mafia_aim_until)
+ return AI_BEHAVIOR_DELAY
+ shooter.mafia_aim_until = 0
+ shooter.mafia_raised = TRUE
+ shooter.mafia_volley_left = shooter.mafia_volley
+ var/obj/item/gun/gun = human_npc_loaded_gun(shooter)
+ if(isnull(gun) || shooter.mafia_volley_left <= 0)
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
+ if(world.time < shooter.mafia_next_pull_at)
+ return AI_BEHAVIOR_DELAY
+ if(human_npc_ally_in_line(shooter, target))
+ human_npc_sidestep(shooter, target)
+ return AI_BEHAVIOR_DELAY
+ if(!human_npc_ready_item(shooter, gun))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ if(shooter.mafia_single_fire)
+ bounty_gun_single_fire(shooter, gun)
+ shooter.zone_selected = human_npc_pick_aim_zone()
+ controller.ai_interact(target = target, combat_mode = TRUE)
+ shooter.mafia_volley_left--
+ shooter.mafia_next_pull_at = world.time + shooter.mafia_volley_gap
+ if(shooter.mafia_volley_left <= 0)
+ return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED
+ return AI_BEHAVIOR_DELAY
+
+/datum/ai_behavior/bounty_mafia_fire/finish_action(datum/ai_controller/controller, succeeded, target_key)
+ . = ..()
+ var/mob/living/carbon/human/npc/bounty_mafia/shooter = controller.pawn
+ if(!istype(shooter))
+ return
+ var/pause = shooter.mafia_aim_spoiled ? BOUNTY_MOBSTER_FUMBLE : shooter.mafia_cooldown
+ shooter.mafia_next_volley_at = max(shooter.mafia_next_volley_at, world.time + pause)
+ shooter.mafia_aim_until = 0
+ shooter.mafia_aim_spoiled = FALSE
+ shooter.mafia_volley_left = 0
+
+/// The player's reload (human_npc_reload), with the club's sound and lines as the hand goes for the magazine
+/datum/ai_behavior/human_npc_reload/bounty_mafia
+
+/datum/ai_behavior/human_npc_reload/bounty_mafia/setup(datum/ai_controller/controller)
+ . = ..()
+ if(!.)
+ return
+ var/mob/living/carbon/human/npc/bounty_mafia/member = controller.pawn
+ if(istype(member))
+ member.mafia_on_reload()
+
+/// Brute's fists: tg's melee, listening for his punch landing on the target for the length of the blow
+/datum/ai_behavior/basic_melee_attack/human_npc/bounty_mafia_brute
+
+/datum/ai_behavior/basic_melee_attack/human_npc/bounty_mafia_brute/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key)
+ var/mob/living/carbon/human/npc/bounty_mafia/lieutenant/brute = controller.pawn
+ var/mob/living/carbon/human/victim = controller.blackboard[target_key]
+ if(!istype(brute) || !ishuman(victim) || QDELETED(victim))
+ return ..()
+ brute.RegisterSignal(victim, COMSIG_HUMAN_GOT_PUNCHED, TYPE_PROC_REF(/mob/living/carbon/human/npc/bounty_mafia/lieutenant, mafia_on_punch_landed), override = TRUE)
+ . = ..()
+ brute.UnregisterSignal(victim, COMSIG_HUMAN_GOT_PUNCHED)
+
+/**
+ * The bounty AI's breaking free (bounty_escape_captivity: cuffs, a locker, a hard grab, a carry), and any hold a
+ * hunter has on a club member, a passive grab included: grabbed, a goon breaks free. It resists the tg way (resist()).
+ */
+/datum/ai_planning_subtree/bounty_escape_captivity/bounty_mafia
+
+/datum/ai_planning_subtree/bounty_escape_captivity/bounty_mafia/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ . = ..()
+ if(. == SUBTREE_RETURN_FINISH_PLANNING)
+ return
+ var/mob/living/carbon/human/npc/bounty_mafia/member = controller.pawn
+ if(!istype(member) || member.stat != CONSCIOUS)
+ return
+ var/mob/living/holder = member.pulledby || (ismob(member.buckled) ? member.buckled : null)
+ if(!holder || !member.mafia_answer_grab(holder))
+ return
+ controller.queue_behavior(/datum/ai_behavior/resist)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
// ----- goons -----
+/**
+ * The club's people on human bodies: soft crit first (crawl, plead, a boss fires wild from the floor), then breaking
+ * free of whatever holds them, then the family's own mind.
+ */
/datum/ai_controller/basic_controller/bounty_mafia
- blackboard = list()
+ blackboard = list(
+ BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/human_npc,
+ BB_TARGET_MINIMUM_STAT = HUMAN_NPC_SPARES_DOWNED,
+ BB_AGGRO_RANGE = BOUNTY_MOBSTER_SIGHT,
+ BB_HUMAN_NPC_SHOT_DELAY = BOUNTY_MOBSTER_PISTOL_COOLDOWN,
+ BB_HUMAN_NPC_FIRE_RANGE = BOUNTY_MOBSTER_SIGHT,
+ )
ai_movement = /datum/ai_movement/basic_avoidance
idle_behavior = null
planning_subtrees = list(
+ /datum/ai_planning_subtree/human_npc_soft_crit,
+ /datum/ai_planning_subtree/bounty_escape_captivity/bounty_mafia,
/datum/ai_planning_subtree/bounty_mafia_goon,
)
+/datum/ai_controller/basic_controller/bounty_mafia/TryPossessPawn(atom/new_pawn)
+ if(!ishumannpc(new_pawn))
+ return AI_CONTROLLER_INCOMPATIBLE
+ return ..()
+
+// Cuffs and soft crit don't stop a person's AI (human_npc_soft_crit.dm)
+/datum/ai_controller/basic_controller/bounty_mafia/get_able_to_run()
+ return human_npc_ai_able_to_run(src)
+
+/datum/ai_controller/basic_controller/bounty_mafia/on_stat_changed(mob/living/source, new_stat)
+ . = ..()
+ human_npc_ai_stat_changed(src, new_stat)
+
/**
- * A goon's whole mind: back into its room if it's out; its target; nothing until its room's shout is over;
- * then shoot with a line (or stab when next to them), else close in as far as its room lets it.
+ * A goon's whole mind: its target; nothing until its room's shout is over; then reload, shoot with a line (or stab
+ * or punch when next to them), else close in as far as its room lets it; with nobody to fight, back into its room.
*/
/datum/ai_planning_subtree/bounty_mafia_goon
/datum/ai_planning_subtree/bounty_mafia_goon/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/trooper/russian/mafia/goon = controller.pawn
+ var/mob/living/carbon/human/npc/bounty_mafia/goon = controller.pawn
if(!istype(goon) || goon.stat != CONSCIOUS)
return SUBTREE_RETURN_FINISH_PLANNING
- // Grabbed by a hunter: that's a fight. He's the target, and it breaks free first.
- if(goon.mafia_answer_grab())
- controller.queue_behavior(/datum/ai_behavior/resist)
- return SUBTREE_RETURN_FINISH_PLANNING
if(!goon.mafia_can_act())
return SUBTREE_RETURN_FINISH_PLANNING
var/at_home = goon.mafia_at_home()
@@ -2278,10 +2382,8 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
goon.face_atom(target)
return SUBTREE_RETURN_FINISH_PLANNING
if(target)
- var/has_line = goon.mafia_gun ? can_see(goon, target, BOUNTY_MOBSTER_SIGHT) : goon.Adjacent(target)
- if(has_line)
+ if(goon.mafia_plan_attack(controller, target))
goon.mafia_away_since = 0
- controller.queue_behavior(/datum/ai_behavior/bounty_mafia_goon_attack, BB_BASIC_MOB_CURRENT_TARGET)
return SUBTREE_RETURN_FINISH_PLANNING
if(at_home)
if(goon.mafia_step_ok(target))
@@ -2293,22 +2395,13 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
controller.set_blackboard_key(BB_BOUNTY_MAFIA_MOVE_TO, exit)
controller.queue_behavior(/datum/ai_behavior/bounty_mafia_approach/onto, BB_BOUNTY_MAFIA_MOVE_TO)
return SUBTREE_RETURN_FINISH_PLANNING
+ // Nobody it can get at from here: out of its room, it walks back
var/turf/home = goon.mafia_head_home()
if(home)
controller.set_blackboard_key(BB_BOUNTY_MAFIA_MOVE_TO, home)
controller.queue_behavior(/datum/ai_behavior/bounty_mafia_approach/onto, BB_BOUNTY_MAFIA_MOVE_TO)
return SUBTREE_RETURN_FINISH_PLANNING
-/datum/ai_behavior/bounty_mafia_goon_attack
-
-/datum/ai_behavior/bounty_mafia_goon_attack/perform(seconds_per_tick, datum/ai_controller/controller, target_key)
- var/mob/living/basic/trooper/russian/mafia/goon = controller.pawn
- var/mob/living/target = controller.blackboard[target_key]
- if(!istype(goon) || QDELETED(target))
- return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
- goon.mafia_attack(target)
- return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
-
// ----- the mech -----
/datum/ai_controller/basic_controller/bounty_mafia_mech
@@ -2358,44 +2451,50 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms)
// ----- the don -----
-/datum/ai_controller/basic_controller/bounty_mafia_don
- blackboard = list()
- ai_movement = /datum/ai_movement/basic_avoidance
- idle_behavior = null
+/datum/ai_controller/basic_controller/bounty_mafia/don
+ blackboard = list(
+ BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/human_npc,
+ BB_TARGET_MINIMUM_STAT = HUMAN_NPC_SPARES_DOWNED,
+ BB_AGGRO_RANGE = BOUNTY_MECH_SIGHT,
+ BB_HUMAN_NPC_SHOT_DELAY = BOUNTY_DON_COOLDOWN,
+ BB_HUMAN_NPC_FIRE_RANGE = BOUNTY_MECH_SIGHT,
+ )
planning_subtrees = list(
+ /datum/ai_planning_subtree/human_npc_soft_crit,
+ /datum/ai_planning_subtree/bounty_escape_captivity/bounty_mafia,
/datum/ai_planning_subtree/bounty_mafia_don,
)
-/// The don's mind: nothing while he reels; his target; behind the wreck while he reloads; shoot with a line; else closer
+/**
+ * The don's mind: nothing while he gets his bearings; his target; behind the wreck to reload; shoot with a line, or
+ * his fists up close; else closer. With nobody to fight, back into his garage if he was taken out of it.
+ */
/datum/ai_planning_subtree/bounty_mafia_don
/datum/ai_planning_subtree/bounty_mafia_don/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/bounty_lair_boss/mafia_don/don = controller.pawn
- if(!istype(don) || don.don_busy || !don.don_can_act())
+ var/mob/living/carbon/human/npc/bounty_mafia/don/don = controller.pawn
+ if(!istype(don) || don.stat != CONSCIOUS)
+ return SUBTREE_RETURN_FINISH_PLANNING
+ if(world.time < don.don_dazed_until || !don.mafia_can_act())
return SUBTREE_RETURN_FINISH_PLANNING
- var/mob/living/target = don.don_find_target()
+ var/mob/living/target = don.mafia_find_target()
if(!target)
+ var/turf/home = don.don_head_home()
+ if(home)
+ controller.set_blackboard_key(BB_BOUNTY_MAFIA_MOVE_TO, home)
+ controller.queue_behavior(/datum/ai_behavior/bounty_mafia_approach/onto, BB_BOUNTY_MAFIA_MOVE_TO)
return SUBTREE_RETURN_FINISH_PLANNING
- if(don.don_gun.is_reloading())
+ var/obj/item/gun/gun = human_npc_held_gun(don)
+ if(gun && !gun.can_shoot() && !LAZYLEN(don.do_afters) && world.time >= controller.blackboard[BB_HUMAN_NPC_ARMING_RETRY_AT] && human_npc_can_reload(don, gun))
+ // Behind the wreck first, then the fresh magazine
var/turf/cover = don.don_cover_turf(target)
if(cover && get_turf(don) != cover)
controller.set_blackboard_key(BB_BOUNTY_MAFIA_MOVE_TO, cover)
controller.queue_behavior(/datum/ai_behavior/bounty_mafia_approach/onto, BB_BOUNTY_MAFIA_MOVE_TO)
return SUBTREE_RETURN_FINISH_PLANNING
- if(don.Adjacent(target) || can_see(don, target, BOUNTY_MECH_SIGHT))
- controller.queue_behavior(/datum/ai_behavior/bounty_mafia_don_attack, BB_BASIC_MOB_CURRENT_TARGET)
- else
- controller.queue_behavior(/datum/ai_behavior/bounty_mafia_approach, BB_BASIC_MOB_CURRENT_TARGET)
+ if(don.mafia_plan_attack(controller, target))
+ return SUBTREE_RETURN_FINISH_PLANNING
+ controller.queue_behavior(/datum/ai_behavior/bounty_mafia_approach, BB_BASIC_MOB_CURRENT_TARGET)
return SUBTREE_RETURN_FINISH_PLANNING
-/datum/ai_behavior/bounty_mafia_don_attack
-
-/datum/ai_behavior/bounty_mafia_don_attack/perform(seconds_per_tick, datum/ai_controller/controller, target_key)
- var/mob/living/basic/bounty_lair_boss/mafia_don/don = controller.pawn
- var/mob/living/target = controller.blackboard[target_key]
- if(!istype(don) || QDELETED(target))
- return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
- don.don_attack(target)
- return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
-
#undef BOUNTY_MAFIA_BUSY_TRAIT
diff --git a/voidcrew/modules/bounties/bounty_lair_types.dm b/voidcrew/modules/bounties/bounty_lair_types.dm
index 3abadc197f3..f4406c2c0b5 100644
--- a/voidcrew/modules/bounties/bounty_lair_types.dm
+++ b/voidcrew/modules/bounties/bounty_lair_types.dm
@@ -19,30 +19,32 @@
/// Where a lair's boss appears when the interior loads. Placed on the map (P11); P10 spawns boss_type there.
/obj/effect/landmark/bounty_lair_boss
- /// The boss to spawn here (a /mob/living/basic/bounty_lair_boss path), set on the map
+ /// The boss to spawn here, set on the map: a /mob/living/basic/bounty_lair_boss path, or a human NPC boss (built at once, it is one body)
var/boss_type
/// A lair's gatekeeper spot. P10 spawns gatekeeper_type here at load; when every gatekeeper in the lair is dead, P10 opens the lair's gate poddoors (mapped with id "bounty_lair_gate").
/obj/effect/landmark/bounty_lair_gatekeeper
- /// The mob to spawn here as a gatekeeper, set on the map (the mafia lieutenant for the club)
+ /// The mob to spawn here as a gatekeeper, set on the map (the mafia lieutenant for the club). A human NPC is queued (spawn_human_npc()).
var/gatekeeper_type
-/// The base of lair bosses: never under /mob/living/basic/boss (megafauna are banned from ruins and outposts). P12 sets the mafia ones.
+/// The base of lair bosses that aren't people: never under /mob/living/basic/boss (megafauna are banned from ruins and outposts). P12 sets the mafia one.
/mob/living/basic/bounty_lair_boss
/// Weakref to the posting (/datum/criminal_bounty), or null for an admin spawn
var/datum/weakref/posting_ref
-/// The don in his mech (phase one). P12.
+/// The don in his mech (phase one): a machine, so it stays a mob of its own (owner call OC-5). P12.
/mob/living/basic/bounty_lair_boss/mafia_mech
-/// The don on foot after the mech breaks (phase two). His death drops the trophy. P12.
-/mob/living/basic/bounty_lair_boss/mafia_don
-/// Mafia goons for the club. P12 sets them (lootless, club outfits); P11 places their markers.
-/mob/living/basic/trooper/russian/mafia
-/mob/living/basic/trooper/russian/mafia/pistol
-/mob/living/basic/trooper/russian/mafia/smg
+/// The club's people: real human NPCs. The base is the knife man; P12 sets them (club outfits, real guns); P11 places their markers.
+/mob/living/carbon/human/npc/bounty_mafia
+/mob/living/carbon/human/npc/bounty_mafia/pistol
+/mob/living/carbon/human/npc/bounty_mafia/smg
/// Tougher; their deaths open the arena (P10's gate rule). P12.
-/mob/living/basic/trooper/russian/mafia/lieutenant
+/mob/living/carbon/human/npc/bounty_mafia/lieutenant
+/// The don on foot after the mech breaks (phase two), a person. His death drops the trophy. P12.
+/mob/living/carbon/human/npc/bounty_mafia/don
+ /// Weakref to the posting (/datum/criminal_bounty) he is wanted on, or null for an admin spawn
+ var/datum/weakref/posting_ref
/// Room spawner for the club's goons. P12 sets its tables; P11 places it on the map (the loot test requires every zone_mobs subtype to appear in a ruin map).
/obj/effect/zone_mobs/mafia
diff --git a/voidcrew/modules/bounties/bounty_outfits.dm b/voidcrew/modules/bounties/bounty_outfits.dm
new file mode 100644
index 00000000000..3eff08fd633
--- /dev/null
+++ b/voidcrew/modules/bounties/bounty_outfits.dm
@@ -0,0 +1,137 @@
+/**
+ * # Bounty hunting: what criminals and their people wear
+ *
+ * Owner: P2 body (the table, the base clothes and the tier armour). The families dress themselves by
+ * overriding bounty_build_outfit(): P3 meek and normal criminals and companions, P4 the mini-boss kits,
+ * P6 decoys, P9 the kingpin and his goons, P12 the mafia club.
+ *
+ * Toughness comes from what they wear (defaults 1.5, CR-12): petty criminals in plain clothes, Wanted in
+ * an armour vest, Most Wanted in a vest and a helmet, mini-bosses in their kit's armour. It is real
+ * armour on real slots, locked to the body (D3), so it protects by tg's armour rules and never drops.
+ * Their weapons are carried, not held, until the fight starts, with real spare ammunition; their
+ * self-treatment items are real (N6). The human NPC base adds a sealed suit and air in vacuum, a mask in
+ * bad air and warm clothes in the cold, on top of whatever is picked here (human_npc_outfits.dm). In
+ * vacuum the suit it seals up in is its own family's, in the armour class of what it wears in good air
+ * (bounty_suits.dm).
+ */
+
+/**
+ * The outfit table of every bounty human: it asks the NPC being dressed (bounty_build_outfit()), so
+ * the choice can read its record, its tier, its style and its kit. Set as npc_outfit_table. Then the
+ * clothes for its site go on (bounty_site_clothes(), companions), and its own sealed suit if it is about
+ * to be sealed up for vacuum (bounty_seal_outfit()); the plain EVA layer is only the fallback.
+ */
+/datum/human_npc_outfit_table/bounty
+ vacuum_layer = /datum/human_npc_layer/eva
+
+/datum/human_npc_outfit_table/bounty/pick_outfit(mob/living/carbon/human/npc/npc, zone)
+ if(!ishumannpc(npc))
+ return null
+ var/outfit = npc.bounty_build_outfit(zone || ZONE_GREEN)
+ outfit = npc.bounty_site_clothes(outfit)
+ return bounty_seal_outfit(npc, outfit, src)
+
+/**
+ * What a bounty human wears in `zone` (ZONE_*): a /datum/outfit typepath, or an instance made for it
+ * (bounty_outfit_instance()). Null leaves it in whatever its look brings. Every bounty family overrides it.
+ */
+/mob/living/carbon/human/npc/proc/bounty_build_outfit(zone)
+ return null
+
+/**
+ * `outfit` (from bounty_build_outfit()) in the clothes it wears for where it is, or as it is. Companions
+ * swap their plain clothes for rough ones picked by their criminal's site (bounty_companions.dm).
+ */
+/mob/living/carbon/human/npc/proc/bounty_site_clothes(outfit)
+ return outfit
+
+/// A fresh outfit of `base_type`, to add weapons, armour and kit to before it is worn
+/proc/bounty_outfit_instance(base_type)
+ if(!ispath(base_type, /datum/outfit))
+ return null
+ return new base_type()
+
+/**
+ * Puts the armour of `tier` (BOUNTY_TIER_*) on `outfit`, an instance: Wanted an armour vest, Most Wanted
+ * a vest and a helmet, Petty none. Anything the old suit carried in its storage moves to the backpack.
+ */
+/proc/bounty_add_tier_armour(datum/outfit/outfit, tier)
+ if(!istype(outfit) || tier == BOUNTY_TIER_PETTY || isnull(tier))
+ return outfit
+ if(outfit.suit_store)
+ if(outfit.back)
+ LAZYADDASSOC(outfit.backpack_contents, outfit.suit_store, 1)
+ outfit.suit_store = null
+ outfit.suit = /obj/item/clothing/suit/armor/vest
+ if(tier == BOUNTY_TIER_MOST_WANTED)
+ outfit.head = /obj/item/clothing/head/helmet
+ return outfit
+
+/// The plain clothes a criminal of `archetype` (BOUNTY_ARCHETYPE_*) wears in `zone`
+/proc/bounty_plain_clothes(archetype, zone)
+ var/meek = archetype == BOUNTY_ARCHETYPE_MEEK
+ switch(zone)
+ if(ZONE_RED)
+ return meek ? /datum/outfit/bounty_criminal/drifter : /datum/outfit/bounty_criminal/tough
+ if(ZONE_YELLOW)
+ return meek ? /datum/outfit/bounty_criminal/spacer : /datum/outfit/bounty_criminal/hauler
+ return meek ? /datum/outfit/bounty_criminal : /datum/outfit/bounty_criminal/local
+
+// A criminal with no family of its own to dress it: plain clothes for its archetype and zone, and its tier's armour.
+/mob/living/carbon/human/npc/bounty_criminal/bounty_build_outfit(zone)
+ var/datum/outfit/outfit = bounty_outfit_instance(bounty_plain_clothes(record?.archetype, zone))
+ return bounty_add_tier_armour(outfit, record?.tier)
+
+/// ZONE_GREEN, ZONE_YELLOW or ZONE_RED for where its site is (or where it stands), green if unknown
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_zone()
+ var/atom/site = body_site_ref?.resolve()
+ var/zone = site ? SSovermap_zones?.get_zone_type(get_turf(site)) : SSovermap_zones?.get_zone_type_anywhere(get_turf(src))
+ return zone || ZONE_GREEN
+
+// ===== PLAIN CLOTHES =====
+
+/// Plain clothes for a meek criminal in green space
+/datum/outfit/bounty_criminal
+ name = "Bounty criminal: civilian"
+ uniform = /obj/item/clothing/under/pants/jeans
+ suit = /obj/item/clothing/suit/toggle/jacket/sweater
+ shoes = /obj/item/clothing/shoes/sneakers/brown
+
+/// A meek criminal in yellow space
+/datum/outfit/bounty_criminal/spacer
+ name = "Bounty criminal: spacer"
+ uniform = /obj/item/clothing/under/color/grey
+ suit = /obj/item/clothing/suit/jacket/bomber
+ shoes = /obj/item/clothing/shoes/workboots
+ head = /obj/item/clothing/head/beanie
+
+/// A meek criminal in red space
+/datum/outfit/bounty_criminal/drifter
+ name = "Bounty criminal: drifter"
+ uniform = /obj/item/clothing/under/color/black
+ suit = /obj/item/clothing/suit/jacket/leather
+ shoes = /obj/item/clothing/shoes/jackboots
+ head = /obj/item/clothing/head/soft/grey
+
+/// A normal criminal in green space
+/datum/outfit/bounty_criminal/local
+ name = "Bounty criminal: local"
+ uniform = /obj/item/clothing/under/costume/buttondown/slacks
+ suit = /obj/item/clothing/suit/jacket/letterman
+ shoes = /obj/item/clothing/shoes/sneakers/black
+
+/// A normal criminal in yellow space. Overalls, not bare jeans: a Wanted criminal's vest goes over a shirt.
+/datum/outfit/bounty_criminal/hauler
+ name = "Bounty criminal: hauler"
+ uniform = /obj/item/clothing/under/misc/overalls
+ suit = /obj/item/clothing/suit/jacket/miljacket
+ gloves = /obj/item/clothing/gloves/fingerless
+ shoes = /obj/item/clothing/shoes/workboots
+
+/// A normal criminal in red space, and the fallback for a mini-boss
+/datum/outfit/bounty_criminal/tough
+ name = "Bounty criminal: tough"
+ uniform = /obj/item/clothing/under/color/black
+ suit = /obj/item/clothing/suit/jacket/leather/biker
+ gloves = /obj/item/clothing/gloves/fingerless
+ shoes = /obj/item/clothing/shoes/jackboots
diff --git a/voidcrew/modules/bounties/bounty_outpost.dm b/voidcrew/modules/bounties/bounty_outpost.dm
index a60b8834fbf..3dbff01d01f 100644
--- a/voidcrew/modules/bounties/bounty_outpost.dm
+++ b/voidcrew/modules/bounties/bounty_outpost.dm
@@ -7,23 +7,29 @@
* tgui/packages/tgui/interfaces/WantedBoard.tsx and the tests in
* voidcrew/modules/unit_tests/voidcrew_bounty_outpost.dm. Do not edit this file outside P6.
*
- * What it owns: identifying the fugitive (decision 16, spec section 7, abuse review section C):
+ * What it owns: identifying the fugitive (decision 16, spec section 7, abuse review section C).
+ * The fugitive and its decoys are real humans (/mob/living/carbon/human/npc, voidcrew/modules/human_npcs/):
* - Blending in. The fugitive and BOUNTY_DECOY_COUNT decoys wear the zone's patron clothes and go
* by the same generic name ("patron", "dockhand", "spacer"); the alias is never shown. While
- * they blend in nobody can pull them, turrets leave them alone and stray shots pass through them
- * (/datum/component/bounty_outpost_blend).
- * - Decoys (/mob/living/basic/bounty_criminal/decoy): look-alikes with the same body and routine
- * as the fugitive. Showing one the warrant, or hitting one on purpose, raises the posting's
- * alert; a hit is also an outpost strike for the hitter.
+ * they blend in the turrets leave them alone and a hit on one is judged by who it was meant for
+ * (/datum/component/bounty_outpost_blend). They are people like any other: they can be grabbed,
+ * shot, knocked down and cuffed the way anyone can, and what they do about it is their AI's.
+ * - Decoys (/mob/living/carbon/human/npc/bounty_criminal/decoy): look-alikes with the fugitive's
+ * face (a record that shares one or two of its features), the zone's clothes, its bag and belt
+ * (outpost_match_kit(), emptied), and its toughness and pace (body_match()). Showing one the
+ * warrant, hitting one on purpose or reaching for its wrists raises the posting's alert; a hit is
+ * also an outpost strike for the hitter.
* - Traders' clues: any trader, the barkeep included, gives a ship hunting a fugitive there one
* true clue, a different one per trader.
* - The warrant (/obj/item/paper/bounty_warrant): shown to the fugitive it exposes them (P3's
* on_confronted()); shown to anyone else they protest. A ship can show one every
* BOUNTY_WARRANT_COOLDOWN.
- * - The alert: at BOUNTY_OUTPOST_ALERT_SLIP the fugitive slips away and the bounty relists (P5's
- * relist()).
- * - The walk out: when the posting closes or the fugitive slips away, the decoys and an uncaught
- * fugitive walk to the hangar lift and fade out (/datum/component/bounty_outpost_exit).
+ * - The alert: at BOUNTY_OUTPOST_ALERT_SLIP the decoys leave and the fugitive walks out to the
+ * hangar lift; the bounty relists at another trader outpost once it has gone (P5's relist()). A
+ * fugitive caught on the way is still the posting's.
+ * - The walk out: when the posting closes, the decoys and an uncaught fugitive walk to the hangar
+ * lift through the human NPC base's npc_walk_out(). They can be shot, downed and cuffed on the way
+ * and are deleted only on the lift or out of every player's sight (bounty_outpost_walk_out()).
* - The wanted board (/obj/structure/bounty_wanted_board): a locked board on each concourse
* listing the public bounties.
*
@@ -127,24 +133,28 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
var/list/outpost_clues_told = list()
/// How many of the fugitive's features each decoy was made to share, in spawn order
var/list/outpost_decoy_shares = list()
+ /// The decoys' human NPC orders (/datum/human_npc_order), kept so the ones not built yet can be cancelled
+ var/list/outpost_decoy_orders = list()
/**
* Sets a trader-outpost bounty up to blend in, once P5 has spawned the criminal at the outpost
* (site_ref and criminal_ref set):
* - the record gets its old look, so the listing's mugshot shows how they used to look (AR-C1);
* - the fugitive wears the zone's clothes and the zone's generic name, and blends in;
- * - BOUNTY_DECOY_COUNT decoys spawn out of sight, each sharing one or two of its features;
+ * - BOUNTY_DECOY_COUNT decoys spawn out of sight, each sharing one or two of its features. They are
+ * human NPCs, so they wait their turn in the spawn queue and join `decoys` as they are built; with
+ * `immediate` they are built now (tests, and callers that need them at once);
* - the alert and the traders' clues start over.
*
* Refuses (FALSE) a mini-boss (AR-C9), an outpost that already has BOUNTY_MAX_FUGITIVES_PER_OUTPOST,
* and a posting whose site is not a loaded trader outpost. Returns TRUE when set up.
*/
-/datum/criminal_bounty/proc/setup_outpost_blend()
+/datum/criminal_bounty/proc/setup_outpost_blend(immediate = FALSE)
var/obj/structure/overmap/trader_outpost/outpost = site_ref?.resolve()
- var/mob/living/basic/bounty_criminal/fugitive = criminal()
+ var/mob/living/carbon/human/npc/bounty_criminal/fugitive = criminal()
if(!istype(outpost) || !outpost.template_bottom_left || !outpost.outpost_template || !fugitive || !record)
return FALSE
- if(istype(fugitive, /mob/living/basic/bounty_criminal/boss) || record.archetype == BOUNTY_ARCHETYPE_BOSS)
+ if(istype(fugitive, /mob/living/carbon/human/npc/bounty_criminal/boss) || record.archetype == BOUNTY_ARCHETYPE_BOSS)
log_game("BOUNTY: a mini-boss ([record.name]) was refused at [outpost]. Mini-bosses never go to trader outposts.")
return FALSE
if(!bounty_outpost_has_room(outpost, src))
@@ -189,6 +199,7 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
if(!fugitive.site_bounds)
fugitive.site_bounds = bounty_outpost_bounds(outpost)
+ // Dressed in the zone's clothes by the component, which also gives it the generic name
fugitive.AddComponent(/datum/component/bounty_outpost_blend, src, FALSE, display_name, display_desc, outfit)
// Everyone blending in has the same even chance of heading for a bar stool, the fugitive included
var/list/free_stools = bounty_outpost_free_stools(public_floor)
@@ -196,7 +207,7 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
var/feature_count = length(record.features)
for(var/turf/spot as anything in spots)
- if(length(decoys) >= BOUNTY_DECOY_COUNT)
+ if(length(outpost_decoy_orders) >= BOUNTY_DECOY_COUNT)
break
// One or two of its features each, and never all of them (make_decoy_record() holds to that too)
var/shared = rand(1, 2)
@@ -207,16 +218,19 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
// If a line ever names a crime, it names the same one for everybody
if(decoy_record)
decoy_record.crime = record.crime
- var/datum/npc_spawn_context/context = fugitive.bounty_profile_context()
- var/mob/living/basic/bounty_criminal/decoy/decoy = spawn_npc_in_zone(/mob/living/basic/bounty_criminal/decoy, spot, context, FALSE)
var/atom/anchor = (length(free_stools) && prob(50)) ? pick_n_take(free_stools) : null
- decoy.outpost_become(fugitive, decoy_record, src, outpost, display_name, display_desc, outfit, anchor)
- decoys += WEAKREF(decoy)
+ var/datum/human_npc_order/order = bounty_outpost_spawn_decoy(fugitive, decoy_record, spot, src, outpost, display_name, display_desc, outfit, anchor, CALLBACK(src, PROC_REF(outpost_decoy_built)), immediate)
+ outpost_decoy_orders += order
RegisterSignal(src, COMSIG_BOUNTY_POSTING_CLOSED, PROC_REF(outpost_on_closed), override = TRUE)
- log_game("BOUNTY: [record.name] is blending in at [outpost] as a [display_name], with [length(decoys)] decoys.")
+ log_game("BOUNTY: [record.name] is blending in at [outpost] as a [display_name], with [length(outpost_decoy_orders)] decoys on the way.")
return TRUE
+/// One of this posting's decoys has been built and made a look-alike: it is the posting's from now on
+/datum/criminal_bounty/proc/outpost_decoy_built(mob/living/carbon/human/npc/bounty_criminal/decoy/decoy)
+ if(!QDELETED(decoy))
+ decoys += WEAKREF(decoy)
+
/**
* Raises the fugitive's alert for `reason` (BOUNTY_ALERT_*): a wrong warrant, or a hit on a decoy,
* whoever did it. At BOUNTY_OUTPOST_ALERT_SLIP a fugitive still blending in slips away: it walks
@@ -233,32 +247,58 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
return TRUE
/**
- * The fugitive has noticed too much fuss: while it is still blending in and free, it and its
- * decoys leave, and the bounty relists. An exposed fugitive is already running or fighting and
- * stays. Returns TRUE if it slipped away.
+ * The fugitive has noticed too much fuss: while it is still blending in and free, the decoys leave
+ * and it walks out to the hangar lift for real (bounty_outpost_walk_out()). The bounty relists at
+ * another trader outpost once it has gone (outpost_fugitive_left()); until then it is still this
+ * posting's, so a fugitive downed or cuffed on the way is as good a catch as any. An exposed
+ * fugitive is already running or fighting and stays. Returns TRUE if it set off.
*/
/datum/criminal_bounty/proc/outpost_slip_away()
- var/mob/living/basic/bounty_criminal/fugitive = criminal()
+ var/mob/living/carbon/human/npc/bounty_criminal/fugitive = criminal()
if(!fugitive || !fugitive.blended || fugitive.capture_state() != BOUNTY_STATE_FREE)
return FALSE
+ var/datum/component/bounty_outpost_blend/blend = fugitive.GetComponent(/datum/component/bounty_outpost_blend)
+ if(blend?.leaving)
+ return FALSE
var/obj/structure/overmap/trader_outpost/outpost = outpost_site?.resolve() || site_ref?.resolve()
var/where = outpost ? format_text(outpost.name) : "the outpost"
- log_game("BOUNTY: [record?.name] slipped away from [where].")
- // Detached first (outpost_release_site()), so relist() never deletes them mid-walk. P5 shows the
- // reason as "WANTED: ."
- outpost_release_site()
- relist("slipped away from [where]")
- return TRUE
+ log_game("BOUNTY: [record?.name] is slipping away from [where].")
+ outpost_dismiss_decoys()
+ // P5 shows the reason as "WANTED: ."
+ return bounty_outpost_walk_out(fugitive, outpost, CALLBACK(src, PROC_REF(outpost_fugitive_left), "slipped away from [where]"))
-/// The decoys at the current site leave and fade out, and the posting forgets them
-/datum/criminal_bounty/proc/outpost_dismiss_decoys(list/floor)
- var/obj/structure/overmap/trader_outpost/outpost = outpost_site?.resolve()
- if(length(decoys) && outpost && isnull(floor))
- floor = bounty_outpost_public_floor(outpost)
+/**
+ * The slipping fugitive reached the lift (or went where no player could see): the bounty relists.
+ * Its body goes with it, so the posting lets go of it first and its going is not read as a loss.
+ * Nothing happens if it stopped being the posting's meanwhile (the posting closed or relisted).
+ */
+/datum/criminal_bounty/proc/outpost_fugitive_left(reason, mob/living/carbon/human/npc/bounty_criminal/leaver)
+ if(!is_open() || board_relisting || QDELETED(leaver) || criminal() != leaver)
+ return
+ board_detach_criminal()
+ leaver.posting_ref = null
+ log_game("BOUNTY: [record?.name] slipped away.")
+ relist(reason)
+
+/**
+ * The decoys not built yet are cancelled and the built ones set walking out, and the posting forgets
+ * them all. The walk itself starts asynchronously: closing a posting must not wait on anyone's AI.
+ */
+/datum/criminal_bounty/proc/outpost_dismiss_decoys()
+ var/list/leaving = outpost_forget_decoys()
+ if(length(leaving))
+ INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(bounty_outpost_walk_out_all), leaving, outpost_site?.resolve())
+
+/// Cancels the decoys still waiting to be built and lets go of the built ones. Returns the built ones, living or dead.
+/datum/criminal_bounty/proc/outpost_forget_decoys()
+ for(var/datum/human_npc_order/order as anything in outpost_decoy_orders)
+ qdel(order)
+ outpost_decoy_orders.Cut()
+ . = list()
for(var/datum/weakref/decoy_ref as anything in decoys)
- var/mob/living/basic/bounty_criminal/decoy = decoy_ref?.resolve()
+ var/mob/living/carbon/human/npc/bounty_criminal/decoy/decoy = decoy_ref?.resolve()
if(!QDELETED(decoy))
- bounty_outpost_walk_out(decoy, outpost, floor)
+ . += decoy
decoys.Cut()
/**
@@ -270,15 +310,15 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
*/
/datum/criminal_bounty/proc/outpost_release_site()
var/obj/structure/overmap/trader_outpost/outpost = outpost_site?.resolve()
- var/list/floor = outpost ? bounty_outpost_public_floor(outpost) : null
- outpost_dismiss_decoys(floor)
- var/mob/living/basic/bounty_criminal/fugitive = criminal()
- if(!fugitive || !outpost || get_trader_outpost_for_turf(get_turf(fugitive)) != outpost)
- return
- // P5's own detach, so its deletion watch comes off too and the fade isn't read as a loss
- board_detach_criminal()
- fugitive.posting_ref = null
- bounty_outpost_walk_out(fugitive, outpost, floor)
+ var/list/leaving = outpost_forget_decoys()
+ var/mob/living/carbon/human/npc/bounty_criminal/fugitive = criminal()
+ if(fugitive && outpost && get_trader_outpost_for_turf(get_turf(fugitive)) == outpost)
+ // P5's own detach, so its deletion watch comes off too and the walk isn't read as a loss
+ board_detach_criminal()
+ fugitive.posting_ref = null
+ leaving += fugitive
+ if(length(leaving))
+ INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(bounty_outpost_walk_out_all), leaving, outpost)
/// The posting closed (P5's close()): the decoys and an uncaught fugitive walk out
/datum/criminal_bounty/proc/outpost_on_closed(datum/source, reason, obj/structure/overmap/ship/winner)
@@ -444,7 +484,7 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
* `user` showed this posting's warrant to its fugitive: it stops blending in, remembers who, and
* reacts as its kind does (P3's on_confronted(): a meek one bolts, a normal one fights).
*/
-/datum/criminal_bounty/proc/outpost_confront(mob/living/basic/bounty_criminal/fugitive, mob/living/user)
+/datum/criminal_bounty/proc/outpost_confront(mob/living/carbon/human/npc/bounty_criminal/fugitive, mob/living/user)
fugitive.body_add_grudge(user)
var/datum/component/bounty_outpost_blend/blend = fugitive.GetComponent(/datum/component/bounty_outpost_blend)
blend?.stop_blending()
@@ -460,7 +500,7 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
* The room notices an exposed fugitive: the nearest trader who can see them, within
* BOUNTY_OUTPOST_REACT_RANGE, calls out. Returns the trader, or null.
*/
-/datum/criminal_bounty/proc/outpost_trader_reacts(mob/living/basic/bounty_criminal/fugitive)
+/datum/criminal_bounty/proc/outpost_trader_reacts(mob/living/carbon/human/npc/bounty_criminal/fugitive)
var/mob/living/basic/outpost_trader/nearest
var/nearest_distance = INFINITY
for(var/mob/living/basic/outpost_trader/trader in view(BOUNTY_OUTPOST_REACT_RANGE, fugitive))
@@ -478,7 +518,7 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
* `user` showed this posting's warrant to the wrong person, `target`: they protest and show their
* papers. At this posting's trader outpost, it raises the alert.
*/
-/datum/criminal_bounty/proc/outpost_wrong_accusation(mob/living/basic/bounty_criminal/target, mob/living/user)
+/datum/criminal_bounty/proc/outpost_wrong_accusation(mob/living/carbon/human/npc/bounty_criminal/target, mob/living/user)
target.outpost_protest(user)
to_chat(user, span_notice("Their papers are in order. Not who you're after."))
var/obj/structure/overmap/trader_outpost/outpost = outpost_site?.resolve()
@@ -492,7 +532,7 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
* Someone showed them a warrant that isn't theirs: they protest, and show a docking pass that
* checks out. Nothing else happens to them.
*/
-/mob/living/basic/bounty_criminal/proc/outpost_protest(mob/user)
+/mob/living/carbon/human/npc/bounty_criminal/proc/outpost_protest(mob/user)
if(stat != CONSCIOUS)
return
// Forced: a protest always comes out, whatever was said a moment ago (P1's third argument)
@@ -505,99 +545,110 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
// DECOYS
// =========================================================================
-// Built-in values, P6's. Everything that could tell a decoy from its fugitive is copied from the
-// fugitive when the decoy is made (outpost_match_body()), whatever the fugitive's kind.
-/mob/living/basic/bounty_criminal/decoy
+// Built-in values, P6's. A decoy is a person like the fugitive: the same species, build and face but
+// for the features it was made not to share, the zone's clothes, the fugitive's bag and belt
+// (outpost_match_kit()), and its toughness and pace (body_match()). It carries no weapon and never fights.
+/mob/living/carbon/human/npc/bounty_criminal/decoy
name = "patron"
desc = "Another customer passing through."
- maxHealth = BOUNTY_MEEK_HEALTH
- health = BOUNTY_MEEK_HEALTH
+ /// Its fixed toughness is its fugitive's (body_match()), never its own record's tier
+ body_tier_toughness = FALSE
+ /// Nobody's posting cleans a dead decoy up: the corpse sweep does
+ npc_corpse_lifetime = HUMAN_NPC_CORPSE_LIFETIME
/// Barks when hit are rate-limited on their own, beside bounty_say()'s cooldown
COOLDOWN_DECLARE(outpost_bark_cooldown)
- /// How long its fugitive stays down (P2's body_recovery_time()), so they get up together; null before it is made one
- var/outpost_recovery_time
- /// Its fugitive's stamina pool (P2's body_stamina_pool()); null before it is made one
- var/outpost_stamina_pool
/**
- * Makes this decoy a look-alike of `fugitive` wanted on `posting` at `outpost`: `decoy_record`'s
- * face in the zone's `outfit`, the fugitive's body and routine, the zone's generic name, doing
- * what the fugitive does (at `anchor`, a bar stool, or nothing). The decoy is NOT linked to the
- * posting through posting_ref: it is not the criminal, and nothing the pad, the proof of death or
- * the board does may treat it as one. The admin panel's decoys should come through here too.
+ * A decoy made any other way than bounty_outpost_spawn_decoy() still dresses as a customer of the zone
+ * it was made in, never as a criminal: no gun, no armour.
+ */
+/mob/living/carbon/human/npc/bounty_criminal/decoy/bounty_build_outfit(zone)
+ switch(zone)
+ if(ZONE_YELLOW)
+ return /datum/outfit/bounty_outpost_dockhand
+ if(ZONE_RED)
+ return /datum/outfit/bounty_outpost_spacer
+ return /datum/outfit/bounty_outpost_patron
+
+/**
+ * Builds a decoy for `fugitive` at `spot`: a human NPC with `decoy_record`'s face in the zone's
+ * `outfit` and generic name, in its fugitive's faction, in the spawn queue (SShuman_npcs) unless
+ * `immediate`. Once built it is made a look-alike (outpost_become()) and `on_built` is called with it.
+ * Returns the order; qdel() it to cancel a decoy not built yet. A decoy built for a posting that has
+ * closed, moved on or lost its fugitive in the meantime is deleted unseen.
+ */
+/proc/bounty_outpost_spawn_decoy(mob/living/carbon/human/npc/bounty_criminal/fugitive, datum/bounty_record/decoy_record, turf/spot, datum/criminal_bounty/posting, obj/structure/overmap/trader_outpost/outpost, display_name, display_desc, outfit, atom/anchor, datum/callback/on_built, immediate = FALSE)
+ var/datum/npc_spawn_context/context = new(outpost || spot, null, "ordinary", source_turf = get_turf(outpost || spot))
+ var/datum/callback/finish = CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(bounty_outpost_finish_decoy), WEAKREF(fugitive), decoy_record, posting ? WEAKREF(posting) : null, outpost ? WEAKREF(outpost) : null, display_name, display_desc, outfit, anchor ? WEAKREF(anchor) : null, on_built)
+ return spawn_human_npc(/mob/living/carbon/human/npc/bounty_criminal/decoy, spot, finish, look = decoy_record, outfit = outfit, name = display_name, faction = fugitive?.faction, context = context, immediate = immediate)
+
+/// A decoy has just been built (bounty_outpost_spawn_decoy()): checks it is still wanted, then makes it a look-alike
+/proc/bounty_outpost_finish_decoy(datum/weakref/fugitive_ref, datum/bounty_record/decoy_record, datum/weakref/posting_ref, datum/weakref/outpost_ref, display_name, display_desc, outfit, datum/weakref/anchor_ref, datum/callback/on_built, mob/living/carbon/human/npc/bounty_criminal/decoy/decoy)
+ if(QDELETED(decoy))
+ return
+ var/mob/living/carbon/human/npc/bounty_criminal/fugitive = fugitive_ref?.resolve()
+ var/datum/criminal_bounty/posting = posting_ref?.resolve()
+ var/obj/structure/overmap/trader_outpost/outpost = outpost_ref?.resolve()
+ if(QDELETED(fugitive) || (posting_ref && (QDELETED(posting) || !posting.is_open() || posting.outpost_site?.resolve() != outpost)))
+ qdel(decoy)
+ return
+ decoy.outpost_become(fugitive, decoy_record, posting, outpost, display_name, display_desc, outfit, anchor_ref?.resolve())
+ on_built?.Invoke(decoy)
+
+/**
+ * Makes this decoy, already built in the zone's clothes with its record's face, a look-alike of
+ * `fugitive` wanted on `posting` at `outpost`: the fugitive's toughness and pace (body_match()), the
+ * zone's generic name and description, blending in like the fugitive and doing what it does (at
+ * `anchor`, a bar stool, or nothing). The decoy is NOT linked to the posting through posting_ref: it
+ * is not the criminal, and nothing the pad, the proof of death or the board does may treat it as
+ * one. `outfit` is the zone's clothes: a decoy built another way has its own put right.
*/
-/mob/living/basic/bounty_criminal/decoy/proc/outpost_become(mob/living/basic/bounty_criminal/fugitive, datum/bounty_record/decoy_record, datum/criminal_bounty/posting, obj/structure/overmap/trader_outpost/outpost, display_name, display_desc, outfit, atom/anchor)
+/mob/living/carbon/human/npc/bounty_criminal/decoy/proc/outpost_become(mob/living/carbon/human/npc/bounty_criminal/fugitive, datum/bounty_record/decoy_record, datum/criminal_bounty/posting, obj/structure/overmap/trader_outpost/outpost, display_name, display_desc, outfit, atom/anchor)
record = decoy_record
- if(decoy_record?.gender)
- gender = decoy_record.gender
- site_bounds = bounty_outpost_bounds(outpost)
- outpost_match_body(fugitive)
- // The same routine as the fugitive's (AR-C6): the same AI controller type, so start_activity()
- // sets the same blend-in routine on both.
- var/datum/ai_controller/fugitive_controller = fugitive.ai_controller
- if(istype(fugitive_controller))
- var/datum/ai_controller/current = ai_controller
- if(!istype(current) || current.type != fugitive_controller.type)
- if(istype(current))
- QDEL_NULL(ai_controller)
- var/controller_type = fugitive_controller.type
- new controller_type(src)
+ body_set_site(outpost)
+ // The concourse itself, whatever the site gave it
+ var/list/bounds = bounty_outpost_bounds(outpost)
+ if(bounds)
+ site_bounds = bounds
+ body_match(fugitive)
+ outpost_match_kit(fugitive)
AddComponent(/datum/component/bounty_outpost_blend, posting, TRUE, display_name, display_desc, outfit)
start_activity(BOUNTY_ACTIVITY_BLEND, anchor)
/**
- * Copies everything about `fugitive`'s body that a player could compare (AR-C6): P2's body_match()
- * (health, pace, stamina and how it slows), how long it stays down, its size, how it breathes and
- * talks, and how it reacts to a touch.
+ * Wears the same bag and belt as `fugitive` (a meek criminal's fanny pack, a holster, a satchel), which
+ * show at a glance and which the patron clothes leave on the fugitive. Each is a new one of its type,
+ * emptied: a decoy carries no weapon, so a gun slung on the fugitive's back has no match here. Locked
+ * to its body like the rest of its kit (D3).
*/
-/mob/living/basic/bounty_criminal/decoy/proc/outpost_match_body(mob/living/basic/bounty_criminal/fugitive)
- outpost_recovery_time = fugitive.body_recovery_time()
- outpost_stamina_pool = fugitive.body_stamina_pool()
- body_match(fugitive)
- damage_coeff = fugitive.damage_coeff.Copy()
- max_stamina = fugitive.max_stamina
- stamina_crit_threshold = fugitive.stamina_crit_threshold
- stamina_recovery = fugitive.stamina_recovery
- status_flags = fugitive.status_flags
- mob_size = fugitive.mob_size
- faction = LAZYCOPY(fugitive.faction)
- habitable_atmos = fugitive.habitable_atmos?.Copy()
- unsuitable_atmos_damage = fugitive.unsuitable_atmos_damage
- minimum_survivable_temperature = fugitive.minimum_survivable_temperature
- maximum_survivable_temperature = fugitive.maximum_survivable_temperature
- unsuitable_cold_damage = fugitive.unsuitable_cold_damage
- unsuitable_heat_damage = fugitive.unsuitable_heat_damage
- speak_emote = fugitive.speak_emote?.Copy()
- verb_say = fugitive.verb_say
- verb_ask = fugitive.verb_ask
- verb_exclaim = fugitive.verb_exclaim
- verb_yell = fugitive.verb_yell
- verb_whisper = fugitive.verb_whisper
- bubble_icon = fugitive.bubble_icon
- response_help_continuous = fugitive.response_help_continuous
- response_help_simple = fugitive.response_help_simple
- response_disarm_continuous = fugitive.response_disarm_continuous
- response_disarm_simple = fugitive.response_disarm_simple
- response_harm_continuous = fugitive.response_harm_continuous
- response_harm_simple = fugitive.response_harm_simple
- attacked_sound = fugitive.attacked_sound
-
-// Down as long as its fugitive would be (M2): a meek fugitive can't give itself away by getting up first.
-/mob/living/basic/bounty_criminal/decoy/body_recovery_time()
- return isnull(outpost_recovery_time) ? ..() : outpost_recovery_time
-
-/mob/living/basic/bounty_criminal/decoy/body_stamina_pool()
- return isnull(outpost_stamina_pool) ? ..() : outpost_stamina_pool
+/mob/living/carbon/human/npc/bounty_criminal/decoy/proc/outpost_match_kit(mob/living/carbon/human/npc/bounty_criminal/fugitive)
+ if(QDELETED(fugitive))
+ return
+ for(var/slot in list(ITEM_SLOT_BACK, ITEM_SLOT_BELT))
+ var/obj/item/theirs = fugitive.get_item_by_slot(slot)
+ var/obj/item/mine = get_item_by_slot(slot)
+ if(mine?.type == theirs?.type)
+ continue
+ if(mine)
+ temporarilyRemoveItemFromInventory(mine, force = TRUE)
+ qdel(mine)
+ if(!istype(theirs, /obj/item/storage))
+ continue
+ var/obj/item/storage/copy = new theirs.type(src)
+ for(var/atom/movable/inside as anything in copy.contents)
+ qdel(inside)
+ if(equip_to_slot_or_del(copy, slot, initial = TRUE))
+ npc_lock_item(copy)
/// A decoy never fights anyone (P2's gate on attacks)
-/mob/living/basic/bounty_criminal/decoy/may_attack(atom/target)
+/mob/living/carbon/human/npc/bounty_criminal/decoy/may_attack(atom/target)
return FALSE
/**
- * Confronting a decoy, whoever does it (a wrong warrant, cuffs reached for, any other package): a
- * wrong accusation, with its cost. It protests, and at its outpost the posting's alert rises (C1).
+ * Confronting a decoy, whoever does it (a wrong warrant, any other package): a wrong accusation,
+ * with its cost. It protests, and at its outpost the posting's alert rises (C1).
*/
-/mob/living/basic/bounty_criminal/decoy/on_confronted(mob/user)
+/mob/living/carbon/human/npc/bounty_criminal/decoy/on_confronted(mob/user)
var/datum/component/bounty_outpost_blend/blend = GetComponent(/datum/component/bounty_outpost_blend)
var/datum/criminal_bounty/posting = blend?.posting_ref?.resolve()
if(blend?.leaving || QDELETED(posting) || !isliving(user) || !user.mind)
@@ -605,15 +656,16 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
return
posting.outpost_wrong_accusation(src, user)
-/// Someone hit it on purpose: a bark, then it backs off from them for a few seconds
-/mob/living/basic/bounty_criminal/decoy/proc/outpost_react_to_hit(mob/living/attacker)
+/// Someone hit it on purpose: a bark, then it backs off from them for a few seconds (not while it is walking out)
+/mob/living/carbon/human/npc/bounty_criminal/decoy/proc/outpost_react_to_hit(mob/living/attacker)
if(stat != CONSCIOUS || is_downed() || is_restrained())
return
if(COOLDOWN_FINISHED(src, outpost_bark_cooldown))
COOLDOWN_START(src, outpost_bark_cooldown, 8 SECONDS)
if(!bounty_say("hurt"))
say(pick(GLOB.bounty_decoy_hurt_lines), forced = "bounty decoy")
- if(QDELETED(attacker) || !isturf(loc) || HAS_TRAIT(src, TRAIT_IMMOBILIZED))
+ var/datum/component/bounty_outpost_blend/blend = GetComponent(/datum/component/bounty_outpost_blend)
+ if(blend?.leaving || QDELETED(attacker) || !isturf(loc) || HAS_TRAIT(src, TRAIT_IMMOBILIZED))
return
GLOB.move_manager.move_away(src, attacker, BOUNTY_DECOY_FLEE_DISTANCE, max(cached_multiplicative_slowdown, 1), BOUNTY_DECOY_FLEE_TIME, priority = MOVEMENT_ABOVE_SPACE_PRIORITY)
@@ -626,15 +678,19 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
*
* On the fugitive and on each decoy, so the two behave the same way (AR-C6, C7, C8):
* - the zone's generic name and description (set once, and kept);
- * - nobody can pull, drag, shove or stuff them anywhere;
+ * - the fugitive wears the zone's clothes (redress()); a decoy is built in them;
* - the outpost's turrets leave them alone;
- * - a shot not aimed at them passes through them;
+ * - they never step onto the hangar lift by themselves;
* - a deliberate hit by a person counts: on a decoy it raises the alert and is an outpost strike,
- * on the fugitive it ends the act.
+ * on the fugitive it ends the act. So does a reach for their wrists with cuffs.
+ *
+ * Nothing else is special about them: a hand on them, a shot, a shove or a thrown bottle goes through
+ * tg like it would for anyone, and they answer it the way their AI does. A shot hits whoever it hits;
+ * only one aimed at them counts as a deliberate hit.
*
* The fugitive stops blending in when exposed (the warrant, or a hit); a decoy never does. The
- * component stays on an exposed fugitive for the rest of its time at the outpost: its own shots
- * there pass through anyone not on its grudge list (AR-C8).
+ * component stays on an exposed fugitive for the rest of its time at the outpost: if it hurts a
+ * bystander there, the turrets are let loose on it (AR-C8).
*/
/datum/component/bounty_outpost_blend
/// The posting they are part of, as a weakref (/datum/criminal_bounty)
@@ -645,7 +701,7 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
var/decoy = FALSE
/// Still blending in
var/blending = TRUE
- /// Walking out to the hangar (/datum/component/bounty_outpost_exit): hits and warrants no longer count
+ /// Walking out to the hangar (bounty_outpost_walk_out()): hits and warrants no longer count
var/leaving = FALSE
/// The zone's clothes they wear while blending in
var/outfit
@@ -657,21 +713,21 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
COOLDOWN_DECLARE(hit_grace)
/datum/component/bounty_outpost_blend/Initialize(datum/criminal_bounty/posting, decoy = FALSE, display_name, display_desc, outfit)
- if(!istype(parent, /mob/living/basic/bounty_criminal))
+ if(!istype(parent, /mob/living/carbon/human/npc/bounty_criminal))
return COMPONENT_INCOMPATIBLE
posting_ref = posting ? WEAKREF(posting) : null
var/atom/outpost = posting?.outpost_site?.resolve() || posting?.site_ref?.resolve()
outpost_ref = outpost ? WEAKREF(outpost) : null
src.decoy = decoy
src.outfit = outfit
- var/mob/living/basic/bounty_criminal/owner = parent
+ var/mob/living/carbon/human/npc/bounty_criminal/owner = parent
owner.blended = TRUE
if(display_name)
owner.name = display_name
owner.real_name = display_name
+ owner.dna?.real_name = display_name
if(display_desc)
owner.desc = display_desc
- owner.move_resist = MOVE_FORCE_VERY_STRONG
ADD_TRAIT(owner, TRAIT_NO_CONTAINMENT, BOUNTY_OUTPOST_TRAIT)
ADD_TRAIT(owner, TRAIT_NO_STORAGE_INSERT, BOUNTY_OUTPOST_TRAIT)
// Belt and braces beside P2's turret rule for criminals: turrets skip faction-mates before
@@ -681,23 +737,18 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
new_faction += FACTION_TURRET
owner.faction = new_faction
added_turret_faction = TRUE
+ // A decoy was built in the zone's clothes already, which changes nothing; the fugitive was dressed as the criminal it is
if(outfit)
redress()
- // P2 dresses a new criminal in its own clothes in the background; whichever look lands
- // last would stick, so the zone's is put back on after it (from the cache: cheap).
- addtimer(CALLBACK(src, PROC_REF(redress)), 3 SECONDS, TIMER_DELETE_ME)
- addtimer(CALLBACK(src, PROC_REF(redress)), 10 SECONDS, TIMER_DELETE_ME)
/datum/component/bounty_outpost_blend/Destroy(force)
stop_blending()
return ..()
/datum/component/bounty_outpost_blend/RegisterWithParent()
- RegisterSignal(parent, COMSIG_ATOM_CAN_BE_PULLED, PROC_REF(on_pull_attempt))
- RegisterSignal(parent, COMSIG_MOUSEDROP_ONTO, PROC_REF(on_dragged))
RegisterSignal(parent, COMSIG_MOVABLE_PRE_MOVE, PROC_REF(on_pre_move))
RegisterSignal(parent, COMSIG_PROJECTILE_PREHIT, PROC_REF(on_projectile_prehit))
- RegisterSignal(parent, COMSIG_ATOM_ITEM_INTERACTION, PROC_REF(on_item_interaction))
+ RegisterSignal(parent, COMSIG_BOUNTY_CUFF_REACHED, PROC_REF(on_cuff_reached))
RegisterSignal(parent, COMSIG_ATOM_AFTER_ATTACKEDBY, PROC_REF(on_item_attack))
RegisterSignal(parent, COMSIG_ATOM_ATTACK_HAND, PROC_REF(on_hand_attack))
RegisterSignal(parent, COMSIG_ATOM_ATTACK_HAND_SECONDARY, PROC_REF(on_shoved))
@@ -707,15 +758,13 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
RegisterSignal(parent, COMSIG_ATOM_PREHITBY, PROC_REF(on_thrown_hit))
RegisterSignals(parent, list(COMSIG_ATOM_ATTACK_BASIC_MOB, COMSIG_ATOM_ATTACK_ANIMAL), PROC_REF(on_creature_attack))
RegisterSignal(parent, COMSIG_PROJECTILE_FIRER_BEFORE_FIRE, PROC_REF(on_firing))
- RegisterSignal(parent, COMSIG_HOSTILE_POST_ATTACKINGTARGET, PROC_REF(on_melee_attack))
+ RegisterSignals(parent, list(COMSIG_MOB_ITEM_ATTACK, COMSIG_LIVING_UNARMED_ATTACK), PROC_REF(on_own_melee_attack))
/datum/component/bounty_outpost_blend/UnregisterFromParent()
UnregisterSignal(parent, list(
- COMSIG_ATOM_CAN_BE_PULLED,
- COMSIG_MOUSEDROP_ONTO,
COMSIG_MOVABLE_PRE_MOVE,
COMSIG_PROJECTILE_PREHIT,
- COMSIG_ATOM_ITEM_INTERACTION,
+ COMSIG_BOUNTY_CUFF_REACHED,
COMSIG_ATOM_AFTER_ATTACKEDBY,
COMSIG_ATOM_ATTACK_HAND,
COMSIG_ATOM_ATTACK_HAND_SECONDARY,
@@ -726,27 +775,87 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
COMSIG_ATOM_ATTACK_BASIC_MOB,
COMSIG_ATOM_ATTACK_ANIMAL,
COMSIG_PROJECTILE_FIRER_BEFORE_FIRE,
- COMSIG_HOSTILE_POST_ATTACKINGTARGET,
+ COMSIG_MOB_ITEM_ATTACK,
+ COMSIG_LIVING_UNARMED_ATTACK,
))
-/// Puts the zone's clothes back on, while still blending in and not hiding (a meek one's disguise stays)
+/**
+ * Changes the fugitive into the zone's clothes while it blends in. It was dressed as the criminal it
+ * is; decoys are built in the zone's, so the two must end up looking the same. See
+ * outpost_wear_patron_clothes().
+ */
/datum/component/bounty_outpost_blend/proc/redress()
- var/mob/living/basic/bounty_criminal/owner = parent
- if(!blending || leaving || !outfit || !owner.record || owner.hidden)
+ var/mob/living/carbon/human/npc/bounty_criminal/owner = parent
+ if(!blending || leaving || !outfit || QDELETED(owner))
return
- INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(apply_bounty_look), owner, owner.record, outfit)
+ owner.outpost_wear_patron_clothes(outfit)
+
+/**
+ * Changes into `outfit_type`'s clothes: the uniform, the coat, the gloves and the shoes it names, and
+ * nothing on the head or the face (the zone's patrons wear no hats: hair is a clue). What it wore
+ * there is taken away and deleted. Everything else it carries stays where it is, pockets and belt
+ * included. The new clothes are locked to the body like the rest of its kit (D3).
+ * What its species can't live without stays on (a plasmaman's envirosuit, helmet and gloves, its
+ * species' outfit_important_for_life): its decoys, of its species, are dressed over the same.
+ */
+/mob/living/carbon/human/npc/bounty_criminal/proc/outpost_wear_patron_clothes(outfit_type)
+ var/datum/outfit/patron = new outfit_type()
+ var/list/swaps = list(
+ list(w_uniform, patron.uniform, ITEM_SLOT_ICLOTHING),
+ list(wear_suit, patron.suit, ITEM_SLOT_OCLOTHING),
+ list(gloves, patron.gloves, ITEM_SLOT_GLOVES),
+ list(shoes, patron.shoes, ITEM_SLOT_FEET),
+ list(head, patron.head, ITEM_SLOT_HEAD),
+ list(wear_mask, patron.mask, ITEM_SLOT_MASK),
+ )
+ qdel(patron)
+ var/datum/outfit/life = dna?.species?.outfit_important_for_life
+ for(var/list/swap as anything in swaps)
+ var/obj/item/worn = swap[1]
+ var/new_type = swap[2]
+ if(worn && ispath(new_type) && worn.type == new_type)
+ continue
+ if(bounty_outpost_kept_for_life(worn, life, swap[3]))
+ continue
+ if(worn)
+ // idrop off: the pockets, belt and suit storage are meant to stay when the clothes over them are swapped
+ temporarilyRemoveItemFromInventory(worn, force = TRUE, idrop = FALSE)
+ qdel(worn)
+ if(!ispath(new_type))
+ continue
+ var/obj/item/clothes = new new_type(src)
+ equip_to_slot_or_del(clothes, swap[3], initial = TRUE)
+ npc_lock_item(clothes)
-/// Ends the act: pullable (by P2's rules) and containable again, and no longer in the turrets' faction. The name stays.
+/// Whether `worn`, in `slot`, is what `life` (a species' outfit_important_for_life) puts there: kept on when blending in
+/proc/bounty_outpost_kept_for_life(obj/item/worn, datum/outfit/life, slot)
+ if(isnull(worn) || !ispath(life, /datum/outfit))
+ return FALSE
+ var/life_type
+ switch(slot)
+ if(ITEM_SLOT_ICLOTHING)
+ life_type = initial(life.uniform)
+ if(ITEM_SLOT_OCLOTHING)
+ life_type = initial(life.suit)
+ if(ITEM_SLOT_GLOVES)
+ life_type = initial(life.gloves)
+ if(ITEM_SLOT_FEET)
+ life_type = initial(life.shoes)
+ if(ITEM_SLOT_HEAD)
+ life_type = initial(life.head)
+ if(ITEM_SLOT_MASK)
+ life_type = initial(life.mask)
+ return ispath(life_type) && istype(worn, life_type)
+
+/// Ends the act: containable again, and no longer in the turrets' faction. The name stays.
/datum/component/bounty_outpost_blend/proc/stop_blending()
if(!blending)
return
blending = FALSE
- var/mob/living/basic/bounty_criminal/owner = parent
+ var/mob/living/carbon/human/npc/bounty_criminal/owner = parent
if(QDELETED(owner))
return
owner.blended = FALSE
- if(!leaving)
- owner.body_update_drag()
REMOVE_TRAIT(owner, TRAIT_NO_CONTAINMENT, BOUNTY_OUTPOST_TRAIT)
REMOVE_TRAIT(owner, TRAIT_NO_STORAGE_INSERT, BOUNTY_OUTPOST_TRAIT)
if(added_turret_faction)
@@ -755,29 +864,6 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
owner.faction = new_faction
added_turret_faction = FALSE
-/**
- * Nobody pulls someone blending in, or walking out. By P2's rule, though, anyone down, cuffed or dead
- * can be dragged: a fugitive (or a decoy, the same, AR-C6) downed or cuffed while still blending in,
- * by a blast say, is dragged like any other catch.
- */
-/datum/component/bounty_outpost_blend/proc/on_pull_attempt(datum/source, mob/living/puller)
- SIGNAL_HANDLER
- if(leaving)
- return COMSIG_ATOM_CANT_PULL
- if(!blending)
- return NONE
- var/mob/living/basic/bounty_criminal/owner = parent
- if(owner.stat == DEAD || owner.downed || owner.is_restrained())
- return NONE
- return COMSIG_ATOM_CANT_PULL
-
-/// Drag-drops (onto a bed, into a crate or disposals) never check move_resist, so they are refused here
-/datum/component/bounty_outpost_blend/proc/on_dragged(datum/source, atom/over, mob/user)
- SIGNAL_HANDLER
- if(blending || leaving)
- return COMPONENT_CANCEL_MOUSEDROP_ONTO
- return NONE
-
/**
* They never step onto the hangar lift by themselves: the lift carries everyone standing on it, and
* a patron riding it down would leave the outpost. Dragged or thrown, they go where they are taken
@@ -794,37 +880,39 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
return NONE
/**
- * A shot not aimed at someone blending in passes through them (AR-C7): nobody can use a decoy as a
- * shield, or shoot "past" one to make a rival hit it. A shot aimed at them is a deliberate hit.
+ * A shot hits whoever it hits. One aimed at someone blending in is a deliberate hit by whoever fired
+ * it; a stray one that lands on them is not (nobody is framed with it).
*/
/datum/component/bounty_outpost_blend/proc/on_projectile_prehit(datum/source, obj/projectile/projectile)
SIGNAL_HANDLER
- if(leaving)
- return PROJECTILE_INTERRUPT_HIT_PHASE
- if(!blending)
- return NONE
- if(projectile.original != parent)
- return PROJECTILE_INTERRUPT_HIT_PHASE
- if(projectile.is_hostile_projectile() && isliving(projectile.firer))
+ if(projectile.original == parent && projectile.is_hostile_projectile() && isliving(projectile.firer))
deliberate_hit(projectile.firer)
return NONE
/**
- * Restraints reached for (C1): exactly the cost of a punch, on anyone blending in. A decoy's wrists
- * are an outpost strike and the alert; the fugitive's end its act. Standing and free, they pull
- * away, so P2's own refusal (and the confrontation it starts) never runs as a free test. Down or
- * stunned, the cuffs go on as P2 puts them on anyone.
+ * Someone is putting restraints on them (COMSIG_BOUNTY_CUFF_REACHED, from the criminal body before its
+ * own reaction), exactly the cost of a punch (C1):
+ * - A decoy's wrists are an outpost strike and the alert, and it backs away (which breaks the cuffer's
+ * try). Handled here, so it isn't also taken for a wrong warrant.
+ * - The fugitive's end its act. The body's own reaction then steps it away and runs or fights, as for
+ * anyone who is reached for while free.
+ * Down, stunned or held, they can't do anything about it: the cuffs go on. Nobody without a mind
+ * counts. Walking out, the fugitive just takes it like any other free criminal; a decoy's wrists are
+ * still the hitter's strike (handle_hit()).
*/
-/datum/component/bounty_outpost_blend/proc/on_item_interaction(datum/source, mob/living/user, obj/item/tool, list/modifiers)
+/datum/component/bounty_outpost_blend/proc/on_cuff_reached(datum/source, mob/living/user)
SIGNAL_HANDLER
- if(!blending || leaving || !istype(tool, /obj/item/restraints/handcuffs))
+ if(!isliving(user) || !user.mind)
return NONE
- var/mob/living/basic/bounty_criminal/owner = parent
- deliberate_hit(user)
- if(owner.capture_state() != BOUNTY_STATE_FREE)
+ var/mob/living/carbon/human/npc/bounty_criminal/owner = parent
+ if(decoy)
+ deliberate_hit(user)
+ return owner.body_can_answer_cuffs() ? COMPONENT_BOUNTY_CUFF_HANDLED : NONE
+ if(!blending || leaving)
return NONE
- owner.balloon_alert(user, "[owner.p_they()] pull[owner.p_s()] away!")
- return ITEM_INTERACT_BLOCKING
+ owner.body_add_grudge(user)
+ stop_blending()
+ return NONE
/datum/component/bounty_outpost_blend/proc/on_item_attack(datum/source, obj/item/weapon, mob/living/attacker, list/modifiers, list/attack_modifiers)
SIGNAL_HANDLER
@@ -873,22 +961,24 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
/// Someone hit them on purpose. Only a person counts: stray shots, stray throws, explosions and NPCs never do.
/datum/component/bounty_outpost_blend/proc/deliberate_hit(mob/living/attacker)
- if(leaving || !istype(attacker) || !attacker.mind || attacker == parent)
+ if(!istype(attacker) || !attacker.mind || attacker == parent)
return
INVOKE_ASYNC(src, PROC_REF(handle_hit), attacker)
/**
* A person hit them on purpose.
- * - The fugitive: the act is over (it remembers who, and reacts as its kind does).
+ * - The fugitive: the act is over (it remembers who, and reacts as its kind does). Walking out, it
+ * just takes the blow.
* - A decoy (AR-C5): one outpost strike for the hitter, as for hitting a trader, and the bounty's
- * alert rises once per scuffle, whoever swung. The decoy barks and backs off.
+ * alert rises once per scuffle, whoever swung. The decoy barks and backs off. Walking out, the
+ * alert has gone up already, so only the strike and the bark are left.
*/
/datum/component/bounty_outpost_blend/proc/handle_hit(mob/living/attacker)
- var/mob/living/basic/bounty_criminal/owner = parent
- if(QDELETED(owner) || QDELETED(attacker) || leaving)
+ var/mob/living/carbon/human/npc/bounty_criminal/owner = parent
+ if(QDELETED(owner) || QDELETED(attacker))
return
if(!decoy)
- if(!blending)
+ if(!blending || leaving)
return
owner.body_add_grudge(attacker)
stop_blending()
@@ -896,33 +986,33 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
return
var/obj/structure/overmap/trader_outpost/outpost = get_trader_outpost_for_turf(get_turf(owner))
outpost?.register_aggression(attacker)
- if(COOLDOWN_FINISHED(src, hit_grace))
+ if(!leaving && COOLDOWN_FINISHED(src, hit_grace))
COOLDOWN_START(src, hit_grace, BOUNTY_OUTPOST_HIT_GRACE)
var/datum/criminal_bounty/posting = posting_ref?.resolve()
if(posting && !QDELETED(posting))
log_game("BOUNTY: [key_name(attacker)] hit a decoy of [posting.record?.name] at [AREACOORD(owner)].")
posting.raise_alert(BOUNTY_ALERT_DECOY_HIT)
// The alert may have sent everyone out already
- var/mob/living/basic/bounty_criminal/decoy/decoy_mob = owner
- if(!leaving && istype(decoy_mob))
+ var/mob/living/carbon/human/npc/bounty_criminal/decoy/decoy_mob = owner
+ if(istype(decoy_mob))
decoy_mob.outpost_react_to_hit(attacker)
-/// Its own fists landed on `target`
-/datum/component/bounty_outpost_blend/proc/on_melee_attack(datum/source, atom/target, result)
+/// Its own fists, or what it swung, landed on `target`
+/datum/component/bounty_outpost_blend/proc/on_own_melee_attack(datum/source, atom/target)
SIGNAL_HANDLER
note_victim(target)
/**
* The fugitive hurt `victim`. At a trader outpost, anyone not on its grudge list is a bystander, and
* hurting one ends the turrets' leave to let the hunters handle it (AR-C8). P2's may_attack() and
- * the grudge-only shots below keep that from happening; a thrown attack that gets round them should
- * call this too.
+ * its AI's line-of-fire check keep that from happening on purpose; a bullet that hits one anyway
+ * lands here too (on_firing()).
*/
/datum/component/bounty_outpost_blend/proc/note_victim(atom/victim)
if(decoy || !isliving(victim) || victim == parent)
return
- var/mob/living/basic/bounty_criminal/owner = parent
- if(owner.body_has_grudge(victim) || istype(victim, /mob/living/basic/bounty_criminal) || istype(victim, /mob/living/basic/bounty_companion))
+ var/mob/living/carbon/human/npc/bounty_criminal/owner = parent
+ if(owner.body_has_grudge(victim) || istype(victim, /mob/living/carbon/human/npc/bounty_criminal) || istype(victim, /mob/living/carbon/human/npc/bounty_companion))
return
if(!is_trader_outpost_protected(owner))
return
@@ -933,48 +1023,60 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
/**
* Whether a trader outpost's turrets may fire on them (AR-C8): only a fugitive, exposed, that has
* hurt someone who never crossed it. Blending in, or fighting only those who came for it, never.
- * P2's line in is_hostile_creature() asks this for bounty criminals.
+ * Nor one the hunters already have: dead, in crit, cuffed or stunned (tg's own states). P2's line in
+ * is_hostile_creature() asks this for bounty criminals.
*/
-/mob/living/basic/bounty_criminal/proc/outpost_turret_target()
+/mob/living/carbon/human/npc/bounty_criminal/proc/outpost_turret_target()
+ if(capture_state() != BOUNTY_STATE_FREE)
+ return FALSE
var/datum/component/bounty_outpost_blend/blend = GetComponent(/datum/component/bounty_outpost_blend)
return !!blend && !blend.blending && !blend.leaving && blend.hurt_bystander
-/// The fugitive fired: at a trader outpost its shot passes through anyone not on its grudge list (AR-C8)
+/// The fugitive fired: a shot of its that hits someone at a trader outpost is judged by who it hit (note_victim())
/datum/component/bounty_outpost_blend/proc/on_firing(datum/source, obj/projectile/projectile, atom/fired_from, atom/original)
SIGNAL_HANDLER
if(decoy || !is_trader_outpost_protected(parent))
return
- RegisterSignal(projectile, COMSIG_PROJECTILE_SELF_PREHIT, PROC_REF(on_own_projectile_prehit))
+ RegisterSignal(projectile, COMSIG_PROJECTILE_SELF_ON_HIT, PROC_REF(on_own_projectile_hit))
-/datum/component/bounty_outpost_blend/proc/on_own_projectile_prehit(obj/projectile/source, atom/target)
+/datum/component/bounty_outpost_blend/proc/on_own_projectile_hit(obj/projectile/source, atom/movable/firer, atom/target, angle, hit_limb, blocked, pierce_hit)
SIGNAL_HANDLER
- if(!isliving(target) || target == parent)
- return NONE
- var/mob/living/basic/bounty_criminal/owner = parent
- if(owner.body_has_grudge(target))
- return NONE
- return PROJECTILE_INTERRUPT_HIT_PHASE
+ note_victim(target)
// =========================================================================
// WALKING OUT
// =========================================================================
+/// Sends each of `walkers` (human NPCs) out to `outpost`'s hangar lift: bounty_outpost_walk_out()
+/proc/bounty_outpost_walk_out_all(list/walkers, obj/structure/overmap/trader_outpost/outpost)
+ for(var/mob/living/carbon/human/npc/walker as anything in walkers)
+ bounty_outpost_walk_out(walker, outpost)
+
/**
- * `walker` leaves `outpost`: walks to the nearest hangar lift and fades out, or fades where they
- * are if they can't walk there. `floor` is the outpost's public floor if the caller has it (one
- * flood for everyone leaving at once); the lift is only walked to from a tile on it, so an
- * unreachable lift is never pathed to.
+ * `walker` is done at `outpost`: it walks to the nearest hangar lift the way a person would
+ * (npc_walk_out(), human_npc_states.dm). It can be shot, downed, cuffed or grabbed on the way and then
+ * stays where it is; it is deleted only when it stands on the lift, or when no player can see it and
+ * it is on its feet and free. `on_left` is called with it just before that. A lift behind a counter it
+ * can't get round just means it goes when nobody is looking. Someone who is dead stays for the
+ * corpse sweep; someone sitting at a table or hiding gets up first. Returns TRUE if it set off.
*/
-/proc/bounty_outpost_walk_out(mob/living/walker, obj/structure/overmap/trader_outpost/outpost, list/floor)
- if(QDELETED(walker) || walker.GetComponent(/datum/component/bounty_outpost_exit))
- return
- var/turf/exit_turf = bounty_outpost_exit_turf(walker, outpost)
- if(exit_turf)
- if(isnull(floor))
- floor = bounty_outpost_public_floor(outpost)
- if(!isturf(walker.loc) || !(walker.loc in floor) || !(exit_turf in floor))
- exit_turf = null
- walker.AddComponent(/datum/component/bounty_outpost_exit, exit_turf)
+/proc/bounty_outpost_walk_out(mob/living/carbon/human/npc/walker, obj/structure/overmap/trader_outpost/outpost, datum/callback/on_left)
+ if(QDELETED(walker) || walker.stat == DEAD || !isnull(walker.npc_exit))
+ return FALSE
+ var/datum/component/bounty_outpost_blend/blend = walker.GetComponent(/datum/component/bounty_outpost_blend)
+ blend?.leaving = TRUE
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = walker
+ if(istype(criminal))
+ // Out of the closet or from behind the plant, and up from its seat, its drink put down
+ if(criminal.hidden)
+ criminal.ai_unhide()
+ criminal.ai_end_activity()
+ criminal.ai_stand_up()
+ else if(walker.buckled && !ismob(walker.buckled) && !human_npc_out_of_fight(walker))
+ walker.buckled.unbuckle_mob(walker, force = TRUE)
+ // The lift if there is one on its level; else where it stands, which it leaves once nobody can see it
+ var/turf/exit_turf = bounty_outpost_exit_turf(walker, outpost) || get_turf(walker)
+ return walker.npc_walk_out(exit_turf, on_left)
/// The hangar lift alcove tile nearest `from`, on its level, or null
/proc/bounty_outpost_exit_turf(atom/from, obj/structure/overmap/trader_outpost/outpost)
@@ -992,114 +1094,6 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
nearest_distance = distance
return nearest
-/**
- * # Walking out
- *
- * Someone P6 put at an outpost is done there: their AI stops, nobody can hurt or pull them, and
- * they walk to the hangar lift and fade out. Anyone who can't walk (down, cuffed, hidden, dead),
- * can't reach the lift, is taken off their feet on the way, or is still walking after
- * BOUNTY_OUTPOST_EXIT_TIMEOUT fades where they are. The walk's move loop never outlives them.
- */
-/datum/component/bounty_outpost_exit
- /// The hangar lift tile they are walking to, or null
- var/turf/destination
- /// The walk to the lift, while it runs
- var/datum/move_loop/walk_loop
- /// Fading out now
- var/fading = FALSE
-
-/datum/component/bounty_outpost_exit/Initialize(turf/destination)
- if(!isliving(parent))
- return COMPONENT_INCOMPATIBLE
- src.destination = destination
- var/mob/living/walker = parent
- var/datum/component/bounty_outpost_blend/blend = walker.GetComponent(/datum/component/bounty_outpost_blend)
- if(blend)
- blend.leaving = TRUE
- ADD_TRAIT(walker, TRAIT_AI_PAUSED, BOUNTY_OUTPOST_TRAIT)
- ADD_TRAIT(walker, TRAIT_GODMODE, BOUNTY_OUTPOST_TRAIT)
- walker.move_resist = MOVE_FORCE_VERY_STRONG
- walker.pulledby?.stop_pulling()
- walker.stop_pulling()
- addtimer(CALLBACK(src, PROC_REF(fade_out)), BOUNTY_OUTPOST_EXIT_TIMEOUT, TIMER_DELETE_ME)
- if(!destination || !can_walk() || destination.z != walker.z)
- fade_out()
- return
- RegisterSignal(walker, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
- walk_loop = GLOB.move_manager.jps_move(walker, destination, delay = BOUNTY_OUTPOST_EXIT_DELAY, timeout = BOUNTY_OUTPOST_EXIT_TIMEOUT, repath_delay = 2 SECONDS, max_path_length = 150, simulated_only = TRUE, priority = MOVEMENT_ABOVE_SPACE_PRIORITY)
- if(!walk_loop)
- fade_out()
- return
- RegisterSignal(walk_loop, COMSIG_MOVELOOP_PREPROCESS_CHECK, PROC_REF(before_step))
- RegisterSignals(walk_loop, list(COMSIG_MOVELOOP_STOP, COMSIG_QDELETING), PROC_REF(on_walk_ended))
-
-/datum/component/bounty_outpost_exit/Destroy(force)
- end_walk()
- destination = null
- return ..()
-
-/// Whether they can walk out on their own feet
-/datum/component/bounty_outpost_exit/proc/can_walk()
- var/mob/living/walker = parent
- if(QDELETED(walker) || walker.stat != CONSCIOUS || !isturf(walker.loc) || walker.buckled)
- return FALSE
- if(HAS_TRAIT(walker, TRAIT_IMMOBILIZED) || HAS_TRAIT(walker, TRAIT_FLOORED) || HAS_TRAIT(walker, TRAIT_RESTRAINED))
- return FALSE
- if(istype(walker, /mob/living/basic/bounty_criminal))
- var/mob/living/basic/bounty_criminal/criminal = walker
- if(criminal.hidden || criminal.is_downed() || criminal.is_restrained())
- return FALSE
- return TRUE
-
-/// Before each step: someone off their feet or off the floor (stuffed somewhere, carried off) stops walking and fades, so the pathfinder is never asked to start from nowhere
-/datum/component/bounty_outpost_exit/proc/before_step(datum/move_loop/source)
- SIGNAL_HANDLER
- if(can_walk())
- return NONE
- addtimer(CALLBACK(src, PROC_REF(fade_out)), 0, TIMER_DELETE_ME)
- return MOVELOOP_SKIP_STEP
-
-/// The walk stopped (timed out, or ended): whoever hasn't reached the lift fades where they are
-/datum/component/bounty_outpost_exit/proc/on_walk_ended(datum/move_loop/source)
- SIGNAL_HANDLER
- UnregisterSignal(source, list(COMSIG_MOVELOOP_PREPROCESS_CHECK, COMSIG_MOVELOOP_STOP, COMSIG_QDELETING))
- if(walk_loop == source)
- walk_loop = null
- if(!fading)
- addtimer(CALLBACK(src, PROC_REF(fade_out)), 0, TIMER_DELETE_ME)
-
-/// Stops the walk, if it is still going
-/datum/component/bounty_outpost_exit/proc/end_walk()
- if(!walk_loop)
- return
- var/datum/move_loop/ending = walk_loop
- walk_loop = null
- UnregisterSignal(ending, list(COMSIG_MOVELOOP_PREPROCESS_CHECK, COMSIG_MOVELOOP_STOP, COMSIG_QDELETING))
- if(!QDELETED(ending))
- qdel(ending)
-
-/datum/component/bounty_outpost_exit/proc/on_moved(datum/source, atom/old_loc, dir, forced, list/old_locs)
- SIGNAL_HANDLER
- // Faded after the step, never inside the move loop's own step
- if(destination && get_dist(parent, destination) <= 1)
- addtimer(CALLBACK(src, PROC_REF(fade_out)), 0, TIMER_DELETE_ME)
-
-/datum/component/bounty_outpost_exit/proc/fade_out()
- if(fading)
- return
- fading = TRUE
- end_walk()
- var/mob/living/walker = parent
- if(QDELETED(walker))
- return
- UnregisterSignal(walker, COMSIG_MOVABLE_MOVED)
- GLOB.move_manager.stop_looping(walker)
- animate(walker, alpha = 0, time = BOUNTY_OUTPOST_FADE_TIME)
- addtimer(CALLBACK(src, PROC_REF(vanish)), BOUNTY_OUTPOST_FADE_TIME, TIMER_DELETE_ME)
-
-/datum/component/bounty_outpost_exit/proc/vanish()
- qdel(parent)
-
// =========================================================================
// ASKING TRADERS
// =========================================================================
@@ -1132,7 +1126,7 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
if(!posting)
return FALSE
var/words
- var/mob/living/basic/bounty_criminal/fugitive = posting.criminal()
+ var/mob/living/carbon/human/npc/bounty_criminal/fugitive = posting.criminal()
if(!fugitive || get_trader_outpost_for_turf(get_turf(fugitive)) != trader.outpost)
words = "They're not here any more." // slipped away, or someone already dragged them off
else
@@ -1204,21 +1198,21 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
var/obj/structure/overmap/trader_outpost/outpost = outpost_site?.resolve()
switch(kind[1])
if(BOUNTY_CLUE_SEEN)
- var/mob/living/basic/bounty_criminal/fugitive = criminal()
+ var/mob/living/carbon/human/npc/bounty_criminal/fugitive = criminal()
return fugitive ? bounty_outpost_where(fugitive, outpost) : null
if(BOUNTY_CLUE_RULED_OUT)
var/index = kind[2]
if(index < 1 || index > length(decoys))
return null
var/datum/weakref/decoy_ref = decoys[index]
- var/mob/living/basic/bounty_criminal/decoy = decoy_ref?.resolve()
+ var/mob/living/carbon/human/npc/bounty_criminal/decoy = decoy_ref?.resolve()
if(QDELETED(decoy) || decoy.stat == DEAD)
return null
var/where = bounty_outpost_where(decoy, outpost)
if(!where)
return null
// Only if the place picks out one person: never a hint that could fit the fugitive
- for(var/mob/living/basic/bounty_criminal/other as anything in outpost_candidates())
+ for(var/mob/living/carbon/human/npc/bounty_criminal/other as anything in outpost_candidates())
if(other != decoy && bounty_outpost_where(other, outpost) == where)
return null
return where
@@ -1251,11 +1245,11 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
/// The fugitive and its decoys, whoever of them still exists
/datum/criminal_bounty/proc/outpost_candidates()
. = list()
- var/mob/living/basic/bounty_criminal/fugitive = criminal()
+ var/mob/living/carbon/human/npc/bounty_criminal/fugitive = criminal()
if(fugitive)
. += fugitive
for(var/datum/weakref/decoy_ref as anything in decoys)
- var/mob/living/basic/bounty_criminal/decoy = decoy_ref?.resolve()
+ var/mob/living/carbon/human/npc/bounty_criminal/decoy = decoy_ref?.resolve()
if(!QDELETED(decoy))
. += decoy
@@ -1408,15 +1402,6 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
show_warrant(interacting_with, user)
return ITEM_INTERACT_SUCCESS
-/// Its bounty closed: it burns away, wherever it is. Whoever carries it is told; on the floor, the room sees it.
-/obj/item/paper/bounty_warrant/proc/burn_up()
- var/mob/living/holder = get(src, /mob/living)
- if(holder)
- to_chat(holder, span_notice("[src] curls up and burns away."))
- else if(isturf(loc))
- visible_message(span_notice("[src] curls up and burns away."), vision_distance = COMBAT_MESSAGE_RANGE)
- qdel(src)
-
/**
* `user` holds the warrant up to `target`.
* - The fugitive it is for: exposed (outpost_confront()).
@@ -1429,7 +1414,7 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
if(QDELETED(posting) || posting.status != BOUNTY_POSTING_OPEN)
to_chat(user, span_warning("This warrant is out of date."))
return
- if(!istype(target, /mob/living/basic/bounty_criminal))
+ if(!istype(target, /mob/living/carbon/human/npc/bounty_criminal))
user.visible_message(span_notice("[user] holds up a warrant for [target] to see."), span_notice("You hold up the warrant for [target] to see."), vision_distance = COMBAT_MESSAGE_RANGE)
if(target.client)
to_chat(target, span_notice("[user] shows you a bounty warrant. It isn't for you."))
@@ -1443,7 +1428,7 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list(
return
posting.outpost_start_warrant_cooldown(user)
user.visible_message(span_notice("[user] holds up a warrant for [target] to see."), span_notice("You hold up the warrant for [target] to see."), vision_distance = COMBAT_MESSAGE_RANGE)
- var/mob/living/basic/bounty_criminal/criminal = target
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = target
if(criminal == posting.criminal())
posting.outpost_confront(criminal, user)
else
diff --git a/voidcrew/modules/bounties/bounty_placement.dm b/voidcrew/modules/bounties/bounty_placement.dm
index f150143c2ce..6e28641c1ca 100644
--- a/voidcrew/modules/bounties/bounty_placement.dm
+++ b/voidcrew/modules/bounties/bounty_placement.dm
@@ -125,11 +125,11 @@
best += ruin
return board_pick_tiered(best, good, any)
-/// An NPC pirate ship with its crew aboard, not claimed, not abandoned, holding no other bounty
+/// A plain NPC pirate ship with its crew aboard, not claimed, not abandoned, holding no other bounty. Never a themed crew's (bounty_ship_hides_criminals()): a criminal hides among ordinary pirates.
/datum/controller/subsystem/criminal_bounties/proc/board_pick_npc_ship(zone, obj/structure/overmap/exclude)
var/list/candidates = list()
for(var/obj/structure/overmap/ship/npc/pirate/npc_ship in SSnpc_ships?.active_ships)
- if(QDELETED(npc_ship) || npc_ship == exclude)
+ if(QDELETED(npc_ship) || npc_ship == exclude || !bounty_ship_hides_criminals(npc_ship))
continue
if(npc_ship.player_controlled || npc_ship.abandoned || npc_ship.spawner_resolved || !npc_ship.crew_ever_spawned)
continue
@@ -277,7 +277,7 @@
SIGNAL_HANDLER
if(!is_open() || board_relisting)
return
- var/mob/living/basic/bounty_criminal/criminal = criminal()
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = criminal()
// A criminal carried off the site (aboard a ship) is not the site's to take
if(criminal && !board_site_contains(source, get_turf(criminal)))
return
@@ -285,11 +285,11 @@
/**
* The site's interior went away with the criminal in it (spec 6: unload): the criminal, its
- * companions and the marker go, the posting stays open, and the same record comes back at full
- * health on the next load. Cuffs don't survive, but the worst state it reached does (12.1): it
- * never pays more than it did before, and a dead one comes back as proof of death.
+ * companions and the marker go, the posting stays open, and the same record comes back unhurt on the
+ * next load, out of any cuffs. Pay is by its condition on the pad, so a living one owes nothing to how
+ * it was before; one that died comes back as proof of death.
*/
-/datum/criminal_bounty/proc/board_site_took_criminal(mob/living/basic/bounty_criminal/criminal)
+/datum/criminal_bounty/proc/board_site_took_criminal(mob/living/carbon/human/npc/bounty_criminal/criminal)
board_note_worst(criminal)
board_detach_criminal()
var/list/extras = list()
@@ -307,13 +307,10 @@
board_wait_for_load(site())
log_game("BOUNTY: the [board_log_name()] waits for its site to load again")
-/// Remembers the worst state `criminal` reached, for whatever body of it comes next (12.1)
-/datum/criminal_bounty/proc/board_note_worst(mob/living/basic/bounty_criminal/criminal)
- if(!criminal)
- return
- var/state = criminal.stat == DEAD ? BOUNTY_STATE_DEAD : criminal.worst_state
- if(bounty_state_rank(state) < bounty_state_rank(board_worst_state))
- board_worst_state = state
+/// Remembers whether `criminal` was dead when its site took it: the next body of it is then its proof of death
+/datum/criminal_bounty/proc/board_note_worst(mob/living/carbon/human/npc/bounty_criminal/criminal)
+ if(criminal?.stat == DEAD)
+ board_worst_state = BOUNTY_STATE_DEAD
/// The site is gone (a ruin respawning elsewhere, a pirate ship destroyed or despawned)
/datum/criminal_bounty/proc/board_on_site_deleted(datum/source)
@@ -409,7 +406,7 @@
return null
if(board_worst_state == BOUNTY_STATE_DEAD)
return board_place_proof(spot)
- var/mob/living/basic/bounty_criminal/criminal = spawn_bounty_criminal(record, spot, src)
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = spawn_bounty_criminal(record, spot, src)
board_spawning = FALSE
if(QDELETED(criminal))
return null
@@ -441,7 +438,7 @@
* the blend at a trader outpost: P6's setup_outpost_blend()). Also used by tests and the admin panel
* to adopt a criminal spawned by hand.
*/
-/datum/criminal_bounty/proc/board_adopt_criminal(mob/living/basic/bounty_criminal/criminal, obj/structure/overmap/where, activity, atom/anchor)
+/datum/criminal_bounty/proc/board_adopt_criminal(mob/living/carbon/human/npc/bounty_criminal/criminal, obj/structure/overmap/where, activity, atom/anchor)
if(QDELETED(criminal))
return FALSE
board_detach_criminal()
@@ -451,8 +448,6 @@
criminal.record = record
RegisterSignal(criminal, COMSIG_QDELETING, PROC_REF(board_on_criminal_deleted))
board_spawn_failures = 0
- // Whatever an earlier body of theirs went through still counts (12.1). Only ever made worse.
- criminal.body_restore_worst_state(board_worst_state)
if(where)
criminal.site_bounds = board_site_bounds(where)
board_add_site_factions(criminal, where)
@@ -480,7 +475,7 @@
/// Stops tracking the criminal without touching it
/datum/criminal_bounty/proc/board_detach_criminal()
- var/mob/living/basic/bounty_criminal/criminal = criminal()
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = criminal()
if(criminal)
UnregisterSignal(criminal, COMSIG_QDELETING)
criminal_ref = null
@@ -497,7 +492,7 @@
return BOUNTY_ACTIVITY_EXPLORE
/// Companions for a normal criminal: 0 to BOUNTY_MAX_COMPANIONS in every zone (12.3 C9: the zone scales pay, never the fight), within the server's cap
-/datum/criminal_bounty/proc/board_spawn_companions(mob/living/basic/bounty_criminal/criminal)
+/datum/criminal_bounty/proc/board_spawn_companions(mob/living/carbon/human/npc/bounty_criminal/criminal)
var/count = rand(0, BOUNTY_MAX_COMPANIONS)
// The crew aboard a pirate ship are company enough
if(placement_kind == BOUNTY_PLACEMENT_NPC_SHIP)
@@ -505,17 +500,15 @@
count = min(count, BOUNTY_MAX_LIVE_COMPANIONS - SScriminal_bounties.board_live_companions())
if(count <= 0)
return list()
- var/list/spawned = criminal.spawn_companions(count)
- for(var/mob/living/companion in spawned)
- companions |= WEAKREF(companion)
- return spawned
+ // Built through the human NPC queue: each companion joins the posting's list as it joins its criminal (bounty_companions.dm).
+ criminal.spawn_companions(count)
/**
* Makes the criminal a friend of the site's own, so it doesn't fight the hostiles native to where
* it hides (spec 3): the crew's factions aboard a pirate ship, the planet's and ruins' hostiles.
* The neutral faction every player has is never added.
*/
-/datum/criminal_bounty/proc/board_add_site_factions(mob/living/basic/bounty_criminal/criminal, obj/structure/overmap/where)
+/datum/criminal_bounty/proc/board_add_site_factions(mob/living/carbon/human/npc/bounty_criminal/criminal, obj/structure/overmap/where)
var/list/added = list(FACTION_HOSTILE)
if(istype(where, /obj/structure/overmap/ship/npc))
var/obj/structure/overmap/ship/npc/npc_ship = where
@@ -562,7 +555,7 @@
* let go and the bounty lists at a new site. Returns TRUE if it acted.
*/
/datum/criminal_bounty/proc/board_check_unreachable()
- var/mob/living/basic/bounty_criminal/criminal = criminal()
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = criminal()
if(!criminal)
return FALSE
var/in_chasm = istype(criminal.loc, /obj/effect/abstract/chasm_storage)
@@ -850,7 +843,7 @@
if(placement_kind == BOUNTY_PLACEMENT_TRADER_OUTPOST)
board_drop_marker()
return FALSE
- var/mob/living/basic/bounty_criminal/criminal = criminal()
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = criminal()
if(!criminal)
return FALSE
if(!force && world.time < board_next_sighting)
diff --git a/voidcrew/modules/bounties/bounty_posting.dm b/voidcrew/modules/bounties/bounty_posting.dm
index 68f9bbe68a7..9da2acf8d26 100644
--- a/voidcrew/modules/bounties/bounty_posting.dm
+++ b/voidcrew/modules/bounties/bounty_posting.dm
@@ -45,7 +45,7 @@
var/datum/weakref/board_proof_ref
/// Weakrefs to GPS units (/datum/component/gps/item) its sighting beacon was uploaded to -> weakref of the ship that linked them
var/list/board_gps_units = list()
- /// The worst capture state (BOUNTY_STATE_*) any body of its criminal reached. A criminal that comes back when its site loads again starts from here: once downed, never full pay; once dead, only proof (12.1).
+ /// BOUNTY_STATE_DEAD once a body of its criminal was dead when its site unloaded: the next load places its proof of death, never a living body again. Otherwise BOUNTY_STATE_FREE.
var/board_worst_state = BOUNTY_STATE_FREE
/// The sighting beacon's tag on those units
var/board_gps_tag
@@ -53,8 +53,6 @@
var/board_next_sighting = 0
/// "[REF(ship)]" -> warrants that ship printed for it (AR-G2)
var/list/board_warrants = list()
- /// Weakrefs to every warrant printed for it, burned when it closes
- var/list/board_printed_warrants = list()
/// Timer deciding, a moment after its criminal was deleted, whether anything is left to turn in
var/board_lost_timer
@@ -284,7 +282,6 @@
claimants.Cut()
board_hunt_started.Cut()
board_clear_gps()
- board_burn_warrants()
// Listeners get the criminal and decoys first: P6 detaches the ones at a trader outpost and walks them out
SEND_SIGNAL(src, COMSIG_BOUNTY_POSTING_CLOSED, reason, winner)
@@ -351,7 +348,7 @@
* so this never touches one being beamed out.
*/
/datum/criminal_bounty/proc/board_remove_mobs(reason, relisting = FALSE)
- var/mob/living/basic/bounty_criminal/criminal = criminal()
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = criminal()
board_detach_criminal()
var/list/extras = list()
for(var/datum/weakref/ref as anything in companions + decoys)
@@ -385,6 +382,12 @@
var/turf/spot = get_turf(leaving)
if(spot && leaving.stat != DEAD)
new /obj/effect/temp_visual/transporter_flash/departure(spot)
+ // Its locked kit goes with it (D3); whatever on it isn't its own (papers, a key, a crew's cuffs, a suit a
+ // crew put on it) stays behind, as at the pad (bounty_return_crew_items(), bounty_suits.dm).
+ if(ishumannpc(leaving) && spot)
+ var/mob/living/carbon/human/npc/body = leaving
+ body.npc_drop_not_gear()
+ bounty_return_crew_items(body, spot)
qdel(leaving)
// ===== RELISTING =====
@@ -486,19 +489,12 @@
return 0
/**
- * Percent paid for a criminal in `state` at the pad that has at some point been as bad as
- * `worst_state` (12.1: once downed, at most the downed share; once dead, the dead share). 0 for a
- * free criminal, which the pad refuses.
+ * Percent paid for a criminal in `state` at the pad: its condition there, nothing it went through on the
+ * way (owner ruling 2026-11-08). 0 for a free criminal, which the pad refuses. The kingpin and kill-only
+ * postings override it.
*/
-/datum/criminal_bounty/proc/board_share_for(state, worst_state)
- var/share = bounty_state_share(state)
- if(!share)
- return 0
- if(worst_state && worst_state != BOUNTY_STATE_FREE)
- var/worst_share = bounty_state_share(worst_state)
- if(worst_share)
- share = min(share, worst_share)
- return share
+/datum/criminal_bounty/proc/board_share_for(state)
+ return bounty_state_share(state)
/**
* What a turn-in at `share` percent pays: list(credits, vouchers). Vouchers come only with the
@@ -626,17 +622,8 @@
warrant.name = "warrant ([record?.name || "unknown"])"
warrant.add_raw_text(board_warrant_text(), advanced_html = TRUE)
warrant.update_appearance()
- board_printed_warrants += WEAKREF(warrant)
return warrant
-/// Burns every warrant printed for it that is still around: a closed bounty's warrant is only litter
-/datum/criminal_bounty/proc/board_burn_warrants()
- for(var/datum/weakref/warrant_ref as anything in board_printed_warrants)
- var/obj/item/paper/bounty_warrant/warrant = warrant_ref?.resolve()
- if(!QDELETED(warrant))
- warrant.burn_up()
- board_printed_warrants.Cut()
-
/// The reward as a poster says it: "1000 cr and 1 trade voucher"
/datum/criminal_bounty/proc/board_reward_text()
return "[value] cr[board_vouchers ? " and [board_vouchers] trade voucher[board_vouchers > 1 ? "s" : ""]" : ""]"
diff --git a/voidcrew/modules/bounties/bounty_restraints.dm b/voidcrew/modules/bounties/bounty_restraints.dm
index 736afda066f..a1eabc81d22 100644
--- a/voidcrew/modules/bounties/bounty_restraints.dm
+++ b/voidcrew/modules/bounties/bounty_restraints.dm
@@ -1,268 +1,137 @@
/**
- * # Bounty hunting: restraints on a criminal
+ * # Bounty hunting: cuffs on a criminal
*
* Owner: P2 body. Do not edit this file outside P2.
*
- * What it owns: cuffing bounty criminals, a port of the prisoner's cuff pattern
- * (outpost_prison_capture.dm) as procs on the criminal (spec sections 4 and 12.3, C1 and C2):
- * - Any tg handcuffs, cable restraints or zipties, used on it by anyone with hands. Only on a criminal
- * that is downed, stunned or has surrendered, over BOUNTY_CUFF_TIME. On one standing free the cuffs
- * are refused, and the try alerts it (P3's on_confronted()).
- * - Restrained, it is held still, throws no punches and fires no shots (may_attack()), plans nothing
- * (TRAIT_BOUNTY_HELD and TRAIT_AI_PAUSED), and can be dragged. A downed one stays down until the
- * cuffs come off.
- * - Anyone takes them off with an empty hand over BOUNTY_UNCUFF_TIME: handcuffs to their hand, cable
- * and zipties cut away.
- * - Cable restraints slip after BOUNTY_CABLE_SLIP and zipties after BOUNTY_ZIPTIE_SLIP (a mini-boss in
- * half the time, and it snaps them), with a visible struggle for the last BOUNTY_SLIP_WARNING.
- * Handcuffs never slip.
- * - The cuffs show as tg's handcuff overlay, stay in its contents, and drop when it dies or is deleted.
- * Cuffing a criminal gives no claim on it: whoever gets it onto their own pad is paid (decision 18).
+ * A criminal is cuffed the way a person is: tg's attempt_to_cuff() (4 seconds, anyone with hands, any
+ * tg handcuffs, cable restraints or zipties), worn in tg's handcuff slot, and taken off the way anyone's
+ * are. A cuffed criminal can walk, as players can; it works at its cuffs through tg's resist (its AI's
+ * escape captivity): a minute for handcuffs, 45 s for zipties, 30 s for cable, and dragging it breaks the
+ * try (defaults 1.4). Its AI plans nothing else while cuffed.
*
- * The shared vars (`restraints` and the rest) are declared in bounty_types.dm and nowhere else; a
- * var only P2 uses goes here, or in bounty_criminal.dm, with a `body_` prefix.
+ * What this file adds:
+ * - The reaction to a reach for its wrists (defaults 1.4, CR-7): while it can still move on its own it
+ * steps away a moment after the cuffing starts, which breaks the cuffer's do_after, and then runs or
+ * fights (on_confronted()). Paralysed after giving up, stamcritted, knocked down or in crit, it can't,
+ * and the cuffs go on. A subtype changes it in body_on_cuff_attempt(); the trader-outpost blend takes
+ * it over through COMSIG_BOUNTY_CUFF_REACHED.
+ * - COMSIG_BOUNTY_CRIMINAL_RESTRAINED and _UNRESTRAINED for the AI packages, from tg's TRAIT_RESTRAINED.
+ * - Fultons never go on (M2, owner question 10): the pad is the only way off its site bar the carry.
+ * Cuffing gives no claim on it: whoever gets it onto their own pad is paid (decision 18).
*/
-// ===== CUFFING =====
+/mob/living/carbon/human/npc/bounty_criminal
+ /// Weakref to whoever last reached for its wrists, and when
+ var/datum/weakref/body_cuffer_ref
+ var/body_cuffed_at = 0
+ /// world.time it last started working at its cuffs (tg's cuff_resist())
+ var/body_working_cuffs_at = 0
+
+/// Hooks tg's cuffing on it. Called once from Initialize(). Cuffs going on and off come through tg's
+/// own TRAIT_RESTRAINED handlers below: a second registration of that signal on itself would replace
+/// tg's, and its hands would stay free in cuffs.
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_hook_cuffs()
+ RegisterSignal(src, COMSIG_CARBON_CUFF_ATTEMPTED, PROC_REF(body_on_cuff_signal))
+ RegisterSignal(src, COMSIG_MOB_REMOVING_CUFFS, PROC_REF(body_on_working_cuffs))
+
+// tg's own TRAIT_RESTRAINED handlers (code/modules/mob/living/init_signals.dm) block its hands. Registering
+// the trait's signals again on itself would replace them, so the body hears the cuffs through them.
+/mob/living/carbon/human/npc/bounty_criminal/on_restrained_trait_gain(datum/source)
+ . = ..()
+ body_on_restrained(source)
+
+/mob/living/carbon/human/npc/bounty_criminal/on_restrained_trait_loss(datum/source)
+ . = ..()
+ body_on_unrestrained(source)
-// Restraints go on from the item interaction, ahead of anything else that item might do to it. A
-// fulton never goes on: the pad is the only way off its site bar the carry (M2, owner question 10).
-/mob/living/basic/bounty_criminal/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
- if(istype(tool, /obj/item/restraints/handcuffs))
- return body_on_cuffs_used(user, tool)
+// A fulton never goes on a criminal (M2).
+/mob/living/carbon/human/npc/bounty_criminal/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(istype(tool, /obj/item/extraction_pack))
balloon_alert(user, "won't hold [p_them()]!")
return ITEM_INTERACT_BLOCKING
return ..()
-/// Why `user` can't put `cuffs` on it now, as a balloon alert, or null if they can
-/mob/living/basic/bounty_criminal/proc/body_cuff_refusal(mob/living/user, obj/item/restraints/handcuffs/cuffs)
- if(stat == DEAD)
- return "can't cuff [p_them()]"
- if(is_restrained())
- return "already cuffed"
- if(istype(cuffs, /obj/item/restraints/handcuffs/cable/zipties/used) || istype(cuffs, /obj/item/restraints/handcuffs/cable/zipties/fake/used))
- return "used up"
- if(user && !iscyborg(user) && user.usable_hands <= 0)
- return "no hands free"
- // Standing and free, it fights or runs; it has to be put down, stunned or talked into giving up first (C2).
- if(capture_state() == BOUNTY_STATE_FREE)
- return "[p_they()] pull[p_s()] away!"
- return null
+// ===== A REACH FOR ITS WRISTS =====
-/// Restraints used on it: refused with a balloon alert (and a free one is alerted), or put on in the background
-/mob/living/basic/bounty_criminal/proc/body_on_cuffs_used(mob/living/user, obj/item/restraints/handcuffs/cuffs)
- var/refusal = body_cuff_work ? "already busy" : body_cuff_refusal(user, cuffs)
- if(refusal)
- balloon_alert(user, refusal)
- // Reaching for its wrists is a confrontation: a meek one bolts, a normal one fights (P3). Blending
- // in, P6's blend component answers for it, the same for the fugitive and its decoys.
- if(!body_cuff_work && !blended && capture_state() == BOUNTY_STATE_FREE)
- body_add_grudge(user)
- INVOKE_ASYNC(src, PROC_REF(on_confronted), user)
- return ITEM_INTERACT_BLOCKING
- INVOKE_ASYNC(src, PROC_REF(body_cuff_by), user, cuffs)
- return ITEM_INTERACT_SUCCESS
+/// tg's attempt_to_cuff() is about to start on it. Never refuses the cuffs: the body answers the way a person would.
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_on_cuff_signal(datum/source, mob/living/user)
+ SIGNAL_HANDLER
+ if(!isliving(user) || user == src || stat == DEAD)
+ return NONE
+ body_cuffer_ref = WEAKREF(user)
+ body_cuffed_at = world.time
+ if(SEND_SIGNAL(src, COMSIG_BOUNTY_CUFF_REACHED, user) & COMPONENT_BOUNTY_CUFF_HANDLED)
+ return NONE
+ body_on_cuff_attempt(user)
+ return NONE
/**
- * `user` puts `cuffs` on it over BOUNTY_CUFF_TIME, with tg's cuff sounds. Fails if it gets up or
- * breaks free meanwhile, or moves away. Returns TRUE if it is restrained. Sleeps.
+ * `user` started cuffing it. While it can still move on its own it puts them on its grudge list and,
+ * a moment into their cuffing, steps away from them (breaking the try) and runs or fights. Override
+ * for a body that answers differently (a man on his sofa, a don who won't be taken alive). Inside the
+ * cuff signal's stack: must not sleep.
*/
-/mob/living/basic/bounty_criminal/proc/body_cuff_by(mob/living/user, obj/item/restraints/handcuffs/cuffs)
- if(body_cuff_work || body_cuff_refusal(user, cuffs))
- return FALSE
- body_cuff_work = TRUE
- user.visible_message(span_danger("[user] is trying to put [cuffs] on [src]!"), span_danger("You try to put [cuffs] on [src]."))
- playsound(src, cuffs.cuffsound, 30, TRUE, -2)
- var/done = do_after(user, BOUNTY_CUFF_TIME, target = src, timed_action_flags = IGNORE_SLOWDOWNS)
- body_cuff_work = FALSE
- if(QDELETED(src))
- return FALSE
- // A borg's cuffs are part of its module: it puts on a new pair of the same kind, as tg's cuffs do for borgs.
- var/dispense = iscyborg(user)
- if(!done || QDELETED(cuffs) || (cuffs.loc != user && !dispense) || body_cuff_refusal(user, cuffs))
- balloon_alert(user, "failed to cuff!")
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_on_cuff_attempt(mob/living/user)
+ if(!body_can_answer_cuffs())
+ return
+ body_add_grudge(user)
+ addtimer(CALLBACK(src, PROC_REF(body_answer_cuffs), WEAKREF(user)), BOUNTY_CUFF_REACTION_DELAY, TIMER_DELETE_ME)
+
+/// Whether it can do anything about a reach for its wrists: awake, on its feet and free to move, not already cuffed, not held or hidden
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_can_answer_cuffs()
+ if(stat != CONSCIOUS || is_restrained() || buckled || hidden || !isturf(loc))
return FALSE
- var/success_sound = cuffs.cuffsuccesssound
- if(!body_apply_cuffs(cuffs, user, dispense))
- balloon_alert(user, "failed to cuff!")
+ if(HAS_TRAIT(src, TRAIT_INCAPACITATED) || HAS_TRAIT(src, TRAIT_IMMOBILIZED) || HAS_TRAIT(src, TRAIT_FLOORED))
return FALSE
- playsound(src, success_sound, 30, TRUE, -2)
- user.visible_message(span_notice("[user] restrains [src] with [restraints]."), span_notice("You restrain [src] with [restraints]."))
- log_combat(user, src, "restrained")
- return TRUE
+ return !(pulledby && pulledby.grab_state >= GRAB_AGGRESSIVE)
-/// What `cuffs` turn into once worn: zipties their used pair, fake zipties their fake used pair (tg gives both the real one), anything else stays itself (null)
-/proc/bounty_worn_cuffs_type(obj/item/restraints/handcuffs/cuffs)
- if(istype(cuffs, /obj/item/restraints/handcuffs/cable/zipties/fake) && !istype(cuffs, /obj/item/restraints/handcuffs/cable/zipties/fake/used))
- return /obj/item/restraints/handcuffs/cable/zipties/fake/used
- return cuffs?.trashtype
+/// A moment after the reach: a step away from `user_ref`'s owner, then its fight or flight (on_confronted()).
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_answer_cuffs(datum/weakref/user_ref)
+ var/mob/living/user = user_ref?.resolve()
+ if(QDELETED(src) || QDELETED(user) || !body_can_answer_cuffs())
+ return
+ body_step_away_from(user)
+ on_confronted(user)
-/**
- * Puts `cuffs` on it at once; zipties become their used pair, as on people. `user`, if any, gives
- * them up from their hands, unless `dispense` (a borg), which puts on a new pair of the same kind
- * instead. Returns TRUE if it is restrained.
- */
-/mob/living/basic/bounty_criminal/proc/body_apply_cuffs(obj/item/restraints/handcuffs/cuffs, mob/living/user, dispense = FALSE)
- if(is_restrained() || QDELETED(cuffs) || stat == DEAD)
+/// One real step directly or diagonally away from `threat`, onto ground its leash allows. Returns TRUE if it moved.
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_step_away_from(atom/threat)
+ var/turf/here = get_turf(src)
+ if(!here || !threat)
return FALSE
- var/obj/item/restraints/handcuffs/worn = cuffs
- var/used_path = bounty_worn_cuffs_type(cuffs)
- if(dispense)
- var/dispensed_path = used_path || cuffs.type
- worn = new dispensed_path(src)
- else
- if(user && !user.temporarilyRemoveItemFromInventory(cuffs))
- return FALSE
- if(used_path)
- worn = new used_path(src)
- qdel(cuffs)
- else
- cuffs.forceMove(src)
- if(QDELETED(worn) || worn.loc != src)
- return FALSE
- restraints = worn
- ADD_TRAIT(src, TRAIT_IMMOBILIZED, BOUNTY_BODY_CUFFS_TRAIT)
- if(pulling)
- stop_pulling()
- ai_controller?.CancelActions()
- body_update_held()
+ var/away = get_dir(threat, src) || pick(GLOB.alldirs)
+ for(var/direction in list(away, turn(away, 45), turn(away, -45), turn(away, 90), turn(away, -90)))
+ var/turf/step_turf = get_step(here, direction)
+ if(!step_turf || step_turf.is_blocked_turf(exclude_mobs = FALSE) || !body_move_allowed(step_turf))
+ continue
+ if(Move(step_turf, direction))
+ return TRUE
+ return FALSE
+
+// ===== CUFFS ON AND OFF =====
+
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_on_working_cuffs(datum/source, obj/item/cuffs)
+ SIGNAL_HANDLER
+ body_working_cuffs_at = world.time
+
+/// Cuffed: the AI packages hear who did it (whoever last reached for its wrists, if it was lately)
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_on_restrained(datum/source)
+ SIGNAL_HANDLER
+ if(stat == DEAD || QDELING(src))
+ return
+ var/mob/living/user = body_cuffer_ref?.resolve()
+ if(world.time > body_cuffed_at + 30 SECONDS)
+ user = null
if(user)
body_add_grudge(user)
- body_start_slip()
- update_appearance(UPDATE_OVERLAYS)
body_state_changed()
SEND_SIGNAL(src, COMSIG_BOUNTY_CRIMINAL_RESTRAINED, user)
- // Forced: the cuffs go on 2 s after a downing or a stun, well inside the cooldown of what they said then (BUG-1).
- if(stat == CONSCIOUS)
- INVOKE_ASYNC(src, TYPE_PROC_REF(/mob/living, bounty_say), "cuffed", null, TRUE)
- return TRUE
-// ===== UNCUFFING =====
-
-// An empty, open hand on a restrained criminal starts taking the restraints off.
-/mob/living/basic/bounty_criminal/attack_hand(mob/living/carbon/human/user, list/modifiers)
- if(is_restrained() && stat != DEAD && !user.combat_mode && !LAZYACCESS(modifiers, RIGHT_CLICK))
- INVOKE_ASYNC(src, PROC_REF(body_uncuff_by), user)
- return TRUE
- return ..()
-
-/// `user` takes its restraints off over BOUNTY_UNCUFF_TIME. Returns TRUE if they came off. Sleeps.
-/mob/living/basic/bounty_criminal/proc/body_uncuff_by(mob/living/user)
- if(!is_restrained() || body_cuff_work)
- return FALSE
- body_cuff_work = TRUE
- user.visible_message(span_notice("[user] starts taking [restraints] off [src]."), span_notice("You start taking [restraints] off [src]."))
- var/done = do_after(user, BOUNTY_UNCUFF_TIME, target = src)
- body_cuff_work = FALSE
- if(!done || QDELETED(src) || !is_restrained())
- return FALSE
- var/cut = istype(restraints, /obj/item/restraints/handcuffs/cable)
- user.visible_message(span_notice("[user] [cut ? "cuts" : "takes"] [restraints] off [src]."), span_notice("You [cut ? "cut" : "take"] [restraints] off [src]."))
- body_remove_cuffs(user)
- return TRUE
-
-/**
- * Takes its restraints off. With `user`, handcuffs go to their hands (or the floor) and cable and
- * zipties are cut away; without, the restraints drop where it is. Returns the restraints still about,
- * or null.
- */
-/mob/living/basic/bounty_criminal/proc/body_remove_cuffs(mob/living/user)
- var/obj/item/restraints/handcuffs/worn = restraints
- if(!worn)
- return null
- // Cleared first, so Exited() leaves the rest to this proc.
- restraints = null
- var/atom/drop_spot = drop_location()
- if(QDELETED(worn))
- worn = null
- else if((user && istype(worn, /obj/item/restraints/handcuffs/cable)) || !drop_spot)
- qdel(worn)
- worn = null
- else
- worn.forceMove(drop_spot)
- if(user)
- user.put_in_hands(worn)
- body_uncuffed(user)
- return worn
-
-/// Its restraints are off, however they came off: it can move and act again, and a downed one whose recovery came due starts getting up
-/mob/living/basic/bounty_criminal/proc/body_uncuffed(mob/living/user)
- REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, BOUNTY_BODY_CUFFS_TRAIT)
- body_stop_slip()
- if(QDELETED(src))
+/// Out of its cuffs: the AI packages hear whether it got itself out (null) or someone took them off (src: who isn't known)
+/mob/living/carbon/human/npc/bounty_criminal/proc/body_on_unrestrained(datum/source)
+ SIGNAL_HANDLER
+ if(stat == DEAD || QDELING(src))
return
- body_update_held()
- update_appearance(UPDATE_OVERLAYS)
+ var/self_freed = body_working_cuffs_at && world.time <= body_working_cuffs_at + BOUNTY_SELF_FREED_WINDOW
+ body_working_cuffs_at = 0
body_state_changed()
- SEND_SIGNAL(src, COMSIG_BOUNTY_CRIMINAL_UNRESTRAINED, user)
- if(downed && body_recovery_due && stat != DEAD)
- body_recovery_due = FALSE
- deltimer(body_recovery_timer)
- body_stir()
-
-/mob/living/basic/bounty_criminal/Exited(atom/movable/gone, direction)
- . = ..()
- if(gone == restraints)
- // Taken or destroyed some other way than body_remove_cuffs()
- restraints = null
- body_uncuffed(null)
-
-// ===== SLIPPING =====
-
-/// How long its restraints hold before it slips them: cable, zipties or joke cuffs; a mini-boss in half the time; 0 for handcuffs, which never slip
-/mob/living/basic/bounty_criminal/proc/body_slip_time()
- if(!is_restrained())
- return 0
- var/time
- if(istype(restraints, /obj/item/restraints/handcuffs/fake) || istype(restraints, /obj/item/restraints/handcuffs/cable/zipties/fake))
- time = BOUNTY_FAKE_CUFF_SLIP
- else if(istype(restraints, /obj/item/restraints/handcuffs/cable/zipties))
- time = BOUNTY_ZIPTIE_SLIP
- else if(istype(restraints, /obj/item/restraints/handcuffs/cable))
- time = BOUNTY_CABLE_SLIP
- else
- return 0
- if(istype(src, /mob/living/basic/bounty_criminal/boss))
- time *= BOUNTY_BOSS_SLIP_MULT
- return time
-
-/// Starts the clock on its restraints slipping, if they ever do
-/mob/living/basic/bounty_criminal/proc/body_start_slip()
- body_stop_slip()
- var/time = body_slip_time()
- if(time <= 0)
- return
- body_slip_warn_timer = addtimer(CALLBACK(src, PROC_REF(body_slip_warning)), max(0, time - BOUNTY_SLIP_WARNING), TIMER_STOPPABLE | TIMER_DELETE_ME)
- body_slip_timer = addtimer(CALLBACK(src, PROC_REF(body_slip_cuffs)), time, TIMER_STOPPABLE | TIMER_DELETE_ME)
-
-/// Stops the slipping clock
-/mob/living/basic/bounty_criminal/proc/body_stop_slip()
- deltimer(body_slip_warn_timer)
- deltimer(body_slip_timer)
- body_slip_warn_timer = null
- body_slip_timer = null
-
-/// The visible struggle before it slips its restraints
-/mob/living/basic/bounty_criminal/proc/body_slip_warning()
- body_slip_warn_timer = null
- if(!is_restrained() || stat == DEAD)
- return
- if(istype(src, /mob/living/basic/bounty_criminal/boss))
- visible_message(span_warning("[src] strains against [restraints]."))
- else
- visible_message(span_warning("[src] is working at [restraints]."))
- INVOKE_ASYNC(src, TYPE_PROC_REF(/mob/living, bounty_say), "slipping_cuffs")
-
-/// Out of its restraints: a mini-boss snaps them, anyone else slips them and they drop. Returns TRUE if they came off.
-/mob/living/basic/bounty_criminal/proc/body_slip_cuffs()
- body_slip_timer = null
- if(!is_restrained() || stat == DEAD)
- return FALSE
- var/snapped = istype(src, /mob/living/basic/bounty_criminal/boss)
- var/message = snapped ? "[src] snaps [restraints]!" : "[src] slips out of [restraints]!"
- visible_message(span_danger(message))
- var/obj/item/restraints/handcuffs/worn = body_remove_cuffs()
- if(snapped && worn)
- qdel(worn)
- return TRUE
+ SEND_SIGNAL(src, COMSIG_BOUNTY_CRIMINAL_UNRESTRAINED, self_freed ? null : src)
diff --git a/voidcrew/modules/bounties/bounty_styles.dm b/voidcrew/modules/bounties/bounty_styles.dm
new file mode 100644
index 00000000000..d8e81df3fd2
--- /dev/null
+++ b/voidcrew/modules/bounties/bounty_styles.dm
@@ -0,0 +1,900 @@
+/**
+ * # Bounty hunting: fighting styles, with real weapons
+ *
+ * Owner: P3 AI. Do not edit this file outside P3.
+ *
+ * How a criminal or a companion fights (combat.md 6.2, defaults CR-13). Every style is a real item the
+ * fighter carries, puts in its hand when the fight starts, and uses the way a player does, through
+ * controller.ai_interact() (a click):
+ * - brawler: fists, and now and then a real shove (a right click);
+ * - knife: a knife from a pocket (Wanted and above: a combat knife). Its cuts and bleeding are the
+ * knife's own;
+ * - club: a baseball bat in hand (Wanted and above: the metal bat). It knocks people back as tg's bat does;
+ * - pistol: a Stechkin from a shoulder holster, set to single shots with its own fire selector, a spare
+ * magazine in a pocket, reloaded the player's way. Strings of BOUNTY_PISTOL_STRING_SHOTS, then a pause;
+ * - shotgun: a pump shotgun on the back with buckshot (Wanted and above: a semi-automatic combat
+ * shotgun), shells on a bandolier, loaded into the tube shell by shell;
+ * - SMG: a WT-550 worn on the belt at every tier, a spare magazine in a pocket. A burst is
+ * BOUNTY_SMG_BURST separate trigger pulls at the gun's own full-auto rate, so it stops the moment
+ * they can't shoot or the target is gone;
+ * - revolver: a .38 in a shoulder holster, a speedloader in a pocket. A dry cylinder is reloaded the
+ * player's way: the speedloader clicked into it pushes the spent casings out;
+ * - bottle: beer bottles from a satchel, thrown one at a time with a real throw (tg's bottle smashes on
+ * whoever it hits); out of bottles, they fight with their fists;
+ * - holdout: a meek criminal's little Makarov, a pocket gun, and a spare magazine in a fanny pack (the
+ * cornered volley in bounty_ai_meek.dm).
+ * Nothing is spawned for the fight, no projectile comes from the body, and nothing passes through
+ * anyone: before a shot or a throw the fighter checks its line and steps aside for anyone it may not
+ * hit (bounty_ai_line_blocked()). The style sets only the timing: how often they pull the trigger or
+ * throw, the telegraph before it (a hit during it fumbles the attack), the reload, and the distance they
+ * keep. Gear is locked to the body (D3): it never drops and is never loot; bottles are consumables, so a
+ * thrown one leaves the hand and breaks.
+ *
+ * A gun that comes out of its holster, off their back or out of a bag at the start of a fight comes
+ * with a line and the holster's sound, and the draw is the telegraph for the first shot: at least
+ * BOUNTY_DRAW_TIME after it, fumbled by a hit in between (/datum/ai_behavior/human_npc_draw/bounty).
+ */
+
+/// Every fighting style by key (BOUNTY_STYLE_*), one datum each
+GLOBAL_LIST_INIT(bounty_styles, init_bounty_styles())
+
+/proc/init_bounty_styles()
+ var/list/styles = list()
+ for(var/datum/bounty_style/style_type as anything in subtypesof(/datum/bounty_style))
+ var/datum/bounty_style/style = new style_type
+ if(style.key)
+ styles[style.key] = style
+ return styles
+
+/// A fighter's style: from its controller's blackboard
+/proc/bounty_ai_style(mob/living/fighter)
+ var/datum/ai_controller/controller = fighter?.ai_controller
+ if(QDELETED(controller))
+ return null
+ return GLOB.bounty_styles[controller.blackboard[BB_BOUNTY_STYLE]]
+
+/// Puts style `key` on `fighter`'s AI. Its weapon is whatever it was dressed with (bounty_build_outfit()).
+/proc/bounty_ai_apply_style(mob/living/fighter, key)
+ var/datum/bounty_style/style = GLOB.bounty_styles[key]
+ var/datum/ai_controller/controller = fighter?.ai_controller
+ if(!style || QDELETED(controller))
+ return FALSE
+ controller.set_blackboard_key(BB_BOUNTY_STYLE, key)
+ bounty_ai_clear_windup(controller)
+ controller.clear_blackboard_key(BB_BOUNTY_BURST_LEFT)
+ return TRUE
+
+/// Whether style `key` (BOUNTY_STYLE_*) fights with a gun
+/proc/bounty_style_is_gun(key)
+ var/datum/bounty_style/style = GLOB.bounty_styles[key]
+ return !!style && ispath(style.weapon, /obj/item/gun)
+
+/// Whether a pawn is in a fight it can take part in: a criminal fighting, or a companion that has not broken
+/proc/bounty_ai_fighting(mob/living/fighter)
+ if(istype(fighter, /mob/living/carbon/human/npc/bounty_criminal))
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = fighter
+ return criminal.ai_mode == BOUNTY_AI_FIGHTING && criminal.ai_can_act()
+ if(istype(fighter, /mob/living/carbon/human/npc/bounty_companion))
+ var/mob/living/carbon/human/npc/bounty_companion/companion = fighter
+ return companion.ai_can_fight()
+ return FALSE
+
+/// Puts the weapons in `body`'s hands away on its body (the human NPC base's npc_stow_weapons()): a holster, a pocket, a back. What has nowhere to go stays in hand.
+/proc/bounty_ai_holster(mob/living/carbon/human/npc/body)
+ if(!ishumannpc(body) || HAS_TRAIT(body, TRAIT_HANDS_BLOCKED))
+ return
+ body.npc_stow_weapons()
+
+/// The first `item_type` that `body` carries and can take in hand in a moment (held, worn, in a bag or pouch it wears), or null
+/proc/bounty_ai_carried(mob/living/carbon/body, item_type)
+ if(!ispath(item_type))
+ return null
+ for(var/obj/item/thing as anything in body.get_all_contents_type(item_type))
+ if(body.is_holding(thing) || human_npc_can_draw(body, thing))
+ return thing
+ return null
+
+/// Whether `gun` fires on the next pull, or would after the pump its style's telegraph works (`pumps`)
+/proc/bounty_ai_gun_ready(obj/item/gun/gun, pumps = FALSE)
+ if(!istype(gun))
+ return FALSE
+ if(gun.can_shoot())
+ return TRUE
+ var/obj/item/gun/ballistic/ballistic = gun
+ return pumps && istype(ballistic) && human_npc_gun_needs_rack(ballistic)
+
+/// Live rounds in a ballistic gun: its magazine (a revolver's cylinder holds its chamber) and a chambered round. Null for anything else.
+/proc/bounty_gun_live_rounds(obj/item/gun/ballistic/gun)
+ if(!istype(gun))
+ return null
+ . = gun.magazine ? human_npc_live_rounds(gun.magazine) : 0
+ if(gun.chambered?.loaded_projectile && (!gun.magazine || !(gun.chambered in gun.magazine.stored_ammo)))
+ .++
+
+/**
+ * Sets `gun` to single shots with its own fire selector, the way `user` would: their fire-mode button
+ * on the gun, or the selector itself while the button isn't theirs. A Stechkin fires three-round
+ * bursts until it is switched. Returns TRUE if the gun fires one round a pull now.
+ */
+/proc/bounty_gun_single_fire(mob/living/user, obj/item/gun/ballistic/gun)
+ if(!istype(gun))
+ return FALSE
+ if(gun.burst_size <= 1)
+ return TRUE
+ // A gun with no selector only fires its burst
+ if(!gun.burst_fire_selection)
+ return FALSE
+ // The selector's click and its note go to whoever flips it, not to whoever's turn it is
+ var/mob/old_usr = usr
+ usr = user
+ for(var/datum/action/item_action/toggle_firemode/selector in gun.actions)
+ if(selector.owner == user)
+ selector.Trigger(user)
+ break
+ if(gun.burst_size > 1 && gun.burst_fire_selection)
+ gun.burst_select()
+ usr = old_usr
+ return gun.burst_size <= 1
+
+/**
+ * Counts a shot just fired from `gun` towards a string of `string_length` on `controller`'s blackboard. A
+ * new magazine (a reload) starts the count again. TRUE when the shot ends a string with rounds still in
+ * the gun; an empty one is reloaded instead.
+ */
+/proc/bounty_ai_string_done(datum/ai_controller/controller, obj/item/gun/ballistic/gun, string_length)
+ if(!istype(gun) || string_length <= 0 || !gun.magazine)
+ return FALSE
+ var/shots = 1
+ if(controller.blackboard[BB_BOUNTY_STRING_MAGAZINE] == gun.magazine)
+ shots += controller.blackboard[BB_BOUNTY_STRING_SHOTS]
+ else
+ controller.set_blackboard_key(BB_BOUNTY_STRING_MAGAZINE, gun.magazine)
+ if(shots >= string_length && bounty_gun_live_rounds(gun) > 0)
+ controller.set_blackboard_key(BB_BOUNTY_STRING_SHOTS, 0)
+ return TRUE
+ controller.set_blackboard_key(BB_BOUNTY_STRING_SHOTS, shots)
+ return FALSE
+
+/// Empties the hand that isn't holding `keep`, for a gun that needs both: puts what's there away, and lets go of a spent shell or a spent magazine
+/proc/bounty_ai_free_other_hand(mob/living/carbon/body, obj/item/keep)
+ for(var/obj/item/held in body.held_items)
+ if(held == keep)
+ continue
+ if((isammocasing(held) || istype(held, /obj/item/ammo_box)) && !human_npc_live_rounds(held))
+ body.dropItemToGround(held)
+ continue
+ if(!held.equip_to_best_slot(body))
+ body.dropItemToGround(held)
+ return length(body.get_empty_held_indexes()) > 0
+
+/**
+ * Whether someone `shooter` may not hit stands in its line of fire to `target`: one of its own gang, its
+ * own side of the site (the crew it is aboard with), or a bystander it has no quarrel with. Shots and
+ * throws pass over anyone lying down. This is the whole of friendly fire: nothing it fires passes
+ * through anyone.
+ */
+/proc/bounty_ai_line_blocked(mob/living/shooter, atom/target)
+ var/turf/start = get_turf(shooter)
+ var/turf/end = get_turf(target)
+ if(!start || !end)
+ return FALSE
+ for(var/turf/line_turf as anything in get_line(start, end))
+ if(line_turf == start || line_turf == end)
+ continue
+ for(var/mob/living/other in line_turf)
+ if(other == shooter || other.stat == DEAD || other.body_position == LYING_DOWN)
+ continue
+ if(shooter.faction_check_atom(other) || !bounty_ai_may_hit(shooter, other))
+ return TRUE
+ return FALSE
+
+/// One step sideways for a clear line to `target`, no further from them, on the leash
+/proc/bounty_ai_sidestep(mob/living/fighter, atom/target)
+ var/turf/here = get_turf(fighter)
+ if(!here || !isturf(fighter.loc))
+ return FALSE
+ var/list/options = list()
+ for(var/direction in GLOB.alldirs)
+ var/turf/next = get_step(here, direction)
+ if(!next || get_dist(next, target) > get_dist(here, target) || !next.can_cross_safely(fighter))
+ continue
+ options += next
+ shuffle_inplace(options)
+ for(var/turf/next as anything in options)
+ if(bounty_ai_step(fighter, next))
+ return TRUE
+ return FALSE
+
+/// A step straight back from `target`, now and then, on the leash
+/proc/bounty_ai_back_off(datum/ai_controller/controller, mob/living/fighter, atom/target)
+ if(world.time < controller.blackboard[BB_BOUNTY_BACKSTEP_AT] || !isturf(fighter.loc))
+ return FALSE
+ controller.set_blackboard_key(BB_BOUNTY_BACKSTEP_AT, world.time + BOUNTY_BACKSTEP_GAP)
+ var/away_dir = get_dir(target, fighter)
+ var/turf/away = away_dir && get_step(fighter, away_dir)
+ if(!away || !bounty_ai_step(fighter, away))
+ return FALSE
+ fighter.face_atom(target)
+ return TRUE
+
+/// Forgets a wind-up in progress
+/proc/bounty_ai_clear_windup(datum/ai_controller/controller)
+ controller.clear_blackboard_key(BB_BOUNTY_WINDUP_UNTIL)
+ controller.clear_blackboard_key(BB_BOUNTY_WINDUP_FROM)
+ controller.clear_blackboard_key(BB_BOUNTY_WINDUP_STAMINA)
+
+// ===== THE STYLES =====
+
+/**
+ * How someone fights. Criminals, companions and the meek's holdout share these. The style puts a real
+ * weapon (and its spares) on the outfit they are dressed in, and sets how they use it; what the weapon
+ * does is the weapon's.
+ */
+/datum/bounty_style
+ /// BOUNTY_STYLE_*
+ var/key
+ /// Fights at range: a gun, or something thrown
+ var/ranged = FALSE
+ /// What they carry, by tier: Petty, and Wanted or above (null for bare fists)
+ var/weapon
+ var/heavy_weapon
+ /// What counts as their style's weapon when they look for it on themselves
+ var/weapon_type
+ /// The behaviour that keeps this style's distance while it shoots or throws
+ var/ranged_behavior = /datum/ai_behavior/bounty_shoot
+ /// Anyone closer than this and they step back (0: never)
+ var/min_range = 0
+ /// Between trigger pulls or throws
+ var/interval = 1 SECONDS
+ /// The telegraph before a shot or a throw, and what it says and sounds like
+ var/windup = 0
+ var/windup_message
+ var/windup_sound
+ /// The telegraph works a pump: a spent shell in the chamber doesn't need a reload
+ var/pumps = FALSE
+ /// Only the first shot of a string needs the telegraph (the gun raised, the hammer back); the draw counts as one
+ var/windup_per_string = FALSE
+ /// Chance a blow is a shove instead
+ var/shove_chance = 0
+ /// A gun kept in a holster, on the back or in a bag until a fight: what people see as it comes out (on_drawn())
+ var/draw_message
+ /// The gun is set to single shots with its own fire selector before it fires
+ var/single_fire = FALSE
+ /// Trigger pulls in one burst, burst_gap apart (1: a pull at a time). Each pull is its own step of bounty_shoot.
+ var/burst = 1
+ var/burst_gap = 0
+ /// Shots in a string, then string_pause on top of the interval before the next (0: no strings)
+ var/string_shots = 0
+ var/string_pause = 0
+ /// Its weapon goes where nobody sees it while they pass as a customer: a pocket, a holster or a bag under
+ /// a coat (decoys wear the same holster or bag, outpost_match_kit()). A gun on the belt or the back, or
+ /// a bat in hand, gives them away, so a trader-outpost fugitive never fights this way (bounty_roll_style()).
+ var/concealable = TRUE
+
+/**
+ * Puts this style's weapon and spares on `outfit` (an instance), the heavier weapon if `heavy`. The
+ * weapon is carried (a holster, a pocket, the back, a bag) unless it has nowhere to go on a body.
+ */
+/datum/bounty_style/proc/equip(datum/outfit/outfit, heavy = FALSE)
+ return
+
+/// The weapon this style carries at `heavy`
+/datum/bounty_style/proc/weapon_for(heavy)
+ return (heavy && heavy_weapon) || weapon
+
+/// Trigger pulls in one burst for `fighter`
+/datum/bounty_style/proc/burst_length(mob/living/carbon/fighter)
+ return burst
+
+/// Shots in one string for `fighter`, 0 for none
+/datum/bounty_style/proc/string_length(mob/living/carbon/fighter)
+ return string_shots
+
+/// Whether a burst is under way. One whose next pull is long overdue was cut off (the AI stopped meanwhile), and is forgotten.
+/datum/bounty_style/proc/burst_under_way(datum/ai_controller/controller)
+ if(!controller.blackboard[BB_BOUNTY_BURST_LEFT])
+ return FALSE
+ if(world.time > controller.blackboard[BB_BOUNTY_NEXT_SHOT] + BOUNTY_BURST_STALE)
+ end_burst(controller)
+ return FALSE
+ return TRUE
+
+/// Whatever is left of a burst never fires: the next one starts with its own telegraph
+/datum/bounty_style/proc/end_burst(datum/ai_controller/controller)
+ controller.clear_blackboard_key(BB_BOUNTY_BURST_LEFT)
+
+/**
+ * `weapon`, this style's own, just came into `fighter`'s hand out of `drawn_from` (a holster, a bag, or
+ * the body itself for a slot). The selector is set, and a gun that was put away comes out with the
+ * line and the holster's sound: the draw is the telegraph for the first shot, BOUNTY_DRAW_TIME later,
+ * and a hit in between fumbles it.
+ */
+/datum/bounty_style/proc/on_drawn(mob/living/carbon/fighter, datum/ai_controller/controller, obj/item/weapon, atom/drawn_from)
+ if(single_fire)
+ bounty_gun_single_fire(fighter, weapon)
+ if(!draw_message)
+ return
+ var/now = world.time
+ end_burst(controller)
+ controller.set_blackboard_key(BB_BOUNTY_DRAWN_AT, now)
+ controller.set_blackboard_key(BB_BOUNTY_NEXT_SHOT, now + BOUNTY_DRAW_TIME)
+ controller.set_blackboard_key(BB_BOUNTY_WINDUP_UNTIL, now + BOUNTY_DRAW_TIME)
+ controller.set_blackboard_key(BB_BOUNTY_WINDUP_FROM, now)
+ controller.set_blackboard_key(BB_BOUNTY_WINDUP_STAMINA, fighter.getStaminaLoss())
+ var/atom/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
+ if(target)
+ fighter.face_atom(target)
+ fighter.visible_message(span_warning(replacetext(draw_message, "%USER", "[fighter]")), vision_distance = COMBAT_MESSAGE_RANGE)
+ var/obj/item/container = drawn_from
+ var/open_sound = istype(container) ? container.atom_storage?.open_sound : null
+ if(open_sound)
+ playsound(fighter, open_sound, 50, TRUE)
+
+/// The ranged weapon in `fighter`'s hand that is ready to use, or null: a loaded (or pumpable) gun, a bottle
+/datum/bounty_style/proc/ready_in_hand(mob/living/carbon/fighter)
+ if(!ranged)
+ return null
+ for(var/obj/item/gun/gun in fighter.held_items)
+ if(bounty_ai_gun_ready(gun, pumps))
+ return gun
+ return null
+
+/// A ranged weapon of this style `fighter` carries that is worth drawing (one that fires, or that it can load), or null
+/datum/bounty_style/proc/carried_ranged(mob/living/carbon/fighter)
+ if(!ranged || !weapon_type)
+ return null
+ for(var/obj/item/gun/gun in fighter.get_all_contents_type(weapon_type))
+ if(fighter.is_holding(gun) || !human_npc_can_draw(fighter, gun))
+ continue
+ if(bounty_ai_gun_ready(gun, pumps) || human_npc_can_reload(fighter, gun))
+ return gun
+ return null
+
+/// Whether this shot needs the telegraph first
+/datum/bounty_style/proc/needs_windup(datum/ai_controller/controller)
+ if(windup <= 0)
+ return FALSE
+ if(!windup_per_string)
+ return TRUE
+ // Raised by the last shot, or by the draw, recently enough: the string goes on
+ var/raised_at = max(controller.blackboard[BB_BOUNTY_LAST_SHOT], controller.blackboard[BB_BOUNTY_DRAWN_AT])
+ return !raised_at || world.time - raised_at > BOUNTY_PISTOL_STRING_GAP
+
+/// The telegraph: what they say, show and sound like before the shot
+/datum/bounty_style/proc/telegraph(mob/living/carbon/fighter, atom/target, obj/item/weapon)
+ fighter.face_atom(target)
+ if(windup_message)
+ fighter.visible_message(span_warning(replacetext(windup_message, "%USER", "[fighter]")))
+ if(windup_sound)
+ playsound(fighter, windup_sound, 50, TRUE)
+
+/**
+ * One step of a telegraphed attack. Returns TRUE when the attack goes now. Otherwise it is winding
+ * up (the telegraph is shown at the start), or the wind-up just ended in a fumble: any hit taken during
+ * it (damage, or more stamina loss) spoils the attack, and they try again a moment later.
+ */
+/datum/bounty_style/proc/windup_step(mob/living/carbon/fighter, datum/ai_controller/controller, atom/target, obj/item/weapon)
+ var/now = world.time
+ var/until = controller.blackboard[BB_BOUNTY_WINDUP_UNTIL]
+ if(until && now > until + BOUNTY_WINDUP_STALE)
+ // Left over from an interrupted fight: it has to be done again
+ bounty_ai_clear_windup(controller)
+ until = null
+ if(!until)
+ if(!needs_windup(controller))
+ return TRUE
+ controller.set_blackboard_key(BB_BOUNTY_WINDUP_UNTIL, now + windup)
+ controller.set_blackboard_key(BB_BOUNTY_WINDUP_FROM, now)
+ controller.set_blackboard_key(BB_BOUNTY_WINDUP_STAMINA, fighter.getStaminaLoss())
+ telegraph(fighter, target, weapon)
+ return FALSE
+ if(now < until)
+ fighter.face_atom(target)
+ return FALSE
+ var/hit_at = controller.blackboard[BB_BOUNTY_HIT_AT]
+ var/fumbled = (hit_at && hit_at >= controller.blackboard[BB_BOUNTY_WINDUP_FROM]) || fighter.getStaminaLoss() > controller.blackboard[BB_BOUNTY_WINDUP_STAMINA] + 1
+ bounty_ai_clear_windup(controller)
+ if(fumbled)
+ fighter.visible_message(span_notice("[fighter] fumbles [weapon]!"))
+ controller.set_blackboard_key(BB_BOUNTY_NEXT_SHOT, now + BOUNTY_FUMBLE_PAUSE)
+ return FALSE
+ return TRUE
+
+/**
+ * The attack itself, with `weapon` in hand: a trigger pull at `target`, the player's way. Returns TRUE
+ * if it went.
+ */
+/datum/bounty_style/proc/attack(mob/living/carbon/fighter, datum/ai_controller/controller, atom/target, obj/item/weapon)
+ var/obj/item/gun/gun = weapon
+ if(!istype(gun))
+ return FALSE
+ if(gun.weapon_weight == WEAPON_HEAVY)
+ bounty_ai_free_other_hand(fighter, gun)
+ if(!human_npc_ready_item(fighter, gun))
+ return FALSE
+ if(single_fire)
+ bounty_gun_single_fire(fighter, gun)
+ fighter.zone_selected = human_npc_pick_aim_zone()
+ var/rounds = bounty_gun_live_rounds(gun)
+ if(!controller.ai_interact(target = target, combat_mode = TRUE))
+ return FALSE
+ // Only a round that went counts: a click the gun refused (its fire delay, an empty chamber) is no shot
+ return isnull(rounds) || bounty_gun_live_rounds(gun) < rounds
+
+/**
+ * One pull of the trigger (or one throw) at `target`, then the clock for the next: the burst's next
+ * pull burst_gap away while one is under way, else the style's interval, with string_pause on top after
+ * the last shot of a string. Returns TRUE if a round went.
+ */
+/datum/bounty_style/proc/pull(mob/living/carbon/fighter, datum/ai_controller/controller, atom/target, obj/item/weapon)
+ var/fired = attack(fighter, controller, target, weapon)
+ var/now = world.time
+ if(fired)
+ controller.set_blackboard_key(BB_BOUNTY_LAST_SHOT, now)
+ var/pulls = burst_length(fighter)
+ if(fired && pulls > 1)
+ var/left = (controller.blackboard[BB_BOUNTY_BURST_LEFT] || pulls) - 1
+ if(left > 0 && ready_in_hand(fighter))
+ controller.set_blackboard_key(BB_BOUNTY_BURST_LEFT, left)
+ controller.set_blackboard_key(BB_BOUNTY_NEXT_SHOT, now + burst_gap)
+ return TRUE
+ end_burst(controller)
+ var/next = now + interval
+ if(fired && bounty_ai_string_done(controller, weapon, string_length(fighter)))
+ next += string_pause
+ controller.set_blackboard_key(BB_BOUNTY_NEXT_SHOT, next)
+ return fired
+
+/// Bare fists: a person's punch, and now and then a shove
+/datum/bounty_style/brawler
+ key = BOUNTY_STYLE_BRAWLER
+ shove_chance = BOUNTY_BRAWLER_SHOVE_CHANCE
+
+/// A knife in a pocket. Its cuts bleed, as a real one's do.
+/datum/bounty_style/knife
+ key = BOUNTY_STYLE_KNIFE
+ weapon = /obj/item/knife
+ heavy_weapon = /obj/item/knife/combat
+ weapon_type = /obj/item/knife
+
+/datum/bounty_style/knife/equip(datum/outfit/outfit, heavy = FALSE)
+ bounty_outfit_carry(outfit, weapon_for(heavy))
+
+/// A baseball bat. A bat has no slot to go in on a body, so it is in hand from the start.
+/datum/bounty_style/club
+ key = BOUNTY_STYLE_CLUB
+ weapon = /obj/item/melee/baseball_bat
+ heavy_weapon = /obj/item/melee/baseball_bat/ablative
+ weapon_type = /obj/item/melee/baseball_bat
+ concealable = FALSE
+
+/datum/bounty_style/club/equip(datum/outfit/outfit, heavy = FALSE)
+ outfit.r_hand = weapon_for(heavy)
+
+/// A Stechkin in a shoulder holster, a spare magazine in a pocket: single shots twice a second, in strings
+/datum/bounty_style/pistol
+ key = BOUNTY_STYLE_PISTOL
+ ranged = TRUE
+ weapon = /obj/item/gun/ballistic/automatic/pistol/aps
+ weapon_type = /obj/item/gun/ballistic/automatic/pistol/aps
+ interval = BOUNTY_PISTOL_INTERVAL
+ min_range = BOUNTY_PISTOL_MIN_RANGE
+ windup = BOUNTY_PISTOL_WINDUP
+ windup_per_string = TRUE
+ windup_message = "%USER raises a pistol."
+ windup_sound = 'sound/items/weapons/gun/pistol/rack_small.ogg'
+ draw_message = "%USER pulls out a pistol!"
+ single_fire = TRUE
+ string_shots = BOUNTY_PISTOL_STRING_SHOTS
+ string_pause = BOUNTY_PISTOL_STRING_PAUSE
+
+/datum/bounty_style/pistol/equip(datum/outfit/outfit, heavy = FALSE)
+ var/obj/item/gun/ballistic/gun_type = weapon_for(heavy)
+ outfit.belt = /obj/item/storage/belt/holster
+ outfit.belt_contents = null
+ LAZYADDASSOC(outfit.belt_contents, gun_type, 1)
+ bounty_outfit_carry(outfit, initial(gun_type.accepted_magazine_type))
+
+/**
+ * A WT-550 worn on the belt, at every tier, and a spare magazine in a pocket. Brought up level before
+ * each burst; a burst is BOUNTY_SMG_BURST trigger pulls at the gun's own full-auto rate.
+ */
+/datum/bounty_style/smg
+ key = BOUNTY_STYLE_SMG
+ ranged = TRUE
+ weapon = /obj/item/gun/ballistic/automatic/wt550
+ weapon_type = /obj/item/gun/ballistic/automatic/wt550
+ interval = BOUNTY_SMG_INTERVAL
+ min_range = BOUNTY_SMG_MIN_RANGE
+ windup = BOUNTY_SMG_WINDUP
+ windup_sound = 'sound/items/weapons/gun/smg/smgrack.ogg'
+ draw_message = "%USER pulls out an SMG!"
+ burst = BOUNTY_SMG_BURST
+ burst_gap = BOUNTY_SMG_BURST_GAP
+ concealable = FALSE
+
+/datum/bounty_style/smg/equip(datum/outfit/outfit, heavy = FALSE)
+ var/obj/item/gun/ballistic/gun_type = weapon_for(heavy)
+ outfit.belt = gun_type
+ outfit.belt_contents = null
+ bounty_outfit_carry(outfit, initial(gun_type.accepted_magazine_type))
+
+/// A .38 revolver in a shoulder holster, a speedloader in a pocket: one heavy shot a second
+/datum/bounty_style/revolver
+ key = BOUNTY_STYLE_REVOLVER
+ ranged = TRUE
+ weapon = /obj/item/gun/ballistic/revolver/c38
+ weapon_type = /obj/item/gun/ballistic/revolver/c38
+ interval = BOUNTY_REVOLVER_INTERVAL
+ min_range = BOUNTY_REVOLVER_MIN_RANGE
+ windup = BOUNTY_REVOLVER_WINDUP
+ windup_per_string = TRUE
+ windup_message = "%USER thumbs back the hammer."
+ windup_sound = 'sound/items/weapons/gun/general/ballistic_click.ogg'
+ draw_message = "%USER pulls out a revolver!"
+
+/datum/bounty_style/revolver/equip(datum/outfit/outfit, heavy = FALSE)
+ outfit.belt = /obj/item/storage/belt/holster
+ outfit.belt_contents = null
+ LAZYADDASSOC(outfit.belt_contents, weapon_for(heavy), 1)
+ bounty_outfit_carry(outfit, /obj/item/ammo_box/c38)
+
+/// Buckshot: a pump shotgun on the back, shells on a bandolier. The pump is the telegraph before each blast.
+/datum/bounty_style/shotgun
+ key = BOUNTY_STYLE_SHOTGUN
+ ranged = TRUE
+ weapon = /obj/item/gun/ballistic/shotgun/lethal
+ heavy_weapon = /obj/item/gun/ballistic/shotgun/automatic/combat/bounty
+ weapon_type = /obj/item/gun/ballistic/shotgun
+ ranged_behavior = /datum/ai_behavior/bounty_shoot/close
+ interval = BOUNTY_SHOTGUN_INTERVAL
+ windup = BOUNTY_SHOTGUN_WINDUP
+ windup_message = "%USER pumps the shotgun."
+ windup_sound = 'sound/items/weapons/gun/shotgun/rack.ogg'
+ pumps = TRUE
+ draw_message = "%USER unslings a shotgun!"
+ concealable = FALSE
+
+/datum/bounty_style/shotgun/equip(datum/outfit/outfit, heavy = FALSE)
+ outfit.back = weapon_for(heavy)
+ outfit.belt = /obj/item/storage/belt/bandolier
+ outfit.belt_contents = null
+ LAZYADDASSOC(outfit.belt_contents, /obj/item/ammo_casing/shotgun/buckshot, BOUNTY_SHOTGUN_SHELLS)
+
+/// Off the back, the pump is worked as it comes up if nothing is chambered: the draw is the first blast's telegraph
+/datum/bounty_style/shotgun/on_drawn(mob/living/carbon/fighter, datum/ai_controller/controller, obj/item/weapon, atom/drawn_from)
+ . = ..()
+ var/obj/item/gun/ballistic/gun = weapon
+ if(istype(gun) && human_npc_gun_needs_rack(gun) && human_npc_ready_item(fighter, gun))
+ gun.attack_self(fighter)
+
+/// The pump is real: a spent shell in the chamber is worked out by hand, which makes the rack's own sound
+/datum/bounty_style/shotgun/telegraph(mob/living/carbon/fighter, atom/target, obj/item/weapon)
+ fighter.face_atom(target)
+ if(windup_message)
+ fighter.visible_message(span_warning(replacetext(windup_message, "%USER", "[fighter]")))
+ var/obj/item/gun/ballistic/gun = weapon
+ if(istype(gun) && human_npc_gun_needs_rack(gun) && human_npc_ready_item(fighter, gun))
+ gun.attack_self(fighter)
+ else if(windup_sound)
+ playsound(fighter, windup_sound, 50, TRUE)
+
+/// Beer bottles from a satchel, thrown one at a time
+/datum/bounty_style/bottle
+ key = BOUNTY_STYLE_BOTTLE
+ ranged = TRUE
+ weapon = /obj/item/reagent_containers/cup/glass/bottle/beer
+ weapon_type = /obj/item/reagent_containers/cup/glass/bottle
+ ranged_behavior = /datum/ai_behavior/bounty_shoot/throw
+ interval = BOUNTY_BOTTLE_INTERVAL
+ min_range = BOUNTY_BOTTLE_MIN_RANGE
+ windup = BOUNTY_BOTTLE_WINDUP
+ windup_message = "%USER winds up to throw a bottle."
+
+/datum/bounty_style/bottle/equip(datum/outfit/outfit, heavy = FALSE)
+ if(!outfit.back)
+ outfit.back = /obj/item/storage/backpack/satchel
+ LAZYADDASSOC(outfit.backpack_contents, weapon, heavy ? BOUNTY_BOTTLES_WANTED : BOUNTY_BOTTLES_PETTY)
+
+/datum/bounty_style/bottle/ready_in_hand(mob/living/carbon/fighter)
+ for(var/obj/item/reagent_containers/cup/glass/bottle/bottle in fighter.held_items)
+ if(bottle.isGlass)
+ return bottle
+ return null
+
+/datum/bounty_style/bottle/carried_ranged(mob/living/carbon/fighter)
+ for(var/obj/item/reagent_containers/cup/glass/bottle/bottle in fighter.get_all_contents_type(weapon_type))
+ if(bottle.isGlass && !fighter.is_holding(bottle) && human_npc_can_draw(fighter, bottle))
+ return bottle
+ return null
+
+/// A real throw: the bottle leaves the hand and flies, as a player's does. tg's bottle breaks on whoever it hits.
+/datum/bounty_style/bottle/attack(mob/living/carbon/fighter, datum/ai_controller/controller, atom/target, obj/item/weapon)
+ if(!human_npc_ready_item(fighter, weapon))
+ return FALSE
+ fighter.zone_selected = human_npc_pick_aim_zone()
+ fighter.throw_mode_on(THROW_MODE_TOGGLE)
+ controller.ai_interact(target = target, combat_mode = TRUE)
+ // A click that didn't go through leaves throw mode on: the next click must not be a throw
+ if(fighter.throw_mode)
+ fighter.throw_mode_off(THROW_MODE_TOGGLE)
+ return FALSE
+ return !fighter.is_holding(weapon)
+
+/**
+ * The meek's little gun: a Makarov in a pocket and a spare magazine in a fanny pack. The volley is fired
+ * one trigger pull at a time by the meek AI (bounty_ai_meek.dm).
+ */
+/datum/bounty_style/holdout
+ key = BOUNTY_STYLE_HOLDOUT
+ ranged = TRUE
+ weapon = /obj/item/gun/ballistic/automatic/pistol
+ weapon_type = /obj/item/gun/ballistic/automatic/pistol
+ interval = BOUNTY_MEEK_PISTOL_GAP
+
+/datum/bounty_style/holdout/equip(datum/outfit/outfit, heavy = FALSE)
+ var/obj/item/gun/ballistic/gun_type = weapon
+ bounty_outfit_carry(outfit, gun_type)
+ outfit.belt = /obj/item/storage/belt/fannypack
+ outfit.belt_contents = null
+ LAZYADDASSOC(outfit.belt_contents, initial(gun_type.accepted_magazine_type), 1)
+
+/**
+ * Puts `item_type` somewhere `outfit` carries it: a free pocket, else the belt's pouch, else the bag.
+ * Returns TRUE if it found a place.
+ */
+/proc/bounty_outfit_carry(datum/outfit/outfit, item_type)
+ if(!istype(outfit) || !ispath(item_type))
+ return FALSE
+ if(!outfit.r_pocket)
+ outfit.r_pocket = item_type
+ return TRUE
+ if(!outfit.l_pocket)
+ outfit.l_pocket = item_type
+ return TRUE
+ if(outfit.belt && ispath(outfit.belt, /obj/item/storage))
+ LAZYADDASSOC(outfit.belt_contents, item_type, 1)
+ return TRUE
+ if(outfit.back && ispath(outfit.back, /obj/item/storage))
+ LAZYADDASSOC(outfit.backpack_contents, item_type, 1)
+ return TRUE
+ return FALSE
+
+/**
+ * The outfit a bounty fighter wears: plain clothes for `archetype` in `zone`, its tier's armour, its
+ * style's weapon and spares, and `treatment` (a bruise pack, a stimpack) in a pocket.
+ */
+/proc/bounty_fighter_outfit(archetype, zone, tier, style_key, heavy = FALSE, treatment)
+ var/datum/outfit/outfit = bounty_outfit_instance(bounty_plain_clothes(archetype, zone))
+ if(!outfit)
+ return null
+ bounty_add_tier_armour(outfit, tier)
+ var/datum/bounty_style/style = GLOB.bounty_styles[style_key]
+ style?.equip(outfit, heavy)
+ if(treatment)
+ bounty_outfit_carry(outfit, treatment)
+ return outfit
+
+/// A Wanted criminal's combat shotgun, loaded with buckshot (tg's comes with rubber shot)
+/obj/item/gun/ballistic/shotgun/automatic/combat/bounty
+ accepted_magazine_type = /obj/item/ammo_box/magazine/internal/shot/com/bounty
+
+/obj/item/ammo_box/magazine/internal/shot/com/bounty
+ ammo_type = /obj/item/ammo_casing/shotgun/buckshot
+
+// ===== ARMING =====
+
+/**
+ * In a fight with a target: keeps their style's weapon in hand. Draws it when the fight starts (a
+ * holster, a pocket, the back, a bag), reloads a gun the player's way when it runs dry (the human NPC
+ * base's reload; a shotgun shell by shell), or draws something else, or nothing and uses fists.
+ */
+/datum/ai_planning_subtree/bounty_arm
+
+/datum/ai_planning_subtree/bounty_arm/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/carbon/human/npc/fighter = controller.pawn
+ if(!ishumannpc(fighter) || !bounty_ai_fighting(fighter) || !controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET))
+ return
+ if(HAS_TRAIT(fighter, TRAIT_HANDS_BLOCKED) || LAZYLEN(fighter.do_afters) || world.time < controller.blackboard[BB_HUMAN_NPC_ARMING_RETRY_AT])
+ return
+ var/datum/bounty_style/style = bounty_ai_style(fighter)
+ if(!style)
+ return
+ var/obj/item/to_draw
+ if(style.ranged)
+ if(style.ready_in_hand(fighter))
+ return
+ var/obj/item/gun/ballistic/gun = human_npc_held_gun(fighter)
+ if(istype(gun) && human_npc_can_reload(fighter, gun))
+ controller.queue_behavior(gun.internal_magazine ? /datum/ai_behavior/human_npc_reload/bounty_tube : /datum/ai_behavior/human_npc_reload)
+ return SUBTREE_RETURN_FINISH_PLANNING
+ to_draw = style.carried_ranged(fighter)
+ else if(style.weapon_type)
+ if(human_npc_held_melee_weapon(fighter))
+ return
+ to_draw = bounty_ai_carried(fighter, style.weapon_type)
+ if(fighter.is_holding(to_draw))
+ return
+ else
+ return
+ if(!to_draw && !human_npc_held_melee_weapon(fighter))
+ to_draw = human_npc_backup_weapon(fighter)
+ if(!to_draw)
+ return
+ controller.set_blackboard_key(BB_HUMAN_NPC_DRAW_ITEM, to_draw)
+ controller.queue_behavior(/datum/ai_behavior/human_npc_draw/bounty, BB_HUMAN_NPC_DRAW_ITEM)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/**
+ * The human NPC base's draw. When what comes into the hand is their style's own weapon, the style
+ * answers it (on_drawn()): a holstered or slung gun comes out with a line, and the first shot waits.
+ */
+/datum/ai_behavior/human_npc_draw/bounty
+
+/datum/ai_behavior/human_npc_draw/bounty/perform(seconds_per_tick, datum/ai_controller/controller, item_key)
+ var/mob/living/carbon/npc = controller.pawn
+ var/obj/item/weapon = controller.blackboard[item_key]
+ var/atom/drawn_from = weapon?.loc
+ var/held_before = !QDELETED(weapon) && npc.is_holding(weapon)
+ . = ..()
+ if(held_before || QDELETED(weapon) || !npc.is_holding(weapon))
+ return
+ var/datum/bounty_style/style = bounty_ai_style(npc)
+ if(style?.weapon_type && istype(weapon, style.weapon_type))
+ style.on_drawn(npc, controller, weapon, drawn_from)
+
+/**
+ * The human NPC base's reload, for a gun loaded through its tube (a shotgun): every shell it can fit,
+ * one at a time, then the pump.
+ */
+/datum/ai_behavior/human_npc_reload/bounty_tube
+ give_up_after = 15 SECONDS
+
+/datum/ai_behavior/human_npc_reload/bounty_tube/perform(seconds_per_tick, datum/ai_controller/controller)
+ var/mob/living/carbon/npc = controller.pawn
+ var/obj/item/gun/ballistic/gun = human_npc_held_gun(npc)
+ if(!istype(gun) || !gun.internal_magazine || world.time >= controller.blackboard[BB_HUMAN_NPC_RELOAD_UNTIL])
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ var/obj/item/spent = human_npc_spent_ammo_in_hand(npc, gun)
+ if(spent)
+ npc.dropItemToGround(spent, force = TRUE)
+ return AI_BEHAVIOR_DELAY
+ var/obj/item/ammo_box/magazine/tube = gun.magazine
+ if(tube && tube.ammo_count(FALSE) < tube.max_ammo)
+ var/obj/item/ammo = human_npc_find_ammo(npc, gun)
+ if(ammo)
+ if(!npc.is_holding(ammo))
+ if(!human_npc_take_in_hand(npc, ammo))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ return AI_BEHAVIOR_DELAY
+ if(!human_npc_ready_item(npc, ammo))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ controller.ai_interact(target = gun, combat_mode = FALSE)
+ return AI_BEHAVIOR_DELAY
+ if(human_npc_gun_needs_rack(gun))
+ if(!human_npc_ready_item(npc, gun))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ controller.ai_interact(target = gun, combat_mode = FALSE)
+ return AI_BEHAVIOR_DELAY
+ if(gun.can_shoot())
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+
+// ===== SHOOTING AND THROWING =====
+
+/// In a fight with a ranged style and its weapon ready in hand: shoots or throws, at the style's distance
+/datum/ai_planning_subtree/bounty_ranged
+
+/datum/ai_planning_subtree/bounty_ranged/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/carbon/fighter = controller.pawn
+ if(!bounty_ai_fighting(fighter) || !controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET))
+ return
+ var/datum/bounty_style/style = bounty_ai_style(fighter)
+ if(!style?.ranged || HAS_TRAIT(fighter, TRAIT_HANDS_BLOCKED) || !style.ready_in_hand(fighter))
+ return
+ controller.queue_behavior(style.ranged_behavior, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETING_STRATEGY)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/**
+ * Shoots (or throws) at the target from the style's distance: closes in while it can't see them, steps
+ * back from anyone inside the style's min_range, steps aside for anyone it may not hit in its line,
+ * telegraphs, then pulls the trigger (or throws) once per the style's interval; a burst is that many
+ * pulls burst_gap apart, each one checked like the first. Planning carries on meanwhile, so a new
+ * target, a retreat or a call for help is picked up mid-fight.
+ */
+/datum/ai_behavior/bounty_shoot
+ // Often enough that a style fires at its own pace and its wind-up is never stretched
+ action_cooldown = 0.1 SECONDS
+ behavior_flags = AI_BEHAVIOR_REQUIRE_MOVEMENT | AI_BEHAVIOR_MOVE_AND_PERFORM | AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
+ required_distance = BOUNTY_PISTOL_RANGE
+
+/datum/ai_behavior/bounty_shoot/setup(datum/ai_controller/controller, target_key, targeting_strategy_key)
+ . = ..()
+ var/atom/target = controller.blackboard[target_key]
+ if(QDELETED(target))
+ return FALSE
+ set_movement_target(controller, target)
+
+/datum/ai_behavior/bounty_shoot/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targeting_strategy_key)
+ var/mob/living/carbon/fighter = controller.pawn
+ var/atom/target = controller.blackboard[target_key]
+ var/datum/targeting_strategy/strategy = GET_TARGETING_STRATEGY(controller.blackboard[targeting_strategy_key])
+ if(QDELETED(target) || !strategy?.can_attack(fighter, target, BOUNTY_FIGHT_VISION))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ var/datum/ai_controller/basic_controller/bounty/brain = controller
+ if(istype(brain) && !brain.may_shoot(target))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ var/datum/bounty_style/style = bounty_ai_style(fighter)
+ var/obj/item/weapon = style?.ready_in_hand(fighter)
+ if(!weapon || HAS_TRAIT(fighter, TRAIT_HANDS_BLOCKED))
+ // Dry or empty-handed: the arm subtree reloads or draws, or they fight with their fists
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
+ // Every round of a burst is a pull of its own, asked for again here: anything above that stops it stops the burst
+ var/bursting = style.burst_under_way(controller)
+ if(!can_see(fighter, target, required_distance))
+ style.end_burst(controller)
+ return AI_BEHAVIOR_INSTANT
+ var/winding = !!controller.blackboard[BB_BOUNTY_WINDUP_UNTIL]
+ if(style.min_range && get_dist(fighter, target) < style.min_range && !winding && !bursting)
+ bounty_ai_back_off(controller, fighter, target)
+ if(bounty_ai_line_blocked(fighter, target))
+ style.end_burst(controller)
+ bounty_ai_sidestep(fighter, target)
+ return AI_BEHAVIOR_DELAY
+ if(!winding && world.time < controller.blackboard[BB_BOUNTY_NEXT_SHOT])
+ return AI_BEHAVIOR_DELAY
+ if(!bursting && !style.windup_step(fighter, controller, target, weapon))
+ return AI_BEHAVIOR_DELAY
+ style.pull(fighter, controller, target, weapon)
+ return AI_BEHAVIOR_DELAY
+
+/// A wind-up or a burst cut short never carries over: the next shot telegraphs again
+/datum/ai_behavior/bounty_shoot/finish_action(datum/ai_controller/controller, succeeded, target_key, targeting_strategy_key)
+ . = ..()
+ bounty_ai_clear_windup(controller)
+ controller.clear_blackboard_key(BB_BOUNTY_BURST_LEFT)
+
+/// The shotgun closes in to BOUNTY_SHOTGUN_RANGE
+/datum/ai_behavior/bounty_shoot/close
+ required_distance = BOUNTY_SHOTGUN_RANGE
+
+/// The bottle thrower stays BOUNTY_BOTTLE_RANGE off
+/datum/ai_behavior/bounty_shoot/throw
+ required_distance = BOUNTY_BOTTLE_RANGE
+
+// ===== MELEE =====
+
+/**
+ * In a fight with a target and no ranged weapon ready: walks up and hits with the best melee weapon in
+ * hand, or a fist (the human NPC base's melee). A brawler now and then shoves instead.
+ */
+/datum/ai_planning_subtree/bounty_melee
+
+/datum/ai_planning_subtree/bounty_melee/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/carbon/fighter = controller.pawn
+ if(!bounty_ai_fighting(fighter) || !controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET))
+ return
+ var/datum/bounty_style/style = bounty_ai_style(fighter)
+ if(style?.ranged && style.ready_in_hand(fighter))
+ return
+ controller.queue_behavior(/datum/ai_behavior/basic_melee_attack/human_npc/bounty, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETING_STRATEGY, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/// The human NPC base's melee (tg's, through a click), with the brawler's shove: a real right click with an empty hand
+/datum/ai_behavior/basic_melee_attack/human_npc/bounty
+
+/datum/ai_behavior/basic_melee_attack/human_npc/bounty/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key)
+ var/mob/living/carbon/fighter = controller.pawn
+ var/mob/living/target = controller.blackboard[target_key]
+ var/datum/bounty_style/style = bounty_ai_style(fighter)
+ if(!style?.shove_chance || !isliving(target) || !fighter.CanReach(target) || world.time < fighter.next_move)
+ return ..()
+ var/attack_at = controller.blackboard[BB_BASIC_MOB_MELEE_COOLDOWN_TIMER]
+ if(isnull(attack_at) || attack_at > world.time || !prob(style.shove_chance))
+ return ..()
+ var/datum/targeting_strategy/strategy = GET_TARGETING_STRATEGY(controller.blackboard[targeting_strategy_key])
+ if(!strategy?.can_attack(fighter, target) || !human_npc_ready_empty_hand(fighter))
+ return ..()
+ fighter.zone_selected = BODY_ZONE_CHEST
+ controller.ai_interact(target = target, combat_mode = TRUE, modifiers = list(RIGHT_CLICK = TRUE))
+ return AI_BEHAVIOR_DELAY
diff --git a/voidcrew/modules/bounties/bounty_suits.dm b/voidcrew/modules/bounties/bounty_suits.dm
new file mode 100644
index 00000000000..48f3d798efd
--- /dev/null
+++ b/voidcrew/modules/bounties/bounty_suits.dm
@@ -0,0 +1,273 @@
+/**
+ * # Bounty hunting: suits where the air kills, and the crew's things at the pad
+ *
+ * Owner: A1 company and suits. Criminals and companions are real human NPCs, so they breathe, freeze and
+ * suffocate as anyone does (human_npc.dm); the human NPC base dresses them for the air where they are made
+ * (human_npc_outfits.dm). This file adds the bounty's rules on top:
+ *
+ * - Where they are dressed for. At a space ruin, vacuum is a door away, so a criminal there is always
+ * dressed for it; on a planet, so is one whose site has air that would hurt a person on any of a few
+ * tiles read at random, not only on its own (bounty_site_dress_for()). Companions are dressed for what
+ * their criminal was (bounty_companions.dm).
+ * - What they seal up in (bounty_vacuum_gear()): a suit in the armour class of what they wear in good air,
+ * so the vacuum neither strips nor gives armour. Petty and meek criminals and companions wear a soft
+ * suit; a Wanted or Most Wanted criminal, who wears an armour vest, an armoured space suit; a mini-boss
+ * its kit's own (bounty_boss_kits.dm). It is real gear, locked to them like the rest (D3,
+ * human_npc_gear.dm): it can't be stripped and never becomes loot.
+ * - Suiting up a catch. A hunter can put their own pressure suit or helmet on a criminal that is down,
+ * cuffed, stunned or dead, through the strip menu: it goes on in place of the locked piece in that slot,
+ * which is gone, taking as long as taking one off a person and putting the other on. It is the hunter's
+ * and can come off again like on anyone. An empty slot takes one the ordinary way.
+ * - The pad gives the crew back everything they put on the body (bounty_return_crew_items()).
+ */
+
+/// Soft suits, for those who wear no armour, each list(suit, helmet)
+GLOBAL_LIST_INIT(bounty_soft_suits, list(
+ list(/obj/item/clothing/suit/space/eva, /obj/item/clothing/head/helmet/space/eva),
+ list(/obj/item/clothing/suit/space, /obj/item/clothing/head/helmet/space),
+ list(/obj/item/clothing/suit/space/nasavoid, /obj/item/clothing/head/helmet/space/nasavoid),
+))
+
+/// Armoured space suits, for those who wear an armour vest, each list(suit, helmet)
+GLOBAL_LIST_INIT(bounty_armoured_suits, list(
+ list(/obj/item/clothing/suit/space/syndicate/black, /obj/item/clothing/head/helmet/space/syndicate/black),
+ list(/obj/item/clothing/suit/space/syndicate/black/green, /obj/item/clothing/head/helmet/space/syndicate/black/green),
+ list(/obj/item/clothing/suit/space/syndicate/black/blue, /obj/item/clothing/head/helmet/space/syndicate/black/blue),
+ list(/obj/item/clothing/suit/space/syndicate/black/orange, /obj/item/clothing/head/helmet/space/syndicate/black/orange),
+))
+
+// ===== WHERE THEY ARE DRESSED FOR =====
+
+/**
+ * The BOUNTY_PLACEMENT_* kind of the site a spawn context was made for (the overmap object it names:
+ * spawn_bounty_criminal() makes the criminal's from its site, and companions inherit it), or null.
+ */
+/proc/bounty_site_kind_of(datum/npc_spawn_context/context)
+ var/source_type = context?.source_type
+ if(ispath(source_type, /obj/structure/overmap/planet))
+ return BOUNTY_PLACEMENT_PLANET
+ if(ispath(source_type, /obj/structure/overmap/space_ruin))
+ return BOUNTY_PLACEMENT_RUIN
+ if(ispath(source_type, /obj/structure/overmap/ship/npc/pirate))
+ return BOUNTY_PLACEMENT_NPC_SHIP
+ if(ispath(source_type, /obj/structure/overmap/trader_outpost))
+ return BOUNTY_PLACEMENT_TRADER_OUTPOST
+ return null
+
+/**
+ * HUMAN_NPC_SITE_* flags a bounty NPC made for `context`'s site is dressed for whatever the air on its own
+ * tile: vacuum at a space ruin, and on a planet whatever a few of its tiles' air asks of a person
+ * (bounty_planet_site()). The human NPC base adds the spawn tile's own. NONE anywhere else.
+ */
+/proc/bounty_site_dress_for(datum/npc_spawn_context/context)
+ switch(bounty_site_kind_of(context))
+ if(BOUNTY_PLACEMENT_RUIN)
+ return HUMAN_NPC_SITE_VACUUM
+ if(BOUNTY_PLACEMENT_PLANET)
+ return bounty_planet_site(locate(context.source_id))
+ return NONE
+
+/**
+ * What the air of `planet`'s site asks of a person (HUMAN_NPC_SITE_* flags), read on
+ * BOUNTY_SITE_AIR_SAMPLES open tiles picked at random within its footprint: a criminal in a sealed ruin
+ * on a planet whose air would kill it still has to go out in it.
+ */
+/proc/bounty_planet_site(obj/structure/overmap/planet/planet)
+ . = NONE
+ if(!istype(planet) || QDELETED(planet))
+ return
+ var/list/bounds = bounty_site_bounds(planet)
+ if(length(bounds) < 5)
+ return
+ for(var/i in 1 to BOUNTY_SITE_AIR_SAMPLES)
+ var/turf/open/sample = locate(rand(bounds[1], bounds[3]), rand(bounds[2], bounds[4]), bounds[5])
+ if(!istype(sample) || is_space_or_openspace(sample))
+ continue
+ . |= human_npc_site_at(sample)
+
+/// Whether the human NPC base will seal `npc` up as it dresses it (npc_fit_outfit_to_site()): its site asks for it, and its species isn't proof against both vacuum and its cold
+/proc/bounty_dressing_sealed(mob/living/carbon/human/npc/npc, datum/human_npc_outfit_table/table)
+ var/site = human_npc_site_at(get_turf(npc)) | npc.npc_always_site | table?.always_site
+ if(!(site & HUMAN_NPC_SITE_VACUUM))
+ return FALSE
+ return !(HAS_TRAIT(npc, TRAIT_RESISTLOWPRESSURE) && HAS_TRAIT(npc, TRAIT_RESISTCOLD))
+
+// ===== WHAT THEY SEAL UP IN =====
+
+/mob/living/carbon/human/npc
+ /// The sealed suit and helmet it was given for vacuum, list(suit, helmet), once it has been dressed in them (bounty_vacuum_gear())
+ var/list/suits_vacuum_gear
+
+/**
+ * The suit and helmet a bounty NPC seals up in where the air would kill it: list(suit, helmet) typepaths,
+ * a null helmet keeping its own (already sealed). Null for the human NPC base's plain EVA layer. Each
+ * family overrides it; a random pick is fine, as it is asked once per body (bounty_vacuum_gear()).
+ */
+/mob/living/carbon/human/npc/proc/bounty_sealed_gear()
+ return null
+
+/// A soft suit or an armoured one for a criminal of `tier` (BOUNTY_TIER_*): armoured for those who wear an armour vest (bounty_add_tier_armour())
+/proc/bounty_tier_sealed_gear(tier)
+ if(isnull(tier) || tier == BOUNTY_TIER_PETTY)
+ return pick(GLOB.bounty_soft_suits)
+ return pick(GLOB.bounty_armoured_suits)
+
+/mob/living/carbon/human/npc/bounty_criminal/normal/bounty_sealed_gear()
+ return bounty_tier_sealed_gear(record?.tier)
+
+/mob/living/carbon/human/npc/bounty_criminal/meek/bounty_sealed_gear()
+ return bounty_tier_sealed_gear(record?.tier)
+
+// A mini-boss's kit sets its own (bounty_boss_kits.dm); one with none wears plain clothes, so a soft suit
+/mob/living/carbon/human/npc/bounty_criminal/boss/bounty_sealed_gear()
+ return pick(GLOB.bounty_soft_suits)
+
+/mob/living/carbon/human/npc/bounty_companion/bounty_sealed_gear()
+ return pick(GLOB.bounty_soft_suits)
+
+/**
+ * The sealed suit and helmet `npc` wears where the air would kill it (bounty_sealed_gear()), the same
+ * every time it is asked: list(suit, helmet), or null for the plain EVA layer. Anything that changes a
+ * bounty NPC's clothes later (the chrome exposure, a blend) leaves these pieces alone.
+ */
+/proc/bounty_vacuum_gear(mob/living/carbon/human/npc/npc)
+ if(!ishumannpc(npc))
+ return null
+ if(isnull(npc.suits_vacuum_gear))
+ var/list/gear = npc.bounty_sealed_gear()
+ npc.suits_vacuum_gear = islist(gear) ? gear.Copy() : list()
+ return length(npc.suits_vacuum_gear) ? npc.suits_vacuum_gear : null
+
+/**
+ * `outfit` (a typepath or an instance) with `npc`'s own sealed suit and helmet on, if it is about to be
+ * sealed up for vacuum (bounty_dressing_sealed()): the human NPC base then finds it sealed, and only adds
+ * the air tank. Anything the old suit held moves to the backpack, as the base's layers do. Returns the
+ * outfit unchanged when nothing is needed, else an instance (one passed in is changed in place).
+ */
+/proc/bounty_seal_outfit(mob/living/carbon/human/npc/npc, outfit, datum/human_npc_outfit_table/table)
+ if(isnull(outfit) || !bounty_dressing_sealed(npc, table))
+ return outfit
+ var/list/gear = bounty_vacuum_gear(npc)
+ if(length(gear) < 2 || !ispath(gear[1], /obj/item/clothing/suit))
+ return outfit
+ var/datum/outfit/dressed = ispath(outfit, /datum/outfit) ? new outfit() : outfit
+ if(!istype(dressed))
+ return outfit
+ if(dressed.suit_store)
+ if(dressed.back)
+ LAZYADDASSOC(dressed.backpack_contents, dressed.suit_store, 1)
+ dressed.suit_store = null
+ dressed.suit = gear[1]
+ var/obj/item/clothing/own_head = dressed.head
+ if(ispath(gear[2], /obj/item/clothing/head))
+ dressed.head = gear[2]
+ else if(!ispath(own_head, /obj/item/clothing) || !(initial(own_head.clothing_flags) & STOPSPRESSUREDAMAGE) || !initial(own_head.min_cold_protection_temperature) || initial(own_head.min_cold_protection_temperature) > SPACE_HELM_MIN_TEMP_PROTECT)
+ dressed.head = /obj/item/clothing/head/helmet/space
+ return dressed
+
+// ===== SUITING UP A CATCH =====
+
+/// Whether `garment` is a pressure suit or helmet `user` could put on someone in `slot` (ITEM_SLOT_OCLOTHING or ITEM_SLOT_HEAD)
+/proc/bounty_pressure_garment_for(obj/item/clothing/garment, slot)
+ if(!istype(garment) || QDELETED(garment) || !(garment.clothing_flags & STOPSPRESSUREDAMAGE) || !(garment.slot_flags & slot))
+ return FALSE
+ if(HAS_TRAIT(garment, TRAIT_NODROP) || (garment.item_flags & ABSTRACT))
+ return FALSE
+ switch(slot)
+ if(ITEM_SLOT_OCLOTHING)
+ return istype(garment, /obj/item/clothing/suit)
+ if(ITEM_SLOT_HEAD)
+ return istype(garment, /obj/item/clothing/head)
+ return FALSE
+
+/**
+ * The pressure suit or helmet `user` holds ready to put on it in place of `worn`, one of its own locked
+ * pieces in the suit or head slot, or null when this isn't that (any other reach goes to tg's strip menu
+ * as it is). A hood belongs to its suit, and goes with it.
+ */
+/mob/living/carbon/human/npc/bounty_criminal/proc/suits_garment_offered(mob/user, obj/item/worn)
+ if(!ismob(user) || !istype(worn) || worn.loc != src || !human_npc_gear_locked(worn))
+ return null
+ if(istype(worn, /obj/item/clothing/head/hooded))
+ return null
+ var/slot = get_slot_by_item(worn)
+ if(slot != ITEM_SLOT_OCLOTHING && slot != ITEM_SLOT_HEAD)
+ return null
+ var/obj/item/clothing/garment = user.get_active_held_item()
+ return bounty_pressure_garment_for(garment, slot) ? garment : null
+
+/**
+ * The bounty_body component's strip hook (bounty_criminal.dm): `user` reaches for `worn` through the strip
+ * menu. With a pressure suit or helmet in hand for a slot its own locked piece fills, on a criminal that is
+ * down, cuffed, stunned or dead, the hunter starts putting theirs on (suits_put_on()); on one that is free,
+ * it pulls away. Returns COMPONENT_CANT_STRIP when it takes the reach over, so tg's strip doesn't go on to
+ * refuse the locked piece, else NONE.
+ */
+/mob/living/carbon/human/npc/bounty_criminal/proc/suits_strip_reach(mob/user, obj/item/worn)
+ var/obj/item/clothing/garment = suits_garment_offered(user, worn)
+ if(!garment)
+ return NONE
+ if(capture_state() == BOUNTY_STATE_FREE)
+ balloon_alert(user, "[p_they()] pull[p_s()] away!")
+ return COMPONENT_CANT_STRIP
+ INVOKE_ASYNC(src, PROC_REF(suits_put_on), user, worn, garment)
+ return COMPONENT_CANT_STRIP
+
+/**
+ * `user` puts `garment` on it in place of `worn`: as long as taking the one off a person and putting the
+ * other on (`worn`'s strip delay and `garment`'s equip delay), standing beside it. Sleeps. Returns TRUE if
+ * it went on.
+ */
+/mob/living/carbon/human/npc/bounty_criminal/proc/suits_put_on(mob/user, obj/item/worn, obj/item/clothing/garment)
+ garment.item_start_equip(src, garment, user)
+ if(!do_after(user, worn.strip_delay + garment.equip_delay_other, src, interaction_key = REF(garment)))
+ return FALSE
+ return suits_swap_now(user, worn, garment)
+
+/**
+ * Puts `garment`, from `user`'s hands, on it in place of `worn`, now: the locked piece is gone (it never
+ * leaves the body as loot), and the garment is the hunter's, an ordinary item that can come off again.
+ * Only while it is still the same reach: `worn` in its slot, `garment` in the hunter's hand, the hunter
+ * beside it, and it down, cuffed, stunned or dead. Returns TRUE if it went on. Doesn't sleep.
+ */
+/mob/living/carbon/human/npc/bounty_criminal/proc/suits_swap_now(mob/user, obj/item/worn, obj/item/clothing/garment)
+ if(QDELETED(src) || QDELETED(user) || !user.Adjacent(src))
+ return FALSE
+ if(suits_garment_offered(user, worn) != garment || capture_state() == BOUNTY_STATE_FREE)
+ return FALSE
+ var/slot = get_slot_by_item(worn)
+ // One that wouldn't fit them (their species, their shape) leaves their own piece on
+ if(!can_equip(garment, slot, disable_warning = TRUE, bypass_equip_delay_self = TRUE, ignore_equipped = TRUE))
+ return FALSE
+ if(!user.temporarilyRemoveItemFromInventory(garment))
+ return FALSE
+ qdel(worn)
+ if(!equip_to_slot_if_possible(garment, slot, disable_warning = TRUE, bypass_equip_delay_self = TRUE))
+ user.put_in_hands(garment)
+ return FALSE
+ finish_equip_mob(garment, src, user)
+ return TRUE
+
+// ===== THE CREW'S THINGS =====
+
+/// Whether `item`, directly on a bounty NPC's body, is something the crew put there: not its own locked gear or consumables, and not part of the body (limbs, organs, implants). A hood goes with its suit.
+/proc/bounty_crew_item(obj/item/item)
+ if(!istype(item) || QDELETED(item) || (item.item_flags & ABSTRACT))
+ return FALSE
+ if(isbodypart(item) || isorgan(item) || istype(item, /obj/item/implant) || istype(item, /obj/item/clothing/head/hooded))
+ return FALSE
+ return !HAS_TRAIT(item, TRAIT_HUMAN_NPC_GEAR) && !HAS_TRAIT(item, TRAIT_HUMAN_NPC_CONSUMABLE)
+
+/**
+ * Puts down at `spot` everything the crew put on `body`: their cuffs, a suit and helmet, an air tank in its
+ * suit storage, whatever else. Its own gear goes with it (D3). Returns what was put down.
+ */
+/proc/bounty_return_crew_items(mob/living/carbon/human/npc/body, turf/spot)
+ . = list()
+ if(QDELETED(body) || !isturf(spot))
+ return
+ for(var/obj/item/item in body.contents.Copy())
+ if(item.loc != body || !bounty_crew_item(item))
+ continue
+ if(body.transferItemToLoc(item, spot, force = TRUE))
+ . += item
diff --git a/voidcrew/modules/bounties/bounty_turn_in.dm b/voidcrew/modules/bounties/bounty_turn_in.dm
index 463539bf9a0..2fa9980ba99 100644
--- a/voidcrew/modules/bounties/bounty_turn_in.dm
+++ b/voidcrew/modules/bounties/bounty_turn_in.dm
@@ -36,7 +36,7 @@
// ===== TURNING IN =====
/// Bind field work before the criminal or its proof can be carried to another band.
-/datum/criminal_bounty/proc/board_note_work_zone(mob/living/basic/bounty_criminal/target)
+/datum/criminal_bounty/proc/board_note_work_zone(mob/living/carbon/human/npc/bounty_criminal/target)
if(!is_open() || !record || record.board_work_zone || target != criminal() || record.status != BOUNTY_RECORD_WANTED)
return
var/band = get_zone_type_for_player_turf(get_turf(target))
@@ -112,7 +112,7 @@
/datum/criminal_bounty/proc/board_target_on_pad(obj/machinery/mission_pad/pad)
if(!pad || !isturf(pad.loc))
return null
- var/mob/living/basic/bounty_criminal/criminal = criminal()
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = criminal()
if(criminal && criminal.loc == pad.loc)
return criminal
var/obj/item/bounty_proof/proof = board_proof()
@@ -129,13 +129,13 @@
/datum/criminal_bounty/proc/board_target_refusal(obj/machinery/mission_pad/pad, list/found)
var/atom/movable/target = board_target_on_pad(pad)
if(!target)
- var/mob/living/basic/bounty_criminal/criminal = criminal()
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = criminal()
if(criminal && get_turf(criminal) == get_turf(pad))
return "they're inside [criminal.loc]"
return "nothing on the pad for this bounty"
var/state = BOUNTY_STATE_DEAD
- if(istype(target, /mob/living/basic/bounty_criminal))
- var/mob/living/basic/bounty_criminal/criminal = target
+ if(istype(target, /mob/living/carbon/human/npc/bounty_criminal))
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = target
if(criminal.client || criminal.mind)
return "the pad won't take them"
state = criminal.capture_state()
@@ -147,9 +147,11 @@
/**
* Pays `ship` for `target` (this bounty's criminal or its proof) in `state` at `pad`, and ends the
- * bounty for everyone. No yield from start to end. The share is the worse of `state` and the worst
- * state the criminal ever reached (12.1); a live catch gets its hurt, its captor and its preferred
- * prison and goes to the prisoner pool. Returns list(credits, vouchers), or why not.
+ * bounty for everyone. No yield from start to end, and it pays once: the posting is closed before
+ * anything else can press. The share is the criminal's condition on the pad, read at the press (owner
+ * ruling 2026-11-08: dead 25%, in crit 60%, cuffed or stunned 100%; what it went through on the way
+ * doesn't count). A live catch gets its hurt, its captor and its preferred prison and goes to the
+ * prisoner pool. Returns list(credits, vouchers), or why not.
*/
/datum/criminal_bounty/proc/board_claim(obj/structure/overmap/ship/ship, obj/machinery/mission_pad/pad, atom/movable/target, state, mob/user)
// Everything after this line runs once: a second press, or a second ship, finds it closed
@@ -157,13 +159,13 @@
return "that bounty is closed"
if(QDELETED(target) || QDELETED(ship))
return "nothing on the pad for this bounty"
- var/mob/living/basic/bounty_criminal/criminal = istype(target, /mob/living/basic/bounty_criminal) ? target : null
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = istype(target, /mob/living/carbon/human/npc/bounty_criminal) ? target : null
var/obj/item/bounty_proof/proof = istype(target, /obj/item/bounty_proof) ? target : null
if(!criminal && !proof)
return "nothing on the pad for this bounty"
if(proof)
state = BOUNTY_STATE_DEAD
- var/share = board_share_for(state, criminal ? criminal.worst_state : BOUNTY_STATE_DEAD)
+ var/share = board_share_for(state)
if(!share)
return "they're standing free"
var/list/pay = board_payout(share)
@@ -266,8 +268,8 @@
var/state = null
if(target)
state = "proof"
- if(istype(target, /mob/living/basic/bounty_criminal))
- var/mob/living/basic/bounty_criminal/criminal = target
+ if(istype(target, /mob/living/carbon/human/npc/bounty_criminal))
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = target
state = criminal.capture_state()
var/refusal
if(private_to && offered_to() != ship)
@@ -316,8 +318,8 @@
/// What the pad says about `arrived` on it, or null if it says nothing (not a bounty target, or not this ship's to turn in)
/obj/machinery/mission_pad/proc/bounty_pad_line(atom/movable/arrived)
var/datum/criminal_bounty/posting
- if(istype(arrived, /mob/living/basic/bounty_criminal))
- var/mob/living/basic/bounty_criminal/criminal = arrived
+ if(istype(arrived, /mob/living/carbon/human/npc/bounty_criminal))
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = arrived
posting = criminal.posting()
else if(istype(arrived, /obj/item/bounty_proof))
var/obj/item/bounty_proof/proof = arrived
@@ -343,18 +345,19 @@
// ===== THE BEAM =====
/**
- * The pad takes them: held still, harmless and untouchable, and fading out in the prisoner's
- * beam (outpost_prison_prisoner.dm beam_out()), then deleted. Never a teleport (AR-A1). Nothing
- * they leave behind counts as proof of death.
+ * The pad takes them: held still and harmless, fading out in the prisoner's beam
+ * (outpost_prison_prisoner.dm beam_out()), then deleted. Never a teleport (AR-A1). The pay was settled
+ * before the beam starts, so nothing that happens to them during it changes it; there is no godmode
+ * (defaults 1.8, CR-18). Their locked kit goes with them (D3); anything on them that isn't kit (papers,
+ * a key, the crew's own cuffs) is left on the pad. Nothing they leave behind counts as proof of death.
*/
-/mob/living/basic/bounty_criminal/proc/board_beam_out()
+/mob/living/carbon/human/npc/bounty_criminal/proc/board_beam_out()
// Their last words as the pad takes them (P1's beamed_out lines), said before the beam holds them still
if(stat == CONSCIOUS)
INVOKE_ASYNC(src, TYPE_PROC_REF(/mob/living, bounty_say), "beamed_out", null, TRUE)
ADD_TRAIT(src, TRAIT_BOUNTY_REMOVED, BOUNTY_PAD_TRAIT)
ADD_TRAIT(src, TRAIT_IMMOBILIZED, BOUNTY_PAD_TRAIT)
ADD_TRAIT(src, TRAIT_INCAPACITATED, BOUNTY_PAD_TRAIT)
- ADD_TRAIT(src, TRAIT_GODMODE, BOUNTY_PAD_TRAIT)
REMOVE_TRAIT(src, TRAIT_MISSION_FIELD_MOB, BOUNTY_TRAIT)
ai_controller?.set_ai_status(AI_STATUS_OFF)
pulledby?.stop_pulling()
@@ -368,8 +371,11 @@
transporter_dematerialise(src, BOUNTY_BEAM_TIME)
addtimer(CALLBACK(src, PROC_REF(board_finish_beam_out)), BOUNTY_BEAM_TIME, TIMER_DELETE_ME)
-/mob/living/basic/bounty_criminal/proc/board_finish_beam_out()
+/mob/living/carbon/human/npc/bounty_criminal/proc/board_finish_beam_out()
var/turf/spot = get_turf(src)
+ npc_drop_not_gear()
+ // What the crew put on them stays with the crew: their restraints, and any suit, helmet or tank they put on for the trip (bounty_suits.dm)
+ bounty_return_crew_items(src, spot)
if(spot)
new /obj/effect/temp_visual/transporter_flash/departure(spot)
transporter_sparks(spot)
@@ -445,13 +451,13 @@
* the criminal away (TRAIT_BOUNTY_REMOVED), when its bounty is closed or relisting, or when the
* criminal went with its site's interior (it comes back at the next load). One proof per bounty.
*/
-/proc/bounty_drop_proof(mob/living/basic/bounty_criminal/criminal)
+/proc/bounty_drop_proof(mob/living/carbon/human/npc/bounty_criminal/criminal)
if(!criminal || HAS_TRAIT(criminal, TRAIT_BOUNTY_REMOVED))
return null
var/datum/criminal_bounty/posting = criminal.posting_ref?.resolve()
if(!posting || !posting.is_open() || posting.board_relisting)
return null
- var/mob/living/basic/bounty_criminal/current = posting.criminal()
+ var/mob/living/carbon/human/npc/bounty_criminal/current = posting.criminal()
if(current && current != criminal)
return null
var/turf/spot = get_turf(criminal)
@@ -526,13 +532,15 @@
/**
* Called from the bluespace body bag's attempt_fold(): TRUE stops `folder` folding `bag`, because
- * a living bounty criminal is inside (AR-E7). Tells `folder` why.
+ * a bounty criminal inside is alive and struggling (AR-E7, PL-20). One in crit or dead is a body, and
+ * folds like anyone's; the bag still never rides a transporter beam with a live one in it
+ * (bounty_blocks_transport()). Tells `folder` why.
*/
/proc/bounty_blocks_bag_fold(obj/structure/closet/body_bag/bag, mob/living/folder)
if(!bag)
return FALSE
- for(var/mob/living/basic/bounty_criminal/criminal in bag.get_all_contents())
- if(criminal.stat == DEAD)
+ for(var/mob/living/carbon/human/npc/bounty_criminal/criminal in bag.get_all_contents())
+ if(!bounty_body_bound(criminal) || criminal.is_downed())
continue
if(folder)
to_chat(folder, span_warning("[bag] won't fold with someone alive and struggling inside."))
@@ -555,12 +563,22 @@
if(QDELETED(thing))
return FALSE
for(var/mob/living/passenger in thing.get_all_contents())
- if(passenger == thing || passenger.stat == DEAD)
- continue
- if(istype(passenger, /mob/living/basic/bounty_criminal) || istype(passenger, /mob/living/basic/bounty_companion))
+ if(passenger != thing && bounty_body_bound(passenger))
return TRUE
return FALSE
+/**
+ * Whether `body` is a living bounty person the pad is the only way out for: a criminal still held to its
+ * site (its body's TRAIT_NO_TELEPORT; a convict a crew talked down loses it and is free to go), or a
+ * companion. Dead bodies are proof, and travel like any body.
+ */
+/proc/bounty_body_bound(mob/living/body)
+ if(!isliving(body) || QDELETED(body) || body.stat == DEAD)
+ return FALSE
+ if(istype(body, /mob/living/carbon/human/npc/bounty_criminal))
+ return HAS_TRAIT_FROM(body, TRAIT_NO_TELEPORT, BOUNTY_BODY_TRAIT)
+ return istype(body, /mob/living/carbon/human/npc/bounty_companion)
+
/**
* Called from the transporter pad's gather_payload(): TRUE keeps `thing` off the beam. A criminal
* refuses teleports itself (P2); this stops a locker, a crate or a bag with a living one inside
@@ -570,7 +588,6 @@
/proc/bounty_blocks_transport(atom/movable/thing)
if(QDELETED(thing))
return FALSE
- if(istype(thing, /mob/living/basic/bounty_criminal) || istype(thing, /mob/living/basic/bounty_companion))
- var/mob/living/rider = thing
- return rider.stat != DEAD
+ if(ismob(thing))
+ return bounty_body_bound(thing)
return bounty_holds_living_criminal(thing)
diff --git a/voidcrew/modules/bounties/bounty_types.dm b/voidcrew/modules/bounties/bounty_types.dm
index 6af790269ea..12943ae57fd 100644
--- a/voidcrew/modules/bounties/bounty_types.dm
+++ b/voidcrew/modules/bounties/bounty_types.dm
@@ -140,7 +140,7 @@ GLOBAL_LIST_EMPTY(bounty_prisoner_pool)
var/placement_kind
/// Weakref to where the criminal is: the overmap object of the planet, ruin, pirate ship or trader outpost
var/datum/weakref/site_ref
- /// Weakref to the criminal's mob while its site is loaded (/mob/living/basic/bounty_criminal)
+ /// Weakref to the criminal's mob while its site is loaded (/mob/living/carbon/human/npc/bounty_criminal)
var/datum/weakref/criminal_ref
/// Weakref to the ship a private offer is for; null for a public bounty
var/datum/weakref/private_to
@@ -152,9 +152,9 @@ GLOBAL_LIST_EMPTY(bounty_prisoner_pool)
var/value = 0
/// world.time it comes off the board
var/expires_at = 0
- /// Weakrefs to its decoys at a trader outpost (/mob/living/basic/bounty_criminal/decoy)
+ /// Weakrefs to its decoys at a trader outpost (/mob/living/carbon/human/npc/bounty_criminal/decoy)
var/list/decoys = list()
- /// Weakrefs to the criminal's companions (/mob/living/basic/bounty_companion)
+ /// Weakrefs to the criminal's companions (/mob/living/carbon/human/npc/bounty_companion)
var/list/companions = list()
/// The sighting marker hunters' GPS units point to
var/obj/effect/bounty_sighting/marker
@@ -167,29 +167,26 @@ GLOBAL_LIST_EMPTY(bounty_prisoner_pool)
/// The criminal's mob, if its site is loaded and it still exists
/datum/criminal_bounty/proc/criminal()
- var/mob/living/basic/bounty_criminal/criminal = criminal_ref?.resolve()
+ var/mob/living/carbon/human/npc/bounty_criminal/criminal = criminal_ref?.resolve()
return QDELETED(criminal) ? null : criminal
// ===== THE CRIMINALS =====
/**
- * A wanted criminal, while its site is loaded. Its own mob family: not an outpost prisoner (a
- * caught criminal becomes a new prisoner, rebuilt from the record) and never under
- * /mob/living/basic/boss (megafauna are banned from outposts). No AI controller until P3 gives it
- * one. Built-in values are set by P2 in bounty_criminal.dm.
+ * A wanted criminal, while its site is loaded: a real human body (/mob/living/carbon/human/npc, the
+ * human NPC base) driven by the bounty AI. Its crit, stamina, cuffs, wounds, death and revival are
+ * tg's, as for a player; only its AI and the bounty rules on top are its own. Not an outpost
+ * prisoner: a caught criminal becomes a new prisoner, rebuilt from the record. Built-in values are
+ * set by P2 in bounty_criminal.dm.
*/
-/mob/living/basic/bounty_criminal
+/mob/living/carbon/human/npc/bounty_criminal
/// Who they are (/datum/bounty_record)
var/datum/bounty_record/record
/// Weakref to the posting they are wanted on (/datum/criminal_bounty); null for an admin spawn with none
var/datum/weakref/posting_ref
- /// At or below the downed line: floored, harmless and draggable until they recover (P2)
- var/downed = FALSE
/// Hidden in a locker, a crate, as a potted plant or in the dark (P3)
var/hidden = FALSE
- /// The restraints on them, held in their contents (P2), or null
- var/obj/item/restraints/handcuffs/restraints
- /// Weakrefs to their companions (/mob/living/basic/bounty_companion)
+ /// Weakrefs to their companions (/mob/living/carbon/human/npc/bounty_companion)
var/list/companions = list()
/// Blending in at a trader outpost: the fugitive and its decoys idle, talk and move the same way (P6, P3)
var/blended = FALSE
@@ -197,42 +194,40 @@ GLOBAL_LIST_EMPTY(bounty_prisoner_pool)
var/list/grudge = list()
/// Their leash, list(min_x, min_y, max_x, max_y, z), or null for none (P2's leash_ok())
var/list/site_bounds
- /// The worst capture state they have reached (BOUNTY_STATE_*): once downed or dead, the pay share never rises again. P2 writes it, P5 pays on it.
- var/worst_state = BOUNTY_STATE_FREE
/// The posting they are wanted on, if it still exists
-/mob/living/basic/bounty_criminal/proc/posting()
+/mob/living/carbon/human/npc/bounty_criminal/proc/posting()
var/datum/criminal_bounty/posting = posting_ref?.resolve()
return QDELETED(posting) ? null : posting
/// A meek criminal: runs, hides, blends in. P2 sets its body, P3 its AI.
-/mob/living/basic/bounty_criminal/meek
+/mob/living/carbon/human/npc/bounty_criminal/meek
/// A normal criminal: found doing something, fights back. P2 sets its body, P3 its AI.
-/mob/living/basic/bounty_criminal/normal
+/mob/living/carbon/human/npc/bounty_criminal/normal
/// A mini-boss: the base of the five kits. P4 sets its body and AI in bounty_boss.dm.
-/mob/living/basic/bounty_criminal/boss
+/mob/living/carbon/human/npc/bounty_criminal/boss
-/mob/living/basic/bounty_criminal/boss/juggernaut
-/mob/living/basic/bounty_criminal/boss/pyromaniac
-/mob/living/basic/bounty_criminal/boss/demolitionist
-/mob/living/basic/bounty_criminal/boss/ghost
-/mob/living/basic/bounty_criminal/boss/heavy
+/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut
+/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac
+/mob/living/carbon/human/npc/bounty_criminal/boss/demolitionist
+/mob/living/carbon/human/npc/bounty_criminal/boss/ghost
+/mob/living/carbon/human/npc/bounty_criminal/boss/heavy
/**
* A patron at a trader outpost who shares some of the fugitive's features. Same body, same
* blended-in mode and same examine layout as the fugitive, so nothing about it gives the fugitive
* away; only what a warrant does to it differs. P6 owns its behaviour (bounty_outpost.dm).
*/
-/mob/living/basic/bounty_criminal/decoy
+/mob/living/carbon/human/npc/bounty_criminal/decoy
/**
* Someone with a normal criminal: fights beside them, is not a bounty and pays nothing. P3 owns it
* (bounty_companions.dm) and sets its built-in values.
*/
-/mob/living/basic/bounty_companion
- /// Weakref to the criminal they are with (/mob/living/basic/bounty_criminal)
+/mob/living/carbon/human/npc/bounty_companion
+ /// Weakref to the criminal they are with (/mob/living/carbon/human/npc/bounty_criminal)
var/datum/weakref/leader_ref
// ===== OBJECTS =====
diff --git a/voidcrew/modules/bounties/strings/bounty_lair_mafia.json b/voidcrew/modules/bounties/strings/bounty_lair_mafia.json
index 1c4af5a59e4..d0966d79c2a 100644
--- a/voidcrew/modules/bounties/strings/bounty_lair_mafia.json
+++ b/voidcrew/modules/bounties/strings/bounty_lair_mafia.json
@@ -33,6 +33,16 @@
"I'm bleeding here!",
"Somebody shoot them!"
],
+ "goon_shoved": [
+ "Hands off.",
+ "Back up, pal.",
+ "Don't touch me."
+ ],
+ "goon_cuffed": [
+ "Get off me!",
+ "Not a chance.",
+ "You're not putting those on me."
+ ],
"tommy_alert": [
"Nobody goes through this door. Boss's orders.",
"You picked the wrong club, friend.",
@@ -83,5 +93,10 @@
"You'll pay for that.",
"My family will find you.",
"Not like this. Not in my own club."
+ ],
+ "don_cuffed": [
+ "Nobody takes me alive.",
+ "You'll have to kill me first.",
+ "Cuffs? On me?"
]
}
diff --git a/voidcrew/modules/cargo/shipping/_shuttle_loan.dm b/voidcrew/modules/cargo/shipping/_shuttle_loan.dm
index 49ee78bb71a..87b3d32db60 100644
--- a/voidcrew/modules/cargo/shipping/_shuttle_loan.dm
+++ b/voidcrew/modules/cargo/shipping/_shuttle_loan.dm
@@ -210,13 +210,14 @@ GLOBAL_LIST_INIT(voidcrew_shuttle_loans, list(
qdel(item)
return delivery
-/// The cargo bay can be off-map; its host ship supplies the encounter band.
+/// The cargo bay can be off-map; its host ship supplies the encounter band. People (human NPCs) are queued
+/// and built a body a tick (spawn_npc_in_zone_or_queue()).
/datum/voidcrew_shuttle_loan/proc/spawn_hostile(mob_type, turf/location, datum/voidcrew_cargo_shuttle/shuttle)
if(!npc_source)
var/turf/source_turf = get_turf(shuttle.target_ship)
npc_source = new(shuttle, SSovermap_zones.get_zone_type_anywhere(source_turf) || ZONE_GREEN, source_turf = source_turf)
var/datum/npc_spawn_context/context = new(shuttle, npc_source.zone_type, "ordinary", source_turf = npc_source.source_turf)
- return spawn_npc_in_zone(mob_type, location, context)
+ return spawn_npc_in_zone_or_queue(mob_type, location, context)
/// Department resupply - free supplies, no bonus
/datum/voidcrew_shuttle_loan/department_resupply
@@ -449,13 +450,13 @@ GLOBAL_LIST_INIT(voidcrew_shuttle_loans, list(
for(var/i in 1 to 2)
if(!length(cargo_turfs))
break
- spawn_hostile(/mob/living/basic/trooper/syndicate/ranged/infiltrator, pick_n_take(cargo_turfs), shuttle)
+ spawn_hostile(/mob/living/carbon/human/npc/ruin/trooper/syndicate/gunner/infiltrator, pick_n_take(cargo_turfs), shuttle)
// Chance for more
if(prob(75) && length(cargo_turfs))
- spawn_hostile(/mob/living/basic/trooper/syndicate/ranged/infiltrator, pick_n_take(cargo_turfs), shuttle)
+ spawn_hostile(/mob/living/carbon/human/npc/ruin/trooper/syndicate/gunner/infiltrator, pick_n_take(cargo_turfs), shuttle)
if(prob(50) && length(cargo_turfs))
- spawn_hostile(/mob/living/basic/trooper/syndicate/ranged/infiltrator, pick_n_take(cargo_turfs), shuttle)
+ spawn_hostile(/mob/living/carbon/human/npc/ruin/trooper/syndicate/gunner/infiltrator, pick_n_take(cargo_turfs), shuttle)
/// Lots of bees - Toxic bees and beekeeping equipment
/datum/voidcrew_shuttle_loan/lots_of_bees
@@ -580,15 +581,15 @@ GLOBAL_LIST_INIT(voidcrew_shuttle_loans, list(
// The Russians
if(length(cargo_turfs))
- spawn_hostile(/mob/living/basic/trooper/russian, pick_n_take(cargo_turfs), shuttle)
+ spawn_hostile(/mob/living/carbon/human/npc/ruin/trooper/russian, pick_n_take(cargo_turfs), shuttle)
if(length(cargo_turfs))
- spawn_hostile(/mob/living/basic/trooper/russian/ranged, pick_n_take(cargo_turfs), shuttle) // This one drops a mateba
+ spawn_hostile(/mob/living/carbon/human/npc/ruin/trooper/russian/gunner, pick_n_take(cargo_turfs), shuttle) // This one drops a Nagant
if(length(cargo_turfs))
spawn_hostile(/mob/living/basic/bear/russian, pick_n_take(cargo_turfs), shuttle)
// Chance for more
if(prob(75) && length(cargo_turfs))
- spawn_hostile(/mob/living/basic/trooper/russian, pick_n_take(cargo_turfs), shuttle)
+ spawn_hostile(/mob/living/carbon/human/npc/ruin/trooper/russian, pick_n_take(cargo_turfs), shuttle)
if(prob(50) && length(cargo_turfs))
spawn_hostile(/mob/living/basic/bear/russian, pick_n_take(cargo_turfs), shuttle)
diff --git a/voidcrew/modules/dynamic_events/events/portal_storm.dm b/voidcrew/modules/dynamic_events/events/portal_storm.dm
index 98b221070a6..7dee9a0a9e1 100644
--- a/voidcrew/modules/dynamic_events/events/portal_storm.dm
+++ b/voidcrew/modules/dynamic_events/events/portal_storm.dm
@@ -179,12 +179,24 @@
if(!spawn_turf || !target_ship.is_aboard(spawn_turf))
continue
var/datum/npc_spawn_context/context = new(target_ship, npc_spawn_zone, role, source_turf = npc_source_turf)
+ // People (human NPCs) are queued and step out of the portal as they are built, a body a tick.
+ if(ispath(mob_type, /mob/living/carbon/human/npc))
+ spawn_human_npc(mob_type, spawn_turf, CALLBACK(src, PROC_REF(human_stepped_out)), context = context)
+ spawned_mobs++
+ continue
var/mob/living/new_hostile = spawn_npc_in_zone(mob_type, spawn_turf, context)
if(QDELETED(new_hostile))
continue
spawned_mobs++
spawn_effects(spawn_turf)
+/// A queued boarder is built: the portal flashes where it steps out, if it is still aboard.
+/datum/round_event/voidcrew/portal_storm/proc/human_stepped_out(mob/living/carbon/human/npc/boarder)
+ var/turf/spot = get_turf(boarder)
+ if(!spot || !target_valid() || !target_ship.is_aboard(spot))
+ return
+ spawn_effects(spot)
+
/// Plays TG's portal flash and sound without allowing the shifted visual off-ship.
/datum/round_event/voidcrew/portal_storm/proc/spawn_effects(turf/spawn_turf)
if(!target_valid() || !spawn_turf || !target_ship.is_aboard(spawn_turf))
@@ -194,16 +206,17 @@
if(!target_ship.is_aboard(effect_turf))
effect_turf = spawn_turf
var/appearance_index = GET_TURF_PLANE_OFFSET(effect_turf) + 1
- if(appearance_index <= length(storm_appearances))
+ if(appearance_index <= length(storm_appearances) && storm_appearances[appearance_index])
effect_turf.flick_overlay_static(storm_appearances[appearance_index], 15)
playsound(effect_turf, 'sound/effects/magic/lightningbolt.ogg', rand(80, 100), TRUE)
-/// Syndicate commandos, with a stormtrooper occupying the optional boss slot.
+/// Syndicate commandos, with a stormtrooper occupying the optional boss slot: people in sealed suits
+/// (human NPCs, voidcrew/modules/human_npcs/ruins/ruin_npc_troopers.dm), armed for the zone they board in.
/datum/round_event/voidcrew/portal_storm/syndicate_shocktroop
- boss_types = list(/mob/living/basic/trooper/syndicate/melee/space/stormtrooper = 2)
+ boss_types = list(/mob/living/carbon/human/npc/ruin/trooper/syndicate/stormtrooper/sword = 2)
hostile_types = list(
- /mob/living/basic/trooper/syndicate/melee/space = 8,
- /mob/living/basic/trooper/syndicate/ranged/space = 2,
+ /mob/living/carbon/human/npc/ruin/trooper/syndicate/commando = 8,
+ /mob/living/carbon/human/npc/ruin/trooper/syndicate/commando/gunner = 2,
)
/// Hostile cult constructs using the same pulse and population limits.
diff --git a/voidcrew/modules/human_npcs/human_npc.dm b/voidcrew/modules/human_npcs/human_npc.dm
new file mode 100644
index 00000000000..aec6ce77173
--- /dev/null
+++ b/voidcrew/modules/human_npcs/human_npc.dm
@@ -0,0 +1,665 @@
+/**
+ * # Human NPCs
+ *
+ * A human NPC is a real /mob/living/carbon/human driven by an AI (human_npc_ai.dm). Everything a
+ * player's body does, it does through the same tg code: wounds, bleeding, dismemberment, soft and hard
+ * crit, suffocation, stamina damage and stamcrit, stuns, cuffs, grabs, pulling, death, revival,
+ * organ decay, and the hyperviolence gore and executions. There are no stand-in states, health
+ * pools or heals. Phases B-E of the human NPC migration build pirates, troopers, hermits and bounty
+ * criminals on this type; the developer notes are in the kit vault (modules/human_npcs.md).
+ *
+ * Making one: spawn_human_npc() (human_npc_spawning.dm) queues it, so a wave is built a body or two
+ * per tick, never all at once. Maps place /obj/effect/spawner/human_npc. A subtype sets its look,
+ * outfit, name, faction, rank, toughness and death drops with the vars below.
+ *
+ * What differs from a player's body, and why. These are the only deviations:
+ * - Dormancy (performance). Life() does nothing while no player is on the NPC's z-level, alive or
+ * dead (npc_dormant()), the same test tg uses to switch the AI off. While dormant nothing in Life()
+ * runs: bleeding, wound and organ processing, metabolism, breathing, body temperature, pressure,
+ * crit oxygen loss, natural healing, disease. A dormant NPC is frozen in time; a wounded one doesn't
+ * bleed out until someone arrives. A corpse that wakes catches up the organ decay it missed while
+ * dormant (npc_catch_up_decay()), so the defib window and organ rot match a player's corpse; its
+ * body temperature is not caught up. Stamina recovery is a timer, not Life(), so it is not paused.
+ * A space suit's thermal regulator is switched off while it is dormant and back on when it wakes
+ * (npc_set_suit_heating()), so a cell doesn't run flat keeping a frozen-in-time body warm.
+ * This has to be a guard on this type's own Life(): COMSIG_LIVING_LIFE's cancel flag only stops
+ * /mob/living/Life(), and carbon and human Life() run organs, wounds, limbs and temperature around it.
+ * - No mood datum and TRAIT_NOHUNGER (performance, and an NPC never eats over a 6 hour round).
+ * - Gear lock (owner decision D3, human_npc_gear.dm): its kit can't be stripped, dropped or looted.
+ * - Aimed crits and gun executions only from elites and bosses (owner decision D4, npc_rank).
+ */
+/mob/living/carbon/human/npc
+ name = "stranger"
+ faction = list(FACTION_HOSTILE)
+ ai_controller = /datum/ai_controller/basic_controller/human_npc
+ /// What it wears and holds: an outfit typepath. Weapons go in its r_hand and l_hand, spare
+ /// magazines in pockets or belt_contents, an air tank with internals_slot set.
+ var/datum/outfit/npc_outfit
+ /**
+ * How it looks. Null: an ordinary random person of the default species. A
+ * /obj/effect/mob_spawn typepath: that spawner's species, hair and skin, and its outfit if
+ * npc_outfit is unset (the corpse spawners of today's NPCs). spawn_human_npc(look =) also takes a
+ * /datum/bounty_look or a /datum/bounty_record.
+ */
+ var/npc_look
+ /// Its name. Null keeps the random name its look rolled.
+ var/npc_name
+ /// HUMAN_NPC_RANK_*. Only elites and bosses land aimed crits and gun executions.
+ var/npc_rank = HUMAN_NPC_RANK_REGULAR
+ /**
+ * Toughness: brute and burn damage taken is multiplied by this, through the body's physiology,
+ * as species and cyberware do it for players. Never touches stamina or stuns. 1 is a person.
+ * Change it on a live NPC with set_npc_toughness().
+ */
+ var/npc_damage_taken = 1
+ /// A /datum/armor added to the body's own physiology armour (dermal plating on a player). Null for none.
+ var/datum/armor/npc_body_armor
+ /**
+ * Cyberware organ typepaths installed at spawn (voidcrew/modules/cyberware/). It works as it does
+ * in a player: a dodge shunt dodges, plating armours, a brownout browns out. It burns out to scrap
+ * when the NPC dies or the ware is taken out of it (owner ruling), so it is never salvaged working.
+ */
+ var/list/npc_cyberware
+ /**
+ * Handles its own air the way a person does (npc_update_internals()): opens a tank it carries when
+ * the air it would breathe is bad and it has a mask or helmet that takes one, and closes the valve
+ * again once the air is fine, so its tank doesn't run dry in a breathable room.
+ */
+ var/npc_internals = TRUE
+ /// Typepaths spawned under it the first time it dies (its designed loot). Never a second time.
+ var/list/npc_death_loot
+ /// Credits dropped as a holochip the first time it dies.
+ var/npc_death_cash = 0
+ /// How long its corpse lies before SShuman_npcs may delete it once nobody is near. 0: never; the
+ /// system that owns the NPC cleans it up.
+ var/npc_corpse_lifetime = HUMAN_NPC_CORPSE_LIFETIME
+ /// Apply the dormancy and life trims. Only the measurement harness turns this off.
+ var/npc_trim_life = TRUE
+
+ // ===== Per-family behaviour (phase A2). A family sets these on its own subtype. =====
+ /**
+ * Picks its outfit by zone and rank when npc_outfit is unset: a /datum/human_npc_outfit_table typepath
+ * (human_npc_outfits.dm). spawn_human_npc(outfit =) also takes a table.
+ */
+ var/datum/human_npc_outfit_table/npc_outfit_table
+ /// HUMAN_NPC_SITE_* flags it always dresses for, on top of the air where it spawns: a boarder that
+ /// crosses vacuum sets HUMAN_NPC_SITE_VACUUM so it carries a sealed suit even when it spawns indoors.
+ var/npc_always_site = NONE
+ /// What it says when things happen to it: a /datum/human_npc_voice typepath (human_npc_barks.dm), or
+ /// null for nothing. Override npc_bark() to voice it another way.
+ var/datum/human_npc_voice/npc_voice
+ /// When it gives up: a /datum/human_npc_surrender typepath (human_npc_surrender.dm), or null if it never does.
+ var/datum/human_npc_surrender/npc_surrender
+ /**
+ * The worst state a target can be in and still get attacked, written into its AI's
+ * BB_TARGET_MINIMUM_STAT at spawn: HUMAN_NPC_FINISHES_DOWNED (pirates, troopers, hermits) or
+ * HUMAN_NPC_SPARES_DOWNED (criminals, bosses, prisoners, guards).
+ */
+ var/npc_target_stat = HUMAN_NPC_FINISHES_DOWNED
+ /// D3: its kit is locked to its body. Prisoners turn this off (owner ruling OC-11): their jumpsuits,
+ /// contraband and shivs are ordinary items that shakedowns and confiscation work on.
+ var/npc_gear_locked = TRUE
+ /**
+ * How it fights stun weapons (human_npc_combat_sense.dm): its family's /datum/npc_combat_sense typepath,
+ * or null for none. Only armed hostiles set it, never civilians, townsfolk or prisoners. Its controller
+ * must list /datum/ai_planning_subtree/npc_combat_sense.
+ */
+ var/datum/npc_combat_sense/npc_combat_sense
+
+ /// The HUMAN_NPC_SITE_* flags it was dressed for
+ var/npc_site = NONE
+ /// The bark kind it last gave, for tests and admins
+ var/npc_last_bark
+ COOLDOWN_DECLARE(npc_bark_cooldown)
+ /// world.time it may next plead while down in soft crit
+ var/npc_next_plead = 0
+ /// TRUE while the paralysis of its own *surrender runs
+ var/npc_surrendering = FALSE
+ /// Set when a surrender's paralysis ended with nobody cuffing it: it decides again at once
+ var/npc_surrender_redecide = FALSE
+ /// world.time it may next roll to surrender
+ var/npc_next_surrender_roll = 0
+ /// How many times it has rolled to give up, and how many times it did
+ var/npc_surrender_rolls = 0
+ var/npc_surrender_count = 0
+ /// Weakref to whoever held it when it last resisted, and the world.time it did
+ var/datum/weakref/npc_resisted_hold
+ var/npc_resisted_at = 0
+ /// The turf it is walking out to (npc_walk_out()), or null
+ var/turf/npc_exit
+ /// Called with it just before it is deleted on walking out
+ var/datum/callback/npc_on_left
+
+ /// TRUE once its death loot has dropped
+ var/npc_loot_dropped = FALSE
+ /// world.time it last died, or 0
+ var/npc_died_at = 0
+ /// world.time its current dormant spell began, or 0 while awake
+ var/npc_dormant_since = 0
+ /// The damage multiplier set_npc_toughness() last applied
+ var/npc_damage_taken_applied = 1
+ /// Weakrefs to limbs and organs that came off it, cleaned up with its corpse
+ var/list/datum/weakref/npc_remains
+
+/mob/living/carbon/human/npc/Initialize(mapload, datum/human_npc_order/order)
+ . = ..()
+ if(npc_trim_life)
+ ADD_TRAIT(src, TRAIT_NOHUNGER, INNATE_TRAIT)
+ npc_dress(order)
+ for(var/ware_type in npc_cyberware)
+ npc_install_cyberware(ware_type)
+ npc_conceal_presence()
+ if(npc_gear_locked)
+ npc_lock_all_gear()
+ for(var/obj/item/held as anything in held_items)
+ if(held)
+ human_npc_ready_weapon(src, held)
+ npc_update_internals()
+ npc_set_suit_heating(TRUE)
+ set_npc_toughness(npc_damage_taken)
+ if(npc_body_armor)
+ physiology.armor = physiology.armor.add_other_armor(npc_body_armor)
+ if(istype(ai_controller))
+ ai_controller.set_blackboard_key(BB_TARGET_MINIMUM_STAT, npc_target_stat)
+ AddElement(/datum/element/human_npc_body)
+ AddElement(/datum/element/human_npc_reactions)
+ if(ispath(npc_combat_sense, /datum/npc_combat_sense))
+ AddComponent(/datum/component/npc_combat_sense, npc_combat_sense)
+
+/mob/living/carbon/human/npc/Destroy()
+ SShuman_npcs?.forget_corpse(src)
+ SShuman_npcs?.leavers -= src
+ npc_remains = null
+ npc_resisted_hold = null
+ npc_exit = null
+ npc_on_left = null
+ return ..()
+
+/mob/living/carbon/human/npc/setup_mood()
+ if(npc_trim_life)
+ return
+ return ..()
+
+// ===== DORMANCY =====
+
+/mob/living/carbon/human/npc/Life(seconds_per_tick = SSMOBS_DT, times_fired)
+ if(npc_trim_life)
+ if(npc_dormant())
+ if(!npc_dormant_since)
+ npc_dormant_since = world.time
+ npc_set_suit_heating(FALSE)
+ return FALSE
+ if(npc_dormant_since)
+ npc_catch_up_decay((world.time - npc_dormant_since) / (1 SECONDS), times_fired)
+ npc_dormant_since = 0
+ npc_set_suit_heating(TRUE)
+ // Before the breath this Life() takes: a person who steps into bad air reaches for the valve.
+ if(stat != DEAD)
+ npc_update_internals()
+#ifdef HUMAN_NPC_SPIKE_HARNESS
+ GLOB.human_npc_spike_life_passes++
+#endif
+ return ..()
+
+/// TRUE while this NPC's Life() should not run: no player is on its z-level.
+/mob/living/carbon/human/npc/proc/npc_dormant()
+ return !npc_players_on_level()
+
+/// Whether any living player shares this NPC's z-level. Same test as get_expected_ai_status().
+/mob/living/carbon/human/npc/proc/npc_players_on_level()
+ var/turf/our_turf = get_turf(src)
+ if(isnull(our_turf))
+ return FALSE
+ return length(SSmobs.clients_by_zlevel[our_turf.z]) > 0
+
+/**
+ * A corpse that slept for `slept_seconds` decays its organs for that long at once, through tg's own
+ * handle_organs() (which skips frozen and robotic organs and bodies kept in formaldehyde or
+ * cryostylane), so its defib window closes when a player's would. A living NPC catches nothing up.
+ */
+/mob/living/carbon/human/npc/proc/npc_catch_up_decay(slept_seconds, times_fired)
+ if(stat != DEAD || slept_seconds <= 0 || HAS_TRAIT(src, TRAIT_STASIS))
+ return
+ handle_organs(slept_seconds, times_fired)
+
+// ===== DRESSING =====
+
+/**
+ * Puts on its look, outfit, name and faction. `order` may override the type's own.
+ *
+ * The outfit is, first found: the order's outfit, npc_outfit, a pick from npc_outfit_table, or the
+ * outfit of a spawner look. An outfit table (as the order's outfit or npc_outfit_table) picks by the
+ * zone it spawns in and its rank. Then the site layers go on (human_npc_outfits.dm): where the air
+ * can't keep it alive it gets a sealed suit and a tank, where it is cold it gets cold-weather wear, so
+ * no NPC suffocates or freezes on the spot it was made. Species that don't need them (skeletons in
+ * vacuum) are left as they are.
+ */
+/mob/living/carbon/human/npc/proc/npc_dress(datum/human_npc_order/order)
+ var/look = order?.look || npc_look
+ var/outfit = order?.outfit || npc_outfit
+ var/datum/human_npc_outfit_table/table
+ if(ispath(outfit, /datum/human_npc_outfit_table))
+ table = outfit
+ outfit = null
+ else if(isnull(outfit) && ispath(npc_outfit_table, /datum/human_npc_outfit_table))
+ table = npc_outfit_table
+ var/datum/bounty_record/record
+ if(istype(look, /datum/bounty_record))
+ record = look
+ look = bounty_ensure_look(record)
+ var/spawner_outfit
+ if(ispath(look, /obj/effect/mob_spawn))
+ spawner_outfit = npc_apply_spawner_look(look)
+ else if(istype(look, /datum/bounty_look))
+ npc_apply_bounty_look(look)
+ else
+ npc_apply_random_look()
+ // Plasmamen and other species that need their own kit to live get it first, as from a spawner.
+ dna.species.give_important_for_life(src)
+ if(table)
+ table = human_npc_singleton(table)
+ outfit = table.pick_outfit(src, order ? order.resolve_zone() : npc_spawn_zone())
+ outfit ||= spawner_outfit
+ // Dressed directly, not through /obj/effect/mob_spawn/equip(), whose ladder strip
+ // (voidcrew/edits/mobs/ladder_outfits.dm) would delete the guns an NPC fights with.
+ if(outfit)
+ outfit = npc_fit_outfit_to_site(outfit, table)
+ equipOutfit(outfit)
+ if(record)
+ bounty_wear_features(src, record.features)
+ var/new_name = order?.name || npc_name
+ if(new_name)
+ fully_replace_character_name(real_name, new_name)
+ if(length(order?.faction))
+ faction = order.faction.Copy()
+
+/// An ordinary random person, as tg's corpse spawners make them.
+/mob/living/carbon/human/npc/proc/npc_apply_random_look()
+ randomize_human_normie(src, update_body = FALSE)
+ update_body(is_creating = TRUE)
+
+/// The look of a /obj/effect/mob_spawn typepath, applied the way its special() applies it. Returns its outfit.
+/mob/living/carbon/human/npc/proc/npc_apply_spawner_look(obj/effect/mob_spawn/spawner)
+ var/datum/species/species = initial(spawner.mob_species)
+ if(ispath(species, /datum/species) && dna.species.type != species)
+ set_species(species)
+ underwear = "Nude"
+ undershirt = "Nude"
+ socks = "Nude"
+ randomize_human_normie(src, update_body = FALSE)
+ var/hairstyle = initial(spawner.hairstyle)
+ if(hairstyle)
+ set_hairstyle(hairstyle, update = FALSE)
+ var/facial_hairstyle = initial(spawner.facial_hairstyle)
+ if(facial_hairstyle)
+ set_facial_hairstyle(facial_hairstyle, update = FALSE)
+ var/haircolor = initial(spawner.haircolor)
+ if(haircolor)
+ set_haircolor(haircolor, update = FALSE)
+ var/facial_haircolor = initial(spawner.facial_haircolor)
+ if(facial_haircolor)
+ set_facial_haircolor(facial_haircolor, update = FALSE)
+ var/spawner_skin = initial(spawner.skin_tone)
+ if(spawner_skin)
+ skin_tone = spawner_skin
+ update_body(is_creating = TRUE)
+ return initial(spawner.outfit)
+
+/// A bounty record's face (voidcrew/modules/bounties/), applied in the order bounty_dress_dummy() uses.
+/mob/living/carbon/human/npc/proc/npc_apply_bounty_look(datum/bounty_look/look)
+ // Before the species: its visible organs take their shape from dna.features as they go in.
+ for(var/feature in look.features)
+ dna.features[feature] = look.features[feature]
+ gender = look.physique == FEMALE ? FEMALE : MALE
+ physique = gender
+ if(ispath(look.species, /datum/species) && dna.species.type != look.species)
+ set_species(look.species)
+ if(look.skin_tone)
+ skin_tone = look.skin_tone
+ set_hairstyle(look.hairstyle || "Bald", update = FALSE)
+ if(look.hair_color)
+ set_haircolor(look.hair_color, update = FALSE)
+ set_facial_hairstyle(look.facial_hairstyle || "Shaved", update = FALSE)
+ if(look.facial_hair_color || look.hair_color)
+ set_facial_haircolor(look.facial_hair_color || look.hair_color, update = FALSE)
+ if(look.eye_color)
+ set_eye_color(look.eye_color)
+ underwear = "Nude"
+ undershirt = "Nude"
+ socks = "Nude"
+ update_body(is_creating = TRUE)
+
+/// Keeps its PDA off messenger lists and its suit sensors off crew monitors, as corpse spawners do.
+/mob/living/carbon/human/npc/proc/npc_conceal_presence()
+ var/obj/item/modular_computer/pda/messenger = locate() in src
+ if(messenger)
+ var/datum/computer_file/program/messenger/message_app = locate() in messenger.stored_files
+ if(message_app)
+ message_app.invisible = TRUE
+ var/obj/item/clothing/under/sensor_clothes = w_uniform
+ if(istype(sensor_clothes))
+ sensor_clothes.sensor_mode = SENSOR_OFF
+ update_suit_sensors()
+
+/**
+ * Opens or closes its internals for the air where it stands, as a person minds their valve: open while
+ * the air would hurt it (too thin, short of what its lungs need, poisonous), closed while it is fine. A
+ * conscious NPC only; one that can't use its hands (cuffs, a stun) leaves the valve as it is, as would a
+ * person. Species that don't breathe, or that only live on what's in their tank (plasmamen), keep it
+ * as it is. Called from Life() and when it is dressed.
+ */
+/mob/living/carbon/human/npc/proc/npc_update_internals()
+ if(!npc_internals || HAS_TRAIT(src, TRAIT_NOBREATH))
+ return
+ if(stat > SOFT_CRIT || HAS_TRAIT(src, TRAIT_HANDS_BLOCKED))
+ return
+ var/obj/item/organ/lungs/lungs = get_organ_slot(ORGAN_SLOT_LUNGS)
+ if(isnull(lungs))
+ return
+ // Lungs that need something ordinary air doesn't have: whatever it was dressed with stays on.
+ if(lungs.safe_plasma_min > 0 || lungs.safe_nitro_min > 0)
+ return
+ var/bad_air = human_npc_air_hurts(get_turf(src), lungs, margin = internal ? HUMAN_NPC_AIR_MARGIN : 0)
+ if(bad_air)
+ if(!internal)
+ npc_open_internals()
+ else if(internal && !external)
+ close_internals()
+
+/// Turns on an air tank it wears, if it has something to breathe it through, the way a player does.
+/mob/living/carbon/human/npc/proc/npc_open_internals()
+ if(internal || !can_breathe_internals())
+ return
+ for(var/obj/item/tank/internals/tank in get_equipped_items(INCLUDE_POCKETS | INCLUDE_HELD))
+ if(tank.air_contents?.return_pressure() <= 0)
+ continue
+ if(open_internals(tank))
+ return
+
+/**
+ * Whether breathing the air at `spot` would hurt someone with `lungs`: pressure too low or too high,
+ * too little oxygen, or too much plasma, carbon dioxide or sleeping gas, by those lungs' own limits.
+ * `margin` (kPa) asks for that much better than the limit before the air counts as fine again, so a
+ * valve isn't worked every breath at the edge.
+ */
+/proc/human_npc_air_hurts(turf/spot, obj/item/organ/lungs/lungs, margin = 0)
+ var/datum/gas_mixture/air = spot?.return_air()
+ if(isnull(air))
+ return TRUE
+ var/pressure = air.return_pressure()
+ if(pressure < HAZARD_LOW_PRESSURE + margin * 4 || pressure > HAZARD_HIGH_PRESSURE)
+ return TRUE
+ if(lungs.safe_oxygen_min && human_npc_partial_pressure(air, /datum/gas/oxygen, pressure) < lungs.safe_oxygen_min + margin)
+ return TRUE
+ if(lungs.safe_plasma_max && human_npc_partial_pressure(air, /datum/gas/plasma, pressure) > max(lungs.safe_plasma_max - margin * 0.01, 0))
+ return TRUE
+ if(lungs.safe_co2_max && human_npc_partial_pressure(air, /datum/gas/carbon_dioxide, pressure) > lungs.safe_co2_max - margin)
+ return TRUE
+ if(lungs.n2o_para_min && human_npc_partial_pressure(air, /datum/gas/nitrous_oxide, pressure) >= lungs.n2o_para_min)
+ return TRUE
+ return FALSE
+
+/**
+ * Sets how much brute and burn damage it takes, as a multiple of a person's. Scales the
+ * physiology mods it set before, so other changes to them (species, implants) are kept.
+ */
+/mob/living/carbon/human/npc/proc/set_npc_toughness(damage_taken)
+ if(damage_taken <= 0)
+ CRASH("[src] ([type]) was given a damage multiplier of [damage_taken]")
+ var/change = damage_taken / npc_damage_taken_applied
+ physiology.brute_mod *= change
+ physiology.burn_mod *= change
+ npc_damage_taken_applied = damage_taken
+ npc_damage_taken = damage_taken
+
+// ===== RULES OF ENGAGEMENT =====
+
+// The strip menu works as on anyone, but locked gear (D3) carries TRAIT_NO_STRIP, so its slots read as
+// empty and can't be emptied. What isn't gear (a ship key, bounty proof, a paper) can be taken from a
+// cuffed, downed or careless NPC the way it could from a person. An NPC whose gear isn't locked
+// (prisoners, OC-11) is searched and stripped like anyone.
+
+// D4: an NPC's hits become aimed crits and executions only if it is an elite or a boss, or a
+// person is driving the body.
+/mob/living/carbon/human/npc/hv_can_land_aimed_crits()
+ return client || npc_rank >= HUMAN_NPC_RANK_ELITE
+
+// Gun executions are rarer still: bosses only, as a deliberate move (owner ruling OC-9).
+/mob/living/carbon/human/npc/hv_can_execute()
+ return client || npc_rank >= HUMAN_NPC_RANK_BOSS
+
+/mob/living/carbon/human/npc/Login()
+ . = ..()
+ // A player in control of the body (a brain transplant) can't keep its gear (D3). Admins
+ // driving an NPC for an event keep it.
+ if(!. || isnull(client) || client.holder)
+ return
+ npc_delete_locked_gear()
+
+// ===== DEATH AND REMAINS =====
+
+/mob/living/carbon/human/npc/death(gibbed)
+ if(stat == DEAD)
+ return ..()
+ . = ..()
+ if(stat != DEAD)
+ return
+ npc_died_at = world.time
+ npc_drop_death_loot()
+ npc_drop_not_gear()
+ npc_burn_out_chrome()
+ if(!gibbed && npc_corpse_lifetime && !QDELING(src))
+ SShuman_npcs.track_corpse(src)
+
+/// Drops its designed loot under it, once in its life however often it dies.
+/mob/living/carbon/human/npc/proc/npc_drop_death_loot()
+ if(npc_loot_dropped)
+ return
+ npc_loot_dropped = TRUE
+ var/atom/drop_spot = drop_location()
+ if(isnull(drop_spot))
+ return
+ // As death_drops does for basic mobs (voidcrew/edits/mobs/weapon_drops.dm): admin-spawned NPCs drop no guns.
+ var/no_guns = (flags_1 & ADMIN_SPAWNED_1) || npc_spawn_context?.suppress_gun_loot
+ for(var/loot_type in npc_roll_death_loot())
+ if(no_guns && ispath(loot_type, /obj/item/gun))
+ continue
+ new loot_type(drop_spot)
+ if(npc_death_cash > 0)
+ new /obj/item/holochip(drop_spot, npc_death_cash)
+
+/// The typepaths it drops on its first death. Override to roll them (zone ladders, rare pools).
+/mob/living/carbon/human/npc/proc/npc_roll_death_loot()
+ return npc_death_loot
+
+/// Back from the dead (defib, strange reagent): no longer a corpse to clean up.
+/mob/living/carbon/human/npc/proc/npc_revived()
+ npc_died_at = 0
+ SShuman_npcs.forget_corpse(src)
+
+/// A limb or organ came off: remember it, so it goes when the corpse does.
+/mob/living/carbon/human/npc/proc/npc_lost_part(obj/item/part)
+ LAZYADD(npc_remains, WEAKREF(part))
+
+// ===== CYBERWARE =====
+
+/**
+ * Installs a cyberware organ at spawn, the way the cyberware code's own staging inserts do
+ * (special = TRUE skips the install-context gate; the brownout monitor still applies). Returns the
+ * organ, or null if it didn't go in.
+ */
+/mob/living/carbon/human/npc/proc/npc_install_cyberware(ware_type)
+ var/obj/item/organ/ware = new ware_type()
+ if(!ware.GetComponent(/datum/component/cyberware))
+ stack_trace("[type] was given [ware_type] as cyberware, which isn't chrome")
+ qdel(ware)
+ return null
+ if(!ware.Insert(src, special = TRUE))
+ qdel(ware)
+ return null
+ return ware
+
+/// Owner ruling: an NPC's chrome burns out when it dies. Every piece comes out and turns to scrap.
+/mob/living/carbon/human/npc/proc/npc_burn_out_chrome()
+ var/atom/drop_spot = drop_location()
+ var/burnt = 0
+ for(var/obj/item/organ/ware in organs.Copy())
+ if(!ware.GetComponent(/datum/component/cyberware))
+ continue
+ ware.Remove(src, special = TRUE)
+ if(drop_spot)
+ ware.forceMove(drop_spot)
+ human_npc_burn_out_chrome(ware)
+ burnt++
+ if(burnt && drop_spot)
+ do_sparks(min(burnt, 3), TRUE, src)
+ visible_message(span_warning("[src]'s chrome sparks and goes dead."))
+
+/// Turns a piece of a human NPC's chrome that has left its body into scrap where it lies.
+/proc/human_npc_burn_out_chrome(obj/item/organ/ware)
+ if(QDELETED(ware) || ware.owner)
+ return
+ var/turf/floor = get_turf(ware)
+ if(isnull(floor))
+ qdel(ware)
+ return
+ var/mob/living/holder = ismob(ware.loc) ? ware.loc : null
+ var/obj/item/burnt_chrome/scrap = new(floor, ware)
+ qdel(ware)
+ holder?.put_in_hands(scrap)
+
+/// What a human NPC's cyberware leaves once it burns out: scrap, never a working implant.
+/obj/item/burnt_chrome
+ name = "burnt-out chrome"
+ desc = "Cyberware fused black inside. Only good for scrap."
+ icon = 'voidcrew/modules/cyberware/icons/cyberware.dmi'
+ icon_state = "scrapper"
+ w_class = WEIGHT_CLASS_SMALL
+ color = "#4a4a4a"
+ custom_materials = list(/datum/material/iron = SMALL_MATERIAL_AMOUNT)
+
+/obj/item/burnt_chrome/Initialize(mapload, obj/item/organ/ware)
+ . = ..()
+ if(isnull(ware))
+ return
+ name = "burnt-out [format_text(ware.name)]"
+ icon = ware.icon
+ icon_state = ware.icon_state
+
+/**
+ * Listens to a human NPC's body for the base type. An element, not RegisterSignal(src) on the mob,
+ * so a subtype can register these signals on itself without replacing the base's handlers.
+ */
+/datum/element/human_npc_body
+ element_flags = ELEMENT_DETACH_ON_HOST_DESTROY
+
+/datum/element/human_npc_body/Attach(datum/target)
+ . = ..()
+ if(!ishumannpc(target))
+ return ELEMENT_INCOMPATIBLE
+ RegisterSignal(target, COMSIG_CARBON_REMOVE_LIMB, PROC_REF(on_lost_limb))
+ RegisterSignal(target, COMSIG_CARBON_LOSE_ORGAN, PROC_REF(on_lost_organ))
+ RegisterSignal(target, COMSIG_LIVING_REVIVE, PROC_REF(on_revived))
+
+/datum/element/human_npc_body/Detach(datum/source)
+ UnregisterSignal(source, list(COMSIG_CARBON_REMOVE_LIMB, COMSIG_CARBON_LOSE_ORGAN, COMSIG_LIVING_REVIVE))
+ return ..()
+
+/datum/element/human_npc_body/proc/on_lost_limb(mob/living/carbon/human/npc/source, obj/item/bodypart/limb, special, dismembered)
+ SIGNAL_HANDLER
+ if(!special)
+ source.npc_lost_part(limb)
+
+/datum/element/human_npc_body/proc/on_lost_organ(mob/living/carbon/human/npc/source, obj/item/organ/organ, special)
+ SIGNAL_HANDLER
+ // Chrome taken out of an NPC, by surgery, a lost limb, gibbing or dusting, burns out like it does at
+ // death. Next tick, once whatever moved it has put it down.
+ if(organ.GetComponent(/datum/component/cyberware))
+ addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(human_npc_burn_out_chrome), organ), 0)
+ return
+ if(!special)
+ source.npc_lost_part(organ)
+
+/datum/element/human_npc_body/proc/on_revived(mob/living/carbon/human/npc/source, full_heal_flags)
+ SIGNAL_HANDLER
+ source.npc_revived()
+
+/**
+ * Whether its corpse may be cleaned up now: dead for npc_corpse_lifetime, with no player within
+ * HUMAN_NPC_CORPSE_WATCH_RANGE, and not being dragged, carried or held.
+ */
+/mob/living/carbon/human/npc/proc/npc_corpse_expired()
+ if(stat != DEAD || !npc_corpse_lifetime || !npc_died_at)
+ return FALSE
+ if(world.time < npc_died_at + npc_corpse_lifetime)
+ return FALSE
+ if(pulledby || buckled || ismob(loc))
+ return FALSE
+ return !human_npc_watched(src)
+
+/// Deletes its corpse, and the limbs and organs it lost that lie unwatched on the floor.
+/mob/living/carbon/human/npc/proc/npc_fade()
+ for(var/datum/weakref/remain_ref as anything in npc_remains)
+ var/obj/item/remain = remain_ref.resolve()
+ if(QDELETED(remain) || !isturf(remain.loc) || remain.pulledby)
+ continue
+ var/obj/item/bodypart/limb = remain
+ if(istype(limb) && limb.owner)
+ continue
+ var/obj/item/organ/organ = remain
+ if(istype(organ) && organ.owner)
+ continue
+ if(human_npc_watched(remain))
+ continue
+ qdel(remain)
+ npc_remains = null
+ qdel(src)
+
+/// Whether a player is within HUMAN_NPC_CORPSE_WATCH_RANGE of `thing`.
+/proc/human_npc_watched(atom/thing)
+ var/turf/spot = get_turf(thing)
+ if(isnull(spot) || !length(SSmobs.clients_by_zlevel[spot.z]))
+ return FALSE
+ for(var/mob/viewer as anything in SSspatial_grid.orthogonal_range_search(spot, SPATIAL_GRID_CONTENTS_TYPE_CLIENTS, HUMAN_NPC_CORPSE_WATCH_RANGE))
+ if(get_dist(viewer, spot) <= HUMAN_NPC_CORPSE_WATCH_RANGE)
+ return TRUE
+ return FALSE
+
+/// Whether tg weather should act on `candidate`, a mob that has never had a mind: a human NPC that
+/// isn't dormant. Read by the mind gates in tg's weather code.
+/proc/human_npc_weathered(mob/living/candidate)
+ if(!ishumannpc(candidate))
+ return FALSE
+ var/mob/living/carbon/human/npc/npc = candidate
+ return !npc.npc_dormant()
+
+/// Shared instances of the per-family rule datums (voices, surrender rules, outfit tables, site layers),
+/// one per type, made on first use.
+GLOBAL_LIST_EMPTY(human_npc_singletons)
+
+/// The shared instance of `datum_type`.
+/proc/human_npc_singleton(datum_type)
+ var/datum/instance = GLOB.human_npc_singletons[datum_type]
+ if(isnull(instance))
+ instance = new datum_type()
+ GLOB.human_npc_singletons[datum_type] = instance
+ return instance
+
+/**
+ * The zone it was made in, for outfit tables: its spawn context's zone, else the zone of where it
+ * stands (a ship's overmap tile when aboard one), else green, the weakest.
+ */
+/mob/living/carbon/human/npc/proc/npc_spawn_zone()
+ return npc_spawn_context?.zone_type || get_zone_type_for_player_turf(get_turf(src)) || ZONE_GREEN
+
+/**
+ * Switches its space suit's thermal regulator on or off, as a player does with the suit's button. On only
+ * where it was dressed for vacuum or cold, and never for a corpse. Off while dormant (see the top of this
+ * file).
+ */
+/mob/living/carbon/human/npc/proc/npc_set_suit_heating(on)
+ if(on && (stat == DEAD || !(npc_site & (HUMAN_NPC_SITE_VACUUM | HUMAN_NPC_SITE_COLD))))
+ return
+ var/obj/item/clothing/suit/space/suit = wear_suit
+ if(istype(suit) && suit.thermal_on != !!on)
+ suit.toggle_spacesuit(src)
diff --git a/voidcrew/modules/human_npcs/human_npc_admin.dm b/voidcrew/modules/human_npcs/human_npc_admin.dm
new file mode 100644
index 00000000000..88da89ce822
--- /dev/null
+++ b/voidcrew/modules/human_npcs/human_npc_admin.dm
@@ -0,0 +1,30 @@
+// Admin debug tool: spawn human NPCs around yourself, through the same throttled queue the game uses.
+
+ADMIN_VERB(spawn_human_npcs, R_SPAWN|R_DEBUG, "Spawn Human NPCs", "Spawn human NPCs of one type around you, built a few per tick.", ADMIN_CATEGORY_DEBUG)
+ var/turf/center = get_turf(user.mob)
+ if(isnull(center))
+ to_chat(user, span_warning("You need to be standing somewhere."), confidential = TRUE)
+ return
+ var/list/choices = list()
+ for(var/npc_type in subtypesof(/mob/living/carbon/human/npc))
+ var/mob/living/carbon/human/npc/npc_path = npc_type
+ choices["[initial(npc_path.npc_name) || initial(npc_path.name)] ([npc_type])"] = npc_type
+ var/choice = tgui_input_list(user, "Which human NPC?", "Spawn Human NPCs", sort_list(choices))
+ if(isnull(choice) || isnull(choices[choice]))
+ return
+ var/count = tgui_input_number(user, "How many?", "Spawn Human NPCs", 1, 50, 1)
+ if(!count)
+ return
+ var/list/spots = list()
+ for(var/turf/open/spot in RANGE_TURFS(3, center))
+ if(!spot.is_blocked_turf(exclude_mobs = TRUE))
+ spots += spot
+ if(!length(spots))
+ spots += center
+ var/npc_type = choices[choice]
+ var/datum/callback/mark = CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(human_npc_mark_admin_spawned))
+ for(var/i in 1 to count)
+ spawn_human_npc(npc_type, pick(spots), on_spawned = mark)
+ log_admin("[key_name(user)] spawned [count] [npc_type] at [AREACOORD(center)]")
+ message_admins("[key_name_admin(user)] spawned [count] [npc_type] at [ADMIN_VERBOSEJMP(center)]")
+ BLACKBOX_LOG_ADMIN_VERB("Spawn Human NPCs")
diff --git a/voidcrew/modules/human_npcs/human_npc_ai.dm b/voidcrew/modules/human_npcs/human_npc_ai.dm
new file mode 100644
index 00000000000..4d6675b26b8
--- /dev/null
+++ b/voidcrew/modules/human_npcs/human_npc_ai.dm
@@ -0,0 +1,540 @@
+/**
+ * # Human NPC AI
+ *
+ * Fights through the body's own hands, the way a player does. Everything goes through
+ * controller.ai_interact(), which is a player's click (tg's monkey AI and ranged_skirmish use it too):
+ * - a gun is fired by clicking the target with it, so the gun's real fire path runs: fire delay,
+ * firing pin, projectile, casing, recoil, wounds and the hyperviolence executions;
+ * - a melee weapon (or a fist) hits through the real attack chain;
+ * - a reload is the player's reload: the spare magazine comes out of a pocket, belt or bag into the
+ * free hand, the gun is clicked with it (tg's insert or tactical reload), the bolt is racked by
+ * using the gun, and the empty magazine is dropped. Nothing refills from nowhere. When the spares
+ * run out it draws another weapon it carries, or fights with what it holds.
+ *
+ * tg's basic controller already stops the AI at any stat above CONSCIOUS and while stunned, knocked
+ * out, in stamcrit or in stasis. It also stops while cuffed, which would keep tg's escape_captivity
+ * subtree from ever working the cuffs; get_able_to_run() below lets a cuffed or grabbed NPC struggle the
+ * way a player does (resist), and do_after()s pause it so a breakout isn't cut short by walking. It also
+ * lets the AI run in soft crit, where only the soft-crit subtree plans (human_npc_soft_crit.dm).
+ *
+ * The AI goes off with the body's dormancy: tg switches it off while no player is on the z-level, the
+ * same test human_npc.dm uses for Life().
+ *
+ * Planning order: soft crit (plead, medipen, elites fire wild), escape captivity, walk out (human_npc_states.dm),
+ * surrender (human_npc_surrender.dm), then find a target, combat sense for the types that have it
+ * (human_npc_combat_sense.dm), arm, shoot, melee.
+ *
+ * Phase B (PR #500's pirate crews) can drop these subtrees into its own planning lists:
+ * human_npc_arm, human_npc_shoot and human_npc_melee need only BB_BASIC_MOB_CURRENT_TARGET and
+ * BB_TARGETING_STRATEGY; the shooting keys have defaults. The helper procs at the bottom are for
+ * any behaviour that has to handle a human NPC's weapons.
+ */
+
+/datum/ai_controller/basic_controller/human_npc
+ blackboard = list(
+ BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/human_npc,
+ BB_TARGET_MINIMUM_STAT = HARD_CRIT,
+ BB_AGGRO_RANGE = HUMAN_NPC_SIGHT_RANGE,
+ BB_HUMAN_NPC_SHOT_DELAY = 3 SECONDS,
+ BB_HUMAN_NPC_FIRE_RANGE = 7,
+ BB_HUMAN_NPC_KEEP_AWAY = 2,
+ )
+ ai_movement = /datum/ai_movement/basic_avoidance
+ idle_behavior = /datum/idle_behavior/idle_random_walk/less_walking
+ planning_subtrees = list(
+ /datum/ai_planning_subtree/human_npc_soft_crit,
+ /datum/ai_planning_subtree/escape_captivity,
+ /datum/ai_planning_subtree/human_npc_walk_out,
+ /datum/ai_planning_subtree/human_npc_surrender,
+ /datum/ai_planning_subtree/simple_find_target,
+ /datum/ai_planning_subtree/npc_combat_sense,
+ /datum/ai_planning_subtree/human_npc_arm,
+ /datum/ai_planning_subtree/human_npc_shoot,
+ /datum/ai_planning_subtree/human_npc_melee,
+ )
+
+/datum/ai_controller/basic_controller/human_npc/TryPossessPawn(atom/new_pawn)
+ if(!ishuman(new_pawn))
+ return AI_CONTROLLER_INCOMPATIBLE
+ // Relays who hit us, so we turn on someone shooting from where we weren't looking
+ new_pawn.AddElement(/datum/element/relay_attackers)
+ RegisterSignal(new_pawn, COMSIG_ATOM_WAS_ATTACKED, PROC_REF(on_pawn_attacked))
+ return ..()
+
+/datum/ai_controller/basic_controller/human_npc/UnpossessPawn(destroy)
+ if(pawn)
+ UnregisterSignal(pawn, COMSIG_ATOM_WAS_ATTACKED)
+ return ..()
+
+// The basic controller's own check, except that cuffs and soft crit don't stop us (see the top of this
+// file, and human_npc_soft_crit.dm).
+/datum/ai_controller/basic_controller/human_npc/get_able_to_run()
+ return human_npc_ai_able_to_run(src)
+
+/datum/ai_controller/basic_controller/human_npc/on_stat_changed(mob/living/source, new_stat)
+ . = ..()
+ human_npc_ai_stat_changed(src, new_stat)
+
+/// Someone hit us: with nothing else to fight, fight them, if we can see them.
+/datum/ai_controller/basic_controller/human_npc/proc/on_pawn_attacked(mob/living/source, atom/attacker, attack_flags)
+ SIGNAL_HANDLER
+ if(source == attacker || QDELETED(attacker) || blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET))
+ return
+ var/datum/targeting_strategy/strategy = GET_TARGETING_STRATEGY(blackboard[BB_TARGETING_STRATEGY])
+ if(strategy?.can_attack(source, attacker))
+ set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, attacker)
+
+// ===== TARGETING =====
+
+/**
+ * tg's basic targeting, but a check made without a range (target finding filters its candidates
+ * that way) uses the NPC's sight range instead of can_see()'s default of 5 tiles. It also never
+ * picks someone in another packed encounter on the same z-level, who can't be reached across the
+ * cordon (the containment the old simple-animal hostiles have in ListTargetsLazy()).
+ */
+/datum/targeting_strategy/basic/human_npc
+
+/datum/targeting_strategy/basic/human_npc/can_attack(mob/living/living_mob, atom/the_target, vision_range)
+ if(isnull(vision_range))
+ vision_range = living_mob.ai_controller?.blackboard[BB_AGGRO_RANGE] || HUMAN_NPC_SIGHT_RANGE
+ if(!..(living_mob, the_target, vision_range))
+ return FALSE
+ return !map_region_excludes_turf(map_region_for_turf(get_turf(living_mob)), get_turf(the_target))
+
+// ===== ARMING: RELOAD OR DRAW =====
+
+/// Keeps a usable weapon in hand: reloads a spent gun from the magazines it carries, or draws another weapon.
+/datum/ai_planning_subtree/human_npc_arm
+
+/datum/ai_planning_subtree/human_npc_arm/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/carbon/npc = controller.pawn
+ if(HAS_TRAIT(npc, TRAIT_HANDS_BLOCKED) || LAZYLEN(npc.do_afters))
+ return
+ if(world.time < controller.blackboard[BB_HUMAN_NPC_ARMING_RETRY_AT])
+ return
+ var/obj/item/gun/gun = human_npc_held_gun(npc)
+ if(gun?.can_shoot())
+ return
+ if(human_npc_can_reload(npc, gun))
+ controller.queue_behavior(/datum/ai_behavior/human_npc_reload)
+ return SUBTREE_RETURN_FINISH_PLANNING
+ if(human_npc_held_melee_weapon(npc))
+ return
+ var/obj/item/backup = human_npc_backup_weapon(npc)
+ if(isnull(backup))
+ return
+ controller.set_blackboard_key(BB_HUMAN_NPC_DRAW_ITEM, backup)
+ controller.queue_behavior(/datum/ai_behavior/human_npc_draw, BB_HUMAN_NPC_DRAW_ITEM)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/**
+ * A player's reload, one step per action: drop the spent magazine, rack a loaded gun, take a spare
+ * into the free hand, click the gun with it. Fails, and the NPC fights on with something else, if
+ * it has no spare or no hand free.
+ */
+/datum/ai_behavior/human_npc_reload
+ action_cooldown = 0.8 SECONDS
+ /// Gives up after this long, so a gun that won't take what it carries can't hold the NPC forever
+ var/give_up_after = 8 SECONDS
+
+/datum/ai_behavior/human_npc_reload/setup(datum/ai_controller/controller)
+ . = ..()
+ var/mob/living/carbon/npc = controller.pawn
+ var/obj/item/gun/ballistic/gun = human_npc_held_gun(npc)
+ if(!istype(gun))
+ return FALSE
+ controller.set_blackboard_key(BB_HUMAN_NPC_RELOAD_UNTIL, world.time + give_up_after)
+ npc.visible_message(span_notice("[npc] reloads [gun]."))
+
+/datum/ai_behavior/human_npc_reload/perform(seconds_per_tick, datum/ai_controller/controller)
+ var/mob/living/carbon/npc = controller.pawn
+ var/obj/item/gun/ballistic/gun = human_npc_held_gun(npc)
+ if(!istype(gun) || world.time >= controller.blackboard[BB_HUMAN_NPC_RELOAD_UNTIL])
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ var/obj/item/spent = human_npc_spent_ammo_in_hand(npc, gun)
+ if(spent)
+ npc.dropItemToGround(spent, force = TRUE)
+ return AI_BEHAVIOR_DELAY
+ if(gun.can_shoot())
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
+ if(human_npc_gun_needs_rack(gun))
+ if(!human_npc_ready_item(npc, gun))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ controller.ai_interact(target = gun, combat_mode = FALSE)
+ return AI_BEHAVIOR_DELAY
+ var/obj/item/ammo = human_npc_find_ammo(npc, gun)
+ if(isnull(ammo))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ if(!npc.is_holding(ammo))
+ if(!human_npc_take_in_hand(npc, ammo))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ return AI_BEHAVIOR_DELAY
+ if(!human_npc_ready_item(npc, ammo))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ controller.ai_interact(target = gun, combat_mode = FALSE)
+ return AI_BEHAVIOR_DELAY
+
+/datum/ai_behavior/human_npc_reload/finish_action(datum/ai_controller/controller, succeeded)
+ . = ..()
+ // A reload that got nowhere isn't tried again straight away; the NPC fights with what it has.
+ controller.set_blackboard_key(BB_HUMAN_NPC_ARMING_RETRY_AT, succeeded ? 0 : world.time + 10 SECONDS)
+
+/// Takes another weapon it carries into hand: a loaded gun, or failing that a melee weapon.
+/datum/ai_behavior/human_npc_draw
+ action_cooldown = 0.6 SECONDS
+
+/datum/ai_behavior/human_npc_draw/perform(seconds_per_tick, datum/ai_controller/controller, item_key)
+ var/mob/living/carbon/npc = controller.pawn
+ var/obj/item/weapon = controller.blackboard[item_key]
+ if(QDELETED(weapon) || human_npc_holding(weapon) != npc)
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ if(!npc.is_holding(weapon))
+ if(!length(npc.get_empty_held_indexes()))
+ // Both hands full: holster the spent gun first, if it has somewhere to go.
+ var/obj/item/gun/spent = human_npc_held_gun(npc)
+ if(isnull(spent) || spent.can_shoot() || !spent.equip_to_best_slot(npc))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ return AI_BEHAVIOR_DELAY
+ if(!human_npc_take_in_hand(npc, weapon))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ human_npc_ready_item(npc, weapon)
+ human_npc_ready_weapon(npc, weapon)
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
+
+/datum/ai_behavior/human_npc_draw/finish_action(datum/ai_controller/controller, succeeded, item_key)
+ . = ..()
+ controller.clear_blackboard_key(item_key)
+ if(!succeeded)
+ controller.set_blackboard_key(BB_HUMAN_NPC_ARMING_RETRY_AT, world.time + 10 SECONDS)
+
+// ===== SHOOTING =====
+
+/**
+ * With a loaded gun in hand: shoots the target from up to BB_HUMAN_NPC_FIRE_RANGE, stepping back
+ * from anyone closer than BB_HUMAN_NPC_KEEP_AWAY, and closes in when it can't see them or they are
+ * too far.
+ */
+/datum/ai_planning_subtree/human_npc_shoot
+
+/datum/ai_planning_subtree/human_npc_shoot/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/atom/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
+ if(QDELETED(target))
+ return
+ var/mob/living/carbon/npc = controller.pawn
+ if(HAS_TRAIT(npc, TRAIT_HANDS_BLOCKED) || isnull(human_npc_loaded_gun(npc)))
+ return
+ var/fire_range = controller.blackboard[BB_HUMAN_NPC_FIRE_RANGE] || 7
+ var/distance = get_dist(npc, target)
+ if(distance <= fire_range && can_see(npc, target, fire_range))
+ var/keep_away = controller.blackboard[BB_HUMAN_NPC_KEEP_AWAY]
+ if(keep_away && distance < keep_away && !LAZYLEN(npc.do_afters))
+ controller.queue_behavior(/datum/ai_behavior/step_away, BB_BASIC_MOB_CURRENT_TARGET)
+ controller.queue_behavior(/datum/ai_behavior/human_npc_shoot, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETING_STRATEGY, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION)
+ else
+ controller.queue_behavior(/datum/ai_behavior/human_npc_close_in, BB_BASIC_MOB_CURRENT_TARGET, fire_range)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/// One pull of the trigger, then a wait of BB_HUMAN_NPC_SHOT_DELAY. Doesn't hold up planning.
+/datum/ai_behavior/human_npc_shoot
+ action_cooldown = 0.5 SECONDS
+ behavior_flags = AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
+
+/datum/ai_behavior/human_npc_shoot/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key)
+ var/mob/living/carbon/npc = controller.pawn
+ var/atom/target = controller.blackboard[target_key]
+ var/datum/targeting_strategy/strategy = GET_TARGETING_STRATEGY(controller.blackboard[targeting_strategy_key])
+ if(QDELETED(target) || !strategy?.can_attack(npc, target))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ var/obj/item/gun/gun = human_npc_loaded_gun(npc)
+ if(isnull(gun))
+ // Empty now: the next plan reloads or changes weapon.
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
+ if(world.time < controller.blackboard[BB_HUMAN_NPC_NEXT_SHOT])
+ return AI_BEHAVIOR_DELAY
+ var/atom/hiding_target = strategy.find_hidden_mobs(npc, target)
+ controller.set_blackboard_key(hiding_location_key, hiding_target)
+ var/atom/final_target = hiding_target || target
+ if(human_npc_ally_in_line(npc, final_target))
+ human_npc_sidestep(npc, final_target)
+ return AI_BEHAVIOR_DELAY
+ if(!human_npc_ready_item(npc, gun))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ npc.zone_selected = human_npc_pick_aim_zone()
+ controller.ai_interact(target = final_target, combat_mode = TRUE)
+ controller.set_blackboard_key(BB_HUMAN_NPC_NEXT_SHOT, world.time + (controller.blackboard[BB_HUMAN_NPC_SHOT_DELAY] || 3 SECONDS))
+ return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED
+
+/// Walks at the target until it is within `range` and in sight.
+/datum/ai_behavior/human_npc_close_in
+ behavior_flags = AI_BEHAVIOR_REQUIRE_MOVEMENT | AI_BEHAVIOR_MOVE_AND_PERFORM | AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
+
+/datum/ai_behavior/human_npc_close_in/setup(datum/ai_controller/controller, target_key, range)
+ . = ..()
+ var/atom/target = controller.blackboard[target_key]
+ if(QDELETED(target))
+ return FALSE
+ set_movement_target(controller, target)
+
+/datum/ai_behavior/human_npc_close_in/perform(seconds_per_tick, datum/ai_controller/controller, target_key, range)
+ var/atom/target = controller.blackboard[target_key]
+ if(QDELETED(target))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ if(get_dist(controller.pawn, target) <= range && can_see(controller.pawn, target, range))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
+ return AI_BEHAVIOR_INSTANT
+
+// ===== MELEE =====
+
+/// With no loaded gun: walks up and hits with the best melee weapon held, or a fist.
+/datum/ai_planning_subtree/human_npc_melee
+
+/datum/ai_planning_subtree/human_npc_melee/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ if(!controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET))
+ return
+ controller.queue_behavior(/datum/ai_behavior/basic_melee_attack/human_npc, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETING_STRATEGY, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+// tg's basic melee attack already clicks the target through ai_interact(); this picks what to hit with and where.
+/datum/ai_behavior/basic_melee_attack/human_npc
+
+/datum/ai_behavior/basic_melee_attack/human_npc/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key)
+ var/mob/living/carbon/npc = controller.pawn
+ var/obj/item/weapon = human_npc_held_melee_weapon(npc)
+ if(weapon)
+ human_npc_ready_item(npc, weapon)
+ human_npc_ready_weapon(npc, weapon) // a two-hander let go of with one hand is gripped again
+ else
+ human_npc_ready_empty_hand(npc)
+ npc.zone_selected = human_npc_pick_aim_zone()
+ return ..()
+
+// ===== HELPERS =====
+
+/// Body zones an NPC aims at, weighted. A player picks their own zone; an NPC's hits spread out.
+/proc/human_npc_pick_aim_zone()
+ var/static/list/aim_zones = list(
+ BODY_ZONE_CHEST = 40,
+ BODY_ZONE_HEAD = 15,
+ BODY_ZONE_L_ARM = 10,
+ BODY_ZONE_R_ARM = 10,
+ BODY_ZONE_L_LEG = 10,
+ BODY_ZONE_R_LEG = 10,
+ BODY_ZONE_PRECISE_GROIN = 5,
+ )
+ return pick_weight(aim_zones)
+
+/// Makes `item` the active hand. Returns FALSE if `npc` isn't holding it.
+/proc/human_npc_ready_item(mob/living/carbon/npc, obj/item/item)
+ if(isnull(item))
+ return FALSE
+ if(npc.get_active_held_item() == item)
+ return TRUE
+ var/index = npc.get_held_index_of_item(item)
+ if(!index)
+ return FALSE
+ npc.swap_hand(index, silent = TRUE)
+ return npc.get_active_held_item() == item
+
+/// Makes an empty hand the active one, for a punch. Returns FALSE if both hands are full.
+/proc/human_npc_ready_empty_hand(mob/living/carbon/npc)
+ if(isnull(npc.get_active_held_item()))
+ return TRUE
+ var/list/empty = npc.get_empty_held_indexes()
+ if(!length(empty))
+ return FALSE
+ npc.swap_hand(empty[1], silent = TRUE)
+ return isnull(npc.get_active_held_item())
+
+/// Switches on or wields a weapon in hand the way its user would: energy blades, batons, two-handed weapons.
+/proc/human_npc_ready_weapon(mob/living/carbon/npc, obj/item/weapon)
+ if(QDELETED(weapon) || !npc.is_holding(weapon))
+ return
+ if(weapon.GetComponent(/datum/component/transforming))
+ if(!HAS_TRAIT(weapon, TRAIT_TRANSFORM_ACTIVE))
+ weapon.attack_self(npc)
+ return
+ if(istype(weapon, /obj/item/melee/baton/security))
+ var/obj/item/melee/baton/security/baton = weapon
+ if(!baton.active)
+ baton.attack_self(npc)
+ return
+ if(weapon.GetComponent(/datum/component/two_handed) && !HAS_TRAIT(weapon, TRAIT_WIELDED) && length(npc.get_empty_held_indexes()))
+ // Wielding takes the weapon's own hand as the active one and the other hand free, as for a player
+ if(human_npc_ready_item(npc, weapon))
+ weapon.attack_self(npc)
+
+/// The gun it holds, preferring one that can fire.
+/proc/human_npc_held_gun(mob/living/carbon/npc)
+ var/obj/item/gun/found
+ for(var/obj/item/gun/gun in npc.held_items)
+ if(gun.can_shoot())
+ return gun
+ found ||= gun
+ return found
+
+/// A gun it holds that can fire right now, or null.
+/proc/human_npc_loaded_gun(mob/living/carbon/npc)
+ for(var/obj/item/gun/gun in npc.held_items)
+ if(gun.can_shoot())
+ return gun
+ return null
+
+/// Whether `item` is any use as a melee weapon.
+/proc/human_npc_is_melee_weapon(obj/item/item)
+ if(isnull(item) || isgun(item) || isbodypart(item) || isorgan(item) || (item.item_flags & ABSTRACT))
+ return FALSE
+ // Energy blades and batons are weak until switched on.
+ return human_npc_melee_force(item) >= 10 || item.GetComponent(/datum/component/transforming) || istype(item, /obj/item/melee/baton)
+
+/// What `item` hits for once readied: a two-handed weapon (a fireaxe) counts wielded, as human_npc_ready_weapon() swings it.
+/proc/human_npc_melee_force(obj/item/item)
+ var/datum/component/two_handed/two_handed = item.GetComponent(/datum/component/two_handed)
+ if(two_handed && !HAS_TRAIT(item, TRAIT_WIELDED))
+ return max(item.force, two_handed.force_wielded, item.force * two_handed.force_multiplier)
+ return item.force
+
+/// The best melee weapon it holds, or null.
+/proc/human_npc_held_melee_weapon(mob/living/carbon/npc)
+ var/obj/item/best
+ for(var/obj/item/held in npc.held_items)
+ if(human_npc_is_melee_weapon(held) && (isnull(best) || human_npc_melee_force(held) > human_npc_melee_force(best)))
+ best = held
+ return best
+
+/// Something better to fight with that it carries but doesn't hold: a loaded gun first, then the strongest melee weapon.
+/proc/human_npc_backup_weapon(mob/living/carbon/npc)
+ var/obj/item/best_melee
+ for(var/obj/item/thing as anything in npc.get_all_contents_type(/obj/item))
+ if(npc.is_holding(thing) || !human_npc_can_draw(npc, thing))
+ continue
+ if(isgun(thing))
+ var/obj/item/gun/spare = thing
+ if(spare.can_shoot())
+ return spare
+ continue
+ if(human_npc_is_melee_weapon(thing) && (isnull(best_melee) || human_npc_melee_force(thing) > human_npc_melee_force(best_melee)))
+ best_melee = thing
+ return best_melee
+
+/// Whether `item` is somewhere a person can take it from in a moment: a worn slot, or a bag or pouch it wears.
+/proc/human_npc_can_draw(mob/living/carbon/npc, obj/item/item)
+ if(isbodypart(item) || isorgan(item) || istype(item, /obj/item/implant))
+ return FALSE
+ if(item.loc == npc)
+ return !isnull(npc.get_slot_by_item(item))
+ var/obj/item/container = item.loc
+ return istype(container) && !isnull(container.atom_storage) && human_npc_holding(container) == npc
+
+/// Takes `item` out of a slot or a bag into a free hand. Returns TRUE if it ends up held.
+/proc/human_npc_take_in_hand(mob/living/carbon/npc, obj/item/item)
+ if(npc.is_holding(item))
+ return TRUE
+ if(!length(npc.get_empty_held_indexes()) || !human_npc_can_draw(npc, item))
+ return FALSE
+ if(item.loc == npc)
+ if(!npc.temporarilyRemoveItemFromInventory(item))
+ return FALSE
+ else
+ var/obj/item/container = item.loc
+ if(!container.atom_storage.attempt_remove(item, npc, silent = TRUE))
+ return FALSE
+ if(npc.put_in_hands(item))
+ return TRUE
+ npc.equip_to_appropriate_slot(item)
+ return FALSE
+
+/// Live rounds in a magazine, box or casing.
+/proc/human_npc_live_rounds(obj/item/ammo)
+ if(isammocasing(ammo))
+ var/obj/item/ammo_casing/casing = ammo
+ return casing.loaded_projectile ? 1 : 0
+ if(istype(ammo, /obj/item/ammo_box/magazine))
+ var/obj/item/ammo_box/magazine/magazine = ammo
+ return magazine.ammo_count(FALSE)
+ var/obj/item/ammo_box/box = ammo
+ if(!istype(box))
+ return 0
+ . = 0
+ for(var/obj/item/ammo_casing/round as anything in box.stored_ammo)
+ if(ispath(round) || round.loaded_projectile)
+ .++
+
+/// Whether a ballistic gun has live rounds loaded but none chambered, so using it (rack, pump, drop the bolt) readies it.
+/proc/human_npc_gun_needs_rack(obj/item/gun/ballistic/gun)
+ if(gun.bolt_type == BOLT_TYPE_NO_BOLT || gun.chambered?.loaded_projectile)
+ return FALSE
+ return gun.magazine && human_npc_live_rounds(gun.magazine) > 0
+
+/// Spare ammunition it carries that `gun` takes: a loaded magazine for a detachable-magazine gun,
+/// or a box, clip, speedloader or loose round of its calibre for one with an internal magazine.
+/proc/human_npc_find_ammo(mob/living/carbon/npc, obj/item/gun/ballistic/gun)
+ if(!istype(gun))
+ return null
+ // Whatever is already in hand first, then pockets, belt and bags.
+ for(var/obj/item/held in npc.held_items)
+ if(held != gun && human_npc_ammo_fits(gun, held))
+ return held
+ for(var/obj/item/thing as anything in npc.get_all_contents_type(/obj/item))
+ if(npc.is_holding(thing) || thing == gun.magazine || thing.loc == gun || !human_npc_can_draw(npc, thing))
+ continue
+ if(human_npc_ammo_fits(gun, thing))
+ return thing
+ return null
+
+/// Whether `ammo` loads `gun` and has a live round in it.
+/proc/human_npc_ammo_fits(obj/item/gun/ballistic/gun, obj/item/ammo)
+ if(!gun.internal_magazine)
+ return istype(ammo, gun.accepted_magazine_type) && human_npc_live_rounds(ammo) > 0
+ var/caliber = gun.magazine?.caliber
+ if(isnull(caliber))
+ return FALSE
+ if(istype(ammo, /obj/item/ammo_box))
+ var/obj/item/ammo_box/box = ammo
+ return box.caliber == caliber && human_npc_live_rounds(box) > 0
+ if(isammocasing(ammo))
+ var/obj/item/ammo_casing/casing = ammo
+ return casing.caliber == caliber && !isnull(casing.loaded_projectile)
+ return FALSE
+
+/// Whether it carries anything that makes `gun` fire again.
+/proc/human_npc_can_reload(mob/living/carbon/npc, obj/item/gun/ballistic/gun)
+ if(!istype(gun))
+ return FALSE
+ return human_npc_gun_needs_rack(gun) || !isnull(human_npc_find_ammo(npc, gun))
+
+/// A spent magazine, empty box or spent casing in its hands that's no use to `gun`.
+/proc/human_npc_spent_ammo_in_hand(mob/living/carbon/npc, obj/item/gun/ballistic/gun)
+ for(var/obj/item/held in npc.held_items)
+ if(held == gun || !(istype(held, /obj/item/ammo_box) || isammocasing(held)))
+ continue
+ if(!human_npc_live_rounds(held))
+ return held
+ return null
+
+/// Whether an ally stands between `shooter` and `target`. Shots pass over anyone lying down.
+/proc/human_npc_ally_in_line(mob/living/shooter, atom/target)
+ var/turf/shooter_turf = get_turf(shooter)
+ var/turf/target_turf = get_turf(target)
+ for(var/turf/line_turf as anything in get_line(shooter_turf, target_turf))
+ if(line_turf == shooter_turf || line_turf == target_turf)
+ continue
+ for(var/mob/living/other in line_turf)
+ if(other.stat == DEAD || other.body_position == LYING_DOWN)
+ continue
+ if(shooter.faction_check_atom(other))
+ return TRUE
+ return FALSE
+
+/// One step sideways, keeping no further from the target, for a clear shot.
+/proc/human_npc_sidestep(mob/living/shooter, atom/target)
+ var/turf/our_turf = get_turf(shooter)
+ var/list/possible_turfs = list()
+ for(var/direction in GLOB.alldirs)
+ var/turf/step_turf = get_step(our_turf, direction)
+ if(isnull(step_turf) || step_turf.is_blocked_turf() || get_dist(step_turf, target) > get_dist(shooter, target))
+ continue
+ possible_turfs += step_turf
+ if(!length(possible_turfs))
+ return
+ var/turf/picked = pick(possible_turfs)
+ step(shooter, get_dir(shooter, picked))
diff --git a/voidcrew/modules/human_npcs/human_npc_barks.dm b/voidcrew/modules/human_npcs/human_npc_barks.dm
new file mode 100644
index 00000000000..4aa4ea541e8
--- /dev/null
+++ b/voidcrew/modules/human_npcs/human_npc_barks.dm
@@ -0,0 +1,203 @@
+/**
+ * # Human NPC barks (N3)
+ *
+ * What a human NPC says when something real happens to its body. Every hook hangs on a tg state change,
+ * never on a stand-in state: entering crit (TRAIT_CRITICAL_CONDITION), leaving crit or getting up from
+ * stamcrit, handcuffs going on and coming off (TRAIT_RESTRAINED), starting to work at its cuffs (tg's
+ * cuff_resist(), COMSIG_MOB_REMOVING_CUFFS), breaking out of a grab or off someone's shoulders by
+ * resisting, giving up (human_npc_surrender.dm) and dying.
+ *
+ * A family supplies its lines with a /datum/human_npc_voice subtype on the NPC's npc_voice. A voice has
+ * spoken `lines` and third-person `emotes` ("collapses.") per kind (HUMAN_NPC_BARK_*, or any kind of the
+ * family's own: npc_bark("alert") works the same). Speech goes through say() without `forced`, so a gag or
+ * a mute works on an NPC as on a player, and tg whispers it in soft crit. In hard crit and after death it
+ * can't speak, so only the emote shows. One NPC barks at most once per voice `cooldown`; surrender and
+ * death always come through. A family that already has its own voice system (bounty criminals'
+ * bounty_say()) overrides npc_bark() instead.
+ *
+ * Death also plays the hyperviolence death throes (HV-21, hv_death_throes(), a shudder as the body
+ * falls). The deathgasp itself is tg's: carbons always give it.
+ */
+
+/// Says or shows its line for `kind` (HUMAN_NPC_BARK_*). `force` skips the cooldown and the voice's chance.
+/// Returns TRUE if it said or did anything. Override to voice a family another way.
+/mob/living/carbon/human/npc/proc/npc_bark(kind, force = FALSE)
+ if(QDELETED(src) || !ispath(npc_voice, /datum/human_npc_voice))
+ return FALSE
+ var/datum/human_npc_voice/voice = human_npc_singleton(npc_voice)
+ return voice.bark(src, kind, force)
+
+/**
+ * A family's lines. Lists are kind => list of strings. Emotes are third person without the name
+ * ("collapses.", "groans and tries to get up."). Keep them short and in character (kit rules, "Writing
+ * for players"): no mechanics, no hints.
+ */
+/datum/human_npc_voice
+ /// Spoken lines by kind
+ var/list/lines = list()
+ /// Emotes by kind, shown before the line, and alone when it can't speak
+ var/list/emotes = list()
+ /// Percent chance it barks at all, by kind. A kind not listed always barks (cooldown allowing).
+ var/list/chances = list()
+ /// Seconds between two barks from one NPC
+ var/cooldown = HUMAN_NPC_BARK_COOLDOWN
+
+/// The spoken lines for `kind`. Pleading falls back to the downed lines.
+/datum/human_npc_voice/proc/lines_for(kind)
+ . = lines[kind]
+ if(!length(.) && kind == HUMAN_NPC_BARK_PLEAD)
+ . = lines[HUMAN_NPC_BARK_DOWNED]
+
+/// The emotes for `kind`.
+/datum/human_npc_voice/proc/emotes_for(kind)
+ return emotes[kind]
+
+/datum/human_npc_voice/proc/bark(mob/living/carbon/human/npc/speaker, kind, force = FALSE)
+ if(!force && !COOLDOWN_FINISHED(speaker, npc_bark_cooldown))
+ return FALSE
+ if(!force && (kind in chances) && !prob(chances[kind]))
+ return FALSE
+ var/list/acts = emotes_for(kind)
+ var/list/spoken = lines_for(kind)
+ var/can_talk = length(spoken) && human_npc_can_talk(speaker)
+ if(!length(acts) && !can_talk)
+ return FALSE
+ if(length(acts))
+ speaker.visible_message(span_emote("[speaker] [pick(acts)]"))
+ if(can_talk)
+ INVOKE_ASYNC(speaker, TYPE_PROC_REF(/atom/movable, say), pick(spoken))
+ speaker.npc_last_bark = kind
+ COOLDOWN_START(speaker, npc_bark_cooldown, cooldown)
+ return TRUE
+
+/// Whether `speaker` can speak out loud or whisper now. Never in hard crit: tg turns that into last words.
+/proc/human_npc_can_talk(mob/living/speaker)
+ if(speaker.stat != CONSCIOUS && speaker.stat != SOFT_CRIT)
+ return FALSE
+ return speaker.can_speak()
+
+/**
+ * Relays the tg state changes the barks hang on to the NPC's own procs, so a family can override what
+ * happens (npc_on_downed() and so on) without touching the signals. An element, so a subtype can listen
+ * to the same signals on itself.
+ */
+/datum/element/human_npc_reactions
+ element_flags = ELEMENT_DETACH_ON_HOST_DESTROY
+
+/datum/element/human_npc_reactions/Attach(datum/target)
+ . = ..()
+ if(!ishumannpc(target))
+ return ELEMENT_INCOMPATIBLE
+ RegisterSignal(target, SIGNAL_ADDTRAIT(TRAIT_CRITICAL_CONDITION), PROC_REF(on_crit_started))
+ RegisterSignal(target, SIGNAL_REMOVETRAIT(TRAIT_CRITICAL_CONDITION), PROC_REF(on_crit_ended))
+ RegisterSignal(target, COMSIG_LIVING_STATUS_REMOVED, PROC_REF(on_status_removed))
+ RegisterSignal(target, SIGNAL_ADDTRAIT(TRAIT_RESTRAINED), PROC_REF(on_restrained))
+ RegisterSignal(target, SIGNAL_REMOVETRAIT(TRAIT_RESTRAINED), PROC_REF(on_unrestrained))
+ RegisterSignal(target, COMSIG_MOB_REMOVING_CUFFS, PROC_REF(on_working_cuffs))
+ RegisterSignal(target, COMSIG_LIVING_RESIST, PROC_REF(on_resist))
+ RegisterSignal(target, COMSIG_ATOM_NO_LONGER_PULLED, PROC_REF(on_let_go))
+ RegisterSignal(target, COMSIG_LIVING_SET_BUCKLED, PROC_REF(on_buckled))
+ RegisterSignal(target, COMSIG_LIVING_DEATH, PROC_REF(on_death))
+
+/datum/element/human_npc_reactions/Detach(datum/source)
+ UnregisterSignal(source, list(
+ SIGNAL_ADDTRAIT(TRAIT_CRITICAL_CONDITION),
+ SIGNAL_REMOVETRAIT(TRAIT_CRITICAL_CONDITION),
+ COMSIG_LIVING_STATUS_REMOVED,
+ SIGNAL_ADDTRAIT(TRAIT_RESTRAINED),
+ SIGNAL_REMOVETRAIT(TRAIT_RESTRAINED),
+ COMSIG_MOB_REMOVING_CUFFS,
+ COMSIG_LIVING_RESIST,
+ COMSIG_ATOM_NO_LONGER_PULLED,
+ COMSIG_LIVING_SET_BUCKLED,
+ COMSIG_LIVING_DEATH,
+ ))
+ return ..()
+
+/datum/element/human_npc_reactions/proc/on_crit_started(mob/living/carbon/human/npc/source)
+ SIGNAL_HANDLER
+ if(source.stat != DEAD)
+ source.npc_on_downed()
+
+/datum/element/human_npc_reactions/proc/on_crit_ended(mob/living/carbon/human/npc/source)
+ SIGNAL_HANDLER
+ // tg drops the trait on death too; only a living body that came out of crit has recovered.
+ if(source.stat != DEAD && !QDELING(source))
+ source.npc_on_recovered()
+
+/datum/element/human_npc_reactions/proc/on_status_removed(mob/living/carbon/human/npc/source, datum/status_effect/effect)
+ SIGNAL_HANDLER
+ if(source.stat == DEAD || QDELING(source))
+ return
+ if(istype(effect, /datum/status_effect/incapacitating/stamcrit))
+ if(source.stat == CONSCIOUS)
+ source.npc_on_recovered()
+ return
+ if(istype(effect, /datum/status_effect/incapacitating/paralyzed) && source.npc_surrendering)
+ source.npc_surrender_ended()
+
+/datum/element/human_npc_reactions/proc/on_restrained(mob/living/carbon/human/npc/source)
+ SIGNAL_HANDLER
+ if(source.handcuffed && source.stat != DEAD)
+ source.npc_bark(HUMAN_NPC_BARK_CUFFED)
+
+/datum/element/human_npc_reactions/proc/on_unrestrained(mob/living/carbon/human/npc/source)
+ SIGNAL_HANDLER
+ if(source.stat != DEAD && !QDELING(source))
+ source.npc_bark(HUMAN_NPC_BARK_UNCUFFED)
+
+/datum/element/human_npc_reactions/proc/on_working_cuffs(mob/living/carbon/human/npc/source, obj/item/cuffs)
+ SIGNAL_HANDLER
+ source.npc_bark(HUMAN_NPC_BARK_SLIPPING)
+
+/// Notes who held it as it resisted. tg's resist_grab() lets go in the same call when it works.
+/datum/element/human_npc_reactions/proc/on_resist(mob/living/carbon/human/npc/source)
+ SIGNAL_HANDLER
+ var/atom/movable/holder = source.pulledby || (ismob(source.buckled) ? source.buckled : null)
+ if(isnull(holder) || HAS_TRAIT(source, TRAIT_RESTRAINED))
+ return
+ source.npc_resisted_hold = WEAKREF(holder)
+ source.npc_resisted_at = world.time
+
+/datum/element/human_npc_reactions/proc/on_let_go(mob/living/carbon/human/npc/source, atom/movable/puller)
+ SIGNAL_HANDLER
+ source.npc_check_pulled_free(puller)
+
+/datum/element/human_npc_reactions/proc/on_buckled(mob/living/carbon/human/npc/source, atom/movable/new_buckled)
+ SIGNAL_HANDLER
+ // Squirming off a carrier's shoulders can take a moment; a grab breaks in the same call.
+ if(isnull(new_buckled))
+ source.npc_check_pulled_free(within = 6 SECONDS)
+
+/datum/element/human_npc_reactions/proc/on_death(mob/living/carbon/human/npc/source, gibbed)
+ SIGNAL_HANDLER
+ source.npc_surrendering = FALSE
+ if(gibbed)
+ return
+ source.hv_death_throes()
+ source.npc_bark(HUMAN_NPC_BARK_DEATH, force = TRUE)
+
+// ===== What it does when those things happen. Families override these. =====
+
+/// It entered crit.
+/mob/living/carbon/human/npc/proc/npc_on_downed()
+ npc_surrendering = FALSE
+ npc_bark(HUMAN_NPC_BARK_DOWNED, force = TRUE)
+ npc_next_plead = world.time + HUMAN_NPC_PLEAD_INTERVAL
+ SEND_SIGNAL(src, COMSIG_HUMAN_NPC_DOWNED)
+
+/// It left crit, or got up from stamcrit.
+/mob/living/carbon/human/npc/proc/npc_on_recovered()
+ npc_bark(HUMAN_NPC_BARK_RECOVER)
+ SEND_SIGNAL(src, COMSIG_HUMAN_NPC_RECOVERED)
+
+/// It stopped being held. If it resisted its way out (this tick, or `within` that long ago), it pulled free.
+/mob/living/carbon/human/npc/proc/npc_check_pulled_free(atom/movable/holder, within = 0)
+ if(!npc_resisted_at || world.time > npc_resisted_at + within)
+ return
+ var/atom/movable/resisted = npc_resisted_hold?.resolve()
+ npc_resisted_hold = null
+ npc_resisted_at = 0
+ if(holder && resisted != holder)
+ return
+ npc_bark(HUMAN_NPC_BARK_PULLED_FREE)
diff --git a/voidcrew/modules/human_npcs/human_npc_combat_sense.dm b/voidcrew/modules/human_npcs/human_npc_combat_sense.dm
new file mode 100644
index 00000000000..c1cc0f02860
--- /dev/null
+++ b/voidcrew/modules/human_npcs/human_npc_combat_sense.dm
@@ -0,0 +1,633 @@
+/**
+ * # Combat sense
+ *
+ * Armed hostile human NPCs that opt in fight back against stun weapons the way a player does, through
+ * the body's own systems. Two parts:
+ * - A stimulant when it tires. Past HUMAN_NPC_SENSE_STIM_SHARE of the stamina loss that would stamcrit
+ * it, and still in a fight, it takes a stimulant pen it carries into a free hand and uses it (tg's
+ * use in hand, so the pen's real reagents go in). Only what it carries, and never while a stimulant
+ * is already in its blood. What a family carries is its outfit's business: see each family's file.
+ * - Stun fire. Hit by a shot that does stamina damage (a disabler bolt, a rubber round), it stops
+ * standing in the open. A gunner runs to the nearest tile out of the shooter's line of fire
+ * (human_npc_find_cover()) and keeps its head down for a moment, longer while it is winded (which is
+ * when tg's own stamina recovery catches up with it). Then the family's own fight subtrees walk it
+ * back out to shoot: it peeks. Three runs for cover in one exchange, then it stands and fights. A
+ * fighter that hits from close (a blade, fists, a shotgun) charges the shooter instead.
+ *
+ * Every move goes through the AI's movement (the controller's own movement type, so a family's leash
+ * pathing applies, at the body's real move delay: basic controllers track cached_multiplicative_slowdown).
+ * Every reaction shows in the world first ("ducks for cover!"). A family's rules say which tiles it may
+ * use (tile_ok(): a criminal's leash, a pirate crew's battlefield, a guard's wing).
+ *
+ * Nothing here touches the body: no immunity, no stamina, health or stun change, no stand-in state.
+ * Cuffed, in crit, stunned, in stamcrit, knocked down, grabbed, giving up or walking out, it does nothing
+ * (can_act(); tg's controller also stops the AI in stamcrit and stuns).
+ *
+ * Opting in: a human NPC type sets npc_combat_sense to a /datum/npc_combat_sense typepath (its family's
+ * rules), and its controller lists /datum/ai_planning_subtree/npc_combat_sense where it should plan: after
+ * soft crit, breaking free, walking out, surrender and finding a target, and before arming and attacking.
+ * Civilians, townsfolk and prisoners never set it. Anything else may AddComponent(/datum/component/
+ * npc_combat_sense, rules_type) on a human NPC whose controller lists the subtree, and subclass
+ * /datum/npc_combat_sense to change the numbers or any step (a bounty boss, say).
+ */
+
+// ===== THE RULES =====
+
+/**
+ * How a family uses its combat sense. One shared instance per type (human_npc_singleton()). The vars are
+ * the numbers; each proc is a step a family may override.
+ */
+/datum/npc_combat_sense
+ /// Whether it uses stimulant pens it carries when it tires
+ var/use_stims = TRUE
+ /// Stamina loss, as a share of what stamcrits it, at which it reaches for a stimulant
+ var/stim_share = HUMAN_NPC_SENSE_STIM_SHARE
+ /// Whether stun fire makes it move at all
+ var/react_to_stun_fire = TRUE
+ /// How long after its last stun hit it keeps reacting
+ var/react_time = HUMAN_NPC_SENSE_REACT_TIME
+ /// The furthest it walks to cover, in steps
+ var/cover_steps = HUMAN_NPC_SENSE_COVER_STEPS
+ /// How long it keeps its head down before it looks out
+ var/peek_after = HUMAN_NPC_SENSE_PEEK_AFTER
+ /// The longest it stays down while winded
+ var/max_hold = HUMAN_NPC_SENSE_MAX_HOLD
+ /// Runs for cover per exchange of fire before it stands and fights
+ var/cover_moves = HUMAN_NPC_SENSE_COVER_MOVES
+ /// A fighter that hits from this close charges the shooter instead of taking cover. 0: it never charges.
+ var/close_in_reach = HUMAN_NPC_SENSE_CLOSE_IN_REACH
+
+/**
+ * Whether it can do anything about a fight right now: on its feet and free. Never cuffed, grabbed,
+ * buckled, stunned, knocked down, in crit, busy with a do_after, giving up or walking out.
+ */
+/datum/npc_combat_sense/proc/can_act(mob/living/carbon/human/npc, datum/ai_controller/controller)
+ if(npc.stat != CONSCIOUS || !isturf(npc.loc) || npc.buckled || npc.pulledby)
+ return FALSE
+ if(HAS_TRAIT(npc, TRAIT_RESTRAINED) || HAS_TRAIT(npc, TRAIT_HANDS_BLOCKED) || HAS_TRAIT(npc, TRAIT_INCAPACITATED))
+ return FALSE
+ if(HAS_TRAIT(npc, TRAIT_IMMOBILIZED) || HAS_TRAIT(npc, TRAIT_FLOORED) || npc.body_position == LYING_DOWN)
+ return FALSE
+ if(LAZYLEN(npc.do_afters))
+ return FALSE
+ var/mob/living/carbon/human/npc/human_npc = npc
+ if(istype(human_npc) && (human_npc.npc_surrendering || human_npc.npc_exit))
+ return FALSE
+ return TRUE
+
+/// Whether it is in a fight: it has a target, or someone is shooting stun rounds at it.
+/datum/npc_combat_sense/proc/in_fight(mob/living/carbon/human/npc, datum/ai_controller/controller, datum/component/npc_combat_sense/sense)
+ return controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET) || sense.under_fire()
+
+/// Whether it is winded: stamina loss past stim_share of what would stamcrit it.
+/datum/npc_combat_sense/proc/winded(mob/living/carbon/human/npc)
+ return npc.getStaminaLoss() >= stim_share * (npc.maxHealth - npc.crit_threshold)
+
+/// A stimulant pen it carries and could take out now, or null.
+/datum/npc_combat_sense/proc/find_stim(mob/living/carbon/human/npc)
+ return human_npc_find_stim(npc)
+
+/// Whether the one who fired `shooter`'s stun shot is on its side, so the shot is friendly fire.
+/datum/npc_combat_sense/proc/allied(mob/living/carbon/human/npc, atom/shooter)
+ return isliving(shooter) && npc.faction_check_atom(shooter)
+
+/// Whether a stun shot from `shooter` is one to react to: a person or a mech, not itself, not a friend.
+/datum/npc_combat_sense/proc/threat_ok(mob/living/carbon/human/npc, atom/shooter)
+ if(QDELETED(shooter) || shooter == npc || !(isliving(shooter) || ismecha(shooter)))
+ return FALSE
+ return !allied(npc, shooter)
+
+/**
+ * How close it fights from, in tiles: its gun's range if it holds or carries one that fires (the shooting
+ * subtrees' BB_HUMAN_NPC_FIRE_RANGE), else 1. At or under close_in_reach it charges; over it, it takes cover.
+ */
+/datum/npc_combat_sense/proc/reach(mob/living/carbon/human/npc, datum/ai_controller/controller)
+ if(HAS_TRAIT(npc, TRAIT_NOGUNS))
+ return 1
+ if(human_npc_held_gun(npc) || isgun(human_npc_backup_weapon(npc)))
+ return controller.blackboard[BB_HUMAN_NPC_FIRE_RANGE] || 7
+ return 1
+
+/// Whether it may leave where it stands for this fight at all (a pirate holding the helm's line doesn't).
+/datum/npc_combat_sense/proc/may_move(mob/living/carbon/human/npc, datum/ai_controller/controller)
+ return TRUE
+
+/**
+ * Whether it may stand on `tile` (and walk through it on the way to cover): open floor that is safe to
+ * cross, in the NPC's own map region. Families add their leash.
+ */
+/datum/npc_combat_sense/proc/tile_ok(mob/living/carbon/human/npc, datum/ai_controller/controller, turf/tile)
+ if(!isopenturf(tile) || isspaceturf(tile) || isopenspaceturf(tile) || isgroundlessturf(tile) || islava(tile) || ischasm(tile))
+ return FALSE
+ if(!tile.can_cross_safely(npc))
+ return FALSE
+ return !map_region_excludes_turf(map_region_for_turf(get_turf(npc)), tile)
+
+/// The nearest tile it may reach that is out of a shot's line from `threat_turf`, or null.
+/datum/npc_combat_sense/proc/find_cover(mob/living/carbon/human/npc, datum/ai_controller/controller, turf/threat_turf, pass_flags)
+ return human_npc_find_cover(npc, threat_turf, cover_steps, pass_flags, CALLBACK(src, PROC_REF(tile_ok), npc, controller))
+
+/// How long it keeps down in cover it reached at `arrived_at`: peek_after, or up to max_hold while winded.
+/datum/npc_combat_sense/proc/hold_until(mob/living/carbon/human/npc, datum/component/npc_combat_sense/sense)
+ return sense.arrived_at + (winded(npc) ? max_hold : peek_after)
+
+/**
+ * What the people around see it do, before it does it (and a line from its voice, if its family has one
+ * for `kind`). In the world and in character: no rules, no numbers.
+ */
+/datum/npc_combat_sense/proc/telegraph(mob/living/carbon/human/npc, kind, atom/about, obj/item/used)
+ switch(kind)
+ if(HUMAN_NPC_BARK_TAKE_COVER)
+ npc.visible_message(span_warning("[npc] ducks for cover!"))
+ if(HUMAN_NPC_BARK_CHARGE)
+ npc.visible_message(span_warning("[npc] charges at [about]!"))
+ if(HUMAN_NPC_BARK_STIMULANT)
+ npc.visible_message(span_warning("[npc] jabs [used] into [npc.p_their()] thigh."))
+ return
+ var/mob/living/carbon/human/npc/human_npc = npc
+ if(istype(human_npc))
+ human_npc.npc_bark(kind)
+
+// ===== PLANNING =====
+
+/**
+ * One plan. Under stun fire a gunner gets out of the line of fire first and uses its stimulant from
+ * cover; out of cover's reach (none near, out of runs, looking out) it uses the stimulant where it is.
+ * A close fighter takes its stimulant first, then charges. Returns SUBTREE_RETURN_FINISH_PLANNING while it
+ * is doing something about it, so the attacks below wait.
+ */
+/datum/npc_combat_sense/proc/plan(mob/living/carbon/human/npc, datum/ai_controller/controller, datum/component/npc_combat_sense/sense)
+ if(!can_act(npc, controller))
+ sense.stand_down(controller)
+ return
+ var/under_fire = sense.under_fire()
+ if(!under_fire && sense.hits)
+ sense.end_exchange(controller)
+ var/reacting = under_fire && react_to_stun_fire && may_move(npc, controller)
+ var/close_fighter = reacting && close_in_reach && reach(npc, controller) <= close_in_reach
+ if(reacting && !close_fighter)
+ . = plan_cover(npc, controller, sense)
+ if(.)
+ return
+ if(plan_stim(npc, controller, sense))
+ return SUBTREE_RETURN_FINISH_PLANNING
+ if(close_fighter)
+ return plan_close_in(npc, controller, sense)
+
+/// Queues the stimulant it wants now, if any. Returns TRUE if it did.
+/datum/npc_combat_sense/proc/plan_stim(mob/living/carbon/human/npc, datum/ai_controller/controller, datum/component/npc_combat_sense/sense)
+ var/obj/item/reagent_containers/hypospray/medipen/stim = wants_stim(npc, controller, sense)
+ if(isnull(stim))
+ return FALSE
+ controller.set_blackboard_key(BB_HUMAN_NPC_STIM_ITEM, stim)
+ controller.queue_behavior(/datum/ai_behavior/npc_combat_sense_stim, BB_HUMAN_NPC_STIM_ITEM)
+ return TRUE
+
+/// The stimulant pen it should use now, or null: the one in hand from the last plan, or one it carries while winded in a fight.
+/datum/npc_combat_sense/proc/wants_stim(mob/living/carbon/human/npc, datum/ai_controller/controller, datum/component/npc_combat_sense/sense)
+ if(!use_stims || world.time < sense.next_stim_at)
+ return null
+ var/obj/item/reagent_containers/hypospray/medipen/using = controller.blackboard[BB_HUMAN_NPC_STIM_ITEM]
+ if(istype(using) && !QDELETED(using) && human_npc_is_stim(using) && human_npc_holding(using) == npc)
+ return using
+ if(!winded(npc) || !in_fight(npc, controller, sense) || human_npc_stimmed(npc))
+ return null
+ . = find_stim(npc)
+ // Nothing on it: don't turn its pockets out again every plan
+ if(isnull(.))
+ sense.next_stim_at = world.time + HUMAN_NPC_SENSE_STIM_RETRY
+
+/**
+ * A gunner under stun fire: on the way to cover, it keeps going; in cover, it keeps down (using its
+ * stimulant or reloading there if it needs to) until it is time to look out or the shooter can see it
+ * there anyway; in the open, each new stun hit is weighed once, and it runs for the nearest cover if it
+ * has runs left. Returns null when it has nothing to do about it here.
+ */
+/datum/npc_combat_sense/proc/plan_cover(mob/living/carbon/human/npc, datum/ai_controller/controller, datum/component/npc_combat_sense/sense)
+ var/turf/here = get_turf(npc)
+ var/turf/threat_turf = sense.threat_turf(npc)
+ if(isnull(here) || isnull(threat_turf))
+ return
+ if(sense.cover)
+ var/blown = human_npc_line_of_fire(threat_turf, sense.cover, sense.shot_pass_flags)
+ if(here == sense.cover)
+ sense.arrived_at ||= world.time
+ // Whoever it is fighting at arm's length gets fought, cover or not
+ var/atom/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
+ if(target && get_dist(npc, target) <= 1)
+ blown = TRUE
+ if(!blown && world.time < hold_until(npc, sense))
+ // Hits taken getting here or in here were answered by being here
+ sense.decided_at = world.time
+ // Its stimulant or a fresh magazine while it is out of sight, else it keeps its head down
+ if(!plan_stim(npc, controller, sense) && !human_npc_cover_reload(npc, controller))
+ controller.queue_behavior(/datum/ai_behavior/npc_combat_sense_hold)
+ return SUBTREE_RETURN_FINISH_PLANNING
+ // Time to look out, or it is seen here anyway: the fight subtrees take it from here
+ sense.stand_down(controller)
+ return
+ if(!blown && world.time < sense.cover_deadline && tile_ok(npc, controller, sense.cover))
+ sense.decided_at = world.time
+ controller.queue_behavior(/datum/ai_behavior/npc_combat_sense_take_cover, BB_HUMAN_NPC_COVER)
+ return SUBTREE_RETURN_FINISH_PLANNING
+ sense.stand_down(controller)
+ return
+ if(sense.last_hit_at <= sense.decided_at)
+ return
+ sense.decided_at = world.time
+ if(sense.cover_moves >= cover_moves || !human_npc_line_of_fire(threat_turf, here, sense.shot_pass_flags))
+ return
+ var/turf/spot = find_cover(npc, controller, threat_turf, sense.shot_pass_flags)
+ if(isnull(spot))
+ return
+ sense.take_cover(controller, spot)
+ telegraph(npc, HUMAN_NPC_BARK_TAKE_COVER, sense.threat())
+ controller.queue_behavior(/datum/ai_behavior/npc_combat_sense_take_cover, BB_HUMAN_NPC_COVER)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/**
+ * A close fighter under stun fire: it runs at the shooter, if the shooter is who it is already fighting,
+ * until it is close enough to hit. Then the family's attacks take over.
+ */
+/datum/npc_combat_sense/proc/plan_close_in(mob/living/carbon/human/npc, datum/ai_controller/controller, datum/component/npc_combat_sense/sense)
+ var/atom/shooter = sense.threat()
+ if(isnull(shooter) || shooter != controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET])
+ return
+ var/reach = max(reach(npc, controller), 1)
+ if(get_dist(npc, shooter) <= reach && can_see(npc, shooter, reach))
+ return
+ if(world.time - sense.charged_at > react_time)
+ telegraph(npc, HUMAN_NPC_BARK_CHARGE, shooter)
+ sense.charged_at = world.time
+ sense.decided_at = world.time
+ controller.set_blackboard_key(BB_HUMAN_NPC_STUN_SHOOTER, shooter)
+ controller.queue_behavior(/datum/ai_behavior/human_npc_close_in, BB_HUMAN_NPC_STUN_SHOOTER, reach)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/// Plans the combat sense of a pawn that has one. Controllers that support it list this where it should run.
+/datum/ai_planning_subtree/npc_combat_sense
+
+/datum/ai_planning_subtree/npc_combat_sense/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/carbon/human/npc = controller.pawn
+ if(!istype(npc))
+ return
+ var/datum/component/npc_combat_sense/sense = npc.GetComponent(/datum/component/npc_combat_sense)
+ if(isnull(sense))
+ return
+ return sense.rules.plan(npc, controller, sense)
+
+// ===== THE COMPONENT: what it noticed =====
+
+/**
+ * On a human NPC with combat sense: notes stun hits (who, from where, what the shot could pass) and keeps
+ * the state of the current exchange. The decisions are its rules' (plan()).
+ */
+/datum/component/npc_combat_sense
+ dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
+ /// The family's rules, a shared instance
+ var/datum/npc_combat_sense/rules
+ /// Whoever last shot it with stun fire
+ var/datum/weakref/shooter_ref
+ /// Where that shot was fired from
+ var/turf/shot_from
+ /// What that shot could fly through (glass, tables, grilles), to judge cover against the next one
+ var/shot_pass_flags = PASSTABLE
+ /// world.time of its last stun hit
+ var/last_hit_at = 0
+ /// Stun hits taken in this exchange
+ var/hits = 0
+ /// world.time it last answered a stun hit (ran for cover, charged, or chose to stand)
+ var/decided_at = 0
+ /// The cover it is going to or keeping down in
+ var/turf/cover
+ /// world.time it gives up on reaching that cover
+ var/cover_deadline = 0
+ /// world.time it got there, or 0
+ var/arrived_at = 0
+ /// Runs for cover in this exchange
+ var/cover_moves = 0
+ /// world.time it last charged a shooter
+ var/charged_at = 0
+ /// Stimulants it has used
+ var/stims_used = 0
+ /// world.time it may next reach for a stimulant, after a try that got nowhere
+ var/next_stim_at = 0
+
+/datum/component/npc_combat_sense/Initialize(rules_type = /datum/npc_combat_sense)
+ if(!ishumannpc(parent) || !ispath(rules_type, /datum/npc_combat_sense))
+ return COMPONENT_INCOMPATIBLE
+ rules = human_npc_singleton(rules_type)
+
+/datum/component/npc_combat_sense/InheritComponent(datum/component/new_comp, i_am_original, rules_type = /datum/npc_combat_sense)
+ if(ispath(rules_type, /datum/npc_combat_sense))
+ rules = human_npc_singleton(rules_type)
+
+/datum/component/npc_combat_sense/RegisterWithParent()
+ RegisterSignal(parent, COMSIG_ATOM_BULLET_ACT, PROC_REF(on_shot))
+ RegisterSignal(parent, COMSIG_LIVING_DEATH, PROC_REF(on_death))
+
+/datum/component/npc_combat_sense/UnregisterFromParent()
+ UnregisterSignal(parent, list(COMSIG_ATOM_BULLET_ACT, COMSIG_LIVING_DEATH))
+
+/datum/component/npc_combat_sense/Destroy(force)
+ rules = null
+ shooter_ref = null
+ shot_from = null
+ cover = null
+ return ..()
+
+/// A shot landed. Stun fire is noted; the next plan decides what to do about it.
+/datum/component/npc_combat_sense/proc/on_shot(mob/living/carbon/human/source, obj/projectile/shot, def_zone, piercing_hit, blocked)
+ SIGNAL_HANDLER
+ if(source.stat == DEAD || !human_npc_stun_projectile(shot))
+ return
+ var/atom/shooter = shot.firer
+ if(!rules.threat_ok(source, shooter))
+ return
+ if(!under_fire())
+ hits = 0
+ cover_moves = 0
+ shooter_ref = WEAKREF(shooter)
+ shot_from = get_turf(shot.starting) || get_turf(shooter)
+ shot_pass_flags = shot.pass_flags
+ last_hit_at = world.time
+ hits++
+
+/datum/component/npc_combat_sense/proc/on_death(mob/living/source, gibbed)
+ SIGNAL_HANDLER
+ end_exchange(source.ai_controller)
+
+/// Whether stun fire hit it recently enough to still react.
+/datum/component/npc_combat_sense/proc/under_fire()
+ return last_hit_at && world.time - last_hit_at <= rules.react_time
+
+/// The one shooting stun rounds at it, if they are still about on its level.
+/datum/component/npc_combat_sense/proc/threat()
+ var/atom/shooter = shooter_ref?.resolve()
+ if(QDELETED(shooter))
+ return null
+ var/turf/shooter_turf = get_turf(shooter)
+ var/turf/our_turf = get_turf(parent)
+ if(isnull(shooter_turf) || shooter_turf.z != our_turf?.z)
+ return null
+ return shooter
+
+/// Where the stun fire comes from: the shooter's tile while it can tell, else where the last shot was fired from.
+/datum/component/npc_combat_sense/proc/threat_turf(mob/living/npc)
+ var/atom/shooter = threat()
+ if(shooter && can_see(npc, shooter, HUMAN_NPC_SIGHT_RANGE))
+ return get_turf(shooter)
+ return shot_from
+
+/// Sets off for `spot`.
+/datum/component/npc_combat_sense/proc/take_cover(datum/ai_controller/controller, turf/spot)
+ cover = spot
+ arrived_at = 0
+ cover_moves++
+ cover_deadline = world.time + 1 SECONDS + get_dist(parent, spot) * HUMAN_NPC_SENSE_COVER_STEP_TIME
+ controller.set_blackboard_key(BB_HUMAN_NPC_COVER, spot)
+
+/// Leaves its cover plan (it is going back to the fight, or can't do anything).
+/datum/component/npc_combat_sense/proc/stand_down(datum/ai_controller/controller)
+ cover = null
+ arrived_at = 0
+ cover_deadline = 0
+ controller?.clear_blackboard_key(BB_HUMAN_NPC_COVER)
+
+/// The exchange of fire is over: next time starts afresh.
+/datum/component/npc_combat_sense/proc/end_exchange(datum/ai_controller/controller)
+ stand_down(controller)
+ hits = 0
+ cover_moves = 0
+ last_hit_at = 0
+ decided_at = 0
+ shooter_ref = null
+ shot_from = null
+
+// ===== BEHAVIOURS =====
+
+/// Walks to the cover turf in `cover_key`. The plan holds it there once it arrives.
+/datum/ai_behavior/npc_combat_sense_take_cover
+ required_distance = 0
+ action_cooldown = 0.2 SECONDS
+ behavior_flags = AI_BEHAVIOR_REQUIRE_MOVEMENT | AI_BEHAVIOR_MOVE_AND_PERFORM | AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
+
+/datum/ai_behavior/npc_combat_sense_take_cover/setup(datum/ai_controller/controller, cover_key)
+ . = ..()
+ var/turf/spot = controller.blackboard[cover_key]
+ if(!isturf(spot))
+ return FALSE
+ set_movement_target(controller, spot)
+
+/datum/ai_behavior/npc_combat_sense_take_cover/perform(seconds_per_tick, datum/ai_controller/controller, cover_key)
+ var/turf/spot = controller.blackboard[cover_key]
+ if(!isturf(spot))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ if(get_turf(controller.pawn) == spot)
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
+ return AI_BEHAVIOR_DELAY
+
+/// Keeps its head down where it is. Ends when the plan stops asking for it.
+/datum/ai_behavior/npc_combat_sense_hold
+ action_cooldown = 0.5 SECONDS
+ behavior_flags = AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
+
+/datum/ai_behavior/npc_combat_sense_hold/perform(seconds_per_tick, datum/ai_controller/controller)
+ return AI_BEHAVIOR_DELAY
+
+/**
+ * Uses the stimulant pen in `item_key` on itself the way a player does: takes it in a free hand (letting
+ * go of a two-handed grip, or putting away a spent gun, if both are full), then use in hand. The spent pen
+ * is dropped and its weapons taken up again.
+ */
+/datum/ai_behavior/npc_combat_sense_stim
+ action_cooldown = 0.5 SECONDS
+ behavior_flags = AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
+
+/datum/ai_behavior/npc_combat_sense_stim/perform(seconds_per_tick, datum/ai_controller/controller, item_key)
+ var/mob/living/carbon/human/npc = controller.pawn
+ var/obj/item/reagent_containers/hypospray/medipen/pen = controller.blackboard[item_key]
+ if(!istype(pen) || QDELETED(pen) || human_npc_holding(pen) != npc || npc.stat != CONSCIOUS || HAS_TRAIT(npc, TRAIT_HANDS_BLOCKED))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ if(!human_npc_is_stim(pen))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ if(!npc.is_holding(pen))
+ if(!human_npc_free_a_hand(npc) || !human_npc_take_in_hand(npc, pen))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ return AI_BEHAVIOR_DELAY
+ if(!human_npc_ready_item(npc, pen) || npc.next_move > world.time)
+ return AI_BEHAVIOR_DELAY
+ var/datum/component/npc_combat_sense/sense = npc.GetComponent(/datum/component/npc_combat_sense)
+ sense?.rules.telegraph(npc, HUMAN_NPC_BARK_STIMULANT, null, pen)
+ npc.execute_mode()
+ if(!pen.used_up)
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ if(sense)
+ sense.stims_used++
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
+
+/datum/ai_behavior/npc_combat_sense_stim/finish_action(datum/ai_controller/controller, succeeded, item_key)
+ var/mob/living/carbon/human/npc = controller.pawn
+ var/obj/item/reagent_containers/hypospray/medipen/pen = controller.blackboard[item_key]
+ . = ..()
+ controller.clear_blackboard_key(item_key)
+ if(!istype(npc))
+ return
+ if(istype(pen) && !QDELETED(pen) && npc.is_holding(pen))
+ if(pen.used_up)
+ npc.dropItemToGround(pen)
+ else
+ // Cut short (the plan moved on): back where it came from
+ pen.equip_to_best_slot(npc)
+ for(var/obj/item/held in npc.held_items)
+ human_npc_ready_weapon(npc, held)
+ if(!succeeded)
+ var/datum/component/npc_combat_sense/sense = npc.GetComponent(/datum/component/npc_combat_sense)
+ if(sense)
+ sense.next_stim_at = world.time + HUMAN_NPC_SENSE_STIM_RETRY
+
+// ===== HELPERS (API) =====
+
+/// Reagents that count as a stimulant: what a person takes to keep going through a fight.
+GLOBAL_LIST_INIT(human_npc_stim_reagents, typecacheof(list(
+ /datum/reagent/medicine/stimulants,
+ /datum/reagent/medicine/ephedrine,
+ /datum/reagent/drug/methamphetamine,
+)))
+
+/// Whether `shot` does stamina damage: a disabler bolt, a rubber round.
+/proc/human_npc_stun_projectile(obj/projectile/shot)
+ if(!istype(shot))
+ return FALSE
+ return (shot.damage_type == STAMINA && shot.damage > 0) || shot.stamina > 0
+
+/// Whether `pen` is an unspent medipen with a stimulant in it.
+/proc/human_npc_is_stim(obj/item/reagent_containers/hypospray/medipen/pen)
+ if(!istype(pen) || pen.used_up || !pen.reagents?.total_volume)
+ return FALSE
+ for(var/datum/reagent/reagent as anything in pen.reagents.reagent_list)
+ if(is_type_in_typecache(reagent, GLOB.human_npc_stim_reagents))
+ return TRUE
+ return FALSE
+
+/// Whether a stimulant is already in `body`'s blood.
+/proc/human_npc_stimmed(mob/living/carbon/body)
+ for(var/datum/reagent/reagent as anything in body.reagents?.reagent_list)
+ if(is_type_in_typecache(reagent, GLOB.human_npc_stim_reagents))
+ return TRUE
+ return FALSE
+
+/// A stimulant pen `npc` holds, or carries somewhere it can take it from in a moment, or null.
+/proc/human_npc_find_stim(mob/living/carbon/npc)
+ for(var/obj/item/reagent_containers/hypospray/medipen/pen in npc.get_all_contents_type(/obj/item/reagent_containers/hypospray/medipen))
+ if(human_npc_is_stim(pen) && (npc.is_holding(pen) || human_npc_can_draw(npc, pen)))
+ return pen
+ return null
+
+/// Frees a hand: lets go of a two-handed grip, else puts away a gun that can't fire. Returns TRUE if a hand is free.
+/proc/human_npc_free_a_hand(mob/living/carbon/npc)
+ if(length(npc.get_empty_held_indexes()))
+ return TRUE
+ for(var/obj/item/held in npc.held_items)
+ if(HAS_TRAIT(held, TRAIT_WIELDED))
+ held.attack_self(npc)
+ break
+ if(length(npc.get_empty_held_indexes()))
+ return TRUE
+ var/obj/item/gun/spent = human_npc_held_gun(npc)
+ if(spent && !spent.can_shoot())
+ spent.equip_to_best_slot(npc)
+ return length(npc.get_empty_held_indexes()) > 0
+
+/**
+ * Whether a shot from `from_turf` could fly straight to `to_turf`: nothing on the way between the two tile
+ * centres that blocks it. Walls, closed doors, machines and anything opaque block; glass, tables and grilles
+ * only stop a shot that can't pass them (`pass_flags`, the projectile's). Directional things (windoors,
+ * railings) are ignored. A rough line, like a person judging cover by eye.
+ */
+/proc/human_npc_line_of_fire(turf/from_turf, turf/to_turf, pass_flags = PASSTABLE)
+ if(isnull(from_turf) || isnull(to_turf) || from_turf.z != to_turf.z)
+ return FALSE
+ var/dx = to_turf.x - from_turf.x
+ var/dy = to_turf.y - from_turf.y
+ // Four looks per tile along the segment, each at the tile under that point
+ var/samples = max(abs(dx), abs(dy)) * 4
+ var/turf/last = from_turf
+ for(var/sample in 1 to samples - 1)
+ var/turf/step = locate(round(from_turf.x + dx * sample / samples + 0.5), round(from_turf.y + dy * sample / samples + 0.5), from_turf.z)
+ if(step == last || step == to_turf)
+ continue
+ last = step
+ if(isnull(step) || step.density || step.opacity)
+ return FALSE
+ for(var/obj/thing in step)
+ if(thing.opacity)
+ return FALSE
+ if(!thing.density || (thing.flags_1 & ON_BORDER_1) || (thing.pass_flags_self & pass_flags))
+ continue
+ return FALSE
+ return TRUE
+
+/// Whether someone else is standing on `tile`, so `npc` can't take cover there.
+/proc/human_npc_cover_taken(turf/tile, mob/living/npc)
+ for(var/mob/living/other in tile)
+ if(other != npc && other.density)
+ return TRUE
+ return FALSE
+
+/**
+ * The nearest tile `npc` can walk to within `max_steps` that is out of a shot's line from `threat_turf`,
+ * or null. One flood from where it stands, with the pathfinder's own step check (walls, windows, doors it
+ * has no access for), never onto or through a tile `tile_ok` (a callback taking the turf) refuses. Of the
+ * nearest, the one closest to the threat, so it can look out again. Cheap enough to run once per stun
+ * hit: it never sleeps.
+ */
+/proc/human_npc_find_cover(mob/living/npc, turf/threat_turf, max_steps = HUMAN_NPC_SENSE_COVER_STEPS, pass_flags = PASSTABLE, datum/callback/tile_ok)
+ var/turf/start = get_turf(npc)
+ if(isnull(start) || isnull(threat_turf) || start.z != threat_turf.z)
+ return null
+ var/datum/can_pass_info/pass_info = new(npc, npc.ai_controller?.get_access())
+ var/list/steps_to = list()
+ steps_to[start] = 0
+ var/list/queue = list(start)
+ var/index = 1
+ var/turf/best
+ var/best_steps = INFINITY
+ var/best_distance = INFINITY
+ while(index <= length(queue))
+ var/turf/current = queue[index++]
+ var/steps = steps_to[current]
+ // Breadth first: everything from here on is further than the cover already found
+ if(steps >= best_steps || steps >= max_steps)
+ break
+ for(var/direction in GLOB.alldirs)
+ var/turf/next = get_step(current, direction)
+ if(isnull(next) || !isnull(steps_to[next]) || next.density)
+ continue
+ if(current.LinkBlockedWithAccess(next, pass_info))
+ continue
+ steps_to[next] = steps + 1
+ if(tile_ok && !tile_ok.Invoke(next))
+ continue
+ queue += next
+ if(human_npc_cover_taken(next, npc) || human_npc_line_of_fire(threat_turf, next, pass_flags))
+ continue
+ var/distance = get_dist(next, threat_turf)
+ if(steps + 1 < best_steps || distance < best_distance)
+ best = next
+ best_steps = steps + 1
+ best_distance = distance
+ return best
+
+/**
+ * In cover with a gun that ran dry and a magazine to put in it: queues the human NPC base's reload (the
+ * player's reload) and returns TRUE. Guns loaded a round at a time wait for the family's own arming.
+ */
+/proc/human_npc_cover_reload(mob/living/carbon/npc, datum/ai_controller/controller)
+ if(world.time < controller.blackboard[BB_HUMAN_NPC_ARMING_RETRY_AT])
+ return FALSE
+ var/obj/item/gun/ballistic/gun = human_npc_held_gun(npc)
+ if(!istype(gun) || gun.internal_magazine || gun.can_shoot() || !human_npc_can_reload(npc, gun))
+ return FALSE
+ controller.queue_behavior(/datum/ai_behavior/human_npc_reload)
+ return TRUE
diff --git a/voidcrew/modules/human_npcs/human_npc_gear.dm b/voidcrew/modules/human_npcs/human_npc_gear.dm
new file mode 100644
index 00000000000..557828ce6ab
--- /dev/null
+++ b/voidcrew/modules/human_npcs/human_npc_gear.dm
@@ -0,0 +1,247 @@
+// Human NPC gear lock (owner decision D3): everything a human NPC wears or holds stays on its body
+// and never becomes loot. Its designed death drops (human_npc.dm, npc_drop_death_loot()) are the
+// only things a player gets from killing one.
+//
+// How it holds, using tg's own inventory paths rather than special cases per route:
+// * A drop that would put the item anywhere but on a human NPC is refused (COMSIG_ITEM_PRE_UNEQUIP):
+// disarm shoves, a held item dropped on a knockdown, gib item drops, a stray transferItemToLoc().
+// The NPC's own moves inside its inventory (magazine into its gun, gun into its holster, a tank
+// into its suit storage) still work, because they end on the NPC.
+// * Locked items carry TRAIT_NO_STRIP: tg's strip menu shows their slots as empty and won't take them.
+// The menu still opens, so what isn't gear (a captain's ship key in his pocket) can be taken off a
+// cuffed or downed NPC as off a person.
+// * Anything that forces the item out of the body anyway (an arm cut off still holding the gun, a
+// head knocked off with the helmet on, species changes, admin undress) lands outside the NPC, and
+// the item is deleted on the next tick (COMSIG_MOVABLE_MOVED). The wait lets tg code that moves an
+// item twice in one call finish: a tactical reload drops the old magazine on the floor and then
+// puts it back in the NPC's hand.
+// * Locked items can't be sold (COMSIG_ITEM_PRE_EXPORT) and carry no materials, so an NPC corpse put
+// through the cargo shuttle or an emagged recycler yields nothing for its kit.
+// * When the body is deleted (corpse cleanup, gibbing, a site unloading) the gear goes with it,
+// since /atom/movable/Destroy() deletes contents.
+// * A player who ends up in control of an NPC body (a brain transplant) loses its gear at once
+// (human_npc.dm, Login()).
+//
+// Organs and body parts are the body, not gear: they come off and can be harvested the way a
+// player's do (cyberware is the exception: it burns out to scrap, human_npc.dm). Ammunition casings
+// are not locked either, so spent brass stays on the floor.
+//
+// The exceptions, explicit and tested:
+// * GLOB.human_npc_not_gear: items whose loss would break something outside the NPC (a ship key, a
+// contract's recovery item, bounty proof, a paper someone has to read). Never locked; they drop at
+// the NPC's feet when it dies.
+// * GLOB.human_npc_consumable_gear: things an NPC uses up (grenades, barrier grenades, bottles, syringe
+// darts, medipens, pills, bandages and other medical stacks, thrown spears, stars and bolas). They
+// may leave its body the way a person's would: thrown, fired, dropped or knocked out of its hand.
+// They still never become loot: in anyone's hands or bags but a human NPC's they are deleted, and
+// loose ones go when the NPC that carried them does.
+// * NPCs with npc_gear_locked = FALSE lock nothing at all (owner ruling OC-11: prisoners' jumpsuits,
+// contraband and shivs are ordinary items, so shakedowns, confiscation and uniform swaps work). Their
+// guards keep the lock.
+
+/// Items an NPC carries that aren't its gear: never locked, dropped when it dies. Their loss would
+/// break something outside the NPC (the cryo pod refuses to delete the first two for the same reason).
+GLOBAL_LIST_INIT(human_npc_not_gear, typecacheof(list(
+ /obj/item/ship_key,
+ /obj/item/mission_recovery,
+ /obj/item/bounty_proof,
+ /obj/item/paper,
+)))
+
+/// Items an NPC uses up: they leave its body like a person's would, but never become loot.
+GLOBAL_LIST_INIT(human_npc_consumable_gear, typecacheof(list(
+ /obj/item/grenade,
+ /obj/item/reagent_containers/cup/glass/bottle,
+ /obj/item/reagent_containers/syringe,
+ /obj/item/reagent_containers/hypospray/medipen,
+ /obj/item/reagent_containers/applicator/pill,
+ /obj/item/stack/medical,
+ /obj/item/spear,
+ /obj/item/throwing_star,
+ /obj/item/restraints/legcuffs/bola,
+)))
+
+/// Trait source for the gear lock's traits, shared by the element and the consumable component.
+#define HUMAN_NPC_GEAR_TRAIT_SOURCE "human_npc_gear_lock"
+
+/// Locks an item to the human NPC body that carries it. Safe to call again on a locked item.
+/datum/element/human_npc_gear
+ element_flags = ELEMENT_DETACH_ON_HOST_DESTROY
+
+/datum/element/human_npc_gear/Attach(datum/target)
+ . = ..()
+ if(!isitem(target))
+ return ELEMENT_INCOMPATIBLE
+ var/obj/item/gear = target
+ gear.add_traits(list(TRAIT_HUMAN_NPC_GEAR, TRAIT_NO_STRIP), HUMAN_NPC_GEAR_TRAIT_SOURCE)
+ RegisterSignal(gear, COMSIG_ITEM_PRE_UNEQUIP, PROC_REF(on_pre_unequip))
+ RegisterSignal(gear, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
+ RegisterSignal(gear, COMSIG_ITEM_PRE_EXPORT, PROC_REF(on_pre_export))
+ human_npc_gear_strip_materials(gear)
+
+/datum/element/human_npc_gear/Detach(datum/source)
+ UnregisterSignal(source, list(COMSIG_ITEM_PRE_UNEQUIP, COMSIG_MOVABLE_MOVED, COMSIG_ITEM_PRE_EXPORT))
+ source.remove_traits(list(TRAIT_HUMAN_NPC_GEAR, TRAIT_NO_STRIP), HUMAN_NPC_GEAR_TRAIT_SOURCE)
+ return ..()
+
+/// Refuses any drop or hand-over that would leave the NPC's body. Forced moves are let through and
+/// caught by on_moved().
+/datum/element/human_npc_gear/proc/on_pre_unequip(obj/item/source, force, atom/newloc, no_move, invdrop, silent)
+ SIGNAL_HANDLER
+ if(force || isnull(newloc) || human_npc_holding(newloc))
+ return NONE
+ return COMPONENT_ITEM_BLOCK_UNEQUIP
+
+/datum/element/human_npc_gear/proc/on_moved(obj/item/source, atom/old_loc, dir, forced, list/old_locs)
+ SIGNAL_HANDLER
+ human_npc_gear_check(source)
+
+/datum/element/human_npc_gear/proc/on_pre_export(obj/item/source)
+ SIGNAL_HANDLER
+ return COMPONENT_STOP_EXPORT
+
+/**
+ * Something an NPC uses up (GLOB.human_npc_consumable_gear). It leaves the body like anyone's would:
+ * thrown, fired from a dart gun, dropped, knocked from a hand. Lying loose or in flight it stays; in
+ * anyone's hands or bags but a human NPC's it is deleted; loose, it goes when its NPC does.
+ */
+/datum/component/human_npc_consumable
+ /// The NPC it was issued to
+ var/mob/living/carbon/human/npc/owner
+
+/datum/component/human_npc_consumable/Initialize(mob/living/carbon/human/npc/owner)
+ if(!isitem(parent) || !ishumannpc(owner))
+ return COMPONENT_INCOMPATIBLE
+ src.owner = owner
+ RegisterSignal(owner, COMSIG_QDELETING, PROC_REF(on_owner_deleted))
+ human_npc_gear_strip_materials(parent)
+
+/datum/component/human_npc_consumable/RegisterWithParent()
+ var/obj/item/item = parent
+ item.add_traits(list(TRAIT_HUMAN_NPC_CONSUMABLE, TRAIT_NO_STRIP), HUMAN_NPC_GEAR_TRAIT_SOURCE)
+ RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
+ RegisterSignal(parent, COMSIG_ITEM_PRE_EXPORT, PROC_REF(on_pre_export))
+
+/datum/component/human_npc_consumable/UnregisterFromParent()
+ var/obj/item/item = parent
+ item.remove_traits(list(TRAIT_HUMAN_NPC_CONSUMABLE, TRAIT_NO_STRIP), HUMAN_NPC_GEAR_TRAIT_SOURCE)
+ UnregisterSignal(parent, list(COMSIG_MOVABLE_MOVED, COMSIG_ITEM_PRE_EXPORT))
+
+/datum/component/human_npc_consumable/Destroy(force)
+ if(owner)
+ UnregisterSignal(owner, COMSIG_QDELETING)
+ owner = null
+ return ..()
+
+/datum/component/human_npc_consumable/proc/on_moved(obj/item/source, atom/old_loc, dir, forced, list/old_locs)
+ SIGNAL_HANDLER
+ human_npc_gear_check(source)
+
+/datum/component/human_npc_consumable/proc/on_pre_export(obj/item/source)
+ SIGNAL_HANDLER
+ return COMPONENT_STOP_EXPORT
+
+/// Its NPC is gone: a loose one goes too. One still on the NPC is deleted with it anyway.
+/datum/component/human_npc_consumable/proc/on_owner_deleted(datum/source)
+ SIGNAL_HANDLER
+ var/obj/item/item = parent
+ UnregisterSignal(owner, COMSIG_QDELETING)
+ owner = null
+ if(!QDELETED(item) && !human_npc_holding(item))
+ qdel(item)
+
+/// The human NPC that `place` is, or is carried by at any depth (a gun in its hand, a magazine in a
+/// pouch on its belt, its body in a bag). Null when the chain ends on a turf or in nullspace first.
+/proc/human_npc_holding(atom/place)
+ while(place && !isturf(place))
+ if(ishumannpc(place))
+ return place
+ place = place.loc
+ return null
+
+/// Whether `item` may be where it is: on a human NPC, or for a consumable, also loose or in flight.
+/proc/human_npc_gear_allowed_at(obj/item/item)
+ if(human_npc_holding(item.loc))
+ return TRUE
+ if(!HAS_TRAIT(item, TRAIT_HUMAN_NPC_CONSUMABLE))
+ return FALSE
+ return isturf(item.loc) || istype(item.loc, /obj/projectile)
+
+/// After a move: locked gear that ended up somewhere it may not be is deleted on the next tick, unless
+/// it is back where it may be by then.
+/proc/human_npc_gear_check(obj/item/item)
+ if(QDELING(item) || human_npc_gear_allowed_at(item) || HAS_TRAIT(item, TRAIT_HUMAN_NPC_GEAR_LOST))
+ return
+ ADD_TRAIT(item, TRAIT_HUMAN_NPC_GEAR_LOST, HUMAN_NPC_GEAR_TRAIT_SOURCE)
+ addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(human_npc_gear_settle), item), 0)
+
+/// A locked item that went somewhere it may not be last tick: deleted, unless it is back by now.
+/proc/human_npc_gear_settle(obj/item/gear)
+ if(QDELETED(gear))
+ return
+ REMOVE_TRAIT(gear, TRAIT_HUMAN_NPC_GEAR_LOST, HUMAN_NPC_GEAR_TRAIT_SOURCE)
+ if(human_npc_gear_allowed_at(gear))
+ return
+ qdel(gear)
+
+/// Locked gear keeps no salvage value. Material effects (a plasteel helmet's colour and armour) live in
+/// custom_materials, so only plain items lose theirs.
+/proc/human_npc_gear_strip_materials(obj/item/gear)
+ if(length(gear.custom_materials) && !(gear.material_flags & MATERIAL_EFFECTS))
+ gear.set_custom_materials(null)
+
+/// Whether `item` is locked to a human NPC's body. For tests and admin tools.
+/proc/human_npc_gear_locked(obj/item/item)
+ return !QDELETED(item) && HAS_TRAIT(item, TRAIT_HUMAN_NPC_GEAR)
+
+/// Whether `item` is a consumable issued to a human NPC. For tests and admin tools.
+/proc/human_npc_gear_consumable(obj/item/item)
+ return !QDELETED(item) && HAS_TRAIT(item, TRAIT_HUMAN_NPC_CONSUMABLE)
+
+/**
+ * Locks `item` to this NPC's body, or issues it as a consumable, by the lists above. Items that aren't
+ * gear, body parts, organs, ammunition casings and abstract items are left alone, and so is everything
+ * on an NPC whose gear isn't locked (npc_gear_locked). Use it for anything handed to an NPC after it
+ * spawned. Returns TRUE if the item is now locked or issued.
+ */
+/mob/living/carbon/human/npc/proc/npc_lock_item(obj/item/item)
+ if(!npc_gear_locked || QDELETED(item) || isbodypart(item) || isorgan(item) || isammocasing(item) || (item.item_flags & ABSTRACT))
+ return FALSE
+ if(is_type_in_typecache(item, GLOB.human_npc_not_gear))
+ return FALSE
+ if(HAS_TRAIT(item, TRAIT_HUMAN_NPC_GEAR) || HAS_TRAIT(item, TRAIT_HUMAN_NPC_CONSUMABLE))
+ return TRUE
+ if(is_type_in_typecache(item, GLOB.human_npc_consumable_gear))
+ item.AddComponent(/datum/component/human_npc_consumable, src)
+ else
+ item.AddElement(/datum/element/human_npc_gear)
+ return TRUE
+
+/// Locks everything the NPC carries: worn, held, in pockets and bags, implants and skillchips.
+/mob/living/carbon/human/npc/proc/npc_lock_all_gear()
+ for(var/obj/item/item as anything in get_all_contents_type(/obj/item))
+ npc_lock_item(item)
+
+/// Deletes every locked or issued item the NPC carries. Used when a player takes over the body.
+/mob/living/carbon/human/npc/proc/npc_delete_locked_gear()
+ for(var/obj/item/item as anything in get_all_contents_type(/obj/item))
+ if(QDELETED(item))
+ continue
+ if(HAS_TRAIT(item, TRAIT_HUMAN_NPC_GEAR) || HAS_TRAIT(item, TRAIT_HUMAN_NPC_CONSUMABLE))
+ qdel(item)
+
+/// Drops what it carries that isn't gear (GLOB.human_npc_not_gear) at its feet, as anyone's would be
+/// found on them. Called when it dies, since nobody can search an NPC's pockets.
+/mob/living/carbon/human/npc/proc/npc_drop_not_gear()
+ var/atom/drop_spot = drop_location()
+ if(isnull(drop_spot))
+ return
+ for(var/obj/item/item as anything in get_all_contents_type(/obj/item))
+ if(QDELETED(item) || !is_type_in_typecache(item, GLOB.human_npc_not_gear))
+ continue
+ if(item.loc == src)
+ dropItemToGround(item, force = TRUE)
+ else
+ item.forceMove(drop_spot)
+
+#undef HUMAN_NPC_GEAR_TRAIT_SOURCE
diff --git a/voidcrew/modules/human_npcs/human_npc_outfits.dm b/voidcrew/modules/human_npcs/human_npc_outfits.dm
new file mode 100644
index 00000000000..c228e62a787
--- /dev/null
+++ b/voidcrew/modules/human_npcs/human_npc_outfits.dm
@@ -0,0 +1,251 @@
+/**
+ * # Human NPC outfits by zone, rank and site (N7)
+ *
+ * Toughness for human NPCs comes from what they wear (defaults 1.5), so harder zones get better kit,
+ * not more health: rags in green, a vest in yellow, a vest and helmet in red, better guns as you go.
+ *
+ * An outfit table (/datum/human_npc_outfit_table) picks a /datum/outfit for one NPC from weighted lists
+ * per zone and rank. Use one by setting npc_outfit_table on the NPC type, or by passing the table
+ * typepath as spawn_human_npc(outfit =). The zone is the spawn context's (spawn_npc_in_zone()), else
+ * the zone of the spawn turf (a ship's overmap tile when aboard one), else green. A queued order whose
+ * zone isn't known yet waits for it in the queue, up to HUMAN_NPC_ZONE_WAIT (human_npc_spawning.dm).
+ *
+ * Whatever the outfit, the site layers then make sure the NPC can live where it is made (decision D5
+ * and defaults 1.12: real suits and tanks, never immunity traits). human_npc_site_at() reads the air on
+ * the spawn turf:
+ * - HUMAN_NPC_SITE_VACUUM (too little pressure): if the outfit's suit and helmet aren't both sealed,
+ * the table's vacuum_layer replaces them with a sealed suit and helmet; it also gets a tank. A MODsuit
+ * on its back counts as sealed: tg's outfit path deploys and seals it (quick_activation()).
+ * - HUMAN_NPC_SITE_BAD_AIR (pressure fine, air not): a breath mask if nothing it wears takes internals,
+ * and a tank.
+ * - HUMAN_NPC_SITE_COLD: the table's cold_layer fills the slots the outfit leaves empty with cold-weather
+ * wear and swaps the shoes for winter boots. An outfit meant for ice planets should bring its own.
+ * A table's always_site, and the NPC's npc_always_site, add sites regardless of the air (boarders that
+ * cross vacuum). Species that need none of it (skeletons) are left alone. Resisting low pressure isn't
+ * enough on its own: vacuum is as cold as space, and only a space suit keeps that out (tg insulation),
+ * so a pressure-proof species that feels the cold (silverscale, lustrous) is still sealed; one that
+ * doesn't breathe gets no tank. The NPC then opens its tank and switches on its suit's thermal
+ * regulator, as a player would.
+ */
+
+/**
+ * Weighted outfits for one family. Lists are outfit typepath => weight. A zone left null uses the zone
+ * below it; elites and bosses fall back to the zone's regulars. Override outfits_for() to pick by
+ * anything else the NPC carries (a bounty's tier, a faction's role).
+ */
+/datum/human_npc_outfit_table
+ /// Regulars in the green zone
+ var/list/green
+ /// Regulars in the yellow zone. Null: green's.
+ var/list/yellow
+ /// Regulars in the red zone. Null: yellow's.
+ var/list/red
+ /// Elites in any zone. Null: the zone's regulars.
+ var/list/elite
+ /// Bosses in any zone. Null: elite's.
+ var/list/boss
+ /// HUMAN_NPC_SITE_* flags every NPC it dresses gets, whatever the air where it spawns
+ var/always_site = NONE
+ /// What goes over an outfit that isn't sealed, in vacuum (a /datum/human_npc_layer typepath)
+ var/datum/human_npc_layer/vacuum_layer = /datum/human_npc_layer/eva
+ /// What goes over an outfit in the cold
+ var/datum/human_npc_layer/cold_layer = /datum/human_npc_layer/cold
+
+/// The weighted outfits `npc` may get in `zone` (ZONE_*).
+/datum/human_npc_outfit_table/proc/outfits_for(mob/living/carbon/human/npc/npc, zone)
+ var/rank = npc?.npc_rank || HUMAN_NPC_RANK_REGULAR
+ if(rank >= HUMAN_NPC_RANK_BOSS && length(boss))
+ return boss
+ if(rank >= HUMAN_NPC_RANK_ELITE && length(elite))
+ return elite
+ if(zone == ZONE_RED && length(red))
+ return red
+ if(zone >= ZONE_YELLOW && length(yellow))
+ return yellow
+ return green
+
+/// One outfit typepath for `npc` in `zone`, or null if the table has nothing for it.
+/datum/human_npc_outfit_table/proc/pick_outfit(mob/living/carbon/human/npc/npc, zone)
+ var/list/choices = outfits_for(npc, zone)
+ if(!length(choices))
+ return null
+ return pick_weight(choices)
+
+/**
+ * What `spot` asks of a person standing there: HUMAN_NPC_SITE_* flags read from its air. Space and
+ * anything under tg's hazard pressure is vacuum; too little oxygen or a lungful of plasma or carbon
+ * dioxide is bad air; air below HUMAN_NPC_SITE_COLD_TEMP is cold. Only reads the air, so a planet tile
+ * keeps sharing its planet's mix (return_air_readonly(), planetary_shared_air.dm).
+ */
+/proc/human_npc_site_at(turf/spot)
+ if(isnull(spot))
+ return NONE
+ var/datum/gas_mixture/air = spot.return_air_readonly()
+ if(isnull(air))
+ return HUMAN_NPC_SITE_VACUUM | HUMAN_NPC_SITE_COLD
+ . = NONE
+ var/pressure = air.return_pressure()
+ if(pressure < HAZARD_LOW_PRESSURE)
+ . |= HUMAN_NPC_SITE_VACUUM
+ else
+ var/oxygen = human_npc_partial_pressure(air, /datum/gas/oxygen, pressure)
+ var/plasma = human_npc_partial_pressure(air, /datum/gas/plasma, pressure)
+ var/carbon_dioxide = human_npc_partial_pressure(air, /datum/gas/carbon_dioxide, pressure)
+ if(oxygen < HUMAN_NPC_SITE_MIN_OXYGEN || plasma > 0.5 || carbon_dioxide > 10)
+ . |= HUMAN_NPC_SITE_BAD_AIR
+ if(air.temperature < HUMAN_NPC_SITE_COLD_TEMP)
+ . |= HUMAN_NPC_SITE_COLD
+
+/// The partial pressure of `gas_type` in `air`, in kPa, given the mix's total `pressure`.
+/proc/human_npc_partial_pressure(datum/gas_mixture/air, gas_type, pressure)
+ var/list/entry = air.gases[gas_type]
+ var/total = air.total_moles()
+ if(!entry || !total)
+ return 0
+ return pressure * entry[MOLES] / total
+
+/**
+ * Its outfit, with whatever the site needs layered on (see the top of this file). Returns `outfit`
+ * unchanged when nothing is needed, else an outfit instance (an instance passed in is changed in place).
+ */
+/mob/living/carbon/human/npc/proc/npc_fit_outfit_to_site(outfit, datum/human_npc_outfit_table/table)
+ npc_site = human_npc_site_at(get_turf(src)) | npc_always_site | table?.always_site
+ // The cold of vacuum gets through anything but a space suit (SPACE_SUIT_MIN_TEMP_PROTECT)
+ var/needs_seal = (npc_site & HUMAN_NPC_SITE_VACUUM) && !(HAS_TRAIT(src, TRAIT_RESISTLOWPRESSURE) && HAS_TRAIT(src, TRAIT_RESISTCOLD))
+ var/needs_air = (npc_site & (HUMAN_NPC_SITE_VACUUM | HUMAN_NPC_SITE_BAD_AIR)) && !HAS_TRAIT(src, TRAIT_NOBREATH)
+ var/needs_warmth = (npc_site & HUMAN_NPC_SITE_COLD) && !HAS_TRAIT(src, TRAIT_RESISTCOLD)
+ if(!needs_seal && !needs_air && !needs_warmth)
+ return outfit
+ var/datum/outfit/dressed = ispath(outfit) ? new outfit() : outfit
+ if(!istype(dressed))
+ return outfit
+ if(needs_seal && !human_npc_outfit_sealed(dressed))
+ var/datum/human_npc_layer/seal = human_npc_singleton(table?.vacuum_layer || /datum/human_npc_layer/eva)
+ seal.apply(dressed)
+ if(needs_air && !human_npc_outfit_has_air(dressed))
+ if(!human_npc_outfit_can_breathe(dressed))
+ dressed.mask = /obj/item/clothing/mask/breath
+ human_npc_outfit_add_tank(dressed)
+ // A sealed suit with its heating on keeps out the cold of space; warm clothes go on where it isn't sealed.
+ if(needs_warmth && !(needs_seal && human_npc_outfit_sealed(dressed)))
+ var/datum/human_npc_layer/warmth = human_npc_singleton(table?.cold_layer || /datum/human_npc_layer/cold)
+ warmth.apply(dressed)
+ return dressed
+
+/// Whether the outfit's suit and helmet both hold pressure and keep out the cold of space. A fire suit or a
+/// tactical vest holds pressure too, but a person freezes in one out there (tg's cold protection). A space
+/// suit keeps it out with its thermal regulator, which comes on as an outfit puts it on if it has a cell
+/// (on_outfit_equip()).
+/proc/human_npc_outfit_sealed(datum/outfit/outfit)
+ // A MODsuit on its back deploys and seals head to toe as the outfit puts it on (quick_activation())
+ if(ispath(outfit.back, /obj/item/mod/control))
+ return TRUE
+ // Typed as a space suit only to read its cell; any suit that holds pressure is checked
+ var/obj/item/clothing/suit/space/suit = outfit.suit
+ var/obj/item/clothing/head = outfit.head
+ if(!ispath(suit, /obj/item/clothing) || !ispath(head, /obj/item/clothing))
+ return FALSE
+ if(!(initial(suit.clothing_flags) & STOPSPRESSUREDAMAGE) || !(initial(head.clothing_flags) & STOPSPRESSUREDAMAGE))
+ return FALSE
+ var/suit_cold = (ispath(suit, /obj/item/clothing/suit/space) && initial(suit.cell)) ? SPACE_SUIT_MIN_TEMP_PROTECT : initial(suit.min_cold_protection_temperature)
+ var/head_cold = initial(head.min_cold_protection_temperature)
+ return suit_cold && suit_cold <= SPACE_SUIT_MIN_TEMP_PROTECT && head_cold && head_cold <= SPACE_HELM_MIN_TEMP_PROTECT
+
+/// Whether it wears something it can breathe a tank through: a mask or a helmet that takes internals.
+/proc/human_npc_outfit_can_breathe(datum/outfit/outfit)
+ // A MODsuit's helmet takes internals once sealed
+ if(ispath(outfit.back, /obj/item/mod/control))
+ return TRUE
+ var/obj/item/clothing/mask = outfit.mask
+ var/obj/item/clothing/head = outfit.head
+ if(ispath(mask, /obj/item/clothing) && (initial(mask.clothing_flags) & MASKINTERNALS))
+ return TRUE
+ return ispath(head, /obj/item/clothing) && (initial(head.clothing_flags) & HEADINTERNALS)
+
+/// Whether it carries a tank where it can open it and can breathe through something.
+/proc/human_npc_outfit_has_air(datum/outfit/outfit)
+ if(!human_npc_outfit_can_breathe(outfit))
+ return FALSE
+ for(var/carried in list(outfit.suit_store, outfit.back, outfit.belt, outfit.l_pocket, outfit.r_pocket))
+ if(ispath(carried, /obj/item/tank/internals))
+ return TRUE
+ return FALSE
+
+/// Gives the outfit an air tank and opens it: in a space suit's or a MODsuit chestplate's storage, else a
+/// pocket, else the back or the belt. Returns TRUE if it found a place.
+/proc/human_npc_outfit_add_tank(datum/outfit/outfit)
+ if(isnull(outfit.suit_store) && (ispath(outfit.suit, /obj/item/clothing/suit/space) || ispath(outfit.back, /obj/item/mod/control)))
+ outfit.suit_store = /obj/item/tank/internals/oxygen
+ outfit.internals_slot = ITEM_SLOT_SUITSTORE
+ return TRUE
+ if(isnull(outfit.l_pocket))
+ outfit.l_pocket = /obj/item/tank/internals/emergency_oxygen/double
+ outfit.internals_slot = ITEM_SLOT_LPOCKET
+ return TRUE
+ if(isnull(outfit.r_pocket))
+ outfit.r_pocket = /obj/item/tank/internals/emergency_oxygen/double
+ outfit.internals_slot = ITEM_SLOT_RPOCKET
+ return TRUE
+ if(isnull(outfit.back))
+ outfit.back = /obj/item/tank/internals/oxygen
+ outfit.internals_slot = ITEM_SLOT_BACK
+ return TRUE
+ if(isnull(outfit.belt))
+ outfit.belt = /obj/item/tank/internals/emergency_oxygen/double
+ outfit.internals_slot = ITEM_SLOT_BELT
+ return TRUE
+ stack_trace("[outfit.type] has nowhere to carry an air tank")
+ return FALSE
+
+/**
+ * Clothing layered over an outfit for a site. Slots it sets are filled where the outfit leaves them
+ * empty, or always for the slots in `replace_slots` (ITEM_SLOT_* flags). Anything in suit storage that
+ * a replaced suit can't hold moves to the backpack, if there is one.
+ */
+/datum/human_npc_layer
+ var/suit
+ var/head
+ var/mask
+ var/gloves
+ var/shoes
+ var/neck
+ /// ITEM_SLOT_* flags of slots it takes over even when the outfit fills them
+ var/replace_slots = NONE
+
+/datum/human_npc_layer/proc/apply(datum/outfit/outfit)
+ if(suit && (isnull(outfit.suit) || (replace_slots & ITEM_SLOT_OCLOTHING)))
+ if(outfit.suit_store && outfit.suit != suit)
+ if(outfit.back)
+ LAZYADDASSOC(outfit.backpack_contents, outfit.suit_store, 1)
+ outfit.suit_store = null
+ outfit.suit = suit
+ if(head && (isnull(outfit.head) || (replace_slots & ITEM_SLOT_HEAD)))
+ outfit.head = head
+ if(mask && (isnull(outfit.mask) || (replace_slots & ITEM_SLOT_MASK)))
+ outfit.mask = mask
+ if(gloves && (isnull(outfit.gloves) || (replace_slots & ITEM_SLOT_GLOVES)))
+ outfit.gloves = gloves
+ if(shoes && (isnull(outfit.shoes) || (replace_slots & ITEM_SLOT_FEET)))
+ outfit.shoes = shoes
+ if(neck && (isnull(outfit.neck) || (replace_slots & ITEM_SLOT_NECK)))
+ outfit.neck = neck
+
+/// A plain sealed EVA suit and helmet, the fallback for any family in vacuum.
+/datum/human_npc_layer/eva
+ suit = /obj/item/clothing/suit/space/eva
+ head = /obj/item/clothing/head/helmet/space/eva
+ replace_slots = ITEM_SLOT_OCLOTHING | ITEM_SLOT_HEAD
+
+/// Pirates' own space suit: lighter, armoured, and it holds a gun.
+/datum/human_npc_layer/eva/pirate
+ suit = /obj/item/clothing/suit/space/pirate
+ head = /obj/item/clothing/head/helmet/space/pirate
+
+/// Cold-weather wear for whatever an outfit leaves bare.
+/datum/human_npc_layer/cold
+ suit = /obj/item/clothing/suit/hooded/wintercoat
+ head = /obj/item/clothing/head/costume/ushanka
+ gloves = /obj/item/clothing/gloves/color/black
+ shoes = /obj/item/clothing/shoes/winterboots
+ neck = /obj/item/clothing/neck/scarf
+ replace_slots = ITEM_SLOT_FEET
diff --git a/voidcrew/modules/human_npcs/human_npc_outfits_pirates.dm b/voidcrew/modules/human_npcs/human_npc_outfits_pirates.dm
new file mode 100644
index 00000000000..199f63e5af5
--- /dev/null
+++ b/voidcrew/modules/human_npcs/human_npc_outfits_pirates.dm
@@ -0,0 +1,398 @@
+/**
+ * # Pirate faction outfits for human NPCs (N7, for phase B)
+ *
+ * The faction looks are today's faction pirate corpse outfits (voidcrew/modules/npc_ships/code/
+ * faction_pirates/faction_pirate_corpses.dm), so a human pirate looks like the pirate players already
+ * know. These subtypes add what the basic mob only drew: the real weapon in hand, and the real spare
+ * magazines, shells or backup knife it fights on with (human_npc_ai.dm reloads from them the way a player
+ * does). Energy guns can't be reloaded by hand, so energy gunners carry a knife.
+ *
+ * Guns per faction follow PR #500's crew gun weights; melee weapons, captains and bosses hold what the
+ * basic mobs hold today, the bosses' with their own attack verbs (faction_pirate_humans.dm). The melee
+ * crew carry a crowbar for unpowered doors. The ship crews that wear these are in
+ * voidcrew/modules/npc_ships/code/faction_pirates/faction_pirate_humans.dm.
+ *
+ * Tables (one per faction): /datum/human_npc_outfit_table/pirate/ dresses a mixed crew (melee
+ * and gunners, the faction's captain for elites and its boss for bosses);
+ * /datum/human_npc_outfit_table/pirate//gunners only gunners. The ship crews add a boarding
+ * table per faction (sealed for vacuum) and pick by their crew_role (faction_pirate_humans.dm). In vacuum
+ * each faction gets its own space suit (vacuum_layer).
+ */
+
+/datum/human_npc_outfit_table/pirate
+ vacuum_layer = /datum/human_npc_layer/eva/pirate
+ /// Melee crew outfits: outfit typepath => weight
+ var/list/melee
+ /// Gunner outfits: outfit typepath => weight, as the faction's crew guns
+ var/list/gunners
+ /// Dress only gunners
+ var/gunners_only = FALSE
+
+/datum/human_npc_outfit_table/pirate/New()
+ . = ..()
+ if(!isnull(green))
+ return
+ green = gunners?.Copy() || list()
+ if(gunners_only)
+ return
+ for(var/outfit_type in melee)
+ green[outfit_type] = melee[outfit_type]
+
+// ===== SILVERSCALE =====
+
+/datum/human_npc_layer/eva/silverscale
+ suit = /obj/item/clothing/suit/space/pirate/silverscale
+ head = /obj/item/clothing/head/helmet/space/pirate/tophat
+
+/datum/human_npc_outfit_table/pirate/silverscale
+ vacuum_layer = /datum/human_npc_layer/eva/silverscale
+ melee = list(/datum/outfit/piratecorpse/faction/silverscale/melee/armed = 4)
+ gunners = list(
+ /datum/outfit/piratecorpse/faction/silverscale/ranged/energy_gun = 3,
+ /datum/outfit/piratecorpse/faction/silverscale/ranged/laser_rifle = 2,
+ /datum/outfit/piratecorpse/faction/silverscale/ranged/pistol = 3,
+ /datum/outfit/piratecorpse/faction/silverscale/ranged/shotgun = 1,
+ )
+ elite = list(/datum/outfit/piratecorpse/faction/silverscale/captain/armed = 1)
+ boss = list(/datum/outfit/piratecorpse/faction/silverscale/highlord/armed = 1)
+
+/datum/human_npc_outfit_table/pirate/silverscale/gunners
+ gunners_only = TRUE
+
+/datum/outfit/piratecorpse/faction/silverscale/melee/armed
+ name = "Human NPC: Silverscale Duelist"
+ r_hand = /obj/item/melee/energy/sword/pirate
+ l_pocket = /obj/item/crowbar
+
+/datum/outfit/piratecorpse/faction/silverscale/ranged/energy_gun
+ name = "Human NPC: Silverscale Marksman (energy gun)"
+ r_hand = /obj/item/gun/energy/e_gun/lethal
+ l_pocket = /obj/item/knife/combat/survival
+
+/datum/outfit/piratecorpse/faction/silverscale/ranged/laser_rifle
+ name = "Human NPC: Silverscale Marksman (laser rifle)"
+ r_hand = /obj/item/gun/energy/laser
+ l_pocket = /obj/item/knife/combat/survival
+
+/datum/outfit/piratecorpse/faction/silverscale/ranged/pistol
+ name = "Human NPC: Silverscale Marksman (pistol)"
+ r_hand = /obj/item/gun/ballistic/automatic/pistol
+ l_pocket = /obj/item/ammo_box/magazine/m9mm
+ r_pocket = /obj/item/ammo_box/magazine/m9mm
+
+/datum/outfit/piratecorpse/faction/silverscale/ranged/shotgun
+ name = "Human NPC: Silverscale Marksman (shotgun)"
+ r_hand = /obj/item/gun/ballistic/shotgun/lethal
+ belt = /obj/item/storage/belt/bandolier
+ belt_contents = list(/obj/item/ammo_casing/shotgun/buckshot = 8)
+
+/datum/outfit/piratecorpse/faction/silverscale/captain/armed
+ name = "Human NPC: Silverscale Noble"
+ r_hand = /obj/item/melee/sabre
+
+/datum/outfit/piratecorpse/faction/silverscale/highlord/armed
+ name = "Human NPC: Silverscale Highlord"
+ r_hand = /obj/item/melee/energy/sword/pirate/boss
+
+// ===== SKELETON =====
+
+/datum/human_npc_layer/eva/pirate/bandana
+ head = /obj/item/clothing/head/helmet/space/pirate/bandana
+
+// Skeletons don't breathe and shrug off vacuum and cold (their species), so they rarely need the suit.
+/datum/human_npc_outfit_table/pirate/skeleton
+ vacuum_layer = /datum/human_npc_layer/eva/pirate/bandana
+ melee = list(/datum/outfit/piratecorpse/faction/skeleton/melee/armed = 4)
+ gunners = list(
+ /datum/outfit/piratecorpse/faction/skeleton/ranged/laser_rifle = 1,
+ /datum/outfit/piratecorpse/faction/skeleton/ranged/pistol = 2,
+ /datum/outfit/piratecorpse/faction/skeleton/ranged/smg = 2,
+ /datum/outfit/piratecorpse/faction/skeleton/ranged/shotgun = 3,
+ )
+ elite = list(/datum/outfit/piratecorpse/faction/skeleton/captain/armed = 1)
+ boss = list(/datum/outfit/piratecorpse/faction/skeleton/davyjones/armed = 1)
+
+/datum/human_npc_outfit_table/pirate/skeleton/gunners
+ gunners_only = TRUE
+
+/datum/outfit/piratecorpse/faction/skeleton/melee/armed
+ name = "Human NPC: Skeleton Swashbuckler"
+ r_hand = /obj/item/melee/energy/sword/pirate
+ l_pocket = /obj/item/crowbar
+
+/datum/outfit/piratecorpse/faction/skeleton/ranged/laser_rifle
+ name = "Human NPC: Skeleton Gunner (laser rifle)"
+ r_hand = /obj/item/gun/energy/laser
+ l_pocket = /obj/item/knife/combat/survival
+
+/datum/outfit/piratecorpse/faction/skeleton/ranged/pistol
+ name = "Human NPC: Skeleton Gunner (pistol)"
+ r_hand = /obj/item/gun/ballistic/automatic/pistol
+ l_pocket = /obj/item/ammo_box/magazine/m9mm
+ r_pocket = /obj/item/ammo_box/magazine/m9mm
+
+/datum/outfit/piratecorpse/faction/skeleton/ranged/smg
+ name = "Human NPC: Skeleton Gunner (SMG)"
+ r_hand = /obj/item/gun/ballistic/automatic/mini_uzi
+ l_pocket = /obj/item/ammo_box/magazine/uzim9mm
+ r_pocket = /obj/item/ammo_box/magazine/uzim9mm
+
+/datum/outfit/piratecorpse/faction/skeleton/ranged/shotgun
+ name = "Human NPC: Skeleton Gunner (shotgun)"
+ r_hand = /obj/item/gun/ballistic/shotgun/lethal
+ belt = /obj/item/storage/belt/bandolier
+ belt_contents = list(/obj/item/ammo_casing/shotgun/buckshot = 8)
+
+/datum/outfit/piratecorpse/faction/skeleton/captain/armed
+ name = "Human NPC: Skeleton Captain"
+ r_hand = /obj/item/claymore/cutlass
+
+// His flask of cursed grog (voidcrew/modules/npc_ships/code/faction_pirates/faction_pirate_humans.dm) where
+// the corpse kept a doubloon.
+/datum/outfit/piratecorpse/faction/skeleton/davyjones/armed
+ name = "Human NPC: Davy Jones"
+ r_hand = /obj/item/claymore/cutlass/davy_jones
+ l_pocket = /obj/item/reagent_containers/cup/glass/flask/davy_jones
+
+// ===== GREY TIDE =====
+
+// Assistants in the station's grey EVA suits: slow, but sealed.
+/datum/human_npc_outfit_table/pirate/grey
+ vacuum_layer = /datum/human_npc_layer/eva
+ melee = list(/datum/outfit/piratecorpse/faction/grey/melee/armed = 4)
+ gunners = list(
+ /datum/outfit/piratecorpse/faction/grey/ranged/energy_gun = 3,
+ /datum/outfit/piratecorpse/faction/grey/ranged/laser_rifle = 3,
+ /datum/outfit/piratecorpse/faction/grey/ranged/smg = 1,
+ )
+ elite = list(/datum/outfit/piratecorpse/faction/grey/captain/armed = 1)
+ boss = list(/datum/outfit/piratecorpse/faction/grey/robust/armed = 1)
+
+/datum/human_npc_outfit_table/pirate/grey/gunners
+ gunners_only = TRUE
+
+/datum/outfit/piratecorpse/faction/grey/melee/armed
+ name = "Human NPC: Grey Tider"
+ r_hand = /obj/item/storage/toolbox/mechanical
+ l_pocket = /obj/item/crowbar
+
+/datum/outfit/piratecorpse/faction/grey/ranged/energy_gun
+ name = "Human NPC: Grey Tider Gunner (energy gun)"
+ r_hand = /obj/item/gun/energy/e_gun/lethal
+ l_pocket = /obj/item/knife/combat/survival
+
+/datum/outfit/piratecorpse/faction/grey/ranged/laser_rifle
+ name = "Human NPC: Grey Tider Gunner (laser rifle)"
+ r_hand = /obj/item/gun/energy/laser
+ l_pocket = /obj/item/knife/combat/survival
+
+/datum/outfit/piratecorpse/faction/grey/ranged/smg
+ name = "Human NPC: Grey Tider Gunner (SMG)"
+ r_hand = /obj/item/gun/ballistic/automatic/mini_uzi
+ l_pocket = /obj/item/ammo_box/magazine/uzim9mm
+ r_pocket = /obj/item/ammo_box/magazine/uzim9mm
+
+/datum/outfit/piratecorpse/faction/grey/captain/armed
+ name = "Human NPC: Tidemaster"
+ r_hand = /obj/item/storage/toolbox/syndicate
+
+/datum/outfit/piratecorpse/faction/grey/robust/armed
+ name = "Human NPC: The Robust One"
+ r_hand = /obj/item/storage/toolbox/mechanical/old/clean/robust_one
+
+// ===== LUSTROUS =====
+
+/datum/human_npc_outfit_table/pirate/lustrous
+ melee = list(/datum/outfit/piratecorpse/faction/lustrous/melee/armed = 4)
+ gunners = list(
+ /datum/outfit/piratecorpse/faction/lustrous/ranged/energy_gun = 3,
+ /datum/outfit/piratecorpse/faction/lustrous/ranged/laser_rifle = 3,
+ /datum/outfit/piratecorpse/faction/lustrous/ranged/pistol = 1,
+ )
+ elite = list(/datum/outfit/piratecorpse/faction/lustrous/captain/armed = 1)
+ boss = list(/datum/outfit/piratecorpse/faction/lustrous/radiant/armed = 1)
+
+/datum/human_npc_outfit_table/pirate/lustrous/gunners
+ gunners_only = TRUE
+
+/datum/outfit/piratecorpse/faction/lustrous/melee/armed
+ name = "Human NPC: Lustrous Scintillant"
+ r_hand = /obj/item/switchblade
+ l_pocket = /obj/item/crowbar
+
+/datum/outfit/piratecorpse/faction/lustrous/ranged/energy_gun
+ name = "Human NPC: Lustrous Coruscant (energy gun)"
+ r_hand = /obj/item/gun/energy/e_gun/lethal
+ l_pocket = /obj/item/knife/combat/survival
+
+/datum/outfit/piratecorpse/faction/lustrous/ranged/laser_rifle
+ name = "Human NPC: Lustrous Coruscant (laser rifle)"
+ r_hand = /obj/item/gun/energy/laser
+ l_pocket = /obj/item/knife/combat/survival
+
+/datum/outfit/piratecorpse/faction/lustrous/ranged/pistol
+ name = "Human NPC: Lustrous Coruscant (pistol)"
+ r_hand = /obj/item/gun/ballistic/automatic/pistol
+ l_pocket = /obj/item/ammo_box/magazine/m9mm
+ r_pocket = /obj/item/ammo_box/magazine/m9mm
+
+/datum/outfit/piratecorpse/faction/lustrous/captain/armed
+ name = "Human NPC: Lustrous Radiant"
+ r_hand = /obj/item/melee/energy/sword/pirate
+
+/datum/outfit/piratecorpse/faction/lustrous/radiant/armed
+ name = "Human NPC: The Radiant One"
+ r_hand = /obj/item/melee/energy/sword/pirate/boss/radiant
+
+// ===== INTERDYNE =====
+
+/datum/human_npc_layer/eva/interdyne
+ suit = /obj/item/clothing/suit/space/syndicate/black/med
+ head = /obj/item/clothing/head/helmet/space/syndicate/black/med
+
+/datum/human_npc_outfit_table/pirate/interdyne
+ vacuum_layer = /datum/human_npc_layer/eva/interdyne
+ melee = list(/datum/outfit/piratecorpse/faction/interdyne/melee/armed = 4)
+ gunners = list(
+ /datum/outfit/piratecorpse/faction/interdyne/ranged/energy_gun = 2,
+ /datum/outfit/piratecorpse/faction/interdyne/ranged/pistol = 2,
+ /datum/outfit/piratecorpse/faction/interdyne/ranged/smg = 3,
+ /datum/outfit/piratecorpse/faction/interdyne/ranged/shotgun = 1,
+ )
+ elite = list(/datum/outfit/piratecorpse/faction/interdyne/captain/armed = 1)
+ boss = list(/datum/outfit/piratecorpse/faction/interdyne/prime/armed = 1)
+
+/datum/human_npc_outfit_table/pirate/interdyne/gunners
+ gunners_only = TRUE
+
+/datum/outfit/piratecorpse/faction/interdyne/melee/armed
+ name = "Human NPC: Interdyne Enforcer"
+ r_hand = /obj/item/scalpel
+ l_pocket = /obj/item/crowbar
+
+/datum/outfit/piratecorpse/faction/interdyne/ranged/energy_gun
+ name = "Human NPC: Interdyne Pharmacist (energy gun)"
+ r_hand = /obj/item/gun/energy/e_gun/lethal
+ l_pocket = /obj/item/knife/combat/survival
+
+/datum/outfit/piratecorpse/faction/interdyne/ranged/pistol
+ name = "Human NPC: Interdyne Pharmacist (pistol)"
+ r_hand = /obj/item/gun/ballistic/automatic/pistol
+ l_pocket = /obj/item/ammo_box/magazine/m9mm
+ r_pocket = /obj/item/ammo_box/magazine/m9mm
+
+/datum/outfit/piratecorpse/faction/interdyne/ranged/smg
+ name = "Human NPC: Interdyne Pharmacist (SMG)"
+ r_hand = /obj/item/gun/ballistic/automatic/mini_uzi
+ l_pocket = /obj/item/ammo_box/magazine/uzim9mm
+ r_pocket = /obj/item/ammo_box/magazine/uzim9mm
+
+/datum/outfit/piratecorpse/faction/interdyne/ranged/shotgun
+ name = "Human NPC: Interdyne Pharmacist (shotgun)"
+ r_hand = /obj/item/gun/ballistic/shotgun/lethal
+ belt = /obj/item/storage/belt/bandolier
+ belt_contents = list(/obj/item/ammo_casing/shotgun/buckshot = 8)
+
+/datum/outfit/piratecorpse/faction/interdyne/captain/armed
+ name = "Human NPC: Interdyne Director"
+ r_hand = /obj/item/melee/energy/sword/pirate
+
+// Today's Director Prime shoots lasers from its body; the human one holds the gun, with its combat
+// hypospray in a pocket for phase B's self-treatment.
+/datum/outfit/piratecorpse/faction/interdyne/prime/armed
+ name = "Human NPC: Interdyne Director Prime"
+ r_hand = /obj/item/gun/energy/e_gun/lethal
+ l_pocket = /obj/item/knife/combat/survival
+ r_pocket = /obj/item/reagent_containers/hypospray/combat
+
+// ===== IRS =====
+
+/datum/human_npc_layer/eva/irs
+ suit = /obj/item/clothing/suit/space/syndicate/black
+ head = /obj/item/clothing/head/helmet/space/syndicate/black
+
+/datum/human_npc_outfit_table/pirate/irs
+ vacuum_layer = /datum/human_npc_layer/eva/irs
+ melee = list(/datum/outfit/piratecorpse/faction/irs/melee/armed = 4)
+ gunners = list(
+ /datum/outfit/piratecorpse/faction/irs/ranged/energy_gun = 1,
+ /datum/outfit/piratecorpse/faction/irs/ranged/pistol = 3,
+ /datum/outfit/piratecorpse/faction/irs/ranged/smg = 2,
+ /datum/outfit/piratecorpse/faction/irs/ranged/shotgun = 2,
+ )
+ elite = list(/datum/outfit/piratecorpse/faction/irs/captain/armed = 1)
+ boss = list(/datum/outfit/piratecorpse/faction/irs/chief/armed = 1)
+
+/datum/human_npc_outfit_table/pirate/irs/gunners
+ gunners_only = TRUE
+
+// A real telescopic baton: it knocks people down, where the basic mob's only did brute.
+/datum/outfit/piratecorpse/faction/irs/melee/armed
+ name = "Human NPC: IRS Enforcer"
+ r_hand = /obj/item/melee/baton/telescopic
+ l_pocket = /obj/item/crowbar
+
+/datum/outfit/piratecorpse/faction/irs/ranged/energy_gun
+ name = "Human NPC: IRS Agent (energy gun)"
+ r_hand = /obj/item/gun/energy/e_gun/lethal
+ l_pocket = /obj/item/knife/combat/survival
+
+/datum/outfit/piratecorpse/faction/irs/ranged/pistol
+ name = "Human NPC: IRS Agent (pistol)"
+ r_hand = /obj/item/gun/ballistic/automatic/pistol
+ l_pocket = /obj/item/ammo_box/magazine/m9mm
+ r_pocket = /obj/item/ammo_box/magazine/m9mm
+
+/datum/outfit/piratecorpse/faction/irs/ranged/smg
+ name = "Human NPC: IRS Agent (SMG)"
+ r_hand = /obj/item/gun/ballistic/automatic/mini_uzi
+ l_pocket = /obj/item/ammo_box/magazine/uzim9mm
+ r_pocket = /obj/item/ammo_box/magazine/uzim9mm
+
+/datum/outfit/piratecorpse/faction/irs/ranged/shotgun
+ name = "Human NPC: IRS Agent (shotgun)"
+ r_hand = /obj/item/gun/ballistic/shotgun/lethal
+ belt = /obj/item/storage/belt/bandolier
+ belt_contents = list(/obj/item/ammo_casing/shotgun/buckshot = 8)
+
+/datum/outfit/piratecorpse/faction/irs/captain/armed
+ name = "Human NPC: IRS Head Auditor"
+ r_hand = /obj/item/gun/energy/e_gun/lethal
+ l_pocket = /obj/item/knife/combat/survival
+
+/datum/outfit/piratecorpse/faction/irs/chief/armed
+ name = "Human NPC: IRS Chief Auditor"
+ r_hand = /obj/item/gun/energy/e_gun/lethal
+ l_pocket = /obj/item/knife/combat/survival
+ r_pocket = /obj/item/reagent_containers/hypospray/medipen/stimulants
+
+// ===== MEDIEVAL =====
+
+// Footsoldiers and the warlord hate guns (TRAIT_NOGUNS, set by phase B on their types); only the
+// crossbowmen shoot, and their crossbows recharge by themselves.
+/datum/human_npc_outfit_table/pirate/medieval
+ melee = list(/datum/outfit/piratecorpse/faction/medieval/melee/armed = 2)
+ gunners = list(/datum/outfit/piratecorpse/faction/medieval/ranged/crossbow = 1)
+ elite = list(/datum/outfit/piratecorpse/faction/medieval/captain/armed = 1)
+ boss = list(/datum/outfit/piratecorpse/faction/medieval/blackknight/armed = 1)
+
+/datum/human_npc_outfit_table/pirate/medieval/gunners
+ gunners_only = TRUE
+
+/datum/outfit/piratecorpse/faction/medieval/melee/armed
+ name = "Human NPC: Medieval Footsoldier"
+ r_hand = /obj/item/claymore/shortsword
+ l_pocket = /obj/item/crowbar
+
+/datum/outfit/piratecorpse/faction/medieval/ranged/crossbow
+ name = "Human NPC: Medieval Crossbowman"
+ r_hand = /obj/item/gun/energy/recharge/ebow/large
+ l_pocket = /obj/item/knife/combat/survival
+
+/datum/outfit/piratecorpse/faction/medieval/captain/armed
+ name = "Human NPC: Medieval Warlord"
+ r_hand = /obj/item/fireaxe/boardingaxe/warlord
+
+/datum/outfit/piratecorpse/faction/medieval/blackknight/armed
+ name = "Human NPC: The Black Knight"
+ r_hand = /obj/item/claymore/black_knight
diff --git a/voidcrew/modules/human_npcs/human_npc_samples.dm b/voidcrew/modules/human_npcs/human_npc_samples.dm
new file mode 100644
index 00000000000..216b76347d8
--- /dev/null
+++ b/voidcrew/modules/human_npcs/human_npc_samples.dm
@@ -0,0 +1,162 @@
+// Sample human NPCs: the reference kit for the base (admin spawns, tests, the measurement harness).
+// Phases B-E make their own types (pirate factions, troopers, hermits, criminals) and replace these.
+// The ranged samples carry their spare ammunition, and the spacer its own air: no NPC refills from
+// nothing or breathes vacuum.
+
+/datum/outfit/human_npc
+ name = "Human NPC"
+
+/datum/outfit/human_npc/pirate_gunner
+ name = "Human NPC: pirate gunner"
+ uniform = /obj/item/clothing/under/costume/pirate
+ suit = /obj/item/clothing/suit/costume/pirate/armored
+ head = /obj/item/clothing/head/costume/pirate/armored
+ glasses = /obj/item/clothing/glasses/eyepatch
+ gloves = /obj/item/clothing/gloves/color/black
+ shoes = /obj/item/clothing/shoes/jackboots
+ belt = /obj/item/storage/belt/military
+ belt_contents = list(
+ /obj/item/ammo_box/magazine/m9mm = 2,
+ /obj/item/knife/combat/survival = 1,
+ )
+ r_hand = /obj/item/gun/ballistic/automatic/pistol
+
+/datum/outfit/human_npc/pirate_laser
+ name = "Human NPC: pirate laser gunner"
+ uniform = /obj/item/clothing/under/costume/pirate
+ suit = /obj/item/clothing/suit/costume/pirate/armored
+ head = /obj/item/clothing/head/costume/pirate/armored
+ glasses = /obj/item/clothing/glasses/eyepatch
+ shoes = /obj/item/clothing/shoes/jackboots
+ belt = /obj/item/storage/belt/military
+ belt_contents = list(/obj/item/knife/combat/survival = 1)
+ r_hand = /obj/item/gun/energy/laser
+
+/datum/outfit/human_npc/pirate_swashbuckler
+ name = "Human NPC: pirate swashbuckler"
+ uniform = /obj/item/clothing/under/costume/pirate
+ head = /obj/item/clothing/head/costume/pirate/bandana/armored
+ glasses = /obj/item/clothing/glasses/eyepatch
+ shoes = /obj/item/clothing/shoes/jackboots
+ r_hand = /obj/item/melee/energy/sword/pirate
+
+/// For hulls and ruins open to space: a sealed suit and its own air.
+/datum/outfit/human_npc/pirate_spacer
+ name = "Human NPC: pirate spacer"
+ uniform = /obj/item/clothing/under/costume/pirate
+ suit = /obj/item/clothing/suit/space/pirate
+ head = /obj/item/clothing/head/helmet/space/pirate
+ gloves = /obj/item/clothing/gloves/color/black
+ shoes = /obj/item/clothing/shoes/jackboots
+ suit_store = /obj/item/tank/internals/oxygen
+ internals_slot = ITEM_SLOT_SUITSTORE
+ belt = /obj/item/storage/belt/military
+ belt_contents = list(/obj/item/knife/combat/survival = 1)
+ r_hand = /obj/item/gun/energy/laser
+
+/mob/living/carbon/human/npc/sample
+ faction = list(FACTION_PIRATE)
+ npc_name = "Pirate"
+
+/mob/living/carbon/human/npc/sample/gunner
+ npc_name = "Pirate Gunner"
+ npc_outfit = /datum/outfit/human_npc/pirate_gunner
+ npc_death_cash = 100
+
+/mob/living/carbon/human/npc/sample/laser
+ npc_name = "Pirate Gunner"
+ npc_outfit = /datum/outfit/human_npc/pirate_laser
+ npc_death_cash = 100
+
+/mob/living/carbon/human/npc/sample/swashbuckler
+ npc_name = "Pirate Swashbuckler"
+ npc_outfit = /datum/outfit/human_npc/pirate_swashbuckler
+ npc_death_cash = 100
+
+/mob/living/carbon/human/npc/sample/spacer
+ npc_name = "Pirate Spacer"
+ npc_outfit = /datum/outfit/human_npc/pirate_spacer
+ npc_death_cash = 100
+
+/// An elite: lands aimed crits and executions, and takes a quarter less brute and burn.
+/mob/living/carbon/human/npc/sample/elite
+ npc_name = "Pirate Bosun"
+ npc_outfit = /datum/outfit/human_npc/pirate_gunner
+ npc_rank = HUMAN_NPC_RANK_ELITE
+ npc_damage_taken = 0.75
+ npc_death_cash = 300
+
+// ===== Phase A2 samples: a voice, surrender rules and a zone table, for tests and admin spawns =====
+
+/datum/human_npc_voice/sample
+ lines = list(
+ HUMAN_NPC_BARK_DOWNED = list("I'm hit! I'm hit!", "Not like this..."),
+ HUMAN_NPC_BARK_RECOVER = list("Still breathing.", "That all you've got?"),
+ HUMAN_NPC_BARK_PLEAD = list("Please... don't.", "I give, I give..."),
+ HUMAN_NPC_BARK_CUFFED = list("These are too tight."),
+ HUMAN_NPC_BARK_SLIPPING = list("Almost got it..."),
+ HUMAN_NPC_BARK_UNCUFFED = list("Hands free."),
+ HUMAN_NPC_BARK_PULLED_FREE = list("Hands off!"),
+ HUMAN_NPC_BARK_SURRENDER = list("Alright! I give up!", "Don't shoot!"),
+ )
+ emotes = list(
+ HUMAN_NPC_BARK_DOWNED = list("collapses."),
+ )
+
+/datum/human_npc_surrender/sample
+
+/mob/living/carbon/human/npc/sample
+ npc_voice = /datum/human_npc_voice/sample
+
+/// Gives up when it is losing, and stops shooting anyone already down: the shape of a criminal.
+/mob/living/carbon/human/npc/sample/thug
+ npc_name = "Thug"
+ npc_outfit = /datum/outfit/human_npc/thug
+ npc_surrender = /datum/human_npc_surrender/sample
+ npc_target_stat = HUMAN_NPC_SPARES_DOWNED
+ npc_death_cash = 100
+
+/// Dressed by zone: rags in green, a vest in yellow, a vest, helmet and SMG in red.
+/mob/living/carbon/human/npc/sample/raider
+ npc_name = "Raider"
+ npc_outfit_table = /datum/human_npc_outfit_table/sample_raiders
+ npc_death_cash = 100
+
+/datum/human_npc_outfit_table/sample_raiders
+ green = list(/datum/outfit/human_npc/raider = 1)
+ yellow = list(/datum/outfit/human_npc/raider/vest = 1)
+ red = list(/datum/outfit/human_npc/raider/armoured = 1)
+ elite = list(/datum/outfit/human_npc/pirate_gunner = 1)
+ vacuum_layer = /datum/human_npc_layer/eva/pirate
+
+/datum/outfit/human_npc/raider
+ name = "Human NPC: raider"
+ uniform = /obj/item/clothing/under/costume/pirate
+ head = /obj/item/clothing/head/costume/pirate/bandana/armored
+ shoes = /obj/item/clothing/shoes/jackboots
+ r_hand = /obj/item/gun/ballistic/automatic/pistol
+ l_pocket = /obj/item/ammo_box/magazine/m9mm
+
+/datum/outfit/human_npc/raider/vest
+ name = "Human NPC: raider in a vest"
+ suit = /obj/item/clothing/suit/armor/vest
+ r_pocket = /obj/item/ammo_box/magazine/m9mm
+
+/datum/outfit/human_npc/raider/armoured
+ name = "Human NPC: armoured raider"
+ suit = /obj/item/clothing/suit/armor/vest
+ head = /obj/item/clothing/head/helmet
+ r_hand = /obj/item/gun/ballistic/automatic/mini_uzi
+ l_pocket = /obj/item/ammo_box/magazine/uzim9mm
+ r_pocket = /obj/item/ammo_box/magazine/uzim9mm
+
+/// A pistol and somewhere to holster it, so it has somewhere to put the gun when it gives up.
+/datum/outfit/human_npc/thug
+ name = "Human NPC: thug"
+ uniform = /obj/item/clothing/under/costume/pirate
+ shoes = /obj/item/clothing/shoes/jackboots
+ gloves = /obj/item/clothing/gloves/color/black
+ belt = /obj/item/storage/belt/holster
+ r_hand = /obj/item/gun/ballistic/automatic/pistol
+ l_pocket = /obj/item/ammo_box/magazine/m9mm
+ r_pocket = /obj/item/reagent_containers/hypospray/medipen
diff --git a/voidcrew/modules/human_npcs/human_npc_soft_crit.dm b/voidcrew/modules/human_npcs/human_npc_soft_crit.dm
new file mode 100644
index 00000000000..e60c6715fef
--- /dev/null
+++ b/voidcrew/modules/human_npcs/human_npc_soft_crit.dm
@@ -0,0 +1,162 @@
+/**
+ * # Human NPCs in soft crit (N5)
+ *
+ * A person in soft crit is on the floor and (Voidcrew's soft-crit item use, PR #284,
+ * voidcrew/edits/modules/mob/mob.dm) can use what is on them at a quarter of the speed. An NPC stays
+ * where it fell (the owner didn't want NPCs crawling about), pleads now and then, and injects a
+ * medipen it carries. Elites and bosses also fire wild from the floor, at the ground around their
+ * attacker, the way a player shooting from crit does. Everything goes through tg: the medipen is the player's "use in hand" (execute_mode()), the shot is a click with the gun.
+ * Brute packs and other medical stacks need a do_after, which tg refuses to anyone incapacitated, so a
+ * person in soft crit can't use them, and neither can an NPC.
+ *
+ * tg's basic controller turns the AI off at any stat above CONSCIOUS. human_npc_ai_able_to_run() lets a
+ * human NPC's AI run in soft crit; this subtree must then come first in its planning list, so nothing
+ * else plans while it is down. Hard crit, unconscious and dead still stop the AI.
+ *
+ * Who a family keeps attacking is npc_target_stat on the NPC (HUMAN_NPC_FINISHES_DOWNED or
+ * HUMAN_NPC_SPARES_DOWNED), written into BB_TARGET_MINIMUM_STAT at spawn.
+ */
+
+/**
+ * The run check for any controller whose pawn is a human NPC: the basic controller's, except that cuffs
+ * don't stop it (so escape_captivity can work at them, phase A) and soft crit doesn't either (so the
+ * soft-crit subtree runs). A controller of another type (PR #500's pirate crew) calls this from its own
+ * get_able_to_run().
+ */
+/proc/human_npc_ai_able_to_run(datum/ai_controller/controller)
+ var/mob/living/living_pawn = controller.pawn
+ if(HAS_TRAIT(living_pawn, TRAIT_AI_PAUSED) || world.time < controller.paused_until)
+ return AI_UNABLE_TO_RUN
+ if(living_pawn.stat && living_pawn.stat != SOFT_CRIT && !(controller.ai_traits & CAN_ACT_WHILE_DEAD))
+ return AI_UNABLE_TO_RUN
+ var/ignore_incap_flags = INCAPABLE_RESTRAINTS
+ if(controller.ai_traits & CAN_ACT_IN_STASIS)
+ ignore_incap_flags |= INCAPABLE_STASIS
+ if(controller.ai_traits & CAN_ACT_WHILE_GRABBED)
+ ignore_incap_flags |= INCAPABLE_GRAB
+ // The same test the click code uses in soft crit: crit's own incapacitation doesn't count, a stun does.
+ if(living_pawn.incapacitated_except_softcrit(ignore_incap_flags))
+ return AI_UNABLE_TO_RUN
+ if((controller.ai_traits & PAUSE_DURING_DO_AFTER) && LAZYLEN(living_pawn.do_afters))
+ return AI_UNABLE_TO_RUN | AI_PREVENT_CANCEL_ACTIONS
+ return NONE
+
+/// For a human NPC controller's on_stat_changed(): falling into soft crit drops whatever it was doing
+/// on its feet (a reload, a shot, a chase), so only the soft-crit subtree's behaviours run.
+/proc/human_npc_ai_stat_changed(datum/ai_controller/controller, new_stat)
+ if(new_stat == SOFT_CRIT)
+ controller.CancelActions()
+
+/// In soft crit: treat itself, fire wild (elites and bosses), plead. It stays where it fell. Must come first.
+/datum/ai_planning_subtree/human_npc_soft_crit
+
+/datum/ai_planning_subtree/human_npc_soft_crit/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/carbon/npc = controller.pawn
+ if(npc.stat != SOFT_CRIT)
+ return
+ var/mob/living/carbon/human/npc/human_npc = ishumannpc(npc) ? npc : null
+ if(human_npc && world.time >= human_npc.npc_next_plead)
+ human_npc.npc_next_plead = world.time + HUMAN_NPC_PLEAD_INTERVAL
+ human_npc.npc_bark(HUMAN_NPC_BARK_PLEAD)
+ if(world.time >= controller.blackboard[BB_HUMAN_NPC_NEXT_TREAT])
+ var/obj/item/treatment = human_npc_soft_crit_treatment(npc)
+ if(treatment)
+ controller.set_blackboard_key(BB_HUMAN_NPC_TREAT_ITEM, treatment)
+ controller.queue_behavior(/datum/ai_behavior/human_npc_treat_self, BB_HUMAN_NPC_TREAT_ITEM)
+ return SUBTREE_RETURN_FINISH_PLANNING
+ var/mob/living/threat = human_npc_nearest_threat(controller)
+ if(isnull(threat))
+ return SUBTREE_RETURN_FINISH_PLANNING
+ controller.set_blackboard_key(BB_HUMAN_NPC_FLEE_FROM, threat)
+ if(human_npc?.npc_rank >= HUMAN_NPC_RANK_ELITE && !isnull(human_npc_loaded_gun(npc)))
+ controller.queue_behavior(/datum/ai_behavior/human_npc_fire_wild, BB_HUMAN_NPC_FLEE_FROM)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/// Something it carries that it can use on itself in soft crit: a medipen with something in it.
+/proc/human_npc_soft_crit_treatment(mob/living/carbon/npc)
+ for(var/obj/item/reagent_containers/hypospray/medipen/pen in npc.get_all_contents_type(/obj/item/reagent_containers/hypospray/medipen))
+ if(pen.used_up || !pen.reagents?.total_volume)
+ continue
+ if(npc.is_holding(pen) || human_npc_can_draw(npc, pen))
+ return pen
+ return null
+
+/// The closest mob it can see that it would fight, whatever state that mob is in. Its target first.
+/proc/human_npc_nearest_threat(datum/ai_controller/controller)
+ var/mob/living/npc = controller.pawn
+ var/atom/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
+ if(isliving(target) && !QDELETED(target) && target.z == npc.z && can_see(npc, target, HUMAN_NPC_SIGHT_RANGE))
+ return target
+ var/mob/living/closest
+ var/closest_distance = INFINITY
+ for(var/mob/living/other in oview(HUMAN_NPC_SIGHT_RANGE, npc))
+ if(other.stat == DEAD || npc.faction_check_atom(other))
+ continue
+ var/distance = get_dist(npc, other)
+ if(distance < closest_distance)
+ closest = other
+ closest_distance = distance
+ return closest
+
+/**
+ * Uses a medipen on itself the way a player in soft crit does: takes it in hand (holstering its gun if
+ * both hands are full), then "use in hand", then lets the empty pen fall.
+ */
+/datum/ai_behavior/human_npc_treat_self
+ action_cooldown = 1 SECONDS
+ behavior_flags = AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
+
+/datum/ai_behavior/human_npc_treat_self/perform(seconds_per_tick, datum/ai_controller/controller, item_key)
+ var/mob/living/carbon/npc = controller.pawn
+ var/obj/item/reagent_containers/hypospray/medipen/pen = controller.blackboard[item_key]
+ if(!istype(pen) || QDELETED(pen) || human_npc_holding(pen) != npc)
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ if(pen.used_up)
+ if(npc.is_holding(pen))
+ npc.dropItemToGround(pen)
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
+ if(!npc.is_holding(pen))
+ if(!length(npc.get_empty_held_indexes()))
+ var/obj/item/gun/gun = human_npc_held_gun(npc)
+ if(isnull(gun) || !gun.equip_to_best_slot(npc))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ return AI_BEHAVIOR_DELAY
+ if(!human_npc_take_in_hand(npc, pen))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ return AI_BEHAVIOR_DELAY
+ if(!human_npc_ready_item(npc, pen))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ if(npc.next_move > world.time)
+ return AI_BEHAVIOR_DELAY
+ npc.execute_mode()
+ return AI_BEHAVIOR_DELAY
+
+/datum/ai_behavior/human_npc_treat_self/finish_action(datum/ai_controller/controller, succeeded, item_key)
+ . = ..()
+ controller.clear_blackboard_key(item_key)
+ controller.set_blackboard_key(BB_HUMAN_NPC_NEXT_TREAT, world.time + (succeeded ? 30 SECONDS : 10 SECONDS))
+
+/**
+ * Fires its gun from the floor at the ground around `target`, not at the person: it can barely aim.
+ * Half the rate of a standing shooter. Only for elites and bosses (the soft-crit subtree decides).
+ */
+/datum/ai_behavior/human_npc_fire_wild
+ action_cooldown = 0.5 SECONDS
+ behavior_flags = AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
+
+/datum/ai_behavior/human_npc_fire_wild/perform(seconds_per_tick, datum/ai_controller/controller, target_key)
+ var/mob/living/carbon/npc = controller.pawn
+ var/atom/target = controller.blackboard[target_key]
+ if(npc.stat != SOFT_CRIT || QDELETED(target) || !can_see(npc, target, controller.blackboard[BB_HUMAN_NPC_FIRE_RANGE] || 7))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ var/obj/item/gun/gun = human_npc_loaded_gun(npc)
+ if(isnull(gun))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
+ if(world.time < controller.blackboard[BB_HUMAN_NPC_NEXT_SHOT] || npc.next_move > world.time)
+ return AI_BEHAVIOR_DELAY
+ if(!human_npc_ready_item(npc, gun))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ var/turf/aim = pick(RANGE_TURFS(1, get_turf(target)))
+ controller.ai_interact(target = aim, combat_mode = TRUE)
+ controller.set_blackboard_key(BB_HUMAN_NPC_NEXT_SHOT, world.time + 2 * (controller.blackboard[BB_HUMAN_NPC_SHOT_DELAY] || 3 SECONDS))
+ return AI_BEHAVIOR_DELAY
diff --git a/voidcrew/modules/human_npcs/human_npc_spawning.dm b/voidcrew/modules/human_npcs/human_npc_spawning.dm
new file mode 100644
index 00000000000..c5f583c9d6b
--- /dev/null
+++ b/voidcrew/modules/human_npcs/human_npc_spawning.dm
@@ -0,0 +1,303 @@
+/**
+ * # Making human NPCs, and clearing their bodies away
+ *
+ * A human costs about 11 ms to build (spike measurement), so a boarding wave of eight built in one
+ * tick stalls the server for two. Every human NPC goes through spawn_human_npc(), which queues an
+ * order; SShuman_npcs builds HUMAN_NPC_SPAWNS_PER_FIRE of them per fire.
+ *
+ * The same subsystem cleans up corpses so they don't pile up over a 6 hour round: a body dead for
+ * its npc_corpse_lifetime is deleted the first time a sweep finds no player near it, with the limbs
+ * and organs it lost that lie unwatched on the floor. Bodies being dragged, carried or watched stay.
+ * An NPC whose own system cleans it up sets npc_corpse_lifetime = 0. It also deletes living NPCs that
+ * are walking out (npc_walk_out(), human_npc_states.dm) once they may go.
+ *
+ * An order dressed by an outfit table (human_npc_outfits.dm) needs its zone. While its spawn context
+ * is still resolving the zone (a planet level registering late), the order waits in the queue, up to
+ * HUMAN_NPC_ZONE_WAIT, and is then dressed for green.
+ */
+
+/**
+ * Queues a human NPC to be built at `where`. Returns the order; qdel() it to cancel.
+ *
+ * * npc_type - a /mob/living/carbon/human/npc typepath
+ * * where - where it appears (its turf is used)
+ * * on_spawned - called with the new mob straight after it is built, the same tick
+ * * look - overrides the type's npc_look: a /obj/effect/mob_spawn typepath, a /datum/bounty_look or a
+ * /datum/bounty_record
+ * * outfit - overrides the type's npc_outfit: an outfit typepath, or a /datum/human_npc_outfit_table
+ * typepath to pick one by zone and rank
+ * * name - overrides the type's npc_name
+ * * faction - overrides the type's faction list
+ * * context - a /datum/npc_spawn_context (voidcrew/modules/npc_scaling/); the body is built through
+ * spawn_npc_in_zone() and the context finalised after on_spawned
+ * * immediate - build it now instead of queueing it (admin tools, tests)
+ * * dir - the way it faces when it appears (a mapped spawner's dir), or NONE for its own
+ */
+/proc/spawn_human_npc(npc_type, atom/where, datum/callback/on_spawned, look, outfit, name, list/faction, datum/npc_spawn_context/context, immediate = FALSE, dir = NONE)
+ var/datum/human_npc_order/order = new(npc_type, where, on_spawned, look, outfit, name, faction, context)
+ order.dir = dir
+ if(immediate)
+ order.fulfil()
+ else
+ SShuman_npcs.queue += order
+ return order
+
+/// One queued human NPC. Holds what spawn_human_npc() was given until the body is built.
+/datum/human_npc_order
+ var/npc_type
+ var/turf/where
+ var/datum/callback/on_spawned
+ var/look
+ var/datum/outfit/outfit
+ var/name
+ var/list/faction
+ var/datum/npc_spawn_context/context
+ /// The way it faces when built, or NONE
+ var/dir = NONE
+ /// The area its spot was in when queued: the order is dropped if the spot has been reused since
+ var/area/where_area
+ /// Weakref to the map region its spot was in when queued (a packed encounter's footprint or a
+ /// reservation), for the same check; null on a level that isn't packed
+ var/datum/weakref/where_region
+ /// The ZONE_* it is dressed for, once known (resolve_zone())
+ var/zone
+ /// world.time it was queued
+ var/queued_at = 0
+ /// world.time it may next look up a zone it is waiting for
+ var/next_zone_check = 0
+ /// Weakref to the mob once it is built
+ var/datum/weakref/spawned_ref
+ /// Set once fulfil() has run, whether or not it made a mob
+ var/done = FALSE
+
+/datum/human_npc_order/New(npc_type, atom/where, datum/callback/on_spawned, look, outfit, name, list/faction, datum/npc_spawn_context/context)
+ if(!ispath(npc_type, /mob/living/carbon/human/npc))
+ CRASH("spawn_human_npc() was given [npc_type], which is not a human NPC type")
+ src.npc_type = npc_type
+ src.where = get_turf(where)
+ src.where_area = src.where?.loc
+ var/datum/region = map_region_for_turf(src.where)
+ src.where_region = region ? WEAKREF(region) : null
+ src.on_spawned = on_spawned
+ src.look = look
+ src.outfit = outfit
+ src.name = name
+ src.faction = faction?.Copy()
+ src.context = context
+ queued_at = world.time
+
+/datum/human_npc_order/Destroy(force)
+ SShuman_npcs.queue -= src
+ release()
+ return ..()
+
+/// Drops what the order held, so a fulfilled order keeps nothing alive.
+/datum/human_npc_order/proc/release()
+ where = null
+ where_area = null
+ where_region = null
+ on_spawned = null
+ look = null
+ outfit = null
+ faction = null
+ context = null
+
+/// Whether its body is dressed from an outfit table, and so needs to know its zone first.
+/datum/human_npc_order/proc/needs_zone()
+ if(ispath(outfit, /datum/human_npc_outfit_table))
+ return TRUE
+ if(outfit)
+ return FALSE
+ var/mob/living/carbon/human/npc/npc_path = npc_type
+ return !initial(npc_path.npc_outfit) && ispath(initial(npc_path.npc_outfit_table), /datum/human_npc_outfit_table)
+
+/**
+ * The zone to dress it for, or null while it is still unknown and worth waiting for: its context's
+ * zone, else the zone of its spawn turf (a ship's overmap tile when aboard one). `now` settles for
+ * green instead of waiting, as does an order that has waited HUMAN_NPC_ZONE_WAIT.
+ */
+/datum/human_npc_order/proc/resolve_zone(now = TRUE)
+ if(!isnull(zone))
+ return zone
+ zone = context?.zone_type || get_zone_type_for_player_turf(where)
+ if(isnull(zone) && (now || isnull(context) || world.time >= queued_at + HUMAN_NPC_ZONE_WAIT))
+ zone = ZONE_GREEN
+ return zone
+
+/// Whether it can be built now: it doesn't need a zone, or its zone is known. A waiting order looks
+/// its zone up at most once a second.
+/datum/human_npc_order/proc/ready()
+ if(!isnull(zone) || !needs_zone())
+ return TRUE
+ if(world.time < next_zone_check)
+ return FALSE
+ next_zone_check = world.time + 1 SECONDS
+ return !isnull(resolve_zone(now = FALSE))
+
+/**
+ * Whether the spot it was queued for is still the same place. An order can wait in the queue (up to
+ * HUMAN_NPC_ZONE_WAIT for its zone); by then the ruin or planet it was for may have unloaded and its
+ * turfs been reused by something else. The spot must still exist, be in the same area and the same
+ * packed map region, and not have become a wall.
+ */
+/datum/human_npc_order/proc/spot_still_valid()
+ if(isnull(where) || QDELETED(where))
+ return FALSE
+ if(where.loc != where_area)
+ return FALSE
+ // A region that registers after the spot was queued (a planet level coming up late) is fine; one
+ // that has gone, or been replaced by another, means the ground was recycled.
+ if(where_region && map_region_for_turf(where) != where_region.resolve())
+ return FALSE
+ return !isclosedturf(where)
+
+/// Builds the NPC now. Returns it, or null if it couldn't be built.
+/datum/human_npc_order/proc/fulfil()
+ if(done)
+ return spawned_ref?.resolve()
+ done = TRUE
+ SShuman_npcs.queue -= src
+ var/mob/living/carbon/human/npc/npc
+ if(spot_still_valid())
+ if(context)
+ npc = spawn_npc_in_zone(npc_type, where, context, finalize = FALSE, constructor_args = list(src))
+ else
+ npc = new npc_type(where, src)
+ if(QDELETED(npc))
+ release()
+ return null
+ spawned_ref = WEAKREF(npc)
+ if(dir)
+ npc.setDir(dir)
+ SShuman_npcs.spawned_total++
+ on_spawned?.Invoke(npc)
+ context?.finalize()
+ release()
+ return npc
+
+/// Marks a human NPC as admin-spawned (spawn_human_npcs verb).
+/proc/human_npc_mark_admin_spawned(mob/living/carbon/human/npc/npc)
+ npc.flags_1 |= ADMIN_SPAWNED_1
+
+SUBSYSTEM_DEF(human_npcs)
+ name = "Human NPCs"
+ flags = SS_NO_INIT
+ wait = 1
+ runlevels = RUNLEVEL_LOBBY | RUNLEVELS_DEFAULT
+ /// Orders waiting to be built, oldest first
+ var/list/datum/human_npc_order/queue = list()
+ /// Dead human NPCs whose corpses may be cleaned up
+ var/list/mob/living/carbon/human/npc/corpses = list()
+ /// The corpses this sweep still has to look at
+ var/list/mob/living/carbon/human/npc/corpse_run = list()
+ /// world.time of the next corpse sweep
+ var/next_sweep = 0
+ /// Human NPCs built this round
+ var/spawned_total = 0
+ /// Corpses cleaned up this round
+ var/faded_total = 0
+ /// Living NPCs walking out (npc_walk_out())
+ var/list/mob/living/carbon/human/npc/leavers = list()
+ /// world.time of the next check of the leavers
+ var/next_leaver_sweep = 0
+ /// NPCs that walked out this round
+ var/left_total = 0
+
+/datum/controller/subsystem/human_npcs/stat_entry(msg)
+ msg = "Q:[length(queue)]|Made:[spawned_total]|Bodies:[length(corpses)]|Faded:[faded_total]|Leaving:[length(leavers)]|Left:[left_total]"
+ return ..()
+
+/datum/controller/subsystem/human_npcs/fire(resumed = FALSE)
+ if(length(queue))
+ process_spawns(HUMAN_NPC_SPAWNS_PER_FIRE)
+ if(MC_TICK_CHECK)
+ return
+ if(length(leavers) && world.time >= next_leaver_sweep)
+ next_leaver_sweep = world.time + HUMAN_NPC_LEAVER_SWEEP_INTERVAL
+ sweep_leavers()
+ if(MC_TICK_CHECK)
+ return
+ if(!length(corpse_run))
+ if(world.time < next_sweep || !length(corpses))
+ return
+ next_sweep = world.time + HUMAN_NPC_CORPSE_SWEEP_INTERVAL
+ corpse_run = corpses.Copy()
+ var/deleted = 0
+ while(length(corpse_run))
+ var/mob/living/carbon/human/npc/body = corpse_run[length(corpse_run)]
+ corpse_run.len--
+ if(QDELETED(body))
+ corpses -= body
+ continue
+ if(body.npc_corpse_expired())
+ body.npc_fade()
+ faded_total++
+ deleted++
+ if(deleted >= HUMAN_NPC_CORPSE_DELETES_PER_FIRE || MC_TICK_CHECK)
+ return
+
+/// Builds up to `budget` queued NPCs, oldest first, passing over orders still waiting for their zone.
+/// Returns how many it built.
+/datum/controller/subsystem/human_npcs/proc/process_spawns(budget = HUMAN_NPC_SPAWNS_PER_FIRE)
+ . = 0
+ var/index = 1
+ while(index <= length(queue) && . < budget)
+ var/datum/human_npc_order/order = queue[index]
+ if(QDELETED(order) || order.done)
+ queue.Cut(index, index + 1)
+ continue
+ if(!order.ready())
+ index++
+ continue
+ queue.Cut(index, index + 1)
+ if(order.fulfil())
+ .++
+
+/// Deletes the NPCs walking out that may go now (npc_may_vanish()).
+/datum/controller/subsystem/human_npcs/proc/sweep_leavers()
+ for(var/mob/living/carbon/human/npc/leaver as anything in leavers.Copy())
+ if(QDELETED(leaver) || leaver.stat == DEAD)
+ leavers -= leaver
+ continue
+ if(leaver.npc_may_vanish())
+ leaver.npc_vanish()
+ left_total++
+
+/datum/controller/subsystem/human_npcs/proc/track_corpse(mob/living/carbon/human/npc/body)
+ corpses |= body
+
+/datum/controller/subsystem/human_npcs/proc/forget_corpse(mob/living/carbon/human/npc/body)
+ corpses -= body
+ corpse_run -= body
+
+/**
+ * Map placement for a human NPC: queues `npc_type` here when the map loads, so a ruin full of them
+ * builds over several ticks.
+ */
+/obj/effect/spawner/human_npc
+ name = "human NPC spawner"
+ icon = 'icons/effects/mapping_helpers.dmi'
+ icon_state = "mobspawner"
+ /// The /mob/living/carbon/human/npc typepath to spawn
+ var/npc_type
+ /// A name for this one NPC (a mapped character), or null for its type's
+ var/npc_name
+ /// Factions for this one NPC (a mapped camp's own side), or null for its type's
+ var/list/npc_faction
+ /// The family root this type is: never mapped and places nothing, so it may have no npc_type. A
+ /// family's own root subtype sets this to itself (tests make one of every type).
+ var/abstract_spawner_type = /obj/effect/spawner/human_npc
+
+/obj/effect/spawner/human_npc/Initialize(mapload)
+ . = ..()
+ if(!ispath(npc_type, /mob/living/carbon/human/npc))
+ if(type != abstract_spawner_type)
+ stack_trace("[type] at [AREACOORD(src)] has no human NPC type to spawn")
+ return
+#ifdef UNIT_TESTS
+ // The create-and-destroy test makes one of every type on one tile; it isn't a map, so place nothing.
+ if(GLOB.running_create_and_destroy)
+ return
+#endif
+ // The mapped spawner's dir is the way the NPC faces.
+ spawn_human_npc(npc_type, get_turf(src), name = npc_name, faction = npc_faction, context = get_npc_spawn_context(), dir = dir)
diff --git a/voidcrew/modules/human_npcs/human_npc_spike_harness.dm b/voidcrew/modules/human_npcs/human_npc_spike_harness.dm
new file mode 100644
index 00000000000..894b95afc05
--- /dev/null
+++ b/voidcrew/modules/human_npcs/human_npc_spike_harness.dm
@@ -0,0 +1,568 @@
+// Measurement harness for the human NPC spike. Compiled only with -DHUMAN_NPC_SPIKE_HARNESS;
+// nothing here exists in a normal build.
+//
+// Boots a clientless world, starts the round, builds a walled, lit, breathable test room in a
+// turf reservation, then spawns NPCs of one kind (world.params "spike_kind": human,
+// human_untrimmed or trooper) in steps of 20, 50 and 100. At each step it measures them dormant
+// (no player on their z-level), awake with nothing to fight, and in combat against damage-proof
+// human dummies; then their corpses; then a 25 vs 25 fight to the death. Results go to
+// data/human_npc_spike__*: a CSV of per-phase numbers, BYOND profiler dumps, and instance
+// censuses. The current phase name is written to data/human_npc_spike__phase.txt so an
+// outside sampler can tag process memory readings with it.
+#ifdef HUMAN_NPC_SPIKE_HARNESS
+
+/// Mobs the harness spawned and controls, assoc mob -> TRUE.
+GLOBAL_LIST_EMPTY(human_npc_spike_mobs)
+/// Whether the harness pretends a player is on the test room's z-level.
+GLOBAL_VAR_INIT(human_npc_spike_awake, FALSE)
+/// Human NPC Life() calls that got past the dormancy guard (counted in human_npc.dm under this define).
+GLOBAL_VAR_INIT(human_npc_spike_life_passes, 0)
+
+/// Same NPC with every Life() trim switched off, to measure what the trims save.
+/mob/living/carbon/human/npc/sample/laser/spike_untrimmed
+ npc_trim_life = FALSE
+
+/mob/living/carbon/human/npc/npc_players_on_level()
+ if(GLOB.human_npc_spike_mobs[src])
+ return GLOB.human_npc_spike_awake
+ return ..()
+
+// A clientless world has no clients on any z-level, so every AI would be off. While "awake", the
+// harness's own mobs get the status a mob near a player would get.
+/datum/ai_controller/get_expected_ai_status()
+ if(GLOB.human_npc_spike_awake && GLOB.human_npc_spike_mobs[pawn])
+ var/mob/living/living_pawn = pawn
+ if(living_pawn.stat != DEAD && able_to_run && !on_failed_planning_timeout && isturf(living_pawn.loc) && !living_pawn.client)
+ return AI_STATUS_ON
+ return ..()
+
+#define SPIKE_ROOM_W 30
+#define SPIKE_ROOM_H 36
+
+SUBSYSTEM_DEF(human_npc_spike)
+ name = "Human NPC Spike Harness"
+ flags = SS_NO_FIRE
+ /// human, human_untrimmed or trooper
+ var/kind = "human"
+ var/mob_type
+ var/out_prefix
+ var/csv_path
+ var/phase_path
+ var/datum/turf_reservation/reservation
+ /// Bottom-left floor turf of the test room.
+ var/turf/origin
+ var/list/turf/room_turfs = list()
+ var/list/mob/living/npcs = list()
+ var/list/mob/living/dummies = list()
+
+/datum/controller/subsystem/human_npc_spike/Initialize()
+ Master.sleep_offline_after_initializations = FALSE
+ var/list/params = world.params
+ kind = params?["spike_kind"] || "human"
+ switch(kind)
+ if("trooper")
+ mob_type = /mob/living/basic/trooper/pirate/ranged
+ if("human_untrimmed")
+ mob_type = /mob/living/carbon/human/npc/sample/laser/spike_untrimmed
+ else
+ kind = "human"
+ mob_type = /mob/living/carbon/human/npc/sample/laser
+ if(params?["spike_mode"] == "dormancy")
+ kind = "[kind]_dormancy"
+ out_prefix = "data/human_npc_spike_[kind]"
+ csv_path = "[out_prefix]_results.csv"
+ phase_path = "[out_prefix]_phase.txt"
+ fdel(csv_path)
+ rustg_file_write("kind,phase,n,metric,value\n", csv_path)
+ set_phase("init")
+ SSticker.start_immediately = TRUE
+ if(params?["spike_mode"] == "dormancy")
+ INVOKE_ASYNC(src, PROC_REF(run_dormancy_proof))
+ else
+ INVOKE_ASYNC(src, PROC_REF(run_spike))
+ return SS_INIT_SUCCESS
+
+/datum/controller/subsystem/human_npc_spike/proc/set_phase(label)
+ rustg_file_write(label, phase_path)
+ log_world("human_npc_spike: phase [label]")
+
+/datum/controller/subsystem/human_npc_spike/proc/record(phase, n, metric, value)
+ rustg_file_append("[kind],[phase],[n],[metric],[value]\n", csv_path)
+
+/datum/controller/subsystem/human_npc_spike/proc/run_spike()
+ UNTIL(SSticker.current_state == GAME_STATE_PLAYING)
+ SSticker.delay_end = TRUE
+ SSprofiler.can_fire = FALSE
+ world.Profile(PROFILE_STOP)
+ set_phase("settle_roundstart")
+ sleep(60 SECONDS)
+ if(!build_room())
+ set_phase("failed_room")
+ return
+ sleep(10 SECONDS)
+ census("baseline")
+ measure("baseline", 0, 30 SECONDS)
+ profile("baseline", 0, 15 SECONDS)
+
+ for(var/n in list(20, 50, 100))
+ spawn_npcs_to(n)
+ set_awake(FALSE)
+ settle("spawned", n, 20 SECONDS)
+ if(n == 100)
+ census("spawned_100")
+ measure("dormant", n, 30 SECONDS)
+ set_awake(TRUE)
+ settle("awake_settle", n, 10 SECONDS)
+ measure("awake", n, 30 SECONDS)
+ profile("awake", n, 15 SECONDS)
+ spawn_dummies()
+ settle("combat_settle", n, 10 SECONDS)
+ measure("combat", n, 45 SECONDS)
+ profile("combat", n, 15 SECONDS)
+ clear_dummies()
+ set_awake(FALSE)
+ settle("post_combat", n, 10 SECONDS)
+ clear_debris()
+
+ bulk_memory(400)
+
+ // Corpses: kill every NPC the way a fight would, then measure the bodies left behind.
+ set_awake(TRUE)
+ kill_npcs()
+ settle("corpse_settle", 100, 20 SECONDS)
+ census("corpses_100")
+ measure("corpses_awake", 100, 30 SECONDS)
+ profile("corpses_awake", 100, 15 SECONDS)
+ set_awake(FALSE)
+ measure("corpses_dormant", 100, 30 SECONDS)
+ clear_room()
+ settle("cleared", 0, 20 SECONDS)
+ census("cleared")
+
+ team_fight(25)
+ settle("after_fight", 0, 10 SECONDS)
+ clear_room()
+ settle("cleared_fight", 0, 15 SECONDS)
+
+ bench_spawn_and_kill(20)
+ clear_room()
+ settle("cleared_bench", 0, 10 SECONDS)
+ bench_hits(/obj/projectile/bullet/c9mm, 150)
+ bench_hits(/obj/projectile/beam/laser, 150)
+ clear_room()
+ settle("cleared_hits", 0, 15 SECONDS)
+
+ // The same fight again under the profiler, to see where its time goes.
+ world.Profile(PROFILE_CLEAR)
+ world.Profile(PROFILE_START)
+ team_fight(25, "fight_profiled")
+ var/fight_profile = world.Profile(PROFILE_REFRESH, format = "json")
+ world.Profile(PROFILE_STOP)
+ rustg_file_write(fight_profile, "[out_prefix]_profile_fight_25.json")
+ settle("after_fight_profiled", 0, 10 SECONDS)
+ set_phase("done")
+
+/**
+ * spike_mode=dormancy: a short run for the production base. Queues 100 NPCs through
+ * spawn_human_npc() and records how many were built per tick, then measures their Life() and AI
+ * cost dormant, awake, and as corpses without and with a player on the z-level, counting the Life()
+ * calls that got past the dormancy guard in each phase, and checks that a waking corpse catches up
+ * the organ decay it slept through.
+ */
+/datum/controller/subsystem/human_npc_spike/proc/run_dormancy_proof()
+ UNTIL(SSticker.current_state == GAME_STATE_PLAYING)
+ SSticker.delay_end = TRUE
+ SSprofiler.can_fire = FALSE
+ world.Profile(PROFILE_STOP)
+ set_phase("settle_roundstart")
+ sleep(45 SECONDS)
+ if(!build_room())
+ set_phase("failed_room")
+ return
+ sleep(10 SECONDS)
+ census("baseline")
+ measure("baseline", 0, 20 SECONDS)
+ queue_npcs(100)
+ set_awake(FALSE)
+ settle("spawned", 100, 15 SECONDS)
+ life_phase("dormant", 100, 30 SECONDS)
+ set_awake(TRUE)
+ settle("awake_settle", 100, 5 SECONDS)
+ life_phase("awake", 100, 30 SECONDS)
+ kill_npcs()
+ set_awake(FALSE)
+ settle("corpse_settle", 100, 10 SECONDS)
+ life_phase("corpses_dormant", 100, 30 SECONDS)
+ var/mob/living/carbon/human/sample_corpse
+ for(var/mob/living/carbon/human/npc/body as anything in npcs)
+ if(!QDELETED(body) && body.stat == DEAD)
+ sample_corpse = body
+ break
+ var/obj/item/organ/brain/brain = sample_corpse?.get_organ_slot(ORGAN_SLOT_BRAIN)
+ record("decay", 100, "brain_damage_asleep", brain?.damage)
+ set_awake(TRUE)
+ life_phase("corpses_awake", 100, 30 SECONDS)
+ record("decay", 100, "brain_damage_after_waking", brain?.damage)
+ set_phase("done")
+
+/// Queues `count` NPCs through the production spawn queue and records how fast it builds them.
+/datum/controller/subsystem/human_npc_spike/proc/queue_npcs(count)
+ set_phase("queueing_[count]")
+ var/start_built = SShuman_npcs.spawned_total
+ var/start_time = world.time
+ var/first_slot = length(npcs)
+ for(var/i in 1 to count)
+ spawn_human_npc(mob_type, npc_slot(first_slot + i), on_spawned = CALLBACK(src, PROC_REF(adopt_npc)))
+ var/most_in_one_tick = 0
+ var/last_built = start_built
+ var/ticks = 0
+ while(SShuman_npcs.spawned_total - start_built < count && ticks < 4000)
+ sleep(world.tick_lag)
+ ticks++
+ most_in_one_tick = max(most_in_one_tick, SShuman_npcs.spawned_total - last_built)
+ last_built = SShuman_npcs.spawned_total
+ record("spawn_queue", count, "built", SShuman_npcs.spawned_total - start_built)
+ record("spawn_queue", count, "ticks", ticks)
+ record("spawn_queue", count, "seconds", (world.time - start_time) / 10)
+ record("spawn_queue", count, "most_built_in_one_tick", most_in_one_tick)
+
+/datum/controller/subsystem/human_npc_spike/proc/adopt_npc(mob/living/npc)
+ npcs += npc
+ GLOB.human_npc_spike_mobs[npc] = TRUE
+ RegisterSignal(npc, COMSIG_QDELETING, PROC_REF(forget_mob))
+
+/// measure(), plus how many Life() calls got past the dormancy guard.
+/datum/controller/subsystem/human_npc_spike/proc/life_phase(label, n, duration)
+ GLOB.human_npc_spike_life_passes = 0
+ var/start = world.time
+ measure(label, n, duration)
+ var/seconds = max((world.time - start) / 10, 1)
+ record(label, n, "life_passes", GLOB.human_npc_spike_life_passes)
+ record(label, n, "life_passes_per_npc_per_s", GLOB.human_npc_spike_life_passes / max(n, 1) / seconds)
+
+/datum/controller/subsystem/human_npc_spike/proc/settle(label, n, duration)
+ set_phase("[label]_[n]")
+ sleep(duration)
+
+/datum/controller/subsystem/human_npc_spike/proc/build_room()
+ reservation = SSmapping.request_turf_block_reservation(SPIKE_ROOM_W + 8, SPIKE_ROOM_H + 8, requester = "human NPC spike harness")
+ if(!reservation)
+ log_world("human_npc_spike: no reservation")
+ return FALSE
+ var/turf/bottom_left = reservation.bottom_left_turfs[1]
+ origin = locate(bottom_left.x + 4, bottom_left.y + 4, bottom_left.z)
+ var/area/misc/testroom/room_area = GLOB.areas_by_type[/area/misc/testroom] || new
+ for(var/dx in -1 to SPIKE_ROOM_W)
+ for(var/dy in -1 to SPIKE_ROOM_H)
+ var/turf/spot = locate(origin.x + dx, origin.y + dy, origin.z)
+ var/edge = dx == -1 || dy == -1 || dx == SPIKE_ROOM_W || dy == SPIKE_ROOM_H
+ if(edge)
+ spot = spot.ChangeTurf(/turf/closed/indestructible)
+ else
+ spot = spot.ChangeTurf(/turf/open/floor/iron)
+ room_turfs += spot
+ spot.change_area(spot.loc, room_area)
+ CHECK_TICK
+ record("room", 0, "z", origin.z)
+ return TRUE
+
+/// Spawn slot `index` (1-100): four columns, 25 rows, front column first.
+/datum/controller/subsystem/human_npc_spike/proc/npc_slot(index, x_front = 9, x_step = -1)
+ var/col = round((index - 1) / 25)
+ var/row = (index - 1) % 25
+ return locate(origin.x + x_front + col * x_step, origin.y + 5 + row, origin.z)
+
+/datum/controller/subsystem/human_npc_spike/proc/add_npc(turf/where, list/faction)
+ var/mob/living/npc = new mob_type(where)
+ if(faction)
+ npc.faction = faction.Copy()
+ npcs += npc
+ GLOB.human_npc_spike_mobs[npc] = TRUE
+ RegisterSignal(npc, COMSIG_QDELETING, PROC_REF(forget_mob))
+ return npc
+
+/datum/controller/subsystem/human_npc_spike/proc/forget_mob(mob/living/gone)
+ SIGNAL_HANDLER
+ npcs -= gone
+ dummies -= gone
+ GLOB.human_npc_spike_mobs -= gone
+
+/datum/controller/subsystem/human_npc_spike/proc/spawn_npcs_to(n)
+ set_phase("spawning_[n]")
+ while(length(npcs) < n)
+ add_npc(npc_slot(length(npcs) + 1))
+ CHECK_TICK
+ record("spawn", n, "npcs", length(npcs))
+ if(length(npcs))
+ var/mob/living/sample = npcs[1]
+ record("spawn", n, "atoms_in_one_npc", length(sample.get_all_contents()))
+
+/datum/controller/subsystem/human_npc_spike/proc/set_awake(awake)
+ GLOB.human_npc_spike_awake = awake
+ for(var/mob/living/npc as anything in GLOB.human_npc_spike_mobs)
+ var/datum/ai_controller/controller = npc.ai_controller
+ if(!controller)
+ continue
+ controller.can_idle = !awake
+ controller.reset_ai_status()
+
+/// BYOND reuses freed heap, so a few dozen mobs barely move the process's private bytes. Spawns
+/// `count` more dormant NPCs in the free half of the room so the outside sampler sees a real step,
+/// counts the world, then deletes them again.
+/datum/controller/subsystem/human_npc_spike/proc/bulk_memory(count)
+ set_phase("bulk_spawning")
+ set_awake(FALSE)
+ var/list/bulk = list()
+ for(var/i in 1 to count)
+ var/turf/where = locate(origin.x + 12 + (i - 1) % 18, origin.y + round((i - 1) / 18), origin.z)
+ bulk += add_npc(where)
+ CHECK_TICK
+ settle("bulk", length(npcs), 25 SECONDS)
+ census("bulk_[length(npcs)]")
+ settle("bulk_after_census", length(npcs), 15 SECONDS)
+ set_phase("bulk_deleting")
+ for(var/mob/living/npc as anything in bulk)
+ qdel(npc)
+ CHECK_TICK
+ settle("bulk_deleted", length(npcs), 30 SECONDS)
+
+/// Damage-proof clientless humans the NPCs see as hostile. Every hit lands and is processed, but
+/// deals nothing, so they never fall and the fight never ends.
+/datum/controller/subsystem/human_npc_spike/proc/spawn_dummies()
+ for(var/k in 0 to 4)
+ var/turf/where = locate(origin.x + 11, origin.y + 6 + k * 6, origin.z)
+ var/mob/living/carbon/human/dummy_target = new(where)
+ dummy_target.faction = list("spike_target")
+ var/datum/physiology/body = dummy_target.physiology
+ body.brute_mod = 0
+ body.burn_mod = 0
+ body.tox_mod = 0
+ body.oxy_mod = 0
+ body.stamina_mod = 0
+ body.bleed_mod = 0
+ dummies += dummy_target
+ RegisterSignal(dummy_target, COMSIG_QDELETING, PROC_REF(forget_mob))
+
+/datum/controller/subsystem/human_npc_spike/proc/clear_dummies()
+ for(var/mob/living/dummy_target as anything in dummies.Copy())
+ qdel(dummy_target)
+ dummies.Cut()
+
+/// Deletes blood, casings, dropped items and scorch marks left on the floor.
+/datum/controller/subsystem/human_npc_spike/proc/clear_debris()
+ var/removed = 0
+ for(var/turf/spot as anything in room_turfs)
+ for(var/atom/movable/thing as anything in spot)
+ if(istype(thing, /obj/effect/decal) || isitem(thing))
+ qdel(thing)
+ removed++
+ CHECK_TICK
+ record("debris", length(npcs), "removed", removed)
+
+/// Deletes everything in the room that isn't a client's mob.
+/datum/controller/subsystem/human_npc_spike/proc/clear_room()
+ for(var/turf/spot as anything in room_turfs)
+ for(var/atom/movable/thing as anything in spot)
+ if(ismob(thing))
+ var/mob/thing_mob = thing
+ if(thing_mob.client)
+ continue
+ qdel(thing)
+ CHECK_TICK
+ npcs.Cut()
+ GLOB.human_npc_spike_mobs.Cut()
+
+/// Kills every NPC with a big chest hit, as a fight would. Troopers leave their human corpse.
+/datum/controller/subsystem/human_npc_spike/proc/kill_npcs()
+ set_phase("killing")
+ for(var/mob/living/npc as anything in npcs.Copy())
+ if(QDELETED(npc))
+ continue
+ npc.apply_damage(300, BRUTE, BODY_ZONE_CHEST)
+ if(!QDELETED(npc) && npc.stat != DEAD)
+ npc.death()
+ CHECK_TICK
+ var/corpses = 0
+ for(var/turf/spot as anything in room_turfs)
+ for(var/mob/living/body in spot)
+ if(body.stat == DEAD)
+ corpses++
+ record("corpses", 100, "corpses_in_room", corpses)
+
+/// Times making `count` NPCs one by one, then killing each with one big hit (a trooper's kill
+/// includes building its human corpse). A synchronous call can't span ticks, so the tick usage
+/// delta of each call is its whole cost.
+/datum/controller/subsystem/human_npc_spike/proc/bench_spawn_and_kill(count)
+ set_phase("bench_spawn_kill")
+ set_awake(FALSE)
+ var/list/made = list()
+ var/spawn_usage = 0
+ for(var/i in 1 to count)
+ var/turf/where = npc_slot(i)
+ var/start = TICK_USAGE_REAL
+ made += add_npc(where)
+ spawn_usage += TICK_USAGE_REAL - start
+ stoplag()
+ var/kill_usage = 0
+ for(var/mob/living/npc as anything in made)
+ if(QDELETED(npc))
+ continue
+ var/start = TICK_USAGE_REAL
+ npc.apply_damage(300, BRUTE, BODY_ZONE_CHEST)
+ if(!QDELETED(npc) && npc.stat != DEAD)
+ npc.death()
+ kill_usage += TICK_USAGE_REAL - start
+ stoplag()
+ record("bench", count, "ms_per_spawn", TICK_DELTA_TO_MS(spawn_usage) / count)
+ record("bench", count, "ms_per_kill", TICK_DELTA_TO_MS(kill_usage) / count)
+
+/// Times `hits` hits of `projectile_type` from a human shooter on NPCs of the kind under test,
+/// aimed at random zones. Each hit is processed the way a fired projectile's impact is (armour
+/// check, bullet_act, wounds, gore). Damage carries between hits; an NPC that drops to hard crit
+/// or dies is replaced, untimed.
+/datum/controller/subsystem/human_npc_spike/proc/bench_hits(projectile_type, hits)
+ set_phase("bench_hits")
+ set_awake(FALSE)
+ var/turf/shooter_turf = locate(origin.x + 20, origin.y + 18, origin.z)
+ var/turf/target_turf = locate(origin.x + 20, origin.y + 20, origin.z)
+ var/mob/living/carbon/human/shooter = new(shooter_turf)
+ shooter.faction = list("spike_shooter")
+ var/mob/living/target
+ var/usage = 0
+ var/replaced = 0
+ for(var/i in 1 to hits)
+ if(QDELETED(target) || target.stat >= HARD_CRIT)
+ if(!QDELETED(target))
+ qdel(target)
+ target = add_npc(target_turf)
+ replaced++
+ var/obj/projectile/shot = new projectile_type(target_turf)
+ shot.firer = shooter
+ shot.fired_from = shooter
+ shot.starting = shooter_turf
+ shot.def_zone = human_npc_pick_aim_zone()
+ var/start = TICK_USAGE_REAL
+ target.projectile_hit(shot, shot.def_zone)
+ usage += TICK_USAGE_REAL - start
+ qdel(shot)
+ stoplag()
+ qdel(shooter)
+ var/projectile_name = replacetext("[projectile_type]", "/obj/projectile/", "")
+ record("bench", hits, "ms_per_hit:[projectile_name]", TICK_DELTA_TO_MS(usage) / hits)
+ record("bench", hits, "targets_used:[projectile_name]", replaced)
+
+/// Two teams of `per_side`, the kind under test on both, fight until one side is down.
+/datum/controller/subsystem/human_npc_spike/proc/team_fight(per_side, label = "fight")
+ var/list/team_a = list()
+ var/list/team_b = list()
+ for(var/i in 1 to per_side)
+ team_a += add_npc(npc_slot(i, x_front = 9, x_step = -1), list("spike_a"))
+ team_b += add_npc(npc_slot(i, x_front = 13, x_step = 1), list("spike_b"))
+ settle("[label]_spawned", per_side, 10 SECONDS)
+ set_awake(TRUE)
+ var/datum/callback/fight_over = CALLBACK(src, PROC_REF(fight_over), team_a, team_b)
+ measure(label, per_side, 180 SECONDS, fight_over)
+ record(label, per_side, "a_standing", count_standing(team_a))
+ record(label, per_side, "b_standing", count_standing(team_b))
+ var/dead = 0
+ for(var/turf/spot as anything in room_turfs)
+ for(var/mob/living/body in spot)
+ if(body.stat == DEAD)
+ dead++
+ record(label, per_side, "dead_bodies", dead)
+ set_awake(FALSE)
+
+/datum/controller/subsystem/human_npc_spike/proc/count_standing(list/team)
+ . = 0
+ for(var/mob/living/member as anything in team)
+ if(!QDELETED(member) && member.stat == CONSCIOUS)
+ .++
+
+/datum/controller/subsystem/human_npc_spike/proc/fight_over(list/team_a, list/team_b)
+ return !count_standing(team_a) || !count_standing(team_b)
+
+/// Measures `duration` of play: world.cpu per tick, time dilation, and each subsystem's CPU time
+/// from the MC's rolling usage, which records the real tick usage of every fire.
+/datum/controller/subsystem/human_npc_spike/proc/measure(label, n, duration, datum/callback/stop_when)
+ set_phase("[label]_[n]")
+ for(var/datum/controller/subsystem/subsystem as anything in Master.subsystems)
+ subsystem.rolling_usage = list()
+ Master.rolling_usage_length = 30 MINUTES
+ Master.use_rolling_usage = TRUE
+ var/start_time = world.time
+ var/start_real = REALTIMEOFDAY
+ var/end_time = world.time + duration
+ var/list/cpu_samples = list()
+ var/map_cpu_sum = 0
+ while(world.time < end_time)
+ sleep(world.tick_lag)
+ cpu_samples += world.cpu
+ map_cpu_sum += world.map_cpu
+ if(stop_when?.Invoke())
+ break
+ Master.use_rolling_usage = FALSE
+ var/game_seconds = max((world.time - start_time) / 10, 0.1)
+ var/real_seconds = max((REALTIMEOFDAY - start_real) / 10, 0.1)
+ var/samples = max(length(cpu_samples), 1)
+ var/cpu_sum = 0
+ for(var/sample in cpu_samples)
+ cpu_sum += sample
+ sortTim(cpu_samples, cmp = GLOBAL_PROC_REF(cmp_numeric_asc))
+ record(label, n, "game_seconds", game_seconds)
+ record(label, n, "real_seconds", real_seconds)
+ record(label, n, "cpu_avg", cpu_sum / samples)
+ record(label, n, "cpu_p95", length(cpu_samples) ? cpu_samples[max(1, round(length(cpu_samples) * 0.95))] : 0)
+ record(label, n, "cpu_max", length(cpu_samples) ? cpu_samples[length(cpu_samples)] : 0)
+ record(label, n, "map_cpu_avg", map_cpu_sum / samples)
+ record(label, n, "mob_living_list", length(GLOB.mob_living_list))
+ record(label, n, "ai_on", length(GLOB.ai_controllers_by_status[AI_STATUS_ON]))
+ record(label, n, "npcs_alive", count_alive())
+ var/total_ms = 0
+ for(var/datum/controller/subsystem/subsystem as anything in Master.subsystems)
+ var/list/usage = subsystem.rolling_usage
+ var/sum = 0
+ for(var/i in 2 to length(usage) step 2)
+ sum += usage[i]
+ subsystem.rolling_usage = list()
+ if(!sum)
+ continue
+ var/ms_per_second = TICK_DELTA_TO_MS(sum) / game_seconds
+ total_ms += ms_per_second
+ record(label, n, "ss_ms_per_s:[subsystem.name]", ms_per_second)
+ record(label, n, "ss_total_ms_per_s", total_ms)
+
+/datum/controller/subsystem/human_npc_spike/proc/count_alive()
+ . = 0
+ for(var/mob/living/npc as anything in npcs)
+ if(!QDELETED(npc) && npc.stat != DEAD)
+ .++
+
+/// Runs the BYOND profiler for `duration` and saves its JSON.
+/datum/controller/subsystem/human_npc_spike/proc/profile(label, n, duration)
+ set_phase("profile_[label]_[n]")
+ world.Profile(PROFILE_CLEAR)
+ world.Profile(PROFILE_START)
+ sleep(duration)
+ var/data = world.Profile(PROFILE_REFRESH, format = "json")
+ world.Profile(PROFILE_STOP)
+ rustg_file_write(data, "[out_prefix]_profile_[label]_[n].json")
+
+/// Counts every atom and datum in the world by type and saves the totals.
+/datum/controller/subsystem/human_npc_spike/proc/census(label)
+ set_phase("census_[label]")
+ var/list/atoms = count_atoms()
+ var/list/datums = count_datums()
+ var/atom_total = 0
+ for(var/key in atoms)
+ atom_total += atoms[key]
+ var/datum_total = 0
+ for(var/key in datums)
+ datum_total += datums[key]
+ record("census_[label]", 0, "atoms_total", atom_total)
+ record("census_[label]", 0, "datums_total", datum_total)
+ rustg_file_write(json_encode(list("atoms" = atoms, "datums" = datums)), "[out_prefix]_census_[label].json")
+
+#undef SPIKE_ROOM_W
+#undef SPIKE_ROOM_H
+
+#endif
diff --git a/voidcrew/modules/human_npcs/human_npc_states.dm b/voidcrew/modules/human_npcs/human_npc_states.dm
new file mode 100644
index 00000000000..279cc850d6e
--- /dev/null
+++ b/voidcrew/modules/human_npcs/human_npc_states.dm
@@ -0,0 +1,108 @@
+/**
+ * # Shared state rules for human NPCs
+ *
+ * N4, out of the fight: one test for "this body isn't fighting any more", read from tg state, used by
+ * boarding waves and the pirate pool slot (owner ruling OC-7), hull turrets, bounty pay, and AI morale.
+ *
+ * N8, walking out: a living NPC that leaves (a goon running off, a decoy heading for the lift, a crewman
+ * abandoning a fight) walks to its exit for real. Shots land, wounds slow it, cuffs and grabs stop it.
+ * It is deleted only when it stands on its exit tile, or when no player is near enough to see it
+ * (human_npc_watched()), and never while it is down, cuffed, dragged, carried or buckled. There is no
+ * godmode beam. SShuman_npcs checks the NPCs that are leaving once a second.
+ */
+
+/**
+ * Whether `body` is out of the fight: dead, in crit (tg's TRAIT_CRITICAL_CONDITION, soft or hard,
+ * asleep or not), or restrained (handcuffs, a straitjacket). Stamcrit and stuns pass, so they don't
+ * count. Works on any mob; a basic mob is out only once dead.
+ */
+/proc/human_npc_out_of_fight(mob/living/body)
+ if(QDELETED(body) || body.stat == DEAD)
+ return TRUE
+ return HAS_TRAIT(body, TRAIT_CRITICAL_CONDITION) || HAS_TRAIT(body, TRAIT_RESTRAINED)
+
+// ===== Walking out =====
+
+/**
+ * Sends it walking to `exit` (an atom; its turf is used). It is deleted on that tile, or wherever nobody
+ * can see it (npc_may_vanish()). `on_left`, if given, is called with it just before it goes, after
+ * COMSIG_HUMAN_NPC_LEFT. Call npc_stop_leaving() to call it back.
+ */
+/mob/living/carbon/human/npc/proc/npc_walk_out(atom/exit, datum/callback/on_left)
+ var/turf/exit_turf = get_turf(exit)
+ if(isnull(exit_turf) || stat == DEAD)
+ return FALSE
+ npc_exit = exit_turf
+ npc_on_left = on_left
+ SShuman_npcs.leavers |= src
+ if(istype(ai_controller))
+ ai_controller.set_blackboard_key(BB_HUMAN_NPC_EXIT, exit_turf)
+ // The way out may be round corners: walk it with a pathfinder, as a person would.
+ human_npc_set_ai_movement(ai_controller, /datum/ai_movement/jps)
+ return TRUE
+
+/// Calls off its walk out.
+/mob/living/carbon/human/npc/proc/npc_stop_leaving()
+ npc_exit = null
+ npc_on_left = null
+ SShuman_npcs.leavers -= src
+ if(istype(ai_controller))
+ ai_controller.clear_blackboard_key(BB_HUMAN_NPC_EXIT)
+ human_npc_set_ai_movement(ai_controller, initial(ai_controller.ai_movement))
+
+/**
+ * Whether a living NPC that is leaving may be deleted now: up and free (not in crit, not cuffed, not
+ * stunned, not dragged, carried or buckled, standing on a turf), and either on its exit tile or out of
+ * sight of every player.
+ */
+/mob/living/carbon/human/npc/proc/npc_may_vanish()
+ if(isnull(npc_exit) || stat != CONSCIOUS || human_npc_out_of_fight(src))
+ return FALSE
+ if(INCAPACITATED_IGNORING(src, NONE) || pulledby || buckled || !isturf(loc))
+ return FALSE
+ return get_turf(src) == npc_exit || !human_npc_watched(src)
+
+/// Switches a controller's movement type, stopping any walk the old one was doing.
+/proc/human_npc_set_ai_movement(datum/ai_controller/controller, datum/ai_movement/movement_type)
+ if(!ispath(movement_type, /datum/ai_movement))
+ return
+ if(controller.ai_movement?.moving_controllers[controller])
+ controller.ai_movement.stop_moving_towards(controller)
+ controller.change_ai_movement_type(movement_type)
+
+/// It has left: what it carries that isn't gear drops where it stood, and it is deleted with its kit.
+/mob/living/carbon/human/npc/proc/npc_vanish()
+ SShuman_npcs.leavers -= src
+ SEND_SIGNAL(src, COMSIG_HUMAN_NPC_LEFT)
+ npc_on_left?.Invoke(src)
+ npc_on_left = null
+ npc_drop_not_gear()
+ qdel(src)
+
+/// While it has somewhere to walk out to, it walks there and does nothing else.
+/datum/ai_planning_subtree/human_npc_walk_out
+
+/datum/ai_planning_subtree/human_npc_walk_out/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/npc = controller.pawn
+ if(npc.stat != CONSCIOUS || !controller.blackboard_key_exists(BB_HUMAN_NPC_EXIT))
+ return
+ controller.queue_behavior(/datum/ai_behavior/human_npc_walk_out, BB_HUMAN_NPC_EXIT)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/// Walks to the exit. SShuman_npcs deletes it when it may go (npc_may_vanish()).
+/datum/ai_behavior/human_npc_walk_out
+ required_distance = 0
+ action_cooldown = 1 SECONDS
+ behavior_flags = AI_BEHAVIOR_REQUIRE_MOVEMENT | AI_BEHAVIOR_MOVE_AND_PERFORM | AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
+
+/datum/ai_behavior/human_npc_walk_out/setup(datum/ai_controller/controller, exit_key)
+ . = ..()
+ var/turf/exit = controller.blackboard[exit_key]
+ if(isnull(exit))
+ return FALSE
+ set_movement_target(controller, exit)
+
+/datum/ai_behavior/human_npc_walk_out/perform(seconds_per_tick, datum/ai_controller/controller, exit_key)
+ if(!controller.blackboard_key_exists(exit_key))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ return AI_BEHAVIOR_DELAY
diff --git a/voidcrew/modules/human_npcs/human_npc_surrender.dm b/voidcrew/modules/human_npcs/human_npc_surrender.dm
new file mode 100644
index 00000000000..93c8f3b7f9b
--- /dev/null
+++ b/voidcrew/modules/human_npcs/human_npc_surrender.dm
@@ -0,0 +1,161 @@
+/**
+ * # Human NPC surrender (N2)
+ *
+ * Giving up is an AI choice followed by the same action a player takes (defaults 1.3, decision D3):
+ * 1. The NPC weighs its odds (a /datum/human_npc_surrender on its npc_surrender: how hurt it is, how many
+ * hostiles are on it, how many friends are still standing).
+ * 2. On a yes it stows the weapons in its hands in its own belt, bag, holster or suit storage. Its gear
+ * is locked (D3), so it never drops them; one with nowhere to put a gun keeps holding it, hands blocked.
+ * 3. It says its surrender line and runs tg's *surrender emote, a real 20 second Paralyze. That is the
+ * cuff window: tg cuffs (4 s) work on it like on anyone.
+ * 4. When the Paralyze ends and nobody cuffed it, it decides again at once: give up again, or (if its
+ * rules say so) run from the nearest hostile for a while, or fight on.
+ * There is no surrender state, trait or mark: what players see and act on is tg's Paralyze and cuffs.
+ *
+ * A family picks the numbers with a subtype, and overrides hurt_enough(), should_consider() or odds()
+ * for its own rules (the kingpin only once his crew is down; convicts the moment they are sighted, so
+ * hurt_enough() is always TRUE for them). Code that wants an NPC to give up at once calls
+ * npc_surrender() itself.
+ */
+
+/// A family's surrender rules. One shared instance per type (human_npc_singleton()).
+/datum/human_npc_surrender
+ /// Percent chance on the first roll of a fight
+ var/chance = 60
+ /// Percent chance on later rolls
+ var/retry_chance = 25
+ /// Percent taken off the chance for each friend still standing near it
+ var/ally_penalty = 20
+ /// It considers giving up only at or below this share of its health
+ var/health_share = 0.4
+ /// ...and only with at least this many hostiles near it
+ var/hostiles_needed = 2
+ /// How far it looks for hostiles and friends, in tiles
+ var/range = 7
+ /// Time between two rolls
+ var/retry_delay = 5 SECONDS
+ /// When a surrender's paralysis ends uncuffed and it decides not to give up again: run (TRUE), or fight on
+ var/flees = TRUE
+ /// How long it runs for
+ var/flee_time = 20 SECONDS
+
+/// Whether `npc` is in a bad enough way to think about giving up. Cheap: checked before it looks around.
+/datum/human_npc_surrender/proc/hurt_enough(mob/living/carbon/human/npc/npc)
+ return npc.health <= npc.maxHealth * health_share
+
+/// Whether, having looked around, it thinks about giving up.
+/datum/human_npc_surrender/proc/should_consider(mob/living/carbon/human/npc/npc, list/hostiles, list/allies)
+ return length(hostiles) >= hostiles_needed
+
+/// Percent chance it gives up on this roll. `first` is TRUE for its first roll of the fight.
+/datum/human_npc_surrender/proc/odds(mob/living/carbon/human/npc/npc, list/hostiles, list/allies, first)
+ if(!length(hostiles))
+ return 0
+ return clamp((first ? chance : retry_chance) - ally_penalty * length(allies), 0, 100)
+
+/// The living hostiles near `npc` that are still in the fight and that it can see.
+/datum/human_npc_surrender/proc/hostiles_near(mob/living/carbon/human/npc/npc)
+ . = list()
+ for(var/mob/living/other in oview(range, npc))
+ if(other.faction_check_atom(npc) || human_npc_out_of_fight(other))
+ continue
+ if(other.client || other.ai_controller?.blackboard[BB_BASIC_MOB_CURRENT_TARGET] == npc || npc.ai_controller?.blackboard[BB_BASIC_MOB_CURRENT_TARGET] == other)
+ . += other
+
+/// Its friends near it that are still standing.
+/datum/human_npc_surrender/proc/allies_near(mob/living/carbon/human/npc/npc)
+ . = list()
+ for(var/mob/living/other in oview(range, npc))
+ if(other.client || !npc.faction_check_atom(other) || human_npc_out_of_fight(other))
+ continue
+ if(other.body_position == LYING_DOWN)
+ continue
+ . += other
+
+/// The rules it surrenders by, or null if it never does.
+/mob/living/carbon/human/npc/proc/npc_surrender_rules()
+ if(!ispath(npc_surrender, /datum/human_npc_surrender))
+ return null
+ return human_npc_singleton(npc_surrender)
+
+/**
+ * Gives up now, the way a player does: weapons stowed, its surrender line, tg's *surrender (a 20 second
+ * Paralyze). Returns TRUE if it is lying there with its hands on its head.
+ */
+/mob/living/carbon/human/npc/proc/npc_surrender()
+ if(stat != CONSCIOUS || HAS_TRAIT(src, TRAIT_RESTRAINED) || npc_surrendering)
+ return FALSE
+ npc_stow_weapons()
+ npc_bark(HUMAN_NPC_BARK_SURRENDER, force = TRUE)
+ npc_surrendering = TRUE
+ emote("surrender", intentional = TRUE)
+ if(!IsParalyzed())
+ npc_surrendering = FALSE
+ return FALSE
+ npc_surrender_count++
+ SEND_SIGNAL(src, COMSIG_HUMAN_NPC_SURRENDERED)
+ return TRUE
+
+/// Puts the weapons in its hands away on its body. D3: never on the floor.
+/mob/living/carbon/human/npc/proc/npc_stow_weapons()
+ for(var/obj/item/held in held_items)
+ if(isgun(held) || human_npc_is_melee_weapon(held))
+ held.equip_to_best_slot(src)
+
+/// Its surrender's paralysis is over. Cuffed: taken, nothing to decide. Otherwise it decides again.
+/mob/living/carbon/human/npc/proc/npc_surrender_ended()
+ if(IsParalyzed())
+ return
+ npc_surrendering = FALSE
+ if(stat != CONSCIOUS || HAS_TRAIT(src, TRAIT_RESTRAINED))
+ return
+ npc_surrender_redecide = TRUE
+ SEND_SIGNAL(src, COMSIG_HUMAN_NPC_SURRENDER_ENDED)
+
+/**
+ * Rolls to give up when its rules say it is losing, and decides again straight after a surrender
+ * nobody took. Put it after escape_captivity and before targeting in any controller whose pawn is a
+ * human NPC.
+ */
+/datum/ai_planning_subtree/human_npc_surrender
+
+/datum/ai_planning_subtree/human_npc_surrender/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/carbon/human/npc/npc = controller.pawn
+ if(!ishumannpc(npc) || npc.stat != CONSCIOUS || HAS_TRAIT(npc, TRAIT_RESTRAINED))
+ return
+ var/datum/human_npc_surrender/rules = npc.npc_surrender_rules()
+ if(isnull(rules))
+ return
+ // Running after walking away from a surrender.
+ if(world.time < controller.blackboard[BB_HUMAN_NPC_FLEE_UNTIL] && controller.blackboard_key_exists(BB_HUMAN_NPC_FLEE_FROM))
+ controller.queue_behavior(/datum/ai_behavior/run_away_from_target, BB_HUMAN_NPC_FLEE_FROM)
+ return SUBTREE_RETURN_FINISH_PLANNING
+ var/redecide = npc.npc_surrender_redecide
+ if(!redecide && (world.time < npc.npc_next_surrender_roll || !rules.hurt_enough(npc)))
+ return
+ // Looking around costs, so it looks at most once per retry_delay.
+ npc.npc_next_surrender_roll = world.time + rules.retry_delay
+ npc.npc_surrender_redecide = FALSE
+ var/list/hostiles = rules.hostiles_near(npc)
+ var/list/allies = rules.allies_near(npc)
+ if(!redecide && !rules.should_consider(npc, hostiles, allies))
+ return
+ var/first = !npc.npc_surrender_rolls
+ npc.npc_surrender_rolls++
+ if(prob(rules.odds(npc, hostiles, allies, first)))
+ controller.queue_behavior(/datum/ai_behavior/human_npc_surrender)
+ return SUBTREE_RETURN_FINISH_PLANNING
+ if(redecide && rules.flees && length(hostiles))
+ controller.set_blackboard_key(BB_HUMAN_NPC_FLEE_FROM, get_closest_atom(/mob/living, hostiles, npc))
+ controller.set_blackboard_key(BB_HUMAN_NPC_FLEE_UNTIL, world.time + rules.flee_time)
+ controller.queue_behavior(/datum/ai_behavior/run_away_from_target, BB_HUMAN_NPC_FLEE_FROM)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/// Gives up (npc_surrender()).
+/datum/ai_behavior/human_npc_surrender
+
+/datum/ai_behavior/human_npc_surrender/perform(seconds_per_tick, datum/ai_controller/controller)
+ var/mob/living/carbon/human/npc/npc = controller.pawn
+ if(!ishumannpc(npc) || !npc.npc_surrender())
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
diff --git a/voidcrew/modules/human_npcs/ruins/ruin_npc_base.dm b/voidcrew/modules/human_npcs/ruins/ruin_npc_base.dm
new file mode 100644
index 00000000000..23e2866be79
--- /dev/null
+++ b/voidcrew/modules/human_npcs/ruins/ruin_npc_base.dm
@@ -0,0 +1,145 @@
+/**
+ * # Ruin, planet and mission human NPCs (phase C of the human NPC migration)
+ *
+ * The people found in ruins, on planets and at mission sites: tg's troopers (space pirates, Syndicate
+ * operatives, Nanotrasen security, Russian mobsters), the beach and boat pirates, and the wasteland hermits
+ * and poacher squads. The faction pirate crews squatting in ruins or named in kill contracts are the same
+ * faction pirates that crew NPC ships (/mob/living/carbon/human/npc/faction_pirate,
+ * voidcrew/modules/npc_ships/code/faction_pirates/faction_pirate_humans.dm), which do the same things for
+ * themselves (planet alliance, spot line, contract cash). They were
+ * basic and simple mobs that swapped to a corpse on death; now they are real
+ * /mob/living/carbon/human/npc bodies (voidcrew/modules/human_npcs/), so wounds, crit, bleeding,
+ * medicine, cuffs and revival work on them as on players. Developer notes: kit vault modules/human_npcs.md.
+ *
+ * What the families share (this root):
+ * - They belong where they spawn. On a planet they join its fauna's alliance (map_footprint.dm), as the
+ * mobs they replace did, so hermits and beach pirates don't fight the local wildlife. Anywhere else they
+ * keep their own factions.
+ * - A "spot" line when they pick someone new to fight (RUIN_NPC_BARK_SPOT).
+ * - Zone outfit tables (/datum/human_npc_outfit_table/ruin): more armour, better guns and a medipen in
+ * the yellow and red zones, never more health, and outfits of their own on cold sites.
+ * - spawn_npc_in_zone_or_queue(): planet, biome and marker spawners queue human types through
+ * spawn_human_npc() instead of building a dozen bodies in one tick.
+ * - A kill contract's cash entitlement (npc_payout_mission): a named target pays its cash once per
+ * contract, as the faction pirates did.
+ */
+
+/// Bark kind: it picked someone new to fight.
+#define RUIN_NPC_BARK_SPOT "spot"
+
+/mob/living/carbon/human/npc/ruin
+ npc_target_stat = HUMAN_NPC_FINISHES_DOWNED
+ /// Weakref to the /datum/mission whose named target this is; its death cash pays only if that
+ /// contract can still claim it (/datum/mission/proc/claim_boss_cash()).
+ var/datum/weakref/npc_payout_mission
+ /// Weakref to the last mob it called out, so one fight gives one "spot" line
+ var/datum/weakref/npc_spotted
+ /// The ZONE_* its spawn order dressed it for, or null if it was made without one
+ var/npc_dressed_zone
+
+/mob/living/carbon/human/npc/ruin/Initialize(mapload, datum/human_npc_order/order)
+ . = ..()
+ npc_dressed_zone = order?.resolve_zone()
+ // tg's Initialize gave it the planet's alliance before it was dressed; a mapped or ordered faction
+ // list has replaced its factions since, so it rejoins here.
+ inherit_planetary_faction(src)
+ AddElement(/datum/element/human_npc_spot_bark)
+
+/mob/living/carbon/human/npc/ruin/Destroy()
+ npc_payout_mission = null
+ npc_spotted = null
+ return ..()
+
+/**
+ * The zone it belongs to, for zone-laddered loot: its spawn context's, which may have resolved after it
+ * was made (a ruin loading before its planet registered), else the zone it was dressed for, else where
+ * it stands.
+ */
+/mob/living/carbon/human/npc/ruin/proc/npc_home_zone()
+ return npc_spawn_context?.zone_type || npc_dressed_zone || npc_spawn_zone()
+
+// Natives of the planet they spawn on, like the fauna they share it with.
+/mob/living/carbon/human/npc/ruin/should_inherit_planetary_faction()
+ return TRUE
+
+// A named contract target's cash goes to the contract once (the faction pirates' rule): if the
+// contract is gone or has already paid, the body carries none.
+/mob/living/carbon/human/npc/ruin/npc_drop_death_loot()
+ if(!npc_loot_dropped && npc_death_cash > 0 && npc_payout_mission)
+ var/datum/mission/mission = npc_payout_mission.resolve()
+ if(!mission?.claim_boss_cash())
+ npc_death_cash = 0
+ return ..()
+
+/**
+ * Says the family's spot line when the NPC picks someone new to fight. An element, so the NPC's own
+ * types can listen to the same blackboard signal.
+ */
+/datum/element/human_npc_spot_bark
+ element_flags = ELEMENT_DETACH_ON_HOST_DESTROY
+
+/datum/element/human_npc_spot_bark/Attach(datum/target)
+ . = ..()
+ if(!istype(target, /mob/living/carbon/human/npc/ruin))
+ return ELEMENT_INCOMPATIBLE
+ RegisterSignal(target, COMSIG_AI_BLACKBOARD_KEY_SET(BB_BASIC_MOB_CURRENT_TARGET), PROC_REF(on_target_set))
+
+/datum/element/human_npc_spot_bark/Detach(datum/source)
+ UnregisterSignal(source, COMSIG_AI_BLACKBOARD_KEY_SET(BB_BASIC_MOB_CURRENT_TARGET))
+ return ..()
+
+/datum/element/human_npc_spot_bark/proc/on_target_set(mob/living/carbon/human/npc/ruin/source)
+ SIGNAL_HANDLER
+ var/mob/living/target = source.ai_controller?.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
+ if(!isliving(target) || source.stat != CONSCIOUS)
+ return
+ if(source.npc_spotted?.resolve() == target)
+ return
+ source.npc_spotted = WEAKREF(target)
+ source.npc_bark(RUIN_NPC_BARK_SPOT)
+
+/**
+ * Outfit tables for the ruin families. Green regulars wear what they always did; yellow adds armour; red
+ * adds a helmet or better gun and a medipen (used in soft crit, human_npc_soft_crit.dm). Families that
+ * are found on cold sites set a cold_layer that swaps their suit for a cold-weather one (the base cold
+ * layer only fills empty slots, which leaves an armour vest's wearer to freeze).
+ */
+/datum/human_npc_outfit_table/ruin
+
+/// Cold-weather wear that also replaces the suit: for outfits whose suit is armour with no warmth in it.
+/datum/human_npc_layer/cold/coat
+ replace_slots = ITEM_SLOT_FEET | ITEM_SLOT_OCLOTHING
+
+/**
+ * spawn_npc_in_zone() for spawners that roll many mobs at once (planet population, biome terrain, zone
+ * markers): a human NPC type is queued through spawn_human_npc() with the same context, so it is built
+ * over the next ticks instead of now. Returns the mob, or the human NPC order.
+ */
+/proc/spawn_npc_in_zone_or_queue(spawn_type, atom/location, datum/npc_spawn_context/context)
+ if(ispath(spawn_type, /mob/living/carbon/human/npc))
+ return spawn_human_npc(spawn_type, location, context = context)
+ return spawn_npc_in_zone(spawn_type, location, context)
+
+/// Map spawners for the ruin families (ruin_npc_spawners.dm). Each subtype names the NPC it places;
+/// npc_name and npc_faction set one mapped NPC's own name and side.
+/obj/effect/spawner/human_npc/ruin
+ name = "ruin NPC spawner"
+ // The family's own type places nothing (it is never mapped; tests create every type once).
+ abstract_spawner_type = /obj/effect/spawner/human_npc/ruin
+
+// ===== Derelict shuttles inside space ruins =====
+// The caravan ambush ruin docks four upstream derelict shuttles (code/datums/shuttles/ruin.dm) that
+// carried trooper mobs. Following the space ruins' copy-and-redirect scheme (voidcrew/datums/ruins/space.dm),
+// voidcrew copies of those maps with human NPC spawners live in _maps/voidcrew/shuttles/, and these
+// prefixes point the upstream templates at them. The upstream maps stay as merge reference.
+/datum/map_template/shuttle/ruin/caravan_victim
+ prefix = "_maps/voidcrew/shuttles/"
+
+/datum/map_template/shuttle/ruin/pirate_cutter
+ prefix = "_maps/voidcrew/shuttles/"
+
+/datum/map_template/shuttle/ruin/syndicate_dropship
+ prefix = "_maps/voidcrew/shuttles/"
+
+/datum/map_template/shuttle/ruin/syndicate_fighter_shiv
+ prefix = "_maps/voidcrew/shuttles/"
diff --git a/voidcrew/modules/human_npcs/ruins/ruin_npc_hermits.dm b/voidcrew/modules/human_npcs/ruins/ruin_npc_hermits.dm
new file mode 100644
index 00000000000..fcd6c135127
--- /dev/null
+++ b/voidcrew/modules/human_npcs/ruins/ruin_npc_hermits.dm
@@ -0,0 +1,89 @@
+/**
+ * # Wasteland hermits and poacher squads (AM-9, AM-3)
+ *
+ * The wild-eyed people of the sandworlds, in their tattered survival gear (the wasteland corpse outfits,
+ * voidcrew/modules/mob_spawn/corpses/wasteland_corpses.dm): wanderers who fight with their fists or a
+ * knife, hunters with a .38 revolver and speedloaders, and soldiers with a WT-550 and spare magazines.
+ * They spawn from the wasteland biomes, wasteland ruins and the poacher bust contract, which renames them.
+ *
+ * Their survival suits keep the cold off their bodies; on a cold site the cold layer adds a hat, scarf and
+ * winter boots (a poacher camp on an ice planet), and a bad-air site a mask and tank. Nothing makes them
+ * immune to the weather: a storm that hurts a player hurts them.
+ */
+
+/datum/human_npc_voice/ruin_hermit
+ lines = list(
+ RUIN_NPC_BARK_SPOT = list(
+ "The sun... The sun...",
+ "You'll do...",
+ "All mine...",
+ "Gg..free..",
+ "Drink.. need drink...",
+ "I can smell... you..",
+ "G-g...",
+ "Taste..the salt.",
+ ),
+ HUMAN_NPC_BARK_DOWNED = list("G-g...", "The sun..."),
+ HUMAN_NPC_BARK_PLEAD = list("Drink... need drink..."),
+ )
+ emotes = list(
+ HUMAN_NPC_BARK_DOWNED = list("collapses."),
+ )
+ chances = list(RUIN_NPC_BARK_SPOT = 50)
+
+/datum/outfit/hermit/survivor/knife
+ name = "Wasteland Survivor (knife)"
+ r_hand = /obj/item/knife/combat/survival
+
+/datum/outfit/hermit/survivor/knife/red
+ name = "Wasteland Survivor (knife, red zone)"
+ l_pocket = /obj/item/reagent_containers/hypospray/medipen
+
+/// A .38 revolver and two speedloaders.
+/datum/outfit/hermit/survivor/hunter/armed
+ name = "Wasteland Hunter (armed)"
+ r_hand = /obj/item/gun/ballistic/revolver/c38
+ backpack_contents = list(/obj/item/ammo_box/c38 = 2)
+
+/datum/outfit/hermit/survivor/hunter/armed/red
+ name = "Wasteland Hunter (armed, red zone)"
+ backpack_contents = list(/obj/item/ammo_box/c38 = 2, /obj/item/reagent_containers/hypospray/medipen = 1)
+
+/// A WT-550 and two spare magazines.
+/datum/outfit/hermit/survivor/gunslinger/armed
+ name = "Wasteland Gunslinger (armed)"
+ r_hand = /obj/item/gun/ballistic/automatic/wt550
+ backpack_contents = list(/obj/item/ammo_box/magazine/wt550m9 = 2)
+
+/datum/outfit/hermit/survivor/gunslinger/armed/red
+ name = "Wasteland Gunslinger (armed, red zone)"
+ backpack_contents = list(/obj/item/ammo_box/magazine/wt550m9 = 2, /obj/item/reagent_containers/hypospray/medipen = 1)
+
+/datum/human_npc_outfit_table/ruin/hermit
+ green = list(/datum/outfit/hermit/survivor = 1)
+ yellow = list(/datum/outfit/hermit/survivor/knife = 1)
+ red = list(/datum/outfit/hermit/survivor/knife/red = 1)
+
+/datum/human_npc_outfit_table/ruin/hermit/hunter
+ green = list(/datum/outfit/hermit/survivor/hunter/armed = 1)
+ yellow = list(/datum/outfit/hermit/survivor/hunter/armed = 1)
+ red = list(/datum/outfit/hermit/survivor/hunter/armed/red = 1)
+
+/datum/human_npc_outfit_table/ruin/hermit/gunslinger
+ green = list(/datum/outfit/hermit/survivor/gunslinger/armed = 1)
+ yellow = list(/datum/outfit/hermit/survivor/gunslinger/armed = 1)
+ red = list(/datum/outfit/hermit/survivor/gunslinger/armed/red = 1)
+
+/mob/living/carbon/human/npc/ruin/hermit
+ npc_name = "Hermit Wanderer"
+ faction = list("hermit", FACTION_WASTELAND)
+ npc_voice = /datum/human_npc_voice/ruin_hermit
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/hermit
+
+/mob/living/carbon/human/npc/ruin/hermit/hunter
+ npc_name = "Hermit Hunter"
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/hermit/hunter
+
+/mob/living/carbon/human/npc/ruin/hermit/gunslinger
+ npc_name = "Hermit Soldier"
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/hermit/gunslinger
diff --git a/voidcrew/modules/human_npcs/ruins/ruin_npc_spawners.dm b/voidcrew/modules/human_npcs/ruins/ruin_npc_spawners.dm
new file mode 100644
index 00000000000..1185c09b221
--- /dev/null
+++ b/voidcrew/modules/human_npcs/ruins/ruin_npc_spawners.dm
@@ -0,0 +1,111 @@
+// Map spawners for the ruin, planet and mission human NPCs. Each one queues its NPC when the map loads
+// (spawn_human_npc(), a body per tick), dressed for the zone the ruin landed in. Set npc_name or
+// npc_faction on a placed spawner for one NPC's own name or side (a camp's private faction).
+
+// ===== Pirates =====
+
+/obj/effect/spawner/human_npc/ruin/pirate
+ name = "pirate swashbuckler spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/pirate
+
+/obj/effect/spawner/human_npc/ruin/pirate/gunner
+ name = "pirate gunner spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/pirate/gunner
+
+/obj/effect/spawner/human_npc/ruin/pirate/space
+ name = "space pirate swashbuckler spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/pirate/space
+
+/obj/effect/spawner/human_npc/ruin/pirate/space/gunner
+ name = "space pirate gunner spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/pirate/space/gunner
+
+/obj/effect/spawner/human_npc/ruin/pirate/beach
+ name = "beach pirate swashbuckler spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/pirate/beach
+
+/obj/effect/spawner/human_npc/ruin/pirate/beach/gunner
+ name = "beach pirate gunner spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/pirate/beach/gunner
+
+/obj/effect/spawner/human_npc/ruin/pirate/cosplayer
+ name = "pirate cosplayer spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/pirate/cosplayer
+
+// ===== Syndicate =====
+
+/obj/effect/spawner/human_npc/ruin/syndicate
+ name = "Syndicate operative spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/syndicate
+
+/obj/effect/spawner/human_npc/ruin/syndicate/sword
+ name = "Syndicate sword guard spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/syndicate/sword
+
+/obj/effect/spawner/human_npc/ruin/syndicate/gunner
+ name = "Syndicate gunner spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/syndicate/gunner
+
+/obj/effect/spawner/human_npc/ruin/syndicate/gunner/smg
+ name = "Syndicate SMG gunner spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/syndicate/gunner/smg
+
+/obj/effect/spawner/human_npc/ruin/syndicate/gunner/shotgun
+ name = "Syndicate shotgunner spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/syndicate/gunner/shotgun
+
+/obj/effect/spawner/human_npc/ruin/syndicate/gunner/pilot
+ name = "Syndicate salvage pilot spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/syndicate/gunner/pilot
+
+/obj/effect/spawner/human_npc/ruin/syndicate/commando
+ name = "Syndicate commando spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/syndicate/commando
+
+/obj/effect/spawner/human_npc/ruin/syndicate/commando/gunner
+ name = "Syndicate commando gunner spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/syndicate/commando/gunner
+
+/obj/effect/spawner/human_npc/ruin/syndicate/commando/smg
+ name = "Syndicate commando SMG gunner spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/syndicate/commando/smg
+
+/obj/effect/spawner/human_npc/ruin/syndicate/stormtrooper
+ name = "Syndicate stormtrooper spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/syndicate/stormtrooper
+
+/obj/effect/spawner/human_npc/ruin/syndicate/stormtrooper/shotgun
+ name = "Syndicate stormtrooper shotgunner spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/syndicate/stormtrooper/shotgun
+
+/obj/effect/spawner/human_npc/ruin/syndicate/stormtrooper/sword
+ name = "Syndicate stormtrooper sword guard spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/syndicate/stormtrooper/sword
+
+// ===== Nanotrasen and Russians =====
+
+/obj/effect/spawner/human_npc/ruin/nanotrasen
+ name = "Nanotrasen security officer spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/nanotrasen
+
+/obj/effect/spawner/human_npc/ruin/russian
+ name = "Russian mobster spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/russian
+
+/obj/effect/spawner/human_npc/ruin/russian/gunner
+ name = "Russian gunner spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/trooper/russian/gunner
+
+// ===== Hermits =====
+
+/obj/effect/spawner/human_npc/ruin/hermit
+ name = "hermit wanderer spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/hermit
+
+/obj/effect/spawner/human_npc/ruin/hermit/hunter
+ name = "hermit hunter spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/hermit/hunter
+
+/obj/effect/spawner/human_npc/ruin/hermit/gunslinger
+ name = "hermit soldier spawner"
+ npc_type = /mob/living/carbon/human/npc/ruin/hermit/gunslinger
diff --git a/voidcrew/modules/human_npcs/ruins/ruin_npc_troopers.dm b/voidcrew/modules/human_npcs/ruins/ruin_npc_troopers.dm
new file mode 100644
index 00000000000..565a8c5b3a7
--- /dev/null
+++ b/voidcrew/modules/human_npcs/ruins/ruin_npc_troopers.dm
@@ -0,0 +1,596 @@
+/**
+ * # Troopers as human NPCs: pirates, Syndicate operatives, Nanotrasen security, Russian mobsters
+ *
+ * The human versions of tg's /mob/living/basic/trooper families placed in Voidcrew ruins, ruin shuttles,
+ * beaches and zone markers. Each keeps its trooper's name, faction and look (today's corpse outfits),
+ * holds the weapon the trooper only drew, and carries real spare ammunition.
+ *
+ * Zones (/datum/human_npc_outfit_table/ruin): green wears what the trooper wore; yellow adds armour; red
+ * adds a helmet and a medipen. The trooper weapon ladder (voidcrew/edits/mobs/weapon_drops.dm) lives in
+ * the tables: Syndicate SMGs and shotguns are pistols outside the red zone (stormtroopers' SMGs only in
+ * the green), and the Syndicate sword guard has only a knife in the green. Nanotrasen officers only ever
+ * carried the M1911 in Voidcrew maps.
+ *
+ * Designed drops stay as the troopers had them: only the Russians carried any (a kitchen knife, a Nagant
+ * revolver). Their clothes and guns are gear (decision D3) and never loot. The pirates' coin-snatching
+ * hits are gone: an NPC hits like a person.
+ */
+
+// ===== VOICES =====
+
+/datum/human_npc_voice/ruin_pirate
+ lines = list(
+ RUIN_NPC_BARK_SPOT = list("Yarr! Fresh meat!", "Ahoy, landlubber!", "Cut 'em down!", "Avast!"),
+ HUMAN_NPC_BARK_DOWNED = list("Arr... me guts...", "Not like this..."),
+ HUMAN_NPC_BARK_RECOVER = list("Still breathin'!", "That all ye got?"),
+ HUMAN_NPC_BARK_PLEAD = list("Mercy, matey..."),
+ HUMAN_NPC_BARK_CUFFED = list("Ye'll hang for this."),
+ )
+ emotes = list(
+ HUMAN_NPC_BARK_DOWNED = list("collapses."),
+ )
+ chances = list(RUIN_NPC_BARK_SPOT = 60)
+
+/datum/human_npc_voice/ruin_syndicate
+ lines = list(
+ RUIN_NPC_BARK_SPOT = list("Contact!", "Hostile sighted.", "Engaging.", "Death to Nanotrasen!"),
+ HUMAN_NPC_BARK_DOWNED = list("Man down...", "I'm hit..."),
+ HUMAN_NPC_BARK_RECOVER = list("Back in it.", "Still in the fight."),
+ HUMAN_NPC_BARK_CUFFED = list("I'm not telling you anything."),
+ )
+ emotes = list(
+ HUMAN_NPC_BARK_DOWNED = list("collapses."),
+ )
+ chances = list(RUIN_NPC_BARK_SPOT = 50)
+
+/datum/human_npc_voice/ruin_nanotrasen
+ lines = list(
+ RUIN_NPC_BARK_SPOT = list("Halt! Private security!", "Hostile in sight.", "Stop right there!"),
+ HUMAN_NPC_BARK_DOWNED = list("Officer down...", "Need a medic..."),
+ HUMAN_NPC_BARK_RECOVER = list("Still standing."),
+ HUMAN_NPC_BARK_CUFFED = list("You'll answer to Central for this."),
+ )
+ emotes = list(
+ HUMAN_NPC_BARK_DOWNED = list("collapses."),
+ )
+ chances = list(RUIN_NPC_BARK_SPOT = 50)
+
+/datum/human_npc_voice/ruin_russian
+ lines = list(
+ RUIN_NPC_BARK_SPOT = list("Hey! You!", "Who let you in?", "For the Motherland!"),
+ HUMAN_NPC_BARK_DOWNED = list("Ugh... not good...", "Someone... help..."),
+ HUMAN_NPC_BARK_RECOVER = list("Is that all?"),
+ )
+ emotes = list(
+ HUMAN_NPC_BARK_DOWNED = list("collapses."),
+ )
+ chances = list(RUIN_NPC_BARK_SPOT = 50)
+
+// ===== FAMILY ROOT =====
+
+/mob/living/carbon/human/npc/ruin/trooper
+ name = "trooper"
+ // Armed hostiles: cover from stun fire, and a stimulant if one carries it (human_npc_combat_sense.dm)
+ npc_combat_sense = /datum/npc_combat_sense
+
+// ===== SPACE PIRATES (tg's pirate troopers) =====
+
+/datum/outfit/ruin_npc
+ name = "Ruin NPC"
+
+/// The swashbuckler: a pirate's rags, an eyepatch and an energy cutlass.
+/datum/outfit/ruin_npc/pirate
+ name = "Ruin NPC: pirate swashbuckler"
+ uniform = /obj/item/clothing/under/costume/pirate
+ shoes = /obj/item/clothing/shoes/jackboots
+ glasses = /obj/item/clothing/glasses/eyepatch
+ head = /obj/item/clothing/head/costume/pirate/bandana/armored
+ r_hand = /obj/item/melee/energy/sword/pirate
+
+/datum/outfit/ruin_npc/pirate/coat
+ name = "Ruin NPC: pirate swashbuckler in a coat"
+ suit = /obj/item/clothing/suit/costume/pirate/armored
+
+/datum/outfit/ruin_npc/pirate/coat/red
+ name = "Ruin NPC: pirate swashbuckler, red zone"
+ gloves = /obj/item/clothing/gloves/color/black
+ l_pocket = /obj/item/reagent_containers/hypospray/medipen
+
+/// The gunner: a laser gun and the armoured captain's hat.
+/datum/outfit/ruin_npc/pirate/gunner
+ name = "Ruin NPC: pirate gunner"
+ head = /obj/item/clothing/head/costume/pirate/armored
+ r_hand = /obj/item/gun/energy/laser
+
+/datum/outfit/ruin_npc/pirate/gunner/coat
+ name = "Ruin NPC: pirate gunner in a coat"
+ suit = /obj/item/clothing/suit/costume/pirate/armored
+
+/datum/outfit/ruin_npc/pirate/gunner/coat/red
+ name = "Ruin NPC: pirate gunner, red zone"
+ gloves = /obj/item/clothing/gloves/color/black
+ l_pocket = /obj/item/reagent_containers/hypospray/medipen
+
+/// Space pirates fight in breached hulls: the pirate space suit and its own air.
+/datum/outfit/ruin_npc/pirate/space
+ name = "Ruin NPC: space pirate swashbuckler"
+ suit = /obj/item/clothing/suit/space/pirate
+ head = /obj/item/clothing/head/helmet/space/pirate/bandana
+ gloves = /obj/item/clothing/gloves/color/black
+ suit_store = /obj/item/tank/internals/oxygen
+ internals_slot = ITEM_SLOT_SUITSTORE
+
+/datum/outfit/ruin_npc/pirate/space/red
+ name = "Ruin NPC: space pirate swashbuckler, red zone"
+ l_pocket = /obj/item/reagent_containers/hypospray/medipen
+
+/datum/outfit/ruin_npc/pirate/space/gunner
+ name = "Ruin NPC: space pirate gunner"
+ head = /obj/item/clothing/head/helmet/space/pirate
+ r_hand = /obj/item/gun/energy/e_gun/lethal
+
+/datum/outfit/ruin_npc/pirate/space/gunner/red
+ name = "Ruin NPC: space pirate gunner, red zone"
+ l_pocket = /obj/item/reagent_containers/hypospray/medipen
+
+/// Timothy, the pirate cosplayer locked in the Hightide's kitchen: the costume, not the armour.
+/datum/outfit/ruin_npc/pirate/cosplayer
+ name = "Ruin NPC: pirate cosplayer"
+ head = /obj/item/clothing/head/costume/pirate
+ suit = /obj/item/clothing/suit/costume/pirate
+ shoes = /obj/item/clothing/shoes/sneakers/black
+ r_hand = /obj/item/gun/energy/laser
+
+/datum/human_npc_outfit_table/ruin/pirate
+ vacuum_layer = /datum/human_npc_layer/eva/pirate
+ green = list(/datum/outfit/ruin_npc/pirate = 1)
+ yellow = list(/datum/outfit/ruin_npc/pirate/coat = 1)
+ red = list(/datum/outfit/ruin_npc/pirate/coat/red = 1)
+
+/datum/human_npc_outfit_table/ruin/pirate/gunner
+ green = list(/datum/outfit/ruin_npc/pirate/gunner = 1)
+ yellow = list(/datum/outfit/ruin_npc/pirate/gunner/coat = 1)
+ red = list(/datum/outfit/ruin_npc/pirate/gunner/coat/red = 1)
+
+/datum/human_npc_outfit_table/ruin/pirate/space
+ green = list(/datum/outfit/ruin_npc/pirate/space = 1)
+ yellow = list(/datum/outfit/ruin_npc/pirate/space = 1)
+ red = list(/datum/outfit/ruin_npc/pirate/space/red = 1)
+
+/datum/human_npc_outfit_table/ruin/pirate/space/gunner
+ green = list(/datum/outfit/ruin_npc/pirate/space/gunner = 1)
+ yellow = list(/datum/outfit/ruin_npc/pirate/space/gunner = 1)
+ red = list(/datum/outfit/ruin_npc/pirate/space/gunner/red = 1)
+
+/mob/living/carbon/human/npc/ruin/trooper/pirate
+ npc_name = "Pirate Swashbuckler"
+ faction = list(FACTION_PIRATE)
+ npc_voice = /datum/human_npc_voice/ruin_pirate
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/pirate
+
+/mob/living/carbon/human/npc/ruin/trooper/pirate/gunner
+ npc_name = "Pirate Gunner"
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/pirate/gunner
+
+/mob/living/carbon/human/npc/ruin/trooper/pirate/space
+ npc_name = "Space Pirate Swashbuckler"
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/pirate/space
+
+/mob/living/carbon/human/npc/ruin/trooper/pirate/space/gunner
+ npc_name = "Space Pirate Gunner"
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/pirate/space/gunner
+
+/// The beach's own pirates, sided with the shore's wildlife: the barrel spawners' crews, and the boat
+/// pirates of the deep water, who now wade (the old boat sprite was this same costume in a boat).
+/mob/living/carbon/human/npc/ruin/trooper/pirate/beach
+ faction = list(FACTION_BEACH)
+
+/mob/living/carbon/human/npc/ruin/trooper/pirate/beach/gunner
+ npc_name = "Pirate Gunner"
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/pirate/gunner
+
+/// Timothy. He survived on the rats, which shows: he goes down twice as fast as anyone else.
+/mob/living/carbon/human/npc/ruin/trooper/pirate/cosplayer
+ npc_name = "Timothy"
+ npc_outfit_table = null
+ npc_outfit = /datum/outfit/ruin_npc/pirate/cosplayer
+ npc_damage_taken = 2
+
+// ===== SYNDICATE OPERATIVES =====
+
+/// A Syndicate operative with a knife.
+/datum/outfit/ruin_npc/syndicate
+ name = "Ruin NPC: Syndicate operative"
+ uniform = /obj/item/clothing/under/syndicate
+ shoes = /obj/item/clothing/shoes/combat
+ gloves = /obj/item/clothing/gloves/combat
+ r_hand = /obj/item/knife/combat/survival
+
+/datum/outfit/ruin_npc/syndicate/vest
+ name = "Ruin NPC: Syndicate operative in a vest"
+ suit = /obj/item/clothing/suit/armor/vest
+
+/datum/outfit/ruin_npc/syndicate/vest/helmet
+ name = "Ruin NPC: Syndicate operative, red zone"
+ head = /obj/item/clothing/head/helmet/swat
+ l_pocket = /obj/item/reagent_containers/hypospray/medipen
+
+/// The sword guard: an energy sword and an energy shield.
+/datum/outfit/ruin_npc/syndicate/vest/sword
+ name = "Ruin NPC: Syndicate sword guard"
+ r_hand = /obj/item/melee/energy/sword/saber/red
+ l_hand = /obj/item/shield/energy
+
+/datum/outfit/ruin_npc/syndicate/vest/sword/helmet
+ name = "Ruin NPC: Syndicate sword guard, red zone"
+ head = /obj/item/clothing/head/helmet/swat
+ l_pocket = /obj/item/reagent_containers/hypospray/medipen
+
+/// A Makarov and two spare magazines.
+/datum/outfit/ruin_npc/syndicate/pistol
+ name = "Ruin NPC: Syndicate gunner"
+ r_hand = /obj/item/gun/ballistic/automatic/pistol
+ l_pocket = /obj/item/ammo_box/magazine/m9mm
+ r_pocket = /obj/item/ammo_box/magazine/m9mm
+
+/datum/outfit/ruin_npc/syndicate/pistol/vest
+ name = "Ruin NPC: Syndicate gunner in a vest"
+ suit = /obj/item/clothing/suit/armor/vest
+
+/datum/outfit/ruin_npc/syndicate/pistol/vest/helmet
+ name = "Ruin NPC: Syndicate gunner, red zone"
+ head = /obj/item/clothing/head/helmet/swat
+ belt = /obj/item/storage/belt/military
+ belt_contents = list(/obj/item/reagent_containers/hypospray/medipen = 1)
+
+/// The C-20r, in the red zone only.
+/datum/outfit/ruin_npc/syndicate/pistol/vest/helmet/smg
+ name = "Ruin NPC: Syndicate SMG gunner"
+ r_hand = /obj/item/gun/ballistic/automatic/c20r/unrestricted
+ l_pocket = /obj/item/ammo_box/magazine/smgm45
+ r_pocket = /obj/item/ammo_box/magazine/smgm45
+
+/// The Bulldog, in the red zone only.
+/datum/outfit/ruin_npc/syndicate/pistol/vest/helmet/shotgun
+ name = "Ruin NPC: Syndicate shotgunner"
+ r_hand = /obj/item/gun/ballistic/shotgun/bulldog/unrestricted
+ l_pocket = /obj/item/ammo_box/magazine/m12g
+ r_pocket = /obj/item/ammo_box/magazine/m12g
+
+/// The hijack team a cargo shuttle loan brings aboard (voidcrew/modules/cargo/shipping/_shuttle_loan.dm):
+/// a suppressed Makarov and two spare magazines.
+/datum/outfit/ruin_npc/syndicate/pistol/infiltrator
+ name = "Ruin NPC: Syndicate infiltrator"
+ r_hand = /obj/item/gun/ballistic/automatic/pistol/suppressed
+
+/datum/outfit/ruin_npc/syndicate/pistol/infiltrator/vest
+ name = "Ruin NPC: Syndicate infiltrator in a vest"
+ suit = /obj/item/clothing/suit/armor/vest
+
+/datum/outfit/ruin_npc/syndicate/pistol/infiltrator/vest/helmet
+ name = "Ruin NPC: Syndicate infiltrator, red zone"
+ head = /obj/item/clothing/head/helmet/swat
+ belt = /obj/item/storage/belt/military
+ belt_contents = list(/obj/item/reagent_containers/hypospray/medipen = 1)
+
+/// The salvage pilots of the caravan ambush: flight scarf and goggles over the armour.
+/datum/outfit/ruin_npc/syndicate/pistol/pilot
+ name = "Ruin NPC: Syndicate salvage pilot"
+ suit = /obj/item/clothing/suit/armor/vest/alt
+ neck = /obj/item/clothing/neck/large_scarf/syndie
+ glasses = /obj/item/clothing/glasses/cold
+
+/datum/outfit/ruin_npc/syndicate/pistol/pilot/smg
+ name = "Ruin NPC: Syndicate salvage pilot, red zone"
+ head = /obj/item/clothing/head/helmet/swat
+ r_hand = /obj/item/gun/ballistic/automatic/c20r/unrestricted
+ l_pocket = /obj/item/ammo_box/magazine/smgm45
+ r_pocket = /obj/item/ammo_box/magazine/smgm45
+
+/// Commandos: the black Syndicate space suit and its own air.
+/datum/outfit/ruin_npc/syndicate/commando
+ name = "Ruin NPC: Syndicate commando"
+ suit = /obj/item/clothing/suit/space/syndicate/black
+ head = /obj/item/clothing/head/helmet/space/syndicate/black
+ suit_store = /obj/item/tank/internals/oxygen
+ internals_slot = ITEM_SLOT_SUITSTORE
+
+/datum/outfit/ruin_npc/syndicate/commando/red
+ name = "Ruin NPC: Syndicate commando, red zone"
+ l_pocket = /obj/item/reagent_containers/hypospray/medipen
+
+/datum/outfit/ruin_npc/syndicate/commando/pistol
+ name = "Ruin NPC: Syndicate commando gunner"
+ r_hand = /obj/item/gun/ballistic/automatic/pistol
+ l_pocket = /obj/item/ammo_box/magazine/m9mm
+ r_pocket = /obj/item/ammo_box/magazine/m9mm
+
+/datum/outfit/ruin_npc/syndicate/commando/pistol/red
+ name = "Ruin NPC: Syndicate commando gunner, red zone"
+ belt = /obj/item/storage/belt/military
+ belt_contents = list(/obj/item/reagent_containers/hypospray/medipen = 1)
+
+/datum/outfit/ruin_npc/syndicate/commando/pistol/red/smg
+ name = "Ruin NPC: Syndicate commando SMG gunner"
+ r_hand = /obj/item/gun/ballistic/automatic/c20r/unrestricted
+ l_pocket = /obj/item/ammo_box/magazine/smgm45
+ r_pocket = /obj/item/ammo_box/magazine/smgm45
+
+/datum/outfit/ruin_npc/syndicate/commando/pistol/red/shotgun
+ name = "Ruin NPC: Syndicate commando shotgunner"
+ r_hand = /obj/item/gun/ballistic/shotgun/bulldog/unrestricted
+ l_pocket = /obj/item/ammo_box/magazine/m12g
+ r_pocket = /obj/item/ammo_box/magazine/m12g
+
+/datum/outfit/ruin_npc/syndicate/commando/sword
+ name = "Ruin NPC: Syndicate commando sword guard"
+ r_hand = /obj/item/melee/energy/sword/saber/red
+ l_hand = /obj/item/shield/energy
+
+/// Stormtroopers: the blood-red Syndicate space suit.
+/datum/outfit/ruin_npc/syndicate/commando/stormtrooper
+ name = "Ruin NPC: Syndicate stormtrooper"
+ suit = /obj/item/clothing/suit/space/syndicate/black/red
+ head = /obj/item/clothing/head/helmet/space/syndicate/black/red
+ r_hand = /obj/item/gun/ballistic/automatic/pistol
+ l_pocket = /obj/item/ammo_box/magazine/m9mm
+ r_pocket = /obj/item/ammo_box/magazine/m9mm
+
+/datum/outfit/ruin_npc/syndicate/commando/stormtrooper/smg
+ name = "Ruin NPC: Syndicate stormtrooper SMG gunner"
+ r_hand = /obj/item/gun/ballistic/automatic/c20r/unrestricted
+ l_pocket = /obj/item/ammo_box/magazine/smgm45
+ r_pocket = /obj/item/ammo_box/magazine/smgm45
+ belt = /obj/item/storage/belt/military
+ belt_contents = list(/obj/item/reagent_containers/hypospray/medipen = 1)
+
+/datum/outfit/ruin_npc/syndicate/commando/stormtrooper/shotgun
+ name = "Ruin NPC: Syndicate stormtrooper shotgunner"
+ r_hand = /obj/item/gun/ballistic/shotgun/bulldog/unrestricted
+ l_pocket = /obj/item/ammo_box/magazine/m12g
+ r_pocket = /obj/item/ammo_box/magazine/m12g
+ belt = /obj/item/storage/belt/military
+ belt_contents = list(/obj/item/reagent_containers/hypospray/medipen = 1)
+
+/datum/outfit/ruin_npc/syndicate/commando/stormtrooper/sword
+ name = "Ruin NPC: Syndicate stormtrooper sword guard"
+ r_hand = /obj/item/melee/energy/sword/saber/red
+ l_hand = /obj/item/shield/energy
+ l_pocket = /obj/item/reagent_containers/hypospray/medipen
+ r_pocket = null
+
+/// Operatives on the ice wear the Syndicate's armoured explorer suit over their kit.
+/datum/human_npc_layer/cold/coat/syndicate
+ suit = /obj/item/clothing/suit/hooded/explorer/syndicate
+
+/datum/human_npc_outfit_table/ruin/syndicate
+ vacuum_layer = /datum/human_npc_layer/eva/syndicate
+ cold_layer = /datum/human_npc_layer/cold/coat/syndicate
+ green = list(/datum/outfit/ruin_npc/syndicate = 1)
+ yellow = list(/datum/outfit/ruin_npc/syndicate/vest = 1)
+ red = list(/datum/outfit/ruin_npc/syndicate/vest/helmet = 1)
+
+/// The sword guard has only a knife in the green zone (the trooper weapon ladder).
+/datum/human_npc_outfit_table/ruin/syndicate/sword
+ green = list(/datum/outfit/ruin_npc/syndicate = 1)
+ yellow = list(/datum/outfit/ruin_npc/syndicate/vest/sword = 1)
+ red = list(/datum/outfit/ruin_npc/syndicate/vest/sword/helmet = 1)
+
+/datum/human_npc_outfit_table/ruin/syndicate/pistol
+ green = list(/datum/outfit/ruin_npc/syndicate/pistol = 1)
+ yellow = list(/datum/outfit/ruin_npc/syndicate/pistol/vest = 1)
+ red = list(/datum/outfit/ruin_npc/syndicate/pistol/vest/helmet = 1)
+
+/// SMGs and shotguns are pistols outside the red zone (the trooper weapon ladder).
+/datum/human_npc_outfit_table/ruin/syndicate/pistol/smg
+ red = list(/datum/outfit/ruin_npc/syndicate/pistol/vest/helmet/smg = 1)
+
+/datum/human_npc_outfit_table/ruin/syndicate/pistol/shotgun
+ red = list(/datum/outfit/ruin_npc/syndicate/pistol/vest/helmet/shotgun = 1)
+
+/datum/human_npc_outfit_table/ruin/syndicate/infiltrator
+ green = list(/datum/outfit/ruin_npc/syndicate/pistol/infiltrator = 1)
+ yellow = list(/datum/outfit/ruin_npc/syndicate/pistol/infiltrator/vest = 1)
+ red = list(/datum/outfit/ruin_npc/syndicate/pistol/infiltrator/vest/helmet = 1)
+
+/datum/human_npc_outfit_table/ruin/syndicate/pilot
+ green = list(/datum/outfit/ruin_npc/syndicate/pistol/pilot = 1)
+ yellow = list(/datum/outfit/ruin_npc/syndicate/pistol/pilot = 1)
+ red = list(/datum/outfit/ruin_npc/syndicate/pistol/pilot/smg = 1)
+
+/datum/human_npc_outfit_table/ruin/syndicate/commando
+ green = list(/datum/outfit/ruin_npc/syndicate/commando = 1)
+ yellow = list(/datum/outfit/ruin_npc/syndicate/commando = 1)
+ red = list(/datum/outfit/ruin_npc/syndicate/commando/red = 1)
+
+/datum/human_npc_outfit_table/ruin/syndicate/commando/pistol
+ green = list(/datum/outfit/ruin_npc/syndicate/commando/pistol = 1)
+ yellow = list(/datum/outfit/ruin_npc/syndicate/commando/pistol = 1)
+ red = list(/datum/outfit/ruin_npc/syndicate/commando/pistol/red = 1)
+
+/datum/human_npc_outfit_table/ruin/syndicate/commando/smg
+ green = list(/datum/outfit/ruin_npc/syndicate/commando/pistol = 1)
+ yellow = list(/datum/outfit/ruin_npc/syndicate/commando/pistol = 1)
+ red = list(/datum/outfit/ruin_npc/syndicate/commando/pistol/red/smg = 1)
+
+/// Stormtroopers are elites but follow the zone ladder like the regulars, so their tables pick by zone
+/// alone: SMG stormtroopers carry pistols in the green zone, shotgunners outside the red.
+/datum/human_npc_outfit_table/ruin/syndicate/stormtrooper
+
+/datum/human_npc_outfit_table/ruin/syndicate/stormtrooper/outfits_for(mob/living/carbon/human/npc/npc, zone)
+ if(zone == ZONE_RED && length(red))
+ return red
+ if(zone >= ZONE_YELLOW && length(yellow))
+ return yellow
+ return green
+
+/datum/human_npc_outfit_table/ruin/syndicate/stormtrooper/smg
+ green = list(/datum/outfit/ruin_npc/syndicate/commando/stormtrooper = 1)
+ yellow = list(/datum/outfit/ruin_npc/syndicate/commando/stormtrooper/smg = 1)
+ red = list(/datum/outfit/ruin_npc/syndicate/commando/stormtrooper/smg = 1)
+
+/datum/human_npc_outfit_table/ruin/syndicate/stormtrooper/shotgun
+ green = list(/datum/outfit/ruin_npc/syndicate/commando/stormtrooper = 1)
+ yellow = list(/datum/outfit/ruin_npc/syndicate/commando/stormtrooper = 1)
+ red = list(/datum/outfit/ruin_npc/syndicate/commando/stormtrooper/shotgun = 1)
+
+/datum/human_npc_outfit_table/ruin/syndicate/stormtrooper/sword
+ green = list(/datum/outfit/ruin_npc/syndicate/commando/stormtrooper/sword = 1)
+ yellow = list(/datum/outfit/ruin_npc/syndicate/commando/stormtrooper/sword = 1)
+ red = list(/datum/outfit/ruin_npc/syndicate/commando/stormtrooper/sword = 1)
+
+/// Space Syndicate kit: the black suit.
+/datum/human_npc_layer/eva/syndicate
+ suit = /obj/item/clothing/suit/space/syndicate/black
+ head = /obj/item/clothing/head/helmet/space/syndicate/black
+
+/mob/living/carbon/human/npc/ruin/trooper/syndicate
+ npc_name = "Syndicate Operative"
+ faction = list(ROLE_SYNDICATE)
+ npc_voice = /datum/human_npc_voice/ruin_syndicate
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/syndicate
+
+/mob/living/carbon/human/npc/ruin/trooper/syndicate/sword
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/syndicate/sword
+
+/mob/living/carbon/human/npc/ruin/trooper/syndicate/gunner
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/syndicate/pistol
+
+/mob/living/carbon/human/npc/ruin/trooper/syndicate/gunner/smg
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/syndicate/pistol/smg
+
+/mob/living/carbon/human/npc/ruin/trooper/syndicate/gunner/shotgun
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/syndicate/pistol/shotgun
+
+/// The hijack team a cargo shuttle loan brings aboard.
+/mob/living/carbon/human/npc/ruin/trooper/syndicate/gunner/infiltrator
+ npc_name = "Syndicate Infiltrator"
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/syndicate/infiltrator
+
+/mob/living/carbon/human/npc/ruin/trooper/syndicate/gunner/pilot
+ npc_name = "Syndicate Salvage Pilot"
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/syndicate/pilot
+
+/mob/living/carbon/human/npc/ruin/trooper/syndicate/commando
+ npc_name = "Syndicate Commando"
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/syndicate/commando
+
+/mob/living/carbon/human/npc/ruin/trooper/syndicate/commando/gunner
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/syndicate/commando/pistol
+
+/mob/living/carbon/human/npc/ruin/trooper/syndicate/commando/smg
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/syndicate/commando/smg
+
+/// Stormtroopers: elites in the blood-red suit. They take a fifth less brute and burn, and land aimed hits.
+/mob/living/carbon/human/npc/ruin/trooper/syndicate/stormtrooper
+ npc_name = "Syndicate Stormtrooper"
+ npc_rank = HUMAN_NPC_RANK_ELITE
+ npc_damage_taken = 0.8
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/syndicate/stormtrooper/smg
+
+/mob/living/carbon/human/npc/ruin/trooper/syndicate/stormtrooper/shotgun
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/syndicate/stormtrooper/shotgun
+
+/mob/living/carbon/human/npc/ruin/trooper/syndicate/stormtrooper/sword
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/syndicate/stormtrooper/sword
+
+// ===== NANOTRASEN PRIVATE SECURITY =====
+
+/// An M1911 and two spare magazines, in security blues.
+/datum/outfit/ruin_npc/nanotrasen
+ name = "Ruin NPC: Nanotrasen security officer"
+ uniform = /obj/item/clothing/under/rank/security/officer
+ shoes = /obj/item/clothing/shoes/combat
+ gloves = /obj/item/clothing/gloves/combat
+ back = /obj/item/storage/backpack/security
+ r_hand = /obj/item/gun/ballistic/automatic/pistol/m1911
+ l_pocket = /obj/item/ammo_box/magazine/m45
+ r_pocket = /obj/item/ammo_box/magazine/m45
+
+/datum/outfit/ruin_npc/nanotrasen/vest
+ name = "Ruin NPC: Nanotrasen security officer in a vest"
+ suit = /obj/item/clothing/suit/armor/vest
+
+/datum/outfit/ruin_npc/nanotrasen/vest/helmet
+ name = "Ruin NPC: Nanotrasen security officer, red zone"
+ head = /obj/item/clothing/head/helmet/swat/nanotrasen
+ backpack_contents = list(/obj/item/reagent_containers/hypospray/medipen = 1)
+
+/datum/human_npc_outfit_table/ruin/nanotrasen
+ green = list(/datum/outfit/ruin_npc/nanotrasen = 1)
+ yellow = list(/datum/outfit/ruin_npc/nanotrasen/vest = 1)
+ red = list(/datum/outfit/ruin_npc/nanotrasen/vest/helmet = 1)
+
+/mob/living/carbon/human/npc/ruin/trooper/nanotrasen
+ npc_name = "Nanotrasen Private Security Officer"
+ faction = list(ROLE_DEATHSQUAD)
+ npc_voice = /datum/human_npc_voice/ruin_nanotrasen
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/nanotrasen
+
+// ===== RUSSIAN MOBSTERS =====
+
+/// A soviet uniform, a bear pelt and a kitchen knife.
+/datum/outfit/ruin_npc/russian
+ name = "Ruin NPC: Russian mobster"
+ uniform = /obj/item/clothing/under/costume/soviet
+ shoes = /obj/item/clothing/shoes/jackboots
+ head = /obj/item/clothing/head/costume/bearpelt
+ gloves = /obj/item/clothing/gloves/color/black
+ r_hand = /obj/item/knife/kitchen
+
+/datum/outfit/ruin_npc/russian/vest
+ name = "Ruin NPC: Russian mobster in a vest"
+ suit = /obj/item/clothing/suit/armor/vest
+
+/// The red zone's Russians are troopers: camo, a bulletproof vest and a helmet.
+/datum/outfit/ruin_npc/russian/trooper
+ name = "Ruin NPC: Russian trooper"
+ uniform = /obj/item/clothing/under/syndicate/camo
+ suit = /obj/item/clothing/suit/armor/bulletproof
+ head = /obj/item/clothing/head/helmet/alt
+ shoes = /obj/item/clothing/shoes/combat
+ gloves = /obj/item/clothing/gloves/combat
+ l_pocket = /obj/item/reagent_containers/hypospray/medipen
+
+/// A Makarov and two spare magazines, under an ushanka.
+/datum/outfit/ruin_npc/russian/gunner
+ name = "Ruin NPC: Russian gunner"
+ head = /obj/item/clothing/head/costume/ushanka
+ r_hand = /obj/item/gun/ballistic/automatic/pistol
+ l_pocket = /obj/item/ammo_box/magazine/m9mm
+ r_pocket = /obj/item/ammo_box/magazine/m9mm
+
+/datum/outfit/ruin_npc/russian/gunner/vest
+ name = "Ruin NPC: Russian gunner in a vest"
+ suit = /obj/item/clothing/suit/armor/vest
+
+/datum/outfit/ruin_npc/russian/gunner/trooper
+ name = "Ruin NPC: Russian trooper gunner"
+ uniform = /obj/item/clothing/under/syndicate/camo
+ suit = /obj/item/clothing/suit/armor/bulletproof
+ head = /obj/item/clothing/head/helmet/alt
+ shoes = /obj/item/clothing/shoes/combat
+ gloves = /obj/item/clothing/gloves/combat
+ belt = /obj/item/storage/belt/military
+ belt_contents = list(/obj/item/reagent_containers/hypospray/medipen = 1)
+
+/datum/human_npc_outfit_table/ruin/russian
+ green = list(/datum/outfit/ruin_npc/russian = 1)
+ yellow = list(/datum/outfit/ruin_npc/russian/vest = 1)
+ red = list(/datum/outfit/ruin_npc/russian/trooper = 1)
+
+/datum/human_npc_outfit_table/ruin/russian/gunner
+ green = list(/datum/outfit/ruin_npc/russian/gunner = 1)
+ yellow = list(/datum/outfit/ruin_npc/russian/gunner/vest = 1)
+ red = list(/datum/outfit/ruin_npc/russian/gunner/trooper = 1)
+
+/mob/living/carbon/human/npc/ruin/trooper/russian
+ npc_name = "Russian Mobster"
+ faction = list(FACTION_RUSSIAN)
+ npc_voice = /datum/human_npc_voice/ruin_russian
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/russian
+ npc_death_loot = list(/obj/item/knife/kitchen)
+
+/mob/living/carbon/human/npc/ruin/trooper/russian/gunner
+ npc_outfit_table = /datum/human_npc_outfit_table/ruin/russian/gunner
+ npc_death_loot = list(/obj/item/gun/ballistic/revolver/nagant)
diff --git a/voidcrew/modules/hyperviolence/finishers/finisher_ai.dm b/voidcrew/modules/hyperviolence/finishers/finisher_ai.dm
index eae237a1596..a02648f4ab3 100644
--- a/voidcrew/modules/hyperviolence/finishers/finisher_ai.dm
+++ b/voidcrew/modules/hyperviolence/finishers/finisher_ai.dm
@@ -67,6 +67,7 @@
/proc/hv_finisher_add_subtree(datum/ai_controller/controller)
var/static/list/goes_first = typecacheof(list(
/datum/ai_planning_subtree/call_reinforcements,
+ /datum/ai_planning_subtree/human_npc_soft_crit,
/datum/ai_planning_subtree/pirate_crew_find_target,
/datum/ai_planning_subtree/escape_captivity,
/datum/ai_planning_subtree/pet_planning,
diff --git a/voidcrew/modules/lich/lich_spells.dm b/voidcrew/modules/lich/lich_spells.dm
index 096c68d95f2..0a4d2d0761b 100644
--- a/voidcrew/modules/lich/lich_spells.dm
+++ b/voidcrew/modules/lich/lich_spells.dm
@@ -332,7 +332,7 @@
mend_the_dead(victim)
return
- victim.adjustToxLoss(VERDIGRIS_BOLT_ROT, forced = TRUE)
+ victim.adjustToxLoss(VERDIGRIS_BOLT_ROT)
victim.visible_message(
span_danger("The green soaks into [victim] and starts to rot [victim.p_them()]."),
span_userdanger("Something green gets under your skin and starts rotting you."),
@@ -636,7 +636,8 @@
return
stung = TRUE
- attacker.adjustBruteLoss(npc_zone_damage(VERDIGRIS_MIRAGE_STING, src))
+ // Through the arm that struck it, as the message says (a body without arms takes it anywhere).
+ attacker.apply_damage(npc_zone_damage(VERDIGRIS_MIRAGE_STING, src), BRUTE, attacker.get_active_hand() || null)
to_chat(attacker, span_userdanger("The mirage bursts, spraying green light through your arm!"))
new /obj/effect/temp_visual/small_smoke/halfsecond(get_turf(src))
QDEL_IN(src, 0)
@@ -701,7 +702,7 @@
/obj/item/book/granter/action/spell/verdigris_bolt/recoil(mob/living/user)
. = ..()
user.visible_message(span_warning("[src] coughs out a wash of green, and the air around [user] starts to smell like wet soil."))
- user.adjustToxLoss(15, forced = TRUE)
+ user.adjustToxLoss(15)
/obj/item/book/granter/action/spell/grave_mirage
name = "codex of the fourth corpse"
diff --git a/voidcrew/modules/loot/themes/expedition.dm b/voidcrew/modules/loot/themes/expedition.dm
index 9bd98aee396..998f18b4288 100644
--- a/voidcrew/modules/loot/themes/expedition.dm
+++ b/voidcrew/modules/loot/themes/expedition.dm
@@ -117,6 +117,7 @@
/// Planet fauna: territorial wildlife around and inside surface ruins.
/obj/effect/zone_mobs/wildlife
name = "zone mob spawner (wildlife)"
+ wave_arrival = ZONE_MOBS_ARRIVE_EMERGE
mobs_green = list(
/mob/living/basic/mining/bileworm = 8,
/mob/living/basic/mining/lobstrosity = 6,
@@ -160,6 +161,7 @@
/// asteroid ruin, everything in these tables survives space.
/obj/effect/zone_mobs/asteroid
name = "zone mob spawner (asteroid)"
+ wave_arrival = ZONE_MOBS_ARRIVE_EMERGE
mobs_green = list(
/mob/living/basic/mining/goldgrub = 8,
/mob/living/basic/mining/hivelord = 6,
diff --git a/voidcrew/modules/loot/themes/occult.dm b/voidcrew/modules/loot/themes/occult.dm
index e9e98726474..2bbfab11449 100644
--- a/voidcrew/modules/loot/themes/occult.dm
+++ b/voidcrew/modules/loot/themes/occult.dm
@@ -118,6 +118,7 @@
/// Cult remnants: constructs still bound to a dead master's wards.
/obj/effect/zone_mobs/cult
name = "zone mob spawner (cult)"
+ wave_arrival = ZONE_MOBS_ARRIVE_EMERGE
mobs_green = list(
/mob/living/basic/construct/proteon/hostile = 10,
)
@@ -146,6 +147,7 @@
/// The restless dead: graves, derelicts, plague sites.
/obj/effect/zone_mobs/undead
name = "zone mob spawner (undead)"
+ wave_arrival = ZONE_MOBS_ARRIVE_EMERGE
mobs_green = list(
/mob/living/basic/skeleton = 10,
/mob/living/basic/zombie = 6,
diff --git a/voidcrew/modules/loot/themes/plunder.dm b/voidcrew/modules/loot/themes/plunder.dm
index b142f73c2ae..d0cc0e26036 100644
--- a/voidcrew/modules/loot/themes/plunder.dm
+++ b/voidcrew/modules/loot/themes/plunder.dm
@@ -97,40 +97,40 @@
/obj/effect/zone_mobs/pirate
name = "zone mob spawner (pirate)"
mobs_green = list(
- /mob/living/basic/trooper/pirate/faction/grey/melee = 10,
- /mob/living/basic/trooper/pirate/faction/skeleton/melee = 8,
- /mob/living/basic/trooper/pirate/faction/silverscale/melee = 6,
+ /mob/living/carbon/human/npc/faction_pirate/grey/melee = 10,
+ /mob/living/carbon/human/npc/faction_pirate/skeleton/melee = 8,
+ /mob/living/carbon/human/npc/faction_pirate/silverscale/melee = 6,
)
mobs_yellow = list(
- /mob/living/basic/trooper/pirate/faction/grey/ranged = 8,
- /mob/living/basic/trooper/pirate/faction/skeleton/ranged = 8,
- /mob/living/basic/trooper/pirate/faction/silverscale/melee = 6,
- /mob/living/basic/trooper/pirate/faction/lustrous/ranged = 5,
+ /mob/living/carbon/human/npc/faction_pirate/grey/ranged = 8,
+ /mob/living/carbon/human/npc/faction_pirate/skeleton/ranged = 8,
+ /mob/living/carbon/human/npc/faction_pirate/silverscale/melee = 6,
+ /mob/living/carbon/human/npc/faction_pirate/lustrous/ranged = 5,
)
mobs_red = list(
- /mob/living/basic/trooper/pirate/faction/silverscale/ranged = 8,
- /mob/living/basic/trooper/pirate/faction/lustrous/ranged = 8,
- /mob/living/basic/trooper/pirate/faction/interdyne/ranged = 6,
- /mob/living/basic/trooper/pirate/faction/skeleton/captain = 4,
- /mob/living/basic/trooper/pirate/faction/grey/captain = 4,
+ /mob/living/carbon/human/npc/faction_pirate/silverscale/ranged = 8,
+ /mob/living/carbon/human/npc/faction_pirate/lustrous/ranged = 8,
+ /mob/living/carbon/human/npc/faction_pirate/interdyne/ranged = 6,
+ /mob/living/carbon/human/npc/faction_pirate/skeleton/captain = 4,
+ /mob/living/carbon/human/npc/faction_pirate/grey/captain = 4,
)
/// The pirate setpiece: a captain holding the vault, a proper boss in the red.
/obj/effect/zone_mobs/pirate/boss
name = "zone mob spawner (pirate boss)"
mobs_green = list(
- /mob/living/basic/trooper/pirate/faction/grey/captain = 1,
- /mob/living/basic/trooper/pirate/faction/skeleton/captain = 1,
+ /mob/living/carbon/human/npc/faction_pirate/grey/captain = 1,
+ /mob/living/carbon/human/npc/faction_pirate/skeleton/captain = 1,
)
mobs_yellow = list(
- /mob/living/basic/trooper/pirate/faction/silverscale/captain = 1,
- /mob/living/basic/trooper/pirate/faction/lustrous/captain = 1,
- /mob/living/basic/trooper/pirate/faction/interdyne/captain = 1,
+ /mob/living/carbon/human/npc/faction_pirate/silverscale/captain = 1,
+ /mob/living/carbon/human/npc/faction_pirate/lustrous/captain = 1,
+ /mob/living/carbon/human/npc/faction_pirate/interdyne/captain = 1,
)
mobs_red = list(
- /mob/living/basic/trooper/pirate/faction/boss/silverscale = 1,
- /mob/living/basic/trooper/pirate/faction/boss/skeleton = 1,
- /mob/living/basic/trooper/pirate/faction/boss/grey = 1,
- /mob/living/basic/trooper/pirate/faction/boss/lustrous = 1,
- /mob/living/basic/trooper/pirate/faction/boss/interdyne = 1,
+ /mob/living/carbon/human/npc/faction_pirate/silverscale/boss = 1,
+ /mob/living/carbon/human/npc/faction_pirate/skeleton/boss = 1,
+ /mob/living/carbon/human/npc/faction_pirate/grey/boss = 1,
+ /mob/living/carbon/human/npc/faction_pirate/lustrous/boss = 1,
+ /mob/living/carbon/human/npc/faction_pirate/interdyne/boss = 1,
)
diff --git a/voidcrew/modules/loot/themes/research.dm b/voidcrew/modules/loot/themes/research.dm
index 0d1b04cd1cb..5ab110ccda4 100644
--- a/voidcrew/modules/loot/themes/research.dm
+++ b/voidcrew/modules/loot/themes/research.dm
@@ -120,6 +120,7 @@
/// Infested nests: giant spiders. Webs sold separately.
/obj/effect/zone_mobs/bug
name = "zone mob spawner (bug)"
+ wave_arrival = ZONE_MOBS_ARRIVE_EMERGE
mobs_green = list(
/mob/living/basic/spider/giant/nurse = 8,
/mob/living/basic/spider/giant = 6,
diff --git a/voidcrew/modules/loot/themes/syndicate.dm b/voidcrew/modules/loot/themes/syndicate.dm
index d6abe3cc164..fb0fe4ef730 100644
--- a/voidcrew/modules/loot/themes/syndicate.dm
+++ b/voidcrew/modules/loot/themes/syndicate.dm
@@ -103,6 +103,7 @@
/// Syndicate holdouts: operatives left guarding whatever the base was for.
/obj/effect/zone_mobs/syndicate
name = "zone mob spawner (syndicate)"
+ wave_pod_style = /datum/pod_style/syndicate
mobs_green = list(
/mob/living/basic/trooper/syndicate/melee = 14,
)
diff --git a/voidcrew/modules/loot/zone_mobs.dm b/voidcrew/modules/loot/zone_mobs.dm
index 284115aa4f7..bc2b62e4edc 100644
--- a/voidcrew/modules/loot/zone_mobs.dm
+++ b/voidcrew/modules/loot/zone_mobs.dm
@@ -51,13 +51,24 @@
var/npc_role = "auto"
/// How far spawns scatter from the marker
var/scatter_radius = 2
+ /// How a runtime wave gets on scene: ZONE_MOBS_ARRIVE_POD or ZONE_MOBS_ARRIVE_EMERGE
+ var/wave_arrival = ZONE_MOBS_ARRIVE_POD
+ /// Pod look for ZONE_MOBS_ARRIVE_POD waves
+ var/datum/pod_style/wave_pod_style = /datum/pod_style
+ /// Set for runtime waves: the pack shows up on screen instead of appearing in place
+ var/wave = FALSE
/**
* Runtime spawns (mission waves) can pass a count override:
* new /obj/effect/zone_mobs/pirate(T, list(1, 2)) guarantees 1-2 spawns in
* every band, regardless of the theme's defaults.
+ * Pass wave = TRUE when players may be watching: the pack drops in by pod or
+ * digs out of the ground (wave_arrival) instead of appearing next to them.
*/
-/obj/effect/zone_mobs/Initialize(mapload, list/count_override)
+/obj/effect/zone_mobs/Initialize(mapload, list/count_override, wave = FALSE)
+ src.wave = wave
+ if(wave)
+ scatter_radius = max(scatter_radius, ZONE_MOBS_WAVE_SCATTER)
if(npc_role == "auto" && npc_zone_boss_type(type))
npc_role = "boss"
if(islist(count_override) && length(count_override) >= 2)
@@ -107,7 +118,12 @@
continue
var/turf/spot = length(open_turfs) ? pick_n_take(open_turfs) : get_turf(src)
var/datum/npc_spawn_context/context = new(src, zone_type, npc_role)
- spawn_npc_in_zone(mob_path, spot, context)
+ if(!wave)
+ spawn_npc_in_zone_or_queue(mob_path, spot, context)
+ else if(wave_arrival == ZONE_MOBS_ARRIVE_EMERGE)
+ zone_mobs_emerge(mob_path, spot, context)
+ else
+ zone_mobs_pod_drop(mob_path, spot, context, wave_pod_style)
/**
* Open, unblocked turfs around the marker the pack can scatter onto.
@@ -115,7 +131,8 @@
/obj/effect/zone_mobs/proc/get_scatter_turfs()
var/list/result = list()
for(var/turf/open/tile in RANGE_TURFS(scatter_radius, src))
- if(tile.is_blocked_turf(exclude_mobs = TRUE))
+ // A wave never lands a pod or digs up under someone's feet
+ if(tile.is_blocked_turf(exclude_mobs = !wave))
continue
result += tile
return result
diff --git a/voidcrew/modules/loot/zone_mobs_arrival.dm b/voidcrew/modules/loot/zone_mobs_arrival.dm
new file mode 100644
index 00000000000..689d9694b36
--- /dev/null
+++ b/voidcrew/modules/loot/zone_mobs_arrival.dm
@@ -0,0 +1,84 @@
+/**
+ * # Zone Mob Wave Arrivals
+ *
+ * Runtime waves (new /obj/effect/zone_mobs/(T, count, TRUE)) are called
+ * in while players are standing right there, so the pack has to visibly get
+ * there instead of appearing beside them. Crews drop in by pod; beasts, bugs
+ * and the dead dig up out of the ground after a short rumble.
+ */
+
+/// How long the ground shakes before something digs out of it
+#define ZONE_MOBS_EMERGE_TIME (2.5 SECONDS)
+/// How far below the tile an emerging mob starts
+#define ZONE_MOBS_EMERGE_DEPTH 16
+
+/**
+ * Loads one mob into a pod and drops it on the spot. The pod shows its usual
+ * landing marker, does no damage or explosion, opens, then leaves, so it never
+ * stays behind as free furniture.
+ */
+/proc/zone_mobs_pod_drop(mob_path, turf/spot, datum/npc_spawn_context/context, datum/pod_style/style = /datum/pod_style)
+ // A human NPC is built by the spawn queue (human_npc_spawning.dm), then goes in its pod the same tick
+ if(ispath(mob_path, /mob/living/carbon/human/npc))
+ spawn_human_npc(mob_path, spot, CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(zone_mobs_pod_send), spot, style), context = context)
+ return
+ var/obj/structure/closet/supplypod/podspawn/pod = new(null, style)
+ spawn_npc_in_zone(mob_path, pod, context)
+ new /obj/effect/pod_landingzone(spot, pod)
+
+/// Puts a human NPC the spawn queue has just built into a pod and drops it on the spot.
+/proc/zone_mobs_pod_send(turf/spot, datum/pod_style/style, mob/living/body)
+ if(QDELETED(body))
+ return
+ var/obj/structure/closet/supplypod/podspawn/pod = new(null, style)
+ body.forceMove(pod)
+ new /obj/effect/pod_landingzone(spot, pod)
+
+/**
+ * The ground rumbles, then the mob climbs out of it and leaves rubble behind.
+ */
+/proc/zone_mobs_emerge(mob_path, turf/spot, datum/npc_spawn_context/context)
+ new /obj/effect/temp_visual/zone_mobs_emerge(spot)
+ playsound(spot, 'sound/effects/break_stone.ogg', 50, TRUE)
+ addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(zone_mobs_emerge_finish), mob_path, spot, context), ZONE_MOBS_EMERGE_TIME)
+
+/proc/zone_mobs_emerge_finish(mob_path, turf/spot, datum/npc_spawn_context/context)
+ if(!spot)
+ return
+ playsound(spot, 'sound/effects/shovel_dig.ogg', 60, TRUE)
+ new /obj/effect/decal/cleanable/rubble(spot)
+ // A human NPC is built by the spawn queue (human_npc_spawning.dm) and climbs out as it appears
+ if(ispath(mob_path, /mob/living/carbon/human/npc))
+ spawn_human_npc(mob_path, spot, CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(zone_mobs_emerge_rise)), context = context)
+ return
+ zone_mobs_emerge_rise(spawn_npc_in_zone(mob_path, spot, context))
+
+/// The mob rises out of the ground it was just made on.
+/proc/zone_mobs_emerge_rise(mob/living/body)
+ if(!isliving(body) || QDELETED(body))
+ return
+ // Parallel and relative so a mob's own idle animation (floating, bobbing) survives
+ var/final_alpha = body.alpha
+ body.alpha = 0
+ body.pixel_z -= ZONE_MOBS_EMERGE_DEPTH
+ animate(body, pixel_z = ZONE_MOBS_EMERGE_DEPTH, time = 0.6 SECONDS, easing = QUAD_EASING | EASE_OUT, flags = ANIMATION_RELATIVE | ANIMATION_PARALLEL)
+ animate(body, alpha = final_alpha, time = 0.4 SECONDS, flags = ANIMATION_PARALLEL)
+
+/// The shaking dirt that gives away something digging up
+/obj/effect/temp_visual/zone_mobs_emerge
+ name = "shifting ground"
+ icon = 'icons/obj/debris.dmi'
+ icon_state = "rubble_bounce"
+ layer = ABOVE_OPEN_TURF_LAYER
+ plane = FLOOR_PLANE
+ randomdir = FALSE
+ duration = ZONE_MOBS_EMERGE_TIME
+
+/obj/effect/temp_visual/zone_mobs_emerge/Initialize(mapload)
+ . = ..()
+ animate(src, pixel_x = 1, time = 0.5, loop = -1)
+ animate(pixel_x = -1, time = 1)
+ animate(pixel_x = 0, time = 0.5)
+
+#undef ZONE_MOBS_EMERGE_TIME
+#undef ZONE_MOBS_EMERGE_DEPTH
diff --git a/voidcrew/modules/missions/mission_pad.dm b/voidcrew/modules/missions/mission_pad.dm
index 3c59618a55b..f52ef602e19 100644
--- a/voidcrew/modules/missions/mission_pad.dm
+++ b/voidcrew/modules/missions/mission_pad.dm
@@ -181,7 +181,7 @@
if(arrived.loc != loc)
return
// A wanted criminal or its proof of death: the pad says what Turn In would pay (voidcrew/modules/bounties/bounty_turn_in.dm)
- if(istype(arrived, /mob/living/basic/bounty_criminal) || istype(arrived, /obj/item/bounty_proof))
+ if(istype(arrived, /mob/living/carbon/human/npc/bounty_criminal) || istype(arrived, /obj/item/bounty_proof))
INVOKE_ASYNC(src, PROC_REF(bounty_pad_announce), arrived)
if(!isitem(arrived))
return
diff --git a/voidcrew/modules/missions/missions/field_expedition.dm b/voidcrew/modules/missions/missions/field_expedition.dm
index 81fd90250d9..5ca8eaec4e4 100644
--- a/voidcrew/modules/missions/missions/field_expedition.dm
+++ b/voidcrew/modules/missions/missions/field_expedition.dm
@@ -64,7 +64,7 @@
UnregisterSignal(source, COMSIG_ITEM_PICKUP)
if(failed || completed || !wave_theme || !prob(ambush_chance))
return
- new wave_theme(get_turf(taker), list(1, 2))
+ new wave_theme(get_turf(taker), list(1, 2), TRUE)
servant?.ship_notify("[name]: ground team disturbed something at the crash site.", "MISSION UPDATE", SHIP_NOTIFY_WARNING, 'voidcrew/sound/notify2.ogg', 50)
/datum/mission/field_expedition/update_text()
diff --git a/voidcrew/modules/missions/missions/poacher_bust.dm b/voidcrew/modules/missions/missions/poacher_bust.dm
index 07cf53dc8f8..e664c33b809 100644
--- a/voidcrew/modules/missions/missions/poacher_bust.dm
+++ b/voidcrew/modules/missions/missions/poacher_bust.dm
@@ -12,9 +12,11 @@
* filter on the planet target), and the protected species, terrain and
* evidence all come from a per-planet table.
*
- * The squad is the fork's hermit family (simple_animal humanoids): scruffy
- * wild-country gunmen with working c38/c46x30mm casing fire, each renamed to
- * a generated poacher on spawn. Every death is attributed suppression-style
+ * The squad is the wasteland hermits as human NPCs
+ * (voidcrew/modules/human_npcs/ruins/ruin_npc_hermits.dm): scruffy wild-country
+ * gunmen with real .38 revolvers and WT-550s and their spare ammunition, each
+ * renamed to a generated poacher on spawn. They are queued and built a body a
+ * tick; on an ice planet they are dressed for the cold. Every death is attributed suppression-style
* (last-attacker ckey or a living crew member in confirm range); unattributed
* deaths still count - dead is dead, and the telemetry logs it - so the wipe
* can never stall on a weather or wildlife kill.
@@ -194,26 +196,25 @@
wipe = new
// The squad scales with the zone: green gets rifles and a knife, deeper
- // zones add the trailboss's SMG and more guns. Exact subtypes only, the
- // /survivor/random variant self-replaces on Initialize and would escape
- // tracking.
+ // zones add the trailboss's SMG and more guns. Exact types only: a type
+ // that replaces itself on Initialize would escape tracking.
var/list/squad_types = list()
switch(difficulty)
if(MISSION_DIFFICULTY_MEDIUM)
- squad_types += /mob/living/simple_animal/hostile/asteroid/hermit/ranged/gunslinger
- squad_types += /mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter
- squad_types += /mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter
- squad_types += /mob/living/simple_animal/hostile/asteroid/hermit/survivor
+ squad_types += /mob/living/carbon/human/npc/ruin/hermit/gunslinger
+ squad_types += /mob/living/carbon/human/npc/ruin/hermit/hunter
+ squad_types += /mob/living/carbon/human/npc/ruin/hermit/hunter
+ squad_types += /mob/living/carbon/human/npc/ruin/hermit
if(MISSION_DIFFICULTY_HARD)
- squad_types += /mob/living/simple_animal/hostile/asteroid/hermit/ranged/gunslinger
- squad_types += /mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter
- squad_types += /mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter
- squad_types += /mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter
- squad_types += /mob/living/simple_animal/hostile/asteroid/hermit/survivor
+ squad_types += /mob/living/carbon/human/npc/ruin/hermit/gunslinger
+ squad_types += /mob/living/carbon/human/npc/ruin/hermit/hunter
+ squad_types += /mob/living/carbon/human/npc/ruin/hermit/hunter
+ squad_types += /mob/living/carbon/human/npc/ruin/hermit/hunter
+ squad_types += /mob/living/carbon/human/npc/ruin/hermit
else
- squad_types += /mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter
- squad_types += /mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter
- squad_types += /mob/living/simple_animal/hostile/asteroid/hermit/survivor
+ squad_types += /mob/living/carbon/human/npc/ruin/hermit/hunter
+ squad_types += /mob/living/carbon/human/npc/ruin/hermit/hunter
+ squad_types += /mob/living/carbon/human/npc/ruin/hermit
wipe.squad_types = squad_types
wipe.squad_names = squad_names
wipe.evidence_names = bust_row["evidence"]
@@ -264,6 +265,8 @@
var/list/squad_names
/// Live squad members still being tracked
var/list/mob/living/squad = list()
+ /// Queued orders for human NPC poachers not built yet (voidcrew/modules/human_npcs/)
+ var/list/datum/human_npc_order/pending_poachers = list()
/// Total squad size at spawn / members down so far
var/squad_size = 0
var/squad_down = 0
@@ -301,29 +304,39 @@
squad_size = 0
cache = null
-/// Stops tracking every remaining squad member (mission over / reset)
+/// Stops tracking every remaining squad member (mission over / reset), and cancels the ones still queued
/datum/mission_objective/field/wipe_camp/proc/release_squad()
for(var/mob/living/poacher as anything in squad)
UnregisterSignal(poacher, list(COMSIG_LIVING_DEATH, COMSIG_QDELETING))
squad.Cut()
+ for(var/datum/human_npc_order/order as anything in pending_poachers)
+ qdel(order)
+ pending_poachers.Cut()
/datum/mission_objective/field/wipe_camp/spawn_field_objects(turf/camp_turf)
- // The squad, scattered around the campsite
+ // The squad, scattered around the campsite. Human poachers are queued and join
+ // the squad as they are built; the head count includes them from the start.
for(var/i in 1 to length(squad_types))
var/poacher_type = squad_types[i]
- var/mob/living/simple_animal/poacher = spawn_field_npc(poacher_type, get_nearby_open_turf(camp_turf, 3), finalize = FALSE)
- if(i <= length(squad_names))
- poacher.name = squad_names[i]
+ var/poacher_name = i <= length(squad_names) ? squad_names[i] : null
+ var/turf/poacher_spot = get_nearby_open_turf(camp_turf, 3)
+ if(ispath(poacher_type, /mob/living/carbon/human/npc))
+ // Their outfits keep an ice-planet camp from freezing (human_npc_outfits.dm site layers).
+ var/datum/npc_spawn_context/context = new(mission?.target || src, mission?.target?.get_zone_type(), "auto", source_turf = poacher_spot)
+ pending_poachers += spawn_human_npc(poacher_type, poacher_spot, CALLBACK(src, PROC_REF(on_human_poacher_built)), name = poacher_name, context = context)
+ continue
+ var/mob/living/simple_animal/poacher = spawn_field_npc(poacher_type, poacher_spot, finalize = FALSE)
+ if(poacher_name)
+ poacher.name = poacher_name
poacher.desc += " The kit is professional: snare wire, skinning knives, and the brand of [mission.objective_name] burned into the stock."
// Outfitted expedition: cold-weather gear keeps an ice-planet camp
// from freezing to death before the crew arrives
poacher.minbodytemp = 0
poacher.npc_spawn_context.finalize()
- protect_field_mob(poacher)
- RegisterSignal(poacher, COMSIG_LIVING_DEATH, PROC_REF(on_poacher_death))
- RegisterSignal(poacher, COMSIG_QDELETING, PROC_REF(on_poacher_removed))
- squad += poacher
- squad_size = length(squad)
+ enlist_poacher(poacher)
+ squad_size = length(squad) + length(pending_poachers)
+ if(length(pending_poachers))
+ addtimer(CALLBACK(src, PROC_REF(check_pending_poachers)), HUMAN_NPC_ZONE_WAIT + 10 SECONDS)
// Camp dressing: fire, crude cover, bedrolls. The dense prelit bonfire
// can't be pathed into, so the squad won't cook itself.
@@ -366,6 +379,41 @@
notify_crew("[mission.objective_name] camp sighted - [squad_size] armed poachers holding a sealed trophy cache. The case beacon marks the cache ([mission.gps_tag]).", type = SHIP_NOTIFY_WARNING, sound = 'voidcrew/sound/notify2.ogg')
+/// Tracks a squad member: spared by the planet's fauna sweep, counted when it dies.
+/datum/mission_objective/field/wipe_camp/proc/enlist_poacher(mob/living/poacher)
+ protect_field_mob(poacher)
+ RegisterSignal(poacher, COMSIG_LIVING_DEATH, PROC_REF(on_poacher_death))
+ RegisterSignal(poacher, COMSIG_QDELETING, PROC_REF(on_poacher_removed))
+ squad += poacher
+
+/// A queued human poacher was built: it joins the squad.
+/datum/mission_objective/field/wipe_camp/proc/on_human_poacher_built(mob/living/carbon/human/npc/poacher)
+ for(var/datum/human_npc_order/order as anything in pending_poachers)
+ if(order.spawned_ref?.resolve() == poacher)
+ pending_poachers -= order
+ break
+ if(!active || !mission || mission.failed || mission.completed)
+ return
+ enlist_poacher(poacher)
+
+/**
+ * A queued poacher that was never built (its spot became unusable) leaves the head count, so the wipe
+ * can still finish. Orders still waiting are looked at again later.
+ */
+/datum/mission_objective/field/wipe_camp/proc/check_pending_poachers()
+ if(!active || !mission || mission.failed || mission.completed)
+ return
+ for(var/datum/human_npc_order/order as anything in pending_poachers.Copy())
+ if(QDELETED(order) || (order.done && !order.spawned_ref?.resolve()))
+ pending_poachers -= order
+ squad_size--
+ if(length(pending_poachers))
+ addtimer(CALLBACK(src, PROC_REF(check_pending_poachers)), 10 SECONDS)
+ return
+ if(squad_size > 0 && squad_down >= squad_size)
+ unlock_cache()
+ complete()
+
/**
* A named poacher died: always counts toward the wipe (attribution only
* flavors the line - dead is dead and the telemetry logs it, so a weather or
diff --git a/voidcrew/modules/missions/missions/recovery.dm b/voidcrew/modules/missions/missions/recovery.dm
index a018e34a098..9973774908a 100644
--- a/voidcrew/modules/missions/missions/recovery.dm
+++ b/voidcrew/modules/missions/missions/recovery.dm
@@ -70,39 +70,40 @@
mission_limit = 2
gps_tag_prefix = "HUNT"
- /// Mob type pools per difficulty (space-capable faction pirates).
+ /// Mob type pools per difficulty: faction pirates as human NPCs
+ /// (voidcrew/modules/npc_ships/code/faction_pirates/faction_pirate_humans.dm), in space suits where the site is airless.
/// Hard pool is the real faction bosses. Red-zone bounties are the
/// named monsters of the sector, not just another captain.
var/static/list/easy_targets = list(
- /mob/living/basic/trooper/pirate/faction/silverscale/melee,
- /mob/living/basic/trooper/pirate/faction/skeleton/melee,
- /mob/living/basic/trooper/pirate/faction/grey/melee,
+ /mob/living/carbon/human/npc/faction_pirate/silverscale/melee,
+ /mob/living/carbon/human/npc/faction_pirate/skeleton/melee,
+ /mob/living/carbon/human/npc/faction_pirate/grey/melee,
)
var/static/list/medium_targets = list(
- /mob/living/basic/trooper/pirate/faction/silverscale/ranged,
- /mob/living/basic/trooper/pirate/faction/skeleton/ranged,
- /mob/living/basic/trooper/pirate/faction/lustrous/ranged,
- /mob/living/basic/trooper/pirate/faction/grey/captain,
+ /mob/living/carbon/human/npc/faction_pirate/silverscale/ranged,
+ /mob/living/carbon/human/npc/faction_pirate/skeleton/ranged,
+ /mob/living/carbon/human/npc/faction_pirate/lustrous/ranged,
+ /mob/living/carbon/human/npc/faction_pirate/grey/captain,
)
var/static/list/hard_targets = list(
- /mob/living/basic/trooper/pirate/faction/boss/silverscale,
- /mob/living/basic/trooper/pirate/faction/boss/skeleton,
- /mob/living/basic/trooper/pirate/faction/boss/grey,
- /mob/living/basic/trooper/pirate/faction/boss/lustrous,
- /mob/living/basic/trooper/pirate/faction/boss/interdyne,
- /mob/living/basic/trooper/pirate/faction/boss/medieval,
+ /mob/living/carbon/human/npc/faction_pirate/silverscale/boss,
+ /mob/living/carbon/human/npc/faction_pirate/skeleton/boss,
+ /mob/living/carbon/human/npc/faction_pirate/grey/boss,
+ /mob/living/carbon/human/npc/faction_pirate/lustrous/boss,
+ /mob/living/carbon/human/npc/faction_pirate/interdyne/boss,
+ /mob/living/carbon/human/npc/faction_pirate/medieval/boss,
)
/// Entourage pools: bounty targets above easy keep hired muscle around
var/static/list/medium_guards = list(
- /mob/living/basic/trooper/pirate/faction/grey/melee,
- /mob/living/basic/trooper/pirate/faction/skeleton/melee,
- /mob/living/basic/trooper/pirate/faction/silverscale/melee,
+ /mob/living/carbon/human/npc/faction_pirate/grey/melee,
+ /mob/living/carbon/human/npc/faction_pirate/skeleton/melee,
+ /mob/living/carbon/human/npc/faction_pirate/silverscale/melee,
)
var/static/list/hard_guards = list(
- /mob/living/basic/trooper/pirate/faction/silverscale/ranged,
- /mob/living/basic/trooper/pirate/faction/skeleton/ranged,
- /mob/living/basic/trooper/pirate/faction/lustrous/ranged,
- /mob/living/basic/trooper/pirate/faction/interdyne/ranged,
+ /mob/living/carbon/human/npc/faction_pirate/silverscale/ranged,
+ /mob/living/carbon/human/npc/faction_pirate/skeleton/ranged,
+ /mob/living/carbon/human/npc/faction_pirate/lustrous/ranged,
+ /mob/living/carbon/human/npc/faction_pirate/interdyne/ranged,
)
/datum/mission/recovery/kill/generate_details()
diff --git a/voidcrew/modules/missions/missions/recovery_variants.dm b/voidcrew/modules/missions/missions/recovery_variants.dm
index 7a38e0c38bc..2a53a981637 100644
--- a/voidcrew/modules/missions/missions/recovery_variants.dm
+++ b/voidcrew/modules/missions/missions/recovery_variants.dm
@@ -189,7 +189,7 @@
return
alarm_tripped = TRUE
var/turf/site = get_turf(cargo)
- new wave_theme(site, list(1, 2))
+ new wave_theme(site, list(1, 2), TRUE)
second_wave_timer = addtimer(CALLBACK(src, PROC_REF(second_wave), site), EXTRACTION_SECOND_WAVE_DELAY, TIMER_STOPPABLE)
servant?.ship_notify("[name]: site security alarm triggered.", "MISSION UPDATE", SHIP_NOTIFY_WARNING, 'voidcrew/sound/notify2.ogg', 50)
@@ -197,7 +197,7 @@
second_wave_timer = null
if(failed || completed || !site)
return
- new wave_theme(site, list(1, 2))
+ new wave_theme(site, list(1, 2), TRUE)
/**
* # Anchored Recovery Cargo
diff --git a/voidcrew/modules/missions/missions/rescue.dm b/voidcrew/modules/missions/missions/rescue.dm
index 0a3e7b6527a..626b0585f2a 100644
--- a/voidcrew/modules/missions/missions/rescue.dm
+++ b/voidcrew/modules/missions/missions/rescue.dm
@@ -51,60 +51,71 @@
/datum/mission/rescue/waypoint_label()
return "Rescue: [objective_name]"
+/// Blackboard: who a rescue survivor follows
+#define BB_MISSION_SURVIVOR_LEADER "mission_survivor_leader"
+
/**
* # Mission Survivor
*
- * The living objective: friendly, fragile, and clingy on request. An empty
- * hand toggles follow; they never fight back.
+ * The living objective: friendly, fragile, and clingy on request. A real human body (the human NPC
+ * base, voidcrew/modules/human_npcs/): wounds, bleeding, crit, death and revival are a person's, and a
+ * crew can fireman-carry, drag, bag or treat them like anyone. An empty hand while they are up and
+ * about toggles follow; down, asleep or on fire it is tg's help (CPR, shaking awake, patting out
+ * flames). They never fight back.
*
- * They are immune to the environment on purpose. The contract puts them inside
- * wrecks, and a wreck is airless and near absolute zero: on tg's basic-mob
- * defaults this mob takes 1 brute (no air to breathe) plus 2 burn (body temp
- * under 250K, which it reaches in a single tick at -30K/s) every two-second
- * Life tick from the moment it spawns. That is 60 HP of survivor in forty
- * seconds, and the survivor spawns when the crew's ship docks - so they were
- * dead before anyone could walk across the ruin to them, every single time, on
- * every airless site. Their suit is what they have been surviving in; only
- * violence gets to kill them.
+ * The contract puts them inside wrecks, which are airless and near absolute zero: they have been
+ * living in their emergency softsuit, helmet on and a tank on their back, and breathe from the tank
+ * when the air is bad, as a person does. Their body is the mission's: the corpse cleanup never takes
+ * it, since a dead survivor can still be brought back (the escort objective's revival window).
*/
-/mob/living/basic/mission_survivor
+/mob/living/carbon/human/npc/mission_survivor
name = "survivor"
desc = "Somebody who has had a very long week and would love to see a ship interior again. Their emergency softsuit is patched in three places and still holding."
- icon = 'icons/mob/simple/simple_human.dmi'
- maxHealth = 60
- health = 60
- melee_damage_lower = 0
- melee_damage_upper = 0
- combat_mode = FALSE
- mob_biotypes = MOB_ORGANIC | MOB_HUMANOID
- sentience_type = SENTIENCE_HUMANOID
- unsuitable_atmos_damage = 0
- unsuitable_cold_damage = 0
- unsuitable_heat_damage = 0
- speak_emote = list("croaks")
-
+ faction = list(FACTION_NEUTRAL)
+ ai_controller = /datum/ai_controller/basic_controller/mission_survivor
+ npc_outfit = /datum/outfit/mission_survivor
+ npc_target_stat = HUMAN_NPC_SPARES_DOWNED
+ npc_corpse_lifetime = 0
/// Who the survivor is currently following, if anyone
var/datum/weakref/following_ref
-/mob/living/basic/mission_survivor/Initialize(mapload)
- . = ..()
+/// A freighter hand who has been living in the emergency softsuit from the wreck's locker
+/datum/outfit/mission_survivor
+ name = "Rescue survivor"
+ uniform = /obj/item/clothing/under/color/grey
+ suit = /obj/item/clothing/suit/space/fragile
+ head = /obj/item/clothing/head/helmet/space/fragile
+ mask = /obj/item/clothing/mask/breath
+ back = /obj/item/tank/internals/oxygen
+ shoes = /obj/item/clothing/shoes/sneakers/black
+ internals_slot = ITEM_SLOT_BACK
+
+/mob/living/carbon/human/npc/mission_survivor/Initialize(mapload, datum/human_npc_order/order)
var/static/list/survivor_names = list("Adler", "Bex", "Cato", "Dova", "Emin", "Farrow", "Ines", "Jun", "Kest", "Loami")
- name = "survivor ([pick(survivor_names)])"
- real_name = name
- apply_dynamic_human_appearance(src, outfit_path = /datum/outfit/job/assistant)
+ npc_name = "survivor ([pick(survivor_names)])"
+ return ..()
-/mob/living/basic/mission_survivor/examine(mob/user)
+/mob/living/carbon/human/npc/mission_survivor/Destroy()
+ following_ref = null
+ return ..()
+
+// A dry, worn-out voice
+/mob/living/carbon/human/npc/mission_survivor/get_default_say_verb()
+ return "croaks"
+
+/mob/living/carbon/human/npc/mission_survivor/examine(mob/user)
. = ..()
+ if(stat == DEAD)
+ return
var/mob/following = following_ref?.resolve()
if(following)
. += span_notice("They're sticking close to [following].")
else
. += span_notice("They look lost.")
-/mob/living/basic/mission_survivor/attack_hand(mob/living/user, list/modifiers)
- . = ..()
- if(. || user.combat_mode)
- return
+/mob/living/carbon/human/npc/mission_survivor/attack_hand(mob/living/user, list/modifiers)
+ if(user.combat_mode || LAZYACCESS(modifiers, RIGHT_CLICK) || stat != CONSCIOUS || on_fire || body_position != STANDING_UP || HAS_TRAIT(src, TRAIT_INCAPACITATED))
+ return ..()
var/mob/following = following_ref?.resolve()
if(following == user)
stop_following()
@@ -116,14 +127,39 @@
say("Right behind you. Please don't be wrong about the way out.")
return TRUE
-/mob/living/basic/mission_survivor/proc/start_following(mob/living/leader)
+/mob/living/carbon/human/npc/mission_survivor/proc/start_following(mob/living/leader)
following_ref = WEAKREF(leader)
- GLOB.move_manager.move_to(src, leader, 1, 4)
+ ai_controller?.set_blackboard_key(BB_MISSION_SURVIVOR_LEADER, leader)
-/mob/living/basic/mission_survivor/proc/stop_following()
+/mob/living/carbon/human/npc/mission_survivor/proc/stop_following()
following_ref = null
- GLOB.move_manager.stop_looping(src)
+ ai_controller?.clear_blackboard_key(BB_MISSION_SURVIVOR_LEADER)
-/mob/living/basic/mission_survivor/death(gibbed)
+/mob/living/carbon/human/npc/mission_survivor/death(gibbed)
stop_following()
return ..()
+
+/**
+ * The survivor's brain: keeps up with whoever they follow, on their own feet. tg's basic controller
+ * already stops it while they are down, stunned, asleep or carried, so a survivor in crit is a body
+ * to carry, not one dragged along by a script.
+ */
+/datum/ai_controller/basic_controller/mission_survivor
+ blackboard = list()
+ ai_traits = PASSIVE_AI_FLAGS
+ ai_movement = /datum/ai_movement/jps
+ idle_behavior = null
+ planning_subtrees = list(/datum/ai_planning_subtree/mission_survivor_follow)
+
+/// Walks after their leader when more than a step behind, while the leader is near enough to follow
+/datum/ai_planning_subtree/mission_survivor_follow
+
+/datum/ai_planning_subtree/mission_survivor_follow/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/survivor = controller.pawn
+ var/mob/living/leader = controller.blackboard[BB_MISSION_SURVIVOR_LEADER]
+ if(QDELETED(leader) || leader.z != survivor.z || get_dist(survivor, leader) <= 1 || get_dist(survivor, leader) > 12)
+ return
+ controller.queue_behavior(/datum/ai_behavior/travel_towards/stop_on_arrival, BB_MISSION_SURVIVOR_LEADER)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+#undef BB_MISSION_SURVIVOR_LEADER
diff --git a/voidcrew/modules/missions/objectives/combat.dm b/voidcrew/modules/missions/objectives/combat.dm
index a9f08365fff..72cf2024bc2 100644
--- a/voidcrew/modules/missions/objectives/combat.dm
+++ b/voidcrew/modules/missions/objectives/combat.dm
@@ -158,8 +158,12 @@
var/proof_type = /obj/item/mission_recovery/proof
/// The live target, while they're alive
var/mob/living/target_mob
+ /// The queued order building a human NPC target (voidcrew/modules/human_npcs/), until it is built
+ var/datum/human_npc_order/quarry_order
/datum/mission_objective/field/kill_named/deactivate()
+ // A target still waiting in the spawn queue is never built.
+ QDEL_NULL(quarry_order)
if(target_mob)
UnregisterSignal(target_mob, COMSIG_LIVING_DEATH)
target_mob = null
@@ -174,6 +178,9 @@
create_proof(spawn_turf)
complete()
return
+ if(ispath(target_mob_type, /mob/living/carbon/human/npc))
+ spawn_human_quarry(spawn_turf)
+ return
var/mob/living/target = spawn_field_npc(target_mob_type, spawn_turf, finalize = FALSE)
target.name = mission.objective_name
target.desc += " They look like they're worth something dead."
@@ -186,6 +193,31 @@
guard.desc += " They're on somebody's payroll."
guard.npc_spawn_context.finalize()
+/**
+ * A human NPC target (voidcrew/modules/human_npcs/) and its guards are queued, a body a tick, not built
+ * on the spot. The target carries the contract's name and is tracked once it exists; the guards are
+ * untracked muscle, as above.
+ */
+/datum/mission_objective/field/kill_named/proc/spawn_human_quarry(turf/spawn_turf)
+ var/datum/npc_spawn_context/context = new(mission?.target || src, mission?.target?.get_zone_type(), "auto", source_turf = spawn_turf)
+ quarry_order = spawn_human_npc(target_mob_type, spawn_turf, CALLBACK(src, PROC_REF(on_quarry_built)), name = mission.objective_name, context = context)
+ for(var/guard_type in guard_types)
+ var/turf/guard_spot = get_nearby_open_turf(spawn_turf)
+ if(ispath(guard_type, /mob/living/carbon/human/npc))
+ var/datum/npc_spawn_context/guard_context = new(mission?.target || src, mission?.target?.get_zone_type(), "auto", source_turf = guard_spot)
+ spawn_human_npc(guard_type, guard_spot, context = guard_context)
+ continue
+ var/mob/living/guard = spawn_field_npc(guard_type, guard_spot, finalize = FALSE)
+ guard.desc += " They're on somebody's payroll."
+ guard.npc_spawn_context.finalize()
+
+/// The queued target exists now: track it, unless the contract moved on while it waited.
+/datum/mission_objective/field/kill_named/proc/on_quarry_built(mob/living/quarry)
+ quarry_order = null
+ if(!active || !mission || mission.failed || mission.completed || mission.named_kill_completed)
+ return
+ track_target(quarry)
+
/// Keep death tracking and the cash entitlement attached to the same mission.
/datum/mission_objective/field/kill_named/proc/track_target(mob/living/target)
target_mob = target
@@ -193,6 +225,12 @@
if(istype(target, /mob/living/basic/trooper/pirate/faction))
var/mob/living/basic/trooper/pirate/faction/pirate = target
pirate.mission_payout_ref = WEAKREF(mission)
+ else if(istype(target, /mob/living/carbon/human/npc/ruin))
+ var/mob/living/carbon/human/npc/ruin/quarry = target
+ quarry.npc_payout_mission = WEAKREF(mission)
+ else if(istype(target, /mob/living/carbon/human/npc/faction_pirate))
+ var/mob/living/carbon/human/npc/faction_pirate/pirate_quarry = target
+ pirate_quarry.npc_payout_mission = WEAKREF(mission)
RegisterSignal(target, COMSIG_LIVING_DEATH, PROC_REF(on_target_death))
mission.register_quest_atom(target)
@@ -239,8 +277,9 @@
* turn-in item - the mission auto-completes like a survey.
*/
/datum/mission_objective/kill_count
- /// Base typepath of mobs that count
- var/mob_base_type = /mob/living/basic/trooper/pirate/faction
+ /// Base typepaths of basic mobs that count (the basic faction pirates). Human NPCs count by the pirate
+ /// flag they sail under (counts_victim()): ruin pirates and NPC ship crews alike.
+ var/list/mob_base_types = list(/mob/living/basic/trooper/pirate/faction)
/// Minimum zone the kill must happen in (design guard: no green farming)
var/minimum_zone = ZONE_YELLOW
/// Kills required / confirmed
@@ -248,10 +287,13 @@
var/kill_count = 0
/// How close (tiles) a living crew member must be to confirm a kill
var/confirm_range = 9
+ /// Weakrefs to every body already counted: one revived and killed again counts once
+ var/list/datum/weakref/counted_kills = list()
/datum/mission_objective/kill_count/reset()
. = ..()
kill_count = 0
+ counted_kills.Cut()
/datum/mission_objective/kill_count/activate()
. = ..()
@@ -263,16 +305,17 @@
/datum/mission_objective/kill_count/proc/on_any_death(datum/source, mob/living/victim, gibbed)
SIGNAL_HANDLER
- if(completed || !istype(victim, mob_base_type))
+ if(completed || !counts_victim(victim))
return
- var/turf/where = get_turf(victim)
- if(!where)
+ var/datum/weakref/victim_ref = WEAKREF(victim)
+ if(victim_ref in counted_kills)
return
- var/zone_type = SSovermap_zones?.get_zone_type_anywhere(where)
- if(isnull(zone_type) || zone_type < minimum_zone)
+ var/turf/where = get_turf(victim)
+ if(!where || !kill_zone_counts(where))
return
if(!kill_attributable_to_crew(victim, where))
return
+ counted_kills += victim_ref
kill_count++
if(kill_count >= required_kills)
notify_crew("Suppression sweep complete.")
@@ -280,6 +323,21 @@
return
notify_crew("Kill confirmed: [kill_count]/[required_kills].", sound = 'voidcrew/sound/notify2.ogg')
+/// Whether a kill at `where` is deep enough to count (design guard: no green farming).
+/datum/mission_objective/kill_count/proc/kill_zone_counts(turf/where)
+ var/zone_type = SSovermap_zones?.get_zone_type_anywhere(where)
+ return !isnull(zone_type) && zone_type >= minimum_zone
+
+/**
+ * Whether `victim` is a mob this sweep counts: the basic faction pirates, and human NPCs
+ * (voidcrew/modules/human_npcs/) that sail under the pirate flag: ruin and mission pirates and the crews
+ * of NPC pirate ships. Each body counts once (counted_kills).
+ */
+/datum/mission_objective/kill_count/proc/counts_victim(mob/living/victim)
+ if(is_type_in_list(victim, mob_base_types))
+ return TRUE
+ return ishumannpc(victim) && (FACTION_PIRATE in victim.faction)
+
/**
* Whether this kill belongs to the servant crew: the last attacker's ckey is
* a crew member's, or a living crew member is close enough to have done it
diff --git a/voidcrew/modules/missions/objectives/site_ops.dm b/voidcrew/modules/missions/objectives/site_ops.dm
index 0689c21430e..ca946692ed3 100644
--- a/voidcrew/modules/missions/objectives/site_ops.dm
+++ b/voidcrew/modules/missions/objectives/site_ops.dm
@@ -163,7 +163,7 @@
points_done++
// Calibration is loud. Something heard it.
if(wave_theme)
- new wave_theme(get_turf(pylon), list(1, 2))
+ new wave_theme(get_turf(pylon), list(1, 2), TRUE)
// The finished pylon stays as a breadcrumb but stops being the objective
mission.forget_quest_atom(pylon)
@@ -299,7 +299,7 @@
*/
/datum/mission_objective/field/escort
/// The survivor mob type
- var/survivor_type = /mob/living/basic/mission_survivor
+ var/survivor_type = /mob/living/carbon/human/npc/mission_survivor
/// The live survivor
var/mob/living/survivor
/// Health fraction at turn-in for the "still walking" pay bonus
@@ -555,7 +555,7 @@
// Periodic company
if(wave_theme && beacon.next_wave_at <= world.time)
beacon.next_wave_at = world.time + wave_interval
- new wave_theme(get_turf(beacon), list(1, 2))
+ new wave_theme(get_turf(beacon), list(1, 2), TRUE)
notify_crew("Claim jumpers inbound on the beacon!", type = SHIP_NOTIFY_WARNING, sound = 'voidcrew/sound/notify2.ogg')
/// The clock ran out with the beacon alive: print the deed
diff --git a/voidcrew/modules/mob/living/simple_animal/hostile/pirate.dm b/voidcrew/modules/mob/living/simple_animal/hostile/pirate.dm
deleted file mode 100644
index c44867a13e0..00000000000
--- a/voidcrew/modules/mob/living/simple_animal/hostile/pirate.dm
+++ /dev/null
@@ -1,23 +0,0 @@
-/mob/living/basic/trooper/pirate/melee/beach
- faction = list(FACTION_BEACH)
-
-/mob/living/basic/trooper/pirate/ranged/beach
- faction = list(FACTION_BEACH)
-
-/mob/living/basic/trooper/pirate/melee/beach/boat
- icon = 'voidcrew/icons/mob/boat_pirates.dmi'
- icon_state = "piratemelee"
- icon_living = "piratemelee"
- use_dynamic_appearance = FALSE
- faction = list(FACTION_BEACH)
- unsuitable_atmos_damage = 0
- minimum_survivable_temperature = 0
-
-/mob/living/basic/trooper/pirate/ranged/beach/boat
- icon = 'voidcrew/icons/mob/boat_pirates.dmi'
- icon_state = "pirateranged"
- icon_living = "pirateranged"
- use_dynamic_appearance = FALSE
- faction = list(FACTION_BEACH)
- unsuitable_atmos_damage = 0
- minimum_survivable_temperature = 0
diff --git a/voidcrew/modules/mob/living/simple_animal/hostile/wasteland/hermits.dm b/voidcrew/modules/mob/living/simple_animal/hostile/wasteland/hermits.dm
deleted file mode 100644
index e59848796f3..00000000000
--- a/voidcrew/modules/mob/living/simple_animal/hostile/wasteland/hermits.dm
+++ /dev/null
@@ -1,92 +0,0 @@
-/mob/living/simple_animal/hostile/asteroid/hermit
- name = "Wasteland Inhabitant"
- desc = "If you can read this, yell at a coder!"
- icon = 'voidcrew/icons/mob/simple_human.dmi'
- icon_state = "survivor_base"
- icon_living = "survivor_base"
- icon_dead = null
- icon_gib = null
- mob_biotypes = MOB_ORGANIC
- minbodytemp = 180
- unsuitable_atmos_damage = 15
- atmos_requirements = list("min_oxy" = 1, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 999, "min_n2" = 0, "max_n2" = 0)
- speak_chance = 20
- turns_per_move = 5
- response_help_continuous = "pushes"
- response_help_simple = "push"
- speed = 0
- maxHealth = 100
- health = 100
- harm_intent_damage = 5
- melee_damage_lower = 10
- melee_damage_upper = 10
- attack_verb_continuous = "punches"
- attack_verb_simple = "punch"
- attack_sound = 'sound/items/weapons/punch1.ogg'
- combat_mode = TRUE
- unsuitable_atmos_damage = 15
- speak_emote = list(
- "The sun... The sun...",
- "You'll do...",
- "All mine...",
- "Gg..free..",
- "Drink.. need drink...",
- "I can smell... you..",
- "G-g...",
- "Taste..the salt.",
- )
- loot = list(
- /obj/effect/mob_spawn/corpse/human/hermit/survivor
- )
- del_on_death = 1
- faction = list("hermit", "wasteland")
-
-/mob/living/simple_animal/hostile/asteroid/hermit/death(gibbed)
- move_force = MOVE_FORCE_DEFAULT
- move_resist = MOVE_RESIST_DEFAULT
- pull_force = PULL_FORCE_DEFAULT
- return ..()
-
-/mob/living/simple_animal/hostile/asteroid/hermit/survivor
- name = "Hermit Wanderer"
- desc =" A wild-eyed figure, wearing tattered mining equipment and boasting a malformed body, twisted by the heavy metals and high background radiation of the sandworlds."
-
-/mob/living/simple_animal/hostile/asteroid/hermit/survivor/random/Initialize()
- . = ..()
- if(prob(10))
- spawn_npc_in_zone(/mob/living/simple_animal/hostile/asteroid/hermit/ranged/gunslinger, loc, get_npc_spawn_context(), FALSE)
- return INITIALIZE_HINT_QDEL
- if(prob(35))
- spawn_npc_in_zone(/mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter, loc, get_npc_spawn_context(), FALSE)
- return INITIALIZE_HINT_QDEL
-
-/mob/living/simple_animal/hostile/asteroid/hermit/ranged
- icon_state = "survivor_hunter"
- icon_living = "survivor_hunter"
- casingtype = /obj/item/ammo_casing/c38
- projectilesound = 'sound/items/weapons/gun/rifle/shot.ogg'
- ranged = 1
- rapid_fire_delay = 6
- retreat_distance = 5
- minimum_distance = 5
-
-/mob/living/simple_animal/hostile/asteroid/hermit/ranged/hunter
- name = "Hermit Hunter"
- desc ="A wild-eyed figure. Watch out- he has a gun, and he remembers just enough of his old life to use it!"
- loot = list(
- /obj/effect/mob_spawn/corpse/human/hermit/survivor/hunter
- )
-
-/mob/living/simple_animal/hostile/asteroid/hermit/ranged/gunslinger
- name = "Hermit Soldier"
- desc = "The miner's rebellion, though mostly underground, recieved a few good weapon shipments from an off-sector source. You should probably start running."
- icon_state = "survivor_gunslinger"
- icon_living = "survivor_gunslinger"
- casingtype = /obj/item/ammo_casing/c46x30mm
- projectilesound = 'sound/items/weapons/gun/smg/shot.ogg'
- speed = 1
- rapid = 4
- rapid_fire_delay = 3
- loot = list(
- /obj/effect/mob_spawn/corpse/human/hermit/survivor/gunslinger
- )
diff --git a/voidcrew/modules/npc_scaling/zone_profiles.dm b/voidcrew/modules/npc_scaling/zone_profiles.dm
index 59385ef4d83..1397933e795 100644
--- a/voidcrew/modules/npc_scaling/zone_profiles.dm
+++ b/voidcrew/modules/npc_scaling/zone_profiles.dm
@@ -101,8 +101,8 @@
/mob/living/simple_animal/hostile/asteroid/elite,
/mob/living/basic/boss,
/mob/living/basic/trooper/pirate/faction/boss,
- /mob/living/basic/bounty_criminal/boss,
- /mob/living/basic/bounty_criminal/kingpin,
+ /mob/living/carbon/human/npc/bounty_criminal/boss,
+ /mob/living/carbon/human/npc/bounty_criminal/kingpin,
/mob/living/basic/bounty_lair_boss,
/mob/living/basic/lich,
/mob/living/basic/hoarfrost_matriarch,
@@ -186,13 +186,21 @@
RegisterSignal(src, COMSIG_PROJECTILE_FIRER_BEFORE_FIRE, PROC_REF(npc_zone_projectile))
/// Use for raw max-health changes (posse size, phases). Retains the selected factor.
+/// Never on a carbon: a person's crit line stays where tg puts it (human NPCs, defaults PI-1).
/mob/living/proc/set_npc_zone_health(raw_max_health)
+ if(iscarbon(src))
+ stack_trace("set_npc_zone_health() was called on [src] ([type]); carbons keep tg's health. Toughen human NPCs with armour and npc_damage_taken.")
+ return
npc_zone_original_max_health = raw_max_health
resize_npc_zone_health(raw_max_health * npc_zone_health_factor)
/// Basic and legacy simple animals both store ALL physical damage in bruteloss.
/// Scale the damage store too, so updatehealth/healing/revival cannot undo the resize.
+/// Never on a carbon (see set_npc_zone_health()).
/mob/living/proc/resize_npc_zone_health(new_max_health)
+ if(iscarbon(src))
+ stack_trace("resize_npc_zone_health() was called on [src] ([type]); carbons keep tg's health. Toughen human NPCs with armour and npc_damage_taken.")
+ return
if(maxHealth <= 0 || new_max_health <= 0)
return
var/ratio = new_max_health / maxHealth
diff --git a/voidcrew/modules/npc_ships/code/_defines.dm b/voidcrew/modules/npc_ships/code/_defines.dm
index 42a56952e19..f6d0946fb93 100644
--- a/voidcrew/modules/npc_ships/code/_defines.dm
+++ b/voidcrew/modules/npc_ships/code/_defines.dm
@@ -307,6 +307,10 @@ GLOBAL_LIST_EMPTY(door_to_rooms) // ship_ref -> list(door_ref -> list(room_id_
#define BB_PIRATE_POST_TURF "pirate_post_turf"
/// Where a mob that strayed is walking back to
#define BB_PIRATE_RETURN_TURF "pirate_return_turf"
+/// Where a pirate with no crew was put (a ruin's, a planet's, a contract's): it keeps near it
+#define BB_PIRATE_CREWLESS_HOME "pirate_crewless_home"
+/// A pirate with no crew and nothing to fight walks home once it is this many tiles from it
+#define PIRATE_CREWLESS_LEASH 10
/// The door (or wrecked door frame) this mob is breaking through
#define BB_PIRATE_BREACH_TARGET "pirate_breach_target"
/// The turf it breaks the door from
@@ -390,3 +394,38 @@ GLOBAL_LIST_EMPTY(door_to_rooms) // ship_ref -> list(door_ref -> list(room_id_
#define PIRATE_CREW_CROSS_BARK_CREW (30 SECONDS)
/// How often a pirate with no target looks around for one
#define PIRATE_CREW_SCAN_COOLDOWN (1 SECONDS)
+
+// ========== HUMAN SHIP CREWS (faction_pirate_humans.dm, pirate_crew_human.dm) ==========
+// NPC ship crews and their boarders are real human NPCs (voidcrew/modules/human_npcs/). Unit tests
+// can't see these; they use the literals.
+
+/// A crewman who fights hand to hand (ship_crew/var/crew_role); its faction table dresses it from the melee outfits
+#define SHIP_CREW_ROLE_MELEE "melee"
+/// A crewman who fights with a gun; its faction table dresses it from the gunner outfits
+#define SHIP_CREW_ROLE_GUNNER "gunner"
+
+/// Pulls of the trigger left in the volley a human gunner is firing
+#define BB_PIRATE_VOLLEY_LEFT "pirate_volley_left"
+/// world.time a gunner's spin-up or aim ends; a hit before then spoils it
+#define BB_PIRATE_WINDUP_UNTIL "pirate_windup_until"
+/// world.time the door being broken last lost integrity, so a breach that gets somewhere isn't given up on
+#define BB_PIRATE_BREACH_PROGRESS_AT "pirate_breach_progress_at"
+/// The door's integrity when it was last looked at
+#define BB_PIRATE_BREACH_INTEGRITY "pirate_breach_integrity"
+/// The item an elite or boss is using on itself (its stimulant, a flask)
+#define BB_PIRATE_SELF_ITEM "pirate_self_item"
+/// world.time a boss may next drink from its flask
+#define BB_PIRATE_NEXT_DRINK "pirate_next_drink"
+/// world.time a boss gunner may next put its gun to a downed hunter's head
+#define BB_PIRATE_NEXT_EXECUTION "pirate_next_execution"
+
+/// A crew member adrift in space, out of sight of every player, this long is cleaned up (pirate_crew.dm)
+#define PIRATE_CREW_ADRIFT_TIME (2 MINUTES)
+/// A boss gunner waits this long between executions
+#define PIRATE_CREW_EXECUTION_COOLDOWN (60 SECONDS)
+/// A boss with a flask drinks from it no more often than this, and only once it is this hurt
+#define PIRATE_CREW_DRINK_COOLDOWN (20 SECONDS)
+#define PIRATE_CREW_DRINK_HEALTH_SHARE 0.7
+/// Elites' and bosses' toughness by rank (npc_damage_taken). Starting values for the balance pass.
+#define SHIP_CREW_ELITE_DAMAGE_TAKEN 0.8
+#define SHIP_CREW_BOSS_DAMAGE_TAKEN 0.6
diff --git a/voidcrew/modules/npc_ships/code/admin_verbs.dm b/voidcrew/modules/npc_ships/code/admin_verbs.dm
index dd3bd2d8a1b..c62568887a6 100644
--- a/voidcrew/modules/npc_ships/code/admin_verbs.dm
+++ b/voidcrew/modules/npc_ships/code/admin_verbs.dm
@@ -2,49 +2,49 @@
* Admin verbs for NPC pirate mob spawning
*/
-/// Mapping of faction names to their mob types
+/// Mapping of faction names to their mob types: the human NPC ship crews (faction_pirate_humans.dm)
GLOBAL_LIST_INIT(npc_pirate_factions, list(
"Silverscale" = list(
- "Melee (Duelist)" = /mob/living/basic/trooper/pirate/faction/silverscale/melee,
- "Ranged (Marksman)" = /mob/living/basic/trooper/pirate/faction/silverscale/ranged,
- "Captain (Noble)" = /mob/living/basic/trooper/pirate/faction/silverscale/captain,
- "Boss (Highlord)" = /mob/living/basic/trooper/pirate/faction/boss/silverscale,
+ "Melee (Duelist)" = /mob/living/carbon/human/npc/faction_pirate/silverscale/melee,
+ "Ranged (Marksman)" = /mob/living/carbon/human/npc/faction_pirate/silverscale/ranged,
+ "Captain (Noble)" = /mob/living/carbon/human/npc/faction_pirate/silverscale/captain,
+ "Boss (Highlord)" = /mob/living/carbon/human/npc/faction_pirate/silverscale/boss,
),
"Skeleton" = list(
- "Melee (Swashbuckler)" = /mob/living/basic/trooper/pirate/faction/skeleton/melee,
- "Ranged (Gunner)" = /mob/living/basic/trooper/pirate/faction/skeleton/ranged,
- "Captain" = /mob/living/basic/trooper/pirate/faction/skeleton/captain,
- "Boss (Davy Jones)" = /mob/living/basic/trooper/pirate/faction/boss/skeleton,
+ "Melee (Swashbuckler)" = /mob/living/carbon/human/npc/faction_pirate/skeleton/melee,
+ "Ranged (Gunner)" = /mob/living/carbon/human/npc/faction_pirate/skeleton/ranged,
+ "Captain" = /mob/living/carbon/human/npc/faction_pirate/skeleton/captain,
+ "Boss (Davy Jones)" = /mob/living/carbon/human/npc/faction_pirate/skeleton/boss,
),
"Grey Tide" = list(
- "Melee (Grey Tider)" = /mob/living/basic/trooper/pirate/faction/grey/melee,
- "Ranged (Gunner)" = /mob/living/basic/trooper/pirate/faction/grey/ranged,
- "Captain (Tidemaster)" = /mob/living/basic/trooper/pirate/faction/grey/captain,
- "Boss (The Robust One)" = /mob/living/basic/trooper/pirate/faction/boss/grey,
+ "Melee (Grey Tider)" = /mob/living/carbon/human/npc/faction_pirate/grey/melee,
+ "Ranged (Gunner)" = /mob/living/carbon/human/npc/faction_pirate/grey/ranged,
+ "Captain (Tidemaster)" = /mob/living/carbon/human/npc/faction_pirate/grey/captain,
+ "Boss (The Robust One)" = /mob/living/carbon/human/npc/faction_pirate/grey/boss,
),
"Lustrous" = list(
- "Melee (Scintillant)" = /mob/living/basic/trooper/pirate/faction/lustrous/melee,
- "Ranged (Coruscant)" = /mob/living/basic/trooper/pirate/faction/lustrous/ranged,
- "Captain (Radiant)" = /mob/living/basic/trooper/pirate/faction/lustrous/captain,
- "Boss (The Radiant One)" = /mob/living/basic/trooper/pirate/faction/boss/lustrous,
+ "Melee (Scintillant)" = /mob/living/carbon/human/npc/faction_pirate/lustrous/melee,
+ "Ranged (Coruscant)" = /mob/living/carbon/human/npc/faction_pirate/lustrous/ranged,
+ "Captain (Radiant)" = /mob/living/carbon/human/npc/faction_pirate/lustrous/captain,
+ "Boss (The Radiant One)" = /mob/living/carbon/human/npc/faction_pirate/lustrous/boss,
),
"Interdyne" = list(
- "Melee (Enforcer)" = /mob/living/basic/trooper/pirate/faction/interdyne/melee,
- "Ranged (Pharmacist)" = /mob/living/basic/trooper/pirate/faction/interdyne/ranged,
- "Captain (Director)" = /mob/living/basic/trooper/pirate/faction/interdyne/captain,
- "Boss (Director Prime)" = /mob/living/basic/trooper/pirate/faction/boss/interdyne,
+ "Melee (Enforcer)" = /mob/living/carbon/human/npc/faction_pirate/interdyne/melee,
+ "Ranged (Pharmacist)" = /mob/living/carbon/human/npc/faction_pirate/interdyne/ranged,
+ "Captain (Director)" = /mob/living/carbon/human/npc/faction_pirate/interdyne/captain,
+ "Boss (Director Prime)" = /mob/living/carbon/human/npc/faction_pirate/interdyne/boss,
),
"IRS" = list(
- "Melee (Enforcer)" = /mob/living/basic/trooper/pirate/faction/irs/melee,
- "Ranged (Agent)" = /mob/living/basic/trooper/pirate/faction/irs/ranged,
- "Captain (Head Auditor)" = /mob/living/basic/trooper/pirate/faction/irs/captain,
- "Boss (Chief Auditor)" = /mob/living/basic/trooper/pirate/faction/boss/irs,
+ "Melee (Enforcer)" = /mob/living/carbon/human/npc/faction_pirate/irs/melee,
+ "Ranged (Agent)" = /mob/living/carbon/human/npc/faction_pirate/irs/ranged,
+ "Captain (Head Auditor)" = /mob/living/carbon/human/npc/faction_pirate/irs/captain,
+ "Boss (Chief Auditor)" = /mob/living/carbon/human/npc/faction_pirate/irs/boss,
),
"Medieval" = list(
- "Melee (Footsoldier)" = /mob/living/basic/trooper/pirate/faction/medieval/melee,
- "Ranged (Crossbowman)" = /mob/living/basic/trooper/pirate/faction/medieval/ranged,
- "Captain (Warlord)" = /mob/living/basic/trooper/pirate/faction/medieval/captain,
- "Boss (The Black Knight)" = /mob/living/basic/trooper/pirate/faction/boss/medieval,
+ "Melee (Footsoldier)" = /mob/living/carbon/human/npc/faction_pirate/medieval/melee,
+ "Ranged (Crossbowman)" = /mob/living/carbon/human/npc/faction_pirate/medieval/ranged,
+ "Captain (Warlord)" = /mob/living/carbon/human/npc/faction_pirate/medieval/captain,
+ "Boss (The Black Knight)" = /mob/living/carbon/human/npc/faction_pirate/medieval/boss,
),
))
@@ -90,9 +90,16 @@ ADMIN_VERB(spawn_npc_pirate, R_SPAWN|R_DEBUG, "Spawn NPC Pirate", "Spawn an NPC
// Step 3: Ask whether it boards the ship we're standing on
var/setup_raid = tgui_alert(user, "Send it after the crew of the ship you're standing on, as a boarder?", "Boarder AI", list("Yes", "No"))
- // Spawn the pirate
+ // Spawn the pirate: a human NPC is built at once, dressed as a boarder if it is boarding
var/datum/npc_spawn_context/context = new(spawn_turf, null, "ordinary")
- var/mob/living/basic/trooper/pirate/spawned_pirate = spawn_npc_in_zone(mob_path, spawn_turf, context, FALSE)
+ var/mob/living/spawned_pirate
+ if(ispath(mob_path, /mob/living/carbon/human/npc))
+ var/datum/human_npc_order/order = spawn_human_npc(mob_path, spawn_turf, outfit = (setup_raid == "Yes" ? boarding_outfit_for(mob_path) : null), context = context, immediate = TRUE)
+ spawned_pirate = order?.spawned_ref?.resolve()
+ if(spawned_pirate)
+ spawned_pirate.flags_1 |= ADMIN_SPAWNED_1
+ else
+ spawned_pirate = spawn_npc_in_zone(mob_path, spawn_turf, context, FALSE)
if(!spawned_pirate)
to_chat(user, span_warning("Failed to spawn pirate."))
return
@@ -118,7 +125,8 @@ ADMIN_VERB(spawn_npc_pirate, R_SPAWN|R_DEBUG, "Spawn NPC Pirate", "Spawn an NPC
else
to_chat(user, span_notice("Spawned [spawned_pirate.name] ([selected_faction] - [selected_type]) with its own AI."))
- context.finalize()
+ if(!ispath(mob_path, /mob/living/carbon/human/npc))
+ context.finalize()
message_admins("[key_name_admin(user)] spawned NPC pirate: [spawned_pirate.name] ([selected_faction] - [selected_type]) at [AREACOORD(spawn_turf)]")
log_admin("[key_name(user)] spawned NPC pirate: [spawned_pirate.name] ([selected_faction] - [selected_type]) at [AREACOORD(spawn_turf)]")
BLACKBOX_LOG_ADMIN_VERB("Spawn NPC Pirate")
diff --git a/voidcrew/modules/npc_ships/code/behaviors/ship_combat_behaviors.dm b/voidcrew/modules/npc_ships/code/behaviors/ship_combat_behaviors.dm
index 0b5c1916e1c..fcdb81f058b 100644
--- a/voidcrew/modules/npc_ships/code/behaviors/ship_combat_behaviors.dm
+++ b/voidcrew/modules/npc_ships/code/behaviors/ship_combat_behaviors.dm
@@ -704,18 +704,20 @@
return AI_BEHAVIOR_DELAY
/**
- * Count hostile mobs (pirate troopers) currently on a target ship.
- * Used to enforce the max boarder cap during ship combat.
+ * Count the boarders on a target ship still in the fight: the raid's members aboard it (pirate_crew.dm),
+ * human or basic, whatever their faction. Used to enforce the max boarder cap during ship combat.
*/
/datum/ai_behavior/npc_ship/fire_boarding_pods/proc/count_hostile_mobs_on_ship(obj/structure/overmap/ship/target)
- if(!target?.shuttle?.shuttle_areas)
+ var/list/shuttle_areas = target?.shuttle?.shuttle_areas
+ var/datum/pirate_crew/raid = pirate_crew_of(target, TRUE)
+ if(!length(shuttle_areas) || !raid)
return 0
-
var/count = 0
- for(var/area/shuttle_area as anything in target.shuttle.shuttle_areas)
- for(var/mob/living/basic/trooper/pirate/boarder in shuttle_area)
- if(boarder.stat != DEAD)
- count++
+ for(var/mob/living/boarder as anything in raid.members)
+ if(human_npc_out_of_fight(boarder))
+ continue
+ if(shuttle_areas[get_area(boarder)])
+ count++
return count
// ========== USE INTERDICTOR ==========
diff --git a/voidcrew/modules/npc_ships/code/boarding_pod.dm b/voidcrew/modules/npc_ships/code/boarding_pod.dm
index e54b2177e0e..d737e88b670 100644
--- a/voidcrew/modules/npc_ships/code/boarding_pod.dm
+++ b/voidcrew/modules/npc_ships/code/boarding_pod.dm
@@ -3,15 +3,24 @@
*
* Uses the existing supplypod/landing zone system for the dramatic drop-from-above effect.
* Pod lands, opens to reveal the boarder, then vanishes.
+ *
+ * Human NPC boarders (the NPC ship crews, faction_pirate_humans.dm) are built through the spawn queue
+ * (spawn_human_npc(), a body at a time) aboard the pirate's own hull, dressed from their faction's
+ * boarding table (a sealed suit and air), and only then put in their pod and launched
+ * (boarding_pod_launch()). A basic-mob boarder is built straight into its pod as before. Either way the
+ * caller hears about the boarder through `on_boarder`, called with it once it is in its pod.
*/
/// Tracks spawn index for distributing boarders along patrol path
GLOBAL_VAR_INIT(boarding_spawn_index, 0)
GLOBAL_VAR_INIT(boarding_spawn_total, 1)
-/// Global proc to create a boarding pod drop at a target location
-/// Returns the boarder mob so the caller can register signals (e.g. death tracking)
-/proc/create_boarding_pod(turf/target_turf, obj/structure/overmap/ship/target_ship, obj/structure/overmap/ship/npc/source_ship, mob_type, datum/npc_spawn_context/encounter, budget_reserved = FALSE)
+/**
+ * Launches a boarding pod at `target_turf` carrying a `mob_type`. Returns the boarder (a basic mob, built
+ * now), the /datum/human_npc_order of a human boarder still in the spawn queue, or null if nothing was
+ * sent. `on_boarder` is called with the boarder once it is in its pod.
+ */
+/proc/create_boarding_pod(turf/target_turf, obj/structure/overmap/ship/target_ship, obj/structure/overmap/ship/npc/source_ship, mob_type, datum/npc_spawn_context/encounter, budget_reserved = FALSE, datum/callback/on_boarder)
if(!target_turf || !mob_type)
return null
// Combat volleys call this on a timer; the target may have docked since firing.
@@ -28,6 +37,12 @@ GLOBAL_VAR_INIT(boarding_spawn_total, 1)
return null
var/datum/npc_spawn_context/context = new(target_ship, controller.boarding_context.zone_type, "ordinary", source_turf = controller.boarding_context.source_turf)
+ if(ispath(mob_type, /mob/living/carbon/human/npc))
+ var/datum/callback/launch = CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(boarding_pod_launch), /obj/structure/closet/supplypod/boarding, target_turf, target_ship, source_ship, on_boarder)
+ var/datum/human_npc_order/order = spawn_human_npc(mob_type, boarding_pod_build_turf(source_ship, target_turf), launch, outfit = boarding_outfit_for(mob_type), context = context)
+ controller.track_boarding_order(order)
+ return order
+
// Create the boarding pod with the mob inside
var/obj/structure/closet/supplypod/boarding/pod = new()
@@ -37,17 +52,52 @@ GLOBAL_VAR_INIT(boarding_spawn_total, 1)
qdel(pod)
return null
- // Store references for the pod
+ boarding_pod_send(pod, boarder, target_turf, target_ship, source_ship)
+ on_boarder?.Invoke(boarder)
+ return boarder
+
+/// Where a human boarder is built before it goes in its pod: aboard the pirate's own hull, where it
+/// climbs into the pod, else (a hull with no dock) the landing spot itself. It is in its pod the same tick.
+/proc/boarding_pod_build_turf(obj/structure/overmap/ship/npc/source_ship, turf/target_turf)
+ return get_turf(source_ship?.shuttle) || target_turf
+
+/// The boarding outfit table for a human ship crewman (its faction's table sealed for vacuum), or null
+/// for anything else.
+/proc/boarding_outfit_for(mob_type)
+ if(!ispath(mob_type, /mob/living/carbon/human/npc/faction_pirate))
+ return null
+ var/mob/living/carbon/human/npc/faction_pirate/crew_type = mob_type
+ return initial(crew_type.boarding_outfit_table)
+
+/**
+ * A human boarder is built (the spawn queue's callback): if the raid it was sent on still stands, it goes
+ * in its pod and the pod launches; if the target docked or the raid ended meanwhile, the delivery is
+ * cancelled and the boarder deleted before anyone saw it. A boss learns which hull it boarded for.
+ */
+/proc/boarding_pod_launch(pod_type, turf/target_turf, obj/structure/overmap/ship/target_ship, obj/structure/overmap/ship/npc/source_ship, datum/callback/on_boarder, mob/living/boarder)
+ if(QDELETED(boarder))
+ return
+ var/datum/ai_controller/npc_ship/controller = source_ship?.ai_controller
+ if(QDELETED(target_ship) || QDELETED(source_ship) || target_ship.state != OVERMAP_SHIP_FLYING || source_ship.state != OVERMAP_SHIP_FLYING || !istype(controller) || controller.get_target() != target_ship)
+ qdel(boarder)
+ return
+ var/obj/structure/closet/supplypod/boarding/pod = new pod_type()
+ boarder.forceMove(pod)
+ var/mob/living/carbon/human/npc/faction_pirate/crewman = boarder
+ if(istype(crewman) && ispath(pod_type, /obj/structure/closet/supplypod/boarding/boss))
+ crewman.parent_ship = source_ship
+ boarding_pod_send(pod, boarder, target_turf, target_ship, source_ship)
+ on_boarder?.Invoke(boarder)
+
+/// Sends `pod`, with `boarder` already inside, falling onto `target_turf`.
+/proc/boarding_pod_send(obj/structure/closet/supplypod/boarding/pod, mob/living/boarder, turf/target_turf, obj/structure/overmap/ship/target_ship, obj/structure/overmap/ship/npc/source_ship)
pod.target_ship = target_ship
pod.source_ship = source_ship
pod.boarder_ref = WEAKREF(boarder)
pod.spawn_index = GLOB.boarding_spawn_index++
-
// Create the landing zone - this handles the whole falling animation
new /obj/effect/pod_landingzone/boarding(target_turf, pod, target_ship, source_ship)
- return boarder
-
/**
* Boarding Pod - A supplypod variant for delivering hostile boarders
*
@@ -162,9 +212,12 @@ GLOBAL_VAR_INIT(boarding_spawn_total, 1)
// ========== BOSS BOARDING POD ==========
-/// Global proc to create a boss boarding pod drop at a target location
-/// Returns the boss mob so the caller can register signals and track it
-/proc/create_boss_boarding_pod(turf/target_turf, obj/structure/overmap/ship/target_ship, obj/structure/overmap/ship/npc/source_ship, mob_type)
+/**
+ * Launches the boss's heavy boarding pod at `target_turf`. Returns the boss (a basic mob), the order of a
+ * human boss still in the spawn queue, or null. `on_boss` is called with the boss once it is in its pod.
+ * A human boss keeps its own look (it is dressed from its faction's ordinary table, with a mask and air).
+ */
+/proc/create_boss_boarding_pod(turf/target_turf, obj/structure/overmap/ship/target_ship, obj/structure/overmap/ship/npc/source_ship, mob_type, datum/callback/on_boss)
if(!target_turf || !mob_type)
return null
if(QDELETED(target_ship) || QDELETED(source_ship) || target_ship.state != OVERMAP_SHIP_FLYING || source_ship.state != OVERMAP_SHIP_FLYING)
@@ -179,6 +232,12 @@ GLOBAL_VAR_INIT(boarding_spawn_total, 1)
controller.boarding_boss_sent = TRUE
var/datum/npc_spawn_context/context = new(target_ship, controller.boarding_context.zone_type, "boss", source_turf = controller.boarding_context.source_turf)
+ if(ispath(mob_type, /mob/living/carbon/human/npc))
+ var/datum/callback/launch = CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(boarding_pod_launch), /obj/structure/closet/supplypod/boarding/boss, target_turf, target_ship, source_ship, on_boss)
+ var/datum/human_npc_order/order = spawn_human_npc(mob_type, boarding_pod_build_turf(source_ship, target_turf), launch, context = context)
+ controller.track_boarding_order(order)
+ return order
+
// Create the boss boarding pod
var/obj/structure/closet/supplypod/boarding/boss/pod = new()
@@ -192,14 +251,8 @@ GLOBAL_VAR_INIT(boarding_spawn_total, 1)
boss.parent_ship = source_ship
context.finalize()
- // Store references for the pod
- pod.target_ship = target_ship
- pod.source_ship = source_ship
- pod.boarder_ref = WEAKREF(boss)
-
- // Create the landing zone - this handles the whole falling animation
- new /obj/effect/pod_landingzone/boarding(target_turf, pod, target_ship, source_ship)
-
+ boarding_pod_send(pod, boss, target_turf, target_ship, source_ship)
+ on_boss?.Invoke(boss)
return boss
/**
diff --git a/voidcrew/modules/npc_ships/code/faction_pirates/faction_pirate_corpses.dm b/voidcrew/modules/npc_ships/code/faction_pirates/faction_pirate_corpses.dm
index 441ce006666..8cb174b72ea 100644
--- a/voidcrew/modules/npc_ships/code/faction_pirates/faction_pirate_corpses.dm
+++ b/voidcrew/modules/npc_ships/code/faction_pirates/faction_pirate_corpses.dm
@@ -168,7 +168,9 @@
outfit = /datum/outfit/piratecorpse/faction/lustrous
/obj/effect/mob_spawn/corpse/human/pirate/faction/lustrous/special(mob/living/carbon/human/spawned_human)
- // Prevent the ethereal heart's crystal revival mechanic from reviving NPC pirate corpses
+ // Only for bodies that start dead: the corpse a basic lustrous pirate leaves, and appearance dummies. A
+ // clientless prop revived by its crystal would be nobody. Living lustrous pirates are human NPCs that
+ // take only this spawner's look, never this proc, and crystallise as players do (defaults PI-6).
ADD_TRAIT(spawned_human, TRAIT_CANNOT_CRYSTALIZE, TRAIT_GENERIC)
return ..()
diff --git a/voidcrew/modules/npc_ships/code/faction_pirates/faction_pirate_humans.dm b/voidcrew/modules/npc_ships/code/faction_pirates/faction_pirate_humans.dm
new file mode 100644
index 00000000000..060544beed2
--- /dev/null
+++ b/voidcrew/modules/npc_ships/code/faction_pirates/faction_pirate_humans.dm
@@ -0,0 +1,834 @@
+/**
+ * # Faction pirates as human NPCs
+ *
+ * The seven pirate factions (Silverscale, the skeletons, the grey tide, the Lustrous, Interdyne, the IRS
+ * and the medieval knights) as real human NPCs (voidcrew/modules/human_npcs/): real bodies with real
+ * crit, stamina, wounds, cuffs, bleeding and revival, holding the real weapons they fight with. One type
+ * per faction and rank, /mob/living/carbon/human/npc/faction_pirate//,
+ * used wherever a faction pirate turns up:
+ * - aboard NPC pirate ships, as the hull's crew and the boarders it sends (phase B). The ship enlists them
+ * in a /datum/pirate_crew (pirate_crew.dm); boarders are dressed from the faction's boarding table;
+ * a boarding boss learns its hull (parent_ship);
+ * - in ruins and on planets, scattered by the pirate zone markers (voidcrew/modules/loot/themes/plunder.dm),
+ * and as kill contract targets and their guards (voidcrew/modules/missions/missions/recovery.dm)
+ * (phase C). There they belong to the planet's alliance like the fauna, and a contract target pays its
+ * cash once per contract (npc_payout_mission).
+ * Their AI is PR #500's pirate crew on the human base (pirate_crew_human.dm), crew or no crew: one with no
+ * crew fights what it sees and calls out who it spotted.
+ *
+ * Every faction keeps its look, lines and guns:
+ * - the look (species, hair, skin) comes from the faction corpse spawner (npc_look), the clothes and
+ * weapons from the faction's outfit table (human_npc_outfits_pirates.dm), picked by crew_role and rank;
+ * in vacuum the faction's own space suit, whatever outfit it wears;
+ * - toughness comes from what they wear plus npc_damage_taken by rank (captains 0.8, bosses 0.6), never
+ * from a health pool;
+ * - captains and bosses carry a real stimulant and inject it when their fight starts (the old stun
+ * immunity), Davy Jones drinks from a flask of cursed grog (his old regeneration), the Black Knight has
+ * tg's hulk and gigantism (his size and his shrugging off batons), the Radiant One is a real ethereal;
+ * - medieval footsoldiers, the warlord and the Black Knight refuse guns (TRAIT_NOGUNS), as before;
+ * - the designed loot rolls (the zone ladder, the red-zone 25% piece, boss uniques, the plunder of 25, 300,
+ * 1000 or 3000 credits) drop once at death, by the zone it belongs to (npc_home_zone()). What they wear
+ * and hold is locked to the body (D3) and never loot. A ship captain's key is not gear: it drops when he
+ * dies.
+ *
+ * Their ID card carries their name, so one whose helmet hides its face is still "Silverscale Duelist" and
+ * not "Unknown". It is locked gear like the rest and opens nothing.
+ */
+
+/// What a faction pirate says when things happen to its body (human_npc_barks.dm). "spot" is said when one
+/// with no crew picks someone new to fight; a crew calls out its own (pirate_crew.dm).
+/datum/human_npc_voice/faction_pirate
+ lines = list(
+ PIRATE_BARK_SPOT = list("There!", "Over here!", "Found one!", "Contact!"),
+ HUMAN_NPC_BARK_DOWNED = list("I'm hit!", "Agh! Man down!", "Not like this..."),
+ HUMAN_NPC_BARK_PLEAD = list("Don't... don't.", "Quarter... give quarter..."),
+ HUMAN_NPC_BARK_RECOVER = list("Still breathing.", "Back on my feet."),
+ HUMAN_NPC_BARK_CUFFED = list("The captain will hear of this.", "Get these off me!", "You'll hang for this."),
+ HUMAN_NPC_BARK_SLIPPING = list("Almost..."),
+ HUMAN_NPC_BARK_PULLED_FREE = list("Hands off!"),
+ HUMAN_NPC_BARK_SURRENDER = list("Alright! Alright, I'm done!", "Don't shoot! I yield!", "Quarter! I'm out!"),
+ )
+ emotes = list(
+ HUMAN_NPC_BARK_DOWNED = list("collapses."),
+ "stimulant" = list("jabs a needle into their neck."),
+ "drink" = list("takes a long pull from a battered flask."),
+ )
+ chances = list(PIRATE_BARK_SPOT = 60)
+
+/datum/human_npc_voice/faction_pirate/skeleton
+ lines = list(
+ PIRATE_BARK_SPOT = list("There ye are!", "I see ye!", "Over here, lads!"),
+ HUMAN_NPC_BARK_DOWNED = list("Back to the deep..."),
+ HUMAN_NPC_BARK_PLEAD = list("Mercy, matey..."),
+ HUMAN_NPC_BARK_RECOVER = list("The dead don't stay down."),
+ HUMAN_NPC_BARK_CUFFED = list("Irons won't hold the dead."),
+ HUMAN_NPC_BARK_SLIPPING = list("Almost..."),
+ HUMAN_NPC_BARK_PULLED_FREE = list("Unhand me!"),
+ )
+ emotes = list(
+ HUMAN_NPC_BARK_DOWNED = list("clatters to the floor."),
+ "stimulant" = list("jabs a needle between their ribs."),
+ "drink" = list("takes a long pull from a battered flask."),
+ )
+
+/datum/human_npc_voice/faction_pirate/grey
+ lines = list(
+ PIRATE_BARK_SPOT = list("Get 'em!", "That one, there!", "Over here!"),
+ HUMAN_NPC_BARK_DOWNED = list("I want my toolbox..."),
+ HUMAN_NPC_BARK_PLEAD = list("I didn't do nothing!"),
+ HUMAN_NPC_BARK_RECOVER = list("Robust!"),
+ HUMAN_NPC_BARK_CUFFED = list("I didn't take nothing!"),
+ HUMAN_NPC_BARK_SLIPPING = list("Almost..."),
+ HUMAN_NPC_BARK_PULLED_FREE = list("Hands off!"),
+ HUMAN_NPC_BARK_SURRENDER = list("Okay! Okay! I give!", "Not the face! I'm done!", "I didn't do nothing! I give up!"),
+ )
+
+/datum/human_npc_voice/faction_pirate/irs
+ lines = list(
+ PIRATE_BARK_SPOT = list("There's the taxpayer!", "Stop right there.", "You're overdue."),
+ HUMAN_NPC_BARK_DOWNED = list("This will be... noted..."),
+ HUMAN_NPC_BARK_PLEAD = list("I'm only an auditor..."),
+ HUMAN_NPC_BARK_RECOVER = list("Where were we."),
+ HUMAN_NPC_BARK_CUFFED = list("Obstruction of an audit. Noted."),
+ HUMAN_NPC_BARK_SLIPPING = list("Almost..."),
+ HUMAN_NPC_BARK_PULLED_FREE = list("Hands off!"),
+ HUMAN_NPC_BARK_SURRENDER = list("I'm unarmed! I'm an accountant!", "Fine! The audit is suspended!", "I yield! Pending review!"),
+ )
+
+/datum/human_npc_voice/faction_pirate/medieval
+ lines = list(
+ PIRATE_BARK_SPOT = list("Have at thee!", "There, the coward!", "Halt!"),
+ HUMAN_NPC_BARK_DOWNED = list("I am slain!", "'Tis but a scratch..."),
+ HUMAN_NPC_BARK_PLEAD = list("Quarter! I beg quarter!"),
+ HUMAN_NPC_BARK_RECOVER = list("I yet stand!"),
+ HUMAN_NPC_BARK_CUFFED = list("Thou shalt pay for this dishonour."),
+ HUMAN_NPC_BARK_SLIPPING = list("Almost..."),
+ HUMAN_NPC_BARK_PULLED_FREE = list("Unhand me, cur!"),
+ HUMAN_NPC_BARK_SURRENDER = list("I yield! I yield!", "Quarter! I beg quarter!"),
+ )
+
+/**
+ * When a pirate with no crew gives up (human_npc_surrender.dm): a ruin's, a planet's or a contract's. A crew
+ * aboard a ship fights on together, and its ship decides what is left of it (pirate_crew.dm). Bosses never
+ * give up; captains seldom.
+ */
+/datum/human_npc_surrender/faction_pirate
+ chance = 50
+ retry_chance = 20
+
+/datum/human_npc_surrender/faction_pirate/hurt_enough(mob/living/carbon/human/npc/npc)
+ if(npc.npc_rank >= HUMAN_NPC_RANK_BOSS)
+ return FALSE
+ return ..()
+
+/datum/human_npc_surrender/faction_pirate/odds(mob/living/carbon/human/npc/npc, list/hostiles, list/allies, first)
+ . = ..()
+ if(npc.npc_rank >= HUMAN_NPC_RANK_ELITE)
+ . = round(. / 2)
+
+/// Knights and their kind: they beg quarter less often, and never run.
+/datum/human_npc_surrender/faction_pirate/stubborn
+ chance = 30
+ retry_chance = 10
+ flees = FALSE
+
+/// Auditors and tiders: one gun on them is enough, and they run when they can.
+/datum/human_npc_surrender/faction_pirate/meek
+ chance = 70
+ retry_chance = 35
+ hostiles_needed = 1
+ health_share = 0.5
+
+/mob/living/carbon/human/npc/faction_pirate
+ name = "pirate"
+ faction = list(FACTION_PIRATE)
+ ai_controller = /datum/ai_controller/basic_controller/pirate_crew/human
+ npc_voice = /datum/human_npc_voice/faction_pirate
+ npc_target_stat = HUMAN_NPC_FINISHES_DOWNED
+ // Read only while it has no crew (pirate_crew_human.dm)
+ npc_surrender = /datum/human_npc_surrender/faction_pirate
+ /// SHIP_CREW_ROLE_MELEE or SHIP_CREW_ROLE_GUNNER: which of its faction's outfits a regular wears
+ var/crew_role
+ /// Its faction's table with a sealed suit added, for boarders (an outfit table typepath)
+ var/datum/human_npc_outfit_table/boarding_outfit_table
+ /// One line about it on examine, in character
+ var/crew_desc
+ /// What this faction shouts when its ship's crew goes on alert (pirate_crew.dm). Null: the generic lines.
+ var/list/crew_alert_lines
+ /// What it shouts when it spots someone. Null: the generic lines.
+ var/list/crew_spot_lines
+ /// The ZONE_* its spawn order dressed it for, or null if it was made without one
+ var/npc_dressed_zone
+
+ // ===== Designed loot, as the basic faction pirates roll it (faction_pirate_mobs.dm) =====
+ /// Always dropped
+ var/list/loot_pool
+ /// Each rolled once at spawn against npc_ladder_red_drop()
+ var/list/rare_loot_pool
+ /// What the rare roll gave
+ var/list/rolled_rare_loot
+ /// With any of these set, it drops one zone-laddered weapon (pirate_roll_ladder_weapon())
+ var/list/random_loot = list(
+ /obj/item/knife/combat/survival,
+ /obj/item/spear,
+ /obj/item/melee/baseball_bat,
+ )
+ /// One of these is always dropped
+ var/list/random_loot_2 = list(
+ /obj/item/storage/medkit/regular,
+ /obj/item/storage/toolbox/mechanical,
+ /obj/item/flashlight/seclite,
+ /obj/item/reagent_containers/hypospray/medipen,
+ /obj/item/stack/telecrystal,
+ )
+ /// A captain whose zone ladder drops a melee weapon (Silverscale, Lustrous and Interdyne captains)
+ var/captain_ladder_melee = FALSE
+ /// Weakref to the /datum/mission whose named target this is; its death cash pays only if that contract
+ /// can still claim it (/datum/mission/proc/claim_boss_cash())
+ var/datum/weakref/npc_payout_mission
+
+ // ===== Elites and bosses =====
+ /// The medipen it injects when its fight starts, or null. Elites and bosses get one by rank.
+ var/obj/item/reagent_containers/hypospray/medipen/stimulant_type
+ /// The NPC hull this is the boarding boss of; killing or taking it disables the hull
+ var/obj/structure/overmap/ship/npc/pirate/parent_ship
+
+/mob/living/carbon/human/npc/faction_pirate/Initialize(mapload, datum/human_npc_order/order)
+ switch(npc_rank)
+ if(HUMAN_NPC_RANK_ELITE)
+ // A type that sets its own toughness keeps it
+ if(npc_damage_taken == 1)
+ npc_damage_taken = SHIP_CREW_ELITE_DAMAGE_TAKEN
+ stimulant_type ||= /obj/item/reagent_containers/hypospray/medipen/stimpack/traitor
+ if(HUMAN_NPC_RANK_BOSS)
+ if(npc_damage_taken == 1)
+ npc_damage_taken = SHIP_CREW_BOSS_DAMAGE_TAKEN
+ . = ..()
+ npc_dressed_zone = order?.resolve_zone()
+ // Where it was put: a pirate with no crew keeps near it (pirate_crew_human.dm)
+ if(istype(ai_controller))
+ ai_controller.set_blackboard_key(BB_PIRATE_CREWLESS_HOME, get_turf(src))
+ // tg's Initialize gave it the planet's alliance before it was dressed; an ordered faction list may
+ // have replaced its factions since, so it rejoins here. Off a planet this does nothing.
+ inherit_planetary_faction(src)
+ rolled_rare_loot = list()
+ for(var/item_type in rare_loot_pool)
+ if(npc_ladder_red_drop())
+ rolled_rare_loot += item_type
+ crew_issue_id()
+ if(stimulant_type)
+ var/obj/item/stimulant = new stimulant_type(src)
+ if(!crew_give(stimulant))
+ qdel(stimulant)
+
+/mob/living/carbon/human/npc/faction_pirate/Destroy()
+ parent_ship = null
+ npc_payout_mission = null
+ return ..()
+
+// Natives of the planet they are found on, like the fauna they share it with.
+/mob/living/carbon/human/npc/faction_pirate/should_inherit_planetary_faction()
+ return TRUE
+
+// In vacuum, the faction's own space suit, even over an outfit it was handed directly.
+/mob/living/carbon/human/npc/faction_pirate/npc_fit_outfit_to_site(outfit, datum/human_npc_outfit_table/table)
+ if(isnull(table) && ispath(npc_outfit_table, /datum/human_npc_outfit_table))
+ table = human_npc_singleton(npc_outfit_table)
+ return ..(outfit, table)
+
+/mob/living/carbon/human/npc/faction_pirate/examine(mob/user)
+ . = ..()
+ if(crew_desc && stat != DEAD)
+ . += span_notice(crew_desc)
+
+/// An ID card with its name on it, so a helmet that hides its face doesn't make it "Unknown".
+/mob/living/carbon/human/npc/faction_pirate/proc/crew_issue_id()
+ if(wear_id)
+ return
+ var/obj/item/card/id/advanced/black/card = new(src)
+ card.registered_name = real_name
+ card.assignment = real_name
+ card.update_label()
+ if(!equip_to_slot_if_possible(card, ITEM_SLOT_ID, disable_warning = TRUE))
+ qdel(card)
+ return
+ npc_lock_item(card)
+
+/**
+ * Puts `thing` somewhere on its body it can take it from: a free pocket, else its backpack or belt.
+ * Locks or issues it by the gear rules (a ship key isn't gear, a medipen is a consumable). Returns TRUE
+ * if it is on the body; FALSE leaves it where it was, for the caller to deal with.
+ */
+/mob/living/carbon/human/npc/faction_pirate/proc/crew_give(obj/item/thing)
+ if(QDELETED(thing))
+ return FALSE
+ if(equip_to_slot_if_possible(thing, ITEM_SLOT_LPOCKET, disable_warning = TRUE) || equip_to_slot_if_possible(thing, ITEM_SLOT_RPOCKET, disable_warning = TRUE))
+ npc_lock_item(thing)
+ return TRUE
+ for(var/obj/item/container in list(back, belt))
+ if(container.atom_storage?.attempt_insert(thing, src, override = TRUE, messages = FALSE))
+ npc_lock_item(thing)
+ return TRUE
+ return FALSE
+
+/**
+ * Puts something that isn't gear (its ship's key) in a pocket, where a crew that has it cuffed or down can
+ * pick it out (the strip menu, human_npc.dm). A full pocket is emptied into its bag or belt first. Falls
+ * back to crew_give() if neither pocket can be had.
+ */
+/mob/living/carbon/human/npc/faction_pirate/proc/crew_pocket(obj/item/thing)
+ if(QDELETED(thing))
+ return FALSE
+ for(var/slot in list(ITEM_SLOT_LPOCKET, ITEM_SLOT_RPOCKET))
+ if(equip_to_slot_if_possible(thing, slot, disable_warning = TRUE))
+ npc_lock_item(thing)
+ return TRUE
+ for(var/slot in list(ITEM_SLOT_LPOCKET, ITEM_SLOT_RPOCKET))
+ var/obj/item/in_pocket = get_item_by_slot(slot)
+ if(isnull(in_pocket))
+ continue
+ for(var/obj/item/container in list(back, belt))
+ if(!container.atom_storage?.attempt_insert(in_pocket, src, override = TRUE, messages = FALSE))
+ continue
+ if(equip_to_slot_if_possible(thing, slot, disable_warning = TRUE))
+ npc_lock_item(thing)
+ return TRUE
+ break
+ return crew_give(thing)
+
+/**
+ * The zone it belongs to, for zone-laddered loot: its spawn context's, which may have resolved after it
+ * was made (a ruin loading before its planet registered), else the zone it was dressed for, else where
+ * it stands.
+ */
+/mob/living/carbon/human/npc/faction_pirate/proc/npc_home_zone()
+ return npc_spawn_context?.zone_type || npc_dressed_zone || npc_spawn_zone()
+
+// ===== Death and its designed drops =====
+
+/mob/living/carbon/human/npc/faction_pirate/npc_roll_death_loot()
+ var/zone = npc_home_zone()
+ . = list()
+ if(length(loot_pool))
+ . += loot_pool
+ if(length(rolled_rare_loot))
+ . += rolled_rare_loot
+ if(length(random_loot))
+ . += pirate_roll_ladder_weapon(zone)
+ if(captain_ladder_melee)
+ if(zone == ZONE_YELLOW)
+ . += /obj/item/claymore/shortsword
+ else if(zone == ZONE_RED)
+ . += pick(npc_ladder_yellow_melee())
+ if(length(random_loot_2))
+ . += pick(random_loot_2)
+
+// A named contract target's cash goes to the contract once: if the contract is gone or has already paid,
+// the body carries none.
+/mob/living/carbon/human/npc/faction_pirate/npc_drop_death_loot()
+ if(!npc_loot_dropped && npc_death_cash > 0 && npc_payout_mission)
+ var/datum/mission/mission = npc_payout_mission.resolve()
+ if(!mission?.claim_boss_cash())
+ npc_death_cash = 0
+ return ..()
+
+/mob/living/carbon/human/npc/faction_pirate/death(gibbed)
+ var/was_alive = stat != DEAD
+ . = ..()
+ if(was_alive && stat == DEAD)
+ crew_report_boss_down()
+
+/// The hull this boarded for hears its boss is down (PI-22: the boss's fall disables the hull).
+/mob/living/carbon/human/npc/faction_pirate/proc/crew_report_boss_down()
+ var/datum/ai_controller/npc_ship/controller = parent_ship?.ai_controller
+ if(istype(controller))
+ SEND_SIGNAL(controller, COMSIG_BOARDING_BOSS_KILLED, src)
+
+// ===== The factions =====
+
+// ----- Silverscale (aristocratic lizards) -----
+
+/mob/living/carbon/human/npc/faction_pirate/silverscale
+ npc_name = "Silverscale Pirate"
+ crew_desc = "An aristocratic lizard pirate demanding tribute from lesser beings."
+ npc_look = /obj/effect/mob_spawn/corpse/human/pirate/faction/silverscale
+ npc_outfit_table = /datum/human_npc_outfit_table/pirate/silverscale
+ boarding_outfit_table = /datum/human_npc_outfit_table/pirate/silverscale/boarding
+
+/mob/living/carbon/human/npc/faction_pirate/silverscale/Initialize(mapload, datum/human_npc_order/order)
+ // The rank and file may be carrying a fish (as the basic duelists and marksmen do)
+ if(crew_role)
+ random_loot_2 = list(/obj/item/storage/medkit/regular, /obj/item/storage/toolbox/mechanical, random_fish_type())
+ return ..()
+
+/mob/living/carbon/human/npc/faction_pirate/silverscale/melee
+ npc_name = "Silverscale Duelist"
+ crew_desc = "A noble lizard trained in the art of the blade."
+ crew_role = SHIP_CREW_ROLE_MELEE
+ npc_death_cash = 300
+
+/mob/living/carbon/human/npc/faction_pirate/silverscale/ranged
+ npc_name = "Silverscale Marksman"
+ crew_desc = "A noble lizard with impeccable aim."
+ crew_role = SHIP_CREW_ROLE_GUNNER
+ npc_death_cash = 25
+
+/mob/living/carbon/human/npc/faction_pirate/silverscale/captain
+ npc_name = "Silverscale Noble"
+ crew_desc = "A high-born lizard of impeccable breeding and ruthless ambition."
+ npc_rank = HUMAN_NPC_RANK_ELITE
+ random_loot = null
+ captain_ladder_melee = TRUE
+ npc_death_cash = 1000
+
+/mob/living/carbon/human/npc/faction_pirate/silverscale/boss
+ npc_name = "Silverscale Highlord"
+ crew_desc = "The supreme ruler of the Silverscale noble house. A master duelist who has slain countless challengers."
+ npc_rank = HUMAN_NPC_RANK_BOSS
+ npc_always_site = HUMAN_NPC_SITE_BAD_AIR
+ stimulant_type = /obj/item/reagent_containers/hypospray/medipen/stimulants
+ random_loot = null
+ random_loot_2 = null
+ loot_pool = list(/obj/item/clothing/suit/hooded/cloak/drake, /obj/item/clothing/head/hooded/cloakhood/drake)
+ npc_death_cash = 3000
+
+// ----- Skeleton (the Flying Dutchman) -----
+
+/mob/living/carbon/human/npc/faction_pirate/skeleton
+ npc_name = "Skeleton Pirate"
+ crew_desc = "Yarr! An undead scourge of the space lanes."
+ npc_look = /obj/effect/mob_spawn/corpse/human/pirate/faction/skeleton
+ npc_outfit_table = /datum/human_npc_outfit_table/pirate/skeleton
+ boarding_outfit_table = /datum/human_npc_outfit_table/pirate/skeleton/boarding
+ npc_voice = /datum/human_npc_voice/faction_pirate/skeleton
+ // The dead don't give up
+ npc_surrender = null
+ crew_alert_lines = list(
+ "All hands! Boarders!",
+ "Fresh crew coming aboard!",
+ "They'll fit right in. Eventually.",
+ )
+ crew_spot_lines = list(
+ "There ye are!",
+ "I see ye!",
+ "Over here, lads!",
+ )
+
+/mob/living/carbon/human/npc/faction_pirate/skeleton/melee
+ npc_name = "Skeleton Swashbuckler"
+ crew_desc = "A skeletal swordsman that refuses to stay dead."
+ crew_role = SHIP_CREW_ROLE_MELEE
+ npc_death_cash = 300
+
+/mob/living/carbon/human/npc/faction_pirate/skeleton/ranged
+ npc_name = "Skeleton Gunner"
+ crew_desc = "A skeletal marksman with hollow eyes."
+ crew_role = SHIP_CREW_ROLE_GUNNER
+ npc_death_cash = 25
+
+/mob/living/carbon/human/npc/faction_pirate/skeleton/captain
+ npc_name = "Skeleton Captain"
+ crew_desc = "The terrifying undead commander of the Flying Dutchman."
+ npc_rank = HUMAN_NPC_RANK_ELITE
+ loot_pool = list(/obj/item/gun/energy/laser)
+ random_loot = null
+ npc_death_cash = 1000
+
+/// Davy Jones drinks cursed grog from the flask in his pocket when he is hurt (his old regeneration,
+/// defaults PI-5).
+/mob/living/carbon/human/npc/faction_pirate/skeleton/boss
+ npc_name = "Davy Jones"
+ crew_desc = "Captain of the Flying Dutchman. His cursed compass always points to the greatest treasure... or the nearest victim."
+ npc_rank = HUMAN_NPC_RANK_BOSS
+ npc_always_site = HUMAN_NPC_SITE_BAD_AIR
+ stimulant_type = /obj/item/reagent_containers/hypospray/medipen/stimulants
+ random_loot = null
+ random_loot_2 = null
+ loot_pool = list(/obj/item/gun/ballistic/shotgun/hook)
+ npc_death_cash = 3000
+
+// ----- Grey Tide (rogue assistants) -----
+
+/mob/living/carbon/human/npc/faction_pirate/grey
+ npc_name = "Grey Tider"
+ crew_desc = "A former assistant turned space pirate. Robust."
+ npc_look = /obj/effect/mob_spawn/corpse/human/pirate/faction/grey
+ npc_outfit_table = /datum/human_npc_outfit_table/pirate/grey
+ boarding_outfit_table = /datum/human_npc_outfit_table/pirate/grey/boarding
+ npc_voice = /datum/human_npc_voice/faction_pirate/grey
+ npc_surrender = /datum/human_npc_surrender/faction_pirate/meek
+ crew_alert_lines = list(
+ "Someone's on the ship!",
+ "Who let them in?",
+ "They're after our stuff!",
+ )
+ crew_spot_lines = list(
+ "Get 'em!",
+ "That one, there!",
+ "Over here!",
+ )
+
+/mob/living/carbon/human/npc/faction_pirate/grey/melee
+ crew_desc = "Armed with a toolbox and bad intentions."
+ crew_role = SHIP_CREW_ROLE_MELEE
+ npc_death_cash = 300
+
+/mob/living/carbon/human/npc/faction_pirate/grey/ranged
+ npc_name = "Grey Tider Gunner"
+ crew_desc = "An assistant with a gun. Uh oh."
+ crew_role = SHIP_CREW_ROLE_GUNNER
+ npc_death_cash = 25
+
+/mob/living/carbon/human/npc/faction_pirate/grey/captain
+ npc_name = "Tidemaster"
+ crew_desc = "If he's on your shift, the Captain does not have his spare."
+ npc_rank = HUMAN_NPC_RANK_ELITE
+ loot_pool = list(/obj/item/storage/toolbox/syndicate)
+ random_loot = null
+ npc_death_cash = 1000
+
+/mob/living/carbon/human/npc/faction_pirate/grey/boss
+ npc_name = "The Robust One"
+ crew_desc = "The ultimate assistant. The greyest tider to ever live. Their toolbox has seen things."
+ npc_rank = HUMAN_NPC_RANK_BOSS
+ npc_always_site = HUMAN_NPC_SITE_BAD_AIR
+ stimulant_type = /obj/item/reagent_containers/hypospray/medipen/stimulants
+ random_loot = null
+ random_loot_2 = null
+ loot_pool = list(/obj/item/stack/telecrystal/five)
+ rare_loot_pool = list(/obj/item/storage/toolbox/mechanical/old/clean)
+ npc_death_cash = 3000
+
+/mob/living/carbon/human/npc/faction_pirate/grey/boss/Initialize(mapload, datum/human_npc_order/order)
+ . = ..()
+ AddComponent(/datum/component/hv_finisher_user, /datum/hv_finisher/robust_one)
+
+// ----- Lustrous (mutated ethereals) -----
+
+// Real ethereals: they glow by their species, and a dead one's heart crystallises and revives it as a
+// player's does, unless the crystal is broken (defaults PI-6).
+/mob/living/carbon/human/npc/faction_pirate/lustrous
+ npc_name = "Lustrous Pirate"
+ crew_desc = "A mutated ethereal obsessed with bluespace crystals."
+ npc_look = /obj/effect/mob_spawn/corpse/human/pirate/faction/lustrous
+ npc_outfit_table = /datum/human_npc_outfit_table/pirate/lustrous
+ boarding_outfit_table = /datum/human_npc_outfit_table/pirate/lustrous/boarding
+
+/mob/living/carbon/human/npc/faction_pirate/lustrous/melee
+ npc_name = "Lustrous Scintillant"
+ crew_desc = "A crystalline being with a sharp blade."
+ crew_role = SHIP_CREW_ROLE_MELEE
+ npc_death_cash = 300
+
+/mob/living/carbon/human/npc/faction_pirate/lustrous/ranged
+ npc_name = "Lustrous Coruscant"
+ crew_desc = "A crystalline being channeling energy through strange weapons."
+ crew_role = SHIP_CREW_ROLE_GUNNER
+ npc_death_cash = 25
+
+/mob/living/carbon/human/npc/faction_pirate/lustrous/captain
+ npc_name = "Lustrous Radiant"
+ crew_desc = "A blindingly bright ethereal, the leader of their crystalline kind."
+ npc_rank = HUMAN_NPC_RANK_ELITE
+ random_loot = null
+ captain_ladder_melee = TRUE
+ npc_death_cash = 1000
+
+/mob/living/carbon/human/npc/faction_pirate/lustrous/boss
+ npc_name = "The Radiant One"
+ crew_desc = "A blindingly luminous ethereal. The crystalline matrix of their body phases in and out of realspace."
+ npc_rank = HUMAN_NPC_RANK_BOSS
+ npc_always_site = HUMAN_NPC_SITE_BAD_AIR
+ stimulant_type = /obj/item/reagent_containers/hypospray/medipen/stimulants
+ random_loot = null
+ random_loot_2 = null
+ loot_pool = list(/obj/item/grenade/gas_crystal/nitrous_oxide_crystal)
+ rare_loot_pool = list(/obj/item/cain_and_abel)
+ npc_death_cash = 3000
+
+// ----- Interdyne (ex-pharmacists) -----
+
+/mob/living/carbon/human/npc/faction_pirate/interdyne
+ npc_name = "Interdyne Pirate"
+ crew_desc = "A former pharmaceutical employee turned bioterrorist."
+ npc_look = /obj/effect/mob_spawn/corpse/human/pirate/faction/interdyne
+ npc_outfit_table = /datum/human_npc_outfit_table/pirate/interdyne
+ boarding_outfit_table = /datum/human_npc_outfit_table/pirate/interdyne/boarding
+
+/mob/living/carbon/human/npc/faction_pirate/interdyne/melee
+ npc_name = "Interdyne Enforcer"
+ crew_desc = "Enforces pharmaceutical compliance with surgical precision."
+ crew_role = SHIP_CREW_ROLE_MELEE
+ npc_death_cash = 300
+
+/mob/living/carbon/human/npc/faction_pirate/interdyne/ranged
+ npc_name = "Interdyne Pharmacist"
+ crew_desc = "Dispenses death instead of medicine."
+ crew_role = SHIP_CREW_ROLE_GUNNER
+ npc_death_cash = 25
+
+/mob/living/carbon/human/npc/faction_pirate/interdyne/captain
+ npc_name = "Interdyne Director"
+ crew_desc = "The head of this rogue pharmaceutical operation."
+ npc_rank = HUMAN_NPC_RANK_ELITE
+ random_loot = null
+ captain_ladder_melee = TRUE
+ npc_death_cash = 1000
+
+/mob/living/carbon/human/npc/faction_pirate/interdyne/boss
+ npc_name = "Director Prime"
+ crew_desc = "The head of all Interdyne black site operations. Their hypospray contains experimental compounds."
+ npc_rank = HUMAN_NPC_RANK_BOSS
+ npc_always_site = HUMAN_NPC_SITE_BAD_AIR
+ stimulant_type = /obj/item/reagent_containers/hypospray/medipen/stimulants
+ random_loot = null
+ random_loot_2 = null
+ loot_pool = list(/obj/item/reagent_containers/hypospray/combat, /obj/item/gun/syringe/syndicate, /obj/item/grenade/gluon)
+ npc_death_cash = 3000
+
+// ----- IRS (tax collectors) -----
+
+/mob/living/carbon/human/npc/faction_pirate/irs
+ npc_name = "IRS Agent"
+ crew_desc = "The only thing certain in life is death and taxes. They're here for both."
+ faction = list(FACTION_PIRATE, FACTION_IRS)
+ npc_look = /obj/effect/mob_spawn/corpse/human/pirate/faction/irs
+ npc_outfit_table = /datum/human_npc_outfit_table/pirate/irs
+ boarding_outfit_table = /datum/human_npc_outfit_table/pirate/irs/boarding
+ npc_voice = /datum/human_npc_voice/faction_pirate/irs
+ npc_surrender = /datum/human_npc_surrender/faction_pirate/meek
+ crew_alert_lines = list(
+ "Unscheduled visitors. Begin the audit.",
+ "Everyone aboard is now under review.",
+ "Intruders on deck. Find them.",
+ )
+ crew_spot_lines = list(
+ "There's the taxpayer!",
+ "Stop right there.",
+ "You're overdue.",
+ )
+
+/mob/living/carbon/human/npc/faction_pirate/irs/melee
+ npc_name = "IRS Enforcer"
+ crew_desc = "Collects taxes the hard way."
+ crew_role = SHIP_CREW_ROLE_MELEE
+ npc_death_cash = 300
+
+/mob/living/carbon/human/npc/faction_pirate/irs/ranged
+ crew_desc = "Armed and ready to collect."
+ crew_role = SHIP_CREW_ROLE_GUNNER
+ npc_death_cash = 25
+
+/mob/living/carbon/human/npc/faction_pirate/irs/captain
+ npc_name = "IRS Head Auditor"
+ crew_desc = "The head of tax enforcement. Nobody escapes their audits."
+ npc_rank = HUMAN_NPC_RANK_ELITE
+ loot_pool = list(/obj/item/gun/energy/laser)
+ random_loot = null
+ npc_death_cash = 1000
+
+/mob/living/carbon/human/npc/faction_pirate/irs/boss
+ npc_name = "Chief Auditor"
+ crew_desc = "The supreme authority of the Space IRS. No one escapes their audits. NO ONE."
+ npc_rank = HUMAN_NPC_RANK_BOSS
+ npc_always_site = HUMAN_NPC_SITE_BAD_AIR
+ // Carried in the outfit: the chief has no bag to put one in
+ stimulant_type = null
+ random_loot = null
+ random_loot_2 = null
+ loot_pool = list(/obj/item/gun/energy/laser, /obj/item/storage/bag/money/dutchmen)
+ npc_death_cash = 3000
+
+// ----- Medieval (space warmongers) -----
+
+/mob/living/carbon/human/npc/faction_pirate/medieval
+ npc_name = "Medieval Pirate"
+ crew_desc = "A space-faring knight who somehow operates a starship."
+ npc_look = /obj/effect/mob_spawn/corpse/human/pirate/faction/medieval
+ npc_outfit_table = /datum/human_npc_outfit_table/pirate/medieval
+ boarding_outfit_table = /datum/human_npc_outfit_table/pirate/medieval/boarding
+ npc_voice = /datum/human_npc_voice/faction_pirate/medieval
+ npc_surrender = /datum/human_npc_surrender/faction_pirate/stubborn
+ crew_alert_lines = list(
+ "To arms! Intruders!",
+ "Who dares board us?",
+ "Defend the ship!",
+ )
+ crew_spot_lines = list(
+ "Have at thee!",
+ "There, the coward!",
+ "Halt!",
+ )
+ /// Hates guns and throws them hard (footsoldiers, the warlord and the Black Knight; not the crossbowmen)
+ var/refuses_guns = FALSE
+
+/mob/living/carbon/human/npc/faction_pirate/medieval/Initialize(mapload, datum/human_npc_order/order)
+ . = ..()
+ if(refuses_guns)
+ add_traits(list(TRAIT_NOGUNS, TRAIT_TOSS_GUN_HARD), INNATE_TRAIT)
+
+/mob/living/carbon/human/npc/faction_pirate/medieval/melee
+ npc_name = "Medieval Footsoldier"
+ crew_desc = "A knight who refuses to use guns. Honorable."
+ crew_role = SHIP_CREW_ROLE_MELEE
+ refuses_guns = TRUE
+ npc_death_cash = 300
+
+/mob/living/carbon/human/npc/faction_pirate/medieval/ranged
+ npc_name = "Medieval Crossbowman"
+ crew_desc = "At least crossbows are period-appropriate. Sort of."
+ crew_role = SHIP_CREW_ROLE_GUNNER
+ npc_death_cash = 25
+
+/// The warlord: plate armour and a stimulant where the basic mob had stun immunity (defaults PI-4).
+/mob/living/carbon/human/npc/faction_pirate/medieval/captain
+ npc_name = "Medieval Warlord"
+ crew_desc = "A hulking brute of a knight. Massive, and very angry."
+ npc_rank = HUMAN_NPC_RANK_ELITE
+ refuses_guns = TRUE
+ stimulant_type = /obj/item/reagent_containers/hypospray/medipen/stimulants
+ loot_pool = list(/obj/item/fireaxe)
+ random_loot = null
+ npc_death_cash = 1000
+
+/// The Black Knight: tg's hulk (stun and shove immune until he drops into crit) and gigantism (his size).
+/mob/living/carbon/human/npc/faction_pirate/medieval/boss
+ npc_name = "The Black Knight"
+ crew_desc = "A massive armored warrior. 'Tis but a scratch!' No really, they refuse to die."
+ npc_rank = HUMAN_NPC_RANK_BOSS
+ npc_damage_taken = 0.5
+ npc_always_site = HUMAN_NPC_SITE_BAD_AIR
+ refuses_guns = TRUE
+ random_loot = null
+ random_loot_2 = null
+ loot_pool = list(/obj/item/claymore/shortsword, /obj/item/shield/kite)
+ npc_death_cash = 3000
+
+/mob/living/carbon/human/npc/faction_pirate/medieval/boss/Initialize(mapload, datum/human_npc_order/order)
+ . = ..()
+ dna.add_mutation(/datum/mutation/hulk, MUTATION_SOURCE_MUTATOR)
+ dna.add_mutation(/datum/mutation/gigantism, MUTATION_SOURCE_MUTATOR)
+ AddComponent(/datum/component/hv_finisher_user, /datum/hv_finisher/black_knight)
+
+// ===== Boss kit =====
+
+/// Davy Jones's flask. Locked to him like the rest of his kit (D3).
+/obj/item/reagent_containers/cup/glass/flask/davy_jones
+ name = "battered flask"
+ desc = "A dented pewter flask. Whatever is in it smells of the deep."
+ list_reagents = list(/datum/reagent/medicine/omnizine/cursed_grog = 40)
+
+/**
+ * Cursed grog: knits the flesh of the undead while it is in their blood, with a cold blue glow. To the
+ * living it is brine and bad rum, so blood drawn from Davy Jones heals nobody. Never synthesised, never
+ * overdosed. Like any reagent it can be purged, and the flask runs dry.
+ */
+/datum/reagent/medicine/omnizine/cursed_grog
+ name = "Cursed Grog"
+ description = "Sea water and something older. It keeps the dead from staying dead."
+ color = "#2a4a7a"
+ taste_description = "brine and old rum"
+ healing = 3
+ overdose_threshold = 0
+ chemical_flags = NONE
+
+/datum/reagent/medicine/omnizine/cursed_grog/on_mob_life(mob/living/carbon/affected_mob, seconds_per_tick, times_fired)
+ healing = (affected_mob.mob_biotypes & MOB_UNDEAD) ? initial(healing) : 0
+ return ..()
+
+/datum/reagent/medicine/omnizine/cursed_grog/on_mob_metabolize(mob/living/affected_mob)
+ . = ..()
+ affected_mob.add_filter("cursed_grog", 2, outline_filter(1, "#4488FF"))
+
+/datum/reagent/medicine/omnizine/cursed_grog/on_mob_end_metabolize(mob/living/affected_mob)
+ . = ..()
+ affected_mob.remove_filter("cursed_grog")
+
+/// The Robust One's toolbox: the old blue toolbox, with the telecrystals inside that make it hit harder.
+/obj/item/storage/toolbox/mechanical/old/clean/robust_one
+ attack_verb_continuous = list("ROBUSTS")
+ attack_verb_simple = list("ROBUST")
+
+/obj/item/storage/toolbox/mechanical/old/clean/robust_one/PopulateContents()
+ . = ..()
+ new /obj/item/stack/telecrystal(src, 6)
+
+/// Davy Jones's cutlass.
+/obj/item/claymore/cutlass/davy_jones
+ attack_verb_continuous = list("curses", "slashes", "cuts")
+ attack_verb_simple = list("curse", "slash", "cut")
+
+/// The Black Knight's claymore.
+/obj/item/claymore/black_knight
+ attack_verb_continuous = list("smites", "cleaves", "hews")
+ attack_verb_simple = list("smite", "cleave", "hew")
+
+/// The warlord's boarding axe.
+/obj/item/fireaxe/boardingaxe/warlord
+ attack_verb_continuous = list("crushes", "cleaves", "hacks")
+ attack_verb_simple = list("crush", "cleave", "hack")
+
+/// An energy cutlass with a boss's own attack verbs.
+/obj/item/melee/energy/sword/pirate/boss
+ /// Verbs while lit
+ var/list/boss_verbs_continuous = list("eviscerates")
+ var/list/boss_verbs_simple = list("eviscerate")
+
+/obj/item/melee/energy/sword/pirate/boss/make_transformable()
+ AddComponent( \
+ /datum/component/transforming, \
+ force_on = active_force, \
+ throwforce_on = active_throwforce, \
+ throw_speed_on = 4, \
+ sharpness_on = active_sharpness, \
+ hitsound_on = active_hitsound, \
+ w_class_on = active_w_class, \
+ attack_verb_continuous_on = boss_verbs_continuous, \
+ attack_verb_simple_on = boss_verbs_simple, \
+ )
+ RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))
+
+/// The Radiant One's cutlass.
+/obj/item/melee/energy/sword/pirate/boss/radiant
+ boss_verbs_continuous = list("phases through", "slashes")
+ boss_verbs_simple = list("phase through", "slash")
+
+// ===== Dressing by role, and for boarding =====
+
+// A crewman of the rank and file wears its role's outfits from its faction's table
+// (voidcrew/modules/human_npcs/human_npc_outfits_pirates.dm): a duelist the faction's blades, a marksman
+// its guns in PR #500's gun weights. Captains and bosses wear their own.
+/datum/human_npc_outfit_table/pirate/outfits_for(mob/living/carbon/human/npc/npc, zone)
+ var/mob/living/carbon/human/npc/faction_pirate/crewman = npc
+ if(istype(crewman) && crewman.npc_rank == HUMAN_NPC_RANK_REGULAR)
+ switch(crewman.crew_role)
+ if(SHIP_CREW_ROLE_MELEE)
+ if(length(melee) && !gunners_only)
+ return melee
+ if(SHIP_CREW_ROLE_GUNNER)
+ if(length(gunners))
+ return gunners
+ return ..()
+
+// Boarders cross space and may land in a vented room, so they wear a sealed suit and carry air
+// (always_site, human_npc_outfits.dm). Skeletons need neither and are left as they are.
+/datum/human_npc_outfit_table/pirate/silverscale/boarding
+ always_site = HUMAN_NPC_SITE_VACUUM
+
+/datum/human_npc_outfit_table/pirate/skeleton/boarding
+ always_site = HUMAN_NPC_SITE_VACUUM
+
+/datum/human_npc_outfit_table/pirate/grey/boarding
+ always_site = HUMAN_NPC_SITE_VACUUM
+
+/datum/human_npc_outfit_table/pirate/lustrous/boarding
+ always_site = HUMAN_NPC_SITE_VACUUM
+
+/datum/human_npc_outfit_table/pirate/interdyne/boarding
+ always_site = HUMAN_NPC_SITE_VACUUM
+
+/datum/human_npc_outfit_table/pirate/irs/boarding
+ always_site = HUMAN_NPC_SITE_VACUUM
+
+/datum/human_npc_outfit_table/pirate/medieval/boarding
+ always_site = HUMAN_NPC_SITE_VACUUM
diff --git a/voidcrew/modules/npc_ships/code/faction_pirates/faction_pirate_mobs.dm b/voidcrew/modules/npc_ships/code/faction_pirates/faction_pirate_mobs.dm
index 4622793770b..081ecec1352 100644
--- a/voidcrew/modules/npc_ships/code/faction_pirates/faction_pirate_mobs.dm
+++ b/voidcrew/modules/npc_ships/code/faction_pirates/faction_pirate_mobs.dm
@@ -1,4 +1,5 @@
-// Faction-specific pirate NPC mobs for Voidcrew NPC ships
+// Faction-specific pirate NPC basic mobs. NPC ship crews and their boarders are human NPCs now
+// (faction_pirate_humans.dm); these stay for ruins, planets and missions until those move (phase C).
// Each faction has melee, ranged, and captain variants
// All are space-capable (no atmos damage, spacewalk trait)
@@ -25,10 +26,6 @@
var/list/crew_alert_lines
/// What it shouts when it spots someone. Null uses the generic lines.
var/list/crew_spot_lines
- /// Weights of the guns a gunner of this faction rolls when it joins a crew (pirate_guns.dm). Null: the default mix.
- var/list/crew_gun_weights
- /// Keeps its own ranged weapon instead of rolling a gun
- var/crew_keeps_gun = FALSE
/// Random combat loot - one item is picked at random and added to death drops.
var/list/random_loot = list(\
/obj/item/knife/combat/survival,\
@@ -83,6 +80,10 @@
AddElement(/datum/element/death_drops, string_list(death_loot))
/mob/living/basic/trooper/pirate/faction/proc/roll_ladder_weapon(zone, roll = rand(1, 100))
+ return pirate_roll_ladder_weapon(zone, roll)
+
+/// The weapon a faction pirate drops by the zone it fought in, basic or human (faction_pirate_humans.dm).
+/proc/pirate_roll_ladder_weapon(zone, roll = rand(1, 100))
switch(zone)
if(ZONE_YELLOW)
return roll <= 5 ? /obj/item/gun/energy/laser : pick(npc_ladder_yellow_melee())
@@ -636,56 +637,3 @@
ADD_TRAIT(src, TRAIT_PUSHIMMUNE, INNATE_TRAIT)
ADD_TRAIT(src, TRAIT_NOGUNS, INNATE_TRAIT)
ADD_TRAIT(src, TRAIT_TOSS_GUN_HARD, INNATE_TRAIT)
-
-// ==================== CREW GUNS ====================
-// What each faction's gunners roll when they join a crew (pirate_guns.dm)
-
-/mob/living/basic/trooper/pirate/faction/silverscale
- crew_gun_weights = list(
- /datum/pirate_gun_loadout/energy_gun = 3,
- /datum/pirate_gun_loadout/laser_rifle = 2,
- /datum/pirate_gun_loadout/pistol = 3,
- /datum/pirate_gun_loadout/shotgun = 1,
- )
-
-/mob/living/basic/trooper/pirate/faction/skeleton
- crew_gun_weights = list(
- /datum/pirate_gun_loadout/laser_rifle = 1,
- /datum/pirate_gun_loadout/pistol = 2,
- /datum/pirate_gun_loadout/smg = 2,
- /datum/pirate_gun_loadout/shotgun = 3,
- )
-
-/mob/living/basic/trooper/pirate/faction/grey
- crew_gun_weights = list(
- /datum/pirate_gun_loadout/energy_gun = 3,
- /datum/pirate_gun_loadout/laser_rifle = 3,
- /datum/pirate_gun_loadout/smg = 1,
- )
-
-/mob/living/basic/trooper/pirate/faction/lustrous
- crew_gun_weights = list(
- /datum/pirate_gun_loadout/energy_gun = 3,
- /datum/pirate_gun_loadout/laser_rifle = 3,
- /datum/pirate_gun_loadout/pistol = 1,
- )
-
-/mob/living/basic/trooper/pirate/faction/interdyne
- crew_gun_weights = list(
- /datum/pirate_gun_loadout/energy_gun = 2,
- /datum/pirate_gun_loadout/pistol = 2,
- /datum/pirate_gun_loadout/smg = 3,
- /datum/pirate_gun_loadout/shotgun = 1,
- )
-
-/mob/living/basic/trooper/pirate/faction/irs
- crew_gun_weights = list(
- /datum/pirate_gun_loadout/energy_gun = 1,
- /datum/pirate_gun_loadout/pistol = 3,
- /datum/pirate_gun_loadout/smg = 2,
- /datum/pirate_gun_loadout/shotgun = 2,
- )
-
-// Crossbows suit them
-/mob/living/basic/trooper/pirate/faction/medieval
- crew_keeps_gun = TRUE
diff --git a/voidcrew/modules/npc_ships/code/faction_pirates/faction_pirate_ships.dm b/voidcrew/modules/npc_ships/code/faction_pirates/faction_pirate_ships.dm
index 8d743ce5b2f..1cffb46b6b3 100644
--- a/voidcrew/modules/npc_ships/code/faction_pirates/faction_pirate_ships.dm
+++ b/voidcrew/modules/npc_ships/code/faction_pirates/faction_pirate_ships.dm
@@ -1,5 +1,6 @@
// Faction-specific NPC pirate ship types
-// Each faction has unique colors, crew types, and behaviors
+// Each faction has unique colors, crew types, and behaviors. Crews, boarders and bosses are human NPCs
+// (faction_pirate_humans.dm).
// ==================== FACTION COLORS ====================
@@ -29,11 +30,11 @@
crew_min = 2
crew_max = 4
- captain_type = /mob/living/basic/trooper/pirate/faction/silverscale/captain
+ captain_type = /mob/living/carbon/human/npc/faction_pirate/silverscale/captain
crew_types = list(
- /mob/living/basic/trooper/pirate/faction/silverscale/melee,
- /mob/living/basic/trooper/pirate/faction/silverscale/melee,
- /mob/living/basic/trooper/pirate/faction/silverscale/ranged,
+ /mob/living/carbon/human/npc/faction_pirate/silverscale/melee,
+ /mob/living/carbon/human/npc/faction_pirate/silverscale/melee,
+ /mob/living/carbon/human/npc/faction_pirate/silverscale/ranged,
)
// Boarding pods - aristocrats send their duelists
@@ -52,7 +53,7 @@
pirate_faction = "silverscale"
// Phased combat - aristocratic duelists
- boss_type = /mob/living/basic/trooper/pirate/faction/boss/silverscale
+ boss_type = /mob/living/carbon/human/npc/faction_pirate/silverscale/boss
broke_lines = list(
"Destitute. How disappointing. My retainers will see what else your hold contains.",
"You have nothing to offer but cargo, then. And perhaps your lives.",
@@ -90,11 +91,11 @@
crew_min = 3
crew_max = 6
- captain_type = /mob/living/basic/trooper/pirate/faction/skeleton/captain
+ captain_type = /mob/living/carbon/human/npc/faction_pirate/skeleton/captain
crew_types = list(
- /mob/living/basic/trooper/pirate/faction/skeleton/melee,
- /mob/living/basic/trooper/pirate/faction/skeleton/melee,
- /mob/living/basic/trooper/pirate/faction/skeleton/ranged,
+ /mob/living/carbon/human/npc/faction_pirate/skeleton/melee,
+ /mob/living/carbon/human/npc/faction_pirate/skeleton/melee,
+ /mob/living/carbon/human/npc/faction_pirate/skeleton/ranged,
)
// Boarding pods - undead are relentless boarders
@@ -112,7 +113,7 @@
pirate_faction = "skeleton"
// Phased combat - undead hordes
- boss_type = /mob/living/basic/trooper/pirate/faction/boss/skeleton
+ boss_type = /mob/living/carbon/human/npc/faction_pirate/skeleton/boss
broke_lines = list(
"No coin on this wreck. No matter - we take flesh as readily as gold.",
"Empty holds, empty pockets. We will settle for your crew.",
@@ -150,11 +151,11 @@
crew_min = 3
crew_max = 5
- captain_type = /mob/living/basic/trooper/pirate/faction/grey/captain
+ captain_type = /mob/living/carbon/human/npc/faction_pirate/grey/captain
crew_types = list(
- /mob/living/basic/trooper/pirate/faction/grey/melee,
- /mob/living/basic/trooper/pirate/faction/grey/melee,
- /mob/living/basic/trooper/pirate/faction/grey/ranged,
+ /mob/living/carbon/human/npc/faction_pirate/grey/melee,
+ /mob/living/carbon/human/npc/faction_pirate/grey/melee,
+ /mob/living/carbon/human/npc/faction_pirate/grey/ranged,
)
// Boarding pods - grey tiders love swarming
@@ -172,7 +173,7 @@
hold_credits_max = 1600
// Phased combat - greytide swarm
- boss_type = /mob/living/basic/trooper/pirate/faction/boss/grey
+ boss_type = /mob/living/carbon/human/npc/faction_pirate/grey/boss
broke_lines = list(
"lmao ur broke? w/e. boys go grab whatever isnt bolted down",
"no creds? fine. WE TAKE THE TOOLBOXES",
@@ -206,10 +207,10 @@
crew_min = 2
crew_max = 4
- captain_type = /mob/living/basic/trooper/pirate/faction/lustrous/captain
+ captain_type = /mob/living/carbon/human/npc/faction_pirate/lustrous/captain
crew_types = list(
- /mob/living/basic/trooper/pirate/faction/lustrous/melee,
- /mob/living/basic/trooper/pirate/faction/lustrous/ranged,
+ /mob/living/carbon/human/npc/faction_pirate/lustrous/melee,
+ /mob/living/carbon/human/npc/faction_pirate/lustrous/ranged,
)
// Boarding pods - ethereals prefer ranged combat, fewer boarders
@@ -227,7 +228,7 @@
hold_credits_max = 3000
// Phased combat - crystalline beings
- boss_type = /mob/living/basic/trooper/pirate/faction/boss/lustrous
+ boss_type = /mob/living/carbon/human/npc/faction_pirate/lustrous/boss
broke_lines = list(
"You carry no wealth. We will take what matter you do carry.",
"Nothing of value in your accounts. We will harvest from your hold instead.",
@@ -266,11 +267,11 @@
crew_min = 3
crew_max = 5
- captain_type = /mob/living/basic/trooper/pirate/faction/interdyne/captain
+ captain_type = /mob/living/carbon/human/npc/faction_pirate/interdyne/captain
crew_types = list(
- /mob/living/basic/trooper/pirate/faction/interdyne/melee,
- /mob/living/basic/trooper/pirate/faction/interdyne/ranged,
- /mob/living/basic/trooper/pirate/faction/interdyne/ranged,
+ /mob/living/carbon/human/npc/faction_pirate/interdyne/melee,
+ /mob/living/carbon/human/npc/faction_pirate/interdyne/ranged,
+ /mob/living/carbon/human/npc/faction_pirate/interdyne/ranged,
)
// Boarding pods - interdyne sends surgical strike teams
@@ -288,7 +289,7 @@
hold_credits_max = 3800
// Phased combat - surgical strike teams
- boss_type = /mob/living/basic/trooper/pirate/faction/boss/interdyne
+ boss_type = /mob/living/carbon/human/npc/faction_pirate/interdyne/boss
broke_lines = list(
"Accounts empty. Switching to physical asset recovery. Deploying collection team.",
"No liquid funds. Your cargo and your crew will serve as compensation.",
@@ -331,11 +332,11 @@
crew_min = 3
crew_max = 5
- captain_type = /mob/living/basic/trooper/pirate/faction/irs/captain
+ captain_type = /mob/living/carbon/human/npc/faction_pirate/irs/captain
crew_types = list(
- /mob/living/basic/trooper/pirate/faction/irs/melee,
- /mob/living/basic/trooper/pirate/faction/irs/ranged,
- /mob/living/basic/trooper/pirate/faction/irs/ranged,
+ /mob/living/carbon/human/npc/faction_pirate/irs/melee,
+ /mob/living/carbon/human/npc/faction_pirate/irs/ranged,
+ /mob/living/carbon/human/npc/faction_pirate/irs/ranged,
)
// Boarding pods - IRS sends auditors to seize assets
@@ -354,7 +355,7 @@
hold_credits_max = 6000
// Phased combat - tax enforcement
- boss_type = /mob/living/basic/trooper/pirate/faction/boss/irs
+ boss_type = /mob/living/carbon/human/npc/faction_pirate/irs/boss
broke_lines = list(
"Insufficient funds for settlement. Proceeding directly to asset seizure.",
"You cannot pay. Then we collect in kind. Agents are boarding now.",
@@ -396,11 +397,11 @@
crew_min = 3
crew_max = 6
- captain_type = /mob/living/basic/trooper/pirate/faction/medieval/captain
+ captain_type = /mob/living/carbon/human/npc/faction_pirate/medieval/captain
crew_types = list(
- /mob/living/basic/trooper/pirate/faction/medieval/melee,
- /mob/living/basic/trooper/pirate/faction/medieval/melee,
- /mob/living/basic/trooper/pirate/faction/medieval/ranged,
+ /mob/living/carbon/human/npc/faction_pirate/medieval/melee,
+ /mob/living/carbon/human/npc/faction_pirate/medieval/melee,
+ /mob/living/carbon/human/npc/faction_pirate/medieval/ranged,
)
// Boarding pods - medieval warriors LOVE boarding actions
@@ -418,7 +419,7 @@
hold_credits_max = 3200
// Phased combat - knights and men-at-arms
- boss_type = /mob/living/basic/trooper/pirate/faction/boss/medieval
+ boss_type = /mob/living/carbon/human/npc/faction_pirate/medieval/boss
broke_lines = list(
"No coin in thy coffers? Then we shall take thy goods by force of arms!",
"A pauper's ship! Very well - the spoils shall be whatever thou carriest!",
diff --git a/voidcrew/modules/npc_ships/code/faction_pirates/nt_patrol.dm b/voidcrew/modules/npc_ships/code/faction_pirates/nt_patrol.dm
index 20fe1ccaac3..0be6558a3d8 100644
--- a/voidcrew/modules/npc_ships/code/faction_pirates/nt_patrol.dm
+++ b/voidcrew/modules/npc_ships/code/faction_pirates/nt_patrol.dm
@@ -61,11 +61,11 @@
// Crew configuration - NT customs enforcement detail
crew_min = 3
crew_max = 5
- captain_type = /mob/living/basic/trooper/nanotrasen/ranged/assault/customs
+ captain_type = /mob/living/carbon/human/npc/faction_pirate/nt_customs/sergeant
crew_types = list(
- /mob/living/basic/trooper/nanotrasen/customs,
- /mob/living/basic/trooper/nanotrasen/ranged/smg/customs,
- /mob/living/basic/trooper/nanotrasen/ranged/smg/customs,
+ /mob/living/carbon/human/npc/faction_pirate/nt_customs/officer,
+ /mob/living/carbon/human/npc/faction_pirate/nt_customs/inspector,
+ /mob/living/carbon/human/npc/faction_pirate/nt_customs/inspector,
)
// Negotiation - the "fine". Dispatch overwrites both bounds with the exact
@@ -88,8 +88,8 @@
boarding_pods_max = 2
boarding_pod_cooldown_time = 30 SECONDS
boarding_pod_mob_types = list(
- /mob/living/basic/trooper/nanotrasen/customs,
- /mob/living/basic/trooper/nanotrasen/ranged/smg/customs,
+ /mob/living/carbon/human/npc/faction_pirate/nt_customs/officer,
+ /mob/living/carbon/human/npc/faction_pirate/nt_customs/inspector,
)
// Phased combat - compliance action waves, then the Director
@@ -99,7 +99,7 @@
list(3, 4), // Wave 2
list(3, 5), // Wave 3
)
- boss_type = /mob/living/basic/trooper/pirate/faction/boss/nt_patrol
+ boss_type = /mob/living/carbon/human/npc/faction_pirate/nt_customs/director
wave_taunts = list(
list( // Wave 1 -> 2 cooldown
"Compliance teams are inbound. This is a billable action.",
@@ -185,10 +185,11 @@
// faction_pirate_equipment.dm, but keyed to the NT crew's faction so they
// don't gun down their own officers.
//
-// req_access is deliberately an access nobody aboard carries. The crew are
-// basic mobs with no ID cards, so the swipe lock only ever gates boarders -
-// and the inherited ACCESS_SYNDICATE gated it the wrong way round, since
-// voidcrew's syndicate job outfits hand players that access at roundstart.
+// req_access is CentCom access. The crew carry CentCom ID cards, but those are
+// locked to their bodies (human NPC gear lock, voidcrew/modules/human_npcs/) and
+// the crew never work a turret's panel, so the swipe lock only ever gates
+// boarders - and the inherited ACCESS_SYNDICATE gated it the wrong way round,
+// since voidcrew's syndicate job outfits hand players that access at roundstart.
// The counterplay is the turretid console, which ship_nt_patrol.dmm maps
// unlocked on purpose.
@@ -204,100 +205,177 @@
faction = list(ROLE_DEATHSQUAD)
req_access = list(ACCESS_CENT_GENERAL)
-// ==================== CREW MOBS ====================
-// Space-capable customs variants of the upstream NT troopers
-// (code/modules/mob/living/basic/trooper/nanotrasen.dm). Mirrors what
-// /mob/living/basic/trooper/pirate/faction does for pirate crews: atmos
-// immunity + TRAIT_SPACEWALK so ship interiors and boarding actions work.
-
-/// Customs guard - melee escort with a stun baton
-/mob/living/basic/trooper/nanotrasen/customs
- name = "\improper Nanotrasen Customs Officer"
- desc = "A Nanotrasen customs officer, here to search your ship. The baton is standard issue."
- maxHealth = 110
- health = 110
- melee_damage_lower = 12
- melee_damage_upper = 18
- attack_verb_continuous = "batons"
- attack_verb_simple = "baton"
- attack_sound = 'sound/items/weapons/genhit1.ogg'
- unsuitable_atmos_damage = 0
- unsuitable_cold_damage = 0
- unsuitable_heat_damage = 0
- minimum_survivable_temperature = 0
- r_hand = /obj/item/melee/baton/security
-
-/mob/living/basic/trooper/nanotrasen/customs/Initialize(mapload)
- . = ..()
- ADD_TRAIT(src, TRAIT_SPACEWALK, INNATE_TRAIT)
-
-/// Customs inspector - SMG-armed ranged officer
-/mob/living/basic/trooper/nanotrasen/ranged/smg/customs
- name = "\improper Nanotrasen Customs Inspector"
- desc = "A Nanotrasen customs inspector. Authorized to conduct searches, seizures, and suppressive fire."
- unsuitable_atmos_damage = 0
- unsuitable_cold_damage = 0
- unsuitable_heat_damage = 0
- minimum_survivable_temperature = 0
-
-/mob/living/basic/trooper/nanotrasen/ranged/smg/customs/Initialize(mapload)
- . = ..()
- ADD_TRAIT(src, TRAIT_SPACEWALK, INNATE_TRAIT)
-
-/// Customs sergeant - assault-rifle captain of the patrol (carries the ship key)
-/mob/living/basic/trooper/nanotrasen/ranged/assault/customs
- name = "\improper Nanotrasen Customs Sergeant"
- desc = "The ranking customs officer aboard. Personally responsible for this quarter's seizure figures."
- maxHealth = 120
- health = 120
- unsuitable_atmos_damage = 0
- unsuitable_cold_damage = 0
- unsuitable_heat_damage = 0
- minimum_survivable_temperature = 0
-
-/mob/living/basic/trooper/nanotrasen/ranged/assault/customs/Initialize(mapload)
- . = ..()
- ADD_TRAIT(src, TRAIT_SPACEWALK, INNATE_TRAIT)
-
-// ==================== THE BOSS ====================
-// Subtypes /mob/living/basic/trooper/pirate/faction/boss because
-// create_boss_boarding_pod() (boarding_pod.dm) writes boss.parent_ship and the
-// boss death hook lives on that type - an upstream NT trooper would runtime.
-// Flavor and loadout are pure Nanotrasen.
-
-/mob/living/basic/trooper/pirate/faction/boss/nt_patrol
- name = "NT Compliance Director"
- desc = "A senior Nanotrasen compliance executive in body armor, sent out when the paperwork stops working."
- maxHealth = 350
- health = 350
- melee_damage_lower = 20
- melee_damage_upper = 25
- armour_penetration = 25
- attack_verb_continuous = "restructures"
- attack_verb_simple = "restructure"
- attack_sound = 'sound/items/weapons/genhit1.ogg'
- attack_vis_effect = ATTACK_EFFECT_PUNCH
+// ==================== THE CREW ====================
+// Customs officers, inspectors, their sergeant and the Compliance Director as human NPCs
+// (voidcrew/modules/human_npcs/), crewing the corvette and boarding by pod the way the pirate factions do
+// (faction_pirate_humans.dm, whose crew AI, boarding, captain's key and boss hooks they share). They look
+// like tg's Nanotrasen troopers (the corpse spawners' species, hair and clothes) and hold the guns those
+// troopers fired, by the zone ladder the basic customs mobs used (voidcrew/edits/mobs/weapon_drops.dm):
+// inspectors and the sergeant carry an M1911 outside the red zone. Their CentCom ID cards are locked gear
+// like the rest of their kit, so a dead officer's card opens nothing for anyone. Boarders wear a sealed suit
+// and carry air. They drop nothing (a customs vessel is no prize); the Director drops his e-gun, his baton
+// and 2,000 credits of collected fines, as the basic boss did.
+
+/// What customs says when things happen to its body (human_npc_barks.dm)
+/datum/human_npc_voice/nt_customs
+ lines = list(
+ PIRATE_BARK_SPOT = list("Customs! Stay where you are!", "There. Detain them.", "Contact. Compliance action authorised."),
+ HUMAN_NPC_BARK_DOWNED = list("Officer down!", "I need a medic. Bill them for it."),
+ HUMAN_NPC_BARK_PLEAD = list("Assaulting an officer... is a crime...", "This is going on your file..."),
+ HUMAN_NPC_BARK_RECOVER = list("Back on duty.", "Where was I."),
+ HUMAN_NPC_BARK_CUFFED = list("You're cuffing a customs officer. That's on file.", "This is obstruction."),
+ HUMAN_NPC_BARK_SLIPPING = list("Almost..."),
+ HUMAN_NPC_BARK_PULLED_FREE = list("Hands off, citizen!"),
+ )
+ emotes = list(
+ HUMAN_NPC_BARK_DOWNED = list("collapses."),
+ "stimulant" = list("jabs a needle into their neck."),
+ )
+ chances = list(PIRATE_BARK_SPOT = 60)
+
+/mob/living/carbon/human/npc/faction_pirate/nt_customs
+ name = "customs officer"
+ npc_name = "Nanotrasen Customs Officer"
+ crew_desc = "A Nanotrasen customs officer, here to search your ship."
+ // The corvette's turrets and doors are keyed to it (above); never counted as a pirate
faction = list(ROLE_DEATHSQUAD)
- mob_spawner = /obj/effect/mob_spawn/corpse/human/nanotrasenelitesoldier
- corpse = /obj/effect/mob_spawn/corpse/human/nanotrasenelitesoldier
- r_hand = /obj/item/gun/energy/e_gun
- loot_pool = list(/obj/item/gun/energy/e_gun, /obj/item/melee/baton/security/loaded)
- plunder_credits = 2000
- ai_controller = /datum/ai_controller/basic_controller/trooper/ranged
- var/projectiletype = /obj/projectile/beam/laser
- var/projectilesound = 'sound/items/weapons/laser.ogg'
- var/burst_shots = 3
- var/ranged_cooldown = 5 SECONDS
-
-/mob/living/basic/trooper/pirate/faction/boss/nt_patrol/Initialize(mapload)
- . = ..()
- AddComponent(\
- /datum/component/ranged_attacks,\
- projectile_type = projectiletype,\
- projectile_sound = projectilesound,\
- cooldown_time = ranged_cooldown,\
- burst_shots = burst_shots,\
+ npc_look = /obj/effect/mob_spawn/corpse/human/nanotrasensoldier
+ npc_outfit_table = /datum/human_npc_outfit_table/pirate/nt_customs
+ boarding_outfit_table = /datum/human_npc_outfit_table/pirate/nt_customs/boarding
+ npc_voice = /datum/human_npc_voice/nt_customs
+ // Always aboard their corvette or with its boarders: the crew decides, as for pirates
+ npc_surrender = null
+ crew_alert_lines = list(
+ "Unauthorised boarders. Detain them.",
+ "Intruders on a customs vessel. Weapons free.",
+ "All officers, we have a breach.",
)
+ crew_spot_lines = list(
+ "Customs! Stay where you are!",
+ "There. Detain them.",
+ "Contact. Compliance action authorised.",
+ )
+ // A customs vessel is no prize: the crew drop nothing
+ random_loot = null
+ random_loot_2 = null
+
+// Corporate staff, not natives of any planet
+/mob/living/carbon/human/npc/faction_pirate/nt_customs/should_inherit_planetary_faction()
+ return FALSE
+
+// The corpse look's own CentCom ID (tg's trooper corpses) already names its rank; keep it and put the
+// NPC's own name on it, so a masked officer isn't "Unknown".
+/mob/living/carbon/human/npc/faction_pirate/nt_customs/crew_issue_id()
+ var/obj/item/card/id/card = wear_id
+ if(!istype(card))
+ return ..()
+ card.registered_name = real_name
+ card.update_label()
+
+/// Customs guard: a stun baton and cuffs' worth of authority
+/mob/living/carbon/human/npc/faction_pirate/nt_customs/officer
+ npc_name = "Nanotrasen Customs Officer"
+ crew_desc = "A Nanotrasen customs officer, here to search your ship. The baton is standard issue."
+ crew_role = SHIP_CREW_ROLE_MELEE
+
+/// Customs inspector: an M1911, or a WT-550 in the red zone
+/mob/living/carbon/human/npc/faction_pirate/nt_customs/inspector
+ npc_name = "Nanotrasen Customs Inspector"
+ crew_desc = "A Nanotrasen customs inspector. Authorised to conduct searches, seizures, and suppressive fire."
+ crew_role = SHIP_CREW_ROLE_GUNNER
+
+/// Customs sergeant: the corvette's captain, who carries its key
+/mob/living/carbon/human/npc/faction_pirate/nt_customs/sergeant
+ npc_name = "Nanotrasen Customs Sergeant"
+ crew_desc = "The ranking customs officer aboard. Personally responsible for this quarter's seizure figures."
+ npc_look = /obj/effect/mob_spawn/corpse/human/nanotrasenassaultsoldier
+ npc_rank = HUMAN_NPC_RANK_ELITE
+
+/// The Compliance Director: the boss the corvette sends last. Killing or taking him disables it.
+/mob/living/carbon/human/npc/faction_pirate/nt_customs/director
+ npc_name = "NT Compliance Director"
+ crew_desc = "A senior Nanotrasen compliance executive in body armour, sent out when the paperwork stops working."
+ npc_look = /obj/effect/mob_spawn/corpse/human/nanotrasenelitesoldier
+ npc_rank = HUMAN_NPC_RANK_BOSS
+ npc_always_site = HUMAN_NPC_SITE_BAD_AIR
+ stimulant_type = /obj/item/reagent_containers/hypospray/medipen/stimulants
+ loot_pool = list(/obj/item/gun/energy/e_gun, /obj/item/melee/baton/security/loaded)
+ npc_death_cash = 2000
+
+// ===== Outfits: tg's trooper corpse outfits, with the real weapons the basic mobs fired =====
+
+/// Rank and file by role and zone; the sergeant and the Director wear their own.
+/datum/human_npc_outfit_table/pirate/nt_customs
+ vacuum_layer = /datum/human_npc_layer/eva/nt_customs
+ melee = list(/datum/outfit/nanotrasensoldiercorpse/nt_customs_officer = 1)
+ gunners = list(/datum/outfit/nanotrasensoldiercorpse/nt_customs_inspector = 1)
+ elite = list(/datum/outfit/nanotrasenassaultsoldiercorpse/nt_customs_sergeant = 1)
+ boss = list(/datum/outfit/nt_customs_director = 1)
+ /// In the red zone the gunners and the sergeant carry the guns the basic mobs fired there
+ var/list/red_gunners = list(/datum/outfit/nanotrasensoldiercorpse/nt_customs_inspector/smg = 1)
+ var/list/red_elite = list(/datum/outfit/nanotrasenassaultsoldiercorpse/nt_customs_sergeant/rifle = 1)
+
+/datum/human_npc_outfit_table/pirate/nt_customs/outfits_for(mob/living/carbon/human/npc/npc, zone)
+ if(zone == ZONE_RED)
+ var/mob/living/carbon/human/npc/faction_pirate/crewman = npc
+ if(npc?.npc_rank == HUMAN_NPC_RANK_ELITE)
+ return red_elite
+ if(istype(crewman) && crewman.npc_rank == HUMAN_NPC_RANK_REGULAR && crewman.crew_role == SHIP_CREW_ROLE_GUNNER)
+ return red_gunners
+ return ..()
+
+// Boarders cross space: a sealed suit and air
+/datum/human_npc_outfit_table/pirate/nt_customs/boarding
+ always_site = HUMAN_NPC_SITE_VACUUM
+
+/datum/human_npc_layer/eva/nt_customs
+ suit = /obj/item/clothing/suit/space/syndicate/black/blue
+ head = /obj/item/clothing/head/helmet/space/syndicate/black/blue
+
+/datum/outfit/nanotrasensoldiercorpse/nt_customs_officer
+ name = "Human NPC: NT Customs Officer"
+ r_hand = /obj/item/melee/baton/security/loaded
+ l_pocket = /obj/item/crowbar
+
+/datum/outfit/nanotrasensoldiercorpse/nt_customs_inspector
+ name = "Human NPC: NT Customs Inspector"
+ r_hand = /obj/item/gun/ballistic/automatic/pistol/m1911
+ l_pocket = /obj/item/ammo_box/magazine/m45
+ r_pocket = /obj/item/ammo_box/magazine/m45
+
+/datum/outfit/nanotrasensoldiercorpse/nt_customs_inspector/smg
+ name = "Human NPC: NT Customs Inspector (WT-550)"
+ r_hand = /obj/item/gun/ballistic/automatic/wt550
+ l_pocket = /obj/item/ammo_box/magazine/wt550m9
+ r_pocket = /obj/item/ammo_box/magazine/wt550m9
+
+/datum/outfit/nanotrasenassaultsoldiercorpse/nt_customs_sergeant
+ name = "Human NPC: NT Customs Sergeant"
+ r_hand = /obj/item/gun/ballistic/automatic/pistol/m1911
+ l_pocket = /obj/item/ammo_box/magazine/m45
+ r_pocket = /obj/item/ammo_box/magazine/m45
+
+/datum/outfit/nanotrasenassaultsoldiercorpse/nt_customs_sergeant/rifle
+ name = "Human NPC: NT Customs Sergeant (rifle)"
+ r_hand = /obj/item/gun/ballistic/automatic/ar
+ l_pocket = /obj/item/ammo_box/magazine/m223
+ r_pocket = /obj/item/ammo_box/magazine/m223
+
+/// The Director: tg's elite trooper in body armour instead of the modsuit, a lethal e-gun and a baton
+/datum/outfit/nt_customs_director
+ name = "Human NPC: NT Compliance Director"
+ uniform = /obj/item/clothing/under/rank/centcom/military
+ suit = /obj/item/clothing/suit/armor/bulletproof
+ shoes = /obj/item/clothing/shoes/combat
+ gloves = /obj/item/clothing/gloves/combat
+ mask = /obj/item/clothing/mask/gas/sechailer/swat
+ head = /obj/item/clothing/head/helmet/swat/nanotrasen
+ back = /obj/item/storage/backpack/security
+ belt = /obj/item/melee/baton/security/loaded
+ id = /obj/item/card/id/advanced/centcom
+ id_trim = /datum/id_trim/centcom/ert/security
+ r_hand = /obj/item/gun/energy/e_gun/lethal
+ l_pocket = /obj/item/knife/combat/survival
// ==================== NEGOTIATION DIALOG ====================
diff --git a/voidcrew/modules/npc_ships/code/mob_patrol.dm b/voidcrew/modules/npc_ships/code/mob_patrol.dm
index 6865b6ce6ad..058ed5851a3 100644
--- a/voidcrew/modules/npc_ships/code/mob_patrol.dm
+++ b/voidcrew/modules/npc_ships/code/mob_patrol.dm
@@ -1431,7 +1431,7 @@
PATROL_LOG("[pawn] not adjacent to assembly [assembly.name] (dist=[assembly_dist]), cannot attack")
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED
- pawn.melee_attack(assembly)
+ patrol_melee_attack(controller, assembly)
PATROL_LOG("[pawn] smashing door assembly [assembly.name]")
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED
@@ -1464,7 +1464,7 @@
PATROL_LOG("[pawn] not adjacent to obstacle [obstacle.name], cannot attack")
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED
- pawn.melee_attack(obstacle)
+ patrol_melee_attack(controller, obstacle)
PATROL_LOG("[pawn] smashing blocking obstacle [obstacle.name]")
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED
@@ -1504,7 +1504,7 @@
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED // Keep running until adjacent
// Adjacent - attack it
- pawn.melee_attack(assembly)
+ patrol_melee_attack(controller, assembly)
PATROL_LOG("[pawn] smashing patrol target assembly [assembly.name]")
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED
@@ -1610,7 +1610,7 @@
// Always use melee attack for door breaking (like blobbernauts/standard troopers)
// This is more reliable than ranged attacks and saves ammo for combat
- pawn.melee_attack(door)
+ patrol_melee_attack(controller, door)
PATROL_LOG("[pawn] smashing blocking door [door.name]")
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED
@@ -1789,7 +1789,7 @@
// Always use melee attack for door breaking (like blobbernauts/standard troopers)
// This is more reliable than ranged attacks and saves ammo for combat
- pawn.melee_attack(door)
+ patrol_melee_attack(controller, door)
PATROL_LOG("[pawn] smashing door [door.name]")
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED
@@ -1931,7 +1931,7 @@
// If locked or welded, attack it to break it open
if(closet.locked || closet.welded)
- pawn.melee_attack(closet)
+ patrol_melee_attack(controller, closet)
PATROL_LOG("[pawn] attacking locked/welded closet [closet.name]")
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED // Keep attacking until it opens
@@ -1946,7 +1946,11 @@
// Scan for crew hiding inside - they'll be on/near the closet's turf now
var/turf/closet_turf = get_turf(closet)
if(closet_turf)
+ var/datum/targeting_strategy/targeting = GET_TARGETING_STRATEGY(controller.blackboard[BB_TARGETING_STRATEGY])
for(var/mob/living/carbon/hiding_crew in range(1, closet_turf))
+ // Not the patroller itself, a person breaking out of an outpost prison, or anyone it won't fight
+ if(hiding_crew == pawn || (targeting && !targeting.can_attack(pawn, hiding_crew)))
+ continue
if(hiding_crew.stat != DEAD)
// Found a live crew member! Target them immediately
controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, hiding_crew)
@@ -2136,3 +2140,14 @@
/datum/ai_planning_subtree/try_open_door_in_path,
/datum/ai_planning_subtree/attack_patrol_door,
)
+
+/**
+ * One blow from a patroller at `target`: a basic mob's own melee attack, or, for a person on a patrol (a
+ * prisoner breaking out of an outpost prison is a real human body), a click with combat mode on through
+ * their own hands.
+ */
+/proc/patrol_melee_attack(datum/ai_controller/controller, atom/target)
+ var/mob/living/basic/basic_pawn = controller?.pawn
+ if(isbasicmob(basic_pawn))
+ return basic_pawn.melee_attack(target)
+ return controller?.ai_interact(target = target, combat_mode = TRUE)
diff --git a/voidcrew/modules/npc_ships/code/npc_ship.dm b/voidcrew/modules/npc_ships/code/npc_ship.dm
index b639e0a06a5..0be9b40ff7c 100644
--- a/voidcrew/modules/npc_ships/code/npc_ship.dm
+++ b/voidcrew/modules/npc_ships/code/npc_ship.dm
@@ -147,6 +147,11 @@
/// treat an empty roster as a crew wipe unless this is set - otherwise a hull whose
/// crew spawn silently failed would resolve at birth and churn the pool in a loop.
var/crew_ever_spawned = FALSE
+ /// Human NPC crew still waiting in the spawn queue (spawn_human_npc()); the hull's roster isn't
+ /// complete, and can't be wiped, until they are built
+ var/list/datum/human_npc_order/crew_orders = list()
+ /// Set once the crew wipe has been handled, so a second path to it does nothing
+ var/crew_wipe_handled = FALSE
// ========== MASS CACHING (Performance optimization) ==========
// Instead of iterating all turfs every second, we cache mass and only
@@ -239,8 +244,9 @@
if(abandonment_timer)
deltimer(abandonment_timer)
abandonment_timer = null
- // Clear crew tracking
+ // Clear crew tracking; crew still in the spawn queue are never built
tracked_crew.Cut()
+ QDEL_LIST(crew_orders)
return ..()
/**
@@ -375,16 +381,13 @@
if(captain_type && length(valid_turfs))
var/turf/captain_loc = pick_n_take(valid_turfs)
var/datum/npc_spawn_context/context = new(src, pool_zone_type, "boss")
- var/mob/living/basic/captain = spawn_npc_in_zone(captain_type, captain_loc, context, FALSE)
- // Give captain the ship key - stored in contents, drops on death
- var/obj/item/ship_key/key = new(null, src)
- key.forceMove(captain)
- context.finalize()
- // Track captain and register death signal
- tracked_crew += captain
- RegisterSignal(captain, COMSIG_LIVING_DEATH, PROC_REF(on_crew_death))
- // The captain holds the helm with one guard (pirate_crew.dm)
- pirate_crew_enlist_defender(captain, src, PIRATE_ROLE_CAPTAIN)
+ if(ispath(captain_type, /mob/living/carbon/human/npc))
+ // Human NPCs are built a body at a time (spawn_human_npc()); the captain joins when built
+ crew_orders += spawn_human_npc(captain_type, captain_loc, CALLBACK(src, PROC_REF(on_captain_built)), context = context)
+ else
+ var/mob/living/basic/captain = spawn_npc_in_zone(captain_type, captain_loc, context, FALSE)
+ context.finalize()
+ on_captain_built(captain)
crew_count-- // Captain counts toward crew count
// Spawn rest of crew from configured types
@@ -392,15 +395,53 @@
var/turf/spawn_loc = pick_n_take(valid_turfs)
var/mob_type = pick(crew_types)
var/datum/npc_spawn_context/context = new(src, pool_zone_type, "ordinary")
- var/mob/living/crewmember = spawn_npc_in_zone(mob_type, spawn_loc, context)
- // Track crew and register death signal
- tracked_crew += crewmember
- RegisterSignal(crewmember, COMSIG_LIVING_DEATH, PROC_REF(on_crew_death))
- pirate_crew_enlist_defender(crewmember, src)
+ if(ispath(mob_type, /mob/living/carbon/human/npc))
+ crew_orders += spawn_human_npc(mob_type, spawn_loc, CALLBACK(src, PROC_REF(on_crewman_built)), context = context)
+ else
+ on_crewman_built(spawn_npc_in_zone(mob_type, spawn_loc, context))
+
+/// The captain is built: it carries the ship key and holds the helm with one guard (pirate_crew.dm).
+/obj/structure/overmap/ship/npc/proc/on_captain_built(mob/living/captain)
+ if(QDELETED(captain))
+ return
+ // The key is not gear: a human captain keeps it in a pocket, where a crew that cuffs or downs him can
+ // take it (the strip menu), and it drops when he dies (on_crew_death())
+ var/obj/item/ship_key/key = new(null, src)
+ var/mob/living/carbon/human/npc/faction_pirate/human_captain = captain
+ if(!istype(human_captain) || !human_captain.crew_pocket(key))
+ key.forceMove(captain)
+ track_crewman(captain, PIRATE_ROLE_CAPTAIN)
+/// A crewman is built: tracked for the crew wipe and enlisted in the hull's crew.
+/obj/structure/overmap/ship/npc/proc/on_crewman_built(mob/living/crewmember)
+ if(QDELETED(crewmember))
+ return
+ track_crewman(crewmember, PIRATE_ROLE_HUNTER)
+
+/obj/structure/overmap/ship/npc/proc/track_crewman(mob/living/crewmember, role)
+ prune_crew_orders()
+ if(QDELETED(src))
+ qdel(crewmember)
+ return
+ tracked_crew += crewmember
+ RegisterSignal(crewmember, COMSIG_LIVING_DEATH, PROC_REF(on_crew_death))
+ // Out of the fight counts as gone for the crew wipe too (owner ruling OC-7): down or cuffed
+ if(ishumannpc(crewmember))
+ RegisterSignals(crewmember, list(COMSIG_HUMAN_NPC_DOWNED, SIGNAL_ADDTRAIT(TRAIT_RESTRAINED)), PROC_REF(on_crew_out_of_fight))
+ pirate_crew_enlist_defender(crewmember, src, role)
// A roster exists; the pool may now treat this roster emptying as a crew wipe
- if(length(tracked_crew))
- crew_ever_spawned = TRUE
+ crew_ever_spawned = TRUE
+
+/// Drops crew orders that have been built or cancelled.
+/obj/structure/overmap/ship/npc/proc/prune_crew_orders()
+ for(var/datum/human_npc_order/order as anything in crew_orders.Copy())
+ if(QDELETED(order) || order.done)
+ crew_orders -= order
+
+/// Whether crew are still waiting to be built.
+/obj/structure/overmap/ship/npc/proc/crew_pending()
+ prune_crew_orders()
+ return length(crew_orders) > 0
/**
* Signal handler for when any crew member dies.
@@ -408,27 +449,45 @@
*/
/obj/structure/overmap/ship/npc/proc/on_crew_death(mob/living/victim, gibbed)
SIGNAL_HANDLER
- UnregisterSignal(victim, COMSIG_LIVING_DEATH)
+ UnregisterSignal(victim, list(COMSIG_LIVING_DEATH, COMSIG_HUMAN_NPC_DOWNED, SIGNAL_ADDTRAIT(TRAIT_RESTRAINED)))
- // Drop ship key if the victim has one (captain)
+ // Drop ship key if the victim has one (captain). A human captain's drops from his pocket with
+ // whatever else he carries that isn't gear (human_npc_gear.dm); this catches one held loose.
var/turf/drop_loc = get_turf(victim)
if(drop_loc)
for(var/obj/item/ship_key/key in victim.contents)
- key.forceMove(drop_loc)
+ if(!victim.get_slot_by_item(key))
+ key.forceMove(drop_loc)
// Remove from tracked crew list
tracked_crew -= victim
log_shuttle("NPC_SHIP: [name] crew member [victim] died ([length(tracked_crew)] tracked crew remain)")
+ check_crew_wipe()
+
+/// A human crewman went into crit or was cuffed: if nobody aboard is left fighting, the crew is wiped.
+/obj/structure/overmap/ship/npc/proc/on_crew_out_of_fight(mob/living/source)
+ SIGNAL_HANDLER
+ check_crew_wipe()
- // Check if all crew are dead
- if(!length(tracked_crew))
- npc_metric_crew_wiped(src)
- // The pool slot frees the instant the crew is wiped. The abandonment timer below
- // is a separate concern - it holds the hull claimable for a while - and must not
- // delay the replacement spawn.
- if(!player_controlled)
- notify_spawner_resolved("crew wiped")
- start_abandonment_timer()
+/**
+ * The crew is wiped once every tracked crewman is dead, or out of the fight (in crit or cuffed, owner
+ * ruling OC-7: a crew the players took down or captured is beaten, and a body frozen in crit on a hull
+ * nobody is near must not hold the pool slot). Crew still waiting to be built keep it from wiping.
+ */
+/obj/structure/overmap/ship/npc/proc/check_crew_wipe()
+ if(crew_wipe_handled || crew_pending())
+ return
+ for(var/mob/living/crewmember as anything in tracked_crew)
+ if(!human_npc_out_of_fight(crewmember))
+ return
+ crew_wipe_handled = TRUE
+ npc_metric_crew_wiped(src)
+ // The pool slot frees the instant the crew is wiped. The abandonment timer below
+ // is a separate concern - it holds the hull claimable for a while - and must not
+ // delay the replacement spawn.
+ if(!player_controlled)
+ notify_spawner_resolved("crew wiped")
+ start_abandonment_timer()
/**
* Starts a timer to abandon the ship after all crew die.
@@ -522,21 +581,20 @@
return despawn_derelict()
/**
- * How many of this hull's own tracked crew are alive and actually aboard.
+ * How many of this hull's own tracked crew are still fighting and actually aboard.
*
* Derived from live state rather than roster bookkeeping on purpose: a missed death
* signal, a hard-deleted mob, or a pirate spaced or dragged off the hull must all read
- * as "not aboard", or the pool slot this crew holds never frees. The roster is 2-6
- * entries, so this is cheap enough for the reconcile's slow tick.
+ * as "not aboard", or the pool slot this crew holds never frees. A crewman in crit or
+ * cuffed is out of the fight and doesn't count either (owner ruling OC-7). The roster is
+ * 2-6 entries, so this is cheap enough for the reconcile's slow tick.
*/
/obj/structure/overmap/ship/npc/proc/count_live_crew_aboard()
if(!shuttle?.shuttle_areas)
return 0
var/count = 0
for(var/mob/living/crew as anything in tracked_crew)
- if(QDELETED(crew))
- continue
- if(crew.stat == DEAD)
+ if(human_npc_out_of_fight(crew))
continue
var/area/crew_area = get_area(crew)
if(!crew_area || !shuttle.shuttle_areas[crew_area])
@@ -544,25 +602,6 @@
count++
return count
-/**
- * Kills tracked crew that ended up floating in open space (hull breach blowout).
- * The same cleanup boarding waves already get via check_boarders_in_space(); without it
- * a spaced pirate drifts alive forever. Run from the pool reconcile.
- */
-/obj/structure/overmap/ship/npc/proc/sweep_spaced_crew()
- var/list/spaced = list()
- for(var/mob/living/crew as anything in tracked_crew)
- if(QDELETED(crew) || crew.stat == DEAD)
- continue
- var/turf/crew_turf = get_turf(crew)
- if(!crew_turf)
- continue
- if(isspaceturf(crew_turf) || istype(get_area(crew_turf), /area/space))
- spaced += crew
- // death() fires on_crew_death, which edits tracked_crew - never kill mid-iteration
- for(var/mob/living/lost as anything in spaced)
- lost.death()
-
/**
* Signal handler for ship integrity changes.
* Updates boarding state when ship is damaged enough.
@@ -916,10 +955,10 @@
// Crew configuration
crew_min = 3
crew_max = 6
- captain_type = /mob/living/basic/trooper/pirate/ranged/space
+ captain_type = /mob/living/carbon/human/npc/ruin/trooper/pirate/space/gunner
crew_types = list(
- /mob/living/basic/trooper/pirate/melee/space,
- /mob/living/basic/trooper/pirate/ranged/space,
+ /mob/living/carbon/human/npc/ruin/trooper/pirate/space,
+ /mob/living/carbon/human/npc/ruin/trooper/pirate/space/gunner,
)
// Faction
diff --git a/voidcrew/modules/npc_ships/code/npc_ship_controller.dm b/voidcrew/modules/npc_ships/code/npc_ship_controller.dm
index bb5a1744aab..f26d546ccf8 100644
--- a/voidcrew/modules/npc_ships/code/npc_ship_controller.dm
+++ b/voidcrew/modules/npc_ships/code/npc_ship_controller.dm
@@ -32,6 +32,10 @@
var/boarding_committed = 0
var/boarding_pending = 0
var/boarding_boss_sent = FALSE
+ /// Human boarders (and a human boss) of this encounter still waiting in the spawn queue
+ var/list/datum/human_npc_order/boarding_orders = list()
+ /// Of those, the ones the scripted wave sent: the wave isn't over while any of them is still coming
+ var/list/datum/human_npc_order/wave_orders = list()
/datum/ai_controller/npc_ship/New(atom/new_pawn)
// Initialize combat blackboard
@@ -101,6 +105,7 @@
/// Override to avoid ai_movement access in parent Destroy
/datum/ai_controller/npc_ship/Destroy(force)
cleanup_boarding_signals()
+ cancel_boarding_orders()
UnpossessPawn(FALSE)
if(ai_status)
GLOB.ai_controllers_by_status[ai_status] -= src
@@ -439,6 +444,8 @@
// half-elapsed wipe timer over onto whoever we point at next.
if(old_target != target)
cleanup_boarding_signals()
+ // Boarders not yet built for the old target are never sent
+ cancel_boarding_orders()
boarding_context = null
boarding_budget = 0
boarding_committed = 0
@@ -835,27 +842,26 @@
GLOB.boarding_spawn_index = 0
GLOB.boarding_spawn_total = boarder_count
- // Spawn the boarders via drop pods
+ // Spawn the boarders via drop pods. Human boarders are built through the spawn queue first, so they
+ // join the wave (track_wave_boarder()) as each one goes in its pod.
var/list/wave_boarders = list()
+ blackboard[BB_NPC_BOARDING_WAVE_BOARDERS] = wave_boarders
+ wave_orders.Cut()
+ var/launched = 0
for(var/i in 1 to boarder_count)
if(!length(valid_turfs))
break
var/turf/spawn_loc = pick(valid_turfs)
var/mob_type = pick(mob_types)
- // Create boarding pod with the mob inside - returns the boarder for tracking
- var/mob/living/boarder = create_boarding_pod(spawn_loc, target, ship, mob_type)
-
- if(boarder)
- // Track this boarder and register death signal
- wave_boarders += boarder
- RegisterSignal(boarder, COMSIG_LIVING_DEATH, PROC_REF(on_boarder_death))
+ var/sent = create_boarding_pod(spawn_loc, target, ship, mob_type, on_boarder = CALLBACK(src, PROC_REF(track_wave_boarder), wave_boarders))
+ if(istype(sent, /datum/human_npc_order))
+ wave_orders += sent
+ if(sent)
+ launched++
// Note: Patrol setup is handled by the boarding pod's open_pod() proc
- log_shuttle("PATROL: Wave [wave_number] launched [length(wave_boarders)] boarders via drop pods")
-
- // Store the wave boarders for tracking
- blackboard[BB_NPC_BOARDING_WAVE_BOARDERS] = wave_boarders
+ log_shuttle("PATROL: Wave [wave_number] launched [launched] boarders via drop pods")
// Track wave start time and target position (for time limit and movement detection)
set_blackboard_key(BB_NPC_BOARDING_WAVE_START_TIME, world.time)
@@ -865,10 +871,43 @@
// Notify target ship
target.ship_notify("Hostiles have boarded!", "SECURITY", SHIP_NOTIFY_DANGER, 'voidcrew/sound/warn3.ogg', 25)
- npc_metric_boarding_wave(src, wave_number, length(wave_boarders))
+ npc_metric_boarding_wave(src, wave_number, launched)
return TRUE
+/// A wave boarder is in its pod: it counts toward `wave` (the list it was sent with) until it is out of
+/// the fight. Dead, in crit or cuffed is out (owner ruling OC-7).
+/datum/ai_controller/npc_ship/proc/track_wave_boarder(list/wave, mob/living/boarder)
+ prune_boarding_orders()
+ if(QDELETED(boarder) || wave != blackboard[BB_NPC_BOARDING_WAVE_BOARDERS])
+ return
+ wave += boarder
+ RegisterSignal(boarder, COMSIG_LIVING_DEATH, PROC_REF(on_boarder_death))
+ if(ishumannpc(boarder))
+ RegisterSignals(boarder, list(COMSIG_HUMAN_NPC_DOWNED, SIGNAL_ADDTRAIT(TRAIT_RESTRAINED)), PROC_REF(on_boarder_out_of_fight))
+
+/// Remembers a human boarder still waiting to be built, so the encounter can call it off.
+/datum/ai_controller/npc_ship/proc/track_boarding_order(datum/human_npc_order/order)
+ if(!QDELETED(order) && !order.done)
+ boarding_orders += order
+
+/// Drops orders that have been built or cancelled.
+/datum/ai_controller/npc_ship/proc/prune_boarding_orders()
+ for(var/datum/human_npc_order/order as anything in boarding_orders.Copy())
+ if(QDELETED(order) || order.done)
+ boarding_orders -= order
+ for(var/datum/human_npc_order/order as anything in wave_orders.Copy())
+ if(QDELETED(order) || order.done)
+ wave_orders -= order
+
+/// Calls off every boarder of this encounter that hasn't been built yet.
+/datum/ai_controller/npc_ship/proc/cancel_boarding_orders()
+ for(var/datum/human_npc_order/order as anything in boarding_orders)
+ if(!QDELETED(order))
+ qdel(order)
+ boarding_orders.Cut()
+ wave_orders.Cut()
+
/**
* Find valid turfs on the target ship for spawning boarders.
*/
@@ -904,7 +943,7 @@
*/
/datum/ai_controller/npc_ship/proc/on_boarder_death(mob/living/victim, gibbed)
SIGNAL_HANDLER
- UnregisterSignal(victim, COMSIG_LIVING_DEATH)
+ UnregisterSignal(victim, list(COMSIG_LIVING_DEATH, COMSIG_HUMAN_NPC_DOWNED, SIGNAL_ADDTRAIT(TRAIT_RESTRAINED)))
var/list/wave_boarders = blackboard[BB_NPC_BOARDING_WAVE_BOARDERS]
if(wave_boarders)
@@ -913,8 +952,14 @@
// Check if all boarders are dead
INVOKE_ASYNC(src, PROC_REF(check_wave_complete))
+/// A human boarder went into crit or was cuffed: out of the fight, so the wave may be over.
+/datum/ai_controller/npc_ship/proc/on_boarder_out_of_fight(mob/living/source)
+ SIGNAL_HANDLER
+ INVOKE_ASYNC(src, PROC_REF(check_wave_complete))
+
/**
- * Check if the current wave is complete (all boarders dead).
+ * Check if the current wave is complete: every boarder is out of the fight (dead, in crit or cuffed,
+ * owner ruling OC-7) and none is still waiting to be built.
*/
/datum/ai_controller/npc_ship/proc/check_wave_complete()
// Guard against multiple calls - only process if we're in BOARDING state
@@ -922,12 +967,16 @@
if(combat_state != NPC_COMBAT_BOARDING || !validate_boarding_target())
return
+ prune_boarding_orders()
+ if(length(wave_orders))
+ return // Boarders still on their way
+
var/list/wave_boarders = blackboard[BB_NPC_BOARDING_WAVE_BOARDERS]
- // Count living boarders
+ // Count boarders still fighting
var/living_count = 0
for(var/mob/living/boarder as anything in wave_boarders)
- if(!QDELETED(boarder) && boarder.stat != DEAD)
+ if(!human_npc_out_of_fight(boarder))
living_count++
if(living_count > 0)
@@ -981,7 +1030,7 @@
// Notify about cooldown
var/next_wave = completed_wave + 1
- target.ship_notify("Wave [completed_wave] repelled! Next wave in 30 seconds...", "COMBAT", SHIP_NOTIFY_NOTICE, 'voidcrew/sound/notify.ogg', 50)
+ target.ship_notify("Boarders repelled!", "COMBAT", SHIP_NOTIFY_NOTICE, 'voidcrew/sound/notify.ogg', 50)
// Schedule next wave
boarding_timers += addtimer(CALLBACK(src, PROC_REF(end_wave_cooldown), next_wave), NPC_BOARDING_WAVE_COOLDOWN, TIMER_STOPPABLE)
@@ -1071,24 +1120,32 @@
if(!boss_type)
return
- // Create boss boarding pod - returns the boss for tracking
- // Pod handles parent_ship, AI controller swap, and patrol assignment
- var/mob/living/basic/trooper/pirate/faction/boss/boss = create_boss_boarding_pod(spawn_loc, target, ship, boss_type)
- if(boss)
- set_blackboard_key(BB_NPC_BOARDING_BOSS, boss)
- RegisterSignal(boss, COMSIG_LIVING_DEATH, PROC_REF(on_boss_death))
- npc_metric_boss_deployed(src, boss)
+ // Create boss boarding pod. The pod gives the boss its parent_ship; track_boss() follows it from
+ // the moment it is in its pod (a human boss is built through the spawn queue first).
+ create_boss_boarding_pod(spawn_loc, target, ship, boss_type, CALLBACK(src, PROC_REF(track_boss)))
// Announce boss arrival
target.ship_notify("WARNING: Enemy Commander incoming via drop pod!", "SECURITY", SHIP_NOTIFY_DANGER, 'voidcrew/sound/warn3.ogg', 25)
+/// The boss is in its pod: watched until it is out of the fight.
+/datum/ai_controller/npc_ship/proc/track_boss(mob/living/boss)
+ prune_boarding_orders()
+ if(QDELETED(boss))
+ return
+ set_blackboard_key(BB_NPC_BOARDING_BOSS, boss)
+ RegisterSignal(boss, COMSIG_LIVING_DEATH, PROC_REF(on_boss_death))
+ // A human boss in crit or cuffed is beaten as surely as a dead one (owner ruling OC-7)
+ if(ishumannpc(boss))
+ RegisterSignals(boss, list(COMSIG_HUMAN_NPC_DOWNED, SIGNAL_ADDTRAIT(TRAIT_RESTRAINED)), PROC_REF(on_boss_death))
+ npc_metric_boss_deployed(src, boss)
+
/**
- * Signal handler for when the boss is killed.
+ * Signal handler for when the boss is killed, or a human boss is downed or cuffed.
* This disables the pirate ship and allows players to board it.
*/
/datum/ai_controller/npc_ship/proc/on_boss_death(mob/living/victim, gibbed)
SIGNAL_HANDLER
- UnregisterSignal(victim, COMSIG_LIVING_DEATH)
+ UnregisterSignal(victim, list(COMSIG_LIVING_DEATH, COMSIG_HUMAN_NPC_DOWNED, SIGNAL_ADDTRAIT(TRAIT_RESTRAINED)))
INVOKE_ASYNC(src, PROC_REF(handle_boss_killed))
@@ -1333,6 +1390,8 @@
boarding_timers.Cut()
boarding_committed -= boarding_pending
boarding_pending = 0
+ // Boarders still being built land as part of the raid, outside any wave
+ wave_orders.Cut()
// Unregister from player crew deaths
var/list/tracked_crew = blackboard[BB_NPC_BOARDING_PLAYER_CREW]
@@ -1345,11 +1404,11 @@
var/list/wave_boarders = blackboard[BB_NPC_BOARDING_WAVE_BOARDERS]
for(var/mob/living/boarder as anything in wave_boarders)
if(!QDELETED(boarder))
- UnregisterSignal(boarder, COMSIG_LIVING_DEATH)
+ UnregisterSignal(boarder, list(COMSIG_LIVING_DEATH, COMSIG_HUMAN_NPC_DOWNED, SIGNAL_ADDTRAIT(TRAIT_RESTRAINED)))
var/mob/living/boss = blackboard[BB_NPC_BOARDING_BOSS]
if(!QDELETED(boss))
- UnregisterSignal(boss, COMSIG_LIVING_DEATH)
+ UnregisterSignal(boss, list(COMSIG_LIVING_DEATH, COMSIG_HUMAN_NPC_DOWNED, SIGNAL_ADDTRAIT(TRAIT_RESTRAINED)))
// Clear boarding blackboard keys
clear_blackboard_key(BB_NPC_BOARDING_WAVE)
@@ -1397,13 +1456,14 @@
return
npc_metric_wave_ended(src, current_wave, "timed_out")
- // Clean up current wave boarders
+ // Clean up current wave boarders; any still on their way land as part of the raid, outside the wave
var/list/wave_boarders = blackboard[BB_NPC_BOARDING_WAVE_BOARDERS]
if(wave_boarders)
for(var/mob/living/boarder as anything in wave_boarders)
if(!QDELETED(boarder))
- UnregisterSignal(boarder, COMSIG_LIVING_DEATH)
+ UnregisterSignal(boarder, list(COMSIG_LIVING_DEATH, COMSIG_HUMAN_NPC_DOWNED, SIGNAL_ADDTRAIT(TRAIT_RESTRAINED)))
clear_blackboard_key(BB_NPC_BOARDING_WAVE_BOARDERS)
+ wave_orders.Cut()
if(is_red_zone_raid())
start_boss_cooldown()
@@ -1411,8 +1471,9 @@
end_yellow_raid()
/**
- * Check if any boarders have fallen into space and clean them up.
- * This prevents boarders from being "stuck" floating in space after being spaced.
+ * Boarders that have fallen into space are off the ship and out of this wave. Nothing kills them: space
+ * does that to an unsuited body, and a suited one drifts until its crew gives it up (pirate_crew.dm,
+ * check_adrift()). A wave whose last boarders were spaced is over.
*/
/datum/ai_controller/npc_ship/proc/check_boarders_in_space()
var/list/wave_boarders = blackboard[BB_NPC_BOARDING_WAVE_BOARDERS]
@@ -1421,21 +1482,17 @@
var/list/spaced_boarders = list()
for(var/mob/living/boarder as anything in wave_boarders)
- if(QDELETED(boarder))
+ if(QDELETED(boarder) || boarder.stat == DEAD)
continue
- var/turf/boarder_turf = get_turf(boarder)
- if(!boarder_turf)
- continue
- // Check if boarder is in space (not on a ship)
- if(isspaceturf(boarder_turf) || istype(get_area(boarder_turf), /area/space))
+ if(pirate_crew_member_adrift(boarder))
spaced_boarders += boarder
- // Kill spaced boarders (they suffocate in space anyway)
+ if(!length(spaced_boarders))
+ return
for(var/mob/living/spaced as anything in spaced_boarders)
- if(!QDELETED(spaced) && spaced.stat != DEAD)
- spaced.death()
- wave_boarders -= spaced
- UnregisterSignal(spaced, COMSIG_LIVING_DEATH)
+ wave_boarders -= spaced
+ UnregisterSignal(spaced, list(COMSIG_LIVING_DEATH, COMSIG_HUMAN_NPC_DOWNED, SIGNAL_ADDTRAIT(TRAIT_RESTRAINED)))
+ check_wave_complete()
/// Snapshot the target band and connected crew exactly once, including combat-only raids.
/datum/ai_controller/npc_ship/proc/capture_boarding_encounter(obj/structure/overmap/ship/target)
@@ -1451,6 +1508,7 @@
return reserved
/// Timer callbacks must still belong to this encounter after docking or target changes.
+/// Returns the boarder, or the order of a human one still being built.
/datum/ai_controller/npc_ship/proc/deploy_combat_boarder(turf/spot, obj/structure/overmap/ship/target, mob_type, datum/npc_spawn_context/encounter)
if(get_target() != target || boarding_context != encounter)
return
@@ -1464,10 +1522,6 @@
var/list/spots = get_target_spawn_turfs(target)
if(!istype(ship) || !ship.boss_type || !length(spots))
return FALSE
- var/mob/living/boss = create_boss_boarding_pod(pick(spots), target, ship, ship.boss_type)
- if(!boss)
+ if(!create_boss_boarding_pod(pick(spots), target, ship, ship.boss_type, CALLBACK(src, PROC_REF(track_boss))))
return FALSE
- set_blackboard_key(BB_NPC_BOARDING_BOSS, boss)
- RegisterSignal(boss, COMSIG_LIVING_DEATH, PROC_REF(on_boss_death))
- npc_metric_boss_deployed(src, boss)
return TRUE
diff --git a/voidcrew/modules/npc_ships/code/outpost_patrol.dm b/voidcrew/modules/npc_ships/code/outpost_patrol.dm
index ad94f58fb8d..fe3ab37194a 100644
--- a/voidcrew/modules/npc_ships/code/outpost_patrol.dm
+++ b/voidcrew/modules/npc_ships/code/outpost_patrol.dm
@@ -163,7 +163,7 @@ GLOBAL_LIST_EMPTY(outpost_patrol_caches)
* was doing is cancelled first; the old controller and its blackboard are deleted. Returns the new
* controller, or null if it could not take the mob.
*/
-/proc/swap_basic_ai_controller(mob/living/basic/pawn, controller_type)
+/proc/swap_basic_ai_controller(mob/living/pawn, controller_type)
if(QDELETED(pawn) || !ispath(controller_type, /datum/ai_controller))
return null
var/datum/ai_controller/old_controller = pawn.ai_controller
@@ -185,7 +185,7 @@ GLOBAL_LIST_EMPTY(outpost_patrol_caches)
/// Whether a breakout controller leaves `target` alone: prisoners, and anyone else breaking out
/proc/is_outpost_breakout_ally(mob/living/target)
- if(istype(target, /mob/living/basic/outpost_prisoner))
+ if(istype(target, /mob/living/carbon/human/npc/outpost_prisoner))
return TRUE
return istype(target?.ai_controller, /datum/ai_controller/basic_controller/outpost_breakout)
@@ -571,16 +571,16 @@ GLOBAL_LIST_EMPTY(outpost_patrol_caches)
// ===== BREAKOUT AI =====
/**
- * Someone who broke out of an outpost prison. Walks the outpost's patrol path, opens or smashes the
- * doors on the way, searches lockers, and fights anyone who is not a prisoner with its own melee.
+ * Someone who broke out of an outpost prison. Walks the outpost's patrol path, opens the doors on the
+ * way that open for them, searches lockers, and fights anyone who is not a prisoner with their fists.
* Swapped onto a prisoner with swap_basic_ai_controller(), then given a path with
* assign_mob_to_outpost_patrol(). Without a path it wanders and still fights.
*/
/datum/ai_controller/basic_controller/outpost_breakout
blackboard = list(
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/outpost_breakout,
- // People are beaten down, not finished off
- BB_TARGET_MINIMUM_STAT = SOFT_CRIT,
+ // People are beaten down, not finished off: nobody in crit is hit (defaults 1.13)
+ BB_TARGET_MINIMUM_STAT = HUMAN_NPC_SPARES_DOWNED,
)
ai_movement = /datum/ai_movement/jps
idle_behavior = /datum/idle_behavior/idle_random_walk
@@ -664,19 +664,16 @@ GLOBAL_LIST_EMPTY(outpost_patrol_caches)
/datum/ai_behavior/attack_obstructions/trooper/include_mobs/outpost_breakout
-/datum/ai_behavior/attack_obstructions/trooper/include_mobs/outpost_breakout/attack_in_direction(datum/ai_controller/controller, mob/living/basic/basic_mob, direction)
- var/turf/next_step = get_step(basic_mob, direction)
+// A runner is a real human body (outpost_prison_prisoner.dm): it throws punches at whoever is in its way
+// through its own hands, and walks round what fists can't move.
+/datum/ai_behavior/attack_obstructions/trooper/include_mobs/outpost_breakout/attack_in_direction(datum/ai_controller/controller, mob/living/runner, direction)
+ var/turf/next_step = get_step(runner, direction)
if(!next_step?.is_blocked_turf(exclude_mobs = FALSE, source_atom = controller.pawn))
return FALSE
for(var/mob/living/blocking_mob in next_step)
- if(blocking_mob == basic_mob || is_outpost_breakout_ally(blocking_mob))
+ if(blocking_mob == runner || is_outpost_breakout_ally(blocking_mob))
continue
- basic_mob.melee_attack(blocking_mob)
- return TRUE
- for(var/obj/object as anything in next_step.contents)
- if(!can_smash_object(basic_mob, object))
- continue
- basic_mob.melee_attack(object)
+ controller.ai_interact(blocking_mob, combat_mode = TRUE)
return TRUE
return FALSE
diff --git a/voidcrew/modules/npc_ships/code/pirate_crew.dm b/voidcrew/modules/npc_ships/code/pirate_crew.dm
index 127b17cbc4b..37ce19f9618 100644
--- a/voidcrew/modules/npc_ships/code/pirate_crew.dm
+++ b/voidcrew/modules/npc_ships/code/pirate_crew.dm
@@ -8,8 +8,15 @@
*
* Once alerted, a crew knows where every hostile on its battlefield is, refreshed every few
* seconds, and sends its hunters after them. Players can dodge but can't hide. The captain
- * and one guard hold the helm until most of the crew is dead. The per-mob behaviour lives in
- * pirate_crew_ai.dm.
+ * and one guard hold the helm until most of the crew is out of the fight. The per-mob behaviour
+ * lives in pirate_crew_ai.dm, and for the human NPC crews every NPC ship now has, in
+ * pirate_crew_human.dm.
+ *
+ * A member counts as out of the fight once it is dead, in crit or cuffed (human_npc_out_of_fight(),
+ * owner ruling OC-7): it no longer hunts or holds the helm. A member adrift in space with no player
+ * near enough to see it is cleaned up after PIRATE_CREW_ADRIFT_TIME (check_adrift()): it can't get
+ * back aboard, and a body drifting alive forever would hold its crew open. That is bookkeeping, not a
+ * death: one drifting where a player can see it stays.
*/
/// Defending crews, by REF() of the NPC hull they crew
@@ -38,9 +45,14 @@ GLOBAL_LIST_INIT(pirate_crew_captain_lines, list(
"Fine. I'll do it myself.",
))
+/// Whether `recruit` is a body a pirate crew can take on: a basic mob, or a human NPC
+/// (voidcrew/modules/human_npcs/). Human members still need their own ranged and breach behaviours.
+/proc/pirate_crew_can_enlist(mob/living/recruit)
+ return isbasicmob(recruit) || ishumannpc(recruit)
+
/// Enlists `recruit` in the crew defending `hull`, making the crew if it has none yet
/proc/pirate_crew_enlist_defender(mob/living/recruit, obj/structure/overmap/ship/hull, role = PIRATE_ROLE_HUNTER)
- if(QDELETED(hull) || !isbasicmob(recruit) || QDELETED(recruit))
+ if(QDELETED(hull) || !pirate_crew_can_enlist(recruit) || QDELETED(recruit))
return FALSE
var/datum/pirate_crew/crew = pirate_crew_of(hull, FALSE)
if(!crew)
@@ -49,7 +61,7 @@ GLOBAL_LIST_INIT(pirate_crew_captain_lines, list(
/// Enlists `recruit` in the raid on `target`, making the raid if there is none yet
/proc/pirate_crew_enlist_raider(mob/living/recruit, obj/structure/overmap/ship/target)
- if(QDELETED(target) || !isbasicmob(recruit) || QDELETED(recruit))
+ if(QDELETED(target) || !pirate_crew_can_enlist(recruit) || QDELETED(recruit))
return FALSE
var/datum/pirate_crew/crew = pirate_crew_of(target, TRUE)
if(!crew)
@@ -64,8 +76,10 @@ GLOBAL_LIST_INIT(pirate_crew_captain_lines, list(
var/datum/pirate_crew/crew = registry[REF(ship)]
return QDELETED(crew) ? null : crew
-/// The controller a pirate gets when it joins a crew: ranged if it was a ranged trooper
-/proc/pirate_crew_controller_type(mob/living/basic/recruit)
+/// The controller a pirate gets when it joins a crew: the human one for a human NPC, else ranged if it was a ranged trooper
+/proc/pirate_crew_controller_type(mob/living/recruit)
+ if(ishumannpc(recruit))
+ return /datum/ai_controller/basic_controller/pirate_crew/human
var/datum/ai_controller/current = recruit?.ai_controller
if(istype(current, /datum/ai_controller/basic_controller/trooper/ranged) || istype(current, /datum/ai_controller/basic_controller/pirate_crew/ranged))
return /datum/ai_controller/basic_controller/pirate_crew/ranged
@@ -73,15 +87,23 @@ GLOBAL_LIST_INIT(pirate_crew_captain_lines, list(
/// What `speaker` says for a PIRATE_BARK_* moment. Faction pirates may carry their own lines.
/proc/pirate_crew_bark_lines(mob/living/speaker, kind)
+ var/list/alert_lines
+ var/list/spot_lines
var/mob/living/basic/trooper/pirate/faction/faction_pirate = speaker
+ var/mob/living/carbon/human/npc/faction_pirate/crewman = speaker
if(istype(faction_pirate))
- switch(kind)
- if(PIRATE_BARK_ALERT)
- if(length(faction_pirate.crew_alert_lines))
- return faction_pirate.crew_alert_lines
- if(PIRATE_BARK_SPOT)
- if(length(faction_pirate.crew_spot_lines))
- return faction_pirate.crew_spot_lines
+ alert_lines = faction_pirate.crew_alert_lines
+ spot_lines = faction_pirate.crew_spot_lines
+ else if(istype(crewman))
+ alert_lines = crewman.crew_alert_lines
+ spot_lines = crewman.crew_spot_lines
+ switch(kind)
+ if(PIRATE_BARK_ALERT)
+ if(length(alert_lines))
+ return alert_lines
+ if(PIRATE_BARK_SPOT)
+ if(length(spot_lines))
+ return spot_lines
switch(kind)
if(PIRATE_BARK_ALERT)
return GLOB.pirate_crew_alert_lines
@@ -148,6 +170,8 @@ GLOBAL_LIST_INIT(pirate_crew_captain_lines, list(
var/battlefield_dirty = TRUE
/// Whether the raiding crew has had its arrival line
var/arrival_barked = FALSE
+ /// Members adrift in space, mob -> world.time they were first found adrift
+ var/list/adrift_since = list()
COOLDOWN_DECLARE(intel_cooldown)
COOLDOWN_DECLARE(battlefield_cooldown)
COOLDOWN_DECLARE(spot_bark_cooldown)
@@ -191,6 +215,7 @@ GLOBAL_LIST_INIT(pirate_crew_captain_lines, list(
controller.reset_ai_status()
members.Cut()
home_turfs.Cut()
+ adrift_since.Cut()
for(var/mob/living/hostile in known_hostiles)
UnregisterSignal(hostile, COMSIG_QDELETING)
known_hostiles.Cut()
@@ -207,7 +232,7 @@ GLOBAL_LIST_INIT(pirate_crew_captain_lines, list(
* role. A defending crew's first non-captain becomes the guard; a melee recruit takes the
* job off a ranged guard while the crew is still calm.
*/
-/datum/pirate_crew/proc/enlist(mob/living/basic/recruit, role = PIRATE_ROLE_HUNTER)
+/datum/pirate_crew/proc/enlist(mob/living/recruit, role = PIRATE_ROLE_HUNTER)
if(QDELETED(recruit) || recruit.stat == DEAD)
return FALSE
if(raiding || isnull(role))
@@ -220,7 +245,6 @@ GLOBAL_LIST_INIT(pirate_crew_captain_lines, list(
home_turfs -= recruit
return FALSE
if(!already_member)
- pirate_crew_arm(recruit)
RegisterSignal(recruit, COMSIG_LIVING_DEATH, PROC_REF(on_member_lost))
RegisterSignal(recruit, COMSIG_QDELETING, PROC_REF(on_member_lost))
if(!raiding && role != PIRATE_ROLE_CAPTAIN)
@@ -236,10 +260,15 @@ GLOBAL_LIST_INIT(pirate_crew_captain_lines, list(
return TRUE
/// Puts `member` on a pirate crew controller wired to this crew. Returns the controller.
-/datum/pirate_crew/proc/attach_controller(mob/living/basic/member, role)
+/datum/pirate_crew/proc/attach_controller(mob/living/member, role)
var/datum/ai_controller/basic_controller/pirate_crew/controller = swap_basic_ai_controller(member, pirate_crew_controller_type(member))
if(!istype(controller))
return null
+ // A human NPC's family decides who it keeps attacking (pirates: until hard crit); a fresh controller
+ // starts on its type's default
+ if(ishumannpc(member))
+ var/mob/living/carbon/human/npc/human_member = member
+ controller.set_blackboard_key(BB_TARGET_MINIMUM_STAT, human_member.npc_target_stat)
// A member handed over from another crew starts this crew's bookkeeping afresh
if(controller.blackboard[BB_PIRATE_CREW] != src)
controller.last_battlefield_turf = null
@@ -277,8 +306,10 @@ GLOBAL_LIST_INIT(pirate_crew_captain_lines, list(
set_role(guard, PIRATE_ROLE_HUNTER)
set_role(recruit, PIRATE_ROLE_GUARD)
-/// Whether `member` fights at range
+/// Whether `member` fights at range: a human carrying a gun it may use, or a basic mob on the ranged controller
/proc/pirate_crew_is_ranged(mob/living/member)
+ if(ishuman(member))
+ return pirate_crew_human_gunner(member)
return istype(member?.ai_controller, /datum/ai_controller/basic_controller/pirate_crew/ranged)
/datum/pirate_crew/proc/on_member_lost(mob/living/source)
@@ -291,6 +322,7 @@ GLOBAL_LIST_INIT(pirate_crew_captain_lines, list(
UnregisterSignal(member, list(COMSIG_LIVING_DEATH, COMSIG_QDELETING))
members -= member
home_turfs -= member
+ adrift_since -= member
if(!length(members))
qdel(src)
@@ -484,7 +516,8 @@ GLOBAL_LIST_INIT(pirate_crew_captain_lines, list(
/datum/pirate_crew/proc/assign_hunts()
var/list/hunters = list()
for(var/mob/living/member in members)
- if(QDELETED(member) || member.stat == DEAD || !member.ai_controller)
+ // Down or cuffed: not hunting anyone
+ if(QDELETED(member) || human_npc_out_of_fight(member) || !member.ai_controller)
continue
if(holds_post(member))
member.ai_controller.clear_blackboard_key(BB_PIRATE_HUNT_TARGET)
@@ -568,13 +601,13 @@ GLOBAL_LIST_INIT(pirate_crew_captain_lines, list(
controller.can_idle = TRUE
controller.reset_ai_status()
-/// The captain and the guard join the hunt once the rest of the crew is mostly dead
+/// The captain and the guard join the hunt once the rest of the crew is mostly out of the fight
/datum/pirate_crew/proc/check_promotion()
if(promoted || raiding)
return
var/living = 0
for(var/mob/living/member in members)
- if(members[member] != PIRATE_ROLE_CAPTAIN && member.stat != DEAD)
+ if(members[member] != PIRATE_ROLE_CAPTAIN && !human_npc_out_of_fight(member))
living++
if(living > min(starting_crew / 3, 1))
return
@@ -584,13 +617,14 @@ GLOBAL_LIST_INIT(pirate_crew_captain_lines, list(
// ===== BARKS =====
+/// A crew shout from `speaker`. Ordinary speech (defaults PI-18): a gagged or muted pirate says nothing.
/datum/pirate_crew/proc/bark(mob/living/speaker, kind)
- if(QDELETED(speaker) || speaker.stat != CONSCIOUS)
+ if(QDELETED(speaker) || speaker.stat != CONSCIOUS || !speaker.can_speak())
return FALSE
var/list/lines = pirate_crew_bark_lines(speaker, kind)
if(!length(lines))
return FALSE
- INVOKE_ASYNC(speaker, TYPE_PROC_REF(/atom/movable, say), message = pick(lines), forced = "pirate crew")
+ INVOKE_ASYNC(speaker, TYPE_PROC_REF(/atom/movable, say), message = pick(lines))
return TRUE
/// `member` saw `target`: tell the crew, and maybe shout about it
@@ -625,6 +659,9 @@ GLOBAL_LIST_INIT(pirate_crew_captain_lines, list(
if(battlefield_dirty || COOLDOWN_FINISHED(src, battlefield_cooldown))
refresh_battlefield()
check_members()
+ if(QDELETED(src))
+ return PROCESS_KILL
+ check_adrift()
if(QDELETED(src))
return PROCESS_KILL
if(!alerted)
@@ -646,7 +683,8 @@ GLOBAL_LIST_INIT(pirate_crew_captain_lines, list(
*/
/datum/pirate_crew/proc/check_members()
var/list/stranded = list()
- for(var/mob/living/basic/member in members)
+ // Every member, human NPCs included: a loop typed to basic mobs skipped them silently.
+ for(var/mob/living/member in members)
if(QDELETED(member) || member.stat == DEAD || GET_CLIENT(member))
continue
var/datum/ai_controller/controller = member.ai_controller
@@ -660,13 +698,47 @@ GLOBAL_LIST_INIT(pirate_crew_captain_lines, list(
var/obj/structure/overmap/ship/other = pirate_crew_ship_at(where)
if(other && other != home_ship)
stranded[member] = other
- for(var/mob/living/basic/member as anything in stranded)
+ for(var/mob/living/member as anything in stranded)
var/obj/structure/overmap/ship/other = stranded[member]
remove_member(member)
pirate_crew_enlist_raider(member, other)
if(QDELETED(src))
return
+/**
+ * Cleans up members adrift in space that no player can see, once they have drifted for
+ * PIRATE_CREW_ADRIFT_TIME. Space kills a pirate without a suit on its own; a suited one would drift
+ * alive forever, off its battlefield, holding its crew and its hull's pool slot open. A human NPC goes
+ * the way one that walks out does (npc_vanish(): what it carries that isn't gear, a ship key, drops where
+ * it was). See the top of this file.
+ */
+/datum/pirate_crew/proc/check_adrift()
+ for(var/mob/living/member as anything in members.Copy())
+ if(QDELETED(member) || member.stat == DEAD || GET_CLIENT(member) || !pirate_crew_member_adrift(member))
+ adrift_since -= member
+ continue
+ if(isnull(adrift_since[member]))
+ adrift_since[member] = world.time
+ continue
+ if(world.time < adrift_since[member] + PIRATE_CREW_ADRIFT_TIME || human_npc_watched(member))
+ continue
+ log_shuttle("PIRATE_CREW: [member] was lost adrift at [AREACOORD(member)]")
+ remove_member(member)
+ if(ishumannpc(member))
+ var/mob/living/carbon/human/npc/lost = member
+ lost.npc_vanish()
+ else
+ qdel(member)
+ if(QDELETED(src))
+ return
+
+/// Whether `member` is floating in space, off any ship's deck
+/proc/pirate_crew_member_adrift(mob/living/member)
+ var/turf/where = get_turf(member)
+ if(isnull(where) || !isturf(member.loc))
+ return FALSE
+ return isspaceturf(where) || istype(get_area(where), /area/space)
+
// ===== HOME SHIP SIGNALS =====
/datum/pirate_crew/proc/on_home_ship_deleted(datum/source)
@@ -710,9 +782,12 @@ GLOBAL_LIST_INIT(pirate_crew_captain_lines, list(
behavior_names += replacetext("[behavior.type]", "/datum/ai_behavior/", "")
text += ": [controller.ai_status][controller.can_idle ? " (may idle)" : ""][controller.able_to_plan ? "" : " (planning blocked)"][controller.on_failed_planning_timeout ? " (planning timeout)" : ""]"
text += ", doing [length(behavior_names) ? jointext(behavior_names, " + ") : "nothing"]"
- var/datum/component/pirate_gun/gun = pirate_gun_of(member)
- if(gun)
- text += ", [gun.status_text()]"
+ if(ishuman(member))
+ var/obj/item/gun/gun = human_npc_held_gun(member)
+ if(gun)
+ text += ", holding [gun][gun.can_shoot() ? "" : " (empty)"]"
+ if(human_npc_out_of_fight(member))
+ text += " (out of the fight)"
var/atom/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
text += ", target [target ? "[target]" : "none"]"
var/mob/hunt = controller.blackboard[BB_PIRATE_HUNT_TARGET]
diff --git a/voidcrew/modules/npc_ships/code/pirate_crew_ai.dm b/voidcrew/modules/npc_ships/code/pirate_crew_ai.dm
index b2dbe66ce31..f0fb4024e87 100644
--- a/voidcrew/modules/npc_ships/code/pirate_crew_ai.dm
+++ b/voidcrew/modules/npc_ships/code/pirate_crew_ai.dm
@@ -4,6 +4,10 @@
* Fights whoever it can see, breaks through doors that won't open for it, holds the helm if it
* is the captain or the guard, and otherwise walks to wherever the crew last knew a hostile to
* be. Doors it may open are walked through, never hit. Allies in a corridor swap places.
+ *
+ * NPC ship crews and boarders are human NPCs and run the human controller (pirate_crew_human.dm),
+ * which fights and breaks doors with the body's own hands. The basic-mob controllers below are what
+ * a basic pirate gets if it is enlisted (an admin spawn, a basic boarding type).
*/
// ===== CONTROLLERS =====
@@ -67,8 +71,6 @@
* or away from the helm, since nothing would get to check.
*/
/datum/ai_planning_subtree/basic_ranged_attack_subtree/trooper/pirate_crew
- // Stock gunfire, or a rolled pirate gun (pirate_guns.dm)
- operational_datums = list(/datum/component/ranged_attacks, /datum/component/pirate_gun)
ranged_attack_behavior = /datum/ai_behavior/basic_ranged_attack/trooper/pirate_crew
/datum/ai_planning_subtree/basic_ranged_attack_subtree/trooper/pirate_crew/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
@@ -78,20 +80,12 @@
var/behavior = ranged_attack_behavior
if(istype(pirate_controller) && pirate_controller.target_hold_ground)
behavior = /datum/ai_behavior/basic_ranged_attack/trooper/pirate_crew/hold_ground
- else
- var/datum/component/pirate_gun/gun = pirate_gun_of(controller.pawn)
- if(gun?.loadout.close_range)
- behavior = /datum/ai_behavior/basic_ranged_attack/trooper/pirate_crew/close
controller.queue_behavior(behavior, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETING_STRATEGY, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION)
return SUBTREE_RETURN_FINISH_PLANNING
/datum/ai_behavior/basic_ranged_attack/trooper/pirate_crew
behavior_flags = AI_BEHAVIOR_REQUIRE_MOVEMENT | AI_BEHAVIOR_MOVE_AND_PERFORM | AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
-/// A shotgunner walks in close before it fires
-/datum/ai_behavior/basic_ranged_attack/trooper/pirate_crew/close
- required_distance = 3
-
/// Returns fire at someone it may not go after (off the battlefield, or past the helm's leash) without taking a step towards them
/datum/ai_behavior/basic_ranged_attack/trooper/pirate_crew/hold_ground
required_distance = PIRATE_CREW_SIGHT_RANGE
@@ -129,8 +123,7 @@
if(QDELETED(target))
return FALSE
if(istype(src, /datum/ai_controller/basic_controller/pirate_crew/ranged))
- var/datum/component/pirate_gun/gun = pirate_gun_of(pawn)
- return can_see(pawn, target, gun?.loadout.close_range || 5)
+ return can_see(pawn, target, 5)
return get_dist(pawn, target) <= 1
// ----- Door bookkeeping -----
@@ -155,12 +148,16 @@
set_blackboard_key(BB_PIRATE_BREACH_STAND, stand || get_turf(pawn))
set_blackboard_key(BB_PIRATE_BREACH_TURF, get_turf(target))
set_blackboard_key(BB_PIRATE_BREACH_STARTED, world.time)
+ clear_blackboard_key(BB_PIRATE_BREACH_INTEGRITY)
+ clear_blackboard_key(BB_PIRATE_BREACH_PROGRESS_AT)
/datum/ai_controller/basic_controller/pirate_crew/proc/clear_breach()
clear_blackboard_key(BB_PIRATE_BREACH_TARGET)
clear_blackboard_key(BB_PIRATE_BREACH_STAND)
clear_blackboard_key(BB_PIRATE_BREACH_TURF)
clear_blackboard_key(BB_PIRATE_BREACH_STARTED)
+ clear_blackboard_key(BB_PIRATE_BREACH_INTEGRITY)
+ clear_blackboard_key(BB_PIRATE_BREACH_PROGRESS_AT)
// ----- Pawn signals -----
@@ -428,8 +425,15 @@
if(isliving(requester) && istype(requester.ai_controller, /datum/ai_controller/basic_controller/pirate_crew))
return TRUE
-/// Whether breaking `door` would open the ship to space: an external airlock or blast door with nothing beyond it
+/**
+ * Whether breaking `door` would open the ship to space: an external airlock or blast door with nothing
+ * beyond it, or a firelock holding back a room that has lost its air.
+ */
/proc/pirate_door_vents_space(obj/machinery/door/door, turf/from)
+ if(istype(door, /obj/machinery/door/firedoor))
+ var/turf/firelock_turf = get_turf(door)
+ var/turf/beyond = (from && firelock_turf) ? get_turf_through_door(from, firelock_turf) : null
+ return beyond && !is_safe_turf(beyond, TRUE, FALSE)
if(!istype(door, /obj/machinery/door/airlock/external) && !istype(door, /obj/machinery/door/poddoor))
return FALSE
var/turf/door_turf = get_turf(door)
@@ -582,7 +586,12 @@
return
pirate_controller.target_hold_ground = (target_reach(pirate_controller, crew, found) == PIRATE_TARGET_HOLD)
controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, found)
- crew?.on_member_spotted(pawn, found)
+ if(crew)
+ crew.on_member_spotted(pawn, found)
+ else if(ishumannpc(pawn))
+ // A faction pirate met in a ruin or a contract, with no crew to tell
+ var/mob/living/carbon/human/npc/loner = pawn
+ loner.npc_bark(PIRATE_BARK_SPOT)
/datum/ai_planning_subtree/pirate_crew_find_target/proc/scan_for_target(datum/ai_controller/basic_controller/pirate_crew/controller, datum/pirate_crew/crew, datum/targeting_strategy/strategy, mob/living/basic/pawn, turf/pawn_turf)
var/atom/best_player
@@ -628,7 +637,7 @@
* battlefield or only just off it on solid ground, and within PIRATE_CREW_POST_LEASH of the helm
* for the captain and the guard. Past that a gunner standing on the battlefield still shoots back
* at a player from where it stands (PIRATE_TARGET_HOLD); anything else is let go (PIRATE_TARGET_OUT).
- * Nobody follows a target into space, where the spaced-crew sweeps would kill them.
+ * Nobody follows a target into space: a crewman adrift is lost to the crew (pirate_crew.dm).
*/
/datum/ai_planning_subtree/pirate_crew_find_target/proc/target_reach(datum/ai_controller/basic_controller/pirate_crew/controller, datum/pirate_crew/crew, atom/target)
if(!crew)
@@ -638,7 +647,7 @@
return PIRATE_TARGET_OUT
var/mob/living/pawn = controller.pawn
var/fallback = PIRATE_TARGET_OUT
- if(istype(controller, /datum/ai_controller/basic_controller/pirate_crew/ranged) && crew.turf_on_battlefield(get_turf(pawn)) && pirate_crew_player_target(target))
+ if(pirate_crew_is_ranged(pawn) && crew.turf_on_battlefield(get_turf(pawn)) && pirate_crew_player_target(target))
fallback = PIRATE_TARGET_HOLD
if(crew.holds_post(pawn))
var/turf/post = crew.post_for(pawn)
@@ -740,8 +749,14 @@
if(!pirate_door_breachable(blocker, stand))
controller.skip_door(blocker)
return FALSE
+ // Given up once a stretch goes by with the door taking no damage at all: a human shooting a door
+ // open takes longer than a basic mob smashing it, but gets somewhere.
var/started = controller.blackboard[BB_PIRATE_BREACH_STARTED] || world.time
- if(world.time > started + PIRATE_CREW_BREACH_GIVE_UP)
+ if(blocker.atom_integrity < (controller.blackboard[BB_PIRATE_BREACH_INTEGRITY] || INFINITY))
+ controller.set_blackboard_key(BB_PIRATE_BREACH_INTEGRITY, blocker.atom_integrity)
+ controller.set_blackboard_key(BB_PIRATE_BREACH_PROGRESS_AT, world.time)
+ var/progress_at = max(started, controller.blackboard[BB_PIRATE_BREACH_PROGRESS_AT])
+ if(world.time > progress_at + PIRATE_CREW_BREACH_GIVE_UP)
log_shuttle("PIRATE_CREW: [pawn] gave up breaking [blocker] at [AREACOORD(blocker)]")
controller.skip_door(blocker)
return FALSE
@@ -911,12 +926,28 @@
/datum/ai_behavior/pirate_crew_breach/perform(seconds_per_tick, datum/ai_controller/controller, target_key, stand_key)
var/obj/blocker = controller.blackboard[target_key]
- var/mob/living/basic/pawn = controller.pawn
+ var/mob/living/pawn = controller.pawn
if(QDELETED(blocker) || !blocker.density)
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED
if(istype(blocker, /obj/machinery/door) && pirate_can_open_door(pawn, blocker))
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED
- if(!isbasicmob(pawn) || !pawn.Adjacent(blocker))
+ if(ishuman(pawn))
+ // A person's hands: pry it, shoot it from a step back, or hit it (pirate_crew_human.dm)
+ var/turf/stand = controller.blackboard[stand_key] || get_turf(pawn)
+ var/turf/spot = pirate_crew_human_breach_spot(pawn, blocker, stand)
+ if(controller.current_movement_target != spot)
+ set_movement_target(controller, spot)
+ if(get_turf(pawn) != spot && !(spot == stand && pawn.Adjacent(blocker)))
+ return AI_BEHAVIOR_DELAY
+ if(!pirate_crew_human_breach(controller, pawn, blocker))
+ // Nothing it carries can hurt this door: leave it to someone who can
+ var/datum/ai_controller/basic_controller/pirate_crew/pirate_controller = controller
+ pirate_controller.skip_door(blocker)
+ pirate_controller.clear_breach()
+ return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED
+ return AI_BEHAVIOR_DELAY
+ var/mob/living/basic/basic_pawn = pawn
+ if(!isbasicmob(basic_pawn) || !basic_pawn.Adjacent(blocker))
return AI_BEHAVIOR_DELAY
- pawn.melee_attack(blocker)
+ basic_pawn.melee_attack(blocker)
return AI_BEHAVIOR_DELAY
diff --git a/voidcrew/modules/npc_ships/code/pirate_crew_combat_sense.dm b/voidcrew/modules/npc_ships/code/pirate_crew_combat_sense.dm
new file mode 100644
index 00000000000..d3c42984a75
--- /dev/null
+++ b/voidcrew/modules/npc_ships/code/pirate_crew_combat_sense.dm
@@ -0,0 +1,47 @@
+/**
+ * Combat sense for faction pirates (voidcrew/modules/human_npcs/human_npc_combat_sense.dm): NPC ship crews,
+ * boarders, NT customs and the crews squatting in ruins, every faction and rank.
+ *
+ * What they carry is #509's and unchanged: the rank and file no stimulant; captains a combat stimpack and
+ * bosses a stimulant pen, which they inject as their fight starts (pirate_crew_human_self_care). So the
+ * stimulant half only ever fires for a pirate still holding an unused stimulant. Under stun fire:
+ * - a gunner runs for cover, but only on its crew's battlefield, a captain or helm guard only within
+ * PIRATE_CREW_POST_LEASH of its post, and a pirate with no crew only within PIRATE_CREWLESS_LEASH of
+ * where it was put; never onto open space;
+ * - a gunner told to hold its ground against someone off the battlefield (target_hold_ground) stays put
+ * and shoots back, as before;
+ * - a melee pirate, or a shotgunner (its gun handling's close_range), charges the shooter.
+ */
+/datum/npc_combat_sense/pirate_crew
+
+/mob/living/carbon/human/npc/faction_pirate
+ npc_combat_sense = /datum/npc_combat_sense/pirate_crew
+
+/datum/npc_combat_sense/pirate_crew/may_move(mob/living/carbon/human/npc, datum/ai_controller/controller)
+ var/datum/ai_controller/basic_controller/pirate_crew/pirate_controller = controller
+ return !(istype(pirate_controller) && pirate_controller.target_hold_ground)
+
+/datum/npc_combat_sense/pirate_crew/reach(mob/living/carbon/human/npc, datum/ai_controller/controller)
+ if(!pirate_crew_human_gunner(npc))
+ return 1
+ var/obj/item/gun/gun = human_npc_held_gun(npc)
+ if(gun)
+ var/datum/pirate_gun_handling/handling = pirate_gun_handling_for(gun)
+ if(handling?.close_range)
+ return handling.close_range
+ return controller.blackboard[BB_HUMAN_NPC_FIRE_RANGE] || 7
+
+/datum/npc_combat_sense/pirate_crew/tile_ok(mob/living/carbon/human/npc, datum/ai_controller/controller, turf/tile)
+ if(!..() || pirate_turf_is_void(tile))
+ return FALSE
+ var/datum/ai_controller/basic_controller/pirate_crew/pirate_controller = controller
+ var/datum/pirate_crew/crew = istype(pirate_controller) ? pirate_controller.get_crew() : null
+ if(crew)
+ if(!crew.turf_on_battlefield(tile))
+ return FALSE
+ if(!crew.holds_post(npc))
+ return TRUE
+ var/turf/post = crew.post_for(npc)
+ return isnull(post) || (post.z == tile.z && get_dist(post, tile) <= PIRATE_CREW_POST_LEASH)
+ var/turf/home = controller.blackboard[BB_PIRATE_CREWLESS_HOME]
+ return isnull(home) || home.z != tile.z || get_dist(home, tile) <= PIRATE_CREWLESS_LEASH
diff --git a/voidcrew/modules/npc_ships/code/pirate_crew_human.dm b/voidcrew/modules/npc_ships/code/pirate_crew_human.dm
new file mode 100644
index 00000000000..276364b569f
--- /dev/null
+++ b/voidcrew/modules/npc_ships/code/pirate_crew_human.dm
@@ -0,0 +1,503 @@
+/**
+ * Pirate crew AI on human NPC bodies (human NPC migration, phase B).
+ *
+ * The crew AI itself is PR #500's (pirate_crew.dm, pirate_crew_ai.dm): the crew's intel, the captain and
+ * guard at the helm, the hunt, door breaking that never vents a ship, swapping places in corridors. This
+ * file gives it a human body's hands, through the human NPC base (voidcrew/modules/human_npcs/):
+ * - it runs in soft crit and while cuffed (human_npc_ai_able_to_run()), with the soft-crit branch first,
+ * so a downed pirate crawls, pleads and, if it is an elite or a boss, fires wild, and a cuffed one
+ * works at its cuffs;
+ * - gunners fire the real gun in their hands in volleys (pirate_guns.dm), reload from the magazines and
+ * shells they carry the way a player does, and fight with a knife or their fists when they run dry;
+ * - doors that won't open are pried with a crowbar or a fireaxe it carries (an unpowered airlock, a
+ * firelock), else shot, else hit with a blade heavy enough to dent them;
+ * - captains and bosses inject the stimulant they carry when their fight starts; a boss with a flask
+ * drinks from it when hurt; a boss gunner puts its gun to the head of a hunter who is down (the
+ * hyperviolence execution, with its wind-up the crew can interrupt), once a minute at most.
+ * Everything goes through ai_interact(), a player's click.
+ */
+
+/datum/ai_controller/basic_controller/pirate_crew/human
+ blackboard = list(
+ BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic/human_npc,
+ BB_TARGET_MINIMUM_STAT = HARD_CRIT,
+ BB_AGGRO_RANGE = PIRATE_CREW_SIGHT_RANGE,
+ BB_HUMAN_NPC_SHOT_DELAY = 3 SECONDS,
+ BB_HUMAN_NPC_FIRE_RANGE = 7,
+ BB_HUMAN_NPC_KEEP_AWAY = 2,
+ )
+ // Holds still through its own do_afters: a cuff breakout, a gun to someone's head
+ ai_traits = PAUSE_DURING_DO_AFTER
+ planning_subtrees = list(
+ /datum/ai_planning_subtree/human_npc_soft_crit,
+ /datum/ai_planning_subtree/escape_captivity,
+ /datum/ai_planning_subtree/human_npc_surrender/crewless,
+ /datum/ai_planning_subtree/pirate_crew_find_target,
+ /datum/ai_planning_subtree/pirate_crew_human_self_care,
+ /datum/ai_planning_subtree/npc_combat_sense,
+ /datum/ai_planning_subtree/pirate_crew_doors,
+ /datum/ai_planning_subtree/human_npc_arm/pirate_crew,
+ /datum/ai_planning_subtree/pirate_crew_human_shoot,
+ /datum/ai_planning_subtree/human_npc_melee/pirate_crew,
+ /datum/ai_planning_subtree/pirate_crew_hold_post,
+ /datum/ai_planning_subtree/pirate_crew_hunt,
+ /datum/ai_planning_subtree/pirate_crew_leash,
+ /datum/ai_planning_subtree/pirate_crewless_home,
+ )
+
+/datum/ai_controller/basic_controller/pirate_crew/human/TryPossessPawn(atom/new_pawn)
+ if(!ishuman(new_pawn))
+ return AI_CONTROLLER_INCOMPATIBLE
+ return ..()
+
+// The human NPC base's run check: cuffs and soft crit don't stop it (human_npc_soft_crit.dm).
+/datum/ai_controller/basic_controller/pirate_crew/human/get_able_to_run()
+ return human_npc_ai_able_to_run(src)
+
+/datum/ai_controller/basic_controller/pirate_crew/human/on_stat_changed(mob/living/source, new_stat)
+ . = ..()
+ human_npc_ai_stat_changed(src, new_stat)
+
+// A hit during an SMG's spin-up or a shotgun's aim spoils the volley.
+/datum/ai_controller/basic_controller/pirate_crew/human/on_pawn_damaged(mob/living/source, damage_dealt)
+ . = ..()
+ if(damage_dealt <= 0 || blackboard[BB_PIRATE_WINDUP_UNTIL] <= world.time)
+ return
+ clear_blackboard_key(BB_PIRATE_WINDUP_UNTIL)
+ set_blackboard_key(BB_PIRATE_VOLLEY_LEFT, 0)
+ set_blackboard_key(BB_HUMAN_NPC_NEXT_SHOT, world.time + 1 SECONDS)
+
+/datum/ai_controller/basic_controller/pirate_crew/human/can_hit_now(atom/target)
+ if(QDELETED(target))
+ return FALSE
+ var/mob/living/carbon/npc = pawn
+ var/obj/item/gun/gun = human_npc_loaded_gun(npc)
+ if(gun)
+ var/datum/pirate_gun_handling/handling = pirate_gun_handling_for(gun)
+ var/reach = handling.close_range || blackboard[BB_HUMAN_NPC_FIRE_RANGE] || 7
+ return get_dist(npc, target) <= reach && can_see(npc, target, reach)
+ return npc.Adjacent(target)
+
+// ===== WITH NO CREW: ruins, planets, contracts =====
+
+/// A pirate with no crew gives up by its family's rules (npc_surrender, human_npc_surrender.dm). One in a
+/// crew fights on with it.
+/datum/ai_planning_subtree/human_npc_surrender/crewless
+
+/datum/ai_planning_subtree/human_npc_surrender/crewless/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/datum/ai_controller/basic_controller/pirate_crew/pirate_controller = controller
+ if(istype(pirate_controller) && pirate_controller.get_crew())
+ return
+ return ..()
+
+/// A pirate with no crew and nobody to fight walks back to where it was put once it has strayed more
+/// than PIRATE_CREWLESS_LEASH tiles (a chase, a flight from its surrender).
+/datum/ai_planning_subtree/pirate_crewless_home
+
+/datum/ai_planning_subtree/pirate_crewless_home/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/datum/ai_controller/basic_controller/pirate_crew/pirate_controller = controller
+ if(!istype(pirate_controller) || pirate_controller.get_crew() || controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET))
+ return
+ var/turf/home = controller.blackboard[BB_PIRATE_CREWLESS_HOME]
+ var/turf/here = get_turf(controller.pawn)
+ if(isnull(home) || isnull(here) || home.z != here.z)
+ return
+ if(get_dist(here, home) <= PIRATE_CREWLESS_LEASH)
+ return
+ controller.set_blackboard_key(BB_PIRATE_RETURN_TURF, home)
+ controller.queue_behavior(/datum/ai_behavior/pirate_crew_travel/leash, BB_PIRATE_RETURN_TURF)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/// Whether a human crewman fights at range: it holds or carries a gun it can fire, and may use guns.
+/proc/pirate_crew_human_gunner(mob/living/carbon/human/npc)
+ if(HAS_TRAIT(npc, TRAIT_NOGUNS))
+ return FALSE
+ if(locate(/obj/item/gun) in npc.held_items)
+ return TRUE
+ return length(npc.get_all_contents_type(/obj/item/gun)) > 0
+
+// ===== ARMING: the base's reload and draw, with the crew's reload shouts =====
+
+/datum/ai_planning_subtree/human_npc_arm/pirate_crew
+
+/datum/ai_planning_subtree/human_npc_arm/pirate_crew/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/carbon/npc = controller.pawn
+ var/obj/item/gun/gun = human_npc_held_gun(npc)
+ var/was_dry = gun && !gun.can_shoot()
+ // A pump racked between shells is no reload worth shouting about
+ var/just_racking = istype(gun, /obj/item/gun/ballistic) && human_npc_gun_needs_rack(gun)
+ . = ..()
+ if(. != SUBTREE_RETURN_FINISH_PLANNING || !was_dry || just_racking || !prob(PIRATE_CREW_RELOAD_BARK_CHANCE))
+ return
+ var/datum/pirate_gun_handling/handling = pirate_gun_handling_for(gun)
+ var/list/lines = human_npc_can_reload(npc, gun) ? handling.reload_lines : handling.dry_lines
+ if(length(lines) && human_npc_can_talk(npc))
+ INVOKE_ASYNC(npc, TYPE_PROC_REF(/atom/movable, say), pick(lines))
+
+// ===== SHOOTING =====
+
+/**
+ * With a loaded gun in hand: fires its volleys at the target from up to the gun's range (a shotgunner
+ * walks in to three tiles first), stepping back from anyone too close, and closing in when it can't see
+ * them. A gunner told to hold its ground (target_reach()) shoots back from where it stands and never
+ * takes a step after them. A boss gunner whose target is down puts the gun to their head instead.
+ */
+/datum/ai_planning_subtree/pirate_crew_human_shoot
+
+/datum/ai_planning_subtree/pirate_crew_human_shoot/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/atom/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
+ if(QDELETED(target))
+ return
+ var/mob/living/carbon/human/npc/npc = controller.pawn
+ if(HAS_TRAIT(npc, TRAIT_HANDS_BLOCKED) || LAZYLEN(npc.do_afters))
+ return
+ var/obj/item/gun/gun = human_npc_loaded_gun(npc)
+ if(isnull(gun))
+ return
+ var/datum/ai_controller/basic_controller/pirate_crew/pirate_controller = controller
+ var/hold = istype(pirate_controller) && pirate_controller.target_hold_ground
+ if(!hold && pirate_crew_human_wants_execution(controller, npc, target))
+ if(npc.Adjacent(target))
+ controller.queue_behavior(/datum/ai_behavior/pirate_crew_human_execute, BB_BASIC_MOB_CURRENT_TARGET)
+ else
+ controller.queue_behavior(/datum/ai_behavior/human_npc_close_in, BB_BASIC_MOB_CURRENT_TARGET, 1)
+ return SUBTREE_RETURN_FINISH_PLANNING
+ var/datum/pirate_gun_handling/handling = pirate_gun_handling_for(gun)
+ var/fire_range = hold ? PIRATE_CREW_SIGHT_RANGE : (handling.close_range || controller.blackboard[BB_HUMAN_NPC_FIRE_RANGE] || 7)
+ var/distance = get_dist(npc, target)
+ if(distance <= fire_range && can_see(npc, target, fire_range))
+ var/keep_away = controller.blackboard[BB_HUMAN_NPC_KEEP_AWAY]
+ if(!hold && !handling.close_range && keep_away && distance < keep_away)
+ controller.queue_behavior(/datum/ai_behavior/step_away, BB_BASIC_MOB_CURRENT_TARGET)
+ controller.queue_behavior(/datum/ai_behavior/pirate_crew_human_shoot, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETING_STRATEGY, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION)
+ return SUBTREE_RETURN_FINISH_PLANNING
+ if(hold)
+ return
+ controller.queue_behavior(/datum/ai_behavior/human_npc_close_in, BB_BASIC_MOB_CURRENT_TARGET, fire_range)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/**
+ * One pull of the trigger per step of a volley (pirate_guns.dm). A volley that needs a spin-up or a
+ * moment's aim waits for it first; a hit in that moment spoils it (the controller's on_pawn_damaged()).
+ * Doesn't hold up planning.
+ */
+/datum/ai_behavior/pirate_crew_human_shoot
+ action_cooldown = 0.1 SECONDS
+ behavior_flags = AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
+
+/datum/ai_behavior/pirate_crew_human_shoot/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key)
+ var/mob/living/carbon/npc = controller.pawn
+ var/atom/target = controller.blackboard[target_key]
+ var/datum/targeting_strategy/strategy = GET_TARGETING_STRATEGY(controller.blackboard[targeting_strategy_key])
+ if(QDELETED(target) || !strategy?.can_attack(npc, target))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ var/obj/item/gun/gun = human_npc_loaded_gun(npc)
+ if(isnull(gun))
+ // Empty now: the next plan reloads or changes weapon
+ controller.set_blackboard_key(BB_PIRATE_VOLLEY_LEFT, 0)
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
+ var/datum/pirate_gun_handling/handling = pirate_gun_handling_for(gun)
+ var/windup_until = controller.blackboard[BB_PIRATE_WINDUP_UNTIL]
+ if(windup_until)
+ if(world.time < windup_until)
+ return AI_BEHAVIOR_DELAY
+ controller.clear_blackboard_key(BB_PIRATE_WINDUP_UNTIL)
+ controller.set_blackboard_key(BB_PIRATE_VOLLEY_LEFT, handling.shots)
+ if(world.time < controller.blackboard[BB_HUMAN_NPC_NEXT_SHOT])
+ return AI_BEHAVIOR_DELAY
+ if(controller.blackboard[BB_PIRATE_VOLLEY_LEFT] <= 0)
+ if(handling.windup)
+ npc.face_atom(target)
+ if(handling.windup_sound)
+ playsound(npc, handling.windup_sound, 50, TRUE)
+ controller.set_blackboard_key(BB_PIRATE_WINDUP_UNTIL, world.time + handling.windup)
+ return AI_BEHAVIOR_DELAY
+ controller.set_blackboard_key(BB_PIRATE_VOLLEY_LEFT, handling.shots)
+ var/atom/hiding_target = strategy.find_hidden_mobs(npc, target)
+ controller.set_blackboard_key(hiding_location_key, hiding_target)
+ var/atom/final_target = hiding_target || target
+ if(human_npc_ally_in_line(npc, final_target))
+ human_npc_sidestep(npc, final_target)
+ return AI_BEHAVIOR_DELAY
+ if(!human_npc_ready_item(npc, gun))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ npc.zone_selected = pirate_crew_human_aim_zone(npc, final_target)
+ controller.ai_interact(target = final_target, combat_mode = TRUE)
+ var/volley_left = controller.blackboard[BB_PIRATE_VOLLEY_LEFT] - 1
+ controller.set_blackboard_key(BB_PIRATE_VOLLEY_LEFT, volley_left)
+ controller.set_blackboard_key(BB_HUMAN_NPC_NEXT_SHOT, world.time + (volley_left > 0 ? handling.shot_gap : handling.volley_gap))
+ return AI_BEHAVIOR_DELAY
+
+/// Where an ordinary shot is aimed. Never the head of someone helpless at point blank: that would be an
+/// execution, which only a boss starts, and only on purpose (pirate_crew_human_execute).
+/proc/pirate_crew_human_aim_zone(mob/living/shooter, atom/target)
+ var/zone = human_npc_pick_aim_zone()
+ if(zone == BODY_ZONE_HEAD && isliving(target) && shooter.Adjacent(target))
+ var/mob/living/victim = target
+ if(victim.hv_can_be_executed())
+ return BODY_ZONE_CHEST
+ return zone
+
+/// Whether a boss gunner should walk up to `target` and put its gun to their head: it is a boss (OC-9),
+/// its execution isn't cooling down, and the target is someone it may execute.
+/proc/pirate_crew_human_wants_execution(datum/ai_controller/controller, mob/living/carbon/human/npc/npc, atom/target)
+ if(!ishumannpc(npc) || npc.npc_rank < HUMAN_NPC_RANK_BOSS || !isliving(target))
+ return FALSE
+ if(world.time < controller.blackboard[BB_PIRATE_NEXT_EXECUTION])
+ return FALSE
+ var/mob/living/victim = target
+ if(victim.stat == DEAD || !victim.hv_can_be_executed())
+ return FALSE
+ var/obj/item/gun/gun = human_npc_loaded_gun(npc)
+ return gun?.hv_execution_possible(npc, victim) || (gun && !npc.Adjacent(victim))
+
+/**
+ * A boss puts the barrel of its gun to the head of someone down beside it: the hyperviolence execution
+ * (executions.dm), a click aimed at the head. Its 1.5 second wind-up is a do_after, so it runs apart
+ * from the AI's tick, and the crew can break it by moving either of them.
+ */
+/datum/ai_behavior/pirate_crew_human_execute
+ action_cooldown = 1 SECONDS
+
+/datum/ai_behavior/pirate_crew_human_execute/perform(seconds_per_tick, datum/ai_controller/controller, target_key)
+ var/mob/living/carbon/npc = controller.pawn
+ var/mob/living/victim = controller.blackboard[target_key]
+ var/obj/item/gun/gun = human_npc_loaded_gun(npc)
+ if(!isliving(victim) || isnull(gun) || !gun.hv_execution_possible(npc, victim) || !human_npc_ready_item(npc, gun))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ controller.set_blackboard_key(BB_PIRATE_NEXT_EXECUTION, world.time + PIRATE_CREW_EXECUTION_COOLDOWN)
+ npc.zone_selected = BODY_ZONE_HEAD
+ INVOKE_ASYNC(controller, TYPE_PROC_REF(/datum/ai_controller, ai_interact), victim, TRUE)
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
+
+/// tg melee with what it holds, except against someone it was told to hold its ground against: a gunner
+/// whose gun ran dry doesn't run off the battlefield or away from the helm after them.
+/datum/ai_planning_subtree/human_npc_melee/pirate_crew
+
+/datum/ai_planning_subtree/human_npc_melee/pirate_crew/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/datum/ai_controller/basic_controller/pirate_crew/pirate_controller = controller
+ if(istype(pirate_controller) && pirate_controller.target_hold_ground)
+ return
+ return ..()
+
+// ===== STIMULANTS AND THE FLASK =====
+
+/**
+ * Captains and bosses inject the stimulant they carry once their fight has started (they have someone
+ * to fight); a boss carrying a flask drinks from it when it is hurt. Real items used the way a player
+ * uses them: the medipen in hand, then used; the flask clicked on itself.
+ */
+/datum/ai_planning_subtree/pirate_crew_human_self_care
+
+/datum/ai_planning_subtree/pirate_crew_human_self_care/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/carbon/human/npc/npc = controller.pawn
+ if(!ishumannpc(npc) || npc.npc_rank < HUMAN_NPC_RANK_ELITE || npc.stat != CONSCIOUS)
+ return
+ if(HAS_TRAIT(npc, TRAIT_HANDS_BLOCKED) || LAZYLEN(npc.do_afters))
+ return
+ if(!controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET))
+ return
+ var/obj/item/to_use = pirate_crew_human_stimulant(npc)
+ if(isnull(to_use) && npc.health < npc.maxHealth * PIRATE_CREW_DRINK_HEALTH_SHARE && world.time >= controller.blackboard[BB_PIRATE_NEXT_DRINK])
+ to_use = pirate_crew_human_flask(npc)
+ if(isnull(to_use))
+ return
+ controller.set_blackboard_key(BB_PIRATE_SELF_ITEM, to_use)
+ controller.queue_behavior(/datum/ai_behavior/pirate_crew_human_use_on_self, BB_PIRATE_SELF_ITEM)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/// A stimulant medipen it carries and hasn't used, unless one is already in its blood.
+/proc/pirate_crew_human_stimulant(mob/living/carbon/npc)
+ if(npc.reagents?.has_reagent(/datum/reagent/medicine/stimulants))
+ return null
+ for(var/obj/item/reagent_containers/hypospray/medipen/pen in npc.get_all_contents_type(/obj/item/reagent_containers/hypospray/medipen))
+ if(pen.used_up || !pen.reagents?.has_reagent(/datum/reagent/medicine/stimulants))
+ continue
+ if(npc.is_holding(pen) || human_npc_can_draw(npc, pen))
+ return pen
+ return null
+
+/// A flask with something left in it that it can take out.
+/proc/pirate_crew_human_flask(mob/living/carbon/npc)
+ for(var/obj/item/reagent_containers/cup/glass/flask/flask in npc.get_all_contents_type(/obj/item/reagent_containers/cup/glass/flask))
+ if(!flask.reagents?.total_volume)
+ continue
+ if(npc.is_holding(flask) || human_npc_can_draw(npc, flask))
+ return flask
+ return null
+
+/**
+ * Takes the item in a free hand (letting go of a two-handed grip, or holstering a spent gun, if both are
+ * full), uses it on itself, puts a flask back and takes up its weapon again.
+ */
+/datum/ai_behavior/pirate_crew_human_use_on_self
+ action_cooldown = 0.8 SECONDS
+ behavior_flags = AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
+
+/datum/ai_behavior/pirate_crew_human_use_on_self/perform(seconds_per_tick, datum/ai_controller/controller, item_key)
+ var/mob/living/carbon/human/npc/npc = controller.pawn
+ var/obj/item/thing = controller.blackboard[item_key]
+ if(QDELETED(thing) || human_npc_holding(thing) != npc || npc.stat != CONSCIOUS)
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ if(!npc.is_holding(thing))
+ if(!length(npc.get_empty_held_indexes()) && !pirate_crew_human_free_a_hand(npc))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ if(!human_npc_take_in_hand(npc, thing))
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED
+ return AI_BEHAVIOR_DELAY
+ if(!human_npc_ready_item(npc, thing) || npc.next_move > world.time)
+ return AI_BEHAVIOR_DELAY
+ if(istype(thing, /obj/item/reagent_containers/hypospray/medipen))
+ npc.npc_bark("stimulant", force = TRUE)
+ npc.execute_mode()
+ var/obj/item/reagent_containers/hypospray/medipen/pen = thing
+ if(pen.used_up && npc.is_holding(pen))
+ npc.dropItemToGround(pen)
+ else
+ npc.npc_bark("drink", force = TRUE)
+ controller.ai_interact(target = npc, combat_mode = FALSE)
+ controller.set_blackboard_key(BB_PIRATE_NEXT_DRINK, world.time + PIRATE_CREW_DRINK_COOLDOWN)
+ if(npc.is_holding(thing))
+ thing.equip_to_best_slot(npc)
+ for(var/obj/item/held in npc.held_items)
+ human_npc_ready_weapon(npc, held)
+ return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
+
+/datum/ai_behavior/pirate_crew_human_use_on_self/finish_action(datum/ai_controller/controller, succeeded, item_key)
+ . = ..()
+ controller.clear_blackboard_key(item_key)
+ if(!succeeded)
+ // Couldn't get at it; it won't keep trying every tick
+ controller.set_blackboard_key(BB_PIRATE_NEXT_DRINK, world.time + PIRATE_CREW_DRINK_COOLDOWN)
+
+/// Frees a hand: lets go of a two-handed grip, or holsters a gun that can't fire. Returns TRUE if a hand is free.
+/proc/pirate_crew_human_free_a_hand(mob/living/carbon/npc)
+ for(var/obj/item/held in npc.held_items)
+ if(held.GetComponent(/datum/component/two_handed) && HAS_TRAIT(held, TRAIT_WIELDED))
+ held.attack_self(npc)
+ break
+ if(length(npc.get_empty_held_indexes()))
+ return TRUE
+ var/obj/item/gun/spent = human_npc_held_gun(npc)
+ if(spent && !spent.can_shoot())
+ spent.equip_to_best_slot(npc)
+ return length(npc.get_empty_held_indexes()) > 0
+
+// ===== DOORS =====
+
+/**
+ * A human crewman breaking through `blocker` (a door or the frame a broken door left), the ways a person
+ * can: prying an unpowered airlock or a firelock with a crowbar or fireaxe it carries, shooting the door
+ * from a step back, or hitting it with something heavy enough to dent it. Returns FALSE when it has no
+ * way to hurt this door, so the crew's breach gives up on it and another member can try.
+ */
+/proc/pirate_crew_human_breach(datum/ai_controller/controller, mob/living/carbon/human/npc, obj/blocker)
+ if(LAZYLEN(npc.do_afters) || HAS_TRAIT(npc, TRAIT_HANDS_BLOCKED) || npc.next_move > world.time)
+ return TRUE
+ // A pry bar on a door that will give: an airlock with no power that isn't bolted or welded, or a firelock
+ var/obj/item/pry_tool = pirate_crew_human_pry_tool(npc)
+ if(pry_tool && pirate_crew_human_can_pry(blocker))
+ if(npc.Adjacent(blocker) && pirate_crew_human_ready_tool(npc, pry_tool))
+ // A crowbar's right click forces a firelock fully open; its left click only holds it
+ var/list/modifiers = (istype(blocker, /obj/machinery/door/firedoor) && pry_tool.tool_behaviour == TOOL_CROWBAR) ? list(RIGHT_CLICK = TRUE) : null
+ controller.ai_interact(target = blocker, combat_mode = FALSE, modifiers = modifiers)
+ return TRUE
+ // A gun, from a step back so the shot isn't a bash (pirate_crew_human_breach_spot() puts it there)
+ var/obj/item/gun/gun = human_npc_loaded_gun(npc)
+ if(gun && !npc.Adjacent(blocker) && get_dist(npc, blocker) <= 3 && can_see(npc, blocker, 3))
+ if(human_npc_ready_item(npc, gun))
+ npc.face_atom(blocker)
+ controller.ai_interact(target = blocker, combat_mode = TRUE)
+ return TRUE
+ // A blade or a club that dents it
+ var/obj/item/weapon = pirate_crew_human_door_weapon(npc, blocker)
+ if(weapon)
+ if(npc.Adjacent(blocker) && human_npc_ready_item(npc, weapon))
+ controller.ai_interact(target = blocker, combat_mode = TRUE)
+ return TRUE
+ return FALSE
+
+/**
+ * Where a crewman works on `blocker` from: the floor beside it (`stand`) to pry or hit it, or for a gunner
+ * with nothing to pry it, the floor a step further back, so the shot isn't a bash with the gun.
+ */
+/proc/pirate_crew_human_breach_spot(mob/living/carbon/human/npc, obj/blocker, turf/stand)
+ if(!isturf(stand))
+ stand = get_turf(npc)
+ if(isnull(human_npc_loaded_gun(npc)))
+ return stand
+ if(pirate_crew_human_can_pry(blocker) && pirate_crew_human_pry_tool(npc))
+ return stand
+ var/turf/back = get_step(stand, get_dir(blocker, stand))
+ if(back && pirate_turf_standable(back) && can_see(back, blocker, 3))
+ return back
+ return stand
+
+/// Whether a crowbar or a fireaxe in a person's hands would force `blocker`.
+/proc/pirate_crew_human_can_pry(obj/blocker)
+ if(istype(blocker, /obj/machinery/door/firedoor))
+ var/obj/machinery/door/firedoor/firelock = blocker
+ return firelock.density && !firelock.welded && !firelock.operating
+ if(!istype(blocker, /obj/machinery/door/airlock))
+ return FALSE
+ var/obj/machinery/door/airlock/airlock = blocker
+ return airlock.density && !airlock.locked && !airlock.welded && !airlock.seal && !airlock.operating && !airlock.hasPower()
+
+/// A crowbar or a fireaxe it holds or can draw.
+/proc/pirate_crew_human_pry_tool(mob/living/carbon/npc)
+ for(var/obj/item/thing as anything in npc.get_all_contents_type(/obj/item))
+ if(!(thing.tool_behaviour == TOOL_CROWBAR || istype(thing, /obj/item/fireaxe)))
+ continue
+ if(npc.is_holding(thing) || human_npc_can_draw(npc, thing))
+ return thing
+ return null
+
+/// Gets `tool` into the active hand and ready (a fireaxe wielded), putting away what's in the way.
+/// Returns TRUE once it can be used.
+/proc/pirate_crew_human_ready_tool(mob/living/carbon/npc, obj/item/tool)
+ if(!npc.is_holding(tool))
+ if(!length(npc.get_empty_held_indexes()) && !pirate_crew_human_free_a_hand(npc))
+ // Both hands still full: put the weaker of what it holds away
+ var/obj/item/stowed = npc.get_inactive_held_item() || npc.get_active_held_item()
+ if(isnull(stowed) || !stowed.equip_to_best_slot(npc))
+ return FALSE
+ if(!human_npc_take_in_hand(npc, tool))
+ return FALSE
+ if(istype(tool, /obj/item/fireaxe))
+ human_npc_ready_weapon(npc, tool)
+ if(!HAS_TRAIT(tool, TRAIT_WIELDED))
+ return FALSE
+ return human_npc_ready_item(npc, tool)
+
+/// A melee weapon it holds or can draw that hits `blocker` hard enough to hurt it (its damage
+/// deflection), or null.
+/proc/pirate_crew_human_door_weapon(mob/living/carbon/npc, obj/blocker)
+ var/obj/item/best
+ var/best_force = 0
+ for(var/obj/item/thing as anything in npc.get_all_contents_type(/obj/item))
+ if(!human_npc_is_melee_weapon(thing))
+ continue
+ if(!npc.is_holding(thing) && !human_npc_can_draw(npc, thing))
+ continue
+ var/blow = pirate_crew_human_door_blow(thing)
+ if(blow > best_force)
+ best = thing
+ best_force = blow
+ if(isnull(best) || best_force < blocker.damage_deflection)
+ return null
+ if(!npc.is_holding(best))
+ if(!length(npc.get_empty_held_indexes()) || !human_npc_take_in_hand(npc, best))
+ return null
+ human_npc_ready_weapon(npc, best)
+ return best
+
+/// What `weapon` hits a door for, as it would be swung: lit, wielded, and with its demolition modifier.
+/proc/pirate_crew_human_door_blow(obj/item/weapon)
+ var/force = weapon.force
+ var/datum/component/transforming/transforming = weapon.GetComponent(/datum/component/transforming)
+ if(transforming && !HAS_TRAIT(weapon, TRAIT_TRANSFORM_ACTIVE))
+ force = max(force, transforming.force_on)
+ var/datum/component/two_handed/two_handed = weapon.GetComponent(/datum/component/two_handed)
+ if(two_handed && !HAS_TRAIT(weapon, TRAIT_WIELDED))
+ force = max(force, two_handed.force_wielded)
+ return force * weapon.demolition_mod
diff --git a/voidcrew/modules/npc_ships/code/pirate_guns.dm b/voidcrew/modules/npc_ships/code/pirate_guns.dm
index 9c98550f815..80ba300a4c7 100644
--- a/voidcrew/modules/npc_ships/code/pirate_guns.dm
+++ b/voidcrew/modules/npc_ships/code/pirate_guns.dm
@@ -1,359 +1,104 @@
/**
- * Pirate crew guns.
+ * Pirate crew guns: how a human pirate handles the real gun in its hands.
*
- * A ranged pirate rolls a gun when it joins a crew (pirate_crew_arm()), weighted by its faction: an
- * energy gun, a laser rifle, a pistol, an SMG or a shotgun. The gun shows in its hand and fires the
- * real gun's rounds: a ballistic gun's are read off the item by bounty_real_weapon() (bounties
- * module), with its magazine, pellets, spread and damage multiplier; an energy gun fires its
- * casing's beam. Nothing is spawned for the fight and nothing drops.
- *
- * Each loadout has a magazine and a reload, and the SMG and shotgun wind up before they fire (a
- * hit during the wind-up spoils it). The shotgun walks in close before it fires. Every loadout
- * deals about what the old two-laser volley every 6 seconds did, so a crew hits as hard as before.
+ * PR #500 rolled a drawn gun for each basic-mob gunner and fired its rounds from the body. Human
+ * pirates (faction_pirate_humans.dm) hold the real thing, chosen by their faction's outfit table
+ * (voidcrew/modules/human_npcs/human_npc_outfits_pirates.dm, weighted as PR #500's crew_gun_weights),
+ * with real spare magazines or shells, and fire it through the real fire path. What is left of PR #500's
+ * loadouts is how each kind of gun is used: how many pulls of the trigger make a volley and how long the
+ * pirate waits between volleys (tuned, as before, to about the old two-laser volley every six seconds),
+ * the SMG's spin-up and the shotgun's moment of aim that a hit spoils, the shotgunner walking in close,
+ * and what it shouts when it reloads. The pump, the magazine change and their sounds are the gun's own.
*/
-/// One of each loadout, by type
-GLOBAL_LIST_INIT(pirate_gun_loadouts, init_pirate_gun_loadouts())
+/// One of each handling, most specific gun type first
+GLOBAL_LIST_INIT(pirate_gun_handlings, init_pirate_gun_handlings())
-/proc/init_pirate_gun_loadouts()
+/proc/init_pirate_gun_handlings()
. = list()
- for(var/loadout_type in subtypesof(/datum/pirate_gun_loadout))
- .[loadout_type] = new loadout_type
-
-/// What a gunner rolls when its faction says nothing: an even mix of energy and ballistic
-GLOBAL_LIST_INIT(pirate_gun_default_weights, list(
- /datum/pirate_gun_loadout/energy_gun = 2,
- /datum/pirate_gun_loadout/laser_rifle = 1,
- /datum/pirate_gun_loadout/pistol = 2,
- /datum/pirate_gun_loadout/smg = 2,
- /datum/pirate_gun_loadout/shotgun = 2,
-))
+ // Most specific first: pistols are automatic guns too, and every gun type is a /obj/item/gun.
+ for(var/handling_type in list(
+ /datum/pirate_gun_handling/shotgun,
+ /datum/pirate_gun_handling/pistol,
+ /datum/pirate_gun_handling/smg,
+ /datum/pirate_gun_handling/ballistic,
+ /datum/pirate_gun_handling/crossbow,
+ /datum/pirate_gun_handling/energy,
+ /datum/pirate_gun_handling,
+ ))
+ . += new handling_type
+
+/// How a pirate uses `gun`: the first handling whose gun type it is.
+/proc/pirate_gun_handling_for(obj/item/gun/gun)
+ for(var/datum/pirate_gun_handling/handling as anything in GLOB.pirate_gun_handlings)
+ if(istype(gun, handling.gun_type))
+ return handling
+ return GLOB.pirate_gun_handlings[length(GLOB.pirate_gun_handlings)]
/**
- * A pirate gun: the item in the hand, its rounds, and how it is fired. Read-only, shared by every
- * pirate carrying it; the ammunition and timers live on the pirate's /datum/component/pirate_gun.
+ * How a pirate fires one kind of gun. Read-only and shared; the timers live on the pirate's AI
+ * blackboard (BB_PIRATE_VOLLEY_LEFT, BB_PIRATE_WINDUP_UNTIL, BB_HUMAN_NPC_NEXT_SHOT).
*/
-/datum/pirate_gun_loadout
- /// The gun in the hand
- var/gun_type
- /// For a ballistic gun, what it is loaded with (null: the magazine's own rounds)
- var/ammo_type
- /// For an energy gun, the casing it fires (its beam and its sound)
- var/obj/item/ammo_casing/energy/energy_casing
- /// For an energy gun, shots in a cell
- var/energy_shots = 0
- /// Shots in one burst, and the time between them
- var/burst = 1
- var/burst_delay = 0.2 SECONDS
- /// From the start of one burst (or wind-up) to the next
- var/cooldown = 6 SECONDS
- var/reload_time = 2.5 SECONDS
- /// The spin-up or pump before a burst, if any; a hit during it spoils the burst
+/datum/pirate_gun_handling
+ /// The guns it covers
+ var/gun_type = /obj/item/gun
+ /// Pulls of the trigger in one volley, and the time between them
+ var/shots = 1
+ var/shot_gap = 0.3 SECONDS
+ /// From the last pull of a volley to the first of the next
+ var/volley_gap = 3 SECONDS
+ /// The spin-up or aim before a volley, if any: a hit during it spoils the volley
var/windup = 0
var/windup_sound
- var/fire_sound
- var/reload_sound = 'sound/items/weapons/gun/general/magazine_insert_full.ogg'
/// Tiles: it walks in to this before it fires (0: the usual gunner range)
var/close_range = 0
- /// What its carrier may shout on reloading
+ /// What it may shout as it changes magazines or loads shells
var/list/reload_lines = list("Reloading!", "Changing mags!", "Cover me, I'm reloading!")
- /// The real gun's numbers, for a ballistic gun (/datum/bounty_real_weapon)
- var/datum/bounty_real_weapon/weapon
-
-/datum/pirate_gun_loadout/New()
- . = ..()
- if(ispath(gun_type, /obj/item/gun/ballistic))
- weapon = bounty_real_weapon(gun_type, ammo_type)
- if(!fire_sound)
- fire_sound = weapon.fire_sound
- else if(energy_casing && !fire_sound)
- fire_sound = initial(energy_casing.fire_sound)
-
-/// Rounds in a full magazine, or shots in a full cell
-/datum/pirate_gun_loadout/proc/magazine_size()
- if(weapon)
- return max(1, weapon.magazine)
- return max(1, energy_shots)
-
-/// Projectiles one round fires
-/datum/pirate_gun_loadout/proc/pellets()
- if(weapon)
- return max(1, weapon.pellets)
- return max(1, initial(energy_casing.pellets))
-
-/// A new projectile of one round (one pellet of a shell) at `start`, carrying the real round's numbers
-/datum/pirate_gun_loadout/proc/make_projectile(turf/start)
- if(weapon)
- if(!weapon.round_type)
- return null
- var/obj/projectile/bullet = new weapon.round_type(start)
- weapon.load(bullet)
- return bullet
- var/projectile_type = initial(energy_casing.projectile_type)
- return projectile_type ? new projectile_type(start) : null
-
-/// Degrees one projectile strays
-/datum/pirate_gun_loadout/proc/shot_spread()
- if(weapon)
- return weapon.shot_spread()
- var/variance = initial(energy_casing.variance)
- return variance ? round((rand() - 0.5) * variance) : 0
-
-/// Energy gun (lethal): two beams every six seconds, twelve shots to a cell
-/datum/pirate_gun_loadout/energy_gun
- gun_type = /obj/item/gun/energy/e_gun/lethal
- energy_casing = /obj/item/ammo_casing/energy/laser
- energy_shots = 12
- burst = 2
- cooldown = 6 SECONDS
- reload_time = 3 SECONDS
- reload_sound = 'sound/items/weapons/gun/general/magazine_insert_empty.ogg'
- reload_lines = list("Swapping cells!", "Cell's dry!", "Cover me!")
-
-/// Laser rifle: as the energy gun, with a bigger cell
-/datum/pirate_gun_loadout/laser_rifle
- gun_type = /obj/item/gun/energy/laser
- energy_casing = /obj/item/ammo_casing/energy/lasergun
- energy_shots = 16
- burst = 2
- cooldown = 6 SECONDS
- reload_time = 3 SECONDS
- reload_sound = 'sound/items/weapons/gun/general/magazine_insert_empty.ogg'
- reload_lines = list("Swapping cells!", "Cell's dry!", "Cover me!")
-
-/// Makarov: a quick pair of 9mm every seven seconds, a reload every six pairs
-/datum/pirate_gun_loadout/pistol
+ /// What it may shout when the gun runs dry and can't be reloaded
+ var/list/dry_lines
+
+/// Energy guns: two beams every six seconds. A cell can't be changed by hand, so a dry one is put away.
+/datum/pirate_gun_handling/energy
+ gun_type = /obj/item/gun/energy
+ shots = 2
+ shot_gap = 0.2 SECONDS
+ volley_gap = 6 SECONDS
+ reload_lines = null
+ dry_lines = list("Cell's dry!", "Cover me!")
+
+/// The medieval crossbow: one bolt every six seconds. It draws itself again.
+/datum/pirate_gun_handling/crossbow
+ gun_type = /obj/item/gun/energy/recharge
+ shots = 1
+ volley_gap = 6 SECONDS
+ reload_lines = null
+
+/// Any other bullet gun: one shot every three seconds.
+/datum/pirate_gun_handling/ballistic
+ gun_type = /obj/item/gun/ballistic
+
+/// Pistols: a quick pair every seven seconds.
+/datum/pirate_gun_handling/pistol
gun_type = /obj/item/gun/ballistic/automatic/pistol
- burst = 2
- burst_delay = 0.3 SECONDS
- cooldown = 7 SECONDS
- reload_time = 2 SECONDS
- reload_sound = 'sound/items/weapons/gun/pistol/mag_insert.ogg'
-
-/// Uzi: a five-round string after a short wind-up, every seven seconds
-/datum/pirate_gun_loadout/smg
- gun_type = /obj/item/gun/ballistic/automatic/mini_uzi
- burst = 5
- burst_delay = 0.1 SECONDS
- cooldown = 7 SECONDS
- reload_time = 2.5 SECONDS
+ shots = 2
+ shot_gap = 0.3 SECONDS
+ volley_gap = 7 SECONDS
+
+/// SMGs: spins up, then three bursts, every seven seconds.
+/datum/pirate_gun_handling/smg
+ gun_type = /obj/item/gun/ballistic/automatic
+ shots = 3
+ shot_gap = 0.3 SECONDS
+ volley_gap = 7 SECONDS
windup = 0.4 SECONDS
windup_sound = 'sound/items/weapons/gun/smg/smgrack.ogg'
-/// Pump shotgun with buckshot: walks in close, pumps, and fires a shell every four seconds
-/datum/pirate_gun_loadout/shotgun
+/// Pump shotguns: walks in close, aims a moment and fires a shell every four seconds. The pump after
+/// each shot is the gun's own (the AI racks it as a player does).
+/datum/pirate_gun_handling/shotgun
gun_type = /obj/item/gun/ballistic/shotgun
- ammo_type = /obj/item/ammo_casing/shotgun/buckshot
- burst = 1
- cooldown = 4 SECONDS
- reload_time = 3 SECONDS
+ shots = 1
+ volley_gap = 4 SECONDS
windup = 0.4 SECONDS
- windup_sound = 'sound/items/weapons/gun/shotgun/rack.ogg'
- reload_sound = 'sound/items/weapons/gun/shotgun/insert_shell.ogg'
close_range = 3
reload_lines = list("Reloading!", "Loading shells!", "Cover me!")
-
-// ===== ARMING =====
-
-/// The loadout weights for `gunner`'s faction: type => weight, or null to keep its own gun
-/proc/pirate_gun_weights_for(mob/living/basic/gunner)
- var/mob/living/basic/trooper/pirate/faction/faction_pirate = gunner
- if(istype(faction_pirate))
- if(faction_pirate.crew_keeps_gun)
- return null
- return faction_pirate.crew_gun_weights || GLOB.pirate_gun_default_weights
- if(istype(gunner, /mob/living/basic/trooper/pirate))
- return GLOB.pirate_gun_default_weights
- return null
-
-/**
- * Hands `gunner` a rolled pirate gun in place of its stock ranged attack: the gun shows in its hand
- * and fires real rounds. Only a gunner whose faction has loadouts, and only once. Returns the loadout.
- */
-/proc/pirate_crew_arm(mob/living/basic/gunner, loadout_type)
- if(QDELETED(gunner) || gunner.GetComponent(/datum/component/pirate_gun))
- return null
- if(!gunner.GetComponent(/datum/component/ranged_attacks))
- return null
- if(!loadout_type)
- var/list/weights = pirate_gun_weights_for(gunner)
- if(!length(weights))
- return null
- loadout_type = pick_weight(weights)
- var/datum/pirate_gun_loadout/loadout = GLOB.pirate_gun_loadouts[loadout_type]
- if(!loadout)
- return null
- qdel(gunner.GetComponent(/datum/component/ranged_attacks))
- gunner.AddComponent(/datum/component/pirate_gun, loadout)
- var/mob/living/basic/trooper/trooper = gunner
- if(istype(trooper))
- trooper.r_hand = loadout.gun_type
- if(trooper.use_dynamic_appearance)
- apply_dynamic_human_appearance(trooper, mob_spawn_path = trooper.mob_spawner, r_hand = trooper.r_hand, l_hand = trooper.l_hand)
- return loadout
-
-/// The pirate gun `gunner` carries, if any
-/proc/pirate_gun_of(mob/living/gunner)
- return gunner?.GetComponent(/datum/component/pirate_gun)
-
-// ===== THE GUN IN HAND =====
-
-/**
- * A pirate's gun in use: its ammunition and timers. The AI's ranged attack (RangedAttack()) asks it
- * to fire; it fires a burst when it's ready, winds up first if it has to, and reloads when empty.
- * Its timers check `serial`, so a spoiled or cancelled burst does nothing.
- */
-/datum/component/pirate_gun
- var/datum/pirate_gun_loadout/loadout
- /// Rounds left in the magazine
- var/ammo = 0
- /// world.time it may start the next burst or wind-up
- var/next_fire_at = 0
- /// world.time the reload is done
- var/reloading_until = 0
- /// Winding up now
- var/winding = FALSE
- /// Goes up with every burst, wind-up and fumble, so stale timers do nothing
- var/serial = 0
- /// What it's aimed at
- var/datum/weakref/aim_ref
-
-/datum/component/pirate_gun/Initialize(datum/pirate_gun_loadout/loadout)
- if(!isbasicmob(parent) || !istype(loadout))
- return COMPONENT_INCOMPATIBLE
- src.loadout = loadout
- ammo = loadout.magazine_size()
-
-/datum/component/pirate_gun/Destroy(force)
- serial++
- loadout = null
- aim_ref = null
- return ..()
-
-/datum/component/pirate_gun/RegisterWithParent()
- . = ..()
- ADD_TRAIT(parent, TRAIT_SUBTREE_REQUIRED_OPERATIONAL_DATUM, type)
- RegisterSignal(parent, COMSIG_MOB_ATTACK_RANGED, PROC_REF(on_ranged_attack))
- RegisterSignal(parent, COMSIG_MOB_AFTER_APPLY_DAMAGE, PROC_REF(on_damaged))
-
-/datum/component/pirate_gun/UnregisterFromParent()
- . = ..()
- UnregisterSignal(parent, list(COMSIG_MOB_ATTACK_RANGED, COMSIG_MOB_AFTER_APPLY_DAMAGE))
- REMOVE_TRAIT(parent, TRAIT_SUBTREE_REQUIRED_OPERATIONAL_DATUM, type)
-
-/datum/component/pirate_gun/proc/on_ranged_attack(mob/living/basic/source, atom/target, modifiers)
- SIGNAL_HANDLER
- try_fire(target)
-
-/// A hit during the wind-up spoils it: nothing fires, and the next try waits a moment
-/datum/component/pirate_gun/proc/on_damaged(mob/living/source, damage_dealt)
- SIGNAL_HANDLER
- if(!winding || damage_dealt <= 0)
- return
- serial++
- winding = FALSE
- next_fire_at = max(next_fire_at, world.time + 1 SECONDS)
-
-/datum/component/pirate_gun/proc/ready()
- return !winding && world.time >= next_fire_at
-
-/datum/component/pirate_gun/proc/is_reloading()
- return world.time < reloading_until
-
-/datum/component/pirate_gun/proc/can_fire(mob/living/owner)
- return owner && owner.stat == CONSCIOUS && isturf(owner.loc) && !HAS_TRAIT(owner, TRAIT_INCAPACITATED) && !HAS_TRAIT(owner, TRAIT_HANDS_BLOCKED)
-
-/// Starts a burst at `target`, after the wind-up if it has one. TRUE if it started.
-/datum/component/pirate_gun/proc/try_fire(atom/target)
- var/mob/living/owner = parent
- if(!can_fire(owner) || !ready() || QDELETED(target))
- return FALSE
- if(loadout.close_range && get_dist(owner, target) > loadout.close_range)
- return FALSE
- aim_ref = WEAKREF(target)
- serial++
- owner.face_atom(target)
- if(loadout.windup)
- winding = TRUE
- next_fire_at = world.time + loadout.windup + loadout.cooldown
- if(loadout.windup_sound)
- playsound(owner, loadout.windup_sound, 50, TRUE)
- addtimer(CALLBACK(src, PROC_REF(finish_windup), serial), loadout.windup, TIMER_DELETE_ME)
- return TRUE
- fire_burst()
- return TRUE
-
-/datum/component/pirate_gun/proc/finish_windup(fire_serial)
- if(fire_serial != serial || !winding)
- return
- winding = FALSE
- if(can_fire(parent))
- fire_burst()
-
-/// A burst: as many shots as the magazine has left, then a reload if it's spent
-/datum/component/pirate_gun/proc/fire_burst()
- var/shots = clamp(loadout.burst, 1, ammo)
- ammo -= shots
- next_fire_at = max(next_fire_at, world.time + loadout.cooldown)
- var/fire_serial = serial
- shoot_once(fire_serial)
- for(var/i in 2 to shots)
- addtimer(CALLBACK(src, PROC_REF(shoot_once), fire_serial), (i - 1) * loadout.burst_delay, TIMER_DELETE_ME)
- if(ammo <= 0)
- start_reload((shots - 1) * loadout.burst_delay)
-
-/// One round of the burst under `fire_serial`: every pellet of it
-/datum/component/pirate_gun/proc/shoot_once(fire_serial)
- if(fire_serial != serial)
- return null
- var/mob/living/owner = parent
- var/atom/target = aim_ref?.resolve()
- if(!can_fire(owner) || QDELETED(target))
- return null
- if(isliving(target))
- var/mob/living/living_target = target
- if(living_target.stat == DEAD)
- return null
- owner.face_atom(target)
- var/turf/start = get_turf(owner)
- if(!start || start == get_turf(target))
- return null
- var/obj/projectile/first
- for(var/pellet in 1 to loadout.pellets())
- var/obj/projectile/shot = loadout.make_projectile(start)
- if(!shot)
- break
- shot.firer = owner
- shot.fired_from = owner
- shot.ignored_factions = owner.faction?.Copy()
- shot.aim_projectile(target, owner, null, loadout.shot_spread())
- if(QDELETED(shot))
- continue
- shot.fire()
- if(!first && !QDELETED(shot))
- first = shot
- if(loadout.fire_sound)
- playsound(owner, loadout.fire_sound, 60, TRUE)
- SEND_SIGNAL(owner, COMSIG_BASICMOB_POST_ATTACK_RANGED, target, null)
- return first
-
-/// A fresh magazine, ready `delay` + the reload time from now
-/datum/component/pirate_gun/proc/start_reload(delay = 0)
- ammo = loadout.magazine_size()
- reloading_until = world.time + delay + loadout.reload_time
- next_fire_at = max(next_fire_at, reloading_until)
- addtimer(CALLBACK(src, PROC_REF(reload_effects)), delay, TIMER_DELETE_ME)
-
-/datum/component/pirate_gun/proc/reload_effects()
- var/mob/living/owner = parent
- if(QDELETED(owner) || owner.stat != CONSCIOUS)
- return
- if(loadout.reload_sound)
- playsound(owner, loadout.reload_sound, 40, TRUE)
- if(length(loadout.reload_lines) && prob(PIRATE_CREW_RELOAD_BARK_CHANCE))
- INVOKE_ASYNC(owner, TYPE_PROC_REF(/atom/movable, say), message = pick(loadout.reload_lines), forced = "pirate crew")
-
-/// For the admin status readout
-/datum/component/pirate_gun/proc/status_text()
- var/obj/item/gun_path = loadout.gun_type
- return "[initial(gun_path.name)] [ammo]/[loadout.magazine_size()][is_reloading() ? " reloading" : ""][winding ? " winding up" : ""]"
diff --git a/voidcrew/modules/npc_ships/code/spawner_subsystem.dm b/voidcrew/modules/npc_ships/code/spawner_subsystem.dm
index 2391f08dc8b..f74882420fa 100644
--- a/voidcrew/modules/npc_ships/code/spawner_subsystem.dm
+++ b/voidcrew/modules/npc_ships/code/spawner_subsystem.dm
@@ -258,12 +258,18 @@ SUBSYSTEM_DEF(npc_ships)
if(ship.spawner_resolved || ship.abandoned)
continue
if(!ship.crew_ever_spawned)
+ // Human crews are built a body at a time (spawn_human_npc()); still queued is not malformed
+ if(ship.crew_pending())
+ continue
if(!(REF(ship) in logged_malformed))
logged_malformed += REF(ship)
log_world("SSnpc_ships: [ship.name] has no crew roster (spawn_crew failed?) - it holds its pool slot and will never auto-resolve")
continue
- // Put spaced survivors out of their misery before the census reads them
- ship.sweep_spaced_crew()
+ // A crewman spaced off the hull no longer counts as aboard; the space kills him or it doesn't
+ // (no death is forced, defaults PI-3), and one adrift with nobody to see him is cleaned up by
+ // his crew (pirate_crew.dm). Crew still queued to be built keep the hull's slot.
+ if(ship.crew_pending())
+ continue
if(ship.count_live_crew_aboard() <= 0)
ship.notify_spawner_resolved("crew wiped (reconcile)")
continue
diff --git a/voidcrew/modules/player_outposts/outpost_admin_prison.dm b/voidcrew/modules/player_outposts/outpost_admin_prison.dm
index 11ebecc5d59..841fb028771 100644
--- a/voidcrew/modules/player_outposts/outpost_admin_prison.dm
+++ b/voidcrew/modules/player_outposts/outpost_admin_prison.dm
@@ -94,7 +94,7 @@ GLOBAL_LIST_INIT(outpost_admin_prison_crew_modes, list("auto" = null, "home" = T
record(user, home, "[open ? "open" : "close"] prison intake")
if("prison_spawn")
// Forced: an admin spawn ignores the cell's ready time and a running experiment
- var/mob/living/basic/outpost_prisoner/arrival = prison.admit_next(TRUE)
+ var/mob/living/carbon/human/npc/outpost_prisoner/arrival = prison.admit_next(TRUE)
if(!arrival)
error = "No free cell."
return
@@ -108,7 +108,7 @@ GLOBAL_LIST_INIT(outpost_admin_prison_crew_modes, list("auto" = null, "home" = T
return
record(user, home, "fill [count] prison cell\s")
if("prison_release", "prison_kill", "prison_remove", "prison_set", "prison_fight", "prison_breakout", "prison_wreck")
- var/mob/living/basic/outpost_prisoner/prisoner = locate(params["ref"]) in prison.prisoners
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = locate(params["ref"]) in prison.prisoners
if(QDELETED(prisoner))
error = "That prisoner is gone."
return
@@ -126,7 +126,7 @@ GLOBAL_LIST_INIT(outpost_admin_prison_crew_modes, list("auto" = null, "home" = T
if(!prisoner.can_join_riot() || prisoner.trouble)
error = "That prisoner can't fight now."
return
- var/mob/living/basic/outpost_prisoner/partner = prison.nearest_fight_partner(prisoner)
+ var/mob/living/carbon/human/npc/outpost_prisoner/partner = prison.nearest_fight_partner(prisoner)
if(!partner)
error = "No other prisoner can fight."
return
@@ -284,7 +284,7 @@ GLOBAL_LIST_INIT(outpost_admin_prison_crew_modes, list("auto" = null, "home" = T
if(!istext(form) || !(form in list("hulk", "fly", "nightmare", "changeling")))
error = "Invalid experiment form."
return
- var/mob/living/basic/outpost_prisoner/subject = locate(params["ref"]) in prison.prisoners
+ var/mob/living/carbon/human/npc/outpost_prisoner/subject = locate(params["ref"]) in prison.prisoners
if(QDELETED(subject))
error = "That prisoner is gone."
return
@@ -418,7 +418,7 @@ GLOBAL_LIST_INIT(outpost_admin_prison_crew_modes, list("auto" = null, "home" = T
for(var/datum/outpost_prison_cell/cell as anything in cells)
cell_rows += list(list("number" = cell.number, "occupant_ref" = cell.occupant ? REF(cell.occupant) : null))
var/list/prisoner_rows = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner as anything in roster_order())
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner as anything in roster_order())
prisoner_rows += list(list(
"ref" = REF(prisoner),
"name" = prisoner.real_name,
@@ -440,7 +440,7 @@ GLOBAL_LIST_INIT(outpost_admin_prison_crew_modes, list("auto" = null, "home" = T
"mood" = round(prisoner.mood),
"state" = prisoner.trouble_state(),
"loose_left" = prisoner.loose_seconds_shown(),
- "cuffed" = !!prisoner.cuffs,
+ "cuffed" = !!prisoner.handcuffed,
"lockdown_left" = max(0, round(prisoner.lockdown_left)),
))
var/list/trouble_block = trouble_payload()
@@ -519,11 +519,11 @@ GLOBAL_LIST_INIT(outpost_admin_prison_crew_modes, list("auto" = null, "home" = T
return null
/// Where their care falls between no pay and full pay, 0 to 1 (section 1's G(care))
-/mob/living/basic/outpost_prisoner/proc/admin_care_grade()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/admin_care_grade()
return clamp((care() - OUTPOST_PRISON_GRADE_FLOOR) / (OUTPOST_PRISON_GRADE_FULL - OUTPOST_PRISON_GRADE_FLOOR), 0, 1)
/// What they are up to, in a few words
-/mob/living/basic/outpost_prisoner/proc/admin_activity_text()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/admin_activity_text()
if(stat == DEAD)
return "dead"
if(phase == PRISONER_ARRIVING)
@@ -532,9 +532,9 @@ GLOBAL_LIST_INIT(outpost_admin_prison_crew_modes, list("auto" = null, "home" = T
return "beaming out"
if(pulledby)
return "being dragged"
- if(beaten_left > 0)
- return "beaten ([round(beaten_left)] s)"
- if(cuffs)
+ if(beaten)
+ return HAS_TRAIT(src, TRAIT_CRITICAL_CONDITION) ? "beaten, in crit" : "beaten"
+ if(handcuffed)
if(trouble == PRISONER_TROUBLE_LOOSE)
return "cuffed, loose"
return is_rioting() ? "cuffed, rioting" : "cuffed"
@@ -559,18 +559,17 @@ GLOBAL_LIST_INIT(outpost_admin_prison_crew_modes, list("auto" = null, "home" = T
return text
/// Sets one of a prisoner's values. Returns FALSE if it can't take it.
-/datum/outpost_prison/proc/admin_set(mob/living/basic/outpost_prisoner/prisoner, field, value)
+/datum/outpost_prison/proc/admin_set(mob/living/carbon/human/npc/outpost_prisoner/prisoner, field, value)
switch(field)
if("hunger")
prisoner.set_hunger(clamp(value, 0, 100))
if("grime")
prisoner.set_uniform_grime(clamp(value, 0, 100))
if("health")
- // 1 to 100 percent; killing has its own button.
+ // 1 to 100 percent; killing has its own button. Bruising over the limbs, measured as it lands.
if(prisoner.stat == DEAD)
return FALSE
- var/target_loss = prisoner.maxHealth * (100 - clamp(value, 1, 100)) / 100
- prisoner.adjustBruteLoss(target_loss - prisoner.getBruteLoss(), forced = TRUE)
+ outpost_prison_set_health(prisoner, prisoner.maxHealth * clamp(value, 1, 100) / 100)
if("sentence")
if(prisoner.stat == DEAD || prisoner.phase != PRISONER_PRESENT)
return FALSE
@@ -598,7 +597,7 @@ GLOBAL_LIST_INIT(outpost_admin_prison_crew_modes, list("auto" = null, "home" = T
/// Applies one change to every living prisoner. Returns how many.
/datum/outpost_prison/proc/admin_all(what)
var/count = 0
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.stat == DEAD || prisoner.phase == PRISONER_LEAVING)
continue
count++
@@ -612,13 +611,11 @@ GLOBAL_LIST_INIT(outpost_admin_prison_crew_modes, list("auto" = null, "home" = T
if("clean")
prisoner.set_uniform_grime(0)
if("hurt")
- // A real hit, so they bleed, never a killing one.
- var/damage = min(30, prisoner.health - 1)
- if(damage > 0)
- prisoner.apply_damage(damage, BRUTE)
+ // A real hit on one limb, so they bruise and may bleed (defaults PR-27).
+ prisoner.apply_damage(30, BRUTE, pick(BODY_ZONE_CHEST, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG))
if("heal")
- prisoner.adjustBruteLoss(-prisoner.getBruteLoss(), forced = TRUE)
- prisoner.setStaminaLoss(0)
+ // tg's own full heal of the body (damage, wounds, blood), cuffs and the rest left as they are.
+ prisoner.fully_heal(HEAL_DAMAGE | HEAL_WOUNDS | HEAL_BLOOD | HEAL_LIMBS | HEAL_ORGANS)
if("enrage")
// Low enough to threaten staff, fight, and riot once it has held for half a minute.
prisoner.set_mood(10)
@@ -636,7 +633,7 @@ GLOBAL_LIST_INIT(outpost_admin_prison_crew_modes, list("auto" = null, "home" = T
end_fight(brawl)
if(riot_active)
end_riot()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.stat == DEAD || prisoner.phase == PRISONER_LEAVING)
continue
prisoner.cancel_threat()
@@ -651,10 +648,10 @@ GLOBAL_LIST_INIT(outpost_admin_prison_crew_modes, list("auto" = null, "home" = T
return count
/// The nearest other prisoner who could fight, for the admin fight button
-/datum/outpost_prison/proc/nearest_fight_partner(mob/living/basic/outpost_prisoner/prisoner)
- var/mob/living/basic/outpost_prisoner/nearest
+/datum/outpost_prison/proc/nearest_fight_partner(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
+ var/mob/living/carbon/human/npc/outpost_prisoner/nearest
var/nearest_distance = INFINITY
- for(var/mob/living/basic/outpost_prisoner/other in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/other in prisoners)
if(other == prisoner || !other.can_join_riot() || other.trouble)
continue
var/distance = get_dist(prisoner, other)
@@ -664,10 +661,10 @@ GLOBAL_LIST_INIT(outpost_admin_prison_crew_modes, list("auto" = null, "home" = T
return nearest
/// What the admin panel shows as their state
-/mob/living/basic/outpost_prisoner/proc/trouble_state()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/trouble_state()
if(trouble == PRISONER_TROUBLE_LOOSE)
return "loose"
- if(beaten_left > 0)
+ if(beaten)
return "beaten"
// is_rioting() covers a breakout too; the panel tells them apart, as admin_activity_text() does
if(trouble == PRISONER_TROUBLE_BREAKOUT)
@@ -680,7 +677,7 @@ GLOBAL_LIST_INIT(outpost_admin_prison_crew_modes, list("auto" = null, "home" = T
return trouble || "normal"
/// Seconds left loose, shown only while they are out of the cell block
-/mob/living/basic/outpost_prisoner/proc/loose_seconds_shown()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/loose_seconds_shown()
if(trouble != PRISONER_TROUBLE_LOOSE || stat == DEAD || prison?.in_cell_block(src))
return null
return max(0, round(loose_left))
diff --git a/voidcrew/modules/player_outposts/outpost_npc_looks.dm b/voidcrew/modules/player_outposts/outpost_npc_looks.dm
index d31bce7a67e..288938ffd8a 100644
--- a/voidcrew/modules/player_outposts/outpost_npc_looks.dm
+++ b/voidcrew/modules/player_outposts/outpost_npc_looks.dm
@@ -1,8 +1,13 @@
/**
* # Outpost NPC looks
*
- * Human-looking basic mobs on outposts (prisoners, guards, and ambient NPCs) wear an outfit on
- * a human body. tg's set_dynamic_human_appearance() builds that body on a fixed, bald, pale dummy
+ * Two kinds of look live here.
+ *
+ * Faces for real bodies (/datum/outpost_npc_look, at the bottom of the file): ambient NPCs are real
+ * human bodies and wear one randomly rolled face for life; what they hold is a real item in hand.
+ *
+ * Dressed appearances for the basic mobs that still copy a picture of a person onto themselves
+ * (the rest of the file): they wear an outfit on a human body. tg's set_dynamic_human_appearance() builds that body on a fixed, bald, pale dummy
* and caches one appearance per outfit, so everyone in the same outfit has the same face and a
* male body whatever their gender.
*
@@ -193,6 +198,83 @@ GLOBAL_LIST_EMPTY(outpost_npc_looks)
return style_name
return null
+// =========================================================================
+// FACES FOR REAL BODIES
+// =========================================================================
+
+/**
+ * One person's face, kept as the features a real human body needs to look like them: gender and
+ * physique, skin tone, hair and facial hair (styles and colours) and eye colour. Ambient NPCs are
+ * human bodies (voidcrew/modules/ambient_npcs/); each rolls one of these when it is made and wears
+ * it for life, so the same person shows idle, holding a mop, welding, and dead. Strays keep theirs
+ * across visits (stray_identity()), so the same person comes back. The appearance cache above is
+ * for the basic mobs that still copy a dressed look onto themselves (bounty companions and goons).
+ */
+/datum/outpost_npc_look
+ /// MALE or FEMALE (also the body's physique)
+ var/gender = MALE
+ var/skin_tone = "caucasian1"
+ var/hairstyle = "Bald"
+ var/hair_color = "#000000"
+ var/facial_hairstyle = "Shaved"
+ var/facial_hair_color = "#000000"
+ var/eye_color = "#000000"
+
+/// A random person of `gender` (MALE or FEMALE; anything else is male), rolled the way randomize_human_normie() rolls one
+/proc/new_outpost_npc_person(gender = MALE)
+ var/datum/outpost_npc_look/person = new
+ person.gender = gender == FEMALE ? FEMALE : MALE
+ person.skin_tone = pick(GLOB.skin_tones)
+ person.hairstyle = outpost_npc_hairstyle(person.gender) || "Bald"
+ if(person.gender == MALE && prob(OUTPOST_NPC_FACIAL_HAIR_CHANCE))
+ person.facial_hairstyle = outpost_npc_facial_hairstyle() || "Shaved"
+ person.hair_color = random_hair_color()
+ person.facial_hair_color = person.hair_color
+ person.eye_color = random_eye_color()
+ return person
+
+/// The face `body` wears now, as a look that can be put on another body
+/proc/outpost_npc_look_of(mob/living/carbon/human/body)
+ var/datum/outpost_npc_look/person = new
+ person.gender = body.gender == FEMALE ? FEMALE : MALE
+ person.skin_tone = body.skin_tone
+ person.hairstyle = body.hairstyle
+ person.hair_color = body.hair_color
+ person.facial_hairstyle = body.facial_hairstyle
+ person.facial_hair_color = body.facial_hair_color
+ person.eye_color = body.eye_color_left
+ return person
+
+/// A copy, so two bodies never share one look datum
+/datum/outpost_npc_look/proc/copy()
+ var/datum/outpost_npc_look/twin = new
+ twin.gender = gender
+ twin.skin_tone = skin_tone
+ twin.hairstyle = hairstyle
+ twin.hair_color = hair_color
+ twin.facial_hairstyle = facial_hairstyle
+ twin.facial_hair_color = facial_hair_color
+ twin.eye_color = eye_color
+ return twin
+
+/// Puts this face on `body`, undressed parts bare (no underwear), and redraws it
+/datum/outpost_npc_look/proc/apply_to(mob/living/carbon/human/body)
+ if(QDELETED(body))
+ return
+ body.gender = gender
+ body.physique = gender
+ body.skin_tone = skin_tone
+ body.set_hairstyle(hairstyle, update = FALSE)
+ body.set_haircolor(hair_color, update = FALSE)
+ body.set_facial_hairstyle(facial_hairstyle, update = FALSE)
+ body.set_facial_haircolor(facial_hair_color, update = FALSE)
+ body.set_eye_color(eye_color)
+ body.underwear = "Nude"
+ body.undershirt = "Nude"
+ body.socks = "Nude"
+ // Without is_creating the limbs keep the skin tone they were made with
+ body.update_body(is_creating = TRUE)
+
#undef OUTPOST_NPC_LOOK_COUNT
#undef OUTPOST_NPC_FACIAL_HAIR_CHANCE
#undef OUTPOST_NPC_HELD_LOOKS_MAX
diff --git a/voidcrew/modules/player_outposts/outpost_prison_ambience.dm b/voidcrew/modules/player_outposts/outpost_prison_ambience.dm
index b85a6cd7f75..d6756ea9640 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_ambience.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_ambience.dm
@@ -23,7 +23,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_examine_placeholders, list("{They}", "{they}",
// ===== THE PRISONER =====
-/mob/living/basic/outpost_prisoner
+/mob/living/carbon/human/npc/outpost_prisoner
/// Picks their examine line within a mood band, so looking twice reads the same
var/ambience_examine_seed = 0
/// Running after they turned to look at staff coming in, after humming, and after a whisper in a huddle
@@ -32,14 +32,14 @@ GLOBAL_LIST_INIT(outpost_prisoner_examine_placeholders, list("{They}", "{they}",
COOLDOWN_DECLARE(ambience_huddle_cooldown)
/// Hooks up the prisoner's side of the ambience; called from setup_extras(). Nothing needs hooking: the prison drives it from its tick, and examine is the override below.
-/mob/living/basic/outpost_prisoner/proc/setup_ambience()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/setup_ambience()
return
/**
* Their mood in words, by band and personality, and one line on how they are kept when something
* shows (hurt, a dirty jumpsuit, shut in, due out), then every package's own lines. Never a number.
*/
-/mob/living/basic/outpost_prisoner/examine(mob/user)
+/mob/living/carbon/human/npc/outpost_prisoner/examine(mob/user)
. = ..()
if(stat == DEAD || phase != PRISONER_PRESENT)
return
@@ -54,7 +54,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_examine_placeholders, list("{They}", "{they}",
. += span_notice(line)
/// A closer look: what they are in for, their cell, roughly how long they have left, and their birthday until the yard has had the cake
-/mob/living/basic/outpost_prisoner/examine_more(mob/user)
+/mob/living/carbon/human/npc/outpost_prisoner/examine_more(mob/user)
. = ..()
if(stat == DEAD || !prison)
return
@@ -69,14 +69,14 @@ GLOBAL_LIST_INIT(outpost_prisoner_examine_placeholders, list("{They}", "{they}",
. += span_notice("It's [p_their()] birthday today.")
/// "a few minutes" or "about 25 minutes": their sentence left, rounded to OUTPOST_PRISONER_EXAMINE_ROUND_MINUTES
-/mob/living/basic/outpost_prisoner/proc/sentence_examine_text()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/sentence_examine_text()
var/minutes = sentence_left / 60
if(minutes < OUTPOST_PRISONER_EXAMINE_ROUND_MINUTES)
return "a few minutes"
return "about [round(minutes, OUTPOST_PRISONER_EXAMINE_ROUND_MINUTES)] minutes"
/// The "examine" key for their mood: the bands match the angry, threat, climb and tidy lines
-/mob/living/basic/outpost_prisoner/proc/mood_examine_band()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/mood_examine_band()
if(mood < PRISONER_THREAT_ANGRY_MOOD)
return "mood_0"
if(mood < PRISONER_THREAT_MOOD)
@@ -88,7 +88,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_examine_placeholders, list("{They}", "{they}",
return "mood_75"
/// A line on their mood, filled in, or null. Their own personality's lines come up more often than the shared ones.
-/mob/living/basic/outpost_prisoner/proc/mood_examine_line()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/mood_examine_line()
var/list/bands = outpost_prisoner_extra_dialogue("outpost_prison_security.json", "examine")
var/list/band = bands[mood_examine_band()]
if(!islist(band))
@@ -105,7 +105,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_examine_placeholders, list("{They}", "{they}",
return fill_examine_line(pool[(ambience_examine_seed % length(pool)) + 1])
/// Fills an examine line's pronouns ({They}, {their}, ...) and verb endings ({s}, {es}) for them
-/mob/living/basic/outpost_prisoner/proc/fill_examine_line(line)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/fill_examine_line(line)
if(!istext(line))
return null
line = replacetextEx(line, "{They}", p_They())
@@ -118,7 +118,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_examine_placeholders, list("{They}", "{they}",
return line
/// One line on how they are kept, the most pressing first, or null when nothing shows
-/mob/living/basic/outpost_prisoner/proc/state_examine_line()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/state_examine_line()
var/health_percent = health_factor()
if(health_percent < PRISONER_BLEED_BELOW)
return "[p_They()] look[p_s()] badly hurt."
@@ -190,7 +190,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_examine_placeholders, list("{They}", "{they}",
/// Whether another prisoner is too close to `tile` to sulk there
/datum/prisoner_activity/sulk/proc/sulk_company_near(turf/tile)
- for(var/mob/living/basic/outpost_prisoner/other in prisoner.prison.prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/other in prisoner.prison.prisoners)
if(other != prisoner && get_dist(other, tile) <= OUTPOST_PRISONER_SULK_ALONE_RANGE)
return TRUE
return FALSE
@@ -242,7 +242,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_examine_placeholders, list("{They}", "{they}",
* wing); TRUE drops it. Small talk, remarks to staff, conversations and chatter about what they
* are doing go quiet; complaints and threats about the wing still get said.
*/
-/datum/outpost_prison/proc/speech_hushed(mob/living/basic/outpost_prisoner/speaker, context)
+/datum/outpost_prison/proc/speech_hushed(mob/living/carbon/human/npc/outpost_prisoner/speaker, context)
if(stage != PRISON_STAGE_RESTLESS)
return FALSE
var/static/list/always_hushed = list("idle", "staff_near", "conversation")
@@ -289,7 +289,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_examine_placeholders, list("{They}", "{they}",
var/spoken = FALSE
var/emotes = 0
var/reacted = 0
- for(var/mob/living/basic/outpost_prisoner/prisoner in shuffle(prisoners))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in shuffle(prisoners))
if(!prisoner.ai_running() || !prisoner.routine_allowed() || prisoner.activity?.sleeping)
continue
if(!COOLDOWN_FINISHED(prisoner, ambience_notice_cooldown))
@@ -322,12 +322,12 @@ GLOBAL_LIST_INIT(outpost_prisoner_examine_placeholders, list("{They}", "{they}",
return reacted
/// A chat they are in waits a moment while they look over
-/datum/outpost_prison/proc/pause_chat_for_notice(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/pause_chat_for_notice(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/datum/prisoner_activity/chat/talk = prisoner.activity
if(!istype(talk))
return
if(istype(talk, /datum/prisoner_activity/chat/listen))
- var/mob/living/basic/outpost_prisoner/talker = talk.chat_partner()
+ var/mob/living/carbon/human/npc/outpost_prisoner/talker = talk.chat_partner()
talk = talker?.activity
if(!istype(talk) || istype(talk, /datum/prisoner_activity/chat/listen))
return
@@ -338,7 +338,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_examine_placeholders, list("{They}", "{they}",
/// Content prisoners now and then hum; while the wing is restless, the ones gathered in the yard whisper among themselves
/datum/outpost_prison/proc/yard_sounds_tick(seconds)
var/huddling = stage == PRISON_STAGE_RESTLESS && !riot_imminent && !riot_active
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.phase != PRISONER_PRESENT || prisoner.stat != CONSCIOUS || !prisoner.ai_running())
continue
if(huddling && istype(prisoner.activity, /datum/prisoner_activity/gather))
@@ -352,7 +352,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_examine_placeholders, list("{They}", "{they}",
* A content cheerful, chatty or quiet prisoner, awake and free, hums to themself, at most once per
* OUTPOST_PRISONER_HUM_COOLDOWN. Returns TRUE if they did.
*/
-/datum/outpost_prison/proc/try_hum(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/try_hum(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/static/list/hummers = list("cheerful", "chatty", "quiet")
if(prisoner.mood < OUTPOST_PRISONER_HUM_MOOD || !(prisoner.personality in hummers))
return FALSE
@@ -364,7 +364,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_examine_placeholders, list("{They}", "{they}",
return TRUE
/// A gathered prisoner whispers a huddle line, at most once per OUTPOST_PRISONER_HUDDLE_GAP. Returns TRUE if they did.
-/datum/outpost_prison/proc/try_huddle(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/try_huddle(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(!COOLDOWN_FINISHED(prisoner, ambience_huddle_cooldown))
return FALSE
var/line = prisoner.pick_line("huddle")
@@ -404,7 +404,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_examine_placeholders, list("{They}", "{they}",
ambience_chant_beats++
var/list/gathered = list()
var/list/slammers = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in shuffle(prisoners))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in shuffle(prisoners))
var/datum/prisoner_activity/gather/gathering = prisoner.activity
if(!istype(gathering) || !gathering.started || gathering.spot || !prisoner.ai_running() || !prisoner.routine_allowed())
continue
@@ -421,12 +421,12 @@ GLOBAL_LIST_INIT(outpost_prisoner_examine_placeholders, list("{They}", "{they}",
if(!(ambience_chant_beats % OUTPOST_PRISON_CHANT_LINE_EVERY))
var/list/voices = length(slammers) ? slammers : gathered
if(length(voices))
- var/mob/living/basic/outpost_prisoner/voice = pick(voices)
+ var/mob/living/carbon/human/npc/outpost_prisoner/voice = pick(voices)
voice.say_context("riot_chant")
return slammers
/// A mess table or a door beside `prisoner` to slam on, or null
-/datum/outpost_prison/proc/chant_surface(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/chant_surface(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/turf/here = get_turf(prisoner)
for(var/direction in GLOB.cardinals)
var/turf/beside = get_step(here, direction)
@@ -450,7 +450,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_examine_placeholders, list("{They}", "{they}",
return 0
ambience_roared = TRUE
var/roared = 0
- for(var/mob/living/basic/outpost_prisoner/rioter in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/rioter in prisoners)
if(!rioter.is_rioting() || rioter.stat != CONSCIOUS || rioter.phase != PRISONER_PRESENT || !rioter.ai_running())
continue
if(rioter.say_context("riot_roar"))
diff --git a/voidcrew/modules/player_outposts/outpost_prison_boss_moves.dm b/voidcrew/modules/player_outposts/outpost_prison_boss_moves.dm
index 3e259912edc..918d96de83f 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_boss_moves.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_boss_moves.dm
@@ -49,11 +49,11 @@
/// Weakrefs to guards the kingpin paid off, until they are back at work
var/list/boss_bribed_guards = list()
-/mob/living/basic/outpost_prisoner
+/mob/living/carbon/human/npc/outpost_prisoner
/// Their riot move, made the first time a riot needs it (boss_move_datum()), or null
var/datum/prison_boss_move/boss_move
-/mob/living/basic/outpost_prison_guard
+/mob/living/carbon/human/npc/outpost_prison_guard
/// world.time until which they stay out of a riot, paid off by the kingpin
var/prison_bribed_until = 0
@@ -88,7 +88,7 @@
boss_bribes_tick()
if(!trouble_enabled || !riot_active)
return
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
var/datum/prison_boss_move/move = prisoner.boss_move_datum()
if(!move)
continue
@@ -96,7 +96,7 @@
move.try_start()
/// A prisoner is leaving the roster (extras_prisoner_leaving()): their move stops
-/datum/outpost_prison/proc/boss_moves_prisoner_leaving(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/boss_moves_prisoner_leaving(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
QDEL_NULL(prisoner.boss_move)
/// The prison is being deleted (extras_destroy())
@@ -108,25 +108,25 @@
* cell, past the riot's wind-up, awake and on their feet, not held, climbing or batoned, with a member
* of the wing home and someone on the level. Uncuffed, or cuffed if `cuffed`.
*/
-/datum/outpost_prison/proc/boss_riot_ok(mob/living/basic/outpost_prisoner/prisoner, cuffed = FALSE)
+/datum/outpost_prison/proc/boss_riot_ok(mob/living/carbon/human/npc/outpost_prisoner/prisoner, cuffed = FALSE)
if(!trouble_enabled || !riot_active || riot_windup_left > 0 || !crew_home())
return FALSE
if(QDELETED(prisoner) || prisoner.prison != src || prisoner.stat != CONSCIOUS || !prisoner.riot_at_large())
return FALSE
if(!in_cell_block(prisoner) || !isturf(prisoner.loc) || !prisoner.ai_running())
return FALSE
- if(prisoner.is_down() || prisoner.pulledby || prisoner.climb_ref || prisoner.beaten_left > 0 || prisoner.surrendered_to_turret() || world.time < prisoner.baton_stop_until)
+ if(prisoner.is_down() || prisoner.pulledby || prisoner.climb_ref || prisoner.is_beaten() || prisoner.surrendered_to_turret() || world.time < prisoner.baton_stop_until)
return FALSE
- return cuffed ? !!prisoner.cuffs : !prisoner.cuffs
+ return cuffed ? !!prisoner.handcuffed : !prisoner.handcuffed
/// Whether a move of `prisoner`'s may land on `person`: awake staff the riot goes for, in the cell block where `prisoner` can get at them
-/datum/outpost_prison/proc/boss_may_hit(mob/living/basic/outpost_prisoner/prisoner, mob/living/person)
+/datum/outpost_prison/proc/boss_may_hit(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/person)
if(QDELETED(person) || person == prisoner || !is_outpost_prison_staff(person))
return FALSE
return in_cell_block(person) && !!prisoner.reachable?[get_turf(person)]
/// The nearest staff a move of `prisoner`'s may land on (boss_may_hit()) within `range` and in sight, or null
-/datum/outpost_prison/proc/boss_nearest_staff(mob/living/basic/outpost_prisoner/prisoner, range = PRISON_BOSS_SIGHT)
+/datum/outpost_prison/proc/boss_nearest_staff(mob/living/carbon/human/npc/outpost_prisoner/prisoner, range = PRISON_BOSS_SIGHT)
var/mob/living/nearest
var/nearest_distance = INFINITY
for(var/mob/living/person in view(range, prisoner))
@@ -151,7 +151,7 @@
// ===== THE PRISONER'S SIDE =====
/// Their riot move, made the first time it is asked for; null for anyone without one (bounty_boss_move_type())
-/mob/living/basic/outpost_prisoner/proc/boss_move_datum()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/boss_move_datum()
if(boss_move)
return boss_move
var/move_type = bounty_boss_move_type(bounty_record)
@@ -161,7 +161,7 @@
return boss_move
/// Whether they are winding up or in the middle of their move (or reeling from it), so they hold still (trouble_target())
-/mob/living/basic/outpost_prisoner/proc/boss_move_busy()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/boss_move_busy()
return !!boss_move && boss_move.busy_until > world.time
// ===== A MOVE =====
@@ -174,7 +174,7 @@
* call finish_windup(pending_serial) instead of waiting.
*/
/datum/prison_boss_move
- /// The prisoner whose move it is (/mob/living/basic/outpost_prisoner)
+ /// The prisoner whose move it is (/mob/living/carbon/human/npc/outpost_prisoner)
var/datum/weakref/prisoner_ref
/// How long it winds up, telegraphing, before anything happens
var/windup = 1 SECONDS
@@ -196,7 +196,7 @@
/// Weakrefs to the wind-up's marks still showing
var/list/telegraphs
-/datum/prison_boss_move/New(mob/living/basic/outpost_prisoner/owner)
+/datum/prison_boss_move/New(mob/living/carbon/human/npc/outpost_prisoner/owner)
. = ..()
prisoner_ref = WEAKREF(owner)
@@ -207,18 +207,18 @@
/// The prisoner, while they exist
/datum/prison_boss_move/proc/owner()
- var/mob/living/basic/outpost_prisoner/prisoner = prisoner_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = prisoner_ref?.resolve()
return QDELETED(prisoner) ? null : prisoner
/// Every tick of a riot, before try_start(): anything the move keeps track of
-/datum/prison_boss_move/proc/observe(mob/living/basic/outpost_prisoner/prisoner)
+/datum/prison_boss_move/proc/observe(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
return
/// Starts the move if it is ready, the boss may use it and there is something to use it on. Returns TRUE if it started.
/datum/prison_boss_move/proc/try_start()
if(pending_serial || world.time < busy_until || world.time < ready_at)
return FALSE
- var/mob/living/basic/outpost_prisoner/prisoner = owner()
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = owner()
var/datum/outpost_prison/prison = prisoner?.prison
if(!prison || (once_per_riot && used_in_riot == prison.boss_riot_serial))
return FALSE
@@ -243,14 +243,14 @@
return TRUE
/// Whether the boss is still free to finish the wind-up under way
-/datum/prison_boss_move/proc/may_finish(mob/living/basic/outpost_prisoner/prisoner)
+/datum/prison_boss_move/proc/may_finish(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
return !!prisoner?.prison?.boss_riot_ok(prisoner, needs_cuffs)
/// During the wind-up: stopped if the boss is no longer free to finish it (knocked down, dragged, cuffed, out of the riot)
/datum/prison_boss_move/proc/watch_windup(serial)
if(!serial || serial != pending_serial)
return FALSE
- var/mob/living/basic/outpost_prisoner/prisoner = owner()
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = owner()
if(!may_finish(prisoner))
cancel()
interrupted(prisoner)
@@ -266,7 +266,7 @@
if(!serial || serial != pending_serial)
return FALSE
var/atom/target = pending_target?.resolve()
- var/mob/living/basic/outpost_prisoner/prisoner = owner()
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = owner()
if(!may_finish(prisoner))
cancel()
interrupted(prisoner)
@@ -288,24 +288,24 @@
pending_target = null
busy_until = 0
clear_telegraphs()
- var/mob/living/basic/outpost_prisoner/prisoner = owner()
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = owner()
if(prisoner)
REMOVE_TRAIT(prisoner, TRAIT_IMMOBILIZED, PRISON_BOSS_MOVE_TRAIT)
/// What the move goes for now, or null: a member of staff, or a thing near them
-/datum/prison_boss_move/proc/find_target(mob/living/basic/outpost_prisoner/prisoner)
+/datum/prison_boss_move/proc/find_target(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
return null
/// Shows everyone what is coming, with a sound and a line
-/datum/prison_boss_move/proc/telegraph(mob/living/basic/outpost_prisoner/prisoner, atom/target)
+/datum/prison_boss_move/proc/telegraph(mob/living/carbon/human/npc/outpost_prisoner/prisoner, atom/target)
return
/// Does it. `target` may be gone by now. Returns TRUE if anything happened.
-/datum/prison_boss_move/proc/effect(mob/living/basic/outpost_prisoner/prisoner, atom/target)
+/datum/prison_boss_move/proc/effect(mob/living/carbon/human/npc/outpost_prisoner/prisoner, atom/target)
return FALSE
/// The wind-up was stopped before it finished
-/datum/prison_boss_move/proc/interrupted(mob/living/basic/outpost_prisoner/prisoner)
+/datum/prison_boss_move/proc/interrupted(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
return
/// Marks `turfs` for the wind-up, with the field kits' floor marks
@@ -340,7 +340,7 @@
return ..()
/// The nearest staff in sight, PRISON_BOSS_CHARGE_MIN_RANGE to _RANGE tiles off, on a line he could run clear to them
-/datum/prison_boss_move/charge/find_target(mob/living/basic/outpost_prisoner/prisoner)
+/datum/prison_boss_move/charge/find_target(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/datum/outpost_prison/prison = prisoner.prison
var/mob/living/best
var/best_distance = INFINITY
@@ -359,7 +359,7 @@
* The line from the boss toward `target`, PRISON_BOSS_CHARGE_RANGE tiles long: it stops at the first
* wall, and never runs past the cell block's edge.
*/
-/datum/prison_boss_move/charge/proc/charge_line(mob/living/basic/outpost_prisoner/prisoner, atom/target)
+/datum/prison_boss_move/charge/proc/charge_line(mob/living/carbon/human/npc/outpost_prisoner/prisoner, atom/target)
. = list()
var/datum/outpost_prison/prison = prisoner.prison
var/turf/origin = get_turf(prisoner)
@@ -382,7 +382,7 @@
break
/// Whether the line toward `person` reaches them with nothing solid and nobody else before them
-/datum/prison_boss_move/charge/proc/clear_run_to(mob/living/basic/outpost_prisoner/prisoner, mob/living/person)
+/datum/prison_boss_move/charge/proc/clear_run_to(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/person)
var/turf/aim = get_turf(person)
for(var/turf/spot as anything in charge_line(prisoner, person))
if(spot == aim)
@@ -392,14 +392,14 @@
return FALSE
/// Whether a charge can run onto `spot`: in the cell block, ground the boss could walk, nothing solid on it
-/datum/outpost_prison/proc/boss_run_tile_ok(mob/living/basic/outpost_prisoner/prisoner, turf/spot)
+/datum/outpost_prison/proc/boss_run_tile_ok(mob/living/carbon/human/npc/outpost_prisoner/prisoner, turf/spot)
if(!spot || spot.z != prisoner.z || isclosedturf(spot) || !in_cell_block(spot) || !prisoner.walkable?[spot])
return FALSE
if(isgroundlessturf(spot) || islava(spot) || ischasm(spot))
return FALSE
return !spot.is_blocked_turf(exclude_mobs = TRUE)
-/datum/prison_boss_move/charge/telegraph(mob/living/basic/outpost_prisoner/prisoner, atom/target)
+/datum/prison_boss_move/charge/telegraph(mob/living/carbon/human/npc/outpost_prisoner/prisoner, atom/target)
path = charge_line(prisoner, target)
prisoner.visible_message(span_boldwarning("[prisoner] drops [prisoner.p_their()] shoulder and lowers [prisoner.p_their()] head!"))
playsound(prisoner, 'sound/mobs/non-humanoids/gorilla/gorilla.ogg', 60, TRUE)
@@ -407,7 +407,7 @@
mark_turfs(path, "#c8a060")
prisoner.say_context("boss_move_charge")
-/datum/prison_boss_move/charge/effect(mob/living/basic/outpost_prisoner/prisoner, atom/target)
+/datum/prison_boss_move/charge/effect(mob/living/carbon/human/npc/outpost_prisoner/prisoner, atom/target)
if(!length(path) || get_dist(prisoner, path[1]) > 1)
path = null
return FALSE
@@ -427,7 +427,7 @@
* slams into it and reels. Nothing is broken, and he never leaves the cell block.
*/
/datum/prison_boss_move/charge/proc/charge_step(serial)
- var/mob/living/basic/outpost_prisoner/prisoner = owner()
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = owner()
var/datum/outpost_prison/prison = prisoner?.prison
if(!serial || serial != charge_serial || !prison || !prison.boss_riot_ok(prisoner))
end_charge()
@@ -452,7 +452,7 @@
addtimer(CALLBACK(src, PROC_REF(charge_step), serial), PRISON_BOSS_CHARGE_STEP, TIMER_DELETE_ME)
/// Knocks `person` off their feet: brute through melee armour and a knockdown (a guard, who can't be knocked down, takes the blow)
-/datum/prison_boss_move/charge/proc/slam_into(mob/living/basic/outpost_prisoner/prisoner, mob/living/person)
+/datum/prison_boss_move/charge/proc/slam_into(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/person)
prisoner.face_atom(person)
prisoner.do_attack_animation(person, ATTACK_EFFECT_SMASH)
person.visible_message(span_danger("[prisoner] slams into [person]!"), span_userdanger("[prisoner] slams into you!"))
@@ -463,7 +463,7 @@
log_combat(prisoner, person, "shoulder-charged")
/// Ran into something solid on `spot`: stopped dead, reeling for PRISON_BOSS_CHARGE_REEL. It takes no harm.
-/datum/prison_boss_move/charge/proc/bounce(mob/living/basic/outpost_prisoner/prisoner, turf/spot)
+/datum/prison_boss_move/charge/proc/bounce(mob/living/carbon/human/npc/outpost_prisoner/prisoner, turf/spot)
end_charge()
if(prisoner.stat != CONSCIOUS)
return
@@ -502,7 +502,7 @@
return ..()
/// A bunk within PRISON_BOSS_FIRE_RANGE tiles, in sight with nothing in the way, with staff standing where it would burn
-/datum/prison_boss_move/bed_fire/find_target(mob/living/basic/outpost_prisoner/prisoner)
+/datum/prison_boss_move/bed_fire/find_target(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(fire_ref?.resolve())
return null
var/datum/outpost_prison/prison = prisoner.prison
@@ -533,14 +533,14 @@
continue
. += beside
-/datum/prison_boss_move/bed_fire/telegraph(mob/living/basic/outpost_prisoner/prisoner, atom/target)
+/datum/prison_boss_move/bed_fire/telegraph(mob/living/carbon/human/npc/outpost_prisoner/prisoner, atom/target)
patch = prisoner.prison.boss_fire_patch(target)
prisoner.visible_message(span_boldwarning("[prisoner] strikes a match and eyes [target]."))
playsound(prisoner, 'sound/items/match_strike.ogg', 60, TRUE)
mark_turfs(patch, "#ff5a1f", "target_circle")
prisoner.say_context("boss_move_fire")
-/datum/prison_boss_move/bed_fire/effect(mob/living/basic/outpost_prisoner/prisoner, atom/target)
+/datum/prison_boss_move/bed_fire/effect(mob/living/carbon/human/npc/outpost_prisoner/prisoner, atom/target)
var/obj/structure/bed/bunk = target
var/list/burning = patch
patch = null
@@ -618,7 +618,7 @@
* The way out of the cell block he is breaking now, beside him, once the riot's blows have been at it
* (note_exit_attacked()): a staff door, a serving hatch not yet open, or a window. Never anything else.
*/
-/datum/prison_boss_move/rigged_charge/find_target(mob/living/basic/outpost_prisoner/prisoner)
+/datum/prison_boss_move/rigged_charge/find_target(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/datum/outpost_prison/prison = prisoner.prison
var/obj/target = prisoner.riot_target_ref?.resolve()
if(!isobj(target) || !prison.is_exit_blocker(target) || !prisoner.within_reach(target))
@@ -630,13 +630,13 @@
return null
return target
-/datum/prison_boss_move/rigged_charge/telegraph(mob/living/basic/outpost_prisoner/prisoner, atom/target)
+/datum/prison_boss_move/rigged_charge/telegraph(mob/living/carbon/human/npc/outpost_prisoner/prisoner, atom/target)
prisoner.visible_message(span_boldwarning("[prisoner] crouches by [target] and packs something against it."))
playsound(prisoner, 'sound/machines/click.ogg', 60, TRUE)
mark_turfs(list(get_turf(target)), COLOR_RED)
prisoner.say_context("boss_move_rig")
-/datum/prison_boss_move/rigged_charge/effect(mob/living/basic/outpost_prisoner/prisoner, atom/target)
+/datum/prison_boss_move/rigged_charge/effect(mob/living/carbon/human/npc/outpost_prisoner/prisoner, atom/target)
var/datum/outpost_prison/prison = prisoner.prison
if(QDELETED(target) || !prison.is_exit_blocker(target))
return FALSE
@@ -746,48 +746,56 @@
/// world.time they were first seen cuffed this time, 0 while they are not
var/cuffed_at = 0
-/datum/prison_boss_move/slip_cuffs/observe(mob/living/basic/outpost_prisoner/prisoner)
- if(!prisoner.cuffs)
+/datum/prison_boss_move/slip_cuffs/observe(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
+ if(!prisoner.handcuffed)
cuffed_at = 0
else if(!cuffed_at)
cuffed_at = world.time
/// Their cuffs, once they have worn them PRISON_BOSS_SLIP_DELAY, with staff in sight to get away from
-/datum/prison_boss_move/slip_cuffs/find_target(mob/living/basic/outpost_prisoner/prisoner)
- if(!prisoner.cuffs || !cuffed_at || world.time - cuffed_at < PRISON_BOSS_SLIP_DELAY)
+/datum/prison_boss_move/slip_cuffs/find_target(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
+ if(!prisoner.handcuffed || !cuffed_at || world.time - cuffed_at < PRISON_BOSS_SLIP_DELAY)
return null
if(!prisoner.prison.boss_nearest_staff(prisoner))
return null
- return prisoner.cuffs
+ return prisoner.handcuffed
-/datum/prison_boss_move/slip_cuffs/may_finish(mob/living/basic/outpost_prisoner/prisoner)
- return ..() && prisoner.cuffs == pending_target?.resolve()
+/datum/prison_boss_move/slip_cuffs/may_finish(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
+ return ..() && prisoner.handcuffed == pending_target?.resolve()
-/datum/prison_boss_move/slip_cuffs/telegraph(mob/living/basic/outpost_prisoner/prisoner, atom/target)
+/datum/prison_boss_move/slip_cuffs/telegraph(mob/living/carbon/human/npc/outpost_prisoner/prisoner, atom/target)
prisoner.visible_message(span_boldwarning("[prisoner] starts twisting at [target], working a hand loose."))
playsound(prisoner, 'sound/items/weapons/handcuffs.ogg', 40, TRUE)
prisoner.Shake(1, 0, windup)
prisoner.say_context("boss_move_slip")
-/datum/prison_boss_move/slip_cuffs/interrupted(mob/living/basic/outpost_prisoner/prisoner)
- if(prisoner?.stat == CONSCIOUS && prisoner.cuffs)
- prisoner.visible_message(span_notice("[prisoner] loses [prisoner.p_their()] grip on [prisoner.cuffs]."))
+/datum/prison_boss_move/slip_cuffs/interrupted(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
+ if(prisoner?.stat == CONSCIOUS && prisoner.handcuffed)
+ prisoner.visible_message(span_notice("[prisoner] loses [prisoner.p_their()] grip on [prisoner.handcuffed]."))
-/datum/prison_boss_move/slip_cuffs/effect(mob/living/basic/outpost_prisoner/prisoner, atom/target)
- var/obj/item/restraints/handcuffs/worn = prisoner.cuffs
+/**
+ * After the telegraph, they work at the cuffs the way anyone does (tg's cuff_resist(): the cuffs' own
+ * breakout time, broken by being moved or knocked down). Out of them, they slip away in a shimmer.
+ */
+/datum/prison_boss_move/slip_cuffs/effect(mob/living/carbon/human/npc/outpost_prisoner/prisoner, atom/target)
+ var/obj/item/restraints/handcuffs/worn = prisoner.handcuffed
if(!worn || worn != target)
return FALSE
- // Without a user they drop where they stand: the same cuffs, on the floor
- prisoner.remove_cuffs()
+ INVOKE_ASYNC(src, PROC_REF(work_free), prisoner, worn)
+ return TRUE
+
+/datum/prison_boss_move/slip_cuffs/proc/work_free(mob/living/carbon/human/npc/outpost_prisoner/prisoner, obj/item/restraints/handcuffs/worn)
+ prisoner.cuff_resist(worn)
+ if(QDELETED(prisoner) || prisoner.handcuffed == worn || prisoner.stat != CONSCIOUS)
+ return
prisoner.visible_message(span_danger("[prisoner] slips out of [worn]!"))
playsound(prisoner, 'sound/effects/magic/smoke.ogg', 40, TRUE)
prisoner.apply_status_effect(/datum/status_effect/prison_boss_shimmer)
- return TRUE
/**
- * The shimmer after a Ghost slips their cuffs, as the field cloak: faint and blurred for
- * PRISON_BOSS_SHIMMER_TIME, and PRISON_BOSS_SHIMMER_MISS percent of blows, throws and shots miss. A hit
- * that lands or a flash ends it.
+ * The shimmer after a Ghost slips their cuffs: faint and blurred for PRISON_BOSS_SHIMMER_TIME, a look
+ * and nothing more. A Ghost's dodging is their real chrome (a Slipwire shunt, outpost_prison_bounty.dm;
+ * owner ruling OC-6), which works with the shimmer or without it. A hit that lands or a flash ends it.
*/
/datum/status_effect/prison_boss_shimmer
id = "prison_boss_shimmer"
@@ -797,48 +805,24 @@
alert_type = null
/// Broken by a hit or a flash, which says so itself
var/broken = FALSE
- /// The miss message shows at most every second, so a burst of fire doesn't flood chat
- COOLDOWN_DECLARE(miss_message_cooldown)
/datum/status_effect/prison_boss_shimmer/on_apply()
if(owner.stat != CONSCIOUS)
return FALSE
animate(owner, alpha = PRISON_BOSS_SHIMMER_ALPHA, time = 0.3 SECONDS)
owner.add_filter("prison_boss_shimmer", 2, list("type" = "blur", "size" = 1))
- RegisterSignal(owner, COMSIG_LIVING_CHECK_BLOCK, PROC_REF(on_check_block))
- RegisterSignal(owner, COMSIG_PROJECTILE_PREHIT, PROC_REF(on_prehit))
RegisterSignal(owner, COMSIG_MOB_AFTER_APPLY_DAMAGE, PROC_REF(on_damaged))
RegisterSignal(owner, COMSIG_MOB_FLASHED, PROC_REF(on_flashed))
owner.visible_message(span_warning("[owner] fades into a faint shimmer!"))
return TRUE
/datum/status_effect/prison_boss_shimmer/on_remove()
- UnregisterSignal(owner, list(COMSIG_LIVING_CHECK_BLOCK, COMSIG_PROJECTILE_PREHIT, COMSIG_MOB_AFTER_APPLY_DAMAGE, COMSIG_MOB_FLASHED))
+ UnregisterSignal(owner, list(COMSIG_MOB_AFTER_APPLY_DAMAGE, COMSIG_MOB_FLASHED))
animate(owner, alpha = 255, time = 0.3 SECONDS)
owner.remove_filter("prison_boss_shimmer")
if(!broken && owner.stat != DEAD)
owner.visible_message(span_notice("The shimmer around [owner] fades."))
-/datum/status_effect/prison_boss_shimmer/proc/miss_message(message)
- if(!COOLDOWN_FINISHED(src, miss_message_cooldown))
- return
- COOLDOWN_START(src, miss_message_cooldown, 1 SECONDS)
- owner.visible_message(message)
-
-/datum/status_effect/prison_boss_shimmer/proc/on_check_block(mob/living/source, atom/hit_by, damage, attack_text, attack_type, armour_penetration, damage_type)
- SIGNAL_HANDLER
- if(owner.stat != CONSCIOUS || !prob(PRISON_BOSS_SHIMMER_MISS))
- return NONE
- miss_message(span_warning("[attack_text] passes through the shimmer where [owner] was!"))
- return SUCCESSFUL_BLOCK
-
-/datum/status_effect/prison_boss_shimmer/proc/on_prehit(mob/living/source, obj/projectile/shot)
- SIGNAL_HANDLER
- if(shot.firer == owner || owner.stat != CONSCIOUS || !prob(PRISON_BOSS_SHIMMER_MISS))
- return NONE
- miss_message(span_warning("[shot] passes through the shimmer around [owner]!"))
- return PROJECTILE_INTERRUPT_HIT_PHASE
-
/datum/status_effect/prison_boss_shimmer/proc/on_damaged(mob/living/source, damage, damagetype)
SIGNAL_HANDLER
if(damage <= 0 || broken)
@@ -879,7 +863,7 @@
* The nearest table beside him that tg lets be flipped, to go over toward the nearest staff in sight;
* failing that, a locker beside him to shove into the doorway of a staff door staff are coming through.
*/
-/datum/prison_boss_move/barricade/find_target(mob/living/basic/outpost_prisoner/prisoner)
+/datum/prison_boss_move/barricade/find_target(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/datum/outpost_prison/prison = prisoner.prison
var/mob/living/nearest = prison.boss_staff_about(prisoner, PRISON_BOSS_BARRICADE_SIGHT)
if(!nearest)
@@ -905,7 +889,7 @@
return null
/// The nearest awake staff in sight within `range` anywhere in the wing, the office included: who a barricade is against
-/datum/outpost_prison/proc/boss_staff_about(mob/living/basic/outpost_prisoner/prisoner, range)
+/datum/outpost_prison/proc/boss_staff_about(mob/living/carbon/human/npc/outpost_prisoner/prisoner, range)
var/mob/living/nearest
var/nearest_distance = INFINITY
for(var/mob/living/person in view(range, prisoner))
@@ -941,7 +925,7 @@
return FALSE
/// The tile straight in front of the staff door on `door_tile`, on the yard side, that `prisoner` can walk and nothing stands on, or null
-/datum/outpost_prison/proc/boss_doorway_front(turf/door_tile, mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/boss_doorway_front(turf/door_tile, mob/living/carbon/human/npc/outpost_prisoner/prisoner)
for(var/direction in GLOB.cardinals)
var/turf/front = get_step(door_tile, direction)
if(!front || !cell_block[front] || isclosedturf(front) || !prisoner.walkable?[front] || front.is_blocked_turf())
@@ -950,7 +934,7 @@
return null
/// Whether a heavy may shove `locker`: a shut locker or crate, loose on the floor, in the cell block where `prisoner` can get at it, and not outpost property
-/datum/outpost_prison/proc/boss_locker_shovable(obj/structure/closet/locker, mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/boss_locker_shovable(obj/structure/closet/locker, mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(QDELETED(locker) || locker.anchored || !locker.density || !isturf(locker.loc))
return FALSE
if((locker.resistance_flags & INDESTRUCTIBLE) || HAS_TRAIT(locker, TRAIT_OUTPOST_PROPERTY))
@@ -961,7 +945,7 @@
/datum/outpost_prison/proc/boss_shove_tile_ok(turf/spot)
return spot && cell_block[spot] && !isclosedturf(spot) && prisoner_can_stand(spot) && !spot.is_blocked_turf()
-/datum/prison_boss_move/barricade/telegraph(mob/living/basic/outpost_prisoner/prisoner, atom/target)
+/datum/prison_boss_move/barricade/telegraph(mob/living/carbon/human/npc/outpost_prisoner/prisoner, atom/target)
if(shove_to)
shove_ref = WEAKREF(target)
prisoner.visible_message(span_boldwarning("[prisoner] puts [prisoner.p_their()] shoulder to [target]."))
@@ -973,7 +957,7 @@
mark_turfs(list(get_turf(target)), "#c0c0c0")
prisoner.say_context("boss_move_barricade")
-/datum/prison_boss_move/barricade/effect(mob/living/basic/outpost_prisoner/prisoner, atom/target)
+/datum/prison_boss_move/barricade/effect(mob/living/carbon/human/npc/outpost_prisoner/prisoner, atom/target)
var/datum/outpost_prison/prison = prisoner.prison
if(shove_to)
var/obj/structure/closet/locker = target
@@ -1000,7 +984,7 @@
* It stops in the doorway, at anything or anyone in the way, or when the heavy can't follow.
*/
/datum/prison_boss_move/barricade/proc/shove_step(serial)
- var/mob/living/basic/outpost_prisoner/prisoner = owner()
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = owner()
var/datum/outpost_prison/prison = prisoner?.prison
var/obj/structure/closet/locker = shove_ref?.resolve()
if(!serial || serial != shove_serial || !prison || !prison.boss_riot_ok(prisoner) || QDELETED(locker) || !shove_to)
@@ -1042,9 +1026,9 @@
boss_riot_serial++
if(forced_riot || !crew_home())
return joining
- var/mob/living/basic/outpost_prisoner/kingpin
- for(var/mob/living/basic/outpost_prisoner/prisoner as anything in joining)
- if(prisoner.bounty_record?.archetype != BOUNTY_ARCHETYPE_KINGPIN || prisoner.stat != CONSCIOUS || prisoner.cuffs)
+ var/mob/living/carbon/human/npc/outpost_prisoner/kingpin
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner as anything in joining)
+ if(prisoner.bounty_record?.archetype != BOUNTY_ARCHETYPE_KINGPIN || prisoner.stat != CONSCIOUS || prisoner.handcuffed)
continue
if(!in_cell_block(prisoner) || prisoner.is_confined() || !prisoner.ai_running())
continue
@@ -1053,7 +1037,7 @@
if(!kingpin)
return joining
var/list/swayed = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if((prisoner in joining) || !prisoner.can_join_riot())
continue
if(prisoner.mood < prisoner.riot_join_mood() + PRISON_BOSS_WORD_BONUS)
@@ -1070,11 +1054,11 @@
once_per_riot = TRUE
/// The nearest of the wing's own NPC guards in sight and on duty, never a player
-/datum/prison_boss_move/bribe/find_target(mob/living/basic/outpost_prisoner/prisoner)
+/datum/prison_boss_move/bribe/find_target(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/datum/outpost_prison/prison = prisoner.prison
- var/mob/living/basic/outpost_prison_guard/best
+ var/mob/living/carbon/human/npc/outpost_prison_guard/best
var/best_distance = INFINITY
- for(var/mob/living/basic/outpost_prison_guard/guard in view(PRISON_BOSS_BRIBE_RANGE, prisoner))
+ for(var/mob/living/carbon/human/npc/outpost_prison_guard/guard in view(PRISON_BOSS_BRIBE_RANGE, prisoner))
var/distance = get_dist(prisoner, guard)
if(distance < best_distance && prison.boss_bribable(guard))
best = guard
@@ -1082,20 +1066,20 @@
return best
/// Whether the kingpin may pay off `guard`: one of this wing's guards, on duty, not already paid, and nobody's playing them
-/datum/outpost_prison/proc/boss_bribable(mob/living/basic/outpost_prison_guard/guard)
+/datum/outpost_prison/proc/boss_bribable(mob/living/carbon/human/npc/outpost_prison_guard/guard)
if(!istype(guard) || QDELETED(guard) || guard.prison != src || !guard.on_duty())
return FALSE
return isnull(guard.mind) && isnull(guard.client)
-/datum/prison_boss_move/bribe/telegraph(mob/living/basic/outpost_prisoner/prisoner, atom/target)
+/datum/prison_boss_move/bribe/telegraph(mob/living/carbon/human/npc/outpost_prisoner/prisoner, atom/target)
prisoner.visible_message(span_boldwarning("[prisoner] catches [target]'s eye and taps [prisoner.p_their()] pocket."))
playsound(prisoner, 'sound/items/coinflip.ogg', 50, TRUE)
mark_turfs(list(get_turf(target)), "#e0c050", "target_circle")
prisoner.say_context("boss_move_bribe")
-/datum/prison_boss_move/bribe/effect(mob/living/basic/outpost_prisoner/prisoner, atom/target)
+/datum/prison_boss_move/bribe/effect(mob/living/carbon/human/npc/outpost_prisoner/prisoner, atom/target)
var/datum/outpost_prison/prison = prisoner.prison
- var/mob/living/basic/outpost_prison_guard/guard = target
+ var/mob/living/carbon/human/npc/outpost_prison_guard/guard = target
if(!prison.boss_bribable(guard) || get_dist(prisoner, guard) > PRISON_BOSS_BRIBE_RANGE || !(guard in view(PRISON_BOSS_BRIBE_RANGE, prisoner)))
return FALSE
prison.boss_bribe_guard(guard)
@@ -1106,7 +1090,7 @@
* no riot response, no baton, and rioters leave them be), standing back in the office's far corner.
* boss_bribes_tick() sends them back to work.
*/
-/datum/outpost_prison/proc/boss_bribe_guard(mob/living/basic/outpost_prison_guard/guard)
+/datum/outpost_prison/proc/boss_bribe_guard(mob/living/carbon/human/npc/outpost_prison_guard/guard)
guard.prison_bribed_until = world.time + PRISON_BOSS_BRIBE_TIME
guard.end_response()
guard.set_baton(FALSE)
@@ -1121,7 +1105,7 @@
/// Paid-off guards whose time is up go back to work
/datum/outpost_prison/proc/boss_bribes_tick()
for(var/datum/weakref/ref as anything in boss_bribed_guards.Copy())
- var/mob/living/basic/outpost_prison_guard/guard = ref.resolve()
+ var/mob/living/carbon/human/npc/outpost_prison_guard/guard = ref.resolve()
if(QDELETED(guard))
boss_bribed_guards -= ref
continue
@@ -1134,7 +1118,7 @@
guard.visible_message(span_notice("[guard] squares [guard.p_their()] shoulders and gets back to work."))
/// Whether the kingpin has them standing back from the riot (on_duty())
-/mob/living/basic/outpost_prison_guard/proc/boss_bribed()
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/boss_bribed()
return prison_bribed_until > world.time
/**
diff --git a/voidcrew/modules/player_outposts/outpost_prison_bounty.dm b/voidcrew/modules/player_outposts/outpost_prison_bounty.dm
index e631f2e1154..3c62ec816ee 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_bounty.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_bounty.dm
@@ -81,7 +81,7 @@
/// For tests: whether a meek prisoner watching the staff door darts when it opens (TRUE or FALSE) instead of rolling for it
var/prison_bounty_forced_dart
-/mob/living/basic/outpost_prisoner
+/mob/living/carbon/human/npc/outpost_prisoner
/// Running after a bounty prisoner called out someone off the ship that caught them (bounty_extra_speech())
COOLDOWN_DECLARE(prison_captor_line_cooldown)
@@ -333,7 +333,7 @@ GLOBAL_VAR(bounty_pool_timer)
/// Living bounty prisoners on the roster who are not leaving, of `tier` when given
/datum/outpost_prison/proc/bounty_prisoner_count(tier)
. = 0
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(!prisoner.bounty_record || prisoner.stat == DEAD || prisoner.phase == PRISONER_LEAVING)
continue
if(tier && prisoner.bounty_record.tier != tier)
@@ -445,7 +445,7 @@ GLOBAL_VAR(bounty_pool_timer)
continue
bounty_pool_remove(record)
record.status = BOUNTY_RECORD_IMPRISONED
- var/mob/living/basic/outpost_prisoner/prisoner = new(spot, record)
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = new(spot, record)
admit(prisoner, cell)
prisoner.beam_in()
start_arrival_gap(soonest_lane())
@@ -456,17 +456,17 @@ GLOBAL_VAR(bounty_pool_timer)
// ===== A PRISONER FROM A RECORD =====
/**
- * Before the prisoner's Initialize() calls ..(): the body their record says (gender, and health by
- * tier), so tg sizes max_stamina from the right maxHealth. A record still in the pool leaves it now,
- * before they exist.
+ * Before the prisoner's Initialize() calls ..(): a record still in the pool leaves it now, before they
+ * exist, and a tougher criminal takes less from a blow (npc_damage_taken by tier, through physiology,
+ * defaults PR-16). Their face and gender come from the record through the human NPC base.
*/
-/mob/living/basic/outpost_prisoner/proc/apply_bounty_body(datum/bounty_record/record)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/apply_bounty_body(datum/bounty_record/record)
if(record in GLOB.bounty_prisoner_pool)
bounty_pool_remove(record)
- if(record.gender == MALE || record.gender == FEMALE)
- gender = record.gender
- maxHealth = bounty_by_tier(record.tier, BOUNTY_PRISONER_HEALTH_PETTY, BOUNTY_PRISONER_HEALTH_WANTED, BOUNTY_PRISONER_HEALTH_MOST_WANTED)
- health = maxHealth
+ npc_damage_taken = bounty_by_tier(record.tier, BOUNTY_PRISONER_DAMAGE_TAKEN_PETTY, BOUNTY_PRISONER_DAMAGE_TAKEN_WANTED, BOUNTY_PRISONER_DAMAGE_TAKEN_MOST_WANTED)
+ // The Ghost's dodging is real chrome (owner ruling OC-6): a Slipwire shunt, which burns out to scrap if they die.
+ if(record.archetype == BOUNTY_ARCHETYPE_BOSS && record.kit == BOUNTY_KIT_GHOST)
+ npc_cyberware = list(/obj/item/organ/cyberimp/cyberware/slipwire)
/**
* At the end of the prisoner's Initialize(), before their look is built: who their record says
@@ -478,12 +478,11 @@ GLOBAL_VAR(bounty_pool_timer)
* yard hears BOUNTY_PRISON_MOST_WANTED_YARD_CRIME, as a Most Wanted criminal never names theirs in
* its own lines (BUG-12); the console and examine still read the record's.
*/
-/mob/living/basic/outpost_prisoner/proc/apply_bounty_record(datum/bounty_record/record)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/apply_bounty_record(datum/bounty_record/record)
if(record.gender == MALE || record.gender == FEMALE)
gender = record.gender
if(length(record.name))
- real_name = record.name
- name = real_name
+ fully_replace_character_name(real_name, record.name)
var/plain_crime = bounty_plain_crime(record.crime)
if(record.tier == BOUNTY_TIER_MOST_WANTED)
crime = BOUNTY_PRISON_MOST_WANTED_YARD_CRIME
@@ -492,9 +491,8 @@ GLOBAL_VAR(bounty_pool_timer)
var/list/personalities = bounty_archetype_personalities(record.archetype)
if(length(personalities))
personality = pick(personalities)
- // The plain jumpsuit: the glasses and beanie variants would hide their hair or fake their eyewear
- outfit_path = /datum/outfit/outpost_prisoner
- // As hurt as they were caught, but never below BOUNTY_PRISONER_MIN_ARRIVAL_HEALTH percent
+ // As hurt as they were caught, but never below BOUNTY_PRISONER_MIN_ARRIVAL_HEALTH percent: real
+ // damage spread over their limbs when they beam in (beam_in())
arrival_brute = round(maxHealth * clamp(record.hurt_fraction || 0, 0, 1 - BOUNTY_PRISONER_MIN_ARRIVAL_HEALTH / 100))
record.status = BOUNTY_RECORD_IMPRISONED
@@ -535,7 +533,7 @@ GLOBAL_VAR(bounty_pool_timer)
* nothing (a release is followed by forget(), for one). A closed record never returns to the pool
* (bounty_pool_add() refuses it). Returns TRUE if this call closed it.
*/
-/proc/close_bounty_record(mob/living/basic/outpost_prisoner/prisoner, status)
+/proc/close_bounty_record(mob/living/carbon/human/npc/outpost_prisoner/prisoner, status)
var/datum/bounty_record/record = prisoner?.bounty_record
if(!record || record.status != BOUNTY_RECORD_IMPRISONED)
return FALSE
@@ -544,13 +542,13 @@ GLOBAL_VAR(bounty_pool_timer)
return TRUE
/// Why Kessler's experiments refuse `prisoner`, or null: a bounty prisoner's identity would be lost
-/proc/bounty_experiment_refusal(mob/living/basic/outpost_prisoner/prisoner)
+/proc/bounty_experiment_refusal(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
return prisoner?.bounty_record ? "Kessler won't touch a bounty prisoner." : null
// ===== PAY =====
/// What `prisoner` earns the treasury (stipend, pay rate and release bonus) as a multiple of an ordinary prisoner's: x1.5, x2 or x2.5 by tier
-/datum/outpost_prison/proc/bounty_pay_mult(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/bounty_pay_mult(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/datum/bounty_record/record = prisoner?.bounty_record
if(!record)
return 1
@@ -558,54 +556,40 @@ GLOBAL_VAR(bounty_pool_timer)
// ===== DANGER =====
-/// Multiplier on their punches and shiv blows (update_melee() and strike()), by tier and by what they hit with
-/mob/living/basic/outpost_prisoner/proc/bounty_damage_mult()
- if(!bounty_record)
- return 1
- if(has_shiv())
- return bounty_by_tier(bounty_record.tier, BOUNTY_PRISON_SHIV_MULT_PETTY, BOUNTY_PRISON_SHIV_MULT_WANTED, BOUNTY_PRISON_SHIV_MULT_MOST_WANTED)
- return bounty_by_tier(bounty_record.tier, BOUNTY_PRISON_PUNCH_MULT_PETTY, BOUNTY_PRISON_PUNCH_MULT_WANTED, BOUNTY_PRISON_PUNCH_MULT_MOST_WANTED)
-
/// Multiplier on their mood losses (mood_scale())
-/mob/living/basic/outpost_prisoner/proc/bounty_mood_scale()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/bounty_mood_scale()
if(!bounty_record)
return 1
return bounty_by_tier(bounty_record.tier, BOUNTY_PRISON_MOOD_SCALE_PETTY, BOUNTY_PRISON_MOOD_SCALE_WANTED, BOUNTY_PRISON_MOOD_SCALE_MOST_WANTED)
/// Mood points added to the line below which they square up to staff (threat_mood_for() and threat_mood_ceiling())
-/mob/living/basic/outpost_prisoner/proc/bounty_threat_bonus()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/bounty_threat_bonus()
if(!bounty_record)
return 0
return bounty_by_tier(bounty_record.tier, BOUNTY_PRISON_THREAT_BONUS_PETTY, BOUNTY_PRISON_THREAT_BONUS_WANTED, BOUNTY_PRISON_THREAT_BONUS_MOST_WANTED)
/// Mood points added to the line below which they join a riot (riot_join_bonus())
-/mob/living/basic/outpost_prisoner/proc/bounty_riot_bonus()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/bounty_riot_bonus()
if(!bounty_record)
return 0
return bounty_by_tier(bounty_record.tier, BOUNTY_PRISON_RIOT_BONUS_PETTY, BOUNTY_PRISON_RIOT_BONUS_WANTED, BOUNTY_PRISON_RIOT_BONUS_MOST_WANTED)
/// Multiplier on the damage their blows do to the wing's ways out (hit_exit())
-/mob/living/basic/outpost_prisoner/proc/bounty_breakout_mult()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/bounty_breakout_mult()
if(!bounty_record)
return 1
return bounty_by_tier(bounty_record.tier, BOUNTY_PRISON_BREAKOUT_MULT_PETTY, BOUNTY_PRISON_BREAKOUT_MULT_WANTED, BOUNTY_PRISON_BREAKOUT_MULT_MOST_WANTED)
-/// Multiplier on how long cuffing them takes (cuff_time())
-/mob/living/basic/outpost_prisoner/proc/bounty_cuff_mult()
- if(!bounty_record)
- return 1
- return bounty_by_tier(bounty_record.tier, BOUNTY_PRISON_CUFF_MULT_PETTY, BOUNTY_PRISON_CUFF_MULT_WANTED, BOUNTY_PRISON_CUFF_MULT_MOST_WANTED)
-
/// Whether they were a meek criminal: they back off, go over hatches and slip out of doors
-/mob/living/basic/outpost_prisoner/proc/bounty_is_meek()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/bounty_is_meek()
return bounty_record?.archetype == BOUNTY_ARCHETYPE_MEEK
/// Multiplier on how likely they are to back off when a player hits them: twice as likely for a meek bounty prisoner (hit_reaction(), through bounty_hit_reaction_weights())
-/mob/living/basic/outpost_prisoner/proc/bounty_back_off_mult()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/bounty_back_off_mult()
return bounty_is_meek() ? BOUNTY_PRISON_MEEK_BACK_OFF_MULT : 1
/// Multiplier on how likely they are to hit back when a player hits them: a Wanted or Most Wanted prisoner who is not meek hits back like a grumpy one (hit_reaction(), through bounty_hit_reaction_weights())
-/mob/living/basic/outpost_prisoner/proc/bounty_hit_back_mult()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/bounty_hit_back_mult()
if(!bounty_record || bounty_is_meek())
return 1
return bounty_by_tier(bounty_record.tier, 1, BOUNTY_PRISON_HIT_BACK_MULT_WANTED, BOUNTY_PRISON_HIT_BACK_MULT_MOST_WANTED)
@@ -614,38 +598,30 @@ GLOBAL_VAR(bounty_pool_timer)
* A calm prisoner's hit-back and back-off weights (outpost_prisoner_hit_reaction_weights()'s list,
* which is theirs to change), scaled for a bounty prisoner. Returns the same list. hit_reaction() rolls on it.
*/
-/mob/living/basic/outpost_prisoner/proc/bounty_hit_reaction_weights(list/weights)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/bounty_hit_reaction_weights(list/weights)
if(!bounty_record || !islist(weights))
return weights
weights[PRISONER_HIT_FIGHT] = max(1, round(weights[PRISONER_HIT_FIGHT] * bounty_hit_back_mult()))
weights[PRISONER_HIT_COWER] = max(1, round(weights[PRISONER_HIT_COWER] * bounty_back_off_mult()))
return weights
-/// Their speed while loose, or null for the usual: a meek bounty prisoner runs faster than the others (go_loose())
-/mob/living/basic/outpost_prisoner/proc/bounty_loose_speed()
- return bounty_is_meek() ? BOUNTY_PRISON_MEEK_LOOSE_SPEED : null
-
-/// The speed they go back to when not running from anything: a loose meek bounty prisoner keeps their loose speed (update_flee_speed(), back_in_custody())
-/mob/living/basic/outpost_prisoner/proc/bounty_base_speed()
- if(trouble == PRISONER_TROUBLE_LOOSE)
- var/loose_speed = bounty_loose_speed()
- if(loose_speed)
- return loose_speed
- return initial(speed)
+/// Whether they run rather than walk when not running from anything: a runner runs (go_loose(), update_flee_speed(), back_in_custody())
+/mob/living/carbon/human/npc/outpost_prisoner/proc/bounty_base_speed()
+ return trouble == PRISONER_TROUBLE_LOOSE
/// How long going over a serving hatch takes them, or null for the usual: a meek bounty prisoner is quicker (start_climb())
-/mob/living/basic/outpost_prisoner/proc/bounty_climb_time()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/bounty_climb_time()
return bounty_is_meek() ? BOUNTY_PRISON_MEEK_CLIMB_TIME : null
/// Multiplier on their weight as the wildcard "snap" prisoner: a Most Wanted ringleader's is doubled (pick_snapper())
-/mob/living/basic/outpost_prisoner/proc/bounty_snap_weight_mult()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/bounty_snap_weight_mult()
return bounty_record?.tier == BOUNTY_TIER_MOST_WANTED ? BOUNTY_PRISON_RINGLEADER_SNAP_MULT : 1
/// `rioters` with any Most Wanted first, so a ringleader is among the first to shout when a riot starts (start_riot()). Returns a new list.
/proc/bounty_ringleaders_first(list/rioters)
var/list/leaders = list()
var/list/others = list()
- for(var/mob/living/basic/outpost_prisoner/rioter as anything in rioters)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/rioter as anything in rioters)
if(rioter.bounty_record?.tier == BOUNTY_TIER_MOST_WANTED)
leaders += rioter
else
@@ -654,10 +630,10 @@ GLOBAL_VAR(bounty_pool_timer)
/// An awake, uncuffed Most Wanted prisoner out in the yard, not shut in a cell, who stirs the others up, or null
/datum/outpost_prison/proc/bounty_ringleader()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.bounty_record?.tier != BOUNTY_TIER_MOST_WANTED || !counts_for_tension(prisoner))
continue
- if(prisoner.stat != CONSCIOUS || prisoner.cuffs || !in_cell_block(prisoner) || prisoner.is_confined())
+ if(prisoner.stat != CONSCIOUS || prisoner.handcuffed || !in_cell_block(prisoner) || prisoner.is_confined())
continue
return prisoner
return null
@@ -670,7 +646,7 @@ GLOBAL_VAR(bounty_pool_timer)
/datum/outpost_prison/proc/bounty_restless_causes()
if(BOUNTY_PRISON_RINGLEADER_TENSION <= 0)
return list()
- var/mob/living/basic/outpost_prisoner/ringleader = bounty_ringleader()
+ var/mob/living/carbon/human/npc/outpost_prisoner/ringleader = bounty_ringleader()
return ringleader ? list("[ringleader.real_name] stirring them up") : list()
// ===== MEEK BOUNTY PRISONERS: HATCHES AND DOORS =====
@@ -906,7 +882,7 @@ GLOBAL_VAR(bounty_pool_timer)
return best
/// Whether they are a meek bounty prisoner in a mood to watch the staff door for their chance, with a member of the wing home (nothing new starts in an empty wing)
-/mob/living/basic/outpost_prisoner/proc/bounty_may_watch_door()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/bounty_may_watch_door()
return bounty_is_meek() && mood < BOUNTY_PRISON_MEEK_DART_MOOD && !!prison?.trouble_enabled && prison.crew_home()
// ===== CONSOLES =====
@@ -916,7 +892,7 @@ GLOBAL_VAR(bounty_pool_timer)
* "wanted for" line and whether they are Most Wanted, the one tier a wanted poster names. Petty and
* Wanted show nothing more, and no pay multiplier.
*/
-/datum/outpost_prison/proc/bounty_roster_badge(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/bounty_roster_badge(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/datum/bounty_record/record = prisoner?.bounty_record
if(!record)
return null
@@ -932,7 +908,7 @@ GLOBAL_VAR(bounty_pool_timer)
* since the yard's "In for ..." leaves it out (BUG-12): "Most Wanted, for smuggling. The crew of the
* Meridian brought him in."
*/
-/datum/outpost_prison/proc/bounty_examine(mob/living/basic/outpost_prisoner/prisoner, mob/user)
+/datum/outpost_prison/proc/bounty_examine(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/user)
var/datum/bounty_record/record = prisoner?.bounty_record
if(!record)
return null
@@ -955,7 +931,7 @@ GLOBAL_VAR(bounty_pool_timer)
* Values for their lines that name the ship that caught them, list("{place}" = "Meridian"), or null
* for an ordinary prisoner or a record with no captor. The lines say "the {place}".
*/
-/mob/living/basic/outpost_prisoner/proc/bounty_captor_values()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/bounty_captor_values()
if(!length(bounty_record?.captor_name))
return null
return list("{place}" = bounty_record.captor_name)
@@ -965,12 +941,12 @@ GLOBAL_VAR(bounty_pool_timer)
* the Meridian crew sends people."), in place of the usual hello. Returns TRUE if they said it.
* finish_beam_in() calls it before its own arrival lines.
*/
-/mob/living/basic/outpost_prisoner/proc/bounty_arrival_speech()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/bounty_arrival_speech()
var/list/values = bounty_captor_values()
return values ? say_context_with("bounty_arrival", values) : FALSE
/// Someone awake off the ship that caught them, within BOUNTY_PRISON_CAPTOR_VIEW tiles and in sight, or null
-/mob/living/basic/outpost_prisoner/proc/bounty_captor_in_view()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/bounty_captor_in_view()
var/obj/structure/overmap/ship/captor_ship = bounty_record?.captor_ship?.resolve()
if(QDELETED(captor_ship))
return null
@@ -985,7 +961,7 @@ GLOBAL_VAR(bounty_pool_timer)
* Rolled at `chance` percent, and at most once every BOUNTY_PRISON_CAPTOR_LINE_GAP each; the sight
* check runs only once the roll comes up. Returns list(context, null, values), or null.
*/
-/datum/outpost_prison/proc/bounty_extra_speech(mob/living/basic/outpost_prisoner/prisoner, chance = BOUNTY_PRISON_CAPTOR_LINE_CHANCE)
+/datum/outpost_prison/proc/bounty_extra_speech(mob/living/carbon/human/npc/outpost_prisoner/prisoner, chance = BOUNTY_PRISON_CAPTOR_LINE_CHANCE)
var/list/values = prisoner?.bounty_captor_values()
if(!values || !COOLDOWN_FINISHED(prisoner, prison_captor_line_cooldown) || !prob(chance))
return null
@@ -1079,7 +1055,7 @@ GLOBAL_VAR(bounty_pool_timer)
var/datum/bounty_record/record = bounty_pool_find(params?["id"])
if(!record)
return list("error" = "That record is no longer in the pool.")
- var/mob/living/basic/outpost_prisoner/arrival = bounty_admit_record(record)
+ var/mob/living/carbon/human/npc/outpost_prisoner/arrival = bounty_admit_record(record)
if(!arrival)
return list("error" = "No free cell.")
return "admit bounty prisoner [arrival.real_name] ([bounty_tier_name(record.tier)]) into cell [arrival.cell?.number]"
diff --git a/voidcrew/modules/player_outposts/outpost_prison_breach.dm b/voidcrew/modules/player_outposts/outpost_prison_breach.dm
new file mode 100644
index 00000000000..5c4fd7fcdd7
--- /dev/null
+++ b/voidcrew/modules/player_outposts/outpost_prison_breach.dm
@@ -0,0 +1,198 @@
+/**
+ * # Prison breaches: emergency air
+ *
+ * Prisoners breathe like anyone (they are real human bodies): a breach, a fire or a plasma leak in the
+ * cell block suffocates, freezes and burns them the way it does the crew. Owner ruling Q3: the cell
+ * block has emergency lockers of breath masks and air tanks, and a prisoner on bad air who isn't busy
+ * making trouble goes and gets one, puts the mask on, and breathes from the tank (the human NPC base
+ * opens a worn tank while the air is bad). The wing gets one locker per PRISON_EMERGENCY_LOCKER_TILES
+ * floor tiles of its cell block when the corrections service lays it out, against a yard wall.
+ *
+ * Nothing here heals or shields anyone: a prisoner who can't reach a locker, or finds it emptied,
+ * suffocates.
+ */
+
+/// Floor tiles of cell block per emergency locker
+#define PRISON_EMERGENCY_LOCKER_TILES 60
+/// How often a prisoner on bad air may try again for a locker after failing to get to one
+#define PRISON_EMERGENCY_RETRY (15 SECONDS)
+
+/// The cell block's emergency locker: breath masks and air tanks, the same every time
+/obj/structure/closet/emcloset/outpost_prison
+ name = "emergency locker"
+ desc = "Breath masks and air tanks for the cell block, for when the air goes bad."
+ anchored = TRUE
+
+/obj/structure/closet/emcloset/outpost_prison/Initialize(mapload)
+ . = ..()
+ AddElement(/datum/element/outpost_property)
+
+// Stocked when it is placed, not on first opening (tg's closets fill lazily), so a prisoner can tell from
+// the yard which locker still has air in it (emergency_locker_for()).
+/obj/structure/closet/emcloset/outpost_prison/populate_contents_immediate()
+ . = ..()
+ for(var/i in 1 to 4)
+ new /obj/item/clothing/mask/breath(src)
+ new /obj/item/tank/internals/emergency_oxygen(src)
+
+/obj/structure/closet/emcloset/outpost_prison/PopulateContents()
+ return
+
+/datum/outpost_prison
+ /// The emergency lockers the wing's cell block has (weakrefs)
+ var/list/emergency_lockers = list()
+
+/**
+ * Makes sure the cell block has its emergency lockers: one per PRISON_EMERGENCY_LOCKER_TILES of floor,
+ * counting any already standing there (mapped or placed), each new one against a yard wall away from the
+ * others. Called when the cell block is worked out.
+ */
+/datum/outpost_prison/proc/ensure_emergency_lockers()
+ if(!length(cell_block))
+ return
+ var/list/standing = list()
+ var/floor = 0
+ for(var/turf/tile as anything in cell_block)
+ if(isclosedturf(tile))
+ continue
+ floor++
+ for(var/obj/structure/closet/emcloset/locker in tile)
+ standing += locker
+ emergency_lockers.Cut()
+ for(var/obj/structure/closet/emcloset/locker as anything in standing)
+ emergency_lockers += WEAKREF(locker)
+ var/wanted = max(1, round(floor / PRISON_EMERGENCY_LOCKER_TILES))
+ while(length(standing) < wanted)
+ var/turf/spot = emergency_locker_spot(standing)
+ if(!spot)
+ return
+ var/obj/structure/closet/emcloset/outpost_prison/locker = new(spot)
+ standing += locker
+ emergency_lockers += WEAKREF(locker)
+
+/// A yard tile against a wall, in no cell, with nothing on it and no door beside it, furthest from `others`
+/datum/outpost_prison/proc/emergency_locker_spot(list/others)
+ var/turf/best
+ var/best_distance = -1
+ for(var/turf/open/tile in cell_block)
+ if(cell_at(tile) || tile.is_blocked_turf(TRUE) || length(tile.contents))
+ continue
+ var/against_wall = FALSE
+ var/by_door = FALSE
+ for(var/direction in GLOB.cardinals)
+ var/turf/beside = get_step(tile, direction)
+ if(isclosedturf(beside))
+ against_wall = TRUE
+ if(locate(/obj/machinery/door) in beside)
+ by_door = TRUE
+ if(!against_wall || by_door)
+ continue
+ var/nearest = INFINITY
+ for(var/atom/other as anything in others)
+ nearest = min(nearest, get_dist(other, tile))
+ if(nearest > best_distance)
+ best = tile
+ best_distance = nearest
+ return best
+
+/// The nearest emergency locker `prisoner` can walk to that still has a mask and a tank in it
+/datum/outpost_prison/proc/emergency_locker_for(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
+ var/obj/structure/closet/best
+ var/best_distance = INFINITY
+ for(var/datum/weakref/locker_ref as anything in emergency_lockers)
+ var/obj/structure/closet/locker = locker_ref.resolve()
+ if(QDELETED(locker) || !prisoner.approach_turf(locker))
+ continue
+ // A locker nobody has opened yet (tg fills them on first opening) is worth a look.
+ if(locker.contents_initialized || locker.opened)
+ var/atom/inside = locker.opened ? get_turf(locker) : locker
+ if(!(locate(/obj/item/clothing/mask/breath) in inside) && !(locate(/obj/item/clothing/mask/gas) in inside))
+ continue
+ if(!(locate(/obj/item/tank/internals) in inside))
+ continue
+ var/distance = get_dist(prisoner, locker)
+ if(distance < best_distance)
+ best = locker
+ best_distance = distance
+ return best
+
+/mob/living/carbon/human/npc/outpost_prisoner
+ /// world.time they may next go for an emergency locker
+ var/next_emergency_try = 0
+
+/// Whether they wear a mask they could breathe a tank through, and carry a tank
+/mob/living/carbon/human/npc/outpost_prisoner/proc/has_emergency_air()
+ if(!can_breathe_internals())
+ return FALSE
+ for(var/obj/item/tank/internals/tank in get_equipped_items(INCLUDE_POCKETS | INCLUDE_HELD))
+ return TRUE
+ return FALSE
+
+/**
+ * The air where they stand is bad (air_tick()). Wearing a mask and a tank, they breathe from it.
+ * Otherwise, unless they are busy with trouble, they go for the nearest emergency locker.
+ */
+/mob/living/carbon/human/npc/outpost_prisoner/proc/on_bad_air()
+ if(stat != CONSCIOUS)
+ return
+ if(has_emergency_air())
+ if(!internal)
+ npc_open_internals()
+ return
+ if(world.time < next_emergency_try || istype(activity, /datum/prisoner_activity/emergency_air) || !routine_allowed())
+ return
+ var/datum/prisoner_activity/emergency_air/dash = new(src)
+ if(!dash.setup())
+ qdel(dash)
+ next_emergency_try = world.time + PRISON_EMERGENCY_RETRY
+ return
+ start_activity(dash)
+
+/// To the emergency locker: open it, take a mask and a tank, put them on and breathe
+/datum/prisoner_activity/emergency_air
+ name = "getting emergency air"
+ interruptible = FALSE
+ min_duration = 3 SECONDS
+ max_duration = 3 SECONDS
+ var/datum/weakref/locker_ref
+
+/datum/prisoner_activity/emergency_air/setup()
+ var/obj/structure/closet/locker = prisoner.prison?.emergency_locker_for(prisoner)
+ if(!locker)
+ return FALSE
+ locker_ref = WEAKREF(locker)
+ spot = prisoner.approach_turf(locker)
+ return !!spot
+
+/datum/prisoner_activity/emergency_air/begin()
+ . = ..()
+ var/obj/structure/closet/locker = locker_ref?.resolve()
+ if(QDELETED(locker) || get_dist(prisoner, locker) > 1)
+ return
+ prisoner.face_atom(locker)
+ if(!locker.opened)
+ locker.open(prisoner)
+ var/turf/inside = get_turf(locker)
+ var/obj/item/clothing/mask/mask = locate(/obj/item/clothing/mask/breath) in inside
+ mask ||= locate(/obj/item/clothing/mask/gas) in inside
+ var/obj/item/tank/internals/tank = locate(/obj/item/tank/internals) in inside
+ if(!mask || !tank)
+ return
+ prisoner.visible_message(span_notice("[prisoner] grabs [mask] and [tank] out of [locker]."))
+ if(prisoner.wear_mask && !prisoner.can_breathe_internals())
+ prisoner.dropItemToGround(prisoner.wear_mask)
+ if(!prisoner.wear_mask)
+ mask.forceMove(prisoner)
+ if(!prisoner.equip_to_slot_if_possible(mask, ITEM_SLOT_MASK, disable_warning = TRUE))
+ mask.forceMove(inside)
+ tank.forceMove(prisoner)
+ if(!prisoner.equip_to_slot_if_possible(tank, ITEM_SLOT_BELT, disable_warning = TRUE) && !prisoner.equip_to_slot_if_possible(tank, ITEM_SLOT_LPOCKET, disable_warning = TRUE) && !prisoner.equip_to_slot_if_possible(tank, ITEM_SLOT_RPOCKET, disable_warning = TRUE) && !prisoner.put_in_hands(tank))
+ tank.forceMove(inside)
+ prisoner.npc_open_internals()
+
+/datum/prisoner_activity/emergency_air/Destroy()
+ locker_ref = null
+ return ..()
+
+#undef PRISON_EMERGENCY_LOCKER_TILES
+#undef PRISON_EMERGENCY_RETRY
diff --git a/voidcrew/modules/player_outposts/outpost_prison_breakout.dm b/voidcrew/modules/player_outposts/outpost_prison_breakout.dm
index a54a098ff3f..9d6cc54d253 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_breakout.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_breakout.dm
@@ -80,7 +80,7 @@
* The ways out a rioter can get at, exit tile = its blocker: tiles on the cell block's edge beside
* ground they can walk, whose blocker they have not given up on for now.
*/
-/datum/outpost_prison/proc/exit_tiles(mob/living/basic/outpost_prisoner/rioter)
+/datum/outpost_prison/proc/exit_tiles(mob/living/carbon/human/npc/outpost_prisoner/rioter)
var/list/exits = list()
for(var/turf/tile as anything in rioter.reachable)
if(rioter.walkable?[tile] || !is_exit_tile(tile))
@@ -96,9 +96,9 @@
return istype(blocker, /obj/structure/table/reinforced/prison_hatch) ? 1 : PRISON_RIOT_EXIT_CROWD
/// How many rioters other than `except`, on their feet, are working at the way out on `tile`
-/datum/outpost_prison/proc/rioters_at_exit(turf/tile, mob/living/basic/outpost_prisoner/except)
+/datum/outpost_prison/proc/rioters_at_exit(turf/tile, mob/living/carbon/human/npc/outpost_prisoner/except)
var/count = 0
- for(var/mob/living/basic/outpost_prisoner/other in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/other in prisoners)
if(other == except || !other.is_rioting() || !other.trouble_can_act())
continue
var/atom/target = other.riot_target_ref?.resolve()
@@ -112,7 +112,7 @@
* farther than a door. One with no room left (exit_room()) is passed over unless `crowded_ok`.
* Null if none will do.
*/
-/datum/outpost_prison/proc/choose_exit(mob/living/basic/outpost_prisoner/rioter, list/exits, crowded_ok = FALSE)
+/datum/outpost_prison/proc/choose_exit(mob/living/carbon/human/npc/outpost_prisoner/rioter, list/exits, crowded_ok = FALSE)
var/turf/best
var/best_score = INFINITY
for(var/turf/tile as anything in exits)
@@ -148,7 +148,7 @@
* A fixture for a rioter to smash: one within PRISON_RIOT_DETOUR_RANGE tiles of `near` if there is
* one, else any they can reach, or null with `near_only`.
*/
-/datum/outpost_prison/proc/pick_fixture(mob/living/basic/outpost_prisoner/rioter, turf/near, near_only = FALSE)
+/datum/outpost_prison/proc/pick_fixture(mob/living/carbon/human/npc/outpost_prisoner/rioter, turf/near, near_only = FALSE)
var/list/found = list()
var/list/close = list()
for(var/turf/tile as anything in rioter.reachable)
@@ -173,7 +173,7 @@
* at, the wing's fixtures. Breaking out, they go for the ways out, crowded or not, and never stop
* for a fixture on the way.
*/
-/datum/outpost_prison/proc/pick_smash_target(mob/living/basic/outpost_prisoner/rioter)
+/datum/outpost_prison/proc/pick_smash_target(mob/living/carbon/human/npc/outpost_prisoner/rioter)
var/atom/priority = priority_smash_target(rioter)
if(priority)
return priority
@@ -192,7 +192,7 @@
return pick_fixture(rioter)
/// Whether a rioter can make for `tile` to get out: walkable for them, in the wing, outside the cell block, and not given up on
-/datum/outpost_prison/proc/escape_spot_ok(turf/tile, mob/living/basic/outpost_prisoner/rioter)
+/datum/outpost_prison/proc/escape_spot_ok(turf/tile, mob/living/carbon/human/npc/outpost_prisoner/rioter)
return isturf(tile) && tile.loc == wing && !cell_block[tile] && rioter.walkable?[tile] && LAZYACCESS(rioter.riot_skips, REF(tile)) <= world.time
/**
@@ -200,7 +200,7 @@
* can walk to, keeping the one they chose while it still works, and preferring one nobody stands on.
* Null with nobody home, so the rioters stay in the yard, and in a wing with no cells.
*/
-/datum/outpost_prison/proc/escape_spot(mob/living/basic/outpost_prisoner/rioter)
+/datum/outpost_prison/proc/escape_spot(mob/living/carbon/human/npc/outpost_prisoner/rioter)
if(!length(cell_block) || !length(rioter.walkable) || !crew_home())
return null
var/turf/chosen = rioter.riot_target_ref?.resolve()
@@ -233,7 +233,7 @@
* each way out this riot is announced; with nobody home it only booms. When the way gives, everyone's
* reach is worked out again so the rioters see the gap. Returns TRUE.
*/
-/datum/outpost_prison/proc/hit_exit(mob/living/basic/outpost_prisoner/rioter, obj/target)
+/datum/outpost_prison/proc/hit_exit(mob/living/carbon/human/npc/outpost_prisoner/rioter, obj/target)
var/turf/tile = get_turf(target)
rioter.trouble_line("riot_break_door", fallback = "riot")
if(!crew_home())
@@ -300,7 +300,7 @@
* hatch is forced open (force_open()). With the office side already open or gone, the yard side opens
* for them, or takes the blow if it cannot open. Returns TRUE if the office side gave.
*/
-/obj/structure/table/reinforced/prison_hatch/proc/take_rioter_blow(mob/living/basic/outpost_prisoner/rioter)
+/obj/structure/table/reinforced/prison_hatch/proc/take_rioter_blow(mob/living/carbon/human/npc/outpost_prisoner/rioter)
playsound(src, 'sound/effects/glass/glassbash.ogg', 50, TRUE)
var/obj/machinery/door/window/staff_door = staff_windoor()
if(staff_door?.density)
diff --git a/voidcrew/modules/player_outposts/outpost_prison_capture.dm b/voidcrew/modules/player_outposts/outpost_prison_capture.dm
index db9a890e563..75db2b47b69 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_capture.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_capture.dm
@@ -1,18 +1,17 @@
/**
* # Prison capture: cuffs and lockdown
*
- * Cuffs. A member of the wing can put any handcuffs, cable restraints or zipties on a prisoner.
- * One who is down takes PRISONER_CUFF_TIME_DOWN; one on their feet takes PRISONER_CUFF_TIME_STANDING,
- * holding still meanwhile, and only while making no trouble: rioters, runners, fighters, anyone
- * threatening staff and anyone wrecking their cell must be put down first. Cuffed, they drop what
- * they hold and do nothing but stand or sit where they are and complain: no blows, threats,
- * fights, climbing, smashing, eating or activities, and a runner's loose clock waits. Anyone can
- * drag them, and a member can take them through the wing's staff doors (outpost_prisoner_escorted()).
- * Cuffs kept on past PRISONER_CUFFED_GRACE sour them and stop their pay like a lock-in, unless it
- * is for good reason: the wing is in protective custody, or they owe lockdown. A member takes the
- * cuffs off from the talk menu ("Uncuff"), or with an empty hand while they are down: real cuffs go
- * to the member's hand, cable and zipties are cut away.
- * The cuffs drop to the floor when the prisoner dies, beams out or is deleted.
+ * Cuffs are tg's own handcuffs, cable restraints and zipties, put on through tg's cuffing (4 seconds,
+ * its sounds and messages). Only a member of the wing may cuff a prisoner (COMSIG_CARBON_CUFF_ATTEMPTED).
+ * Anyone making trouble on their feet (a rioter, a runner, a fighter, anyone squaring up to staff or
+ * climbing out) won't hold still: they step out of the cuffer's reach, which breaks the cuffing, so
+ * they get put down first. Cuffed, they can walk, as anyone can, but they choose to stand or sit where
+ * they are and complain: no blows, threats, fights, climbing, smashing, eating or activities, and a
+ * runner's loose clock waits. Anyone can drag them, and a member can take them through the wing's staff
+ * doors (outpost_prisoner_escorted()). Cuffs kept on past PRISONER_CUFFED_GRACE sour them and stop
+ * their pay like a lock-in, unless it is for good reason: the wing is in protective custody, or they owe
+ * lockdown. A member takes the cuffs off from the talk menu ("Uncuff"), or through the strip menu like
+ * anyone's: real cuffs go to the member's hand, cable and zipties are cut away. A body keeps its cuffs.
*
* Lockdown. A rioter shut in a cell, and a runner caught after getting out during a riot, owes
* PRISON_RIOT_LOCKDOWN_TIME of lockdown. It counts down only while they are shut in a cell, and
@@ -25,12 +24,7 @@
* outpost_prison_riot.dm). Only the ones shut in a cell owe lockdown.
*/
-/// Trait source for the cuffs holding a prisoner still
-#define PRISONER_CUFFS_TRAIT "outpost_prisoner_cuffs"
-
-/mob/living/basic/outpost_prisoner
- /// The cuffs on them, held in their contents
- var/obj/item/restraints/handcuffs/cuffs
+/mob/living/carbon/human/npc/outpost_prisoner
/// Seconds cuffed without good reason; falls PRISONER_LOCKED_IN_RECOVERY seconds a second once uncuffed
var/cuffed_seconds = 0
/// Someone is putting cuffs on them or taking them off
@@ -46,199 +40,143 @@
// ===== CUFFING =====
-/// Why `user` can't put `restraints` on them now, as a balloon alert, or null if they can
-/mob/living/basic/outpost_prisoner/proc/cuff_refusal(mob/living/user, obj/item/restraints/handcuffs/restraints)
+/// Why `user` can't put cuffs on them now, as a balloon alert, or null if they can
+/mob/living/carbon/human/npc/outpost_prisoner/proc/cuff_refusal(mob/living/user)
if(!prison || !prison.is_member(user))
return "members only"
if(stat == DEAD || phase != PRISONER_PRESENT)
return "can't cuff [p_them()]"
- if(cuffs)
- return "already cuffed"
- if(istype(restraints, /obj/item/restraints/handcuffs/cable/zipties/used))
- return "used up"
- // On their feet only when they are making no trouble; rioters and runners go down first.
- if(!is_down() && (trouble || threat_ref || swing_ref || climb_ref))
- return "won't hold still"
return null
-/// How long cuffing them takes: quicker when they are down
-/mob/living/basic/outpost_prisoner/proc/cuff_time()
- return (is_down() ? PRISONER_CUFF_TIME_DOWN : PRISONER_CUFF_TIME_STANDING) * bounty_cuff_mult()
-
-/// Cuffs used on them (from the item interaction signal): refused with a balloon alert, or put on in the background
-/mob/living/basic/outpost_prisoner/proc/on_cuffs_used(mob/living/user, obj/item/restraints/handcuffs/restraints)
- var/refusal = cuff_refusal(user, restraints)
- if(!refusal && cuff_work)
- refusal = "already busy"
- if(refusal)
- balloon_alert(user, refusal)
- return ITEM_INTERACT_BLOCKING
- INVOKE_ASYNC(src, PROC_REF(cuff_by), user, restraints)
- return ITEM_INTERACT_SUCCESS
+/// Making trouble on their feet: they won't stand still for the cuffs
+/mob/living/carbon/human/npc/outpost_prisoner/proc/fights_the_cuffs()
+ return !is_down() && (trouble || threat_ref || swing_ref || climb_ref)
/**
- * `user` puts `restraints` on them over cuff_time(), with tg's cuff sounds. They hold still
- * meanwhile (in_trouble() counts it, so their routine waits). Returns TRUE if they are cuffed. Sleeps.
+ * Someone starts cuffing them with tg's cuffs. Not a member: refused. Making trouble on their feet:
+ * they pull away out of reach, which breaks tg's cuffing do_after. Otherwise they hold still, and their
+ * routine waits while the cuffs go on.
*/
-/mob/living/basic/outpost_prisoner/proc/cuff_by(mob/living/user, obj/item/restraints/handcuffs/restraints)
- if(cuff_work || cuff_refusal(user, restraints))
- return FALSE
+/mob/living/carbon/human/npc/outpost_prisoner/proc/on_cuff_attempt(datum/source, mob/living/user)
+ SIGNAL_HANDLER
+ var/refusal = cuff_refusal(user)
+ if(refusal)
+ balloon_alert(user, refusal)
+ return COMSIG_CARBON_CUFF_PREVENT
+ if(fights_the_cuffs() && !HAS_TRAIT(src, TRAIT_IMMOBILIZED))
+ INVOKE_ASYNC(src, PROC_REF(pull_away_from), user)
+ return NONE
cuff_work = TRUE
ai_controller?.CancelActions()
- user.visible_message(span_danger("[user] is trying to put [restraints] on [src]!"), span_danger("You try to put [restraints] on [src]."))
- playsound(src, restraints.cuffsound, 30, TRUE, -2)
- var/done = do_after(user, cuff_time(), target = src, timed_action_flags = IGNORE_SLOWDOWNS)
- cuff_work = FALSE
- if(QDELETED(src))
- return FALSE
- // A borg's cuffs are part of its module: it dispenses a pair, as tg's cuffs do for borgs.
- var/dispense = iscyborg(user)
- if(!done || QDELETED(restraints) || (restraints.loc != user && !dispense) || cuff_refusal(user, restraints))
- balloon_alert(user, "failed to cuff!")
- return FALSE
- var/success_sound = restraints.cuffsuccesssound
- if(!apply_cuffs(restraints, user, dispense))
- balloon_alert(user, "failed to cuff!")
- return FALSE
- playsound(src, success_sound, 30, TRUE, -2)
- user.visible_message(span_notice("[user] handcuffs [src]."), span_notice("You handcuff [src]."))
- log_combat(user, src, "handcuffed")
- return TRUE
+ addtimer(VARSET_CALLBACK(src, cuff_work, FALSE), PRISONER_CUFF_TIME_STANDING + 1 SECONDS, TIMER_UNIQUE | TIMER_OVERRIDE)
+ return NONE
+
+/// A step out of `user`'s reach, as anyone twists away from someone with cuffs
+/mob/living/carbon/human/npc/outpost_prisoner/proc/pull_away_from(mob/living/user)
+ if(QDELETED(src) || QDELETED(user) || stat != CONSCIOUS)
+ return
+ step_away(src, user)
/**
- * Puts `restraints` on them at once; zipties become their used pair, as on people. `user`, if
- * any, gives them up from their hands, unless `dispense` (a borg), which puts on a new pair of the
- * same kind instead. What they hold drops and whatever they were up to stops. Returns TRUE if they
- * are cuffed.
+ * Cuffs went on: what they were up to stops. Called once the cuffs are on (the restrained trait
+ * handler, outpost_prison_prisoner.dm); their line comes from npc_bark().
*/
-/mob/living/basic/outpost_prisoner/proc/apply_cuffs(obj/item/restraints/handcuffs/restraints, mob/living/user, dispense = FALSE)
- if(cuffs || QDELETED(restraints) || stat == DEAD)
- return FALSE
- var/obj/item/restraints/handcuffs/worn = restraints
- if(dispense)
- var/dispensed_path = restraints.trashtype || restraints.type
- worn = new dispensed_path(src)
- else
- if(user && !user.temporarilyRemoveItemFromInventory(restraints))
- return FALSE
- if(restraints.trashtype)
- var/trash_path = restraints.trashtype
- worn = new trash_path(src)
- qdel(restraints)
- else
- restraints.forceMove(src)
- if(QDELETED(worn) || worn.loc != src)
- return FALSE
- cuffs = worn
- ADD_TRAIT(src, TRAIT_IMMOBILIZED, PRISONER_CUFFS_TRAIT)
- if(has_shiv())
- drop_shiv()
- else
- drop_held_item()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/on_cuffed()
+ cuff_work = FALSE
end_activity()
cancel_threat()
stop_climb(fell = TRUE)
// The breakout AI too: a caught runner stays put until walked home.
ai_controller?.CancelActions()
- // Draggable now: whatever trouble they were in stops (on_downed()).
- update_drag_resistance()
- update_appearance(UPDATE_OVERLAYS)
update_bubble()
- if(stat == CONSCIOUS)
- say_context("cuffed")
- return TRUE
// ===== UNCUFFING =====
/**
- * A member takes the cuffs off by hand, over PRISONER_UNCUFF_TIME. Returns TRUE if
+ * A member takes the cuffs off by hand from the talk menu, over PRISONER_UNCUFF_TIME. Returns TRUE if
* they came off. Sleeps.
*/
-/mob/living/basic/outpost_prisoner/proc/uncuff_by(mob/living/user)
- if(!cuffs || cuff_work)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/uncuff_by(mob/living/user)
+ var/obj/item/restraints/handcuffs/worn = handcuffed
+ if(!worn || cuff_work)
return FALSE
cuff_work = TRUE
- user.visible_message(span_notice("[user] starts taking [cuffs] off [src]."), span_notice("You start taking [cuffs] off [src]."))
+ user.visible_message(span_notice("[user] starts taking [worn] off [src]."), span_notice("You start taking [worn] off [src]."))
var/done = do_after(user, PRISONER_UNCUFF_TIME, target = src)
cuff_work = FALSE
- if(!done || QDELETED(src) || !cuffs || !prison?.is_member(user))
+ if(!done || QDELETED(src) || handcuffed != worn || !prison?.is_member(user))
return FALSE
- var/cut = istype(cuffs, /obj/item/restraints/handcuffs/cable)
- user.visible_message(span_notice("[user] [cut ? "cuts" : "takes"] [cuffs] off [src]."), span_notice("You [cut ? "cut" : "take"] [cuffs] off [src]."))
+ var/cut = istype(worn, /obj/item/restraints/handcuffs/cable)
+ user.visible_message(span_notice("[user] [cut ? "cuts" : "takes"] [worn] off [src]."), span_notice("You [cut ? "cut" : "take"] [worn] off [src]."))
remove_cuffs(user)
- if(stat == CONSCIOUS)
- say_context("cuffs_off")
return TRUE
/**
- * Takes their cuffs off. With `user`, real cuffs go to their hands (or the floor) and cable
- * restraints and zipties are cut away; without, the cuffs drop where they are. Returns the cuffs
- * still about, or null.
+ * Takes their cuffs off through tg's uncuff(). With `user`, real cuffs go to their hands (or the floor)
+ * and cable restraints and zipties are cut away; without, the cuffs drop where they are. Returns the
+ * cuffs still about, or null.
*/
-/mob/living/basic/outpost_prisoner/proc/remove_cuffs(mob/living/user)
- var/obj/item/restraints/handcuffs/worn = cuffs
+/mob/living/carbon/human/npc/outpost_prisoner/proc/remove_cuffs(mob/living/user)
+ var/obj/item/restraints/handcuffs/worn = handcuffed
if(!worn)
return null
- // Cleared first, so Exited() leaves the rest to this proc.
- cuffs = null
+ uncuff()
+ if(QDELETED(worn))
+ return null
if(user && istype(worn, /obj/item/restraints/handcuffs/cable))
qdel(worn)
- worn = null
- else
- worn.forceMove(drop_location())
- if(user)
- user.put_in_hands(worn)
- uncuffed()
+ return null
+ user?.put_in_hands(worn)
return worn
/// The cuffs are off, however they came off
-/mob/living/basic/outpost_prisoner/proc/uncuffed()
- REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, PRISONER_CUFFS_TRAIT)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/uncuffed()
if(QDELETED(src))
return
- update_drag_resistance()
- update_appearance(UPDATE_OVERLAYS)
prison?.refresh_prisoner_reach(src)
-// ===== CUFFED =====
+/// Cuffs on or off (tg's TRAIT_RESTRAINED)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/on_restraint_changed()
+ if(QDELETED(src))
+ return
+ if(handcuffed)
+ INVOKE_ASYNC(src, PROC_REF(on_cuffed))
+ else
+ INVOKE_ASYNC(src, PROC_REF(uncuffed))
-// Cuffed hands throw no punches, whatever their AI wants.
-/mob/living/basic/outpost_prisoner/early_melee_attack(atom/target, list/modifiers, ignore_cooldown = FALSE)
- if(cuffs)
- return FALSE
- return ..()
+// ===== CUFFED =====
/// Whether their cuffs are souring them and stopping their pay: on past PRISONER_CUFFED_GRACE, and not for good reason
-/mob/living/basic/outpost_prisoner/proc/cuffs_souring()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/cuffs_souring()
return cuffed_seconds > PRISONER_CUFFED_GRACE && !prison?.restraint_justified(src)
/// Whether restraining a prisoner is for good reason right now, so it costs them nothing: protective custody, or lockdown they owe
-/datum/outpost_prison/proc/restraint_justified(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/restraint_justified(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
return prisoner.lockdown_left > 0 || protective_custody()
/**
* Advances a prisoner's cuffed clock by `seconds`: up while cuffed without good reason, and down
* PRISONER_LOCKED_IN_RECOVERY seconds a second once the cuffs are off, like the lock-in clock.
*/
-/datum/outpost_prison/proc/update_cuffed(mob/living/basic/outpost_prisoner/prisoner, seconds)
- if(prisoner.cuffs)
+/datum/outpost_prison/proc/update_cuffed(mob/living/carbon/human/npc/outpost_prisoner/prisoner, seconds)
+ if(prisoner.handcuffed)
if(!restraint_justified(prisoner))
prisoner.cuffed_seconds += seconds
return
prisoner.cuffed_seconds = max(0, prisoner.cuffed_seconds - PRISONER_LOCKED_IN_RECOVERY * seconds)
-/// Cuffed, they plan nothing: no routine, no trouble, no patrol, no doors. First on both prisoner controllers.
+/// Cuffed, they choose to plan nothing: no routine, no trouble, no patrol, no doors. First on both prisoner controllers.
/datum/ai_planning_subtree/outpost_prisoner_cuffed
/datum/ai_planning_subtree/outpost_prisoner_cuffed/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/outpost_prisoner/prisoner = controller.pawn
- if(istype(prisoner) && prisoner.cuffs)
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = controller.pawn
+ if(istype(prisoner) && prisoner.handcuffed)
return SUBTREE_RETURN_FINISH_PLANNING
// ===== LOCKDOWN =====
/// They owe PRISON_RIOT_LOCKDOWN_TIME of lockdown from now. `quiet` leaves the line to the caller.
-/datum/outpost_prison/proc/start_lockdown(mob/living/basic/outpost_prisoner/prisoner, quiet = FALSE)
+/datum/outpost_prison/proc/start_lockdown(mob/living/carbon/human/npc/outpost_prisoner/prisoner, quiet = FALSE)
prisoner.lockdown_left = PRISON_RIOT_LOCKDOWN_TIME
prisoner.lockdown_out = 0
add_log("[prisoner.real_name] is on lockdown.")
@@ -251,7 +189,7 @@
* out early. Down, cuffed or loose, the grace waits, and so does it while the cell they were serving
* in is still bolted: they got out through a hole, and nobody let them out.
*/
-/datum/outpost_prison/proc/lockdown_tick(mob/living/basic/outpost_prisoner/prisoner, seconds)
+/datum/outpost_prison/proc/lockdown_tick(mob/living/carbon/human/npc/outpost_prisoner/prisoner, seconds)
if(prisoner.lockdown_left <= 0)
prisoner.lockdown_out = 0
prisoner.lockdown_cell_ref = null
@@ -274,7 +212,7 @@
let_out_early(prisoner)
/// Served: the warden's log notes it once, and the prisoner says so. The usual lock-in rules apply again.
-/datum/outpost_prison/proc/lockdown_served(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/lockdown_served(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
prisoner.lockdown_left = 0
prisoner.lockdown_out = 0
prisoner.lockdown_cell_ref = null
@@ -286,7 +224,7 @@
* Let out before the lockdown was served: logged once, and they riot again, joining a riot
* that is on or starting one whatever the quiet after the last. Returns TRUE if they are rioting.
*/
-/datum/outpost_prison/proc/let_out_early(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/let_out_early(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
prisoner.lockdown_left = 0
prisoner.lockdown_out = 0
add_log("[prisoner.real_name] was let out before their lockdown was up.")
@@ -309,12 +247,10 @@
// ===== WHERE STAFF LOOK =====
-/mob/living/basic/outpost_prisoner/examine(mob/user)
+/mob/living/carbon/human/npc/outpost_prisoner/examine(mob/user)
. = ..()
if(stat == DEAD)
return
- if(cuffs)
- . += span_warning("[p_They()] [p_are()] handcuffed.")
if(lockdown_left > 0)
. += span_notice("On lockdown for [outpost_prison_lockdown_text(lockdown_left)].")
@@ -324,7 +260,7 @@
var/datum/outpost_prison_cell/cell = prison?.cell_by_number(cell_number)
if(!cell)
return
- for(var/mob/living/basic/outpost_prisoner/prisoner in prison.prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prison.prisoners)
if(prisoner.lockdown_left <= 0 || prisoner.stat == DEAD || prisoner.phase != PRISONER_PRESENT)
continue
var/inside = cell.contains(prisoner)
@@ -335,4 +271,3 @@
line += " [prisoner.p_They()] [prisoner.p_are()] not in the cell."
. += span_notice(line)
-#undef PRISONER_CUFFS_TRAIT
diff --git a/voidcrew/modules/player_outposts/outpost_prison_changeling.dm b/voidcrew/modules/player_outposts/outpost_prison_changeling.dm
index c621aff305f..ab3137d6a6f 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_changeling.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_changeling.dm
@@ -71,7 +71,7 @@
* calls this once the host has eaten the tainted food. Returns the event, or null if it cannot
* start (a dead host, someone else's prisoner, or a changeling already running in the wing).
*/
-/proc/outpost_changeling_infect(mob/living/basic/outpost_prisoner/host, datum/outpost_prison/prison)
+/proc/outpost_changeling_infect(mob/living/carbon/human/npc/outpost_prisoner/host, datum/outpost_prison/prison)
if(QDELETED(host) || QDELETED(prison) || host.stat == DEAD || host.prison != prison)
return null
if(prison.active_changeling && prison.active_changeling.stage != "done")
@@ -89,7 +89,7 @@
/// Why it ended, once it has
var/end_reason
var/datum/outpost_prison/prison
- var/mob/living/basic/outpost_prisoner/host
+ var/mob/living/carbon/human/npc/outpost_prisoner/host
var/mob/living/basic/headslug/beakless/outpost/slug
var/mob/living/basic/outpost_experiment/horror/horror
/// The vent the slug is in, or the one that is giving way
@@ -141,7 +141,7 @@
/// Prisoners whose deaths are watched while a creature is loose
var/list/watched_prisoners = list()
-/datum/outpost_changeling_event/New(mob/living/basic/outpost_prisoner/new_host, datum/outpost_prison/new_prison)
+/datum/outpost_changeling_event/New(mob/living/carbon/human/npc/outpost_prisoner/new_host, datum/outpost_prison/new_prison)
. = ..()
prison = new_prison
prison.active_changeling = src
@@ -256,21 +256,41 @@
// ===== THE HOST =====
-/datum/outpost_changeling_event/proc/link_host(mob/living/basic/outpost_prisoner/new_host)
+/datum/outpost_changeling_event/proc/link_host(mob/living/carbon/human/npc/outpost_prisoner/new_host)
host = new_host
host.experiment_subject = TRUE
host.update_bubble()
RegisterSignal(host, COMSIG_LIVING_DEATH, PROC_REF(on_host_death))
RegisterSignal(host, COMSIG_QDELETING, PROC_REF(on_host_deleted))
+ // EX-8: the specimen is a real thing in their chest, which surgery can cut out.
+ var/obj/item/organ/body_egg/outpost_specimen/specimen = new()
+ specimen.event_ref = WEAKREF(src)
+ if(!specimen.Insert(new_host, special = TRUE))
+ qdel(specimen)
+
+/// The specimen in the host, if there is one
+/datum/outpost_changeling_event/proc/host_specimen()
+ if(QDELETED(host))
+ return null
+ return locate(/obj/item/organ/body_egg/outpost_specimen) in host.organs
+
+/// Takes the specimen out of the host for good, as the burst or the end of the experiment does
+/datum/outpost_changeling_event/proc/remove_specimen()
+ var/obj/item/organ/body_egg/outpost_specimen/specimen = host_specimen()
+ if(!specimen)
+ return
+ specimen.event_ref = null
+ specimen.Remove(specimen.owner, special = TRUE)
+ qdel(specimen)
/// Lets go of the host: signals off and back on their feet. `cured` also ends their part in the experiment.
/datum/outpost_changeling_event/proc/release_host(cured = FALSE)
if(!host)
return
- var/mob/living/basic/outpost_prisoner/was_host = host
+ remove_specimen()
+ var/mob/living/carbon/human/npc/outpost_prisoner/was_host = host
host = null
UnregisterSignal(was_host, list(COMSIG_LIVING_DEATH, COMSIG_QDELETING))
- was_host.remove_traits(list(TRAIT_FLOORED, TRAIT_INCAPACITATED, TRAIT_IMMOBILIZED), CHANGELING_HOST_TRAIT)
if(istype(was_host.activity, /datum/prisoner_activity/changeling_bed))
was_host.end_activity()
if(cured && !QDELETED(was_host))
@@ -319,7 +339,7 @@
if(!said_pain && incubation_elapsed >= OUTPOST_CHANGELING_TELL_PAIN)
said_pain = TRUE
INVOKE_ASYNC(host, TYPE_PROC_REF(/atom, manual_emote), "rubs [host.p_their()] stomach and winces.")
- INVOKE_ASYNC(host, TYPE_PROC_REF(/mob/living/basic/outpost_prisoner, say_context), "experiment_dose")
+ INVOKE_ASYNC(host, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prisoner, say_context), "experiment_dose")
prison.add_log("[host.real_name] complains of stomach pain.")
return
if(!said_retch && incubation_elapsed >= OUTPOST_CHANGELING_TELL_RETCH)
@@ -368,25 +388,33 @@
heave_left = rand(3, 5)
heave()
-/// The host goes down, on their bunk if they got there: groaning, and draggable
+/**
+ * The host goes down, on their bunk if they got there: groaning, and draggable. They lie down the way
+ * anyone sick does, and the heaves keep knocking them flat (heave()).
+ */
/datum/outpost_changeling_event/proc/host_lie_down()
if(host_down || QDELETED(host))
return
host_down = TRUE
- host.add_traits(list(TRAIT_FLOORED, TRAIT_INCAPACITATED, TRAIT_IMMOBILIZED), CHANGELING_HOST_TRAIT)
+ host.set_resting(TRUE, silent = TRUE)
+ host.Knockdown(OUTPOST_CHANGELING_HOST_KNOCKDOWN)
host.visible_message(span_warning("[host] curls up, groaning, arms wrapped around [host.p_their()] belly."))
-/// The host's belly heaves; now and then a neighbour notices
+/// The host's belly heaves, and they are sick and knocked flat by it; now and then a neighbour notices
/datum/outpost_changeling_event/proc/heave()
host.Shake(1, 0, 0.6 SECONDS)
playsound(host, 'sound/effects/meatslap.ogg', 15, TRUE, -2)
+ if(host.stat != DEAD)
+ if(prob(40))
+ host.vomit(VOMIT_CATEGORY_KNOCKDOWN, lost_nutrition = 0)
+ host.Knockdown(OUTPOST_CHANGELING_HOST_KNOCKDOWN)
if(prob(50))
host.visible_message(span_warning("Something moves under [host]'s jumpsuit. [host.p_Their()] belly heaves."))
else
INVOKE_ASYNC(host, TYPE_PROC_REF(/atom, manual_emote), pick("groans.", "moans.", "whimpers."))
if(!prob(30))
return
- for(var/mob/living/basic/outpost_prisoner/neighbour in shuffle(prison.prisoners))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/neighbour in shuffle(prison.prisoners))
if(neighbour == host || neighbour.stat != CONSCIOUS || neighbour.phase != PRISONER_PRESENT || !(host in view(6, neighbour)))
continue
INVOKE_ASYNC(neighbour, TYPE_PROC_REF(/atom, manual_emote), pick("stares at [host].", "backs away from [host].", "covers [neighbour.p_their()] mouth.", "calls out to [host]. No answer."))
@@ -427,7 +455,7 @@
if(!spot)
lose_specimen("the host is gone")
return FALSE
- var/mob/living/basic/outpost_prisoner/victim = host
+ var/mob/living/carbon/human/npc/outpost_prisoner/victim = host
release_host()
stage = "burst"
early_burst_left = 0
@@ -495,7 +523,7 @@
/// Prisoners who saw it scream
/datum/outpost_changeling_event/proc/scream_near(turf/spot)
var/screamed = 0
- for(var/mob/living/basic/outpost_prisoner/witness in view(7, spot))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/witness in view(7, spot))
if(witness.stat != CONSCIOUS || witness.phase != PRISONER_PRESENT || witness.can_be_dragged())
continue
INVOKE_ASYNC(witness, TYPE_PROC_REF(/atom, manual_emote), pick("screams!", "shrieks and scrambles back!", "yells in horror!"))
@@ -656,13 +684,13 @@
if(level < 2 || !prison.wing_can_speak())
return FALSE
var/context = level >= 3 ? "creature_panic" : "vent_noise"
- for(var/mob/living/basic/outpost_prisoner/listener in shuffle(prison.prisoners))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/listener in shuffle(prison.prisoners))
if(listener.stat != CONSCIOUS || listener.phase != PRISONER_PRESENT || listener.can_be_dragged() || !listener.ai_running())
continue
if(get_dist(listener, vent) > 7)
continue
prison.note_speech()
- INVOKE_ASYNC(listener, TYPE_PROC_REF(/mob/living/basic/outpost_prisoner, say_context), context)
+ INVOKE_ASYNC(listener, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prisoner, say_context), context)
return TRUE
return FALSE
@@ -813,13 +841,13 @@
/datum/outpost_changeling_event/proc/horror_remark(context)
if(QDELETED(horror) || QDELETED(prison) || !prison.wing_can_speak())
return FALSE
- for(var/mob/living/basic/outpost_prisoner/witness in shuffle(prison.prisoners))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/witness in shuffle(prison.prisoners))
if(witness.stat != CONSCIOUS || witness.phase != PRISONER_PRESENT || witness.can_be_dragged() || !witness.ai_running())
continue
if(!(horror in view(7, witness)))
continue
prison.note_speech()
- INVOKE_ASYNC(witness, TYPE_PROC_REF(/mob/living/basic/outpost_prisoner, say_context), context)
+ INVOKE_ASYNC(witness, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prisoner, say_context), context)
return TRUE
return FALSE
@@ -909,7 +937,7 @@
/datum/outpost_changeling_event/proc/panic_prisoners()
panicked = TRUE
var/shouts = 0
- for(var/mob/living/basic/outpost_prisoner/prisoner in prison.prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prison.prisoners)
if(prisoner == host || !prisoner.routine_allowed() || prisoner.is_confined())
continue
if(istype(prisoner.activity, /datum/prisoner_activity/flee_creature) || istype(prisoner.activity, /datum/prisoner_activity/creature_panic))
@@ -921,11 +949,11 @@
prisoner.start_activity(flee)
if(shouts < 2 && prisoner.ai_running())
shouts++
- INVOKE_ASYNC(prisoner, TYPE_PROC_REF(/mob/living/basic/outpost_prisoner, say_context), "creature_panic")
+ INVOKE_ASYNC(prisoner, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prisoner, say_context), "creature_panic")
/// Watches the prisoners' deaths while a creature is loose
/datum/outpost_changeling_event/proc/watch_prisoners()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prison.prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prison.prisoners)
if(prisoner.stat == DEAD || watched_prisoners[prisoner])
continue
watched_prisoners[prisoner] = TRUE
@@ -933,7 +961,7 @@
RegisterSignal(prisoner, COMSIG_QDELETING, PROC_REF(on_watched_prisoner_deleted))
/datum/outpost_changeling_event/proc/unwatch_prisoners()
- for(var/mob/living/basic/outpost_prisoner/prisoner as anything in watched_prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner as anything in watched_prisoners)
UnregisterSignal(prisoner, list(COMSIG_LIVING_DEATH, COMSIG_QDELETING))
watched_prisoners.Cut()
@@ -943,7 +971,7 @@
watched_prisoners -= source
/// A prisoner died while a creature was loose: the creature's kill if it was beside them
-/datum/outpost_changeling_event/proc/on_prisoner_died(mob/living/basic/outpost_prisoner/victim, gibbed)
+/datum/outpost_changeling_event/proc/on_prisoner_died(mob/living/carbon/human/npc/outpost_prisoner/victim, gibbed)
SIGNAL_HANDLER
var/mob/living/creature = current_creature()
note_death(victim, creature && get_dist(creature, victim) <= 2)
@@ -962,7 +990,7 @@
var/turf/spot = get_turf(victim)
if(!spot)
return TRUE
- for(var/mob/living/basic/outpost_prisoner/witness in view(7, spot))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/witness in view(7, spot))
if(witness == victim || witness.stat != CONSCIOUS || witness.phase != PRISONER_PRESENT)
continue
witnesses |= WEAKREF(witness)
@@ -978,7 +1006,7 @@
if(QDELETED(prison))
return
for(var/datum/weakref/ref as anything in witnesses)
- var/mob/living/basic/outpost_prisoner/witness = ref.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/witness = ref.resolve()
if(QDELETED(witness) || witness.stat == DEAD || !(witness in prison.prisoners))
continue
witness.adjust_mood(-OUTPOST_CHANGELING_WITNESS_MOOD)
@@ -1421,3 +1449,34 @@
#undef CHANGELING_HOST_TRAIT
#undef HEADSLUG_VENT_TRAIT
#undef BB_OUTPOST_HEADSLUG_VENT
+
+// ===== THE SPECIMEN IN A BODY =====
+
+/**
+ * The specimen growing in a host with a body (EX-8): a real organ in the chest, as tg's alien embryo is.
+ * The event's clock grows it and bursts the host; the organ is what is there to find on a scanner or cut
+ * out in surgery. Cut out, it dies, and the experiment loses its specimen.
+ */
+/obj/item/organ/body_egg/outpost_specimen
+ name = "Kessler specimen"
+ desc = "A small, wet, curled-up thing that never stops moving."
+ icon_state = "innards"
+ /// The changeling event it is part of
+ var/datum/weakref/event_ref
+
+/obj/item/organ/body_egg/outpost_specimen/Destroy()
+ event_ref = null
+ return ..()
+
+/obj/item/organ/body_egg/outpost_specimen/on_mob_remove(mob/living/carbon/egg_owner, special, movement_flags)
+ . = ..()
+ // The event's own removals (the burst, the end of the experiment) are special.
+ if(special)
+ return
+ var/datum/outpost_changeling_event/event = event_ref?.resolve()
+ event_ref = null
+ // Cut out: it dies outside a body, and the specimen is lost.
+ if(event)
+ INVOKE_ASYNC(event, TYPE_PROC_REF(/datum/outpost_changeling_event, lose_specimen), "the specimen was cut out")
+ visible_message(span_warning("[src] shudders and goes still."))
+ QDEL_IN(src, 1)
diff --git a/voidcrew/modules/player_outposts/outpost_prison_conditions.dm b/voidcrew/modules/player_outposts/outpost_prison_conditions.dm
index 287e720cf6f..46ce61e5564 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_conditions.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_conditions.dm
@@ -24,9 +24,7 @@
/// How often mess, air and rats are refreshed, in seconds
#define PRISON_MESS_REFRESH_SECONDS 5
-/// Seconds per step of damage from bad air
-#define PRISON_AIR_STEP_SECONDS 5
-/// Percent chance a prisoner hurt by bad air says so
+/// Percent chance a prisoner on bad air says so, each check
#define PRISON_AIR_LINE_CHANCE 15
/// Mess weight by type (see PRISON_MESS_WEIGHT_*); types not listed are not mess
@@ -530,7 +528,7 @@ GLOBAL_LIST_INIT(outpost_prison_furniture_types, zebra_typecacheof(list(
/datum/outpost_prison/proc/check_battery()
var/battery = battery_percent()
if(!isnull(battery) && !isnull(last_battery) && last_battery >= PRISON_BATTERY_WARNING && battery < PRISON_BATTERY_WARNING)
- var/mob/living/basic/outpost_prisoner/speaker = pick_conditions_speaker()
+ var/mob/living/carbon/human/npc/outpost_prisoner/speaker = pick_conditions_speaker()
if(speaker?.say_context("lights_flicker"))
note_speech()
last_battery = battery
@@ -572,7 +570,7 @@ GLOBAL_LIST_INIT(outpost_prison_furniture_types, zebra_typecacheof(list(
* no power costs in proportion; a clean, lit, powered wing is a small comfort; and a dark cell of
* their own costs a little more.
*/
-/mob/living/basic/outpost_prisoner/proc/wing_mood_per_minute()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/wing_mood_per_minute()
var/loss = 0
var/gain = 0
if(prison && trouble != PRISONER_TROUBLE_LOOSE)
@@ -587,20 +585,18 @@ GLOBAL_LIST_INIT(outpost_prison_furniture_types, zebra_typecacheof(list(
// ===== AIR =====
-/// Prisoners on bad air lose a little health every PRISON_AIR_STEP_SECONDS, never below PRISON_AIR_HEALTH_FLOOR percent
+/**
+ * Bad air is tg's own: prisoners breathe like anyone, and a breach, a fire or a plasma leak hurts them
+ * the way it hurts the crew. Each check, a prisoner on bad air may say so, and goes for a mask and a tank
+ * from the cell block's emergency locker (outpost_prison_breach.dm); once they wear one, they breathe
+ * from it while the air is bad.
+ */
/datum/outpost_prison/proc/air_tick(seconds)
- var/steps = max(1, round(seconds / PRISON_AIR_STEP_SECONDS))
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.phase != PRISONER_PRESENT || prisoner.stat == DEAD || !outpost_prison_unsafe_air(prisoner.loc?.return_air()))
continue
- var/hurt = FALSE
- for(var/i in 1 to steps)
- var/above_floor = prisoner.health - prisoner.maxHealth * PRISON_AIR_HEALTH_FLOOR / 100
- if(above_floor <= 0)
- break
- prisoner.adjustBruteLoss(min(PRISON_AIR_DAMAGE, above_floor))
- hurt = TRUE
- if(hurt && prisoner.stat == CONSCIOUS && prob(PRISON_AIR_LINE_CHANCE) && wing_can_speak() && prisoner.say_context("no_air"))
+ prisoner.on_bad_air()
+ if(prisoner.stat == CONSCIOUS && prob(PRISON_AIR_LINE_CHANCE) && wing_can_speak() && prisoner.say_context("no_air"))
note_speech()
/// Whether air is too thin, too thick, too hot, too cold or too full of plasma to live in
@@ -652,7 +648,7 @@ GLOBAL_LIST_INIT(outpost_prison_furniture_types, zebra_typecacheof(list(
var/mob/living/basic/mouse/rat = new(spot)
rat_refs += WEAKREF(rat)
log_game("PLAYER OUTPOST PRISON: a rat turned up in the prison wing at '[outpost?.name]'")
- for(var/mob/living/basic/outpost_prisoner/prisoner in view(7, spot))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in view(7, spot))
if(prisoner.prison == src && prisoner.stat == CONSCIOUS && prisoner.say_context("rat"))
note_speech()
break
@@ -661,7 +657,7 @@ GLOBAL_LIST_INIT(outpost_prison_furniture_types, zebra_typecacheof(list(
/// Someone in the wing to remark on its state
/datum/outpost_prison/proc/pick_conditions_speaker()
var/list/candidates = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.phase == PRISONER_PRESENT && prisoner.stat == CONSCIOUS && prisoner.trouble != PRISONER_TROUBLE_LOOSE)
candidates += prisoner
return length(candidates) ? pick(candidates) : null
diff --git a/voidcrew/modules/player_outposts/outpost_prison_containment.dm b/voidcrew/modules/player_outposts/outpost_prison_containment.dm
index 077e9c53675..2e9538328ab 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_containment.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_containment.dm
@@ -116,7 +116,7 @@
* pulled by a member of the wing who may use the door. Visitors let in may use the door, but
* never take a prisoner with them, so nobody but the wing's own people can drag one off the outpost.
*/
-/proc/outpost_prisoner_escorted(atom/door, mob/living/basic/outpost_prisoner/prisoner)
+/proc/outpost_prisoner_escorted(atom/door, mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(!istype(prisoner) || !prisoner.can_be_dragged())
return FALSE
var/mob/living/puller = prisoner.pulledby
@@ -165,7 +165,7 @@
/// Refreshes where every prisoner can walk and reach. The prisoners share one look at each tile.
/datum/outpost_prison/proc/refresh_reach()
var/list/standable = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
refresh_prisoner_reach(prisoner, standable)
/**
@@ -174,7 +174,7 @@
* seen through the office windows is not. `standable` (turf = whether a prisoner can stand there)
* is shared by every prisoner in one refresh, so each tile is looked at once.
*/
-/datum/outpost_prison/proc/refresh_prisoner_reach(mob/living/basic/outpost_prisoner/prisoner, list/standable)
+/datum/outpost_prison/proc/refresh_prisoner_reach(mob/living/carbon/human/npc/outpost_prisoner/prisoner, list/standable)
var/list/walked = list()
var/list/reach = list()
var/turf/start = get_turf(prisoner)
@@ -244,6 +244,8 @@
if(!found[tile] && !isclosedturf(tile))
staff_ground[tile] = TRUE
record_layout()
+ // Masks and tanks for a breach (outpost_prison_breach.dm)
+ ensure_emergency_lockers()
/**
* Whether the cell block flood carries on through a tile. Only the wing's structure stops it:
@@ -413,49 +415,52 @@
/**
* Hooks up what keeps a prisoner contained; called from Initialize(). Teleports fail, forced ones
- * included (drop pods, quantum pads); polymorph and type changes fail; and a dead prisoner stays
- * dead: anything that tries to bring them back gets the body collected at once instead.
- * TRAIT_NO_TRANSFORM would stop polymorph too, but it also stops their AI moving them.
+ * included (drop pods, quantum pads); polymorph and type changes fail. A dead prisoner can be brought
+ * back like anyone (on_revived()). TRAIT_NO_TRANSFORM would stop polymorph too, but it also stops their
+ * AI moving them.
*/
-/mob/living/basic/outpost_prisoner/proc/setup_containment()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/setup_containment()
RegisterSignal(src, COMSIG_MOVABLE_TELEPORTING, PROC_REF(refuse_teleport))
RegisterSignal(src, COMSIG_LIVING_PRE_WABBAJACKED, PROC_REF(refuse_polymorph))
RegisterSignal(src, COMSIG_PRE_MOB_CHANGED_TYPE, PROC_REF(refuse_type_change))
- RegisterSignal(src, COMSIG_LIVING_REVIVE, PROC_REF(on_revive_attempt))
+ RegisterSignal(src, COMSIG_LIVING_REVIVE, PROC_REF(on_revived))
-/mob/living/basic/outpost_prisoner/proc/refuse_teleport(datum/source, atom/destination, channel)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/refuse_teleport(datum/source, atom/destination, channel)
SIGNAL_HANDLER
if(isturf(loc))
visible_message(span_notice("[src] flickers for a moment, but stays where [p_they()] [p_are()]."))
return TRUE
-/mob/living/basic/outpost_prisoner/proc/refuse_polymorph(datum/source, what_to_randomize)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/refuse_polymorph(datum/source, what_to_randomize)
SIGNAL_HANDLER
visible_message(span_notice("[src] shimmers for a moment, then looks the same as before."))
return STOP_WABBAJACK
-/mob/living/basic/outpost_prisoner/proc/refuse_type_change(datum/source)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/refuse_type_change(datum/source)
SIGNAL_HANDLER
return COMPONENT_BLOCK_MOB_CHANGE
-/// The dead stay dead: the corrections service has already logged the death, whether or not the body is still in the cell block
-/mob/living/basic/outpost_prisoner/can_be_revived()
- if(died_at || (prison && phase == PRISONER_PRESENT))
- return FALSE
- return ..()
-
-/// Someone tried to bring a dead prisoner back
-/mob/living/basic/outpost_prisoner/proc/on_revive_attempt(datum/source, full_heal_flags)
+/**
+ * Brought back (a defibrillator, strange reagent: tg's revival works on them as on anyone). Still on the
+ * roster, they are the same inmate again: the death stays on the books (its record closed, the yard's
+ * blame not taken back) and the log says so. Revived after their body left the roster, the corrections
+ * service takes them back off the outpost.
+ */
+/mob/living/carbon/human/npc/outpost_prisoner/proc/on_revived(datum/source, full_heal_flags)
SIGNAL_HANDLER
- if(stat != DEAD || !prison || phase != PRISONER_PRESENT)
+ if(prison && phase == PRISONER_PRESENT)
+ if(died_at)
+ prison.add_log("[real_name] was revived. The corrections service has already logged the death.")
+ died_at = 0
return
- prison.add_log("Someone tried to revive [real_name]. The corrections service has already logged the death.")
+ if(phase != PRISONER_LEAVING)
+ INVOKE_ASYNC(src, PROC_REF(beam_out))
/**
* Whether they are shut in their cell: standing in a cell with its door bolted shut, or with
* nowhere to walk but the cell and its doorway (a welded, walled-in or unpowered door).
*/
-/mob/living/basic/outpost_prisoner/proc/is_confined()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/is_confined()
var/datum/outpost_prison_cell/holding = prison?.cell_at(get_turf(src))
if(!holding)
return FALSE
diff --git a/voidcrew/modules/player_outposts/outpost_prison_contraband.dm b/voidcrew/modules/player_outposts/outpost_prison_contraband.dm
index b61ff885838..98cb3a30eb6 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_contraband.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_contraband.dm
@@ -39,7 +39,7 @@
/// world.time a search of this cell last cost its owner mood
var/searched_at = 0
-/mob/living/basic/outpost_prisoner
+/mob/living/carbon/human/npc/outpost_prisoner
/// Seconds their mood has stayed low enough to make a shiv, and to brew pruno
var/contraband_shiv_sour = 0
var/contraband_brew_sour = 0
@@ -62,12 +62,12 @@
// ===== THE PRISONER'S SIDE =====
/// Hooks up the prisoner's side of contraband and mail (the letter hand-over); called from setup_extras()
-/mob/living/basic/outpost_prisoner/proc/setup_contraband()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/setup_contraband()
// An element, since the prisoner's own handler for item use already takes the signal (outpost_prison_mail.dm)
AddElement(/datum/element/outpost_prison_mail_handover)
/// The sour clocks, the drink wearing off and the drunk's sway
-/mob/living/basic/outpost_prisoner/proc/contraband_counters(seconds)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/contraband_counters(seconds)
// Each sour clock counts while mood is under its line, holds just above it, and resets once they cheer up
if(mood >= OUTPOST_CONTRABAND_SOUR_RESET)
contraband_shiv_sour = 0
@@ -87,19 +87,19 @@
if(stat == CONSCIOUS && isturf(loc) && !buckled)
Shake(1, 0, 0.5 SECONDS)
-/mob/living/basic/outpost_prisoner/proc/contraband_drunk()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/contraband_drunk()
return contraband_drunk_left > 0
/// Whether they have been sour long enough to make a shiv, and their cell has none
-/mob/living/basic/outpost_prisoner/proc/contraband_can_make_shiv()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/contraband_can_make_shiv()
return cell && !cell.stash_shiv && contraband_shiv_sour >= OUTPOST_CONTRABAND_SOUR_TIME
/// Whether they have been grumbling long enough to brew, and their cell's cistern has no pruno
-/mob/living/basic/outpost_prisoner/proc/contraband_can_brew()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/contraband_can_brew()
return cell && contraband_brew_sour >= OUTPOST_CONTRABAND_BREW_SOUR_TIME && !prison?.contraband_pruno(cell)
/// Hides `thing` (a razor blade or yeast from the mail) on them until they can stash it. FALSE if they already carry something.
-/mob/living/basic/outpost_prisoner/proc/contraband_carry(obj/item/thing)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/contraband_carry(obj/item/thing)
if(QDELETED(thing) || carried_contraband)
return FALSE
thing.forceMove(src)
@@ -110,12 +110,12 @@
return TRUE
/// Forgets what they carried, leaving the item wherever it is
-/mob/living/basic/outpost_prisoner/proc/contraband_clear_carried()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/contraband_clear_carried()
if(carried_contraband)
UnregisterSignal(carried_contraband, list(COMSIG_MOVABLE_MOVED, COMSIG_QDELETING))
carried_contraband = null
-/mob/living/basic/outpost_prisoner/proc/on_carried_contraband_moved(obj/item/source)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/on_carried_contraband_moved(obj/item/source)
SIGNAL_HANDLER
if(source != carried_contraband)
UnregisterSignal(source, list(COMSIG_MOVABLE_MOVED, COMSIG_QDELETING))
@@ -124,7 +124,7 @@
contraband_clear_carried()
/// A new arrival finds what the last occupant left and says so, if it is still there
-/mob/living/basic/outpost_prisoner/proc/contraband_remark_inherited()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/contraband_remark_inherited()
if(stat != CONSCIOUS || phase != PRISONER_PRESENT || !cell || in_trouble())
return FALSE
if(!cell.stash_shiv && !prison?.contraband_pruno(cell))
@@ -139,7 +139,7 @@
/// Sour clocks, shiv making, brewing and drinking, and the cells' beds and toilets
/datum/outpost_prison/proc/contraband_tick(seconds)
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.phase != PRISONER_PRESENT || prisoner.stat == DEAD)
continue
prisoner.contraband_counters(seconds)
@@ -151,12 +151,12 @@
return
contraband_clock = 0
contraband_hook_fixtures()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.phase != PRISONER_PRESENT || prisoner.stat != CONSCIOUS)
continue
// Nobody on the level: whatever came in the mail is stashed wherever they are, unless they are cuffed
if(prisoner.carried_contraband && !prisoner.ai_running())
- if(!prisoner.cuffs)
+ if(!prisoner.handcuffed)
contraband_stash_carried(prisoner)
continue
contraband_try_start(prisoner)
@@ -166,7 +166,7 @@
* they are free, nothing more pressing has them busy and no staff are in sight. Returns the
* activity started, or null.
*/
-/datum/outpost_prison/proc/contraband_try_start(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/contraband_try_start(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(!prisoner.ai_running() || !prisoner.routine_allowed() || !prisoner.cell)
return null
var/datum/prisoner_activity/current = prisoner.activity
@@ -188,14 +188,14 @@
return stash
/// Staff (on-duty guards included) who can see `prisoner`, or null
-/datum/outpost_prison/proc/contraband_watcher(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/contraband_watcher(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
for(var/mob/living/person in view(OUTPOST_CONTRABAND_WATCH_RANGE, prisoner))
if(is_outpost_prison_staff(person))
return person
return null
/// Caught at it: they stop, deny it, and have to sour all over again before the next try
-/datum/outpost_prison/proc/contraband_caught(mob/living/basic/outpost_prisoner/prisoner, mob/living/watcher, shiv = TRUE)
+/datum/outpost_prison/proc/contraband_caught(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/watcher, shiv = TRUE)
if(shiv)
prisoner.contraband_shiv_sour = 0
else
@@ -268,7 +268,7 @@
return TRUE
/// A prisoner drinks the pruno in their cell's cistern: a lift, then a while drunk. Returns TRUE if they drank.
-/datum/outpost_prison/proc/contraband_drink(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/contraband_drink(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/obj/item/reagent_containers/cup/glass/bottle/pruno/bag = contraband_pruno(prisoner?.cell)
if(!outpost_prison_pruno_ready(bag))
return FALSE
@@ -281,7 +281,7 @@
return TRUE
/// Home and unwatched, with the AI running: whatever came in the mail goes into hiding
-/datum/outpost_prison/proc/contraband_try_stash_carried(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/contraband_try_stash_carried(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(!prisoner.cell?.contains(prisoner) || !prisoner.routine_allowed() || contraband_watcher(prisoner))
return FALSE
return contraband_stash_carried(prisoner)
@@ -291,7 +291,7 @@
* the cistern. A cell that already has that stash, or no room for it, leaves them carrying it.
* Returns TRUE if it was stashed.
*/
-/datum/outpost_prison/proc/contraband_stash_carried(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/contraband_stash_carried(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/obj/item/thing = prisoner.carried_contraband
var/datum/outpost_prison_cell/home = prisoner.cell
if(!thing || thing.loc != prisoner || !home)
@@ -366,7 +366,7 @@
return COMPONENT_CANCEL_ATTACK_CHAIN
if(source.has_buckled_mobs())
// A prisoner lying on it can be told to get up from the talk menu, or shaken awake; the balloon only says who is in the way.
- var/mob/living/basic/outpost_prisoner/lying = locate() in source.buckled_mobs
+ var/mob/living/carbon/human/npc/outpost_prisoner/lying = locate() in source.buckled_mobs
source.balloon_alert(user, lying?.activity?.sleeping ? "someone's asleep on it" : "someone's lying on it")
return COMPONENT_CANCEL_ATTACK_CHAIN
INVOKE_ASYNC(src, PROC_REF(contraband_search_mattress), user, source)
@@ -388,7 +388,7 @@
return null
if(QDELETED(src) || QDELETED(bed) || QDELETED(user) || cell_at(get_turf(bed)) != cell)
return null
- var/mob/living/basic/outpost_prisoner/owner = cell.occupant
+ var/mob/living/carbon/human/npc/outpost_prisoner/owner = cell.occupant
if(cell.stash_shiv)
cell.stash_shiv = FALSE
var/obj/item/knife/shiv/shiv = new(get_turf(user))
@@ -457,7 +457,7 @@
to_chat(user, span_notice("There's nothing in the cistern."))
else
to_chat(user, span_notice("You find [english_list(found)] in the cistern."))
- var/mob/living/basic/outpost_prisoner/owner = cell.occupant
+ var/mob/living/carbon/human/npc/outpost_prisoner/owner = cell.occupant
if(!caught)
contraband_search_came_up_empty(owner, user, cell)
return "empty"
@@ -477,11 +477,11 @@
return TRUE
/// Whether a cell's owner is there to take it: present, awake and not loose
-/datum/outpost_prison/proc/contraband_owner_home(mob/living/basic/outpost_prisoner/owner)
+/datum/outpost_prison/proc/contraband_owner_home(mob/living/carbon/human/npc/outpost_prisoner/owner)
return !QDELETED(owner) && (owner in prisoners) && owner.stat == CONSCIOUS && owner.phase == PRISONER_PRESENT && owner.trouble != PRISONER_TROUBLE_LOOSE
/// Something was found in `owner`'s cell by `finder`: they deny it and lose a little mood
-/datum/outpost_prison/proc/contraband_owner_caught(mob/living/basic/outpost_prisoner/owner, mob/living/finder, datum/outpost_prison_cell/cell)
+/datum/outpost_prison/proc/contraband_owner_caught(mob/living/carbon/human/npc/outpost_prisoner/owner, mob/living/finder, datum/outpost_prison_cell/cell)
if(!contraband_owner_home(owner))
return FALSE
if(contraband_search_costs(cell))
@@ -493,12 +493,12 @@
return TRUE
/// A search of `owner`'s cell found nothing: the owner and anyone watching take it badly. An empty cell costs nothing.
-/datum/outpost_prison/proc/contraband_search_came_up_empty(mob/living/basic/outpost_prisoner/owner, mob/living/searcher, datum/outpost_prison_cell/cell)
+/datum/outpost_prison/proc/contraband_search_came_up_empty(mob/living/carbon/human/npc/outpost_prisoner/owner, mob/living/searcher, datum/outpost_prison_cell/cell)
if(!contraband_owner_home(owner))
return FALSE
if(contraband_search_costs(cell))
owner.adjust_mood(-OUTPOST_CONTRABAND_EMPTY_MOOD)
- for(var/mob/living/basic/outpost_prisoner/onlooker in view(OUTPOST_CONTRABAND_WATCH_RANGE, searcher))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/onlooker in view(OUTPOST_CONTRABAND_WATCH_RANGE, searcher))
if(onlooker == owner || !(onlooker in prisoners) || onlooker.stat != CONSCIOUS || onlooker.phase != PRISONER_PRESENT)
continue
onlooker.adjust_mood(-OUTPOST_CONTRABAND_ONLOOKER_MOOD)
@@ -530,13 +530,13 @@
// ===== THE PAT-DOWN =====
/// The pat-down choice for the talk menu: name -> image. Hands on the wall, or held still in cuffs.
-/datum/outpost_prison/proc/contraband_talk_choices(mob/living/basic/outpost_prisoner/prisoner, mob/living/user)
+/datum/outpost_prison/proc/contraband_talk_choices(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/user)
if(!prisoner || !user || !is_member(user))
return list()
return list((CONTRABAND_PATDOWN_CHOICE) = image(icon = 'voidcrew/icons/hud/radial.dmi', icon_state = "radial_search"))
/// Runs a talk menu choice of this package; TRUE if it was one. May sleep.
-/datum/outpost_prison/proc/contraband_talk_act(mob/living/basic/outpost_prisoner/prisoner, mob/living/user, choice)
+/datum/outpost_prison/proc/contraband_talk_act(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/user, choice)
if(choice != CONTRABAND_PATDOWN_CHOICE)
return FALSE
contraband_pat_down(prisoner, user)
@@ -549,12 +549,12 @@
* in it: rioting, loose or sour, they hold still and are searched, unless someone is already
* talking to them or working on their cuffs. Returns "found", "empty" or null. Sleeps.
*/
-/datum/outpost_prison/proc/contraband_pat_down(mob/living/basic/outpost_prisoner/prisoner, mob/living/user)
+/datum/outpost_prison/proc/contraband_pat_down(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/user)
if(QDELETED(prisoner) || QDELETED(user) || !is_member(user) || !(prisoner in prisoners))
return null
if(prisoner.stat != CONSCIOUS || prisoner.phase != PRISONER_PRESENT)
return null
- if(prisoner.cuffs)
+ if(prisoner.handcuffed)
if(prisoner.talking || prisoner.cuff_work)
prisoner.balloon_alert(user, "busy")
return null
@@ -571,7 +571,7 @@
prisoner.talking = TRUE
prisoner.end_activity()
prisoner.stand_up()
- if(prisoner.cuffs)
+ if(prisoner.handcuffed)
// Their hands are cuffed already; nothing for them to put on the wall
prisoner.face_atom(user)
prisoner.manual_emote("stands still to be searched.")
@@ -612,11 +612,11 @@
prisoner.say_context("patdown_empty")
if(contraband_roll(OUTPOST_CONTRABAND_PATDOWN_ONLOOKER_CHANCE))
var/list/onlookers = list()
- for(var/mob/living/basic/outpost_prisoner/onlooker in view(OUTPOST_CONTRABAND_ONLOOKER_RANGE, prisoner))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/onlooker in view(OUTPOST_CONTRABAND_ONLOOKER_RANGE, prisoner))
if(onlooker != prisoner && (onlooker in prisoners) && onlooker.stat == CONSCIOUS && onlooker.phase == PRISONER_PRESENT && !onlooker.in_trouble())
onlookers += onlooker
if(length(onlookers))
- var/mob/living/basic/outpost_prisoner/speaker = pick(onlookers)
+ var/mob/living/carbon/human/npc/outpost_prisoner/speaker = pick(onlookers)
speaker.face_atom(user)
speaker.say_context("patdown_onlooker", prisoner)
note_staff_event(user, prisoner, "patdown_empty")
@@ -637,35 +637,35 @@
return contraband_tension() > 0 ? "word of a shiv" : null
/// How much higher `prisoner`'s riot line is (a shiv under their mattress, and some bounty prisoners: outpost_prison_bounty.dm)
-/datum/outpost_prison/proc/riot_join_bonus(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/riot_join_bonus(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
return (prisoner?.cell?.stash_shiv ? OUTPOST_CONTRABAND_RIOT_JOIN_BONUS : 0) + (prisoner ? prisoner.bounty_riot_bonus() : 0)
/**
* A rioter draws the shiv from their cell's stash instead of a new one; TRUE if they did. Only
* start_rioting() calls this: a stash never arms a threat or a fight (decision 8).
*/
-/datum/outpost_prison/proc/draw_stashed_shiv(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/draw_stashed_shiv(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/datum/outpost_prison_cell/home = prisoner?.cell
if(!home?.stash_shiv || prisoner.has_shiv())
return FALSE
home.stash_shiv = FALSE
prisoner.drop_held_item()
- var/obj/item/knife/shiv/shiv = new(prisoner)
- prisoner.held_item = shiv
- prisoner.update_melee()
- prisoner.update_appearance(UPDATE_OVERLAYS)
+ // The stash comes out into their hand, a real shiv like any other.
+ var/obj/item/knife/shiv/shiv = new(prisoner.drop_location())
+ if(!prisoner.take_item(shiv))
+ return FALSE
prisoner.manual_emote("pulls out a shiv [prisoner.p_they()] had been saving.")
return TRUE
/// Multiplier on the chance these two start a fight: either one drunk
-/datum/outpost_prison/proc/contraband_fight_mult(mob/living/basic/outpost_prisoner/one, mob/living/basic/outpost_prisoner/two)
+/datum/outpost_prison/proc/contraband_fight_mult(mob/living/carbon/human/npc/outpost_prisoner/one, mob/living/carbon/human/npc/outpost_prisoner/two)
if(one?.contraband_drunk() || two?.contraband_drunk())
return OUTPOST_CONTRABAND_DRUNK_FIGHT_MULT
return 1
/// Multiplier on the wing's chance of a spat: anyone drunk
/datum/outpost_prison/proc/contraband_spat_mult()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.phase == PRISONER_PRESENT && prisoner.stat == CONSCIOUS && prisoner.contraband_drunk())
return OUTPOST_CONTRABAND_DRUNK_SPAT_MULT
return 1
@@ -673,13 +673,13 @@
// ===== SPEECH AND EXAMINE =====
/// A drunk line `prisoner` wants to say now, as list(context, other), or null
-/datum/outpost_prison/proc/contraband_extra_speech(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/contraband_extra_speech(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(prisoner?.contraband_drunk() && prob(50))
return list("drunk", null)
return null
/// The tells for examine: a hand kept in a pocket, a drunk's sway; or null
-/datum/outpost_prison/proc/contraband_examine(mob/living/basic/outpost_prisoner/prisoner, mob/user)
+/datum/outpost_prison/proc/contraband_examine(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/user)
if(!prisoner || prisoner.stat == DEAD)
return null
var/list/tells = list()
@@ -699,22 +699,22 @@
UnregisterSignal(thing, list(COMSIG_ATOM_ATTACK_HAND, COMSIG_ATOM_ATTACK_HAND_SECONDARY, COMSIG_ATOM_EXITED))
contraband_hooked.Cut()
// Prisoners deleted with the prison never pass through forget()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
var/obj/item/thing = prisoner.carried_contraband
prisoner.contraband_clear_carried()
qdel(thing)
/// A new arrival: half the time they notice what the last occupant left, a little after they arrive
-/datum/outpost_prison/proc/contraband_prisoner_admitted(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/contraband_prisoner_admitted(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/datum/outpost_prison_cell/home = prisoner?.cell
if(!home || (!home.stash_shiv && !contraband_pruno(home)))
return
if(!contraband_roll(OUTPOST_CONTRABAND_INHERIT_CHANCE))
return
- addtimer(CALLBACK(prisoner, TYPE_PROC_REF(/mob/living/basic/outpost_prisoner, contraband_remark_inherited)), OUTPOST_CONTRABAND_INHERIT_DELAY)
+ addtimer(CALLBACK(prisoner, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prisoner, contraband_remark_inherited)), OUTPOST_CONTRABAND_INHERIT_DELAY)
/// A prisoner is leaving: what they carry goes with them. Their cell's stash stays for the next.
-/datum/outpost_prison/proc/contraband_prisoner_leaving(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/contraband_prisoner_leaving(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/obj/item/thing = prisoner.carried_contraband
prisoner.contraband_clear_carried()
qdel(thing)
@@ -734,7 +734,7 @@
))
var/list/drunk = list()
var/list/carrying = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.contraband_drunk())
drunk += REF(prisoner)
if(prisoner.carried_contraband)
diff --git a/voidcrew/modules/player_outposts/outpost_prison_core.dm b/voidcrew/modules/player_outposts/outpost_prison_core.dm
index 91f70cae088..82ab99026dc 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_core.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_core.dm
@@ -47,7 +47,7 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
var/datum/outpost_upgrade/prison/upgrade
var/obj/structure/overmap/dynamic/player_outpost/outpost
var/area/voidcrew/player_outpost/prison/wing
- var/list/mob/living/basic/outpost_prisoner/prisoners = list()
+ var/list/mob/living/carbon/human/npc/outpost_prisoner/prisoners = list()
/// The wing's cells, in number order
var/list/datum/outpost_prison_cell/cells = list()
/// Prisoners the wing holds at once: one per cell, at most OUTPOST_PRISON_MAX_CAPACITY
@@ -108,7 +108,7 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
wing.prison = null
var/list/leaving = prisoners
prisoners = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in leaving)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in leaving)
close_bounty_record(prisoner, BOUNTY_RECORD_CLOSED)
prisoner.prison = null
prisoner.cell = null
@@ -325,7 +325,7 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
if(supply_clock < PRISON_SUPPLY_REFRESH_SECONDS)
return
supply_clock = 0
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
prisoner.fend_for_self()
prisoner.check_sick_call()
check_hatch_shortage()
@@ -358,7 +358,7 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
dirty_suits++
// How long it lasts at the usual rates, for the prisoners here (or a full wing while intake is open).
var/eaters = 0
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.phase != PRISONER_ARRIVING && prisoner.stat != DEAD && prisoner.trouble != PRISONER_TROUBLE_LOOSE)
eaters++
if(!eaters && intake_open)
@@ -389,7 +389,7 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
var/list/all_hatches = hatches()
if(!length(all_hatches))
return
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.stat != CONSCIOUS || prisoner.phase != PRISONER_PRESENT || prisoner.trouble)
continue
var/reaches_hatch = FALSE
@@ -442,7 +442,7 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
* hatch, a table, a cell, the floor), or a cleaner uniform off a serving hatch when `want_uniform`
* is set. Anything another prisoner is already fetching is left alone.
*/
-/datum/outpost_prison/proc/find_supply(mob/living/basic/outpost_prisoner/prisoner, want_uniform = FALSE)
+/datum/outpost_prison/proc/find_supply(mob/living/carbon/human/npc/outpost_prisoner/prisoner, want_uniform = FALSE)
if(!prisoner.reachable)
refresh_prisoner_reach(prisoner)
var/obj/item/best
@@ -514,14 +514,14 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
if(user)
note_staff_stock(user)
// Whoever wants it drops what they were idling at and comes over.
- for(var/mob/living/basic/outpost_prisoner/wanting in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/wanting in prisoners)
var/datum/prisoner_activity/idle = wanting.activity
if(!wanting.ai_running() || !idle?.leisure || !idle.interruptible || idle.sleeping)
continue
if((food && wanting.wants_food()) || (suits && wanting.wants_clean_uniform()))
wanting.end_activity()
- var/mob/living/basic/outpost_prisoner/thanker
- for(var/mob/living/basic/outpost_prisoner/waiting in prisoners)
+ var/mob/living/carbon/human/npc/outpost_prisoner/thanker
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/waiting in prisoners)
var/datum/prisoner_activity/hatch_wait/wait = waiting.activity
if(!istype(wait) || wait.hatch_ref?.resolve() != hatch)
continue
@@ -529,11 +529,11 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
thanker = waiting
if(user)
waiting.note_carer(user)
- INVOKE_ASYNC(waiting, TYPE_PROC_REF(/mob/living/basic/outpost_prisoner, thank), (food && waiting.wants_food()) ? "thanks_food" : "thanks_uniform")
+ INVOKE_ASYNC(waiting, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prisoner, thank), (food && waiting.wants_food()) ? "thanks_food" : "thanks_uniform")
break
if(!COOLDOWN_FINISHED(src, hatch_call_cooldown))
return null
- for(var/mob/living/basic/outpost_prisoner/crier as anything in shuffle(prisoners))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/crier as anything in shuffle(prisoners))
if(crier == thanker || crier.stat != CONSCIOUS || crier.phase != PRISONER_PRESENT || crier.in_trouble() || crier.activity?.sleeping)
continue
var/context
@@ -545,7 +545,7 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
continue
COOLDOWN_START(src, hatch_call_cooldown, OUTPOST_PRISON_HATCH_CALL_GAP)
note_speech()
- INVOKE_ASYNC(crier, TYPE_PROC_REF(/mob/living/basic/outpost_prisoner, say_context), context)
+ INVOKE_ASYNC(crier, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prisoner, say_context), context)
return crier
return null
@@ -554,15 +554,15 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
* PRISONER_SHARED_MEAL_WINDOW makes a shared meal: each of them cheers up a little, once, and one
* of them says so. Returns the prisoners who got the lift.
*/
-/datum/outpost_prison/proc/note_table_meal(mob/living/basic/outpost_prisoner/eater)
- for(var/mob/living/basic/outpost_prisoner/earlier as anything in table_eaters.Copy())
+/datum/outpost_prison/proc/note_table_meal(mob/living/carbon/human/npc/outpost_prisoner/eater)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/earlier as anything in table_eaters.Copy())
if(QDELETED(earlier) || !(earlier in prisoners) || world.time - table_eaters[earlier] > PRISONER_SHARED_MEAL_WINDOW)
table_eaters -= earlier
table_eaters[eater] = world.time
var/list/lifted = list()
if(length(table_eaters) < PRISONER_SHARED_MEAL_COUNT)
return lifted
- for(var/mob/living/basic/outpost_prisoner/diner as anything in table_eaters)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/diner as anything in table_eaters)
if(diner.shared_meal_at && world.time - diner.shared_meal_at <= PRISONER_SHARED_MEAL_WINDOW)
continue
diner.shared_meal_at = world.time
@@ -572,8 +572,8 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
note_shared_meal(lifted)
if(length(lifted) && COOLDOWN_FINISHED(src, mess_hall_cooldown))
COOLDOWN_START(src, mess_hall_cooldown, OUTPOST_PRISON_MESS_HALL_GAP)
- var/mob/living/basic/outpost_prisoner/speaker = pick(lifted)
- INVOKE_ASYNC(speaker, TYPE_PROC_REF(/mob/living/basic/outpost_prisoner, say_context), "mess_hall")
+ var/mob/living/carbon/human/npc/outpost_prisoner/speaker = pick(lifted)
+ INVOKE_ASYNC(speaker, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prisoner, say_context), "mess_hall")
return lifted
/**
@@ -584,22 +584,22 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
if(!is_member(shooter) || !COOLDOWN_FINISHED(src, staff_basket_cooldown))
return FALSE
var/list/players = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.stat == CONSCIOUS && prisoner.phase == PRISONER_PRESENT && istype(prisoner.activity, /datum/prisoner_activity/basketball))
players += prisoner
if(length(players) < 2)
return FALSE
COOLDOWN_START(src, staff_basket_cooldown, OUTPOST_PRISON_STAFF_BASKET_GAP)
note_staff_basket(shooter)
- for(var/mob/living/basic/outpost_prisoner/player as anything in players)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/player as anything in players)
player.adjust_mood(PRISONER_MOOD_STAFF_BASKET)
player.face_atom(hoop)
- var/mob/living/basic/outpost_prisoner/cheering = pick(players)
+ var/mob/living/carbon/human/npc/outpost_prisoner/cheering = pick(players)
INVOKE_ASYNC(cheering, TYPE_PROC_REF(/atom, manual_emote), pick("whistles.", "claps.", "cheers."))
return TRUE
/// The nearest trash bin the prisoner can reach
-/datum/outpost_prison/proc/find_bin(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/find_bin(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(!prisoner.reachable)
refresh_prisoner_reach(prisoner)
var/obj/structure/closet/crate/bin/best
@@ -613,7 +613,7 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
return best
/// The nearest litter lying where the prisoner may walk, off the serving hatches and out of other cells
-/datum/outpost_prison/proc/find_litter(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/find_litter(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(!prisoner.walkable)
refresh_prisoner_reach(prisoner)
var/obj/item/trash/best
@@ -631,7 +631,7 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
return best
/// A basketball the prisoner can get at: their own, loose within reach, or in another player's hands
-/datum/outpost_prison/proc/find_ball(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/find_ball(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(istype(prisoner.held_item, /obj/item/toy/basketball))
return prisoner.held_item
if(!prisoner.reachable)
@@ -640,13 +640,13 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
var/obj/item/toy/basketball/ball = locate() in spot
if(ball)
return ball
- for(var/mob/living/basic/outpost_prisoner/other in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/other in prisoners)
if(istype(other.held_item, /obj/item/toy/basketball) && prisoner.walkable?[get_turf(other)])
return other.held_item
return null
/// The nearest book lying about within reach, not on a shelf
-/datum/outpost_prison/proc/find_loose_book(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/find_loose_book(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(!prisoner.reachable)
refresh_prisoner_reach(prisoner)
var/obj/item/book/best
@@ -681,8 +681,8 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
return FALSE
/// Whether a prisoner other than `except` is doing an activity of this type
-/datum/outpost_prison/proc/anyone_doing(activity_type, mob/living/basic/outpost_prisoner/except)
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+/datum/outpost_prison/proc/anyone_doing(activity_type, mob/living/carbon/human/npc/outpost_prisoner/except)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner != except && istype(prisoner.activity, activity_type))
return TRUE
return FALSE
@@ -690,7 +690,7 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
// ===== CLAIMS =====
/// Reserves `thing` for `prisoner`. FALSE if someone else is using it.
-/datum/outpost_prison/proc/claim(atom/thing, mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/claim(atom/thing, mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(claimed_by_other(thing, prisoner))
return FALSE
claims[REF(thing)] = prisoner
@@ -698,13 +698,13 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
/// The prisoner using `thing`, if any
/datum/outpost_prison/proc/claimant(atom/thing)
- var/mob/living/basic/outpost_prisoner/holder = claims[REF(thing)]
+ var/mob/living/carbon/human/npc/outpost_prisoner/holder = claims[REF(thing)]
if(QDELETED(holder) || !holder.activity)
return null
return holder
-/datum/outpost_prison/proc/claimed_by_other(atom/thing, mob/living/basic/outpost_prisoner/prisoner)
- var/mob/living/basic/outpost_prisoner/holder = claimant(thing)
+/datum/outpost_prison/proc/claimed_by_other(atom/thing, mob/living/carbon/human/npc/outpost_prisoner/prisoner)
+ var/mob/living/carbon/human/npc/outpost_prisoner/holder = claimant(thing)
return holder && holder != prisoner
// ===== SPEECH =====
@@ -722,10 +722,9 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
if(QDELETED(outpost) || !wing)
return
tick(seconds_per_tick)
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.phase != PRISONER_PRESENT)
continue
- prisoner.maybe_drip(seconds_per_tick)
if(prisoner.stat != CONSCIOUS)
continue
if(prisoner.trouble != PRISONER_TROUBLE_LOOSE && SPT_PROB(OUTPOST_PRISON_MESS_CHANCE / 60, seconds_per_tick))
@@ -747,7 +746,7 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
conditions_tick(seconds)
containment_tick(seconds)
supply_tick(seconds)
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners.Copy())
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners.Copy())
if(QDELETED(prisoner) || prisoner.phase != PRISONER_PRESENT)
continue
if(prisoner.stat == DEAD)
@@ -778,7 +777,7 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
// ===== COMINGS AND GOINGS =====
/// Drops a prisoner from the roster and their cell, and starts refilling it
-/datum/outpost_prison/proc/forget(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/forget(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(!(prisoner in prisoners))
return
// Whatever else closed their bounty record first decided how it ended (outpost_prison_bounty.dm).
@@ -797,6 +796,11 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
emptied.occupant = null
prisoner.cell = null
prisoner.prison = null
+ // Off the roster, a body is like any human NPC's: cleaned up once it has lain unwatched for a while
+ // (human_npc_spawning.dm), unless someone is dragging, carrying or watching it.
+ if(prisoner.stat == DEAD && !QDELETED(prisoner))
+ prisoner.npc_corpse_lifetime = HUMAN_NPC_CORPSE_LIFETIME
+ SShuman_npcs.track_corpse(prisoner)
for(var/key in claims.Copy())
if(claims[key] == prisoner)
claims -= key
@@ -823,7 +827,7 @@ GLOBAL_LIST_EMPTY(outpost_prisons)
var/list/turfs
var/list/turf_set
/// The prisoner who owns it
- var/mob/living/basic/outpost_prisoner/occupant
+ var/mob/living/carbon/human/npc/outpost_prisoner/occupant
/// world.time from which the cell may take a new arrival
var/ready_at = 0
diff --git a/voidcrew/modules/player_outposts/outpost_prison_creatures.dm b/voidcrew/modules/player_outposts/outpost_prison_creatures.dm
index 1a127916052..56161b68613 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_creatures.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_creatures.dm
@@ -1,59 +1,21 @@
/**
- * # Experiment creatures
+ * # Experiment creatures: the tells, and the changeling's horror's base
*
- * What a serum turns a prisoner into, with tg's looks and mechanics where tg has them:
- * - The hulk: a green, swollen prisoner (tg's hulk skin). Punches hard, charges with a 1.5 second
- * wind-up and a line on the floor, stuns itself on a wall, tears through interior walls (tg's
- * wall_tearer, limited to the outpost's inside) and forces doors. It knocks prisoners flat but
- * never kills them. Worn down to a quarter it is exhausted, and a baton or disabler puts it down
- * alive for a bigger bonus.
- * - The fly person: tg's fly species, flying. It zips about the wing in short random darts, darts
- * away from anyone close and from whoever just hit it, and jinks out of the way of some shots while
- * it flies freely. Cornered, it bites. It eats whatever food it finds and throws up every few
- * seconds. A flyswatter hits it thirty times harder, as it does tg's fly people; a baton knocks it
- * to the floor for a moment, and stamina weapons slow it down and then put it down alive.
- * - The nightmare: tg's nightmare with its light eater. It spends its first half minute breaking
- * the lights, then hunts prisoners in the dark. It heals and dodges in the dark and burns in the
- * light, jaunts beside a target through the dark after a warning ripple, and a flash burns it.
- * Before the change, the dosed prisoner shows the form's tells (outpost_experiment_tell()). Put
- * down, alive or dead, a creature lies on the floor where everyone can see it (show_down()), a
- * subdued one twitching, until Kessler's team beams in for it (kessler_collect()).
- *
- * All of them are basic mobs under /mob/living/basic/outpost_experiment, never megafauna, with no
- * sentience, no need for air, and no way to be boxed, teleported, polymorphed or revived. They
- * only break the outpost's interior (outpost_experiment_can_smash()). Their AI runs only while
- * someone is on the level, like everything else in the wing.
+ * The serum's forms (the hulk, the fly person and the nightmare) are the subject's own body changed by
+ * tg's biology: outpost_prison_experiment_forms.dm. This file keeps what the serum shows before it takes
+ * (outpost_experiment_tell()), the forms' ability hit, and the basic mob the
+ * changeling's horror is filed under (outpost_prison_horror.dm), which stays a monster (owner ruling OC-4):
+ * a basic mob, never megafauna, with no sentience, no need for air, and no way to be boxed, teleported or
+ * polymorphed. It only breaks the outpost's interior (outpost_experiment_can_smash()).
*/
-/// The creature a serum form becomes
-/proc/outpost_experiment_creature_type(form)
- switch(form)
- if("hulk")
- return /mob/living/basic/outpost_experiment/hulk
- if("fly")
- return /mob/living/basic/outpost_experiment/fly
- if("nightmare")
- return /mob/living/basic/outpost_experiment/nightmare
- return null
-
-/// Living players on level `z` beyond the first, up to OUTPOST_EXPERIMENT_EXTRA_PLAYERS_MAX, for a creature's health
-/proc/outpost_experiment_extra_players(z)
- if(!z || z > length(SSmobs.clients_by_zlevel))
- return 0
- var/count = 0
- for(var/mob/living/person as anything in SSmobs.clients_by_zlevel[z])
- if(QDELETED(person) || person.stat == DEAD || !person.client || is_outpost_prisoner(person) || is_outpost_experiment_mob(person))
- continue
- count++
- return clamp(count - 1, 0, OUTPOST_EXPERIMENT_EXTRA_PLAYERS_MAX)
-
// ===== TELLS =====
/**
* One tell of what the serum is turning `subject` into, `progress` (0 to 1) through the last
* OUTPOST_EXPERIMENT_TELLS seconds. Plain to see, so the crew can fetch the right tool.
*/
-/proc/outpost_experiment_tell(form, mob/living/basic/outpost_prisoner/subject, progress)
+/proc/outpost_experiment_tell(form, mob/living/carbon/human/npc/outpost_prisoner/subject, progress)
if(QDELETED(subject) || subject.stat != CONSCIOUS)
return
subject.Shake(1, 1, 0.5 SECONDS)
@@ -86,8 +48,20 @@
subject.manual_emote(pick("flinches away from the light.", "whispers to nobody.", "shades [subject.p_their()] eyes.", "stands very still in the dark."))
playsound(subject, pick('sound/effects/hallucinations/i_see_you1.ogg', 'sound/effects/hallucinations/behind_you1.ogg'), 20, TRUE)
+/**
+ * One of a creature's ability hits on `victim` (the hulk's charge, the nightmare's lunge out of the dark):
+ * at a body zone, through the armour on it, and able to wound like any other blow of its kind. A blunt hit
+ * when `sharpness` is NONE. Returns the damage dealt.
+ */
+/proc/outpost_experiment_ability_hit(mob/living/victim, damage, sharpness = NONE, armour_penetration = 0, zone, atom/attacker)
+ if(QDELETED(victim))
+ return 0
+ zone ||= victim.get_random_valid_zone(BODY_ZONE_CHEST)
+ var/blocked = victim.run_armor_check(zone, MELEE, armour_penetration = armour_penetration)
+ return victim.apply_damage(damage, BRUTE, zone, blocked, sharpness = sharpness, attack_direction = attacker ? get_dir(attacker, victim) : null)
+
/// Takes the tells off a subject the serum never finished with
-/proc/outpost_experiment_clear_tells(mob/living/basic/outpost_prisoner/subject)
+/proc/outpost_experiment_clear_tells(mob/living/carbon/human/npc/outpost_prisoner/subject)
if(QDELETED(subject))
return
subject.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY)
@@ -95,9 +69,9 @@
if(subject.current_size != RESIZE_DEFAULT_SIZE)
subject.update_transform(RESIZE_DEFAULT_SIZE / subject.current_size)
-// ===== THE CREATURE =====
+// ===== THE HORROR'S BASE =====
-/// What a prisoner turned into. Kept at home and out of players' hands; see the file header.
+/// What the changeling's specimen grows into is filed under this: kept at home and out of players' hands.
/mob/living/basic/outpost_experiment
name = "experiment"
desc = "What a prisoner turned into."
@@ -117,21 +91,15 @@
unsuitable_heat_damage = 0
damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, STAMINA = 0, OXY = 0)
environment_smash = ENVIRONMENT_SMASH_NONE
- ai_controller = /datum/ai_controller/basic_controller/outpost_experiment
// tg's human deathgasp
death_message = "seizes up and falls limp, their eyes dead and lifeless..."
- // Knocked down, subdued or dead, it lies on the floor like a person.
+ // Knocked down or dead, it lies on the floor like a person.
mobility_flags = MOBILITY_FLAGS_REST_CAPABLE_DEFAULT
rotate_on_lying = TRUE
- /// What the log calls it: "a hulk"
+ /// What the log calls it
var/form_name = "a creature"
- /// What everyone sees when it is subdued, after its name
- var/subdued_message = "collapses, spent."
/// A tell on examine, if any: something anyone watching it would notice
var/win_hint
- /// Health with one player on the level, and per extra player
- var/base_health = 100
- var/health_per_player = 0
/// Dialogue context it says now and then, and seconds to the next line
var/line_context
var/line_left = 10
@@ -139,31 +107,15 @@
var/datum/outpost_prison/prison
/// The prisoner's personality, for its lines
var/personality
- /// Put down alive
- var/subdued = FALSE
/// Its footsteps: the footstep element's sound set, volume multiplier and extra range
var/footstep_kind = FOOTSTEP_MOB_SHOE
var/footstep_volume = 0.5
var/footstep_range = -8
- /// The target it is chasing now, the closest it has gotten to it, where it last stood, and when it last
- /// got anywhere: to notice it is stuck (track_reach())
- var/datum/weakref/chase_target_ref
- var/chase_best_distance = 0
- var/turf/chase_last_turf
- var/chase_progress_time = 0
- /// Targets it has given up on reaching -> world.time it may try them again (find_light(), choose_target())
- var/list/unreachable_until
-/mob/living/basic/outpost_experiment/Initialize(mapload, datum/outpost_prison/owner, mob/living/basic/outpost_prisoner/subject)
- if(subject)
- gender = subject.gender
+/mob/living/basic/outpost_experiment/Initialize(mapload, datum/outpost_prison/owner)
. = ..()
prison = owner
damage_coeff = damage_coeff.Copy()
- if(subject)
- personality = subject.personality
- real_name = subject.real_name
- name = real_name
ADD_TRAIT(src, TRAIT_NO_CONTAINMENT, INNATE_TRAIT)
ADD_TRAIT(src, TRAIT_NO_STORAGE_INSERT, INNATE_TRAIT)
RegisterSignal(src, COMSIG_MOVABLE_TELEPORTING, PROC_REF(refuse_teleport))
@@ -171,22 +123,15 @@
RegisterSignal(src, COMSIG_PRE_MOB_CHANGED_TYPE, PROC_REF(refuse_type_change))
AddComponent(/datum/component/experiment_damage_ledger)
AddElement(/datum/element/footstep, footstep_type = footstep_kind, volume = footstep_volume, e_range = footstep_range)
- var/turf/here = get_turf(src)
- var/full_health = base_health + health_per_player * outpost_experiment_extra_players(here?.z)
- maxHealth = full_health
- health = full_health
- build_look(subject?.outfit_path || /datum/outfit/outpost_prisoner)
+ build_look()
/mob/living/basic/outpost_experiment/Destroy()
prison = null
- chase_target_ref = null
- chase_last_turf = null
- unreachable_until = null
return ..()
-/// Puts on its look, from the prisoner's outfit
+/// Puts on its look
/mob/living/basic/outpost_experiment/proc/build_look(outfit_path)
- apply_dynamic_human_appearance(src, outfit_path, /datum/species/human)
+ return
/mob/living/basic/outpost_experiment/proc/refuse_teleport(datum/source, atom/destination, channel)
SIGNAL_HANDLER
@@ -203,56 +148,45 @@
SIGNAL_HANDLER
return COMPONENT_BLOCK_MOB_CHANGE
-/// Kessler has already written it off: nothing brings it back
-/mob/living/basic/outpost_experiment/can_be_revived()
- return FALSE
-
/// Down for good, its body can be dragged about until Kessler collects it
/mob/living/basic/outpost_experiment/death(gibbed)
. = ..()
move_resist = MOVE_RESIST_DEFAULT
if(. && !gibbed && !QDELETED(src))
- show_down(FALSE)
+ balloon_alert_to_viewers("dead")
/mob/living/basic/outpost_experiment/examine(mob/user)
. = ..()
- if(HAS_TRAIT_FROM(src, TRAIT_GODMODE, OUTPOST_KESSLER_TRAIT))
+ if(HAS_TRAIT_FROM(src, TRAIT_IMMOBILIZED, OUTPOST_KESSLER_TRAIT))
. += span_notice("Kessler Biolabs is taking [p_them()] away.")
- else if(subdued || stat == DEAD)
+ else if(stat == DEAD)
. += span_notice("[p_They()] [p_are()] down. Kessler Biolabs will collect [p_them()] shortly.")
else if(win_hint)
. += span_notice(win_hint)
-/**
- * Put down: everyone in sight is told, with a balloon over it. `subdued` is alive (the death
- * message has already said the rest); it lies there twitching until Kessler collects it (Life()).
- */
-/mob/living/basic/outpost_experiment/proc/show_down(subdued)
- if(subdued)
- visible_message(span_danger("[src] [subdued_message]"))
- balloon_alert_to_viewers(subdued ? "subdued" : "dead")
-
-/// Twitches on the floor, subdued, waiting for Kessler
-/mob/living/basic/outpost_experiment/proc/down_twitch()
- Shake(1, 0, 0.4 SECONDS)
- if(prob(30))
- manual_emote(pick("twitches.", "groans.", "stirs weakly."))
-
/// Health it still had, which a gib or dust takes without it counting as damage on its ledger
/mob/living/basic/outpost_experiment/proc/unspent_health()
return health
/**
* Interim turret rule (outpost_prison_riot.dm): outpost turrets shoot a creature wherever it is,
- * until it is dead, subdued or in Kessler's hands. Turret damage is not the crew's, so a turret
- * kill pays no containment bonus.
+ * until it is dead or Kessler's beam has it. Turret damage is not the crew's, so a turret kill pays
+ * no containment bonus.
*/
/mob/living/basic/outpost_experiment/proc/turret_target()
- return stat != DEAD && !subdued && !HAS_TRAIT(src, TRAIT_GODMODE)
+ return stat != DEAD && !HAS_TRAIT_FROM(src, TRAIT_IMMOBILIZED, OUTPOST_KESSLER_TRAIT)
+/**
+ * Whether outpost turrets shoot `creature`, an experiment's creature: the horror by its own rule; a body the
+ * serum took while it is up and fighting (not down for Kessler, not being beamed away).
+ */
/proc/is_outpost_experiment_turret_target(mob/living/creature)
var/mob/living/basic/outpost_experiment/experiment_creature = creature
- return istype(experiment_creature) && experiment_creature.turret_target()
+ if(istype(experiment_creature))
+ return experiment_creature.turret_target()
+ if(!creature?.GetComponent(/datum/component/outpost_experiment_form))
+ return FALSE
+ return !outpost_experiment_down_state(creature) && !HAS_TRAIT_FROM(creature, TRAIT_IMMOBILIZED, OUTPOST_KESSLER_TRAIT)
/// Whether its AI runs: only while someone is on the level
/mob/living/basic/outpost_experiment/proc/awake()
@@ -260,11 +194,7 @@
/mob/living/basic/outpost_experiment/Life(seconds_per_tick = SSMOBS_DT, times_fired)
. = ..()
- if(subdued && stat != DEAD && !HAS_TRAIT_FROM(src, TRAIT_GODMODE, OUTPOST_KESSLER_TRAIT) && !QDELETED(src))
- if(prob(60))
- down_twitch()
- return
- if(stat == DEAD || subdued || HAS_TRAIT(src, TRAIT_GODMODE) || !awake())
+ if(stat == DEAD || HAS_TRAIT_FROM(src, TRAIT_IMMOBILIZED, OUTPOST_KESSLER_TRAIT) || !awake())
return
creature_life(seconds_per_tick)
if(!line_context)
@@ -279,1118 +209,3 @@
/// Each second while awake: what it does besides fighting
/mob/living/basic/outpost_experiment/proc/creature_life(seconds_per_tick)
return
-
-/**
- * Worn out on stamina: down alive on the floor, held there, and the containment bonus for a live
- * one. Kessler's team comes for it OUTPOST_EXPERIMENT_PICKUP seconds later.
- */
-/mob/living/basic/outpost_experiment/proc/subdue()
- if(subdued || stat == DEAD)
- return FALSE
- subdued = TRUE
- move_resist = MOVE_RESIST_DEFAULT
- ADD_TRAIT(src, TRAIT_INCAPACITATED, OUTPOST_KESSLER_TRAIT)
- ADD_TRAIT(src, TRAIT_IMMOBILIZED, OUTPOST_KESSLER_TRAIT)
- ADD_TRAIT(src, TRAIT_FLOORED, OUTPOST_KESSLER_TRAIT)
- ai_controller?.CancelActions()
- show_down(TRUE)
- prison?.experiment_creature_down(src, subdued = TRUE)
- return TRUE
-
-/mob/living/basic/outpost_experiment/received_stamina_damage(current_level, amount_actual, amount)
- . = ..()
- if(has_status_effect(/datum/status_effect/incapacitating/stamcrit))
- subdue()
-
-// ----- targets -----
-
-/// Whether it goes after `target`. By default only its victims (is_victim()); the fly adds food, the nightmare lights.
-/mob/living/basic/outpost_experiment/proc/can_target(atom/target)
- return is_victim(target)
-
-/// People, borgs and prisoners, never its own kind or Kessler's staff
-/mob/living/basic/outpost_experiment/proc/is_victim(atom/target)
- var/mob/living/victim = target
- if(!istype(victim) || victim == src || victim.stat == DEAD)
- return FALSE
- if(is_outpost_experiment_mob(victim) || HAS_TRAIT(victim, TRAIT_GODMODE))
- return FALSE
- if(is_outpost_prisoner(victim))
- var/mob/living/basic/outpost_prisoner/prisoner = victim
- if(prisoner.phase != PRISONER_PRESENT || !may_hit_prisoner(prisoner))
- return FALSE
- return !blocked_by_cell(prisoner)
- return ishuman(victim) || issilicon(victim) || !isnull(victim.mind)
-
-/// Whether it hits this prisoner
-/mob/living/basic/outpost_experiment/proc/may_hit_prisoner(mob/living/basic/outpost_prisoner/prisoner)
- return TRUE
-
-/// How much less it wants a target than its distance says; prisoners and people may count differently
-/mob/living/basic/outpost_experiment/proc/target_penalty(mob/living/target)
- return 0
-
-/**
- * Its target now: whoever hurt it lately, else the nearest it wants in sight. While nobody from the
- * wing is home it fights back but hunts nobody, as the horror does (crew_about()), so a loose
- * creature is never a trap left for visitors.
- */
-/mob/living/basic/outpost_experiment/proc/choose_target()
- var/datum/component/experiment_damage_ledger/ledger = GetComponent(/datum/component/experiment_damage_ledger)
- var/mob/living/attacker = ledger?.recent_player()
- if(attacker && can_target(attacker) && get_dist(src, attacker) <= 9 && can_see(src, attacker, 9) && !target_unreachable(attacker))
- return attacker
- if(prison && !prison.crew_home())
- return null
- var/mob/living/best
- var/best_score = INFINITY
- for(var/mob/living/candidate in range(7, src))
- if(!can_target(candidate) || !can_see(src, candidate, 7) || target_unreachable(candidate))
- continue
- var/score = get_dist(src, candidate) + target_penalty(candidate)
- if(score < best_score)
- best = candidate
- best_score = score
- return best
-
-/**
- * Its AI's first thought each plan: picks the target and may queue something of its own. Returns
- * SUBTREE_RETURN_FINISH_PLANNING when that is all it does this plan.
- */
-/mob/living/basic/outpost_experiment/proc/ai_think(datum/ai_controller/controller)
- var/atom/target = choose_target()
- if(target)
- controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, target)
- else
- controller.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET)
- return null
-
-// ----- reach -----
-
-/// Whether nothing shut stops it: the hulk smashes through walls and doors, so a bolted cell or a target it can't get to never is out of its reach
-/mob/living/basic/outpost_experiment/proc/smashes_through()
- return FALSE
-
-/// Whether it is mid-jaunt or otherwise between motives right now, and should not be judged on progress
-/mob/living/basic/outpost_experiment/proc/chasing_paused()
- return FALSE
-
-/// Whether a bolted cell keeps `prisoner` away from it: shut and locked, and it is not inside with them
-/mob/living/basic/outpost_experiment/proc/blocked_by_cell(mob/living/basic/outpost_prisoner/prisoner)
- if(smashes_through())
- return FALSE
- var/datum/outpost_prison_cell/holding = prison?.cell_at(get_turf(prisoner))
- return holding && holding.is_bolted() && !holding.contains(src)
-
-/**
- * Notes whether it is getting anywhere with `controller`'s current target: closer, beside it (Adjacent(),
- * which a shut window or door fails even at a tile's distance), or at least on the move, so a target
- * that runs is chased rather than given up on. OUTPOST_EXPERIMENT_STUCK_TIME standing still and apart
- * writes the target off as unreachable for OUTPOST_EXPERIMENT_UNREACHABLE_TIME; find_light() and
- * choose_target() skip anything on that list. Distance and Adjacent() only: no pathfinding call.
- */
-/mob/living/basic/outpost_experiment/proc/track_reach(datum/ai_controller/controller)
- if(smashes_through() || chasing_paused())
- return
- var/atom/movable/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
- if(QDELETED(target))
- chase_target_ref = null
- return
- if(chase_target_ref?.resolve() != target)
- chase_target_ref = WEAKREF(target)
- chase_best_distance = get_dist(src, target)
- chase_last_turf = loc
- chase_progress_time = world.time
- return
- if(Adjacent(target) || loc != chase_last_turf)
- chase_last_turf = loc
- chase_progress_time = world.time
- return
- var/distance = get_dist(src, target)
- if(distance < chase_best_distance)
- chase_best_distance = distance
- chase_progress_time = world.time
- return
- if(world.time - chase_progress_time < OUTPOST_EXPERIMENT_STUCK_TIME)
- return
- mark_unreachable(target)
- chase_target_ref = null
-
-/// Whether it gave up on reaching `target` recently
-/mob/living/basic/outpost_experiment/proc/target_unreachable(atom/target)
- if(!length(unreachable_until))
- return FALSE
- var/datum/weakref/ref = WEAKREF(target)
- var/until = unreachable_until[ref]
- if(!until)
- return FALSE
- if(until > world.time)
- return TRUE
- unreachable_until -= ref
- return FALSE
-
-/// Writes `target` off for OUTPOST_EXPERIMENT_UNREACHABLE_TIME: something is stopping it getting there
-/mob/living/basic/outpost_experiment/proc/mark_unreachable(atom/target)
- LAZYSET(unreachable_until, WEAKREF(target), world.time + OUTPOST_EXPERIMENT_UNREACHABLE_TIME)
- prune_unreachable()
-
-/// Drops expired entries, then the oldest ones if it somehow grew past OUTPOST_EXPERIMENT_UNREACHABLE_MAX
-/mob/living/basic/outpost_experiment/proc/prune_unreachable()
- for(var/datum/weakref/ref as anything in unreachable_until.Copy())
- if(unreachable_until[ref] <= world.time)
- unreachable_until -= ref
- while(length(unreachable_until) > OUTPOST_EXPERIMENT_UNREACHABLE_MAX)
- var/datum/weakref/oldest
- for(var/datum/weakref/ref as anything in unreachable_until)
- oldest = ref
- break
- unreachable_until -= oldest
-
-// ----- breaking things -----
-
-/// Whether it may break `thing` out of its way. Only the hulk does.
-/mob/living/basic/outpost_experiment/proc/can_break(atom/thing)
- return FALSE
-
-/// Breaks `thing` out of its way
-/mob/living/basic/outpost_experiment/proc/break_obstacle(atom/thing)
- return FALSE
-
-// ===== HULK =====
-
-/mob/living/basic/outpost_experiment/hulk
- desc = "A prisoner swollen into a green giant, still in the rags of a jumpsuit."
- form_name = "a hulk"
- mob_size = MOB_SIZE_LARGE
- footstep_kind = FOOTSTEP_MOB_HEAVY
- footstep_volume = 1
- footstep_range = -4
- status_flags = NONE
- base_health = OUTPOST_HULK_HEALTH
- health_per_player = OUTPOST_HULK_HEALTH_PER_PLAYER
- speed = OUTPOST_HULK_SPEED
- melee_damage_lower = OUTPOST_HULK_PUNCH_MIN
- melee_damage_upper = OUTPOST_HULK_PUNCH_MAX
- melee_attack_cooldown = OUTPOST_HULK_PUNCH_COOLDOWN
- obj_damage = 60
- environment_smash = ENVIRONMENT_SMASH_STRUCTURES
- attack_verb_continuous = "smashes"
- attack_verb_simple = "smash"
- attack_sound = 'sound/effects/meteorimpact.ogg'
- attack_vis_effect = ATTACK_EFFECT_SMASH
- max_stamina = OUTPOST_HULK_STAMINA
- line_context = "hulk"
- /// Worn down: slower, no charge, and batons work
- var/exhausted = FALSE
- /// Its charge
- var/datum/action/cooldown/mob_cooldown/charge/basic_charge/outpost_hulk/charge
-
-/mob/living/basic/outpost_experiment/hulk/Initialize(mapload, datum/outpost_prison/owner, mob/living/basic/outpost_prisoner/subject)
- . = ..()
- update_transform(1.25)
- charge = new(src)
- charge.Grant(src)
- ai_controller?.set_blackboard_key(BB_TARGETED_ACTION, charge)
- AddElement(/datum/element/wall_tearer/outpost_interior, allow_reinforced = FALSE, tear_time = OUTPOST_HULK_TEAR_TIME)
- RegisterSignal(src, COMSIG_LIVING_HEALTH_UPDATE, PROC_REF(check_exhausted))
- playsound(src, 'sound/mobs/non-humanoids/gorilla/gorilla.ogg', 80, TRUE)
- visible_message(span_danger("[src] swells, splits [p_their()] jumpsuit and roars!"))
-
-/mob/living/basic/outpost_experiment/hulk/Destroy()
- QDEL_NULL(charge)
- return ..()
-
-/mob/living/basic/outpost_experiment/hulk/build_look(outfit_path)
- INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(outpost_hulk_look), src, outfit_path)
-
-/// Players first, then prisoners still on their feet
-/mob/living/basic/outpost_experiment/hulk/target_penalty(mob/living/target)
- return is_outpost_prisoner(target) ? 3 : 0
-
-/// Only prisoners still standing: it knocks them flat and leaves them
-/mob/living/basic/outpost_experiment/hulk/may_hit_prisoner(mob/living/basic/outpost_prisoner/prisoner)
- return !prisoner.can_be_dragged() && prisoner.beaten_left <= 0
-
-/// It tears through walls and forces doors, so a bolted cell and a blocked path never stop it
-/mob/living/basic/outpost_experiment/hulk/smashes_through()
- return TRUE
-
-/mob/living/basic/outpost_experiment/hulk/ai_think(datum/ai_controller/controller)
- . = ..()
- var/mob/living/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
- if(exhausted || !isliving(target) || !charge?.IsAvailable())
- return
- var/distance = get_dist(src, target)
- if(distance < 2 || distance > OUTPOST_HULK_CHARGE_RANGE || !can_see(src, target, OUTPOST_HULK_CHARGE_RANGE))
- return
- controller.queue_behavior(/datum/ai_behavior/targeted_mob_ability, BB_TARGETED_ACTION, BB_BASIC_MOB_CURRENT_TARGET)
- return SUBTREE_RETURN_FINISH_PLANNING
-
-/// A punch; a prisoner is knocked flat instead, and a person may go flying
-/mob/living/basic/outpost_experiment/hulk/melee_attack(atom/target, list/modifiers, ignore_cooldown = FALSE)
- if(is_outpost_prisoner(target))
- if(!early_melee_attack(target, modifiers, ignore_cooldown))
- return FALSE
- do_attack_animation(target, ATTACK_EFFECT_SMASH)
- playsound(target, 'sound/items/weapons/punch1.ogg', 60, TRUE)
- knock_down_prisoner(target)
- return TRUE
- . = ..()
- if(!. || !isliving(target) || !prob(OUTPOST_HULK_THROW_CHANCE))
- return
- var/mob/living/victim = target
- if(victim.stat == DEAD || victim.anchored || victim.move_resist >= MOVE_FORCE_OVERPOWERING)
- return
- victim.visible_message(span_danger("[src] sends [victim] flying!"))
- victim.throw_at(get_ranged_target_turf(victim, get_dir(src, victim), OUTPOST_HULK_THROW_RANGE), OUTPOST_HULK_THROW_RANGE, 1, src)
-
-/// Knocks a prisoner into the beaten state: hurt, flat on the floor, never killed
-/mob/living/basic/outpost_experiment/hulk/proc/knock_down_prisoner(mob/living/basic/outpost_prisoner/prisoner)
- if(QDELETED(prisoner) || prisoner.stat == DEAD)
- return FALSE
- var/damage = min(rand(OUTPOST_HULK_PUNCH_MIN, OUTPOST_HULK_PUNCH_MAX), max(0, prisoner.health - 1))
- if(damage > 0)
- prisoner.apply_damage(damage, BRUTE)
- prisoner.visible_message(span_danger("[src] knocks [prisoner] flat!"))
- if(prisoner.stat == CONSCIOUS && prisoner.beaten_left <= 0)
- prisoner.collapse()
- return TRUE
-
-/// Worn down to OUTPOST_HULK_EXHAUSTED_AT percent: slower, no more charging, and stamina weapons work
-/mob/living/basic/outpost_experiment/hulk/proc/check_exhausted(datum/source)
- SIGNAL_HANDLER
- if(exhausted || stat == DEAD || health > maxHealth * OUTPOST_HULK_EXHAUSTED_AT / 100)
- return
- exhausted = TRUE
- set_varspeed(OUTPOST_HULK_EXHAUSTED_SPEED)
- damage_coeff[STAMINA] = 1
- status_flags |= CANSTUN | CANKNOCKDOWN
- charge?.disable()
- visible_message(span_warning("[src] staggers, heaving for breath. [p_They()] look[p_s()] spent."))
-
-/// Charged into a wall: stunned, and hit harder for a moment
-/mob/living/basic/outpost_experiment/hulk/proc/stagger_on_wall()
- Stun(OUTPOST_HULK_WALL_STUN, ignore_canstun = TRUE)
- damage_coeff[BRUTE] = OUTPOST_HULK_WALL_VULNERABLE
- damage_coeff[BURN] = OUTPOST_HULK_WALL_VULNERABLE
- addtimer(CALLBACK(src, PROC_REF(recover_from_wall)), OUTPOST_HULK_WALL_STUN, TIMER_UNIQUE | TIMER_OVERRIDE | TIMER_DELETE_ME)
-
-/mob/living/basic/outpost_experiment/hulk/proc/recover_from_wall()
- damage_coeff[BRUTE] = 1
- damage_coeff[BURN] = 1
-
-/// Interior walls, windows, grilles, tables, chairs and doors, never the hatch counters or anything protected
-/mob/living/basic/outpost_experiment/hulk/can_break(atom/thing)
- if(QDELETED(thing) || !outpost_experiment_can_smash(thing, prison))
- return FALSE
- if(isturf(thing))
- return iswallturf(thing) && !istype(thing, /turf/closed/wall/r_wall) && !isindestructiblewall(thing)
- var/obj/object = thing
- if(!istype(object) || (object.resistance_flags & INDESTRUCTIBLE) || HAS_TRAIT(object, TRAIT_OUTPOST_PROPERTY))
- return FALSE
- if(istype(object, /obj/structure/table/reinforced/prison_hatch))
- return FALSE
- return istype(object, /obj/structure/window) || istype(object, /obj/structure/grille) || istype(object, /obj/structure/table) \
- || istype(object, /obj/structure/chair) || istype(object, /obj/machinery/door)
-
-/mob/living/basic/outpost_experiment/hulk/break_obstacle(atom/thing)
- if(!can_break(thing))
- return FALSE
- if(isturf(thing))
- // The wall tearer takes it from here, in three pulls.
- melee_attack(thing)
- return TRUE
- if(istype(thing, /obj/machinery/door/airlock))
- INVOKE_ASYNC(src, PROC_REF(force_door), thing)
- return TRUE
- smash(thing)
- return TRUE
-
-/// Batters a door until it gives: bolts sheared, weld broken, forced open
-/mob/living/basic/outpost_experiment/hulk/proc/force_door(obj/machinery/door/airlock/door)
- if(DOING_INTERACTION_WITH_TARGET(src, door) || !door.density)
- return FALSE
- visible_message(span_danger("[src] batters at [door]!"))
- playsound(door, 'sound/effects/bang.ogg', 70, TRUE)
- door.Shake(2, 2, 0.5 SECONDS)
- if(!do_after(src, OUTPOST_HULK_DOOR_TIME, target = door) || QDELETED(door) || !can_break(door))
- return FALSE
- if(door.locked)
- door.unbolt()
- if(door.welded)
- door.welded = FALSE
- door.update_appearance()
- door.visible_message(span_danger("[src] forces [door] open!"))
- playsound(door, 'sound/machines/airlock/airlock_alien_prying.ogg', 80, TRUE)
- INVOKE_ASYNC(door, TYPE_PROC_REF(/obj/machinery/door, open), BYPASS_DOOR_CHECKS)
- prison?.refresh_reach()
- return TRUE
-
-/// Puts something through: windows shatter, tables fold, chairs splinter, window doors break
-/mob/living/basic/outpost_experiment/hulk/proc/smash(obj/thing)
- if(QDELETED(thing))
- return FALSE
- do_attack_animation(thing, ATTACK_EFFECT_SMASH)
- visible_message(span_danger("[src] smashes [thing]!"))
- playsound(thing, istype(thing, /obj/structure/window) ? 'sound/effects/glass/glassbr1.ogg' : 'sound/effects/woodhit.ogg', 70, TRUE)
- thing.take_damage(thing.get_integrity(), BRUTE, MELEE, FALSE, get_dir(thing, src))
- return TRUE
-
-/// tg's hulk skin on the prisoner's own clothes, cached per outfit
-/proc/outpost_hulk_look(mob/living/basic/outpost_experiment/hulk/hulk, outfit_path)
- var/static/list/looks = list()
- var/key = "[outfit_path]"
- var/mutable_appearance/look = looks[key]
- if(!look)
- var/mob/living/carbon/human/dummy/consistent/dummy = new()
- dummy.set_species(/datum/species/human)
- dummy.stat = DEAD
- dummy.underwear = "Nude"
- dummy.undershirt = "Nude"
- dummy.socks = "Nude"
- if(outfit_path)
- dummy.equipOutfit(outfit_path, visuals_only = TRUE)
- for(var/obj/item/bodypart/part as anything in dummy.bodyparts)
- part.add_color_override(COLOR_DARK_LIME, LIMB_COLOR_HULK)
- dummy.update_body_parts()
- look = new(dummy.appearance)
- looks[key] = look
- qdel(dummy)
- if(QDELETED(hulk))
- return
- hulk.icon = 'icons/mob/human/human.dmi'
- hulk.icon_state = ""
- hulk.appearance_flags |= KEEP_TOGETHER
- hulk.copy_overlays(look, cut_old = TRUE)
-
-/// The hulk's charge: a roar, a stamp and a line on the floor, then six tiles of it
-/datum/action/cooldown/mob_cooldown/charge/basic_charge/outpost_hulk
- name = "Charge"
- desc = "Put your head down and run through whatever is in the way."
- cooldown_time = OUTPOST_HULK_CHARGE_COOLDOWN
- charge_delay = OUTPOST_HULK_CHARGE_WINDUP
- charge_distance = OUTPOST_HULK_CHARGE_RANGE
- charge_past = 1
- charge_damage = OUTPOST_HULK_CHARGE_DAMAGE
- destroy_objects = FALSE
- shake_duration = OUTPOST_HULK_CHARGE_WINDUP
- recoil_duration = OUTPOST_HULK_WALL_STUN
- knockdown_duration = OUTPOST_HULK_CHARGE_KNOCKDOWN
-
-/datum/action/cooldown/mob_cooldown/charge/basic_charge/outpost_hulk/do_charge_indicator(atom/charger, atom/charge_target)
- . = ..()
- playsound(charger, 'sound/mobs/non-humanoids/gorilla/gorilla.ogg', 80, TRUE)
- charger.visible_message(span_danger("[charger] roars and stamps, lowering [charger.p_their()] head!"))
- var/direction = get_dir(charger, charge_target)
- var/turf/step_turf = get_turf(charger)
- for(var/i in 1 to charge_distance)
- step_turf = get_step(step_turf, direction)
- if(!step_turf || isclosedturf(step_turf))
- break
- new /obj/effect/temp_visual/telegraphing/outpost_hulk_charge(step_turf)
-
-/datum/action/cooldown/mob_cooldown/charge/basic_charge/outpost_hulk/on_bump(atom/movable/source, atom/target)
- var/mob/living/basic/outpost_experiment/hulk/hulk = source
- if(istype(hulk) && isobj(target) && target.density && !istype(target, /obj/machinery/door/airlock) && hulk.can_break(target))
- INVOKE_ASYNC(hulk, TYPE_PROC_REF(/mob/living/basic/outpost_experiment/hulk, smash), target)
- return
- return ..()
-
-/datum/action/cooldown/mob_cooldown/charge/basic_charge/outpost_hulk/on_moved(atom/source)
- . = ..()
- var/mob/living/basic/outpost_experiment/hulk/hulk = source
- if(!istype(hulk))
- return
- for(var/obj/structure/chair/chair in get_turf(hulk))
- if(hulk.can_break(chair))
- INVOKE_ASYNC(hulk, TYPE_PROC_REF(/mob/living/basic/outpost_experiment/hulk, smash), chair)
-
-/datum/action/cooldown/mob_cooldown/charge/basic_charge/outpost_hulk/hit_target(atom/movable/source, atom/target, damage_dealt)
- var/mob/living/basic/outpost_experiment/hulk/hulk = source
- if(is_outpost_prisoner(target))
- hulk?.knock_down_prisoner(target)
- return
- if(isliving(target))
- var/mob/living/victim = target
- victim.apply_damage(damage_dealt, BRUTE, wound_bonus = CANT_WOUND)
- playsound(get_turf(victim), 'sound/effects/meteorimpact.ogg', 80, TRUE)
- return ..()
- hulk?.visible_message(span_danger("[hulk] slams into [target] and reels!"))
- playsound(get_turf(source), 'sound/effects/bang.ogg', 80, TRUE)
- hulk?.stagger_on_wall()
-
-/// The floor in the charge's path, for the length of the wind-up
-/obj/effect/temp_visual/telegraphing/outpost_hulk_charge
- duration = OUTPOST_HULK_CHARGE_WINDUP
- color = "#9ae05a"
-
-/// tg's wall tearer, for walls inside the outpost only
-/datum/element/wall_tearer/outpost_interior
-
-/datum/element/wall_tearer/outpost_interior/validate_target(atom/target, mob/living/tearer)
- . = ..()
- if(. != TRUE)
- return
- var/mob/living/basic/outpost_experiment/hulk/hulk = tearer
- if(!istype(hulk) || !hulk.can_break(target))
- target.balloon_alert(tearer, "it won't give!")
- return -1
-
-// ===== FLY PERSON =====
-
-/mob/living/basic/outpost_experiment/fly
- desc = "A prisoner turned into something like a fly: bulging eyes, a proboscis, and a buzz you can hear across the room."
- form_name = "a fly person"
- base_health = OUTPOST_FLY_HEALTH
- speed = OUTPOST_FLY_SPEED
- melee_damage_lower = OUTPOST_FLY_BITE
- melee_damage_upper = OUTPOST_FLY_BITE
- melee_attack_cooldown = 1.5 SECONDS
- attack_verb_continuous = "bites"
- attack_verb_simple = "bite"
- attack_sound = 'sound/items/weapons/bite.ogg'
- attack_vis_effect = ATTACK_EFFECT_BITE
- damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, STAMINA = 1, OXY = 0)
- status_flags = CANPUSH | CANSTUN | CANKNOCKDOWN
- max_stamina = OUTPOST_FLY_STAMINA
- line_context = "fly"
- ai_controller = /datum/ai_controller/basic_controller/outpost_experiment/fly
- death_message = "drops out of the air and goes still."
- subdued_message = "drops out of the air, stunned."
- win_hint = "It never lands for long."
- /// Seconds to its next heave
- var/vomit_left = OUTPOST_FLY_VOMIT_MIN
- /// REF() of prisoners who watched it throw up -> world.time
- var/list/disgusted = list()
- /// world.time of its next random dart, and by when the dart under way must be over
- var/next_dart = 0
- var/dart_until = 0
- /// Whoever hit it last, whom it keeps away from until flit_until
- var/datum/weakref/flit_from_ref
- var/flit_until = 0
-
-/mob/living/basic/outpost_experiment/fly/Initialize(mapload, datum/outpost_prison/owner, mob/living/basic/outpost_prisoner/subject)
- . = ..()
- RegisterSignal(src, COMSIG_MOB_APPLY_DAMAGE_MODIFIERS, PROC_REF(swatter_weakness))
- RegisterSignal(src, COMSIG_PROJECTILE_PREHIT, PROC_REF(dodge))
- RegisterSignal(src, COMSIG_ATOM_WAS_ATTACKED, PROC_REF(on_attacked))
- ADD_TRAIT(src, TRAIT_MOVE_FLYING, OUTPOST_FLY_TRAIT)
- playsound(src, 'sound/mobs/non-humanoids/bee/bee_swarm.ogg', 60, TRUE)
- visible_message(span_danger("[src] folds up, splits open and unfolds as something with wings!"))
-
-/mob/living/basic/outpost_experiment/fly/Destroy()
- flit_from_ref = null
- return ..()
-
-/mob/living/basic/outpost_experiment/fly/build_look(outfit_path)
- apply_dynamic_human_appearance(src, outfit_path, /datum/species/fly)
-
-/// On the floor (knocked down, subdued or dead) it is not flying
-/mob/living/basic/outpost_experiment/fly/on_lying_down(new_lying_angle)
- . = ..()
- REMOVE_TRAIT(src, TRAIT_MOVE_FLYING, OUTPOST_FLY_TRAIT)
-
-/// Back up, it takes off again
-/mob/living/basic/outpost_experiment/fly/on_standing_up()
- . = ..()
- if(stat == CONSCIOUS && !subdued)
- ADD_TRAIT(src, TRAIT_MOVE_FLYING, OUTPOST_FLY_TRAIT)
-
-/mob/living/basic/outpost_experiment/fly/down_twitch()
- Shake(1, 0, 0.4 SECONDS)
- playsound(src, 'sound/mobs/non-humanoids/bee/bee.ogg', 15, TRUE)
- if(prob(40))
- manual_emote(pick("buzzes weakly.", "twitches [p_their()] wings.", "twitches."))
-
-/// tg's fly people take thirty times the damage from a flyswatter
-/mob/living/basic/outpost_experiment/fly/proc/swatter_weakness(datum/source, list/damage_mods, damage_amount, damagetype, def_zone, sharpness, attack_direction, obj/item/attacking_item)
- SIGNAL_HANDLER
- if(istype(attacking_item, /obj/item/melee/flyswatter))
- damage_mods += OUTPOST_FLY_SWATTER_MULT
-
-/// In the air and free to move: not knocked down, stunned, held, pulled, subdued or being taken away
-/mob/living/basic/outpost_experiment/fly/proc/flying_freely()
- if(stat != CONSCIOUS || subdued || !isturf(loc) || pulledby || buckled || body_position != STANDING_UP)
- return FALSE
- return !HAS_TRAIT(src, TRAIT_IMMOBILIZED) && !HAS_TRAIT(src, TRAIT_INCAPACITATED) && !HAS_TRAIT(src, TRAIT_GODMODE)
-
-/// Jinks out of the way of some shots while it flies freely
-/mob/living/basic/outpost_experiment/fly/proc/dodge(datum/source, obj/projectile/shot)
- SIGNAL_HANDLER
- if(!flying_freely() || !prob(OUTPOST_FLY_DODGE))
- return NONE
- visible_message(span_warning("[src] jinks out of the way of [shot]!"))
- playsound(src, 'sound/mobs/non-humanoids/bee/bee.ogg', 30, TRUE)
- return PROJECTILE_INTERRUPT_HIT_PHASE
-
-/// Hit while flying: it flits away from whoever did it, and keeps away from them for a few seconds
-/mob/living/basic/outpost_experiment/fly/proc/on_attacked(datum/source, atom/attacker, attack_flags)
- SIGNAL_HANDLER
- if(!attacker || attacker == src || !flying_freely())
- return
- flit_from_ref = WEAKREF(attacker)
- flit_until = world.time + OUTPOST_FLY_FLIT_TIME
- // Once the blow is over, not in the middle of it.
- addtimer(CALLBACK(src, PROC_REF(flit)), 1, TIMER_UNIQUE | TIMER_OVERRIDE | TIMER_DELETE_ME)
-
-/// Whoever hit it within OUTPOST_FLY_FLIT_TIME, if still near enough to keep away from
-/mob/living/basic/outpost_experiment/fly/proc/flit_threat()
- if(world.time > flit_until)
- return null
- var/atom/movable/attacker = flit_from_ref?.resolve()
- if(QDELETED(attacker) || attacker.z != z || get_dist(src, attacker) > OUTPOST_FLY_DART_MAX + OUTPOST_FLY_FLEE_RANGE)
- return null
- return attacker
-
-/// Darts away from whoever just hit it, at once rather than at its next thought. Returns TRUE if it went.
-/mob/living/basic/outpost_experiment/fly/proc/flit()
- var/atom/attacker = flit_threat()
- if(!attacker || !flying_freely() || !ai_controller || !awake())
- return FALSE
- var/turf/spot = dart_spot(attacker)
- if(!spot)
- return FALSE
- ai_controller.CancelActions()
- ai_controller.queue_behavior(/datum/ai_behavior/outpost_fly_dart/away, spot)
- return TRUE
-
-/// It goes for food and bites only when cornered: its "targets" are meals, and people it cannot get away from
-/mob/living/basic/outpost_experiment/fly/can_target(atom/target)
- if(istype(target, /obj/item/food))
- return isturf(target.loc)
- return ..()
-
-/// Whoever is closest within OUTPOST_FLY_FLEE_RANGE, to keep away from
-/mob/living/basic/outpost_experiment/fly/proc/nearest_threat()
- var/mob/living/nearest
- var/nearest_distance = INFINITY
- for(var/mob/living/person in range(OUTPOST_FLY_FLEE_RANGE, src))
- if(person == src || !is_victim(person))
- continue
- var/distance = get_dist(src, person)
- if(distance < nearest_distance)
- nearest = person
- nearest_distance = distance
- return nearest
-
-/**
- * Somewhere to dart to: an open tile OUTPOST_FLY_DART_MIN to OUTPOST_FLY_DART_MAX tiles off, in a
- * clear line, on ground it keeps to (may_dart_to()). Away from `threat`, only somewhere farther
- * from it than it is now, and out of its OUTPOST_FLY_FLEE_RANGE if it can. Null if there is
- * nowhere: cornered.
- */
-/mob/living/basic/outpost_experiment/fly/proc/dart_spot(atom/threat)
- var/turf/here = get_turf(src)
- if(!here)
- return null
- var/threat_distance = threat ? get_dist(here, threat) : 0
- var/list/spots = list()
- var/list/clear_spots = list()
- for(var/turf/open/tile in RANGE_TURFS(OUTPOST_FLY_DART_MAX, here))
- if(get_dist(here, tile) < OUTPOST_FLY_DART_MIN)
- continue
- var/from_threat = threat ? get_dist(tile, threat) : INFINITY
- if(from_threat <= threat_distance || !may_dart_to(tile) || !clear_line(here, tile))
- continue
- spots += tile
- if(from_threat > OUTPOST_FLY_FLEE_RANGE)
- clear_spots += tile
- if(length(clear_spots))
- return pick(clear_spots)
- return length(spots) ? pick(spots) : null
-
-/**
- * Whether it keeps to `tile`: free and safe, and in the wing (its cell block, while it is in
- * there) like the other creatures. Got out of the wing, it darts about the room it is in.
- */
-/mob/living/basic/outpost_experiment/fly/proc/may_dart_to(turf/tile)
- if(isspaceturf(tile) || isopenspaceturf(tile) || tile.is_blocked_turf(FALSE, src) || !tile.can_cross_safely(src))
- return FALSE
- var/turf/here = get_turf(src)
- if(prison?.wing && here.loc == prison.wing)
- return tile.loc == prison.wing && (!prison.in_cell_block(here) || prison.in_cell_block(tile))
- return tile.loc == here.loc
-
-/// Whether it can fly straight from `start` to `finish`: nothing solid or opaque in the way
-/mob/living/basic/outpost_experiment/fly/proc/clear_line(turf/start, turf/finish)
- for(var/turf/step as anything in get_line(start, finish))
- if(step == start)
- continue
- if(step.opacity || step.is_blocked_turf(TRUE, src))
- return FALSE
- return TRUE
-
-/**
- * Keeps moving: darts away from anyone close or who just hit it, and bites only when cornered
- * with someone at it. Otherwise it goes for food in sight, or darts about at random with short
- * pauses. It hovers (outpost_fly_hover) rather than planning nothing, so it notices people at once.
- */
-/mob/living/basic/outpost_experiment/fly/ai_think(datum/ai_controller/controller)
- if(!flying_freely())
- controller.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET)
- controller.queue_behavior(/datum/ai_behavior/outpost_fly_hover)
- return SUBTREE_RETURN_FINISH_PLANNING
- var/atom/threat = flit_threat() || nearest_threat()
- if(threat)
- var/turf/away = dart_spot(threat)
- if(away)
- controller.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET)
- controller.queue_behavior(/datum/ai_behavior/outpost_fly_dart/away, away)
- return SUBTREE_RETURN_FINISH_PLANNING
- // Nowhere farther to go: it bites whoever is at it.
- var/mob/living/at_it = threat
- if(istype(at_it) && Adjacent(at_it) && can_target(at_it))
- controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, at_it)
- return null
- controller.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET)
- controller.queue_behavior(/datum/ai_behavior/outpost_fly_hover)
- return SUBTREE_RETURN_FINISH_PLANNING
- var/obj/item/food/meal = find_meal()
- if(meal)
- controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, meal)
- return null
- controller.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET)
- var/turf/spot = world.time >= next_dart ? dart_spot() : null
- if(spot)
- controller.queue_behavior(/datum/ai_behavior/outpost_fly_dart, spot)
- return SUBTREE_RETURN_FINISH_PLANNING
- if(world.time >= next_dart)
- next_dart = world.time + rand(OUTPOST_FLY_DART_GAP_MIN, OUTPOST_FLY_DART_GAP_MAX)
- controller.queue_behavior(/datum/ai_behavior/outpost_fly_hover)
- return SUBTREE_RETURN_FINISH_PLANNING
-
-/// The nearest food in sight: a serving hatch, a table or the floor
-/mob/living/basic/outpost_experiment/fly/proc/find_meal()
- var/obj/item/food/best
- var/best_distance = INFINITY
- for(var/obj/item/food/meal in range(5, src))
- if(!isturf(meal.loc) || !can_see(src, meal, 5))
- continue
- var/distance = get_dist(src, meal)
- if(distance < best_distance)
- best = meal
- best_distance = distance
- return best
-
-/mob/living/basic/outpost_experiment/fly/melee_attack(atom/target, list/modifiers, ignore_cooldown = FALSE)
- var/obj/item/food/meal = target
- if(istype(meal))
- if(!early_melee_attack(target, modifiers, ignore_cooldown))
- return FALSE
- visible_message(span_warning("[src] slurps up [meal]."))
- playsound(src, 'sound/items/eatfood.ogg', 40, TRUE)
- if(isturf(meal.loc))
- new /obj/effect/decal/cleanable/food/crumbs(meal.loc)
- qdel(meal)
- return TRUE
- return ..()
-
-/// It throws up every few seconds, now and then over someone beside it; prisoners who see it lose a little mood
-/mob/living/basic/outpost_experiment/fly/creature_life(seconds_per_tick)
- vomit_left -= seconds_per_tick
- if(vomit_left > 0 || !isturf(loc))
- return
- vomit_left = rand(OUTPOST_FLY_VOMIT_MIN, OUTPOST_FLY_VOMIT_MAX)
- throw_up()
-
-/mob/living/basic/outpost_experiment/fly/proc/throw_up()
- var/turf/spot = loc
- var/list/beside = list()
- for(var/mob/living/person in orange(1, src))
- if(is_victim(person))
- beside += person
- if(length(beside) && prob(OUTPOST_FLY_VOMIT_ON_CHANCE))
- var/mob/living/unlucky = pick(beside)
- spot = get_turf(unlucky)
- visible_message(span_danger("[src] throws up all over [unlucky]!"))
- else
- visible_message(span_warning("[src] throws up."))
- playsound(src, 'sound/mobs/humanoids/human/gag_vomit/crack_vomit.ogg', 50, TRUE)
- if(isopenturf(spot))
- new /obj/effect/decal/cleanable/vomit(spot)
- for(var/mob/living/basic/outpost_prisoner/watcher in viewers(5, src))
- if(watcher.stat != CONSCIOUS || LAZYACCESS(disgusted, REF(watcher)) > world.time)
- continue
- LAZYSET(disgusted, REF(watcher), world.time + OUTPOST_EXPERIMENT_FLY_DISGUST_GAP)
- watcher.adjust_mood(-OUTPOST_EXPERIMENT_FLY_DISGUST_MOOD)
- return spot
-
-// ===== NIGHTMARE =====
-
-/mob/living/basic/outpost_experiment/nightmare
- desc = "A shape like a person cut out of the dark, with a long blade where one arm should be."
- form_name = "a nightmare"
- footstep_kind = FOOTSTEP_MOB_BAREFOOT
- footstep_volume = 0.3
- base_health = OUTPOST_NIGHTMARE_HEALTH
- health_per_player = OUTPOST_NIGHTMARE_HEALTH_PER_PLAYER
- speed = OUTPOST_NIGHTMARE_DARK_SPEED
- melee_damage_lower = OUTPOST_NIGHTMARE_DAMAGE
- melee_damage_upper = OUTPOST_NIGHTMARE_DAMAGE
- melee_attack_cooldown = OUTPOST_NIGHTMARE_ATTACK_COOLDOWN
- armour_penetration = OUTPOST_NIGHTMARE_ARMOUR_PENETRATION
- attack_verb_continuous = "slashes"
- attack_verb_simple = "slash"
- attack_sound = 'sound/items/weapons/bladeslice.ogg'
- attack_vis_effect = ATTACK_EFFECT_SLASH
- sharpness = SHARP_EDGED
- lighting_cutoff = LIGHTING_CUTOFF_HIGH
- /// Seconds left of breaking the lights before it hunts
- var/opening_left = OUTPOST_NIGHTMARE_OPENING_MIN
- /// Mid jaunt: gone into the dark, about to come out beside someone
- var/jaunting = FALSE
- /// Where it will come out, and at whom
- var/turf/jaunt_spot
- var/datum/weakref/jaunt_target_ref
- /// Its last light reading was dark
- var/in_shadow = TRUE
- COOLDOWN_DECLARE(jaunt_cooldown)
-
-/mob/living/basic/outpost_experiment/nightmare/Initialize(mapload, datum/outpost_prison/owner, mob/living/basic/outpost_prisoner/subject)
- . = ..()
- opening_left = rand(OUTPOST_NIGHTMARE_OPENING_MIN, OUTPOST_NIGHTMARE_OPENING_MAX)
- RegisterSignal(src, COMSIG_PROJECTILE_PREHIT, PROC_REF(dodge))
- RegisterSignal(src, COMSIG_ATOM_ATTACKBY, PROC_REF(on_attackby))
- playsound(src, 'sound/effects/hallucinations/wail.ogg', 60, TRUE)
- visible_message(span_danger("The light seems to drain out of [src], and something else stands where [p_they()] stood."))
-
-/mob/living/basic/outpost_experiment/nightmare/Destroy()
- jaunt_spot = null
- return ..()
-
-/mob/living/basic/outpost_experiment/nightmare/build_look(outfit_path)
- apply_dynamic_human_appearance(src, /datum/outfit/outpost_experiment_nightmare, /datum/species/shadow/nightmare)
-
-/// Whether the tile it stands on is dark
-/mob/living/basic/outpost_experiment/nightmare/proc/in_dark(turf/tile = get_turf(src))
- return tile && tile.get_lumcount() < OUTPOST_NIGHTMARE_DARK
-
-/// Each second: heal in the dark and move fast, burn in the light and move slow; the opening runs down
-/mob/living/basic/outpost_experiment/nightmare/creature_life(seconds_per_tick)
- if(opening_left > 0)
- opening_left -= seconds_per_tick
- in_shadow = in_dark()
- set_varspeed(in_shadow ? OUTPOST_NIGHTMARE_DARK_SPEED : OUTPOST_NIGHTMARE_LIGHT_SPEED)
- if(in_shadow)
- if(health < maxHealth)
- adjustBruteLoss(-OUTPOST_NIGHTMARE_REGEN * seconds_per_tick)
- return
- if(jaunting)
- cancel_jaunt()
- var/burn = OUTPOST_NIGHTMARE_BURN * seconds_per_tick
- adjustFireLoss(burn)
- // The crew's lights are their weapon.
- var/datum/component/experiment_damage_ledger/ledger = GetComponent(/datum/component/experiment_damage_ledger)
- ledger?.add_damage(burn, TRUE)
- if(prob(20))
- visible_message(span_warning("[src] smokes and shrinks from the light."))
-
-/// Whether it is still breaking the lights: for its first half minute, until it is hurt, or until there are none
-/mob/living/basic/outpost_experiment/nightmare/proc/in_opening()
- if(opening_left <= 0)
- return FALSE
- var/datum/component/experiment_damage_ledger/ledger = GetComponent(/datum/component/experiment_damage_ledger)
- if(ledger && (ledger.player_damage + ledger.other_damage + ledger.pending) > 0)
- opening_left = 0
- return FALSE
- return TRUE
-
-/// Prisoners first, standing or down; it finishes what it starts
-/mob/living/basic/outpost_experiment/nightmare/target_penalty(mob/living/target)
- return is_outpost_prisoner(target) ? -3 : 0
-
-/// Mid-jaunt it is immobile by design, not stuck
-/mob/living/basic/outpost_experiment/nightmare/chasing_paused()
- return jaunting
-
-/// Lights, during the opening
-/mob/living/basic/outpost_experiment/nightmare/can_target(atom/target)
- if(istype(target, /obj/machinery/light))
- var/obj/machinery/light/fixture = target
- return fixture.status != LIGHT_BROKEN && fixture.status != LIGHT_EMPTY
- return ..()
-
-/// The nearest working light in sight
-/mob/living/basic/outpost_experiment/nightmare/proc/find_light()
- var/obj/machinery/light/best
- var/best_distance = INFINITY
- for(var/obj/machinery/light/fixture in range(9, src))
- if(!can_target(fixture) || !can_see(src, fixture, 9) || target_unreachable(fixture))
- continue
- var/distance = get_dist(src, fixture)
- if(distance < best_distance)
- best = fixture
- best_distance = distance
- return best
-
-/mob/living/basic/outpost_experiment/nightmare/ai_think(datum/ai_controller/controller)
- if(jaunting)
- controller.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET)
- return SUBTREE_RETURN_FINISH_PLANNING
- if(in_opening())
- var/obj/machinery/light/fixture = find_light()
- if(fixture)
- controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, fixture)
- return null
- opening_left = 0
- . = ..()
- var/mob/living/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
- if(!isliving(target) || get_dist(src, target) <= 1)
- return
- var/turf/spot = jaunt_spot_near(target)
- if(!spot)
- return
- start_jaunt(target, spot)
- return SUBTREE_RETURN_FINISH_PLANNING
-
-/// A light eater hit; a light is simply put out, and a flashlight in the victim's hands may burn out for good
-/mob/living/basic/outpost_experiment/nightmare/melee_attack(atom/target, list/modifiers, ignore_cooldown = FALSE)
- var/obj/machinery/light/fixture = target
- if(istype(fixture))
- if(!early_melee_attack(target, modifiers, ignore_cooldown))
- return FALSE
- do_attack_animation(fixture, ATTACK_EFFECT_SLASH)
- if(fixture.status == LIGHT_OK || fixture.status == LIGHT_BURNED)
- fixture.visible_message(span_danger("[src] cuts through [fixture], and it goes dark."))
- fixture.break_light_tube()
- return TRUE
- . = ..()
- if(. && isliving(target))
- eat_held_light(target)
-
-/// OUTPOST_NIGHTMARE_BURNOUT_CHANCE to put out a flashlight `victim` holds for good; never a flare or glowstick
-/mob/living/basic/outpost_experiment/nightmare/proc/eat_held_light(mob/living/victim)
- if(!prob(OUTPOST_NIGHTMARE_BURNOUT_CHANCE))
- return null
- for(var/obj/item/flashlight/light in victim.held_items)
- if(istype(light, /obj/item/flashlight/flare) || istype(light, /obj/item/flashlight/glowstick) || !light.light_on)
- continue
- if(SEND_SIGNAL(light, COMSIG_LIGHT_EATER_ACT, src) & COMPONENT_BLOCK_LIGHT_EATER)
- continue
- light.AddElement(/datum/element/light_eaten)
- victim.visible_message(span_danger("[src]'s blade passes through [light], and it dies in [victim]'s hand."))
- return light
- return null
-
-/// Sidesteps most shots in the dark
-/mob/living/basic/outpost_experiment/nightmare/proc/dodge(datum/source, obj/projectile/shot)
- SIGNAL_HANDLER
- if(stat != CONSCIOUS || !in_dark() || !prob(OUTPOST_NIGHTMARE_DODGE))
- return NONE
- visible_message(span_warning("[src] melts aside from [shot]!"))
- return PROJECTILE_INTERRUPT_HIT_PHASE
-
-/// A handheld flash burns it, staggers it and throws it out of a jaunt
-/mob/living/basic/outpost_experiment/nightmare/proc/on_attackby(datum/source, obj/item/attacking_item, mob/living/user, list/modifiers, list/attack_modifiers)
- SIGNAL_HANDLER
- var/obj/item/assembly/flash/flash = attacking_item
- if(!istype(flash) || stat == DEAD || flash.burnt_out || world.time < flash.last_trigger + flash.cooldown)
- return NONE
- INVOKE_ASYNC(flash, TYPE_PROC_REF(/obj/item/assembly/flash, try_use_flash), user)
- INVOKE_ASYNC(src, PROC_REF(flashed), user)
- return COMPONENT_NO_AFTERATTACK
-
-/mob/living/basic/outpost_experiment/nightmare/proc/flashed(mob/living/user)
- var/datum/component/experiment_damage_ledger/ledger = GetComponent(/datum/component/experiment_damage_ledger)
- ledger?.note_attacker(user)
- cancel_jaunt()
- visible_message(span_danger("[src] shrieks and recoils from the flash!"))
- apply_damage(OUTPOST_NIGHTMARE_FLASH_DAMAGE, BURN)
- Stun(OUTPOST_NIGHTMARE_FLASH_STAGGER, ignore_canstun = TRUE)
-
-/// A dark tile beside `target` it could jaunt to, if the jaunt is ready and it stands in the dark
-/mob/living/basic/outpost_experiment/nightmare/proc/jaunt_spot_near(mob/living/target)
- if(jaunting || !COOLDOWN_FINISHED(src, jaunt_cooldown) || !in_dark())
- return null
- var/list/spots = list()
- for(var/turf/open/tile in orange(1, target))
- if(tile.is_blocked_turf(TRUE) || !in_dark(tile) || !prison?.outpost_holds(tile))
- continue
- spots += tile
- return length(spots) ? pick(spots) : null
-
-/// Fades into the dark; a ripple and a whisper warn where it will come out, OUTPOST_NIGHTMARE_JAUNT_RIPPLE later
-/mob/living/basic/outpost_experiment/nightmare/proc/start_jaunt(mob/living/target, turf/spot)
- jaunting = TRUE
- jaunt_spot = spot
- jaunt_target_ref = WEAKREF(target)
- COOLDOWN_START(src, jaunt_cooldown, OUTPOST_NIGHTMARE_JAUNT_COOLDOWN)
- ADD_TRAIT(src, TRAIT_IMMOBILIZED, REF(src))
- ai_controller?.CancelActions()
- animate(src, alpha = 0, time = 0.3 SECONDS)
- new /obj/effect/temp_visual/telegraphing/outpost_shadow_ripple(spot)
- playsound(spot, pick('sound/effects/hallucinations/behind_you1.ogg', 'sound/effects/hallucinations/behind_you2.ogg', 'sound/effects/hallucinations/i_see_you2.ogg'), 35, TRUE)
- addtimer(CALLBACK(src, PROC_REF(finish_jaunt)), OUTPOST_NIGHTMARE_JAUNT_RIPPLE, TIMER_DELETE_ME)
-
-/// Comes out beside the target, if the spot is still dark, and strikes
-/mob/living/basic/outpost_experiment/nightmare/proc/finish_jaunt()
- if(!jaunting)
- return FALSE
- var/turf/spot = jaunt_spot
- var/mob/living/target = jaunt_target_ref?.resolve()
- end_jaunt()
- if(stat == DEAD || !spot || !in_dark(spot) || spot.is_blocked_turf(TRUE))
- return FALSE
- forceMove(spot)
- if(!target || !Adjacent(target) || !can_target(target))
- return TRUE
- face_atom(target)
- do_attack_animation(target, ATTACK_EFFECT_SLASH)
- playsound(target, 'sound/items/weapons/bladeslice.ogg', 60, TRUE)
- target.visible_message(span_danger("[src] lunges out of the dark at [target]!"), span_userdanger("[src] lunges out of the dark at you!"))
- target.apply_damage(OUTPOST_NIGHTMARE_JAUNT_DAMAGE, BRUTE, wound_bonus = CANT_WOUND)
- target.Knockdown(OUTPOST_NIGHTMARE_JAUNT_KNOCKDOWN)
- return TRUE
-
-/// Thrown out of a jaunt (light, a flash): back where it went in
-/mob/living/basic/outpost_experiment/nightmare/proc/cancel_jaunt()
- if(!jaunting)
- return
- end_jaunt()
- visible_message(span_warning("[src] is forced out of the shadows!"))
-
-/mob/living/basic/outpost_experiment/nightmare/proc/end_jaunt()
- jaunting = FALSE
- jaunt_spot = null
- jaunt_target_ref = null
- REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, REF(src))
- animate(src, alpha = 255, time = 0.2 SECONDS)
-
-/// Where the nightmare will come out of the dark
-/obj/effect/temp_visual/telegraphing/outpost_shadow_ripple
- icon = 'icons/mob/telegraphing/telegraph.dmi'
- icon_state = "target_circle"
- color = "#2a0a3a"
- light_range = 0
- duration = OUTPOST_NIGHTMARE_JAUNT_RIPPLE
-
-/// The nightmare's look: tg's light eater in hand
-/datum/outfit/outpost_experiment_nightmare
- name = "Prison experiment nightmare"
- r_hand = /obj/item/light_eater
-
-// ===== AI =====
-
-/// Chases what the creature's own ai_think() picks, breaks what it may out of the way, and fights
-/datum/ai_controller/basic_controller/outpost_experiment
- blackboard = list(
- BB_TARGETING_STRATEGY = /datum/targeting_strategy/outpost_experiment,
- BB_TARGET_MINIMUM_STAT = HARD_CRIT,
- )
- ai_movement = /datum/ai_movement/jps
- idle_behavior = /datum/idle_behavior/idle_random_walk
- planning_subtrees = list(
- /datum/ai_planning_subtree/outpost_experiment_think,
- /datum/ai_planning_subtree/attack_obstacle_in_path/outpost_experiment,
- /datum/ai_planning_subtree/basic_melee_attack_subtree,
- )
-
-/// The fly person moves only in its own darts: no aimless steps, which would also crawl it about while knocked down
-/datum/ai_controller/basic_controller/outpost_experiment/fly
- idle_behavior = null
-
-/// The fly person's darts: straight hops that start at once
-/datum/ai_movement/basic_avoidance/outpost_fly
- move_flags = MOVEMENT_LOOP_START_FAST
-
-/**
- * A fly person's dart to the turf it picked (dart_spot()): done when it gets there, given up after
- * OUTPOST_FLY_DART_TIMEOUT. Planning goes on meanwhile, so a dart away from someone can cut a
- * random one short. A random dart is followed by a short pause.
- */
-/datum/ai_behavior/outpost_fly_dart
- required_distance = 0
- action_cooldown = 0
- behavior_flags = AI_BEHAVIOR_REQUIRE_MOVEMENT | AI_BEHAVIOR_MOVE_AND_PERFORM | AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
-
-/datum/ai_behavior/outpost_fly_dart/setup(datum/ai_controller/controller, turf/destination)
- var/mob/living/basic/outpost_experiment/fly/fly = controller.pawn
- if(!istype(fly) || !isturf(destination) || destination.z != fly.z)
- return FALSE
- fly.dart_until = world.time + OUTPOST_FLY_DART_TIMEOUT
- set_movement_target(controller, destination, /datum/ai_movement/basic_avoidance/outpost_fly)
- return ..()
-
-/datum/ai_behavior/outpost_fly_dart/perform(seconds_per_tick, datum/ai_controller/controller, turf/destination)
- var/mob/living/basic/outpost_experiment/fly/fly = controller.pawn
- if(!istype(fly) || world.time >= fly.dart_until)
- return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED
- if(get_turf(fly) == destination)
- return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED
- return AI_BEHAVIOR_DELAY
-
-/datum/ai_behavior/outpost_fly_dart/finish_action(datum/ai_controller/controller, succeeded, turf/destination)
- // A dart that took over from this one has set its own movement; leave that be.
- var/moving_for_us = controller.movement_target_source == type
- . = ..()
- if(moving_for_us)
- controller.change_ai_movement_type(initial(controller.ai_movement))
- var/mob/living/basic/outpost_experiment/fly/fly = controller.pawn
- if(istype(fly))
- fly.next_dart = world.time + pause_after()
-
-/// How long it hangs in the air after this dart before the next random one
-/datum/ai_behavior/outpost_fly_dart/proc/pause_after()
- return rand(OUTPOST_FLY_DART_GAP_MIN, OUTPOST_FLY_DART_GAP_MAX)
-
-/// Away from someone: no pause after it
-/datum/ai_behavior/outpost_fly_dart/away
-
-/datum/ai_behavior/outpost_fly_dart/away/pause_after()
- return 0
-
-/// The fly person hanging in the air between darts. Planning goes on, so it notices anyone coming at once.
-/datum/ai_behavior/outpost_fly_hover
- action_cooldown = 0
- behavior_flags = AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
-
-/datum/ai_behavior/outpost_fly_hover/perform(seconds_per_tick, datum/ai_controller/controller)
- var/mob/living/basic/outpost_experiment/fly/fly = controller.pawn
- if(!istype(fly) || world.time >= fly.next_dart)
- return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED
- return AI_BEHAVIOR_DELAY
-
-/// The creature decides what it is after
-/datum/ai_planning_subtree/outpost_experiment_think
-
-/datum/ai_planning_subtree/outpost_experiment_think/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/outpost_experiment/creature = controller.pawn
- if(!istype(creature) || creature.subdued)
- return SUBTREE_RETURN_FINISH_PLANNING
- creature.track_reach(controller)
- return creature.ai_think(controller)
-
-/// Only what the creature may break
-/datum/ai_planning_subtree/attack_obstacle_in_path/outpost_experiment
- attack_behaviour = /datum/ai_behavior/attack_obstructions/outpost_experiment
-
-/datum/ai_behavior/attack_obstructions/outpost_experiment
-
-/datum/ai_behavior/attack_obstructions/outpost_experiment/attack_in_direction(datum/ai_controller/controller, mob/living/basic/basic_mob, direction)
- var/mob/living/basic/outpost_experiment/creature = basic_mob
- if(!istype(creature))
- return FALSE
- var/turf/next_step = get_step(basic_mob, direction)
- if(!next_step?.is_blocked_turf(exclude_mobs = TRUE, source_atom = basic_mob))
- return FALSE
- for(var/obj/object in next_step)
- if(!object.density || object.IsObscured() || !creature.can_break(object))
- continue
- return creature.break_obstacle(object)
- if(isclosedturf(next_step) && creature.can_break(next_step))
- return creature.break_obstacle(next_step)
- return FALSE
-
-/// A creature's targets are whatever its can_target() says, in reach on its level
-/datum/targeting_strategy/outpost_experiment
-
-/datum/targeting_strategy/outpost_experiment/can_attack(mob/living/living_mob, atom/target, vision_range)
- var/mob/living/basic/outpost_experiment/creature = living_mob
- if(!istype(creature) || QDELETED(target) || !isturf(creature.loc))
- return FALSE
- var/turf/target_turf = get_turf(target)
- if(!target_turf || target_turf.z != creature.z)
- return FALSE
- if(vision_range && get_dist(creature, target) > vision_range)
- return FALSE
- return creature.can_target(target)
diff --git a/voidcrew/modules/player_outposts/outpost_prison_dialogue.dm b/voidcrew/modules/player_outposts/outpost_prison_dialogue.dm
index 6b4665a7f4b..c4231e4e93b 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_dialogue.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_dialogue.dm
@@ -33,7 +33,7 @@
return islist(entry) ? entry : list()
/// Scales a prisoner's pause between spontaneous lines
-/mob/living/basic/outpost_prisoner/proc/speech_pace()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/speech_pace()
switch(personality)
if("chatty")
return 0.6
@@ -46,7 +46,7 @@
return 1
/// Their sentence left in words, for {time_left}
-/mob/living/basic/outpost_prisoner/proc/time_left_text()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/time_left_text()
var/seconds = max(0, round(sentence_left))
var/minutes = round(seconds / 60 + 0.5)
if(minutes >= 2)
@@ -56,7 +56,7 @@
return "[max(seconds, 1)] seconds"
/// Fills a line's placeholders for this speaker, talking to `other`
-/mob/living/basic/outpost_prisoner/proc/fill_line(line, mob/living/basic/outpost_prisoner/other)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/fill_line(line, mob/living/carbon/human/npc/outpost_prisoner/other)
line = replacetext(line, "{name}", speech_name())
line = replacetext(line, "{other}", other ? other.speech_name() : "pal")
line = replacetext(line, "{crime}", crime)
@@ -70,7 +70,7 @@
* A line for `context`, filled in, or null when the file has none that fits. Personality lines
* come up more often than the shared ones; lines naming {other} need someone to talk to.
*/
-/mob/living/basic/outpost_prisoner/proc/pick_line(context, mob/living/basic/outpost_prisoner/other)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/pick_line(context, mob/living/carbon/human/npc/outpost_prisoner/other)
// The main file first, then the extras' files (outpost_prison_extras.dm)
var/list/by_personality = outpost_prisoner_context_lines(context)
if(!islist(by_personality))
@@ -86,7 +86,7 @@
return fill_line(pick(usable), other)
/// The lines of `pool` they can say now: not the last thing they said, naming nobody when alone, and no extra placeholder they have no value for
-/mob/living/basic/outpost_prisoner/proc/usable_lines(list/pool, mob/living/basic/outpost_prisoner/other)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/usable_lines(list/pool, mob/living/carbon/human/npc/outpost_prisoner/other)
var/list/usable = list()
for(var/line in pool)
if(!istext(line) || line == last_line || (!other && findtext(line, "{other}")))
@@ -97,7 +97,7 @@
return usable
/// Whether `line` names an extra placeholder ({staff}, {place}, ...) that extra_line_values has no value for
-/mob/living/basic/outpost_prisoner/proc/missing_extra_value(line)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/missing_extra_value(line)
for(var/placeholder in GLOB.outpost_prisoner_extra_placeholders)
if(findtext(line, placeholder) && isnull(LAZYACCESS(extra_line_values, placeholder)))
return TRUE
@@ -107,11 +107,11 @@
* Whether they may say anything now: awake and all the way here. Never while beaming in or out,
* when they are invisible or only half there.
*/
-/mob/living/basic/outpost_prisoner/proc/may_speak()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/may_speak()
return !QDELETED(src) && stat == CONSCIOUS && phase == PRISONER_PRESENT
/// Says a line for `context`. Returns TRUE if they said something.
-/mob/living/basic/outpost_prisoner/proc/say_context(context, mob/living/basic/outpost_prisoner/other)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/say_context(context, mob/living/carbon/human/npc/outpost_prisoner/other)
if(!may_speak())
return FALSE
var/line = pick_line(context, other)
@@ -122,7 +122,7 @@
return TRUE
/// Thanks whoever fed, clothed or treated them, no more than every 20 seconds
-/mob/living/basic/outpost_prisoner/proc/thank(context)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/thank(context)
if(phase != PRISONER_PRESENT || !COOLDOWN_FINISHED(src, thanks_cooldown))
return FALSE
if(!say_context(context))
@@ -134,7 +134,7 @@
* Opens a two-person exchange with `partner`, who answers a few seconds later with one of the
* opener's replies. Returns TRUE if it started.
*/
-/mob/living/basic/outpost_prisoner/proc/start_conversation(mob/living/basic/outpost_prisoner/partner)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/start_conversation(mob/living/carbon/human/npc/outpost_prisoner/partner)
if(!may_speak() || QDELETED(partner) || !partner.may_speak())
return FALSE
var/list/conversations = outpost_prisoner_dialogue("conversations")
@@ -153,8 +153,8 @@
return TRUE
/// The second half of a conversation
-/mob/living/basic/outpost_prisoner/proc/reply_in_conversation(line, datum/weakref/opener_ref)
- var/mob/living/basic/outpost_prisoner/opener = opener_ref?.resolve()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/reply_in_conversation(line, datum/weakref/opener_ref)
+ var/mob/living/carbon/human/npc/outpost_prisoner/opener = opener_ref?.resolve()
if(!may_speak() || QDELETED(opener) || get_dist(src, opener) > 5)
return FALSE
face_atom(opener)
@@ -163,15 +163,15 @@
return TRUE
/// Whether a member of staff (see is_outpost_prison_staff()) is in sight, borgs included
-/mob/living/basic/outpost_prisoner/proc/staff_in_view()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/staff_in_view()
for(var/mob/living/person in view(5, src))
if(is_outpost_prison_staff(person))
return TRUE
return FALSE
/// Another prisoner close by, to talk at
-/mob/living/basic/outpost_prisoner/proc/nearby_prisoner()
- for(var/mob/living/basic/outpost_prisoner/other in view(3, src))
+/mob/living/carbon/human/npc/outpost_prisoner/proc/nearby_prisoner()
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/other in view(3, src))
if(other != src && other.stat == CONSCIOUS && other.phase == PRISONER_PRESENT)
return other
return null
@@ -180,18 +180,18 @@
* What to talk about now, as list(context, other), most pressing first: cuffs, trouble, lockdown,
* being locked in, needs, the state of the wing, staff in sight, what they are doing, then small talk.
*/
-/mob/living/basic/outpost_prisoner/proc/pick_speech()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/pick_speech()
if(activity?.sleeping)
return prob(25) ? list("sleeping", null) : null
// Cuffed, they complain about it (outpost_prison_capture.dm).
- if(cuffs && prob(50))
+ if(handcuffed && prob(50))
return list("cuffed", null)
// Trouble has its own lines, said as it happens (outpost_prison_trouble.dm).
if(trouble == PRISONER_TROUBLE_LOOSE)
return prob(50) ? list("breakout", null) : null
if(is_rioting())
return list("riot", null)
- if(trouble || beaten_left > 0 || threat_ref || climb_ref)
+ if(trouble || beaten || threat_ref || climb_ref)
return null
// Running from a creature, they shout about that instead (outpost_prison_panic.dm).
if(is_panicking())
@@ -230,7 +230,7 @@
return extra
if(prob(30) && staff_in_view())
return list("staff_near", null)
- var/mob/living/basic/outpost_prisoner/partner = activity?.chat_partner()
+ var/mob/living/carbon/human/npc/outpost_prisoner/partner = activity?.chat_partner()
if(activity?.context && prob(60))
return list(activity.context, partner)
return list("idle", partner || nearby_prisoner())
@@ -239,7 +239,7 @@
* Called about once a second by the prison. Most seconds they say nothing; once their own and
* the wing's cooldowns are up there is a small chance each second.
*/
-/mob/living/basic/outpost_prisoner/proc/speech_tick()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/speech_tick()
if(stat != CONSCIOUS || phase != PRISONER_PRESENT || !prison)
return FALSE
if(!said_release_soon && sentence_left <= 90)
@@ -290,7 +290,7 @@
return 1
/// A piece of mess on the worst tile of the cell block's floor they can see nearby, or null
-/mob/living/basic/outpost_prisoner/proc/worst_mess_in_view()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/worst_mess_in_view()
var/list/tile_load = list()
var/atom/movable/worst
var/worst_load = 0
@@ -308,7 +308,7 @@
return worst
/// The nearest light in the wing they can see that gives no light, or null
-/mob/living/basic/outpost_prisoner/proc/dead_light_in_view()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/dead_light_in_view()
var/obj/machinery/light/nearest
var/nearest_distance = INFINITY
for(var/obj/machinery/light/fixture in view(PRISONER_POINT_RANGE, src))
@@ -326,7 +326,7 @@
* After a dirty_prison or dark line, with staff in sight, points at what they mean: the worst mess
* or the dead light near them. Returns what they pointed at, or null.
*/
-/mob/living/basic/outpost_prisoner/proc/show_complaint(context)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/show_complaint(context)
if(context != "dirty_prison" && context != "dark")
return null
if(stat != CONSCIOUS || !isturf(loc) || !staff_in_view())
diff --git a/voidcrew/modules/player_outposts/outpost_prison_doors.dm b/voidcrew/modules/player_outposts/outpost_prison_doors.dm
index d9005801156..0e49bf6ef6f 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_doors.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_doors.dm
@@ -101,7 +101,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/door/window/brigdoor/outpost_prison_s
/// Whether `thing` is a loose prisoner: out of the cell block and on the run
/proc/outpost_prisoner_loose(atom/thing)
- var/mob/living/basic/outpost_prisoner/prisoner = thing
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = thing
return istype(prisoner) && prisoner.trouble == PRISONER_TROUBLE_LOOSE
/obj/machinery/door/airlock/security/prison_staff/glass
diff --git a/voidcrew/modules/player_outposts/outpost_prison_economy.dm b/voidcrew/modules/player_outposts/outpost_prison_economy.dm
index 501f1c0c41d..f8ee9c662f0 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_economy.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_economy.dm
@@ -61,7 +61,7 @@
* long enough to stop paying. Not while it is for their own safety, or they are hiding in their own
* cell from a creature (outpost_prison_panic.dm), or for lockdown they owe.
*/
-/datum/outpost_prison/proc/confined_unpaid(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/confined_unpaid(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
return (prisoner.locked_in_seconds > OUTPOST_PRISON_CONFINED_PAY_AFTER && !protective_custody() && !prisoner.sheltering_from_creature()) || prisoner.cuffs_souring()
/**
@@ -69,7 +69,7 @@
* Nothing while they are dead, arriving or leaving, not earning (fighting, rioting, loose and the
* like), or confined to their cell too long.
*/
-/datum/outpost_prison/proc/pay_factor(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/pay_factor(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(QDELETED(prisoner) || prisoner.stat == DEAD || prisoner.phase != PRISONER_PRESENT || !prisoner.earning_pay())
return 0
if(confined_unpaid(prisoner))
@@ -77,7 +77,7 @@
return care_grade(prisoner.care()) * conditions_pay_factor()
/// A prisoner served `served` seconds of their sentence: their stipend for it, and the seconds served and kept for the release bonus
-/datum/outpost_prison/proc/accrue_pay(mob/living/basic/outpost_prisoner/prisoner, served)
+/datum/outpost_prison/proc/accrue_pay(mob/living/carbon/human/npc/outpost_prisoner/prisoner, served)
var/factor = pay_factor(prisoner)
pay_owed += OUTPOST_PRISON_BASE_PAY * bounty_pay_mult(prisoner) * factor * served / 60
prisoner.served_seconds += served
@@ -116,13 +116,13 @@
return 0
/// What a prisoner earns the treasury per minute right now
-/datum/outpost_prison/proc/prisoner_pay_rate(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/prisoner_pay_rate(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
return OUTPOST_PRISON_BASE_PAY * bounty_pay_mult(prisoner) * pay_factor(prisoner)
/// What every prisoner earns the treasury per minute right now
/datum/outpost_prison/proc/pay_rate()
var/total = 0
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
total += prisoner_pay_rate(prisoner)
return total
@@ -201,8 +201,8 @@
/datum/outpost_prison/proc/incident_ongoing()
if(riot_active)
return TRUE
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
- if(prisoner.phase == PRISONER_PRESENT && prisoner.stat != DEAD && (prisoner.is_rioting() || (prisoner.trouble == PRISONER_TROUBLE_LOOSE && !prisoner.cuffs)))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
+ if(prisoner.phase == PRISONER_PRESENT && prisoner.stat != DEAD && (prisoner.is_rioting() || (prisoner.trouble == PRISONER_TROUBLE_LOOSE && !prisoner.handcuffed)))
return TRUE
return FALSE
@@ -213,7 +213,7 @@
* OUTPOST_PRISON_LOST_TO_SUSPEND lost within OUTPOST_PRISON_LOST_WINDOW, the corrections service
* suspends transfers until a manager reopens intake.
*/
-/datum/outpost_prison/proc/note_prisoner_lost(mob/living/basic/outpost_prisoner/prisoner, reason)
+/datum/outpost_prison/proc/note_prisoner_lost(mob/living/carbon/human/npc/outpost_prisoner/prisoner, reason)
lost_log += world.time
var/lost = lost_recently()
log_game("PLAYER OUTPOST PRISON: '[outpost?.name]' lost [prisoner?.real_name || "a prisoner"] ([reason || "lost"]), [lost] lost recently")
@@ -401,7 +401,7 @@
if(!spot)
continue
// An ordinary arrival may be a caught bounty criminal from the pool; the admin panel's never is (outpost_prison_bounty.dm).
- var/mob/living/basic/outpost_prisoner/prisoner = new(spot, forced ? null : bounty_pool_take(src))
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = new(spot, forced ? null : bounty_pool_take(src))
admit(prisoner, cell)
prisoner.beam_in()
start_arrival_gap(lane || soonest_lane())
@@ -410,7 +410,7 @@
return null
/// Books a prisoner into a cell (the first free one when none is given), in the mood the yard puts newcomers in
-/datum/outpost_prison/proc/admit(mob/living/basic/outpost_prisoner/prisoner, datum/outpost_prison_cell/into)
+/datum/outpost_prison/proc/admit(mob/living/carbon/human/npc/outpost_prisoner/prisoner, datum/outpost_prison_cell/into)
if(!into)
for(var/datum/outpost_prison_cell/cell as anything in cells)
if(!cell.occupant)
@@ -435,7 +435,7 @@
* After a tick of a prisoner's sentence: released once it has run out, and sent back to their
* cell in its last OUTPOST_PRISON_RELEASE_WALK seconds.
*/
-/datum/outpost_prison/proc/check_release(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/check_release(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(prisoner.sentence_left <= 0)
release(prisoner)
else if(prisoner.sentence_left <= OUTPOST_PRISON_RELEASE_WALK && !istype(prisoner.activity, /datum/prisoner_activity/go_home) && !prisoner.in_trouble())
@@ -443,7 +443,7 @@
prisoner.end_activity()
/// Sentence served: pays the release bonus and beams the prisoner out of wherever they stand
-/datum/outpost_prison/proc/release(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/release(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(prisoner.phase != PRISONER_PRESENT || prisoner.stat == DEAD)
return 0
var/average = prisoner.served_seconds ? prisoner.kept_seconds / prisoner.served_seconds : 0
@@ -461,7 +461,7 @@
* A prisoner died. Nobody comes for the body (body_tick()): it keeps its cell until staff carry it
* out of the cell block. A death blamed on staff costs no fine, but the yard takes it hard (blame_death()).
*/
-/datum/outpost_prison/proc/on_prisoner_death(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/on_prisoner_death(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
add_log("[prisoner.real_name] died.")
close_bounty_record(prisoner, BOUNTY_RECORD_DEAD)
prisoner.died_at = world.time
@@ -478,7 +478,7 @@
* it leaves the roster, and its cell waits a refill. An experiment under way that still needs it,
* a specimen host about to burst, keeps it on the roster wherever it is.
*/
-/datum/outpost_prison/proc/body_tick(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/body_tick(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(in_cell_block(prisoner) || held_for_experiment(prisoner))
return
add_log("[prisoner.real_name]'s body is out of the cell block.")
@@ -487,7 +487,7 @@
/// Prisoners' bodies lying in the cell block, which nobody comes for
/datum/outpost_prison/proc/bodies_in_cell_block()
. = 0
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.stat == DEAD && prisoner.phase == PRISONER_PRESENT && in_cell_block(prisoner))
.++
@@ -512,7 +512,7 @@
*/
/datum/outpost_prison/proc/on_outpost_abandoned()
var/out_of_hand = 0
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.phase == PRISONER_PRESENT && prisoner.stat != DEAD && (prisoner.is_rioting() || prisoner.trouble == PRISONER_TROUBLE_LOOSE))
out_of_hand++
if(out_of_hand)
@@ -524,7 +524,7 @@
lost_log.Cut()
pay_owed = 0
var/transferred = 0
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners.Copy())
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners.Copy())
if(QDELETED(prisoner) || prisoner.phase == PRISONER_LEAVING)
continue
close_bounty_record(prisoner, BOUNTY_RECORD_CLOSED)
diff --git a/voidcrew/modules/player_outposts/outpost_prison_experiment_forms.dm b/voidcrew/modules/player_outposts/outpost_prison_experiment_forms.dm
new file mode 100644
index 00000000000..102eb718f16
--- /dev/null
+++ b/voidcrew/modules/player_outposts/outpost_prison_experiment_forms.dm
@@ -0,0 +1,1256 @@
+/**
+ * # What the serum makes of a prisoner
+ *
+ * The serum (outpost_prison_experiments.dm) works on the subject's own body, with tg's own biology
+ * (human NPC migration, phase E2; owner defaults EX-1 to EX-15):
+ * - The hulk: tg's hulk gene (it shrugs off stuns and shoves, punches walls down and people about, and
+ * loses it when the body drops into crit) and tg's gigantism for its size. It charges with a roar and a
+ * line on the floor, staggers when it hits a wall, forces doors, smashes furniture in its way and knocks
+ * standing prisoners flat. Beaten into crit it is an ordinary person again, and batons and cuffs work.
+ * - The fly person: tg's fly species (a flyswatter does thirty times the damage, and it throws up what it
+ * eats). It darts about the wing, away from anyone close and from whoever just hit it, hits back only
+ * when cornered, and goes for any food it sees. Its sidestep is a Slipwire implant (owner ruling OC-6),
+ * which burns out with it like any NPC's chrome.
+ * - The nightmare: tg's nightmare species and organs (it heals and slips shots in the dark, burns in the
+ * light, a flash sears it, its light eater breaks lights and puts out torches). It spends its first
+ * half minute breaking the lights, then hunts prisoners, sinking into the dark and coming out beside one
+ * after a warning ripple.
+ *
+ * The body stays a body: wounds, blood, crit, cuffs, stamina, sedatives, death and revival are tg's. Its
+ * toughness is physiology (npc_damage_taken), never health, and never scaled by who is about. Its hits on
+ * people go through armour and wound like anyone's (EX-7). Kessler's team collects it only once it is down
+ * (outpost_experiment_down_state()), and pays by the state it finds it in.
+ *
+ * The form is a component on the prisoner's own body (human NPC phase E1): the serum turns the inmate, who
+ * leaves the prison's roster (transform_subject(), outpost_prisoner/proc/stand_down_for_experiment()) but
+ * keeps their name, face, wounds and blood.
+ */
+
+/// Trait source for what the form puts on a body
+#define OUTPOST_EXPERIMENT_FORM_TRAIT "outpost_experiment_form"
+/// Blackboard key of the food a fly person is going for
+#define BB_OUTPOST_FLY_MEAL "BB_outpost_fly_meal"
+
+// ===== TURNING =====
+
+/// The form component for a serum form, or null
+/proc/outpost_experiment_form_type(form)
+ switch(form)
+ if("hulk")
+ return /datum/component/outpost_experiment_form/hulk
+ if("fly")
+ return /datum/component/outpost_experiment_form/fly
+ if("nightmare")
+ return /datum/component/outpost_experiment_form/nightmare
+ return null
+
+/// What a creature is: a serum form ("hulk", "fly", "nightmare"), the changeling's "horror" or "headslug", or null
+/proc/outpost_experiment_form_name(mob/living/creature)
+ if(!isliving(creature))
+ return null
+ var/datum/component/outpost_experiment_form/form = creature.GetComponent(/datum/component/outpost_experiment_form)
+ if(form)
+ return form.form
+ if(istype(creature, /mob/living/basic/outpost_experiment/horror))
+ return "horror"
+ if(istype(creature, /mob/living/basic/headslug))
+ return "headslug"
+ return null
+
+/// Whether `creature` is an experiment's creature: a body the serum took, or the changeling's horror
+/proc/is_outpost_experiment_creature(mob/living/creature)
+ if(!isliving(creature))
+ return FALSE
+ return istype(creature, /mob/living/basic/outpost_experiment) || !!creature.GetComponent(/datum/component/outpost_experiment_form)
+
+/**
+ * Turns `body` into serum `form` for `prison` where it stands. Returns the form, or null if it didn't take.
+ * `personality` is the prisoner's, for its lines.
+ */
+/proc/outpost_experiment_turn(mob/living/carbon/human/body, form, datum/outpost_prison/prison, personality)
+ var/form_type = outpost_experiment_form_type(form)
+ if(!form_type || !ishuman(body) || QDELETED(body) || body.stat == DEAD)
+ return null
+ // One form to a body.
+ if(body.GetComponent(/datum/component/outpost_experiment_form))
+ return null
+ var/datum/component/outpost_experiment_form/turned = body.AddComponent(form_type, prison, personality)
+ if(!istype(turned))
+ return null
+ turned.change_body()
+ return turned
+
+// ===== THE FORM =====
+
+/**
+ * A serum form on a body: its biology, its mind (an AI) and its side, what it says and does now and then,
+ * and how it chooses whom to go for. See the file header.
+ */
+/datum/component/outpost_experiment_form
+ dupe_mode = COMPONENT_DUPE_UNIQUE
+ /// "hulk", "fly" or "nightmare"
+ var/form
+ /// What the log calls it: "a hulk"
+ var/form_name = "a creature"
+ /// Brute and burn damage it takes as a multiple of a person's (physiology, npc_damage_taken)
+ var/damage_taken = 1
+ /// The AI it thinks with
+ var/controller_type = /datum/ai_controller/basic_controller/human_npc/outpost_experiment
+ /// Dialogue context it says now and then, and seconds to the next line
+ var/line_context
+ var/line_left = 10
+ /// A tell on examine: something anyone watching it would notice
+ var/win_hint
+ /// What everyone sees when it goes down alive, after its name
+ var/down_message = "collapses, spent."
+ /// Emotes it gives now and then lying there alive, waiting for Kessler
+ var/list/down_emotes = list("twitches.", "groans.", "stirs weakly.")
+ /// The prison it came from
+ var/datum/outpost_prison/prison
+ /// The prisoner's personality, for its lines
+ var/personality
+ /// The body has changed (change_body())
+ var/changed = FALSE
+ /// The target it is chasing now, the closest it has got to it, where it last stood, and when it last got
+ /// anywhere: to notice it is stuck (track_reach())
+ var/datum/weakref/chase_target_ref
+ var/chase_best_distance = 0
+ var/turf/chase_last_turf
+ var/chase_progress_time = 0
+ /// Targets it has given up on reaching -> world.time it may try them again
+ var/list/unreachable_until
+
+/datum/component/outpost_experiment_form/Initialize(datum/outpost_prison/owner, personality)
+ if(!ishuman(parent))
+ return COMPONENT_INCOMPATIBLE
+ prison = owner
+ src.personality = personality
+
+/datum/component/outpost_experiment_form/RegisterWithParent()
+ var/mob/living/carbon/human/body = parent
+ body.add_traits(list(TRAIT_OUTPOST_EXPERIMENT, TRAIT_NO_CONTAINMENT, TRAIT_NO_STORAGE_INSERT), OUTPOST_EXPERIMENT_FORM_TRAIT)
+ RegisterSignal(body, COMSIG_MOVABLE_TELEPORTING, PROC_REF(refuse_teleport))
+ RegisterSignal(body, COMSIG_LIVING_PRE_WABBAJACKED, PROC_REF(refuse_polymorph))
+ RegisterSignal(body, COMSIG_PRE_MOB_CHANGED_TYPE, PROC_REF(refuse_type_change))
+ RegisterSignal(body, COMSIG_LIVING_LIFE, PROC_REF(on_life))
+ RegisterSignal(body, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine))
+
+/datum/component/outpost_experiment_form/UnregisterFromParent()
+ var/mob/living/carbon/human/body = parent
+ body.remove_traits(list(TRAIT_OUTPOST_EXPERIMENT, TRAIT_NO_CONTAINMENT, TRAIT_NO_STORAGE_INSERT), OUTPOST_EXPERIMENT_FORM_TRAIT)
+ UnregisterSignal(body, list(COMSIG_MOVABLE_TELEPORTING, COMSIG_LIVING_PRE_WABBAJACKED, COMSIG_PRE_MOB_CHANGED_TYPE, COMSIG_LIVING_LIFE, COMSIG_ATOM_EXAMINE))
+
+/datum/component/outpost_experiment_form/Destroy(force)
+ prison = null
+ chase_target_ref = null
+ chase_last_turf = null
+ unreachable_until = null
+ return ..()
+
+/**
+ * The change: the tells come off, the body takes the form's biology (change_biology()), its side, its
+ * toughness and its AI, and everyone in sight sees it happen. Once.
+ */
+/datum/component/outpost_experiment_form/proc/change_body()
+ if(changed)
+ return
+ changed = TRUE
+ var/mob/living/carbon/human/body = parent
+ outpost_experiment_clear_tells(body)
+ var/old_name = body.real_name
+ change_biology(body)
+ // A species can rename the body (nightmares do); it is still the prisoner.
+ if(body.real_name != old_name)
+ body.fully_replace_character_name(body.real_name, old_name)
+ body.faction = list(FACTION_OUTPOST_EXPERIMENT)
+ if(ishumannpc(body))
+ var/mob/living/carbon/human/npc/npc = body
+ npc.set_npc_toughness(damage_taken)
+ QDEL_NULL(body.ai_controller)
+ var/datum/ai_controller/brain = new controller_type(body)
+ setup_controller(brain)
+ announce_change(body)
+
+/// What the form does to the body's biology. Each form's own.
+/datum/component/outpost_experiment_form/proc/change_biology(mob/living/carbon/human/body)
+ return
+
+/// Readies a new AI for the form: its abilities' blackboard keys
+/datum/component/outpost_experiment_form/proc/setup_controller(datum/ai_controller/brain)
+ return
+
+/// What everyone in sight sees as the serum takes
+/datum/component/outpost_experiment_form/proc/announce_change(mob/living/carbon/human/body)
+ return
+
+/datum/component/outpost_experiment_form/proc/refuse_teleport(datum/source, atom/destination, channel)
+ SIGNAL_HANDLER
+ var/mob/living/body = parent
+ if(isturf(body.loc))
+ body.visible_message(span_notice("[body] flickers for a moment, but stays where [body.p_they()] [body.p_are()]."))
+ return TRUE
+
+/datum/component/outpost_experiment_form/proc/refuse_polymorph(datum/source, what_to_randomize)
+ SIGNAL_HANDLER
+ var/mob/living/body = parent
+ body.visible_message(span_notice("[body] shimmers for a moment, then looks the same as before."))
+ return STOP_WABBAJACK
+
+/datum/component/outpost_experiment_form/proc/refuse_type_change(datum/source)
+ SIGNAL_HANDLER
+ return COMPONENT_BLOCK_MOB_CHANGE
+
+/datum/component/outpost_experiment_form/proc/on_examine(datum/source, mob/user, list/examine_list)
+ SIGNAL_HANDLER
+ var/mob/living/body = parent
+ if(HAS_TRAIT_FROM(body, TRAIT_IMMOBILIZED, OUTPOST_KESSLER_TRAIT))
+ examine_list += span_notice("Kessler Biolabs is taking [body.p_them()] away.")
+ else if(prison?.experiment_awaiting_pickup(body))
+ examine_list += span_notice("[body.p_They()] [body.p_are()] down. Kessler Biolabs will collect [body.p_them()] shortly.")
+ else if(win_hint && body.stat == CONSCIOUS)
+ examine_list += span_notice(win_hint)
+
+/// Whether its AI runs: only while someone is on the level, like everything else in the wing
+/datum/component/outpost_experiment_form/proc/awake()
+ var/mob/living/body = parent
+ return body.ai_controller?.ai_status == AI_STATUS_ON
+
+/// Each Life() tick while someone is about: its own doings and a line now and then while it is up, a twitch while it lies waiting for Kessler
+/datum/component/outpost_experiment_form/proc/on_life(mob/living/carbon/human/body, seconds_per_tick, times_fired)
+ SIGNAL_HANDLER
+ if(body.stat == DEAD || HAS_TRAIT_FROM(body, TRAIT_IMMOBILIZED, OUTPOST_KESSLER_TRAIT))
+ return
+ if(prison?.experiment_awaiting_pickup(body))
+ if(prob(60))
+ down_twitch(body)
+ return
+ if(body.stat != CONSCIOUS || !awake())
+ return
+ form_life(body, seconds_per_tick)
+ if(!line_context)
+ return
+ line_left -= seconds_per_tick
+ if(line_left > 0)
+ return
+ line_left = rand(15, 25)
+ var/line = outpost_experiment_line(line_context, personality)
+ if(line)
+ INVOKE_ASYNC(body, TYPE_PROC_REF(/atom/movable, say), line)
+
+/// Each Life() tick while it is up: what it does besides fighting
+/datum/component/outpost_experiment_form/proc/form_life(mob/living/carbon/human/body, seconds_per_tick)
+ return
+
+/// Lying there alive, waiting for Kessler
+/datum/component/outpost_experiment_form/proc/down_twitch(mob/living/carbon/human/body)
+ body.Shake(1, 0, 0.4 SECONDS)
+ if(prob(30))
+ INVOKE_ASYNC(body, TYPE_PROC_REF(/atom, manual_emote), pick(down_emotes))
+
+/// Makes the hand it fights with the active one, before a blow at `target`
+/datum/component/outpost_experiment_form/proc/ready_to_hit(atom/target)
+ return human_npc_ready_empty_hand(parent)
+
+// ----- whom it goes for -----
+
+/// Whether it goes after `target`. By default only its victims (is_victim()); the fly adds food, the nightmare lights.
+/datum/component/outpost_experiment_form/proc/can_target(atom/target)
+ return is_victim(target)
+
+/// People, borgs and prisoners, never its own kind or Kessler's staff
+/datum/component/outpost_experiment_form/proc/is_victim(atom/target)
+ var/mob/living/victim = target
+ if(!istype(victim) || victim == parent || victim.stat == DEAD)
+ return FALSE
+ if(is_outpost_experiment_mob(victim) || HAS_TRAIT(victim, TRAIT_GODMODE))
+ return FALSE
+ if(is_outpost_prisoner(victim))
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = victim
+ if(prisoner.phase != PRISONER_PRESENT || !may_hit_prisoner(prisoner))
+ return FALSE
+ return !blocked_by_cell(prisoner)
+ return ishuman(victim) || issilicon(victim) || !isnull(victim.mind)
+
+/// Whether it hits this prisoner
+/datum/component/outpost_experiment_form/proc/may_hit_prisoner(mob/living/prisoner)
+ return TRUE
+
+/// How much less it wants a target than its distance says; prisoners and people may count differently
+/datum/component/outpost_experiment_form/proc/target_penalty(mob/living/target)
+ return 0
+
+/**
+ * Its target now: whoever hurt it lately, else the nearest it wants in sight. While nobody from the
+ * wing is home it fights back but hunts nobody, so a loose creature is never a trap left for visitors.
+ */
+/datum/component/outpost_experiment_form/proc/choose_target()
+ var/mob/living/body = parent
+ var/datum/component/experiment_damage_ledger/ledger = body.GetComponent(/datum/component/experiment_damage_ledger)
+ var/mob/living/attacker = ledger?.recent_player()
+ if(attacker && can_target(attacker) && get_dist(body, attacker) <= 9 && can_see(body, attacker, 9) && !target_unreachable(attacker))
+ return attacker
+ if(prison && !prison.crew_home())
+ return null
+ var/mob/living/best
+ var/best_score = INFINITY
+ for(var/mob/living/candidate in range(7, body))
+ if(!can_target(candidate) || !can_see(body, candidate, 7) || target_unreachable(candidate))
+ continue
+ var/score = get_dist(body, candidate) + target_penalty(candidate)
+ if(score < best_score)
+ best = candidate
+ best_score = score
+ return best
+
+/**
+ * Its AI's first thought each plan: picks the target and may queue something of its own. Returns
+ * SUBTREE_RETURN_FINISH_PLANNING when that is all it does this plan.
+ */
+/datum/component/outpost_experiment_form/proc/ai_think(datum/ai_controller/controller)
+ var/atom/target = choose_target()
+ if(target)
+ controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, target)
+ else
+ controller.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET)
+ return null
+
+// ----- reach -----
+
+/// Whether nothing shut stops it: the hulk goes through walls and doors, so a bolted cell never keeps it out
+/datum/component/outpost_experiment_form/proc/smashes_through()
+ return FALSE
+
+/// Whether it is between moves by design (mid-jaunt), and should not be judged on progress
+/datum/component/outpost_experiment_form/proc/chasing_paused()
+ return FALSE
+
+/// Whether a bolted cell keeps `prisoner` away from it: shut and locked, and it is not inside with them
+/datum/component/outpost_experiment_form/proc/blocked_by_cell(mob/living/prisoner)
+ if(smashes_through())
+ return FALSE
+ var/datum/outpost_prison_cell/holding = prison?.cell_at(get_turf(prisoner))
+ return holding && holding.is_bolted() && !holding.contains(parent)
+
+/**
+ * Notes whether it is getting anywhere with `controller`'s current target: closer, beside it, or at least
+ * on the move. OUTPOST_EXPERIMENT_STUCK_TIME standing still and apart writes the target off as unreachable
+ * for OUTPOST_EXPERIMENT_UNREACHABLE_TIME. Distance and Adjacent() only: no pathfinding call.
+ */
+/datum/component/outpost_experiment_form/proc/track_reach(datum/ai_controller/controller)
+ if(smashes_through() || chasing_paused())
+ return
+ var/mob/living/body = parent
+ var/atom/movable/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
+ if(QDELETED(target))
+ chase_target_ref = null
+ return
+ if(chase_target_ref?.resolve() != target)
+ chase_target_ref = WEAKREF(target)
+ chase_best_distance = get_dist(body, target)
+ chase_last_turf = body.loc
+ chase_progress_time = world.time
+ return
+ if(body.Adjacent(target) || body.loc != chase_last_turf)
+ chase_last_turf = body.loc
+ chase_progress_time = world.time
+ return
+ var/distance = get_dist(body, target)
+ if(distance < chase_best_distance)
+ chase_best_distance = distance
+ chase_progress_time = world.time
+ return
+ if(world.time - chase_progress_time < OUTPOST_EXPERIMENT_STUCK_TIME)
+ return
+ mark_unreachable(target)
+ chase_target_ref = null
+
+/// Whether it gave up on reaching `target` recently
+/datum/component/outpost_experiment_form/proc/target_unreachable(atom/target)
+ if(!length(unreachable_until))
+ return FALSE
+ var/datum/weakref/ref = WEAKREF(target)
+ var/until = unreachable_until[ref]
+ if(!until)
+ return FALSE
+ if(until > world.time)
+ return TRUE
+ unreachable_until -= ref
+ return FALSE
+
+/// Writes `target` off for OUTPOST_EXPERIMENT_UNREACHABLE_TIME
+/datum/component/outpost_experiment_form/proc/mark_unreachable(atom/target)
+ LAZYSET(unreachable_until, WEAKREF(target), world.time + OUTPOST_EXPERIMENT_UNREACHABLE_TIME)
+ for(var/datum/weakref/ref as anything in unreachable_until.Copy())
+ if(unreachable_until[ref] <= world.time)
+ unreachable_until -= ref
+ while(length(unreachable_until) > OUTPOST_EXPERIMENT_UNREACHABLE_MAX)
+ unreachable_until.Cut(1, 2)
+
+// ----- breaking things -----
+
+/// Whether it may break `thing` out of its way. Only the hulk does.
+/datum/component/outpost_experiment_form/proc/can_break(atom/thing)
+ return FALSE
+
+/// Breaks `thing` out of its way. Returns TRUE if it set about it.
+/datum/component/outpost_experiment_form/proc/break_obstacle(atom/thing, datum/ai_controller/controller)
+ return FALSE
+
+// ===== HULK =====
+
+/datum/component/outpost_experiment_form/hulk
+ form = "hulk"
+ form_name = "a hulk"
+ damage_taken = OUTPOST_HULK_DAMAGE_TAKEN
+ line_context = "hulk"
+ /// Its charge
+ var/datum/action/cooldown/mob_cooldown/charge/basic_charge/outpost_hulk/charge
+
+/datum/component/outpost_experiment_form/hulk/Destroy(force)
+ QDEL_NULL(charge)
+ return ..()
+
+/datum/component/outpost_experiment_form/hulk/UnregisterFromParent()
+ UnregisterSignal(parent, list(COMSIG_LIVING_EARLY_UNARMED_ATTACK, SIGNAL_REMOVETRAIT(TRAIT_HULK)))
+ return ..()
+
+/datum/component/outpost_experiment_form/hulk/change_biology(mob/living/carbon/human/body)
+ // tg's hulk gene takes only on a human body: the serum makes one of whatever it finds.
+ if(body.dna.species.id != SPECIES_HUMAN)
+ body.set_species(/datum/species/human)
+ // Before the gene: handlers of one signal run in the order they were registered, and on_punch() must
+ // see the target's health before the gene's own handler lands the blow.
+ RegisterSignal(body, COMSIG_LIVING_EARLY_UNARMED_ATTACK, PROC_REF(on_punch))
+ body.dna.add_mutation(/datum/mutation/hulk, MUTATION_SOURCE_MUTATOR)
+ body.dna.add_mutation(/datum/mutation/gigantism, MUTATION_SOURCE_MUTATOR)
+ charge = new(body)
+ charge.Grant(body)
+ RegisterSignal(body, SIGNAL_REMOVETRAIT(TRAIT_HULK), PROC_REF(on_hulk_lost))
+
+/datum/component/outpost_experiment_form/hulk/setup_controller(datum/ai_controller/brain)
+ brain.set_blackboard_key(BB_TARGETED_ACTION, charge)
+
+/datum/component/outpost_experiment_form/hulk/announce_change(mob/living/carbon/human/body)
+ playsound(body, 'sound/mobs/non-humanoids/gorilla/gorilla.ogg', 80, TRUE)
+ body.visible_message(span_danger("[body] swells until [body.p_their()] jumpsuit strains at the seams, and roars!"))
+
+/// Players first, then prisoners still on their feet
+/datum/component/outpost_experiment_form/hulk/target_penalty(mob/living/target)
+ return is_outpost_prisoner(target) ? 3 : 0
+
+/// Only prisoners still standing: it knocks them flat and leaves them
+/datum/component/outpost_experiment_form/hulk/may_hit_prisoner(mob/living/prisoner)
+ return prisoner.stat == CONSCIOUS && prisoner.body_position == STANDING_UP
+
+/// While it is a hulk it goes through walls and forces doors, so a bolted cell never stops it
+/datum/component/outpost_experiment_form/hulk/smashes_through()
+ return HAS_TRAIT(parent, TRAIT_HULK)
+
+/datum/component/outpost_experiment_form/hulk/ai_think(datum/ai_controller/controller)
+ . = ..()
+ var/mob/living/body = parent
+ var/mob/living/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
+ if(!HAS_TRAIT(body, TRAIT_HULK) || !isliving(target) || !charge?.IsAvailable())
+ return
+ var/distance = get_dist(body, target)
+ if(distance < 2 || distance > OUTPOST_HULK_CHARGE_RANGE || !can_see(body, target, OUTPOST_HULK_CHARGE_RANGE))
+ return
+ controller.queue_behavior(/datum/ai_behavior/targeted_mob_ability, BB_TARGETED_ACTION, BB_BASIC_MOB_CURRENT_TARGET)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/// A hulk punch is tg's (the gene answers this signal too); what it did to the target shows a tick later
+/datum/component/outpost_experiment_form/hulk/proc/on_punch(mob/living/carbon/human/source, atom/target, proximity, list/modifiers)
+ SIGNAL_HANDLER
+ if(!source.combat_mode || !proximity || !isliving(target) || target == source || !HAS_TRAIT(source, TRAIT_HULK))
+ return NONE
+ var/mob/living/victim = target
+ addtimer(CALLBACK(src, PROC_REF(after_punch), WEAKREF(victim), victim.health), 0, TIMER_DELETE_ME)
+ return NONE
+
+/// A blow that landed: a standing prisoner goes down, and anyone else may go flying
+/datum/component/outpost_experiment_form/hulk/proc/after_punch(datum/weakref/victim_ref, health_before)
+ var/mob/living/carbon/human/body = parent
+ var/mob/living/victim = victim_ref?.resolve()
+ if(QDELETED(victim) || QDELETED(body) || victim.stat == DEAD || victim.health >= health_before)
+ return
+ if(is_outpost_prisoner(victim))
+ if(victim.body_position != STANDING_UP)
+ return
+ victim.visible_message(span_danger("[body] knocks [victim] flat!"))
+ playsound(victim, 'sound/items/weapons/punch1.ogg', 60, TRUE)
+ victim.Knockdown(OUTPOST_HULK_KNOCKDOWN)
+ return
+ if(!prob(OUTPOST_HULK_THROW_CHANCE) || victim.anchored || victim.buckled || victim.move_resist >= MOVE_FORCE_OVERPOWERING)
+ return
+ victim.visible_message(span_danger("[body] sends [victim] flying!"))
+ victim.throw_at(get_ranged_target_turf(victim, get_dir(body, victim), OUTPOST_HULK_THROW_RANGE), OUTPOST_HULK_THROW_RANGE, 1, body)
+
+/// Down into crit, the gene let go of it (tg's hulk): it is an ordinary person again
+/datum/component/outpost_experiment_form/hulk/proc/on_hulk_lost(mob/living/carbon/human/source)
+ SIGNAL_HANDLER
+ if(source.stat == DEAD)
+ return
+ source.visible_message(span_warning("[source] staggers, heaving for breath. [source.p_They()] look[source.p_s()] spent."))
+
+/// Charged into a wall with nobody caught: stunned a moment, the way any charger is
+/datum/component/outpost_experiment_form/hulk/proc/stagger_on_wall()
+ var/mob/living/body = parent
+ body.Stun(OUTPOST_HULK_WALL_STUN, ignore_canstun = TRUE)
+
+/// Interior walls, windows, grilles, tables, chairs and doors, never the hatch counters or anything protected
+/datum/component/outpost_experiment_form/hulk/can_break(atom/thing)
+ if(!HAS_TRAIT(parent, TRAIT_HULK) || QDELETED(thing) || !outpost_experiment_can_smash(thing, prison))
+ return FALSE
+ if(isturf(thing))
+ return iswallturf(thing) && !istype(thing, /turf/closed/wall/r_wall) && !isindestructiblewall(thing)
+ var/obj/object = thing
+ if(!istype(object) || (object.resistance_flags & INDESTRUCTIBLE) || HAS_TRAIT(object, TRAIT_OUTPOST_PROPERTY))
+ return FALSE
+ if(istype(object, /obj/structure/table/reinforced/prison_hatch))
+ return FALSE
+ return istype(object, /obj/structure/window) || istype(object, /obj/structure/grille) || istype(object, /obj/structure/table) \
+ || istype(object, /obj/structure/chair) || istype(object, /obj/machinery/door)
+
+/datum/component/outpost_experiment_form/hulk/break_obstacle(atom/thing, datum/ai_controller/controller)
+ if(!can_break(thing))
+ return FALSE
+ if(istype(thing, /obj/machinery/door/airlock))
+ INVOKE_ASYNC(src, PROC_REF(force_door), thing)
+ return TRUE
+ if(isturf(thing))
+ // tg's hulk smash: a few blows bring an interior wall down, and hurt the arm doing it.
+ if(!human_npc_ready_empty_hand(parent))
+ return FALSE
+ controller.ai_interact(target = thing, combat_mode = TRUE)
+ return TRUE
+ smash(thing)
+ return TRUE
+
+/// Batters a door until it gives: bolts sheared, weld broken, forced open
+/datum/component/outpost_experiment_form/hulk/proc/force_door(obj/machinery/door/airlock/door)
+ var/mob/living/body = parent
+ if(DOING_INTERACTION_WITH_TARGET(body, door) || !door.density)
+ return FALSE
+ body.visible_message(span_danger("[body] batters at [door]!"))
+ playsound(door, 'sound/effects/bang.ogg', 70, TRUE)
+ door.Shake(2, 2, 0.5 SECONDS)
+ if(!do_after(body, OUTPOST_HULK_DOOR_TIME, target = door) || QDELETED(door) || !can_break(door))
+ return FALSE
+ if(door.locked)
+ door.unbolt()
+ if(door.welded)
+ door.welded = FALSE
+ door.update_appearance()
+ door.visible_message(span_danger("[body] forces [door] open!"))
+ playsound(door, 'sound/machines/airlock/airlock_alien_prying.ogg', 80, TRUE)
+ INVOKE_ASYNC(door, TYPE_PROC_REF(/obj/machinery/door, open), BYPASS_DOOR_CHECKS)
+ prison?.refresh_reach()
+ return TRUE
+
+/// Puts something through: windows shatter, tables fold, chairs splinter, window doors break
+/datum/component/outpost_experiment_form/hulk/proc/smash(obj/thing)
+ if(QDELETED(thing))
+ return FALSE
+ var/mob/living/body = parent
+ body.do_attack_animation(thing, ATTACK_EFFECT_SMASH)
+ body.visible_message(span_danger("[body] smashes [thing]!"))
+ playsound(thing, istype(thing, /obj/structure/window) ? 'sound/effects/glass/glassbr1.ogg' : 'sound/effects/woodhit.ogg', 70, TRUE)
+ thing.take_damage(thing.get_integrity(), BRUTE, MELEE, FALSE, get_dir(thing, body))
+ return TRUE
+
+/// The hulk's charge: a roar, a stamp and a line on the floor, then six tiles of it
+/datum/action/cooldown/mob_cooldown/charge/basic_charge/outpost_hulk
+ name = "Charge"
+ desc = "Put your head down and run through whatever is in the way."
+ cooldown_time = OUTPOST_HULK_CHARGE_COOLDOWN
+ charge_delay = OUTPOST_HULK_CHARGE_WINDUP
+ charge_distance = OUTPOST_HULK_CHARGE_RANGE
+ charge_past = 1
+ charge_damage = OUTPOST_HULK_CHARGE_DAMAGE
+ destroy_objects = FALSE
+ shake_duration = OUTPOST_HULK_CHARGE_WINDUP
+ recoil_duration = OUTPOST_HULK_WALL_STUN
+ knockdown_duration = OUTPOST_HULK_CHARGE_KNOCKDOWN
+
+/datum/action/cooldown/mob_cooldown/charge/basic_charge/outpost_hulk/do_charge_indicator(atom/charger, atom/charge_target)
+ . = ..()
+ playsound(charger, 'sound/mobs/non-humanoids/gorilla/gorilla.ogg', 80, TRUE)
+ charger.visible_message(span_danger("[charger] roars and stamps, lowering [charger.p_their()] head!"))
+ var/direction = get_dir(charger, charge_target)
+ var/turf/step_turf = get_turf(charger)
+ for(var/i in 1 to charge_distance)
+ step_turf = get_step(step_turf, direction)
+ if(!step_turf || isclosedturf(step_turf))
+ break
+ new /obj/effect/temp_visual/telegraphing/outpost_hulk_charge(step_turf)
+
+/// The hulk's form, if `charger` is a hulk
+/datum/action/cooldown/mob_cooldown/charge/basic_charge/outpost_hulk/proc/hulk_form(atom/movable/charger)
+ return charger.GetComponent(/datum/component/outpost_experiment_form/hulk)
+
+/datum/action/cooldown/mob_cooldown/charge/basic_charge/outpost_hulk/on_bump(atom/movable/source, atom/target)
+ var/datum/component/outpost_experiment_form/hulk/hulk = hulk_form(source)
+ if(hulk && isobj(target) && target.density && !istype(target, /obj/machinery/door/airlock) && hulk.can_break(target))
+ INVOKE_ASYNC(hulk, TYPE_PROC_REF(/datum/component/outpost_experiment_form/hulk, smash), target)
+ return
+ return ..()
+
+/datum/action/cooldown/mob_cooldown/charge/basic_charge/outpost_hulk/on_moved(atom/source)
+ . = ..()
+ var/datum/component/outpost_experiment_form/hulk/hulk = hulk_form(source)
+ if(!hulk)
+ return
+ for(var/obj/structure/chair/chair in get_turf(source))
+ if(hulk.can_break(chair))
+ INVOKE_ASYNC(hulk, TYPE_PROC_REF(/datum/component/outpost_experiment_form/hulk, smash), chair)
+
+/datum/action/cooldown/mob_cooldown/charge/basic_charge/outpost_hulk/hit_target(atom/movable/source, atom/target, damage_dealt)
+ var/datum/component/outpost_experiment_form/hulk/hulk = hulk_form(source)
+ if(isliving(target))
+ var/mob/living/victim = target
+ // A prisoner is bowled over; anyone else takes the full charge, through their armour (EX-7).
+ if(!is_outpost_prisoner(victim))
+ outpost_experiment_ability_hit(victim, damage_dealt, attacker = source)
+ playsound(get_turf(victim), 'sound/effects/meteorimpact.ogg', 80, TRUE)
+ return ..()
+ source.visible_message(span_danger("[source] slams into [target] and reels!"))
+ playsound(get_turf(source), 'sound/effects/bang.ogg', 80, TRUE)
+ hulk?.stagger_on_wall()
+
+/// The floor in the charge's path, for the length of the wind-up
+/obj/effect/temp_visual/telegraphing/outpost_hulk_charge
+ duration = OUTPOST_HULK_CHARGE_WINDUP
+ color = "#9ae05a"
+
+// ===== FLY PERSON =====
+
+/datum/component/outpost_experiment_form/fly
+ form = "fly"
+ form_name = "a fly person"
+ damage_taken = OUTPOST_FLY_DAMAGE_TAKEN
+ line_context = "fly"
+ controller_type = /datum/ai_controller/basic_controller/human_npc/outpost_experiment/fly
+ win_hint = "It never stays still for long."
+ down_message = "drops to the floor, stunned."
+ down_emotes = list("buzzes weakly.", "twitches.", "trembles.")
+ /// world.time of its next random dart, and by when the dart under way must be over
+ var/next_dart = 0
+ var/dart_until = 0
+ /// Whoever hit it last, whom it keeps away from until flit_until
+ var/datum/weakref/flit_from_ref
+ var/flit_until = 0
+ /// REF() of prisoners who watched it throw up -> world.time they may be put off again
+ var/list/disgusted
+
+/datum/component/outpost_experiment_form/fly/down_twitch(mob/living/carbon/human/body)
+ . = ..()
+ playsound(body, 'sound/mobs/non-humanoids/bee/bee.ogg', 15, TRUE)
+
+/datum/component/outpost_experiment_form/fly/Destroy(force)
+ flit_from_ref = null
+ disgusted = null
+ return ..()
+
+/datum/component/outpost_experiment_form/fly/UnregisterFromParent()
+ UnregisterSignal(parent, list(COMSIG_ATOM_WAS_ATTACKED, COMSIG_CARBON_VOMITED))
+ return ..()
+
+/datum/component/outpost_experiment_form/fly/change_biology(mob/living/carbon/human/body)
+ body.set_species(/datum/species/fly)
+ // Its quickness is real chrome (owner ruling OC-6), which an EMP scrambles and death burns out.
+ if(ishumannpc(body))
+ var/mob/living/carbon/human/npc/npc = body
+ npc.npc_install_cyberware(/obj/item/organ/cyberimp/cyberware/slipwire)
+ RegisterSignal(body, COMSIG_ATOM_WAS_ATTACKED, PROC_REF(on_attacked))
+ RegisterSignal(body, COMSIG_CARBON_VOMITED, PROC_REF(on_vomited))
+
+/datum/component/outpost_experiment_form/fly/announce_change(mob/living/carbon/human/body)
+ playsound(body, 'sound/mobs/non-humanoids/bee/bee_swarm.ogg', 60, TRUE)
+ body.visible_message(span_danger("[body] folds up, splits open and unfolds into something with bulging eyes and a proboscis!"))
+
+/// On its feet and free to move: not down, held, cuffed, pulled, buckled or being taken away
+/datum/component/outpost_experiment_form/fly/proc/free_to_dart()
+ var/mob/living/body = parent
+ if(body.stat != CONSCIOUS || !isturf(body.loc) || body.pulledby || body.buckled || body.body_position != STANDING_UP)
+ return FALSE
+ return !HAS_TRAIT(body, TRAIT_IMMOBILIZED) && !HAS_TRAIT(body, TRAIT_INCAPACITATED) && !HAS_TRAIT(body, TRAIT_RESTRAINED)
+
+/// Hit while it is free to move: it flits away from whoever did it, and keeps away from them for a few seconds
+/datum/component/outpost_experiment_form/fly/proc/on_attacked(datum/source, atom/attacker, attack_flags)
+ SIGNAL_HANDLER
+ if(!attacker || attacker == parent || !free_to_dart())
+ return
+ flit_from_ref = WEAKREF(attacker)
+ flit_until = world.time + OUTPOST_FLY_FLIT_TIME
+ // Once the blow is over, not in the middle of it.
+ addtimer(CALLBACK(src, PROC_REF(flit)), 1, TIMER_UNIQUE | TIMER_OVERRIDE | TIMER_DELETE_ME)
+
+/// Whoever hit it within OUTPOST_FLY_FLIT_TIME, if still near enough to keep away from
+/datum/component/outpost_experiment_form/fly/proc/flit_threat()
+ if(world.time > flit_until)
+ return null
+ var/mob/living/body = parent
+ var/atom/movable/attacker = flit_from_ref?.resolve()
+ if(QDELETED(attacker) || attacker.z != body.z || get_dist(body, attacker) > OUTPOST_FLY_DART_MAX + OUTPOST_FLY_FLEE_RANGE)
+ return null
+ return attacker
+
+/// Darts away from whoever just hit it, at once rather than at its next thought. Returns TRUE if it went.
+/datum/component/outpost_experiment_form/fly/proc/flit()
+ var/mob/living/body = parent
+ var/atom/attacker = flit_threat()
+ if(!attacker || !free_to_dart() || !body.ai_controller || !awake())
+ return FALSE
+ var/turf/spot = dart_spot(attacker)
+ if(!spot)
+ return FALSE
+ body.ai_controller.CancelActions()
+ body.ai_controller.queue_behavior(/datum/ai_behavior/outpost_fly_dart/away, spot)
+ return TRUE
+
+/// It goes for food and hits only when cornered: its "targets" are meals, and people it cannot get away from
+/datum/component/outpost_experiment_form/fly/can_target(atom/target)
+ if(istype(target, /obj/item/food))
+ return isturf(target.loc)
+ return ..()
+
+/// Whoever is closest within OUTPOST_FLY_FLEE_RANGE, to keep away from
+/datum/component/outpost_experiment_form/fly/proc/nearest_threat()
+ var/mob/living/body = parent
+ var/mob/living/nearest
+ var/nearest_distance = INFINITY
+ for(var/mob/living/person in range(OUTPOST_FLY_FLEE_RANGE, body))
+ if(person == body || !is_victim(person))
+ continue
+ var/distance = get_dist(body, person)
+ if(distance < nearest_distance)
+ nearest = person
+ nearest_distance = distance
+ return nearest
+
+/**
+ * Somewhere to dart to: an open tile OUTPOST_FLY_DART_MIN to OUTPOST_FLY_DART_MAX tiles off, in a clear
+ * line, on ground it keeps to (may_dart_to()). Away from `threat`, only somewhere farther from it than it
+ * is now, and out of its OUTPOST_FLY_FLEE_RANGE if it can. Null if there is nowhere: cornered.
+ */
+/datum/component/outpost_experiment_form/fly/proc/dart_spot(atom/threat)
+ var/turf/here = get_turf(parent)
+ if(!here)
+ return null
+ var/threat_distance = threat ? get_dist(here, threat) : 0
+ var/list/spots = list()
+ var/list/clear_spots = list()
+ for(var/turf/open/tile in RANGE_TURFS(OUTPOST_FLY_DART_MAX, here))
+ if(get_dist(here, tile) < OUTPOST_FLY_DART_MIN)
+ continue
+ var/from_threat = threat ? get_dist(tile, threat) : INFINITY
+ if(from_threat <= threat_distance || !may_dart_to(tile) || !clear_line(here, tile))
+ continue
+ spots += tile
+ if(from_threat > OUTPOST_FLY_FLEE_RANGE)
+ clear_spots += tile
+ if(length(clear_spots))
+ return pick(clear_spots)
+ return length(spots) ? pick(spots) : null
+
+/**
+ * Whether it keeps to `tile`: free and safe, and in the wing (its cell block, while it is in there).
+ * Got out of the wing, it darts about the room it is in.
+ */
+/datum/component/outpost_experiment_form/fly/proc/may_dart_to(turf/tile)
+ var/mob/living/body = parent
+ if(isspaceturf(tile) || isopenspaceturf(tile) || tile.is_blocked_turf(FALSE, body) || !tile.can_cross_safely(body))
+ return FALSE
+ var/turf/here = get_turf(body)
+ if(prison?.wing && here.loc == prison.wing)
+ return tile.loc == prison.wing && (!prison.in_cell_block(here) || prison.in_cell_block(tile))
+ return tile.loc == here.loc
+
+/// Whether it can go straight from `start` to `finish`: nothing solid or opaque in the way
+/datum/component/outpost_experiment_form/fly/proc/clear_line(turf/start, turf/finish)
+ for(var/turf/step as anything in get_line(start, finish))
+ if(step == start)
+ continue
+ if(step.opacity || step.is_blocked_turf(TRUE, parent))
+ return FALSE
+ return TRUE
+
+/**
+ * Keeps moving: darts away from anyone close or who just hit it, and hits only when cornered with
+ * someone at it. Otherwise it goes for food in sight, or darts about at random with short pauses. It
+ * hovers (outpost_fly_hover) rather than planning nothing, so it notices people at once.
+ */
+/datum/component/outpost_experiment_form/fly/ai_think(datum/ai_controller/controller)
+ var/mob/living/body = parent
+ if(!free_to_dart())
+ controller.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET)
+ return null
+ var/atom/threat = flit_threat() || nearest_threat()
+ if(threat)
+ var/turf/away = dart_spot(threat)
+ if(away)
+ controller.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET)
+ controller.queue_behavior(/datum/ai_behavior/outpost_fly_dart/away, away)
+ return SUBTREE_RETURN_FINISH_PLANNING
+ // Nowhere farther to go: it hits whoever is at it.
+ var/mob/living/at_it = threat
+ if(istype(at_it) && body.Adjacent(at_it) && can_target(at_it))
+ controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, at_it)
+ return null
+ controller.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET)
+ controller.queue_behavior(/datum/ai_behavior/outpost_fly_hover)
+ return SUBTREE_RETURN_FINISH_PLANNING
+ controller.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET)
+ var/obj/item/food/meal = held_meal() || find_meal()
+ if(meal)
+ controller.set_blackboard_key(BB_OUTPOST_FLY_MEAL, meal)
+ controller.queue_behavior(/datum/ai_behavior/outpost_fly_eat, BB_OUTPOST_FLY_MEAL)
+ return SUBTREE_RETURN_FINISH_PLANNING
+ var/turf/spot = world.time >= next_dart ? dart_spot() : null
+ if(spot)
+ controller.queue_behavior(/datum/ai_behavior/outpost_fly_dart, spot)
+ return SUBTREE_RETURN_FINISH_PLANNING
+ if(world.time >= next_dart)
+ next_dart = world.time + rand(OUTPOST_FLY_DART_GAP_MIN, OUTPOST_FLY_DART_GAP_MAX)
+ controller.queue_behavior(/datum/ai_behavior/outpost_fly_hover)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/// Food it has in hand already
+/datum/component/outpost_experiment_form/fly/proc/held_meal()
+ var/mob/living/carbon/human/body = parent
+ for(var/obj/item/food/meal in body.held_items)
+ return meal
+ return null
+
+/// The nearest food in sight: a serving hatch, a table or the floor
+/datum/component/outpost_experiment_form/fly/proc/find_meal()
+ var/mob/living/body = parent
+ var/obj/item/food/best
+ var/best_distance = INFINITY
+ for(var/obj/item/food/meal in range(5, body))
+ if(!isturf(meal.loc) || !can_see(body, meal, 5) || target_unreachable(meal))
+ continue
+ var/distance = get_dist(body, meal)
+ if(distance < best_distance)
+ best = meal
+ best_distance = distance
+ return best
+
+/**
+ * tg's fly stomach throws up what it eats (and the fly is a messy eater). Whoever it gets it on hears
+ * about it, and prisoners who see it lose a little mood, each at most once in a while.
+ */
+/datum/component/outpost_experiment_form/fly/proc/on_vomited(mob/living/carbon/source, distance, force)
+ SIGNAL_HANDLER
+ var/turf/ahead = get_step(source, source.dir)
+ var/mob/living/unlucky = ahead ? locate(/mob/living) in ahead : null
+ if(unlucky && unlucky != source)
+ source.visible_message(span_danger("[source] throws up all over [unlucky]!"))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/watcher in viewers(5, source))
+ if(watcher.stat != CONSCIOUS || LAZYACCESS(disgusted, REF(watcher)) > world.time)
+ continue
+ LAZYSET(disgusted, REF(watcher), world.time + OUTPOST_EXPERIMENT_FLY_DISGUST_GAP)
+ watcher.adjust_mood(-OUTPOST_EXPERIMENT_FLY_DISGUST_MOOD)
+
+// ===== NIGHTMARE =====
+
+/datum/component/outpost_experiment_form/nightmare
+ form = "nightmare"
+ form_name = "a nightmare"
+ damage_taken = OUTPOST_NIGHTMARE_DAMAGE_TAKEN
+ /// Seconds left of breaking the lights before it hunts
+ var/opening_left = OUTPOST_NIGHTMARE_OPENING_MIN
+ /// Mid jaunt: gone into the dark, about to come out beside someone
+ var/jaunting = FALSE
+ /// Where it will come out, and at whom
+ var/turf/jaunt_spot
+ var/datum/weakref/jaunt_target_ref
+ COOLDOWN_DECLARE(jaunt_cooldown)
+
+/datum/component/outpost_experiment_form/nightmare/Destroy(force)
+ jaunt_spot = null
+ jaunt_target_ref = null
+ return ..()
+
+/datum/component/outpost_experiment_form/nightmare/UnregisterFromParent()
+ if(jaunting)
+ end_jaunt()
+ UnregisterSignal(parent, COMSIG_MOB_FLASH_OVERRIDE_CHECK)
+ return ..()
+
+/datum/component/outpost_experiment_form/nightmare/change_biology(mob/living/carbon/human/body)
+ // tg's nightmare: its brain heals it and slips shots in the dark, its heart grows the light eater, and
+ // its shadow flesh burns in the light. It can wear nothing but a hat, so the jumpsuit falls off.
+ body.set_species(/datum/species/shadow/nightmare)
+ opening_left = rand(OUTPOST_NIGHTMARE_OPENING_MIN, OUTPOST_NIGHTMARE_OPENING_MAX)
+ RegisterSignal(body, COMSIG_MOB_FLASH_OVERRIDE_CHECK, PROC_REF(on_flashed))
+
+/datum/component/outpost_experiment_form/nightmare/announce_change(mob/living/carbon/human/body)
+ playsound(body, 'sound/effects/hallucinations/wail.ogg', 60, TRUE)
+ body.visible_message(span_danger("The light seems to drain out of [body], and something else stands where [body.p_they()] stood."))
+
+/// Whether `tile` (where it stands, by default) is dark
+/datum/component/outpost_experiment_form/nightmare/proc/in_dark(turf/tile = get_turf(parent))
+ return tile && tile.get_lumcount() < SHADOW_SPECIES_LIGHT_THRESHOLD
+
+/// The opening runs down; in the light a jaunt is cut short, and now and then it is seen to suffer
+/datum/component/outpost_experiment_form/nightmare/form_life(mob/living/carbon/human/body, seconds_per_tick)
+ if(opening_left > 0)
+ opening_left -= seconds_per_tick
+ if(in_dark())
+ return
+ if(jaunting)
+ cancel_jaunt()
+ if(prob(20))
+ body.visible_message(span_warning("[body] smokes and shrinks from the light."))
+
+/// Whether it is still breaking the lights: for its first half minute, until it is hurt, or until there are none
+/datum/component/outpost_experiment_form/nightmare/proc/in_opening()
+ if(opening_left <= 0)
+ return FALSE
+ var/mob/living/body = parent
+ var/datum/component/experiment_damage_ledger/ledger = body.GetComponent(/datum/component/experiment_damage_ledger)
+ if(ledger && (ledger.player_damage + ledger.other_damage + ledger.pending) > 0)
+ opening_left = 0
+ return FALSE
+ return TRUE
+
+/// Prisoners first, standing or down; it finishes what it starts
+/datum/component/outpost_experiment_form/nightmare/target_penalty(mob/living/target)
+ return is_outpost_prisoner(target) ? -3 : 0
+
+/datum/component/outpost_experiment_form/nightmare/chasing_paused()
+ return jaunting
+
+/// Lights, during the opening
+/datum/component/outpost_experiment_form/nightmare/can_target(atom/target)
+ if(istype(target, /obj/machinery/light))
+ var/obj/machinery/light/fixture = target
+ return fixture.status != LIGHT_BROKEN && fixture.status != LIGHT_EMPTY
+ return ..()
+
+/// It fights with tg's light eater, which breaks lights and puts out torches as it cuts
+/datum/component/outpost_experiment_form/nightmare/ready_to_hit(atom/target)
+ var/mob/living/carbon/human/body = parent
+ for(var/obj/item/light_eater/blade in body.held_items)
+ return human_npc_ready_item(body, blade)
+ return ..()
+
+/// The nearest working light in sight
+/datum/component/outpost_experiment_form/nightmare/proc/find_light()
+ var/mob/living/body = parent
+ var/obj/machinery/light/best
+ var/best_distance = INFINITY
+ for(var/obj/machinery/light/fixture in range(9, body))
+ if(!can_target(fixture) || !can_see(body, fixture, 9) || target_unreachable(fixture))
+ continue
+ var/distance = get_dist(body, fixture)
+ if(distance < best_distance)
+ best = fixture
+ best_distance = distance
+ return best
+
+/datum/component/outpost_experiment_form/nightmare/ai_think(datum/ai_controller/controller)
+ if(jaunting)
+ controller.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET)
+ return SUBTREE_RETURN_FINISH_PLANNING
+ if(in_opening())
+ var/obj/machinery/light/fixture = find_light()
+ if(fixture)
+ controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, fixture)
+ return null
+ opening_left = 0
+ . = ..()
+ var/mob/living/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET]
+ if(!isliving(target) || get_dist(parent, target) <= 1)
+ return
+ var/turf/spot = jaunt_spot_near(target)
+ if(!spot)
+ return
+ start_jaunt(target, spot)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+/// A flash sears it (tg's shadow flesh) and throws it out of a jaunt
+/datum/component/outpost_experiment_form/nightmare/proc/on_flashed(datum/source, mob/living/carbon/flashed, flash, deviation)
+ SIGNAL_HANDLER
+ if(jaunting)
+ cancel_jaunt()
+ return NONE
+
+/// A dark tile beside `target` it could come out on, if the jaunt is ready and it stands in the dark
+/datum/component/outpost_experiment_form/nightmare/proc/jaunt_spot_near(mob/living/target)
+ if(jaunting || !COOLDOWN_FINISHED(src, jaunt_cooldown) || !in_dark())
+ return null
+ var/list/spots = list()
+ for(var/turf/open/tile in orange(1, target))
+ if(tile.is_blocked_turf(TRUE) || !in_dark(tile) || !prison?.outpost_holds(tile))
+ continue
+ spots += tile
+ return length(spots) ? pick(spots) : null
+
+/// Sinks into the dark; a ripple and a whisper warn where it will come out, OUTPOST_NIGHTMARE_JAUNT_RIPPLE later
+/datum/component/outpost_experiment_form/nightmare/proc/start_jaunt(mob/living/target, turf/spot)
+ var/mob/living/body = parent
+ jaunting = TRUE
+ jaunt_spot = spot
+ jaunt_target_ref = WEAKREF(target)
+ COOLDOWN_START(src, jaunt_cooldown, OUTPOST_NIGHTMARE_JAUNT_COOLDOWN)
+ ADD_TRAIT(body, TRAIT_IMMOBILIZED, OUTPOST_EXPERIMENT_FORM_TRAIT)
+ body.ai_controller?.CancelActions()
+ animate(body, alpha = 0, time = 0.3 SECONDS)
+ new /obj/effect/temp_visual/telegraphing/outpost_shadow_ripple(spot)
+ playsound(spot, pick('sound/effects/hallucinations/behind_you1.ogg', 'sound/effects/hallucinations/behind_you2.ogg', 'sound/effects/hallucinations/i_see_you2.ogg'), 35, TRUE)
+ addtimer(CALLBACK(src, PROC_REF(finish_jaunt)), OUTPOST_NIGHTMARE_JAUNT_RIPPLE, TIMER_DELETE_ME)
+
+/// Comes out beside the target, if the spot is still dark, and lunges: a blade through the armour on them (EX-7)
+/datum/component/outpost_experiment_form/nightmare/proc/finish_jaunt()
+ if(!jaunting)
+ return FALSE
+ var/mob/living/body = parent
+ var/turf/spot = jaunt_spot
+ var/mob/living/target = jaunt_target_ref?.resolve()
+ end_jaunt()
+ if(body.stat != CONSCIOUS || !spot || !in_dark(spot) || spot.is_blocked_turf(TRUE))
+ return FALSE
+ body.forceMove(spot)
+ if(!target || !body.Adjacent(target) || !can_target(target))
+ return TRUE
+ body.face_atom(target)
+ body.do_attack_animation(target, ATTACK_EFFECT_SLASH)
+ playsound(target, 'sound/items/weapons/bladeslice.ogg', 60, TRUE)
+ target.visible_message(span_danger("[body] lunges out of the dark at [target]!"), span_userdanger("[body] lunges out of the dark at you!"))
+ outpost_experiment_ability_hit(target, OUTPOST_NIGHTMARE_JAUNT_DAMAGE, SHARP_EDGED, OUTPOST_NIGHTMARE_ARMOUR_PENETRATION, attacker = body)
+ target.Knockdown(OUTPOST_NIGHTMARE_JAUNT_KNOCKDOWN)
+ return TRUE
+
+/// Thrown out of a jaunt (light, a flash): back where it went in
+/datum/component/outpost_experiment_form/nightmare/proc/cancel_jaunt()
+ if(!jaunting)
+ return
+ end_jaunt()
+ var/mob/living/body = parent
+ body.visible_message(span_warning("[body] is forced out of the shadows!"))
+
+/datum/component/outpost_experiment_form/nightmare/proc/end_jaunt()
+ var/mob/living/body = parent
+ jaunting = FALSE
+ jaunt_spot = null
+ jaunt_target_ref = null
+ REMOVE_TRAIT(body, TRAIT_IMMOBILIZED, OUTPOST_EXPERIMENT_FORM_TRAIT)
+ animate(body, alpha = 255, time = 0.2 SECONDS)
+
+/// Where the nightmare will come out of the dark
+/obj/effect/temp_visual/telegraphing/outpost_shadow_ripple
+ icon = 'icons/mob/telegraphing/telegraph.dmi'
+ icon_state = "target_circle"
+ color = "#2a0a3a"
+ light_range = 0
+ duration = OUTPOST_NIGHTMARE_JAUNT_RIPPLE
+
+// ===== AI =====
+
+/**
+ * A creature's mind: tg's human NPC controller (soft crit, working at cuffs and grabs), then what its form
+ * wants (ai_think()), breaking what it may out of its way, and real blows with its hands or its blade.
+ */
+/datum/ai_controller/basic_controller/human_npc/outpost_experiment
+ blackboard = list(
+ BB_TARGETING_STRATEGY = /datum/targeting_strategy/outpost_experiment_form,
+ BB_TARGET_MINIMUM_STAT = HARD_CRIT,
+ )
+ ai_movement = /datum/ai_movement/jps
+ idle_behavior = /datum/idle_behavior/idle_random_walk
+ planning_subtrees = list(
+ /datum/ai_planning_subtree/human_npc_soft_crit,
+ /datum/ai_planning_subtree/escape_captivity,
+ /datum/ai_planning_subtree/outpost_experiment_form_think,
+ /datum/ai_planning_subtree/attack_obstacle_in_path/outpost_experiment_form,
+ /datum/ai_planning_subtree/outpost_experiment_form_melee,
+ )
+
+/// The fly person moves only in its own darts: no aimless steps
+/datum/ai_controller/basic_controller/human_npc/outpost_experiment/fly
+ idle_behavior = null
+
+/// The creature's form decides what it is after
+/datum/ai_planning_subtree/outpost_experiment_form_think
+
+/datum/ai_planning_subtree/outpost_experiment_form_think/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ var/mob/living/body = controller.pawn
+ var/datum/component/outpost_experiment_form/form = body.GetComponent(/datum/component/outpost_experiment_form)
+ if(!form || body.stat != CONSCIOUS)
+ return
+ form.track_reach(controller)
+ return form.ai_think(controller)
+
+/// Only what the form may break
+/datum/ai_planning_subtree/attack_obstacle_in_path/outpost_experiment_form
+ attack_behaviour = /datum/ai_behavior/attack_obstructions/outpost_experiment_form
+
+/datum/ai_behavior/attack_obstructions/outpost_experiment_form
+
+/datum/ai_behavior/attack_obstructions/outpost_experiment_form/attack_in_direction(datum/ai_controller/controller, mob/living/basic/basic_mob, direction)
+ var/mob/living/body = controller.pawn
+ var/datum/component/outpost_experiment_form/form = body.GetComponent(/datum/component/outpost_experiment_form)
+ if(!form)
+ return FALSE
+ var/turf/next_step = get_step(body, direction)
+ if(!next_step?.is_blocked_turf(exclude_mobs = TRUE, source_atom = body))
+ return FALSE
+ for(var/obj/object in next_step)
+ if(!object.density || object.IsObscured() || !form.can_break(object))
+ continue
+ return form.break_obstacle(object, controller)
+ if(isclosedturf(next_step) && form.can_break(next_step))
+ return form.break_obstacle(next_step, controller)
+ return FALSE
+
+/// With a target: walks up and hits it, with the hand or blade the form fights with
+/datum/ai_planning_subtree/outpost_experiment_form_melee
+
+/datum/ai_planning_subtree/outpost_experiment_form_melee/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
+ if(!controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET))
+ return
+ controller.queue_behavior(/datum/ai_behavior/basic_melee_attack/outpost_experiment_form, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETING_STRATEGY, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION)
+ return SUBTREE_RETURN_FINISH_PLANNING
+
+// tg's basic melee attack already clicks the target through ai_interact(); this readies the hand or blade first.
+/datum/ai_behavior/basic_melee_attack/outpost_experiment_form
+
+/datum/ai_behavior/basic_melee_attack/outpost_experiment_form/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key)
+ var/mob/living/carbon/body = controller.pawn
+ var/datum/component/outpost_experiment_form/form = body.GetComponent(/datum/component/outpost_experiment_form)
+ form?.ready_to_hit(controller.blackboard[target_key])
+ body.zone_selected = human_npc_pick_aim_zone()
+ return ..()
+
+/// A creature's targets are whatever its form's can_target() says, in reach on its level
+/datum/targeting_strategy/outpost_experiment_form
+
+/datum/targeting_strategy/outpost_experiment_form/can_attack(mob/living/living_mob, atom/target, vision_range)
+ var/datum/component/outpost_experiment_form/form = living_mob.GetComponent(/datum/component/outpost_experiment_form)
+ if(!form || QDELETED(target) || !isturf(living_mob.loc))
+ return FALSE
+ var/turf/target_turf = get_turf(target)
+ if(!target_turf || target_turf.z != living_mob.z)
+ return FALSE
+ if(vision_range && get_dist(living_mob, target) > vision_range)
+ return FALSE
+ return form.can_target(target)
+
+/// The fly person's darts: straight runs that start at once
+/datum/ai_movement/basic_avoidance/outpost_fly
+ move_flags = MOVEMENT_LOOP_START_FAST
+
+/**
+ * A fly person's dart to the turf it picked (dart_spot()): done when it gets there, given up after
+ * OUTPOST_FLY_DART_TIMEOUT. Planning goes on meanwhile, so a dart away from someone can cut a random one
+ * short. A random dart is followed by a short pause.
+ */
+/datum/ai_behavior/outpost_fly_dart
+ required_distance = 0
+ action_cooldown = 0
+ behavior_flags = AI_BEHAVIOR_REQUIRE_MOVEMENT | AI_BEHAVIOR_MOVE_AND_PERFORM | AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
+
+/datum/ai_behavior/outpost_fly_dart/setup(datum/ai_controller/controller, turf/destination)
+ var/mob/living/body = controller.pawn
+ var/datum/component/outpost_experiment_form/fly/fly = body.GetComponent(/datum/component/outpost_experiment_form/fly)
+ if(!fly || !isturf(destination) || destination.z != body.z)
+ return FALSE
+ fly.dart_until = world.time + OUTPOST_FLY_DART_TIMEOUT
+ set_movement_target(controller, destination, /datum/ai_movement/basic_avoidance/outpost_fly)
+ return ..()
+
+/datum/ai_behavior/outpost_fly_dart/perform(seconds_per_tick, datum/ai_controller/controller, turf/destination)
+ var/mob/living/body = controller.pawn
+ var/datum/component/outpost_experiment_form/fly/fly = body.GetComponent(/datum/component/outpost_experiment_form/fly)
+ if(!fly || world.time >= fly.dart_until)
+ return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED
+ if(get_turf(body) == destination)
+ return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED
+ return AI_BEHAVIOR_DELAY
+
+/datum/ai_behavior/outpost_fly_dart/finish_action(datum/ai_controller/controller, succeeded, turf/destination)
+ // A dart that took over from this one has set its own movement; leave that be.
+ var/moving_for_us = controller.movement_target_source == type
+ . = ..()
+ if(moving_for_us)
+ controller.change_ai_movement_type(initial(controller.ai_movement))
+ var/mob/living/body = controller.pawn
+ var/datum/component/outpost_experiment_form/fly/fly = body?.GetComponent(/datum/component/outpost_experiment_form/fly)
+ if(fly)
+ fly.next_dart = world.time + pause_after()
+
+/// How long it waits after this dart before the next random one
+/datum/ai_behavior/outpost_fly_dart/proc/pause_after()
+ return rand(OUTPOST_FLY_DART_GAP_MIN, OUTPOST_FLY_DART_GAP_MAX)
+
+/// Away from someone: no pause after it
+/datum/ai_behavior/outpost_fly_dart/away
+
+/datum/ai_behavior/outpost_fly_dart/away/pause_after()
+ return 0
+
+/// The fly person waiting between darts. Planning goes on, so it notices anyone coming at once.
+/datum/ai_behavior/outpost_fly_hover
+ action_cooldown = 0
+ behavior_flags = AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
+
+/datum/ai_behavior/outpost_fly_hover/perform(seconds_per_tick, datum/ai_controller/controller)
+ var/mob/living/body = controller.pawn
+ var/datum/component/outpost_experiment_form/fly/fly = body.GetComponent(/datum/component/outpost_experiment_form/fly)
+ if(!fly || world.time >= fly.next_dart)
+ return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED
+ return AI_BEHAVIOR_DELAY
+
+/**
+ * The fly person eats: walks to the food, picks it up and eats it the way anyone does (tg's edible, with
+ * its do_after per bite); its fly stomach does the rest. Planning goes on, so a threat cuts it short.
+ */
+/datum/ai_behavior/outpost_fly_eat
+ action_cooldown = 1 SECONDS
+ required_distance = 1
+ behavior_flags = AI_BEHAVIOR_REQUIRE_MOVEMENT | AI_BEHAVIOR_MOVE_AND_PERFORM | AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION
+
+/datum/ai_behavior/outpost_fly_eat/setup(datum/ai_controller/controller, meal_key)
+ var/obj/item/food/meal = controller.blackboard[meal_key]
+ if(QDELETED(meal))
+ return FALSE
+ set_movement_target(controller, meal)
+ return ..()
+
+/datum/ai_behavior/outpost_fly_eat/perform(seconds_per_tick, datum/ai_controller/controller, meal_key)
+ var/mob/living/carbon/human/body = controller.pawn
+ var/obj/item/food/meal = controller.blackboard[meal_key]
+ if(QDELETED(meal))
+ return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED
+ if(LAZYLEN(body.do_afters))
+ return AI_BEHAVIOR_DELAY
+ if(body.is_holding(meal))
+ if(!human_npc_ready_item(body, meal))
+ return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED
+ // A bite: the food used on itself, out of combat mode, as a player eats.
+ controller.ai_interact(target = body, combat_mode = FALSE)
+ return AI_BEHAVIOR_DELAY
+ if(!isturf(meal.loc))
+ return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED
+ if(!body.Adjacent(meal))
+ return AI_BEHAVIOR_DELAY
+ if(!human_npc_ready_empty_hand(body))
+ return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED
+ controller.ai_interact(target = meal, combat_mode = FALSE)
+ return AI_BEHAVIOR_DELAY
+
+/datum/ai_behavior/outpost_fly_eat/finish_action(datum/ai_controller/controller, succeeded, meal_key)
+ var/obj/item/food/meal = controller.blackboard[meal_key]
+ . = ..()
+ controller.clear_blackboard_key(meal_key)
+ if(succeeded || QDELETED(meal))
+ return
+ // Couldn't get at it: written off a while, like a target it can't reach.
+ var/mob/living/body = controller.pawn
+ var/datum/component/outpost_experiment_form/fly/fly = body?.GetComponent(/datum/component/outpost_experiment_form/fly)
+ fly?.mark_unreachable(meal)
+
+#undef OUTPOST_EXPERIMENT_FORM_TRAIT
+#undef BB_OUTPOST_FLY_MEAL
diff --git a/voidcrew/modules/player_outposts/outpost_prison_experiments.dm b/voidcrew/modules/player_outposts/outpost_prison_experiments.dm
index 2d06959b6db..94892810561 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_experiments.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_experiments.dm
@@ -10,12 +10,17 @@
* - The serum, the specimen jar and the food it taints (outpost_prison_serum.dm) only work in a
* member's hands, on this wing's prisoners, for 10 minutes, and never leave the level.
* - A serum subject twitches for a minute, with the form's tells in the last 40 seconds, then
- * turns into a hulk, a fly person or a nightmare (outpost_prison_creatures.dm). A specimen host
- * goes to the changeling event (outpost_changeling_infect(), outpost_prison_changeling.dm).
- * - The wing is paid a fee when a creature shows (experiment_creature_appeared()) and a bonus when
- * it is put down (experiment_creature_down()) if the crew did half its damage or more
- * (/datum/component/experiment_damage_ledger). Each is paid once per experiment. Put down, it
- * lies there, "awaiting pickup" on the console, until Kessler's team beams in for it (kessler_collect()).
+ * their own body becomes a hulk, a fly person or a nightmare by tg's own genes and species
+ * (outpost_prison_experiment_forms.dm). A specimen host goes to the changeling event
+ * (outpost_changeling_infect(), outpost_prison_changeling.dm).
+ * - The wing is paid a fee when a creature shows (experiment_creature_appeared()). A creature that goes
+ * down (dead, or in crit, stamcrit, asleep or cuffed: outpost_experiment_down_state()) lies there,
+ * "awaiting pickup" on the console, until Kessler's team beams in for it (kessler_collect()), keeps it
+ * down with a real tranquilliser dart, and beams it away. The containment bonus is paid, if the crew
+ * did half its damage or more (/datum/component/experiment_damage_ledger), when it dies, or for one
+ * taken alive when Kessler has it, at the subdued rate if it was held. Each is paid once per
+ * experiment. One that gets back up before Kessler has it (revived, woken, out of its cuffs) is loose
+ * again.
* - A creature stays until the crew puts it down or an admin ends the experiment. One that gets out
* of the wing sets off the containment breach alarm. One taken off the outpost (onto a ship, say)
* is recovered by Kessler at once, for a fee that becomes debt (experiment_recover()). The one
@@ -29,7 +34,7 @@
* Every clock here counts only while a member of the wing is home (crew_home()).
*/
-/mob/living/basic/outpost_prisoner
+/mob/living/carbon/human/npc/outpost_prisoner
/// Dosed or carrying a specimen: their death is the experiment's, not staff's
var/experiment_subject = FALSE
@@ -37,7 +42,7 @@
/// The experiment under way, or just ended (the console shows the result for a while)
var/datum/outpost_experiment/experiment
/// The researcher, while visiting with an offer
- var/mob/living/basic/outpost_kessler_staff/researcher/researcher
+ var/mob/living/carbon/human/npc/outpost_kessler_staff/researcher/researcher
/// Crew-home seconds until the researcher is due; null before the first arrival and while an offer, item or experiment is out
var/researcher_wait
/// The researcher's visits have been scheduled: the wing has had its first arrival
@@ -114,7 +119,7 @@
* bursts from the body.
*/
/datum/outpost_prison/proc/subject_tick(seconds, home)
- var/mob/living/basic/outpost_prisoner/subject = experiment.subject()
+ var/mob/living/carbon/human/npc/outpost_prisoner/subject = experiment.subject()
if(!subject || subject.prison != src || subject.phase != PRISONER_PRESENT)
experiment_failed("the subject is gone")
return FALSE
@@ -134,14 +139,14 @@
/datum/outpost_prison/proc/experiment_paused()
if(!experiment_active() || !crew_home())
return TRUE
- var/mob/living/basic/outpost_prisoner/subject = experiment.subject()
+ var/mob/living/carbon/human/npc/outpost_prisoner/subject = experiment.subject()
return subject && subject.stat != DEAD && (get_area(subject) != wing || !in_cell_block(subject))
/// A minute of twitching, then the change. The form's tells show in the last OUTPOST_EXPERIMENT_TELLS seconds.
/datum/outpost_prison/proc/twitch_tick(seconds, home)
if(!home)
return
- var/mob/living/basic/outpost_prisoner/subject = experiment.subject()
+ var/mob/living/carbon/human/npc/outpost_prisoner/subject = experiment.subject()
experiment.twitch_left -= seconds
experiment.stage = experiment.twitch_left > OUTPOST_EXPERIMENT_TELLS ? "dosed" : "twitching"
if(experiment.twitch_left <= 0)
@@ -162,21 +167,29 @@
else
subject.say_context("experiment_dose")
-/// The serum takes: the subject becomes the creature where they stand
+/// The serum takes: the subject's body becomes the creature where they stand (outpost_prison_experiment_forms.dm)
/datum/outpost_prison/proc/transform_subject()
- var/mob/living/basic/outpost_prisoner/subject = experiment.subject()
- var/creature_type = outpost_experiment_creature_type(experiment.form)
+ var/mob/living/carbon/human/npc/outpost_prisoner/subject = experiment.subject()
var/turf/spot = get_turf(subject)
- if(!subject || !creature_type || !spot)
+ if(!subject || !outpost_experiment_form_type(experiment.form) || !spot)
experiment_failed("the serum did not take")
return null
- var/mob/living/basic/outpost_experiment/creature = new creature_type(spot, src, subject)
- add_log("[subject.real_name] turned into [creature.form_name].")
- log_game("PLAYER OUTPOST PRISON: [subject.real_name] turned into [creature.form_name] at '[outpost?.name]' [AREACOORD(spot)]")
+ var/subject_name = subject.real_name
+ var/personality = subject.personality
experiment.subject_ref = null
- qdel(subject)
- experiment_creature_appeared(creature, experiment.form)
- return creature
+ // The same body, no longer an inmate: off the roster (its cell waits a refill), the prisoner's own
+ // reactions off. The form brings its own mind, side and refusals.
+ subject.stand_down_for_experiment()
+ forget(subject)
+ var/mob/living/carbon/human/body = subject
+ var/datum/component/outpost_experiment_form/form = outpost_experiment_turn(body, experiment.form, src, personality)
+ if(!form)
+ experiment_failed("the serum did not take")
+ return null
+ add_log("[subject_name] turned into [form.form_name].")
+ log_game("PLAYER OUTPOST PRISON: [subject_name] turned into [form.form_name] at '[outpost?.name]' [AREACOORD(spot)]")
+ experiment_creature_appeared(body, experiment.form)
+ return body
/**
* The creatures and the leash. A creature off the outpost is recovered at once (for the fee only
@@ -196,6 +209,10 @@
return
var/out_of_wing = FALSE
for(var/mob/living/creature as anything in live)
+ // A body the serum took is down when tg says so: crit, stamcrit, asleep, cuffed or dead.
+ if(outpost_experiment_down_state(creature))
+ experiment_creature_down(creature)
+ continue
if(!outpost_holds(creature))
// Its own move into space (on_moved()) usually got there first; this catches the rest.
var/mob/living/basic/outpost_experiment/horror/spaced = creature
@@ -208,6 +225,12 @@
return
if(get_area(creature) != wing)
out_of_wing = TRUE
+ // Down and waiting for Kessler, but dragged off the outpost: Kessler's beam takes it at once.
+ for(var/key in experiment.awaiting.Copy())
+ var/datum/weakref/creature_ref = experiment.creature_refs[key]
+ var/mob/living/creature = creature_ref?.resolve()
+ if(!QDELETED(creature) && !outpost_holds(creature) && !HAS_TRAIT_FROM(creature, TRAIT_IMMOBILIZED, OUTPOST_KESSLER_TRAIT))
+ kessler_finish_collect(creature_ref)
if(out_of_wing && !experiment.breach_announced)
experiment.breach_announced = TRUE
add_log("An experiment creature got out of the wing.")
@@ -230,7 +253,7 @@
* does the admin panel with `forced`, which skips the cell block rule. One experiment at a time,
* on a living prisoner of this wing. Returns TRUE if it started.
*/
-/datum/outpost_prison/proc/start_experiment(form, mob/living/basic/outpost_prisoner/subject, forced = FALSE)
+/datum/outpost_prison/proc/start_experiment(form, mob/living/carbon/human/npc/outpost_prisoner/subject, forced = FALSE)
if(!(form in list("hulk", "fly", "nightmare", "changeling")))
return FALSE
if(QDELETED(subject) || subject.prison != src || subject.phase != PRISONER_PRESENT || subject.stat == DEAD)
@@ -262,7 +285,7 @@
experiment.stage = "dosed"
experiment.twitch_left = OUTPOST_EXPERIMENT_TWITCH
experiment.effect_left = rand(3, 5)
- INVOKE_ASYNC(subject, TYPE_PROC_REF(/mob/living/basic/outpost_prisoner, say_context), "experiment_dose")
+ INVOKE_ASYNC(subject, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prisoner, say_context), "experiment_dose")
return TRUE
// ===== CREATURES AND PAY =====
@@ -290,7 +313,10 @@
experiment.creature_refs[key] = WEAKREF(creature)
experiment.creature_kinds[key] = kind
experiment.revealed = TRUE
- creature.AddComponent(/datum/component/experiment_damage_ledger)
+ var/datum/component/experiment_damage_ledger/ledger = creature.AddComponent(/datum/component/experiment_damage_ledger)
+ // The crew's lights are their weapon against a nightmare: what the light burns is theirs.
+ if(kind == "nightmare" && istype(ledger))
+ ledger.light_is_players = TRUE
RegisterSignal(creature, COMSIG_LIVING_DEATH, PROC_REF(on_creature_death))
RegisterSignal(creature, COMSIG_QDELETING, PROC_REF(on_creature_deleted))
experiment.stage = kind == "horror" ? "horror" : "live"
@@ -304,37 +330,87 @@
return TRUE
/**
- * A creature was put down: killed, or `subdued` alive (worn out on stamina). Pays the containment
- * bonus, once per experiment, if players did at least OUTPOST_EXPERIMENT_PLAYER_SHARE of its
- * damage. It lies there, and the console shows it awaiting pickup, until Kessler's team comes for
- * it OUTPOST_EXPERIMENT_PICKUP seconds later. With no creature left the experiment is over.
- * Returns TRUE if it counted.
+ * A creature went down (outpost_experiment_down_state()): dead, or a body the serum took in crit,
+ * stamcrit, asleep or cuffed. It lies there, and the console shows it awaiting pickup, until Kessler's
+ * team comes for it OUTPOST_EXPERIMENT_PICKUP seconds later (kessler_collect()). A dead one earns the
+ * containment bonus now (once per experiment, so reviving it earns nothing more); one down alive earns it
+ * when Kessler has it, by the state the team finds it in. With nothing left loose or down alive, the
+ * experiment is contained. Returns TRUE if it counted.
*/
-/datum/outpost_prison/proc/experiment_creature_down(mob/living/creature, subdued = FALSE)
+/datum/outpost_prison/proc/experiment_creature_down(mob/living/creature)
if(!experiment || !creature)
return FALSE
var/key = REF(creature)
if(!experiment.creature_refs[key] || experiment.downed[key])
return FALSE
+ var/state = outpost_experiment_down_state(creature) || OUTPOST_EXPERIMENT_DOWN_DEAD
experiment.downed[key] = TRUE
- experiment.awaiting[key] = subdued ? "subdued" : "down"
- var/kind = experiment.creature_kinds[key]
- if(!experiment.bonus_done && !experiment.resolved)
- experiment.bonus_done = TRUE
- var/datum/component/experiment_damage_ledger/ledger = creature.GetComponent(/datum/component/experiment_damage_ledger)
- var/share = ledger ? ledger.player_share() : 1
- if(share >= OUTPOST_EXPERIMENT_PLAYER_SHARE)
- var/bonus = round(outpost_experiment_bonus(kind, subdued) * experiment.multiplier)
- if(pay_treasury(bonus, "Kessler Biolabs containment bonus"))
- experiment.bonus_paid = bonus
- add_log("[creature.name] was [subdued ? "subdued" : "put down"]. Kessler Biolabs paid a [bonus] cr containment bonus.")
- else
- add_log("[creature.name] was [subdued ? "subdued" : "put down"]. Kessler Biolabs paid no bonus.")
- addtimer(CALLBACK(src, PROC_REF(kessler_collect), WEAKREF(creature), FALSE), OUTPOST_EXPERIMENT_PICKUP SECONDS, TIMER_DELETE_ME)
- if(!experiment.resolved && !length(experiment.live_creatures()))
- resolve_experiment("contained")
+ experiment.awaiting[key] = state
+ if(state != OUTPOST_EXPERIMENT_DOWN_DEAD)
+ var/datum/component/outpost_experiment_form/form = creature.GetComponent(/datum/component/outpost_experiment_form)
+ creature.visible_message(span_danger("[creature] [form?.down_message || "collapses, spent."]"))
+ creature.balloon_alert_to_viewers(state)
+ else
+ if(ishuman(creature))
+ creature.balloon_alert_to_viewers("dead")
+ pay_containment(creature)
+ addtimer(CALLBACK(src, PROC_REF(kessler_collect), WEAKREF(creature)), OUTPOST_EXPERIMENT_PICKUP SECONDS, TIMER_DELETE_ME)
+ experiment_check_contained()
return TRUE
+/// Contained: nothing of the experiment's is loose, or down alive waiting for Kessler (which could still get up)
+/datum/outpost_prison/proc/experiment_check_contained()
+ if(!experiment || experiment.resolved || length(experiment.live_creatures()))
+ return FALSE
+ for(var/key in experiment.awaiting)
+ if(experiment.awaiting[key] != OUTPOST_EXPERIMENT_DOWN_DEAD)
+ return FALSE
+ resolve_experiment("contained")
+ return TRUE
+
+/// Whether `creature` lies down waiting for Kessler's team
+/datum/outpost_prison/proc/experiment_awaiting_pickup(mob/living/creature)
+ if(!experiment)
+ return FALSE
+ return !!experiment.awaiting[REF(creature)]
+
+/**
+ * A creature that went down is back on its feet before Kessler had it (revived, woken, out of its
+ * cuffs): it is loose again, and the experiment goes on. One the experiment has already been settled
+ * for (contained, paid) is Kessler's: the beam takes it as it stands.
+ */
+/datum/outpost_prison/proc/experiment_creature_back_up(mob/living/creature)
+ if(!experiment)
+ return
+ var/key = REF(creature)
+ experiment.awaiting -= key
+ if(experiment.resolved)
+ kessler_take(creature)
+ return
+ experiment.downed -= key
+ add_log("[creature.name] got back up before Kessler Biolabs came for [creature.p_them()].")
+
+/**
+ * The containment bonus, once per experiment, for the creature Kessler is taking: if players did at least
+ * OUTPOST_EXPERIMENT_PLAYER_SHARE of its damage, at the subdued rate when it was taken alive and held.
+ */
+/datum/outpost_prison/proc/pay_containment(mob/living/creature)
+ var/key = REF(creature)
+ if(experiment.bonus_done || experiment.resolved)
+ return
+ experiment.bonus_done = TRUE
+ var/subdued = experiment.awaiting[key] == OUTPOST_EXPERIMENT_DOWN_SUBDUED
+ var/kind = experiment.creature_kinds[key]
+ var/datum/component/experiment_damage_ledger/ledger = creature.GetComponent(/datum/component/experiment_damage_ledger)
+ var/share = ledger ? ledger.player_share() : 1
+ if(share < OUTPOST_EXPERIMENT_PLAYER_SHARE)
+ add_log("[creature.name] was [subdued ? "subdued" : "put down"]. Kessler Biolabs paid no bonus.")
+ return
+ var/bonus = round(outpost_experiment_bonus(kind, subdued) * experiment.multiplier)
+ if(pay_treasury(bonus, "Kessler Biolabs containment bonus"))
+ experiment.bonus_paid = bonus
+ add_log("[creature.name] was [subdued ? "subdued" : "put down"]. Kessler Biolabs paid a [bonus] cr containment bonus.")
+
/**
* A tracked creature died: that is it put down. Gibbed or dusted (a bomb, a shuttle), it never took
* the health it still had as damage, so that goes on its ledger as damage that was not the players'.
@@ -342,14 +418,14 @@
*/
/datum/outpost_prison/proc/on_creature_death(mob/living/creature, gibbed)
SIGNAL_HANDLER
- var/unspent = creature.health
+ var/unspent = max(0, creature.health)
var/mob/living/basic/outpost_experiment/experiment_creature = creature
if(istype(experiment_creature))
unspent = experiment_creature.unspent_health()
if(gibbed && unspent > 0)
var/datum/component/experiment_damage_ledger/ledger = creature.GetComponent(/datum/component/experiment_damage_ledger)
ledger?.add_damage(unspent, FALSE)
- INVOKE_ASYNC(src, PROC_REF(experiment_creature_down), creature, FALSE)
+ INVOKE_ASYNC(src, PROC_REF(experiment_creature_down), creature)
/// A tracked creature is gone. A serum creature deleted before it was put down or recovered takes the experiment with it.
/datum/outpost_prison/proc/on_creature_deleted(mob/living/creature)
@@ -378,7 +454,8 @@
return FALSE
for(var/mob/living/creature as anything in experiment.live_creatures())
experiment.downed[REF(creature)] = TRUE
- kessler_collect(WEAKREF(creature), FALSE)
+ kessler_take(creature)
+ take_awaiting_creatures()
add_log("The experiment failed: [reason].")
log_game("PLAYER OUTPOST PRISON: experiment failed at '[outpost?.name]' ([reason])")
resolve_experiment("failed")
@@ -399,7 +476,8 @@
fee = max(fee, outpost_experiment_recovery_fee(experiment.creature_kinds[key]))
names += creature.name
experiment.downed[key] = TRUE
- kessler_collect(WEAKREF(creature), TRUE)
+ outpost_kessler_team(creature, "kessler_recovery", tranquilise = FALSE)
+ kessler_take(creature)
var/charged = 0
if(charge && fee > 0)
charged = charge_fine(fee, "Kessler Biolabs recovery fee")
@@ -450,8 +528,9 @@
qdel(creature)
for(var/mob/living/creature as anything in experiment.live_creatures())
experiment.downed[REF(creature)] = TRUE
- kessler_collect(WEAKREF(creature), FALSE)
- var/mob/living/basic/outpost_prisoner/subject = experiment.subject()
+ kessler_take(creature)
+ take_awaiting_creatures()
+ var/mob/living/carbon/human/npc/outpost_prisoner/subject = experiment.subject()
if(subject)
subject.experiment_subject = FALSE
outpost_experiment_clear_tells(subject)
@@ -482,7 +561,7 @@
experiment.resolved = TRUE
experiment.stage = outcome
experiment.result_left = OUTPOST_EXPERIMENT_RESULT_SHOWN
- var/mob/living/basic/outpost_prisoner/subject = experiment.subject()
+ var/mob/living/carbon/human/npc/outpost_prisoner/subject = experiment.subject()
if(subject && subject.stat != DEAD)
subject.experiment_subject = FALSE
outpost_experiment_clear_tells(subject)
@@ -492,7 +571,7 @@
// absorbed who was not a prisoner. Its witnesses join the experiment's, once each.
if(!QDELETED(experiment.changeling))
for(var/datum/weakref/witness_ref as anything in experiment.changeling.witnesses)
- var/mob/living/basic/outpost_prisoner/witness = witness_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/witness = witness_ref?.resolve()
if(witness)
experiment.witnesses[REF(witness)] = witness_ref
#endif
@@ -510,7 +589,7 @@
/datum/outpost_prison/proc/experiment_aftermath()
for(var/key in experiment.witnesses)
var/datum/weakref/witness_ref = experiment.witnesses[key]
- var/mob/living/basic/outpost_prisoner/witness = witness_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/witness = witness_ref?.resolve()
if(!witness || witness.prison != src || witness.stat == DEAD || witness.phase != PRISONER_PRESENT)
continue
witness.adjust_mood(-OUTPOST_EXPERIMENT_SAW_DEATH_MOOD)
@@ -520,37 +599,138 @@
experiment.creature_kills = 0
/**
- * Kessler takes a creature away: a team beams in around it, and OUTPOST_KESSLER_TEAM_TIME later
- * the beam takes it. One that was put down is collected where it lies; one still on its feet (a
- * `recovery` off the outpost, or an experiment called off) is tranquilised and drops first. It is
- * held still and cannot be hurt meanwhile.
+ * Kessler's team comes for a creature that went down (experiment_creature_down()): two agents beam in
+ * around it, a living one gets a real chloral hydrate dart to keep it down (owner ruling OC-3), and
+ * OUTPOST_KESSLER_TEAM_TIME later, if it is still down, the containment bonus is paid and the beam takes
+ * it. The bonus goes by the state it was found in. One already back on its feet is loose again.
*/
-/datum/outpost_prison/proc/kessler_collect(datum/weakref/creature_ref, recovery = FALSE)
+/datum/outpost_prison/proc/kessler_collect(datum/weakref/creature_ref)
var/mob/living/creature = creature_ref?.resolve()
- if(QDELETED(creature) || HAS_TRAIT_FROM(creature, TRAIT_GODMODE, OUTPOST_KESSLER_TRAIT))
+ if(QDELETED(creature) || !experiment || HAS_TRAIT_FROM(creature, TRAIT_IMMOBILIZED, OUTPOST_KESSLER_TRAIT))
+ return
+ var/key = REF(creature)
+ if(!experiment.awaiting[key])
+ return
+ var/state = outpost_experiment_down_state(creature)
+ if(!state)
+ experiment_creature_back_up(creature)
+ return
+ experiment.awaiting[key] = state
+ outpost_kessler_team(creature, "kessler_collect", tranquilise = FALSE)
+ if(creature.stat != DEAD)
+ outpost_kessler_dart(creature)
+ addtimer(CALLBACK(src, PROC_REF(kessler_finish_collect), creature_ref), OUTPOST_KESSLER_TEAM_TIME, TIMER_DELETE_ME)
+
+/// The team's beam takes a creature still down, and Kessler pays for it if it hasn't yet. With nothing left loose or down alive, the experiment is contained.
+/datum/outpost_prison/proc/kessler_finish_collect(datum/weakref/creature_ref)
+ var/mob/living/creature = creature_ref?.resolve()
+ if(QDELETED(creature) || !experiment || HAS_TRAIT_FROM(creature, TRAIT_IMMOBILIZED, OUTPOST_KESSLER_TRAIT))
+ return
+ var/key = REF(creature)
+ if(!experiment.awaiting[key])
+ return
+ if(!outpost_experiment_down_state(creature))
+ experiment_creature_back_up(creature)
return
- var/already_down = creature.stat == DEAD || creature.body_position == LYING_DOWN
- ADD_TRAIT(creature, TRAIT_GODMODE, OUTPOST_KESSLER_TRAIT)
- ADD_TRAIT(creature, TRAIT_IMMOBILIZED, OUTPOST_KESSLER_TRAIT)
- ADD_TRAIT(creature, TRAIT_INCAPACITATED, OUTPOST_KESSLER_TRAIT)
- ADD_TRAIT(creature, TRAIT_HANDS_BLOCKED, OUTPOST_KESSLER_TRAIT)
- ADD_TRAIT(creature, TRAIT_FLOORED, OUTPOST_KESSLER_TRAIT)
- creature.ai_controller?.CancelActions()
+ pay_containment(creature)
+ add_log("Kessler Biolabs collected [creature.name].")
+ experiment.awaiting -= key
+ kessler_take(creature)
+ experiment_check_contained()
+
+/**
+ * Kessler's beam takes a creature away for good: held still and harmless for the beam, then gone. A
+ * transporter, never godmode (defaults 1.8): nothing that happens during it changes what was paid. The
+ * crew's restraints stay behind.
+ */
+/datum/outpost_prison/proc/kessler_take(mob/living/creature)
+ if(QDELETED(creature) || HAS_TRAIT_FROM(creature, TRAIT_IMMOBILIZED, OUTPOST_KESSLER_TRAIT))
+ return
+ creature.add_traits(list(TRAIT_IMMOBILIZED, TRAIT_INCAPACITATED, TRAIT_HANDS_BLOCKED), OUTPOST_KESSLER_TRAIT)
+ creature.ai_controller?.set_ai_status(AI_STATUS_OFF)
creature.pulledby?.stop_pulling()
- if(recovery)
- outpost_kessler_team(creature, "kessler_recovery", tranquilise = TRUE)
- else
- outpost_kessler_team(creature, "kessler_collect", tranquilise = !already_down)
- if(already_down && !recovery)
- add_log("Kessler Biolabs collected [creature.name].")
- addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(outpost_kessler_beam_away), creature), OUTPOST_KESSLER_TEAM_TIME, TIMER_DELETE_ME)
+ creature.stop_pulling()
+ creature.buckled?.unbuckle_mob(creature, force = TRUE)
+ var/turf/spot = get_turf(creature)
+ if(spot)
+ creature.visible_message(span_notice("A transporter beam takes [creature] away."))
+ playsound(spot, 'sound/effects/magic/teleport_diss.ogg', 40, TRUE)
+ new /obj/effect/temp_visual/transporter_beam(spot, OUTPOST_KESSLER_BEAM_TIME + 0.5 SECONDS)
+ transporter_dematerialise(creature, OUTPOST_KESSLER_BEAM_TIME)
+ addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(outpost_kessler_finish_take), WEAKREF(creature)), OUTPOST_KESSLER_BEAM_TIME, TIMER_DELETE_ME)
+
+/// Everything down and waiting for Kessler goes with the beam now, unpaid: the experiment is over before the team came
+/datum/outpost_prison/proc/take_awaiting_creatures()
+ for(var/key in experiment.awaiting.Copy())
+ var/datum/weakref/creature_ref = experiment.creature_refs[key]
+ experiment.awaiting -= key
+ kessler_take(creature_ref?.resolve())
+
+/// The end of Kessler's beam: restraints the crew put on it stay, and the rest goes
+/proc/outpost_kessler_finish_take(datum/weakref/creature_ref)
+ var/mob/living/creature = creature_ref?.resolve()
+ if(QDELETED(creature))
+ return
+ var/turf/spot = get_turf(creature)
+ var/mob/living/carbon/held = creature
+ if(spot && istype(held))
+ for(var/obj/item/restraints/worn in list(held.handcuffed, held.legcuffed))
+ held.transferItemToLoc(worn, spot, force = TRUE)
+ if(spot)
+ new /obj/effect/temp_visual/transporter_flash/departure(spot)
+ transporter_sparks(spot)
+ playsound(spot, 'sound/effects/magic/teleport_app.ogg', 50, TRUE)
+ qdel(creature)
+
+/**
+ * A Kessler agent's tranquilliser: a real dart of chloral hydrate, fired from beside `creature`, which tg's
+ * reagent and the target's clothing decide the rest of.
+ */
+/proc/outpost_kessler_dart(mob/living/creature)
+ var/turf/target_turf = get_turf(creature)
+ if(!target_turf)
+ return null
+ var/turf/from = target_turf
+ for(var/turf/open/tile in shuffle(orange(1, target_turf)))
+ if(!tile.is_blocked_turf(TRUE))
+ from = tile
+ break
+ var/obj/projectile/bullet/dart/dart = new(from)
+ dart.reagents.add_reagent(/datum/reagent/toxin/chloralhydrate, OUTPOST_KESSLER_DART_DOSE)
+ dart.original = creature
+ playsound(from, 'sound/items/syringeproj.ogg', 50, TRUE)
+ dart.aim_projectile(creature, from)
+ dart.fire(direct_target = creature)
+ return dart
+
+/**
+ * Whether a creature is down for Kessler, and how, by tg's own states: OUTPOST_EXPERIMENT_DOWN_DEAD;
+ * OUTPOST_EXPERIMENT_DOWN_SUBDUED for a body alive on the floor (crit, stamcrit, asleep) and held (cuffed
+ * or asleep); OUTPOST_EXPERIMENT_DOWN_DOWN for one on the floor or cuffed but not both. Null while it is
+ * up and free. The horror and the headslug, monsters, are down only once dead.
+ */
+/proc/outpost_experiment_down_state(mob/living/creature)
+ if(QDELETED(creature))
+ return null
+ if(creature.stat == DEAD)
+ return OUTPOST_EXPERIMENT_DOWN_DEAD
+ if(!iscarbon(creature))
+ return null
+ var/asleep = creature.stat == UNCONSCIOUS || creature.IsSleeping() || creature.IsUnconscious()
+ var/floored = asleep || creature.stat >= SOFT_CRIT || HAS_TRAIT_FROM(creature, TRAIT_INCAPACITATED, STAMINA)
+ var/held = asleep || HAS_TRAIT(creature, TRAIT_RESTRAINED)
+ if(floored && held)
+ return OUTPOST_EXPERIMENT_DOWN_SUBDUED
+ if(floored || held)
+ return OUTPOST_EXPERIMENT_DOWN_DOWN
+ return null
// ===== PRISONERS =====
/// Prisoners who could be the researcher's subjects: in the wing, alive, not loose and not dosed already
/datum/outpost_prison/proc/researcher_prisoner_count()
var/count = 0
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.phase == PRISONER_PRESENT && prisoner.stat != DEAD && prisoner.trouble != PRISONER_TROUBLE_LOOSE && !prisoner.experiment_subject)
count++
return count
@@ -560,7 +740,7 @@
* researcher says so. A changeling host dying is the changeling event's to handle. Anyone else a
* creature (not staff) killed counts toward the aftermath, with everyone in sight of it a witness.
*/
-/datum/outpost_prison/on_prisoner_death(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/on_prisoner_death(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
. = ..()
if(!experiment_active())
return
@@ -575,12 +755,12 @@
if(!creature_live() || prisoner.death_blamed)
return
experiment.creature_kills++
- for(var/mob/living/basic/outpost_prisoner/witness in viewers(OUTPOST_EXPERIMENT_WITNESS_RANGE, get_turf(prisoner)))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/witness in viewers(OUTPOST_EXPERIMENT_WITNESS_RANGE, get_turf(prisoner)))
if(witness != prisoner && witness.prison == src && witness.stat != DEAD)
experiment.witnesses[REF(witness)] = WEAKREF(witness)
/// A dosed subject earns nothing: their pay and release bonus are forfeit
-/datum/outpost_prison/pay_factor(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/pay_factor(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(prisoner?.experiment_subject)
return 0
return ..()
@@ -592,7 +772,7 @@
* of the cell block stays on the roster (body_tick()).
* Once the experiment is over the usual rules apply again.
*/
-/datum/outpost_prison/proc/held_for_experiment(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/held_for_experiment(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(!prisoner || !experiment_active())
return FALSE
if(prisoner == experiment.subject())
@@ -604,12 +784,12 @@
return FALSE
/// A dosed subject is not released at the end of their sentence
-/datum/outpost_prison/check_release(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/check_release(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(held_for_experiment(prisoner))
return
return ..()
-/datum/outpost_prison/release(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/release(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(held_for_experiment(prisoner))
return 0
return ..()
@@ -740,7 +920,7 @@
var/list/witnesses = list()
var/creature_kills = 0
-/datum/outpost_experiment/New(datum/outpost_prison/owner, form, mob/living/basic/outpost_prisoner/subject)
+/datum/outpost_experiment/New(datum/outpost_prison/owner, form, mob/living/carbon/human/npc/outpost_prisoner/subject)
. = ..()
prison = owner
src.form = form
@@ -972,6 +1152,9 @@
/// While set, the damage it takes is the players' whoever struck last: fire a player is credited
/// with (the horror's take_fire_damage()). It is not a blow, so recent_player() keeps its time.
var/crediting_players = FALSE
+ /// A nightmare's: burns it takes standing in the light, with nobody striking it, are the players'
+ /// (the crew's lights are their weapon)
+ var/light_is_players = FALSE
/datum/component/experiment_damage_ledger/Initialize()
if(!isliving(parent))
@@ -1021,6 +1204,11 @@
if(crediting_players)
add_damage(damage, TRUE)
return
+ if(light_is_players && damagetype == BURN && last_attack_time != world.time)
+ var/turf/lit = get_turf(parent)
+ if(lit && lit.get_lumcount() >= SHADOW_SPECIES_LIGHT_THRESHOLD)
+ add_damage(damage, TRUE)
+ return
if(last_attack_time == world.time)
if(!last_attack_prisoner)
add_damage(damage, last_attack_player)
@@ -1095,7 +1283,7 @@
return TRUE
/// Starts a changeling event in `host`, a prisoner of `prison`, and returns it
-/proc/outpost_changeling_infect(mob/living/basic/outpost_prisoner/host, datum/outpost_prison/prison)
+/proc/outpost_changeling_infect(mob/living/carbon/human/npc/outpost_prisoner/host, datum/outpost_prison/prison)
var/datum/outpost_changeling_event/event = new
event.prison = prison
event.host_ref = WEAKREF(host)
diff --git a/voidcrew/modules/player_outposts/outpost_prison_extras.dm b/voidcrew/modules/player_outposts/outpost_prison_extras.dm
index d0df5077f73..16f7f332f9c 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_extras.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_extras.dm
@@ -61,14 +61,14 @@ GLOBAL_LIST_INIT(outpost_prisoner_extra_placeholders, list("{staff}", "{place}",
// ===== THE PRISONER =====
-/mob/living/basic/outpost_prisoner
+/mob/living/carbon/human/npc/outpost_prisoner
/// Values for extra placeholders ("{staff}" = "Isaac") while one line is picked and said
var/list/extra_line_values
/// The last person or borg (never a machine) whose hit on them counted as staff's
var/datum/weakref/last_staff_attacker_ref
/// Hooks up every package's own handlers; called once from Initialize()
-/mob/living/basic/outpost_prisoner/proc/setup_extras()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/setup_extras()
setup_ambience()
setup_warden_tools()
setup_pastimes()
@@ -78,13 +78,13 @@ GLOBAL_LIST_INIT(outpost_prisoner_extra_placeholders, list("{staff}", "{place}",
* Says a line for `context` with values for extra placeholders, list("{place}" = "the Meridian").
* Lines naming a placeholder without a value are skipped. Returns TRUE if they said something.
*/
-/mob/living/basic/outpost_prisoner/proc/say_context_with(context, list/values, mob/living/basic/outpost_prisoner/other)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/say_context_with(context, list/values, mob/living/carbon/human/npc/outpost_prisoner/other)
extra_line_values = values
. = say_context(context, other)
extra_line_values = null
/// Says a line for `context` to `person`, filling {staff} with the name the yard knows them by
-/mob/living/basic/outpost_prisoner/proc/say_to_staff(context, mob/person)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/say_to_staff(context, mob/person)
var/staff_name = prison?.staff_greeting_name(person)
return say_context_with(context, staff_name ? list("{staff}" = staff_name) : null)
@@ -123,13 +123,13 @@ GLOBAL_LIST_INIT(outpost_prisoner_extra_placeholders, list("{staff}", "{place}",
guards_abandon()
/// A prisoner was booked in (admit()), with their cell and mood set
-/datum/outpost_prison/proc/extras_prisoner_admitted(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/extras_prisoner_admitted(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
on_prisoner_admitted(prisoner)
contraband_prisoner_admitted(prisoner)
leads_prisoner_admitted(prisoner)
/// A prisoner is leaving the roster (forget()), still holding their prison and cell
-/datum/outpost_prison/proc/extras_prisoner_leaving(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/extras_prisoner_leaving(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
on_prisoner_leaving(prisoner)
contraband_prisoner_leaving(prisoner)
mail_prisoner_leaving(prisoner)
@@ -146,7 +146,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_extra_placeholders, list("{staff}", "{place}",
// ===== THE PRISON: SPEECH, EXAMINE AND THE TALK MENU =====
/// Something a package wants a prisoner to say now: list(context, other[, values]), or null
-/datum/outpost_prison/proc/extra_speech(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/extra_speech(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
// A bounty prisoner who sees someone off the ship that caught them (outpost_prison_bounty.dm): rare and gated
var/list/choice = bounty_extra_speech(prisoner)
if(choice)
@@ -163,7 +163,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_extra_placeholders, list("{staff}", "{place}",
return leads_extra_speech(prisoner)
/// Extra sentences for a prisoner's examine text, from every package that has one; XB's examine() shows them
-/datum/outpost_prison/proc/examine_extra_lines(mob/living/basic/outpost_prisoner/prisoner, mob/user)
+/datum/outpost_prison/proc/examine_extra_lines(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/user)
var/list/lines = list()
for(var/line in list(relationship_examine(prisoner), contraband_examine(prisoner, user), leads_examine(prisoner, user), wildcard_examine(prisoner), bounty_examine(prisoner, user)))
if(istext(line) && length(line))
@@ -171,7 +171,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_extra_placeholders, list("{staff}", "{place}",
return lines
/// Extra choices for the talk menu (XC's radial): name -> image, from the packages that add one
-/datum/outpost_prison/proc/talk_menu_extra_choices(mob/living/basic/outpost_prisoner/prisoner, mob/living/user)
+/datum/outpost_prison/proc/talk_menu_extra_choices(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/user)
var/list/choices = list()
for(var/list/extra as anything in list(contraband_talk_choices(prisoner, user), leads_talk_choices(prisoner, user)))
for(var/key in extra)
@@ -179,7 +179,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_extra_placeholders, list("{staff}", "{place}",
return choices
/// Runs an extra talk menu choice; TRUE if a package handled it. May sleep (the menu is async).
-/datum/outpost_prison/proc/talk_menu_extra_act(mob/living/basic/outpost_prisoner/prisoner, mob/living/user, choice)
+/datum/outpost_prison/proc/talk_menu_extra_act(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/user, choice)
if(contraband_talk_act(prisoner, user, choice))
return TRUE
return leads_talk_act(prisoner, user, choice)
@@ -187,7 +187,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_extra_placeholders, list("{staff}", "{place}",
// ===== THE PRISON: TROUBLE =====
/// What the packages do to the chance two prisoners start a fight: a multiplier, 1 for no change
-/datum/outpost_prison/proc/extras_fight_mult(mob/living/basic/outpost_prisoner/one, mob/living/basic/outpost_prisoner/two)
+/datum/outpost_prison/proc/extras_fight_mult(mob/living/carbon/human/npc/outpost_prisoner/one, mob/living/carbon/human/npc/outpost_prisoner/two)
return fight_chance_mult(one, two) * contraband_fight_mult(one, two)
// ===== THE PRISON: CONSOLES =====
diff --git a/voidcrew/modules/player_outposts/outpost_prison_fixtures.dm b/voidcrew/modules/player_outposts/outpost_prison_fixtures.dm
index 0ca544dd12f..a76de68e62c 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_fixtures.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_fixtures.dm
@@ -10,7 +10,9 @@
/// Whether this is an outpost prisoner
/proc/is_outpost_prisoner(atom/thing)
- return istype(thing, /mob/living/basic/outpost_prisoner)
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = thing
+ // A body the serum turned is an experiment's creature now (outpost_prison_experiment_forms.dm)
+ return istype(prisoner) && !prisoner.experiment_turned
// ===== UNIFORM =====
diff --git a/voidcrew/modules/player_outposts/outpost_prison_guard_combat_sense.dm b/voidcrew/modules/player_outposts/outpost_prison_guard_combat_sense.dm
new file mode 100644
index 00000000000..91cb195988e
--- /dev/null
+++ b/voidcrew/modules/player_outposts/outpost_prison_guard_combat_sense.dm
@@ -0,0 +1,30 @@
+/**
+ * Combat sense for a prison's NPC guards (voidcrew/modules/human_npcs/human_npc_combat_sense.dm).
+ *
+ * Guards never strike players and carry no stimulant, so theirs is the cover half only: on duty and shot
+ * with stun rounds by anyone but a fellow guard, a guard gets out of the line of fire, inside the wing,
+ * keeps down a moment, then goes back to whatever it was doing (its routine plans again). It never
+ * charges anyone (close_in_reach 0). The prison's own turrets aren't a threat it reacts to: only people
+ * and mechs are.
+ */
+/datum/npc_combat_sense/prison_guard
+ use_stims = FALSE
+ close_in_reach = 0
+
+/mob/living/carbon/human/npc/outpost_prison_guard
+ npc_combat_sense = /datum/npc_combat_sense/prison_guard
+
+/datum/npc_combat_sense/prison_guard/can_act(mob/living/carbon/human/npc, datum/ai_controller/controller)
+ var/mob/living/carbon/human/npc/outpost_prison_guard/guard = npc
+ return istype(guard) && guard.on_duty() && ..()
+
+// Players share the guards' faction: only another guard's shot is friendly fire.
+/datum/npc_combat_sense/prison_guard/allied(mob/living/carbon/human/npc, atom/shooter)
+ return is_outpost_prison_guard(shooter)
+
+/datum/npc_combat_sense/prison_guard/tile_ok(mob/living/carbon/human/npc, datum/ai_controller/controller, turf/tile)
+ if(!..())
+ return FALSE
+ var/mob/living/carbon/human/npc/outpost_prison_guard/guard = npc
+ var/area/wing = istype(guard) ? guard.prison?.wing : null
+ return isnull(wing) || get_area(tile) == wing
diff --git a/voidcrew/modules/player_outposts/outpost_prison_guard_routine.dm b/voidcrew/modules/player_outposts/outpost_prison_guard_routine.dm
index a2fa01ac29f..096d8392a8e 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_guard_routine.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_guard_routine.dm
@@ -2,8 +2,8 @@
* # Prison guards: routine
*
* Owner: XA (extras-plan.md 4.1). The guards' AI controller, their peaceful activities (post,
- * rounds, watching the yard, a drink at the cooler, a chat, checking on a prisoner) and the
- * response datum the dispatcher in outpost_prison_guards.dm hands out.
+ * rounds, watching the yard, a drink at the cooler, a chat, checking on a prisoner, patching
+ * themselves up) and the response datum the dispatcher in outpost_prison_guards.dm hands out.
*
* As with the prisoners' routine (outpost_prison_routine.dm), the AI only walks: to the goal of
* the guard's response when there is one, else to their activity's. The dispatcher deals with
@@ -86,7 +86,7 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
// ===== THE GUARD'S SIDE =====
/// Where their AI should walk them now, or null to stay put
-/mob/living/basic/outpost_prison_guard/proc/walk_goal()
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/walk_goal()
if(phase == OUTPOST_GUARD_DISMISSED)
return (leave_spot && loc != leave_spot) ? leave_spot : null
if(phase != OUTPOST_GUARD_PRESENT)
@@ -98,7 +98,7 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
return (goal && !at_goal(goal)) ? goal : null
/// A walk to `goal` failed: a response gets another try until it expires; an activity gets one more, then a rest
-/mob/living/basic/outpost_prison_guard/proc/walk_failed(atom/goal)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/walk_failed(atom/goal)
if(response || !activity || goal != activity.goal())
return
if(++activity.failed_moves < 2)
@@ -107,7 +107,7 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
end_activity(cancel_ai = FALSE)
/// Ends what they are doing on routine
-/mob/living/basic/outpost_prison_guard/proc/end_activity(cancel_ai = TRUE)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/end_activity(cancel_ai = TRUE)
if(!activity)
return
var/datum/outpost_guard_activity/old = activity
@@ -119,16 +119,16 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
ai_controller?.CancelActions()
/// Starts `new_activity` in place of whatever they were doing on routine
-/mob/living/basic/outpost_prison_guard/proc/start_activity(datum/outpost_guard_activity/new_activity)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/start_activity(datum/outpost_guard_activity/new_activity)
end_activity()
activity = new_activity
return new_activity
-/mob/living/basic/outpost_prison_guard/proc/activity_on_cooldown(activity_type)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/activity_on_cooldown(activity_type)
return LAZYACCESS(activity_cooldowns, activity_type) > world.time
/// Picks their next routine activity by weight. Returns it, already set up, or null.
-/mob/living/basic/outpost_prison_guard/proc/choose_activity()
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/choose_activity()
if(!prison || !on_duty())
return null
var/list/candidates = list()
@@ -161,7 +161,7 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
* A two-guard exchange: they open with a line from the file's guard_conversations, and `partner`
* answers a few seconds later. Returns TRUE if it started.
*/
-/mob/living/basic/outpost_prison_guard/proc/start_guard_conversation(mob/living/basic/outpost_prison_guard/partner)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/start_guard_conversation(mob/living/carbon/human/npc/outpost_prison_guard/partner)
if(!on_duty() || !partner?.on_duty())
return FALSE
var/list/conversations = outpost_guard_dialogue("guard_conversations")
@@ -179,8 +179,8 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
return TRUE
/// The second half of a guards' exchange
-/mob/living/basic/outpost_prison_guard/proc/reply_to_guard(line, datum/weakref/opener_ref)
- var/mob/living/basic/outpost_prison_guard/opener = opener_ref?.resolve()
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/reply_to_guard(line, datum/weakref/opener_ref)
+ var/mob/living/carbon/human/npc/outpost_prison_guard/opener = opener_ref?.resolve()
if(!on_duty() || !opener || get_dist(src, opener) > 5 || !istext(line))
return FALSE
face_atom(opener)
@@ -191,7 +191,9 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
// ===== AI =====
/datum/ai_controller/basic_controller/outpost_prison_guard
- blackboard = list()
+ blackboard = list(
+ BB_TARGET_MINIMUM_STAT = HUMAN_NPC_SPARES_DOWNED,
+ )
ai_traits = PASSIVE_AI_FLAGS
ai_movement = /datum/ai_movement/jps
// The routine plans everything, idle time included.
@@ -200,13 +202,17 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
can_idle = FALSE
// No finding targets: guards only ever strike through the dispatcher (outpost_prison_guards.dm),
// so turrets never read them as hostile.
- planning_subtrees = list(/datum/ai_planning_subtree/outpost_prison_guard)
+ // Combat sense first: out of a line of stun fire before anything else (outpost_prison_guard_combat_sense.dm)
+ planning_subtrees = list(
+ /datum/ai_planning_subtree/npc_combat_sense,
+ /datum/ai_planning_subtree/outpost_prison_guard,
+ )
/// Walks to the response's goal, else the activity's, or ticks the activity once there
/datum/ai_planning_subtree/outpost_prison_guard
/datum/ai_planning_subtree/outpost_prison_guard/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/outpost_prison_guard/guard = controller.pawn
+ var/mob/living/carbon/human/npc/outpost_prison_guard/guard = controller.pawn
if(!istype(guard) || guard.stat != CONSCIOUS || HAS_TRAIT(guard, TRAIT_IMMOBILIZED))
return
if(guard.phase == OUTPOST_GUARD_DISMISSED || guard.response)
@@ -235,7 +241,7 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
return SUBTREE_RETURN_FINISH_PLANNING
/// Queues the walk to `goal`: onto a tile, or up beside a mob
-/mob/living/basic/outpost_prison_guard/proc/queue_walk(datum/ai_controller/controller, atom/goal)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/queue_walk(datum/ai_controller/controller, atom/goal)
controller.set_blackboard_key(BB_OUTPOST_GUARD_GOAL, goal)
controller.queue_behavior(isturf(goal) ? /datum/ai_behavior/outpost_prison_guard_travel : /datum/ai_behavior/outpost_prison_guard_travel/approach, BB_OUTPOST_GUARD_GOAL)
@@ -253,7 +259,7 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
set_movement_target(controller, goal)
/datum/ai_behavior/outpost_prison_guard_travel/perform(seconds_per_tick, datum/ai_controller/controller, goal_key)
- var/mob/living/basic/outpost_prison_guard/guard = controller.pawn
+ var/mob/living/carbon/human/npc/outpost_prison_guard/guard = controller.pawn
var/atom/goal = controller.blackboard[goal_key]
if(QDELETED(goal) || !istype(guard))
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED
@@ -269,7 +275,7 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
. = ..()
controller.clear_blackboard_key(goal_key)
if(!succeeded)
- var/mob/living/basic/outpost_prison_guard/guard = controller.pawn
+ var/mob/living/carbon/human/npc/outpost_prison_guard/guard = controller.pawn
if(istype(guard))
guard.walk_failed(goal)
@@ -282,11 +288,11 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
action_cooldown = 1 SECONDS
/datum/ai_behavior/outpost_prison_guard_activity/setup(datum/ai_controller/controller)
- var/mob/living/basic/outpost_prison_guard/guard = controller.pawn
+ var/mob/living/carbon/human/npc/outpost_prison_guard/guard = controller.pawn
return istype(guard) && !!guard.activity
/datum/ai_behavior/outpost_prison_guard_activity/perform(seconds_per_tick, datum/ai_controller/controller)
- var/mob/living/basic/outpost_prison_guard/guard = controller.pawn
+ var/mob/living/carbon/human/npc/outpost_prison_guard/guard = controller.pawn
var/datum/outpost_guard_activity/doing = guard.activity
if(!doing || guard.response || !guard.on_duty())
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED
@@ -320,14 +326,14 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
var/max_duration = 90 SECONDS
/// Whether rounds or the other guard's chat may take its place
var/interruptible = TRUE
- var/mob/living/basic/outpost_prison_guard/guard
+ var/mob/living/carbon/human/npc/outpost_prison_guard/guard
/// Where they are headed: a tile, or a mob to stand beside; null once there
var/datum/weakref/goal_ref
var/started = FALSE
var/ends_at = 0
var/failed_moves = 0
-/datum/outpost_guard_activity/New(mob/living/basic/outpost_prison_guard/doer)
+/datum/outpost_guard_activity/New(mob/living/carbon/human/npc/outpost_prison_guard/doer)
. = ..()
guard = doer
@@ -377,7 +383,7 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
/// The other guard of the wing on the payroll, if any is here
/datum/outpost_guard_activity/proc/other_guard()
- for(var/mob/living/basic/outpost_prison_guard/other in guard.prison?.guard_mobs)
+ for(var/mob/living/carbon/human/npc/outpost_prison_guard/other in guard.prison?.guard_mobs)
if(other != guard && other.on_duty())
return other
return null
@@ -534,8 +540,8 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
/datum/outpost_guard_activity/watch_yard/tick(seconds)
var/obj/structure/hoop/hoop = hoop_ref?.resolve()
- var/mob/living/basic/outpost_prisoner/player
- for(var/mob/living/basic/outpost_prisoner/prisoner in guard.prison?.prisoners)
+ var/mob/living/carbon/human/npc/outpost_prisoner/player
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in guard.prison?.prisoners)
if(istype(prisoner.activity, /datum/prisoner_activity/basketball) && prisoner.stat == CONSCIOUS)
player = prisoner
break
@@ -600,7 +606,7 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
var/next_exchange = 0
/datum/outpost_guard_activity/chat/setup()
- var/mob/living/basic/outpost_prison_guard/other = other_guard()
+ var/mob/living/carbon/human/npc/outpost_prison_guard/other = other_guard()
if(!can_join(other))
return FALSE
partner_ref = WEAKREF(other)
@@ -608,13 +614,13 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
return TRUE
/// Whether the other guard is free to talk
-/datum/outpost_guard_activity/chat/proc/can_join(mob/living/basic/outpost_prison_guard/other)
+/datum/outpost_guard_activity/chat/proc/can_join(mob/living/carbon/human/npc/outpost_prison_guard/other)
if(!other?.on_duty() || !other.ai_running() || other.response)
return FALSE
return !other.activity || (other.activity.interruptible && !istype(other.activity, /datum/outpost_guard_activity/chat))
/datum/outpost_guard_activity/chat/arrive()
- var/mob/living/basic/outpost_prison_guard/partner = partner_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prison_guard/partner = partner_ref?.resolve()
if(!partner || !guard.Adjacent(partner) || !can_join(partner))
return FALSE
. = ..()
@@ -624,7 +630,7 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
next_exchange = world.time + 1 SECONDS
/datum/outpost_guard_activity/chat/tick(seconds)
- var/mob/living/basic/outpost_prison_guard/partner = partner_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prison_guard/partner = partner_ref?.resolve()
var/datum/outpost_guard_activity/chat/listen/listening = partner?.activity
if(!partner || !guard.Adjacent(partner) || !istype(listening) || listening.partner_ref?.resolve() != guard)
return GUARD_ACTIVITY_DONE
@@ -636,7 +642,7 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
return ..()
/datum/outpost_guard_activity/chat/finish()
- var/mob/living/basic/outpost_prison_guard/partner = partner_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prison_guard/partner = partner_ref?.resolve()
var/datum/outpost_guard_activity/chat/listen/listening = partner?.activity
if(istype(listening) && listening.partner_ref?.resolve() == guard)
partner.end_activity()
@@ -647,7 +653,7 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
leisure = FALSE
weight = 0
-/datum/outpost_guard_activity/chat/listen/New(mob/living/basic/outpost_prison_guard/doer, mob/living/basic/outpost_prison_guard/talker)
+/datum/outpost_guard_activity/chat/listen/New(mob/living/carbon/human/npc/outpost_prison_guard/doer, mob/living/carbon/human/npc/outpost_prison_guard/talker)
. = ..(doer)
partner_ref = WEAKREF(talker)
started = TRUE
@@ -661,7 +667,7 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
return TRUE
/datum/outpost_guard_activity/chat/listen/tick(seconds)
- var/mob/living/basic/outpost_prison_guard/talker = partner_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prison_guard/talker = partner_ref?.resolve()
var/datum/outpost_guard_activity/chat/talking = talker?.activity
if(!talker || !guard.Adjacent(talker) || !istype(talking) || talking.partner_ref?.resolve() != guard)
return GUARD_ACTIVITY_DONE
@@ -688,7 +694,7 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
/datum/outpost_guard_activity/check_on/setup()
var/datum/outpost_prison/prison = guard.prison
var/list/options = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prison.prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prison.prisoners)
if(prisoner.phase != PRISONER_PRESENT || !prisoner.routine_allowed() || prisoner.activity?.sleeping || !prison.in_cell_block(prisoner))
continue
if(prisoner.guard_noticed_at && world.time - prisoner.guard_noticed_at < OUTPOST_GUARD_CHECK_ON_GAP)
@@ -698,7 +704,7 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
options += prisoner
if(!length(options))
return FALSE
- var/mob/living/basic/outpost_prisoner/chosen = pick(options)
+ var/mob/living/carbon/human/npc/outpost_prisoner/chosen = pick(options)
prisoner_ref = WEAKREF(chosen)
need = chosen.bubble
chosen.guard_noticed_at = world.time
@@ -707,7 +713,7 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
/datum/outpost_guard_activity/check_on/begin()
. = ..()
- var/mob/living/basic/outpost_prisoner/prisoner = prisoner_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = prisoner_ref?.resolve()
if(!prisoner)
return
guard.face_atom(prisoner)
@@ -716,12 +722,132 @@ GLOBAL_LIST_INIT(outpost_guard_leisure, outpost_guard_leisure_types())
guard.prison?.note_speech()
/datum/outpost_guard_activity/check_on/tick(seconds)
- var/mob/living/basic/outpost_prisoner/prisoner = prisoner_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = prisoner_ref?.resolve()
if(!prisoner || !guard.Adjacent(prisoner))
return GUARD_ACTIVITY_DONE
guard.face_atom(prisoner)
return ..()
+// ----- patching up -----
+
+/**
+ * Hurt (OUTPOST_GUARD_TREAT_ABOVE brute and burn) with nothing going on: they treat themselves the way
+ * anyone does, with a bruise pack or suture on themselves (tg's medical stacks, their do_after and all).
+ * Their own pack first, else one from the wing's first-aid kit in the office, which the crew keeps stocked.
+ * Nothing heals them otherwise.
+ */
+/datum/outpost_guard_activity/patch_up
+ name = "patching up"
+ leisure = TRUE
+ weight = 0
+ min_duration = 20 SECONDS
+ max_duration = 30 SECONDS
+ interruptible = FALSE
+ /// The first-aid kit they are going to, if they have nothing of their own
+ var/datum/weakref/kit_ref
+
+/datum/outpost_guard_activity/patch_up/get_weight()
+ if(!guard.needs_patching() || guard.prison?.riot_active)
+ return 0
+ return 100
+
+/datum/outpost_guard_activity/patch_up/setup()
+ if(guard.carried_treatment())
+ return TRUE
+ var/obj/item/storage/medkit/kit = guard.prison?.guard_first_aid_kit()
+ if(!kit)
+ return FALSE
+ kit_ref = WEAKREF(kit)
+ set_goal(isturf(kit.loc) && guard.prison.guard_office_tile(kit.loc) ? kit.loc : guard.prison.guard_spot_beside(kit, guard))
+ return !!goal()
+
+/datum/outpost_guard_activity/patch_up/begin()
+ . = ..()
+ var/obj/item/storage/medkit/kit = kit_ref?.resolve()
+ if(kit && !guard.carried_treatment() && get_dist(guard, kit) <= 1)
+ guard.take_treatment_from(kit)
+ INVOKE_ASYNC(guard, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prison_guard, treat_self))
+
+/datum/outpost_guard_activity/patch_up/tick(seconds)
+ if(!guard.treating && !guard.needs_patching())
+ return GUARD_ACTIVITY_DONE
+ if(!guard.treating && guard.carried_treatment())
+ INVOKE_ASYNC(guard, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prison_guard, treat_self))
+ return ..()
+
+/datum/outpost_guard_activity/patch_up/Destroy()
+ kit_ref = null
+ return ..()
+
+/mob/living/carbon/human/npc/outpost_prison_guard
+ /// Busy putting a dressing on themselves
+ var/treating = FALSE
+
+/// Hurt enough to stop and patch up
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/needs_patching()
+ return getBruteLoss() + getFireLoss() >= OUTPOST_GUARD_TREAT_ABOVE
+
+/// A bruise pack, suture, ointment or mesh they carry that would do some good now
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/carried_treatment()
+ for(var/obj/item/stack/medical/stack in get_all_contents_type(/obj/item/stack/medical))
+ if(QDELETED(stack) || !stack.amount)
+ continue
+ if((stack.heal_brute && getBruteLoss()) || (stack.heal_burn && getFireLoss()))
+ return stack
+ return null
+
+/// Takes a pack out of the wing's first-aid kit into a free hand, as anyone would
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/take_treatment_from(obj/item/storage/medkit/kit)
+ for(var/obj/item/stack/medical/stack in kit)
+ if(!stack.amount || !((stack.heal_brute && getBruteLoss()) || (stack.heal_burn && getFireLoss())))
+ continue
+ if(!put_in_hands(stack))
+ return null
+ // Used up on them, never loot (human_npc_gear.dm)
+ npc_lock_item(stack)
+ return stack
+ return null
+
+/**
+ * Puts a dressing on themselves: a medical stack they carry, in a free hand, used on their own body
+ * through tg's medical code (the do_after, the limb it treats, the stack used up). Sleeps.
+ */
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/treat_self()
+ if(treating || stat != CONSCIOUS || !needs_patching())
+ return FALSE
+ var/obj/item/stack/medical/stack = carried_treatment()
+ if(!stack)
+ return FALSE
+ if(!is_holding(stack) && !human_npc_take_in_hand(src, stack))
+ set_baton(FALSE)
+ if(!human_npc_take_in_hand(src, stack))
+ return FALSE
+ if(!human_npc_ready_item(src, stack))
+ return FALSE
+ treating = TRUE
+ stack.interact_with_atom(src, src)
+ treating = FALSE
+ if(!QDELETED(stack) && is_holding(stack))
+ stack.equip_to_best_slot(src)
+ return TRUE
+
+/// The wing's first-aid kit in the office with something in it, if there is one
+/datum/outpost_prison/proc/guard_first_aid_kit()
+ for(var/turf/tile as anything in staff_ground)
+ if(tile.loc != wing)
+ continue
+ for(var/obj/item/storage/medkit/kit in tile)
+ if(locate(/obj/item/stack/medical) in kit)
+ return kit
+ return null
+
+/// A free office tile beside `thing`, for a guard to stand at, or null
+/datum/outpost_prison/proc/guard_spot_beside(atom/thing, mob/living/except)
+ for(var/turf/tile in orange(1, get_turf(thing)))
+ if(guard_office_tile(tile) && !guard_spot_taken(tile, except))
+ return tile
+ return null
+
#undef GUARD_ACTIVITY_CONTINUE
#undef GUARD_ACTIVITY_DONE
#undef GUARD_ACTIVITY_MOVE
diff --git a/voidcrew/modules/player_outposts/outpost_prison_guards.dm b/voidcrew/modules/player_outposts/outpost_prison_guards.dm
index 17a559bba63..48f53e41c70 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_guards.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_guards.dm
@@ -3,20 +3,27 @@
*
* Owner: XA (extras-plan.md 4.1). NPC guards the wing's managers hire at the warden's console:
* named people on the payroll who keep a peaceful routine, step in on spats, arguments, fights,
- * threats and hatch climbs, hold the staff doors in a riot, go down instead of dying and come
- * back free. Paid per minute while a member is home. Their routine and activities are in
+ * threats and hatch climbs, and hold the staff doors in a riot. Paid per minute while a member is home. Their routine and activities are in
* outpost_prison_guard_routine.dm; numbers in voidcrew/_DEFINES/outpost_prison_guards.dm.
*
- * Each hired guard is a record on the prison (name, rank, personality, when they are back). The
+ * A guard is a real human body (voidcrew/modules/human_npcs/, owner ruling OC-2): stuns, stamina,
+ * batons, bleeding, crit and death work on them as on anyone, and nothing tops their health up. Hurt,
+ * they patch themselves up with the office first-aid kit (outpost_prison_guard_routine.dm). In crit
+ * for OUTPOST_GUARD_RECALL_DELAY the corrections service medevacs the real body; a dead guard's body
+ * is collected OUTPOST_GUARD_BODY_COLLECT_DELAY after they die. Either way their record waits
+ * OUTPOST_GUARD_RETURN_TIME, then sends them back (the same face, from the record). Their kit is
+ * locked to them (D3): it never becomes loot.
+ *
+ * Each hired guard is a record on the prison (name, rank, personality, face, when they are back). The
* guard on the wing is a mob made from the record; when a guard goes down or is called away the
* mob beams out and the record waits to send them back. A slot's wait belongs to the prison, so
* dismissing a downed guard and hiring another does not skip it.
*
* Guards are security only: they never feed, clothe, treat, clean or light anything, so they
* cannot raise pay. They never strike players, pets, bots or other NPCs, and they strike a
- * prisoner only for violence under way (fighting, rioting, swinging, climbing out, loose) with a
- * stun baton that does stamina damage and nothing else. The strike never goes through
- * melee_attack(), so no hit is put down to staff.
+ * prisoner only for violence under way (fighting, rioting, swinging, climbing out, loose) with the
+ * real stun baton off their belt, through their own hands: tg's stamina, knockdown and cell charge.
+ * A prisoner never holds a guard's blow against staff (hit_by_staff()).
*
* The dispatcher (dispatch_guards()) runs every second from guards_tick() and only for guards whose
* AI is running, which it is only while a player is on the level. Every response has a proc a test
@@ -31,7 +38,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
/// Whether `thing` is one of a prison's NPC guards; with `on_duty`, only one present, arrived and not down
/proc/is_outpost_prison_guard(atom/thing, on_duty = FALSE)
- var/mob/living/basic/outpost_prison_guard/guard = thing
+ var/mob/living/carbon/human/npc/outpost_prison_guard/guard = thing
if(!istype(guard))
return FALSE
return !on_duty || guard.on_duty()
@@ -42,34 +49,17 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
// ===== THE GUARD =====
-/mob/living/basic/outpost_prison_guard
+/mob/living/carbon/human/npc/outpost_prison_guard
name = "guard"
desc = "A corrections officer on the prison wing's payroll."
- icon = 'icons/mob/simple/simple_human.dmi'
- unique_name = FALSE
combat_mode = FALSE
- mob_biotypes = MOB_ORGANIC | MOB_HUMANOID
- // No sentience potions, no lazarus.
- sentience_type = SENTIENCE_HUMANOID
- maxHealth = OUTPOST_GUARD_HEALTH
- health = OUTPOST_GUARD_HEALTH
- speed = OUTPOST_GUARD_SPEED_WALK
- // Nobody drags or shoves them about.
- move_resist = MOVE_FORCE_VERY_STRONG
- density = TRUE
- basic_mob_flags = NONE
- mobility_flags = MOBILITY_FLAGS_REST_CAPABLE_DEFAULT
- rotate_on_lying = TRUE
- // No stuns or knockdowns: a guard is up or down (go_down()), nothing between.
- status_flags = NONE
- damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, STAMINA = 0, OXY = 0)
- // A breach or a fire in the wing must not kill them.
- unsuitable_atmos_damage = 0
- unsuitable_cold_damage = 0
- unsuitable_heat_damage = 0
- response_help_continuous = "pats"
- response_help_simple = "pat"
+ faction = list(FACTION_NEUTRAL)
ai_controller = /datum/ai_controller/basic_controller/outpost_prison_guard
+ npc_outfit = /datum/outfit/outpost_prison_guard
+ // They stop once a prisoner is down (defaults 1.13), and only ever go for prisoners.
+ npc_target_stat = HUMAN_NPC_SPARES_DOWNED
+ // The corrections service collects a guard's body (guards_tick()); the base never cleans it up.
+ npc_corpse_lifetime = 0
/// The prison that hired them
var/datum/outpost_prison/prison
@@ -91,10 +81,14 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
var/list/response_skips
/// Whether the stun baton is out in their hand
var/baton_out = FALSE
+ /// world.time they went down (crit) or died, for the medevac and the body's collection
+ var/down_since = 0
/// The last thing they said, so they don't repeat it at once
var/last_line
/// Down: seconds until they are beamed out
var/down_left = 0
+ /// Killed rather than downed: the body is collected, and the record's wait starts after
+ var/died_on_duty = FALSE
/// Dismissed: seconds left to walk to the office before they beam out wherever they are
var/dismiss_left = 0
/// Dismissed: where they walk to before beaming out
@@ -107,10 +101,8 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
/// Between "Hey. Don't." lines
COOLDOWN_DECLARE(warned_cooldown)
-/mob/living/basic/outpost_prison_guard/Initialize(mapload)
- gender = pick(MALE, FEMALE)
- . = ..()
- AddElement(/datum/element/footstep, footstep_type = FOOTSTEP_MOB_SHOE)
+/mob/living/carbon/human/npc/outpost_prison_guard/Initialize(mapload)
+ . = ..(mapload)
AddElement(/datum/element/relay_attackers)
RegisterSignal(src, COMSIG_ATOM_WAS_ATTACKED, PROC_REF(on_attacked))
// Nothing moves a guard but their own feet and the prison's beam.
@@ -118,13 +110,12 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
RegisterSignal(src, COMSIG_LIVING_PRE_WABBAJACKED, PROC_REF(refuse_polymorph))
RegisterSignal(src, COMSIG_PRE_MOB_CHANGED_TYPE, PROC_REF(refuse_type_change))
RegisterSignal(src, COMSIG_MOUSEDROP_ONTO, PROC_REF(block_being_dragged))
- RegisterSignal(src, COMSIG_ATOM_CAN_BE_PULLED, PROC_REF(refuse_pull))
- ADD_TRAIT(src, TRAIT_NO_CONTAINMENT, INNATE_TRAIT)
- ADD_TRAIT(src, TRAIT_NO_STORAGE_INSERT, INNATE_TRAIT)
- // Next tick: spawn_guard() calls join() right after new, which sets the record's gender and face.
- addtimer(CALLBACK(src, PROC_REF(guard_build_look)), 1)
+ // On their feet nobody boxes or bags them; down or dead they are a body like anyone's (set_guard_upright()).
+ // Anyone can drag a guard who is down. A guard on their feet shakes off anyone but the wing's members (guards_tick()).
+ set_guard_upright(TRUE)
+ set_prison_pace(hurry = FALSE)
-/mob/living/basic/outpost_prison_guard/Destroy()
+/mob/living/carbon/human/npc/outpost_prison_guard/Destroy()
end_response(cancel_ai = FALSE)
end_activity(cancel_ai = FALSE)
if(record?.guard == src)
@@ -138,120 +129,158 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
leave_spot = null
return ..()
-/// Dresses them as their own person in the guard's outfit (outpost_npc_looks.dm): the record's face and gender. Can sleep.
-/mob/living/basic/outpost_prison_guard/proc/guard_build_look()
- set_outpost_npc_look(src, /datum/outfit/outpost_prison_guard, gender, record ? record.look_number : 1)
- if(QDELETED(src))
- return
- update_appearance(UPDATE_OVERLAYS)
-
-/// Takes on the name, rank, gender and personality of the guard on the payroll
-/mob/living/basic/outpost_prison_guard/proc/join(datum/outpost_prison/owner, datum/outpost_guard_record/hired)
+/// Takes on the name, rank, face and personality of the guard on the payroll. The first one sent sets the record's face.
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/join(datum/outpost_prison/owner, datum/outpost_guard_record/hired)
prison = owner
record = hired
hired.guard = src
owner.guard_mobs |= src
- gender = hired.gender
+ if(length(hired.look))
+ outpost_prison_apply_look(src, hired.look)
+ else
+ hired.look = outpost_prison_save_look(src)
+ hired.gender = gender
personality = hired.personality
- real_name = hired.full_name()
- name = real_name
+ fully_replace_character_name(real_name, hired.full_name())
-/// On the wing and on duty: arrived, not down, not dismissed, and not paid by the kingpin to stand back (outpost_prison_boss_moves.dm)
-/mob/living/basic/outpost_prison_guard/proc/on_duty()
- return !QDELETED(src) && phase == OUTPOST_GUARD_PRESENT && stat == CONSCIOUS && !boss_bribed()
+/// On the wing and on duty: arrived, not down, cuffed or stunned, not dismissed, and not paid by the kingpin to stand back (outpost_prison_boss_moves.dm)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/on_duty()
+ return !QDELETED(src) && phase == OUTPOST_GUARD_PRESENT && stat == CONSCIOUS && !human_npc_out_of_fight(src) && !boss_bribed()
/// Whether their AI is running, which it is only while someone is on the level to see them (see outpost_prison_ai_running())
-/mob/living/basic/outpost_prison_guard/proc/ai_running()
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/ai_running()
return outpost_prison_ai_running(src)
-/mob/living/basic/outpost_prison_guard/update_overlays()
- . = ..()
- if(!baton_out || phase == OUTPOST_GUARD_DOWN)
- return
- // The lit baton in hand, the way a security officer holds one, turning with them
- var/mutable_appearance/baton = mutable_appearance('icons/mob/inhands/equipment/security_righthand.dmi', "stunbaton_active")
- baton.plane = FLOAT_PLANE
- baton.layer = FLOAT_LAYER
- . += baton
-
-/// Draws or puts away the baton
-/mob/living/basic/outpost_prison_guard/proc/set_baton(out)
+/// Their stun baton, wherever on them it is
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/get_baton()
+ return locate(/obj/item/melee/baton/security) in get_all_contents()
+
+/// Draws the baton off the belt into a hand and switches it on, or puts it away again, as an officer does
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/set_baton(out)
out = !!out
- if(baton_out == out)
+ var/obj/item/melee/baton/security/baton = get_baton()
+ if(!baton)
+ baton_out = FALSE
+ return
+ if(out)
+ if(!is_holding(baton) && !human_npc_take_in_hand(src, baton))
+ return
+ if(!baton.active && baton.cell?.charge >= baton.cell_hit_cost)
+ baton.attack_self(src)
+ baton_out = TRUE
return
- baton_out = out
- update_appearance(UPDATE_OVERLAYS)
+ baton_out = FALSE
+ if(!is_holding(baton))
+ return
+ if(baton.active)
+ baton.attack_self(src)
+ if(!equip_to_slot_if_possible(baton, ITEM_SLOT_BELT, disable_warning = TRUE))
+ baton.equip_to_best_slot(src)
// ===== REFUSALS =====
-/mob/living/basic/outpost_prison_guard/proc/refuse_teleport(datum/source, atom/destination, channel)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/refuse_teleport(datum/source, atom/destination, channel)
SIGNAL_HANDLER
if(isturf(loc))
visible_message(span_notice("[src] flickers for a moment, but stays where [p_they()] [p_are()]."))
return TRUE
-/mob/living/basic/outpost_prison_guard/proc/refuse_polymorph(datum/source, what_to_randomize)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/refuse_polymorph(datum/source, what_to_randomize)
SIGNAL_HANDLER
visible_message(span_notice("[src] shimmers for a moment, then looks the same as before."))
return STOP_WABBAJACK
-/mob/living/basic/outpost_prison_guard/proc/refuse_type_change(datum/source)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/refuse_type_change(datum/source)
SIGNAL_HANDLER
return COMPONENT_BLOCK_MOB_CHANGE
-/mob/living/basic/outpost_prison_guard/proc/block_being_dragged(atom/over, mob/user)
- SIGNAL_HANDLER
- return COMPONENT_CANCEL_MOUSEDROP_ONTO
+/// On their feet they refuse lockers and bags; down or dead, a body can be bagged like anyone's
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/set_guard_upright(upright)
+ if(upright)
+ add_traits(list(TRAIT_NO_CONTAINMENT, TRAIT_NO_STORAGE_INSERT), OUTPOST_GUARD_UPRIGHT_TRAIT)
+ else
+ remove_traits(list(TRAIT_NO_CONTAINMENT, TRAIT_NO_STORAGE_INSERT), OUTPOST_GUARD_UPRIGHT_TRAIT)
-/mob/living/basic/outpost_prison_guard/proc/refuse_pull(datum/source, mob/living/puller)
+/// Not dragged onto things while on their feet
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/block_being_dragged(atom/over, mob/user)
SIGNAL_HANDLER
- return COMSIG_ATOM_CANT_PULL
+ return stat == CONSCIOUS && phase == OUTPOST_GUARD_PRESENT ? COMPONENT_CANCEL_MOUSEDROP_ONTO : NONE
-// ===== HURT AND DOWN =====
+/// On their feet, a guard won't be led about by anyone but the wing's members: they resist it, as anyone resists a pull
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/shake_off_pull()
+ if(!pulledby || !on_duty() || world.time < next_move)
+ return
+ if(isliving(pulledby) && prison?.is_member(pulledby))
+ return
+ execute_resist()
+
+// ===== HURT, DOWN AND DEAD =====
/**
- * Damage never takes a guard below OUTPOST_GUARD_DOWN_AT: at that point they go down instead,
- * and while down nothing hurts them (TRAIT_GODMODE). Forced damage is held to the same floor.
+ * Into crit: they go down. The corrections service medevacs the real body after
+ * OUTPOST_GUARD_RECALL_DELAY (guards_tick()); treated and back out of crit before then, they are back on duty.
*/
-/mob/living/basic/outpost_prison_guard/adjust_health(amount, updating_health = TRUE, forced = FALSE)
- var/floor_loss = maxHealth - OUTPOST_GUARD_DOWN_AT
- if(amount > 0)
- if(phase == OUTPOST_GUARD_DOWN || phase == OUTPOST_GUARD_LEAVING || bruteloss >= floor_loss)
- return 0
- amount = min(amount, floor_loss - bruteloss)
+/mob/living/carbon/human/npc/outpost_prison_guard/npc_on_downed()
. = ..()
- if(bruteloss >= floor_loss && prison)
- INVOKE_ASYNC(src, PROC_REF(go_down))
+ go_down()
-/// Guards never die: whatever would kill one puts them down instead
-/mob/living/basic/outpost_prison_guard/death(gibbed)
- if(!gibbed && prison && phase != OUTPOST_GUARD_LEAVING)
- go_down()
+/// Back out of crit before the medevac came: on their feet and on duty again
+/mob/living/carbon/human/npc/outpost_prison_guard/npc_on_recovered()
+ . = ..()
+ if(phase != OUTPOST_GUARD_DOWN || died_on_duty || stat == DEAD || HAS_TRAIT(src, TRAIT_CRITICAL_CONDITION))
return
- return ..()
+ phase = OUTPOST_GUARD_PRESENT
+ down_left = 0
+ down_since = 0
+ set_guard_upright(TRUE)
+ prison?.add_log("[real_name] is back on [p_their()] feet.")
+
+/// The prison's guards speak from their own file (say_guard()); a few of tg's changes map onto their lines.
+/mob/living/carbon/human/npc/outpost_prison_guard/npc_bark(kind, force = FALSE)
+ switch(kind)
+ if(HUMAN_NPC_BARK_DOWNED)
+ return say_guard("downed")
+ return FALSE
+
+/mob/living/carbon/human/npc/outpost_prison_guard/death(gibbed)
+ var/was_alive = stat != DEAD
+ . = ..()
+ if(!was_alive || stat != DEAD)
+ return
+ died_on_duty = TRUE
+ set_guard_upright(FALSE)
+ if(phase == OUTPOST_GUARD_LEAVING || !prison)
+ return
+ end_response()
+ end_activity()
+ baton_out = FALSE
+ phase = OUTPOST_GUARD_DOWN
+ down_since = world.time
+ down_left = OUTPOST_GUARD_BODY_COLLECT_DELAY / (1 SECONDS)
+ prison.guard_killed(src)
/**
- * Down: lying there, nothing more can hurt them, and OUTPOST_GUARD_RECALL_DELAY later they are
- * beamed out, to come back free OUTPOST_GUARD_RETURN_TIME after that (guards_tick()).
+ * Down in crit: lying there, and OUTPOST_GUARD_RECALL_DELAY later the corrections service medevacs the
+ * body, to send them back OUTPOST_GUARD_RETURN_TIME after that (guards_tick()). Nothing protects them
+ * meanwhile: they can bleed out, or be finished off.
*/
-/mob/living/basic/outpost_prison_guard/proc/go_down()
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/go_down()
if(QDELETED(src) || phase == OUTPOST_GUARD_DOWN || phase == OUTPOST_GUARD_LEAVING)
return FALSE
var/was_leaving = phase == OUTPOST_GUARD_DISMISSED
phase = OUTPOST_GUARD_DOWN
end_response()
end_activity()
- set_baton(FALSE)
- ADD_TRAIT(src, TRAIT_GODMODE, OUTPOST_GUARD_DOWN_TRAIT)
- add_traits(list(TRAIT_FLOORED, TRAIT_IMMOBILIZED, TRAIT_INCAPACITATED), OUTPOST_GUARD_DOWN_TRAIT)
+ baton_out = FALSE
+ set_guard_upright(FALSE)
+ down_since = world.time
down_left = was_leaving ? 0 : OUTPOST_GUARD_RECALL_DELAY / (1 SECONDS)
visible_message(span_danger("[src] goes down!"))
- say_guard("downed")
prison?.add_log("[real_name] went down.")
return TRUE
/// Someone took a swing at them. Prisoners are the dispatcher's business; anyone else gets a warning and some room.
-/mob/living/basic/outpost_prison_guard/proc/on_attacked(datum/source, atom/attacker, attack_flags)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/on_attacked(datum/source, atom/attacker, attack_flags)
SIGNAL_HANDLER
if(!(attack_flags & (ATTACKER_DAMAGING_ATTACK | ATTACKER_STAMINA_ATTACK | ATTACKER_SHOVING)))
return
@@ -260,7 +289,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
INVOKE_ASYNC(src, PROC_REF(warn_off), attacker)
/// "Hey. Don't." and a step back. Guards never strike players.
-/mob/living/basic/outpost_prison_guard/proc/warn_off(atom/attacker)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/warn_off(atom/attacker)
if(!on_duty() || QDELETED(attacker))
return FALSE
if(!COOLDOWN_FINISHED(src, warned_cooldown))
@@ -273,12 +302,6 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
log_combat(attacker, src, "attacked a prison guard")
return TRUE
-/// Healing slowly while nothing is going on
-/mob/living/basic/outpost_prison_guard/proc/heal_tick(seconds)
- if(phase != OUTPOST_GUARD_PRESENT || bruteloss <= 0 || prison?.riot_active)
- return
- adjust_health(-OUTPOST_GUARD_HEAL_PER_MINUTE * seconds / 60)
-
// ===== BEAMING IN AND OUT =====
/**
@@ -286,7 +309,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
* the whole beam. They stay OUTPOST_GUARD_ARRIVING (held still, no routine, no responses, no
* speech) until finish_beam_in() as the beam ends.
*/
-/mob/living/basic/outpost_prison_guard/proc/beam_in()
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/beam_in()
phase = OUTPOST_GUARD_ARRIVING
ADD_TRAIT(src, TRAIT_IMMOBILIZED, OUTPOST_GUARD_BEAM_TRAIT)
var/turf/spot = get_turf(src)
@@ -298,7 +321,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
addtimer(CALLBACK(src, PROC_REF(finish_beam_in)), OUTPOST_PRISON_BEAM_TIME)
/// Fully there as the beam ends: the flash, and only now are they on duty, and say so
-/mob/living/basic/outpost_prison_guard/proc/finish_beam_in()
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/finish_beam_in()
if(phase != OUTPOST_GUARD_ARRIVING)
return FALSE
var/turf/spot = get_turf(src)
@@ -318,7 +341,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
* Dematerialises them and deletes them at the end of the beam. Their record, if they are still on
* the payroll, sends them back after `away_seconds` (guards_tick()).
*/
-/mob/living/basic/outpost_prison_guard/proc/beam_out(away_seconds = 0)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/beam_out(away_seconds = 0)
if(phase == OUTPOST_GUARD_LEAVING)
return FALSE
phase = OUTPOST_GUARD_LEAVING
@@ -339,7 +362,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
addtimer(CALLBACK(src, PROC_REF(finish_beam_out)), OUTPOST_PRISON_BEAM_TIME)
return TRUE
-/mob/living/basic/outpost_prison_guard/proc/finish_beam_out()
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/finish_beam_out()
var/turf/spot = get_turf(src)
if(spot)
new /obj/effect/temp_visual/transporter_flash/departure(spot)
@@ -348,7 +371,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
qdel(src)
/// Called back from somewhere they should not be (off the wing's level, or out of the wing with nobody about)
-/mob/living/basic/outpost_prison_guard/proc/recall(away_seconds = OUTPOST_GUARD_OFF_LEVEL_AWAY)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/recall(away_seconds = OUTPOST_GUARD_OFF_LEVEL_AWAY)
if(phase != OUTPOST_GUARD_PRESENT)
return FALSE
say_guard("recalled")
@@ -359,7 +382,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
* Off the payroll: they say `context`, walk back to the office and beam out there, or wherever
* they are after OUTPOST_GUARD_DISMISS_WALK seconds. Down or arriving, they beam out at once.
*/
-/mob/living/basic/outpost_prison_guard/proc/leave(context = "dismissed")
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/leave(context = "dismissed")
if(phase == OUTPOST_GUARD_LEAVING || phase == OUTPOST_GUARD_DISMISSED)
return FALSE
if(phase != OUTPOST_GUARD_PRESENT || stat != CONSCIOUS)
@@ -368,7 +391,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
end_response()
end_activity()
set_baton(FALSE)
- set_varspeed(OUTPOST_GUARD_SPEED_WALK)
+ set_prison_pace(hurry = FALSE)
say_guard(context)
dismiss_left = OUTPOST_GUARD_DISMISS_WALK
leave_spot = prison?.guard_office_spot(src)
@@ -377,7 +400,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
// ===== SPEECH =====
/// A line for `context` in their personality (or anyone's), with `values` filled in, or null
-/mob/living/basic/outpost_prison_guard/proc/pick_guard_line(context, list/values)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/pick_guard_line(context, list/values)
var/list/guard_lines = outpost_guard_dialogue("guard_lines")
var/list/by_personality = guard_lines[context]
if(!islist(by_personality))
@@ -396,7 +419,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
return line
/// The lines of `pool` that are not the last thing they said and need no placeholder `values` lacks
-/mob/living/basic/outpost_prison_guard/proc/usable_guard_lines(list/pool, list/values)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/usable_guard_lines(list/pool, list/values)
var/list/usable = list()
for(var/line in pool)
if(!istext(line) || line == last_line)
@@ -411,7 +434,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
return usable
/// Says a line for `context`. Returns TRUE if they said something. Never while beaming in or out, invisible or half there.
-/mob/living/basic/outpost_prison_guard/proc/say_guard(context, list/values)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/say_guard(context, list/values)
if(QDELETED(src) || stat == DEAD || phase == OUTPOST_GUARD_ARRIVING || phase == OUTPOST_GUARD_LEAVING)
return FALSE
var/line = pick_guard_line(context, values)
@@ -422,7 +445,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
return TRUE
/// An idle line: waits for the wing to be quiet and for their own pause, and counts toward the wing's
-/mob/living/basic/outpost_prison_guard/proc/idle_say(context, list/values)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/idle_say(context, list/values)
if(!prison?.wing_can_speak() || !COOLDOWN_FINISHED(src, speech_cooldown))
return FALSE
if(!say_guard(context, values))
@@ -438,7 +461,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
* and making violent trouble right now (rioting, breaking out, fighting with blows, swinging at
* someone or having just struck someone, climbing out, or loose). Never a calm or downed prisoner.
*/
-/mob/living/basic/outpost_prison_guard/proc/may_strike(mob/living/basic/outpost_prisoner/prisoner)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/may_strike(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(!on_duty() || !is_outpost_prisoner(prisoner) || QDELETED(prisoner) || !prison || prisoner.prison != prison)
return FALSE
if(prisoner.stat != CONSCIOUS || prisoner.phase != PRISONER_PRESENT || prisoner.can_be_dragged() || !Adjacent(prisoner))
@@ -451,29 +474,47 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
return prisoner.guard_struck_recently()
/**
- * One stun baton strike: OUTPOST_GUARD_BATON_STAMINA stamina, their blows stop, and every prisoner
- * who sees it loses a little mood. Not an attack in tg's sense (no relay_attackers, no
- * hit_by_staff()), so it is never held against staff and never hurts. Returns TRUE if it landed.
+ * One strike with the real stun baton off their belt, through their own hands: tg's baton does its
+ * stamina damage and knockdown, against the prisoner's armour, off the cell's charge. Their blows stop,
+ * and every prisoner who sees it loses a little mood. A prisoner never holds a guard's blow against staff
+ * (hit_by_staff()). Returns TRUE if they swung.
*/
-/mob/living/basic/outpost_prison_guard/proc/strike(mob/living/basic/outpost_prisoner/prisoner)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/strike(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(!COOLDOWN_FINISHED(src, baton_cooldown) || !may_strike(prisoner))
return FALSE
- COOLDOWN_START(src, baton_cooldown, OUTPOST_GUARD_BATON_COOLDOWN)
+ var/obj/item/melee/baton/security/baton = get_baton()
+ // A flat cell would make it a club, and guards never hurt anyone: they go to change it (baton_flat()).
+ if(!baton || !baton.cell || baton.cell.charge < baton.cell_hit_cost)
+ baton_flat()
+ return FALSE
set_baton(TRUE)
- face_atom(prisoner)
- do_attack_animation(prisoner)
- playsound(prisoner, 'sound/items/weapons/egloves.ogg', 50, TRUE)
- prisoner.visible_message(span_danger("[src] strikes [prisoner] with a stun baton!"), span_userdanger("[src] strikes you with a stun baton!"))
- prisoner.apply_damage(OUTPOST_GUARD_BATON_STAMINA, STAMINA)
+ // The baton recharges between stuns, as anyone's does.
+ if(!is_holding(baton) || !baton.active || !COOLDOWN_FINISHED(baton, cooldown_check))
+ return FALSE
+ COOLDOWN_START(src, baton_cooldown, OUTPOST_GUARD_BATON_COOLDOWN)
+ if(!outpost_prison_npc_hit(src, prisoner, baton))
+ return FALSE
prisoner.stop_blows()
prison.guard_strike_seen(prisoner, src)
return TRUE
+/**
+ * Their baton's cell is flat. The office recharger can't take a baton that is locked to its guard
+ * (human_npc_gear.dm), so the corrections service swaps the shift: they say so and beam out, and the
+ * record sends them back with a charged baton after OUTPOST_GUARD_SHIFT_SWAP_TIME. Their wages stop meanwhile.
+ */
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/baton_flat()
+ if(phase != OUTPOST_GUARD_PRESENT || !prison)
+ return FALSE
+ say_guard("recalled")
+ prison.add_log("[real_name]'s baton went flat. [p_They()] went to swap shifts.")
+ return beam_out(OUTPOST_GUARD_SHIFT_SWAP_TIME / (1 SECONDS))
+
/// Strikes a rioter beside them. Returns TRUE if they struck.
-/mob/living/basic/outpost_prison_guard/proc/strike_adjacent_rioter()
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/strike_adjacent_rioter()
if(!COOLDOWN_FINISHED(src, baton_cooldown))
return FALSE
- for(var/mob/living/basic/outpost_prisoner/rioter in orange(1, src))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/rioter in orange(1, src))
if(rioter.is_rioting() && strike(rioter))
return TRUE
return FALSE
@@ -481,29 +522,29 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
// ===== RESPONSES =====
/// Sends them to deal with something, dropping their routine
-/mob/living/basic/outpost_prison_guard/proc/give_response(kind, priority, key, atom/target, turf/spot)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/give_response(kind, priority, key, atom/target, turf/spot)
end_response(cancel_ai = FALSE)
end_activity(cancel_ai = FALSE)
response = new(kind, key, priority, target, spot)
response.expires_at = world.time + OUTPOST_GUARD_RESPONSE_TIMEOUT
- set_varspeed(OUTPOST_GUARD_SPEED_HURRY)
+ set_prison_pace(hurry = TRUE)
set_baton(TRUE)
ai_controller?.CancelActions()
return response
/// Back to routine
-/mob/living/basic/outpost_prison_guard/proc/end_response(cancel_ai = TRUE)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/end_response(cancel_ai = TRUE)
if(!response)
return
QDEL_NULL(response)
if(!QDELETED(src))
- set_varspeed(OUTPOST_GUARD_SPEED_WALK)
+ set_prison_pace(hurry = FALSE)
set_baton(FALSE)
if(cancel_ai)
ai_controller?.CancelActions()
/// Whether they gave up on an incident recently
-/mob/living/basic/outpost_prison_guard/proc/skipping(key)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/skipping(key)
return LAZYACCESS(response_skips, key) > world.time
/**
@@ -511,7 +552,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
* the AI walks them to) and, once there, acts. Called by the dispatcher every second. Returns
* TRUE while the response goes on.
*/
-/mob/living/basic/outpost_prison_guard/proc/perform_response()
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/perform_response()
var/datum/outpost_guard_response/job = response
if(!job)
return FALSE
@@ -545,7 +586,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
return TRUE
/// Whether they stand where a response wants them: beside a mob, or on a tile
-/mob/living/basic/outpost_prison_guard/proc/at_goal(atom/goal)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/at_goal(atom/goal)
if(!goal)
return TRUE
if(isturf(goal))
@@ -557,13 +598,13 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
* it down (the prison's guard_talkdown_chance); once blows fly, "Break it up!", then the baton on
* the first fighter every OUTPOST_GUARD_BATON_COOLDOWN until the fight is over.
*/
-/mob/living/basic/outpost_prison_guard/proc/fight_response(datum/outpost_guard_response/job)
- var/mob/living/basic/outpost_prisoner/fighter = job.target()
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/fight_response(datum/outpost_guard_response/job)
+ var/mob/living/carbon/human/npc/outpost_prisoner/fighter = job.target()
var/datum/outpost_prison_fight/brawl = fighter?.fight
if(QDELETED(brawl))
return TRUE
- var/mob/living/basic/outpost_prisoner/other = brawl.opponent_of(fighter)
- var/mob/living/basic/outpost_prisoner/beside = Adjacent(fighter) ? fighter : ((other && Adjacent(other)) ? other : null)
+ var/mob/living/carbon/human/npc/outpost_prisoner/other = brawl.opponent_of(fighter)
+ var/mob/living/carbon/human/npc/outpost_prisoner/beside = Adjacent(fighter) ? fighter : ((other && Adjacent(other)) ? other : null)
if(!beside)
job.set_goal(fighter)
return FALSE
@@ -595,8 +636,8 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
* decided to swing, or struck someone in the last OUTPOST_GUARD_STRUCK_RECENT, gets the baton
* after the warning instead, until they stop.
*/
-/mob/living/basic/outpost_prison_guard/proc/threat_response(datum/outpost_guard_response/job)
- var/mob/living/basic/outpost_prisoner/prisoner = job.target()
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/threat_response(datum/outpost_guard_response/job)
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = job.target()
if(!prisoner || prisoner.stat != CONSCIOUS || prisoner.phase != PRISONER_PRESENT || prisoner.can_be_dragged() || prisoner.trouble)
return TRUE
var/violent = prisoner.swing_ref || prisoner.guard_struck_recently()
@@ -622,8 +663,8 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
return FALSE
/// A prisoner climbing over a serving hatch: to the hatch's office side, "Get down off that!", and down they slide
-/mob/living/basic/outpost_prison_guard/proc/climb_response(datum/outpost_guard_response/job)
- var/mob/living/basic/outpost_prisoner/climber = job.target()
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/climb_response(datum/outpost_guard_response/job)
+ var/mob/living/carbon/human/npc/outpost_prisoner/climber = job.target()
var/obj/structure/table/reinforced/prison_hatch/hatch = climber?.climb_ref?.resolve()
if(!hatch)
return TRUE
@@ -647,7 +688,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
* OUTPOST_GUARD_FOLLOW_RANGE of them and go for any rioter at them. Otherwise they hold the staff
* door from the office. They baton any rioter beside them whatever they are doing.
*/
-/mob/living/basic/outpost_prison_guard/proc/riot_response(datum/outpost_guard_response/job)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/riot_response(datum/outpost_guard_response/job)
if(!prison.riot_active)
return TRUE
job.reached = TRUE
@@ -657,7 +698,9 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
job.spot = prison.guard_fallback_spot(src)
say_guard("fallback")
job.set_goal((job.spot && loc != job.spot) ? job.spot : null)
- strike_adjacent_rioter()
+ if(!strike_adjacent_rioter() && (!job.spot || loc == job.spot))
+ // Back in the corner, they patch themselves up from the office's first-aid kit (outpost_prison_guard_routine.dm).
+ INVOKE_ASYNC(src, PROC_REF(treat_self))
return FALSE
var/mob/living/member = prison.guard_member_in_cell_block()
if(member)
@@ -665,7 +708,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
job.mode = "follow"
job.spot = null
say_guard("follow_member", list("{boss}" = prison.guard_boss_name(member)))
- var/mob/living/basic/outpost_prisoner/attacker = prison.rioter_beside(member)
+ var/mob/living/carbon/human/npc/outpost_prisoner/attacker = prison.rioter_beside(member)
if(attacker && !Adjacent(attacker))
job.set_goal(attacker)
else if(get_dist(src, member) > OUTPOST_GUARD_FOLLOW_RANGE)
@@ -690,7 +733,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
* cell block that the other guard is not holding, the tiles to its sides first so the doorway
* itself stays clear for the crew. Sets it as their response's spot. Returns it, or null.
*/
-/mob/living/basic/outpost_prison_guard/proc/take_hold_position()
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/take_hold_position()
if(!prison)
return null
for(var/turf/spot as anything in prison.guard_hold_spots())
@@ -705,7 +748,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
* it is dead, taken or shut in. They never strike the creatures. The rest of an experiment (the dose,
* the incubation, the slug in the vents) is no reason to leave the yard to itself.
*/
-/mob/living/basic/outpost_prison_guard/proc/shelter_response(datum/outpost_guard_response/job)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/shelter_response(datum/outpost_guard_response/job)
if(!prison.creature_out())
return TRUE
job.reached = TRUE
@@ -715,7 +758,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
return FALSE
/// Wandered out of the wing: back to the office
-/mob/living/basic/outpost_prison_guard/proc/leash_response(datum/outpost_guard_response/job)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/leash_response(datum/outpost_guard_response/job)
if(get_area(src) == prison.wing)
outside_seconds = 0
return TRUE
@@ -728,14 +771,14 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
// ===== THE PRISONER'S SIDE =====
-/mob/living/basic/outpost_prisoner
+/mob/living/carbon/human/npc/outpost_prisoner
/// world.time a guard last checked on them, or they last said hello to a guard
var/guard_noticed_at = 0
/// world.time they last lost mood seeing a guard's baton
var/guard_onlooker_at = 0
/// Whether they struck someone (not another prisoner) in the last OUTPOST_GUARD_STRUCK_RECENT
-/mob/living/basic/outpost_prisoner/proc/guard_struck_recently()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/guard_struck_recently()
return struck_at && world.time - struck_at <= OUTPOST_GUARD_STRUCK_RECENT && !isnull(struck_ref?.resolve())
// ===== THE PAYROLL =====
@@ -744,28 +787,28 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
/datum/outpost_guard_record
var/datum/outpost_prison/prison
/// The guard on the wing now, if any
- var/mob/living/basic/outpost_prison_guard/guard
+ var/mob/living/carbon/human/npc/outpost_prison_guard/guard
/// "Officer" or "Sergeant"
var/rank = "Officer"
var/surname = "Hale"
var/gender = MALE
var/personality = "by_the_book"
- /// Which face they have (set_outpost_npc_look())
- var/look_number = 1
+ /// Their face, saved from the first body sent (outpost_prison_save_look()), so the same person comes back
+ var/list/look
/// An admin's guard: no fee, no wage, not counted against guard_max()
var/free = FALSE
var/dismissed = FALSE
/// Seconds until they are sent back while away (down, recalled); they come only while a member is home
var/away_left = 0
/// What the guard is made as (tests use a subtype)
- var/guard_type = /mob/living/basic/outpost_prison_guard
+ var/guard_type = /mob/living/carbon/human/npc/outpost_prison_guard
/datum/outpost_guard_record/New(datum/outpost_prison/owner, rank, free = FALSE, guard_type)
. = ..()
prison = owner
src.rank = rank
src.free = free
- if(ispath(guard_type, /mob/living/basic/outpost_prison_guard))
+ if(ispath(guard_type, /mob/living/carbon/human/npc/outpost_prison_guard))
src.guard_type = guard_type
gender = pick(MALE, FEMALE)
if(length(GLOB.last_names))
@@ -773,7 +816,6 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
var/list/personalities = outpost_guard_dialogue("guard_personalities")
if(length(personalities))
personality = pick(personalities)
- look_number = random_outpost_npc_look_number()
/datum/outpost_guard_record/Destroy()
if(guard?.record == src)
@@ -789,7 +831,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
/// Seconds before this slot could have a guard on the wing again: the down time and the return, or the time still away
/datum/outpost_guard_record/proc/pending_wait()
if(guard)
- return guard.phase == OUTPOST_GUARD_DOWN ? guard.down_left + OUTPOST_GUARD_RETURN_TIME / (1 SECONDS) : 0
+ return guard.phase == OUTPOST_GUARD_DOWN ? max(0, guard.down_left) + OUTPOST_GUARD_RETURN_TIME / (1 SECONDS) : 0
return max(0, away_left)
/// What the console calls them: arriving, post, rounds, routine, responding, riot, down or away
@@ -816,7 +858,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
/// Every guard on the payroll
var/list/datum/outpost_guard_record/guard_records = list()
/// Every guard mob of this prison, on the wing or leaving it
- var/list/mob/living/basic/outpost_prison_guard/guard_mobs = list()
+ var/list/mob/living/carbon/human/npc/outpost_prison_guard/guard_mobs = list()
/// Seconds each slot still waits for a dismissed guard's return, passed on to the next hire
var/list/guard_slot_waits = list()
/// Wages earned and not yet charged, in credits, and the seconds into the charging interval
@@ -910,8 +952,12 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
var/turf/spot = guard_office_spot()
if(!spot)
return null
+ // Nobody is sent into an office with air nobody can breathe; the slot waits for it to be fixed.
+ if(outpost_prison_unsafe_air(spot.return_air()))
+ return null
var/datum/npc_spawn_context/context = new(outpost, role = "exempt")
- var/mob/living/basic/outpost_prison_guard/guard = spawn_npc_in_zone(record.guard_type, spot, context, FALSE)
+ // One at a time, as they are hired or sent back: no need for the human NPC spawn queue.
+ var/mob/living/carbon/human/npc/outpost_prison_guard/guard = spawn_npc_in_zone(record.guard_type, spot, context, FALSE)
guard.join(src, record)
context.finalize()
record.away_left = 0
@@ -933,7 +979,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
guard_slot_waits += wait
record.dismissed = TRUE
guard_records -= record
- var/mob/living/basic/outpost_prison_guard/guard = record.guard
+ var/mob/living/carbon/human/npc/outpost_prison_guard/guard = record.guard
record.guard = null
if(guard)
guard.record = null
@@ -967,20 +1013,26 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
record.away_left = max(0, record.away_left - seconds)
if(record.away_left <= 0 && home)
spawn_guard(record)
- for(var/mob/living/basic/outpost_prison_guard/guard in guard_mobs.Copy())
+ for(var/mob/living/carbon/human/npc/outpost_prison_guard/guard in guard_mobs.Copy())
if(QDELETED(guard))
continue
switch(guard.phase)
if(OUTPOST_GUARD_DOWN)
guard.down_left -= seconds
if(guard.down_left <= 0)
- guard.beam_out(OUTPOST_GUARD_RETURN_TIME / (1 SECONDS))
+ guard_medevac(guard)
if(OUTPOST_GUARD_DISMISSED)
guard.dismiss_left -= seconds
if(guard.dismiss_left <= 0 || (guard.leave_spot && guard.loc == guard.leave_spot) || !guard.ai_running())
guard.beam_out()
if(OUTPOST_GUARD_PRESENT)
- guard.heal_tick(seconds)
+ guard.shake_off_pull()
+ // Bad air in the wing (a breach, a fire): guards carry no air of their own, so the corrections
+ // service calls them off it until the office is fit to stand in again (spawn_guard()).
+ if(guard.stat == CONSCIOUS && outpost_prison_unsafe_air(guard.loc?.return_air()))
+ guard.say_guard("recalled")
+ add_log("[guard.real_name] was called off the wing: bad air.")
+ guard.beam_out(OUTPOST_GUARD_SHIFT_SWAP_TIME / (1 SECONDS))
guard_rounds_tick(seconds)
guard_check_clock += seconds
if(guard_check_clock >= OUTPOST_GUARD_CHECK_SECONDS)
@@ -990,6 +1042,38 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
guard_yard_chatter()
dispatch_guards()
+/**
+ * The corrections service takes a downed guard's real body away (a transport: the same beam as
+ * everyone's, with no heal), or a dead guard's body once it has lain for OUTPOST_GUARD_BODY_COLLECT_DELAY.
+ * Their wages stopped when they went down (guard_payroll()); their record sends them back after
+ * OUTPOST_GUARD_RETURN_TIME. The service locks on to its own staff wherever the body is: zipped in a bag,
+ * shut in a locker, carried off. Otherwise a body stashed out of sight would hold the slot for the rest
+ * of the round, and lie there for anyone to cut up.
+ */
+/datum/outpost_prison/proc/guard_medevac(mob/living/carbon/human/npc/outpost_prison_guard/guard)
+ if(QDELETED(guard) || guard.phase != OUTPOST_GUARD_DOWN)
+ return FALSE
+ if(!isturf(guard.loc))
+ var/turf/out_of_it = get_turf(guard)
+ if(isnull(out_of_it))
+ return FALSE
+ guard.forceMove(out_of_it)
+ guard.pulledby?.stop_pulling()
+ guard.buckled?.unbuckle_mob(guard, force = TRUE)
+ add_log(guard.stat == DEAD ? "The corrections service collected [guard.real_name]'s body." : "The corrections service took [guard.real_name] away for treatment.")
+ return guard.beam_out(OUTPOST_GUARD_RETURN_TIME / (1 SECONDS))
+
+/**
+ * A guard was killed on duty. Logged with whoever last hurt them (the warden's log and the game log),
+ * and the yard hears of it. The slot waits out the body's collection and the return before anyone is sent.
+ */
+/datum/outpost_prison/proc/guard_killed(mob/living/carbon/human/npc/outpost_prison_guard/guard)
+ var/mob/killer = guard.lastattacker ? get_mob_by_ckey(guard.lastattackerckey) : null
+ add_log("[guard.real_name] was killed on duty.")
+ log_game("PLAYER OUTPOST PRISON: '[outpost?.name]': guard [guard.real_name] was killed[killer ? " (last hit by [key_name(killer)])" : ""]")
+ if(killer && !is_member(killer))
+ announce("Prison wing: [guard.real_name] was killed on duty.", SHIP_NOTIFY_WARNING)
+
/**
* Wages: OUTPOST_GUARD_WAGE a minute for each hired guard on the wing, only while a member is
* home, charged every OUTPOST_PRISON_DEPOSIT_INTERVAL.
@@ -1050,7 +1134,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
guard_rounds_left -= seconds
if(guard_rounds_left > 0)
return
- for(var/mob/living/basic/outpost_prison_guard/guard in shuffle(guard_mobs))
+ for(var/mob/living/carbon/human/npc/outpost_prison_guard/guard in shuffle(guard_mobs))
if(!guard.on_duty() || !guard.ai_running() || guard.response)
continue
if(guard.activity && (!guard.activity.interruptible || istype(guard.activity, /datum/outpost_guard_activity/rounds)))
@@ -1069,7 +1153,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
*/
/datum/outpost_prison/proc/guard_leash_check()
var/z = wing_z()
- for(var/mob/living/basic/outpost_prison_guard/guard in guard_mobs)
+ for(var/mob/living/carbon/human/npc/outpost_prison_guard/guard in guard_mobs)
if(guard.phase != OUTPOST_GUARD_PRESENT)
continue
var/turf/here = get_turf(guard)
@@ -1101,7 +1185,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
*/
/datum/outpost_prison/proc/dispatch_guards()
var/list/on_duty = list()
- for(var/mob/living/basic/outpost_prison_guard/guard in guard_mobs)
+ for(var/mob/living/carbon/human/npc/outpost_prison_guard/guard in guard_mobs)
if(guard.on_duty() && guard.ai_running())
on_duty += guard
if(!riot_active)
@@ -1112,7 +1196,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
if(!length(on_duty))
return
if(creature_about)
- for(var/mob/living/basic/outpost_prison_guard/guard as anything in on_duty)
+ for(var/mob/living/carbon/human/npc/outpost_prison_guard/guard as anything in on_duty)
if(guard.response?.kind == "shelter")
continue
guard.give_response("shelter", OUTPOST_GUARD_PRIORITY_SHELTER, "shelter", null, guard_office_spot(guard))
@@ -1120,7 +1204,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
guard_shelter_called = TRUE
guard.say_guard("creature_flee")
else if(riot_active)
- for(var/mob/living/basic/outpost_prison_guard/guard as anything in on_duty)
+ for(var/mob/living/carbon/human/npc/outpost_prison_guard/guard as anything in on_duty)
if(guard.response?.kind == "riot")
continue
guard.give_response("riot", OUTPOST_GUARD_PRIORITY_RIOT, "riot", null, null)
@@ -1129,7 +1213,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
assign_guard_incidents(on_duty)
guard_stop_spat(on_duty)
guard_watch_loose(on_duty)
- for(var/mob/living/basic/outpost_prison_guard/guard as anything in on_duty)
+ for(var/mob/living/carbon/human/npc/outpost_prison_guard/guard as anything in on_duty)
guard.perform_response()
/**
@@ -1139,7 +1223,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
*/
/datum/outpost_prison/proc/guard_incidents()
var/list/found = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.phase != PRISONER_PRESENT || prisoner.stat != CONSCIOUS || prisoner.can_be_dragged())
continue
if(prisoner.climb_ref)
@@ -1166,7 +1250,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
for(var/list/incident as anything in guard_incidents())
var/key = incident[1]
var/handled = FALSE
- for(var/mob/living/basic/outpost_prison_guard/guard as anything in on_duty)
+ for(var/mob/living/carbon/human/npc/outpost_prison_guard/guard as anything in on_duty)
if(guard.response?.key == key)
handled = TRUE
// A fight's priority rises once blows fly.
@@ -1174,15 +1258,15 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
break
if(handled)
continue
- var/mob/living/basic/outpost_prisoner/prisoner = incident[4]
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = incident[4]
var/atom/where = prisoner
var/turf/spot
if(incident[2] == "climb")
var/obj/structure/table/reinforced/prison_hatch/hatch = prisoner.climb_ref?.resolve()
spot = hatch?.staff_side_turf()
where = spot || prisoner
- var/mob/living/basic/outpost_prison_guard/best
- for(var/mob/living/basic/outpost_prison_guard/guard as anything in on_duty)
+ var/mob/living/carbon/human/npc/outpost_prison_guard/best
+ for(var/mob/living/carbon/human/npc/outpost_prison_guard/guard as anything in on_duty)
if(guard.response && guard.response.priority >= incident[3])
continue
if(guard.skipping(key))
@@ -1195,13 +1279,13 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
/datum/outpost_prison/proc/guard_stop_spat(list/on_duty)
if(spat_lines_left <= 0)
return FALSE
- var/mob/living/basic/outpost_prisoner/one = spat_first_ref?.resolve()
- var/mob/living/basic/outpost_prisoner/two = spat_second_ref?.resolve()
- for(var/mob/living/basic/outpost_prison_guard/guard as anything in on_duty)
+ var/mob/living/carbon/human/npc/outpost_prisoner/one = spat_first_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/two = spat_second_ref?.resolve()
+ for(var/mob/living/carbon/human/npc/outpost_prison_guard/guard as anything in on_duty)
if(guard.response)
continue
var/list/seen = view(OUTPOST_GUARD_SPAT_VIEW, guard)
- var/mob/living/basic/outpost_prisoner/speaker = (one && (one in seen)) ? one : ((two && (two in seen)) ? two : null)
+ var/mob/living/carbon/human/npc/outpost_prisoner/speaker = (one && (one in seen)) ? one : ((two && (two in seen)) ? two : null)
if(!speaker)
continue
guard.face_atom(speaker)
@@ -1213,19 +1297,19 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
/// Loose prisoners: one guard calls each one out, once, and any guard they come beside batons them. No chase.
/datum/outpost_prison/proc/guard_watch_loose(list/on_duty)
var/list/called = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.trouble != PRISONER_TROUBLE_LOOSE || prisoner.phase != PRISONER_PRESENT || prisoner.stat != CONSCIOUS)
continue
var/key = REF(prisoner)
called[key] = TRUE
if(!guard_loose_called[key])
// Said aloud, and noted in the warden's log
- var/mob/living/basic/outpost_prison_guard/crier = pick(on_duty)
+ var/mob/living/carbon/human/npc/outpost_prison_guard/crier = pick(on_duty)
if(crier.say_guard("loose_call", list("{place}" = get_area_name(prisoner))))
add_log("[crier.real_name]: \"[crier.last_line]\"")
if(prisoner.can_be_dragged())
continue
- for(var/mob/living/basic/outpost_prison_guard/guard as anything in on_duty)
+ for(var/mob/living/carbon/human/npc/outpost_prison_guard/guard as anything in on_duty)
if(guard.strike(prisoner))
break
guard_loose_called = called
@@ -1241,18 +1325,18 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
var/list/first_names = list()
var/list/full_names = list()
var/list/places = list()
- for(var/mob/living/basic/outpost_prisoner/runner as anything in runners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/runner as anything in runners)
first_names += runner.speech_name()
full_names += runner.real_name
places |= get_area_name(runner)
// Every line says where they were last seen
var/list/values = list("{prisoner}" = english_list(first_names), "{place}" = english_list(places))
var/list/on_duty = list()
- for(var/mob/living/basic/outpost_prison_guard/guard in guard_mobs)
+ for(var/mob/living/carbon/human/npc/outpost_prison_guard/guard in guard_mobs)
if(guard.on_duty())
on_duty += guard
if(length(on_duty))
- var/mob/living/basic/outpost_prison_guard/crier = pick(on_duty)
+ var/mob/living/carbon/human/npc/outpost_prison_guard/crier = pick(on_duty)
if(crier.say_guard("loose_nearly", values))
add_log("[crier.real_name]: \"[crier.last_line]\"")
announce("[crier.real_name]: \"[crier.last_line]\"", SHIP_NOTIFY_DANGER)
@@ -1261,7 +1345,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
return TRUE
/// The riot hold is called out once a riot: said aloud, and noted in the warden's log
-/datum/outpost_prison/proc/announce_riot_hold(mob/living/basic/outpost_prison_guard/guard)
+/datum/outpost_prison/proc/announce_riot_hold(mob/living/carbon/human/npc/outpost_prison_guard/guard)
if(guard_riot_announced)
return FALSE
guard_riot_announced = TRUE
@@ -1271,9 +1355,9 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
return TRUE
/// Every prisoner who sees a baton strike loses OUTPOST_GUARD_ONLOOKER_MOOD, at most once per OUTPOST_GUARD_ONLOOKER_GAP each; one may say so
-/datum/outpost_prison/proc/guard_strike_seen(mob/living/basic/outpost_prisoner/struck, mob/living/basic/outpost_prison_guard/guard)
+/datum/outpost_prison/proc/guard_strike_seen(mob/living/carbon/human/npc/outpost_prisoner/struck, mob/living/carbon/human/npc/outpost_prison_guard/guard)
var/list/watchers = list()
- for(var/mob/living/basic/outpost_prisoner/onlooker in view(OUTPOST_GUARD_ONLOOKER_RANGE, struck))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/onlooker in view(OUTPOST_GUARD_ONLOOKER_RANGE, struck))
if(onlooker == struck || onlooker.prison != src || onlooker.stat != CONSCIOUS || onlooker.phase != PRISONER_PRESENT)
continue
if(onlooker.guard_onlooker_at && world.time - onlooker.guard_onlooker_at < OUTPOST_GUARD_ONLOOKER_GAP)
@@ -1282,8 +1366,8 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
onlooker.adjust_mood(-OUTPOST_GUARD_ONLOOKER_MOOD)
watchers += onlooker
if(length(watchers) && prob(50))
- var/mob/living/basic/outpost_prisoner/speaker = pick(watchers)
- INVOKE_ASYNC(speaker, TYPE_PROC_REF(/mob/living/basic/outpost_prisoner, say_context_with), "guard_batoned", list("{staff}" = guard.real_name))
+ var/mob/living/carbon/human/npc/outpost_prisoner/speaker = pick(watchers)
+ INVOKE_ASYNC(speaker, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prisoner, say_context_with), "guard_batoned", list("{staff}" = guard.real_name))
return watchers
// ===== MEMBERS, GREETINGS AND REPORTS =====
@@ -1310,7 +1394,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
/// A rioter on their feet beside `member`, if any
/datum/outpost_prison/proc/rioter_beside(mob/living/member)
- for(var/mob/living/basic/outpost_prisoner/rioter in orange(1, member))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/rioter in orange(1, member))
if(rioter.prison == src && rioter.is_rioting() && rioter.stat == CONSCIOUS && !rioter.can_be_dragged())
return rioter
return null
@@ -1335,7 +1419,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
var/list/causes = restless_causes()
if(length(causes))
return list("report_restless", list("{cause}" = causes[1]))
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(counts_for_tension(prisoner) && ("hurt" in prisoner.bubble_needs()))
return list("report_hurt", list("{prisoner}" = prisoner.speech_name()))
var/list/dark = conditions_payload()["dark_cells"]
@@ -1349,7 +1433,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
if(!length(members))
return
for(var/mob/living/member as anything in members)
- for(var/mob/living/basic/outpost_prison_guard/guard in guard_mobs)
+ for(var/mob/living/carbon/human/npc/outpost_prison_guard/guard in guard_mobs)
if(!guard.on_duty() || guard.response || get_dist(guard, member) > OUTPOST_GUARD_REPORT_RANGE || !(member in view(OUTPOST_GUARD_REPORT_RANGE, guard)))
continue
if(guard.greet_member(member))
@@ -1359,7 +1443,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
* Greets `member` if it is time, else reports to them if it is time. Returns TRUE if they said
* something.
*/
-/mob/living/basic/outpost_prison_guard/proc/greet_member(mob/living/member)
+/mob/living/carbon/human/npc/outpost_prison_guard/proc/greet_member(mob/living/member)
if(!prison || !on_duty())
return FALSE
var/key = member.ckey || REF(member)
@@ -1390,10 +1474,10 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
/datum/outpost_prison/proc/guard_yard_chatter()
if(!wing_can_speak() || !prob(OUTPOST_GUARD_NOTICE_CHANCE))
return FALSE
- for(var/mob/living/basic/outpost_prison_guard/guard in shuffle(guard_mobs))
+ for(var/mob/living/carbon/human/npc/outpost_prison_guard/guard in shuffle(guard_mobs))
if(!guard.on_duty() || !guard.ai_running())
continue
- for(var/mob/living/basic/outpost_prisoner/prisoner in view(OUTPOST_GUARD_NOTICE_RANGE, guard))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in view(OUTPOST_GUARD_NOTICE_RANGE, guard))
if(prisoner.prison != src || !prisoner.ai_running() || !prisoner.routine_allowed() || prisoner.activity?.sleeping)
continue
if(prisoner.guard_noticed_at && world.time - prisoner.guard_noticed_at < OUTPOST_GUARD_CHECK_ON_GAP)
@@ -1431,7 +1515,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
for(var/mob/living/other in tile)
if(other != except && other.density)
return TRUE
- for(var/mob/living/basic/outpost_prison_guard/guard in guard_mobs)
+ for(var/mob/living/carbon/human/npc/outpost_prison_guard/guard in guard_mobs)
if(guard == except)
continue
if(guard.response?.spot == tile || guard.activity?.goal_turf() == tile)
@@ -1547,7 +1631,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
/datum/outpost_prison/proc/guards_admin_payload()
var/list/rows = list()
for(var/datum/outpost_guard_record/record as anything in guard_records)
- var/mob/living/basic/outpost_prison_guard/guard = record.guard
+ var/mob/living/carbon/human/npc/outpost_prison_guard/guard = record.guard
var/status = record.status()
if(status == "away" || status == "down")
var/back = record.back_in()
@@ -1581,10 +1665,11 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
if(action == "prison_guard_remove")
dismiss_guard(record, "dismissed", forget_wait = TRUE)
return "remove prison guard [guard_name]"
- var/mob/living/basic/outpost_prison_guard/guard = record.guard
+ var/mob/living/carbon/human/npc/outpost_prison_guard/guard = record.guard
if(!guard?.on_duty())
return list("error" = "That guard is not on duty.")
- guard.adjust_health(guard.health - OUTPOST_GUARD_DOWN_AT)
+ // Real damage over their limbs, enough to put them in crit; tg's crit does the rest.
+ guard.take_overall_damage(brute = max(0, guard.health) + 5)
if(guard.phase != OUTPOST_GUARD_DOWN)
guard.go_down()
return "put prison guard [guard_name] down"
@@ -1593,7 +1678,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
// ===== LIFE AND DEATH OF THE PRISON =====
/datum/outpost_prison/proc/guards_destroy()
- for(var/mob/living/basic/outpost_prison_guard/guard in guard_mobs.Copy())
+ for(var/mob/living/carbon/human/npc/outpost_prison_guard/guard in guard_mobs.Copy())
if(QDELETED(guard))
continue
guard.prison = null
@@ -1611,7 +1696,7 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
/// The outpost was abandoned: every guard is dismissed, no refund, and beams out
/datum/outpost_prison/proc/guards_abandon()
for(var/datum/outpost_guard_record/record as anything in guard_records.Copy())
- var/mob/living/basic/outpost_prison_guard/guard = record.guard
+ var/mob/living/carbon/human/npc/outpost_prison_guard/guard = record.guard
dismiss_guard(record, "dismissed", forget_wait = TRUE)
guard?.beam_out()
guard_slot_waits.Cut()
@@ -1621,16 +1706,20 @@ GLOBAL_LIST_INIT(outpost_guard_placeholders, list("{boss}", "{count}", "{cause}"
// ===== LOOK =====
/**
- * A corrections officer: pale blue shirt and tie over navy trousers, a navy peaked police cap,
- * black gloves and combat boots, and an earpiece. No red, no orange (that's the inmates), no
- * armour; the stun baton is drawn in hand only when they use it (update_overlays()).
+ * A corrections officer: pale blue shirt and tie over navy trousers, a blue-trimmed vest and helmet,
+ * black gloves and combat boots, and an earpiece. No red, no orange (that's the inmates). The stun
+ * baton rides on the belt and is drawn only when they use it (set_baton()); a bruise pack in a pocket
+ * for their own scrapes. Locked to them (D3): none of it is ever loot.
*/
/datum/outfit/outpost_prison_guard
name = "Outpost prison guard"
uniform = /obj/item/clothing/under/rank/security/officer/blueshirt
- head = /obj/item/clothing/head/hats/warden/police
+ suit = /obj/item/clothing/suit/armor/vest/blueshirt
+ head = /obj/item/clothing/head/helmet/blueshirt
gloves = /obj/item/clothing/gloves/color/black
shoes = /obj/item/clothing/shoes/jackboots
ears = /obj/item/radio/headset
+ belt = /obj/item/melee/baton/security/loaded
+ r_pocket = /obj/item/stack/medical/bruise_pack
#undef OUTPOST_GUARD_DIALOGUE_FILE
diff --git a/voidcrew/modules/player_outposts/outpost_prison_horror.dm b/voidcrew/modules/player_outposts/outpost_prison_horror.dm
index 9f977ec2bcc..afcc6265a0e 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_horror.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_horror.dm
@@ -736,7 +736,7 @@
if(victim.stat != CONSCIOUS)
return TRUE
if(is_outpost_prisoner(victim))
- var/mob/living/basic/outpost_prisoner/prisoner = victim
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = victim
return prisoner.can_be_dragged()
return HAS_TRAIT_FROM(victim, TRAIT_INCAPACITATED, STAMINA)
@@ -785,8 +785,8 @@
if(watcher.client)
shake_camera(watcher, 3, 1)
if(is_outpost_prisoner(victim))
- var/mob/living/basic/outpost_prisoner/prisoner = victim
- INVOKE_ASYNC(prisoner, TYPE_PROC_REF(/mob/living/basic/outpost_prisoner, say_context), "absorbed")
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = victim
+ INVOKE_ASYNC(prisoner, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prisoner, say_context), "absorbed")
addtimer(CALLBACK(src, PROC_REF(absorb_proboscis), serial), OUTPOST_HORROR_ABSORB_PROBOSCIS, TIMER_DELETE_ME)
addtimer(CALLBACK(src, PROC_REF(absorb_drained), serial), OUTPOST_HORROR_ABSORB_TIME, TIMER_DELETE_ME)
return TRUE
@@ -836,16 +836,20 @@
set_busy("digest", OUTPOST_HORROR_DIGEST_TIME)
return victim
-/// Husked and dead
+/// Dead and husked the way tg's changeling absorb leaves its victims: death, then tg's Drain() on a body
/mob/living/basic/outpost_experiment/horror/proc/husk(mob/living/victim)
victim.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY)
- victim.become_husk(CHANGELING_DRAIN)
- if(!ishuman(victim))
- // A basic mob has no husk sprite: grey and dried out
- victim.add_atom_colour(list(0.35,0.35,0.35,0, 0.35,0.35,0.35,0, 0.35,0.35,0.35,0, 0,0,0,1, -0.05,-0.05,-0.05,0), FIXED_COLOUR_PRIORITY)
- victim.blood_volume = 0
if(victim.stat != DEAD)
+ victim.investigate_log("has died from being absorbed by an outpost prison horror.", INVESTIGATE_DEATHS)
victim.death()
+ if(iscarbon(victim))
+ var/mob/living/carbon/body = victim
+ body.Drain()
+ return
+ // A basic mob has no husk sprite: grey and dried out
+ victim.become_husk(CHANGELING_DRAIN)
+ victim.add_atom_colour(list(0.35,0.35,0.35,0, 0.35,0.35,0.35,0, 0.35,0.35,0.35,0, 0,0,0,1, -0.05,-0.05,-0.05,0), FIXED_COLOUR_PRIORITY)
+ victim.blood_volume = 0
/// Admins hear about every non-member it absorbs; the game log gets every absorb
/mob/living/basic/outpost_experiment/horror/proc/log_absorb(mob/living/victim)
@@ -1049,7 +1053,7 @@
/// Whether a prisoner is shut in a bolted cell, which it leaves for last
/mob/living/basic/outpost_experiment/horror/proc/bolted_away(mob/living/target)
- var/mob/living/basic/outpost_prisoner/prisoner = target
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = target
return istype(prisoner) && prisoner.in_bolted_cell()
/**
@@ -1133,7 +1137,7 @@
best_distance = distance
if(best)
return best
- for(var/mob/living/basic/outpost_prisoner/prisoner as anything in event?.prison?.prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner as anything in event?.prison?.prisoners)
if(!valid_quarry(prisoner) || bolted_away(prisoner))
continue
var/distance = get_dist(src, prisoner)
diff --git a/voidcrew/modules/player_outposts/outpost_prison_incidents.dm b/voidcrew/modules/player_outposts/outpost_prison_incidents.dm
index bf54e8e5320..93a95cd4f00 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_incidents.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_incidents.dm
@@ -66,7 +66,7 @@
/// Prisoners who count for wildcards: present, alive, not loose, in the cell block
/datum/outpost_prison/proc/wildcard_prisoner_count()
var/count = 0
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(counts_for_tension(prisoner) && in_cell_block(prisoner))
count++
return count
@@ -146,7 +146,7 @@
/// The kinds and their weights: a stabbing is likelier while someone who could do it has a shiv stashed
/datum/outpost_prison/proc/wildcard_kind_weights()
var/stab_weight = PRISON_INCIDENT_WEIGHT_STAB
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.cell?.stash_shiv && wildcard_can_act(prisoner))
stab_weight *= PRISON_INCIDENT_STASH_KIND_MULT
break
@@ -171,7 +171,7 @@
* block, out of trouble and not busy with it, not shut in a cell, owing no lockdown, not an
* experiment's subject, and not running from a creature
*/
-/datum/outpost_prison/proc/wildcard_can_act(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/wildcard_can_act(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(QDELETED(prisoner) || prisoner.prison != src || prisoner.phase != PRISONER_PRESENT || prisoner.stat != CONSCIOUS)
return FALSE
if(prisoner.in_trouble() || prisoner.can_be_dragged() || prisoner.pulledby || prisoner.experiment_subject || prisoner.lockdown_left > 0 || prisoner.is_panicking())
@@ -181,7 +181,7 @@
return in_cell_block(prisoner) && !prisoner.is_confined()
/// Whether `prisoner` can be the one a stabbing is aimed at: as wildcard_can_act(), but asleep will do
-/datum/outpost_prison/proc/wildcard_can_be_target(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/wildcard_can_be_target(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(QDELETED(prisoner) || prisoner.prison != src || prisoner.phase != PRISONER_PRESENT || prisoner.stat != CONSCIOUS)
return FALSE
if(prisoner.in_trouble() || prisoner.can_be_dragged() || prisoner.pulledby || prisoner.experiment_subject)
@@ -189,7 +189,7 @@
return in_cell_block(prisoner) && !prisoner.is_confined()
/// Whether `one` can walk to where `two` stands
-/datum/outpost_prison/proc/wildcard_can_reach(mob/living/basic/outpost_prisoner/one, mob/living/basic/outpost_prisoner/two)
+/datum/outpost_prison/proc/wildcard_can_reach(mob/living/carbon/human/npc/outpost_prisoner/one, mob/living/carbon/human/npc/outpost_prisoner/two)
if(!one.walkable)
refresh_prisoner_reach(one)
return !!one.walkable?[get_turf(two)]
@@ -218,11 +218,11 @@
var/list/weights = list()
var/list/rival_pairs = list()
var/list/rival_weights = list()
- for(var/mob/living/basic/outpost_prisoner/attacker in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/attacker in prisoners)
if(!wildcard_can_act(attacker))
continue
var/weight = attacker.cell?.stash_shiv ? PRISON_INCIDENT_STASH_PICK_MULT : 1
- for(var/mob/living/basic/outpost_prisoner/victim in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/victim in prisoners)
if(victim == attacker || !wildcard_can_be_target(victim) || !wildcard_can_reach(attacker, victim))
continue
if(are_rivals(attacker, victim))
@@ -241,7 +241,7 @@
/datum/outpost_prison/proc/pick_snapper()
var/list/options = list()
var/list/weights = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(!wildcard_can_act(prisoner) || !prisoner.can_join_riot())
continue
options += prisoner
@@ -253,15 +253,15 @@
/// Who fights whom: list(one, two), rivals first, or null
/datum/outpost_prison/proc/pick_fight_pair()
var/list/able = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(wildcard_can_act(prisoner) && !prisoner.fight)
able += prisoner
var/list/pairs = list()
var/list/rival_pairs = list()
for(var/first_index in 1 to length(able) - 1)
- var/mob/living/basic/outpost_prisoner/one = able[first_index]
+ var/mob/living/carbon/human/npc/outpost_prisoner/one = able[first_index]
for(var/second_index in first_index + 1 to length(able))
- var/mob/living/basic/outpost_prisoner/two = able[second_index]
+ var/mob/living/carbon/human/npc/outpost_prisoner/two = able[second_index]
if(!wildcard_can_reach(one, two))
continue
if(are_rivals(one, two))
@@ -289,7 +289,7 @@
/// A snap: the tell, or with `skip_tell` the riot at once. Returns TRUE if it started.
/datum/outpost_prison/proc/start_snap(skip_tell = FALSE)
- var/mob/living/basic/outpost_prisoner/snapper = pick_snapper()
+ var/mob/living/carbon/human/npc/outpost_prisoner/snapper = pick_snapper()
if(!snapper)
return FALSE
if(skip_tell)
@@ -300,7 +300,7 @@
return TRUE
/// `snapper` riots, alone unless others are unhappy enough to join. Returns TRUE if the riot started.
-/datum/outpost_prison/proc/snap(mob/living/basic/outpost_prisoner/snapper)
+/datum/outpost_prison/proc/snap(mob/living/carbon/human/npc/outpost_prisoner/snapper)
if(!snapper?.can_join_riot())
return FALSE
if(!start_riot("[snapper.real_name] snapped", forced = snapper, ignore_quiet = TRUE))
@@ -318,27 +318,27 @@
// ===== STOPPING ONE =====
/// Whether `prisoner` is working up to a stabbing or a snap right now
-/datum/outpost_prison/proc/wildcard_brooding(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/wildcard_brooding(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
return !!prisoner && wildcard?.stage == WILDCARD_TELL && wildcard.actor() == prisoner
/// The tell for examine, while `prisoner` works up to a stabbing or a snap; or null
-/datum/outpost_prison/proc/wildcard_examine(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/wildcard_examine(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(!wildcard_brooding(prisoner))
return null
if(wildcard.kind != "stab")
return "Paces and mutters, fists clenched."
- var/mob/living/basic/outpost_prisoner/target = wildcard.target()
+ var/mob/living/carbon/human/npc/outpost_prisoner/target = wildcard.target()
var/stare = target ? "Keeps staring at [target.speech_name()]" : "Keeps staring at someone"
return wildcard.last_tell_shown ? "[stare], one hand under [prisoner.p_their()] shirt." : "[stare]."
/// A member talked `prisoner` down (talk_down()): a tell under way is called off. Returns TRUE if one was.
-/datum/outpost_prison/proc/wildcard_talked_down(mob/living/basic/outpost_prisoner/prisoner, mob/living/user)
+/datum/outpost_prison/proc/wildcard_talked_down(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/user)
if(!wildcard_brooding(prisoner))
return FALSE
return wildcard.stopped_by_staff(user, "talk")
/// Staff batoned `prisoner` (a signal handler's call: nothing here sleeps): a tell under way is called off
-/datum/outpost_prison/proc/wildcard_batoned(mob/living/basic/outpost_prisoner/prisoner, mob/living/user)
+/datum/outpost_prison/proc/wildcard_batoned(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/user)
if(!wildcard_brooding(prisoner))
return FALSE
return wildcard.stopped_by_staff(user, "baton")
@@ -346,7 +346,7 @@
// ===== COMINGS AND GOINGS =====
/// A prisoner is leaving the roster: a wildcard they are part of ends, and a stabber drops the shiv
-/datum/outpost_prison/proc/wildcard_prisoner_leaving(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/wildcard_prisoner_leaving(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(!wildcard || (wildcard.actor() != prisoner && wildcard.target() != prisoner))
return
if(wildcard.stage == WILDCARD_ATTACK && wildcard.actor() != prisoner)
@@ -360,8 +360,8 @@
/// The admin panel's wildcard numbers, with the wing events' (outpost_prison_wing_events.dm)
/datum/outpost_prison/proc/incidents_admin_payload()
- var/mob/living/basic/outpost_prisoner/actor = wildcard?.actor()
- var/mob/living/basic/outpost_prisoner/target = wildcard?.target()
+ var/mob/living/carbon/human/npc/outpost_prisoner/actor = wildcard?.actor()
+ var/mob/living/carbon/human/npc/outpost_prisoner/target = wildcard?.target()
return list(
"chance" = round(outpost_prison_wildcard_chance(tension), 0.1),
"gap_left" = round(wildcard_gap_left),
@@ -397,7 +397,7 @@
/// A stabbing's fight
var/datum/weakref/fight_ref
-/datum/outpost_prison_wildcard/New(datum/outpost_prison/owner, kind, mob/living/basic/outpost_prisoner/actor, mob/living/basic/outpost_prisoner/target)
+/datum/outpost_prison_wildcard/New(datum/outpost_prison/owner, kind, mob/living/carbon/human/npc/outpost_prisoner/actor, mob/living/carbon/human/npc/outpost_prisoner/target)
. = ..()
prison = owner
src.kind = kind
@@ -406,7 +406,7 @@
tell_left = rand(PRISON_INCIDENT_TELL_MIN, PRISON_INCIDENT_TELL_MAX)
/datum/outpost_prison_wildcard/Destroy()
- var/mob/living/basic/outpost_prisoner/actor = actor()
+ var/mob/living/carbon/human/npc/outpost_prisoner/actor = actor()
if(actor && is_tell_activity(actor.activity))
actor.end_activity()
if(prison?.wildcard == src)
@@ -425,13 +425,13 @@
return istype(activity, /datum/prisoner_activity/wildcard_shadow) || istype(activity, /datum/prisoner_activity/pace/wildcard)
/// Whether a stabbing's victim is still there to go for
-/datum/outpost_prison_wildcard/proc/target_ok(mob/living/basic/outpost_prisoner/target)
+/datum/outpost_prison_wildcard/proc/target_ok(mob/living/carbon/human/npc/outpost_prisoner/target)
return !QDELETED(target) && target.prison == prison && (target in prison.prisoners) && target.phase == PRISONER_PRESENT && target.stat != DEAD && target.trouble != PRISONER_TROUBLE_LOOSE && !target.is_rioting()
/// The tell begins: a stare and the shadowing, or the pacing
/datum/outpost_prison_wildcard/proc/begin_tell()
- var/mob/living/basic/outpost_prisoner/actor = actor()
- var/mob/living/basic/outpost_prisoner/target = target()
+ var/mob/living/carbon/human/npc/outpost_prisoner/actor = actor()
+ var/mob/living/carbon/human/npc/outpost_prisoner/target = target()
if(!actor)
return
actor.end_activity()
@@ -445,7 +445,7 @@
log_game("PLAYER OUTPOST PRISON: [actor.real_name] is working up to [kind == "stab" ? "stabbing [target?.real_name]" : "snapping"] at '[prison?.outpost?.name]'")
/// Starts the tell's activity again if something ended it
-/datum/outpost_prison_wildcard/proc/restart_activity(mob/living/basic/outpost_prisoner/actor)
+/datum/outpost_prison_wildcard/proc/restart_activity(mob/living/carbon/human/npc/outpost_prisoner/actor)
if(is_tell_activity(actor.activity) || !actor.routine_allowed())
return
var/datum/prisoner_activity/tell_activity
@@ -460,8 +460,8 @@
/// Advances the tell, or watches the attack until its fight is over
/datum/outpost_prison_wildcard/proc/tick(seconds)
- var/mob/living/basic/outpost_prisoner/actor = actor()
- var/mob/living/basic/outpost_prisoner/target = target()
+ var/mob/living/carbon/human/npc/outpost_prisoner/actor = actor()
+ var/mob/living/carbon/human/npc/outpost_prisoner/target = target()
if(stage == WILDCARD_ATTACK)
var/datum/outpost_prison_fight/brawl = fight_ref?.resolve()
if(!QDELETED(brawl) && actor?.fight == brawl)
@@ -504,7 +504,7 @@
qdel(src)
/// A stabbing's tell: the stare, a mutter, the hand under the shirt
-/datum/outpost_prison_wildcard/proc/tell_stab(mob/living/basic/outpost_prisoner/actor, mob/living/basic/outpost_prisoner/target)
+/datum/outpost_prison_wildcard/proc/tell_stab(mob/living/carbon/human/npc/outpost_prisoner/actor, mob/living/carbon/human/npc/outpost_prisoner/target)
var/in_sight = (target in view(7, actor))
if(in_sight)
actor.face_atom(target)
@@ -516,7 +516,7 @@
actor.manual_emote("slips a hand under [actor.p_their()] shirt.")
/// A snap's tell: muttering, a blow at the wall, then shouting
-/datum/outpost_prison_wildcard/proc/tell_snap(mob/living/basic/outpost_prisoner/actor)
+/datum/outpost_prison_wildcard/proc/tell_snap(mob/living/carbon/human/npc/outpost_prisoner/actor)
if(!muttered && tell_elapsed >= PRISON_INCIDENT_MUTTER_AT)
muttered = TRUE
actor.say_context("incident_pacing")
@@ -543,8 +543,8 @@
* victim, a fight past its argument. Returns TRUE if it started.
*/
/datum/outpost_prison_wildcard/proc/strike()
- var/mob/living/basic/outpost_prisoner/actor = actor()
- var/mob/living/basic/outpost_prisoner/target = target()
+ var/mob/living/carbon/human/npc/outpost_prisoner/actor = actor()
+ var/mob/living/carbon/human/npc/outpost_prisoner/target = target()
// Nobody goes for a prisoner who is already down, or busy fighting someone else.
if(QDELETED(actor) || actor.stat != CONSCIOUS || actor.trouble || actor.can_be_dragged() || !target_ok(target) || target.stat != CONSCIOUS || target.can_be_dragged() || target.fight)
return FALSE
@@ -553,9 +553,9 @@
if(is_tell_activity(actor.activity))
actor.end_activity()
actor.stand_up()
- if(!prison.draw_stashed_shiv(actor))
- actor.draw_shiv()
- actor.manual_emote("pulls a shiv out from under [actor.p_their()] shirt!")
+ // A stabbing needs a blade: one stashed in their cell, or one they already carry. Nothing comes from nowhere.
+ if(!actor.has_shiv() && !prison.draw_stashed_shiv(actor))
+ return FALSE
var/datum/outpost_prison_fight/brawl = prison.start_fight(actor, target, "stab")
if(!brawl)
put_away_shiv(actor)
@@ -570,13 +570,13 @@
return TRUE
/// After a stabbing, the attacker lets go of the shiv, unless they are rioting or loose with it
-/datum/outpost_prison_wildcard/proc/put_away_shiv(mob/living/basic/outpost_prisoner/actor)
+/datum/outpost_prison_wildcard/proc/put_away_shiv(mob/living/carbon/human/npc/outpost_prisoner/actor)
if(QDELETED(actor) || !actor.has_shiv() || actor.is_rioting() || actor.trouble == PRISONER_TROUBLE_LOOSE)
return
actor.drop_shiv()
/// It came to nothing (the victim out of reach, the snapper shut in): they think better of it
-/datum/outpost_prison_wildcard/proc/give_up(mob/living/basic/outpost_prisoner/actor)
+/datum/outpost_prison_wildcard/proc/give_up(mob/living/carbon/human/npc/outpost_prisoner/actor)
if(!QDELETED(actor) && actor.stat == CONSCIOUS)
actor.say_context("incident_stopped")
qdel(src)
@@ -589,8 +589,8 @@
/datum/outpost_prison_wildcard/proc/stopped_by_staff(mob/living/user, how)
if(stage != WILDCARD_TELL)
return FALSE
- var/mob/living/basic/outpost_prisoner/actor = actor()
- var/mob/living/basic/outpost_prisoner/target = target()
+ var/mob/living/carbon/human/npc/outpost_prisoner/actor = actor()
+ var/mob/living/carbon/human/npc/outpost_prisoner/target = target()
if(actor)
actor.note_trouble_ended()
var/what = kind == "stab" ? "went for [target?.real_name || "someone"]" : "snapped"
@@ -599,7 +599,7 @@
prison?.add_log("[user?.name || "Someone"] talked [who] down before [actor.p_they()] [what].")
else
prison?.add_log(user ? "[user.name] stopped [who] before [actor.p_they()] [what]." : "[who] was stopped before [actor.p_they()] [what].")
- INVOKE_ASYNC(actor, TYPE_PROC_REF(/mob/living/basic/outpost_prisoner, say_context), "incident_stopped")
+ INVOKE_ASYNC(actor, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prisoner, say_context), "incident_stopped")
qdel(src)
return TRUE
@@ -613,7 +613,7 @@
interruptible = FALSE
var/datum/weakref/target_ref
-/datum/prisoner_activity/wildcard_shadow/New(mob/living/basic/outpost_prisoner/doer, mob/living/basic/outpost_prisoner/target)
+/datum/prisoner_activity/wildcard_shadow/New(mob/living/carbon/human/npc/outpost_prisoner/doer, mob/living/carbon/human/npc/outpost_prisoner/target)
. = ..()
target_ref = target ? WEAKREF(target) : null
diff --git a/voidcrew/modules/player_outposts/outpost_prison_leads.dm b/voidcrew/modules/player_outposts/outpost_prison_leads.dm
index 2a77d84b737..ab38f2fd799 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_leads.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_leads.dm
@@ -32,7 +32,7 @@
/// Lies given anywhere this round, so every lie's waypoint key is unique on any ship's helm
GLOBAL_VAR_INIT(outpost_prison_lead_lies, 0)
-/mob/living/basic/outpost_prisoner
+/mob/living/carbon/human/npc/outpost_prisoner
/// Knows where something is, until they tell it (leads_prisoner_admitted())
var/carries_lead = FALSE
/// A member is putting a question about leads to them right now
@@ -83,11 +83,11 @@ GLOBAL_VAR_INIT(outpost_prison_lead_lies, 0)
// ===== CARRIERS =====
/// A prisoner was booked in: some carry a lead
-/datum/outpost_prison/proc/leads_prisoner_admitted(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/leads_prisoner_admitted(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
prisoner.carries_lead = prob(OUTPOST_PRISON_LEAD_CHANCE)
/// Their tips stay on the helms and in the tracking by name; a liar who has gone never owns up
-/datum/outpost_prison/proc/leads_prisoner_leaving(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/leads_prisoner_leaving(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
prisoner.carries_lead = FALSE
/// Whether the wing's gap between leads is over
@@ -100,7 +100,7 @@ GLOBAL_VAR_INIT(outpost_prison_lead_lies, 0)
return !!lead_test_roll
return prob(chance)
-/datum/outpost_prison/proc/lead_member_in_view(mob/living/basic/outpost_prisoner/prisoner, range)
+/datum/outpost_prison/proc/lead_member_in_view(mob/living/carbon/human/npc/outpost_prisoner/prisoner, range)
for(var/mob/living/person in view(range, prisoner))
if(person.stat == CONSCIOUS && is_member(person))
return TRUE
@@ -109,7 +109,7 @@ GLOBAL_VAR_INIT(outpost_prison_lead_lies, 0)
// ===== SPEECH AND EXAMINE =====
/// A carrier hints at what they know, while the wing is ready to give a lead and a member is near
-/datum/outpost_prison/proc/leads_extra_speech(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/leads_extra_speech(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(!prisoner.carries_lead || !lead_ready())
return null
if(!lead_member_in_view(prisoner, OUTPOST_PRISON_LEAD_HINT_RANGE) || !lead_roll(OUTPOST_PRISON_LEAD_HINT_CHANCE))
@@ -117,13 +117,13 @@ GLOBAL_VAR_INIT(outpost_prison_lead_lies, 0)
return list("lead_hint", null)
/// Nothing: mood (XB's examine) and the tells as they answer are what there is to read
-/datum/outpost_prison/proc/leads_examine(mob/living/basic/outpost_prisoner/prisoner, mob/user)
+/datum/outpost_prison/proc/leads_examine(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/user)
return null
// ===== THE TALK MENU =====
/// "Heard anything?" on every prisoner, and "About that tip" on those who saw a recent one given; members only
-/datum/outpost_prison/proc/leads_talk_choices(mob/living/basic/outpost_prisoner/prisoner, mob/living/user)
+/datum/outpost_prison/proc/leads_talk_choices(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/user)
var/list/choices = list()
if(!prisoner || !user || !is_member(user))
return choices
@@ -133,7 +133,7 @@ GLOBAL_VAR_INIT(outpost_prison_lead_lies, 0)
return choices
/// Runs a talk menu choice of this package; TRUE if it was one. May sleep.
-/datum/outpost_prison/proc/leads_talk_act(mob/living/basic/outpost_prisoner/prisoner, mob/living/user, choice)
+/datum/outpost_prison/proc/leads_talk_act(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/user, choice)
if(choice == LEAD_ASK_CHOICE)
lead_ask(prisoner, user)
return TRUE
@@ -147,12 +147,12 @@ GLOBAL_VAR_INIT(outpost_prison_lead_lies, 0)
return FALSE
/// The newest tip `prisoner` can be asked about (lead_vouchable()), or null
-/datum/outpost_prison/proc/lead_newest_vouchable(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/lead_newest_vouchable(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/list/vouchable = lead_vouchable(prisoner)
return length(vouchable) ? vouchable[length(vouchable)] : null
/// Open leads `prisoner` saw given, recent enough to ask about, that they did not give and have not answered for
-/datum/outpost_prison/proc/lead_vouchable(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/lead_vouchable(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/list/found = list()
var/datum/weakref/prisoner_ref = WEAKREF(prisoner)
for(var/datum/outpost_prison_lead/lead as anything in open_leads)
@@ -164,14 +164,14 @@ GLOBAL_VAR_INIT(outpost_prison_lead_lies, 0)
return found
/// Whether `user` may put a question to `prisoner` now; shows or says why not
-/datum/outpost_prison/proc/lead_can_ask(mob/living/basic/outpost_prisoner/prisoner, mob/living/user)
+/datum/outpost_prison/proc/lead_can_ask(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/user)
if(QDELETED(prisoner) || QDELETED(user) || prisoner.prison != src || prisoner.phase != PRISONER_PRESENT || prisoner.stat != CONSCIOUS)
return FALSE
if(!is_member(user))
prisoner.balloon_alert(user, "not your prisoner")
return FALSE
// Not talking: the talk menu may hold that while it hands this question over.
- if(prisoner.lead_questioned || prisoner.trouble || prisoner.fight || prisoner.threat_ref || prisoner.swing_ref || prisoner.climb_ref || prisoner.beaten_left > 0)
+ if(prisoner.lead_questioned || prisoner.trouble || prisoner.fight || prisoner.threat_ref || prisoner.swing_ref || prisoner.climb_ref || prisoner.is_beaten())
prisoner.balloon_alert(user, "they're busy")
return FALSE
if(!prisoner.will_listen())
@@ -182,7 +182,7 @@ GLOBAL_VAR_INIT(outpost_prison_lead_lies, 0)
return TRUE
/// A few seconds face to face, as a talk-down takes; FALSE if it was cut short or they stopped listening
-/datum/outpost_prison/proc/lead_face_to_face(mob/living/basic/outpost_prisoner/prisoner, mob/living/user, self_message)
+/datum/outpost_prison/proc/lead_face_to_face(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/user, self_message)
prisoner.lead_questioned = TRUE
// Put back as found: the talk menu may already hold it and clear it itself.
var/was_talking = prisoner.talking
@@ -204,7 +204,7 @@ GLOBAL_VAR_INIT(outpost_prison_lead_lies, 0)
return TRUE
/// "Heard anything?": the checks and the talk, then give_lead() for the asker's ship
-/datum/outpost_prison/proc/lead_ask(mob/living/basic/outpost_prisoner/prisoner, mob/living/user)
+/datum/outpost_prison/proc/lead_ask(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/user)
if(!lead_can_ask(prisoner, user))
return FALSE
if(!get_crew_ship(user))
@@ -226,7 +226,7 @@ GLOBAL_VAR_INIT(outpost_prison_lead_lies, 0)
return TRUE
/// "About that tip": the checks and the talk, then lead_vouch()
-/datum/outpost_prison/proc/lead_ask_about(mob/living/basic/outpost_prisoner/prisoner, mob/living/user, datum/outpost_prison_lead/lead)
+/datum/outpost_prison/proc/lead_ask_about(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/user, datum/outpost_prison_lead/lead)
if(!lead_can_ask(prisoner, user))
return FALSE
if(!(lead in lead_vouchable(prisoner)))
@@ -240,7 +240,7 @@ GLOBAL_VAR_INIT(outpost_prison_lead_lies, 0)
// ===== GIVING A LEAD =====
/// Whether `asker` hit `prisoner` unprovoked in the last OUTPOST_PRISON_LEAD_HIT_MEMORY
-/datum/outpost_prison/proc/lead_hit_by(mob/living/basic/outpost_prisoner/prisoner, mob/asker)
+/datum/outpost_prison/proc/lead_hit_by(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/asker)
if(prisoner.last_hit_justified || !prisoner.last_staff_hit)
return FALSE
if(world.time - prisoner.last_staff_hit > OUTPOST_PRISON_LEAD_HIT_MEMORY)
@@ -248,7 +248,7 @@ GLOBAL_VAR_INIT(outpost_prison_lead_lies, 0)
return prisoner.last_staff_attacker_ref?.resolve() == asker
/// Percent chance `prisoner` lies to `asker`: none when content, then by mood, the asker's name in the yard and personality
-/datum/outpost_prison/proc/lead_lie_chance(mob/living/basic/outpost_prisoner/prisoner, mob/asker)
+/datum/outpost_prison/proc/lead_lie_chance(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/asker)
if(prisoner.mood >= OUTPOST_PRISON_LEAD_TRUE_MOOD)
return 0
var/chance = prisoner.mood < OUTPOST_PRISON_LEAD_HOSTILE_MOOD ? OUTPOST_PRISON_LEAD_LIE_HOSTILE : OUTPOST_PRISON_LEAD_LIE_UNEASY
@@ -272,7 +272,7 @@ GLOBAL_VAR_INIT(outpost_prison_lead_lies, 0)
* lead_lie_chance(), which `force_lie` (tests) decides instead. Returns "invalid", "refuse_hit",
* "refuse", "none", "nothing", "truth" or "lie".
*/
-/datum/outpost_prison/proc/give_lead(mob/living/basic/outpost_prisoner/prisoner, obj/structure/overmap/ship/ship, mob/living/asker, force_lie = null)
+/datum/outpost_prison/proc/give_lead(mob/living/carbon/human/npc/outpost_prisoner/prisoner, obj/structure/overmap/ship/ship, mob/living/asker, force_lie = null)
if(QDELETED(prisoner) || prisoner.prison != src || prisoner.phase != PRISONER_PRESENT || prisoner.stat != CONSCIOUS)
return "invalid"
if(QDELETED(ship) || QDELETED(asker))
@@ -326,7 +326,7 @@ GLOBAL_VAR_INIT(outpost_prison_lead_lies, 0)
lead.ship_ref = WEAKREF(ship)
lead.ship_name = ship.name
lead.given_at = world.time
- for(var/mob/living/basic/outpost_prisoner/other in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/other in prisoners)
if(other != prisoner && other.phase == PRISONER_PRESENT)
lead.witnesses += WEAKREF(other)
@@ -347,7 +347,7 @@ GLOBAL_VAR_INIT(outpost_prison_lead_lies, 0)
return lead.lie ? "lie" : "truth"
/// A tell as they answer: an emote from the dialogue file's "tells", their personality's more often than the shared ones
-/datum/outpost_prison/proc/lead_tell_emote(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/lead_tell_emote(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/list/tells = outpost_prisoner_extra_dialogue(LEAD_DIALOGUE_FILE, "tells")
var/list/own = prisoner.personality ? tells[prisoner.personality] : null
var/list/shared = tells["any"]
@@ -477,13 +477,13 @@ GLOBAL_VAR_INIT(outpost_prison_lead_lies, 0)
var/datum/outpost_prison_lead/lead = lead_ref?.resolve()
if(!lead || !(lead in open_leads))
return FALSE
- var/mob/living/basic/outpost_prisoner/teller = lead.teller_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/teller = lead.teller_ref?.resolve()
var/mob/living/asker = lead.asker_ref?.resolve()
if(QDELETED(teller) || QDELETED(asker) || teller.prison != src)
return FALSE
if(!lead_roll(OUTPOST_PRISON_LEAD_GOSSIP_CHANCE))
return FALSE
- for(var/mob/living/basic/outpost_prisoner/other in shuffle(prisoners))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/other in shuffle(prisoners))
if(other == teller || other.stat != CONSCIOUS || other.phase != PRISONER_PRESENT || other.trouble || other.mood < OUTPOST_PRISON_LEAD_GOSSIP_MOOD)
continue
var/list/seen = view(OUTPOST_PRISON_LEAD_GOSSIP_RANGE, other)
@@ -498,7 +498,7 @@ GLOBAL_VAR_INIT(outpost_prison_lead_lies, 0)
* middling aren't sure, and the sour and anyone the asker hit refuse (they can be asked again
* later). Returns "refuse_hit", "refuse", "unsure", "true" or "lie" (what they said the tip was).
*/
-/datum/outpost_prison/proc/lead_vouch(mob/living/basic/outpost_prisoner/prisoner, datum/outpost_prison_lead/lead, mob/living/asker)
+/datum/outpost_prison/proc/lead_vouch(mob/living/carbon/human/npc/outpost_prisoner/prisoner, datum/outpost_prison_lead/lead, mob/living/asker)
prisoner.face_atom(asker)
if(lead_hit_by(prisoner, asker))
prisoner.say_context("lead_refuse_hit")
@@ -550,7 +550,7 @@ GLOBAL_VAR_INIT(outpost_prison_lead_lies, 0)
/// A caught liar still in the wing owns up once the asker comes within OUTPOST_PRISON_LEAD_CAUGHT_RANGE
/datum/outpost_prison/proc/lead_caught_line(datum/outpost_prison_lead/lead)
- var/mob/living/basic/outpost_prisoner/teller = lead.teller_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/teller = lead.teller_ref?.resolve()
if(QDELETED(teller) || teller.prison != src)
lead.caught_said = TRUE
return FALSE
@@ -574,7 +574,7 @@ GLOBAL_VAR_INIT(outpost_prison_lead_lies, 0)
/// The admin panel's leads block: {ready_in, carriers: [ref], open: [{teller, ship, name, lie, exposed, age}]}; times in seconds
/datum/outpost_prison/proc/leads_admin_payload()
var/list/carriers = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.carries_lead)
carriers += REF(prisoner)
var/list/open = list()
@@ -598,7 +598,7 @@ GLOBAL_VAR_INIT(outpost_prison_lead_lies, 0)
if(action != "prison_lead")
return null
var/ref = params ? params["ref"] : null
- var/mob/living/basic/outpost_prisoner/prisoner = istext(ref) ? (locate(ref) in prisoners) : null
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = istext(ref) ? (locate(ref) in prisoners) : null
if(QDELETED(prisoner))
return list("error" = "No such prisoner.")
prisoner.carries_lead = TRUE
diff --git a/voidcrew/modules/player_outposts/outpost_prison_life.dm b/voidcrew/modules/player_outposts/outpost_prison_life.dm
index 835bf41113c..a1d82660238 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_life.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_life.dm
@@ -28,7 +28,7 @@
/// A friend of one of the fighters has had their one try at breaking it up
var/breakup_tried = FALSE
-/mob/living/basic/outpost_prisoner
+/mob/living/carbon/human/npc/outpost_prisoner
/// It is their birthday; `party_done` once the yard has had the cake
var/has_birthday = FALSE
var/party_done = FALSE
@@ -38,19 +38,19 @@
// ===== AFFINITY =====
/// The key a pair of prisoners is kept under, the same whichever way round they come
-/datum/outpost_prison/proc/affinity_key(mob/living/basic/outpost_prisoner/one, mob/living/basic/outpost_prisoner/two)
+/datum/outpost_prison/proc/affinity_key(mob/living/carbon/human/npc/outpost_prisoner/one, mob/living/carbon/human/npc/outpost_prisoner/two)
var/one_ref = REF(one)
var/two_ref = REF(two)
return (sorttext(one_ref, two_ref) > 0) ? "[one_ref]|[two_ref]" : "[two_ref]|[one_ref]"
/// How two prisoners get on, -100 (rivals) to 100 (friends)
-/datum/outpost_prison/proc/affinity(mob/living/basic/outpost_prisoner/one, mob/living/basic/outpost_prisoner/two)
+/datum/outpost_prison/proc/affinity(mob/living/carbon/human/npc/outpost_prisoner/one, mob/living/carbon/human/npc/outpost_prisoner/two)
if(!one || !two || one == two)
return 0
return affinities[affinity_key(one, two)] || 0
/// Sets how two prisoners get on. A wing keeps at most PRISON_AFFINITY_MAX_PAIRS pairs: a new one pushes out the mildest.
-/datum/outpost_prison/proc/set_affinity(mob/living/basic/outpost_prisoner/one, mob/living/basic/outpost_prisoner/two, value)
+/datum/outpost_prison/proc/set_affinity(mob/living/carbon/human/npc/outpost_prisoner/one, mob/living/carbon/human/npc/outpost_prisoner/two, value)
if(!one || !two || one == two)
return 0
var/key = affinity_key(one, two)
@@ -68,20 +68,20 @@
affinities[key] = value
return value
-/datum/outpost_prison/proc/adjust_affinity(mob/living/basic/outpost_prisoner/one, mob/living/basic/outpost_prisoner/two, amount)
+/datum/outpost_prison/proc/adjust_affinity(mob/living/carbon/human/npc/outpost_prisoner/one, mob/living/carbon/human/npc/outpost_prisoner/two, amount)
return set_affinity(one, two, affinity(one, two) + amount)
-/datum/outpost_prison/proc/are_friends(mob/living/basic/outpost_prisoner/one, mob/living/basic/outpost_prisoner/two)
+/datum/outpost_prison/proc/are_friends(mob/living/carbon/human/npc/outpost_prisoner/one, mob/living/carbon/human/npc/outpost_prisoner/two)
return affinity(one, two) >= PRISON_AFFINITY_FRIEND
-/datum/outpost_prison/proc/are_rivals(mob/living/basic/outpost_prisoner/one, mob/living/basic/outpost_prisoner/two)
+/datum/outpost_prison/proc/are_rivals(mob/living/carbon/human/npc/outpost_prisoner/one, mob/living/carbon/human/npc/outpost_prisoner/two)
return affinity(one, two) <= PRISON_AFFINITY_RIVAL
/// The prisoner `prisoner` gets on with best, if a friend; with `worst`, the one they get on with worst, if a rival
-/datum/outpost_prison/proc/closest_tie(mob/living/basic/outpost_prisoner/prisoner, worst = FALSE)
- var/mob/living/basic/outpost_prisoner/found
+/datum/outpost_prison/proc/closest_tie(mob/living/carbon/human/npc/outpost_prisoner/prisoner, worst = FALSE)
+ var/mob/living/carbon/human/npc/outpost_prisoner/found
var/found_value = worst ? PRISON_AFFINITY_RIVAL : PRISON_AFFINITY_FRIEND
- for(var/mob/living/basic/outpost_prisoner/other in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/other in prisoners)
if(other == prisoner || other.stat == DEAD || other.phase == PRISONER_LEAVING)
continue
var/value = affinity(prisoner, other)
@@ -93,12 +93,12 @@
return found
/// Picks, removes from `options` and returns the prisoner `prisoner` goes to chat with, friends by preference
-/datum/outpost_prison/proc/take_chat_partner(mob/living/basic/outpost_prisoner/prisoner, list/options)
+/datum/outpost_prison/proc/take_chat_partner(mob/living/carbon/human/npc/outpost_prisoner/prisoner, list/options)
if(!length(options))
return null
var/list/weights = list()
var/total = 0
- for(var/mob/living/basic/outpost_prisoner/other as anything in options)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/other as anything in options)
var/weight = clamp(1 + affinity(prisoner, other) / 25, PRISON_CHAT_WEIGHT_MIN, PRISON_CHAT_WEIGHT_MAX)
weights += weight
total += weight
@@ -106,7 +106,7 @@
for(var/index in 1 to length(options))
roll -= weights[index]
if(roll <= 0)
- var/mob/living/basic/outpost_prisoner/chosen = options[index]
+ var/mob/living/carbon/human/npc/outpost_prisoner/chosen = options[index]
options.Cut(index, index + 1)
return chosen
return pick_n_take(options)
@@ -114,7 +114,7 @@
// ===== WHAT CHANGES IT =====
/// A chat between two prisoners finished
-/datum/outpost_prison/proc/note_chat(mob/living/basic/outpost_prisoner/one, mob/living/basic/outpost_prisoner/two)
+/datum/outpost_prison/proc/note_chat(mob/living/carbon/human/npc/outpost_prisoner/one, mob/living/carbon/human/npc/outpost_prisoner/two)
adjust_affinity(one, two, PRISON_AFFINITY_CHAT)
/// Prisoners who shared a meal and got its lift: every pair of them
@@ -123,16 +123,16 @@
for(var/second_index in first_index + 1 to length(diners))
adjust_affinity(diners[first_index], diners[second_index], PRISON_AFFINITY_SHARED_MEAL)
-/datum/outpost_prison/proc/note_spat(mob/living/basic/outpost_prisoner/one, mob/living/basic/outpost_prisoner/two)
+/datum/outpost_prison/proc/note_spat(mob/living/carbon/human/npc/outpost_prisoner/one, mob/living/carbon/human/npc/outpost_prisoner/two)
adjust_affinity(one, two, PRISON_AFFINITY_SPAT)
-/datum/outpost_prison/proc/note_fight(mob/living/basic/outpost_prisoner/one, mob/living/basic/outpost_prisoner/two)
+/datum/outpost_prison/proc/note_fight(mob/living/carbon/human/npc/outpost_prisoner/one, mob/living/carbon/human/npc/outpost_prisoner/two)
adjust_affinity(one, two, PRISON_AFFINITY_FIGHT)
/// Each full minute two prisoners spend playing basketball together brings them a little closer
/datum/outpost_prison/proc/coplay_tick(seconds)
var/list/players = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.stat == CONSCIOUS && prisoner.phase == PRISONER_PRESENT && istype(prisoner.activity, /datum/prisoner_activity/basketball) && prisoner.activity.started)
players += prisoner
for(var/first_index in 1 to length(players) - 1)
@@ -147,7 +147,7 @@
// ===== WHAT IT CHANGES =====
/// Rivals fight more readily, friends less
-/datum/outpost_prison/proc/fight_chance_mult(mob/living/basic/outpost_prisoner/one, mob/living/basic/outpost_prisoner/two)
+/datum/outpost_prison/proc/fight_chance_mult(mob/living/carbon/human/npc/outpost_prisoner/one, mob/living/carbon/human/npc/outpost_prisoner/two)
if(are_rivals(one, two))
return PRISON_FIGHT_MULT_RIVAL
if(are_friends(one, two))
@@ -155,7 +155,7 @@
return 1
/// A fight cause beyond food, ball and bed: an old grudge between two who can't stand each other
-/datum/outpost_prison/proc/fight_cause_extra(mob/living/basic/outpost_prisoner/one, mob/living/basic/outpost_prisoner/two)
+/datum/outpost_prison/proc/fight_cause_extra(mob/living/carbon/human/npc/outpost_prisoner/one, mob/living/carbon/human/npc/outpost_prisoner/two)
if(affinity(one, two) <= PRISON_AFFINITY_GRUDGE)
return "grudge"
return null
@@ -181,7 +181,7 @@
* The two-person conversation `speaker` opens with `partner`: friends and rivals mostly open with
* one of their own (conversations_friendly, conversations_hostile), falling back to the main pool.
*/
-/datum/outpost_prison/proc/pick_conversation(mob/living/basic/outpost_prisoner/speaker, mob/living/basic/outpost_prisoner/partner)
+/datum/outpost_prison/proc/pick_conversation(mob/living/carbon/human/npc/outpost_prisoner/speaker, mob/living/carbon/human/npc/outpost_prisoner/partner)
var/value = affinity(speaker, partner)
var/pool_key
if(value >= PRISON_AFFINITY_FRIEND)
@@ -197,9 +197,9 @@
return length(pool) ? pick(pool) : null
/// "Seems to get on with Rosa." for examine, or null
-/datum/outpost_prison/proc/relationship_examine(mob/living/basic/outpost_prisoner/prisoner)
- var/mob/living/basic/outpost_prisoner/friend = closest_tie(prisoner)
- var/mob/living/basic/outpost_prisoner/rival = closest_tie(prisoner, worst = TRUE)
+/datum/outpost_prison/proc/relationship_examine(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
+ var/mob/living/carbon/human/npc/outpost_prisoner/friend = closest_tie(prisoner)
+ var/mob/living/carbon/human/npc/outpost_prisoner/rival = closest_tie(prisoner, worst = TRUE)
if(friend && rival)
return "Seems to get on with [friend.speech_name()], and keeps away from [rival.speech_name()]."
if(friend)
@@ -209,8 +209,8 @@
return null
/// The first name of `prisoner`'s worst rival in the wing, or null
-/datum/outpost_prison/proc/worst_rival_name(mob/living/basic/outpost_prisoner/prisoner)
- var/mob/living/basic/outpost_prisoner/rival = closest_tie(prisoner, worst = TRUE)
+/datum/outpost_prison/proc/worst_rival_name(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
+ var/mob/living/carbon/human/npc/outpost_prisoner/rival = closest_tie(prisoner, worst = TRUE)
return rival?.speech_name()
// ===== A FRIEND BREAKS IT UP =====
@@ -224,28 +224,28 @@
for(var/datum/outpost_prison_fight/brawl in fights.Copy())
if(brawl.fighting || brawl.breakup_tried)
continue
- for(var/mob/living/basic/outpost_prisoner/fighter as anything in list(brawl.first, brawl.second))
- var/mob/living/basic/outpost_prisoner/friend = peacemaker_for(fighter, brawl)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/fighter as anything in list(brawl.first, brawl.second))
+ var/mob/living/carbon/human/npc/outpost_prisoner/friend = peacemaker_for(fighter, brawl)
if(!friend)
continue
brawl.breakup_tried = TRUE
var/chance = isnull(breakup_chance_override) ? PRISON_BREAKUP_CHANCE : breakup_chance_override
if(!prob(chance))
break
- var/mob/living/basic/outpost_prisoner/opponent = brawl.opponent_of(fighter)
+ var/mob/living/carbon/human/npc/outpost_prisoner/opponent = brawl.opponent_of(fighter)
friend.face_atom(fighter)
friend.manual_emote(opponent ? "steps in between [fighter] and [opponent]." : "puts a hand on [fighter]'s shoulder.")
end_fight(brawl)
add_log("[friend.real_name] talked [fighter.real_name] and [opponent?.real_name] out of a fight.")
- INVOKE_ASYNC(friend, TYPE_PROC_REF(/mob/living/basic/outpost_prisoner, say_context), "friend_breaks_up", fighter)
+ INVOKE_ASYNC(friend, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prisoner, say_context), "friend_breaks_up", fighter)
return friend
return null
/// A friend of `fighter` who could step in: close by, awake, in a good enough mood and out of trouble
-/datum/outpost_prison/proc/peacemaker_for(mob/living/basic/outpost_prisoner/fighter, datum/outpost_prison_fight/brawl)
+/datum/outpost_prison/proc/peacemaker_for(mob/living/carbon/human/npc/outpost_prisoner/fighter, datum/outpost_prison_fight/brawl)
if(QDELETED(fighter))
return null
- for(var/mob/living/basic/outpost_prisoner/other in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/other in prisoners)
if(other == brawl.first || other == brawl.second || !are_friends(fighter, other))
continue
// Down or cuffed, they can't step in between anyone
@@ -258,13 +258,13 @@
// ===== ARRIVALS =====
/// A prisoner was booked in. Whether they know anyone inside, and their birthday, wait until they beam in.
-/datum/outpost_prison/proc/on_prisoner_admitted(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/on_prisoner_admitted(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
// admit_next() beams them in straight after admit(); anyone booked in any other way stays put.
addtimer(CALLBACK(src, PROC_REF(greet_arrival), WEAKREF(prisoner)), 1)
/// An arrival beaming in through intake: a crewmate or a rival already inside, a birthday, marks on the wall
/datum/outpost_prison/proc/greet_arrival(datum/weakref/prisoner_ref)
- var/mob/living/basic/outpost_prisoner/prisoner = prisoner_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = prisoner_ref?.resolve()
if(!prisoner || prisoner.prison != src || prisoner.phase != PRISONER_ARRIVING)
return FALSE
roll_crew_tie(prisoner)
@@ -279,9 +279,9 @@
* (-PRISON_CREW_TIE). `forced` is "friend" or "rival" to skip the roll. The arrival says so once
* they have beamed in. Returns the other prisoner, or null.
*/
-/datum/outpost_prison/proc/roll_crew_tie(mob/living/basic/outpost_prisoner/prisoner, forced)
+/datum/outpost_prison/proc/roll_crew_tie(mob/living/carbon/human/npc/outpost_prisoner/prisoner, forced)
var/list/others = list()
- for(var/mob/living/basic/outpost_prisoner/other in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/other in prisoners)
if(other != prisoner && other.phase == PRISONER_PRESENT && other.stat != DEAD && other.trouble != PRISONER_TROUBLE_LOOSE)
others += other
if(!length(others))
@@ -294,7 +294,7 @@
tie = "rival"
if(tie != "friend" && tie != "rival")
return null
- var/mob/living/basic/outpost_prisoner/other = pick(others)
+ var/mob/living/carbon/human/npc/outpost_prisoner/other = pick(others)
set_affinity(prisoner, other, tie == "friend" ? PRISON_CREW_TIE : -PRISON_CREW_TIE)
var/delay = (prisoner.phase == PRISONER_ARRIVING ? OUTPOST_PRISON_BEAM_TIME / (1 SECONDS) : 0) + PRISON_CREW_LINE_DELAY
queue_life_line(prisoner, tie == "friend" ? "arrival_crew_friend" : "arrival_crew_rival", other, delay)
@@ -305,7 +305,7 @@
return prob(PRISON_BIRTHDAY_CHANCE)
/// It is their birthday: they say so once they are in, and the yard can throw them a party (outpost_prison_pastimes.dm)
-/datum/outpost_prison/proc/give_birthday(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/give_birthday(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
prisoner.has_birthday = TRUE
prisoner.party_done = FALSE
var/delay = (prisoner.phase == PRISONER_ARRIVING ? OUTPOST_PRISON_BEAM_TIME / (1 SECONDS) : 0) + PRISON_BIRTHDAY_LINE_DELAY
@@ -314,12 +314,12 @@
// ===== LINES DUE =====
/// Queues a line for `prisoner` to say to `other` in `seconds`
-/datum/outpost_prison/proc/queue_life_line(mob/living/basic/outpost_prisoner/prisoner, context, mob/living/basic/outpost_prisoner/other, seconds)
+/datum/outpost_prison/proc/queue_life_line(mob/living/carbon/human/npc/outpost_prisoner/prisoner, context, mob/living/carbon/human/npc/outpost_prisoner/other, seconds)
LAZYADD(prisoner.life_lines, list(list(seconds, context, other ? WEAKREF(other) : null)))
/// Counts down queued lines and says the ones that are due, once the speaker has beamed in
/datum/outpost_prison/proc/life_lines_tick(seconds)
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(!length(prisoner.life_lines))
continue
for(var/list/entry as anything in prisoner.life_lines.Copy())
@@ -330,7 +330,7 @@
if(prisoner.phase != PRISONER_PRESENT || prisoner.stat != CONSCIOUS)
continue
var/datum/weakref/other_ref = entry[3]
- var/mob/living/basic/outpost_prisoner/other = other_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/other = other_ref?.resolve()
if(other && other.stat == CONSCIOUS && (other in view(7, prisoner)))
prisoner.face_atom(other)
else
@@ -339,10 +339,10 @@
/// Says a line for a prisoner who may have gone by now; for timers
/datum/outpost_prison/proc/say_life_line(datum/weakref/speaker_ref, context, datum/weakref/other_ref)
- var/mob/living/basic/outpost_prisoner/speaker = speaker_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/speaker = speaker_ref?.resolve()
if(!speaker || speaker.stat != CONSCIOUS)
return FALSE
- var/mob/living/basic/outpost_prisoner/other = other_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/other = other_ref?.resolve()
if(other)
speaker.face_atom(other)
return speaker.say_context(context, other)
@@ -350,7 +350,7 @@
// ===== LEAVING =====
/// A prisoner is leaving the roster: their pairs go, and a party for them is off
-/datum/outpost_prison/proc/on_prisoner_leaving(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/on_prisoner_leaving(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/prisoner_ref = REF(prisoner)
for(var/key in affinities.Copy())
if(findtext(key, prisoner_ref))
@@ -368,7 +368,7 @@
* sight say goodbye, a second or so apart, and feel it; the leaver answers the first before the beam
* takes them. Returns TRUE if any of that replaced the usual release line.
*/
-/datum/outpost_prison/proc/on_prisoner_releasing(mob/living/basic/outpost_prisoner/prisoner, average)
+/datum/outpost_prison/proc/on_prisoner_releasing(mob/living/carbon/human/npc/outpost_prisoner/prisoner, average)
var/spoke = FALSE
if(average >= PRISON_RELEASE_THANKS_AVERAGE)
var/mob/living/member = nearest_member_in_view(prisoner)
@@ -381,7 +381,7 @@
else if(average <= PRISON_RELEASE_BITTER_AVERAGE)
spoke = prisoner.say_context("release_bitter")
var/list/friends = list()
- for(var/mob/living/basic/outpost_prisoner/other in view(PRISON_FAREWELL_RANGE, prisoner))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/other in view(PRISON_FAREWELL_RANGE, prisoner))
if(other == prisoner || !(other in prisoners) || other.stat != CONSCIOUS || other.phase != PRISONER_PRESENT)
continue
if(are_friends(prisoner, other))
@@ -391,7 +391,7 @@
// The first goodbye and the leaver's answer come before the beam starts, since nobody talks while
// beaming out; later friends call after them anyway, a second or two apart.
var/delay = 0
- for(var/mob/living/basic/outpost_prisoner/friend as anything in friends)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/friend as anything in friends)
friend.adjust_mood(-PRISON_FAREWELL_MOOD)
friend.face_atom(prisoner)
if(friend == friends[1])
@@ -403,7 +403,7 @@
return TRUE
/// The nearest member of the wing awake in sight of `prisoner`, or null
-/datum/outpost_prison/proc/nearest_member_in_view(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/nearest_member_in_view(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/mob/living/nearest
var/nearest_distance = INFINITY
for(var/mob/living/person in view(7, prisoner))
@@ -433,7 +433,7 @@
/// A birthday prisoner free to talk brings it up now and then, until they get their party
/datum/outpost_prison/proc/birthday_chatter()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(!prisoner.has_birthday || prisoner.party_done || prisoner.stat != CONSCIOUS || prisoner.phase != PRISONER_PRESENT)
continue
if(!prisoner.ai_running() || prisoner.in_trouble() || prisoner.activity?.sleeping)
@@ -459,8 +459,8 @@
var/list/refs = splittext(key, "|")
if(length(refs) != 2)
continue
- var/mob/living/basic/outpost_prisoner/one = locate(refs[1]) in prisoners
- var/mob/living/basic/outpost_prisoner/two = locate(refs[2]) in prisoners
+ var/mob/living/carbon/human/npc/outpost_prisoner/one = locate(refs[1]) in prisoners
+ var/mob/living/carbon/human/npc/outpost_prisoner/two = locate(refs[2]) in prisoners
if(!one || !two)
continue
pairs += list(list(
@@ -471,11 +471,11 @@
"affinity" = round(affinities[key]),
))
var/list/birthdays = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.has_birthday && !prisoner.party_done)
birthdays += REF(prisoner)
var/scene
- var/mob/living/basic/outpost_prisoner/host = party_host_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/host = party_host_ref?.resolve()
if(party_stage && host)
scene = party_stage == "waiting" ? "cake waiting for [host.real_name]" : "birthday party for [host.real_name]"
return list(
@@ -488,8 +488,8 @@
/datum/outpost_prison/proc/life_admin_act(action, list/params, mob/user)
switch(action)
if("prison_affinity")
- var/mob/living/basic/outpost_prisoner/one = locate(params?["a_ref"]) in prisoners
- var/mob/living/basic/outpost_prisoner/two = locate(params?["b_ref"]) in prisoners
+ var/mob/living/carbon/human/npc/outpost_prisoner/one = locate(params?["a_ref"]) in prisoners
+ var/mob/living/carbon/human/npc/outpost_prisoner/two = locate(params?["b_ref"]) in prisoners
if(QDELETED(one) || QDELETED(two) || one == two)
return list("error" = "Pick two different prisoners.")
var/value = params["value"]
@@ -500,7 +500,7 @@
set_affinity(one, two, value)
return "set how [one.real_name] and [two.real_name] get on to [round(affinity(one, two))]"
if("prison_birthday", "prison_party")
- var/mob/living/basic/outpost_prisoner/prisoner = locate(params?["ref"]) in prisoners
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = locate(params?["ref"]) in prisoners
if(QDELETED(prisoner) || prisoner.stat == DEAD || prisoner.phase != PRISONER_PRESENT)
return list("error" = "Only a living prisoner in the wing.")
if(action == "prison_birthday")
diff --git a/voidcrew/modules/player_outposts/outpost_prison_mail.dm b/voidcrew/modules/player_outposts/outpost_prison_mail.dm
index c71f90b36c9..3d666bed22b 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_mail.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_mail.dm
@@ -41,7 +41,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
// ===== STATE =====
-/mob/living/basic/outpost_prisoner
+/mob/living/carbon/human/npc/outpost_prisoner
/// Whether a letter has come for them this stay; one each
var/mail_had_letter = FALSE
@@ -205,7 +205,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
return waiting
/// The letter waiting for `prisoner`, if any
-/datum/outpost_prison/proc/mail_waiting_for(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/mail_waiting_for(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
for(var/obj/item/paper/outpost_prison_letter/letter in mail_waiting_letters())
if(letter.letter_prisoner_ref?.resolve() == prisoner)
return letter
@@ -220,7 +220,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
/datum/outpost_prison/proc/mail_wave_recipients()
var/present = 0
var/list/eligible = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.phase != PRISONER_PRESENT || prisoner.stat == DEAD)
continue
present++
@@ -251,7 +251,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
return 0
var/obj/structure/closet/supplypod/outpost_prison_mail/pod = new()
var/obj/structure/closet/crate/mail/crate = new(pod)
- for(var/mob/living/basic/outpost_prisoner/prisoner as anything in recipients)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner as anything in recipients)
mail_make_letter(prisoner, null, null, crate)
crate.update_appearance()
RegisterSignal(crate, COMSIG_MOVABLE_MOVED, PROC_REF(mail_crate_moved))
@@ -472,7 +472,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
* waves (the admin panel's prison_mail): `kind` (by weight when not given), and for a contraband
* letter `enclosure_type` (a razor blade or yeast by chance when not given). Returns the letter, or null.
*/
-/datum/outpost_prison/proc/mail_send(mob/living/basic/outpost_prisoner/prisoner, kind, enclosure_type)
+/datum/outpost_prison/proc/mail_send(mob/living/carbon/human/npc/outpost_prisoner/prisoner, kind, enclosure_type)
if(QDELETED(prisoner) || !(prisoner in prisoners))
return null
var/turf/spot = mail_letter_drop_turf()
@@ -492,7 +492,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
* not given), and for a contraband letter `enclosure_type` (a razor blade or yeast by chance when not
* given). That is their one letter this stay. The caller tracks it (mail_letters). Returns the letter.
*/
-/datum/outpost_prison/proc/mail_make_letter(mob/living/basic/outpost_prisoner/prisoner, kind, enclosure_type, atom/destination)
+/datum/outpost_prison/proc/mail_make_letter(mob/living/carbon/human/npc/outpost_prisoner/prisoner, kind, enclosure_type, atom/destination)
if(!(kind in GLOB.outpost_prison_mail_kinds))
kind = pick_weight(GLOB.outpost_prison_mail_kinds)
var/obj/item/mail/envelope/outpost_prison/envelope = new(destination)
@@ -514,7 +514,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
return letter
/// Writes a letter of `kind` to `prisoner` from the extras' templates
-/datum/outpost_prison/proc/mail_write(obj/item/paper/outpost_prison_letter/letter, mob/living/basic/outpost_prisoner/prisoner, kind)
+/datum/outpost_prison/proc/mail_write(obj/item/paper/outpost_prison_letter/letter, mob/living/carbon/human/npc/outpost_prisoner/prisoner, kind)
var/list/by_kind = outpost_prisoner_extra_dialogue(MAIL_STRINGS_FILE, "letters")
var/list/templates = by_kind[kind]
var/list/senders = outpost_prisoner_extra_dialogue(MAIL_STRINGS_FILE, "senders")
@@ -538,7 +538,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
/datum/outpost_prison/proc/mail_check()
var/z = wing_z()
for(var/obj/item/paper/outpost_prison_letter/letter in mail_waiting_letters())
- var/mob/living/basic/outpost_prisoner/addressee = letter.letter_prisoner_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/addressee = letter.letter_prisoner_ref?.resolve()
if(QDELETED(addressee) || !(addressee in prisoners))
mail_discard(letter)
continue
@@ -555,7 +555,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
if(QDELETED(letter))
return
mail_letters -= WEAKREF(letter)
- var/mob/living/basic/outpost_prisoner/addressee = letter.letter_prisoner_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/addressee = letter.letter_prisoner_ref?.resolve()
if(lost && !QDELETED(addressee) && (addressee in prisoners) && addressee.stat != DEAD)
addressee.adjust_mood(-OUTPOST_MAIL_EXPIRED_MOOD)
add_log("[addressee.real_name]'s mail was sent back.")
@@ -564,7 +564,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
/// Someone opened a letter before its prisoner got it
/datum/outpost_prison/proc/mail_opened(obj/item/paper/outpost_prison_letter/letter, mob/user)
add_log("[user ? user.name : "Someone"] opened [letter.letter_addressee]'s mail.")
- var/mob/living/basic/outpost_prisoner/addressee = letter.letter_prisoner_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/addressee = letter.letter_prisoner_ref?.resolve()
if(user && addressee)
note_staff_event(user, addressee, "mail_opened")
@@ -576,7 +576,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
* the level they read it where they stand if the hatch is in their reach, as fend_for_self() does
* with food. Returns TRUE if they went for it or read it.
*/
-/datum/outpost_prison/proc/mail_collect_from_hatch(mob/living/basic/outpost_prisoner/addressee, obj/item/thing)
+/datum/outpost_prison/proc/mail_collect_from_hatch(mob/living/carbon/human/npc/outpost_prisoner/addressee, obj/item/thing)
if(addressee.stat != CONSCIOUS || addressee.phase != PRISONER_PRESENT || !isturf(thing.loc))
return FALSE
if(addressee.ai_running())
@@ -591,7 +591,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
return FALSE
addressee.start_activity(fetch)
return TRUE
- if(addressee.in_trouble() || addressee.cuffs)
+ if(addressee.in_trouble() || addressee.handcuffed)
return FALSE
if(!addressee.reachable)
refresh_prisoner_reach(addressee)
@@ -608,7 +608,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
if(!letter)
only_mail = FALSE
continue
- var/mob/living/basic/outpost_prisoner/addressee = letter.letter_prisoner_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/addressee = letter.letter_prisoner_ref?.resolve()
if(!QDELETED(addressee) && (addressee in prisoners))
mail_collect_from_hatch(addressee, thing)
return only_mail
@@ -618,21 +618,21 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
* anyone else says it isn't theirs, and a prisoner who won't listen refuses it. Runs inside a
* signal handler: never sleeps. Returns the item interaction result.
*/
-/datum/outpost_prison/proc/mail_hand_over(mob/living/basic/outpost_prisoner/prisoner, mob/living/user, obj/item/thing, obj/item/paper/outpost_prison_letter/letter)
+/datum/outpost_prison/proc/mail_hand_over(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/user, obj/item/thing, obj/item/paper/outpost_prison_letter/letter)
if(prisoner.stat != CONSCIOUS || prisoner.phase != PRISONER_PRESENT)
return NONE
if(letter.letter_prisoner_ref?.resolve() != prisoner)
prisoner.balloon_alert(user, "not theirs")
- INVOKE_ASYNC(prisoner, TYPE_PROC_REF(/mob/living/basic/outpost_prisoner, say_context), "mail_not_mine")
+ INVOKE_ASYNC(prisoner, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prisoner, say_context), "mail_not_mine")
return ITEM_INTERACT_BLOCKING
// Cuffed hands take nothing, as with food and uniforms (outpost_prison_capture.dm)
- if(prisoner.cuffs)
+ if(prisoner.handcuffed)
prisoner.balloon_alert(user, "cuffed")
return ITEM_INTERACT_BLOCKING
// Fighting, squaring up, climbing, lying beaten, or already busy with staff: they won't take it
if(prisoner.in_trouble() || !prisoner.will_listen())
prisoner.balloon_alert(user, "not listening")
- INVOKE_ASYNC(prisoner, TYPE_PROC_REF(/mob/living/basic/outpost_prisoner, say_context), "talk_refuse")
+ INVOKE_ASYNC(prisoner, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prisoner, say_context), "talk_refuse")
return ITEM_INTERACT_BLOCKING
if(!user.temporarilyRemoveItemFromInventory(thing))
return ITEM_INTERACT_BLOCKING
@@ -649,7 +649,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
* unless `instant`, then the letter takes effect. Bad news sends them to sit in their cell a while.
* Returns the kind read, or null. Sleeps unless `instant`.
*/
-/datum/outpost_prison/proc/mail_read(mob/living/basic/outpost_prisoner/prisoner, obj/item/thing, instant = FALSE)
+/datum/outpost_prison/proc/mail_read(mob/living/carbon/human/npc/outpost_prisoner/prisoner, obj/item/thing, instant = FALSE)
if(QDELETED(prisoner) || QDELETED(thing))
return null
mail_reading_emote(prisoner, thing)
@@ -667,7 +667,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
mail_start_mull(prisoner)
return kind
-/datum/outpost_prison/proc/mail_reading_emote(mob/living/basic/outpost_prisoner/prisoner, obj/item/thing)
+/datum/outpost_prison/proc/mail_reading_emote(mob/living/carbon/human/npc/outpost_prisoner/prisoner, obj/item/thing)
if(istype(thing, /obj/item/mail/envelope/outpost_prison))
prisoner.manual_emote("tears open the envelope and reads the letter.")
playsound(prisoner, 'sound/items/poster/poster_ripped.ogg', 30, TRUE)
@@ -681,7 +681,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
* sealed in with it is kept hidden (contraband, 4.14). The letter and its envelope are then gone
* (they keep it). Never sleeps. Returns the kind, or null.
*/
-/datum/outpost_prison/proc/mail_finish_reading(mob/living/basic/outpost_prisoner/prisoner, obj/item/thing)
+/datum/outpost_prison/proc/mail_finish_reading(mob/living/carbon/human/npc/outpost_prisoner/prisoner, obj/item/thing)
var/obj/item/paper/outpost_prison_letter/letter = outpost_prison_letter_in(thing)
if(!letter || QDELETED(prisoner))
return null
@@ -705,7 +705,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
return kind
/// Bad news: they go and sit in their cell's chair (or on its bed) for a while, if they can
-/datum/outpost_prison/proc/mail_start_mull(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/mail_start_mull(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(QDELETED(prisoner) || !prisoner.ai_running() || !prisoner.routine_allowed())
return FALSE
var/datum/prisoner_activity/mull_letter/mull = new(prisoner)
@@ -718,7 +718,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
// ===== THE PRISON: SPEECH, CONSOLES, CLEAN-UP =====
/// "Any mail for me?", from a prisoner with a letter waiting and a member in sight, as list(context, other, values), or null
-/datum/outpost_prison/proc/mail_extra_speech(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/mail_extra_speech(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(!mail_waiting_for(prisoner) || !contraband_roll(OUTPOST_MAIL_ASK_CHANCE))
return null
for(var/mob/living/person in view(OUTPOST_MAIL_ASK_RANGE, prisoner))
@@ -729,7 +729,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
return null
/// A prisoner is leaving: their undelivered letters go
-/datum/outpost_prison/proc/mail_prisoner_leaving(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/mail_prisoner_leaving(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
for(var/obj/item/paper/outpost_prison_letter/letter in mail_waiting_letters())
if(letter.letter_prisoner_ref?.resolve() == prisoner)
mail_discard(letter)
@@ -743,7 +743,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
/datum/outpost_prison/proc/mail_admin_payload()
var/list/rows = list()
for(var/obj/item/paper/outpost_prison_letter/letter in mail_waiting_letters())
- var/mob/living/basic/outpost_prisoner/addressee = letter.letter_prisoner_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/addressee = letter.letter_prisoner_ref?.resolve()
rows += list(list(
"ref" = REF(letter),
"to_ref" = addressee ? REF(addressee) : null,
@@ -769,7 +769,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
return "call a prison mail pod with [sent] letter\s"
if(action != "prison_mail")
return null
- var/mob/living/basic/outpost_prisoner/prisoner = locate(params?["ref"]) in prisoners
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = locate(params?["ref"]) in prisoners
if(QDELETED(prisoner))
return list("error" = "That prisoner is gone.")
var/kind = params["kind"]
@@ -791,7 +791,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
/datum/element/outpost_prison_mail_handover/Attach(datum/target)
. = ..()
- if(!istype(target, /mob/living/basic/outpost_prisoner))
+ if(!istype(target, /mob/living/carbon/human/npc/outpost_prisoner))
return ELEMENT_INCOMPATIBLE
RegisterSignal(target, COMSIG_ATOM_ITEM_INTERACTION, PROC_REF(on_item_interaction))
@@ -799,7 +799,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
UnregisterSignal(source, COMSIG_ATOM_ITEM_INTERACTION)
return ..()
-/datum/element/outpost_prison_mail_handover/proc/on_item_interaction(mob/living/basic/outpost_prisoner/source, mob/living/user, obj/item/tool, list/modifiers)
+/datum/element/outpost_prison_mail_handover/proc/on_item_interaction(mob/living/carbon/human/npc/outpost_prisoner/source, mob/living/user, obj/item/tool, list/modifiers)
SIGNAL_HANDLER
if(!istype(user) || user.combat_mode || is_outpost_prisoner(user) || !source.prison)
return NONE
@@ -823,7 +823,7 @@ GLOBAL_LIST_INIT(outpost_prison_mail_kinds, list(
var/read_for = 0
var/datum/weakref/seat_ref
-/datum/prisoner_activity/fetch_mail/New(mob/living/basic/outpost_prisoner/doer, obj/item/thing)
+/datum/prisoner_activity/fetch_mail/New(mob/living/carbon/human/npc/outpost_prisoner/doer, obj/item/thing)
. = ..(doer)
mail_ref = WEAKREF(thing)
diff --git a/voidcrew/modules/player_outposts/outpost_prison_npc_bodies.dm b/voidcrew/modules/player_outposts/outpost_prison_npc_bodies.dm
new file mode 100644
index 00000000000..c5e57d0bf43
--- /dev/null
+++ b/voidcrew/modules/player_outposts/outpost_prison_npc_bodies.dm
@@ -0,0 +1,120 @@
+/**
+ * # Prison NPC bodies
+ *
+ * Prisoners, guards and Kessler staff are real human bodies (voidcrew/modules/human_npcs/): they go
+ * down, bleed, stamcrit, get cuffed, die and come back through tg's own code. This file holds what the
+ * prison's own AI needs to use those bodies the way a person does:
+ * - outpost_prison_npc_hit(): a blow is a click with combat mode on, through the body's hands (a fist,
+ * a held shiv, a stun baton), so tg's damage, armour, wounds, knockdowns and logs apply.
+ * - Saved faces: a guard on the payroll is the same person each time the record sends them back
+ * (outpost_prison_save_look(), outpost_prison_apply_look()).
+ * - Bruising to a health: outpost_prison_bruise() and outpost_prison_set_health(), for a transfer's
+ * roughing up and the admin tools.
+ */
+
+/// Brute in which a limb is bruised by outpost_prison_bruise(): a multiple of it on a limb (0.75 or 0.5 of
+/// the body's health) comes to whole tenths of health
+#define OUTPOST_PRISON_BRUISE_STEP 0.4
+
+/**
+ * `hitter` strikes `target` beside it with `weapon` in hand (switched to the active hand), or a fist
+ * if `weapon` is null, the way a player clicks with combat mode on. The aim spreads over the body as
+ * other human NPCs' does. Returns TRUE if the blow was thrown: not if they can't swing yet, nor a second
+ * time in the same tick, which ClickOn() would ignore as it does a player's second click.
+ */
+/proc/outpost_prison_npc_hit(mob/living/carbon/human/hitter, atom/target, obj/item/weapon)
+ if(QDELETED(hitter) || QDELETED(target) || hitter.stat != CONSCIOUS || world.time < hitter.next_move || world.time <= hitter.next_click)
+ return FALSE
+ if(!hitter.Adjacent(target))
+ return FALSE
+ if(weapon)
+ if(!human_npc_ready_item(hitter, weapon))
+ return FALSE
+ else if(!human_npc_ready_empty_hand(hitter))
+ return FALSE
+ hitter.face_atom(target)
+ hitter.zone_selected = human_npc_pick_aim_zone()
+ var/old_combat_mode = hitter.combat_mode
+ hitter.set_combat_mode(TRUE, silent = TRUE)
+ hitter.ClickOn(target)
+ hitter.set_combat_mode(old_combat_mode, silent = TRUE)
+ return TRUE
+
+/// What makes a face: the bits of a random person a guard record keeps, so the same guard comes back
+/proc/outpost_prison_save_look(mob/living/carbon/human/person)
+ if(QDELETED(person))
+ return null
+ return list(
+ "gender" = person.gender,
+ "skin_tone" = person.skin_tone,
+ "hairstyle" = person.hairstyle,
+ "hair_color" = person.hair_color,
+ "facial_hairstyle" = person.facial_hairstyle,
+ "facial_hair_color" = person.facial_hair_color,
+ "eye_color" = person.eye_color_left,
+ "real_name" = person.real_name,
+ )
+
+/// Puts a face saved by outpost_prison_save_look() on `person`
+/proc/outpost_prison_apply_look(mob/living/carbon/human/person, list/look)
+ if(QDELETED(person) || !length(look))
+ return
+ person.gender = look["gender"] == FEMALE ? FEMALE : MALE
+ person.physique = person.gender
+ if(look["skin_tone"])
+ person.skin_tone = look["skin_tone"]
+ person.set_hairstyle(look["hairstyle"] || "Bald", update = FALSE)
+ if(look["hair_color"])
+ person.set_haircolor(look["hair_color"], update = FALSE)
+ person.set_facial_hairstyle(look["facial_hairstyle"] || "Shaved", update = FALSE)
+ if(look["facial_hair_color"])
+ person.set_facial_haircolor(look["facial_hair_color"], update = FALSE)
+ if(look["eye_color"])
+ person.set_eye_color(look["eye_color"])
+ person.update_body(is_creating = TRUE)
+
+/**
+ * Bruises `body` until it has lost `health_loss` health: brute spread over its limbs, no wounds and no
+ * attacker, as a rough transfer leaves someone, with the chest taking what is left. Arms and legs count
+ * for less of a body's health than its head and chest (body_damage_coeff), so each limb's share is
+ * measured in health and bruised in steps of OUTPOST_PRISON_BRUISE_STEP brute, which come to whole
+ * tenths of health; the chest, which counts in full, then makes the loss exact. Returns the health it
+ * ended at.
+ */
+/proc/outpost_prison_bruise(mob/living/carbon/body, health_loss)
+ if(QDELETED(body) || health_loss <= 0)
+ return body?.health
+ var/target_health = body.health - health_loss
+ var/obj/item/bodypart/chest = body.get_bodypart(BODY_ZONE_CHEST)
+ var/list/parts = body.get_damageable_bodyparts()
+ if(length(parts))
+ var/share = health_loss / length(parts)
+ for(var/obj/item/bodypart/part as anything in parts)
+ if(part == chest || part.body_damage_coeff <= 0)
+ continue
+ var/room = FLOOR(part.max_damage - part.get_damage(), OUTPOST_PRISON_BRUISE_STEP)
+ var/brute = min(round(share / part.body_damage_coeff, OUTPOST_PRISON_BRUISE_STEP), room)
+ if(brute > 0)
+ part.receive_damage(brute = brute, forced = TRUE, wound_bonus = CANT_WOUND, updating_health = FALSE)
+ body.updatehealth()
+ for(var/i in 1 to 5)
+ var/short = round(body.health - target_health, DAMAGE_PRECISION)
+ if(short <= 0 || !chest)
+ break
+ chest.receive_damage(brute = short, forced = TRUE, wound_bonus = CANT_WOUND)
+ body.update_damage_overlays()
+ return body.health
+
+/**
+ * Sets `body`'s health to `target_health` with brute alone: heals the brute it has, then bruises it
+ * down (outpost_prison_bruise()). Burns, toxins and lost air stay as they are, so a body with those
+ * can't be brought all the way up. For the admin tools. Returns the health it ended at.
+ */
+/proc/outpost_prison_set_health(mob/living/carbon/body, target_health)
+ if(QDELETED(body))
+ return null
+ if(body.getBruteLoss() > 0)
+ body.heal_overall_damage(brute = body.getBruteLoss(), forced = TRUE)
+ return outpost_prison_bruise(body, body.health - target_health)
+
+#undef OUTPOST_PRISON_BRUISE_STEP
diff --git a/voidcrew/modules/player_outposts/outpost_prison_panic.dm b/voidcrew/modules/player_outposts/outpost_prison_panic.dm
index ea647506707..38b269d00bd 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_panic.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_panic.dm
@@ -41,7 +41,7 @@
// ===== THE PRISONER =====
-/mob/living/basic/outpost_prisoner
+/mob/living/carbon/human/npc/outpost_prisoner
/// Seconds of fright left: full while a creature frightens them, counting down once none does. 0 when calm.
var/creature_panic_left = 0
/// The creature that frightened them last
@@ -61,11 +61,11 @@
var/running_scared = FALSE
/// Whether a creature has them frightened
-/mob/living/basic/outpost_prisoner/proc/is_panicking()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/is_panicking()
return creature_panic_left > 0
/// The creature that frightened them last, while it lives
-/mob/living/basic/outpost_prisoner/proc/panic_threat()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/panic_threat()
var/mob/living/threat = panic_threat_ref?.resolve()
if(QDELETED(threat) || threat.stat == DEAD)
return null
@@ -76,13 +76,13 @@
* (outpost_prison_changeling.dm): they asked for it, so the lock-in clock waits, and so does the
* pay it stops (update_locked_in(), confined_unpaid()).
*/
-/mob/living/basic/outpost_prisoner/proc/sheltering_from_creature()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/sheltering_from_creature()
if(!is_panicking() && !istype(activity, /datum/prisoner_activity/flee_creature))
return FALSE
return !!cell?.contains(src) && is_confined()
/// The creature they are going for, while they still are: a menace still, close, and not given up on
-/mob/living/basic/outpost_prisoner/proc/creature_foe()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/creature_foe()
if(!creature_foe_ref)
return null
var/mob/living/foe = creature_foe_ref.resolve()
@@ -92,19 +92,19 @@
return foe
/// They run while running from a creature, and walk otherwise
-/mob/living/basic/outpost_prisoner/proc/update_flee_speed()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/update_flee_speed()
var/wanted = stat != DEAD && (istype(activity, /datum/prisoner_activity/creature_panic) || (!!creature_retreat_spot && world.time < creature_retreat_until))
if(wanted == running_scared)
return
running_scared = wanted
// A loose meek bounty prisoner keeps their pace (outpost_prison_bounty.dm).
- set_varspeed(wanted ? OUTPOST_PANIC_FLEE_SPEED : bounty_base_speed())
+ set_prison_pace(hurry = wanted || bounty_base_speed())
/**
* A rioter running from a creature, planned from the trouble subtree: TRUE while they are on the
* way. At the spot, out of time or no longer rioting, they stop and riot on.
*/
-/mob/living/basic/outpost_prisoner/proc/plan_creature_retreat(datum/ai_controller/controller)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/plan_creature_retreat(datum/ai_controller/controller)
if(!creature_retreat_spot)
return FALSE
if(loc == creature_retreat_spot || world.time >= creature_retreat_until || !is_rioting())
@@ -115,7 +115,7 @@
controller.queue_behavior(/datum/ai_behavior/outpost_prisoner_creature_retreat)
return TRUE
-/mob/living/basic/outpost_prisoner/proc/finish_creature_retreat()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/finish_creature_retreat()
creature_retreat_spot = null
creature_retreat_until = 0
update_flee_speed()
@@ -127,7 +127,7 @@
action_cooldown = 0.5 SECONDS
/datum/ai_behavior/outpost_prisoner_creature_retreat/setup(datum/ai_controller/controller)
- var/mob/living/basic/outpost_prisoner/prisoner = controller.pawn
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = controller.pawn
var/turf/spot = prisoner?.creature_retreat_spot
if(!spot)
return FALSE
@@ -136,7 +136,7 @@
return TRUE
/datum/ai_behavior/outpost_prisoner_creature_retreat/perform(seconds_per_tick, datum/ai_controller/controller)
- var/mob/living/basic/outpost_prisoner/prisoner = controller.pawn
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = controller.pawn
if(!prisoner?.creature_retreat_spot || prisoner.loc != prisoner.creature_retreat_spot)
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED
prisoner.finish_creature_retreat()
@@ -146,7 +146,7 @@
. = ..()
if(!succeeded)
// No way through: they riot on from where they are.
- var/mob/living/basic/outpost_prisoner/prisoner = controller.pawn
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = controller.pawn
prisoner?.finish_creature_retreat()
/**
@@ -249,7 +249,7 @@
* everyone; otherwise it has to be within OUTPOST_PANIC_SIGHT_RANGE and in their sight, or within
* OUTPOST_PANIC_DOWNED_RANGE for one that only frightens up close.
*/
-/datum/outpost_prison/proc/frightens(mob/living/basic/outpost_prisoner/prisoner, mob/living/creature, menace, loose)
+/datum/outpost_prison/proc/frightens(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/creature, menace, loose)
var/turf/here = get_turf(prisoner)
var/turf/there = get_turf(creature)
if(!here || !there || here.z != there.z)
@@ -261,7 +261,7 @@
return get_dist(here, there) <= OUTPOST_PANIC_SIGHT_RANGE && can_see(here, there, OUTPOST_PANIC_SIGHT_RANGE)
/// The nearest of `threats` (creature = menace) that frightens `prisoner`, or null. `loose` marks those loose in the cell block.
-/datum/outpost_prison/proc/frightening_creature(mob/living/basic/outpost_prisoner/prisoner, list/threats, list/loose)
+/datum/outpost_prison/proc/frightening_creature(mob/living/carbon/human/npc/outpost_prisoner/prisoner, list/threats, list/loose)
var/mob/living/nearest
var/nearest_distance = INFINITY
for(var/mob/living/creature as anything in threats)
@@ -276,7 +276,7 @@
// ===== THE PRISON'S TICK =====
/// Whether a creature can frighten `prisoner` now: present and awake in the wing's custody, not loose, and not the experiment's subject
-/datum/outpost_prison/proc/can_panic(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/can_panic(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
return prisoner.prison == src && prisoner.phase == PRISONER_PRESENT && prisoner.stat == CONSCIOUS && !prisoner.experiment_subject && prisoner.trouble != PRISONER_TROUBLE_LOOSE
/**
@@ -289,7 +289,7 @@
for(var/mob/living/creature as anything in threats)
loose[creature] = threats[creature] == CREATURE_MENACE_FULL && in_cell_block(creature) && !creature_shut_in(creature)
var/shouts = 0
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners.Copy())
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners.Copy())
if(QDELETED(prisoner))
continue
if(!can_panic(prisoner))
@@ -317,7 +317,7 @@
* drops what they were doing (a wreck, squaring up to staff) and runs (start_panic()), or, already
* running, rethinks the way (the panic's reconsider()). Returns TRUE if they shouted.
*/
-/datum/outpost_prison/proc/react_to_creature(mob/living/basic/outpost_prisoner/prisoner, mob/living/threat, seconds, may_shout)
+/datum/outpost_prison/proc/react_to_creature(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/threat, seconds, may_shout)
if(prisoner.can_be_dragged() || prisoner.pulledby)
// Down, they neither run nor fight.
prisoner.creature_foe_ref = null
@@ -343,7 +343,7 @@
* `prisoner` breaks and runs (/datum/prisoner_activity/creature_panic), if their routine is free to.
* `shout` has them say so. Returns TRUE if they shouted.
*/
-/datum/outpost_prison/proc/start_panic(mob/living/basic/outpost_prisoner/prisoner, shout = FALSE)
+/datum/outpost_prison/proc/start_panic(mob/living/carbon/human/npc/outpost_prisoner/prisoner, shout = FALSE)
if(prisoner.prison != src || prisoner.experiment_subject || !prisoner.routine_allowed())
return FALSE
if(istype(prisoner.activity, /datum/prisoner_activity/creature_panic))
@@ -357,17 +357,17 @@
if(!shout || !prisoner.ai_running())
return FALSE
prisoner.next_panic_line = world.time + OUTPOST_EXPERIMENT_PANIC_GAP * rand(4, 6) / 10 SECONDS
- INVOKE_ASYNC(prisoner, TYPE_PROC_REF(/mob/living/basic/outpost_prisoner, say_context), "creature_flee")
+ INVOKE_ASYNC(prisoner, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prisoner, say_context), "creature_flee")
return TRUE
/// Still frightened with nothing in sight: they stay where they ran to, and go back to it if something else took them away
-/datum/outpost_prison/proc/keep_hiding(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/keep_hiding(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(istype(prisoner.activity, /datum/prisoner_activity/creature_panic) || istype(prisoner.activity, /datum/prisoner_activity/flee_creature))
return
start_panic(prisoner)
/// Cuffed, down or held: nowhere to go, so they cower and shout now and then. Returns TRUE if they shouted.
-/datum/outpost_prison/proc/cower_in_fright(mob/living/basic/outpost_prisoner/prisoner, may_shout)
+/datum/outpost_prison/proc/cower_in_fright(mob/living/carbon/human/npc/outpost_prisoner/prisoner, may_shout)
if(!may_shout && world.time < prisoner.next_panic_line)
return FALSE
prisoner.next_panic_line = world.time + OUTPOST_EXPERIMENT_PANIC_GAP * rand(8, 12) / 10 SECONDS
@@ -377,11 +377,11 @@
if(!may_shout && !wing_can_speak())
return FALSE
note_speech()
- INVOKE_ASYNC(prisoner, TYPE_PROC_REF(/mob/living/basic/outpost_prisoner, say_context), "creature_panic")
+ INVOKE_ASYNC(prisoner, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prisoner, say_context), "creature_panic")
return TRUE
/// Nothing has frightened them for OUTPOST_PANIC_CALM_TIME, or they can no longer be frightened: back to their day
-/datum/outpost_prison/proc/calm_from_panic(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/calm_from_panic(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
prisoner.creature_panic_left = 0
prisoner.panic_threat_ref = null
prisoner.creature_reaction = null
@@ -399,7 +399,7 @@
* mood and personality (outpost_prisoner_creature_fight_chance()). The roll holds for
* OUTPOST_PANIC_ROLL_HOLD. Returns what they did.
*/
-/datum/outpost_prison/proc/creature_roll(mob/living/basic/outpost_prisoner/prisoner, mob/living/threat)
+/datum/outpost_prison/proc/creature_roll(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/threat)
if(prisoner.creature_reaction && world.time < prisoner.creature_reaction_until)
return prisoner.creature_reaction
var/reaction = forced_creature_reaction
@@ -414,7 +414,7 @@
return reaction
/// Goes at the creature, with their shiv if they have one. A fight they were in is forgotten.
-/datum/outpost_prison/proc/stand_against_creature(mob/living/basic/outpost_prisoner/prisoner, mob/living/threat)
+/datum/outpost_prison/proc/stand_against_creature(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/threat)
if(prisoner.fight)
end_fight(prisoner.fight)
prisoner.cancel_threat()
@@ -431,7 +431,7 @@
* (flee_spot()) and riot on from there, or back off where they stand with nowhere to go. Returns
* TRUE if a rioter ran.
*/
-/datum/outpost_prison/proc/run_from_creature(mob/living/basic/outpost_prisoner/prisoner, mob/living/threat)
+/datum/outpost_prison/proc/run_from_creature(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/threat)
prisoner.creature_foe_ref = null
if(!prisoner.is_rioting())
if(prisoner.fight)
@@ -449,7 +449,7 @@
prisoner.creature_retreat_until = world.time + OUTPOST_PANIC_RETREAT_TIME
prisoner.update_flee_speed()
if(prisoner.ai_running() && prob(50))
- INVOKE_ASYNC(prisoner, TYPE_PROC_REF(/mob/living/basic/outpost_prisoner, say_context), "creature_flee")
+ INVOKE_ASYNC(prisoner, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prisoner, say_context), "creature_flee")
return TRUE
// ===== WHERE TO RUN =====
@@ -478,7 +478,7 @@
return steps
/// Where they hide at home: their own cell's chair or bed (home_seat()), or failing that any free tile of their own cell they can walk to, or null
-/datum/outpost_prison/proc/panic_home_spot(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/panic_home_spot(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/datum/outpost_prison_cell/home = prisoner.cell
if(!home || !prisoner.walkable)
return null
@@ -496,7 +496,7 @@
* passes within OUTPOST_PANIC_PATH_MARGIN of it and no farther from it than they stand now. Once they
* are inside the cell, only it coming in makes home unsafe.
*/
-/datum/outpost_prison/proc/home_is_safe(mob/living/basic/outpost_prisoner/prisoner, turf/home, mob/living/threat)
+/datum/outpost_prison/proc/home_is_safe(mob/living/carbon/human/npc/outpost_prisoner/prisoner, turf/home, mob/living/threat)
var/datum/outpost_prison_cell/own = prisoner.cell
if(!own || !home)
return FALSE
@@ -533,7 +533,7 @@
* passing beside it that is farthest from it, out of its sight if any is, and not within
* OUTPOST_PANIC_SPOT_MARGIN of it. Null when there is nowhere: they are cornered.
*/
-/datum/outpost_prison/proc/flee_spot(mob/living/basic/outpost_prisoner/prisoner, mob/living/threat)
+/datum/outpost_prison/proc/flee_spot(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/living/threat)
var/turf/here = get_turf(prisoner)
var/turf/danger = get_turf(threat)
if(!here || !danger || !length(prisoner.walkable))
@@ -718,7 +718,7 @@
/// What they shout: to be bolted in, on the way home or in it; to run, otherwise; about the dark, now and then, with a nightmare about
/datum/prisoner_activity/creature_panic/proc/panic_line()
var/mob/living/threat = prisoner.panic_threat()
- var/nightmare = istype(threat, /mob/living/basic/outpost_experiment/nightmare) || (!threat && prisoner.prison?.experiment?.form == "nightmare")
+ var/nightmare = outpost_experiment_form_name(threat) == "nightmare" || (!threat && prisoner.prison?.experiment?.form == "nightmare")
if(nightmare && prob(50))
return "nightmare_fear"
return plan == "home" ? "creature_panic" : "creature_flee"
diff --git a/voidcrew/modules/player_outposts/outpost_prison_pastimes.dm b/voidcrew/modules/player_outposts/outpost_prison_pastimes.dm
index 52996783238..584decf82c2 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_pastimes.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_pastimes.dm
@@ -70,7 +70,7 @@
/// Seconds since the last look for scrubbed marks
var/mark_check_clock = 0
-/mob/living/basic/outpost_prisoner
+/mob/living/carbon/human/npc/outpost_prisoner
/// Between the lifts a card game gives them
COOLDOWN_DECLARE(cards_mood_cooldown)
/// Between the lifts a game of basketball with staff gives them
@@ -83,7 +83,7 @@
/// Hooks up the prisoner's side of the pastimes; called from setup_extras(). Nothing to hook: the
/// pastimes run from activities and the prison's clock.
-/mob/living/basic/outpost_prisoner/proc/setup_pastimes()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/setup_pastimes()
return
/// Advances the party, the game with staff and the marks on the walls by `seconds`
@@ -140,7 +140,7 @@
return found
/// Whether `prisoner` could sit on `stool` now: they can walk there, and nobody else sits on it, stands on it or has it
-/datum/outpost_prison/proc/stool_free_for(obj/structure/chair/stool, mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/stool_free_for(obj/structure/chair/stool, mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/turf/seat = get_turf(stool)
if(QDELETED(stool) || !seat || !prisoner.walkable?[seat] || claimed_by_other(stool, prisoner))
return FALSE
@@ -202,7 +202,7 @@
/// Whether members of the wing sitting at the table are dealt in
var/deals_in_members = FALSE
-/datum/prisoner_activity/table_game/New(mob/living/basic/outpost_prisoner/doer, datum/prisoner_activity/table_game/host_game)
+/datum/prisoner_activity/table_game/New(mob/living/carbon/human/npc/outpost_prisoner/doer, datum/prisoner_activity/table_game/host_game)
. = ..(doer)
if(host_game)
game_ref = WEAKREF(host_game)
@@ -284,7 +284,7 @@
return best
/// Whether `other` may be called over: free for leisure (the chat's rule), not hungry, and no rival of the host
-/datum/prisoner_activity/table_game/proc/can_invite(mob/living/basic/outpost_prisoner/other)
+/datum/prisoner_activity/table_game/proc/can_invite(mob/living/carbon/human/npc/outpost_prisoner/other)
if(other == prisoner || QDELETED(other) || !other.routine_allowed() || !other.ai_running())
return FALSE
var/datum/prisoner_activity/doing = other.activity
@@ -303,7 +303,7 @@
free_stools++
if(!free_stools)
return FALSE
- for(var/mob/living/basic/outpost_prisoner/other in prison.prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/other in prison.prisoners)
if(can_invite(other))
return TRUE
return FALSE
@@ -454,7 +454,7 @@
if(own && prisoner.buckled == own)
seats += list(list(prisoner, own, prison.table_beside(own)))
for(var/datum/weakref/joiner_ref as anything in joiner_refs)
- var/mob/living/basic/outpost_prisoner/joiner = joiner_ref.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/joiner = joiner_ref.resolve()
var/datum/prisoner_activity/table_game/seat = joiner?.activity
if(!istype(seat) || seat.game_ref?.resolve() != src || !seat.started)
continue
@@ -491,7 +491,7 @@
var/datum/outpost_prison/prison = prisoner.prison
var/list/live = list()
for(var/datum/weakref/joiner_ref as anything in joiner_refs)
- var/mob/living/basic/outpost_prisoner/joiner = joiner_ref.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/joiner = joiner_ref.resolve()
var/datum/prisoner_activity/table_game/seat = joiner?.activity
if(istype(seat) && seat.game_ref?.resolve() == src)
live += joiner_ref
@@ -500,14 +500,14 @@
if(room <= 0)
return 0
var/list/candidates = list()
- for(var/mob/living/basic/outpost_prisoner/other in shuffle(prison.prisoners))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/other in shuffle(prison.prisoners))
if(can_invite(other))
candidates += other
- var/mob/living/basic/outpost_prisoner/first_called
+ var/mob/living/carbon/human/npc/outpost_prisoner/first_called
var/came = 0
while(room > 0 && length(candidates))
- var/mob/living/basic/outpost_prisoner/best
- for(var/mob/living/basic/outpost_prisoner/other as anything in candidates)
+ var/mob/living/carbon/human/npc/outpost_prisoner/best
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/other as anything in candidates)
if(!best || prison.affinity(prisoner, other) > prison.affinity(prisoner, best))
best = other
candidates -= best
@@ -523,7 +523,7 @@
return came
/// Gives `other` a seat at this game and sends them to it. TRUE if they are coming.
-/datum/prisoner_activity/table_game/proc/seat_joiner(mob/living/basic/outpost_prisoner/other)
+/datum/prisoner_activity/table_game/proc/seat_joiner(mob/living/carbon/human/npc/outpost_prisoner/other)
if(!seat_type || QDELETED(other))
return FALSE
var/datum/prisoner_activity/table_game/seat = new seat_type(other, src)
@@ -537,7 +537,7 @@
/// Sends everyone the host called over back to their own business
/datum/prisoner_activity/table_game/proc/release_joiners()
for(var/datum/weakref/joiner_ref as anything in joiner_refs)
- var/mob/living/basic/outpost_prisoner/joiner = joiner_ref.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/joiner = joiner_ref.resolve()
var/datum/prisoner_activity/table_game/seat = joiner?.activity
if(istype(seat) && seat.game_ref?.resolve() == src)
joiner.end_activity()
@@ -738,7 +738,7 @@
/datum/prisoner_activity/cards/proc/reward_players(list/in_hand)
var/datum/outpost_prison/prison = prisoner.prison
for(var/mob/living/player as anything in in_hand)
- var/mob/living/basic/outpost_prisoner/inmate = player
+ var/mob/living/carbon/human/npc/outpost_prisoner/inmate = player
if(istype(inmate))
if(COOLDOWN_FINISHED(inmate, cards_mood_cooldown))
COOLDOWN_START(inmate, cards_mood_cooldown, PRISON_CARDS_MOOD_GAP)
@@ -755,19 +755,19 @@
if(!prob(PRISON_CARDS_TALK_CHANCE))
return
var/list/inmate_losers = list()
- for(var/mob/living/basic/outpost_prisoner/loser in in_hand)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/loser in in_hand)
if(loser != winner)
inmate_losers += loser
- var/mob/living/basic/outpost_prisoner/inmate_winner = is_outpost_prisoner(winner) ? winner : null
+ var/mob/living/carbon/human/npc/outpost_prisoner/inmate_winner = is_outpost_prisoner(winner) ? winner : null
if(inmate_winner && (!length(inmate_losers) || prob(55)))
- var/mob/living/basic/outpost_prisoner/beaten = length(inmate_losers) ? pick(inmate_losers) : null
+ var/mob/living/carbon/human/npc/outpost_prisoner/beaten = length(inmate_losers) ? pick(inmate_losers) : null
if(beaten)
inmate_winner.face_atom(beaten)
inmate_winner.say_context("cards_win", beaten)
return
if(!length(inmate_losers))
return
- var/mob/living/basic/outpost_prisoner/grumbler = pick(inmate_losers)
+ var/mob/living/carbon/human/npc/outpost_prisoner/grumbler = pick(inmate_losers)
grumbler.face_atom(winner)
if(inmate_winner)
grumbler.say_context("cards_lose", inmate_winner)
@@ -792,8 +792,8 @@
var/list/talkers = seated_prisoners()
if(!length(talkers))
return
- var/mob/living/basic/outpost_prisoner/speaker = pick(talkers)
- var/mob/living/basic/outpost_prisoner/other = length(talkers) > 1 ? pick(talkers - speaker) : null
+ var/mob/living/carbon/human/npc/outpost_prisoner/speaker = pick(talkers)
+ var/mob/living/carbon/human/npc/outpost_prisoner/other = length(talkers) > 1 ? pick(talkers - speaker) : null
if(speaker.say_context("cards", other))
prison.note_speech()
@@ -807,7 +807,7 @@
return FALSE
COOLDOWN_START(prison, cards_missing_cooldown, PRISON_CARDS_MISSING_GAP)
var/list/talkers = seated_prisoners()
- var/mob/living/basic/outpost_prisoner/speaker = length(talkers) ? pick(talkers) : prisoner
+ var/mob/living/carbon/human/npc/outpost_prisoner/speaker = length(talkers) ? pick(talkers) : prisoner
return speaker.say_context("cards_missing")
/datum/prisoner_activity/cards/end_game()
@@ -815,7 +815,7 @@
/// The admin panel's card game: a prisoner free to play takes a deck to its table and calls others over. A log line, or null.
/datum/outpost_prison/proc/admin_start_cards()
- for(var/mob/living/basic/outpost_prisoner/host in shuffle(prisoners))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/host in shuffle(prisoners))
if(!host.ai_running() || !host.routine_allowed())
continue
var/datum/prisoner_activity/doing = host.activity
@@ -912,7 +912,7 @@
/// The prisoner rolling against the host, while they still sit at the table
/datum/prisoner_activity/dice/proc/partner()
- var/mob/living/basic/outpost_prisoner/other = partner_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/other = partner_ref?.resolve()
return (other && front_of(other)) ? other : null
/datum/prisoner_activity/dice/play_step()
@@ -923,7 +923,7 @@
return ACTIVITY_CONTINUE
if(--roll_wait > 0)
return ACTIVITY_CONTINUE
- var/mob/living/basic/outpost_prisoner/roller = turn == 1 ? prisoner : partner()
+ var/mob/living/carbon/human/npc/outpost_prisoner/roller = turn == 1 ? prisoner : partner()
if(rounds_left <= 0 || !roller || !roll_die(roller))
stage = "tidy"
steps = 0
@@ -931,8 +931,8 @@
return ACTIVITY_CONTINUE
/// Where `roller` rolls to: the table in front of the other player, else the table two tiles off
-/datum/prisoner_activity/dice/proc/roll_target(mob/living/basic/outpost_prisoner/roller)
- var/mob/living/basic/outpost_prisoner/other = roller == prisoner ? partner() : prisoner
+/datum/prisoner_activity/dice/proc/roll_target(mob/living/carbon/human/npc/outpost_prisoner/roller)
+ var/mob/living/carbon/human/npc/outpost_prisoner/other = roller == prisoner ? partner() : prisoner
var/turf/front = front_of(other)
if(front && front != get_turf(roller))
return front
@@ -942,7 +942,7 @@
return front_of(roller)
/// `roller` picks up the die and rolls it across the table. TRUE if it is rolling.
-/datum/prisoner_activity/dice/proc/roll_die(mob/living/basic/outpost_prisoner/roller)
+/datum/prisoner_activity/dice/proc/roll_die(mob/living/carbon/human/npc/outpost_prisoner/roller)
var/obj/item/dice/die = die_ref?.resolve()
if(QDELETED(die))
return FALSE
@@ -980,11 +980,11 @@
/// Both have rolled: the higher roll wins and usually says so. Returns the winner, or null for a draw.
/datum/prisoner_activity/dice/proc/settle_round()
last_winner_ref = null
- var/mob/living/basic/outpost_prisoner/other = partner_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/other = partner_ref?.resolve()
if(!other || rolls[1] == rolls[2])
return null
- var/mob/living/basic/outpost_prisoner/winner = rolls[1] > rolls[2] ? prisoner : other
- var/mob/living/basic/outpost_prisoner/loser = winner == prisoner ? other : prisoner
+ var/mob/living/carbon/human/npc/outpost_prisoner/winner = rolls[1] > rolls[2] ? prisoner : other
+ var/mob/living/carbon/human/npc/outpost_prisoner/loser = winner == prisoner ? other : prisoner
last_winner_ref = WEAKREF(winner)
if(prob(70) && winner.stat == CONSCIOUS)
winner.face_atom(loser)
@@ -1034,7 +1034,7 @@
/// The prisoner whose birthday it is and who has not had their party, if any is in the wing
/datum/outpost_prison/proc/birthday_host()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.has_birthday && !prisoner.party_done && prisoner.stat != DEAD && prisoner.phase == PRISONER_PRESENT)
return prisoner
return null
@@ -1043,7 +1043,7 @@
* Keeps `cake` for `host`'s party: nobody eats it as a meal while it waits (reserved_supply()).
* `giver` is whoever put it on the hatch or handed it over. Never sleeps. Returns TRUE if it is kept.
*/
-/datum/outpost_prison/proc/start_party(mob/living/basic/outpost_prisoner/host, obj/item/food/cake/cake, mob/living/giver)
+/datum/outpost_prison/proc/start_party(mob/living/carbon/human/npc/outpost_prisoner/host, obj/item/food/cake/cake, mob/living/giver)
if(party_stage || QDELETED(host) || !istype(cake) || QDELETED(cake))
return FALSE
if(!host.has_birthday || host.party_done || host.stat == DEAD || host.phase != PRISONER_PRESENT || !(host in prisoners))
@@ -1059,7 +1059,7 @@
/// Sends the host to fetch the cake, once they are free. TRUE if they are on it.
/datum/outpost_prison/proc/try_start_party_host()
- var/mob/living/basic/outpost_prisoner/host = party_host_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/host = party_host_ref?.resolve()
if(!host || party_stage != PARTY_WAITING || !party_cake())
return FALSE
if(istype(host.activity, /datum/prisoner_activity/party_host))
@@ -1078,7 +1078,7 @@
return TRUE
/// Whether `guest` would come over to the party: awake, free and not busy with a meal or a duty
-/datum/outpost_prison/proc/party_guest_free(mob/living/basic/outpost_prisoner/guest)
+/datum/outpost_prison/proc/party_guest_free(mob/living/carbon/human/npc/outpost_prisoner/guest)
if(QDELETED(guest) || !guest.ai_running() || !guest.routine_allowed())
return FALSE
var/datum/prisoner_activity/doing = guest.activity
@@ -1093,7 +1093,7 @@
* Returns TRUE if it began.
*/
/datum/outpost_prison/proc/party_ready(turf/spot)
- var/mob/living/basic/outpost_prisoner/host = party_host_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/host = party_host_ref?.resolve()
if(party_stage != PARTY_WAITING || !host || !spot)
return FALSE
party_spot = spot
@@ -1101,14 +1101,14 @@
party_stage_seconds = 0
party_scene_seconds = 0
party_guests = list()
- for(var/mob/living/basic/outpost_prisoner/guest in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/guest in prisoners)
if(guest != host)
invite_party_guest(guest)
host.manual_emote("waves everyone over.")
return TRUE
/// Calls `guest` over to the party. TRUE if they are coming.
-/datum/outpost_prison/proc/invite_party_guest(mob/living/basic/outpost_prisoner/guest)
+/datum/outpost_prison/proc/invite_party_guest(mob/living/carbon/human/npc/outpost_prisoner/guest)
if(!party_spot || !party_guest_free(guest))
return FALSE
var/datum/prisoner_activity/party_guest/coming = new(guest)
@@ -1123,7 +1123,7 @@
/datum/outpost_prison/proc/present_guests(arrived_only = TRUE)
var/list/found = list()
for(var/datum/weakref/guest_ref as anything in party_guests)
- var/mob/living/basic/outpost_prisoner/guest = guest_ref.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/guest = guest_ref.resolve()
var/datum/prisoner_activity/party_guest/attending = guest?.activity
if(!istype(attending) || guest.stat != CONSCIOUS || (arrived_only && !attending.started))
continue
@@ -1139,7 +1139,7 @@
/datum/outpost_prison/proc/party_tick(seconds)
if(!party_stage)
return
- var/mob/living/basic/outpost_prisoner/host = party_host_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/host = party_host_ref?.resolve()
if(!host || !(host in prisoners) || host.stat == DEAD || host.phase != PRISONER_PRESENT)
end_party()
return
@@ -1174,7 +1174,7 @@
/// The candles go out, and the guests cheer and clap
/datum/outpost_prison/proc/blow_candles()
- var/mob/living/basic/outpost_prisoner/host = party_host_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/host = party_host_ref?.resolve()
var/obj/item/food/cake/cake = party_cake()
if(!host || !cake)
end_party()
@@ -1184,7 +1184,7 @@
host.face_atom(cake)
host.manual_emote("blows out the candles.")
var/cheers = 0
- for(var/mob/living/basic/outpost_prisoner/guest as anything in shuffle(present_guests()))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/guest as anything in shuffle(present_guests()))
guest.face_atom(cake)
if(cheers < 2)
addtimer(CALLBACK(src, PROC_REF(say_life_line), WEAKREF(guest), "birthday_party", WEAKREF(host)), (0.5 + 0.8 * cheers) SECONDS)
@@ -1199,7 +1199,7 @@
* table. Crumbs are left behind.
*/
/datum/outpost_prison/proc/serve_party()
- var/mob/living/basic/outpost_prisoner/host = party_host_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/host = party_host_ref?.resolve()
var/obj/item/food/cake/cake = party_cake()
var/turf/center = party_spot || get_turf(cake)
if(!host || !cake || !center)
@@ -1216,11 +1216,11 @@
host.visible_message(span_notice("[host] cuts [cake] and passes the slices round."))
qdel(cake)
var/list/diners = list(host)
- for(var/mob/living/basic/outpost_prisoner/guest as anything in present_guests())
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/guest as anything in present_guests())
if(get_dist(guest, center) <= PRISON_PARTY_REACH)
diners += guest
party_diners = list()
- for(var/mob/living/basic/outpost_prisoner/diner as anything in diners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/diner as anything in diners)
diner.drop_held_item()
// Beside the table they take theirs off it; further round, the slice is passed along to them.
// Nobody picks anything up from further off than they can reach (take_item()).
@@ -1237,12 +1237,12 @@
/// Everyone eats their slice; the host thanks whoever brought the cake, and has had their party
/datum/outpost_prison/proc/finish_party()
- var/mob/living/basic/outpost_prisoner/host = party_host_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/host = party_host_ref?.resolve()
var/fed = 0
for(var/list/entry as anything in party_diners)
var/datum/weakref/diner_ref = entry[1]
var/datum/weakref/slice_ref = entry[2]
- var/mob/living/basic/outpost_prisoner/diner = diner_ref.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/diner = diner_ref.resolve()
var/obj/item/food/slice = slice_ref.resolve()
if(!diner || !slice || diner.held_item != slice || diner.stat != CONSCIOUS)
continue
@@ -1268,7 +1268,7 @@
* `diner` eats a slice of the birthday cake. It counts as a cooked meal however the cake was made
* (a birthday cake is junk food to outpost_prisoner_food_tier()), as the build plan asks.
*/
-/datum/outpost_prison/proc/party_feed(mob/living/basic/outpost_prisoner/diner, obj/item/food/slice)
+/datum/outpost_prison/proc/party_feed(mob/living/carbon/human/npc/outpost_prisoner/diner, obj/item/food/slice)
if(outpost_prisoner_food_tier(slice) == "cooked")
diner.eat_food(slice)
return
@@ -1289,7 +1289,7 @@
/// The party is over or off: everyone goes back to their day, and the cake (if uneaten) is ordinary food
/datum/outpost_prison/proc/end_party()
var/list/guests = party_guests
- var/mob/living/basic/outpost_prisoner/host = party_host_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/host = party_host_ref?.resolve()
clear_party_state()
dismiss_party_guests(guests)
if(host && istype(host.activity, /datum/prisoner_activity/party_host))
@@ -1297,7 +1297,7 @@
/datum/outpost_prison/proc/dismiss_party_guests(list/guests)
for(var/datum/weakref/guest_ref as anything in guests)
- var/mob/living/basic/outpost_prisoner/guest = guest_ref.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/guest = guest_ref.resolve()
if(guest && istype(guest.activity, /datum/prisoner_activity/party_guest))
guest.end_activity()
@@ -1314,7 +1314,7 @@
party_diners = list()
/// Whether `thing` is the cake kept for a party, which nobody may eat as a meal
-/datum/outpost_prison/proc/reserved_supply(obj/item/thing, mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/reserved_supply(obj/item/thing, mob/living/carbon/human/npc/outpost_prisoner/prisoner)
return !!party_stage && !!thing && thing == party_cake()
/**
@@ -1322,7 +1322,7 @@
* eaten this way. A whole cake handed to the prisoner whose birthday it is starts their party: they
* take it, and fetch it to a table once they are free. Runs in a signal handler: never sleeps.
*/
-/datum/outpost_prison/proc/pastime_pre_eat(mob/living/basic/outpost_prisoner/prisoner, atom/food, mob/living/feeder)
+/datum/outpost_prison/proc/pastime_pre_eat(mob/living/carbon/human/npc/outpost_prisoner/prisoner, atom/food, mob/living/feeder)
if(reserved_supply(food, prisoner))
// Handing the kept cake to the birthday prisoner saves them fetching it.
if(party_stage == PARTY_WAITING && prisoner == party_host_ref?.resolve() && istype(feeder) && food.loc == feeder && !prisoner.held_item && feeder.temporarilyRemoveItemFromInventory(food))
@@ -1359,7 +1359,7 @@
if(!QDELETED(whole) && whole.loc == hatch?.loc)
cake = whole
break
- var/mob/living/basic/outpost_prisoner/host = birthday_host()
+ var/mob/living/carbon/human/npc/outpost_prisoner/host = birthday_host()
if(!cake || !host || !start_party(host, cake, user))
return FALSE
INVOKE_ASYNC(src, PROC_REF(try_start_party_host))
@@ -1591,7 +1591,7 @@
/// The hoop a prisoner is shooting at now, or null when nobody is playing
/datum/outpost_prison/proc/game_hoop()
- for(var/mob/living/basic/outpost_prisoner/player in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/player in prisoners)
var/datum/prisoner_activity/basketball/game = player.activity
if(!istype(game) || !game.started || player.stat != CONSCIOUS)
continue
@@ -1603,7 +1603,7 @@
/// Prisoners playing basketball now
/datum/outpost_prison/proc/basketball_players()
var/list/players = list()
- for(var/mob/living/basic/outpost_prisoner/player in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/player in prisoners)
if(player.stat == CONSCIOUS && istype(player.activity, /datum/prisoner_activity/basketball) && player.activity.started)
players += player
return players
@@ -1611,7 +1611,7 @@
/// Prisoners watching the game at `hoop`
/datum/outpost_prison/proc/game_watchers(obj/structure/hoop/hoop)
var/list/watchers = list()
- for(var/mob/living/basic/outpost_prisoner/watcher in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/watcher in prisoners)
var/datum/prisoner_activity/watch_game/watching = watcher.activity
if(istype(watching) && watching.started && watcher.stat == CONSCIOUS && watching.hoop_ref?.resolve() == hoop)
watchers += watcher
@@ -1668,7 +1668,7 @@
/// Each prisoner playing now cheers up for playing with staff, at most every PRISON_STAFF_GAME_MOOD_GAP
/datum/outpost_prison/proc/lift_staff_game_players()
- for(var/mob/living/basic/outpost_prisoner/player as anything in basketball_players())
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/player as anything in basketball_players())
if(!COOLDOWN_FINISHED(player, staff_game_mood_cooldown))
continue
COOLDOWN_START(player, staff_game_mood_cooldown, PRISON_STAFF_GAME_MOOD_GAP)
@@ -1683,11 +1683,11 @@
return
var/mob/living/shooter = shooter_ref?.resolve()
var/list/watchers = game_watchers(hoop)
- for(var/mob/living/basic/outpost_prisoner/watcher as anything in watchers)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/watcher as anything in watchers)
watcher.face_atom(hoop)
if(score_event)
var/list/announcers = length(watchers) ? watchers : basketball_players()
- var/mob/living/basic/outpost_prisoner/announcer = length(announcers) ? pick(announcers) : null
+ var/mob/living/carbon/human/npc/outpost_prisoner/announcer = length(announcers) ? pick(announcers) : null
var/mob/living/staff = staff_ref?.resolve()
switch(score_event)
if("call")
@@ -1698,7 +1698,7 @@
announcer?.say_to_staff("game_lost", staff)
if(scored && length(watchers) && COOLDOWN_FINISHED(src, crowd_clap_cooldown))
COOLDOWN_START(src, crowd_clap_cooldown, PRISON_CROWD_CLAP_GAP)
- for(var/mob/living/basic/outpost_prisoner/watcher as anything in watchers)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/watcher as anything in watchers)
if(prob(70))
watcher.manual_emote("claps.")
playsound(watcher, pick('sound/mobs/humanoids/human/clap/clap1.ogg', 'sound/mobs/humanoids/human/clap/clap2.ogg', 'sound/mobs/humanoids/human/clap/clap3.ogg'), 35, TRUE)
@@ -1708,7 +1708,7 @@
if(!context)
return
COOLDOWN_START(src, crowd_line_cooldown, PRISON_CROWD_LINE_GAP)
- var/mob/living/basic/outpost_prisoner/speaker = pick(watchers)
+ var/mob/living/carbon/human/npc/outpost_prisoner/speaker = pick(watchers)
if(is_outpost_prisoner(shooter))
speaker.say_context(context, shooter)
else if(shooter)
@@ -1822,7 +1822,7 @@
return initials || "Someone"
/// The crayon state for a prisoner's mark: their first initial, or a doodle
-/proc/outpost_prisoner_mark_state(mob/living/basic/outpost_prisoner/prisoner)
+/proc/outpost_prisoner_mark_state(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/letter = lowertext(copytext(prisoner.real_name, 1, 2))
if(prob(PRISON_MARK_INITIAL_CHANCE) && length(letter) == 1 && text2ascii(letter) >= 97 && text2ascii(letter) <= 122)
return letter
@@ -1844,7 +1844,7 @@
* "R.D. was here." A cell keeps PRISON_CELL_MARKS_MAX marks; a new one replaces the oldest.
* Crayon marks are not mess (outpost_prison_conditions.dm). Returns the mark, or null.
*/
-/datum/outpost_prison/proc/add_cell_mark(mob/living/basic/outpost_prisoner/prisoner, turf/wall)
+/datum/outpost_prison/proc/add_cell_mark(mob/living/carbon/human/npc/outpost_prisoner/prisoner, turf/wall)
var/datum/outpost_prison_cell/home = prisoner?.cell
if(!home || !isclosedturf(wall))
return null
@@ -1871,7 +1871,7 @@
/// A mark is going for a newer one: whoever made it no longer looks for it
/datum/outpost_prison/proc/forget_wall_mark(obj/effect/decal/cleanable/crayon/mark)
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.wall_mark_ref?.resolve() == mark)
prisoner.wall_mark_ref = null
prisoner.wall_mark_spot = null
@@ -1882,7 +1882,7 @@
*/
/datum/outpost_prison/proc/check_scrubbed_marks()
var/noticed = 0
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(!prisoner.wall_mark_ref || prisoner.stat != CONSCIOUS || prisoner.phase != PRISONER_PRESENT)
continue
var/obj/effect/decal/cleanable/crayon/mark = prisoner.wall_mark_ref.resolve()
diff --git a/voidcrew/modules/player_outposts/outpost_prison_prisoner.dm b/voidcrew/modules/player_outposts/outpost_prison_prisoner.dm
index 369d99e208c..a3a2f07fa06 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_prisoner.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_prisoner.dm
@@ -1,61 +1,51 @@
/**
* # Outpost prisoner
*
- * An inmate of a player outpost's prison wing (outpost_prison_core.dm). Each prisoner owns one
- * cell, beams into it on arrival and out of it on release, and fills the time in between with the
- * routine in outpost_prison_routine.dm. They talk (outpost_prison_dialogue.dm), and when unhappy
- * they threaten, fight, riot and escape (outpost_prison_trouble.dm, outpost_prison_riot.dm).
+ * An inmate of a player outpost's prison wing (outpost_prison_core.dm), and a real human body
+ * (voidcrew/modules/human_npcs/): they breathe, bleed, bruise, stamcrit, go into crit, die and can be
+ * revived through tg's own code, like anyone. Each prisoner owns one cell, beams into it on arrival
+ * and out of it on release, and fills the time in between with the routine in
+ * outpost_prison_routine.dm. They talk (outpost_prison_dialogue.dm), and when unhappy they threaten,
+ * fight, riot and escape (outpost_prison_trouble.dm, outpost_prison_riot.dm).
*
* Needs, on 0-100 scales: `hunger` falls over time and food restores it, by how good the food
- * is; `uniform_grime` rises over time, three times as fast at sport, and a cleaner prison uniform
- * resets it. Health does not come back on its own; brute medical stacks treat it. Arrivals come in
- * hungry, a third in a stained uniform and a fifth roughed up in transfer. A thought bubble with
- * the item they need shows when one needs attention, cycling when they need several. They bleed
- * when hit, and drip while badly hurt. They take supplies only from a serving hatch or from a
- * person's hand (outpost_prison_core.dm).
+ * is (the prison's own meter: human NPCs have tg's hunger off); `uniform_grime` rises over time,
+ * three times as fast at sport, shows on the real prison jumpsuit they wear, and a cleaner prison
+ * uniform resets it. Health does not come back on its own; treatment does. Arrivals come in hungry, a
+ * third in a stained uniform and a fifth roughed up in transfer (real limb damage). A thought bubble
+ * with the item they need shows when one needs attention, cycling when they need several. They take
+ * supplies only from a serving hatch or from a person's hand (outpost_prison_core.dm), into a real hand.
*
- * Awake, they cannot be dragged onto things or boxed, and only a calm one (calm_for_pull()) can be
- * pulled, going along with it (outpost_prison_warden_tools.dm). Knocked down, in stamina crit,
- * cuffed or dead, staff can drag them; stamina crit lasts PRISONER_STAMCRIT_TIME after the last
- * hit. Cuffs and lockdown are in outpost_prison_capture.dm.
+ * Owner ruling OC-11: their jumpsuit, contraband and shivs are ordinary items, not locked to them, so
+ * they can be searched, stripped and disarmed like anyone. Awake and free they keep out of bags and
+ * lockers (a bluespace bag is a way out of the wing); down or dead they can be bagged. Anyone can
+ * pull them: a calm one goes along with it (outpost_prison_warden_tools.dm), one making trouble
+ * resists it, as anyone can. Cuffs (tg's) and lockdown are in outpost_prison_capture.dm.
*/
/// Trait source for the beam holding a prisoner still
#define PRISONER_BEAM_TRAIT "outpost_prisoner_beam"
/// Offset source for sitting on a bed edge
#define PRISONER_SITTING_OFFSET "outpost_prisoner_sitting"
+/// Trait source for what only an awake prisoner on their feet refuses (a bag, a locker)
+#define PRISONER_AWAKE_TRAIT "outpost_prisoner_awake"
-/mob/living/basic/outpost_prisoner
+/mob/living/carbon/human/npc/outpost_prisoner
name = "prisoner"
desc = "An inmate of the outpost's prison wing."
- icon = 'icons/mob/simple/simple_human.dmi'
- unique_name = FALSE
combat_mode = FALSE
- mob_biotypes = MOB_ORGANIC | MOB_HUMANOID
- sentience_type = SENTIENCE_HUMANOID
- maxHealth = 100
- health = 100
- speed = 2
- // Heavy while awake, so nobody shoves them about; see update_drag_resistance().
- move_resist = MOVE_FORCE_VERY_STRONG
- density = TRUE
- basic_mob_flags = NONE
- // tg's human deathgasp
- death_message = "seizes up and falls limp, their eyes dead and lifeless..."
- // They lie down on beds, when knocked down and when dead.
- mobility_flags = MOBILITY_FLAGS_REST_CAPABLE_DEFAULT
- rotate_on_lying = TRUE
- blood_volume = BLOOD_VOLUME_NORMAL
- // Batons knock them down, as they do people.
- status_flags = CANPUSH | CANSTUN | CANKNOCKDOWN
- stamina_regen_time = PRISONER_STAMCRIT_TIME
- // No air needs yet: a breach must not kill the inmates.
- unsuitable_atmos_damage = 0
- unsuitable_cold_damage = 0
- unsuitable_heat_damage = 0
- response_help_continuous = "pats"
- response_help_simple = "pat"
+ faction = list(FACTION_NEUTRAL)
ai_controller = /datum/ai_controller/basic_controller/outpost_prisoner
+ npc_outfit = /datum/outfit/outpost_prisoner
+ // Owner ruling OC-11: their jumpsuit, contraband and shivs are ordinary items, so shakedowns,
+ // confiscation and uniform swaps work. Searched and stripped like anyone.
+ npc_gear_locked = FALSE
+ // They stop once someone is down (defaults 1.13).
+ npc_target_stat = HUMAN_NPC_SPARES_DOWNED
+ // The prison owns the body: it lies in the cell block until carried out (outpost_prison_economy.dm).
+ npc_corpse_lifetime = 0
+ // No air tank: the cell block's emergency lockers have the masks and tanks (outpost_prison_conditions.dm).
+ npc_internals = TRUE
/// The prison holding them
var/datum/outpost_prison/prison
@@ -80,8 +70,6 @@
var/locked_in_seconds = 0
/// Outfit whose look they wear
var/outfit_path
- /// Which of the people wearing that outfit they look like (outpost_npc_looks.dm)
- var/look_number = 1
/// The need their thought bubble is about, if any; see update_bubble()
var/bubble
/// The bubble that is up now, if one is; it pops up now and then rather than staying
@@ -93,7 +81,7 @@
var/bubble_timer
/// Which grime overlay they show: 0 none, 1 dirty, 2 filthy
var/grime_stage = 0
- /// What they are carrying, held in their contents
+ /// What they are carrying in their hand for the prison's routine (take_item()), a real item in a real hand
var/obj/item/held_item
/// What they are holding a hand out for, one activity tick before they take it (see reach_for())
var/datum/weakref/reaching_ref
@@ -117,7 +105,7 @@
var/well_fed_left = 0
/// Came in wearing a stained transfer uniform
var/arrived_stained = FALSE
- /// Brute damage they carry from transfer, applied when they beam in, and whether they came in hurt
+ /// Health they lose to a rough transfer, as bruising when they beam in, and whether they came in hurt
var/arrival_brute = 0
var/arrived_hurt = FALSE
/// Seconds the thought bubble has shown the current set of needs, for cycling through them
@@ -129,6 +117,8 @@
var/last_cared_at = 0
/// world.time they last got the lift of a shared meal
var/shared_meal_at = 0
+ /// The serum turned them into an experiment's creature: off the roster, no longer treated as an inmate
+ var/experiment_turned = FALSE
/// The criminal they were, when a bounty hunter caught them (outpost_prison_bounty.dm); null for an ordinary prisoner
var/datum/bounty_record/bounty_record
COOLDOWN_DECLARE(speech_cooldown)
@@ -142,97 +132,135 @@
/// Running while what they last said is up over their head: no thought bubble (hush_bubble())
COOLDOWN_DECLARE(bubble_hush)
-/mob/living/basic/outpost_prisoner/Initialize(mapload, datum/bounty_record/record)
- gender = pick(MALE, FEMALE)
- // A caught bounty criminal (admit_next()) keeps their body and who they were (outpost_prison_bounty.dm).
+/**
+ * The second argument is a caught criminal's record (admit_next(), outpost_prison_bounty.dm), never a
+ * human NPC spawn order: a bounty prisoner keeps the face the record says they were caught with (the
+ * base dresses a /datum/bounty_record look). Anyone else is a random person in one of the prison's
+ * jumpsuits. Prisoners are made one at a time as they are admitted, so they don't go through the
+ * human NPC spawn queue.
+ */
+/mob/living/carbon/human/npc/outpost_prisoner/Initialize(mapload, datum/bounty_record/record)
+ if(!istype(record))
+ record = null
bounty_record = record
if(record)
apply_bounty_body(record)
- . = ..()
- real_name = generate_random_name_species_based(gender, TRUE, /datum/species/human)
- name = real_name
+ npc_look = record
+ // The plain jumpsuit: the glasses and beanie variants would hide their hair or fake their eyewear
+ npc_outfit = /datum/outfit/outpost_prisoner
+ else
+ npc_outfit = pick(/datum/outfit/outpost_prisoner, /datum/outfit/outpost_prisoner/glasses, /datum/outfit/outpost_prisoner/beanie)
+ outfit_path = npc_outfit
+ . = ..(mapload)
+ // They stroll; a runner or a rioter breaks into a run (set_prison_pace()).
+ set_prison_pace(hurry = FALSE)
roll_arrival()
var/list/personalities = outpost_prisoner_dialogue("personalities")
personality = length(personalities) ? pick(personalities) : "quiet"
var/list/crimes = outpost_prisoner_dialogue("crimes")
crime = length(crimes) ? pick(crimes) : "unpaid docking fees"
- outfit_path = pick(/datum/outfit/outpost_prisoner, /datum/outfit/outpost_prisoner/glasses, /datum/outfit/outpost_prisoner/beanie)
- look_number = random_outpost_npc_look_number()
if(record)
apply_bounty_record(record)
- INVOKE_ASYNC(src, PROC_REF(build_look))
+ uniform_grime_to_suit()
// One shared list: element arguments are keyed by list reference.
var/static/list/edible_types = list(/obj/item/food)
AddElement(/datum/element/basic_eating, food_types = edible_types)
- AddElement(/datum/element/footstep, footstep_type = FOOTSTEP_MOB_SHOE)
RegisterSignal(src, COMSIG_MOB_PRE_EAT, PROC_REF(on_pre_eat))
RegisterSignal(src, COMSIG_MOB_ATE, PROC_REF(on_ate))
RegisterSignal(src, COMSIG_ATOM_ITEM_INTERACTION, PROC_REF(on_item_interaction))
+ // Whatever lands in their hands by tg's own means (a catch, a hand-over) is what they hold too
+ RegisterSignal(src, COMSIG_MOB_EQUIPPED_ITEM, PROC_REF(on_equipped_item))
RegisterSignal(src, COMSIG_MOB_AFTER_APPLY_DAMAGE, PROC_REF(on_damaged))
RegisterSignal(src, COMSIG_LIVING_HEALTH_UPDATE, PROC_REF(on_health_update))
// Talking puts the thought bubble away (manual_emote() below covers the prison's own emotes).
RegisterSignals(src, list(COMSIG_MOB_SAY, COMSIG_MOB_EMOTE), PROC_REF(on_speech))
- // Dragging only while they are down or cuffed (can_be_dragged()); pulling also while calm (pull_allowed()).
- RegisterSignal(src, COMSIG_MOUSEDROP_ONTO, PROC_REF(block_being_dragged))
- RegisterSignal(src, COMSIG_ATOM_CAN_BE_PULLED, PROC_REF(check_pullable))
- // Changes to being down reach update_drag_resistance() through the living trait handlers
- // overridden below; registering those trait signals here would replace living's own.
- ADD_TRAIT(src, TRAIT_NO_CONTAINMENT, INNATE_TRAIT)
- ADD_TRAIT(src, TRAIT_NO_STORAGE_INSERT, INNATE_TRAIT)
+ // Members only put cuffs on them (outpost_prison_capture.dm); tg's handcuffs do the rest.
+ RegisterSignal(src, COMSIG_CARBON_CUFF_ATTEMPTED, PROC_REF(on_cuff_attempt))
+ // Cuffs going on and off, and going down and getting up (crit, stamcrit, knockdowns), reach
+ // update_drag_resistance() through the living trait handlers overridden below; registering those
+ // trait signals here would replace living's own.
setup_trouble()
setup_containment()
setup_extras()
last_health = health
+ update_drag_resistance()
-/mob/living/basic/outpost_prisoner/Destroy()
+/mob/living/carbon/human/npc/outpost_prisoner/Destroy()
end_activity(cancel_ai = FALSE)
clear_trouble()
- if(held_item)
- held_item.forceMove(drop_location())
- remove_cuffs()
prison?.forget(src)
prison = null
cell = null
walkable = null
reachable = null
+ held_item = null
deltimer(bubble_timer)
if(thought)
vis_contents -= thought
QDEL_NULL(thought)
return ..()
-/mob/living/basic/outpost_prisoner/Exited(atom/movable/gone, direction)
+/mob/living/carbon/human/npc/outpost_prisoner/Exited(atom/movable/gone, direction)
. = ..()
if(gone == held_item)
held_item = null
- update_appearance(UPDATE_OVERLAYS)
- else if(gone == cuffs)
- // Cuffs taken or destroyed some other way than remove_cuffs()
- cuffs = null
- uncuffed()
-
-/// Dresses them as their own person in their outfit, with a body to match their gender; a bounty prisoner keeps the face they were caught with (bounty_looks.dm). Can sleep.
-/mob/living/basic/outpost_prisoner/proc/build_look()
- if(bounty_record)
- apply_bounty_look(src, bounty_record, outfit_path)
- else
- set_outpost_npc_look(src, outfit_path, gender, look_number)
- if(QDELETED(src))
- return
- update_appearance(UPDATE_OVERLAYS)
+
+/// Something went into their hands without take_item(): tg caught a thrown ball for them, or someone handed it over. They hold it now.
+/mob/living/carbon/human/npc/outpost_prisoner/proc/on_equipped_item(datum/source, obj/item/equipped, slot)
+ SIGNAL_HANDLER
+ if(!held_item && (slot & ITEM_SLOT_HANDS))
+ held_item = equipped
+
+/**
+ * The serum took them (outpost_prison_experiment_forms.dm): the same body, no longer an inmate. Whatever
+ * they were doing and whatever trouble they were in stops, their thought bubble goes, and the prisoner's
+ * own reactions (needs and treatment, cuffing rules, blame, turret rules, teleport and polymorph refusals)
+ * are switched off; the form brings its own. The caller takes them off the roster (forget()).
+ */
+/mob/living/carbon/human/npc/outpost_prisoner/proc/stand_down_for_experiment()
+ experiment_turned = TRUE
+ // The prison no longer owns the body: if Kessler never takes it, it goes like any NPC's
+ npc_corpse_lifetime = HUMAN_NPC_CORPSE_LIFETIME
+ end_activity(cancel_ai = FALSE)
+ clear_trouble()
+ bubble = null
+ if(popped_bubble)
+ fade_bubble()
+ UnregisterSignal(src, list(
+ COMSIG_MOB_PRE_EAT,
+ COMSIG_MOB_ATE,
+ COMSIG_ATOM_ITEM_INTERACTION,
+ COMSIG_MOB_AFTER_APPLY_DAMAGE,
+ COMSIG_LIVING_HEALTH_UPDATE,
+ COMSIG_MOB_SAY,
+ COMSIG_MOB_EMOTE,
+ COMSIG_CARBON_CUFF_ATTEMPTED,
+ COMSIG_ATOM_WAS_ATTACKED,
+ COMSIG_MOB_BATONED,
+ COMSIG_ATOM_BULLET_ACT,
+ COMSIG_MOVABLE_TELEPORTING,
+ COMSIG_LIVING_PRE_WABBAJACKED,
+ COMSIG_PRE_MOB_CHANGED_TYPE,
+ COMSIG_LIVING_REVIVE,
+ ))
+
+/// Walking pace, or a run for a runner, a rioter or someone fleeing, by the move intent a player uses.
+/mob/living/carbon/human/npc/proc/set_prison_pace(hurry)
+ if((move_intent == MOVE_INTENT_RUN) != !!hurry)
+ toggle_move_intent()
/**
* How they come in: hungry, a third in a stained transfer uniform, a fifth roughed up in transfer.
* The injury waits for beam_in(), so a prisoner made any other way (an admin, a test) starts whole.
*/
-/mob/living/basic/outpost_prisoner/proc/roll_arrival()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/roll_arrival()
hunger = rand(PRISONER_ARRIVAL_HUNGER_MIN, PRISONER_ARRIVAL_HUNGER_MAX)
arrived_stained = prob(PRISONER_STAINED_CHANCE)
uniform_grime = arrived_stained ? rand(PRISONER_STAINED_GRIME_MIN, PRISONER_STAINED_GRIME_MAX) : rand(0, PRISONER_ARRIVAL_GRIME_MAX)
arrival_brute = prob(PRISONER_HURT_ARRIVAL_CHANCE) ? round(maxHealth * (100 - rand(PRISONER_HURT_ARRIVAL_MIN, PRISONER_HURT_ARRIVAL_MAX)) / 100) : 0
/// Their first name, for dialogue. (Not called first_name(): inside it, that would call itself.)
-/mob/living/basic/outpost_prisoner/proc/speech_name()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/speech_name()
return first_name(real_name)
// ===== BEAMING IN AND OUT =====
@@ -243,11 +271,11 @@
* PRISONER_ARRIVING, and so do nothing at all (no walking, routine, trouble, speech or thought
* bubble), until finish_beam_in() as the beam ends.
*/
-/mob/living/basic/outpost_prisoner/proc/beam_in()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/beam_in()
phase = PRISONER_ARRIVING
if(arrival_brute > 0)
- // Roughed up in transfer: no attacker, so no blame, no blood and no collapse.
- adjustBruteLoss(arrival_brute)
+ // Roughed up in transfer: real bruising spread over their limbs, with no attacker, so no blame.
+ outpost_prison_bruise(src, arrival_brute)
arrival_brute = 0
arrived_hurt = TRUE
ADD_TRAIT(src, TRAIT_IMMOBILIZED, PRISONER_BEAM_TRAIT)
@@ -264,7 +292,7 @@
addtimer(CALLBACK(src, PROC_REF(finish_beam_in)), OUTPOST_PRISON_BEAM_TIME)
/// Fully there as the beam ends: the flash, and only now are they present, free to move, and say hello
-/mob/living/basic/outpost_prisoner/proc/finish_beam_in()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/finish_beam_in()
if(phase != PRISONER_ARRIVING)
return
var/turf/spot = get_turf(src)
@@ -291,7 +319,7 @@
* Dematerialises them where they stand and deletes them at the end of the beam. From the start
* they are PRISONER_LEAVING: held still, with no routine, trouble, speech or thought bubble.
*/
-/mob/living/basic/outpost_prisoner/proc/beam_out()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/beam_out()
if(phase == PRISONER_LEAVING)
return
phase = PRISONER_LEAVING
@@ -312,7 +340,7 @@
transporter_dematerialise(src, OUTPOST_PRISON_BEAM_TIME)
addtimer(CALLBACK(src, PROC_REF(finish_beam_out)), OUTPOST_PRISON_BEAM_TIME)
-/mob/living/basic/outpost_prisoner/proc/finish_beam_out()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/finish_beam_out()
var/turf/spot = get_turf(src)
if(spot)
new /obj/effect/temp_visual/transporter_flash/departure(spot)
@@ -321,7 +349,7 @@
qdel(src)
/// What the warden's roster calls them: present, arriving, leaving or dead
-/mob/living/basic/outpost_prisoner/proc/console_status()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/console_status()
if(stat == DEAD)
return "dead"
if(phase == PRISONER_ARRIVING)
@@ -330,75 +358,86 @@
return "leaving"
return "present"
-// ===== DRAGGING =====
+// ===== DOWN, CUFFED AND PULLED =====
-/// Whether they are down: knocked down, in stamina crit, beaten, out or dead
-/mob/living/basic/outpost_prisoner/proc/is_down()
- // Floored but not buckled is on the floor; a bed floors them too, and that doesn't count.
- return stat != CONSCIOUS || HAS_TRAIT(src, TRAIT_INCAPACITATED) || (HAS_TRAIT(src, TRAIT_FLOORED) && !buckled)
+/// Whether they are down: in crit, in stamina crit, knocked down, stunned, out cold, lying on the floor or dead (tg's own states)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/is_down()
+ if(stat != CONSCIOUS || HAS_TRAIT(src, TRAIT_INCAPACITATED))
+ return TRUE
+ // On the floor but not on a bed: lying in bed is no more down than sitting in a chair.
+ return (HAS_TRAIT(src, TRAIT_FLOORED) || body_position == LYING_DOWN) && !buckled
-/// Staff may drag them only while they are down or cuffed (outpost_prison_capture.dm)
-/mob/living/basic/outpost_prisoner/proc/can_be_dragged()
- return is_down() || !!cuffs
+/// Down or in handcuffs: whatever trouble they were in stops, and staff can take them by the arm (outpost_prison_capture.dm)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/can_be_dragged()
+ return is_down() || !!handcuffed
/**
* Calm enough to go along with a pull: awake, present, and in no trouble of their own (rioting,
* loose, fighting, wrecking, squaring up, swinging, climbing, beaten down or hitting back).
* Someone talking to them or working on their cuffs does not count.
*/
-/mob/living/basic/outpost_prisoner/proc/calm_for_pull()
- return stat == CONSCIOUS && phase == PRISONER_PRESENT && !trouble && !threat_ref && !swing_ref && !climb_ref && beaten_left <= 0 && !retaliating()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/calm_for_pull()
+ return stat == CONSCIOUS && phase == PRISONER_PRESENT && !trouble && !threat_ref && !swing_ref && !climb_ref && !retaliating()
-/// Anyone may pull them while they are down or cuffed, or while they are calm
-/mob/living/basic/outpost_prisoner/proc/pull_allowed()
+/// Whether they go along with a pull, or let it be: down, cuffed or calm. Anyone else resists it the way a person does.
+/mob/living/carbon/human/npc/outpost_prisoner/proc/pull_allowed()
return can_be_dragged() || calm_for_pull()
-/// Their move_resist: ordinary while they can be dragged or are going along with a pull, else too heavy to shove or pull
-/mob/living/basic/outpost_prisoner/proc/pull_weight()
- return (can_be_dragged() || (pulledby && calm_for_pull())) ? MOVE_RESIST_DEFAULT : MOVE_FORCE_VERY_STRONG
+/mob/living/carbon/human/npc/outpost_prisoner/on_floored_trait_gain(datum/source)
+ . = ..()
+ update_drag_resistance()
-/mob/living/basic/outpost_prisoner/proc/check_pullable(datum/source, mob/living/puller)
- SIGNAL_HANDLER
- return pull_allowed() ? NONE : COMSIG_ATOM_CANT_PULL
+/mob/living/carbon/human/npc/outpost_prisoner/on_floored_trait_loss(datum/source)
+ . = ..()
+ update_drag_resistance()
-// Calm, they go along with a pull however heavy they are against shoves; pull_weight() lightens them once it has hold.
-/mob/living/basic/outpost_prisoner/can_be_pulled(user, force)
- if(!can_be_dragged() && calm_for_pull())
- force = max(force, move_resist * MOVE_FORCE_PULL_RATIO)
- return ..(user, force)
+/mob/living/carbon/human/npc/outpost_prisoner/on_incapacitated_trait_gain(datum/source)
+ . = ..()
+ update_drag_resistance()
-/mob/living/basic/outpost_prisoner/proc/block_being_dragged(atom/over, mob/user)
- SIGNAL_HANDLER
- return can_be_dragged() ? NONE : COMPONENT_CANCEL_MOUSEDROP_ONTO
+/mob/living/carbon/human/npc/outpost_prisoner/on_incapacitated_trait_loss(datum/source)
+ . = ..()
+ update_drag_resistance()
-/mob/living/basic/outpost_prisoner/on_floored_trait_gain(datum/source)
+/mob/living/carbon/human/npc/outpost_prisoner/on_restrained_trait_gain(datum/source)
. = ..()
+ on_restraint_changed()
update_drag_resistance()
-/mob/living/basic/outpost_prisoner/on_floored_trait_loss(datum/source)
+/mob/living/carbon/human/npc/outpost_prisoner/on_restrained_trait_loss(datum/source)
. = ..()
+ on_restraint_changed()
update_drag_resistance()
-/mob/living/basic/outpost_prisoner/on_incapacitated_trait_gain(datum/source)
+/mob/living/carbon/human/npc/outpost_prisoner/set_stat(new_stat)
. = ..()
update_drag_resistance()
-/mob/living/basic/outpost_prisoner/on_incapacitated_trait_loss(datum/source)
+// Getting up takes a moment once a knockdown or stamina crit is over (tg's get_up()): they count as down
+// until they are on their feet, so standing up (and lying down) is a change too.
+/mob/living/carbon/human/npc/outpost_prisoner/on_standing_up()
. = ..()
update_drag_resistance()
-/mob/living/basic/outpost_prisoner/set_stat(new_stat)
+/mob/living/carbon/human/npc/outpost_prisoner/on_lying_down(new_lying_angle)
. = ..()
update_drag_resistance()
-/// Heavy while awake and free, so nobody shoves them about; ordinary while they are down or cuffed, or calm and being pulled
-/mob/living/basic/outpost_prisoner/proc/update_drag_resistance()
+/**
+ * Going down, getting up, cuffs on and off. Awake and free they keep out of bags and lockers (a
+ * bluespace bag is a way out of the wing); down or dead they can be bagged like anyone. Down or cuffed,
+ * whatever they were doing and whatever trouble they were making stops. Up and free again, a rioter
+ * riots on.
+ */
+/mob/living/carbon/human/npc/outpost_prisoner/proc/update_drag_resistance()
var/draggable = can_be_dragged()
- move_resist = pull_weight()
+ if(stat == CONSCIOUS && !is_down())
+ ADD_TRAIT(src, TRAIT_NO_STORAGE_INSERT, PRISONER_AWAKE_TRAIT)
+ ADD_TRAIT(src, TRAIT_NO_CONTAINMENT, PRISONER_AWAKE_TRAIT)
+ else
+ REMOVE_TRAIT(src, TRAIT_NO_STORAGE_INSERT, PRISONER_AWAKE_TRAIT)
+ REMOVE_TRAIT(src, TRAIT_NO_CONTAINMENT, PRISONER_AWAKE_TRAIT)
if(!draggable)
- // A calm prisoner goes along with a pull (outpost_prison_warden_tools.dm); anyone else shakes it off.
- if(!calm_for_pull())
- pulledby?.stop_pulling()
if(is_rioting() && stat == CONSCIOUS)
// Up and free again: a rioter riots on until the riot is over.
INVOKE_ASYNC(src, PROC_REF(back_to_rioting))
@@ -416,7 +455,7 @@
* Time passing: hunger falls (not while well fed after cooked food) and the uniform gets dirtier,
* three times as fast at sport, where they sometimes get hurt.
*/
-/mob/living/basic/outpost_prisoner/proc/adjust_needs(seconds)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/adjust_needs(seconds)
if(stat == DEAD)
return
var/hungry_seconds = seconds
@@ -434,7 +473,7 @@
sport_injury()
/// Shooting hoops or working out: sweaty, and now and then painful
-/mob/living/basic/outpost_prisoner/proc/playing_sport()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/playing_sport()
if(!activity?.started)
return FALSE
if(istype(activity, /datum/prisoner_activity/basketball))
@@ -443,49 +482,69 @@
return istype(workout) && workout.exercising
/**
- * Hurt at sport: a turned ankle or the ball in the face, PRISONER_SPORT_INJURY_MIN to _MAX brute,
- * and they stop playing. No attacker, so no blame and no blood. Never while already badly hurt,
- * and never enough to put them down.
+ * Hurt at sport, as anyone gets hurt at sport: a turned ankle (a real sprain on a leg), the ball in
+ * the face or a pulled back, PRISONER_SPORT_INJURY_MIN to _MAX brute on the limb it happened to, and
+ * they stop playing. No attacker, so no blame. Not while already badly hurt.
*/
-/mob/living/basic/outpost_prisoner/proc/sport_injury()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/sport_injury()
if(stat != CONSCIOUS || health_factor() <= PRISONER_SPORT_INJURY_ABOVE)
return FALSE
- var/damage = min(rand(PRISONER_SPORT_INJURY_MIN, PRISONER_SPORT_INJURY_MAX), health - 1)
- if(damage < 1)
- return FALSE
- if(istype(activity, /datum/prisoner_activity/basketball))
- manual_emote(pick("goes down clutching an ankle.", "takes the ball to the face.", "lands badly and hops off the court."))
+ var/damage = rand(PRISONER_SPORT_INJURY_MIN, PRISONER_SPORT_INJURY_MAX)
+ var/ankle = prob(50)
+ var/zone = ankle ? pick(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG) : (istype(activity, /datum/prisoner_activity/basketball) ? BODY_ZONE_HEAD : BODY_ZONE_CHEST)
+ if(ankle)
+ manual_emote(pick("goes down clutching an ankle.", "lands badly and hops off the court."))
+ else if(istype(activity, /datum/prisoner_activity/basketball))
+ manual_emote("takes the ball to the face.")
else
- manual_emote(pick("goes down clutching an ankle.", "pulls something and sits down hard.", "grabs at [p_their()] back mid push-up."))
- adjustBruteLoss(damage)
+ manual_emote(pick("pulls something and sits down hard.", "grabs at [p_their()] back mid push-up."))
+ apply_damage(damage, BRUTE, zone, wound_bonus = CANT_WOUND)
+ if(ankle)
+ var/obj/item/bodypart/leg = get_bodypart(zone)
+ if(leg)
+ var/datum/wound/blunt/bone/moderate/sprain = new
+ sprain.apply_wound(leg)
end_activity()
return TRUE
-/mob/living/basic/outpost_prisoner/proc/set_hunger(amount)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/set_hunger(amount)
hunger = clamp(amount, 0, 100)
update_bubble()
-/mob/living/basic/outpost_prisoner/proc/set_uniform_grime(amount)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/set_uniform_grime(amount)
uniform_grime = clamp(amount, 0, 100)
+ uniform_grime_to_suit()
update_bubble()
+/// The prison jumpsuit they wear, if it is one of the outpost's (a stripped or redressed prisoner may have none)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/worn_prison_uniform()
+ var/obj/item/clothing/under/rank/prisoner/outpost/suit = w_uniform
+ return istype(suit) ? suit : null
+
+/// Their grime shows on the real jumpsuit they wear, which keeps it when it comes off
+/mob/living/carbon/human/npc/outpost_prisoner/proc/uniform_grime_to_suit()
+ var/obj/item/clothing/under/rank/prisoner/outpost/suit = worn_prison_uniform()
+ if(suit && suit.grime != uniform_grime)
+ suit.set_grime(uniform_grime)
+ update_worn_undersuit()
+
/// Fed, 0-100: full marks until they are hungry, then down to nothing once they are starving
-/mob/living/basic/outpost_prisoner/proc/fed_factor()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/fed_factor()
return clamp(100 * (hunger - PRISONER_HUNGER_STARVING) / (PRISONER_HUNGER_HUNGRY - PRISONER_HUNGER_STARVING), 0, 100)
/// Clean, 0-100: full marks until the uniform is dirty, then down to nothing once it is filthy
-/mob/living/basic/outpost_prisoner/proc/clean_factor()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/clean_factor()
return clamp(100 * (PRISONER_GRIME_FILTHY - uniform_grime) / (PRISONER_GRIME_FILTHY - PRISONER_GRIME_DIRTY), 0, 100)
-/mob/living/basic/outpost_prisoner/proc/health_factor()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/health_factor()
return stat == DEAD ? 0 : clamp(100 * health / maxHealth, 0, 100)
/// Care, 0-100: the mean of fed, clean and health
-/mob/living/basic/outpost_prisoner/proc/care()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/care()
return (fed_factor() + clean_factor() + health_factor()) / 3
/// What their needs do to their mood per minute: list(gain, loss), before personality
-/mob/living/basic/outpost_prisoner/proc/needs_mood_per_minute()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/needs_mood_per_minute()
var/loss = 0
if(hunger < PRISONER_HUNGER_STARVING)
loss += PRISONER_MOOD_STARVING
@@ -501,21 +560,21 @@
loss += PRISONER_MOOD_HURT * (PRISONER_HURT_MOOD_BELOW - health_percent) / PRISONER_HURT_MOOD_BELOW
return list(0, loss)
-/mob/living/basic/outpost_prisoner/proc/wants_food()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/wants_food()
return stat == CONSCIOUS && hunger < PRISONER_HUNGER_SEEK && well_fed_left <= 0
-/mob/living/basic/outpost_prisoner/proc/wants_clean_uniform()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/wants_clean_uniform()
return stat == CONSCIOUS && uniform_grime >= PRISONER_GRIME_DIRTY
/// Whether they would take this off the floor or the hatch and change into it
-/mob/living/basic/outpost_prisoner/proc/would_change_into(obj/item/thing)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/would_change_into(obj/item/thing)
var/obj/item/clothing/under/rank/prisoner/outpost/fresh = thing
return istype(fresh) && wants_clean_uniform() && fresh.grime < PRISONER_GRIME_DIRTY && fresh.grime < uniform_grime
// ===== THOUGHT BUBBLE =====
/// The needs that want attention now, most urgent first: hungry, hurt, dirty
-/mob/living/basic/outpost_prisoner/proc/bubble_needs()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/bubble_needs()
var/list/needs = list()
if(hunger < PRISONER_HUNGER_HUNGRY)
needs += "hungry"
@@ -530,7 +589,7 @@
* or loose (a shiv) and being an experiment's subject (a syringe) show on their own. Otherwise it
* cycles through their needs every PRISONER_BUBBLE_CYCLE, most urgent first.
*/
-/mob/living/basic/outpost_prisoner/proc/wanted_bubble(list/needs)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/wanted_bubble(list/needs)
if(stat == DEAD || phase != PRISONER_PRESENT)
return null
if(is_rioting() || trouble == PRISONER_TROUBLE_LOOSE)
@@ -549,7 +608,7 @@
* starts at the most urgent. The bubble itself pops up now and then (see schedule_bubble()); a need that
* has just come up, a riot or a dose pops it soon.
*/
-/mob/living/basic/outpost_prisoner/proc/update_bubble()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/update_bubble()
var/list/needs = bubble_needs()
var/needs_text = jointext(needs, ",")
var/fresh = FALSE
@@ -576,7 +635,7 @@
* Pops the bubble when it is due, but not while what they last said is still up over their head
* (hush_bubble()). One that no longer holds fades early, and a riot takes over at once.
*/
-/mob/living/basic/outpost_prisoner/proc/schedule_bubble(list/needs, fresh)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/schedule_bubble(list/needs, fresh)
if(popped_bubble && popped_bubble != bubble && (!(popped_bubble in needs) || bubble == "riot"))
fade_bubble()
if(!bubble)
@@ -587,11 +646,11 @@
pop_bubble()
/// They said or emoted something: see hush_bubble()
-/mob/living/basic/outpost_prisoner/proc/on_speech(datum/source)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/on_speech(datum/source)
SIGNAL_HANDLER
hush_bubble()
-/mob/living/basic/outpost_prisoner/manual_emote(text)
+/mob/living/carbon/human/npc/outpost_prisoner/manual_emote(text)
. = ..()
if(.)
hush_bubble()
@@ -601,7 +660,7 @@
* sinks away out of the text's way, and none pops until the words are gone; then a need that
* still holds comes back within PRISONER_BUBBLE_FRESH_DELAY.
*/
-/mob/living/basic/outpost_prisoner/proc/hush_bubble()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/hush_bubble()
COOLDOWN_START(src, bubble_hush, PRISONER_BUBBLE_HUSH)
if(!popped_bubble)
return
@@ -609,7 +668,7 @@
bubble_next_pop = min(bubble_next_pop, world.time + PRISONER_BUBBLE_HUSH + rand(0, PRISONER_BUBBLE_FRESH_DELAY))
/// Pops the bubble up with a little bounce; it bobs, then fades on its own
-/mob/living/basic/outpost_prisoner/proc/pop_bubble()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/pop_bubble()
if(!bubble || QDELETED(src))
return
popped_bubble = bubble
@@ -623,7 +682,7 @@
bubble_timer = addtimer(CALLBACK(src, PROC_REF(end_bubble)), PRISONER_BUBBLE_SHOW + PRISONER_BUBBLE_FADE, TIMER_STOPPABLE | TIMER_DELETE_ME)
/// Fades the bubble out early, sinking with `sink` (see /obj/effect/abstract/outpost_thought/proc/fade())
-/mob/living/basic/outpost_prisoner/proc/fade_bubble(sink = FALSE)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/fade_bubble(sink = FALSE)
popped_bubble = null
if(!thought)
return
@@ -632,56 +691,22 @@
bubble_timer = addtimer(CALLBACK(src, PROC_REF(end_bubble)), PRISONER_BUBBLE_FADE, TIMER_STOPPABLE | TIMER_DELETE_ME)
/// Takes the faded bubble down
-/mob/living/basic/outpost_prisoner/proc/end_bubble()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/end_bubble()
bubble_timer = null
popped_bubble = null
if(thought)
vis_contents -= thought
/// Takes any bubble down at once, with no fade: for when they beam in or out
-/mob/living/basic/outpost_prisoner/proc/drop_bubble()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/drop_bubble()
deltimer(bubble_timer)
end_bubble()
-/mob/living/basic/outpost_prisoner/update_overlays()
+/mob/living/carbon/human/npc/outpost_prisoner/update_overlays()
. = ..()
- if(grime_stage)
- var/mutable_appearance/grime = mutable_appearance('icons/effects/blood.dmi', "uniformblood")
- grime.color = "#5a4630"
- grime.alpha = grime_stage == 2 ? 200 : 130
- . += grime
+ // Their grime is on the jumpsuit itself (uniform_grime_to_suit()); filth draws flies.
if(grime_stage == 2)
. += mutable_appearance('icons/effects/effects.dmi', "fly-surrounding", ABOVE_MOB_LAYER)
- if(cuffs)
- // tg's own cuff overlay, as people wear it
- . += mutable_appearance('icons/mob/simple/mob.dmi', "handcuff1")
- if(held_item)
- // In hand the way a player holds it, turning with them (npc_inhand_look() in bounty_ai.dm)
- var/list/inhand = npc_inhand_look(held_item)
- if(inhand)
- var/mutable_appearance/carried = mutable_appearance(inhand[1], inhand[2])
- carried.plane = FLOAT_PLANE
- carried.layer = FLOAT_LAYER
- . += carried
- else
- // No in-hand sprite: the item itself, small, in the same hand whichever way they face
- var/mutable_appearance/carried = new(held_item.appearance)
- carried.plane = FLOAT_PLANE
- carried.layer = FLOAT_LAYER
- carried.dir = SOUTH
- carried.pixel_x = 0
- carried.pixel_y = 0
- carried.pixel_w = ((dir & WEST) || dir == NORTH) ? -7 : 7
- carried.pixel_z = -4
- carried.transform = matrix().Scale(0.6)
- . += carried
-
-/// Turning moves what they carry to the other side
-/mob/living/basic/outpost_prisoner/setDir(newdir)
- var/old_dir = dir
- . = ..()
- if(held_item && dir != old_dir)
- update_appearance(UPDATE_OVERLAYS)
/**
* tg's thought bubble, as a point uses, with the needed item's own sprite inset. A prisoner's pops up
@@ -775,7 +800,7 @@
* turn to it, lean in, and it visibly goes into their hand. With `announce`, the room is told what
* they took and from where. Returns TRUE if they hold it.
*/
-/mob/living/basic/outpost_prisoner/proc/take_item(obj/item/thing, announce = FALSE)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/take_item(obj/item/thing, announce = FALSE)
if(held_item || QDELETED(thing))
return FALSE
if(thing.loc != src)
@@ -793,15 +818,14 @@
var/obj/structure/table/reinforced/prison_hatch/hatch = locate() in from
var/message = hatch ? "[src] takes [thing] off [hatch]." : "[src] picks up [thing]."
visible_message(span_notice(message))
- thing.forceMove(src)
- if(thing.loc != src)
+ // Into a real hand: tg draws it there, and anyone can knock it out of it.
+ if(!put_in_hands(thing))
return FALSE
held_item = thing
- update_appearance(UPDATE_OVERLAYS)
return TRUE
/// Leans towards `target` for a moment, as a hand goes out to it
-/mob/living/basic/outpost_prisoner/proc/reach_animation(atom/target)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/reach_animation(atom/target)
var/direction = get_dir(src, target)
if(!direction)
return
@@ -811,18 +835,20 @@
animate(pixel_x = pixel_x - shift_x, pixel_y = pixel_y - shift_y, time = 2, easing = SINE_EASING, flags = ANIMATION_PARALLEL)
/// Puts down whatever they carry, on `where` or their own tile
-/mob/living/basic/outpost_prisoner/proc/drop_held_item(atom/where)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/drop_held_item(atom/where)
if(!held_item)
return null
var/obj/item/dropped = held_item
- dropped.forceMove(where || drop_location())
+ if(!(where ? transferItemToLoc(dropped, where, force = TRUE) : dropItemToGround(dropped, force = TRUE)))
+ return null
+ held_item = null
return dropped
/**
* Whether they can reach `thing` from where they stand. At a serving hatch they open their side
* first: PRISONER_REACH_WAIT means it is opening.
*/
-/mob/living/basic/outpost_prisoner/proc/try_reach(obj/item/thing)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/try_reach(obj/item/thing)
if(QDELETED(thing) || !isturf(thing.loc))
return PRISONER_REACH_FAILED
if(thing.loc == loc)
@@ -840,7 +866,7 @@
* first time it is in reach they turn to it and hold out a hand (PRISONER_REACH_WAIT), and only on
* the next call, about a second later, is it PRISONER_REACH_OK to take it.
*/
-/mob/living/basic/outpost_prisoner/proc/reach_for(obj/item/thing)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/reach_for(obj/item/thing)
var/result = try_reach(thing)
if(result != PRISONER_REACH_OK)
reaching_ref = null
@@ -853,7 +879,7 @@
return PRISONER_REACH_WAIT
/// Sits on a chair, stool or toilet, facing `facing` if given
-/mob/living/basic/outpost_prisoner/proc/sit_on(obj/structure/seat, facing)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/sit_on(obj/structure/seat, facing)
if(buckled != seat)
if(loc != seat.loc)
return FALSE
@@ -865,7 +891,7 @@
return TRUE
/// Gets up from whatever they sit or lie on
-/mob/living/basic/outpost_prisoner/proc/stand_up()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/stand_up()
remove_offsets(PRISONER_SITTING_OFFSET)
buckled?.unbuckle_mob(src, force = TRUE)
@@ -873,7 +899,7 @@
* Settles on the bed under them. There is no sitting pose for a bed, and a standing sprite shifted down
* reads as someone standing on it, so they lie on it, awake. With no bed to lie on, they crouch.
*/
-/mob/living/basic/outpost_prisoner/proc/sit_on_edge(facing)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/sit_on_edge(facing)
var/obj/structure/bed/bed = locate() in loc
if(bed && buckled != bed)
stand_up()
@@ -884,7 +910,7 @@
setDir(facing)
/// Whether they crouch where they are, as sit_on_edge() leaves them with no bed under them
-/mob/living/basic/outpost_prisoner/proc/is_crouching()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/is_crouching()
return !!has_offset(PRISONER_SITTING_OFFSET)
/**
@@ -893,7 +919,7 @@
* way it faces; `facing` is for the bed and the crouch. The bed is for lying down, so any sitting in
* the cell goes to the chair first (home_seat()).
*/
-/mob/living/basic/outpost_prisoner/proc/sit_in_cell(facing)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/sit_in_cell(facing)
var/obj/structure/chair/chair = locate() in loc
if(chair && (buckled == chair || !chair.has_buckled_mobs()) && sit_on(chair))
return
@@ -903,7 +929,7 @@
* Where they sit down in their own cell: its chair if they can use it (seat_usable()), else its bed
* on the same terms, lying on it. Null if the cell has neither they can use.
*/
-/mob/living/basic/outpost_prisoner/proc/home_seat()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/home_seat()
if(!cell)
return null
var/obj/structure/chair/chair = cell.chair()
@@ -915,7 +941,7 @@
return null
/// Whether they can walk to `seat` and use it: nobody else on its tile or in it, and nobody else has claimed it
-/mob/living/basic/outpost_prisoner/proc/seat_usable(obj/structure/seat)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/seat_usable(obj/structure/seat)
var/turf/tile = get_turf(seat)
if(!tile || !walkable?[tile] || (tile != loc && tile_taken(tile)))
return FALSE
@@ -949,11 +975,9 @@
return "snack"
return "poor"
-/mob/living/basic/outpost_prisoner/proc/on_pre_eat(datum/source, atom/food, mob/living/feeder)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/on_pre_eat(datum/source, atom/food, mob/living/feeder)
SIGNAL_HANDLER
- if(cuffs)
- if(feeder)
- balloon_alert(feeder, "cuffed")
+ if(handcuffed && !feeder)
return COMSIG_MOB_CANCEL_EAT
if(prison?.pastime_pre_eat(src, food, feeder))
return COMSIG_MOB_CANCEL_EAT
@@ -967,7 +991,7 @@
* Eats `meal`: hunger and mood by how good it is, and cooked food keeps them full for
* PRISONER_WELL_FED_TIME. Returns the tier.
*/
-/mob/living/basic/outpost_prisoner/proc/eat_food(obj/item/food/meal)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/eat_food(obj/item/food/meal)
var/tier = outpost_prisoner_food_tier(meal)
switch(tier)
if("ration")
@@ -985,7 +1009,7 @@
return tier
/// What they say about a meal: praise for cooking, a complaint about poor food, else thanks to whoever fed them
-/mob/living/basic/outpost_prisoner/proc/react_to_food(tier, mob/living/feeder)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/react_to_food(tier, mob/living/feeder)
switch(tier)
if("cooked")
if(thank("good_food") || !feeder)
@@ -997,7 +1021,7 @@
thank("thanks_food")
/// Fed by hand
-/mob/living/basic/outpost_prisoner/proc/on_ate(datum/source, atom/food, mob/living/feeder)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/on_ate(datum/source, atom/food, mob/living/feeder)
SIGNAL_HANDLER
var/tier = eat_food(food)
if(isturf(loc) && prob(50))
@@ -1011,7 +1035,7 @@
* `table_turf` is null when they ate standing up. Returns the wrapper when they mean to take it
* to the bin, else null.
*/
-/mob/living/basic/outpost_prisoner/proc/finish_meal(obj/item/food/meal, turf/seat_turf, turf/table_turf)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/finish_meal(obj/item/food/meal, turf/seat_turf, turf/table_turf)
if(QDELETED(meal))
return null
var/tier = eat_food(meal)
@@ -1030,7 +1054,7 @@
* unhappy one (below PRISONER_LITTER_MOOD) drops it on the floor; anyone else leaves it where
* they ate.
*/
-/mob/living/basic/outpost_prisoner/proc/leave_meal_mess(obj/item/food/meal, turf/floor, turf/table_turf)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/leave_meal_mess(obj/item/food/meal, turf/floor, turf/table_turf)
if(isopenturf(floor) && (!table_turf || prob(PRISONER_TABLE_CRUMB_CHANCE)))
new /obj/effect/decal/cleanable/food/crumbs(floor)
var/trash_type
@@ -1057,7 +1081,7 @@
return trash
/// Puts `trash` in `bin` (or the nearest bin in reach) straight away. Returns TRUE if it went in.
-/mob/living/basic/outpost_prisoner/proc/bin_litter(obj/item/trash, obj/structure/closet/crate/bin/bin)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/bin_litter(obj/item/trash, obj/structure/closet/crate/bin/bin)
if(QDELETED(trash))
return FALSE
bin = bin || prison?.find_bin(src)
@@ -1085,7 +1109,7 @@
return count < bin.storage_capacity
/// Someone fed, clothed or treated them by hand
-/mob/living/basic/outpost_prisoner/proc/note_carer(mob/living/carer)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/note_carer(mob/living/carer)
if(!istype(carer) || is_outpost_prisoner(carer))
return
last_carer_ref = WEAKREF(carer)
@@ -1094,11 +1118,9 @@
// ===== UNIFORMS =====
-/// Cuffs go on them (outpost_prison_capture.dm); handed a cleaner prison uniform, they change and hand the old one back
-/mob/living/basic/outpost_prisoner/proc/on_item_interaction(datum/source, mob/living/user, obj/item/tool, list/modifiers)
+/// Treated by hand, they notice; handed a cleaner prison uniform, they change and hand the old one back. Cuffs are tg's own (outpost_prison_capture.dm).
+/mob/living/carbon/human/npc/outpost_prisoner/proc/on_item_interaction(datum/source, mob/living/user, obj/item/tool, list/modifiers)
SIGNAL_HANDLER
- if(istype(tool, /obj/item/restraints/handcuffs))
- return on_cuffs_used(user, tool)
if(istype(tool, /obj/item/stack/medical))
// Treatment only shows as health coming back once the dressing is on.
COOLDOWN_START(src, treatment_window, 20 SECONDS)
@@ -1108,7 +1130,7 @@
// Not while they beam in or out, invisible or half there.
if(!istype(offered) || user.combat_mode || stat != CONSCIOUS || phase != PRISONER_PRESENT)
return NONE
- if(cuffs)
+ if(handcuffed)
balloon_alert(user, "cuffed")
return ITEM_INTERACT_BLOCKING
if(offered.grime >= uniform_grime)
@@ -1128,7 +1150,7 @@
* Picks up a cleaner uniform within arm's reach (their own tile or beside them) and changes, leaving
* the old one in its place. They turn to it, lean in, and it visibly leaves the floor or the hatch.
*/
-/mob/living/basic/outpost_prisoner/proc/take_uniform(obj/item/clothing/under/rank/prisoner/outpost/fresh)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/take_uniform(obj/item/clothing/under/rank/prisoner/outpost/fresh)
if(!would_change_into(fresh) || !isturf(fresh.loc) || !(fresh.loc == loc || Adjacent(fresh)))
return FALSE
var/turf/spot = fresh.loc
@@ -1143,32 +1165,38 @@
return TRUE
/**
- * Changes into `fresh` and returns their old uniform, created at `drop_spot`. The clean one goes
- * before the old one appears, so a swap on a full serving hatch never pushes it over capacity.
+ * Changes into `fresh`, the way anyone changes: the jumpsuit they wear comes off onto `drop_spot`
+ * and the clean one goes on. Returns the old one (null if what they wore wasn't a prison jumpsuit).
*/
-/mob/living/basic/outpost_prisoner/proc/swap_uniform(obj/item/clothing/under/rank/prisoner/outpost/fresh, atom/drop_spot)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/swap_uniform(obj/item/clothing/under/rank/prisoner/outpost/fresh, atom/drop_spot)
var/fresh_grime = fresh.grime
- var/old_grime = uniform_grime
- qdel(fresh)
- var/obj/item/clothing/under/rank/prisoner/outpost/old = new(drop_spot)
- old.set_grime(old_grime)
+ // Off the counter before the old one goes down, so a swap on a full serving hatch never pushes it over capacity.
+ fresh.forceMove(src)
+ var/obj/item/clothing/under/rank/prisoner/outpost/old = worn_prison_uniform()
+ if(old)
+ old.set_grime(uniform_grime)
+ if(!transferItemToLoc(old, drop_spot, force = TRUE))
+ return null
+ else if(w_uniform)
+ // Someone else's clothes: off they come, as they are
+ var/obj/item/other_clothes = w_uniform
+ if(!transferItemToLoc(other_clothes, drop_spot, force = TRUE))
+ return null
+ if(!equip_to_slot_if_possible(fresh, ITEM_SLOT_ICLOTHING, disable_warning = TRUE))
+ fresh.forceMove(drop_spot)
set_uniform_grime(fresh_grime)
adjust_mood(PRISONER_MOOD_CLEAN_UNIFORM)
return old
// ===== HURT AND TREATED =====
-/// Blood on the floor from any real brute hit
-/mob/living/basic/outpost_prisoner/proc/on_damaged(datum/source, damage_dealt, damagetype)
+/// A real hit that puts them down is a collapse (outpost_prison_trouble.dm). tg does the blood.
+/mob/living/carbon/human/npc/outpost_prisoner/proc/on_damaged(datum/source, damage_dealt, damagetype)
SIGNAL_HANDLER
- if((damagetype == BRUTE || damagetype == BURN) && damage_dealt > 0)
- // Low enough and they collapse (outpost_prison_trouble.dm).
+ if(damage_dealt > 0 && (damagetype == BRUTE || damagetype == BURN || damagetype == STAMINA))
INVOKE_ASYNC(src, PROC_REF(check_beaten))
- if(damagetype != BRUTE || damage_dealt < 3 || !isturf(loc))
- return
- add_splatter_floor(loc, damage_dealt < 10)
-/mob/living/basic/outpost_prisoner/proc/on_health_update(datum/source)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/on_health_update(datum/source)
SIGNAL_HANDLER
var/was = last_health
last_health = health
@@ -1178,15 +1206,6 @@
adjust_mood(PRISONER_MOOD_TREATED)
INVOKE_ASYNC(src, PROC_REF(thank), "thanks_treatment")
-/// Badly hurt and untreated: now and then a drop of blood
-/mob/living/basic/outpost_prisoner/proc/maybe_drip(seconds)
- if(stat == DEAD || !isturf(loc) || health_factor() >= PRISONER_BLEED_BELOW)
- return FALSE
- if(!SPT_PROB(3, seconds))
- return FALSE
- add_splatter_floor(loc, small_drip = TRUE)
- return TRUE
-
// ===== LEFT ALONE =====
/**
@@ -1197,7 +1216,7 @@
* moments tg switches the AI off after a plan that queued nothing (ai_running()), they walk over
* and take things by hand instead.
*/
-/mob/living/basic/outpost_prisoner/proc/fend_for_self()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/fend_for_self()
if(!routine_allowed() || ai_running())
return
if(wants_food())
@@ -1213,7 +1232,7 @@
swap_uniform(fresh, fresh.loc)
/// Leaves some dirt or a wrapper where they stand
-/mob/living/basic/outpost_prisoner/proc/make_mess()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/make_mess()
var/turf/open/floor = loc
if(!istype(floor))
return
@@ -1223,13 +1242,12 @@
var/trash_type = pick(/obj/item/trash/candy, /obj/item/trash/chips, /obj/item/trash/raisins)
new trash_type(floor)
-/mob/living/basic/outpost_prisoner/death(gibbed)
+/mob/living/carbon/human/npc/outpost_prisoner/death(gibbed)
var/was_alive = stat != DEAD
. = ..()
+ // The body keeps what it held and wore, cuffs too, as anyone's does.
if(was_alive && stat == DEAD)
end_activity()
- drop_held_item()
- remove_cuffs()
prison?.on_prisoner_death(src)
update_bubble()
@@ -1237,7 +1255,7 @@
/datum/outfit/outpost_prisoner
name = "Outpost prisoner"
- uniform = /obj/item/clothing/under/rank/prisoner
+ uniform = /obj/item/clothing/under/rank/prisoner/outpost
shoes = /obj/item/clothing/shoes/sneakers/orange
/datum/outfit/outpost_prisoner/glasses
@@ -1250,3 +1268,4 @@
#undef PRISONER_BEAM_TRAIT
#undef PRISONER_SITTING_OFFSET
+#undef PRISONER_AWAKE_TRAIT
diff --git a/voidcrew/modules/player_outposts/outpost_prison_researcher.dm b/voidcrew/modules/player_outposts/outpost_prison_researcher.dm
index 163c4718879..52fd2faa699 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_researcher.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_researcher.dm
@@ -155,7 +155,7 @@
if(!spot)
return null
roll_offer()
- var/mob/living/basic/outpost_kessler_staff/researcher/doctor = new(spot, src)
+ var/mob/living/carbon/human/npc/outpost_kessler_staff/researcher/doctor = new(spot, src)
researcher = doctor
researcher_stay = 0
pitch_left = OUTPOST_KESSLER_BEAM_TIME / (1 SECONDS) + 2
@@ -184,7 +184,7 @@
* checked again once it returns. Returns what they got: the item, TRUE for a decline, or FALSE.
*/
/datum/outpost_prison/proc/present_offer(mob/living/user)
- var/mob/living/basic/outpost_kessler_staff/researcher/doctor = researcher
+ var/mob/living/carbon/human/npc/outpost_kessler_staff/researcher/doctor = researcher
if(QDELETED(doctor) || doctor.leaving || doctor.beaming || !outpost?.can_manage(user))
return FALSE
var/mob/holder = offer_claim?.resolve()
@@ -217,7 +217,7 @@
* to 0, and the researcher leaves. Refused if the wing could not run it now. Returns the item.
*/
/datum/outpost_prison/proc/accept_offer(mob/living/user)
- var/mob/living/basic/outpost_kessler_staff/researcher/doctor = researcher
+ var/mob/living/carbon/human/npc/outpost_kessler_staff/researcher/doctor = researcher
if(QDELETED(doctor) || doctor.leaving || !outpost?.can_manage(user))
return FALSE
var/needed = offer_kind == "specimen" ? 2 : 1
@@ -243,7 +243,7 @@
/// `user` turns the offer down: the next one pays more, and the researcher leaves
/datum/outpost_prison/proc/decline_offer(mob/living/user)
- var/mob/living/basic/outpost_kessler_staff/researcher/doctor = researcher
+ var/mob/living/carbon/human/npc/outpost_kessler_staff/researcher/doctor = researcher
if(QDELETED(doctor) || doctor.leaving)
return FALSE
sweetener = min(sweetener + OUTPOST_EXPERIMENT_SWEETENER, OUTPOST_EXPERIMENT_SWEETENER_MAX)
@@ -255,7 +255,7 @@
/// Nobody took the offer in time: the researcher leaves, and the next offer pays more
/datum/outpost_prison/proc/researcher_lapse()
- var/mob/living/basic/outpost_kessler_staff/researcher/doctor = researcher
+ var/mob/living/carbon/human/npc/outpost_kessler_staff/researcher/doctor = researcher
if(QDELETED(doctor))
researcher = null
return FALSE
@@ -265,21 +265,37 @@
send_researcher_away(doctor)
return TRUE
-/// Someone hurt the researcher: gone at once, with no sweetener for the next visit
+/**
+ * Someone hurt the researcher: "I'm leaving!", and the corporate beam takes them a couple of seconds
+ * later (OUTPOST_KESSLER_ASSAULT_BEAM_DELAY), with no sweetener for the next visit. The hit was real;
+ * the beam is only a way out.
+ */
/datum/outpost_prison/proc/researcher_assaulted()
- var/mob/living/basic/outpost_kessler_staff/researcher/doctor = researcher
+ var/mob/living/carbon/human/npc/outpost_kessler_staff/researcher/doctor = researcher
if(QDELETED(doctor))
return FALSE
// Hit while still beaming in: they just go, without a word from thin air.
- if(!doctor.beaming && !doctor.departing)
+ if(!doctor.beaming && !doctor.departing && doctor.stat == CONSCIOUS)
doctor.say("I'm leaving!")
add_log("[doctor.real_name] was attacked and left.")
log_game("PLAYER OUTPOST PRISON: the Kessler researcher at '[outpost?.name]' was attacked and left")
- send_researcher_away(doctor, 0)
+ send_researcher_away(doctor, OUTPOST_KESSLER_ASSAULT_BEAM_DELAY)
return TRUE
+/**
+ * The researcher was killed before Kessler's beam got them out. Kessler takes the body back, and
+ * doesn't come again for a long while (OUTPOST_KESSLER_KILLED_WAIT_MIN to _MAX).
+ */
+/datum/outpost_prison/proc/researcher_killed(mob/living/carbon/human/npc/outpost_kessler_staff/researcher/doctor, mob/killer)
+ add_log("[doctor.real_name] of Kessler Biolabs was killed. Kessler wants a word about that.")
+ log_game("PLAYER OUTPOST PRISON: the Kessler researcher at '[outpost?.name]' was killed[killer ? " (last hit by [key_name(killer)])" : ""]")
+ if(researcher == doctor)
+ researcher = null
+ offer_claim = null
+ researcher_wait = max(researcher_wait || 0, rand(OUTPOST_KESSLER_KILLED_WAIT_MIN, OUTPOST_KESSLER_KILLED_WAIT_MAX))
+
/// The researcher leaves after `delay`; the next visit is 35-50 minutes off
-/datum/outpost_prison/proc/send_researcher_away(mob/living/basic/outpost_kessler_staff/researcher/doctor, delay = 2 SECONDS)
+/datum/outpost_prison/proc/send_researcher_away(mob/living/carbon/human/npc/outpost_kessler_staff/researcher/doctor, delay = 2 SECONDS)
researcher = null
offer_claim = null
researcher_wait = rand(OUTPOST_EXPERIMENT_GAP_MIN, OUTPOST_EXPERIMENT_GAP_MAX)
@@ -291,39 +307,28 @@
if(!spot)
return null
// Not the wing's researcher: nobody can take an offer from them, and they hold no reference to the prison.
- var/mob/living/basic/outpost_kessler_staff/researcher/doctor = new(spot, null)
+ var/mob/living/carbon/human/npc/outpost_kessler_staff/researcher/doctor = new(spot, null)
doctor.beam_in()
// A second after they are all the way in, not while they are still knitting together.
- addtimer(CALLBACK(doctor, TYPE_PROC_REF(/mob/living/basic/outpost_kessler_staff/researcher, refuse_wing)), OUTPOST_KESSLER_BEAM_TIME + 1 SECONDS, TIMER_DELETE_ME)
+ addtimer(CALLBACK(doctor, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_kessler_staff/researcher, refuse_wing)), OUTPOST_KESSLER_BEAM_TIME + 1 SECONDS, TIMER_DELETE_ME)
add_log("[doctor.real_name] of Kessler Biolabs came, but would not work in the wing as it is.")
return doctor
// ===== KESSLER STAFF =====
-/// Someone from Kessler Biolabs: beams in and out, cannot be hurt, boxed, teleported or taken over
-/mob/living/basic/outpost_kessler_staff
+/**
+ * Someone from Kessler Biolabs, a real human body (owner ruling OC-3): they can be hurt, bled, cuffed
+ * and killed like anyone. The first real hit sends them away: "I'm leaving!" and Kessler's beam a
+ * couple of seconds later. Teleporters, polymorph and bluespace bags don't take them while they are
+ * alive. Their kit is locked to them (D3). They have no AI: they stand where they beamed in.
+ */
+/mob/living/carbon/human/npc/outpost_kessler_staff
name = "Kessler Biolabs employee"
desc = "Someone from Kessler Biolabs."
- icon = 'icons/mob/simple/simple_human.dmi'
- mob_biotypes = MOB_ORGANIC | MOB_HUMANOID
- sentience_type = SENTIENCE_HUMANOID
- basic_mob_flags = NONE
- status_flags = NONE
- move_resist = INFINITY
- // tg's human deathgasp
- death_message = "seizes up and falls limp, their eyes dead and lifeless..."
- density = TRUE
- maxHealth = 100
- health = 100
- damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, STAMINA = 0, OXY = 0)
- unsuitable_atmos_damage = 0
- unsuitable_cold_damage = 0
- unsuitable_heat_damage = 0
- speak_emote = list("says")
- response_help_continuous = "taps"
- response_help_simple = "tap"
- /// What they wear
- var/outfit = /datum/outfit/outpost_kessler_researcher
+ faction = list(FACTION_NEUTRAL)
+ ai_controller = null
+ npc_outfit = /datum/outfit/outpost_kessler_researcher
+ npc_target_stat = HUMAN_NPC_SPARES_DOWNED
/// The prison they came to
var/datum/outpost_prison/prison
/// On the way out
@@ -335,52 +340,78 @@
/// A line of dialogue to say once they have fully materialised, if any
var/arrival_line
-/mob/living/basic/outpost_kessler_staff/Initialize(mapload, datum/outpost_prison/owner)
- gender = pick(MALE, FEMALE)
- . = ..()
- prison = owner
- ADD_TRAIT(src, TRAIT_NO_CONTAINMENT, INNATE_TRAIT)
- ADD_TRAIT(src, TRAIT_NO_STORAGE_INSERT, INNATE_TRAIT)
+/**
+ * The second argument is the prison they come to (or null for a visit that isn't the wing's), never a
+ * human NPC spawn order. Made one at a time as they visit, so they don't go through the spawn queue.
+ */
+/mob/living/carbon/human/npc/outpost_kessler_staff/Initialize(mapload, datum/outpost_prison/owner)
+ . = ..(mapload)
+ prison = istype(owner) ? owner : null
+ ADD_TRAIT(src, TRAIT_NO_CONTAINMENT, OUTPOST_KESSLER_TRAIT)
+ ADD_TRAIT(src, TRAIT_NO_STORAGE_INSERT, OUTPOST_KESSLER_TRAIT)
ADD_TRAIT(src, TRAIT_OUTPOST_EXPERIMENT, INNATE_TRAIT)
- ADD_TRAIT(src, TRAIT_PUSHIMMUNE, INNATE_TRAIT)
- AddElement(/datum/element/footstep, footstep_type = FOOTSTEP_MOB_SHOE)
+ AddElement(/datum/element/relay_attackers)
+ RegisterSignal(src, COMSIG_ATOM_WAS_ATTACKED, PROC_REF(on_attacked))
+ RegisterSignal(src, COMSIG_MOB_AFTER_APPLY_DAMAGE, PROC_REF(on_damaged))
RegisterSignal(src, COMSIG_MOVABLE_TELEPORTING, PROC_REF(refuse_teleport))
RegisterSignal(src, COMSIG_LIVING_PRE_WABBAJACKED, PROC_REF(refuse_polymorph))
RegisterSignal(src, COMSIG_PRE_MOB_CHANGED_TYPE, PROC_REF(refuse_type_change))
- apply_dynamic_human_appearance(src, outfit, /datum/species/human)
-/mob/living/basic/outpost_kessler_staff/Destroy()
+/mob/living/carbon/human/npc/outpost_kessler_staff/Destroy()
if(prison?.researcher == src)
prison.researcher = null
prison.offer_claim = null
prison = null
return ..()
-/// Nothing Kessler sends can be hurt: a blow makes them leave instead
-/mob/living/basic/outpost_kessler_staff/adjust_health(amount, updating_health = TRUE, forced = FALSE)
- if(amount > 0 && !forced)
+/// A real blow from someone: they leave
+/mob/living/carbon/human/npc/outpost_kessler_staff/proc/on_attacked(datum/source, atom/attacker, attack_flags)
+ SIGNAL_HANDLER
+ if(attack_flags & (ATTACKER_DAMAGING_ATTACK | ATTACKER_STAMINA_ATTACK))
INVOKE_ASYNC(src, PROC_REF(hurt_by_someone))
- return 0
- return ..()
-/mob/living/basic/outpost_kessler_staff/proc/hurt_by_someone()
- leave()
+/// Hurt any other way (a fire, a blast, a stray shot): they leave too
+/mob/living/carbon/human/npc/outpost_kessler_staff/proc/on_damaged(datum/source, damage_dealt, damagetype)
+ SIGNAL_HANDLER
+ if(damage_dealt > 0 && damagetype != OXY)
+ INVOKE_ASYNC(src, PROC_REF(hurt_by_someone))
+
+/mob/living/carbon/human/npc/outpost_kessler_staff/proc/hurt_by_someone()
+ leave(OUTPOST_KESSLER_ASSAULT_BEAM_DELAY)
+
+/mob/living/carbon/human/npc/outpost_kessler_staff/death(gibbed)
+ var/datum/outpost_prison/visited = prison
+ var/was_alive = stat != DEAD
+ . = ..()
+ if(!was_alive || stat != DEAD)
+ return
+ REMOVE_TRAIT(src, TRAIT_NO_CONTAINMENT, OUTPOST_KESSLER_TRAIT)
+ REMOVE_TRAIT(src, TRAIT_NO_STORAGE_INSERT, OUTPOST_KESSLER_TRAIT)
+ killed_on_visit(visited)
+ // Kessler takes its own people back, alive or not.
+ leave(OUTPOST_KESSLER_ASSAULT_BEAM_DELAY)
-/mob/living/basic/outpost_kessler_staff/proc/refuse_teleport(datum/source, atom/destination, channel)
+/// Killed while visiting `visited`
+/mob/living/carbon/human/npc/outpost_kessler_staff/proc/killed_on_visit(datum/outpost_prison/visited)
+ return
+
+/mob/living/carbon/human/npc/outpost_kessler_staff/proc/refuse_teleport(datum/source, atom/destination, channel)
SIGNAL_HANDLER
+ if(stat == DEAD)
+ return FALSE
return TRUE
-/mob/living/basic/outpost_kessler_staff/proc/refuse_polymorph(datum/source, what_to_randomize)
+/mob/living/carbon/human/npc/outpost_kessler_staff/proc/refuse_polymorph(datum/source, what_to_randomize)
SIGNAL_HANDLER
return STOP_WABBAJACK
-/mob/living/basic/outpost_kessler_staff/proc/refuse_type_change(datum/source)
+/mob/living/carbon/human/npc/outpost_kessler_staff/proc/refuse_type_change(datum/source)
SIGNAL_HANDLER
return COMPONENT_BLOCK_MOB_CHANGE
-/// Says a line of `context` from the dialogue file. Never while beaming in or out, invisible or half there.
-/mob/living/basic/outpost_kessler_staff/proc/say_line(context)
- if(beaming || departing)
+/// Says a line of `context` from the dialogue file. Never while beaming in or out, invisible or half there, or unable to talk.
+/mob/living/carbon/human/npc/outpost_kessler_staff/proc/say_line(context)
+ if(beaming || departing || !human_npc_can_talk(src))
return null
var/line = outpost_experiment_line(context)
if(line)
@@ -391,7 +422,7 @@
* Materialises where they stand: they knit together inside the transporter's column over the
* whole beam. They stay `beaming` (held still, silent) until finish_beam_in() as the beam ends.
*/
-/mob/living/basic/outpost_kessler_staff/proc/beam_in()
+/mob/living/carbon/human/npc/outpost_kessler_staff/proc/beam_in()
beaming = TRUE
ADD_TRAIT(src, TRAIT_IMMOBILIZED, OUTPOST_KESSLER_TRAIT)
var/turf/spot = get_turf(src)
@@ -404,7 +435,7 @@
addtimer(CALLBACK(src, PROC_REF(finish_beam_in)), OUTPOST_KESSLER_BEAM_TIME, TIMER_DELETE_ME)
/// Fully there as the beam ends: the flash, and only now do they talk
-/mob/living/basic/outpost_kessler_staff/proc/finish_beam_in()
+/mob/living/carbon/human/npc/outpost_kessler_staff/proc/finish_beam_in()
if(!beaming || departing)
return
var/turf/spot = get_turf(src)
@@ -420,7 +451,7 @@
say_line(arrival_line)
/// Leaves after `delay`: beams out and is gone
-/mob/living/basic/outpost_kessler_staff/proc/leave(delay = 0)
+/mob/living/carbon/human/npc/outpost_kessler_staff/proc/leave(delay = 0)
if(leaving)
return
leaving = TRUE
@@ -433,9 +464,13 @@
else
beam_out()
-/mob/living/basic/outpost_kessler_staff/proc/beam_out()
+/mob/living/carbon/human/npc/outpost_kessler_staff/proc/beam_out()
+ if(departing || QDELETED(src))
+ return
beaming = FALSE
departing = TRUE
+ pulledby?.stop_pulling()
+ buckled?.unbuckle_mob(src, force = TRUE)
ADD_TRAIT(src, TRAIT_IMMOBILIZED, OUTPOST_KESSLER_TRAIT)
var/turf/spot = get_turf(src)
if(spot)
@@ -444,7 +479,7 @@
transporter_dematerialise(src, OUTPOST_KESSLER_BEAM_TIME)
addtimer(CALLBACK(src, PROC_REF(finish_beam_out)), OUTPOST_KESSLER_BEAM_TIME, TIMER_DELETE_ME)
-/mob/living/basic/outpost_kessler_staff/proc/finish_beam_out()
+/mob/living/carbon/human/npc/outpost_kessler_staff/proc/finish_beam_out()
var/turf/spot = get_turf(src)
if(spot)
new /obj/effect/temp_visual/transporter_flash/departure(spot)
@@ -454,34 +489,36 @@
// ----- the researcher -----
-/mob/living/basic/outpost_kessler_staff/researcher
+/mob/living/carbon/human/npc/outpost_kessler_staff/researcher
name = "researcher"
desc = "A researcher from Kessler Biolabs, with a clipboard and a labcoat that has never seen a stain."
- outfit = /datum/outfit/outpost_kessler_researcher
+ npc_outfit = /datum/outfit/outpost_kessler_researcher
COOLDOWN_DECLARE(brush_off_cooldown)
-/mob/living/basic/outpost_kessler_staff/researcher/Initialize(mapload, datum/outpost_prison/owner)
+/mob/living/carbon/human/npc/outpost_kessler_staff/researcher/Initialize(mapload, datum/outpost_prison/owner)
. = ..()
- real_name = "Dr. [pick(GLOB.last_names)]"
- name = real_name
+ fully_replace_character_name(real_name, "Dr. [pick(GLOB.last_names)]")
RegisterSignal(src, COMSIG_ATOM_ATTACK_HAND, PROC_REF(on_hand))
-/mob/living/basic/outpost_kessler_staff/researcher/hurt_by_someone()
- if(prison?.researcher == src)
+/mob/living/carbon/human/npc/outpost_kessler_staff/researcher/hurt_by_someone()
+ if(prison?.researcher == src && !leaving)
prison.researcher_assaulted()
return
- leave()
+ leave(OUTPOST_KESSLER_ASSAULT_BEAM_DELAY)
+
+/mob/living/carbon/human/npc/outpost_kessler_staff/researcher/killed_on_visit(datum/outpost_prison/visited)
+ visited?.researcher_killed(src, lastattackerckey ? get_mob_by_ckey(lastattackerckey) : null)
-/// An empty hand, not in combat mode: a word with the researcher instead of a pat
-/mob/living/basic/outpost_kessler_staff/researcher/proc/on_hand(datum/source, mob/living/user, list/modifiers)
+/// An empty hand, not in combat mode: a word with the researcher instead of a pat. Down or out cold, tg's own help.
+/mob/living/carbon/human/npc/outpost_kessler_staff/researcher/proc/on_hand(datum/source, mob/living/user, list/modifiers)
SIGNAL_HANDLER
- if(!istype(user) || user.combat_mode || LAZYACCESS(modifiers, RIGHT_CLICK))
+ if(!istype(user) || user.combat_mode || LAZYACCESS(modifiers, RIGHT_CLICK) || stat != CONSCIOUS || on_fire)
return NONE
INVOKE_ASYNC(src, PROC_REF(talk_to), user)
return COMPONENT_CANCEL_ATTACK_CHAIN
/// Managers get the offer; everyone else gets told who the researcher deals with
-/mob/living/basic/outpost_kessler_staff/researcher/proc/talk_to(mob/living/user)
+/mob/living/carbon/human/npc/outpost_kessler_staff/researcher/proc/talk_to(mob/living/user)
if(leaving || beaming || !prison || prison.researcher != src)
return FALSE
face_atom(user)
@@ -493,17 +530,17 @@
return prison.present_offer(user)
/// The offer card as a prompt: "Accept", "Decline", or null if it was closed
-/mob/living/basic/outpost_kessler_staff/researcher/proc/ask_offer(mob/living/user, text, timeout)
+/mob/living/carbon/human/npc/outpost_kessler_staff/researcher/proc/ask_offer(mob/living/user, text, timeout)
return tgui_alert(user, text, "[real_name], Kessler Biolabs", list("Accept", "Decline"), timeout)
/// A pitch to whoever is about, pushier after declines
-/mob/living/basic/outpost_kessler_staff/researcher/proc/pitch(sweetened = FALSE)
+/mob/living/carbon/human/npc/outpost_kessler_staff/researcher/proc/pitch(sweetened = FALSE)
if(leaving || beaming)
return null
return say_line(sweetened ? "researcher_sweetened" : "researcher_offer")
/// A short visit to a wing in no state for an experiment
-/mob/living/basic/outpost_kessler_staff/researcher/proc/refuse_wing()
+/mob/living/carbon/human/npc/outpost_kessler_staff/researcher/proc/refuse_wing()
if(QDELETED(src) || leaving)
return
say_line("researcher_pigsty")
@@ -511,15 +548,30 @@
// ----- the recovery team -----
-/mob/living/basic/outpost_kessler_staff/agent
+/mob/living/carbon/human/npc/outpost_kessler_staff/agent
name = "Kessler recovery agent"
desc = "A Kessler Biolabs recovery agent in a hazmat suit, carrying a tranquilliser gun."
- outfit = /datum/outfit/outpost_kessler_agent
+ npc_outfit = /datum/outfit/outpost_kessler_agent
+
+/// Fires the real chloral hydrate dart in its syringe gun at `target`, the way anyone fires one. Returns TRUE if it fired.
+/mob/living/carbon/human/npc/outpost_kessler_staff/agent/proc/dart(mob/living/target)
+ if(QDELETED(target) || stat != CONSCIOUS || departing)
+ return FALSE
+ var/obj/item/gun/syringe/gun = locate() in held_items
+ if(!gun || !length(gun.syringes) || !human_npc_ready_item(src, gun))
+ return FALSE
+ face_atom(target)
+ var/old_combat_mode = combat_mode
+ set_combat_mode(TRUE, silent = TRUE)
+ ClickOn(target)
+ set_combat_mode(old_combat_mode, silent = TRUE)
+ return TRUE
/**
* Two agents beam in around `creature`, one says a line of `context` once they are all the way in,
- * and they all beam out after OUTPOST_KESSLER_TEAM_TIME. A creature still on its feet is
- * `tranquilise`d; one already down is simply collected.
+ * and they all beam out after OUTPOST_KESSLER_TEAM_TIME. With `tranquilise`, the first agent fires the
+ * real chloral hydrate dart in its syringe gun at the creature once it is all the way in, to keep it
+ * down while they work (owner ruling OC-3: they collect only what is already down).
*/
/proc/outpost_kessler_team(mob/living/creature, context = "kessler_recovery", tranquilise = TRUE)
var/turf/center = get_turf(creature)
@@ -529,9 +581,9 @@
for(var/turf/open/tile in orange(1, center))
if(!tile.is_blocked_turf(TRUE) && !(locate(/mob/living) in tile))
spots += tile
- var/mob/living/basic/outpost_kessler_staff/agent/speaker
+ var/mob/living/carbon/human/npc/outpost_kessler_staff/agent/speaker
for(var/i in 1 to min(2, length(spots)))
- var/mob/living/basic/outpost_kessler_staff/agent/agent = new(pick_n_take(spots), null)
+ var/mob/living/carbon/human/npc/outpost_kessler_staff/agent/agent = new(pick_n_take(spots), null)
agent.face_atom(creature)
agent.beam_in()
agent.leave(OUTPOST_KESSLER_TEAM_TIME)
@@ -543,21 +595,11 @@
if(tranquilise)
creature.visible_message(span_warning("Kessler Biolabs agents beam in around [creature], and a tranquilliser dart drops [creature.p_them()]."))
playsound(center, 'sound/items/syringeproj.ogg', 50, TRUE)
+ if(speaker)
+ addtimer(CALLBACK(speaker, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_kessler_staff/agent, dart), creature), OUTPOST_KESSLER_BEAM_TIME + 0.2 SECONDS, TIMER_DELETE_ME)
else
creature.visible_message(span_notice("Kessler Biolabs agents beam in to collect [creature]."))
-/// Kessler's beam takes `target` away for good
-/proc/outpost_kessler_beam_away(mob/living/target)
- if(QDELETED(target))
- return
- var/turf/spot = get_turf(target)
- if(spot)
- target.visible_message(span_notice("A transporter beam takes [target] away."))
- playsound(spot, 'sound/effects/magic/teleport_diss.ogg', 40, TRUE)
- new /obj/effect/temp_visual/transporter_beam(spot, OUTPOST_KESSLER_BEAM_TIME + 0.5 SECONDS)
- transporter_dematerialise(target, OUTPOST_KESSLER_BEAM_TIME)
- QDEL_IN(target, OUTPOST_KESSLER_BEAM_TIME)
-
// ===== LOOKS =====
/datum/outfit/outpost_kessler_researcher
@@ -578,3 +620,16 @@
gloves = /obj/item/clothing/gloves/latex
shoes = /obj/item/clothing/shoes/sneakers/white
r_hand = /obj/item/gun/syringe
+
+/datum/outfit/outpost_kessler_agent/post_equip(mob/living/carbon/human/agent, visuals_only = FALSE)
+ . = ..()
+ if(visuals_only)
+ return
+ var/obj/item/gun/syringe/gun = locate() in agent.held_items
+ if(!gun)
+ return
+ var/obj/item/reagent_containers/syringe/dart = new(gun)
+ dart.reagents.add_reagent(/datum/reagent/toxin/chloralhydrate, dart.volume)
+ dart.name = "tranquilliser syringe"
+ gun.syringes += dart
+ gun.update_appearance()
diff --git a/voidcrew/modules/player_outposts/outpost_prison_riot.dm b/voidcrew/modules/player_outposts/outpost_prison_riot.dm
index c531de4ec84..0468d022a1a 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_riot.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_riot.dm
@@ -140,10 +140,10 @@
* mean mood, so a neglected wing sours its newcomers. `newcomer` is left out of the mean, as is
* anyone who has not served a moment yet.
*/
-/datum/outpost_prison/proc/arrival_mood(mob/living/basic/outpost_prisoner/newcomer)
+/datum/outpost_prison/proc/arrival_mood(mob/living/carbon/human/npc/outpost_prisoner/newcomer)
var/total = 0
var/count = 0
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner == newcomer || prisoner.served_seconds <= 0 || !counts_for_tension(prisoner))
continue
total += prisoner.mood
@@ -159,7 +159,7 @@
* PRISONER_LOCKED_IN_RECOVERY seconds a second, so letting them out for a moment does not reset it.
* A rioter just shut in a cell is in custody, and owes lockdown for it (outpost_prison_capture.dm).
*/
-/datum/outpost_prison/proc/update_locked_in(mob/living/basic/outpost_prisoner/prisoner, seconds)
+/datum/outpost_prison/proc/update_locked_in(mob/living/carbon/human/npc/outpost_prisoner/prisoner, seconds)
var/confined = prisoner.is_confined()
if(confined)
if(!prisoner.was_confined && prisoner.is_rioting())
@@ -181,7 +181,7 @@
return riot_active || runners_at_large() > 0
/// A prisoner is let out after a long lock-in: some relief, and they say so
-/datum/outpost_prison/proc/on_unbolted(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/on_unbolted(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(QDELETED(prisoner) || prisoner.stat != CONSCIOUS || prisoner.phase != PRISONER_PRESENT || prisoner.trouble)
return FALSE
prisoner.adjust_mood(PRISONER_MOOD_UNBOLTED)
@@ -209,7 +209,7 @@
* Staff killed a prisoner. No fine: the cost is the worst spark there is, the pay and bonus they
* forfeit, and a body to deal with (body_tick()).
*/
-/datum/outpost_prison/proc/blame_death(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/blame_death(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(prisoner.death_blamed)
return FALSE
prisoner.death_blamed = TRUE
@@ -219,14 +219,14 @@
return trouble_event(PRISON_SPIKE_KILLED, "[prisoner.real_name] was killed by staff")
/// Whether a prisoner's mood counts toward the wing's tension: present, alive and not loose
-/datum/outpost_prison/proc/counts_for_tension(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/counts_for_tension(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
return prisoner.phase == PRISONER_PRESENT && prisoner.stat != DEAD && prisoner.trouble != PRISONER_TROUBLE_LOOSE
/// 100 minus the mean mood of the prisoners in the cell block, plus the spike and any shivs hidden in the wing
/datum/outpost_prison/proc/compute_tension()
var/total = 0
var/count = 0
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(!counts_for_tension(prisoner))
continue
total += prisoner.mood
@@ -289,7 +289,7 @@
var/hurt = 0
var/locked = 0
var/cuffed = 0
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(!counts_for_tension(prisoner))
continue
if(prisoner.hunger < PRISONER_HUNGER_HUNGRY)
@@ -338,7 +338,7 @@
add_log("A riot is brewing in the yard.")
announce("Prison wing: a riot is brewing.", SHIP_NOTIFY_DANGER)
var/shouts = 0
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(!prisoner.routine_allowed() || cell_at(get_turf(prisoner)))
continue
// Leisure makes way, so the gathering (three times as likely now) gets picked.
@@ -355,7 +355,7 @@
/datum/outpost_prison/proc/trouble_tick(seconds)
tension_spike = max(0, tension_spike - PRISON_SPIKE_DECAY * seconds)
subdued_left = max(0, subdued_left - seconds)
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners.Copy())
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners.Copy())
if(QDELETED(prisoner) || prisoner.phase != PRISONER_PRESENT || prisoner.stat == DEAD)
continue
prisoner.trouble_counters(seconds)
@@ -373,7 +373,7 @@
check_incident_over()
/// A prisoner's own trouble timers
-/mob/living/basic/outpost_prisoner/proc/trouble_counters(seconds)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/trouble_counters(seconds)
threat_cooldown = max(0, threat_cooldown - seconds)
fight_cooldown = max(0, fight_cooldown - seconds)
if(swing_ref)
@@ -382,10 +382,8 @@
if(swing_left <= 0 || !target || target.stat == DEAD)
swing_ref = null
swing_left = 0
- if(beaten_left > 0)
- beaten_left -= seconds
- if(beaten_left <= 0 || health_factor() > PRISONER_RECOVER_ABOVE)
- recover()
+ // Down until they are up again, by tg's own clock (crit, stamina, the knockdown), or a yield's lie-down by choice
+ beaten_tick()
if(climb_ref)
climb_tick(seconds)
@@ -396,7 +394,7 @@
* their AI runs, and never at someone who just helped them. A talk with staff holds the threat.
*/
/datum/outpost_prison/proc/threats_tick(seconds)
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
// Someone in trouble keeps a swing only while hitting back at a player (outpost_prison_trouble.dm).
// Running from a creature, staff are the least of their worries (outpost_prison_panic.dm).
if(prisoner.phase != PRISONER_PRESENT || (prisoner.trouble && !prisoner.retaliating()) || !prisoner.trouble_can_act() || !prisoner.ai_running() || !in_cell_block(prisoner) || prisoner.is_panicking())
@@ -427,8 +425,8 @@
/// Two prisoners squaring off: an argument, then blows until one yields
/datum/outpost_prison_fight
var/datum/outpost_prison/prison
- var/mob/living/basic/outpost_prisoner/first
- var/mob/living/basic/outpost_prisoner/second
+ var/mob/living/carbon/human/npc/outpost_prisoner/first
+ var/mob/living/carbon/human/npc/outpost_prisoner/second
/// What it is about, for the argument's lines: "food", "ball", "bed" or "none"
var/cause = "none"
/// Past the argument: blows are being thrown
@@ -440,7 +438,7 @@
/// Seconds it has lasted
var/elapsed = 0
-/datum/outpost_prison_fight/New(datum/outpost_prison/owner, mob/living/basic/outpost_prisoner/one, mob/living/basic/outpost_prisoner/two, cause = "none")
+/datum/outpost_prison_fight/New(datum/outpost_prison/owner, mob/living/carbon/human/npc/outpost_prisoner/one, mob/living/carbon/human/npc/outpost_prisoner/two, cause = "none")
. = ..()
prison = owner
first = one
@@ -457,7 +455,7 @@
prison = null
return ..()
-/datum/outpost_prison_fight/proc/opponent_of(mob/living/basic/outpost_prisoner/fighter)
+/datum/outpost_prison_fight/proc/opponent_of(mob/living/carbon/human/npc/outpost_prisoner/fighter)
if(fighter == first)
return second
if(fighter == second)
@@ -465,7 +463,7 @@
return null
/// Still up for it: awake, on their feet, in this fight
-/datum/outpost_prison_fight/proc/fighter_ok(mob/living/basic/outpost_prisoner/fighter)
+/datum/outpost_prison_fight/proc/fighter_ok(mob/living/carbon/human/npc/outpost_prisoner/fighter)
return !QDELETED(fighter) && fighter.stat == CONSCIOUS && fighter.phase == PRISONER_PRESENT && fighter.fight == src && fighter.trouble == PRISONER_TROUBLE_FIGHT && !fighter.can_be_dragged()
/// The argument, then the fight. FALSE once it is over.
@@ -476,7 +474,7 @@
if(elapsed >= PRISONER_FIGHT_MAX_TIME)
return FALSE
if(fighting)
- for(var/mob/living/basic/outpost_prisoner/fighter as anything in list(first, second))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/fighter as anything in list(first, second))
if(fighter.health_factor() <= PRISONER_FIGHT_YIELD)
fighter.yield_fight()
return FALSE
@@ -485,8 +483,8 @@
line_left -= seconds
if(line_left <= 0)
line_left = 3
- var/mob/living/basic/outpost_prisoner/speaker = first_speaks ? first : second
- var/mob/living/basic/outpost_prisoner/listener = opponent_of(speaker)
+ var/mob/living/carbon/human/npc/outpost_prisoner/speaker = first_speaks ? first : second
+ var/mob/living/carbon/human/npc/outpost_prisoner/listener = opponent_of(speaker)
first_speaks = !first_speaks
speaker.face_atom(listener)
speaker.say_context_or("fight_argue_[cause]", "fight_argue", listener)
@@ -494,17 +492,17 @@
fighting = TRUE
first.manual_emote("goes for [second]!")
// A scuffle on the floor is dirty work.
- for(var/mob/living/basic/outpost_prisoner/fighter as anything in list(first, second))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/fighter as anything in list(first, second))
fighter.set_uniform_grime(fighter.uniform_grime + PRISONER_FIGHT_GRIME)
return TRUE
/// Starts a fight between two prisoners over `cause`, telling everyone in sight. Returns the fight, or null.
-/datum/outpost_prison/proc/start_fight(mob/living/basic/outpost_prisoner/one, mob/living/basic/outpost_prisoner/two, cause = "none")
+/datum/outpost_prison/proc/start_fight(mob/living/carbon/human/npc/outpost_prisoner/one, mob/living/carbon/human/npc/outpost_prisoner/two, cause = "none")
if(!trouble_enabled || one == two || one.fight || two.fight || riot_active)
return null
var/datum/outpost_prison_fight/brawl = new(src, one, two, cause)
fights += brawl
- for(var/mob/living/basic/outpost_prisoner/fighter as anything in list(one, two))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/fighter as anything in list(one, two))
fighter.cancel_threat()
fighter.end_activity()
fighter.stand_up()
@@ -513,7 +511,7 @@
one.face_atom(two)
two.face_atom(one)
add_tension_spike(PRISON_SPIKE_FIGHT)
- for(var/mob/living/basic/outpost_prisoner/onlooker in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/onlooker in prisoners)
if(onlooker == one || onlooker == two || onlooker.stat != CONSCIOUS || onlooker.phase != PRISONER_PRESENT)
continue
if((onlooker in view(7, one)) || (onlooker in view(7, two)))
@@ -528,7 +526,7 @@
return
fights -= brawl
fight_gap_left = PRISON_FIGHT_GAP
- for(var/mob/living/basic/outpost_prisoner/fighter as anything in list(brawl.first, brawl.second))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/fighter as anything in list(brawl.first, brawl.second))
if(QDELETED(fighter))
continue
if(fighter.fight == brawl)
@@ -541,15 +539,15 @@
qdel(brawl)
/// Whether they are angry enough, free and able to start a fight, with someone around to see it, and no creature frightening them
-/mob/living/basic/outpost_prisoner/proc/can_start_fight()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/can_start_fight()
return prison && mood < PRISONER_FIGHT_MOOD && !in_trouble() && fight_cooldown <= 0 && trouble_can_act() && health_factor() > PRISONER_FIGHT_YIELD && !activity?.sleeping && ai_running() && prison.in_cell_block(src) && !is_panicking()
/// Chasing the ball, or holding it
-/mob/living/basic/outpost_prisoner/proc/after_ball()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/after_ball()
return istype(activity, /datum/prisoner_activity/basketball) || istype(held_item, /obj/item/toy/basketball)
/// What two prisoners would fight about: both hungry ("food"), both after the ball ("ball"), one in the other's cell ("bed"), or nothing ("none")
-/datum/outpost_prison/proc/fight_cause(mob/living/basic/outpost_prisoner/one, mob/living/basic/outpost_prisoner/two)
+/datum/outpost_prison/proc/fight_cause(mob/living/carbon/human/npc/outpost_prisoner/one, mob/living/carbon/human/npc/outpost_prisoner/two)
if(one.hunger < PRISONER_HUNGER_HUNGRY && two.hunger < PRISONER_HUNGER_HUNGRY)
return "food"
if(one.after_ball() && two.after_ball())
@@ -585,14 +583,14 @@
if(!trouble_enabled || riot_active || subdued_left > 0 || length(fights) || fight_gap_left > 0)
return null
var/list/angry = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.phase == PRISONER_PRESENT && prisoner.can_start_fight())
angry += prisoner
var/list/pairs = list()
for(var/i in 1 to length(angry) - 1)
- var/mob/living/basic/outpost_prisoner/one = angry[i]
+ var/mob/living/carbon/human/npc/outpost_prisoner/one = angry[i]
for(var/j in i + 1 to length(angry))
- var/mob/living/basic/outpost_prisoner/two = angry[j]
+ var/mob/living/carbon/human/npc/outpost_prisoner/two = angry[j]
if(get_dist(one, two) <= PRISONER_FIGHT_RANGE && one.walkable?[get_turf(two)])
pairs += list(list(one, two))
if(!length(pairs))
@@ -609,7 +607,7 @@
// ===== SPATS =====
/// Whether a prisoner is sour enough and free to argue, and no creature is frightening them
-/datum/outpost_prison/proc/can_spat(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/can_spat(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
return prisoner.phase == PRISONER_PRESENT && prisoner.mood < PRISONER_SPAT_MOOD && !prisoner.in_trouble() && prisoner.trouble_can_act() && !prisoner.activity?.sleeping && prisoner.ai_running() && !prisoner.is_panicking()
/**
@@ -620,14 +618,14 @@
if(!trouble_enabled || riot_active || spat_lines_left > 0 || spat_gap_left > 0 || !prob(PRISON_SPAT_CHANCE * contraband_spat_mult()))
return FALSE
var/list/sour = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(can_spat(prisoner))
sour += prisoner
var/list/pairs = list()
for(var/i in 1 to length(sour) - 1)
- var/mob/living/basic/outpost_prisoner/one = sour[i]
+ var/mob/living/carbon/human/npc/outpost_prisoner/one = sour[i]
for(var/j in i + 1 to length(sour))
- var/mob/living/basic/outpost_prisoner/two = sour[j]
+ var/mob/living/carbon/human/npc/outpost_prisoner/two = sour[j]
if(get_dist(one, two) <= PRISONER_FIGHT_RANGE && (two in view(PRISONER_FIGHT_RANGE, one)))
pairs += list(list(one, two))
if(!length(pairs))
@@ -651,13 +649,13 @@
spat_line_left -= seconds
if(spat_line_left > 0)
return
- var/mob/living/basic/outpost_prisoner/one = spat_first_ref?.resolve()
- var/mob/living/basic/outpost_prisoner/two = spat_second_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/one = spat_first_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/two = spat_second_ref?.resolve()
if(!one || !two || one.stat != CONSCIOUS || two.stat != CONSCIOUS || one.phase != PRISONER_PRESENT || two.phase != PRISONER_PRESENT || one.in_trouble() || two.in_trouble())
spat_lines_left = 0
return
- var/mob/living/basic/outpost_prisoner/speaker = (spat_lines_said % 2) ? two : one
- var/mob/living/basic/outpost_prisoner/listener = speaker == one ? two : one
+ var/mob/living/carbon/human/npc/outpost_prisoner/speaker = (spat_lines_said % 2) ? two : one
+ var/mob/living/carbon/human/npc/outpost_prisoner/listener = speaker == one ? two : one
speaker.face_atom(listener)
speaker.say_context("spat", listener)
spat_lines_said++
@@ -667,7 +665,7 @@
// ===== RIOTS =====
/// Whether they are shut in a cell with its door bolted
-/mob/living/basic/outpost_prisoner/proc/in_bolted_cell()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/in_bolted_cell()
var/datum/outpost_prison_cell/holding = prison?.cell_at(get_turf(src))
return holding?.is_bolted()
@@ -676,11 +674,11 @@
* door bolted open does not count). Down or cuffed, they are still at large, though the riot may
* count them dealt with (riot_handled()).
*/
-/mob/living/basic/outpost_prisoner/proc/riot_at_large()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/riot_at_large()
return phase == PRISONER_PRESENT && stat != DEAD && is_rioting() && !is_confined()
/// A rioter at large and free to act: on their feet, uncuffed, and not given up at a turret's warning (outpost_prison_security.dm)
-/mob/living/basic/outpost_prisoner/proc/riot_free()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/riot_free()
return riot_at_large() && stat == CONSCIOUS && !can_be_dragged() && !surrendered_to_turret()
/**
@@ -689,10 +687,10 @@
* unable to act (in crit, stamina crit, collapsed or stunned). A knockdown they are straight back
* up from is not enough. The riot is over once every rioter is (riot_tick()).
*/
-/mob/living/basic/outpost_prisoner/proc/riot_handled()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/riot_handled()
if(QDELETED(src) || isnull(get_turf(src)))
return TRUE
- if(!riot_at_large() || cuffs)
+ if(!riot_at_large() || handcuffed)
return TRUE
return stat != CONSCIOUS || HAS_TRAIT(src, TRAIT_INCAPACITATED)
@@ -700,11 +698,11 @@
* Whether they can join a riot now. Not from a cell they are shut in: a riot that nobody can take
* out of a cell would be over as soon as it began, so they bang on the door and shout instead.
*/
-/mob/living/basic/outpost_prisoner/proc/can_join_riot()
- return prison && stat == CONSCIOUS && phase == PRISONER_PRESENT && !can_be_dragged() && beaten_left <= 0 && !climb_ref && (!trouble || trouble == PRISONER_TROUBLE_FIGHT) && prison.in_cell_block(src) && !is_confined()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/can_join_riot()
+ return prison && stat == CONSCIOUS && phase == PRISONER_PRESENT && !can_be_dragged() && !beaten && !climb_ref && (!trouble || trouble == PRISONER_TROUBLE_FIGHT) && prison.in_cell_block(src) && !is_confined()
/// Below this mood they join a riot, by personality, raised by a shiv under their mattress (outpost_prison_contraband.dm)
-/mob/living/basic/outpost_prisoner/proc/riot_join_mood()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/riot_join_mood()
var/line = PRISON_RIOT_JOIN_CHATTY
switch(personality)
if("grumpy")
@@ -721,10 +719,10 @@
* Who joins a riot: everyone below their personality's line (everyone able, for an admin riot),
* plus `forced`, else the unhappiest alone.
*/
-/datum/outpost_prison/proc/riot_candidates(everyone = FALSE, mob/living/basic/outpost_prisoner/forced)
+/datum/outpost_prison/proc/riot_candidates(everyone = FALSE, mob/living/carbon/human/npc/outpost_prisoner/forced)
var/list/joining = list()
- var/mob/living/basic/outpost_prisoner/unhappiest
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ var/mob/living/carbon/human/npc/outpost_prisoner/unhappiest
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(!prisoner.can_join_riot())
continue
if(everyone || prisoner == forced || prisoner.mood < prisoner.riot_join_mood())
@@ -741,7 +739,7 @@
* does. `ignore_quiet` starts it in the quiet after a riot too, for a prisoner let out of lockdown
* early. An experiment under way stops nothing.
*/
-/datum/outpost_prison/proc/start_riot(reason, everyone = FALSE, mob/living/basic/outpost_prisoner/forced, ignore_quiet = FALSE, alone = FALSE)
+/datum/outpost_prison/proc/start_riot(reason, everyone = FALSE, mob/living/carbon/human/npc/outpost_prisoner/forced, ignore_quiet = FALSE, alone = FALSE)
if(!trouble_enabled || riot_active)
return FALSE
if(!everyone && subdued_left > 0 && !ignore_quiet)
@@ -766,7 +764,7 @@
open_incident()
var/shouts = 0
// A Most Wanted ringleader is among the first to shout (outpost_prison_bounty.dm).
- for(var/mob/living/basic/outpost_prisoner/rioter as anything in bounty_ringleaders_first(joining))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/rioter as anything in bounty_ringleaders_first(joining))
rioter.start_rioting(shouts++ < 2)
send_bystanders_home(joining)
add_log("Riot in the yard: [length(joining)] prisoner\s.")
@@ -777,7 +775,7 @@
return TRUE
/// Joins the riot: a shiv out, everything else dropped
-/mob/living/basic/outpost_prisoner/proc/start_rioting(shout = TRUE)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/start_rioting(shout = TRUE)
cancel_threat()
end_activity()
stand_up()
@@ -786,16 +784,15 @@
riot_target_ref = null
riot_target_hits = 0
riot_victim_ref = null
- // A shiv they hid in their cell is the one they draw (outpost_prison_contraband.dm).
- if(!prison?.draw_stashed_shiv(src))
- draw_shiv()
+ // A shiv they hid in their cell is the one they draw (outpost_prison_contraband.dm); without one, their fists.
+ prison?.draw_stashed_shiv(src)
update_bubble()
if(shout)
say_context("riot")
/// Prisoners who stay out of a riot go back to their own cells and sit it out on the bed. Anyone running from a creature keeps running (outpost_prison_panic.dm).
/datum/outpost_prison/proc/send_bystanders_home(list/rioters)
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if((prisoner in rioters) || prisoner.phase != PRISONER_PRESENT || !prisoner.routine_allowed() || prisoner.is_confined() || prisoner.is_panicking())
continue
var/datum/prisoner_activity/hide/hide = new(prisoner)
@@ -816,7 +813,7 @@
riot_windup_left = max(0, riot_windup_left - seconds)
var/unhandled = 0
var/free = 0
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.riot_handled())
continue
unhandled++
@@ -862,7 +859,7 @@
riot_windup_left = 0
tension_spike = 0
subdued_left = PRISON_SUBDUED_TIME / (1 SECONDS)
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.is_rioting())
prisoner.calm_down()
stage = outpost_prison_stage_for(compute_tension())
@@ -884,7 +881,7 @@
/// The riot went on too long: the rioters go all out for the exits, and each one's loose clock starts
/datum/outpost_prison/proc/begin_breakout()
breaking_out = TRUE
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
// Rioters who gave up at a turret's warning stay where they are (outpost_prison_security.dm)
if(prisoner.trouble != PRISONER_TROUBLE_RIOT || prisoner.surrendered_to_turret())
continue
@@ -901,7 +898,7 @@
* once a riot turns into a breakout. Anyone else in a riot already on carries on as before. Returns
* TRUE if they are breaking out.
*/
-/datum/outpost_prison/proc/start_breakout(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/start_breakout(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(!trouble_enabled || QDELETED(prisoner) || !(prisoner in prisoners))
return FALSE
if(!prisoner.is_rioting())
@@ -928,7 +925,7 @@
*/
/datum/outpost_prison/proc/transfer_rioters()
var/list/rioters = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.riot_at_large() && !held_for_experiment(prisoner))
rioters += prisoner
if(!length(rioters))
@@ -937,7 +934,7 @@
return 0
open_incident()
var/charged = 0
- for(var/mob/living/basic/outpost_prisoner/rioter as anything in rioters)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/rioter as anything in rioters)
close_bounty_record(rioter, BOUNTY_RECORD_CLOSED)
charged += charge_fine(OUTPOST_PRISON_TRANSFER_FEE, "Prisoner transfer: [rioter.real_name]", TRUE)
note_prisoner_lost(rioter, "transferred")
@@ -951,7 +948,7 @@
return length(rioters)
/// A serving hatch left open on both sides that this prisoner can reach from the yard side
-/datum/outpost_prison/proc/open_hatch_for(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/open_hatch_for(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
for(var/obj/structure/table/reinforced/prison_hatch/hatch in fixtures_of("hatch"))
if(QDELETED(hatch) || !hatch.both_sides_open())
continue
@@ -969,7 +966,7 @@
* were smashing for a few more blows, or a new target (pick_smash_target(),
* outpost_prison_breakout.dm). Turret warnings are in outpost_prison_security.dm.
*/
-/mob/living/basic/outpost_prisoner/proc/riot_target()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/riot_target()
if(!prison)
return null
if(prison.riot_windup_left > 0 || surrendered_to_turret() || is_confined())
@@ -1004,7 +1001,7 @@
return next
/// The nearest member of staff in sight that they can get to, and that no more than PRISON_RIOT_MAX_ATTACKERS - 1 others are going for
-/mob/living/basic/outpost_prisoner/proc/staff_in_reach()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/staff_in_reach()
var/mob/living/nearest
var/nearest_distance = INFINITY
for(var/mob/living/person in view(7, src))
@@ -1020,9 +1017,9 @@
return nearest
/// How many rioters other than `except` are going for `person`
-/datum/outpost_prison/proc/attackers_on(mob/living/person, mob/living/basic/outpost_prisoner/except)
+/datum/outpost_prison/proc/attackers_on(mob/living/person, mob/living/carbon/human/npc/outpost_prisoner/except)
var/count = 0
- for(var/mob/living/basic/outpost_prisoner/other in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/other in prisoners)
if(other == except || !other.is_rioting() || !other.trouble_can_act())
continue
if(other.riot_victim_ref?.resolve() == person)
@@ -1030,7 +1027,7 @@
return count
/// Whether a rioter's target is still worth hitting
-/datum/outpost_prison/proc/still_smashable(atom/target, mob/living/basic/outpost_prisoner/rioter)
+/datum/outpost_prison/proc/still_smashable(atom/target, mob/living/carbon/human/npc/outpost_prisoner/rioter)
if(QDELETED(target) || !rioter.reachable?[get_turf(target)] || LAZYACCESS(rioter.riot_skips, REF(target)) > world.time)
return FALSE
if(istype(target, /obj/machinery/light))
@@ -1078,7 +1075,7 @@
* wrecking their cells; wrecks under way go on. Nothing happens while their AI sleeps.
*/
/datum/outpost_prison/proc/wreck_tick(seconds)
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners.Copy())
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners.Copy())
if(QDELETED(prisoner) || prisoner.phase != PRISONER_PRESENT || prisoner.stat != CONSCIOUS)
continue
if(prisoner.trouble == PRISONER_TROUBLE_WRECK)
@@ -1091,7 +1088,7 @@
* and gets dirty, and they hammer on the door. The warden's log says so. Also the admin panel's hook.
* Returns TRUE if they started.
*/
-/datum/outpost_prison/proc/start_wreck(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/start_wreck(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(QDELETED(prisoner) || prisoner.prison != src || prisoner.phase != PRISONER_PRESENT || prisoner.stat != CONSCIOUS || prisoner.trouble)
return FALSE
var/datum/outpost_prison_cell/holding = cell_at(get_turf(prisoner))
@@ -1122,7 +1119,7 @@
return TRUE
/// A wreck goes on: bangs on the door every few seconds, and after PRISONER_WRECK_TIME the bolts shear
-/datum/outpost_prison/proc/wreck_step(mob/living/basic/outpost_prisoner/prisoner, seconds)
+/datum/outpost_prison/proc/wreck_step(mob/living/carbon/human/npc/outpost_prisoner/prisoner, seconds)
var/datum/outpost_prison_cell/holding = cell_at(get_turf(prisoner))
if(!holding || !prisoner.is_confined())
// Let out, or no longer in a cell: the wreck is over.
@@ -1144,7 +1141,7 @@
shear_bolts(prisoner, holding)
/// A wreck ends without the bolts shearing: let out, knocked down or gone
-/datum/outpost_prison/proc/stop_wreck(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/stop_wreck(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(prisoner.trouble != PRISONER_TROUBLE_WRECK)
return
prisoner.trouble = null
@@ -1153,7 +1150,7 @@
prisoner.update_bubble()
/// The cell door gives, bolted or welded: out they come, and unless the wing is subdued they riot
-/datum/outpost_prison/proc/shear_bolts(mob/living/basic/outpost_prisoner/prisoner, datum/outpost_prison_cell/holding)
+/datum/outpost_prison/proc/shear_bolts(mob/living/carbon/human/npc/outpost_prisoner/prisoner, datum/outpost_prison_cell/holding)
stop_wreck(prisoner)
var/obj/machinery/door/airlock/door = holding.door()
if(door && (door.locked || door.welded))
@@ -1199,7 +1196,7 @@
/// Prisoners on the patrol AI, still in the wing's custody
/datum/outpost_prison/proc/loose_count()
var/count = 0
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.trouble == PRISONER_TROUBLE_LOOSE && prisoner.phase == PRISONER_PRESENT && prisoner.stat != DEAD)
count++
return count
@@ -1207,8 +1204,8 @@
/// Loose prisoners nobody has caught yet: not cuffed. Caught ones, left cuffed somewhere, keep no protective custody going.
/datum/outpost_prison/proc/runners_at_large()
var/count = 0
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
- if(prisoner.trouble == PRISONER_TROUBLE_LOOSE && prisoner.phase == PRISONER_PRESENT && prisoner.stat != DEAD && !prisoner.cuffs)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
+ if(prisoner.trouble == PRISONER_TROUBLE_LOOSE && prisoner.phase == PRISONER_PRESENT && prisoner.stat != DEAD && !prisoner.handcuffed)
count++
return count
@@ -1219,7 +1216,7 @@
*/
/datum/outpost_prison/proc/alarm_state()
var/list/sightings = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.trouble == PRISONER_TROUBLE_LOOSE && prisoner.phase == PRISONER_PRESENT && prisoner.stat != DEAD)
sightings += "[prisoner.real_name] ([get_area_name(prisoner)])"
var/loose_text
@@ -1242,7 +1239,7 @@
/// The trouble block for the admin panel and tests: the stage, tension, the riot's clocks and who is on a loose clock where
/datum/outpost_prison/proc/trouble_payload()
var/list/loose = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners)
if(prisoner.phase != PRISONER_PRESENT || prisoner.stat == DEAD || prisoner.loose_left <= 0)
continue
if(prisoner.trouble != PRISONER_TROUBLE_LOOSE && prisoner.trouble != PRISONER_TROUBLE_BREAKOUT)
@@ -1269,7 +1266,7 @@
* or cuffed (can_be_dragged()).
*/
/datum/outpost_prison/proc/check_escapes(seconds)
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners.Copy())
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners.Copy())
if(QDELETED(prisoner) || prisoner.phase != PRISONER_PRESENT || prisoner.stat == DEAD)
continue
var/inside = in_cell_block(prisoner)
@@ -1300,13 +1297,13 @@
/datum/outpost_prison/proc/loose_tick(seconds)
var/list/still_loose = list()
var/list/nearly_away = list()
- for(var/mob/living/basic/outpost_prisoner/prisoner in prisoners.Copy())
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/prisoner in prisoners.Copy())
if(QDELETED(prisoner) || prisoner.phase != PRISONER_PRESENT || prisoner.stat == DEAD || prisoner.loose_left <= 0)
continue
if(prisoner.trouble != PRISONER_TROUBLE_LOOSE && prisoner.trouble != PRISONER_TROUBLE_BREAKOUT)
prisoner.loose_left = 0
continue
- if(prisoner.trouble == PRISONER_TROUBLE_LOOSE ? prisoner.cuffs : !prisoner.riot_free())
+ if(prisoner.trouble == PRISONER_TROUBLE_LOOSE ? prisoner.handcuffed : !prisoner.riot_free())
continue
if(prisoner.loose_left <= seconds && held_for_experiment(prisoner))
continue
@@ -1327,7 +1324,7 @@
* Out of the cell block: loose on the outpost patrol AI, with their clock running. `breakout`
* marks it as part of a breakout even if they were not rioting (the admin button).
*/
-/datum/outpost_prison/proc/prisoner_escaped(mob/living/basic/outpost_prisoner/prisoner, breakout = FALSE)
+/datum/outpost_prison/proc/prisoner_escaped(mob/living/carbon/human/npc/outpost_prisoner/prisoner, breakout = FALSE)
if(prisoner.trouble == PRISONER_TROUBLE_LOOSE)
return FALSE
var/from_riot = breakout || prisoner.is_rioting()
@@ -1353,7 +1350,7 @@
return TRUE
/// Goes loose: the outpost patrol AI takes over, and the clock starts, or carries on from the breakout
-/mob/living/basic/outpost_prisoner/proc/go_loose()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/go_loose()
end_activity()
stand_up()
stop_climb()
@@ -1366,11 +1363,8 @@
trouble = PRISONER_TROUBLE_LOOSE
if(loose_left <= 0)
loose_left = OUTPOST_PRISON_LOOSE_TIME
- // Wanted and Most Wanted bounty prisoners hit harder, and a meek one runs faster (outpost_prison_bounty.dm).
- obj_damage = PRISONER_LOOSE_OBJ_DAMAGE * bounty_breakout_mult()
- if(bounty_loose_speed())
- set_varspeed(bounty_base_speed())
- update_melee()
+ // A runner runs.
+ set_prison_pace(hurry = bounty_base_speed())
update_bubble()
// The outpost patrol AI (voidcrew/modules/npc_ships/code/outpost_patrol.dm). Finding the doors
// yields on a big outpost, and this runs in the prison's tick on SSprocessing.
@@ -1378,7 +1372,7 @@
assign_mob_to_outpost_patrol_async(src, prison?.outpost)
/// Back in the cell block, down or cuffed: in custody again, in a foul mood, and owing lockdown if they got out during a riot
-/datum/outpost_prison/proc/recapture(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/recapture(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(prisoner.trouble != PRISONER_TROUBLE_LOOSE)
return FALSE
var/owes_lockdown = prisoner.escaped_rioting
@@ -1391,21 +1385,17 @@
update_riot_lights()
return TRUE
-/mob/living/basic/outpost_prisoner/proc/back_in_custody()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/back_in_custody()
clear_outpost_patrol(src)
trouble = null
loose_left = 0
escaped_rioting = FALSE
note_trouble_ended()
- obj_damage = initial(obj_damage)
- // A meek bounty prisoner slows back down (outpost_prison_bounty.dm).
- if(bounty_loose_speed())
- set_varspeed(bounty_base_speed())
+ set_prison_pace(hurry = bounty_base_speed())
drop_shiv()
set_mood(PRISONER_RECAPTURED_MOOD)
swap_basic_ai_controller(src, /datum/ai_controller/basic_controller/outpost_prisoner)
prison?.refresh_prisoner_reach(src)
- update_melee()
update_bubble()
say_context("recaptured")
@@ -1413,7 +1403,7 @@
* Out of time: gone for good, walls or no walls. No bonus; the treasury is fined
* OUTPOST_PRISON_ESCAPE_FINE as part of the incident, and the corrections service counts them lost.
*/
-/datum/outpost_prison/proc/escaped_for_good(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/escaped_for_good(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
close_bounty_record(prisoner, BOUNTY_RECORD_ESCAPED)
var/fine = charge_fine(OUTPOST_PRISON_ESCAPE_FINE, "Prison escape fine: [prisoner.real_name]", TRUE)
note_prisoner_lost(prisoner, "escaped")
@@ -1434,14 +1424,14 @@
* rioting or not, and treats a loose prisoner outside the wing as fair game until they are down, so
* a runner is stopped rather than killed. Turrets players build follow outpost_prison_security.dm.
*/
-/mob/living/basic/outpost_prisoner/proc/turret_target()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/turret_target()
if(stat == DEAD || trouble != PRISONER_TROUBLE_LOOSE || phase != PRISONER_PRESENT || can_be_dragged())
return FALSE
return !prison || get_area(src) != prison.wing
/proc/is_loose_outpost_prisoner(mob/living/creature)
- var/mob/living/basic/outpost_prisoner/prisoner = creature
- return istype(prisoner) && prisoner.turret_target()
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = creature
+ return istype(prisoner) && !prisoner.experiment_turned && prisoner.turret_target()
// ===== SERVING HATCH =====
diff --git a/voidcrew/modules/player_outposts/outpost_prison_routine.dm b/voidcrew/modules/player_outposts/outpost_prison_routine.dm
index 0732c7fa3e9..086d0a15b13 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_routine.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_routine.dm
@@ -38,11 +38,11 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
// ===== PRISONER SIDE =====
/// Whether their routine may run now: not while down, cuffed, pulled, in trouble or held by the talk menu (outpost_prison_warden_tools.dm)
-/mob/living/basic/outpost_prisoner/proc/routine_allowed()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/routine_allowed()
return prison && stat == CONSCIOUS && phase == PRISONER_PRESENT && !can_be_dragged() && !pulledby && !in_trouble() && !held_by_talk_menu()
/// Ends what they are doing, putting things down and getting up
-/mob/living/basic/outpost_prisoner/proc/end_activity(cancel_ai = TRUE)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/end_activity(cancel_ai = TRUE)
if(!activity)
return
var/datum/prisoner_activity/old = activity
@@ -55,13 +55,13 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
ai_controller?.CancelActions()
/// Starts `new_activity` in place of whatever they were doing
-/mob/living/basic/outpost_prisoner/proc/start_activity(datum/prisoner_activity/new_activity)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/start_activity(datum/prisoner_activity/new_activity)
end_activity()
activity = new_activity
return new_activity
/// A walk failed: try once more, then give up on it for a while
-/mob/living/basic/outpost_prisoner/proc/activity_move_failed()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/activity_move_failed()
if(!activity)
return
if(++activity.failed_moves < 2)
@@ -70,14 +70,14 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
end_activity(cancel_ai = FALSE)
/// Whether they gave up on this kind of activity recently
-/mob/living/basic/outpost_prisoner/proc/activity_on_cooldown(activity_type)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/activity_on_cooldown(activity_type)
return LAZYACCESS(activity_cooldowns, activity_type) > world.time
/**
* Picks their next activity: duties and needs first (heading home at release, eating, changing,
* calling for the hatch), then leisure by weight. Returns the activity, already set up.
*/
-/mob/living/basic/outpost_prisoner/proc/choose_activity()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/choose_activity()
if(!prison)
return null
if(!walkable)
@@ -131,7 +131,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
return null
/// The nearest free tile beside `target` they can stand on, or its own tile when walkable
-/mob/living/basic/outpost_prisoner/proc/approach_turf(atom/target)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/approach_turf(atom/target)
var/turf/target_turf = get_turf(target)
if(!target_turf || !walkable)
return null
@@ -150,19 +150,19 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
return best
/// Somewhere to hang about: the yard, or their own cell, not someone else's
-/mob/living/basic/outpost_prisoner/proc/may_loiter(turf/tile)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/may_loiter(turf/tile)
var/datum/outpost_prison_cell/holder = prison?.cell_at(tile)
return !holder || holder == cell || holder == prison.cell_at(get_turf(src))
/// Whether someone else stands on this tile
-/mob/living/basic/outpost_prisoner/proc/tile_taken(turf/tile)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/tile_taken(turf/tile)
for(var/mob/living/other in tile)
if(other != src && other.density)
return TRUE
return FALSE
/// Their bed if they can get to it, else any free bed they can
-/mob/living/basic/outpost_prisoner/proc/find_bed()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/find_bed()
var/obj/structure/bed/own = cell?.bed()
if(own && walkable?[get_turf(own)] && !prison.claimed_by_other(own, src))
return own
@@ -172,7 +172,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
return null
/// A fixture of `category` they can walk up to and nobody else is using, own cell's first, never in another's cell
-/mob/living/basic/outpost_prisoner/proc/find_fixture(category, stand_on = FALSE)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/find_fixture(category, stand_on = FALSE)
var/list/options = list()
for(var/atom/fixture as anything in prison.fixtures_of(category))
if(QDELETED(fixture) || prison.claimed_by_other(fixture, src))
@@ -189,7 +189,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
return pick(options)
/// Whether `person` is a member of the wing awake in the cell block, close by, holding dressings
-/mob/living/basic/outpost_prisoner/proc/is_medic(mob/living/person)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/is_medic(mob/living/person)
if(!istype(person) || QDELETED(person) || person.stat != CONSCIOUS || is_outpost_prisoner(person))
return FALSE
if(get_dist(src, person) > PRISONER_SICK_CALL_RANGE || !prison?.in_cell_block(person) || !prison.is_member(person))
@@ -197,7 +197,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
return !!person.is_holding_item_of_type(/obj/item/stack/medical)
/// The nearest medic they can see and walk up to
-/mob/living/basic/outpost_prisoner/proc/find_medic()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/find_medic()
var/mob/living/best
var/best_distance = INFINITY
for(var/mob/living/person in view(PRISONER_SICK_CALL_RANGE, src))
@@ -213,13 +213,13 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
* Hurt, with a medic in sight: drops whatever idle thing they were doing and goes over. Called
* every few seconds by the prison while anyone is on the level. Returns TRUE if they went.
*/
-/mob/living/basic/outpost_prisoner/proc/check_sick_call()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/check_sick_call()
if(!ai_running())
return FALSE
return start_sick_call()
/// Starts a sick call if they are hurt, free and someone holding dressings is near. Returns TRUE if it started.
-/mob/living/basic/outpost_prisoner/proc/start_sick_call()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/start_sick_call()
if(!routine_allowed() || health_factor() >= PRISONER_INJURED_BELOW || !COOLDOWN_FINISHED(src, sick_call_cooldown))
return FALSE
// A need, a duty or sleep comes first; anything idle can wait.
@@ -236,7 +236,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
* A ball thrown at them: caught by anyone in a game, and by an idle prisoner when staff throw it,
* who then starts shooting hoops. Returns TRUE if they caught it.
*/
-/mob/living/basic/outpost_prisoner/proc/try_catch_ball(atom/movable/thrown_thing, datum/thrownthing/throwing)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/try_catch_ball(atom/movable/thrown_thing, datum/thrownthing/throwing)
var/obj/item/toy/basketball/ball = thrown_thing
if(!istype(ball) || held_item || !routine_allowed() || activity?.sleeping)
return FALSE
@@ -257,7 +257,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
qdel(game)
return TRUE
-/mob/living/basic/outpost_prisoner/hitby(atom/movable/AM, skipcatch, hitpush = TRUE, blocked = FALSE, datum/thrownthing/throwingdatum)
+/mob/living/carbon/human/npc/outpost_prisoner/hitby(atom/movable/AM, skipcatch, hitpush = TRUE, blocked = FALSE, datum/thrownthing/throwingdatum)
if(try_catch_ball(AM, throwingdatum))
return TRUE
return ..()
@@ -284,7 +284,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
/datum/ai_planning_subtree/outpost_prisoner_routine
/datum/ai_planning_subtree/outpost_prisoner_routine/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
- var/mob/living/basic/outpost_prisoner/prisoner = controller.pawn
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = controller.pawn
if(!istype(prisoner) || !prisoner.routine_allowed())
return
var/datum/prisoner_activity/activity = prisoner.activity || prisoner.choose_activity()
@@ -310,7 +310,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
action_cooldown = 0.5 SECONDS
/datum/ai_behavior/outpost_prisoner_travel/setup(datum/ai_controller/controller)
- var/mob/living/basic/outpost_prisoner/prisoner = controller.pawn
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = controller.pawn
var/turf/spot = prisoner.activity?.spot
if(!spot)
return FALSE
@@ -319,7 +319,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
return TRUE
/datum/ai_behavior/outpost_prisoner_travel/perform(seconds_per_tick, datum/ai_controller/controller)
- var/mob/living/basic/outpost_prisoner/prisoner = controller.pawn
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = controller.pawn
var/datum/prisoner_activity/activity = prisoner.activity
if(!activity || prisoner.loc != activity.spot)
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED
@@ -330,7 +330,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
/datum/ai_behavior/outpost_prisoner_travel/finish_action(datum/ai_controller/controller, succeeded)
. = ..()
if(!succeeded)
- var/mob/living/basic/outpost_prisoner/prisoner = controller.pawn
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = controller.pawn
prisoner?.activity_move_failed()
/// Ticks the activity about once a second until it wants to move or is done
@@ -338,11 +338,11 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
action_cooldown = 1 SECONDS
/datum/ai_behavior/outpost_prisoner_activity/setup(datum/ai_controller/controller)
- var/mob/living/basic/outpost_prisoner/prisoner = controller.pawn
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = controller.pawn
return !!prisoner.activity
/datum/ai_behavior/outpost_prisoner_activity/perform(seconds_per_tick, datum/ai_controller/controller)
- var/mob/living/basic/outpost_prisoner/prisoner = controller.pawn
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = controller.pawn
var/datum/prisoner_activity/activity = prisoner.activity
if(!activity || !prisoner.routine_allowed())
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED
@@ -381,7 +381,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
var/mood_activity = FALSE
/// Asleep: no chatting, only sleep talk
var/sleeping = FALSE
- var/mob/living/basic/outpost_prisoner/prisoner
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner
/// Where they are headed; null once there
var/turf/spot
/// When it ends, once started
@@ -392,7 +392,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
/// REF() keys of what this activity has claimed in the prison
var/list/claimed
-/datum/prisoner_activity/New(mob/living/basic/outpost_prisoner/doer)
+/datum/prisoner_activity/New(mob/living/carbon/human/npc/outpost_prisoner/doer)
. = ..()
prisoner = doer
@@ -1062,13 +1062,13 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
/datum/prisoner_activity/chat/setup()
var/list/options = list()
- for(var/mob/living/basic/outpost_prisoner/other as anything in prisoner.prison.prisoners)
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/other as anything in prisoner.prison.prisoners)
if(other == prisoner || !can_join(other))
continue
options += other
while(length(options))
// Friends first (outpost_prison_life.dm); the pick comes out of options either way.
- var/mob/living/basic/outpost_prisoner/other = prisoner.prison.take_chat_partner(prisoner, options)
+ var/mob/living/carbon/human/npc/outpost_prisoner/other = prisoner.prison.take_chat_partner(prisoner, options)
var/turf/beside = prisoner.approach_turf(other)
if(!beside)
continue
@@ -1078,7 +1078,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
return FALSE
/// Whether `other` is free to talk
-/datum/prisoner_activity/chat/proc/can_join(mob/living/basic/outpost_prisoner/other)
+/datum/prisoner_activity/chat/proc/can_join(mob/living/carbon/human/npc/outpost_prisoner/other)
if(QDELETED(other) || !other.routine_allowed() || other.activity?.sleeping)
return FALSE
if(other.activity && (!other.activity.interruptible || istype(other.activity, /datum/prisoner_activity/chat)))
@@ -1086,7 +1086,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
return TRUE
/datum/prisoner_activity/chat/arrive()
- var/mob/living/basic/outpost_prisoner/partner = partner_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/partner = partner_ref?.resolve()
if(!partner || get_dist(prisoner, partner) > 1 || !can_join(partner))
return FALSE
. = ..()
@@ -1096,7 +1096,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
next_exchange = world.time + 1 SECONDS
/datum/prisoner_activity/chat/tick(seconds)
- var/mob/living/basic/outpost_prisoner/partner = partner_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/partner = partner_ref?.resolve()
if(!partner || get_dist(prisoner, partner) > 1 || partner.activity?.chat_partner() != prisoner)
return ACTIVITY_DONE
prisoner.face_atom(partner)
@@ -1107,7 +1107,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
return ..()
/datum/prisoner_activity/chat/finish()
- var/mob/living/basic/outpost_prisoner/partner = partner_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/partner = partner_ref?.resolve()
if(partner && istype(partner.activity, /datum/prisoner_activity/chat/listen) && partner.activity.chat_partner() == prisoner)
partner.end_activity()
if(started && partner)
@@ -1119,7 +1119,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
leisure = FALSE
weight = 0
-/datum/prisoner_activity/chat/listen/New(mob/living/basic/outpost_prisoner/doer, mob/living/basic/outpost_prisoner/talker)
+/datum/prisoner_activity/chat/listen/New(mob/living/carbon/human/npc/outpost_prisoner/doer, mob/living/carbon/human/npc/outpost_prisoner/talker)
. = ..(doer)
partner_ref = WEAKREF(talker)
started = TRUE
@@ -1133,7 +1133,7 @@ GLOBAL_LIST_INIT(outpost_prisoner_leisure, outpost_prisoner_leisure_types())
return TRUE
/datum/prisoner_activity/chat/listen/tick(seconds)
- var/mob/living/basic/outpost_prisoner/talker = partner_ref?.resolve()
+ var/mob/living/carbon/human/npc/outpost_prisoner/talker = partner_ref?.resolve()
if(!talker || get_dist(prisoner, talker) > 1 || talker.activity?.chat_partner() != prisoner)
return ACTIVITY_DONE
prisoner.face_atom(talker)
diff --git a/voidcrew/modules/player_outposts/outpost_prison_security.dm b/voidcrew/modules/player_outposts/outpost_prison_security.dm
index 636154072b0..f8f5351b6e9 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_security.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_security.dm
@@ -15,9 +15,9 @@
* A shot at a prisoner is always a stun shot: the turret's own if its gun has a stamina or
* electrode setting that goes through glass, else a disabler beam, whatever the mode. Before the first shot at a prisoner
* it has not warned lately, the turret warns them and holds fire for a moment, and the prisoner
- * decides what to do about it (react_to_turret()). Its shots pass through anyone the rule spares,
- * and a lethal shot passes through every prisoner. Rioters go for turrets they can reach before
- * any fixture (priority_smash_target()).
+ * decides what to do about it (react_to_turret()). The rule is the turret's choice of target: a shot
+ * that goes wide lands on whoever is in the way, as anyone's would. Rioters go for turrets they can
+ * reach before any fixture (priority_smash_target()).
*
* On a player outpost a turret's controls, and a turret control panel's, answer only to the
* outpost's members, as a hull turret's do there (ship_defense_turret.dm).
@@ -39,10 +39,13 @@
/proc/outpost_prison_turret_verdict(mob/living/target, obj/machinery/porta_turret/turret)
if(!isliving(target))
return OUTPOST_PRISON_TURRET_NOT_MINE
+ // A body the serum took is the creature now, whoever it was (outpost_prison_experiment_forms.dm)
+ if(is_outpost_experiment_creature(target))
+ return (target.stat != DEAD && is_hostile_creature(target)) ? OUTPOST_PRISON_TURRET_SHOOT : OUTPOST_PRISON_TURRET_SPARE
if(is_outpost_prisoner(target))
- var/mob/living/basic/outpost_prisoner/prisoner = target
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = target
return prisoner.turret_verdict(turret)
- if(is_outpost_prison_guard(target) || istype(target, /mob/living/basic/outpost_kessler_staff))
+ if(is_outpost_prison_guard(target) || istype(target, /mob/living/carbon/human/npc/outpost_kessler_staff))
return OUTPOST_PRISON_TURRET_SPARE
// The experiments' creatures (outpost_prison_creatures.dm, outpost_prison_changeling.dm): until dead, subdued or in Kessler's hands
if(is_outpost_prison_mob(target) || is_outpost_experiment_mob(target))
@@ -58,7 +61,7 @@
var/obj/projectile/shot = projectile_type
return initial(shot.damage_type) == STAMINA && initial(shot.damage) > 0
-/mob/living/basic/outpost_prisoner
+/mob/living/carbon/human/npc/outpost_prisoner
/// What they did about a turret's warning while rioting (OUTPOST_PRISON_TURRET_GIVE_UP, _BACK_OFF or _DEFY), the turret, and when that runs out
var/turret_reaction
var/datum/weakref/turret_reaction_ref
@@ -68,7 +71,7 @@
var/turret_retreat_until = 0
/// A turret's verdict on them; see outpost_prison_turret_verdict()
-/mob/living/basic/outpost_prisoner/proc/turret_verdict(obj/machinery/porta_turret/turret)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/turret_verdict(obj/machinery/porta_turret/turret)
if(stat != CONSCIOUS || phase != PRISONER_PRESENT || can_be_dragged() || is_confined())
return OUTPOST_PRISON_TURRET_SPARE
if(surrendered_to_turret() || backing_off_from_turret() || !turret_trouble())
@@ -76,21 +79,21 @@
return OUTPOST_PRISON_TURRET_SHOOT
/// The trouble a turret answers: rioting or breaking out, loose, swinging at staff, climbing a hatch, or fighting past the argument. Threats, arguments and wrecking a cell are not.
-/mob/living/basic/outpost_prisoner/proc/turret_trouble()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/turret_trouble()
if(is_rioting() || trouble == PRISONER_TROUBLE_LOOSE || climb_ref || swing_ref?.resolve())
return TRUE
return trouble == PRISONER_TROUBLE_FIGHT && fight?.fighting
/// A rioter who gave up at a turret's warning: in the riot until staff bolt them in, but doing nothing
-/mob/living/basic/outpost_prisoner/proc/surrendered_to_turret()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/surrendered_to_turret()
return turret_reaction == OUTPOST_PRISON_TURRET_GIVE_UP && is_rioting()
/// Walking away after backing off from a turret's warning
-/mob/living/basic/outpost_prisoner/proc/backing_off_from_turret()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/backing_off_from_turret()
return world.time < turret_retreat_until
/// Forgets what a turret's warning made them do: a riot starting or ending clears it
-/mob/living/basic/outpost_prisoner/proc/clear_turret_reaction()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/clear_turret_reaction()
turret_reaction = null
turret_reaction_ref = null
turret_reaction_until = 0
@@ -156,7 +159,7 @@
update_appearance()
/// Whether it may fire at `prisoner` now. The first time in a while it warns them instead, and holds fire for OUTPOST_PRISON_TURRET_WARN_TIME.
-/obj/machinery/porta_turret/proc/prison_may_fire_at(mob/living/basic/outpost_prisoner/prisoner)
+/obj/machinery/porta_turret/proc/prison_may_fire_at(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(outpost_prison_turret_verdict(prisoner, src) != OUTPOST_PRISON_TURRET_SHOOT)
return FALSE
var/warned = LAZYACCESS(prison_warned_at, REF(prisoner))
@@ -169,7 +172,7 @@
return !(prisoner.is_rioting() && prisoner.prison?.riot_windup_left > 0)
/// The warning: a red line on them, a triple beep and "Step away.", and they decide what to do about it. Returns what they did.
-/obj/machinery/porta_turret/proc/warn_prisoner(mob/living/basic/outpost_prisoner/prisoner)
+/obj/machinery/porta_turret/proc/warn_prisoner(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
for(var/key in prison_warned_at?.Copy())
if(world.time - prison_warned_at[key] >= OUTPOST_PRISON_TURRET_REWARN_TIME)
LAZYREMOVE(prison_warned_at, key)
@@ -180,24 +183,6 @@
say("Step away.")
return prisoner.react_to_turret(src)
-/// A turret following the prison's rules lands no shot on anyone the rule spares, and no lethal one on a prisoner
-/obj/projectile/can_hit_target(atom/target, direct_target = FALSE, ignore_loc = FALSE, cross_failed = FALSE)
- if(isliving(target) && istype(firer, /obj/machinery/porta_turret) && !outpost_prison_turret_shot_lands(src, target))
- return FALSE
- return ..()
-
-/// Whether `shot`, fired by a turret, may land on `target`
-/proc/outpost_prison_turret_shot_lands(obj/projectile/shot, mob/living/target)
- var/obj/machinery/porta_turret/turret = shot.firer
- if(!turret.uses_outpost_turret_rules())
- return TRUE
- switch(outpost_prison_turret_verdict(target, turret))
- if(OUTPOST_PRISON_TURRET_NOT_MINE)
- return TRUE
- if(OUTPOST_PRISON_TURRET_SPARE)
- return FALSE
- return !is_outpost_prisoner(target) || outpost_prison_stun_projectile(shot.type)
-
// ===== THE WARNING, FROM THE PRISONER'S SIDE =====
/// Percent chance someone swinging at staff or fighting backs off at a turret's warning: likelier the better their mood, never certain either way
@@ -235,7 +220,7 @@
* off (riot on out of the turret's sight), or defy it (go for the turret).
* Loose prisoners run on the outpost patrol AI and take no notice. Returns what they did, or null.
*/
-/mob/living/basic/outpost_prisoner/proc/react_to_turret(obj/machinery/porta_turret/turret)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/react_to_turret(obj/machinery/porta_turret/turret)
if(QDELETED(turret) || stat != CONSCIOUS || phase != PRISONER_PRESENT || can_be_dragged())
return null
var/reaction
@@ -269,24 +254,24 @@
return reaction
/// Backing off with `chance` percent, else defying. The prison's forced_turret_reaction settles it instead, for tests.
-/mob/living/basic/outpost_prisoner/proc/turret_roll(chance)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/turret_roll(chance)
var/forced = prison?.forced_turret_reaction
if(forced)
return forced == OUTPOST_PRISON_TURRET_DEFY ? OUTPOST_PRISON_TURRET_DEFY : OUTPOST_PRISON_TURRET_BACK_OFF
return prob(chance) ? OUTPOST_PRISON_TURRET_BACK_OFF : OUTPOST_PRISON_TURRET_DEFY
-/mob/living/basic/outpost_prisoner/proc/set_turret_reaction(reaction, obj/machinery/porta_turret/turret, duration)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/set_turret_reaction(reaction, obj/machinery/porta_turret/turret, duration)
turret_reaction = reaction
turret_reaction_ref = WEAKREF(turret)
turret_reaction_until = world.time + duration
/// Heads for `spot`, if there is one; no turret shoots them for `duration` meanwhile
-/mob/living/basic/outpost_prisoner/proc/start_turret_retreat(turf/spot, duration)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/start_turret_retreat(turf/spot, duration)
turret_retreat_spot = spot
turret_retreat_until = world.time + duration
/// Swinging or fighting, and backing off: they drop it, step away from the turret and whoever they were going for, and don't square up again for the threat cooldown
-/mob/living/basic/outpost_prisoner/proc/turret_stand_down(obj/machinery/porta_turret/turret)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/turret_stand_down(obj/machinery/porta_turret/turret)
var/mob/living/other = swing_ref?.resolve() || fight?.opponent_of(src)
cancel_threat()
threat_cooldown = max(threat_cooldown, PRISONER_THREAT_COOLDOWN)
@@ -297,7 +282,7 @@
start_turret_retreat(pick_turret_retreat(turret, FALSE, other), OUTPOST_PRISON_TURRET_RETREAT_TIME)
/// A rioter who gives up: the shiv goes down and they walk back to their own cell. Bolted in, they are out of the riot, owing lockdown (outpost_prison_capture.dm).
-/mob/living/basic/outpost_prisoner/proc/turret_give_up(obj/machinery/porta_turret/turret)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/turret_give_up(obj/machinery/porta_turret/turret)
set_turret_reaction(OUTPOST_PRISON_TURRET_GIVE_UP, turret, 0)
cancel_threat()
drop_shiv()
@@ -310,7 +295,7 @@
prison?.add_log("[real_name] gave up rioting at a turret's warning.")
/// A rioter who backs off: still rioting, but out of the turret's sight, and leaving alone what it can see for a while
-/mob/living/basic/outpost_prisoner/proc/turret_back_off_riot(obj/machinery/porta_turret/turret)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/turret_back_off_riot(obj/machinery/porta_turret/turret)
set_turret_reaction(OUTPOST_PRISON_TURRET_BACK_OFF, turret, OUTPOST_PRISON_TURRET_AVOID_TIME)
// The turret too: under its cover it does not show up in its own view
LAZYSET(riot_skips, REF(turret), turret_reaction_until)
@@ -324,13 +309,13 @@
start_turret_retreat(pick_turret_retreat(turret, TRUE), OUTPOST_PRISON_TURRET_RETREAT_TIME)
/// A rioter who defies it: they go for the turret before anything else (riot_target()), and get shot on the way
-/mob/living/basic/outpost_prisoner/proc/turret_defy(obj/machinery/porta_turret/turret)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/turret_defy(obj/machinery/porta_turret/turret)
set_turret_reaction(OUTPOST_PRISON_TURRET_DEFY, turret, OUTPOST_PRISON_TURRET_DEFY_TIME)
LAZYREMOVE(riot_skips, REF(turret))
ai_controller?.CancelActions()
/// The turret a rioter defied, while they still mean to smash it and can get at it
-/mob/living/basic/outpost_prisoner/proc/defied_turret()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/defied_turret()
if(turret_reaction != OUTPOST_PRISON_TURRET_DEFY || world.time >= turret_reaction_until || !is_rioting())
return null
var/obj/machinery/porta_turret/turret = turret_reaction_ref?.resolve()
@@ -339,7 +324,7 @@
return turret
/// Where a rioter who gave up waits: their cell's chair or bed (home_seat()), or any free tile of their own cell they can walk to
-/mob/living/basic/outpost_prisoner/proc/own_cell_spot()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/own_cell_spot()
if(!cell)
return null
var/obj/structure/seat = home_seat()
@@ -355,7 +340,7 @@
* can walk to that it cannot see, or failing that the one farthest from it; anyone else a tile or
* two away, as far as they can get from it and from `other`. Null if nowhere will do.
*/
-/mob/living/basic/outpost_prisoner/proc/pick_turret_retreat(obj/machinery/porta_turret/turret, out_of_sight = FALSE, mob/living/other)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/pick_turret_retreat(obj/machinery/porta_turret/turret, out_of_sight = FALSE, mob/living/other)
if(!length(walkable))
return null
var/turf/here = get_turf(src)
@@ -387,7 +372,7 @@
* way. At the spot, or out of time, they stop; one who gave up and got to their cell's chair or
* bed sits down (sit_in_cell()).
*/
-/mob/living/basic/outpost_prisoner/proc/plan_turret_retreat(datum/ai_controller/controller)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/plan_turret_retreat(datum/ai_controller/controller)
if(!turret_retreat_spot)
return FALSE
if(loc == turret_retreat_spot || world.time >= turret_retreat_until)
@@ -398,7 +383,7 @@
controller.queue_behavior(/datum/ai_behavior/outpost_prisoner_turret_retreat)
return TRUE
-/mob/living/basic/outpost_prisoner/proc/finish_turret_retreat()
+/mob/living/carbon/human/npc/outpost_prisoner/proc/finish_turret_retreat()
var/turf/spot = turret_retreat_spot
turret_retreat_spot = null
if(!surrendered_to_turret() || loc != spot || !cell?.contains(src) || !((locate(/obj/structure/chair) in loc) || (locate(/obj/structure/bed) in loc)))
@@ -413,7 +398,7 @@
action_cooldown = 0.5 SECONDS
/datum/ai_behavior/outpost_prisoner_turret_retreat/setup(datum/ai_controller/controller)
- var/mob/living/basic/outpost_prisoner/prisoner = controller.pawn
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = controller.pawn
var/turf/spot = prisoner?.turret_retreat_spot
if(!spot)
return FALSE
@@ -422,7 +407,7 @@
return TRUE
/datum/ai_behavior/outpost_prisoner_turret_retreat/perform(seconds_per_tick, datum/ai_controller/controller)
- var/mob/living/basic/outpost_prisoner/prisoner = controller.pawn
+ var/mob/living/carbon/human/npc/outpost_prisoner/prisoner = controller.pawn
if(!prisoner?.turret_retreat_spot || prisoner.loc != prisoner.turret_retreat_spot)
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED
prisoner.finish_turret_retreat()
@@ -442,7 +427,7 @@
* rules that they can reach and have not given up on, or null. A rioter newly going for one may
* shout about it.
*/
-/datum/outpost_prison/proc/priority_smash_target(mob/living/basic/outpost_prisoner/rioter)
+/datum/outpost_prison/proc/priority_smash_target(mob/living/carbon/human/npc/outpost_prisoner/rioter)
if(!rioter?.reachable)
return null
var/obj/machinery/porta_turret/nearest
@@ -457,21 +442,21 @@
nearest_distance = distance
if(nearest && rioter.riot_target_ref?.resolve() != nearest && COOLDOWN_FINISHED(src, turret_smash_line_cooldown))
COOLDOWN_START(src, turret_smash_line_cooldown, OUTPOST_PRISON_TURRET_SMASH_LINE_GAP)
- INVOKE_ASYNC(rioter, TYPE_PROC_REF(/mob/living/basic/outpost_prisoner, say_context), "turret_smash")
+ INVOKE_ASYNC(rioter, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prisoner, say_context), "turret_smash")
return nearest
/// A turret's shot is about to land on `target`: now and then someone watching says something
-/datum/outpost_prison/proc/note_turret_hit(mob/living/basic/outpost_prisoner/target)
+/datum/outpost_prison/proc/note_turret_hit(mob/living/carbon/human/npc/outpost_prisoner/target)
if(!COOLDOWN_FINISHED(src, turret_hit_line_cooldown) || !prob(OUTPOST_PRISON_TURRET_HIT_LINE_CHANCE))
return FALSE
- for(var/mob/living/basic/outpost_prisoner/onlooker in shuffle(prisoners))
+ for(var/mob/living/carbon/human/npc/outpost_prisoner/onlooker in shuffle(prisoners))
if(onlooker == target || onlooker.stat != CONSCIOUS || onlooker.phase != PRISONER_PRESENT || !onlooker.ai_running() || onlooker.in_trouble())
continue
if(get_dist(onlooker, target) > 7 || !(target in view(7, onlooker)))
continue
COOLDOWN_START(src, turret_hit_line_cooldown, OUTPOST_PRISON_TURRET_HIT_LINE_GAP)
onlooker.face_atom(target)
- INVOKE_ASYNC(onlooker, TYPE_PROC_REF(/mob/living/basic/outpost_prisoner, say_context), "turret_hit")
+ INVOKE_ASYNC(onlooker, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prisoner, say_context), "turret_hit")
return TRUE
return FALSE
diff --git a/voidcrew/modules/player_outposts/outpost_prison_serum.dm b/voidcrew/modules/player_outposts/outpost_prison_serum.dm
index eef2c4310ee..af179458ffa 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_serum.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_serum.dm
@@ -55,7 +55,7 @@
/obj/item/outpost_experiment/serum/interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers)
if(!isliving(interacting_with))
return NONE
- var/mob/living/basic/outpost_prisoner/subject = interacting_with
+ var/mob/living/carbon/human/npc/outpost_prisoner/subject = interacting_with
var/error = dose_error(user, subject)
if(error)
balloon_alert(user, error)
@@ -79,7 +79,7 @@
return ITEM_INTERACT_SUCCESS
/// Why the serum cannot go into `subject` now, or null
-/obj/item/outpost_experiment/serum/proc/dose_error(mob/living/user, mob/living/basic/outpost_prisoner/subject)
+/obj/item/outpost_experiment/serum/proc/dose_error(mob/living/user, mob/living/carbon/human/npc/outpost_prisoner/subject)
var/error = user_error(user)
if(error)
return error
@@ -207,7 +207,7 @@
*/
/datum/component/outpost_experiment_item/proc/eaten_by(mob/living/eater)
var/datum/outpost_prison/prison = prison()
- var/mob/living/basic/outpost_prisoner/host = eater
+ var/mob/living/carbon/human/npc/outpost_prisoner/host = eater
if(istype(host) && prison && host.prison == prison && prison.start_experiment("changeling", host))
log_game("PLAYER OUTPOST PRISON: [host.real_name] ate food with a Kessler specimen in it at '[prison.outpost?.name]'")
qdel(src)
@@ -250,7 +250,7 @@
qdel(parent)
/// A prisoner eats: food with the specimen in it takes them as its host
-/mob/living/basic/outpost_prisoner/eat_food(obj/item/food/meal)
+/mob/living/carbon/human/npc/outpost_prisoner/eat_food(obj/item/food/meal)
var/datum/component/outpost_experiment_item/specimen = meal?.GetComponent(/datum/component/outpost_experiment_item)
. = ..()
if(specimen && !QDELETED(specimen))
diff --git a/voidcrew/modules/player_outposts/outpost_prison_social.dm b/voidcrew/modules/player_outposts/outpost_prison_social.dm
index a22d32f11dd..00aa58585de 100644
--- a/voidcrew/modules/player_outposts/outpost_prison_social.dm
+++ b/voidcrew/modules/player_outposts/outpost_prison_social.dm
@@ -103,7 +103,7 @@
var/rep_greet_chance = PRISON_REP_GREET_CHANCE
var/rep_word_chance = PRISON_REP_WORD_CHANCE
-/mob/living/basic/outpost_prisoner
+/mob/living/carbon/human/npc/outpost_prisoner
/// Record key -> world.time they last greeted that person
var/list/rep_greeted
/// Record keys already thanked for bringing them mail this stay
@@ -200,7 +200,7 @@
// note_staff_care() and note_staff_hit() run inside signal handlers: nothing here may sleep.
/// `person` fed, clothed or treated `prisoner` by hand: once per prisoner per PRISON_REP_CARE_GAP
-/datum/outpost_prison/proc/note_staff_care(mob/person, mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/note_staff_care(mob/person, mob/living/carbon/human/npc/outpost_prisoner/prisoner)
if(!prisoner || !ismob(person))
return FALSE
// note_carer() runs as a dressing is offered, so a dressing held to someone unhurt is not care.
@@ -229,7 +229,7 @@
return TRUE
/// `person` talked `prisoner` down
-/datum/outpost_prison/proc/note_staff_talk(mob/person, mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/note_staff_talk(mob/person, mob/living/carbon/human/npc/outpost_prisoner/prisoner)
return rep_adjust(person, PRISON_REP_TALK)
/// `person` sank a shot while prisoners played
@@ -243,7 +243,7 @@
return rep_adjust(person, min(amount, PRISON_REP_KINDNESS_MAX))
/// An unprovoked hit on `prisoner` that cost them mood (hit_by_staff() has already ruled out deserved ones)
-/datum/outpost_prison/proc/note_staff_hit(atom/attacker, mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/note_staff_hit(atom/attacker, mob/living/carbon/human/npc/outpost_prisoner/prisoner)
var/counted = FALSE
for(var/mob/person in rep_people_behind(attacker))
if(rep_adjust(person, PRISON_REP_HIT))
@@ -254,7 +254,7 @@
* Staff got the blame for `prisoner`: `event` is "beaten" (an unprovoked beating down, on top of
* the hits) or "killed" (the score goes to PRISON_REP_MIN). The blame goes to whoever last hit them.
*/
-/datum/outpost_prison/proc/note_staff_blamed(mob/living/basic/outpost_prisoner/prisoner, event)
+/datum/outpost_prison/proc/note_staff_blamed(mob/living/carbon/human/npc/outpost_prisoner/prisoner, event)
if(event != "beaten" && event != "killed")
return FALSE
var/atom/attacker = prisoner?.last_staff_attacker_ref?.resolve()
@@ -277,7 +277,7 @@
* prisoner per stay), "mail_opened", "search_found", "search_empty", "patdown_found",
* "patdown_empty". Events it does not know, and anyone who is not a member, are ignored.
*/
-/datum/outpost_prison/proc/note_staff_event(mob/person, mob/living/basic/outpost_prisoner/prisoner, event)
+/datum/outpost_prison/proc/note_staff_event(mob/person, mob/living/carbon/human/npc/outpost_prisoner/prisoner, event)
var/amount
switch(event)
if("mail_delivered")
@@ -307,7 +307,7 @@
// ===== WHAT IT DOES =====
/// Below this mood `prisoner` squares up to `person`: lower for a fair member, higher for a brute, and higher for some bounty prisoners (outpost_prison_bounty.dm)
-/datum/outpost_prison/proc/threat_mood_for(mob/living/basic/outpost_prisoner/prisoner, mob/person)
+/datum/outpost_prison/proc/threat_mood_for(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/person)
. = PRISONER_THREAT_MOOD
switch(staff_label(person))
if("fair")
@@ -317,29 +317,29 @@
. += prisoner ? prisoner.bounty_threat_bonus() : 0
/// The highest line threat_mood_for() can return (for `prisoner`, when given), so a prisoner above it looks for nobody
-/datum/outpost_prison/proc/threat_mood_ceiling(mob/living/basic/outpost_prisoner/prisoner)
+/datum/outpost_prison/proc/threat_mood_ceiling(mob/living/carbon/human/npc/outpost_prisoner/prisoner)
return max(PRISONER_THREAT_MOOD, PRISON_REP_THREAT_BRUTE) + (prisoner ? prisoner.bounty_threat_bonus() : 0)
/// The mood a talk-down from `person` gives `prisoner`
-/datum/outpost_prison/proc/talk_mood_for(mob/living/basic/outpost_prisoner/prisoner, mob/person)
+/datum/outpost_prison/proc/talk_mood_for(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/person)
return staff_label(person) == "fair" ? PRISON_REP_TALK_MOOD_FAIR : PRISONER_MOOD_TALK
/// Whether `prisoner` refuses to be talked down by `person`: a brute, below PRISON_REP_REFUSE_BRUTE_BELOW. It says so itself (async).
-/datum/outpost_prison/proc/refuses_talk_from(mob/living/basic/outpost_prisoner/prisoner, mob/person)
+/datum/outpost_prison/proc/refuses_talk_from(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/person)
if(!prisoner || prisoner.mood >= PRISON_REP_REFUSE_BRUTE_BELOW || staff_label(person) != "brute")
return FALSE
prisoner.balloon_alert(person, "not listening")
- INVOKE_ASYNC(prisoner, TYPE_PROC_REF(/mob/living/basic/outpost_prisoner, turn_away_brute), person)
+ INVOKE_ASYNC(prisoner, TYPE_PROC_REF(/mob/living/carbon/human/npc/outpost_prisoner, turn_away_brute), person)
return TRUE
/// Won't hear a word from a brute
-/mob/living/basic/outpost_prisoner/proc/turn_away_brute(mob/person)
+/mob/living/carbon/human/npc/outpost_prisoner/proc/turn_away_brute(mob/person)
if(!QDELETED(person))
face_atom(person)
say_to_staff("talk_refuse_brute", person)
/// How far `person` seems to a rioter picking whom to go for: a brute nearer, a fair member farther
-/datum/outpost_prison/proc/riot_victim_distance(mob/living/basic/outpost_prisoner/prisoner, mob/person, distance)
+/datum/outpost_prison/proc/riot_victim_distance(mob/living/carbon/human/npc/outpost_prisoner/prisoner, mob/person, distance)
switch(staff_label(person))
if("brute")
return distance - PRISON_REP_RIOT_BRUTE_NEARER
@@ -355,7 +355,7 @@
* PRISON_REP_GREET_RANGE tiles in view gets greet_