From 5ad27cb9af25faa4bdffeb70e0451f525aa730de Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Sun, 15 Nov 2026 15:44:22 -0800 Subject: [PATCH 01/29] Cyberware lines: cheaper chrome models, a street ripperdoc, new chrome and ability animations - Street and milspec models of Cascade, Redline, Ghostskin and Governor Delete, with the Shiv and Scorch Blades, the Widowline Arc and Brawler myomers. - Ratchet's Back Bay, a street ripperdoc at Quartermain Depot. Both ripperdocs buy back pulled street chrome and burnt-out NPC chrome. - New chrome: leg, hand, plating, lung, lining, reflex and ear pieces, the holdout revolver arm, and street passives. - Ghostskin and better hide the wearer from turrets, older mobs and human NPCs short of bosses. - Ability animations for Redline, Cascade, Ghostskin, the Lazarus node, leaps, EMP and brownouts, and the Chrome Cradle's rig. Worn chrome draws over the jumpsuit. - Reflex windows dodge blows and ranged fire by model and crit more often. - The Chrome Cradle fits a second arm housing of the same kind on the free arm. - Chrome stock in the loot themes and at Splice, gear ratings, the admin chrome test kit, and the wiki. - The cyberdeck's leftovers are removed from Machine Communion. --- tgstation.dme | 13 + .../voidcrew_tgui/interfaces/ChromeCradle.tsx | 50 +- tools/gear_catalog/ratings/ammo.json | 9 + tools/gear_catalog/ratings/cyberware.json | 397 ++++++- tools/gear_catalog/ratings/guns.json | 9 + tools/gear_catalog/ratings/melee.json | 35 +- tools/gear_catalog/ratings/organs.json | 42 +- tools/gear_catalog/ratings/tools.json | 45 +- voidcrew/_DEFINES/cyberware.dm | 116 +- .../outposts/trader_outpost_outfitter.dmm | 277 +++-- voidcrew/modules/admin/chrome_test_kit.dm | 256 +++++ .../modules/antag_ruins/ascension_mech.dm | 32 +- voidcrew/modules/cyberware/chrome_cradle.dm | 15 +- voidcrew/modules/cyberware/cyberware_anim.dm | 921 +++++++++++++++ voidcrew/modules/cyberware/cyberware_anim2.dm | 1023 +++++++++++++++++ voidcrew/modules/cyberware/cyberware_base.dm | 181 ++- .../modules/cyberware/cyberware_component.dm | 14 + .../modules/cyberware/cyberware_stealth.dm | 131 ++- .../cyberware/icons/chrome_cradle_rig.dmi | Bin 0 -> 8223 bytes .../modules/cyberware/icons/cyberware.dmi | Bin 35983 -> 63256 bytes .../cyberware/icons/cyberware_anim.dmi | Bin 0 -> 12313 bytes .../cyberware/icons/cyberware_anim2.dmi | Bin 0 -> 36105 bytes .../cyberware/icons/cyberware_anim2_large.dmi | Bin 0 -> 11560 bytes .../cyberware/icons/cyberware_anim_large.dmi | Bin 0 -> 61317 bytes .../icons/cyberware_anim_monowire.dmi | Bin 0 -> 7378 bytes .../cyberware/icons/cyberware_ground.dmi | Bin 0 -> 1601 bytes .../cyberware/icons/cyberware_lefthand.dmi | Bin 2000 -> 8431 bytes .../cyberware/icons/cyberware_righthand.dmi | Bin 1960 -> 8252 bytes .../cyberware/icons/cyberware_weapons.dmi | Bin 1672 -> 6188 bytes .../cyberware/icons/cyberware_worn.dmi | Bin 3700 -> 7161 bytes .../modules/cyberware/ripperdoc_catalog.dm | 232 +++- .../modules/cyberware/street_doc_catalog.dm | 268 +++++ .../modules/cyberware/ware_arm_utility.dm | 13 +- voidcrew/modules/cyberware/ware_legend.dm | 322 +++++- .../modules/cyberware/ware_line_berserk.dm | 91 ++ voidcrew/modules/cyberware/ware_line_camo.dm | 67 ++ .../modules/cyberware/ware_line_governor.dm | 75 ++ .../modules/cyberware/ware_line_mantis.dm | 196 ++++ .../modules/cyberware/ware_line_models_a.dm | 383 ++++++ voidcrew/modules/cyberware/ware_line_sandy.dm | 132 +++ .../modules/cyberware/ware_line_widowline.dm | 223 ++++ .../modules/cyberware/ware_military_arms.dm | 180 ++- .../modules/cyberware/ware_military_body.dm | 179 ++- voidcrew/modules/cyberware/ware_models_b.dm | 314 +++++ voidcrew/modules/cyberware/ware_pro_combat.dm | 192 +++- .../modules/cyberware/ware_pro_utility.dm | 78 +- .../modules/cyberware/ware_second_wind.dm | 30 +- voidcrew/modules/cyberware/ware_street.dm | 51 +- .../modules/cyberware/ware_street_passives.dm | 454 ++++++++ voidcrew/modules/lich/lich_thrall.dm | 2 + voidcrew/modules/loot/themes/armory.dm | 22 + voidcrew/modules/loot/themes/expedition.dm | 12 + voidcrew/modules/loot/themes/industrial.dm | 15 +- voidcrew/modules/loot/themes/medical.dm | 8 + voidcrew/modules/loot/themes/plunder.dm | 12 +- voidcrew/modules/loot/themes/research.dm | 4 + voidcrew/modules/loot/themes/syndicate.dm | 47 +- voidcrew/modules/loot/themes/wardrobe.dm | 1 + voidcrew/modules/trade/shop_buyback.dm | 43 +- voidcrew/modules/unit_tests/_unit_tests.dm | 9 + .../modules/unit_tests/voidcrew_cyberware.dm | 519 ++++++++- .../unit_tests/voidcrew_cyberware_anim.dm | 226 ++++ .../unit_tests/voidcrew_cyberware_anim2.dm | 361 ++++++ .../unit_tests/voidcrew_cyberware_kit.dm | 79 ++ .../unit_tests/voidcrew_cyberware_mantis.dm | 159 +++ .../unit_tests/voidcrew_cyberware_models_a.dm | 383 ++++++ .../unit_tests/voidcrew_cyberware_models_b.dm | 404 +++++++ .../unit_tests/voidcrew_cyberware_npcs.dm | 202 ++++ .../unit_tests/voidcrew_cyberware_passives.dm | 317 +++++ .../unit_tests/voidcrew_cyberware_text.dm | 20 + voidcrew/modules/unit_tests/voidcrew_loot.dm | 32 +- wiki/content/cyberware.md | 53 +- wiki/content/glossary.md | 2 +- wiki/content/trader-outposts.md | 5 +- 74 files changed, 9451 insertions(+), 532 deletions(-) create mode 100644 voidcrew/modules/admin/chrome_test_kit.dm create mode 100644 voidcrew/modules/cyberware/cyberware_anim.dm create mode 100644 voidcrew/modules/cyberware/cyberware_anim2.dm create mode 100644 voidcrew/modules/cyberware/icons/chrome_cradle_rig.dmi create mode 100644 voidcrew/modules/cyberware/icons/cyberware_anim.dmi create mode 100644 voidcrew/modules/cyberware/icons/cyberware_anim2.dmi create mode 100644 voidcrew/modules/cyberware/icons/cyberware_anim2_large.dmi create mode 100644 voidcrew/modules/cyberware/icons/cyberware_anim_large.dmi create mode 100644 voidcrew/modules/cyberware/icons/cyberware_anim_monowire.dmi create mode 100644 voidcrew/modules/cyberware/icons/cyberware_ground.dmi create mode 100644 voidcrew/modules/cyberware/street_doc_catalog.dm create mode 100644 voidcrew/modules/cyberware/ware_line_berserk.dm create mode 100644 voidcrew/modules/cyberware/ware_line_camo.dm create mode 100644 voidcrew/modules/cyberware/ware_line_governor.dm create mode 100644 voidcrew/modules/cyberware/ware_line_mantis.dm create mode 100644 voidcrew/modules/cyberware/ware_line_models_a.dm create mode 100644 voidcrew/modules/cyberware/ware_line_sandy.dm create mode 100644 voidcrew/modules/cyberware/ware_line_widowline.dm create mode 100644 voidcrew/modules/cyberware/ware_models_b.dm create mode 100644 voidcrew/modules/cyberware/ware_street_passives.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_cyberware_anim.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_cyberware_anim2.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_cyberware_kit.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_cyberware_mantis.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_cyberware_models_a.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_cyberware_models_b.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_cyberware_npcs.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_cyberware_passives.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_cyberware_text.dm diff --git a/tgstation.dme b/tgstation.dme index cbc40fdf982..40f23116804 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -7033,6 +7033,7 @@ #include "voidcrew\mapping\shuttles\syndicate\geneva.dm" #include "voidcrew\mapping\shuttles\syndicate\hyena.dm" #include "voidcrew\mapping\spawners\nanites.dm" +#include "voidcrew\modules\admin\chrome_test_kit.dm" #include "voidcrew\modules\admin\feature_testing.dm" #include "voidcrew\modules\admin\overmap_management.dm" #include "voidcrew\modules\admin\overmap_management_bans.dm" @@ -7175,6 +7176,8 @@ #include "voidcrew\modules\cryo\machine.dm" #include "voidcrew\modules\cyberware\chrome_cradle.dm" #include "voidcrew\modules\cyberware\cradle_ui.dm" +#include "voidcrew\modules\cyberware\cyberware_anim.dm" +#include "voidcrew\modules\cyberware\cyberware_anim2.dm" #include "voidcrew\modules\cyberware\cyberware_base.dm" #include "voidcrew\modules\cyberware\cyberware_component.dm" #include "voidcrew\modules\cyberware\cyberware_feedback.dm" @@ -7183,15 +7186,25 @@ #include "voidcrew\modules\cyberware\cyberware_stealth.dm" #include "voidcrew\modules\cyberware\parlor_fixtures.dm" #include "voidcrew\modules\cyberware\ripperdoc_catalog.dm" +#include "voidcrew\modules\cyberware\street_doc_catalog.dm" #include "voidcrew\modules\cyberware\ware_arm_utility.dm" #include "voidcrew\modules\cyberware\ware_legend.dm" +#include "voidcrew\modules\cyberware\ware_line_berserk.dm" +#include "voidcrew\modules\cyberware\ware_line_camo.dm" +#include "voidcrew\modules\cyberware\ware_line_governor.dm" +#include "voidcrew\modules\cyberware\ware_line_mantis.dm" +#include "voidcrew\modules\cyberware\ware_line_models_a.dm" +#include "voidcrew\modules\cyberware\ware_line_sandy.dm" +#include "voidcrew\modules\cyberware\ware_line_widowline.dm" #include "voidcrew\modules\cyberware\ware_military_arms.dm" #include "voidcrew\modules\cyberware\ware_military_body.dm" +#include "voidcrew\modules\cyberware\ware_models_b.dm" #include "voidcrew\modules\cyberware\ware_pro_combat.dm" #include "voidcrew\modules\cyberware\ware_pro_utility.dm" #include "voidcrew\modules\cyberware\ware_registry.dm" #include "voidcrew\modules\cyberware\ware_second_wind.dm" #include "voidcrew\modules\cyberware\ware_street.dm" +#include "voidcrew\modules\cyberware\ware_street_passives.dm" #include "voidcrew\modules\derelict_outposts\derelict_layout.dm" #include "voidcrew\modules\derelict_outposts\derelict_leash.dm" #include "voidcrew\modules\derelict_outposts\derelict_outpost.dm" diff --git a/tgui/packages/voidcrew_tgui/interfaces/ChromeCradle.tsx b/tgui/packages/voidcrew_tgui/interfaces/ChromeCradle.tsx index 57008cc670e..cf51c16a304 100644 --- a/tgui/packages/voidcrew_tgui/interfaces/ChromeCradle.tsx +++ b/tgui/packages/voidcrew_tgui/interfaces/ChromeCradle.tsx @@ -370,10 +370,7 @@ const Rack = () => { if (!has_occupant) { return ( -
- The rack is dark. Drag yourself onto the slab to lie back and it wakes - up. -
+
The rack is dark.
); } @@ -477,7 +474,7 @@ const TileCard = (props: { ware: Ware }) => {
- T{ware.tier} {TIER_NAMES[ware.tier] || 'CHROME'} + {TIER_NAMES[ware.tier] || 'CHROME'} load {ware.load} {ware.capacity_bonus > 0 && +{ware.capacity_bonus} cap} @@ -520,10 +517,7 @@ const Detail = () => { if (!ware) { return ( -
- Pick a piece from the rack. Anything you own shows up on the body before - the rig touches you. -
+
Nothing selected.
); } @@ -548,7 +542,7 @@ const Detail = () => {
- TIER {ware.tier} · {TIER_NAMES[ware.tier] || 'CHROME'} + {TIER_NAMES[ware.tier] || 'CHROME'} {ware.state === 'installed' @@ -603,7 +597,7 @@ const Detail = () => { )} {!!overCapacity && (
- No neural headroom. Shed load or find a Governor. + No neural headroom.
)}
@@ -614,7 +608,6 @@ const Detail = () => { act('remove', { ref: ware.ref })} > EXTRACT @@ -623,11 +616,7 @@ const Detail = () => { act('install', { ref: ware.ref })} > INSTALL @@ -776,10 +765,7 @@ const StatusDeck = () => { style={{ width: `${progress * 100}%` }} /> -
- Hold still. Leaving the slab cancels the cycle. Nothing is lost, the - ware goes to the tray. -
+
Hold still.
); } @@ -789,19 +775,13 @@ const StatusDeck = () => { notes.push('Trade embargo. The rig will not work on you.'); } if (!has_occupant) { - notes.push('The slab is empty. Drag yourself onto it to lie back.'); + notes.push('The slab is empty.'); } else if (!occupant_is_user) { - notes.push( - `${occupant_name} is on the slab. The rig takes orders from its occupant only. You can still pop the parts tray.`, - ); + notes.push(`${occupant_name} is on the slab.`); } else if (!can_operate) { - notes.push( - 'The rig refuses: you have to be conscious and unrestrained to consent to chrome work.', - ); + notes.push('The rig needs you awake and free to say yes.'); } else { - notes.push( - 'Rig idle. Highlight a piece in the rack, check it on the body, then commit.', - ); + notes.push('Rig idle.'); } if (tray_count > 0) { notes.push( @@ -841,10 +821,7 @@ const Controls = () => { act('tuneup')} > {`TUNE-UP · ${tuneup_fee} CR`} @@ -852,7 +829,6 @@ const Controls = () => { act('eject_tray')} > {`EJECT TRAY${tray_count > 0 ? ` · ${tray_count}` : ''}`} @@ -860,7 +836,6 @@ const Controls = () => { act('eject_cash')} > EJECT CASH @@ -868,7 +843,6 @@ const Controls = () => { act('get_up')} > {occupant_is_user ? 'GET UP' : 'UNBUCKLE'} diff --git a/tools/gear_catalog/ratings/ammo.json b/tools/gear_catalog/ratings/ammo.json index 4cb6dcb603c..6d7ae0e45a1 100644 --- a/tools/gear_catalog/ratings/ammo.json +++ b/tools/gear_catalog/ratings/ammo.json @@ -342,6 +342,15 @@ "reason": "Built into the peashooter, never on its own. Rated with the gun.", "tier": "green" }, + "/obj/item/ammo_box/magazine/internal/cylinder/rev38/cyberware_holdout": { + "confidence": "high", + "group": "magazines built into a gun", + "hash": "", + "name": "holdout cylinder", + "rank": 8, + "reason": "Built into the Holdout revolver arm, never on its own. Rated with the gun.", + "tier": "yellow" + }, "/obj/item/ammo_box/magazine/internal/cylinder/rev38/housecall": { "confidence": "high", "group": "magazines built into a gun", diff --git a/tools/gear_catalog/ratings/cyberware.json b/tools/gear_catalog/ratings/cyberware.json index f4c5b57f0ea..f6613a33fec 100644 --- a/tools/gear_catalog/ratings/cyberware.json +++ b/tools/gear_catalog/ratings/cyberware.json @@ -19,7 +19,7 @@ "hash": "c229d282cf893570", "name": "Strong-Arm empowered musculature implant", "note": "Humans only. With the implanted arm active, an empty-hand combat-mode left-click on a mob becomes a slam on a 5 s cooldown: the hand's unarmed damage roll plus 5 (plus 20 more against beast, special and mining mobs), doubled and run through melee armor, and the target is thrown 1 tile if the wearer is standing; it is not used while Hulk. One implant in each arm lets the wearer pry closed airlocks open bare-handed (6 s, instant if unpowered, refused if bolted or welded). An EMP puts the arm down for 9 s (4.5 s on a light pulse): slams fail, and half the time the wearer lunges onto the target and falls for 3 s, otherwise is paralyzed for 1 s.", - "rank": 6, + "rank": 14, "reason": "A slam for 20 to 30 damage every 5 s per arm, 60 to 70 against mining mobs and beasts, and a pair pries powered airlocks in 6 s. 1,200 cr for two from cargo. EMP makes the arm a liability for 9 s.", "tier": "yellow" }, @@ -28,7 +28,7 @@ "group": "Work tools", "hash": "5b81131a4a10a42c", "name": "Harpoon Spool", - "rank": 6, + "rank": 9, "reason": "Pulls a loose item or small creature to you from 6 tiles every 8 s, anything bigger drags you a tile. Can grab a dropped gun, little else. Load 2, 2,800 cr.", "tier": "green" }, @@ -37,7 +37,7 @@ "group": "Arm weapons and fists", "hash": "31fd669dadf0cf4c", "name": "Bunker Buster housing", - "rank": 5, + "rank": 10, "reason": "Two 60-damage rockets that floor the target and wreck doors and machines with no blast, about 10 on the gun score plus breaching. Two hands, two shots, then 600 cr at reputation 22 or late research. Loot only.", "tier": "yellow" }, @@ -51,6 +51,15 @@ "reason": "Every timed action takes 25% less time, surgery, welding, cuffing and repairs alike, plus a driver, wrench and cutters in the arm. Worth a slot for medics and engineers. Load 2, 1,800 cr.", "tier": "yellow" }, + "/obj/item/organ/cyberimp/arm/toolkit/cyberware/fixers/street": { + "confidence": "medium", + "group": "Work tools", + "hash": "", + "name": "Tinker's fingers", + "rank": 3, + "reason": "A driver, wrench and cutters in the arm, and every timed action 10% faster. The Fixer's Fingers at a tenth of the stack: load 1, 700 cr. Splice takes a pulled set back for 350 cr.", + "tier": "green" + }, "/obj/item/organ/cyberimp/arm/toolkit/cyberware/graverobber": { "confidence": "medium", "group": "Scouting and sight", @@ -66,7 +75,7 @@ "group": "Hacking and ship control", "hash": "52911504b95eb634", "name": "Icepick Jack", - "rank": 1, + "rank": 4, "reason": "Knocks hostile turrets out for 15 s, turns them for 10 s, and forces bolted or unpowered doors in 6 s. A boarding crew's key to player hulls, though jacking their turrets sets off an alarm. Load 3, 1 voucher.", "tier": "yellow" }, @@ -76,7 +85,7 @@ "hash": "b190c2719a5d40f7", "name": "Mantis Blade housing (right)", "note": "Each housing extends a hardlight blade into the hand (it can't be dropped; retract stows it). An ability, usable from either housing with its blade out, dashes up to 5 tiles to a living target after a 0.3 s wind-up, lands 10 brute (armor applies, wounding) per extended blade on arrival and floors the target for 2 s. The 20 s cooldown is shared by both housings and is spent even if the dash falls short.", - "rank": 2, + "rank": 5, "reason": "Half of a pair: 20-force blades that can't be disarmed, plus a 5-tile lunge every 20 s that adds 20 damage and floors the target for 2 s. Load 6 the pair, 4 vouchers at reputation 22, one on the shelf per round.", "tier": "red" }, @@ -86,44 +95,110 @@ "hash": "91733b8b4ac9435a", "name": "Mantis Blade housing (left)", "note": "Each housing extends a hardlight blade into the hand (it can't be dropped; retract stows it). An ability, usable from either housing with its blade out, dashes up to 5 tiles to a living target after a 0.3 s wind-up, lands 10 brute (armor applies, wounding) per extended blade on arrival and floors the target for 2 s. The 20 s cooldown is shared by both housings and is spent even if the dash falls short.", - "rank": 3, + "rank": 6, "reason": "Left half of the Mantis pair: 20-force blades that can't be disarmed, plus a 5-tile lunge every 20 s that adds 20 damage and floors the target for 2 s.", "tier": "red" }, + "/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/scorch": { + "confidence": "medium", + "group": "Arm weapons and fists", + "hash": "", + "name": "Scorch Blade housing (right)", + "note": "Each landed cut adds 2 fire stacks and sets the target alight; the lunge adds 4 once, however many blades arrive. Corpses are left alone and the wearer is never lit. The blade is lit while out. Its torn arteries are seared half shut (2 flow, clotting) instead of the Mantis's 3.5 that never clots; otherwise the Mantis lunge, leap, kill reset, impale, X-slash and scissor.", + "rank": 3, + "reason": "Half of a pair: the Mantis blades and lunge, with every cut and the lunge setting the target alight. Load 8 the pair, 4 vouchers at reputation 22, one on the shelf per round.", + "tier": "red" + }, + "/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/scorch/left": { + "confidence": "medium", + "group": "Arm weapons and fists", + "hash": "", + "name": "Scorch Blade housing (left)", + "note": "Each landed cut adds 2 fire stacks and sets the target alight; the lunge adds 4 once, however many blades arrive. Corpses are left alone and the wearer is never lit. The blade is lit while out. Its torn arteries are seared half shut (2 flow, clotting) instead of the Mantis's 3.5 that never clots; otherwise the Mantis lunge, leap, kill reset, impale, X-slash and scissor.", + "rank": 4, + "reason": "Left half of the Scorch pair: the Mantis blades and lunge, with every cut and the lunge setting the target alight.", + "tier": "red" + }, + "/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/street": { + "confidence": "medium", + "group": "Arm weapons and fists", + "hash": "", + "name": "Shiv Blade housing (right)", + "rank": 15, + "reason": "Half of a pair: 14-force blades that can't be disarmed, no lunge. Load 4 the pair, 2,400 cr at yellow reputation. Splice takes a pulled housing back for 600 cr.", + "tier": "yellow" + }, + "/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/street/left": { + "confidence": "medium", + "group": "Arm weapons and fists", + "hash": "", + "name": "Shiv Blade housing (left)", + "rank": 16, + "reason": "Left half of the Shiv pair: 14-force blades that can't be disarmed, no lunge.", + "tier": "yellow" + }, "/obj/item/organ/cyberimp/arm/toolkit/cyberware/monowire": { "confidence": "high", "group": "Arm weapons and fists", "hash": "174a6ea665db7cac", "name": "Widowline spool housing", - "rank": 1, + "rank": 2, "reason": "20 damage a swing (15 brute, 5 burn) straight through all armor, reach 2, and it cuts neighbours for 75%. The best melee against armored crews, useless on walls and doors. Load 5, 3 vouchers at reputation 22, one on the shelf per round.", "tier": "red" }, + "/obj/item/organ/cyberimp/arm/toolkit/cyberware/monowire/live": { + "confidence": "medium", + "group": "Arm weapons and fists", + "hash": "", + "name": "Widowline Arc spool housing", + "note": "The Widowline wire with a shock on every landed hit. A living target takes 5 more burn and a 2 s stagger (stacking to 4 s) unless it is shock immune or its suit is insulated; gloves do not matter. Silicons, mechs and robotic mobs take 25 more burn. A hit on a turret, ship laser turret, console or camera knocks it out for 5 s, once per 15 s per wire; outpost property is immune. The cleave does not shock. Its garrote always takes the head off, not only in hard crit; an Atlas frame, a sealed helmet, an armoured collar or plating still stops it. A wire pair counts as Arc if either wire is.", + "rank": 1, + "reason": "The Widowline's 20 a swing through all armor and reach 2, plus 5 burn and a stagger on the target, 25 extra burn on robots and mechs, and a turret or console shorted out for 5 s, and a garrote that always beheads. Load 6, 5 vouchers at reputation 22, one on the shelf per round.", + "tier": "red" + }, "/obj/item/organ/cyberimp/arm/toolkit/cyberware/rockjaw": { "confidence": "high", "group": "Work tools", "hash": "29ec5344a41717f9", "name": "Rockjaw drill fist", "note": "Folds a mining drill out of the forearm. While the drill is out, ore from any rock the wearer cracks (with any tool) is swept 0.2 s later into an internal hopper with no size limit in the code instead of landing on the floor; a second button dumps the hopper at the wearer's feet. Sweeping is off during an EMP reboot, and the hopper's contents drop if the arm ware is destroyed.", - "rank": 5, + "rank": 7, "reason": "A mining drill in the forearm with a bottomless ore hopper. A miner's bag and pick in one arm slot. Load 2, 1,200 cr.", "tier": "green" }, + "/obj/item/organ/cyberimp/arm/toolkit/cyberware/rockjaw/deepcore": { + "confidence": "medium", + "group": "Work tools", + "hash": "", + "name": "Deepcore drill fist", + "rank": 6, + "reason": "The Rockjaw's ore hopper on a faster drill, between the Rockjaw drill and a diamond drill. Load 3, 2,400 cr. Splice takes a pulled one back for 1,200 cr.", + "tier": "green" + }, "/obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin": { "confidence": "medium", "group": "Arm weapons and fists", "hash": "43903115df46709c", "name": "Popup Ronin housing", - "rank": 4, + "rank": 9, "reason": "A one-handed machine pistol in the arm that can't be disarmed: 20 damage, 3.3 shots a second, about a WT-550 on the gun score (47). 20-round magazines are 250 cr at reputation 22 or late research. Loot only.", "tier": "yellow" }, + "/obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin/holdout": { + "confidence": "medium", + "group": "Arm weapons and fists", + "hash": "", + "name": "Holdout housing", + "rank": 11, + "reason": "A .38 revolver in the arm that can't be disarmed: 25 damage, six shots, about 2.5 a second, reloaded by hand a round at a time with ordinary .38. Load 3, 2,400 cr at reputation 4. Splice takes a pulled housing back for 1,200 cr.", + "tier": "yellow" + }, "/obj/item/organ/cyberimp/arm/toolkit/cyberware/skyhook": { "confidence": "high", "group": "Mobility and stealth", "hash": "d2c5b721e44bd009", "name": "Skyhook wrist winch", - "rank": 3, + "rank": 4, "reason": "Fires a line at any wall or anchored structure within 7 tiles and hauls you there, every 8 s. Real chase and escape mobility, at the cost of an arm slot. Load 3, loot only.", "tier": "yellow" }, @@ -132,7 +207,7 @@ "group": "Work tools", "hash": "4a6c47ce239cc051", "name": "integrated paperwork implant", - "rank": 7, + "rank": 11, "reason": "A pen, clipboard, lighter and laser pointer in your arm. Harmless.", "tier": "none" }, @@ -141,7 +216,7 @@ "group": "Work tools", "hash": "6e21944c25437900", "name": "surgical toolset implant", - "rank": 3, + "rank": 4, "reason": "A surgical kit in your arm. Saves carrying the tools. Late printing.", "tier": "green" }, @@ -150,7 +225,7 @@ "group": "Work tools", "hash": "2ffcab76bdd48728", "name": "morbid surgical toolset implant", - "rank": 4, + "rank": 5, "reason": "The surgical arm rebuilt for looks and a nasty mood. Same job as the plain one.", "tier": "green" }, @@ -169,7 +244,7 @@ "hash": "095577f719c51add", "name": "anti-drop implant", "note": "A toggle button: switching it on makes whatever is in the wearer's hands at that moment undroppable (stuns and disarms don't release it) until the button is pressed again or the item leaves the hand; items picked up afterwards are not locked. An EMP releases it and flings the held items up to 10 tiles in random directions, and as with every brain implant any EMP also stuns the wearer for 20 s (10 s on a light pulse).", - "rank": 6, + "rank": 8, "reason": "Locks what's in your hands so stuns and disarms can't take it. Same job as Gecko Grip at about 24 cr of material, but any EMP stuns you for 20 s and flings the item.", "tier": "green" }, @@ -179,7 +254,7 @@ "hash": "8ae45008ffefef4e", "name": "CNS rebooter implant", "note": "1 s after the wearer gains a stun, immobilize, paralysis or stamina crit it clears stun, knockdown, immobilize, paralysis and all stamina damage, then grants stun immunity, baton resistance and immunity to damage slowdown for 6 s (stamina is zeroed again at the end). Then locks out for 60 s. An EMP takes it offline for 9 s (4.5 s on a light pulse), and as with every brain implant also stuns the wearer for 20 s (10 s light).", - "rank": 2, + "rank": 3, "reason": "Once a minute a stun is cleared after 1 s, stamina resets, and you get 6 s of stun immunity. Undoes the first stun of a fight for one neural load. Any EMP stuns the wearer for 20 s and takes it offline for 9 s.", "tier": "yellow" }, @@ -189,7 +264,7 @@ "hash": "df0fb0f149203f80", "name": "CNS skillchip connector implant", "note": "Lets the wearer put a skillchip in or take one out without surgery: a 1.5 s action, inserting the chip in the active hand or, with an empty hand, choosing an installed chip from a radial menu. An EMP knocks installed chips onto the floor (one on a light pulse, two on a heavy one), and as with every brain implant stuns the wearer for 20 s (10 s light). With no chip installed the handler indexes the first chip of an empty or null list and its brain-damage branch is called without a brain, so it may error out before the reboot timer starts (unconfirmed).", - "rank": 7, + "rank": 8, "reason": "Swap skillchips without surgery. Skillchips do almost nothing, and any EMP stuns you for 20 s.", "tier": "none" }, @@ -199,7 +274,7 @@ "hash": "5bc666bd0e7ad39e", "name": "nutriment pump implant", "note": "While the wearer's nutrition is at or below 150 (250 for the PLUS version) it adds about 50 nutrition, then waits 5 s before it can do so again, which stops nutrition falling below that line. An EMP pushes bad-food toxin into the blood (5 units on a heavy pulse, 10 on the PLUS version).", - "rank": 5, + "rank": 6, "reason": "Keeps you just above starving. Removes the need for a kitchen for one neural load.", "tier": "green" }, @@ -209,7 +284,7 @@ "hash": "ce113e10a6c8deab", "name": "nutriment pump implant PLUS", "note": "While the wearer's nutrition is at or below 150 (250 for the PLUS version) it adds about 50 nutrition, then waits 5 s before it can do so again, which stops nutrition falling below that line. An EMP pushes bad-food toxin into the blood (5 units on a heavy pulse, 10 on the PLUS version).", - "rank": 4, + "rank": 5, "reason": "Keeps you fed before you get hungry. Removes food from a six-hour round for one neural load.", "tier": "green" }, @@ -229,7 +304,7 @@ "hash": "14f4a2c2517247c0", "name": "Herculean gravitronic spinal implant", "note": "Cuts the wearer's climbing, ladder, gym-machine, table-carry and vent-boulder lifting times to 80%, adds +1 speed and +4 range to everything they throw, adds 4 to tackle strength and lets them break boulders off a discovered ore vent with bare hands. An EMP deals 20 brute (10 light) to the chest. A gravity anomaly core can be slotted in to change it into the Atlas variant.", - "rank": 6, + "rank": 9, "reason": "Faster climbing, throws fly farther and faster, tackles hit harder, and you can break boulders off ore vents by hand. Nothing here wins a fight. About 85 cr of material.", "tier": "green" }, @@ -239,20 +314,40 @@ "hash": "ffff4012788ccee2", "name": "implantable thrusters set", "note": "A toggle that lets the wearer move under their own power in zero gravity, with a movement-speed bonus while floating and no stabilization, so they keep drifting when they stop. It draws on ambient air above 30 kPa for free, otherwise internals gas or the wearer's plasma store, and turns itself off if neither is available.", - "rank": 5, + "rank": 7, "reason": "A jetpack in your chest with no back slot used, and a speed bonus while floating. Free air when there's pressure, otherwise your tank. About 74 cr of material after 200 research points.", "tier": "green" }, + "/obj/item/organ/cyberimp/cyberware/adrenal_pump": { + "confidence": "medium", + "group": "Nerves and stuns", + "hash": "", + "name": "Adrenal pump", + "note": "When a stamina update leaves a conscious wearer at 70 or more stamina loss and the pump is ready, one tick later it takes 40 off, speeds the wearer up (movement -0.4) and tints them red for 3 s, and plays a loud heartbeat. It then waits 4 minutes; the wait is stored as a ready-at time on the organ, so a refit does not reset it. It ignores the stamina dumped by the Cascade and Redline crashes. It takes the spare heart slot, so it evicts the Clotter node, and goes off during an EMP reboot or brownout.", + "rank": 5, + "reason": "Once every 4 minutes a bad run of stamina damage is cut by 40 and the wearer gets 3 s of extra speed, enough to stay out of a stamina crit for one more volley. Load 2, 2,400 cr at reputation 4.", + "tier": "yellow" + }, "/obj/item/organ/cyberimp/cyberware/atlas": { "confidence": "medium", "group": "Armor and frame", "hash": "0a8132740babf01b", "name": "Atlas frame", "note": "Bones can't be broken (no dislocations or fractures) and limbs can't be dismembered; slashes, punctures, burns and bleeding still land normally. Items and mobs the wearer throws get +2 tiles of range and +1 speed, and any throw of the wearer by something else travels half as far. All of it drops during an EMP reboot or over-capacity brownout.", - "rank": 3, + "rank": 4, "reason": "No broken bones and no lost limbs, thrown things fly farther and you get thrown half as far. Slashes, burns and bleeding still land. Load 4, 2 vouchers at reputation 22.", "tier": "yellow" }, + "/obj/item/organ/cyberimp/cyberware/atlas/street": { + "confidence": "medium", + "group": "Armor and frame", + "hash": "", + "name": "Strut frame", + "note": "Bone wounds (dislocations, hairline and compound fractures) are refused while the ware is online; nothing else. Limbs can still be dismembered, throws are not boosted and the wearer's own knockback is not reduced. Drops during an EMP reboot or over-capacity brownout.", + "rank": 8, + "reason": "Bones can't break: no dislocations or fractures. Limbs still come off, and slashes, burns and bleeding land as usual. None of the Atlas Frame's throw boost or knockback cut. Load 2, 1,500 cr at reputation 4.", + "tier": "yellow" + }, "/obj/item/organ/cyberimp/cyberware/cargo_cavity": { "confidence": "high", "group": "Body upkeep", @@ -265,32 +360,80 @@ "/obj/item/organ/cyberimp/cyberware/cascade": { "confidence": "high", "group": "Operating system", - "hash": "875de17ed8afaa7f", + "hash": "", "name": "Cascade lattice", "rank": 1, - "reason": "Eight seconds a minute at about double speed, melee twice as fast and 40% dodge while moving, then six seconds of crash and 80 stamina. Load 12 of 20, 8 vouchers at reputation 22. An EMP mid-burst ends it.", + "reason": "Eight seconds a minute at about double speed, melee twice as fast, 60% dodge against blows (and shots while moving) and a bigger crit roll on its own hits, then six seconds of crash and 80 stamina. Load 12 of 20, 8 vouchers at reputation 22. An EMP mid-burst ends it.", "tier": "red" }, + "/obj/item/organ/cyberimp/cyberware/cascade/milspec": { + "confidence": "medium", + "group": "Operating system", + "hash": "", + "name": "Service reflex lattice", + "rank": 4, + "reason": "Seven seconds in every 90 at close to the lattice's speed, melee 40% quicker, 45% dodge against blows (and shots while moving) and a bigger crit roll on its own hits, then seven seconds of crash and 90 stamina. Load 9, 4 vouchers at reputation 11. An EMP mid-burst ends it.", + "tier": "red" + }, + "/obj/item/organ/cyberimp/cyberware/cascade/street": { + "confidence": "medium", + "group": "Operating system", + "hash": "", + "name": "Spliced reflex rig", + "rank": 7, + "reason": "Six seconds in every 120 at a clear speed boost, melee a quarter quicker, 30% dodge against blows (and shots while moving) and a small crit roll bonus on its own hits, then eight seconds of crash and 90 stamina. A short window on a long cooldown keeps it below the service lattice. Load 6, 3,600 cr at reputation 4. An EMP mid-burst ends it.", + "tier": "yellow" + }, "/obj/item/organ/cyberimp/cyberware/chromatic_dermis": { "confidence": "high", "group": "Body upkeep", "hash": "ec8cfbbd975a51eb", "name": "Chromatic Dermis ink suite", "note": "Cosmetic only: draws a glowing outline of the chosen colour and pattern around the wearer that flares when they take damage, swing, use a chrome ability or when other chrome acts, dims when they are hungry, and goes dark while the ware is down. No mechanical effect.", - "rank": 8, + "rank": 9, "reason": "Glowing tattoos with no other effect. Load 0, 400 cr.", "tier": "none" }, + "/obj/item/organ/cyberimp/cyberware/clotter_node": { + "confidence": "medium", + "group": "Body upkeep", + "hash": "", + "name": "Clotter node", + "note": "While online, multiplies the blood a human wearer loses by 0.5, on life ticks and flat bleeds alike. It stacks multiplicatively with other bleed reducers and goes off during an EMP reboot or over-capacity brownout. It takes the spare heart slot, so it evicts the Adrenal pump.", + "rank": 3, + "reason": "Halves the blood lost to wounds. It buys a bleeding crew member time between medic visits and does nothing against burst damage. Load 1, 900 cr.", + "tier": "green" + }, "/obj/item/organ/cyberimp/cyberware/coolant": { "confidence": "medium", "group": "Armor and frame", "hash": "4ceed965097294a4", "name": "Coolant Loop lattice", - "note": "While the ware is online the wearer takes no damage from overheating (hot air or body temperature), takes half burn damage (humans only), and loses 1 fire stack per second. It does not stop fire: a burning wearer is still burned at half strength. All three drop during an EMP reboot or over-capacity brownout.", + "note": "While the ware is online the wearer takes no damage from overheating (hot air or body temperature), takes half burn damage (humans only), and loses 1 fire stack per second. Fire on a human only does harm through body heat, which the ware blocks, so a burning wearer loses clothes but takes no burn from the flames; burn dealt outright (lasers) lands at half. All three drop during an EMP reboot or over-capacity brownout.", "rank": 2, "reason": "Halves all burn damage on top of armor, lasers included, plus no heat damage and fire burns off fast. Half of every beam in the game for load 3. Bullets and blades ignore it. 3,600 cr with no reputation.", "tier": "red" }, + "/obj/item/organ/cyberimp/cyberware/coolant/street": { + "confidence": "medium", + "group": "Armor and frame", + "hash": "", + "name": "Heat-sink lining", + "note": "While the ware is online the wearer takes no damage from overheating (hot air or body temperature) and loses 1 fire stack per second. It does not reduce burn damage dealt outright (lasers land at full strength), but fire on a human only does harm through body heat, which the ware blocks, so a burning wearer loses clothes and takes no burn from the flames. Both drop during an EMP reboot or over-capacity brownout.", + "rank": 9, + "reason": "No heat damage from hot air or lava country, and being set alight burns only your clothes, but laser burns land at full strength. The heat half of the Coolant Loops for load 1, 1,500 cr.", + "tier": "green" + }, + "/obj/item/organ/cyberimp/cyberware/cuffer_wrists": { + "confidence": "medium", + "group": "Work tools", + "hash": "", + "name": "Cuffer's wrists", + "note": "While online, handcuffing takes 75% of the usual time, the trait combat and insulated gloves also give. It takes the hands slot, so it evicts the Gecko Grip and the Medic's palms.", + "rank": 10, + "reason": "Cuffs go on in three quarters of the time with no glove needed. A small edge for bounty hunters and boarders. Load 1, 500 cr.", + "tier": "green" + }, "/obj/item/organ/cyberimp/cyberware/dead_channel": { "confidence": "medium", "group": "Nerves and stuns", @@ -307,10 +450,20 @@ "hash": "5b60dbb7a15c8084", "name": "Dermal Mesh weave", "note": "While online, adds physiology armor to a human wearer: melee 15, bullet 15, laser 10, wound 5. The armor is removed during an EMP reboot or an over-capacity brownout.", - "rank": 4, + "rank": 5, "reason": "15 melee, 15 bullet, 10 laser on the whole body, on top of whatever you wear. A clear step up for load 2 and 2,000 cr. EMP switches it off for 9 s.", "tier": "yellow" }, + "/obj/item/organ/cyberimp/cyberware/dermal_mesh/hardweave": { + "confidence": "medium", + "group": "Armor and frame", + "hash": "", + "name": "Hardweave plating", + "note": "While online, adds physiology armor to a human wearer: melee 20, bullet 20, laser 15, energy 10, wound 10. Bullets and buckshot pellets from the front glance off at 30% (each pellet rolls on its own), keep flying at reduced damage and cost the wearer 5 stamina each. Never lasers, energy, melee or shots into the back. Shares the dodge arbiter: dodge plus glance never stop more than 60% of shots. The armor and the glance are off during an EMP reboot or an over-capacity brownout.", + "rank": 3, + "reason": "20 melee, 20 bullet, 15 laser, 10 energy and 10 wound armor on the whole body, on top of whatever you wear, and nearly a third of bullets from the front glance off. A size up from the Mesh and well short of the Slabskin Plate, which adds bomb, fire, acid and a bigger glance. Load 3, 3,000 cr at reputation 4. Strong for yellow against gunfire from the front, still useless against lasers and flanking. EMP switches it off for 9 s.", + "tier": "yellow" + }, "/obj/item/organ/cyberimp/cyberware/doppler": { "confidence": "high", "group": "Scouting and sight", @@ -321,13 +474,33 @@ "reason": "Anything alive and moving within 9 tiles shows through walls, without taking your eye slot. Standing still hides you and the ping is audible. Thermals' little brother. Load 2, 1 voucher.", "tier": "yellow" }, + "/obj/item/organ/cyberimp/cyberware/doppler/street": { + "confidence": "medium", + "group": "Scouting and sight", + "hash": "", + "name": "Thumper ear", + "note": "A toggle: while on, living mobs within 5 tiles on the wearer's level that are moving show as blips through walls on the wearer's HUD, each lasting 3 s after its last step so standing still drops off the display; machines never show. It plays a sonar ping at the wearer on every life tick while any mover is tracked, louder than the Heartbeat Doppler's and doubled within 3 tiles, so nearby players can hear it.", + "rank": 3, + "reason": "Anything alive and moving within 5 tiles shows through walls for a moment after each step, without taking your eye slot. Standing still hides you and the ping carries. A shorter, louder Heartbeat Doppler. Load 1, 1,500 cr at reputation 4.", + "tier": "yellow" + }, + "/obj/item/organ/cyberimp/cyberware/frostline": { + "confidence": "medium", + "group": "Armor and frame", + "hash": "", + "name": "Frostline lining", + "note": "While the ware is online the wearer takes no damage from cold air or body temperature. It does nothing for pressure, breathing or burns. The trait drops during an EMP reboot or over-capacity brownout.", + "rank": 10, + "reason": "No cold damage on ice planets and in the cold of space, but low pressure and no air still kill. Shares the seal slot with every air and heat lining, so it never sits beside a bladder. Load 1, 1,500 cr.", + "tier": "green" + }, "/obj/item/organ/cyberimp/cyberware/gastro": { "confidence": "high", "group": "Body upkeep", "hash": "26dc92f22c6385f6", "name": "Gastro Reactor", "note": "The wearer eats 35% faster, food that is contaminated (for example dropped on the floor) gives no infection or disgust mood, vomiting costs half the nutrition, everything they eat counts as 6 points higher quality (lifting rotten or gross food above the disgust line, though species-toxic food stays toxic) and disgust drains away at 3 per second. Off during an EMP reboot or over-capacity brownout.", - "rank": 6, + "rank": 7, "reason": "Eat anything, eat faster, no food poisoning. No bearing on a fight. Load 1, 400 cr.", "tier": "none" }, @@ -337,7 +510,7 @@ "hash": "e331ce1251c1f939", "name": "Gecko Grip palm pads", "note": "The wearer's hands refuse to drop held items while stunned, paralyzed, unconscious, in crit or stamina-crit (handcuffs still take the hands, and the dead drop them). They can walk over tables and climb obstacles 20% faster, and stepping onto a chasm edge shoves them back to the lip instead of dropping them, resetting after 30 s. An EMP opens the hands and hurls whatever is held up to 5 tiles (3 on a light pulse).", - "rank": 5, + "rank": 7, "reason": "Stuns and crit can't strip what you're holding, you walk over tables and a chasm edge throws you back. Load 1, 900 cr. An EMP flings your gun away.", "tier": "green" }, @@ -346,11 +519,21 @@ "group": "Mobility and stealth", "hash": "d87709dff38cd54e", "name": "Ghostskin weave", - "note": "A button turns on 10 s of optical camo (a faint outline that brightens when they move) with a 30 s cooldown spent on use; pressing it again drops the field early. The field collapses on attacking a living thing, firing a gun, being hit or attacked, hostile bullets, being cuffed, death or an EMP. Basic-mob AI won't target the wearer from more than 2 tiles away while it is up.", + "note": "A button turns on 10 s of optical camo (a faint outline that brightens when they move) with a 30 s cooldown spent on use; pressing it again drops the field early. The field collapses on attacking a living thing, firing a gun, being hit or attacked (an animal's bite, a mech or a xeno included), hostile bullets, a real electric shock, being cuffed, death or an EMP. Basic-mob AI won't target the wearer from more than 2 tiles away while it is up.", "rank": 2, "reason": "Ten seconds of near-invisibility every 30, and mobs farther than 2 tiles lose you. Attacking or being hit ends it. A free escape or free first shot in most fights, and it walks you through ruins. Load 5, 4 vouchers at reputation 22.", "tier": "red" }, + "/obj/item/organ/cyberimp/cyberware/ghostskin/street": { + "confidence": "medium", + "group": "Mobility and stealth", + "hash": "", + "name": "Flickerskin weave", + "note": "A button turns on 7 s of optical camo (a faded outline at about a quarter opacity that brightens when they move) with a 45 s cooldown spent on use; pressing it again drops the field early. The field collapses on attacking a living thing, firing a gun, being hit or attacked (an animal's bite, a mech or a xeno included), hostile bullets, a real electric shock, being cuffed, death or an EMP. It does not grant the mob-hiding camo trait, so NPC AI still targets the wearer at any range and Chrome Read still resolves them.", + "rank": 6, + "reason": "Seven seconds of mostly faded camo every 45: people lose you in a crowd or a dim room, mobs and turrets still see you, and any swing or hit ends it. A cheap way to break line of sight from players. Load 2, 2,400 cr at yellow reputation.", + "tier": "yellow" + }, "/obj/item/organ/cyberimp/cyberware/gorilla_arms": { "confidence": "high", "group": "Arm weapons and fists", @@ -371,6 +554,24 @@ "reason": "Left half of the Gorilla pair: a flat 20 damage punch every 4 s, 40 to machines and structures every second, breaks rock, and the pair pries powered airlocks in 4 s.", "tier": "yellow" }, + "/obj/item/organ/cyberimp/cyberware/gorilla_arms/street": { + "confidence": "medium", + "group": "Arm weapons and fists", + "hash": "", + "name": "Brawler myomers (right)", + "rank": 12, + "reason": "Half of a pair: a 14 damage punch every 5 s that snaps a limb on the fourth hit, a grab slam for 18 to 22 with a 1 s knockdown every 15 s, and 32 to structures, enough to break down an airlock. The pair forces powered airlocks in 7 s, staggers everything adjacent every 60 s and tears an arm off a downed target. Above the Strong-Arm, which slams a little harder but has no finisher or door damage; below Gorilla Arms, which hurl, hit harder, pry faster and have three finishers. Load 4 the pair, 2,000 cr at reputation 4. Either ripperdoc takes a pulled arm back for 500 cr.", + "tier": "yellow" + }, + "/obj/item/organ/cyberimp/cyberware/gorilla_arms/street/left": { + "confidence": "medium", + "group": "Arm weapons and fists", + "hash": "", + "name": "Brawler myomers (left)", + "rank": 13, + "reason": "Left half of the Brawler pair: a 14 damage punch every 5 s, an 18 to 22 grab slam every 15 s, 32 to structures. The pair forces airlocks, has a light ground pound and the limb rip.", + "tier": "yellow" + }, "/obj/item/organ/cyberimp/cyberware/governor_delete": { "confidence": "medium", "group": "Operating system", @@ -380,6 +581,24 @@ "reason": "Adds 15 neural load for 35 in all, giving up the slot Cascade and Redline need. That runs Slabskin, Lazarus, Mantis, Hopper, Dead Channel, Coolant, Deadeye and Atlas at once. 5 vouchers at reputation 22.", "tier": "red" }, + "/obj/item/organ/cyberimp/cyberware/governor_delete/milspec": { + "confidence": "medium", + "group": "Operating system", + "hash": "", + "name": "Governor Bypass", + "rank": 6, + "reason": "Raises the neural load limit from 20 to 30 for no load of its own, in the slot Cascade and Redline need. 3 vouchers at reputation 11.", + "tier": "red" + }, + "/obj/item/organ/cyberimp/cyberware/governor_delete/street": { + "confidence": "medium", + "group": "Operating system", + "hash": "", + "name": "Governor Patch", + "rank": 9, + "reason": "Raises the neural load limit from 20 to 25 for no load of its own, in the slot Cascade and Redline need. 2,500 cr at reputation 4.", + "tier": "yellow" + }, "/obj/item/organ/cyberimp/cyberware/hemoglass": { "confidence": "medium", "group": "Body upkeep", @@ -395,10 +614,28 @@ "group": "Mobility and stealth", "hash": "2f8e33baec594340", "name": "Hopper piston calves", - "rank": 4, + "rank": 5, "reason": "Jump 4 tiles over tables, gaps and people every 8 s. Won't cross walls or windows. Strong in any fight. Load 3, 3,600 cr.", "tier": "yellow" }, + "/obj/item/organ/cyberimp/cyberware/hopper/milspec": { + "confidence": "medium", + "group": "Mobility and stealth", + "hash": "", + "name": "Vaulter pistons", + "rank": 3, + "reason": "Jump 5 tiles over tables, gaps and people every 6 s, and walk away from drops and wet floors like the Shock Coils. Won't cross walls or windows. Load 4, 3 vouchers at reputation 11.", + "tier": "red" + }, + "/obj/item/organ/cyberimp/cyberware/hopper/street": { + "confidence": "medium", + "group": "Mobility and stealth", + "hash": "", + "name": "Spring calves", + "rank": 8, + "reason": "Jump 3 tiles over tables, gaps and people every 14 s. Won't cross walls or windows. The cheap rung under the Hopper, with none of the Shock Coils' trims. Load 2, 1,800 cr at reputation 4. Splice takes a pulled pair back for 900 cr.", + "tier": "yellow" + }, "/obj/item/organ/cyberimp/cyberware/lazarus": { "confidence": "high", "group": "Revive and last stand", @@ -409,6 +646,26 @@ "reason": "Once every 6 minutes, dropping into crit stands you up at 30% health with stuns cleared after a 1 s seizure. A second life in the same fight. Load 5, 4 vouchers at reputation 22.", "tier": "red" }, + "/obj/item/organ/cyberimp/cyberware/medic_palms": { + "confidence": "medium", + "group": "Work tools", + "hash": "", + "name": "Medic's palms", + "note": "While online, gives the wearer the quicker chemistry trait (syringes, pills, patches and the like take less time) and the quicker fireman carry (3 s instead of 5), the same traits as nitrile gloves, without using the glove slot. It takes the hands slot, so it evicts the Gecko Grip and the Cuffer's wrists.", + "rank": 8, + "reason": "Nitrile-glove speed on chemistry and carrying without the glove slot, so a medic can wear insulated or armored gloves instead. Load 1, 600 cr.", + "tier": "green" + }, + "/obj/item/organ/cyberimp/cyberware/muffler_ear": { + "confidence": "medium", + "group": "Nerves and stuns", + "hash": "", + "name": "Muffler ear", + "note": "While online, takes one point off the intensity of a bang, which is what earmuffs do: a flashbang or similar bang does nothing to the wearer, though the flash still blinds. It goes off during an EMP reboot or brownout. It takes the chrome ears slot, so it evicts the Heartbeat Doppler.", + "rank": 10, + "reason": "A flashbang's bang stops dropping the wearer, like earmuffs you can't take off. The flash still blinds. Load 1, 700 cr.", + "tier": "green" + }, "/obj/item/organ/cyberimp/cyberware/piledriver": { "confidence": "high", "group": "Mobility and stealth", @@ -427,13 +684,31 @@ "reason": "Twelve seconds in every 90: stun immune, 40% less brute and burn, 8 more on punches, and a roar that staggers everyone within 5 tiles. Then 100 stamina and slow legs. Load 10, 6 vouchers at reputation 22.", "tier": "red" }, + "/obj/item/organ/cyberimp/cyberware/redline/milspec": { + "confidence": "medium", + "group": "Operating system", + "hash": "", + "name": "Vanguard core", + "rank": 5, + "reason": "Ten seconds in every 105: stun immune, 30% less brute and burn, 5 more on punches, and a roar that staggers everyone within 4 tiles. Then 100 stamina and slow legs. Load 8, 4 vouchers at reputation 11.", + "tier": "red" + }, + "/obj/item/organ/cyberimp/cyberware/redline/street": { + "confidence": "medium", + "group": "Operating system", + "hash": "", + "name": "Hothead core", + "rank": 8, + "reason": "Eight seconds in every 90: 20% less brute and burn and 3 more on punches, with no stun immunity and no roar. Then 100 stamina and slow legs. Load 4, 3,000 cr at reputation 4.", + "tier": "yellow" + }, "/obj/item/organ/cyberimp/cyberware/registry_uplink": { "confidence": "low", "group": "Hacking and ship control", "hash": "3ab34be71b4333f9", "name": "Registry uplink", "note": "Gives a button that opens an outpost's management panel from anywhere, with no distance, docking, zone or console-power requirement, for each outpost where the wearer is currently the management user. It needs the wearer conscious and the ware running, and any open panel closes if the ware goes down or is removed.", - "rank": 3, + "rank": 6, "reason": "Opens the management panel of an outpost you run from anywhere. Convenience for outpost owners, no use to anyone else. Load 2, 2,800 cr.", "tier": "green" }, @@ -443,7 +718,7 @@ "hash": "332ab143dabb3d52", "name": "Rigger socket", "note": "Opens a working helm console on the ship the bearer is standing on, from anywhere aboard, subject to the console's normal crew access; broken, unpowered and view-only viewscreen consoles don't count. While the uplink is up the bearer has +1 movement slowdown, and it drops if they leave the hull, go unconscious, close the panel, lose the console, or the socket is EMP'd or browned out. The button has a 5 second cooldown.", - "rank": 2, + "rank": 5, "reason": "Fly your ship from anywhere aboard at a walking pace. Lets a pilot hide from boarders or fix things mid-fight, and it needs a working helm. Load 4, 3 vouchers at reputation 22.", "tier": "yellow" }, @@ -453,7 +728,7 @@ "hash": "e057ede2eff30ba2", "name": "Scrapper's Knuckles", "note": "Replaces the bearer's own punch (combat mode, left click, not a Hulk) with that hand's normal unarmed roll plus 4 flat damage against mobs, and double that total against machines and structures. Humans can still block it and armor still applies; it stops working while the ware is EMP'd or browned out.", - "rank": 9, + "rank": 17, "reason": "Half of a pair: punches do 4 more, double against machines. A cheap brawler's first step. Load 2 the pair, 800 cr.", "tier": "green" }, @@ -463,7 +738,7 @@ "hash": "1262168b74587722", "name": "Scrapper's Knuckles", "note": "Replaces the bearer's own punch (combat mode, left click, not a Hulk) with that hand's normal unarmed roll plus 4 flat damage against mobs, and double that total against machines and structures. Humans can still block it and armor still applies; it stops working while the ware is EMP'd or browned out.", - "rank": 10, + "rank": 18, "reason": "Left half of the Scrapper pair: punches do 4 more, double against machines.", "tier": "green" }, @@ -473,17 +748,27 @@ "hash": "7266f264ffd401f9", "name": "Second Wind bladder", "note": "When the surroundings have under 16 kPa of oxygen and the bearer isn't on tank internals, the bladder supplies the breath itself from a 180 second reserve, spending 8 seconds of reserve per breath and refilling 16 seconds per breath taken in breathable air. It replaces only the breath, and it announces itself with a gasp, a HUD alert and a loud breathing loop; it does nothing for no-breathers or while EMP'd or browned out.", - "rank": 5, + "rank": 7, "reason": "Three minutes of air when you lose your internals, refills as you breathe. A safety net against vacuum. Load 1, 900 cr.", "tier": "green" }, + "/obj/item/organ/cyberimp/cyberware/second_wind/deep": { + "confidence": "medium", + "group": "Armor and frame", + "hash": "", + "name": "Deep-lung bladder", + "note": "Works exactly like the Second Wind bladder: when the surroundings have under 16 kPa of oxygen and the bearer isn't on tank internals, it supplies the breath itself, spending 8 seconds of reserve per breath. The reserve is 360 seconds (180) and refills 24 seconds per breath taken in breathable air (16). It announces itself with a gasp, a HUD alert and a loud breathing loop; it does nothing for no-breathers or while EMP'd or browned out.", + "rank": 6, + "reason": "Six minutes of air when you lose your internals, refilling faster than the Second Wind. A longer safety net against vacuum, not a way to work in it. Load 2, 1,800 cr.", + "tier": "green" + }, "/obj/item/organ/cyberimp/cyberware/shock_coils": { "confidence": "medium", "group": "Nerves and stuns", "hash": "d453bb62463e3dcb", "name": "Shock Coil calf pistons", "note": "Halves knockdown durations and cuts stun durations by 20%, stops slipping on water-wet floors (water only), and cancels fall damage from dropping down levels with no power cost; falls of 2 or more levels still stagger the bearer for up to 10 seconds. All of it switches off while the ware is EMP'd or browned out.", - "rank": 4, + "rank": 6, "reason": "Knockdowns are half as long, stuns 20% shorter, no slipping on water or fall damage. The best cheap chrome: load 1, 500 cr. Evicted by Hopper.", "tier": "green" }, @@ -503,16 +788,46 @@ "hash": "83d2c1a6b828b267", "name": "Slipwire reflex shunt", "note": "While the bearer has moved within the last second, a hostile projectile has a 15% chance to be dodged with a visible sidestep and the round flies on; shooters 1 tile away always hit, and it doesn't work lying down, buckled or unconscious. Also gives a small speed bonus (-0.1 slowdown); with other dodge sources only the highest chance counts, and everything here is off while the ware is EMP'd or browned out.", - "rank": 3, + "rank": 4, "reason": "15% of bullets miss while you're moving, never from an adjacent shooter, and you run slightly faster. Takes the slot Dead Channel wants. Load 4, 2 vouchers.", "tier": "yellow" }, + "/obj/item/organ/cyberimp/cyberware/slipwire/milspec": { + "confidence": "medium", + "group": "Nerves and stuns", + "hash": "", + "name": "Weaver shunt", + "note": "While the bearer has moved within the last second, a hostile projectile has a 20% chance to be dodged with a visible sidestep and the round flies on; shooters 1 tile away always hit, and it doesn't work lying down, buckled or unconscious. Also gives a speed bonus (-0.15 slowdown). With other dodge sources only the highest chance counts, so a Cascade window's 40% still wins, and everything here is off while the ware is EMP'd or browned out.", + "rank": 2, + "reason": "20% of bullets miss while you're moving, never from an adjacent shooter, and you run a little faster than a Slipwire. Takes the slot Dead Channel wants. Load 5, 3 vouchers at reputation 11.", + "tier": "red" + }, + "/obj/item/organ/cyberimp/cyberware/slipwire/street": { + "confidence": "medium", + "group": "Nerves and stuns", + "hash": "", + "name": "Twitchwire", + "note": "While the bearer has moved within the last second, a hostile projectile has an 8% chance to be dodged with a visible sidestep and the round flies on; shooters 1 tile away always hit, and it doesn't work lying down, buckled or unconscious. No speed bonus. With other dodge sources only the highest chance counts, and it is off while the ware is EMP'd or browned out.", + "rank": 9, + "reason": "8% of bullets miss while you're moving, never from an adjacent shooter, and nothing else. A cheap taste of the Slipwire in the slot Dead Channel wants. Load 2, 1,800 cr at reputation 4.", + "tier": "yellow" + }, + "/obj/item/organ/cyberimp/cyberware/subvocal_mic": { + "confidence": "medium", + "group": "Mobility and stealth", + "hash": "", + "name": "Subvocal mic", + "note": "While online, a radio line the wearer speaks (headset, department or intercom) is spoken at range 0 instead of 1: the wearer and anyone on their tile hear it, a neighbour one tile away gets the usual garbled eavesdrop copy, and nobody further hears it. Ordinary talk is unchanged. It goes off during an EMP reboot or brownout.", + "rank": 10, + "reason": "Radio talk is not overheard by anyone standing close. A small edge for sneaking and boarding. Load 1, 600 cr.", + "tier": "green" + }, "/obj/item/organ/cyberimp/eyes/hud/diagnostic": { "confidence": "high", "group": "Scouting and sight", "hash": "bc1a71fec9d46258", "name": "diagnostic HUD implant", - "rank": 5, + "rank": 6, "reason": "A diagnostic HUD with no glasses. Shows machine and robot health, for engineers.", "tier": "green" }, @@ -521,7 +836,7 @@ "group": "Scouting and sight", "hash": "4beab53dff56918d", "name": "medical HUD implant", - "rank": 3, + "rank": 4, "reason": "A health HUD with no glasses, same job as the green goggles but the eye slot stays free. About 30 cr of material, or found on two hulls.", "tier": "green" }, @@ -530,7 +845,7 @@ "group": "Scouting and sight", "hash": "91681c47158b6422", "name": "security HUD implant", - "rank": 4, + "rank": 5, "reason": "A security HUD with no glasses. Names and wanted status, nothing that wins a fight.", "tier": "green" }, @@ -539,7 +854,7 @@ "group": "Body upkeep", "hash": "81096fd3e55913d0", "name": "breathing tube implant", - "rank": 3, + "rank": 4, "reason": "Use internals with no mask, which frees the mask slot, and you can't be choked. About 2 cr of material after 200 research points.", "tier": "green" } diff --git a/tools/gear_catalog/ratings/guns.json b/tools/gear_catalog/ratings/guns.json index efe8bbffc2b..93472b5b67c 100644 --- a/tools/gear_catalog/ratings/guns.json +++ b/tools/gear_catalog/ratings/guns.json @@ -591,6 +591,15 @@ }, "tier": "yellow" }, + "/obj/item/gun/ballistic/revolver/cyberware_holdout": { + "confidence": "medium", + "group": "sidearms", + "hash": "", + "name": "holdout revolver", + "rank": 14, + "reason": "A .38 revolver folded into the forearm: 25 damage, six shots, about 2.5 a second. Can't be disarmed while deployed, and every reload is a round at a time by hand.", + "tier": "yellow" + }, "/obj/item/gun/ballistic/revolver/golden": { "confidence": "medium", "group": "sidearms", diff --git a/tools/gear_catalog/ratings/melee.json b/tools/gear_catalog/ratings/melee.json index a7568c8fc05..ad2dbd69153 100644 --- a/tools/gear_catalog/ratings/melee.json +++ b/tools/gear_catalog/ratings/melee.json @@ -1161,19 +1161,48 @@ "hash": "c34e783490904319", "name": "Widowline monowire", "note": "Each landed hit adds 5 burn damage and cleaves every living mob next to the target that the target can see and that is not on the wielder's crew team, for 75% of the hit's damage in brute and burn. Its armour penetration is the full 100.", - "rank": 1, + "rank": 2, "reason": "Rated with its arm housing: 25 a second through any armor at 2 tiles, and the hit carries into every enemy beside the target. Hidden until used. Needs surgery.", "tier": "red" }, + "/obj/item/melee/cyberware_monowire/live": { + "confidence": "medium", + "group": "arm blades", + "hash": "", + "name": "Widowline Arc monowire", + "note": "Each landed hit also shocks the target for 5 burn and a short stagger (not through shock immunity or insulated suits), adds 25 burn on silicons, mechs and robotic mobs, and shorts a turret, ship laser turret, console or camera for 5 s, once per 15 s. The cleave neighbours take the plain cleave only.", + "rank": 1, + "reason": "Rated with its arm housing: the Widowline wire with a shock, a stagger and a machine-killing short on every landed hit. Needs surgery.", + "tier": "red" + }, "/obj/item/melee/energy/blade/hardlight/cyberware_mantis": { "confidence": "medium", "group": "arm blades", "hash": "e09509a45772dc39", "name": "mantis blade", - "rank": 2, + "rank": 4, "reason": "Rated with its arm housing: 20 force blades that cannot be disarmed, and a 5 tile lunge every 20 s that floors the target for 2 s. Needs surgery.", "tier": "red" }, + "/obj/item/melee/energy/blade/hardlight/cyberware_mantis/scorch": { + "confidence": "medium", + "group": "arm blades", + "hash": "", + "name": "scorch blade", + "note": "Each landed cut adds 2 fire stacks and sets the target alight. Corpses are left alone and the wielder is never lit.", + "rank": 3, + "reason": "Rated with its arm housing: the Mantis blade and lunge, with every cut and the lunge setting the target alight. Needs surgery.", + "tier": "red" + }, + "/obj/item/melee/energy/blade/hardlight/cyberware_mantis/street": { + "confidence": "medium", + "group": "arm blades", + "hash": "", + "name": "shiv blade", + "rank": 5, + "reason": "Rated with its arm housing: 14 force blades that cannot be disarmed, no lunge. Needs surgery.", + "tier": "yellow" + }, "/obj/item/melee/energy/sword/pirate": { "confidence": "high", "group": "energy blades", @@ -1315,7 +1344,7 @@ "group": "arm blades", "hash": "63a21bf583afc355", "name": "synthetic arm blade", - "rank": 3, + "rank": 6, "reason": "20 force blade grown on a hacked limb grower. Huge, no parry. The route was not fully traced.", "tier": "green" }, diff --git a/tools/gear_catalog/ratings/organs.json b/tools/gear_catalog/ratings/organs.json index fba7540a1e9..10e7be33481 100644 --- a/tools/gear_catalog/ratings/organs.json +++ b/tools/gear_catalog/ratings/organs.json @@ -429,7 +429,7 @@ "group": "Eyes", "hash": "970e50f04a7a2db8", "name": "eyes", - "rank": 18, + "rank": 23, "reason": "Plain replacement eyes.", "tier": "none" }, @@ -438,7 +438,7 @@ "group": "Eyes", "hash": "07ec6668fecdcd61", "name": "moth eyes", - "rank": 19, + "rank": 24, "reason": "Plain replacement eyes.", "tier": "none" }, @@ -447,7 +447,7 @@ "group": "Eyes", "hash": "3e1ed2dde4757134", "name": "fung-eye", - "rank": 8, + "rank": 11, "reason": "Night vision you can toggle, with no neural load. Placed in one jungle ruin. Same job as night vision goggles.", "tier": "yellow" }, @@ -456,7 +456,7 @@ "group": "Eyes", "hash": "84a3161d476535dd", "name": "robotic eyes", - "rank": 11, + "rank": 16, "reason": "A working pair of robotic eyes, no better than your own.", "tier": "none" }, @@ -465,7 +465,7 @@ "group": "Eyes", "hash": "7cc5a72a291dbd8a", "name": "basic robotic eyes", - "rank": 13, + "rank": 18, "reason": "Cheap replacement eyes, weak to flashes.", "tier": "none" }, @@ -474,7 +474,7 @@ "group": "Eyes", "hash": "4ba3d5231be60398", "name": "basic robotic moth eyes", - "rank": 14, + "rank": 19, "reason": "Cheap replacement eyes, weak to flashes.", "tier": "none" }, @@ -483,8 +483,8 @@ "group": "Eyes", "hash": "8ea026e0bf1e0602", "name": "Deadeye link", - "rank": 5, - "reason": "Tag a target and your next three shots curve onto it, every 25 s. Bullets stop missing for a burst, but the target gets a warning and walls stop it. Load 3, 2 vouchers with no reputation.", + "rank": 7, + "reason": "Tag a target and your next three shots curve onto it, every 25 s. Bullets stop missing for a burst, but the target gets a warning and walls stop it. Also zooms about 14 tiles out at a slight slowdown, though nobody can shoot while zoomed. Load 3, 2 vouchers at yellow reputation.", "tier": "yellow" }, "/obj/item/organ/eyes/robotic/cyberware/nightshade": { @@ -493,8 +493,8 @@ "hash": "030567541e7e32a4", "name": "Nightshade optics", "note": "Gives night vision with a green tint and puts a glow, visible only to the wearer, on every living body in view even in the dark (corpses glow dimmer). Flash protection stays at the robotic default, and its chrome scan only counts implants without naming them.", - "rank": 6, - "reason": "Night vision with no flash weakness and a glow on every living body in view. Beats night vision goggles for 600 cr and load 1.", + "rank": 8, + "reason": "Night vision with no flash weakness and a glow on every living body in view. Beats night vision goggles for 600 cr and load 1. Also zooms about 9 tiles out at a walk.", "tier": "yellow" }, "/obj/item/organ/eyes/robotic/cyberware/prospector": { @@ -502,8 +502,8 @@ "group": "Eyes", "hash": "5f70c88fa7552793", "name": "Prospector Suite optics", - "rank": 7, - "reason": "A pulse every 10 s shows ore through rock and loot caches within 9 tiles. Great for mining and ruin crews, no help in a fight. Load 2, 2 vouchers.", + "rank": 10, + "reason": "A pulse every 10 s shows ore through rock and loot caches within 9 tiles. Great for mining and ruin crews, no help in a fight. Also zooms about 14 tiles out at a slight slowdown. Load 2, 1 voucher at yellow reputation.", "tier": "yellow" }, "/obj/item/organ/eyes/robotic/flashlight": { @@ -511,7 +511,7 @@ "group": "Eyes", "hash": "31bf05befe1e2bdf", "name": "flashlight eyes", - "rank": 17, + "rank": 22, "reason": "Flashlights strapped into your skull. You can't see through them. A joke.", "tier": "none" }, @@ -520,7 +520,7 @@ "group": "Eyes", "hash": "121bc2c724450f5d", "name": "high luminosity eyes", - "rank": 15, + "rank": 20, "reason": "A coloured torch in your face. Useful in the dark, costs a load.", "tier": "none" }, @@ -529,7 +529,7 @@ "group": "Eyes", "hash": "880f3fcfed561cbf", "name": "high luminosity moth eyes", - "rank": 16, + "rank": 21, "reason": "A coloured torch in your face. Useful in the dark, costs a load.", "tier": "none" }, @@ -538,7 +538,7 @@ "group": "Eyes", "hash": "1719a4848fac0fdb", "name": "robotic moth eyes", - "rank": 12, + "rank": 17, "reason": "A working pair of robotic eyes, no better than your own.", "tier": "none" }, @@ -547,7 +547,7 @@ "group": "Eyes", "hash": "5d54a8f40d09d8b4", "name": "shielded robotic eyes", - "rank": 9, + "rank": 14, "reason": "Flash immunity with no tint, and EMP proof. Better sunglasses that don't take the slot. About 2 cr of material.", "tier": "green" }, @@ -556,7 +556,7 @@ "group": "Eyes", "hash": "617e9ddf30f1f6f4", "name": "shielded robotic moth eyes", - "rank": 10, + "rank": 15, "reason": "Moth looks on shielded eyes. Flash immunity with no tint.", "tier": "green" }, @@ -565,7 +565,7 @@ "group": "Eyes", "hash": "2abaf20763c58a3e", "name": "thermal eyes", - "rank": 3, + "rank": 4, "reason": "Same sight as thermal goggles, every living thing through walls, but sunglasses over them cancel the flash weakness. Better than the goggles, and they print with no reputation. An EMP flashes them.", "tier": "yellow" }, @@ -574,7 +574,7 @@ "group": "Eyes", "hash": "1436defdd6c14505", "name": "thermal moth eyes", - "rank": 4, + "rank": 5, "reason": "Same as thermal eyes with moth looks. Living things through walls, flash weak.", "tier": "yellow" }, @@ -601,7 +601,7 @@ "group": "Eyes", "hash": "927d6a5cf2f19d2f", "name": "snail eyes", - "rank": 20, + "rank": 25, "reason": "Plain replacement eyes.", "tier": "none" }, diff --git a/tools/gear_catalog/ratings/tools.json b/tools/gear_catalog/ratings/tools.json index 80c6cfaaa21..53f65496042 100644 --- a/tools/gear_catalog/ratings/tools.json +++ b/tools/gear_catalog/ratings/tools.json @@ -1446,7 +1446,7 @@ "group": "Mining tools", "hash": "16ae32694e632739", "name": "manual mining scanner", - "rank": 19, + "rank": 20, "reason": "Manual ore scanner. Click for a look at nearby ore. Common on hulls.", "tier": "none" }, @@ -1539,7 +1539,7 @@ "group": "Mining tools", "hash": "c2024f595b1ac958", "name": "ore sensor", - "rank": 20, + "rank": 21, "reason": "Crafted bone ore sensor. Small range and it needs brimdust to make.", "tier": "none" }, @@ -1557,7 +1557,7 @@ "group": "Mining tools", "hash": "971c85bf93572b1b", "name": "pickaxe", - "rank": 14, + "rank": 15, "reason": "Plain pick. Prints at round start and hits for 15, but it's heavy to carry.", "tier": "none" }, @@ -1566,7 +1566,7 @@ "group": "Mining tools", "hash": "b938dac87ca2790e", "name": "diamond-tipped pickaxe", - "rank": 7, + "rank": 8, "reason": "Digs in about a third of the normal time. 1,200 cr at the green waystation, a fair first upgrade.", "tier": "green" }, @@ -1584,7 +1584,7 @@ "group": "Mining tools", "hash": "a8467bba7110047c", "name": "mining drill", - "rank": 10, + "rank": 11, "reason": "Digs at a little over half the normal time. Cheap and printable after 40 research points. The usual first upgrade.", "tier": "green" }, @@ -1593,10 +1593,19 @@ "group": "Mining tools", "hash": "093655e5e5394734", "name": "rockjaw drill", - "rank": 8, + "rank": 9, "reason": "Implant drill. Half-time digging with your hands free. The implant is the real purchase.", "tier": "green" }, + "/obj/item/pickaxe/drill/cyberware/deepcore": { + "confidence": "medium", + "group": "Mining tools", + "hash": "", + "name": "deepcore drill", + "rank": 7, + "reason": "Implant drill. Digs in under a third of the usual time with your hands free, between the rockjaw drill and a diamond drill. The implant is the real purchase.", + "tier": "green" + }, "/obj/item/pickaxe/drill/diamonddrill": { "confidence": "medium", "group": "Mining tools", @@ -1620,7 +1629,7 @@ "group": "Mining tools", "hash": "971c85bf93572b1b", "name": "emergency disembarkation tool", - "rank": 15, + "rank": 16, "reason": "Plain-speed pick from emergency kits. Hits for 15, but it's heavy to carry.", "tier": "none" }, @@ -1629,7 +1638,7 @@ "group": "Mining tools", "hash": "e44656dab7dcaa9d", "name": "improvised pickaxe", - "rank": 17, + "rank": 18, "reason": "Taped-together pick at a third of the normal speed. Better than bare hands.", "tier": "none" }, @@ -1638,7 +1647,7 @@ "group": "Mining tools", "hash": "f0d10d8ea21ed503", "name": "compact pickaxe", - "rank": 14, + "rank": 15, "reason": "Plain-speed pick in a smaller size.", "tier": "none" }, @@ -1647,7 +1656,7 @@ "group": "Mining tools", "hash": "0dc2d79772498eca", "name": "rusty pickaxe", - "rank": 16, + "rank": 17, "reason": "Plain-speed pick from a scrap crate.", "tier": "none" }, @@ -1656,7 +1665,7 @@ "group": "Mining tools", "hash": "d955462ef7f3820e", "name": "silver-plated pickaxe", - "rank": 9, + "rank": 10, "reason": "Half-time digging for 1,000 mining points.", "tier": "green" }, @@ -1674,7 +1683,7 @@ "group": "Mining tools", "hash": "dab2a22ec6f7f472", "name": "material sniffer", - "rank": 22, + "rank": 23, "reason": "Crafted from an analyzer and some cable. Points at loose sheets of iron and glass. Minor.", "tier": "none" }, @@ -1701,7 +1710,7 @@ "group": "Mining tools", "hash": "adad44b7c8924f21", "name": "ventpointer", - "rank": 21, + "rank": 22, "reason": "Points at nearby ore vents. 800 mining points for a shortcut you can walk.", "tier": "none" }, @@ -2195,7 +2204,7 @@ "group": "Mining tools", "hash": "a8c7ee47f9855f4e", "name": "shovel", - "rank": 18, + "rank": 19, "reason": "Plain shovel, 8 force. Prints at round start.", "tier": "none" }, @@ -2215,7 +2224,7 @@ "hash": "39a661a6f4799dbe", "name": "dull bone shovel", "note": "With combat mode on, each hit on an organic mob (and each thrown hit) adds a second hit equal to its own force (10; 8 for the dull version) to the same limb, and does nothing extra to robots or other non-organic mobs. Digs at tool speed 0.3 (0.8 dull).", - "rank": 11, + "rank": 12, "reason": "Dull bone shovel: each hit on an organic lands twice for 16. Slower dig. One ruin.", "tier": "green" }, @@ -2224,7 +2233,7 @@ "group": "Mining tools", "hash": "6d36ec3489795240", "name": "spade", - "rank": 18, + "rank": 19, "reason": "Garden spade.", "tier": "none" }, @@ -2386,7 +2395,7 @@ "group": "Mining tools", "hash": "949739cf35df0bb0", "name": "advanced automatic mining scanner", - "rank": 12, + "rank": 13, "reason": "Shows ore within 7 tiles on its own. 300 cr at the green waystation. Right price, right place.", "tier": "green" }, @@ -2395,7 +2404,7 @@ "group": "Mining tools", "hash": "7c5b6654d9cb653b", "name": "automatic mining scanner", - "rank": 13, + "rank": 14, "reason": "Shows ore within 4 tiles on its own, more slowly. Common on hulls.", "tier": "green" }, diff --git a/voidcrew/_DEFINES/cyberware.dm b/voidcrew/_DEFINES/cyberware.dm index 02a5ffdaa13..cf6eb52c4f0 100644 --- a/voidcrew/_DEFINES/cyberware.dm +++ b/voidcrew/_DEFINES/cyberware.dm @@ -11,12 +11,19 @@ #define CYBERWARE_BIOTECH_CAPACITY 15 #define TRAIT_BIOTECH_NEURAL "biotech_neural" -/// Mob-overlay height worn chrome draws at: between the character-setup -/// underwear/undershirt layer (BODY_LAYER, 32) and the eyes (EYES_LAYER, 31), -/// so a spine rig reads over a bra or undershirt while every EQUIPPED -/// clothing layer (UNIFORM_LAYER 28 and up) still covers it. Fractional on -/// purpose, it must never collide with a real layer index. -#define CYBERWARE_WORN_LAYER 31.5 +/// Mob-overlay height worn chrome draws at: just over the jumpsuit +/// (UNIFORM_LAYER, 28) and under the worn ID (ID_LAYER, 27), so arm plates and +/// a spine rig read over normal clothes while hands (BODYPARTS_HIGH_LAYER 25), +/// gloves, shoes and every suit, vest or armour layer (SUIT_LAYER 19 and up) +/// still cover them. Mob layers count down: a lower number draws on top. +/// Fractional on purpose, it must never collide with a real layer index, nor +/// with a fresh stump (HV_STUMP_FRESH_LAYER, 27.5). +#define CYBERWARE_WORN_LAYER 27.6 +/// Mob layer the lit nodes of a spine rig (Cascade, Redline) shine at: just over +/// whatever is worn on the back (BACK_LAYER 14, and every suit and cloak under +/// it), still under hair (HAIR_LAYER 13) and headgear. Only what glows goes up +/// here; the housing and dark nodes stay at CYBERWARE_WORN_LAYER. +#define CYBERWARE_SPINE_SHINE_LAYER 13.7 // ---- Organ slots ------------------------------------------------------- // Minted here, never in DNA.dm. Slot uniqueness is global per mob, so @@ -150,3 +157,100 @@ /// Minimum environmental O2 partial pressure (kPa) the bladder considers /// breathable, mirroring the lungs' safe_oxygen_min of 16. #define CYBERWARE_BREATHABLE_O2_KPA 16 + +// ---- Optics zoom (cyberware_zoom.dm) ----------------------------------- +// Every set of chrome optics can zoom: tg's scope component pans the camera +// toward the cursor. A zoomed bearer can't fire a gun and their clicks reach +// nothing on the map. + +/// Held by a bearer while their chrome optics are zoomed. Source is the optics. +#define TRAIT_CYBER_ZOOMED "cyber_zoomed" + +// ---- Chrome wheel (chrome_wheel.dm) ------------------------------------ + +/// Name of the "Chrome wheel" keybind; the release poll reads the player's +/// keys for it to catch modifier binds, which never get a keyUp of their own. +#define CHROME_WHEEL_KEYBIND "chrome_wheel" +/// A wheel key let go sooner than this was a tap, and the wheel stays open +/// for a click instead of closing on release. +#define CHROME_WHEEL_HOLD_TIME (0.3 SECONDS) + +/// Wheel states. CLOSED, HELD (open while the key is down) or CLICK (open +/// after a tap, until the next click or press). +#define CHROME_WHEEL_CLOSED 0 +#define CHROME_WHEEL_HELD 1 +#define CHROME_WHEEL_CLICK 2 + +/// Sockets: where a ware's chips sit on the ring. Each owns a run of fixed +/// positions on its region's arc, so one socket's chrome changing never moves +/// another socket's chips. Hand chrome rides its arm's socket. +#define CHROME_WHEEL_SOCKET_EYES "eyes" +#define CHROME_WHEEL_SOCKET_HEAD "head" +#define CHROME_WHEEL_SOCKET_OS "os" +#define CHROME_WHEEL_SOCKET_SKIN "skin" +#define CHROME_WHEEL_SOCKET_LEFT_ARM "l_arm" +#define CHROME_WHEEL_SOCKET_RIGHT_ARM "r_arm" +#define CHROME_WHEEL_SOCKET_LEGS "legs" + +/// Radius in pixels of the ring the chips sit on. +#define CHROME_WHEEL_RADIUS 100 +/// Degrees between neighbouring chips on the ring. +#define CHROME_WHEEL_STEP 14.5 +/// A socket with more chips than its arc holds starts another row this much +/// further out, at the same angles. +#define CHROME_WHEEL_ROW_GAP 26 +/// The ring's centre sits this many pixels above the centre of the view. +#define CHROME_WHEEL_CENTRE_Y 2 +/// Mouse distance from the ring centre inside which nothing is pointed at. +#define CHROME_WHEEL_DEADZONE 34 +/// A chip this close to the mouse is the one under it. +#define CHROME_WHEEL_PICK_RANGE 12 +/// Otherwise the mouse points at the first-row chip whose bearing from the ring +/// centre is nearest its own, if one lies within this many degrees. +#define CHROME_WHEEL_POINT_TOLERANCE 13 + +/// After a pick the wheel stays up this long for the lock and fade. The pick +/// itself lands at once. +#define CHROME_WHEEL_LINGER_TIME (0.2 SECONDS) +/// A wheel opened from the Chrome button fires what a click picks, so a click +/// further than this from the ring's centre picks by bearing no more: out past +/// the second row, a click just shuts the wheel. +#define CHROME_WHEEL_FIRE_REACH (CHROME_WHEEL_RADIUS + CHROME_WHEEL_ROW_GAP + 24) +/// Reserves Arm chrome's place on the wheel (GLOB.chrome_wheel_reserved), as an +/// organ slot reserves its ware's. +#define CHROME_WHEEL_ARMS_KEY "chrome_arms" +/// The region an Arm chrome chip lights: both arms. +#define CHROME_WHEEL_REGION_ARMS "arms" +/// The Chrome button's and Arm chrome's own art. +#define CHROME_HUD_ICON 'voidcrew/modules/cyberware/icons/chrome_hud.dmi' + +#define CHROME_WHEEL_ICON 'voidcrew/modules/cyberware/icons/chrome_wheel.dmi' +/// 240x240 art centred on the ring: body, arcs, leaders, glows, backdrop. +#define CHROME_WHEEL_RING_ICON 'voidcrew/modules/cyberware/icons/chrome_wheel_ring.dmi' +/// Corner brackets borrowed from the chrome read. +#define CHROME_WHEEL_BRACKET_ICON 'voidcrew/modules/cyberware/icons/chrome_read.dmi' + +/// Wheel colours, the chrome read's own. +#define CHROME_WHEEL_HUD_COLOR CYBERWARE_COLOR_TIER_2 +#define CHROME_WHEEL_PANEL_COLOR "#060e12" +#define CHROME_WHEEL_NAME_COLOR "#e6fbff" +#define CHROME_WHEEL_DIM_COLOR "#8fa1a8" +#define CHROME_WHEEL_OFFLINE_COLOR "#ff5a4a" +#define CHROME_WHEEL_OFFLINE_NAME_COLOR "#7d8a90" +/// The pick's brackets (radial.dmi's module_selected cyan). +#define CHROME_WHEEL_PICKED_COLOR "#00ffff" +/// Deployed or armed (radial.dmi's module_active green). +#define CHROME_WHEEL_DEPLOYED_COLOR "#00ff00" + +// ---- Phase 2 models: seal, frame and nervous street models ------------- +// ware_models_b.dm. Hardweave, the Strut frame, the Deep-lung bladder, the +// Heat-sink and Frostline linings, the Twitchwire and Weaver shunts, and the +// Thumper ear. + +/// Held by a bearer whose skeleton simply does not break. Blocks the whole +/// bone wound series, dislocations, hairline fractures, compound fractures, +/// at the wound system's own gate, and nothing else. Every other wound series +/// lands on its bearer exactly as it lands on anyone. Granted by the Atlas +/// frame (ware_military_body.dm) and the Strut frame (ware_models_b.dm); the +/// gate itself is in ware_military_body.dm. +#define TRAIT_CYBERWARE_UNBREAKABLE_BONES "cyberware_unbreakable_bones" diff --git a/voidcrew/_maps/map_files/outposts/trader_outpost_outfitter.dmm b/voidcrew/_maps/map_files/outposts/trader_outpost_outfitter.dmm index 2d4848184b2..82854e88a5b 100644 --- a/voidcrew/_maps/map_files/outposts/trader_outpost_outfitter.dmm +++ b/voidcrew/_maps/map_files/outposts/trader_outpost_outfitter.dmm @@ -372,6 +372,10 @@ /obj/effect/landmark/outpost_network_pad_spot, /turf/open/indestructible/dark, /area/voidcrew/trader_outpost/checkpoint) +"bc" = ( +/obj/structure/sink/directional/north, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "bd" = ( /obj/effect/turf_decal/arrows{ dir = 2 @@ -748,6 +752,10 @@ }, /turf/open/indestructible/dark/smooth_large, /area/voidcrew/trader_outpost) +"dg" = ( +/obj/effect/decal/cleanable/blood/gibs/robot_debris/old, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "dD" = ( /obj/effect/turf_decal/stripes, /obj/effect/turf_decal/siding/thinplating_new/dark{ @@ -1043,6 +1051,13 @@ }, /turf/open/indestructible, /area/voidcrew/trader_outpost) +"gS" = ( +/obj/item/trash/can{ + pixel_w = -6; + pixel_z = -4 + }, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "gT" = ( /obj/effect/turf_decal/siding/thinplating_new/dark, /obj/effect/decal/cleanable/dirt, @@ -1171,6 +1186,9 @@ /obj/effect/decal/cleanable/dirt, /turf/open/indestructible/dark/smooth_large, /area/voidcrew/trader_outpost) +"iQ" = ( +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "iR" = ( /obj/effect/turf_decal/siding/thinplating_new/dark{ dir = 8 @@ -1292,6 +1310,12 @@ /obj/effect/decal/cleanable/dirt, /turf/open/indestructible/large, /area/voidcrew/trader_outpost) +"ku" = ( +/obj/structure/rack, +/obj/structure/sign/poster/contraband/cybersun_six_hundred/directional/north, +/obj/effect/decal/cleanable/dirt, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "kv" = ( /obj/effect/turf_decal/siding/thinplating_new/dark/corner{ dir = 1 @@ -1377,6 +1401,14 @@ }, /turf/open/indestructible/large, /area/voidcrew/trader_outpost) +"ld" = ( +/obj/structure/table, +/obj/item/cigbutt{ + pixel_w = 5; + pixel_z = 7 + }, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "lw" = ( /obj/structure/rack, /obj/effect/turf_decal/trimline/red/filled/line{ @@ -1402,6 +1434,11 @@ "ly" = ( /turf/open/indestructible/dark, /area/voidcrew/trader_outpost) +"lz" = ( +/mob/living/basic/outpost_trader/ripperdoc/street_doc, +/obj/machinery/light/small/dim/directional/north, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "lE" = ( /obj/structure/window/reinforced/shuttle/indestructible, /turf/open/indestructible/plating, @@ -1533,6 +1570,10 @@ }, /turf/open/indestructible/dark, /area/voidcrew/trader_outpost) +"nV" = ( +/obj/machinery/light/small/directional/west, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "oi" = ( /obj/effect/turf_decal/siding/wideplating_new/dark{ dir = 1 @@ -1631,18 +1672,6 @@ /obj/machinery/newscaster/directional/east, /turf/open/indestructible/dark, /area/voidcrew/trader_outpost) -"pC" = ( -/obj/effect/turf_decal/tile/yellow/anticorner/contrasted{ - dir = 4 - }, -/obj/effect/turf_decal/siding/thinplating_new{ - dir = 5 - }, -/obj/item/kirbyplants/organic/plant22, -/obj/effect/decal/cleanable/cobweb/cobweb2, -/obj/effect/decal/cleanable/dirt, -/turf/open/indestructible, -/area/voidcrew/trader_outpost) "pE" = ( /obj/effect/turf_decal/tile/dark/full, /obj/effect/invisible_wall, @@ -1731,6 +1760,11 @@ /obj/effect/decal/cleanable/dirt/dust, /turf/open/indestructible/dark/textured, /area/voidcrew/trader_outpost) +"qA" = ( +/obj/structure/fluff/shower_drain, +/obj/effect/decal/cleanable/blood/old, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "qN" = ( /obj/structure/closet/crate/secure{ name = "chassis crate"; @@ -1757,6 +1791,12 @@ /obj/effect/decal/cleanable/dirt, /turf/open/indestructible/large, /area/voidcrew/trader_outpost) +"qZ" = ( +/obj/machinery/door/airlock/maintenance{ + name = "Back Bay" + }, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "rd" = ( /obj/effect/turf_decal/trimline/yellow/filled/line{ dir = 8 @@ -1771,6 +1811,10 @@ /obj/structure/chair/office/light, /turf/open/indestructible/large, /area/voidcrew/trader_outpost) +"rg" = ( +/obj/structure/closet/crate/bin, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "rj" = ( /obj/structure/table/reinforced/rglass, /obj/structure/desk_bell{ @@ -1813,6 +1857,16 @@ /obj/effect/decal/cleanable/dirt, /turf/open/indestructible, /area/voidcrew/trader_outpost) +"sd" = ( +/obj/machinery/porta_turret/outpost, +/obj/effect/turf_decal/box/red/corners{ + dir = 1 + }, +/obj/effect/turf_decal/box/red/corners{ + dir = 8 + }, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "sf" = ( /obj/structure/closet/secure_closet/outpost_rental, /obj/effect/turf_decal/siding/wideplating_new/dark{ @@ -1828,6 +1882,14 @@ }, /turf/open/indestructible/dark, /area/voidcrew/trader_outpost) +"sh" = ( +/obj/structure/closet/crate{ + anchored = 1; + name = "parts crate" + }, +/obj/effect/decal/cleanable/cobweb, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "si" = ( /obj/effect/turf_decal/siding/wideplating_new/dark{ dir = 4 @@ -1928,6 +1990,14 @@ }, /turf/open/indestructible/large, /area/voidcrew/trader_outpost) +"tf" = ( +/obj/structure/table, +/obj/structure/fluff/paper/stack{ + pixel_w = -3; + pixel_z = 3 + }, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "tj" = ( /obj/structure/closet/secure_closet/outpost_rental, /obj/effect/turf_decal/siding/wideplating_new/dark{ @@ -1959,6 +2029,11 @@ }, /turf/open/indestructible/large, /area/voidcrew/trader_outpost) +"tD" = ( +/obj/machinery/chrome_cradle, +/obj/effect/decal/cleanable/blood/old, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "tH" = ( /obj/effect/turf_decal/siding/thinplating_new/corner{ dir = 4 @@ -2075,6 +2150,10 @@ /obj/machinery/light/floor, /turf/open/indestructible, /area/voidcrew/trader_outpost) +"uM" = ( +/obj/effect/decal/cleanable/dirt, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "vb" = ( /obj/structure/fluff/paper/stack{ dir = 1; @@ -2190,6 +2269,10 @@ }, /turf/open/indestructible/white/smooth_large, /area/voidcrew/trader_outpost) +"wK" = ( +/obj/machinery/light/cold/directional/east, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "wM" = ( /obj/structure/table, /obj/item/storage/medkit/regular, @@ -2375,6 +2458,11 @@ /obj/machinery/light/directional/north, /turf/open/indestructible/large, /area/voidcrew/trader_outpost) +"zp" = ( +/obj/structure/rack, +/obj/effect/decal/cleanable/cobweb/cobweb2, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "zw" = ( /obj/structure/chair{ dir = 1 @@ -2629,6 +2717,11 @@ }, /turf/open/indestructible/dark, /area/voidcrew/trader_outpost) +"CD" = ( +/obj/structure/chair/stool, +/obj/effect/decal/cleanable/dirt, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "CQ" = ( /obj/effect/turf_decal/tile/yellow/half/contrasted{ dir = 8 @@ -2765,6 +2858,19 @@ }, /turf/open/indestructible, /area/voidcrew/trader_outpost) +"EW" = ( +/obj/effect/turf_decal/tile/yellow/anticorner/contrasted{ + dir = 4 + }, +/obj/effect/turf_decal/siding/thinplating_new{ + dir = 5 + }, +/obj/item/kirbyplants/organic/plant22, +/obj/effect/decal/cleanable/cobweb/cobweb2, +/obj/effect/decal/cleanable/dirt, +/obj/structure/sign/poster/contraband/interdyne_gene_clinics/directional/east, +/turf/open/indestructible, +/area/voidcrew/trader_outpost) "EX" = ( /obj/effect/turf_decal/tile/dark/full, /obj/effect/invisible_wall, @@ -2778,6 +2884,14 @@ /obj/item/radio/intercom/directional/north, /turf/open/indestructible/hoteltile, /area/voidcrew/trader_outpost) +"Ff" = ( +/obj/structure/table, +/obj/structure/desk_bell{ + pixel_w = 0; + pixel_z = 4 + }, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "Fx" = ( /obj/structure/closet/secure_closet/outpost_rental, /obj/effect/turf_decal/siding/wideplating_new/dark{ @@ -2836,6 +2950,10 @@ }, /turf/open/indestructible, /area/voidcrew/trader_outpost) +"Ga" = ( +/obj/machinery/vending/wallmed/directional/east, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "Gd" = ( /obj/effect/turf_decal/siding/wideplating_new/light{ dir = 8 @@ -2854,6 +2972,10 @@ /obj/effect/decal/cleanable/dirt, /turf/open/indestructible, /area/voidcrew/trader_outpost) +"Gk" = ( +/obj/structure/mirror/directional/east, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "Gt" = ( /obj/effect/turf_decal/tile/dark/full, /obj/structure/sign/poster/official/get_your_legs{ @@ -2972,6 +3094,10 @@ }, /turf/open/indestructible, /area/voidcrew/trader_outpost) +"Iu" = ( +/obj/item/cigbutt, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "Iw" = ( /turf/open/indestructible/hoteltile, /area/voidcrew/trader_outpost) @@ -3299,6 +3425,10 @@ /obj/structure/extinguisher_cabinet/directional/west, /turf/open/indestructible, /area/voidcrew/trader_outpost) +"MB" = ( +/obj/effect/decal/cleanable/blood/drip, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "MI" = ( /obj/effect/spawner/random/trash/soap, /obj/machinery/light/small/directional/south, @@ -3314,6 +3444,10 @@ }, /turf/open/indestructible/large, /area/voidcrew/trader_outpost) +"MW" = ( +/obj/effect/decal/cleanable/blood/oil, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "Na" = ( /obj/structure/table, /obj/effect/spawner/random/food_or_drink/donkpockets, @@ -3668,6 +3802,11 @@ }, /turf/open/indestructible/dark, /area/voidcrew/trader_outpost) +"Uc" = ( +/obj/effect/decal/cleanable/blood/gibs/robot_debris/limb, +/obj/item/cigbutt, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "Ud" = ( /obj/effect/turf_decal/bot, /obj/structure/closet/crate, @@ -3924,6 +4063,10 @@ }, /turf/open/indestructible, /area/voidcrew/trader_outpost) +"ZP" = ( +/obj/structure/table, +/turf/open/indestructible/freezer, +/area/voidcrew/trader_outpost) "ZV" = ( /obj/effect/decal/cleanable/dirt/dust, /obj/machinery/light/floor, @@ -5368,7 +5511,7 @@ ai fp vS dU -pC +EW hE gQ Vl @@ -5412,7 +5555,7 @@ CS dU dU dU -dU +qZ dU dU dU @@ -5452,13 +5595,13 @@ lE lE dU dU -aV -aV -aV -aV -aV -aV -aV +sh +ZP +uM +nV +uM +rg +dU dU dU lE @@ -5492,15 +5635,15 @@ ao ao ao ao -ao -aF -aV -aV -aV -aV -aV aV dU +ku +tf +Iu +CD +uM +bc +dU dU FC oU @@ -5534,15 +5677,15 @@ ao ao ao ao -ao -ao -ao -aV -aV -aV -aV aV dU +Uc +ZP +gS +iQ +MW +dg +dU cI cY gg @@ -5576,14 +5719,14 @@ ao ao ao ao -ao -ao -ao -ao -ao -aV -aV aV +dU +lz +Ff +uM +MB +tD +qA lE aE Hd @@ -5618,14 +5761,14 @@ ao ao ao ao -ao -ao -ao -ao -ao -ao -ao -aF +aV +dU +zp +ld +Ga +Gk +wK +sd dU tj AY @@ -5660,14 +5803,14 @@ ao ao ao ao -ao -ao -ao -ao -ao -ao -ao -ao +aV +dU +dU +dU +dU +dU +dU +dU dU dU sf @@ -5702,15 +5845,15 @@ ao ao ao ao -ao -ao -ao -ao -ao -ao -ao -ao -ao +aF +aV +aV +aV +aV +aV +aV +aF +aV dU dU dU diff --git a/voidcrew/modules/admin/chrome_test_kit.dm b/voidcrew/modules/admin/chrome_test_kit.dm new file mode 100644 index 00000000000..e562911d4ef --- /dev/null +++ b/voidcrew/modules/admin/chrome_test_kit.dm @@ -0,0 +1,256 @@ +/** + * # Chrome test kit + * + * One admin verb for trying the cyberware lines without a shopping trip. It drops a Chrome + * Cradle beside the admin with a stack of trade vouchers and a holochip of credits, then offers + * a short list of ready-made builds (see GLOB.chrome_test_loadouts) that either go straight into + * the admin's own body or into a crate at their feet, plus a chromed human to point Chrome Read + * at. The dummy is a human NPC body (voidcrew/modules/human_npcs/) with no + * AI, so it is the same kind of body as the NPCs players meet: its chrome works, and burns out + * to scrap when it dies or a piece leaves it. + * + * Installs here are special inserts, the same door the unit tests use: no cradle sequence, no + * boot splash, no install context. They still obey the body's rules in two ways. A piece whose + * limb is missing is not forced into a body that cannot hold it, and a piece that would push the + * body past its neural capacity goes into the crate instead of browning the whole build out + * (the Cascade and Redline cores share the OS slot with the Governors, so the heavy builds do + * not fit on a stock body). The chat report lists what went where and the final load. + * + * Admin only (R_ADMIN|R_DEBUG), logged like the other feature-testing verbs. The loadouts are + * plain typepath lists so they are easy to retune. + */ + +/** + * The ready-made builds, in install order. Order matters twice: a piece is skipped when the + * body no longer has headroom, so the ones listed first are the ones that stay; and pairs list + * the right arm first, its left twin after. + */ +GLOBAL_LIST_INIT(chrome_test_loadouts, list( + "Blade dancer" = list( + /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/left, + /obj/item/organ/cyberimp/cyberware/cascade, + /obj/item/organ/cyberimp/cyberware/slipwire, + ), + "Tank" = list( + /obj/item/organ/cyberimp/cyberware/gorilla_arms, + /obj/item/organ/cyberimp/cyberware/gorilla_arms/left, + /obj/item/organ/cyberimp/cyberware/slabskin, + /obj/item/organ/cyberimp/cyberware/atlas, + /obj/item/organ/cyberimp/cyberware/redline, + ), + "Street kid" = list( + /obj/item/organ/cyberimp/cyberware/cascade/street, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/street, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/street/left, + /obj/item/organ/cyberimp/cyberware/ghostskin/street, + /obj/item/organ/cyberimp/cyberware/hopper/street, + /obj/item/organ/cyberimp/cyberware/clotter_node, + /obj/item/organ/cyberimp/cyberware/medic_palms, + /obj/item/organ/cyberimp/cyberware/subvocal_mic, + /obj/item/organ/cyberimp/cyberware/muffler_ear, + ), +)) + +/// The kit's menu entries that are not loadouts. +#define CHROME_KIT_EVERYTHING "Everything (one of each, in a crate)" +#define CHROME_KIT_DUMMY "Chrome dummy (a chromed human to test on)" +#define CHROME_KIT_BASICS "Cradle, vouchers and credits only" + +/// Vouchers and credits the kit hands out per use. +#define CHROME_KIT_VOUCHERS 30 +#define CHROME_KIT_CREDITS 20000 + +/** + * Every piece of chrome a ripperdoc shelf sells, one of each, as typepaths: the loose organs, + * and the cased pairs as the case (cracking it open spills both halves). Read off the shop's + * own SKU datums so it follows the roster by itself, plus the one piece no shelf sells. + */ +/proc/chrome_kit_everything_types() + var/list/found = list() + for(var/datum/shop_sku/sku_type as anything in subtypesof(/datum/shop_sku/ripperdoc)) + var/item_path = initial(sku_type.item_path) + if(!item_path || found[item_path]) + continue + if(ispath(item_path, /obj/item/organ) || ispath(item_path, /obj/item/cyberware_pair_case) || ispath(item_path, /obj/item/storage/case/cyberware)) + found[item_path] = TRUE + // The Meteor Piledriver is a mission prize, not on any shelf. + found[/obj/item/organ/cyberimp/cyberware/piledriver] = TRUE + return assoc_to_keys(found) + +/// A free turf beside the user for a prop: open floor with nothing solid on it, nearest first. +/proc/chrome_kit_adjacent_turf(atom/user) + var/turf/origin = get_turf(user) + if(!origin) + return null + for(var/direction in GLOB.cardinals) + var/turf/candidate = get_step(origin, direction) + if(!candidate || candidate.density || isspaceturf(candidate)) + continue + var/blocked = FALSE + for(var/atom/movable/occupant as anything in candidate) + if(occupant.density || istype(occupant, /obj/machinery/chrome_cradle)) + blocked = TRUE + break + if(!blocked) + return candidate + return origin + +/** + * Seats a build into a body with special inserts, in order. A piece stays out when the body has + * no limb for it, when it would not fit under the body's neural capacity (the same netted check + * the cradle uses, so a same-slot swap counts) or when the insert is refused. Returns the + * organs left over, ready for a crate; `report` collects a plain line per piece for the chat + * report. + */ +/proc/chrome_kit_install(mob/living/carbon/target, list/ware_types, list/report) + var/list/left_over = list() + var/turf/here = get_turf(target) + for(var/ware_type in ware_types) + var/obj/item/organ/ware = new ware_type(here) + var/reason + if(!target.get_bodypart(deprecise_zone(ware.zone))) + reason = "no limb for it" + else if(!cyberware_insert_check(ware, target, silent = TRUE)) + reason = "no neural headroom" + else if(!ware.Insert(target, special = TRUE)) + reason = "the body refused it" + if(reason) + report += "[ware.name] left out ([reason])" + left_over += ware + return left_over + +/** + * The kit's dummy: a human NPC body with no AI (it never moves, fights or barks), in a grey + * jumpsuit, on no side anyone fights for. Being an NPC body is the point: its chrome burns out at + * death and when a piece leaves it, as on every NPC players meet. + */ +/mob/living/carbon/human/npc/chrome_dummy + ai_controller = null + npc_name = "Chrome dummy" + npc_outfit = /datum/outfit/chrome_dummy + faction = list(FACTION_NEUTRAL) + npc_voice = null + npc_surrender = null + +/datum/outfit/chrome_dummy + name = "Chrome dummy" + uniform = /obj/item/clothing/under/color/grey + +/** + * A chrome dummy at `where` carrying what fits of `ware_types` (chrome_kit_install(); pieces that + * don't fit are deleted, so the dummy keeps only what fits). Returns the dummy. + */ +/proc/chrome_kit_make_dummy(turf/where, list/ware_types, list/report) + var/mob/living/carbon/human/npc/chrome_dummy/dummy = new(where) + var/list/dummy_spare = chrome_kit_install(dummy, ware_types, report) + QDEL_LIST(dummy_spare) + return dummy + +/// A crate of loose chrome at a turf. Items placed straight into the crate, so its slot count +/// never turns the big builds away. +/proc/chrome_kit_crate(turf/where, list/contents_list, crate_name = "chrome crate") + var/obj/structure/closet/crate/crate = new(where) + crate.name = crate_name + for(var/obj/item/spare in contents_list) + spare.forceMove(crate) + return crate + +/// The admin's chrome status line: load against capacity and any piece that is dark. +/proc/chrome_kit_status_line(mob/living/carbon/target) + var/load = get_chrome_load(target) + var/capacity = get_chrome_capacity(target) + var/dark = 0 + for(var/obj/item/organ/ware as anything in get_installed_cyberware(target)) + if(ware.organ_flags & ORGAN_FAILING) + dark++ + return "[length(get_installed_cyberware(target))] pieces, load [load]/[capacity][dark ? ", [dark] dark" : ""]" + +ADMIN_VERB(chrome_test_kit, R_ADMIN|R_DEBUG, "Chrome: Test Kit", "Drop a Chrome Cradle with vouchers and credits beside you, then take a ready-made chrome build (into your body or a crate) or a chromed dummy to test on.", ADMIN_CATEGORY_DEBUG) + var/mob/admin_mob = user.mob + var/turf/origin = get_turf(admin_mob) + if(!origin) + to_chat(user, span_warning("You need a physical location to drop the kit at.")) + return + + var/list/menu = list() + for(var/loadout_name in GLOB.chrome_test_loadouts) + menu += loadout_name + menu += CHROME_KIT_EVERYTHING + menu += CHROME_KIT_DUMMY + menu += CHROME_KIT_BASICS + var/choice = tgui_input_list(user, "Which build?", "Chrome Test Kit", menu) + if(!choice) + return + + // Where it goes, for the two choices that have a body to put it in. + var/into_body = FALSE + if(GLOB.chrome_test_loadouts[choice]) + if(iscarbon(admin_mob)) + var/where = tgui_input_list(user, "Install it where?", "Chrome Test Kit", list("Into my body", "Into a crate at my feet")) + if(!where) + return + into_body = where == "Into my body" + else + to_chat(user, span_notice("You have no body to install into, so the build goes in a crate.")) + + // The dummy takes any one of the builds, or a random one. + var/dummy_build + if(choice == CHROME_KIT_DUMMY) + var/list/builds = list("Random") + for(var/loadout_name in GLOB.chrome_test_loadouts) + builds += loadout_name + dummy_build = tgui_input_list(user, "Which build does the dummy carry?", "Chrome Test Kit", builds) + if(!dummy_build) + return + if(dummy_build == "Random") + dummy_build = pick(GLOB.chrome_test_loadouts) + + // The bench. One cradle per kit spot; asking twice does not stack them. + var/obj/machinery/chrome_cradle/cradle = locate() in view(5, origin) + var/made_cradle = FALSE + if(!cradle) + cradle = new(chrome_kit_adjacent_turf(admin_mob)) + made_cradle = TRUE + new /obj/item/stack/trade_voucher(origin, CHROME_KIT_VOUCHERS) + new /obj/item/holochip(origin, CHROME_KIT_CREDITS) + + var/list/report = list() + var/summary = "[made_cradle ? "a cradle" : "the cradle already here"], [CHROME_KIT_VOUCHERS] vouchers and [CHROME_KIT_CREDITS] cr" + switch(choice) + if(CHROME_KIT_BASICS) + EMPTY_BLOCK_GUARD // the bench, vouchers and credits are the whole kit + if(CHROME_KIT_EVERYTHING) + var/list/everything = list() + for(var/ware_type in chrome_kit_everything_types()) + everything += new ware_type(origin) + chrome_kit_crate(origin, everything, "chrome crate (everything)") + summary += ", a crate with [length(everything)] items" + if(CHROME_KIT_DUMMY) + var/mob/living/carbon/human/npc/chrome_dummy/dummy = chrome_kit_make_dummy(chrome_kit_adjacent_turf(admin_mob), GLOB.chrome_test_loadouts[dummy_build], report) + summary += ", a chrome dummy carrying the [dummy_build] build ([chrome_kit_status_line(dummy)])" + else + var/list/ware_types = GLOB.chrome_test_loadouts[choice] + if(into_body) + var/list/spare = chrome_kit_install(admin_mob, ware_types, report) + summary += ", the [choice] build installed ([chrome_kit_status_line(admin_mob)])" + if(length(spare)) + chrome_kit_crate(origin, spare, "chrome crate ([choice], left over)") + summary += ", [length(spare)] left over in a crate" + else + var/list/boxed = list() + for(var/ware_type in ware_types) + boxed += new ware_type(origin) + chrome_kit_crate(origin, boxed, "chrome crate ([choice])") + summary += ", the [choice] build in a crate" + + to_chat(user, span_notice("Chrome test kit: [summary].")) + for(var/line in report) + to_chat(user, span_notice(" [line].")) + message_admins("[key_name_admin(user)] used the chrome test kit ([choice]) at [ADMIN_VERBOSEJMP(origin)].") + log_admin("[key_name(user)] used the chrome test kit ([choice]): [summary].") + BLACKBOX_LOG_ADMIN_VERB("Chrome Test Kit") + +#undef CHROME_KIT_EVERYTHING +#undef CHROME_KIT_DUMMY +#undef CHROME_KIT_BASICS diff --git a/voidcrew/modules/antag_ruins/ascension_mech.dm b/voidcrew/modules/antag_ruins/ascension_mech.dm index b8fab656eb6..52619b45dba 100644 --- a/voidcrew/modules/antag_ruins/ascension_mech.dm +++ b/voidcrew/modules/antag_ruins/ascension_mech.dm @@ -2037,7 +2037,7 @@ GLOBAL_LIST_EMPTY(machine_quickhacks) */ /datum/machine_quickhack/safeties name = "Cut the Safeties" - desc = "Strip the target's safety interlocks. Exactly what an emag would do to it, which depends entirely on what it is." + desc = "Strip the target's safety interlocks." radial_icon = 'icons/obj/card.dmi' radial_icon_state = "emag" cooldown = 25 SECONDS @@ -2070,7 +2070,7 @@ GLOBAL_LIST_EMPTY(machine_quickhacks) /datum/machine_quickhack/bolts name = "Bolts" - desc = "Throw the door's bolts, or pull them if they are already down. Works on the AI wire, so a cut door will not answer." + desc = "Throw the door's bolts, or pull them if they are already down." radial_icon_state = "lockdown" cooldown = 8 SECONDS @@ -2105,8 +2105,7 @@ GLOBAL_LIST_EMPTY(machine_quickhacks) */ /datum/machine_quickhack/electrify name = "Electrify" - desc = "Run the door's frame live for 30 seconds. It draws on your own current rather than the area's, so a \ - nearly-empty APC still lands the shock. Touching it without insulated gloves is 20 burn and a stun." + desc = "Run the door's frame live for 30 seconds. Touching it without insulated gloves is 20 burn and a stun." radial_icon = 'icons/obj/machines/wallmounts.dmi' radial_icon_state = "apc-spark" cooldown = 20 SECONDS @@ -2171,7 +2170,7 @@ GLOBAL_LIST_EMPTY(machine_quickhacks) /datum/machine_quickhack/kill_power name = "Kill the Power" - desc = "Flip an APC's breaker. Lights, equipment and air handling across that whole area go dead until it is flipped back." + desc = "Flip an APC's breaker. Lights, equipment and air handling across that whole area go dead." radial_icon = 'icons/obj/machines/wallmounts.dmi' radial_icon_state = "apc0" cooldown = 30 SECONDS @@ -2199,7 +2198,7 @@ GLOBAL_LIST_EMPTY(machine_quickhacks) */ /datum/machine_quickhack/burst_lights name = "Burst the Lights" - desc = "Push an APC's lighting circuit until every bulb in its area breaks. They stay broken." + desc = "Push an APC's lighting circuit until every bulb in its area breaks." radial_icon_state = "blackout" cooldown = 30 SECONDS @@ -2239,7 +2238,7 @@ GLOBAL_LIST_EMPTY(machine_quickhacks) */ /datum/machine_quickhack/feedback_surge name = "Feedback Surge" - desc = "Dump everything a person's gear is holding into the person. Empties every power cell they are carrying and shocks them for up to 60 burn, scaled to how much charge there was." + desc = "Empty every power cell a person is carrying through the person, for up to 60 burn." radial_icon = 'icons/obj/weapons/baton.dmi' radial_icon_state = "stunbaton_active" cooldown = 60 SECONDS @@ -2277,7 +2276,7 @@ GLOBAL_LIST_EMPTY(machine_quickhacks) */ /datum/machine_quickhack/cutout name = "Cutout" - desc = "Quietly empty every power cell a person is carrying and switch their radios off for 45 seconds. No shock and no stun; their gear just stops." + desc = "Quietly empty every power cell a person is carrying and switch their radios off for 45 seconds." radial_icon = 'icons/obj/weapons/baton.dmi' radial_icon_state = "stunbaton_nocell" cooldown = 35 SECONDS @@ -2312,7 +2311,7 @@ GLOBAL_LIST_EMPTY(machine_quickhacks) /datum/machine_quickhack/silence name = "Silence" - desc = "Jam every radio within nine tiles of what you clicked for 45 seconds, and switch the ones already in range off outright for as long." + desc = "Jam every radio within nine tiles of what you clicked for 45 seconds." radial_icon = 'icons/obj/devices/syndie_gadget.dmi' radial_icon_state = "jammer" cooldown = 40 SECONDS @@ -2608,10 +2607,7 @@ GLOBAL_LIST_EMPTY(machine_masshacks) */ /datum/machine_masshack/overload name = "Overload the Room" - desc = "Feed every machine around you power at once, each one at full overload strength. Five seconds of the whole \ - room buzzing, then up to twelve real explosions land a fifth of a second apart. It takes the walls with it and \ - it will breach a hull if one is in the pattern. Lights just burst. Nothing that goes up comes back, and you are \ - standing in the middle of it, leave." + desc = "Overload every machine around you at once. Five seconds of buzzing, then up to twelve explosions. You are standing in the middle of it." radial_icon_state = "overload_machine" cooldown = 3 MINUTES @@ -2652,9 +2648,7 @@ GLOBAL_LIST_EMPTY(machine_masshacks) */ /datum/machine_masshack/arc_flash name = "Arc Flash" - desc = "Every powered machine around you starts earthing itself through whoever is standing nearest to it. Five \ - volleys a second and a half apart, 14 burn each, and it comes out of the wall rather than through their hands, \ - so insulated gloves do nothing. It hits everyone in the room except you, friend or not." + desc = "Every powered machine around you earths itself through whoever is standing nearest. Five volleys, 14 burn each, on everyone but you." radial_icon = 'icons/mob/actions/actions_spells.dmi' radial_icon_state = "lightning" cooldown = 2 MINUTES @@ -2767,9 +2761,7 @@ GLOBAL_LIST_EMPTY(machine_masshacks) */ /datum/machine_masshack/wake name = "Wake the Machines" - desc = "Stand every free-standing machine in the room up to fight for you. Up to eight of them, twice as tough as an \ - animated machine and hitting twice as hard, for two minutes before they fall apart. They know you and nobody \ - else, everyone else in the room is a stranger to them. The machines do not come back." + desc = "Stand up to eight free-standing machines in the room up to fight for you for two minutes." radial_icon_state = "override_machine" cooldown = 3 MINUTES @@ -2797,7 +2789,7 @@ GLOBAL_LIST_EMPTY(machine_masshacks) for(var/mob/living/second as anything in woken) if(first != second) first.befriend(second) - to_chat(user, span_boldnotice("[length(woken)] of them get up. They know your face and each other's, and nobody else's.")) + to_chat(user, span_boldnotice("[length(woken)] of them get up.")) return TRUE /** diff --git a/voidcrew/modules/cyberware/chrome_cradle.dm b/voidcrew/modules/cyberware/chrome_cradle.dm index ef2dc109b0a..79d7d433ec9 100644 --- a/voidcrew/modules/cyberware/chrome_cradle.dm +++ b/voidcrew/modules/cyberware/chrome_cradle.dm @@ -94,8 +94,6 @@ /obj/machinery/chrome_cradle/examine(mob/user) . = ..() - . += span_notice("Drag yourself (or a patient) onto the slab to lie back on it. Whoever's on the slab runs their own install; the rig won't take orders from anyone else.") - . += span_notice("Tune-ups run [CYBERWARE_TUNEUP_FEE] cr: EMP-scrambled and damaged chrome comes back to spec. Load cash into the slab or pay by ID.") if(loaded_credits) . += span_notice("The slab's cash slot holds [loaded_credits] cr.") if(length(tray)) @@ -261,6 +259,8 @@ /// on the marked stage a spark shower plus Splice's mid-line. /obj/machinery/chrome_cradle/proc/run_sequence_stage(mid_stage = FALSE) playsound(src, 'sound/effects/servostep.ogg', 60, TRUE) + // The rig's arms move on the beat (cyberware_anim2.dm). + rig_beat(mid_stage) var/mob/living/patient = occupant if(istype(patient)) patient.do_jitter_animation(60) @@ -317,6 +317,7 @@ SStgui.update_uis(src) return do_sparks(3, FALSE, src) + rig_boot_fx(patient) patient.flash_act(visual = 1) if(chrome.tier >= CYBERWARE_TIER_4) visible_message(span_notice("The parlor's neon stutters as the rig pulls the current it needs.")) @@ -370,6 +371,7 @@ for(var/timer in stage_timers) deltimer(timer) stage_timers.Cut() + rig_stop() busy = FALSE busy_action = null busy_ware = null @@ -408,7 +410,7 @@ if(any_repairable) return null if(only_brownout && length(installed)) - return "That chrome is browned out, not broken. Shed some load instead." + return "That chrome is browned out, not broken." return "Nothing needs a tune-up." /obj/machinery/chrome_cradle/proc/try_tune_up(mob/living/carbon/patient) @@ -807,6 +809,13 @@ return TRUE +// ---- Ship saves --------------------------------------------------------- + +// A cradle belongs to a parlor. A saved hull must never rebuild one (an admin test kit can +// drop one on a ship), or every load would hand that ship a free operating slab. +/obj/machinery/chrome_cradle/checkpoint_type() + return null + // ---- Outpost aggression ------------------------------------------------ // Attacking outpost property is aggression, the cradle included. diff --git a/voidcrew/modules/cyberware/cyberware_anim.dm b/voidcrew/modules/cyberware/cyberware_anim.dm new file mode 100644 index 00000000000..24a6049bc42 --- /dev/null +++ b/voidcrew/modules/cyberware/cyberware_anim.dm @@ -0,0 +1,921 @@ +/** + * # Chrome animations + * + * Four pieces of motion that sit on top of chrome that already works. None of + * them changes what the chrome does or when: every proc here only draws, and + * the mechanics call into it after they have already happened. + * + * - Mantis blades swing out of the housing and fold back into it. + * - The Ghostskin field flickers in and out: hard steps of alpha with a + * pixel of jitter, and a sharper stutter when something knocks it down. + * - The Cascade's spine nodes ignite neck to hips, a ring rolls out across the + * floor, and the nodes die hips to neck when the crash hits. + * - An EMP fills every worn piece with static, arcs between them, kills them one + * after another, and they blink back on when they reboot. + * + * Two ways of drawing, chosen per effect: + * - One-shot frames ride a holder object in the bearer's vis_contents. A fresh + * object always plays its icon state from the first frame, which an overlay + * does not, so swings, arcs and sparks are holders that delete themselves. + * - Anything that must sit at the worn chrome's layer (under suits, gloves and + * hands) is a "look" on the worn overlay itself: the bodypart overlay asks + * the implant for its look when it draws, and the look is part of the limb's + * render key, so a look change is one update_body_parts() away. + * + * Nothing here loops on the server. Timers are one-shot and owned by the thing + * they animate, so they die with it. + */ + +#define CYBERWARE_ANIM_ICON 'voidcrew/modules/cyberware/icons/cyberware_anim.dmi' +#define CYBERWARE_ANIM_LARGE_ICON 'voidcrew/modules/cyberware/icons/cyberware_anim_large.dmi' +/// Batch-2 art: breathing LEDs and the looks of cyberware_anim2.dm. +#define CYBERWARE_ANIM2_ICON 'voidcrew/modules/cyberware/icons/cyberware_anim2.dmi' + +/// Worn looks. Null is the plain overlay. +#define CHROME_LOOK_STATIC "static" +#define CHROME_LOOK_DARK "dark" +#define CHROME_LOOK_FLASH "flash" +#define CHROME_LOOK_FOLD "fold" +/// Brownout looks (cyberware_anim2.dm): browned out, and the warm stutter on the way down or up. +#define CHROME_LOOK_BROWN "brown" +#define CHROME_LOOK_WARM "warm" + +/// Layer for a blade swing: just over the held item it turns into. +#define CHROME_ANIM_BLADE_LAYER (-(HANDS_LAYER - 0.5)) +/// Layer for arcs, sparks and crackle: over everything the bearer wears. +#define CHROME_ANIM_TOP_LAYER (-(HIGHEST_LAYER - 0.5)) + +// ========================================================================= +// THE HOLDER +// ========================================================================= + +/** + * One short animation drawn on a bearer. Created per use and deleted after + * its lifetime, so its icon state always starts on the first frame. Inherits + * the bearer's facing and plane; clicks pass through it. + */ +/obj/effect/abstract/cyberware_anim + name = "chrome" + icon = CYBERWARE_ANIM_LARGE_ICON + mouse_opacity = MOUSE_OPACITY_TRANSPARENT + vis_flags = VIS_INHERIT_DIR | VIS_INHERIT_PLANE + blocks_emissive = EMISSIVE_BLOCK_NONE + /// What we are drawn on. + var/atom/movable/bearer + +/obj/effect/abstract/cyberware_anim/Destroy() + detach() + return ..() + +/obj/effect/abstract/cyberware_anim/proc/detach() + if(!bearer) + return + UnregisterSignal(bearer, COMSIG_QDELETING) + bearer.vis_contents -= src + bearer = null + +/obj/effect/abstract/cyberware_anim/proc/on_bearer_deleted(datum/source) + SIGNAL_HANDLER + qdel(src) + +/** + * Plays [state] from [icon_file] on [bearer] for [lifetime], then deletes + * itself. Large-sheet states are 64x64 and get centred on the bearer's tile. + * [glow] adds an emissive twin, so the frames light up in the dark. + */ +/proc/cyberware_anim_play(atom/movable/bearer, icon_file, state, anim_layer, lifetime, glow = FALSE) + if(QDELETED(bearer) || !state) + return null + var/obj/effect/abstract/cyberware_anim/holder = new(null) + holder.bearer = bearer + holder.icon = icon_file + holder.icon_state = state + holder.layer = anim_layer + if(icon_file == CYBERWARE_ANIM_LARGE_ICON) + holder.pixel_x = -16 + holder.pixel_y = -16 + if(glow) + holder.add_overlay(emissive_appearance(icon_file, state, bearer)) + holder.RegisterSignal(bearer, COMSIG_QDELETING, TYPE_PROC_REF(/obj/effect/abstract/cyberware_anim, on_bearer_deleted)) + bearer.vis_contents += holder + QDEL_IN(holder, lifetime) + return holder + +// ========================================================================= +// WORN LOOKS +// ========================================================================= + +/// The EMP look the reboot show has put on this piece. Null means "whatever +/// the reboot state says": dark while down, plain otherwise. +/datum/component/cyberware/var/emp_look +/// The brownout look the brownout show has put on this piece. Null means +/// "whatever the brownout state says": browned out or plain. +/datum/component/cyberware/var/brownout_look + +/** + * The look this implant's worn overlay draws with right now, or null for the + * plain overlay. Read by the bodypart overlay on every draw. + */ +/obj/item/organ/cyberimp/proc/cyberware_worn_look() + var/datum/component/cyberware/chrome = GetComponent(/datum/component/cyberware) + if(!chrome) + return null + if(chrome.emp_look) + return chrome.emp_look + if(chrome.emp_down) + return CHROME_LOOK_DARK + if(chrome.brownout_look) + return chrome.brownout_look + if(chrome.browned_out) + return CHROME_LOOK_BROWN + return null + +/// What this implant adds to its limb's render key, so a look change redraws. +/obj/item/organ/cyberimp/proc/cyberware_worn_key() + return "[cyberware_worn_look()]" + +/** + * Dresses one implant's freshly built worn images in its current look. + * Called by /datum/bodypart_overlay/augment/cyberware before it adds + * emissive blockers, so a see-through image gets a see-through blocker. + */ +/obj/item/organ/cyberimp/proc/cyberware_dress_worn(list/imageset, image_layer, obj/item/bodypart/limb) + var/look = cyberware_worn_look() + if(!look) + return cyberware_dress_leds(imageset, image_layer, limb) + var/list/dressed = list() + for(var/image/part as anything in imageset) + var/glow = PLANE_TO_TRUE(part.plane) == EMISSIVE_PLANE + switch(look) + if(CHROME_LOOK_FOLD) + // The folded housing waits while the swing plays over it. + if(glow) + continue + part.alpha = 0 + if(CHROME_LOOK_DARK) + if(glow) + continue + part.color = list(0.18, 0.18, 0.2, 0.32, 0.32, 0.34, 0.08, 0.08, 0.1, 0.02, 0.02, 0.03) + if(CHROME_LOOK_FLASH) + if(glow) + continue + part.color = list(0.55, 0, 0, 0, 0.55, 0, 0, 0, 0.55, 0.42, 0.5, 0.55) + dressed += part + dressed += emissive_appearance(part.icon, part.icon_state, limb?.owner || limb, part.layer) + continue + if(CHROME_LOOK_STATIC) + if(!glow) + // Static clipped to the piece's own pixels. + part.appearance_flags |= KEEP_TOGETHER + var/mutable_appearance/noise = mutable_appearance('icons/effects/effects.dmi', "static_base", alpha = 170) + noise.blend_mode = BLEND_INSET_OVERLAY + part.overlays += noise + if(CHROME_LOOK_BROWN) + if(glow) + continue + part.color = list(0.62, 0, 0, 0, 0.62, 0, 0, 0, 0.66, 0, 0, 0) + if(CHROME_LOOK_WARM) + if(glow) + // A sagging supply: the lights still burn, weaker. + dressed += emissive_appearance(part.icon, part.icon_state, limb?.owner || limb, part.layer, alpha = 110) + continue + part.color = list(0.9, 0, 0, 0, 0.74, 0, 0, 0, 0.58, 0.05, 0.02, 0) + dressed += part + return dressed + +/** + * The plain look: any worn state with breathing LEDs in the batch-2 sheet + * gets them, and the breathing glow replaces the piece's own still glow. + * The LED states loop on their own, so a lit piece costs the server nothing. + */ +/obj/item/organ/cyberimp/proc/cyberware_dress_leds(list/imageset, image_layer, obj/item/bodypart/limb) + var/list/leds + for(var/image/part as anything in imageset) + if(PLANE_TO_TRUE(part.plane) == EMISSIVE_PLANE) + continue + var/led_state = "[part.icon_state]_led" + if(icon_exists(CYBERWARE_ANIM2_ICON, led_state)) + LAZYSET(leds, "[part.icon_state]", led_state) + if(!leds) + return imageset + var/list/dressed = list() + for(var/image/part as anything in imageset) + if(PLANE_TO_TRUE(part.plane) == EMISSIVE_PLANE) + var/glow_state = "[part.icon_state]" + if(length(glow_state) > 2 && copytext(glow_state, -2) == "_e" && leds[copytext(glow_state, 1, -2)]) + continue + dressed += part + for(var/worn_state in leds) + dressed += image(icon = CYBERWARE_ANIM2_ICON, icon_state = leds[worn_state], layer = image_layer) + dressed += emissive_appearance(CYBERWARE_ANIM2_ICON, "[leds[worn_state]]_e", limb?.owner || limb, image_layer) + return dressed + +// ========================================================================= +// MANTIS BLADES: UNFOLD AND FOLD +// ========================================================================= + +/// How long the blade swings out before the held blade takes over. +#define BLADE_UNFOLD_SWING (0.3 SECONDS) +/// The whole unfold, last sparks included. +#define BLADE_UNFOLD_TIME (0.4 SECONDS) +/// How long the folded housing waits while the blade folds back in. +#define BLADE_FOLD_SWING (0.3 SECONDS) +/// The whole fold, last sparks included. +#define BLADE_FOLD_TIME (0.5 SECONDS) + +/obj/item/organ/cyberimp/arm/toolkit/cyberware + /// The swing playing on the bearer right now, if any. Weak: it deletes itself. + var/datum/weakref/blade_anim_ref + /// Until this world.time the folded housing is drawn see-through. + var/fold_hide_until = 0 + /// Timer that brings the folded housing back. + var/fold_timer + /// Colour of the flash at the hinge when the blade swings. + var/blade_flash_color = "#bfe6ff" + /// One hinge flash at a time, however fast the blade is toggled. + COOLDOWN_DECLARE(blade_flash_cooldown) + +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/street + blade_flash_color = "#e8e0c8" + +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/scorch + blade_flash_color = "#ffb070" + +/obj/item/organ/cyberimp/arm/toolkit/cyberware/cyberware_worn_look() + if(world.time < fold_hide_until) + return CHROME_LOOK_FOLD + return ..() + +/// The swing state for this housing, or null when the sheet has none. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/blade_anim_state(kind) + var/state = "[aug_overlay]_[kind]_[zone == BODY_ZONE_L_ARM ? "left" : "right"]" + return icon_exists(CYBERWARE_ANIM_LARGE_ICON, state) ? state : null + +/// The swing playing on the bearer right now, if any. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/blade_anim() + return blade_anim_ref?.resolve() + +/// Stops any swing and brings the folded housing back if it was waiting. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/stop_blade_anim() + qdel(blade_anim()) + blade_anim_ref = null + if(fold_timer) + deltimer(fold_timer) + fold_timer = null + fold_hide_until = 0 + +/// The blade swings out of the housing. Called once the blade is in a hand. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/play_blade_unfold(obj/item/blade) + var/state = blade_anim_state("unfold") + if(!state || !owner) + return + stop_blade_anim() + blade_anim_ref = WEAKREF(cyberware_anim_play(owner, CYBERWARE_ANIM_LARGE_ICON, state, CHROME_ANIM_BLADE_LAYER, BLADE_UNFOLD_TIME)) + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/held_blade = blade + if(istype(held_blade)) + held_blade.hide_inhand_for(BLADE_UNFOLD_SWING) + blade_flash(0.7, BLADE_UNFOLD_SWING) + +/** + * The blade folds back into the housing. Called once it is stowed; the + * folded housing stays see-through until the swing has played. + */ +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/play_blade_fold() + var/state = blade_anim_state("fold") + if(!state || !owner) + return + stop_blade_anim() + blade_anim_ref = WEAKREF(cyberware_anim_play(owner, CYBERWARE_ANIM_LARGE_ICON, state, CHROME_ANIM_BLADE_LAYER, BLADE_FOLD_TIME)) + fold_hide_until = world.time + BLADE_FOLD_SWING + fold_timer = addtimer(CALLBACK(src, PROC_REF(end_fold_hide)), BLADE_FOLD_SWING, TIMER_STOPPABLE) + blade_flash(0.5, BLADE_FOLD_SWING) + +/// A brief light at the hinge while the blade swings. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/blade_flash(power, duration) + if(!COOLDOWN_FINISHED(src, blade_flash_cooldown)) + return + COOLDOWN_START(src, blade_flash_cooldown, duration) + owner.mob_light(1.5, power, blade_flash_color, duration) + +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/end_fold_hide() + fold_timer = null + fold_hide_until = 0 + owner?.update_body_parts() + +/obj/item/melee/energy/blade/hardlight/cyberware_mantis + /// Until this world.time the blade is not drawn in the hand: the swing is. + var/inhand_hidden_until = 0 + +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/hide_inhand_for(duration) + inhand_hidden_until = world.time + duration + var/mob/holder = loc + if(ismob(holder)) + holder.update_held_items() + addtimer(CALLBACK(src, PROC_REF(show_inhand)), duration, TIMER_UNIQUE | TIMER_OVERRIDE) + +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/show_inhand() + if(!inhand_hidden_until) + return + inhand_hidden_until = 0 + var/mob/holder = loc + if(ismob(holder)) + holder.update_held_items() + +// The blade is in the hand from the first tick; only its drawing waits. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/build_worn_icon(default_layer = 0, default_icon_file = null, isinhands = FALSE, female_uniform = NO_FEMALE_UNIFORM, override_state = null, override_file = null) + . = ..() + if(isinhands && world.time < inhand_hidden_until) + var/mutable_appearance/standing = . + standing.alpha = 0 + +// ========================================================================= +// IMPACTS +// ========================================================================= + +/obj/item/melee/energy/blade/hardlight/cyberware_mantis + /// What a hit with this blade plays over its target, in place of tg's flying blade. + var/impact_state = "impact_mantis" + +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/street + impact_state = "impact_shiv" + +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/scorch + impact_state = "impact_scorch" + +/obj/item/melee/cyberware_monowire + /// What a hit with this wire plays over its target, in place of tg's flying spool. + var/impact_state = "impact_widowline" + +/obj/item/melee/cyberware_monowire/live + // A landed Arc hit already lashes, crackles and bursts (cyberware_anim2.dm), so no impact goes on top. + impact_state = null + +// The swinger's lunge stays; only the picture over the target changes. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/animate_attack(atom/movable/attacker, atom/attacked_atom, animation_type) + if(!cyberware_play_impact(attacker, attacked_atom, impact_state)) + return ..() + +/obj/item/melee/cyberware_monowire/animate_attack(atom/movable/attacker, atom/attacked_atom, animation_type) + if(!cyberware_play_impact(attacker, attacked_atom, impact_state)) + return ..() + +// Nor tg's flying spool in its place: the Arc's shock is its picture. Walls and floors keep tg's own. +/obj/item/melee/cyberware_monowire/live/animate_attack(atom/movable/attacker, atom/attacked_atom, animation_type) + if(!ismovable(attacked_atom)) + return ..() + +/** + * A chrome weapon's hit drawn over what it hit: a short slash, flash or + * crackle, upright even on someone lying down, and turned to come from the + * attacker's side. Returns the holder, or null if there was nothing to draw on. + */ +/proc/cyberware_play_impact(atom/movable/attacker, atom/attacked_atom, impact_state) + if(!impact_state || !ismovable(attacked_atom)) + return null + var/obj/effect/abstract/cyberware_anim/impact = cyberware_anim_play(attacked_atom, CYBERWARE_ANIM_ICON, impact_state, CHROME_ANIM_TOP_LAYER, 0.4 SECONDS, glow = impact_state != "impact_shiv") + if(!impact) + return null + impact.appearance_flags |= RESET_TRANSFORM + // The art swings in from the left; a blow from the right is mirrored, one from above or below either way. + var/direction = get_dir(attacker, attacked_atom) + if((direction & WEST) || (!(direction & EAST) && prob(50))) + impact.transform = matrix(-1, 0, 0, 0, 1, 0) + return impact + +#undef BLADE_UNFOLD_SWING +#undef BLADE_UNFOLD_TIME +#undef BLADE_FOLD_SWING +#undef BLADE_FOLD_TIME + +// ========================================================================= +// GHOSTSKIN FIELD: THE SIGNAL FLICKER +// ========================================================================= + +/// How long the field takes to flicker in. +#define CLOAK_ENTER_TIME (0.6 SECONDS) + +/obj/item/organ/cyberimp/cyberware/ghostskin + /// world.time the field finishes flickering in. Moving under the field waits for it. + var/cloak_enter_until = 0 + +/** + * Hard 1 px jumps sideways alongside one of the alpha chains below. [steps] + * are (jump, hold) pairs; the jumps are relative and add up to nothing, so the + * bearer ends where it started however the chain is cut short. + */ +/proc/cyberware_cloak_jolt(mob/living/wearer, list/steps) + for(var/i in 1 to length(steps) step 2) + var/jump = steps[i] + var/hold = steps[i + 1] + if(i == 1) + animate(wearer, pixel_w = jump, time = 0, flags = ANIMATION_RELATIVE | ANIMATION_PARALLEL) + else + animate(pixel_w = jump, time = 0, flags = ANIMATION_RELATIVE) + if(hold) + animate(pixel_w = 0, time = hold, flags = ANIMATION_RELATIVE) + +/** + * The field comes up: the bearer's alpha stutters through hard steps and eases + * down to field alpha, jumping a pixel sideways on the way. While the field + * holds there is nothing on the bearer but that alpha. + */ +/obj/item/organ/cyberimp/cyberware/ghostskin/proc/cloak_flicker_in(mob/living/carbon/wearer) + cloak_enter_until = world.time + CLOAK_ENTER_TIME + var/faded = field_alpha + // The alpha chain first: it replaces whatever the bearer was animating. + animate(wearer, alpha = max(115, faded), time = 0) + animate(alpha = max(115, faded), time = 0.5) + animate(alpha = 230, time = 0) + animate(alpha = 230, time = 1) + animate(alpha = max(75, faded), time = 0) + animate(alpha = max(75, faded), time = 0.5) + animate(alpha = 180, time = 0) + animate(alpha = 180, time = 1) + animate(alpha = max(55, faded), time = 0) + animate(alpha = max(55, faded), time = 0.5) + animate(alpha = 125, time = 0) + animate(alpha = 125, time = 0.5) + animate(alpha = faded, time = 2, easing = SINE_EASING) + cyberware_cloak_jolt(wearer, list(1, 0.5, -1, 1, -1, 0.5, 1, 1, 1, 0.5, -1, 0.5)) + +/// The field runs out or is switched off: the flicker in reverse, back to full view. +/obj/item/organ/cyberimp/cyberware/ghostskin/proc/cloak_flicker_out(mob/living/carbon/wearer) + cloak_enter_until = 0 + var/faded = field_alpha + animate(wearer, alpha = 110, time = 0) + animate(alpha = 110, time = 0.5) + animate(alpha = max(60, faded), time = 0) + animate(alpha = max(60, faded), time = 0.5) + animate(alpha = 175, time = 0) + animate(alpha = 175, time = 0.5) + animate(alpha = 105, time = 0) + animate(alpha = 105, time = 0.5) + animate(alpha = 235, time = 0) + animate(alpha = 235, time = 0.5) + animate(alpha = 255, time = 1, easing = SINE_EASING) + cyberware_cloak_jolt(wearer, list(-1, 0.5, 1, 0.5, 1, 0.5, -1, 0.5, -1, 0.5, 1, 1)) + +/// The field is knocked down: full view, a dip, full view, with hard 2 px jolts. +/obj/item/organ/cyberimp/cyberware/ghostskin/proc/cloak_flicker_break(mob/living/carbon/wearer) + cloak_enter_until = 0 + animate(wearer, alpha = 255, time = 0) + animate(alpha = 255, time = 0.5) + animate(alpha = 140, time = 0) + animate(alpha = 140, time = 0.5) + animate(alpha = 255, time = 0) + animate(alpha = 255, time = 0.5) + cyberware_cloak_jolt(wearer, list(2, 0.5, -4, 0.5, 3, 0.5, -1, 0)) + +/// A quiet drop (the weave pulled, or switched off while not worn): straight back to full view. +/obj/item/organ/cyberimp/cyberware/ghostskin/proc/cloak_reset(mob/living/carbon/wearer) + cloak_enter_until = 0 + if(!QDELETED(wearer)) + animate(wearer, alpha = 255, time = 0) + +#undef CLOAK_ENTER_TIME + +// ========================================================================= +// CASCADE: SPINE NODES AND THE TIME RING +// ========================================================================= + +/// Time between node frames. +#define CASCADE_NODE_STEP (0.1 SECONDS) +/// When the ring rolls out: as the last node lights. +#define CASCADE_RING_DELAY (0.45 SECONDS) + +/obj/item/organ/cyberimp/cyberware/cascade + /// The spine node frame drawn over the lattice, or null for the plain one. + var/node_look + /// Node frames still to play, in order. + var/list/node_queue + /// Timer for the next node frame. + var/node_timer + /// Timer for the floor ring. + var/ring_timer + /// How far the ring rolls out (transform scale of a two-tile ring). + var/ring_scale = 3.3 + /// How bright the ring starts. + var/ring_alpha = 235 + /// How long the ring takes to roll out and fade. + var/ring_time = 0.65 SECONDS + +/obj/item/organ/cyberimp/cyberware/cascade/milspec + ring_scale = 2.7 + ring_alpha = 190 + ring_time = 0.55 SECONDS + +/obj/item/organ/cyberimp/cyberware/cascade/street + ring_scale = 2.2 + ring_alpha = 140 + ring_time = 0.45 SECONDS + +/obj/item/organ/cyberimp/cyberware/cascade/cyberware_worn_key() + return "[..()]-[node_look]" + +/obj/item/organ/cyberimp/cyberware/cascade/cyberware_dress_worn(list/imageset, image_layer, obj/item/bodypart/limb) + if(cyberware_worn_look() || !node_look) + return ..() + var/state = "[aug_overlay]_[node_look]" + if(!icon_exists(CYBERWARE_ANIM_ICON, state)) + return imageset + // The node frame replaces the lattice's own idle glow. + var/list/dressed = list() + for(var/image/part as anything in imageset) + if(PLANE_TO_TRUE(part.plane) == EMISSIVE_PLANE) + continue + dressed += part + dressed += cyberware_spine_node_images(CYBERWARE_ANIM_ICON, state, node_look != "dead", image_layer, limb?.owner || limb) + return dressed + +/** + * The images of one spine node frame. Lit nodes shine through whatever is worn on the back: they draw at + * CYBERWARE_SPINE_SHINE_LAYER, just over the backpack. Dark nodes stay with the housing, under the clothes. A + * frame with lit and dark nodes both is split in its sheet into "[state]_lit" and "[state]_dark". + */ +/proc/cyberware_spine_node_images(icon_file, state, lit, image_layer, atom/glow_owner) + var/list/images = list() + var/has_glow = icon_exists(icon_file, "[state]_e") + if(!lit) + images += image(icon = icon_file, icon_state = state, layer = image_layer) + if(has_glow) + images += emissive_appearance(icon_file, "[state]_e", glow_owner, image_layer) + return images + var/lit_state = state + if(icon_exists(icon_file, "[state]_lit")) + lit_state = "[state]_lit" + images += image(icon = icon_file, icon_state = "[state]_dark", layer = image_layer) + images += image(icon = icon_file, icon_state = lit_state, layer = -CYBERWARE_SPINE_SHINE_LAYER) + if(has_glow) + images += emissive_appearance(icon_file, "[state]_e", glow_owner, -CYBERWARE_SPINE_SHINE_LAYER) + return images + +/// Plays node frames one after another, then holds the last. +/obj/item/organ/cyberimp/cyberware/cascade/proc/play_node_looks(list/looks) + if(node_timer) + deltimer(node_timer) + node_timer = null + node_queue = looks.Copy() + advance_node_look() + +/obj/item/organ/cyberimp/cyberware/cascade/proc/advance_node_look() + node_timer = null + if(!length(node_queue)) + return + node_look = popleft(node_queue) + owner?.update_body_parts() + if(length(node_queue)) + node_timer = addtimer(CALLBACK(src, PROC_REF(advance_node_look)), CASCADE_NODE_STEP, TIMER_STOPPABLE) + +/// Back to the plain lattice, no frames pending, no ring on the way. +/obj/item/organ/cyberimp/cyberware/cascade/proc/clear_node_looks(mob/living/carbon/redraw) + if(node_timer) + deltimer(node_timer) + node_timer = null + if(ring_timer) + deltimer(ring_timer) + ring_timer = null + node_queue = null + if(isnull(node_look)) + return + node_look = null + redraw?.update_body_parts() + +/// The window opens: nodes ignite neck to hips, then the ring rolls out. +/obj/item/organ/cyberimp/cyberware/cascade/proc/play_window_open() + if(!owner) + return + play_node_looks(list("boot1", "boot2", "boot3", "boot4", "boot5", "lit")) + if(ring_timer) + deltimer(ring_timer) + ring_timer = addtimer(CALLBACK(src, PROC_REF(roll_ring)), CASCADE_RING_DELAY, TIMER_STOPPABLE) + +/obj/item/organ/cyberimp/cyberware/cascade/proc/roll_ring() + ring_timer = null + var/turf/here = get_turf(owner) + if(here) + new /obj/effect/temp_visual/cyberware_time_ring(here, ring_scale, ring_alpha, ring_time) + +/// The crash: nodes die hips to neck and stay dark. +/obj/item/organ/cyberimp/cyberware/cascade/proc/play_crash() + if(!owner) + return + if(ring_timer) + deltimer(ring_timer) + ring_timer = null + play_node_looks(list("crash1", "crash2", "crash3", "crash4", "crash5", "dead")) + +/// The lattice in the bearer's OS slot, if it is a Cascade. +/proc/cyberware_bearer_lattice(mob/living/bearer) + if(!iscarbon(bearer)) + return null + var/mob/living/carbon/carbon_bearer = bearer + var/obj/item/organ/cyberimp/cyberware/cascade/lattice = carbon_bearer.get_organ_slot(ORGAN_SLOT_CYBERWARE_OS) + return istype(lattice) ? lattice : null + +/// Hook for the window's on_apply(). +/proc/cyberware_cascade_window_fx(mob/living/bearer) + cyberware_bearer_lattice(bearer)?.play_window_open() + +/// Hook for the window's on_remove(), after it has (or hasn't) applied the crash. +/proc/cyberware_cascade_window_end_fx(mob/living/bearer) + var/obj/item/organ/cyberimp/cyberware/cascade/lattice = cyberware_bearer_lattice(bearer) + if(lattice && !bearer.has_status_effect(/datum/status_effect/cyberware_cascade_crash)) + lattice.clear_node_looks(bearer) + +/// Hook for the crash's on_apply(). +/proc/cyberware_cascade_crash_fx(mob/living/bearer) + cyberware_bearer_lattice(bearer)?.play_crash() + +/// Hook for the crash's on_remove(). +/proc/cyberware_cascade_crash_end_fx(mob/living/bearer) + cyberware_bearer_lattice(bearer)?.clear_node_looks(bearer) + +/// The floor ring that rolls out when a Cascade window opens. +/obj/effect/temp_visual/cyberware_time_ring + icon = CYBERWARE_ANIM_LARGE_ICON + icon_state = "time_ring" + pixel_x = -16 + pixel_y = -16 + layer = ABOVE_OPEN_TURF_LAYER + plane = FLOOR_PLANE + randomdir = FALSE + duration = 0.65 SECONDS + +/obj/effect/temp_visual/cyberware_time_ring/Initialize(mapload, max_scale = 3.3, peak_alpha = 235, ring_time = 0.65 SECONDS) + duration = ring_time + . = ..() + add_overlay(emissive_appearance(icon, icon_state, src)) + transform = matrix().Scale(0.2) + alpha = peak_alpha + animate(src, transform = matrix().Scale(max_scale), time = duration, easing = SINE_EASING | EASE_OUT, flags = ANIMATION_PARALLEL) + animate(src, alpha = 0, time = duration, easing = QUAD_EASING | EASE_IN, flags = ANIMATION_PARALLEL) + +#undef CASCADE_NODE_STEP +#undef CASCADE_RING_DELAY + +// ========================================================================= +// EMP ON CHROME +// ========================================================================= + +/// From the hit to the first piece going dark. +#define EMP_SHOW_FIRST_DEATH (0.55 SECONDS) +/// Between one piece going dark and the next. +#define EMP_SHOW_DEATH_STAGGER (0.2 SECONDS) +/// How long the arcs crackle. +#define EMP_SHOW_ARC_TIME (0.8 SECONDS) +/// Most arcs drawn at once. +#define EMP_SHOW_MAX_ARCS 3 + +/** + * The EMP picture for one bearer. Each worn piece hit in a burst fills with + * static, arcs jump between the pieces, and they go dark one after another; + * the mechanical reboot timing is untouched, only the picture staggers. When a + * piece comes back it blinks bright, dark, then on. + * + * Looks live on each piece's cyberware component (emp_look), and clearing + * them always falls back to the right picture for the reboot state, so + * deleting this at any point leaves the bearer drawn correctly. + */ +/datum/component/chrome_emp_show + dupe_mode = COMPONENT_DUPE_UNIQUE + /// Pieces in the burst that have not gone dark yet. + var/list/datum/weakref/crackling = list() + /// Pieces whose look this show has set, so it can take them back off. + var/list/datum/weakref/touched = list() + /// When the current burst started; a later hit starts a new one. + var/burst_started = -1 + /// Pieces scheduled to go dark in the current burst. + var/burst_deaths = 0 + /// Holders this show is playing. + var/list/obj/effect/abstract/cyberware_anim/holders = list() + /// Steps still to run. At zero the show deletes itself. + var/pending = 0 + /// The current blink batch: pieces that rebooted on the same tick. + var/list/datum/weakref/blink_batch + /// When the current blink batch started. + var/blink_started = -1 + +/datum/component/chrome_emp_show/Initialize() + if(!iscarbon(parent)) + return COMPONENT_INCOMPATIBLE + +/datum/component/chrome_emp_show/RegisterWithParent() + RegisterSignal(parent, COMSIG_LIVING_DEATH, PROC_REF(on_death)) + +/datum/component/chrome_emp_show/UnregisterFromParent() + UnregisterSignal(parent, COMSIG_LIVING_DEATH) + +/datum/component/chrome_emp_show/Destroy() + var/list/playing = holders.Copy() + holders.Cut() + QDEL_LIST(playing) + var/mob/living/carbon/bearer = parent + var/changed = FALSE + for(var/datum/weakref/piece_ref as anything in touched) + var/obj/item/organ/piece = piece_ref.resolve() + var/datum/component/cyberware/chrome = piece?.GetComponent(/datum/component/cyberware) + if(chrome?.emp_look) + chrome.emp_look = null + changed = TRUE + touched.Cut() + crackling.Cut() + if(changed && !QDELETED(bearer)) + bearer.update_body_parts() + return ..() + +/datum/component/chrome_emp_show/proc/on_death(datum/source) + SIGNAL_HANDLER + qdel(src) + +/// The show for [bearer], made if there isn't one. +/proc/chrome_emp_show_for(mob/living/carbon/bearer) + if(!iscarbon(bearer) || QDELETED(bearer) || bearer.stat == DEAD) + return null + return bearer.GetComponent(/datum/component/chrome_emp_show) || bearer.AddComponent(/datum/component/chrome_emp_show) + +/// Worn chrome only: the show draws on the worn overlay. +/proc/chrome_emp_show_wants(obj/item/organ/piece) + var/obj/item/organ/cyberimp/implant = piece + return istype(implant) && implant.bodypart_aug && implant.owner + +/// Region name a piece arcs from, matching the arc sheet. +/proc/chrome_emp_region(obj/item/organ/piece) + switch(piece.zone) + if(BODY_ZONE_R_ARM) + return "arm_r" + if(BODY_ZONE_L_ARM) + return "arm_l" + if(BODY_ZONE_R_LEG, BODY_ZONE_L_LEG) + return "legs" + return "chest" + +/// Hook for start_emp_reboot(): the piece was just knocked offline. +/proc/cyberware_emp_hit_fx(obj/item/organ/piece) + if(!chrome_emp_show_wants(piece)) + return + var/datum/component/chrome_emp_show/show = chrome_emp_show_for(piece.owner) + if(show) + show.hit(piece) + else + // No show on a corpse: just draw the piece dark. + piece.owner.update_body_parts() + +/// Hook for finish_emp_reboot(): the piece is back online. +/proc/cyberware_emp_reboot_fx(obj/item/organ/piece) + if(!chrome_emp_show_wants(piece)) + return + var/datum/component/chrome_emp_show/show = chrome_emp_show_for(piece.owner) + if(show) + show.blink(piece) + else + piece.owner.update_body_parts() + +/datum/component/chrome_emp_show/proc/set_look(obj/item/organ/piece, look) + var/datum/component/cyberware/chrome = piece.GetComponent(/datum/component/cyberware) + if(!chrome) + return + chrome.emp_look = look + touched |= WEAKREF(piece) + +/// A piece is hit: static now, dark on its turn. +/datum/component/chrome_emp_show/proc/hit(obj/item/organ/piece) + var/datum/weakref/piece_ref = WEAKREF(piece) + if(burst_started != world.time && !length(crackling)) + // A fresh burst. Everything hit this tick joins it; the crackle starts next tick. + burst_started = world.time + burst_deaths = 0 + pending++ + addtimer(CALLBACK(src, PROC_REF(start_burst)), 0) + set_look(piece, CHROME_LOOK_STATIC) + crackling |= piece_ref + var/dies_at = burst_started + EMP_SHOW_FIRST_DEATH + EMP_SHOW_DEATH_STAGGER * burst_deaths + burst_deaths++ + pending++ + addtimer(CALLBACK(src, PROC_REF(piece_dies), piece_ref), max(dies_at - world.time, 0.5)) + +/// The tick after the hit: show the static, throw the arcs, shake the bearer. +/datum/component/chrome_emp_show/proc/start_burst() + var/mob/living/carbon/bearer = parent + bearer.update_body_parts() + var/list/regions = list() + for(var/datum/weakref/piece_ref as anything in crackling) + var/obj/item/organ/piece = piece_ref.resolve() + if(piece?.owner == bearer) + regions |= chrome_emp_region(piece) + sortTim(regions, GLOBAL_PROC_REF(cmp_text_asc)) + var/list/arcs = list() + if(length(regions) == 1) + arcs += "chrome_arc_[regions[1]]" + else + for(var/i in 1 to length(regions) - 1) + arcs += "chrome_arc_[regions[i]]_[regions[i + 1]]" + if(length(regions) >= 3) + arcs += "chrome_arc_[regions[1]]_[regions[length(regions)]]" + for(var/i in 1 to min(length(arcs), EMP_SHOW_MAX_ARCS)) + add_holder(cyberware_anim_play(bearer, CYBERWARE_ANIM_LARGE_ICON, arcs[i], CHROME_ANIM_TOP_LAYER, EMP_SHOW_ARC_TIME, glow = TRUE)) + bearer.do_jitter_animation(0) + var/turf/here = get_turf(bearer) + if(here) + new /obj/effect/temp_visual/emp(here) + step_done() + +/// One piece's turn to go dark, with a spark where it dies. +/datum/component/chrome_emp_show/proc/piece_dies(datum/weakref/piece_ref) + crackling -= piece_ref + var/obj/item/organ/piece = piece_ref.resolve() + var/mob/living/carbon/bearer = parent + if(piece?.owner == bearer) + var/datum/component/cyberware/chrome = piece.GetComponent(/datum/component/cyberware) + if(chrome?.emp_look == CHROME_LOOK_STATIC) + chrome.emp_look = null + bearer.update_body_parts() + add_holder(cyberware_anim_play(bearer, CYBERWARE_ANIM_LARGE_ICON, "chrome_spark_[chrome_emp_region(piece)]", CHROME_ANIM_TOP_LAYER, 0.2 SECONDS, glow = TRUE)) + step_done() + +/// A piece is back: bright, dark, bright, on. Pieces back on the same tick blink together. +/datum/component/chrome_emp_show/proc/blink(obj/item/organ/piece) + crackling -= WEAKREF(piece) + if(blink_started != world.time) + blink_started = world.time + blink_batch = list() + var/list/batch = blink_batch + pending += 3 + addtimer(CALLBACK(src, PROC_REF(blink_step), batch, CHROME_LOOK_DARK), 0.5) + addtimer(CALLBACK(src, PROC_REF(blink_step), batch, CHROME_LOOK_FLASH), 2) + addtimer(CALLBACK(src, PROC_REF(blink_step), batch, null), 2.5) + blink_batch |= WEAKREF(piece) + set_look(piece, CHROME_LOOK_FLASH) + var/mob/living/carbon/bearer = parent + bearer.update_body_parts() + +/datum/component/chrome_emp_show/proc/blink_step(list/batch, look) + var/mob/living/carbon/bearer = parent + for(var/datum/weakref/piece_ref as anything in batch) + var/obj/item/organ/piece = piece_ref.resolve() + var/datum/component/cyberware/chrome = piece?.GetComponent(/datum/component/cyberware) + // A piece hit again mid-blink belongs to the new burst now. + if(!chrome || piece.owner != bearer || chrome.emp_down) + continue + chrome.emp_look = look + bearer.update_body_parts() + step_done() + +/datum/component/chrome_emp_show/proc/add_holder(obj/effect/abstract/cyberware_anim/holder) + if(!holder) + return + holders += holder + RegisterSignal(holder, COMSIG_QDELETING, PROC_REF(on_holder_deleted)) + +/datum/component/chrome_emp_show/proc/on_holder_deleted(datum/source) + SIGNAL_HANDLER + holders -= source + +/datum/component/chrome_emp_show/proc/step_done() + pending-- + if(pending <= 0 && !length(crackling)) + qdel(src) + +#undef EMP_SHOW_FIRST_DEATH +#undef EMP_SHOW_DEATH_STAGGER +#undef EMP_SHOW_ARC_TIME +#undef EMP_SHOW_MAX_ARCS + +// ========================================================================= +// CLEANUP +// ========================================================================= + +/** + * Takes every animation this organ is running off [old_owner] and resets its + * looks. Called when the chrome leaves a body and when it is deleted. + */ +/obj/item/organ/proc/cyberware_anim_clear(mob/living/carbon/old_owner) + var/datum/component/cyberware/chrome = GetComponent(/datum/component/cyberware) + if(chrome) + chrome.emp_look = null + chrome.brownout_look = null + +/obj/item/organ/cyberimp/arm/toolkit/cyberware/cyberware_anim_clear(mob/living/carbon/old_owner) + . = ..() + stop_blade_anim() + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade in contents) + blade.inhand_hidden_until = 0 + +/obj/item/organ/cyberimp/cyberware/ghostskin/cyberware_anim_clear(mob/living/carbon/old_owner) + . = ..() + cloak_enter_until = 0 + +/obj/item/organ/cyberimp/cyberware/cascade/cyberware_anim_clear(mob/living/carbon/old_owner) + . = ..() + clear_node_looks() + +#undef CYBERWARE_ANIM_ICON +#undef CYBERWARE_ANIM_LARGE_ICON +#undef CYBERWARE_ANIM2_ICON +#undef CHROME_LOOK_STATIC +#undef CHROME_LOOK_DARK +#undef CHROME_LOOK_FLASH +#undef CHROME_LOOK_FOLD +#undef CHROME_LOOK_BROWN +#undef CHROME_LOOK_WARM +#undef CHROME_ANIM_BLADE_LAYER +#undef CHROME_ANIM_TOP_LAYER diff --git a/voidcrew/modules/cyberware/cyberware_anim2.dm b/voidcrew/modules/cyberware/cyberware_anim2.dm new file mode 100644 index 00000000000..0dd1adb2bbb --- /dev/null +++ b/voidcrew/modules/cyberware/cyberware_anim2.dm @@ -0,0 +1,1023 @@ +/** + * # Chrome animations, second batch + * + * More motion on chrome that already works, built the same way as + * cyberware_anim.dm: every proc here only draws, and the mechanics call into + * it after they have already happened. Nothing here changes a number, a timer + * or who gets hit. + * + * - Redline Burn: nodes flash white and run red-hot, eyes flood red, a red + * halo breathes round the body and the roar rolls a ring across the floor. + * In the crash the outline gutters out, the spine runs white and the charge + * earths through the deck in arcs that fade; the nodes cool to grey and the + * body slumps a little. + * - Lazarus Node: a magenta charge crawls over the body through the windup, + * then a white jolt, a burst and a little spring as they come up. + * - Leaps: the Hopper crouches, kicks up dust and arcs over to where it lands, + * with a shadow running along the floor under it. The Piledriver glides to + * its mark and slams down with a ring and a cracked floor. + * - Weapon trails: a Scorch cut throws embers; the Widowline Arc's wire + * lashes out, a small crackle runs along it and sparks burst where it hit. + * - Brownout: worn chrome stutters, warms and dims together, and stutters + * back on when the load comes off. (The LEDs breathing at rest are part of + * the plain worn look in cyberware_anim.dm.) + * - Chrome cradle: the rig's arms come down on the servo beats, carry the ware + * in and sink it, and the patient glitches as it boots. + * + * Timers are one-shot and owned by the thing they animate, or global procs + * holding weak references, so nothing outlives what it draws on. + */ + +#define CYBERWARE_ANIM2_ICON 'voidcrew/modules/cyberware/icons/cyberware_anim2.dmi' +#define CYBERWARE_ANIM2_LARGE_ICON 'voidcrew/modules/cyberware/icons/cyberware_anim2_large.dmi' +#define CHROME_CRADLE_RIG_ICON 'voidcrew/modules/cyberware/icons/chrome_cradle_rig.dmi' + +/// Layer for flashes, arcs and bursts: over everything the bearer wears. +#define CHROME_ANIM2_TOP_LAYER (-(HIGHEST_LAYER - 0.5)) + +/// Worn looks shared with cyberware_anim.dm. +#define CHROME_LOOK_BROWN "brown" +#define CHROME_LOOK_WARM "warm" + +// ========================================================================= +// SHARED HELPERS +// ========================================================================= + +/// Plays a 64x64 state from the batch-2 sheet centred on [bearer]. +/proc/cyberware_anim2_play_large(atom/movable/bearer, state, lifetime, glow = TRUE) + var/obj/effect/abstract/cyberware_anim/holder = cyberware_anim_play(bearer, CYBERWARE_ANIM2_LARGE_ICON, state, CHROME_ANIM2_TOP_LAYER, lifetime, glow) + if(holder) + holder.pixel_x = -16 + holder.pixel_y = -16 + return holder + +/** + * A particle emitter riding [bearer] for [lifetime]. It stops making new + * particles after [emit_time] so the last ones fade out before it goes. + */ +/proc/cyberware_anim_particles(atom/movable/bearer, particles_type, anim_layer, emit_time, lifetime) + if(QDELETED(bearer)) + return null + var/obj/effect/abstract/cyberware_anim/holder = new(null) + holder.bearer = bearer + holder.icon = null + holder.layer = anim_layer + holder.particles = new particles_type + holder.RegisterSignal(bearer, COMSIG_QDELETING, TYPE_PROC_REF(/obj/effect/abstract/cyberware_anim, on_bearer_deleted)) + bearer.vis_contents += holder + addtimer(CALLBACK(holder, TYPE_PROC_REF(/obj/effect/abstract/cyberware_anim, stop_particles)), emit_time) + QDEL_IN(holder, lifetime) + return holder + +/obj/effect/abstract/cyberware_anim/proc/stop_particles() + if(particles) + particles.spawning = 0 + +/// Grey dust kicked up by a landing or a take-off. +/proc/cyberware_grey_dust(turf/where) + if(isnull(where)) + return null + var/obj/effect/temp_visual/mook_dust/dust = new(where) + dust.color = list(0.45, 0.45, 0.45, 0.45, 0.45, 0.45, 0.2, 0.2, 0.2, 0.33, 0.33, 0.35) + return dust + +#define CHROME_FLASH_FILTER "cyberware_flash" + +/// A white flash over [target] that fades back to its own colours. +/proc/cyberware_flash_fx(atom/movable/target, fade_time = 0.25 SECONDS) + if(QDELETED(target)) + return + var/static/list/flash = list(0.4, 0, 0, 0, 0, 0.4, 0, 0, 0, 0, 0.4, 0, 0, 0, 0, 1, 0.6, 0.6, 0.62, 0) + target.add_filter(CHROME_FLASH_FILTER, 43, color_matrix_filter(flash)) + animate(target.get_filter(CHROME_FLASH_FILTER), color = COLOR_MATRIX_IDENTITY, time = fade_time) + // A rebuild of the target's filters lands on the faded end, not the flash. + target.filter_data[CHROME_FLASH_FILTER]["color"] = COLOR_MATRIX_IDENTITY + addtimer(CALLBACK(target, TYPE_PROC_REF(/datum, remove_filter), CHROME_FLASH_FILTER), fade_time + 0.5) + +#undef CHROME_FLASH_FILTER + +// ========================================================================= +// GLITCH (a patient booting new chrome) +// ========================================================================= + +#define CHROME_GLITCH_SLICES "cyberware_glitch_slices" +#define CHROME_GLITCH_RED "cyberware_glitch_red" +#define CHROME_GLITCH_CYAN "cyberware_glitch_cyan" + +/** + * Tears [target] into shifted slices with a red and cyan fringe and a burst + * of static over it, for [duration]. With [flash] it whites out first. With + * [inset] the static keeps to the target's own pixels, which needs a target + * drawn as one piece (KEEP_TOGETHER, as people are). + */ +/proc/cyberware_glitch_fx(atom/movable/target, duration = 0.25 SECONDS, flash = FALSE, inset = FALSE) + if(QDELETED(target)) + return + target.add_filters(list( + list("name" = CHROME_GLITCH_SLICES, "priority" = 40, "params" = displacement_map_filter(icon(CYBERWARE_ANIM2_ICON, "glitch_slices"), size = 3)), + list("name" = CHROME_GLITCH_RED, "priority" = 41, "params" = drop_shadow_filter(x = -1, y = 0, size = 0, color = "#ff2020a0")), + list("name" = CHROME_GLITCH_CYAN, "priority" = 42, "params" = drop_shadow_filter(x = 1, y = 0, size = 0, color = "#20e0ffa0")), + )) + // The slices jump about, then settle. + var/slices = target.get_filter(CHROME_GLITCH_SLICES) + animate(slices, y = 7, time = 0.5) + animate(y = 13, size = 2, time = 0.5) + animate(y = 3, size = 0, time = max(duration - 1, 0.5)) + target.filter_data[CHROME_GLITCH_SLICES]["size"] = 0 + if(flash) + cyberware_flash_fx(target, duration * 0.5) + var/obj/effect/abstract/cyberware_anim/tear = cyberware_anim_play(target, CYBERWARE_ANIM2_ICON, "glitch_tear", CHROME_ANIM2_TOP_LAYER, duration) + if(tear && inset) + tear.blend_mode = BLEND_INSET_OVERLAY + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(cyberware_glitch_end), WEAKREF(target)), duration) + +/proc/cyberware_glitch_end(datum/weakref/target_ref) + var/atom/movable/target = target_ref?.resolve() + if(QDELETED(target)) + return + target.remove_filter(list(CHROME_GLITCH_SLICES, CHROME_GLITCH_RED, CHROME_GLITCH_CYAN)) + +#undef CHROME_GLITCH_SLICES +#undef CHROME_GLITCH_RED +#undef CHROME_GLITCH_CYAN + +// ========================================================================= +// REDLINE BURN +// ========================================================================= + +#define REDLINE_LOOK_FLASH "flash" +/// The crash's first instant: the whole core lit white down the spine. +#define REDLINE_LOOK_SURGE "surge" +#define REDLINE_LOOK_HOT "hot" +#define REDLINE_LOOK_COOL1 "cool1" +#define REDLINE_LOOK_COOL2 "cool2" +#define REDLINE_SAG_FILTER "cyberware_redline_sag" +/// How long the white kick-in flash holds before the nodes run red. +#define REDLINE_FLASH_TIME (0.15 SECONDS) +/// The crash: how long the spine runs white before the charge leaves it for the floor. +#define REDLINE_SPINE_FLASH (0.1 SECONDS) +/// From the discharge to the nodes going grey. +#define REDLINE_COOL_STEP (0.35 SECONDS) +/// The outline's last stutters, drawn by a filter of its own once the window has taken its outline away. +#define REDLINE_GUTTER_FILTER "cyberware_redline_gutter" +/// The window's outline colour (CYBERWARE_REDLINE_OUTLINE_COLOR, ware_legend.dm), lit and out. +#define REDLINE_GUTTER_ON "#ff2a2a" +#define REDLINE_GUTTER_OUT "#ff2a2a00" +/// How long that outline stands at full strength before its first stutter. +#define REDLINE_GUTTER_HOLD (0.1 SECONDS) +/// How long the arcs stand on the deck, how often they change, and how long their tracks take to glow, cool and +/// fade after them. +#define REDLINE_ARC_TIME (0.15 SECONDS) +#define REDLINE_ARC_FLICKER (0.05 SECONDS) +#define REDLINE_GLOW_TIME (2.2 SECONDS) +/// How long the body takes to straighten up out of the slump when the crash ends. +#define REDLINE_STRAIGHTEN_TIME (0.3 SECONDS) +/// The sheet of deck effects, 96 px and centred on the bearer's tile. +#define CYBERWARE_GROUND_ICON 'voidcrew/modules/cyberware/icons/cyberware_ground.dmi' +/// The eyes during the burn. +#define REDLINE_EYE_COLOR "#ff2a1a" +/// The eyes as the red drains out of them. +#define REDLINE_EYE_DYING "#8a2420" + +/obj/item/organ/cyberimp/cyberware/redline + /// The node look drawn over the core, or null for the plain one. + var/burn_look + /// Timer for the next node look. + var/burn_look_timer + /// Who carries our filters and our death watch. + var/datum/weakref/burn_fx_ref + /// The red light the burn throws. + var/datum/weakref/burn_light_ref + +/obj/item/organ/cyberimp/cyberware/redline/cyberware_worn_key() + return "[..()]-[burn_look]" + +/obj/item/organ/cyberimp/cyberware/redline/cyberware_dress_worn(list/imageset, image_layer, obj/item/bodypart/limb) + if(cyberware_worn_look() || !burn_look) + return ..() + var/state = "[aug_overlay]_[burn_look]" + if(!icon_exists(CYBERWARE_ANIM2_ICON, state)) + return ..() + // The node look replaces the core's own glow. + var/list/dressed = list() + for(var/image/part as anything in imageset) + if(PLANE_TO_TRUE(part.plane) == EMISSIVE_PLANE) + continue + dressed += part + // Nodes that still glow shine through whatever is worn on the back; cold ones stay under it. + dressed += cyberware_spine_node_images(CYBERWARE_ANIM2_ICON, state, burn_look != REDLINE_LOOK_COOL2, image_layer, limb?.owner || limb) + if(burn_look == REDLINE_LOOK_HOT || burn_look == REDLINE_LOOK_FLASH || burn_look == REDLINE_LOOK_SURGE) + dressed += redline_eyes(limb, image_layer) + else if(burn_look == REDLINE_LOOK_COOL1) + // The crash: the red drains out of them. + dressed += redline_eyes(limb, image_layer, REDLINE_EYE_DYING, FALSE) + return dressed + +/// Red eyes for the burn, drawn from the bearer's own eye sprites so they sit where their eyes are. +/obj/item/organ/cyberimp/cyberware/redline/proc/redline_eyes(obj/item/bodypart/limb, image_layer, eye_color = REDLINE_EYE_COLOR, glow = TRUE) + var/mob/living/carbon/human/bearer = limb?.owner + if(!istype(bearer)) + return list() + var/obj/item/organ/eyes/eyes = bearer.get_organ_slot(ORGAN_SLOT_EYES) + var/obj/item/bodypart/head/head = bearer.get_bodypart(BODY_ZONE_HEAD) + if(!istype(eyes) || isnull(eyes.eye_icon_state) || !head) + return list() + if(bearer.check_obscured_slots() & ITEM_SLOT_EYES) + return list() + var/list/eye_images = list() + for(var/side in list("_l", "_r")) + var/mutable_appearance/eye = mutable_appearance('icons/mob/human/human_face.dmi', "[eyes.eye_icon_state][side]", image_layer, bearer) + eye.color = eye_color + if(head.worn_face_offset) + head.worn_face_offset.apply_offset(eye) + eye_images += eye + if(!glow) + continue + var/mutable_appearance/eye_glow = emissive_appearance(eye.icon, eye.icon_state, bearer, image_layer) + if(head.worn_face_offset) + head.worn_face_offset.apply_offset(eye_glow) + eye_images += eye_glow + return eye_images + +/obj/item/organ/cyberimp/cyberware/redline/proc/set_burn_look(look) + burn_look_timer = null + if(burn_look == look) + return + burn_look = look + owner?.update_body_parts() + +/obj/item/organ/cyberimp/cyberware/redline/proc/queue_burn_look(look, delay) + if(burn_look_timer) + deltimer(burn_look_timer) + burn_look_timer = addtimer(CALLBACK(src, PROC_REF(set_burn_look), look), delay, TIMER_STOPPABLE) + +/// The window opens: white-hot nodes, then red, red eyes and a red light. The red outline around the +/// body is the window's own (ware_legend.dm). +/obj/item/organ/cyberimp/cyberware/redline/proc/play_burn_window(mob/living/carbon/bearer) + if(QDELETED(bearer) || bearer != owner) + return + clear_burn_fx() + watch_burn_bearer(bearer) + set_burn_look(REDLINE_LOOK_FLASH) + queue_burn_look(REDLINE_LOOK_HOT, REDLINE_FLASH_TIME) + burn_light_ref = WEAKREF(bearer.mob_light(2, 0.7, "#ff3b22", burn_window + 2 SECONDS)) + +/// The roar: a red ring rolls out as far as it reaches. +/obj/item/organ/cyberimp/cyberware/redline/proc/play_burn_roar(mob/living/carbon/bearer, reach) + var/turf/here = get_turf(bearer) + if(here && reach > 0) + new /obj/effect/temp_visual/circle_wave/cyberware_roar(here, reach) + +/** + * The crash. The governor slams shut and the charge it was holding has to go somewhere: the outline gutters out, + * the red drains from the eyes, the spine runs white from neck to hips, and then the charge earths through the + * deck (see [/obj/item/organ/cyberimp/cyberware/redline/proc/ground_burn]). The body slumps. + */ +/obj/item/organ/cyberimp/cyberware/redline/proc/play_burn_crash(mob/living/carbon/bearer) + if(QDELETED(bearer) || bearer != owner) + return + stop_burn_glow(bearer) + watch_burn_bearer(bearer) + if(burn_look_timer) + deltimer(burn_look_timer) + set_burn_look(REDLINE_LOOK_SURGE) + burn_look_timer = addtimer(CALLBACK(src, PROC_REF(ground_burn)), REDLINE_SPINE_FLASH, TIMER_STOPPABLE) + // The window took its outline with it. Ours holds for a beat, then stutters out (gutter_burn). Both filters go + // on before the slump starts to move: adding a filter rebuilds every filter on the body from its stored values + // and drops whatever was animating. + bearer.add_filter(REDLINE_GUTTER_FILTER, 2, outline_filter(1, REDLINE_GUTTER_ON)) + bearer.add_filter(REDLINE_SAG_FILTER, 31, displacement_map_filter(icon(CYBERWARE_ANIM2_ICON, "sag_map"), size = 0)) + animate(bearer.get_filter(REDLINE_SAG_FILTER), size = 2, time = 0.3 SECONDS, easing = QUAD_EASING | EASE_OUT) + bearer.filter_data[REDLINE_SAG_FILTER]["size"] = 2 + addtimer(CALLBACK(src, PROC_REF(gutter_burn), WEAKREF(bearer), 1), REDLINE_GUTTER_HOLD) + +/** + * The outline's last stutters, one a call: out, back dimmer, out, back dimmer still, gone. + * + * Stepped on a timer and stored as it goes, not animated. A second filter animation started on a body in the same + * instant as the slump's does not play, and an outline left lit in its stored values comes back at full strength + * the next time anything rebuilds the body's filters. + */ +/obj/item/organ/cyberimp/cyberware/redline/proc/gutter_burn(datum/weakref/bearer_ref, step) + var/static/list/colours = list(REDLINE_GUTTER_OUT, "#ff2a2ab4", REDLINE_GUTTER_OUT, "#ff2a2a70") + var/static/list/holds = list(0.05 SECONDS, 0.1 SECONDS, 0.05 SECONDS, 0.05 SECONDS) + var/mob/living/carbon/bearer = bearer_ref?.resolve() + if(QDELETED(bearer) || !bearer.get_filter(REDLINE_GUTTER_FILTER)) + return + if(step > length(colours)) + bearer.remove_filter(REDLINE_GUTTER_FILTER) + return + bearer.modify_filter(REDLINE_GUTTER_FILTER, list("color" = colours[step])) + addtimer(CALLBACK(src, PROC_REF(gutter_burn), bearer_ref, step + 1), holds[step]) + +/** + * The charge leaves the spine for the floor. The nodes cool behind it, arcs crawl out across the deck under + * everybody's feet, and on a bearer still standing it runs down the legs first: behind the body, and in front of + * it only when the back is to the camera. + */ +/obj/item/organ/cyberimp/cyberware/redline/proc/ground_burn() + burn_look_timer = null + var/mob/living/carbon/bearer = burn_fx_ref?.resolve() + if(QDELETED(bearer) || bearer != owner) + return + set_burn_look(REDLINE_LOOK_COOL1) + queue_burn_look(REDLINE_LOOK_COOL2, REDLINE_COOL_STEP) + var/turf/deck = get_turf(bearer) + if(!isturf(bearer.loc) || isgroundlessturf(deck)) + return + var/lying = bearer.body_position == LYING_DOWN + new /obj/effect/temp_visual/cyberware_redline_ground(deck, lying) + playsound(deck, SFX_SPARKS, 40, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) + if(lying) + return + var/obj/effect/abstract/cyberware_anim/leg = cyberware_anim_play(bearer, CYBERWARE_ANIM2_ICON, "redline_legarc", CHROME_ANIM2_TOP_LAYER, REDLINE_ARC_TIME, glow = TRUE) + if(leg && !(bearer.dir & NORTH)) + leg.vis_flags |= VIS_UNDERLAY + +/// Takes the light off; the nodes and the slump stay. +/obj/item/organ/cyberimp/cyberware/redline/proc/stop_burn_glow(mob/living/carbon/bearer) + qdel(burn_light_ref?.resolve()) + burn_light_ref = null + +/obj/item/organ/cyberimp/cyberware/redline/proc/watch_burn_bearer(mob/living/carbon/bearer) + burn_fx_ref = WEAKREF(bearer) + RegisterSignal(bearer, COMSIG_LIVING_DEATH, PROC_REF(on_burn_bearer_death), override = TRUE) + +/obj/item/organ/cyberimp/cyberware/redline/proc/on_burn_bearer_death(datum/source) + SIGNAL_HANDLER + clear_burn_fx() + +/// Back to the plain core: no node look, no halo, light or slump. [straighten] eases a living body up out of the +/// slump (the crash running its course); otherwise the slump goes at once. +/obj/item/organ/cyberimp/cyberware/redline/proc/clear_burn_fx(straighten = FALSE) + if(burn_look_timer) + deltimer(burn_look_timer) + burn_look_timer = null + var/mob/living/carbon/bearer = burn_fx_ref?.resolve() + burn_fx_ref = null + stop_burn_glow(bearer) + if(!QDELETED(bearer)) + UnregisterSignal(bearer, COMSIG_LIVING_DEATH) + bearer.remove_filter(REDLINE_GUTTER_FILTER) + var/sag = bearer.get_filter(REDLINE_SAG_FILTER) + if(sag && straighten && bearer.stat != DEAD) + animate(sag, size = 0, time = REDLINE_STRAIGHTEN_TIME, easing = QUAD_EASING | EASE_OUT) + bearer.filter_data[REDLINE_SAG_FILTER]["size"] = 0 + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(cyberware_redline_straightened), WEAKREF(bearer)), REDLINE_STRAIGHTEN_TIME) + else + bearer.remove_filter(REDLINE_SAG_FILTER) + if(isnull(burn_look)) + return + burn_look = null + if(!QDELETED(bearer)) + bearer.update_body_parts() + +/// The body is upright again: the slump's filter, flat by now, comes off. A slump put on since is left alone. +/proc/cyberware_redline_straightened(datum/weakref/bearer_ref) + var/mob/living/carbon/bearer = bearer_ref?.resolve() + if(QDELETED(bearer) || bearer.filter_data?[REDLINE_SAG_FILTER]?["size"]) + return + bearer.remove_filter(REDLINE_SAG_FILTER) + +/// The core in the bearer's OS slot, if it is a Redline model. +/proc/cyberware_bearer_redline(mob/living/bearer) + if(!iscarbon(bearer)) + return null + var/mob/living/carbon/carbon_bearer = bearer + var/obj/item/organ/cyberimp/cyberware/redline/core = carbon_bearer.get_organ_slot(ORGAN_SLOT_CYBERWARE_OS) + return istype(core) ? core : null + +/// Hook for the window's on_apply(). +/proc/cyberware_redline_window_fx(mob/living/bearer) + cyberware_bearer_redline(bearer)?.play_burn_window(bearer) + +/// Hook for the roar, with the reach it was given. +/proc/cyberware_redline_roar_fx(mob/living/bearer, reach) + cyberware_bearer_redline(bearer)?.play_burn_roar(bearer, reach) + +/// Hook for the window's on_remove(), after it has (or hasn't) applied the crash. +/proc/cyberware_redline_window_end_fx(mob/living/bearer) + var/obj/item/organ/cyberimp/cyberware/redline/core = cyberware_bearer_redline(bearer) + if(core && !bearer.has_status_effect(/datum/status_effect/cyberware_redline_crash)) + core.clear_burn_fx() + +/// Hook for the crash's on_apply(). +/proc/cyberware_redline_crash_fx(mob/living/bearer) + cyberware_bearer_redline(bearer)?.play_burn_crash(bearer) + +/// Hook for the crash's on_remove(). +/proc/cyberware_redline_crash_end_fx(mob/living/bearer) + cyberware_bearer_redline(bearer)?.clear_burn_fx(straighten = TRUE) + +/obj/item/organ/cyberimp/cyberware/redline/cyberware_anim_clear(mob/living/carbon/old_owner) + . = ..() + clear_burn_fx() + +/// The roar's ring, out as far as the roar reaches. It rolls across the floor, so it is drawn on the floor: under +/// everyone and everything standing in its way, whichever side of the bearer they are on. +/obj/effect/temp_visual/circle_wave/cyberware_roar + color = "#ff4a2a" + max_alpha = 200 + duration = 0.5 SECONDS + plane = FLOOR_PLANE + layer = ABOVE_OPEN_TURF_LAYER + +/obj/effect/temp_visual/circle_wave/cyberware_roar/Initialize(mapload, reach = 5) + // The 64 px ring, scaled so its edge lands [reach] tiles out. + amount_to_scale = reach + 0.5 + return ..() + +/** + * The Redline's charge earthing through the deck. Arcs crawl out across the floor under everybody's feet and + * flicker; the tracks they leave glow, cool to a scorch and fade to nothing. Nothing of it outlasts its duration. + * + * It is floor: on the floor plane, and shifted with pixel_w and pixel_z so the 96 px picture stays on its own + * tile's row. Shifted with pixel_y it would sort a row forward, and its glow would light the bearer through. + */ +/obj/effect/temp_visual/cyberware_redline_ground + icon = CYBERWARE_GROUND_ICON + icon_state = "redline_arcs_standing_1" + plane = FLOOR_PLANE + layer = ABOVE_OPEN_TURF_LAYER + pixel_w = -32 + pixel_z = -32 + randomdir = FALSE + duration = REDLINE_ARC_TIME + REDLINE_GLOW_TIME + light_range = 2 + light_power = 0.9 + light_color = "#ff5a3a" + /// Where on the tile the charge reaches the deck: "standing" at the feet, "lying" along the length of the back. + var/shape = "standing" + +/obj/effect/temp_visual/cyberware_redline_ground/Initialize(mapload, lying = FALSE) + . = ..() + shape = lying ? "lying" : "standing" + show_arcs(1) + addtimer(CALLBACK(src, PROC_REF(show_arcs), 2), REDLINE_ARC_FLICKER) + addtimer(CALLBACK(src, PROC_REF(show_arcs), 1), REDLINE_ARC_FLICKER * 2) + addtimer(CALLBACK(src, PROC_REF(leave_glow)), REDLINE_ARC_TIME) + +/// One of the two arc pictures, and the same picture again as its glow, so the two are never out of step. +/obj/effect/temp_visual/cyberware_redline_ground/proc/show_arcs(picture) + icon_state = "redline_arcs_[shape]_[picture]" + cut_overlays() + add_overlay(emissive_appearance(icon, icon_state, src)) + +/// The arcs are gone: their tracks glow, cool and fade. +/obj/effect/temp_visual/cyberware_redline_ground/proc/leave_glow() + icon_state = "redline_glow_[shape]" + cut_overlays() + add_overlay(emissive_appearance(icon, icon_state, src, alpha = 150)) + set_light(0) + animate(src, alpha = 255, time = REDLINE_GLOW_TIME * 0.15) + animate(color = "#6a5350", time = REDLINE_GLOW_TIME * 0.3) + animate(alpha = 0, time = REDLINE_GLOW_TIME * 0.5) + +#undef REDLINE_LOOK_FLASH +#undef REDLINE_LOOK_SURGE +#undef REDLINE_LOOK_HOT +#undef REDLINE_LOOK_COOL1 +#undef REDLINE_LOOK_COOL2 +#undef REDLINE_SAG_FILTER +#undef REDLINE_FLASH_TIME +#undef REDLINE_COOL_STEP +#undef REDLINE_SPINE_FLASH +#undef REDLINE_GUTTER_FILTER +#undef REDLINE_GUTTER_ON +#undef REDLINE_GUTTER_OUT +#undef REDLINE_GUTTER_HOLD +#undef REDLINE_ARC_TIME +#undef REDLINE_ARC_FLICKER +#undef REDLINE_STRAIGHTEN_TIME +#undef REDLINE_GLOW_TIME +#undef REDLINE_EYE_DYING +#undef CYBERWARE_GROUND_ICON +#undef REDLINE_EYE_COLOR + +// ========================================================================= +// LAZARUS NODE +// ========================================================================= + +#define LAZARUS_SPRING_OFFSET "cyberware_lazarus_spring" +#define LAZARUS_CHARGE_FILTER "cyberware_lazarus_charge" + +/obj/item/organ/cyberimp/cyberware/lazarus + /// Who carries the charge's magenta halo. + var/datum/weakref/charge_fx_ref + /// The charge glow on the chest through the windup. + var/datum/weakref/charge_glow_ref + /// The arcs crawling over the body through the windup. + var/datum/weakref/charge_arcs_ref + /// The magenta light of the charge. + var/datum/weakref/charge_light_ref + +/// The windup: the node charges, magenta arcs crawl out over the body. +/obj/item/organ/cyberimp/cyberware/lazarus/proc/play_charge_fx(mob/living/carbon/patient, windup) + clear_charge_fx() + if(QDELETED(patient)) + return + charge_glow_ref = WEAKREF(cyberware_anim_play(patient, CYBERWARE_ANIM2_ICON, "lazarus_charge", CHROME_ANIM2_TOP_LAYER, windup, glow = TRUE)) + charge_arcs_ref = WEAKREF(cyberware_anim2_play_large(patient, "lazarus_arcs", windup)) + charge_light_ref = WEAKREF(patient.mob_light(1.5, 0.8, "#e700e3", windup)) + // The whole body takes on the charge, brighter as it fills. + charge_fx_ref = WEAKREF(patient) + patient.add_filter(LAZARUS_CHARGE_FILTER, 33, drop_shadow_filter(x = 0, y = 0, size = 1, color = "#e700e340")) + animate(patient.get_filter(LAZARUS_CHARGE_FILTER), size = 2.5, color = "#e700e3b0", time = windup, easing = QUAD_EASING | EASE_IN) + patient.filter_data[LAZARUS_CHARGE_FILTER]["size"] = 2.5 + patient.filter_data[LAZARUS_CHARGE_FILTER]["color"] = "#e700e3b0" + +/// Takes the charge off whoever it is on. +/obj/item/organ/cyberimp/cyberware/lazarus/proc/clear_charge_fx() + qdel(charge_glow_ref?.resolve()) + qdel(charge_arcs_ref?.resolve()) + qdel(charge_light_ref?.resolve()) + charge_glow_ref = null + charge_arcs_ref = null + charge_light_ref = null + var/mob/living/carbon/patient = charge_fx_ref?.resolve() + charge_fx_ref = null + if(!QDELETED(patient)) + patient.remove_filter(LAZARUS_CHARGE_FILTER) + +/// The jolt: a white flash, a burst and a light, and a little spring off the floor. +/obj/item/organ/cyberimp/cyberware/lazarus/proc/play_jolt_fx(mob/living/carbon/patient) + clear_charge_fx() + if(QDELETED(patient)) + return + cyberware_anim2_play_large(patient, "lazarus_jolt", 0.5 SECONDS) + patient.mob_light(2.5, 1.4, "#ffe6ff", 0.3 SECONDS) + cyberware_flash_fx(patient, 0.25 SECONDS) + patient.add_offsets(LAZARUS_SPRING_OFFSET, z_add = 3, animate = FALSE) + addtimer(CALLBACK(patient, TYPE_PROC_REF(/mob/living, remove_offsets), LAZARUS_SPRING_OFFSET), 0.5) + +/obj/item/organ/cyberimp/cyberware/lazarus/cyberware_anim_clear(mob/living/carbon/old_owner) + . = ..() + clear_charge_fx() + +#undef LAZARUS_SPRING_OFFSET +#undef LAZARUS_CHARGE_FILTER + +// ========================================================================= +// LEAPS +// ========================================================================= + +/// Set at take-off to when the leap should be down. A leap whose landing never +/// runs is put back on the floor shortly after. +/mob/living/var/cyberware_leap_until = 0 +/// How the body's steps were animated before a leap switched that off, to put back once it has landed. +/mob/living/var/cyberware_leap_steps + +/// Where a leaping body draws among the things on its row: over anyone standing there, since it is above them. +#define CYBERWARE_LEAP_LAYER (ABOVE_MOB_LAYER + 0.05) +/// How long a leap that holds its height takes to come down at the end. +#define CYBERWARE_LEAP_SLAM (0.1 SECONDS) + +/// Where the body sits at rest, before any leap offset. +/proc/cyberware_leap_rest(mob/living/jumper, pixel) + var/base = jumper.base_pixel_z + switch(pixel) + if(PIXEL_W_OFFSET) + base = jumper.base_pixel_w + if(PIXEL_Y_OFFSET) + base = jumper.base_pixel_y + return base + jumper.has_offset(pixel = pixel) + +/** + * Take-off. The body arcs from [launch] over to [landing] and is down on the landing tile when [airtime] ends, so + * the landing's dust, ring and sound meet it there. With [height] under [peak] it rises to [peak] halfway and + * falls; with [height] at [peak] it climbs, holds that height over to its mark and drops in the last + * CYBERWARE_LEAP_SLAM of the flight. The body stays on its own tile until the landing moves it; only the drawing + * travels. + * + * The fall is started by a timer of its own, on the same clock as the landing: a server running slow holds the + * body up until its landing is nearly due, and never stands it on the tile ahead of its own impact. + * + * The run along the floor goes at an even pace and only the height eases, so the body never hangs at the top of + * its arc. The run up and down the screen is pixel_y, which carries the body's place in the front-to-back order + * along with it: it draws in front of what it has passed and behind what it hasn't. The height is pixel_z, which + * changes nothing but the drawing. On its row it draws over whoever stands there. + */ +/proc/cyberware_leap_takeoff_fx(mob/living/jumper, turf/launch, turf/landing, airtime, height, peak, obj/effect/afterimage) + if(QDELETED(jumper)) + return + if(afterimage) + // The crouch the pistons fired out of. + var/matrix/squash = matrix(afterimage.transform) + squash.Scale(1.08, 0.86) + squash.Translate(0, -2) + afterimage.transform = squash + cyberware_grey_dust(launch) + var/dx = 0 + var/dy = 0 + if(launch && landing) + dx = (landing.x - launch.x) * ICON_SIZE_X + dy = (landing.y - launch.y) * ICON_SIZE_Y + var/rest_w = cyberware_leap_rest(jumper, PIXEL_W_OFFSET) + var/rest_y = cyberware_leap_rest(jumper, PIXEL_Y_OFFSET) + var/rest_z = cyberware_leap_rest(jumper, PIXEL_Z_OFFSET) + if(jumper.layer == initial(jumper.layer) || jumper.layer == LYING_MOB_LAYER) + jumper.layer = CYBERWARE_LEAP_LAYER + // The landing moves the body onto a tile its drawing has already reached, so that move must not glide. The + // client only honours this for moves that come after it has heard of it, so it is set here, not at the landing. + if(jumper.animate_movement != NO_STEPS) + jumper.cyberware_leap_steps = jumper.animate_movement + jumper.animate_movement = NO_STEPS + animate(jumper, pixel_w = rest_w + dx, pixel_y = rest_y + dy, time = airtime, flags = ANIMATION_PARALLEL) + var/fall = airtime * 0.5 + var/rise = airtime * 0.5 + if(height >= peak) + fall = min(CYBERWARE_LEAP_SLAM, airtime * 0.5) + rise = (airtime - fall) * 0.4 + animate(jumper, pixel_z = rest_z + peak, time = rise, easing = QUAD_EASING | EASE_OUT, flags = ANIMATION_PARALLEL) + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(cyberware_leap_fall_fx), WEAKREF(jumper), fall), airtime - fall) + if(dx || dy) + new /obj/effect/temp_visual/cyberware_leap_shadow(launch, dx, dy, airtime) + jumper.cyberware_leap_until = world.time + airtime + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(cyberware_leap_failsafe), WEAKREF(jumper)), airtime + 0.5 SECONDS) + +/// The last of a leap: the body comes down over its landing tile, arriving as the landing is due. +/proc/cyberware_leap_fall_fx(datum/weakref/jumper_ref, fall) + var/mob/living/jumper = jumper_ref?.resolve() + if(QDELETED(jumper) || !jumper.cyberware_leap_until) + return + animate(jumper, pixel_z = cyberware_leap_rest(jumper, PIXEL_Z_OFFSET), time = fall, easing = QUAD_EASING | EASE_IN, flags = ANIMATION_PARALLEL) + +/** + * Touchdown: the arc has brought the body down over its landing tile, and the drawing goes back to the body. The + * move onto that tile, which the caller makes right after this, must not glide: the drawing is already there. + */ +/proc/cyberware_leap_touchdown_fx(mob/living/jumper) + if(QDELETED(jumper)) + return + jumper.cyberware_leap_until = 0 + if(jumper.layer == CYBERWARE_LEAP_LAYER) + jumper.layer = jumper.body_position == LYING_DOWN ? LYING_MOB_LAYER : initial(jumper.layer) + // Ends every track of the arc where it stands. + animate(jumper, pixel_w = cyberware_leap_rest(jumper, PIXEL_W_OFFSET), pixel_y = cyberware_leap_rest(jumper, PIXEL_Y_OFFSET), pixel_z = cyberware_leap_rest(jumper, PIXEL_Z_OFFSET), time = 0, flags = ANIMATION_END_NOW) + // Steps glide again once the landing's own move has gone out. + if(!isnull(jumper.cyberware_leap_steps)) + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(cyberware_leap_steps_back), WEAKREF(jumper)), 0.2 SECONDS) + +/// Gives a landed body its step animation back, unless it is already in the air again. +/proc/cyberware_leap_steps_back(datum/weakref/jumper_ref) + var/mob/living/jumper = jumper_ref?.resolve() + if(QDELETED(jumper) || jumper.cyberware_leap_until || isnull(jumper.cyberware_leap_steps)) + return + jumper.animate_movement = jumper.cyberware_leap_steps + jumper.cyberware_leap_steps = null + +/// A leap whose landing never ran (the pistons were pulled mid-air) is put back down. +/proc/cyberware_leap_failsafe(datum/weakref/jumper_ref) + var/mob/living/jumper = jumper_ref?.resolve() + if(QDELETED(jumper) || !jumper.cyberware_leap_until || world.time < jumper.cyberware_leap_until) + return + cyberware_leap_touchdown_fx(jumper) + +/// The Piledriver's impact: a ring rolls out over the shockwave and the floor cracks. +/proc/cyberware_piledriver_impact_fx(turf/where, reach) + if(isnull(where)) + return + new /obj/effect/temp_visual/circle_wave/cyberware_slam/floor(where, reach) + new /obj/effect/temp_visual/cyberware_impact_cracks(where, "damaged1", 255) + for(var/direction in GLOB.cardinals) + var/turf/next = get_step(where, direction) + if(next) + new /obj/effect/temp_visual/cyberware_impact_cracks(next, "damaged5", 140) + +/// The shadow that runs along the floor under a leap. +/obj/effect/temp_visual/cyberware_leap_shadow + icon = CYBERWARE_ANIM2_ICON + icon_state = "leap_shadow" + layer = BELOW_MOB_LAYER + randomdir = FALSE + duration = 0.3 SECONDS + +/obj/effect/temp_visual/cyberware_leap_shadow/Initialize(mapload, dx = 0, dy = 0, airtime = 0.2 SECONDS) + duration = airtime + 0.1 SECONDS + . = ..() + animate(src, pixel_x = dx, pixel_y = dy, time = airtime) + animate(src, transform = matrix().Scale(0.7), time = airtime * 0.5, easing = SINE_EASING | EASE_OUT, flags = ANIMATION_PARALLEL) + animate(transform = matrix(), time = airtime * 0.5, easing = SINE_EASING | EASE_IN) + +/// The Piledriver's ring: grey, out over the shockwave. +/obj/effect/temp_visual/circle_wave/cyberware_slam + color = "#d8d4cc" + max_alpha = 220 + duration = 0.4 SECONDS + layer = BELOW_MOB_LAYER + +/obj/effect/temp_visual/circle_wave/cyberware_slam/Initialize(mapload, reach = 2) + amount_to_scale = reach + 0.5 + return ..() + +/// The same ring drawn on the floor, under everyone and everything standing in its way, whichever side of the +/// landing they are on. The Piledriver's own; the plain one is also what a Gorilla fist throws. +/obj/effect/temp_visual/circle_wave/cyberware_slam/floor + plane = FLOOR_PLANE + layer = ABOVE_OPEN_TURF_LAYER + +/// Cracks the Piledriver leaves in the floor. They fade on their own. +/obj/effect/temp_visual/cyberware_impact_cracks + icon = 'icons/turf/damaged.dmi' + icon_state = "damaged1" + plane = FLOOR_PLANE + layer = ABOVE_OPEN_TURF_LAYER + randomdir = FALSE + duration = 8 SECONDS + +/obj/effect/temp_visual/cyberware_impact_cracks/Initialize(mapload, state = "damaged1", peak_alpha = 255) + . = ..() + var/turf/here = loc + // Nothing to crack in space, open air or a chasm. + if(!isfloorturf(here)) + return INITIALIZE_HINT_QDEL + icon_state = state + alpha = peak_alpha + animate(src, alpha = peak_alpha, time = duration - 2 SECONDS) + animate(alpha = 0, time = 2 SECONDS) + +// ========================================================================= +// WEAPON TRAILS +// ========================================================================= + +/// A landed Scorch cut: embers fly off whoever it cut. The burning slash itself +/// is the blade's impact (cyberware_anim.dm), so nothing else is drawn on top. +/proc/cyberware_scorch_trail_fx(mob/living/user, mob/living/target) + var/turf/here = get_turf(target) + if(isnull(here)) + return + new /obj/effect/temp_visual/cyberware_scorch_embers(here) + +/// Only the embers: the picture is blank. +/obj/effect/temp_visual/cyberware_scorch_embers + layer = ABOVE_MOB_LAYER + randomdir = FALSE + duration = 0.7 SECONDS + +/obj/effect/temp_visual/cyberware_scorch_embers/Initialize(mapload) + . = ..() + particles = new /particles/embers/spark/cyberware_scorch + addtimer(CALLBACK(src, PROC_REF(stop_embers)), 1) + +/obj/effect/temp_visual/cyberware_scorch_embers/proc/stop_embers() + if(particles) + particles.spawning = 0 + +/// One burst of embers off a Scorch cut. +/particles/embers/spark/cyberware_scorch + count = 8 + spawning = 8 + lifespan = 0.6 SECONDS + fade = 0.4 SECONDS + velocity = generator(GEN_CIRCLE, 2, 3, SQUARE_RAND) + gravity = list(0, -0.15) + +/// A landed Widowline Arc swing: the wire lashes out to whatever it hit, a +/// blue-white line held as long as the shock's crackle runs along it. +/proc/cyberware_monowire_lash_fx(mob/living/user, atom/target) + if(QDELETED(user) || QDELETED(target) || get_turf(user) == get_turf(target)) + return + user.Beam(target, icon_state = "monowire_lash", icon = CYBERWARE_ANIM2_ICON, time = 0.5 SECONDS) + +/// The Arc's shock: a small crackle runs along the wire and sparks burst where +/// it touched. It's a wire, so there is no bolt of its own. +/proc/cyberware_arc_crackle_fx(mob/living/user, atom/target) + if(QDELETED(user) || QDELETED(target)) + return + if(get_turf(user) != get_turf(target)) + user.Beam(target, icon_state = "arc_crackle", icon = CYBERWARE_ANIM2_ICON, time = 0.5 SECONDS) + var/turf/there = get_turf(target) + if(there) + new /obj/effect/temp_visual/cyberware_arc_hit(there) + +/obj/effect/temp_visual/cyberware_arc_hit + icon = CYBERWARE_ANIM2_LARGE_ICON + icon_state = "arc_hit" + pixel_x = -16 + pixel_y = -16 + layer = ABOVE_MOB_LAYER + randomdir = FALSE + duration = 0.4 SECONDS + +/obj/effect/temp_visual/cyberware_arc_hit/Initialize(mapload) + . = ..() + add_overlay(emissive_appearance(icon, icon_state, src)) + +// ========================================================================= +// BROWNOUT +// ========================================================================= + +/// Step between the frames of a brownout stutter. +#define BROWNOUT_STEP (0.1 SECONDS) + +/** + * The brownout picture for one bearer: every worn piece stutters, warms and + * dims together on the way down, and stutters back on on the way up. The + * brownout itself has already happened; this only plays the picture, and + * clearing it at any point leaves each piece drawn as its state says. + */ +/datum/component/chrome_brownout_show + dupe_mode = COMPONENT_DUPE_UNIQUE + /// Looks still to play, in order. + var/list/steps + /// Timer for the next look. + var/step_timer + /// Pieces whose look this show has set. + var/list/datum/weakref/touched = list() + +/datum/component/chrome_brownout_show/Initialize() + if(!iscarbon(parent)) + return COMPONENT_INCOMPATIBLE + +/datum/component/chrome_brownout_show/RegisterWithParent() + RegisterSignal(parent, COMSIG_LIVING_DEATH, PROC_REF(on_death)) + +/datum/component/chrome_brownout_show/UnregisterFromParent() + UnregisterSignal(parent, COMSIG_LIVING_DEATH) + +/datum/component/chrome_brownout_show/Destroy() + if(step_timer) + deltimer(step_timer) + step_timer = null + var/changed = FALSE + for(var/datum/weakref/piece_ref as anything in touched) + var/obj/item/organ/piece = piece_ref.resolve() + var/datum/component/cyberware/chrome = piece?.GetComponent(/datum/component/cyberware) + if(chrome?.brownout_look) + chrome.brownout_look = null + changed = TRUE + touched.Cut() + var/mob/living/carbon/bearer = parent + if(changed && !QDELETED(bearer)) + bearer.update_body_parts() + return ..() + +/datum/component/chrome_brownout_show/proc/on_death(datum/source) + SIGNAL_HANDLER + qdel(src) + +/// Starts the stutter: down when [tripped], back up otherwise. +/datum/component/chrome_brownout_show/proc/play(tripped) + if(tripped) + steps = list(CHROME_LOOK_WARM, CHROME_LOOK_BROWN, CHROME_LOOK_WARM, CHROME_LOOK_BROWN, CHROME_LOOK_BROWN, CHROME_LOOK_WARM, CHROME_LOOK_BROWN) + else + steps = list(CHROME_LOOK_BROWN, CHROME_LOOK_WARM, CHROME_LOOK_BROWN, CHROME_LOOK_BROWN, CHROME_LOOK_WARM, CHROME_LOOK_BROWN) + if(step_timer) + deltimer(step_timer) + step_timer = null + advance() + +/datum/component/chrome_brownout_show/proc/advance() + step_timer = null + if(!length(steps)) + qdel(src) + return + var/look = popleft(steps) + var/mob/living/carbon/bearer = parent + for(var/obj/item/organ/piece as anything in get_installed_cyberware(bearer)) + var/obj/item/organ/cyberimp/implant = piece + if(!istype(implant) || !implant.bodypart_aug) + continue + var/datum/component/cyberware/chrome = piece.GetComponent(/datum/component/cyberware) + if(!chrome) + continue + chrome.brownout_look = look + touched |= WEAKREF(piece) + bearer.update_body_parts() + step_timer = addtimer(CALLBACK(src, PROC_REF(advance)), BROWNOUT_STEP, TIMER_STOPPABLE) + +/// Hook for the brownout monitor: [bearer]'s chrome just went down ([tripped]) or came back. +/proc/cyberware_brownout_fx(mob/living/carbon/bearer, tripped) + if(!iscarbon(bearer) || QDELETED(bearer)) + return + if(bearer.stat == DEAD) + // No show on a corpse: just draw it as it is. + bearer.update_body_parts() + return + var/datum/component/chrome_brownout_show/show = bearer.GetComponent(/datum/component/chrome_brownout_show) || bearer.AddComponent(/datum/component/chrome_brownout_show) + show?.play(tripped) + +#undef BROWNOUT_STEP + +// ========================================================================= +// CHROME CRADLE RIG +// ========================================================================= + +/// Layers on the cradle: the rig over the ware, both over the patient. +#define RIG_LAYER (ABOVE_MOB_LAYER + 0.02) +#define RIG_WARE_LAYER (ABOVE_MOB_LAYER + 0.01) +/// The gripper's tip, as pixel offsets of the carried ware's centre on the cradle tile. +#define RIG_WARE_X 4 +#define RIG_WARE_PARKED_Y 19 +#define RIG_WARE_WORK_Y 2 +/// How long each move of the rig takes, matching its art. +#define RIG_GRIP_TIME (0.6 SECONDS) +#define RIG_PRESS_TIME (0.4 SECONDS) +#define RIG_RETRACT_TIME (0.3 SECONDS) + +/obj/machinery/chrome_cradle + /// The rig's current move, or null while it is parked. + var/rig_phase + /// The rig drawing that move. + var/datum/weakref/rig_ref + /// The ware in the gripper. + var/datum/weakref/rig_ware_ref + /// Timer that parks the rig once it has pulled back. + var/rig_park_timer + +/obj/machinery/chrome_cradle/update_overlays() + . = ..() + if(rig_phase) + return + // The parked rig, over whoever lies on the slab. + var/mutable_appearance/rig = mutable_appearance(CHROME_CRADLE_RIG_ICON, "rig", RIG_LAYER) + rig.pixel_x = -16 + rig.pixel_y = -16 + . += rig + var/mutable_appearance/rig_glow = emissive_appearance(CHROME_CRADLE_RIG_ICON, "rig_e", src, RIG_LAYER) + rig_glow.pixel_x = -16 + rig_glow.pixel_y = -16 + . += rig_glow + +/// Plays one move of the rig: [phase] is a state of the rig sheet without its "rig_". +/obj/machinery/chrome_cradle/proc/play_rig(phase) + if(rig_park_timer) + deltimer(rig_park_timer) + rig_park_timer = null + qdel(rig_ref?.resolve()) + var/was_parked = isnull(rig_phase) + rig_phase = phase + if(was_parked) + update_appearance(UPDATE_OVERLAYS) + var/state = "rig_[phase]" + var/obj/effect/abstract/cyberware_anim/rig = cyberware_anim_play(src, CHROME_CRADLE_RIG_ICON, state, RIG_LAYER, CYBERWARE_INSTALL_TIME + 1 SECONDS) + if(!rig) + return + rig.pixel_x = -16 + rig.pixel_y = -16 + rig.add_overlay(emissive_appearance(CHROME_CRADLE_RIG_ICON, "[state]_e", src)) + rig_ref = WEAKREF(rig) + +/// A servo beat of the install: the arms come down, the gripper brings the ware, then presses it in. +/obj/machinery/chrome_cradle/proc/rig_beat(mid_stage) + if(busy_action != "install") + return + if(mid_stage) + play_rig("press") + var/obj/effect/abstract/cyberware_anim/carried = rig_ware_ref?.resolve() + if(carried) + animate(carried, pixel_y = RIG_WARE_WORK_Y - 3, transform = matrix().Scale(0.2), alpha = 0, time = RIG_PRESS_TIME, easing = QUAD_EASING | EASE_IN) + return + if(isnull(rig_phase) || rig_phase == "retract") + play_rig("arms_down") + return + play_rig("grip_down") + qdel(rig_ware_ref?.resolve()) + if(QDELETED(busy_ware)) + return + var/obj/effect/abstract/cyberware_anim/carried = cyberware_anim_play(src, busy_ware.icon, busy_ware.icon_state, RIG_WARE_LAYER, CYBERWARE_INSTALL_TIME) + if(!carried) + return + carried.transform = matrix().Scale(0.45) + carried.pixel_x = RIG_WARE_X + carried.pixel_y = RIG_WARE_PARKED_Y + animate(carried, pixel_y = RIG_WARE_WORK_Y, time = RIG_GRIP_TIME, easing = CUBIC_EASING | EASE_OUT) + rig_ware_ref = WEAKREF(carried) + +/// The sequence is over, done or not: the rig pulls back and parks. +/obj/machinery/chrome_cradle/proc/rig_stop() + qdel(rig_ware_ref?.resolve()) + rig_ware_ref = null + if(isnull(rig_phase) || rig_phase == "retract") + return + play_rig("retract") + rig_park_timer = addtimer(CALLBACK(src, PROC_REF(park_rig)), RIG_RETRACT_TIME, TIMER_STOPPABLE) + +/obj/machinery/chrome_cradle/proc/park_rig() + rig_park_timer = null + qdel(rig_ref?.resolve()) + rig_ref = null + rig_phase = null + update_appearance(UPDATE_OVERLAYS) + +/// The ware boots in its new owner: a glitch runs over them. +/obj/machinery/chrome_cradle/proc/rig_boot_fx(mob/living/carbon/patient) + cyberware_glitch_fx(patient, 0.2 SECONDS, flash = TRUE, inset = TRUE) + +#undef RIG_LAYER +#undef RIG_WARE_LAYER +#undef RIG_WARE_X +#undef RIG_WARE_PARKED_Y +#undef RIG_WARE_WORK_Y +#undef RIG_GRIP_TIME +#undef RIG_PRESS_TIME +#undef RIG_RETRACT_TIME + +#undef CYBERWARE_LEAP_LAYER +#undef CYBERWARE_LEAP_SLAM +#undef CYBERWARE_ANIM2_ICON +#undef CYBERWARE_ANIM2_LARGE_ICON +#undef CHROME_CRADLE_RIG_ICON +#undef CHROME_ANIM2_TOP_LAYER +#undef CHROME_LOOK_BROWN +#undef CHROME_LOOK_WARM diff --git a/voidcrew/modules/cyberware/cyberware_base.dm b/voidcrew/modules/cyberware/cyberware_base.dm index 367f077f491..c3c034580bc 100644 --- a/voidcrew/modules/cyberware/cyberware_base.dm +++ b/voidcrew/modules/cyberware/cyberware_base.dm @@ -20,38 +20,88 @@ * (autosurgeon.dm's "insertion failed!" path). */ /** - * The worn-chrome overlay: tg's augment overlay, drawn one notch higher. - * Stock augments sit at BODY_ADJ_LAYER, which the character-setup underwear - * layer paints over, a bra would cover a Cascade spine rig. Chrome instead - * draws at CYBERWARE_WORN_LAYER: over underwear and undershirts, still under - * eyes, damage, and every EQUIPPED clothing layer. One override covers the - * images, the emissive twins and the emissive blockers alike, because they - * all take their layer from bitflag_to_layer(). + * The worn-chrome overlay: tg's augment overlay, drawn higher. Stock augments + * sit at BODY_ADJ_LAYER, under underwear and every piece of clothing. Chrome + * draws at CYBERWARE_WORN_LAYER instead: over the jumpsuit, still under hands, + * gloves, shoes and suits. One override covers the images, the emissive twins + * and the emissive blockers alike, because they all take their layer from + * bitflag_to_layer(). + * + * Plating grown into the skin (worn_under_clothes) is skin: it stays where + * stock augments sit, under everything that is worn. */ /datum/bodypart_overlay/augment/cyberware /datum/bodypart_overlay/augment/cyberware/bitflag_to_layer(layer) if(layer == EXTERNAL_ADJACENT) + var/obj/item/organ/cyberimp/cyberware/ware = implant + if(istype(ware) && ware.worn_under_clothes) + return ..() return -CYBERWARE_WORN_LAYER return ..() +// Arm hardware whose worn sprite draws the folded item (the Mantis line) is not +// drawn while that item is out in a hand. Hiding here also drops the overlay from +// the limb's icon key, so update_body_parts() redraws the arm on the flip. +/datum/bodypart_overlay/augment/cyberware/can_draw_on_bodypart(obj/item/bodypart/bodypart_owner) + // A bearer being deleted can lose its chrome before its clothes, and taking + // the clothes off redraws the limbs while this overlay is still on them. + if(!implant) + return FALSE + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/arm_ware = implant + if(istype(arm_ware) && arm_ware.worn_overlay_hidden()) + return FALSE + return ..() + +/** + * The parent puts an emissive blocker over every image it draws, the glow + * included. Same layer, later in the list, so a Cascade or Redline would black + * out its own glow. Glows skip the blocker and go last, after every blocker of + * this overlay, the same order tg's worn clothing uses. + */ +/datum/bodypart_overlay/augment/cyberware/get_overlay(layer, obj/item/bodypart/limb) + layer = bitflag_to_layer(layer) + var/list/imageset = implant.get_overlay(layer, limb) + // EMP static, dark and blink looks, the folding housing, the spine nodes (cyberware_anim.dm). + imageset = implant.cyberware_dress_worn(imageset, layer, limb) + if(blocks_emissive == EMISSIVE_BLOCK_NONE || !limb) + return imageset + + var/list/all_images = list() + var/list/glows = list() + for(var/image/overlay as anything in imageset) + if(PLANE_TO_TRUE(overlay.plane) == EMISSIVE_PLANE) + glows += overlay + continue + all_images += overlay + all_images += emissive_blocker(overlay.icon, overlay.icon_state, limb, layer = overlay.layer, alpha = overlay.alpha) + return all_images + glows + +/// The animation look is part of the limb's render key, so changing it redraws the limb. +/datum/bodypart_overlay/augment/cyberware/generate_icon_cache() + . = ..() + if(implant) + . += implant.cyberware_worn_key() + /obj/item/organ/cyberimp/cyberware name = "cyberware" desc = "Aftermarket chrome. Someone sat in a parlor chair for this." icon = 'voidcrew/modules/cyberware/icons/cyberware.dmi' // Worn look: ware that reads from outside the body sets aug_overlay to a // state in this sheet and tg's bodypart-overlay pipeline draws it ON the - // bearer, over the character-setup underwear, under equipped clothing. + // bearer, over the jumpsuit, under suits and armour. // Stack enough chrome and you stop looking human. aug_icon = 'voidcrew/modules/cyberware/icons/cyberware_worn.dmi' organ_flags = ORGAN_ROBOTIC - failing_desc = "is dark and inert, browned out, EMP-scrambled, or plain broken." + failing_desc = "is dark and inert." /// Neural load this ware puts on its bearer. 0-12; see the tier bands. var/chrome_load = 1 /// CYBERWARE_TIER_*, drives accent colours and the parlor experience. var/tier = CYBERWARE_TIER_1 /// Chrome capacity this ware grants while installed (the Governor hook). var/chrome_capacity_bonus = 0 + /// TRUE for ware that is part of the skin: its worn look draws under clothes, not over the jumpsuit. + var/worn_under_clothes = FALSE /obj/item/organ/cyberimp/cyberware/Initialize(mapload) . = ..() @@ -126,6 +176,8 @@ name = "cyberware optics" desc = "Aftermarket eyes. The irises catch the light in a way real ones don't." icon = 'voidcrew/modules/cyberware/icons/cyberware.dmi' + // The base is never sold; it borrows the plainest optics' sprite so it has one. + icon_state = "nightshade" actions_types = list(/datum/action/cooldown/cyberware/chrome_read) /// Neural load this ware puts on its bearer. var/chrome_load = 1 @@ -198,6 +250,8 @@ name = "arm cyberware" desc = "Aftermarket arm hardware. Folds away until you want it." icon = 'voidcrew/modules/cyberware/icons/cyberware.dmi' + // The base is never sold; it borrows a plain arm housing's sprite so it has one. + icon_state = "fixers" // Worn look (see the cyberware base above): the arm pipeline derives // "[aug_overlay]_left/_right" from the installed zone on its own. No // separate hand states in our sheet, so the hand overlay stays off. @@ -209,6 +263,9 @@ var/tier = CYBERWARE_TIER_1 /// Chrome capacity this ware grants while installed. var/chrome_capacity_bonus = 0 + /// TRUE when the worn sprite draws the deployable folded into its housing + /// (the Mantis line). The worn overlay hides while that item is out in a hand. + var/hide_worn_while_deployed = FALSE /obj/item/organ/cyberimp/arm/toolkit/cyberware/Initialize(mapload) . = ..() @@ -241,6 +298,12 @@ if(!special) cyberware_boot_splash(arm_owner, src) +// tg's arm implants register these two on the bearer and never let go on removal, so a +// housing sold on or reinstalled elsewhere kept answering to the body it was pulled from. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/on_mob_remove(mob/living/carbon/arm_owner, special = FALSE, movement_flags) + . = ..() + UnregisterSignal(arm_owner, list(COMSIG_CARBON_POST_ATTACH_LIMB, COMSIG_KB_MOB_DROPITEM_DOWN)) + // Deploying and stowing arm hardware is the most visible thing a piece of // chrome does, so it is also the ink's most common cue: every toolkit arm // (Fixer's Fingers picking a tool off the radial, the Rockjaw drill, blades, @@ -254,12 +317,39 @@ // (augments_arms.dm), so "did it deploy" is "did it leave us", not "is it set". if(active_item && !(active_item in src)) cyberware_ink_pulse(owner, CYBERWARE_INK_HARD) + if(hide_worn_while_deployed) + // Any way out of the hand that isn't Retract() (a forced drop, a + // deleted blade) must put the folded sprite back as well. + RegisterSignal(active_item, COMSIG_ITEM_DROPPED, PROC_REF(on_deployed_item_dropped), override = TRUE) + play_blade_unfold(active_item) + owner.update_body_parts() /obj/item/organ/cyberimp/arm/toolkit/cyberware/Retract() var/mob/living/carbon/stowing_owner = owner + var/obj/item/stowing = active_item + // Only a blade coming out of the hand folds back in; one picked off the floor just stows. + var/was_held = stowing && stowing_owner?.is_holding(stowing) . = ..() if(.) cyberware_ink_pulse(stowing_owner, CYBERWARE_INK_SOFT) + if(hide_worn_while_deployed) + UnregisterSignal(stowing, COMSIG_ITEM_DROPPED) + if(was_held && owner) + play_blade_fold() + stowing_owner?.update_body_parts() + +/// TRUE while the worn overlay should not draw: this hardware's worn sprite +/// shows its item folded away, and that item is out in the bearer's hand. +/// Stowed, dropped, deleted or with no bearer, the overlay draws. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/worn_overlay_hidden() + return hide_worn_while_deployed && owner && active_item && owner.is_holding(active_item) + +/// Signal proc for [COMSIG_ITEM_DROPPED] on a deployed item whose folded sprite +/// is part of the worn overlay. Redraws the arm so the housing shows again. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/on_deployed_item_dropped(obj/item/source, mob/user) + SIGNAL_HANDLER + UnregisterSignal(source, COMSIG_ITEM_DROPPED) + owner?.update_body_parts() /obj/item/organ/cyberimp/arm/toolkit/cyberware/emp_act(severity) . = ..() // toolkit's own EMP retract fires first @@ -296,12 +386,23 @@ /proc/cyberware_insert_check(obj/item/organ/ware, mob/living/carbon/target, silent = FALSE, mob/feedback_to) if(!iscarbon(target)) return FALSE + if(!cyberware_has_limb(ware, target, silent)) + return FALSE if(installed_capacity_check(target, list(ware), ware.cyberware_get_incumbents(target), silent)) return TRUE if(!silent && feedback_to && feedback_to != target) feedback_to.balloon_alert(feedback_to, "no neural headroom!") return FALSE +/// Whether the body still has the limb this ware lives in. Chrome cannot go into a limb that +/// is gone: the insert would seat it on a body with nothing to hold it. +/proc/cyberware_has_limb(obj/item/organ/ware, mob/living/carbon/target, silent = FALSE) + if(target.get_bodypart(deprecise_zone(ware.zone))) + return TRUE + if(!silent) + target.balloon_alert(target, "no limb for it!") + return FALSE + /** * Full gate for a live (non-special) Insert(): a legit install context must * be open for this receiver, and the netted capacity must fit. The context @@ -321,6 +422,9 @@ receiver.balloon_alert(receiver, "needs a real rig!") to_chat(receiver, span_warning("The autosurgeon chokes. This needs a real rig.")) return FALSE + // Even a forced window cannot seat chrome in a limb that is not there. + if(!cyberware_has_limb(ware, receiver)) + return FALSE if(!chrome.install_context_forced && !cyberware_insert_check(ware, receiver)) return FALSE chrome.clear_install_context() @@ -450,6 +554,65 @@ return FALSE return TRUE +/** + * A click made with a chrome ability armed belongs to the chrome, refused or + * not. tg's version returns FALSE on a refusal, and ClickOn() then carries on + * as an ordinary click: a held gun fires at whoever was out of reach, an empty + * hand punches whoever the ability would not take. So an armed ability takes + * the one click it is handed, and only that one. + * + * Chrome abilities have no button of their own to click off (chrome_hud.dm), + * so the aim must never outlive the click. A refusal (wrong target, out of + * reach, no line of sight) disarms: the ability's own balloon says why, and + * the next click is an ordinary one. A right-click disarms without trying. A + * button that has gone dark since it was armed (EMP, cooldown started + * elsewhere, stun) disarms too. None of these touch the cooldown. + * + * Only for a real click on an armed ability. Trigger() with a target (AI and + * scripted callers) pass through unchanged. + */ +/datum/action/cooldown/cyberware/InterceptClickOn(mob/living/clicker, params, atom/target) + var/armed = !isnull(clicker) && clicker.click_intercept == src + if(!armed) + return ..() + // The click is the player acting, so the idle drop no longer applies (a channel can outlast it). + stop_timer() + if(params && LAZYACCESS(params2list(params), RIGHT_CLICK)) + unset_click_ability(clicker, refund_cooldown = TRUE) + return TRUE + if(!IsAvailable(feedback = TRUE)) + unset_click_ability(clicker, refund_cooldown = TRUE) + return TRUE + if(..()) + return TRUE + // Refused. Only drop our own aim: a channel that slept may have let another ability arm meanwhile. + if(clicker.click_intercept == src) + unset_click_ability(clicker, refund_cooldown = TRUE) + return TRUE + +/// The timer that drops an aim left waiting. (Names reused on purpose: the CI build sits at DM's identifier limit.) +/datum/action/cooldown/cyberware/var/timeout_timer + +/datum/action/cooldown/cyberware/set_click_ability(mob/on_who) + . = ..() + stop_timer() + timeout_timer = addtimer(CALLBACK(src, PROC_REF(on_timeout)), 10 SECONDS, TIMER_STOPPABLE|TIMER_DELETE_ME) + +/datum/action/cooldown/cyberware/unset_click_ability(mob/on_who, refund_cooldown = TRUE) + stop_timer() + return ..() + +/datum/action/cooldown/cyberware/proc/stop_timer() + if(timeout_timer) + deltimer(timeout_timer) + timeout_timer = null + +/// Armed and never clicked: the aim drops, cooldown untouched. +/datum/action/cooldown/cyberware/proc/on_timeout() + timeout_timer = null + if(owner?.click_intercept == src) + unset_click_ability(owner, refund_cooldown = TRUE) + /** * Is there a clear arc from [here] to [destination]? Shared by every leg * ware that throws its owner through the air: Hopper Pistons, Meteor diff --git a/voidcrew/modules/cyberware/cyberware_component.dm b/voidcrew/modules/cyberware/cyberware_component.dm index ef1b1480118..e7f79a889ef 100644 --- a/voidcrew/modules/cyberware/cyberware_component.dm +++ b/voidcrew/modules/cyberware/cyberware_component.dm @@ -66,6 +66,8 @@ if(emp_timer) deltimer(emp_timer) emp_timer = null + var/obj/item/organ/ware = parent + ware?.cyberware_anim_clear() install_context_ref = null install_context_forced = FALSE return ..() @@ -101,6 +103,8 @@ settle_passives(old_owner) set_browned_out(FALSE) cyberware_reevaluate_brownout(old_owner) + var/obj/item/organ/ware = parent + ware.cyberware_anim_clear(old_owner) /// Signal proc for [COMSIG_CARBON_GAIN_ORGAN] and [COMSIG_CARBON_LOSE_ORGAN] /// on the bearer. Every installed ware listens with its own component, so a @@ -131,6 +135,8 @@ if(emp_timer) deltimer(emp_timer) emp_timer = addtimer(CALLBACK(src, PROC_REF(finish_emp_reboot)), CYBERWARE_EMP_DOWNTIME / max(severity, 1), TIMER_STOPPABLE) + // Static, arcs, then dark (cyberware_anim.dm). Only the picture staggers. + cyberware_emp_hit_fx(parent) /datum/component/cyberware/proc/finish_emp_reboot() emp_timer = null @@ -141,6 +147,9 @@ var/obj/item/organ/ware = parent if(ware.owner && !(ware.organ_flags & ORGAN_FAILING)) ware.owner.balloon_alert(ware.owner, "[ware.name] back online") + cyberware_emp_reboot_fx(ware) + else + ware.owner?.update_body_parts() /// Cradle tune-up: cancels any pending EMP reboot and repairs the organ /// outright. Cannot fix a brownout, that is a load problem, not damage. @@ -149,9 +158,11 @@ deltimer(emp_timer) emp_timer = null emp_down = FALSE + emp_look = null var/obj/item/organ/ware = parent ware.set_organ_damage(0) update_failing() + ware.owner?.update_body_parts() /// Settles ORGAN_FAILING from our two failure sources. Careful not to clear /// a failure earned through organ damage: only lift the flag while the organ @@ -415,6 +426,9 @@ GLOBAL_LIST_INIT(installed_capacity_costs, list( newly_tripped = TRUE else any_recovered = TRUE + if(newly_tripped || any_recovered) + // Worn chrome stutters down or back up (cyberware_anim2.dm). + cyberware_brownout_fx(target, newly_tripped) if(newly_tripped) target.balloon_alert(target, "chrome brownout!") to_chat(target, span_boldwarning("Your chrome goes dark.")) diff --git a/voidcrew/modules/cyberware/cyberware_stealth.dm b/voidcrew/modules/cyberware/cyberware_stealth.dm index a56766082b9..9e1aee21738 100644 --- a/voidcrew/modules/cyberware/cyberware_stealth.dm +++ b/voidcrew/modules/cyberware/cyberware_stealth.dm @@ -4,14 +4,39 @@ * The Ghostskin Weave (ware_military.dm) fades its bearer to an alpha shimmer, * which fools humans but means nothing to NPC AI, basic mobs target by * reference, not by pixels. This file is the AI half of the camo: a trait the - * weave holds while active, and a chained override of the basic-mob targeting - * strategy that refuses camo'd targets beyond point-blank range. + * weave holds while active, one shared question (cyberware_camo_hides()), and + * the hooks that ask it for everything that hunts the bearer by sight. * - * The override lives HERE, in a cyberware-owned file, rather than in the + * Everything that grants TRAIT_CYBER_CAMO is hidden from: + * - basic mobs and human NPCs (the targeting strategy below, which every + * strategy subtype inherits through its own `..()` calls: the human NPC + * strategy, pirate crews and boarders, bounty criminals and their crews, + * ruin troopers and hermits, patrols, the club's people), + * - simple_animal hostiles (hermits, ice demons, polar bears, ...), + * - every porta_turret subtype: ruin and Syndicate turrets, hull defense + * turrets, player-built turrets, trader and player outpost turrets, including + * a player an outpost has marked, + * and, through one-line calls in the files that own them, the scripted target + * picks that never go through a /basic strategy: the club's people + * (mafia_target_ok()), the lich's thralls and the outpost experiment forms + * (their form's can_target()). + * + * What camo does NOT hide from: anything within CYBERWARE_CAMO_SPOT_RANGE + * tiles, the mobs in GLOB.cyberware_camo_piercing_types (megafauna, elites + * and the bosses that are still basic mobs), and every human NPC of boss rank + * (npc_rank HUMAN_NPC_RANK_BOSS: faction pirate bosses, the NT patrol's + * director, bounty bosses, the kingpin, the club's don). Ship weapons that + * target ships, not people, are not covered here. The street Flickerskin + * never grants the trait at all. + * + * The overrides live HERE, in a cyberware-owned file, rather than in the * shared AI files: defining the same proc a second time is this fork's blessed * way to patch upstream behavior (the later .dme include wraps the earlier - * definition, and `..()` calls straight into it). Nothing outside this module - * changes on disk. + * definition, and `..()` calls straight into it). That only works for a proc + * whose first definition is included BEFORE this file, so the hooks for the + * voidcrew files that include after it (the lich, the club, the experiment + * forms) are a single call to cyberware_camo_hides() in the proc that picks + * the target. * * TRAIT_CYBER_CAMO itself lives in voidcrew/_DEFINES/cyberware.dm, because * the chrome read (cyberware_scan.dm) is included ahead of this file and also @@ -23,6 +48,49 @@ /// fauna pack point-blank is still a bad idea. The PvP/PvE counterplay floor. #define CYBERWARE_CAMO_SPOT_RANGE 2 +/// Mobs that see straight through optical camo, whatever it is: megafauna, +/// mining elites and the bosses and mini bosses of the ruins, lairs, outposts +/// and vestiges that are still basic mobs. A typecache, so subtypes count. +/// Bosses that are people (human NPCs) see through it by rank instead, in +/// cyberware_camo_hides(). +GLOBAL_LIST_INIT(cyberware_camo_piercing_types, typecacheof(list( + /mob/living/simple_animal/hostile/megafauna, + /mob/living/basic/trooper/pirate/faction/boss, + /mob/living/simple_animal/hostile/asteroid/elite, + /mob/living/basic/boss, + /mob/living/basic/lich, + /mob/living/basic/hoarfrost_matriarch, + /mob/living/basic/bounty_lair_boss, + /mob/living/basic/outpost_experiment/horror, + /mob/living/basic/alien/queen/large/derelict, + /mob/living/basic/vestige_oracle, + /mob/living/basic/vestige_mutant, + /mob/living/basic/vestige_warframe, +))) + +/** + * Whether optical camo hides `target` from `viewer` right now: the target holds + * TRAIT_CYBER_CAMO, the viewer is further off than CYBERWARE_CAMO_SPOT_RANGE and + * the viewer is not one of the mobs that sees through it (a piercing type, or a + * human NPC of boss rank). `viewer` is whatever + * is doing the looking (a mob, a turret, a creature picking its next victim). + * Anything that is not a living mob is never hidden. + */ +/proc/cyberware_camo_hides(mob/living/target, atom/viewer) + if(!isliving(target) || !HAS_TRAIT(target, TRAIT_CYBER_CAMO)) + return FALSE + if(!viewer) + return TRUE + if(get_dist(viewer, target) <= CYBERWARE_CAMO_SPOT_RANGE) + return FALSE + if(is_type_in_typecache(viewer, GLOB.cyberware_camo_piercing_types)) + return FALSE + if(ishumannpc(viewer)) + var/mob/living/carbon/human/npc/person = viewer + if(person.npc_rank >= HUMAN_NPC_RANK_BOSS) + return FALSE + return TRUE + /** * Chained override of the stock basic targeting strategy (base definition: * code/datums/ai/basic_mobs/targeting_strategies/basic_targeting_strategy.dm). @@ -35,10 +103,49 @@ . = ..() if(!.) return - if(!isliving(the_target)) - return . - if(!HAS_TRAIT(the_target, TRAIT_CYBER_CAMO)) - return . - if(get_dist(living_mob, the_target) <= CYBERWARE_CAMO_SPOT_RANGE) - return . - return FALSE + if(cyberware_camo_hides(the_target, living_mob)) + return FALSE + return . + +/** + * The same for simple_animal hostiles, whose single gate is CanAttack() (base + * definition: code/modules/mob/living/simple_animal/hostile/hostile.dm). They + * ask it when they pick a target and again every tick they chase one, so a + * camo field that goes up mid-chase makes them lose the target. + */ +/mob/living/simple_animal/hostile/CanAttack(atom/the_target) + . = ..() + if(!.) + return + if(cyberware_camo_hides(the_target, src)) + return FALSE + return . + +/** + * Every porta_turret, however it finds its targets (the stock scan, the hull + * defense turret's, the outpost's), hands the list it wants to shoot at to + * tryToShootAt(). Anyone camo'd and out of spot range is dropped from it. A + * turret left with nothing behaves as one that found nothing (the cover goes + * back down) instead of standing up for a target it cannot see. + */ +/obj/machinery/porta_turret/tryToShootAt(list/atom/movable/targets) + var/hid_someone = FALSE + for(var/mob/living/candidate in targets.Copy()) + if(cyberware_camo_hides(candidate, src)) + targets -= candidate + hid_someone = TRUE + if(hid_someone && !length(targets)) + if(!always_up) + popDown() + return FALSE + return ..() + +/** + * Drops the bearer's camo field, if it is up. For the abilities that hurt someone without going + * through an attack the field listens for: a lunge, a landing. Same collapse as any other + * contact. + */ +/proc/cyberware_camo_drop(mob/living/carbon/bearer, reason = "field contact") + var/obj/item/organ/cyberimp/cyberware/ghostskin/weave = bearer?.get_organ_slot(ORGAN_SLOT_CYBERWARE_SKIN) + if(istype(weave)) + weave.break_camo(bearer, reason = reason) diff --git a/voidcrew/modules/cyberware/icons/chrome_cradle_rig.dmi b/voidcrew/modules/cyberware/icons/chrome_cradle_rig.dmi new file mode 100644 index 0000000000000000000000000000000000000000..8fb824341d4ae87824c333f8c1ee6e6f39d618f7 GIT binary patch literal 8223 zcmcIp3p`Z&zF#!E(&^>VR#b$LiX?~qdN_ug|q_uTn>X4aaS^?&`=|Mz|TR-Cn^*_KT* zn*adVVt&Th1^`5j;5V>wJ^YK$uLDl-ff{k~Qi!o+7Z3R@xou*ZMehh^;=bIfaFJ85;tbw`-|iYaj#+O&a`ON{?l0!Xr!I!)%ui@q z9dsB4J_eq)z%`PA{UPd#HshIxy(?@kiFfFfSZALRAf6s`_OJONUR6P6)0vD}=V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`B%g-rTqmk_l7F}sLB2;xoSJx5|wfGOu1fJZhZcz}|>sqU8Bn?DY zO8ntguAT;>6WXwH`G^|Lr!EVXUYB1dlKixQ|+{5CHXJHlHH3PY|k~<4pa;AtRugQ{*iZ~s) zxo9j_?;-iZ#NNycq@vwy!5>yi%0+sN&t|h%Cz`{~bs&9zwiR3-L|!e6c&|IhR`blj z7aiGTEggnArWC8#7KB4d;<>ri_u%@|d1Vl$Fb2;lMD{K(7j*oLbE$((DbY|FF21!;b%tT_6gfocKOs%W#>!Ds9^7>KH6hmRO66Z?&R-PU23BB-`F3pycle01% zut|>;9D4-Z;Ki3%oK;w9y6|W?3Ajix|K#1!ltj4)^s0G`a6+#mp6dH(vCfc)iU20h zd?L7JRzI2=i8}kG<3j7@s0c*u*El$@k@Ru@AjkRw^{}fJO2C0{8%yV0Er6i2gxSxz zKyMm4?S7ywQWvHEY}Fx!ztJc!i~u-#D~R;?A+Ame zvce5xZH-Qe0!Ht?>_3!n@7m`Fz?*ESx_`$y!d~BR6l-bmtdNBg$E=m2h;Afsbw*oJ zr!f&kETRB6p-ijzl$x%8S)cGO2evewTfXN)%;tpzOXTDdS^-R&e&nJBd?j{nzW{zX12Q=(erc?{XK=3^TtB?8J^1zVFLt8i8 z2>1Ef-%PYvBCxCWE48>oErqNaBkEZ4Cdv>+Rp9@#yUG45XQW8DZwQ>6~Rf#NE9WlsZp`p2~g_e7&1yShk z$4^AEJrEm*^3@NNmO8IDic~Us`>PUTflu=H_mBS+u-d&?cBq*|$`t_jM{ooH$W{;$ y1*#SQ{)294R9PsykCZ99PxRjvb^z!&0d3nc`+-E+dXTc#tGS7#am8u3TmJzfwK~=S literal 0 HcmV?d00001 diff --git a/voidcrew/modules/cyberware/icons/cyberware.dmi b/voidcrew/modules/cyberware/icons/cyberware.dmi index 81028cb0dab1d475ebb5c21158b05ce3b37cbbb7..4b1b0b628165b3056a0ee3e1e14f8763409e4fb4 100644 GIT binary patch literal 63256 zcmbSyQ*>lq)NO^`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B81y z&Zzqm6>vM#`F11~-1GSdrWC<=MmLj_kj&EWE?8=zespZX`VGVWpkh%q!^83tG%HdP zsra@4Jp9HIpfd6~ z0y?wCARkcVeIG&*egi~q*n;m6LsL3D| zSxZFa_tR%!M8?tD^i~G2^}R3Rv4YjZj>!jNlGIJ!LqbkS>XgezP!oWWMot^~UMz=; zn5bUsL_&j|c1Z!LZZmtyI=kr+v943FsbV&Bf`@htBbvM|BDaL2+cpZ;%D3?HYjEW2 z&n=VcR>R55$+zv<)xxD10VN2I1YgEVz=<|PP4CrbVB`ndGBX_|o;>)nUjHKQ^}K(W z3feL+iEJ0LB<(_tSl5lCiBmjGZd3WMBF)zK`;FV{O-k(c$Cg&yq8y^4Ar&ever{5QuD2dO=Fm(~D9U z(tf&zw!NKrm|QFnMoPkG9TB6BO;bbzh9aP(aMq~^3ce5|g}leZ-Q)*Ov>9qk<(ySL zdr?pmn1Xj1a)Sb!2Os?3d7@r~@G&OZ31of_S3XO#^K^BGv2;xgx=8yjmZ9b+EC@68 zsAW=JPCjc$9c1Y^ohNP!rgqLwo!IZinr!1CAAw9t>LBar@DVOdBm_=8!Z6>>f_(m* pXw+juJXcIhNPgg@NItsp{|A%qNT65Dyj=hQ002ovPDHLkV1mw$++_d& diff --git a/voidcrew/modules/cyberware/icons/cyberware_anim.dmi b/voidcrew/modules/cyberware/icons/cyberware_anim.dmi new file mode 100644 index 0000000000000000000000000000000000000000..f0b9f5ebf02d13704f0d52cec05d660d206e04c3 GIT binary patch literal 12313 zcmch7cU)6v|Mm%p*rHI21yKP9VjX~>lud9VpkTp>5HPl&h$wrn#8v8p5(ywvf&&LD z%9I&=sIruRjIaVKfv_WB2!SN$y-$ML_UZ5a`MiI;N%(v?$$fH8?(e$3*Y&-2)Y^Q- zw`;zIAZUffq5ZZHBw+^rs+TPV?}Tl8JqbamccI5l`0qdM=i=+`?eFg82|>YWxk=Bh z|82JF0DZ!K_Y>WN89NxOfB$6z)$CrD2;BcaWex)Y}5wCSGm-649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IFj^sLiW$0O?{V%TGv$FS(z4e>U;w zY~r2CKx3A&?g$ZSl0B(D57&%^JNMob_5bUutNklik1V`*`;oism3zr9(dY%3R0Ta- vyE{i(5J?5RKO%QPom0^N;HlMx0$6bk)?`($7nsk0Ad3Um`}6jmy7YelNn${y literal 0 HcmV?d00001 diff --git a/voidcrew/modules/cyberware/icons/cyberware_anim2.dmi b/voidcrew/modules/cyberware/icons/cyberware_anim2.dmi new file mode 100644 index 0000000000000000000000000000000000000000..2e8607e159e7e2cce59e01ea7655ae6a073f62fb GIT binary patch literal 36105 zcmdRX2|QGN+rPS7w9-lmX`=i@Dy>+$aVZN6 z%L?VAhfcAuEOLkcF0d|wEqc7S_p-3ezvy)Otj(cI)<)M&ENx6I%vo3*LerjnFpt{H z?pZm!_EqkYGs>rkwWYCjv0j6_Hw&M5f9}@3L9u4nDTQO}6$dyAHhV0nE|bL2MT#tW zsSXq}ZB;JKi4Aq|=;yee?aiqDo*(X9j=f@T*Rof@z5Di5-aQ|ID?)@*TQu$;%-@{7 z?3UlsrfAO(2k)+K?tfQO=6(-TPP8-H@0YrO-SN~CmfL%hy&|s)?tCEr;*+8HE}wJr zHbm7WLhQ(DQchm<=)>mbqmZQM{Oul%* z-@pK;?=uofeHXi`DK-7BkwA4tYJtoN-H(S(ovZQO-h+SYH}XMpL8M#%y7Sssiq7f` z;`3~Bssc7edVN#d{=0pTUGe@U}w)z*HDLLL~?6SKo>qEywl)BP&Ym= zTr8=6T<^U6L)YNvU3&;c3%eTv4nFo$3fhnHT%LSc(>lZB9{SLxOZV3w>U_L~vRgmR zWwY&;W%oxkA~uDXcKO9#wvTaVwT@3uaCUKM_N&-?A++Jhi;H3ld)IDO4uANIv#_-l2=QK*sU>vj^Er?1%+wIbHFXO=QN)8EsFZdd#1p58+bHqb z>nWi%mCh)(B>?#U(a&^>>qIfybYM)zn$jmsr8VMhyC()4Tr80-Tn%mxupC0W&^t(| zF)}ZGsPAoMf7u|0{-rX|RnOR*fF4zYm11f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2Y&O-z!Z{aD1+M$?Wa?tD9bH}_+~}snO7^<6>F?8{O59VKAGYR zEiSkerH>#-L4yS7g)AUFV(9(z0Zfj7{0j$S6$OEV*A39l`;LLXJ_BU4d9E~ z7>p34uEH0AzjOtD1`(1=)L}sI%}ZdJWHaD!K@X$@oDSv_wk37tIm|#igRLCWwgbf^D&cf<8p6;z8wYVRTBi6gTGQGBe%{g-jz-uZPp2C4?8z; zS+Ok3%w-p_?JXCMxcqkWEn3M>W;p8|p|7m;K&{y(-AT7yko{2X6!b literal 0 HcmV?d00001 diff --git a/voidcrew/modules/cyberware/icons/cyberware_anim2_large.dmi b/voidcrew/modules/cyberware/icons/cyberware_anim2_large.dmi new file mode 100644 index 0000000000000000000000000000000000000000..8004507e5b08c65e226aec354f5a98b412046d58 GIT binary patch literal 11560 zcmcI~cT^M6w{8Fx3kXpVqzDEDlqN`(5|9oepdx}4r3gruUP3?=BE9#H6r~ABFHz|r zO?vMj1QKdOAmvTG@1OVIz3aZ;td%vh&)IWkpMCcJ_ID=pN$;^b{YAEmAP|UNQ$ytm z2t=(&`JF!p0)ed4rX+#Wci(3(+*PdIEZ^C=xZ629fk56Fjzdb9esQy&TdXEsoGMr5 zs2?uSc4)u6BSNRI-DX|Pe1sZ#z{C$}=2~v+Gt8f>&weA$!RwtoVDG2&QbjaqF;`X3 z_3xcCT3hiK7k<)Svx-Q3Ewb(u@H*=BB6V)2F8rqSgWBGNneOv;llRwnWf@uRD>jAH z2gg5%O*8+FTW#<#De$xoC2_oO3RzT`*O?0I&O0>Et)*M@cq=~8X4B%#V)*LAgJE7r z5J*r&Q$^{S_w>%3pZoK*RQ_F?&@!PZ5h96gU`J%q-)d-pC>lJ@Y0Eu3hP&|K2 z@l`go6*D4!R^VM9ZfC){OpyCS46zwAkEvd;KLhyie|D(Ym!|VwT&D7#cXdd(@Uyan zVD~gFtn;Pot{zB>IF&6~V5jqxXyU5zbdV6i5-={Hc=KGG(hoOtY9`;ns(eY_*_0#J zQSq@sM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a5Kr z5Mnc}-A~7mf8mw?`z4QDWflkr;=16q(N1uHG?`!sZmC1Cx1MBIV?19 z?kk2H=K&61$s4P;(;18qb84~Dyho1QmDQG|O&8mClha3K>M%Y0b1`f+m~Hukr5Q?< zheZ~#nK%V)oikBdBbA$7Q3G52(xs#VG9BJ4(jHL(!>US_kDzr@Z z?MzQA;m^TgNVd3NOv*%aPvdrsOZ?=KKUueK-wTzYiW9uEUq716&R}?NaFtOYB_g^( zWpDk)jh@rEWc6j;*K33BwBwnIy8G^#W)?jt-T~$^B9FoS+HK5MyMC}%5sMPrrgOmz zRpT&FR-U}jzni{M+&5ZZSZiBZ^>(#TSM|wD-?ht@7q=E$NuJ*>L^Vj``n}Q)uUvV0 zFPU2`wM9GTd-a_Ecrx2@@ikUrz}*^PGfvcSw?>I|N{N_ETvmj}`BRbEg%7!sVW?FF z6dp8rBHE|Ku2$lSKZso&esVVJt?Rl>k%7V<1ms8&m?v|Rq;{&|aE#-*A-bscU(Xqe zmi5zk)H~|>p^S|(B@nh=cMOu=ukasB_zMRXVla=_a*qN1D~q<^8}1UbGC%CACU>_U zn*c}1+({)pdC$J?aOig%DoYw5QN&o{XPY;E8~XhA`Lxh$sU~#ARN5QhqA@vJ@KQWN z$mbqdv0~aJa}V4ZZu{~VR`DN~G^9pMe|Yk@jiI_)8>%Mw+@ z_l!`C^oL}`DPvZ#1Lt#@tY-tMVW&^pb!Ep@dcEWUKw?nrAOOfY{S6KObnZg-UV-@e z74H6qf;z>I)HZ#)TkLv{#+jIrf0kt8glnoJ+f(y5oUI-eEyUIeVOe(4^Oyete7k;= literal 0 HcmV?d00001 diff --git a/voidcrew/modules/cyberware/icons/cyberware_ground.dmi b/voidcrew/modules/cyberware/icons/cyberware_ground.dmi new file mode 100644 index 0000000000000000000000000000000000000000..3762c0e948b869af71b1f926946b9b3fd6672766 GIT binary patch literal 1601 zcmbVKdpOez82(8+p+pqw5j)N@Em6m{+h$srEw`CVnk-#hin(nZmpP=2Q;Vg|T$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BWnc2%>uR*2(yB?AndwboRD@Foa^QP{w}qRtb5d><#Vv#4ln{PZ;x!YYa>=24o$>~1 zxqO1+#H1wsCuODjh&#?X7?V$X7xwe<-a7?$orXNd9thI5AiVA~ZT_}X{2%_Ziuh+aRAADqQ+g#$Kw`nRL?$R zH)9F!k8XAp!^$=2H2xtta)#2saXdSE$aXrjlT%9~G>n(#sH)}Vn?QlfhXmS?pwPE2 znT`$!jOXR@Dq0ig+JO3cw{e&|T`E#&XaJsK?^x?M7ypcm*&d7a>y_0H5279YwIDXP z6Rf!6c429Amv9W}^q)pQrt_=umlG8ug%tu#CMd@luB6fV?Yy)Q>e~y`kPBDQv{rG_J7y#|8Qr42l*${u!iw{1ocU_|2|)fwk% zgZQ=p59Svg$=W3k(5yKgnJe)HB2`rixu2y)CgaOruSH^h-nGZicUK$MJc)v*-iNti z-;dG&Cj!g^wuP1t$18n6iSQM%gyH~tEk7M6Mr>Y_!9@!S%dzKU(7H3bo>R?^+Zo@y zVO3VmuQ#Cy+jNauI#~OcL;=iOO+&LhFj439*}jSmH{xN~z864hLHXdp+23zOuNz$1 z?RoHdfArqdC=jDn*#C;Il$r+V)o?N^V39As@=J7ier1|RQ>N&S7}0Ighiw$9g-aQk z|A?SBB<6_P># diff --git a/voidcrew/modules/cyberware/icons/cyberware_weapons.dmi b/voidcrew/modules/cyberware/icons/cyberware_weapons.dmi index ce1bf56b5a1acb7dfd840ecb797a21f340e60372..b18b988f8b89a317f1e6c169012f841526531b06 100644 GIT binary patch literal 6188 zcmZ`-c{r4B_n)yZ*~V98Yh-VwvLwscm&g-t?o0oBDkn2s{@V>I_qce^-bmT86V^`8%}mVI9}>|YcT8*y28~}r4FlkLrm)S z9hCC>)t}-e<+@AggNxN?ZAV`?`p5#m4k4okJ8tj3zFc|@Yi0w%Iw?H!e25Dwv(Erk zHTh}bW4+8S7)(gxu73*cyO8Aq0314MWomRaD0?MGDCM8oSGYV^UZY#|ZNUKU-ziGp zRcCnlu9RuiMhyuDkR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perdoc_catalog.dm b/voidcrew/modules/cyberware/ripperdoc_catalog.dm index 4dfd8a8e01a..226d1199621 100644 --- a/voidcrew/modules/cyberware/ripperdoc_catalog.dm +++ b/voidcrew/modules/cyberware/ripperdoc_catalog.dm @@ -8,10 +8,10 @@ * * Balance shape mirrors Vex's counter: credits buy the street and pro-utility * ware, vouchers gate everything that changes how you fight. Splice's intake - * ledger buys back ONLY the ladder-base rungs, the street chrome a customer - * outgrows, at half list, credits only, so climbing a slot ladder feels like - * climbing and never becomes an arbitrage loop (you can't refund vouchers, and - * a removed piece resold at 50% is always a loss). + * ledger buys back every piece he sells for credits (owner D7), at half list, + * credits only, so climbing a slot ladder feels like climbing and never becomes + * an arbitrage loop (voucher chrome is never bought back, and a removed piece + * resold at 50% is always a loss). * * Splice is not the only source any more. The roster also rides the zone loot * tables (modules/loot/themes/) at the tier that matches what he charges for @@ -73,6 +73,30 @@ /datum/shop_sku/ripperdoc/rockjaw, /datum/shop_sku/ripperdoc/fixers, /datum/shop_sku/ripperdoc/dermal_mesh, + /datum/shop_sku/ripperdoc/ghostskin_street, + /datum/shop_sku/ripperdoc/mantis_street, + /datum/shop_sku/ripperdoc/governor_street, + /datum/shop_sku/ripperdoc/redline_street, + /datum/shop_sku/ripperdoc/cascade_street, + // The phase 2 street models, street passives and optics. + /datum/shop_sku/ripperdoc/cuffer_wrists, + /datum/shop_sku/ripperdoc/medic_palms, + /datum/shop_sku/ripperdoc/subvocal_mic, + /datum/shop_sku/ripperdoc/fixers_street, + /datum/shop_sku/ripperdoc/muffler_ear, + /datum/shop_sku/ripperdoc/clotter_node, + /datum/shop_sku/ripperdoc/coolant_street, + /datum/shop_sku/ripperdoc/frostline, + /datum/shop_sku/ripperdoc/atlas_street, + /datum/shop_sku/ripperdoc/doppler_street, + /datum/shop_sku/ripperdoc/second_wind_deep, + /datum/shop_sku/ripperdoc/slipwire_street, + /datum/shop_sku/ripperdoc/hopper_street, + /datum/shop_sku/ripperdoc/adrenal_pump, + /datum/shop_sku/ripperdoc/gorilla_street, + /datum/shop_sku/ripperdoc/rockjaw_deepcore, + /datum/shop_sku/ripperdoc/ronin_holdout, + /datum/shop_sku/ripperdoc/hardweave, // ---- Pro Chrome (mixed) ---- /datum/shop_sku/ripperdoc/angler, /datum/shop_sku/ripperdoc/hemoglass, @@ -90,11 +114,18 @@ /datum/shop_sku/ripperdoc/atlas, /datum/shop_sku/ripperdoc/gorilla, /datum/shop_sku/ripperdoc/monowire, + /datum/shop_sku/ripperdoc/monowire_live, /datum/shop_sku/ripperdoc/rigger, /datum/shop_sku/ripperdoc/slabskin, /datum/shop_sku/ripperdoc/mantis, + /datum/shop_sku/ripperdoc/mantis_scorch, /datum/shop_sku/ripperdoc/ghostskin, /datum/shop_sku/ripperdoc/lazarus, + /datum/shop_sku/ripperdoc/governor_milspec, + /datum/shop_sku/ripperdoc/redline_milspec, + /datum/shop_sku/ripperdoc/cascade_milspec, + /datum/shop_sku/ripperdoc/hopper_milspec, + /datum/shop_sku/ripperdoc/slipwire_milspec, // ---- Legend Chrome (the chase, always listed) ---- /datum/shop_sku/ripperdoc/governor_delete, /datum/shop_sku/ripperdoc/redline, @@ -104,12 +135,50 @@ /datum/shop_sku/ripperdoc/buster_rockets, ) buyback_types = list( - // The trade-in ladder: only the street rungs a customer outgrows. + // The trade-in ladder: every piece on the shelf priced in credits. /datum/shop_buyback/ripperdoc/nightshade, /datum/shop_buyback/ripperdoc/shock_coils, /datum/shop_buyback/ripperdoc/second_wind, /datum/shop_buyback/ripperdoc/dermal_mesh, /datum/shop_buyback/ripperdoc/scrapper, + // The cyberware lines' street models (ware_line_*.dm). + /datum/shop_buyback/ripperdoc/ghostskin_street, + /datum/shop_buyback/ripperdoc/mantis_street, + /datum/shop_buyback/ripperdoc/governor_street, + /datum/shop_buyback/ripperdoc/redline_street, + /datum/shop_buyback/ripperdoc/cascade_street, + // The phase 2 street models, street passives and optics. + /datum/shop_buyback/ripperdoc/cuffer_wrists, + /datum/shop_buyback/ripperdoc/medic_palms, + /datum/shop_buyback/ripperdoc/subvocal_mic, + /datum/shop_buyback/ripperdoc/fixers_street, + /datum/shop_buyback/ripperdoc/muffler_ear, + /datum/shop_buyback/ripperdoc/clotter_node, + /datum/shop_buyback/ripperdoc/coolant_street, + /datum/shop_buyback/ripperdoc/frostline, + /datum/shop_buyback/ripperdoc/atlas_street, + /datum/shop_buyback/ripperdoc/doppler_street, + /datum/shop_buyback/ripperdoc/second_wind_deep, + /datum/shop_buyback/ripperdoc/slipwire_street, + /datum/shop_buyback/ripperdoc/hopper_street, + /datum/shop_buyback/ripperdoc/adrenal_pump, + /datum/shop_buyback/ripperdoc/gorilla_street, + /datum/shop_buyback/ripperdoc/rockjaw_deepcore, + /datum/shop_buyback/ripperdoc/ronin_holdout, + /datum/shop_buyback/ripperdoc/hardweave, + // The rest of the credit shelf (owner D7). + /datum/shop_buyback/ripperdoc/hopper, + /datum/shop_buyback/ripperdoc/coolant, + /datum/shop_buyback/ripperdoc/fixers, + /datum/shop_buyback/ripperdoc/rockjaw, + /datum/shop_buyback/ripperdoc/gecko, + /datum/shop_buyback/ripperdoc/hemoglass, + /datum/shop_buyback/ripperdoc/angler, + /datum/shop_buyback/ripperdoc/registry_uplink, + /datum/shop_buyback/ripperdoc/cargo_cavity, + /datum/shop_buyback/ripperdoc/gastro, + /datum/shop_buyback/ripperdoc/chromatic_dermis, + /datum/shop_buyback/ripperdoc/burnt_chrome, ) trader_lines = list( TRADER_LINE_GREETING = list( @@ -444,7 +513,7 @@ /datum/shop_sku/ripperdoc/cascade zone_permission = ZONE_PERMISSION_ELITE category = "Legend Chrome" - desc = "A Sandevistan reflex lattice in a sealed surgical case." + desc = "A full-spine reflex lattice in a sealed surgical case." item_path = /obj/item/organ/cyberimp/cyberware/cascade price_vouchers = 8 stock_min = 1 @@ -476,11 +545,21 @@ // ========================================================================= // SPLICE'S INTAKE LEDGER: the trade-in ladder -// Half list, credits only, street rungs only. Removed chrome resold here is +// Half list, credits only, credit-priced chrome only. Removed chrome resold here is // always a loss (you can't refund vouchers, and 50% never beats buying up the // ladder), so this reads as "trade up" and never as an arbitrage loop. +// +// The ripperdoc trade-in is the one ledger that takes chrome bought over a +// counter (owner decision, 2026-11-07): every other buyer and every export +// refuses anything carrying the trader-goods mark (trade/resale.dm). It holds +// because each entry pays half the lowest list price of the piece and a special +// takes at most 30% off, so a bought piece always sells back at a loss. The +// voidcrew_ripperdoc_resale unit test pins both halves of that. // ========================================================================= +/datum/shop_buyback/ripperdoc + buys_shop_stock = TRUE + /datum/shop_buyback/ripperdoc/nightshade name = "Nightshade Optics (pulled)" desc = "Old low-light eyes. Splice takes them off your hands when you move up to a targeting rig." @@ -492,7 +571,7 @@ /datum/shop_buyback/ripperdoc/shock_coils name = "Shock Coils (pulled)" - desc = "Reflex legs, lightly used. Trade-in credit toward the jump pistons." + desc = "Reflex legs, lightly used." category = "Trade-In" item_path = /obj/item/organ/cyberimp/cyberware/shock_coils pay_credits = 250 @@ -501,9 +580,11 @@ /datum/shop_buyback/ripperdoc/second_wind name = "Second Wind Bladder (pulled)" - desc = "A used air reserve. Worth half toward something with a longer bladder." + desc = "A used air reserve." category = "Trade-In" item_path = /obj/item/organ/cyberimp/cyberware/second_wind + // The Deep-lung is a subtype with its own, higher entry (ware_models_b.dm). + match_subtypes = FALSE pay_credits = 450 demand_min = 2 demand_max = 3 @@ -513,6 +594,8 @@ desc = "Light plating you've outgrown. Splice recycles the weave toward the heavy slab." category = "Trade-In" item_path = /obj/item/organ/cyberimp/cyberware/dermal_mesh + // The Hardweave is a subtype with its own, higher entry (ware_models_b.dm). + match_subtypes = FALSE pay_credits = 1000 demand_min = 1 demand_max = 2 @@ -526,3 +609,134 @@ pay_credits = 200 demand_min = 2 demand_max = 4 + +// ========================================================================= +// THE REST OF THE CREDIT SHELF (owner D7): every piece he sells for credits +// comes back at half list, credits only. Exact types, so a ladder rung above +// or below (Spring calves, Vaulter, Tinker's, Deepcore, Heat-sink) keeps its +// own entry or none. Ratchet's subtypes carry his wording. +// ========================================================================= + +/datum/shop_buyback/ripperdoc/hopper + name = "Hopper piston calves (pulled)" + desc = "Piston calves, still sprung." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/hopper + match_subtypes = FALSE + pay_credits = 1800 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/ripperdoc/coolant + name = "Coolant Loop lattice (pulled)" + desc = "A drained coolant lattice." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/coolant + match_subtypes = FALSE + pay_credits = 1800 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/ripperdoc/fixers + name = "Fixer's Fingers (pulled)" + desc = "A fingertip tool suite, pulled." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/arm/toolkit/cyberware/fixers + match_subtypes = FALSE + pay_credits = 900 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/ripperdoc/rockjaw + name = "Rockjaw drill fist (pulled)" + desc = "A drill fist with plenty of bit left." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/arm/toolkit/cyberware/rockjaw + match_subtypes = FALSE + pay_credits = 600 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/ripperdoc/gecko + name = "Gecko Grip palm pads (pulled)" + desc = "Palm pads, a bit worn." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/gecko + match_subtypes = FALSE + pay_credits = 450 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/ripperdoc/hemoglass + name = "Hemoglass filter (pulled)" + desc = "A blood filter, flushed." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/hemoglass + match_subtypes = FALSE + pay_credits = 600 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/ripperdoc/angler + name = "Harpoon Spool (pulled)" + desc = "A wrist spool and its line." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/arm/toolkit/cyberware/angler + match_subtypes = FALSE + pay_credits = 600 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/ripperdoc/registry_uplink + name = "Registry uplink (pulled)" + desc = "A registry uplink, pulled." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/registry_uplink + match_subtypes = FALSE + pay_credits = 600 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/ripperdoc/cargo_cavity + name = "Cargo Cavity (pulled)" + desc = "An empty rib compartment." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/cargo_cavity + match_subtypes = FALSE + pay_credits = 500 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/ripperdoc/gastro + name = "Gastro Reactor (pulled)" + desc = "A used stomach liner." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/gastro + match_subtypes = FALSE + pay_credits = 200 + demand_min = 2 + demand_max = 3 + +/datum/shop_buyback/ripperdoc/chromatic_dermis + name = "Chromatic Dermis ink suite (pulled)" + desc = "A sheet of circuit ink, peeled." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/chromatic_dermis + match_subtypes = FALSE + pay_credits = 200 + demand_min = 2 + demand_max = 3 + +/** + * Dead chrome off a dead (or opened-up) human NPC (/obj/item/burnt_chrome, human_npc.dm). Scrap money only: + * 50 cr is a fifth of the cheapest piece Splice sells for credits, so burning out bought chrome in a captive + * to sell the husk is always a loss, and the round's demand caps it. + */ +/datum/shop_buyback/ripperdoc/burnt_chrome + name = "Burnt-out chrome" + desc = "Dead implants. Splice strips them for the parts that didn't melt." + category = "Scrap" + item_path = /obj/item/burnt_chrome + pay_credits = 50 + demand_min = 4 + demand_max = 8 diff --git a/voidcrew/modules/cyberware/street_doc_catalog.dm b/voidcrew/modules/cyberware/street_doc_catalog.dm new file mode 100644 index 00000000000..40d0ba79934 --- /dev/null +++ b/voidcrew/modules/cyberware/street_doc_catalog.dm @@ -0,0 +1,268 @@ +/** + * # The Back Bay: Ratchet, street ripperdoc + * + * Quartermain's chrome counter: a vendor stall in a storage bay off the depot's + * upper landing, with its own Chrome Cradle. Ratchet is a loader mechanic who + * started putting chrome in people, and the shelf shows it: street chrome only, + * nothing that needs a voucher. + * + * He lists the SAME /datum/shop_sku/ripperdoc types Splice does, not copies. + * Each shop builds its own SKU instances, so his stock is his own, but the + * price of a piece can never drift between the two counters. That matters + * because the cradle quotes one price per organ type + * (build_cyberware_price_index() in cradle_ui.dm), and because + * voidcrew_zone_shops/catalog pins the reputation gate of every SKU type that + * exists, so a parallel set of street-doc SKU types would need its own + * entries there for no gain. + * + * His intake ledger takes everything Splice's does at the same pay, even the + * credit chrome only Splice sells + * (subtypes of Splice's buybacks, with his own wording). Like Splice's, and + * unlike every other ledger, it takes chrome bought at a counter and pulled + * again (buys_shop_stock on /datum/shop_buyback/ripperdoc, ripperdoc_catalog.dm). + * + * Catalog and NPC only: the organs live in ware_*.dm, the cradle in + * chrome_cradle.dm, the room on the Quartermain map + * (trader_outpost_outfitter.dmm). The NPC is a subtype of Splice's so the + * cradle's install patter (play_ripperdoc_bark()) comes out of his mouth. + */ + +/** + * Ratchet's look: a black robotics jumpsuit under a leather wader bib, the + * kind you hose down. Insulated gloves because half the job is wiring, welding + * goggles pushed up because the other half is welding, a hand-rolled cigarette, + * and a hand drill he uses on loaders and patients alike. Kept clear of Splice + * (no scrubs, no leather jacket) and of Sawbones (no head mirror). + * Purely cosmetic, the NPC snapshot only copies appearance. + */ +/datum/outfit/street_doc_ratchet + name = "Street ripperdoc" + uniform = /obj/item/clothing/under/rank/rnd/roboticist + suit = /obj/item/clothing/suit/apron/waders + gloves = /obj/item/clothing/gloves/color/yellow + shoes = /obj/item/clothing/shoes/workboots + glasses = /obj/item/clothing/glasses/welding/up + mask = /obj/item/cigarette/rollie + r_hand = /obj/item/screwdriver/power + +/datum/outpost_shop/vendor/street_doc + outpost_name = "\improper The Back Bay" + outpost_desc = "The depot's ripperdoc, in a storage bay he rents by the week." + trader_name = "Ratchet" + trader_outfit = /datum/outfit/street_doc_ratchet + trader_gender = MALE + trader_voice_pack = "goon.speak_3" + trader_voice_pitch = 0.88 + // A SKU whose category is missing here never renders on the storefront + // (voidcrew_shop_catalog checks it). Add the line models' category if it + // is not "Street Chrome". + categories = list( + "Street Chrome", + ) + sku_types = list( + // ---- Street Chrome (credits), Splice's own SKU types ---- + /datum/shop_sku/ripperdoc/chromatic_dermis, + /datum/shop_sku/ripperdoc/gastro, + /datum/shop_sku/ripperdoc/shock_coils, + /datum/shop_sku/ripperdoc/nightshade, + /datum/shop_sku/ripperdoc/scrapper, + /datum/shop_sku/ripperdoc/gecko, + /datum/shop_sku/ripperdoc/second_wind, + /datum/shop_sku/ripperdoc/cargo_cavity, + /datum/shop_sku/ripperdoc/rockjaw, + /datum/shop_sku/ripperdoc/fixers, + /datum/shop_sku/ripperdoc/dermal_mesh, + // ---- Street models from the cyberware lines (credit-priced T2) ---- + // CYBERWARE LINES: T2 SKUS START + /datum/shop_sku/ripperdoc/ghostskin_street, + /datum/shop_sku/ripperdoc/mantis_street, + /datum/shop_sku/ripperdoc/governor_street, + /datum/shop_sku/ripperdoc/redline_street, + /datum/shop_sku/ripperdoc/cascade_street, + // Phase 2: the street models, street passives and optics. Nothing + // priced in vouchers belongs here. + /datum/shop_sku/ripperdoc/cuffer_wrists, + /datum/shop_sku/ripperdoc/medic_palms, + /datum/shop_sku/ripperdoc/subvocal_mic, + /datum/shop_sku/ripperdoc/fixers_street, + /datum/shop_sku/ripperdoc/muffler_ear, + /datum/shop_sku/ripperdoc/clotter_node, + /datum/shop_sku/ripperdoc/coolant_street, + /datum/shop_sku/ripperdoc/frostline, + /datum/shop_sku/ripperdoc/atlas_street, + /datum/shop_sku/ripperdoc/doppler_street, + /datum/shop_sku/ripperdoc/second_wind_deep, + /datum/shop_sku/ripperdoc/slipwire_street, + /datum/shop_sku/ripperdoc/hopper_street, + /datum/shop_sku/ripperdoc/adrenal_pump, + /datum/shop_sku/ripperdoc/gorilla_street, + /datum/shop_sku/ripperdoc/rockjaw_deepcore, + /datum/shop_sku/ripperdoc/ronin_holdout, + /datum/shop_sku/ripperdoc/hardweave, + // CYBERWARE LINES: T2 SKUS END + ) + buyback_types = list( + /datum/shop_buyback/ripperdoc/nightshade/street_doc, + /datum/shop_buyback/ripperdoc/shock_coils/street_doc, + /datum/shop_buyback/ripperdoc/second_wind/street_doc, + /datum/shop_buyback/ripperdoc/dermal_mesh/street_doc, + /datum/shop_buyback/ripperdoc/scrapper/street_doc, + // CYBERWARE LINES: T2 BUYBACKS START + /datum/shop_buyback/ripperdoc/ghostskin_street/street_doc, + /datum/shop_buyback/ripperdoc/mantis_street/street_doc, + /datum/shop_buyback/ripperdoc/governor_street/street_doc, + /datum/shop_buyback/ripperdoc/redline_street/street_doc, + /datum/shop_buyback/ripperdoc/cascade_street/street_doc, + /datum/shop_buyback/ripperdoc/cuffer_wrists/street_doc, + /datum/shop_buyback/ripperdoc/medic_palms/street_doc, + /datum/shop_buyback/ripperdoc/subvocal_mic/street_doc, + /datum/shop_buyback/ripperdoc/fixers_street/street_doc, + /datum/shop_buyback/ripperdoc/muffler_ear/street_doc, + /datum/shop_buyback/ripperdoc/clotter_node/street_doc, + /datum/shop_buyback/ripperdoc/coolant_street/street_doc, + /datum/shop_buyback/ripperdoc/frostline/street_doc, + /datum/shop_buyback/ripperdoc/atlas_street/street_doc, + /datum/shop_buyback/ripperdoc/doppler_street/street_doc, + /datum/shop_buyback/ripperdoc/second_wind_deep/street_doc, + /datum/shop_buyback/ripperdoc/slipwire_street/street_doc, + /datum/shop_buyback/ripperdoc/hopper_street/street_doc, + /datum/shop_buyback/ripperdoc/adrenal_pump/street_doc, + /datum/shop_buyback/ripperdoc/gorilla_street/street_doc, + /datum/shop_buyback/ripperdoc/rockjaw_deepcore/street_doc, + /datum/shop_buyback/ripperdoc/ronin_holdout/street_doc, + /datum/shop_buyback/ripperdoc/hardweave/street_doc, + // CYBERWARE LINES: T2 BUYBACKS END + // The rest of Splice's credit shelf, which Ratchet buys back even where he + // doesn't sell it (owner D7). + /datum/shop_buyback/ripperdoc/hopper/street_doc, + /datum/shop_buyback/ripperdoc/coolant/street_doc, + /datum/shop_buyback/ripperdoc/fixers/street_doc, + /datum/shop_buyback/ripperdoc/rockjaw/street_doc, + /datum/shop_buyback/ripperdoc/gecko/street_doc, + /datum/shop_buyback/ripperdoc/hemoglass/street_doc, + /datum/shop_buyback/ripperdoc/angler/street_doc, + /datum/shop_buyback/ripperdoc/registry_uplink/street_doc, + /datum/shop_buyback/ripperdoc/cargo_cavity/street_doc, + /datum/shop_buyback/ripperdoc/gastro/street_doc, + /datum/shop_buyback/ripperdoc/chromatic_dermis/street_doc, + ) + trader_lines = list( + TRADER_LINE_GREETING = list( + "Shut the door, you're letting the good air out.", + "Chair's free. The chrome isn't.", + "Don't mind the bucket.", + "You want it fancy, the Undertow's that way. You want it today, sit down.", + ), + TRADER_LINE_SALE = list( + "Done. Lie down whenever you're ready.", + "Good pick. I've put in a hundred of those. Most of them still work.", + "Wipe the slab before you lie on it.", + "Pleasure doing business.", + "There you go. Don't tell Sarge what you paid.", + ), + TRADER_LINE_REFUSAL = list( + "Your ship's on the list. Can't help you.", + "Not today. Sarge would have my bay.", + "No. Go square it with the depot first.", + ), + TRADER_LINE_WARNING = list( + "Easy. The turrets in here don't miss.", + "Do that again and the whole depot stops serving you.", + "I patch people up. I'd rather not start with you.", + ), + TRADER_LINE_AGGRESSION = list( + "Out of my bay!", + "Sarge! Got one for you!", + "Wrong guy to swing at.", + ), + TRADER_LINE_IDLE = list( + "That cradle came off a wreck. Don't ask whose.", + "Splice has the nicer chair. I've got the shorter flight.", + "I used to fix loaders. An arm's just a small loader.", + "The drain in the floor? Don't worry about the drain.", + "Most of my customers come back. Some of them on purpose.", + "The dockhands keep asking for discounts. I keep saying no.", + ), + TRADER_LINE_RESTOCK = list( + "Convoy's in. New chrome, some of it barely used.", + "Fresh crate. Still smells like the last owner.", + "Restocked. Get in before the dockhands do.", + ), + ) + +// ========================================================================= +// RATCHET'S INTAKE LEDGER +// Splice's ledger entries with Ratchet's wording. Same goods, same pay. +// ========================================================================= + +/datum/shop_buyback/ripperdoc/nightshade/street_doc + desc = "Used low-light eyes." + +/datum/shop_buyback/ripperdoc/shock_coils/street_doc + desc = "Used calf pistons." + +/datum/shop_buyback/ripperdoc/second_wind/street_doc + desc = "A used air bladder." + +/datum/shop_buyback/ripperdoc/dermal_mesh/street_doc + desc = "Used subdermal plating." + +/datum/shop_buyback/ripperdoc/scrapper/street_doc + desc = "One used knuckle plate, either hand." + +/datum/shop_buyback/ripperdoc/ghostskin_street/street_doc + desc = "A used camo weave. Patchy, like they all are." + +/datum/shop_buyback/ripperdoc/mantis_street/street_doc + desc = "One used blade housing, either arm." + +/datum/shop_buyback/ripperdoc/governor_street/street_doc + desc = "A used governor patch. The tape's still on it." + +/datum/shop_buyback/ripperdoc/redline_street/street_doc + desc = "A used rage core. Smells burnt." + +/datum/shop_buyback/ripperdoc/cascade_street/street_doc + desc = "A used spinal rig, held together with tape." + +/datum/shop_buyback/ripperdoc/hopper/street_doc + desc = "Used piston calves." + +/datum/shop_buyback/ripperdoc/coolant/street_doc + desc = "A coolant lattice, drained." + +/datum/shop_buyback/ripperdoc/fixers/street_doc + desc = "Used fingertip tools." + +/datum/shop_buyback/ripperdoc/rockjaw/street_doc + desc = "A used drill fist." + +/datum/shop_buyback/ripperdoc/gecko/street_doc + desc = "Worn palm pads." + +/datum/shop_buyback/ripperdoc/hemoglass/street_doc + desc = "A used blood filter." + +/datum/shop_buyback/ripperdoc/angler/street_doc + desc = "A wrist harpoon, line and all." + +/datum/shop_buyback/ripperdoc/registry_uplink/street_doc + desc = "A used registry uplink." + +/datum/shop_buyback/ripperdoc/cargo_cavity/street_doc + desc = "An empty rib pocket." + +/datum/shop_buyback/ripperdoc/gastro/street_doc + desc = "A stomach liner, scrubbed. Mostly." + +/datum/shop_buyback/ripperdoc/chromatic_dermis/street_doc + desc = "Old circuit ink." + +// ========================================================================= +// THE NPC +// ========================================================================= + +/// Ratchet behind his counter. A ripperdoc subtype, so the cradle in his bay +/// talks through him during installs. +/mob/living/basic/outpost_trader/ripperdoc/street_doc + shop_type = /datum/outpost_shop/vendor/street_doc diff --git a/voidcrew/modules/cyberware/ware_arm_utility.dm b/voidcrew/modules/cyberware/ware_arm_utility.dm index 1c64088dd28..4b0bdaeec19 100644 --- a/voidcrew/modules/cyberware/ware_arm_utility.dm +++ b/voidcrew/modules/cyberware/ware_arm_utility.dm @@ -29,7 +29,7 @@ */ /obj/item/organ/cyberimp/arm/toolkit/cyberware/rockjaw name = "\improper Rockjaw drill fist" - desc = "A compact mining drill that folds out of the forearm. Anything it cracks gets vacuumed straight into an internal hopper, so you aren't crawling around the floor picking up your own ore." + desc = "A compact mining drill that folds out of the forearm, with a hopper that swallows whatever it cracks." icon_state = "rockjaw" chrome_load = 2 tier = CYBERWARE_TIER_1 @@ -58,7 +58,7 @@ /// diamond drill (0.2). The speed is part of what the 1,200 cr buys. /obj/item/pickaxe/drill/cyberware name = "rockjaw drill" - desc = "The business end of a Rockjaw drill fist. It only comes off the arm at a Chrome Cradle." + desc = "The business end of a Rockjaw drill fist." toolspeed = 0.5 /obj/item/organ/cyberimp/arm/toolkit/cyberware/rockjaw/Destroy() @@ -160,7 +160,7 @@ */ /obj/item/organ/cyberimp/arm/toolkit/cyberware/fixers name = "\improper Fixer's Fingers" - desc = "A fingertip omnitool suite. Driver, wrench and cutters fold out of the knuckles, and the servo tendons behind them make everything you do with your hands quicker." + desc = "A fingertip omnitool suite. Driver, wrench and cutters fold out of the knuckles on quick servo tendons." icon_state = "fixers" chrome_load = 2 tier = CYBERWARE_TIER_1 @@ -170,6 +170,9 @@ /obj/item/wrench/cyborg, /obj/item/wirecutters/cyborg, ) + /// The action-speed modifier the servo tendons apply while the ware is running. + /// The model in the line (ware_line_models_a.dm) swaps in a weaker one. + var/datum/actionspeed_modifier/speed_modifier = /datum/actionspeed_modifier/cyberware_fixers // The tool-speed bonus rides the failing-gated passive layer (BAL-4): servo // tendons with an EMP reboot or a brownout are just fingers until the ware @@ -177,10 +180,10 @@ // idempotent and needs no applied-state guard. /obj/item/organ/cyberimp/arm/toolkit/cyberware/fixers/chrome_passives_on(mob/living/carbon/bearer) . = ..() - bearer?.add_actionspeed_modifier(/datum/actionspeed_modifier/cyberware_fixers) + bearer?.add_actionspeed_modifier(speed_modifier) /obj/item/organ/cyberimp/arm/toolkit/cyberware/fixers/chrome_passives_off(mob/living/carbon/bearer) . = ..() - bearer?.remove_actionspeed_modifier(/datum/actionspeed_modifier/cyberware_fixers) + bearer?.remove_actionspeed_modifier(speed_modifier) #undef CYBERWARE_ROCKJAW_SWEEP_DELAY diff --git a/voidcrew/modules/cyberware/ware_legend.dm b/voidcrew/modules/cyberware/ware_legend.dm index db50e79d8c2..58e909208b7 100644 --- a/voidcrew/modules/cyberware/ware_legend.dm +++ b/voidcrew/modules/cyberware/ware_legend.dm @@ -19,13 +19,19 @@ #define CYBERWARE_CASCADE_WINDOW (8 SECONDS) /// The price. #define CYBERWARE_CASCADE_CRASH (6 SECONDS) -/// Ranged dodge chance while moving during the window (shared arbiter; -/// highest-wins with Slipwire's 15, never additive). -#define CYBERWARE_CASCADE_DODGE_CHANCE 40 +/// Dodge chance during the window (shared arbiter; highest-wins with +/// Slipwire's 15, never additive): ranged fire while moving, blows any time. +#define CYBERWARE_CASCADE_DODGE_CHANCE 60 +/// Crit roll bonus for the bearer's own aimed hits during the window (crit_roll.dm). +#define CYBERWARE_CASCADE_CRIT_BONUS 18 /// Stamina dumped by the crash. #define CYBERWARE_CASCADE_CRASH_STAMINA 80 /// Degrees the afterimage hue moves per step of the trail. #define CYBERWARE_CASCADE_HUE_STEP 25 +/// Melee-cooldown multiplier during the window (lower is faster). +#define CYBERWARE_CASCADE_MELEE_MULT 0.5 +/// Starting opacity of a trail afterimage. +#define CYBERWARE_CASCADE_AFTERIMAGE_ALPHA 200 /** * # Cascade Lattice (T4, chest, OS slot, load 12) @@ -33,18 +39,24 @@ * The sandevistan-class flagship. Eight seconds where the world happens at * your speed: a full -1 gait (with reagent-modifier immunity for the * duration, no meth stacking, no sub-tick movement), melee cooldowns - * halved, and 40% ranged dodge while moving through the shared arbiter in - * ware_pro_combat.dm. Everyone nearby sees it: afterimages peel off every + * halved, 60% dodge through the shared arbiter in ware_pro_combat.dm (ranged + * fire while moving, blows whether moving or not), and +18 on the crit roll + * for the bearer's own aimed hits (crit_roll.dm). Everyone nearby sees it: afterimages peel off every * step, your victim's screen never had a chance, and the activation is an * audible time-tear. * * Then the heat bill: six seconds of crash, heavy stamina dump, leaden * slowdown, zero dodge. An EMP during the window skips straight to the * crash and re-arms the full sixty-second cooldown. + * + * Every number the window and the crash run on is a var here, so the lesser + * models in ware_line_sandy.dm retune by setting vars and swapping the action + * for a slower one. The status effects copy the numbers off the organ when the + * button is pressed and hold no reference back to it. */ /obj/item/organ/cyberimp/cyberware/cascade name = "\improper Cascade lattice" - desc = "A full-spine lattice of superconducting myelin, a real sandevistan, not one of the knockoffs. For eight seconds at a time you move and nobody else really does. Then all the heat it just made has to go somewhere, and it goes into you." + desc = "A full-spine lattice of superconducting myelin, the real thing, not one of the knockoffs. The bill comes afterward." icon_state = "cascade" zone = BODY_ZONE_CHEST slot = ORGAN_SLOT_CYBERWARE_OS @@ -54,6 +66,30 @@ aug_overlay = "cascade" emissive_overlay = TRUE actions_types = list(/datum/action/cooldown/cyberware/cascade_surge) + /// How long the window lasts. + var/window_duration = CYBERWARE_CASCADE_WINDOW + /// How long the crash lasts once the window ends. + var/crash_duration = CYBERWARE_CASCADE_CRASH + /// Stamina dumped on the bearer by the crash. + var/crash_stamina = CYBERWARE_CASCADE_CRASH_STAMINA + /// Dodge chance during the window: ranged fire while moving, blows any time. + var/window_dodge = CYBERWARE_CASCADE_DODGE_CHANCE + /// Crit roll bonus for the bearer's own aimed hits during the window. + var/window_crit_bonus = CYBERWARE_CASCADE_CRIT_BONUS + /// The gait the window grants. + var/datum/movespeed_modifier/window_speed = /datum/movespeed_modifier/cyberware_cascade + /// Melee-cooldown multiplier during the window (lower is faster). + var/window_melee_mult = CYBERWARE_CASCADE_MELEE_MULT + /// The bearer's screen tint during the window. + var/datum/client_colour/window_colour = /datum/client_colour/cyberware_cascade + /// A trail afterimage is left on every Nth step. + var/afterimage_interval = 1 + /// Starting opacity of a trail afterimage. + var/afterimage_alpha = CYBERWARE_CASCADE_AFTERIMAGE_ALPHA + /// The status alert shown while the window runs. + var/window_alert = /atom/movable/screen/alert/status_effect/cyberware_cascade + /// What the bearer reads on activation. + var/online_message = "CASCADE ONLINE." /obj/item/organ/cyberimp/cyberware/cascade/on_mob_remove(mob/living/carbon/organ_owner, special = FALSE, movement_flags) . = ..() @@ -83,7 +119,7 @@ /datum/action/cooldown/cyberware/cascade_surge name = "Cascade Surge" - desc = "Eight seconds of overwhelming speed: melee cooldowns halved, 40% chance to dodge ranged fire while moving. Then six seconds of crash. An EMP mid-window crashes you instantly." + desc = "Eight seconds of overwhelming speed: melee cooldowns halved, hits land harder, and a 60% chance to dodge blows, or ranged fire on the move. Then six seconds of crash." button_icon = 'voidcrew/modules/cyberware/icons/cyberware.dmi' button_icon_state = "act_cascade" cooldown_time = 60 SECONDS @@ -97,7 +133,8 @@ surger.balloon_alert(surger, "lattice still cycling!") return FALSE StartCooldown() - surger.apply_status_effect(/datum/status_effect/cyberware_cascade_window) + // The lattice hands the window its numbers (an organ-less call falls back to the T4 defaults). + surger.apply_status_effect(/datum/status_effect/cyberware_cascade_window, organ) return TRUE /** @@ -112,40 +149,86 @@ alert_type = /atom/movable/screen/alert/status_effect/cyberware_cascade /// Hue of the next afterimage, in degrees. Starts random so no two surges match. var/trail_hue = 0 + // The numbers below default to the T4 lattice and are overwritten from the + // organ that opened the window (see on_creation). Copied, never referenced. + /// Dodge chance while the window lives: ranged fire while moving, blows any time. + var/dodge_chance = CYBERWARE_CASCADE_DODGE_CHANCE + /// Crit roll bonus for the bearer's own aimed hits while the window lives. + var/crit_bonus = CYBERWARE_CASCADE_CRIT_BONUS + /// The gait the window grants. + var/datum/movespeed_modifier/speed_type = /datum/movespeed_modifier/cyberware_cascade + /// Melee-cooldown multiplier (lower is faster). + var/melee_mult = CYBERWARE_CASCADE_MELEE_MULT + /// The bearer's screen tint. + var/datum/client_colour/colour_type = /datum/client_colour/cyberware_cascade + /// A trail afterimage is left on every Nth step. + var/afterimage_interval = 1 + /// Starting opacity of a trail afterimage. + var/afterimage_alpha = CYBERWARE_CASCADE_AFTERIMAGE_ALPHA + /// What the bearer reads on activation. + var/online_message = "CASCADE ONLINE." + /// The crash this window rolls into. + var/crash_duration = CYBERWARE_CASCADE_CRASH + var/crash_stamina = CYBERWARE_CASCADE_CRASH_STAMINA + /// Steps taken so far, for the afterimage cadence. + var/steps_taken = 0 + +/// Optional second argument: the lattice whose numbers this window runs on. +/datum/status_effect/cyberware_cascade_window/on_creation(mob/living/new_owner, obj/item/organ/cyberimp/cyberware/cascade/lattice) + if(istype(lattice)) + duration = lattice.window_duration + alert_type = lattice.window_alert + dodge_chance = lattice.window_dodge + crit_bonus = lattice.window_crit_bonus + speed_type = lattice.window_speed + melee_mult = lattice.window_melee_mult + colour_type = lattice.window_colour + afterimage_interval = lattice.afterimage_interval + afterimage_alpha = lattice.afterimage_alpha + online_message = lattice.online_message + crash_duration = lattice.crash_duration + crash_stamina = lattice.crash_stamina + return ..() /datum/status_effect/cyberware_cascade_window/on_apply() trail_hue = rand(0, 359) - owner.add_movespeed_modifier(/datum/movespeed_modifier/cyberware_cascade) + owner.add_movespeed_modifier(speed_type) owner.add_movespeed_mod_immunities(id, /datum/movespeed_modifier/reagent) - cyberware_register_dodge_source(owner, id, CALLBACK(src, PROC_REF(get_dodge_chance))) + cyberware_register_dodge_source(owner, id, CALLBACK(src, PROC_REF(get_dodge_chance)), melee = TRUE) + owner.hv_crit_set_attacker_bonus(id, crit_bonus) RegisterSignal(owner, COMSIG_MOVABLE_MOVED, PROC_REF(on_move)) - owner.add_client_colour(/datum/client_colour/cyberware_cascade, id) + owner.add_client_colour(colour_type, id) playsound(owner, 'sound/effects/magic/timeparadox2.ogg', 70, TRUE) owner.visible_message( span_boldwarning("[owner] fractures into afterimages. Something under [owner.p_their()] skin is running far too fast!"), - span_boldnotice("CASCADE ONLINE. Eight seconds."), + span_boldnotice(online_message), ) owner.balloon_alert(owner, "cascade online") + cyberware_cascade_window_fx(owner) return TRUE /datum/status_effect/cyberware_cascade_window/on_remove() - owner.remove_movespeed_modifier(/datum/movespeed_modifier/cyberware_cascade) + owner.remove_movespeed_modifier(speed_type) owner.remove_movespeed_mod_immunities(id, /datum/movespeed_modifier/reagent) cyberware_unregister_dodge_source(owner, id) + owner.hv_crit_set_attacker_bonus(id, null) UnregisterSignal(owner, COMSIG_MOVABLE_MOVED) owner.remove_client_colour(id) if(!QDELETED(owner) && owner.stat != DEAD) - owner.apply_status_effect(/datum/status_effect/cyberware_cascade_crash) + owner.apply_status_effect(/datum/status_effect/cyberware_cascade_crash, crash_duration, crash_stamina) + if(!QDELETED(owner)) + cyberware_cascade_window_end_fx(owner) return ..() -/// Melee cooldowns halved for the window (changeNext_move multiplies these in). +/// Melee cooldowns scaled for the window (changeNext_move multiplies these in). /datum/status_effect/cyberware_cascade_window/nextmove_modifier() - return 0.5 + return melee_mult -/// Dodge-source callback for the shared arbiter: flat 40 while the window -/// lives (the arbiter itself enforces moving-only and point-blank rules). +/// Dodge-source callback for the shared arbiter: flat chance while the window +/// lives (the arbiter itself enforces the moving-only and point-blank rules +/// for shots, and the pinned rules for blows). /datum/status_effect/cyberware_cascade_window/proc/get_dodge_chance() - return CYBERWARE_CASCADE_DODGE_CHANCE + return dodge_chance /// Signal proc for [COMSIG_MOVABLE_MOVED]: one afterimage per step, the /// telegraph everyone in the fight can read. Each step shifts the hue, so the @@ -154,16 +237,19 @@ SIGNAL_HANDLER if(!isturf(old_loc)) return - new /obj/effect/temp_visual/decoy/fading/cascade(old_loc, owner, trail_hue) + steps_taken++ + if(steps_taken % afterimage_interval) // cheaper chrome leaves a sparser trail + return + new /obj/effect/temp_visual/decoy/fading/cascade(old_loc, owner, trail_hue, afterimage_alpha) trail_hue = (trail_hue + CYBERWARE_CASCADE_HUE_STEP) % 360 /// One afterimage in the Cascade trail, washed in a single hue. /obj/effect/temp_visual/decoy/fading/cascade duration = 8 -/obj/effect/temp_visual/decoy/fading/cascade/Initialize(mapload, atom/mimiced_atom, hue = 0) +/obj/effect/temp_visual/decoy/fading/cascade/Initialize(mapload, atom/mimiced_atom, hue = 0, start_alpha = CYBERWARE_CASCADE_AFTERIMAGE_ALPHA) . = ..() - alpha = 200 + alpha = start_alpha color = cascade_tint_matrix(hue) animate(src, alpha = 0, time = duration) // restart the parent's fade from the new alpha @@ -185,19 +271,34 @@ /atom/movable/screen/alert/status_effect/cyberware_cascade name = "Cascade Window" - desc = "The lattice has the world in slow motion. Make it count. Six seconds of crash follows either way." + desc = "The lattice has the world in slow motion. Make it count." icon_state = "radiation_shield" +/// The lesser models' alert (ware_line_sandy.dm), with no crash timer in the text. +/atom/movable/screen/alert/status_effect/cyberware_cascade/aftermarket + name = "Reflex Window" + desc = "The rig has the world in slow motion. Make it count." + /// The bill. No dodge source, no speed, the opposite of all of it. /datum/status_effect/cyberware_cascade_crash id = "cyberware_cascade_crash" duration = CYBERWARE_CASCADE_CRASH tick_interval = STATUS_EFFECT_NO_TICK alert_type = null + /// Stamina dumped on the bearer when the crash lands. + var/crash_stamina = CYBERWARE_CASCADE_CRASH_STAMINA + +/// Optional arguments: crash length and stamina dump, from the window that ended. +/datum/status_effect/cyberware_cascade_crash/on_creation(mob/living/new_owner, crash_duration, stamina_dump) + if(isnum(crash_duration)) + duration = crash_duration + if(isnum(stamina_dump)) + crash_stamina = stamina_dump + return ..() /datum/status_effect/cyberware_cascade_crash/on_apply() owner.add_movespeed_modifier(/datum/movespeed_modifier/cyberware_cascade_crash) - owner.adjustStaminaLoss(CYBERWARE_CASCADE_CRASH_STAMINA) + owner.adjustStaminaLoss(crash_stamina) owner.add_client_colour(/datum/client_colour/cyberware_cascade_crash, id) playsound(owner, 'sound/machines/warning-buzzer.ogg', 50, TRUE) owner.visible_message( @@ -205,6 +306,7 @@ span_userdanger("The lattice dumps its heat. Your whole body seizes up and everything slows to a crawl."), ) owner.balloon_alert(owner, "cascade crash!") + cyberware_cascade_crash_fx(owner) return TRUE /datum/status_effect/cyberware_cascade_crash/on_remove() @@ -212,6 +314,8 @@ owner.remove_client_colour(id) if(!QDELETED(owner) && owner.stat != DEAD) owner.balloon_alert(owner, "systems restabilized") + if(!QDELETED(owner)) + cyberware_cascade_crash_end_fx(owner) return ..() /datum/movespeed_modifier/cyberware_cascade @@ -250,6 +354,8 @@ #define CYBERWARE_REDLINE_CRASH_STAMINA 100 /// Crash slowdown duration. #define CYBERWARE_REDLINE_CRASH (5 SECONDS) +/// The outline a bearer wears through the window. +#define CYBERWARE_REDLINE_OUTLINE_COLOR "#ff2a2a" /** * # Redline Core (T4, chest, OS slot, load 10) @@ -271,7 +377,7 @@ */ /obj/item/organ/cyberimp/cyberware/redline name = "\improper Redline core" - desc = "A combat governor rebuilt to fail open. Twelve seconds with every safety limit switched off at once, announced by a chest speaker nobody told you was in there." + desc = "A combat governor rebuilt to fail open, announced by a chest speaker nobody told you was in there." icon_state = "redline" zone = BODY_ZONE_CHEST slot = ORGAN_SLOT_CYBERWARE_OS @@ -281,6 +387,29 @@ aug_overlay = "redline" emissive_overlay = TRUE actions_types = list(/datum/action/cooldown/cyberware/redline_burn) + // The burn's tuning lives on the organ so a cheaper or rougher model (see + // ware_line_berserk.dm) retunes it by setting vars. The defaults below ARE + // the Redline core's numbers. The defines stay as those defaults. + /// Length of the burn window. + var/burn_window = CYBERWARE_REDLINE_WINDOW + /// Incoming brute/burn multiplier during the window. + var/burn_damage_mult = CYBERWARE_REDLINE_DAMAGE_MULT + /// Flat bonus to unarmed strikes during the window. + var/burn_melee_bonus = CYBERWARE_REDLINE_MELEE_BONUS + /// Whether the window grants stun and baton immunity. + var/burn_stun_immune = TRUE + /// Roar reach in tiles. 0 keeps the announcement but staggers nobody. + var/burn_roar_range = CYBERWARE_REDLINE_ROAR_RANGE + /// Crash slowdown duration. + var/burn_crash = CYBERWARE_REDLINE_CRASH + /// Stamina dumped by the crash. + var/burn_crash_stamina = CYBERWARE_REDLINE_CRASH_STAMINA + /// Cooldown on the Redline Burn button. + var/burn_cooldown = 90 SECONDS + /// Button tooltip. Null keeps the Redline Burn action's own text. + var/burn_action_desc + /// Status alert text while the window is open. Null keeps the alert's own text. + var/burn_alert_desc /obj/item/organ/cyberimp/cyberware/redline/on_mob_remove(mob/living/carbon/organ_owner, special = FALSE, movement_flags) . = ..() @@ -312,12 +441,22 @@ /datum/action/cooldown/cyberware/redline_burn name = "Redline Burn" - desc = "Twelve seconds of stun immunity, 40% damage resistance and harder fists, opened with a staggering roar. Ends in a stamina collapse. An EMP mid-window collapses you instantly." + desc = "Twelve seconds of stun immunity, 40% damage resistance and harder fists, opened with a staggering roar. Ends in a collapse." button_icon = 'voidcrew/modules/cyberware/icons/cyberware.dmi' button_icon_state = "act_redline" cooldown_time = 90 SECONDS click_to_activate = FALSE +/datum/action/cooldown/cyberware/redline_burn/New(Target, original = TRUE) + . = ..() + // The core this button belongs to sets its own cooldown and tooltip. + var/obj/item/organ/cyberimp/cyberware/redline/core = organ + if(!istype(core)) + return + cooldown_time = core.burn_cooldown + if(core.burn_action_desc) + desc = core.burn_action_desc + /datum/action/cooldown/cyberware/redline_burn/Activate(atom/target) if(!isliving(owner)) return FALSE @@ -326,7 +465,7 @@ burner.balloon_alert(burner, "core still venting!") return FALSE StartCooldown() - burner.apply_status_effect(/datum/status_effect/cyberware_redline_window) + burner.apply_status_effect(/datum/status_effect/cyberware_redline_window, organ) return TRUE /** @@ -382,47 +521,93 @@ /// roll, so the next arming is skipped. See suppress_topup() for why this /// can't just clear the armed state. var/topup_suppressed = FALSE + // Tuning. The defaults are the Redline core's own numbers; on_creation() + // replaces them with the installed core's when one is passed in. + /// Incoming brute/burn multiplier. + var/damage_mult = CYBERWARE_REDLINE_DAMAGE_MULT + /// Flat bonus to unarmed strikes. + var/melee_bonus = CYBERWARE_REDLINE_MELEE_BONUS + /// Whether the window grants stun and baton immunity. + var/stun_immune = TRUE + /// Roar reach in tiles, 0 for the announcement only. + var/roar_range = CYBERWARE_REDLINE_ROAR_RANGE + /// Handed to the crash this window rolls into. + var/crash_duration = CYBERWARE_REDLINE_CRASH + var/crash_stamina = CYBERWARE_REDLINE_CRASH_STAMINA + /// Replaces the alert's description, if set. + var/alert_desc + +/// Pass the core whose numbers this burn runs on. Without one the window uses +/// the Redline core's own. +/datum/status_effect/cyberware_redline_window/on_creation(mob/living/new_owner, obj/item/organ/cyberimp/cyberware/redline/core) + if(istype(core)) + duration = core.burn_window + damage_mult = core.burn_damage_mult + melee_bonus = core.burn_melee_bonus + stun_immune = core.burn_stun_immune + roar_range = core.burn_roar_range + crash_duration = core.burn_crash + crash_stamina = core.burn_crash_stamina + alert_desc = core.burn_alert_desc + . = ..() + if(. && linked_alert && alert_desc) + linked_alert.desc = alert_desc /datum/status_effect/cyberware_redline_window/on_apply() // The anti-stun implant's buff pattern: traits plus damage-slowdown immunity. - owner.add_traits(list(TRAIT_STUNIMMUNE, TRAIT_BATON_RESISTANCE), id) + if(stun_immune) + owner.add_traits(list(TRAIT_STUNIMMUNE, TRAIT_BATON_RESISTANCE), id) owner.add_movespeed_mod_immunities(id, /datum/movespeed_modifier/damage_slowdown) if(ishuman(owner)) var/mob/living/carbon/human/human_owner = owner - human_owner.physiology.brute_mod *= CYBERWARE_REDLINE_DAMAGE_MULT - human_owner.physiology.burn_mod *= CYBERWARE_REDLINE_DAMAGE_MULT + human_owner.physiology.brute_mod *= damage_mult + human_owner.physiology.burn_mod *= damage_mult if(iscarbon(owner)) var/mob/living/carbon/carbon_owner = owner for(var/obj/item/bodypart/arm/limb in carbon_owner.bodyparts) - limb.unarmed_damage_low += CYBERWARE_REDLINE_MELEE_BONUS - limb.unarmed_damage_high += CYBERWARE_REDLINE_MELEE_BONUS + limb.unarmed_damage_low += melee_bonus + limb.unarmed_damage_high += melee_bonus buffed_parts += limb RegisterSignal(owner, COMSIG_LIVING_EARLY_UNARMED_ATTACK, PROC_REF(on_early_unarmed_attack)) RegisterSignal(owner, COMSIG_LIVING_UNARMED_ATTACK, PROC_REF(on_unarmed_attack)) owner.add_client_colour(/datum/client_colour/cyberware_redline, id) + // Everyone can see a bearer is burning: a red outline for the whole window, gone when it ends or they die + owner.add_filter(id, 2, outline_filter(1, CYBERWARE_REDLINE_OUTLINE_COLOR)) + RegisterSignal(owner, COMSIG_LIVING_DEATH, PROC_REF(on_bearer_death)) owner.balloon_alert(owner, "REDLINE") INVOKE_ASYNC(src, PROC_REF(roar)) + // Red-hot nodes, red eyes, a red light (cyberware_anim2.dm). + cyberware_redline_window_fx(owner) return TRUE +/// The burn's outline goes out with its bearer +/datum/status_effect/cyberware_redline_window/proc/on_bearer_death(mob/living/source, gibbed) + SIGNAL_HANDLER + source.remove_filter(id) + /datum/status_effect/cyberware_redline_window/on_remove() - owner.remove_traits(list(TRAIT_STUNIMMUNE, TRAIT_BATON_RESISTANCE), id) + if(stun_immune) + owner.remove_traits(list(TRAIT_STUNIMMUNE, TRAIT_BATON_RESISTANCE), id) owner.remove_movespeed_mod_immunities(id, /datum/movespeed_modifier/damage_slowdown) if(ishuman(owner)) var/mob/living/carbon/human/human_owner = owner - human_owner.physiology.brute_mod /= CYBERWARE_REDLINE_DAMAGE_MULT - human_owner.physiology.burn_mod /= CYBERWARE_REDLINE_DAMAGE_MULT + human_owner.physiology.brute_mod /= damage_mult + human_owner.physiology.burn_mod /= damage_mult for(var/obj/item/bodypart/arm/limb as anything in buffed_parts) if(QDELETED(limb)) continue - limb.unarmed_damage_low -= CYBERWARE_REDLINE_MELEE_BONUS - limb.unarmed_damage_high -= CYBERWARE_REDLINE_MELEE_BONUS + limb.unarmed_damage_low -= melee_bonus + limb.unarmed_damage_high -= melee_bonus buffed_parts.Cut() - UnregisterSignal(owner, list(COMSIG_LIVING_EARLY_UNARMED_ATTACK, COMSIG_LIVING_UNARMED_ATTACK)) + UnregisterSignal(owner, list(COMSIG_LIVING_EARLY_UNARMED_ATTACK, COMSIG_LIVING_UNARMED_ATTACK, COMSIG_LIVING_DEATH)) + owner.remove_filter(id) bypassed_victim = null bypassed_penetration = 0 owner.remove_client_colour(id) if(!QDELETED(owner) && owner.stat != DEAD) - owner.apply_status_effect(/datum/status_effect/cyberware_redline_crash) + owner.apply_status_effect(/datum/status_effect/cyberware_redline_crash, crash_duration, crash_stamina) + if(!QDELETED(owner)) + cyberware_redline_window_end_fx(owner) return ..() /** @@ -436,11 +621,19 @@ return playsound(owner, 'sound/effects/magic/demon_attack1.ogg', 90, TRUE) playsound(owner, 'sound/effects/magic/repulse.ogg', 60, TRUE) + if(roar_range <= 0) + // A core with no roar behind it still announces itself, just doesn't shake anything. + owner.visible_message( + span_boldwarning("[owner]'s eyes flood red and the speaker in [owner.p_their()] chest blares!"), + span_boldwarning("Your chest speaker blares."), + ) + return owner.visible_message( span_boldwarning("[owner]'s eyes flood red and a speaker-drone ROAR shakes the deck!"), span_boldwarning("You ROAR."), ) - for(var/mob/living/victim in oview(CYBERWARE_REDLINE_ROAR_RANGE, owner)) + cyberware_redline_roar_fx(owner, roar_range) + for(var/mob/living/victim in oview(roar_range, owner)) if(victim.stat == DEAD) continue if(cyberware_is_ally(owner, victim)) @@ -551,7 +744,7 @@ return var/target_zone = victim.get_random_valid_zone(owner.zone_selected) victim.apply_damage( - CYBERWARE_REDLINE_MELEE_BONUS, + melee_bonus, BRUTE, target_zone, victim.run_armor_check(target_zone, MELEE, armour_penetration = penetration, silent = TRUE), @@ -561,7 +754,7 @@ /atom/movable/screen/alert/status_effect/cyberware_redline name = "Redline Burn" - desc = "Every safety limit off at once. Stuns don't land, hits don't hurt much, and your fists hit a great deal harder. You collapse when it ends." + desc = "Every safety limit is off at once." icon_state = "radiation_shield" /datum/status_effect/cyberware_redline_crash @@ -569,16 +762,29 @@ duration = CYBERWARE_REDLINE_CRASH tick_interval = STATUS_EFFECT_NO_TICK alert_type = null + /// Stamina dumped on apply. + var/stamina_dump = CYBERWARE_REDLINE_CRASH_STAMINA + +/// The window hands over its core's crash length and stamina dump. Without +/// them the crash is the Redline core's own. +/datum/status_effect/cyberware_redline_crash/on_creation(mob/living/new_owner, new_duration, new_stamina_dump) + if(!isnull(new_duration)) + duration = new_duration + if(!isnull(new_stamina_dump)) + stamina_dump = new_stamina_dump + return ..() /datum/status_effect/cyberware_redline_crash/on_apply() owner.add_movespeed_modifier(/datum/movespeed_modifier/cyberware_redline_crash) - owner.adjustStaminaLoss(CYBERWARE_REDLINE_CRASH_STAMINA) + owner.adjustStaminaLoss(stamina_dump) owner.add_client_colour(/datum/client_colour/cyberware_redline_crash, id) owner.visible_message( span_warning("[owner] sags as the red drains out of [owner.p_their()] eyes."), span_userdanger("The core slams shut and your legs go out from under you."), ) owner.balloon_alert(owner, "redline collapse!") + // The outline gutters out, the charge earths through the deck, the nodes cool, the body slumps (cyberware_anim2.dm). + cyberware_redline_crash_fx(owner) return TRUE /datum/status_effect/cyberware_redline_crash/on_remove() @@ -586,6 +792,8 @@ owner.remove_client_colour(id) if(!QDELETED(owner) && owner.stat != DEAD) owner.balloon_alert(owner, "core recovered") + if(!QDELETED(owner)) + cyberware_redline_crash_end_fx(owner) return ..() /datum/movespeed_modifier/cyberware_redline_crash @@ -684,7 +892,7 @@ */ /obj/item/organ/cyberimp/cyberware/piledriver name = "\improper Meteor Piledriver frame" - desc = "Prototype launch pistons sleeved over both legs, running into a gyroscopic landing computer that aims you at the floor. It wants an open lane to throw you down, and everyone underneath gets a shadow to look at before you get there." + desc = "Prototype launch pistons sleeved over both legs, running into a gyroscopic landing computer that aims you at the floor." icon_state = "piledriver" zone = BODY_ZONE_L_LEG slot = ORGAN_SLOT_CYBERWARE_LEGS @@ -706,7 +914,9 @@ desc = "Something very heavy is about to land on this exact spot." icon = 'icons/mob/telegraphing/telegraph_96x96.dmi' icon_state = "target_largebox" - layer = BELOW_MOB_LAYER + // Painted on the floor: under whoever stands in it, on every row it covers. + plane = FLOOR_PLANE + layer = LOWER_RUNE_LAYER pixel_x = -32 pixel_y = -32 alpha = 0 @@ -718,11 +928,13 @@ /datum/action/cooldown/cyberware/piledriver_leap name = "Meteor Leap" - desc = "Launch onto any tile you can see with a clear arc to it, or onto somebody standing on one. Walls, windows and shut doors stop the jump. A shadow warns everyone underneath first. A direct hit crushes whoever is still there: heavy brute, broken bones, flat on the deck. Everything within two tiles is knocked flat and thrown." + desc = "Launch onto a tile you can see, or onto somebody standing on one. A direct hit crushes whoever is still there, and everything within two tiles is knocked flat." button_icon = 'voidcrew/modules/cyberware/icons/cyberware.dmi' button_icon_state = "act_piledriver" cooldown_time = 60 SECONDS click_to_activate = TRUE + // A stunned, paralysed or bound body does not get to leap out of it. + check_flags = AB_CHECK_CONSCIOUS | AB_CHECK_INCAPACITATED | AB_CHECK_IMMOBILE /datum/action/cooldown/cyberware/piledriver_leap/Activate(atom/target) if(!isliving(owner)) @@ -732,6 +944,10 @@ var/turf/here = get_turf(jumper) if(isnull(destination) || isnull(here) || destination == here) return FALSE + // The landing crushes whoever is under it, so it is not for a pacifist. + if(HAS_TRAIT(jumper, TRAIT_PACIFISM)) + to_chat(jumper, span_warning("You don't want to harm other living beings!")) + return FALSE if(jumper.buckled || !isturf(jumper.loc)) jumper.balloon_alert(jumper, "can't launch from here!") return FALSE @@ -749,6 +965,8 @@ if(arc_blocker(here, destination)) jumper.balloon_alert(jumper, "no room for the arc!") return FALSE + // The shadow goes down and the landing hurts someone. + cyberware_camo_drop(jumper) StartCooldown() // Liftoff: locked in for the whole arc, committed, like everything // with this much telegraph. The TILE is what gets locked, never the mob, @@ -757,15 +975,15 @@ jumper.face_atom(destination) var/launch_message = "You launch. The landing computer handles the rest." if(isliving(target)) - launch_message = "You launch. The landing computer locks the tile [target] is standing on, if [target.p_they()] move[target.p_s()], you come down on empty deck." + launch_message = "You launch. The landing computer locks onto [target]." jumper.visible_message( span_boldwarning("[jumper]'s leg pistons CRACK the deck and [jumper.p_they()] launch[jumper.p_es()] skyward!"), span_warning(launch_message), ) playsound(here, 'sound/effects/gravhit.ogg', 70, TRUE) - new /obj/effect/temp_visual/mook_dust(here) new /obj/effect/temp_visual/cyberware_piledriver_shadow(destination) - animate(jumper, pixel_z = 64, time = CYBERWARE_PILEDRIVER_AIRTIME * 0.5, flags = ANIMATION_RELATIVE, easing = QUAD_EASING|EASE_OUT) + // Up off the deck and over to the mark; the body stays on its tile until it lands (cyberware_anim2.dm). + cyberware_leap_takeoff_fx(jumper, here, destination, CYBERWARE_PILEDRIVER_AIRTIME, 64, 64) addtimer(CALLBACK(src, PROC_REF(land), destination), CYBERWARE_PILEDRIVER_AIRTIME) return TRUE @@ -783,7 +1001,7 @@ if(QDELETED(jumper)) return jumper.remove_traits(list(TRAIT_IMMOBILIZED, TRAIT_HANDS_BLOCKED), REF(src)) - animate(jumper, pixel_z = -64, time = 0.1 SECONDS, flags = ANIMATION_RELATIVE) + cyberware_leap_touchdown_fx(jumper) if(jumper.stat == DEAD) return // The marked tile can stop existing mid-flight (someone blows the floor out @@ -812,7 +1030,8 @@ crushed += pinned jumper.forceMove(final) playsound(final, 'sound/effects/meteorimpact.ogg', 90, TRUE) - new /obj/effect/temp_visual/mook_dust(final) + cyberware_grey_dust(final) + cyberware_piledriver_impact_fx(final, CYBERWARE_PILEDRIVER_IMPACT_RANGE) for(var/mob/living/victim as anything in crushed) crush_victim(jumper, victim) for(var/mob/living/victim in oview(CYBERWARE_PILEDRIVER_IMPACT_RANGE, final)) @@ -899,6 +1118,7 @@ #undef CYBERWARE_REDLINE_ROAR_RANGE #undef CYBERWARE_REDLINE_CRASH_STAMINA #undef CYBERWARE_REDLINE_CRASH +#undef CYBERWARE_REDLINE_OUTLINE_COLOR #undef CYBERWARE_PILEDRIVER_RANGE #undef CYBERWARE_PILEDRIVER_AIRTIME #undef CYBERWARE_PILEDRIVER_IMPACT_RANGE diff --git a/voidcrew/modules/cyberware/ware_line_berserk.dm b/voidcrew/modules/cyberware/ware_line_berserk.dm new file mode 100644 index 00000000000..6bdde5d925d --- /dev/null +++ b/voidcrew/modules/cyberware/ware_line_berserk.dm @@ -0,0 +1,91 @@ +/** + * # The Berserk line: cheaper cores for the Redline slot + * + * Two earlier models of the Redline core. Same chest OS slot as the Redline + * (and Cascade), so fitting one evicts the other. Same burn, retuned: every + * number lives in a var on /obj/item/organ/cyberimp/cyberware/redline + * (ware_legend.dm) and a model sets its own here. + * + * | | window | damage | punch | stun immune | roar | crash | cooldown | load | + * |---|---|---|---|---|---|---|---|---| + * | street | 8 s | x0.8 | +3 | no | none | 6 s | 90 s | 4 | + * | milspec | 10 s | x0.7 | +5 | yes | 4 tiles | 5 s | 105 s | 8 | + * | Redline | 12 s | x0.6 | +8 | yes | 5 tiles | 5 s | 90 s | 10 | + * + * The chest speaker announcement stays on every model: it is the telegraph. + * The street core has no roar to follow it, so it announces and staggers + * nobody. Crash stamina stays at the Redline's 100 on all three. + * + * The street core cycles as fast as the Redline itself (final balance pass, + * review-balance change 5): at 120 s it was the worst T2 OS pick. What keeps it + * the bottom rung is the short, soft window, no stun immunity and no roar. + */ + +/// Street: bench-built, sold for credits. Burns for less time, softens less and +/// does not hold off stuns. +/obj/item/organ/cyberimp/cyberware/redline/street + name = "\improper Hothead core" + desc = "A combat governor soldered together on a back-room bench out of parts from two others. The chest speaker rattles when it runs." + icon_state = "redline_street" + chrome_load = 4 + tier = CYBERWARE_TIER_2 + aug_overlay = "redline_street" + burn_window = 8 SECONDS + burn_damage_mult = 0.8 + burn_melee_bonus = 3 + burn_stun_immune = FALSE + burn_roar_range = 0 + burn_crash = 6 SECONDS + burn_cooldown = 90 SECONDS + burn_action_desc = "Eight seconds of damage resistance and harder fists, announced by the chest speaker. Ends in a collapse." + burn_alert_desc = "The safeties are loosened, not gone." + +/// Milspec: surplus assault issue. Close to the Redline, a size smaller. +/obj/item/organ/cyberimp/cyberware/redline/milspec + name = "\improper Vanguard core" + desc = "A surplus assault governor, still stencilled with someone else's unit number. The chest speaker is military grade, which means loud." + icon_state = "redline_milspec" + chrome_load = 8 + tier = CYBERWARE_TIER_3 + aug_overlay = "redline_milspec" + burn_window = 10 SECONDS + burn_damage_mult = 0.7 + burn_melee_bonus = 5 + burn_stun_immune = TRUE + burn_roar_range = 4 + burn_crash = 5 SECONDS + burn_cooldown = 90 SECONDS + burn_action_desc = "Ten seconds of stun immunity, 30% damage resistance and harder fists, opened with a staggering roar. Ends in a collapse." + burn_alert_desc = "The safeties are off." + +// ========================================================================= +// SPLICE SKUs (wired into the vendors at integration, not here) +// ========================================================================= + +/datum/shop_sku/ripperdoc/redline_street + zone_permission = ZONE_PERMISSION_YELLOW + category = "Street Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/redline/street + price_credits = 3000 + +/datum/shop_sku/ripperdoc/redline_milspec + zone_permission = ZONE_PERMISSION_ADVANCED + category = "Military Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/redline/milspec + price_vouchers = 4 + +// ========================================================================= +// TRADE-IN: the street model only +// Half list, credits only, exact type. The milspec core is paid for in +// vouchers and is never bought back. +// ========================================================================= + +/datum/shop_buyback/ripperdoc/redline_street + name = "Hothead Core (pulled)" + desc = "A pulled rage governor, scorched where the safeties used to be." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/redline/street + match_subtypes = FALSE + pay_credits = 1500 + demand_min = 1 + demand_max = 2 diff --git a/voidcrew/modules/cyberware/ware_line_camo.dm b/voidcrew/modules/cyberware/ware_line_camo.dm new file mode 100644 index 00000000000..21561b3900f --- /dev/null +++ b/voidcrew/modules/cyberware/ware_line_camo.dm @@ -0,0 +1,67 @@ +/** + * # Camo line: the street weave + * + * The cheap rung under the Ghostskin Weave (ware_military_body.dm), on the same + * skin slot, so installing one evicts the other. It reuses the whole Ghostskin + * field, signals, break triggers and all, and only retunes the vars the parent + * exposes: a shorter, patchier fade that fools players and never mobs. + * + * This file is included BEFORE ware_military_body.dm, so it cannot use the + * CYBERWARE_GHOSTSKIN_* defines (they are defined and #undef'd over there). + * Every number below is a plain var override instead. + * + * What hides_from_mobs = FALSE buys, in practice: no TRAIT_CYBER_CAMO, so + * cyberware_stealth.dm never refuses the bearer as a target (basic mobs, + * simple_animal hostiles, turrets and the scripted hunters it names) and + * cyberware_scan.dm never scatters a chrome read on them. All of it is keyed + * on that one trait. + */ + +/obj/item/organ/cyberimp/cyberware/ghostskin/street + name = "\improper Flickerskin weave" + desc = "A budget subdermal weave of refraction cells, mostly salvage. Switched on, you go blurry at the edges, which is not the same as gone." + icon_state = "ghostskin_street" + chrome_load = 2 + tier = CYBERWARE_TIER_2 + actions_types = list(/datum/action/cooldown/cyberware/ghostskin_cloak/street) + // Mostly faded, but never as faint as the full weave. Moving flares it + // well above that. + field_alpha = 60 + ripple_alpha = 170 + field_duration = 7 SECONDS + hides_from_mobs = FALSE + +/obj/item/organ/cyberimp/cyberware/ghostskin/street/engage_feedback(mob/living/carbon/wearer) + playsound(wearer, 'voidcrew/sound/machines/cloaking/on.ogg', 35, TRUE) + wearer.visible_message( + span_warning("[wearer] flickers and goes patchy!"), + span_notice("The weave stutters on and smears the light around you. Not all of it."), + ) + +/datum/action/cooldown/cyberware/ghostskin_cloak/street + desc = "Seven seconds of patchy optical camo." + cooldown_time = 45 SECONDS + +// ========================================================================= +// SPLICE SKUS +// Not listed on any vendor from here: the lead adds the path to Splice's +// sku_types and to the street doc's, and the buyback to buyback_types. +// ========================================================================= + +/datum/shop_sku/ripperdoc/ghostskin_street + zone_permission = ZONE_PERMISSION_YELLOW + category = "Street Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/ghostskin/street + price_credits = 2400 + stock_min = 1 + stock_max = 2 + +/// Trade-in at half list, credits only, like the other street rungs. +/datum/shop_buyback/ripperdoc/ghostskin_street + name = "Flickerskin weave (pulled)" + desc = "A patchy camo weave you've outgrown." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/ghostskin/street + pay_credits = 1200 + demand_min = 1 + demand_max = 2 diff --git a/voidcrew/modules/cyberware/ware_line_governor.dm b/voidcrew/modules/cyberware/ware_line_governor.dm new file mode 100644 index 00000000000..9de41c9a7fa --- /dev/null +++ b/voidcrew/modules/cyberware/ware_line_governor.dm @@ -0,0 +1,75 @@ +/** + * # The Governor line + * + * Two cheaper rungs under Governor Delete (ware_legend.dm), so a crew can buy + * a little headroom early and climb to the real thing. All three sit in the + * chest OS slot, so fitting one evicts another, and they evict Cascade and + * Redline too: the cost of headroom is the operating-system slot, same as the + * parent. Load is 0 on every rung. + * + * The parent already reads its bonus from `chrome_capacity_bonus`, so the + * rungs only retune that var and `tier`; there is no behaviour of their own. + * Delete has no downside beyond the slot, so there is none to scale down. + * + * Swapping down is safe by construction. The install gate nets the evicted + * governor's bonus out (installed_capacity_check), so a swap that would leave + * the body over its new ceiling is refused up front with the incumbent still + * online. Pulling a governor out is never blocked: whatever is then over the + * ceiling browns out until load drops, like any other capacity loss. + * + * Rung bonus limit load tier + * Patch +5 25 0 T2 (street, sold for credits) + * Bypass +10 30 0 T3 (military, sold for vouchers) + * Delete +15 35 0 T4 (ware_legend.dm) + */ + +/// T2: a hand-fitted patch over the limiter instead of a clean removal. +/obj/item/organ/cyberimp/cyberware/governor_delete/street + name = "\improper Governor Patch" + desc = "A neural governor with the limiter taped over rather than removed. The tape has seen some things." + icon_state = "governor_delete_street" + chrome_load = 0 + chrome_capacity_bonus = 5 + tier = CYBERWARE_TIER_2 + +/// T3: the limiter jumpered out of the circuit, surplus-grade work. +/obj/item/organ/cyberimp/cyberware/governor_delete/milspec + name = "\improper Governor Bypass" + desc = "A neural governor with its limiter jumpered out of the circuit. The surplus stencil is still on the casing." + icon_state = "governor_delete_milspec" + chrome_load = 0 + chrome_capacity_bonus = 10 + tier = CYBERWARE_TIER_3 + +// ========================================================================= +// SPLICE SKUS: not listed on any vendor yet, the integration pass adds them +// to the Chop Shop's sku_types (and the street doc's, for the Patch). +// ========================================================================= + +/datum/shop_sku/ripperdoc/governor_street + zone_permission = ZONE_PERMISSION_YELLOW + category = "Street Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/governor_delete/street + price_credits = 2500 + +/datum/shop_sku/ripperdoc/governor_milspec + zone_permission = ZONE_PERMISSION_ADVANCED + category = "Military Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/governor_delete/milspec + price_vouchers = 3 + +// ========================================================================= +// TRADE-IN: the Patch is the rung a customer outgrows, half list in credits. +// Not listed on any buyback_types yet, same integration pass as above. The +// Bypass costs vouchers, which can't be refunded, so it has no entry. +// ========================================================================= + +/datum/shop_buyback/ripperdoc/governor_street + name = "Governor Patch (pulled)" + desc = "A taped-over governor, pulled." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/governor_delete/street + match_subtypes = FALSE + pay_credits = 1250 + demand_min = 1 + demand_max = 2 diff --git a/voidcrew/modules/cyberware/ware_line_mantis.dm b/voidcrew/modules/cyberware/ware_line_mantis.dm new file mode 100644 index 00000000000..7d6dea15e45 --- /dev/null +++ b/voidcrew/modules/cyberware/ware_line_mantis.dm @@ -0,0 +1,196 @@ +/** + * # Mantis Blades line: the Shiv and Scorch models + * + * Two more ways to buy the same forearm blades (ware_military_arms.dm): + * - Shiv Blades, the street model. A duller blade, no lunge, light on the + * nervous system, sold for credits in the yellow zone and bought back. + * - Scorch Blades, the fire model. Mantis in every number, but every cut + * sets the target alight and the lunge lights them harder. + * + * Both are subtypes of the Mantis housing, so they share its arm hardware slot: + * installing one evicts the other. Both ship as cased pairs (left and right), + * like the parent. The tuning rides vars on the housing (lunge_range, + * lunge_bonus, lunge_fire_stacks and friends), so a model retunes by setting + * them, not by copying the lunge. + */ + +// ---- Fire -------------------------------------------------------------- + +/** + * Puts fire stacks on a living target and lights them. The only fire this + * line makes. It never touches the attacker and never lights a turf: any + * heat the surroundings get is what a burning mob already gives off. Corpses + * are left alone, so a body is never cooked out from under a revive or a salvage. + * Returns TRUE if the target caught fire just now. + */ +/proc/cyberware_scorch_target(mob/living/victim, stacks) + if(!istype(victim) || QDELETED(victim) || victim.stat == DEAD || stacks <= 0) + return FALSE + victim.adjust_fire_stacks(stacks) + return victim.ignite_mob() + +// ---- Blades -------------------------------------------------------------- + +/** + * The Shiv's blade. The same hardlight on a worse emitter: dull grey, and it + * hits softer. + */ +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/street + name = "shiv blade" + desc = "A dull grey sliver of hardlight with no shine to it. It still cuts." + icon_state = "mantis_street" + base_icon_state = "mantis_street" + inhand_icon_state = "mantis_street" + force = 14 + +/** + * The Scorch's blade. Cuts like a Mantis, then lights what it cut. The edge runs + * orange and the blade throws a little firelight while it is out. + */ +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/scorch + name = "scorch blade" + desc = "A forearm's length of hardlight gone orange along the edge. The air above it shimmers." + icon_state = "mantis_scorch" + base_icon_state = "mantis_scorch" + inhand_icon_state = "mantis_scorch" + light_range = 2 + light_power = 1 + light_color = LIGHT_COLOR_FIRE + /// Fire stacks each landed cut puts on its target. + var/fire_stacks_per_hit = 2 + /// Set by afterattack() during attack()'s parent call, which only a swing that + /// connected reaches. attack()'s own FALSE can't tell a cut from a pacifist's + /// pulled swing or a signal-skipped one. The Widowline does the same. + var/swing_landed = FALSE + +// The glow is only for a blade that is out. Stowed inside the housing it is dark. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/scorch/equipped(mob/user, slot, initial = FALSE) + . = ..() + set_light_on(TRUE) + +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/scorch/dropped(mob/user, silent = FALSE) + . = ..() + set_light_on(FALSE) + +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/scorch/attack(mob/living/target, mob/living/user, list/modifiers, list/attack_modifiers) + swing_landed = FALSE + . = ..() + var/landed = swing_landed + swing_landed = FALSE + // Only a cut that landed burns: not a blocked or cancelled swing, not a pulled + // one. Never the wielder, whoever is in the way. + if(. || !landed || QDELETED(target) || target == user) + return + // Embers off the cut; the blade's impact is the slash (cyberware_anim2.dm). + cyberware_scorch_trail_fx(user, target) + if(cyberware_scorch_target(target, fire_stacks_per_hit)) + log_combat(user, target, "set alight", src, "(scorch blade)") + +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/scorch/afterattack(atom/target, mob/user, list/modifiers, list/attack_modifiers) + . = ..() + swing_landed = TRUE + +// ---- Shiv Blades (street) ------------------------------------------------ + +/** + * # Shiv Blades (T2, arms, arm hardware slots, load 2 per arm / 4 the pair) + * + * The street answer to Mantis Blades: the same hardlight forearm housing built + * from salvage. The blade is weaker and there is no lunge, so no button besides + * the blade toggle. Cheap in credits and light on the nervous system, and Splice + * takes a pulled housing back toward the real thing. + */ +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/street + name = "\improper Shiv Blade housing (right)" + desc = "A forearm housing with the serial plate filed off and an emitter wired in by someone who skipped the manual." + icon_state = "mantis_street" + chrome_load = 2 + tier = CYBERWARE_TIER_2 + aug_overlay = "mantis_street" + items_to_create = list(/obj/item/melee/energy/blade/hardlight/cyberware_mantis/street) + actions_types = list(/datum/action/item_action/organ_action/toggle/toolkit) + +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/street/left + name = "\improper Shiv Blade housing (left)" + zone = BODY_ZONE_L_ARM + slot = ORGAN_SLOT_LEFT_ARM_AUG + +/obj/item/cyberware_pair_case/mantis_street + name = "\improper Shiv Blades case" + desc = "A scuffed clamshell case with two forearm housings jammed into mismatched foam." + ware_types = list( + /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/street, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/street/left, + ) + +// ---- Scorch Blades (fire) ------------------------------------------------ + +/** + * # Scorch Blades (T3, arms, arm hardware slots, load 4 per arm / 8 the pair) + * + * Mantis Blades with a heat sink grafted onto the emitter rail. The blade, the + * lunge and the cooldown are the Mantis numbers. What is added is fire: each cut + * leaves the target burning, and the lunge lights them harder. It heats the + * wrist, but never sets the wearer alight. + */ +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/scorch + name = "\improper Scorch Blade housing (right)" + desc = "A forearm housing with a heat sink grafted onto the emitter rail. The wrist runs warm even with nothing out." + icon_state = "mantis_scorch" + chrome_load = 4 + tier = CYBERWARE_TIER_3 + aug_overlay = "mantis_scorch" + items_to_create = list(/obj/item/melee/energy/blade/hardlight/cyberware_mantis/scorch) + lunge_fire_stacks = 4 + +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/scorch/left + name = "\improper Scorch Blade housing (left)" + zone = BODY_ZONE_L_ARM + slot = ORGAN_SLOT_LEFT_ARM_AUG + +/obj/item/cyberware_pair_case/mantis_scorch + name = "\improper Scorch Blades case" + desc = "A heavy clamshell case, scorched at the corners, with two forearm housings set in heat-proof foam." + ware_types = list( + /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/scorch, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/scorch/left, + ) + +// ---- The parlor's shelf -------------------------------------------------- + +/datum/shop_sku/ripperdoc/mantis_street + zone_permission = ZONE_PERMISSION_YELLOW + category = "Street Chrome" + name = "Shiv Blades (pair)" + desc = "A cased pair of cheap forearm blades." + item_path = /obj/item/cyberware_pair_case/mantis_street + price_credits = 2400 + stock_min = 1 + stock_max = 2 + fixed_price = TRUE + contract_reward = FALSE + +/datum/shop_sku/ripperdoc/mantis_scorch + zone_permission = ZONE_PERMISSION_ELITE + category = "Military Chrome" + name = "Scorch Blades (pair)" + desc = "A cased pair of forearm blades with heat sinks on the emitter rails." + item_path = /obj/item/cyberware_pair_case/mantis_scorch + price_vouchers = 4 + stock_min = 1 + stock_max = 1 + convoys_per_unit = 3 + fixed_price = TRUE + contract_reward = FALSE + +/// Half the credit price of one housing, either side, as the other street rungs +/// pay. Credits only, so turning a pair around is always a loss. +/datum/shop_buyback/ripperdoc/mantis_street + name = "Shiv Blade housing (pulled)" + desc = "A secondhand forearm housing, either side." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/street + match_subtypes = TRUE + pay_credits = 600 + demand_min = 2 + demand_max = 4 diff --git a/voidcrew/modules/cyberware/ware_line_models_a.dm b/voidcrew/modules/cyberware/ware_line_models_a.dm new file mode 100644 index 00000000000..2960751f369 --- /dev/null +++ b/voidcrew/modules/cyberware/ware_line_models_a.dm @@ -0,0 +1,383 @@ +/** + * # Cheaper and harder models of six wares + * + * Seven new models, each a subtype of the ware it sits under in the same slot, + * so fitting one evicts the other. The parent's tuning lives in vars (the Hopper + * leap, the Gorilla punches, the Fixer's tool-speed modifier), and a model + * retunes by setting them. + * + * model parent tier load price where + * Spring calves Hopper pistons T1 2 1,800 cr yellow + * Vaulter pistons Hopper pistons T3 4 3 vouchers advanced + * Brawler myomers Gorilla Arms T2 2 per arm 1,600 cr the pair yellow + * Tinker's fingers Fixer's Fingers T1 1 700 cr public + * Deepcore drill fist Rockjaw T2 3 2,400 cr public + * Holdout housing Popup Ronin T2 3 2,400 cr yellow + * + * Leg ladder: Shock Coils, Spring calves, Hopper, Vaulter, Meteor Piledriver. + * The Vaulter carries the Coils' soft landing and dry footing, which the Hopper + * itself never had, so stepping up to it costs no safety. + * + * Sold at Splice's counter, and the credit-priced ones at the street doc's + * (ripperdoc_catalog.dm, street_doc_catalog.dm). All of them also ride the + * zone loot tables (modules/loot/themes/). + */ + +// ========================================================================= +// SPRING CALVES (street Hopper) +// ========================================================================= + +/** + * # Spring calves (T1, legs, load 2) + * + * The cheap way into a jump: coil springs on the calves instead of pistons. A + * short hop that takes a while to wind back up. Nothing else. + */ +/obj/item/organ/cyberimp/cyberware/hopper/street + name = "\improper Spring calves" + desc = "Industrial coil springs sleeved over both calves and bolted straight to the shin. They squeak." + icon_state = "hopper_street" + chrome_load = 2 + tier = CYBERWARE_TIER_1 + aug_overlay = "hopper_street" + leap_range = 3 + leap_cooldown = 14 SECONDS + leap_action_desc = "Leap up to three tiles over gaps, tables and people." + +// ========================================================================= +// VAULTER PISTONS (milspec Hopper) +// ========================================================================= + +/** + * # Vaulter pistons (T3, legs, load 4) + * + * Military leg pistons: a longer jump on a shorter clock, with shock plates + * under the heel. Keeps the Shock Coils' soft landing and dry footing, minus the + * Coils' knockdown and stun trims, which stay with the Coils. + */ +/obj/item/organ/cyberimp/cyberware/hopper/milspec + name = "\improper Vaulter pistons" + desc = "Decommissioned military leg pistons, shock-plated at the heel. Somebody ground the serial number off and left the warning stencil." + icon_state = "hopper_milspec" + chrome_load = 4 + tier = CYBERWARE_TIER_3 + aug_overlay = "hopper_milspec" + organ_traits = list(TRAIT_NO_SLIP_WATER) + leap_range = 5 + leap_cooldown = 6 SECONDS + leap_action_desc = "Leap up to five tiles over gaps, tables and people." + +/obj/item/organ/cyberimp/cyberware/hopper/milspec/on_mob_insert(mob/living/carbon/organ_owner, special = FALSE, movement_flags) + . = ..() + RegisterSignal(organ_owner, COMSIG_LIVING_Z_IMPACT, PROC_REF(on_z_impact)) + +/obj/item/organ/cyberimp/cyberware/hopper/milspec/on_mob_remove(mob/living/carbon/organ_owner, special = FALSE, movement_flags) + . = ..() + UnregisterSignal(organ_owner, COMSIG_LIVING_Z_IMPACT) + +/// Signal proc for [COMSIG_LIVING_Z_IMPACT]: the Shock Coils' soft landing. Big +/// multi-level drops still stagger. +/obj/item/organ/cyberimp/cyberware/hopper/milspec/proc/on_z_impact(datum/source, levels, turf/fell_on) + SIGNAL_HANDLER + if(organ_flags & ORGAN_FAILING) + return NONE + new /obj/effect/temp_visual/mook_dust(fell_on) + cyberware_ink_pulse(owner, CYBERWARE_INK_SOFT) + if(levels >= 2) + owner.adjust_staggered_up_to(STAGGERED_SLOWDOWN_LENGTH * levels, 10 SECONDS) + owner.visible_message( + span_notice("[owner] lands on [fell_on] with a piston hiss."), + span_notice("Your heel plates soak up the impact."), + ) + return ZIMPACT_CANCEL_DAMAGE | ZIMPACT_NO_MESSAGE | ZIMPACT_NO_SPIN + +// ========================================================================= +// BRAWLER MYOMERS (street Gorilla Arms) +// ========================================================================= + +/** + * # Brawler myomers (T2, arms, arm hardware slots, load 2 per arm / 4 the pair) + * + * Gorilla Arms bought cheap: lighter punches, slower, a lighter smash on + * structures. Rock still breaks, and a grabbed victim takes the ordinary slam, + * not a throw across the room. The pair never pries a door: the set bonus is + * never attached, so even one of these beside a real Gorilla arm gets nothing. + */ +/obj/item/organ/cyberimp/cyberware/gorilla_arms/street + name = "\improper Brawler myomers (right)" + desc = "Off-the-shelf myomer strips grafted along the forearm. You don't look any stronger for it. You just stop losing arm wrestles." + icon_state = "gorilla_street" + chrome_load = 2 + tier = CYBERWARE_TIER_2 + aug_overlay = "gorilla_street_right" + punch_damage = 14 + structure_damage = 20 + punch_cooldown_time = 5 SECONDS + smash_cooldown_time = 1.5 SECONDS + hurl_range = 0 + pries_doors = FALSE + +/obj/item/organ/cyberimp/cyberware/gorilla_arms/street/left + name = "\improper Brawler myomers (left)" + zone = BODY_ZONE_L_ARM + slot = ORGAN_SLOT_LEFT_ARM_AUG + aug_overlay = "gorilla_street_left" + +/obj/item/cyberware_pair_case/gorilla_arms/street + name = "\improper Brawler myomers case" + desc = "A scuffed clamshell case with two bundles of myomer strips zip-tied into the foam." + ware_types = list( + /obj/item/organ/cyberimp/cyberware/gorilla_arms/street, + /obj/item/organ/cyberimp/cyberware/gorilla_arms/street/left, + ) + +// ========================================================================= +// TINKER'S FINGERS (street Fixer's Fingers) +// ========================================================================= + +/// Tinker's fingers' servo speed-up: a tenth off every timed action, to the +/// Fixer's quarter. Its own key, so it never replaces the Fixer's. +/datum/actionspeed_modifier/cyberware_fixers/street + multiplicative_slowdown = -0.1 + +/** + * # Tinker's fingers (T1, arm aug, load 1) + * + * The same three tools in the knuckles and cheaper servos behind them. A green + * crew's way into the arm slot the Fixer's Fingers hold at yellow. + */ +/obj/item/organ/cyberimp/arm/toolkit/cyberware/fixers/street + name = "\improper Tinker's fingers" + desc = "A fingertip tool suite in a housing that has been opened and closed more times than the warranty allows. Driver, wrench and cutters, all slightly loose." + icon_state = "fixers_street" + chrome_load = 1 + tier = CYBERWARE_TIER_1 + speed_modifier = /datum/actionspeed_modifier/cyberware_fixers/street + +// ========================================================================= +// DEEPCORE DRILL FIST (heavy Rockjaw) +// ========================================================================= + +/// The Deepcore's drill: between the Rockjaw's drill (0.5) and the diamond +/// drill (0.2). +/obj/item/pickaxe/drill/cyberware/deepcore + name = "deepcore drill" + desc = "A long drill bit with a diamond collar, wired straight into the forearm. It isn't coming off without a surgeon." + toolspeed = 0.3 + +/** + * # Deepcore drill fist (T2, arm aug, load 3) + * + * The Rockjaw with a heavier drill on the arm. The ore hopper and its button + * are the Rockjaw's own. + */ +/obj/item/organ/cyberimp/arm/toolkit/cyberware/rockjaw/deepcore + name = "\improper Deepcore drill fist" + desc = "A heavy drill folded into the forearm, built for rock the usual drills give up on." + icon_state = "rockjaw_deepcore" + chrome_load = 3 + tier = CYBERWARE_TIER_2 + items_to_create = list(/obj/item/pickaxe/drill/cyberware/deepcore) + +// ========================================================================= +// HOLDOUT HOUSING (street Popup Ronin) +// ========================================================================= + +/** + * The holdout's cylinder: six chambers of ordinary .38, thumbed in one round at + * a time. A speedloader feeds it a round per click, not the whole cylinder. + */ +/obj/item/ammo_box/magazine/internal/cylinder/rev38/cyberware_holdout + name = "holdout cylinder" + multiload = FALSE + +/** + * The gun the housing unfolds: a snub-nosed revolver on the stock chassis. NODROP + * while deployed comes from the toolkit Extend, so it can't be disarmed; Retract + * and EMP stow it. It leaves the shop loaded, and every reload after that is by + * hand, round by round. + */ +/obj/item/gun/ballistic/revolver/cyberware_holdout + name = "holdout revolver" + desc = "A snub-nosed revolver small enough to fold into a forearm. Uses .38 Special rounds." + icon = 'voidcrew/modules/cyberware/icons/cyberware_weapons.dmi' + icon_state = "ronin_holdout" + inhand_icon_state = "ronin_holdout" + lefthand_file = 'voidcrew/modules/cyberware/icons/cyberware_lefthand.dmi' + righthand_file = 'voidcrew/modules/cyberware/icons/cyberware_righthand.dmi' + accepted_magazine_type = /obj/item/ammo_box/magazine/internal/cylinder/rev38/cyberware_holdout + fire_sound = 'sound/items/weapons/gun/revolver/shot.ogg' + fire_delay = 0.4 SECONDS + /// How long each round takes to thumb into the cylinder. + var/reload_time = 1 SECONDS + +/// TRUE when a chamber is empty or holds a spent casing, so a round can go in. +/obj/item/gun/ballistic/revolver/cyberware_holdout/proc/cylinder_has_room() + if(!magazine) + return FALSE + for(var/slot in magazine.stored_ammo) + if(isnull(slot)) + return TRUE + // A path is a round the cylinder hasn't spawned yet, which is a live one. + if(!istype(slot, /obj/item/ammo_casing)) + continue + var/obj/item/ammo_casing/casing = slot + if(!casing.loaded_projectile) + return TRUE + return FALSE + +// Thumbing a round in takes a moment. A full cylinder is refused without a wait. +/obj/item/gun/ballistic/revolver/cyberware_holdout/load_gun(obj/item/ammo, mob/living/user) + if(user && cylinder_has_room() && !do_after(user, reload_time, target = src)) + return FALSE + return ..() + +/** + * # Holdout housing (T2, one arm, aug slot, load 3) + * + * A fold-out forearm revolver for the yellow zone: six shots of ordinary .38, + * loaded by hand. Anyone who looks at the bearer sees the housing in the arm. + */ +/obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin/holdout + name = "\improper Holdout housing" + desc = "A forearm housing with a snub-nosed revolver folded inside. Not much to look at, which is the idea." + icon_state = "ronin_holdout" + chrome_load = 3 + tier = CYBERWARE_TIER_2 + aug_overlay = "ronin_holdout" + items_to_create = list(/obj/item/gun/ballistic/revolver/cyberware_holdout) + +/obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin/holdout/on_mob_insert(mob/living/carbon/arm_owner, special = FALSE, movement_flags) + . = ..() + RegisterSignal(arm_owner, COMSIG_ATOM_EXAMINE, PROC_REF(on_owner_examined)) + +/obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin/holdout/on_mob_remove(mob/living/carbon/arm_owner, special = FALSE, movement_flags) + . = ..() + UnregisterSignal(arm_owner, COMSIG_ATOM_EXAMINE) + +/// Signal proc for [COMSIG_ATOM_EXAMINE] on the bearer: the housing shows in the +/// arm to anyone who looks, suit or no suit. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin/holdout/proc/on_owner_examined(mob/living/carbon/source, mob/user, list/examine_list) + SIGNAL_HANDLER + examine_list += span_notice("[source.p_They()] [source.p_have()] a revolver housing set into [source.p_their()] [parse_zone(zone)].") + +// ========================================================================= +// SPLICE SKUS: on the Chop Shop's sku_types (ripperdoc_catalog.dm), and the +// credit-priced ones on the Back Bay's too (street_doc_catalog.dm). +// ========================================================================= + +/datum/shop_sku/ripperdoc/hopper_street + zone_permission = ZONE_PERMISSION_YELLOW + category = "Street Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/hopper/street + price_credits = 1800 + +/datum/shop_sku/ripperdoc/hopper_milspec + zone_permission = ZONE_PERMISSION_ADVANCED + category = "Military Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/hopper/milspec + price_vouchers = 3 + +/datum/shop_sku/ripperdoc/gorilla_street + zone_permission = ZONE_PERMISSION_YELLOW + category = "Street Chrome" + name = "Brawler Myomers (pair)" + desc = "A cased pair of cheap myomer forearms." + item_path = /obj/item/cyberware_pair_case/gorilla_arms/street + price_credits = 1600 + stock_min = 1 + stock_max = 2 + fixed_price = TRUE + contract_reward = FALSE + +/datum/shop_sku/ripperdoc/fixers_street + category = "Street Chrome" + item_path = /obj/item/organ/cyberimp/arm/toolkit/cyberware/fixers/street + price_credits = 700 + +/datum/shop_sku/ripperdoc/rockjaw_deepcore + category = "Street Chrome" + item_path = /obj/item/organ/cyberimp/arm/toolkit/cyberware/rockjaw/deepcore + price_credits = 2400 + +/datum/shop_sku/ripperdoc/ronin_holdout + zone_permission = ZONE_PERMISSION_YELLOW + category = "Street Chrome" + desc = "A snub-nosed revolver folded into a chrome forearm." + item_path = /obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin/holdout + price_credits = 2400 + stock_min = 1 + stock_max = 2 + fixed_price = TRUE + contract_reward = FALSE + +// ========================================================================= +// INTAKE LEDGERS: half the shelf price, credits only, like the other street +// rungs. The Vaulter costs vouchers, which can't be refunded, so it has no +// entry. Ratchet's subtypes carry his wording and are listed beside Splice's. +// ========================================================================= + +/datum/shop_buyback/ripperdoc/hopper_street + name = "Spring calves (pulled)" + desc = "Used calf springs. They squeak." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/hopper/street + match_subtypes = FALSE + pay_credits = 900 + demand_min = 2 + demand_max = 3 + +/datum/shop_buyback/ripperdoc/hopper_street/street_doc + desc = "A used pair of calf springs." + +/datum/shop_buyback/ripperdoc/gorilla_street + name = "Brawler myomers (pulled)" + desc = "One myomer arm, either side." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/gorilla_arms/street + match_subtypes = TRUE + pay_credits = 400 + demand_min = 2 + demand_max = 4 + +/datum/shop_buyback/ripperdoc/gorilla_street/street_doc + desc = "One used myomer arm, either side." + +/datum/shop_buyback/ripperdoc/fixers_street + name = "Tinker's fingers (pulled)" + desc = "A used fingertip tool suite." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/arm/toolkit/cyberware/fixers/street + match_subtypes = FALSE + pay_credits = 350 + demand_min = 2 + demand_max = 3 + +/datum/shop_buyback/ripperdoc/fixers_street/street_doc + desc = "A used set of fingertip tools, a bit loose." + +/datum/shop_buyback/ripperdoc/rockjaw_deepcore + name = "Deepcore drill fist (pulled)" + desc = "A used drill fist. The bit's still sharp." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/arm/toolkit/cyberware/rockjaw/deepcore + match_subtypes = FALSE + pay_credits = 1200 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/ripperdoc/rockjaw_deepcore/street_doc + desc = "A used drill fist, ore hopper and all." + +/datum/shop_buyback/ripperdoc/ronin_holdout + name = "Holdout housing (pulled)" + desc = "A used revolver housing." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin/holdout + match_subtypes = FALSE + pay_credits = 1200 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/ripperdoc/ronin_holdout/street_doc + desc = "A used revolver housing, cylinder and all." diff --git a/voidcrew/modules/cyberware/ware_line_sandy.dm b/voidcrew/modules/cyberware/ware_line_sandy.dm new file mode 100644 index 00000000000..303ff54f346 --- /dev/null +++ b/voidcrew/modules/cyberware/ware_line_sandy.dm @@ -0,0 +1,132 @@ +/** + * # The Cascade line: street and service-grade reflex rigs + * + * Two cheaper ways into the chest OS slot's speed core, both subtypes of the + * Cascade Lattice (ware_legend.dm) so they share its slot, its EMP rule, its + * crash-on-removal rule and its window code. Installing any of the three + * evicts the other two, and the Redline family sits in the same slot, so a + * crew climbs this ladder by swapping in the next rung. + * + * Each rung trades window strength for a worse bill: the lower the model, the + * slower the gait, the thinner the dodge and the melee boost, and the longer + * and nastier the crash. Window length stays nearly flat. The telegraphs are + * the same at every rung (the activation, the afterimages, the crash), just + * duller and sparser on the cheap chrome. + * + * model window gait dodge crit melee crash stamina cooldown load + * street 6 s -0.5 30 +9 x0.75 8 s 90 120 s 6 + * service 7 s -0.75 45 +14 x0.6 7 s 90 90 s 9 + * Cascade T4 8 s -1 60 +18 x0.5 6 s 80 60 s 12 + * + * The dodge covers ranged fire while moving and blows whether moving or not + * (the shared arbiter in ware_pro_combat.dm). The crit column is added to the + * aimed-crit roll of the bearer's own hits (crit_roll.dm): on a 25+ damage + * hit's 1 to 90 roll that is about +10, +15 and +20 points of chance. + * + * Sold at Splice's counter. The street model is credits, behind the yellow + * step, and trades in at the Intake ledger; the service model is vouchers + * behind the advanced step. + */ + +// ========================================================================= +// STREET MODEL (T2) +// ========================================================================= + +/obj/item/organ/cyberimp/cyberware/cascade/street + name = "spliced reflex rig" + desc = "A spinal reflex rig cobbled together from salvaged parts and a lot of tape. The scorch marks came with it." + icon_state = "cascade_street" + chrome_load = 6 + tier = CYBERWARE_TIER_2 + aug_overlay = "cascade_street" + actions_types = list(/datum/action/cooldown/cyberware/cascade_surge/street) + window_duration = 6 SECONDS + crash_duration = 8 SECONDS + crash_stamina = 90 + window_dodge = 30 + window_crit_bonus = 9 + window_speed = /datum/movespeed_modifier/cyberware_cascade/street + window_melee_mult = 0.75 + window_colour = /datum/client_colour/cyberware_cascade/street + afterimage_interval = 3 + afterimage_alpha = 120 + window_alert = /atom/movable/screen/alert/status_effect/cyberware_cascade/aftermarket + online_message = "REFLEX RIG ONLINE." + +/datum/action/cooldown/cyberware/cascade_surge/street + name = "Reflex Surge" + desc = "Six seconds of speed: melee cooldowns cut by a quarter, hits land harder, and a 30% chance to dodge blows, or ranged fire on the move. Then eight seconds of crash." + cooldown_time = 120 SECONDS + +/datum/movespeed_modifier/cyberware_cascade/street + multiplicative_slowdown = -0.5 + +/// The street rig's screen: the lattice's tint, a quarter as strong. +/datum/client_colour/cyberware_cascade/street + color = list(1.025, 0, 0.02, 0.0125, 1.0125, 0.025, 0.025, 0, 1.05) + +// ========================================================================= +// SERVICE MODEL (T3) +// ========================================================================= + +/obj/item/organ/cyberimp/cyberware/cascade/milspec + name = "service reflex lattice" + desc = "A decommissioned military reflex lattice. The serial plate has been ground off, but the stencilling on the casing is still there." + icon_state = "cascade_milspec" + chrome_load = 9 + tier = CYBERWARE_TIER_3 + aug_overlay = "cascade_milspec" + actions_types = list(/datum/action/cooldown/cyberware/cascade_surge/milspec) + window_duration = 7 SECONDS + crash_duration = 7 SECONDS + crash_stamina = 90 + window_dodge = 45 + window_crit_bonus = 14 + window_speed = /datum/movespeed_modifier/cyberware_cascade/milspec + window_melee_mult = 0.6 + window_colour = /datum/client_colour/cyberware_cascade/milspec + afterimage_interval = 2 + afterimage_alpha = 160 + window_alert = /atom/movable/screen/alert/status_effect/cyberware_cascade/aftermarket + online_message = "LATTICE ONLINE." + +/datum/action/cooldown/cyberware/cascade_surge/milspec + name = "Reflex Surge" + desc = "Seven seconds of speed: melee cooldowns cut by 40%, hits land harder, and a 45% chance to dodge blows, or ranged fire on the move. Then seven seconds of crash." + cooldown_time = 90 SECONDS + +/datum/movespeed_modifier/cyberware_cascade/milspec + multiplicative_slowdown = -0.75 + +/// The service lattice's screen: the lattice's tint, half as strong. +/datum/client_colour/cyberware_cascade/milspec + color = list(1.05, 0, 0.04, 0.025, 1.025, 0.05, 0.05, 0, 1.1) + +// ========================================================================= +// SPLICE SKUs and INTAKE LEDGER +// The lead wires these into /datum/outpost_shop/vendor/ripperdoc (sku_types, +// buyback_types) and the zone loot tables at integration. +// ========================================================================= + +/datum/shop_sku/ripperdoc/cascade_street + zone_permission = ZONE_PERMISSION_YELLOW + category = "Street Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/cascade/street + price_credits = 3600 + +/datum/shop_sku/ripperdoc/cascade_milspec + zone_permission = ZONE_PERMISSION_ADVANCED + category = "Military Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/cascade/milspec + price_vouchers = 4 + +/// Half list, credits only, like the rest of the ladder's street rungs. +/datum/shop_buyback/ripperdoc/cascade_street + name = "Spliced Reflex Rig (pulled)" + desc = "A taped-together spinal rig. Splice strips it for parts toward a proper lattice." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/cascade/street + match_subtypes = FALSE + pay_credits = 1800 + demand_min = 1 + demand_max = 2 diff --git a/voidcrew/modules/cyberware/ware_line_widowline.dm b/voidcrew/modules/cyberware/ware_line_widowline.dm new file mode 100644 index 00000000000..6e66115a473 --- /dev/null +++ b/voidcrew/modules/cyberware/ware_line_widowline.dm @@ -0,0 +1,223 @@ +/** + * # Widowline line: the Arc model + * + * The Widowline monowire (ware_military_arms.dm) with a capacitor stack on the + * spool. Everything the plain wire does still happens, and every landed hit + * adds a shock on top: + * + * - Living targets take a little burn and a short stagger. The current goes in + * through the wire itself, so it is run with SHOCK_NOGLOVES and insulated + * gloves do nothing. Everything else tg's shock code already honours still + * applies: TRAIT_SHOCKIMMUNE, insulating suits and species or physiology + * shock coefficients. A target the shock can't reach takes only the plain + * cut: no burn, no stagger, no arc. + * - Silicons, mechs and robotic mobs (MOB_ROBOTIC) take a heavy burn bonus. + * The plain wire is nearly useless against them (its demolition_mod), and + * this is what makes up for it. Silicons shrug electrocute_act off by signal, + * so they get the bonus alone. + * - A turret, a ship laser turret, a console or a camera is knocked out for a + * few seconds. Never a raw emp_act: an EMP blacks out an APC for a minute, + * pops airlocks open, drains a laser turret's cell and scrambles a + * porta-turret's targeting flags. Each family is cut through its own + * machinery (the Icepick Jack's precedent), consoles lose power briefly, and + * anything that answers tg's on_saboteur() hook (cameras) goes through that. + * Outpost property and the trader outposts' concourse are immune. + * + * The cleave is untouched: neighbours take the plain cleave, not the shock. + */ + +/// Burn of the shock itself, on top of the cut and the wire's own charge. +#define CYBERWARE_ARC_SHOCK_BURN 5 +/// Stagger a landed shock leaves, and the most it stacks to. +#define CYBERWARE_ARC_STAGGER (2 SECONDS) +#define CYBERWARE_ARC_STAGGER_CAP (4 SECONDS) +/// Burn bonus on silicons, mechs and robotic mobs. +#define CYBERWARE_ARC_ROBOTIC_BONUS 25 +/// How long a shorted turret, console or camera stays dark. +#define CYBERWARE_ARC_JAM_DURATION (5 SECONDS) +/// Gap before the same wire can short another machine. +#define CYBERWARE_ARC_JAM_RECHARGE (15 SECONDS) + +/** + * The wire. Plain Widowline numbers (force, burn, cleave, reach, armour + * penetration, demolition_mod) are inherited as they are; the vars here are + * the shock rider only. All of it keys off afterattack(), which only runs for + * a swing that actually landed, on a mob or on an object that can be hit. + */ +/obj/item/melee/cyberware_monowire/live + name = "\improper Widowline Arc monowire" + desc = "A weighted spool of monomolecular line with a capacitor stack feeding it. It smells of ozone and ticks like a cooling engine." + icon_state = "monowire_live" + inhand_icon_state = "monowire_live" + /// Burn of the shock on a living target. + var/shock_burn = CYBERWARE_ARC_SHOCK_BURN + /// Stagger a landed shock leaves. + var/stagger_time = CYBERWARE_ARC_STAGGER + /// Most stagger the shock stacks to. + var/stagger_cap = CYBERWARE_ARC_STAGGER_CAP + /// Burn bonus on silicons, mechs and robotic mobs. + var/robotic_bonus = CYBERWARE_ARC_ROBOTIC_BONUS + /// How long a shorted machine stays down. + var/jam_duration = CYBERWARE_ARC_JAM_DURATION + /// Gap before this wire can short another machine. + var/jam_recharge = CYBERWARE_ARC_JAM_RECHARGE + /// The stack recharging after a machine was shorted. + COOLDOWN_DECLARE(jam_cooldown) + +/obj/item/melee/cyberware_monowire/live/afterattack(atom/target, mob/user, list/modifiers, list/attack_modifiers) + . = ..() + if(!isliving(user) || QDELETED(target) || target == user) + return + // The wire lashes out to what it hit (cyberware_anim2.dm). + cyberware_monowire_lash_fx(user, target) + if(isliving(target)) + discharge_into_mob(target, user) + else if(ismecha(target)) + discharge_into_mech(target, user) + else if(ismachinery(target)) + discharge_into_machine(target, user) + +/// The shock on whatever it went into: a crackle along the wire and sparks +/// where it touched (cyberware_anim2.dm). The wire is the picture, never a bolt. +/obj/item/melee/cyberware_monowire/live/proc/arc_visuals(atom/target, mob/living/user) + cyberware_arc_crackle_fx(user, target) + do_sparks(2, TRUE, target) + playsound(target, SFX_SPARKS, 50, TRUE) + cyberware_ink_pulse(user, CYBERWARE_INK_SOFT) + +/** + * The shock into a living target. Returns TRUE if anything landed. + * Dead and shock-immune targets are skipped entirely; see the file header for + * what counts as shock-immune. + */ +/obj/item/melee/cyberware_monowire/live/proc/discharge_into_mob(mob/living/target, mob/living/user) + if(target.stat == DEAD || HAS_TRAIT(target, TRAIT_SHOCKIMMUNE)) + return FALSE + var/jolted = FALSE + var/is_silicon = issilicon(target) + // No stun, no message, no skeleton flash, no jitter: the beam and the + // sparks are the tell, and the stagger is the whole effect on the body. + if(!is_silicon && target.electrocute_act(shock_burn, user, 1, SHOCK_NOGLOVES | SHOCK_NOSTUN | SHOCK_SUPPRESS_MESSAGE | SHOCK_NO_HUMAN_ANIM, 0, 0, 0)) + jolted = TRUE + if(is_silicon || (target.mob_biotypes & MOB_ROBOTIC)) + var/bonus_zone = target.get_random_valid_zone(user.zone_selected) + target.apply_damage( + robotic_bonus, + BURN, + bonus_zone, + target.run_armor_check(bonus_zone, ENERGY, armour_penetration = armour_penetration, silent = TRUE), + ) + jolted = TRUE + if(!jolted) + return FALSE + arc_visuals(target, user) + if(!QDELETED(target)) + target.adjust_staggered_up_to(stagger_time, stagger_cap) + return TRUE + +/// The burn bonus into a mech's armour. The pilot is not touched. +/obj/item/melee/cyberware_monowire/live/proc/discharge_into_mech(obj/vehicle/sealed/mecha/mech, mob/living/user) + if(QDELETED(mech) || mech.atom_integrity <= 0 || HAS_TRAIT(mech, TRAIT_OUTPOST_PROPERTY) || is_trader_outpost_protected(mech)) + return FALSE + mech.take_damage(robotic_bonus, BURN, ENERGY, FALSE, get_dir(mech, user), armour_penetration) + arc_visuals(mech, user) + return TRUE + +/** + * Shorts a machine out for a few seconds, if it is one that can be. Returns + * TRUE if it went dark. The recharge only starts on a machine that actually + * went dark, so a wasted swing at a vending machine costs nothing. + */ +/obj/item/melee/cyberware_monowire/live/proc/discharge_into_machine(obj/machinery/machine, mob/living/user) + if(QDELETED(machine) || HAS_TRAIT(machine, TRAIT_OUTPOST_PROPERTY) || is_trader_outpost_protected(machine)) + return FALSE + if(!COOLDOWN_FINISHED(src, jam_cooldown) || !jam_machine(machine)) + // Still crackles, goes nowhere. + do_sparks(1, TRUE, machine) + return FALSE + COOLDOWN_START(src, jam_cooldown, jam_recharge) + arc_visuals(machine, user) + machine.visible_message(span_warning("[machine] crackles and goes dark.")) + return TRUE + +/// Cuts the machine through its own family's machinery. Returns TRUE if it was knocked out. +/obj/item/melee/cyberware_monowire/live/proc/jam_machine(obj/machinery/machine) + if(machine.machine_stat & BROKEN) + return FALSE + if(istype(machine, /obj/machinery/porta_turret)) + // Outpost sanctuary turrets are immune, as against the Icepick Jack. + if(istype(machine, /obj/machinery/porta_turret/outpost)) + return FALSE + var/obj/machinery/porta_turret/turret = machine + if(!COOLDOWN_FINISHED(turret, disabled_time)) + return FALSE + turret.set_disabled(jam_duration) + return TRUE + if(istype(machine, /obj/machinery/ship_combat/laser_turret)) + var/obj/machinery/ship_combat/laser_turret/laser = machine + // Its fire cooldown is also its normal reload; never shorten that. + if(COOLDOWN_TIMELEFT(laser, fire_cooldown) >= jam_duration) + return FALSE + COOLDOWN_START(laser, fire_cooldown, jam_duration) + return TRUE + if(istype(machine, /obj/machinery/computer)) + return cyberware_arc_power_cut(machine, jam_duration) + // Cameras answer here; anything else with no answer is left alone. + return !!machine.on_saboteur(src, jam_duration) + +/** + * Drops a machine's power for a moment, the same flag an area blackout sets + * and the same way back: power_change() works the real state out again. + * Returns FALSE for a machine that is already down or draws no power. + */ +/proc/cyberware_arc_power_cut(obj/machinery/machine, duration) + if(machine.use_power == NO_POWER_USE || (machine.machine_stat & (NOPOWER | BROKEN | MAINT | EMPED))) + return FALSE + machine.set_machine_stat(machine.machine_stat | NOPOWER) + SEND_SIGNAL(machine, COMSIG_MACHINERY_POWER_LOST) + machine.update_appearance() + machine.set_light(0) + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(cyberware_arc_power_restore), machine), duration) + return TRUE + +/// End of a power cut. Global so it survives the machine being deleted meanwhile. +/proc/cyberware_arc_power_restore(obj/machinery/machine) + if(QDELETED(machine)) + return + // power_change() leaves a broken machine's flags alone, so a machine that + // broke while it was dark would stay unpowered after it was repaired. + if(machine.machine_stat & BROKEN) + machine.set_machine_stat(machine.machine_stat & ~NOPOWER) + machine.power_change() + +/** + * # Widowline Arc spool housing (T3, one arm, aug slot, load 6) + * + * The Widowline spool housing, stepped up. Same slot, same arm, so installing + * one evicts the other. Sold at the Chop Shop for vouchers and never bought + * back, like the plain Widowline. + */ +/obj/item/organ/cyberimp/arm/toolkit/cyberware/monowire/live + name = "\improper Widowline Arc spool housing" + desc = "A wrist spool wound with monomolecular line, with a capacitor stack bolted on where the safety used to be." + icon_state = "monowire_live" + chrome_load = 6 + items_to_create = list(/obj/item/melee/cyberware_monowire/live) + +/datum/shop_sku/ripperdoc/monowire_live + zone_permission = ZONE_PERMISSION_ELITE + category = "Military Chrome" + item_path = /obj/item/organ/cyberimp/arm/toolkit/cyberware/monowire/live + price_vouchers = 5 + stock_min = 1 + stock_max = 1 + convoys_per_unit = 3 + fixed_price = TRUE + contract_reward = FALSE + +#undef CYBERWARE_ARC_SHOCK_BURN +#undef CYBERWARE_ARC_STAGGER +#undef CYBERWARE_ARC_STAGGER_CAP +#undef CYBERWARE_ARC_ROBOTIC_BONUS +#undef CYBERWARE_ARC_JAM_DURATION +#undef CYBERWARE_ARC_JAM_RECHARGE diff --git a/voidcrew/modules/cyberware/ware_military_arms.dm b/voidcrew/modules/cyberware/ware_military_arms.dm index cb46862d5ea..c6319fd0282 100644 --- a/voidcrew/modules/cyberware/ware_military_arms.dm +++ b/voidcrew/modules/cyberware/ware_military_arms.dm @@ -23,7 +23,7 @@ */ /obj/item/cyberware_pair_case name = "cyberware pair case" - desc = "A foam-lined clamshell case for a matched set of chrome. Crack it open in hand." + desc = "A foam-lined clamshell case for a matched set of chrome." icon = 'voidcrew/modules/cyberware/icons/cyberware.dmi' icon_state = "ware_case" w_class = WEIGHT_CLASS_NORMAL @@ -39,7 +39,7 @@ . = ..() if(length(contents)) . += span_notice("Nestled in the foam: [english_list(contents)].") - . += span_notice("Use it in hand to crack it open.") + /obj/item/cyberware_pair_case/attack_self(mob/user, modifiers) . = ..() @@ -61,7 +61,7 @@ /obj/item/cyberware_pair_case/gorilla_arms name = "\improper Gorilla Arms case" - desc = "A heavy clamshell case stenciled with a fist. Two myomer lattices inside, one per arm. The Cradle installs the pair in one sitting." + desc = "A heavy clamshell case stenciled with a fist. Two myomer lattices inside, one per arm." ware_types = list( /obj/item/organ/cyberimp/cyberware/gorilla_arms, /obj/item/organ/cyberimp/cyberware/gorilla_arms/left, @@ -114,7 +114,7 @@ */ /obj/item/organ/cyberimp/cyberware/gorilla_arms name = "\improper Gorilla Arms myomer lattice (right)" - desc = "A myomer weave anchored bone-deep through the arm. You don't look any stronger for it; you just start pulling closed airlocks open with your bare hands." + desc = "A myomer weave anchored bone-deep through the arm. You don't look any stronger for it; doors just stop being your problem." icon_state = "gorilla" zone = BODY_ZONE_R_ARM slot = ORGAN_SLOT_RIGHT_ARM_AUG @@ -128,6 +128,21 @@ aug_overlay = "gorilla_right" /// Rate limit on this arm's empowered hits. COOLDOWN_DECLARE(slam_cooldown) + // The defines above are the Gorilla defaults. They live in vars so the other + // models of the line (ware_line_models_a.dm) can retune by setting them. + /// Flat brute per empowered punch. + var/punch_damage = CYBERWARE_GORILLA_PUNCH_DAMAGE + /// Damage per structure/machine smash. + var/structure_damage = CYBERWARE_GORILLA_STRUCTURE_DAMAGE + /// Gap between empowered punches, per arm. + var/punch_cooldown_time = CYBERWARE_GORILLA_PUNCH_COOLDOWN + /// Gap between structure smashes / rock breaks, per arm. + var/smash_cooldown_time = CYBERWARE_GORILLA_SMASH_COOLDOWN + /// How far an aggressively-grabbed victim gets hurled. 0 or less: no hurl, + /// the grabbed victim takes the ordinary slam. + var/hurl_range = CYBERWARE_GORILLA_HURL_RANGE + /// Whether a matched pair of these pries closed airlocks (the set bonus). + var/pries_doors = TRUE /obj/item/organ/cyberimp/cyberware/gorilla_arms/left name = "\improper Gorilla Arms myomer lattice (left)" @@ -137,7 +152,8 @@ /obj/item/organ/cyberimp/cyberware/gorilla_arms/Initialize(mapload) . = ..() - AddElement(/datum/element/organ_set_bonus, /datum/status_effect/organ_set_bonus/cyberware_gorilla) + if(pries_doors) + AddElement(/datum/element/organ_set_bonus, /datum/status_effect/organ_set_bonus/cyberware_gorilla) /** * Worn-chrome overlay hook. Gorilla Arms replace the limb outright, hand @@ -146,12 +162,11 @@ * sits well above CYBERWARE_WORN_LAYER, so a plate drawn only at the chrome * layer gets painted back over by bare knuckles. * - * One image cannot fix that. The hand already draws above UNIFORM_LAYER, so - * anything stacked over the hand is also stacked over the jumpsuit, and the - * chrome layer exists precisely to stay under worn clothing. Instead we do what - * tg's own toolkit augments do (augments_arms.dm's hand_state): the arm plate - * keeps the chrome layer and hides under sleeves, and a separate "_hand" plate - * rides at the hand's own layer, where gloves still cover it like real skin. + * Lifting the whole arm plate above the hand would also lift it over the worn + * ID. Instead we do what tg's own toolkit augments do (augments_arms.dm's + * hand_state): the arm plate keeps the chrome layer, over the sleeve, and a + * separate "_hand" plate rides at the hand's own layer, where gloves still + * cover it like real skin. * * The sheet may ship without the hand plate. Then this is a no-op and the arm * plate renders alone, exactly as it did before. @@ -198,7 +213,7 @@ source.do_attack_animation(rock, ATTACK_EFFECT_SMASH) playsound(rock, 'sound/effects/meteorimpact.ogg', 30, TRUE) rock.gets_drilled(source, 1) - COOLDOWN_START(src, slam_cooldown, CYBERWARE_GORILLA_SMASH_COOLDOWN) + COOLDOWN_START(src, slam_cooldown, smash_cooldown_time) return COMPONENT_CANCEL_ATTACK_CHAIN // Structures, girders, machines cave in. Loose items are beneath us. @@ -213,11 +228,12 @@ span_danger("[source] caves [smashed] in with a piston-driven fist!"), span_danger("You cave [smashed] in!"), ) - smashed.take_damage(CYBERWARE_GORILLA_STRUCTURE_DAMAGE, BRUTE, MELEE) - COOLDOWN_START(src, slam_cooldown, CYBERWARE_GORILLA_SMASH_COOLDOWN) + smashed.take_damage(structure_damage, BRUTE, MELEE) + COOLDOWN_START(src, slam_cooldown, smash_cooldown_time) return COMPONENT_CANCEL_ATTACK_CHAIN - if(!isliving(target)) + // A pacifist's punch at a living thing is the ordinary punch, which refuses it. + if(!isliving(target) || HAS_TRAIT(source, TRAIT_PACIFISM)) return NONE if(!source.can_unarmed_attack()) return COMPONENT_SKIP_ATTACK @@ -227,24 +243,24 @@ if(ishuman(living_target)) var/mob/living/carbon/human/human_target = living_target - if(human_target.check_block(source, CYBERWARE_GORILLA_PUNCH_DAMAGE, "[source]'s piston punch")) + if(human_target.check_block(source, punch_damage, "[source]'s piston punch")) source.do_attack_animation(living_target) playsound(living_target.loc, 'sound/items/weapons/punchmiss.ogg', 25, TRUE, -1) log_combat(source, living_target, "attempted to piston-punch", "gorilla arms") return COMPONENT_CANCEL_ATTACK_CHAIN // The one damage line. Flat, wounding, honest. - var/grabbed_hurl = living_target.pulledby == source && source.grab_state >= GRAB_AGGRESSIVE + var/grabbed_hurl = hurl_range > 0 && living_target.pulledby == source && source.grab_state >= GRAB_AGGRESSIVE source.do_attack_animation(living_target, ATTACK_EFFECT_SMASH) playsound(living_target.loc, 'sound/items/weapons/punch1.ogg', 40, TRUE, -1) var/target_zone = living_target.get_random_valid_zone(source.zone_selected) var/armor_block = living_target.run_armor_check(target_zone, MELEE, armour_penetration = active_hand.unarmed_effectiveness) - living_target.apply_damage(CYBERWARE_GORILLA_PUNCH_DAMAGE, BRUTE, target_zone, armor_block, wound_bonus = 10) + living_target.apply_damage(punch_damage, BRUTE, target_zone, armor_block, wound_bonus = 10) if(source.body_position != LYING_DOWN) var/atom/throw_target = get_edge_target_turf(living_target, source.dir) if(grabbed_hurl) - living_target.safe_throw_at(throw_target, CYBERWARE_GORILLA_HURL_RANGE, 2, source) + living_target.safe_throw_at(throw_target, hurl_range, 2, source) living_target.visible_message( span_danger("[source] hurls [living_target] across the room!"), span_userdanger("[source] hurls you across the room!"), @@ -257,7 +273,7 @@ ) to_chat(source, span_danger("You slam [living_target]!")) log_combat(source, living_target, "piston-punched", "gorilla arms") - COOLDOWN_START(src, slam_cooldown, CYBERWARE_GORILLA_PUNCH_COOLDOWN) + COOLDOWN_START(src, slam_cooldown, punch_cooldown_time) return COMPONENT_CANCEL_ATTACK_CHAIN /** @@ -270,8 +286,8 @@ id = "organ_set_bonus_cyberware_gorilla" organs_needed = 2 required_biotype = NONE - bonus_activate_text = span_notice("Your Gorilla Arms sync up. You can force closed airlocks by hand now. Walk up and pull, out of combat mode.") - bonus_deactivate_text = span_notice("Your arms fall out of sync. Doors stay shut again.") + bonus_activate_text = span_notice("Your Gorilla Arms sync up.") + bonus_deactivate_text = span_notice("Your arms fall out of sync.") /datum/status_effect/organ_set_bonus/cyberware_gorilla/enable_bonus(obj/item/organ/inserted_organ) . = ..() @@ -287,6 +303,9 @@ // MANTIS BLADES // ========================================================================= +// These four are the Mantis defaults. The housing reads them into vars so the +// other models in the line (ware_line_mantis.dm) can retune by setting vars. + /// Lunge reach in tiles. #define CYBERWARE_MANTIS_LUNGE_RANGE 5 /// Bonus brute the arriving lunge lands PER BLADE (cap 10 per ADDENDUM 2). @@ -305,9 +324,9 @@ * * Every sprite comes off the cyberware sheets rather than the stock hardlight * sword: this is a long blade running forward past the hand out of a forearm - * housing, not something anybody is gripping. The held sprite is blade only. - * The housing is already on the bearer's arm as the organ's aug_overlay, and - * drawing a second one in the hand put a metal brick over their bicep. + * housing, not something anybody is gripping. The held sprite is the blade + * along the forearm. The organ's worn overlay (the housing with the blade + * folded in) hides while the blade is out, see hide_worn_while_deployed. * * base_icon_state comes along for the ride purely so it cannot disagree with * icon_state; update_icon_state() only consults it when sword_color_icon is @@ -343,6 +362,8 @@ chrome_load = 3 tier = CYBERWARE_TIER_3 aug_overlay = "mantis" + // The worn housing sprite carries the folded blade, so it hides while the blade is out. + hide_worn_while_deployed = TRUE items_to_create = list(/obj/item/melee/energy/blade/hardlight/cyberware_mantis) // A blade sliding out of a forearm housing and snapping back into it, the // cursed katana's pair (mining_loot/cursed_katana.dm), not a baton's ratchet. @@ -352,6 +373,17 @@ /datum/action/item_action/organ_action/toggle/toolkit, /datum/action/cooldown/cyberware/mantis_lunge, ) + /// Lunge reach in tiles. + var/lunge_range = CYBERWARE_MANTIS_LUNGE_RANGE + /// Bonus brute the arriving lunge lands per blade out. + var/lunge_bonus = CYBERWARE_MANTIS_LUNGE_BONUS + /// Delay between the wind-up and the dash. + var/lunge_telegraph = CYBERWARE_MANTIS_LUNGE_TELEGRAPH + /// How long a connecting lunge floors its target. + var/lunge_knockdown = CYBERWARE_MANTIS_LUNGE_KNOCKDOWN + /// Fire stacks the arriving lunge puts on its target (and lights them + /// with). 0 for no fire. The most of any blade that arrives lands, not the sum. + var/lunge_fire_stacks = 0 /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/left name = "\improper Mantis Blade housing (left)" @@ -369,32 +401,42 @@ /datum/action/cooldown/cyberware/mantis_lunge name = "Mantis Lunge" - desc = "Dash up to five tiles onto a target with the blade leading, cutting them open and dropping them on arrival. The blade must be extended. With both blades out, both land." + desc = "Dash up to five tiles onto a target, cutting them open and dropping them on arrival." button_icon = 'voidcrew/modules/cyberware/icons/cyberware.dmi' button_icon_state = "act_mantis_lunge" cooldown_time = 20 SECONDS click_to_activate = TRUE + // A stunned, paralysed or bound body, or one with its hands tied, does not lunge. + check_flags = AB_CHECK_CONSCIOUS | AB_CHECK_INCAPACITATED | AB_CHECK_IMMOBILE | AB_CHECK_HANDS_BLOCKED /** - * How many mantis blades this owner has out right now. Every housing grants - * exactly one of these buttons, so counting the buttons whose blade is - * extended counts the blades that will arrive. + * The housings whose blade is out right now and will arrive with the lunge. + * Every lunging housing grants exactly one of these buttons, so walking the + * buttons whose blade is extended finds the blades. A model with no lunge + * button never lands in this list. */ -/datum/action/cooldown/cyberware/mantis_lunge/proc/count_extended_blades() +/datum/action/cooldown/cyberware/mantis_lunge/proc/get_extended_housings() + var/list/housings = list() if(!owner) - return 0 - var/blades = 0 + return housings for(var/datum/action/cooldown/cyberware/mantis_lunge/lunge_action in owner.actions) var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing = lunge_action.organ if(istype(housing) && housing.blade_extended()) - blades++ - return blades + housings += housing + return housings + +/// How many mantis blades this owner has out right now. +/datum/action/cooldown/cyberware/mantis_lunge/proc/count_extended_blades() + return length(get_extended_housings()) /datum/action/cooldown/cyberware/mantis_lunge/Activate(atom/target) var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing = organ if(!istype(housing) || !isliving(owner)) return FALSE var/mob/living/lunger = owner + if(HAS_TRAIT(lunger, TRAIT_PACIFISM)) + to_chat(lunger, span_warning("You don't want to harm other living beings!")) + return FALSE if(!housing.blade_extended()) lunger.balloon_alert(lunger, "extend the blade first!") return FALSE @@ -408,9 +450,11 @@ if(victim == lunger || victim.stat == DEAD) lunger.balloon_alert(lunger, "no target!") return FALSE - if(get_dist(lunger, victim) > CYBERWARE_MANTIS_LUNGE_RANGE || !can_see(lunger, victim, CYBERWARE_MANTIS_LUNGE_RANGE)) + if(get_dist(lunger, victim) > housing.lunge_range || !can_see(lunger, victim, housing.lunge_range)) lunger.balloon_alert(lunger, "out of reach!") return FALSE + // The blade is about to be used on someone. + cyberware_camo_drop(lunger) // One lunge clock across both housings: start every mantis_lunge button // this owner has, ours included. for(var/datum/action/cooldown/cyberware/mantis_lunge/lunge_action in lunger.actions) @@ -423,7 +467,7 @@ span_warning("You coil for the lunge."), ) playsound(lunger, 'sound/items/weapons/sear.ogg', 50, TRUE) - addtimer(CALLBACK(src, PROC_REF(do_lunge), WEAKREF(victim)), CYBERWARE_MANTIS_LUNGE_TELEGRAPH) + addtimer(CALLBACK(src, PROC_REF(do_lunge), WEAKREF(victim)), housing.lunge_telegraph) return TRUE /// The dash itself: walk the line to the target with a decoy per tile, @@ -432,12 +476,15 @@ var/mob/living/lunger = owner if(QDELETED(lunger) || lunger.incapacitated || !isturf(lunger.loc)) return + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing = organ + if(!istype(housing)) + return var/mob/living/victim = victim_ref?.resolve() if(QDELETED(victim) || victim.stat == DEAD) lunger.balloon_alert(lunger, "target lost!") return var/turf/victim_turf = get_turf(victim) - if(!victim_turf || get_dist(lunger, victim_turf) > CYBERWARE_MANTIS_LUNGE_RANGE + 1) + if(!victim_turf || get_dist(lunger, victim_turf) > housing.lunge_range + 1) lunger.balloon_alert(lunger, "target lost!") return playsound(lunger, 'sound/items/weapons/bladeslice.ogg', 60, TRUE) @@ -456,23 +503,33 @@ // Both housings deployed means both blades arrive. Floored at one: a blade // stowed during the 0.3s telegraph shouldn't eat the whole cooldown for // nothing when the dash still connected. - var/blades = max(count_extended_blades(), 1) + var/list/blade_housings = get_extended_housings() + if(!length(blade_housings)) + blade_housings = list(housing) + var/blades = length(blade_housings) lunger.face_atom(victim) - lunger.do_attack_animation(victim, ATTACK_EFFECT_SLASH) + lunger.do_attack_animation(victim, no_effect = TRUE) + // The blade's own impact over the target (cyberware_anim.dm). + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/lunge_blade = housing.active_item + cyberware_play_impact(lunger, victim, istype(lunge_blade) ? lunge_blade.impact_state : "impact_mantis") // One armor roll for the arrival, reused per blade. Both land in the same // instant on the same plate, and it keeps the armor message to one line. var/armor_block = victim.run_armor_check(BODY_ZONE_CHEST, MELEE) - for(var/i in 1 to blades) + var/lunge_fire = 0 + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/blade_housing as anything in blade_housings) victim.apply_damage( - CYBERWARE_MANTIS_LUNGE_BONUS, + blade_housing.lunge_bonus, BRUTE, BODY_ZONE_CHEST, armor_block, wound_bonus = 10, sharpness = SHARP_EDGED, ) - victim.Knockdown(CYBERWARE_MANTIS_LUNGE_KNOCKDOWN) + lunge_fire = max(lunge_fire, blade_housing.lunge_fire_stacks) + victim.Knockdown(housing.lunge_knockdown) + if(lunge_fire) + cyberware_scorch_target(victim, lunge_fire) if(blades > 1) victim.visible_message( span_danger("[lunger] flickers across the gap and shuts both blades on [victim] like a trap, dropping [victim.p_them()]!"), @@ -513,7 +570,7 @@ */ /obj/item/melee/cyberware_monowire name = "\improper Widowline monowire" - desc = "A weighted spool of monomolecular line, run live. At rest it's a glitter in the air. Swung, it goes through plate and the person wearing it in the same motion, and through whoever is standing next to them." + desc = "A weighted spool of monomolecular line, run live. At rest it's a glitter in the air." icon = 'voidcrew/modules/cyberware/icons/cyberware_weapons.dmi' icon_state = "monowire" inhand_icon_state = "monowire" @@ -533,22 +590,33 @@ attack_verb_continuous = list("garrotes", "flenses", "lashes", "bisects") attack_verb_simple = list("garrote", "flense", "lash", "bisect") hitsound = 'voidcrew/sound/monowire1.ogg' + /// Cleave fraction of the wire's damage dealt to secondary targets. + var/cleave_mult = CYBERWARE_MONOWIRE_CLEAVE_MULT + /// Burn the charged line adds on top of the cut, every hit. + var/charge_burn = CYBERWARE_MONOWIRE_BURN + /// Set by afterattack() during attack()'s parent call. Only a swing that + /// connected gets that far, and attack()'s own return can't tell a hit from + /// a pacifist's pulled swing or a signal-skipped one (both return FALSE). + var/swing_landed = FALSE /obj/item/melee/cyberware_monowire/attack(mob/living/target, mob/living/user, list/modifiers, list/attack_modifiers) // The parent plays hitsound partway through the swing, so pick which of the // line's two voices we are before handing off. hitsound = pick('voidcrew/sound/monowire1.ogg', 'voidcrew/sound/monowire2.ogg') + swing_landed = FALSE . = ..() - // A truthy return means the swing was blocked or cancelled outright, no - // cut landed, so nothing burns and nothing carries through. - if(. || QDELETED(target) || !isliving(user)) + var/landed = swing_landed + swing_landed = FALSE + // No cut landed (blocked, cancelled, pulled), so nothing burns and nothing + // carries through. + if(. || !landed || QDELETED(target) || !isliving(user)) return // The charge on the line, on top of the cut. Silent armor check: the parent // already announced the penetration for this same swing. var/burn_zone = target.get_random_valid_zone(user.zone_selected) target.apply_damage( - CYBERWARE_MONOWIRE_BURN, + charge_burn, BURN, burn_zone, target.run_armor_check(burn_zone, MELEE, armour_penetration = armour_penetration, silent = TRUE), @@ -565,7 +633,7 @@ // One roll for both halves: it is one pass of the same wire. var/cleave_block = nearby.run_armor_check(BODY_ZONE_CHEST, MELEE, armour_penetration = armour_penetration) nearby.apply_damage( - force * CYBERWARE_MONOWIRE_CLEAVE_MULT, + force * cleave_mult, BRUTE, BODY_ZONE_CHEST, cleave_block, @@ -573,7 +641,7 @@ sharpness = SHARP_EDGED, ) nearby.apply_damage( - CYBERWARE_MONOWIRE_BURN * CYBERWARE_MONOWIRE_CLEAVE_MULT, + charge_burn * cleave_mult, BURN, BODY_ZONE_CHEST, cleave_block, @@ -587,6 +655,10 @@ ) playsound(target, 'sound/items/weapons/bladeslice.ogg', 50, TRUE) +/obj/item/melee/cyberware_monowire/afterattack(atom/target, mob/user, list/modifiers, list/attack_modifiers) + . = ..() + swing_landed = TRUE + /** * # Widowline Monowire (T3, one arm, aug slot, load 5) * @@ -634,7 +706,7 @@ */ /obj/item/ammo_box/magazine/cyberware_ronin name = "\improper Ronin flush-feed magazine (10x24mm)" - desc = "A flush-feed magazine keyed to the Popup Ronin's action and nothing else's. Holds twenty caseless rounds." + desc = "A flush-feed magazine keyed to the Popup Ronin's action and nothing else's." icon = 'voidcrew/modules/cyberware/icons/cyberware.dmi' icon_state = "ronin_mag" base_icon_state = "ronin_mag" @@ -681,7 +753,7 @@ */ /obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin name = "\improper Popup Ronin housing" - desc = "A forearm rig that unfolds a skeletal machine-pistol into your grip and folds it away again just as fast. The mag well only takes Ronin flush-feed magazines." + desc = "A forearm rig that unfolds a skeletal machine-pistol into your grip and folds it away again just as fast." icon_state = "ronin" chrome_load = 5 tier = CYBERWARE_TIER_3 @@ -723,7 +795,7 @@ /obj/item/ammo_casing/cyberware_buster name = "30mm shaped rocket" - desc = "A stubby shaped-charge rocket in the Buster's proprietary 30mm. All of the blast goes forward and stops at the first thing it hits." + desc = "A stubby shaped-charge rocket in the Buster's proprietary 30mm." icon_state = "low_yield_rocket" base_icon_state = "low_yield_rocket" caliber = CYBERWARE_CALIBER_BUSTER @@ -771,7 +843,7 @@ */ /obj/item/gun/ballistic/revolver/cyberware_buster name = "\improper Bunker Buster micro-rocket pod" - desc = "A two-tube rocket pod that rides folded along the forearm. The munitions are shaped, so the blast goes into the target instead of the room, and instead of your hull." + desc = "A two-tube rocket pod that rides folded along the forearm." icon = 'voidcrew/modules/cyberware/icons/cyberware_weapons.dmi' icon_state = "bunker_buster" inhand_icon_state = "bunker_buster" @@ -797,7 +869,7 @@ */ /obj/item/organ/cyberimp/arm/toolkit/cyberware/bunker_buster name = "\improper Bunker Buster housing" - desc = "A reinforced forearm bay built around two rocket tubes, with a recoil bed where your radius used to be. Takes proprietary 30mm shaped rockets, so make both count." + desc = "A reinforced forearm bay built around two rocket tubes, with a recoil bed where your radius used to be." icon_state = "bunker_buster" chrome_load = 5 tier = CYBERWARE_TIER_3 diff --git a/voidcrew/modules/cyberware/ware_military_body.dm b/voidcrew/modules/cyberware/ware_military_body.dm index 6bd4b6d118f..a5cf534aba9 100644 --- a/voidcrew/modules/cyberware/ware_military_body.dm +++ b/voidcrew/modules/cyberware/ware_military_body.dm @@ -10,7 +10,7 @@ // GHOSTSKIN WEAVE // ========================================================================= -/// Cloak alpha. NEVER 0: a shimmer stays readable point-blank. +/// Cloak alpha. NEVER 0: a faint outline stays readable point-blank. #define CYBERWARE_GHOSTSKIN_ALPHA 40 /// How long a camo field holds before it collapses on its own. #define CYBERWARE_GHOSTSKIN_DURATION (10 SECONDS) @@ -19,17 +19,17 @@ * # Ghostskin Weave (T3, chest, skin slot, load 5) * * A dermal mesh of refraction cells: ten seconds of optical camo on a - * 30-second clock. Players see a heat-shimmer outline (alpha 40, never full - * invisibility) that ripples brighter when you move; NPC targeting honors + * 30-second clock. Players see a faint outline (alpha 40, never full + * invisibility) that flashes brighter when you move; NPC targeting honors * TRAIT_CYBER_CAMO through the hook in cyberware_stealth.dm, but anything * within two tiles spots you anyway. The field collapses the instant you - * attack, shoot, get struck, get cuffed, or eat an EMP, the break-trigger - * list is the MOD stealth module's, plus gunfire (nothing uncounterable + * attack, shoot, throw, get struck, get cuffed, or eat an EMP, the break-trigger + * list is the MOD stealth module's, plus gunfire and throws (nothing uncounterable * fires from inside a cloak on this server). */ /obj/item/organ/cyberimp/cyberware/ghostskin name = "\improper Ghostskin weave" - desc = "A subdermal lattice of refraction cells. Switched on, you're a faint heat-shimmer and not much else. Swing at anyone and the field drops, mid-swing, out in the open." + desc = "A subdermal lattice of refraction cells. Switched on, you flicker out until there's barely anything of you left to see." icon_state = "ghostskin" zone = BODY_ZONE_CHEST slot = ORGAN_SLOT_CYBERWARE_SKIN @@ -41,11 +41,28 @@ var/camo_active = FALSE /// Timer for the field's natural collapse. var/camo_timer + /// Alpha the bearer fades to while the field is up. Never 0. + var/field_alpha = CYBERWARE_GHOSTSKIN_ALPHA + /// How long the field holds before it collapses on its own. + var/field_duration = CYBERWARE_GHOSTSKIN_DURATION + /// Alpha the bearer flashes up to for a step when moving under the field. + /// Must stay above field_alpha, motion is meant to make you MORE visible. + var/ripple_alpha = 90 + /// Whether the field takes the bearer out of NPC targeting and scatters a + /// chrome read (TRAIT_CYBER_CAMO). Cheaper weaves only fool players. + var/hides_from_mobs = TRUE /obj/item/organ/cyberimp/cyberware/ghostskin/on_mob_remove(mob/living/carbon/organ_owner, special = FALSE, movement_flags) . = ..() break_camo(organ_owner, silent = TRUE) +/// The field runs on the weave: it collapses the moment the weave goes offline, +/// a brownout or damage, the same as an EMP drops it. +/obj/item/organ/cyberimp/cyberware/ghostskin/chrome_passives_off(mob/living/carbon/bearer) + . = ..() + if(camo_active) + break_camo(bearer, reason = "weave offline", silent = (owner != bearer)) + /obj/item/organ/cyberimp/cyberware/ghostskin/emp_act(severity) . = ..() if(. & EMP_PROTECT_SELF) @@ -53,22 +70,26 @@ if(camo_active) break_camo(owner, reason = "EMP discharge") -/// Raises the field: shimmer alpha, camo trait, break triggers, expiry clock. +/// Raises the field: field alpha, camo trait, break triggers, expiry clock. /obj/item/organ/cyberimp/cyberware/ghostskin/proc/engage_camo(mob/living/carbon/wearer) if(camo_active || !wearer) return camo_active = TRUE - ADD_TRAIT(wearer, TRAIT_CYBER_CAMO, REF(src)) - animate(wearer, alpha = CYBERWARE_GHOSTSKIN_ALPHA, time = 1 SECONDS) - playsound(wearer, 'voidcrew/sound/machines/cloaking/on.ogg', 60, TRUE) - wearer.visible_message( - span_warning("[wearer] ripples and thins to a heat-shimmer outline!"), - span_notice("The weave bends the light around you. Ten seconds."), - ) + if(hides_from_mobs) + ADD_TRAIT(wearer, TRAIT_CYBER_CAMO, REF(src)) + // Flickers down to field_alpha over 0.6 s (cyberware_anim.dm). The var holds field_alpha at once. + cloak_flicker_in(wearer) + engage_feedback(wearer) // The MOD stealth break list (modules_ninja.dm), minus bump-off, plus - // gunfire, shooting from inside a cloak breaks it here. - RegisterSignal(wearer, COMSIG_LIVING_UNARMED_ATTACK, PROC_REF(on_unarmed_attack)) + // gunfire and throwing: shooting or throwing from inside a cloak breaks it here. + // The early signal too: a fist that takes over the attack (Gorilla, Scrapper) cancels the + // chain before the late one is ever sent. + RegisterSignals(wearer, list(COMSIG_LIVING_EARLY_UNARMED_ATTACK, COMSIG_LIVING_UNARMED_ATTACK), PROC_REF(on_unarmed_attack)) RegisterSignal(wearer, COMSIG_ATOM_BULLET_ACT, PROC_REF(on_bullet_act)) + RegisterSignal(wearer, COMSIG_LIVING_ELECTROCUTE_ACT, PROC_REF(on_shocked)) + // Being mauled by an animal, a mob, a mech or a xeno is being hit too: the + // field is what keeps those mobs off you (cyberware_stealth.dm), so a bite at + // point-blank range has to drop it. RegisterSignals(wearer, list( COMSIG_MOB_ITEM_ATTACK, COMSIG_ATOM_ATTACKBY, @@ -76,19 +97,38 @@ COMSIG_ATOM_HITBY, COMSIG_ATOM_HULK_ATTACK, COMSIG_ATOM_ATTACK_PAW, + COMSIG_ATOM_ATTACK_ANIMAL, + COMSIG_ATOM_ATTACK_BASIC_MOB, + COMSIG_ATOM_ATTACK_MECH, + COMSIG_MOB_ATTACK_ALIEN, COMSIG_CARBON_CUFF_ATTEMPTED, COMSIG_MOB_FIRED_GUN, + COMSIG_MOB_THROW, COMSIG_LIVING_DEATH, ), PROC_REF(on_break_trigger)) RegisterSignal(wearer, COMSIG_MOVABLE_MOVED, PROC_REF(on_camo_move)) - camo_timer = addtimer(CALLBACK(src, PROC_REF(on_field_expired)), CYBERWARE_GHOSTSKIN_DURATION, TIMER_STOPPABLE) + camo_timer = addtimer(CALLBACK(src, PROC_REF(on_field_expired)), field_duration, TIMER_STOPPABLE) + +/// The sound and chat lines that go with the field coming up. Split out so a +/// cheaper weave can tell it differently. +/obj/item/organ/cyberimp/cyberware/ghostskin/proc/engage_feedback(mob/living/carbon/wearer) + playsound(wearer, 'voidcrew/sound/machines/cloaking/on.ogg', 60, TRUE) + wearer.visible_message( + span_warning("[wearer] flickers and fades almost out of sight!"), + span_notice("The weave bends the light around you."), + ) /obj/item/organ/cyberimp/cyberware/ghostskin/proc/on_field_expired() camo_timer = null - break_camo(owner, reason = "field capacity spent") + break_camo(owner, reason = "field capacity spent", gentle = TRUE) -/// Collapses the field and returns the bearer to full visibility. -/obj/item/organ/cyberimp/cyberware/ghostskin/proc/break_camo(mob/living/carbon/wearer, reason, silent = FALSE) +/** + * Collapses the field and returns the bearer to full visibility. A [gentle] + * drop (the field ran out or was switched off) flickers back out; anything + * that knocks it down stutters back with sparks; a [silent] one just snaps + * back. + */ +/obj/item/organ/cyberimp/cyberware/ghostskin/proc/break_camo(mob/living/carbon/wearer, reason, silent = FALSE, gentle = FALSE) if(!camo_active) return camo_active = FALSE @@ -99,6 +139,7 @@ return REMOVE_TRAIT(wearer, TRAIT_CYBER_CAMO, REF(src)) UnregisterSignal(wearer, list( + COMSIG_LIVING_EARLY_UNARMED_ATTACK, COMSIG_LIVING_UNARMED_ATTACK, COMSIG_ATOM_BULLET_ACT, COMSIG_MOB_ITEM_ATTACK, @@ -107,16 +148,28 @@ COMSIG_ATOM_HITBY, COMSIG_ATOM_HULK_ATTACK, COMSIG_ATOM_ATTACK_PAW, + COMSIG_ATOM_ATTACK_ANIMAL, + COMSIG_ATOM_ATTACK_BASIC_MOB, + COMSIG_ATOM_ATTACK_MECH, + COMSIG_MOB_ATTACK_ALIEN, + COMSIG_LIVING_ELECTROCUTE_ACT, COMSIG_CARBON_CUFF_ATTEMPTED, COMSIG_MOB_FIRED_GUN, + COMSIG_MOB_THROW, COMSIG_LIVING_DEATH, COMSIG_MOVABLE_MOVED, )) - animate(wearer, alpha = 255, time = 0.5 SECONDS) - if(!silent) + // The way back to full view is the exit's own (cyberware_anim.dm). + if(silent) + cloak_reset(wearer) + else if(gentle) + cloak_flicker_out(wearer) + else + cloak_flicker_break(wearer) do_sparks(2, TRUE, wearer) + if(!silent) wearer.visible_message( - span_danger("[wearer] shimmers back into full view!"), + span_danger("[wearer] flickers back into full view!"), span_warning("The weave collapses[reason ? ", [reason]" : ""]. You are visible."), ) @@ -133,6 +186,15 @@ return break_camo(owner, reason = "field contact") +/// Signal proc for [COMSIG_LIVING_ELECTROCUTE_ACT]: a real jolt (a live door) +/// drops the field. Hallucinated shocks and +/// ones the gloves fully insulate don't. +/obj/item/organ/cyberimp/cyberware/ghostskin/proc/on_shocked(datum/source, shock_damage, shock_source, siemens_coeff, flags) + SIGNAL_HANDLER + if((flags & SHOCK_ILLUSION) || shock_damage <= 0 || siemens_coeff <= 0) + return + break_camo(owner, reason = "field shorted") + /// Signal proc for [COMSIG_ATOM_BULLET_ACT]: hostile rounds pop the field. /obj/item/organ/cyberimp/cyberware/ghostskin/proc/on_bullet_act(datum/source, obj/projectile/projectile) SIGNAL_HANDLER @@ -140,19 +202,22 @@ return break_camo(owner, reason = "field disrupted") -/// Signal proc for [COMSIG_MOVABLE_MOVED]: the moving-shimmer ripple. +/// Signal proc for [COMSIG_MOVABLE_MOVED]: the moving flash. /// Motion makes you briefly MORE visible. Free counterplay for sharp eyes. /obj/item/organ/cyberimp/cyberware/ghostskin/proc/on_camo_move(datum/source) SIGNAL_HANDLER var/mob/living/wearer = owner if(!wearer || !camo_active) return - animate(wearer, alpha = 90, time = 0.15 SECONDS) - animate(alpha = CYBERWARE_GHOSTSKIN_ALPHA, time = 0.35 SECONDS) + // Still flickering in; the bearer is more visible than this already. + if(world.time < cloak_enter_until) + return + animate(wearer, alpha = ripple_alpha, time = 0.15 SECONDS) + animate(alpha = field_alpha, time = 0.35 SECONDS) /datum/action/cooldown/cyberware/ghostskin_cloak name = "Ghostskin Field" - desc = "Ten seconds of optical camo. Attacking, shooting, taking a hit or an EMP drops the field. Anyone standing right next to you still sees you." + desc = "Ten seconds of optical camo." button_icon = 'voidcrew/modules/cyberware/icons/cyberware.dmi' button_icon_state = "act_ghostskin" cooldown_time = 30 SECONDS @@ -164,7 +229,7 @@ return FALSE if(weave.camo_active) // Manual early collapse; the cooldown was already paid. - weave.break_camo(owner, reason = "disengaged") + weave.break_camo(owner, reason = "disengaged", gentle = TRUE) return TRUE StartCooldown() weave.engage_camo(owner) @@ -199,7 +264,7 @@ */ /obj/item/organ/cyberimp/cyberware/slabskin name = "\improper Slabskin plate" - desc = "Sintered ceramic scales grown into the skin in overlapping courses. Bullets leave scuffs and a noise like a dropped pan, and not a great deal else." + desc = "A keel and rib plates of sintered ceramic, grown into the skin of the chest and back. Bullets leave scuffs and a noise like a dropped pan." icon_state = "slabskin" zone = BODY_ZONE_CHEST slot = ORGAN_SLOT_CYBERWARE_DERMAL @@ -207,6 +272,7 @@ chrome_load = 6 tier = CYBERWARE_TIER_3 aug_overlay = "slabskin" + worn_under_clothes = TRUE /// TRUE while the plate armor is mixed into the bearer's physiology. /// Guards the failing-gated passive hooks against double add/subtract. var/plate_armor_applied = FALSE @@ -285,7 +351,7 @@ */ /obj/item/organ/cyberimp/cyberware/lazarus name = "\improper Lazarus node" - desc = "A capacitor bank sunk fist-deep in the chest, wired straight across the heart. When you go down it spends a second charging up, then shocks you back onto your feet. Rebuilding that charge takes a lot longer." + desc = "A capacitor bank sunk fist-deep in the chest, wired straight across the heart. It has strong views on you staying down." icon_state = "lazarus" zone = BODY_ZONE_CHEST slot = ORGAN_SLOT_HEART_AID @@ -304,7 +370,7 @@ if(COOLDOWN_FINISHED(src, jolt_cooldown)) . += span_notice("The charge bank reads READY.") else - . += span_notice("The charge bank reads RECHARGING, [DisplayTimeText(COOLDOWN_TIMELEFT(src, jolt_cooldown))] left.") + . += span_notice("The charge bank reads RECHARGING.") /obj/item/organ/cyberimp/cyberware/lazarus/on_mob_insert(mob/living/carbon/organ_owner, special = FALSE, movement_flags) . = ..() @@ -320,6 +386,7 @@ . = ..() jolting = FALSE jolt_generation++ + clear_charge_fx() /** * Signal proc for [COMSIG_MOB_STATCHANGE]: fires the windup on the @@ -328,6 +395,8 @@ */ /obj/item/organ/cyberimp/cyberware/lazarus/proc/on_stat_change(mob/living/carbon/source, new_stat, old_stat) SIGNAL_HANDLER + if(new_stat == DEAD) + clear_charge_fx() if(jolting) return var/datum/component/cyberware/chrome = GetComponent(/datum/component/cyberware) @@ -348,6 +417,8 @@ playsound(source, 'sound/machines/defib/defib_charge.ogg', 75, TRUE) source.set_jitter_if_lower(4 SECONDS) source.do_jitter_animation(200) + // Magenta charge and arcs crawling over the body (cyberware_anim2.dm). + play_charge_fx(source, CYBERWARE_LAZARUS_WINDUP) addtimer(CALLBACK(src, PROC_REF(jolt), jolt_generation, WEAKREF(source)), CYBERWARE_LAZARUS_WINDUP) /// The discharge: heal to 30%, clear the floor out from under every stun, @@ -357,6 +428,8 @@ if(!jolting || windup_generation != jolt_generation) return jolting = FALSE + // The windup is over whether or not the jolt fires: a patient who got up on their own keeps no glow. + clear_charge_fx() var/mob/living/carbon/patient = intended_patient?.resolve() if(QDELETED(src) || QDELETED(patient) || patient != owner) return @@ -390,6 +463,7 @@ patient.set_resting(FALSE, silent = TRUE, instant = TRUE) playsound(patient, 'sound/machines/defib/defib_zap.ogg', 100, TRUE) do_sparks(3, TRUE, patient) + play_jolt_fx(patient) patient.emote("gasp") patient.set_jitter_if_lower(20 SECONDS) patient.visible_message( @@ -402,11 +476,8 @@ // ATLAS FRAME // ========================================================================= -/// Held by a bearer whose skeleton simply does not break. Blocks the whole -/// bone wound series, dislocations, hairline fractures, compound fractures, -/// at the wound system's own gate, and nothing else. Every other wound series -/// lands on its bearer exactly as it lands on anyone. -#define TRAIT_CYBERWARE_UNBREAKABLE_BONES "cyberware_unbreakable_bones" +// TRAIT_CYBERWARE_UNBREAKABLE_BONES lives in voidcrew/_DEFINES/cyberware.dm +// so the street frame (ware_models_b.dm) can name it too. /** * # Atlas Frame (T3, chest, frame slot, load 4) @@ -423,7 +494,7 @@ */ /obj/item/organ/cyberimp/cyberware/atlas name = "\improper Atlas frame" - desc = "A titanium truss bolted through the spine and ribs. Nothing breaks your bones and nothing takes a limb off you. Everything softer than bone is still your problem, and anything you throw leaves your hand like it was fired." + desc = "A titanium truss bolted through the spine and ribs, so the skeleton stops being the weak point." icon_state = "atlas" zone = BODY_ZONE_CHEST slot = ORGAN_SLOT_CYBERWARE_FRAME @@ -431,15 +502,27 @@ chrome_load = 4 tier = CYBERWARE_TIER_3 organ_traits = list(TRAIT_NODISMEMBER, TRAIT_CYBERWARE_UNBREAKABLE_BONES) + /// Tiles added to the range of anything the bearer throws. With no speed + /// bonus either, the throw hook is never armed. + var/throw_range_bonus = 2 + /// Speed added to anything the bearer throws. + var/throw_speed_bonus = 1 + /// Whether a throw of the bearer by something else travels half as far. + var/resists_knockback = TRUE + /// The line examine adds on top of the organ's own. Null for none. + var/frame_examine = null /obj/item/organ/cyberimp/cyberware/atlas/examine(mob/user) . = ..() - . += span_notice("Covers the skeleton only: no dislocations, no fractures, and no losing a limb. Slashes, punctures, burns and bleeding are untouched.") + if(frame_examine) + . += span_notice(frame_examine) /obj/item/organ/cyberimp/cyberware/atlas/on_mob_insert(mob/living/carbon/organ_owner, special = FALSE, movement_flags) . = ..() - RegisterSignal(organ_owner, COMSIG_MOB_THROW, PROC_REF(on_owner_throws)) - RegisterSignal(organ_owner, COMSIG_MOVABLE_PRE_THROW, PROC_REF(on_owner_thrown)) + if(throw_range_bonus || throw_speed_bonus) + RegisterSignal(organ_owner, COMSIG_MOB_THROW, PROC_REF(on_owner_throws)) + if(resists_knockback) + RegisterSignal(organ_owner, COMSIG_MOVABLE_PRE_THROW, PROC_REF(on_owner_thrown)) /obj/item/organ/cyberimp/cyberware/atlas/on_mob_remove(mob/living/carbon/organ_owner, special = FALSE, movement_flags) . = ..() @@ -472,8 +555,8 @@ SIGNAL_HANDLER if(throw_args[4] != owner) // someone else's throw, somehow return - throw_args[2] += 2 // range - throw_args[3] += 1 // speed + throw_args[2] += throw_range_bonus // range + throw_args[3] += throw_speed_bonus // speed /obj/item/organ/cyberimp/cyberware/atlas/proc/clear_throw_hooks(list/candidates) for(var/atom/movable/candidate as anything in candidates) @@ -565,7 +648,7 @@ */ /obj/item/organ/cyberimp/cyberware/rigger name = "\improper Rigger socket" - desc = "A skull jack that patches a ship's helm straight into your head. Anywhere aboard, you can fly it, as long as the ship still has a helm console for the socket to talk to, and as long as you don't mind walking while you do it." + desc = "A skull jack that patches a ship's helm straight into your head." icon_state = "rigger" zone = BODY_ZONE_HEAD slot = ORGAN_SLOT_CYBERWARE_RIGGER @@ -580,7 +663,6 @@ /obj/item/organ/cyberimp/cyberware/rigger/examine(mob/user) . = ..() - . += span_notice("Opens the helm of whatever ship its bearer stands on, from anywhere on it. It borrows a real console. A hull with no helm left has nothing to answer with.") if(!owner) return if(!linked_ship) @@ -727,12 +809,12 @@ return FALSE if(!linked_ship) pilot.balloon_alert(pilot, "no hull to reach") - to_chat(pilot, span_warning("The socket casts around for a hull and finds solid ground. You have to be aboard a ship.")) + to_chat(pilot, span_warning("The socket casts around for a hull and finds solid ground.")) return FALSE var/obj/machinery/computer/helm/console = find_console() if(!console) pilot.balloon_alert(pilot, "no helm answering!") - to_chat(pilot, span_warning("Nothing aboard [linked_ship] answers the uplink. The socket borrows a helm console, and there isn't a working one left on the ship.")) + to_chat(pilot, span_warning("Nothing aboard [linked_ship] answers the uplink.")) return FALSE if(!console.check_crew_access(pilot)) return FALSE @@ -743,7 +825,7 @@ cyberware_ink_pulse(pilot, CYBERWARE_INK_HARD) pilot.visible_message( span_notice("The jack behind [pilot]'s ear lights up, and [pilot.p_their()] eyes go somewhere else."), - span_notice("The uplink catches [console] aboard [linked_ship]. You are flying the ship from here, at a walk."), + span_notice("The uplink catches [console] aboard [linked_ship]. You are flying the ship from here."), ) console.ui_interact(pilot) return TRUE @@ -778,7 +860,7 @@ /datum/action/cooldown/cyberware/rigger_uplink name = "Helm Uplink" - desc = "Open the ship's helm from wherever you're standing. You move at a walk while it's up, and it drops if you leave the hull, black out, or lose the socket." + desc = "Open the ship's helm from wherever you're standing. You walk slowly while it's up." button_icon = 'voidcrew/modules/cyberware/icons/cyberware.dmi' button_icon_state = "rigger" cooldown_time = 5 SECONDS @@ -847,5 +929,4 @@ #undef CYBERWARE_LAZARUS_COOLDOWN #undef CYBERWARE_LAZARUS_WINDUP #undef CYBERWARE_LAZARUS_HEAL_TO -#undef TRAIT_CYBERWARE_UNBREAKABLE_BONES #undef CYBERWARE_RIGGER_SLOWDOWN diff --git a/voidcrew/modules/cyberware/ware_models_b.dm b/voidcrew/modules/cyberware/ware_models_b.dm new file mode 100644 index 00000000000..9db419c8cba --- /dev/null +++ b/voidcrew/modules/cyberware/ware_models_b.dm @@ -0,0 +1,314 @@ +/** + * # Street and service models, set B + * + * Cheaper and sideways models of the plating, frame, seal, nervous and ear + * wares. Every one is a subtype of the ware it undercuts and sits in the same + * slot, so fitting one evicts the other. The parents keep their numbers; the + * models only set the vars the parents expose. + * + * model parent slot load tier sold for + * Hardweave plating Dermal Mesh dermal 3 T2 3,000 cr (yellow) + * Strut frame Atlas Frame frame 2 T2 1,500 cr (yellow) + * Deep-lung bladder Second Wind seal 2 T2 1,800 cr + * Heat-sink lining Coolant Loops seal 1 T1 1,500 cr + * Frostline lining (new) seal 1 T1 1,500 cr + * Twitchwire Slipwire nervous 2 T1 1,800 cr (yellow) + * Weaver shunt Slipwire nervous 5 T3 3 vouchers (advanced) + * Thumper ear Heartbeat Dop. ears 1 T1 1,500 cr (yellow) + * + * The seal slot now holds five choices (Second Wind, Deep-lung, Heat-sink, + * Frostline, Coolant). It stays a single slot, so none of them combine: an + * air bladder and a cold lining never share a body. + * + * Dodge goes through the shared arbiter (ware_pro_combat.dm), which rolls the + * single highest live source, so the Twitchwire and the Weaver shunt can never + * stack with a Cascade window or each other. + * + * Splice's shelf, the street doc's shelf (ripperdoc_catalog.dm, + * street_doc_catalog.dm) and the zone loot tables list the SKUs, ledger + * entries and organs below. + */ + +// ========================================================================= +// HARDWEAVE PLATING (T2): the middle of the dermal ladder +// ========================================================================= + +/// Between the Mesh and the Slabskin Plate: more of the same, none of the +/// plate's bomb, fire and acid cover. +/datum/armor/cyberware_hardweave + melee = 20 + bullet = 20 + laser = 15 + energy = 10 + wound = 10 + +/obj/item/organ/cyberimp/cyberware/dermal_mesh/hardweave + name = "\improper Hardweave plating" + desc = "Rib plates over the chest and back with a layered polymer weave sewn in below them, a size up from the usual mesh. The scarring is the part nobody mentions." + icon_state = "dermal_mesh_hardweave" + aug_overlay = "dermal_mesh_hardweave" + chrome_load = 3 + tier = CYBERWARE_TIER_2 + mesh_armor = /datum/armor/cyberware_hardweave + +// ========================================================================= +// STRUT FRAME (T2): the bones and nothing else +// ========================================================================= + +/obj/item/organ/cyberimp/cyberware/atlas/street + name = "\improper Strut frame" + desc = "Steel struts bolted along the long bones. It holds you together and has no opinion about the rest." + icon_state = "atlas_street" + chrome_load = 2 + tier = CYBERWARE_TIER_2 + // Bones only: limbs can still come off, throws are plain, and a shove + // carries you as far as it carries anyone. + organ_traits = list(TRAIT_CYBERWARE_UNBREAKABLE_BONES) + throw_range_bonus = 0 + throw_speed_bonus = 0 + resists_knockback = FALSE + frame_examine = null + +// ========================================================================= +// DEEP-LUNG BLADDER (T2): a longer breath +// ========================================================================= + +/obj/item/organ/cyberimp/cyberware/second_wind/deep + name = "\improper Deep-lung bladder" + desc = "An oversized air bladder packed in around the ribs, for people who spend their shifts on the wrong side of an airlock." + icon_state = "second_wind_deep" + chrome_load = 2 + tier = CYBERWARE_TIER_2 + reserve = 360 SECONDS + max_reserve = 360 SECONDS + refill_rate = 24 SECONDS + +// ========================================================================= +// HEAT-SINK LINING (T1): the heat half of Coolant Loops +// ========================================================================= + +/obj/item/organ/cyberimp/cyberware/coolant/street + name = "\improper Heat-sink lining" + desc = "A lining of finned aluminium stitched in under the ribs, so the heat has somewhere to go. It ticks as it cools." + icon_state = "coolant_street" + chrome_load = 1 + tier = CYBERWARE_TIER_1 + // Heat exposure and the fire scrub stay; burns land at full strength. + burn_mult = 1 + +// ========================================================================= +// FROSTLINE LINING (T1): the cold twin +// ========================================================================= + +/** + * # Frostline lining (T1, chest, seal slot, load 1) + * + * The mirror of the Coolant Loops' heat immunity: the cold stops hurting and + * nothing else changes. It does not breathe for you, so vacuum still kills + * through low pressure, and as the seal slot is single it never sits beside + * an air bladder. + */ +/obj/item/organ/cyberimp/cyberware/frostline + name = "\improper Frostline lining" + desc = "A quilted heating lining stitched in under the ribs, for work on planets that never get warm." + icon_state = "frostline" + zone = BODY_ZONE_CHEST + slot = ORGAN_SLOT_CYBERWARE_SEAL + w_class = WEIGHT_CLASS_SMALL + chrome_load = 1 + tier = CYBERWARE_TIER_1 + organ_traits = list(TRAIT_RESISTCOLD) + +// ========================================================================= +// TWITCHWIRE (T1) and WEAVER SHUNT (T3): the rungs around the Slipwire +// ========================================================================= + +/// The Twitchwire's dodge: a flinch more than a sidestep. +/obj/item/organ/cyberimp/cyberware/slipwire/street + name = "\improper Twitchwire" + desc = "A cheap reflex splice into the spinal trunk. Your legs flinch a little before you tell them to." + icon_state = "slipwire_street" + chrome_load = 2 + tier = CYBERWARE_TIER_1 + dodge_chance = 8 + gait_modifier = null + +/obj/item/organ/cyberimp/cyberware/slipwire/milspec + name = "\improper Weaver shunt" + desc = "A military reflex shunt wired the length of the spine. It was built for people who get shot at for a living." + icon_state = "slipwire_milspec" + chrome_load = 5 + tier = CYBERWARE_TIER_3 + dodge_chance = 20 + gait_modifier = /datum/movespeed_modifier/cyberware_slipwire/weaver + +/datum/movespeed_modifier/cyberware_slipwire/weaver + multiplicative_slowdown = -0.15 + +// ========================================================================= +// THUMPER EAR (T1): short, loud sonar +// ========================================================================= + +/obj/item/organ/cyberimp/cyberware/doppler/street + name = "\improper Thumper ear" + desc = "A budget sonar transceiver socketed in behind the ear. It thumps like a bass drum from the inside." + icon_state = "doppler_street" + chrome_load = 1 + tier = CYBERWARE_TIER_1 + sonar_range = 5 + contact_fade = 3 SECONDS + ping_volume_bonus = 10 + +// ========================================================================= +// SPLICE SKUS: on the Chop Shop's sku_types, and the credit ones on the +// street doc's too. +// ========================================================================= + +/datum/shop_sku/ripperdoc/hardweave + zone_permission = ZONE_PERMISSION_YELLOW + category = "Street Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/dermal_mesh/hardweave + price_credits = 3000 + +/datum/shop_sku/ripperdoc/atlas_street + zone_permission = ZONE_PERMISSION_YELLOW + category = "Street Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/atlas/street + price_credits = 1500 + +/datum/shop_sku/ripperdoc/second_wind_deep + category = "Street Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/second_wind/deep + price_credits = 1800 + +/datum/shop_sku/ripperdoc/coolant_street + category = "Street Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/coolant/street + price_credits = 1500 + +/datum/shop_sku/ripperdoc/frostline + category = "Street Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/frostline + price_credits = 1500 + +/datum/shop_sku/ripperdoc/slipwire_street + zone_permission = ZONE_PERMISSION_YELLOW + category = "Street Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/slipwire/street + price_credits = 1800 + +/datum/shop_sku/ripperdoc/slipwire_milspec + zone_permission = ZONE_PERMISSION_ADVANCED + category = "Military Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/slipwire/milspec + price_vouchers = 3 + +/datum/shop_sku/ripperdoc/doppler_street + zone_permission = ZONE_PERMISSION_YELLOW + category = "Street Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/doppler/street + price_credits = 1500 + +// ========================================================================= +// TRADE-IN: half list, credits only, exact type. The Weaver shunt costs +// vouchers, which can't be refunded, so it has no entry. Each entry also has +// the street doc's own wording below. +// +// Names stay siblings of the parent entries (second_wind_deep, not +// second_wind/deep) so a model never inherits its parent's price. The +// parent's own entries (second_wind, dermal_mesh) still match these models +// through match_subtypes, at the parent's lower rate. +// ========================================================================= + +/datum/shop_buyback/ripperdoc/hardweave + name = "Hardweave Plating (pulled)" + desc = "Heavy weave, cut out. Splice recycles it toward the plate." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/dermal_mesh/hardweave + match_subtypes = FALSE + pay_credits = 1500 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/ripperdoc/atlas_street + name = "Strut Frame (pulled)" + desc = "A bolted-in bone frame, pulled. Splice strips it for the full truss." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/atlas/street + match_subtypes = FALSE + pay_credits = 750 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/ripperdoc/second_wind_deep + name = "Deep-Lung Bladder (pulled)" + desc = "A big air bladder, used. Splice patches and resells." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/second_wind/deep + match_subtypes = FALSE + pay_credits = 900 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/ripperdoc/coolant_street + name = "Heat-Sink Lining (pulled)" + desc = "A finned lining, pulled. Splice melts it down toward the full loop." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/coolant/street + match_subtypes = FALSE + pay_credits = 750 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/ripperdoc/frostline + name = "Frostline Lining (pulled)" + desc = "A quilted heater lining, pulled. Splice resells these to the ice crews." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/frostline + match_subtypes = FALSE + pay_credits = 750 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/ripperdoc/slipwire_street + name = "Twitchwire (pulled)" + desc = "A cheap reflex splice, pulled. Splice trades it up toward the real shunt." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/slipwire/street + match_subtypes = FALSE + pay_credits = 900 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/ripperdoc/doppler_street + name = "Thumper Ear (pulled)" + desc = "A loud little sonar, pulled. Splice takes it toward a quieter one." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/doppler/street + match_subtypes = FALSE + pay_credits = 750 + demand_min = 1 + demand_max = 2 + +// ---- Ratchet's wording ---------------------------------------------------- + +/datum/shop_buyback/ripperdoc/hardweave/street_doc + desc = "Used armour weave. Heavy." + +/datum/shop_buyback/ripperdoc/atlas_street/street_doc + desc = "A used bone frame. Still rattles." + +/datum/shop_buyback/ripperdoc/second_wind_deep/street_doc + desc = "A used big air bladder." + +/datum/shop_buyback/ripperdoc/coolant_street/street_doc + desc = "A used heat-sink lining. Still warm." + +/datum/shop_buyback/ripperdoc/frostline/street_doc + desc = "A used heater lining." + +/datum/shop_buyback/ripperdoc/slipwire_street/street_doc + desc = "A used reflex splice. Twitchy." + +/datum/shop_buyback/ripperdoc/doppler_street/street_doc + desc = "A used sonar ear. Loud." diff --git a/voidcrew/modules/cyberware/ware_pro_combat.dm b/voidcrew/modules/cyberware/ware_pro_combat.dm index 5fd06eb5f91..c03fdaa54ca 100644 --- a/voidcrew/modules/cyberware/ware_pro_combat.dm +++ b/voidcrew/modules/cyberware/ware_pro_combat.dm @@ -6,11 +6,14 @@ * * - /datum/component/cyberware_dodge: THE one projectile-dodge arbiter. * Slipwire registers a 15% source here, Cascade Lattice (ware_legend.dm) - * registers a 40% source during its window, and the component rolls the + * registers a 60% source during its window, and the component rolls the * single HIGHEST live source. Never additive: Slipwire + Cascade together - * is still 40%, not 49%. Any future dodge chrome must register a source + * is still 60%, not 75%. Any future dodge chrome must register a source * through cyberware_register_dodge_source() rather than hanging its own - * COMSIG_ATOM_PRE_BULLET_ACT handler. + * COMSIG_ATOM_PRE_BULLET_ACT handler. A source registered with melee = TRUE + * (the Cascade line's windows) also dodges blows, through tg's own + * check_block() via COMSIG_LIVING_CHECK_BLOCK, so a dodged blow is a real + * miss and never fake damage. * - cyberware_is_ally(): the crew filter for auto-targeting ware (Deadeye's * tag, Widowline's cleave). Allies are people who share a ship team with * you; NPC boarders standing on your deck are NOT allies, and rival players @@ -22,6 +25,8 @@ /// A dodge source only fires while its bearer moved within this window. #define CYBERWARE_DODGE_MOVE_WINDOW (1 SECONDS) +/// The shortest gap between two dodge lines from a bearer nobody is playing (an NPC under fire). +#define CYBERWARE_DODGE_LINE_GAP (1.5 SECONDS) /** * The one dodge roll for all cyberware. Lives on the mob; wares and status @@ -36,13 +41,22 @@ * fading decoy and a bullet-miss crack. Dodging reads to the shooter. * - COMPONENT_BULLET_PIERCED means the round keeps flying into whoever is * behind; accepted as flavor. + * - Melee sources dodge damaging blows (weapons, fists, claws and bites) + * whether moving or not, but never grabs, tackles or shoves (zero-damage + * attempts), and never once the bearer is pinned: lying down, stunned, + * cuffed, buckled, held in an aggressive grab or in a finisher's hold. + * A melee dodge blurs in place; it never steps the bearer out of reach. */ /datum/component/cyberware_dodge dupe_mode = COMPONENT_DUPE_UNIQUE /// key -> /datum/callback returning that source's live dodge chance. var/list/dodge_sources = list() + /// key -> /datum/callback for the sources that also dodge blows. Each is in dodge_sources too. + var/list/melee_sources = list() /// world.time of the bearer's last move. var/last_move_time = 0 + /// world.time a dodge was last announced: an NPC under fire says it at most once every CYBERWARE_DODGE_LINE_GAP, so chat isn't flooded + var/last_message_at = -INFINITY /datum/component/cyberware_dodge/Initialize() if(!isliving(parent)) @@ -51,12 +65,14 @@ /datum/component/cyberware_dodge/RegisterWithParent() RegisterSignal(parent, COMSIG_ATOM_PRE_BULLET_ACT, PROC_REF(on_pre_bullet_act)) RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved)) + RegisterSignal(parent, COMSIG_LIVING_CHECK_BLOCK, PROC_REF(on_check_block)) /datum/component/cyberware_dodge/UnregisterFromParent() - UnregisterSignal(parent, list(COMSIG_ATOM_PRE_BULLET_ACT, COMSIG_MOVABLE_MOVED)) + UnregisterSignal(parent, list(COMSIG_ATOM_PRE_BULLET_ACT, COMSIG_MOVABLE_MOVED, COMSIG_LIVING_CHECK_BLOCK)) /datum/component/cyberware_dodge/Destroy() dodge_sources = null + melee_sources = null return ..() /// Signal proc for [COMSIG_MOVABLE_MOVED]: timestamp the movement window. @@ -78,17 +94,75 @@ var/atom/shooter = hitting_projectile.firer if(shooter && shooter != source && get_dist(source, shooter) <= 1) return NONE - var/best_chance = 0 - for(var/key in dodge_sources) - var/datum/callback/chance_callback = dodge_sources[key] - var/chance = chance_callback?.Invoke() - if(isnum(chance)) - best_chance = max(best_chance, chance) + var/best_chance = best_chance(dodge_sources) if(best_chance <= 0 || !prob(best_chance)) return NONE INVOKE_ASYNC(src, PROC_REF(perform_sidestep), source, hitting_projectile) return COMPONENT_BULLET_PIERCED +/// The highest live chance among these sources. Never additive. +/datum/component/cyberware_dodge/proc/best_chance(list/sources) + . = 0 + for(var/key in sources) + var/datum/callback/chance_callback = sources[key] + var/chance = chance_callback?.Invoke() + if(isnum(chance)) + . = max(., chance) + +/// Signal proc for [COMSIG_LIVING_CHECK_BLOCK]: the melee dodge roll, from tg's own check_block(). +/datum/component/cyberware_dodge/proc/on_check_block(mob/living/source, atom/hit_by, damage, attack_text, attack_type, armour_penetration, damage_type) + SIGNAL_HANDLER + if(!length(melee_sources) || !cyberware_can_dodge_blow(source, hit_by, damage, attack_text, attack_type)) + return FAILED_BLOCK + var/best_chance = best_chance(melee_sources) + if(best_chance <= 0 || !prob(best_chance)) + return FAILED_BLOCK + INVOKE_ASYNC(src, PROC_REF(perform_blow_dodge), source, attack_text) + return SUCCESSFUL_BLOCK + +/// The visible half of a dodged blow: the same blur decoy, a whiff, and a line. No step. +/datum/component/cyberware_dodge/proc/perform_blow_dodge(mob/living/source, attack_text) + if(QDELETED(source)) + return + new /obj/effect/temp_visual/decoy/fading/halfsecond(source.loc, source) + playsound(source, 'sound/items/weapons/punchmiss.ogg', 50, TRUE) + if(source.client || world.time - last_message_at >= CYBERWARE_DODGE_LINE_GAP) + last_message_at = world.time + source.visible_message( + span_danger("[source] blurs out of the way of [attack_text]!"), + span_danger("You blur out of the way of [attack_text]!"), + ) + +/** + * Whether the bearer can dodge this blow at all. Only damaging melee and + * unarmed blows from someone else; never while the bearer is down, stunned, + * cuffed, buckled, held tight, or in a finisher's hold, so grabs, finishers, + * the garrote and executions are never dodged once they have started. + */ +/proc/cyberware_can_dodge_blow(mob/living/bearer, atom/hit_by, damage, attack_text, attack_type) + if(attack_type != MELEE_ATTACK && attack_type != UNARMED_ATTACK) + return FALSE + if(!isnum(damage) || damage <= 0) + // tg checks a person's bare hands before it knows what they do, with no damage and the + // attacker's name as the text. Only a hand thrown in combat mode counts; a grab + // ("[name]'s grab"), a tackle and a friendly touch never do. + if(!isliving(hit_by)) + return FALSE + var/mob/living/attacker = hit_by + if(!attacker.combat_mode || attack_text != attacker.name) + return FALSE + if(hit_by == bearer || (isitem(hit_by) && hit_by.loc == bearer)) + return FALSE + if(bearer.stat != CONSCIOUS || bearer.body_position == LYING_DOWN || bearer.buckled) + return FALSE + if(HAS_TRAIT(bearer, TRAIT_INCAPACITATED) || HAS_TRAIT(bearer, TRAIT_FLOORED) || HAS_TRAIT(bearer, TRAIT_RESTRAINED) || HAS_TRAIT(bearer, TRAIT_IMMOBILIZED)) + return FALSE + if(bearer.pulledby && bearer.pulledby.grab_state >= GRAB_AGGRESSIVE) + return FALSE + if(bearer.has_status_effect(/datum/status_effect/hv_finisher_hold)) + return FALSE + return TRUE + /// The visible half of a successful dodge: blur decoy, bullet-miss crack, /// and a one-tile sidestep perpendicular to the shot when the floor allows. /datum/component/cyberware_dodge/proc/perform_sidestep(mob/living/source, obj/projectile/dodged) @@ -96,10 +170,12 @@ return new /obj/effect/temp_visual/decoy/fading/halfsecond(source.loc, source) playsound(source, SFX_BULLET_MISS, 60, TRUE) - source.visible_message( - span_danger("[source] blurs sideways out of [dodged]'s path!"), - span_danger("You blur out of [dodged]'s path!"), - ) + if(source.client || world.time - last_message_at >= CYBERWARE_DODGE_LINE_GAP) + last_message_at = world.time + source.visible_message( + span_danger("[source] blurs sideways out of [dodged]'s path!"), + span_danger("You blur out of [dodged]'s path!"), + ) var/incoming_dir = QDELETED(dodged) ? source.dir : dodged.dir var/list/side_dirs = shuffle(list(turn(incoming_dir, 90), turn(incoming_dir, -90))) for(var/step_dir in side_dirs) @@ -111,12 +187,17 @@ * arbiter component on first use. The callback is polled per incoming * projectile and must return the source's CURRENT chance, return 0 while * disabled (ORGAN_FAILING etc.) rather than unregistering per-flicker. + * With melee = TRUE the same chance also dodges blows (see on_check_block()). */ -/proc/cyberware_register_dodge_source(mob/living/bearer, key, datum/callback/chance_callback) +/proc/cyberware_register_dodge_source(mob/living/bearer, key, datum/callback/chance_callback, melee = FALSE) if(!istype(bearer) || !key || !chance_callback) return var/datum/component/cyberware_dodge/arbiter = bearer.LoadComponent(/datum/component/cyberware_dodge) arbiter.dodge_sources[key] = chance_callback + if(melee) + arbiter.melee_sources[key] = chance_callback + else + arbiter.melee_sources -= key /// Removes a keyed dodge source; the arbiter cleans itself up with the last one. /proc/cyberware_unregister_dodge_source(mob/living/bearer, key) @@ -124,6 +205,7 @@ if(!arbiter) return arbiter.dodge_sources -= key + arbiter.melee_sources -= key if(!length(arbiter.dodge_sources)) qdel(arbiter) @@ -158,6 +240,9 @@ return TRUE if(!istype(user) || !istype(target)) return FALSE + // A bounty criminal's own companions and creatures (voidcrew/modules/bounties) + if(bounty_ai_same_gang(user, target)) + return TRUE var/datum/team/user_team = cyberware_crew_team(user) if(!user_team) return FALSE @@ -189,7 +274,7 @@ */ /obj/item/organ/eyes/robotic/cyberware/deadeye name = "\improper Deadeye link" - desc = "Milspec optics built around a target-processing coprocessor. Paint someone and the link walks your next few rounds onto them, whatever the barrel was actually pointed at." + desc = "Military optics built around a targeting coprocessor. It decides where your rounds go, and you aren't consulted." icon_state = "deadeye" chrome_load = 3 tier = CYBERWARE_TIER_2 @@ -197,6 +282,12 @@ /datum/action/cooldown/cyberware/deadeye_tag, /datum/action/cooldown/cyberware/chrome_read, ) + /// How far a tag can be planted, and how far homing keeps correcting. + var/tag_range = CYBERWARE_DEADEYE_TAG_RANGE + /// Homing shots granted per tag. + var/tag_shots = CYBERWARE_DEADEYE_TAG_SHOTS + /// How long a tag lasts, spent or not. + var/tag_duration = CYBERWARE_DEADEYE_TAG_DURATION /// Weakref to the currently tagged target. var/datum/weakref/tagged_ref /// Homing shots remaining on the current tag. @@ -217,14 +308,14 @@ /obj/item/organ/eyes/robotic/cyberware/deadeye/proc/start_tag(mob/living/target) end_tag(owner) tagged_ref = WEAKREF(target) - shots_left = CYBERWARE_DEADEYE_TAG_SHOTS + shots_left = tag_shots RegisterSignal(owner, COMSIG_PROJECTILE_FIRER_BEFORE_FIRE, PROC_REF(on_owner_fired)) target.add_filter(CYBERWARE_DEADEYE_MARK_FILTER, 2, list("type" = "outline", "color" = "#ff3300", "size" = 1)) new /obj/effect/temp_visual/smartgun_target(get_turf(target)) playsound(owner, 'sound/machines/synth/synth_yes.ogg', 30, TRUE) owner.balloon_alert(owner, "target tagged") to_chat(target, span_userdanger("A red targeting glint settles on you!")) - tag_timer = addtimer(CALLBACK(src, PROC_REF(on_tag_expired)), CYBERWARE_DEADEYE_TAG_DURATION, TIMER_STOPPABLE) + tag_timer = addtimer(CALLBACK(src, PROC_REF(on_tag_expired)), tag_duration, TIMER_STOPPABLE) /obj/item/organ/eyes/robotic/cyberware/deadeye/proc/on_tag_expired() tag_timer = null @@ -255,7 +346,7 @@ if(!istype(projectile)) return var/mob/living/target = tagged_ref?.resolve() - if(QDELETED(target) || target.stat == DEAD || target.z != user.z || get_dist(user, target) > CYBERWARE_DEADEYE_TAG_RANGE) + if(QDELETED(target) || target.stat == DEAD || target.z != user.z || get_dist(user, target) > tag_range) end_tag(user) return projectile.set_homing_target(target) @@ -267,7 +358,7 @@ /datum/action/cooldown/cyberware/deadeye_tag name = "Deadeye Tag" - desc = "Tag a hostile in view. Your next three shots track them automatically. The tag refuses to take a crewmate." + desc = "Tag a hostile in view. Your next three shots track them." button_icon = 'icons/mob/actions/actions_items.dmi' button_icon_state = "sniper_zoom" cooldown_time = 25 SECONDS @@ -287,7 +378,7 @@ if(cyberware_is_ally(owner, victim)) owner.balloon_alert(owner, "friendly, tag refused!") return FALSE - if(!can_see(owner, victim, CYBERWARE_DEADEYE_TAG_RANGE)) + if(!can_see(owner, victim, optics.tag_range)) owner.balloon_alert(owner, "no line of sight!") return FALSE StartCooldown() @@ -309,17 +400,22 @@ * sidestep (never point-blank, never while browned out) plus a small * always-on gait boost. The dodge itself lives in the shared arbiter above; * this organ just contributes a source whose chance drops to zero the moment - * the ware is EMP-scrambled or browned out. + * the ware is EMP-scrambled or browned out. The chance and the gait boost are + * vars, so the street and service models (ware_models_b.dm) retune them. */ /obj/item/organ/cyberimp/cyberware/slipwire name = "\improper Slipwire reflex shunt" - desc = "A reflex arc spliced in parallel with the spinal trunk. While you're moving it sidesteps incoming fire on its own, roughly one shot in seven misses because your body moved before you told it to." + desc = "A reflex arc spliced in parallel with the spinal trunk. Your body gets out of the way before you've decided to." icon_state = "slipwire" zone = BODY_ZONE_CHEST slot = ORGAN_SLOT_CYBERWARE_NERVOUS w_class = WEIGHT_CLASS_SMALL chrome_load = 4 tier = CYBERWARE_TIER_2 + /// Percent of hostile projectiles dodged while the bearer is moving. + var/dodge_chance = CYBERWARE_SLIPWIRE_DODGE_CHANCE + /// The gait boost the ware adds while it runs. Null for none. + var/datum/movespeed_modifier/gait_modifier = /datum/movespeed_modifier/cyberware_slipwire /obj/item/organ/cyberimp/cyberware/slipwire/on_mob_insert(mob/living/carbon/organ_owner, special = FALSE, movement_flags) . = ..() @@ -335,17 +431,19 @@ // add/remove is idempotent and needs no applied-state guard. /obj/item/organ/cyberimp/cyberware/slipwire/chrome_passives_on(mob/living/carbon/bearer) . = ..() - bearer?.add_movespeed_modifier(/datum/movespeed_modifier/cyberware_slipwire) + if(gait_modifier) + bearer?.add_movespeed_modifier(gait_modifier) /obj/item/organ/cyberimp/cyberware/slipwire/chrome_passives_off(mob/living/carbon/bearer) . = ..() - bearer?.remove_movespeed_modifier(/datum/movespeed_modifier/cyberware_slipwire) + if(gait_modifier) + bearer?.remove_movespeed_modifier(gait_modifier) /// Dodge-source callback: dead weight while failing, 15% otherwise. /obj/item/organ/cyberimp/cyberware/slipwire/proc/get_dodge_chance() if(organ_flags & ORGAN_FAILING) return 0 - return CYBERWARE_SLIPWIRE_DODGE_CHANCE + return dodge_chance /datum/movespeed_modifier/cyberware_slipwire multiplicative_slowdown = -0.1 @@ -391,7 +489,7 @@ */ /obj/item/organ/cyberimp/cyberware/dead_channel name = "\improper Dead Channel pain editor" - desc = "A signal processor clamped over the pain nerves. You stop feeling injuries entirely, which keeps you upright and moving where anyone else would fold. The catch is that you can't tell how bad it's gotten. The colour draining out of the world is the only gauge you get." + desc = "A signal processor clamped over the pain nerves. Nothing hurts. That isn't the same as nothing being wrong." icon_state = "dead_channel" zone = BODY_ZONE_CHEST slot = ORGAN_SLOT_CYBERWARE_NERVOUS @@ -608,7 +706,7 @@ */ /obj/item/organ/cyberimp/cyberware/hopper name = "\improper Hopper piston calves" - desc = "Paired myomer pistons sleeved over both calves. Four tiles of flat jump on demand, over railings, tables and whoever's in the way. Flat is the operative word: they will not put you over a wall." + desc = "Paired myomer pistons sleeved over both calves, for clearing railings, tables and whoever's in the way." icon_state = "hopper" zone = BODY_ZONE_L_LEG slot = ORGAN_SLOT_CYBERWARE_LEGS @@ -622,14 +720,34 @@ tier = CYBERWARE_TIER_2 aug_overlay = "hopper" actions_types = list(/datum/action/cooldown/cyberware/hopper_leap) + // The models in the line (ware_line_models_a.dm) retune these by setting vars. + /// Leap distance in tiles. + var/leap_range = CYBERWARE_HOPPER_RANGE + /// Gap between leaps. The button reads it when it is built. + var/leap_cooldown = 8 SECONDS + /// Tooltip for the button when this model's numbers differ from the button's + /// own text. Null keeps the button's own. + var/leap_action_desc /datum/action/cooldown/cyberware/hopper_leap name = "Piston Leap" - desc = "Leap up to four tiles over gaps, tables and people, onto any open floor you can see with a clear lane to it. Walls, windows and shut doors stop the jump." + desc = "Leap up to four tiles over gaps, tables and people." button_icon = 'voidcrew/modules/cyberware/icons/cyberware.dmi' button_icon_state = "act_hopper" cooldown_time = 8 SECONDS click_to_activate = TRUE + // A stunned, paralysed or bound body does not get to leap out of it. + check_flags = AB_CHECK_CONSCIOUS | AB_CHECK_INCAPACITATED | AB_CHECK_IMMOBILE + +/datum/action/cooldown/cyberware/hopper_leap/New(Target, original = TRUE) + . = ..() + // The pistons this button belongs to set its cooldown and tooltip. + var/obj/item/organ/cyberimp/cyberware/hopper/pistons = organ + if(!istype(pistons)) + return + cooldown_time = pistons.leap_cooldown + if(pistons.leap_action_desc) + desc = pistons.leap_action_desc /datum/action/cooldown/cyberware/hopper_leap/Activate(atom/target) if(!isliving(owner)) @@ -642,10 +760,12 @@ if(jumper.buckled || !isturf(jumper.loc)) jumper.balloon_alert(jumper, "can't jump from here!") return FALSE - if(get_dist(here, destination) > CYBERWARE_HOPPER_RANGE) + var/obj/item/organ/cyberimp/cyberware/hopper/pistons = organ + var/leap_range = istype(pistons) ? pistons.leap_range : CYBERWARE_HOPPER_RANGE + if(get_dist(here, destination) > leap_range) jumper.balloon_alert(jumper, "too far!") return FALSE - if(!can_see(jumper, destination, CYBERWARE_HOPPER_RANGE)) + if(!can_see(jumper, destination, leap_range)) jumper.balloon_alert(jumper, "no line of sight!") return FALSE if(destination.is_blocked_turf() || islava(destination) || ischasm(destination)) @@ -656,12 +776,13 @@ return FALSE StartCooldown() playsound(here, 'sound/items/weapons/punchmiss.ogg', 40, TRUE, -1) - new /obj/effect/temp_visual/decoy/fading/halfsecond(here, jumper) + var/obj/effect/temp_visual/decoy/fading/halfsecond/afterimage = new(here, jumper) jumper.visible_message( span_warning("[jumper]'s legs fire like pistons and [jumper.p_they()] vault[jumper.p_s()] into the air!"), span_notice("You fire the pistons and leap."), ) - animate(jumper, pixel_z = 20, time = CYBERWARE_HOPPER_AIRTIME, flags = ANIMATION_RELATIVE, easing = QUAD_EASING|EASE_OUT) + // A crouch, dust, and an arc over to the landing; the body stays on its tile until it lands (cyberware_anim2.dm). + cyberware_leap_takeoff_fx(jumper, here, destination, CYBERWARE_HOPPER_AIRTIME, 20, 26, afterimage) addtimer(CALLBACK(src, PROC_REF(land), destination), CYBERWARE_HOPPER_AIRTIME) return TRUE @@ -671,7 +792,7 @@ var/mob/living/jumper = owner if(QDELETED(jumper)) return - animate(jumper, pixel_z = -20, time = 0.1 SECONDS, flags = ANIMATION_RELATIVE) + cyberware_leap_touchdown_fx(jumper) var/turf/final = destination if(QDELETED(final) || final.is_blocked_turf()) final = null @@ -683,10 +804,11 @@ jumper.balloon_alert(jumper, "landing fouled!") return jumper.forceMove(final) - new /obj/effect/temp_visual/mook_dust(final) + cyberware_grey_dust(final) playsound(final, 'sound/effects/gravhit.ogg', 50, TRUE) #undef CYBERWARE_DODGE_MOVE_WINDOW +#undef CYBERWARE_DODGE_LINE_GAP #undef CYBERWARE_DEADEYE_TAG_RANGE #undef CYBERWARE_DEADEYE_TAG_SHOTS #undef CYBERWARE_DEADEYE_TAG_DURATION diff --git a/voidcrew/modules/cyberware/ware_pro_utility.dm b/voidcrew/modules/cyberware/ware_pro_utility.dm index 1c560463f0e..94e8d298d53 100644 --- a/voidcrew/modules/cyberware/ware_pro_utility.dm +++ b/voidcrew/modules/cyberware/ware_pro_utility.dm @@ -189,7 +189,7 @@ */ /obj/item/organ/cyberimp/arm/toolkit/cyberware/icepick name = "\improper Icepick Jack" - desc = "A slim data spike folded into the wrist, tipped in monocrystal. Turret IFF buses and door motor controllers all run the same handful of protocols, and the spike knows every one of them. Outpost security hardware is the one exception; nobody has cracked that firmware." + desc = "A slim data spike folded into the wrist, tipped in monocrystal. Turrets and door motors both talk to it a little too easily." icon_state = "icepick" chrome_load = 3 tier = CYBERWARE_TIER_2 @@ -229,7 +229,7 @@ /datum/action/cooldown/cyberware/icepick/suppress name = "Icepick: Suppress" - desc = "Spike a hostile turret in line of sight to knock it offline for a while, or slowly force open a bolted or unpowered door you're standing at." + desc = "Spike a hostile turret in sight to knock it offline, or force open a bolted or unpowered door." // Both channels are on the same spike, so both need their own face on the // HUD: two identical buttons is a misclick waiting to happen. button_icon_state = "act_icepick_suppress" @@ -346,7 +346,7 @@ */ /obj/item/organ/cyberimp/arm/toolkit/cyberware/skyhook name = "\improper Skyhook wrist winch" - desc = "A barbed anchor over a spooled monofilament winch, built through the wrist bones. Fire it into anything solid within seven tiles and hold on." + desc = "A barbed anchor over a spooled monofilament winch, built through the wrist bones. It goes into anything solid and reels you in after it." icon_state = "skyhook" chrome_load = 3 tier = CYBERWARE_TIER_2 @@ -359,6 +359,8 @@ button_icon_state = "skyhook" cooldown_time = 8 SECONDS click_to_activate = TRUE + // A stunned, paralysed or bound body, or one with its hands tied, does not winch itself out. + check_flags = AB_CHECK_CONSCIOUS | AB_CHECK_INCAPACITATED | AB_CHECK_IMMOBILE | AB_CHECK_HANDS_BLOCKED /// The zipline visual for the current pull. var/datum/beam/zipline /// Traits worn for the duration of the pull, per the grapple gun. @@ -431,7 +433,7 @@ */ /obj/item/organ/eyes/robotic/cyberware/prospector name = "\improper Prospector Suite optics" - desc = "Amber-ringed surveyor eyes. Blink the command and they thump out a resonance pulse: ore veins light up straight through the rock, and any cache transponders in range echo back with them. The handheld scanner needs line of sight. These don't." + desc = "Amber-ringed surveyor eyes that can see ore through solid rock. The pulse that does it makes your skull hum." icon_state = "prospector" eye_color_left = "#b8860b" eye_color_right = "#b8860b" @@ -442,6 +444,10 @@ /datum/action/cooldown/cyberware/prospector_pulse, /datum/action/cooldown/cyberware/chrome_read, ) + /// How far the resonance pulse reaches, through rock, in tiles. + var/pulse_range = CYBERWARE_PROSPECTOR_RANGE + /// Whether the pulse also flags zone loot caches. + var/pulse_marks_caches = TRUE /// Cache marks the last pulse raised, so pulling the optics takes them out /// with it instead of leaving blips on a client that no longer owns them. var/list/hud_marks = list() @@ -472,10 +478,14 @@ var/mob/living/carbon/bearer = organ.owner var/obj/item/organ/eyes/robotic/cyberware/prospector/optics = organ var/list/marks = istype(optics) ? optics.hud_marks : null - mineral_scan_pulse(get_turf(bearer), CYBERWARE_PROSPECTOR_RANGE, scanner = bearer) + var/pulse_range = istype(optics) ? optics.pulse_range : CYBERWARE_PROSPECTOR_RANGE + mineral_scan_pulse(get_turf(bearer), pulse_range, scanner = bearer) playsound(bearer, 'sound/machines/sonar-ping.ogg', 25, TRUE) + if(istype(optics) && !optics.pulse_marks_caches) + StartCooldown() + return TRUE var/caches = 0 - for(var/obj/structure/closet/crate/zone_loot/cache in range(CYBERWARE_PROSPECTOR_RANGE, bearer)) + for(var/obj/structure/closet/crate/zone_loot/cache in range(pulse_range, bearer)) // Marks go up through the rock the same way the ore reveal does, a // cache you can already see was never the thing worth pinging for. cyberware_hud_mark(bearer, cache, "#ffb347", 6 SECONDS, registry = marks) @@ -498,7 +508,7 @@ */ /obj/item/organ/cyberimp/cyberware/hemoglass name = "\improper Hemoglass filter" - desc = "A dialysis loop in borosilicate, teed into the vena cava. It strips poisons, chems and radiation out of your blood a little faster than most things can put them in. Party mode tells it to leave the recreational chems alone." + desc = "A dialysis loop in borosilicate, teed into the vena cava. It cleans your blood faster than most things can foul it. There's a switch for evenings when you'd rather it didn't." icon_state = "hemoglass" zone = BODY_ZONE_CHEST slot = ORGAN_SLOT_CYBERWARE_FILTER @@ -513,7 +523,7 @@ /obj/item/organ/cyberimp/cyberware/hemoglass/ui_action_click() party_mode = !party_mode - owner.balloon_alert(owner, party_mode ? "party mode, recreational channels open" : "filter scrubbing everything") + owner.balloon_alert(owner, party_mode ? "party mode" : "scrubbing everything") /obj/item/organ/cyberimp/cyberware/hemoglass/on_life(seconds_per_tick, times_fired) . = ..() @@ -542,13 +552,17 @@ * * Circulating coolant woven through the torso: heat exposure damage is * trait-gated off, burns hit at half strength, and open flame on you gets - * starved down fast. Deliberately NOT fireproof, enough flamer fuel still - * wins, which keeps the buyable MOD flamethrower an honest counter. Sits + * starved down fast. In practice that makes a human bearer fireproof: fire + * stacks only hurt a human through body heat (fire_stacks.dm harm_human()), + * and TRAIT_RESISTHEAT gates that damage off (_species.dm), so a burning + * bearer loses clothes, not skin. The cheap Heat-sink lining + * (ware_models_b.dm) carries the same trait. Burn damage dealt outright + * (a laser, say) still lands, halved here. Sits * on the seal ladder above Second Wind: pick your climate. */ /obj/item/organ/cyberimp/cyberware/coolant name = "\improper Coolant Loop lattice" - desc = "Kilometres of microbore coolant line threaded between muscle and skin: a full climate system for your body. You can work in lava country and walk out of fires that would cook anyone else. It eats a lot of chrome load to run." + desc = "Kilometres of microbore coolant line threaded between muscle and skin, which makes you a climate system with a pulse." icon_state = "coolant" zone = BODY_ZONE_CHEST slot = ORGAN_SLOT_CYBERWARE_SEAL @@ -556,6 +570,9 @@ chrome_load = 3 tier = CYBERWARE_TIER_2 organ_traits = list(TRAIT_RESISTHEAT) + /// Multiplier on the bearer's burn damage while running. 1 leaves burns alone + /// and applies no physiology mod at all. + var/burn_mult = 0.5 /// TRUE while the burn-halving physiology mod is applied. Guards the /// failing-gated passive hooks against double multiply/divide. var/coolant_mod_applied = FALSE @@ -567,11 +584,11 @@ // Physiology persists across species changes (physiology.dm:1). /obj/item/organ/cyberimp/cyberware/coolant/chrome_passives_on(mob/living/carbon/bearer) . = ..() - if(coolant_mod_applied || !ishuman(bearer)) + if(coolant_mod_applied || !ishuman(bearer) || burn_mult == 1) return coolant_mod_applied = TRUE var/mob/living/carbon/human/human_bearer = bearer - human_bearer.physiology.burn_mod *= 0.5 + human_bearer.physiology.burn_mod *= burn_mult /obj/item/organ/cyberimp/cyberware/coolant/chrome_passives_off(mob/living/carbon/bearer) . = ..() @@ -581,7 +598,7 @@ if(!ishuman(bearer) || QDELETED(bearer)) return var/mob/living/carbon/human/human_bearer = bearer - human_bearer.physiology.burn_mod /= 0.5 + human_bearer.physiology.burn_mod /= burn_mult /obj/item/organ/cyberimp/cyberware/coolant/on_life(seconds_per_tick, times_fired) . = ..() @@ -615,7 +632,7 @@ */ /obj/item/organ/cyberimp/cyberware/doppler name = "\improper Heartbeat Doppler" - desc = "A sonar transceiver socketed into the bone behind your ear. Anything alive and moving within nine tiles shows up through walls; anything holding still doesn't register at all. The ping is quiet, but it's out loud, so you're not the only one who knows it's running." + desc = "A sonar transceiver socketed into the bone behind your ear. It paints whatever is moving nearby, walls or no walls, and the ping is louder than the brochure said." icon_state = "doppler" zone = BODY_ZONE_HEAD slot = ORGAN_SLOT_CYBERWARE_EARS @@ -625,6 +642,12 @@ actions_types = list(/datum/action/item_action/organ_action/toggle) /// Whether the sonar is running. var/active = FALSE + /// How far the sonar reaches, in tiles. + var/sonar_range = CYBERWARE_DOPPLER_RANGE + /// How long a contact stays painted after its last step. + var/contact_fade = CYBERWARE_DOPPLER_FADE + /// Added to the ping's volume, on top of the distance falloff. + var/ping_volume_bonus = 0 /// Living things in range we hold movement and death hooks on. Assoc for /// the O(1) membership test; the values are dummies. var/list/watched = list() @@ -694,7 +717,7 @@ return next_sweep = world.time + CYBERWARE_DOPPLER_SWEEP var/list/in_range = list() - for(var/mob/living/contact in range(CYBERWARE_DOPPLER_RANGE, owner)) + for(var/mob/living/contact in range(sonar_range, owner)) if(contact == owner || contact.stat == DEAD) continue in_range[contact] = TRUE @@ -742,14 +765,14 @@ /obj/item/organ/cyberimp/cyberware/doppler/proc/paint_contact(mob/living/contact) if(!active || (organ_flags & ORGAN_FAILING) || QDELETED(owner) || QDELETED(contact)) return - if(contact.stat == DEAD || get_dist(owner, contact) > CYBERWARE_DOPPLER_RANGE || contact.z != owner.z) + if(contact.stat == DEAD || get_dist(owner, contact) > sonar_range || contact.z != owner.z) unwatch_contact(contact) return var/datum/cyberware_hud_mark/blip = contacts[contact] if(blip) - blip.refresh(CYBERWARE_DOPPLER_FADE) + blip.refresh(contact_fade) return - cyberware_hud_mark(owner, contact, "#9fd8ff", CYBERWARE_DOPPLER_FADE, "sonar_ping_small", contacts, contact) + cyberware_hud_mark(owner, contact, "#9fd8ff", contact_fade, "sonar_ping_small", contacts, contact) /// Signal proc for [COMSIG_MOVABLE_MOVED] on the bearer: the set of things /// close enough to hook changed. The blips re-aim themselves. @@ -792,7 +815,7 @@ if(nearest_mover == INFINITY) return // Louder as they close; audible around you either way. That's the deal. - var/ping_volume = clamp(45 - nearest_mover * 3, 15, 45) + var/ping_volume = clamp(45 - nearest_mover * 3, 15, 45) + ping_volume_bonus playsound(owner, 'sound/machines/sonar-ping.ogg', ping_volume, TRUE) if(nearest_mover <= 3) // close contact: the beep doubles up addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(playsound), owner, 'sound/machines/sonar-ping.ogg', ping_volume, TRUE), 0.4 SECONDS) @@ -812,7 +835,7 @@ */ /obj/item/organ/cyberimp/arm/toolkit/cyberware/graverobber name = "\improper Graverobber's Jack" - desc = "An arm-mounted data spike that reads intel out of dead bodies. Spend three seconds on an adjacent corpse and nearby loot caches and hostile patrols get marked on your HUD." + desc = "An arm-mounted data spike for going through the implants of the recently dead." icon_state = "graverobber" chrome_load = 2 tier = CYBERWARE_TIER_2 @@ -821,12 +844,6 @@ /// with it instead of leaving blips on a client that no longer owns them. var/list/hud_marks = list() -/obj/item/organ/cyberimp/arm/toolkit/cyberware/graverobber/examine(mob/user) - . = ..() - . += span_notice("Once installed, use the Data-Spike the Dead ability on a dead body next to you. The read takes 3 seconds. It marks loot caches within [CYBERWARE_GRAVEROBBER_SWEEP_RANGE] tiles in amber and hostile patrols in red on your HUD for a few seconds.") - . += span_notice("Occasionally a read recovers a vault phrase, marking caches within [CYBERWARE_GRAVEROBBER_DEEP_SWEEP_RANGE] tiles instead.") - . += span_notice("Each body can only be read once, and the spike takes 20 seconds to recharge between reads.") - /obj/item/organ/cyberimp/arm/toolkit/cyberware/graverobber/on_mob_remove(mob/living/carbon/arm_owner, special = FALSE, movement_flags) clear_marks() return ..() @@ -912,7 +929,7 @@ */ /obj/item/organ/cyberimp/arm/toolkit/cyberware/angler name = "\improper Harpoon Spool" - desc = "A forearm winch spooled with monofilament under a barbed head. Fired, it drags loose gear and small creatures to you from six tiles out, anything heavier drags you instead." + desc = "A forearm winch spooled with monofilament under a barbed head. It reels in whatever it hits, or you toward it, depending on who's heavier." icon_state = "angler" chrome_load = 2 tier = CYBERWARE_TIER_2 @@ -920,7 +937,7 @@ /datum/action/cooldown/cyberware/harpoon name = "Harpoon Barb" - desc = "Fire the barb up to six tiles: loose items and small creatures come to you. Anything heavier drags you a tile toward it instead." + desc = "Fire the barb up to six tiles. Loose items and small creatures come to you; anything heavier pulls you toward it." button_icon = 'voidcrew/modules/cyberware/icons/cyberware.dmi' button_icon_state = "angler" cooldown_time = 8 SECONDS @@ -928,7 +945,8 @@ /datum/action/cooldown/cyberware/harpoon/Activate(atom/target) var/mob/living/carbon/bearer = organ.owner - if(isturf(target) || QDELETED(target)) + // Clicking yourself fires the barb at nothing: a line from the bearer to the bearer. + if(isturf(target) || QDELETED(target) || target == bearer) bearer.balloon_alert(bearer, "barb skitters off!") return FALSE if(get_dist(bearer, target) > CYBERWARE_ANGLER_RANGE || !(target in view(CYBERWARE_ANGLER_RANGE, bearer))) diff --git a/voidcrew/modules/cyberware/ware_second_wind.dm b/voidcrew/modules/cyberware/ware_second_wind.dm index 6330c5ecf31..75a98197b43 100644 --- a/voidcrew/modules/cyberware/ware_second_wind.dm +++ b/voidcrew/modules/cyberware/ware_second_wind.dm @@ -41,15 +41,21 @@ /obj/item/organ/cyberimp/cyberware/second_wind name = "\improper Second Wind bladder" - desc = "A vacuum-cured polymer bladder plumbed around the lungs. When the air runs out it kicks in with a hiss and gives you about three minutes to do something about it, then refills off every breath you take normally. You'll know when it's running: the mask-breathing is loud and the indicator is hard to miss." + desc = "A vacuum-cured polymer bladder plumbed around the lungs. When the air runs out it takes over with a hiss." icon_state = "second_wind" zone = BODY_ZONE_CHEST slot = ORGAN_SLOT_CYBERWARE_SEAL w_class = WEIGHT_CLASS_SMALL chrome_load = 1 tier = CYBERWARE_TIER_1 - /// Breathable reserve remaining, in deciseconds of breathing covered. + /// Breathable reserve remaining, in deciseconds of breathing covered. A + /// model with a bigger bladder sets this to its max_reserve too, a var + /// initialiser can't read another var. var/reserve = CYBERWARE_SECOND_WIND_RESERVE + /// The most reserve the bladder holds. + var/max_reserve = CYBERWARE_SECOND_WIND_RESERVE + /// Reserve regained per normal breath in breathable air. + var/refill_rate = CYBERWARE_SECOND_WIND_REFILL /// TRUE while feeding the owner from reserve, for the engage/disengage beats. var/engaged = FALSE /// Whether the low-reserve warning has already fired this engagement, so @@ -65,7 +71,7 @@ /obj/item/organ/cyberimp/cyberware/second_wind/examine(mob/user) . = ..() var/seconds_left = round(reserve / (1 SECONDS)) - . += span_notice("The reserve gauge reads [seconds_left] seconds of air[reserve < CYBERWARE_SECOND_WIND_RESERVE ? ", refilling while its bearer breathes normally" : " (full)"].") + . += span_notice("The reserve gauge reads [seconds_left] seconds of air.") /obj/item/organ/cyberimp/cyberware/second_wind/on_mob_insert(mob/living/carbon/organ_owner, special = FALSE, movement_flags) . = ..() @@ -116,15 +122,15 @@ if(environment_is_breathable(source)) if(engaged) set_engaged(source, FALSE) - if(reserve < CYBERWARE_SECOND_WIND_RESERVE) - reserve = min(reserve + CYBERWARE_SECOND_WIND_REFILL, CYBERWARE_SECOND_WIND_RESERVE) + if(reserve < max_reserve) + reserve = min(reserve + refill_rate, max_reserve) low_warned = FALSE return NONE if(reserve <= 0) if(engaged) set_engaged(source, FALSE) source.balloon_alert(source, "air reserve empty!") - to_chat(source, span_userdanger("Your Second Wind bladder collapses empty. You are breathing vacuum.")) + to_chat(source, span_userdanger("Your [format_text(name)] collapses empty. You are breathing vacuum.")) playsound(source, 'sound/machines/buzz/buzz-sigh.ogg', 40, TRUE) return NONE if(!engaged) @@ -133,7 +139,7 @@ update_alert(source) if(!low_warned && reserve <= CYBERWARE_SECOND_WIND_LOW) low_warned = TRUE - to_chat(source, span_warning("Your bladder gauge drops into the red, [round(reserve / (1 SECONDS))] seconds of air left.")) + to_chat(source, span_warning("Your bladder gauge drops into the red.")) playsound(source, 'sound/machines/buzz/buzz-two.ogg', 30, TRUE) // This IS a successful breath as far as the body is concerned. source.failed_last_breath = FALSE @@ -148,10 +154,10 @@ engaged = new_state if(engaged) INVOKE_ASYNC(source, TYPE_PROC_REF(/mob, emote), "gasp") - source.balloon_alert(source, "second wind engages") + source.balloon_alert(source, "[LOWER_TEXT(format_text(name))] engages") source.visible_message( span_notice("[source] takes a sharp breath, and something under [source.p_their()] ribs starts working."), - span_notice("SEAL ENGAGED. The bladder takes your breathing off you. You have [round(reserve / (1 SECONDS))] seconds of air."), + span_notice("SEAL ENGAGED. The bladder takes your breathing off you."), span_hear("You hear a pneumatic hiss and the rhythm of mask breathing."), vision_distance = COMBAT_MESSAGE_RANGE, ) @@ -160,7 +166,7 @@ breath_loop?.start(source) update_alert(source) return - source.balloon_alert(source, "second wind disengages") + source.balloon_alert(source, "[LOWER_TEXT(format_text(name))] disengages") to_chat(source, span_notice("SEAL RELEASED. You are breathing the room again.")) cyberware_ink_pulse(source, CYBERWARE_INK_SOFT) breath_loop?.stop() @@ -182,7 +188,9 @@ var/seconds_left = round(reserve / (1 SECONDS)) var/running_low = reserve <= CYBERWARE_SECOND_WIND_LOW indicator.color = running_low ? "#ffb347" : "#4dd8e6" - indicator.desc = "Your Second Wind bladder is doing your breathing for you. [seconds_left] second\s of reserve air left[running_low ? ". Find air." : "."]" + // Named for the bladder actually fitted, so a Deep-lung never reads as a Second Wind. + indicator.name = "[format_text(name)] engaged" + indicator.desc = "Your [format_text(name)] is doing your breathing for you. The gauge reads [seconds_left] second\s." /** * Whether the mob's surroundings hold enough oxygen to breathe unassisted: diff --git a/voidcrew/modules/cyberware/ware_street.dm b/voidcrew/modules/cyberware/ware_street.dm index 4ca0296974c..70d6d2a1751 100644 --- a/voidcrew/modules/cyberware/ware_street.dm +++ b/voidcrew/modules/cyberware/ware_street.dm @@ -68,7 +68,7 @@ GLOBAL_LIST_INIT(cyberware_ink_palette, list( */ /obj/item/organ/cyberimp/cyberware/chromatic_dermis name = "\improper Chromatic Dermis ink suite" - desc = "Programmable tattoo ink and the spider-legged injector that lays it under the skin. The traces light up whenever the rest of your chrome does something: a punch landing, a tool folding out, the air bladder kicking in. Colour and pattern are set at a Chrome Cradle." + desc = "Programmable tattoo ink and the spider-legged injector that lays it under the skin. The traces light up whenever the rest of your chrome gets to work." icon_state = "chromatic_dermis" zone = BODY_ZONE_CHEST slot = ORGAN_SLOT_CYBERWARE_INK @@ -276,7 +276,7 @@ GLOBAL_LIST_INIT(cyberware_ink_palette, list( */ /obj/item/organ/eyes/robotic/cyberware/nightshade name = "\improper Nightshade optics" - desc = "Matte black eyes that render a dark room in green. Living bodies in range pick up a soft glow only you can see, so an unlit corridor isn't cover any more. They aren't thermals, so a flashbang hits you no harder than it would normal eyes. The diagnostic bus is the stock one: it counts how much chrome someone is carrying, but can't name any of it." + desc = "Matte black eyes that render a dark room in green. Living bodies pick up a soft glow only you can see." icon_state = "nightshade" eye_color_left = "#1d3b2a" eye_color_right = "#1d3b2a" @@ -409,7 +409,7 @@ GLOBAL_LIST_INIT(cyberware_ink_palette, list( */ /obj/item/organ/cyberimp/cyberware/scrapper name = "\improper Scrapper's Knuckles" - desc = "Milled knuckle caps grafted along the metacarpals, right-arm fit. Your punches land harder, and against plating and machine housings they land about twice as hard again." + desc = "Milled knuckle caps grafted along the metacarpals, right-arm fit. Hinges and housings come off worse." icon_state = "scrapper" zone = BODY_ZONE_R_ARM slot = ORGAN_SLOT_RIGHT_ARM_AUG @@ -423,7 +423,7 @@ GLOBAL_LIST_INIT(cyberware_ink_palette, list( aug_overlay = "scrapper_right" /obj/item/organ/cyberimp/cyberware/scrapper/left - desc = "Milled knuckle caps grafted along the metacarpals, left-arm fit. Your punches land harder, and against plating and machine housings they land about twice as hard again." + desc = "Milled knuckle caps grafted along the metacarpals, left-arm fit. Hinges and housings come off worse." zone = BODY_ZONE_L_ARM slot = ORGAN_SLOT_LEFT_ARM_AUG aug_overlay = "scrapper_left" @@ -458,6 +458,9 @@ GLOBAL_LIST_INIT(cyberware_ink_palette, list( var/is_structure_target = ismachinery(target) || isstructure(target) if(!isliving(target) && !is_structure_target) return NONE + // A pacifist's punch at a living thing is the ordinary punch, which refuses it. + if(isliving(target) && HAS_TRAIT(source, TRAIT_PACIFISM)) + return NONE // Past the last "not our punch" guard: this swing is ours from here on, so // stand Redline's bypass top-up down before we take the chain away. The // roll below reads the hand's unarmed damage, which already carries the @@ -517,7 +520,7 @@ GLOBAL_LIST_INIT(cyberware_ink_palette, list( /obj/item/storage/case/cyberware/scrapper name = "\improper Scrapper's Knuckles case" - desc = "A foam-lined chrome case holding a matched pair of Scrapper's Knuckles, one per arm. Each side installs separately, though the rig will do both in one sitting." + desc = "A foam-lined chrome case holding a matched pair of Scrapper's Knuckles, one per arm." /obj/item/storage/case/cyberware/scrapper/PopulateContents() new /obj/item/organ/cyberimp/cyberware/scrapper(src) @@ -535,7 +538,7 @@ GLOBAL_LIST_INIT(cyberware_ink_palette, list( */ /obj/item/organ/cyberimp/cyberware/shock_coils name = "\improper Shock Coil calf pistons" - desc = "Spring-loaded pistons sistered along the calf bones. You get back on your feet much faster after a knockdown, keep your footing on wet decking, and walk away from drops that would break an ankle." + desc = "Spring-loaded pistons sistered along the calf bones, so the floor gets less say in things." icon_state = "shock_coils" zone = BODY_ZONE_L_LEG slot = ORGAN_SLOT_CYBERWARE_LEGS @@ -622,7 +625,7 @@ GLOBAL_LIST_INIT(cyberware_ink_palette, list( */ /obj/item/organ/cyberimp/cyberware/gastro name = "\improper Gastro Reactor" - desc = "A ceramic-lined digester where your stomach used to be. Rot, floor scrapings, whatever was in the back of the fridge. It all burns the same, faster than a real gut and without the food poisoning." + desc = "A ceramic-lined digester where your stomach used to be. Rot, floor scrapings, whatever was in the back of the fridge: it all burns the same." icon_state = "gastro" zone = BODY_ZONE_CHEST slot = ORGAN_SLOT_CYBERWARE_GUT @@ -668,7 +671,7 @@ GLOBAL_LIST_INIT(cyberware_ink_palette, list( */ /obj/item/organ/cyberimp/cyberware/cargo_cavity name = "\improper Cargo Cavity" - desc = "A shielded compartment plumbed into the ribcage, sized for one small item. Scanners read straight past it and a pat-down won't find it." + desc = "A shielded compartment plumbed into the ribcage, sized for one small item." icon_state = "cargo_cavity" zone = BODY_ZONE_CHEST slot = ORGAN_SLOT_CYBERWARE_STASH @@ -745,7 +748,7 @@ GLOBAL_LIST_INIT(cyberware_ink_palette, list( */ /obj/item/organ/cyberimp/cyberware/dermal_mesh name = "\improper Dermal Mesh weave" - desc = "A subdermal lattice of impact polymer. It won't stop anything serious, but knives and small arms hurt noticeably less and the skin over it doesn't tear so easily." + desc = "A subdermal lattice of impact polymer. It won't stop anything serious, but it takes the edge off." icon_state = "dermal_mesh" zone = BODY_ZONE_CHEST slot = ORGAN_SLOT_CYBERWARE_DERMAL @@ -753,6 +756,7 @@ GLOBAL_LIST_INIT(cyberware_ink_palette, list( chrome_load = 2 tier = CYBERWARE_TIER_1 aug_overlay = "dermal_mesh" + worn_under_clothes = TRUE /// Armor mixed into the bearer's physiology while installed and running. var/datum/armor/mesh_armor = /datum/armor/cyberware_dermal_mesh /// TRUE while mesh_armor is mixed in; guards against double add/subtract. @@ -807,7 +811,7 @@ GLOBAL_LIST_INIT(cyberware_ink_palette, list( */ /obj/item/organ/cyberimp/cyberware/gecko name = "\improper Gecko Grip palm pads" - desc = "Setae pads laminated into the palms, running the same trick geckos do. Your hands clamp shut on whatever you're holding when you go down, so nobody strips your gun off you, and you can cross tables like flat ground and catch a ledge on the way into a chasm. Cuffs still work fine." + desc = "Setae pads laminated into the palms, running the same trick geckos do. Whatever you're holding stays held." icon_state = "gecko" zone = BODY_ZONE_R_ARM slot = ORGAN_SLOT_CYBERWARE_HANDS @@ -832,19 +836,32 @@ GLOBAL_LIST_INIT(cyberware_ink_palette, list( RegisterSignal(organ_owner, COMSIG_MOB_EQUIPPED_ITEM, PROC_REF(on_item_equipped)) RegisterSignal(organ_owner, COMSIG_MOB_UNEQUIPPED_ITEM, PROC_REF(on_item_unequipped)) RegisterSignal(organ_owner, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved)) - passtable_on(organ_owner, REF(src)) // Whatever they were already holding when the pads went in. for(var/obj/item/held in organ_owner.held_items) guard_item(held) - if(catch_ready) - ADD_TRAIT(organ_owner, TRAIT_CHASM_STOPPER, REF(src)) /obj/item/organ/cyberimp/cyberware/gecko/on_mob_remove(mob/living/carbon/organ_owner, special = FALSE, movement_flags) . = ..() drop_guards() UnregisterSignal(organ_owner, list(COMSIG_MOB_EQUIPPED_ITEM, COMSIG_MOB_UNEQUIPPED_ITEM, COMSIG_MOVABLE_MOVED)) - passtable_off(organ_owner, REF(src)) - REMOVE_TRAIT(organ_owner, TRAIT_CHASM_STOPPER, REF(src)) + +// Tables as flat ground and the chasm catch ride the failing-gated passive layer: dark pads +// (EMP, brownout, damage) do neither. The catch used to stay armed through a pulse, and a +// bearer whose pads were dark could cross a chasm because the arming trait was never spent. +/obj/item/organ/cyberimp/cyberware/gecko/chrome_passives_on(mob/living/carbon/bearer) + . = ..() + if(isnull(bearer)) + return + passtable_on(bearer, REF(src)) + if(catch_ready) + ADD_TRAIT(bearer, TRAIT_CHASM_STOPPER, REF(src)) + +/obj/item/organ/cyberimp/cyberware/gecko/chrome_passives_off(mob/living/carbon/bearer) + . = ..() + if(isnull(bearer)) + return + passtable_off(bearer, REF(src)) + REMOVE_TRAIT(bearer, TRAIT_CHASM_STOPPER, REF(src)) /obj/item/organ/cyberimp/cyberware/gecko/Destroy() drop_guards() @@ -968,7 +985,9 @@ GLOBAL_LIST_INIT(cyberware_ink_palette, list( /obj/item/organ/cyberimp/cyberware/gecko/proc/rearm_catch() catch_ready = TRUE - if(owner) + // Dark pads re-arm too, the trait goes back on with the passive layer. + var/datum/component/cyberware/chrome = GetComponent(/datum/component/cyberware) + if(owner && chrome?.passives_online) ADD_TRAIT(owner, TRAIT_CHASM_STOPPER, REF(src)) owner.balloon_alert(owner, "grips re-set") diff --git a/voidcrew/modules/cyberware/ware_street_passives.dm b/voidcrew/modules/cyberware/ware_street_passives.dm new file mode 100644 index 00000000000..d5a50c516eb --- /dev/null +++ b/voidcrew/modules/cyberware/ware_street_passives.dm @@ -0,0 +1,454 @@ +/** + * # Street passives + * + * Six cheap pieces of chrome that do one quiet thing each and have no button: + * + * - Clotter node (heart aux, T1): bleed slower. + * - Adrenal pump (heart aux, T2): answers a bad run of stamina damage once + * in a while. Shares the heart aux slot with the Clotter node. + * - Medic's palms (hands, T1): nitrile-glove speed without the glove. + * - Cuffer's wrists (hands, T1): quicker cuffing. Sideways to the Medic's + * palms and the Gecko Grip, which sit in the same slot. + * - Subvocal mic (larynx, T1): radio talk goes no further than the speaker. + * - Muffler ear (ears, T1): earmuff-grade protection from a bang. Sideways to + * the Heartbeat Doppler, same slot. + * + * Every effect rides the failing-gated passive layer (chrome_passives_on/off in + * cyberware_base.dm), so an EMP, a brownout or a damage failure switches it off + * and a tune-up hands it back. All tuning is in vars on the organ. + * + * The Subvocal mic needs two small hooks in the speech path. Both are chained + * overrides at the bottom of this file, nothing upstream is edited. + * + * SKUs and trade-ins are defined at the bottom. + */ + +/// Held by a mob whose radio talk is not overheard. Granted by the Subvocal mic. +#define TRAIT_CYBER_SUBVOCAL "cyber_subvocal" +/// The red the Adrenal pump leaves on its bearer for the length of the rush. +#define CYBERWARE_ADRENAL_FLUSH "#ff8f8f" + +// ========================================================================= +// CLOTTER NODE +// ========================================================================= + +/** + * # Clotter node (T1, chest, heart aux slot, load 1) + * + * Halves the blood the bearer loses. The multiplier is mixed into the human + * physiology, which survives species changes, so there is one multiply and one + * divide per flip, and the factor actually applied is remembered so retuning the + * var on a live organ cannot desync the pair. Rides the failing-gated passive + * hooks like the Dermal Mesh does. + */ +/obj/item/organ/cyberimp/cyberware/clotter_node + name = "\improper Clotter node" + desc = "A reservoir of clotting gel plumbed into the heart. Cuts stop sooner than they should." + icon_state = "clotter_node" + zone = BODY_ZONE_CHEST + slot = ORGAN_SLOT_CYBERWARE_HEART_AUX + w_class = WEIGHT_CLASS_SMALL + chrome_load = 1 + tier = CYBERWARE_TIER_1 + /// Multiplier on the blood the bearer loses. + var/bleed_multiplier = 0.5 + /// The multiplier currently mixed into the bearer, or null when none is. + var/applied_bleed_multiplier + +/obj/item/organ/cyberimp/cyberware/clotter_node/chrome_passives_on(mob/living/carbon/bearer) + . = ..() + if(!isnull(applied_bleed_multiplier) || !ishuman(bearer)) + return + var/mob/living/carbon/human/human_bearer = bearer + applied_bleed_multiplier = bleed_multiplier + human_bearer.physiology.bleed_mod *= applied_bleed_multiplier + +/obj/item/organ/cyberimp/cyberware/clotter_node/chrome_passives_off(mob/living/carbon/bearer) + . = ..() + if(isnull(applied_bleed_multiplier)) + return + var/removed_multiplier = applied_bleed_multiplier + applied_bleed_multiplier = null // reset before the validity skip, see Shock Coils + if(!ishuman(bearer) || QDELETED(bearer)) + return + var/mob/living/carbon/human/human_bearer = bearer + human_bearer.physiology.bleed_mod /= removed_multiplier + +// ========================================================================= +// ADRENAL PUMP +// ========================================================================= + +/** + * # Adrenal pump (T2, chest, heart aux slot, load 2) + * + * When a run of stamina damage takes the bearer to the trigger level, the pump + * dumps a shot of adrenaline: part of the stamina loss comes off and the bearer + * is quicker on their feet for a few seconds. The tell is deliberate: a heartbeat + * thud anyone nearby can hear and a red flush on the bearer. + * + * The wait before it fires again is stored on the organ as the world.time it is + * ready at, so pulling the pump and refitting it never resets the wait. + * + * It answers damage from outside only. The crashes of the Cascade and Redline + * lines dump stamina as their own price, and a pump that took the sting out of + * that price would make the cheap heart ware a cure for the legend ware's bill, so + * the check runs one tick after the damage (the crash status is not on the bearer + * yet at the moment of the dump) and stands down while either crash is running. + */ +/obj/item/organ/cyberimp/cyberware/adrenal_pump + name = "\improper Adrenal pump" + desc = "A pump of synthetic adrenaline wired into the heart. The sort of thing a doctor tells you not to try at home." + icon_state = "adrenal_pump" + zone = BODY_ZONE_CHEST + slot = ORGAN_SLOT_CYBERWARE_HEART_AUX + w_class = WEIGHT_CLASS_SMALL + chrome_load = 2 + tier = CYBERWARE_TIER_2 + /// Stamina loss at or above which the pump fires. + var/trigger_stamina = 70 + /// Stamina loss taken off when it fires. + var/stamina_relief = 40 + /// How long the bearer is quicker for. + var/rush_duration = 3 SECONDS + /// How long the pump takes to charge again after firing. + var/recharge_time = 4 MINUTES + /// world.time at which the pump is ready to fire. Lives on the organ, so + /// removing and refitting it keeps the wait. + var/ready_at = 0 + /// TRUE while a firing check is queued, so one volley of damage queues one check. + var/discharge_queued = FALSE + +/obj/item/organ/cyberimp/cyberware/adrenal_pump/examine(mob/user) + . = ..() + . += span_notice("Its status light is [world.time < ready_at ? "amber" : "green"].") + +/obj/item/organ/cyberimp/cyberware/adrenal_pump/chrome_passives_on(mob/living/carbon/bearer) + . = ..() + if(isnull(bearer)) + return + RegisterSignal(bearer, COMSIG_LIVING_STAMINA_UPDATE, PROC_REF(on_stamina_update), override = TRUE) + +/obj/item/organ/cyberimp/cyberware/adrenal_pump/chrome_passives_off(mob/living/carbon/bearer) + . = ..() + discharge_queued = FALSE + if(isnull(bearer)) + return + UnregisterSignal(bearer, COMSIG_LIVING_STAMINA_UPDATE) + +/// Signal proc for [COMSIG_LIVING_STAMINA_UPDATE]: cheap tests only, the pump +/// itself fires from the queued check. +/obj/item/organ/cyberimp/cyberware/adrenal_pump/proc/on_stamina_update(mob/living/source) + SIGNAL_HANDLER + if(discharge_queued || source != owner || world.time < ready_at) + return + if(source.stat != CONSCIOUS || source.getStaminaLoss() < trigger_stamina) + return + discharge_queued = TRUE + addtimer(CALLBACK(src, PROC_REF(discharge)), 1) // next tick, see the header + +/// The queued check. Everything is tested again: the bearer may have recovered, +/// been knocked out, lost the chrome or be riding out a crash. +/obj/item/organ/cyberimp/cyberware/adrenal_pump/proc/discharge() + discharge_queued = FALSE + var/mob/living/carbon/bearer = owner + if(QDELETED(src) || QDELETED(bearer) || world.time < ready_at) + return + var/datum/component/cyberware/chrome = GetComponent(/datum/component/cyberware) + if(!chrome?.is_running()) + return + if(bearer.stat != CONSCIOUS || bearer.getStaminaLoss() < trigger_stamina) + return + if(bearer.has_status_effect(/datum/status_effect/cyberware_cascade_crash) || bearer.has_status_effect(/datum/status_effect/cyberware_redline_crash)) + return + // Spent first: the relief below re-enters the stamina signal. + ready_at = world.time + recharge_time + bearer.adjustStaminaLoss(-stamina_relief) + bearer.apply_status_effect(/datum/status_effect/cyberware_adrenal_rush, rush_duration) + playsound(bearer, 'sound/effects/singlebeat.ogg', 100, TRUE, 2) + bearer.visible_message( + span_warning("[bearer] flushes red, heart thudding loud enough to hear."), + span_userdanger("Your heart slams and the exhaustion drops away."), + ) + bearer.balloon_alert(bearer, "adrenaline!") + cyberware_ink_pulse(bearer, CYBERWARE_INK_HARD) + +/// The burst of speed, and the flush that shows it. +/datum/status_effect/cyberware_adrenal_rush + id = "cyberware_adrenal_rush" + duration = 3 SECONDS + tick_interval = STATUS_EFFECT_NO_TICK + alert_type = null + +/// Optional argument: how long the rush lasts, from the pump that fired it. +/datum/status_effect/cyberware_adrenal_rush/on_creation(mob/living/new_owner, rush_duration) + if(isnum(rush_duration)) + duration = rush_duration + return ..() + +/datum/status_effect/cyberware_adrenal_rush/on_apply() + owner.add_movespeed_modifier(/datum/movespeed_modifier/cyberware_adrenal_rush) + owner.add_atom_colour(CYBERWARE_ADRENAL_FLUSH, TEMPORARY_COLOUR_PRIORITY) + return TRUE + +/datum/status_effect/cyberware_adrenal_rush/on_remove() + owner.remove_movespeed_modifier(/datum/movespeed_modifier/cyberware_adrenal_rush) + owner.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, CYBERWARE_ADRENAL_FLUSH) + return ..() + +/datum/movespeed_modifier/cyberware_adrenal_rush + multiplicative_slowdown = -0.4 + +// ========================================================================= +// MEDIC'S PALMS +// ========================================================================= + +/** + * # Medic's palms (T1, arm, hands slot, load 1) + * + * The nitrile-glove pair of traits (quicker chemistry, quicker fireman carry) + * without taking up the glove slot. Same slot as the Gecko Grip and the Cuffer's + * wrists, so a body wears one of the three. + */ +/obj/item/organ/cyberimp/cyberware/medic_palms + name = "\improper Medic's palms" + desc = "Sterile palm plates with a better grip than any nitrile glove. Saves a trip to the glove dispenser." + icon_state = "medic_palms" + zone = BODY_ZONE_R_ARM + slot = ORGAN_SLOT_CYBERWARE_HANDS + w_class = WEIGHT_CLASS_SMALL + chrome_load = 1 + tier = CYBERWARE_TIER_1 + organ_traits = list(TRAIT_FASTMED, TRAIT_QUICKER_CARRY) + +// ========================================================================= +// CUFFER'S WRISTS +// ========================================================================= + +/** + * # Cuffer's wrists (T1, arm, hands slot, load 1) + * + * Cuffs go on in three quarters of the time (TRAIT_FAST_CUFFING, the same trait + * as combat gloves). For bounty hunters and anyone else who ties people up for a + * living. + */ +/obj/item/organ/cyberimp/cyberware/cuffer_wrists + name = "\improper Cuffer's wrists" + desc = "Reinforced wrist actuators with a lot of practice at closing around other people's wrists." + icon_state = "cuffer_wrists" + zone = BODY_ZONE_R_ARM + slot = ORGAN_SLOT_CYBERWARE_HANDS + w_class = WEIGHT_CLASS_SMALL + chrome_load = 1 + tier = CYBERWARE_TIER_1 + organ_traits = list(TRAIT_FAST_CUFFING) + +// ========================================================================= +// SUBVOCAL MIC +// ========================================================================= + +/** + * # Subvocal mic (T1, head, larynx slot, load 1) + * + * Radio talk is whispered at range 1 today, so the person next to you hears it. + * With the mic it goes no further than the speaker. The trait is the whole ware; + * the speech hooks at the bottom of this file read it. + */ +/obj/item/organ/cyberimp/cyberware/subvocal_mic + name = "\improper Subvocal mic" + desc = "A throat mic sutured to the vocal cords. Radio chatter goes out the wire instead of the room." + icon_state = "subvocal_mic" + zone = BODY_ZONE_HEAD + slot = ORGAN_SLOT_CYBERWARE_LARYNX + w_class = WEIGHT_CLASS_SMALL + chrome_load = 1 + tier = CYBERWARE_TIER_1 + organ_traits = list(TRAIT_CYBER_SUBVOCAL) + +/// TRUE between a radio line the Subvocal mic quieted and the send_speech() call +/// that carries it, which follows straight on with no wait in between. +/mob/living/var/cyberware_subvocal_pending = FALSE + +/** + * Chained override of the human radio branch (base definition: + * code/modules/mob/living/carbon/human/human_say.dm, which sets the whisper + * range when it returns REDUCE_RANGE). A bearer's radio line is marked here; + * the send_speech() override below spends the mark. A line the radio swallowed + * (NOPASS) never reaches send_speech and is not marked. + */ +/mob/living/carbon/human/radio(message, list/message_mods = list(), list/spans, language) + cyberware_subvocal_pending = FALSE + . = ..() + if((. & REDUCE_RANGE) && !(. & NOPASS) && HAS_TRAIT(src, TRAIT_CYBER_SUBVOCAL)) + cyberware_subvocal_pending = TRUE + +/** + * Chained override of living speech output. A marked radio line is spoken at + * range 0: the bearer and anyone on their tile hear it, a neighbour one tile off + * gets the usual eavesdropper's garble, nobody else hears anything. The voice + * bark layer wraps this one and still plays its blip at the old range. + */ +/mob/living/send_speech(message_raw, message_range = 6, obj/source = src, bubble_type = bubble_icon, list/spans, datum/language/message_language = null, list/message_mods = list(), forced = null, tts_message, list/tts_filter) + if(cyberware_subvocal_pending) + cyberware_subvocal_pending = FALSE + message_range = 0 + return ..(message_raw, message_range, source, bubble_type, spans, message_language, message_mods, forced, tts_message, tts_filter) + +// ========================================================================= +// MUFFLER EAR +// ========================================================================= + +/** + * # Muffler ear (T1, head, ears slot, load 1) + * + * Takes one point off the intensity of a bang, which is exactly what earmuffs do + * (code/datums/components/earprotection.dm, sender soundbang_act in + * carbon_defense.dm). The listener is registered by the passive hooks, so an + * offline ear hears the bang in full. Same slot as the Heartbeat Doppler. + */ +/obj/item/organ/cyberimp/cyberware/muffler_ear + name = "\improper Muffler ear" + desc = "Baffles set into the ear canal. Earmuffs you can't leave on the bridge." + icon_state = "muffler_ear" + zone = BODY_ZONE_HEAD + slot = ORGAN_SLOT_CYBERWARE_EARS + w_class = WEIGHT_CLASS_SMALL + chrome_load = 1 + tier = CYBERWARE_TIER_1 + /// Intensity taken off a bang. + var/bang_reduction = 1 + +/obj/item/organ/cyberimp/cyberware/muffler_ear/chrome_passives_on(mob/living/carbon/bearer) + . = ..() + if(isnull(bearer)) + return + RegisterSignal(bearer, COMSIG_CARBON_SOUNDBANG, PROC_REF(on_soundbang), override = TRUE) + +/obj/item/organ/cyberimp/cyberware/muffler_ear/chrome_passives_off(mob/living/carbon/bearer) + . = ..() + if(isnull(bearer)) + return + UnregisterSignal(bearer, COMSIG_CARBON_SOUNDBANG) + +/// Signal proc for [COMSIG_CARBON_SOUNDBANG]: the intensity rides in a list so +/// listeners can change it. +/obj/item/organ/cyberimp/cyberware/muffler_ear/proc/on_soundbang(datum/source, list/reflist) + SIGNAL_HANDLER + reflist[1] -= bang_reduction + +// ========================================================================= +// SHOP SKUS: on the Chop Shop's sku_types and on the street doc's. +// ========================================================================= + +/datum/shop_sku/ripperdoc/clotter_node + category = "Street Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/clotter_node + price_credits = 900 + +/datum/shop_sku/ripperdoc/adrenal_pump + zone_permission = ZONE_PERMISSION_YELLOW + category = "Street Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/adrenal_pump + price_credits = 2400 + +/datum/shop_sku/ripperdoc/medic_palms + category = "Street Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/medic_palms + price_credits = 600 + +/datum/shop_sku/ripperdoc/cuffer_wrists + category = "Street Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/cuffer_wrists + price_credits = 500 + +/datum/shop_sku/ripperdoc/subvocal_mic + category = "Street Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/subvocal_mic + price_credits = 600 + +/datum/shop_sku/ripperdoc/muffler_ear + category = "Street Chrome" + item_path = /obj/item/organ/cyberimp/cyberware/muffler_ear + price_credits = 700 + +// ========================================================================= +// TRADE-IN: half list, credits only. Ratchet's entries (/street_doc) differ +// only in wording. +// ========================================================================= + +/datum/shop_buyback/ripperdoc/clotter_node + name = "Clotter node (pulled)" + desc = "A used clotting-gel reservoir." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/clotter_node + match_subtypes = FALSE + pay_credits = 450 + demand_min = 2 + demand_max = 3 + +/datum/shop_buyback/ripperdoc/clotter_node/street_doc + desc = "A used gel reservoir. Still sticky." + +/datum/shop_buyback/ripperdoc/adrenal_pump + name = "Adrenal pump (pulled)" + desc = "A used adrenaline pump. Splice takes these off your hands." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/adrenal_pump + match_subtypes = FALSE + pay_credits = 1200 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/ripperdoc/adrenal_pump/street_doc + desc = "A used heart pump. Handle it gently." + +/datum/shop_buyback/ripperdoc/medic_palms + name = "Medic's palms (pulled)" + desc = "Used sterile palm plates." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/medic_palms + match_subtypes = FALSE + pay_credits = 300 + demand_min = 2 + demand_max = 3 + +/datum/shop_buyback/ripperdoc/medic_palms/street_doc + desc = "Used palm plates. Washed, mostly." + +/datum/shop_buyback/ripperdoc/cuffer_wrists + name = "Cuffer's wrists (pulled)" + desc = "Used wrist actuators." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/cuffer_wrists + match_subtypes = FALSE + pay_credits = 250 + demand_min = 2 + demand_max = 3 + +/datum/shop_buyback/ripperdoc/cuffer_wrists/street_doc + desc = "Used wrist actuators. They've seen some arrests." + +/datum/shop_buyback/ripperdoc/subvocal_mic + name = "Subvocal mic (pulled)" + desc = "A used throat mic." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/subvocal_mic + match_subtypes = FALSE + pay_credits = 300 + demand_min = 2 + demand_max = 3 + +/datum/shop_buyback/ripperdoc/subvocal_mic/street_doc + desc = "A used throat mic. Don't ask what it heard." + +/datum/shop_buyback/ripperdoc/muffler_ear + name = "Muffler ear (pulled)" + desc = "Used ear baffles." + category = "Trade-In" + item_path = /obj/item/organ/cyberimp/cyberware/muffler_ear + match_subtypes = FALSE + pay_credits = 350 + demand_min = 2 + demand_max = 3 + +/datum/shop_buyback/ripperdoc/muffler_ear/street_doc + desc = "Used ear baffles. Quiet ones." diff --git a/voidcrew/modules/lich/lich_thrall.dm b/voidcrew/modules/lich/lich_thrall.dm index 00d8117386b..ba1e9aec77e 100644 --- a/voidcrew/modules/lich/lich_thrall.dm +++ b/voidcrew/modules/lich/lich_thrall.dm @@ -370,6 +370,8 @@ continue // Ilthuun and his garrison if(candidate.has_status_effect(/datum/status_effect/lich_thrall)) continue + if(cyberware_camo_hides(candidate, owner)) // optical camo (cyberware_stealth.dm) + continue var/score = get_dist(owner, candidate) if(candidate.client) diff --git a/voidcrew/modules/loot/themes/armory.dm b/voidcrew/modules/loot/themes/armory.dm index 0e2b164afe7..9ecd3e86319 100644 --- a/voidcrew/modules/loot/themes/armory.dm +++ b/voidcrew/modules/loot/themes/armory.dm @@ -8,6 +8,8 @@ // Cyberware: chrome a garrison would have issued rather than bought, light // weave and knuckle plate on the line, and in the back room the ceramic // plating, the targeting optics and the frame that stops a limb coming off. +// The governor and rage-core lines ride here too: the taped-over street +// models on the line, the surplus service models in the back room. // TODO: review/balance-pass all four tiers: first-draft weights and // contents, never playtested. Tune against the outfitter armor/gun prices // in theme_skus. @@ -140,6 +142,13 @@ /datum/shop_sku/ripperdoc/slabskin, /datum/shop_sku/ripperdoc/deadeye, /datum/shop_sku/ripperdoc/atlas, + /datum/shop_sku/ripperdoc/governor_street, + /datum/shop_sku/ripperdoc/governor_milspec, + /datum/shop_sku/ripperdoc/redline_street, + /datum/shop_sku/ripperdoc/redline_milspec, + /datum/shop_sku/ripperdoc/cuffer_wrists, + /datum/shop_sku/ripperdoc/muffler_ear, + /datum/shop_sku/ripperdoc/hardweave, ) loot_common = list( /obj/item/clothing/suit/armor/vest = 10, @@ -152,6 +161,10 @@ /obj/item/clothing/mask/balaclava = 4, // gene injector loot (gene_injectors.dm) /obj/item/dnainjector/loot/strength = 3, + // guard-post chrome: faster hands with the cuffs, and an ear that + // shuts out a flashbang + /obj/item/organ/cyberimp/cyberware/cuffer_wrists = 4, + /obj/item/organ/cyberimp/cyberware/muffler_ear = 4, ) loot_uncommon = list( /obj/item/clothing/suit/armor/bulletproof = 10, @@ -163,6 +176,11 @@ /obj/item/ship_parts/combat = 7, // Issue chrome: subdermal impact weave. /obj/item/organ/cyberimp/cyberware/dermal_mesh = 4, + // a patched limiter and a cheap rage core, both off a deserter + /obj/item/organ/cyberimp/cyberware/governor_delete/street = 2, + /obj/item/organ/cyberimp/cyberware/redline/street = 2, + // the heavier issue weave + /obj/item/organ/cyberimp/cyberware/dermal_mesh/hardweave = 3, ) loot_prime = list( /obj/item/clothing/suit/armor/vest/marine = 9, @@ -178,6 +196,10 @@ /obj/item/organ/cyberimp/cyberware/atlas = 2, // gene injector loot (gene_injectors.dm) /obj/item/dnainjector/loot/quick_recovery = 1, + // surplus service chrome with the unit numbers still on it + /obj/item/organ/cyberimp/cyberware/governor_delete/milspec = 2, + /obj/item/organ/cyberimp/cyberware/redline/milspec = 2, + // the service optics ) // One-of-a-kind authored prizes, drawn as the fourth tier from any // band (weight = how shallow the item used to sit: 3 was reachable diff --git a/voidcrew/modules/loot/themes/expedition.dm b/voidcrew/modules/loot/themes/expedition.dm index 9bd98aee396..a4ed3dd3fb7 100644 --- a/voidcrew/modules/loot/themes/expedition.dm +++ b/voidcrew/modules/loot/themes/expedition.dm @@ -42,6 +42,10 @@ /datum/shop_sku/ripperdoc/angler, /datum/shop_sku/ripperdoc/prospector, /datum/shop_sku/ripperdoc/hopper, + /datum/shop_sku/ripperdoc/frostline, + /datum/shop_sku/ripperdoc/hopper_street, + /datum/shop_sku/ripperdoc/rockjaw_deepcore, + /datum/shop_sku/ripperdoc/hopper_milspec, ) loot_common = list( /obj/item/clothing/suit/hooded/explorer = 10, @@ -57,6 +61,8 @@ /obj/item/organ/cyberimp/cyberware/shock_coils = 4, // gene injector loot (gene_injectors.dm) /obj/item/dnainjector/loot/geladikinesis = 3, + // a cold lining for the ice worlds, and cheap eyes that see a long way + /obj/item/organ/cyberimp/cyberware/frostline = 3, ) loot_uncommon = list( /obj/item/gun/energy/recharge/kinetic_accelerator = 10, @@ -76,6 +82,10 @@ /obj/item/dnainjector/loot/olfaction = 3, /obj/item/dnainjector/loot/farsight = 2, /obj/item/dnainjector/loot/cold_adaptation = 2, + // claim chrome a step up: calf springs, the heavy drill fist and long + // optics + /obj/item/organ/cyberimp/cyberware/hopper/street = 3, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/rockjaw/deepcore = 3, ) loot_prime = list( /obj/item/borg/upgrade/modkit/range = 9, @@ -91,6 +101,8 @@ /obj/item/organ/cyberimp/cyberware/hopper = 2, // gene injector loot (gene_injectors.dm) /obj/item/dnainjector/loot/pressure_adaptation = 1, + // the survey team's jump pistons + /obj/item/organ/cyberimp/cyberware/hopper/milspec = 2, ) // One-of-a-kind authored prizes, drawn as the fourth tier from any // band (weight = how shallow the item used to sit: 3 was reachable diff --git a/voidcrew/modules/loot/themes/industrial.dm b/voidcrew/modules/loot/themes/industrial.dm index 6fae89d3e02..d860708cfad 100644 --- a/voidcrew/modules/loot/themes/industrial.dm +++ b/voidcrew/modules/loot/themes/industrial.dm @@ -8,7 +8,8 @@ // (see cave_entrance.dm): industrial plant equipment, uncommon-tier. // - cyberware: shop-floor chrome, the kind a plant fits to keep a line // running, omnitool fingers, then the coolant lattice for hot work and -// the myomer arms that pull a dead airlock open. +// the myomer arms that pull a dead airlock open. The cheap myomer pair +// is a yellow melee extra, the real Gorilla Arms a red one. // TODO: review/balance-pass all four tiers: first-draft weights and // contents, never playtested. Tune against outpost shop material prices and // the Boffin stall parts SKUs in theme_skus. @@ -26,6 +27,9 @@ ), ) melee_extras = list( + LOOT_WEAPON_YELLOW = list( + /obj/item/cyberware_pair_case/gorilla_arms/street = 1, + ), LOOT_WEAPON_RED = list( /obj/item/cyberware_pair_case/gorilla_arms = 1, ), @@ -41,6 +45,10 @@ /datum/shop_sku/ripperdoc/fixers, /datum/shop_sku/ripperdoc/coolant, /datum/shop_sku/ripperdoc/gorilla, + /datum/shop_sku/ripperdoc/coolant_street, + /datum/shop_sku/ripperdoc/fixers_street, + /datum/shop_sku/ripperdoc/atlas_street, + /datum/shop_sku/ripperdoc/gorilla_street, ) loot_common = list( /obj/item/stack/sheet/iron/fifty = 10, @@ -57,6 +65,9 @@ /obj/item/stack/sheet/plasteel/twenty = 4, // gene injector loot (gene_injectors.dm) /obj/item/dnainjector/loot/rock_eater = 3, + // line-worker chrome: a heat-sink lining and loose fingertip tools + /obj/item/organ/cyberimp/cyberware/coolant/street = 3, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/fixers/street = 4, ) loot_uncommon = list( /obj/item/stack/sheet/mineral/titanium/fifty = 8, @@ -79,6 +90,8 @@ // gene injector loot (gene_injectors.dm) /obj/item/dnainjector/loot/heat_adaptation = 2, /obj/item/dnainjector/loot/insulated = 3, + // a loader's strut frame + /obj/item/organ/cyberimp/cyberware/atlas/street = 3, ) loot_prime = list( /obj/item/stack/sheet/plasteel/fifty = 9, diff --git a/voidcrew/modules/loot/themes/medical.dm b/voidcrew/modules/loot/themes/medical.dm index 3d152ec9ea7..7b9bd79fd7e 100644 --- a/voidcrew/modules/loot/themes/medical.dm +++ b/voidcrew/modules/loot/themes/medical.dm @@ -34,6 +34,9 @@ /datum/shop_sku/ripperdoc/hemoglass, /datum/shop_sku/ripperdoc/dead_channel, /datum/shop_sku/ripperdoc/lazarus, + /datum/shop_sku/ripperdoc/clotter_node, + /datum/shop_sku/ripperdoc/medic_palms, + /datum/shop_sku/ripperdoc/second_wind_deep, ) loot_common = list( /obj/item/storage/medkit/regular = 10, @@ -53,6 +56,9 @@ /obj/item/organ/cyberimp/cyberware/gastro = 4, // gene injector loot (gene_injectors.dm) /obj/item/dnainjector/loot/stimmed = 3, + // clinic chrome: a clotting node and a medic's sensor palms + /obj/item/organ/cyberimp/cyberware/clotter_node = 4, + /obj/item/organ/cyberimp/cyberware/medic_palms = 3, ) loot_uncommon = list( /obj/item/storage/medkit/advanced = 10, @@ -79,6 +85,8 @@ // gene injector loot (gene_injectors.dm) /obj/item/dnainjector/loot/hypermetabolic = 3, /obj/item/dnainjector/loot/plasmocile = 2, + // the long-shift air bladder + /obj/item/organ/cyberimp/cyberware/second_wind/deep = 3, ) loot_prime = list( /obj/item/reagent_containers/hypospray/medipen/atropine = 7, diff --git a/voidcrew/modules/loot/themes/plunder.dm b/voidcrew/modules/loot/themes/plunder.dm index d0cc0e26036..313898b55d4 100644 --- a/voidcrew/modules/loot/themes/plunder.dm +++ b/voidcrew/modules/loot/themes/plunder.dm @@ -6,7 +6,9 @@ // crews. // Cyberware: boarding chrome, and it reads as taken off somebody rather than // bought, grip pads at uncommon, and in the treasure the blade pair, the -// folding machine-pistol and the rocket pod. +// folding machine-pistol and the rocket pod. The cheap shiv pair is a yellow +// melee extra, the heat-sunk blade pair a red one beside the Mantis, and the +// holdout revolver arm a yellow gun extra. // TODO: review/balance-pass all four tiers: first-draft weights and // contents, never playtested. // ========================================================================= @@ -22,6 +24,7 @@ /obj/item/gun/ballistic/revolver/mateba = 1, /obj/item/gun/ballistic/shotgun/musket/no_quarter = 1, /obj/item/gun/magic/hook/marlinspike = 1, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin/holdout = 1, ), LOOT_WEAPON_RED = list( /obj/item/gun/ballistic/shotgun/automatic/combat = 1, @@ -30,9 +33,13 @@ ), ) melee_extras = list( + LOOT_WEAPON_YELLOW = list( + /obj/item/cyberware_pair_case/mantis_street = 1, + ), LOOT_WEAPON_RED = list( /obj/item/claymore/cutlass/parley = 1, /obj/item/cyberware_pair_case/mantis_blades = 1, + /obj/item/cyberware_pair_case/mantis_scorch = 1, /obj/item/heave_ho = 1, ), ) @@ -41,8 +48,11 @@ /datum/shop_sku/black_market/rotating/mateba, /datum/shop_sku/ripperdoc/gecko, /datum/shop_sku/ripperdoc/mantis, + /datum/shop_sku/ripperdoc/mantis_street, + /datum/shop_sku/ripperdoc/mantis_scorch, /datum/shop_sku/ripperdoc/ronin, /datum/shop_sku/ripperdoc/bunker_buster, + /datum/shop_sku/ripperdoc/ronin_holdout, ) loot_common = list( /obj/item/stack/spacecash/c100 = 10, diff --git a/voidcrew/modules/loot/themes/research.dm b/voidcrew/modules/loot/themes/research.dm index 0d1b04cd1cb..35bb2e9ce04 100644 --- a/voidcrew/modules/loot/themes/research.dm +++ b/voidcrew/modules/loot/themes/research.dm @@ -36,6 +36,7 @@ theme_skus = list( /datum/shop_sku/ripperdoc/doppler, /datum/shop_sku/ripperdoc/rigger, + /datum/shop_sku/ripperdoc/doppler_street, ) loot_common = list( /obj/item/storage/box/beakers = 10, @@ -64,6 +65,8 @@ // lab hardware worn instead of carried: a sonar transceiver socketed // into the bone behind the ear, reading movement through walls /obj/item/organ/cyberimp/cyberware/doppler = 3, + // a cheaper sonar ear, and survey optics off the long-range bench + /obj/item/organ/cyberimp/cyberware/doppler/street = 3, ) loot_prime = list( /obj/item/stack/ore/bluespace_crystal/refined = 10, @@ -87,6 +90,7 @@ // the annex's own interface work: a skull jack that flies a ship from // anywhere aboard it, as long as the hull still has a helm console /obj/item/organ/cyberimp/cyberware/rigger = 2, + // the observation post's eyes // gene injector loot (gene_injectors.dm) /obj/item/dnainjector/loot/thermal_vision = 3, /obj/item/dnainjector/loot/cryokinesis = 2, diff --git a/voidcrew/modules/loot/themes/syndicate.dm b/voidcrew/modules/loot/themes/syndicate.dm index d6abe3cc164..08016d1ace3 100644 --- a/voidcrew/modules/loot/themes/syndicate.dm +++ b/voidcrew/modules/loot/themes/syndicate.dm @@ -9,6 +9,11 @@ // Cyberware rides the same two channels: the parlor's smuggling cavity and // door spike sit at uncommon, and the three voucher-only pieces an operative // would carry (cloak weave, wire, reflex shunt) sit at the bottom of prime. +// The camo and reflex lines follow the same split: the street weave and the +// taped reflex rig at uncommon, the service lattice in prime, and the live +// wire beside the plain one in the red melee extras. The chrome added with the +// cyberware lines sits at about half the weight of the older entries, so the +// syndicate tables stay mostly guns, gear and contraband. // ========================================================================= /datum/loot_theme/syndicate @@ -32,6 +37,7 @@ LOOT_WEAPON_RED = list( /obj/item/knife/understudy = 1, /obj/item/organ/cyberimp/arm/toolkit/cyberware/monowire = 1, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/monowire/live = 1, ), ) guard_themes = list(/obj/effect/zone_mobs/syndicate, /obj/effect/zone_mobs/syndicate/boss) @@ -47,6 +53,14 @@ /datum/shop_sku/ripperdoc/slipwire, /datum/shop_sku/ripperdoc/monowire, /datum/shop_sku/ripperdoc/ghostskin, + /datum/shop_sku/ripperdoc/ghostskin_street, + /datum/shop_sku/ripperdoc/cascade_street, + /datum/shop_sku/ripperdoc/cascade_milspec, + /datum/shop_sku/ripperdoc/monowire_live, + /datum/shop_sku/ripperdoc/subvocal_mic, + /datum/shop_sku/ripperdoc/slipwire_street, + /datum/shop_sku/ripperdoc/adrenal_pump, + /datum/shop_sku/ripperdoc/slipwire_milspec, ) loot_common = list( /obj/item/soap/syndie = 10, @@ -56,6 +70,8 @@ /obj/item/encryptionkey/syndicate = 6, /obj/item/grenade/empgrenade = 5, /obj/item/storage/medkit/tactical = 4, + // a throat mic nobody nearby hears + /obj/item/organ/cyberimp/cyberware/subvocal_mic = 2, ) loot_uncommon = list( /obj/item/grenade/c4 = 6, @@ -71,6 +87,12 @@ // gene injector loot (gene_injectors.dm) /obj/item/dnainjector/loot/mind_reader = 2, /obj/item/dnainjector/loot/anti_glow = 2, + // knockoff operative chrome: a patchy camo weave and a taped reflex rig + /obj/item/organ/cyberimp/cyberware/ghostskin/street = 2, + /obj/item/organ/cyberimp/cyberware/cascade/street = 1, + // street operative chrome: a twitchy reflex shunt and an adrenal pump + /obj/item/organ/cyberimp/cyberware/slipwire/street = 2, + /obj/item/organ/cyberimp/cyberware/adrenal_pump = 2, ) loot_prime = list( /obj/item/pen/sleepy = 4, @@ -79,6 +101,9 @@ // Operative chrome: the reflex shunt and refraction weave. /obj/item/organ/cyberimp/cyberware/slipwire = 3, /obj/item/organ/cyberimp/cyberware/ghostskin = 2, + /obj/item/organ/cyberimp/cyberware/cascade/milspec = 1, + // the boarding team's shunt + /obj/item/organ/cyberimp/cyberware/slipwire/milspec = 1, ) // One-of-a-kind authored prizes, drawn as the fourth tier from any // band (weight = how shallow the item used to sit: 3 was reachable @@ -104,28 +129,28 @@ /obj/effect/zone_mobs/syndicate name = "zone mob spawner (syndicate)" mobs_green = list( - /mob/living/basic/trooper/syndicate/melee = 14, + /mob/living/carbon/human/npc/ruin/trooper/syndicate = 14, ) mobs_yellow = list( - /mob/living/basic/trooper/syndicate/melee/sword = 8, - /mob/living/basic/trooper/syndicate/ranged = 12, + /mob/living/carbon/human/npc/ruin/trooper/syndicate/sword = 8, + /mob/living/carbon/human/npc/ruin/trooper/syndicate/gunner = 12, ) mobs_red = list( - /mob/living/basic/trooper/syndicate/ranged/smg = 8, - /mob/living/basic/trooper/syndicate/ranged/shotgun = 6, - /mob/living/basic/trooper/syndicate/melee/sword = 5, - /mob/living/basic/trooper/syndicate/ranged/smg/space/stormtrooper = 2, + /mob/living/carbon/human/npc/ruin/trooper/syndicate/gunner/smg = 8, + /mob/living/carbon/human/npc/ruin/trooper/syndicate/gunner/shotgun = 6, + /mob/living/carbon/human/npc/ruin/trooper/syndicate/sword = 5, + /mob/living/carbon/human/npc/ruin/trooper/syndicate/stormtrooper = 2, ) /obj/effect/zone_mobs/syndicate/boss name = "zone mob spawner (syndicate boss)" mobs_green = list( - /mob/living/basic/trooper/syndicate/melee = 1, + /mob/living/carbon/human/npc/ruin/trooper/syndicate = 1, ) mobs_yellow = list( - /mob/living/basic/trooper/syndicate/ranged = 2, + /mob/living/carbon/human/npc/ruin/trooper/syndicate/gunner = 2, ) mobs_red = list( - /mob/living/basic/trooper/syndicate/ranged/smg/space/stormtrooper = 1, - /mob/living/basic/trooper/syndicate/ranged/shotgun/space/stormtrooper = 1, + /mob/living/carbon/human/npc/ruin/trooper/syndicate/stormtrooper = 1, + /mob/living/carbon/human/npc/ruin/trooper/syndicate/stormtrooper/shotgun = 1, ) diff --git a/voidcrew/modules/loot/themes/wardrobe.dm b/voidcrew/modules/loot/themes/wardrobe.dm index 35dc5bede0e..b34b8a7212f 100644 --- a/voidcrew/modules/loot/themes/wardrobe.dm +++ b/voidcrew/modules/loot/themes/wardrobe.dm @@ -51,6 +51,7 @@ // gene injector loot (gene_injectors.dm) /obj/item/dnainjector/loot/glowy = 3, /obj/item/dnainjector/loot/gigantism = 2, + // cheap zoom eyes, bought for the look as much as the view ) loot_uncommon = list( /obj/item/clothing/suit/jacket/leather/biker = 10, diff --git a/voidcrew/modules/trade/shop_buyback.dm b/voidcrew/modules/trade/shop_buyback.dm index 9ad15e40e0d..04930411588 100644 --- a/voidcrew/modules/trade/shop_buyback.dm +++ b/voidcrew/modules/trade/shop_buyback.dm @@ -42,6 +42,10 @@ var/icon_state_override /// Cached base64 icon for the UI, computed once per instance var/cached_icon + /// Takes goods bought over a counter (TRAIT_TRADER_GOODS) as well as found + /// ones. Only the ripperdoc trade-in sets this, and only credit payouts + /// honour it, see takes_shop_stock(). + var/buys_shop_stock = FALSE /datum/shop_buyback/New() ..() @@ -88,11 +92,20 @@ cached_icon = icon2base64(icon(icon_file, state, SOUTH, frame = 1)) return cached_icon +/** + * Whether this ledger takes goods that were bought at a shop. Every ledger + * refuses them except the ripperdoc trade-in, and that one only while it pays + * credits alone: a voucher payout for bought goods would turn credits into + * vouchers. + */ +/datum/shop_buyback/proc/takes_shop_stock() + return buys_shop_stock && pay_vouchers <= 0 + /** * Whether this item counts for this ledger entry. */ /datum/shop_buyback/proc/matches(obj/item/offered) - if(is_trader_good(offered)) + if(is_trader_good(offered) && !takes_shop_stock()) return FALSE if(match_subtypes ? !istype(offered, item_path) : offered.type != item_path) return FALSE @@ -111,7 +124,7 @@ if(match_subtypes || !item_path) return null for(var/obj/item/offered in user.get_all_contents()) - if(istype(offered, item_path) && offered.type != item_path) + if(istype(offered, item_path) && offered.type != item_path && !shop_buyback_inside_body(offered)) return offered return null @@ -125,6 +138,11 @@ * the seller's own back, or the MODsuit they are standing in. Held items still * count (that hand-off is the whole gesture), and so does anything in a bag or * a pocket, because carrying it there is already a decision to bring it. + * + * The seller's own body is skipped too. Installed organs sit inside their + * bodypart, inside the mob, so the same sweep reaches them, and none of them + * is in get_equipped_items(): without this a chrome ledger would take the + * seller's working eyes out of their head. */ /datum/shop_buyback/proc/find_offered_items(mob/living/user) var/list/found = list() @@ -135,10 +153,29 @@ for(var/obj/item/offered in user.get_all_contents()) if((offered in found) || (offered in worn)) continue + if(shop_buyback_inside_body(offered)) + continue if(matches(offered)) found += offered return found +/** + * Whether an item is part of a body or rides inside one: an attached limb, an + * installed organ, or anything held inside either. The walk stops at the first + * mob, so a severed limb or a pulled organ in a bag still counts as goods. + */ +/proc/shop_buyback_inside_body(obj/item/offered) + for(var/atom/current = offered; current && !ismob(current); current = current.loc) + if(isorgan(current)) + var/obj/item/organ/organ = current + if(organ.owner) + return TRUE + else if(isbodypart(current)) + var/obj/item/bodypart/limb = current + if(limb.owner) + return TRUE + return FALSE + /** * How many sale-units the seller is carrying (stacks divide by `amount`). */ @@ -171,7 +208,7 @@ return "Not buying any more this shift." if(count_carried_units(user) < 1) for(var/obj/item/offered in user.get_all_contents()) - if(istype(offered, item_path) && is_trader_good(offered)) + if(istype(offered, item_path) && is_trader_good(offered) && !takes_shop_stock() && !shop_buyback_inside_body(offered)) return "I don't buy back shop stock." // Exact-type ledgers (match_subtypes = FALSE) refuse processed/lab-made // variants of the wanted goods. Without this, a player holding a refined diff --git a/voidcrew/modules/unit_tests/_unit_tests.dm b/voidcrew/modules/unit_tests/_unit_tests.dm index de2b2787c3b..2da4434b197 100644 --- a/voidcrew/modules/unit_tests/_unit_tests.dm +++ b/voidcrew/modules/unit_tests/_unit_tests.dm @@ -73,6 +73,15 @@ #include "voidcrew_crew_antag_gc.dm" #include "voidcrew_crew_hud.dm" #include "voidcrew_cyberware.dm" +#include "voidcrew_cyberware_anim.dm" +#include "voidcrew_cyberware_anim2.dm" +#include "voidcrew_cyberware_kit.dm" +#include "voidcrew_cyberware_mantis.dm" +#include "voidcrew_cyberware_models_a.dm" +#include "voidcrew_cyberware_models_b.dm" +#include "voidcrew_cyberware_npcs.dm" +#include "voidcrew_cyberware_passives.dm" +#include "voidcrew_cyberware_text.dm" #include "voidcrew_derelict_helpers.dm" #include "voidcrew_derelict_layout.dm" #include "voidcrew_derelict_leash.dm" diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware.dm index 35b2f28ea1d..15ec4e9376b 100644 --- a/voidcrew/modules/unit_tests/voidcrew_cyberware.dm +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware.dm @@ -158,7 +158,12 @@ /datum/unit_test/voidcrew_cyberware_arm_slots /datum/unit_test/voidcrew_cyberware_arm_slots/Run() - var/list/exempt = list(/obj/item/organ/cyberimp/cyberware/gecko) + // The other two palm and wrist pieces share the hands slot with it (ware_street_passives.dm). + var/list/exempt = list( + /obj/item/organ/cyberimp/cyberware/gecko, + /obj/item/organ/cyberimp/cyberware/medic_palms, + /obj/item/organ/cyberimp/cyberware/cuffer_wrists, + ) var/list/arm_ware = typesof(/obj/item/organ/cyberimp/cyberware) + typesof(/obj/item/organ/cyberimp/arm/toolkit/cyberware) for(var/organ_path in arm_ware) if(organ_path in exempt) @@ -170,6 +175,51 @@ if(BODY_ZONE_L_ARM) TEST_ASSERT_EQUAL(initial(ware.slot), ORGAN_SLOT_LEFT_ARM_AUG, "[organ_path] is left-arm chrome off the arm hardware slot. It would stack with blades/launchers on the same arm") +/// The Widowline Arc: same slot as the Widowline it steps up from, a heavier +/// load, and a wire whose shock lands through insulated gloves, skips the +/// shock-immune, hits robots harder, and shorts a turret once per recharge. +/datum/unit_test/voidcrew_cyberware_widowline_arc + +/datum/unit_test/voidcrew_cyberware_widowline_arc/Run() + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/monowire/plain = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/monowire) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/monowire/live/arc = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/monowire/live) + TEST_ASSERT_EQUAL(arc.slot, plain.slot, "The Arc housing isn't in the Widowline's slot, so the two would stack") + TEST_ASSERT(arc.chrome_load > plain.chrome_load, "The Arc housing is no heavier than the plain Widowline") + var/obj/item/melee/cyberware_monowire/live/wire = locate() in arc + TEST_ASSERT(wire, "The Arc housing didn't build its live wire") + + var/turf/start = run_loc_floor_bottom_left + var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human/consistent, start) + var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human/consistent, get_step(start, EAST)) + TEST_ASSERT(wire.discharge_into_mob(victim, user), "The shock didn't land on a plain human") + TEST_ASSERT(victim.getFireLoss() > 0, "The shock left no burn") + TEST_ASSERT(victim.has_status_effect(/datum/status_effect/staggered), "The shock left no stagger") + + var/mob/living/carbon/human/gloved = allocate(/mob/living/carbon/human/consistent, get_step(start, EAST)) + var/obj/item/clothing/gloves/color/yellow/insulated = allocate(/obj/item/clothing/gloves/color/yellow) + gloved.equip_to_slot_if_possible(insulated, ITEM_SLOT_GLOVES, qdel_on_fail = FALSE, disable_warning = TRUE) + TEST_ASSERT_EQUAL(gloved.gloves, insulated, "Insulated gloves fixture failed to equip") + TEST_ASSERT(wire.discharge_into_mob(gloved, user), "Insulated gloves stopped the shock") + + var/mob/living/carbon/human/immune = allocate(/mob/living/carbon/human/consistent, get_step(start, EAST)) + ADD_TRAIT(immune, TRAIT_SHOCKIMMUNE, TRAIT_SOURCE_UNIT_TESTS) + TEST_ASSERT(!wire.discharge_into_mob(immune, user), "A shock-immune target was shocked") + TEST_ASSERT_EQUAL(immune.getFireLoss(), 0, "A shock-immune target took burn") + TEST_ASSERT(!immune.has_status_effect(/datum/status_effect/staggered), "A shock-immune target was staggered") + + // Any robotic biotype takes the robot bonus, not just silicons. + var/mob/living/basic/pet/dog/corgi/robot = allocate(/mob/living/basic/pet/dog/corgi, get_step(start, EAST)) + robot.mob_biotypes = MOB_ROBOTIC + TEST_ASSERT(wire.discharge_into_mob(robot, user), "The robot bonus didn't land on a robotic mob") + TEST_ASSERT(robot.health < robot.maxHealth, "The robot bonus did no damage") + + var/obj/machinery/porta_turret/turret = allocate(/obj/machinery/porta_turret, get_step(start, NORTH)) + TEST_ASSERT(wire.discharge_into_machine(turret, user), "The wire didn't short a porta-turret") + TEST_ASSERT(!COOLDOWN_FINISHED(turret, disabled_time), "A shorted porta-turret isn't disabled") + var/obj/machinery/porta_turret/second_turret = allocate(/obj/machinery/porta_turret, get_step(start, NORTH)) + TEST_ASSERT(!wire.discharge_into_machine(second_turret, user), "The wire shorted a second machine before it recharged") + TEST_ASSERT(COOLDOWN_FINISHED(second_turret, disabled_time), "A turret was disabled with the wire recharging") + /// (f) Chrome read: the optics' scan resolves installed hardware by name at /// itemized resolution, rates parlor chrome by tier and everything else /// UNRATED, counts either way, and NEVER resolves anything flagged @@ -203,7 +253,7 @@ // printable augments unrated, and skips what it can't see. var/itemized = jointext(cyberware_scan_readout(lab_rat, 2), "\n") TEST_ASSERT(findtext(itemized, uppertext(optics.name)), "An itemized chrome read didn't name the installed optics: [itemized]") - TEST_ASSERT(findtext(itemized, "T1"), "An itemized chrome read didn't rate the tier 1 optics: [itemized]") + TEST_ASSERT(findtext(itemized, "STREET"), "An itemized chrome read didn't rate the street-grade optics: [itemized]") TEST_ASSERT(findtext(itemized, "UNRATED"), "An itemized chrome read rated a printable augment as parlor chrome: [itemized]") TEST_ASSERT(!findtext(itemized, uppertext(stash.name)), "An itemized chrome read named the ORGAN_HIDDEN Cargo Cavity: [itemized]") TEST_ASSERT(findtext(itemized, "SIGNATURES 2"), "An itemized chrome read miscounted the visible signatures: [itemized]") @@ -214,6 +264,40 @@ TEST_ASSERT(findtext(silhouette, "SIGNATURES 2"), "A silhouette chrome read didn't report the signature count: [silhouette]") TEST_ASSERT_EQUAL(initial(optics.chrome_scan_resolution), 1, "The street-tier Nightshade isn't set to silhouette resolution") +/// Camo line: the street weave fades its bearer but never takes the +/// cyber_camo trait (NPC targeting and chrome reads key on it, so it fools +/// players only), while the full Ghostskin keeps both. They share the skin +/// slot, so the upgrade evicts the street weave and drops its field. +/// Literals: trait is TRAIT_CYBER_CAMO ("cyber_camo"), alphas are 60 street +/// and 40 full, times are in deciseconds (70 = 7 s), tier 2 = CYBERWARE_TIER_2. +/datum/unit_test/voidcrew_cyberware_camo_line + +/datum/unit_test/voidcrew_cyberware_camo_line/Run() + var/mob/living/carbon/human/lab_rat = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/ghostskin/street/street = allocate(/obj/item/organ/cyberimp/cyberware/ghostskin/street) + TEST_ASSERT_EQUAL(street.chrome_load, 2, "The street camo weave's load drifted") + TEST_ASSERT_EQUAL(street.tier, 2, "The street camo weave left tier 2") + TEST_ASSERT_EQUAL(street.field_duration, 70, "The street camo weave's field duration drifted") + TEST_ASSERT(!street.hides_from_mobs, "The street camo weave hides its bearer from mobs") + TEST_ASSERT(street.Insert(lab_rat, special = TRUE), "Street weave staging insert was refused") + street.engage_camo(lab_rat) + TEST_ASSERT(street.camo_active, "The street weave's field never came up") + TEST_ASSERT_EQUAL(lab_rat.alpha, 60, "The street weave faded its bearer to the wrong alpha") + TEST_ASSERT(!HAS_TRAIT(lab_rat, "cyber_camo"), "The street weave granted the mob-hiding camo trait") + + // The full weave is unchanged: trait, alpha 40, ten seconds. + var/obj/item/organ/cyberimp/cyberware/ghostskin/full = allocate(/obj/item/organ/cyberimp/cyberware/ghostskin) + TEST_ASSERT(full.Insert(lab_rat, special = TRUE), "Ghostskin staging insert was refused") + TEST_ASSERT(!street.camo_active, "Evicting the street weave left its field up") + TEST_ASSERT(!HAS_TRAIT(lab_rat, "cyber_camo"), "Nothing should hold the camo trait between fields") + TEST_ASSERT_EQUAL(full.field_duration, 100, "Ghostskin's field duration drifted") + TEST_ASSERT(full.hides_from_mobs, "Ghostskin stopped hiding its bearer from mobs") + full.engage_camo(lab_rat) + TEST_ASSERT(HAS_TRAIT(lab_rat, "cyber_camo"), "Ghostskin stopped granting the camo trait") + TEST_ASSERT_EQUAL(lab_rat.alpha, 40, "Ghostskin faded its bearer to the wrong alpha") + full.break_camo(lab_rat, silent = TRUE) + TEST_ASSERT(!HAS_TRAIT(lab_rat, "cyber_camo"), "Ghostskin left the camo trait behind when its field dropped") + /// (e) Second Wind Bladder: blocks suffocation while reserve lasts, runs /// dry, and refills in breathable air. /// @@ -259,6 +343,54 @@ TEST_ASSERT(!bladder.engaged, "Second Wind stayed engaged in breathable air") vacuum.ChangeTurf(floor_type) +/// A player's Redline burn wears a red outline for the whole window, and it goes out when the bearer dies +/datum/unit_test/voidcrew_cyberware_redline_outline + +/datum/unit_test/voidcrew_cyberware_redline_outline/Run() + var/mob/living/carbon/human/lab_rat = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/redline/core = allocate(/obj/item/organ/cyberimp/cyberware/redline) + TEST_ASSERT(core.Insert(lab_rat, special = TRUE), "Redline staging insert was refused") + var/datum/action/cooldown/cyberware/redline_burn/burn = locate() in core.actions // chrome abilities never join mob.actions (chrome_hud.dm) + TEST_ASSERT_NOTNULL(burn, "The Redline core gave no burn action") + burn.Trigger() + TEST_ASSERT_NOTNULL(lab_rat.has_status_effect(/datum/status_effect/cyberware_redline_window), "Pressing the burn opened no window") + TEST_ASSERT_NOTNULL(lab_rat.get_filter("cyberware_redline_window"), "A player's burn has no red outline") + lab_rat.death() + TEST_ASSERT_NULL(lab_rat.get_filter("cyberware_redline_window"), "The red outline stayed on a dead bearer") + lab_rat.remove_status_effect(/datum/status_effect/cyberware_redline_window) + TEST_ASSERT_NULL(lab_rat.get_filter("cyberware_redline_window"), "The red outline outlasted the window") + +/// Splice buys burnt-out chrome as scrap, for less than the cheapest piece he sells for credits +/datum/unit_test/voidcrew_cyberware_burnt_chrome_sale + +/datum/unit_test/voidcrew_cyberware_burnt_chrome_sale/Run() + var/mob/living/carbon/human/seller = allocate(/mob/living/carbon/human/consistent, run_loc_floor_bottom_left) + var/obj/item/card/id/id = allocate(/obj/item/card/id) + var/datum/bank_account/account = allocate(/datum/bank_account, "Burnt chrome test", null, 1, FALSE) + id.registered_account = account + TEST_ASSERT(seller.put_in_hands(id), "The seller could not hold their ID") + var/datum/shop_buyback/ripperdoc/burnt_chrome/ledger = allocate(/datum/shop_buyback/ripperdoc/burnt_chrome) + ledger.demand = 2 + var/datum/outpost_shop/vendor/ripperdoc/splice = allocate(/datum/outpost_shop/vendor/ripperdoc) + var/takes_burnt = FALSE + for(var/datum/shop_buyback/intake as anything in splice.buybacks) + if(intake.type == ledger.type) + takes_burnt = TRUE + TEST_ASSERT(takes_burnt, "Splice doesn't take burnt-out chrome") + for(var/datum/shop_sku/sku as anything in subtypesof(/datum/shop_sku/ripperdoc)) + var/price = initial(sku.price_credits) + if(price > 0) + TEST_ASSERT(ledger.pay_credits * 4 < price, "Burnt-out chrome pays [ledger.pay_credits], near [sku]'s [price] credit price") + + var/obj/item/organ/cyberimp/cyberware/scrapper/knuckles = allocate(/obj/item/organ/cyberimp/cyberware/scrapper, run_loc_floor_bottom_left) + var/obj/item/burnt_chrome/husk = allocate(/obj/item/burnt_chrome, run_loc_floor_bottom_left, knuckles) + TEST_ASSERT(seller.put_in_hands(husk), "The seller could not hold the burnt-out chrome") + var/balance = account.account_balance + TEST_ASSERT(ledger.try_sell(seller, null, TRUE), "Splice refused burnt-out chrome") + TEST_ASSERT(QDELETED(husk), "The sold burnt-out chrome wasn't taken") + TEST_ASSERT_EQUAL(account.account_balance, balance + ledger.pay_credits, "Burnt-out chrome paid the wrong amount") + TEST_ASSERT_EQUAL(ledger.demand, 1, "The sale used no demand") + /// (g) The Chrome Cradle console: every reachable piece files into exactly one /// rack group, and the highlight projects its own swap before anything commits. /// The interface reads all of this straight out of ui_data(), so a silent @@ -336,6 +468,49 @@ TEST_ASSERT(paired["vouchers"] > 0, "[half] indexed with no voucher price") TEST_ASSERT(paired["paired"], "[half] came out of a pair case without the paired flag") +/// (h2) Ratchet, the street doc at Quartermain: credit sales only, every piece +/// he sells has a cradle quote that matches his shelf, his ledger never pays +/// vouchers, and on the map he stands in view of his own cradle, so the install +/// patter (play_ripperdoc_bark) comes out of his mouth. +/datum/unit_test/voidcrew_street_doc + +/datum/unit_test/voidcrew_street_doc/Run() + build_cyberware_price_index() + var/datum/outpost_shop/vendor/street_doc/shop = allocate(/datum/outpost_shop/vendor/street_doc) + TEST_ASSERT(length(shop.skus), "The street doc has nothing on his shelf") + for(var/datum/shop_sku/sku as anything in shop.skus) + TEST_ASSERT(istype(sku, /datum/shop_sku/ripperdoc), "[sku.type] at the street doc is not ripperdoc stock, so the cradle never quotes it") + TEST_ASSERT(sku.price_credits > 0 && !sku.price_vouchers, "[sku.type] at the street doc is not a credit sale") + if(!ispath(sku.item_path, /obj/item/organ)) + continue + var/list/quote = GLOB.cyberware_price_index[sku.item_path] + TEST_ASSERT(!isnull(quote), "The cradle has no price for [sku.item_path], which the street doc sells") + if(quote) + TEST_ASSERT_EQUAL(quote["credits"], sku.price_credits, "The cradle quotes [sku.item_path] differently from the street doc's shelf") + TEST_ASSERT(length(shop.buybacks), "The street doc buys nothing back") + for(var/datum/shop_buyback/buyback as anything in shop.buybacks) + TEST_ASSERT(buyback.pay_credits > 0 && !buyback.pay_vouchers, "[buyback.type] at the street doc pays vouchers for chrome a ship can buy") + + var/obj/structure/overmap/trader_outpost/outpost = allocate(/obj/structure/overmap/trader_outpost/outfitter) + TEST_ASSERT(outpost.load_level(), "Quartermain's interior failed to load") + var/turf/bottom_left = outpost.template_bottom_left + var/turf/top_right = locate(bottom_left.x + outpost.outpost_template.width - 1, bottom_left.y + outpost.outpost_template.height - 1, bottom_left.z) + var/list/docs = list() + var/list/cradles = list() + for(var/turf/interior as anything in block(bottom_left, top_right)) + for(var/mob/living/basic/outpost_trader/ripperdoc/street_doc/doc in interior) + docs += doc + for(var/obj/machinery/chrome_cradle/cradle in interior) + cradles += cradle + TEST_ASSERT_EQUAL(length(docs), 1, "Quartermain has [length(docs)] street docs, not one") + TEST_ASSERT_EQUAL(length(cradles), 1, "Quartermain has [length(cradles)] chrome cradles, not one") + var/mob/living/basic/outpost_trader/ripperdoc/street_doc/ratchet = docs[1] + var/obj/machinery/chrome_cradle/rig = cradles[1] + TEST_ASSERT(istype(ratchet.shop, /datum/outpost_shop/vendor/street_doc), "The street doc is not running his own counter") + TEST_ASSERT(ratchet in view(7, rig), "The street doc can't see his cradle, so installs there run without him") + TEST_ASSERT_EQUAL(get_trader_outpost_for_turf(get_turf(rig)), outpost, "Quartermain's cradle does not know which outpost it is in") + qdel(outpost) + /// Recheck the complete final installation after the delay, before touching incumbents. /datum/unit_test/voidcrew_cradle_installed_capacity @@ -541,8 +716,9 @@ // the cursor and needs a client, so it is deliberately not what we call. var/obj/item/organ/eyes/robotic/cyberware/nightshade/optics = allocate(/obj/item/organ/eyes/robotic/cyberware/nightshade) TEST_ASSERT(optics.Insert(lab_rat, special = TRUE), "Nightshade staging insert was refused") - var/datum/action/cooldown/cyberware/chrome_read/read = locate(/datum/action/cooldown/cyberware/chrome_read) in lab_rat.actions - TEST_ASSERT(!isnull(read), "The optics never granted their chrome read action to the body") + // Chrome abilities have no HUD button, so they never join lab_rat.actions (chrome_hud.dm). + var/datum/action/cooldown/cyberware/chrome_read/read = locate(/datum/action/cooldown/cyberware/chrome_read) in optics.actions + TEST_ASSERT(read?.owner == lab_rat, "The optics never granted their chrome read action to the body") TEST_ASSERT(!lab_rat.is_blind(), "Test fixture: the staged optics left the body blind, so the read could never run") var/before = ink.pulse_count @@ -887,6 +1063,60 @@ TEST_ASSERT(governor.Insert(patient, TRUE), "Governor couldn't replace an OS") TEST_ASSERT(!cascade.owner && governor.owner == patient, "Chest OS hardware stacked") +/// The Governor line: each rung gives its own headroom at no load in the shared +/// OS slot, and swapping down never leaves the body quietly over its new ceiling. +/datum/unit_test/voidcrew_governor_line + +/datum/unit_test/voidcrew_governor_line/Run() + var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/governor_delete/delete = allocate(/obj/item/organ/cyberimp/cyberware/governor_delete) + var/obj/item/organ/cyberimp/cyberware/governor_delete/milspec/bypass = allocate(/obj/item/organ/cyberimp/cyberware/governor_delete/milspec) + var/obj/item/organ/cyberimp/cyberware/governor_delete/street/patch = allocate(/obj/item/organ/cyberimp/cyberware/governor_delete/street) + // ware, bonus, tier (the defines aren't visible from here: CYBERWARE_TIER_2/3/4) + var/list/rungs = list( + list(patch, 5, 2), + list(bypass, 10, 3), + list(delete, 15, 4), + ) + for(var/list/rung as anything in rungs) + var/obj/item/organ/cyberimp/cyberware/ware = rung[1] + var/datum/component/cyberware/chrome = ware.GetComponent(/datum/component/cyberware) + TEST_ASSERT_EQUAL(ware.slot, delete.slot, "[ware.type] isn't in the Governor's OS slot") + TEST_ASSERT_EQUAL(chrome.chrome_load, 0, "[ware.type] costs load, a Governor never does") + TEST_ASSERT_EQUAL(chrome.capacity_bonus, rung[2], "[ware.type] has the wrong capacity bonus") + TEST_ASSERT_EQUAL(chrome.tier, rung[3], "[ware.type] has the wrong tier") + TEST_ASSERT(ware.Insert(patient, TRUE), "[ware.type] fixture failed to install") + TEST_ASSERT_EQUAL(get_chrome_capacity(patient), 20 + rung[2], "[ware.type] gave the wrong capacity") + TEST_ASSERT_EQUAL(get_chrome_load(patient), 0, "[ware.type] put load on the body") + // Only the last rung is left in the slot: each install evicted the one before. + TEST_ASSERT(delete.owner == patient && !bypass.owner && !patch.owner, "Governor rungs stacked in the OS slot") + + // Swapping down is gated, not trapped: at a load the lower rung can't hold, the + // swap is refused with the incumbent still online. + var/obj/item/organ/cyberimp/cyberware/test_full_body/bulk = allocate(/obj/item/organ/cyberimp/cyberware/test_full_body) + var/obj/item/organ/cyberimp/cyberware/test_heavy/heavy = allocate(/obj/item/organ/cyberimp/cyberware/test_heavy) + bulk.Insert(patient, TRUE) + heavy.Insert(patient, TRUE) + TEST_ASSERT_EQUAL(get_chrome_load(patient), 35, "Governor line fixture load is wrong") + TEST_ASSERT(!cyberware_insert_check(bypass, patient, TRUE), "35 load fit under the Bypass's 30") + TEST_ASSERT(!cyberware_insert_check(patch, patient, TRUE), "35 load fit under the Patch's 25") + TEST_ASSERT(delete.owner == patient && !(delete.organ_flags & ORGAN_FAILING), "A refused downgrade disturbed the incumbent Governor") + heavy.Remove(patient, TRUE) + TEST_ASSERT(cyberware_insert_check(patch, patient, TRUE), "20 load didn't fit under the Patch's 25") + TEST_ASSERT(cyberware_insert_check(bypass, patient, TRUE), "20 load didn't fit under the Bypass's 30") + heavy.Insert(patient, TRUE) + + // Pulling the Governor is never blocked: everything browns out, and the + // smaller one that goes back in only lifts it once load fits. + var/datum/component/cyberware/bulk_chrome = bulk.GetComponent(/datum/component/cyberware) + TEST_ASSERT(bulk_chrome.is_running(), "35 of 35 browned out") + delete.Remove(patient, TRUE) + TEST_ASSERT(!bulk_chrome.is_running(), "Losing the Governor didn't brown out the over-capacity chrome") + TEST_ASSERT(patch.Insert(patient, TRUE), "The Patch couldn't go in over capacity with special") + TEST_ASSERT(!bulk_chrome.is_running(), "35 load stayed up under the Patch's 25") + heavy.Remove(patient, TRUE) + TEST_ASSERT(bulk_chrome.is_running(), "20 load stayed browned out under the Patch's 25") + /// Every approved exception is checked independently of the table under test. /datum/unit_test/voidcrew_nanite_capacity_costs @@ -1030,6 +1260,62 @@ TEST_ASSERT_EQUAL(get_chrome_load(patient), 16, "Deleting nanites retained installed program costs") TEST_ASSERT_EQUAL(patient.physiology.armor.get_rating(MELEE), bare_armor, "Deleting recovered nanites retained their armor") +/// The Berserk line: street and milspec cores share the Redline's OS slot and +/// retune its one burn through vars, and the Redline core itself is unchanged. +/datum/unit_test/voidcrew_berserk_line + +/datum/unit_test/voidcrew_berserk_line/Run() + var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/redline/core = allocate(/obj/item/organ/cyberimp/cyberware/redline) + TEST_ASSERT_EQUAL(core.burn_window, 12 SECONDS, "Redline core's window moved") + TEST_ASSERT_EQUAL(core.burn_damage_mult, 0.6, "Redline core's damage multiplier moved") + TEST_ASSERT_EQUAL(core.burn_melee_bonus, 8, "Redline core's punch bonus moved") + TEST_ASSERT(core.burn_stun_immune, "Redline core lost its stun immunity") + TEST_ASSERT_EQUAL(core.burn_roar_range, 5, "Redline core's roar moved") + TEST_ASSERT_EQUAL(core.burn_crash, 5 SECONDS, "Redline core's crash moved") + TEST_ASSERT_EQUAL(core.burn_cooldown, 90 SECONDS, "Redline core's cooldown moved") + TEST_ASSERT_EQUAL(core.chrome_load, 10, "Redline core's load moved") + for(var/model_type in list(/obj/item/organ/cyberimp/cyberware/redline/street, /obj/item/organ/cyberimp/cyberware/redline/milspec)) + var/obj/item/organ/cyberimp/cyberware/redline/model = allocate(model_type) + TEST_ASSERT_EQUAL(model.slot, core.slot, "[model_type] doesn't share the Redline's OS slot") + TEST_ASSERT(model.chrome_load < core.chrome_load, "[model_type] doesn't cost less load than the Redline core") + TEST_ASSERT(model.tier < core.tier, "[model_type] isn't a lower tier than the Redline core") + // The street core cycles as fast as the Redline (final balance pass); no model cycles faster. + TEST_ASSERT(model.burn_window < core.burn_window && model.burn_cooldown >= core.burn_cooldown, "[model_type] isn't a shorter burn, no faster, than the Redline core") + TEST_ASSERT(model.icon_state != core.icon_state && model.aug_overlay != core.aug_overlay, "[model_type] reuses the Redline core's sprite states") + var/obj/item/organ/cyberimp/cyberware/redline/street/street = allocate(/obj/item/organ/cyberimp/cyberware/redline/street) + var/obj/item/organ/cyberimp/cyberware/redline/milspec/milspec = allocate(/obj/item/organ/cyberimp/cyberware/redline/milspec) + for(var/obj/item/organ/cyberimp/cyberware/redline/model as anything in list(street, milspec)) + var/datum/action/cooldown/cyberware/redline_burn/burn = locate() in model.actions + TEST_ASSERT_NOTNULL(burn, "[model.type] has no Redline Burn button") + TEST_ASSERT_EQUAL(burn.cooldown_time, model.burn_cooldown, "[model.type]'s button doesn't use the core's cooldown") + // The street burn: no stun immunity, its own damage cut, window and crash length. + patient.apply_status_effect(/datum/status_effect/cyberware_redline_window, street) + var/datum/status_effect/cyberware_redline_window/window = patient.has_status_effect(/datum/status_effect/cyberware_redline_window) + TEST_ASSERT_NOTNULL(window, "The street core didn't open a burn window") + TEST_ASSERT(!HAS_TRAIT(patient, TRAIT_STUNIMMUNE), "The street burn granted stun immunity") + TEST_ASSERT_EQUAL(patient.physiology.brute_mod, 0.8, "The street burn didn't cut brute by its own multiplier") + TEST_ASSERT_EQUAL(window.duration - world.time, street.burn_window, "The street burn ignored its window length") + patient.remove_status_effect(/datum/status_effect/cyberware_redline_window) + TEST_ASSERT_EQUAL(patient.physiology.brute_mod, 1, "The street burn left a damage multiplier behind") + var/datum/status_effect/cyberware_redline_crash/crash = patient.has_status_effect(/datum/status_effect/cyberware_redline_crash) + TEST_ASSERT_NOTNULL(crash, "The street burn didn't roll into a crash") + TEST_ASSERT(crash.duration - world.time <= street.burn_crash && crash.duration - world.time > street.burn_crash - 1 SECONDS, "The street crash ignored its length") + patient.remove_status_effect(/datum/status_effect/cyberware_redline_crash) + // The milspec burn holds stuns off, and drops them cleanly. + patient.apply_status_effect(/datum/status_effect/cyberware_redline_window, milspec) + TEST_ASSERT(HAS_TRAIT(patient, TRAIT_STUNIMMUNE), "The milspec burn didn't grant stun immunity") + TEST_ASSERT_EQUAL(patient.physiology.brute_mod, 0.7, "The milspec burn didn't cut brute by its own multiplier") + patient.remove_status_effect(/datum/status_effect/cyberware_redline_window) + TEST_ASSERT(!HAS_TRAIT(patient, TRAIT_STUNIMMUNE), "The milspec burn kept stun immunity after it ended") + TEST_ASSERT_EQUAL(patient.physiology.brute_mod, 1, "The milspec burn left a damage multiplier behind") + patient.remove_status_effect(/datum/status_effect/cyberware_redline_crash) + // With no core named the window runs the Redline core's own numbers. + patient.apply_status_effect(/datum/status_effect/cyberware_redline_window) + TEST_ASSERT_EQUAL(patient.physiology.brute_mod, 0.6, "A bare burn window didn't use the Redline core's numbers") + patient.remove_status_effect(/datum/status_effect/cyberware_redline_window) + patient.remove_status_effect(/datum/status_effect/cyberware_redline_crash) + /datum/unit_test/voidcrew_cyberware_running_gates /datum/unit_test/voidcrew_cyberware_running_gates/Run() @@ -1127,3 +1413,228 @@ node.Remove(patient, TRUE) node.Insert(patient, TRUE) TEST_ASSERT_EQUAL(node.jolt_cooldown, ready_at, "Removal/reinstall reset Lazarus cooldown") + +/// The Cascade line: the street and service models share the lattice's OS slot, +/// carry their own numbers onto the window and crash, and the original lattice +/// keeps every one of its. +/datum/unit_test/voidcrew_cascade_line + +/datum/unit_test/voidcrew_cascade_line/Run() + var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/cascade/lattice = allocate(/obj/item/organ/cyberimp/cyberware/cascade) + var/obj/item/organ/cyberimp/cyberware/cascade/street/street = allocate(/obj/item/organ/cyberimp/cyberware/cascade/street) + var/obj/item/organ/cyberimp/cyberware/cascade/milspec/milspec = allocate(/obj/item/organ/cyberimp/cyberware/cascade/milspec) + TEST_ASSERT_EQUAL(street.slot, lattice.slot, "The street rig isn't in the lattice's OS slot") + TEST_ASSERT_EQUAL(milspec.slot, lattice.slot, "The service lattice isn't in the lattice's OS slot") + TEST_ASSERT(street.chrome_load < milspec.chrome_load && milspec.chrome_load < lattice.chrome_load, "The Cascade line's loads don't climb") + TEST_ASSERT(street.Insert(patient, TRUE), "Street fixture failed") + TEST_ASSERT(milspec.Insert(patient, TRUE), "Service fixture failed") + TEST_ASSERT(!street.owner && milspec.owner == patient, "Two Cascade models shared the OS slot") + + // The original lattice runs on its original numbers. + patient.apply_status_effect(/datum/status_effect/cyberware_cascade_window, lattice) + var/datum/status_effect/cyberware_cascade_window/window = patient.has_status_effect(/datum/status_effect/cyberware_cascade_window) + TEST_ASSERT_NOTNULL(window, "The lattice didn't open a window") + TEST_ASSERT_EQUAL(window.dodge_chance, 60, "The lattice window lost its dodge") + TEST_ASSERT_EQUAL(window.nextmove_modifier(), 0.5, "The lattice window lost its melee boost") + TEST_ASSERT_EQUAL(window.duration, world.time + 8 SECONDS, "The lattice window lost its length") + TEST_ASSERT(patient.has_movespeed_modifier(/datum/movespeed_modifier/cyberware_cascade), "The lattice window lost its gait") + patient.remove_status_effect(/datum/status_effect/cyberware_cascade_window) + var/datum/status_effect/cyberware_cascade_crash/crash = patient.has_status_effect(/datum/status_effect/cyberware_cascade_crash) + TEST_ASSERT_NOTNULL(crash, "The lattice window ended without a crash") + TEST_ASSERT_EQUAL(crash.duration, world.time + 6 SECONDS, "The lattice crash lost its length") + TEST_ASSERT_EQUAL(patient.getStaminaLoss(), 80, "The lattice crash lost its stamina dump") + patient.remove_status_effect(/datum/status_effect/cyberware_cascade_crash) + patient.setStaminaLoss(0) + + // The street rig runs on its own. + patient.apply_status_effect(/datum/status_effect/cyberware_cascade_window, street) + window = patient.has_status_effect(/datum/status_effect/cyberware_cascade_window) + TEST_ASSERT_NOTNULL(window, "The street rig didn't open a window") + TEST_ASSERT_EQUAL(window.dodge_chance, 30, "The street window kept the wrong dodge") + TEST_ASSERT_EQUAL(window.nextmove_modifier(), 0.75, "The street window kept the wrong melee boost") + TEST_ASSERT_EQUAL(window.duration, world.time + 6 SECONDS, "The street window kept the wrong length") + TEST_ASSERT(patient.has_movespeed_modifier(/datum/movespeed_modifier/cyberware_cascade/street), "The street window lost its gait") + TEST_ASSERT(!patient.has_movespeed_modifier(/datum/movespeed_modifier/cyberware_cascade), "The street window kept the lattice's gait") + patient.remove_status_effect(/datum/status_effect/cyberware_cascade_window) + TEST_ASSERT(!patient.has_movespeed_modifier(/datum/movespeed_modifier/cyberware_cascade/street), "The street gait outlived its window") + crash = patient.has_status_effect(/datum/status_effect/cyberware_cascade_crash) + TEST_ASSERT_NOTNULL(crash, "The street window ended without a crash") + TEST_ASSERT_EQUAL(crash.duration, world.time + 8 SECONDS, "The street crash kept the wrong length") + TEST_ASSERT_EQUAL(crash.crash_stamina, 90, "The street crash kept the wrong stamina dump") + TEST_ASSERT_EQUAL(patient.getStaminaLoss(), 90, "The street crash didn't dump its stamina") + TEST_ASSERT(!HAS_TRAIT_FROM(patient, TRAIT_INCAPACITATED, STAMINA), "The street crash floored its user") + patient.remove_status_effect(/datum/status_effect/cyberware_cascade_crash) + + // What Splice quotes for the two lesser models. + build_cyberware_price_index() + var/list/street_price = GLOB.cyberware_price_index[street.type] + var/list/milspec_price = GLOB.cyberware_price_index[milspec.type] + TEST_ASSERT(street_price && street_price["credits"] > 0 && !street_price["vouchers"], "The street rig isn't a credit-priced SKU") + TEST_ASSERT(milspec_price && milspec_price["vouchers"] > 0, "The service lattice isn't a voucher-priced SKU") + +/// A reflex window dodges blows through tg's own check_block(): a dodged knife +/// is a real miss that deals nothing. It never dodges once the bearer is down, +/// never a grab, and never in the crash. The window also raises the crit roll +/// of the bearer's own hits on a standing target, and only during the window. +/datum/unit_test/voidcrew_cascade_blow_dodge + +/datum/unit_test/voidcrew_cascade_blow_dodge/Run() + var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human/consistent) + var/mob/living/carbon/human/attacker = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/cascade/lattice = allocate(/obj/item/organ/cyberimp/cyberware/cascade) + var/obj/item/organ/cyberimp/cyberware/cascade/milspec/milspec = allocate(/obj/item/organ/cyberimp/cyberware/cascade/milspec) + var/obj/item/organ/cyberimp/cyberware/cascade/street/street = allocate(/obj/item/organ/cyberimp/cyberware/cascade/street) + var/obj/item/knife/kitchen/knife = allocate(/obj/item/knife/kitchen) + TEST_ASSERT(attacker.put_in_active_hand(knife), "Attacker fixture failed") + attacker.set_combat_mode(TRUE) + attacker.zone_selected = BODY_ZONE_CHEST + + TEST_ASSERT_EQUAL(street.window_dodge, 30, "The street rig dodges at the wrong chance") + TEST_ASSERT_EQUAL(milspec.window_dodge, 45, "The service lattice dodges at the wrong chance") + TEST_ASSERT_EQUAL(lattice.window_dodge, 60, "The lattice dodges at the wrong chance") + TEST_ASSERT(street.window_crit_bonus < milspec.window_crit_bonus && milspec.window_crit_bonus < lattice.window_crit_bonus, "The crit bonus doesn't climb the Cascade line") + + TEST_ASSERT_EQUAL(attacker.hv_crit_attacker_bonus(patient), 0, "A crit bonus with no window open") + attacker.apply_status_effect(/datum/status_effect/cyberware_cascade_window, lattice) + TEST_ASSERT_EQUAL(attacker.hv_crit_attacker_bonus(patient), lattice.window_crit_bonus, "The window didn't raise its bearer's crit roll") + patient.Knockdown(2 SECONDS) + TEST_ASSERT_EQUAL(attacker.hv_crit_attacker_bonus(patient), 0, "The window's crit bonus reached a helpless victim") + patient.SetKnockdown(0) + patient.set_body_position(STANDING_UP) + attacker.remove_status_effect(/datum/status_effect/cyberware_cascade_window) + TEST_ASSERT_EQUAL(attacker.hv_crit_attacker_bonus(patient), 0, "The crit bonus outlived the window") + attacker.remove_status_effect(/datum/status_effect/cyberware_cascade_crash) + attacker.setStaminaLoss(0) + + // The window, forced to always dodge. + patient.apply_status_effect(/datum/status_effect/cyberware_cascade_window, lattice) + var/datum/status_effect/cyberware_cascade_window/window = patient.has_status_effect(/datum/status_effect/cyberware_cascade_window) + TEST_ASSERT_NOTNULL(window, "The lattice didn't open a window") + window.dodge_chance = 100 + TEST_ASSERT_EQUAL(patient.check_block(knife, knife.force, "the [knife]", MELEE_ATTACK), SUCCESSFUL_BLOCK, "The window didn't dodge a knife") + patient.attacked_by(knife, attacker) + TEST_ASSERT_EQUAL(patient.getBruteLoss(), 0, "A dodged knife still cut") + TEST_ASSERT_EQUAL(patient.check_block(attacker, 0, "[attacker]'s grab", UNARMED_ATTACK), FAILED_BLOCK, "The window dodged a grab") + TEST_ASSERT_EQUAL(patient.check_block(knife, knife.force, "the [knife]", PROJECTILE_ATTACK), FAILED_BLOCK, "The blow dodge took a projectile check") + patient.Knockdown(2 SECONDS) + TEST_ASSERT_EQUAL(patient.check_block(knife, knife.force, "the [knife]", MELEE_ATTACK), FAILED_BLOCK, "The window dodged a blow while knocked down") + patient.SetKnockdown(0) + patient.set_body_position(STANDING_UP) + patient.Stun(2 SECONDS) + TEST_ASSERT_EQUAL(patient.check_block(knife, knife.force, "the [knife]", MELEE_ATTACK), FAILED_BLOCK, "The window dodged a blow while stunned") + patient.SetStun(0) + + // The crash dodges nothing. + patient.remove_status_effect(/datum/status_effect/cyberware_cascade_window) + TEST_ASSERT_NOTNULL(patient.has_status_effect(/datum/status_effect/cyberware_cascade_crash), "The window ended without a crash") + TEST_ASSERT_NULL(patient.GetComponent(/datum/component/cyberware_dodge), "The crash kept a dodge source") + for(var/i in 1 to 10) + TEST_ASSERT_EQUAL(patient.check_block(knife, knife.force, "the [knife]", MELEE_ATTACK), FAILED_BLOCK, "The crash dodged a blow") + patient.attacked_by(knife, attacker) + TEST_ASSERT(patient.getBruteLoss() > 0, "A knife in the crash dealt nothing") + +/// The ripperdoc trade-in, the one ledger that takes chrome bought over a +/// counter. No entry may pay more than half the cheapest shelf price of the +/// piece (a special takes at most 30% off, so a bought piece always sells back +/// at a loss), none may buy back a piece any shop sells for vouchers, and none +/// may reach into the seller's body. Every other ledger and the cargo shuttle +/// still refuse the same piece once it is pulled. +/datum/unit_test/voidcrew_ripperdoc_resale + +/datum/unit_test/voidcrew_ripperdoc_resale/Run() + // Every installable piece any shelf sells: its lowest credit price for one + // piece, and whether any shelf asks vouchers for it. + var/list/lowest_credits = list() + var/list/voucher_sold = list() + for(var/datum/shop_sku/sku_type as anything in subtypesof(/datum/shop_sku)) + var/item_path = initial(sku_type.item_path) + var/list/pieces = list() + if(ispath(item_path, /obj/item/organ)) + pieces += item_path + else if(ispath(item_path, /obj/item/cyberware_pair_case) || ispath(item_path, /obj/item/storage/case/cyberware)) + // A cased set sells every piece inside it for the one price. + var/obj/item/sample = new item_path(null) + for(var/obj/item/organ/held in sample.contents) + pieces += held.type + for(var/atom/movable/packed as anything in sample.contents.Copy()) + qdel(packed) + qdel(sample) + if(!length(pieces)) + continue + var/credits = initial(sku_type.price_credits) + for(var/piece in pieces) + if(initial(sku_type.price_vouchers) > 0) + voucher_sold[piece] = TRUE + if(credits > 0) + var/each = credits / length(pieces) + lowest_credits[piece] = isnull(lowest_credits[piece]) ? each : min(lowest_credits[piece], each) + + var/list/ledger_types = typesof(/datum/shop_buyback/ripperdoc) - /datum/shop_buyback/ripperdoc + TEST_ASSERT(length(ledger_types), "There is no ripperdoc trade-in") + for(var/buyback_type in ledger_types) + var/datum/shop_buyback/ledger = allocate(buyback_type) + TEST_ASSERT(ledger.takes_shop_stock(), "[buyback_type] refuses chrome bought at a counter") + TEST_ASSERT(ledger.pay_credits > 0 && !ledger.pay_vouchers, "[buyback_type] does not pay in credits alone") + var/matched = 0 + for(var/piece in lowest_credits | voucher_sold) + if(ledger.match_subtypes ? !ispath(piece, ledger.item_path) : piece != ledger.item_path) + continue + matched++ + TEST_ASSERT(!voucher_sold[piece], "[buyback_type] buys back [piece], which a shop sells for vouchers") + var/lowest = lowest_credits[piece] + if(isnull(lowest)) + continue + TEST_ASSERT(ledger.pay_credits * 2 <= lowest, "[buyback_type] pays [ledger.pay_credits] cr for [piece], more than half its lowest shelf price ([lowest] cr)") + // The deepest special (shop.dm roll_special, 30% off) still loses money. + TEST_ASSERT(ledger.pay_credits < max(5, round(lowest * 70 / 100, 5)), "[buyback_type] pays more for [piece] than it costs on special") + TEST_ASSERT(matched, "[buyback_type] buys back a piece no shelf sells") + + // One street core, bought, installed, pulled and sold back. + var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human/consistent, run_loc_floor_bottom_left) + var/obj/item/card/id/id = allocate(/obj/item/card/id) + id.registered_account = allocate(/datum/bank_account, "Ripperdoc resale test", null, 1, FALSE) + patient.put_in_active_hand(id) + var/datum/bank_account/account = id.registered_account + var/datum/shop_sku/sku = allocate(/datum/shop_sku/ripperdoc/redline_street) + var/obj/item/organ/cyberimp/cyberware/redline/street/core = sku.dispense(patient, null) + TEST_ASSERT(istype(core), "The street core's shelf handed over [core]") + TEST_ASSERT(is_trader_good(core), "Chrome bought at the counter came without the shop mark") + patient.dropItemToGround(core) + TEST_ASSERT(core.Insert(patient, special = TRUE), "The bought core would not install") + + var/datum/shop_buyback/splice = allocate(/datum/shop_buyback/ripperdoc/redline_street) + var/datum/shop_buyback/ratchet = allocate(/datum/shop_buyback/ripperdoc/redline_street/street_doc) + splice.demand = 2 + var/balance = account.account_balance + TEST_ASSERT_EQUAL(splice.count_carried_units(patient), 0, "The trade-in offered to buy a core still installed in its owner") + TEST_ASSERT(!splice.try_sell(patient, null), "The trade-in bought a core out of a living chest") + TEST_ASSERT(!QDELETED(core) && core.owner == patient, "A trade-in took chrome out of its owner") + TEST_ASSERT_EQUAL(account.account_balance, balance, "A refused trade-in paid out") + + core.Remove(patient, special = TRUE) + patient.put_in_hands(core) + TEST_ASSERT(is_trader_good(core), "Pulling the core wiped its shop mark") + + // Nobody else buys it: a plain ledger for this exact piece, every other + // ledger in the game, or the cargo shuttle. + var/datum/shop_buyback/any_ledger = allocate(/datum/shop_buyback) + any_ledger.item_path = core.type + any_ledger.pay_credits = 10 + TEST_ASSERT(!any_ledger.matches(core), "A plain ledger for this very core bought it") + for(var/buyback_type in subtypesof(/datum/shop_buyback)) + if(ispath(buyback_type, /datum/shop_buyback/ripperdoc)) + continue + var/datum/shop_buyback/other = allocate(buyback_type) + if(other.item_path) + TEST_ASSERT(!other.matches(core), "[buyback_type] bought back chrome sold at a counter") + var/datum/export/export = allocate(/datum/export) + export.export_types = typecacheof(list(core.type)) + TEST_ASSERT(!export.applies_to(core), "Cargo would export chrome sold at a counter") + + // Both ripperdocs take it, at half list. + TEST_ASSERT(ratchet.matches(core), "The street doc won't take back chrome a ripperdoc sold") + TEST_ASSERT(splice.try_sell(patient, null), "Splice won't take back chrome a ripperdoc sold") + TEST_ASSERT(QDELETED(core), "The sold core stayed with the seller") + TEST_ASSERT_EQUAL(account.account_balance, balance + splice.pay_credits, "The trade-in paid the wrong amount") + TEST_ASSERT_EQUAL(splice.pay_credits * 2, sku.price_credits, "The street core does not sell back at half list") diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware_anim.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware_anim.dm new file mode 100644 index 00000000000..0565f4a137a --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware_anim.dm @@ -0,0 +1,226 @@ +/** + * # Chrome animations + * + * The animations only draw, but they leave things on a body while they play: + * holders in vis_contents, filters, worn looks and pending frames. These check + * that each animation puts them on and that they come off again when it is cut + * short: the blade stowed, the chrome pulled, the field broken, the bearer dead. + * + * Unit-test files compile before voidcrew/_DEFINES/ and the module's own + * defines are local, so looks and filter names are literals here. + */ + +/// TRUE if any chrome animation holder is still drawn on [bearer]. +/proc/voidcrew_test_has_chrome_anim(atom/movable/bearer) + return !!(locate(/obj/effect/abstract/cyberware_anim) in bearer.vis_contents) + +/// Mantis: the swing rides the bearer, the fold replaces the unfold, and +/// pulling the housing takes the swing and the folded-housing wait with it. +/datum/unit_test/voidcrew_cyberware_anim_blade + +/datum/unit_test/voidcrew_cyberware_anim_blade/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis) + TEST_ASSERT(housing.Insert(bearer, special = TRUE), "Test fixture: Mantis housing insert refused") + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade = housing.contents[1] + + housing.Extend(blade) + TEST_ASSERT(bearer.is_holding(blade), "Test fixture: the blade never reached a hand") + var/obj/effect/abstract/cyberware_anim/unfold = housing.blade_anim() + TEST_ASSERT(unfold && (unfold in bearer.vis_contents), "The blade swing didn't play on the bearer") + TEST_ASSERT_EQUAL(unfold.icon_state, "mantis_unfold_right", "The right housing played the wrong swing") + TEST_ASSERT(blade.inhand_hidden_until > world.time, "The held blade draws before the swing has played") + + housing.Retract() + TEST_ASSERT(QDELETED(unfold), "Stowing the blade left the unfold swing playing") + var/obj/effect/abstract/cyberware_anim/fold = housing.blade_anim() + TEST_ASSERT(fold && (fold in bearer.vis_contents), "The blade didn't fold back in") + TEST_ASSERT_EQUAL(fold.icon_state, "mantis_fold_right", "The right housing folded the wrong swing") + TEST_ASSERT_EQUAL(housing.cyberware_worn_look(), "fold", "The folded housing draws over the fold swing") + TEST_ASSERT(findtext(bearer.icon_render_keys[BODY_ZONE_R_ARM], "fold"), "The arm wasn't redrawn for the fold") + + // A blade knocked out of the hand is stowed without a fold. + housing.Extend(blade) + bearer.dropItemToGround(blade, force = TRUE) + housing.Retract() + TEST_ASSERT(isnull(housing.cyberware_worn_look()), "A blade stowed off the floor hid the housing for a fold") + + housing.Extend(blade) + var/obj/effect/abstract/cyberware_anim/last_swing = housing.blade_anim() + TEST_ASSERT(last_swing, "Test fixture: the last swing never played") + housing.Remove(bearer, special = TRUE) + TEST_ASSERT(QDELETED(last_swing) && isnull(housing.blade_anim_ref), "Pulling the housing left its swing") + TEST_ASSERT(!voidcrew_test_has_chrome_anim(bearer), "Pulling the housing left a swing drawn on the body") + TEST_ASSERT(!housing.fold_hide_until && !housing.fold_timer, "Pulling the housing left the folded housing waiting") + TEST_ASSERT(!blade.inhand_hidden_until, "A pulled housing's blade stays hidden in its next hand") + +/// Ghostskin: the field flickers in to plain field alpha with nothing else on +/// the bearer, and every way out (run out, switched off, knocked down, pulled, +/// dead) ends at full view, back where the body started, with nothing left on it. +/datum/unit_test/voidcrew_cyberware_anim_cloak + +/datum/unit_test/voidcrew_cyberware_anim_cloak/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/ghostskin/weave = allocate(/obj/item/organ/cyberimp/cyberware/ghostskin) + TEST_ASSERT(weave.Insert(bearer, special = TRUE), "Test fixture: Ghostskin insert refused") + var/filters_before = length(bearer.filter_data) + var/rest_w = bearer.pixel_w + + weave.engage_camo(bearer) + TEST_ASSERT_EQUAL(bearer.alpha, 40, "The flicker doesn't end at the field's alpha") + TEST_ASSERT_EQUAL(bearer.pixel_w, rest_w, "The flicker's jumps don't add up to nothing") + TEST_ASSERT(weave.cloak_enter_until > world.time, "Nothing keeps a step from cutting the flicker short") + TEST_ASSERT_EQUAL(length(bearer.filter_data), filters_before, "The field put a filter on its bearer") + TEST_ASSERT(!voidcrew_test_has_chrome_anim(bearer), "The field put a drawing on its bearer") + weave.cloak_enter_until = 0 + weave.on_camo_move(bearer) + TEST_ASSERT_EQUAL(bearer.alpha, 40, "Moving under the field left the bearer brighter") + + // Run out: the gentle way back. + weave.on_field_expired() + TEST_ASSERT(!weave.camo_active, "Test fixture: the field didn't run out") + TEST_ASSERT_EQUAL(bearer.alpha, 255, "A field that ran out left its bearer faded") + TEST_ASSERT_EQUAL(bearer.pixel_w, rest_w, "The way back out left the body off to one side") + + // Knocked down: the sharp way back. + weave.engage_camo(bearer) + weave.break_camo(bearer, reason = "test") + TEST_ASSERT_EQUAL(bearer.alpha, 255, "A knocked-down field left its bearer faded") + TEST_ASSERT_EQUAL(bearer.pixel_w, rest_w, "The knock left the body off to one side") + TEST_ASSERT_EQUAL(length(bearer.filter_data), filters_before, "A broken field left a filter behind") + TEST_ASSERT(!voidcrew_test_has_chrome_anim(bearer), "A broken field left a drawing behind") + + // Switched off by hand. + var/datum/action/cooldown/cyberware/ghostskin_cloak/button = locate() in weave.actions + weave.engage_camo(bearer) + button.Activate(bearer) + TEST_ASSERT(!weave.camo_active, "Test fixture: the button didn't drop the field") + TEST_ASSERT_EQUAL(bearer.alpha, 255, "A field switched off left its bearer faded") + + // Pulled mid-flicker, and dead mid-field. + weave.engage_camo(bearer) + weave.Remove(bearer, special = TRUE) + TEST_ASSERT_EQUAL(bearer.alpha, 255, "A weave pulled mid-flicker left its bearer faded") + TEST_ASSERT_EQUAL(bearer.pixel_w, rest_w, "A weave pulled mid-flicker left the body off to one side") + TEST_ASSERT(!weave.cloak_enter_until, "A pulled weave still holds off the moving flash") + + var/mob/living/carbon/human/doomed = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/ghostskin/street/rag = allocate(/obj/item/organ/cyberimp/cyberware/ghostskin/street) + TEST_ASSERT(rag.Insert(doomed, special = TRUE), "Test fixture: Flickerskin insert refused") + var/doomed_filters = length(doomed.filter_data) + rag.engage_camo(doomed) + TEST_ASSERT_EQUAL(doomed.alpha, 60, "Flickerskin doesn't flicker down to its own alpha") + doomed.death() + TEST_ASSERT(!rag.camo_active, "Test fixture: death didn't drop the field") + TEST_ASSERT_EQUAL(doomed.alpha, 255, "Death left the body faded") + TEST_ASSERT(length(doomed.filter_data) <= doomed_filters, "Death left a filter on the body") + +/// Cascade: the window lights the spine, the crash kills it, the crash ending +/// puts the plain lattice back, and a lattice pulled mid-window leaves no frames. +/datum/unit_test/voidcrew_cyberware_anim_cascade + +/datum/unit_test/voidcrew_cyberware_anim_cascade/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/cascade/lattice = allocate(/obj/item/organ/cyberimp/cyberware/cascade) + TEST_ASSERT(lattice.Insert(bearer, special = TRUE), "Test fixture: Cascade insert refused") + + bearer.apply_status_effect(/datum/status_effect/cyberware_cascade_window, lattice) + TEST_ASSERT_EQUAL(lattice.node_look, "boot1", "The spine didn't start lighting when the window opened") + TEST_ASSERT(lattice.node_timer, "The spine lit one node and stopped") + TEST_ASSERT(lattice.ring_timer, "No ring is coming") + TEST_ASSERT(findtext(bearer.icon_render_keys[BODY_ZONE_CHEST], "boot1"), "The chest wasn't redrawn for the node frame") + var/list/images = lattice.bodypart_aug.get_overlay(EXTERNAL_ADJACENT, bearer.get_bodypart(BODY_ZONE_CHEST)) + var/found_nodes = FALSE + for(var/image/part as anything in images) + if(part.icon_state == "cascade_boot1") + found_nodes = TRUE + // CYBERWARE_SPINE_SHINE_LAYER; the chrome itself sits at CYBERWARE_WORN_LAYER, 27.6. Both are defined after the tests. + TEST_ASSERT_EQUAL(part.layer, -13.7, "Lit nodes don't shine through what is worn on the back") + TEST_ASSERT(found_nodes, "The node frame isn't drawn over the lattice") + // A dying frame is split: what still glows shines through, the dead nodes stay under the clothes. + lattice.node_look = "crash3" + var/found_lit = FALSE + var/found_dark = FALSE + for(var/image/part as anything in lattice.bodypart_aug.get_overlay(EXTERNAL_ADJACENT, bearer.get_bodypart(BODY_ZONE_CHEST))) + if(part.icon_state == "cascade_crash3_lit" && part.layer == -13.7) + found_lit = TRUE + if(part.icon_state == "cascade_crash3_dark" && part.layer == -27.6) + found_dark = TRUE + TEST_ASSERT(found_lit, "The nodes still lit in a dying frame don't shine through") + TEST_ASSERT(found_dark, "The dead nodes of a dying frame aren't under the clothes") + lattice.node_look = "dead" + for(var/image/part as anything in lattice.bodypart_aug.get_overlay(EXTERNAL_ADJACENT, bearer.get_bodypart(BODY_ZONE_CHEST))) + TEST_ASSERT(part.layer != -13.7, "A dead spine still draws over what is worn on the back") + lattice.node_look = "boot1" + + bearer.remove_status_effect(/datum/status_effect/cyberware_cascade_window) + TEST_ASSERT(bearer.has_status_effect(/datum/status_effect/cyberware_cascade_crash), "Test fixture: no crash after the window") + TEST_ASSERT_EQUAL(lattice.node_look, "crash1", "The spine didn't start dying with the crash") + TEST_ASSERT(!lattice.ring_timer, "The ring rolls out after the window closed") + + bearer.remove_status_effect(/datum/status_effect/cyberware_cascade_crash) + TEST_ASSERT_NULL(lattice.node_look, "The crash ended on a node frame") + TEST_ASSERT(!lattice.node_timer, "Node frames keep playing after the crash") + + bearer.apply_status_effect(/datum/status_effect/cyberware_cascade_window, lattice) + lattice.Remove(bearer, special = TRUE) + TEST_ASSERT_NULL(lattice.node_look, "A lattice pulled mid-window kept its node frame") + TEST_ASSERT(!lattice.node_timer && !lattice.ring_timer, "A lattice pulled mid-window kept playing") + +/// EMP: every worn piece gets the static look and joins one show; the show +/// ends with its bearer, and the reboot and a tune-up both clear the look. +/datum/unit_test/voidcrew_cyberware_anim_emp + +/datum/unit_test/voidcrew_cyberware_anim_emp/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm = allocate(/obj/item/organ/cyberimp/cyberware/gorilla_arms) + var/obj/item/organ/cyberimp/cyberware/cascade/lattice = allocate(/obj/item/organ/cyberimp/cyberware/cascade) + TEST_ASSERT(arm.Insert(bearer, special = TRUE), "Test fixture: Gorilla Arms insert refused") + TEST_ASSERT(lattice.Insert(bearer, special = TRUE), "Test fixture: Cascade insert refused") + var/datum/component/cyberware/arm_chrome = arm.GetComponent(/datum/component/cyberware) + var/datum/component/cyberware/spine_chrome = lattice.GetComponent(/datum/component/cyberware) + + arm_chrome.start_emp_reboot() + spine_chrome.start_emp_reboot() + var/datum/component/chrome_emp_show/show = bearer.GetComponent(/datum/component/chrome_emp_show) + TEST_ASSERT(show, "An EMP on worn chrome put on no show") + TEST_ASSERT_EQUAL(length(show.crackling), 2, "Two pieces hit on one tick aren't one burst") + TEST_ASSERT_EQUAL(arm.cyberware_worn_look(), "static", "An EMP'd piece doesn't fill with static") + var/list/images = arm.bodypart_aug.get_overlay(EXTERNAL_ADJACENT, bearer.get_bodypart(BODY_ZONE_R_ARM)) + var/image/plate = images[1] + TEST_ASSERT(plate.appearance_flags & KEEP_TOGETHER, "The static isn't clipped to the piece") + + bearer.death() + TEST_ASSERT(QDELETED(show), "The EMP show outlived its bearer") + TEST_ASSERT(!voidcrew_test_has_chrome_anim(bearer), "Arcs or sparks stayed on a dead bearer") + TEST_ASSERT_EQUAL(arm.cyberware_worn_look(), "dark", "Dead, the EMP'd chrome isn't drawn dark") + images = arm.bodypart_aug.get_overlay(EXTERNAL_ADJACENT, bearer.get_bodypart(BODY_ZONE_R_ARM)) + plate = images[1] + TEST_ASSERT(islist(plate.color), "A dark piece isn't drawn dark") + + arm_chrome.finish_emp_reboot() + TEST_ASSERT_NULL(arm.cyberware_worn_look(), "A rebooted piece kept a look") + spine_chrome.tune_up() + TEST_ASSERT_NULL(lattice.cyberware_worn_look(), "A tuned-up piece kept a look") + + // Pulled while crackling: the piece drops its look, the show carries on without it. + var/mob/living/carbon/human/next_bearer = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/left/left_arm = allocate(/obj/item/organ/cyberimp/cyberware/gorilla_arms/left) + TEST_ASSERT(left_arm.Insert(next_bearer, special = TRUE), "Test fixture: left Gorilla Arms insert refused") + var/datum/component/cyberware/left_chrome = left_arm.GetComponent(/datum/component/cyberware) + left_chrome.start_emp_reboot() + TEST_ASSERT(next_bearer.GetComponent(/datum/component/chrome_emp_show), "Test fixture: no show on the second bearer") + left_arm.Remove(next_bearer, special = TRUE) + TEST_ASSERT_NULL(left_chrome.emp_look, "A piece pulled mid-EMP kept its static") + +/// Skin plating is skin: it draws under the clothes with stock augments, while the rest of the chrome stays over +/// the jumpsuit. +/datum/unit_test/voidcrew_cyberware_anim_skin_plating + +/datum/unit_test/voidcrew_cyberware_anim_skin_plating/Run() + for(var/plating_type in list(/obj/item/organ/cyberimp/cyberware/slabskin, /obj/item/organ/cyberimp/cyberware/dermal_mesh, /obj/item/organ/cyberimp/cyberware/dermal_mesh/hardweave)) + var/obj/item/organ/cyberimp/cyberware/plating = allocate(plating_type) + TEST_ASSERT_EQUAL(plating.bodypart_aug.bitflag_to_layer(EXTERNAL_ADJACENT), -BODY_ADJ_LAYER, "[plating_type] draws over clothes") + // CYBERWARE_WORN_LAYER, which is defined after the tests. + var/obj/item/organ/cyberimp/cyberware/cascade/lattice = allocate(/obj/item/organ/cyberimp/cyberware/cascade) + TEST_ASSERT_EQUAL(lattice.bodypart_aug.bitflag_to_layer(EXTERNAL_ADJACENT), -27.6, "The spine rig dropped under the jumpsuit") diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware_anim2.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware_anim2.dm new file mode 100644 index 00000000000..48bca84064a --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware_anim2.dm @@ -0,0 +1,361 @@ +/** + * # Chrome animations, second batch + * + * Like the first batch's tests: each animation puts its holders, filters, + * looks and timers on, and they come off again when it ends or is cut short + * (the chrome pulled, the bearer dead, the sequence cancelled). + * + * Unit-test files compile before voidcrew/_DEFINES/ and the module's own + * defines are local, so looks, states and filter names are literals here. + */ + +/// TRUE if a chrome animation holder playing [state] is drawn on [bearer]. +/proc/voidcrew_test_anim_state(atom/movable/bearer, state) + for(var/obj/effect/abstract/cyberware_anim/holder in bearer.vis_contents) + if(holder.icon_state == state) + return TRUE + return FALSE + +/// Redline: the window lights the nodes and the halo, the crash cools them and +/// slumps the body, and the end, a death or a pulled core leaves nothing behind. +/datum/unit_test/voidcrew_cyberware_anim2_redline + +/datum/unit_test/voidcrew_cyberware_anim2_redline/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/redline/core = allocate(/obj/item/organ/cyberimp/cyberware/redline) + TEST_ASSERT(core.Insert(bearer, special = TRUE), "Test fixture: Redline insert refused") + + bearer.apply_status_effect(/datum/status_effect/cyberware_redline_window, core) + TEST_ASSERT_EQUAL(core.burn_look, "flash", "The nodes didn't flash when the burn kicked in") + TEST_ASSERT(core.burn_look_timer, "The nodes flashed and never ran red") + TEST_ASSERT(findtext(bearer.icon_render_keys[BODY_ZONE_CHEST], "flash"), "The chest wasn't redrawn for the flash") + TEST_ASSERT(bearer.get_filter("cyberware_redline_window"), "The burn has no red outline") + TEST_ASSERT(core.burn_light_ref?.resolve(), "The burn throws no light") + TEST_ASSERT((locate(/obj/effect/temp_visual/circle_wave/cyberware_roar) in get_turf(bearer)), "The roar rolled no ring") + core.set_burn_look("hot") + var/found_nodes = FALSE + var/found_eyes = FALSE + for(var/image/part as anything in core.bodypart_aug.get_overlay(EXTERNAL_ADJACENT, bearer.get_bodypart(BODY_ZONE_CHEST))) + if(part.icon_state == "redline_hot") + found_nodes = TRUE + TEST_ASSERT_EQUAL(part.layer, -13.7, "Red-hot nodes don't shine through what is worn on the back") + if(part.icon_state == "eyes_l") + found_eyes = TRUE + TEST_ASSERT(found_nodes, "The red-hot nodes aren't drawn over the core") + TEST_ASSERT(found_eyes, "The eyes don't flood red") + + bearer.remove_status_effect(/datum/status_effect/cyberware_redline_window) + TEST_ASSERT(bearer.has_status_effect(/datum/status_effect/cyberware_redline_crash), "Test fixture: no crash after the window") + TEST_ASSERT_EQUAL(core.burn_look, "surge", "The spine doesn't run white as the crash begins") + var/found_spine = FALSE + for(var/image/part as anything in core.bodypart_aug.get_overlay(EXTERNAL_ADJACENT, bearer.get_bodypart(BODY_ZONE_CHEST))) + if(part.icon_state == "redline_surge") + found_spine = TRUE + TEST_ASSERT(found_spine, "The white spine isn't drawn over the core") + TEST_ASSERT(core.burn_look_timer, "The charge never leaves the spine") + TEST_ASSERT(!bearer.get_filter("cyberware_redline_window"), "The red outline outlived the window") + TEST_ASSERT(bearer.get_filter("cyberware_redline_gutter"), "The outline goes out without a stutter") + // Its stutters by hand. Each is stored, so anything that rebuilds the body's filters meanwhile can't relight it. + core.gutter_burn(WEAKREF(bearer), 1) + TEST_ASSERT_EQUAL(bearer.filter_data["cyberware_redline_gutter"]["color"], "#ff2a2a00", "The guttering outline doesn't go out between stutters") + core.gutter_burn(WEAKREF(bearer), 5) + TEST_ASSERT(!bearer.get_filter("cyberware_redline_gutter"), "The outline never finishes guttering out") + TEST_ASSERT(!core.burn_light_ref?.resolve(), "The red light outlived the window") + TEST_ASSERT(bearer.get_filter("cyberware_redline_sag"), "The crash doesn't slump the body") + // The charge leaves the spine: the nodes cool, the eyes dim, and arcs crawl out across the deck under the body. + core.ground_burn() + TEST_ASSERT_EQUAL(core.burn_look, "cool1", "The nodes didn't start cooling once the charge left them") + var/obj/effect/temp_visual/cyberware_redline_ground/arcs = locate() in get_turf(bearer) + TEST_ASSERT_NOTNULL(arcs, "The charge never earths through the deck") + TEST_ASSERT_EQUAL(PLANE_TO_TRUE(arcs.plane), FLOOR_PLANE, "The arcs on the deck draw over the people standing on it") + TEST_ASSERT_EQUAL(arcs.pixel_y, 0, "The arcs on the deck sort a row forward of their own tile") + TEST_ASSERT(icon_exists(arcs.icon, arcs.icon_state), "The arcs on the deck have no picture") + var/found_dying_eyes = FALSE + for(var/image/part as anything in core.bodypart_aug.get_overlay(EXTERNAL_ADJACENT, bearer.get_bodypart(BODY_ZONE_CHEST))) + if(part.icon_state == "eyes_l") + found_dying_eyes = TRUE + TEST_ASSERT(found_dying_eyes, "The red goes out of the eyes at once, with no dying flicker") + + bearer.remove_status_effect(/datum/status_effect/cyberware_redline_crash) + TEST_ASSERT_NULL(core.burn_look, "The nodes kept a look after the crash") + // A living body eases up out of the slump, and the filter comes off once it is flat. + TEST_ASSERT_EQUAL(bearer.filter_data?["cyberware_redline_sag"]?["size"], 0, "The body doesn't straighten up when the crash ends") + cyberware_redline_straightened(WEAKREF(bearer)) + TEST_ASSERT(!bearer.get_filter("cyberware_redline_sag"), "The slump outlived the crash") + TEST_ASSERT(!bearer.get_filter("cyberware_redline_gutter"), "The outline's last stutter outlived the crash") + TEST_ASSERT(!core.burn_look_timer, "Node looks keep coming after the crash") + + // Dead mid-burn: the picture goes at once, though the window runs on. + bearer.apply_status_effect(/datum/status_effect/cyberware_redline_window, core) + bearer.death() + TEST_ASSERT_NULL(core.burn_look, "A dead body kept its red-hot nodes") + TEST_ASSERT(!bearer.get_filter("cyberware_redline_window"), "A dead body kept the red outline") + TEST_ASSERT(!core.burn_light_ref?.resolve(), "A dead body kept the red light") + + // Pulled mid-crash: nothing stays on the old bearer. + var/mob/living/carbon/human/next_bearer = allocate(/mob/living/carbon/human/consistent) + core.Remove(bearer, special = TRUE) + TEST_ASSERT(core.Insert(next_bearer, special = TRUE), "Test fixture: Redline reinsert refused") + next_bearer.apply_status_effect(/datum/status_effect/cyberware_redline_window, core) + next_bearer.remove_status_effect(/datum/status_effect/cyberware_redline_window) + core.Remove(next_bearer, special = TRUE) + TEST_ASSERT_NULL(core.burn_look, "A pulled core kept its node look") + TEST_ASSERT(!next_bearer.get_filter("cyberware_redline_sag"), "A pulled core left the slump") + TEST_ASSERT(!next_bearer.get_filter("cyberware_redline_gutter"), "A pulled core left the outline stuttering") + TEST_ASSERT(!core.burn_look_timer, "A pulled core still earths its charge") + +/// Lazarus: crit starts the charge, death or a pulled node ends it, and the +/// jolt flashes, bursts and springs the patient without leaving anything on. +/datum/unit_test/voidcrew_cyberware_anim2_lazarus + +/datum/unit_test/voidcrew_cyberware_anim2_lazarus/Run() + var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/lazarus/node = allocate(/obj/item/organ/cyberimp/cyberware/lazarus) + TEST_ASSERT(node.Insert(patient, special = TRUE), "Test fixture: Lazarus insert refused") + + patient.adjustBruteLoss(120) + TEST_ASSERT(patient.stat == SOFT_CRIT || patient.stat == HARD_CRIT, "Test fixture: the patient isn't in crit") + TEST_ASSERT(node.jolting, "Test fixture: crit didn't start the windup") + TEST_ASSERT(voidcrew_test_anim_state(patient, "lazarus_charge"), "The windup has no charge glow") + TEST_ASSERT(voidcrew_test_anim_state(patient, "lazarus_arcs"), "The windup has no arcs") + TEST_ASSERT(patient.get_filter("cyberware_lazarus_charge"), "The windup doesn't light the body") + + node.jolt(node.jolt_generation, WEAKREF(patient)) + TEST_ASSERT(patient.stat != DEAD, "Test fixture: the jolt didn't take") + TEST_ASSERT(!voidcrew_test_anim_state(patient, "lazarus_charge"), "The charge glow outlived the jolt") + TEST_ASSERT(!patient.get_filter("cyberware_lazarus_charge"), "The charge's halo outlived the jolt") + TEST_ASSERT(voidcrew_test_anim_state(patient, "lazarus_jolt"), "The jolt has no burst") + TEST_ASSERT(patient.get_filter("cyberware_flash"), "The jolt has no flash") + TEST_ASSERT_EQUAL(patient.has_offset("cyberware_lazarus_spring", PIXEL_Z_OFFSET), 3, "The jolt doesn't spring the patient up") + + // Dead during the windup: the charge dies with them. + var/mob/living/carbon/human/doomed = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/lazarus/second_node = allocate(/obj/item/organ/cyberimp/cyberware/lazarus) + TEST_ASSERT(second_node.Insert(doomed, special = TRUE), "Test fixture: second Lazarus insert refused") + second_node.play_charge_fx(doomed, 1 SECONDS) + doomed.death() + TEST_ASSERT(!(locate(/obj/effect/abstract/cyberware_anim) in doomed.vis_contents), "The charge played on a corpse") + TEST_ASSERT(!doomed.get_filter("cyberware_lazarus_charge"), "The charge's halo stayed on a corpse") + + // Pulled during the windup. + var/mob/living/carbon/human/donor = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/lazarus/third_node = allocate(/obj/item/organ/cyberimp/cyberware/lazarus) + TEST_ASSERT(third_node.Insert(donor, special = TRUE), "Test fixture: third Lazarus insert refused") + third_node.play_charge_fx(donor, 1 SECONDS) + third_node.Remove(donor, special = TRUE) + TEST_ASSERT(!(locate(/obj/effect/abstract/cyberware_anim) in donor.vis_contents), "A pulled node left its charge") + TEST_ASSERT(!donor.get_filter("cyberware_lazarus_charge"), "A pulled node left the charge's halo") + +/// Leaps: take-off carries the drawing over to the landing and only the drawing, drawn over whoever stands on its +/// row; the fall brings it down as the landing is due; touchdown gives it back without a glide; a leap up or down +/// the screen moves its place in the front-to-back order with it; a leap that never lands is put down anyway. +/datum/unit_test/voidcrew_cyberware_anim2_leap + +/datum/unit_test/voidcrew_cyberware_anim2_leap/Run() + var/turf/start = run_loc_floor_bottom_left + var/turf/landing = locate(start.x + 2, start.y, start.z) + TEST_ASSERT(landing && landing.x <= run_loc_floor_top_right.x, "Test fixture: the test room is too narrow for a two-tile leap") + var/mob/living/carbon/human/jumper = allocate(/mob/living/carbon/human/consistent, start) + + var/ground_layer = jumper.layer + cyberware_leap_takeoff_fx(jumper, start, landing, 0.2 SECONDS, 20, 26) + TEST_ASSERT_EQUAL(jumper.loc, start, "The take-off moved the body") + TEST_ASSERT_EQUAL(jumper.pixel_w, 64, "The leap's drawing doesn't end over the landing") + TEST_ASSERT_EQUAL(jumper.pixel_z, 26, "The leap's drawing doesn't rise") + cyberware_leap_fall_fx(WEAKREF(jumper), 0.1 SECONDS) + TEST_ASSERT_EQUAL(jumper.pixel_z, 0, "The leap's drawing isn't down on the floor when its landing is due") + TEST_ASSERT(jumper.layer > ground_layer, "A leaping body doesn't draw over the people on its row") + TEST_ASSERT((locate(/obj/effect/temp_visual/cyberware_leap_shadow) in start), "The leap has no floor shadow") + TEST_ASSERT(jumper.cyberware_leap_until, "Nothing watches for a leap that never lands") + + cyberware_leap_touchdown_fx(jumper) + TEST_ASSERT_EQUAL(jumper.pixel_w, 0, "The landing left the drawing to one side") + TEST_ASSERT_EQUAL(jumper.pixel_z, 0, "The landing left the drawing in the air") + TEST_ASSERT_EQUAL(jumper.layer, ground_layer, "The landing left the body drawn over everyone") + TEST_ASSERT_EQUAL(jumper.animate_movement, NO_STEPS, "The move onto the landing tile would glide after the arc") + cyberware_leap_steps_back(WEAKREF(jumper)) + TEST_ASSERT_EQUAL(jumper.animate_movement, SLIDE_STEPS, "A landed body's steps never glide again") + TEST_ASSERT(!jumper.cyberware_leap_until, "A landed leap is still watched") + + // One tile arcs like any other: the landing never glides, so there is nothing to hide by hopping in place. + cyberware_leap_takeoff_fx(jumper, start, get_step(start, EAST), 0.2 SECONDS, 20, 26) + TEST_ASSERT_EQUAL(jumper.pixel_w, 32, "A one-tile leap doesn't travel") + cyberware_leap_touchdown_fx(jumper) + + // Up the screen the run is pixel_y, so the body's place in the front-to-back order goes with it. + cyberware_leap_takeoff_fx(jumper, start, get_step(start, NORTH), 0.2 SECONDS, 20, 26) + TEST_ASSERT_EQUAL(jumper.pixel_y, 32, "A leap up the screen keeps its launch row's place in the draw order") + cyberware_leap_touchdown_fx(jumper) + TEST_ASSERT_EQUAL(jumper.pixel_y, 0, "The landing left the drawing up the screen") + + // The pistons pulled mid-air: no landing ever runs, the failsafe puts the body down. + cyberware_leap_takeoff_fx(jumper, start, landing, 0.2 SECONDS, 20, 26) + jumper.cyberware_leap_until = world.time + cyberware_leap_failsafe(WEAKREF(jumper)) + TEST_ASSERT_EQUAL(jumper.pixel_w, 0, "A leap that never landed stayed to one side") + TEST_ASSERT_EQUAL(jumper.pixel_z, 0, "A leap that never landed stayed in the air") + TEST_ASSERT_EQUAL(jumper.layer, ground_layer, "A leap that never landed stayed drawn over everyone") + + // The real button, end to end. + var/obj/item/organ/cyberimp/cyberware/hopper/pistons = allocate(/obj/item/organ/cyberimp/cyberware/hopper) + TEST_ASSERT(pistons.Insert(jumper, special = TRUE), "Test fixture: Hopper insert refused") + var/datum/action/cooldown/cyberware/hopper_leap/action = locate() in pistons.actions + TEST_ASSERT(action.Activate(landing), "Test fixture: the leap refused a clear two-tile jump") + TEST_ASSERT_EQUAL(jumper.loc, start, "The leap moved the body before it landed") + TEST_ASSERT_EQUAL(jumper.pixel_w, 64, "The Hopper's arc doesn't travel") + action.land(landing) + TEST_ASSERT_EQUAL(jumper.loc, landing, "The leap landed somewhere else") + TEST_ASSERT_EQUAL(jumper.pixel_w, 0, "The Hopper landed off to one side") + TEST_ASSERT_EQUAL(jumper.pixel_z, 0, "The Hopper landed in the air") + TEST_ASSERT_EQUAL(jumper.layer, ground_layer, "The Hopper landed still drawn over everyone") + + // The Piledriver's impact cracks the floor and leaves it alone afterwards. + cyberware_piledriver_impact_fx(landing, 2) + var/obj/effect/temp_visual/cyberware_impact_cracks/cracks = locate() in landing + TEST_ASSERT(cracks, "The impact left no cracks") + TEST_ASSERT(cracks.timerid, "The cracks never clean themselves up") + +/// Brownout: worn chrome stutters together and the show leaves no looks behind, +/// on its own, on recovery and on death. +/datum/unit_test/voidcrew_cyberware_anim2_brownout + +/datum/unit_test/voidcrew_cyberware_anim2_brownout/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/cascade/lattice = allocate(/obj/item/organ/cyberimp/cyberware/cascade) + var/obj/item/organ/cyberimp/cyberware/test_heavy/heavy = allocate(/obj/item/organ/cyberimp/cyberware/test_heavy) + var/obj/item/organ/cyberimp/cyberware/test_overflow/overflow = allocate(/obj/item/organ/cyberimp/cyberware/test_overflow) + TEST_ASSERT(lattice.Insert(bearer, special = TRUE), "Test fixture: Cascade insert refused") + var/datum/component/cyberware/chrome = lattice.GetComponent(/datum/component/cyberware) + + // At rest the lattice breathes: its LEDs replace the still glow. + var/found_led = FALSE + var/found_still = FALSE + for(var/image/part as anything in lattice.bodypart_aug.get_overlay(EXTERNAL_ADJACENT, bearer.get_bodypart(BODY_ZONE_CHEST))) + if(part.icon_state == "cascade_led" || part.icon_state == "cascade_led_e") + found_led = TRUE + if(part.icon_state == "cascade_e") + found_still = TRUE + TEST_ASSERT(found_led, "The lattice's LEDs don't breathe") + TEST_ASSERT(!found_still, "The still glow is drawn under the breathing one") + + TEST_ASSERT(heavy.Insert(bearer, special = TRUE), "Test fixture: heavy insert refused") + if(!chrome.browned_out) + TEST_ASSERT(overflow.Insert(bearer, special = TRUE), "Test fixture: overflow insert refused") + TEST_ASSERT(chrome.browned_out, "Test fixture: the body didn't brown out") + var/datum/component/chrome_brownout_show/show = bearer.GetComponent(/datum/component/chrome_brownout_show) + TEST_ASSERT(show, "A brownout put on no show") + TEST_ASSERT_EQUAL(lattice.cyberware_worn_look(), "warm", "The brownout didn't start with the warm stutter") + TEST_ASSERT(show.step_timer, "The stutter stopped on its first frame") + while(length(show.steps)) + show.advance() + show.advance() + TEST_ASSERT(QDELETED(show), "The brownout show didn't end") + TEST_ASSERT_NULL(chrome.brownout_look, "The finished show left a look") + TEST_ASSERT_EQUAL(lattice.cyberware_worn_look(), "brown", "Browned-out chrome isn't drawn browned out") + + // Back under: the stutter back on, then plain. + if(overflow.owner) + overflow.Remove(bearer, special = TRUE) + heavy.Remove(bearer, special = TRUE) + TEST_ASSERT(!chrome.browned_out, "Test fixture: the brownout didn't clear") + show = bearer.GetComponent(/datum/component/chrome_brownout_show) + TEST_ASSERT(show, "Coming back up played no stutter") + TEST_ASSERT_EQUAL(lattice.cyberware_worn_look(), "brown", "The way back up didn't start dark") + + // Dead mid-stutter: the show ends and the looks go with it. + bearer.death() + TEST_ASSERT(QDELETED(show), "The brownout show outlived its bearer") + TEST_ASSERT_NULL(chrome.brownout_look, "Death left a stutter look") + TEST_ASSERT_NULL(lattice.cyberware_worn_look(), "Recovered chrome isn't drawn plain") + +/// Chrome cradle: the rig follows the install's beats and pulls back and parks +/// when the sequence is cancelled, with nothing left in the gripper. +/datum/unit_test/voidcrew_cyberware_anim2_cradle + +/datum/unit_test/voidcrew_cyberware_anim2_cradle/Run() + var/obj/machinery/chrome_cradle/cradle = allocate(/obj/machinery/chrome_cradle) + var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human/consistent, get_turf(cradle)) + TEST_ASSERT(cradle.buckle_mob(patient, force = TRUE, check_loc = FALSE), "Test fixture: couldn't buckle the patient") + var/obj/item/organ/cyberimp/cyberware/redline/street/ware = allocate(/obj/item/organ/cyberimp/cyberware/redline/street) + ware.forceMove(cradle) + + cradle.begin_install(ware) + TEST_ASSERT(cradle.busy, "Test fixture: the install didn't start") + TEST_ASSERT_EQUAL(cradle.rig_phase, "arms_down", "The arms didn't come down on the first beat") + TEST_ASSERT(voidcrew_test_anim_state(cradle, "rig_arms_down"), "The rig isn't drawn coming down") + cradle.run_sequence_stage() + TEST_ASSERT_EQUAL(cradle.rig_phase, "grip_down", "The gripper didn't come down on the second beat") + var/obj/effect/abstract/cyberware_anim/carried = cradle.rig_ware_ref?.resolve() + TEST_ASSERT(carried && carried.icon_state == ware.icon_state, "The gripper isn't carrying the ware") + TEST_ASSERT(!voidcrew_test_anim_state(cradle, "rig_arms_down"), "The last move's rig stayed drawn") + cradle.run_sequence_stage(TRUE) + TEST_ASSERT_EQUAL(cradle.rig_phase, "press", "The gripper didn't press on the third beat") + + cradle.cancel_sequence() + TEST_ASSERT_EQUAL(cradle.rig_phase, "retract", "A cancelled install left the rig down") + TEST_ASSERT(QDELETED(carried), "A cancelled install left the ware in the gripper") + TEST_ASSERT(cradle.rig_park_timer, "The rig never parks") + cradle.park_rig() + TEST_ASSERT_NULL(cradle.rig_phase, "The parked rig still has a move") + TEST_ASSERT(!(locate(/obj/effect/abstract/cyberware_anim) in cradle.vis_contents), "The parked rig left a drawing") + cradle.unbuckle_mob(patient, force = TRUE) + +/// Impacts: a chrome weapon's hit plays its impact over the target in place of +/// tg's flying item, upright, turned to the attacker's side, and it goes away. +/datum/unit_test/voidcrew_cyberware_anim2_impact + +/datum/unit_test/voidcrew_cyberware_anim2_impact/Run() + var/turf/start = run_loc_floor_bottom_left + var/mob/living/carbon/human/west = allocate(/mob/living/carbon/human/consistent, start) + var/mob/living/carbon/human/east = allocate(/mob/living/carbon/human/consistent, get_step(start, EAST)) + + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade = allocate(/obj/item/melee/energy/blade/hardlight/cyberware_mantis) + blade.animate_attack(west, east) + var/obj/effect/abstract/cyberware_anim/impact = locate() in east.vis_contents + TEST_ASSERT(impact, "A Mantis hit drew no impact over its target") + TEST_ASSERT_EQUAL(impact.icon_state, "impact_mantis", "A Mantis hit drew the wrong impact") + TEST_ASSERT(impact.appearance_flags & RESET_TRANSFORM, "The impact turns with a lying target") + TEST_ASSERT_EQUAL(impact.transform.a, 1, "A blow from the west was mirrored") + TEST_ASSERT(length(impact.overlays), "The Mantis impact doesn't glow") + qdel(impact) + + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/street/shiv = allocate(/obj/item/melee/energy/blade/hardlight/cyberware_mantis/street) + shiv.animate_attack(east, west) + impact = locate() in west.vis_contents + TEST_ASSERT(impact && impact.icon_state == "impact_shiv", "A Shiv hit drew the wrong impact") + TEST_ASSERT_EQUAL(impact.transform.a, -1, "A blow from the east wasn't mirrored") + TEST_ASSERT(!length(impact.overlays), "The Shiv's steel impact glows") + qdel(impact) + + var/obj/item/melee/cyberware_monowire/wire = allocate(/obj/item/melee/cyberware_monowire) + wire.animate_attack(west, east) + impact = locate() in east.vis_contents + TEST_ASSERT(impact && impact.icon_state == "impact_widowline", "A Widowline hit drew the wrong impact") + qdel(impact) + TEST_ASSERT(!(locate(/obj/effect/abstract/cyberware_anim) in east.vis_contents), "The impact stayed on its target") + + // The Arc's lash, crackle and burst are its picture: nothing goes on top, not even tg's flying spool. + wire = allocate(/obj/item/melee/cyberware_monowire/live) + wire.animate_attack(west, east) + TEST_ASSERT(!(locate(/obj/effect/abstract/cyberware_anim) in east.vis_contents), "A Widowline Arc hit drew an impact over its shock") + TEST_ASSERT(!(locate(/atom/movable/flick_visual) in east.vis_contents), "A Widowline Arc hit drew tg's flying spool") + + // Its shock is a crackle along the wire, never a lightning bolt from the wielder. + var/obj/item/melee/cyberware_monowire/live/arc = wire + arc.arc_visuals(east, west) + var/list/drawn = list() + for(var/obj/effect/ebeam/segment in get_turf(west)) + for(var/obj/effect/ebeam/look in segment.vis_contents) + drawn += look.icon_state + TEST_ASSERT(("arc_crackle" in drawn), "The Arc's shock drew no crackle along the wire") + for(var/state in drawn) + TEST_ASSERT(!findtext(state, "lightning"), "The Arc's shock drew a lightning bolt") + + // A Scorch cut throws embers but draws nothing over the blade's own slash. + cyberware_scorch_trail_fx(west, east) + var/obj/effect/temp_visual/cyberware_scorch_embers/embers = locate() in get_turf(east) + TEST_ASSERT(embers?.particles, "A Scorch cut threw no embers") + TEST_ASSERT_EQUAL(embers.icon_state, "nothing", "A Scorch cut drew a picture over the blade's impact") + + // Nothing to draw on a wall or a floor: those keep tg's own. + TEST_ASSERT_NULL(cyberware_play_impact(west, get_turf(east), "impact_mantis"), "An impact was drawn on a turf") diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware_kit.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware_kit.dm new file mode 100644 index 00000000000..193ee516d54 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware_kit.dm @@ -0,0 +1,79 @@ +/** + * # Chrome test kit (voidcrew/modules/admin/chrome_test_kit.dm) + * + * The verb itself needs a client and a menu, so these tests hold the parts under it: every + * ready-made build is made of real chrome, fits one body without evicting itself, comes out + * running, and what does not fit is handed back rather than lost; a body missing a limb is + * not forced to take chrome for it; "everything" really is the whole shelf. + */ + +/datum/unit_test/voidcrew_cyberware_kit_loadouts + +/datum/unit_test/voidcrew_cyberware_kit_loadouts/Run() + TEST_ASSERT(length(GLOB.chrome_test_loadouts) >= 3, "The kit offers only [length(GLOB.chrome_test_loadouts)] builds") + for(var/loadout_name in GLOB.chrome_test_loadouts) + var/list/ware_types = GLOB.chrome_test_loadouts[loadout_name] + TEST_ASSERT(length(ware_types), "The [loadout_name] build is empty") + // No two pieces of a build may want the same slot, or one would evict the other. + var/list/slots = list() + for(var/ware_type in ware_types) + TEST_ASSERT(ispath(ware_type, /obj/item/organ), "[loadout_name]: [ware_type] is not an organ") + var/obj/item/organ/example = ware_type + var/slot_name = initial(example.slot) + TEST_ASSERT(!slots[slot_name], "[loadout_name]: [ware_type] and [slots[slot_name]] share the slot [slot_name]") + slots[slot_name] = "[ware_type]" + var/mob/living/carbon/human/body = allocate(/mob/living/carbon/human/consistent) + var/list/report = list() + var/list/left_over = chrome_kit_install(body, ware_types, report) + for(var/obj/item/organ/spare as anything in left_over) + TEST_ASSERT(!QDELETED(spare) && !spare.owner, "[loadout_name]: a piece left over is deleted or still owned") + qdel(spare) + TEST_ASSERT_EQUAL(length(get_installed_cyberware(body)) + length(left_over), length(ware_types), "[loadout_name]: pieces went missing between the list and the body") + TEST_ASSERT(get_chrome_load(body) <= get_chrome_capacity(body), "[loadout_name]: the kit left the body over capacity ([get_chrome_load(body)] of [get_chrome_capacity(body)])") + for(var/obj/item/organ/ware as anything in get_installed_cyberware(body)) + var/datum/component/cyberware/chrome = ware.GetComponent(/datum/component/cyberware) + TEST_ASSERT(chrome.is_running(), "[loadout_name]: [ware.type] came out of the kit dark") + // The first piece listed is the one the build is named for; it must always make it. + var/first_type = ware_types[1] + TEST_ASSERT(locate(first_type) in body.organs, "[loadout_name]: its first piece, [first_type], did not install") + +/// A body with no left arm takes the right-arm pieces and hands the left-arm ones back. +/datum/unit_test/voidcrew_cyberware_kit_limbs + +/datum/unit_test/voidcrew_cyberware_kit_limbs/Run() + var/mob/living/carbon/human/body = allocate(/mob/living/carbon/human/consistent) + var/obj/item/bodypart/arm = body.get_bodypart(BODY_ZONE_L_ARM) + arm.drop_limb() + qdel(arm) + var/list/report = list() + var/list/left_over = chrome_kit_install(body, list( + /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/left, + ), report) + TEST_ASSERT_EQUAL(length(left_over), 1, "The left housing should have been handed back, got [length(left_over)] pieces") + var/obj/item/organ/handed_back = left_over[1] + TEST_ASSERT(istype(handed_back, /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/left), "The wrong piece was handed back: [handed_back.type]") + TEST_ASSERT(!handed_back.owner && isturf(handed_back.loc), "The handed-back housing is not loose on the floor") + TEST_ASSERT_EQUAL(length(report), 1, "The kit should name the piece it left out, got [length(report)] lines") + TEST_ASSERT(findtext(report[1], "no limb"), "The kit did not say it was the missing limb: [report[1]]") + TEST_ASSERT_EQUAL(length(get_installed_cyberware(body)), 1, "The right housing did not install on its own") + qdel(handed_back) + +/// The "everything" crate covers every organ any ripperdoc shelf sells, once. +/datum/unit_test/voidcrew_cyberware_kit_everything + +/datum/unit_test/voidcrew_cyberware_kit_everything/Run() + var/list/everything = chrome_kit_everything_types() + TEST_ASSERT(length(everything) > 40, "The everything crate holds only [length(everything)] kinds") + for(var/datum/shop_sku/sku_type as anything in subtypesof(/datum/shop_sku/ripperdoc)) + var/item_path = initial(sku_type.item_path) + if(ispath(item_path, /obj/item/organ) || ispath(item_path, /obj/item/cyberware_pair_case) || ispath(item_path, /obj/item/storage/case/cyberware)) + TEST_ASSERT(item_path in everything, "The everything crate is missing [item_path], which [sku_type] sells") + TEST_ASSERT(/obj/item/organ/cyberimp/cyberware/piledriver in everything, "The everything crate is missing the Piledriver, which no shelf sells") + // Built the way the verb builds it, the crate's contents are loose, real chrome. + var/list/made = list() + for(var/ware_type in everything) + made += allocate(ware_type) + var/obj/structure/closet/crate/crate = chrome_kit_crate(run_loc_floor_bottom_left, made, "test crate") + allocated += crate + TEST_ASSERT_EQUAL(length(crate.contents), length(everything), "The crate lost items on the way in") diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware_mantis.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware_mantis.dm new file mode 100644 index 00000000000..df1703dde96 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware_mantis.dm @@ -0,0 +1,159 @@ +/** + * # Mantis Blades line (Shiv and Scorch models) + * + * The street model has no lunge, the fire model keeps the parent's lunge and + * adds fire, a cut lights the target and never the wielder, and the pair + * cases quote prices through the cradle's index. Unit-test files compile before + * voidcrew/_DEFINES/, so the numbers below are literals. + */ +/datum/unit_test/voidcrew_cyberware_mantis_line + +/datum/unit_test/voidcrew_cyberware_mantis_line/Run() + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/parent = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/street/street = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/street) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/scorch/scorch = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/scorch) + + // The parent keeps its numbers: the defines became vars with the same values. + TEST_ASSERT_EQUAL(parent.lunge_range, 5, "Mantis lunge range changed") + TEST_ASSERT_EQUAL(parent.lunge_bonus, 10, "Mantis lunge bonus changed") + TEST_ASSERT_EQUAL(parent.lunge_fire_stacks, 0, "The plain Mantis lunge sets people on fire") + + // Item Initialize() turns actions_types into granted actions and nulls the list. + TEST_ASSERT(!(locate(/datum/action/cooldown/cyberware/mantis_lunge) in (street.actions || list())), "Shiv Blades got a lunge") + TEST_ASSERT(locate(/datum/action/cooldown/cyberware/mantis_lunge) in (scorch.actions || list()), "Scorch Blades lost the lunge") + TEST_ASSERT_EQUAL(scorch.lunge_fire_stacks, 4, "Scorch lunge fire is not 4 stacks") + + // Same slot as the parent, so the line evicts itself. + TEST_ASSERT_EQUAL(street.slot, parent.slot, "Shiv housing is not in the Mantis arm slot") + TEST_ASSERT_EQUAL(scorch.slot, parent.slot, "Scorch housing is not in the Mantis arm slot") + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/street/left/street_left = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/street/left) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/scorch/left/scorch_left = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/scorch/left) + TEST_ASSERT_EQUAL(street_left.slot, ORGAN_SLOT_LEFT_ARM_AUG, "Left Shiv housing is not in the left arm slot") + TEST_ASSERT_EQUAL(scorch_left.slot, ORGAN_SLOT_LEFT_ARM_AUG, "Left Scorch housing is not in the left arm slot") + + // The weaker blade. + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/street/street_blade = allocate(/obj/item/melee/energy/blade/hardlight/cyberware_mantis/street) + TEST_ASSERT_EQUAL(street_blade.force, 14, "Shiv blade force is not 14") + + // Cases carry a matched pair of the right model. + var/obj/item/cyberware_pair_case/mantis_street/street_case = allocate(/obj/item/cyberware_pair_case/mantis_street) + var/obj/item/cyberware_pair_case/mantis_scorch/scorch_case = allocate(/obj/item/cyberware_pair_case/mantis_scorch) + TEST_ASSERT_EQUAL(length(street_case.contents), 2, "Shiv case isn't a pair") + TEST_ASSERT_EQUAL(length(scorch_case.contents), 2, "Scorch case isn't a pair") + TEST_ASSERT(locate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/street/left) in street_case.contents, "Shiv case has no left housing") + TEST_ASSERT(locate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/scorch/left) in scorch_case.contents, "Scorch case has no left housing") + + // Both halves of each case quote the case's price at the cradle. + build_cyberware_price_index() + var/list/street_price = get_cyberware_price(street) + var/list/scorch_price = get_cyberware_price(scorch_left) + TEST_ASSERT(street_price && street_price["credits"] > 0 && street_price["paired"], "Shiv Blades quote no credit price as a pair") + TEST_ASSERT(scorch_price && scorch_price["vouchers"] > 0 && scorch_price["paired"], "Scorch Blades quote no voucher price as a pair") + +/// A cut with the Scorch blade lights the target and never the one holding it, +/// and a corpse is left alone. +/datum/unit_test/voidcrew_cyberware_mantis_scorch + +/datum/unit_test/voidcrew_cyberware_mantis_scorch/Run() + var/mob/living/carbon/human/wielder = allocate(/mob/living/carbon/human/consistent) + var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human/consistent) + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/scorch/blade = allocate(/obj/item/melee/energy/blade/hardlight/cyberware_mantis/scorch) + wielder.put_in_active_hand(blade) + blade.attack(victim, wielder, list(), list()) + TEST_ASSERT(victim.fire_stacks >= 2, "A scorch cut left no fire stacks on the target") + TEST_ASSERT(victim.on_fire, "A scorch cut didn't light the target") + TEST_ASSERT(!wielder.on_fire && wielder.fire_stacks <= 0, "A scorch cut put fire on the wielder") + + // A swing that never lands burns nothing: a pacifist's pulled swing returns + // the same FALSE as a cut, so only a cut that reached afterattack() counts. + var/mob/living/carbon/human/spared = allocate(/mob/living/carbon/human/consistent) + ADD_TRAIT(wielder, TRAIT_PACIFISM, TRAIT_SOURCE_UNIT_TESTS) + blade.attack(spared, wielder, list(), list()) + REMOVE_TRAIT(wielder, TRAIT_PACIFISM, TRAIT_SOURCE_UNIT_TESTS) + TEST_ASSERT(!spared.on_fire && spared.fire_stacks <= 0, "A pacifist's pulled scorch swing set the target alight") + + var/mob/living/carbon/human/corpse = allocate(/mob/living/carbon/human/consistent) + corpse.stat = DEAD + TEST_ASSERT(!cyberware_scorch_target(corpse, 4), "A corpse was set alight") + TEST_ASSERT(!corpse.on_fire, "A corpse is burning") + +/// The worn housing sprite shows the blade folded in, so each arm's housing +/// hides while that arm's blade is out and comes back when the blade is stowed, +/// knocked out of the hand, the chrome is EMP'd, or the housing is pulled. +/datum/unit_test/voidcrew_cyberware_mantis_stowed_overlay + +/datum/unit_test/voidcrew_cyberware_mantis_stowed_overlay/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/right = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/left/left = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/left) + TEST_ASSERT(right.Insert(bearer, special = TRUE), "Test fixture: right housing insert refused") + TEST_ASSERT(left.Insert(bearer, special = TRUE), "Test fixture: left housing insert refused") + var/obj/item/bodypart/right_arm = bearer.get_bodypart(BODY_ZONE_R_ARM) + var/obj/item/bodypart/left_arm = bearer.get_bodypart(BODY_ZONE_L_ARM) + var/obj/item/blade = right.contents[1] + TEST_ASSERT(right.bodypart_aug in right_arm.bodypart_overlays, "Test fixture: the right housing has no worn overlay on the arm") + TEST_ASSERT(stowed_drawn(bearer, right_arm, right), "A stowed housing isn't drawn") + + right.Extend(blade) + TEST_ASSERT(bearer.is_holding(blade), "Test fixture: the blade never reached a hand") + TEST_ASSERT(!stowed_drawn(bearer, right_arm, right), "The folded housing still draws with its blade out") + TEST_ASSERT(stowed_drawn(bearer, left_arm, left), "Deploying the right blade hid the left housing") + + right.Retract() + TEST_ASSERT(stowed_drawn(bearer, right_arm, right), "The housing didn't come back when the blade was stowed") + + right.Extend(blade) + bearer.dropItemToGround(blade, force = TRUE) + TEST_ASSERT(stowed_drawn(bearer, right_arm, right), "The housing stayed hidden after the blade left the hand") + right.Retract() + TEST_ASSERT(blade.loc == right, "Test fixture: the dropped blade never went back into the housing") + + var/datum/component/cyberware/chrome = right.GetComponent(/datum/component/cyberware) + right.Extend(blade) + chrome.start_emp_reboot() + TEST_ASSERT(blade.loc == right, "Test fixture: the EMP didn't stow the blade") + TEST_ASSERT(stowed_drawn(bearer, right_arm, right), "The housing stayed hidden after an EMP stowed the blade") + chrome.tune_up() + + right.Extend(blade) + right.Remove(bearer, special = TRUE) + TEST_ASSERT(!(right.bodypart_aug in right_arm.bodypart_overlays), "A pulled housing left its overlay on the arm") + // A fresh body: tg's arm implants never drop their bearer signals on removal, + // so going back into the same body trips a double-registration warning. + var/mob/living/carbon/human/next_bearer = allocate(/mob/living/carbon/human/consistent) + TEST_ASSERT(right.Insert(next_bearer, special = TRUE), "Test fixture: installing the pulled housing was refused") + TEST_ASSERT(stowed_drawn(next_bearer, next_bearer.get_bodypart(BODY_ZONE_R_ARM), right), "A housing pulled with its blade out doesn't draw in its next body") + +/// TRUE when the housing's worn overlay is both allowed to draw and present in the +/// arm's last render key, so a missed redraw fails as well as a wrong check. +/datum/unit_test/voidcrew_cyberware_mantis_stowed_overlay/proc/stowed_drawn(mob/living/carbon/human/bearer, obj/item/bodypart/arm, obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing) + var/drawable = housing.bodypart_aug.can_draw_on_bodypart(arm) + var/in_key = !!findtext(bearer.icon_render_keys[arm.body_zone], housing.get_overlay_state()) + TEST_ASSERT_EQUAL(drawable, in_key, "[housing] can_draw_on_bodypart() and the arm's render key disagree, the arm was not redrawn") + return drawable + +/// Worn chrome with a glow (Cascade, Redline) must not black the glow out with +/// its own emissive blocker: the glow comes after every blocker the overlay makes. +/datum/unit_test/voidcrew_cyberware_worn_glow + +/datum/unit_test/voidcrew_cyberware_worn_glow/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/cascade/lattice = allocate(/obj/item/organ/cyberimp/cyberware/cascade) + TEST_ASSERT(lattice.Insert(bearer, special = TRUE), "Test fixture: Cascade insert refused") + var/obj/item/bodypart/chest = bearer.get_bodypart(BODY_ZONE_CHEST) + var/list/images = lattice.bodypart_aug.get_overlay(EXTERNAL_ADJACENT, chest) + var/glow_at = 0 + var/last_blocker_at = 0 + for(var/i in 1 to length(images)) + var/mutable_appearance/part = images[i] + if(PLANE_TO_TRUE(part.plane) != EMISSIVE_PLANE) + continue + // The emissive matrix puts its glow in the constant row; a blocker's constant row is all zero. + var/list/matrix = part.color + if(islist(matrix) && length(matrix) >= 20 && (matrix[17] || matrix[18] || matrix[19])) + glow_at = i + else + last_blocker_at = i + TEST_ASSERT(glow_at, "The Cascade worn overlay has no glow") + TEST_ASSERT(last_blocker_at, "The Cascade worn overlay has no emissive blocker") + TEST_ASSERT(glow_at > last_blocker_at, "An emissive blocker sits on top of the Cascade glow") diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware_models_a.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware_models_a.dm new file mode 100644 index 00000000000..58e7bf97c82 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware_models_a.dm @@ -0,0 +1,383 @@ +/** + * # Cyberware models, part A + * + * The Spring calves and Vaulter pistons (Hopper), Brawler myomers (Gorilla Arms), + * Tinker's fingers (Fixer's Fingers), Deepcore drill fist (Rockjaw) and Holdout + * housing (Popup Ronin). Each parent keeps its numbers (the defines became vars + * with the same values), each model shares the parent's slot, and the shelf and + * ledger entries pay what the plan says. Unit-test files compile before + * voidcrew/_DEFINES/, so tiers, slots and zone permissions below are literals: + * tier 1/2/3 are the CYBERWARE_TIER_* values, zone permission 0/1/2 are + * public/yellow/advanced. + */ + +/// The Hopper line: the parent leaps four tiles on an eight second clock with no +/// traits and no fall handler, the Spring calves leap three on fourteen seconds, +/// the Vaulter five on six and carry the Shock Coils' soft landing and dry footing. +/datum/unit_test/voidcrew_cyberware_models_a_hopper + +/datum/unit_test/voidcrew_cyberware_models_a_hopper/Run() + var/obj/item/organ/cyberimp/cyberware/hopper/parent = allocate(/obj/item/organ/cyberimp/cyberware/hopper) + var/obj/item/organ/cyberimp/cyberware/hopper/street/street = allocate(/obj/item/organ/cyberimp/cyberware/hopper/street) + var/obj/item/organ/cyberimp/cyberware/hopper/milspec/milspec = allocate(/obj/item/organ/cyberimp/cyberware/hopper/milspec) + var/obj/item/organ/cyberimp/cyberware/shock_coils/coils = allocate(/obj/item/organ/cyberimp/cyberware/shock_coils) + + // The parent keeps its numbers. + TEST_ASSERT_EQUAL(parent.leap_range, 4, "The Hopper's leap range changed") + TEST_ASSERT_EQUAL(parent.leap_cooldown, 8 SECONDS, "The Hopper's leap cooldown changed") + TEST_ASSERT_EQUAL(parent.chrome_load, 3, "The Hopper's load changed") + TEST_ASSERT_EQUAL(parent.tier, 2, "The Hopper's tier changed") + TEST_ASSERT_NULL(parent.leap_action_desc, "The Hopper's button text is overridden") + TEST_ASSERT(!length(parent.organ_traits), "The Hopper grew a passive trait") + + // The models. + TEST_ASSERT_EQUAL(street.leap_range, 3, "Spring calves don't leap three tiles") + TEST_ASSERT_EQUAL(street.leap_cooldown, 14 SECONDS, "Spring calves' clock isn't fourteen seconds") + TEST_ASSERT_EQUAL(street.chrome_load, 2, "Spring calves' load isn't 2") + TEST_ASSERT_EQUAL(street.tier, 1, "Spring calves aren't tier 1") + TEST_ASSERT(!length(street.organ_traits), "Spring calves got dry footing") + TEST_ASSERT_EQUAL(milspec.leap_range, 5, "Vaulter pistons don't leap five tiles") + TEST_ASSERT_EQUAL(milspec.leap_cooldown, 6 SECONDS, "Vaulter pistons' clock isn't six seconds") + TEST_ASSERT_EQUAL(milspec.chrome_load, 4, "Vaulter pistons' load isn't 4") + TEST_ASSERT_EQUAL(milspec.tier, 3, "Vaulter pistons aren't tier 3") + TEST_ASSERT(TRAIT_NO_SLIP_WATER in milspec.organ_traits, "Vaulter pistons don't keep dry footing") + TEST_ASSERT(street.chrome_load < parent.chrome_load && parent.chrome_load < milspec.chrome_load, "The leg line's loads don't climb") + + // Same slot as the Coils and the parent: the leg ladder evicts itself. + TEST_ASSERT_EQUAL(street.slot, coils.slot, "Spring calves aren't in the leg slot") + TEST_ASSERT_EQUAL(milspec.slot, coils.slot, "Vaulter pistons aren't in the leg slot") + TEST_ASSERT_EQUAL(parent.slot, coils.slot, "The Hopper left the leg slot") + + // Each button takes its cooldown and its text from the pistons it belongs to. + var/datum/action/cooldown/cyberware/hopper_leap/parent_button = locate() in parent.actions + var/datum/action/cooldown/cyberware/hopper_leap/street_button = locate() in street.actions + var/datum/action/cooldown/cyberware/hopper_leap/milspec_button = locate() in milspec.actions + TEST_ASSERT_NOTNULL(parent_button, "The Hopper lost its leap button") + TEST_ASSERT_NOTNULL(street_button, "Spring calves have no leap button") + TEST_ASSERT_NOTNULL(milspec_button, "Vaulter pistons have no leap button") + TEST_ASSERT_EQUAL(parent_button.cooldown_time, 8 SECONDS, "The Hopper's button changed its clock") + TEST_ASSERT(findtext(parent_button.desc, "four tiles"), "The Hopper's button changed its text") + TEST_ASSERT_EQUAL(street_button.cooldown_time, 14 SECONDS, "Spring calves' button kept the wrong clock") + TEST_ASSERT(findtext(street_button.desc, "three tiles"), "Spring calves' button kept the wrong text") + TEST_ASSERT_EQUAL(milspec_button.cooldown_time, 6 SECONDS, "Vaulter pistons' button kept the wrong clock") + TEST_ASSERT(findtext(milspec_button.desc, "five tiles"), "Vaulter pistons' button kept the wrong text") + + // The reach follows the pistons. The arena is five tiles square, so the far + // corner is four tiles from the near one. + var/turf/start = run_loc_floor_bottom_left + var/turf/three_away = locate(start.x + 3, start.y, start.z) + var/turf/four_away = locate(start.x + 4, start.y, start.z) + TEST_ASSERT(isfloorturf(three_away) && isfloorturf(four_away), "The test arena is smaller than the leap test needs") + + var/mob/living/carbon/human/hopper_wearer = allocate(/mob/living/carbon/human/consistent, start) + TEST_ASSERT(parent.Insert(hopper_wearer, special = TRUE), "The Hopper wouldn't go in") + TEST_ASSERT(parent_button.Activate(four_away), "The Hopper wouldn't leap four tiles") + TEST_ASSERT_EQUAL(parent_button.next_use_time, world.time + 8 SECONDS, "The Hopper's leap started the wrong clock") + + var/mob/living/carbon/human/spring_wearer = allocate(/mob/living/carbon/human/consistent, start) + TEST_ASSERT(street.Insert(spring_wearer, special = TRUE), "Spring calves wouldn't go in") + TEST_ASSERT(!street_button.Activate(four_away), "Spring calves leapt four tiles") + TEST_ASSERT(street_button.IsAvailable(), "A refused leap started Spring calves' clock") + TEST_ASSERT(street_button.Activate(three_away), "Spring calves wouldn't leap three tiles") + TEST_ASSERT_EQUAL(street_button.next_use_time, world.time + 14 SECONDS, "Spring calves' leap started the wrong clock") + + // Dry footing and the soft landing belong to the Vaulter alone. + var/mob/living/carbon/human/vault_wearer = allocate(/mob/living/carbon/human/consistent, start) + TEST_ASSERT(milspec.Insert(vault_wearer, special = TRUE), "Vaulter pistons wouldn't go in") + TEST_ASSERT(HAS_TRAIT(vault_wearer, TRAIT_NO_SLIP_WATER), "Vaulter pistons gave no dry footing") + var/landing = SEND_SIGNAL(vault_wearer, COMSIG_LIVING_Z_IMPACT, 1, start) + TEST_ASSERT(landing & ZIMPACT_CANCEL_DAMAGE, "Vaulter pistons didn't soften a fall") + milspec.organ_flags |= ORGAN_FAILING + landing = SEND_SIGNAL(vault_wearer, COMSIG_LIVING_Z_IMPACT, 1, start) + TEST_ASSERT(!(landing & ZIMPACT_CANCEL_DAMAGE), "Browned-out Vaulter pistons still softened a fall") + milspec.organ_flags &= ~ORGAN_FAILING + milspec.Remove(vault_wearer, special = TRUE) + TEST_ASSERT(!HAS_TRAIT(vault_wearer, TRAIT_NO_SLIP_WATER), "Dry footing outlived the Vaulter pistons") + landing = SEND_SIGNAL(vault_wearer, COMSIG_LIVING_Z_IMPACT, 1, start) + TEST_ASSERT(!(landing & ZIMPACT_CANCEL_DAMAGE), "A fall was softened with the Vaulter pistons gone") + + // The Hopper and the Spring calves never had either. + TEST_ASSERT(!HAS_TRAIT(hopper_wearer, TRAIT_NO_SLIP_WATER), "The Hopper got dry footing") + TEST_ASSERT(!(SEND_SIGNAL(hopper_wearer, COMSIG_LIVING_Z_IMPACT, 1, start) & ZIMPACT_CANCEL_DAMAGE), "The Hopper softened a fall") + TEST_ASSERT(!HAS_TRAIT(spring_wearer, TRAIT_NO_SLIP_WATER), "Spring calves got dry footing") + TEST_ASSERT(!(SEND_SIGNAL(spring_wearer, COMSIG_LIVING_Z_IMPACT, 1, start) & ZIMPACT_CANCEL_DAMAGE), "Spring calves softened a fall") + +/// The Gorilla line: the parent keeps every number and the door-pry bonus. The +/// Brawler myomers punch lighter and slower, smash lighter, hurl nobody, and +/// never pry a door, alone or beside a real Gorilla arm. The case holds a pair. +/datum/unit_test/voidcrew_cyberware_models_a_gorilla + +/datum/unit_test/voidcrew_cyberware_models_a_gorilla/Run() + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/real_right = allocate(/obj/item/organ/cyberimp/cyberware/gorilla_arms) + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/left/real_left = allocate(/obj/item/organ/cyberimp/cyberware/gorilla_arms/left) + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/street/brawler_right = allocate(/obj/item/organ/cyberimp/cyberware/gorilla_arms/street) + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/street/left/brawler_left = allocate(/obj/item/organ/cyberimp/cyberware/gorilla_arms/street/left) + + // The parent keeps its numbers. + TEST_ASSERT_EQUAL(real_right.punch_damage, 20, "Gorilla punch damage changed") + TEST_ASSERT_EQUAL(real_right.structure_damage, 40, "Gorilla structure damage changed") + TEST_ASSERT_EQUAL(real_right.punch_cooldown_time, 4 SECONDS, "Gorilla punch cooldown changed") + TEST_ASSERT_EQUAL(real_right.smash_cooldown_time, 1 SECONDS, "Gorilla smash cooldown changed") + TEST_ASSERT_EQUAL(real_right.hurl_range, 4, "Gorilla hurl range changed") + TEST_ASSERT(real_right.pries_doors, "Gorilla Arms stopped prying doors") + TEST_ASSERT_EQUAL(real_right.chrome_load, 3, "Gorilla load changed") + TEST_ASSERT_EQUAL(real_right.tier, 3, "Gorilla tier changed") + + // The model. + TEST_ASSERT_EQUAL(brawler_right.punch_damage, 14, "Brawler punch isn't 14") + TEST_ASSERT_EQUAL(brawler_right.structure_damage, 20, "Brawler smash isn't 20") + TEST_ASSERT_EQUAL(brawler_right.punch_cooldown_time, 5 SECONDS, "Brawler punch clock isn't five seconds") + TEST_ASSERT_EQUAL(brawler_right.smash_cooldown_time, 1.5 SECONDS, "Brawler smash clock isn't a second and a half") + TEST_ASSERT(brawler_right.hurl_range <= 0, "Brawler myomers can hurl a grabbed victim") + TEST_ASSERT(!brawler_right.pries_doors, "Brawler myomers pry doors") + TEST_ASSERT_EQUAL(brawler_right.chrome_load, 2, "Brawler load isn't 2 per arm") + TEST_ASSERT_EQUAL(brawler_right.tier, 2, "Brawler myomers aren't tier 2") + TEST_ASSERT_EQUAL(brawler_left.chrome_load, 2, "Left Brawler load isn't 2") + TEST_ASSERT_EQUAL(brawler_right.slot, real_right.slot, "Right Brawler myomers aren't in the right arm slot") + TEST_ASSERT_EQUAL(brawler_left.slot, real_left.slot, "Left Brawler myomers aren't in the left arm slot") + TEST_ASSERT_EQUAL(brawler_left.zone, BODY_ZONE_L_ARM, "Left Brawler myomers aren't left-arm chrome") + + // The case holds one of each side. + var/obj/item/cyberware_pair_case/gorilla_arms/street/brawler_case = allocate(/obj/item/cyberware_pair_case/gorilla_arms/street) + TEST_ASSERT_EQUAL(length(brawler_case.contents), 2, "The Brawler case isn't a pair") + TEST_ASSERT(locate(/obj/item/organ/cyberimp/cyberware/gorilla_arms/street) in brawler_case.contents, "The Brawler case has no right arm") + TEST_ASSERT(locate(/obj/item/organ/cyberimp/cyberware/gorilla_arms/street/left) in brawler_case.contents, "The Brawler case has no left arm") + var/obj/item/cyberware_pair_case/gorilla_arms/real_case = allocate(/obj/item/cyberware_pair_case/gorilla_arms) + TEST_ASSERT(locate(/obj/item/organ/cyberimp/cyberware/gorilla_arms/left) in real_case.contents, "The Gorilla case lost its left arm") + TEST_ASSERT(!(locate(/obj/item/organ/cyberimp/cyberware/gorilla_arms/street) in real_case.contents), "The Gorilla case holds Brawler myomers") + + // A real pair pries doors. Brawler myomers never do, alone or beside a real arm. + var/mob/living/carbon/human/real_pair = allocate(/mob/living/carbon/human/consistent, run_loc_floor_bottom_left) + TEST_ASSERT(real_right.Insert(real_pair, special = TRUE), "The right Gorilla arm wouldn't go in") + TEST_ASSERT(real_left.Insert(real_pair, special = TRUE), "The left Gorilla arm wouldn't go in") + var/datum/status_effect/organ_set_bonus/pair_bonus = real_pair.has_status_effect(/datum/status_effect/organ_set_bonus/cyberware_gorilla) + TEST_ASSERT_NOTNULL(pair_bonus, "A Gorilla pair has no set bonus") + TEST_ASSERT(pair_bonus.bonus_active, "A Gorilla pair doesn't pry doors") + + var/mob/living/carbon/human/brawler_pair = allocate(/mob/living/carbon/human/consistent, run_loc_floor_bottom_left) + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/street/pair_right = allocate(/obj/item/organ/cyberimp/cyberware/gorilla_arms/street) + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/street/left/pair_left = allocate(/obj/item/organ/cyberimp/cyberware/gorilla_arms/street/left) + TEST_ASSERT(pair_right.Insert(brawler_pair, special = TRUE), "The right Brawler arm wouldn't go in") + TEST_ASSERT(pair_left.Insert(brawler_pair, special = TRUE), "The left Brawler arm wouldn't go in") + TEST_ASSERT_NULL(brawler_pair.has_status_effect(/datum/status_effect/organ_set_bonus/cyberware_gorilla), "A Brawler pair got the door-pry set bonus") + + var/mob/living/carbon/human/mixed_pair = allocate(/mob/living/carbon/human/consistent, run_loc_floor_bottom_left) + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/mixed_real = allocate(/obj/item/organ/cyberimp/cyberware/gorilla_arms) + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/street/left/mixed_street = allocate(/obj/item/organ/cyberimp/cyberware/gorilla_arms/street/left) + TEST_ASSERT(mixed_real.Insert(mixed_pair, special = TRUE), "The real arm wouldn't go in beside a Brawler arm") + TEST_ASSERT(mixed_street.Insert(mixed_pair, special = TRUE), "The Brawler arm wouldn't go in beside a real arm") + var/datum/status_effect/organ_set_bonus/mixed_bonus = mixed_pair.has_status_effect(/datum/status_effect/organ_set_bonus/cyberware_gorilla) + TEST_ASSERT(!mixed_bonus?.bonus_active, "A real Gorilla arm and a Brawler arm pry doors") + + // A punch lands for the model's damage and starts the model's clock. + var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human/consistent, run_loc_floor_bottom_left) + var/mob/living/carbon/human/puncher = allocate(/mob/living/carbon/human/consistent, run_loc_floor_bottom_left) + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/street/left/punch_arm = allocate(/obj/item/organ/cyberimp/cyberware/gorilla_arms/street/left) + TEST_ASSERT(punch_arm.Insert(puncher, special = TRUE), "The punching arm wouldn't go in") + puncher.set_combat_mode(TRUE) + puncher.swap_hand(1) + TEST_ASSERT_EQUAL(puncher.get_active_hand()?.body_zone, BODY_ZONE_L_ARM, "The test puncher isn't swinging with the left arm") + var/hurt_before = victim.getBruteLoss() + TEST_ASSERT_EQUAL(punch_arm.on_punch(puncher, victim, TRUE, null), COMPONENT_CANCEL_ATTACK_CHAIN, "The Brawler arm didn't take the punch") + TEST_ASSERT_EQUAL(victim.getBruteLoss() - hurt_before, 14, "A Brawler punch didn't land 14") + TEST_ASSERT_EQUAL(COOLDOWN_TIMELEFT(punch_arm, slam_cooldown), 5 SECONDS, "A Brawler punch didn't start the five second clock") + TEST_ASSERT_NOTEQUAL(punch_arm.on_punch(puncher, victim, TRUE, null), COMPONENT_CANCEL_ATTACK_CHAIN, "A Brawler arm punched again on its clock") + +/// Tinker's fingers: the Fixer's three tools and a weaker servo speed-up under +/// its own key, so it never replaces the Fixer's. +/datum/unit_test/voidcrew_cyberware_models_a_fixers + +/datum/unit_test/voidcrew_cyberware_models_a_fixers/Run() + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/fixers/parent = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/fixers) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/fixers/street/street = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/fixers/street) + + TEST_ASSERT_EQUAL(parent.speed_modifier, /datum/actionspeed_modifier/cyberware_fixers, "The Fixer's speed-up changed") + TEST_ASSERT_EQUAL(get_cached_actionspeed_modifier(parent.speed_modifier).multiplicative_slowdown, -0.25, "The Fixer's speed-up isn't a quarter") + TEST_ASSERT_EQUAL(parent.chrome_load, 2, "The Fixer's load changed") + TEST_ASSERT_EQUAL(parent.tier, 1, "The Fixer's tier changed") + + TEST_ASSERT_EQUAL(street.speed_modifier, /datum/actionspeed_modifier/cyberware_fixers/street, "Tinker's fingers use the wrong speed-up") + TEST_ASSERT_EQUAL(get_cached_actionspeed_modifier(street.speed_modifier).multiplicative_slowdown, -0.1, "Tinker's speed-up isn't a tenth") + TEST_ASSERT_EQUAL(street.chrome_load, 1, "Tinker's load isn't 1") + TEST_ASSERT_EQUAL(street.tier, 1, "Tinker's fingers aren't tier 1") + TEST_ASSERT_EQUAL(street.slot, parent.slot, "Tinker's fingers aren't in the Fixer's arm slot") + TEST_ASSERT(street.speed_modifier != parent.speed_modifier, "Tinker's fingers would replace the Fixer's speed-up") + TEST_ASSERT_EQUAL(length(street.items_to_create), length(parent.items_to_create), "Tinker's fingers carry a different number of tools") + for(var/tool_path in parent.items_to_create) + TEST_ASSERT(tool_path in street.items_to_create, "Tinker's fingers lost [tool_path]") + + // The speed-up rides the running ware: on with the fingers in, off with them out. + var/mob/living/carbon/human/tinker = allocate(/mob/living/carbon/human/consistent, run_loc_floor_bottom_left) + TEST_ASSERT(street.Insert(tinker, special = TRUE), "Tinker's fingers wouldn't go in") + TEST_ASSERT(tinker.has_actionspeed_modifier(street.speed_modifier), "Tinker's fingers gave no speed-up") + TEST_ASSERT(!tinker.has_actionspeed_modifier(parent.speed_modifier), "Tinker's fingers gave the Fixer's speed-up") + street.Remove(tinker, special = TRUE) + TEST_ASSERT(!tinker.has_actionspeed_modifier(street.speed_modifier), "The speed-up outlived Tinker's fingers") + + var/mob/living/carbon/human/fixer = allocate(/mob/living/carbon/human/consistent, run_loc_floor_bottom_left) + TEST_ASSERT(parent.Insert(fixer, special = TRUE), "The Fixer's Fingers wouldn't go in") + TEST_ASSERT(fixer.has_actionspeed_modifier(parent.speed_modifier), "The Fixer's Fingers gave no speed-up") + TEST_ASSERT(!fixer.has_actionspeed_modifier(street.speed_modifier), "The Fixer's Fingers gave Tinker's speed-up") + +/// The Deepcore: a heavier drill on the Rockjaw's hopper and buttons. +/datum/unit_test/voidcrew_cyberware_models_a_deepcore + +/datum/unit_test/voidcrew_cyberware_models_a_deepcore/Run() + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/rockjaw/parent = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/rockjaw) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/rockjaw/deepcore/deepcore = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/rockjaw/deepcore) + TEST_ASSERT_EQUAL(parent.chrome_load, 2, "The Rockjaw's load changed") + TEST_ASSERT_EQUAL(parent.tier, 1, "The Rockjaw's tier changed") + TEST_ASSERT_EQUAL(deepcore.chrome_load, 3, "The Deepcore's load isn't 3") + TEST_ASSERT_EQUAL(deepcore.tier, 2, "The Deepcore isn't tier 2") + TEST_ASSERT_EQUAL(deepcore.slot, parent.slot, "The Deepcore isn't in the Rockjaw's arm slot") + + var/obj/item/pickaxe/drill/cyberware/rockjaw_drill = locate(/obj/item/pickaxe/drill/cyberware) in parent + var/obj/item/pickaxe/drill/cyberware/deepcore/deepcore_drill = locate(/obj/item/pickaxe/drill/cyberware/deepcore) in deepcore + TEST_ASSERT_NOTNULL(rockjaw_drill, "The Rockjaw has no drill") + TEST_ASSERT_EQUAL(rockjaw_drill.type, /obj/item/pickaxe/drill/cyberware, "The Rockjaw carries a different drill") + TEST_ASSERT_EQUAL(rockjaw_drill.toolspeed, 0.5, "The Rockjaw's drill changed speed") + TEST_ASSERT_NOTNULL(deepcore_drill, "The Deepcore has no Deepcore drill") + TEST_ASSERT_EQUAL(deepcore_drill.toolspeed, 0.3, "The Deepcore drill isn't 0.3") + var/obj/item/pickaxe/drill/diamonddrill/diamond = allocate(/obj/item/pickaxe/drill/diamonddrill) + TEST_ASSERT(deepcore_drill.toolspeed > diamond.toolspeed, "The Deepcore drill is faster than a diamond drill") + TEST_ASSERT(deepcore_drill.toolspeed < rockjaw_drill.toolspeed, "The Deepcore drill isn't faster than the Rockjaw's") + + // The hopper button comes along. + TEST_ASSERT(locate(/datum/action/item_action/organ_action/rockjaw_hopper) in deepcore.actions, "The Deepcore lost the ore hopper button") + +/// The Holdout: six rounds of ordinary .38 in a folding arm revolver, thumbed in +/// by hand a round at a time, and the housing shows when someone looks at the arm. +/datum/unit_test/voidcrew_cyberware_models_a_holdout + +/datum/unit_test/voidcrew_cyberware_models_a_holdout/Run() + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin/ronin = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin/holdout/holdout = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin/holdout) + + // The parent is untouched. + TEST_ASSERT_EQUAL(ronin.chrome_load, 5, "The Ronin's load changed") + TEST_ASSERT_EQUAL(ronin.tier, 3, "The Ronin's tier changed") + TEST_ASSERT(/obj/item/gun/ballistic/automatic/cyberware_ronin in ronin.items_to_create, "The Ronin lost its machine pistol") + + TEST_ASSERT_EQUAL(holdout.chrome_load, 3, "The Holdout's load isn't 3") + TEST_ASSERT_EQUAL(holdout.tier, 2, "The Holdout isn't tier 2") + TEST_ASSERT_EQUAL(holdout.slot, ronin.slot, "The Holdout isn't in the Ronin's arm slot") + TEST_ASSERT_EQUAL(holdout.zone, ronin.zone, "The Holdout isn't in the Ronin's arm zone") + TEST_ASSERT_EQUAL(length(holdout.items_to_create), 1, "The Holdout carries more than the one revolver") + TEST_ASSERT(!(/obj/item/gun/ballistic/automatic/cyberware_ronin in holdout.items_to_create), "The Holdout carries the Ronin's machine pistol") + + // A loaded six-shot .38 with a slow trigger. + var/obj/item/gun/ballistic/revolver/cyberware_holdout/gun = locate() in holdout + TEST_ASSERT_NOTNULL(gun, "The Holdout housing holds no revolver") + TEST_ASSERT_EQUAL(gun.magazine.max_ammo, 6, "The Holdout's cylinder isn't six chambers") + TEST_ASSERT_EQUAL(gun.magazine.caliber, CALIBER_38, "The Holdout doesn't take .38") + TEST_ASSERT_EQUAL(gun.get_ammo(FALSE, FALSE), 6, "The Holdout doesn't leave the shop loaded") + TEST_ASSERT_EQUAL(gun.fire_delay, 0.4 SECONDS, "The Holdout's trigger isn't 0.4 seconds") + TEST_ASSERT(!gun.magazine.multiload, "The Holdout's cylinder loads a speedloader at once") + + // The cylinder takes a speedloader a round at a time. An ordinary revolver + // cylinder takes all it has room for. + var/mob/living/carbon/human/loader = allocate(/mob/living/carbon/human/consistent, run_loc_floor_bottom_left) + var/obj/item/ammo_box/magazine/internal/cylinder/rev38/cyberware_holdout/cylinder = allocate(/obj/item/ammo_box/magazine/internal/cylinder/rev38/cyberware_holdout) + var/obj/item/ammo_box/magazine/internal/cylinder/rev38/detective_cylinder = allocate(/obj/item/ammo_box/magazine/internal/cylinder/rev38) + for(var/obj/item/ammo_box/magazine/internal/cylinder/rev38/emptied as anything in list(cylinder, detective_cylinder)) + // ammo_list() spawns the cylinder's lazy rounds, so there is something to remove. + for(var/obj/item/ammo_casing/round in emptied.ammo_list()) + qdel(round) + TEST_ASSERT_EQUAL(emptied.ammo_count(FALSE), 0, "A test cylinder didn't empty") + var/obj/item/ammo_box/c38/speedloader = allocate(/obj/item/ammo_box/c38) + var/obj/item/ammo_box/c38/second_speedloader = allocate(/obj/item/ammo_box/c38) + TEST_ASSERT_EQUAL(cylinder.attackby(speedloader, loader, null, TRUE), 1, "The Holdout cylinder took more than a round from a speedloader") + TEST_ASSERT_EQUAL(detective_cylinder.attackby(second_speedloader, loader, null, TRUE), 6, "An ordinary .38 cylinder stopped taking a whole speedloader") + + // A full cylinder has no room, a spent chamber or an empty one has. + TEST_ASSERT(!gun.cylinder_has_room(), "A full Holdout cylinder claims room") + var/list/rounds = gun.magazine.ammo_list() + var/obj/item/ammo_casing/first_round = rounds[1] + QDEL_NULL(first_round.loaded_projectile) + TEST_ASSERT(gun.cylinder_has_room(), "A spent chamber doesn't count as room") + // A full cylinder is refused outright, with no wait. + var/obj/item/gun/ballistic/revolver/cyberware_holdout/full_gun = allocate(/obj/item/gun/ballistic/revolver/cyberware_holdout) + TEST_ASSERT(!full_gun.load_gun(speedloader, loader), "A full Holdout cylinder took another round") + TEST_ASSERT_EQUAL(full_gun.get_ammo(FALSE, FALSE), 6, "Refusing a round cost the Holdout one") + + // The housing shows when someone looks at the bearer, and stops when it is gone. + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent, run_loc_floor_bottom_left) + var/mob/living/carbon/human/onlooker = allocate(/mob/living/carbon/human/consistent, run_loc_floor_bottom_left) + var/list/before_lines = list() + SEND_SIGNAL(bearer, COMSIG_ATOM_EXAMINE, onlooker, before_lines) + TEST_ASSERT(!findtext(jointext(before_lines, " "), "revolver housing"), "A body with no Holdout shows a revolver housing") + TEST_ASSERT(holdout.Insert(bearer, special = TRUE), "The Holdout housing wouldn't go in") + var/list/lines = list() + SEND_SIGNAL(bearer, COMSIG_ATOM_EXAMINE, onlooker, lines) + TEST_ASSERT(findtext(jointext(lines, " "), "revolver housing"), "Looking at the bearer doesn't show the Holdout housing") + holdout.Remove(bearer, special = TRUE) + var/list/after_lines = list() + SEND_SIGNAL(bearer, COMSIG_ATOM_EXAMINE, onlooker, after_lines) + TEST_ASSERT(!findtext(jointext(after_lines, " "), "revolver housing"), "The housing still shows after it was pulled") + +/// What the shelf asks and what the ledger pays, per the plan. Every ledger +/// entry is half the shelf price of the piece, credits only, and takes both +/// ripperdocs' wording. The Vaulter is voucher chrome and has no entry. +/datum/unit_test/voidcrew_cyberware_models_a_shelf + +/datum/unit_test/voidcrew_cyberware_models_a_shelf/Run() + // SKU, what it sells, credits, vouchers, zone permission (0 public, 1 yellow, 2 advanced), pieces per sale + var/list/shelf = list( + list(/datum/shop_sku/ripperdoc/hopper_street, /obj/item/organ/cyberimp/cyberware/hopper/street, 1800, 0, 1, 1), + list(/datum/shop_sku/ripperdoc/hopper_milspec, /obj/item/organ/cyberimp/cyberware/hopper/milspec, 0, 3, 2, 1), + list(/datum/shop_sku/ripperdoc/gorilla_street, /obj/item/cyberware_pair_case/gorilla_arms/street, 1600, 0, 1, 2), + list(/datum/shop_sku/ripperdoc/fixers_street, /obj/item/organ/cyberimp/arm/toolkit/cyberware/fixers/street, 700, 0, 0, 1), + list(/datum/shop_sku/ripperdoc/rockjaw_deepcore, /obj/item/organ/cyberimp/arm/toolkit/cyberware/rockjaw/deepcore, 2400, 0, 0, 1), + list(/datum/shop_sku/ripperdoc/ronin_holdout, /obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin/holdout, 2400, 0, 1, 1), + ) + build_cyberware_price_index() + for(var/list/row as anything in shelf) + var/datum/shop_sku/sku = allocate(row[1]) + TEST_ASSERT_EQUAL(sku.item_path, row[2], "[row[1]] sells the wrong item") + TEST_ASSERT_EQUAL(sku.price_credits, row[3], "[row[1]] asks the wrong credits") + TEST_ASSERT_EQUAL(sku.price_vouchers, row[4], "[row[1]] asks the wrong vouchers") + TEST_ASSERT_EQUAL(sku.zone_permission, row[5], "[row[1]] sits at the wrong reputation") + TEST_ASSERT(sku.price_credits <= 0 || sku.category == "Street Chrome", "[row[1]] is credit chrome off the street shelf") + TEST_ASSERT(sku.price_vouchers <= 0 || sku.category == "Military Chrome", "[row[1]] is voucher chrome off the military shelf") + if(row[1] == /datum/shop_sku/ripperdoc/ronin_holdout || row[1] == /datum/shop_sku/ripperdoc/gorilla_street) + TEST_ASSERT(sku.fixed_price && !sku.contract_reward, "[row[1]] can be discounted or handed out as a contract reward") + + // What the cradle quotes for the pieces. A pair quotes the whole case on each half. + var/list/quote = GLOB.cyberware_price_index[/obj/item/organ/cyberimp/cyberware/hopper/street] + TEST_ASSERT(quote && quote["credits"] == 1800 && !quote["vouchers"], "Spring calves quote the wrong price") + quote = GLOB.cyberware_price_index[/obj/item/organ/cyberimp/cyberware/hopper/milspec] + TEST_ASSERT(quote && quote["vouchers"] == 3 && !quote["credits"], "Vaulter pistons quote the wrong price") + for(var/pair_half in list(/obj/item/organ/cyberimp/cyberware/gorilla_arms/street, /obj/item/organ/cyberimp/cyberware/gorilla_arms/street/left)) + quote = GLOB.cyberware_price_index[pair_half] + TEST_ASSERT(quote && quote["credits"] == 1600 && quote["paired"], "[pair_half] doesn't quote the pair's price") + quote = GLOB.cyberware_price_index[/obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin/holdout] + TEST_ASSERT(quote && quote["credits"] == 2400, "The Holdout quotes the wrong price") + + // Ledger: half the shelf price of one piece, credits only, either side of a pair. + var/list/ledgers = list( + list(/datum/shop_buyback/ripperdoc/hopper_street, /datum/shop_buyback/ripperdoc/hopper_street/street_doc, /obj/item/organ/cyberimp/cyberware/hopper/street, 900), + list(/datum/shop_buyback/ripperdoc/gorilla_street, /datum/shop_buyback/ripperdoc/gorilla_street/street_doc, /obj/item/organ/cyberimp/cyberware/gorilla_arms/street, 400), + list(/datum/shop_buyback/ripperdoc/fixers_street, /datum/shop_buyback/ripperdoc/fixers_street/street_doc, /obj/item/organ/cyberimp/arm/toolkit/cyberware/fixers/street, 350), + list(/datum/shop_buyback/ripperdoc/ronin_holdout, /datum/shop_buyback/ripperdoc/ronin_holdout/street_doc, /obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin/holdout, 1200), + list(/datum/shop_buyback/ripperdoc/rockjaw_deepcore, /datum/shop_buyback/ripperdoc/rockjaw_deepcore/street_doc, /obj/item/organ/cyberimp/arm/toolkit/cyberware/rockjaw/deepcore, 1200), + ) + for(var/list/row as anything in ledgers) + for(var/ledger_index in 1 to 2) + var/datum/shop_buyback/ledger = allocate(row[ledger_index]) + TEST_ASSERT_EQUAL(ledger.item_path, row[3], "[row[ledger_index]] buys the wrong piece") + TEST_ASSERT_EQUAL(ledger.pay_credits, row[4], "[row[ledger_index]] pays the wrong credits") + TEST_ASSERT(!ledger.pay_vouchers, "[row[ledger_index]] pays vouchers") + TEST_ASSERT(ledger.takes_shop_stock(), "[row[ledger_index]] refuses chrome bought at a counter") + + // Either side of a Brawler pair is taken, and nothing else of the Gorilla line. + var/datum/shop_buyback/brawler_ledger = allocate(/datum/shop_buyback/ripperdoc/gorilla_street) + TEST_ASSERT(brawler_ledger.matches(allocate(/obj/item/organ/cyberimp/cyberware/gorilla_arms/street)), "The ledger won't take a right Brawler arm") + TEST_ASSERT(brawler_ledger.matches(allocate(/obj/item/organ/cyberimp/cyberware/gorilla_arms/street/left)), "The ledger won't take a left Brawler arm") + TEST_ASSERT(!brawler_ledger.matches(allocate(/obj/item/organ/cyberimp/cyberware/gorilla_arms)), "The Brawler ledger takes a real Gorilla arm") + var/datum/shop_buyback/spring_ledger = allocate(/datum/shop_buyback/ripperdoc/hopper_street) + TEST_ASSERT(!spring_ledger.matches(allocate(/obj/item/organ/cyberimp/cyberware/hopper)), "The Spring calves ledger takes a Hopper") + TEST_ASSERT(!spring_ledger.matches(allocate(/obj/item/organ/cyberimp/cyberware/hopper/milspec)), "The Spring calves ledger takes Vaulter pistons") + var/datum/shop_buyback/tinker_ledger = allocate(/datum/shop_buyback/ripperdoc/fixers_street) + TEST_ASSERT(!tinker_ledger.matches(allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/fixers)), "The Tinker's ledger takes the Fixer's Fingers") + var/datum/shop_buyback/deepcore_ledger = allocate(/datum/shop_buyback/ripperdoc/rockjaw_deepcore) + TEST_ASSERT(!deepcore_ledger.matches(allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/rockjaw)), "The Deepcore ledger takes a plain Rockjaw") diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware_models_b.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware_models_b.dm new file mode 100644 index 00000000000..a6f07ffc9b1 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware_models_b.dm @@ -0,0 +1,404 @@ +/** + * # Cyberware models, set B + * + * Hardweave plating, the Strut frame, the Deep-lung bladder, the Heat-sink and + * Frostline linings, the Twitchwire and Weaver shunt, and the Thumper ear + * (voidcrew/modules/cyberware/ware_models_b.dm). Each model has to share its + * parent's slot, keep its own numbers, and leave the parent's numbers exactly + * as they were. + * + * Unit-test files compile before voidcrew/_DEFINES/, so the fork's defines are + * written as literals below: CYBERWARE_TIER_1/2/3 are 1/2/3, and the + * unbreakable-bones trait is "cyberware_unbreakable_bones". + */ + +/// Every model sits in its parent's slot with the planned load and tier, a +/// state of its own, and a description without a number in it. +/datum/unit_test/voidcrew_cyberware_models_b_slots + +/datum/unit_test/voidcrew_cyberware_models_b_slots/Run() + // model, parent, load, tier + var/list/models = list( + list(/obj/item/organ/cyberimp/cyberware/dermal_mesh/hardweave, /obj/item/organ/cyberimp/cyberware/dermal_mesh, 3, 2), + list(/obj/item/organ/cyberimp/cyberware/atlas/street, /obj/item/organ/cyberimp/cyberware/atlas, 2, 2), + list(/obj/item/organ/cyberimp/cyberware/second_wind/deep, /obj/item/organ/cyberimp/cyberware/second_wind, 2, 2), + list(/obj/item/organ/cyberimp/cyberware/coolant/street, /obj/item/organ/cyberimp/cyberware/coolant, 1, 1), + list(/obj/item/organ/cyberimp/cyberware/frostline, /obj/item/organ/cyberimp/cyberware/coolant, 1, 1), + list(/obj/item/organ/cyberimp/cyberware/slipwire/street, /obj/item/organ/cyberimp/cyberware/slipwire, 2, 1), + list(/obj/item/organ/cyberimp/cyberware/slipwire/milspec, /obj/item/organ/cyberimp/cyberware/slipwire, 5, 3), + list(/obj/item/organ/cyberimp/cyberware/doppler/street, /obj/item/organ/cyberimp/cyberware/doppler, 1, 1), + ) + for(var/list/row as anything in models) + var/obj/item/organ/cyberimp/cyberware/ware = allocate(row[1]) + var/obj/item/organ/cyberimp/cyberware/parent = allocate(row[2]) + var/datum/component/cyberware/chrome = ware.GetComponent(/datum/component/cyberware) + TEST_ASSERT_NOTNULL(chrome, "[ware.type] has no cyberware component") + TEST_ASSERT_EQUAL(ware.slot, parent.slot, "[ware.type] is not in [parent.type]'s slot, so the two would stack") + TEST_ASSERT_EQUAL(ware.zone, parent.zone, "[ware.type] is in a different body zone from [parent.type]") + TEST_ASSERT_EQUAL(chrome.chrome_load, row[3], "[ware.type] has the wrong chrome load") + TEST_ASSERT_EQUAL(chrome.tier, row[4], "[ware.type] has the wrong tier") + TEST_ASSERT(!findtext(ware.desc, regex("\[0-9]")), "[ware.type]'s description has a number in it") + TEST_ASSERT(!findtext(ware.desc, "tier") && !findtext(ware.desc, "load"), "[ware.type]'s description talks about game rules") + if(ware.type != /obj/item/organ/cyberimp/cyberware/frostline) + TEST_ASSERT(ware.icon_state != parent.icon_state, "[ware.type] reuses its parent's item state") + // Where the parent has a worn look, the model has its own. + if(parent.aug_overlay) + TEST_ASSERT(ware.aug_overlay && ware.aug_overlay != parent.aug_overlay, "[ware.type] wears its parent's overlay") + + // The seal slot is one slot with five choices: whichever went in last is + // the only one left. + var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human/consistent) + var/list/seal_ware = list( + /obj/item/organ/cyberimp/cyberware/second_wind, + /obj/item/organ/cyberimp/cyberware/second_wind/deep, + /obj/item/organ/cyberimp/cyberware/coolant/street, + /obj/item/organ/cyberimp/cyberware/frostline, + /obj/item/organ/cyberimp/cyberware/coolant, + ) + var/list/placed = list() + for(var/seal_path in seal_ware) + var/obj/item/organ/cyberimp/cyberware/seal = allocate(seal_path) + TEST_ASSERT(seal.Insert(patient, special = TRUE), "[seal_path] staging insert was refused") + TEST_ASSERT_EQUAL(patient.get_organ_slot(seal.slot), seal, "[seal_path] did not take the seal slot") + for(var/obj/item/organ/earlier as anything in placed) + TEST_ASSERT(earlier.owner != patient, "[earlier.type] stayed in the seal slot beside [seal_path]") + placed += seal + +/// The parents run on the numbers they had before the vars existed. +/datum/unit_test/voidcrew_cyberware_models_b_parents + +/datum/unit_test/voidcrew_cyberware_models_b_parents/Run() + var/obj/item/organ/cyberimp/cyberware/second_wind/bladder = allocate(/obj/item/organ/cyberimp/cyberware/second_wind) + TEST_ASSERT_EQUAL(bladder.reserve, 180 SECONDS, "Second Wind's reserve changed") + TEST_ASSERT_EQUAL(bladder.max_reserve, 180 SECONDS, "Second Wind's cap changed") + TEST_ASSERT_EQUAL(bladder.refill_rate, 16 SECONDS, "Second Wind's refill changed") + + var/obj/item/organ/cyberimp/cyberware/coolant/loops = allocate(/obj/item/organ/cyberimp/cyberware/coolant) + TEST_ASSERT_EQUAL(loops.burn_mult, 0.5, "Coolant Loops stopped halving burns") + + var/obj/item/organ/cyberimp/cyberware/slipwire/slipwire = allocate(/obj/item/organ/cyberimp/cyberware/slipwire) + TEST_ASSERT_EQUAL(slipwire.dodge_chance, 15, "Slipwire's dodge changed") + TEST_ASSERT_EQUAL(slipwire.gait_modifier, /datum/movespeed_modifier/cyberware_slipwire, "Slipwire's gait changed") + TEST_ASSERT(!findtext(slipwire.desc, "seven") && !findtext(slipwire.desc, regex("\[0-9]")), "Slipwire's description still quotes its odds") + + var/obj/item/organ/cyberimp/cyberware/doppler/doppler = allocate(/obj/item/organ/cyberimp/cyberware/doppler) + TEST_ASSERT_EQUAL(doppler.sonar_range, 9, "Heartbeat Doppler's range changed") + TEST_ASSERT_EQUAL(doppler.contact_fade, 4 SECONDS, "Heartbeat Doppler's fade changed") + TEST_ASSERT_EQUAL(doppler.ping_volume_bonus, 0, "Heartbeat Doppler's ping got louder") + + var/obj/item/organ/cyberimp/cyberware/atlas/atlas = allocate(/obj/item/organ/cyberimp/cyberware/atlas) + TEST_ASSERT_EQUAL(atlas.throw_range_bonus, 2, "Atlas Frame's throw range changed") + TEST_ASSERT_EQUAL(atlas.throw_speed_bonus, 1, "Atlas Frame's throw speed changed") + TEST_ASSERT(atlas.resists_knockback, "Atlas Frame stopped resisting knockback") + // The text pass cut the examine line that explained the frame's rules. + TEST_ASSERT_NULL(atlas.frame_examine, "Atlas Frame's examine explains its rules again") + TEST_ASSERT(TRAIT_NODISMEMBER in atlas.organ_traits, "Atlas Frame stopped holding limbs on") + TEST_ASSERT("cyberware_unbreakable_bones" in atlas.organ_traits, "Atlas Frame stopped holding bones together") + + var/obj/item/organ/cyberimp/cyberware/dermal_mesh/mesh = allocate(/obj/item/organ/cyberimp/cyberware/dermal_mesh) + TEST_ASSERT_EQUAL(mesh.mesh_armor, /datum/armor/cyberware_dermal_mesh, "Dermal Mesh's plating changed") + +/// Hardweave sits between the Mesh and the Slabskin Plate, and swapping it for +/// the Mesh hands back exactly the difference. +/datum/unit_test/voidcrew_cyberware_models_b_hardweave + +/datum/unit_test/voidcrew_cyberware_models_b_hardweave/Run() + var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/dermal_mesh/hardweave/hardweave = allocate(/obj/item/organ/cyberimp/cyberware/dermal_mesh/hardweave) + var/obj/item/organ/cyberimp/cyberware/dermal_mesh/mesh = allocate(/obj/item/organ/cyberimp/cyberware/dermal_mesh) + // melee, bullet, laser, energy, wound + var/list/ratings = list(MELEE, BULLET, LASER, ENERGY, WOUND) + var/list/bare = list() + for(var/rating in ratings) + bare[rating] = patient.physiology.armor.get_rating(rating) + + TEST_ASSERT(hardweave.Insert(patient, special = TRUE), "Hardweave staging insert was refused") + var/list/hardweave_plus = list(20, 20, 15, 10, 10) + for(var/index in 1 to length(ratings)) + var/rating = ratings[index] + TEST_ASSERT_EQUAL(patient.physiology.armor.get_rating(rating), bare[rating] + hardweave_plus[index], "Hardweave gave the wrong [rating] armour") + + TEST_ASSERT(mesh.Insert(patient, special = TRUE), "Dermal Mesh staging insert was refused") + TEST_ASSERT(!hardweave.owner, "Hardweave stayed in the dermal slot beside the Mesh") + var/list/mesh_plus = list(15, 15, 10, 0, 5) + for(var/index in 1 to length(ratings)) + var/rating = ratings[index] + TEST_ASSERT_EQUAL(patient.physiology.armor.get_rating(rating), bare[rating] + mesh_plus[index], "Swapping Hardweave for the Mesh left the wrong [rating] armour") + + TEST_ASSERT(hardweave.Insert(patient, special = TRUE), "Hardweave second staging insert was refused") + patient.emp_act(EMP_HEAVY) + TEST_ASSERT(hardweave.organ_flags & ORGAN_FAILING, "An EMP never reached Hardweave") + for(var/rating in ratings) + TEST_ASSERT_EQUAL(patient.physiology.armor.get_rating(rating), bare[rating], "EMP-scrambled Hardweave kept armouring its bearer") + var/datum/component/cyberware/chrome = hardweave.GetComponent(/datum/component/cyberware) + chrome.tune_up() + TEST_ASSERT_EQUAL(patient.physiology.armor.get_rating(MELEE), bare[MELEE] + 20, "A tune-up did not hand Hardweave's plating back") + hardweave.Remove(patient, special = TRUE) + TEST_ASSERT_EQUAL(patient.physiology.armor.get_rating(MELEE), bare[MELEE], "Pulling Hardweave left plating on the body") + +/// The Strut frame holds bones and nothing else; the Atlas it undercuts still +/// holds limbs on and still throws and shrugs like a frame. +/datum/unit_test/voidcrew_cyberware_models_b_strut + +/datum/unit_test/voidcrew_cyberware_models_b_strut/Run() + var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/atlas/street/strut = allocate(/obj/item/organ/cyberimp/cyberware/atlas/street) + var/obj/item/organ/cyberimp/cyberware/atlas/atlas = allocate(/obj/item/organ/cyberimp/cyberware/atlas) + + TEST_ASSERT(strut.Insert(patient, special = TRUE), "Strut frame staging insert was refused") + TEST_ASSERT(HAS_TRAIT(patient, "cyberware_unbreakable_bones"), "The Strut frame did not keep the bones together") + TEST_ASSERT(!HAS_TRAIT(patient, TRAIT_NODISMEMBER), "The Strut frame keeps limbs on") + TEST_ASSERT_NULL(strut._signal_procs?[patient]?[COMSIG_MOB_THROW], "The Strut frame is boosting throws") + TEST_ASSERT_NULL(strut._signal_procs?[patient]?[COMSIG_MOVABLE_PRE_THROW], "The Strut frame is resisting knockback") + var/examined = jointext(strut.examine(patient), " ") + TEST_ASSERT(!findtext(examined, "no losing a limb"), "The Strut frame examine still promises limbs stay on") + + // The Atlas replaces it and gets everything back. + TEST_ASSERT(atlas.Insert(patient, special = TRUE), "Atlas staging insert was refused") + TEST_ASSERT(!strut.owner, "The Strut frame stayed in the frame slot beside the Atlas") + TEST_ASSERT(HAS_TRAIT(patient, "cyberware_unbreakable_bones"), "The Atlas lost its bones") + TEST_ASSERT(HAS_TRAIT(patient, TRAIT_NODISMEMBER), "The Atlas lost its limbs") + TEST_ASSERT_NOTNULL(atlas._signal_procs?[patient]?[COMSIG_MOB_THROW], "The Atlas stopped boosting throws") + TEST_ASSERT_NOTNULL(atlas._signal_procs?[patient]?[COMSIG_MOVABLE_PRE_THROW], "The Atlas stopped resisting knockback") + + // And the Atlas still does the arithmetic it did. + var/list/thrown = list(null, 8, 1, patient) + atlas.boost_throw(null, thrown) + TEST_ASSERT_EQUAL(thrown[2], 10, "The Atlas added the wrong range to a throw") + TEST_ASSERT_EQUAL(thrown[3], 2, "The Atlas added the wrong speed to a throw") + var/list/shoved = list(null, 8, 1, null) + atlas.on_owner_thrown(patient, shoved) + TEST_ASSERT_EQUAL(shoved[2], 4, "The Atlas stopped halving knockback") + + atlas.Remove(patient, special = TRUE) + TEST_ASSERT(!HAS_TRAIT(patient, "cyberware_unbreakable_bones") && !HAS_TRAIT(patient, TRAIT_NODISMEMBER), "Pulling the Atlas left traits on the body") + +/// Deep-lung, Heat-sink and Frostline. +/datum/unit_test/voidcrew_cyberware_models_b_seal + +/datum/unit_test/voidcrew_cyberware_models_b_seal/Run() + var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human/consistent) + + // Deep-lung: a bigger bladder that refills faster, otherwise a Second Wind. + var/obj/item/organ/cyberimp/cyberware/second_wind/deep/deep = allocate(/obj/item/organ/cyberimp/cyberware/second_wind/deep) + TEST_ASSERT_EQUAL(deep.max_reserve, 360 SECONDS, "The Deep-lung bladder holds the wrong amount") + TEST_ASSERT_EQUAL(deep.reserve, deep.max_reserve, "The Deep-lung bladder starts partly empty") + TEST_ASSERT_EQUAL(deep.refill_rate, 24 SECONDS, "The Deep-lung bladder refills at the wrong rate") + TEST_ASSERT(deep.Insert(patient, special = TRUE), "Deep-lung staging insert was refused") + deep.reserve = 0 + patient.forceMove(run_loc_floor_bottom_left) + patient.breathe(2, 1) + TEST_ASSERT_EQUAL(deep.reserve, 24 SECONDS, "A breath of good air refilled the wrong amount of Deep-lung reserve") + deep.reserve = deep.max_reserve - 10 + patient.breathe(2, 1) + TEST_ASSERT_EQUAL(deep.reserve, deep.max_reserve, "The Deep-lung bladder refilled past its cap") + deep.Remove(patient, special = TRUE) + + // Heat-sink: the heat half of the loops, no burn halving. + var/obj/item/organ/cyberimp/cyberware/coolant/street/sink = allocate(/obj/item/organ/cyberimp/cyberware/coolant/street) + var/obj/item/organ/cyberimp/cyberware/coolant/loops = allocate(/obj/item/organ/cyberimp/cyberware/coolant) + var/bare_burn = patient.physiology.burn_mod + TEST_ASSERT(sink.Insert(patient, special = TRUE), "Heat-sink staging insert was refused") + TEST_ASSERT(HAS_TRAIT(patient, TRAIT_RESISTHEAT), "The Heat-sink lining does not turn heat away") + TEST_ASSERT_EQUAL(patient.physiology.burn_mod, bare_burn, "The Heat-sink lining halves burns") + TEST_ASSERT(!sink.coolant_mod_applied, "The Heat-sink lining thinks it applied a burn mod") + patient.adjust_fire_stacks(5) + var/lit_stacks = patient.fire_stacks + TEST_ASSERT(lit_stacks > 0, "Test fixture: the patient took no fire stacks") + sink.on_life(1, 1) + TEST_ASSERT(patient.fire_stacks < lit_stacks, "The Heat-sink lining does not scrub fire") + patient.set_fire_stacks(0) + + TEST_ASSERT(loops.Insert(patient, special = TRUE), "Coolant Loops staging insert was refused") + TEST_ASSERT(!sink.owner, "The Heat-sink lining stayed in the seal slot beside the loops") + TEST_ASSERT_EQUAL(patient.physiology.burn_mod, bare_burn * 0.5, "Coolant Loops stopped halving burns") + TEST_ASSERT(sink.Insert(patient, special = TRUE), "Heat-sink second staging insert was refused") + TEST_ASSERT_EQUAL(patient.physiology.burn_mod, bare_burn, "Swapping the loops for the Heat-sink left a burn mod on the body") + sink.Remove(patient, special = TRUE) + TEST_ASSERT(!HAS_TRAIT(patient, TRAIT_RESISTHEAT), "Pulling the Heat-sink left heat immunity on the body") + + // Frostline: the cold stops hurting and nothing else changes. + var/obj/item/organ/cyberimp/cyberware/frostline/frost = allocate(/obj/item/organ/cyberimp/cyberware/frostline) + TEST_ASSERT(frost.Insert(patient, special = TRUE), "Frostline staging insert was refused") + TEST_ASSERT(HAS_TRAIT(patient, TRAIT_RESISTCOLD), "Frostline does not turn the cold away") + TEST_ASSERT(!HAS_TRAIT(patient, TRAIT_RESISTHEAT), "Frostline turns the heat away too") + TEST_ASSERT(!HAS_TRAIT(patient, TRAIT_NOBREATH) && !HAS_TRAIT(patient, TRAIT_RESISTLOWPRESSURE), "Frostline does more than the cold") + TEST_ASSERT_EQUAL(patient.physiology.burn_mod, bare_burn, "Frostline changed how burns land") + patient.emp_act(EMP_HEAVY) + TEST_ASSERT(frost.organ_flags & ORGAN_FAILING, "An EMP never reached the Frostline lining") + TEST_ASSERT(!HAS_TRAIT(patient, TRAIT_RESISTCOLD), "An EMP-scrambled Frostline lining kept the cold off") + var/datum/component/cyberware/chrome = frost.GetComponent(/datum/component/cyberware) + chrome.tune_up() + TEST_ASSERT(HAS_TRAIT(patient, TRAIT_RESISTCOLD), "A tune-up did not bring the Frostline lining back") + frost.Remove(patient, special = TRUE) + TEST_ASSERT(!HAS_TRAIT(patient, TRAIT_RESISTCOLD), "Pulling the Frostline lining left cold resistance on the body") + +/// A fixed dodge for the arbiter tests. +/datum/unit_test/voidcrew_cyberware_models_b_slipwire + /// Stand-in for a Cascade window's source. + var/test_source_chance = 40 + +/datum/unit_test/voidcrew_cyberware_models_b_slipwire/proc/fixed_chance() + return test_source_chance + +/// Twitchwire and the Weaver shunt dodge through the shared arbiter and bring +/// their own gait; the Slipwire between them keeps its own. +/datum/unit_test/voidcrew_cyberware_models_b_slipwire/Run() + var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/slipwire/slipwire = allocate(/obj/item/organ/cyberimp/cyberware/slipwire) + var/obj/item/organ/cyberimp/cyberware/slipwire/street/twitch = allocate(/obj/item/organ/cyberimp/cyberware/slipwire/street) + var/obj/item/organ/cyberimp/cyberware/slipwire/milspec/weaver = allocate(/obj/item/organ/cyberimp/cyberware/slipwire/milspec) + + // ware, dodge chance, gait modifier (null for none) + var/list/rungs = list( + list(twitch, 8, null), + list(slipwire, 15, /datum/movespeed_modifier/cyberware_slipwire), + list(weaver, 20, /datum/movespeed_modifier/cyberware_slipwire/weaver), + ) + var/list/every_gait = list(/datum/movespeed_modifier/cyberware_slipwire, /datum/movespeed_modifier/cyberware_slipwire/weaver) + for(var/list/rung as anything in rungs) + var/obj/item/organ/cyberimp/cyberware/slipwire/ware = rung[1] + TEST_ASSERT(ware.Insert(patient, special = TRUE), "[ware.type] staging insert was refused") + var/datum/component/cyberware_dodge/arbiter = patient.GetComponent(/datum/component/cyberware_dodge) + TEST_ASSERT_NOTNULL(arbiter, "[ware.type] never reached the shared dodge arbiter") + TEST_ASSERT_EQUAL(length(arbiter.dodge_sources), 1, "[ware.type] left [length(arbiter.dodge_sources)] dodge sources, the ladder stacked") + var/datum/callback/source = arbiter.dodge_sources[REF(ware)] + TEST_ASSERT_NOTNULL(source, "[ware.type] registered no dodge source of its own") + TEST_ASSERT_EQUAL(source.Invoke(), rung[2], "[ware.type] dodges at the wrong chance") + for(var/gait in every_gait) + TEST_ASSERT_EQUAL(!!patient.has_movespeed_modifier(gait), (gait == rung[3]) ? 1 : 0, "[ware.type] has the wrong gait") + + // A scrambled ware dodges nothing and runs no faster. + patient.emp_act(EMP_HEAVY) + var/datum/component/cyberware_dodge/scrambled = patient.GetComponent(/datum/component/cyberware_dodge) + var/datum/callback/scrambled_source = scrambled.dodge_sources[REF(weaver)] + TEST_ASSERT_EQUAL(scrambled_source.Invoke(), 0, "An EMP-scrambled Weaver shunt still dodges") + TEST_ASSERT(!patient.has_movespeed_modifier(/datum/movespeed_modifier/cyberware_slipwire/weaver), "An EMP-scrambled Weaver shunt still runs fast") + var/datum/component/cyberware/chrome = weaver.GetComponent(/datum/component/cyberware) + chrome.tune_up() + TEST_ASSERT(patient.has_movespeed_modifier(/datum/movespeed_modifier/cyberware_slipwire/weaver), "A tune-up did not give the Weaver shunt its gait back") + + // Another source (a Cascade window is one) shares the arbiter by its own + // key. The arbiter rolls the highest of them, so both stay registered + // and neither is summed into the other. + var/datum/component/cyberware_dodge/shared = patient.GetComponent(/datum/component/cyberware_dodge) + cyberware_register_dodge_source(patient, "voidcrew_test_window", CALLBACK(src, PROC_REF(fixed_chance))) + TEST_ASSERT_EQUAL(length(shared.dodge_sources), 2, "A second dodge source did not share the arbiter") + var/best = 0 + for(var/key in shared.dodge_sources) + var/datum/callback/chance_callback = shared.dodge_sources[key] + best = max(best, chance_callback.Invoke()) + TEST_ASSERT_EQUAL(best, 40, "The Weaver shunt raised a Cascade window's dodge") + cyberware_unregister_dodge_source(patient, "voidcrew_test_window") + + weaver.Remove(patient, special = TRUE) + TEST_ASSERT_NULL(patient.GetComponent(/datum/component/cyberware_dodge), "Pulling the last dodge ware left the arbiter behind") + TEST_ASSERT(!patient.has_movespeed_modifier(/datum/movespeed_modifier/cyberware_slipwire/weaver), "Pulling the Weaver shunt left its gait on the body") + +/// The Thumper ear: shorter reach, shorter fade, louder ping; the Heartbeat +/// Doppler it undercuts keeps its own. +/datum/unit_test/voidcrew_cyberware_models_b_doppler + +/datum/unit_test/voidcrew_cyberware_models_b_doppler/Run() + var/obj/item/organ/cyberimp/cyberware/doppler/street/thumper = allocate(/obj/item/organ/cyberimp/cyberware/doppler/street) + TEST_ASSERT_EQUAL(thumper.sonar_range, 5, "The Thumper ear reaches the wrong distance") + TEST_ASSERT_EQUAL(thumper.contact_fade, 3 SECONDS, "The Thumper ear fades contacts at the wrong rate") + TEST_ASSERT_EQUAL(thumper.ping_volume_bonus, 10, "The Thumper ear is not louder") + + // The range var is what the sweep reads: a contact across the test room is + // in reach, and not once the reach is cut below the distance. + var/mob/living/carbon/human/listener = allocate(/mob/living/carbon/human/consistent, run_loc_floor_bottom_left) + var/mob/living/carbon/human/contact = allocate(/mob/living/carbon/human/consistent, run_loc_floor_top_right) + var/distance = get_dist(listener, contact) + TEST_ASSERT(distance >= 2 && distance <= 5, "Test fixture: the room is [distance] tiles across, not between 2 and 5") + TEST_ASSERT(thumper.Insert(listener, special = TRUE), "Thumper staging insert was refused") + thumper.start_sonar() + TEST_ASSERT(thumper.watched[contact], "The Thumper ear did not hear a contact [distance] tiles away") + thumper.stop_sonar(listener) + thumper.sonar_range = distance - 1 + thumper.start_sonar() + TEST_ASSERT(!thumper.watched[contact], "The Thumper ear heard a contact beyond its reach") + thumper.stop_sonar(listener) + TEST_ASSERT(!length(thumper.watched) && !length(thumper.contacts), "Stopping the Thumper ear left contacts behind") + thumper.Remove(listener, special = TRUE) + + // The parent still reaches the full nine. + var/obj/item/organ/cyberimp/cyberware/doppler/doppler = allocate(/obj/item/organ/cyberimp/cyberware/doppler) + TEST_ASSERT(doppler.Insert(listener, special = TRUE), "Doppler staging insert was refused") + TEST_ASSERT(!thumper.owner, "The Thumper ear stayed in the ear slot beside the Doppler") + doppler.start_sonar() + TEST_ASSERT(doppler.watched[contact], "The Heartbeat Doppler lost a contact it used to hear") + doppler.stop_sonar(listener) + +/// What the shelf and the trade-in say: the cradle quotes a price, the +/// planned price and permission, and a trade-in that pays half the shelf price. +/datum/unit_test/voidcrew_cyberware_models_b_shop + +/datum/unit_test/voidcrew_cyberware_models_b_shop/Run() + build_cyberware_price_index() + // sku, item, credits, vouchers, permission reference + var/list/skus = list( + list(/datum/shop_sku/ripperdoc/hardweave, /obj/item/organ/cyberimp/cyberware/dermal_mesh/hardweave, 3000, 0, /datum/shop_sku/ripperdoc/dermal_mesh), + list(/datum/shop_sku/ripperdoc/atlas_street, /obj/item/organ/cyberimp/cyberware/atlas/street, 1500, 0, /datum/shop_sku/ripperdoc/dermal_mesh), + list(/datum/shop_sku/ripperdoc/second_wind_deep, /obj/item/organ/cyberimp/cyberware/second_wind/deep, 1800, 0, /datum/shop_sku/ripperdoc/shock_coils), + list(/datum/shop_sku/ripperdoc/coolant_street, /obj/item/organ/cyberimp/cyberware/coolant/street, 1500, 0, /datum/shop_sku/ripperdoc/shock_coils), + list(/datum/shop_sku/ripperdoc/frostline, /obj/item/organ/cyberimp/cyberware/frostline, 1500, 0, /datum/shop_sku/ripperdoc/shock_coils), + list(/datum/shop_sku/ripperdoc/slipwire_street, /obj/item/organ/cyberimp/cyberware/slipwire/street, 1800, 0, /datum/shop_sku/ripperdoc/dermal_mesh), + list(/datum/shop_sku/ripperdoc/slipwire_milspec, /obj/item/organ/cyberimp/cyberware/slipwire/milspec, 0, 3, /datum/shop_sku/ripperdoc/coolant), + list(/datum/shop_sku/ripperdoc/doppler_street, /obj/item/organ/cyberimp/cyberware/doppler/street, 1500, 0, /datum/shop_sku/ripperdoc/dermal_mesh), + ) + for(var/list/row as anything in skus) + var/datum/shop_sku/sku_type = row[1] + var/reference_type = row[5] + var/datum/shop_sku/reference = reference_type + TEST_ASSERT_EQUAL(initial(sku_type.item_path), row[2], "[sku_type] sells the wrong piece") + TEST_ASSERT_EQUAL(initial(sku_type.price_credits), row[3], "[sku_type] has the wrong credit price") + TEST_ASSERT_EQUAL(initial(sku_type.price_vouchers), row[4], "[sku_type] has the wrong voucher price") + TEST_ASSERT_EQUAL(initial(sku_type.zone_permission), initial(reference.zone_permission), "[sku_type] sits behind the wrong reputation") + var/list/quote = GLOB.cyberware_price_index[row[2]] + TEST_ASSERT_NOTNULL(quote, "The cradle has no price for [row[2]]") + if(quote) + TEST_ASSERT_EQUAL(quote["credits"], row[3], "The cradle quotes [row[2]] differently from its shelf") + TEST_ASSERT_EQUAL(quote["vouchers"], row[4], "The cradle quotes [row[2]] differently from its shelf") + + // The trade-in: one entry per credit-priced model, exact type, half list. + // Splice's entry and Ratchet's share the item and the pay. + var/list/ledgers = list( + list(/datum/shop_buyback/ripperdoc/hardweave, /datum/shop_sku/ripperdoc/hardweave), + list(/datum/shop_buyback/ripperdoc/atlas_street, /datum/shop_sku/ripperdoc/atlas_street), + list(/datum/shop_buyback/ripperdoc/second_wind_deep, /datum/shop_sku/ripperdoc/second_wind_deep), + list(/datum/shop_buyback/ripperdoc/coolant_street, /datum/shop_sku/ripperdoc/coolant_street), + list(/datum/shop_buyback/ripperdoc/frostline, /datum/shop_sku/ripperdoc/frostline), + list(/datum/shop_buyback/ripperdoc/slipwire_street, /datum/shop_sku/ripperdoc/slipwire_street), + list(/datum/shop_buyback/ripperdoc/doppler_street, /datum/shop_sku/ripperdoc/doppler_street), + ) + for(var/list/row as anything in ledgers) + var/ledger_type = row[1] + var/datum/shop_sku/sku_type = row[2] + var/datum/shop_buyback/ledger = allocate(ledger_type) + var/datum/shop_buyback/ratchet = allocate(text2path("[ledger_type]/street_doc")) + TEST_ASSERT_EQUAL(ledger.item_path, initial(sku_type.item_path), "[ledger_type] buys the wrong piece") + TEST_ASSERT(!ledger.match_subtypes, "[ledger_type] buys back its piece's subtypes") + TEST_ASSERT_EQUAL(ledger.pay_credits * 2, initial(sku_type.price_credits), "[ledger_type] does not pay half the shelf price") + TEST_ASSERT(!ledger.pay_vouchers, "[ledger_type] pays vouchers") + TEST_ASSERT_EQUAL(ratchet.item_path, ledger.item_path, "The street doc's [ledger_type] buys a different piece") + TEST_ASSERT_EQUAL(ratchet.pay_credits, ledger.pay_credits, "The street doc's [ledger_type] pays a different amount") + TEST_ASSERT(ratchet.desc != ledger.desc, "The street doc's [ledger_type] has no wording of his own") + + // The parents' own entries take only the parent, so a Hardweave or a + // Deep-lung never sells at the cheaper piece's rate. + var/datum/shop_buyback/mesh_ledger = allocate(/datum/shop_buyback/ripperdoc/dermal_mesh) + TEST_ASSERT(mesh_ledger.matches(allocate(/obj/item/organ/cyberimp/cyberware/dermal_mesh)), "The Dermal Mesh ledger won't take a Dermal Mesh") + TEST_ASSERT(!mesh_ledger.matches(allocate(/obj/item/organ/cyberimp/cyberware/dermal_mesh/hardweave)), "The Dermal Mesh ledger takes a Hardweave") + var/datum/shop_buyback/bladder_ledger = allocate(/datum/shop_buyback/ripperdoc/second_wind) + TEST_ASSERT(bladder_ledger.matches(allocate(/obj/item/organ/cyberimp/cyberware/second_wind)), "The Second Wind ledger won't take a Second Wind") + TEST_ASSERT(!bladder_ledger.matches(allocate(/obj/item/organ/cyberimp/cyberware/second_wind/deep)), "The Second Wind ledger takes a Deep-lung") + + // Vouchers cannot be refunded: the Weaver shunt has no entry anywhere. + for(var/buyback_type in typesof(/datum/shop_buyback/ripperdoc)) + var/datum/shop_buyback/ledger = buyback_type + var/path = initial(ledger.item_path) + if(!path) + continue + var/buys_weaver = initial(ledger.match_subtypes) ? ispath(/obj/item/organ/cyberimp/cyberware/slipwire/milspec, path) : (path == /obj/item/organ/cyberimp/cyberware/slipwire/milspec) + TEST_ASSERT(!buys_weaver, "[buyback_type] buys back the Weaver shunt") diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware_npcs.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware_npcs.dm new file mode 100644 index 00000000000..6a16bdef6ff --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware_npcs.dm @@ -0,0 +1,202 @@ +/** + * Cyberware against the human NPCs and the gore layer. + * + * Human NPCs (voidcrew/modules/human_npcs/) are real human bodies, so the chrome works on them as on + * a player, but an NPC's chrome burns out to scrap (/obj/item/burnt_chrome) when it dies or a piece + * leaves its body by any route. These tests pin that the burn-out beats the chrome salvage (gib, + * dust, a lost limb), that the scrap is no chrome (nothing reinstalls it, no ledger buys it), and + * that Chrome Read works on an NPC. The kit's chrome dummy is such a body. + * + * The gore layer (voidcrew/modules/hyperviolence/): the Atlas frame's dismember immunity stops head + * bursts; the street Strut frame holds the bones only, so it stops fractures (the skull and jaw + * crits included) but not a burst; Hardweave plating counts toward the crit armour gate; a Lazarus + * node never brings back a body whose head burst during its wind-up; and the blades cut as blades. + * + * Literals (unit tests are included before the fork's defines): CYBERWARE_SCAN_ITEMIZED is 2; the + * Lazarus wind-up is 1 second. + */ + +/// Shared helpers; not a test itself +/datum/unit_test/voidcrew_cyberware_npcs + abstract_type = /datum/unit_test/voidcrew_cyberware_npcs + +/// The floor `dx`, `dy` tiles from the test room's bottom-left corner +/datum/unit_test/voidcrew_cyberware_npcs/proc/spot(dx, dy) + return locate(run_loc_floor_bottom_left.x + dx, run_loc_floor_bottom_left.y + dy, run_loc_floor_bottom_left.z) + +/// The kit's chrome dummy carrying `ware_types`, cleaned up with the test +/datum/unit_test/voidcrew_cyberware_npcs/proc/dummy_with(list/ware_types, turf/where) + var/list/report = list() + var/mob/living/carbon/human/npc/chrome_dummy/dummy = chrome_kit_make_dummy(where || run_loc_floor_bottom_left, ware_types, report) + allocated += dummy + TEST_ASSERT(!length(report), "The dummy turned chrome away: [jointext(report, "; ")]") + return dummy + +/// Every piece of chrome lying loose (owned by nobody) in or near the test room, however deep it sits +/datum/unit_test/voidcrew_cyberware_npcs/proc/loose_chrome() + . = list() + for(var/turf/floor in range(6, run_loc_floor_bottom_left)) + for(var/obj/item/organ/ware in floor.get_all_contents()) + if(!ware.owner && ware.GetComponent(/datum/component/cyberware)) + . += ware + +/// The burnt-out scrap in or near the test room +/datum/unit_test/voidcrew_cyberware_npcs/proc/scrap_count() + . = 0 + for(var/turf/floor in range(6, run_loc_floor_bottom_left)) + for(var/obj/item/burnt_chrome/scrap in floor.get_all_contents()) + .++ + +/// An NPC's chrome burns out when it dies; Chrome Read works on it while it lives; the +/// scrap is not chrome and no ledger buys it. +/datum/unit_test/voidcrew_cyberware_npcs/burn_out + +/datum/unit_test/voidcrew_cyberware_npcs/burn_out/Run() + var/mob/living/carbon/human/npc/chrome_dummy/dummy = dummy_with(list( + /obj/item/organ/cyberimp/cyberware/slipwire, + /obj/item/organ/cyberimp/cyberware/dermal_mesh, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis, + ), spot(2, 2)) + TEST_ASSERT(istype(dummy, /mob/living/carbon/human/npc), "The kit's chrome dummy isn't a human NPC body") + TEST_ASSERT_NULL(dummy.ai_controller, "The kit's chrome dummy has an AI") + TEST_ASSERT_EQUAL(length(get_installed_cyberware(dummy)), 3, "The dummy didn't take its three pieces") + + // Death: every piece comes out as scrap, nothing intact is left anywhere. + dummy.death() + TEST_ASSERT(!length(get_installed_cyberware(dummy)), "A dead NPC kept chrome in its body") + sleep(0.5 SECONDS) + TEST_ASSERT(!length(loose_chrome()), "A dead NPC left working chrome behind") + TEST_ASSERT_EQUAL(scrap_count(), 3, "A dead NPC didn't leave one burnt-out scrap per piece") + + // The scrap is no chrome: nothing can install it, and no ledger anywhere buys it. + var/obj/item/burnt_chrome/scrap = locate() in range(6, run_loc_floor_bottom_left) + TEST_ASSERT_NOTNULL(scrap, "Fixture: no scrap to offer") + TEST_ASSERT(!istype(scrap, /obj/item/organ), "Burnt-out chrome is still an organ") + TEST_ASSERT_NULL(scrap.GetComponent(/datum/component/cyberware), "Burnt-out chrome still counts as chrome") + for(var/buyback_type in subtypesof(/datum/shop_buyback)) + var/datum/shop_buyback/ledger = new buyback_type + if(ledger.item_path && ledger.matches(scrap)) + TEST_FAIL("[buyback_type] buys burnt-out chrome") + qdel(ledger) + +/// Chrome the salvage throws loose (gib, dust) or a lost limb carries off burns out all the same. +/datum/unit_test/voidcrew_cyberware_npcs/salvage + +/datum/unit_test/voidcrew_cyberware_npcs/salvage/Run() + // A lost arm takes its chrome with it, and the chrome burns where the arm lies. + var/mob/living/carbon/human/npc/chrome_dummy/maimed = dummy_with(list(/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis), spot(1, 1)) + var/obj/item/bodypart/arm = maimed.get_bodypart(BODY_ZONE_R_ARM) + TEST_ASSERT(arm.dismember(), "Fixture: the dummy's arm wouldn't come off") + sleep(0.5 SECONDS) + TEST_ASSERT(!length(loose_chrome()), "Chrome in an NPC's lost arm stayed working") + TEST_ASSERT_EQUAL(scrap_count(), 1, "Chrome in an NPC's lost arm didn't burn out") + qdel(maimed) + + // Gibbed: the salvage throws the chrome loose, and it burns out where it lands. + var/mob/living/carbon/human/npc/chrome_dummy/gibbed = dummy_with(list( + /obj/item/organ/cyberimp/cyberware/slipwire, + /obj/item/organ/cyberimp/cyberware/atlas/street, + ), spot(2, 2)) + gibbed.gib() + sleep(0.5 SECONDS) + TEST_ASSERT(!length(loose_chrome()), "A gibbed NPC left working chrome behind") + TEST_ASSERT_EQUAL(scrap_count(), 3, "A gibbed NPC's chrome didn't burn out") + + // Dusted: the same. + var/mob/living/carbon/human/npc/chrome_dummy/dusted = dummy_with(list(/obj/item/organ/cyberimp/cyberware/dermal_mesh), spot(3, 3)) + dusted.dust() + sleep(0.5 SECONDS) + TEST_ASSERT(!length(loose_chrome()), "A dusted NPC left working chrome behind") + TEST_ASSERT_EQUAL(scrap_count(), 4, "A dusted NPC's chrome didn't burn out") + +/// The frames against the gore layer: Atlas stops bursts; the Strut frame stops fractures, the skull +/// and jaw crits included, but a head still bursts and a limb still comes off. +/datum/unit_test/voidcrew_cyberware_npcs/frames + +/datum/unit_test/voidcrew_cyberware_npcs/frames/Run() + var/datum/hv_crit/skull = locate(/datum/hv_crit/skull) in GLOB.hv_crits + var/datum/hv_crit/jaw = locate(/datum/hv_crit/jaw) in GLOB.hv_crits + TEST_ASSERT(skull && jaw, "The skull and jaw crits are gone") + + var/mob/living/carbon/human/plain = allocate(/mob/living/carbon/human/consistent, spot(0, 0)) + TEST_ASSERT(skull.can_apply_carbon(plain, plain.get_bodypart(BODY_ZONE_HEAD), WOUND_BLUNT), "Fixture: a plain head can't take the skull crit") + + // Strut: bones only. + var/mob/living/carbon/human/strut_bearer = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + var/obj/item/organ/cyberimp/cyberware/atlas/street/strut = allocate(/obj/item/organ/cyberimp/cyberware/atlas/street) + TEST_ASSERT(strut.Insert(strut_bearer, special = TRUE), "Strut frame staging insert was refused") + var/obj/item/bodypart/strut_head = strut_bearer.get_bodypart(BODY_ZONE_HEAD) + TEST_ASSERT(!skull.can_apply_carbon(strut_bearer, strut_head, WOUND_BLUNT), "The skull caved in under a Strut frame") + TEST_ASSERT(!jaw.can_apply_carbon(strut_bearer, strut_head, WOUND_BLUNT), "The jaw shattered under a Strut frame") + var/datum/wound_pregen_data/fracture = GLOB.all_wound_pregen_data[/datum/wound/blunt/bone/severe] + TEST_ASSERT(!fracture.can_be_applied_to(strut_bearer.get_bodypart(BODY_ZONE_L_ARM), list(WOUND_BLUNT)), "An arm fractured under a Strut frame") + TEST_ASSERT(strut_head.can_dismember(), "A Strut frame made the head impossible to take off") + var/obj/item/bodypart/strut_leg = strut_bearer.get_bodypart(BODY_ZONE_R_LEG) + TEST_ASSERT(strut_leg.dismember(), "A Strut frame kept a leg on") + strut_bearer.adjustOxyLoss(160) + TEST_ASSERT_EQUAL(strut_bearer.stat, HARD_CRIT, "Fixture: the Strut bearer isn't in hard crit") + TEST_ASSERT(strut_bearer.hv_burst_head(NORTH), "A Strut frame stopped a head burst") + TEST_ASSERT_NULL(strut_bearer.get_bodypart(BODY_ZONE_HEAD), "A burst head is still on") + + // Atlas: nothing comes off, nothing bursts. + var/mob/living/carbon/human/atlas_bearer = allocate(/mob/living/carbon/human/consistent, spot(2, 0)) + var/obj/item/organ/cyberimp/cyberware/atlas/atlas = allocate(/obj/item/organ/cyberimp/cyberware/atlas) + TEST_ASSERT(atlas.Insert(atlas_bearer, special = TRUE), "Atlas frame staging insert was refused") + TEST_ASSERT(!skull.can_apply_carbon(atlas_bearer, atlas_bearer.get_bodypart(BODY_ZONE_HEAD), WOUND_BLUNT), "The skull caved in under an Atlas frame") + atlas_bearer.adjustOxyLoss(160) + TEST_ASSERT_EQUAL(atlas_bearer.stat, HARD_CRIT, "Fixture: the Atlas bearer isn't in hard crit") + TEST_ASSERT(!atlas_bearer.hv_burst_head(NORTH), "A head burst under an Atlas frame") + TEST_ASSERT_NOTNULL(atlas_bearer.get_bodypart(BODY_ZONE_HEAD), "An Atlas bearer lost the head") + +/// Plating: Hardweave sits in the body's physiology armour, so the crit gate counts it. +/datum/unit_test/voidcrew_cyberware_npcs/plating + +/datum/unit_test/voidcrew_cyberware_npcs/plating/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent, spot(0, 0)) + var/obj/item/bodypart/chest = bearer.get_bodypart(BODY_ZONE_CHEST) + TEST_ASSERT_EQUAL(round(hv_crit_cover_rating(bearer, chest, MELEE)), 0, "Fixture: a bare body has crit cover") + var/obj/item/organ/cyberimp/cyberware/dermal_mesh/hardweave/plating = allocate(/obj/item/organ/cyberimp/cyberware/dermal_mesh/hardweave) + TEST_ASSERT(plating.Insert(bearer, special = TRUE), "Hardweave staging insert was refused") + TEST_ASSERT_EQUAL(round(hv_crit_cover_rating(bearer, chest, MELEE)), 20, "Hardweave plating doesn't count toward the crit gate") + +/// A Lazarus node winds up as its bearer goes down, but a head that bursts in that second stays burst. +/datum/unit_test/voidcrew_cyberware_npcs/lazarus + +/datum/unit_test/voidcrew_cyberware_npcs/lazarus/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent, spot(0, 0)) + var/obj/item/organ/cyberimp/cyberware/lazarus/node = allocate(/obj/item/organ/cyberimp/cyberware/lazarus) + TEST_ASSERT(node.Insert(bearer, special = TRUE), "Lazarus staging insert was refused") + bearer.adjustOxyLoss(160) + TEST_ASSERT_EQUAL(bearer.stat, HARD_CRIT, "Fixture: the Lazarus bearer isn't in hard crit") + TEST_ASSERT(node.jolting, "The Lazarus node didn't wind up as its bearer went down") + TEST_ASSERT(bearer.hv_burst_head(NORTH), "Fixture: the head didn't burst") + TEST_ASSERT_EQUAL(bearer.stat, DEAD, "A burst head didn't kill") + sleep(2 SECONDS) + TEST_ASSERT_EQUAL(bearer.stat, DEAD, "A Lazarus node brought back a body with a burst head") + TEST_ASSERT_NULL(bearer.get_bodypart(BODY_ZONE_HEAD), "A burst head came back") + +/// The blades cut as blades: brute, edged, so they bleed, spray and slash. An aimed Mantis cut at +/// the head can open the throat. +/datum/unit_test/voidcrew_cyberware_npcs/blades + +/datum/unit_test/voidcrew_cyberware_npcs/blades/Run() + var/static/list/blade_types = list( + /obj/item/melee/energy/blade/hardlight/cyberware_mantis, + /obj/item/melee/energy/blade/hardlight/cyberware_mantis/street, + /obj/item/melee/energy/blade/hardlight/cyberware_mantis/scorch, + /obj/item/melee/cyberware_monowire, + /obj/item/melee/cyberware_monowire/live, + ) + for(var/blade_type in blade_types) + var/obj/item/blade = allocate(blade_type) + TEST_ASSERT_EQUAL(blade.damtype, BRUTE, "[blade_type] doesn't cut for brute, so it never bleeds") + TEST_ASSERT_EQUAL(hv_crit_wounding_type(NONE, blade), WOUND_SLASH, "[blade_type] doesn't slash") + + var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human/consistent, spot(0, 0)) + var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + var/obj/item/mantis = allocate(/obj/item/melee/energy/blade/hardlight/cyberware_mantis) + TEST_ASSERT(user.put_in_active_hand(mantis), "Fixture: the user couldn't hold the blade") + user.zone_selected = BODY_ZONE_HEAD + var/obj/item/bodypart/head = victim.get_bodypart(BODY_ZONE_HEAD) + var/datum/hv_crit/landed = victim.hv_try_aimed_crit(head, BODY_ZONE_HEAD, WOUND_SLASH, mantis.force, mantis.wound_bonus, 0, EAST, mantis, user, 95) + TEST_ASSERT(istype(landed, /datum/hv_crit/throat), "An aimed Mantis cut at the head couldn't open the throat") diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware_passives.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware_passives.dm new file mode 100644 index 00000000000..c287e51b479 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware_passives.dm @@ -0,0 +1,317 @@ +/** + * # Street passives (voidcrew/modules/cyberware/ware_street_passives.dm) + * + * Clotter node, Adrenal pump, Medic's palms, Cuffer's wrists, Subvocal mic and + * Muffler ear: their slots, their effects while online, the failing-gated + * passive layer taking them away on an EMP and handing them back on a tune-up, + * the pump's wait surviving a refit, and the two speech hooks behind the mic. + * Unit-test files compile before voidcrew/_DEFINES/, so the Subvocal trait is + * written as its literal "cyber_subvocal" and the slots as theirs. + */ + +/// A plain pair of earpieces: a worn item in the ears slot whose radio branch +/// needs no working radio behind it. +/obj/item/clothing/ears/voidcrew_test_subvocal_ears + name = "test earpiece" + +/// Shape: every piece sits in the slot the plan gives it, has an item state of +/// its own, carries no button, and the slot sharing is what the plan says. +/datum/unit_test/voidcrew_cyberware_passives_shape + +/datum/unit_test/voidcrew_cyberware_passives_shape/Run() + var/list/passives = list( + /obj/item/organ/cyberimp/cyberware/clotter_node, + /obj/item/organ/cyberimp/cyberware/adrenal_pump, + /obj/item/organ/cyberimp/cyberware/medic_palms, + /obj/item/organ/cyberimp/cyberware/cuffer_wrists, + /obj/item/organ/cyberimp/cyberware/subvocal_mic, + /obj/item/organ/cyberimp/cyberware/muffler_ear, + ) + for(var/passive_path in passives) + var/obj/item/organ/cyberimp/cyberware/ware = allocate(passive_path) + TEST_ASSERT(ware.icon_state, "[passive_path] has no item state") + TEST_ASSERT(ware.chrome_load > 0, "[passive_path] costs no neural load") + TEST_ASSERT(!length(ware.actions), "[passive_path] grew an action button. These are passive") + + var/obj/item/organ/cyberimp/cyberware/clotter_node/clotter = allocate(/obj/item/organ/cyberimp/cyberware/clotter_node) + var/obj/item/organ/cyberimp/cyberware/adrenal_pump/pump = allocate(/obj/item/organ/cyberimp/cyberware/adrenal_pump) + var/obj/item/organ/cyberimp/cyberware/medic_palms/palms = allocate(/obj/item/organ/cyberimp/cyberware/medic_palms) + var/obj/item/organ/cyberimp/cyberware/cuffer_wrists/wrists = allocate(/obj/item/organ/cyberimp/cyberware/cuffer_wrists) + var/obj/item/organ/cyberimp/cyberware/subvocal_mic/mic = allocate(/obj/item/organ/cyberimp/cyberware/subvocal_mic) + var/obj/item/organ/cyberimp/cyberware/muffler_ear/muffler = allocate(/obj/item/organ/cyberimp/cyberware/muffler_ear) + var/obj/item/organ/cyberimp/cyberware/gecko/gecko = allocate(/obj/item/organ/cyberimp/cyberware/gecko) + var/obj/item/organ/cyberimp/cyberware/doppler/doppler = allocate(/obj/item/organ/cyberimp/cyberware/doppler) + + // ORGAN_SLOT_CYBERWARE_HEART_AUX, _HANDS, _LARYNX and _EARS. + TEST_ASSERT_EQUAL(clotter.slot, "cyberware_heart_aux", "Clotter node is not in the spare heart slot") + TEST_ASSERT_EQUAL(pump.slot, clotter.slot, "The pump and the node can both be fitted. They share the heart slot") + TEST_ASSERT_EQUAL(palms.slot, gecko.slot, "Medic's palms are not in the Gecko Grip's hands slot") + TEST_ASSERT_EQUAL(wrists.slot, gecko.slot, "Cuffer's wrists are not in the Gecko Grip's hands slot") + TEST_ASSERT_EQUAL(mic.slot, "cyberware_larynx", "Subvocal mic is not in the larynx slot") + TEST_ASSERT_EQUAL(muffler.slot, doppler.slot, "Muffler ear is not in the Doppler's ears slot") + + // Cheap street chrome, T1 apart from the pump. + TEST_ASSERT_EQUAL(pump.tier, 2, "The pump is not T2") + for(var/obj/item/organ/cyberimp/cyberware/cheap as anything in list(clotter, palms, wrists, mic, muffler)) + TEST_ASSERT_EQUAL(cheap.tier, 1, "[cheap] is not T1") + + // The cradle quotes a credit price for each, and only the pump needs yellow. + build_cyberware_price_index() + for(var/obj/item/organ/cyberimp/cyberware/priced as anything in list(clotter, pump, palms, wrists, mic, muffler)) + var/list/price = get_cyberware_price(priced) + TEST_ASSERT(price && price["credits"] > 0 && !price["vouchers"], "[priced] quotes no credit-only price at the cradle") + var/datum/shop_sku/ripperdoc/adrenal_pump/pump_sku = allocate(/datum/shop_sku/ripperdoc/adrenal_pump) + var/datum/shop_sku/ripperdoc/clotter_node/clotter_sku = allocate(/datum/shop_sku/ripperdoc/clotter_node) + TEST_ASSERT_EQUAL(pump_sku.zone_permission, 1, "The pump is not sold at yellow permission") // ZONE_PERMISSION_YELLOW + TEST_ASSERT_EQUAL(clotter_sku.zone_permission, 0, "The node is gated") // ZONE_PERMISSION_PUBLIC + +/// Clotter node: halves the blood lost, only while online, with one multiply and +/// one divide however often the passive layer flips, and the pump evicts it. +/datum/unit_test/voidcrew_cyberware_clotter_node + +/datum/unit_test/voidcrew_cyberware_clotter_node/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/clotter_node/clotter = allocate(/obj/item/organ/cyberimp/cyberware/clotter_node) + var/datum/component/cyberware/chrome = clotter.GetComponent(/datum/component/cyberware) + TEST_ASSERT_EQUAL(bearer.physiology.bleed_mod, 1, "Test fixture: the bearer already bleeds differently") + + TEST_ASSERT(clotter.Insert(bearer, special = TRUE), "Test fixture: Clotter node staging insert was refused") + TEST_ASSERT_EQUAL(bearer.physiology.bleed_mod, 0.5, "An installed Clotter node didn't halve the bleed") + + // Asked twice, applied once. + clotter.chrome_passives_on(bearer) + TEST_ASSERT_EQUAL(bearer.physiology.bleed_mod, 0.5, "The node's multiplier was applied twice") + + chrome.start_emp_reboot() + TEST_ASSERT_EQUAL(bearer.physiology.bleed_mod, 1, "An EMP'd Clotter node kept the bleed halved") + chrome.tune_up() + TEST_ASSERT_EQUAL(bearer.physiology.bleed_mod, 0.5, "A tuned-up Clotter node didn't hand the bleed cut back") + + // Retuning a fitted organ takes off what was put on, not what the var says now. + clotter.bleed_multiplier = 0.25 + clotter.Remove(bearer, special = TRUE) + clotter.forceMove(run_loc_floor_bottom_left) + TEST_ASSERT_EQUAL(bearer.physiology.bleed_mod, 1, "Pulling the node left the bleed changed") + + // The heart slot holds one: the pump evicts the node and its cut with it. + clotter.bleed_multiplier = 0.5 + TEST_ASSERT(clotter.Insert(bearer, special = TRUE), "Test fixture: Clotter node refit was refused") + TEST_ASSERT_EQUAL(bearer.physiology.bleed_mod, 0.5, "A refitted Clotter node didn't halve the bleed") + var/obj/item/organ/cyberimp/cyberware/adrenal_pump/pump = allocate(/obj/item/organ/cyberimp/cyberware/adrenal_pump) + TEST_ASSERT(pump.Insert(bearer, special = TRUE), "Test fixture: pump staging insert was refused") + TEST_ASSERT(!clotter.owner, "The pump went in beside the node. They share a slot") + TEST_ASSERT_EQUAL(bearer.physiology.bleed_mod, 1, "The evicted node left its bleed cut on the bearer") + +/// Medic's palms and Cuffer's wrists: their traits while online, gone on an EMP +/// and on removal, and the three hands-slot pieces evict one another. +/datum/unit_test/voidcrew_cyberware_hand_traits + +/datum/unit_test/voidcrew_cyberware_hand_traits/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/medic_palms/palms = allocate(/obj/item/organ/cyberimp/cyberware/medic_palms) + var/obj/item/organ/cyberimp/cyberware/cuffer_wrists/wrists = allocate(/obj/item/organ/cyberimp/cyberware/cuffer_wrists) + var/obj/item/organ/cyberimp/cyberware/gecko/gecko = allocate(/obj/item/organ/cyberimp/cyberware/gecko) + + TEST_ASSERT(palms.Insert(bearer, special = TRUE), "Test fixture: Medic's palms staging insert was refused") + TEST_ASSERT(HAS_TRAIT(bearer, TRAIT_FASTMED), "Medic's palms didn't give the quicker chemistry trait") + TEST_ASSERT(HAS_TRAIT(bearer, TRAIT_QUICKER_CARRY), "Medic's palms didn't give the quicker carry trait") + TEST_ASSERT(!HAS_TRAIT(bearer, TRAIT_FAST_CUFFING), "Medic's palms give quicker cuffing") + + var/datum/component/cyberware/chrome = palms.GetComponent(/datum/component/cyberware) + chrome.start_emp_reboot() + TEST_ASSERT(!HAS_TRAIT(bearer, TRAIT_FASTMED) && !HAS_TRAIT(bearer, TRAIT_QUICKER_CARRY), "EMP'd Medic's palms kept their traits") + chrome.tune_up() + TEST_ASSERT(HAS_TRAIT(bearer, TRAIT_FASTMED) && HAS_TRAIT(bearer, TRAIT_QUICKER_CARRY), "Tuned-up Medic's palms didn't hand their traits back") + + // Cuffer's wrists evict the palms: same slot. + TEST_ASSERT(wrists.Insert(bearer, special = TRUE), "Test fixture: Cuffer's wrists staging insert was refused") + TEST_ASSERT(!palms.owner, "The wrists went in beside the palms. They share a slot") + TEST_ASSERT(HAS_TRAIT(bearer, TRAIT_FAST_CUFFING), "Cuffer's wrists didn't give quicker cuffing") + TEST_ASSERT(!HAS_TRAIT(bearer, TRAIT_FASTMED) && !HAS_TRAIT(bearer, TRAIT_QUICKER_CARRY), "The evicted palms left their traits on the bearer") + + // And the Gecko Grip evicts the wrists. + TEST_ASSERT(gecko.Insert(bearer, special = TRUE), "Test fixture: Gecko Grip staging insert was refused") + TEST_ASSERT(!wrists.owner, "The Gecko Grip went in beside the wrists. They share a slot") + TEST_ASSERT(!HAS_TRAIT(bearer, TRAIT_FAST_CUFFING), "The evicted wrists left quicker cuffing on the bearer") + +/// Muffler ear: a bang loses a point of intensity while the ear is online, the +/// same point earmuffs take off, and nothing when it is offline or pulled. The +/// intensity rides in a list, so the signal is read directly: the real +/// soundbang_act() also depends on the room's air. +/datum/unit_test/voidcrew_cyberware_muffler_ear + +/datum/unit_test/voidcrew_cyberware_muffler_ear/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/muffler_ear/muffler = allocate(/obj/item/organ/cyberimp/cyberware/muffler_ear) + var/datum/component/cyberware/chrome = muffler.GetComponent(/datum/component/cyberware) + + var/list/reflist = list(1) + SEND_SIGNAL(bearer, COMSIG_CARBON_SOUNDBANG, reflist) + TEST_ASSERT_EQUAL(reflist[1], 1, "A bare body took a point off a bang") + + TEST_ASSERT(muffler.Insert(bearer, special = TRUE), "Test fixture: Muffler ear staging insert was refused") + reflist = list(1) + SEND_SIGNAL(bearer, COMSIG_CARBON_SOUNDBANG, reflist) + TEST_ASSERT_EQUAL(reflist[1], 0, "The Muffler ear didn't take a point off the bang") + + // A bigger bang loses the one point and no more. + reflist = list(2) + SEND_SIGNAL(bearer, COMSIG_CARBON_SOUNDBANG, reflist) + TEST_ASSERT_EQUAL(reflist[1], 1, "The Muffler ear took more than a point off a bigger bang") + + chrome.start_emp_reboot() + reflist = list(1) + SEND_SIGNAL(bearer, COMSIG_CARBON_SOUNDBANG, reflist) + TEST_ASSERT_EQUAL(reflist[1], 1, "An EMP'd Muffler ear still muffled the bang") + chrome.tune_up() + reflist = list(1) + SEND_SIGNAL(bearer, COMSIG_CARBON_SOUNDBANG, reflist) + TEST_ASSERT_EQUAL(reflist[1], 0, "A tuned-up Muffler ear didn't muffle the bang again") + + muffler.Remove(bearer, special = TRUE) + reflist = list(1) + SEND_SIGNAL(bearer, COMSIG_CARBON_SOUNDBANG, reflist) + TEST_ASSERT_EQUAL(reflist[1], 1, "A pulled Muffler ear still muffled the bang") + +/// Adrenal pump: quiet below its trigger, one answer to a bad run of stamina +/// damage, nothing inside the wait (a refit doesn't reset it), nothing while +/// offline, and everything back once the wait is over. +/datum/unit_test/voidcrew_cyberware_adrenal_pump + +/datum/unit_test/voidcrew_cyberware_adrenal_pump/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/adrenal_pump/pump = allocate(/obj/item/organ/cyberimp/cyberware/adrenal_pump) + TEST_ASSERT(pump.Insert(bearer, special = TRUE), "Test fixture: Adrenal pump staging insert was refused") + var/datum/component/cyberware/chrome = pump.GetComponent(/datum/component/cyberware) + + // Below the trigger: nothing. + bearer.adjustStaminaLoss(50) + sleep(0.5 SECONDS) + TEST_ASSERT_EQUAL(pump.ready_at, 0, "The pump fired below its trigger level") + TEST_ASSERT(!bearer.has_status_effect(/datum/status_effect/cyberware_adrenal_rush), "A rush started below the pump's trigger level") + + // Over it: part of the loss comes off, the bearer is quick and flushed, and + // the wait starts. + bearer.adjustStaminaLoss(30) + sleep(0.5 SECONDS) + TEST_ASSERT(bearer.getStaminaLoss() <= 45, "The pump didn't take stamina loss off ([bearer.getStaminaLoss()] left of 80)") + TEST_ASSERT(bearer.has_status_effect(/datum/status_effect/cyberware_adrenal_rush), "The pump fired without a rush") + TEST_ASSERT(bearer.has_movespeed_modifier(/datum/movespeed_modifier/cyberware_adrenal_rush), "The rush didn't speed the bearer up") + TEST_ASSERT(pump.ready_at > world.time, "The pump didn't start its wait") + + // Inside the wait: another bad run gets no answer. + bearer.adjustStaminaLoss(50) + sleep(0.5 SECONDS) + TEST_ASSERT(bearer.getStaminaLoss() >= 85, "The pump fired again inside its wait") + + // Pulled and refitted: still waiting. The clock lives on the organ. + var/waiting_until = pump.ready_at + pump.Remove(bearer, special = TRUE) + pump.forceMove(run_loc_floor_bottom_left) + TEST_ASSERT(pump.Insert(bearer, special = TRUE), "Test fixture: Adrenal pump refit was refused") + TEST_ASSERT_EQUAL(pump.ready_at, waiting_until, "Refitting the pump reset its wait") + bearer.adjustStaminaLoss(5) + sleep(0.5 SECONDS) + TEST_ASSERT(bearer.getStaminaLoss() >= 90, "A refitted pump fired inside its wait") + + // Offline: no answer, and the wait is not spent. + bearer.setStaminaLoss(0) + pump.ready_at = 0 + chrome.start_emp_reboot() + bearer.adjustStaminaLoss(80) + sleep(0.5 SECONDS) + TEST_ASSERT_EQUAL(pump.ready_at, 0, "An EMP'd pump fired") + TEST_ASSERT(bearer.getStaminaLoss() >= 75, "An EMP'd pump took stamina loss off") + + // Back online, the next bad run is answered. + chrome.tune_up() + bearer.adjustStaminaLoss(1) + sleep(0.5 SECONDS) + TEST_ASSERT(pump.ready_at > world.time, "A tuned-up pump didn't answer a bad run") + TEST_ASSERT(bearer.getStaminaLoss() <= 45, "A tuned-up pump didn't take stamina loss off") + +/// The Cascade and Redline crashes dump stamina as their own price. The pump +/// stands down for them: it is a bar against outside damage, not a way out of +/// the legend ware's bill. +/datum/unit_test/voidcrew_cyberware_adrenal_pump_crash + +/datum/unit_test/voidcrew_cyberware_adrenal_pump_crash/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/adrenal_pump/pump = allocate(/obj/item/organ/cyberimp/cyberware/adrenal_pump) + TEST_ASSERT(pump.Insert(bearer, special = TRUE), "Test fixture: Adrenal pump staging insert was refused") + + bearer.apply_status_effect(/datum/status_effect/cyberware_cascade_crash) + sleep(0.5 SECONDS) + TEST_ASSERT(bearer.has_status_effect(/datum/status_effect/cyberware_cascade_crash), "Test fixture: the Cascade crash isn't running") + TEST_ASSERT(bearer.getStaminaLoss() >= 70, "Test fixture: the Cascade crash dumped no stamina") + TEST_ASSERT_EQUAL(pump.ready_at, 0, "The pump answered the Cascade crash's own stamina dump") + TEST_ASSERT(!bearer.has_status_effect(/datum/status_effect/cyberware_adrenal_rush), "The pump started a rush in the middle of a Cascade crash") + bearer.remove_status_effect(/datum/status_effect/cyberware_cascade_crash) + + var/mob/living/carbon/human/redliner = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/adrenal_pump/second_pump = allocate(/obj/item/organ/cyberimp/cyberware/adrenal_pump) + TEST_ASSERT(second_pump.Insert(redliner, special = TRUE), "Test fixture: second pump staging insert was refused") + redliner.apply_status_effect(/datum/status_effect/cyberware_redline_crash) + sleep(0.5 SECONDS) + TEST_ASSERT(redliner.has_status_effect(/datum/status_effect/cyberware_redline_crash), "Test fixture: the Redline crash isn't running") + TEST_ASSERT_EQUAL(second_pump.ready_at, 0, "The pump answered the Redline crash's own stamina dump") + redliner.remove_status_effect(/datum/status_effect/cyberware_redline_crash) + +/// Subvocal mic: a radio line from a bearer is spoken at range 0, anything else +/// they say, and every line from a body without the mic, keeps its range. The +/// mark the radio branch leaves is spent by the one send_speech() that follows. +/datum/unit_test/voidcrew_cyberware_subvocal_mic + /// The range the speaker's own Hear() was handed, or null before any line. + var/heard_range + +/datum/unit_test/voidcrew_cyberware_subvocal_mic/proc/on_heard(datum/source, list/hear_args) + SIGNAL_HANDLER + heard_range = hear_args[HEARING_RANGE] + +/// One radio line the way say() sends it: the radio branch first, then the +/// whisper-range send. Returns the range the speaker's own Hear() was given. +/datum/unit_test/voidcrew_cyberware_subvocal_mic/proc/speak_on_radio(mob/living/carbon/human/speaker) + heard_range = null + var/radio_flags = speaker.radio("test", list(MODE_HEADSET = TRUE), list(), null) + TEST_ASSERT(radio_flags & REDUCE_RANGE, "Test fixture: the radio branch didn't shorten the range") + speaker.send_speech("test", 1, speaker, speaker.bubble_icon, list(), null, list(WHISPER_MODE = MODE_WHISPER)) + return heard_range + +/datum/unit_test/voidcrew_cyberware_subvocal_mic/Run() + var/mob/living/carbon/human/speaker = allocate(/mob/living/carbon/human/consistent, run_loc_floor_bottom_left) + var/obj/item/clothing/ears/voidcrew_test_subvocal_ears/earpiece = allocate(/obj/item/clothing/ears/voidcrew_test_subvocal_ears) + speaker.equip_to_slot_if_possible(earpiece, ITEM_SLOT_EARS, qdel_on_fail = FALSE, disable_warning = TRUE) + TEST_ASSERT_EQUAL(speaker.ears, earpiece, "Test fixture: the earpiece didn't equip") + RegisterSignal(speaker, COMSIG_MOVABLE_PRE_HEAR, PROC_REF(on_heard)) + + // No mic: radio talk is whispered at range 1, as ever. + TEST_ASSERT_EQUAL(speak_on_radio(speaker), 1, "A body without the mic changed its radio range") + TEST_ASSERT(!speaker.cyberware_subvocal_pending, "A body without the mic left a mark behind") + + var/obj/item/organ/cyberimp/cyberware/subvocal_mic/mic = allocate(/obj/item/organ/cyberimp/cyberware/subvocal_mic) + TEST_ASSERT(mic.Insert(speaker, special = TRUE), "Test fixture: Subvocal mic staging insert was refused") + TEST_ASSERT(HAS_TRAIT(speaker, "cyber_subvocal"), "The Subvocal mic didn't give its trait") // TRAIT_CYBER_SUBVOCAL + + // Mic: the radio line is spoken at range 0, and the mark is spent. + TEST_ASSERT_EQUAL(speak_on_radio(speaker), 0, "A radio line from a Subvocal mic bearer kept its range") + TEST_ASSERT(!speaker.cyberware_subvocal_pending, "The radio line's mark outlived its send") + + // An ordinary line right after is not quieted. + heard_range = null + speaker.send_speech("test", 6, speaker, speaker.bubble_icon, list(), null, list()) + TEST_ASSERT_EQUAL(heard_range, 6, "A spoken line after a radio line was quieted") + + // A mark nobody sent is cleared by the next radio branch rather than quieting a plain line. + speaker.cyberware_subvocal_pending = TRUE + speaker.radio("test", list(), list(), null) + TEST_ASSERT(!speaker.cyberware_subvocal_pending, "A stale mark survived a radio branch that sent nothing") + + // Offline: radio talk is overheard again. + var/datum/component/cyberware/chrome = mic.GetComponent(/datum/component/cyberware) + chrome.start_emp_reboot() + TEST_ASSERT_EQUAL(speak_on_radio(speaker), 1, "An EMP'd Subvocal mic still quieted the radio") + chrome.tune_up() + TEST_ASSERT_EQUAL(speak_on_radio(speaker), 0, "A tuned-up Subvocal mic didn't quiet the radio again") + + mic.Remove(speaker, special = TRUE) + TEST_ASSERT_EQUAL(speak_on_radio(speaker), 1, "A pulled Subvocal mic still quieted the radio") diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware_text.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware_text.dm new file mode 100644 index 00000000000..d6b60288c15 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware_text.dm @@ -0,0 +1,20 @@ +/** + * # Cyberware text + * + * Wares are described the way a person in the world would describe them: no figures and no talk + * of load, tiers, slots or EMPs. Ability buttons are the one place numbers belong, so they are not + * checked here. + */ +/datum/unit_test/voidcrew_cyberware_text + +/datum/unit_test/voidcrew_cyberware_text/Run() + var/list/roots = list( + /obj/item/organ/cyberimp/cyberware, + /obj/item/organ/eyes/robotic/cyberware, + /obj/item/organ/cyberimp/arm/toolkit/cyberware, + ) + for(var/root in roots) + for(var/obj/item/organ/ware_path as anything in typesof(root)) + var/ware_desc = initial(ware_path.desc) + TEST_ASSERT(!findtext(ware_desc, regex("\[0-9]")), "[ware_path]'s description has a figure in it: [ware_desc]") + TEST_ASSERT(!findtext(ware_desc, regex("\b(tier|load|slot|EMP)\b", "i")), "[ware_path]'s description talks about game rules: [ware_desc]") diff --git a/voidcrew/modules/unit_tests/voidcrew_loot.dm b/voidcrew/modules/unit_tests/voidcrew_loot.dm index 9037d9e5d19..242a65edb83 100644 --- a/voidcrew/modules/unit_tests/voidcrew_loot.dm +++ b/voidcrew/modules/unit_tests/voidcrew_loot.dm @@ -504,11 +504,12 @@ TEST_ASSERT_EQUAL(spawned, 1, "Contraband did not pay exactly one green melee weapon") for(var/marker_path in list(/obj/effect/zone_mobs/syndicate, /obj/effect/zone_mobs/syndicate/boss)) var/obj/effect/zone_mobs/marker = new marker_path() + // Human NPC operatives (voidcrew/modules/human_npcs/ruins/); their tables also hold SMGs and shotguns back to the red zone. TEST_ASSERT_EQUAL(length(marker.mobs_green), 1, "Green syndicate pool still includes sword guards") - TEST_ASSERT(marker.mobs_green[/mob/living/basic/trooper/syndicate/melee], "Green syndicate guards lost their knives") + TEST_ASSERT(marker.mobs_green[/mob/living/carbon/human/npc/ruin/trooper/syndicate], "Green syndicate guards lost their knives") for(var/entry in marker.mobs_yellow) - TEST_ASSERT(!ispath(entry, /mob/living/basic/trooper/syndicate/ranged/smg) && !ispath(entry, /mob/living/basic/trooper/syndicate/ranged/shotgun), "Yellow syndicate guard has an advanced ranged weapon") - TEST_ASSERT(marker.mobs_red[/mob/living/basic/trooper/syndicate/ranged/smg] || marker.mobs_red[/mob/living/basic/trooper/syndicate/ranged/smg/space/stormtrooper], "Red syndicate pool lost its SMG guards") + TEST_ASSERT(!ispath(entry, /mob/living/carbon/human/npc/ruin/trooper/syndicate/gunner/smg) && !ispath(entry, /mob/living/carbon/human/npc/ruin/trooper/syndicate/gunner/shotgun), "Yellow syndicate guard has an advanced ranged weapon") + TEST_ASSERT(marker.mobs_red[/mob/living/carbon/human/npc/ruin/trooper/syndicate/gunner/smg] || marker.mobs_red[/mob/living/carbon/human/npc/ruin/trooper/syndicate/stormtrooper], "Red syndicate pool lost its SMG guards") qdel(marker) /** @@ -740,6 +741,8 @@ /obj/item/claymore/cutlass/old, /obj/item/claymore/weak, /obj/item/crowbar/large/twenty_force, + /obj/item/cyberware_pair_case/gorilla_arms/street, + /obj/item/cyberware_pair_case/mantis_street, /obj/item/fireaxe/boardingaxe, /obj/item/fireaxe/boneaxe, /obj/item/gun/ballistic/automatic/ar, @@ -807,6 +810,7 @@ /obj/item/nullrod/vibro, /obj/item/nullrod/vibro/spellblade, /obj/item/nullrod/vibro/talking, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin/holdout, /obj/item/pen/edagger, /obj/item/shield/buckler, /obj/item/shield/buckler/parmula, @@ -828,6 +832,7 @@ /obj/item/cursed_katana, /obj/item/cyberware_pair_case/gorilla_arms, /obj/item/cyberware_pair_case/mantis_blades, + /obj/item/cyberware_pair_case/mantis_scorch, /obj/item/energy_katana, /obj/item/gun/ballistic/automatic/heater/scorcher, /obj/item/gun/ballistic/automatic/l6_saw/unrestricted, @@ -861,6 +866,7 @@ /obj/item/mjollnir, /obj/item/organ/cyberimp/arm/toolkit/cyberware/bunker_buster, /obj/item/organ/cyberimp/arm/toolkit/cyberware/monowire, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/monowire/live, /obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin, /obj/item/shield/energy, /obj/item/singularityhammer, @@ -893,3 +899,23 @@ TEST_ASSERT(entry != /obj/item/his_grace, "His Grace remains in ordinary cache loot") for(var/entry in all_weapons) TEST_ASSERT(entry in seen, "Retained weapon [entry] lost its guarded cache source") + +/// Everything the street doc sells can also turn up in a zone cache (owner: low-tier chrome rides the loot pools too). +/datum/unit_test/voidcrew_street_chrome_in_loot + +/datum/unit_test/voidcrew_street_chrome_in_loot/Run() + var/list/lootable = list() + for(var/theme_path in GLOB.loot_themes) + var/datum/loot_theme/theme = GLOB.loot_themes[theme_path] + for(var/table_name in list("loot_common", "loot_uncommon", "loot_prime", "loot_uniques")) + for(var/entry in theme.vars[table_name]) + lootable[entry] = TRUE + for(var/extras_name in list("gun_extras", "melee_extras")) + var/list/extras = theme.vars[extras_name] + for(var/weapon_class in extras) + for(var/entry in extras[weapon_class]) + lootable[entry] = TRUE + var/datum/outpost_shop/vendor/street_doc/shop = allocate(/datum/outpost_shop/vendor/street_doc) + TEST_ASSERT(length(shop.skus), "The street doc has nothing on his shelf") + for(var/datum/shop_sku/sku as anything in shop.skus) + TEST_ASSERT(lootable[sku.item_path], "[sku.item_path], sold by the street doc, is in no loot theme") diff --git a/wiki/content/cyberware.md b/wiki/content/cyberware.md index dbed7a15dee..b626d765f56 100644 --- a/wiki/content/cyberware.md +++ b/wiki/content/cyberware.md @@ -2,32 +2,36 @@ title: Cyberware category: Economy order: 6 -blurb: Chrome implants from the Chop Shop at the Undertow Exchange, neural capacity, the four tiers, the full catalog, and what an EMP does to a chromed body. +blurb: Chrome implants from the Chop Shop at the Undertow Exchange and the Back Bay at Quartermain Depot, neural capacity, the four tiers, the full catalog, and what an EMP does to a chromed body. --- -Cyberware (**chrome**) is a roster of implantable robotic organs sold at the **Chop Shop**, the neon-lit parlor off the Dregs cantina at the [Undertow Exchange](trader-outposts.md). Every piece does something no printed equipment does, from seeing in the dark to a deployable pair of hardlight blades, and every piece costs **neural load** against a fixed capacity, so a build is a budget rather than a shopping spree. Street chrome sells for credits; the good stuff wants [vouchers](money-and-trade.md). +Cyberware (**chrome**) is a roster of implantable robotic organs sold at the **Chop Shop**, the neon-lit parlor off the Dregs cantina at the [Undertow Exchange](trader-outposts.md), and, street chrome only, at the **Back Bay** in [Quartermain Depot](trader-outposts.md). Every piece does something no printed equipment does, from seeing in the dark to a deployable pair of hardlight blades, and every piece costs **neural load** against a fixed capacity, so a build is a budget rather than a shopping spree. Street chrome sells for credits; the good stuff wants [vouchers](money-and-trade.md). ## The Chop Shop Splice runs the parlor from behind counter glass. Click them for the shop, sorted into Street, Pro, Military and Legend tabs plus an ammunition shelf. Bought chrome lands in your hands as an organ, which does nothing until it is installed. -Installation is the **Chrome Cradle**, the salvaged operating slab in the middle of the parlor, the only one in the galaxy. Drag yourself onto it and its console opens, showing your neural load, every piece of chrome within reach (installed, carried, or in the parts tray), and a projection of what any swap would cost and evict. Hit Install and the rig sedates you and does the work in seconds. Only you can ever order work on your own body, and only while conscious and unrestrained. Nobody can be strapped to the slab and carved for their chrome. Evicted and removed pieces wait in the parts tray, which anyone adjacent can eject. +Installation is the **Chrome Cradle**, the salvaged operating slab in the middle of the parlor. Drag yourself onto it and its console opens, showing your neural load, every piece of chrome within reach (installed, carried, or in the parts tray), and a projection of what any swap would cost and evict. Hit Install and the rig sedates you and does the work in seconds. Only you can ever order work on your own body, and only while conscious and unrestrained. Nobody can be strapped to the slab and carved for their chrome. Evicted and removed pieces wait in the parts tray, which anyone adjacent can eject. The Cradle also removes chrome in three seconds flat, and runs a **tune-up** for 200 credits that clears EMP scramble and repairs all your installed ware. If you carry the Chromatic Dermis ink suite, the Cradle's ink panel re-keys its color and pattern for free. -Outside the parlor, ordinary organ-manipulation surgery at any operating table installs and removes chrome too, leg surgery exists for exactly this reason. Autosurgeons refuse the work entirely. +Outside the parlors, ordinary organ-manipulation surgery at any operating table installs and removes chrome too, leg surgery exists for exactly this reason. Autosurgeons refuse the work entirely. + +## The Back Bay + +Ratchet, a loader mechanic who started putting chrome in people, works out of a storage bay off Quartermain's upper landing. He sells street chrome only, for credits, at Splice's prices, and the bay has a Chrome Cradle of its own that works the same way. He buys pulled chrome back on the same terms as Splice, even the pieces only Splice sells. His shelf carries the newer street pieces too: the cheap optics and the quiet passives below. ## Neural load Your body has **20 capacity** shared by chrome, ordinary implants, cybernetic organs, surgical enhancements and installed nanite programs. Ordinary implants, robotic organs and surgical enhancements cost **1 each**. Mindshield implants cost **0**. Prosthetic limbs cost **0**, but implants inside them still count. Chrome uses the catalogue loads below. Nanite costs depend on the program and count even when switched off. See [Nanites & Revival](nanites-and-revival.md). Every installed upgrade sums its load against capacity, and the Cradle refuses any install that would take you over, though swapping within a ladder only costs the difference, since the piece being replaced comes out first. If you somehow end up over capacity anyway, everything browns out: **every** piece of chrome goes offline and beneficial nanite programs pause until the load drops back under, Remove enough installed load to restore capacity. -Same-slot ware is mutually exclusive, one operating system, one dermal layer, one leg rig, one piece of hardware per arm, which makes most slots either a ladder (Shock Coils into Hopper Pistons, Dermal Mesh into Slabskin) or a straight choice (Cascade Lattice *or* Redline Core). Arm chrome always claims the whole arm: installing Mantis Blades evicts whatever that arm already carried. Chrome optics replace your natural eyes outright. The Governor Delete raises capacity by **15**, to **35**. It occupies the chest operating-system slot, so it competes with the Cascade lattice and Redline core. +Same-slot ware is mutually exclusive, one operating system, one dermal layer, one leg rig, one piece of hardware per arm, which makes most slots either a ladder (Shock Coils into Hopper Pistons, Dermal Mesh into Slabskin) or a straight choice (Cascade Lattice *or* Redline Core). Arm chrome always claims the whole arm: installing Mantis Blades evicts whatever that arm already carried. Chrome optics replace your natural eyes outright. The Governor Delete raises capacity by **15**, to **35**, and the cheaper Governor Patch and Governor Bypass raise it by **5** and **10**. All three occupy the chest operating-system slot, so they compete with the Cascade lattice and Redline core. Much of it shows. Plated arms, leg rigs, dermal weaves and spine lattices draw on your body under your clothes, and stacking enough chrome genuinely stops you looking human. ## The catalog -Prices are Splice's, stock is limited per round, and load is the neural cost. Nightshade optics, Fixer's Fingers, Dermal Mesh, Hopper pistons, Icepick Jack, Heartbeat Doppler, Deadeye link, Slipwire and Prospector Suite need 4 [reputation](zone-reputation.md). Coolant Loop, Dead Channel, Atlas frame, Gorilla Arms and Rigger socket need 11. The rest of the military and legend stock needs 22. Barnaby at Waystation Halcyon also sells Shock Coils and Second Wind at these prices. "Pair" ware is sold as a cased set and installed one organ per arm. +Prices are the same at both counters, stock is limited per round, and load is the neural cost. Nightshade optics, Fixer's Fingers, Dermal Mesh, Hopper pistons, Icepick Jack, Heartbeat Doppler, Deadeye link, Slipwire, Prospector Suite and every street model need 4 [reputation](zone-reputation.md). Coolant Loop, Dead Channel, Atlas frame, Gorilla Arms, Rigger socket, the service reflex lattice, the Vanguard core and the Governor Bypass need 11. The rest of the military and legend stock needs 22. Barnaby at Waystation Halcyon also sells Shock Coils and Second Wind at these prices. "Pair" ware is sold as a cased set and installed one organ per arm. ### Tier 1: Street chrome (credits) @@ -75,7 +79,7 @@ Prices are Splice's, stock is limited per round, and load is the neural cost. Ni | Slabskin plate | 3 | 6 | Heavy built-in armor in every damage type. Solid hits visibly spark off you. Everyone can see you are plated | | Mantis Blades (pair) | 4 | 3/arm | Deployable hardlight blades, plus a five-tile lunge that knocks the target down | | Bunker Buster housing | *loot only* | 5 | Two shaped micro-rockets: 60 damage, no splash, will never breach a hull. Reloads are sold at the parlor or printed with Experimental Ammunition | -| Ghostskin weave | 4 | 5 | Ten seconds of optical camo. NPCs will not target you, and Chrome Reads scatter. Attacking, taking a hit or an EMP drops it | +| Ghostskin weave | 4 | 5 | Ten seconds of optical camo. NPCs will not target you, and Chrome Reads scatter. Attacking, throwing, taking a hit or a shock, or an EMP drops it | | Lazarus node | 4 | 5 | The moment you drop into crit, it charges for a second and shocks you back to your feet at 30% health. Once per six minutes | ### Tier 4: Legend chrome (vouchers, one of each per round) @@ -84,10 +88,41 @@ Prices are Splice's, stock is limited per round, and load is the neural cost. Ni |---|---|---|---| | Governor Delete | 5 | 0 | +15 capacity. Occupies the chest OS slot, competing with Cascade and Redline | | Redline core | 6 | 10 | Twelve seconds of stun immunity, 40% less brute and burn taken, +8 unarmed damage and a roar that staggers everyone nearby, then the crash | -| Cascade lattice | 8 | 12 | The sandevistan: eight seconds at double time with halved melee cooldowns and 40% projectile dodge while moving, then the crash. An EMP mid-window ends it early and eats the cooldown | +| Cascade lattice | 8 | 12 | Eight seconds at double time with halved melee cooldowns and 60% dodge against blows, or against projectiles while moving, and harder-hitting strikes, then the crash. An EMP mid-window ends it early and eats the cooldown | | Meteor Piledriver frame | *never sold* | 8 | An eight-tile leap that crushes whoever is standing on the landing tile and hurls everyone around them. A rare guarded-mission completion prize; see [Missions](missions.md) | -The **ammunition shelf** is the return-visit hook: Ronin magazines at 250 credits and Buster rocket pairs at 300, both at 4 [reputation](zone-reputation.md). Splice also buys back *removed* street chrome at about half list price; military chrome is never bought back. +### Cheaper models + +Six of the big pieces come in cheaper models from other makers. Each takes the same slot as the original, so you can start on the cheap one, sell it back and move up. Street models sell for credits at both counters. The service models and the fire and shock variants are vouchers, from Splice only. + +| Piece | Price | Load | What it does | +|---|---|---|---| +| Flickerskin weave | 2,400 cr | 2 | Seven seconds of patchy camo. It fools people, but NPCs still see you and Chrome Reads still land | +| Shiv Blades (pair) | 2,400 cr | 2/arm | Deployable hardlight blades, duller than the Mantis, with no lunge | +| Governor Patch | 2,500 cr | 0 | +5 capacity. Occupies the chest OS slot | +| Hothead core | 3,000 cr | 4 | Eight seconds of 20% less brute and burn and +3 unarmed damage, then the crash. No stun immunity and no roar | +| Spliced reflex rig | 3,600 cr | 6 | Six seconds of quicker movement, melee cooldowns cut by a quarter and 30% dodge against blows, or against projectiles while moving, and harder-hitting strikes, then a long crash | +| Governor Bypass | 3 vouchers | 0 | +10 capacity. Occupies the chest OS slot | +| Service reflex lattice | 4 vouchers | 9 | Seven seconds of quicker movement, melee cooldowns cut by 40% and 45% dodge against blows, or against projectiles while moving, and harder-hitting strikes, then the crash | +| Vanguard core | 4 vouchers | 8 | Ten seconds of stun immunity, 30% less brute and burn and +5 unarmed damage, opened by a roar that staggers people nearby, then the crash | +| Scorch Blades (pair) | 4 vouchers | 4/arm | Mantis Blades that set whoever they cut on fire. The lunge lights them harder | +| Widowline Arc | 5 vouchers | 6 | A Widowline that shocks on every hit, cuts robots and mechs much harder, and briefly knocks out turrets, consoles and cameras it strikes | + +The **ammunition shelf** is the return-visit hook: Ronin magazines at 250 credits and Buster rocket pairs at 300, both at 4 [reputation](zone-reputation.md). Both ripperdocs buy back any *removed* chrome that sells for credits, even pieces they sold you, at half list price. Chrome paid for in vouchers is never bought back. + +### More street pieces + +The newer makers fill in the gaps under the big names. Each takes the same slot as the piece it copies, so it sells back and climbs like the others. + +- **Spring calves** and **Vaulter pistons**: a short hop on cheap springs, and the service pistons that clear a room. +- **Brawler myomers**: a cased pair of forearms that hit hard and break rock, but no door gives way to them. +- **Tinker's fingers** and the **Deepcore drill fist**: a looser set of fingertip tools, and a heavier drill on the same ore hopper. +- **Holdout housing**: a snub revolver folded into the forearm, loaded one round at a time. +- **Hardweave plating** and the **Strut frame**: a heavier dermal weave, and a frame that keeps your bones whole. +- **Deep-lung bladder**, **Heat-sink lining** and **Frostline lining**: a longer breath, a lining for the heat, a lining for the cold. +- **Twitchwire** and the **Weaver shunt**: a twitchy reflex shunt, and the service model. +- **Thumper ear**: a louder, shorter-ranged sonar behind the ear. +- Quiet pieces with no button: the **Clotter node** slows bleeding, the **Adrenal pump** kicks in when you're about to drop, **Medic's palms** and **Cuffer's wrists** do the glove's job without the glove, the **Subvocal mic** keeps your radio talk from the people next to you, and the **Muffler ear** shuts out a bang. ## Finding chrome in the wild diff --git a/wiki/content/glossary.md b/wiki/content/glossary.md index 67fdcfeaf13..f6a28516a56 100644 --- a/wiki/content/glossary.md +++ b/wiki/content/glossary.md @@ -59,7 +59,7 @@ Voidcrew adds a vocabulary that /tg/station does not have, and most of it turns | **[Ship parts](ship-parts.md)** | Physical items in four classes (combat, science, trade and misc). Bank them through an extraction case to keep them between rounds and buy permanent shipyard unlocks. | | **Extraction case** | The secure case parts must be sitting in, on your person, for them to survive the round. Request one with the **Request Extraction Case** verb. Only the first standard case counts. | | **Voucher** | A trade voucher: a physical chit earned from dangerous work, never bought with credits, and spent at any trader for restricted goods. Being an item, it can be stolen off you. | -| **Chrome** | Cyberware, implantable robotic organs sold at the Chop Shop on the Undertow Exchange. See [Cyberware](cyberware.md). | +| **Chrome** | Cyberware, implantable robotic organs sold at the Chop Shop on the Undertow Exchange and the Back Bay at Quartermain Depot. See [Cyberware](cyberware.md). | | **Neural load** | The shared cost of chrome, implants, robotic organs, surgical enhancements and installed nanite programs against 20 capacity. Overload disables chrome and beneficial nanite programs. | | **Trader outpost** | One of three permanent markets, one per zone: general store in green, outfitter in yellow, black market in red. Turrets shoot people who keep starting fights. See [Trader Outposts](trader-outposts.md). | | **Player outpost** | A base a crew plants for itself using an outpost deed. See [Player Outposts](player-outposts.md). | diff --git a/wiki/content/trader-outposts.md b/wiki/content/trader-outposts.md index e14561a5173..97e0ecd799d 100644 --- a/wiki/content/trader-outposts.md +++ b/wiki/content/trader-outposts.md @@ -73,6 +73,7 @@ Each outpost's concourse has its own side vendors, each with their own shopkeep | Halcyon | The Chowder Pot | Roux | The diner. Hot meals in tiers, galley staples, buys home cooking | | Quartermain | The Skunkworks | Boffin | Research and fabrication gear, Strong-Arm implants, robotics and xenobiology starter packs, raw anomaly cores and anomaly charts | | Quartermain | The Fitting Bay | Wick | Civilian through advanced MODsuits | +| Quartermain | The Back Bay | Ratchet | Street chrome for credits, installed in the bay's own Chrome Cradle | | The Undertow | The Dregs | Dram | The cantina | | The Undertow | Patch-Up Clinic | Sawbones | Medical supplies, the genetics starter pack | | The Undertow | The Chop Shop | Splice | Cyberware implants in four tiers, installed in the parlor's own Chrome Cradle | @@ -81,7 +82,9 @@ Each outpost's concourse has its own side vendors, each with their own shopkeep **The Fitting Bay** at Quartermain has a **MOD fitting bench**, a powered frame you back into while still wearing your suit. It swaps modules for free with no screwdriver work, sells permanent upgrades (plating, module capacity, actuator tuning, power regulation, cell swaps) and per-visit servicing, gives away paint and engraving, and trickle-charges your cell while the frame is shut. Reinforced plating needs 4 [reputation](zone-reputation.md) and composite plating needs 11. It will not convert a suit from one theme to another. For the tier Wick won't touch, syndicate and elite chassis, Interdyne and infiltrator control units, the antag modules. Go to **Vex**: 3600 credits plus 2 vouchers for a syndicate chassis, 5400 plus 3 for an elite, 5 vouchers for a fully equipped syndicate suit. -**The Chop Shop** at the Undertow is the galaxy's only cyberware parlor, a neon annex off the Dregs. Splice sells chrome implants off four shelves, street chrome for credits, pro chrome for credits or vouchers, military and legend chrome for vouchers only, and the **Chrome Cradle** in the middle of the room does the installing: you lie on the slab, pick a piece off the rack, and the rig does the surgery in seconds. Removals, repairs and ink re-keying run on the same console, an ammunition shelf keeps implanted weapons fed, and Splice buys back pulled street chrome at about half price. The full catalog is on [Cyberware](cyberware.md). +**The Chop Shop** at the Undertow is the full cyberware parlor, a neon annex off the Dregs. Splice sells chrome implants off four shelves, street chrome for credits, pro chrome for credits or vouchers, military and legend chrome for vouchers only, and the **Chrome Cradle** in the middle of the room does the installing: you lie on the slab, pick a piece off the rack, and the rig does the surgery in seconds. Removals, repairs and ink re-keying run on the same console, an ammunition shelf keeps implanted weapons fed, and Splice buys back pulled street chrome at about half price. The full catalog is on [Cyberware](cyberware.md). + +**The Back Bay** at Quartermain is the cheap end of the trade: Ratchet works out of a storage bay off the upper landing, with a Chrome Cradle of his own. He sells street chrome only, for credits, at Splice's prices, and buys pulled street chrome back on the same terms. Vex's own shelves carry the other half of the deep-band trade: **exploit software** for ship hacking, from 500-credit lightshow cartridges to the voucher-only exotics, plus the electronic-warfare suite board itself. See [Ship Hacking](ship-hacking.md). From 7ac7d8668f105fa2d336d448040799436581bf08 Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Sun, 15 Nov 2026 16:03:57 -0800 Subject: [PATCH 02/29] Chrome Read plays out over its subject on the reader's screen A chrome read draws on the reader's screen instead of printing to chat: corner brackets lock on over a pulsing outline, then a panel with the subject's name, a socket per piece of hardware framed by grade, a short name list and a load bar. Street optics show static and no names, and a Ghostskin subject breaks the lock. Bystanders see the reader's eyes flicker and the subject sees their own body flinch red. Brings back the readout test and the NPC read that the cyberware lines left out. --- tgstation.dme | 1 + voidcrew/modules/cyberware/cyberware_scan.dm | 159 +++- .../cyberware/cyberware_scan_overlay.dm | 890 ++++++++++++++++++ .../modules/cyberware/icons/chrome_read.dmi | Bin 0 -> 764 bytes .../cyberware/icons/chrome_read_bar.dmi | Bin 0 -> 419 bytes .../modules/unit_tests/voidcrew_cyberware.dm | 125 +++ .../unit_tests/voidcrew_cyberware_npcs.dm | 11 + 7 files changed, 1155 insertions(+), 31 deletions(-) create mode 100644 voidcrew/modules/cyberware/cyberware_scan_overlay.dm create mode 100644 voidcrew/modules/cyberware/icons/chrome_read.dmi create mode 100644 voidcrew/modules/cyberware/icons/chrome_read_bar.dmi diff --git a/tgstation.dme b/tgstation.dme index 40f23116804..2c92d2beb2c 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -7183,6 +7183,7 @@ #include "voidcrew\modules\cyberware\cyberware_feedback.dm" #include "voidcrew\modules\cyberware\cyberware_salvage.dm" #include "voidcrew\modules\cyberware\cyberware_scan.dm" +#include "voidcrew\modules\cyberware\cyberware_scan_overlay.dm" #include "voidcrew\modules\cyberware\cyberware_stealth.dm" #include "voidcrew\modules\cyberware\parlor_fixtures.dm" #include "voidcrew\modules\cyberware\ripperdoc_catalog.dm" diff --git a/voidcrew/modules/cyberware/cyberware_scan.dm b/voidcrew/modules/cyberware/cyberware_scan.dm index 8a7b1c3315e..c5fefbcf8ac 100644 --- a/voidcrew/modules/cyberware/cyberware_scan.dm +++ b/voidcrew/modules/cyberware/cyberware_scan.dm @@ -22,6 +22,11 @@ * - Resolution belongs to the optics, not to the reader: the street-tier * Nightshade counts signatures, everything above it names them. * + * The reader sees the result drawn over the subject, for their eyes only + * (cyberware_scan_overlay.dm). Nothing goes to their chat. Bystanders see the + * reader's eyes flicker; the subject sees their own body flinch red and gets + * the chat line naming the reader. + * * The action rides the shared /datum/action/cooldown/cyberware bridge, so a * browned-out or EMP-scrambled set of eyes reads nothing at all. */ @@ -33,6 +38,14 @@ /// robotic that isn't parlor chrome. #define CYBERWARE_SCAN_UNRATED_COLOR "#8fa1a8" +// Reach and pacing belong to the optics, so a scout model can read further or +// faster. The defaults are the read's stock numbers. +/obj/item/organ/eyes/robotic/cyberware + /// How far this set of eyes can read a body, in tiles, with line of sight. + var/chrome_read_range = CYBERWARE_SCAN_RANGE + /// Cooldown on this set of eyes' chrome read. + var/chrome_read_cooldown = CYBERWARE_SCAN_COOLDOWN + // ---- Readout ----------------------------------------------------------- /** @@ -64,41 +77,90 @@ return "[text]" /** - * Builds the report for a body at the given resolution and hands back the - * styled lines. Split out from the action so the Cradle, an admin tool or a - * unit test can ask the same question without a pair of eyes involved. + * The short name a readout shows for one piece of hardware: no \improper, + * and no "(left)" or "(right)" on paired arm chrome. */ -/proc/cyberware_scan_readout(mob/living/carbon/target, resolution = CYBERWARE_SCAN_ITEMIZED) +/proc/cyberware_scan_label(obj/item/organ/ware) + var/static/regex/side_suffix = regex(@"\s*\((left|right)\)$", "i") + return side_suffix.Replace(format_text(ware.name), "") + +/** + * What a read resolves on a body, as data. The overlay + * (cyberware_scan_overlay.dm) draws it and cyberware_scan_readout() prints it, + * so both agree on what the bus can and can't see. + * + * Returns an associative list: `name` (the visible name), `count`, `load`, + * `capacity`, `resolution` and `entries`, one list per signature in organ + * order. At itemized resolution an entry carries `label`, `name`, `icon`, + * `icon_state`, `color`, `tier` (0 when unrated), `rated` and `offline`. At + * silhouette resolution entries are empty: the bus counts them and nothing + * else. + */ +/proc/cyberware_scan_report(mob/living/carbon/target, resolution = CYBERWARE_SCAN_ITEMIZED) RETURN_TYPE(/list) - . = list() if(!iscarbon(target)) - return - var/accent = CYBERWARE_COLOR_TIER_2 + return null // Masks and helmets beat the bus: a body reads as whatever it looks like. var/subject = target.name if(ishuman(target)) var/mob/living/carbon/human/human_target = target subject = human_target.get_visible_name() - . += cyberware_scan_line("CHROME READ: [uppertext(subject)]", accent) var/list/found = cyberware_scannable_hardware(target) - if(!length(found)) + var/list/entries = list() + for(var/obj/item/organ/ware as anything in found) + if(resolution < CYBERWARE_SCAN_ITEMIZED) + entries += list(list()) + continue + var/datum/component/cyberware/chrome = ware.GetComponent(/datum/component/cyberware) + entries += list(list( + "label" = cyberware_scan_label(ware), + "name" = ware.name, + "icon" = ware.icon, + "icon_state" = ware.icon_state, + // Anything that isn't parlor chrome has no tier to report. + "color" = chrome ? cyberware_tier_color(chrome.tier) : CYBERWARE_SCAN_UNRATED_COLOR, + "tier" = chrome ? chrome.tier : 0, + "rated" = !!chrome, + "offline" = !!(ware.organ_flags & ORGAN_FAILING), + )) + return list( + "name" = subject, + "count" = length(found), + "load" = get_chrome_load(target), + "capacity" = get_chrome_capacity(target), + "resolution" = resolution, + "entries" = entries, + ) + +/** + * Builds the report for a body at the given resolution and hands back the + * styled lines. Split out from the action so the Cradle, an admin tool or a + * unit test can ask the same question without a pair of eyes involved. + */ +/proc/cyberware_scan_readout(mob/living/carbon/target, resolution = CYBERWARE_SCAN_ITEMIZED) + RETURN_TYPE(/list) + . = list() + var/list/report = cyberware_scan_report(target, resolution) + if(!report) + return + var/accent = CYBERWARE_COLOR_TIER_2 + . += cyberware_scan_line("CHROME READ: [uppertext(report["name"])]", accent) + + if(!report["count"]) . += cyberware_scan_line("NO HARDWARE SIGNATURE", accent) return - var/load = get_chrome_load(target) - var/capacity = get_chrome_capacity(target) - . += cyberware_scan_line("SIGNATURES [length(found)] · NEURAL LOAD [load]/[capacity]", accent) + var/load = report["load"] + var/capacity = report["capacity"] + . += cyberware_scan_line("SIGNATURES [report["count"]] · NEURAL LOAD [load]/[capacity]", accent) if(resolution < CYBERWARE_SCAN_ITEMIZED) . += cyberware_scan_line("BUS RESOLUTION TOO LOW: IDENTITIES UNRESOLVED", accent) else - for(var/obj/item/organ/ware as anything in found) - var/datum/component/cyberware/chrome = ware.GetComponent(/datum/component/cyberware) - var/status = (ware.organ_flags & ORGAN_FAILING) ? " · OFFLINE" : "" - // Anything that isn't parlor chrome has no tier to report. - var/rating = chrome ? "T[chrome.tier]" : "UNRATED" - var/line_color = chrome ? cyberware_tier_color(chrome.tier) : CYBERWARE_SCAN_UNRATED_COLOR - . += cyberware_scan_line("» [uppertext(ware.name)] · [rating][status]", line_color) + for(var/list/entry as anything in report["entries"]) + var/status = entry["offline"] ? " · OFFLINE" : "" + var/rating = entry["rated"] ? (list("STREET", "PRO", "MILITARY", "LEGEND")[clamp(entry["tier"], 1, 4)]) : "UNRATED" + . += cyberware_scan_line("» [uppertext(entry["name"])] · [rating][status]", entry["color"]) if(load > capacity) . += cyberware_scan_line("LOAD OVER CEILING: SUBJECT BROWNED OUT", CYBERWARE_COLOR_TIER_3) @@ -106,12 +168,41 @@ /datum/action/cooldown/cyberware/chrome_read name = "Chrome Read" - desc = "Read a body's hardware bus: what's installed, what tier it is, and how loaded their nervous system is. They'll feel you do it." + desc = "Read the chrome in a body you can see. They'll feel you do it." button_icon = 'icons/mob/actions/actions_items.dmi' button_icon_state = "scan" ranged_mousepointer = 'icons/effects/mouse_pointers/scan_target.dmi' cooldown_time = CYBERWARE_SCAN_COOLDOWN click_to_activate = TRUE + /// The readout this read is drawing for our bearer. A new read replaces it. + var/datum/chrome_readout/current_readout + +/datum/action/cooldown/cyberware/chrome_read/New(Target, original = TRUE) + . = ..() + var/obj/item/organ/eyes/robotic/cyberware/optics = organ + if(istype(optics)) + cooldown_time = optics.chrome_read_cooldown + +/datum/action/cooldown/cyberware/chrome_read/Destroy() + QDEL_NULL(current_readout) + return ..() + +/// Swaps whatever we were showing for a fresh readout. A null report draws +/// the scatter. +/datum/action/cooldown/cyberware/chrome_read/proc/show_readout(mob/living/carbon/bearer, mob/living/carbon/subject, list/report) + QDEL_NULL(current_readout) + var/datum/chrome_readout/readout = new(bearer, subject, report, organ) + if(QDELETED(readout)) + return + current_readout = readout + RegisterSignal(readout, COMSIG_QDELETING, PROC_REF(on_readout_deleted)) + +/// Signal proc for [COMSIG_QDELETING] on our readout: it ended on its own +/// (expired, target gone, bearer logged out), so stop holding it. +/datum/action/cooldown/cyberware/chrome_read/proc/on_readout_deleted(datum/source) + SIGNAL_HANDLER + if(source == current_readout) + current_readout = null /datum/action/cooldown/cyberware/chrome_read/Activate(atom/target) var/obj/item/organ/eyes/robotic/cyberware/optics = organ @@ -128,33 +219,39 @@ if(bearer.is_blind()) bearer.balloon_alert(bearer, "optics dark!") return FALSE - if(!self_read && !can_see(bearer, subject, CYBERWARE_SCAN_RANGE)) + if(!self_read && !can_see(bearer, subject, optics.chrome_read_range)) bearer.balloon_alert(bearer, "no line of sight!") return FALSE - // Ghostskin scatters the handshake the same way it scatters NPC targeting. + // Ghostskin scatters the handshake the same way it scatters NPC targeting: + // the readout breaks up and drops without a lock. if(HAS_TRAIT(subject, TRAIT_CYBER_CAMO)) - bearer.balloon_alert(bearer, "signature scatter!") - to_chat(bearer, cyberware_scan_line("CHROME READ: SIGNAL SCATTER, NO LOCK", CYBERWARE_COLOR_TIER_3)) + show_readout(bearer, subject, null) + if(!self_read) + chrome_read_eye_glint(bearer) playsound(bearer, 'sound/machines/terminal/terminal_error.ogg', 20, TRUE) StartCooldown() return TRUE - var/list/report = cyberware_scan_readout(subject, optics.chrome_scan_resolution) - to_chat(bearer, jointext(report, "
")) + // The read draws over the subject for the reader alone; nothing goes to chat. + var/list/report = cyberware_scan_report(subject, optics.chrome_scan_resolution) + show_readout(bearer, subject, report) playsound(bearer, 'sound/machines/terminal/terminal_processing.ogg', 20, TRUE) if(!self_read) // The tell: anyone close enough sees the readout scroll across the eyes. // The subject only sits that message out when they're getting the - // louder one below instead. - var/subject_feels_it = length(cyberware_scannable_hardware(subject)) + // louder one below instead. The reader never gets it: it's their eyes. + chrome_read_eye_glint(bearer) + var/subject_feels_it = report["count"] bearer.visible_message( span_notice("[bearer]'s irises flicker with a scrolling readout."), vision_distance = 3, - ignored_mobs = subject_feels_it ? list(subject) : null, + ignored_mobs = subject_feels_it ? list(subject, bearer) : list(bearer), ) - // The subject's own hardware reports the unauthorized handshake. + // The subject's own hardware reports the unauthorized handshake: it + // flinches on their screen, and their chat names the reader. if(subject_feels_it) - if(can_see(subject, bearer, CYBERWARE_SCAN_RANGE)) + chrome_read_flinch(subject) + if(can_see(subject, bearer, optics.chrome_read_range)) to_chat(subject, span_warning("[bearer] is reading your hardware. Every piece you have just answered a handshake you never authorized.")) else to_chat(subject, span_warning("Your hardware answers a handshake you never authorized. Someone nearby is reading you.")) diff --git a/voidcrew/modules/cyberware/cyberware_scan_overlay.dm b/voidcrew/modules/cyberware/cyberware_scan_overlay.dm new file mode 100644 index 00000000000..9881ce2c342 --- /dev/null +++ b/voidcrew/modules/cyberware/cyberware_scan_overlay.dm @@ -0,0 +1,890 @@ +/** + * # Chrome read overlay + * + * What a chrome read (cyberware_scan.dm) looks like to the reader. Corner + * brackets snap onto the subject and lock while a red outline of their body + * pulses inside them. Then a panel opens beside the subject: their visible + * name, one socket per piece of hardware framed in its tier colour, a short + * name list and a load bar. The outline fades, the panel holds, and the + * brackets release as the panel fades out. + * + * - Street optics (silhouette resolution) fill the sockets with static and + * name nothing. + * - A Ghostskin subject breaks the lock: the brackets hunt, the outline + * flickers into static, the header garbles and "NO LOCK" flashes before it + * all drops. That version stays where the lock was tried instead of + * following someone the optics can't hold. + * - A body with no hardware gets the header and "no chrome". + * + * Every image is a client image shown to the reader alone, on + * ABOVE_LIGHTING_PLANE: it draws over darkness, and a flash or blindfold still + * hides it because blindness lives on FULLSCREEN_PLANE above it. The images are + * parented to the SUBJECT, so they follow them without any server work and, + * just like the subject, are never drawn through a wall. That is on purpose: + * the read needs line of sight to start, and the readout must not turn into a + * free wallhack for its whole hold. (/datum/cyberware_hud_mark is the opposite + * case: it parks on the viewer's turf to draw THROUGH walls.) + * + * All motion is animate() on the reader's client. The server builds the + * images once and runs one timer. + */ + +/// Itemized optics on a body with hardware. +#define READOUT_ITEMIZED "itemized" +/// Street optics: counts and load, nothing named. +#define READOUT_SILHOUETTE "silhouette" +/// Ghostskin: the lock breaks. +#define READOUT_SCATTER "scatter" +/// Nothing on the bus. +#define READOUT_CLEAN "clean" + +// Timeline, in deciseconds from the click. +/// Brackets snap (0-3) and lock (3-7) while the outline pulses; the panel opens here. +#define READOUT_LOCK_TIME 8.5 +/// Header fade-in plus the panel unfolding. +#define READOUT_OPEN_TIME 4.5 +#define READOUT_HOLD_TIME 60 +#define READOUT_CLEAN_HOLD_TIME 30 +#define READOUT_FADE_TIME 6 +/// A scattered read drops at this point, without ever locking. +#define READOUT_SCATTER_DROP_AT 18 +#define READOUT_SCATTER_FADE_TIME 3 + +// Geometry, in pixels from the subject's tile origin (y up). +/// Left edge of a panel opening on the right. +#define READOUT_PANEL_X 37 +/// Top edge of the panel. +#define READOUT_PANEL_TOP 45 +#define READOUT_SOCKETS_PER_ROW 6 +#define READOUT_MAX_SOCKETS 18 +#define READOUT_MAX_NAME_LINES 8 +#define READOUT_MIN_WIDTH 108 +#define READOUT_MAX_WIDTH 160 +#define READOUT_BAR_SEGMENTS 20 +/// The socket icon is 32 px drawn into an 18 px socket. +#define READOUT_SOCKET_ICON_SCALE 0.5625 + +// Colours. +/// The HUD frame: brackets, panel border, leader line. +#define READOUT_HUD_COLOR CYBERWARE_COLOR_TIER_2 +/// The targeting outline. A deep crimson, kept apart from the brighter +/// red-orange of "offline" and the pink of tier 3. +#define READOUT_LOCK_COLOR "#f01d3a" +#define READOUT_LOCK_FILL_COLOR "#c8102a" +#define READOUT_PANEL_COLOR "#060e12" +#define READOUT_NAME_COLOR "#e6fbff" +#define READOUT_DIM_COLOR "#8fa1a8" +#define READOUT_OFFLINE_COLOR "#ff5a4a" +#define READOUT_OFFLINE_NAME_COLOR "#7d8a90" +#define READOUT_STATIC_FRAME_COLOR "#6c7c83" +#define READOUT_GLINT_COLOR "#e9feff" + +#define READOUT_ICON 'voidcrew/modules/cyberware/icons/chrome_read.dmi' +#define READOUT_BAR_ICON 'voidcrew/modules/cyberware/icons/chrome_read_bar.dmi' + +/datum/chrome_readout + /// The only person this is drawn for. + var/mob/living/viewer + /// The body being read. + var/mob/living/target + /// The optics doing the reading. Pulling them ends the readout. + var/obj/item/organ/optics + /// What the images hang off: the subject, or for a scatter the turf they + /// stood on when the lock failed. + var/atom/anchor + /// READOUT_* look. + var/mode + /// The cyberware_scan_report() being drawn. Null for a scatter. + var/list/report + /// Every image, in draw order. + var/list/image/images = list() + /// One image per socket drawn. + var/list/image/sockets = list() + /// One image per name line drawn, "and N more" included. + var/list/image/name_lines = list() + /// image -> list of what play() needs to animate it: its kind, start time, + /// role ("lock", "panel", "socket", "name", "load") and kind-specific data. + var/list/cues = list() + /// The client the images went to. Held because a mob that logged out has none. + var/client/shown_to + /// Expiry timer. + var/timer_id + /// Deciseconds from creation until everything starts fading, and how long that takes. + var/fade_at + var/fade_time + /// Whole lifetime, deciseconds. + var/lifetime + /// Panel geometry. + var/panel_x + var/panel_width + var/panel_height + /// TRUE when the panel opens on the subject's left: the reader is to their right, or the right has no room. + var/flipped = FALSE + /// Pixel offset every image carries. Zero on the subject; on a turf it lines + /// the scatter up with where the subject was drawn. + var/base_w = 0 + var/base_z = 0 + +/datum/chrome_readout/New(mob/living/new_viewer, mob/living/new_target, list/new_report, obj/item/organ/new_optics, animated = TRUE) + . = ..() + viewer = new_viewer + target = new_target + report = new_report + optics = new_optics + if(isnull(report)) + mode = READOUT_SCATTER + else if(!report["count"]) + mode = READOUT_CLEAN + else if(report["resolution"] < CYBERWARE_SCAN_ITEMIZED) + mode = READOUT_SILHOUETTE + else + mode = READOUT_ITEMIZED + + if(mode == READOUT_SCATTER) + anchor = get_turf(target) + base_w = target.pixel_x + target.pixel_w + base_z = target.pixel_y + target.pixel_z + else + anchor = target + if(isnull(anchor)) + qdel(src) + return + + RegisterSignals(target, list(COMSIG_QDELETING, COMSIG_MOVABLE_Z_CHANGED), PROC_REF(end_readout)) + RegisterSignal(viewer, COMSIG_MOB_LOGOUT, PROC_REF(end_readout)) + if(viewer != target) + RegisterSignal(viewer, COMSIG_QDELETING, PROC_REF(end_readout)) + if(optics) + RegisterSignals(optics, list(COMSIG_ORGAN_REMOVED, COMSIG_QDELETING), PROC_REF(end_readout)) + + switch(mode) + if(READOUT_SCATTER) + fade_at = READOUT_SCATTER_DROP_AT + fade_time = READOUT_SCATTER_FADE_TIME + if(READOUT_CLEAN) + fade_at = READOUT_LOCK_TIME + READOUT_OPEN_TIME + READOUT_CLEAN_HOLD_TIME + fade_time = READOUT_FADE_TIME + else + fade_at = READOUT_LOCK_TIME + READOUT_OPEN_TIME + READOUT_HOLD_TIME + fade_time = READOUT_FADE_TIME + lifetime = fade_at + fade_time + 2 + + build_lock() + build_panel() + if(viewer.client) + shown_to = viewer.client + shown_to.images += images + // Animate only once the client holds the images, as balloon alerts and runechat do. + if(animated) + play() + timer_id = addtimer(CALLBACK(src, PROC_REF(expire)), lifetime, TIMER_STOPPABLE | TIMER_CLIENT_TIME | TIMER_DELETE_ME) + +/datum/chrome_readout/Destroy(force) + if(timer_id) + deltimer(timer_id) + timer_id = null + shown_to?.images -= images + shown_to = null + if(target) + UnregisterSignal(target, list(COMSIG_QDELETING, COMSIG_MOVABLE_Z_CHANGED)) + if(viewer) + UnregisterSignal(viewer, list(COMSIG_QDELETING, COMSIG_MOB_LOGOUT)) + if(optics) + UnregisterSignal(optics, list(COMSIG_ORGAN_REMOVED, COMSIG_QDELETING)) + images.Cut() + sockets.Cut() + name_lines.Cut() + cues.Cut() + viewer = null + target = null + optics = null + anchor = null + report = null + return ..() + +/// The hold and fade ran out. +/datum/chrome_readout/proc/expire() + timer_id = null + qdel(src) + +/** + * Signal proc for the ways a readout ends early: the subject deleted or moved + * to another z, the reader deleted or logged out (a new client starts with no + * images, and a ghost must see nothing), or the optics pulled or deleted. A + * subject who dies keeps theirs; it is a snapshot, and reading a corpse is fair. + */ +/datum/chrome_readout/proc/end_readout(datum/source) + SIGNAL_HANDLER + qdel(src) + +// ---- Building ---------------------------------------------------------- + +/// A blank image on the readout's plane, filed for showing and animating. +/datum/chrome_readout/proc/add_image(icon_file, icon_state, role, kind, at = 0) + var/image/drawn = icon_file ? image(icon_file, anchor, icon_state) : image(loc = anchor) + drawn.layer = ABOVE_ALL_MOB_LAYER + length(images) * 0.001 + // KEEP_APART: humans are KEEP_TOGETHER, and the readout must not be pulled + // into their group (their colour, alpha, height filters or lying turn). + drawn.appearance_flags = RESET_COLOR | RESET_ALPHA | RESET_TRANSFORM | KEEP_APART | PIXEL_SCALE + // Without this a click anywhere on the panel lands on the subject. + drawn.mouse_opacity = MOUSE_OPACITY_TRANSPARENT + SET_PLANE_EXPLICIT(drawn, ABOVE_LIGHTING_PLANE, anchor) + drawn.pixel_w = base_w + drawn.pixel_z = base_z + images += drawn + cues[drawn] = list("role" = role, "kind" = kind, "at" = at) + return drawn + +/// A flat rectangle: the white pixel state scaled to size. x/y is the bottom left. +/datum/chrome_readout/proc/add_quad(x, y, width, height, quad_color, quad_alpha, role, kind, at = 0) + var/image/quad = add_image(READOUT_ICON, "px", role, kind, at) + quad.color = quad_color + quad.alpha = quad_alpha + quad.transform = chrome_readout_quad(x, y, width, height) + return quad + +/** + * One line of maptext. `cap_row` is how many pixels below the panel's top edge + * the capitals start. The box is taller than the line and vertically centred, + * so the font's line height never shifts the text: Grand9K 6pt draws a 12 px + * cell with caps 3 px down it, TinyUnicode 12pt a 13 px cell with caps 6 px down. + */ +/datum/chrome_readout/proc/add_text(html, x, cap_row, width, tiny, role, kind, at = 0) + var/image/line = add_image(null, null, role, kind, at) + line.maptext = html + line.maptext_x = x + line.maptext_width = width + if(tiny) + line.maptext_height = 17 + line.maptext_y = READOUT_PANEL_TOP - 9 - cap_row + else + line.maptext_height = 16 + line.maptext_y = READOUT_PANEL_TOP - 11 - cap_row + return line + +/// Brackets, the red outline pulse, and for a scatter the static it breaks into. +/datum/chrome_readout/proc/build_lock() + // Draft C's reticle box: three pixels clear of a standing human sprite. + var/left = 4 + var/right = 26 + var/top = 31 + var/bottom = -2 + if(target.body_position == LYING_DOWN) + left = -2 + right = 33 + top = 26 + bottom = 4 + for(var/corner in list("nw", "ne", "sw", "se")) + var/west = findtext(corner, "w") + var/north = findtext(corner, "n") + var/image/bracket = add_image(READOUT_ICON, "bracket_[corner]", "lock", "bracket") + // The corner pixel sits at canvas column 1 or 30, row 30 or 1. + bracket.pixel_w += (west ? left - 1 : right - 30) + bracket.pixel_z += (north ? top - 30 : bottom - 1) + bracket.color = (mode == READOUT_SCATTER) ? "#ffffff" : READOUT_HUD_COLOR + cues[bracket]["out_w"] = west ? -1 : 1 + cues[bracket]["out_z"] = north ? 1 : -1 + + // The outline pulse, taken from the subject's own look at this moment. + var/image/fill = add_body_copy("lock", "lock_body") + var/list/fill_rgb = rgb2num(READOUT_LOCK_FILL_COLOR) + var/static/icon/stripes_mask = icon(READOUT_ICON, "stripes") + apply_filters(fill, list( + // Flat crimson at a third of the body's alpha... + list("type" = "color", "color" = list(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, fill_rgb[1] / 255, fill_rgb[2] / 255, fill_rgb[3] / 255, 0.33, 0, 0, 0, 0)), + // ...on every third row. + list("type" = "alpha", "icon" = stripes_mask), + )) + cues[fill]["roll"] = 2 + var/image/edge = add_body_copy("lock", "lock_body") + apply_filters(edge, chrome_read_edge_filters(READOUT_LOCK_COLOR)) + edge.alpha = 230 + + if(mode == READOUT_SCATTER) + // What the outline breaks into: tg's human-shaped static and a glitch strip. + var/image/noise = add_image('icons/effects/effects.dmi', "static", "lock", "static", 5) + noise.dir = target.dir + noise.transform = target.transform + noise.color = "#a8f3fb" + noise.alpha = 191 + cues[noise]["jitter"] = 2 + var/image/glitch = add_image('icons/effects/bitrunning.dmi', "glitch", "lock", "static", 5) + glitch.color = CYBERWARE_COLOR_TIER_3 + cues[glitch]["jitter"] = 3 + return + + // Two echoes of the outline swell out from it while the lock holds. + for(var/echo_at in list(3, 6)) + var/image/echo = add_body_copy("lock", "echo", echo_at) + apply_filters(echo, chrome_read_edge_filters(READOUT_LOCK_COLOR)) + var/matrix/start = matrix(target.transform) + var/matrix/finish = matrix(target.transform) + finish.Scale(1.25) + var/matrix/midway = matrix(target.transform) + midway.Scale(1.12) + cues[echo]["from"] = start + cues[echo]["to"] = finish + // Held mid-swell, so a frame captured without animation shows one. + echo.transform = midway + echo.alpha = 110 + +/// A copy of the subject's current look on the readout's plane. +/datum/chrome_readout/proc/add_body_copy(role, kind, at = 0) + var/image/copy = chrome_read_body_copy(target, anchor) + copy.layer = ABOVE_ALL_MOB_LAYER + length(images) * 0.001 + images += copy + cues[copy] = list("role" = role, "kind" = kind, "at" = at) + return copy + +/// Sets an image's filters from param lists, keeping the lists for anything that inspects the readout. +/datum/chrome_readout/proc/apply_filters(image/drawn, list/specs) + var/list/built = list() + for(var/list/spec as anything in specs) + built += filter(arglist(spec)) + drawn.filters = built + cues[drawn]["filters"] = specs + +/// The panel: frame, leader, header, sockets, names and load bar. +/datum/chrome_readout/proc/build_panel() + var/static/datum/font/header_font = new /datum/font/grand9k/size_6pt() + var/static/datum/font/list_font = new /datum/font/tiny_unicode/size_12pt() + var/open_at = (mode == READOUT_SCATTER) ? 5 : READOUT_LOCK_TIME + var/top = READOUT_PANEL_TOP + + // What goes in it. + var/list/entries = list() + var/socket_count = 0 + if(mode == READOUT_ITEMIZED) + entries = sort_entries(report["entries"]) + socket_count = min(length(entries), READOUT_MAX_SOCKETS) + else if(mode == READOUT_SILHOUETTE) + socket_count = min(report["count"], READOUT_MAX_SOCKETS) + var/rows = CEILING(socket_count / READOUT_SOCKETS_PER_ROW, 1) + + var/list/lines = list() + if(mode == READOUT_ITEMIZED) + var/shown = length(entries) + if(shown > READOUT_MAX_NAME_LINES) + shown = READOUT_MAX_NAME_LINES - 1 + for(var/i in 1 to shown) + var/list/entry = entries[i] + lines += list(list("label" = entry["label"], "color" = entry["color"], "offline" = entry["offline"])) + if(shown < length(entries)) + lines += list(list("label" = "and [length(entries) - shown] more", "color" = null, "offline" = FALSE)) + + var/list/noise + var/header_text + if(mode == READOUT_SCATTER) + var/visible_name = ishuman(target) ? target.get_visible_name() : target.name + noise = list() + for(var/i in 1 to 8) + noise += chrome_readout_noise(clamp(length_char(visible_name), 6, 16)) + header_text = noise[1] + else + header_text = report["name"] + + // Width from the real glyph metrics, never the client's MeasureText(). + var/status_width = 0 + if(mode == READOUT_CLEAN) + status_width = list_font.get_metrics("no chrome") + 8 + else if(mode == READOUT_SCATTER) + status_width = header_font.get_metrics("NO LOCK") + 8 + var/width = 5 + header_font.get_metrics(header_text) + 6 + status_width + if(socket_count) + width = max(width, min(socket_count, READOUT_SOCKETS_PER_ROW) * 24 + 2, 22 + READOUT_BAR_SEGMENTS * 4 + 5) + // A name line starts 9 px in and needs 4 px clear of the right border, + // counting the text outline. + var/offline_width = list_font.get_metrics(" offline") + for(var/list/line as anything in lines) + width = max(width, 9 + list_font.get_metrics(line["label"]) + (line["offline"] ? offline_width : 0) + 4) + width = clamp(width, READOUT_MIN_WIDTH, READOUT_MAX_WIDTH) + if(mode != READOUT_SCATTER) + header_text = chrome_readout_fit(header_text, header_font, width - 11 - status_width) + for(var/list/line as anything in lines) + line["label"] = chrome_readout_fit(line["label"], list_font, width - 13 - (line["offline"] ? offline_width : 0)) + + var/height = 13 + switch(mode) + if(READOUT_ITEMIZED) + height = 21 + 24 * rows + 7 * length(lines) + if(READOUT_SILHOUETTE) + height = 20 + 24 * rows + + // Open on the subject's far side from the reader, so the panel never lies over the reader or the ground + // between the two; on the near side only when the far side would run off the reader's screen. + var/turf/viewer_turf = get_turf(viewer) + var/turf/target_turf = get_turf(target) + flipped = FALSE + if(viewer_turf && target_turf) + // The left edge of the subject's tile on the reader's screen, in pixels from the middle of it. A zoom pans + // the screen through the client's own pixel offset. + var/tile_left = (target_turf.x - viewer_turf.x) * ICON_SIZE_X - ICON_SIZE_X / 2 - (viewer.client?.pixel_x || 0) + var/list/screen_pixels = view_to_pixels(viewer.client?.view || world.view) + var/half_screen = screen_pixels[1] / 2 + var/fits_right = tile_left + READOUT_PANEL_X + width <= half_screen + var/fits_left = tile_left - 5 - width >= -half_screen + flipped = target_turf.x < viewer_turf.x + if(flipped && !fits_left && fits_right) + flipped = FALSE + else if(!flipped && !fits_right && fits_left) + flipped = TRUE + panel_x = flipped ? (-5 - width) : READOUT_PANEL_X + panel_width = width + panel_height = height + + // Frame. The back and sides unfold down from the header. + var/image/back = add_quad(panel_x, top - height, width, height, READOUT_PANEL_COLOR, 205, "panel", "unfold", open_at) + cues[back]["from"] = chrome_readout_quad(panel_x, top - 11, width, 11) + add_quad(panel_x, top - 1, width, 1, READOUT_HUD_COLOR, 120, "panel", "fade", open_at) + var/image/border_bottom = add_quad(panel_x, top - height, width, 1, READOUT_HUD_COLOR, 120, "panel", "unfold", open_at) + cues[border_bottom]["from"] = chrome_readout_quad(panel_x, top - 11, width, 1) + var/image/border_left = add_quad(panel_x, top - height, 1, height, READOUT_HUD_COLOR, 120, "panel", "unfold", open_at) + cues[border_left]["from"] = chrome_readout_quad(panel_x, top - 11, 1, 11) + var/image/border_right = add_quad(panel_x + width - 1, top - height, 1, height, READOUT_HUD_COLOR, 120, "panel", "unfold", open_at) + cues[border_right]["from"] = chrome_readout_quad(panel_x + width - 1, top - 11, 1, 11) + add_quad(panel_x, top - 11, 2, 11, READOUT_HUD_COLOR, 255, "panel", "fade", open_at) + var/image/leader = add_image(READOUT_ICON, flipped ? "leader_flip" : "leader", "panel", "fade", open_at) + leader.pixel_w += flipped ? -5 : 5 + leader.pixel_z += 10 + + // Header: whatever name the body shows. + if(mode == READOUT_SCATTER) + var/image/garbled = add_text(chrome_readout_header_html(html_encode(header_text), "#9fb7bd"), panel_x + 5, 2, width - 9, FALSE, "panel", "noise", open_at) + var/list/noise_html = list() + for(var/noise_text in noise) + noise_html += chrome_readout_header_html(html_encode(noise_text), "#9fb7bd") + cues[garbled]["noise"] = noise_html + add_text(chrome_readout_header_html("NO LOCK", CYBERWARE_COLOR_TIER_3, "right"), panel_x + 5, 2, width - 9, FALSE, "panel", "blink", open_at + 1.5) + return + add_text(chrome_readout_header_html(html_encode(header_text), READOUT_NAME_COLOR), panel_x + 5, 2, width - 9, FALSE, "panel", "fade", open_at) + if(mode == READOUT_CLEAN) + add_text(chrome_readout_tiny_html("no chrome", "right"), panel_x + 5, 2, width - 9, TRUE, "panel", "fade", open_at + 1) + return + + // Sockets, wrapping six to a row. + for(var/i in 1 to socket_count) + var/column = (i - 1) % READOUT_SOCKETS_PER_ROW + var/row = round((i - 1) / READOUT_SOCKETS_PER_ROW) + var/image/socket + var/mutable_appearance/inlay + if(mode == READOUT_ITEMIZED) + var/list/entry = entries[i] + socket = add_image(READOUT_ICON, entry["offline"] ? "chip_blink" : "chip", "socket", "socket", open_at + 1.8 + (i - 1) * 0.5) + socket.color = entry["offline"] ? READOUT_OFFLINE_COLOR : entry["color"] + // Smoothly downscaled, so no PIXEL_SCALE on the ware itself. + inlay = mutable_appearance(entry["icon"], entry["icon_state"], appearance_flags = RESET_COLOR) + if(entry["offline"]) + inlay.color = list(0.29, 0.29, 0.29, 0.56, 0.56, 0.56, 0.11, 0.11, 0.11) + else + socket = add_image(READOUT_ICON, "chip", "socket", "socket", open_at + 1.8 + (i - 1) * 0.5) + socket.color = READOUT_STATIC_FRAME_COLOR + inlay = mutable_appearance('icons/effects/effects.dmi', "static_base", alpha = 110, appearance_flags = RESET_COLOR | PIXEL_SCALE) + inlay.color = "#bfbfbf" + inlay.transform = matrix(READOUT_SOCKET_ICON_SCALE, 0, 0, 0, READOUT_SOCKET_ICON_SCALE, 0) + socket.overlays += inlay + // The chip state's 20 px socket starts six pixels into its canvas. + socket.pixel_w += panel_x + 3 + column * 24 - 6 + socket.pixel_z += top - 33 - row * 24 - 6 + sockets += socket + + // Names, each with its tier as a small swatch. + var/names_top = 12 + 24 * rows + for(var/i in 1 to length(lines)) + var/list/line = lines[i] + var/cap_row = names_top + 7 * (i - 1) + var/inner + if(isnull(line["color"])) + inner = "[html_encode(line["label"])]" + else if(line["offline"]) + inner = "[html_encode(line["label"])] offline" + else + inner = "[html_encode(line["label"])]" + var/image/name_line = add_text(chrome_readout_tiny_html(inner), panel_x + 9, cap_row, width - 10, TRUE, "name", "fade", open_at + 2.6 + (i - 1) * 0.5) + if(!isnull(line["color"])) + var/mutable_appearance/swatch = mutable_appearance(READOUT_ICON, "bullet", appearance_flags = RESET_COLOR) + swatch.color = line["color"] + swatch.pixel_w = panel_x + 4 + swatch.pixel_z = top - 4 - cap_row + name_line.overlays += swatch + name_lines += name_line + + // Load, as a bar. Over the ceiling it pins full in the offline colour. + var/bar_row = names_top + (length(lines) ? 7 * length(lines) + 2 : 0) + var/load = report["load"] + var/capacity = max(report["capacity"], 1) + var/over = load > capacity + var/filled = over ? READOUT_BAR_SEGMENTS : clamp(round(load / capacity * READOUT_BAR_SEGMENTS), 0, READOUT_BAR_SEGMENTS) + var/image/bar = add_image(READOUT_BAR_ICON, "fill_[filled]", "load", "bar", open_at + 3.5) + bar.color = over ? READOUT_OFFLINE_COLOR : READOUT_HUD_COLOR + bar.underlays += mutable_appearance(READOUT_BAR_ICON, "track", appearance_flags = RESET_COLOR) + bar.pixel_w += panel_x + 22 + bar.pixel_z += top - 3 - bar_row + bar.maptext = chrome_readout_tiny_html("load") + bar.maptext_x = -18 + bar.maptext_y = -5 + bar.maptext_width = 20 + bar.maptext_height = 17 + cues[bar]["fill"] = filled + +/// Highest tier first, unrated last; ties keep organ order. +/datum/chrome_readout/proc/sort_entries(list/entries) + var/list/sorted = list() + for(var/rank in list(CYBERWARE_TIER_4, CYBERWARE_TIER_3, CYBERWARE_TIER_2, CYBERWARE_TIER_1, 0)) + for(var/list/entry as anything in entries) + if(entry["tier"] == rank) + sorted += list(entry) + return sorted + +// ---- Animation --------------------------------------------------------- + +/// Hands every image its timeline. Called once, after the client has them. +/datum/chrome_readout/proc/play() + for(var/image/drawn as anything in images) + var/list/cue = cues[drawn] + switch(cue["kind"]) + if("fade") + play_fade(drawn, cue["at"]) + if("unfold") + play_unfold(drawn, cue) + if("socket") + play_socket(drawn, cue["at"]) + if("bar") + play_bar(drawn, cue) + if("bracket") + play_bracket(drawn, cue) + if("lock_body") + play_lock_body(drawn, cue) + if("echo") + play_echo(drawn, cue) + if("static") + play_static(drawn, cue) + if("noise") + play_noise(drawn, cue) + if("blink") + play_blink(drawn, cue["at"]) + +/datum/chrome_readout/proc/play_fade(image/drawn, at, fade_in = 0.8) + var/hold_alpha = drawn.alpha + drawn.alpha = 0 + animate(drawn, alpha = 0, time = at) + animate(alpha = hold_alpha, time = fade_in) + animate(alpha = hold_alpha, time = max(fade_at - at - fade_in, 0)) + animate(alpha = 0, time = fade_time) + +/datum/chrome_readout/proc/play_unfold(image/drawn, list/cue) + var/at = cue["at"] + var/hold_alpha = drawn.alpha + var/matrix/full = drawn.transform + drawn.alpha = 0 + drawn.transform = cue["from"] + animate(drawn, alpha = 0, time = at) + animate(alpha = hold_alpha, time = 0.8) + animate(transform = full, time = 2.2, easing = CUBIC_EASING | EASE_OUT) + animate(alpha = hold_alpha, time = max(fade_at - at - 3, 0)) + animate(alpha = 0, time = fade_time) + +/// Sockets land white and settle into their tier colour. +/datum/chrome_readout/proc/play_socket(image/drawn, at) + var/hold_color = drawn.color + drawn.alpha = 0 + drawn.color = "#ffffff" + animate(drawn, alpha = 0, time = at) + animate(alpha = 255, time = 0.6) + animate(color = hold_color, time = 1) + animate(alpha = 255, time = max(fade_at - at - 1.6, 0)) + animate(alpha = 0, time = fade_time) + +/// The bar fills a segment at a time. +/datum/chrome_readout/proc/play_bar(image/drawn, list/cue) + var/at = cue["at"] + var/filled = cue["fill"] + drawn.alpha = 0 + drawn.icon_state = "fill_0" + animate(drawn, alpha = 0, time = at) + animate(alpha = 255, time = 1) + for(var/step in 1 to filled) + animate(icon_state = "fill_[step]", time = 4 / filled) + animate(alpha = 255, time = max(fade_at - at - 1 - (filled ? 4 : 0), 0)) + animate(alpha = 0, time = fade_time) + +/// Snap in from wide with an overshoot, flash through the lock, hold, then +/// release outward as everything fades. A scatter never locks: the brackets hunt. +/datum/chrome_readout/proc/play_bracket(image/drawn, list/cue) + var/final_w = drawn.pixel_w + var/final_z = drawn.pixel_z + var/out_w = cue["out_w"] + var/out_z = cue["out_z"] + var/hold_color = drawn.color + drawn.pixel_w = final_w + out_w * 16 + drawn.pixel_z = final_z + out_z * 16 + drawn.alpha = 0 + drawn.color = "#ffffff" + animate(drawn, pixel_w = final_w, pixel_z = final_z, alpha = 255, time = 3, easing = BACK_EASING | EASE_OUT) + if(mode == READOUT_SCATTER) + var/elapsed = 3 + while(elapsed < fade_at) + var/step = min(1, fade_at - elapsed) + animate(pixel_w = final_w + rand(-3, 3), pixel_z = final_z + rand(-3, 3), alpha = pick(255, 255, 120), time = step, easing = JUMP_EASING | EASE_IN) + elapsed += step + else + for(var/flash in 1 to 6) + animate(color = ISODD(flash) ? hold_color : "#ffffff", time = 4 / 6, easing = JUMP_EASING | EASE_IN) + animate(color = hold_color, time = max(fade_at - 7, 0), easing = JUMP_EASING | EASE_IN) + animate(pixel_w = final_w + out_w * 10, pixel_z = final_z + out_z * 10, alpha = 0, time = fade_time, easing = CUBIC_EASING | EASE_IN) + +/// The red outline: in as the brackets land, held through the lock, out as the +/// panel opens. On a scatter it flickers and slips instead, then gives way to static. +/datum/chrome_readout/proc/play_lock_body(image/drawn, list/cue) + var/hold_alpha = drawn.alpha + var/base = drawn.pixel_w + drawn.alpha = 0 + animate(drawn, alpha = 0, time = 2) + animate(alpha = hold_alpha, time = 2) + if(mode == READOUT_SCATTER) + for(var/flicker in 1 to 8) + animate(alpha = pick(hold_alpha, hold_alpha, round(hold_alpha * 0.3), 0), pixel_w = base + rand(-2, 2), time = 0.5, easing = JUMP_EASING | EASE_IN) + animate(alpha = 0, pixel_w = base, time = 2) + else + animate(alpha = hold_alpha, time = READOUT_LOCK_TIME - 4) + animate(alpha = 0, time = 4.5) + if(cue["roll"]) + // The stripes crawl down the body, a row at a time. + animate(drawn.filters[cue["roll"]], y = -1, time = 0.8, loop = -1, easing = JUMP_EASING | EASE_IN, flags = ANIMATION_PARALLEL) + animate(y = -2, time = 0.8, easing = JUMP_EASING | EASE_IN) + animate(y = 0, time = 0.8, easing = JUMP_EASING | EASE_IN) + +/// One outline echo swelling out and fading. +/datum/chrome_readout/proc/play_echo(image/drawn, list/cue) + drawn.alpha = 0 + drawn.transform = cue["from"] + animate(drawn, alpha = 0, time = cue["at"]) + animate(alpha = 204, time = 0) + animate(alpha = 0, transform = cue["to"], time = 5.5, easing = CUBIC_EASING | EASE_OUT) + +/// Scatter static: shivers in place until the read drops. +/datum/chrome_readout/proc/play_static(image/drawn, list/cue) + var/at = cue["at"] + var/jitter = cue["jitter"] + var/hold_alpha = drawn.alpha + var/base = drawn.pixel_w + drawn.alpha = 0 + animate(drawn, alpha = 0, time = at) + animate(alpha = hold_alpha, time = 1.5) + var/elapsed = at + 1.5 + while(elapsed < fade_at) + var/step = min(0.5, fade_at - elapsed) + animate(alpha = hold_alpha, pixel_w = base + rand(-jitter, jitter), time = step, easing = JUMP_EASING | EASE_IN) + elapsed += step + animate(alpha = 0, time = fade_time) + +/// Scatter header: the name never resolves. +/datum/chrome_readout/proc/play_noise(image/drawn, list/cue) + var/at = cue["at"] + var/list/noise_html = cue["noise"] + drawn.alpha = 0 + animate(drawn, alpha = 0, time = at) + animate(alpha = 255, time = 0.8) + var/elapsed = at + 0.8 + var/frame = 0 + while(elapsed < fade_at) + var/step = min(1, fade_at - elapsed) + animate(maptext = noise_html[(frame % length(noise_html)) + 1], time = step) + elapsed += step + frame++ + animate(alpha = 0, time = fade_time) + +/// "NO LOCK", three beats on and one off. +/datum/chrome_readout/proc/play_blink(image/drawn, at) + drawn.alpha = 0 + animate(drawn, alpha = 0, time = at) + var/elapsed = at + while(elapsed + 2 <= fade_at) + animate(alpha = 255, time = 1.5, easing = JUMP_EASING | EASE_IN) + animate(alpha = 0, time = 0.5, easing = JUMP_EASING | EASE_IN) + elapsed += 2 + animate(alpha = 255, time = max(fade_at - elapsed, 0), easing = JUMP_EASING | EASE_IN) + animate(alpha = 0, time = fade_time) + +// ---- Helpers ----------------------------------------------------------- + +/// Transform that draws the 32 px white state as a rectangle with its bottom left at x, y. +/proc/chrome_readout_quad(x, y, width, height) + return matrix(width / 32, 0, x + width / 2 - 16, 0, height / 32, y + height / 2 - 16) + +/// Grand9K header line (the map's default maptext font). +/proc/chrome_readout_header_html(text, text_color, align = "left") + return MAPTEXT("

[text]
") + +/// TinyUnicode list line. `inner` is already HTML. +/proc/chrome_readout_tiny_html(inner, align = "left") + return MAPTEXT_TINY_UNICODE("
[inner]
") + +/// Garbage of the given length for a header that won't resolve. Plain text; encode it for maptext. +/proc/chrome_readout_noise(length) + var/static/list/glyphs = list("#", "%", "&", "@", "$", "/", "\\", "|", "<", ">", "*") + var/garbage = "" + for(var/i in 1 to length) + garbage += pick(glyphs) + return garbage + +/// Trims text to fit max_width pixels in the given font, marking the cut. +/proc/chrome_readout_fit(text, datum/font/font, max_width) + if(font.get_metrics(text) <= max_width) + return text + var/trimmed = text + while(length_char(trimmed) > 1 && font.get_metrics("[trimmed]..") > max_width) + trimmed = copytext_char(trimmed, 1, length_char(trimmed)) + return "[trimmed].." + +/** + * Filter chain that turns a copy of a body into just its one-pixel outline in + * `edge_color`. The body goes black, gains a white outline, and a colour matrix + * then keys alpha off red: the white ring stays, the black body vanishes, and + * nothing is added where the image was already clear. + */ +/proc/chrome_read_edge_filters(edge_color) + var/list/edge_rgb = rgb2num(edge_color) + return list( + list("type" = "color", "color" = list(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0)), + list("type" = "outline", "size" = 1, "color" = "#ffffff", "flags" = OUTLINE_SHARP | OUTLINE_SQUARE), + list("type" = "color", "color" = list(edge_rgb[1] / 255, edge_rgb[2] / 255, edge_rgb[3] / 255, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), + ) + +/** + * A client image wearing `body`'s current look, hung on `attach_to`, flattened + * out of everything that would tie it to the body's own rendering: no colour, + * alpha or filters of theirs, and on the readout's plane. Parented to the body + * itself it takes no pixel offset of its own (it inherits theirs); parked on a + * turf it keeps theirs so it lines up. + * + * Emissive overlays inside the copy keep their own plane and land exactly on + * the body's own emissives. + */ +/proc/chrome_read_body_copy(mob/living/body, atom/attach_to = body) + var/image/copy = image(loc = attach_to) + copy.appearance = body.appearance + copy.appearance_flags = KEEP_TOGETHER | KEEP_APART | RESET_COLOR | RESET_ALPHA | RESET_TRANSFORM | PIXEL_SCALE + copy.color = null + copy.alpha = 255 + copy.filters = null + copy.blend_mode = BLEND_DEFAULT + copy.render_target = null + copy.render_source = null + copy.mouse_opacity = MOUSE_OPACITY_TRANSPARENT + if(attach_to == body) + copy.pixel_x = 0 + copy.pixel_y = 0 + copy.pixel_w = 0 + copy.pixel_z = 0 + copy.layer = ABOVE_ALL_MOB_LAYER + SET_PLANE_EXPLICIT(copy, ABOVE_LIGHTING_PLANE, attach_to) + return copy + +// ---- The subject and the bystanders ------------------------------------ + +/** + * The subject's own warning: their body flinches red twice, on their screen + * only. The chat line naming the reader is sent by the action. + */ +/proc/chrome_read_flinch(mob/living/subject) + var/client/subject_client = subject?.client + if(!subject_client) + return + var/image/flinch = chrome_read_flinch_image(subject) + subject_client.images += flinch + animate(flinch, alpha = 0, time = 1) + animate(alpha = 255, time = 0) + animate(alpha = 255, time = 1) + animate(alpha = 0, time = 0.6) + animate(alpha = 0, time = 0.4) + animate(alpha = 200, time = 0) + animate(alpha = 200, time = 0.8) + animate(alpha = 0, time = 1.5) + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(remove_image_from_client), flinch, subject_client), 1 SECONDS, TIMER_CLIENT_TIME) + +/// The flinch image: the body in tier-three pink, a faint fill under a hard outline. +/proc/chrome_read_flinch_image(mob/living/subject) + var/image/flinch = chrome_read_body_copy(subject) + var/list/flinch_rgb = rgb2num(CYBERWARE_COLOR_TIER_3) + var/list/specs = chrome_read_edge_filters(CYBERWARE_COLOR_TIER_3) + // Same outline, but the body keeps a faint fill: alpha is 0.27 inside and + // 0.95 on the ring. + specs[3] = list("type" = "color", "color" = list(0, 0, 0, 0.68, 0, 0, 0, 0, 0, 0, 0, 0, flinch_rgb[1] / 255, flinch_rgb[2] / 255, flinch_rgb[3] / 255, 0.27, 0, 0, 0, 0)) + var/list/built = list() + for(var/list/spec as anything in specs) + built += filter(arglist(spec)) + flinch.filters = built + return flinch + +/** + * The tell anyone looking at the reader can see: their eyes flicker. It rides + * the reader through vis_contents, so it shows to whoever sees them. + */ +/proc/chrome_read_eye_glint(mob/living/carbon/reader) + var/mutable_appearance/glint = chrome_read_glint_appearance(reader) + if(!glint) + return + var/atom/movable/visual = reader.flick_overlay_view(glint, 0.5 SECONDS) + if(!visual) + return + visual.vis_flags |= VIS_INHERIT_DIR + animate(visual, alpha = 255, time = 1) + animate(alpha = 0, time = 0.5, easing = JUMP_EASING | EASE_IN) + animate(alpha = 255, time = 1, easing = JUMP_EASING | EASE_IN) + animate(alpha = 0, time = 0.5, easing = JUMP_EASING | EASE_IN) + animate(alpha = 255, time = 1, easing = JUMP_EASING | EASE_IN) + animate(alpha = 0, time = 1) + +/// The reader's eyes, lit. Null when there are no eyes to light or something covers them. +/proc/chrome_read_glint_appearance(mob/living/carbon/reader) + if(!ishuman(reader)) + return null + var/mob/living/carbon/human/human_reader = reader + var/obj/item/organ/eyes/eyes = human_reader.get_organ_slot(ORGAN_SLOT_EYES) + if(isnull(eyes?.eye_icon_state)) + return null + if(human_reader.check_obscured_slots() & ITEM_SLOT_EYES) + return null + var/eye_state = eyes.eye_icon_state + var/mutable_appearance/glint = mutable_appearance('icons/mob/human/human_face.dmi', "[eye_state]_l") + glint.overlays += mutable_appearance('icons/mob/human/human_face.dmi', "[eye_state]_r") + glint.overlays += emissive_appearance('icons/mob/human/human_face.dmi', "[eye_state]_l", reader) + glint.overlays += emissive_appearance('icons/mob/human/human_face.dmi', "[eye_state]_r", reader) + glint.color = READOUT_GLINT_COLOR + glint.dir = reader.dir + var/obj/item/bodypart/head/head = human_reader.get_bodypart(BODY_ZONE_HEAD) + head?.worn_face_offset?.apply_offset(glint) + return glint + +#undef READOUT_ITEMIZED +#undef READOUT_SILHOUETTE +#undef READOUT_SCATTER +#undef READOUT_CLEAN +#undef READOUT_LOCK_TIME +#undef READOUT_OPEN_TIME +#undef READOUT_HOLD_TIME +#undef READOUT_CLEAN_HOLD_TIME +#undef READOUT_FADE_TIME +#undef READOUT_SCATTER_DROP_AT +#undef READOUT_SCATTER_FADE_TIME +#undef READOUT_PANEL_X +#undef READOUT_PANEL_TOP +#undef READOUT_SOCKETS_PER_ROW +#undef READOUT_MAX_SOCKETS +#undef READOUT_MAX_NAME_LINES +#undef READOUT_MIN_WIDTH +#undef READOUT_MAX_WIDTH +#undef READOUT_BAR_SEGMENTS +#undef READOUT_SOCKET_ICON_SCALE +#undef READOUT_HUD_COLOR +#undef READOUT_LOCK_COLOR +#undef READOUT_LOCK_FILL_COLOR +#undef READOUT_PANEL_COLOR +#undef READOUT_NAME_COLOR +#undef READOUT_DIM_COLOR +#undef READOUT_OFFLINE_COLOR +#undef READOUT_OFFLINE_NAME_COLOR +#undef READOUT_STATIC_FRAME_COLOR +#undef READOUT_GLINT_COLOR +#undef READOUT_ICON +#undef READOUT_BAR_ICON diff --git a/voidcrew/modules/cyberware/icons/chrome_read.dmi b/voidcrew/modules/cyberware/icons/chrome_read.dmi new file mode 100644 index 0000000000000000000000000000000000000000..9b3c41a776f425952d9bc38aeefef36a00bc0a4c GIT binary patch literal 764 zcmVV=-0C=2@kk3iYkA<{|Pxjl;+zvm0kb<0s%=xK~#90?cFg>!!Q)a@fby7WME@s z<1$Di&+vocG|0D*AsNgpTze*Vg8rT7dBLYe*)oEUir-DHU4L}?bP#X7jx|7vnM@R1YFP2D%2nYZ~(E!Am zGw=BWmF6Mw-*XP$H(@M-NOf%-2|0fxBp|Lgvo?gV6FMa3cg|Tq1MtqLy~mH8q{Mt`C*_H6X uckYKY0CC={ZW<7rb&*@((u@BnI=?Si8Qz>5i&zr?0000V=-0C=2@)3FM|FcgL1IeCgpyGw6dwH;ifMLO75kYH02tO`lc*Y~2}CY_ss55y=V6R)q7^|TfJxYe${(s?~^@G zgR<}cZ}Yl(`i=I?e(!3tem%73X&Dp%000000NBn48~^|S0000?ao#Tmm^1EFregpA N002ovPDHLkV1n~H#^3+| literal 0 HcmV?d00001 diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware.dm index 15ec4e9376b..ce1691a003f 100644 --- a/voidcrew/modules/unit_tests/voidcrew_cyberware.dm +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware.dm @@ -264,6 +264,131 @@ TEST_ASSERT(findtext(silhouette, "SIGNATURES 2"), "A silhouette chrome read didn't report the signature count: [silhouette]") TEST_ASSERT_EQUAL(initial(optics.chrome_scan_resolution), 1, "The street-tier Nightshade isn't set to silhouette resolution") +/// (f2) Chrome read overlay: the report it draws, and the readout's life. +/// Every reader here is clientless, so this proves the data and the teardown, +/// never how the client draws it. +/// Literals: resolution 1 = CYBERWARE_SCAN_SILHOUETTE, 2 = _ITEMIZED; tier 1 = +/// CYBERWARE_TIER_1; "#8fa1a8" is the unrated colour; "cyber_camo" is +/// TRAIT_CYBER_CAMO; looks are the overlay's own "itemized", "silhouette", +/// "scatter" and "clean". +/datum/unit_test/voidcrew_cyberware_scan_overlay + +/datum/unit_test/voidcrew_cyberware_scan_overlay/Run() + var/mob/living/carbon/human/reader = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/eyes/robotic/cyberware/deadeye/optics = allocate(/obj/item/organ/eyes/robotic/cyberware/deadeye) + TEST_ASSERT(optics.Insert(reader, special = TRUE), "Deadeye staging insert was refused") + var/datum/action/cooldown/cyberware/chrome_read/read = locate() in optics.actions + TEST_ASSERT_NOTNULL(read, "The Deadeye link lost its chrome read") + TEST_ASSERT(!reader.is_blind(), "Test fixture: the staged optics left the reader blind") + + // The subject: a hidden stash, a printable augment, and a weave knocked offline. + var/mob/living/carbon/human/subject = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/cyberware/cargo_cavity/stash = allocate(/obj/item/organ/cyberimp/cyberware/cargo_cavity) + TEST_ASSERT(stash.Insert(subject, special = TRUE), "Cargo Cavity staging insert was refused") + var/obj/item/organ/cyberimp/chest/reviver/printable = allocate(/obj/item/organ/cyberimp/chest/reviver) + TEST_ASSERT(printable.Insert(subject, special = TRUE), "Reviver implant staging insert was refused") + var/obj/item/organ/cyberimp/cyberware/dermal_mesh/weave = allocate(/obj/item/organ/cyberimp/cyberware/dermal_mesh) + TEST_ASSERT(weave.Insert(subject, special = TRUE), "Dermal Mesh staging insert was refused") + var/datum/component/cyberware/weave_chrome = weave.GetComponent(/datum/component/cyberware) + weave_chrome.start_emp_reboot() + TEST_ASSERT(weave.organ_flags & ORGAN_FAILING, "Test fixture: an EMP didn't knock the weave offline") + + // The report: one entry per visible signature, nothing hidden, the + // printable augment unrated and grey, the EMP'd weave offline. + var/list/report = cyberware_scan_report(subject, 2) + TEST_ASSERT_EQUAL(report["count"], 2, "The report miscounted the visible hardware") + TEST_ASSERT_EQUAL(length(report["entries"]), length(cyberware_scannable_hardware(subject)), "The report's entries don't match the scannable hardware") + var/list/reviver_entry + var/list/weave_entry + for(var/list/entry as anything in report["entries"]) + TEST_ASSERT(entry["name"] != stash.name, "The report listed the ORGAN_HIDDEN Cargo Cavity") + if(entry["name"] == printable.name) + reviver_entry = entry + if(entry["name"] == weave.name) + weave_entry = entry + TEST_ASSERT_NOTNULL(reviver_entry, "The report dropped the printable reviver") + TEST_ASSERT(!reviver_entry["rated"], "The report rated a printable augment as parlor chrome") + TEST_ASSERT_EQUAL(reviver_entry["color"], "#8fa1a8", "An unrated augment didn't get the unrated colour") + TEST_ASSERT_NOTNULL(weave_entry, "The report dropped the Dermal Mesh") + TEST_ASSERT(weave_entry["offline"], "An EMP'd weave didn't read as offline") + TEST_ASSERT_EQUAL(weave_entry["tier"], 1, "The weave lost its tier") + TEST_ASSERT_EQUAL(weave_entry["label"], "Dermal Mesh weave", "The label kept the name's formatting macro") + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/blade = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis) + TEST_ASSERT_EQUAL(cyberware_scan_label(blade), "Mantis Blade housing", "A paired arm piece kept its side in the label") + + // Silhouette resolution counts the same signatures and resolves none of them. + var/list/blurred = cyberware_scan_report(subject, 1) + TEST_ASSERT_EQUAL(length(blurred["entries"]), 2, "A silhouette report miscounted") + for(var/list/entry as anything in blurred["entries"]) + TEST_ASSERT(isnull(entry["label"]) && isnull(entry["icon"]), "A silhouette report named or pictured a piece it shouldn't resolve") + + // A read draws a readout: one socket and one name line per entry, every + // image hung off the subject (never through walls) and deaf to clicks. + TEST_ASSERT(read.PreActivate(subject), "The chrome read didn't run on a subject in reach") + var/datum/chrome_readout/first = read.current_readout + TEST_ASSERT_NOTNULL(first, "A read left no readout on the action") + TEST_ASSERT_EQUAL(first.mode, "itemized", "Deadeye optics drew the wrong look") + TEST_ASSERT_EQUAL(length(first.sockets), 2, "The readout drew the wrong number of sockets") + TEST_ASSERT_EQUAL(length(first.name_lines), 2, "The readout drew the wrong number of names") + TEST_ASSERT_NULL(first.shown_to, "A clientless reader was handed images") + for(var/image/drawn as anything in first.images) + TEST_ASSERT_EQUAL(drawn.loc, subject, "A readout image hangs off something other than the subject") + TEST_ASSERT_EQUAL(drawn.mouse_opacity, MOUSE_OPACITY_TRANSPARENT, "A readout image takes clicks meant for the floor") + + // A new read replaces the old one. + read.ResetCooldown() + TEST_ASSERT(read.PreActivate(subject), "A second read didn't run") + TEST_ASSERT(QDELETED(first), "A second read left the first readout up") + var/datum/chrome_readout/readout = read.current_readout + TEST_ASSERT(readout && readout != first, "A second read didn't draw a new readout") + + // Each way it ends early. + SEND_SIGNAL(reader, COMSIG_MOB_LOGOUT) + TEST_ASSERT(QDELETED(readout), "The readout outlived its reader logging out") + TEST_ASSERT_NULL(read.current_readout, "The action held on to a readout that had ended") + + read.PreActivate(subject) + readout = read.current_readout + SEND_SIGNAL(subject, COMSIG_MOVABLE_Z_CHANGED, null, null, TRUE) + TEST_ASSERT(QDELETED(readout), "The readout outlived its subject changing z") + + read.PreActivate(subject) + readout = read.current_readout + optics.Remove(reader, special = TRUE) + TEST_ASSERT(QDELETED(readout), "The readout outlived the optics that drew it") + TEST_ASSERT(optics.Insert(reader, special = TRUE), "The optics wouldn't go back in") + + var/mob/living/carbon/human/doomed = allocate(/mob/living/carbon/human/consistent) + TEST_ASSERT(read.PreActivate(doomed), "The chrome read didn't run on a bare body") + readout = read.current_readout + TEST_ASSERT_EQUAL(readout.mode, "clean", "A body with no hardware drew the wrong look") + TEST_ASSERT_EQUAL(length(readout.sockets), 0, "A body with no hardware drew sockets") + qdel(doomed) + TEST_ASSERT(QDELETED(readout), "The readout outlived its subject") + + // Ghostskin: the lock breaks. No sockets, no names, and it stays on the + // turf where the lock was tried instead of following the subject. + ADD_TRAIT(subject, "cyber_camo", "chrome_read_overlay_test") + TEST_ASSERT(read.PreActivate(subject), "The chrome read didn't run on a camouflaged subject") + readout = read.current_readout + TEST_ASSERT_EQUAL(readout.mode, "scatter", "Ghostskin didn't scatter the readout") + TEST_ASSERT_EQUAL(length(readout.sockets), 0, "A scattered readout drew sockets") + TEST_ASSERT_EQUAL(length(readout.name_lines), 0, "A scattered readout named hardware") + for(var/image/drawn as anything in readout.images) + TEST_ASSERT_EQUAL(drawn.loc, get_turf(subject), "A scattered readout image follows the camouflaged subject") + REMOVE_TRAIT(subject, "cyber_camo", "chrome_read_overlay_test") + + // Street optics: a socket per signature, and not one name. + var/mob/living/carbon/human/street_reader = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/eyes/robotic/cyberware/nightshade/street_optics = allocate(/obj/item/organ/eyes/robotic/cyberware/nightshade) + TEST_ASSERT(street_optics.Insert(street_reader, special = TRUE), "Nightshade staging insert was refused") + var/datum/action/cooldown/cyberware/chrome_read/street_read = locate() in street_optics.actions + TEST_ASSERT(street_read.PreActivate(subject), "The street read didn't run") + readout = street_read.current_readout + TEST_ASSERT_EQUAL(readout.mode, "silhouette", "Nightshade optics drew the wrong look") + TEST_ASSERT_EQUAL(length(readout.sockets), 2, "A silhouette readout didn't draw a socket per signature") + TEST_ASSERT_EQUAL(length(readout.name_lines), 0, "A silhouette readout named hardware") + /// Camo line: the street weave fades its bearer but never takes the /// cyber_camo trait (NPC targeting and chrome reads key on it, so it fools /// players only), while the full Ghostskin keeps both. They share the skin diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware_npcs.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware_npcs.dm index 6a16bdef6ff..64cdace0231 100644 --- a/voidcrew/modules/unit_tests/voidcrew_cyberware_npcs.dm +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware_npcs.dm @@ -61,6 +61,17 @@ TEST_ASSERT_NULL(dummy.ai_controller, "The kit's chrome dummy has an AI") TEST_ASSERT_EQUAL(length(get_installed_cyberware(dummy)), 3, "The dummy didn't take its three pieces") + // Chrome Read reads an NPC like anyone else. + var/mob/living/carbon/human/reader = allocate(/mob/living/carbon/human/consistent, spot(0, 0)) + var/obj/item/organ/eyes/robotic/cyberware/deadeye/optics = allocate(/obj/item/organ/eyes/robotic/cyberware/deadeye) + TEST_ASSERT(optics.Insert(reader, special = TRUE), "Deadeye staging insert was refused") + var/list/report = cyberware_scan_report(dummy, 2) + TEST_ASSERT_EQUAL(report["count"], 3, "Chrome Read miscounted an NPC's chrome") + var/datum/action/cooldown/cyberware/chrome_read/read = locate() in optics.actions + TEST_ASSERT_NOTNULL(read, "The Deadeye link lost its chrome read") + TEST_ASSERT(read.PreActivate(dummy), "The chrome read didn't run on an NPC in reach") + TEST_ASSERT_NOTNULL(read.current_readout, "The chrome read drew nothing over an NPC") + // Death: every piece comes out as scrap, nothing intact is left anywhere. dummy.death() TEST_ASSERT(!length(get_installed_cyberware(dummy)), "A dead NPC kept chrome in its body") From 327204668589acbd193c72ab401cb956b0068fb6 Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Sun, 15 Nov 2026 16:08:27 -0800 Subject: [PATCH 03/29] Chrome wheel, Chrome button, chrome keybinds and optics zoom - The chrome wheel (V): a radial of every ability the bearer's chrome carries, one arc per body region, with cooldown, offline and deployed states on each chip. - Use chrome (Shift+V), Use OS chrome (Ctrl+V) and Arm chrome (Alt+V), all rebindable. - One Chrome button shows the pick and opens the wheel; chrome abilities no longer get a button each. - Optics zoom on every chrome optic, from the wheel, further on better optics; no shooting while zoomed. - Five new optics: Spyglass, Assay optics, Longsight, Marksman link and Lookout, with shop stock, loot placement and gear ratings. - The cyberware matrix test and the opt-in soak test. --- tgstation.dme | 7 + tools/gear_catalog/ratings/organs.json | 45 + voidcrew/_DEFINES/keybindings.dm | 6 + voidcrew/modules/admin/chrome_test_kit.dm | 1 + voidcrew/modules/cyberware/chrome_hud.dm | 198 +++ voidcrew/modules/cyberware/chrome_wheel.dm | 1482 +++++++++++++++++ .../modules/cyberware/chrome_wheel_arms.dm | 111 ++ .../modules/cyberware/chrome_wheel_hud.dm | 142 ++ .../cyberware/chrome_wheel_keybindings.dm | 85 + voidcrew/modules/cyberware/cyberware_base.dm | 6 + voidcrew/modules/cyberware/cyberware_zoom.dm | 244 +++ .../modules/cyberware/icons/chrome_hud.dmi | Bin 0 -> 761 bytes .../modules/cyberware/icons/chrome_wheel.dmi | Bin 0 -> 1000 bytes .../cyberware/icons/chrome_wheel_ring.dmi | Bin 0 -> 29196 bytes .../modules/cyberware/ripperdoc_catalog.dm | 8 + .../modules/cyberware/street_doc_catalog.dm | 6 + voidcrew/modules/cyberware/ware_line_zoom.dm | 210 +++ .../modules/cyberware/ware_military_arms.dm | 5 +- voidcrew/modules/cyberware/ware_pro_combat.dm | 2 + .../modules/cyberware/ware_pro_utility.dm | 2 + voidcrew/modules/loot/themes/armory.dm | 4 + voidcrew/modules/loot/themes/expedition.dm | 6 + voidcrew/modules/loot/themes/research.dm | 4 + voidcrew/modules/loot/themes/wardrobe.dm | 2 + voidcrew/modules/unit_tests/_unit_tests.dm | 4 + .../unit_tests/voidcrew_chrome_wheel.dm | 473 ++++++ .../modules/unit_tests/voidcrew_cyberware.dm | 4 +- .../unit_tests/voidcrew_cyberware_matrix.dm | 775 +++++++++ .../unit_tests/voidcrew_cyberware_soak.dm | 935 +++++++++++ .../unit_tests/voidcrew_cyberware_zoom.dm | 368 ++++ wiki/content/cyberware.md | 4 + 31 files changed, 5136 insertions(+), 3 deletions(-) create mode 100644 voidcrew/modules/cyberware/chrome_hud.dm create mode 100644 voidcrew/modules/cyberware/chrome_wheel.dm create mode 100644 voidcrew/modules/cyberware/chrome_wheel_arms.dm create mode 100644 voidcrew/modules/cyberware/chrome_wheel_hud.dm create mode 100644 voidcrew/modules/cyberware/chrome_wheel_keybindings.dm create mode 100644 voidcrew/modules/cyberware/cyberware_zoom.dm create mode 100644 voidcrew/modules/cyberware/icons/chrome_hud.dmi create mode 100644 voidcrew/modules/cyberware/icons/chrome_wheel.dmi create mode 100644 voidcrew/modules/cyberware/icons/chrome_wheel_ring.dmi create mode 100644 voidcrew/modules/cyberware/ware_line_zoom.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_chrome_wheel.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_cyberware_matrix.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_cyberware_soak.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_cyberware_zoom.dm diff --git a/tgstation.dme b/tgstation.dme index 2c92d2beb2c..c497d823b59 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -7175,6 +7175,11 @@ #include "voidcrew\modules\cryo\despawn.dm" #include "voidcrew\modules\cryo\machine.dm" #include "voidcrew\modules\cyberware\chrome_cradle.dm" +#include "voidcrew\modules\cyberware\chrome_hud.dm" +#include "voidcrew\modules\cyberware\chrome_wheel.dm" +#include "voidcrew\modules\cyberware\chrome_wheel_arms.dm" +#include "voidcrew\modules\cyberware\chrome_wheel_hud.dm" +#include "voidcrew\modules\cyberware\chrome_wheel_keybindings.dm" #include "voidcrew\modules\cyberware\cradle_ui.dm" #include "voidcrew\modules\cyberware\cyberware_anim.dm" #include "voidcrew\modules\cyberware\cyberware_anim2.dm" @@ -7185,6 +7190,7 @@ #include "voidcrew\modules\cyberware\cyberware_scan.dm" #include "voidcrew\modules\cyberware\cyberware_scan_overlay.dm" #include "voidcrew\modules\cyberware\cyberware_stealth.dm" +#include "voidcrew\modules\cyberware\cyberware_zoom.dm" #include "voidcrew\modules\cyberware\parlor_fixtures.dm" #include "voidcrew\modules\cyberware\ripperdoc_catalog.dm" #include "voidcrew\modules\cyberware\street_doc_catalog.dm" @@ -7197,6 +7203,7 @@ #include "voidcrew\modules\cyberware\ware_line_models_a.dm" #include "voidcrew\modules\cyberware\ware_line_sandy.dm" #include "voidcrew\modules\cyberware\ware_line_widowline.dm" +#include "voidcrew\modules\cyberware\ware_line_zoom.dm" #include "voidcrew\modules\cyberware\ware_military_arms.dm" #include "voidcrew\modules\cyberware\ware_military_body.dm" #include "voidcrew\modules\cyberware\ware_models_b.dm" diff --git a/tools/gear_catalog/ratings/organs.json b/tools/gear_catalog/ratings/organs.json index 10e7be33481..c3b3e88ea39 100644 --- a/tools/gear_catalog/ratings/organs.json +++ b/tools/gear_catalog/ratings/organs.json @@ -487,6 +487,33 @@ "reason": "Tag a target and your next three shots curve onto it, every 25 s. Bullets stop missing for a burst, but the target gets a warning and walls stop it. Also zooms about 14 tiles out at a slight slowdown, though nobody can shoot while zoomed. Load 3, 2 vouchers at yellow reputation.", "tier": "yellow" }, + "/obj/item/organ/eyes/robotic/cyberware/deadeye/milspec": { + "confidence": "medium", + "group": "Eyes", + "hash": "", + "name": "marksman link", + "rank": 3, + "reason": "Tag a target and your next four shots curve onto it, every 18 s, out to 10 tiles. Also zooms the view about 19 tiles out at full speed, though nobody can shoot while zoomed. Load 4, 3 vouchers at advanced reputation.", + "tier": "red" + }, + "/obj/item/organ/eyes/robotic/cyberware/longsight": { + "confidence": "medium", + "group": "Eyes", + "hash": "", + "name": "longsight optics", + "rank": 9, + "reason": "Zooms the view about 19 tiles out at full speed and names implants out to 9 tiles. Scouting only, no help in a fight. Load 2, 2,400 cr at yellow reputation.", + "tier": "yellow" + }, + "/obj/item/organ/eyes/robotic/cyberware/lookout": { + "confidence": "medium", + "group": "Eyes", + "hash": "", + "name": "lookout optics", + "rank": 6, + "reason": "Zooms the view about 24 tiles out at full speed, sees in the dark, and names every implant on a body out to 11 tiles every 8 s. Pure scouting: no shooting while zoomed. Load 3, 3 vouchers at advanced reputation.", + "tier": "yellow" + }, "/obj/item/organ/eyes/robotic/cyberware/nightshade": { "confidence": "high", "group": "Eyes", @@ -506,6 +533,24 @@ "reason": "A pulse every 10 s shows ore through rock and loot caches within 9 tiles. Great for mining and ruin crews, no help in a fight. Also zooms about 14 tiles out at a slight slowdown. Load 2, 1 voucher at yellow reputation.", "tier": "yellow" }, + "/obj/item/organ/eyes/robotic/cyberware/prospector/street": { + "confidence": "high", + "group": "Eyes", + "hash": "", + "name": "assay optics", + "rank": 12, + "reason": "A 5-tile ore pulse through rock every 15 s with no cache marks, plus a short zoom that slows you. A cheap start for miners. Load 1, 900 cr.", + "tier": "green" + }, + "/obj/item/organ/eyes/robotic/cyberware/spyglass": { + "confidence": "high", + "group": "Eyes", + "hash": "", + "name": "spyglass optics", + "rank": 13, + "reason": "A short zoom, about 9 tiles, that slows you while you look, and a chrome read that only counts implants. Binoculars reach further but take both hands. Load 1, 400 cr.", + "tier": "green" + }, "/obj/item/organ/eyes/robotic/flashlight": { "confidence": "high", "group": "Eyes", diff --git a/voidcrew/_DEFINES/keybindings.dm b/voidcrew/_DEFINES/keybindings.dm index 921f55734d9..90380ab18c9 100644 --- a/voidcrew/_DEFINES/keybindings.dm +++ b/voidcrew/_DEFINES/keybindings.dm @@ -1,2 +1,8 @@ //Carbon #define COMSIG_KB_CARBON_TAKESHIPPART_DOWN "keybinding_carbon_takeshippart_down" + +//Cyberware (voidcrew/modules/cyberware/chrome_wheel_keybindings.dm) +#define COMSIG_KB_LIVING_CHROME_WHEEL_DOWN "keybinding_living_chrome_wheel_down" +#define COMSIG_KB_LIVING_USE_CHROME_DOWN "keybinding_living_use_chrome_down" +#define COMSIG_KB_LIVING_USE_OS_CHROME_DOWN "keybinding_living_use_os_chrome_down" +#define COMSIG_KB_LIVING_DEPLOY_ARM_CHROME_DOWN "keybinding_living_deploy_arm_chrome_down" diff --git a/voidcrew/modules/admin/chrome_test_kit.dm b/voidcrew/modules/admin/chrome_test_kit.dm index e562911d4ef..8ae937c8ac7 100644 --- a/voidcrew/modules/admin/chrome_test_kit.dm +++ b/voidcrew/modules/admin/chrome_test_kit.dm @@ -45,6 +45,7 @@ GLOBAL_LIST_INIT(chrome_test_loadouts, list( /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/street/left, /obj/item/organ/cyberimp/cyberware/ghostskin/street, /obj/item/organ/cyberimp/cyberware/hopper/street, + /obj/item/organ/eyes/robotic/cyberware/spyglass, /obj/item/organ/cyberimp/cyberware/clotter_node, /obj/item/organ/cyberimp/cyberware/medic_palms, /obj/item/organ/cyberimp/cyberware/subvocal_mic, diff --git a/voidcrew/modules/cyberware/chrome_hud.dm b/voidcrew/modules/cyberware/chrome_hud.dm new file mode 100644 index 00000000000..c8c2a10b63c --- /dev/null +++ b/voidcrew/modules/cyberware/chrome_hud.dm @@ -0,0 +1,198 @@ +/** + * # Chrome on the HUD + * + * Chrome abilities are fired from the chrome wheel (chrome_wheel.dm), so none + * of them gets an action button of its own. One "Chrome" button stands in for + * all of them: it shows the pick (what Use chrome fires) with its cooldown and + * offline state, and a click opens the wheel. + * + * A chrome ability is any action whose target is installed chrome (an organ + * carrying /datum/component/cyberware), plus the wheel's own Arm chrome. Every + * other action, printable tg implants included, keeps its button. + * + * Hiding is tg's own way to keep an action without a button (the ninja dash, + * energy_katana.dm): GiveAction() does nothing for it. The action is still + * granted, so it keeps its owner, its keydown signal, its check_flags signals, + * its cooldown and its click intercepts, and Trigger() works as before. It + * just never joins anyone's actions list (so the HUD, observers and riders + * never see it) and never gets a button. Code that used to look for a chrome + * ability in mob.actions asks get_chrome_wheel_actions() instead. + * + * The chips on the wheel and the Chrome button still wear each ability's own + * button look: chrome_ability_look() builds a button that never goes on a + * screen and copies it. + */ + +/// Whether this action is a chrome ability: fired from the chrome wheel, never +/// given a button of its own. +/datum/action/proc/is_chrome_ability() + var/obj/item/organ/ware = target + return istype(ware) && !!ware.GetComponent(/datum/component/cyberware) + +/datum/action/GiveAction(mob/viewer) + if(is_chrome_ability()) + return + return ..() + +// GiveAction() is the only way in, but a button must never be built for one by any other road either. +/datum/action/ShowTo(mob/viewer) + if(is_chrome_ability()) + return + return ..() + +/datum/action/Grant(mob/grant_to) + . = ..() + if(owner && is_chrome_ability()) + chrome_hud_sync(owner, gained = TRUE) + +/datum/action/Remove(mob/remove_from) + // Grant() hands over by setting the new owner first, then removing the old one. + var/mob/losing = remove_from || owner + . = ..() + if(losing && is_chrome_ability()) + chrome_hud_sync(losing) + +/// A chrome ability's button would have been redrawn (a cooldown ticking, an +/// ability armed, a stun): the Chrome button redraws instead if it shows this one. +/datum/action/build_all_button_icons(update_flags = ALL, force) + . = ..() + if(owner && is_chrome_ability()) + var/datum/component/chrome_wheel/wheel = owner.GetComponent(/datum/component/chrome_wheel) + wheel?.on_ability_changed(src) + +/** + * Brings the bearer's Chrome button and Arm chrome up to date with the chrome + * they carry. [gained] makes the wheel if the body has none yet. + */ +/proc/chrome_hud_sync(mob/living/carbon/bearer, gained = FALSE) + if(!iscarbon(bearer) || QDELETED(bearer)) + return + var/datum/component/chrome_wheel/wheel = gained ? get_chrome_wheel(bearer) : bearer.GetComponent(/datum/component/chrome_wheel) + wheel?.sync_abilities() + +// ---- Ability looks ----------------------------------------------------- + +/// The last look built for this action's chip or Chrome button, and what it was built from. +/datum/action/var/tmp/mutable_appearance/chrome_look +/datum/action/var/tmp/chrome_look_key + +/// What an ability's look is built from. A change here rebuilds it. +/proc/chrome_ability_look_key(datum/action/ability) + var/atom/thing = isatom(ability.target) ? ability.target : null + return "[ability.button_icon]|[ability.button_icon_state]|[ability.overlay_icon_state]|[ability.name]|[thing?.icon]|[thing?.icon_state]|[length(thing?.overlays)]" + +/** + * An ability's own button look, without its background, text, tint or + * position: built on a button that never goes on a screen, so it carries the + * same icon and item overlay a button would. A fresh copy each call. + */ +/proc/chrome_ability_look(datum/action/ability) + RETURN_TYPE(/mutable_appearance) + var/key = chrome_ability_look_key(ability) + if(!ability.chrome_look || ability.chrome_look_key != key) + var/atom/movable/screen/movable/action_button/button = ability.create_button() + var/mutable_appearance/look = new(button) + qdel(button) + look.underlays = list() + look.plane = FLOAT_PLANE + look.layer = FLOAT_LAYER + look.pixel_x = 0 + look.pixel_y = 0 + look.pixel_w = 0 + look.pixel_z = 0 + look.screen_loc = null + look.maptext = null + look.color = null + look.alpha = 255 + look.transform = matrix() + look.appearance_flags = NONE + ability.chrome_look = look + ability.chrome_look_key = key + return new /mutable_appearance(ability.chrome_look) + +// ---- The Chrome button ------------------------------------------------- + +/// The pick's look, frame and anything else the Chrome button laid over itself. +/atom/movable/screen/movable/action_button/var/list/chrome_overlays + +/** + * The one HUD button chrome gets. Shows the wheel's pick framed in cyan, or + * the wheel itself with no pick; red like the pick's own button when it can't + * be used, with its cooldown in seconds and a lit background while it is out + * or armed. A click opens the wheel, and a chip clicked there is picked and fired. + */ +/datum/action/chrome_button + name = "Chrome" + button_icon = CHROME_HUD_ICON + button_icon_state = "chrome" + background_icon_state = "bg_tech_blue" + default_button_position = SCRN_OBJ_INSERT_FIRST + +/datum/action/chrome_button/proc/get_wheel() + RETURN_TYPE(/datum/component/chrome_wheel) + var/datum/component/chrome_wheel/wheel = target + return istype(wheel) ? wheel : null + +/// The ability the button shows, or null. +/datum/action/chrome_button/proc/get_pick() + return get_wheel()?.get_button_pick() + +/datum/action/chrome_button/Trigger(mob/clicker, trigger_flags) + . = ..() + if(!.) + return FALSE + if(clicker && clicker != owner) + return FALSE + var/datum/component/chrome_wheel/wheel = get_wheel() + if(!wheel) + return FALSE + wheel.button_clicked() + return TRUE + +/datum/action/chrome_button/create_button() + var/atom/movable/screen/movable/action_button/button = ..() + // Placed like a cooldown button's count. + button.maptext_x = 4 + button.maptext_y = 2 + button.maptext_width = 32 + button.maptext_height = 16 + return button + +/datum/action/chrome_button/is_action_active(atom/movable/screen/movable/action_button/current_button) + var/datum/action/pick = get_pick() + return pick && chrome_wheel_ability_active(pick, owner) + +/datum/action/chrome_button/apply_button_background(atom/movable/screen/movable/action_button/current_button, force) + // Lit while the pick is out or armed. + background_icon_state = is_action_active(current_button) ? "bg_tech_blue_active" : "bg_tech_blue" + return ..() + +/datum/action/chrome_button/apply_button_icon(atom/movable/screen/movable/action_button/current_button, force) + // With a pick, the pick's own look is laid over an empty button instead. + current_button.icon = get_pick() ? null : button_icon + current_button.icon_state = button_icon_state + +/datum/action/chrome_button/apply_button_overlay(atom/movable/screen/movable/action_button/current_button, force) + . = ..() + if(current_button.chrome_overlays) + current_button.cut_overlay(current_button.chrome_overlays) + current_button.chrome_overlays = null + var/datum/action/pick = get_pick() + if(!pick) + return + // No RESET_COLOR: the button's red goes over the pick, as it did on the pick's own button. + var/list/laid = list(chrome_ability_look(pick), chrome_wheel_marker("module_selected")) + current_button.add_overlay(laid) + current_button.chrome_overlays = laid + +/datum/action/chrome_button/update_button_status(atom/movable/screen/movable/action_button/current_button, force) + . = ..() + current_button.maptext = "" + var/datum/action/pick = get_pick() + if(!pick) + return + var/cooldown_left = chrome_wheel_cooldown_left(pick) + if(cooldown_left) + current_button.maptext = MAPTEXT_TINY_UNICODE("[CEILING(cooldown_left / 10, 1)]") + if(chrome_wheel_offline(pick) || !pick.IsAvailable()) + current_button.color = pick.transparent_when_unavailable ? rgb(128, 0, 0, 128) : rgb(128, 0, 0) diff --git a/voidcrew/modules/cyberware/chrome_wheel.dm b/voidcrew/modules/cyberware/chrome_wheel.dm new file mode 100644 index 00000000000..0e4a86c3f8a --- /dev/null +++ b/voidcrew/modules/cyberware/chrome_wheel.dm @@ -0,0 +1,1482 @@ +/** + * # Chrome wheel + * + * One wheel holding every ability the bearer's chrome carries, so nobody has + * to hunt a row of action buttons mid-fight. Three keybinds drive it + * (chrome_wheel_keybindings.dm): + * + * - Chrome wheel: hold it and the wheel opens at the centre of the view. Point + * at a chip and let go, or click one, to pick it. A quick tap leaves the + * wheel open for a click instead; pressing the key again shuts it. + * - Use chrome: fires the picked ability on key down. + * - Use OS chrome: fires the OS-slot ware's ability on key down, whatever is + * picked. + * + * A chip IS the bearer's existing /datum/action, fired through the same + * Trigger() a button click would use. Cooldowns, ORGAN_FAILING, check_flags + * and click-to-target modes are the ability's own, and nothing here copies or + * replaces one. Abilities are collected generically from every installed + * organ carrying /datum/component/cyberware, so new ware shows up without + * touching this file. Chrome abilities get no HUD button of their own + * (chrome_hud.dm): the wheel owns the one "Chrome" button that shows the pick + * and opens the wheel, and the Arm chrome ability (chrome_wheel_arms.dm) that + * deploys every arm at once. + * + * Looks: an outline of the bearer's body inside a ring cut into one arc per + * body region. Each ware sits in a socket (chrome_wheel_socket()), a run of + * fixed positions on its region's arc, with a leader line from the socket to + * the part of the body it lives in. A socket's chrome changing never moves + * another socket's chips, and an empty socket keeps a dim outline. Pointing at + * a chip grows it and lights its arc, its leader and its body part in its + * tier's colour, and a fixed readout under the ring names it. The pick wears + * the chrome read's corner brackets, and the Chrome button shows it in the + * MOD-style "selected" frame on the HUD. + * + * Pointing is by bearing from the ring's centre, so a flick outward picks the + * chip in that direction without landing on it. Inside the body nothing is + * pointed at. + * + * Sub-options: an ability can offer choices through + * /datum/action/proc/chrome_wheel_options(), empty by default. The wheel does + * not show them; a pick made with select(ability, option_id) makes Use chrome + * call the ability's use_chrome_wheel_option() with that id instead of Trigger(). + * + * Mouse handling: BYOND only reports the mouse over things it can hit, so the + * open wheel lays a full-view cursor catcher (tg's, as the scope uses) under + * its mouse-transparent pieces. Every move and click lands on the catcher, and + * the chip is worked out from where the mouse is relative to the centre. + */ + +// Readout panel under the ring, in pixels from the bottom left of the centre +// tile (y up). The panel's top edge, left edge and size. +#define CHROME_WHEEL_READOUT_TOP -108 +#define CHROME_WHEEL_READOUT_LEFT -66 +#define CHROME_WHEEL_READOUT_WIDTH 164 +#define CHROME_WHEEL_READOUT_HEIGHT 25 + +/// Organ slots that sort first inside their socket, in this order. Any other +/// slot follows them, alphabetically by slot name. +GLOBAL_LIST_INIT(chrome_wheel_slot_order, list( + ORGAN_SLOT_EYES, + ORGAN_SLOT_CYBERWARE_EARS, + ORGAN_SLOT_CYBERWARE_RIGGER, + ORGAN_SLOT_CYBERWARE_REGISTRY, + ORGAN_SLOT_CYBERWARE_OS, + ORGAN_SLOT_CYBERWARE_SKIN, + ORGAN_SLOT_CYBERWARE_FILTER, + ORGAN_SLOT_CYBERWARE_STASH, + ORGAN_SLOT_CYBERWARE_LEGS, +)) + +/** + * Where each socket's chips sit on the ring. "start" is the bearing of its + * first chip in degrees clockwise from twelve o'clock, "turn" the way the rest + * follow (1 clockwise, -1 counter-clockwise), "fits" how many its arc holds + * before another row starts further out. "arc" is the ring arc it lights and + * "region" the body part. The art in chrome_wheel_ring.dmi is drawn to match. + */ +GLOBAL_LIST_INIT(chrome_wheel_sockets, list( + CHROME_WHEEL_SOCKET_EYES = list("start" = -9, "turn" = -1, "fits" = 2, "arc" = "head", "region" = "head"), + CHROME_WHEEL_SOCKET_HEAD = list("start" = 9, "turn" = 1, "fits" = 2, "arc" = "head", "region" = "head"), + CHROME_WHEEL_SOCKET_OS = list("start" = 47, "turn" = 1, "fits" = 2, "arc" = "os", "region" = "spine"), + CHROME_WHEEL_SOCKET_RIGHT_ARM = list("start" = 83, "turn" = 1, "fits" = 4, "arc" = "r_arm", "region" = "r_arm"), + CHROME_WHEEL_SOCKET_LEGS = list("start" = 180, "turn" = 1, "fits" = 3, "arc" = "legs", "region" = "legs"), + CHROME_WHEEL_SOCKET_LEFT_ARM = list("start" = -83, "turn" = -1, "fits" = 4, "arc" = "l_arm", "region" = "l_arm"), + CHROME_WHEEL_SOCKET_SKIN = list("start" = -47, "turn" = -1, "fits" = 2, "arc" = "skin", "region" = "torso"), +)) + +/// Positions a socket holds for one organ slot, filled or not, so the rest of +/// that socket never moves when the slot is filled or emptied. Socket => +/// list(slot, positions held). The OS owns the first chip of its arc. Chrome +/// optics own the first three of theirs (their own ability, the chrome read and +/// the zoom, cyberware_zoom.dm); the third starts the eyes' second row. Arm +/// chrome (chrome_wheel_arms.dm) owns the top of the right arm's arc, where it +/// meets the torso. +GLOBAL_LIST_INIT(chrome_wheel_reserved, list( + CHROME_WHEEL_SOCKET_OS = list(ORGAN_SLOT_CYBERWARE_OS, 1), + CHROME_WHEEL_SOCKET_EYES = list(ORGAN_SLOT_EYES, 3), + CHROME_WHEEL_SOCKET_RIGHT_ARM = list(CHROME_WHEEL_ARMS_KEY, 1), +)) + +// ---- Collection -------------------------------------------------------- + +/** + * Every ability the bearer's installed chrome gives them, then Arm chrome if + * they have it. Offline ware stays in (it shows dark, and firing it gives the + * ability's own feedback); ware that is not in the body has no owner on its + * actions and drops out on its own. + */ +/proc/get_chrome_wheel_actions(mob/living/carbon/bearer) + RETURN_TYPE(/list) + . = list() + for(var/obj/item/organ/ware as anything in get_installed_cyberware(bearer)) + for(var/datum/action/ability in ware.actions) + if(QDELETED(ability) || ability.owner != bearer || !ability.owner_has_control) + continue + . += ability + var/datum/component/chrome_wheel/wheel = bearer?.GetComponent(/datum/component/chrome_wheel) + var/datum/action/chrome_arms/arms = wheel?.arm_action + if(arms && !QDELETED(arms) && arms.owner == bearer) + . += arms + +/// The ability of whatever OS-slot chrome the bearer runs, or null. +/proc/get_os_chrome_action(mob/living/carbon/bearer) + for(var/obj/item/organ/ware as anything in get_installed_cyberware(bearer)) + if(ware.slot != ORGAN_SLOT_CYBERWARE_OS) + continue + for(var/datum/action/ability in ware.actions) + if(!QDELETED(ability) && ability.owner == bearer && ability.owner_has_control) + return ability + return null + +/// The bearer's chrome wheel, made on first use. Null for a body with no chrome +/// abilities and no wheel yet, so a plain body never grows the component. +/proc/get_chrome_wheel(mob/living/carbon/bearer) + if(!iscarbon(bearer)) + return null + var/datum/component/chrome_wheel/wheel = bearer.GetComponent(/datum/component/chrome_wheel) + if(wheel || !length(get_chrome_wheel_actions(bearer))) + return wheel + wheel = bearer.AddComponent(/datum/component/chrome_wheel) + wheel?.sync_abilities() + return wheel + +// ---- Sub-option hooks -------------------------------------------------- + +/** + * One choice an ability offers. [id] must stay the same between calls for the + * same choice: the wheel remembers a pick by id and asks the ability for its + * options again before firing it. + */ +/datum/chrome_wheel_option + /// Stable key for this choice within its ability. Non-empty text: a false + /// id reads as "no option" and would fire the ability itself. + var/id + /// What the readout calls the pick. + var/name + var/icon + var/icon_state + +/datum/chrome_wheel_option/New(id, name, icon, icon_state) + src.id = id + src.name = name + src.icon = icon + src.icon_state = icon_state + +/** + * Choices this ability offers on top of firing it plainly: a list of + * /datum/chrome_wheel_option, or null for none (the default, and every ability + * today). + */ +/datum/action/proc/chrome_wheel_options(mob/living/carbon/bearer) + RETURN_TYPE(/list) + return null + +/** + * Fires one of this ability's chrome wheel sub-options. The default fires the + * ability itself; an override stashes the choice first, then calls Trigger() + * so the button's availability checks and targeting still apply. + */ +/datum/action/proc/use_chrome_wheel_option(mob/living/carbon/bearer, option_id) + return Trigger(bearer) + +/// The option with this id that the ability offers right now, or null. +/proc/chrome_wheel_find_option(datum/action/ability, mob/living/carbon/bearer, option_id) + for(var/datum/chrome_wheel_option/option in ability?.chrome_wheel_options(bearer)) + if(option.id == option_id) + return option + return null + +// ---- Names ------------------------------------------------------------- + +/** + * What the wheel calls this ability: its own name, or for a ware's plain + * deploy or use button, the ware without its housing ("Mantis Blade", not + * "Toggle Mantis Blade housing (left)"). Override for a better one. + */ +/datum/action/proc/chrome_wheel_name() + var/obj/item/organ/ware = target + if(istype(ware) && (istype(src, /datum/action/item_action/organ_action/toggle) || istype(src, /datum/action/item_action/organ_action/use))) + var/static/regex/hardware = regex(@"(\s+(spool\s+)?housing|\s+drill fist)?(\s*\((left|right)\))?$", "i") + return hardware.Replace(format_text(ware.name), "") + return format_text(name) + +/// The name of the chrome an ability lives in, or "" for one that lives in nothing. +/proc/chrome_wheel_ware_name(datum/action/ability) + var/obj/item/organ/ware = ability?.target + return istype(ware) ? format_text(ware.name) : "" + +/// Display names, ability => text. +/proc/chrome_wheel_names(list/abilities) + RETURN_TYPE(/list) + . = list() + for(var/datum/action/ability as anything in abilities) + .[ability] = ability.chrome_wheel_name() + +// ---- Layout ------------------------------------------------------------ + +/// Which socket an organ's abilities sit in, from its slot and the zone it lives in. +/proc/chrome_wheel_socket(obj/item/organ/ware) + if(!istype(ware)) + return CHROME_WHEEL_SOCKET_OS + if(ware.slot == ORGAN_SLOT_EYES || ware.zone == BODY_ZONE_PRECISE_EYES) + return CHROME_WHEEL_SOCKET_EYES + if(ware.slot == ORGAN_SLOT_CYBERWARE_OS) + return CHROME_WHEEL_SOCKET_OS + if(ware.slot == ORGAN_SLOT_CYBERWARE_SKIN) + return CHROME_WHEEL_SOCKET_SKIN + switch(ware.zone) + if(BODY_ZONE_HEAD, BODY_ZONE_PRECISE_MOUTH) + return CHROME_WHEEL_SOCKET_HEAD + if(BODY_ZONE_R_ARM, BODY_ZONE_PRECISE_R_HAND) + return CHROME_WHEEL_SOCKET_RIGHT_ARM + if(BODY_ZONE_L_ARM, BODY_ZONE_PRECISE_L_HAND) + return CHROME_WHEEL_SOCKET_LEFT_ARM + if(BODY_ZONE_R_LEG, BODY_ZONE_L_LEG, BODY_ZONE_PRECISE_R_FOOT, BODY_ZONE_PRECISE_L_FOOT) + return CHROME_WHEEL_SOCKET_LEGS + // The chest and anything else: the OS's arc, after the OS. + return CHROME_WHEEL_SOCKET_OS + +/// Which socket an ability's chip sits in: its chrome's, or for Arm chrome the right arm's. +/proc/chrome_wheel_ability_socket(datum/action/ability) + if(istype(ability, /datum/action/chrome_arms)) + return CHROME_WHEEL_SOCKET_RIGHT_ARM + return chrome_wheel_socket(ability.target) + +/// What claims an ability a reserved position (GLOB.chrome_wheel_reserved): +/// its chrome's organ slot, or CHROME_WHEEL_ARMS_KEY for Arm chrome. +/proc/chrome_wheel_reserve_key(datum/action/ability) + if(istype(ability, /datum/action/chrome_arms)) + return CHROME_WHEEL_ARMS_KEY + var/obj/item/organ/ware = ability.target + return istype(ware) ? ware.slot : null + +/// Hand chrome rides its arm's socket, after the arm's own chrome, with its +/// own leader to the hand. +/proc/chrome_wheel_is_hand(obj/item/organ/ware) + if(!istype(ware)) + return FALSE + return ware.slot == ORGAN_SLOT_CYBERWARE_HANDS || ware.zone == BODY_ZONE_PRECISE_L_HAND || ware.zone == BODY_ZONE_PRECISE_R_HAND + +/// Where an organ slot ranks inside its socket. Unlisted slots rank last. +/proc/chrome_wheel_slot_rank(obj/item/organ/ware) + var/rank = istype(ware) ? GLOB.chrome_wheel_slot_order.Find(ware.slot) : 0 + return rank || length(GLOB.chrome_wheel_slot_order) + 1 + +/// Order inside a socket: hand chrome last, then ranked organ slots, other +/// slots by name, and each organ's own button order. +/proc/cmp_chrome_wheel_abilities(datum/action/first, datum/action/second) + var/obj/item/organ/first_ware = first.target + var/obj/item/organ/second_ware = second.target + // Abilities that live in no organ (Arm chrome) go last; their place is reserved anyway. + if(!isorgan(first_ware) || !isorgan(second_ware)) + return !isorgan(first_ware) - !isorgan(second_ware) + var/hand_gap = chrome_wheel_is_hand(first_ware) - chrome_wheel_is_hand(second_ware) + if(hand_gap) + return hand_gap + var/rank_gap = chrome_wheel_slot_rank(first_ware) - chrome_wheel_slot_rank(second_ware) + if(rank_gap) + return rank_gap + if(first_ware != second_ware) + var/first_slot = istype(first_ware) ? first_ware.slot : "" + var/second_slot = istype(second_ware) ? second_ware.slot : "" + return sorttext(second_slot, first_slot) || sorttext(second.name, first.name) + return LAZYFIND(first_ware.actions, first) - LAZYFIND(second_ware.actions, second) + +/// How many chips the socket's arc holds before another row starts. +/proc/chrome_wheel_socket_fits(socket) + var/list/spec = GLOB.chrome_wheel_sockets[socket] + return spec ? spec["fits"] : 1 + +/** + * Pixel offset from the centre of the view of position [index] in [socket], + * as list(x, y). Positions run along the socket's arc CHROME_WHEEL_STEP + * degrees apart; once the arc is full they start again a row further out. + */ +/proc/chrome_wheel_position(socket, index) + RETURN_TYPE(/list) + var/list/spec = GLOB.chrome_wheel_sockets[socket] + var/fits = spec["fits"] + var/row = round((index - 1) / fits) + var/angle = spec["start"] + spec["turn"] * ((index - 1) % fits) * CHROME_WHEEL_STEP + var/radius = CHROME_WHEEL_RADIUS + row * CHROME_WHEEL_ROW_GAP + return list(round(sin(angle) * radius, 1), round(cos(angle) * radius + CHROME_WHEEL_CENTRE_Y, 1)) + +/** + * Sorts the abilities into sockets: ability => list("socket", "index", + * "hand"). Where an ability lands depends only on its own socket's chrome, + * never on what the rest of the body carries. + */ +/proc/chrome_wheel_placements(list/abilities) + RETURN_TYPE(/list) + var/list/by_socket = list() + for(var/datum/action/ability as anything in abilities) + var/socket = chrome_wheel_ability_socket(ability) + if(!by_socket[socket]) + by_socket[socket] = list() + var/list/members = by_socket[socket] + members += ability + var/list/placements = list() + for(var/socket in by_socket) + var/list/members = sortTim(by_socket[socket], GLOBAL_PROC_REF(cmp_chrome_wheel_abilities)) + var/list/reserved = GLOB.chrome_wheel_reserved[socket] + var/reserved_slot = length(reserved) ? reserved[1] : null + var/reserved_count = length(reserved) ? reserved[2] : 0 + var/next_reserved = 1 + var/next_free = reserved_count + 1 + for(var/datum/action/ability as anything in members) + var/obj/item/organ/ware = ability.target + var/index + if(reserved_slot && chrome_wheel_reserve_key(ability) == reserved_slot && next_reserved <= reserved_count) + index = next_reserved++ + else + index = next_free++ + placements[ability] = list("socket" = socket, "index" = index, "hand" = chrome_wheel_is_hand(ware)) + return placements + +/// Where each ability's chip sits: ability => list(x, y), from the centre of the view. +/proc/chrome_wheel_layout(list/abilities) + RETURN_TYPE(/list) + var/list/placements = chrome_wheel_placements(abilities) + . = list() + for(var/datum/action/ability as anything in placements) + var/list/placement = placements[ability] + .[ability] = chrome_wheel_position(placement["socket"], placement["index"]) + +// ---- Pointing ---------------------------------------------------------- + +/// Bearing of an offset from the centre of the view, as seen from the ring's +/// centre: degrees clockwise from twelve o'clock. +/proc/chrome_wheel_bearing(x, y) + return delta_to_angle(x, y - CHROME_WHEEL_CENTRE_Y) + +/** + * Which of [points] (a list of list(x, y) chip centres) the mouse at offset + * (dx, dy) means, as an index, or 0 for none. Inside the body nothing is + * pointed at. A chip right under the mouse is the one meant; anywhere else, + * the mouse points at the chip whose bearing from the ring's centre is + * nearest its own, so a quick flick outward works without landing on it. + * [on_ring], if given, says which points a bearing can pick (the first row); + * the rest only answer the mouse right on them. With [reach], a bearing only + * picks within that many pixels of the ring's centre. + */ +/proc/chrome_wheel_pick(dx, dy, list/points, list/on_ring, reach) + var/ring_y = dy - CHROME_WHEEL_CENTRE_Y + var/from_centre = sqrt(dx ** 2 + ring_y ** 2) + if(from_centre < CHROME_WHEEL_DEADZONE) + return 0 + var/nearest = 0 + var/nearest_gap = INFINITY + for(var/i in 1 to length(points)) + var/list/point = points[i] + var/gap = sqrt((point[1] - dx) ** 2 + (point[2] - dy) ** 2) + if(gap < nearest_gap) + nearest = i + nearest_gap = gap + if(nearest_gap <= CHROME_WHEEL_PICK_RANGE) + return nearest + if(reach && from_centre > reach) + return 0 + var/mouse_bearing = delta_to_angle(dx, ring_y) + var/pointed = 0 + var/pointed_turn = INFINITY + for(var/i in 1 to length(points)) + if(on_ring && !on_ring[i]) + continue + var/list/point = points[i] + var/turn = abs(WRAP(mouse_bearing - chrome_wheel_bearing(point[1], point[2]) + 180, 0, 360) - 180) + if(turn < pointed_turn) + pointed = i + pointed_turn = turn + return pointed_turn <= CHROME_WHEEL_POINT_TOLERANCE ? pointed : 0 + +/// The mouse position in a screen mouse params string, as pixels from the +/// centre of the viewer's map: list(x, y), or null if the params have none. +/proc/chrome_wheel_mouse_offset(params, client/viewer) + if(!viewer) + return null + var/list/modifiers = params2list(params) + var/screen_loc = LAZYACCESS(modifiers, SCREEN_LOC) + if(!screen_loc) + return null + var/list/pixels = screen_loc_to_offset(screen_loc, viewer.view) + var/list/view_pixels = view_to_pixels(viewer.view) + // screen_loc_to_offset counts tiles from 1, so the first tile starts a tile in. + return list(pixels[1] - ICON_SIZE_X - view_pixels[1] / 2, pixels[2] - ICON_SIZE_Y - view_pixels[2] / 2) + +/// The key a bind sits on, without its modifiers: "ShiftV" is held while "V" +/// is. Bare modifier binds ("Alt") stay as they are. +/proc/chrome_wheel_raw_key(full_key) + var/raw = full_key + var/last_modifier + for(var/modifier in list("Alt", "Ctrl", "Shift")) + if(findtextEx(raw, modifier) == 1) + raw = copytext(raw, length(modifier) + 1) + last_modifier = modifier + return raw || last_modifier + +// ---- Looks ------------------------------------------------------------- + +/// The radial.dmi "module_selected" frame the Chrome button puts round the pick, shared. +/proc/chrome_wheel_marker(frame_state) + var/static/list/markers = list() + if(!markers[frame_state]) + markers[frame_state] = mutable_appearance('icons/hud/radial.dmi', frame_state, FLOAT_LAYER - 0.1) + return markers[frame_state] + +/** + * What an ability's chip shows: the ability's own button look, minus the + * button background and text (chrome_ability_look(), chrome_hud.dm), so the + * chip carries the same icon and item overlay a button would. + */ +/proc/chrome_wheel_ability_look(datum/action/ability) + RETURN_TYPE(/mutable_appearance) + var/mutable_appearance/look = chrome_ability_look(ability) + // Keeps its own colour, follows the chip's pop, and shrinks smoothly. + look.appearance_flags = RESET_COLOR | NO_CLIENT_COLOR + return look + +/// Whether an ability is "on" right now: a toggled arm with its hardware out, +/// or a click-to-target ability armed and waiting for the click. +/proc/chrome_wheel_ability_active(datum/action/ability, mob/living/carbon/bearer) + // Arm chrome is on while any arm has its hardware out. + if(istype(ability, /datum/action/chrome_arms)) + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/housing as anything in get_chrome_arm_housings(bearer)) + if(housing.chrome_arm_deployed()) + return TRUE + return FALSE + // The zoom is a toggle, not a click-to-target: it is on while the optics are zoomed. + if(istype(ability, /datum/action/cooldown/cyberware/optics_zoom)) + var/datum/action/cooldown/cyberware/optics_zoom/zoom = ability + var/obj/item/organ/eyes/robotic/cyberware/optics = zoom.organ + return istype(optics) && optics.is_zoomed() + if(istype(ability, /datum/action/cooldown)) + return bearer.click_intercept == ability + var/obj/item/organ/cyberimp/arm/toolkit/arm = ability.target + if(istype(arm) && istype(ability, /datum/action/item_action/organ_action/toggle)) + return arm.active_item && !(arm.active_item in arm) + return FALSE + +/// Deciseconds left on an ability's cooldown, 0 for one that has none. +/proc/chrome_wheel_cooldown_left(datum/action/ability) + var/datum/action/cooldown/timed = ability + return istype(timed) ? max(timed.next_use_time - world.time, 0) : 0 + +/// Whether the chrome an ability lives in is down: rebooting from an EMP, or +/// browned out over capacity. Arm chrome is down when every arm is. +/proc/chrome_wheel_offline(datum/action/ability) + if(istype(ability, /datum/action/chrome_arms)) + var/list/housings = get_chrome_arm_housings(ability.owner) + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/housing as anything in housings) + var/datum/component/cyberware/arm_chrome = housing.GetComponent(/datum/component/cyberware) + if(arm_chrome?.is_running()) + return FALSE + return length(housings) > 0 + var/obj/item/organ/ware = ability.target + var/datum/component/cyberware/chrome = istype(ware) ? ware.GetComponent(/datum/component/cyberware) : null + return chrome && !chrome.is_running() + +/// Whether an ability can't be used right now for any other reason than its +/// chrome being down or its cooldown: its button's own checks say no. +/proc/chrome_wheel_unavailable(datum/action/ability, cooldown_left) + // On cooldown IsAvailable() is FALSE anyway; the shade shows that instead. + return !cooldown_left && !ability.IsAvailable() + +/// The tier colour of the chrome an ability lives in. Arm chrome wears the +/// colour of the best arm hardware it deploys. +/proc/chrome_wheel_tier_color(datum/action/ability) + if(istype(ability, /datum/action/chrome_arms)) + var/best_tier = 0 + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/housing as anything in get_chrome_arm_housings(ability.owner)) + var/datum/component/cyberware/arm_chrome = housing.GetComponent(/datum/component/cyberware) + best_tier = max(best_tier, arm_chrome?.tier || 0) + return best_tier ? cyberware_tier_color(best_tier) : CHROME_WHEEL_HUD_COLOR + var/obj/item/organ/ware = ability.target + var/datum/component/cyberware/chrome = istype(ware) ? ware.GetComponent(/datum/component/cyberware) : null + return chrome ? cyberware_tier_color(chrome.tier) : CHROME_WHEEL_HUD_COLOR + +/// [color] taken [amount] of the way to white. +/proc/chrome_wheel_lighten(color, amount) + var/list/channels = rgb2num(color) + return rgb(round(channels[1] + (255 - channels[1]) * amount), round(channels[2] + (255 - channels[2]) * amount), round(channels[3] + (255 - channels[3]) * amount)) + +/// One of the chip art states as an overlay that keeps its own colour. +/proc/chrome_wheel_chip_piece(piece_state, piece_color, piece_alpha = 255) + var/mutable_appearance/piece = mutable_appearance(CHROME_WHEEL_ICON, piece_state, FLOAT_LAYER, appearance_flags = RESET_COLOR | NO_CLIENT_COLOR | PIXEL_SCALE) + piece.color = piece_color + piece.alpha = piece_alpha + return piece + +/// Sorts chips clockwise from twelve o'clock, the order they pop in. +/proc/cmp_chrome_wheel_bearing(atom/movable/screen/chrome_wheel/chip/first, atom/movable/screen/chrome_wheel/chip/second) + return chrome_wheel_bearing(first.chip_x, first.chip_y) - chrome_wheel_bearing(second.chip_x, second.chip_y) + +// ---- The wheel --------------------------------------------------------- + +/datum/component/chrome_wheel + /// The ability Use chrome fires. + var/datum/weakref/selected_ref + /// The id of the sub-option of that ability Use chrome fires instead, if one was picked. + var/selected_option + /// The ability whose buttons carry the selection frame. + var/datum/weakref/marked_ref + /// CHROME_WHEEL_CLOSED, CHROME_WHEEL_HELD or CHROME_WHEEL_CLICK. + var/wheel_mode = CHROME_WHEEL_CLOSED + /// REALTIMEOFDAY when the wheel key went down. + var/press_time = 0 + /// The client the wheel is drawn on, so it comes off that screen even after + /// the client has moved to another mob. + var/client/shown_to + /// Screen-centre object every visible part of the wheel hangs off. + var/atom/movable/screen/chrome_wheel/hub/hub + /// Full-view mouse tracker under the wheel. + var/atom/movable/screen/fullscreen/cursor_catcher/chrome_wheel/catcher + /// Every screen object the open wheel made, for teardown. + var/list/parts + /// One chip per ability. + var/list/chips + /// Leader key => list("leader", "node", "node_state", "alpha"): the line + /// from a socket (or a hand chip) to the body, and its dot on the body. + var/list/leaders + /// Arc name => its piece of ring art. + var/list/arcs + /// The body part lit under the chip pointed at. + var/atom/movable/screen/chrome_wheel/art/glow + /// The chip the mouse is on. + var/atom/movable/screen/chrome_wheel/chip/highlighted + /// Readout lines, and the pick mark it shows when nothing is pointed at. + var/atom/movable/screen/chrome_wheel/readout/readout_title + var/atom/movable/screen/chrome_wheel/readout/readout_sub + var/atom/movable/screen/chrome_wheel/readout/readout_status + var/atom/movable/screen/chrome_wheel/readout/readout_mark + /// What the readout last showed. + var/readout_state + /// First mouse position reported after opening. Nothing is pointed at until + /// the mouse leaves it, so a cursor that was resting somewhere when the + /// key went down picks nothing by accident. + var/list/mouse_start + /// Whether the mouse has left [mouse_start]. + var/mouse_moved = FALSE + /// A closed wheel still fading out: its client, its pieces and the timer + /// that takes them away. + var/client/fading_client + var/list/fading_parts + var/fading_timer + /// The second body-part glow, for a chip that lights both arms. + var/atom/movable/screen/chrome_wheel/art/glow_twin + /// Opened from the Chrome button: a chip clicked is fired as well as picked. + var/fire_on_pick = FALSE + /// The one HUD button chrome gets (chrome_hud.dm), while any chrome has an ability. + var/datum/action/chrome_button/hud_button + /// Arm chrome (chrome_wheel_arms.dm), while there is arm hardware to deploy. + var/datum/action/chrome_arms/arm_action + /// What the Chrome button last showed, so it only redraws on a change. + var/button_state + /// Set while sync_abilities() runs: granting and removing actions calls back into it. + var/syncing = FALSE + +/datum/component/chrome_wheel/Initialize() + if(!iscarbon(parent)) + return COMPONENT_INCOMPATIBLE + +/datum/component/chrome_wheel/RegisterWithParent() + RegisterSignal(parent, COMSIG_MOB_LOGOUT, PROC_REF(on_logout)) + RegisterSignal(parent, COMSIG_MOB_STATCHANGE, PROC_REF(on_stat_change)) + // Things the Chrome button shows that no button redraw announces: chrome going + // down or coming back (checked every Life), an EMP, arm hardware in or out of a hand. + RegisterSignal(parent, COMSIG_LIVING_LIFE, PROC_REF(on_life)) + RegisterSignal(parent, COMSIG_ATOM_EMP_ACT, PROC_REF(on_emp)) + RegisterSignals(parent, list(COMSIG_MOB_EQUIPPED_ITEM, COMSIG_MOB_UNEQUIPPED_ITEM), PROC_REF(on_hands_changed)) + // A stun drops whatever chrome was armed, like death or passing out does. + RegisterSignal(parent, SIGNAL_ADDTRAIT(TRAIT_INCAPACITATED), PROC_REF(on_incapacitated)) + +/datum/component/chrome_wheel/UnregisterFromParent() + UnregisterSignal(parent, list(COMSIG_MOB_LOGOUT, COMSIG_MOB_STATCHANGE, COMSIG_LIVING_LIFE, COMSIG_ATOM_EMP_ACT, COMSIG_MOB_EQUIPPED_ITEM, COMSIG_MOB_UNEQUIPPED_ITEM, SIGNAL_ADDTRAIT(TRAIT_INCAPACITATED))) + +/datum/component/chrome_wheel/Destroy(force) + close_wheel() + clear_fading() + unmark() + selected_ref = null + QDEL_NULL(hud_button) + QDEL_NULL(arm_action) + return ..() + +/datum/component/chrome_wheel/proc/on_logout(datum/source) + SIGNAL_HANDLER + close_wheel() + clear_fading() + +/datum/component/chrome_wheel/proc/on_stat_change(datum/source, new_stat, old_stat) + SIGNAL_HANDLER + if(new_stat != CONSCIOUS) + disarm() + if(new_stat >= UNCONSCIOUS) + close_wheel() + refresh_button() + +/datum/component/chrome_wheel/proc/on_incapacitated(datum/source) + SIGNAL_HANDLER + disarm() + +/// Drops the aim of a chrome ability armed and waiting for its click. The cooldown is untouched. +/datum/component/chrome_wheel/proc/disarm() + var/mob/living/carbon/bearer = parent + var/datum/action/cooldown/cyberware/armed = bearer.click_intercept + if(istype(armed) && armed.owner == bearer) + armed.unset_click_ability(bearer, refund_cooldown = TRUE) + refresh_button() + +/datum/component/chrome_wheel/proc/on_life(datum/source, seconds_per_tick, times_fired) + SIGNAL_HANDLER + refresh_button() + +/datum/component/chrome_wheel/proc/on_emp(datum/source, severity, protection) + SIGNAL_HANDLER + // The chrome takes the pulse after the body's signal; look once it has. + addtimer(CALLBACK(src, PROC_REF(refresh_button)), 1, TIMER_UNIQUE | TIMER_OVERRIDE) + +/datum/component/chrome_wheel/proc/on_hands_changed(datum/source, obj/item/item) + SIGNAL_HANDLER + refresh_button() + +// ---- HUD --------------------------------------------------------------- + +/** + * Gives or takes the Chrome button and Arm chrome to match the chrome the + * body carries now. Runs whenever a chrome ability is granted or removed + * (chrome_hud.dm), so the button comes with the first chrome ability and + * goes with the last. + */ +/datum/component/chrome_wheel/proc/sync_abilities() + if(syncing || QDELETED(src)) + return + var/mob/living/carbon/bearer = parent + if(QDELETED(bearer)) + return + syncing = TRUE + if(length(get_chrome_arm_housings(bearer))) + if(!arm_action) + arm_action = new(src) + if(arm_action.owner != bearer) + arm_action.Grant(bearer) + else if(arm_action) + QDEL_NULL(arm_action) + if(length(get_chrome_wheel_actions(bearer))) + if(!hud_button) + hud_button = new(src) + if(hud_button.owner != bearer) + hud_button.Grant(bearer) + else if(hud_button) + QDEL_NULL(hud_button) + syncing = FALSE + refresh_button(force = TRUE) + +/// The ability the Chrome button shows: a chrome ability armed and waiting for +/// its click (Use OS chrome can arm one that isn't the pick), else the pick, +/// while its chrome is still in this body. +/datum/component/chrome_wheel/proc/get_button_pick() + var/mob/living/carbon/bearer = parent + var/datum/action/cooldown/cyberware/armed = bearer?.click_intercept + if(istype(armed) && armed.owner == bearer && !QDELETED(armed)) + return armed + var/datum/action/ability = selected_ref?.resolve() + if(!ability || QDELETED(ability) || ability.owner != parent) + return null + return ability + +/// A chrome ability's button would have redrawn: so does the Chrome button, if it shows that one. +/datum/component/chrome_wheel/proc/on_ability_changed(datum/action/ability) + // Or the one it showed until now: a disarmed ability hands the button back to the pick. + if(ability == get_button_pick() || (button_state && findtext(button_state, REF(ability)))) + refresh_button() + +/// Redraws the Chrome button when what it shows has changed, or always with [force]. +/datum/component/chrome_wheel/proc/refresh_button(force = FALSE) + // No HUD shows it (no client, an NPC): a button made later is drawn current anyway. + if(!hud_button || QDELETED(hud_button) || !length(hud_button.viewers)) + button_state = null + return + var/mob/living/carbon/bearer = parent + var/datum/action/pick = get_button_pick() + var/state = "none" + if(pick) + var/cooldown_left = chrome_wheel_cooldown_left(pick) + state = "[REF(pick)]|[chrome_ability_look_key(pick)]|[CEILING(cooldown_left / 10, 1)]|[chrome_wheel_offline(pick)]|[pick.IsAvailable()]|[chrome_wheel_ability_active(pick, bearer)]" + if(!force && state == button_state) + return + button_state = state + hud_button.build_all_button_icons(ALL, TRUE) + +/// The Chrome button was clicked: open the wheel for the mouse, or shut it. +/datum/component/chrome_wheel/proc/button_clicked() + if(is_open()) + close_wheel() + return + open_wheel(CHROME_WHEEL_CLICK, fire = TRUE) + +/// The "Deploy arm chrome" key: fire Arm chrome, as its chip would. +/datum/component/chrome_wheel/proc/use_arms() + var/mob/living/carbon/bearer = parent + if(!arm_action || arm_action.owner != bearer) + bearer.balloon_alert(bearer, "no arm chrome!") + return FALSE + return fire(arm_action) + +/// Whether the wheel is on screen. +/datum/component/chrome_wheel/proc/is_open() + return wheel_mode != CHROME_WHEEL_CLOSED + +// ---- Keys -------------------------------------------------------------- + +/// Wheel key down: open the wheel, or shut one a tap left open. +/datum/component/chrome_wheel/proc/wheel_key_down() + switch(wheel_mode) + if(CHROME_WHEEL_CLICK) + close_wheel() + return + if(CHROME_WHEEL_HELD) + return + if(open_wheel(CHROME_WHEEL_HELD)) + press_time = REALTIMEOFDAY + +/// Wheel key up: after a tap the wheel stays open for a click; after a hold, +/// whatever the mouse is on is picked and the wheel closes. +/datum/component/chrome_wheel/proc/wheel_key_up() + if(wheel_mode != CHROME_WHEEL_HELD) + return + if(REALTIMEOFDAY - press_time < CHROME_WHEEL_HOLD_TIME) + wheel_mode = CHROME_WHEEL_CLICK + return + choose(highlighted) + +/** + * Whether a key the "Chrome wheel" bind sits on is still down. keyUp only + * reaches binds by their bare key (bindings_client.dm), so a bind on a + * modifier combo such as ShiftV never hears its own release; while the wheel + * is held open, this poll catches it instead. + */ +/datum/component/chrome_wheel/proc/wheel_key_held() + var/mob/living/carbon/bearer = parent + var/client/viewer = bearer.client + if(!viewer) + return FALSE + var/list/bindings = viewer.prefs?.key_bindings + for(var/full_key in LAZYACCESS(bindings, CHROME_WHEEL_KEYBIND)) + if(viewer.keys_held[chrome_wheel_raw_key(full_key)]) + return TRUE + return FALSE + +/// Use chrome: fire the picked ability. With nothing picked, a lone ability +/// is fired; with several, the wheel opens for a click. +/datum/component/chrome_wheel/proc/use_selected() + if(wheel_mode != CHROME_WHEEL_CLOSED) + if(highlighted) + select_chip(highlighted, quiet = TRUE) + close_wheel() + var/datum/action/ability = get_selected_ability() + if(ability) + return fire(ability, selected_option) + var/mob/living/carbon/bearer = parent + var/list/abilities = get_chrome_wheel_actions(bearer) + switch(length(abilities)) + if(0) + bearer.balloon_alert(bearer, "no chrome!") + if(1) + select(abilities[1]) + return fire(abilities[1]) + else + open_wheel(CHROME_WHEEL_CLICK) + return FALSE + +/// Use OS chrome: fire the OS-slot ware's ability, leaving the pick alone. +/datum/component/chrome_wheel/proc/use_os() + var/mob/living/carbon/bearer = parent + var/datum/action/ability = get_os_chrome_action(bearer) + if(!ability) + bearer.balloon_alert(bearer, "no OS chrome!") + return FALSE + return fire(ability) + +/** + * Fires an ability exactly as its button would: Trigger() with the bearer as + * the clicker, so availability feedback, cooldowns and targeting modes are the + * button's own. Paced like a keybound action button (action.dm keydown()). + */ +/datum/component/chrome_wheel/proc/fire(datum/action/ability, option_id) + var/mob/living/carbon/bearer = parent + if(bearer.next_click > world.time) + return FALSE + bearer.next_click = world.time + CLICK_CD_ACTIVATE_ABILITY + // Async because some triggers wait on the player: a multi-tool arm opens its own radial. + if(option_id) + INVOKE_ASYNC(ability, TYPE_PROC_REF(/datum/action, use_chrome_wheel_option), bearer, option_id) + else + INVOKE_ASYNC(ability, TYPE_PROC_REF(/datum/action, Trigger), bearer) + // A toggle (zoom, arm hardware) changes nothing a redraw announces. + refresh_button() + return TRUE + +// ---- Selection --------------------------------------------------------- + +/datum/component/chrome_wheel/proc/select(datum/action/ability, option_id) + selected_ref = WEAKREF(ability) + selected_option = option_id + mark(ability) + for(var/atom/movable/screen/chrome_wheel/chip/chip as anything in chips) + draw_chip(chip) + update_readout() + +/datum/component/chrome_wheel/proc/deselect() + selected_ref = null + selected_option = null + unmark() + +/// The picked ability, while it is still chrome in this body and its picked +/// option is still on offer. A pick that went stale is dropped. +/datum/component/chrome_wheel/proc/get_selected_ability() + var/datum/action/ability = selected_ref?.resolve() + if(!ability) + if(selected_ref) + deselect() + return null + var/mob/living/carbon/bearer = parent + if(!(ability in get_chrome_wheel_actions(bearer)) || (selected_option && !chrome_wheel_find_option(ability, bearer, selected_option))) + deselect() + return null + return ability + +/// Shows the pick on the Chrome button, and watches it for leaving the body. +/datum/component/chrome_wheel/proc/mark(datum/action/ability) + if(marked_ref?.resolve() != ability) + unmark() + marked_ref = WEAKREF(ability) + RegisterSignal(ability, COMSIG_ACTION_REMOVED, PROC_REF(on_marked_removed)) + refresh_button() + +/datum/component/chrome_wheel/proc/unmark() + var/datum/action/marked = marked_ref?.resolve() + marked_ref = null + if(marked) + UnregisterSignal(marked, COMSIG_ACTION_REMOVED) + refresh_button() + +/// The picked ability left this body (the ware was cut out, or moved to someone +/// else): drop the pick now, so it never follows it into another body. +/datum/component/chrome_wheel/proc/on_marked_removed(datum/action/source, mob/old_owner) + SIGNAL_HANDLER + if(old_owner == parent) + deselect() + +/// Picks the ability on [chip] while it is still chrome in this body. Returns +/// whether it did: a ware cut out while the wheel was held open drops out here, +/// so its chip can't be picked and the pick can't follow it into someone else. +/datum/component/chrome_wheel/proc/select_chip(atom/movable/screen/chrome_wheel/chip/chip, quiet = FALSE) + var/datum/action/ability = chip?.ability_ref?.resolve() + if(!ability || !(ability in get_chrome_wheel_actions(parent))) + return FALSE + select(ability) + if(!quiet) + var/mob/living/carbon/bearer = parent + bearer.balloon_alert(bearer, lowertext(chip.name)) + return TRUE + +/// Pick [chip] (or nothing, for null) and close the wheel. The pick lands at +/// once; the wheel stays up a moment longer for the lock and the fade. A wheel +/// opened from the Chrome button fires the pick as well. +/datum/component/chrome_wheel/proc/choose(atom/movable/screen/chrome_wheel/chip/chip) + var/fire_it = fire_on_pick + var/picked = chip && select_chip(chip, quiet = fire_it) + close_wheel(linger = TRUE, chosen = picked ? chip : null) + if(picked && fire_it) + var/datum/action/ability = get_selected_ability() + if(ability) + fire(ability, selected_option) + +// ---- Opening and closing ----------------------------------------------- + +/// Opens the wheel in [mode]. With [fire], a chip clicked is fired as well as picked. +/datum/component/chrome_wheel/proc/open_wheel(mode, fire = FALSE) + var/mob/living/carbon/bearer = parent + var/client/viewer = bearer.client + if(wheel_mode != CHROME_WHEEL_CLOSED || !viewer || bearer.stat >= UNCONSCIOUS) + return FALSE + var/list/abilities = get_chrome_wheel_actions(bearer) + if(!length(abilities)) + bearer.balloon_alert(bearer, "no chrome!") + return FALSE + clear_fading() + build_wheel(abilities) + + catcher = new + catcher.wheel = src + catcher.assign_to_mob(bearer) + catcher.update_for_view(viewer.view) + shown_to = viewer + viewer.screen += catcher + viewer.screen += hub + play_open() + + wheel_mode = mode + fire_on_pick = fire + mouse_start = null + mouse_moved = FALSE + START_PROCESSING(SSfastprocess, src) + return TRUE + +/** + * Makes every piece of the wheel for [abilities] and hangs it off a new hub, + * without putting anything on a screen. + */ +/datum/component/chrome_wheel/proc/build_wheel(list/abilities) + var/list/placements = chrome_wheel_placements(abilities) + var/list/names = chrome_wheel_names(abilities) + parts = list() + chips = list() + leaders = list() + arcs = list() + readout_state = null + hub = new + parts += hub + add_piece(/atom/movable/screen/chrome_wheel/art/backdrop) + add_piece(/atom/movable/screen/chrome_wheel/art, "body") + glow = add_piece(/atom/movable/screen/chrome_wheel/art, null, 2.2) + glow.alpha = 0 + glow_twin = add_piece(/atom/movable/screen/chrome_wheel/art, null, 2.2) + glow_twin.alpha = 0 + var/list/arc_names = list() + for(var/socket in GLOB.chrome_wheel_sockets) + arc_names |= GLOB.chrome_wheel_sockets[socket]["arc"] + for(var/arc_name in arc_names) + arcs[arc_name] = add_piece(/atom/movable/screen/chrome_wheel/art, "arc_[arc_name]", 2.25) + + // Which sockets hold chrome of their own, and which positions are taken. + var/list/occupied = list() + var/list/taken = list() + for(var/datum/action/ability as anything in placements) + var/list/placement = placements[ability] + taken["[placement["socket"]]|[placement["index"]]"] = TRUE + // Arm chrome borrows the right arm's arc; it doesn't make the right arm chromed. + if(!placement["hand"] && !istype(ability, /datum/action/chrome_arms)) + occupied[placement["socket"]] = TRUE + for(var/socket in GLOB.chrome_wheel_sockets) + add_leader(socket, socket, occupied[socket]) + if(!taken["[socket]|1"]) + var/list/point = chrome_wheel_position(socket, 1) + var/atom/movable/screen/chrome_wheel/empty_socket/outline = add_piece(/atom/movable/screen/chrome_wheel/empty_socket) + outline.pixel_x = point[1] + outline.pixel_y = point[2] + + for(var/datum/action/ability as anything in abilities) + var/list/placement = placements[ability] + var/socket = placement["socket"] + var/list/point = chrome_wheel_position(socket, placement["index"]) + var/atom/movable/screen/chrome_wheel/chip/chip = add_piece(/atom/movable/screen/chrome_wheel/chip) + chip.ability_ref = WEAKREF(ability) + chip.name = names[ability] + chip.socket = socket + chip.index = placement["index"] + chip.leader_key = socket + chip.region = GLOB.chrome_wheel_sockets[socket]["region"] + if(istype(ability, /datum/action/chrome_arms)) + // Lights both arms: their arcs, their leaders and the arms on the body. + chip.region = CHROME_WHEEL_REGION_ARMS + else if(placement["hand"]) + var/hand = (socket == CHROME_WHEEL_SOCKET_LEFT_ARM) ? "l_hand" : "r_hand" + chip.region = hand + // The ring art has a run to the hand from each first-row position. + if(chip.index <= chrome_wheel_socket_fits(socket)) + chip.leader_key = "[hand]_[chip.index]" + add_leader(chip.leader_key, hand, TRUE) + chip.chip_x = point[1] + chip.chip_y = point[2] + chip.pixel_x = point[1] + chip.pixel_y = point[2] + chips += chip + draw_chip(chip) + // Nothing is pointed at yet: the arcs start dim, as they are whenever the pointer leaves a chip. + light_up(null) + build_readout() + update_readout() + +/// A new piece of the wheel on the hub. [art_state] sets its icon state and +/// [piece_layer] its layer, when given. +/datum/component/chrome_wheel/proc/add_piece(piece_type, art_state, piece_layer) + var/atom/movable/screen/chrome_wheel/piece = new piece_type + if(art_state) + piece.icon_state = art_state + if(piece_layer) + piece.layer = piece_layer + parts += piece + hub.vis_contents += piece + return piece + +/// The leader for [key] and the dot where it meets the body, from the ring art. +/datum/component/chrome_wheel/proc/add_leader(key, art_key, filled) + if(leaders[key]) + return + var/atom/movable/screen/chrome_wheel/art/line = add_piece(/atom/movable/screen/chrome_wheel/art, "leader_[key]", 2.3) + var/atom/movable/screen/chrome_wheel/art/dot = add_piece(/atom/movable/screen/chrome_wheel/art, "node_[art_key]", 2.4) + leaders[key] = list("leader" = line, "node" = dot, "node_state" = "node_[art_key]", "alpha" = filled ? 100 : 40) + style_leader(key, null) + +/// The readout panel's frame and its empty text lines. +/datum/component/chrome_wheel/proc/build_readout() + var/left = CHROME_WHEEL_READOUT_LEFT + var/top = CHROME_WHEEL_READOUT_TOP + var/width = CHROME_WHEEL_READOUT_WIDTH + var/height = CHROME_WHEEL_READOUT_HEIGHT + add_readout_block(left, top - height, width, height, CHROME_WHEEL_PANEL_COLOR, 205, 4) + add_readout_block(left, top - 1, width, 1, CHROME_WHEEL_HUD_COLOR, 120, 4.1) + add_readout_block(left, top - height, width, 1, CHROME_WHEEL_HUD_COLOR, 120, 4.1) + add_readout_block(left, top - height, 1, height, CHROME_WHEEL_HUD_COLOR, 120, 4.1) + add_readout_block(left + width - 1, top - height, 1, height, CHROME_WHEEL_HUD_COLOR, 120, 4.1) + add_readout_block(left, top - 12, 2, 12, CHROME_WHEEL_HUD_COLOR, 255, 4.1) + // Text boxes are taller than their line and centred on it, as the chrome + // read sets them: Grand9K caps start 5 px under a 16 px box's top, + // TinyUnicode caps 8 px under a 17 px one. + readout_title = add_readout_text(left + 5, top - 11 - 2, width - 9, 16) + readout_sub = add_readout_text(left + 5, top - 9 - 13, width - 9, 17) + readout_status = add_readout_text(left + 5, top - 11 - 3, width - 10, 16) + readout_mark = add_piece(/atom/movable/screen/chrome_wheel/readout, "pick_glyph", 4.3) + readout_mark.color = CHROME_WHEEL_PICKED_COLOR + readout_mark.alpha = 0 + readout_mark.pixel_x = left + 140 + readout_mark.pixel_y = top - 22 + +/datum/component/chrome_wheel/proc/add_readout_block(x, y, width, height, block_color, block_alpha, block_layer) + var/atom/movable/screen/chrome_wheel/readout/block = add_piece(/atom/movable/screen/chrome_wheel/readout, null, block_layer) + block.color = block_color + block.alpha = block_alpha + block.transform = chrome_readout_quad(x, y, width, height) + return block + +/datum/component/chrome_wheel/proc/add_readout_text(x, y, width, height) + var/atom/movable/screen/chrome_wheel/readout/line = add_piece(/atom/movable/screen/chrome_wheel/readout, null, 4.2) + line.icon_state = null + line.maptext_x = x + line.maptext_y = y + line.maptext_width = width + line.maptext_height = height + return line + +/// Fades the wheel in and pops the chips out one after another, clockwise from the top. +/datum/component/chrome_wheel/proc/play_open() + hub.alpha = 0 + animate(hub, alpha = 255, time = 1) + var/list/order = sortTim(chips.Copy(), GLOBAL_PROC_REF(cmp_chrome_wheel_bearing)) + for(var/i in 1 to length(order)) + var/atom/movable/screen/chrome_wheel/chip/chip = order[i] + var/matrix/small = matrix(0.6, 0, 0, 0, 0.6, 0) + chip.transform = small + animate(chip, transform = small, time = (i - 1) * 0.08) + animate(transform = matrix(), time = 0.8, easing = BACK_EASING | EASE_OUT) + +/** + * Shuts the wheel and gives the mouse back to the world. With [linger] the + * pieces stay on screen a moment to fade, after [chosen] locks. + */ +/datum/component/chrome_wheel/proc/close_wheel(linger = FALSE, atom/movable/screen/chrome_wheel/chip/chosen) + STOP_PROCESSING(SSfastprocess, src) + wheel_mode = CHROME_WHEEL_CLOSED + fire_on_pick = FALSE + if(shown_to) + shown_to.screen -= catcher + QDEL_NULL(catcher) + if(linger && shown_to && hub) + clear_fading() + fading_client = shown_to + fading_parts = parts + if(chosen) + play_lock(chosen) + animate(hub, alpha = hub.alpha, time = chosen ? 1 : 0) + animate(alpha = 0, time = 1) + fading_timer = addtimer(CALLBACK(src, PROC_REF(fade_done)), CHROME_WHEEL_LINGER_TIME, TIMER_STOPPABLE | TIMER_CLIENT_TIME | TIMER_DELETE_ME) + else + shown_to?.screen -= hub + QDEL_LIST(parts) + shown_to = null + hub = null + parts = null + chips = null + leaders = null + arcs = null + glow = null + glow_twin = null + highlighted = null + readout_title = null + readout_sub = null + readout_status = null + readout_mark = null + readout_state = null + mouse_start = null + mouse_moved = FALSE + +/datum/component/chrome_wheel/proc/fade_done() + fading_timer = null + clear_fading() + +/// Takes a fading wheel off its screen now. +/datum/component/chrome_wheel/proc/clear_fading() + if(fading_timer) + deltimer(fading_timer) + fading_timer = null + if(fading_client && length(fading_parts)) + fading_client.screen -= fading_parts[1] + fading_client = null + QDEL_LIST(fading_parts) + +/// The pick locking on: its frame flashes white and the brackets snap in. +/datum/component/chrome_wheel/proc/play_lock(atom/movable/screen/chrome_wheel/chip/chip) + var/settled = chip.color + chip.color = "#ffffff" + animate(chip, color = "#ffffff", time = 0.5) + animate(color = settled, time = 0) + for(var/atom/movable/screen/chrome_wheel/bracket/corner as anything in chip.brackets) + if(!corner.alpha) + continue + var/final_x = corner.pixel_x + var/final_y = corner.pixel_y + corner.pixel_x = final_x + corner.out_x * 7 + corner.pixel_y = final_y + corner.out_y * 7 + corner.color = "#ffffff" + animate(corner, pixel_x = final_x, pixel_y = final_y, time = 1, easing = BACK_EASING | EASE_OUT) + animate(corner, color = "#ffffff", time = 0.5, flags = ANIMATION_PARALLEL) + animate(color = CHROME_WHEEL_PICKED_COLOR, time = 0) + +/// While open: catch a modifier bind's release, and keep the chips current. +/datum/component/chrome_wheel/process(seconds_per_tick) + if(wheel_mode == CHROME_WHEEL_CLOSED) + return PROCESS_KILL + if(wheel_mode == CHROME_WHEEL_HELD && !wheel_key_held()) + wheel_key_up() + if(wheel_mode == CHROME_WHEEL_CLOSED) + return PROCESS_KILL + for(var/atom/movable/screen/chrome_wheel/chip/chip as anything in chips) + draw_chip(chip) + update_readout() + +// ---- Drawing ----------------------------------------------------------- + +/** + * Brings a chip up to date: its frame in its tier colour (blinking red while + * the chrome is down), the ability's icon, the green inner line while it is + * deployed or armed, the pick's brackets, and a draining shade with seconds + * while it cools down. Bigger and brighter while pointed at. Redraws only on + * change. + */ +/datum/component/chrome_wheel/proc/draw_chip(atom/movable/screen/chrome_wheel/chip/chip) + var/mob/living/carbon/bearer = parent + var/datum/action/ability = chip.ability_ref?.resolve() + if(!ability) + if(chip.drawn_state != "gone") + chip.drawn_state = "gone" + chip.cut_overlays() + chip.underlays.Cut() + chip.alpha = 70 + return + var/datum/action/cooldown/timed = istype(ability, /datum/action/cooldown) ? ability : null + var/cooldown_left = timed ? max(timed.next_use_time - world.time, 0) : 0 + var/offline = chrome_wheel_offline(ability) + var/unavailable = !offline && chrome_wheel_unavailable(ability, cooldown_left) + var/hovered = (chip == highlighted) + var/picked = (selected_ref?.resolve() == ability) + var/active = chrome_wheel_ability_active(ability, bearer) + var/state = "[offline]|[unavailable]|[hovered]|[picked]|[active]|[timed?.next_use_time]|[!!cooldown_left]|[chrome_ability_look_key(ability)]" + if(state != chip.drawn_state) + chip.drawn_state = state + paint_chip(chip, ability, offline, unavailable, hovered, picked, active) + update_shade(chip, cooldown_left, timed ? max(timed.cooldown_time, cooldown_left) : 0) + if(hovered) + light_up(chip) + update_count(chip, cooldown_left) + +/datum/component/chrome_wheel/proc/paint_chip(atom/movable/screen/chrome_wheel/chip/chip, datum/action/ability, offline, unavailable, hovered, picked, active) + var/size = hovered ? 26 : 22 + chip.size = size + var/base_color = offline ? CHROME_WHEEL_OFFLINE_COLOR : chrome_wheel_tier_color(ability) + chip.icon_state = "frame_[size][offline ? "_blink" : ""]" + chip.color = hovered ? chrome_wheel_lighten(base_color, 0.35) : base_color + chip.alpha = 255 + chip.cut_overlays() + chip.underlays.Cut() + chip.underlays += chrome_wheel_chip_piece("fill_[size]") + if(hovered) + chip.add_overlay(chrome_wheel_chip_piece("halo_26", base_color, 90)) + var/mutable_appearance/look = chrome_wheel_ability_look(ability) + // The icon fills the chip but for a pixel all round. + var/scale = (size - 2) / ICON_SIZE_X + look.transform = matrix(scale, 0, 0, 0, scale, 0) + // Red like its button when it can't be used. + if(offline || unavailable) + look.color = ability.transparent_when_unavailable ? rgb(128, 0, 0, 128) : rgb(128, 0, 0) + chip.add_overlay(look) + if(active) + chip.add_overlay(chrome_wheel_chip_piece("deployed_[size]")) + draw_brackets(chip, picked) + +/// The pick's corner brackets, a couple of pixels clear of the chip's corners. +/datum/component/chrome_wheel/proc/draw_brackets(atom/movable/screen/chrome_wheel/chip/chip, picked) + if(!picked) + for(var/atom/movable/screen/chrome_wheel/bracket/corner as anything in chip.brackets) + corner.alpha = 0 + return + if(!chip.brackets) + chip.brackets = list() + for(var/corner_name in list("nw", "ne", "sw", "se")) + var/atom/movable/screen/chrome_wheel/bracket/corner = new + corner.icon_state = "bracket_[corner_name]" + corner.out_x = findtext(corner_name, "w") ? -1 : 1 + corner.out_y = findtext(corner_name, "n") ? 1 : -1 + chip.brackets += corner + chip.vis_contents += corner + // The bracket art has its corner pixel one in from the edge of its tile; a + // chip's brackets sit two pixels outside its corners. + var/reach = chip.size / 2 + 2 - 15 + for(var/atom/movable/screen/chrome_wheel/bracket/corner as anything in chip.brackets) + animate(corner) + corner.alpha = 255 + corner.color = CHROME_WHEEL_PICKED_COLOR + corner.pixel_x = corner.out_x * reach + corner.pixel_y = corner.out_y * reach + +/// The cooldown wipe: a dark block over the chip's inside that drains downward +/// to nothing as the cooldown runs out, with a faint line along its top. +/// Animated on the client, so it costs no ticks. +/datum/component/chrome_wheel/proc/update_shade(atom/movable/screen/chrome_wheel/chip/chip, cooldown_left, cooldown_total) + if(!cooldown_left) + for(var/atom/movable/screen/chrome_wheel/chip_part/part in list(chip.shade, chip.shade_edge)) + animate(part) + part.alpha = 0 + return + if(!chip.shade) + chip.shade = new + chip.shade.color = COLOR_BLACK + chip.shade_edge = new + chip.shade_edge.layer = 3.2 + chip.vis_contents += list(chip.shade, chip.shade_edge) + var/list/start = chrome_wheel_shade_shape(chip.size, cooldown_left / max(cooldown_total, 1)) + var/list/finish = chrome_wheel_shade_shape(chip.size, 0) + chip.shade.alpha = 185 + chip.shade.transform = start[1] + animate(chip.shade, transform = finish[1], time = cooldown_left) + chip.shade_edge.alpha = 110 + chip.shade_edge.transform = start[2] + animate(chip.shade_edge, transform = finish[2], time = cooldown_left) + +/** + * The cooldown wipe's shape on a chip of [size] with [fraction] of its + * cooldown left: list(shade transform, edge transform). The px state is a + * full tile, squashed to the chip's inside and sitting on its floor; the edge + * is the wipe's top row. + */ +/proc/chrome_wheel_shade_shape(size, fraction) + RETURN_TYPE(/list) + var/inside = size - 2 + var/height = max(inside * min(fraction, 1), 0.3) + return list( + matrix(inside / 32, 0, 0, 0, height / 32, -(inside - height) / 2), + matrix(inside / 32, 0, 0, 0, 1 / 32, max(height, 1) - inside / 2 - 0.5), + ) + +/// Whole seconds left on the cooldown, in the chip's bottom left corner. +/datum/component/chrome_wheel/proc/update_count(atom/movable/screen/chrome_wheel/chip/chip, cooldown_left) + var/seconds = cooldown_left ? CEILING(cooldown_left / 10, 1) : 0 + var/state = "[seconds]|[chip.size]" + if(state == chip.count_state) + return + chip.count_state = state + if(!seconds) + if(chip.count) + chip.count.maptext = null + return + if(!chip.count) + chip.count = new + chip.count.icon_state = null + chip.count.layer = 3.3 + chip.count.maptext_width = 32 + chip.count.maptext_height = 17 + chip.vis_contents += chip.count + // Box centred like the readout's lines (caps 8 px under a 17 px box's top), + // putting the number three pixels in from the chip's bottom left corner. + chip.count.maptext = chrome_readout_tiny_html("[seconds]") + chip.count.maptext_x = 16 - chip.size / 2 + 3 + chip.count.maptext_y = 18 - chip.size / 2 + +/// Sets a leader and its node to [lit_color], or back to the dim HUD colour for null. +/datum/component/chrome_wheel/proc/style_leader(key, lit_color) + var/list/leader = leaders?[key] + if(!leader) + return + var/atom/movable/screen/chrome_wheel/art/line = leader["leader"] + var/atom/movable/screen/chrome_wheel/art/dot = leader["node"] + if(lit_color) + line.color = lit_color + line.alpha = 235 + dot.icon_state = "[leader["node_state"]]_lit" + dot.color = chrome_wheel_lighten(lit_color, 0.6) + dot.alpha = 255 + return + line.color = CHROME_WHEEL_HUD_COLOR + line.alpha = leader["alpha"] + dot.icon_state = leader["node_state"] + dot.color = CHROME_WHEEL_HUD_COLOR + dot.alpha = min(255, leader["alpha"] + 60) + +/// Lights the arc, leader and body part of [chip] in its colour, and puts +/// everything else back. Null lights nothing. +/datum/component/chrome_wheel/proc/light_up(atom/movable/screen/chrome_wheel/chip/chip) + var/datum/action/ability = chip?.ability_ref?.resolve() + var/lit_color + if(ability) + lit_color = chrome_wheel_offline(ability) ? CHROME_WHEEL_OFFLINE_COLOR : chrome_wheel_tier_color(ability) + // Arm chrome lights both arms; anything else its own socket and body part. + var/both_arms = lit_color && chip.region == CHROME_WHEEL_REGION_ARMS + var/list/lit_leaders = list() + var/list/lit_arcs = list() + var/list/lit_regions = list() + if(both_arms) + for(var/arm_socket in list(CHROME_WHEEL_SOCKET_LEFT_ARM, CHROME_WHEEL_SOCKET_RIGHT_ARM)) + lit_leaders += arm_socket + lit_arcs += GLOB.chrome_wheel_sockets[arm_socket]["arc"] + lit_regions += GLOB.chrome_wheel_sockets[arm_socket]["region"] + else if(lit_color) + lit_leaders += chip.leader_key + lit_arcs += GLOB.chrome_wheel_sockets[chip.socket]["arc"] + lit_regions += chip.region + for(var/key in leaders) + style_leader(key, (key in lit_leaders) ? lit_color : null) + for(var/arc_name in arcs) + var/atom/movable/screen/chrome_wheel/art/arc = arcs[arc_name] + var/lit = (arc_name in lit_arcs) + arc.color = lit ? lit_color : CHROME_WHEEL_HUD_COLOR + arc.alpha = lit ? 200 : 80 + var/list/glows = list(glow, glow_twin) + for(var/i in 1 to length(glows)) + var/atom/movable/screen/chrome_wheel/art/body_glow = glows[i] + if(!body_glow) + continue + if(i > length(lit_regions)) + body_glow.alpha = 0 + continue + body_glow.icon_state = "glow_[lit_regions[i]]" + body_glow.color = lit_color + body_glow.alpha = 255 + +/** + * The readout under the ring: the chip pointed at, the chrome it lives in in + * its tier colour, and on the right how it stands ("14s", "offline", "out"). + * With nothing pointed at it shows the pick, dim, with a small bracket mark. + */ +/datum/component/chrome_wheel/proc/update_readout() + if(!readout_title) + return + var/mob/living/carbon/bearer = parent + var/atom/movable/screen/chrome_wheel/chip/shown = highlighted + var/datum/action/ability = shown?.ability_ref?.resolve() + var/idle = !ability + var/title + if(idle) + ability = get_selected_ability() + if(ability) + var/datum/chrome_wheel_option/option = selected_option ? chrome_wheel_find_option(ability, bearer, selected_option) : null + title = option ? option.name : ability.chrome_wheel_name() + else + title = shown.name + var/sub = ability ? chrome_wheel_ware_name(ability) : "" + var/sub_color = CHROME_WHEEL_DIM_COLOR + var/title_color = CHROME_WHEEL_DIM_COLOR + var/status + var/status_color + if(ability && !idle) + title_color = CHROME_WHEEL_NAME_COLOR + var/datum/action/cooldown/timed = istype(ability, /datum/action/cooldown) ? ability : null + var/cooldown_left = timed ? max(timed.next_use_time - world.time, 0) : 0 + if(chrome_wheel_offline(ability)) + status = "offline" + status_color = CHROME_WHEEL_OFFLINE_COLOR + sub_color = CHROME_WHEEL_OFFLINE_NAME_COLOR + else + sub_color = chrome_wheel_tier_color(ability) + if(chrome_wheel_ability_active(ability, bearer)) + status = timed ? "armed" : "out" + status_color = CHROME_WHEEL_DEPLOYED_COLOR + else if(cooldown_left) + status = "[CEILING(cooldown_left / 10, 1)]s" + status_color = "#ffffff" + var/state = "[idle]|[title]|[title_color]|[sub]|[sub_color]|[status]" + if(state == readout_state) + return + readout_state = state + var/static/datum/font/header_font = new /datum/font/grand9k/size_6pt() + var/static/datum/font/list_font = new /datum/font/tiny_unicode/size_12pt() + var/status_width = status ? header_font.get_metrics(status) + 6 : 0 + if(title) + title = chrome_readout_fit(title, header_font, CHROME_WHEEL_READOUT_WIDTH - 10 - status_width) + readout_title.maptext = chrome_readout_header_html(html_encode(title), title_color) + else + readout_title.maptext = null + if(sub) + sub = chrome_readout_fit(sub, list_font, CHROME_WHEEL_READOUT_WIDTH - 10) + readout_sub.maptext = chrome_readout_tiny_html("[html_encode(sub)]") + else + readout_sub.maptext = null + readout_status.maptext = status ? chrome_readout_header_html(status, status_color, "right") : null + readout_mark.alpha = (idle && ability) ? 200 : 0 + +// ---- Mouse ------------------------------------------------------------- + +/datum/component/chrome_wheel/proc/mouse_moved(params) + if(wheel_mode == CHROME_WHEEL_CLOSED) + return + var/list/offset = chrome_wheel_mouse_offset(params, shown_to) + if(!offset) + return + if(!mouse_moved) + if(!mouse_start) + mouse_start = offset + return + if(abs(offset[1] - mouse_start[1]) + abs(offset[2] - mouse_start[2]) < 4) + return + mouse_moved = TRUE + point_at(offset) + +/datum/component/chrome_wheel/proc/mouse_clicked(params) + if(wheel_mode == CHROME_WHEEL_CLOSED) + return + var/list/offset = chrome_wheel_mouse_offset(params, shown_to) + if(!offset) + close_wheel() + return + point_at(offset) + choose(highlighted) + +/// Highlights whatever the mouse at [offset] points at. A wheel opened from the +/// Chrome button fires what a click picks, so out past the ring a click picks nothing. +/datum/component/chrome_wheel/proc/point_at(list/offset) + var/list/points = list() + var/list/on_ring = list() + for(var/atom/movable/screen/chrome_wheel/chip/chip as anything in chips) + points += list(list(chip.chip_x, chip.chip_y)) + on_ring += chip.index <= chrome_wheel_socket_fits(chip.socket) + var/index = chrome_wheel_pick(offset[1], offset[2], points, on_ring, fire_on_pick ? CHROME_WHEEL_FIRE_REACH : null) + set_highlight(index ? chips[index] : null) + +/// Moves the highlight: the old chip shrinks back, the new one grows and lights its part of the body. +/datum/component/chrome_wheel/proc/set_highlight(atom/movable/screen/chrome_wheel/chip/chip) + if(chip == highlighted) + return + var/atom/movable/screen/chrome_wheel/chip/old = highlighted + highlighted = chip + if(old) + draw_chip(old) + if(chip) + draw_chip(chip) + else + light_up(null) + update_readout() + +#undef CHROME_WHEEL_READOUT_TOP +#undef CHROME_WHEEL_READOUT_LEFT +#undef CHROME_WHEEL_READOUT_WIDTH +#undef CHROME_WHEEL_READOUT_HEIGHT diff --git a/voidcrew/modules/cyberware/chrome_wheel_arms.dm b/voidcrew/modules/cyberware/chrome_wheel_arms.dm new file mode 100644 index 00000000000..4a84015724f --- /dev/null +++ b/voidcrew/modules/cyberware/chrome_wheel_arms.dm @@ -0,0 +1,111 @@ +/** + * # Arm chrome + * + * One ability that deploys or stows all of the bearer's arm hardware at once: + * the toolkit arms that put something in a hand (Mantis, Shiv and Scorch + * pairs, Widowline, Rockjaw, Fixer's, Ronin and Holdout, Bunker Buster). Arm + * chrome with nothing to hand out (Icepick, Skyhook, Graverobber, Angler, + * Gorilla) is left alone. + * + * If anything is out, everything goes back in. Otherwise every arm that can + * deploys: running chrome, its own button usable, a free hand on its side. + * A held item is never dropped to make room, so a full hand just keeps its + * arm stowed, and an EMP'd or browned-out arm stays put. A pair comes out + * together because both housings deploy in the same press. + * + * The bearer's chrome wheel owns the ability (chrome_wheel.dm sync_abilities()) + * and gives it a fixed chip at the top of the right arm's arc. It has no HUD + * button, like every chrome ability (chrome_hud.dm); the "Deploy arm chrome" + * key fires it (chrome_wheel_keybindings.dm). + */ +/datum/action/chrome_arms + name = "Arm chrome" + button_icon = CHROME_HUD_ICON + button_icon_state = "arms" + check_flags = AB_CHECK_CONSCIOUS + +/datum/action/chrome_arms/is_chrome_ability() + return TRUE + +/datum/action/chrome_arms/Trigger(mob/clicker, trigger_flags) + . = ..() + if(!.) + return FALSE + return chrome_arms_toggle(owner) + +/// The bearer's installed arm chrome that hands something out, deployed or not. +/proc/get_chrome_arm_housings(mob/living/carbon/bearer) + RETURN_TYPE(/list) + . = list() + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/housing in get_installed_cyberware(bearer)) + if(housing.chrome_arm_item()) + . += housing + +/** + * Stows every deployed arm if any is out, or else deploys every arm that can. + * Returns whether anything moved. + */ +/proc/chrome_arms_toggle(mob/living/carbon/bearer) + var/list/housings = get_chrome_arm_housings(bearer) + if(!length(housings)) + bearer?.balloon_alert(bearer, "no arm chrome!") + return FALSE + var/list/deployed = list() + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/housing as anything in housings) + if(housing.chrome_arm_deployed()) + deployed += housing + if(length(deployed)) + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/housing as anything in deployed) + housing.Retract() + return TRUE + if(HAS_TRAIT(bearer, TRAIT_INCAPACITATED)) + bearer.balloon_alert(bearer, "incapacitated!") + return FALSE + if(HAS_TRAIT(bearer, TRAIT_HANDS_BLOCKED)) + bearer.balloon_alert(bearer, "hands blocked!") + return FALSE + var/out = 0 + var/hands_full = FALSE + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/housing as anything in housings) + if(housing.chrome_arm_deploy()) + out++ + else if(housing.chrome_arm_can_run() && !housing.chrome_arm_hand_free()) + hands_full = TRUE + if(!out) + bearer.balloon_alert(bearer, hands_full ? "hands full!" : "chrome offline!") + return out > 0 + +/// The first thing this arm hands out, while it is still stowed in it or out in a hand; null for arm chrome with nothing to hand out. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/chrome_arm_item() + for(var/datum/weakref/item_ref as anything in items_list) + var/obj/item/stowed = item_ref.resolve() + if(stowed) + return stowed + return null + +/// Whether this arm's item is out of the housing. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/chrome_arm_deployed() + // The toolkit sets active_item before it knows a hand was free, so "out" is "not in us". + return active_item && !(active_item in src) + +/// Whether the chrome runs and its own deploy button could be pressed. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/chrome_arm_can_run() + var/datum/component/cyberware/chrome = GetComponent(/datum/component/cyberware) + if(!owner || !chrome?.is_running()) + return FALSE + var/datum/action/toggle = locate(/datum/action/item_action/organ_action/toggle) in actions + return !toggle || toggle.IsAvailable() + +/// Whether the hand on this arm's side is empty. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/chrome_arm_hand_free() + return !!owner?.get_empty_held_index_for_side(zone == BODY_ZONE_R_ARM ? RIGHT_HANDS : LEFT_HANDS) + +/// Puts this arm's first item in its hand, if the chrome runs and the hand is empty. Returns whether it came out. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/chrome_arm_deploy() + if(chrome_arm_deployed() || !chrome_arm_can_run() || !chrome_arm_hand_free()) + return FALSE + var/obj/item/augment = chrome_arm_item() + if(!augment || !(augment in src)) + return FALSE + Extend(augment) + return chrome_arm_deployed() diff --git a/voidcrew/modules/cyberware/chrome_wheel_hud.dm b/voidcrew/modules/cyberware/chrome_wheel_hud.dm new file mode 100644 index 00000000000..d3273eda2e3 --- /dev/null +++ b/voidcrew/modules/cyberware/chrome_wheel_hud.dm @@ -0,0 +1,142 @@ +/** + * Screen objects for the chrome wheel (chrome_wheel.dm). + * + * Everything the player sees hangs off one hub at the centre of the view, in + * its vis_contents, on the above-HUD plane. None of it takes the mouse: a + * near-invisible full-view catcher sits under it and reports every move and + * click to the wheel, which works out the chip from the mouse position. + * Every piece opts out of clear_screen(), because a knockdown rebuilds the HUD + * mid-hold; the wheel takes its own pieces off the screen when it closes. + * + * Pieces keep the alpha and transform of whatever they hang off, so the hub's + * fade reaches everything and a chip's pop carries its brackets, shade and + * count with it. Each sets its own colour. + * + * Layers, bottom up: backdrop, body, body glow, arcs, leaders, nodes, empty + * sockets, chips (and their shade, count and brackets), readout. + */ +/atom/movable/screen/chrome_wheel + icon = CHROME_WHEEL_ICON + icon_state = null + plane = ABOVE_HUD_PLANE + layer = 3 + mouse_opacity = MOUSE_OPACITY_TRANSPARENT + vis_flags = VIS_INHERIT_PLANE + clear_with_screen = FALSE + appearance_flags = RESET_COLOR | NO_CLIENT_COLOR | PIXEL_SCALE + +/// The wheel's anchor at the centre of the view. Draws nothing itself. +/atom/movable/screen/chrome_wheel/hub + screen_loc = "CENTER" + +/** + * A piece of the 240x240 ring art (chrome_wheel_ring.dmi). The art is centred + * on the ring, which sits CHROME_WHEEL_CENTRE_Y above the middle of the view. + */ +/atom/movable/screen/chrome_wheel/art + icon = CHROME_WHEEL_RING_ICON + layer = 2.1 + pixel_x = -104 + pixel_y = -102 + +/// The soft dark backdrop. Stored at half size and drawn doubled, smoothly. +/atom/movable/screen/chrome_wheel/art/backdrop + icon_state = "scrim" + layer = 2 + appearance_flags = RESET_COLOR | NO_CLIENT_COLOR + +/atom/movable/screen/chrome_wheel/art/backdrop/Initialize(mapload, datum/hud/hud_owner) + . = ..() + transform = matrix(2, 0, 0, 0, 2, 0) + +/// The dim dashed outline of a socket with nothing in it. +/atom/movable/screen/chrome_wheel/empty_socket + icon_state = "socket" + layer = 2.5 + +/// One ability on the ring. +/atom/movable/screen/chrome_wheel/chip + icon_state = "frame_22" + /// The ability this chip fires. + var/datum/weakref/ability_ref + /// CHROME_WHEEL_SOCKET_* it sits in, and its position there, from 1. + var/socket + var/index = 1 + /// Which leader lights when it is pointed at: its socket's, or for hand + /// chrome its own run to the hand ("l_hand_2"). + var/leader_key + /// Which part of the body lights when it is pointed at. + var/region + /// Offset of its centre from the centre of the view, in pixels. + var/chip_x = 0 + var/chip_y = 0 + /// What the chip was last drawn as, so unchanged chips are left alone. + var/drawn_state + /// What its cooldown count last showed. + var/count_state + /// Size it was last drawn at: 22, or 26 while pointed at. + var/size = 22 + /// Cooldown wipe and its top edge, made the first time the chip cools down. + var/atom/movable/screen/chrome_wheel/chip_part/shade + var/atom/movable/screen/chrome_wheel/chip_part/shade_edge + /// Cooldown seconds. + var/atom/movable/screen/chrome_wheel/chip_part/count + /// The pick's corner brackets, made the first time this chip is picked. + var/list/brackets + +/atom/movable/screen/chrome_wheel/chip/Destroy() + vis_contents.Cut() + QDEL_NULL(shade) + QDEL_NULL(shade_edge) + QDEL_NULL(count) + QDEL_LIST(brackets) + ability_ref = null + return ..() + +/// Something drawn on a chip: the cooldown wipe, its edge or its count. +/atom/movable/screen/chrome_wheel/chip_part + icon_state = "px" + layer = 3.1 + +/// One corner of the lock brackets on the picked chip. +/atom/movable/screen/chrome_wheel/bracket + icon = CHROME_WHEEL_BRACKET_ICON + layer = 3.4 + color = CHROME_WHEEL_PICKED_COLOR + /// Which way is outward from the chip, for the snap in: -1 or 1 on each axis. + var/out_x = 0 + var/out_y = 0 + +/// A part of the readout panel under the ring: a flat block, or a line of text. +/atom/movable/screen/chrome_wheel/readout + icon_state = "px" + layer = 4 + +/** + * tg's cursor catcher (the scope's), lifted above the HUD so the mouse reaches + * the wheel wherever it is on the map. Its icon is white at alpha 1: invisible, + * but solid to the mouse. + */ +/atom/movable/screen/fullscreen/cursor_catcher/chrome_wheel + // overlay_fullscreen() appends a severity to the base state; nothing here goes + // through it, so name the state that exists. + icon_state = "fullscreen_blocker0" + plane = ABOVE_HUD_PLANE + layer = 1 + clear_with_screen = FALSE + /// The wheel to report to. + var/datum/component/chrome_wheel/wheel + +/atom/movable/screen/fullscreen/cursor_catcher/chrome_wheel/Destroy() + wheel = null + owner = null + return ..() + +/atom/movable/screen/fullscreen/cursor_catcher/chrome_wheel/MouseMove(location, control, params) + . = ..() + if(usr == owner) + wheel?.mouse_moved(params) + +/atom/movable/screen/fullscreen/cursor_catcher/chrome_wheel/Click(location, control, params) + if(usr == owner) + wheel?.mouse_clicked(params) diff --git a/voidcrew/modules/cyberware/chrome_wheel_keybindings.dm b/voidcrew/modules/cyberware/chrome_wheel_keybindings.dm new file mode 100644 index 00000000000..2578ebd6ab1 --- /dev/null +++ b/voidcrew/modules/cyberware/chrome_wheel_keybindings.dm @@ -0,0 +1,85 @@ +/** + * The chrome wheel's binds (chrome_wheel.dm). Defaults sit on V, the one free + * letter by the movement keys: hold V for the wheel, Shift+V fires the pick + * (beside tg's Shift+E/Q/B variants), Ctrl+V fires the OS and Alt+V deploys or + * stows all arm chrome (chrome_wheel_arms.dm). Alt alone is tg's "Block + * movement", held only for the moment the combo is down. All of them rebind in + * the keybind settings like any other. + */ +/datum/keybinding/living/chrome + +/datum/keybinding/living/chrome/can_use(client/user) + return iscarbon(user.mob) + +/// The bearer's wheel, or null with a "no chrome" balloon for a body without any. +/datum/keybinding/living/chrome/proc/get_wheel(client/user) + var/mob/living/carbon/bearer = user.mob + if(bearer.stat == DEAD) + return null + var/datum/component/chrome_wheel/wheel = get_chrome_wheel(bearer) + if(!wheel) + bearer.balloon_alert(bearer, "no chrome!") + return wheel + +/datum/keybinding/living/chrome/wheel + hotkey_keys = list("V") + name = CHROME_WHEEL_KEYBIND + full_name = "Chrome wheel" + description = "Hold to pick a chrome ability." + keybind_signal = COMSIG_KB_LIVING_CHROME_WHEEL_DOWN + +/datum/keybinding/living/chrome/wheel/down(client/user, turf/target) + . = ..() + if(.) + return + get_wheel(user)?.wheel_key_down() + return TRUE + +/datum/keybinding/living/chrome/wheel/up(client/user, turf/target) + . = ..() + if(.) + return + var/datum/component/chrome_wheel/wheel = user.mob.GetComponent(/datum/component/chrome_wheel) + wheel?.wheel_key_up() + +/datum/keybinding/living/chrome/use + hotkey_keys = list("ShiftV") + name = "use_chrome" + full_name = "Use chrome" + description = "Use the chrome ability picked on the wheel." + keybind_signal = COMSIG_KB_LIVING_USE_CHROME_DOWN + +/datum/keybinding/living/chrome/use/down(client/user, turf/target) + . = ..() + if(.) + return + get_wheel(user)?.use_selected() + return TRUE + +/datum/keybinding/living/chrome/use_os + hotkey_keys = list("CtrlV") + name = "use_os_chrome" + full_name = "Use OS chrome" + description = "Use your operating system chrome." + keybind_signal = COMSIG_KB_LIVING_USE_OS_CHROME_DOWN + +/datum/keybinding/living/chrome/use_os/down(client/user, turf/target) + . = ..() + if(.) + return + get_wheel(user)?.use_os() + return TRUE + +/datum/keybinding/living/chrome/deploy_arms + hotkey_keys = list("AltV") + name = "deploy_arm_chrome" + full_name = "Deploy arm chrome" + description = "Deploy or stow all your arm chrome." + keybind_signal = COMSIG_KB_LIVING_DEPLOY_ARM_CHROME_DOWN + +/datum/keybinding/living/chrome/deploy_arms/down(client/user, turf/target) + . = ..() + if(.) + return + get_wheel(user)?.use_arms() + return TRUE diff --git a/voidcrew/modules/cyberware/cyberware_base.dm b/voidcrew/modules/cyberware/cyberware_base.dm index c3c034580bc..0836cb99609 100644 --- a/voidcrew/modules/cyberware/cyberware_base.dm +++ b/voidcrew/modules/cyberware/cyberware_base.dm @@ -171,6 +171,10 @@ * Every optic on this base carries the chrome read (cyberware_scan.dm), the * diagnostic bus is what makes chrome eyes chrome eyes. Subtypes that add * their own ability must keep the read in their actions_types list. + * + * Every optic also zooms (cyberware_zoom.dm). That button is added in + * Initialize() whenever optics_zoom is above 0, so it never goes in + * actions_types. */ /obj/item/organ/eyes/robotic/cyberware name = "cyberware optics" @@ -192,6 +196,8 @@ /obj/item/organ/eyes/robotic/cyberware/Initialize(mapload) . = ..() AddComponent(/datum/component/cyberware, chrome_load, tier, chrome_capacity_bonus) + // Zoom rides every optic on this base (cyberware_zoom.dm). + setup_optics_zoom() /obj/item/organ/eyes/robotic/cyberware/Destroy() var/turf/drop_turf = get_turf(src) diff --git a/voidcrew/modules/cyberware/cyberware_zoom.dm b/voidcrew/modules/cyberware/cyberware_zoom.dm new file mode 100644 index 00000000000..1dff620378b --- /dev/null +++ b/voidcrew/modules/cyberware/cyberware_zoom.dm @@ -0,0 +1,244 @@ +/** + * # Optics zoom + * + * Every set of chrome optics (/obj/item/organ/eyes/robotic/cyberware and its + * subtypes) can zoom: one toggle button pans the bearer's camera toward the + * cursor, using tg's scope component (code/datums/components/scope.dm), the + * same one binoculars and rifle scopes use. How far it reaches is the optics' + * optics_zoom, passed straight through as the scope's range_modifier; better + * optics reach further, and the cheap ones slow their bearer while they look. + * + * The button rides the /datum/action/cooldown/cyberware bridge, so browned-out, + * EMP-scrambled or failing eyes can't zoom, and the chrome wheel collects it + * like any other chrome button. + * + * Zoom is look-only: + * - A zoomed bearer can't fire a gun (COMSIG_MOB_TRYING_TO_FIRE_GUN is refused, + * and a burst already under autofire stops when the zoom starts). + * - Their clicks on the zoomed view reach nothing on the map. The scope's + * fullscreen cursor catcher already eats them; check_click_intercept() below + * takes them before any click intercept or ClickOn() sees them. + * + * The zoom drops on its own when the eyes stop working or the bearer can't + * look: EMP, brownout or damage failure (chrome_passives_off()), the eyes + * coming out, blindness, a flash, a stun, knockdown or paralysis, any stat + * change (crit, sleep, death), and everything the scope already stops for + * (no client, climbing into a locker or a mech, the organ moving). + */ + +/obj/item/organ/eyes/robotic/cyberware + /// How far the zoom pans, as the scope's range_modifier: 1 reaches as far + /// again as the edge of the normal view, 2 twice that. 0 means no zoom. + var/optics_zoom = 1 + /// Slowdown while zoomed (a multiplicative_slowdown). 0 for none. + var/zoom_walk_penalty = 1 + /// Throttles the "can't aim" balloon, so autofire and click spam don't stack it. + COOLDOWN_DECLARE(zoom_aim_warning) + /// Throttles the iris tell, so flicking the zoom on and off can't flood chat. + COOLDOWN_DECLARE(zoom_tell) + +/// Gives these optics their zoom: the scope that does the panning, and the +/// button. Called from Initialize() on the optics base (cyberware_base.dm). +/obj/item/organ/eyes/robotic/cyberware/proc/setup_optics_zoom() + if(optics_zoom <= 0) + return + // ZOOM_METHOD_ITEM_ACTION with no item_action_type: the scope adds no button + // and no examine line of its own, and only zooms when we tell it to. + AddComponent(/datum/component/scope, range_modifier = optics_zoom, zoom_method = ZOOM_METHOD_ITEM_ACTION) + add_item_action(/datum/action/cooldown/cyberware/optics_zoom) + +/// Whether our bearer is looking through these optics' zoom right now. +/obj/item/organ/eyes/robotic/cyberware/proc/is_zoomed() + return owner && HAS_TRAIT_FROM(owner, TRAIT_CYBER_ZOOMED, REF(src)) + +/// Starts the zoom for our bearer. Returns TRUE if they are now zoomed. +/obj/item/organ/eyes/robotic/cyberware/proc/start_zoom() + var/mob/living/carbon/bearer = owner + if(!iscarbon(bearer) || is_zoomed()) + return FALSE + var/datum/component/cyberware/chrome = GetComponent(/datum/component/cyberware) + var/datum/component/scope/scope = GetComponent(/datum/component/scope) + if(!scope || !chrome?.is_running()) + return FALSE + if(bearer.is_blind()) + bearer.balloon_alert(bearer, "optics dark!") + return FALSE + if(!isturf(bearer.loc)) + bearer.balloon_alert(bearer, "can't see out!") + return FALSE + if(HAS_TRAIT(bearer, TRAIT_INCAPACITATED)) + return FALSE + // The scope refuses a clientless bearer and anyone already scoped (a rifle, + // binoculars), with its own balloon for the second. + if(!scope.zoom(bearer)) + return FALSE + engage_zoom(bearer) + return TRUE + +/** + * Our half of a zoom, once the scope is panning: the trait, the stop hooks, + * the gun block and the walk penalty. Split from start_zoom() because the scope + * needs a client, and a unit test has none. + */ +/obj/item/organ/eyes/robotic/cyberware/proc/engage_zoom(mob/living/carbon/bearer) + ADD_TRAIT(bearer, TRAIT_CYBER_ZOOMED, REF(src)) + // The scope stops itself for a few reasons of its own (no client, the bearer + // climbing into something); it drops TRAIT_USER_SCOPED when it does. + RegisterSignal(bearer, SIGNAL_REMOVETRAIT(TRAIT_USER_SCOPED), PROC_REF(on_scope_lost)) + RegisterSignal(bearer, COMSIG_MOB_TRYING_TO_FIRE_GUN, PROC_REF(on_zoomed_fire)) + RegisterSignal(bearer, COMSIG_MOB_STATCHANGE, PROC_REF(on_zoomed_stat_change)) + RegisterSignal(bearer, COMSIG_MOB_FLASHED, PROC_REF(on_zoomed_flashed)) + RegisterSignal(bearer, COMSIG_LIVING_STATUS_APPLIED, PROC_REF(on_zoomed_status)) + RegisterSignals(bearer, list(COMSIG_LIVING_STATUS_STUN, COMSIG_LIVING_STATUS_KNOCKDOWN, COMSIG_LIVING_STATUS_PARALYZE), PROC_REF(on_zoomed_stunned)) + if(zoom_walk_penalty) + bearer.add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/cyberware_zoom, multiplicative_slowdown = zoom_walk_penalty) + // Autofire fires through process_fire() and never asks the signal above, so + // a burst already rolling when the zoom starts is stopped here instead. + for(var/obj/item/gun/held in bearer.held_items) + var/datum/component/automatic_fire/autofire = held.GetComponent(/datum/component/automatic_fire) + autofire?.stop_autofiring() + // The tell, the chrome read's pattern: only people close enough see it. + if(COOLDOWN_FINISHED(src, zoom_tell)) + COOLDOWN_START(src, zoom_tell, 5 SECONDS) + bearer.visible_message(span_notice("[bearer]'s irises whir and narrow."), vision_distance = 3, ignored_mobs = bearer) + update_zoom_button() + +/// Stops the zoom, scope and all. Safe to call when nothing is zoomed. +/obj/item/organ/eyes/robotic/cyberware/proc/stop_zoom(mob/living/carbon/bearer) + if(!bearer) + return + var/datum/component/scope/scope = GetComponent(/datum/component/scope) + // Only ever stop OUR scope: the fullscreen it clears is shared by every scope. + if(scope?.tracker && HAS_TRAIT_FROM(bearer, TRAIT_USER_SCOPED, REF(scope))) + scope.stop_zooming(bearer) // drops TRAIT_USER_SCOPED, so on_scope_lost() runs + disengage_zoom(bearer) + +/// Undoes engage_zoom(). Idempotent: the passive hook calls it on every flip. +/obj/item/organ/eyes/robotic/cyberware/proc/disengage_zoom(mob/living/carbon/bearer) + if(!bearer) + return + REMOVE_TRAIT(bearer, TRAIT_CYBER_ZOOMED, REF(src)) + UnregisterSignal(bearer, list( + SIGNAL_REMOVETRAIT(TRAIT_USER_SCOPED), + COMSIG_MOB_TRYING_TO_FIRE_GUN, + COMSIG_MOB_STATCHANGE, + COMSIG_MOB_FLASHED, + COMSIG_LIVING_STATUS_APPLIED, + COMSIG_LIVING_STATUS_STUN, + COMSIG_LIVING_STATUS_KNOCKDOWN, + COMSIG_LIVING_STATUS_PARALYZE, + )) + bearer.remove_movespeed_modifier(/datum/movespeed_modifier/cyberware_zoom) + update_zoom_button() + +/// The zoom button shows green while zoomed (the cooldown action's active look). +/obj/item/organ/eyes/robotic/cyberware/proc/update_zoom_button() + for(var/datum/action/cooldown/cyberware/optics_zoom/zoom in actions) + zoom.build_all_button_icons(UPDATE_BUTTON_STATUS) + +/// One short balloon when a zoomed bearer tries to shoot. +/obj/item/organ/eyes/robotic/cyberware/proc/refuse_zoomed_aim(mob/living/carbon/bearer) + if(!COOLDOWN_FINISHED(src, zoom_aim_warning)) + return + COOLDOWN_START(src, zoom_aim_warning, 1 SECONDS) + bearer.balloon_alert(bearer, "too zoomed in to aim!") + +// ---- Stop hooks ---------------------------------------------------------- + +/obj/item/organ/eyes/robotic/cyberware/chrome_passives_off(mob/living/carbon/bearer) + . = ..() + // EMP reboot, brownout, damage failure and removal all come through here. + stop_zoom(bearer) + +/obj/item/organ/eyes/robotic/cyberware/on_mob_remove(mob/living/carbon/organ_owner, special = FALSE, movement_flags) + stop_zoom(organ_owner) + return ..() + +/// Signal proc for [SIGNAL_REMOVETRAIT] of TRAIT_USER_SCOPED: the scope stopped. +/obj/item/organ/eyes/robotic/cyberware/proc/on_scope_lost(mob/living/carbon/source) + SIGNAL_HANDLER + disengage_zoom(source) + +/// Signal proc for [COMSIG_MOB_TRYING_TO_FIRE_GUN]: no shooting through the zoom. +/obj/item/organ/eyes/robotic/cyberware/proc/on_zoomed_fire(mob/living/carbon/source, obj/item/gun/gun, atom/target, flag, params) + SIGNAL_HANDLER + refuse_zoomed_aim(source) + return COMPONENT_CANCEL_GUN_FIRE + +/// Signal proc for [COMSIG_MOB_STATCHANGE]: crit, sleep and death end the zoom. +/obj/item/organ/eyes/robotic/cyberware/proc/on_zoomed_stat_change(mob/living/carbon/source, new_stat, old_stat) + SIGNAL_HANDLER + if(new_stat != CONSCIOUS) + stop_zoom(source) + +/// Signal proc for [COMSIG_MOB_FLASHED]. +/obj/item/organ/eyes/robotic/cyberware/proc/on_zoomed_flashed(mob/living/carbon/source) + SIGNAL_HANDLER + stop_zoom(source) + +/// Signal proc for [COMSIG_LIVING_STATUS_APPLIED]: going blind ends the zoom. +/obj/item/organ/eyes/robotic/cyberware/proc/on_zoomed_status(mob/living/carbon/source, datum/status_effect/effect) + SIGNAL_HANDLER + if(istype(effect, /datum/status_effect/grouped/blindness)) + stop_zoom(source) + +/// Signal proc for stun, knockdown and paralysis. Mirrors the scope's own check. +/obj/item/organ/eyes/robotic/cyberware/proc/on_zoomed_stunned(mob/living/carbon/source, amount = 0, ignore_canstun = FALSE) + SIGNAL_HANDLER + if(amount > 0) + stop_zoom(source) + +// ---- Clicking through the zoom ------------------------------------------- + +/** + * A click on the zoomed view, swallowed. Returns FALSE only for a click that + * isn't on our zoom, which the caller then handles as normal. + */ +/obj/item/organ/eyes/robotic/cyberware/proc/zoom_click(mob/living/carbon/bearer, atom/movable/screen/fullscreen/cursor_catcher/scope/tracker) + var/datum/component/scope/scope = GetComponent(/datum/component/scope) + if(!is_zoomed() || !scope || scope.tracker != tracker) + return FALSE + if(isgun(bearer.get_active_held_item())) + refuse_zoomed_aim(bearer) + return TRUE + +/** + * Zoomed clicks go to zoom_click() before the client's and the mob's click + * intercepts, so an armed ability never receives the scope's screen object as + * its target. The trait check keeps this to one lookup for everyone else. + */ +/mob/living/carbon/check_click_intercept(params, atom/A) + if(HAS_TRAIT(src, TRAIT_CYBER_ZOOMED) && istype(A, /atom/movable/screen/fullscreen/cursor_catcher/scope)) + var/obj/item/organ/eyes/robotic/cyberware/optics = get_organ_slot(ORGAN_SLOT_EYES) + if(istype(optics) && optics.zoom_click(src, A)) + return TRUE + return ..() + +// ---- The button ----------------------------------------------------------- + +/datum/action/cooldown/cyberware/optics_zoom + name = "Optic Zoom" + desc = "Focus your optics on something far off." + // tg's binoculars: reads as "look far", and stays clear of the Deadeye's crosshair. + button_icon = 'icons/obj/devices/tool.dmi' + button_icon_state = "binoculars" + +/datum/action/cooldown/cyberware/optics_zoom/chrome_wheel_name() + return "Zoom" + +/datum/action/cooldown/cyberware/optics_zoom/Activate(atom/target) + var/obj/item/organ/eyes/robotic/cyberware/optics = organ + if(!istype(optics) || !optics.owner) + return FALSE + if(optics.is_zoomed()) + optics.stop_zoom(optics.owner) + return TRUE + return optics.start_zoom() + +/datum/action/cooldown/cyberware/optics_zoom/is_action_active(atom/movable/screen/movable/action_button/current_button) + var/obj/item/organ/eyes/robotic/cyberware/optics = organ + return istype(optics) && optics.is_zoomed() + +/// The walk tax on cheap optics while they're zoomed. Strength set per optics. +/datum/movespeed_modifier/cyberware_zoom + variable = TRUE diff --git a/voidcrew/modules/cyberware/icons/chrome_hud.dmi b/voidcrew/modules/cyberware/icons/chrome_hud.dmi new file mode 100644 index 0000000000000000000000000000000000000000..2b65076978cf4ee3367344382e7d55b25f9b6960 GIT binary patch literal 761 zcmVV=-0C=2JR&a84_w-Y6@%7{?OD!tS%+FJ>RWQ*r;NmRLOex6#a*U0*I5Sc+ z(=$pSoZ^zil2jm5DLJDkKQ~p0i!&v&s2C_<$iQlzZl>gNKs z8~_@*B-+K3+5!Lo0zyedK~#90#4rqQqYgX-I#$?jga_!t!pcjq@(`@N1S>*f zxd(ue4dxRM!3N4n2A}1>q|Q;PpVU(>iJkg$?6hvzEgZcy;plYzjsK4ikLvu*_0``0 zua7r#joA}08b)hmv><>w1yHlrP_jS`u&xL)K;Q9dwb%c--R{Op*GSR=wO;1{x}u1s z#!G!3^p^1u(_9~gS8mEq$oD82n|DE}{+=r5JkJ?S7va1s>1ss)kWiw3z>2krmcbrE z@Yq~Vhh)V)=Y5#}{Q9!HaGxa`oe#JWs7ivPVm#+9Fr2mlAfu5`f=n2YW*J&SZn6@a zw6!nKFMj)=ZH0xkmSuR3eYiN_F)XK{=Wbjw0&jf|nTV2HpydH9S9`?aog%F@lpa-* z@lt|=HkW6f)+eeiE>zxcZ&aDHyZgVkW5*@WqFz|!OntbrjQ7q_30N9Zw{RryM4XiH z383}WqQx_Uq%%duxE24UXz?=UejSz`S2ZtdV=X)yh2&){lL42cOdF5%XgC2I;hc={ zoTQ`VX|N^If5)H)nXD4RO6DhP!jxSw=h%0>42=Q1!261Q2+}y+L;lH$D-Y%y<8GKM zY)V<*GQd+7YmqRsPLB8l4eo|;U5^$r@TtJP@W6aeIZeZqWa*Jjk`Pzaq(tD0j$>J> zb57{BEgZEKvEi2Yxxy^Sd+P#F2jKM3^%E7wTROsHIOb~#p$88EKm-Z3-vJ`NFH#xF rj((0GN4eUf^*w<5HsGyMc1y+&fM%t~Nv#ya00000NkvXXu0mjfw#H=e literal 0 HcmV?d00001 diff --git a/voidcrew/modules/cyberware/icons/chrome_wheel.dmi b/voidcrew/modules/cyberware/icons/chrome_wheel.dmi new file mode 100644 index 0000000000000000000000000000000000000000..a75f826549daa77a992bee93a46b04fcc83d6832 GIT binary patch literal 1000 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSyQ@MXN?cNllZ!G7N;32F7#J$% z%$;i4~ud6xy2qFs&?E%FC^~CGcmpwv0(&@E0@V%Gomyx8=;2 z+cZb@cu(8{bFb|=#~(fInzULd%xZI|#>53$nd-?p+aIJ9ysKn(6=9viaaCG;t)}E* z&;5-@IYXoCkHvN}JUP6$R&f6vts|DQOjcKzJLJFRq&NTP|6Xp>{yXwy;Q5C=df6M| z*6jW%7<$dM)meT2LPhV-DSzf$H~B2d&tL7w!N9=u!qdeuq+-t7yS71(4J3{g&Q8?O z)VO>pAfT8f=uH7*e6x&ljIwxw#v#EK+i#>rpVHm7q;e)hn$f{yViT8!SN_}I#v-hp zY(Gu3cETzqU=YpOmESxw@=DXIUE6i~pPKs$Z~b#MOEjcTtMvXse%l0Rr*AWN|5=u) z^No}H?(>r`Zx)~V6#wu4?9#vgG}06`_!$M<8IA}t6tXzT5XUss450~SP5xTB-@4Z( zul2g;%AfuqAwX_pn5ww-w!+WPe_sE4^v%NBJwJDz|NQOax?7pN2KTE&i@s|;Esf_* zNSpR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ewx;>gwJk)o4;*k#ALcf3e z!=ROGZ?uJl5@!hDB1$`vFAlAC1(|}F`A5a6zjG%7Lvx+4ld5?DOwa}y}+ukHS z7=%}I=e<1DNzhjycg}AZK-Yyhf3Tj{&+q-d#~rbY@;cB1&E3k|zC}UlugJU$-bP>~ zUo@u4$q*El`Xk3=dp4YJA3Hb@WB*J#|2E2PxvFOb+$%?+hLTBeYJN6u5t^SBd;=j+ z2`U*&IOIjQ4Az3KMR03CK@}#K4}j!>Y1^S)hDqTSy8^|KN=s-x<<@ijP-P6X-n7GJ zoPP;tcdFy}45wU&{kO_y<381hs|T#w_5ZlvN<|XrEgNnI?4!dfz`LW*ZvfNZvzoLJwA38#%9+XfwcnCzkDI=a=E|;83Ammp+!TT!tS3Z;hZGY zQVbq1CEdqEGo0wJ?b7)nqLeJK6p!ebks@DGxCa*bJ!6+UUT~Y$x+Qu}Lg=WTe*o9Y zol*Rj8NXgiz7*-bVD0Yqj=Jc9K;&_(XR*H{0Eb^%pS=*(ngO8=^^Z?edQQB$2H8x1 z)7>{R#PS@s;1KEr6!?f!Q#Of7{>mt$E<1u-1g6dAmCe9ggMi$oSQwR0AQCEJj-PS} z0cU83xx=T<_a-jLjzzf!F=jcKQB>A!-mMXYk world.time) + launched = TRUE + click_wrapper(body, victim) + if(launched) + sleep(3 SECONDS) + var/harm = victim.getBruteLoss() + victim.getFireLoss() + victim.getToxLoss() + victim.getOxyLoss() + victim.getStaminaLoss() + var/knocked = victim.IsKnockdown() || victim.IsParalyzed() || victim.IsStun() + if(harm > 0 || knocked) + cell(ware_type, "FAIL: hurt someone while a pacifist ([harm] damage[knocked ? ", knocked down" : ""])") + TEST_FAIL("[ware_type]: a pacifist hurt a bystander with it ([harm] damage[knocked ? ", knocked down" : ""])") + else + cell(ware_type, "ok") + qdel(victim) + qdel(body) + +/// Moving and striking buttons refuse a body that is stunned, paralysed, immobilised or +/// riding a mech, and still work for a healthy one. Only the buttons that carry the bearer +/// across the floor or into a blow are walked: the rest are covered by the other columns. +/datum/unit_test/voidcrew_cyberware_matrix/incapacitated + column = "stunned/mech" + +/datum/unit_test/voidcrew_cyberware_matrix/incapacitated/Run() + var/static/list/movers = list( + /datum/action/cooldown/cyberware/hopper_leap, + /datum/action/cooldown/cyberware/piledriver_leap, + /datum/action/cooldown/cyberware/mantis_lunge, + /datum/action/cooldown/cyberware/skyhook, + ) + for(var/ware_type in voidcrew_cyberware_pool()) + var/list/wares = list() + var/mob/living/carbon/human/body = fit(ware_type, wares) + if(!body) + continue + var/obj/item/organ/ware = wares[1] + var/list/walked = list() + for(var/datum/action/cooldown/cyberware/ability as anything in buttons(ware)) + for(var/mover_type in movers) + if(istype(ability, mover_type)) + walked += ability + if(!length(walked)) + qdel(body) + continue + var/turf/start = get_turf(body) + var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human/consistent, locate(start.x, start.y + 2, start.z)) + var/obj/item/arm_thing = arm_item(ware) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/arm_ware = ware + var/turf/landing = locate(start.x + 3, start.y, start.z) + var/turf/far_wall = locate(start.x, start.y + 5, start.z) + for(var/datum/action/cooldown/cyberware/ability as anything in walked) + var/list/results = list() + for(var/condition in list("healthy", "stunned", "paralyzed", "immobilized", "cuffed", "in a mech")) + body.forceMove(start) + body.SetStun(0) + body.SetParalyzed(0) + body.SetImmobilized(0) + body.set_handcuffed(null) + // The blade comes out while the body is still well. + if(arm_thing && !arm_ware.active_item) + arm_ware.Extend(arm_thing) + var/obj/vehicle/sealed/mecha/ripley/mech + switch(condition) + if("stunned") + body.Stun(30 SECONDS) + if("paralyzed") + body.Paralyze(30 SECONDS) + if("immobilized") + body.Immobilize(30 SECONDS) + if("cuffed") + body.set_handcuffed(new /obj/item/restraints/handcuffs(body)) + if("in a mech") + mech = new /obj/vehicle/sealed/mecha/ripley(start) + mech.mob_enter(body, silent = TRUE) + ability.next_use_time = 0 + ability.Trigger(body, NONE, victim) + var/fired = ability.next_use_time > world.time + if(!fired) + ability.next_use_time = 0 + ability.Trigger(body, NONE, landing) + fired = ability.next_use_time > world.time + if(!fired) + // The winch wants a wall: the far side of the room. + ability.next_use_time = 0 + ability.Trigger(body, NONE, far_wall) + fired = ability.next_use_time > world.time + results[condition] = fired + if(fired) + sleep(2 SECONDS) + if(mech) + mech.mob_exit(body, silent = TRUE) + qdel(mech) + body.SetStun(0) + body.SetParalyzed(0) + body.SetImmobilized(0) + body.set_handcuffed(null) + var/list/line = list() + for(var/condition in results) + line += "[condition] [results[condition] ? "fires" : "refuses"]" + if(!results["healthy"]) + // The fixture could not aim it; say so rather than pass quietly. + cell("[ware_type] / [ability.type]", "inconclusive, did not fire for a healthy body") + continue + cell("[ware_type] / [ability.type]", english_list(line)) + for(var/condition in list("stunned", "paralyzed", "immobilized", "in a mech")) + if(results[condition]) + TEST_FAIL("[ware_type] / [ability.type] fired for a body that is [condition]") + qdel(victim) + qdel(body) + +/// A button aimed at its own bearer. Click abilities get clicked on yourself, and every one has +/// to take it without a runtime and without leaving the bearer worse for it than a refusal +/// would. (The Angler's barb used to run a line from the bearer to the bearer.) +/datum/unit_test/voidcrew_cyberware_matrix/self_click + column = "self click" + +/datum/unit_test/voidcrew_cyberware_matrix/self_click/Run() + for(var/ware_type in voidcrew_cyberware_pool()) + var/list/wares = list() + var/mob/living/carbon/human/body = fit(ware_type, wares) + if(!body) + continue + var/obj/item/organ/ware = wares[1] + var/obj/item/arm_thing = arm_item(ware) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/arm_ware = ware + if(arm_thing) + arm_ware.Extend(arm_thing) + var/turf/before = get_turf(body) + for(var/datum/action/cooldown/cyberware/ability as anything in buttons(ware)) + ability.Trigger(body, NONE, body) + // Whatever it did, it did not carry the bearer off or take the bearer apart. + TEST_ASSERT(!QDELETED(body) && body.stat != DEAD, "[ware_type] / [ability.type] aimed at its own bearer killed or deleted them") + if(ware_type in list(/obj/item/organ/cyberimp/arm/toolkit/cyberware/angler)) + TEST_ASSERT_EQUAL(get_turf(body), before, "The Angler's barb moved a bearer who fired it at themselves") + cell(ware_type, "self click: ok") + sleep(1) + qdel(body) + +/// Taking a ware out, either way, leaves nothing of it listening to the body it left. +/datum/unit_test/voidcrew_cyberware_matrix/listeners + column = "removal" + +/datum/unit_test/voidcrew_cyberware_matrix/listeners/Run() + var/list/bare_state = voidcrew_cyberware_passive_state(allocate(/mob/living/carbon/human/consistent)) + for(var/ware_type in voidcrew_cyberware_pool()) + for(var/quick in list(FALSE, TRUE)) + var/list/wares = list() + var/mob/living/carbon/human/body = fit(ware_type, wares) + if(!body) + if(!quick) + cell(ware_type, "no home on a plain body") + continue + var/obj/item/organ/ware = wares[1] + var/obj/item/arm_thing = arm_item(ware) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/arm_ware = ware + if(arm_thing) + arm_ware.Extend(arm_thing) + for(var/datum/action/cooldown/cyberware/ability as anything in buttons(ware)) + ability.Trigger(body, NONE, body) + var/list/problems = list() + ware.Remove(body, special = quick) + var/list/stale = voidcrew_cyberware_stale_listeners(body) + if(length(stale)) + problems += "left listening to the body it was pulled from: [english_list(stale)]" + if(length(voidcrew_cyberware_held_traits(body, ware))) + problems += "left traits on the body it was pulled from" + if(length(body.actions)) + problems += "left [length(body.actions)] buttons on the body it was pulled from" + if(arm_thing && arm_ware.active_item) + problems += "still holds its deployed weapon after removal" + if(body.click_intercept) + problems += "left a targeting mode on the body it was pulled from" + var/list/leaks = voidcrew_cyberware_state_diff(bare_state, voidcrew_cyberware_passive_state(body)) + if(length(leaks)) + problems += "left the body changed: [english_list(leaks)]" + cell(ware_type, "[quick ? "quick" : "normal"] removal: [length(problems) ? "FAIL: [problems[1]]" : "ok"]") + if(length(problems)) + TEST_FAIL("[ware_type] ([quick ? "quick" : "normal"] removal): [english_list(problems)]") + qdel(ware) + qdel(body) + +/// Ship saves: a hull checkpoint rebuilds machinery and structures and wipes every loose item, +/// so chrome lying about on a ship is cleared like any other stock and bodies are never +/// kept. The one fitting is the cradle, which a saved ship must never rebuild. +/datum/unit_test/voidcrew_cyberware_matrix/ship_save + column = "ship save" + +/datum/unit_test/voidcrew_cyberware_matrix/ship_save/Run() + var/obj/machinery/chrome_cradle/cradle = allocate(/obj/machinery/chrome_cradle) + TEST_ASSERT(!outpost_checkpoint_saves(cradle), "A ship checkpoint would keep a chrome cradle") + TEST_ASSERT_NULL(cradle.checkpoint_type(), "A chrome cradle has a type to be rebuilt as") + cell("/obj/machinery/chrome_cradle", "not saved by a checkpoint") + // Every chrome organ is a plain item, which the clear-out takes, and none of them is a + // machine or a structure that the checkpoint would keep as a fitting. + for(var/ware_type in voidcrew_cyberware_pool()) + TEST_ASSERT(ispath(ware_type, /obj/item/organ), "[ware_type] is not an organ item") + TEST_ASSERT(!ispath(ware_type, /obj/machinery) && !ispath(ware_type, /obj/structure), "[ware_type] is a machine or structure") + cell("every ware", "organ items: cleared with the loose stock, never kept") + +/// The camo weave's own columns: what ends it. +/datum/unit_test/voidcrew_cyberware_matrix/camo + column = "camo" + +/datum/unit_test/voidcrew_cyberware_matrix/camo/Run() + var/obj/item/organ/cyberimp/cyberware/ghostskin/weave + for(var/weave_type in list(/obj/item/organ/cyberimp/cyberware/ghostskin, /obj/item/organ/cyberimp/cyberware/ghostskin/street)) + for(var/condition in list("emp", "brownout", "death", "stun", "paralyze", "cuffs", "mech", "zoom", "gib")) + var/mob/living/carbon/human/body = allocate(/mob/living/carbon/human/consistent) + weave = allocate(weave_type) + weave.Insert(body, special = TRUE) + weave.engage_camo(body) + var/engaged = HAS_TRAIT(body, MATRIX_TRAIT_CAMO) + var/obj/vehicle/sealed/mecha/ripley/mech + switch(condition) + if("emp") + body.emp_act(EMP_HEAVY) + if("brownout") + var/obj/item/organ/cyberimp/cyberware/matrix_ballast/ballast = allocate(/obj/item/organ/cyberimp/cyberware/matrix_ballast) + ballast.Insert(body, special = TRUE) + if("death") + body.death() + if("stun") + body.Stun(5 SECONDS) + if("paralyze") + body.Paralyze(5 SECONDS) + if("cuffs") + body.set_handcuffed(new /obj/item/restraints/handcuffs(body)) + if("mech") + mech = new /obj/vehicle/sealed/mecha/ripley(get_turf(body)) + mech.mob_enter(body, silent = TRUE) + if("zoom") + var/obj/item/organ/eyes/robotic/cyberware/spyglass/eyes = allocate(/obj/item/organ/eyes/robotic/cyberware/spyglass) + eyes.Insert(body, special = TRUE) + eyes.engage_zoom(body) + if("gib") + body.gib() + var/still = HAS_TRAIT(body, MATRIX_TRAIT_CAMO) + cell("[weave_type]", "[condition]: camo [engaged ? "was on" : "never came on"], then [still ? "stayed on" : "dropped"]") + if(weave_type == /obj/item/organ/cyberimp/cyberware/ghostskin) + TEST_ASSERT(engaged, "Ghostskin would not engage on a healthy body") + // Hard stops: a dark weave, a dead wearer, a stripped body. + if(condition in list("emp", "brownout", "death", "gib")) + TEST_ASSERT(!still, "Ghostskin stayed engaged through [condition]") + else + TEST_ASSERT(!engaged, "the street weave grants camo it should not") + if(mech) + mech.mob_exit(body, silent = TRUE) + qdel(mech) + qdel(body) + qdel(weave) + +/// Doing harm from inside the field drops it, whichever ware does the harm: a punch from a +/// fist that skips the ordinary attack chain, a lunge, a landing. +/datum/unit_test/voidcrew_cyberware_matrix/camo_harm + column = "camo (harm)" + +/datum/unit_test/voidcrew_cyberware_matrix/camo_harm/Run() + for(var/ware_type in list( + /obj/item/organ/cyberimp/cyberware/gorilla_arms, + /obj/item/organ/cyberimp/cyberware/gorilla_arms/street, + /obj/item/organ/cyberimp/cyberware/scrapper, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis, + /obj/item/organ/cyberimp/cyberware/piledriver, + )) + var/mob/living/carbon/human/body = allocate(/mob/living/carbon/human/consistent) + var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human/consistent, get_step(body, EAST)) + var/obj/item/organ/cyberimp/cyberware/ghostskin/weave = allocate(/obj/item/organ/cyberimp/cyberware/ghostskin) + weave.Insert(body, special = TRUE) + var/obj/item/organ/ware = allocate(ware_type) + TEST_ASSERT(ware.Insert(body, special = TRUE), "[ware_type] would not install beside the weave") + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/arm_ware = ware + if(istype(arm_ware)) + var/obj/item/blade = locate(/obj/item) in arm_ware.contents + arm_ware.Extend(blade) + body.set_combat_mode(TRUE) + body.face_atom(victim) + weave.engage_camo(body) + TEST_ASSERT(HAS_TRAIT(body, MATRIX_TRAIT_CAMO), "Ghostskin would not engage for [ware_type]") + if(ispath(ware_type, /obj/item/organ/cyberimp/cyberware/piledriver) || istype(arm_ware)) + for(var/datum/action/cooldown/cyberware/ability as anything in buttons(ware)) + ability.Trigger(body, NONE, victim) + else + click_wrapper(body, victim) + var/dropped = !HAS_TRAIT(body, MATRIX_TRAIT_CAMO) + cell("[ware_type]", "camo [dropped ? "dropped" : "stayed up"] when it hurt someone") + if(!dropped) + TEST_FAIL("[ware_type]: the field stayed up while the bearer attacked") + if(ispath(ware_type, /obj/item/organ/cyberimp/cyberware/piledriver) || istype(arm_ware)) + sleep(3 SECONDS) + qdel(body) + qdel(victim) + +#undef MATRIX_TRAIT_CAMO +#undef MATRIX_TRAIT_ZOOMED +#undef MATRIX_SLOT_SKIN diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware_soak.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware_soak.dm new file mode 100644 index 00000000000..4fa57d641bb --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware_soak.dm @@ -0,0 +1,935 @@ +/** + * # Chrome soak + * + * A long, loud, mostly random test for the cyberware module (voidcrew/modules/cyberware/). + * Ten humans get random chrome loadouts and are then put through five minutes of game time of + * everything players and the world do to chrome: every installed ability triggered (with real + * targets, so click abilities fire), EMPs on bodies and on single pieces, forced brownouts, + * cradle installs, removals and tune-ups, sell-backs at the ripperdoc ledgers, death and + * revival, gibbing and dusting (chrome salvage), lost limbs, stuns, cuffs, pacifism, zoom, + * a ride in a mech, speech. A sweep every two seconds checks that the ware's own bookkeeping + * stays consistent. At the end the survivors are healed, stripped of chrome, left alone and + * compared against a snapshot taken before they got any, and everything the soak made is + * deleted and checked for being garbage collected. + * + * It is a SOAK, not a regression test: it fails on any runtime (the error handler fails + * whichever test is running, see docs/UNIT_TESTING_LOCAL.md), on any inconsistency the sweep + * finds, and on anything left behind. It is also slow, so it extends voidcrew_opt_in and is + * left out of a general run. Run it on its own: + * + * dd.exe tgstation.dmb -port -close -trusted -invisible \ + * -params "log-directory=ci&test_only=/datum/unit_test/voidcrew_opt_in/cyberware_soak" + * + * Optional world params: soak_length (deciseconds of storm, default 3000) and soak_seed + * (a number, to repeat a roll of the dice). The report is also written to data/soak_report.txt. + * + * Unit-test files compile before voidcrew/_DEFINES/, so the fork defines this file needs are + * restated below under SOAK_ names. + */ + +/// ORGAN_SLOT_CYBERWARE_SKIN, the Ghostskin slot. +#define SOAK_SLOT_SKIN "cyberware_skin" +/// TRAIT_CYBER_CAMO and TRAIT_CYBER_ZOOMED. +#define SOAK_TRAIT_CAMO "cyber_camo" +#define SOAK_TRAIT_ZOOMED "cyber_zoomed" +/// CYBERWARE_INSTALL_TIME, CYBERWARE_REMOVAL_TIME, CYBERWARE_EMP_DOWNTIME and CYBERWARE_TUNEUP_FEE. +#define SOAK_INSTALL_TIME (4 SECONDS) +#define SOAK_REMOVAL_TIME (3 SECONDS) +#define SOAK_EMP_DOWNTIME (9 SECONDS) +#define SOAK_TUNEUP_FEE 200 +/// How long an inconsistency must hold before the sweep calls it a bug. SSmobs ticks every +/// two seconds and the ware's per-tick settle runs on it, so anything shorter is a race. +#define SOAK_PATIENCE (6 SECONDS) + +/// Ballast for forcing a brownout: far over any body's capacity, in a slot nothing else uses, +/// with no ability of its own. +/obj/item/organ/cyberimp/cyberware/soak_ballast + name = "soak ballast" + zone = BODY_ZONE_CHEST + slot = "voidcrew_soak_ballast" + chrome_load = 25 + +/datum/unit_test/voidcrew_opt_in/cyberware_soak + priority = TEST_LONGER + /// Game time the storm runs for. + var/storm_length = 3000 + /// Bodies kept in play. + var/crew_size = 10 + /// FALSE once the storm is over, so late async events stand down. + var/storming = FALSE + /// Live bodies. + var/list/crew = list() + /// Body -> its snapshot from before it had any chrome. + var/list/baselines = list() + /// Chrome that came off a body or out of a gib and lies about, for the cradle to reinstall. + var/list/loose_chrome = list() + /// Weakrefs to everything this test made that must be collected at the end. + var/list/made = list() + /// Every installable chrome typepath. + var/list/ware_pool = list() + /// Floor turfs in the room. + var/list/floor_turfs = list() + /// Splice's ledgers (the street doc's are the same entries with other words). + var/list/ledgers = list() + /// Problem category -> how many times it was seen. + var/list/problem_counts = list() + /// Problem category -> the first example. + var/list/problem_examples = list() + /// Counters for the report. + var/list/stats = list() + /// Sweep keys seen in this sweep. + var/list/seen_now = list() + /// Sweep key -> world.time it was first seen. + var/list/suspects = list() + /// Sweep keys already reported. + var/list/reported = list() + var/obj/machinery/chrome_cradle/cradle + /// The cradle is single-use at a time; this is the world.time its current user lets go. + var/cradle_lease = 0 + var/mech_lease = 0 + var/next_index = 0 + var/runtimes_at_start = 0 + var/skipped_runtimes_at_start = 0 + var/timers_at_start = 0 + /// SSgarbage failure and hard-delete counts per type before the storm. + var/list/gc_before = list() + +// ---- Bookkeeping --------------------------------------------------------- + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/note(category, detail) + problem_counts[category] = (problem_counts[category] || 0) + 1 + if(!problem_examples[category]) + problem_examples[category] = detail + log_world("SOAK PROBLEM: [category]: [detail]") + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/count(what, amount = 1) + stats[what] = (stats[what] || 0) + amount + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/track(datum/thing) + made += WEAKREF(thing) + return thing + +/// A sweep finding that only counts once it has held for `patience`. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/suspect(key, category, detail, patience = SOAK_PATIENCE) + seen_now[key] = TRUE + if(!suspects[key]) + suspects[key] = world.time + return + if(world.time - suspects[key] >= patience && !reported[key]) + reported[key] = TRUE + note(category, detail) + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/rng_seed() + var/seed = text2num(world.params["soak_seed"]) + if(isnull(seed)) + seed = rand(1, 999999) + rand_seed(seed) + log_world("SOAK seed [seed]") + return seed + +// ---- Setup --------------------------------------------------------------- + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/build_pool() + ware_pool = voidcrew_cyberware_pool().Copy() + TEST_ASSERT(length(ware_pool) > 40, "The chrome pool is only [length(ware_pool)] types, the walk of the subtypes found too little") + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/build_room() + var/turf/low = run_loc_floor_bottom_left + var/turf/high = run_loc_floor_top_right + for(var/x in min(low.x, high.x) to max(low.x, high.x)) + for(var/y in min(low.y, high.y) to max(low.y, high.y)) + var/turf/candidate = locate(x, y, low.z) + // The cradle's tile lifts whoever stands on it, which would be part of a snapshot. + if(isfloorturf(candidate) && candidate != run_loc_floor_top_right) + floor_turfs += candidate + TEST_ASSERT(length(floor_turfs) >= 12, "The test room only has [length(floor_turfs)] floor tiles") + +/// A fresh body. It stands bare for a few seconds first, so the snapshot it is later compared +/// with already has the modifiers every body picks up on its own (mood, for one). +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/spawn_body() + next_index++ + var/index = next_index + var/mob/living/carbon/human/body = new /mob/living/carbon/human/consistent(pick(floor_turfs)) + track(body) + body.fully_replace_character_name(body.real_name, "Soak [index]") + var/obj/item/card/id/id = new(body) + id.registered_account = allocate(/datum/bank_account, "Soak [index]", null, 1, FALSE) + id.registered_account.account_balance = 50000 + body.equip_to_slot_or_del(id, ITEM_SLOT_ID) + body.equip_to_slot_or_del(new /obj/item/clothing/under/color/grey(body), ITEM_SLOT_ICLOTHING) + sleep(6 SECONDS) + if(QDELETED(body) || !storming) + return body + baselines[body] = snapshot(body) + crew += body + random_loadout(body) + return body + +/// A random set of chrome in a random body. Most bodies fit their load; some are loaded +/// past capacity on purpose and start browned out. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/random_loadout(mob/living/carbon/human/body) + var/overshoot = prob(25) ? rand(1, 8) : 0 + var/pieces = rand(2, 7) + var/list/candidates = shuffle(ware_pool.Copy()) + for(var/ware_type in candidates) + if(pieces <= 0) + break + var/obj/item/organ/ware = track(new ware_type(get_turf(body))) + if(!body.get_bodypart(deprecise_zone(ware.zone))) + qdel(ware) + continue + var/datum/component/cyberware/chrome = ware.GetComponent(/datum/component/cyberware) + var/list/incumbents = ware.cyberware_get_incumbents(body) + // Keep most loadouts free of evictions, they are not what is being tested here. + if(length(incumbents) && prob(85)) + qdel(ware) + continue + var/projected = get_chrome_load(body) + (chrome?.chrome_load || 0) + for(var/obj/item/organ/incumbent in incumbents) + projected -= get_installed_capacity_cost(incumbent) + if(projected > get_chrome_capacity(body) + (chrome?.capacity_bonus || 0) + overshoot) + qdel(ware) + continue + if(!ware.Insert(body, special = TRUE)) + qdel(ware) + continue + pieces-- + count("pieces installed") + +/// Everything that should be back to normal once a body has no chrome and has been left alone. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/snapshot(mob/living/carbon/human/body) + var/list/snap = list() + snap["filters"] = length(body.filters) + snap["actions"] = length(body.actions) + // tg's eyelids join the body's vis_contents whenever eyes are drawn, and stay there after + // the eyes leave, so chrome optics going in and out would read as a leak. Not chrome's. + var/visible = 0 + for(var/atom/movable/thing as anything in body.vis_contents) + if(!istype(thing, /obj/effect/abstract/eyelid_effect)) + visible++ + snap["vis_contents"] = visible + var/list/statuses = list() + for(var/datum/status_effect/effect as anything in body.status_effects) + statuses += "[effect.type]" + snap["status effects"] = statuses + var/list/traits = list() + for(var/trait in body._status_traits) + traits[trait] = length(body._status_traits[trait]) + snap["traits"] = traits + var/list/speed = list() + for(var/modifier in body.movespeed_modification) + speed += "[modifier]" + snap["movespeed"] = speed + var/list/action_speed = list() + for(var/modifier in body.actionspeed_modification) + // Mood's own modifier arrives on its own schedule. + if(!findtext("[modifier]", "sanity_component")) + action_speed += "[modifier]" + snap["actionspeed"] = action_speed + var/list/physiology = list() + for(var/var_name in body.physiology.vars) + // The reference finder stamps every datum it walks after a failed GC. + if(var_name == "last_find_references") + continue + var/value = body.physiology.vars[var_name] + if(isnum(value)) + physiology[var_name] = value + for(var/rating in ARMOR_LIST_ALL()) + physiology["armor [rating]"] = body.physiology.armor.get_rating(rating) + snap["physiology"] = physiology + var/list/components = list() + for(var/component_type in body._datum_components) + components += "[component_type]" + snap["components"] = components + var/list/loose = list() + for(var/atom/movable/thing as anything in body.contents) + if(isorgan(thing) || isbodypart(thing) || istype(thing, /obj/item/clothing) || istype(thing, /obj/item/card/id)) + continue + loose += "[thing.type]" + snap["carried"] = loose + var/list/held = list() + for(var/obj/item/thing in body.held_items) + held += "[thing.type]" + snap["held"] = held + snap["intercept"] = body.click_intercept ? "[body.click_intercept.type]" : null + return snap + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/Run() + rng_seed() + var/length_param = text2num(world.params["soak_length"]) + if(length_param) + storm_length = length_param + runtimes_at_start = GLOB.total_runtimes + skipped_runtimes_at_start = GLOB.total_runtimes_skipped + timers_at_start = length(SStimer.timer_id_dict) + for(var/gc_type in SSgarbage.items) + var/datum/qdel_item/item = SSgarbage.items[gc_type] + gc_before[gc_type] = list(item.failures, item.hard_deletes) + + build_pool() + build_room() + for(var/ledger_type in typesof(/datum/shop_buyback/ripperdoc) - /datum/shop_buyback/ripperdoc) + // Ratchet's entries are the same ledger in other words. + if(findtext("[ledger_type]", "/street_doc")) + continue + ledgers += allocate(ledger_type) + cradle = track(new /obj/machinery/chrome_cradle(run_loc_floor_top_right)) + storming = TRUE + for(var/i in 1 to crew_size) + INVOKE_ASYNC(src, PROC_REF(spawn_body)) + sleep(8 SECONDS) + // Two bodies are pacifists for the whole storm. + for(var/i in 1 to min(2, length(crew))) + var/mob/living/carbon/human/pacifist = crew[i] + ADD_TRAIT(pacifist, TRAIT_PACIFISM, "soak") + + var/end_time = world.time + storm_length + var/next_sweep = world.time + var/next_heal = world.time + 20 SECONDS + while(world.time < end_time) + sleep(1 SECONDS) + storm_tick() + if(world.time >= next_sweep) + next_sweep = world.time + 2 SECONDS + sweep() + if(world.time >= next_heal) + next_heal = world.time + 20 SECONDS + top_up() + storming = FALSE + // Let the long events (a death waiting to revive, a brownout waiting to lift, a cradle + // sequence) finish before anyone looks at the wreckage. + sleep(15 SECONDS) + sweep() + sweep() + + audit_survivors() + var/list/leaks = clean_up() + report(leaks) + +// ---- The storm ----------------------------------------------------------- + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/storm_tick() + var/static/list/event_weights = list( + "trigger" = 30, "swing" = 12, "wheel" = 4, "emp" = 8, "emp_one" = 4, "brownout" = 6, + "cradle" = 5, "sell" = 3, "kill" = 5, "gib" = 2, "dust" = 1, "dismember" = 5, "stun" = 6, + "cuff" = 3, "pacifist" = 2, "zoom" = 6, "damage" = 4, "mech" = 2, "speak" = 2, "swap" = 4, + ) + for(var/mob/living/carbon/human/body as anything in crew.Copy()) + if(QDELETED(body)) + crew -= body + baselines -= body + INVOKE_ASYNC(src, PROC_REF(spawn_body)) + continue + if(!prob(35)) + continue + switch(pick_weight(event_weights)) + if("trigger") + INVOKE_ASYNC(src, PROC_REF(ev_trigger), body) + if("swing") + INVOKE_ASYNC(src, PROC_REF(ev_swing), body) + if("wheel") + INVOKE_ASYNC(src, PROC_REF(ev_wheel), body) + if("emp") + INVOKE_ASYNC(src, PROC_REF(ev_emp), body) + if("emp_one") + INVOKE_ASYNC(src, PROC_REF(ev_emp_one), body) + if("brownout") + INVOKE_ASYNC(src, PROC_REF(ev_brownout), body) + if("cradle") + INVOKE_ASYNC(src, PROC_REF(ev_cradle), body) + if("sell") + INVOKE_ASYNC(src, PROC_REF(ev_sell), body) + if("kill") + INVOKE_ASYNC(src, PROC_REF(ev_kill), body) + if("gib") + INVOKE_ASYNC(src, PROC_REF(ev_gib), body, FALSE) + if("dust") + INVOKE_ASYNC(src, PROC_REF(ev_gib), body, TRUE) + if("dismember") + INVOKE_ASYNC(src, PROC_REF(ev_dismember), body) + if("stun") + INVOKE_ASYNC(src, PROC_REF(ev_stun), body) + if("cuff") + INVOKE_ASYNC(src, PROC_REF(ev_cuff), body) + if("pacifist") + INVOKE_ASYNC(src, PROC_REF(ev_pacifist), body) + if("zoom") + INVOKE_ASYNC(src, PROC_REF(ev_zoom), body) + if("damage") + INVOKE_ASYNC(src, PROC_REF(ev_damage), body) + if("mech") + INVOKE_ASYNC(src, PROC_REF(ev_mech), body) + if("speak") + INVOKE_ASYNC(src, PROC_REF(ev_speak), body) + if("swap") + INVOKE_ASYNC(src, PROC_REF(ev_swap), body) + +/// Something for an ability to be pointed at. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/some_target(mob/living/carbon/human/body) + var/roll = rand(1, 10) + if(roll <= 5) + var/list/others = crew - body + for(var/mob/living/carbon/human/other as anything in others.Copy()) + if(QDELETED(other)) + others -= other + if(length(others)) + return pick(others) + if(roll <= 7 && !QDELETED(cradle)) + return cradle + // A click on yourself is a click like any other, and every button has to take it. + if(roll == 10) + return body + return pick(floor_turfs) + +/// Every installed ability, pointed at something. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_trigger(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + for(var/obj/item/organ/ware as anything in get_installed_cyberware(body)) + for(var/datum/action/ability as anything in LAZYCOPY(ware.actions)) + if(QDELETED(ability) || ability.owner != body) + continue + // Cooldowns would stop most of these after the first press. + if(istype(ability, /datum/action/cooldown) && prob(60)) + var/datum/action/cooldown/timed = ability + timed.next_use_time = 0 + count("ability presses") + INVOKE_ASYNC(ability, TYPE_PROC_REF(/datum/action, Trigger), body, NONE, some_target(body)) + +/// A melee swing or a shot, through the real click path, with whatever is in the hands. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_swing(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + body.set_combat_mode(TRUE) + count("clicks") + click_wrapper(body, some_target(body)) + +/// The chrome wheel's Use OS chrome, the one wheel path that needs no screen. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_wheel(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + var/datum/component/chrome_wheel/wheel = get_chrome_wheel(body) + if(!wheel) + return + body.next_click = 0 + count("wheel presses") + wheel.use_os() + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_emp(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + count("body emps") + body.emp_act(prob(50) ? EMP_HEAVY : EMP_LIGHT) + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_emp_one(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + var/list/installed = get_installed_cyberware(body) + if(!length(installed)) + return + var/obj/item/organ/ware = pick(installed) + count("piece emps") + ware.emp_act(prob(50) ? EMP_HEAVY : EMP_LIGHT) + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_brownout(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + var/obj/item/organ/cyberimp/cyberware/soak_ballast/ballast = new /obj/item/organ/cyberimp/cyberware/soak_ballast(get_turf(body)) + track(ballast) + if(!ballast.Insert(body, special = TRUE)) + qdel(ballast) + return + count("brownouts") + sleep(rand(3 SECONDS, 9 SECONDS)) + if(QDELETED(ballast)) + return + if(ballast.owner) + ballast.Remove(ballast.owner, special = TRUE) + qdel(ballast) + +/// A cradle visit: lie down, then install something, take something out, or tune up. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_cradle(mob/living/carbon/human/body) + if(!storming || QDELETED(body) || QDELETED(cradle) || cradle_lease > world.time || !isturf(body.loc)) + return + cradle_lease = world.time + 14 SECONDS + body.forceMove(get_turf(cradle)) + if(!cradle.buckle_mob(body, force = TRUE, check_loc = FALSE)) + cradle_lease = 0 + return + var/list/installed = get_installed_cyberware(body) + var/roll = rand(1, 10) + if(roll <= 2) + count("tune-ups") + var/obj/item/card/id/id = body.get_idcard(TRUE) + var/before = id?.registered_account?.account_balance + cradle.try_tune_up(body) + var/after = id?.registered_account?.account_balance + if(!isnull(before) && before != after && before - after != SOAK_TUNEUP_FEE) + note("tune-up charged the wrong fee", "balance went from [before] to [after]") + else if(roll <= 5 && length(installed)) + count("cradle removals") + cradle.begin_removal(pick(installed)) + sleep(SOAK_REMOVAL_TIME + 1 SECONDS) + else + // A used piece from the floor when there is one, otherwise a fresh one. + var/obj/item/organ/ware + if(length(loose_chrome) && prob(50)) + ware = pick(loose_chrome) + loose_chrome -= ware + if(QDELETED(ware)) + ware = null + for(var/attempt in 1 to 8) + var/candidate_type = pick(ware_pool) + var/obj/item/organ/candidate = track(new candidate_type(get_turf(cradle))) + if(cyberware_insert_check(candidate, body, silent = TRUE)) + ware = candidate + break + qdel(candidate) + if(ware) + count("cradle installs") + ware.forceMove(cradle) + cradle.begin_install(ware) + sleep(SOAK_INSTALL_TIME + 1 SECONDS) + if(!QDELETED(body) && body.buckled == cradle) + cradle.unbuckle_mob(body, force = TRUE) + cradle_lease = 0 + +/// A sale at Splice's ledger: pull a credit-priced piece and hand it over. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_sell(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + var/obj/item/card/id/id = body.get_idcard(TRUE) + if(!id?.registered_account) + return + for(var/obj/item/organ/ware as anything in shuffle(get_installed_cyberware(body))) + for(var/datum/shop_buyback/ledger as anything in ledgers) + if(!ledger.matches(ware)) + continue + ledger.demand = 50 + ware.Remove(body, special = TRUE) + body.put_in_hands(ware) + var/before = id.registered_account.account_balance + var/sold = ledger.try_sell(body, null) + var/gained = id.registered_account.account_balance - before + if(sold) + count("sell-backs") + if(gained != ledger.pay_credits) + note("sell-back paid the wrong amount", "[ware.type] paid [gained], the ledger says [ledger.pay_credits]") + else + if(gained) + note("a refused sell-back still paid", "[ware.type] paid [gained]") + // Not taken: it goes back on the floor for the cradle. + loose_chrome += ware + ware.forceMove(get_turf(body)) + return + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_kill(mob/living/carbon/human/body) + if(!storming || QDELETED(body) || body.stat == DEAD) + return + count("deaths") + body.death() + sleep(rand(2 SECONDS, 9 SECONDS)) + if(QDELETED(body)) + return + body.revive(HEAL_ALL) + count("revives") + +/// Gib or dust a body. Its chrome must come out whole; a fresh body takes its place. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_gib(mob/living/carbon/human/body, dust = FALSE) + if(!storming || QDELETED(body)) + return + var/list/pieces = get_installed_cyberware(body) + // The ballast belongs to its own event, which deletes it when it is done. + for(var/obj/item/organ/ware as anything in pieces.Copy()) + if(istype(ware, /obj/item/organ/cyberimp/cyberware/soak_ballast)) + pieces -= ware + count(dust ? "dustings" : "gibs") + crew -= body + baselines -= body + if(dust) + body.dust() + else + body.gib() + sleep(1 SECONDS) + for(var/obj/item/organ/ware as anything in pieces) + if(QDELETED(ware)) + note("gibbing destroyed a piece of chrome", "[ware.type]") + continue + if(ware.owner) + note("gibbed chrome is still owned by the corpse", "[ware.type]") + continue + if(!isturf(ware.loc)) + note("gibbed chrome did not land on the floor", "[ware.type] is in [ware.loc ? ware.loc.type : "nullspace"]") + continue + count("pieces salvaged") + loose_chrome += ware + spawn_body() + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_dismember(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + var/obj/item/bodypart/limb = body.get_bodypart(pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)) + if(!limb || !limb.dismember()) + return + count("limbs lost") + var/list/riders = list() + for(var/obj/item/organ/ware in limb) + riders += ware + if(prob(40)) + // Burned up on the floor: the chrome has to come out of it. + sleep(1 SECONDS) + qdel(limb) + for(var/obj/item/organ/ware as anything in riders) + if(QDELETED(ware)) + note("destroying a severed limb destroyed its chrome", "[ware.type]") + else if(!isturf(ware.loc)) + note("chrome from a destroyed limb did not land on the floor", "[ware.type] is in [ware.loc ? ware.loc.type : "nullspace"]") + else + loose_chrome += ware + sleep(rand(3 SECONDS, 10 SECONDS)) + if(!QDELETED(body)) + body.regenerate_limbs() + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_stun(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + count("stuns") + switch(rand(1, 3)) + if(1) + body.Paralyze(rand(1 SECONDS, 5 SECONDS)) + if(2) + body.Stun(rand(1 SECONDS, 4 SECONDS)) + if(3) + body.Knockdown(rand(1 SECONDS, 4 SECONDS)) + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_cuff(mob/living/carbon/human/body) + if(!storming || QDELETED(body) || body.handcuffed) + return + var/obj/item/restraints/handcuffs/cuffs = new(body) + body.set_handcuffed(cuffs) + count("cuffings") + sleep(rand(3 SECONDS, 8 SECONDS)) + if(!QDELETED(body) && body.handcuffed == cuffs) + body.set_handcuffed(null) + qdel(cuffs) + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_pacifist(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + // The first two bodies keep it for the whole storm. + if(crew.Find(body) <= 2) + return + if(HAS_TRAIT_FROM(body, TRAIT_PACIFISM, "soak")) + REMOVE_TRAIT(body, TRAIT_PACIFISM, "soak") + else + ADD_TRAIT(body, TRAIT_PACIFISM, "soak") + count("pacifism flips") + +/// Optics zoom. There is no client for tg's scope, so the optics' own half is driven. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_zoom(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + var/obj/item/organ/eyes/robotic/cyberware/optics = body.get_organ_slot(ORGAN_SLOT_EYES) + if(!istype(optics)) + return + count("zoom flips") + if(optics.is_zoomed()) + optics.stop_zoom(body) + return + var/datum/component/cyberware/chrome = optics.GetComponent(/datum/component/cyberware) + if(chrome?.is_running() && body.stat == CONSCIOUS) + optics.engage_zoom(body) + +/// Damage on a piece until it fails, then it is repaired a moment later. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_damage(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + var/list/installed = get_installed_cyberware(body) + if(!length(installed)) + return + var/obj/item/organ/ware = pick(installed) + count("damaged pieces") + ware.apply_organ_damage(ware.maxHealth) + sleep(rand(2 SECONDS, 7 SECONDS)) + if(!QDELETED(ware)) + ware.set_organ_damage(0) + +/// A short ride in a mech, with the abilities going the whole time. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_mech(mob/living/carbon/human/body) + if(!storming || QDELETED(body) || mech_lease > world.time || !isturf(body.loc)) + return + mech_lease = world.time + 12 SECONDS + var/obj/vehicle/sealed/mecha/ripley/mech = new /obj/vehicle/sealed/mecha/ripley(get_turf(body)) + track(mech) + if(!mech.mob_enter(body, silent = TRUE)) + qdel(mech) + mech_lease = 0 + return + count("mech rides") + for(var/i in 1 to 4) + sleep(1 SECONDS) + if(QDELETED(body) || body.loc != mech) + break + ev_trigger(body) + ev_swing(body) + if(!QDELETED(body) && body.loc == mech) + mech.mob_exit(body, silent = TRUE) + qdel(mech) + mech_lease = 0 + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_speak(mob/living/carbon/human/body) + // A dead mouth goes to deadchat, which asks for a ckey this test body never has. + if(!storming || QDELETED(body) || body.stat == DEAD) + return + count("lines spoken") + body.say(prob(50) ? ";soak check, over" : "soak check") + +/// Chrome in or out by hand: what an autosurgeon with a context, a surgeon or an admin does. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_swap(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + var/list/installed = get_installed_cyberware(body) + if(length(installed) && prob(50)) + var/obj/item/organ/ware = pick(installed) + ware.Remove(body, special = TRUE) + ware.forceMove(get_turf(body)) + loose_chrome += ware + count("pieces pulled") + return + var/candidate_type = pick(ware_pool) + var/obj/item/organ/ware = track(new candidate_type(get_turf(body))) + if(!body.get_bodypart(deprecise_zone(ware.zone)) || !cyberware_insert_check(ware, body, silent = TRUE) || !ware.Insert(body, special = TRUE)) + qdel(ware) + return + count("pieces slotted") + +/// Keeps the bodies fit enough to keep going without undoing the chrome's own state. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/top_up() + for(var/mob/living/carbon/human/body as anything in crew) + if(QDELETED(body) || body.stat == DEAD) + continue + body.adjustBruteLoss(-60, updating_health = FALSE, forced = TRUE) + body.adjustFireLoss(-60, updating_health = FALSE, forced = TRUE) + body.adjustToxLoss(-30, updating_health = FALSE, forced = TRUE) + body.adjustOxyLoss(-60, updating_health = FALSE, forced = TRUE) + body.updatehealth() + +// ---- The sweep ----------------------------------------------------------- + +/// Checks the ware's own bookkeeping on every body. Each finding has to hold for a while +/// before it counts, because the ware settles itself on SSmobs' two-second tick. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/sweep() + seen_now = list() + for(var/mob/living/carbon/human/body as anything in crew) + if(QDELETED(body)) + continue + var/over = get_chrome_load(body) > get_chrome_capacity(body) + for(var/obj/item/organ/ware as anything in get_installed_cyberware(body)) + var/datum/component/cyberware/chrome = ware.GetComponent(/datum/component/cyberware) + if(!chrome) + continue + var/ware_ref = REF(ware) + if(ware.owner != body) + suspect("[ware_ref]|owner", "installed chrome whose owner is not its bearer", "[ware.type] owner [ware.owner || "none"] in [body]") + var/running = !!chrome.is_running() + if(!!chrome.passives_online != running) + suspect("[ware_ref]|passives", "passive layer out of step with the ware", "[ware.type] passives_online [chrome.passives_online], running [running] (emp [chrome.emp_down], brownout [chrome.browned_out], damage [ware.damage]/[ware.maxHealth], flags [ware.organ_flags])") + if(!!chrome.browned_out != over) + suspect("[ware_ref]|brownout", "brownout flag out of step with the body's load", "[ware.type] browned_out [chrome.browned_out], load [get_chrome_load(body)] of [get_chrome_capacity(body)]") + if(chrome.emp_down && !chrome.emp_timer) + suspect("[ware_ref]|emptimer", "EMP downtime with no reboot timer", "[ware.type]") + // A reboot always ends on its timer (a missing one is caught just above), but EMPs + // landing back to back can keep a piece down across sweeps. Only a timer set further + // out than any EMP's downtime is an outage that would not end. + if(chrome.emp_down && chrome.emp_timer && timeleft(chrome.emp_timer) > SOAK_EMP_DOWNTIME) + suspect("[ware_ref]|empstuck", "EMP downtime that never ended", "[ware.type] still down", SOAK_EMP_DOWNTIME) + if(istype(ware, /obj/item/organ/cyberimp/arm/toolkit/cyberware)) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/arm = ware + if(arm.active_item && !running && arm.active_item.loc == body) + suspect("[ware_ref]|armweapon", "arm weapon deployed on offline chrome", "[ware.type] holding [arm.active_item.type]") + if(HAS_TRAIT(body, SOAK_TRAIT_ZOOMED)) + var/obj/item/organ/eyes/robotic/cyberware/optics = body.get_organ_slot(ORGAN_SLOT_EYES) + var/datum/component/cyberware/optic_chrome = istype(optics) ? optics.GetComponent(/datum/component/cyberware) : null + if(!istype(optics) || !optics.is_zoomed()) + suspect("[REF(body)]|zoomtrait", "zoom trait with no zoomed optics behind it", "[body]") + else if(!optic_chrome?.is_running()) + suspect("[REF(body)]|zoomoffline", "zoom held open on offline optics", "[optics.type]") + else if(body.stat != CONSCIOUS) + suspect("[REF(body)]|zoomstat", "zoom held open on a body that is not awake", "[body] stat [body.stat]") + if(HAS_TRAIT(body, SOAK_TRAIT_CAMO)) + var/obj/item/organ/cyberimp/cyberware/ghostskin/weave = body.get_organ_slot(SOAK_SLOT_SKIN) + var/datum/component/cyberware/weave_chrome = istype(weave) ? weave.GetComponent(/datum/component/cyberware) : null + if(!istype(weave) || !weave.camo_active) + suspect("[REF(body)]|camotrait", "camo trait with no engaged weave behind it", "[body]") + else if(!weave_chrome?.is_running()) + suspect("[REF(body)]|camooffline", "camo held on an offline weave", "[weave.type]") + for(var/key in suspects.Copy()) + if(!seen_now[key]) + suspects -= key + reported -= key + +// ---- The audit ----------------------------------------------------------- + +/// Heal the survivors, take all their chrome out, leave them alone and compare with the +/// snapshot from before they had any. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/audit_survivors() + var/list/survivors = list() + for(var/mob/living/carbon/human/body as anything in crew) + if(QDELETED(body) || !baselines[body]) + continue + survivors += body + body.drop_all_held_items() + body.forceMove(run_loc_floor_bottom_left) + body.set_handcuffed(null) + REMOVE_TRAIT(body, TRAIT_PACIFISM, "soak") + body.revive(ADMIN_HEAL_ALL) + body.regenerate_limbs() + var/index = 0 + for(var/obj/item/organ/ware as anything in get_installed_cyberware(body)) + index++ + // Half through the normal removal, half the way a dying body does it. + ware.Remove(body, special = (index % 2 == 0)) + ware.forceMove(get_turf(body)) + loose_chrome += ware + if(get_chrome_load(body) != 0) + note("a body still carries load with no chrome in it", "[body] carries [get_chrome_load(body)]") + // Chrome optics and lungs replaced the body's own, so pulling them leaves gaps a + // body without chrome never had (no eyes means blind). + body.dna.species.regenerate_organs(body, replace_current = FALSE) + log_world("SOAK auditing [length(survivors)] survivors after a 20 second quiet") + sleep(20 SECONDS) + for(var/mob/living/carbon/human/body as anything in survivors) + if(QDELETED(body)) + continue + var/list/before = baselines[body] + var/list/now = snapshot(body) + for(var/key in before) + var/old_value = before[key] + var/new_value = now[key] + if(islist(old_value)) + var/list/old_list = old_value + var/list/new_list = new_value + var/list/gained = list() + var/list/lost = list() + if(key == "traits" || key == "physiology") + for(var/entry in new_list) + if(new_list[entry] != old_list[entry]) + gained += "[entry] [old_list[entry]] -> [new_list[entry]]" + for(var/entry in old_list) + if(isnull(new_list[entry])) + lost += "[entry]" + else + var/list/remaining = old_list.Copy() + for(var/entry in new_list) + if(entry in remaining) + remaining -= entry + else + gained += "[entry]" + lost = remaining + if(length(gained) || length(lost)) + // The chrome wheel is made on first use and kept for the body's life. + if(key == "components") + gained -= "[/datum/component/chrome_wheel]" + // A baseline taken mid-fight can hold a passing effect (a stagger); only + // what was ADDED by the chrome and never left counts for these. + if(key == "status effects" || key == "movespeed" || key == "actionspeed") + lost = list() + if(length(gained) || length(lost)) + note("after stripping the chrome, [key] differ from before it", "[body]: gained [english_list(gained)], lost [english_list(lost)]") + else if(old_value != new_value) + note("after stripping the chrome, [key] differs from before it", "[body]: was [old_value], now [new_value]") + for(var/stale in voidcrew_cyberware_stale_listeners(body)) + note("a stripped body still has chrome listening to it", "[body]: [stale]") + +/// Delete everything this test made, wait for the garbage collector, and return what survived. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/clean_up() + // The cradle's own loose ends first. + var/tray_strays = 0 + if(!QDELETED(cradle)) + if(cradle.busy) + note("the cradle ended the soak mid-sequence", "[cradle.busy_action]") + list_clear_nulls(cradle.tray) + for(var/obj/item/organ/stray in cradle.tray) + if(QDELETED(stray)) + tray_strays++ + if(tray_strays) + note("the cradle's tray holds deleted chrome", "[tray_strays] pieces") + crew.Cut() + baselines.Cut() + loose_chrome.Cut() + suspects.Cut() + reported.Cut() + seen_now.Cut() + // The cradle first, because its tray empties onto the floor when it goes. + qdel(cradle) + cradle = null + // Everything in the room goes, bodies and chrome and gibs. Twice: the first pass can drop + // things (a dead body's pockets, a limb's chrome) that the second one picks up. + for(var/pass in 1 to 2) + for(var/turf/where as anything in floor_turfs + run_loc_floor_top_right) + for(var/atom/movable/thing as anything in where.contents.Copy()) + if(istype(thing, /obj/effect/landmark)) + continue + qdel(thing) + floor_turfs.Cut() + ledgers.Cut() + // Past the longest queue the collector has, plus a margin. + sleep(45 SECONDS) + var/list/leaks = list() + for(var/datum/weakref/ref as anything in made) + var/datum/survivor = ref.resolve() + if(survivor) + leaks["[survivor.type]"] = (leaks["[survivor.type]"] || 0) + 1 + made.Cut() + // Anything that ran out of patience with the collector is counted per type. + for(var/gc_type in SSgarbage.items) + var/datum/qdel_item/item = SSgarbage.items[gc_type] + var/list/before = gc_before[gc_type] || list(0, 0) + if(item.failures > before[1] || item.hard_deletes > before[2]) + var/path_text = "[gc_type]" + if(findtext(path_text, "cyberware") || findtext(path_text, "chrome") || findtext(path_text, "/mob/living/carbon/human") || findtext(path_text, "shop_buyback")) + leaks["GC [path_text]: [item.failures - before[1]] failures, [item.hard_deletes - before[2]] hard deletes"] = 1 + // A timer pointing at an object that is already gone should not exist. + var/orphaned = 0 + for(var/timer_id in SStimer.timer_id_dict) + var/datum/timedevent/timer = SStimer.timer_id_dict[timer_id] + var/datum/object = timer?.callBack?.object + if(isdatum(object) && QDELETED(object)) + orphaned++ + if(orphaned) + leaks["timers aimed at deleted objects"] = orphaned + stats["timers before"] = timers_at_start + stats["timers after"] = length(SStimer.timer_id_dict) + return leaks + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/report(list/leaks) + var/list/lines = list() + lines += "CHROME SOAK REPORT" + lines += "storm length [storm_length / 10] s, [crew_size] bodies, [length(ware_pool)] kinds of chrome in the pool" + lines += "runtimes during the soak: [GLOB.total_runtimes - runtimes_at_start] (plus [GLOB.total_runtimes_skipped - skipped_runtimes_at_start] silenced as repeats)" + lines += "-- what was done" + for(var/what in stats) + lines += " [what]: [stats[what]]" + lines += "-- problems ([length(problem_counts)] kinds)" + for(var/category in problem_counts) + lines += " [category] x[problem_counts[category]]: [problem_examples[category]]" + lines += "-- left behind ([length(leaks)] kinds)" + for(var/leak in leaks) + lines += " [leak]: [leaks[leak]]" + var/text = lines.Join("\n") + fdel("data/soak_report.txt") + text2file(text, "data/soak_report.txt") + log_world(text) + for(var/category in problem_counts) + Fail("[category] (x[problem_counts[category]]): [problem_examples[category]]") + for(var/leak in leaks) + Fail("left behind: [leak]: [leaks[leak]]") + +#undef SOAK_SLOT_SKIN +#undef SOAK_TRAIT_CAMO +#undef SOAK_TRAIT_ZOOMED +#undef SOAK_INSTALL_TIME +#undef SOAK_REMOVAL_TIME +#undef SOAK_EMP_DOWNTIME +#undef SOAK_TUNEUP_FEE +#undef SOAK_PATIENCE diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware_zoom.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware_zoom.dm new file mode 100644 index 00000000000..719759ad15a --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware_zoom.dm @@ -0,0 +1,368 @@ +/** + * # Optics zoom (voidcrew/modules/cyberware/cyberware_zoom.dm, ware_line_zoom.dm) + * + * Every chrome optic zooms by tier, a zoomed bearer can't shoot, the zoom drops + * whenever the eyes or the bearer stop working, and a click on the zoomed view + * goes nowhere. There is no client here, so tg's scope never + * starts: these tests drive the optics' own half of a zoom (engage_zoom()) and + * stand in a hand-made cursor catcher for the scope's. + * + * Unit-test files compile before voidcrew/_DEFINES/, so fork defines are + * literals: TRAIT_CYBER_ZOOMED "cyber_zoomed", + * CYBERWARE_SCAN_SILHOUETTE 1 / _ITEMIZED 2, CYBERWARE_TIER_n n, and zone + * permissions Public/Yellow/Advanced 0/1/2. + */ + +/// Stands in for an armed click-to-target ability. +/datum/zoom_click_probe + /// How many clicks reached us as a click intercept. + var/intercepted = 0 + +/datum/zoom_click_probe/proc/InterceptClickOn(mob/user, params, atom/target) + intercepted++ + return TRUE + +/// The ladder: every optic zooms, carries the button and the scope, and reaches +/// what its tier says, never as far as binoculars (4). +/datum/unit_test/voidcrew_cyberware_zoom_ladder + +/datum/unit_test/voidcrew_cyberware_zoom_ladder/Run() + // optic => list(zoom, walk penalty) + var/list/expected = list( + /obj/item/organ/eyes/robotic/cyberware/spyglass = list(1, 1), + /obj/item/organ/eyes/robotic/cyberware/prospector/street = list(1, 1), + /obj/item/organ/eyes/robotic/cyberware/nightshade = list(1, 1), + /obj/item/organ/eyes/robotic/cyberware/prospector = list(1.5, 0.5), + /obj/item/organ/eyes/robotic/cyberware/deadeye = list(1.5, 0.5), + /obj/item/organ/eyes/robotic/cyberware/longsight = list(2, 0), + /obj/item/organ/eyes/robotic/cyberware/deadeye/milspec = list(2, 0), + /obj/item/organ/eyes/robotic/cyberware/lookout = list(2.5, 0), + ) + for(var/optic_type in subtypesof(/obj/item/organ/eyes/robotic/cyberware)) + var/obj/item/organ/eyes/robotic/cyberware/optics = allocate(optic_type) + TEST_ASSERT(optics.optics_zoom > 0, "[optic_type] doesn't zoom") + TEST_ASSERT(optics.optics_zoom < 4, "[optic_type] zooms as far as binoculars") + TEST_ASSERT_EQUAL(optics.slot, ORGAN_SLOT_EYES, "[optic_type] left the eye slot, so it would stack with other optics") + var/datum/component/scope/scope = optics.GetComponent(/datum/component/scope) + TEST_ASSERT_NOTNULL(scope, "[optic_type] has no scope to zoom with") + TEST_ASSERT_EQUAL(scope.range_modifier, optics.optics_zoom, "[optic_type]'s scope reaches a different distance from its zoom") + TEST_ASSERT(locate(/datum/action/cooldown/cyberware/optics_zoom) in optics.actions, "[optic_type] has no zoom button") + TEST_ASSERT(locate(/datum/action/cooldown/cyberware/chrome_read) in optics.actions, "[optic_type] lost its chrome read") + TEST_ASSERT(istype(optics.actions[length(optics.actions)], /datum/action/cooldown/cyberware/optics_zoom), "[optic_type]'s zoom is not its last button") + var/list/numbers = expected[optic_type] + if(!numbers) + continue + TEST_ASSERT_EQUAL(optics.optics_zoom, numbers[1], "[optic_type] zooms the wrong distance") + TEST_ASSERT_EQUAL(optics.zoom_walk_penalty, numbers[2], "[optic_type] has the wrong walk tax while zoomed") + for(var/optic_type in expected) + TEST_ASSERT(ispath(optic_type, /obj/item/organ/eyes/robotic/cyberware), "[optic_type] is no longer chrome optics") + +/// The existing optics keep their numbers now they're vars, and the new models +/// carry theirs. +/datum/unit_test/voidcrew_cyberware_zoom_models + +/datum/unit_test/voidcrew_cyberware_zoom_models/Run() + // Chrome read: 7 tiles every 12 seconds unless the optics say otherwise. + var/obj/item/organ/eyes/robotic/cyberware/nightshade/nightshade = allocate(/obj/item/organ/eyes/robotic/cyberware/nightshade) + var/datum/action/cooldown/cyberware/chrome_read/stock_read = locate() in nightshade.actions + TEST_ASSERT_EQUAL(nightshade.chrome_read_range, 7, "The stock chrome read range changed") + TEST_ASSERT_EQUAL(stock_read.cooldown_time, 12 SECONDS, "The stock chrome read cooldown changed") + + // Deadeye, unchanged. + var/obj/item/organ/eyes/robotic/cyberware/deadeye/deadeye = allocate(/obj/item/organ/eyes/robotic/cyberware/deadeye) + TEST_ASSERT_EQUAL(deadeye.tag_range, 9, "Deadeye tag range changed") + TEST_ASSERT_EQUAL(deadeye.tag_shots, 3, "Deadeye tracked shots changed") + TEST_ASSERT_EQUAL(deadeye.tag_duration, 15 SECONDS, "Deadeye tag length changed") + var/datum/action/cooldown/cyberware/deadeye_tag/deadeye_tag = locate() in deadeye.actions + TEST_ASSERT_EQUAL(deadeye_tag.type, /datum/action/cooldown/cyberware/deadeye_tag, "The Deadeye carries the wrong tag") + TEST_ASSERT_EQUAL(deadeye_tag.cooldown_time, 25 SECONDS, "Deadeye tag cooldown changed") + + // Marksman link: four shots, ten tiles, eighteen seconds, same tag length. + var/obj/item/organ/eyes/robotic/cyberware/deadeye/milspec/marksman = allocate(/obj/item/organ/eyes/robotic/cyberware/deadeye/milspec) + TEST_ASSERT_EQUAL(marksman.tag_range, 10, "Marksman tag range is not 10") + TEST_ASSERT_EQUAL(marksman.tag_shots, 4, "Marksman tracked shots are not 4") + TEST_ASSERT_EQUAL(marksman.tag_duration, 15 SECONDS, "Marksman tag length is not 15 s") + var/datum/action/cooldown/cyberware/deadeye_tag/marksman/marksman_tag = locate() in marksman.actions + TEST_ASSERT_NOTNULL(marksman_tag, "The Marksman link has no tag of its own") + TEST_ASSERT_EQUAL(marksman_tag.cooldown_time, 18 SECONDS, "Marksman tag cooldown is not 18 s") + check_chrome(marksman, 3, 4) + + // Prospector, unchanged; Assay optics shorter, slower and blind to caches. + var/obj/item/organ/eyes/robotic/cyberware/prospector/prospector = allocate(/obj/item/organ/eyes/robotic/cyberware/prospector) + TEST_ASSERT_EQUAL(prospector.pulse_range, 9, "Prospector pulse range changed") + TEST_ASSERT(prospector.pulse_marks_caches, "The Prospector stopped flagging caches") + var/datum/action/cooldown/cyberware/prospector_pulse/stock_pulse = locate() in prospector.actions + TEST_ASSERT_EQUAL(stock_pulse.cooldown_time, 10 SECONDS, "Prospector pulse cooldown changed") + var/obj/item/organ/eyes/robotic/cyberware/prospector/street/assay = allocate(/obj/item/organ/eyes/robotic/cyberware/prospector/street) + TEST_ASSERT_EQUAL(assay.pulse_range, 5, "Assay pulse range is not 5") + TEST_ASSERT(!assay.pulse_marks_caches, "Assay optics flag caches") + var/datum/action/cooldown/cyberware/prospector_pulse/assay/assay_pulse = locate() in assay.actions + TEST_ASSERT_NOTNULL(assay_pulse, "Assay optics have no pulse of their own") + TEST_ASSERT_EQUAL(assay_pulse.cooldown_time, 15 SECONDS, "Assay pulse cooldown is not 15 s") + TEST_ASSERT_EQUAL(assay.chrome_scan_resolution, 1, "Assay optics read at more than silhouette") + check_chrome(assay, 1, 1) + + // The plain scout line. + var/obj/item/organ/eyes/robotic/cyberware/spyglass/spyglass = allocate(/obj/item/organ/eyes/robotic/cyberware/spyglass) + TEST_ASSERT_EQUAL(spyglass.chrome_scan_resolution, 1, "Spyglass optics read at more than silhouette") + TEST_ASSERT_EQUAL(length(spyglass.actions), 2, "Spyglass optics should carry only the read and the zoom") + check_chrome(spyglass, 1, 1) + var/obj/item/organ/eyes/robotic/cyberware/longsight/longsight = allocate(/obj/item/organ/eyes/robotic/cyberware/longsight) + TEST_ASSERT_EQUAL(longsight.chrome_scan_resolution, 2, "Longsight optics don't name what they read") + TEST_ASSERT_EQUAL(longsight.chrome_read_range, 9, "Longsight read range is not 9") + check_chrome(longsight, 2, 2) + var/obj/item/organ/eyes/robotic/cyberware/lookout/lookout = allocate(/obj/item/organ/eyes/robotic/cyberware/lookout) + TEST_ASSERT_EQUAL(lookout.chrome_scan_resolution, 2, "Lookout optics don't name what they read") + TEST_ASSERT_EQUAL(lookout.chrome_read_range, 11, "Lookout read range is not 11") + var/datum/action/cooldown/cyberware/chrome_read/lookout_read = locate() in lookout.actions + TEST_ASSERT_EQUAL(lookout_read.cooldown_time, 8 SECONDS, "Lookout read cooldown is not 8 s") + TEST_ASSERT_EQUAL(lookout.lighting_cutoff, LIGHTING_CUTOFF_MEDIUM, "Lookout optics lost their low-light") + check_chrome(lookout, 3, 3) + +/datum/unit_test/voidcrew_cyberware_zoom_models/proc/check_chrome(obj/item/organ/eyes/robotic/cyberware/optics, tier, load) + var/datum/component/cyberware/chrome = optics.GetComponent(/datum/component/cyberware) + TEST_ASSERT_EQUAL(chrome.tier, tier, "[optics.type] is the wrong tier") + TEST_ASSERT_EQUAL(chrome.chrome_load, load, "[optics.type] carries the wrong neural load") + +/// A zoom holds the trait and the walk tax, refuses guns, and lets go cleanly. +/datum/unit_test/voidcrew_cyberware_zoom_state + +/datum/unit_test/voidcrew_cyberware_zoom_state/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/eyes/robotic/cyberware/spyglass/optics = allocate(/obj/item/organ/eyes/robotic/cyberware/spyglass) + TEST_ASSERT(optics.Insert(bearer, special = TRUE), "Spyglass staging insert was refused") + var/datum/action/cooldown/cyberware/optics_zoom/zoom = locate() in optics.actions + TEST_ASSERT_EQUAL(zoom.owner, bearer, "The zoom button didn't come with the eyes") + TEST_ASSERT(zoom.IsAvailable(), "Healthy installed optics can't zoom") + + // No client: the scope refuses, so the button can't zoom anyone here. + TEST_ASSERT(!optics.start_zoom(), "A clientless bearer zoomed") + TEST_ASSERT(!HAS_TRAIT(bearer, "cyber_zoomed"), "A refused zoom left the bearer zoomed") + + optics.engage_zoom(bearer) + TEST_ASSERT(optics.is_zoomed() && HAS_TRAIT(bearer, "cyber_zoomed"), "Engaging the zoom didn't mark the bearer zoomed") + TEST_ASSERT(zoom.is_action_active(null), "The zoom button doesn't show the zoom as on") + TEST_ASSERT(bearer.has_movespeed_modifier(/datum/movespeed_modifier/cyberware_zoom), "Cheap optics didn't slow their bearer while zoomed") + + var/obj/item/gun/ballistic/automatic/pistol/pistol = allocate(/obj/item/gun/ballistic/automatic/pistol) + TEST_ASSERT(bearer.put_in_active_hand(pistol), "Test fixture: the bearer couldn't hold the pistol") + var/rounds = pistol.get_ammo() + TEST_ASSERT(rounds > 0, "Test fixture: the pistol spawned empty") + TEST_ASSERT(SEND_SIGNAL(bearer, COMSIG_MOB_TRYING_TO_FIRE_GUN, pistol, run_loc_floor_top_right, FALSE, null) & COMPONENT_CANCEL_GUN_FIRE, "A zoomed bearer's gun wasn't stopped") + pistol.fire_gun(run_loc_floor_top_right, bearer, FALSE, null) + TEST_ASSERT_EQUAL(pistol.get_ammo(), rounds, "A zoomed bearer fired a gun") + + optics.stop_zoom(bearer) + TEST_ASSERT(!optics.is_zoomed() && !HAS_TRAIT(bearer, "cyber_zoomed"), "Stopping the zoom left the bearer zoomed") + TEST_ASSERT(!bearer.has_movespeed_modifier(/datum/movespeed_modifier/cyberware_zoom), "The walk tax outlived the zoom") + TEST_ASSERT(!(SEND_SIGNAL(bearer, COMSIG_MOB_TRYING_TO_FIRE_GUN, pistol, run_loc_floor_top_right, FALSE, null) & COMPONENT_CANCEL_GUN_FIRE), "The gun block outlived the zoom") + TEST_ASSERT(!zoom.is_action_active(null), "The zoom button still shows the zoom as on") + + // Scout optics zoom at full stride. + var/mob/living/carbon/human/scout = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/eyes/robotic/cyberware/longsight/scout_optics = allocate(/obj/item/organ/eyes/robotic/cyberware/longsight) + TEST_ASSERT(scout_optics.Insert(scout, special = TRUE), "Longsight staging insert was refused") + scout_optics.engage_zoom(scout) + TEST_ASSERT(!scout.has_movespeed_modifier(/datum/movespeed_modifier/cyberware_zoom), "Scout optics slowed their bearer while zoomed") + scout_optics.stop_zoom(scout) + +/// Everything that should end a zoom does. +/datum/unit_test/voidcrew_cyberware_zoom_drops + +/datum/unit_test/voidcrew_cyberware_zoom_drops/Run() + var/obj/item/organ/eyes/robotic/cyberware/optics = zoomed() + var/datum/component/cyberware/chrome = optics.GetComponent(/datum/component/cyberware) + var/datum/action/cooldown/cyberware/optics_zoom/zoom = locate() in optics.actions + chrome.start_emp_reboot() + check_dropped(optics, "an EMP") + TEST_ASSERT(!zoom.IsAvailable(), "EMP-scrambled optics can still zoom") + chrome.tune_up() + TEST_ASSERT(zoom.IsAvailable(), "Rebooted optics can't zoom again") + + optics = zoomed() + chrome = optics.GetComponent(/datum/component/cyberware) + chrome.set_browned_out(TRUE) + check_dropped(optics, "a brownout") + chrome.set_browned_out(FALSE) + + optics = zoomed() + chrome = optics.GetComponent(/datum/component/cyberware) + optics.set_organ_damage(optics.maxHealth) + chrome.update_failing() // the bearer's life tick, which settles damage failure + check_dropped(optics, "the eyes failing") + + optics = zoomed() + optics.owner.flash_act(1) + check_dropped(optics, "a flash") + + optics = zoomed() + optics.owner.become_blind("voidcrew_zoom_test") + check_dropped(optics, "going blind") + + optics = zoomed() + optics.owner.Stun(2 SECONDS) + check_dropped(optics, "a stun") + + optics = zoomed() + optics.owner.Knockdown(2 SECONDS) + check_dropped(optics, "a knockdown") + + optics = zoomed() + optics.owner.Paralyze(2 SECONDS) + check_dropped(optics, "paralysis") + + optics = zoomed() + optics.owner.death() + check_dropped(optics, "death") + + optics = zoomed() + var/mob/living/carbon/human/bearer = optics.owner + optics.Remove(bearer, special = TRUE) + TEST_ASSERT(!HAS_TRAIT(bearer, "cyber_zoomed"), "Pulling the optics out left their bearer zoomed") + TEST_ASSERT(!bearer.has_movespeed_modifier(/datum/movespeed_modifier/cyberware_zoom), "Pulling the optics out left the walk tax on") + +/// A fresh bearer, zoomed through a fresh pair of Spyglass optics. +/datum/unit_test/voidcrew_cyberware_zoom_drops/proc/zoomed() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/eyes/robotic/cyberware/spyglass/optics = allocate(/obj/item/organ/eyes/robotic/cyberware/spyglass) + TEST_ASSERT(optics.Insert(bearer, special = TRUE), "Spyglass staging insert was refused") + optics.engage_zoom(bearer) + TEST_ASSERT(optics.is_zoomed(), "Test fixture: the zoom didn't engage") + return optics + +/datum/unit_test/voidcrew_cyberware_zoom_drops/proc/check_dropped(obj/item/organ/eyes/robotic/cyberware/optics, cause) + var/mob/living/carbon/human/bearer = optics.owner + TEST_ASSERT(!optics.is_zoomed() && !HAS_TRAIT(bearer, "cyber_zoomed"), "The zoom survived [cause]") + TEST_ASSERT(!bearer.has_movespeed_modifier(/datum/movespeed_modifier/cyberware_zoom), "The walk tax survived [cause]") + TEST_ASSERT(!(SEND_SIGNAL(bearer, COMSIG_MOB_TRYING_TO_FIRE_GUN, null, null, FALSE, null) & COMPONENT_CANCEL_GUN_FIRE), "The gun block survived [cause]") + +/// A zoomed click never reaches a click intercept, and only while zoomed. +/datum/unit_test/voidcrew_cyberware_zoom_click + +/datum/unit_test/voidcrew_cyberware_zoom_click/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/mob/living/carbon/human/far_body = allocate(/mob/living/carbon/human/consistent, run_loc_floor_top_right) + var/obj/item/organ/eyes/robotic/cyberware/lookout/optics = allocate(/obj/item/organ/eyes/robotic/cyberware/lookout) + TEST_ASSERT(optics.Insert(bearer, special = TRUE), "Lookout staging insert was refused") + + // Stand in for the scope's cursor catcher, pointed at the far body. + var/datum/component/scope/scope = optics.GetComponent(/datum/component/scope) + var/atom/movable/screen/fullscreen/cursor_catcher/scope/catcher = new + catcher.owner = bearer + catcher.given_turf = get_turf(far_body) + scope.tracker = catcher + optics.engage_zoom(bearer) + + var/datum/zoom_click_probe/probe = allocate(/datum/zoom_click_probe) + bearer.click_intercept = probe + + bearer.ClickOn(catcher, "") + TEST_ASSERT_EQUAL(probe.intercepted, 0, "An armed click intercept saw a zoomed click") + + // Out of the zoom, clicks are ordinary again. + optics.stop_zoom(bearer) + bearer.next_click = 0 + bearer.ClickOn(catcher, "") + TEST_ASSERT_EQUAL(probe.intercepted, 1, "Clicks stayed swallowed after the zoom ended") + + bearer.click_intercept = null + scope.tracker = null + qdel(catcher) + +/// The zoom button sits on the chrome wheel, and swapping optics with a +/// different number of buttons never moves the ear chrome beside them. +/datum/unit_test/voidcrew_cyberware_zoom_wheel + +/datum/unit_test/voidcrew_cyberware_zoom_wheel/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/eyes/robotic/cyberware/spyglass/cheap = allocate(/obj/item/organ/eyes/robotic/cyberware/spyglass) + TEST_ASSERT(cheap.Insert(bearer, special = TRUE), "Spyglass staging insert was refused") + var/obj/item/organ/cyberimp/cyberware/doppler/ears = allocate(/obj/item/organ/cyberimp/cyberware/doppler) + TEST_ASSERT(ears.Insert(bearer, special = TRUE), "Doppler staging insert was refused") + var/datum/action/cheap_zoom = locate(/datum/action/cooldown/cyberware/optics_zoom) in cheap.actions + var/datum/action/sonar = locate(/datum/action/item_action/organ_action/toggle) in ears.actions + TEST_ASSERT(cheap_zoom && sonar, "A staged organ is missing its button") + + var/list/abilities = get_chrome_wheel_actions(bearer) + TEST_ASSERT(cheap_zoom in abilities, "The zoom button isn't on the chrome wheel") + var/list/positions = chrome_wheel_layout(abilities) + var/list/ears_at = positions[sonar] + + // Optics with an ability of their own: three eye buttons instead of two. + var/obj/item/organ/eyes/robotic/cyberware/deadeye/milspec/link = allocate(/obj/item/organ/eyes/robotic/cyberware/deadeye/milspec) + TEST_ASSERT(link.Insert(bearer, special = TRUE), "Marksman link staging insert was refused") + abilities = get_chrome_wheel_actions(bearer) + TEST_ASSERT(!(cheap_zoom in abilities), "The pulled optics' zoom stayed on the wheel") + TEST_ASSERT(locate(/datum/action/cooldown/cyberware/optics_zoom) in abilities, "The new optics' zoom isn't on the wheel") + positions = chrome_wheel_layout(abilities) + var/list/ears_now = positions[sonar] + TEST_ASSERT(ears_at[1] == ears_now[1] && ears_at[2] == ears_now[2], "Swapping optics moved the ear chrome on the wheel") + + // All three of the link's buttons get a place of their own in the eyes + // socket: none sits on another, and none sits on any other socket's chip. + var/list/placements = chrome_wheel_placements(abilities) + var/list/eye_buttons = list() + for(var/datum/action/ability as anything in link.actions) + if(ability in abilities) + eye_buttons += ability + TEST_ASSERT_EQUAL(length(eye_buttons), 3, "The marksman link should put three buttons on the wheel") + var/list/eye_indexes = list() + for(var/datum/action/ability as anything in eye_buttons) + var/list/placement = placements[ability] + TEST_ASSERT_EQUAL(placement["socket"], "eyes", "[ability.name] is not in the eyes socket") + eye_indexes |= placement["index"] + TEST_ASSERT_EQUAL(length(eye_indexes), 3, "Two optics buttons share a place on the wheel") + for(var/datum/action/ability as anything in eye_buttons) + var/list/here = positions[ability] + for(var/datum/action/other as anything in abilities) + if(other == ability) + continue + var/list/there = positions[other] + // Chips are 22 px across (26 when pointed at). + TEST_ASSERT(sqrt((here[1] - there[1]) ** 2 + (here[2] - there[2]) ** 2) >= 24, "[ability.name] overlaps [other.name] on the wheel") + // Nor on the first places of the head socket beside it. + for(var/head_index in 1 to 2) + var/list/head_point = chrome_wheel_position("head", head_index) + TEST_ASSERT(sqrt((here[1] - head_point[1]) ** 2 + (here[2] - head_point[2]) ** 2) >= 24, "[ability.name] sits on the head socket's place [head_index]") + var/datum/action/link_zoom = locate(/datum/action/cooldown/cyberware/optics_zoom) in link.actions + TEST_ASSERT_EQUAL(link_zoom?.chrome_wheel_name(), "Zoom", "The zoom chip isn't called Zoom") + +/// Shelf prices and gates, half-list trade-ins, and cradle quotes. +/datum/unit_test/voidcrew_cyberware_zoom_catalog + +/datum/unit_test/voidcrew_cyberware_zoom_catalog/Run() + // SKU => list(item, credits, vouchers, zone permission) + var/list/skus = list( + /datum/shop_sku/ripperdoc/spyglass = list(/obj/item/organ/eyes/robotic/cyberware/spyglass, 400, 0, 0), + /datum/shop_sku/ripperdoc/assay_optics = list(/obj/item/organ/eyes/robotic/cyberware/prospector/street, 900, 0, 0), + /datum/shop_sku/ripperdoc/longsight = list(/obj/item/organ/eyes/robotic/cyberware/longsight, 2400, 0, 1), + /datum/shop_sku/ripperdoc/deadeye_milspec = list(/obj/item/organ/eyes/robotic/cyberware/deadeye/milspec, 0, 3, 2), + /datum/shop_sku/ripperdoc/lookout = list(/obj/item/organ/eyes/robotic/cyberware/lookout, 0, 3, 2), + ) + build_cyberware_price_index() + for(var/datum/shop_sku/sku_type as anything in skus) + var/list/row = skus[sku_type] + TEST_ASSERT_EQUAL(initial(sku_type.item_path), row[1], "[sku_type] sells the wrong optics") + TEST_ASSERT_EQUAL(initial(sku_type.price_credits), row[2], "[sku_type] has the wrong credit price") + TEST_ASSERT_EQUAL(initial(sku_type.price_vouchers), row[3], "[sku_type] has the wrong voucher price") + TEST_ASSERT_EQUAL(initial(sku_type.zone_permission), row[4], "[sku_type] has the wrong reputation gate") + var/obj/item/organ/optics = allocate(row[1]) + var/list/quote = get_cyberware_price(optics) + TEST_ASSERT(quote && (quote["credits"] > 0 || quote["vouchers"] > 0), "The cradle quotes no price for [row[1]]") + + // Trade-in => the SKU it pays half of. + var/list/trade_ins = list( + /datum/shop_buyback/ripperdoc/spyglass = /datum/shop_sku/ripperdoc/spyglass, + /datum/shop_buyback/ripperdoc/assay_optics = /datum/shop_sku/ripperdoc/assay_optics, + /datum/shop_buyback/ripperdoc/longsight = /datum/shop_sku/ripperdoc/longsight, + /datum/shop_buyback/ripperdoc/spyglass/street_doc = /datum/shop_sku/ripperdoc/spyglass, + /datum/shop_buyback/ripperdoc/assay_optics/street_doc = /datum/shop_sku/ripperdoc/assay_optics, + /datum/shop_buyback/ripperdoc/longsight/street_doc = /datum/shop_sku/ripperdoc/longsight, + ) + for(var/buyback_type in trade_ins) + var/datum/shop_buyback/ledger = allocate(buyback_type) + var/datum/shop_sku/sku_type = trade_ins[buyback_type] + TEST_ASSERT_EQUAL(ledger.item_path, initial(sku_type.item_path), "[buyback_type] buys something its shelf doesn't sell") + TEST_ASSERT(!ledger.match_subtypes, "[buyback_type] buys subtypes too") + TEST_ASSERT_EQUAL(ledger.pay_credits * 2, initial(sku_type.price_credits), "[buyback_type] doesn't pay half list") + TEST_ASSERT(!ledger.pay_vouchers, "[buyback_type] pays vouchers") diff --git a/wiki/content/cyberware.md b/wiki/content/cyberware.md index b626d765f56..8b98378c3a1 100644 --- a/wiki/content/cyberware.md +++ b/wiki/content/cyberware.md @@ -124,6 +124,10 @@ The newer makers fill in the gaps under the big names. Each takes the same slot - **Thumper ear**: a louder, shorter-ranged sonar behind the ear. - Quiet pieces with no button: the **Clotter node** slows bleeding, the **Adrenal pump** kicks in when you're about to drop, **Medic's palms** and **Cuffer's wrists** do the glove's job without the glove, the **Subvocal mic** keeps your radio talk from the people next to you, and the **Muffler ear** shuts out a bang. +## Optics and zoom + +Every pair of chrome eyes can zoom: focus on something far off and your view pulls toward it. Better eyes see further, and cheap ones make you slow while you look. Nobody shoots straight through a zoom, so you have to look up before you fire. A flash, a stun or an EMP snaps you out of it. Spyglass and assay optics are the cheap way in; the Longsight, the marksman link and the Lookout are what scouts and sharpshooters save for. + ## Finding chrome in the wild Most of the roster also appears in zone loot caches. Street and utility chrome appears among themed supplies. Weapon chrome uses the cache's weapon roll; Popup Ronin and Bunker Buster housings are plunder-cache loot rather than trader stock. Higher zones improve the odds of stronger chrome. The exceptions: Legend chrome and ammunition never drop, the Skyhook drops *only* in expedition caches, and the Meteor Piledriver comes from eligible guarded mission prizes, including hunts and lair trophies. From c24cf3ed55a746d96533d8c78981958d41657875 Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Sun, 15 Nov 2026 16:36:56 -0800 Subject: [PATCH 04/29] Prison inmates, guards and experiment subjects are people The prison wing's NPCs are now human NPCs (/mob/living/carbon/human/npc): real human bodies with tg's own crit, wounds, cuffs, medicine and death. - Inmates, the guards and their routine, and Kessler's visiting agents and researcher. A guard who is beaten down beams out and comes back. - Experiment subjects turn on their own body: the hulk, the nightmare and the fly person bleed, go into crit and can be cuffed, drugged and revived. Kessler's team darts a living one and takes it away. - Guards get out of the line of stun fire and go back to their routine. - A prisoner who breaks out walks the outpost's patrol path as a person and fights with their fists. - The basic-mob prisoner and guard types are removed, with the bounty cuff and damage multipliers they carried. --- tgstation.dme | 4 + .../_DEFINES/outpost_prison_boss_moves.dm | 5 +- voidcrew/_DEFINES/outpost_prison_bounty.dm | 22 +- .../_DEFINES/outpost_prison_changeling.dm | 2 + .../_DEFINES/outpost_prison_conditions.dm | 3 - .../_DEFINES/outpost_prison_experiments.dm | 83 +- voidcrew/_DEFINES/outpost_prison_guards.dm | 22 +- voidcrew/_DEFINES/outpost_prison_needs.dm | 6 +- voidcrew/_DEFINES/outpost_prison_trouble.dm | 35 +- voidcrew/_HELPERS/hostile_creatures.dm | 11 +- voidcrew/modules/bounties/bounty_admin.dm | 2 +- .../modules/npc_ships/code/outpost_patrol.dm | 27 +- .../player_outposts/outpost_admin_prison.dm | 55 +- .../player_outposts/outpost_npc_looks.dm | 86 +- .../outpost_prison_ambience.dm | 42 +- .../outpost_prison_boss_moves.dm | 192 ++- .../player_outposts/outpost_prison_bounty.dm | 110 +- .../player_outposts/outpost_prison_breach.dm | 198 +++ .../outpost_prison_breakout.dm | 20 +- .../player_outposts/outpost_prison_capture.dm | 229 ++- .../outpost_prison_changeling.dm | 107 +- .../outpost_prison_conditions.dm | 32 +- .../outpost_prison_containment.dm | 49 +- .../outpost_prison_contraband.dm | 96 +- .../player_outposts/outpost_prison_core.dm | 76 +- .../outpost_prison_creatures.dm | 1275 +---------------- .../outpost_prison_dialogue.dm | 46 +- .../player_outposts/outpost_prison_doors.dm | 2 +- .../player_outposts/outpost_prison_economy.dm | 34 +- .../outpost_prison_experiment_forms.dm | 1256 ++++++++++++++++ .../outpost_prison_experiments.dm | 356 +++-- .../player_outposts/outpost_prison_extras.dm | 22 +- .../outpost_prison_fixtures.dm | 4 +- .../outpost_prison_guard_combat_sense.dm | 30 + .../outpost_prison_guard_routine.dm | 196 ++- .../player_outposts/outpost_prison_guards.dm | 515 ++++--- .../player_outposts/outpost_prison_horror.dm | 26 +- .../outpost_prison_incidents.dm | 84 +- .../player_outposts/outpost_prison_leads.dm | 52 +- .../player_outposts/outpost_prison_life.dm | 110 +- .../player_outposts/outpost_prison_mail.dm | 56 +- .../outpost_prison_npc_bodies.dm | 120 ++ .../player_outposts/outpost_prison_panic.dm | 62 +- .../outpost_prison_pastimes.dm | 130 +- .../outpost_prison_prisoner.dm | 541 +++---- .../outpost_prison_researcher.dm | 245 ++-- .../player_outposts/outpost_prison_riot.dm | 198 ++- .../player_outposts/outpost_prison_routine.dm | 66 +- .../outpost_prison_security.dm | 87 +- .../player_outposts/outpost_prison_serum.dm | 8 +- .../player_outposts/outpost_prison_social.dm | 34 +- .../player_outposts/outpost_prison_trouble.dm | 398 +++-- .../player_outposts/outpost_prison_warden.dm | 6 +- .../outpost_prison_warden_tools.dm | 96 +- .../outpost_prison_wing_events.dm | 4 +- .../unit_tests/voidcrew_bounty_admin.dm | 2 +- .../unit_tests/voidcrew_bounty_seams.dm | 7 +- .../unit_tests/voidcrew_npc_zone_profiles.dm | 2 +- .../unit_tests/voidcrew_outpost_npc_looks.dm | 15 - .../unit_tests/voidcrew_outpost_patrol.dm | 15 +- .../voidcrew_outpost_prison_admin.dm | 54 +- .../voidcrew_outpost_prison_bounty.dm | 164 +-- .../voidcrew_outpost_prison_breakout.dm | 22 +- .../voidcrew_outpost_prison_built_turrets.dm | 62 +- .../voidcrew_outpost_prison_capture.dm | 173 ++- .../voidcrew_outpost_prison_changeling.dm | 22 +- .../voidcrew_outpost_prison_conditions.dm | 38 +- .../voidcrew_outpost_prison_containment.dm | 71 +- .../voidcrew_outpost_prison_contraband.dm | 40 +- .../voidcrew_outpost_prison_dialogue.dm | 10 +- .../voidcrew_outpost_prison_economy.dm | 60 +- .../voidcrew_outpost_prison_events.dm | 45 +- .../voidcrew_outpost_prison_experiments.dm | 532 ++++--- .../voidcrew_outpost_prison_extension.dm | 12 +- .../voidcrew_outpost_prison_extras.dm | 2 +- .../voidcrew_outpost_prison_guards.dm | 176 ++- .../voidcrew_outpost_prison_helpers.dm | 45 +- .../voidcrew_outpost_prison_leads.dm | 24 +- .../voidcrew_outpost_prison_life.dm | 68 +- .../voidcrew_outpost_prison_needs.dm | 96 +- .../voidcrew_outpost_prison_panic.dm | 30 +- .../voidcrew_outpost_prison_security.dm | 8 +- .../voidcrew_outpost_prison_social.dm | 102 +- .../voidcrew_outpost_prison_staff.dm | 2 +- .../voidcrew_outpost_prison_trouble.dm | 362 ++--- wiki/content/prison-wing.md | 10 +- 86 files changed, 5453 insertions(+), 4391 deletions(-) create mode 100644 voidcrew/modules/player_outposts/outpost_prison_breach.dm create mode 100644 voidcrew/modules/player_outposts/outpost_prison_experiment_forms.dm create mode 100644 voidcrew/modules/player_outposts/outpost_prison_guard_combat_sense.dm create mode 100644 voidcrew/modules/player_outposts/outpost_prison_npc_bodies.dm diff --git a/tgstation.dme b/tgstation.dme index 2555f50033e..7c88c7e4848 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -7564,6 +7564,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" @@ -7575,10 +7576,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" @@ -7586,6 +7589,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/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 30e616a1de2..0561a69e0c2 100644 --- a/voidcrew/_HELPERS/hostile_creatures.dm +++ b/voidcrew/_HELPERS/hostile_creatures.dm @@ -65,14 +65,15 @@ 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), 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). diff --git a/voidcrew/modules/bounties/bounty_admin.dm b/voidcrew/modules/bounties/bounty_admin.dm index 3ba9fa629c4..3fe28acdb79 100644 --- a/voidcrew/modules/bounties/bounty_admin.dm +++ b/voidcrew/modules/bounties/bounty_admin.dm @@ -1195,7 +1195,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)]") 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/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_
    J1ob!{2dMzo_cl}8` zjWA2e6UFA2rf%j|R%wjaE*+CG|ktQ{H`@{yzLk{4<$T3fp|#Ks#0cG4G)bV9k}Naqi;P9Xc0*;^Dwyfkmmx^zL>ONd@(0 zPtCUQW z;FpP~=f#(#AA6od+oBm`FEae~HGWJD+d0u*9G01;Y@@esaD&kASw@`(RJC+?j9R^< z5xOyyGH_t_(mm_m03^ig+vTriE`;-0guE-euO*al9gGs^eA1!@xfbZa5dDB4@MAk~%C5%YUAsz+=*zv;RL4*DY;rHpuig_p3vKuPa%zPu zc0Kg{DMD54T%opqT`$T0N?!TxE)I5-ym?A|x2;|Or`?Nsuxl||&Ke?o8W!&^+X?;V zU6(&>J=eU{yTSUaCDK;)^ohCtFimYinMfZ&U9B_WCRA_XPwhbEc$|9Dtr;(~g z7kbYepkJOUaft1V`mz6nCr{_OPt}9_gev)u2MU|vzhvJ~T~jLFxL!f8#LJ;H7;{Ht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g1F+eWkpM literal 0 HcmV?d00001 diff --git a/voidcrew/modules/hyperviolence_gorilla/sound/gorilla_piston_punch3.ogg b/voidcrew/modules/hyperviolence_gorilla/sound/gorilla_piston_punch3.ogg new file mode 100644 index 0000000000000000000000000000000000000000..ba7bd00f79d3023bfd277ca7a48e42f1f3fdaea6 GIT binary patch literal 8346 zcmb7oc|6qL_y22T581b*v4oL*3nAH!Y{S^cKC(^Lu|_I1gwT*QyoIr4Ez28`3S%9{ zGO{N{(QfNqs_$!fe?GtW=l92VxsN+{&gIz|a8#Fato6_yxh2dR%;mBR7EATI){=F0~F^gt4fxiI{t!A94fsL&dht*|VK zMx~@F;e}Fk^X6PO#cnScZ0N3wGP64~0HD|OnZ=TM5oTg3|7u{w0`GKKMS=GatWqRm zM41G=&Y}Ib{I-n&3#{A*E?ZrWN5JK&E)gHQm=+^Go&N?+<}?6>{Hr;z0}8$i$n-s6 z(j*_sJ2VRlB!R8~%yW2$n?yz_BBNhK#<)(|a-X88$WJ2F?NoJ<_QuopNJk_J6^)sW z!c6C5W*iO(2aIzoX8u3xf$2~PP$Hp~D*?+Dhvlwn=F%sp*3tpKG?$dfq_1jby*A4_ z6_D!}n}0E_uLVmc;c})CYNQAq(?}yyjF+250HuP(S3LDpI)1e1kU2@z!2(A~b0yW@osWOKGc;vp5w zeUGWGdIIDLtrIxmablH(a8}u>^4xUUA(=-bD#LQL zruI2md$aL5ry-ki^8{Q@ecHh%vt_L~qF&1^h}c4PIZXru97a4u6u78R-|X{@LI?Or zEeHouQF4v-p9}X{a*XQ)7AjzZ72qFvh(oLdu?_x@35u>V932pe&&tW~rBL{8Q# z%`6G?TuJ9#sRQIx-z|PuUHbnar^G+KvLL+@m%fh6l1a-CNGq&qFAW~5-|YAw>%Wl$ z0tT$c2ub7rKu(Xch#?4`hjNx%hc@a`z}+FzSm2)v002GNY!y5nWjMtbZp+iPRp+SO*nqApf@+(Kf{16ZnGdFD{eGHd?4&Srz$S?Xr2UpZ021f zTo~vyV}K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MB< zlpMNmRn=L2wd&aSL?lPQ<+JT~2A%nIf}T?sm2U*?7kb_CQo)Bg7#{iMzZfz@XMF~L z+|dC59E`-9a-sQq8*nM0I|JwmBi~Z0`Nb73A2)Une)Y-3s(3=z&RI z{k}bRQz96}e1P9ks7`aINL+le(191<-r__{mhuFR zr2_gf*?_1fs(zl6p{BA0&j*xbHFxlcl{!{S)xcp&kLiG^FL&=R<~NPjEc!5t*!O-v zzoOWwGV;Pxwq-j_P0hFTO?Zij_gI*RNspdB?uU@c@AHoNg+4z0L(mHu(&UcQg=Zg4 z=zY@Zjf%OU_D9Vdm01U)9yD*@xrsX!FPN~|MPlzvZ~wXTu6eI0TH$nAj7;nCZ|7gf zJrLD13aJ0lY#LhP^30dbis2SLaPZlI{))%{`|JRIHv!59R`lrWN+Kb8FWf3E_GBZT zHG|mmG)`@1w^#H*5-&0?F#+R!!kae-B{B(u5&9mioI-DDvGs-6<13o%a#B&Yp4Q zw_QDn@4d98_?-z6FPS9+HjgUfM7h91kMzi&KU}xq;+&p<&S87Iz{c>_8 zVCGxsX>tRvNcE^PRW-i#P53BfK=>ot>wNHEXKg9WM9Po(fwe8yn>N8D{^_@0^WT0x zQntDx-XO#COwAc8t(Skva0A}L0zpn(SY~_5E zvsi{dVQ~2@nyt4Uxn{-qy}dj+rLO*0r%4obH@EjUzqaU(mR(kiICeuF8Yb;Y ebd its type before the test changed it. Put back when the test ends, however it ends. + var/list/changed_turfs + /// The outpost PvP enforcement a test swapped out, put back when it ends + var/datum/outpost_pvp_enforcement/real_enforcement + +/datum/unit_test/voidcrew_gorilla_gore/Destroy() + for(var/turf/changed as anything in changed_turfs) + clear_mess(changed) + changed.ChangeTurf(changed_turfs[changed]) + changed_turfs = null + if(real_enforcement) + GLOB.outpost_pvp_enforcement = real_enforcement + real_enforcement = null + return ..() + +/// Changes [target] to [new_type], remembering what it was so the test puts it back +/datum/unit_test/voidcrew_gorilla_gore/proc/change_turf(turf/target, new_type) + LAZYINITLIST(changed_turfs) + if(!changed_turfs[target]) + changed_turfs[target] = target.type + clear_mess(target) + return target.ChangeTurf(new_type) + +/// Puts a changed turf back now +/datum/unit_test/voidcrew_gorilla_gore/proc/restore_turf(turf/target) + var/old_type = changed_turfs?[target] + if(!old_type) + return + changed_turfs -= target + clear_mess(target) + target.ChangeTurf(old_type) + +/// Blood and other decals listen on their turf; a turf changed under them keeps the listener and the +/// decal can never be deleted cleanly. So the floor is wiped before it changes. +/datum/unit_test/voidcrew_gorilla_gore/proc/clear_mess(turf/target) + for(var/obj/effect/decal/cleanable/mess in target) + qdel(mess) + +/// The floor `dx`, `dy` tiles from the test room's bottom-left corner +/datum/unit_test/voidcrew_gorilla_gore/proc/spot(dx, dy) + return locate(run_loc_floor_bottom_left.x + dx, run_loc_floor_bottom_left.y + dy, run_loc_floor_bottom_left.z) + +/// A human with a pair of Gorilla Arms (or Brawler myomers with [street]) at `where`, in combat mode +/datum/unit_test/voidcrew_gorilla_gore/proc/gorilla(turf/where, street = FALSE) + var/mob/living/carbon/human/consistent/bearer = allocate(/mob/living/carbon/human/consistent, where) + var/right_type = street ? /obj/item/organ/cyberimp/cyberware/gorilla_arms/street : /obj/item/organ/cyberimp/cyberware/gorilla_arms + var/left_type = street ? /obj/item/organ/cyberimp/cyberware/gorilla_arms/street/left : /obj/item/organ/cyberimp/cyberware/gorilla_arms/left + var/obj/item/organ/right = allocate(right_type) + var/obj/item/organ/left = allocate(left_type) + TEST_ASSERT(right.Insert(bearer, special = TRUE), "Test fixture: the right arm wouldn't go in") + TEST_ASSERT(left.Insert(bearer, special = TRUE), "Test fixture: the left arm wouldn't go in") + bearer.set_combat_mode(TRUE) + return bearer + +/// The bearer's arm on [zone] +/datum/unit_test/voidcrew_gorilla_gore/proc/arm(mob/living/carbon/bearer, zone = BODY_ZONE_R_ARM) + for(var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm in bearer.organs) + if(arm.zone == zone) + return arm + +/// One punch from the right arm at [target], with the arm's own clock reset first +/datum/unit_test/voidcrew_gorilla_gore/proc/punch(mob/living/carbon/human/bearer, atom/target, zone = BODY_ZONE_R_ARM) + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/fist = arm(bearer, zone) + bearer.swap_hand(zone == BODY_ZONE_L_ARM ? 1 : 2, silent = TRUE) + COOLDOWN_RESET(fist, slam_cooldown) + bearer.next_move = 0 + return fist.on_punch(bearer, target, TRUE, null) + +/// A human at `where`, stunned flat +/datum/unit_test/voidcrew_gorilla_gore/proc/downed(turf/where) + var/mob/living/carbon/human/consistent/victim = allocate(/mob/living/carbon/human/consistent, where) + victim.Paralyze(100 SECONDS) + return victim + +/// Every chrome puppet left anywhere in the test room, and every body's stand-in (what shows until a client has the puppets' pictures) +/datum/unit_test/voidcrew_gorilla_gore/proc/puppets_left() + . = 0 + for(var/turf/floor in block(run_loc_floor_bottom_left, run_loc_floor_top_right)) + for(var/obj/effect/abstract/chrome_puppet/puppet in floor) + .++ + for(var/obj/effect/abstract/chrome_rig_stand_in/stand_in in floor) + .++ + +// ========================================================================= +// THE SAFE PATH +// ========================================================================= + +/// A knockback stops on the last good tile before space, glass and a door, hits a wall or a standing +/// body, and never launches from a tile without gravity. +/datum/unit_test/voidcrew_gorilla_gore/safe_path + +/datum/unit_test/voidcrew_gorilla_gore/safe_path/Run() + var/mob/living/carbon/human/consistent/victim = allocate(/mob/living/carbon/human/consistent, spot(0, 0)) + // Clear floor: the full reach + var/list/plan = gorilla_plan_knockback(victim, EAST, 3) + TEST_ASSERT_EQUAL(plan[2], 3, "A clear floor didn't take the full knockback") + TEST_ASSERT_EQUAL(plan[1], spot(3, 0), "A clear knockback landed on the wrong tile") + + // Space two tiles out: stop on the tile before it + var/turf/hole = spot(2, 0) + change_turf(hole, /turf/open/space) + plan = gorilla_plan_knockback(victim, EAST, 4) + restore_turf(hole) + TEST_ASSERT_EQUAL(plan[2], 1, "A knockback went into space") + TEST_ASSERT_EQUAL(plan[3], 3, "A knockback into space didn't stop short") // GORILLA_THROW_SHORT + + // Glass in the way: stop before it, and nothing hits the glass + var/obj/structure/window/fulltile/glass = allocate(/obj/structure/window/fulltile, spot(2, 0)) + plan = gorilla_plan_knockback(victim, EAST, 4) + TEST_ASSERT_EQUAL(plan[2], 1, "A knockback went through a window") + TEST_ASSERT_EQUAL(plan[3], 3, "A knockback hit a window") // GORILLA_THROW_SHORT + qdel(glass) + + // A door: the same + var/obj/machinery/door/airlock/door = allocate(/obj/machinery/door/airlock, spot(1, 0)) + plan = gorilla_plan_knockback(victim, EAST, 4) + TEST_ASSERT_EQUAL(plan[2], 0, "A knockback went into a door") + qdel(door) + + // A wall: hit it + var/turf/wall = spot(2, 0) + change_turf(wall, /turf/closed/wall) + plan = gorilla_plan_knockback(victim, EAST, 4) + restore_turf(wall) + TEST_ASSERT_EQUAL(plan[3], 1, "A knockback into a wall didn't hit it") // GORILLA_THROW_WALL + TEST_ASSERT_EQUAL(plan[4], wall, "A knockback hit the wrong wall") + + // A standing body in the way: hit it + var/mob/living/carbon/human/consistent/bystander = allocate(/mob/living/carbon/human/consistent, spot(2, 0)) + plan = gorilla_plan_knockback(victim, EAST, 4) + TEST_ASSERT_EQUAL(plan[3], 2, "A knockback didn't hit the body in the way") // GORILLA_THROW_MOB + TEST_ASSERT_EQUAL(plan[4], bystander, "A knockback hit the wrong body") + qdel(bystander) + + // No gravity under the victim: no launch at all + var/turf/start = spot(0, 0) + change_turf(start, /turf/open/space) + plan = gorilla_plan_knockback(victim, EAST, 4) + restore_turf(start) + TEST_ASSERT_EQUAL(plan[2], 0, "A body was launched from a tile without gravity") + +// ========================================================================= +// THE PUNCH +// ========================================================================= + +/// The punch goes through #509 as one message, counts as aggression at an outpost, and the shove +/// rides the safe path. +/datum/unit_test/voidcrew_gorilla_gore/punch + +/datum/unit_test/voidcrew_gorilla_gore/punch/Run() + var/mob/living/carbon/human/bearer = gorilla(spot(0, 0)) + var/mob/living/carbon/human/consistent/victim = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + real_enforcement = GLOB.outpost_pvp_enforcement + var/datum/outpost_pvp_enforcement/gorilla_spy/spy = new + GLOB.outpost_pvp_enforcement = spy + var/hurt_before = victim.getBruteLoss() + var/punched = punch(bearer, victim) + // The blow lands when the fist is there: 0.1 s (GORILLA_THRUST_LANDS) + sleep(0.3 SECONDS) + GLOB.outpost_pvp_enforcement = real_enforcement + real_enforcement = null + TEST_ASSERT_EQUAL(punched, COMPONENT_CANCEL_ATTACK_CHAIN, "The Gorilla arm didn't take the punch") + TEST_ASSERT(victim.getBruteLoss() > hurt_before, "The piston punch did no damage") + TEST_ASSERT_NULL(victim.hv_hit, "The punch left its attack line held") + TEST_ASSERT(length(spy.hits) && spy.hits[1] == victim, "A piston punch wasn't counted as aggression") + qdel(spy) + + // The shove never goes into a hazard (lava here: a space hole would vent the room and the wind would do it) + var/turf/hole = spot(2, 0) + victim.forceMove(spot(1, 0)) + victim.set_resting(FALSE, instant = TRUE) + change_turf(hole, /turf/open/lava/smooth) + punch(bearer, victim) + sleep(1 SECONDS) + var/landed_in = victim.loc + restore_turf(hole) + TEST_ASSERT_NOTEQUAL(landed_in, hole, "The piston punch knocked someone into lava") + +/// Records aggression instead of judging it +/datum/outpost_pvp_enforcement/gorilla_spy + var/list/hits = list() + +/datum/outpost_pvp_enforcement/gorilla_spy/New() + return + +/datum/outpost_pvp_enforcement/gorilla_spy/register_pvp_aggression(mob/living/victim, mob/living/offender) + hits += victim + +/// Three piston hits on one arm snap it (four from Brawler myomers); heavy armour or the Atlas frame stops it. +/datum/unit_test/voidcrew_gorilla_gore/bone_breakers + +/datum/unit_test/voidcrew_gorilla_gore/bone_breakers/Run() + var/mob/living/carbon/human/bearer = gorilla(spot(0, 0)) + var/mob/living/carbon/human/consistent/victim = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + var/obj/item/bodypart/arm = victim.get_bodypart(BODY_ZONE_L_ARM) + for(var/i in 1 to 2) + gorilla_add_strain(victim, BODY_ZONE_L_ARM, bearer, 3, null, EAST) + TEST_ASSERT_NULL(arm.get_wound_type(/datum/wound/blunt/bone/critical), "An arm snapped before the third hit") + TEST_ASSERT(gorilla_add_strain(victim, BODY_ZONE_L_ARM, bearer, 3, null, EAST), "The third piston hit didn't snap the arm") + TEST_ASSERT_NOTNULL(arm.get_wound_type(/datum/wound/blunt/bone/critical), "A snapped arm has no compound fracture") + TEST_ASSERT("snap_l_arm_bone" in victim.hv_gore_states() + gorilla_snap_states(victim), "A snapped arm shows no bone") + + // The head never snaps + for(var/i in 1 to 4) + TEST_ASSERT(!gorilla_add_strain(victim, BODY_ZONE_HEAD, bearer, 3, null, EAST), "A head snapped") + + // Brawler myomers take four + var/mob/living/carbon/human/consistent/second = allocate(/mob/living/carbon/human/consistent, spot(1, 1)) + for(var/i in 1 to 3) + TEST_ASSERT(!gorilla_add_strain(second, BODY_ZONE_R_LEG, bearer, 4, null, EAST), "A Brawler snapped a leg early") + TEST_ASSERT(gorilla_add_strain(second, BODY_ZONE_R_LEG, bearer, 4, null, EAST), "The fourth Brawler hit didn't snap the leg") + + // Heavy melee armour on the limb stops it + var/mob/living/carbon/human/consistent/armoured = allocate(/mob/living/carbon/human/consistent, spot(1, 2)) + armoured.physiology.armor = armoured.physiology.armor.generate_new_with_modifiers(list(MELEE = 60)) + for(var/i in 1 to 3) + gorilla_add_strain(armoured, BODY_ZONE_R_ARM, bearer, 3, null, EAST) + TEST_ASSERT_NULL(armoured.get_bodypart(BODY_ZONE_R_ARM).get_wound_type(/datum/wound/blunt/bone/critical), "Heavy armour didn't stop a snap") + + // So does the Atlas frame + var/mob/living/carbon/human/consistent/framed = allocate(/mob/living/carbon/human/consistent, spot(2, 2)) + var/obj/item/organ/atlas = allocate(/obj/item/organ/cyberimp/cyberware/atlas) + TEST_ASSERT(atlas.Insert(framed, special = TRUE), "Test fixture: the Atlas frame wouldn't go in") + for(var/i in 1 to 3) + gorilla_add_strain(framed, BODY_ZONE_R_ARM, bearer, 3, null, EAST) + TEST_ASSERT_NULL(framed.get_bodypart(BODY_ZONE_R_ARM).get_wound_type(/datum/wound/blunt/bone/critical), "The Atlas frame let an arm snap") + +/// The snapped-bone states drawn on [victim] now +/proc/gorilla_snap_states(mob/living/carbon/victim) + . = list() + for(var/image/snap as anything in victim.gorilla_snap_overlays) + . += snap.icon_state + +/// A grabbed body is hurled once per grab-move cooldown; the next grabbed punch holds them. +/datum/unit_test/voidcrew_gorilla_gore/hurl_cooldown + +/datum/unit_test/voidcrew_gorilla_gore/hurl_cooldown/Run() + var/mob/living/carbon/human/bearer = gorilla(spot(0, 0)) + var/mob/living/carbon/human/consistent/victim = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + victim.grabbedby(bearer, supress_message = TRUE) + victim.grabbedby(bearer, supress_message = TRUE) + TEST_ASSERT(bearer.grab_state >= GRAB_AGGRESSIVE, "Test fixture: no aggressive grab") + punch(bearer, victim) + sleep(0.3 SECONDS) // the fist arrives + TEST_ASSERT(!TIMER_COOLDOWN_FINISHED(bearer, "gorilla_grab_move"), "A hurl didn't start the grab-move cooldown") // COOLDOWN_GORILLA_GRAB_MOVE + sleep(1 SECONDS) + TEST_ASSERT_NOTEQUAL(victim.loc, spot(1, 0), "A grabbed body wasn't hurled") + // Grab them again: no second hurl inside the cooldown + victim.forceMove(spot(1, 0)) + victim.SetAllImmobility(0) + victim.grabbedby(bearer, supress_message = TRUE) + victim.grabbedby(bearer, supress_message = TRUE) + punch(bearer, victim) + sleep(0.8 SECONDS) + TEST_ASSERT_EQUAL(victim.loc, spot(1, 0), "A grabbed body was hurled twice inside the cooldown") + +// ========================================================================= +// WALL IMPACTS (owner D38) +// ========================================================================= + +/// The mark a wall impact leaves follows the injury: a dent with no broken skin, a floor half-moon and +/// edge smear for a bleeding cut, a spray and runs for a heavy one. +/datum/unit_test/voidcrew_gorilla_gore/wall_impact + +/datum/unit_test/voidcrew_gorilla_gore/wall_impact/Run() + var/turf/wall_spot = spot(2, 0) + change_turf(wall_spot, /turf/closed/wall) + var/turf/closed/wall/wall = spot(2, 0) + var/mob/living/carbon/human/consistent/victim = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + + // Unhurt: a dent, no blood + TEST_ASSERT_EQUAL(victim.gorilla_splat_kind(), 1, "An unhurt body doesn't dent") // GORILLA_SPLAT_DENT + var/dents_before = LAZYLEN(wall.dent_decals) + victim.gorilla_wall_impact(wall, null) + TEST_ASSERT_EQUAL(LAZYLEN(wall.dent_decals), dents_before + 1, "An unhurt impact left no dent") + + // A bleeding cut: the half-moon and the edge + var/obj/item/bodypart/chest = victim.get_bodypart(BODY_ZONE_CHEST) + var/datum/wound/slash/flesh/moderate/cut = new + cut.apply_wound(chest, silent = TRUE) + TEST_ASSERT_EQUAL(victim.gorilla_splat_kind(), 2, "A bleeding cut doesn't splash") // GORILLA_SPLAT_EDGE + victim.gorilla_wall_impact(wall, null) + TEST_ASSERT_NOTNULL(locate(/obj/effect/decal/cleanable/blood/hv_spray/gorilla_splash) in spot(1, 0), "A bleeding impact left no half-moon") + TEST_ASSERT_NOTNULL(locate(/obj/effect/decal/cleanable/blood/hv_spray/wall/gorilla_spray/edge) in spot(1, 0), "A bleeding impact left no edge smear") + + // A heavy cut: the spray and the runs + var/datum/wound/slash/flesh/severe/gash = new + gash.apply_wound(victim.get_bodypart(BODY_ZONE_L_ARM), silent = TRUE) + TEST_ASSERT_EQUAL(victim.gorilla_splat_kind(), 3, "A heavy cut doesn't spray") // GORILLA_SPLAT_SPRAY + victim.gorilla_wall_impact(wall, null) + TEST_ASSERT_NOTNULL(locate(/obj/effect/decal/cleanable/blood/hv_spray/wall/gorilla_spray) in spot(1, 0), "A heavy impact left no spray") + TEST_ASSERT_NOTNULL(locate(/obj/effect/decal/cleanable/blood/hv_spray/wall/gorilla_spray/runs) in spot(1, 0), "A heavy impact left no runs") + // Twice on the same wall face refreshes, never stacks + victim.gorilla_wall_impact(wall, null) + var/sprays = 0 + for(var/obj/effect/decal/cleanable/blood/hv_spray/wall/gorilla_spray/spray in spot(1, 0)) + if(spray.type == /obj/effect/decal/cleanable/blood/hv_spray/wall/gorilla_spray) + sprays++ + TEST_ASSERT_EQUAL(sprays, 1, "Wall sprays stacked") + +/// A Gorilla throw's wall crash wounds through tg (owner D48): a shove only dents; a haymaker into a wall +/// wounds an unhurt body and the mark follows the wound it caused; an already-bleeding body sprays; a hurl +/// through the real throw_impact deals the crash's own damage instead of tg's random-limb crash. +/datum/unit_test/voidcrew_gorilla_gore/wall_crash + +/datum/unit_test/voidcrew_gorilla_gore/wall_crash/Run() + var/turf/wall_spot = spot(2, 0) + change_turf(wall_spot, /turf/closed/wall) + var/turf/closed/wall/wall = spot(2, 0) + var/mob/living/carbon/human/consistent/thrower = allocate(/mob/living/carbon/human/consistent, spot(0, 2)) + + // A light shove: a dent, nothing else + var/mob/living/carbon/human/consistent/shoved = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + var/datum/gorilla_flight/shove = new(shoved, thrower, FALSE, FALSE, 1) // GORILLA_IMPACT_SHOVE + var/dents_before = LAZYLEN(wall.dent_decals) + shoved.gorilla_wall_impact(wall, shove) + shove.end() + TEST_ASSERT_EQUAL(LAZYLEN(wall.dent_decals), dents_before + 1, "A shove into a wall left no dent") + TEST_ASSERT_EQUAL(shoved.getBruteLoss(), 0, "A shove into a wall did damage") + TEST_ASSERT_EQUAL(length(shoved.all_wounds), 0, "A shove into a wall wounded") + TEST_ASSERT(!shoved.IsParalyzed(), "A shove into a wall knocked them down") + TEST_ASSERT_NULL(locate(/obj/effect/decal/cleanable/blood/hv_spray) in spot(1, 0), "A shove into a wall left blood") + qdel(shoved) + + // A haymaker into the wall: a real wound on an unhurt body, and the mark that wound calls for. The roll + // is tg's, so a few fresh bodies get a go; each must match its own wounds. + var/wounded_one = FALSE + for(var/attempt in 1 to 6) + var/mob/living/carbon/human/consistent/victim = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + var/datum/gorilla_flight/flight = new(victim, thrower, TRUE, FALSE) + TEST_ASSERT_EQUAL(flight.impact, 3, "A haymaker flight isn't a haymaker impact") // GORILLA_IMPACT_HAYMAKER + victim.gorilla_wall_impact(wall, flight) + flight.end() + TEST_ASSERT(victim.getBruteLoss() > 0, "A haymaker into a wall did no damage") + TEST_ASSERT(victim.IsParalyzed(), "A haymaker into a wall didn't knock them down") + var/kind = victim.gorilla_splat_kind() + if(kind == 3) // GORILLA_SPLAT_SPRAY + TEST_ASSERT_NOTNULL(locate(/obj/effect/decal/cleanable/blood/hv_spray/wall/gorilla_spray/runs) in spot(1, 0), "A haymaker that tore a heavy wound left no spray") + else if(kind == 2) // GORILLA_SPLAT_EDGE + TEST_ASSERT_NOTNULL(locate(/obj/effect/decal/cleanable/blood/hv_spray/gorilla_splash) in spot(1, 0), "A haymaker that split the skin left no half-moon") + else + TEST_ASSERT_NULL(locate(/obj/effect/decal/cleanable/blood/hv_spray) in spot(1, 0), "A haymaker with no broken skin left blood") + if(length(victim.all_wounds)) + wounded_one = TRUE + qdel(victim) + clear_mess(spot(1, 0)) + if(wounded_one) + break + TEST_ASSERT(wounded_one, "Six haymakers into a wall never wounded an unhurt body") + + // Already bleeding hard: the spray up the wall + var/mob/living/carbon/human/consistent/bleeder = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + var/datum/wound/slash/flesh/severe/gash = new + gash.apply_wound(bleeder.get_bodypart(BODY_ZONE_L_ARM), silent = TRUE) + var/datum/gorilla_flight/slam = new(bleeder, thrower, TRUE, FALSE) + bleeder.gorilla_wall_impact(wall, slam) + slam.end() + TEST_ASSERT_NOTNULL(locate(/obj/effect/decal/cleanable/blood/hv_spray/wall/gorilla_spray) in spot(1, 0), "A bleeding body slammed into a wall left no spray") + TEST_ASSERT_NOTNULL(locate(/obj/effect/decal/cleanable/blood/hv_spray/wall/gorilla_spray/runs) in spot(1, 0), "A bleeding body slammed into a wall left no runs") + qdel(bleeder) + clear_mess(spot(1, 0)) + + // A hurl through the real impact: the crash's own 12 brute, not tg's random-limb crash on top + var/mob/living/carbon/human/consistent/hurled = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + var/datum/gorilla_flight/hurl = new(hurled, thrower, FALSE, FALSE, 2) // GORILLA_IMPACT_HURL + var/datum/thrownthing/throw_datum = new(hurled, wall, EAST, 1, 2, thrower, FALSE, MOVE_FORCE_STRONG, FALSE, null, null) + hurled.throw_impact(wall, throw_datum) + TEST_ASSERT(!throw_datum.gentle, "The wall crash left the throw marked gentle") + TEST_ASSERT_EQUAL(hurled.getBruteLoss(), 12, "A hurl into a wall did the wrong damage") // GORILLA_WALL_HURL_BLUNT + GORILLA_WALL_HURL_EDGE + TEST_ASSERT(hurled.IsParalyzed(), "A hurl into a wall didn't knock them down") + hurl.end() + qdel(throw_datum) + +// ========================================================================= +// THE HAYMAKER +// ========================================================================= + +/// Each real arm winds up a haymaker; the Brawler has none. A wound-up release hits the body in +/// front, sends it flying and spends the pistons; a swing at nothing staggers; a vent costs less. +/datum/unit_test/voidcrew_gorilla_gore/haymaker + +/datum/unit_test/voidcrew_gorilla_gore/haymaker/Run() + var/mob/living/carbon/human/bearer = gorilla(spot(0, 0)) + var/datum/action/cooldown/cyberware/gorilla_haymaker/right_haymaker = locate() in arm(bearer, BODY_ZONE_R_ARM).actions + var/datum/action/cooldown/cyberware/gorilla_haymaker/left_haymaker = locate() in arm(bearer, BODY_ZONE_L_ARM).actions + TEST_ASSERT_NOTNULL(right_haymaker, "The right Gorilla arm has no haymaker") + TEST_ASSERT_NOTNULL(left_haymaker, "The left Gorilla arm has no haymaker") + TEST_ASSERT_EQUAL(right_haymaker.owner, bearer, "The haymaker wasn't granted") + var/mob/living/carbon/human/brawler = gorilla(spot(4, 4), street = TRUE) + TEST_ASSERT_NULL(locate(/datum/action/cooldown/cyberware/gorilla_haymaker) in arm(brawler).actions, "Brawler myomers have a haymaker") + + // Wind up, then let go at someone in front + var/mob/living/carbon/human/consistent/victim = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + bearer.setDir(EAST) + right_haymaker.Trigger(bearer) + TEST_ASSERT(right_haymaker.charging(), "Triggering the haymaker didn't wind it up") + TEST_ASSERT_NOTNULL(bearer.has_status_effect(/datum/status_effect/gorilla_windup), "The wind-up has no status effect") + TEST_ASSERT(bearer.has_movespeed_modifier(/datum/movespeed_modifier/gorilla_windup), "The wind-up doesn't slow") + // The lean: a pixel back at once, turning with the bearer, GORILLA_HAYMAKER_LEAN and a tremble at full charge + var/datum/status_effect/gorilla_windup/windup = bearer.has_status_effect(/datum/status_effect/gorilla_windup) + TEST_ASSERT_EQUAL(bearer.has_offset("gorilla_windup", PIXEL_X_OFFSET), -1, "The wind-up doesn't start a pixel back from an east facing") + bearer.setDir(NORTH) + TEST_ASSERT_EQUAL(bearer.has_offset("gorilla_windup", PIXEL_X_OFFSET), 0, "A turn left the old lean behind") + TEST_ASSERT_EQUAL(bearer.has_offset("gorilla_windup", PIXEL_Z_OFFSET), -1, "Facing away, the lean isn't down the screen") + bearer.setDir(EAST) + right_haymaker.charge_started = world.time - 2 SECONDS + windup.tick(0.2) + TEST_ASSERT_EQUAL(bearer.has_offset("gorilla_windup", PIXEL_X_OFFSET), -4, "A full charge doesn't lean all the way back") // GORILLA_HAYMAKER_LEAN + TEST_ASSERT(bearer.has_offset("gorilla_windup_tremble", PIXEL_W_OFFSET), "A full charge doesn't tremble") + var/hurt_before = victim.getBruteLoss() + right_haymaker.InterceptClickOn(bearer, null, victim) + TEST_ASSERT(!right_haymaker.charging(), "The haymaker still winds up after the release") + TEST_ASSERT_NULL(bearer.has_status_effect(/datum/status_effect/gorilla_windup), "The wind-up outlived the release") + TEST_ASSERT(!bearer.has_movespeed_modifier(/datum/movespeed_modifier/gorilla_windup), "The wind-up's slow outlived it") + TEST_ASSERT(!bearer.has_offset("gorilla_windup"), "The wind-up's lean outlived it") + TEST_ASSERT(!bearer.has_offset("gorilla_windup_tremble"), "The wind-up's tremble outlived it") + // The blow lands when the thrown fist does (GORILLA_HAYMAKER_THROW) + TEST_ASSERT_EQUAL(victim.getBruteLoss(), hurt_before, "The haymaker landed before its fist was thrown") + sleep(0.2 SECONDS) + TEST_ASSERT(victim.getBruteLoss() - hurt_before >= 20, "A full haymaker hit for too little") // GORILLA_HAYMAKER_MIN_DAMAGE + TEST_ASSERT(!TIMER_COOLDOWN_FINISHED(bearer, "gorilla_pistons"), "The haymaker didn't spend the pistons") // COOLDOWN_GORILLA_PISTONS + TEST_ASSERT(!left_haymaker.IsAvailable(), "The other arm's haymaker didn't share the cooldown") + sleep(2 SECONDS) + TEST_ASSERT_NOTEQUAL(victim.loc, spot(1, 0), "The haymaker didn't send them flying") + + // A swing at nothing staggers and still spends the pistons + var/mob/living/carbon/human/whiffer = gorilla(spot(0, 4)) + var/datum/action/cooldown/cyberware/gorilla_haymaker/whiff = locate() in arm(whiffer).actions + whiffer.setDir(EAST) + whiff.Trigger(whiffer) + whiff.charge_started = world.time - 1 SECONDS + whiff.InterceptClickOn(whiffer, null, spot(1, 4)) + TEST_ASSERT_NOTNULL(whiffer.has_status_effect(/datum/status_effect/staggered), "A whiffed haymaker didn't stagger") + TEST_ASSERT(!TIMER_COOLDOWN_FINISHED(whiffer, "gorilla_pistons"), "A whiff didn't spend the pistons") + + // Called off: the pistons vent for a shorter while + var/mob/living/carbon/human/venter = gorilla(spot(2, 2)) + var/datum/action/cooldown/cyberware/gorilla_haymaker/vent = locate() in arm(venter).actions + vent.Trigger(venter) + TEST_ASSERT(vent.charging(), "Test fixture: the third haymaker didn't wind up") + vent.unset_click_ability(venter, refund_cooldown = TRUE) + TEST_ASSERT(!vent.charging(), "Calling the haymaker off left it winding up") + var/left = S_TIMER_COOLDOWN_TIMELEFT(venter, "gorilla_pistons") + TEST_ASSERT(left > 0 && left <= 5 SECONDS, "A vent cost the wrong cooldown ([left])") // GORILLA_PISTONS_VENTED + +/** + * The piston punch's arm: the blow waits for the fist; for the punch and no longer, the punching arm is a puppet over a + * body with that arm masked out; a bearer who looks the same is not pictured again; the arm steps with a bearer who + * steps and comes down when they turn; and a bearer who can't be drawn still lands the blow. + */ +/datum/unit_test/voidcrew_gorilla_gore/punch_thrust + +/datum/unit_test/voidcrew_gorilla_gore/punch_thrust/Run() + var/mob/living/carbon/human/bearer = gorilla(spot(0, 0)) + var/mob/living/carbon/human/consistent/victim = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + bearer.setDir(EAST) + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/fist = arm(bearer) + var/obj/item/bodypart/hand = bearer.get_bodypart(BODY_ZONE_R_ARM) + var/filters_before = length(bearer.filters) + var/hurt_before = victim.getBruteLoss() + TEST_ASSERT(fist.piston_hit(bearer, victim, hand, BODY_ZONE_CHEST), "The piston punch wasn't thrown") + TEST_ASSERT_EQUAL(victim.getBruteLoss(), hurt_before, "The piston punch landed before its fist did") + TEST_ASSERT_NOTNULL(bearer.gorilla_thrust, "The punch drew no arm") + TEST_ASSERT_EQUAL(puppets_left(), 2, "A punch seen from the side isn't an arm and the torso under it") + TEST_ASSERT_EQUAL(length(bearer.filters), filters_before + 1, "The real arm wasn't masked out under its puppet") + sleep(0.3 SECONDS) + TEST_ASSERT(victim.getBruteLoss() > hurt_before, "The piston punch never landed") + sleep(0.4 SECONDS) + TEST_ASSERT_NULL(bearer.gorilla_thrust, "The punch's arm outlived the punch") + TEST_ASSERT_EQUAL(puppets_left(), 0, "The punch left a puppet behind") + TEST_ASSERT_EQUAL(length(bearer.filters), filters_before, "The mask on the real arm outlived the punch") + var/matrix/rested = bearer.transform + TEST_ASSERT(rested.a == 1 && !rested.b && !rested.c && !rested.d && rested.e == 1 && !rested.f, "The lunge left the bearer off their feet") + + // The same look is not pictured twice; the arm walks with its bearer and comes down on a turn + var/mob/living/carbon/human/walker = gorilla(spot(0, 2)) + var/mob/living/carbon/human/consistent/bag = allocate(/mob/living/carbon/human/consistent, spot(1, 2)) + ADD_TRAIT(bag, TRAIT_GODMODE, TRAIT_SOURCE_UNIT_TESTS) + bag.anchored = TRUE + walker.setDir(EAST) + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/walker_fist = arm(walker) + var/obj/item/bodypart/walker_hand = walker.get_bodypart(BODY_ZONE_R_ARM) + walker_fist.piston_hit(walker, bag, walker_hand, BODY_ZONE_HEAD) + var/datum/gorilla_arm_look/look = walker.gorilla_arm_looks?["[EAST]"] + TEST_ASSERT_NOTNULL(look, "The punch kept no picture of its bearer") + sleep(0.6 SECONDS) + walker_fist.piston_hit(walker, bag, walker_hand, BODY_ZONE_HEAD) + TEST_ASSERT_EQUAL(walker.gorilla_arm_looks["[EAST]"], look, "A second punch pictured a bearer who hadn't changed") + var/datum/gorilla_thrust/thrust = walker.gorilla_thrust + TEST_ASSERT_NOTNULL(thrust, "The second punch drew no arm") + walker.forceMove(spot(0, 3)) + TEST_ASSERT_EQUAL(walker.gorilla_thrust, thrust, "A step took the arm down") + for(var/obj/effect/abstract/chrome_puppet/puppet as anything in thrust.pieces) + TEST_ASSERT_EQUAL(puppet.loc, walker.loc, "The arm didn't step with its bearer") + walker.setDir(NORTH) + TEST_ASSERT_NULL(walker.gorilla_thrust, "A turn left the old facing's arm up") + TEST_ASSERT_EQUAL(puppets_left(), 0, "A turn left a puppet behind") + sleep(0.6 SECONDS) + + // A bearer on the floor can't be drawn: tg's lunge, and the blow still lands + var/mob/living/carbon/human/floored = gorilla(spot(2, 4)) + var/mob/living/carbon/human/consistent/kicked = allocate(/mob/living/carbon/human/consistent, spot(3, 4)) + floored.set_resting(TRUE, silent = TRUE, instant = TRUE) + var/kicked_before = kicked.getBruteLoss() + arm(floored).piston_hit(floored, kicked, floored.get_bodypart(BODY_ZONE_R_ARM), BODY_ZONE_CHEST) + TEST_ASSERT_NULL(floored.gorilla_thrust, "A bearer lying down drew an arm") + sleep(0.3 SECONDS) + TEST_ASSERT(kicked.getBruteLoss() > kicked_before, "A punch from the floor never landed") + + // The first punch a picture is taken for lands as soon as any other + var/mob/living/carbon/human/fresh = gorilla(spot(3, 2)) + var/mob/living/carbon/human/consistent/dummy = allocate(/mob/living/carbon/human/consistent, spot(4, 2)) + ADD_TRAIT(dummy, TRAIT_GODMODE, TRAIT_SOURCE_UNIT_TESTS) + dummy.anchored = TRUE + fresh.setDir(EAST) + var/first_wait = gorilla_thrust(fresh, dummy, BODY_ZONE_R_ARM, BODY_ZONE_CHEST) + TEST_ASSERT_NOTNULL(fresh.gorilla_thrust, "Test fixture: the first punch drew no arm") + TEST_ASSERT_EQUAL(first_wait, 0.1 SECONDS, "The first punch of a new look lands late") // GORILLA_THRUST_LANDS + sleep(0.6 SECONDS) + TEST_ASSERT_EQUAL(gorilla_thrust(fresh, dummy, BODY_ZONE_R_ARM, BODY_ZONE_CHEST), first_wait, "A later punch lands at another time than the first") + sleep(0.6 SECONDS) + + // The fist reaches the part it is thrown at, down to the leg of a body beside its bearer + var/datum/gorilla_arm_look/fresh_look = fresh.gorilla_arm_looks?["[EAST]"] + var/datum/chrome_rig/fresh_rig = fresh_look?.rig + TEST_ASSERT_NOTNULL(fresh_rig, "Test fixture: the punch kept no picture") + for(var/zone in list(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_L_LEG)) + var/list/point = gorilla_fist_target(fresh, dummy, zone) + // GORILLA_THRUST_LUNGE_MIN, GORILLA_THRUST_LUNGE_MAX, GORILLA_THRUST_TIP, GORILLA_SWING_EASY_LENGTH, GORILLA_SWING_MAX_LENGTH + var/list/reach = chrome_swing_reach(fresh_rig, "r", point[1], point[2], list(1, 0), 8, 16, 15, 1.9, 3.3, -90) + var/list/fist_at = fresh_rig.hand_at("r", list(reach[2], reach[3], chrome_swing_base(reach[1], 0, 15))) + TEST_ASSERT(abs(fist_at[1] - point[1]) <= 1 && abs(fist_at[2] - point[2]) <= 1, "The fist stops short of the [zone] of a body beside its bearer") + + // A body a corner away gets tg's lunge: the arm is thrown the way its bearer faces + var/mob/living/carbon/human/consistent/cornered = allocate(/mob/living/carbon/human/consistent, spot(4, 3)) + var/cornered_before = cornered.getBruteLoss() + arm(fresh).piston_hit(fresh, cornered, fresh.get_bodypart(BODY_ZONE_R_ARM), BODY_ZONE_CHEST) + TEST_ASSERT_NULL(fresh.gorilla_thrust, "A punch at a corner tile threw its arm past the body") + sleep(0.3 SECONDS) + TEST_ASSERT(cornered.getBruteLoss() > cornered_before, "A punch at a corner tile never landed") + +/** + * The haymaker's arm: a bearer who stands still winds up on the rig, whose puppets lean with the hidden body; the blow + * lands when the thrown fist does, and the rig comes down when the arms are back at rest. A step or a turn mid + * wind-up takes the rig down and the wind-up goes on; a wind-up called off lowers the arms and then the rig. + */ +/datum/unit_test/voidcrew_gorilla_gore/haymaker_swing + +/datum/unit_test/voidcrew_gorilla_gore/haymaker_swing/Run() + var/mob/living/carbon/human/bearer = gorilla(spot(0, 0)) + var/mob/living/carbon/human/consistent/victim = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + bearer.setDir(EAST) + var/datum/action/cooldown/cyberware/gorilla_haymaker/haymaker = locate() in arm(bearer, BODY_ZONE_R_ARM).actions + haymaker.Trigger(bearer) + TEST_ASSERT_NOTNULL(haymaker.rig, "A wind-up standing still raised no rig") + // Three puppets, plus the body's stand-in that every concealed rig puts up (chrome_rig/conceal()) + TEST_ASSERT_EQUAL(puppets_left(), 4, "The wind-up's rig isn't a body and two arms") + TEST_ASSERT_EQUAL(length(haymaker.rig.puppets), 3, "The wind-up's rig isn't a body and two arms") + var/datum/status_effect/gorilla_windup/windup = bearer.has_status_effect(/datum/status_effect/gorilla_windup) + haymaker.charge_started = world.time - 2 SECONDS + windup.tick(0.2) + var/obj/effect/abstract/chrome_puppet/body_puppet = haymaker.rig.puppet("body") + TEST_ASSERT_EQUAL(body_puppet.pixel_x, bearer.pixel_x, "The puppets didn't lean with the hidden body") + TEST_ASSERT_EQUAL(body_puppet.pixel_w, bearer.pixel_w, "The puppets didn't tremble with the hidden body") + var/hurt_before = victim.getBruteLoss() + haymaker.InterceptClickOn(bearer, null, victim) + TEST_ASSERT_NOTNULL(haymaker.rig, "The rig came down before the swing") + TEST_ASSERT_EQUAL(victim.getBruteLoss(), hurt_before, "The haymaker landed before its fist was thrown") + sleep(0.2 SECONDS) + TEST_ASSERT(victim.getBruteLoss() - hurt_before >= 20, "The thrown haymaker never landed") // GORILLA_HAYMAKER_MIN_DAMAGE + TEST_ASSERT_NOTNULL(haymaker.rig, "The rig came down before the follow-through") + sleep(0.6 SECONDS) + TEST_ASSERT_NULL(haymaker.rig, "The rig outlived the swing") + TEST_ASSERT_EQUAL(puppets_left(), 0, "The swing left a puppet behind") + TEST_ASSERT(!bearer.get_filter("chrome_rig_hide"), "The swing left its bearer hidden") // CHROME_RIG_HIDE_FILTER + + // A step: the lean alone from there, and the wind-up goes on + var/mob/living/carbon/human/walker = gorilla(spot(0, 2)) + walker.setDir(EAST) + var/datum/action/cooldown/cyberware/gorilla_haymaker/walking = locate() in arm(walker, BODY_ZONE_R_ARM).actions + walking.Trigger(walker) + TEST_ASSERT_NOTNULL(walking.rig, "Test fixture: the second wind-up raised no rig") + walker.forceMove(spot(0, 3)) + TEST_ASSERT_NULL(walking.rig, "A step left the rig standing where the bearer was") + TEST_ASSERT(walking.charging(), "A step ended the wind-up") + TEST_ASSERT_NOTNULL(walker.has_status_effect(/datum/status_effect/gorilla_windup), "A step ended the wind-up's lean") + walking.unset_click_ability(walker, refund_cooldown = TRUE) + + // A turn does the same + var/mob/living/carbon/human/turner = gorilla(spot(2, 2)) + turner.setDir(EAST) + var/datum/action/cooldown/cyberware/gorilla_haymaker/turning = locate() in arm(turner, BODY_ZONE_R_ARM).actions + turning.Trigger(turner) + TEST_ASSERT_NOTNULL(turning.rig, "Test fixture: the third wind-up raised no rig") + turner.setDir(SOUTH) + TEST_ASSERT_NULL(turning.rig, "A turn left the old facing's puppets up") + TEST_ASSERT(turning.charging(), "A turn ended the wind-up") + turning.unset_click_ability(turner, refund_cooldown = TRUE) + + // Called off: the arms come down first, then the rig + var/mob/living/carbon/human/venter = gorilla(spot(2, 4)) + venter.setDir(EAST) + var/datum/action/cooldown/cyberware/gorilla_haymaker/vented = locate() in arm(venter, BODY_ZONE_R_ARM).actions + vented.Trigger(venter) + TEST_ASSERT_NOTNULL(vented.rig, "Test fixture: the fourth wind-up raised no rig") + vented.unset_click_ability(venter, refund_cooldown = TRUE) + TEST_ASSERT(!vented.charging(), "Test fixture: the wind-up wasn't called off") + TEST_ASSERT_NOTNULL(vented.rig, "A wind-up called off dropped its arms in one frame") + sleep(0.5 SECONDS) + TEST_ASSERT_NULL(vented.rig, "The rig outlived a wind-up called off") + TEST_ASSERT_EQUAL(puppets_left(), 0, "A wind-up called off left a puppet behind") + + // Thrown at a body a corner away: the rig comes down, the lunge is tg's, and the blow still lands + var/mob/living/carbon/human/cornerer = gorilla(spot(3, 3)) + var/mob/living/carbon/human/consistent/cornered = allocate(/mob/living/carbon/human/consistent, spot(4, 4)) + cornerer.setDir(EAST) + var/datum/action/cooldown/cyberware/gorilla_haymaker/corner_swing = locate() in arm(cornerer, BODY_ZONE_R_ARM).actions + corner_swing.Trigger(cornerer) + TEST_ASSERT_NOTNULL(corner_swing.rig, "Test fixture: the fifth wind-up raised no rig") + corner_swing.charge_started = world.time - 1 SECONDS + var/cornered_before = cornered.getBruteLoss() + corner_swing.InterceptClickOn(cornerer, null, cornered) + TEST_ASSERT_NULL(corner_swing.rig, "A haymaker at a corner tile threw its arm past the body") + TEST_ASSERT_EQUAL(puppets_left(), 0, "A haymaker at a corner tile left a puppet behind") + sleep(0.2 SECONDS) + TEST_ASSERT(cornered.getBruteLoss() - cornered_before >= 20, "A haymaker at a corner tile never landed") // GORILLA_HAYMAKER_MIN_DAMAGE + + // Something in the guard hand: that arm stays down, so the thing isn't pulled apart + var/mob/living/carbon/human/guarder = gorilla(spot(4, 2)) + guarder.setDir(EAST) + guarder.put_in_hand(allocate(/obj/item/wrench), 1) + var/datum/action/cooldown/cyberware/gorilla_haymaker/guarded = locate() in arm(guarder, BODY_ZONE_R_ARM).actions + guarded.Trigger(guarder) + TEST_ASSERT_NOTNULL(guarded.rig, "A wind-up with something in the guard hand raised no rig") + TEST_ASSERT_NOTNULL(guarded.rig.arm_poses["r"], "Test fixture: the punching arm wasn't drawn back") + TEST_ASSERT_NULL(guarded.rig.arm_poses["l"], "A guard arm with something in its hand was raised") + guarded.unset_click_ability(guarder, refund_cooldown = TRUE) + + // Something in the punching hand: no drawing, and the wind-up goes on + var/mob/living/carbon/human/gripper = gorilla(spot(0, 4)) + gripper.setDir(EAST) + gripper.put_in_hand(allocate(/obj/item/wrench), 2) + var/datum/action/cooldown/cyberware/gorilla_haymaker/gripped = locate() in arm(gripper, BODY_ZONE_R_ARM).actions + gripped.Trigger(gripper) + TEST_ASSERT_NULL(gripped.rig, "A punching arm with something in its hand was drawn on the rig") + TEST_ASSERT(gripped.charging(), "Something in the punching hand stopped the wind-up") + gripped.unset_click_ability(gripper, refund_cooldown = TRUE) + sleep(0.4 SECONDS) + TEST_ASSERT_EQUAL(puppets_left(), 0, "A wind-up with full hands left a puppet behind") + +// ========================================================================= +// GROUND POUND +// ========================================================================= + +/// The synced pair grants the chip; the pound staggers and dazes everyone around but the bearer, does no +/// brute, and loose things hop outward but never into space. +/datum/unit_test/voidcrew_gorilla_gore/ground_pound + +/datum/unit_test/voidcrew_gorilla_gore/ground_pound/Run() + var/mob/living/carbon/human/bearer = gorilla(spot(2, 2)) + TEST_ASSERT(gorilla_synced(bearer), "Test fixture: the pair isn't synced") + var/datum/action/cooldown/cyberware/gorilla_pound/pound = locate() in arm(bearer, BODY_ZONE_R_ARM).actions + TEST_ASSERT_NOTNULL(pound, "A synced pair has no ground pound") + TEST_ASSERT_EQUAL(pound.owner, bearer, "The ground pound wasn't granted") + + var/mob/living/carbon/human/consistent/near = allocate(/mob/living/carbon/human/consistent, spot(3, 2)) + var/mob/living/carbon/human/consistent/far = allocate(/mob/living/carbon/human/consistent, spot(4, 4)) + // Lava, not space: a space hole would vent the room and the wind would move things itself + var/turf/hole = spot(0, 2) + change_turf(hole, /turf/open/lava/smooth) + var/obj/item/wrench/loose = allocate(/obj/item/wrench, spot(1, 2)) + var/brute_before = near.getBruteLoss() + var/list/hit = gorilla_ground_pound(bearer, get_turf(bearer)) + TEST_ASSERT(near in hit, "The pound missed someone beside it") + TEST_ASSERT(!(far in hit), "The pound reached someone two tiles off") + TEST_ASSERT(!(bearer in hit), "The pound hit its bearer") + TEST_ASSERT_NOTNULL(near.has_status_effect(/datum/status_effect/staggered), "The pound didn't stagger") + TEST_ASSERT_EQUAL(near.getBruteLoss(), brute_before, "The pound did brute") + var/hopped_to = loose.loc + restore_turf(hole) + TEST_ASSERT_NOTEQUAL(hopped_to, hole, "The pound hopped a loose thing into lava") + + // Out of sync: the chip goes + var/obj/item/organ/left = arm(bearer, BODY_ZONE_L_ARM) + left.Remove(bearer, special = TRUE) + sleep(0.1 SECONDS) + TEST_ASSERT(QDELETED(pound) || pound.owner != bearer, "The ground pound outlived the pair") + +// ========================================================================= +// DOOR PRY +// ========================================================================= + +/// A trader outpost's airlock never gives to the Gorilla. +/datum/unit_test/voidcrew_gorilla_gore/pry_outpost + +/datum/unit_test/voidcrew_gorilla_gore/pry_outpost/Run() + var/mob/living/carbon/human/bearer = gorilla(spot(0, 0)) + bearer.set_combat_mode(FALSE) + var/obj/machinery/door/airlock/outpost/door = allocate(/obj/machinery/door/airlock/outpost, spot(1, 0)) + TEST_ASSERT(gorilla_pry_refused(door), "An outpost airlock isn't refused") + var/result = SEND_SIGNAL(bearer, COMSIG_LIVING_UNARMED_ATTACK, door, TRUE, list()) + TEST_ASSERT(result & COMPONENT_CANCEL_ATTACK_CHAIN, "The pry didn't take the outpost door click") + sleep(0.5 SECONDS) + TEST_ASSERT(door.density, "The Gorilla pried an outpost airlock") + var/obj/machinery/door/airlock/plain = allocate(/obj/machinery/door/airlock, spot(0, 1)) + TEST_ASSERT(!gorilla_pry_refused(plain), "A plain airlock is refused") + +// ========================================================================= +// BRAWLER MYOMERS (owner D49): the street slam, the light pound, the rip, doors +// ========================================================================= + +/// The synced Brawler pair's pound staggers and winds those beside it, never dazes them and moves nothing. +/datum/unit_test/voidcrew_gorilla_gore/brawler_pound + +/datum/unit_test/voidcrew_gorilla_gore/brawler_pound/Run() + var/mob/living/carbon/human/brawler = gorilla(spot(2, 2), street = TRUE) + TEST_ASSERT(brawler_synced(brawler), "Test fixture: the Brawler pair isn't synced") + TEST_ASSERT(!gorilla_synced(brawler), "A Brawler pair synced as Gorilla Arms") + var/datum/action/cooldown/cyberware/gorilla_pound/brawler/pound = locate() in arm(brawler, BODY_ZONE_R_ARM).actions + TEST_ASSERT_NOTNULL(pound, "A synced Brawler pair has no ground pound") + TEST_ASSERT_EQUAL(pound.owner, brawler, "The Brawler ground pound wasn't granted") + TEST_ASSERT_EQUAL(pound.cooldown_time, 60 SECONDS, "The Brawler pound isn't on a minute's clock") // BRAWLER_POUND_COOLDOWN + TEST_ASSERT(!pound.daze, "The Brawler pound dazes") + + var/mob/living/carbon/human/consistent/near = allocate(/mob/living/carbon/human/consistent, spot(3, 2)) + var/obj/item/wrench/loose = allocate(/obj/item/wrench, spot(1, 2)) + var/brute_before = near.getBruteLoss() + var/stamina_before = near.getStaminaLoss() + var/list/hit = gorilla_ground_pound(brawler, get_turf(brawler), pound.stagger, pound.daze, pound.stamina, pound.full_pound) + TEST_ASSERT(near in hit, "The Brawler pound missed someone beside it") + var/datum/status_effect/staggered/stagger = near.has_status_effect(/datum/status_effect/staggered) + TEST_ASSERT_NOTNULL(stagger, "The Brawler pound didn't stagger") + TEST_ASSERT(stagger.duration - world.time <= 6 SECONDS, "The Brawler pound staggered past six seconds") // BRAWLER_POUND_STAGGER + TEST_ASSERT_NULL(near.has_status_effect(/datum/status_effect/dazed), "The Brawler pound dazed someone") + var/winded = near.getStaminaLoss() - stamina_before + TEST_ASSERT(winded > 5 && winded <= 10, "The Brawler pound took [winded] stamina, not 10") // BRAWLER_POUND_STAMINA + TEST_ASSERT_EQUAL(near.getBruteLoss(), brute_before, "The Brawler pound did brute") + TEST_ASSERT_EQUAL(loose.loc, spot(1, 2), "The Brawler pound moved a loose thing") + + // Through the chip, on its own clock + var/mob/living/carbon/human/pounder = gorilla(spot(0, 4), street = TRUE) + TEST_ASSERT(gorilla_try_pound(pounder), "The Brawler pound couldn't be started without the chip") + TEST_ASSERT(S_TIMER_COOLDOWN_TIMELEFT(pounder, "gorilla_pound") > 45 SECONDS, "The Brawler pound ran on the Gorilla's clock") // COOLDOWN_GORILLA_POUND + + // A mixed pair has no pound at all + var/mob/living/carbon/human/consistent/mixed = allocate(/mob/living/carbon/human/consistent, spot(4, 4)) + var/obj/item/organ/real = allocate(/obj/item/organ/cyberimp/cyberware/gorilla_arms) + var/obj/item/organ/street = allocate(/obj/item/organ/cyberimp/cyberware/gorilla_arms/street/left) + TEST_ASSERT(real.Insert(mixed, special = TRUE), "Test fixture: the real arm wouldn't go in") + TEST_ASSERT(street.Insert(mixed, special = TRUE), "Test fixture: the Brawler arm wouldn't go in") + TEST_ASSERT_NULL(locate(/datum/action/cooldown/cyberware/gorilla_pound) in real.actions, "A mixed pair got a ground pound") + TEST_ASSERT_NULL(locate(/datum/action/cooldown/cyberware/gorilla_pound) in street.actions, "A mixed pair got a Brawler pound") + + // Out of sync: the chip goes + var/obj/item/organ/left = arm(brawler, BODY_ZONE_L_ARM) + left.Remove(brawler, special = TRUE) + sleep(0.1 SECONDS) + TEST_ASSERT(QDELETED(pound) || pound.owner != brawler, "The Brawler pound outlived the pair") + +/// Brawler punches dent plain and reinforced airlocks, less than the Gorilla's; the synced pair forces a +/// powered one slower than the Gorilla; a trader outpost's door takes neither. +/datum/unit_test/voidcrew_gorilla_gore/brawler_doors + +/datum/unit_test/voidcrew_gorilla_gore/brawler_doors/Run() + var/mob/living/carbon/human/brawler = gorilla(spot(0, 0), street = TRUE) + var/obj/machinery/door/airlock/plain = allocate(/obj/machinery/door/airlock, spot(1, 0)) + var/plain_before = plain.get_integrity() + TEST_ASSERT_EQUAL(punch(brawler, plain), COMPONENT_CANCEL_ATTACK_CHAIN, "A Brawler punch at an airlock wasn't a smash") + var/brawler_dent = plain_before - plain.get_integrity() + TEST_ASSERT(brawler_dent > 0, "A Brawler punch didn't dent a plain airlock") + + var/obj/machinery/door/airlock/reinforced = allocate(/obj/machinery/door/airlock, spot(0, 1)) + reinforced.damage_deflection = 30 // AIRLOCK_DAMAGE_DEFLECTION_R + var/reinforced_before = reinforced.get_integrity() + punch(brawler, reinforced) + TEST_ASSERT(reinforced.get_integrity() < reinforced_before, "A Brawler punch didn't dent a reinforced airlock") + + var/mob/living/carbon/human/real = gorilla(spot(3, 0)) + var/obj/machinery/door/airlock/real_door = allocate(/obj/machinery/door/airlock, spot(4, 0)) + var/real_before = real_door.get_integrity() + punch(real, real_door) + TEST_ASSERT(real_before - real_door.get_integrity() > brawler_dent, "A Brawler punch dents an airlock as deep as a Gorilla's") + + // Forcing a powered airlock that won't open for them: slower than the Gorilla's four seconds + brawler.set_combat_mode(FALSE) + var/obj/machinery/door/airlock/shut = allocate(/obj/machinery/door/airlock, spot(1, 1)) + shut.req_access = list(ACCESS_CAPTAIN) + TEST_ASSERT(shut.hasPower(), "Test fixture: the test room airlock has no power") + TEST_ASSERT(!shut.allowed(brawler), "Test fixture: the airlock opens for the Brawler anyway") + var/forced = SEND_SIGNAL(brawler, COMSIG_LIVING_UNARMED_ATTACK, shut, TRUE, list()) + TEST_ASSERT(forced & COMPONENT_CANCEL_ATTACK_CHAIN, "The Brawler pair didn't take the airlock click") + sleep(4.5 SECONDS) + TEST_ASSERT(shut.density, "The Brawler pair forced an airlock as fast as the Gorilla") // GORILLA_PRY_TIME + // 7 s of prying, then the airlock's own opening before it stops blocking + sleep(4 SECONDS) + TEST_ASSERT(!shut.density, "The Brawler pair never forced the airlock") // BRAWLER_PRY_TIME 7 s + + // An arm that's down forces nothing: the click is an ordinary one + var/obj/machinery/door/airlock/second_shut = allocate(/obj/machinery/door/airlock, spot(1, 2)) + second_shut.req_access = list(ACCESS_CAPTAIN) + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/down_arm = arm(brawler, BODY_ZONE_L_ARM) + down_arm.organ_flags |= ORGAN_FAILING + var/weak = SEND_SIGNAL(brawler, COMSIG_LIVING_UNARMED_ATTACK, second_shut, TRUE, list()) + TEST_ASSERT(!(weak & COMPONENT_CANCEL_ATTACK_CHAIN), "A Brawler pair with an arm down started forcing an airlock") + down_arm.organ_flags &= ~ORGAN_FAILING + + // A trader outpost's airlock takes no punch and no pry + var/obj/machinery/door/airlock/outpost/outpost_door = allocate(/obj/machinery/door/airlock/outpost, spot(0, 2)) + var/outpost_before = outpost_door.get_integrity() + brawler.set_combat_mode(TRUE) + TEST_ASSERT_EQUAL(punch(brawler, outpost_door), COMPONENT_CANCEL_ATTACK_CHAIN, "A Brawler punch at an outpost airlock went through to the door") + TEST_ASSERT_EQUAL(outpost_door.get_integrity(), outpost_before, "A Brawler punch dented an outpost airlock") + brawler.set_combat_mode(FALSE) + var/refused = SEND_SIGNAL(brawler, COMSIG_LIVING_UNARMED_ATTACK, outpost_door, TRUE, list()) + TEST_ASSERT(refused & COMPONENT_CANCEL_ATTACK_CHAIN, "The Brawler pry didn't take the outpost door click") + sleep(0.5 SECONDS) + TEST_ASSERT(outpost_door.density, "The Brawler pair pried an outpost airlock") From 41825a44a8058db30d3903c79b7d3f5d60b8f449 Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Sun, 15 Nov 2026 17:49:57 -0800 Subject: [PATCH 09/29] Gorilla Arms gore: the grab-slam - Someone held in an aggressive grab is lifted and brought down on the floor under them, an open floor beside the bearer or a table, with a click there. - The slam is called off when the body leaves the hold. - Brawler myomers slam lighter and on a longer clock. - The slam's unit tests, and the Brawler line of the wiki. --- tgstation.dme | 1 + .../modules/cyberware/ware_military_arms.dm | 9 + .../hyperviolence_gorilla/gorilla_punch.dm | 59 + .../hyperviolence_gorilla/gorilla_slam.dm | 1054 +++++++++++++++++ .../unit_tests/voidcrew_gorilla_gore.dm | 170 +++ wiki/content/cyberware.md | 2 +- 6 files changed, 1294 insertions(+), 1 deletion(-) create mode 100644 voidcrew/modules/hyperviolence_gorilla/gorilla_slam.dm diff --git a/tgstation.dme b/tgstation.dme index dc86484bc06..b6d8a82d2a5 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -7332,6 +7332,7 @@ #include "voidcrew\modules\hyperviolence_gorilla\gorilla_pound.dm" #include "voidcrew\modules\hyperviolence_gorilla\gorilla_pry.dm" #include "voidcrew\modules\hyperviolence_gorilla\gorilla_punch.dm" +#include "voidcrew\modules\hyperviolence_gorilla\gorilla_slam.dm" #include "voidcrew\modules\hyperviolence_gorilla\gorilla_swing.dm" #include "voidcrew\modules\hyperviolence_gorilla\gorilla_throw.dm" #include "voidcrew\modules\hyperviolence_gorilla\gorilla_thrust.dm" diff --git a/voidcrew/modules/cyberware/ware_military_arms.dm b/voidcrew/modules/cyberware/ware_military_arms.dm index 8d4b79260f0..3323e221284 100644 --- a/voidcrew/modules/cyberware/ware_military_arms.dm +++ b/voidcrew/modules/cyberware/ware_military_arms.dm @@ -221,6 +221,15 @@ COOLDOWN_START(src, slam_cooldown, smash_cooldown_time) return COMPONENT_CANCEL_ATTACK_CHAIN + // Someone held in an aggressive grab, brought down on the floor or a table (hyperviolence_gorilla/gorilla_punch.dm). + // Before the structure smash, so a table click while grabbing slams them instead of caving the table in. + switch(try_slam(source, target, active_hand)) + if(GORILLA_SLAM_DONE) + COOLDOWN_START(src, slam_cooldown, punch_cooldown_time) + return COMPONENT_CANCEL_ATTACK_CHAIN + if(GORILLA_SLAM_PASS) + return NONE + // A trader outpost's doors hold against a fist as they do against a pry, and trying counts against you // (hyperviolence_gorilla/gorilla_pry.dm). if(istype(target, /obj/machinery/door) && gorilla_pry_refused(target)) diff --git a/voidcrew/modules/hyperviolence_gorilla/gorilla_punch.dm b/voidcrew/modules/hyperviolence_gorilla/gorilla_punch.dm index 7236b2c6eea..4d7c1673a2e 100644 --- a/voidcrew/modules/hyperviolence_gorilla/gorilla_punch.dm +++ b/voidcrew/modules/hyperviolence_gorilla/gorilla_punch.dm @@ -440,3 +440,62 @@ GLOBAL_LIST_INIT(gorilla_zone_points, list( gorilla_floor_ring(victim, 0.5) log_combat(attacker, victim, "snapped the [limb.plaintext_zone] of", source_item, "(gorilla arms)") return TRUE + +// ========================================================================= +// GRAB AND SLAM +// ========================================================================= + +/** + * With someone in an aggressive grab, a click on the floor under them, an open floor beside the bearer + * or a table starts the slam that brings them down onto it (gorilla_slam.dm). Returns GORILLA_SLAM_*. + */ +/obj/item/organ/cyberimp/cyberware/gorilla_arms/proc/try_slam(mob/living/carbon/human/source, atom/target, obj/item/bodypart/active_hand) + var/mob/living/victim = source.pulling + if(!isliving(victim) || source.grab_state < GRAB_AGGRESSIVE || victim == source) + return GORILLA_SLAM_NO + var/obj/structure/table/table = istype(target, /obj/structure/table) ? target : null + if(!table && !isturf(target)) + return GORILLA_SLAM_NO + if(!grab_slam || !gorilla_running() || !gorilla_may_use_heavy_moves(source) || HAS_TRAIT(source, TRAIT_PACIFISM) || victim.buckled || source.body_position == LYING_DOWN) + return table ? GORILLA_SLAM_PASS : GORILLA_SLAM_NO + if(!TIMER_COOLDOWN_FINISHED(source, COOLDOWN_GORILLA_GRAB_MOVE)) + return table ? GORILLA_SLAM_PASS : GORILLA_SLAM_NO + var/turf/spot = table ? get_turf(table) : target + if(!source.Adjacent(spot)) + return GORILLA_SLAM_NO + if(!table && !gorilla_slam_floor_ok(spot)) + return GORILLA_SLAM_NO + var/datum/gorilla_slam/slam = new(source, victim, spot, table, src, active_hand) + if(!slam.start()) + qdel(slam) + return table ? GORILLA_SLAM_PASS : GORILLA_SLAM_NO + gorilla_cooldown(source, COOLDOWN_GORILLA_GRAB_MOVE, grab_move_cooldown) + source.changeNext_move(CLICK_CD_MELEE) + return GORILLA_SLAM_DONE + +/** + * Slams whoever [bearer] holds in an aggressive grab onto [onto] (their own tile, an open floor beside the + * bearer, or a table) with the active arm, as a click there would. Returns TRUE if it slammed. For an AI. + * Brawler arms slam too; gorilla_may_use_heavy_moves() still keeps it to players and boss-rank NPCs. + */ +/proc/gorilla_try_slam(mob/living/carbon/human/bearer, atom/onto) + var/obj/item/bodypart/hand = bearer?.get_active_hand() + if(!iscarbon(bearer)) + return FALSE + for(var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm in bearer.organs) + if(arm.owner != bearer || !arm.grab_slam || arm.zone != hand?.body_zone || !arm.gorilla_running() || !COOLDOWN_FINISHED(arm, slam_cooldown)) + continue + if(arm.try_slam(bearer, onto, hand) != GORILLA_SLAM_DONE) + return FALSE + COOLDOWN_START(arm, slam_cooldown, arm.punch_cooldown_time) + return TRUE + return FALSE + +/// Whether a body can be slammed down on [spot]: solid floor with gravity and nothing standing in the way. +/proc/gorilla_slam_floor_ok(turf/spot) + if(!isfloorturf(spot) || isgroundlessturf(spot) || !spot.has_gravity()) + return FALSE + for(var/obj/thing in spot) + if(thing.density && !(thing.flags_1 & ON_BORDER_1)) + return FALSE + return TRUE diff --git a/voidcrew/modules/hyperviolence_gorilla/gorilla_slam.dm b/voidcrew/modules/hyperviolence_gorilla/gorilla_slam.dm new file mode 100644 index 00000000000..6abe224fd6d --- /dev/null +++ b/voidcrew/modules/hyperviolence_gorilla/gorilla_slam.dm @@ -0,0 +1,1054 @@ +/** + * # The grab-slam + * + * With someone in an aggressive grab, a click on the floor under them, an open floor beside the bearer or a table + * presses them up and drives them down onto it (gorilla_arms/proc/try_slam(), gorilla_punch.dm). The lift is drawn + * with the puppet rig (chrome_puppet_rig.dm), so neither real body is moved or turned by it. + * + * - Grip: he leans in and both fists take the body, by belt and collar seen from the side. + * - Hoist: up and over, turning flat. Gorilla Arms press it overhead; Brawler myomers bring it to the shoulder. + * - Top: one held beat. A body taken from behind or beside him is turned to the table or tile here. + * - Slam: driven down with his fists still on it. Seen from the side he bends at the belt; from the front or back he + * drops and lunges. + * - Impact: the damage, the knockdown and the grab letting go all land here, and the real body is put on the tile. + * A ring, and on a floor cracks (and dust and the heavy crash, for Gorilla Arms); both cameras shake and the body + * flashes white. Blood only if the blow made them bleed (a wound through the skin, or tg's cracked ribs bleeding + * inside), as a few drops thrown out round the body. + * - Rebound: the body bounces once and he comes up, hands off. The puppets go once both are still, with the real body + * lying in the same pixels. + * + * Until the impact nothing has happened to anyone. The bearer can't step, the grab is held, and the slam is called off + * if he is stunned or knocked down, loses the grab, or either of them is moved: the body comes down on its feet, unhurt. + * + * The poses are keys (the grip, the top, the impact, the rebound) played as short straight steps. While his fists are on + * the body they are solved onto it at every step, so they never leave it. Every puppet stands on the bearer's tile and is + * moved by its transform alone, which keeps its place in the draw order: the client sorts by row before layer, so a puppet + * that must draw over a table or a ring on the row nearer the viewer is put on that row. + */ + +/mob/living + /// The grab-slam this mob is doing or is held in, if any (gorilla_slam.dm). Cleared when it ends. + var/datum/gorilla_slam/gorilla_slam + +// What an arm does in a key pose. +/// On the body: list(kind, x, y) in the body's own pixels, from the middle of its picture. +#define SLAM_ARM_GRIP 1 +/// On the body, at a point of the scene: list(kind, x, y) pixels from where the bearer stands. +#define SLAM_ARM_POINT 2 +/// On the body, wherever a swing puts the hand: list(kind, angle, reach) as swing_arm() takes them. +#define SLAM_ARM_HELD 3 +/// Off the body: list(kind, angle, reach). +#define SLAM_ARM_SWING 4 + +// How a key pose is eased into. +#define SLAM_EASE_LINEAR 0 +#define SLAM_EASE_OUT 1 +#define SLAM_EASE_IN 2 +#define SLAM_EASE_SINE 3 + +/// Where the belt sits, from the middle of the picture: seen from the side the bearer bends about it. +#define SLAM_WAIST_Y -7 + +/// [progress] (0 to 1) eased as [kind] (SLAM_EASE_*). +/proc/gorilla_slam_ease(kind, progress) + progress = clamp(progress, 0, 1) + switch(kind) + if(SLAM_EASE_OUT) + return 1 - (1 - progress) ** 2 + if(SLAM_EASE_IN) + return progress ** 2 + if(SLAM_EASE_SINE) + return (1 - cos(180 * progress)) / 2 + return progress + +/// One key pose of the bearer. +/datum/gorilla_slam_pose + /// Deciseconds from the click + var/time = 0 + /// The facing of the rig that shows it + var/facing + /// How the move eases into it from the pose before (SLAM_EASE_*) + var/ease = SLAM_EASE_LINEAR + /// Pixels the whole bearer is moved + var/shift_x = 0 + var/shift_y = 0 + /// Degrees he leans forward from the feet, seen from the side + var/lean = 0 + /// Degrees he bends forward at the belt, seen from the side + var/waist = 0 + /// The crouch seen from the front or back: his height as a share, and pixels dropped + var/squash = 1 + var/drop = 0 + /// Side -> list(SLAM_ARM_*, a, b) + var/list/arms + /// Side -> list(x, y): where the fist is on the body, in the body's own pixels. No entry for an arm that is off it. + var/list/grips = list() + /// Side -> list(turn, length): the arm as it is in this pose + var/list/reached = list() + +/datum/gorilla_slam_pose/New(time, facing, ease = SLAM_EASE_LINEAR) + src.time = time + src.facing = facing + src.ease = ease + +/// One grab-slam, from the click to the puppets coming down. +/datum/gorilla_slam + /// Who slams + var/mob/living/carbon/human/bearer + /// Who is slammed + var/mob/living/victim + /// The arm that does it, and its hand: the attacking item + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm + var/obj/item/bodypart/fist + /// The tile the body is brought down on, and the table there if it is slammed onto one + var/turf/spot + var/datum/weakref/table_ref + /// Where the two stood at the click + var/turf/bearer_spot + var/turf/victim_spot + /// The way the bearer faces to take the body, and the way he faces to bring it down + var/taking + var/facing + /// The zone he aimed at the click + var/aimed_zone + /// TRUE for a head-aimed table slam: the body lands face down + var/face_down = FALSE + /// world.time at the click + var/started_at = 0 + /// TRUE once the impact has landed + var/landed = FALSE + /// TRUE once it is over, or called off + var/ended = FALSE + /// TRUE while the slam itself lets go of the grab and moves the body + var/placing = FALSE + /// FALSE when a body couldn't be rigged: the slam happens without the poses + var/posed = FALSE + // The beats, in deciseconds from the click + var/t_grip = GORILLA_SLAM_GRIP_TIME + var/t_top + var/t_drive + var/t_hit + var/t_mid + var/t_up + var/t_end + // The body's middle, in pixels from where the bearer is drawn, and its turn (degrees clockwise): held at the click, + // at the top, and where it lands + var/held_x = 0 + var/held_y = 0 + var/held_angle = 0 + var/top_x = 0 + var/top_y = 0 + var/top_angle = 0 + var/land_x = 0 + var/land_y = 0 + var/land_angle = 0 + /// The middle of the tile it lands on + var/tile_x = 0 + var/tile_y = 0 + /// Where the bearer is drawn on his own tile: every puppet stands there + var/origin_x = 0 + var/origin_y = 0 + /// Where the real body lies after the impact: the puppet settles there + var/final_x = 0 + var/final_y = 0 + var/final_angle = 0 + /// Facing ("[dir]") -> the bearer's rig in that facing + var/list/rigs + /// The body's puppets, one for each of the bearer's rigs ("body_[dir]") + var/datum/chrome_rig/victim_rig + /// The key poses, in order (/datum/gorilla_slam_pose) + var/list/keys + var/hit_timer + var/end_timer + +/datum/gorilla_slam/New(mob/living/carbon/human/bearer, mob/living/victim, turf/spot, obj/structure/table/table, obj/item/organ/cyberimp/cyberware/gorilla_arms/arm, obj/item/bodypart/fist) + . = ..() + src.bearer = bearer + src.victim = victim + src.spot = spot + src.arm = arm + src.fist = fist + if(table) + table_ref = WEAKREF(table) + +/datum/gorilla_slam/Destroy() + ended = TRUE + if(hit_timer) + deltimer(hit_timer) + hit_timer = null + if(end_timer) + deltimer(end_timer) + end_timer = null + take_down() + if(bearer) + stop_listening() + REMOVE_TRAIT(bearer, TRAIT_IMMOBILIZED, GORILLA_SLAM_TRAIT) + if(bearer.gorilla_slam == src) + bearer.gorilla_slam = null + if(victim?.gorilla_slam == src) + victim.gorilla_slam = null + bearer = null + victim = null + arm = null + fist = null + spot = null + bearer_spot = null + victim_spot = null + keys = null + return ..() + +/// Takes every puppet down and shows both bodies. +/datum/gorilla_slam/proc/take_down() + QDEL_NULL(victim_rig) + if(rigs) + QDEL_LIST_ASSOC_VAL(rigs) + rigs = null + +/// The facing toward [target] from where the bearer stands, as face_atom() picks it. Null for his own tile. +/datum/gorilla_slam/proc/toward(turf/target) + var/dx = target.x - bearer_spot.x + var/dy = target.y - bearer_spot.y + if(!dx && !dy) + return null + if(abs(dx) < abs(dy)) + return dy > 0 ? NORTH : SOUTH + return dx > 0 ? EAST : WEST + +/** + * Starts the slam: the rigs go up, the bearer is held where he stands and the impact is set for t_hit. Returns FALSE if + * it can't start; nothing has changed then. + */ +/datum/gorilla_slam/proc/start() + if(QDELETED(bearer) || QDELETED(victim) || QDELETED(arm) || bearer.gorilla_slam || victim.gorilla_slam) + return FALSE + bearer_spot = bearer.loc + victim_spot = victim.loc + if(!isturf(bearer_spot) || !isturf(victim_spot) || !isturf(spot)) + return FALSE + // A body on its feet can't be put down where he stands himself + if(spot == bearer_spot && victim.density) + return FALSE + for(var/mob/living/in_the_way in spot) + if(in_the_way != victim && in_the_way != bearer && in_the_way.density) + return FALSE + bearer.gorilla_slam = src + victim.gorilla_slam = src + started_at = world.time + aimed_zone = check_zone(bearer.zone_selected) + face_down = !isnull(table_ref) && aimed_zone == BODY_ZONE_HEAD + var/now_facing = (bearer.dir in GLOB.cardinals) ? bearer.dir : ((bearer.dir & (EAST|WEST)) || SOUTH) + taking = toward(victim_spot) || now_facing + facing = toward(spot) || taking + bearer.setDir(taking) + t_top = t_grip + (arm.slam_overhead ? GORILLA_SLAM_HOIST_TIME : BRAWLER_SLAM_HOIST_TIME) + t_drive = t_top + GORILLA_SLAM_TOP_TIME + t_hit = t_drive + GORILLA_SLAM_DRIVE_TIME + t_mid = t_hit + GORILLA_SLAM_REBOUND_TIME / 2 + t_up = t_hit + GORILLA_SLAM_RISE_TIME + t_end = t_hit + GORILLA_SLAM_SETTLE_TIME + measure() + posed = build_rigs() + if(posed) + build_keys() + set_stage() + play(0, t_hit) + else + take_down() + ADD_TRAIT(bearer, TRAIT_IMMOBILIZED, GORILLA_SLAM_TRAIT) + listen() + hit_timer = addtimer(CALLBACK(src, PROC_REF(hit)), t_hit, TIMER_STOPPABLE | TIMER_DELETE_ME) + return TRUE + +/// Where [body] is drawn: list(x, y) pixels from where the bearer was drawn at the click. +/datum/gorilla_slam/proc/drawn_at(mob/living/body) + var/turf/here = get_turf(body) + return list((here.x - bearer_spot.x) * ICON_SIZE_X + body.pixel_x + body.pixel_w - origin_x, (here.y - bearer_spot.y) * ICON_SIZE_Y + body.pixel_y + body.pixel_z - origin_y) + +/// [body]'s lying turn in degrees clockwise, the short way round: 0 on its feet, 90 or -90 lying. +/datum/gorilla_slam/proc/turn_of(mob/living/body) + return body.lying_angle > 180 ? body.lying_angle - 360 : body.lying_angle + +/// Works out where the body is held, where the top of the lift is and where it lands, all from where the bearer is drawn. +/datum/gorilla_slam/proc/measure() + origin_x = bearer.pixel_x + bearer.pixel_w + origin_y = bearer.pixel_y + bearer.pixel_z + var/list/victim_at = drawn_at(victim) + held_x = victim_at[1] + held_y = victim_at[2] + held_angle = turn_of(victim) + tile_x = (spot.x - bearer_spot.x) * ICON_SIZE_X + tile_y = (spot.y - bearer_spot.y) * ICON_SIZE_Y + var/side_on = facing & (EAST|WEST) + var/ahead = facing == WEST ? -1 : 1 + // Seen from the side the head ends at his feet, under his fists; from the front or back the body lies head east + var/turned = facing == EAST ? -1 : 1 + if(arm.slam_overhead) + top_x = side_on ? GORILLA_SLAM_TOP_SIDE_X * ahead : GORILLA_SLAM_TOP_FRONT_X + top_y = side_on ? GORILLA_SLAM_TOP_SIDE_Y : (facing == NORTH ? GORILLA_SLAM_TOP_BACK_Y : GORILLA_SLAM_TOP_FRONT_Y) + top_angle = 90 * turned + else + top_x = side_on ? BRAWLER_SLAM_TOP_SIDE_X * ahead : BRAWLER_SLAM_TOP_FRONT_X + top_y = side_on ? BRAWLER_SLAM_TOP_SIDE_Y : BRAWLER_SLAM_TOP_FRONT_Y + top_angle = BRAWLER_SLAM_TOP_TURN * turned + land_angle = 90 * turned + land_x = tile_x + // Where tg draws a body lying there: a little down the tile, and up on a table top + land_y = tile_y + PIXEL_Y_OFFSET_LYING + (table_ref ? GORILLA_SLAM_TABLE_TOP : 0) + final_x = land_x + final_y = land_y + final_angle = land_angle + +// ========================================================================= +// THE RIGS +// ========================================================================= + +/// A flat picture of [body] facing [way], into [rig]. getFlatIcon() draws a body in its own facing unless it faces south, so it is turned for the picture. +/datum/gorilla_slam/proc/picture(datum/chrome_rig/rig, mob/living/body, way) + var/real_dir = body.dir + body.dir = way + . = rig.snapshot() + body.dir = real_dir + +/** + * Stands a puppet of [rig] under [key] where the bearer stands, [row] tiles up the map from him (-1: the row nearer the + * viewer), on [puppet_layer]. It is moved by its transform from there. + */ +/datum/gorilla_slam/proc/stand(datum/chrome_rig/rig, key, icon/picture, row, puppet_layer) + var/obj/effect/abstract/chrome_puppet/puppet = new(bearer_spot) + puppet.name = rig.body.name + puppet.icon = picture + puppet.dir = SOUTH + puppet.plane = bearer.plane + puppet.layer = puppet_layer + puppet.pixel_x = bearer.pixel_x + puppet.pixel_w = bearer.pixel_w + puppet.pixel_y = bearer.pixel_y + row * ICON_SIZE_Y + puppet.pixel_z = bearer.pixel_z - row * ICON_SIZE_Y + rig.puppets[key] = puppet + return puppet + +/// The two arms of [rig] in the order key poses name them: the near one then the far one seen from the side, else the one on the viewer's left then the other. +/datum/gorilla_slam/proc/arm_pair(datum/chrome_rig/rig) + if(rig.facing & (EAST|WEST)) + var/near = rig.near_side() + return list(near, near == "l" ? "r" : "l") + return rig.facing == NORTH ? list("l", "r") : list("r", "l") + +/** + * Builds the bearer's rig for each way he faces in the move, and a puppet of the body for each. Back to front: + * seen from the side, far arm, legs and torso, the body, near arm; from behind, the body, torso, arms; from the front, + * torso, the body, arms. Returns FALSE if either couldn't be rigged. + */ +/datum/gorilla_slam/proc/build_rigs() + rigs = list() + var/list/ways = taking == facing ? list(taking) : list(taking, facing) + for(var/way in ways) + var/datum/chrome_rig/rig = new(bearer, way) + rigs["[way]"] = rig + if(!picture(rig, bearer, way)) + return FALSE + victim_rig = new(victim, face_down ? NORTH : SOUTH) + if(!picture(victim_rig, victim, victim_rig.facing)) + return FALSE + var/base = bearer.layer + for(var/way in ways) + var/datum/chrome_rig/rig = rigs["[way]"] + // The row of the tile the body is on while this rig shows: the one it is taken from, then the one it lands on + var/turf/from = way == taking ? victim_spot : spot + var/turf/onto = way == facing ? spot : victim_spot + var/body_row = min(from.y, onto.y) < bearer_spot.y ? -1 : 0 + var/icon/whole = rig.cut_without_arms("both") + if(way & (EAST|WEST)) + // Split at the belt, the halves sharing three rows so no gap opens behind the bend + var/icon/legs = icon(whole) + legs.DrawBox(null, 1, 13, ICON_SIZE_X, ICON_SIZE_Y) + var/icon/torso = icon(whole) + torso.DrawBox(null, 1, 1, ICON_SIZE_X, 9) + stand(rig, "legs", legs, 0, base) + stand(rig, "body", torso, 0, base + 0.001) + var/near = rig.near_side() + stand(rig, "arm_[near]", rig.arm_picture(near), body_row, base + 0.03) + var/far = near == "l" ? "r" : "l" + stand(rig, "arm_[far]", rig.arm_picture(far), 0, base - 0.02) + stand(victim_rig, "body_[way]", victim_rig.flat, body_row, base + 0.02) + else if(way == NORTH) + stand(rig, "body", whole, 0, base) + for(var/side in list("l", "r")) + stand(rig, "arm_[side]", rig.arm_picture(side), 0, base + 0.02) + stand(victim_rig, "body_[way]", victim_rig.flat, 0, base - 0.02) + else + stand(rig, "body", whole, 0, base) + for(var/side in list("l", "r")) + stand(rig, "arm_[side]", rig.arm_picture(side), body_row, base + 0.03) + stand(victim_rig, "body_[way]", victim_rig.flat, body_row, base + 0.02) + var/datum/chrome_rig/first = rigs["[taking]"] + first.conceal() + victim_rig.conceal() + // The rig he turns into hides no body of its own: its puppets still go in the same file as the rest + if(taking != facing) + var/datum/chrome_rig/turned = rigs["[facing]"] + turned.pack() + return TRUE + +// ========================================================================= +// THE POSES +// ========================================================================= + +/// The body at [time]: list(x, y, turn), its middle in pixels from where the bearer is drawn and its turn in degrees clockwise. +/datum/gorilla_slam/proc/body_at(time) + if(time <= t_grip) + return list(held_x, held_y, held_angle) + if(time <= t_top) + // Fast out of the floor, easing into the top + var/up = gorilla_slam_ease(SLAM_EASE_OUT, (time - t_grip) / (t_top - t_grip)) + return list(held_x + (top_x - held_x) * up, held_y + (top_y - held_y) * up, held_angle + (top_angle - held_angle) * up) + if(time <= t_drive) + return list(top_x, top_y, top_angle) + if(time <= t_hit) + // Straight down, faster all the way + var/down = gorilla_slam_ease(SLAM_EASE_IN, (time - t_drive) / (t_hit - t_drive)) + return list(top_x + (land_x - top_x) * down, top_y + (land_y - top_y) * down, top_angle + (land_angle - top_angle) * down) + // It bounces once, tipping, and drops back onto where the real body lies + var/settled = clamp((time - t_hit) / GORILLA_SLAM_REBOUND_TIME, 0, 1) + var/hop = sin(180 * settled) + var/tip = (land_angle < 0 ? GORILLA_SLAM_BOUNCE_TIP : -GORILLA_SLAM_BOUNCE_TIP) * hop + return list( + land_x + (final_x - land_x) * settled, + land_y + (final_y - land_y) * settled + (arm?.slam_overhead ? GORILLA_SLAM_BOUNCE : BRAWLER_SLAM_BOUNCE) * hop, + land_angle + (final_angle - land_angle) * settled + tip, + ) + +/// The body puppet's transform at [time]. +/datum/gorilla_slam/proc/body_matrix(time) + var/list/at = body_at(time) + var/matrix/placed + if(landed && time >= t_hit + GORILLA_SLAM_REBOUND_TIME && !QDELETED(victim)) + // The real body's own turn, so the puppet ends in its pixels + placed = matrix(victim.transform) + else + placed = matrix() + placed.Turn(at[3]) + placed.Translate(at[1], at[2]) + return placed + +/// The point [x], [y] of the scene (pixels from where the bearer is drawn) in the body's own pixels at [time]. +/datum/gorilla_slam/proc/on_body(time, x, y) + var/list/at = body_at(time) + var/dx = x - at[1] + var/dy = y - at[2] + return list(dx * cos(at[3]) - dy * sin(at[3]), dx * sin(at[3]) + dy * cos(at[3])) + +/** + * The bearer's transforms in a pose of the rig facing [way]: list(legs, torso, arms' base). Seen from the side the legs lean + * from the feet and the torso bends on at the belt; from the front or back the whole body is squashed and the legs are null. + */ +/datum/gorilla_slam/proc/bases(way, shift_x, shift_y, lean, waist, squash, drop) + if(way & (EAST|WEST)) + var/forward = way == EAST ? 1 : -1 + var/matrix/legs = chrome_rig_turn(forward * lean, 0, CHROME_RIG_FEET_Y) + var/matrix/torso = chrome_rig_turn(forward * waist, 0, SLAM_WAIST_Y) + torso.Multiply(legs) + torso.Translate(shift_x, shift_y) + legs.Translate(shift_x, shift_y) + return list(legs, torso, torso) + var/datum/chrome_rig/rig = rigs["[way]"] + var/shoulder_y = rig.shoulder("l")[2] + // The arms come down with the squashed shoulders + return list(null, matrix(1, 0, shift_x, 0, squash, shift_y - drop), matrix(1, 0, shift_x, 0, 1, shift_y + shoulder_y * squash - drop - shoulder_y)) + +/// The bases of key pose [pose]. +/datum/gorilla_slam/proc/bases_of(datum/gorilla_slam_pose/pose) + return bases(pose.facing, pose.shift_x, pose.shift_y, pose.lean, pose.waist, pose.squash, pose.drop) + +/// The arm of [rig] on [side] as swing_arm() would leave it: list(turn, length). +/datum/gorilla_slam/proc/swung(datum/chrome_rig/rig, side, angle, reach) + return list(angle * rig.raise_sign(side), max(GORILLA_SLAM_MIN_REACH, 1 + reach / (GLOB.chrome_rig_arm_length["[rig.facing]"] || 10))) + +/// The arm of [rig] on [side] with its hand at [x], [y] of the scene, the body under it turned by [base]: list(turn, length). It stops short past its longest. +/datum/gorilla_slam/proc/reaching(datum/chrome_rig/rig, side, x, y, matrix/base) + var/list/pose = rig.pose_reaching(side, x, y, 0, base) + pose[2] = min(pose[2], GORILLA_SLAM_MAX_REACH) + return pose + +/** + * Poses [pose] with both fists on a body lying on the tile at [at_x], [at_y] (pixels from where the bearer stands), its + * middle [rise] pixels above the tile's: bent at the belt and leaning in, seen from the side; dropped and lunging, from the + * front or back. [on_table] is the shallower reach onto a table top. + */ +/datum/gorilla_slam/proc/press(datum/gorilla_slam_pose/pose, at_x, at_y, rise, on_table) + var/datum/chrome_rig/rig = rigs["[pose.facing]"] + var/way_x = (pose.facing == EAST) - (pose.facing == WEST) + var/way_y = (pose.facing == NORTH) - (pose.facing == SOUTH) + // How far in front of him the tile is: a whole tile, or none for his own + var/ahead = at_x * way_x + at_y * way_y + var/body_y = at_y + rise + pose.arms = list() + if(way_x) + pose.waist = on_table ? 30 : 50 + pose.shift_x = way_x * ((on_table ? 10 : 12) + (ahead - ICON_SIZE_X) * 18 / ICON_SIZE_X) + // A tile up or down the map as well: he goes most of the way with it + pose.shift_y = at_y * 22 / ICON_SIZE_Y + var/list/pair = arm_pair(rig) + pose.arms[pair[1]] = list(SLAM_ARM_POINT, pose.shift_x + way_x * (on_table ? 11 : 15), body_y + (on_table ? 2 : 3)) + pose.arms[pair[2]] = list(SLAM_ARM_POINT, pose.shift_x + way_x * (on_table ? 9 : 12), body_y + (on_table ? 2 : 3)) + return + var/share = ahead / ICON_SIZE_Y + var/edge + if(way_y > 0) + pose.squash = 0.8 + pose.drop = 3 + pose.shift_y = (on_table ? 13 : 10) * share + edge = body_y - (on_table ? 7 : 4) + else + pose.squash = on_table ? 0.85 : 0.8 + pose.drop = on_table ? 2.25 : 3 + pose.shift_y = (on_table ? -4 : -14) * share + edge = body_y + (on_table ? 6 : 7) * share + 2 * (1 - share) + for(var/side in list("l", "r")) + pose.arms[side] = list(SLAM_ARM_POINT, rig.shoulder(side)[1], edge) + +/// Works out [pose]'s arms: where each fist is on the body (grips) and the arm's own turn and length there (reached). +/datum/gorilla_slam/proc/settle_arms(datum/gorilla_slam_pose/pose) + var/datum/chrome_rig/rig = rigs["[pose.facing]"] + var/matrix/base = bases_of(pose)[3] + for(var/side in list("l", "r")) + var/list/does = pose.arms[side] + switch(does[1]) + if(SLAM_ARM_SWING) + pose.reached[side] = swung(rig, side, does[2], does[3]) + continue + if(SLAM_ARM_GRIP) + pose.grips[side] = list(does[2], does[3]) + if(SLAM_ARM_POINT) + pose.grips[side] = on_body(pose.time, does[2], does[3]) + if(SLAM_ARM_HELD) + var/list/swing = swung(rig, side, does[2], does[3]) + var/list/hand = rig.hand_at(side, list(swing[1], swing[2], base)) + pose.grips[side] = on_body(pose.time, hand[1], hand[2]) + var/list/grip = pose.grips[side] + var/list/point = chrome_rig_apply(body_matrix(pose.time), grip[1], grip[2]) + pose.reached[side] = reaching(rig, side, point[1], point[2], base) + +/// Both arms hanging. +/datum/gorilla_slam/proc/arms_down() + return list("l" = list(SLAM_ARM_SWING, 0, 0), "r" = list(SLAM_ARM_SWING, 0, 0)) + +/// Builds the key poses: standing, the grip, the top (the end of the hoist in the rig that takes the body, then held in the rig that brings it down), the impact, half way up, and upright. +/datum/gorilla_slam/proc/build_keys() + var/datum/chrome_rig/take_rig = rigs["[taking]"] + var/datum/chrome_rig/slam_rig = rigs["[facing]"] + var/take_x = (taking == EAST) - (taking == WEST) + var/slam_x = (facing == EAST) - (facing == WEST) + + var/datum/gorilla_slam_pose/stood = new(0, taking) + stood.arms = arms_down() + + // The grip. A body on its feet: he leans in and takes its near side by belt and collar, or its sides seen from the + // front or back. A body on the floor: he goes down to it as he will at the impact. + var/datum/gorilla_slam_pose/grip = new(t_grip, taking, SLAM_EASE_SINE) + var/list/pair = arm_pair(take_rig) + if(held_angle) + press(grip, held_x, held_y - PIXEL_Y_OFFSET_LYING, PIXEL_Y_OFFSET_LYING, FALSE) + else if(take_x) + grip.waist = 18 + grip.shift_x = 4 * take_x + grip.shift_y = held_y * 22 / ICON_SIZE_Y + grip.arms = list() + grip.arms[pair[1]] = list(SLAM_ARM_GRIP, -5 * take_x, -6) + grip.arms[pair[2]] = list(SLAM_ARM_GRIP, -4 * take_x, 3) + else if(taking == NORTH) + grip.arms = list() + grip.arms[pair[1]] = list(SLAM_ARM_GRIP, -5, -3) + grip.arms[pair[2]] = list(SLAM_ARM_GRIP, 5, -3) + else + grip.squash = 0.9 + grip.drop = 1.5 + grip.shift_y = -4 + grip.arms = list() + grip.arms[pair[1]] = list(SLAM_ARM_GRIP, -6, 2) + grip.arms[pair[2]] = list(SLAM_ARM_GRIP, 6, 2) + + // The top. Gorilla Arms: pressed overhead at full reach, leaning back under it. Brawler myomers: at the shoulder. + var/datum/gorilla_slam_pose/top = new(t_top, facing) + pair = arm_pair(slam_rig) + top.arms = list() + if(slam_x) + if(arm.slam_overhead) + top.lean = -6 + top.arms[pair[1]] = list(SLAM_ARM_HELD, 166, 6) + top.arms[pair[2]] = list(SLAM_ARM_HELD, 174, 6) + else + top.arms[pair[1]] = list(SLAM_ARM_GRIP, -7 * slam_x, 0) + top.arms[pair[2]] = list(SLAM_ARM_GRIP, -5 * slam_x, 4.5) + else + if(arm.slam_overhead && facing == NORTH) + top.shift_y = GORILLA_SLAM_TOP_BACK_RISE + for(var/side in list("l", "r")) + top.arms[side] = list(SLAM_ARM_POINT, slam_rig.shoulder(side)[1], top_y - (arm.slam_overhead ? 8 : 7)) + settle_arms(top) + var/datum/gorilla_slam_pose/top_held = new(t_drive, facing) + top_held.lean = top.lean + top_held.shift_y = top.shift_y + top_held.arms = list() + // The hoist ends with the fists where the top has them, in the rig that took the body + var/datum/gorilla_slam_pose/hoisted = new(t_top, taking, SLAM_EASE_OUT) + hoisted.arms = list() + if(taking == facing) + hoisted.lean = top.lean + hoisted.shift_y = top.shift_y + for(var/side in list("l", "r")) + var/list/grip_at = top.grips[side] + top_held.arms[side] = list(SLAM_ARM_GRIP, grip_at[1], grip_at[2]) + hoisted.arms[side] = list(SLAM_ARM_GRIP, grip_at[1], grip_at[2]) + + // The impact, and half way back up with his hands off it + var/datum/gorilla_slam_pose/impact = new(t_hit, facing, SLAM_EASE_IN) + press(impact, tile_x, tile_y, land_y - tile_y, !isnull(table_ref)) + var/datum/gorilla_slam_pose/rising = new(t_mid, facing, SLAM_EASE_OUT) + rising.shift_x = impact.shift_x / 2 + rising.shift_y = impact.shift_y / 2 + rising.arms = list() + if(slam_x) + rising.waist = 24 + rising.arms[pair[1]] = list(SLAM_ARM_SWING, 38, 2) + rising.arms[pair[2]] = list(SLAM_ARM_SWING, 46, 2) + else + rising.squash = 0.9 + rising.drop = 1.5 + for(var/side in list("l", "r")) + rising.arms[side] = list(SLAM_ARM_SWING, 24, 0) + var/datum/gorilla_slam_pose/upright = new(t_up, facing, SLAM_EASE_SINE) + upright.arms = arms_down() + var/datum/gorilla_slam_pose/still = new(t_end, facing) + still.arms = arms_down() + + keys = list(stood, grip, hoisted, top, top_held, impact, rising, upright, still) + for(var/datum/gorilla_slam_pose/pose as anything in keys) + if(pose != top) + settle_arms(pose) + +/** + * The bearer's puppets in the rig facing [way] at [time]: key ("legs", "body", "arm_l", "arm_r") -> transform. The body + * pose is eased between the keys either side; an arm on the body is solved onto its grip, which slides between the keys' + * grips, and the hand of an arm coming off it or going onto it is carried straight between where the two keys have it. + */ +/datum/gorilla_slam/proc/pose_at(time, way) + var/datum/gorilla_slam_pose/from_key + var/datum/gorilla_slam_pose/to_key + for(var/i in 1 to length(keys) - 1) + var/datum/gorilla_slam_pose/first = keys[i] + var/datum/gorilla_slam_pose/second = keys[i + 1] + if(first.facing != way || second.facing != way || second.time <= first.time) + continue + from_key = first + to_key = second + if(time <= second.time) + break + if(!from_key) + return null + var/datum/chrome_rig/rig = rigs["[way]"] + var/progress = gorilla_slam_ease(to_key.ease, (time - from_key.time) / (to_key.time - from_key.time)) + var/list/base = bases(way, + from_key.shift_x + (to_key.shift_x - from_key.shift_x) * progress, + from_key.shift_y + (to_key.shift_y - from_key.shift_y) * progress, + from_key.lean + (to_key.lean - from_key.lean) * progress, + from_key.waist + (to_key.waist - from_key.waist) * progress, + from_key.squash + (to_key.squash - from_key.squash) * progress, + from_key.drop + (to_key.drop - from_key.drop) * progress) + . = list("body" = base[2]) + if(base[1]) + .["legs"] = base[1] + var/matrix/held + for(var/side in list("l", "r")) + var/list/grip_from = from_key.grips[side] + var/list/grip_to = to_key.grips[side] + var/list/arm_pose + if(grip_from && grip_to) + held ||= body_matrix(time) + var/list/point = chrome_rig_apply(held, grip_from[1] + (grip_to[1] - grip_from[1]) * progress, grip_from[2] + (grip_to[2] - grip_from[2]) * progress) + arm_pose = reaching(rig, side, point[1], point[2], base[3]) + else + // Coming off the body or going onto it: the hand goes straight from where one key has it to where the other + // does, in his own pixels, so the arm folds in past the shoulder and never swings out wide + var/list/hand_from = rig.hand_at(side, from_key.reached[side]) + var/list/hand_to = rig.hand_at(side, to_key.reached[side]) + arm_pose = rig.pose_reaching(side, hand_from[1] + (hand_to[1] - hand_from[1]) * progress, hand_from[2] + (hand_to[2] - hand_from[2]) * progress) + arm_pose[2] = min(arm_pose[2], GORILLA_SLAM_MAX_REACH) + .["arm_[side]"] = rig.arm_matrix(side, arm_pose[1], arm_pose[2], base[3]) + +/// Every puppet takes its first pose: the rig that takes the body as he stands, the rig that brings it down at the top and unseen until then. +/datum/gorilla_slam/proc/set_stage() + for(var/way_text in rigs) + var/datum/chrome_rig/rig = rigs[way_text] + var/way = rig.facing + var/first_time = way == taking ? 0 : t_top + var/list/poses = pose_at(first_time, way) + var/obj/effect/abstract/chrome_puppet/held = victim_rig.puppet("body_[way]") + if(way == taking) + // Exactly as the real body is drawn, whatever its size + var/matrix/as_held = matrix(victim.transform) + as_held.Translate(held_x, held_y) + held.transform = as_held + else + held.transform = body_matrix(first_time) + held.alpha = 0 + for(var/key in poses) + var/obj/effect/abstract/chrome_puppet/puppet = rig.puppet(key) + puppet.transform = poses[key] + if(way != taking) + puppet.alpha = 0 + +/** + * Plays the move from [from_time] to [to_time] (deciseconds from the click, now being [from_time]): every puppet goes + * through its poses in straight steps of GORILLA_SLAM_STEP. The rig that takes the body shows until the top and the rig + * that brings it down from then on. + */ +/datum/gorilla_slam/proc/play(from_time, to_time) + for(var/way_text in rigs) + var/datum/chrome_rig/rig = rigs[way_text] + var/way = rig.facing + var/on_from = max(from_time, way == taking ? 0 : t_top) + var/on_to = min(to_time, way == facing ? t_end : t_top) + if(on_to <= on_from) + continue + var/steps = max(1, round((on_to - on_from) / GORILLA_SLAM_STEP)) + var/step_time = (on_to - on_from) / steps + var/list/chains = list() + for(var/i in 1 to steps) + var/time = on_from + step_time * i + var/list/poses = pose_at(time, way) + poses["body_[way]"] = body_matrix(time) + for(var/key in poses) + if(!chains[key]) + chains[key] = list() + chains[key] += poses[key] + for(var/key in chains) + var/obj/effect/abstract/chrome_puppet/puppet = key == "body_[way]" ? victim_rig.puppet(key) : rig.puppet(key) + if(puppet) + send_through(puppet, chains[key], step_time, on_from - from_time, on_to < to_time) + +/** + * Sends [puppet] through [poses] (transforms), [step_time] each. With a [wait] it stays unseen that long first; with + * [leave] it goes unseen at the end. The swap takes a hundredth of a second, so two rigs never show at once. + */ +/datum/gorilla_slam/proc/send_through(obj/effect/abstract/chrome_puppet/puppet, list/poses, step_time, wait = 0, leave = FALSE) + var/begun = FALSE + var/first_step = step_time + if(wait > 0) + animate(puppet, alpha = 0, time = wait) + animate(alpha = 255, time = GORILLA_SLAM_SWAP) + first_step = max(0, step_time - GORILLA_SLAM_SWAP) + begun = TRUE + for(var/i in 1 to length(poses)) + if(begun) + animate(transform = poses[i], time = i == 1 ? first_step : step_time) + else + animate(puppet, transform = poses[i], time = step_time) + begun = TRUE + if(leave) + animate(alpha = 0, time = GORILLA_SLAM_SWAP) + +// ========================================================================= +// CALLING IT OFF +// ========================================================================= + +/datum/gorilla_slam/proc/listen() + RegisterSignals(bearer, list( + COMSIG_MOVABLE_MOVED, + COMSIG_ATOM_NO_LONGER_PULLING, + COMSIG_LIVING_SET_BODY_POSITION, + COMSIG_MOB_STATCHANGE, + SIGNAL_ADDTRAIT(TRAIT_INCAPACITATED), + ), PROC_REF(on_change)) + RegisterSignal(victim, COMSIG_MOVABLE_MOVED, PROC_REF(on_change)) + RegisterSignal(bearer, COMSIG_QDELETING, PROC_REF(on_deleted)) + RegisterSignal(victim, COMSIG_QDELETING, PROC_REF(on_deleted)) + +/datum/gorilla_slam/proc/stop_listening() + if(bearer) + UnregisterSignal(bearer, list( + COMSIG_MOVABLE_MOVED, + COMSIG_ATOM_NO_LONGER_PULLING, + COMSIG_LIVING_SET_BODY_POSITION, + COMSIG_MOB_STATCHANGE, + SIGNAL_ADDTRAIT(TRAIT_INCAPACITATED), + COMSIG_QDELETING, + )) + if(victim) + UnregisterSignal(victim, list(COMSIG_MOVABLE_MOVED, COMSIG_QDELETING)) + +/// Whether the slam can still land: the bearer up and able, the grab on, both where they stood, the arm running. +/datum/gorilla_slam/proc/still_held() + if(QDELETED(bearer) || QDELETED(victim) || QDELETED(arm) || arm.owner != bearer || !arm.gorilla_running()) + return FALSE + if(bearer.stat != CONSCIOUS || HAS_TRAIT(bearer, TRAIT_INCAPACITATED) || bearer.body_position == LYING_DOWN) + return FALSE + if(bearer.pulling != victim || bearer.grab_state < GRAB_AGGRESSIVE || victim.buckled) + return FALSE + return bearer.loc == bearer_spot && victim.loc == victim_spot + +/// Something changed for one of them: before the impact the slam is called off if it can't land any more; after it, a body that is moved shows as it is. +/datum/gorilla_slam/proc/on_change(datum/source) + SIGNAL_HANDLER + if(ended || placing) + return + if(!landed) + if(!still_held()) + call_off() + return + if(bearer.loc != bearer_spot || victim.loc != spot) + finish() + +/datum/gorilla_slam/proc/on_deleted(datum/source) + SIGNAL_HANDLER + finish() + +/** + * Calls the slam off before the impact. The bearer shows as he is now, free to move, and the body comes down on its feet + * where it stands, unhurt. + */ +/datum/gorilla_slam/proc/call_off() + if(landed || ended) + return + ended = TRUE + if(hit_timer) + deltimer(hit_timer) + hit_timer = null + stop_listening() + if(QDELETED(bearer) || QDELETED(victim)) + finish() + return + REMOVE_TRAIT(bearer, TRAIT_IMMOBILIZED, GORILLA_SLAM_TRAIT) + victim.visible_message(span_danger("[bearer] loses [bearer.p_their()] hold on [victim]!"), span_userdanger("[bearer] loses [bearer.p_their()] hold on you!"), ignored_mobs = bearer) + to_chat(bearer, span_danger("You lose your hold on [victim]!")) + var/showing = world.time - started_at < t_top ? taking : facing + var/obj/effect/abstract/chrome_puppet/held = posed ? victim_rig?.puppet("body_[showing]") : null + // A body taken off its tile shows where it is at once: its puppet would set down on the tile it left. + if(!held || !isturf(victim.loc) || victim.loc != victim_spot) + finish() + return + // His own puppets go at once; the body's puppet comes down onto the real body, and the one not on yet never shows + QDEL_LIST_ASSOC_VAL(rigs) + rigs = null + for(var/key in victim_rig.puppets) + if(victim_rig.puppets[key] != held) + victim_rig.drop_puppet(key) + var/list/victim_at = drawn_at(victim) + var/matrix/down = matrix(victim.transform) + down.Translate(victim_at[1], victim_at[2]) + animate(held, transform = down, alpha = 255, time = GORILLA_SLAM_SET_DOWN_TIME, easing = SINE_EASING | EASE_IN) + end_timer = addtimer(CALLBACK(src, PROC_REF(finish)), GORILLA_SLAM_SET_DOWN_TIME, TIMER_STOPPABLE | TIMER_DELETE_ME) + // Lost grip first, then the body taken off its tile (a pull breaks before the body moves): it shows where it is at + // once, not hidden under a puppet setting down on the tile it left. Destroy()'s stop_listening() lets go of this. + RegisterSignal(victim, COMSIG_MOVABLE_MOVED, PROC_REF(on_deleted)) + +/// The slam is over: the puppets go and both bodies show. +/datum/gorilla_slam/proc/finish() + end_timer = null + if(!QDELETED(src)) + qdel(src) + +// ========================================================================= +// THE IMPACT +// ========================================================================= + +/// The body comes down, if the slam can still land: the grab lets go, the body is put on the tile, and the blow lands. +/datum/gorilla_slam/proc/hit() + hit_timer = null + if(landed || ended) + return + if(!still_held()) + call_off() + return + var/obj/structure/table/table = table_ref?.resolve() + if(table && (QDELETED(table) || table.loc != spot)) + table = null + if(!table && !gorilla_slam_floor_ok(spot)) + call_off() + return + placing = TRUE + bearer.stop_pulling() + var/turf/stood = victim.loc + if(victim.loc != spot) + var/passtable_key = REF(src) + if(table) + passtable_on(victim, passtable_key) + victim.Move(spot, get_dir(victim, spot)) + if(table) + passtable_off(victim, passtable_key) + if(victim.loc != spot && victim.loc != stood && isturf(stood)) + // A diagonal move goes a step at a time: one that got half way was never there, it never left the hoist + victim.forceMove(stood) + placing = FALSE + if(victim.loc != spot) + // Something stopped them getting there + call_off() + return + landed = TRUE + bearer.setDir(facing) + // On its back, or face down for a head-aimed table slam: tg's fall keeps a body facing north or south as it is + if(victim.rotate_on_lying) + victim.setDir(face_down ? NORTH : SOUTH) + var/on_table = !isnull(table) + var/bled = strike(table) + if(!QDELETED(src) && !QDELETED(victim) && !QDELETED(bearer)) + impact_fx(on_table, bled) + if(QDELETED(src) || QDELETED(victim) || QDELETED(bearer)) + if(!QDELETED(src)) + finish() + return + if(victim.rotate_on_lying && victim.body_position == LYING_DOWN) + victim.set_lying_angle(facing == EAST ? LYING_ANGLE_WEST : LYING_ANGLE_EAST) + if(!posed) + finish() + return + // The real body is under the puppets: whatever tg is still easing on it (the fall, the grab's pull, a table's lift) ends now + animate(victim, transform = victim.transform, pixel_x = victim.pixel_x, pixel_y = victim.pixel_y, pixel_w = victim.pixel_w, pixel_z = victim.pixel_z, time = 0, flags = ANIMATION_END_NOW) + var/list/victim_at = drawn_at(victim) + final_x = victim_at[1] + final_y = victim_at[2] + final_angle = turn_of(victim) + play(t_hit, t_end) + end_timer = addtimer(CALLBACK(src, PROC_REF(finish)), t_end - t_hit, TIMER_STOPPABLE | TIMER_DELETE_ME) + +/** + * The blow itself on the body, now on the tile: the damage through #509 as one line, the stamina, the knockdown, and what + * the table takes. Returns TRUE if it opened a wound that bleeds. + */ +/datum/gorilla_slam/proc/strike(obj/structure/table/table) + var/obj/item/bodypart/limb = victim.get_bodypart(aimed_zone) || victim.get_bodypart(BODY_ZONE_CHEST) + var/others + var/self + if(table) + others = face_down ? "[bearer] slams [victim] face first into [table]!" : "[bearer] slams [victim] onto [table]!" + self = face_down ? "[bearer] slams you face first into [table]!" : "[bearer] slams you onto [table]!" + else + others = "[bearer] slams [victim] into the floor!" + self = "[bearer] slams you into the floor!" + victim.hv_hold_attack_message(others, self, null, bearer, vision_range = DEFAULT_MESSAGE_RANGE) + var/armour = victim.run_armor_check(limb, MELEE) + // No attack direction: a body driven into the floor throws no blood across the room (#509's heavy-hit spray) + gorilla_hold_spray(victim) + var/mob/living/carbon/carbon_victim = iscarbon(victim) ? victim : null + var/list/wounds_before = carbon_victim?.gorilla_wound_snapshot() + // What tg lays itself for a chest that bleeds inside from the blow (below): where, and what is there already + var/list/coughed_on = list(spot) + var/turf/faced = get_step(spot, victim.dir) + if(faced) + coughed_on += faced + var/list/blood_before = list() + for(var/turf/where as anything in coughed_on) + for(var/obj/effect/blood in where) + if(istype(blood, /obj/effect/decal/cleanable/blood) || istype(blood, /obj/effect/temp_visual/dir_setting/bloodsplatter)) + blood_before += blood + victim.apply_damage(table ? arm.slam_table_damage : arm.slam_floor_damage, BRUTE, limb || BODY_ZONE_CHEST, armour, wound_bonus = arm.punch_wound_bonus, attacking_item = fist) + victim.hv_flush_hit() + if(QDELETED(victim)) + return FALSE + . = !isnull(carbon_victim) && gorilla_slam_opened_wound(carbon_victim, wounds_before) + // A chest that bleeds inside from the blow coughs it up (tg's cracked ribs): real blood, which tg bursts one way over + // the top of the body and splashes on the tile it faces. A body on its back throws the slam's drops instead, so what + // tg has just laid is taken up and the drops (the same blood) go down in its place. + for(var/turf/where as anything in coughed_on) + for(var/obj/effect/blood in where) + if(blood in blood_before) + continue + if(istype(blood, /obj/effect/decal/cleanable/blood) || istype(blood, /obj/effect/temp_visual/dir_setting/bloodsplatter)) + qdel(blood) + . = TRUE + victim.apply_damage(table ? arm.slam_table_stamina : arm.slam_floor_stamina, STAMINA) + victim.Knockdown(arm.slam_knockdown) + gorilla_register_aggression(victim, bearer) + if(table) + var/datum/component/table_smash/smash = table.GetComponent(/datum/component/table_smash) + table.take_damage(arm.slam_table_break) + // Glass tables break as they do under any slammed body + if(!QDELETED(table)) + smash?.after_smash?.Invoke(victim) + log_combat(bearer, victim, table ? "piston-slammed onto a table" : "piston-slammed into the floor", "gorilla arms") + +/** + * What the impact looks and sounds like. Both cameras shake and the body flashes white. A ring spreads from under it: on + * the table top for a table slam, with the table's own crash; on a floor with cracks, and for Gorilla Arms dust and the + * heavy crash. With [bled], a few drops of blood are thrown out round it. + */ +/datum/gorilla_slam/proc/impact_fx(on_table, bled) + var/heavy = arm.slam_full_fx + for(var/mob/living/shaken in list(bearer, victim)) + shake_camera(shaken, heavy ? 3 : 2, heavy ? 2 : 1) + cyberware_flash_fx((posed && victim_rig?.puppet("body_[facing]")) || victim, 0.2 SECONDS) + // Level with the middle of the body: a table top is half way up to where tg draws a body lying on it + new /obj/effect/temp_visual/circle_wave/cyberware_slam/under_body(spot, heavy ? 0.8 : 0.5, on_table ? GORILLA_SLAM_TABLE_TOP / 2 : 0) + if(on_table) + playsound(victim, 'sound/effects/tableslam.ogg', 90, TRUE) + else if(heavy) + playsound(spot, 'sound/effects/meteorimpact.ogg', 40, TRUE) + new /obj/effect/temp_visual/cyberware_impact_cracks(spot, "damaged1", 220) + var/obj/effect/temp_visual/mook_dust/dust = cyberware_grey_dust(spot) + if(dust) + // On the tile's own row, as the ring is, so the body lying there draws over it + dust.pixel_x = 0 + dust.pixel_y = 0 + dust.pixel_w = -ICON_SIZE_X / 2 + dust.pixel_z = -ICON_SIZE_Y / 2 + else + playsound(spot, SFX_BODYFALL, 70, TRUE) + new /obj/effect/temp_visual/cyberware_impact_cracks(spot, "damaged1", 70) + if(bled && iscarbon(victim)) + gorilla_slam_blood(victim, spot) + +/** + * The slam's ring. tg's ring is drawn from half a tile toward the viewer, which puts it on the row in front of its own + * tile and over anybody lying there; this one stays on its tile's row and is centred by eye only, so the body draws over it. + */ +/obj/effect/temp_visual/circle_wave/cyberware_slam/under_body + pixel_x = 0 + pixel_y = 0 + pixel_w = -16 + pixel_z = -16 + +/obj/effect/temp_visual/circle_wave/cyberware_slam/under_body/Initialize(mapload, reach = 2, rise = 0) + pixel_z += rise + return ..() + +/// Whether [victim] has a wound that bleeds which it didn't have, or had milder, at [before] (gorilla_wound_snapshot()): a cut, a stab, or bone through the skin. +/proc/gorilla_slam_opened_wound(mob/living/carbon/victim, list/before) + for(var/datum/wound/wound as anything in victim.all_wounds) + if((wound in before) && before[wound] >= wound.severity) + continue + if(wound.blood_flow > 0 || (istype(wound, /datum/wound/blunt/bone) && wound.severity >= WOUND_SEVERITY_CRITICAL)) + return TRUE + return FALSE + +/// A few drops of [victim]'s blood thrown out round where it lies on [floor], in a ragged ring: no two the same size or the same way up. +/proc/gorilla_slam_blood(mob/living/carbon/victim, turf/floor) + if(!isturf(floor) || isgroundlessturf(floor) || victim.can_bleed(BLOOD_COVER_TURFS) != BLEED_SPLATTER) + return + var/list/blood_dna = victim.get_blood_dna_list() + var/list/viruses = victim.get_static_viruses() + var/drops = rand(GORILLA_SLAM_DROPS_MIN, GORILLA_SLAM_DROPS_MAX) + var/first = rand(0, 359) + for(var/i in 1 to drops) + var/obj/effect/decal/cleanable/blood/splatter/gorilla_skid/drop = new(floor, viruses, blood_dna) + if(QDELETED(drop)) + continue + var/way = first + i * 360 / drops + rand(-18, 18) + var/far = rand(GORILLA_SLAM_DROPS_NEAR, GORILLA_SLAM_DROPS_FAR) + var/matrix/shape = matrix() + shape.Scale(pick(0.45, 0.55, 0.7)) + shape.Turn(pick(0, 90, 180, 270)) + drop.transform = shape + // From under the body outward. The floor is seen from above and a little from the front, so the ring is flattened. + drop.pixel_x = 0 + drop.pixel_y = PIXEL_Y_OFFSET_LYING + animate(drop, pixel_x = round(cos(way) * far), pixel_y = round(sin(way) * far * 0.75) + PIXEL_Y_OFFSET_LYING, time = 0.12 SECONDS, easing = SINE_EASING | EASE_OUT, flags = ANIMATION_PARALLEL) + +#undef SLAM_ARM_GRIP +#undef SLAM_ARM_POINT +#undef SLAM_ARM_HELD +#undef SLAM_ARM_SWING +#undef SLAM_EASE_LINEAR +#undef SLAM_EASE_OUT +#undef SLAM_EASE_IN +#undef SLAM_EASE_SINE +#undef SLAM_WAIST_Y diff --git a/voidcrew/modules/unit_tests/voidcrew_gorilla_gore.dm b/voidcrew/modules/unit_tests/voidcrew_gorilla_gore.dm index 31b857a208e..32db90daa67 100644 --- a/voidcrew/modules/unit_tests/voidcrew_gorilla_gore.dm +++ b/voidcrew/modules/unit_tests/voidcrew_gorilla_gore.dm @@ -264,6 +264,116 @@ sleep(0.8 SECONDS) TEST_ASSERT_EQUAL(victim.loc, spot(1, 0), "A grabbed body was hurled twice inside the cooldown") +/// A human at `where` in [bearer]'s aggressive grab +/datum/unit_test/voidcrew_gorilla_gore/proc/held_by(mob/living/carbon/human/bearer, turf/where) + var/mob/living/carbon/human/consistent/held = allocate(/mob/living/carbon/human/consistent, where) + held.grabbedby(bearer, supress_message = TRUE) + held.grabbedby(bearer, supress_message = TRUE) + TEST_ASSERT(bearer.pulling == held && bearer.grab_state >= GRAB_AGGRESSIVE, "Test fixture: no aggressive grab") + return held + +/// A click on the floor under a held body slams them into it; a table click slams them onto the table +/// instead of caving the table in. Nothing happens to anyone until the body comes down. +/datum/unit_test/voidcrew_gorilla_gore/slam + +/datum/unit_test/voidcrew_gorilla_gore/slam/Run() + var/mob/living/carbon/human/bearer = gorilla(spot(0, 0)) + var/mob/living/carbon/human/consistent/victim = held_by(bearer, spot(1, 0)) + var/hurt_before = victim.getBruteLoss() + TEST_ASSERT_EQUAL(punch(bearer, spot(1, 0)), COMPONENT_CANCEL_ATTACK_CHAIN, "A floor click while grabbing wasn't a slam") + // On the way up: the grab is held, the bearer stays put, and the body is unhurt and still on its feet + TEST_ASSERT_EQUAL(bearer.pulling, victim, "The slam let go before the body came down") + TEST_ASSERT(HAS_TRAIT_FROM(bearer, TRAIT_IMMOBILIZED, "gorilla_slam"), "The bearer can walk off in the middle of a slam") // GORILLA_SLAM_TRAIT + TEST_ASSERT_EQUAL(victim.getBruteLoss(), hurt_before, "The slam hurt them before it landed") + TEST_ASSERT(victim.body_position == STANDING_UP, "The slam floored them before it landed") + TEST_ASSERT(puppets_left() > 0, "The slam posed nobody") + TEST_ASSERT_NOTNULL(victim.get_filter("chrome_rig_hide"), "The real body shows under its puppet") // CHROME_RIG_HIDE_FILTER + sleep(0.5 SECONDS) // 0.44 s to the impact + TEST_ASSERT_NULL(bearer.pulling, "The slam kept the grab") + TEST_ASSERT(victim.getBruteLoss() > hurt_before, "The floor slam did no damage") + TEST_ASSERT(victim.body_position == LYING_DOWN, "The floor slam didn't knock them down") + // On its back, head at the feet of a bearer seen from the side + TEST_ASSERT_EQUAL(victim.dir, SOUTH, "A slammed body didn't land on its back") + TEST_ASSERT_EQUAL(victim.lying_angle, 270, "A body slammed to the east doesn't lie with its head at the bearer's feet") // LYING_ANGLE_WEST + sleep(0.4 SECONDS) // 0.70 s in all + TEST_ASSERT_EQUAL(puppets_left(), 0, "The slam left puppets standing") + TEST_ASSERT_NULL(victim.get_filter("chrome_rig_hide"), "A slammed body stayed hidden") // CHROME_RIG_HIDE_FILTER + TEST_ASSERT_NULL(bearer.get_filter("chrome_rig_hide"), "The bearer stayed hidden after a slam") // CHROME_RIG_HIDE_FILTER + TEST_ASSERT(!HAS_TRAIT_FROM(bearer, TRAIT_IMMOBILIZED, "gorilla_slam"), "The bearer is still held in place after a slam") // GORILLA_SLAM_TRAIT + TEST_ASSERT_NULL(bearer.gorilla_slam, "The slam never ended for the bearer") + TEST_ASSERT_NULL(victim.gorilla_slam, "The slam never ended for the body") + + // The table. A head-aimed one lands face down. + var/mob/living/carbon/human/table_bearer = gorilla(spot(0, 3)) + var/mob/living/carbon/human/consistent/table_victim = held_by(table_bearer, spot(1, 3)) + var/obj/structure/table/table = allocate(/obj/structure/table, spot(1, 4)) + var/table_before = table.get_integrity() + table_bearer.zone_selected = BODY_ZONE_HEAD + TEST_ASSERT_EQUAL(punch(table_bearer, table), COMPONENT_CANCEL_ATTACK_CHAIN, "A table click while grabbing wasn't a slam") + TEST_ASSERT_EQUAL(table_victim.loc, spot(1, 3), "The body was on the table before the slam landed") + sleep(0.5 SECONDS) + TEST_ASSERT_EQUAL(table_victim.loc, spot(1, 4), "The slam didn't put them on the table") + TEST_ASSERT(QDELETED(table) || table.get_integrity() <= table_before - 50, "The table didn't take the slam") // GORILLA_SLAM_TABLE_BREAK + TEST_ASSERT_EQUAL(table_victim.dir, NORTH, "A head-aimed table slam didn't land face down") + +/// A slam is called off before it lands if the bearer is stunned, loses the grab, or the body is moved or can't be put +/// where it was going: the body is unhurt and on its feet, the puppets go, and the bearer is free to move. +/datum/unit_test/voidcrew_gorilla_gore/slam_called_off + +/datum/unit_test/voidcrew_gorilla_gore/slam_called_off/Run() + // The bearer is stunned on the way up + var/mob/living/carbon/human/stunned = gorilla(spot(0, 0)) + var/mob/living/carbon/human/consistent/first = held_by(stunned, spot(1, 0)) + TEST_ASSERT_EQUAL(punch(stunned, spot(1, 0)), COMPONENT_CANCEL_ATTACK_CHAIN, "Test fixture: no slam") + TEST_ASSERT_NOTNULL(stunned.gorilla_slam, "Test fixture: the slam didn't start") + stunned.Paralyze(2 SECONDS) + TEST_ASSERT(!HAS_TRAIT_FROM(stunned, TRAIT_IMMOBILIZED, "gorilla_slam"), "A called-off slam still holds the bearer in place") // GORILLA_SLAM_TRAIT + TEST_ASSERT_NULL(stunned.get_filter("chrome_rig_hide"), "A stunned bearer stayed hidden behind his puppets") // CHROME_RIG_HIDE_FILTER + sleep(0.7 SECONDS) + TEST_ASSERT_EQUAL(first.getBruteLoss(), 0, "A slam landed after the bearer was stunned") + TEST_ASSERT_EQUAL(first.getStaminaLoss(), 0, "A called-off slam winded them") + TEST_ASSERT(first.body_position == STANDING_UP, "A called-off slam knocked them down") + TEST_ASSERT_EQUAL(first.loc, spot(1, 0), "A called-off slam moved the body") + TEST_ASSERT_EQUAL(puppets_left(), 0, "A called-off slam left puppets standing") + TEST_ASSERT_NULL(first.get_filter("chrome_rig_hide"), "A body put back down stayed hidden") // CHROME_RIG_HIDE_FILTER + TEST_ASSERT_NULL(first.gorilla_slam, "A called-off slam never ended for the body") + TEST_ASSERT_NULL(stunned.gorilla_slam, "A called-off slam never ended for the bearer") + + // The grab is lost on the way up + var/mob/living/carbon/human/dropper = gorilla(spot(0, 2)) + var/mob/living/carbon/human/consistent/second = held_by(dropper, spot(1, 2)) + TEST_ASSERT_EQUAL(punch(dropper, spot(1, 2)), COMPONENT_CANCEL_ATTACK_CHAIN, "Test fixture: no second slam") + dropper.stop_pulling() + sleep(0.7 SECONDS) + TEST_ASSERT_EQUAL(second.getBruteLoss(), 0, "A slam landed after the grab was lost") + TEST_ASSERT(second.body_position == STANDING_UP, "A slam with the grab lost knocked them down") + TEST_ASSERT(!HAS_TRAIT_FROM(dropper, TRAIT_IMMOBILIZED, "gorilla_slam"), "A bearer who lost the grab is still held in place") // GORILLA_SLAM_TRAIT + TEST_ASSERT_NULL(second.get_filter("chrome_rig_hide"), "A body that slipped the grab stayed hidden") // CHROME_RIG_HIDE_FILTER + + // The body is pulled away on the way up + var/mob/living/carbon/human/robbed = gorilla(spot(0, 4)) + var/mob/living/carbon/human/consistent/third = held_by(robbed, spot(1, 4)) + TEST_ASSERT_EQUAL(punch(robbed, spot(1, 4)), COMPONENT_CANCEL_ATTACK_CHAIN, "Test fixture: no third slam") + third.forceMove(spot(4, 4)) + TEST_ASSERT_NULL(third.get_filter("chrome_rig_hide"), "A body taken away stayed hidden") // CHROME_RIG_HIDE_FILTER + sleep(0.7 SECONDS) + TEST_ASSERT_EQUAL(third.getBruteLoss(), 0, "A slam landed on a body that was taken away") + TEST_ASSERT_EQUAL(third.loc, spot(4, 4), "A slam brought back a body that was taken away") + TEST_ASSERT_NULL(robbed.gorilla_slam, "A slam on a body taken away never ended") + + // Something blocks the table before the body gets there: it comes down where it stood + var/mob/living/carbon/human/blocked = gorilla(spot(3, 0)) + var/mob/living/carbon/human/consistent/fourth = held_by(blocked, spot(4, 0)) + var/obj/structure/table/table = allocate(/obj/structure/table, spot(3, 1)) + var/table_before = table.get_integrity() + TEST_ASSERT_EQUAL(punch(blocked, table), COMPONENT_CANCEL_ATTACK_CHAIN, "Test fixture: no table slam") + allocate(/obj/structure/window/reinforced/fulltile, spot(3, 1)) + sleep(0.7 SECONDS) + TEST_ASSERT_EQUAL(fourth.loc, spot(4, 0), "A body went through a window onto a table") + TEST_ASSERT_EQUAL(fourth.getBruteLoss(), 0, "A slam that couldn't reach the table hurt them") + TEST_ASSERT_EQUAL(table.get_integrity(), table_before, "A slam that couldn't reach the table hit it") + TEST_ASSERT_EQUAL(puppets_left(), 0, "A slam that couldn't reach the table left puppets standing") + // ========================================================================= // WALL IMPACTS (owner D38) // ========================================================================= @@ -719,6 +829,66 @@ // BRAWLER MYOMERS (owner D49): the street slam, the light pound, the rip, doors // ========================================================================= +/// Brawler myomers slam a held body lighter and on a longer clock, never hurl it, and need the chrome +/// running and a bearer who will hurt someone. +/datum/unit_test/voidcrew_gorilla_gore/brawler_slam + +/datum/unit_test/voidcrew_gorilla_gore/brawler_slam/Run() + var/mob/living/carbon/human/brawler = gorilla(spot(0, 0), street = TRUE) + var/mob/living/carbon/human/consistent/held = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + held.grabbedby(brawler, supress_message = TRUE) + held.grabbedby(brawler, supress_message = TRUE) + var/brute_before = held.getBruteLoss() + var/stamina_before = held.getStaminaLoss() + TEST_ASSERT_EQUAL(punch(brawler, spot(1, 0)), COMPONENT_CANCEL_ATTACK_CHAIN, "A Brawler floor click while grabbing wasn't a slam") + var/grab_wait = S_TIMER_COOLDOWN_TIMELEFT(brawler, "gorilla_grab_move") // COOLDOWN_GORILLA_GRAB_MOVE + TEST_ASSERT(grab_wait > 10 SECONDS, "The Brawler slam's grab clock is the Gorilla's ([grab_wait])") // BRAWLER_GRAB_MOVE_COOLDOWN 15 s + sleep(0.3 SECONDS) + TEST_ASSERT_EQUAL(held.getBruteLoss(), brute_before, "A Brawler slam landed inside 0.3 s") // 0.40 s to the impact + sleep(0.2 SECONDS) + TEST_ASSERT_NULL(brawler.pulling, "The Brawler slam kept the grab") + TEST_ASSERT_EQUAL(held.loc, spot(1, 0), "The Brawler slam moved the body") + TEST_ASSERT_EQUAL(held.getBruteLoss() - brute_before, 18, "A Brawler floor slam didn't land 18") // BRAWLER_SLAM_FLOOR_DAMAGE + var/winded = held.getStaminaLoss() - stamina_before + TEST_ASSERT(winded > 15 && winded <= 20, "A Brawler floor slam took [winded] stamina, not 20") // BRAWLER_SLAM_FLOOR_STAMINA + TEST_ASSERT(held.body_position == LYING_DOWN, "The Brawler slam didn't knock them down") + TEST_ASSERT(held.AmountKnockdown() <= 1 SECONDS, "The Brawler slam floored them for the Gorilla's two seconds") // BRAWLER_SLAM_KNOCKDOWN + + // The table, lighter on the body and on the table + var/mob/living/carbon/human/table_brawler = gorilla(spot(0, 3), street = TRUE) + var/mob/living/carbon/human/consistent/table_victim = allocate(/mob/living/carbon/human/consistent, spot(1, 3)) + var/obj/structure/table/table = allocate(/obj/structure/table, spot(1, 4)) + var/table_before = table.get_integrity() + var/table_brute = table_victim.getBruteLoss() + table_victim.grabbedby(table_brawler, supress_message = TRUE) + table_victim.grabbedby(table_brawler, supress_message = TRUE) + TEST_ASSERT_EQUAL(punch(table_brawler, table), COMPONENT_CANCEL_ATTACK_CHAIN, "A Brawler table click while grabbing wasn't a slam") + sleep(0.5 SECONDS) + TEST_ASSERT_EQUAL(table_victim.getBruteLoss() - table_brute, 22, "A Brawler table slam didn't land 22") // BRAWLER_SLAM_TABLE_DAMAGE + TEST_ASSERT(!QDELETED(table) && table.get_integrity() > table_before - 50 && table.get_integrity() <= table_before - 30, "A Brawler table slam didn't do 30 to the table") // BRAWLER_SLAM_TABLE_BREAK + + // A punch on a held body lands where it stands: no hurl + var/mob/living/carbon/human/hurler = gorilla(spot(3, 0), street = TRUE) + var/mob/living/carbon/human/consistent/punched = allocate(/mob/living/carbon/human/consistent, spot(4, 0)) + punched.grabbedby(hurler, supress_message = TRUE) + punched.grabbedby(hurler, supress_message = TRUE) + TEST_ASSERT_EQUAL(punch(hurler, punched), COMPONENT_CANCEL_ATTACK_CHAIN, "Test fixture: the Brawler punch didn't land") + sleep(0.8 SECONDS) + TEST_ASSERT_EQUAL(punched.loc, spot(4, 0), "Brawler myomers hurled a held body") + + // A pacifist never slams; neither does an arm that's down + var/mob/living/carbon/human/pacifist = gorilla(spot(3, 2), street = TRUE) + var/mob/living/carbon/human/consistent/spared = allocate(/mob/living/carbon/human/consistent, spot(4, 2)) + ADD_TRAIT(pacifist, TRAIT_PACIFISM, TRAIT_SOURCE_UNIT_TESTS) + spared.grabbedby(pacifist, supress_message = TRUE) + spared.grabbedby(pacifist, supress_message = TRUE) + TEST_ASSERT_NOTEQUAL(punch(pacifist, spot(4, 2)), COMPONENT_CANCEL_ATTACK_CHAIN, "A pacifist Brawler slammed someone") + REMOVE_TRAIT(pacifist, TRAIT_PACIFISM, TRAIT_SOURCE_UNIT_TESTS) + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/fried = arm(pacifist) + fried.organ_flags |= ORGAN_FAILING + TEST_ASSERT(!fried.gorilla_running(), "Test fixture: the failing arm still runs") + TEST_ASSERT_NOTEQUAL(fried.try_slam(pacifist, spot(4, 2), pacifist.get_active_hand()), 1, "A failing Brawler arm slammed someone") // GORILLA_SLAM_DONE + /// The synced Brawler pair's pound staggers and winds those beside it, never dazes them and moves nothing. /datum/unit_test/voidcrew_gorilla_gore/brawler_pound diff --git a/wiki/content/cyberware.md b/wiki/content/cyberware.md index 4f615851658..7943f2f77ab 100644 --- a/wiki/content/cyberware.md +++ b/wiki/content/cyberware.md @@ -115,7 +115,7 @@ The **ammunition shelf** is the return-visit hook: Ronin magazines at 250 credit The newer makers fill in the gaps under the big names. Each takes the same slot as the piece it copies, so it sells back and climbs like the others. - **Spring calves** and **Vaulter pistons**: a short hop on cheap springs, and the service pistons that clear a room. -- **Brawler myomers**: a cased pair of forearms that hit hard and break rock, but no door gives way to them. +- **Brawler myomers**: a cased pair of forearms that hit hard, break rock, slam a held body down and force an airlock, slower than Gorilla Arms. - **Tinker's fingers** and the **Deepcore drill fist**: a looser set of fingertip tools, and a heavier drill on the same ore hopper. - **Holdout housing**: a snub revolver folded into the forearm, loaded one round at a time. - **Hardweave plating** and the **Strut frame**: a heavier dermal weave, and a frame that keeps your bones whole. From 9ff6b70c22b55ce5f46bbe0986bc6ccb0d2c032b Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Sun, 15 Nov 2026 17:57:00 -0800 Subject: [PATCH 10/29] Gorilla Arms gore: the head clap, the limb rip and the backbreaker - A punch at someone in crit or stunned starts a finisher picked by the aimed zone, only square on. - Armour on the part and the Atlas frame turn each one into a lesser hurt. - A crate or a table ahead blocks the backbreaker. - The synced Brawler pair has the limb rip. - The chrome finisher base the other chrome finishers share, and the finisher unit tests. --- tgstation.dme | 2 + .../modules/cyberware/ware_military_arms.dm | 4 + .../hyperviolence_gorilla/gorilla_finisher.dm | 2128 +++++++++++++++++ .../hyperviolence_gorilla/gorilla_throw.dm | 8 - .../hv_finisher_chrome.dm | 142 ++ .../unit_tests/voidcrew_gorilla_gore.dm | 331 +++ 6 files changed, 2607 insertions(+), 8 deletions(-) create mode 100644 voidcrew/modules/hyperviolence_gorilla/gorilla_finisher.dm create mode 100644 voidcrew/modules/hyperviolence_gorilla/hv_finisher_chrome.dm diff --git a/tgstation.dme b/tgstation.dme index b6d8a82d2a5..00123864058 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -7327,6 +7327,7 @@ #include "voidcrew\modules\hyperviolence\wire\wire_users.dm" #include "voidcrew\modules\hyperviolence_gorilla\chrome_puppet_rig.dm" #include "voidcrew\modules\hyperviolence_gorilla\chrome_use_release.dm" +#include "voidcrew\modules\hyperviolence_gorilla\gorilla_finisher.dm" #include "voidcrew\modules\hyperviolence_gorilla\gorilla_haymaker.dm" #include "voidcrew\modules\hyperviolence_gorilla\gorilla_looks.dm" #include "voidcrew\modules\hyperviolence_gorilla\gorilla_pound.dm" @@ -7336,6 +7337,7 @@ #include "voidcrew\modules\hyperviolence_gorilla\gorilla_swing.dm" #include "voidcrew\modules\hyperviolence_gorilla\gorilla_throw.dm" #include "voidcrew\modules\hyperviolence_gorilla\gorilla_thrust.dm" +#include "voidcrew\modules\hyperviolence_gorilla\hv_finisher_chrome.dm" #include "voidcrew\modules\intents\_defines.dm" #include "voidcrew\modules\intents\hud_integration.dm" #include "voidcrew\modules\intents\hud_intent.dm" diff --git a/voidcrew/modules/cyberware/ware_military_arms.dm b/voidcrew/modules/cyberware/ware_military_arms.dm index 3323e221284..e9dce34f473 100644 --- a/voidcrew/modules/cyberware/ware_military_arms.dm +++ b/voidcrew/modules/cyberware/ware_military_arms.dm @@ -275,6 +275,10 @@ log_combat(source, living_target, "attempted to piston-punch", "gorilla arms") return COMPONENT_CANCEL_ATTACK_CHAIN + // Someone in crit or stunned, with the aimed zone picking the finisher (hyperviolence_gorilla/gorilla_finisher.dm). + if(gorilla_try_finisher(source, living_target)) + return COMPONENT_CANCEL_ATTACK_CHAIN + // The one damage line, through #509, with the knockback on the safe path (hyperviolence_gorilla/gorilla_punch.dm). piston_hit(source, living_target, active_hand) COOLDOWN_START(src, slam_cooldown, punch_cooldown_time) diff --git a/voidcrew/modules/hyperviolence_gorilla/gorilla_finisher.dm b/voidcrew/modules/hyperviolence_gorilla/gorilla_finisher.dm new file mode 100644 index 00000000000..cb85f71c3c4 --- /dev/null +++ b/voidcrew/modules/hyperviolence_gorilla/gorilla_finisher.dm @@ -0,0 +1,2128 @@ +/** + * # Gorilla finishers (owner D39) + * + * A piston punch from a synced real pair, with both hands empty, on someone in crit or stunned, finishes + * them instead. The aimed zone picks which: + * - Head: the head clap. Hauled off the floor by the collar, a beat of kicking, then both fists meet on + * the head and it bursts (#509's burst; the brain is thrown out whole, so revival works). A helmet or + * plating crumples instead and the skull caves in. Needs gravity, or the brain would drift off. + * - Arm (the aimed one, else the other): the limb rip. A boot on the body, both fists on the arm, it tears + * off at the shoulder with the spray running back over the bearer, and one blow to the head with it. + * Armour on the arm wrenches the shoulder out instead. + * - Chest: the backbreaker. Pressed overhead, brought down across a knee, the back breaks and the body + * is shoved off it, still bent, onto the tile he faces (at his feet if that tile is blocked). Armour on + * the chest cracks the ribs instead. + * The Atlas frame beats all three: nothing bursts, tears or breaks. + * A synced pair of Brawler myomers has the limb rip only, the same rip on the same terms. + * + * The wind-up is the two bodies (owner D34: no mark): the puppet rig (chrome_puppet_rig.dm) poses the + * bearer's arms and the victim. It can be stopped like any #509 finisher: enough damage on the bearer, + * the bearer moving, stunned or cuffed, the victim pulled away or out of their stun, the arms falling + * out of sync. The haymaker and the finishers share the pistons' cooldown: longer after a kill than + * after being stopped. Starting one counts as aggression at a trader outpost. + */ + +/** + * Starts the Gorilla finisher [zone] picks (the bearer's aim when null), if one can start on [victim]. + * Returns TRUE if it did. The punch calls it with the aim; an AI can call it with a zone. + */ +/proc/gorilla_try_finisher(mob/living/carbon/human/source, mob/living/victim, zone) + if(!iscarbon(victim) || !ishuman(source) || !gorilla_may_use_heavy_moves(source)) + return FALSE + var/gorilla_pair = gorilla_synced(source) + if(!gorilla_pair && !brawler_synced(source)) + return FALSE + if(!TIMER_COOLDOWN_FINISHED(source, COOLDOWN_GORILLA_PISTONS) || source.chrome_finisher) + return FALSE + if(!chrome_finisher_valid_victim(source, victim)) + return FALSE + zone = check_zone(zone || source.zone_selected) + var/datum/hv_finisher/chrome/gorilla/finisher_type + switch(zone) + if(BODY_ZONE_HEAD) + finisher_type = /datum/hv_finisher/chrome/gorilla/clap + if(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM) + finisher_type = /datum/hv_finisher/chrome/gorilla/rip + if(BODY_ZONE_CHEST) + finisher_type = /datum/hv_finisher/chrome/gorilla/backbreaker + if(!finisher_type) + return FALSE + // Brawler myomers have the rip and nothing else + if(!gorilla_pair && !initial(finisher_type.brawler_ok)) + return FALSE + var/datum/hv_finisher/chrome/gorilla/finisher = new finisher_type(source, victim) + finisher.aimed_zone = zone + if(!finisher.start()) + qdel(finisher) + return FALSE + gorilla_register_aggression(victim, source) + return TRUE + +/datum/hv_finisher/chrome/gorilla + name = "gorilla finisher" + /// The zone the bearer aimed when it started + var/aimed_zone + /// The bearer's facing toward the victim, fixed at the start + var/facing + /// The bearer's puppets + var/datum/chrome_rig/bearer_rig + /// The victim's puppets + var/datum/chrome_rig/victim_rig + /// Whether a synced pair of Brawler myomers can do this one too, not only Gorilla Arms + var/brawler_ok = FALSE + /// Where the victim was drawn before the finisher's grab, list(x, y) of their pixel offsets: tg draws a grabbed body + /// pulled in at once, and the puppets ease that in instead + var/list/lying_offsets + +/datum/hv_finisher/chrome/gorilla/take_grip() + if(!gripped && isnull(lying_offsets) && !QDELETED(victim)) + lying_offsets = list(victim.pixel_x + victim.pixel_w, victim.pixel_y + victim.pixel_z) + return ..() + +/// Pixels from where the victim is drawn now back to where they lay before the grab: list(x, y). +/datum/hv_finisher/chrome/gorilla/proc/grab_pull_back() + if(isnull(lying_offsets) || QDELETED(victim)) + return list(0, 0) + return list(lying_offsets[1] - (victim.pixel_x + victim.pixel_w), lying_offsets[2] - (victim.pixel_y + victim.pixel_z)) + +/datum/hv_finisher/chrome/gorilla/can_start() + if(!..()) + return FALSE + if(!ishuman(user) || !pair_synced() || !TIMER_COOLDOWN_FINISHED(user, COOLDOWN_GORILLA_PISTONS)) + return FALSE + var/mob/living/carbon/human/bearer = user + for(var/obj/item/held in bearer.held_items) + return FALSE + var/list/arms = gorilla_synced_pair(bearer) + if(length(arms) < 2) + return FALSE + for(var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm as anything in arms) + if(!arm.gorilla_running()) + return FALSE + // Square on only: from a corner the punch is just a punch + if(!finisher_square_on(user, victim)) + return FALSE + return can_start_on(victim) + +/// Whether the bearer's arms are synced for this finisher: a Gorilla pair, or a Brawler pair where it allows one. +/datum/hv_finisher/chrome/gorilla/proc/pair_synced() + return gorilla_synced(user) || (brawler_ok && brawler_synced(user)) + +/// What this finisher needs of the victim besides being down. +/datum/hv_finisher/chrome/gorilla/proc/can_start_on(mob/living/carbon/target) + return TRUE + +/datum/hv_finisher/chrome/gorilla/safety_check() + . = ..() + if(!. && !completed && !pair_synced()) + return HV_FINISHER_ATTACKER_DOWN + if(!. && !completed && finisher_on_corner(user, victim)) + return HV_FINISHER_LOST_GRIP + +/datum/hv_finisher/chrome/gorilla/stop(reason) + if(!running) + return + var/finished = completed + // The parent deletes the finisher, which clears these + var/mob/living/bearer = user + var/mob/living/body = victim + . = ..() + cleanup_rigs() + if(!QDELETED(bearer)) + gorilla_spend_pistons(bearer, finished ? GORILLA_PISTONS_COOLDOWN : GORILLA_PISTONS_INTERRUPTED) + if(finished && !QDELETED(body)) + hv_execution_witnesses(bearer, body) + +/datum/hv_finisher/chrome/gorilla/Destroy() + cleanup_rigs() + return ..() + +/// Takes every puppet down and shows both bodies. +/datum/hv_finisher/chrome/gorilla/proc/cleanup_rigs() + QDEL_NULL(bearer_rig) + QDEL_NULL(victim_rig) + +/// The bearer's rig, made on first use: the body without arms and both arms on their own puppets. +/datum/hv_finisher/chrome/gorilla/proc/rig_bearer() + if(bearer_rig || QDELETED(user)) + return bearer_rig + user.face_atom(victim) + facing = user.dir + bearer_rig = new(user, facing) + if(!bearer_rig.rig_arms()) + QDEL_NULL(bearer_rig) + return bearer_rig + +/// Whether the bearer is seen from the side (facing east or west). +/datum/hv_finisher/chrome/gorilla/proc/side_view() + return facing == EAST || facing == WEST + +// The one gate on who may use the Gorilla's heavy moves (gorilla_punch.dm). +/datum/hv_finisher/chrome/gorilla/user_may_finish() + return gorilla_may_use_heavy_moves(user) + +/// Pixels from the victim's tile to the bearer's. +/datum/hv_finisher/chrome/gorilla/proc/to_bearer() + return list((user.x - victim.x) * ICON_SIZE_X, (user.y - victim.y) * ICON_SIZE_Y) + +/// Both of the bearer's arms to [angle], with [reach] pixels of piston. +/datum/hv_finisher/chrome/gorilla/proc/arms_to(angle, time, reach = 0) + bearer_rig?.swing_arm("l", angle, time, reach) + bearer_rig?.swing_arm("r", angle, time, reach) + +/// The bearer's punching hand, the attacking item for #509's hooks. +/datum/hv_finisher/chrome/gorilla/proc/fist() + var/mob/living/carbon/bearer = user + return bearer.get_active_hand() || bearer.get_bodypart(BODY_ZONE_R_ARM) + +/// The bearer's arm on [which] ("near" or "far" to the viewer in a side view) to [angle], with [reach]. +/datum/hv_finisher/chrome/gorilla/proc/arm_to(which, angle, time, reach = 0) + if(!bearer_rig) + return + var/near = bearer_rig.near_side() + var/side = which == "near" ? near : (near == "l" ? "r" : "l") + bearer_rig.swing_arm(side, angle, time, reach) + +/// The bearer's arm puppet on [which] ("near" or "far"), or null. +/datum/hv_finisher/chrome/gorilla/proc/arm_puppet(which) + if(!bearer_rig) + return null + var/near = bearer_rig.near_side() + return bearer_rig.puppet("arm_[which == "near" ? near : (near == "l" ? "r" : "l")]") + +/// The beat a stage begins with: poses and sounds. Lines come from enter_line(). +/datum/hv_finisher/chrome/gorilla/proc/pose(key) + return + +/// A stage's beat: damage, gore, poses. +/datum/hv_finisher/chrome/gorilla/proc/beat(key) + return + +/// The line the room sees as a stage begins, or null. +/datum/hv_finisher/chrome/gorilla/proc/enter_line(key) + return null + +/// The line the victim sees as a stage begins, or null for the room's. +/datum/hv_finisher/chrome/gorilla/proc/enter_self_line(key) + return null + +/// The flash, sparks, ring and shake of a killing blow on [where], the sparks [spark_w], [spark_z] pixels from its middle. Only the victim flashes; the arms keep their look. +/datum/hv_finisher/chrome/gorilla/proc/hit_stop(atom/movable/where, heavy = TRUE, spark_z = 0, spark_w = 0) + victim_rig?.flash() + var/obj/effect/abstract/cyberware_anim/sparks = gorilla_play_impact(user, where, "impact_gorilla") + if(sparks) + sparks.pixel_z += spark_z + sparks.pixel_w += spark_w + var/turf/spot = get_turf(where) + if(spot) + // On the floor: on the game plane the ring was drawn over bodies standing further up the screen + new /obj/effect/temp_visual/circle_wave/cyberware_slam/floor(spot, heavy ? 1 : 0.6) + for(var/mob/living/viewer in range(4, spot)) + if(viewer.client) + shake_camera(viewer, heavy ? 3 : 2, heavy ? 2 : 1) + +// ---- The stages: each one hands its key to the finisher ---- + +/datum/hv_finisher_stage/hold/gorilla + lunge = 0 + effect_severity = 0 + /// What the finisher does in this stage + var/key + +/datum/hv_finisher_stage/hold/gorilla/enter() + . = ..() + var/datum/hv_finisher/chrome/gorilla/finisher = host + finisher.pose(key) + +/datum/hv_finisher_stage/hold/gorilla/effect() + var/datum/hv_finisher/chrome/gorilla/finisher = host + finisher.beat(key) + +/datum/hv_finisher_stage/hold/gorilla/enter_message() + var/datum/hv_finisher/chrome/gorilla/finisher = host + return finisher.enter_line(key) + +/datum/hv_finisher_stage/hold/gorilla/enter_self_message() + var/datum/hv_finisher/chrome/gorilla/finisher = host + return finisher.enter_self_line(key) + +/datum/hv_finisher_stage/kill/gorilla + lunge = 0 + effect_delay = 0 + duration = 1 SECONDS + var/key + +/datum/hv_finisher_stage/kill/gorilla/enter() + . = ..() + var/datum/hv_finisher/chrome/gorilla/finisher = host + finisher.pose(key) + +/datum/hv_finisher_stage/kill/gorilla/effect() + var/datum/hv_finisher/chrome/gorilla/finisher = host + finisher.beat(key) + +/datum/hv_finisher_stage/kill/gorilla/enter_message() + var/datum/hv_finisher/chrome/gorilla/finisher = host + return finisher.enter_line(key) + +/datum/hv_finisher_stage/recover/gorilla + duration = 0.8 SECONDS + var/key + +/datum/hv_finisher_stage/recover/gorilla/enter() + . = ..() + var/datum/hv_finisher/chrome/gorilla/finisher = host + finisher.pose(key) + +/datum/hv_finisher_stage/recover/gorilla/effect() + var/datum/hv_finisher/chrome/gorilla/finisher = host + finisher.beat(key) + +/datum/hv_finisher_stage/recover/gorilla/enter_message() + var/datum/hv_finisher/chrome/gorilla/finisher = host + return finisher.enter_line(key) + +/** + * Keeps #509's heavy-hit spray and its lost-limb spray off [victim] for the blow being dealt now. A + * finisher lays its own blood; #509's full fan from a held body reads as blood out of nowhere. + */ +/proc/gorilla_hold_spray(mob/living/victim) + victim.hv_blood_spray_until = max(victim.hv_blood_spray_until, world.time + 1) + victim.hv_blood_spray_strength = INFINITY + +/// One short line of [victim]'s blood toward [direction], [tiles] long, and nothing more from #509 for this blow. +/proc/gorilla_short_spray(mob/living/victim, direction, tiles = 2) + victim.hv_blood_throw(direction, tiles) + gorilla_hold_spray(victim) + +// ========================================================================= +// (A) THE HEAD CLAP +// ========================================================================= + +/datum/hv_finisher/chrome/gorilla/clap + name = "gorilla head clap" + zone_preference = list(BODY_ZONE_HEAD) + stages = list( + /datum/hv_finisher_stage/hold/gorilla/clap_hoist, + /datum/hv_finisher_stage/hold/gorilla/clap_squeeze, + /datum/hv_finisher_stage/hold/gorilla/clap_toss, + /datum/hv_finisher_stage/kill/gorilla/clap, + /datum/hv_finisher_stage/recover/gorilla/clap, + ) + /// The held body's offsets at rest in the hold, list(pixel_x, pixel_y, pixel_z): the fists move it about from there + var/list/held_at + /// Where the held head is as the fists meet on it, list(x, y) in pixels from the middle of its tile: what comes out of it starts there + var/list/burst_at + +/datum/hv_finisher_stage/hold/gorilla/clap_hoist + key = "hoist" + duration = 0.65 SECONDS + +/datum/hv_finisher_stage/hold/gorilla/clap_squeeze + key = "squeeze" + duration = 1 SECONDS + +/datum/hv_finisher_stage/hold/gorilla/clap_toss + key = "toss" + duration = 0.3 SECONDS + +/datum/hv_finisher_stage/kill/gorilla/clap + key = "clap" + // The fists meet, a beat of hit-stop, then the head goes + effect_delay = 0.15 SECONDS + +/datum/hv_finisher_stage/recover/gorilla/clap + key = "recover" + +// With nothing to hold the brain down it would drift off for good. +/datum/hv_finisher/chrome/gorilla/clap/can_start_on(mob/living/carbon/target) + var/turf/spot = get_turf(target) + return !isnull(target.get_bodypart(BODY_ZONE_HEAD)) && spot?.has_gravity() + +/datum/hv_finisher/chrome/gorilla/clap/pick_zone() + target_zone = BODY_ZONE_HEAD + return target_zone + +/datum/hv_finisher/chrome/gorilla/clap/enter_line(key) + switch(key) + if("hoist") + return "[user] hauls [victim] off the floor by the collar!" + if("squeeze") + return "[victim] chokes and kicks in [user]'s grip." + +/datum/hv_finisher/chrome/gorilla/clap/enter_self_line(key) + switch(key) + if("hoist") + return "[user] hauls you off the floor by the collar!" + if("squeeze") + return "You choke and kick in [user]'s grip." + +/// The middle of a human head above the neck line, half its width, and half a fist's width, in pixels (tg's human base sprite). +#define CLAP_HEAD_RISE 3.5 +#define CLAP_HEAD_HALF_WIDTH 4.5 +#define CLAP_FIST_HALF_WIDTH 1.5 +/// A chrome fist on an arm pointing up is drawn a couple of pixels short of its hand's middle: aim it that much higher. +#define CLAP_FIST_RAISE 2 + +/// The puppets of the body held in the clap that move it about. The head rides on the body (see the hoist), so it is not one. +/datum/hv_finisher/chrome/gorilla/clap/proc/held_parts() + . = list() + for(var/key_name in victim_rig?.puppets) + if(key_name != "head") + . += victim_rig.puppets[key_name] + +/** + * Where the bearer's fists go on the held head: side ("l" or "r") -> list(x, y), pixels from the middle of his + * puppets, as pose_reaching() takes them. Seen from the side both go on the temple, the near one over the head and the + * far one behind it; from the front or back, one on each side of it. [apart] pixels back off it (negative: pressed + * in), the head squashed to [width] and [height] about its neck, the held body moved [shift_x], [shift_y] pixels from + * where it rests in the hold. Null without both rigs. + */ +/datum/hv_finisher/chrome/gorilla/clap/proc/fists_on_head(apart = 0, width = 1, height = 1, shift_x = 0, shift_y = 0) + var/obj/effect/abstract/chrome_puppet/body_puppet = victim_rig?.puppet("body") + if(!bearer_rig || !body_puppet || !isturf(body_puppet.loc) || !held_at) + return null + // The held body's middle as drawn, from the middle of the bearer's puppets + var/held_x = (body_puppet.x - user.x) * ICON_SIZE_X + held_at[1] + shift_x - (user.pixel_x + user.pixel_w) + var/held_y = (body_puppet.y - user.y) * ICON_SIZE_Y + held_at[2] + held_at[3] + shift_y - (user.pixel_y + user.pixel_z) + // The picture faces the bearer, which puts the head's middle half a pixel off the picture's + var/head_x = held_x + (facing == WEST ? 0.5 : -0.5) * width + var/head_y = held_y + CHROME_RIG_NECK_PIVOT_Y + CLAP_HEAD_RISE * height + . = list() + if(side_view()) + var/back = facing == EAST ? -1 : 1 + for(var/side in list("l", "r")) + .[side] = list(head_x + back * apart, head_y - 1) + return + var/out_by = CLAP_HEAD_HALF_WIDTH * width + CLAP_FIST_HALF_WIDTH + apart + for(var/side in list("l", "r")) + var/list/pivot = bearer_rig.shoulder(side) + .[side] = list(head_x + (pivot[1] < 0 ? -out_by : out_by), head_y + CLAP_FIST_RAISE) + +/// Both fists to [fists] (fists_on_head()) over [time], in short steps. +/datum/hv_finisher/chrome/gorilla/clap/proc/fists_to(list/fists, time) + for(var/side in fists) + bearer_rig.reach_through(side, list(fists[side]), list(time), GORILLA_CLAP_MAX_REACH) + +/// The most either arm must stretch to put its fist on [fists] (fists_on_head()), as a share of its length. +/datum/hv_finisher/chrome/gorilla/clap/proc/fists_stretch(list/fists) + . = 0 + for(var/side in fists) + var/list/point = fists[side] + var/list/pose = bearer_rig.pose_reaching(side, point[1], point[2]) + . = max(., pose[2]) + +/** + * [shift_x], [shift_y] (pixels the fists would move the held head from where it rests in the hold), cut back as far as it + * takes for both fists to stay on the head there ([apart], [width] and [height] as fists_on_head() takes them): never further + * than his arms reach, or than they already stretch to hold it still. list(x, y), whole pixels. + */ +/datum/hv_finisher/chrome/gorilla/clap/proc/within_reach(shift_x, shift_y, apart = 0, width = 1, height = 1) + var/list/still = fists_on_head(apart, width, height) + if(!still) + return list(0, 0) + var/most = max(GORILLA_CLAP_MAX_REACH, fists_stretch(still)) + for(var/scale in list(1, 0.75, 0.5, 0.25)) + var/list/shift = list(round(shift_x * scale, 1), round(shift_y * scale, 1)) + if(fists_stretch(fists_on_head(apart, width, height, shift[1], shift[2])) <= most) + return shift + return list(0, 0) + +/** + * The held body hangs from its head: to each of [shifts] (list(x, y) pixels from where it rests in the hold) in turn, + * step_times[i] to the i-th, swinging about its neck behind the head as it is shaken aside. Returns the swing at each step, + * which the head takes back off its own turn so only its strain shows. + */ +/datum/hv_finisher/chrome/gorilla/clap/proc/move_held(list/shifts, list/step_times, easing = SINE_EASING) + . = list() + var/obj/effect/abstract/chrome_puppet/body_puppet = victim_rig?.puppet("body") + for(var/i in 1 to length(shifts)) + var/list/shift = shifts[i] + var/sway = clamp(shift[1] * GORILLA_CLAP_SWAY, -GORILLA_CLAP_MAX_SWAY, GORILLA_CLAP_MAX_SWAY) + . += sway + if(!body_puppet || !held_at) + continue + var/matrix/hung = chrome_rig_turn(sway, 0, CHROME_RIG_NECK_PIVOT_Y) + if(i == 1) + animate(body_puppet, transform = hung, pixel_x = held_at[1] + shift[1], pixel_y = held_at[2], pixel_z = held_at[3] + shift[2], time = step_times[i], easing = easing) + else + animate(transform = hung, pixel_x = held_at[1] + shift[1], pixel_y = held_at[2], pixel_z = held_at[3] + shift[2], time = step_times[i], easing = easing) + +/datum/hv_finisher/chrome/gorilla/clap/pose(key) + switch(key) + if("hoist") + rig_bearer() + victim_rig = new(victim, REVERSE_DIR(facing || user.dir)) + if(victim_rig.snapshot()) + // The head on its own puppet, so it can strain and crush while the body hangs + victim_rig.add_puppet("body", victim_rig.cut_at_neck(FALSE), TRUE) + var/obj/effect/abstract/chrome_puppet/head = victim_rig.add_puppet("head", victim_rig.cut_at_neck(TRUE)) + // The head rides on the body, drawn wherever the body is and turned with it, so it can never come + // off the neck: only its own squash and strain are its own + head.pixel_x = 0 + head.pixel_y = 0 + head.pixel_w = 0 + head.pixel_z = 0 + head.moveToNullspace() + var/obj/effect/abstract/chrome_puppet/body_puppet = victim_rig.puppet("body") + body_puppet.vis_contents += head + // Its puppets start where it lay before the grab (below): so does what stands in for them + var/list/lay_at = grab_pull_back() + victim_rig.conceal(lay_at[1], lay_at[2]) + var/list/toward = to_bearer() + // Held up in close, and kept there until the burst: seen from the side chest to chest, from the front + // up to his face, from the back just past his head, so its head is where his fists can close on it + var/share = side_view() ? GORILLA_CLAP_HOLD_SIDE : (facing == NORTH ? GORILLA_CLAP_HOLD_BACK : GORILLA_CLAP_HOLD_FRONT) + var/lift = side_view() ? GORILLA_CLAP_LIFT_SIDE : (facing == NORTH ? GORILLA_CLAP_LIFT_BACK : GORILLA_CLAP_LIFT_FRONT) + held_at = list(round(toward[1] * share), round(toward[2] * share), lift) + // It comes up from where it lay, not from where tg's grab draws it pulled in + var/list/pull_back = grab_pull_back() + for(var/obj/effect/abstract/chrome_puppet/held as anything in held_parts()) + held.pixel_x += pull_back[1] + held.pixel_y += pull_back[2] + // The held body is in front of the bearer, unless he faces away from the viewer + held.layer = facing == NORTH ? user.layer - 0.02 : user.layer + 0.02 + animate(held, transform = matrix(), pixel_x = held_at[1], pixel_y = held_at[2], pixel_w = 0, pixel_z = held_at[3], time = 0.4 SECONDS, easing = SINE_EASING | EASE_OUT) + // The head's bottom row overlaps the body's top one: the head draws over it + head.layer = body_puppet.layer + 0.001 + else + QDEL_NULL(victim_rig) + if(side_view()) + // The near fist holds the shirt front, over the held body; the far one is behind the bearer. + var/obj/effect/abstract/chrome_puppet/near_arm = arm_puppet("near") + if(near_arm) + near_arm.layer = user.layer + 0.03 + arm_to("near", 125, 0.4 SECONDS, 2) + arm_to("far", 60, 0.4 SECONDS) + else + // Seen from the front or back: both hands on the shoulders of the body held in front. The arms + // are over the bearer's body and under the held one (which is behind him when he faces away). + for(var/side in list("l", "r")) + var/obj/effect/abstract/chrome_puppet/arm = bearer_rig?.puppet("arm_[side]") + if(arm) + arm.layer = user.layer + 0.01 + arms_to(-25, 0.4 SECONDS) + if("squeeze") + // The fists close on the head and press, then wrench it side to side and lift it as they squeeze. The body + // hangs from the head and goes with them, swinging behind it; the head strains and gives between the fists in + // steps, about the neck so it stays on the shoulders, and the fists follow it in. + var/obj/effect/abstract/chrome_puppet/head = victim_rig?.puppet("head") + var/list/jerks = list(-5, 4, -4, 5, -3, 0) + // Shares of GORILLA_CLAP_SHAKE (aside) and GORILLA_CLAP_HEAVE (up), never lowered + var/list/shakes = list(0, 1, -1, 1, -0.5, 0) + var/list/heaves = list(0, 0.5, 0.5, 1, 1, 1) + var/list/step_times = list() + var/list/squashes = list() + var/list/shifts = list() + var/list/fist_points = list("l" = list(), "r" = list()) + for(var/i in 1 to length(jerks)) + var/give = 1 - 0.05 * i + var/width = side_view() ? 1 + (1 - give) * 0.5 : give + var/height = side_view() ? give : 1 + (1 - give) * 0.3 + step_times += i == 1 ? 0.2 SECONDS : 0.15 SECONDS + squashes += list(list(width, height)) + var/list/shift = within_reach(shakes[i] * GORILLA_CLAP_SHAKE, heaves[i] * GORILLA_CLAP_HEAVE, 0, width, height) + shifts += list(shift) + var/list/fists = fists_on_head(0, width, height, shift[1], shift[2]) + for(var/side in fists) + fist_points[side] += list(fists[side]) + // Each puppet's steps in one run, as animate() chains onto the last thing it was given + var/list/sways = move_held(shifts, step_times) + if(head) + for(var/i in 1 to length(jerks)) + var/list/squash = squashes[i] + // Its own strain and squash about the neck, on top of the body's swing + var/matrix/pressed = chrome_rig_turn(jerks[i] - sways[i], 0, CHROME_RIG_NECK_PIVOT_Y, 0, 0, squash[1], squash[2]) + if(i == 1) + animate(head, transform = pressed, time = step_times[i], easing = SINE_EASING) + else + animate(transform = pressed, time = step_times[i], easing = SINE_EASING) + for(var/side in fist_points) + if(length(fist_points[side])) + bearer_rig.reach_through(side, fist_points[side], step_times, GORILLA_CLAP_MAX_REACH) + // After the swings: the tremble runs alongside them, his fists and the body he holds shaking together + bearer_rig?.tremble(1 SECONDS) + victim_rig?.tremble(1 SECONDS, list("head")) + playsound(victim, 'sound/mobs/humanoids/human/gasp/gasp_male1.ogg', 30, TRUE) + if("toss") + // The fists heave the head up and come off it a little, for the clap; the body goes up with it + var/width = side_view() ? 1.15 : 0.7 + var/height = side_view() ? 0.7 : 1.09 + var/list/shift = within_reach(0, GORILLA_CLAP_HEAVE + GORILLA_CLAP_TOSS_LIFT, GORILLA_CLAP_WIND, width, height) + fists_to(fists_on_head(GORILLA_CLAP_WIND, width, height, shift[1], shift[2]), 0.15 SECONDS) + move_held(list(shift), list(0.15 SECONDS), SINE_EASING | EASE_OUT) + if("clap") + // It bursts and falls where it is held, on the bearer's tile. First, as it moves every puppet to his tile. + bring_in() + // ...and the fists slam back in and down, pressed into the head as it gives between them, still on the neck, + // and drive it down with them + var/width = side_view() ? 1.2 : 0.55 + var/height = side_view() ? 0.6 : 1.15 + var/list/shift = within_reach(0, GORILLA_CLAP_HEAVE + GORILLA_CLAP_TOSS_LIFT - GORILLA_CLAP_SLAM, -1, width, height) + fists_to(fists_on_head(-1, width, height, shift[1], shift[2]), 0.08 SECONDS) + move_held(list(shift), list(0.08 SECONDS), SINE_EASING | EASE_IN) + if(held_at) + burst_at = list(held_at[1] + shift[1], held_at[2] + held_at[3] + shift[2] + CHROME_RIG_NECK_PIVOT_Y + CLAP_HEAD_RISE * height) + var/obj/effect/abstract/chrome_puppet/head = victim_rig?.puppet("head") + if(head) + animate(head, transform = chrome_rig_turn(0, 0, CHROME_RIG_NECK_PIVOT_Y, 0, 0, width, height), time = 0.08 SECONDS, easing = SINE_EASING | EASE_IN) + // The sparks go where the fists meet, on the head + hit_stop(victim_rig?.puppet("body") || victim, TRUE, 9) + if("recover") + arms_to(0, 0.5 SECONDS) + +/datum/hv_finisher/chrome/gorilla/clap/beat(key) + if(key != "clap" || QDELETED(victim)) + return + playsound(victim, 'sound/effects/wounds/crack2.ogg', 80, TRUE) + // Blood and pieces go on out ahead of him + var/outcome = gorilla_head_clap(victim, user, fist(), facing, burst_at) + drop_held_body(outcome == "burst") + +/** + * Brings the held body onto the bearer's tile, drawn where it is held, so it bursts there and falls at his feet + * (a body on the floor shares his tile). + */ +/datum/hv_finisher/chrome/gorilla/clap/proc/bring_in() + var/turf/here = get_turf(user) + var/turf/from = get_turf(victim) + if(!isturf(here) || !isturf(from) || here == from) + return + // Off the grab first: tg turns a pulled body to face whoever pulls it, and on one tile there is no way to face + release_grip() + if(!victim.Move(here, get_dir(from, here))) + victim.forceMove(here) + if(get_turf(victim) != here) + return + for(var/obj/effect/abstract/chrome_puppet/part as anything in held_parts()) + part.forceMove(here) + part.pixel_x -= (here.x - from.x) * ICON_SIZE_X + part.pixel_y -= (here.y - from.y) * ICON_SIZE_Y + if(held_at) + held_at[1] -= (here.x - from.x) * ICON_SIZE_X + held_at[2] -= (here.y - from.y) * ICON_SIZE_Y + +/// The held body falls from where it is held, headless after a burst, to lie as the real one does; that one shows when it lands. +/datum/hv_finisher/chrome/gorilla/clap/proc/drop_held_body(burst) + var/obj/effect/abstract/chrome_puppet/body_puppet = victim_rig?.puppet("body") + if(!body_puppet || QDELETED(victim) || get_turf(body_puppet) != get_turf(victim)) + land() + return + if(burst) + var/obj/effect/abstract/chrome_puppet/head = victim_rig.puppet("head") + if(head) + body_puppet.vis_contents -= head + victim_rig.drop_puppet("head") + // The real body's turn and offsets are already its own, though it may still be drawn on its way to them + animate(body_puppet, transform = victim.transform, pixel_x = victim.pixel_x, pixel_y = victim.pixel_y, pixel_w = victim.pixel_w, pixel_z = victim.pixel_z, time = GORILLA_CLAP_DROP_TIME, easing = SINE_EASING | EASE_IN) + addtimer(CALLBACK(src, PROC_REF(land)), GORILLA_CLAP_DROP_TIME, TIMER_DELETE_ME) + +/// The held body is down: the real one shows in its place. +/datum/hv_finisher/chrome/gorilla/clap/proc/land() + QDEL_NULL(victim_rig) + if(!QDELETED(victim) && victim.stat == DEAD) + victim.hv_death_throes() + +#undef CLAP_HEAD_RISE +#undef CLAP_HEAD_HALF_WIDTH +#undef CLAP_FIST_HALF_WIDTH +#undef CLAP_FIST_RAISE + +/** + * Both fists meet on [victim]'s head. Bursts it (#509), or on a helmet or plating crumples the helmet and + * caves the skull in, or on the Atlas frame does heavy damage and nothing breaks. [head_at] is where a held + * head is drawn (list(x, y), pixels from the middle of its tile), for gorilla_clap_burst(). Returns what + * happened: "burst", "helmet", "frame" or "crit". + */ +/proc/gorilla_head_clap(mob/living/carbon/victim, mob/living/user, obj/item/fist, direction, list/head_at) + var/obj/item/bodypart/head/head = victim.get_bodypart(BODY_ZONE_HEAD) + if(isnull(head)) + return null + victim.hv_hold_attack_message("[user] claps both fists together on [victim]'s head!", "[user] claps both fists together on your head!", "You clap both fists together on [victim]'s head!", user, vision_range = DEFAULT_MESSAGE_RANGE) + . = "burst" + if(HAS_TRAIT(victim, TRAIT_NODISMEMBER) && HAS_TRAIT(victim, TRAIT_CYBERWARE_UNBREAKABLE_BONES)) + // The Atlas frame: nothing bursts and nothing breaks + victim.apply_damage(35, BRUTE, head, victim.run_armor_check(head, MELEE), wound_bonus = CANT_WOUND) + victim.adjustOrganLoss(ORGAN_SLOT_BRAIN, 20) + victim.hv_add_hit_line("[victim]'s frame holds!", HV_LINE_BOLD, "Your frame holds!") + . = "frame" + else if(HAS_TRAIT(victim, TRAIT_HEAD_INJURY_BLOCKED) || hv_crit_cover_rating(victim, head, MELEE) >= GORILLA_CLAP_HELMET_ARMOUR) + // A helmet or plating: no burst. It crumples and the skull caves in under it. + // No attack direction: a sealed helmet throws no blood + victim.apply_damage(35, BRUTE, head, wound_bonus = CANT_WOUND) + var/obj/item/clothing/helmet + if(ishuman(victim)) + var/mob/living/carbon/human/human_victim = victim + helmet = human_victim.head + if(istype(helmet)) + helmet.take_damage(40, BRUTE, MELEE, FALSE) + if(!QDELETED(helmet)) + gorilla_helmet_dent(victim) + victim.hv_add_hit_line("[victim]'s helmet crumples!", HV_LINE_BOLD, "Your helmet crumples!", DEFAULT_MESSAGE_RANGE) + if(hv_crit_apply_wound(head, /datum/wound/blunt/bone/critical/hv_skull, direction, fist)) + victim.hv_add_hit_line("[victim]'s skull caves in!", HV_LINE_HUGE, "Your skull caves in!", DEFAULT_MESSAGE_RANGE) + . = "helmet" + else + // No attack direction: the burst lays its own blood (gorilla_clap_burst()) + victim.apply_damage(30, BRUTE, head, victim.run_armor_check(head, MELEE), wound_bonus = CANT_WOUND) + if(QDELETED(victim) || isnull(victim.get_bodypart(BODY_ZONE_HEAD))) + . = "burst" + else if(!gorilla_clap_burst(victim, direction, head_at)) + // A head that can't come off: the skull caves in instead + if(hv_crit_apply_wound(head, /datum/wound/blunt/bone/critical/hv_skull, direction, fist)) + victim.hv_add_hit_line("[victim]'s skull caves in!", HV_LINE_HUGE, "Your skull caves in!", DEFAULT_MESSAGE_RANGE) + . = "crit" + if(!QDELETED(victim)) + victim.hv_flush_hit() + playsound(victim, 'sound/effects/wounds/splatter.ogg', 60, TRUE) + log_combat(user, victim, "head-clapped", "gorilla arms", "([.])") + +/** + * #509's head burst (hv_burst_head_apart()) sized for two fists at arm's length: the gibs and splatter + * stay round the head, one short line of blood goes out along [burst_dir], the eyes, ears and tongue + * drop on the spot or a tile out and the brain lands a tile or two away, whole, for revival. They leave + * from [head_at] (list(x, y), pixels from the middle of the tile), where the head is held, or from where + * the body's own head is drawn if that isn't given. Returns TRUE if the head burst. + */ +/proc/gorilla_clap_burst(mob/living/carbon/victim, burst_dir, list/head_at) + if(HAS_TRAIT(victim, TRAIT_GODMODE)) + return FALSE + var/obj/item/bodypart/head/head = victim.get_bodypart(BODY_ZONE_HEAD) + if(!head || !head.can_dismember()) + return FALSE + if(!burst_dir) + burst_dir = pick(GLOB.alldirs) + var/turf/here = get_turf(victim) + var/organic = IS_ORGANIC_LIMB(head) + var/bleeds = head.can_bleed() + var/list/blood_dna = bleeds ? victim.get_blood_dna_list() : null + var/blood_color = bleeds ? victim.get_bloodtype()?.get_color() : null + // Read before the head comes off + if(!head_at) + head_at = victim.hv_vis_part_offset(BODY_ZONE_HEAD) + var/list/obj/item/organ/loose = list() + for(var/obj/item/organ/organ in head) + if(!(organ.organ_flags & ORGAN_UNREMOVABLE)) + loose += organ + // One short line; the lost-limb spray the dismember would add is held off + gorilla_short_spray(victim, burst_dir, GORILLA_CLAP_SPRAY_TILES) + // Not dismember(): it throws the head a tile or two, and a head is heavy enough to knock whoever it hits + // a tile back. Thrown into the bearer it shoved him off the body and ended the finisher at the burst. + head = gorilla_tear_limb(victim, head, burst_dir, FALSE) + if(isnull(head)) + return FALSE + // A burst head comes apart where it was + if(isturf(here) && head.loc != here) + head.forceMove(here) + // No violent removal: the brain has to stay good for revival + head.drop_organs() + qdel(head) + if(isturf(here)) + if(!organic) + new /obj/effect/gibspawner/robot(here, victim) + else if(bleeds) + gorilla_clap_gibs(here, burst_dir, blood_dna) + hv_head_burst_splatter(here, burst_dir, blood_color) + playsound(here, 'sound/effects/wounds/splatter.ogg', 80, TRUE) + for(var/obj/item/organ/organ as anything in loose) + if(QDELETED(organ) || !isturf(organ.loc)) + continue + // Flown, not thrown (hv_fling()): nobody is hit by it, the bearer least of all. It starts at the head. + if(istype(organ, /obj/item/organ/brain)) + var/datum/callback/landed = blood_dna ? CALLBACK(organ, TYPE_PROC_REF(/obj/item/organ, hv_landed), blood_dna) : null + organ.hv_vis_fling_from = head_at + hv_fling_organ(organ, burst_dir, GORILLA_CLAP_BRAIN_MIN, GORILLA_CLAP_BRAIN_MAX, landed) + else if(prob(50)) + organ.hv_vis_fling_from = head_at + hv_fling_organ(organ, turn(burst_dir, pick(-45, 0, 45)), 1, 1) + organ.hv_vis_forget_fling() + victim.hv_add_hit_line(pick("[victim]'s head bursts apart!", "[victim]'s skull bursts open!"), HV_LINE_HUGE, range = DEFAULT_MESSAGE_RANGE) + return TRUE + +/** + * The clap's gibs: piled round the head, one a tile out along [burst_dir]. #509's burst gibs streak up to + * three tiles across a cone, which from two fists at arm's length reads as a blast. + */ +/proc/gorilla_clap_gibs(turf/where, burst_dir, list/blood_dna) + for(var/i in 1 to 3) + var/obj/effect/decal/cleanable/blood/gibs/gib = new(where, null, blood_dna) + if(!QDELETED(gib)) + gib.pixel_x = rand(-8, 8) + gib.pixel_y = rand(-8, 8) + var/turf/ahead = get_step(where, burst_dir) + if(ahead && !isgroundlessturf(ahead) && !hv_blood_spray_blocked(ahead)) + new /obj/effect/decal/cleanable/blood/gibs(ahead, null, blood_dna) + new /obj/effect/decal/cleanable/blood/gibs/core(where, null, blood_dna) + +/// A crumpled dent drawn over the helmet for a while. +/proc/gorilla_helmet_dent(mob/living/carbon/victim) + var/mutable_appearance/dent = mutable_appearance(GORILLA_GORE_ICON, "helmet_dent", -(HEAD_LAYER - 0.1)) + victim.add_overlay(dent) + addtimer(CALLBACK(victim, TYPE_PROC_REF(/atom, cut_overlay), dent), 10 SECONDS) + +// ========================================================================= +// (B) THE LIMB RIP +// ========================================================================= + +/datum/hv_finisher/chrome/gorilla/rip + name = "gorilla limb rip" + brawler_ok = TRUE + stages = list( + /datum/hv_finisher_stage/hold/gorilla/rip_plant, + /datum/hv_finisher_stage/hold/gorilla/rip_strain, + /datum/hv_finisher_stage/kill/gorilla/rip, + /datum/hv_finisher_stage/recover/gorilla/rip_club, + /datum/hv_finisher_stage/recover/gorilla/rip, + ) + /// The torn-off arm, held until it is dropped on the victim's tile + var/obj/item/bodypart/held_limb + /// "l" or "r": the side of the victim's body the arm is on + var/side + /// The bearer's arm whose fist takes the wrist first ("l" or "r"); the other fist joins it + var/grip_side + /// Pixels the bearer's puppets lean onto the body now: further in as he takes the arm, back to lean_out as he hauls + var/list/lean = list(0, 0) + /// The lean he hauls back to and holds through the blow + var/list/lean_out = list(0, 0) + /// Pixels the body's puppets are drawn from the real body: where it lay before the grab, until he drags it in by the arm + var/list/body_shift = list(0, 0) + /// Degrees (clockwise) the body is turned up about its feet toward his fists by the haul + var/raised = 0 + /// The hauled arm's length when the fists take it, as a share of its own + var/grip_stretch = 1 + /// Where the fists hold the wrist: pixels from the middle of the bearer's tile + var/list/grip + /// The torn arm's hand and shoulder in its own picture, list(hand_x, hand_y, shoulder_x, shoulder_y): the bearer + /// holds it by the hand and swings the shoulder end + var/list/club_ends + +/datum/hv_finisher_stage/hold/gorilla/rip_plant + key = "plant" + duration = 0.5 SECONDS + enter_sound = 'sound/effects/gravhit.ogg' + enter_volume = 40 + +/datum/hv_finisher_stage/hold/gorilla/rip_strain + key = "strain" + duration = 1.35 SECONDS + +/datum/hv_finisher_stage/kill/gorilla/rip + key = "tear" + duration = 0.8 SECONDS + +/datum/hv_finisher_stage/recover/gorilla/rip_club + key = "club" + duration = 0.45 SECONDS + // Still held through the blow, so the body doesn't slide back off the grab under it. The hit is timed with the + // swing (swing_club()), not this stage's beat, which only fires on the finisher's next tick. + pins = TRUE + +/datum/hv_finisher_stage/recover/gorilla/rip + key = "recover" + +/datum/hv_finisher/chrome/gorilla/rip/Destroy() + drop_held_limb() + return ..() + +/datum/hv_finisher/chrome/gorilla/rip/stop(reason) + if(!running) + return + . = ..() + drop_held_limb() + +/// The aimed arm, else the other one. +/datum/hv_finisher/chrome/gorilla/rip/pick_zone() + var/other = aimed_zone == BODY_ZONE_L_ARM ? BODY_ZONE_R_ARM : BODY_ZONE_L_ARM + target_zone = victim.get_bodypart(aimed_zone) ? aimed_zone : (victim.get_bodypart(other) ? other : null) + side = target_zone == BODY_ZONE_L_ARM ? "l" : "r" + return target_zone + +/datum/hv_finisher/chrome/gorilla/rip/can_start_on(mob/living/carbon/target) + return !isnull(target.get_bodypart(BODY_ZONE_L_ARM)) || !isnull(target.get_bodypart(BODY_ZONE_R_ARM)) + +/datum/hv_finisher/chrome/gorilla/rip/enter_line(key) + switch(key) + if("plant") + return "[user] plants a boot on [victim] and grabs [victim.p_their()] arm!" + if("strain") + return "[user] hauls back on [victim]'s arm!" + +/datum/hv_finisher/chrome/gorilla/rip/enter_self_line(key) + switch(key) + if("plant") + return "[user] plants a boot on you and grabs your arm!" + if("strain") + return "[user] hauls back on your arm!" + +/datum/hv_finisher/chrome/gorilla/rip/pose(key) + var/list/toward = to_bearer() + switch(key) + if("plant") + rig_bearer() + if(bearer_rig && facing == NORTH) + // Seen from behind, everything he does here is on his far side: his arms reach out past his own + // back and head, which hide them where they cross + for(var/arm_side in list("l", "r")) + var/obj/effect/abstract/chrome_puppet/own_arm = bearer_rig.puppet("arm_[arm_side]") + own_arm?.layer = user.layer - 0.01 + lean_out = list(-round(toward[1] / ICON_SIZE_X * GORILLA_RIP_LEAN), -round(toward[2] / ICON_SIZE_Y * GORILLA_RIP_LEAN)) + lean = lean_out.Copy() + victim_rig = new(victim, victim.dir) + if(bearer_rig && victim_rig.snapshot()) + // The arm turns with the lying body, about its own shoulder + victim_rig.base_transform = matrix(victim.transform) + var/obj/effect/abstract/chrome_puppet/laid_body = victim_rig.add_puppet("body", victim_rig.cut_without_arms(side), TRUE) + // Draw order, back to front, the same from the plant to the let-go: + // - Facing the viewer the body lies nearer than he stands: his body, the body on the floor, its + // hauled arm, his arms (they reach toward the viewer), the torn arm. + // - From the side: his far arm, a far hauled arm, the body, his body (a boot on it), a near hauled + // arm, his near arm, the torn arm. + // - Facing away the body is beyond him, and so is all he does to it: the body, its hauled arm, his + // arms, the torn arm in his fists, and over them all his own back and head. + if(laid_body && facing == SOUTH) + laid_body.layer = user.layer + 0.004 + var/obj/effect/abstract/chrome_puppet/hauled = victim_rig.add_puppet("arm_[side]", victim_rig.arm_picture(side), TRUE) + // The far arm seen from the side comes out from behind the body. Any other arm is hauled up in front of the + // bearer, over his body and under his near fist, unless he faces away and it is beyond him. + if(victim_rig.behind_body(side)) + hauled.layer = victim.layer - 0.01 + else + hauled.layer = facing == NORTH ? victim.layer + 0.01 : user.layer + 0.005 + // The body stays where it lay (tg's grab draws it pulled in at once): he steps in to it as far, and drags it + // in by the arm as he hauls + body_shift = grab_pull_back() + lean = list(lean_out[1] + body_shift[1], lean_out[2] + body_shift[2]) + for(var/key_name in victim_rig.puppets) + var/obj/effect/abstract/chrome_puppet/part = victim_rig.puppets[key_name] + part.pixel_x += body_shift[1] + part.pixel_y += body_shift[2] + // What stands in for it until its puppets can be drawn stands where they do + victim_rig.conceal(body_shift[1], body_shift[2]) + take_wrist(0.3 SECONDS, GORILLA_RIP_START_HOLD) + else + QDEL_NULL(victim_rig) + arms_to(side_view() ? 45 : 30, 0.3 SECONDS, 3) + // A boot on the body: the bearer leans over them, arms and all (after the swings, which would cut + // the lean short on the arms). Nothing moves through the hold, while the puppets' pictures reach the + // client: they come on as the bodies stood, and then he steps in. + for(var/key_name in bearer_rig?.puppets) + var/obj/effect/abstract/chrome_puppet/part = bearer_rig.puppets[key_name] + if(victim_rig) + animate(part, pixel_x = part.pixel_x, time = GORILLA_RIP_START_HOLD, flags = ANIMATION_PARALLEL) + animate(pixel_x = part.pixel_x + lean[1], pixel_y = part.pixel_y + lean[2], time = 0.3 SECONDS, easing = SINE_EASING | EASE_OUT) + else + animate(part, pixel_x = part.pixel_x + lean[1], pixel_y = part.pixel_y + lean[2], time = 0.3 SECONDS, easing = SINE_EASING | EASE_OUT, flags = ANIMATION_PARALLEL) + if("strain") + if(victim_rig && grip) + haul(1.3 SECONDS) + else + arms_to(side_view() ? 25 : 15, 1.3 SECONDS, 1) + bearer_rig?.tremble(1.3 SECONDS) + if("tear") + // The arm gives: he yanks it back and comes upright + bearer_rig?.bend_and_swing(0, side_view() ? -20 : 0, 0.1 SECONDS) + if("club") + if(held_limb) + // Up over his head, then down on theirs, the hit landing as it comes down + swing_club(GORILLA_CLUB_RAISE, GORILLA_CLUB_STRIKE) + // A shade before the arm is all the way down: the server's timer runs a tick or two behind the client's swing + addtimer(CALLBACK(src, PROC_REF(club_hit)), GORILLA_CLUB_RAISE + GORILLA_CLUB_STRIKE - GORILLA_CLUB_HIT_LEAD, TIMER_DELETE_ME) + else + arms_to(0, 0.4 SECONDS) + if("recover") + bearer_rig?.drop_puppet("club") + // The arm goes down with the body as he lets it go + drop_held_limb() + // Down the way they point: not back up over his head the way they came + bearer_rig?.unwind_arms() + arms_to(0, 0.5 SECONDS) + // Let go, the body slides back to where tg lays it; its stand-ins go with it, and the real one shows there + if(victim_rig && !QDELETED(victim)) + for(var/key_name in victim_rig.puppets) + var/obj/effect/abstract/chrome_puppet/part = victim_rig.puppets[key_name] + animate(part, pixel_x = victim.pixel_x, pixel_y = victim.pixel_y, pixel_w = victim.pixel_w, pixel_z = victim.pixel_z, time = GORILLA_RIP_LET_GO, easing = EASE_IN | EASE_OUT, flags = ANIMATION_PARALLEL) + addtimer(CALLBACK(src, PROC_REF(fallen)), GORILLA_RIP_LET_GO + 0.05 SECONDS, TIMER_DELETE_ME) + // Straightens up off the body, so the real one shows where he stands (after the swing, as the lean was) + for(var/key_name in bearer_rig?.puppets) + var/obj/effect/abstract/chrome_puppet/part = bearer_rig.puppets[key_name] + animate(part, pixel_x = user.pixel_x, pixel_y = user.pixel_y, time = 0.4 SECONDS, easing = SINE_EASING, flags = ANIMATION_PARALLEL) + +/// The middle of the bearer's puppets as drawn: pixels from the middle of his tile. +/datum/hv_finisher/chrome/gorilla/rip/proc/bearer_origin() + return list(user.pixel_x + user.pixel_w + lean[1], user.pixel_y + user.pixel_z + lean[2]) + +/// The middle of the body's puppets as drawn (body_shift from the real body): pixels from the middle of the bearer's tile. +/datum/hv_finisher/chrome/gorilla/rip/proc/body_origin() + return list((victim.x - user.x) * ICON_SIZE_X + victim.pixel_x + victim.pixel_w + body_shift[1], (victim.y - user.y) * ICON_SIZE_Y + victim.pixel_y + victim.pixel_z + body_shift[2]) + +/** + * The hauled arm's shoulder as drawn, the body turned as the victim rig's base_transform turns it (pixels from the middle + * of the bearer's tile), and the angle the arm comes up at: toward the bearer's shoulders (bent by [bearer_base]), and + * seen from the side turned [tilt] degrees up off the floor. list(x, y, angle). + */ +/datum/hv_finisher/chrome/gorilla/rip/proc/haul_line(tilt, matrix/bearer_base) + var/list/shoulder_at = body_shoulder_at() + var/list/left = bearer_shoulder_at("l", bearer_base) + var/list/right = bearer_shoulder_at("r", bearer_base) + var/angle = arctan((left[1] + right[1]) / 2 - shoulder_at[1], (left[2] + right[2]) / 2 - shoulder_at[2]) + if(side_view()) + // Up toward the top of the screen, never past it + var/to_up = 90 - angle + while(to_up > 180) + to_up -= 360 + while(to_up < -180) + to_up += 360 + angle += clamp(to_up, -tilt, tilt) + return list(shoulder_at[1], shoulder_at[2], angle) + +/// Where the bearer's shoulder on [arm_side] is drawn with his body bent by [bearer_base]: pixels from the middle of his tile. +/datum/hv_finisher/chrome/gorilla/rip/proc/bearer_shoulder_at(arm_side, matrix/bearer_base) + var/list/origin = bearer_origin() + var/list/at = bearer_rig.shoulder_point(arm_side, bearer_base) + return list(origin[1] + at[1], origin[2] + at[2]) + +/// Where the hauled arm's shoulder is drawn, the body turned as the victim rig's base_transform turns it: pixels from the middle of the bearer's tile. +/datum/hv_finisher/chrome/gorilla/rip/proc/body_shoulder_at() + var/list/body_at = body_origin() + var/list/at = victim_rig.shoulder_point(side) + return list(body_at[1] + at[1], body_at[2] + at[2]) + +/// Where the wrist is when the arm is [stretch] times its length: pixels from the middle of the bearer's tile. +/datum/hv_finisher/chrome/gorilla/rip/proc/wrist_at(stretch, tilt, matrix/bearer_base) + var/list/line = haul_line(tilt, bearer_base) + var/length = stretch * victim_rig.arm_reach(side) + return list(line[1] + length * cos(line[3]), line[2] + length * sin(line[3])) + +/** + * The poses that put both of the bearer's fists (his body bent by [bearer_base]) and the hauled hand (the body + * turned as the victim rig's base_transform turns it) on [wrist], each turned the short way from [from] (key -> turn). + * Keys "bearer_l", "bearer_r" and "body"; every pose carries its body's turn. + */ +/datum/hv_finisher/chrome/gorilla/rip/proc/poses_on(list/wrist, list/from, matrix/bearer_base) + . = list() + var/list/origin = bearer_origin() + for(var/arm_side in list("l", "r")) + var/list/pose = bearer_rig.pose_reaching(arm_side, wrist[1] - origin[1], wrist[2] - origin[2], from["bearer_[arm_side]"], bearer_base) + .["bearer_[arm_side]"] = list(pose[1], pose[2], bearer_base) + var/list/body_at = body_origin() + var/list/body_pose = victim_rig.pose_reaching(side, wrist[1] - body_at[1], wrist[2] - body_at[2], from["body"]) + .["body"] = list(body_pose[1], body_pose[2], victim_rig.base_transform) + +/// Sends the bearer's arms and body and the hauled arm through [all_poses] (a list of poses_on() lists), [step_time] a step (or step_time[i] for the i-th, given a list). +/datum/hv_finisher/chrome/gorilla/rip/proc/pose_through(list/all_poses, step_time) + var/list/bends = list() + for(var/key_name in list("bearer_l", "bearer_r", "body")) + var/list/steps = list() + for(var/list/poses as anything in all_poses) + var/list/pose = poses[key_name] + steps += list(pose) + if(key_name == "bearer_l") + bends += list(pose[3]) + if(key_name == "body") + victim_rig.pose_arm_through(side, steps, step_time) + else + bearer_rig.pose_arm_through(key_name == "bearer_l" ? "l" : "r", steps, step_time) + // His body bends with his arms, step for step, so they stay on his shoulders + bearer_rig.body_through(bends, step_time) + +/// The turns each arm is in now, keyed as poses_on() keys them. +/datum/hv_finisher/chrome/gorilla/rip/proc/turns_now() + . = list() + for(var/arm_side in list("l", "r")) + var/list/pose = bearer_rig.arm_poses[arm_side] || list(0, 1) + .["bearer_[arm_side]"] = pose[1] + var/list/pose = victim_rig.arm_poses[side] || list(0, 1) + .["body"] = pose[1] + +/** + * The plant, over [time]: the bearer's piston arms push out, both fists close on the wrist and the arm comes + * up off the floor into them. Every part stays as it is for [hold] first. + */ +/datum/hv_finisher/chrome/gorilla/rip/proc/take_wrist(time, hold = 0) + var/bend = 0 + var/matrix/bent = null + var/list/line = haul_line(GORILLA_RIP_TILT, bent) + // The fist on the near side (seen from the side) or nearer the arm takes it; the other one joins it + var/best_distance + for(var/arm_side in list("l", "r")) + var/list/at = bearer_shoulder_at(arm_side, bent) + var/distance = sqrt((at[1] - line[1]) ** 2 + (at[2] - line[2]) ** 2) + if(isnull(best_distance) || distance < best_distance) + best_distance = distance + grip_side = arm_side + if(side_view()) + grip_side = bearer_rig.near_side() + // The arm comes up as far as it takes to meet that fist pushed out to its reach + var/list/from = bearer_shoulder_at(grip_side, bent) + var/along = gorilla_ray_meets(line[1], line[2], line[3], from[1], from[2], GORILLA_RIP_REACH * bearer_rig.arm_reach(grip_side)) + grip_stretch = clamp(isnull(along) ? GORILLA_RIP_MAX_STRETCH : along / victim_rig.arm_reach(side), 1, GORILLA_RIP_MAX_STRETCH) + grip = wrist_at(grip_stretch, GORILLA_RIP_TILT, bent) + // Every arm swings the same number of short steps, so they arrive together + var/list/now = turns_now() + var/list/there = poses_on(grip, now, bent) + var/list/start = list( + "bearer_l" = bearer_rig.arm_poses["l"] || list(0, 1), + "bearer_r" = bearer_rig.arm_poses["r"] || list(0, 1), + "body" = victim_rig.arm_poses[side] || list(0, 1), + ) + var/steps = bearer_rig.swing_steps(0, bend) + for(var/key_name in there) + var/list/pose = there[key_name] + steps = max(steps, bearer_rig.swing_steps(now[key_name], pose[1])) + var/list/all_poses = list() + var/list/step_times = list() + if(hold) + var/list/still = list() + for(var/key_name in start) + var/list/was = start[key_name] + still[key_name] = list(was[1], was[2], null) + all_poses += list(still) + step_times += hold + for(var/i in 1 to steps) + var/progress = (1 - cos(180 * i / steps)) / 2 + var/matrix/bent_now = bearer_rig.bend_matrix(bend * progress) + var/list/poses = list() + for(var/key_name in there) + var/list/pose = there[key_name] + var/list/was = start[key_name] + poses[key_name] = list(was[1] + (pose[1] - was[1]) * progress, was[2] + (pose[2] - was[2]) * progress, key_name == "body" ? null : bent_now) + all_poses += list(poses) + step_times += time / steps + pose_through(all_poses, step_times) + +/** + * The strain, over [time]: the bearer leans back from his feet (seen from the side) with his arms out and steps back to + * lean_out, hauling the arm up and out of its socket. The body is dragged in by it to where tg's grab draws it, and turns + * up about its feet toward his fists, the feet staying on the floor; both fists on the wrist the whole way. + */ +/datum/hv_finisher/chrome/gorilla/rip/proc/haul(time) + var/lean_back = side_view() ? -GORILLA_RIP_LEAN_BACK : 0 + var/list/start_fist = bearer_shoulder_at(grip_side) + var/grip_reach = sqrt((grip[1] - start_fist[1]) ** 2 + (grip[2] - start_fist[2]) ** 2) + var/body_length = victim_rig.arm_reach(side) + var/matrix/flat = matrix(victim.transform) + raised = raise_toward(flat, grip) + var/list/lean_from = lean.Copy() + var/list/shift_from = body_shift.Copy() + var/step_time = time / GORILLA_RIP_HAUL_STEPS + var/list/all_poses = list() + var/list/body_turns = list() + var/list/leans = list() + var/list/shifts = list() + var/list/from = turns_now() + for(var/i in 1 to GORILLA_RIP_HAUL_STEPS) + // Sine in and out, the same for every part + var/progress = (1 - cos(180 * i / GORILLA_RIP_HAUL_STEPS)) / 2 + lean = list(round(lean_from[1] + (lean_out[1] - lean_from[1]) * progress, 1), round(lean_from[2] + (lean_out[2] - lean_from[2]) * progress, 1)) + body_shift = list(round(shift_from[1] * (1 - progress), 1), round(shift_from[2] * (1 - progress), 1)) + victim_rig.base_transform = chrome_rig_turn_about_feet(flat, raised * progress) + leans += list(lean) + shifts += list(body_shift) + body_turns += list(victim_rig.base_transform) + var/matrix/bent = bearer_rig.bend_matrix(lean_back * progress) + var/list/fist_from = bearer_shoulder_at(grip_side, bent) + var/list/arm_from = body_shoulder_at() + var/apart = sqrt((arm_from[1] - fist_from[1]) ** 2 + (arm_from[2] - fist_from[2]) ** 2) + var/fist_reach = grip_reach + // The arm gives as far as it must to stay in his fists + var/arm_reach = clamp(max((grip_stretch + GORILLA_RIP_HAUL * progress) * body_length, apart - fist_reach + 1), body_length, GORILLA_RIP_MAX_HAUL * body_length) + fist_reach = max(fist_reach, apart - arm_reach + 1) + grip = gorilla_circles_meet(fist_from[1], fist_from[2], fist_reach, arm_from[1], arm_from[2], arm_reach, grip[1], grip[2]) + var/list/poses = poses_on(grip, from, bent) + for(var/key_name in poses) + var/list/pose = poses[key_name] + from[key_name] = pose[1] + all_poses += list(poses) + pose_through(all_poses, step_time) + victim_rig.body_through(body_turns, step_time) + // He stays leaning back until the arm comes away + bearer_rig.bend_angle = lean_back + bearer_rig.base_transform = bearer_rig.bend_matrix(lean_back) + // After the swings and turns, which would cut these short: he steps back and the body comes with him + gorilla_offsets_through(bearer_rig.puppets, leans, user.pixel_x, user.pixel_y, step_time) + gorilla_offsets_through(victim_rig.puppets, shifts, victim.pixel_x, victim.pixel_y, step_time) + // Both bodies shake together, so the fists stay on the wrist + bearer_rig.tremble(time) + victim_rig.tremble(time) + +/** + * Degrees (clockwise) to turn the body lying as [flat] turns it about its feet as the arm is hauled toward [point] (pixels + * from the middle of the bearer's tile). Seen from the side the upper body comes up off the floor, GORILLA_RIP_RAISE; from + * the front or back it turns toward the fists, at most that. + */ +/datum/hv_finisher/chrome/gorilla/rip/proc/raise_toward(matrix/flat, list/point) + var/list/feet = chrome_rig_apply(flat, 0, CHROME_RIG_FEET_Y) + var/list/shoulder_at = victim_rig.shoulder_point(side, flat) + if(side_view()) + // Clockwise lifts a shoulder that lies to the left of the feet + return shoulder_at[1] < feet[1] ? GORILLA_RIP_RAISE : -GORILLA_RIP_RAISE + var/list/body_at = body_origin() + var/turned = arctan(point[1] - body_at[1] - feet[1], point[2] - body_at[2] - feet[2]) - arctan(shoulder_at[1] - feet[1], shoulder_at[2] - feet[2]) + while(turned > 180) + turned -= 360 + while(turned <= -180) + turned += 360 + // Angles run anticlockwise, turns clockwise + return -clamp(turned, -GORILLA_RIP_RAISE, GORILLA_RIP_RAISE) + +/** + * The arm gives: the body drops back flat from its turn about the feet, faster and faster, the arm falling back to its + * side with it if it held. It stays on its stand-ins, in their draw order, until he lets go (the recover). + */ +/datum/hv_finisher/chrome/gorilla/rip/proc/fall_back() + var/obj/effect/abstract/chrome_puppet/body_puppet = victim_rig?.puppet("body") + if(!body_puppet || QDELETED(victim)) + QDEL_NULL(victim_rig) + return + if(!raised) + return + var/matrix/flat = matrix(victim.transform) + var/list/arm_from = victim_rig.puppet("arm_[side]") ? (victim_rig.arm_poses[side] || list(0, 1)) : null + var/steps = 3 + if(arm_from) + steps = max(steps, victim_rig.swing_steps(arm_from[1], 0)) + var/list/body_turns = list() + var/list/arm_steps = list() + for(var/i in 1 to steps) + // Gravity: slow off the top, fast onto the floor + var/progress = 1 - cos(90 * i / steps) + var/matrix/turned = chrome_rig_turn_about_feet(flat, raised * (1 - progress)) + body_turns += list(turned) + if(arm_from) + arm_steps += list(list(arm_from[1] * (1 - progress), arm_from[2] + (1 - arm_from[2]) * progress, turned)) + victim_rig.body_through(body_turns, GORILLA_RIP_FALL_TIME / steps) + if(arm_from) + victim_rig.pose_arm_through(side, arm_steps, GORILLA_RIP_FALL_TIME / steps) + raised = 0 + victim_rig.base_transform = flat + +/// He has let the body go and it lies where tg lays it: the real one shows in its place. +/datum/hv_finisher/chrome/gorilla/rip/proc/fallen() + QDEL_NULL(victim_rig) + +/** + * The stand-ins take on how both bodies look now. With the arm [torn] off, the victim's whole picture is the body, + * stump and all; else the arm is still its own piece. + */ +/datum/hv_finisher/chrome/gorilla/rip/proc/redraw_bodies(torn) + bearer_rig?.redraw_arms() + if(QDELETED(victim) || !victim_rig?.snapshot()) + return + victim_rig.repaint("body", torn ? victim_rig.flat : victim_rig.cut_without_arms(side)) + if(!torn) + victim_rig.repaint("arm_[side]", victim_rig.arm_picture(side)) + +/// Blood bursts every way from the socket the arm just left, where the shoulder is drawn at that moment. +/datum/hv_finisher/chrome/gorilla/rip/proc/shoulder_burst() + var/turf/spot = get_turf(victim) + if(!isturf(spot)) + return + var/list/joint + if(victim_rig?.puppet("body")) + // The stand-in's shoulder, hauled up off the floor: from the middle of the bearer's tile, so back onto the victim's + var/list/at = body_shoulder_at() + var/list/toward = to_bearer() + joint = list(at[1] + toward[1], at[2] + toward[2]) + else + joint = gorilla_shoulder_at(victim, side) + gorilla_blood_burst(spot, round(joint[1]), round(joint[2]), victim, GORILLA_RIP_BURST_DROPS) + +/** + * Where the pool under the torn shoulder goes: pixels from the middle of the victim's tile. Half-way between where the + * shoulder lies as the arm comes off, pulled in by the grab, and where it lies once he lets go, so the stump is over it + * both times. + */ +/datum/hv_finisher/chrome/gorilla/rip/proc/pool_spot() + if(QDELETED(victim)) + return null + var/list/joint = gorilla_shoulder_at(victim, side, victim_rig?.facing) + // Off a body still on its feet it lands at them + if(victim.body_position != LYING_DOWN) + joint[2] = CHROME_RIG_FEET_Y + victim.pixel_y + victim.pixel_z + var/list/back = grab_pull_back() + return list(clamp(round(joint[1] + back[1] / 2), -GORILLA_RIP_POOL_REACH, GORILLA_RIP_POOL_REACH), clamp(round(joint[2] + back[2] / 2), -GORILLA_RIP_POOL_REACH, GORILLA_RIP_POOL_REACH)) + +/** + * Where the shoulder on [side] ("l" or "r") of [body] is drawn, lying or standing as it is now: pixels from the middle of + * its tile. [facing] is the way its picture faces, else its own. + */ +/proc/gorilla_shoulder_at(mob/living/body, side, facing) + var/list/pivots = GLOB.chrome_rig_shoulders["[facing || body.dir]"] || GLOB.chrome_rig_shoulders["[SOUTH]"] + var/list/at = chrome_rig_apply(body.transform, side == "l" ? pivots[1] : pivots[3], side == "l" ? pivots[2] : pivots[4]) + return list(at[1] + body.pixel_x + body.pixel_w, at[2] + body.pixel_y + body.pixel_z) + +/** + * Blood bursts from a wound at [from_x], [from_y] (pixels from the middle of [origin]) every way at once: [count] drops + * of [bleeder]'s blood thrown in a broken ring, no two in a row alike, each landing as a drip one of [reach] pixels out, + * give or take. Drops only: no line along the floor, as #509's sprays lay, and no heavy splats. + */ +/proc/gorilla_blood_burst(turf/origin, from_x, from_y, mob/living/bleeder, count = 10, list/reach = list(6, 9, 12, 15, 19)) + if(!isturf(origin) || QDELETED(bleeder) || bleeder.can_bleed(BLOOD_COVER_TURFS) != BLEED_SPLATTER) + return + var/blood_color = bleeder.get_bloodtype()?.get_damage_color(bleeder) || BLOOD_COLOR_RED + var/list/blood_dna = bleeder.get_blood_dna_list() + var/list/viruses = bleeder.get_static_viruses() + var/start = rand(0, 359) + for(var/i in 1 to count) + var/angle = start + i * (360 / count) + rand(-14, 14) + var/distance = pick(reach) + rand(-2, 2) + var/land_x = from_x + round(sin(angle) * distance) + var/land_y = from_y + round(cos(angle) * distance) + // list(start x, start y, land x, land y, arc height, flight time, wait): the monowire's drop, which lands as a drip + new /obj/effect/temp_visual/wire_blood_drop(origin, list(from_x, from_y, land_x, land_y, 3 + rand(0, 5), round(1.5 + distance / 14, 0.5), 0), blood_color, blood_dna, viruses) + +/** + * Moves [pool] (blood just laid on the floor) so its middle is [x], [y] pixels from the middle of its tile, and keeps it + * there as it grows into a pool. + */ +/proc/gorilla_place_blood(obj/effect/decal/cleanable/blood/pool, x, y) + pool.pixel_x += x - pool.base_pixel_x + pool.pixel_y += y - pool.base_pixel_y + pool.base_pixel_x = x + pool.base_pixel_y = y + +/** + * [body] shudders up to [shift_x], [shift_y] pixels for [time] and ends where it began. Drawn only (pixel_w and pixel_z, + * each step relative), so whatever offsets tg has on the body stay as they are. + */ +/proc/gorilla_shudder(atom/movable/body, shift_x = 2, shift_y = 1, time = 0.2 SECONDS) + var/steps = max(2, round(time / (0.04 SECONDS))) + var/moved_w = 0 + var/moved_z = 0 + for(var/i in 1 to steps) + // The last step takes it back + var/to_w = i == steps ? 0 : rand(-shift_x, shift_x) + var/to_z = i == steps ? 0 : rand(-shift_y, shift_y) + if(i == 1) + animate(body, pixel_w = to_w - moved_w, pixel_z = to_z - moved_z, time = time / steps, flags = ANIMATION_RELATIVE | ANIMATION_PARALLEL) + else + animate(pixel_w = to_w - moved_w, pixel_z = to_z - moved_z, time = time / steps, flags = ANIMATION_RELATIVE) + moved_w = to_w + moved_z = to_z + +/// Sends every puppet in [parts] (key -> puppet) through [points] (list(x, y) pixels on from [base_x], [base_y]), [step_time] a step, alongside its turns. +/proc/gorilla_offsets_through(list/parts, list/points, base_x, base_y, step_time) + for(var/key_name in parts) + var/obj/effect/abstract/chrome_puppet/part = parts[key_name] + for(var/i in 1 to length(points)) + var/list/point = points[i] + if(i == 1) + animate(part, pixel_x = base_x + point[1], pixel_y = base_y + point[2], time = step_time, flags = ANIMATION_PARALLEL) + else + animate(pixel_x = base_x + point[1], pixel_y = base_y + point[2], time = step_time) + +/** + * The point [first_radius] from [first_x], [first_y] and [second_radius] from [second_x], [second_y] nearest + * [near_x], [near_y]. If the two never meet, the point [first_radius] along the line between them. + */ +/proc/gorilla_circles_meet(first_x, first_y, first_radius, second_x, second_y, second_radius, near_x, near_y) + var/apart_x = second_x - first_x + var/apart_y = second_y - first_y + var/apart = sqrt(apart_x * apart_x + apart_y * apart_y) + if(!apart) + return list(first_x, first_y) + apart_x /= apart + apart_y /= apart + if(first_radius + second_radius <= apart || abs(first_radius - second_radius) >= apart) + return list(first_x + apart_x * first_radius, first_y + apart_y * first_radius) + var/along = (apart * apart + first_radius * first_radius - second_radius * second_radius) / (2 * apart) + var/aside = sqrt(max(0, first_radius * first_radius - along * along)) + var/list/one = list(first_x + apart_x * along - apart_y * aside, first_y + apart_y * along + apart_x * aside) + var/list/two = list(first_x + apart_x * along + apart_y * aside, first_y + apart_y * along - apart_x * aside) + if((one[1] - near_x) ** 2 + (one[2] - near_y) ** 2 <= (two[1] - near_x) ** 2 + (two[2] - near_y) ** 2) + return one + return two + +/// How far along the line from [from_x], [from_y] heading [angle] degrees it first meets the circle of [radius] round [round_x], [round_y], or null. +/proc/gorilla_ray_meets(from_x, from_y, angle, round_x, round_y, radius) + var/off_x = from_x - round_x + var/off_y = from_y - round_y + var/half_b = off_x * cos(angle) + off_y * sin(angle) + var/c = off_x * off_x + off_y * off_y - radius * radius + var/disc = half_b * half_b - c + if(disc < 0) + return null + var/root = sqrt(disc) + if(-half_b - root >= 0) + return -half_b - root + if(-half_b + root >= 0) + return -half_b + root + return null + +/datum/hv_finisher/chrome/gorilla/rip/beat(key) + if(QDELETED(victim)) + return + switch(key) + if("tear") + // The sparks at the shoulder the arm leaves, on the body: on the arm they would go off with it in his fists + var/obj/effect/abstract/chrome_puppet/torn_from = victim_rig?.puppet("body") + if(torn_from) + var/list/socket = victim_rig.shoulder_point(side) + hit_stop(torn_from, TRUE, round(socket[2]), round(socket[1])) + else + hit_stop(victim) + var/outcome = gorilla_limb_rip(victim, target_zone, user, fist(), pool_spot()) + // Both bodies are hidden behind their stand-ins, and so is what this just did to them (the stump, the blood + // that ran back over him): the stand-ins take it on now, or it would only show when they come down + redraw_bodies(outcome == "torn") + if(outcome == "torn") + held_limb = gorilla_last_torn_limb(victim, target_zone) + if(held_limb?.can_bleed()) + shoulder_burst() + // The arm goes with the bearer's fists; the body drops back to the floor + var/obj/effect/abstract/chrome_puppet/arm = victim_rig?.puppet("arm_[side]") + if(arm && bearer_rig) + var/list/arm_shoulder = victim_rig.shoulder(side) + var/list/arm_hand = victim_rig.hand_offset(side) + club_ends = list(arm_shoulder[1] + arm_hand[1], arm_shoulder[2] + arm_hand[2], arm_shoulder[1], arm_shoulder[2]) + victim_rig.puppets -= "arm_[side]" + bearer_rig.puppets["club"] = arm + // Drawn where it was, from the bearer's tile + var/list/toward = to_bearer() + arm.pixel_x -= toward[1] + arm.pixel_y -= toward[2] + arm.forceMove(get_turf(user)) + // In his fists, over them. Seen from behind he holds it on his far side, so his body hides it + arm.layer = facing == NORTH ? user.layer - 0.005 : user.layer + 0.03 + if(grip && facing == NORTH) + // Yanked back lying as it was hauled, it would cross the back of his legs and reach past his feet. + // It comes down in his fist, back to its own length, and hangs from it beside him + var/list/origin = bearer_origin() + hang_club(arm, list(grip[1] - origin[1], grip[2] - origin[2]), bearer_rig.hand_point(grip_side)) + else if(grip) + // ...and yanked back with the fist that held it + var/list/fist_at = bearer_rig.hand_point(grip_side) + var/list/origin = bearer_origin() + animate(arm, pixel_x = arm.pixel_x + round(origin[1] + fist_at[1] - grip[1]), pixel_y = arm.pixel_y + round(origin[2] + fist_at[2] - grip[2]), time = 0.1 SECONDS, easing = SINE_EASING) + else + arm.pixel_x = 0 + arm.pixel_y = 0 + arm.pixel_z = 6 + arm.transform = matrix().Turn(100) + for(var/key_name in bearer_rig?.puppets) + var/obj/effect/abstract/chrome_puppet/part = bearer_rig.puppets[key_name] + animate(part, pixel_w = -2, time = 0.1 SECONDS, flags = ANIMATION_RELATIVE | ANIMATION_PARALLEL) + animate(pixel_w = 2, time = 0.3 SECONDS, flags = ANIMATION_RELATIVE) + // It drops back to the floor as the arm gives + fall_back() + +/** + * The torn arm ([club]) goes with the fist that holds its hand, from [from_fist] to [fist_at] (pixels from the middle of + * his puppets), swinging about it in short steps to hang straight down. The fist is at his side, and the arm back at + * its own length, by half way. + */ +/datum/hv_finisher/chrome/gorilla/rip/proc/hang_club(obj/effect/abstract/chrome_puppet/club, list/from_fist, list/fist_at) + var/held_length = club_length() + if(!held_length) + return + var/matrix/drawn = club.transform + var/list/hand_now = chrome_rig_apply(drawn, club_ends[1], club_ends[2]) + var/list/stump_now = chrome_rig_apply(drawn, club_ends[3], club_ends[4]) + var/angle_now = arctan(stump_now[1] - hand_now[1], stump_now[2] - hand_now[2]) + var/stretch_now = sqrt((stump_now[1] - hand_now[1]) ** 2 + (stump_now[2] - hand_now[2]) ** 2) / held_length + var/turn = -90 - angle_now + while(turn > 180) + turn -= 360 + while(turn <= -180) + turn += 360 + var/steps = max(4, bearer_rig.swing_steps(0, turn)) + var/obj/effect/abstract/chrome_puppet/own_arm = bearer_rig.puppet("arm_[grip_side]") + for(var/i in 1 to steps) + var/progress = i / steps + var/yanked = min(1, progress * 2) + var/matrix/hung = club_matrix(from_fist[1] + (fist_at[1] - from_fist[1]) * yanked, from_fist[2] + (fist_at[2] - from_fist[2]) * yanked, angle_now + turn * progress, stretch_now + (1 - stretch_now) * yanked) + if(i == 1) + // From here on its transform alone puts it in his fist, from where his own arm stands + animate(club, transform = hung, pixel_x = own_arm?.pixel_x || 0, pixel_y = own_arm?.pixel_y || 0, pixel_z = own_arm?.pixel_z || 0, time = GORILLA_RIP_HANG_TIME / steps) + else + animate(transform = hung, time = GORILLA_RIP_HANG_TIME / steps) + +/// The middle of the victim's head as drawn, lying or not: pixels from the middle of the bearer's tile. +/datum/hv_finisher/chrome/gorilla/rip/proc/victim_head_at() + var/list/head = chrome_rig_apply(victim.transform, 0, CHROME_RIG_NECK_PIVOT_Y + 3.5) + return list((victim.x - user.x) * ICON_SIZE_X + victim.pixel_x + victim.pixel_w + head[1], (victim.y - user.y) * ICON_SIZE_Y + victim.pixel_y + victim.pixel_z + head[2]) + +/// The torn arm's length in its own picture, hand to shoulder. +/datum/hv_finisher/chrome/gorilla/rip/proc/club_length() + return sqrt((club_ends[3] - club_ends[1]) ** 2 + (club_ends[4] - club_ends[2]) ** 2) + +/** + * The torn arm held by its hand at [fist_x], [fist_y] (pixels from the middle of the bearer's puppets), its shoulder + * end pointing [angle] degrees round from the right (anticlockwise), [stretch] times its length. + */ +/datum/hv_finisher/chrome/gorilla/rip/proc/club_matrix(fist_x, fist_y, angle, stretch = 1) + var/along = arctan(club_ends[3] - club_ends[1], club_ends[4] - club_ends[2]) + return chrome_rig_turn(along - angle, club_ends[1], club_ends[2], fist_x - club_ends[1], fist_y - club_ends[2], 1, stretch) + +/// The degrees from [from_angle] to [to_angle], turning the way [arm_turned] went (anticlockwise positive) when they are far apart. +/proc/gorilla_turn_with(from_angle, to_angle, arm_turned) + var/turned = to_angle - from_angle + while(turned > 180) + turned -= 360 + while(turned <= -180) + turned += 360 + if(abs(arm_turned) > 90 && turned * arm_turned < 0) + turned += arm_turned > 0 ? 360 : -360 + return turned + +/** + * The blow with the torn arm: both fists swing it up over his head in [raise], then bring it down on the victim's + * head in [strike], so it lands as the arms come down. The arm in his fists goes through the same short steps as + * his arms, held by its hand in the fist that tore it off. + */ +/datum/hv_finisher/chrome/gorilla/rip/proc/swing_club(raise, strike) + if(!bearer_rig) + return + var/obj/effect/abstract/chrome_puppet/club = club_ends ? bearer_rig.puppet("club") : null + var/holding = grip_side || bearer_rig.near_side() + var/list/origin = bearer_origin() + // The blow comes down from his shoulders onto the head; the fists go out as far along it as the arm in them doesn't + var/list/head = victim_head_at() + var/list/left = bearer_rig.shoulder("l") + var/list/right = bearer_rig.shoulder("r") + var/from_x = (left[1] + right[1]) / 2 + var/from_y = (left[2] + right[2]) / 2 + var/to_x = head[1] - origin[1] - from_x + var/to_y = head[2] - origin[2] - from_y + var/apart = sqrt(to_x * to_x + to_y * to_y) + var/blow_angle = arctan(to_x, to_y) + var/held_length = club ? club_length() : 0 + var/fist_along = clamp(apart - held_length, 0, GORILLA_CLUB_REACH * bearer_rig.arm_reach(holding)) + var/blow_stretch = held_length ? clamp((apart - fist_along) / held_length, 1, GORILLA_CLUB_MAX_STRETCH) : 1 + var/fist_x = from_x + fist_along * cos(blow_angle) + var/fist_y = from_y + fist_along * sin(blow_angle) + // Overhead: seen from the side up and back, the arm hanging back over his head; from the front or from behind + // straight up, where both his arms and the arm in them show over his head + var/club_up + var/list/poses_now = list() + var/list/poses_up = list() + var/list/poses_down = list() + for(var/arm_side in list("l", "r")) + poses_now[arm_side] = bearer_rig.arm_poses[arm_side] || list(0, 1) + var/list/up + if(side_view()) + up = list(200 * bearer_rig.raise_sign(arm_side), 1.2) + club_up = facing == EAST ? 145 : 35 + else + up = list(170 * bearer_rig.raise_sign(arm_side), 1.1) + club_up = 90 + poses_up[arm_side] = up + var/list/down = bearer_rig.pose_reaching(arm_side, fist_x, fist_y, up[1]) + down[2] = min(down[2], GORILLA_CLUB_REACH) + poses_down[arm_side] = down + // Every arm goes through the same steps: sine up, then faster and faster down + var/up_steps = 1 + var/down_steps = 1 + for(var/arm_side in list("l", "r")) + var/list/now = poses_now[arm_side] + var/list/up = poses_up[arm_side] + var/list/down = poses_down[arm_side] + up_steps = max(up_steps, bearer_rig.swing_steps(now[1], up[1])) + down_steps = max(down_steps, bearer_rig.swing_steps(up[1], down[1])) + var/list/progress = list() + var/list/step_times = list() + for(var/i in 1 to up_steps) + progress += (1 - cos(180 * i / up_steps)) / 2 + step_times += raise / up_steps + for(var/i in 1 to down_steps) + progress += 1 - cos(90 * i / down_steps) + step_times += strike / down_steps + var/list/arm_steps = list("l" = list(), "r" = list()) + for(var/i in 1 to length(progress)) + var/rising = i <= up_steps + for(var/arm_side in list("l", "r")) + var/list/was = rising ? poses_now[arm_side] : poses_up[arm_side] + var/list/will = rising ? poses_up[arm_side] : poses_down[arm_side] + arm_steps[arm_side] += list(list(was[1] + (will[1] - was[1]) * progress[i], was[2] + (will[2] - was[2]) * progress[i])) + for(var/arm_side in arm_steps) + bearer_rig.pose_arm_through(arm_side, arm_steps[arm_side], step_times) + if(!club) + return + // The torn arm turns the way the arm holding it does, from where it hangs in the fist now + var/matrix/drawn = club.transform + var/list/hand_now = chrome_rig_apply(drawn, club_ends[1], club_ends[2]) + var/list/stump_now = chrome_rig_apply(drawn, club_ends[3], club_ends[4]) + var/club_now = arctan(stump_now[1] - hand_now[1], stump_now[2] - hand_now[2]) + var/stretch_now = held_length ? sqrt((stump_now[1] - hand_now[1]) ** 2 + (stump_now[2] - hand_now[2]) ** 2) / held_length : 1 + var/list/hold_now = poses_now[holding] + var/list/hold_up = poses_up[holding] + var/list/hold_down = poses_down[holding] + // Arm turns are clockwise, the arm's angles anticlockwise + var/turn_up = gorilla_turn_with(club_now, club_up, hold_now[1] - hold_up[1]) + var/turn_down = gorilla_turn_with(club_now + turn_up, blow_angle, hold_up[1] - hold_down[1]) + var/obj/effect/abstract/chrome_puppet/holding_arm = bearer_rig.puppet("arm_[holding]") + var/list/held_steps = arm_steps[holding] + for(var/i in 1 to length(held_steps)) + var/rising = i <= up_steps + var/list/fist = bearer_rig.hand_at(holding, held_steps[i]) + var/angle = rising ? club_now + turn_up * progress[i] : club_now + turn_up + turn_down * progress[i] + var/stretch = rising ? stretch_now + (1 - stretch_now) * progress[i] : 1 + (blow_stretch - 1) * progress[i] + var/matrix/held = club_matrix(fist[1], fist[2], angle, stretch) + if(i == 1) + animate(club, transform = held, pixel_x = holding_arm?.pixel_x || 0, pixel_y = holding_arm?.pixel_y || 0, pixel_w = 0, pixel_z = holding_arm?.pixel_z || 0, time = step_times[i]) + else + animate(transform = held, time = step_times[i]) + +/// The torn arm lands on the victim's head. +/datum/hv_finisher/chrome/gorilla/rip/proc/club_hit() + if(!running || QDELETED(victim) || !held_limb) + return + var/obj/item/bodypart/head = victim.get_bodypart(BODY_ZONE_HEAD) + victim.hv_hold_attack_message("[user] beats [victim] with [victim.p_their()] own arm!", "[user] beats you with your own arm!", "You beat [victim] with [victim.p_their()] own arm!", user, vision_range = DEFAULT_MESSAGE_RANGE) + // None of #509's heavy-hit spray for this blow: its fan lands a tile out past the body, nowhere near the head + gorilla_hold_spray(victim) + victim.apply_damage(15, BRUTE, head || BODY_ZONE_CHEST, victim.run_armor_check(head, MELEE), wound_bonus = CANT_WOUND, attack_direction = get_dir(user, victim), attacking_item = fist()) + victim.hv_flush_hit() + playsound(victim, 'sound/effects/wounds/splatter.ogg', 60, TRUE) + // The blow's wound is drawn on the hidden body: its stand-in takes it on, and takes the hit + var/obj/effect/abstract/chrome_puppet/body_puppet = victim_rig?.puppet("body") + if(body_puppet && victim_rig.snapshot()) + victim_rig.repaint("body", victim_rig.puppet("arm_[side]") ? victim_rig.cut_without_arms(side) : victim_rig.flat) + var/obj/effect/abstract/cyberware_anim/impact = gorilla_play_impact(user, body_puppet || victim, "impact_gorilla") + if(impact && body_puppet) + // On the head, where the arm lands. On a puppet it keeps the puppet's place but not its turn: the head as it lies + var/list/head_at = chrome_rig_apply(victim.transform, 0, CHROME_RIG_NECK_PIVOT_Y + 3.5) + impact.pixel_w += round(head_at[1]) + impact.pixel_z += round(head_at[2]) + else if(impact) + // It rides on the body, so its offset turns with a lying one: up is the head + impact.pixel_y += round(CHROME_RIG_NECK_PIVOT_Y + 3.5) + // Not tg's Shake(): its first step takes pixel_y from pixel_x, which throws a body pulled in by a grab a third of a + // tile aside for a frame + if(body_puppet) + for(var/key_name in victim_rig.puppets) + gorilla_shudder(victim_rig.puppets[key_name], 2, 1, 0.2 SECONDS) + else + gorilla_shudder(victim, 2, 1, 0.2 SECONDS) + if(held_limb.can_bleed()) + victim.add_splatter_floor(get_turf(victim), small_drip = TRUE) + +/// Puts the torn arm down on the victim's tile, wherever the finisher stopped. +/datum/hv_finisher/chrome/gorilla/rip/proc/drop_held_limb() + if(isnull(held_limb)) + return + var/obj/item/bodypart/limb = held_limb + held_limb = null + if(QDELETED(limb)) + return + var/turf/spot = get_turf(victim) || get_turf(user) + if(spot) + limb.forceMove(spot) + // What still runs out of it as it lands: a drip, into the pool from the tear where there is one. Not a fresh + // splash on the body's tile a second after the wound + if(limb.can_bleed()) + if(!QDELETED(victim) && get_turf(victim) == spot) + victim.add_splatter_floor(spot, TRUE) + else + new /obj/effect/decal/cleanable/blood/drip(spot, null, limb.blood_dna_info) + +/// The arm just torn from [victim] at [zone], waiting in nullspace, or null. +/proc/gorilla_last_torn_limb(mob/living/carbon/victim, zone) + var/obj/item/bodypart/limb = victim.gorilla_torn_limb?.resolve() + victim.gorilla_torn_limb = null + if(QDELETED(limb) || limb.body_zone != zone) + return null + return limb + +/mob/living/carbon + /// The last arm a Gorilla tore off this body, until the finisher takes it. + var/datum/weakref/gorilla_torn_limb + +/** + * Tears [victim]'s arm at [zone] off, or wrenches the shoulder out of its socket when it's armoured, or + * does nothing but hurt on the Atlas frame or a limb that can't come off. Returns "torn", + * "dislocated" or "held". [blood_at] (list(x, y) pixels from the middle of the victim's tile) is where + * the blood the torn shoulder puts on the floor goes; the middle of the tile without it. + */ +/proc/gorilla_limb_rip(mob/living/carbon/victim, zone, mob/living/user, obj/item/fist, list/blood_at) + var/obj/item/bodypart/limb = victim.get_bodypart(zone) + if(isnull(limb)) + return null + var/toward_bearer = get_dir(victim, user) + if(!limb.can_dismember() || HAS_TRAIT(victim, TRAIT_CYBERWARE_UNBREAKABLE_BONES)) + victim.hv_hold_attack_message("[user] wrenches at [victim]'s [limb.plaintext_zone]!", "[user] wrenches at your [limb.plaintext_zone]!", null, user) + victim.apply_damage(25, BRUTE, limb, victim.run_armor_check(limb, MELEE), wound_bonus = CANT_WOUND, attack_direction = toward_bearer) + victim.hv_add_hit_line("[victim]'s arm holds!", HV_LINE_BOLD, "Your arm holds!") + victim.hv_flush_hit() + log_combat(user, victim, "failed to tear off the arm of", "gorilla arms") + return "held" + if(hv_crit_cover_rating(victim, limb, MELEE) >= GORILLA_RIP_ARMOUR) + victim.hv_hold_attack_message("[user] wrenches at [victim]'s [limb.plaintext_zone]!", "[user] wrenches at your [limb.plaintext_zone]!", null, user) + victim.apply_damage(25, BRUTE, limb, victim.run_armor_check(limb, MELEE), wound_bonus = CANT_WOUND, attack_direction = toward_bearer) + if(hv_crit_apply_wound(limb, /datum/wound/blunt/bone/moderate, toward_bearer, fist)) + victim.hv_add_hit_line("[victim]'s shoulder wrenches out of its socket!", HV_LINE_BOLD, "Your shoulder wrenches out of its socket!") + victim.hv_flush_hit() + do_sparks(2, TRUE, victim) + log_combat(user, victim, "dislocated the arm of", "gorilla arms") + return "dislocated" + // The spray runs back at the bearer: the last hit on the body came from them. + victim.hv_hold_attack_message("[user] tears [victim]'s [limb.plaintext_zone] off at the shoulder!", "[user] tears your [limb.plaintext_zone] off at the shoulder!", "You tear [victim]'s [limb.plaintext_zone] off at the shoulder!", user, vision_range = DEFAULT_MESSAGE_RANGE) + victim.apply_damage(10, BRUTE, limb, wound_bonus = CANT_WOUND, attack_direction = toward_bearer) + // One straight line back at the bearer, who takes it; no fan past him + if(limb.can_bleed()) + gorilla_short_spray(victim, toward_bearer, 2) + var/obj/item/bodypart/torn = gorilla_tear_limb(victim, limb, toward_bearer, TRUE, blood_at) + victim.hv_flush_hit() + if(isnull(torn)) + return "held" + if(!torn.can_bleed()) + do_sparks(3, TRUE, victim) + playsound(victim, 'sound/effects/wounds/crackandbleed.ogg', 80, TRUE) + victim.gorilla_torn_limb = WEAKREF(torn) + log_combat(user, victim, "tore off the [torn.plaintext_zone] of", "gorilla arms") + return "torn" + +/** + * Takes [limb] off as tg's dismember() does (chest damage, scream, sound, mood, memory, bleeding, the + * floor splatter, the wet stump and the spray along the last blow), but never flings it: with [keep_out] + * it is kept out of the world for the finisher to hold, else it is left on the victim's tile. Fresh blood + * it puts on the floor goes [blood_at] (list(x, y) pixels from the middle of the tile), under the wound, if + * given; blood already on the tile stays where it is. Returns the limb or null. + */ +/proc/gorilla_tear_limb(mob/living/carbon/victim, obj/item/bodypart/limb, direction, keep_out = TRUE, list/blood_at) + if(isnull(limb) || limb.owner != victim || !limb.can_dismember() || HAS_TRAIT(victim, TRAIT_GODMODE)) + return null + var/obj/item/bodypart/chest = victim.get_bodypart(BODY_ZONE_CHEST) + chest?.receive_damage(clamp(limb.brute_dam / 2 * chest.body_damage_coeff, 15, 50), wound_bonus = CANT_WOUND) + INVOKE_ASYNC(victim, TYPE_PROC_REF(/mob, emote), "scream") + playsound(get_turf(victim), 'sound/effects/dismember.ogg', 80, TRUE) + victim.add_mood_event("dismembered_[limb.body_zone]", /datum/mood_event/dismembered, limb) + victim.add_mob_memory(/datum/memory/was_dismembered, lost_limb = limb) + LAZYSET(victim.body_zone_dismembered_by, limb.body_zone, WOUND_BLUNT) + var/bleeds = limb.can_bleed() + var/turf/spot = get_turf(victim) + var/list/old_blood = list() + if(blood_at && isturf(spot)) + for(var/obj/effect/decal/cleanable/blood/there in spot) + old_blood += there + if(bleeds) + victim.bleed(rand(20, 40)) + limb.drop_limb(FALSE, TRUE) + victim.update_equipment_speed_mods() + if(bleeds && isturf(spot)) + victim.add_splatter_floor(spot) + if(blood_at) + // tg lays it on the middle of the tile, which a body held in a grab is drawn well off + for(var/obj/effect/decal/cleanable/blood/pool in spot) + if(pool.type == /obj/effect/decal/cleanable/blood && !(pool in old_blood) && !QDELETED(pool)) + gorilla_place_blood(pool, blood_at[1], blood_at[2]) + if(QDELETED(limb)) + return null + if(keep_out) + limb.moveToNullspace() + return limb + +// ========================================================================= +// (C) THE BACKBREAKER +// ========================================================================= + +/datum/hv_finisher/chrome/gorilla/backbreaker + name = "gorilla backbreaker" + zone_preference = list(BODY_ZONE_CHEST) + stages = list( + /datum/hv_finisher_stage/hold/gorilla/back_hoist, + /datum/hv_finisher_stage/hold/gorilla/back_press, + /datum/hv_finisher_stage/kill/gorilla/backbreaker, + /datum/hv_finisher_stage/recover/gorilla/backbreaker, + ) + /// TRUE once the back broke: the body is rolled off still bent + var/broke = FALSE + /// Which way the body lies in his hands and on the floor after: 1 head east, -1 head west. Away from a bearer + /// facing east or west, so it goes off his knee head first; tg lays no body head north or south. + var/lay = 1 + +/datum/hv_finisher_stage/hold/gorilla/back_hoist + key = "hoist" + duration = 0.85 SECONDS + +/datum/hv_finisher_stage/hold/gorilla/back_press + key = "press" + duration = 1 SECONDS + +/datum/hv_finisher_stage/kill/gorilla/backbreaker + key = "slam" + effect_delay = 0.18 SECONDS + duration = 0.6 SECONDS + +/datum/hv_finisher_stage/recover/gorilla/backbreaker + key = "roll" + duration = 0.8 SECONDS + +/datum/hv_finisher/chrome/gorilla/backbreaker/pick_zone() + target_zone = BODY_ZONE_CHEST + return target_zone + +/datum/hv_finisher/chrome/gorilla/backbreaker/can_start_on(mob/living/carbon/target) + return !isnull(target.get_bodypart(BODY_ZONE_CHEST)) + +/datum/hv_finisher/chrome/gorilla/backbreaker/enter_line(key) + switch(key) + if("hoist") + return "[user] hoists [victim] over [user.p_their()] head!" + if("press") + return "[victim] thrashes in [user]'s grip." + if("roll") + return "[user] drops [victim] off [user.p_their()] knee." + +/datum/hv_finisher/chrome/gorilla/backbreaker/enter_self_line(key) + switch(key) + if("hoist") + return "[user] hoists you over [user.p_their()] head!" + if("press") + return "You thrash in [user]'s grip." + +/// Where the belt sits, from the icon's centre: halves turn about it. +#define BACK_WAIST_PIVOT_Y -7 + +/datum/hv_finisher/chrome/gorilla/backbreaker/pose(key) + var/list/toward = to_bearer() + switch(key) + if("hoist") + rig_bearer() + lay = (facing || user.dir) == WEST ? -1 : 1 + victim_rig = new(victim, SOUTH) + if(victim_rig.snapshot()) + // A body lying with its head the other way from how he will hold it comes up head first: turned to that in one + // straight step it would shrink away to nothing half way and grow back + var/lying_turn = arctan(victim.transform.a, victim.transform.b) + var/turn_over = abs(lay * 90 - lying_turn) > 90 ? lay * 90 - lying_turn : 0 + // Draw order, the same from the floor to the floor, so nothing changes places mid-move: + // - Facing away he lifts the body on his far side, holds it there and breaks it over a knee that is + // beyond him too: the body, then his own back, head and arms over it wherever they cross. + // - Any other way it comes up on the viewer's side of him and stays there: he is under it. + var/halves_layer = user.layer + ((facing || user.dir) == NORTH ? -0.05 : 0.05) + for(var/half in list("upper", "lower")) + var/obj/effect/abstract/chrome_puppet/part = victim_rig.add_puppet(half, victim_rig.cut("rig_[half]"), TRUE, halves_layer) + // Overhead on his back, flat, held clear above the bearer's head + if(turn_over) + var/steps = bearer_rig?.swing_steps(0, turn_over) || 15 + for(var/i in 1 to steps) + // Fast off the floor, slow into his hands + var/progress = sin(90 * i / steps) + var/matrix/turned = chrome_rig_turn(lying_turn + turn_over * progress, 0, BACK_WAIST_PIVOT_Y * progress) + if(i == 1) + animate(part, transform = turned, time = 0.55 SECONDS / steps) + else + animate(transform = turned, time = 0.55 SECONDS / steps) + animate(part, pixel_x = toward[1], pixel_y = toward[2], pixel_w = 0, pixel_z = 29, time = 0.55 SECONDS, easing = SINE_EASING | EASE_OUT, flags = ANIMATION_PARALLEL) + else + animate(part, pixel_x = toward[1], pixel_y = toward[2], pixel_w = 0, pixel_z = 29, transform = laid(), time = 0.55 SECONDS, easing = SINE_EASING | EASE_OUT) + victim_rig.conceal() + else + QDEL_NULL(victim_rig) + // Fists up under the body + if(side_view()) + arm_to("near", 166, 0.5 SECONDS, 6) + arm_to("far", 174, 0.5 SECONDS, 6) + else + arms_to(170, 0.5 SECONDS, 3) + if("press") + bearer_rig?.tremble(1 SECONDS) + var/obj/effect/abstract/chrome_puppet/upper = victim_rig?.puppet("upper") + var/obj/effect/abstract/chrome_puppet/lower = victim_rig?.puppet("lower") + for(var/i in 1 to 4) + var/kick = (i % 2) ? 1 : -1 + if(upper) + if(i == 1) + animate(upper, transform = laid(6 * kick), time = 0.12 SECONDS) + else + animate(transform = laid(6 * kick), time = 0.24 SECONDS) + if(lower) + if(i == 1) + animate(lower, transform = laid(-(12 * kick)), time = 0.12 SECONDS) + else + animate(transform = laid(-(12 * kick)), time = 0.24 SECONDS) + if(upper) + animate(transform = laid(), time = 0.1 SECONDS) + if(lower) + animate(transform = laid(), time = 0.1 SECONDS) + if("slam") + // Down to one knee, and the body comes down across it + arms_to(120, 0.15 SECONDS, 2) + bearer_rig?.crouch(0.8, 3, 0.15 SECONDS, SINE_EASING | EASE_IN) + for(var/half in list("upper", "lower")) + var/obj/effect/abstract/chrome_puppet/part = victim_rig?.puppet(half) + if(part) + animate(part, pixel_z = 2, time = 0.16 SECONDS, easing = SINE_EASING | EASE_IN, flags = ANIMATION_PARALLEL) + if("roll") + // Off the knee and forward, onto the tile he faces (owner). If something is in the way there, it comes + // down at his feet instead, on his own tile (a body on the floor shares it). + var/turf/knee = get_turf(user) + var/turf/from = get_turf(victim) + var/turf/ahead = get_step(user, facing || user.dir) + var/shoved = can_lay_on(ahead) + var/turf/lands = shoved ? ahead : knee + if(lands && from && lands != from && victim.body_position == LYING_DOWN) + // The real body is hidden under its halves, which stay drawn where they are as it moves under them + if(shoved) + victim.forceMove(lands) + else + victim.Move(lands, get_dir(from, lands)) + lands = get_turf(victim) + for(var/key_name in victim_rig?.puppets) + var/obj/effect/abstract/chrome_puppet/part = victim_rig.puppets[key_name] + part.forceMove(lands) + part.pixel_x -= (lands.x - from.x) * ICON_SIZE_X + part.pixel_y -= (lands.y - from.y) * ICON_SIZE_Y + // At his feet it lies in front of him, toward the viewer, where he doesn't hide it: the real body too, for + // when the halves come down. Shoved clear of him it lies as tg lays any body. + var/at_feet = get_turf(victim) == knee + if(at_feet) + victim.AddComponent(/datum/component/gorilla_laid_in_front, lay) + // tg turns a lying body to the way it last crawled: lay it as the halves are, or it flips over when + // they come down. + if(victim.body_position == LYING_DOWN) + victim.set_lying_angle(lay > 0 ? LYING_ANGLE_EAST : LYING_ANGLE_WEST) + // Where the halves come to rest, from the middle of the tile they are on. They turn about the belt, seven + // pixels under the middle of the picture, so they sit that far back along the body and a pixel up to lie + // exactly where tg draws the lying body; at his feet the body is drawn out to them instead (the component). + var/rest_x = at_feet ? 0 : lay * BACK_WAIST_PIVOT_Y + var/rest_y = at_feet ? 1 - GORILLA_BACK_IN_FRONT : 1 + // Still bent if the back broke. A broken back hangs folded over the knee for a moment first. + var/bend = broke ? 33 : 0 + var/hold = broke ? GORILLA_BACK_FOLD_HOLD : 0 + if(at_feet) + // He lets it down and stands + arms_to(0, 0.5 SECONDS) + bearer_rig?.crouch(1, 0, 0.4 SECONDS, SINE_EASING | EASE_OUT) + else if(hold) + // He stays down on the knee under it until he shoves it off + addtimer(CALLBACK(src, PROC_REF(shove_off)), hold, TIMER_DELETE_ME) + else + shove_off() + for(var/half in list("upper", "lower")) + var/obj/effect/abstract/chrome_puppet/part = victim_rig?.puppet(half) + if(!part) + continue + var/way = half == "upper" ? 1 : -1 + animate(part, transform = laid(way * (broke ? 38 : 0)), time = hold) + if(at_feet) + animate(pixel_x = rest_x, pixel_y = rest_y, pixel_z = 0, transform = laid(way * bend), time = 0.45 SECONDS, easing = SINE_EASING | EASE_IN | EASE_OUT) + else + // Shoved: up off the knee and over, then down onto the floor ahead + animate(pixel_x = (part.pixel_x + rest_x) / 2, pixel_y = (part.pixel_y + rest_y) / 2, pixel_z = GORILLA_BACK_SHOVE_RISE, transform = laid(way * bend), time = GORILLA_BACK_SHOVE_TIME * 0.45, easing = SINE_EASING | EASE_OUT) + animate(pixel_x = rest_x, pixel_y = rest_y, pixel_z = 0, time = GORILLA_BACK_SHOVE_TIME * 0.55, easing = SINE_EASING | EASE_IN) + // No blood of the move's own where he lands (owner): a broken back doesn't bleed, and a pool on the middle + // of the tile never lined up with the body. What the body really bleeds is tg's. + // At his feet the halves stay drawn as they were hoisted while they lie there: over him, or under him seen + // from behind, where tg draws the lying body too + +/// The bearer shoves the body off his knee: both arms push out after it, then he lets them down and stands. +/datum/hv_finisher/chrome/gorilla/backbreaker/proc/shove_off() + if(!running || !bearer_rig) + return + // Away from the viewer the body goes on past him, behind him as it has been since the hoist + arms_to(side_view() ? 70 : 60, GORILLA_BACK_SHOVE_PUSH, 4) + addtimer(CALLBACK(src, PROC_REF(stand_up)), GORILLA_BACK_SHOVE_PUSH + 0.05 SECONDS, TIMER_DELETE_ME) + +/// He lets his arms down and stands off the knee. +/datum/hv_finisher/chrome/gorilla/backbreaker/proc/stand_up() + if(!running || !bearer_rig) + return + arms_to(0, 0.3 SECONDS) + bearer_rig.crouch(1, 0, 0.3 SECONDS, SINE_EASING | EASE_OUT) + +/// A half of the body as it is held and laid: flat on its back, head the way [var/lay] says, bent [bend] degrees at the belt. +/datum/hv_finisher/chrome/gorilla/backbreaker/proc/laid(bend = 0) + return chrome_rig_turn(lay * (90 + bend), 0, BACK_WAIST_PIVOT_Y) + +/** + * Whether the body can be shoved off the knee onto [ahead], the tile the bearer faces: open floor he can reach, with + * nothing solid on it and nobody else on their feet there. The body's own tile is fine: it was lifted off it. + */ +/datum/hv_finisher/chrome/gorilla/backbreaker/proc/can_lay_on(turf/ahead) + var/turf/here = get_turf(user) + if(QDELETED(victim) || !isopenturf(ahead) || !here || !here.Adjacent(ahead)) + return FALSE + // Nowhere to lie, unless it lay there already + if(get_turf(victim) != ahead && (isgroundlessturf(ahead) || ischasm(ahead) || islava(ahead))) + return FALSE + // No source atom: a body lying on a crate or table tile may pass what it sits on, but it is not put back down on one + if(ahead.is_blocked_turf(exclude_mobs = TRUE)) + return FALSE + for(var/mob/living/other in ahead) + if(other != victim && other != user && other.density && other.body_position == STANDING_UP) + return FALSE + return TRUE + +/datum/hv_finisher/chrome/gorilla/backbreaker/beat(key) + if(key != "slam" || QDELETED(victim)) + return + hit_stop(victim_rig?.puppet("upper") || victim, TRUE) + gorilla_backbreaker_sound(victim) + playsound(victim, 'sound/effects/meteorimpact.ogg', 50, TRUE) + var/turf/knee = get_turf(user) + if(knee) + new /obj/effect/temp_visual/cyberware_impact_cracks(knee, "damaged1", 255) + cyberware_grey_dust(knee) + var/outcome = gorilla_backbreak(victim, user, fist()) + broke = outcome == "broken" + // What the blow did to the body (the snapped bone, tg's wounds) is drawn on the hidden one: the halves take it on + // now, or it would only show when they come down + if(!QDELETED(victim) && victim_rig?.snapshot()) + for(var/half in list("upper", "lower")) + victim_rig.repaint(half, victim_rig.cut("rig_[half]")) + if(broke) + // The body folds over the knee + var/obj/effect/abstract/chrome_puppet/upper = victim_rig?.puppet("upper") + var/obj/effect/abstract/chrome_puppet/lower = victim_rig?.puppet("lower") + if(upper) + animate(upper, transform = laid(38), time = 0.06 SECONDS) + if(lower) + animate(lower, transform = laid(-(38)), time = 0.06 SECONDS) + else + // Nothing gives: the body bounces off the knee + for(var/half in list("upper", "lower")) + var/obj/effect/abstract/chrome_puppet/part = victim_rig?.puppet(half) + if(part) + animate(part, pixel_z = 6, time = 0.12 SECONDS, easing = SINE_EASING | EASE_OUT, flags = ANIMATION_PARALLEL) + animate(pixel_z = 2, time = 0.12 SECONDS, easing = SINE_EASING | EASE_IN) + +/datum/hv_finisher/chrome/gorilla/backbreaker/cleanup_rigs() + // A broken back stays drawn bent for a while after + if(broke && victim_rig && !QDELETED(victim) && victim.get_bodypart(BODY_ZONE_CHEST)) + victim.AddComponent(/datum/component/gorilla_fold, victim_rig, lay) + victim_rig = null + return ..() + +/** + * Brings [victim] down across a knee: heavy brute to the chest, then a broken back, or cracked ribs under + * chest armour, or nothing on the Atlas frame. Returns "broken", "ribs", "frame" or "bruised". + */ +/proc/gorilla_backbreak(mob/living/carbon/victim, mob/living/user, obj/item/fist) + var/obj/item/bodypart/chest = victim.get_bodypart(BODY_ZONE_CHEST) + if(isnull(chest)) + return null + var/direction = get_dir(user, victim) + victim.hv_hold_attack_message("[user] drops to one knee and brings [victim] down across it!", "[user] drops to one knee and brings you down across it!", "You drop to one knee and bring [victim] down across it!", user, vision_range = DEFAULT_MESSAGE_RANGE) + // No attack direction: a body bent over a knee throws no blood across the room (#509's heavy-hit spray) + victim.apply_damage(45, BRUTE, chest, victim.run_armor_check(chest, MELEE), wound_bonus = CANT_WOUND) + . = "bruised" + if(HAS_TRAIT(victim, TRAIT_CYBERWARE_UNBREAKABLE_BONES)) + victim.hv_add_hit_line("[victim]'s frame holds!", HV_LINE_BOLD, "Your frame holds!") + . = "frame" + else if(hv_crit_cover_rating(victim, chest, MELEE) >= GORILLA_BACK_ARMOUR) + if(hv_crit_apply_wound(chest, /datum/wound/blunt/bone/severe, direction, fist)) + victim.hv_add_hit_line("[victim]'s ribs crack!", HV_LINE_BOLD, "Your ribs crack!") + . = "ribs" + else if(hv_crit_apply_wound(chest, /datum/wound/blunt/bone/critical/gorilla_spine, direction, fist)) + victim.hv_add_hit_line("[victim]'s back breaks!", HV_LINE_HUGE, "Your back breaks!", DEFAULT_MESSAGE_RANGE) + . = "broken" + if(!QDELETED(victim)) + victim.hv_flush_hit() + log_combat(user, victim, "backbroke", "gorilla arms", "([.])") + +/** + * # Broken back + * + * tg's compound fracture on the chest, with the spine gone: while it lasts the body can crawl but not + * stand. Treated like any compound fracture (surgery, or bone gel and tape). + */ +/datum/wound/blunt/bone/critical/gorilla_spine + name = "Broken Back" + undiagnosed_name = "Broken Back" + desc = "Patient's spine has been snapped across, leaving the legs useless." + treat_text = "Repair surgically. Bone gel and surgical tape will hold it in an emergency." + treat_text_short = "Repair surgically, or apply bone gel and surgical tape." + simple_desc = "Patient's back is broken. They cannot stand." + simple_treat_text = "Surgery, or bone gel and surgical tape." + homemade_treat_text = "Don't move them." + examine_desc = "is bent at an angle no back should bend" + occur_text = "folds the wrong way with a crack" + +/datum/wound/blunt/bone/critical/gorilla_spine/wound_injury(datum/wound/old_wound = null, attack_direction = null) + . = ..() + if(victim) + ADD_TRAIT(victim, TRAIT_FLOORED, REF(src)) + +/datum/wound/blunt/bone/critical/gorilla_spine/remove_wound(ignore_limb, replaced = FALSE) + if(victim) + REMOVE_TRAIT(victim, TRAIT_FLOORED, REF(src)) + return ..() + +/datum/wound/blunt/bone/critical/gorilla_spine/set_victim(new_victim) + if(victim) + REMOVE_TRAIT(victim, TRAIT_FLOORED, REF(src)) + return ..() + +/datum/wound_pregen_data/bone/gorilla_spine + abstract = FALSE + wound_path_to_generate = /datum/wound/blunt/bone/critical/gorilla_spine + viable_zones = list(BODY_ZONE_CHEST) + can_be_randomly_generated = FALSE + threshold_minimum = 115 + +/** + * The fold a broken back leaves: the victim's puppets stay bent for a while after the backbreaker, until + * the body is moved, buckled or the back is set. Left alone, it eases out flat when its time is up, to lie as + * the real body does, which then shows in its place. + */ +/datum/component/gorilla_fold + /// The victim's rig, handed over by the finisher + var/datum/chrome_rig/rig + /// 1 if the body lies head east, -1 head west + var/lay = 1 + var/fold_timer + +/datum/component/gorilla_fold/Initialize(datum/chrome_rig/rig, lay = 1) + if(!iscarbon(parent) || !istype(rig)) + return COMPONENT_INCOMPATIBLE + src.rig = rig + src.lay = lay + fold_timer = addtimer(CALLBACK(src, PROC_REF(settle)), GORILLA_FOLD_TIME, TIMER_STOPPABLE) + +/// The fold's time is up: the halves ease out flat, where the real body lies, and it shows once they are. +/datum/component/gorilla_fold/proc/settle() + for(var/half in list("upper", "lower")) + var/obj/effect/abstract/chrome_puppet/part = rig?.puppet(half) + if(part) + animate(part, transform = chrome_rig_turn(lay * 90, 0, BACK_WAIST_PIVOT_Y), time = GORILLA_FOLD_SETTLE, easing = SINE_EASING) + fold_timer = QDEL_IN_STOPPABLE(src, GORILLA_FOLD_SETTLE) + +/datum/component/gorilla_fold/RegisterWithParent() + RegisterSignals(parent, list(COMSIG_MOVABLE_MOVED, COMSIG_LIVING_SET_BUCKLED, COMSIG_CARBON_LOSE_WOUND, COMSIG_LIVING_REVIVE, COMSIG_LIVING_SET_BODY_POSITION), PROC_REF(unfold)) + +/datum/component/gorilla_fold/UnregisterFromParent() + UnregisterSignal(parent, list(COMSIG_MOVABLE_MOVED, COMSIG_LIVING_SET_BUCKLED, COMSIG_CARBON_LOSE_WOUND, COMSIG_LIVING_REVIVE, COMSIG_LIVING_SET_BODY_POSITION)) + +/datum/component/gorilla_fold/Destroy() + if(fold_timer) + deltimer(fold_timer) + fold_timer = null + QDEL_NULL(rig) + return ..() + +/datum/component/gorilla_fold/proc/unfold(datum/source) + SIGNAL_HANDLER + qdel(src) + +/** + * A body the backbreaker dropped on the bearer's own tile (the tile he faced was blocked), drawn [GORILLA_BACK_IN_FRONT] + * pixels toward the viewer so the one standing over it doesn't hide it. Comes off when it is moved, strapped in or gets up. + * + * It lies where its halves were laid. They turn about the belt, which is under the middle of the picture, so they lie + * that many pixels along toward the head from where tg draws a lying body (turned about its middle): the real body is + * drawn as far along, or it would jump back when the halves come down. + */ +/datum/component/gorilla_laid_in_front + +/// [lay] is 1 for a body lying head east, -1 head west. +/datum/component/gorilla_laid_in_front/Initialize(lay = 1) + if(!isliving(parent)) + return COMPONENT_INCOMPATIBLE + var/mob/living/body = parent + body.add_offsets(GORILLA_LAID_IN_FRONT_OFFSET, x_add = lay * -BACK_WAIST_PIVOT_Y, y_add = -GORILLA_BACK_IN_FRONT, animate = FALSE) + +/datum/component/gorilla_laid_in_front/RegisterWithParent() + RegisterSignals(parent, list(COMSIG_MOVABLE_MOVED, COMSIG_LIVING_SET_BUCKLED, COMSIG_LIVING_SET_BODY_POSITION), PROC_REF(moved_off)) + +/datum/component/gorilla_laid_in_front/UnregisterFromParent() + UnregisterSignal(parent, list(COMSIG_MOVABLE_MOVED, COMSIG_LIVING_SET_BUCKLED, COMSIG_LIVING_SET_BODY_POSITION)) + var/mob/living/body = parent + body.remove_offsets(GORILLA_LAID_IN_FRONT_OFFSET) + +/datum/component/gorilla_laid_in_front/proc/moved_off(datum/source) + SIGNAL_HANDLER + qdel(src) + +#undef BACK_WAIST_PIVOT_Y diff --git a/voidcrew/modules/hyperviolence_gorilla/gorilla_throw.dm b/voidcrew/modules/hyperviolence_gorilla/gorilla_throw.dm index 38e8bdfa5a7..d2b4a5d58a9 100644 --- a/voidcrew/modules/hyperviolence_gorilla/gorilla_throw.dm +++ b/voidcrew/modules/hyperviolence_gorilla/gorilla_throw.dm @@ -511,11 +511,3 @@ name = "blood smear" icon_state = "impact_edge" alpha = 220 - -/** - * Keeps #509's heavy-hit spray and its lost-limb spray off [victim] for the blow being dealt now. A - * finisher lays its own blood; #509's full fan from a held body reads as blood out of nowhere. - */ -/proc/gorilla_hold_spray(mob/living/victim) - victim.hv_blood_spray_until = max(victim.hv_blood_spray_until, world.time + 1) - victim.hv_blood_spray_strength = INFINITY diff --git a/voidcrew/modules/hyperviolence_gorilla/hv_finisher_chrome.dm b/voidcrew/modules/hyperviolence_gorilla/hv_finisher_chrome.dm new file mode 100644 index 00000000000..3783cdc7fdd --- /dev/null +++ b/voidcrew/modules/hyperviolence_gorilla/hv_finisher_chrome.dm @@ -0,0 +1,142 @@ +/** + * # Chrome finishers: #509's finisher engine for a player's bare hands + * + * #509's /datum/hv_finisher was built for bosses with a weapon in hand and NPC factions. A chrome + * finisher (a player's or a boss's own arms) changes four things, and nothing else: + * - No weapon needed: the start and the safety check never ask for one. + * - Anyone can be finished, as with a gun execution: two players share a faction, so the faction test + * only stops an NPC finishing its own side. Players and boss-rank NPCs only (hv_can_execute()). + * - Down means in crit or stunned, never just lying there. A victim whose stun wears off before the + * kill twists free. + * - No red mark over the victim (owner D34): the wind-up is the two bodies. + * - The one doing it can't walk away mid-way: any step lets go. + * + * Kept in its own file so the other chrome finishers (Mantis, monowire) can share it. + */ + +/mob/living + /// The chrome finisher this mob is doing now, if any. + var/datum/hv_finisher/chrome/chrome_finisher + +/datum/hv_finisher/chrome + name = "chrome finisher" + interrupt_damage = GORILLA_FINISHER_INTERRUPT + /// Set when the victim came out of their stun before the kill + var/twisted_free = FALSE + +/datum/hv_finisher/chrome/Destroy() + if(user?.chrome_finisher == src) + user.chrome_finisher = null + return ..() + +/datum/hv_finisher/chrome/start() + . = ..() + if(. && user) + user.chrome_finisher = src + +/datum/hv_finisher/chrome/can_start() + if(QDELETED(user) || user.stat != CONSCIOUS || HAS_TRAIT(user, TRAIT_INCAPACITATED) || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) + return FALSE + if(HAS_TRAIT(user, TRAIT_PACIFISM) || !user_may_finish()) + return FALSE + if(user.chrome_finisher && user.chrome_finisher != src) + return FALSE + if(!chrome_finisher_valid_victim(user, victim)) + return FALSE + return get_dist(user, victim) <= 1 && user.Adjacent(victim) + +/// Who may do this finisher at all. Players and boss-rank NPCs, as with gun executions; a chrome line can route +/// this through its own gate. +/datum/hv_finisher/chrome/proc/user_may_finish() + return user.hv_can_execute() + +/datum/hv_finisher/chrome/safety_check() + if(QDELETED(user) || user.stat != CONSCIOUS || HAS_TRAIT(user, TRAIT_INCAPACITATED)) + return HV_FINISHER_ATTACKER_DOWN + if(QDELETED(victim)) + return HV_FINISHER_VICTIM_GONE + if(!completed && victim.stat == DEAD) + return HV_FINISHER_VICTIM_GONE + if(!isturf(user.loc) || !isturf(victim.loc) || user.z != victim.z || get_dist(user, victim) > 1) + return HV_FINISHER_LOST_GRIP + if(!victim.has_status_effect(/datum/status_effect/hv_finisher_hold)) + return HV_FINISHER_LOST_GRIP + if(completed) + return 0 + if(HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) + return HV_FINISHER_ATTACKER_DOWN + if(gripped && (user.pulling != victim || user.grab_state < GRAB_AGGRESSIVE)) + return HV_FINISHER_LOST_GRIP + if(!chrome_finisher_is_down(victim)) + twisted_free = TRUE + return HV_FINISHER_LOST_GRIP + return 0 + +// The one doing it takes a step, is shoved or is thrown: it lets go. The victim moving is #509's rule. +/datum/hv_finisher/chrome/on_moved(datum/source) + SIGNAL_HANDLER + if(source == user && running) + end_early(HV_FINISHER_LOST_GRIP) + return + return ..() + +/datum/hv_finisher/chrome/interrupt(reason) + if(running && !completed && reason == HV_FINISHER_LOST_GRIP && twisted_free && !QDELETED(victim) && !QDELETED(user)) + for(var/datum/hv_finisher_stage/stage as anything in stages) + if(stage.entered) + stage.on_interrupt() + victim.visible_message(span_danger("[victim] twists free of [user]'s grip!"), span_userdanger("You twist free of [user]'s grip!")) + stop(reason) + return + return ..() + +/datum/hv_finisher/chrome/stop(reason) + if(!running) + return + . = ..() + if(user?.chrome_finisher == src) + user.chrome_finisher = null + // Nothing owns a chrome finisher but its own timers, and its stages point back at it: it has to delete + // itself once it is over, or the pair would hold both bodies forever. + if(!QDELETED(src)) + qdel(src) + +/** + * Whether [user] may start a chrome finisher on [victim]: a humanoid body that is alive, in crit or + * stunned, on the floor beside them, not strapped to anything and not already being finished. A player + * can finish anyone, as with a gun execution; an NPC never finishes its own side. + */ +/proc/chrome_finisher_valid_victim(mob/living/user, mob/living/carbon/victim) + if(!iscarbon(victim) || !isliving(user) || QDELETED(victim) || QDELETED(user) || victim == user) + return FALSE + if(!ishuman(victim) && !(victim.mob_biotypes & MOB_HUMANOID)) + return FALSE + if(victim.stat == DEAD || HAS_TRAIT(victim, TRAIT_GODMODE)) + return FALSE + if(!chrome_finisher_is_down(victim)) + return FALSE + if(victim.has_status_effect(/datum/status_effect/hv_finisher_hold)) + return FALSE + if(victim.buckled || !isturf(victim.loc) || !isturf(user.loc) || victim.z != user.z) + return FALSE + // An NPC (anything run by an AI) never finishes its own side + if(user.ai_controller && user.faction_check_atom(victim)) + return FALSE + return TRUE + +/// Down, for a chrome finisher: in crit, or stunned. Lying there isn't enough. +/proc/chrome_finisher_is_down(mob/living/victim) + return victim.stat >= SOFT_CRIT || HAS_TRAIT(victim, TRAIT_INCAPACITATED) + +/** + * Whether [victim] is square on to [user]: straight north, south, east or west, never on a corner. The + * Gorilla finishers and the Mantis scissor draw both bodies along one straight line, so they only start + * square on; from a corner the click is an ordinary blow and the bearer steps round to finish. + */ +/proc/finisher_square_on(atom/user, atom/victim) + return (get_dir(user, victim) in GLOB.cardinals) + +/// Whether [victim] has ended up on a corner from [user] mid-move: dragged there or the like. The rigs above +/// can't draw that, so it lets go. The same tile is fine (the clap brings the body in). +/proc/finisher_on_corner(atom/user, atom/victim) + return (get_dir(user, victim) in GLOB.diagonals) diff --git a/voidcrew/modules/unit_tests/voidcrew_gorilla_gore.dm b/voidcrew/modules/unit_tests/voidcrew_gorilla_gore.dm index 32db90daa67..ca6bd9819d0 100644 --- a/voidcrew/modules/unit_tests/voidcrew_gorilla_gore.dm +++ b/voidcrew/modules/unit_tests/voidcrew_gorilla_gore.dm @@ -82,6 +82,13 @@ victim.Paralyze(100 SECONDS) return victim +/// Runs a finisher to its end through advance(), as its timer would. +/datum/unit_test/voidcrew_gorilla_gore/proc/run_to_end(datum/hv_finisher/finisher) + for(var/i in 1 to 20) + if(!finisher.running) + return + finisher.advance() + /// Every chrome puppet left anywhere in the test room, and every body's stand-in (what shows until a client has the puppets' pictures) /datum/unit_test/voidcrew_gorilla_gore/proc/puppets_left() . = 0 @@ -825,6 +832,292 @@ var/obj/machinery/door/airlock/plain = allocate(/obj/machinery/door/airlock, spot(0, 1)) TEST_ASSERT(!gorilla_pry_refused(plain), "A plain airlock is refused") +// ========================================================================= +// FINISHERS (owner D39) +// ========================================================================= + +/// Never on someone just lying there or with something in hand; Brawler myomers never clap a head. +/datum/unit_test/voidcrew_gorilla_gore/finisher_gates + +/datum/unit_test/voidcrew_gorilla_gore/finisher_gates/Run() + var/mob/living/carbon/human/bearer = gorilla(spot(0, 0)) + bearer.zone_selected = BODY_ZONE_HEAD + var/mob/living/carbon/human/consistent/resting = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + resting.set_resting(TRUE, instant = TRUE) + TEST_ASSERT(!gorilla_try_finisher(bearer, resting), "A finisher started on someone just lying down") + + var/mob/living/carbon/human/consistent/stunned = downed(spot(0, 1)) + var/obj/item/wrench/tool = allocate(/obj/item/wrench) + bearer.put_in_hands(tool) + TEST_ASSERT(!gorilla_try_finisher(bearer, stunned), "A finisher started with something in hand") + qdel(tool) + + var/mob/living/carbon/human/brawler = gorilla(spot(3, 3), street = TRUE) + brawler.zone_selected = BODY_ZONE_HEAD + var/mob/living/carbon/human/consistent/brawler_victim = downed(spot(4, 3)) + TEST_ASSERT(!gorilla_try_finisher(brawler, brawler_victim), "Brawler myomers started the head clap") + + // The pistons' cooldown blocks it + gorilla_cooldown(bearer, "gorilla_pistons", 20 SECONDS) // COOLDOWN_GORILLA_PISTONS + TEST_ASSERT(!gorilla_try_finisher(bearer, stunned), "A finisher started while the pistons were spent") + +/// The head clap bursts the head, the brain survives, the rig comes down and the pistons are spent. +/datum/unit_test/voidcrew_gorilla_gore/finisher_clap + +/datum/unit_test/voidcrew_gorilla_gore/finisher_clap/Run() + var/mob/living/carbon/human/bearer = gorilla(spot(1, 1)) + bearer.zone_selected = BODY_ZONE_HEAD + var/mob/living/carbon/human/consistent/victim = downed(spot(2, 1)) + TEST_ASSERT(gorilla_try_finisher(bearer, victim), "The head clap didn't start on someone stunned") + var/datum/hv_finisher/chrome/gorilla/clap/finisher = bearer.chrome_finisher + TEST_ASSERT(istype(finisher), "A head aim didn't pick the head clap") + TEST_ASSERT(puppets_left() > 0, "The head clap put up no rig") + run_to_end(finisher) + TEST_ASSERT_NULL(victim.get_bodypart(BODY_ZONE_HEAD), "The head clap didn't burst the head") + TEST_ASSERT_EQUAL(bearer.loc, spot(1, 1), "The burst moved the bearer (a thrown head knocks a body back)") + TEST_ASSERT_EQUAL(victim.loc, spot(1, 1), "The burst body didn't come down on the bearer's tile, where it was held") + var/obj/item/organ/brain/brain + for(var/turf/floor in block(run_loc_floor_bottom_left, run_loc_floor_top_right)) + brain ||= locate(/obj/item/organ/brain) in floor + TEST_ASSERT_NOTNULL(brain, "The burst head lost its brain") + TEST_ASSERT_EQUAL(puppets_left(), 0, "The head clap left puppets behind") + TEST_ASSERT_NULL(bearer.get_filter("chrome_rig_hide"), "The bearer stayed hidden") + TEST_ASSERT_NULL(victim.get_filter("chrome_rig_hide"), "The victim stayed hidden") + TEST_ASSERT_NOTEQUAL(bearer.mouse_opacity, MOUSE_OPACITY_OPAQUE, "The bearer kept the hidden click area") + var/left = S_TIMER_COOLDOWN_TIMELEFT(bearer, "gorilla_pistons") + TEST_ASSERT(left > 10 SECONDS, "A finished clap didn't spend the pistons for long ([left])") + TEST_ASSERT_NULL(bearer.chrome_finisher, "The finished clap is still on the bearer") + TEST_ASSERT(QDELETED(finisher), "A finished clap outlived its end and kept hold of both bodies") + +/// A helmet crumples instead and the skull caves in; the Atlas frame holds. +/datum/unit_test/voidcrew_gorilla_gore/finisher_clap_armour + +/datum/unit_test/voidcrew_gorilla_gore/finisher_clap_armour/Run() + var/mob/living/carbon/human/bearer = gorilla(spot(1, 1)) + bearer.zone_selected = BODY_ZONE_HEAD + var/mob/living/carbon/human/consistent/helmeted = downed(spot(2, 1)) + helmeted.equip_to_slot_or_del(new /obj/item/clothing/head/helmet/swat(helmeted), ITEM_SLOT_HEAD) + var/datum/hv_finisher/chrome/gorilla/clap/finisher = new(bearer, helmeted) + TEST_ASSERT(finisher.start(), "Test fixture: the clap wouldn't start on a helmet") + run_to_end(finisher) + TEST_ASSERT_NOTNULL(helmeted.get_bodypart(BODY_ZONE_HEAD), "A helmet didn't stop the burst") + TEST_ASSERT_NOTNULL(helmeted.get_bodypart(BODY_ZONE_HEAD).get_wound_type(/datum/wound/blunt/bone/critical/hv_skull), "The skull didn't cave in under the helmet") + qdel(finisher) + + var/mob/living/carbon/human/second = gorilla(spot(1, 3)) + second.zone_selected = BODY_ZONE_HEAD + var/mob/living/carbon/human/consistent/framed = downed(spot(2, 3)) + var/obj/item/organ/atlas = allocate(/obj/item/organ/cyberimp/cyberware/atlas) + TEST_ASSERT(atlas.Insert(framed, special = TRUE), "Test fixture: the Atlas frame wouldn't go in") + var/datum/hv_finisher/chrome/gorilla/clap/frame_finisher = new(second, framed) + TEST_ASSERT(frame_finisher.start(), "Test fixture: the clap wouldn't start on the Atlas frame") + run_to_end(frame_finisher) + TEST_ASSERT_NOTNULL(framed.get_bodypart(BODY_ZONE_HEAD), "The Atlas frame's head burst") + qdel(frame_finisher) + +/// The limb rip tears the aimed arm off and leaves it on the victim's tile. +/datum/unit_test/voidcrew_gorilla_gore/finisher_rip + +/datum/unit_test/voidcrew_gorilla_gore/finisher_rip/Run() + var/mob/living/carbon/human/bearer = gorilla(spot(1, 1)) + bearer.zone_selected = BODY_ZONE_L_ARM + var/mob/living/carbon/human/consistent/victim = downed(spot(2, 1)) + // Blood an earlier test left here would keep the tear's own where it is + clear_mess(spot(2, 1)) + TEST_ASSERT(gorilla_try_finisher(bearer, victim), "The limb rip didn't start") + var/datum/hv_finisher/chrome/gorilla/rip/finisher = bearer.chrome_finisher + TEST_ASSERT(istype(finisher), "An arm aim didn't pick the limb rip") + run_to_end(finisher) + TEST_ASSERT_NULL(victim.get_bodypart(BODY_ZONE_L_ARM), "The aimed arm wasn't torn off") + TEST_ASSERT_NOTNULL(victim.get_bodypart(BODY_ZONE_R_ARM), "The wrong arm was torn off") + var/obj/item/bodypart/arm/left/torn = locate() in get_turf(victim) + TEST_ASSERT_NOTNULL(torn, "The torn arm wasn't left on the victim's tile") + TEST_ASSERT_EQUAL(puppets_left(), 0, "The limb rip left puppets behind") + // The blood is the tear's, laid under the shoulder as the arm came off: nothing fresh when the arm is dropped + var/obj/effect/decal/cleanable/blood/pool + for(var/obj/effect/decal/cleanable/blood/found in get_turf(victim)) + if(found.type == /obj/effect/decal/cleanable/blood) + pool = found + TEST_ASSERT_NOTNULL(pool, "The torn shoulder left no blood on the floor") + TEST_ASSERT(pool.base_pixel_x || pool.base_pixel_y, "The torn shoulder's blood was laid on the middle of the tile, off the body held in the grab") + TEST_ASSERT_NULL(locate(/obj/effect/decal/cleanable/blood/splatter) in get_turf(victim), "The dropped arm laid a splash of its own after the wound") + + // Armour on the arm: the shoulder comes out instead + var/mob/living/carbon/human/second = gorilla(spot(1, 3)) + second.zone_selected = BODY_ZONE_R_ARM + var/mob/living/carbon/human/consistent/armoured = downed(spot(2, 3)) + armoured.physiology.armor = armoured.physiology.armor.generate_new_with_modifiers(list(MELEE = 60)) + var/datum/hv_finisher/chrome/gorilla/rip/armoured_rip = new(second, armoured) + armoured_rip.aimed_zone = BODY_ZONE_R_ARM + TEST_ASSERT(armoured_rip.start(), "Test fixture: the rip wouldn't start on armour") + run_to_end(armoured_rip) + TEST_ASSERT_NOTNULL(armoured.get_bodypart(BODY_ZONE_R_ARM), "An armoured arm was torn off") + TEST_ASSERT_NOTNULL(armoured.get_bodypart(BODY_ZONE_R_ARM).get_wound_type(/datum/wound/blunt/bone/moderate), "An armoured arm didn't dislocate") + qdel(armoured_rip) + +/// The backbreaker breaks the back (they can't stand) and shoves the body onto the tile the bearer faces, or drops it +/// at his feet if that tile is blocked; the fold comes off when the body is moved. +/datum/unit_test/voidcrew_gorilla_gore/finisher_backbreaker + +/datum/unit_test/voidcrew_gorilla_gore/finisher_backbreaker/Run() + var/mob/living/carbon/human/bearer = gorilla(spot(1, 1)) + bearer.zone_selected = BODY_ZONE_CHEST + var/mob/living/carbon/human/consistent/victim = downed(spot(2, 1)) + TEST_ASSERT(gorilla_try_finisher(bearer, victim), "The backbreaker didn't start") + var/datum/hv_finisher/chrome/gorilla/backbreaker/finisher = bearer.chrome_finisher + TEST_ASSERT(istype(finisher), "A chest aim didn't pick the backbreaker") + // Whatever blood earlier tests left where the body is broken and where it comes down + clear_mess(spot(1, 1)) + clear_mess(spot(2, 1)) + run_to_end(finisher) + TEST_ASSERT_NULL(locate(/obj/effect/decal/cleanable/blood) in spot(1, 1), "The backbreaker laid blood of its own at the knee") + TEST_ASSERT_NULL(locate(/obj/effect/decal/cleanable/blood) in spot(2, 1), "The backbreaker laid blood of its own where the body landed") + var/obj/item/bodypart/chest = victim.get_bodypart(BODY_ZONE_CHEST) + var/datum/wound/spine = chest.get_wound_type(/datum/wound/blunt/bone/critical/gorilla_spine) + TEST_ASSERT_NOTNULL(spine, "The back didn't break") + TEST_ASSERT(HAS_TRAIT_FROM(victim, TRAIT_FLOORED, REF(spine)), "A broken back can still stand") + TEST_ASSERT_EQUAL(bearer.loc, spot(1, 1), "The backbreaker moved the bearer") + TEST_ASSERT_EQUAL(victim.loc, spot(2, 1), "The body wasn't shoved off the knee onto the tile the bearer faces") + TEST_ASSERT_EQUAL(victim.lying_angle, LYING_ANGLE_EAST, "The body lies the other way from its bent halves, so it flips when they come down") + TEST_ASSERT_NOTNULL(victim.GetComponent(/datum/component/gorilla_fold), "The broken back isn't drawn bent") + TEST_ASSERT_NOTNULL(victim.get_filter("chrome_rig_hide"), "The bent body isn't the one shown") + TEST_ASSERT_NULL(victim.GetComponent(/datum/component/gorilla_laid_in_front), "A body shoved clear of the bearer is drawn off its tile") + victim.forceMove(spot(3, 3)) + TEST_ASSERT_NULL(victim.GetComponent(/datum/component/gorilla_fold), "The fold stayed on a moved body") + TEST_ASSERT_NULL(victim.get_filter("chrome_rig_hide"), "A moved body stayed hidden") + TEST_ASSERT_EQUAL(puppets_left(), 0, "The fold left puppets behind") + var/spine_ref = REF(spine) + spine.remove_wound() + TEST_ASSERT(!HAS_TRAIT_FROM(victim, TRAIT_FLOORED, spine_ref), "A set back still can't stand") + + // Something solid on the tile he faces: the body comes down at his feet, drawn in front of him + var/mob/living/carbon/human/second = gorilla(spot(1, 3)) + second.zone_selected = BODY_ZONE_CHEST + var/mob/living/carbon/human/consistent/boxed_in = downed(spot(2, 3)) + allocate(/obj/structure/closet/crate, spot(2, 3)) + var/datum/hv_finisher/chrome/gorilla/backbreaker/blocked = new(second, boxed_in) + TEST_ASSERT(blocked.start(), "Test fixture: the backbreaker wouldn't start beside a crate") + run_to_end(blocked) + TEST_ASSERT_EQUAL(boxed_in.loc, spot(1, 3), "With the tile ahead blocked the body didn't come down at the bearer's feet") + TEST_ASSERT_NOTNULL(boxed_in.GetComponent(/datum/component/gorilla_laid_in_front), "The body at his feet isn't drawn in front of the bearer standing over it") + boxed_in.forceMove(spot(3, 3)) + TEST_ASSERT_NULL(boxed_in.GetComponent(/datum/component/gorilla_laid_in_front), "A moved body is still drawn off its tile") + TEST_ASSERT_EQUAL(puppets_left(), 0, "The fold at his feet left puppets behind") + +/// Damage on the bearer, the bearer moving, or the victim coming out of the stun stops it, with the +/// shorter cooldown, and nothing is left hidden or posed. +/datum/unit_test/voidcrew_gorilla_gore/finisher_interrupts + +/datum/unit_test/voidcrew_gorilla_gore/finisher_interrupts/Run() + // Hit hard enough: lets go + var/mob/living/carbon/human/bearer = gorilla(spot(1, 1)) + bearer.zone_selected = BODY_ZONE_CHEST + var/mob/living/carbon/human/consistent/victim = downed(spot(2, 1)) + TEST_ASSERT(gorilla_try_finisher(bearer, victim), "Test fixture: no finisher") + var/datum/hv_finisher/chrome/gorilla/finisher = bearer.chrome_finisher + finisher.advance() + bearer.apply_damage(15, BRUTE, BODY_ZONE_CHEST) + TEST_ASSERT(!finisher.running, "Damage on the bearer didn't stop the finisher") + TEST_ASSERT(QDELETED(finisher), "A stopped finisher outlived its end") + TEST_ASSERT_EQUAL(finisher.result, 3, "Damage stopped it for the wrong reason") // HV_FINISHER_DAMAGED + TEST_ASSERT_EQUAL(puppets_left(), 0, "A stopped finisher left puppets") + TEST_ASSERT_NULL(victim.get_filter("chrome_rig_hide"), "A stopped finisher left the victim hidden") + TEST_ASSERT_NULL(bearer.get_filter("chrome_rig_hide"), "A stopped finisher left the bearer hidden") + var/left = S_TIMER_COOLDOWN_TIMELEFT(bearer, "gorilla_pistons") + TEST_ASSERT(left > 0 && left <= 10 SECONDS, "A stopped finisher cost the wrong cooldown ([left])") // GORILLA_PISTONS_INTERRUPTED + TEST_ASSERT_NOTNULL(victim.get_bodypart(BODY_ZONE_CHEST), "Test fixture: no chest") + TEST_ASSERT_NULL(victim.get_bodypart(BODY_ZONE_CHEST).get_wound_type(/datum/wound/blunt/bone/critical/gorilla_spine), "A stopped backbreaker still broke the back") + + // The bearer steps away: lets go + var/mob/living/carbon/human/walker = gorilla(spot(1, 3)) + walker.zone_selected = BODY_ZONE_HEAD + var/mob/living/carbon/human/consistent/walk_victim = downed(spot(2, 3)) + TEST_ASSERT(gorilla_try_finisher(walker, walk_victim), "Test fixture: no second finisher") + var/datum/hv_finisher/chrome/gorilla/walk_finisher = walker.chrome_finisher + walker.forceMove(spot(0, 3)) + TEST_ASSERT(!walk_finisher.running, "The bearer walked off mid-finisher") + TEST_ASSERT_NOTNULL(walk_victim.get_bodypart(BODY_ZONE_HEAD), "A walked-off clap still burst the head") + + // The victim comes out of the stun before the kill: twists free + var/mob/living/carbon/human/third = gorilla(spot(3, 0)) + third.zone_selected = BODY_ZONE_HEAD + var/mob/living/carbon/human/consistent/waking = downed(spot(4, 0)) + TEST_ASSERT(gorilla_try_finisher(third, waking), "Test fixture: no third finisher") + var/datum/hv_finisher/chrome/gorilla/wake_finisher = third.chrome_finisher + waking.SetAllImmobility(0) + wake_finisher.tick() + TEST_ASSERT(!wake_finisher.running, "A victim out of the stun didn't twist free") + TEST_ASSERT_NOTNULL(waking.get_bodypart(BODY_ZONE_HEAD), "A victim who twisted free lost the head") + TEST_ASSERT_EQUAL(puppets_left(), 0, "Twisting free left puppets") + +/// From a corner the punch is only a punch: the finisher starts square on. A body dragged onto a corner mid-move lets go. +/datum/unit_test/voidcrew_gorilla_gore/finisher_square_on + +/datum/unit_test/voidcrew_gorilla_gore/finisher_square_on/Run() + var/mob/living/carbon/human/bearer = gorilla(spot(1, 1)) + bearer.zone_selected = BODY_ZONE_CHEST + var/mob/living/carbon/human/consistent/victim = downed(spot(2, 2)) + var/hurt_before = victim.getBruteLoss() + TEST_ASSERT_EQUAL(punch(bearer, victim), COMPONENT_CANCEL_ATTACK_CHAIN, "The Gorilla arm didn't take the corner punch") + TEST_ASSERT_NULL(bearer.chrome_finisher, "A finisher started on someone on a corner") + TEST_ASSERT(!victim.has_status_effect(/datum/status_effect/hv_finisher_hold), "Someone on a corner was held for a finisher") + // The blow lands when the fist is there: 0.1 s (GORILLA_THRUST_LANDS) + sleep(0.3 SECONDS) + TEST_ASSERT(victim.getBruteLoss() > hurt_before, "The corner punch did no damage") + for(var/zone in list(BODY_ZONE_HEAD, BODY_ZONE_R_ARM)) + bearer.zone_selected = zone + TEST_ASSERT(!gorilla_try_finisher(bearer, victim), "A [zone] finisher started on someone on a corner") + + // Square on, the same punch starts it + victim.forceMove(spot(2, 1)) + bearer.zone_selected = BODY_ZONE_CHEST + punch(bearer, victim) + var/datum/hv_finisher/chrome/gorilla/backbreaker/finisher = bearer.chrome_finisher + TEST_ASSERT(istype(finisher) && finisher.running, "The backbreaker didn't start square on") + + // Dragged onto a corner before the kill: lets go + finisher.advance() + victim.forceMove(spot(2, 2)) + TEST_ASSERT(QDELETED(finisher) || !finisher.running, "The backbreaker went on with the body on a corner") + TEST_ASSERT_NULL(bearer.chrome_finisher, "The bearer is still finishing a body on a corner") + TEST_ASSERT_EQUAL(puppets_left(), 0, "A finisher stopped on a corner left puppets") + TEST_ASSERT_NULL(victim.get_filter("chrome_rig_hide"), "A finisher stopped on a corner left the victim hidden") + +/// Each new move can be started without a mouse or an aimed zone, for an AI later. +/datum/unit_test/voidcrew_gorilla_gore/ai_entry_points + +/datum/unit_test/voidcrew_gorilla_gore/ai_entry_points/Run() + // The haymaker: the same wind-up, then the hit + var/mob/living/carbon/human/bearer = gorilla(spot(0, 0)) + var/mob/living/carbon/human/consistent/victim = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + var/hurt_before = victim.getBruteLoss() + TEST_ASSERT(gorilla_try_haymaker(bearer, victim, 0.8 SECONDS), "The haymaker couldn't be started without a click") + TEST_ASSERT_NOTNULL(bearer.has_status_effect(/datum/status_effect/gorilla_windup), "An AI haymaker skipped the wind-up") + sleep(1.5 SECONDS) + TEST_ASSERT(victim.getBruteLoss() > hurt_before, "An AI haymaker never landed") + TEST_ASSERT(!TIMER_COOLDOWN_FINISHED(bearer, "gorilla_pistons"), "An AI haymaker didn't spend the pistons") // COOLDOWN_GORILLA_PISTONS + + // The ground pound + var/mob/living/carbon/human/pounder = gorilla(spot(2, 4)) + TEST_ASSERT(gorilla_try_pound(pounder), "The ground pound couldn't be started without the chip") + TEST_ASSERT(!TIMER_COOLDOWN_FINISHED(pounder, "gorilla_pound"), "An AI pound didn't start its cooldown") // COOLDOWN_GORILLA_POUND + + // A finisher by zone, whatever the bearer aims at + var/mob/living/carbon/human/finisher_bearer = gorilla(spot(0, 2)) + finisher_bearer.zone_selected = BODY_ZONE_HEAD + var/mob/living/carbon/human/consistent/downed_victim = downed(spot(1, 2)) + TEST_ASSERT(gorilla_try_finisher(finisher_bearer, downed_victim, BODY_ZONE_CHEST), "A finisher couldn't be started by zone") + TEST_ASSERT(istype(finisher_bearer.chrome_finisher, /datum/hv_finisher/chrome/gorilla/backbreaker), "The zone given didn't pick the finisher") + run_to_end(finisher_bearer.chrome_finisher) + + // The slam, clear of row 0: the haymaker above knocks its victim along it, onto the tiles used here before + var/mob/living/carbon/human/slammer = gorilla(spot(3, 2)) + var/mob/living/carbon/human/consistent/held = allocate(/mob/living/carbon/human/consistent, spot(4, 2)) + held.grabbedby(slammer, supress_message = TRUE) + held.grabbedby(slammer, supress_message = TRUE) + slammer.swap_hand(2, silent = TRUE) + TEST_ASSERT(gorilla_try_slam(slammer, get_turf(held)), "The slam couldn't be started without a click") + // ========================================================================= // BRAWLER MYOMERS (owner D49): the street slam, the light pound, the rip, doors // ========================================================================= @@ -937,6 +1230,44 @@ sleep(0.1 SECONDS) TEST_ASSERT(QDELETED(pound) || pound.owner != brawler, "The Brawler pound outlived the pair") +/// The synced Brawler pair's only finisher is the limb rip, on the same terms as the Gorilla's. A mixed pair has none. +/datum/unit_test/voidcrew_gorilla_gore/brawler_rip + +/datum/unit_test/voidcrew_gorilla_gore/brawler_rip/Run() + var/mob/living/carbon/human/brawler = gorilla(spot(1, 1), street = TRUE) + var/mob/living/carbon/human/consistent/victim = downed(spot(2, 1)) + brawler.zone_selected = BODY_ZONE_HEAD + TEST_ASSERT(!gorilla_try_finisher(brawler, victim), "Brawler myomers started the head clap") + brawler.zone_selected = BODY_ZONE_CHEST + TEST_ASSERT(!gorilla_try_finisher(brawler, victim), "Brawler myomers started the backbreaker") + brawler.zone_selected = BODY_ZONE_L_ARM + TEST_ASSERT(gorilla_try_finisher(brawler, victim), "The Brawler limb rip didn't start") + var/datum/hv_finisher/chrome/gorilla/rip/finisher = brawler.chrome_finisher + TEST_ASSERT(istype(finisher), "An arm aim didn't pick the limb rip for a Brawler") + run_to_end(finisher) + TEST_ASSERT_NULL(victim.get_bodypart(BODY_ZONE_L_ARM), "The Brawler rip didn't tear the aimed arm off") + TEST_ASSERT_NOTNULL(victim.get_bodypart(BODY_ZONE_R_ARM), "The Brawler rip tore the wrong arm off") + TEST_ASSERT_EQUAL(puppets_left(), 0, "The Brawler rip left puppets behind") + TEST_ASSERT(!TIMER_COOLDOWN_FINISHED(brawler, "gorilla_pistons"), "The Brawler rip didn't spend the pistons") // COOLDOWN_GORILLA_PISTONS + + // Not someone just lying there + var/mob/living/carbon/human/second = gorilla(spot(1, 3), street = TRUE) + second.zone_selected = BODY_ZONE_R_ARM + var/mob/living/carbon/human/consistent/resting = allocate(/mob/living/carbon/human/consistent, spot(2, 3)) + resting.set_resting(TRUE, instant = TRUE) + TEST_ASSERT(!gorilla_try_finisher(second, resting), "The Brawler rip started on someone just lying down") + + // A mixed pair rips nothing + var/mob/living/carbon/human/consistent/mixed = allocate(/mob/living/carbon/human/consistent, spot(4, 1)) + var/obj/item/organ/real = allocate(/obj/item/organ/cyberimp/cyberware/gorilla_arms) + var/obj/item/organ/street = allocate(/obj/item/organ/cyberimp/cyberware/gorilla_arms/street/left) + TEST_ASSERT(real.Insert(mixed, special = TRUE), "Test fixture: the real arm wouldn't go in") + TEST_ASSERT(street.Insert(mixed, special = TRUE), "Test fixture: the Brawler arm wouldn't go in") + mixed.set_combat_mode(TRUE) + mixed.zone_selected = BODY_ZONE_L_ARM + var/mob/living/carbon/human/consistent/mixed_victim = downed(spot(4, 2)) + TEST_ASSERT(!gorilla_try_finisher(mixed, mixed_victim), "A mixed pair started the limb rip") + /// Brawler punches dent plain and reinforced airlocks, less than the Gorilla's; the synced pair forces a /// powered one slower than the Gorilla; a trader outpost's door takes neither. /datum/unit_test/voidcrew_gorilla_gore/brawler_doors From caac8910b61cd4150d1d24ae09fbac8b70696672 Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Sun, 15 Nov 2026 18:02:08 -0800 Subject: [PATCH 11/29] Traders pay for rare goods Outpost traders pay for what a crew sells by how rare it is, and the best goods earn trade vouchers. Wherever a trader paid one flat price for any of something, rare goods have their own, higher price: Dram's mixed drinks, Sawbones' organs, Splice's and the street doc's found chrome, Sarge's weapons and armor, Boffin's extracts and anomaly cores, Wick's MODsuits and modules, Fern's prize crops, Pike's trophy fish and Roux's specialty dishes. Each trader takes only a few of each voucher item a round, shared by every crew, and voucher items do not restock with the convoy. Traders won't buy back anything bought from a trader or ordered from cargo, a ship's starting gear sells only at the salvage price, and printed organs, spent extracts and worn suits aren't accepted. --- tgstation.dme | 1 + .../modules/cyberware/ripperdoc_catalog.dm | 127 +++++- .../modules/cyberware/street_doc_catalog.dm | 12 + voidcrew/modules/trade/buyback_listed.dm | 123 ++++++ voidcrew/modules/trade/shop.dm | 7 +- voidcrew/modules/trade/shop_buyback.dm | 11 +- .../shop_catalog_black_market_vendors.dm | 174 +++++++- voidcrew/modules/trade/shop_catalog_diner.dm | 125 +++++- .../modules/trade/shop_catalog_general.dm | 32 ++ .../trade/shop_catalog_general_vendors.dm | 236 ++++++++++- .../modules/trade/shop_catalog_outfitter.dm | 262 +++++++++++- .../trade/shop_catalog_outfitter_vendors.dm | 287 ++++++++++++- .../modules/trade/shop_catalog_suit_vendor.dm | 392 +++++++++++++++++- voidcrew/modules/unit_tests/_unit_tests.dm | 3 + .../unit_tests/voidcrew_buyback_barnaby.dm | 123 ++++++ .../unit_tests/voidcrew_buyback_depot.dm | 162 ++++++++ .../unit_tests/voidcrew_buyback_vex.dm | 116 ++++++ .../modules/unit_tests/voidcrew_cyberware.dm | 8 +- .../unit_tests/voidcrew_cyberware_npcs.dm | 4 +- .../modules/unit_tests/voidcrew_resale.dm | 2 +- 20 files changed, 2145 insertions(+), 62 deletions(-) create mode 100644 voidcrew/modules/trade/buyback_listed.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_buyback_barnaby.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_buyback_depot.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_buyback_vex.dm diff --git a/tgstation.dme b/tgstation.dme index b3c058773a1..d282964d576 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -7809,6 +7809,7 @@ #include "voidcrew\modules\throwing\diagnostics.dm" #include "voidcrew\modules\trade\anomaly_charts.dm" #include "voidcrew\modules\trade\bag_rift_protection.dm" +#include "voidcrew\modules\trade\buyback_listed.dm" #include "voidcrew\modules\trade\modsuit_bench.dm" #include "voidcrew\modules\trade\outpost.dm" #include "voidcrew\modules\trade\outpost_amenities.dm" diff --git a/voidcrew/modules/cyberware/ripperdoc_catalog.dm b/voidcrew/modules/cyberware/ripperdoc_catalog.dm index 97f29aa17c1..fb69e6550ec 100644 --- a/voidcrew/modules/cyberware/ripperdoc_catalog.dm +++ b/voidcrew/modules/cyberware/ripperdoc_catalog.dm @@ -10,8 +10,10 @@ * ware, vouchers gate everything that changes how you fight. Splice's intake * ledger buys back every piece he sells for credits (owner D7), at half list, * credits only, so climbing a slot ladder feels like climbing and never becomes - * an arbitrage loop (voucher chrome is never bought back, and a removed piece - * resold at 50% is always a loss). + * an arbitrage loop (voucher chrome bought at a counter is never bought back, + * and a removed piece resold at 50% is always a loss). Found chrome with no + * trade-in row (voucher-shelf pieces and loot-only ones) sells on four price + * bands instead, which refuse anything bought at a counter. * * Splice is not the only source any more. The roster also rides the zone loot * tables (modules/loot/themes/) at the tier that matches what he charges for @@ -186,7 +188,12 @@ /datum/shop_buyback/ripperdoc/cargo_cavity, /datum/shop_buyback/ripperdoc/gastro, /datum/shop_buyback/ripperdoc/chromatic_dermis, - /datum/shop_buyback/ripperdoc/burnt_chrome, + /datum/shop_buyback/burnt_chrome, + // Found chrome that has no trade-in row, by price band. + /datum/shop_buyback/found_chrome/fitted, + /datum/shop_buyback/found_chrome/pro, + /datum/shop_buyback/found_chrome/military, + /datum/shop_buyback/found_chrome/legend, ) trader_lines = list( TRADER_LINE_GREETING = list( @@ -738,9 +745,10 @@ /** * Dead chrome off a dead (or opened-up) human NPC (/obj/item/burnt_chrome, human_npc.dm). Scrap money only: * 50 cr is a fifth of the cheapest piece Splice sells for credits, so burning out bought chrome in a captive - * to sell the husk is always a loss, and the round's demand caps it. + * to sell the husk is always a loss, and the round's demand caps it. Not a ripperdoc trade-in row: those + * buy back shelf stock, and no shelf sells burnt chrome. */ -/datum/shop_buyback/ripperdoc/burnt_chrome +/datum/shop_buyback/burnt_chrome name = "Burnt-out chrome" desc = "Dead implants. Splice strips them for the parts that didn't melt." category = "Scrap" @@ -748,3 +756,112 @@ pay_credits = 50 demand_min = 4 demand_max = 8 + +/datum/shop_buyback/burnt_chrome/street_doc + desc = "Dead implants. Ratchet melts them down for the metal." + +// ========================================================================= +// FOUND CHROME: the pieces no trade-in row takes +// Voucher-shelf chrome and loot-only chrome, out of caches or off the dead. +// Priced by band against the shelf: 1-voucher pieces pay 400 cr, 2-voucher +// pieces 900 cr (a paired arm counts as half its pair), 3-voucher and dearer +// pieces 1 voucher, the loot-only Piledriver 2. Each band names exact types, +// none of which any trade-in row matches, so no piece fits two rows. +// +// Not a /datum/shop_buyback/ripperdoc subtype on purpose: those take shop +// stock and pay credits only (voidcrew_ripperdoc_resale pins that). These +// refuse anything bought at a counter, so a voucher payout here only ever +// buys chrome nobody paid a shop for. +// ========================================================================= + +/datum/shop_buyback/found_chrome + category = "Found Chrome" + item_path = /obj/item/organ + icon_override = 'voidcrew/modules/cyberware/icons/cyberware.dmi' + /// Exact chrome types this band pays for + var/list/wanted_chrome + +/datum/shop_buyback/found_chrome/buyback_wanted_kind(obj/item/offered) + return (offered.type in wanted_chrome) && !shop_buyback_inside_body(offered) + +/datum/shop_buyback/found_chrome/matches(obj/item/offered) + if(!..() || !(offered.type in wanted_chrome)) + return FALSE + var/obj/item/organ/ware = offered + return !(ware.organ_flags & ORGAN_FAILING) + +/// The stock refusal keys off item_path, which here is every organ (buyback_listed.dm). +/datum/shop_buyback/found_chrome/get_denial_reason(mob/living/user) + return buyback_listed_denial(src, user) + +/datum/shop_buyback/found_chrome/fitted + name = "fitted chrome" + desc = "Icepicks, sonar, field optics, grave hooks. Clean them up and they sell again." + icon_state_override = "icepick" + wanted_chrome = list( + /obj/item/organ/cyberimp/arm/toolkit/cyberware/icepick, + /obj/item/organ/cyberimp/cyberware/doppler, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/graverobber, + /obj/item/organ/eyes/robotic/cyberware/prospector, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/skyhook, + ) + pay_credits = 400 + demand_min = 2 + demand_max = 3 + +/datum/shop_buyback/found_chrome/pro + name = "pro chrome" + desc = "Combat optics, reflex wiring, one arm of a matched pair. Splice knows who's shopping." + icon_state_override = "mantis" + wanted_chrome = list( + /obj/item/organ/eyes/robotic/cyberware/deadeye, + /obj/item/organ/cyberimp/cyberware/slipwire, + /obj/item/organ/cyberimp/cyberware/dead_channel, + /obj/item/organ/cyberimp/cyberware/atlas, + /obj/item/organ/cyberimp/cyberware/gorilla_arms, + /obj/item/organ/cyberimp/cyberware/gorilla_arms/left, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/left, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/scorch, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/scorch/left, + ) + pay_credits = 900 + demand_min = 1 + demand_max = 3 + +/datum/shop_buyback/found_chrome/military + name = "military chrome" + desc = "Monowire, gun arms, slab plating, milspec builds. The big names too, if they still work." + icon_state_override = "ronin" + wanted_chrome = list( + /obj/item/organ/cyberimp/arm/toolkit/cyberware/monowire, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/monowire/live, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/bunker_buster, + /obj/item/organ/cyberimp/cyberware/rigger, + /obj/item/organ/cyberimp/cyberware/slabskin, + /obj/item/organ/cyberimp/cyberware/ghostskin, + /obj/item/organ/cyberimp/cyberware/lazarus, + /obj/item/organ/eyes/robotic/cyberware/lookout, + /obj/item/organ/eyes/robotic/cyberware/deadeye/milspec, + /obj/item/organ/cyberimp/cyberware/slipwire/milspec, + /obj/item/organ/cyberimp/cyberware/hopper/milspec, + /obj/item/organ/cyberimp/cyberware/governor_delete/milspec, + /obj/item/organ/cyberimp/cyberware/redline/milspec, + /obj/item/organ/cyberimp/cyberware/cascade/milspec, + /obj/item/organ/cyberimp/cyberware/governor_delete, + /obj/item/organ/cyberimp/cyberware/redline, + /obj/item/organ/cyberimp/cyberware/cascade, + ) + pay_vouchers = 1 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/found_chrome/legend + name = "Piledriver" + desc = "Splice has never had one on the bench. He'd like to." + icon_state_override = "piledriver" + wanted_chrome = list(/obj/item/organ/cyberimp/cyberware/piledriver) + pay_vouchers = 2 + demand_min = 1 + demand_max = 1 diff --git a/voidcrew/modules/cyberware/street_doc_catalog.dm b/voidcrew/modules/cyberware/street_doc_catalog.dm index 2e71f2e7aff..fbad68fc114 100644 --- a/voidcrew/modules/cyberware/street_doc_catalog.dm +++ b/voidcrew/modules/cyberware/street_doc_catalog.dm @@ -20,6 +20,8 @@ * (subtypes of Splice's buybacks, with his own wording). Like Splice's, and * unlike every other ledger, it takes chrome bought at a counter and pulled * again (buys_shop_stock on /datum/shop_buyback/ripperdoc, ripperdoc_catalog.dm). + * Of Splice's found-chrome bands he runs only the two that pay credits: his + * counter never deals in vouchers either way. * * Catalog and NPC only: the organs live in ware_*.dm, the cradle in * chrome_cradle.dm, the room on the Quartermain map @@ -105,6 +107,7 @@ // CYBERWARE LINES: T2 SKUS END ) buyback_types = list( + /datum/shop_buyback/burnt_chrome/street_doc, /datum/shop_buyback/ripperdoc/nightshade/street_doc, /datum/shop_buyback/ripperdoc/shock_coils/street_doc, /datum/shop_buyback/ripperdoc/second_wind/street_doc, @@ -151,6 +154,9 @@ /datum/shop_buyback/ripperdoc/cargo_cavity/street_doc, /datum/shop_buyback/ripperdoc/gastro/street_doc, /datum/shop_buyback/ripperdoc/chromatic_dermis/street_doc, + // Found chrome with no trade-in row, on Splice's credit bands only. + /datum/shop_buyback/found_chrome/fitted/street_doc, + /datum/shop_buyback/found_chrome/pro/street_doc, ) trader_lines = list( TRADER_LINE_GREETING = list( @@ -264,6 +270,12 @@ /datum/shop_buyback/ripperdoc/chromatic_dermis/street_doc desc = "Old circuit ink." +/datum/shop_buyback/found_chrome/fitted/street_doc + desc = "Tool arms and field optics, pulled. He'll find them a new home." + +/datum/shop_buyback/found_chrome/pro/street_doc + desc = "Combat chrome, pulled. One blade or one fist is fine." + // ========================================================================= // THE NPC // ========================================================================= diff --git a/voidcrew/modules/trade/buyback_listed.dm b/voidcrew/modules/trade/buyback_listed.dm new file mode 100644 index 00000000000..b00b471edb0 --- /dev/null +++ b/voidcrew/modules/trade/buyback_listed.dm @@ -0,0 +1,123 @@ +/** + * # Listed buybacks: shared helpers for ledger rows that name their goods + * + * Most buyback rows take "any X". The depot's rare-goods rows instead take a + * fixed list of exact types (a red-zone rifle, one theme of MODsuit), so a toy + * or printed subtype of the same parent never reaches a voucher payout. These + * procs are shared by the outfitter, Skunkworks and Fitting Bay ledgers + * (shop_catalog_outfitter*.dm, shop_catalog_suit_vendor.dm). + * + * Two extra refusals ride along: + * - Loose goods only. The seller's contents sweep reaches inside everything, + * so a slime extract cycling inside a recurring crossbreed, or an anomaly + * core seated in a MOD module, would otherwise be ripped out and sold. + * - Ship's issue. Gear mapped aboard a player hull when it loads is part of + * what the crew bought with the ship, not a find. It is flagged here and the + * rare rows refuse it; the plain salvage rows still take it as before. + */ + +/obj/item + /// Mapped aboard a player hull at load (see check_buyback_hull_issue()). Rare buyback rows refuse it. + var/buyback_hull_issue = FALSE + +/// Item roots the rare rows buy from. Only these get the hull check, which keeps it off the hot path. +GLOBAL_LIST_INIT(buyback_hull_watch, typecacheof(list( + /obj/item/gun, + /obj/item/melee, + /obj/item/claymore, + /obj/item/katana, + /obj/item/cursed_katana, + /obj/item/energy_katana, + /obj/item/mjollnir, + /obj/item/spear, + /obj/item/shield, + /obj/item/cain_and_abel, + /obj/item/cane/shepherds_crook, + /obj/item/garrison_standard, + /obj/item/heave_ho, + /obj/item/hierophant_club, + /obj/item/knife/understudy, + /obj/item/lava_staff, + /obj/item/veilrender, + /obj/item/clothing/suit, + /obj/item/clothing/head, + /obj/item/mod/control, + /obj/item/mod/module, +))) + +/obj/item/Initialize(mapload) + . = ..() + if(mapload && GLOB.buyback_hull_watch[type]) + check_buyback_hull_issue() + +/** + * Flags gear that loads with a player hull. A player ship loads with + * SSshuttle.loading_ship (or a shipyard order) set; its upgrade modules load + * a moment later, by which time the hull's areas know their port and ship. + * NPC hulls use the same maps, but their loot is a find, so they stay clear. + */ +/obj/item/proc/check_buyback_hull_issue() + var/area/shuttle/voidcrew/hull_area = get_area(src) + if(!istype(hull_area)) + return + var/obj/structure/overmap/ship/hull_ship = SSshuttle.loading_ship || hull_area.shuttle_port?.current_ship + if(!hull_ship) + if(SSshuttle.loading_order) + buyback_hull_issue = TRUE + return + if(istype(hull_ship, /obj/structure/overmap/ship/npc)) + return + buyback_hull_issue = TRUE + +/// Carried loose: in hand, a pocket or slot, or a bag. Not seated inside some other device. +/proc/buyback_goods_loose(obj/item/offered) + var/atom/holder = offered.loc + if(ismob(holder)) + return TRUE + return !isnull(holder?.atom_storage) && !istype(holder, /obj/item/mod/control) + +/// Exact-type cache for a listed row. +/proc/buyback_exact_cache(list/types) + return typecacheof(types, only_root_path = TRUE) + +/// Shows a listed row with its display item's sprite. +/proc/buyback_use_display_icon(datum/shop_buyback/entry, obj/item/display_path) + if(!ispath(display_path)) + return + entry.icon_override = initial(display_path.icon) + entry.icon_state_override = initial(display_path.icon_state) + +/// Whether an item is this row's kind of goods, ignoring who owns it or where it sits. Listed rows override. +/datum/shop_buyback/proc/buyback_wanted_kind(obj/item/offered) + return istype(offered, item_path) + +/** + * Refusal text for a listed row. The stock one keys off item_path, which a + * listed row sets to a broad parent, so it named unrelated shop stock. + */ +/proc/buyback_listed_denial(datum/shop_buyback/entry, mob/living/user) + if(entry.demand <= 0) + return "Not buying any more this shift." + if(entry.count_carried_units(user) < 1) + for(var/obj/item/offered in user.get_all_contents()) + if(!entry.buyback_wanted_kind(offered)) + continue + if(is_trader_good(offered)) + return "I don't buy back shop stock." + if(offered.buyback_hull_issue) + return "That's your ship's own kit." + return "Carrying none of the goods: [entry.get_wanted_text()]." + if(entry.pay_credits > 0 && !get_shop_buyback_account(user)) + return "No bank account on your ID." + return null + +/** + * A core refined from a bought raw core is still the trader's stock. Without + * this, a raw core off Boffin's shelf came out of the refinery as a clean + * object and could go straight back over his counter. + */ +/obj/item/raw_anomaly_core/create_core(newloc, del_self = FALSE, count_towards_limit = FALSE) + var/from_trader = is_trader_good(src) + . = ..() + if(from_trader && .) + mark_trader_goods(.) diff --git a/voidcrew/modules/trade/shop.dm b/voidcrew/modules/trade/shop.dm index e08a0600377..fd78a978987 100644 --- a/voidcrew/modules/trade/shop.dm +++ b/voidcrew/modules/trade/shop.dm @@ -230,7 +230,7 @@ /** * The supply convoy came through: tops core stock back up, swaps one sold-out * rotating slot for a fresh pool pick, rerolls the special and softens the - * buyback demand caps. Driven by the outpost's restock timer. + * credit buyback demand caps. Driven by the outpost's restock timer. */ /datum/outpost_shop/proc/convoy_restock() // Core shelves creep back toward full @@ -273,8 +273,11 @@ sku.discount_pct = initial(sku.discount_pct) roll_special() - // The trader found room in the warehouse for a bit more of everything + // The trader found room in the warehouse for a bit more of everything. + // Voucher rows keep their round-start roll: that roll is the round's whole supply. for(var/datum/shop_buyback/buyback as anything in buybacks) + if(buyback.pay_vouchers > 0) + continue if(buyback.demand < buyback.demand_max) buyback.demand = min(buyback.demand_max, buyback.demand + max(1, round(buyback.demand_max / 2))) diff --git a/voidcrew/modules/trade/shop_buyback.dm b/voidcrew/modules/trade/shop_buyback.dm index 04930411588..fbaf518af0f 100644 --- a/voidcrew/modules/trade/shop_buyback.dm +++ b/voidcrew/modules/trade/shop_buyback.dm @@ -10,10 +10,13 @@ * one sale-unit per click or in bulk. Credits land on the selected ship's account, * falling back to the ID account; voucher payouts materialize in hand. * - * Balance rule: entries that pay VOUCHERS must only ever buy loot that can't - * be manufactured aboard a ship (planet minerals, fauna harvests, ruin finds). - * Vouchers are the currency that can't be farmed safely, and a lathe-printable - * buyback would break that in one shift. + * Balance rule: entries that pay VOUCHERS buy loot a ship can't manufacture + * (planet minerals, fauna harvests, ruin finds) at whatever demand suits it. + * Ship-made goods (drinks, cooked food, plants, slime extracts, farmed fish) + * may pay vouchers only for their rare top tier: 1-3 vouchers a sale, with + * demand 1-3. Demand is per round and shared by every crew, so that roll is + * the whole round's supply for everyone. Commons pay credits. Anything a + * lathe, cargo pack or vendor turns out cheaply never pays vouchers. */ /datum/shop_buyback /// Display name of what the trader wants (defaults to the item's name) diff --git a/voidcrew/modules/trade/shop_catalog_black_market_vendors.dm b/voidcrew/modules/trade/shop_catalog_black_market_vendors.dm index 86765451902..bcfabdca175 100644 --- a/voidcrew/modules/trade/shop_catalog_black_market_vendors.dm +++ b/voidcrew/modules/trade/shop_catalog_black_market_vendors.dm @@ -85,6 +85,10 @@ /datum/shop_buyback/dregs/hooch, /datum/shop_buyback/dregs/kong, /datum/shop_buyback/dregs/ritual_wine, + /datum/shop_buyback/dregs/cocktail/house, + /datum/shop_buyback/dregs/cocktail/fancy, + /datum/shop_buyback/dregs/cocktail/hot_ice_coffee, + /datum/shop_buyback/dregs/cocktail/the_juice, ) trader_lines = list( TRADER_LINE_SALE = list( @@ -310,6 +314,97 @@ demand_min = 1 demand_max = 2 +// Mixed drinks, sold by the glass. A glass counts when it holds at least +// min_volume of one wanted drink and that drink is most of what's in it, so a +// splash of The Juice topped up with water doesn't pass. Every one of these can +// be mixed aboard a ship, so only the two hardest pay vouchers, at small demand. +/datum/shop_buyback/dregs/cocktail + category = "The Bar" + item_path = /obj/item/reagent_containers/cup/glass/drinkingglass + icon_override = 'icons/obj/drinks/mixed_drinks.dmi' + /// Drink reagent types this entry pays for (exact types) + var/list/wanted_drinks + /// Least amount of the drink one glass must hold + var/min_volume = 30 + /// Share of the glass's contents the drink must make up + var/min_share = 0.8 + +/datum/shop_buyback/dregs/cocktail/matches(obj/item/offered) + if(!..() || !offered.reagents) + return FALSE + var/datum/reagents/holder = offered.reagents + if(holder.total_volume < min_volume) + return FALSE + for(var/drink in wanted_drinks) + var/poured = holder.get_reagent_amount(drink) + if(poured >= min_volume && poured >= holder.total_volume * min_share) + return TRUE + return FALSE + +/datum/shop_buyback/dregs/cocktail/get_wanted_text() + return "a full glass of [name]" + +/datum/shop_buyback/dregs/cocktail/house + name = "a proper cocktail" + desc = "Gargle Blasters, Long Islands, Demon's Blood. Anything with a real recipe." + icon_state_override = "gargleblasterglass" + wanted_drinks = list( + /datum/reagent/consumable/ethanol/gargle_blaster, + /datum/reagent/consumable/ethanol/longislandicedtea, + /datum/reagent/consumable/ethanol/b52, + /datum/reagent/consumable/ethanol/quintuple_sec, + /datum/reagent/consumable/ethanol/demonsblood, + /datum/reagent/consumable/ethanol/devilskiss, + /datum/reagent/consumable/ethanol/narsour, + /datum/reagent/consumable/ethanol/hippies_delight, + /datum/reagent/consumable/ethanol/atomicbomb, + /datum/reagent/consumable/ethanol/threemileisland, + /datum/reagent/consumable/ethanol/manhattan_proj, + /datum/reagent/consumable/ethanol/toxins_special, + /datum/reagent/consumable/ethanol/beepsky_smash, + /datum/reagent/consumable/ethanol/turbo, + /datum/reagent/consumable/ethanol/helianthus, + /datum/reagent/consumable/doctor_delight, + ) + pay_credits = 80 + demand_min = 3 + demand_max = 5 + +/datum/shop_buyback/dregs/cocktail/fancy + name = "a top-shelf cocktail" + desc = "Neurotoxin, Singulo, Planet Cracker. What the Undertow's big spenders order." + icon_state_override = "neurotoxinglass" + wanted_drinks = list( + /datum/reagent/consumable/ethanol/neurotoxin, + /datum/reagent/consumable/ethanol/singulo, + /datum/reagent/consumable/ethanol/planet_cracker, + /datum/reagent/consumable/ethanol/triumphal_arch, + /datum/reagent/consumable/ethanol/salt_and_swell, + /datum/reagent/consumable/red_queen, + ) + pay_credits = 200 + demand_min = 2 + demand_max = 3 + +/datum/shop_buyback/dregs/cocktail/hot_ice_coffee + name = "Hot Ice Coffee" + desc = "Coffee brewed over hot ice. One of Dram's regulars drinks nothing else." + icon_override = 'icons/obj/drinks/coffee.dmi' + icon_state_override = "hoticecoffee" + wanted_drinks = list(/datum/reagent/consumable/hot_ice_coffee) + pay_vouchers = 1 + demand_min = 1 + demand_max = 3 + +/datum/shop_buyback/dregs/cocktail/the_juice + name = "The Juice" + desc = "Dram has one regular who orders it and still walks out." + icon_state_override = "thejuice" + wanted_drinks = list(/datum/reagent/consumable/ethanol/the_juice) + pay_vouchers = 2 + demand_min = 1 + demand_max = 2 + // ========================================================================= // PATCH-UP CLINIC: Sawbones, practitioner (license pending since forever) // ========================================================================= @@ -391,6 +486,9 @@ /datum/shop_buyback/clinic/liver, /datum/shop_buyback/clinic/lungs, /datum/shop_buyback/clinic/monster_gland, + /datum/shop_buyback/clinic_exotic/species, + /datum/shop_buyback/clinic_exotic/voltaic_heart, + /datum/shop_buyback/clinic_exotic/meridian_heart, ) trader_lines = list( TRADER_LINE_SALE = list( @@ -637,12 +735,34 @@ price_vouchers = 0 // ===== SAWBONES' INTAKE LEDGER (buybacks) ===== -// Natural donor organs and monster glands only. +// Natural donor organs and monster glands, plus the exotic intake below. + +/// Organs from the off-world playable species. Sawbones prices these on their own +/// line, so the plain donor heart/liver/lungs lines never take one cheap. +GLOBAL_LIST_INIT(clinic_species_organs, typecacheof(list( + /obj/item/organ/brain/lizard, + /obj/item/organ/eyes/lizard, + /obj/item/organ/tongue/lizard, + /obj/item/organ/eyes/moth, + /obj/item/organ/tongue/moth, + /obj/item/organ/ears/cat, + /obj/item/organ/tongue/cat, + /obj/item/organ/lungs/plasmaman, + /obj/item/organ/liver/bone/plasmaman, + /obj/item/organ/stomach/bone/plasmaman, + /obj/item/organ/tongue/bone/plasmaman, + /obj/item/organ/heart/ethereal, + /obj/item/organ/lungs/ethereal, + /obj/item/organ/stomach/ethereal, + /obj/item/organ/tongue/ethereal, +))) /datum/shop_buyback/clinic/matches(obj/item/offered) if(!..() || !istype(offered, /obj/item/organ)) return FALSE var/obj/item/organ/organ = offered + if(is_type_in_typecache(organ, GLOB.clinic_species_organs)) + return FALSE return (organ.organ_flags & ORGAN_ORGANIC) && !(organ.organ_flags & ORGAN_ROBOTIC) && !HAS_TRAIT(organ, TRAIT_PRINTED_ORGAN) /datum/shop_buyback/clinic/heart @@ -692,3 +812,55 @@ if(istype(offered, item_path) && is_dead_monster_core(offered) && !is_trader_good(offered)) return "That core's gone dead." return ..() + +// Exotic intake. Never a limbgrower print (TRAIT_PRINTED_ORGAN), and never a +// dead or broken organ. Species organs come off any body of that species, so +// they pay credits. The voucher lines are organs a ship can't make: +// the voltaic heart's shell prints in a lathe, but the flux core inside comes +// out of a live anomaly, and the Meridian heart only turns up in ruin caches. +/datum/shop_buyback/clinic_exotic + category = "Exotic Intake" + item_path = /obj/item/organ + +/datum/shop_buyback/clinic_exotic/matches(obj/item/offered) + if(!..()) + return FALSE + var/obj/item/organ/organ = offered + return !HAS_TRAIT(organ, TRAIT_PRINTED_ORGAN) && !(organ.organ_flags & ORGAN_FAILING) + +/datum/shop_buyback/clinic_exotic/species + name = "off-world donor organ" + desc = "Lizard, moth, felinid, plasmaman or ethereal. Sawbones has clients who need a match." + icon_override = 'icons/obj/medical/organs/organs.dmi' + icon_state_override = "tonguelizard" + pay_credits = 200 + demand_min = 2 + demand_max = 4 + +/datum/shop_buyback/clinic_exotic/species/matches(obj/item/offered) + if(!..() || !is_type_in_typecache(offered, GLOB.clinic_species_organs)) + return FALSE + var/obj/item/organ/organ = offered + return !(organ.organ_flags & ORGAN_ROBOTIC) + +/datum/shop_buyback/clinic_exotic/voltaic_heart + name = "voltaic heart, cored" + desc = "A voltaic cyberheart with a live flux core seated. Sawbones won't say who it's for." + item_path = /obj/item/organ/heart/cybernetic/anomalock + pay_vouchers = 1 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/clinic_exotic/voltaic_heart/matches(obj/item/offered) + if(!..()) + return FALSE + var/obj/item/organ/heart/cybernetic/anomalock/heart = offered + return istype(heart.core, heart.required_anomaly) && !is_trader_good(heart.core) + +/datum/shop_buyback/clinic_exotic/meridian_heart + name = "Meridian heart" + desc = "The cold-chain heart with its own defib charge. Sawbones has a buyer and a cooler waiting." + item_path = /obj/item/organ/heart/cybernetic/meridian + pay_vouchers = 1 + demand_min = 1 + demand_max = 1 diff --git a/voidcrew/modules/trade/shop_catalog_diner.dm b/voidcrew/modules/trade/shop_catalog_diner.dm index 5a20c3b1341..c9306ef6273 100644 --- a/voidcrew/modules/trade/shop_catalog_diner.dm +++ b/voidcrew/modules/trade/shop_catalog_diner.dm @@ -23,8 +23,9 @@ * and both the buyback ledger and the Kitchen Order contracts accept only * HAS_TRAIT_NOT_FROM that source: Roux never buys her own plates back, and * contracts can't be settled off her own counter. - * - Every ledger payout sits below the cheapest plated SKU, so buy-to-sell-back - * loses money even before the source gate. + * - Every order-wheel payout sits below the cheapest plated SKU, so + * buy-to-sell-back loses money even before the source gate. The specials pay + * more, but Roux plates none of them. * - Nothing here prints on a stock ship autolathe; dishes need a real kitchen. */ @@ -109,7 +110,18 @@ /datum/shop_sku/diner/plated/rare/birthday_cake, /datum/shop_sku/diner/plated/rare/berry_clafoutis, ) + // Specials sit ahead of the catch-alls so a counter quote prices them right buyback_types = list( + /datum/shop_buyback/diner/special/stuffed_legion, + /datum/shop_buyback/diner/special/energy_cake, + /datum/shop_buyback/diner/special/royal_cheese, + /datum/shop_buyback/diner/special/gondola_pocket, + /datum/shop_buyback/diner/special/mimana_bread, + /datum/shop_buyback/diner/special/ghost_burger, + /datum/shop_buyback/diner/special/chaos_donut, + /datum/shop_buyback/diner/special/xenoburger, + /datum/shop_buyback/diner/special/spell_burger, + /datum/shop_buyback/diner/special/notasandwich, /datum/shop_buyback/diner/home_cooking, /datum/shop_buyback/diner/pie_case, /datum/shop_buyback/diner/whole_cake, @@ -457,6 +469,8 @@ // Cooked by an actual person, and not by this kitchen if(!HAS_TRAIT_NOT_FROM(offered, TRAIT_FOOD_CHEF_MADE, TRAIT_SOURCE_OUTPOST_KITCHEN)) return FALSE + if(claimed_by_buyback_family(offered, /datum/shop_buyback/diner/special)) + return FALSE var/obj/item/food/dish = offered return dish.crafting_complexity >= min_complexity @@ -486,6 +500,8 @@ /datum/shop_buyback/diner/whole_cake/matches(obj/item/offered) if(!..()) return FALSE + if(claimed_by_buyback_family(offered, /datum/shop_buyback/diner/special)) + return FALSE return HAS_TRAIT_NOT_FROM(offered, TRAIT_FOOD_CHEF_MADE, TRAIT_SOURCE_OUTPOST_KITCHEN) // The scavenger's rung: no chef gate, pocket change. Donk Co. pays a standing @@ -498,3 +514,108 @@ pay_credits = 20 demand_min = 6 demand_max = 12 + +// The gondola pocket has its own row +/datum/shop_buyback/diner/donk_recall/matches(obj/item/offered) + if(!..()) + return FALSE + return !claimed_by_buyback_family(offered, /datum/shop_buyback/diner/special) + +// ===== ROUX'S SPECIALS ===== +// Dishes that need an ingredient a galley can't just order. Same chef gate as +// the order wheel: cooked by a person, and not on Roux's own pass. Loot-spawned +// plates carry no chef trait and don't count. +// +// Voucher rows each burn something that is itself worth a fight: a legion core +// (the black market pays a voucher for one on its own, so the dish pays two), +// an energy sword (4 vouchers on the black market shelf, so the cake can't +// launder a bought one into profit), strange reagent plus a crown, or gondola +// toxin, which only comes off a gondola. Credit rows use ingredients a ship +// can get with some effort: ectoplasm off a ghost-eaten meal, a mime banana +// mutation, frost oil from ice peppers, xeno meat (a cargo meat crate can roll +// it), a costume wizard hat or a fake moustache from the autodrobe. +// Bread cat and bread dog are mobs, not plates, so they aren't listed. + +/datum/shop_buyback/diner/special + category = "Chef's Specials" + demand_min = 1 + demand_max = 3 + +/datum/shop_buyback/diner/special/matches(obj/item/offered) + if(!..()) + return FALSE + return HAS_TRAIT_NOT_FROM(offered, TRAIT_FOOD_CHEF_MADE, TRAIT_SOURCE_OUTPOST_KITCHEN) + +/datum/shop_buyback/diner/special/stuffed_legion + name = "stuffed legion" + desc = "Goliath steak wrapped round a legion core. Roux plates it under a cloche and charges whatever she likes." + item_path = /obj/item/food/stuffedlegion + pay_vouchers = 2 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/diner/special/energy_cake + name = "energy cake" + desc = "A birthday cake with an energy sword baked in. Roux cuts it with oven mitts on." + item_path = /obj/item/food/cake/birthday/energy + pay_vouchers = 2 + demand_min = 1 + demand_max = 1 + +/datum/shop_buyback/diner/special/royal_cheese + name = "royal cheese" + desc = "A cheese wheel that wears a crown. Roux bows to it. Nobody laughs." + item_path = /obj/item/food/cheese/royal + pay_vouchers = 1 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/diner/special/gondola_pocket + name = "gondola pocket" + desc = "A pocket pastry with gondola in it. Roux serves it to people she trusts, and only once." + item_path = /obj/item/food/donkpocket/gondola + pay_vouchers = 1 + demand_min = 1 + demand_max = 2 + +// The microwaved one is a sibling type, not a subtype +/datum/shop_buyback/diner/special/gondola_pocket/matches(obj/item/offered) + if(istype(offered, /obj/item/food/donkpocket/warm/gondola) && !is_trader_good(offered) && !(offered.item_flags & ABSTRACT) && !(offered.flags_1 & HOLOGRAM_1)) + return HAS_TRAIT_NOT_FROM(offered, TRAIT_FOOD_CHEF_MADE, TRAIT_SOURCE_OUTPOST_KITCHEN) + return ..() + +/datum/shop_buyback/diner/special/mimana_bread + name = "mimana bread (whole loaf)" + desc = "Bread made with a mime's banana. It makes no sound when you cut it." + item_path = /obj/item/food/bread/mimana + pay_credits = 300 + +/datum/shop_buyback/diner/special/ghost_burger + name = "ghost burger" + desc = "A burger with ectoplasm in it. It's cold all the way through and always will be." + item_path = /obj/item/food/burger/ghost + pay_credits = 200 + +/datum/shop_buyback/diner/special/chaos_donut + name = "chaos donut" + desc = "Frost oil and capsaicin in one donut. Roux sells them on a dare." + item_path = /obj/item/food/donut/chaos + pay_credits = 150 + +/datum/shop_buyback/diner/special/xenoburger + name = "xenoburger" + desc = "A burger made from xeno meat. Roux doesn't say where hers comes from." + item_path = /obj/item/food/burger/xeno + pay_credits = 150 + +/datum/shop_buyback/diner/special/spell_burger + name = "spell burger" + desc = "A burger with a wizard hat cooked into it. Customers swear it talks." + item_path = /obj/item/food/burger/spell + pay_credits = 100 + +/datum/shop_buyback/diner/special/notasandwich + name = "not-a-sandwich" + desc = "Two slices of bread wearing a fake moustache. It's not a sandwich. Roux has stopped arguing." + item_path = /obj/item/food/sandwich/notasandwich + pay_credits = 80 diff --git a/voidcrew/modules/trade/shop_catalog_general.dm b/voidcrew/modules/trade/shop_catalog_general.dm index da06e70f6c6..bcc6d97231f 100644 --- a/voidcrew/modules/trade/shop_catalog_general.dm +++ b/voidcrew/modules/trade/shop_catalog_general.dm @@ -695,6 +695,38 @@ demand_min = 5 demand_max = 8 +// Barnaby sends anything Pike wants for the wall next door, so a trophy fish +// never goes in the chowder for less by accident. +/datum/shop_buyback/general/fresh_catch/matches(obj/item/offered) + if(!..()) + return FALSE + return !claimed_by_buyback_family(offered, /datum/shop_buyback/bait) + +/** + * Whether any ledger entry under `family` (a /datum/shop_buyback base type) + * would take `offered`. A catch-all entry ("any fish", "any produce", "any + * dish") calls this to step aside for the specific entries that pay more, so + * a rare item can't be sold cheap by surprise and the two lists never drift: + * adding a rare entry excludes it from the catch-all automatically. + * + * Asks real matches() on one cached prototype per entry, so conditions like a + * potency floor or an excluded subtype carry over exactly. + */ +/proc/claimed_by_buyback_family(obj/item/offered, family) + var/static/list/prototypes_by_family = list() + var/list/prototypes = prototypes_by_family[family] + if(isnull(prototypes)) + prototypes = list() + for(var/datum/shop_buyback/entry_type as anything in subtypesof(family)) + if(!initial(entry_type.item_path)) + continue + prototypes += new entry_type + prototypes_by_family[family] = prototypes + for(var/datum/shop_buyback/prototype as anything in prototypes) + if(prototype.matches(offered)) + return TRUE + return FALSE + /datum/shop_buyback/general/bear_pelt name = "bear hide" desc = "Cave bear hide off the green worlds. Barnaby says it's for the guest bunks. There are no guest bunks." diff --git a/voidcrew/modules/trade/shop_catalog_general_vendors.dm b/voidcrew/modules/trade/shop_catalog_general_vendors.dm index 7abbb058ffd..8abcd744dcc 100644 --- a/voidcrew/modules/trade/shop_catalog_general_vendors.dm +++ b/voidcrew/modules/trade/shop_catalog_general_vendors.dm @@ -15,7 +15,8 @@ * - Fern stocks seeds and supplies rather than printable hand tools. Her * tray board is the fabrication-gated infrastructure for adding a garden. * - Fern's produce and graft buybacks pay pocket change on purpose: it's the - * "sell your harvest at the waystation" fantasy, not an economy. Her graft + * "sell your harvest at the waystation" fantasy, not an economy. Only her + * prize-plant rows (mutation-chain crops over a potency bar) pay real money. Her graft * ledger refuses plain repeated-harvest cuttings so a tray of wheat can't be * farmed into credits; see the matches() override below. * - Pike never buys what his own pond stocks at meaningful prices; the @@ -96,7 +97,15 @@ /datum/shop_sku/potting/rare/gaia, /datum/shop_sku/potting/rare/mystery_seeds, ) + // Prize plants sit ahead of the farm stand so a counter quote prices them right buyback_types = list( + /datum/shop_buyback/potting/prize/gatfruit, + /datum/shop_buyback/potting/prize/omega_weed, + /datum/shop_buyback/potting/prize/bluespace_tomato, + /datum/shop_buyback/potting/prize/holymelon, + /datum/shop_buyback/potting/prize/golden_apple, + /datum/shop_buyback/potting/prize/bluespace_banana, + /datum/shop_buyback/potting/prize/glowcap, /datum/shop_buyback/potting/graft, /datum/shop_buyback/potting/ash_flora, /datum/shop_buyback/potting/produce, @@ -363,6 +372,97 @@ demand_min = 5 demand_max = 10 +// A prize plant good enough for Fern's own ledger never goes on the farm stand. +// One below her bar does, at farm-stand rates. +/datum/shop_buyback/potting/produce/matches(obj/item/offered) + if(!..()) + return FALSE + return !claimed_by_buyback_family(offered, /datum/shop_buyback/potting/prize) + +// ===== FERN'S PRIZE PLANTS ===== +// Mutation-chain crops, bought one at a time. Once a crew has the seed it can +// grow these forever, so the cap is demand (1-3, and the voucher rows never +// refill), and the bar is seed potency: a fresh mutation comes out weak, and +// only a few generations of real breeding clears min_potency. Anything under +// the bar still sells on the farm stand. Seed sources checked: none of these +// seeds is on a vendor, a cargo pack or a trader shelf. Gatfruit seeds only +// spawn as loot; omega weed is a 1-in-5 mutation off contraband cannabis; +// bluespace tomato is two mutations deep off a stock tomato. The credit rows +// are one mutation off seeds anyone can buy. + +/datum/shop_buyback/potting/prize + category = "Prize Plants" + item_path = null + demand_min = 1 + demand_max = 3 + /// Lowest seed potency Fern will take for this entry + var/min_potency = 30 + +/datum/shop_buyback/potting/prize/matches(obj/item/offered) + if(!..()) + return FALSE + var/obj/item/food/grown/crop = offered + return crop.seed?.potency >= min_potency + +/datum/shop_buyback/potting/prize/get_denial_reason(mob/living/user) + . = ..() + if(!. || demand <= 0 || count_carried_units(user) >= 1) + return + for(var/obj/item/food/grown/crop in user.get_all_contents()) + if(istype(crop, item_path) && !is_trader_good(crop)) + return "Not that one. Grow me a stronger one." + +/datum/shop_buyback/potting/prize/gatfruit + name = "gatfruit" + desc = "Fruit that grows bullets. Fern keeps hers in a locked drawer." + item_path = /obj/item/food/grown/gatfruit + pay_vouchers = 2 + min_potency = 50 + demand_min = 1 + demand_max = 1 + +/datum/shop_buyback/potting/prize/omega_weed + name = "omega weed" + desc = "Top-shelf omega weed. Fern says it's for a study." + item_path = /obj/item/food/grown/cannabis/ultimate + pay_vouchers = 1 + min_potency = 50 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/potting/prize/bluespace_tomato + name = "bluespace tomato" + desc = "A tomato that isn't entirely in one place. Fern wants a strong one." + item_path = /obj/item/food/grown/tomato/blue/bluespace + pay_vouchers = 1 + min_potency = 50 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/potting/prize/holymelon + name = "holy melon" + desc = "A melon full of holy water. The chaplain on the next ring orders them by the crate." + item_path = /obj/item/food/grown/holymelon + pay_credits = 200 + +/datum/shop_buyback/potting/prize/golden_apple + name = "golden apple" + desc = "An apple with real gold in it. Fern doesn't eat them." + item_path = /obj/item/food/grown/apple/gold + pay_credits = 200 + +/datum/shop_buyback/potting/prize/bluespace_banana + name = "bluespace banana" + desc = "A banana that slips through space. Fern handles them with tongs." + item_path = /obj/item/food/grown/banana/bluespace + pay_credits = 150 + +/datum/shop_buyback/potting/prize/glowcap + name = "glowcap" + desc = "A mushroom that glows and holds a charge. Halcyon's night lights run on them." + item_path = /obj/item/food/grown/mushroom/glowshroom/glowcap + pay_credits = 150 + // ========================================================================= // PIKE'S BAIT & TACKLE: Pike, resident angler // ========================================================================= @@ -420,9 +520,17 @@ /datum/shop_sku/bait/rotating/stocked_aquarium, ) buyback_types = list( - /datum/shop_buyback/bait/pike, + /datum/shop_buyback/bait/mastodon, + /datum/shop_buyback/bait/nessie, + /datum/shop_buyback/bait/moonfish, + /datum/shop_buyback/bait/chainsawfish, + /datum/shop_buyback/bait/armored_pike, /datum/shop_buyback/bait/donkfish, - /datum/shop_buyback/bait/goldfish, + /datum/shop_buyback/bait/swordfish, + /datum/shop_buyback/bait/pike, + /datum/shop_buyback/bait/lavaloop, + /datum/shop_buyback/bait/starfish, + /datum/shop_buyback/bait/fritterish, ) trader_lines = list( TRADER_LINE_SALE = list( @@ -578,14 +686,67 @@ price_credits = 600 // ===== PIKE'S TROPHY LEDGER (buybacks) ===== -// The weird stuff only. Barnaby handles the by-the-fin chowder trade. +// The weird stuff only. Barnaby's chowder pot takes every other fish, and +// steps aside for anything on this list (see fresh_catch/matches()), so the +// two ledgers never overlap. +// +// Where they come from: the fishing portal (printable from roundstart) opens +// ocean and hyperspace water after fish-scanning experiments and syndicate +// water when emagged, so swordfish, moonfish, starfish, donk-fish, +// chainsawfish and armored pike are all ship-farmable, and fish breed in an +// aquarium. Those pay credits. The two voucher rows can't be pulled from a +// portal: nessie comes out of a deep fryer about once every 22 minutes on a +// hard catch, and the mastodon out of an oil well in a ruin, or a big-fish +// breeding project. Rift fish (chrystarfish aside) only come out of heretic +// influences, which Voidcrew never spawns, so they aren't listed. + +/datum/shop_buyback/bait/mastodon + name = "unmarine mastodon" + desc = "The big one. Pike has cleared a whole wall for it." + category = "Trophy Wall" + item_path = /obj/item/fish/mastodon + pay_vouchers = 2 + demand_min = 1 + demand_max = 1 -/datum/shop_buyback/bait/pike - name = "pike (the fish)" - desc = "He wants one for the wall. He is aware of the name situation. Do not bring up the name situation." +/datum/shop_buyback/bait/nessie + name = "nessie-fish" + desc = "Pulled out of a deep fryer, they say. Pike has stopped asking how." category = "Trophy Wall" - item_path = /obj/item/fish/pike - pay_credits = 300 + item_path = /obj/item/fish/fryish/nessie + pay_vouchers = 1 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/bait/moonfish + name = "zagoskian moonfish" + desc = "A full-grown moonfish. The dwarf ones go in the chowder." + category = "Trophy Wall" + item_path = /obj/item/fish/moonfish + pay_credits = 400 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/bait/moonfish/matches(obj/item/offered) + if(!..()) + return FALSE + return !istype(offered, /obj/item/fish/moonfish/dwarf) + +/datum/shop_buyback/bait/chainsawfish + name = "chainsawfish" + desc = "Pike mounts them with the motor still in. He has the scars to prove it." + category = "Trophy Wall" + item_path = /obj/item/fish/chainsawfish + pay_credits = 400 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/bait/armored_pike + name = "armored pike" + desc = "A pike with plating. Pike takes it personally, in a good way." + category = "Trophy Wall" + item_path = /obj/item/fish/pike/armored + pay_credits = 400 demand_min = 1 demand_max = 2 @@ -598,11 +759,54 @@ demand_min = 1 demand_max = 2 -/datum/shop_buyback/bait/goldfish - name = "goldfish" - desc = "Pity rates. Everyone's first catch deserves a buyer, and Pike remembers his." +/datum/shop_buyback/bait/swordfish + name = "swordfish" + desc = "Deep water, long bill, bad attitude. Pike wants it for over the door." category = "Trophy Wall" - item_path = /obj/item/fish/goldfish - pay_credits = 25 - demand_min = 3 - demand_max = 5 + item_path = /obj/item/fish/swordfish + pay_credits = 300 + demand_min = 1 + demand_max = 3 + +/datum/shop_buyback/bait/pike + name = "pike (the fish)" + desc = "He wants one for the wall. He is aware of the name situation. Do not bring up the name situation." + category = "Trophy Wall" + item_path = /obj/item/fish/pike + pay_credits = 300 + demand_min = 1 + demand_max = 2 + +// The armored kind has its own row +/datum/shop_buyback/bait/pike/matches(obj/item/offered) + if(!..()) + return FALSE + return !istype(offered, /obj/item/fish/pike/armored) + +/datum/shop_buyback/bait/lavaloop + name = "lavaloop" + desc = "A fish that swims in lava. Pike keeps it in a steel bucket on a hot plate." + category = "Trophy Wall" + item_path = /obj/item/fish/lavaloop + pay_credits = 250 + demand_min = 1 + demand_max = 3 + +/datum/shop_buyback/bait/starfish + name = "cosmostarfish" + desc = "Fished out of open space. Pike checks it twice for a pulse." + category = "Trophy Wall" + item_path = /obj/item/fish/starfish + pay_credits = 200 + demand_min = 1 + demand_max = 3 + +/datum/shop_buyback/bait/fritterish + name = "fritterish" + desc = "Grown up from a fryer catch. It still smells of oil." + category = "Trophy Wall" + item_path = /obj/item/fish/fryish/fritterish + pay_credits = 200 + demand_min = 1 + demand_max = 2 + diff --git a/voidcrew/modules/trade/shop_catalog_outfitter.dm b/voidcrew/modules/trade/shop_catalog_outfitter.dm index 84086db044e..d6ef62da5e9 100644 --- a/voidcrew/modules/trade/shop_catalog_outfitter.dm +++ b/voidcrew/modules/trade/shop_catalog_outfitter.dm @@ -176,6 +176,12 @@ /datum/shop_buyback/outfitter/goliath_plates, /datum/shop_buyback/outfitter/sinew, /datum/shop_buyback/outfitter/glacial_core, + /datum/shop_buyback/outfitter/listed/officer_armor, + /datum/shop_buyback/outfitter/listed/military_armor, + /datum/shop_buyback/outfitter/listed/service_arms, + /datum/shop_buyback/outfitter/listed/heavy_arms, + /datum/shop_buyback/outfitter/listed/military_arms, + /datum/shop_buyback/outfitter/listed/collector_pieces, ) // Field harvests for depot resupply mission_requests = list( @@ -788,13 +794,15 @@ price_credits = 2000 // ===== SARGE'S SALVAGE COUNTER (buybacks) ===== -// Credits only; guns and armor can come off a lathe, so they never pay vouchers. +// Plain salvage pays credits. The rare rows below take exact types only +// (buyback_listed.dm): a row typed at /obj/item/gun would pay out on cargo's +// toy crates, 400 cr buys eight foam shotguns, so every gun row names its guns. // -// No gun line here either. Any buyback typed at /obj/item/gun or -// /obj/item/gun/energy pays out on cargo's toy crates, 400 cr buys eight foam -// shotguns or six laser-tag rifles, and none of them can be told apart from the -// real thing at the counter. Armor's bid includes room for discounted cargo and -// the crate/manifest return; security packs cannot receive ordinary coupons. +// Tiers follow tools/gear_catalog/ratings/. Anything a crew can buy, order or +// print pays credits at a fraction of its cheapest shelf price (peddler and +// depot prices); only gear with no buy, print or order route pays vouchers. +// Armor's bid includes room for discounted cargo and the crate/manifest +// return; security packs cannot receive ordinary coupons. /datum/shop_buyback/outfitter/salvage_armor name = "armored suit (salvage)" @@ -805,6 +813,14 @@ demand_min = 3 demand_max = 6 +/// The rare armor rows outbid this one, so their goods go there. Ship's issue still sells here. +/datum/shop_buyback/outfitter/salvage_armor/matches(obj/item/offered) + if(!..()) + return FALSE + if(offered.buyback_hull_issue) + return TRUE + return !(GLOB.depot_officer_armor[offered.type] || GLOB.depot_military_armor[offered.type] || GLOB.depot_collector_pieces[offered.type]) + // Planet megafauna materials: armor-grade feedstock the depot can't lathe /datum/shop_buyback/outfitter/goliath_plates name = "goliath hide plates" @@ -839,6 +855,240 @@ demand_min = 3 demand_max = 5 +// --- Rare arms and armor: exact types, priced by gear rating --- + +/// Yellow-tier armor with no shelf, plus the depot's own ablative vest (1 voucher + 3,600 cr new). +GLOBAL_LIST_INIT(depot_officer_armor, buyback_exact_cache(list( + /obj/item/clothing/suit/armor/hos, + /obj/item/clothing/suit/armor/hos/trenchcoat, + /obj/item/clothing/suit/armor/hos/trenchcoat/winter, + /obj/item/clothing/suit/armor/vest/capcarapace, + /obj/item/clothing/suit/armor/vest/capcarapace/syndicate, + /obj/item/clothing/suit/armor/vest/capcarapace/captains_formal, + /obj/item/clothing/suit/armor/vest/marine/sulaco, + /obj/item/clothing/suit/armor/reactive/teleport, + /obj/item/clothing/suit/armor/swat, + /obj/item/clothing/suit/armor/riot/knight/warlord, + /obj/item/clothing/suit/armor/laserproof, + /obj/item/clothing/suit/costume/pirate/armored, + /obj/item/clothing/suit/costume/pirate/captain/armored, + /obj/item/clothing/head/helmet/swat, + /obj/item/clothing/head/helmet/knight/warlord, + /obj/item/clothing/head/costume/pirate/armored, + /obj/item/clothing/head/costume/pirate/bandana/armored, +))) + +/// Red-tier armor: no shelf, no lathe, no cargo pack. Red caches and megafauna. +GLOBAL_LIST_INIT(depot_military_armor, buyback_exact_cache(list( + /obj/item/clothing/suit/armor/heavy, + /obj/item/clothing/suit/armor/vest/marine, + /obj/item/clothing/suit/armor/vest/marine/pmc, + /obj/item/clothing/suit/armor/vest/marine/security, + /obj/item/clothing/suit/hooded/berserker, + /obj/item/clothing/suit/hooded/hostile_environment, + /obj/item/clothing/head/helmet/marine, + /obj/item/clothing/head/helmet/marine/pmc, + /obj/item/shield/energy, +))) + +/// Yellow-tier arms. Shelf ones start at 1,125 cr (peddler laser), so 300 cr is under a third of any of them. +GLOBAL_LIST_INIT(depot_service_arms, buyback_exact_cache(list( + /obj/item/gun/energy/laser, + /obj/item/gun/energy/e_gun, + /obj/item/gun/energy/e_gun/lethal, + /obj/item/gun/energy/e_gun/old, + /obj/item/gun/energy/e_gun/hos, + /obj/item/gun/energy/laser/captain, + /obj/item/gun/energy/laser/retro, + /obj/item/gun/energy/laser/retro/old, + /obj/item/gun/energy/laser/luxurypaywall, + /obj/item/gun/energy/ionrifle, + /obj/item/gun/energy/disabler/smg, + /obj/item/gun/energy/laser/carbine/cybersun/unrestricted, + /obj/item/gun/ballistic/automatic/c20r/unrestricted, + /obj/item/gun/ballistic/automatic/wt550, + /obj/item/gun/ballistic/automatic/mini_uzi, + /obj/item/gun/ballistic/automatic/pistol/aps, + /obj/item/gun/ballistic/automatic/pistol/deagle, + /obj/item/gun/ballistic/automatic/pistol/deagle/camo, + /obj/item/gun/ballistic/automatic/pistol/deagle/gold, + /obj/item/gun/ballistic/automatic/proto/unrestricted, + /obj/item/gun/ballistic/revolver, + /obj/item/gun/ballistic/revolver/mateba, + /obj/item/gun/ballistic/revolver/nagant, + /obj/item/gun/ballistic/revolver/golden, + /obj/item/gun/ballistic/revolver/grenadelauncher/unrestricted, + /obj/item/gun/ballistic/rifle/boltaction, + /obj/item/gun/ballistic/rifle/boltaction/donkrifle, + /obj/item/gun/ballistic/shotgun/automatic/dual_tube, + /obj/item/gun/syringe/syndicate, + /obj/item/claymore, + /obj/item/claymore/cutlass, + /obj/item/claymore/cutlass/old, + /obj/item/fireaxe/boardingaxe, +))) + +/// Red-tier arms the peddler or a crafting kit can supply (4,950-6,600 cr new), so credits only. +GLOBAL_LIST_INIT(depot_heavy_arms, buyback_exact_cache(list( + /obj/item/gun/energy/laser/carbine, + /obj/item/gun/energy/lasercannon/unrestricted, + /obj/item/gun/energy/laser/scatter, + /obj/item/gun/energy/laser/hellgun, + /obj/item/gun/energy/e_gun/nuclear, + /obj/item/gun/energy/xray, + /obj/item/gun/ballistic/shotgun/automatic/combat, + /obj/item/gun/ballistic/shotgun/bulldog/unrestricted, + /obj/item/gun/ballistic/automatic/tommygun, + /obj/item/katana, + /obj/item/melee/energy/sword/pirate, + /obj/item/melee/energy/sword/saber, + /obj/item/melee/energy/sword/saber/blue, + /obj/item/melee/energy/sword/saber/purple, + /obj/item/melee/energy/sword/saber/red, +))) + +/// Red-tier arms with no buy, print or order route at all. +GLOBAL_LIST_INIT(depot_military_arms, buyback_exact_cache(list( + /obj/item/gun/ballistic/automatic/ar, + /obj/item/gun/ballistic/automatic/l6_saw/unrestricted, + /obj/item/gun/ballistic/automatic/m90/unrestricted, + /obj/item/gun/ballistic/rifle/boltaction/prime, + /obj/item/gun/ballistic/rifle/sniper_rifle, + /obj/item/gun/ballistic/rocketlauncher/unrestricted, + /obj/item/mjollnir, + /obj/item/spear/grey_tide, +))) + +/// Above-tier finds: authored uniques and megafauna prizes. Never on any shelf. +/// The soulscythe is left off on purpose: it can hold a player's soul. +GLOBAL_LIST_INIT(depot_collector_pieces, buyback_exact_cache(list( + /obj/item/gun/ballistic/revolver/c38/housecall, + /obj/item/gun/ballistic/shotgun/musket/no_quarter, + /obj/item/gun/magic/hook/marlinspike, + /obj/item/cain_and_abel, + /obj/item/cane/shepherds_crook, + /obj/item/claymore/cutlass/parley, + /obj/item/cursed_katana, + /obj/item/energy_katana, + /obj/item/garrison_standard, + /obj/item/heave_ho, + /obj/item/hierophant_club, + /obj/item/knife/understudy, + /obj/item/lava_staff, + /obj/item/melee/cleaving_saw, + /obj/item/melee/ghost_sword, + /obj/item/melee/verdigris_staff, + /obj/item/veilrender, + /obj/item/shield/riot/phalanx_buckler, + /obj/item/clothing/suit/armor/hos/trenchcoat/heirloom_coat, + /obj/item/clothing/suit/hooded/cloak/second_shadow, + /obj/item/clothing/suit/hooded/explorer/second_season_duster, + /obj/item/clothing/suit/the_occasion, + /obj/item/clothing/suit/toggle/labcoat/eventide_courier, + /obj/item/clothing/suit/wizrobe/verdigris, + /obj/item/clothing/head/stage_presence, + /obj/item/clothing/head/wizard/verdigris, +))) + +/** + * A row that takes an exact list of types (see buyback_listed.dm). Loose goods + * only, never shop stock, never a hull's own kit. + */ +/datum/shop_buyback/outfitter/listed + item_path = /obj/item + category = "Arms & Armor" + /// The GLOB typecache this row buys from + var/list/wanted_cache + /// Item whose sprite the ledger shows + var/obj/item/display_path + +/datum/shop_buyback/outfitter/listed/New() + ..() + buyback_use_display_icon(src, display_path) + +/datum/shop_buyback/outfitter/listed/buyback_wanted_kind(obj/item/offered) + return wanted_cache?[offered.type] + +/datum/shop_buyback/outfitter/listed/matches(obj/item/offered) + if(!..()) + return FALSE + return buyback_wanted_kind(offered) && !offered.buyback_hull_issue && buyback_goods_loose(offered) + +/datum/shop_buyback/outfitter/listed/get_denial_reason(mob/living/user) + return buyback_listed_denial(src, user) + +/datum/shop_buyback/outfitter/listed/officer_armor + name = "officer's armor" + desc = "Commanders' coats, carapaces, tactical helmets. Good armor with someone else's rank still on it." + display_path = /obj/item/clothing/suit/armor/hos + pay_credits = 350 + demand_min = 2 + demand_max = 4 + +/datum/shop_buyback/outfitter/listed/officer_armor/New() + wanted_cache = GLOB.depot_officer_armor + return ..() + +/datum/shop_buyback/outfitter/listed/military_armor + name = "military armor" + desc = "Marine plate, heavy vests and their helmets. The depot can't get it through any honest channel." + display_path = /obj/item/clothing/suit/armor/vest/marine + pay_vouchers = 1 + demand_min = 1 + demand_max = 3 + +/datum/shop_buyback/outfitter/listed/military_armor/New() + wanted_cache = GLOB.depot_military_armor + return ..() + +/datum/shop_buyback/outfitter/listed/service_arms + name = "service arms" + desc = "Sidearms, rifles and boarding blades in working order. Sarge test-fires everything before it goes on a rack." + display_path = /obj/item/gun/energy/e_gun + pay_credits = 300 + demand_min = 3 + demand_max = 5 + +/datum/shop_buyback/outfitter/listed/service_arms/New() + wanted_cache = GLOB.depot_service_arms + return ..() + +/datum/shop_buyback/outfitter/listed/heavy_arms + name = "heavy arms" + desc = "Laser cannons, combat shotguns, energy blades. Sarge knows a buyer for every one of them." + display_path = /obj/item/gun/energy/lasercannon/unrestricted + pay_credits = 900 + demand_min = 2 + demand_max = 4 + +/datum/shop_buyback/outfitter/listed/heavy_arms/New() + wanted_cache = GLOB.depot_heavy_arms + return ..() + +/datum/shop_buyback/outfitter/listed/military_arms + name = "military arms" + desc = "Machine guns, marksman rifles, launchers. The kind of thing nobody admits to losing." + display_path = /obj/item/gun/ballistic/automatic/l6_saw/unrestricted + pay_vouchers = 1 + demand_min = 1 + demand_max = 3 + +/datum/shop_buyback/outfitter/listed/military_arms/New() + wanted_cache = GLOB.depot_military_arms + return ..() + +/datum/shop_buyback/outfitter/listed/collector_pieces + name = "one-of-a-kind pieces" + desc = "Named blades, heirloom guns, the gear people tell stories about. Sarge keeps a short list of collectors." + display_path = /obj/item/claymore/cutlass/parley + pay_vouchers = 2 + demand_min = 1 + demand_max = 2 + +/datum/shop_buyback/outfitter/listed/collector_pieces/New() + wanted_cache = GLOB.depot_collector_pieces + return ..() + // Barter: the depot always needs hull stock /datum/shop_sku/barter/plasteel_for_shield zone_permission = ZONE_PERMISSION_YELLOW diff --git a/voidcrew/modules/trade/shop_catalog_outfitter_vendors.dm b/voidcrew/modules/trade/shop_catalog_outfitter_vendors.dm index 54aadded283..21d3584acca 100644 --- a/voidcrew/modules/trade/shop_catalog_outfitter_vendors.dm +++ b/voidcrew/modules/trade/shop_catalog_outfitter_vendors.dm @@ -17,8 +17,9 @@ * carries them) and anomaly charts. Both sit on small weighted rotations of * two slots, one unit each. A sold slot turns over to a different type at * the next convoy. Both take the normal specials. The - * 400 cr core buyback is far below any core's price, so buying to resell - * loses money. + * core buybacks sit far below any core's price, and a core refined from a + * bought raw core keeps the shop's stamp (buyback_listed.dm), so it can't + * be sold back at all. * - The buyback ledger only wants what a ship can't print: anomaly cores, * slime extracts, and raw exotics out of the ground. No circuit boards. * Anything a lathe spits out is a money loop waiting to happen. @@ -98,7 +99,18 @@ ) buyback_types = list( /datum/shop_buyback/skunk/anomaly_core, + /datum/shop_buyback/skunk/anomaly_core/uncommon, + /datum/shop_buyback/skunk/anomaly_core/rare, + /datum/shop_buyback/skunk/anomaly_core/raw, + /datum/shop_buyback/skunk/anomaly_core/raw/uncommon, + /datum/shop_buyback/skunk/anomaly_core/raw/rare, /datum/shop_buyback/skunk/slime_extract, + /datum/shop_buyback/skunk/slime_extract/common, + /datum/shop_buyback/skunk/slime_extract/rare, + /datum/shop_buyback/skunk/slime_extract/exotic, + /datum/shop_buyback/skunk/slime_extract/rainbow, + /datum/shop_buyback/skunk/crossbred, + /datum/shop_buyback/skunk/crossbred/rare, /datum/shop_buyback/skunk/bluespace_crystal, /datum/shop_buyback/skunk/uranium, ) @@ -365,23 +377,278 @@ // ===== BOFFIN'S SPECIMEN LEDGER (buybacks) ===== // Nothing a lathe can print. Planet exotics and things that glow wrong. +// Anomaly cores, priced the way his own shelf weights them: flux, grav, +// hallucination and pyro turn up most; bioscrambler, ectoplasm and dimensional +// less; bluespace and vortex rarely. "Raw" is /obj/item/raw_anomaly_core, the +// sealed core that still needs the refinery's implosion; a refined core +// (/obj/item/assembly/signaler/anomaly) is what drops when a crew neutralizes a +// live anomaly. Raw cores on his shelf cost 8,000-12,000 cr, and the refinery +// carries the shop's stamp onto the refined core, so neither can be sold back. + /datum/shop_buyback/skunk/anomaly_core - name = "anomaly core (any)" - desc = "An intact core out of a collapsed anomaly. Boffin pays full rate and asks that you not shake the container. He asks this several times." - category = "Specimens" + name = "anomaly core" + desc = "An intact core out of a collapsed anomaly. Boffin pays well and asks that you not shake the container. He asks this several times." + category = "Anomalies" item_path = /obj/item/assembly/signaler/anomaly - pay_credits = 400 + pay_credits = 800 + demand_min = 2 + demand_max = 4 + /// Exact core types this row takes + var/list/core_types = list( + /obj/item/assembly/signaler/anomaly/flux, + /obj/item/assembly/signaler/anomaly/grav, + /obj/item/assembly/signaler/anomaly/hallucination, + /obj/item/assembly/signaler/anomaly/pyro, + ) + var/list/core_cache + /// Core whose sprite the ledger shows + var/obj/item/display_path = /obj/item/assembly/signaler/anomaly/flux + +/datum/shop_buyback/skunk/anomaly_core/New() + ..() + core_cache = buyback_exact_cache(core_types) + buyback_use_display_icon(src, display_path) + +/datum/shop_buyback/skunk/anomaly_core/buyback_wanted_kind(obj/item/offered) + return core_cache?[offered.type] + +/datum/shop_buyback/skunk/anomaly_core/matches(obj/item/offered) + if(!..()) + return FALSE + // Loose only: a core seated in a MOD module or a device stays where it is + return buyback_wanted_kind(offered) && buyback_goods_loose(offered) + +/datum/shop_buyback/skunk/anomaly_core/get_denial_reason(mob/living/user) + return buyback_listed_denial(src, user) + +/datum/shop_buyback/skunk/anomaly_core/uncommon + name = "uncommon anomaly core" + desc = "Bioscrambler, ectoplasmic or dimensional. Boffin has a shelf for each and they are all nearly empty." + pay_credits = 1500 demand_min = 2 demand_max = 3 + core_types = list( + /obj/item/assembly/signaler/anomaly/bioscrambler, + /obj/item/assembly/signaler/anomaly/ectoplasm, + /obj/item/assembly/signaler/anomaly/dimensional, + ) + display_path = /obj/item/assembly/signaler/anomaly/dimensional + +/datum/shop_buyback/skunk/anomaly_core/rare + name = "bluespace or vortex core" + desc = "The two he has never managed to buy twice. He'll pay in vouchers, which he hates parting with." + pay_credits = 0 + pay_vouchers = 2 + demand_min = 1 + demand_max = 2 + core_types = list( + /obj/item/assembly/signaler/anomaly/bluespace, + /obj/item/assembly/signaler/anomaly/vortex, + ) + display_path = /obj/item/assembly/signaler/anomaly/vortex + +/datum/shop_buyback/skunk/anomaly_core/raw + name = "raw anomaly core" + desc = "A sealed core nobody has run through a refinery yet. Boffin has a refinery. He also has a long list of complaints about it." + category = "Anomalies" + item_path = /obj/item/raw_anomaly_core + pay_credits = 400 + demand_min = 1 + demand_max = 2 + core_types = list( + /obj/item/raw_anomaly_core/flux, + /obj/item/raw_anomaly_core/grav, + /obj/item/raw_anomaly_core/hallucination, + /obj/item/raw_anomaly_core/pyro, + ) + display_path = /obj/item/raw_anomaly_core/flux + +/datum/shop_buyback/skunk/anomaly_core/raw/uncommon + name = "uncommon raw core" + desc = "Unrefined bioscrambler, ectoplasmic or dimensional cores." + pay_credits = 700 + core_types = list( + /obj/item/raw_anomaly_core/bioscrambler, + /obj/item/raw_anomaly_core/ectoplasm, + /obj/item/raw_anomaly_core/dimensional, + ) + display_path = /obj/item/raw_anomaly_core/dimensional + +/datum/shop_buyback/skunk/anomaly_core/raw/rare + name = "raw bluespace or vortex core" + desc = "Unrefined, and still the best thing anyone has brought him all week." + pay_credits = 1200 + core_types = list( + /obj/item/raw_anomaly_core/bluespace, + /obj/item/raw_anomaly_core/vortex, + ) + display_path = /obj/item/raw_anomaly_core/vortex + +// Slime extracts by colour, following the mutation ladder from grey to +// rainbow. Only whole, unspent extracts: a cored-out one is jelly. Ship labs +// make these, so only rainbow and the rarer crossbreeds pay vouchers, on +// small demand that every crew shares. /datum/shop_buyback/skunk/slime_extract - name = "slime extract (any)" - desc = "Cores cut out of slimes. Every color does something different, and Boffin intends to try all of them." - category = "Specimens" + name = "grey slime extract" + desc = "Every lab's first extract. Boffin keeps a jar of them for when he runs out of the interesting ones." + category = "Slime Extracts" item_path = /obj/item/slime_extract - pay_credits = 200 + pay_credits = 50 + demand_min = 4 + demand_max = 8 + /// Exact extract types this row takes + var/list/extract_types = list(/obj/item/slime_extract/grey) + var/list/extract_cache + /// Extract whose sprite the ledger shows + var/obj/item/display_path = /obj/item/slime_extract/grey + +/datum/shop_buyback/skunk/slime_extract/New() + ..() + extract_cache = buyback_exact_cache(extract_types) + buyback_use_display_icon(src, display_path) + +/datum/shop_buyback/skunk/slime_extract/buyback_wanted_kind(obj/item/offered) + return extract_cache?[offered.type] + +/datum/shop_buyback/skunk/slime_extract/matches(obj/item/offered) + if(!..()) + return FALSE + if(!buyback_wanted_kind(offered) || !buyback_goods_loose(offered)) + return FALSE + var/obj/item/slime_extract/extract = offered + // Spent cores are jelly, and a recurring crossbreed's core belongs to it + return extract.extract_uses > 0 && !extract.recurring + +/datum/shop_buyback/skunk/slime_extract/get_denial_reason(mob/living/user) + return buyback_listed_denial(src, user) + +/datum/shop_buyback/skunk/slime_extract/common + name = "common slime extract" + desc = "Orange, purple, blue, metal, yellow, dark purple, dark blue or silver." + pay_credits = 150 + demand_min = 3 + demand_max = 6 + extract_types = list( + /obj/item/slime_extract/orange, + /obj/item/slime_extract/purple, + /obj/item/slime_extract/blue, + /obj/item/slime_extract/metal, + /obj/item/slime_extract/yellow, + /obj/item/slime_extract/darkpurple, + /obj/item/slime_extract/darkblue, + /obj/item/slime_extract/silver, + ) + display_path = /obj/item/slime_extract/orange + +/datum/shop_buyback/skunk/slime_extract/rare + name = "rare slime extract" + desc = "Bluespace, sepia, cerulean or pyrite. The ones that start doing strange things to the room." + pay_credits = 300 demand_min = 3 demand_max = 5 + extract_types = list( + /obj/item/slime_extract/bluespace, + /obj/item/slime_extract/sepia, + /obj/item/slime_extract/cerulean, + /obj/item/slime_extract/pyrite, + ) + display_path = /obj/item/slime_extract/bluespace + +/datum/shop_buyback/skunk/slime_extract/exotic + name = "exotic slime extract" + desc = "Red, green, pink, gold, oil, black, light pink or adamantine. Boffin has a waiting list for most of them." + pay_credits = 550 + demand_min = 2 + demand_max = 4 + extract_types = list( + /obj/item/slime_extract/red, + /obj/item/slime_extract/green, + /obj/item/slime_extract/pink, + /obj/item/slime_extract/gold, + /obj/item/slime_extract/oil, + /obj/item/slime_extract/black, + /obj/item/slime_extract/lightpink, + /obj/item/slime_extract/adamantine, + ) + display_path = /obj/item/slime_extract/adamantine + +/datum/shop_buyback/skunk/slime_extract/rainbow + name = "rainbow slime extract" + desc = "The end of the ladder. Boffin has seen two in his life and wants a third." + pay_credits = 0 + pay_vouchers = 1 + demand_min = 1 + demand_max = 2 + extract_types = list(/obj/item/slime_extract/rainbow) + display_path = /obj/item/slime_extract/rainbow + +/// Crossbreeds, priced by the colour of the slime that made them. Self-sustaining +/// ones split on the spot and are never offered whole, so they're left out. +/datum/shop_buyback/skunk/crossbred + name = "crossbred extract" + desc = "Any crossbreed off a common slime. Ten extracts went into each, which is the part Boffin respects." + category = "Slime Extracts" + item_path = /obj/item/slimecross + pay_credits = 450 + demand_min = 2 + demand_max = 3 + /// Slime colours (SLIME_TYPE_*) this row takes + var/list/colours = list( + SLIME_TYPE_GREY, + SLIME_TYPE_ORANGE, + SLIME_TYPE_PURPLE, + SLIME_TYPE_BLUE, + SLIME_TYPE_METAL, + SLIME_TYPE_YELLOW, + SLIME_TYPE_DARK_PURPLE, + SLIME_TYPE_DARK_BLUE, + SLIME_TYPE_SILVER, + ) + /// Crossbreed whose sprite the ledger shows + var/obj/item/display_path = /obj/item/slimecross/stabilized/grey + +/datum/shop_buyback/skunk/crossbred/New() + ..() + buyback_use_display_icon(src, display_path) + +/datum/shop_buyback/skunk/crossbred/buyback_wanted_kind(obj/item/offered) + if(!istype(offered, /obj/item/slimecross) || istype(offered, /obj/item/slimecross/selfsustaining)) + return FALSE + var/obj/item/slimecross/cross = offered + return cross.colour in colours + +/datum/shop_buyback/skunk/crossbred/matches(obj/item/offered) + if(!..()) + return FALSE + return buyback_wanted_kind(offered) && buyback_goods_loose(offered) + +/datum/shop_buyback/skunk/crossbred/get_denial_reason(mob/living/user) + return buyback_listed_denial(src, user) + +/datum/shop_buyback/skunk/crossbred/rare + name = "rare crossbred extract" + desc = "A crossbreed off a rare slime, up to rainbow. Stabilized ones especially; he wears three." + pay_credits = 0 + pay_vouchers = 1 + demand_min = 1 + demand_max = 3 + colours = list( + SLIME_TYPE_BLUESPACE, + SLIME_TYPE_SEPIA, + SLIME_TYPE_CERULEAN, + SLIME_TYPE_PYRITE, + SLIME_TYPE_RED, + SLIME_TYPE_GREEN, + SLIME_TYPE_PINK, + SLIME_TYPE_GOLD, + SLIME_TYPE_OIL, + SLIME_TYPE_BLACK, + SLIME_TYPE_LIGHT_PINK, + SLIME_TYPE_ADAMANTINE, + SLIME_TYPE_RAINBOW, + ) + display_path = /obj/item/slimecross/stabilized/rainbow /datum/shop_buyback/skunk/bluespace_crystal name = "bluespace crystals" diff --git a/voidcrew/modules/trade/shop_catalog_suit_vendor.dm b/voidcrew/modules/trade/shop_catalog_suit_vendor.dm index 5563133983a..b1a65516c61 100644 --- a/voidcrew/modules/trade/shop_catalog_suit_vendor.dm +++ b/voidcrew/modules/trade/shop_catalog_suit_vendor.dm @@ -22,10 +22,11 @@ * - The core shelf is the ladder spine; the rotating and rare pools carry the * breadth, so a round shows a slice of ~200 modules rather than all of them. * Plating rotates on purpose: which themes you can BUILD varies by round. - * - Buybacks are credits-only and deliberately narrow. Modules, frame parts - * and plating are all mechfab-printable, so buying them back would be a - * money loop for any crew with a fabricator. Wick only buys things no lathe - * makes: dead cores and whole salvaged suits. + * - Buybacks stay narrow. Frame parts, plating and the common modules are + * mechfab-printable, so buying them back would be a money loop for any crew + * with a fabricator. Wick buys dead cores, whole suits (by theme: only the + * unprintable combat themes pay vouchers), anomaly modules with a field core + * seated, and the handful of modules no lathe or shelf supplies. */ // ========================================================================= @@ -189,11 +190,37 @@ /datum/shop_sku/fitter/rare/mod_projectile_dampener, /datum/shop_sku/fitter/rare/bomb_suit, ) - // Credits only, and only things no fabricator makes: dead cores and whole - // suits off whoever stopped needing them + // Dead cores and whole suits off whoever stopped needing them, the rare + // suits and modules by name. Keep scrap_control ahead of the rare suit rows: + // get_counter_value() prices the salvaged-suit contract off the first match. buyback_types = list( /datum/shop_buyback/fitter/broken_core, /datum/shop_buyback/fitter/scrap_control, + /datum/shop_buyback/fitter/rare_suit/civilian, + /datum/shop_buyback/fitter/rare_suit/cosmohonk, + /datum/shop_buyback/fitter/rare_suit/engineering, + /datum/shop_buyback/fitter/rare_suit/medical, + /datum/shop_buyback/fitter/rare_suit/atmospheric, + /datum/shop_buyback/fitter/rare_suit/loader, + /datum/shop_buyback/fitter/rare_suit/mining, + /datum/shop_buyback/fitter/rare_suit/research, + /datum/shop_buyback/fitter/rare_suit/rescue, + /datum/shop_buyback/fitter/rare_suit/security, + /datum/shop_buyback/fitter/rare_suit/prototype, + /datum/shop_buyback/fitter/rare_suit/advanced, + /datum/shop_buyback/fitter/rare_suit/responsory, + /datum/shop_buyback/fitter/rare_suit/syndicate, + /datum/shop_buyback/fitter/rare_suit/safeguard, + /datum/shop_buyback/fitter/rare_suit/interdyne, + /datum/shop_buyback/fitter/rare_suit/infiltrator, + /datum/shop_buyback/fitter/rare_suit/elite, + /datum/shop_buyback/fitter/rare_suit/magnate, + /datum/shop_buyback/fitter/rare_suit/enchanted, + /datum/shop_buyback/fitter/rare_suit/spider_clan, + /datum/shop_buyback/fitter/anomaly_module, + /datum/shop_buyback/fitter/anomaly_module/teleporter, + /datum/shop_buyback/fitter/rare_module, + /datum/shop_buyback/fitter/rare_module/combat, /datum/shop_buyback/fitter/salvage_spacesuit, /datum/shop_buyback/fitter/salvage_space_helmet, ) @@ -899,9 +926,12 @@ // ========================================================================= // WICK'S SALVAGE BENCH (buybacks) -// Credits only, and nothing a fabricator prints. Modules, frame parts and -// plating are all MECHFAB designs. Buying those back would be a money loop -// for any crew with an exosuit fabricator, so Wick doesn't take them. +// Nothing a fabricator prints pays more than scrap. Frame parts, plating and +// most modules are MECHFAB designs, so Wick doesn't take them loose. Whole +// suits are priced theme by theme: printable work themes pay little more than +// their materials, the rest about a quarter of shelf price, and the unprintable +// combat themes vouchers (well under the black market's voucher prices). A suit +// mapped aboard a player hull, or a theme with no row, only sells as scrap. // ========================================================================= /datum/shop_buyback/fitter/broken_core @@ -914,11 +944,11 @@ demand_max = 3 /datum/shop_buyback/fitter/scrap_control - name = "MOD control unit (any)" - desc = "A whole suit with its core seated, working or not, modules included. Wick strips it to the frame and asks nothing about the previous owner." + name = "scrap MODsuit" + desc = "Any other suit with its core seated, working or not. Wick strips it to the frame and asks nothing about the previous owner." category = "Suit Salvage" item_path = /obj/item/mod/control - pay_credits = 500 + pay_credits = 100 demand_min = 2 demand_max = 3 @@ -929,12 +959,348 @@ * * It also has to have a core. A frame and plating print for about 100 cr, so a * coreless unit was a money loop: sell it, wrench the core out of the next one. + * For the same reason the core can't be shop stock (Wick's shelf, cargo). */ /datum/shop_buyback/fitter/scrap_control/matches(obj/item/offered) if(!..()) return FALSE var/obj/item/mod/control/suit = offered - return isnull(suit.wearer) && !isnull(suit.core) + if(!isnull(suit.wearer) || isnull(suit.core) || is_trader_good(suit.core)) + return FALSE + // A rare theme goes to its own row; the ship's own suits still sell here as scrap + return suit.buyback_hull_issue || !buyback_rare_mod_theme(suit) + +/// Every theme that has its own row on Wick's bench, built from the rows themselves. +GLOBAL_LIST_INIT(fitter_suit_row_themes, init_fitter_suit_row_themes()) + +/proc/init_fitter_suit_row_themes() + var/list/themes = list() + for(var/row_type in subtypesof(/datum/shop_buyback/fitter/rare_suit)) + var/datum/shop_buyback/fitter/rare_suit/row = new row_type + for(var/theme in row.theme_types) + themes[theme] = TRUE + qdel(row) + return themes + +/// Whether a suit's theme belongs to one of Wick's named rows. +/proc/buyback_rare_mod_theme(obj/item/mod/control/suit) + var/theme_type = suit.theme?.type + if(!theme_type) + return FALSE + return !!GLOB.fitter_suit_row_themes[theme_type] + +/** + * A whole suit of one theme. Off a body, core seated, the core not shop stock, + * and not one of the suits the crew's own hull came with. Each theme pays + * roughly a quarter of what a shelf asks for it. Themes whose plating a + * fabricator prints pay little more than the materials. + */ +/datum/shop_buyback/fitter/rare_suit + category = "Suits" + item_path = /obj/item/mod/control + demand_min = 1 + demand_max = 3 + /// The themes this row buys + var/list/theme_types + /// Control unit sprites are picked by theme at runtime, so name the state + var/display_state + +/datum/shop_buyback/fitter/rare_suit/New() + ..() + icon_override = 'icons/obj/clothing/modsuit/mod_clothing.dmi' + icon_state_override = display_state + +/datum/shop_buyback/fitter/rare_suit/buyback_wanted_kind(obj/item/offered) + if(!istype(offered, /obj/item/mod/control)) + return FALSE + var/obj/item/mod/control/suit = offered + return suit.theme && (suit.theme.type in theme_types) + +/datum/shop_buyback/fitter/rare_suit/matches(obj/item/offered) + if(!..()) + return FALSE + if(!buyback_wanted_kind(offered) || offered.buyback_hull_issue || !buyback_goods_loose(offered)) + return FALSE + var/obj/item/mod/control/suit = offered + return isnull(suit.wearer) && !isnull(suit.core) && !is_trader_good(suit.core) + +/datum/shop_buyback/fitter/rare_suit/get_denial_reason(mob/living/user) + return buyback_listed_denial(src, user) + +// Work suits. Civilian, engineering, atmospheric, medical and cosmohonk plating all print. + +/datum/shop_buyback/fitter/rare_suit/civilian + name = "civilian MODsuit" + desc = "The suit every hauler starts in. Wick has a crate of them." + theme_types = list(/datum/mod_theme/civilian) + display_state = "civilian-control" + pay_credits = 100 + demand_min = 2 + demand_max = 4 + +/datum/shop_buyback/fitter/rare_suit/cosmohonk + name = "cosmohonk MODsuit" + desc = "Wick takes it so nobody else has to look at it." + theme_types = list(/datum/mod_theme/cosmohonk) + display_state = "cosmohonk-control" + pay_credits = 100 + demand_max = 2 + +/datum/shop_buyback/fitter/rare_suit/engineering + name = "engineering MODsuit" + desc = "Yellow, scuffed and built to be stood in a fire." + theme_types = list(/datum/mod_theme/engineering) + display_state = "engineering-control" + pay_credits = 150 + +/datum/shop_buyback/fitter/rare_suit/medical + name = "medical MODsuit" + desc = "Clean white plating. Wick wipes it down anyway." + theme_types = list(/datum/mod_theme/medical) + display_state = "medical-control" + pay_credits = 150 + +/datum/shop_buyback/fitter/rare_suit/atmospheric + name = "atmospheric MODsuit" + desc = "Heat-rated plating for people who walk into burning rooms on purpose." + theme_types = list(/datum/mod_theme/atmospheric) + display_state = "atmospheric-control" + pay_credits = 150 + +/datum/shop_buyback/fitter/rare_suit/loader + name = "loader MODsuit" + desc = "Cargo hydraulics. The arms still twitch when it's powered down." + theme_types = list(/datum/mod_theme/loader) + display_state = "loader-control" + pay_credits = 700 + +/datum/shop_buyback/fitter/rare_suit/mining + name = "mining MODsuit" + desc = "Ash-scoured and dented by things with teeth." + theme_types = list(/datum/mod_theme/mining) + display_state = "mining-control" + pay_credits = 900 + +/datum/shop_buyback/fitter/rare_suit/research + name = "research MODsuit" + desc = "Blast plating with a scientist's coffee stains on the inside." + theme_types = list(/datum/mod_theme/research) + display_state = "research-control" + pay_credits = 900 + +/datum/shop_buyback/fitter/rare_suit/rescue + name = "rescue MODsuit" + desc = "Paramedic plating, built to run into a firefight and back out." + theme_types = list(/datum/mod_theme/rescue) + display_state = "rescue-control" + pay_credits = 1000 + +// Armored suits + +/datum/shop_buyback/fitter/rare_suit/security + name = "security MODsuit" + desc = "Red-striped plating with the badge numbers ground off." + theme_types = list(/datum/mod_theme/security) + display_state = "security-control" + pay_credits = 1000 + +/datum/shop_buyback/fitter/rare_suit/prototype + name = "prototype MODsuit" + desc = "An early, heavy model. Collectors want them; nobody wants to wear one." + theme_types = list(/datum/mod_theme/prototype) + display_state = "prototype-control" + pay_credits = 1200 + +/datum/shop_buyback/fitter/rare_suit/advanced + name = "advanced MODsuit" + desc = "A chief engineer's suit. Wick knows three crews who'd kill for it, and one who did." + theme_types = list(/datum/mod_theme/advanced) + display_state = "advanced-control" + pay_credits = 1400 + +/datum/shop_buyback/fitter/rare_suit/responsory + name = "response team MODsuit" + desc = "Emergency response plating. Nobody ever comes to collect it." + theme_types = list(/datum/mod_theme/responsory, /datum/mod_theme/responsory/traitor) + display_state = "responsory-control" + pay_credits = 1500 + +// Combat suits + +/datum/shop_buyback/fitter/rare_suit/syndicate + name = "syndicate MODsuit" + desc = "Blood-red combat plating. Wick files the serials off before anyone asks." + theme_types = list(/datum/mod_theme/syndicate) + display_state = "syndicate-control" + pay_vouchers = 1 + demand_max = 2 + +/datum/shop_buyback/fitter/rare_suit/safeguard + name = "safeguard MODsuit" + desc = "A security chief's suit, still smelling of somebody's cigar." + theme_types = list(/datum/mod_theme/safeguard) + display_state = "safeguard-control" + pay_vouchers = 1 + demand_max = 2 + +/datum/shop_buyback/fitter/rare_suit/interdyne + name = "Interdyne MODsuit" + desc = "Interdyne's black and green. Their lawyers never come looking." + theme_types = list(/datum/mod_theme/interdyne) + display_state = "interdyne-control" + pay_vouchers = 2 + demand_max = 2 + +/datum/shop_buyback/fitter/rare_suit/infiltrator + name = "infiltrator MODsuit" + desc = "Thin, quiet plating. Wick doesn't ask what it was for." + theme_types = list(/datum/mod_theme/infiltrator) + display_state = "infiltrator-control" + pay_vouchers = 2 + demand_max = 2 + +/datum/shop_buyback/fitter/rare_suit/elite + name = "elite MODsuit" + desc = "Black and red assault plating. Wick has buyers who don't haggle." + theme_types = list(/datum/mod_theme/elite) + display_state = "elite-control" + pay_vouchers = 2 + demand_max = 2 + +/datum/shop_buyback/fitter/rare_suit/magnate + name = "magnate MODsuit" + desc = "A captain's suit, gold trim and all." + theme_types = list(/datum/mod_theme/magnate) + display_state = "magnate-control" + pay_vouchers = 2 + demand_max = 2 + +/datum/shop_buyback/fitter/rare_suit/enchanted + name = "enchanted MODsuit" + desc = "It hums in a key Wick doesn't like. He'll take it anyway." + theme_types = list(/datum/mod_theme/enchanted) + display_state = "enchanted-control" + pay_vouchers = 2 + demand_max = 1 + +/datum/shop_buyback/fitter/rare_suit/spider_clan + name = "spider clan suit" + desc = "Wick has only ever seen one in a picture. He'd like to see one on his bench." + theme_types = list(/datum/mod_theme/ninja) + display_state = "ninja-control" + pay_vouchers = 3 + demand_max = 1 + +/** + * An anomaly module with a field core seated. The module prints, so the core + * is what's being paid for, a little over Boffin's price for the bare core. + * Loose modules only: one still installed goes with its suit. + */ +/datum/shop_buyback/fitter/anomaly_module + name = "anomaly module" + desc = "An anti-gravity or kinesis module with its core seated and humming. Wick fits them for crews who can't find a core of their own." + category = "Modules" + item_path = /obj/item/mod/module/anomaly_locked + pay_credits = 1200 + demand_min = 1 + demand_max = 3 + /// Exact module types this row takes + var/list/module_types = list( + /obj/item/mod/module/anomaly_locked/antigrav, + /obj/item/mod/module/anomaly_locked/kinesis, + ) + var/list/module_cache + /// Item whose sprite the ledger shows + var/obj/item/display_path = /obj/item/mod/module/anomaly_locked/antigrav + +/datum/shop_buyback/fitter/anomaly_module/New() + ..() + module_cache = buyback_exact_cache(module_types) + buyback_use_display_icon(src, display_path) + +/datum/shop_buyback/fitter/anomaly_module/buyback_wanted_kind(obj/item/offered) + return module_cache?[offered.type] + +/datum/shop_buyback/fitter/anomaly_module/matches(obj/item/offered) + if(!..()) + return FALSE + if(!buyback_wanted_kind(offered) || offered.buyback_hull_issue || !buyback_goods_loose(offered)) + return FALSE + var/obj/item/mod/module/anomaly_locked/module = offered + return !isnull(module.core) && !is_trader_good(module.core) + +/datum/shop_buyback/fitter/anomaly_module/get_denial_reason(mob/living/user) + return buyback_listed_denial(src, user) + +/datum/shop_buyback/fitter/anomaly_module/teleporter + name = "teleporter module" + desc = "A teleporter module with a bluespace core seated. Wick wants one badly enough to pay in vouchers." + pay_credits = 0 + pay_vouchers = 2 + demand_min = 1 + demand_max = 1 + module_types = list(/obj/item/mod/module/anomaly_locked/teleporter) + display_path = /obj/item/mod/module/anomaly_locked/teleporter + +/** + * Modules no lathe prints and no shelf sells: they come out of rare suits. + * Credits only, since they usually arrive with a suit that already paid. + */ +/datum/shop_buyback/fitter/rare_module + name = "rare module" + desc = "Advanced magboots, night vision, ash plating, the odd syndicate fitting. Things Wick can't order." + category = "Modules" + item_path = /obj/item/mod/module + pay_credits = 400 + demand_min = 2 + demand_max = 4 + /// Exact module types this row takes + var/list/module_types = list( + /obj/item/mod/module/ash_accretion, + /obj/item/mod/module/infiltrator, + /obj/item/mod/module/night, + /obj/item/mod/module/sphere_transform, + /obj/item/mod/module/magboot/advanced, + /obj/item/mod/module/quick_carry/advanced, + /obj/item/mod/module/reagent_scanner/advanced, + /obj/item/mod/module/welding/syndicate, + /obj/item/mod/module/welding/camera_vision, + /obj/item/mod/module/weapon_recall, + /obj/item/mod/module/quick_cuff, + /obj/item/mod/module/shove_blocker/locked, + ) + var/list/module_cache + /// Item whose sprite the ledger shows + var/obj/item/display_path = /obj/item/mod/module/magboot/advanced + +/datum/shop_buyback/fitter/rare_module/New() + ..() + module_cache = buyback_exact_cache(module_types) + buyback_use_display_icon(src, display_path) + +/datum/shop_buyback/fitter/rare_module/buyback_wanted_kind(obj/item/offered) + return module_cache?[offered.type] + +/datum/shop_buyback/fitter/rare_module/matches(obj/item/offered) + if(!..()) + return FALSE + return buyback_wanted_kind(offered) && !offered.buyback_hull_issue && buyback_goods_loose(offered) + +/datum/shop_buyback/fitter/rare_module/get_denial_reason(mob/living/user) + return buyback_listed_denial(src, user) + +/datum/shop_buyback/fitter/rare_module/combat + name = "combat module" + desc = "Energy nets, combat defibrillators, hacking gloves. Wick doesn't fit these for anyone he likes." + pay_credits = 1000 + demand_min = 1 + demand_max = 2 + module_types = list( + /obj/item/mod/module/energy_net, + /obj/item/mod/module/defibrillator/combat, + /obj/item/mod/module/hacker, + ) + display_path = /obj/item/mod/module/energy_net /datum/shop_buyback/fitter/salvage_spacesuit name = "space suit (salvage)" diff --git a/voidcrew/modules/unit_tests/_unit_tests.dm b/voidcrew/modules/unit_tests/_unit_tests.dm index 6fc42885580..b8cf0cc5c10 100644 --- a/voidcrew/modules/unit_tests/_unit_tests.dm +++ b/voidcrew/modules/unit_tests/_unit_tests.dm @@ -53,6 +53,9 @@ #include "voidcrew_bounty_lairs.dm" #include "voidcrew_bounty_outpost.dm" #include "voidcrew_bounty_seams.dm" +#include "voidcrew_buyback_barnaby.dm" +#include "voidcrew_buyback_depot.dm" +#include "voidcrew_buyback_vex.dm" #include "voidcrew_camera_scope.dm" #include "voidcrew_cargo_cart.dm" #include "voidcrew_cargo_docking.dm" diff --git a/voidcrew/modules/unit_tests/voidcrew_buyback_barnaby.dm b/voidcrew/modules/unit_tests/voidcrew_buyback_barnaby.dm new file mode 100644 index 00000000000..ce24c548ba5 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_buyback_barnaby.dm @@ -0,0 +1,123 @@ +/// Halcyon's ledgers (Barnaby, Fern, Pike, Roux): rare goods hit their own +/// entry and never the catch-all, and commons never hit a rare entry. +/datum/unit_test/voidcrew_buyback_halcyon + abstract_type = /datum/unit_test/voidcrew_buyback_halcyon + +/// Fern: prize plants clear a potency bar; under it they go to the farm stand. +/datum/unit_test/voidcrew_buyback_halcyon/fern/Run() + var/datum/shop_buyback/potting/produce/stand = allocate(/datum/shop_buyback/potting/produce) + var/datum/shop_buyback/potting/prize/omega_weed/omega = allocate(/datum/shop_buyback/potting/prize/omega_weed) + var/datum/shop_buyback/potting/prize/holymelon/melon_entry = allocate(/datum/shop_buyback/potting/prize/holymelon) + + var/obj/item/food/grown/cannabis/ultimate/weed = allocate(/obj/item/food/grown/cannabis/ultimate) + TEST_ASSERT_NOTNULL(weed.seed, "Omega weed spawned without a seed") + weed.seed.potency = 60 + TEST_ASSERT(omega.matches(weed), "Fern refused strong omega weed") + TEST_ASSERT(!stand.matches(weed), "Strong omega weed also sold at the farm stand") + weed.seed.potency = 20 + TEST_ASSERT(!omega.matches(weed), "Fern paid vouchers for weak omega weed") + TEST_ASSERT(stand.matches(weed), "Weak omega weed sells nowhere") + + var/obj/item/food/grown/holymelon/melon = allocate(/obj/item/food/grown/holymelon) + melon.seed.potency = 40 + TEST_ASSERT(melon_entry.matches(melon), "Fern refused a good holy melon") + TEST_ASSERT(!stand.matches(melon), "A good holy melon also sold at the farm stand") + + var/obj/item/food/grown/tomato/tomato = allocate(/obj/item/food/grown/tomato) + tomato.seed.potency = 100 + TEST_ASSERT(stand.matches(tomato), "The farm stand refused a tomato") + TEST_ASSERT(!claimed_by_buyback_family(tomato, /datum/shop_buyback/potting/prize), "A plain tomato hit a prize entry") + +/// Pike and Barnaby split the fish: trophies to Pike, everything else to the pot. +/datum/unit_test/voidcrew_buyback_halcyon/fish/Run() + var/datum/shop_buyback/general/fresh_catch/pot = allocate(/datum/shop_buyback/general/fresh_catch) + var/datum/shop_buyback/bait/nessie/nessie_entry = allocate(/datum/shop_buyback/bait/nessie) + var/datum/shop_buyback/bait/moonfish/moon_entry = allocate(/datum/shop_buyback/bait/moonfish) + var/datum/shop_buyback/bait/pike/pike_entry = allocate(/datum/shop_buyback/bait/pike) + var/datum/shop_buyback/bait/armored_pike/armored_entry = allocate(/datum/shop_buyback/bait/armored_pike) + + var/obj/item/fish/fryish/nessie/nessie = allocate(/obj/item/fish/fryish/nessie) + TEST_ASSERT(nessie_entry.matches(nessie), "Pike refused a nessie-fish") + TEST_ASSERT(!pot.matches(nessie), "A nessie-fish went in Barnaby's chowder") + + var/obj/item/fish/moonfish/moonfish = allocate(/obj/item/fish/moonfish) + var/obj/item/fish/moonfish/dwarf/dwarf = allocate(/obj/item/fish/moonfish/dwarf) + TEST_ASSERT(moon_entry.matches(moonfish), "Pike refused a moonfish") + TEST_ASSERT(!pot.matches(moonfish), "A moonfish went in Barnaby's chowder") + TEST_ASSERT(!moon_entry.matches(dwarf), "Pike took a dwarf moonfish as a trophy") + TEST_ASSERT(pot.matches(dwarf), "A dwarf moonfish sells nowhere") + + var/obj/item/fish/pike/armored/armored = allocate(/obj/item/fish/pike/armored) + TEST_ASSERT(armored_entry.matches(armored), "Pike refused an armored pike") + TEST_ASSERT(!pike_entry.matches(armored), "An armored pike also sold as a plain pike") + TEST_ASSERT(!pot.matches(armored), "An armored pike went in Barnaby's chowder") + + var/obj/item/fish/goldfish/goldfish = allocate(/obj/item/fish/goldfish) + TEST_ASSERT(pot.matches(goldfish), "Barnaby refused a goldfish") + TEST_ASSERT(!claimed_by_buyback_family(goldfish, /datum/shop_buyback/bait), "A goldfish hit a trophy entry") + +/// Roux: specials leave the catch-alls, and only real cooking counts. +/datum/unit_test/voidcrew_buyback_halcyon/diner/Run() + var/datum/shop_buyback/diner/home_cooking/wheel = allocate(/datum/shop_buyback/diner/home_cooking) + var/datum/shop_buyback/diner/whole_cake/cakes = allocate(/datum/shop_buyback/diner/whole_cake) + var/datum/shop_buyback/diner/donk_recall/recall = allocate(/datum/shop_buyback/diner/donk_recall) + var/datum/shop_buyback/diner/special/stuffed_legion/legion_entry = allocate(/datum/shop_buyback/diner/special/stuffed_legion) + var/datum/shop_buyback/diner/special/energy_cake/cake_entry = allocate(/datum/shop_buyback/diner/special/energy_cake) + var/datum/shop_buyback/diner/special/gondola_pocket/gondola_entry = allocate(/datum/shop_buyback/diner/special/gondola_pocket) + + var/obj/item/food/stuffedlegion/legion = allocate(/obj/item/food/stuffedlegion) + TEST_ASSERT(!legion_entry.matches(legion), "Roux paid for a stuffed legion nobody cooked") + ADD_TRAIT(legion, TRAIT_FOOD_CHEF_MADE, "unit_test") + TEST_ASSERT(legion_entry.matches(legion), "Roux refused a cooked stuffed legion") + TEST_ASSERT(!wheel.matches(legion), "A stuffed legion also sold as a home-cooked meal") + + var/obj/item/food/cake/birthday/energy/energy_cake = allocate(/obj/item/food/cake/birthday/energy) + ADD_TRAIT(energy_cake, TRAIT_FOOD_CHEF_MADE, "unit_test") + TEST_ASSERT(cake_entry.matches(energy_cake), "Roux refused an energy cake") + TEST_ASSERT(!cakes.matches(energy_cake), "An energy cake also sold as a plain whole cake") + + var/obj/item/food/donkpocket/warm/gondola/gondola = allocate(/obj/item/food/donkpocket/warm/gondola) + ADD_TRAIT(gondola, TRAIT_FOOD_CHEF_MADE, "unit_test") + TEST_ASSERT(gondola_entry.matches(gondola), "Roux refused a warm gondola pocket") + TEST_ASSERT(!recall.matches(gondola), "A gondola pocket also sold as a recalled donk-pocket") + + var/obj/item/food/burger/plain/burger = allocate(/obj/item/food/burger/plain) + ADD_TRAIT(burger, TRAIT_FOOD_CHEF_MADE, "unit_test") + TEST_ASSERT(wheel.matches(burger), "Roux refused a home-cooked burger") + TEST_ASSERT(!claimed_by_buyback_family(burger, /datum/shop_buyback/diner/special), "A plain burger hit a special") + +/// The convoy refills credit entries but never a voucher entry, at every trader. +/datum/unit_test/voidcrew_buyback_halcyon/voucher_demand/Run() + var/list/shop_types = list( + /datum/outpost_shop/black_market, + /datum/outpost_shop/vendor/dregs_bar, + /datum/outpost_shop/vendor/patchup_clinic, + /datum/outpost_shop/vendor/ripperdoc, + /datum/outpost_shop/general, + /datum/outpost_shop/vendor/potting_shed, + /datum/outpost_shop/vendor/bait_shop, + /datum/outpost_shop/vendor/diner, + /datum/outpost_shop/outfitter, + /datum/outpost_shop/vendor/skunkworks, + /datum/outpost_shop/vendor/suit_fitter, + ) + var/voucher_rows = 0 + for(var/shop_type in shop_types) + var/datum/outpost_shop/shop = allocate(shop_type) + var/list/rolled = list() + var/datum/shop_buyback/credit_entry + for(var/datum/shop_buyback/buyback as anything in shop.buybacks) + if(buyback.pay_vouchers > 0) + buyback.demand = max(0, buyback.demand - 1) + rolled[buyback] = buyback.demand + voucher_rows++ + else + credit_entry ||= buyback + if(credit_entry) + credit_entry.demand = 0 + shop.convoy_restock() + for(var/datum/shop_buyback/buyback as anything in rolled) + TEST_ASSERT_EQUAL(buyback.demand, rolled[buyback], "A convoy refilled [buyback.type] at [shop_type]") + if(credit_entry) + TEST_ASSERT(credit_entry.demand > 0, "A convoy stopped refilling credit buybacks at [shop_type]") + TEST_ASSERT(voucher_rows > 0, "No trader has a voucher buyback") diff --git a/voidcrew/modules/unit_tests/voidcrew_buyback_depot.dm b/voidcrew/modules/unit_tests/voidcrew_buyback_depot.dm new file mode 100644 index 00000000000..8c62ee67e36 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_buyback_depot.dm @@ -0,0 +1,162 @@ +// Quartermain Depot buybacks: rare goods reach their own rows and nothing else, +// commons stay on the plain rows. Fork defines compile after tests, so prices +// and colours are never read here, only which row matches what. + +/datum/unit_test/voidcrew_buyback_depot + abstract_type = /datum/unit_test/voidcrew_buyback_depot + +/// A seller to carry the goods: matching only takes loose, carried items. +/datum/unit_test/voidcrew_buyback_depot/proc/seller() + return allocate(/mob/living/carbon/human/consistent, run_loc_floor_bottom_left) + +/datum/unit_test/voidcrew_buyback_depot/sarge/Run() + var/mob/living/carbon/human/user = seller() + var/datum/shop_buyback/salvage = allocate(/datum/shop_buyback/outfitter/salvage_armor) + var/datum/shop_buyback/officer = allocate(/datum/shop_buyback/outfitter/listed/officer_armor) + var/datum/shop_buyback/military = allocate(/datum/shop_buyback/outfitter/listed/military_armor) + var/datum/shop_buyback/service = allocate(/datum/shop_buyback/outfitter/listed/service_arms) + var/datum/shop_buyback/heavy = allocate(/datum/shop_buyback/outfitter/listed/heavy_arms) + var/datum/shop_buyback/arms = allocate(/datum/shop_buyback/outfitter/listed/military_arms) + var/datum/shop_buyback/pieces = allocate(/datum/shop_buyback/outfitter/listed/collector_pieces) + + var/obj/item/marine = allocate(/obj/item/clothing/suit/armor/vest/marine, user) + TEST_ASSERT(military.matches(marine), "Military armor refused a marine vest") + TEST_ASSERT(!salvage.matches(marine), "Plain salvage also bought a marine vest") + TEST_ASSERT(!officer.matches(marine), "Officer's armor bought a marine vest") + + var/obj/item/plain_vest = allocate(/obj/item/clothing/suit/armor/vest, user) + TEST_ASSERT(salvage.matches(plain_vest), "Plain salvage refused a plain vest") + TEST_ASSERT(!military.matches(plain_vest), "Military armor bought a plain vest") + TEST_ASSERT(!officer.matches(plain_vest), "Officer's armor bought a plain vest") + + var/obj/item/hos_coat = allocate(/obj/item/clothing/suit/armor/hos, user) + TEST_ASSERT(officer.matches(hos_coat), "Officer's armor refused a commander's coat") + TEST_ASSERT(!salvage.matches(hos_coat), "Plain salvage also bought a commander's coat") + + // The ship's own kit sells as salvage only + var/obj/item/issued = allocate(/obj/item/clothing/suit/armor/vest/marine, user) + issued.buyback_hull_issue = TRUE + TEST_ASSERT(!military.matches(issued), "Military armor bought a hull's own marine vest") + TEST_ASSERT(salvage.matches(issued), "Plain salvage refused a hull's own marine vest") + + var/obj/item/saw = allocate(/obj/item/gun/ballistic/automatic/l6_saw/unrestricted, user) + TEST_ASSERT(arms.matches(saw), "Military arms refused an L6 SAW") + TEST_ASSERT(!heavy.matches(saw) && !service.matches(saw), "A cheaper row also bought an L6 SAW") + + var/obj/item/toy_saw = allocate(/obj/item/gun/ballistic/automatic/l6_saw/toy/unrestricted/riot, user) + TEST_ASSERT(!arms.matches(toy_saw), "Military arms bought a foam SAW") + + var/obj/item/laser = allocate(/obj/item/gun/energy/laser, user) + TEST_ASSERT(service.matches(laser), "Service arms refused a laser gun") + TEST_ASSERT(!heavy.matches(laser) && !arms.matches(laser) && !pieces.matches(laser), "A rare row bought a plain laser gun") + mark_trader_goods(laser) + TEST_ASSERT(!service.matches(laser), "Service arms bought back a shop laser") + + var/obj/item/practice = allocate(/obj/item/gun/energy/laser/practice, user) + TEST_ASSERT(!service.matches(practice), "Service arms bought a practice laser") + + var/obj/item/club = allocate(/obj/item/melee/cleaving_saw, user) + TEST_ASSERT(pieces.matches(club), "One-of-a-kind pieces refused the cleaving saw") + +/datum/unit_test/voidcrew_buyback_depot/boffin/Run() + var/mob/living/carbon/human/user = seller() + var/datum/shop_buyback/grey_row = allocate(/datum/shop_buyback/skunk/slime_extract) + var/datum/shop_buyback/rare_row = allocate(/datum/shop_buyback/skunk/slime_extract/rare) + var/datum/shop_buyback/rainbow_row = allocate(/datum/shop_buyback/skunk/slime_extract/rainbow) + var/datum/shop_buyback/cross_row = allocate(/datum/shop_buyback/skunk/crossbred) + var/datum/shop_buyback/rare_cross_row = allocate(/datum/shop_buyback/skunk/crossbred/rare) + + var/obj/item/slime_extract/grey = allocate(/obj/item/slime_extract/grey, user) + TEST_ASSERT(grey_row.matches(grey), "Boffin refused a grey extract") + TEST_ASSERT(!rainbow_row.matches(grey) && !rare_row.matches(grey), "A rare extract row bought a grey extract") + + var/obj/item/slime_extract/rainbow = allocate(/obj/item/slime_extract/rainbow, user) + TEST_ASSERT(rainbow_row.matches(rainbow), "Boffin refused a rainbow extract") + TEST_ASSERT(!grey_row.matches(rainbow) && !rare_row.matches(rainbow), "A cheaper row bought a rainbow extract") + rainbow.extract_uses = 0 + TEST_ASSERT(!rainbow_row.matches(rainbow), "Boffin bought a spent rainbow extract") + + var/obj/item/slimecross/stabilized/rainbow/stable_rainbow = allocate(/obj/item/slimecross/stabilized/rainbow, user) + TEST_ASSERT(rare_cross_row.matches(stable_rainbow), "Boffin refused a stabilized rainbow extract") + TEST_ASSERT(!cross_row.matches(stable_rainbow), "The common crossbreed row bought a rainbow crossbreed") + var/obj/item/slimecross/stabilized/grey/stable_grey = allocate(/obj/item/slimecross/stabilized/grey, user) + TEST_ASSERT(cross_row.matches(stable_grey), "Boffin refused a grey crossbreed") + TEST_ASSERT(!rare_cross_row.matches(stable_grey), "The rare crossbreed row bought a grey crossbreed") + + var/datum/shop_buyback/common_cores = allocate(/datum/shop_buyback/skunk/anomaly_core) + var/datum/shop_buyback/rare_cores = allocate(/datum/shop_buyback/skunk/anomaly_core/rare) + var/datum/shop_buyback/raw_rare = allocate(/datum/shop_buyback/skunk/anomaly_core/raw/rare) + + var/obj/item/vortex = allocate(/obj/item/assembly/signaler/anomaly/vortex, user) + TEST_ASSERT(rare_cores.matches(vortex), "Boffin refused a vortex core") + TEST_ASSERT(!common_cores.matches(vortex) && !raw_rare.matches(vortex), "Another core row bought a refined vortex core") + + var/obj/item/flux = allocate(/obj/item/assembly/signaler/anomaly/flux, user) + TEST_ASSERT(common_cores.matches(flux), "Boffin refused a flux core") + TEST_ASSERT(!rare_cores.matches(flux), "The rare core row bought a flux core") + + var/obj/item/raw_anomaly_core/vortex/raw = allocate(/obj/item/raw_anomaly_core/vortex, user) + TEST_ASSERT(raw_rare.matches(raw), "Boffin refused a raw vortex core") + TEST_ASSERT(!rare_cores.matches(raw), "The refined core row bought a raw core") + + // A core refined from a bought raw core is still shop stock + mark_trader_goods(raw) + var/obj/item/refined = raw.create_core(user) + allocated += refined + TEST_ASSERT(is_trader_good(refined), "Refining a bought raw core washed off the shop's stamp") + TEST_ASSERT(!rare_cores.matches(refined), "Boffin bought back a core refined from his own stock") + + // A core seated in a module stays put + var/obj/item/mod/module/anomaly_locked/antigrav/module = allocate(/obj/item/mod/module/anomaly_locked/antigrav, user) + var/obj/item/assembly/signaler/anomaly/grav/seated = allocate(/obj/item/assembly/signaler/anomaly/grav) + seated.forceMove(module) + module.core = seated + TEST_ASSERT(!common_cores.matches(seated), "Boffin pulled a core out of a module") + var/datum/shop_buyback/anomaly_modules = allocate(/datum/shop_buyback/fitter/anomaly_module) + TEST_ASSERT(anomaly_modules.matches(module), "Wick refused an anti-gravity module with its core") + +/datum/unit_test/voidcrew_buyback_depot/wick/Run() + var/mob/living/carbon/human/user = seller() + var/datum/shop_buyback/scrap = allocate(/datum/shop_buyback/fitter/scrap_control) + var/datum/shop_buyback/armored = allocate(/datum/shop_buyback/fitter/rare_suit/security) + var/datum/shop_buyback/syndicate = allocate(/datum/shop_buyback/fitter/rare_suit/syndicate) + var/datum/shop_buyback/elite = allocate(/datum/shop_buyback/fitter/rare_suit/elite) + + var/obj/item/mod/control/elite_suit = allocate(/obj/item/mod/control/pre_equipped/empty/elite, user) + TEST_ASSERT(elite.matches(elite_suit), "Wick refused an elite suit") + TEST_ASSERT(!scrap.matches(elite_suit), "The scrap row also bought an elite suit") + TEST_ASSERT(!syndicate.matches(elite_suit) && !armored.matches(elite_suit), "Another suit row bought an elite suit") + + var/obj/item/mod/control/civilian = allocate(/obj/item/mod/control/pre_equipped/civilian, user) + TEST_ASSERT(!scrap.matches(civilian), "The scrap row bought a civilian suit") + TEST_ASSERT(!elite.matches(civilian) && !armored.matches(civilian) && !syndicate.matches(civilian), "Another suit row bought a civilian suit") + var/datum/shop_buyback/civilian_row = allocate(/datum/shop_buyback/fitter/rare_suit/civilian) + TEST_ASSERT(civilian_row.matches(civilian), "Wick refused a civilian suit") + TEST_ASSERT(!civilian_row.matches(elite_suit), "The civilian row bought an elite suit") + // Every theme row must list at least one theme, and no theme may sit on two rows + var/list/seen = list() + for(var/row_type in subtypesof(/datum/shop_buyback/fitter/rare_suit)) + var/datum/shop_buyback/fitter/rare_suit/row = allocate(row_type) + TEST_ASSERT(length(row.theme_types), "[row_type] lists no theme") + for(var/theme in row.theme_types) + TEST_ASSERT(!seen[theme], "[theme] is on two of Wick's suit rows") + seen[theme] = TRUE + + // The hull's own elite suit only sells as scrap + var/obj/item/mod/control/issued = allocate(/obj/item/mod/control/pre_equipped/empty/elite, user) + issued.buyback_hull_issue = TRUE + TEST_ASSERT(!elite.matches(issued), "Wick paid vouchers for a hull's own elite suit") + TEST_ASSERT(scrap.matches(issued), "The scrap row refused a hull's own elite suit") + + // A suit built around a shop core is scrap nowhere + var/obj/item/mod/control/syndie = allocate(/obj/item/mod/control/pre_equipped/empty/syndicate, user) + TEST_ASSERT(syndicate.matches(syndie), "Wick refused a syndicate suit") + mark_trader_goods(syndie.core) + TEST_ASSERT(!syndicate.matches(syndie), "Wick paid vouchers for a suit around a shop core") + TEST_ASSERT(!scrap.matches(syndie), "The scrap row bought a suit around a shop core") + + var/datum/shop_buyback/rare_modules = allocate(/datum/shop_buyback/fitter/rare_module) + var/obj/item/magboots = allocate(/obj/item/mod/module/magboot/advanced, user) + TEST_ASSERT(rare_modules.matches(magboots), "Wick refused advanced magboots") + var/obj/item/plain_magboots = allocate(/obj/item/mod/module/magboot, user) + TEST_ASSERT(!rare_modules.matches(plain_magboots), "Wick bought printable magboots as a rare module") diff --git a/voidcrew/modules/unit_tests/voidcrew_buyback_vex.dm b/voidcrew/modules/unit_tests/voidcrew_buyback_vex.dm new file mode 100644 index 00000000000..76cb05b12e1 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_buyback_vex.dm @@ -0,0 +1,116 @@ +// Buyback ledgers for Dram, Sawbones and Splice: each rare good lands on its +// rare line and never on the cheap one, and a common good never reaches the +// rare line. Fork defines compile after tests, so trait names are literals. + +/datum/unit_test/voidcrew_buyback_vex_drinks + +/datum/unit_test/voidcrew_buyback_vex_drinks/proc/pour(drink, amount, filler_amount = 0) + var/obj/item/reagent_containers/cup/glass/drinkingglass/glass = allocate(/obj/item/reagent_containers/cup/glass/drinkingglass) + glass.reagents.add_reagent(drink, amount) + if(filler_amount) + glass.reagents.add_reagent(/datum/reagent/water, filler_amount) + return glass + +/datum/unit_test/voidcrew_buyback_vex_drinks/Run() + var/datum/shop_buyback/juice = allocate(/datum/shop_buyback/dregs/cocktail/the_juice) + var/datum/shop_buyback/coffee = allocate(/datum/shop_buyback/dregs/cocktail/hot_ice_coffee) + var/datum/shop_buyback/house = allocate(/datum/shop_buyback/dregs/cocktail/house) + var/datum/shop_buyback/fancy = allocate(/datum/shop_buyback/dregs/cocktail/fancy) + + var/obj/item/juice_glass = pour(/datum/reagent/consumable/ethanol/the_juice, 50) + TEST_ASSERT(juice.matches(juice_glass), "A full glass of The Juice missed its line") + TEST_ASSERT(!house.matches(juice_glass) && !fancy.matches(juice_glass), "The Juice also sold on a credit line") + + var/obj/item/coffee_glass = pour(/datum/reagent/consumable/hot_ice_coffee, 40) + TEST_ASSERT(coffee.matches(coffee_glass), "Hot Ice Coffee missed its line") + TEST_ASSERT(!house.matches(coffee_glass) && !juice.matches(coffee_glass), "Hot Ice Coffee sold on another line") + + var/obj/item/watered = pour(/datum/reagent/consumable/ethanol/the_juice, 20, 30) + TEST_ASSERT(!juice.matches(watered), "Watered-down Juice sold as The Juice") + var/obj/item/splash = pour(/datum/reagent/consumable/ethanol/the_juice, 10) + TEST_ASSERT(!juice.matches(splash), "A splash of The Juice sold as a full glass") + + var/obj/item/blaster = pour(/datum/reagent/consumable/ethanol/gargle_blaster, 50) + TEST_ASSERT(house.matches(blaster), "A Gargle Blaster missed the house cocktail line") + TEST_ASSERT(!juice.matches(blaster) && !coffee.matches(blaster) && !fancy.matches(blaster), "A house cocktail reached a rarer line") + + var/obj/item/neuro = pour(/datum/reagent/consumable/ethanol/neurotoxin, 50) + TEST_ASSERT(fancy.matches(neuro) && !house.matches(neuro), "Neurotoxin landed on the wrong line") + + var/obj/item/bottle = allocate(/obj/item/reagent_containers/cup/glass/bottle/kong) + TEST_ASSERT(!house.matches(bottle), "A bottle sold as a cocktail") + +/datum/unit_test/voidcrew_buyback_vex_organs + +/datum/unit_test/voidcrew_buyback_vex_organs/Run() + var/datum/shop_buyback/donor_heart = allocate(/datum/shop_buyback/clinic/heart) + var/datum/shop_buyback/donor_lungs = allocate(/datum/shop_buyback/clinic/lungs) + var/datum/shop_buyback/species = allocate(/datum/shop_buyback/clinic_exotic/species) + var/datum/shop_buyback/voltaic = allocate(/datum/shop_buyback/clinic_exotic/voltaic_heart) + var/datum/shop_buyback/meridian = allocate(/datum/shop_buyback/clinic_exotic/meridian_heart) + + var/obj/item/organ/heart/ethereal/crystal = allocate(/obj/item/organ/heart/ethereal) + TEST_ASSERT(species.matches(crystal), "An ethereal heart missed the off-world line") + TEST_ASSERT(!donor_heart.matches(crystal), "An ethereal heart also sold as a plain donor heart") + var/obj/item/organ/lungs/plasmaman/bone_lungs = allocate(/obj/item/organ/lungs/plasmaman) + TEST_ASSERT(species.matches(bone_lungs) && !donor_lungs.matches(bone_lungs), "Plasmaman lungs landed on the wrong line") + + var/obj/item/organ/heart/plain = allocate(/obj/item/organ/heart) + TEST_ASSERT(donor_heart.matches(plain), "A plain heart missed the donor line") + TEST_ASSERT(!species.matches(plain) && !voltaic.matches(plain) && !meridian.matches(plain), "A plain heart reached an exotic line") + + var/obj/item/organ/tongue/lizard/printed = allocate(/obj/item/organ/tongue/lizard) + ADD_TRAIT(printed, "printed_organ", INNATE_TRAIT) + TEST_ASSERT(!species.matches(printed), "A limbgrower lizard tongue sold as a donor organ") + + var/obj/item/organ/heart/cybernetic/anomalock/empty = allocate(/obj/item/organ/heart/cybernetic/anomalock) + TEST_ASSERT(!voltaic.matches(empty), "A coreless voltaic shell sold as a cored heart") + var/obj/item/organ/heart/cybernetic/anomalock/prebuilt/cored = allocate(/obj/item/organ/heart/cybernetic/anomalock/prebuilt) + TEST_ASSERT(voltaic.matches(cored), "A cored voltaic heart missed its line") + TEST_ASSERT(!donor_heart.matches(cored), "A voltaic heart sold as a donor heart") + + var/obj/item/organ/heart/cybernetic/meridian/found = allocate(/obj/item/organ/heart/cybernetic/meridian) + TEST_ASSERT(meridian.matches(found) && !donor_heart.matches(found) && !voltaic.matches(found), "The Meridian heart landed on the wrong line") + +/datum/unit_test/voidcrew_buyback_vex_chrome + +/datum/unit_test/voidcrew_buyback_vex_chrome/Run() + var/datum/shop_buyback/fitted = allocate(/datum/shop_buyback/found_chrome/fitted) + var/datum/shop_buyback/pro = allocate(/datum/shop_buyback/found_chrome/pro) + var/datum/shop_buyback/military = allocate(/datum/shop_buyback/found_chrome/military) + var/datum/shop_buyback/legend = allocate(/datum/shop_buyback/found_chrome/legend) + + var/obj/item/organ/ronin = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin) + TEST_ASSERT(military.matches(ronin), "A found Ronin arm missed the military line") + TEST_ASSERT(!pro.matches(ronin) && !fitted.matches(ronin) && !legend.matches(ronin), "A Ronin arm sold on a cheaper line") + + var/obj/item/organ/blade = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/scorch/left) + TEST_ASSERT(pro.matches(blade) && !military.matches(blade), "A single scorch blade landed on the wrong line") + + var/obj/item/organ/pick = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/icepick) + TEST_ASSERT(fitted.matches(pick) && !pro.matches(pick), "A found Icepick landed on the wrong line") + + var/obj/item/organ/bought = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/ronin) + mark_trader_goods(bought) + TEST_ASSERT(!military.matches(bought), "Splice paid vouchers for shop stock") + + var/obj/item/organ/printed = allocate(/obj/item/organ/eyes/robotic/thermals) + for(var/datum/shop_buyback/band as anything in list(fitted, pro, military, legend)) + TEST_ASSERT(!band.matches(printed), "Lathe-printed thermal eyes sold as chrome on [band.type]") + + // Every installable piece fits at most one row on each ripperdoc's ledger, + // found or bought, and Ratchet never pays vouchers. + var/list/all_ware = list() + for(var/ware_type in subtypesof(/obj/item/organ/cyberimp/cyberware) + subtypesof(/obj/item/organ/eyes/robotic/cyberware) + subtypesof(/obj/item/organ/cyberimp/arm/toolkit/cyberware)) + all_ware += allocate(ware_type) + for(var/shop_type in list(/datum/outpost_shop/vendor/ripperdoc, /datum/outpost_shop/vendor/street_doc)) + var/datum/outpost_shop/shop = allocate(shop_type) + for(var/datum/shop_buyback/row as anything in shop.buybacks) + if(shop_type == /datum/outpost_shop/vendor/street_doc) + TEST_ASSERT(!row.pay_vouchers, "[row.type] at the street doc pays vouchers") + for(var/obj/item/organ/found as anything in all_ware) + var/list/hits = list() + for(var/datum/shop_buyback/row as anything in shop.buybacks) + if(row.matches(found)) + hits += row.type + TEST_ASSERT(length(hits) <= 1, "[found.type] fits [length(hits)] rows at [shop_type]: [jointext(hits, ", ")]") diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware.dm index 14d0cd30d71..93e4f6b7c29 100644 --- a/voidcrew/modules/unit_tests/voidcrew_cyberware.dm +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware.dm @@ -496,7 +496,7 @@ var/datum/bank_account/account = allocate(/datum/bank_account, "Burnt chrome test", null, 1, FALSE) id.registered_account = account TEST_ASSERT(seller.put_in_hands(id), "The seller could not hold their ID") - var/datum/shop_buyback/ripperdoc/burnt_chrome/ledger = allocate(/datum/shop_buyback/ripperdoc/burnt_chrome) + var/datum/shop_buyback/burnt_chrome/ledger = allocate(/datum/shop_buyback/burnt_chrome) ledger.demand = 2 var/datum/outpost_shop/vendor/ripperdoc/splice = allocate(/datum/outpost_shop/vendor/ripperdoc) var/takes_burnt = FALSE @@ -504,6 +504,12 @@ if(intake.type == ledger.type) takes_burnt = TRUE TEST_ASSERT(takes_burnt, "Splice doesn't take burnt-out chrome") + var/datum/outpost_shop/vendor/street_doc/ratchet = allocate(/datum/outpost_shop/vendor/street_doc) + var/ratchet_takes_burnt = FALSE + for(var/datum/shop_buyback/intake as anything in ratchet.buybacks) + if(istype(intake, /datum/shop_buyback/burnt_chrome)) + ratchet_takes_burnt = TRUE + TEST_ASSERT(ratchet_takes_burnt, "Ratchet doesn't take burnt-out chrome") for(var/datum/shop_sku/sku as anything in subtypesof(/datum/shop_sku/ripperdoc)) var/price = initial(sku.price_credits) if(price > 0) diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware_npcs.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware_npcs.dm index 64cdace0231..fc7f8a78fbf 100644 --- a/voidcrew/modules/unit_tests/voidcrew_cyberware_npcs.dm +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware_npcs.dm @@ -79,12 +79,14 @@ TEST_ASSERT(!length(loose_chrome()), "A dead NPC left working chrome behind") TEST_ASSERT_EQUAL(scrap_count(), 3, "A dead NPC didn't leave one burnt-out scrap per piece") - // The scrap is no chrome: nothing can install it, and no ledger anywhere buys it. + // The scrap is no chrome: nothing can install it, and only the scrap rows buy it. var/obj/item/burnt_chrome/scrap = locate() in range(6, run_loc_floor_bottom_left) TEST_ASSERT_NOTNULL(scrap, "Fixture: no scrap to offer") TEST_ASSERT(!istype(scrap, /obj/item/organ), "Burnt-out chrome is still an organ") TEST_ASSERT_NULL(scrap.GetComponent(/datum/component/cyberware), "Burnt-out chrome still counts as chrome") for(var/buyback_type in subtypesof(/datum/shop_buyback)) + if(ispath(buyback_type, /datum/shop_buyback/burnt_chrome)) + continue var/datum/shop_buyback/ledger = new buyback_type if(ledger.item_path && ledger.matches(scrap)) TEST_FAIL("[buyback_type] buys burnt-out chrome") diff --git a/voidcrew/modules/unit_tests/voidcrew_resale.dm b/voidcrew/modules/unit_tests/voidcrew_resale.dm index d6be684611a..05752cdbae4 100644 --- a/voidcrew/modules/unit_tests/voidcrew_resale.dm +++ b/voidcrew/modules/unit_tests/voidcrew_resale.dm @@ -186,7 +186,7 @@ var/datum/outpost_shop/vendor/patchup_clinic/clinic = allocate(/datum/outpost_shop/vendor/patchup_clinic) for(var/datum/shop_buyback/intake as anything in clinic.buybacks) TEST_ASSERT(!ispath(intake.item_path, /obj/item/defibrillator), "The clinic still buys defibrillators") - TEST_ASSERT_EQUAL(length(clinic.buybacks), 4, "The clinic lost another intake line") + TEST_ASSERT_EQUAL(length(clinic.buybacks), 7, "The clinic lost another intake line") /datum/unit_test/voidcrew_resale/market_floor/Run() save_economy() From a5743db1297c3c5472a39ea7814bc45ea4ea1545 Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Sun, 15 Nov 2026 18:03:48 -0800 Subject: [PATCH 12/29] Mantis Blades gore: swings, torn arteries, the charged leap, the impaling lunge, the X-slash and the scissor - The blades are drawn as their own pieces: an ordinary hit swings the blade, and only the blade that cut carries blood. - Three quick cuts to one limb open its artery. - Holding the lunge crouches for a longer leap; a kill brings the lunge back. - A two-blade lunge onto someone already hurt impales them, pinned to a wall if one is behind them. - Every third cut with both blades out is an X-slash that staggers. - A scissor finisher on someone helpless, only square on. - Shiv Blades get none of these moves; Scorch Blades light what they cut and half-seal the arteries they open. - Someone a lunge lands on falls over instead of dropping flat. - The Mantis unit tests, wiki rows and gear rating notes. --- tgstation.dme | 12 + tools/gear_catalog/ratings/cyberware.json | 6 +- voidcrew/_DEFINES/mantis_gore.dm | 177 ++++ .../modules/mob/living/carbon/floored_fall.dm | 13 + voidcrew/modules/cyberware/cyberware_anim.dm | 173 +++- voidcrew/modules/cyberware/cyberware_anim2.dm | 4 +- .../modules/cyberware/ware_line_mantis.dm | 22 +- .../modules/cyberware/ware_military_arms.dm | 208 +++- .../mantis_gore/icons/mantis_artery.dmi | Bin 0 -> 23492 bytes .../modules/mantis_gore/icons/mantis_gore.dmi | Bin 0 -> 12624 bytes .../mantis_gore/icons/mantis_gore_large.dmi | Bin 0 -> 997 bytes .../mantis_gore/icons/mantis_gore_reach.dmi | Bin 0 -> 113482 bytes .../mantis_gore/icons/mantis_lefthand.dmi | Bin 0 -> 11499 bytes .../mantis_gore/icons/mantis_righthand.dmi | Bin 0 -> 11215 bytes .../mantis_gore/icons/mantis_swing.dmi | Bin 0 -> 33244 bytes voidcrew/modules/mantis_gore/mantis_blade.dm | 382 +++++++ voidcrew/modules/mantis_gore/mantis_charge.dm | 274 +++++ voidcrew/modules/mantis_gore/mantis_core.dm | 253 +++++ .../modules/mantis_gore/mantis_housing.dm | 236 +++++ voidcrew/modules/mantis_gore/mantis_impale.dm | 602 +++++++++++ .../modules/mantis_gore/mantis_lunge_fx.dm | 509 ++++++++++ voidcrew/modules/mantis_gore/mantis_rig.dm | 568 +++++++++++ .../modules/mantis_gore/mantis_scissor.dm | 348 +++++++ voidcrew/modules/mantis_gore/mantis_swing.dm | 304 ++++++ voidcrew/modules/mantis_gore/mantis_wounds.dm | 90 ++ voidcrew/modules/unit_tests/_unit_tests.dm | 2 + .../unit_tests/voidcrew_cyberware_anim.dm | 17 + .../unit_tests/voidcrew_mantis_gore.dm | 960 ++++++++++++++++++ .../unit_tests/voidcrew_mantis_swing.dm | 181 ++++ wiki/content/cyberware.md | 6 +- 30 files changed, 5293 insertions(+), 54 deletions(-) create mode 100644 voidcrew/_DEFINES/mantis_gore.dm create mode 100644 voidcrew/edits/modules/mob/living/carbon/floored_fall.dm create mode 100644 voidcrew/modules/mantis_gore/icons/mantis_artery.dmi create mode 100644 voidcrew/modules/mantis_gore/icons/mantis_gore.dmi create mode 100644 voidcrew/modules/mantis_gore/icons/mantis_gore_large.dmi create mode 100644 voidcrew/modules/mantis_gore/icons/mantis_gore_reach.dmi create mode 100644 voidcrew/modules/mantis_gore/icons/mantis_lefthand.dmi create mode 100644 voidcrew/modules/mantis_gore/icons/mantis_righthand.dmi create mode 100644 voidcrew/modules/mantis_gore/icons/mantis_swing.dmi create mode 100644 voidcrew/modules/mantis_gore/mantis_blade.dm create mode 100644 voidcrew/modules/mantis_gore/mantis_charge.dm create mode 100644 voidcrew/modules/mantis_gore/mantis_core.dm create mode 100644 voidcrew/modules/mantis_gore/mantis_housing.dm create mode 100644 voidcrew/modules/mantis_gore/mantis_impale.dm create mode 100644 voidcrew/modules/mantis_gore/mantis_lunge_fx.dm create mode 100644 voidcrew/modules/mantis_gore/mantis_rig.dm create mode 100644 voidcrew/modules/mantis_gore/mantis_scissor.dm create mode 100644 voidcrew/modules/mantis_gore/mantis_swing.dm create mode 100644 voidcrew/modules/mantis_gore/mantis_wounds.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_mantis_gore.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_mantis_swing.dm diff --git a/tgstation.dme b/tgstation.dme index 00123864058..115965e704a 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -6704,6 +6704,7 @@ #include "voidcrew\_DEFINES\lich.dm" #include "voidcrew\_DEFINES\lighting.dm" #include "voidcrew\_DEFINES\loot.dm" +#include "voidcrew\_DEFINES\mantis_gore.dm" #include "voidcrew\_DEFINES\maps.dm" #include "voidcrew\_DEFINES\maths.dm" #include "voidcrew\_DEFINES\metrics.dm" @@ -6923,6 +6924,7 @@ #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\carbon\floored_fall.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" @@ -7387,6 +7389,16 @@ #include "voidcrew\modules\loot\uniques\research.dm" #include "voidcrew\modules\loot\uniques\syndicate.dm" #include "voidcrew\modules\loot\uniques\wardrobe.dm" +#include "voidcrew\modules\mantis_gore\mantis_blade.dm" +#include "voidcrew\modules\mantis_gore\mantis_charge.dm" +#include "voidcrew\modules\mantis_gore\mantis_core.dm" +#include "voidcrew\modules\mantis_gore\mantis_housing.dm" +#include "voidcrew\modules\mantis_gore\mantis_impale.dm" +#include "voidcrew\modules\mantis_gore\mantis_lunge_fx.dm" +#include "voidcrew\modules\mantis_gore\mantis_rig.dm" +#include "voidcrew\modules\mantis_gore\mantis_scissor.dm" +#include "voidcrew\modules\mantis_gore\mantis_swing.dm" +#include "voidcrew\modules\mantis_gore\mantis_wounds.dm" #include "voidcrew\modules\metrics\combat_metrics.dm" #include "voidcrew\modules\metrics\economy_metrics.dm" #include "voidcrew\modules\metrics\metrics_helpers.dm" diff --git a/tools/gear_catalog/ratings/cyberware.json b/tools/gear_catalog/ratings/cyberware.json index 87f228139b5..d74071c1d64 100644 --- a/tools/gear_catalog/ratings/cyberware.json +++ b/tools/gear_catalog/ratings/cyberware.json @@ -84,7 +84,7 @@ "group": "Arm weapons and fists", "hash": "b190c2719a5d40f7", "name": "Mantis Blade housing (right)", - "note": "Each housing extends a hardlight blade into the hand (it can't be dropped; retract stows it). An ability, usable from either housing with its blade out, dashes up to 5 tiles to a living target after a 0.3 s wind-up, lands 10 brute (armor applies, wounding) per extended blade on arrival and floors the target for 2 s. The 20 s cooldown is shared by both housings and is spent even if the dash falls short.", + "note": "Each housing extends a hardlight blade into the hand (it can't be dropped; retract stows it). An ability, usable from either housing with its blade out, dashes up to 5 tiles to a living target after a 0.3 s wind-up, lands 10 brute (armor applies, wounding) per extended blade on arrival and floors the target for 2 s; held as a rooted, telegraphed crouch (broken by one 10-damage hit or a stun, costing the full cooldown) it leaps up to 7 tiles. The dash never crosses chasms, lava or space. The 20 s cooldown is shared by both housings and is spent even if the dash falls short; a credited kill of a person or anything with 100+ max health drops it to 3 s, at most once per 8 s, once per body per 2 min. Gore (D31): 3 cuts on one limb within 8 s (5 under cover 15-34, never at 35+) tear its artery; with both blades out every 3rd cut adds a 10 brute follow-through and a 1.5 s stagger; a two-blade lunge into someone at 70% health or down holds them 0.8 s (1.5 s against a wall) and rips out for 2x8 brute; a head swing at someone in crit takes the head off after a 1.2 s interruptible wind-up (Atlas: 25 brute instead).", "rank": 5, "reason": "Half of a pair: 20-force blades that can't be disarmed, plus a 5-tile lunge every 20 s that adds 20 damage and floors the target for 2 s. Load 6 the pair, 4 vouchers at reputation 22, one on the shelf per round.", "tier": "red" @@ -94,7 +94,7 @@ "group": "Arm weapons and fists", "hash": "91733b8b4ac9435a", "name": "Mantis Blade housing (left)", - "note": "Each housing extends a hardlight blade into the hand (it can't be dropped; retract stows it). An ability, usable from either housing with its blade out, dashes up to 5 tiles to a living target after a 0.3 s wind-up, lands 10 brute (armor applies, wounding) per extended blade on arrival and floors the target for 2 s. The 20 s cooldown is shared by both housings and is spent even if the dash falls short.", + "note": "Each housing extends a hardlight blade into the hand (it can't be dropped; retract stows it). An ability, usable from either housing with its blade out, dashes up to 5 tiles to a living target after a 0.3 s wind-up, lands 10 brute (armor applies, wounding) per extended blade on arrival and floors the target for 2 s; held as a rooted, telegraphed crouch (broken by one 10-damage hit or a stun, costing the full cooldown) it leaps up to 7 tiles. The dash never crosses chasms, lava or space. The 20 s cooldown is shared by both housings and is spent even if the dash falls short; a credited kill of a person or anything with 100+ max health drops it to 3 s, at most once per 8 s, once per body per 2 min. Gore (D31): 3 cuts on one limb within 8 s (5 under cover 15-34, never at 35+) tear its artery; with both blades out every 3rd cut adds a 10 brute follow-through and a 1.5 s stagger; a two-blade lunge into someone at 70% health or down holds them 0.8 s (1.5 s against a wall) and rips out for 2x8 brute; a head swing at someone in crit takes the head off after a 1.2 s interruptible wind-up (Atlas: 25 brute instead).", "rank": 6, "reason": "Left half of the Mantis pair: 20-force blades that can't be disarmed, plus a 5-tile lunge every 20 s that adds 20 damage and floors the target for 2 s.", "tier": "red" @@ -124,6 +124,7 @@ "group": "Arm weapons and fists", "hash": "", "name": "Shiv Blade housing (right)", + "note": "No lunge, and none of the Mantis gore moves: its cuts bleed like any knife (no torn arteries, X-slash, impale or scissor).", "rank": 15, "reason": "Half of a pair: 14-force blades that can't be disarmed, no lunge. Load 4 the pair, 2,400 cr at yellow reputation. Splice takes a pulled housing back for 600 cr.", "tier": "yellow" @@ -133,6 +134,7 @@ "group": "Arm weapons and fists", "hash": "", "name": "Shiv Blade housing (left)", + "note": "No lunge, and none of the Mantis gore moves: its cuts bleed like any knife (no torn arteries, X-slash, impale or scissor).", "rank": 16, "reason": "Left half of the Shiv pair: 14-force blades that can't be disarmed, no lunge.", "tier": "yellow" diff --git a/voidcrew/_DEFINES/mantis_gore.dm b/voidcrew/_DEFINES/mantis_gore.dm new file mode 100644 index 00000000000..de955bfb4a8 --- /dev/null +++ b/voidcrew/_DEFINES/mantis_gore.dm @@ -0,0 +1,177 @@ +// Mantis Blades x hyperviolence (voidcrew/modules/mantis_gore/). Balance notes for developers; none of +// these numbers go in player text. + +/// 32x32 pictures: glints, the coil glow, trails, the impale tips, the scorch seam. +#define MANTIS_GORE_ICON 'voidcrew/modules/mantis_gore/icons/mantis_gore.dmi' +/// 64x64 pictures: the flick. +#define MANTIS_GORE_LARGE_ICON 'voidcrew/modules/mantis_gore/icons/mantis_gore_large.dmi' +/// 96x96 pictures of the drops a torn artery throws, for each of the eight ways they fly. The wound is in the +/// middle across and MANTIS_ARTERY_WOUND_RISE pixels above the middle: the drops fall further than they rise. +#define MANTIS_ARTERY_ICON 'voidcrew/modules/mantis_gore/icons/mantis_artery.dmi' +#define MANTIS_ARTERY_WOUND_RISE 16 +/// 96x96 pictures centred on the bearer: the arms and blades of each beat of the impale and the scissor, drawn +/// around the victim by the blade rig (mantis_rig.dm). +#define MANTIS_GORE_REACH_ICON 'voidcrew/modules/mantis_gore/icons/mantis_gore_reach.dmi' +/// Layer for blade drawn in front of the victim (and the bearer). +#define MANTIS_OVER_VICTIM_LAYER ABOVE_MOB_LAYER +/// The posed held blades. +#define MANTIS_LEFTHAND_ICON 'voidcrew/modules/mantis_gore/icons/mantis_lefthand.dmi' +#define MANTIS_RIGHTHAND_ICON 'voidcrew/modules/mantis_gore/icons/mantis_righthand.dmi' +/// Layer for pictures on the blades: just over the held blades (cyberware_anim.dm's swing layer). +#define MANTIS_ANIM_BLADE_LAYER (-(HANDS_LAYER - 0.5)) +/// Layer for pictures over the whole body: over everything it wears. +#define MANTIS_ANIM_TOP_LAYER (-(HIGHEST_LAYER - 0.5)) + +// What a blade of the line can do, on /obj/item/melee/energy/blade/hardlight/cyberware_mantis/var/gore_moves. +/// Repeated cuts on one limb tear its artery. +#define MANTIS_MOVE_ARTERY (1<<0) +/// A two-blade lunge skewers someone already hurt. +#define MANTIS_MOVE_IMPALE (1<<1) +/// A head swing at someone dying takes the head off. +#define MANTIS_MOVE_SCISSOR (1<<2) +/// Every third cut with both blades out is a crossed double slash. +#define MANTIS_MOVE_XSLASH (1<<3) +#define MANTIS_MOVES_ALL (MANTIS_MOVE_ARTERY|MANTIS_MOVE_IMPALE|MANTIS_MOVE_SCISSOR|MANTIS_MOVE_XSLASH) + +// Poses of the held blades. Each is an in-hand state "[base_icon_state]_[pose]". +#define MANTIS_POSE_GUARD "guard" +#define MANTIS_POSE_LUNGE "lunge" +#define MANTIS_POSE_RAISE "raise" +#define MANTIS_POSE_COIL "coil" + +// Fields of mantis_rig_beat(). +#define MANTIS_RIG_ORDER 1 +#define MANTIS_RIG_BEARER_W 2 +#define MANTIS_RIG_BEARER_Z 3 +#define MANTIS_RIG_TARGET_W 4 +#define MANTIS_RIG_TARGET_Z 5 +#define MANTIS_RIG_TILT 6 +#define MANTIS_RIG_RAISE 7 + +/// Trait and offset sources. +#define MANTIS_IMPALE_TRAIT "mantis_impale" +#define MANTIS_CHARGE_TRAIT "mantis_charge" + +/// The wound series of a torn limb artery, so it stacks with ordinary cuts on the same limb. +#define WOUND_SERIES_HV_LIMB_ARTERY "wound_series_hv_limb_artery" + +// ---- Arterial gashes ---- +/// Cuts on one limb add up while each lands within this long of the last. +#define MANTIS_CUT_WINDOW (8 SECONDS) +/// A cut must deal this much brute after armour to count. +#define MANTIS_CUT_MIN_DAMAGE 8 +/// Cuts that tear the artery on a limb covered by less than MANTIS_COVER_LIGHT (after armour penetration). +#define MANTIS_TEAR_CUTS_BARE 3 +/// Cuts that tear it under cover from MANTIS_COVER_LIGHT up to MANTIS_COVER_STOP. +#define MANTIS_TEAR_CUTS_COVERED 5 +#define MANTIS_COVER_LIGHT 15 +/// Cover at or above this never tears. +#define MANTIS_COVER_STOP 35 +/// Blood flow at or above which a torn limb artery spurts. +#define MANTIS_ARTERY_OPEN_FLOW 1.5 + +// ---- Kill credit and the lunge reset ---- +/// A death this long after the bearer's last cut counts as their kill. +#define MANTIS_KILL_CREDIT_WINDOW (5 SECONDS) +/// A kill puts the lunge's cooldown down to this, never lower. +#define MANTIS_KILL_RESET_FLOOR (3 SECONDS) +/// At most one reset per bearer in this long. +#define MANTIS_KILL_RESET_COOLDOWN (8 SECONDS) +/// A body that gave a reset gives no other for this long (revive loops). +#define MANTIS_KILL_RESET_VICTIM_LOCKOUT (2 MINUTES) +/// Anything that isn't a person must have at least this much max health to count. +#define MANTIS_KILL_RESET_MIN_HEALTH 100 + +// ---- X-slash ---- +/// Every this many landed cuts on one target is a crossed double slash. +#define MANTIS_XSLASH_EVERY 3 +/// The count holds while each cut lands within this long of the last. +#define MANTIS_XSLASH_WINDOW (4 SECONDS) +#define MANTIS_XSLASH_STAGGER (1.5 SECONDS) + +// ---- Impaling lunge ---- +#define MANTIS_IMPALE_HOLD (0.8 SECONDS) +#define MANTIS_IMPALE_PIN_HOLD (1.5 SECONDS) +/// Brute per blade when they rip free. +#define MANTIS_IMPALE_RIP_DAMAGE 8 +#define MANTIS_IMPALE_RIP_WOUND_BONUS 15 +/// Damage the bearer can take while holding someone up before they lose the grip. +#define MANTIS_IMPALE_BREAK_DAMAGE 15 +/// A target at or under this share of max health is hurt enough to skewer. +#define MANTIS_IMPALE_HEALTH_FRACTION 0.7 +// The beats of the impale (mantis_impale.dm), from the approved storyboard. The bearer's lunge pose shows +// while the lunging body glides in; the blades go in as it lands, and the hold, the pull-back, the rip and +// the drop follow. Where the two bodies sit in each beat is mantis_rig_beat()'s. +/// The victim sliding onto the blades, after the lunging body lands. +#define MANTIS_IMPALE_CONTACT_BEAT (0.05 SECONDS) +/// From the blades going in to the hoist, held up. Short, so the hold fills the 0.8 s. +#define MANTIS_IMPALE_ENTER_BEAT (0.1 SECONDS) +/// Each step of the hoist from the stab up to the hold, and of the pull-back. +#define MANTIS_IMPALE_STEP (0.05 SECONDS) +#define MANTIS_IMPALE_PULL_STEP (0.1 SECONDS) +/// Held up they sag a pixel this long into the hold, for this long, and once more this long after the first. +#define MANTIS_IMPALE_SAG_AFTER (0.15 SECONDS) +#define MANTIS_IMPALE_SAG_FOR (0.1 SECONDS) +/// Facing south, how high (pixels) the victim is drawn up onto the blades before the bearer's body rises with them, +/// a pixel for a pixel, so the bearer's head and shoulders show over the victim's head. +#define MANTIS_IMPALE_SOUTH_RISE_FROM 14 +#define MANTIS_IMPALE_SAG_EVERY (0.2 SECONDS) +/// From the pull-back to the rip-out. +#define MANTIS_IMPALE_RIP_BEAT (0.2 SECONDS) +/// How long the bearer holds the last pose after the blades are out, before they are drawn as usual again, +/// and how long the body takes to fall from the blades to the floor. +#define MANTIS_IMPALE_DROP_BEAT (0.3 SECONDS) +/// From the pull-back to the blades coming out and the body dropping. +#define MANTIS_IMPALE_PULL_BEAT (0.3 SECONDS) + +/// Pixels under a body's middle that it is tipped about: its feet (mantis_tip_matrix()). +#define MANTIS_TIP_FEET (ICON_SIZE_Y / 2 - 4) + +/// How long the lunging body takes to glide in after it has arrived. The hit shows as it lands. +#define MANTIS_LUNGE_GLIDE 1.5 +/// How long the blade rig's pictures take to fade into the real bearer when a move ends (mantis_rig.dm). +#define MANTIS_RIG_HANDBACK (0.15 SECONDS) + +// ---- Charged leap ---- +/// Held shorter than this, it is the ordinary lunge. +#define MANTIS_CHARGE_TAP (0.35 SECONDS) +/// Held this long, it reaches the furthest. +#define MANTIS_CHARGE_FULL (1.2 SECONDS) +/// Pixels the body sinks into the crouch. +#define MANTIS_CHARGE_CROUCH_DROP 5 +/// Held this long, the bearer gives up and straightens. +#define MANTIS_CHARGE_MAX_HOLD (3 SECONDS) +/// After straightening, this long before they can crouch again. +#define MANTIS_CHARGE_REARM (1 SECONDS) +/// One hit this big while crouched breaks it. +#define MANTIS_CHARGE_BREAK_DAMAGE 10 +/// Extra tiles a full charge reaches over the lunge. +#define MANTIS_CHARGE_EXTRA_RANGE 2 + +// ---- Scissor ---- +#define MANTIS_SCISSOR_WINDUP (1.2 SECONDS) +/// Pixels the bearer leans in for the cut, and further when the head lies on the far side of the body. +/// Drawn by the blade rig; this is the bearer's own lean when the rig can't draw them. +#define MANTIS_SCISSOR_LEAN 12 +#define MANTIS_SCISSOR_FAR_LEAN 16 +/// The scissor's swing: the blades come down from the raise, close on the neck, and shut through it this long apart. +#define MANTIS_SCISSOR_SWING_STEP (0.1 SECONDS) +/// The scissor's beats after the cut: the blades shut through the neck, then the bearer straightens over +/// MANTIS_SCISSOR_STRAIGHTEN. +#define MANTIS_SCISSOR_RECOVER_BEAT (0.25 SECONDS) +#define MANTIS_SCISSOR_STRAIGHTEN (0.25 SECONDS) +#define MANTIS_SCISSOR_COOLDOWN (10 SECONDS) +/// Brute to the neck when the head won't come off. +#define MANTIS_SCISSOR_FALLBACK_DAMAGE 25 +/// Where a head cut off by the scissor is drawn on its tile: pixels out from the middle toward the side the +/// head lay, where the neck was, then where it comes to rest, and how far below the middle. +#define MANTIS_HEAD_ROLL_FROM 7 +#define MANTIS_HEAD_ROLL_TO 11 +#define MANTIS_HEAD_ROLL_DROP 5 + +// ---- Blood on the blades ---- +/// How long a drenched blade drips. +#define MANTIS_DRENCH_TIME (60 SECONDS) +#define MANTIS_DRIP_INTERVAL (1.5 SECONDS) +/// Most drops one drench leaves on the floor. +#define MANTIS_DRIP_MAX 20 diff --git a/voidcrew/edits/modules/mob/living/carbon/floored_fall.dm b/voidcrew/edits/modules/mob/living/carbon/floored_fall.dm new file mode 100644 index 00000000000..3e4796ba2b6 --- /dev/null +++ b/voidcrew/edits/modules/mob/living/carbon/floored_fall.dm @@ -0,0 +1,13 @@ +// tg floors a standing body by laying it down and then picking the side it lies on. For a carbon, lying down +// has already picked a side (lying_angle_on_lying_down()), so the side was picked twice, and half the time the +// second pick was the other one. update_transform() applies a turn straight onto the other side with no tween, +// so half of all knockdowns went flat in a single frame instead of falling. Here the first pick is kept. +// Found on the Mantis lunge's landing (voidcrew/modules/mantis_gore/), true of every knockdown. +/mob/living/carbon/on_floored_start() + on_fall() + if(body_position != STANDING_UP) + return + set_body_position(LYING_DOWN) + // Still upright only if lying down picked nothing: buckled upright, or unable to lie down. + if(!lying_angle) + set_lying_angle(pick(LYING_ANGLE_EAST, LYING_ANGLE_WEST)) diff --git a/voidcrew/modules/cyberware/cyberware_anim.dm b/voidcrew/modules/cyberware/cyberware_anim.dm index 25958330faa..0284e0a0c88 100644 --- a/voidcrew/modules/cyberware/cyberware_anim.dm +++ b/voidcrew/modules/cyberware/cyberware_anim.dm @@ -44,6 +44,8 @@ #define CHROME_ANIM_BLADE_LAYER (-(HANDS_LAYER - 0.5)) /// Layer for arcs, sparks and crackle: over everything the bearer wears. #define CHROME_ANIM_TOP_LAYER (-(HIGHEST_LAYER - 0.5)) +/// The mask on a far arm's picture: the near hand's held item, cut out of it. +#define CHROME_ANIM_ARM_COVER_FILTER "chrome_arm_cover" // ========================================================================= // THE HOLDER @@ -62,15 +64,20 @@ blocks_emissive = EMISSIVE_BLOCK_NONE /// What we are drawn on. var/atom/movable/bearer + /// The arm this is a picture of, "left" or "right", once it is sorted as one arm's (sort_as_arm()). + var/arm_side + /// What the near hand holds while this is the far arm's picture: it is cut out of it. + var/obj/item/arm_cover /obj/effect/abstract/cyberware_anim/Destroy() detach() return ..() /obj/effect/abstract/cyberware_anim/proc/detach() + set_arm_cover(null) if(!bearer) return - UnregisterSignal(bearer, COMSIG_QDELETING) + UnregisterSignal(bearer, list(COMSIG_QDELETING, COMSIG_ATOM_POST_DIR_CHANGE, COMSIG_MOB_UPDATE_HELD_ITEMS)) bearer.vis_contents -= src bearer = null @@ -101,6 +108,109 @@ QDEL_IN(holder, lifetime) return holder +// ========================================================================= +// ONE ARM'S PICTURE +// ========================================================================= + +/** + * Sorts this picture as one of the [side] ("left" or "right") arm's from now on. A picture in vis_contents + * draws over every overlay of its bearer whatever its own float layer, held items included, and pictures draw + * over one another in the order they went in, whatever their float layers. So side on a far arm's picture + * would cover the near arm. Here what the near hand holds is cut out of the far arm's picture with a mask of + * that item's held sprite, for as long as it is drawn in that hand, and the near arm's pictures are put back + * on over it (under_near_arm()). Kept right as the bearer turns and as the hands redraw. The art itself + * leaves out the body where it hides a far arm. + */ +/obj/effect/abstract/cyberware_anim/proc/sort_as_arm(side) + if(QDELETED(bearer) || arm_side || !side) + return + arm_side = side + RegisterSignal(bearer, COMSIG_ATOM_POST_DIR_CHANGE, PROC_REF(on_arm_bearer_changed)) + RegisterSignal(bearer, COMSIG_MOB_UPDATE_HELD_ITEMS, PROC_REF(on_arm_bearer_changed)) + fit_to_facing() + +/// Sorts an arm's picture for the way its bearer faces and what the other hand shows right now. +/obj/effect/abstract/cyberware_anim/proc/fit_to_facing() + if(QDELETED(bearer) || !arm_side) + return + var/far = (bearer.dir == EAST && arm_side == "left") || (bearer.dir == WEST && arm_side == "right") + var/obj/item/near_item = far ? near_held_item() : null + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/near_blade = near_item + // A blade hidden under a picture of its own is not in the hand to be cut out: that picture is in front. + if(istype(near_blade) && world.time < near_blade.inhand_hidden_until) + near_item = null + set_arm_cover(near_item) + if(far) + under_near_arm() + +/** + * Puts the near arm's pictures back on over this far arm's picture: each is taken off its bearer and put + * straight back, in the order they were in. A picture put back in the same tick goes on playing where it was. + */ +/obj/effect/abstract/cyberware_anim/proc/under_near_arm() + var/list/near_pictures + for(var/obj/effect/abstract/cyberware_anim/other in bearer.vis_contents) + if(other.arm_side && other.arm_side != arm_side) + LAZYADD(near_pictures, other) + for(var/obj/effect/abstract/cyberware_anim/other as anything in near_pictures) + bearer.vis_contents -= other + bearer.vis_contents += other + +/// What the bearer holds in the hand on the other side from this arm. +/obj/effect/abstract/cyberware_anim/proc/near_held_item() + var/mob/living/holder = bearer + if(!isliving(holder)) + return null + for(var/obj/item/held in holder.held_items) + if(IS_LEFT_INDEX(holder.get_held_index_of_item(held)) != (arm_side == "left")) + return held + return null + +/// Cuts [item]'s held sprite out of this picture, or nothing out of it if null. +/obj/effect/abstract/cyberware_anim/proc/set_arm_cover(obj/item/item) + if(arm_cover) + UnregisterSignal(arm_cover, list(COMSIG_MOVABLE_MOVED, COMSIG_QDELETING)) + var/icon/mask = item && cyberware_held_mask(item, bearer) + arm_cover = mask ? item : null + if(arm_cover) + RegisterSignals(arm_cover, list(COMSIG_MOVABLE_MOVED, COMSIG_QDELETING), PROC_REF(on_arm_cover_gone)) + add_filter(CHROME_ANIM_ARM_COVER_FILTER, 1, alpha_mask_filter(icon = mask, flags = MASK_INVERSE)) + else if(arm_side) + remove_filter(CHROME_ANIM_ARM_COVER_FILTER) + +/obj/effect/abstract/cyberware_anim/proc/on_arm_cover_gone(datum/source) + SIGNAL_HANDLER + set_arm_cover(null) + +/obj/effect/abstract/cyberware_anim/proc/on_arm_bearer_changed(datum/source) + SIGNAL_HANDLER + fit_to_facing() + +/** + * The shape [item] has in [holder]'s hand, facing the way [holder] faces now, as a mask: the first frame of + * its held sprite. Null if it has none. Each sprite and facing is made once. + */ +/proc/cyberware_held_mask(obj/item/item, mob/living/holder) + if(!isliving(holder)) + return null + var/index = holder.get_held_index_of_item(item) + if(!index) + return null + var/file = IS_RIGHT_INDEX(index) ? item.righthand_file : item.lefthand_file + var/state = item.inhand_icon_state || item.icon_state + if(!file || !state || !icon_exists(file, state)) + return null + var/static/list/masks = list() + var/list/by_state = masks[file] + if(!by_state) + by_state = list() + masks[file] = by_state + var/key = "[state]-[holder.dir]" + . = by_state[key] + if(!.) + . = icon(file, state, holder.dir, 1) + by_state[key] = . + // ========================================================================= // WORN LOOKS // ========================================================================= @@ -248,13 +358,24 @@ /// The swing state for this housing, or null when the sheet has none. /obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/blade_anim_state(kind) - var/state = "[aug_overlay]_[kind]_[zone == BODY_ZONE_L_ARM ? "left" : "right"]" + var/state = "[aug_overlay]_[kind]_[arm_side()]" return icon_exists(CYBERWARE_ANIM_LARGE_ICON, state) ? state : null /// The swing playing on the bearer right now, if any. /obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/blade_anim() return blade_anim_ref?.resolve() +/// The arm this housing is in, as the art names it. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/arm_side() + return zone == BODY_ZONE_L_ARM ? "left" : "right" + +/// Plays [state] on the bearer for [lifetime] as this arm's picture: side on, the far arm's goes behind the near arm. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/play_blade_anim(state, lifetime) + var/obj/effect/abstract/cyberware_anim/swing = cyberware_anim_play(owner, CYBERWARE_ANIM_LARGE_ICON, state, CHROME_ANIM_BLADE_LAYER, lifetime) + swing?.sort_as_arm(arm_side()) + blade_anim_ref = WEAKREF(swing) + return swing + /// Stops any swing and brings the folded housing back if it was waiting. /obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/stop_blade_anim() qdel(blade_anim()) @@ -270,12 +391,27 @@ if(!state || !owner) return stop_blade_anim() - blade_anim_ref = WEAKREF(cyberware_anim_play(owner, CYBERWARE_ANIM_LARGE_ICON, state, CHROME_ANIM_BLADE_LAYER, BLADE_UNFOLD_TIME)) + play_blade_anim(state, BLADE_UNFOLD_TIME) var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/held_blade = blade if(istype(held_blade)) held_blade.hide_inhand_for(BLADE_UNFOLD_SWING) blade_flash(0.7, BLADE_UNFOLD_SWING) +/** + * The unfold ends on the guard and keeps it under its last sparks, so a blade is drawn while the held blade + * comes back, whenever that reaches the client. If the blade takes another pose or swings while the unfold is + * still on it, the unfold stops, so its guard is never drawn over the new picture, and the held blade shows at + * once unless something else is hiding it for longer. + */ +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/unfold_overtaken(obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade) + var/obj/effect/abstract/cyberware_anim/unfold = blade_anim() + if(isnull(unfold) || unfold.icon_state != blade_anim_state("unfold")) + return FALSE + stop_blade_anim() + if(blade.inhand_hidden_until <= world.time + BLADE_UNFOLD_SWING) + blade.show_inhand() + return TRUE + /** * The blade folds back into the housing. Called once it is stowed; the * folded housing stays see-through until the swing has played. @@ -285,7 +421,7 @@ if(!state || !owner) return stop_blade_anim() - blade_anim_ref = WEAKREF(cyberware_anim_play(owner, CYBERWARE_ANIM_LARGE_ICON, state, CHROME_ANIM_BLADE_LAYER, BLADE_FOLD_TIME)) + play_blade_anim(state, BLADE_FOLD_TIME) fold_hide_until = world.time + BLADE_FOLD_SWING fold_timer = addtimer(CALLBACK(src, PROC_REF(end_fold_hide)), BLADE_FOLD_SWING, TIMER_STOPPABLE) blade_flash(0.5, BLADE_FOLD_SWING) @@ -307,11 +443,20 @@ var/inhand_hidden_until = 0 /obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/hide_inhand_for(duration) + // A longer hide already running (the impale's or the scissor's blade art) is never cut short by a swing. + if(world.time + duration <= inhand_hidden_until) + return inhand_hidden_until = world.time + duration var/mob/holder = loc if(ismob(holder)) holder.update_held_items() - addtimer(CALLBACK(src, PROC_REF(show_inhand)), duration, TIMER_UNIQUE | TIMER_OVERRIDE) + // Each hide ends on its own timer, and a timer ends nothing while a later hide still runs. + addtimer(CALLBACK(src, PROC_REF(inhand_hide_expired)), duration, TIMER_DELETE_ME) + +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/inhand_hide_expired() + if(world.time < inhand_hidden_until) + return + show_inhand() /obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/show_inhand() if(!inhand_hidden_until) @@ -344,6 +489,11 @@ // The swinger's lunge stays; only the picture over the target changes. /obj/item/melee/energy/blade/hardlight/cyberware_mantis/animate_attack(atom/movable/attacker, atom/attacked_atom, animation_type) + // The arm swings the blade (mantis_gore/mantis_swing.dm), and the impact waits for its strike. The swing is the + // picture on its own where there is no impact (a wall), never tg's flying blade beside it. + if(mantis_play_swing(attacker, attacked_atom)) + mantis_swing_impact(attacker, attacked_atom) + return if(!cyberware_play_impact(attacker, attacked_atom, impact_state)) return ..() @@ -356,9 +506,11 @@ /** * A chrome weapon's hit drawn over what it hit: a short slash, flash or * crackle, upright even on someone lying down, and turned to come from the - * attacker's side. Returns the holder, or null if there was nothing to draw on. + * attacker's side. [mirrored] TRUE or FALSE turns it that way instead (the + * Mantis swing turns it by the hand that swung). Returns the holder, or null + * if there was nothing to draw on. */ -/proc/cyberware_play_impact(atom/movable/attacker, atom/attacked_atom, impact_state) +/proc/cyberware_play_impact(atom/movable/attacker, atom/attacked_atom, impact_state, mirrored = null) if(!impact_state || !ismovable(attacked_atom)) return null var/obj/effect/abstract/cyberware_anim/impact = cyberware_anim_play(attacked_atom, CYBERWARE_ANIM_ICON, impact_state, CHROME_ANIM_TOP_LAYER, 0.4 SECONDS, glow = impact_state != "impact_shiv") @@ -366,8 +518,10 @@ return null impact.appearance_flags |= RESET_TRANSFORM // The art swings in from the left; a blow from the right is mirrored, one from above or below either way. - var/direction = get_dir(attacker, attacked_atom) - if((direction & WEST) || (!(direction & EAST) && prob(50))) + if(isnull(mirrored)) + var/direction = get_dir(attacker, attacked_atom) + mirrored = (direction & WEST) || (!(direction & EAST) && prob(50)) + if(mirrored) impact.transform = matrix(-1, 0, 0, 0, 1, 0) return impact @@ -908,3 +1062,4 @@ #undef CHROME_LOOK_WARM #undef CHROME_ANIM_BLADE_LAYER #undef CHROME_ANIM_TOP_LAYER +#undef CHROME_ANIM_ARM_COVER_FILTER diff --git a/voidcrew/modules/cyberware/cyberware_anim2.dm b/voidcrew/modules/cyberware/cyberware_anim2.dm index 819fd06c1d0..483bc87826c 100644 --- a/voidcrew/modules/cyberware/cyberware_anim2.dm +++ b/voidcrew/modules/cyberware/cyberware_anim2.dm @@ -89,7 +89,9 @@ return var/static/list/flash = list(0.4, 0, 0, 0, 0, 0.4, 0, 0, 0, 0, 0.4, 0, 0, 0, 0, 1, 0.6, 0.6, 0.62, 0) target.add_filter(CHROME_FLASH_FILTER, 43, color_matrix_filter(flash)) - animate(target.get_filter(CHROME_FLASH_FILTER), color = COLOR_MATRIX_IDENTITY, time = fade_time) + // Beside whatever else is moving the target: a plain animate() on its filter would end a fall or a shove + // already under way, and they would snap to the floor. + animate(target.get_filter(CHROME_FLASH_FILTER), color = COLOR_MATRIX_IDENTITY, time = fade_time, flags = ANIMATION_PARALLEL) // A rebuild of the target's filters lands on the faded end, not the flash. target.filter_data[CHROME_FLASH_FILTER]["color"] = COLOR_MATRIX_IDENTITY addtimer(CALLBACK(target, TYPE_PROC_REF(/datum, remove_filter), CHROME_FLASH_FILTER), fade_time + 0.5) diff --git a/voidcrew/modules/cyberware/ware_line_mantis.dm b/voidcrew/modules/cyberware/ware_line_mantis.dm index 7d6dea15e45..2505e971bf1 100644 --- a/voidcrew/modules/cyberware/ware_line_mantis.dm +++ b/voidcrew/modules/cyberware/ware_line_mantis.dm @@ -40,7 +40,7 @@ desc = "A dull grey sliver of hardlight with no shine to it. It still cuts." icon_state = "mantis_street" base_icon_state = "mantis_street" - inhand_icon_state = "mantis_street" + inhand_icon_state = "mantis_street_guard" force = 14 /** @@ -52,16 +52,12 @@ desc = "A forearm's length of hardlight gone orange along the edge. The air above it shimmers." icon_state = "mantis_scorch" base_icon_state = "mantis_scorch" - inhand_icon_state = "mantis_scorch" + inhand_icon_state = "mantis_scorch_guard" light_range = 2 light_power = 1 light_color = LIGHT_COLOR_FIRE /// Fire stacks each landed cut puts on its target. var/fire_stacks_per_hit = 2 - /// Set by afterattack() during attack()'s parent call, which only a swing that - /// connected reaches. attack()'s own FALSE can't tell a cut from a pacifist's - /// pulled swing or a signal-skipped one. The Widowline does the same. - var/swing_landed = FALSE // The glow is only for a blade that is out. Stowed inside the housing it is dark. /obj/item/melee/energy/blade/hardlight/cyberware_mantis/scorch/equipped(mob/user, slot, initial = FALSE) @@ -72,24 +68,14 @@ . = ..() set_light_on(FALSE) -/obj/item/melee/energy/blade/hardlight/cyberware_mantis/scorch/attack(mob/living/target, mob/living/user, list/modifiers, list/attack_modifiers) - swing_landed = FALSE +// Only a cut that landed burns (the parent's attack() decides that), never the wielder. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/scorch/on_cut_landed(mob/living/target, mob/living/user) . = ..() - var/landed = swing_landed - swing_landed = FALSE - // Only a cut that landed burns: not a blocked or cancelled swing, not a pulled - // one. Never the wielder, whoever is in the way. - if(. || !landed || QDELETED(target) || target == user) - return // Embers off the cut; the blade's impact is the slash (cyberware_anim2.dm). cyberware_scorch_trail_fx(user, target) if(cyberware_scorch_target(target, fire_stacks_per_hit)) log_combat(user, target, "set alight", src, "(scorch blade)") -/obj/item/melee/energy/blade/hardlight/cyberware_mantis/scorch/afterattack(atom/target, mob/user, list/modifiers, list/attack_modifiers) - . = ..() - swing_landed = TRUE - // ---- Shiv Blades (street) ------------------------------------------------ /** diff --git a/voidcrew/modules/cyberware/ware_military_arms.dm b/voidcrew/modules/cyberware/ware_military_arms.dm index e9dce34f473..eef698851ac 100644 --- a/voidcrew/modules/cyberware/ware_military_arms.dm +++ b/voidcrew/modules/cyberware/ware_military_arms.dm @@ -339,6 +339,10 @@ /// How long a connecting lunge floors its target. Above the module's usual /// 1-1.5s band because the lunge is telegraphed and on a 20 second clock. #define CYBERWARE_MANTIS_LUNGE_KNOCKDOWN (2 SECONDS) +/// How long a shown-line dash (dash_aim) takes per tile: a real run down the line, one tick a step. +#define CYBERWARE_MANTIS_LUNGE_STEP (0.5) +/// How long tg's attack lunge takes to reach its target (do_attack_animation()): the arrival's cut lands no sooner. +#define CYBERWARE_MANTIS_LUNGE_THRUST (0.1 SECONDS) /** * The blade itself: hardlight, ~20 force (cap 22), sharp, wounding. Only @@ -352,9 +356,10 @@ * along the forearm. The organ's worn overlay (the housing with the blade * folded in) hides while the blade is out, see hide_worn_while_deployed. * - * base_icon_state comes along for the ride purely so it cannot disagree with - * icon_state; update_icon_state() only consults it when sword_color_icon is - * set, which it never is here. + * base_icon_state names the blade's model for its held poses: the held sprite + * is "[base_icon_state]_[pose]" (voidcrew/modules/mantis_gore/), the raised + * guard while nothing else is going on. update_icon_state() only consults it + * when sword_color_icon is set, which it never is here. */ /obj/item/melee/energy/blade/hardlight/cyberware_mantis name = "mantis blade" @@ -362,12 +367,41 @@ icon = 'voidcrew/modules/cyberware/icons/cyberware_weapons.dmi' icon_state = "mantis" base_icon_state = "mantis" - inhand_icon_state = "mantis" - lefthand_file = 'voidcrew/modules/cyberware/icons/cyberware_lefthand.dmi' - righthand_file = 'voidcrew/modules/cyberware/icons/cyberware_righthand.dmi' + inhand_icon_state = "mantis_guard" + lefthand_file = MANTIS_LEFTHAND_ICON + righthand_file = MANTIS_RIGHTHAND_ICON force = 20 armour_penetration = 10 wound_bonus = 10 + /// Set by afterattack() during attack()'s parent call, which only a swing that + /// connected reaches. attack()'s own FALSE can't tell a cut from a pacifist's + /// pulled swing or a signal-skipped one. The Widowline does the same. + var/swing_landed = FALSE + +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/attack(mob/living/target, mob/living/user, list/modifiers, list/attack_modifiers) + // A head swing at someone dying is the scissor, not a cut (mantis_gore/mantis_scissor.dm). + if(mantis_swing_taken(target, user)) + return TRUE + swing_landed = FALSE + // What the cut does to the body is read while the hit resolves, so its lines join the attack line. + mantis_watch_cut(target, user) + . = ..() + mantis_unwatch_cut(target) + var/landed = swing_landed + swing_landed = FALSE + // Only a cut that landed counts: not a blocked or cancelled swing, not a pulled + // one. Never the wielder, whoever is in the way. + if(. || !landed || QDELETED(target) || target == user) + return + on_cut_landed(target, user) + +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/afterattack(atom/target, mob/user, list/modifiers, list/attack_modifiers) + . = ..() + swing_landed = TRUE + +/// A swing with this blade connected with [target]. The line's models add to it. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/on_cut_landed(mob/living/target, mob/living/user) + return /** * # Mantis Blades (T3, arms, aug slots, load 3 per arm / 6 the pair) @@ -432,6 +466,9 @@ click_to_activate = TRUE // A stunned, paralysed or bound body, or one with its hands tied, does not lunge. check_flags = AB_CHECK_CONSCIOUS | AB_CHECK_INCAPACITATED | AB_CHECK_IMMOBILE | AB_CHECK_HANDS_BLOCKED + /// Set by a bearer that showed its line before pressing (a bounty NPC's tell): the next press runs down + /// that line to this tile with real movement (dash()) instead of the ordinary lunge. Spent by the press. + var/turf/dash_aim /** * The housings whose blade is out right now and will arrive with the lunge. @@ -472,6 +509,8 @@ lunger.balloon_alert(lunger, "no target!") return FALSE var/mob/living/victim = target + var/turf/aim = dash_aim + dash_aim = null if(victim == lunger || victim.stat == DEAD) lunger.balloon_alert(lunger, "no target!") return FALSE @@ -480,6 +519,9 @@ return FALSE // The blade is about to be used on someone. cyberware_camo_drop(lunger) + // A shown line out of reach is no line: the ordinary lunge + if(aim && (aim.z != lunger.z || get_dist(lunger, aim) > housing.lunge_range)) + aim = null // One lunge clock across both housings: start every mantis_lunge button // this owner has, ours included. for(var/datum/action/cooldown/cyberware/mantis_lunge/lunge_action in get_chrome_wheel_actions(lunger)) @@ -491,40 +533,137 @@ span_boldwarning("[lunger] drops low, mantis blade[both_blades ? "s" : ""] laid flat along [lunger.p_their()] [both_blades ? "arms" : "arm"]!"), span_warning("You coil for the lunge."), ) + // The blades go flat along the arms for the wind-up (mantis_gore/mantis_poses.dm). + mantis_pose_blades(get_extended_housings(), MANTIS_POSE_LUNGE) playsound(lunger, 'sound/items/weapons/sear.ogg', 50, TRUE) - addtimer(CALLBACK(src, PROC_REF(do_lunge), WEAKREF(victim)), housing.lunge_telegraph) + addtimer(CALLBACK(src, PROC_REF(do_lunge), WEAKREF(victim), null, FALSE, aim), housing.lunge_telegraph) return TRUE -/// The dash itself: walk the line to the target with a decoy per tile, -/// stop adjacent, land the bonus cut once per blade and floor them. -/datum/action/cooldown/cyberware/mantis_lunge/proc/do_lunge(datum/weakref/victim_ref) +/// The dash itself: walk the line to the target, stop adjacent, land the bonus +/// cut once per blade and floor them. [range] is how far it may reach (a charged +/// leap reaches further, mantis_gore/mantis_charge.dm); [charged] is TRUE for a +/// leap out of a crouch. With a shown line ([aim], from dash_aim) it runs down +/// that line instead (dash()). +/datum/action/cooldown/cyberware/mantis_lunge/proc/do_lunge(datum/weakref/victim_ref, range, charged = FALSE, turf/aim) var/mob/living/lunger = owner - if(QDELETED(lunger) || lunger.incapacitated || !isturf(lunger.loc)) + if(QDELETED(lunger)) return var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing = organ if(!istype(housing)) return + // The blades go back to the guard however the dash ends. + var/list/posed = get_extended_housings() + if(lunger.incapacitated || !isturf(lunger.loc)) + mantis_pose_blades(posed, MANTIS_POSE_GUARD) + return + if(isnull(range)) + range = housing.lunge_range var/mob/living/victim = victim_ref?.resolve() if(QDELETED(victim) || victim.stat == DEAD) lunger.balloon_alert(lunger, "target lost!") + mantis_pose_blades(posed, MANTIS_POSE_GUARD) return + if(aim) + if(aim.z != lunger.z) + lunger.balloon_alert(lunger, "target lost!") + mantis_pose_blades(posed, MANTIS_POSE_GUARD) + return + INVOKE_ASYNC(src, PROC_REF(dash), lunger, victim_ref, aim, range, charged, posed) + return + // The ordinary lunge: walk the line to the target with a decoy per tile and stop adjacent var/turf/victim_turf = get_turf(victim) - if(!victim_turf || get_dist(lunger, victim_turf) > housing.lunge_range + 1) + if(!victim_turf || get_dist(lunger, victim_turf) > range + 1) lunger.balloon_alert(lunger, "target lost!") + mantis_pose_blades(posed, MANTIS_POSE_GUARD) return playsound(lunger, 'sound/items/weapons/bladeslice.ogg', 60, TRUE) - for(var/turf/step_turf as anything in get_line(get_turf(lunger), victim_turf)) - if(step_turf == get_turf(lunger)) + var/turf/start = get_turf(lunger) + var/list/passed = list() + for(var/turf/step_turf as anything in get_line(start, victim_turf)) + if(step_turf == start) continue if(step_turf == victim_turf) break if(step_turf.is_blocked_turf(exclude_mobs = TRUE)) break - new /obj/effect/temp_visual/decoy/fading/halfsecond(lunger.loc, lunger) + // Never over a drop, into lava or out into space: the dash stops at the edge. + if(mantis_lunge_unsafe_turf(step_turf)) + break + passed += lunger.loc lunger.forceMove(step_turf) + // Hardlight afterimages and a streak down the line, and the body glides into place (mantis_gore/mantis_lunge_fx.dm). + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/lunge_blade = housing.active_item + var/glide = mantis_lunge_dash_fx(lunger, start, passed, charged, istype(lunge_blade) ? lunge_blade.base_icon_state : "mantis") if(!lunger.Adjacent(victim)) lunger.balloon_alert(lunger, "fell short!") + // The blades stay flat while the body is still gliding in. + mantis_lunge_settle(posed, glide) + return + land_lunge(lunger, victim, housing, lunge_blade, charged, posed, start, glide) + +/** + * A shown-line dash (dash_aim, a bounty NPC's tell): a real run down the line it showed, a tile a tick with + * a decoy per tile, up to the tile before `aim`. Anything that stops a walker stops it there: a wall, a + * window, a shut door, a standing body, a stun or a grab. The lunge lands only where the line said: on a + * target still on the marked tile, or one who stepped into its way, next to it where it stops. Anyone who + * stepped off the line is missed. It goes no further than [range] tiles, never over a drop, lava or + * space, and leaves the lunge's afterimages and streak behind it (mantis_gore/mantis_lunge_fx.dm). + * [posed] are the blades laid flat for the wind-up: they go back to the guard however it ends. + */ +/datum/action/cooldown/cyberware/mantis_lunge/proc/dash(mob/living/lunger, datum/weakref/victim_ref, turf/aim, range, charged = FALSE, list/posed) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing = organ + if(!istype(housing)) + mantis_pose_blades(posed, MANTIS_POSE_GUARD) + return + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/lunge_blade = housing.active_item + var/model = istype(lunge_blade) ? lunge_blade.base_icon_state : "mantis" + var/turf/start = get_turf(lunger) + var/turf/stopped_at + var/dash_dir = get_dir(start, aim) + var/steps = 0 + playsound(lunger, 'sound/items/weapons/bladeslice.ogg', 60, TRUE) + for(var/turf/step_turf as anything in get_line(start, aim)) + if(step_turf == start) + continue + if(steps >= range || mantis_lunge_unsafe_turf(step_turf)) + break + if(step_turf == aim || QDELETED(lunger) || lunger.incapacitated || lunger.body_position == LYING_DOWN || !isturf(lunger.loc) || lunger.pulledby?.grab_state > GRAB_PASSIVE) + break + var/blocked = FALSE + for(var/mob/living/body in step_turf) + if(body.density) + blocked = TRUE + break + if(blocked) + stopped_at = step_turf + break + var/turf/from = lunger.loc + lunger.set_glide_size(DELAY_TO_GLIDE_SIZE(CYBERWARE_MANTIS_LUNGE_STEP)) + if(!lunger.Move(step_turf, get_dir(from, step_turf)) || lunger.loc != step_turf) + break + steps++ + // The lunge's wake on the tile it just left: hardlight afterimages and the streak. + mantis_dash_ghost(WEAKREF(lunger), WEAKREF(from), dash_dir, steps / (range + 1), model) + sleep(CYBERWARE_MANTIS_LUNGE_STEP) + if(QDELETED(lunger) || lunger.stat != CONSCIOUS) + mantis_pose_blades(posed, MANTIS_POSE_GUARD) + return + var/mob/living/victim = victim_ref?.resolve() + var/turf/victim_turf = get_turf(victim) + if(QDELETED(victim) || victim.stat == DEAD || (victim_turf != aim && victim_turf != stopped_at) || !lunger.Adjacent(victim)) + lunger.balloon_alert(lunger, "fell short!") + mantis_pose_blades(posed, MANTIS_POSE_GUARD) return + // The run was real movement: the body is already there. + land_lunge(lunger, victim, housing, lunge_blade, charged, posed, null, 0) + +/// The arrival: the bonus cut once per blade, and they go down. [housing] is the housing that lunged and +/// [lunge_blade] its blade, [charged] is TRUE for a leap out of a crouch, and [posed] are the blades laid +/// flat for the wind-up. [from] is where the ordinary lunge set out, for the impale's glide in; a shown-line +/// dash ran here on its own feet and gives none. [glide] is how long the body still takes to glide in +/// (mantis_lunge_dash_fx()): the impact, the knockdown and the blades' return to the guard wait for it, and for +/// the body's thrust at the target when it is already there. +/datum/action/cooldown/cyberware/mantis_lunge/proc/land_lunge(mob/living/lunger, mob/living/victim, obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing, obj/item/melee/energy/blade/hardlight/cyberware_mantis/lunge_blade, charged = FALSE, list/posed, turf/from, glide = 0) // Both housings deployed means both blades arrive. Floored at one: a blade // stowed during the 0.3s telegraph shouldn't eat the whole cooldown for // nothing when the dash still connected. @@ -532,12 +671,17 @@ if(!length(blade_housings)) blade_housings = list(housing) var/blades = length(blade_housings) + // Judged as they arrive, before the arrival cut: someone already hurt or down. + var/skewer = mantis_can_impale(lunger, victim, blade_housings) lunger.face_atom(victim) lunger.do_attack_animation(victim, no_effect = TRUE) - // The blade's own impact over the target (cyberware_anim.dm). - var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/lunge_blade = housing.active_item - cyberware_play_impact(lunger, victim, istype(lunge_blade) ? lunge_blade.impact_state : "impact_mantis") + // The cut lands as the body does, and not before its thrust has reached them. + var/lands_in = max(glide, CYBERWARE_MANTIS_LUNGE_THRUST) + // The blade's own impact over the target (both blades for a pounce), and a burst of light and dust (mantis_gore/mantis_lunge_fx.dm). + mantis_lunge_arrival_fx(lunger, victim, istype(lunge_blade) ? lunge_blade.impact_state : "impact_mantis", charged && blades > 1, lands_in) + // The arrival counts toward the lunger's kill (mantis_gore/mantis_cuts.dm). + mantis_note_hit(victim, lunger) // One armor roll for the arrival, reused per blade. Both land in the same // instant on the same plate, and it keeps the armor message to one line. var/armor_block = victim.run_armor_check(BODY_ZONE_CHEST, MELEE) @@ -552,10 +696,30 @@ sharpness = SHARP_EDGED, ) lunge_fire = max(lunge_fire, blade_housing.lunge_fire_stacks) - victim.Knockdown(housing.lunge_knockdown) if(lunge_fire) cyberware_scorch_target(victim, lunge_fire) - if(blades > 1) + // Both blades into someone already hurt: held up on them, then ripped free (mantis_gore/mantis_impale.dm). + // The knockdown waits for the rip. + if(skewer && !QDELETED(victim) && victim.stat != DEAD && mantis_start_impale(src, lunger, victim, blade_housings, housing.lunge_knockdown, from, charged ? 2 : MANTIS_LUNGE_GLIDE)) + log_combat(lunger, victim, "mantis-lunged and impaled", "mantis blades ([blades] landed)") + playsound(victim, 'sound/effects/wounds/pierce3.ogg', 70, TRUE) + return + // The blades stay flat through the glide and come back to the guard as the body lands, and they go down + // then, with the impact (mantis_gore/mantis_lunge_fx.dm). + mantis_lunge_settle(posed, lands_in) + mantis_lunge_knockdown(victim, housing.lunge_knockdown, lands_in) + if(charged) + if(blades > 1) + victim.visible_message( + span_danger("[lunger] springs at [victim] and shuts both blades on [victim.p_them()], dropping [victim.p_them()]!"), + span_userdanger("[lunger] springs at you. Both blades land at once and your legs go out from under you!"), + ) + else + victim.visible_message( + span_danger("[lunger] springs at [victim], opens [victim.p_them()] up and puts [victim.p_them()] down!"), + span_userdanger("[lunger] springs at you. The blade is already in you, and the floor comes up fast!"), + ) + else if(blades > 1) victim.visible_message( span_danger("[lunger] flickers across the gap and shuts both blades on [victim] like a trap, dropping [victim.p_them()]!"), span_userdanger("[lunger] flickers across the gap. Both blades land at once and your legs go out from under you!"), @@ -565,7 +729,7 @@ span_danger("[lunger] flickers across the gap, opens [victim] up on arrival and puts [victim.p_them()] down!"), span_userdanger("[lunger] flickers across the gap. The blade is already in you, and the floor comes up fast!"), ) - log_combat(lunger, victim, "mantis-lunged", "mantis blades ([blades] landed)") + log_combat(lunger, victim, charged ? "mantis-leapt" : "mantis-lunged", "mantis blades ([blades] landed)") playsound(victim, 'sound/items/weapons/bladeslice.ogg', 70, TRUE) // ========================================================================= @@ -892,6 +1056,8 @@ #undef CYBERWARE_MANTIS_LUNGE_BONUS #undef CYBERWARE_MANTIS_LUNGE_TELEGRAPH #undef CYBERWARE_MANTIS_LUNGE_KNOCKDOWN +#undef CYBERWARE_MANTIS_LUNGE_STEP +#undef CYBERWARE_MANTIS_LUNGE_THRUST #undef CYBERWARE_MONOWIRE_CLEAVE_MULT #undef CYBERWARE_MONOWIRE_BURN #undef CYBERWARE_CALIBER_RONIN diff --git a/voidcrew/modules/mantis_gore/icons/mantis_artery.dmi b/voidcrew/modules/mantis_gore/icons/mantis_artery.dmi new file mode 100644 index 0000000000000000000000000000000000000000..8732265b3a060b79b890562f305b3f36391daf53 GIT binary patch literal 23492 zcmeHv3tWs__wb&Xnl7lJkU~QwM5Q81O)1yplF>zygs5~wCF-FtE)mW-k}gh;B8nm^ zUB)pbryD0Kw;CC8JEjX=r{-JxnHk49@ArQ1|NH&V_nr6u{#w6Z^E`X)+uCdIwf0(T z@25k{9Tp5x)>K9a4Oz6%b|pfJEc~ZP2aJwgg9sj3yH+`Gx7`@LA!tj$_AUO~5DI3Avk+>MJ9EGHGa9Xet>@%lv#y-jyY&aD0}?yU00w4dHgSWP`c-<3Ki)NtfxhlmKu z^2BlZFZ0e!t{*bXg!y#)&o{l$+=F*D=bg;B<3HT+MpLBkp$c4*}dlYdY*=M*RIxMP;5wf-*($`>}R zZ;wm$b1|8mO?iI1yU{$W?A>&A<^6In?Eg?86w=e*7oJ`y8{ViwB^!05QF)3X!322q z(C`~$5*H!DdmoAAQ1uXhOv1fc5r@tD%^#p47;8)Uu3nDDHFth)-EhA$$?l%;Zf9Fw zjDOQ0GSfknw@l>6vzY!VLL4CuR30l_*SbJdl5Bo&UCrITh~|6Z$BHkzqq?9s-ee1u zqGZ#m#x+(%-D33^C)@%JW`Qw;f$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OW&nm-08h zPkM~E4@H5ifUf+nh*ZzMpU&AuEBV{V>P3QY( z*LR1XU5CetSA(8Q^cfPu^}jV%1C1~HW67#=B(H0rLwzfAgufqc5r?MElng>bLLlB3 z&8I30M=Ui8`(4mq5uE@ literal 0 HcmV?d00001 diff --git a/voidcrew/modules/mantis_gore/icons/mantis_gore_large.dmi b/voidcrew/modules/mantis_gore/icons/mantis_gore_large.dmi new file mode 100644 index 0000000000000000000000000000000000000000..39c504a9b1833bbd12b6a06e4b6b419a7363fdf2 GIT binary patch literal 997 zcmeAS@N?(olHy`uVBq!ia0y~yU~~Xs4mP03*$GQm0jd6~kcbkO)Z*l#%z~24{5%GR zid(^91x2ObzXTV2{Q5-8TUYDcne)LLLJck&KX{~b-beE!L(v(Z9Tvtx#+Qw~6y`jd zbYxP9La?T};d+(L7IwPo#+KImIF>kcb{ng1ULldfB%U4>n3Sj0k;^0Ed)9LeixF>W z!-Q^Qb^HAcM-C^3`DIDHbko${@oQ(pUq%MYZ`Njf3>&!_7?=e;T^vIyZoR#GF!!(l z4{Lze2@#n!&Q%8M9?oMDapmt!7N7K0?t*jw(%1Q3A&)qKo*@X1g@^9eI#Ygjp8YDu zL;gPur>tW+)c-j(Etr*oL88}e?u=6J14ffKuzTq2+MZS~!q{QZGO?d&119EF=w_5nV%=N3pHF| zo}tH~+sy3x*tZ9?1u`(4OJLFwYiklLkdSS7-1w{d0uw_+B6ou$SHnS2#)N=}HDUty vxYSt~87?p~#r5d1Fvco??SLr&+TmNvyzSP}UBV%Kb|6ttS3j3^P6KhE6 literal 0 HcmV?d00001 diff --git a/voidcrew/modules/mantis_gore/icons/mantis_gore_reach.dmi b/voidcrew/modules/mantis_gore/icons/mantis_gore_reach.dmi new file mode 100644 index 0000000000000000000000000000000000000000..2b66dba06d8e899a8312fb2ea59f8364c056f7e6 GIT binary patch literal 113482 zcmeFZc{r5s|2BS0Xc6s}6qTqHqAXcPX`3RIY%xY5l@PKoGi_QZ3?gfb$R4tfp~W6T z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QPXSE(6q=*AHly!4nqO@Yt$VmCVPQlnd+x2LfGOlh~ zTG0U_Gx3=iBbtnQ8*;4$$pAC+A#lHv&^5$O9@=@}H3L9%_2j?llg^s!MMF+VwFXw( n#M-O>regeg?Ee7?po?JVo?klmxb%1olpErV=IOM*P4E6Ucuwd= literal 0 HcmV?d00001 diff --git a/voidcrew/modules/mantis_gore/icons/mantis_lefthand.dmi b/voidcrew/modules/mantis_gore/icons/mantis_lefthand.dmi new file mode 100644 index 0000000000000000000000000000000000000000..263155493f3b4f3ab1ed89343d121d554a3dd679 GIT binary patch literal 11499 zcmb8Uby!s0+cvyu1QBi|1W6r0LK*?-5E-RA2c<(&8iqkdFhF2H>5^`xLqJekx^w6b z=@{Z$+|TQ_n&Vc?qhG)3~N?g*Lj}Tx!!B2JtiZeCxIY{46dxG1wlBe;0`1v z1TE|F70%$X>#Jknu4whr!p+Xb-Okwwg1i$mqra29;im|;*`t!v=Nzi>|HfazlAz6k*;0_^97O6 zkucY=2fx3i?Hl*g6?N8dd^l}OH(8B*G_4x>CCsCYfwx%x3CmZu>R-fp#};w7>^ty% z!lj=xC_UfZ3tFj-FHExe#m^Zco5AoM{^Xw`{ikF6Djlp8oR43i^I)_Ntzm|-Xf_rl zno(FrnE9Wd-D?T2u5~NFTe&{TZUWa8k$v78*zImEtIscR`Gx1FVdOaZKHex-st|@# zt`35@%ixM~I^N@(Qz#c5tK{t+b<(ZzSbB!uI-ajLH~y*7Zlcuu@KH=l|99Mef!K=} z{@4{&;Rk+{g5h z!W$*@_$T2L$-gaypA_#bB77{G&A+dCOY*{Z``0@bUrA8D4>GCm(w1-iey&hWUutr3 z@tPzxSkK}~@QDeM1!<2&X6yEZZzCe3DB?xDUPWe*^@SCYrzzgiTsp!!Ncp-HvIo^n zUF@9&pgzaow$Uk86JN9Wyf{qJkx!zGoUa2yj;QaO#@p)MtP{?Z1mofQlp!AV zt%+pfR2MOm%}lO)k;>5?hbOkeMrssEzJX+*Uob)s8u_FbmyhCt--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Z8T5zHMJD=IU!ctl?G0KNKVoT}=e{eltUZP?GM^C5(8s&6v zN+6yi@AHj#jtGhT6QELz4@zLZck5N8BBbh{x2M4Mj4O$xk$zOdoy3Gk{+2ykHyDJ* zyqQAM`F-N30BjdWY!k);xHukCFcFf*A3rVv!0-+X&6ve~_{VRx;VIa6~(G zMj}UM2af2brIf^h0Lq@pJbOKb94)rMpw9t)@jMQwr@II_=3S0B1f)uaR*ZSsz^eI} zV~0XG36vlIdz>qz`vjWj?->bO7CO*GP+RY1;_ePl@En;@|M>`#w%LqE$>ie?VO{cf z=XdZs<~2iRkm(^_0h6DJs6$->!1Nw4y+i~cKUnPZuYU~C&P+ss@ey-L2``I^Xuk3H z$YHP8p4V2OP0&!_*wCEm+f8@M~AST}R8|bq&zzm+2z_ z!(w(z%Uq^Zz40BzAggWM+3(^&%#jmoI&4eL*WffD9W%XY!=uO9dWUrLLOt*rK9=7> zn%_*HP0#eX6xR7Ay*5S4;)~pIFV5E@L_Rr`jAA=~=9}-e{= MANTIS_COVER_STOP) + return 0 + if(cover >= MANTIS_COVER_LIGHT) + return MANTIS_TEAR_CUTS_COVERED + return MANTIS_TEAR_CUTS_BARE + +/// Counts a cut on [limb], and tears its artery when enough have landed. Returns TRUE if it tore. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/mantis_gash(mob/living/carbon/victim, mob/living/user, obj/item/bodypart/limb, damage, attack_direction) + if(damage < MANTIS_CUT_MIN_DAMAGE || victim.stat == DEAD || limb.owner != victim || !limb.can_bleed()) + return FALSE + if(!user.hv_can_land_aimed_crits()) + return FALSE + var/needed = mantis_cuts_to_tear(victim, limb, armour_penetration) + if(!needed) + return FALSE + var/datum/status_effect/mantis_cuts/cuts = victim.has_status_effect(/datum/status_effect/mantis_cuts) + if(isnull(cuts) || cuts.add_cut(limb.body_zone) < needed) + return FALSE + cuts.clear_cuts(limb.body_zone) + return mantis_tear_artery(victim, user, limb, attack_direction) + +/// What the torn artery of [limb] is: the throat and the aorta are #509's own wounds. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/artery_wound_for(obj/item/bodypart/limb) + switch(limb.body_zone) + if(BODY_ZONE_HEAD) + return /datum/wound/slash/flesh/critical/hv_carotid + if(BODY_ZONE_CHEST) + return /datum/wound/pierce/bleed/critical/hv_aorta + return artery_wound_type + +/// Where the artery of [limb] is, as the line names it. +/proc/mantis_artery_place(obj/item/bodypart/limb) + return limb.body_zone == BODY_ZONE_HEAD ? "neck" : limb.plaintext_zone + +/// Tears the artery of [limb]. Returns TRUE if it tore. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/mantis_tear_artery(mob/living/carbon/victim, mob/living/user, obj/item/bodypart/limb, attack_direction) + // A sealed helmet or an armoured collar still saves the throat, as it does from #509's slit throat. + if(limb.body_zone == BODY_ZONE_HEAD) + var/datum/hv_crit/throat/throat = locate() in GLOB.hv_crits + if(throat?.blocked_on_carbon(victim, limb, src)) + return FALSE + var/datum/wound/wound_type = artery_wound_for(limb) + var/datum/wound_pregen_data/pregen = GLOB.all_wound_pregen_data[wound_type] + if(!pregen?.can_be_applied_to(limb, list(WOUND_SLASH))) + return FALSE + // The throat's and the aorta's wounds are #509's and tg's: given the cut's direction they throw tg's wound + // spray along it, a line of blood three tiles long. The tear throws its own drops instead, so they get none. + var/own_wound = ispath(wound_type, /datum/wound/slash/flesh/critical/hv_carotid/limb) + var/datum/wound/torn = hv_crit_apply_wound(limb, wound_type, own_wound ? attack_direction : null, src) + if(!torn) + return FALSE + var/seared = ispath(artery_wound_type, /datum/wound/slash/flesh/critical/hv_carotid/limb/seared) + var/place = mantis_artery_place(limb) + if(seared) + // The throat and aorta wounds are #509's; the heat closes part of them. + if(!istype(torn, /datum/wound/slash/flesh/critical/hv_carotid/limb)) + torn.adjust_blood_flow(-torn.blood_flow * 0.4) + victim.hv_add_hit_line("[victim]'s [place] is seared open to the artery!", HV_LINE_BOLD, "Your [place] is seared open to the artery!", DEFAULT_MESSAGE_RANGE) + else + victim.hv_add_hit_line("The artery in [victim]'s [place] is cut!", HV_LINE_BOLD, "The artery in your [place] is cut!", DEFAULT_MESSAGE_RANGE) + drench(victim) + // What it looks like: one spurt of drops the way the cut went, then the blood runs down the body. + mantis_spurt_fx(victim, limb.body_zone, attack_direction, seared) + mantis_artery_run_fx(victim, limb.body_zone, torn) + log_combat(user, victim, "tore an artery in", src, "([limb.plaintext_zone])") + return TRUE + +// ---- X-slash ----------------------------------------------------------- + +/// Counts a landed cut toward the X-slash. Every third on one target, with both blades out, is one. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/mantis_xslash_count(mob/living/victim, mob/living/user, obj/item/bodypart/limb, attack_direction) + var/datum/mantis_bearer/state = user.get_mantis_state() + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/off_blade + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/held as anything in mantis_held_blades(user, MANTIS_MOVE_XSLASH)) + if(held != src) + off_blade = held + break + if(isnull(off_blade) || !user.hv_can_land_aimed_crits() || victim.stat == DEAD) + state.xslash_count = 0 + return FALSE + if(state.xslash_target?.resolve() != victim || world.time - state.xslash_last > MANTIS_XSLASH_WINDOW) + state.xslash_count = 0 + state.xslash_target = WEAKREF(victim) + state.xslash_last = world.time + state.xslash_count++ + if(state.xslash_count < MANTIS_XSLASH_EVERY) + return FALSE + state.xslash_count = 0 + mantis_xslash(victim, user, off_blade, limb, attack_direction) + return TRUE + +/// The off blade follows through across the first cut, and the target reels. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/mantis_xslash(mob/living/victim, mob/living/user, obj/item/melee/energy/blade/hardlight/cyberware_mantis/off_blade, obj/item/bodypart/limb, attack_direction) + var/zone = limb ? limb.body_zone : BODY_ZONE_CHEST + var/place = limb ? limb.plaintext_zone : "body" + // The attack line being held for this hit becomes the crossed slash. + var/datum/hv_hit/hit = victim.hv_hit + if(hit?.others_text && hit.attacker == user) + hit.others_text = "[user] crosses both blades through [victim]'s [place]!" + hit.victim_text = "[user] crosses both blades through your [place]!" + if(hit.attacker_text) + hit.attacker_text = "You cross both blades through [victim]'s [place]!" + victim.hv_add_hit_line("[victim] reels!", HV_LINE_BOLD, "You reel!") + var/armour = victim.run_armor_check(zone, MELEE, armour_penetration = off_blade.armour_penetration, silent = TRUE) + victim.apply_damage( + off_blade.force * 0.5, + BRUTE, + limb || zone, + armour, + wound_bonus = 10, + sharpness = SHARP_EDGED, + attack_direction = attack_direction, + attacking_item = off_blade, + ) + if(!QDELETED(victim)) + victim.set_staggered_if_lower(MANTIS_XSLASH_STAGGER) + mantis_xslash_cross(user, victim, off_blade, zone) + log_combat(user, victim, "x-slashed", src) + +// ========================================================================= +// POSES AND THE GLINT +// ========================================================================= + +/// Puts the held blade in [pose] (MANTIS_POSE_*), or back in the guard if this model has no such pose. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/set_mantis_pose(pose = MANTIS_POSE_GUARD) + var/state = "[base_icon_state]_[pose]" + if(pose != MANTIS_POSE_GUARD && !icon_exists(righthand_file, state)) + pose = MANTIS_POSE_GUARD + state = "[base_icon_state]_[pose]" + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing = housing_ref?.resolve() + housing?.set_stance_raise(mantis_stance_raise(pose)) + if(mantis_pose == pose && inhand_icon_state == state) + return + housing?.unfold_overtaken(src) + mantis_pose = pose + inhand_icon_state = state + var/mob/holder = loc + if(ismob(holder)) + holder.update_held_items() + +/// How far the fists ride up in [pose], in pixels. Matches the held sprites. +/proc/mantis_stance_raise(pose) + switch(pose) + if(MANTIS_POSE_RAISE) + return 3 + if(MANTIS_POSE_COIL) + return 1 + return 2 + +/// Puts every blade of [housings] in [pose]. +/proc/mantis_pose_blades(list/housings, pose) + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade as anything in mantis_housing_blades(housings)) + blade.set_mantis_pose(pose) + +/// The hand this blade sits in, as the art names it. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/hand_side() + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing = housing_ref?.resolve() + return housing?.zone == BODY_ZONE_L_ARM ? "left" : "right" + +/// A light runs along the edge, if this model has an edge that catches the light in [pose]. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/play_glint(pose = mantis_pose) + var/mob/living/holder = loc + if(!isliving(holder) || !holder.is_holding(src)) + return null + var/state = "[base_icon_state]_[pose]_glint_[hand_side()]" + if(!icon_exists(MANTIS_GORE_ICON, state)) + return null + var/obj/effect/abstract/cyberware_anim/glint = cyberware_anim_play(holder, MANTIS_GORE_ICON, state, MANTIS_ANIM_BLADE_LAYER, 0.3 SECONDS, glow = TRUE) + // Side on, the far blade's light stays behind the near blade. + glint?.sort_as_arm(hand_side()) + return glint + +// ========================================================================= +// BLOOD +// ========================================================================= + +/// Whether there is blood on the blade to show. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/is_bloody() + return !(item_flags & NO_BLOOD_ON_ITEM) && GET_ATOM_BLOOD_DECAL_LENGTH(src) + +/// A kill, a torn artery, a rip, the scissor or the X-slash: the blade runs red with [source]'s blood and drips +/// for a while. Only the blade that did it: the other keeps whatever it had. +/// [light]: the steel that went through is bloodied (the lighter coat), not soaked: the impale and the scissor, +/// so the held blade matches the one the finisher drew. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/drench(mob/living/source, light = FALSE) + if(item_flags & NO_BLOOD_ON_ITEM) + return FALSE + if(isliving(source) && source.can_bleed(BLOOD_COVER_ITEMS) == BLEED_SPLATTER) + add_mob_blood(source) + if(!is_bloody()) + return FALSE + drenched_until = world.time + MANTIS_DRENCH_TIME + if(!light) + soaked_until = drenched_until + drips_left = MANTIS_DRIP_MAX + if(!drip_timer) + drip_timer = addtimer(CALLBACK(src, PROC_REF(drip)), MANTIS_DRIP_INTERVAL, TIMER_STOPPABLE|TIMER_DELETE_ME) + refresh_held() + return TRUE + +/// One drop off the blade onto the floor under its wielder, while it is still drenched. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/drip() + drip_timer = null + if(world.time >= drenched_until || drips_left <= 0 || !is_bloody()) + stop_dripping() + return + var/mob/living/holder = loc + if(isliving(holder) && holder.is_holding(src) && isturf(holder.loc)) + var/turf/floor = holder.loc + if(!isgroundlessturf(floor) && floor.has_gravity()) + var/list/blood_dna = blood_dna_copy() + var/obj/effect/decal/cleanable/blood/drip/drop = locate() in floor + if(drop) + drop.add_blood_DNA(blood_dna) + else + new /obj/effect/decal/cleanable/blood/drip(floor, null, blood_dna) + drips_left-- + drip_timer = addtimer(CALLBACK(src, PROC_REF(drip)), MANTIS_DRIP_INTERVAL, TIMER_STOPPABLE|TIMER_DELETE_ME) + +/// The blade stops dripping. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/stop_dripping() + if(drip_timer) + deltimer(drip_timer) + drip_timer = null + var/was_drenched = drenched_until + drenched_until = 0 + soaked_until = 0 + drips_left = 0 + if(was_drenched) + refresh_held() + +/// The blood on the blade, as a list of its own (a decal keeps the list it is given). +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/blood_dna_copy() + var/list/blood_dna = GET_ATOM_BLOOD_DNA(src) + return blood_dna ? blood_dna.Copy() : list() + +/// The held sprite redraws. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/refresh_held() + var/mob/holder = loc + if(ismob(holder)) + holder.update_held_items() + +/// The blade is back in its housing: the guard, and no more drops. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/mantis_stowed() + stop_dripping() + mantis_pose = MANTIS_POSE_GUARD + inhand_icon_state = "[base_icon_state]_[MANTIS_POSE_GUARD]" + +// tg's item blood is drawn on the item only. In the hand, a coat of blood drawn for the pose, heavier and +// dripping while drenched. Drawn as its own state: an inset overlay inside a whole body masks against the +// body, not the blade. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/worn_overlays(mutable_appearance/standing, isinhands = FALSE, icon_file) + . = ..() + if(!isinhands || !is_bloody()) + return + var/blood_color = get_blood_dna_color() + var/drenched = world.time < drenched_until + var/coat_state = "[standing.icon_state]_[world.time < soaked_until ? "soak" : "blood"]" + if(icon_exists(icon_file, coat_state)) + var/mutable_appearance/coat = mutable_appearance(icon_file, coat_state, appearance_flags = RESET_COLOR) + coat.color = blood_color + . += coat + if(drenched && icon_exists(icon_file, "[standing.icon_state]_drip")) + var/mutable_appearance/drops = mutable_appearance(icon_file, "[standing.icon_state]_drip", appearance_flags = RESET_COLOR) + drops.color = blood_color + . += drops diff --git a/voidcrew/modules/mantis_gore/mantis_charge.dm b/voidcrew/modules/mantis_gore/mantis_charge.dm new file mode 100644 index 00000000000..548799fb2a3 --- /dev/null +++ b/voidcrew/modules/mantis_gore/mantis_charge.dm @@ -0,0 +1,274 @@ +// The charged leap. With the lunge armed, press and hold on a target: past a short tap the bearer sinks +// into a crouch, rooted, blades swept back and glowing brighter the longer they hold. Release to pounce, +// further for a longer hold. A tap is still the ordinary lunge. One solid hit or a stun knocks them out +// of the crouch and costs the whole cooldown; holding too long they straighten up on their own. +// +// The input is tg's hold pattern (full-auto, the Justice mech): the armed button listens to its +// bearer's client for the press and the release. AI bearers, with no client, only ever tap. + +/datum/action/cooldown/cyberware/mantis_lunge + /// The client the armed button listens to. + var/client/charge_client + /// world.time the press began, or 0. + var/charge_started = 0 + /// Who the press was on. + var/datum/weakref/charge_target + /// TRUE once the crouch shows. + var/crouched = FALSE + /// The body crouched, so it is stood up again even if the button has moved on. + var/datum/weakref/crouch_body + /// The glow on each blade while crouched. + var/list/datum/weakref/crouch_glows + /// Timer of the crouch showing. + var/charge_timer + /// Timer of the next crouch check. + var/crouch_tick_timer + +/datum/action/cooldown/cyberware/mantis_lunge/set_click_ability(mob/on_who) + . = ..() + listen_for_charge(on_who) + +/datum/action/cooldown/cyberware/mantis_lunge/unset_click_ability(mob/on_who, refund_cooldown = TRUE) + stop_listening_for_charge() + cancel_charge() + return ..() + +/datum/action/cooldown/cyberware/mantis_lunge/Remove(mob/removed_from) + stop_listening_for_charge() + cancel_charge() + impale?.finish() + return ..() + +/datum/action/cooldown/cyberware/mantis_lunge/Destroy() + stop_listening_for_charge() + cancel_charge() + impale?.finish() + impale = null + return ..() + +/datum/action/cooldown/cyberware/mantis_lunge/proc/listen_for_charge(mob/on_who) + stop_listening_for_charge() + if(isnull(on_who?.client)) + return + charge_client = on_who.client + RegisterSignal(charge_client, COMSIG_CLIENT_MOUSEDOWN, PROC_REF(on_mouse_down)) + +/datum/action/cooldown/cyberware/mantis_lunge/proc/stop_listening_for_charge() + if(isnull(charge_client)) + return + UnregisterSignal(charge_client, list(COMSIG_CLIENT_MOUSEDOWN, COMSIG_CLIENT_MOUSEUP)) + charge_client = null + +/datum/action/cooldown/cyberware/mantis_lunge/proc/on_mouse_down(client/source, atom/object, turf/location, control, params) + SIGNAL_HANDLER + var/list/modifiers = params2list(params) + if(!LAZYACCESS(modifiers, LEFT_CLICK) || LAZYACCESS(modifiers, SHIFT_CLICK) || LAZYACCESS(modifiers, CTRL_CLICK) || LAZYACCESS(modifiers, ALT_CLICK)) + return + if(owner?.click_intercept != src || !isliving(object)) + return + INVOKE_ASYNC(src, PROC_REF(begin_charge), object) + +/datum/action/cooldown/cyberware/mantis_lunge/proc/on_mouse_up(client/source, atom/object, turf/location, control, params) + SIGNAL_HANDLER + UnregisterSignal(source, COMSIG_CLIENT_MOUSEUP) + if(!charge_started) + return + if(!crouched) + // A tap: the click that follows is the ordinary lunge. + cancel_charge(rearm = FALSE) + return + INVOKE_ASYNC(src, PROC_REF(release_charge)) + // The crouch was the press: the click that follows it is spent. + return COMPONENT_CLIENT_MOUSEUP_INTERCEPT + +/// How far a leap held for [held] reaches, from a lunge of [base_range]. +/proc/mantis_charge_range(held, base_range) + var/progress = clamp((held - MANTIS_CHARGE_TAP) / (MANTIS_CHARGE_FULL - MANTIS_CHARGE_TAP), 0, 1) + return base_range + round(MANTIS_CHARGE_EXTRA_RANGE * progress, 1) + +/// The press on [target]. Returns TRUE if a charge began. +/datum/action/cooldown/cyberware/mantis_lunge/proc/begin_charge(mob/living/target) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing = organ + var/mob/living/carbon/bearer = owner + if(charge_started || !istype(housing) || !iscarbon(bearer) || !isliving(target)) + return FALSE + if(!IsAvailable() || !housing.blade_extended() || HAS_TRAIT(bearer, TRAIT_PACIFISM)) + return FALSE + if(target == bearer || target.stat == DEAD || bearer.buckled || !isturf(bearer.loc)) + return FALSE + var/datum/mantis_bearer/state = bearer.get_mantis_state() + if(world.time < state.next_charge) + return FALSE + var/reach = housing.lunge_range + MANTIS_CHARGE_EXTRA_RANGE + if(get_dist(bearer, target) > reach || !can_see(bearer, target, reach)) + return FALSE + charge_started = world.time + charge_target = WEAKREF(target) + // The field drops the moment they set themselves, not when they leave the floor. + cyberware_camo_drop(bearer) + charge_timer = addtimer(CALLBACK(src, PROC_REF(enter_crouch)), MANTIS_CHARGE_TAP, TIMER_STOPPABLE|TIMER_DELETE_ME) + if(charge_client) + RegisterSignal(charge_client, COMSIG_CLIENT_MOUSEUP, PROC_REF(on_mouse_up), override = TRUE) + return TRUE + +/// Past the tap: the crouch shows. +/datum/action/cooldown/cyberware/mantis_lunge/proc/enter_crouch() + if(charge_timer) + deltimer(charge_timer) + charge_timer = null + var/mob/living/carbon/bearer = owner + if(!charge_started || !iscarbon(bearer) || crouched) + return + if(!can_hold_crouch()) + cancel_charge() + return + crouched = TRUE + crouch_body = WEAKREF(bearer) + ADD_TRAIT(bearer, TRAIT_IMMOBILIZED, MANTIS_CHARGE_TRAIT) + bearer.add_offsets(MANTIS_CHARGE_TRAIT, z_add = -MANTIS_CHARGE_CROUCH_DROP) + var/list/housings = get_extended_housings() + mantis_pose_blades(housings, MANTIS_POSE_COIL) + crouch_glows = list() + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade as anything in mantis_housing_blades(housings)) + var/obj/effect/abstract/cyberware_anim/glow = mantis_coil_glow_fx(bearer, blade) + if(glow) + crouch_glows += WEAKREF(glow) + var/mob/living/target = charge_target?.resolve() + if(target) + bearer.face_atom(target) + bearer.visible_message( + span_boldwarning("[bearer] sinks into a crouch, blades drawn back!"), + span_warning("You coil to spring."), + ) + playsound(bearer, 'sound/items/weapons/sear.ogg', 35, TRUE) + RegisterSignal(bearer, COMSIG_MOB_AFTER_APPLY_DAMAGE, PROC_REF(on_crouch_damaged)) + crouch_tick_timer = addtimer(CALLBACK(src, PROC_REF(crouch_tick)), 0.2 SECONDS, TIMER_STOPPABLE|TIMER_DELETE_ME) + +/// Whether the bearer can keep crouching: on their feet, unhurt enough, blade out, still meaning harm. +/datum/action/cooldown/cyberware/mantis_lunge/proc/can_hold_crouch() + var/mob/living/carbon/bearer = owner + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing = organ + if(!iscarbon(bearer) || !istype(housing) || !housing.blade_extended()) + return FALSE + if(bearer.stat != CONSCIOUS || bearer.buckled || !isturf(bearer.loc) || HAS_TRAIT(bearer, TRAIT_PACIFISM)) + return FALSE + return TRUE + +/// Whether something has put the crouched bearer down: a stun, a knockdown, a fall. +/datum/action/cooldown/cyberware/mantis_lunge/proc/crouch_knocked_out() + var/mob/living/carbon/bearer = owner + return HAS_TRAIT(bearer, TRAIT_INCAPACITATED) || HAS_TRAIT(bearer, TRAIT_FLOORED) || bearer.body_position == LYING_DOWN || HAS_TRAIT(bearer, TRAIT_HANDS_BLOCKED) + +/datum/action/cooldown/cyberware/mantis_lunge/proc/crouch_tick() + crouch_tick_timer = null + if(!crouched) + return + if(!iscarbon(owner) || owner.stat != CONSCIOUS) + cancel_charge() + return + if(crouch_knocked_out()) + break_crouch() + return + if(!can_hold_crouch()) + cancel_charge() + return + if(world.time - charge_started >= MANTIS_CHARGE_MAX_HOLD) + // Held too long: they straighten up. No cooldown, a moment before they can set again. + var/mob/living/bearer = owner + cancel_charge() + bearer.balloon_alert(bearer, "straightened up") + return + crouch_tick_timer = addtimer(CALLBACK(src, PROC_REF(crouch_tick)), 0.2 SECONDS, TIMER_STOPPABLE|TIMER_DELETE_ME) + +/datum/action/cooldown/cyberware/mantis_lunge/proc/on_crouch_damaged(datum/source, damage_dealt, damagetype) + SIGNAL_HANDLER + if(!crouched || damage_dealt < MANTIS_CHARGE_BREAK_DAMAGE) + return + if(!(damagetype in list(BRUTE, BURN, STAMINA))) + return + INVOKE_ASYNC(src, PROC_REF(break_crouch)) + +/// Knocked out of the crouch: no pounce, and the whole cooldown. +/datum/action/cooldown/cyberware/mantis_lunge/proc/break_crouch() + if(!crouched) + return + var/mob/living/carbon/bearer = owner + cancel_charge() + if(!iscarbon(bearer)) + return + for(var/datum/action/cooldown/cyberware/mantis_lunge/lunge as anything in mantis_lunge_actions(bearer)) + lunge.StartCooldown() + bearer.do_stagger_animation() + bearer.visible_message( + span_danger("[bearer] is knocked out of [bearer.p_their()] crouch!"), + span_userdanger("You're knocked out of your crouch!"), + ) + if(bearer.click_intercept == src) + unset_click_ability(bearer, refund_cooldown = FALSE) + +/// Let go after the crouch: the leap. Returns TRUE if they sprang. +/datum/action/cooldown/cyberware/mantis_lunge/proc/release_charge() + var/held = world.time - charge_started + var/mob/living/target = charge_target?.resolve() + var/mob/living/carbon/bearer = owner + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing = organ + cancel_charge(rearm = FALSE) + if(!iscarbon(bearer) || !istype(housing)) + return FALSE + if(QDELETED(target) || target.stat == DEAD) + bearer.balloon_alert(bearer, "no target!") + return FALSE + if(!IsAvailable(feedback = TRUE) || !housing.blade_extended() || HAS_TRAIT(bearer, TRAIT_PACIFISM)) + return FALSE + var/range = mantis_charge_range(held, housing.lunge_range) + if(get_dist(bearer, target) > range || !can_see(bearer, target, range)) + bearer.balloon_alert(bearer, "out of reach!") + return FALSE + cyberware_camo_drop(bearer) + for(var/datum/action/cooldown/cyberware/mantis_lunge/lunge as anything in mantis_lunge_actions(bearer)) + lunge.StartCooldown() + if(bearer.click_intercept == src) + unset_click_ability(bearer, refund_cooldown = FALSE) + bearer.face_atom(target) + mantis_pose_blades(get_extended_housings(), MANTIS_POSE_LUNGE) + playsound(bearer, 'sound/items/weapons/sear.ogg', 50, TRUE) + // The crouch was the telegraph: no second wind-up. + do_lunge(WEAKREF(target), range, TRUE) + return TRUE + +/** + * Ends any charge: stands the bearer back up, takes the glow off and puts the blades back in the guard. + * [rearm] keeps them from setting again for a moment, when the crouch had shown. + */ +/datum/action/cooldown/cyberware/mantis_lunge/proc/cancel_charge(rearm = TRUE) + if(charge_timer) + deltimer(charge_timer) + charge_timer = null + if(crouch_tick_timer) + deltimer(crouch_tick_timer) + crouch_tick_timer = null + if(charge_client) + UnregisterSignal(charge_client, COMSIG_CLIENT_MOUSEUP) + charge_started = 0 + charge_target = null + if(!crouched) + return + crouched = FALSE + for(var/datum/weakref/glow_ref as anything in crouch_glows) + var/obj/effect/abstract/cyberware_anim/glow = glow_ref.resolve() + if(glow) + qdel(glow) + crouch_glows = null + var/mob/living/carbon/bearer = crouch_body?.resolve() + crouch_body = null + if(isnull(bearer)) + return + UnregisterSignal(bearer, COMSIG_MOB_AFTER_APPLY_DAMAGE) + REMOVE_TRAIT(bearer, TRAIT_IMMOBILIZED, MANTIS_CHARGE_TRAIT) + bearer.remove_offsets(MANTIS_CHARGE_TRAIT, animate = FALSE) + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade as anything in mantis_held_blades(bearer)) + if(blade.mantis_pose == MANTIS_POSE_COIL) + blade.set_mantis_pose(MANTIS_POSE_GUARD) + if(rearm) + var/datum/mantis_bearer/state = bearer.get_mantis_state() + state.next_charge = world.time + MANTIS_CHARGE_REARM diff --git a/voidcrew/modules/mantis_gore/mantis_core.dm b/voidcrew/modules/mantis_gore/mantis_core.dm new file mode 100644 index 00000000000..0f13f8c6dcb --- /dev/null +++ b/voidcrew/modules/mantis_gore/mantis_core.dm @@ -0,0 +1,253 @@ +/** + * # Mantis Blades x hyperviolence + * + * The Mantis line (voidcrew/modules/cyberware/ware_military_arms.dm, ware_line_mantis.dm) on top of the + * gore layer (voidcrew/modules/hyperviolence/). The Mantis is the predator: it wins by bleed-out, + * pinning and mobility. It never cuts a limb clean off mid-fight; its one dismemberment is the scissor, + * on someone already dying. + * + * - Arterial gashes: cuts on one limb add up and tear its artery (mantis_blade.dm, mantis_wounds.dm). + * - Impaling lunge: both blades into someone hurt hold them up, or pin them to a wall (mantis_impale.dm). + * - Scissor: a head swing at someone dying, a #509 finisher (mantis_scissor.dm). + * - Blood on the blades, dripping after a kill, flicked off on the way in (mantis_blade.dm, mantis_housing.dm). + * - Lunge trail, afterimages and the arrival (mantis_lunge_fx.dm). + * - X-slash: every third cut with both blades out (mantis_blade.dm). + * - Combat stance: the guard pose and the raised fists while the blades are out (mantis_poses.dm). + * - Charged leap and the kill reset (mantis_charge.dm, and the kill credit below). + * - Scorch burns and half-seals; the Shiv only bleeds (the model tuning in mantis_blade.dm). + * + * Human NPCs only get the gore moves at #509's ranks: aimed crits (hv_can_land_aimed_crits()) for the + * arteries, the impale, the X-slash and the reset; executions (hv_can_execute()) for the scissor. An + * ordinary NPC with Mantis blades cuts like a knife. + * + * Every number is in voidcrew/_DEFINES/mantis_gore.dm. + */ + +// ========================================================================= +// PER-BEARER BOOKKEEPING +// ========================================================================= + +/// What one bearer of the line is in the middle of: the X-slash count and the clocks of the +/// scissor, the kill reset and the crouch. Holds no hard references. +/datum/mantis_bearer + /// Who the X-slash count is on + var/datum/weakref/xslash_target + /// Landed cuts on them so far + var/xslash_count = 0 + /// world.time of the last of those cuts + var/xslash_last = 0 + /// world.time the scissor can be tried again + var/next_scissor = 0 + /// world.time a kill can reset the lunge again + var/next_kill_reset = 0 + /// world.time the bearer can crouch to charge again + var/next_charge = 0 + /// The scissor running now, if any + var/datum/hv_finisher/mantis_scissor/scissor + /// The blade rig drawing this bearer now, if any (mantis_rig.dm) + var/datum/mantis_rig/rig + +/datum/mantis_bearer/Destroy() + xslash_target = null + scissor = null + rig = null + return ..() + +/mob/living + /// The Mantis line's bookkeeping for this mob as a bearer (voidcrew/modules/mantis_gore/). Made on first use. + var/datum/mantis_bearer/mantis_state + /// world.time this mob, killed, last reset someone's lunge. Outlives death on purpose (revive loops). + var/mantis_reset_given_at = 0 + +/mob/living/proc/get_mantis_state() + RETURN_TYPE(/datum/mantis_bearer) + if(!mantis_state) + mantis_state = new + return mantis_state + +// ========================================================================= +// HELPERS +// ========================================================================= + +/// The Mantis-line blades [bearer] has out in a hand, optionally only those that can do [moves] (MANTIS_MOVE_*). +/proc/mantis_held_blades(mob/living/bearer, moves = NONE) + RETURN_TYPE(/list) + . = list() + if(!isliving(bearer)) + return + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade in bearer.held_items) + if(moves && (blade.gore_moves & moves) != moves) + continue + . += blade + +/// Every Mantis lunge button [bearer] has. Chrome abilities never join mob.actions (chrome_hud.dm). +/proc/mantis_lunge_actions(mob/living/bearer) + RETURN_TYPE(/list) + . = list() + if(!iscarbon(bearer)) + return + for(var/datum/action/cooldown/cyberware/mantis_lunge/lunge in get_chrome_wheel_actions(bearer)) + . += lunge + +/// The held blade of each of [housings], skipping any that isn't out. +/proc/mantis_housing_blades(list/housings) + RETURN_TYPE(/list) + . = list() + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing as anything in housings) + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade = housing.active_item + if(istype(blade) && housing.blade_extended()) + . += blade + +/// Whether [victim] is dying: in crit, or out cold at crit health. Lying down or stunned is not enough. +/proc/mantis_in_crit(mob/living/victim) + if(!isliving(victim) || victim.stat == DEAD) + return FALSE + if(victim.stat == SOFT_CRIT || victim.stat == HARD_CRIT) + return TRUE + return victim.stat == UNCONSCIOUS && victim.health <= victim.crit_threshold + +// ========================================================================= +// KILL CREDIT +// ========================================================================= + +/** + * [bearer] has just cut [victim] with the line: a death in the next few seconds is their kill. + * Called before the damage lands, so the cut that kills counts. [blades] are the blades that cut, the ones + * a kill drenches; null when every blade out struck (the lunge, the impale, the scissor). + */ +/proc/mantis_note_hit(mob/living/victim, mob/living/bearer, list/blades) + if(!isliving(victim) || !isliving(bearer) || victim == bearer || QDELETED(victim) || victim.stat == DEAD) + return null + var/datum/status_effect/mantis_cuts/cuts = victim.has_status_effect(/datum/status_effect/mantis_cuts) + if(cuts) + cuts.refresh() + else + cuts = victim.apply_status_effect(/datum/status_effect/mantis_cuts) + if(!cuts) + return null + cuts.last_bearer = WEAKREF(bearer) + cuts.last_hit = world.time + cuts.last_blades = null + for(var/obj/item/blade as anything in blades) + LAZYADD(cuts.last_blades, WEAKREF(blade)) + return cuts + +/** + * On someone the line has cut lately. Counts the cuts on each limb (the arterial gashes) and remembers + * who cut them last, so their death can be credited. Runs out on its own a while after the last cut. + */ +/datum/status_effect/mantis_cuts + id = "mantis_cuts" + alert_type = null + duration = MANTIS_CUT_WINDOW + tick_interval = STATUS_EFFECT_NO_TICK + status_type = STATUS_EFFECT_UNIQUE + /// Body zone -> cuts on it that still add up + var/list/limb_cuts + /// Body zone -> world.time of its last cut + var/list/limb_cut_times + /// Who cut them last + var/datum/weakref/last_bearer + /// world.time of that cut + var/last_hit = 0 + /// Weakrefs to the blades of that cut, or null if every blade out struck + var/list/last_blades + +/datum/status_effect/mantis_cuts/on_apply() + RegisterSignal(owner, COMSIG_LIVING_DEATH, PROC_REF(on_owner_death)) + return TRUE + +/datum/status_effect/mantis_cuts/on_remove() + UnregisterSignal(owner, COMSIG_LIVING_DEATH) + +/datum/status_effect/mantis_cuts/Destroy() + last_bearer = null + last_blades = null + return ..() + +/// One more cut on [zone]. Returns how many now add up there. +/datum/status_effect/mantis_cuts/proc/add_cut(zone) + LAZYINITLIST(limb_cuts) + LAZYINITLIST(limb_cut_times) + if(world.time - (limb_cut_times[zone] || 0) > MANTIS_CUT_WINDOW) + limb_cuts[zone] = 0 + limb_cuts[zone] = (limb_cuts[zone] || 0) + 1 + limb_cut_times[zone] = world.time + return limb_cuts[zone] + +/// The count on [zone] starts over. +/datum/status_effect/mantis_cuts/proc/clear_cuts(zone) + LAZYREMOVE(limb_cuts, zone) + LAZYREMOVE(limb_cut_times, zone) + +/datum/status_effect/mantis_cuts/proc/on_owner_death(datum/source, gibbed) + SIGNAL_HANDLER + var/mob/living/bearer = last_bearer?.resolve() + if(isnull(bearer) || world.time - last_hit > MANTIS_KILL_CREDIT_WINDOW) + return + var/list/killing_blades + for(var/datum/weakref/blade_ref as anything in last_blades) + var/obj/item/blade = blade_ref.resolve() + if(blade) + LAZYADD(killing_blades, blade) + mantis_kill_credit(bearer, owner, last_blades ? (killing_blades || list()) : null) + +/** + * [bearer] killed [victim]: the blades that did it are drenched, and the lunge may come back early. + * [blades] are those blades; null means every blade [bearer] has out. A kill in the impale or the scissor + * only stains them: the blade rig draws the blood they leave on the steel, and the held art keeps that coat + * after. + */ +/proc/mantis_kill_credit(mob/living/bearer, mob/living/victim, list/blades) + if(QDELETED(bearer) || bearer.stat == DEAD) + return FALSE + var/light = !isnull(bearer.mantis_state?.rig) + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade as anything in mantis_held_blades(bearer)) + if(isnull(blades) || (blade in blades)) + blade.drench(victim, light) + return mantis_try_kill_reset(bearer, victim) + +/// Whether killing [victim] can reset a lunge at all: a person (not a monkey), or something big. +/proc/mantis_kill_reset_counts(mob/living/victim) + if(ishuman(victim)) + return !ismonkey(victim) + return victim.maxHealth >= MANTIS_KILL_RESET_MIN_HEALTH + +/** + * The kill reset. [bearer]'s lunge cooldown comes down to MANTIS_KILL_RESET_FLOOR, never lower, at most + * once per MANTIS_KILL_RESET_COOLDOWN per bearer, and a body that gave one gives no other for + * MANTIS_KILL_RESET_VICTIM_LOCKOUT. Prisoners (cuffed or strapped down at death) and small animals never + * count. Returns TRUE if it reset. + */ +/proc/mantis_try_kill_reset(mob/living/bearer, mob/living/victim) + if(!isliving(victim) || !iscarbon(bearer) || !bearer.hv_can_land_aimed_crits()) + return FALSE + if(!mantis_kill_reset_counts(victim)) + return FALSE + if(HAS_TRAIT(victim, TRAIT_RESTRAINED) || victim.buckled) + return FALSE + if(victim.mantis_reset_given_at && world.time < victim.mantis_reset_given_at + MANTIS_KILL_RESET_VICTIM_LOCKOUT) + return FALSE + var/datum/mantis_bearer/state = bearer.get_mantis_state() + if(world.time < state.next_kill_reset) + return FALSE + var/reset = FALSE + for(var/datum/action/cooldown/cyberware/mantis_lunge/lunge as anything in mantis_lunge_actions(bearer)) + if(lunge.next_use_time > world.time + MANTIS_KILL_RESET_FLOOR) + lunge.StartCooldown(MANTIS_KILL_RESET_FLOOR) + reset = TRUE + if(!reset) + return FALSE + state.next_kill_reset = world.time + MANTIS_KILL_RESET_COOLDOWN + victim.mantis_reset_given_at = world.time + mantis_reset_tell(bearer) + log_combat(bearer, victim, "had the mantis lunge come back early from killing") + return TRUE + +/// The only sign of a reset: both blades flare once, with a soft ring of steel. +/proc/mantis_reset_tell(mob/living/bearer) + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade as anything in mantis_held_blades(bearer)) + blade.play_glint(MANTIS_POSE_GUARD) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing = blade.housing_ref?.resolve() + housing?.blade_flash(1, 0.3 SECONDS) + playsound(bearer, 'sound/items/unsheath.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE) diff --git a/voidcrew/modules/mantis_gore/mantis_housing.dm b/voidcrew/modules/mantis_gore/mantis_housing.dm new file mode 100644 index 00000000000..2d682512cd6 --- /dev/null +++ b/voidcrew/modules/mantis_gore/mantis_housing.dm @@ -0,0 +1,236 @@ +// The housing side of the Mantis line's gore: the combat stance while a blade is out (the guard pose, +// the fists raised, a glint now and then), the flick of blood on the way back in, and the stain the +// housing keeps until it is washed. See mantis_core.dm for the overview. + +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis + /// Raises the fist on the arm while the blade is out. + var/datum/bodypart_overlay/mantis_stance/stance_overlay + /// The arm it is on. + var/datum/weakref/stance_limb + /// Timer of the next glint. + var/glint_timer + /// Blood flicked off the blade has left the housing stained. + var/stained = FALSE + /// Colour of that stain. + var/stain_color + +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/Destroy() + stance_off() + stop_glint() + return ..() + +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/on_mob_insert(mob/living/carbon/arm_owner, special = FALSE, movement_flags) + . = ..() + RegisterSignal(arm_owner, COMSIG_COMPONENT_CLEAN_ACT, PROC_REF(on_bearer_washed)) + +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/on_mob_remove(mob/living/carbon/arm_owner, special = FALSE, movement_flags) + . = ..() + UnregisterSignal(arm_owner, COMSIG_COMPONENT_CLEAN_ACT) + stance_off() + stop_glint() + +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/Extend(obj/item/augment) + . = ..() + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade = active_item + if(!istype(blade) || (blade in src) || !owner?.is_holding(blade)) + return + blade.housing_ref = WEAKREF(src) + stance_on() + blade.set_mantis_pose(MANTIS_POSE_GUARD) + schedule_glint() + +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/Retract() + var/mob/living/carbon/stowing_owner = owner + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/stowing = active_item + var/flick = istype(stowing) && stowing_owner?.is_holding(stowing) && stowing.is_bloody() + . = ..() + if(!.) + return + stance_off() + stop_glint() + if(!istype(stowing)) + return + stowing.mantis_stowed() + if(flick && !QDELETED(stowing_owner)) + flick_blood(stowing_owner, stowing) + +// A blade forced out of the hand some other way (a cut-off hand, a forced drop) ends the stance too. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/on_deployed_item_dropped(obj/item/source, mob/user) + SIGNAL_HANDLER + stance_off() + stop_glint() + return ..() + +// ---- The stance ---------------------------------------------------------- + +/// Raises this arm's fist to the guard. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/proc/stance_on() + stance_off() + var/obj/item/bodypart/arm = owner?.get_bodypart(zone) + if(isnull(arm)) + return + stance_overlay = new + stance_limb = WEAKREF(arm) + arm.add_bodypart_overlay(stance_overlay) + +/// Lowers it again. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/proc/stance_off() + if(isnull(stance_overlay)) + return + var/obj/item/bodypart/arm = stance_limb?.resolve() + if(arm && (stance_overlay in arm.bodypart_overlays)) + arm.remove_bodypart_overlay(stance_overlay) + QDEL_NULL(stance_overlay) + stance_limb = null + +/// How high the fist rides, for the blade's pose. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/proc/set_stance_raise(raise) + if(isnull(stance_overlay) || stance_overlay.raise == raise) + return + stance_overlay.raise = raise + owner?.update_body_parts() + +/** + * The fist on an arm whose Mantis blade is out, raised to the guard. Draws nothing of its own: it moves + * the arm's hand up a few pixels, and is part of the arm's render key so it redraws when it changes. + */ +/datum/bodypart_overlay/mantis_stance + layers = NONE + blocks_emissive = EMISSIVE_BLOCK_NONE + /// Pixels the hand rides up. + var/raise = 2 + +/datum/bodypart_overlay/mantis_stance/generate_icon_cache() + return list("mantis_stance_[raise]") + +/datum/bodypart_overlay/mantis_stance/modify_bodypart_appearance(datum/appearance) + // Images and mutable appearances both: the hand and its emissive blocker move together. + var/image/part = appearance + if(isnull(part) || !findtext("[part.icon_state]", "_hand")) + return + part.pixel_y += raise + +// ---- The glint ----------------------------------------------------------- + +/// The next glint along the edge, 8 to 12 seconds out. One-shot timers only. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/proc/schedule_glint() + stop_glint() + glint_timer = addtimer(CALLBACK(src, PROC_REF(stance_glint)), rand(8 SECONDS, 12 SECONDS), TIMER_STOPPABLE|TIMER_DELETE_ME) + +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/proc/stop_glint() + if(glint_timer) + deltimer(glint_timer) + glint_timer = null + +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/proc/stance_glint() + glint_timer = null + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade = active_item + if(!istype(blade) || !owner?.is_holding(blade)) + return + if(blade.mantis_pose == MANTIS_POSE_GUARD) + blade.play_glint() + schedule_glint() + +// ---- Blood ----------------------------------------------------------------- + +/// How long flicked blood is in the air: the flick's three frames. +#define MANTIS_FLICK_FLIGHT (0.3 SECONDS) + +/** + * What a flicked blade leaves on the tile ahead: a thin line of spatter from where the blade pointed, bending a + * little and breaking into drops toward its far end ("flick_spatter_[hand]", drawn for the tile ahead in each + * facing). One per hand, so two blades lay a line each. Its own kind of blood, not one of the sprays: a tile's + * spray is neither turned by a flick nor kept off the tile by one. + */ +/obj/effect/decal/cleanable/blood/mantis_flick + name = "blood spatter" + icon = MANTIS_GORE_ICON + icon_state = "flick_spatter_right" + random_icon_states = null + mergeable_decal = FALSE + // Thin enough that walking through it does not leave footprints. + bloodiness = 15 + drying_time = 3 MINUTES + beauty = -20 + base_name = null + base_suffix = "spatter" + /// The hand that flicked it: "left" or "right". + var/hand = "right" + +// Too thin to dive into. +/obj/effect/decal/cleanable/blood/mantis_flick/can_bloodcrawl_in() + return FALSE + +/// The [hand] blade's flicked blood lands on [ahead], thrown the way [flick_dir]. Wet spatter that hand already +/// left there is only freshened. Returns the spatter. +/proc/mantis_flick_land(turf/ahead, flick_dir, hand, list/blood_dna) + if(!isturf(ahead) || !length(blood_dna)) + return null + for(var/obj/effect/decal/cleanable/blood/mantis_flick/wet in ahead) + if(wet.hand != hand || wet.dir != flick_dir || wet.dried || QDELETED(wet)) + continue + wet.add_blood_DNA(blood_dna) + return wet + var/obj/effect/decal/cleanable/blood/mantis_flick/spatter = new(ahead, null, blood_dna) + if(QDELETED(spatter)) + return null + spatter.hand = hand + spatter.icon_state = "flick_spatter_[hand]" + spatter.setDir(flick_dir) + var/full_alpha = spatter.alpha + spatter.alpha = 0 + animate(spatter, alpha = full_alpha, time = 0.1 SECONDS) + return spatter + +/// The blade snaps back in bloody: the blood flies off ahead and lands as a line of spatter, and some stays on +/// the housing. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/proc/flick_blood(mob/living/carbon/bearer, obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade) + var/blood_color = blade.get_blood_dna_color() + var/list/blood_dna = blade.blood_dna_copy() + var/obj/effect/abstract/cyberware_anim/fling = cyberware_anim_play(bearer, MANTIS_GORE_LARGE_ICON, "mantis_flick_[zone == BODY_ZONE_L_ARM ? "left" : "right"]", MANTIS_ANIM_BLADE_LAYER, 0.3 SECONDS) + if(fling) + fling.pixel_x = -16 + fling.pixel_y = -16 + fling.color = blood_color + var/turf/ahead = get_step(bearer, bearer.dir) + if(isturf(bearer.loc) && ahead && length(blood_dna) && !hv_blood_spray_blocked(ahead) && !isgroundlessturf(ahead) && ahead.has_gravity()) + // It lands once the flick has crossed to it, not as the blade starts back in. + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(mantis_flick_land), ahead, bearer.dir, zone == BODY_ZONE_L_ARM ? "left" : "right", blood_dna), MANTIS_FLICK_FLIGHT) + blade.wash(CLEAN_TYPE_BLOOD) + stained = TRUE + stain_color = blood_color + bearer.update_body_parts() + +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/proc/on_bearer_washed(datum/source, clean_types) + SIGNAL_HANDLER + if(!(clean_types & CLEAN_TYPE_BLOOD)) + return + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade = active_item + if(istype(blade) && blade.is_bloody()) + blade.wash(CLEAN_TYPE_BLOOD) + blade.stop_dripping() + blade.refresh_held() + if(!stained) + return + stained = FALSE + stain_color = null + owner?.update_body_parts() + +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/cyberware_worn_key() + return "[..()][stained ? "-blood[stain_color]" : ""]" + +// The stain is drawn over the housing's own pixels, only in its plain look (an EMP's dark, a brownout or the +// fold hide it with the rest of the housing). +/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/cyberware_dress_worn(list/imageset, image_layer, obj/item/bodypart/limb) + . = ..() + if(!stained || cyberware_worn_look()) + return + var/stain_state = "[aug_overlay]_[zone == BODY_ZONE_L_ARM ? "left" : "right"]_stain" + if(!icon_exists(MANTIS_GORE_ICON, stain_state)) + return + var/image/stain = image(icon = MANTIS_GORE_ICON, icon_state = stain_state, layer = image_layer) + stain.appearance_flags |= RESET_COLOR + stain.color = stain_color + . += stain + +#undef MANTIS_FLICK_FLIGHT diff --git a/voidcrew/modules/mantis_gore/mantis_impale.dm b/voidcrew/modules/mantis_gore/mantis_impale.dm new file mode 100644 index 00000000000..de703e5538e --- /dev/null +++ b/voidcrew/modules/mantis_gore/mantis_impale.dm @@ -0,0 +1,602 @@ +// The impaling lunge. A lunge that arrives with both blades on someone already hurt or down skewers them: +// held up on the blades for a beat (pinned to the wall for longer, if one is right behind them), then the +// blades rip out with a spray and they drop. The bearer is rooted with full hands the whole time, and +// the victim's hands stay free, so they can still shoot. + +/// Whether a lunge arriving with [housings] skewers [victim]: both blades out and able, a person no bigger +/// than a person, and already hurt or down. +/proc/mantis_can_impale(mob/living/lunger, mob/living/victim, list/housings) + if(!iscarbon(victim) || victim.stat == DEAD || victim.mob_size > MOB_SIZE_HUMAN) + return FALSE + if(!lunger.hv_can_land_aimed_crits()) + return FALSE + var/list/blades = mantis_housing_blades(housings) + if(length(blades) < 2) + return FALSE + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade as anything in blades) + if(!(blade.gore_moves & MANTIS_MOVE_IMPALE)) + return FALSE + if(HAS_TRAIT_FROM(victim, TRAIT_IMMOBILIZED, MANTIS_IMPALE_TRAIT) || victim.has_status_effect(/datum/status_effect/hv_finisher_hold)) + return FALSE + if(victim.buckled || !isturf(victim.loc)) + return FALSE + if(victim.health <= victim.maxHealth * MANTIS_IMPALE_HEALTH_FRACTION) + return TRUE + return victim.body_position == LYING_DOWN || victim.stat >= SOFT_CRIT || HAS_TRAIT(victim, TRAIT_INCAPACITATED) + +/// Skewers [victim] on the blades of [housings]. Returns TRUE if it took hold. [from] is where the lunge set +/// out, for the [glide] the lunging body takes to reach them (mantis_lunge_dash_fx()). +/proc/mantis_start_impale(datum/action/cooldown/cyberware/mantis_lunge/lunge, mob/living/carbon/lunger, mob/living/carbon/victim, list/housings, knockdown, turf/from, glide = MANTIS_LUNGE_GLIDE) + var/datum/mantis_impale/skewer = new(lunger, victim, housings, knockdown) + var/turf/landed = get_turf(lunger) + if(from && landed && from != landed) + skewer.glide_w = (from.x - landed.x) * ICON_SIZE_X + skewer.glide_z = (from.y - landed.y) * ICON_SIZE_Y + skewer.glide_time = glide + if(!skewer.start()) + qdel(skewer) + return FALSE + lunge?.impale = skewer + return TRUE + +/datum/action/cooldown/cyberware/mantis_lunge + /// The skewer this lunge is holding, while it holds. + var/datum/mantis_impale/impale + +/** + * # The skewer + * + * The beats, from the approved storyboard: the lunging body glides in, blades out; the points reach them + * and go in, and the two are drawn together; the victim is held up on the blades; the bearer pulls back, rips + * the blades out and the victim drops. From the glide to the drop the bearer is drawn by the blade rig + * (mantis_rig.dm): the far blade, the far arm and the bearer's body under the victim, the near arm and the + * near blade over them, the steel inside them cut out. + */ +/datum/mantis_impale + var/mob/living/carbon/bearer + var/mob/living/carbon/victim + /// The housings whose blades went in. + var/list/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housings + /// The way the lunge travelled. The tips come out on that side. + var/lunge_dir + /// The way it is drawn (mantis_rig_facing()). + var/facing + /// TRUE when a wall right behind them takes the points. + var/wall_pin = FALSE + /// How long they are held. + var/hold_time = MANTIS_IMPALE_HOLD + /// How long they go down for when the blades come out. + var/knockdown = 2 SECONDS + var/started_at = 0 + /// Damage the bearer has taken since it began. + var/taken = 0 + var/tick_timer + /// The bearer drawn around the victim, from the start of the glide in. + var/datum/mantis_rig/rig + /// The landing, when the points reach them. + var/rig_timer + /// Where the lunging body glides in from, in pixels off the bearer's tile, and how long it takes. + var/glide_w = 0 + var/glide_z = 0 + var/glide_time = 0 + /// The beat drawn now. + var/beat + /// How far tg had them turned to lie down when they came up on the blades, or 0. + var/hoist_angle = 0 + /// Degrees they are tipped back about their feet at the rip, to take back out. + var/tilt_angle = 0 + /// The way they faced before they were turned onto the blades. + var/prior_dir + var/running = FALSE + /// TRUE from the pull-back until the blades are out. + var/ripping = FALSE + /// Pixels they hang up from where the hold has them: -1 while they sag on the blades (set_sag()). + var/sag = 0 + /// The bar over the bearer that everyone sees fill until the rip (finisher_bar.dm) + var/obj/effect/abstract/hv_exec_bar/exec_bar + +/datum/mantis_impale/New(mob/living/carbon/bearer, mob/living/carbon/victim, list/housings, knockdown) + . = ..() + src.bearer = bearer + src.victim = victim + src.housings = housings.Copy() + if(isnum(knockdown)) + src.knockdown = knockdown + +/datum/mantis_impale/Destroy() + if(running) + finish() + QDEL_NULL(rig) + bearer = null + victim = null + housings = null + return ..() + +/datum/mantis_impale/proc/start() + if(running || QDELETED(bearer) || QDELETED(victim)) + return FALSE + lunge_dir = get_dir(bearer, victim) || bearer.dir + facing = mantis_rig_facing(bearer, victim) + var/turf/behind = get_step(victim, lunge_dir) + wall_pin = !isnull(behind) && hv_blood_spray_blocked(behind) + hold_time = wall_pin ? MANTIS_IMPALE_PIN_HOLD : MANTIS_IMPALE_HOLD + running = TRUE + started_at = world.time + // Everyone in view sees the hold count down to the rip (finisher_bar.dm) + exec_bar = hv_exec_bar_start(bearer, hold_time) + bearer.add_traits(list(TRAIT_IMMOBILIZED, TRAIT_HANDS_BLOCKED), MANTIS_IMPALE_TRAIT) + ADD_TRAIT(victim, TRAIT_IMMOBILIZED, MANTIS_IMPALE_TRAIT) + // Turned onto the blades and brought up off the floor if they were on it. The rig draws the lunging body + // gliding in, blades out and short of them (the bearer's own lunge pose would lie over them); the points + // reach them as it lands (begin_rig()). + prior_dir = victim.dir + victim.setDir(mantis_face_dir(victim, bearer)) + hoist() + place_victim(0, 0) + mantis_pose_blades(housings, MANTIS_POSE_LUNGE) + put_up_rig() + if(rig) + show_beat("arrive", glide_time, glide_w, glide_z) + rig_timer = addtimer(CALLBACK(src, PROC_REF(begin_rig)), max(glide_time, world.tick_lag), TIMER_STOPPABLE|TIMER_DELETE_ME) + // The lunge's own slash, drawn as it landed, would float over the blades. + for(var/obj/effect/abstract/cyberware_anim/picture in victim.vis_contents) + if(findtext(picture.icon_state, "impact_") == 1) + qdel(picture) + RegisterSignal(bearer, COMSIG_MOB_AFTER_APPLY_DAMAGE, PROC_REF(on_bearer_damaged)) + RegisterSignals(bearer, list(COMSIG_LIVING_DEATH, COMSIG_QDELETING, COMSIG_MOVABLE_MOVED), PROC_REF(on_lost)) + RegisterSignals(victim, list(COMSIG_LIVING_DEATH, COMSIG_QDELETING, COMSIG_MOVABLE_MOVED), PROC_REF(on_lost)) + RegisterSignal(victim, COMSIG_LIVING_POST_UPDATE_TRANSFORM, PROC_REF(on_victim_turned)) + if(wall_pin) + victim.visible_message( + span_danger("[bearer] drives both blades through [victim] and pins [victim.p_them()] to the wall!"), + span_userdanger("Two blades punch through you and into the wall!"), + ) + else + victim.visible_message( + span_danger("[bearer] drives both blades through [victim] and lifts [victim.p_them()] off [victim.p_their()] feet!"), + span_userdanger("Two blades punch through you!"), + ) + schedule_tick() + return TRUE + +/// The bearer is drawn by the rig from here to the drop. +/datum/mantis_impale/proc/put_up_rig() + if(rig) + return + rig = new(bearer, victim, facing, model(), "impale") + if(!rig.start()) + QDEL_NULL(rig) + +/// The lunging body has landed: the two are drawn together, and the victim slides onto the blades. +/datum/mantis_impale/proc/begin_rig() + rig_timer = null + if(!running || ripping) + return + put_up_rig() + // Whole blades, the victim over the steel they have slid onto: they cover it as they come. + show_beat("contact", MANTIS_IMPALE_CONTACT_BEAT) + addtimer(CALLBACK(src, PROC_REF(stab)), MANTIS_IMPALE_CONTACT_BEAT, TIMER_DELETE_ME) + +/// The blades are in: the points come out of the back wet, with a burst of blood and a crackle of their light. +/datum/mantis_impale/proc/stab() + if(!running || ripping) + return + if(rig) + rig.wet = TRUE + show_beat("enter", 0) + // The crackle is at the points, so it lasts only while they are still: it is gone as the hoist begins. + switch(facing) + if(NORTH) + rig?.burst("enter_puff", 0.25 SECONDS, "T", under = TRUE) + rig?.burst("enter_spark", MANTIS_IMPALE_ENTER_BEAT, "tips", blood = FALSE) + if(SOUTH) + rig?.burst("enter_puff", 0.25 SECONDS, "tips") + rig?.burst("enter_spark", MANTIS_IMPALE_ENTER_BEAT, "tips", blood = FALSE) + else + rig?.burst("enter_puff", 0.25 SECONDS, "T") + rig?.burst("enter_spark", MANTIS_IMPALE_ENTER_BEAT, "near", blood = FALSE) + addtimer(CALLBACK(src, PROC_REF(lift), 1), MANTIS_IMPALE_ENTER_BEAT, TIMER_DELETE_ME) + +/** + * The hoist from the stab to the hold, a frame at a time: the victim and the blades in them rise together, + * in the same frame, so the steel stays where it went in. + */ +/datum/mantis_impale/proc/lift(step) + if(!running || ripping) + return + if(!mantis_rig_beat("impale", "lift[step]", facing)) + hang() + return + show_beat("lift[step]", 0) + addtimer(CALLBACK(src, PROC_REF(lift), step + 1), MANTIS_IMPALE_STEP, TIMER_DELETE_ME) + +/** + * Held up: the victim hangs on the blades until the pull-back. Twice they sag a pixel and are heaved back up, + * and the blades and the arms holding them dip with them in the same frame (set_sag()). + */ +/datum/mantis_impale/proc/hang() + show_beat("hold", 0) + if(!running || ripping || QDELETED(victim)) + return + for(var/again in 0 to 1) + var/at = MANTIS_IMPALE_SAG_AFTER + again * MANTIS_IMPALE_SAG_EVERY + addtimer(CALLBACK(src, PROC_REF(set_sag), -1), at, TIMER_DELETE_ME) + addtimer(CALLBACK(src, PROC_REF(set_sag), 0), at + MANTIS_IMPALE_SAG_FOR, TIMER_DELETE_ME) + +/// In the hold they hang [new_sag] pixels up from where the hold has them (a sag is negative). +/datum/mantis_impale/proc/set_sag(new_sag) + if(!running || ripping || beat != "hold" || sag == new_sag) + return + sag = new_sag + show_beat("hold", 0) + +/** + * Draws [new_beat] (mantis_rig_beat()): the bearer's arms and lean, and the victim drawn onto the blades. + * Up against a wall the victim stays where they are and the bearer comes the whole way; from a diagonal the + * two meet halfway up or down the screen. Pictures only. + */ +/datum/mantis_impale/proc/show_beat(new_beat, time = 0.1 SECONDS, from_w = 0, from_z = 0) + if(!running || (ripping && (new_beat == "hold" || findtext(new_beat, "lift") == 1))) + return + var/list/spec = mantis_rig_beat("impale", new_beat, facing) + if(!spec) + return + beat = new_beat + var/target_w = spec[MANTIS_RIG_TARGET_W] + var/target_z = spec[MANTIS_RIG_TARGET_Z] + var/extra_w = 0 + var/extra_z = 0 + if((facing & (EAST|WEST)) && (lunge_dir & (NORTH|SOUTH))) + var/half = (lunge_dir & NORTH) ? ICON_SIZE_Y / 2 : -ICON_SIZE_Y / 2 + extra_z = half + target_z -= half + if(wall_pin) + extra_w -= target_w + extra_z -= target_z + target_w = 0 + target_z = 0 + // Sagging in the hold (set_sag()): the steel in them and the arms holding them go with them. Not against a + // wall: the points are in it. + var/dip = (new_beat == "hold" && !wall_pin) ? sag : 0 + // Facing south the victim is held up in front of the bearer, back to the camera, high enough to hide them + // whole. The bearer draws up tall behind them as they heave, head and shoulders over the victim's head, the + // fists with them; the points out of the victim's back stay where they are. + var/rise = (facing == SOUTH) ? max(0, spec[MANTIS_RIG_TARGET_Z] - MANTIS_IMPALE_SOUTH_RISE_FROM) : 0 + rig?.show(new_beat, extra_w, extra_z, time, from_w, from_z, ride_z = dip, body_z = rise) + // The bar over the bearer goes up with them, so it sits over their head rather than across their face. + if(!QDELETED(exec_bar) && !exec_bar.ending) + animate(exec_bar, pixel_z = exec_bar.rest_z + rise, time = time, easing = SINE_EASING, flags = ANIMATION_PARALLEL) + place_victim(target_w, target_z + dip, time) + set_tilt(spec[MANTIS_RIG_TILT]) + +/// Draws the victim [w], [z] pixels off their tile (and upright, if brought up off the floor), over [time]. +/datum/mantis_impale/proc/place_victim(w, z, time = 0.1 SECONDS) + // Brought upright off the floor: tg draws someone lying down a little low. + var/upright = hoist_angle ? -PIXEL_Y_OFFSET_LYING : 0 + // Drawn onto the blades as fast as the rig leans in (tg's own glide takes twice as long), so the points + // are at their front as they arrive, not after. + var/from_w = victim.pixel_w + var/from_z = victim.pixel_z + victim.add_offsets(MANTIS_IMPALE_TRAIT, w_add = w, z_add = z + upright, animate = FALSE) + var/to_w = victim.pixel_w + var/to_z = victim.pixel_z + if((to_w == from_w && to_z == from_z) || !time) + return + victim.pixel_w = from_w + victim.pixel_z = from_z + animate(victim, pixel_w = to_w, pixel_z = to_z, time = time, easing = SINE_EASING, flags = ANIMATION_PARALLEL) + +/// The matrix tipping a body [angle] degrees about its feet (clockwise), after [base]. +/proc/mantis_tip_matrix(matrix/base, angle) + var/matrix/turned = matrix(base) + turned.Translate(0, MANTIS_TIP_FEET) + turned.Turn(angle) + turned.Translate(0, -MANTIS_TIP_FEET) + return turned + +/// Where the point [x], [y] (pixels from a sprite's middle, y up) is drawn once the sprite is turned [angle] +/// degrees clockwise about [about_x], [about_y]. +/proc/mantis_turn_point(x, y, angle, about_x, about_y) + var/dx = x - about_x + var/dy = y - about_y + return list(about_x + dx * cos(angle) + dy * sin(angle), about_y - dx * sin(angle) + dy * cos(angle)) + +/** + * [body] falls in one motion from how it was drawn on the blades (offsets [from_w], [from_z], [from_y], upright + * and tipped back [from_angle] degrees about its feet) to how tg has it now, lying or standing, turning about + * the point [pivot] pixels under its middle (its feet for a fall backwards, 0 for a drop in place). It is the + * real body the whole way and ends on tg's own turn and offsets, so nothing takes over at the end. Gravity: + * slow off the blades, fast at the floor. A picture only: tg's lying state is set before this. + */ +/proc/mantis_drop_body(mob/living/body, from_w, from_z, from_y, from_angle, pivot, time) + if(QDELETED(body)) + return + var/matrix/to_transform = matrix(body.transform) + var/to_w = body.pixel_w + var/to_z = body.pixel_z + var/to_y = body.pixel_y + var/to_angle = (body.body_position == LYING_DOWN && body.rotate_on_lying) ? body.lying_angle : 0 + if(to_angle > 180) + to_angle -= 360 + // The turning point at the start (the picture tipped about the feet) and at the end (tg turns about the middle). + var/list/start = mantis_turn_point(0, -pivot, from_angle, 0, -MANTIS_TIP_FEET) + var/start_x = start[1] + from_w + var/start_y = start[2] + from_z + from_y + var/list/end = mantis_turn_point(0, -pivot, to_angle, 0, 0) + var/end_x = end[1] + to_w + var/end_y = end[2] + to_z + to_y + var/steps = 4 + for(var/step in 0 to steps) + var/fallen = (step / steps) ** 2 + var/matrix/turned = to_transform + var/step_w = to_w + var/step_z = to_z + if(step < steps) + turned = matrix() + turned.Translate(0, pivot) + turned.Turn(from_angle + (to_angle - from_angle) * fallen) + turned.Translate(0, -pivot) + step_w = round(start_x + (end_x - start_x) * fallen, 1) + step_z = round(start_y + (end_y - start_y) * fallen + pivot - to_y, 1) + // The first step puts the picture back where it was drawn at once: it replaces tg's own turn, and + // whatever else this tick started on the body. + if(step == 0) + animate(body, transform = turned, pixel_w = step_w, pixel_z = step_z, pixel_y = to_y, time = 0) + else + animate(transform = turned, pixel_w = step_w, pixel_z = step_z, time = time / steps) + +/// Tips the victim back to [angle] degrees about their feet. +/datum/mantis_impale/proc/set_tilt(angle) + if(angle == tilt_angle || QDELETED(victim)) + return + var/matrix/turned = mantis_tip_matrix(victim.transform, angle - tilt_angle) + tilt_angle = angle + animate(victim, transform = turned, time = 0.1 SECONDS, flags = ANIMATION_PARALLEL) + +/// Takes the tip back out at once, before anything else turns them. +/datum/mantis_impale/proc/untilt() + if(tilt_angle && !QDELETED(victim)) + victim.transform = mantis_tip_matrix(victim.transform, -tilt_angle) + tilt_angle = 0 + +/** + * Someone skewered off the floor comes up with the blades and is drawn upright for the hold. Only the + * picture turns: tg still has them lying down, with everything that goes with it. Skipped for a resized + * body, whose lying turn carries a shift that wouldn't come back out cleanly. + */ +/datum/mantis_impale/proc/hoist() + if(hoist_angle || victim.body_position != LYING_DOWN || !victim.rotate_on_lying || !victim.lying_angle) + return + if(victim.current_size != RESIZE_DEFAULT_SIZE) + return + hoist_angle = victim.lying_angle + var/matrix/upright = matrix(victim.transform) + upright.Turn(-hoist_angle) + victim.transform = upright + +/// Gives back tg's lying turn. [fall] drops them into it instead of snapping. +/datum/mantis_impale/proc/unhoist(fall = FALSE) + if(!hoist_angle) + return + var/matrix/lying = matrix(victim.transform) + lying.Turn(hoist_angle) + hoist_angle = 0 + if(fall) + animate(victim, transform = lying, time = 0.2 SECONDS, easing = EASE_IN, flags = ANIMATION_PARALLEL) + else + victim.transform = lying + +/// tg turned them while they hang on the blades (got up, or went down): its turn stands, the picture stays upright. +/datum/mantis_impale/proc/on_victim_turned(datum/source, resize, new_lying_angle, is_opposite_angle) + SIGNAL_HANDLER + if(!running) + return + // tg turned the upright picture by the change, and turns add up: undoing the hoist leaves tg's own. + untilt() + unhoist() + hoist() + if(beat) + show_beat(beat) + else + place_victim(0, 0) + +/// The model of the blades in them, for the pictures. +/datum/mantis_impale/proc/model() + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade as anything in mantis_housing_blades(housings)) + return blade.base_icon_state + return "mantis" + +/// Ends the bar over the bearer: full when the rip comes on time, failed otherwise +/datum/mantis_impale/proc/end_exec_bar(success) + if(!QDELETED(exec_bar)) + exec_bar.finish(success) + exec_bar = null + +/datum/mantis_impale/proc/schedule_tick() + tick_timer = addtimer(CALLBACK(src, PROC_REF(tick)), 0.2 SECONDS, TIMER_STOPPABLE|TIMER_DELETE_ME) + +/datum/mantis_impale/proc/tick() + tick_timer = null + if(!running) + return + if(!holds()) + finish() + return + if(world.time - started_at >= hold_time) + rip() + return + schedule_tick() + +/// Whether the hold still holds: both alive and side by side, the blades still out, the bearer on their feet. +/datum/mantis_impale/proc/holds() + if(QDELETED(bearer) || QDELETED(victim) || bearer.stat != CONSCIOUS || victim.stat == DEAD) + return FALSE + if(HAS_TRAIT(bearer, TRAIT_INCAPACITATED) || HAS_TRAIT(bearer, TRAIT_FLOORED)) + return FALSE + if(!isturf(bearer.loc) || !isturf(victim.loc) || bearer.z != victim.z || get_dist(bearer, victim) > 1) + return FALSE + return length(mantis_housing_blades(housings)) >= 1 + +/** + * The blades rip out. [half] when the bearer lost their grip: it tears less on the way out, with no + * pull-back. Otherwise first the pull-back: the bearer draws back while they still hang there, then tears + * the blades out, and a beat later they come free and the body drops (tear_out()). + */ +/datum/mantis_impale/proc/rip(half = FALSE) + if(!running || ripping) + return + end_exec_bar(!half) + // A lost grip is a jolt, not a pull: they come straight off. + if(half) + tear_out(TRUE) + return + ripping = TRUE + if(tick_timer) + deltimer(tick_timer) + tick_timer = null + // The pull-back in steps, the steel coming out a little at a time. + for(var/step in 1 to 3) + addtimer(CALLBACK(src, PROC_REF(show_beat), "pull[step]", 0), (step - 1) * MANTIS_IMPALE_PULL_STEP, TIMER_DELETE_ME) + addtimer(CALLBACK(src, PROC_REF(show_rip)), 3 * MANTIS_IMPALE_PULL_STEP, TIMER_DELETE_ME) + addtimer(CALLBACK(src, PROC_REF(tear_out), half), 3 * MANTIS_IMPALE_PULL_STEP + MANTIS_IMPALE_PULL_BEAT - MANTIS_IMPALE_RIP_BEAT, TIMER_DELETE_ME) + +/// The blades tear up and down out of them: blood sprays out of the back as they come free. +/datum/mantis_impale/proc/show_rip() + if(!running) + return + show_beat("rip") + rig?.burst("rip_spray", 0.4 SECONDS, "T", under = (facing == NORTH)) + +/// The blades come out after the pull-back: the damage, the spray and the fall. The bearer holds the +/// last pose for the drop, then is drawn as usual again. +/datum/mantis_impale/proc/tear_out(half = FALSE) + if(!running) + return + var/list/blades = mantis_housing_blades(housings) + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/first_blade = length(blades) ? blades[1] : null + var/damage = half ? MANTIS_IMPALE_RIP_DAMAGE * 0.5 : MANTIS_IMPALE_RIP_DAMAGE + var/mob/living/carbon/held = victim + var/mob/living/carbon/holder = bearer + var/rip_dir = lunge_dir + // The rig stays up for the drop; finish() would take it down. + var/datum/mantis_rig/dropping = rig + rig = null + // They fall from where they are drawn now: tipped back about their feet, up on the blades. + var/fall_w = held?.pixel_w + var/fall_z = held?.pixel_z + var/fall_y = held?.pixel_y + var/fall_tilt = tilt_angle + // Only a body drawn upright on the blades (brought up off the floor, or standing) at its usual size. + var/can_fall = held && held.current_size == RESIZE_DEFAULT_SIZE && (hoist_angle || held.body_position != LYING_DOWN || !held.rotate_on_lying || !held.lying_angle) + var/side = facing & (EAST|WEST) + var/face = held?.dir + finish(settle = !can_fall) + if(!QDELETED(held) && held.stat != DEAD) + mantis_note_hit(held, holder) + if(half) + held.hv_hold_attack_message("[holder] loses [holder.p_their()] grip on [held]!", "[holder] loses [holder.p_their()] grip on you!", null, null, null, COMBAT_MESSAGE_RANGE) + else + held.hv_hold_attack_message("[holder] rips both blades out of [held]!", "[holder] rips both blades out of you!", null, null, null, COMBAT_MESSAGE_RANGE) + var/armour = held.run_armor_check(BODY_ZONE_CHEST, MELEE, armour_penetration = first_blade?.armour_penetration, silent = TRUE) + for(var/i in 1 to max(1, length(blades))) + held.apply_damage( + damage, + BRUTE, + BODY_ZONE_CHEST, + armour, + wound_bonus = MANTIS_IMPALE_RIP_WOUND_BONUS, + sharpness = SHARP_EDGED, + attack_direction = rip_dir, + attacking_item = first_blade, + ) + if(QDELETED(held)) + break + if(!QDELETED(held)) + held.hv_flush_hit() + if(!QDELETED(held)) + held.hv_blood_spray(rip_dir, half ? 2 : 3) + if(wall_pin) + held.hv_blood_lay_wall_spray(get_turf(held), rip_dir, held.get_blood_dna_list(), held.get_static_viruses()) + // Someone held up standing goes down now. tg would slide them the 6 px down into its lying offset + // on its own clock while the fall draws them; give them the offset first, so the fall draws it. + var/was_standing = can_fall && held.body_position != LYING_DOWN && held.rotate_on_lying + if(was_standing) + held.add_offsets(LYING_DOWN_TRAIT, y_add = PIXEL_Y_OFFSET_LYING, animate = FALSE) + held.Knockdown(knockdown) + if(was_standing && held.body_position != LYING_DOWN) + held.remove_offsets(LYING_DOWN_TRAIT, animate = FALSE) + playsound(held, 'sound/items/weapons/bladeslice.ogg', 70, TRUE) + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade as anything in blades) + blade.drench(held, light = TRUE) + if(half && !QDELETED(holder)) + holder.set_staggered_if_lower(1.5 SECONDS) + log_combat(holder, held, half ? "lost the grip on" : "ripped the mantis blades out of") + // The fall: one motion from the blades to the floor, ending where tg lays them. Seen from the side they + // were tipped back, so they land on their back, head away from the bearer, still facing them. + if(can_fall && !QDELETED(held)) + if(side && held.body_position == LYING_DOWN && held.rotate_on_lying) + held.set_lying_angle(side == EAST ? LYING_ANGLE_EAST : LYING_ANGLE_WEST) + if(face) + held.setDir(face) + mantis_drop_body(held, fall_w, fall_z, fall_y, fall_tilt, side ? MANTIS_TIP_FEET : 0, MANTIS_IMPALE_DROP_BEAT) + // The drop, drawn once they are down (their layer is the floor's now), then the real bearer fades back in. + if(dropping && !QDELETED(dropping)) + dropping.show("drop", time = MANTIS_IMPALE_DROP_BEAT) + addtimer(CALLBACK(dropping, TYPE_PROC_REF(/datum/mantis_rig, hand_back)), MANTIS_IMPALE_DROP_BEAT, TIMER_DELETE_ME) + +/// The bearer is hit while holding them up. Enough of it and they lose the grip. +/datum/mantis_impale/proc/on_bearer_damaged(datum/source, damage_dealt, damagetype) + SIGNAL_HANDLER + if(!running || damage_dealt <= 0) + return + taken += damage_dealt + if(taken >= MANTIS_IMPALE_BREAK_DAMAGE) + INVOKE_ASYNC(src, PROC_REF(rip), TRUE) + +/// Either of them died, was deleted or was moved off the other. +/datum/mantis_impale/proc/on_lost(datum/source) + SIGNAL_HANDLER + if(!running) + return + // Moving within the hold (a nudge onto the same spot) is fine; apart is not. + if(!holds()) + finish() + +/** + * Lets go of both, puts everything back, and ends. Without [settle] the victim's picture is put back at once + * for the drop to draw the fall from (tear_out()); with it they ease back the way tg would. + */ +/datum/mantis_impale/proc/finish(settle = TRUE) + if(!running) + return + running = FALSE + end_exec_bar(FALSE) + if(tick_timer) + deltimer(tick_timer) + tick_timer = null + if(rig_timer) + deltimer(rig_timer) + rig_timer = null + QDEL_NULL(rig) + if(bearer) + UnregisterSignal(bearer, list(COMSIG_MOB_AFTER_APPLY_DAMAGE, COMSIG_LIVING_DEATH, COMSIG_QDELETING, COMSIG_MOVABLE_MOVED)) + bearer.remove_traits(list(TRAIT_IMMOBILIZED, TRAIT_HANDS_BLOCKED), MANTIS_IMPALE_TRAIT) + for(var/datum/action/cooldown/cyberware/mantis_lunge/lunge as anything in mantis_lunge_actions(bearer)) + if(lunge.impale == src) + lunge.impale = null + if(victim) + UnregisterSignal(victim, list(COMSIG_LIVING_DEATH, COMSIG_QDELETING, COMSIG_MOVABLE_MOVED, COMSIG_LIVING_POST_UPDATE_TRANSFORM)) + REMOVE_TRAIT(victim, TRAIT_IMMOBILIZED, MANTIS_IMPALE_TRAIT) + victim.remove_offsets(MANTIS_IMPALE_TRAIT, animate = settle) + if(!QDELETED(victim)) + untilt() + unhoist(fall = settle) + // Still on the floor: back to the way tg laid them. + if(settle && victim.body_position == LYING_DOWN && prior_dir) + victim.setDir(prior_dir) + if(housings) + mantis_pose_blades(housings, MANTIS_POSE_GUARD) + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade as anything in mantis_housing_blades(housings)) + blade.show_inhand() + if(!QDELETED(src)) + qdel(src) diff --git a/voidcrew/modules/mantis_gore/mantis_lunge_fx.dm b/voidcrew/modules/mantis_gore/mantis_lunge_fx.dm new file mode 100644 index 00000000000..72f1f089403 --- /dev/null +++ b/voidcrew/modules/mantis_gore/mantis_lunge_fx.dm @@ -0,0 +1,509 @@ +// Pictures for the Mantis line's gore. Nothing here changes who gets hit, when or how hard: the +// mechanics call in after they have happened. One-shot holders and temp visuals only; every animate() +// on a mob here is relative and parallel and ends where it began, so tg's offsets, lying turn and #509's +// death throes stay right. (The impale's hoist, which turns a body upright for the hold, is in +// mantis_impale.dm and gives tg's turn back. The blades going into a body are drawn by the blade rig, +// mantis_rig.dm.) + +// ========================================================================= +// THE LUNGE +// ========================================================================= + +/// How long a charged leap's body takes to arc in: longer than the lunge's glide (MANTIS_LUNGE_GLIDE). +#define MANTIS_LEAP_GLIDE 2 + +/// Whether a dash must stop before [step]: a drop, lava or open space. Never crossed, whatever the reach. +/proc/mantis_lunge_unsafe_turf(turf/step) + if(isnull(step)) + return TRUE + return istype(step, /turf/open/chasm) || islava(step) || isspaceturf(step) || istype(step, /turf/open/openspace) + +/// A hardlight afterimage left along the dash. +/obj/effect/temp_visual/decoy/fading/mantis_afterimage + duration = 4 + +/obj/effect/temp_visual/decoy/fading/mantis_afterimage/Initialize(mapload, atom/mimiced_atom, model, fade = 1) + . = ..() + // Washed out to the blade's light, fainter the further back down the line. + color = model == "mantis_scorch" ? list(0.5, 0.3, 0.15, 0.5, 0.3, 0.15, 0.5, 0.3, 0.15, 0.45, 0.25, 0.1) : list(0.25, 0.35, 0.5, 0.25, 0.35, 0.5, 0.25, 0.35, 0.5, 0.15, 0.3, 0.45) + alpha = round(200 * fade) + animate(src, alpha = 0, time = duration) + +/// The streak a lunge leaves at blade height across a tile it passed. +/obj/effect/temp_visual/mantis_trail + icon = MANTIS_GORE_ICON + icon_state = "mantis_trail" + layer = ABOVE_MOB_LAYER + randomdir = FALSE + duration = 5 + +/obj/effect/temp_visual/mantis_trail/Initialize(mapload, trail_dir, model) + . = ..() + if(model == "mantis_scorch") + icon_state = "mantis_scorch_trail" + // The art runs east-west and north-south; a diagonal dash uses the nearer of the two. + setDir((trail_dir & (EAST|WEST)) ? ((trail_dir & EAST) ? EAST : WEST) : ((trail_dir & NORTH) ? NORTH : SOUTH)) + add_overlay(emissive_appearance(icon, icon_state, src)) + +/** + * The dash, drawn after the lunger has already arrived: the body glides in from where it started, and + * each afterimage and streak shows as the body passes it, so the line trails behind. Returns how long the + * body takes to glide in, 0 if it went nowhere: what the dash does to its target waits that long, to land + * as the body does. + */ +/proc/mantis_lunge_dash_fx(mob/living/lunger, turf/start, list/passed, charged, model) + var/turf/finish = get_turf(lunger) + if(isnull(finish) || isnull(start) || !length(passed)) + return 0 + var/dash_dir = get_dir(start, finish) + var/count = length(passed) + var/glide = charged ? MANTIS_LEAP_GLIDE : MANTIS_LUNGE_GLIDE + // The body is already there: draw it back where it started and let it slide in. + var/back_w = (start.x - finish.x) * ICON_SIZE_X + var/back_z = (start.y - finish.y) * ICON_SIZE_Y + // The client glides a move of one tile by itself. Drawn back a tile on top of that, the body would start a + // tile behind where it stood, so here it is not drawn back: its own glide is only made to take as long. + if(get_dist(start, finish) <= 1) + lunger.set_glide_size(DELAY_TO_GLIDE_SIZE(glide)) + back_w = 0 + back_z = 0 + animate(lunger, pixel_w = back_w, pixel_z = back_z, time = 0, flags = ANIMATION_RELATIVE|ANIMATION_PARALLEL) + if(charged) + // A pounce arcs, higher the further it goes. + var/arc = min(2 * get_dist(start, finish) + 4, 16) + animate(pixel_w = -back_w * 0.5, pixel_z = -back_z * 0.5 + arc, time = glide * 0.5, easing = SINE_EASING|EASE_OUT, flags = ANIMATION_RELATIVE) + animate(pixel_w = -back_w * 0.5, pixel_z = -back_z * 0.5 - arc, time = glide * 0.5, easing = SINE_EASING|EASE_IN, flags = ANIMATION_RELATIVE) + cyberware_grey_dust(start) + else + animate(pixel_w = -back_w, pixel_z = -back_z, time = glide, easing = SINE_EASING|EASE_OUT, flags = ANIMATION_RELATIVE) + var/list/spots = list() + for(var/turf/spot as anything in passed) + spots += WEAKREF(spot) + for(var/i in 1 to count) + var/delay = round(glide * (i - 1) / count, world.tick_lag) + // Dashing away from the viewer, the last half-step afterimage would stand in front of the body it trails, + // over its legs: that one is left out. + var/half_step = !(i == count && (dash_dir & NORTH)) + if(delay <= 0) + mantis_dash_ghost(WEAKREF(lunger), spots[i], dash_dir, i / (count + 1), model, half_step) + else + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(mantis_dash_ghost), WEAKREF(lunger), spots[i], dash_dir, i / (count + 1), model, half_step), delay) + return glide + +/** + * The blades of [housings], laid flat for the dash, come back to the guard once the body has glided in, [delay] + * from now. A blade that has taken another pose since (a crouch, a raise) keeps it. + */ +/proc/mantis_lunge_settle(list/housings, delay = 0) + if(delay > 0) + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(mantis_lunge_settle), housings), delay) + return + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade as anything in mantis_housing_blades(housings)) + if(blade.mantis_pose == MANTIS_POSE_LUNGE) + blade.set_mantis_pose(MANTIS_POSE_GUARD) + +/// One step of the dash's wake: two afterimages half a tile apart (one without [half_step]) and the streak, on +/// the tile the body just crossed. +/proc/mantis_dash_ghost(datum/weakref/lunger_ref, datum/weakref/spot_ref, dash_dir, fade, model, half_step = TRUE) + var/mob/living/lunger = lunger_ref?.resolve() + var/turf/spot = spot_ref?.resolve() + if(QDELETED(lunger) || isnull(spot)) + return + new /obj/effect/temp_visual/decoy/fading/mantis_afterimage(spot, lunger, model, fade * 0.7) + if(half_step) + var/obj/effect/temp_visual/decoy/fading/mantis_afterimage/half = new(spot, lunger, model, fade) + half.pixel_x += (dash_dir & EAST) ? 16 : ((dash_dir & WEST) ? -16 : 0) + half.pixel_y += (dash_dir & NORTH) ? 16 : ((dash_dir & SOUTH) ? -16 : 0) + new /obj/effect/temp_visual/mantis_trail(spot, dash_dir, model) + +/// The lunge lands: one impact and a puff of dust, as the gliding body reaches them, [delay] from now (the +/// glide mantis_lunge_dash_fx() gave; none for a body already there). A [pounce] lands with both blades, the +/// second mirrored a beat later. The flash comes with the knockdown (mantis_lunge_knockdown()). +/proc/mantis_lunge_arrival_fx(mob/living/lunger, mob/living/victim, impact_state, pounce = FALSE, delay = MANTIS_LUNGE_GLIDE) + if(QDELETED(victim)) + return + if(delay <= 0) + mantis_lunge_land_fx(WEAKREF(lunger), WEAKREF(victim), impact_state, pounce) + return + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(mantis_lunge_land_fx), WEAKREF(lunger), WEAKREF(victim), impact_state, pounce), delay) + +/// Knocks [victim] down when the lunging body lands on them, with the impact, rather than as the lunge +/// starts its glide in: [delay] from now, as for the impact. They flash as they go: after the fall has begun, +/// because tg's fall is a plain animate() and would end a flash already running. +/proc/mantis_lunge_knockdown(mob/living/victim, amount, delay = MANTIS_LUNGE_GLIDE) + if(QDELETED(victim)) + return + if(delay <= 0) + mantis_lunge_knockdown_now(WEAKREF(victim), amount) + return + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(mantis_lunge_knockdown_now), WEAKREF(victim), amount), delay) + +/proc/mantis_lunge_knockdown_now(datum/weakref/victim_ref, amount) + var/mob/living/victim = victim_ref?.resolve() + if(QDELETED(victim)) + return + victim.Knockdown(amount) + cyberware_flash_fx(victim, 0.2 SECONDS) + +/proc/mantis_lunge_land_fx(datum/weakref/lunger_ref, datum/weakref/victim_ref, impact_state, pounce) + var/mob/living/lunger = lunger_ref?.resolve() + var/mob/living/victim = victim_ref?.resolve() + if(QDELETED(lunger) || QDELETED(victim)) + return + // Skewered: the blades in them are the picture of this hit. + if(HAS_TRAIT_FROM(victim, TRAIT_IMMOBILIZED, MANTIS_IMPALE_TRAIT)) + return + cyberware_play_impact(lunger, victim, impact_state) + if(pounce) + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(mantis_mirrored_impact), lunger_ref, victim_ref, impact_state), 0.4) + var/obj/effect/temp_visual/mook_dust/dust = cyberware_grey_dust(get_turf(victim)) + if(dust) + dust.transform = matrix(0.5, 0, 0, 0, 0.5, 0) + +/// The second blade's impact, from the other side. +/proc/mantis_mirrored_impact(datum/weakref/lunger_ref, datum/weakref/victim_ref, impact_state) + var/mob/living/lunger = lunger_ref?.resolve() + var/mob/living/victim = victim_ref?.resolve() + if(QDELETED(lunger) || QDELETED(victim)) + return + // Skewered: the blades in them are the picture of this hit. + if(HAS_TRAIT_FROM(victim, TRAIT_IMMOBILIZED, MANTIS_IMPALE_TRAIT)) + return + var/obj/effect/abstract/cyberware_anim/impact = cyberware_play_impact(lunger, victim, impact_state) + if(impact) + var/matrix/flipped = matrix(impact.transform) + flipped.a = -flipped.a + impact.transform = flipped + +// ========================================================================= +// THE CUTS +// ========================================================================= + +/// How far over the floor the artery of [zone] opens on [victim], as the spurt's art comes: "low" (a leg, or +/// anyone lying down), "mid" (an arm, the chest) or "high" (the neck). +/proc/mantis_artery_height(mob/living/victim, zone) + if(victim.body_position == LYING_DOWN) + return "low" + switch(zone) + if(BODY_ZONE_HEAD) + return "high" + if(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG) + return "low" + return "mid" + +/// Where the artery of [zone] opens on [body], as it stands, faces and lies now, from the middle of its tile: +/// list(x, y) in pixels. The part as it is drawn (mantis_part_point()); the neck for the head. +/proc/mantis_artery_point(mob/living/body, zone) + if(zone != BODY_ZONE_HEAD) + return mantis_part_point(body, zone) + var/across = (body.dir == EAST) ? 2 : ((body.dir == WEST) ? -3 : 0) + var/matrix/shape = body.transform + return list(round(shape.a * across + shape.b * 5 + shape.c, 1), round(shape.d * across + shape.e * 5 + shape.f, 1)) + +/// How long a spurt's picture shows nothing before its drops leave the wound: the half beat a swinging blade cocks +/// back before it cuts (the slash over the target waits for it the same way, mantis_swing.dm). A tear comes with +/// the click, so without the wait its drops were in the air a frame ahead of the cut. It is the art's own first +/// frame, empty: the client plays it from the same moment as the swing, where a timer on the server could not +/// be held to it. +#define MANTIS_SPURT_WAIT (0.5 DECISECONDS) + +/// The spurt's art, by [height] and whether it is a [weak] one: list(how far out its drops come down, how far +/// below the wound, how long they are in the air). Pixels and deciseconds, as the art is drawn. +/proc/mantis_spurt_shape(height, weak) + switch(height) + if("low") + return list(weak ? 6.7 : 16.16, 6, 3) + if("high") + return list(weak ? 11.63 : 28.18, 24, 4.5) + return list(weak ? 9.8 : 23.74, 16, 4) + +/** + * One spurt out of a torn artery: a handful of drops thrown from the wound the way the cut went ([spurt_dir]), + * big and small in turn, that arc down and land as spots about a tile off ("spurt_[height]" in + * MANTIS_ARTERY_ICON, drawn for each of the eight ways). A [weak] one is fewer drops that fall close by: a + * seared artery, or a wall where the drops would have come down. Upright in the world (it does not lie down + * with the body), in the blood's own colour. Thrown away from the viewer, or out of a limb on the body's far + * side, the drops leave from behind the body; otherwise in front of it. Thrown straight up or down the screen + * they lean out to the wound's side of the body (mantis_spurt_lean()). The drops leave half a beat after the + * call (MANTIS_SPURT_WAIT), with the cut that tore the artery and never ahead of it. Returns the picture. + */ +/proc/mantis_spurt_fx(mob/living/victim, zone, spurt_dir, weak = FALSE) + if(QDELETED(victim) || !isturf(victim.loc) || victim.can_bleed(BLOOD_COVER_TURFS) != BLEED_SPLATTER) + return null + if(!spurt_dir) + spurt_dir = pick(GLOB.alldirs) + var/height = mantis_artery_height(victim, zone) + var/list/point = mantis_artery_point(victim, zone) + // Which side of the body's middle line, as it is drawn, the wound is on. One on the line counts as the right. + var/side = point[1] < 0 ? -1 : 1 + // The wound on the floor's own grid: the body may be drawn off the middle of its tile (lying down, shoved). + var/list/from = list(point[1] + victim.pixel_x + victim.pixel_w, point[2] + victim.pixel_y + victim.pixel_z) + var/turf/land = weak ? null : mantis_spurt_turf(victim, from, height, FALSE, spurt_dir, side) + if(!weak && (isnull(land) || hv_blood_spray_blocked(land))) + weak = TRUE + if(weak) + land = mantis_spurt_turf(victim, from, height, TRUE, spurt_dir, side) + var/list/shape = mantis_spurt_shape(height, weak) + var/state = "[height][weak ? "_weak" : ""]" + // The wait, the flight, and one beat past the landing on its last frame: the spots it shows there are the ones + // laid on the floor. + var/obj/effect/abstract/cyberware_anim/jet = cyberware_anim_play(victim, MANTIS_ARTERY_ICON, "spurt_[state]", MANTIS_ANIM_TOP_LAYER, MANTIS_SPURT_WAIT + shape[3] + world.tick_lag) + if(!jet) + return null + jet.vis_flags &= ~VIS_INHERIT_DIR + jet.setDir(spurt_dir) + // Blood in the air is no part of the body: drawn apart from it, so its layer sorts it against the whole body. + jet.appearance_flags |= RESET_TRANSFORM|RESET_COLOR|KEEP_APART + // 96x96, the wound above its middle so the drops that fall furthest (the neck's, thrown down the screen) stay + // in the picture until they land. Drawn elsewhere, not moved: it stays on the body's own row. + jet.pixel_w = -32 + point[1] + jet.pixel_z = -32 - MANTIS_ARTERY_WOUND_RISE + point[2] + jet.color = victim.get_blood_dna_color() || BLOOD_COLOR_RED + jet.layer = ((spurt_dir & NORTH) || wire_limb_far(zone, victim.dir)) ? BELOW_MOB_LAYER : MANTIS_OVER_VICTIM_LAYER + var/lean = mantis_spurt_lean(weak, spurt_dir, side) + if(lean) + // They lean from when they leave the wound, not while the picture waits. + var/wound_w = jet.pixel_w + animate(jet, pixel_w = wound_w, time = MANTIS_SPURT_WAIT) + animate(pixel_w = wound_w + lean, time = shape[3], easing = SINE_EASING|EASE_OUT) + if(land) + var/list/spot = mantis_spurt_spot(from, height, weak, spurt_dir, side) + var/offset_x = spot[1] - (land.x - victim.x) * ICON_SIZE_X + var/offset_y = spot[2] - (land.y - victim.y) * ICON_SIZE_Y + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(mantis_spurt_land), land, "artery_drops_[state]", spurt_dir, offset_x, offset_y, victim.get_blood_dna_list(), victim.get_static_viruses()), MANTIS_SPURT_WAIT + shape[3]) + return jet + +/// How far a spurt's drops lean sideways by the time they come down, in pixels. Thrown straight up or down the +/// screen out of a wound on one [side] of the body's middle line (-1 left as drawn, 1 right, 0 for no lean) they +/// would fly along the body, behind it or over it: they lean out to the wound's side and land clear of it. +/proc/mantis_spurt_lean(weak, spurt_dir, side) + if(spurt_dir != NORTH && spurt_dir != SOUTH) + return 0 + return side * (weak ? 4 : 9) + +/// Where the middle of a spurt's drops comes down, from the middle of the tile the wound is on: list(x, y). +/// [point] is the wound (mantis_artery_point()), on the [side] of the body mantis_spurt_lean() takes. +/proc/mantis_spurt_spot(list/point, height, weak, spurt_dir, side = 0) + var/list/shape = mantis_spurt_shape(height, weak) + var/out_x = (spurt_dir & EAST) ? 1 : ((spurt_dir & WEST) ? -1 : 0) + var/out_y = (spurt_dir & NORTH) ? 1 : ((spurt_dir & SOUTH) ? -1 : 0) + var/reach = shape[1] * ((out_x && out_y) ? 0.7071 : 1) + return list(point[1] + round(out_x * reach, 1) + mantis_spurt_lean(weak, spurt_dir, side), point[2] - shape[2] + round(out_y * reach, 1)) + +/// The tile a spurt's drops come down on, or null if there is none. +/proc/mantis_spurt_turf(mob/living/victim, list/point, height, weak, spurt_dir, side = 0) + var/list/spot = mantis_spurt_spot(point, height, weak, spurt_dir, side) + return locate(victim.x + round(spot[1] / ICON_SIZE_X, 1), victim.y + round(spot[2] / ICON_SIZE_Y, 1), victim.z) + +/** + * The spots a spurt of arterial blood leaves where its drops come down ("artery_drops_[...]", the last frame + * of the spurt's own art, eight ways), and the drips at the feet off the run down the body ("artery_feet_[...]"). + * Its own kind of blood, not one of the sprays: thin, and a tile keeps only a few. + * + * It is one of tg's drops of blood on purpose, with tg's own list of drop pictures. tg's bleeding feeds its + * drips to the first wet blood it finds on a tile unless that blood is drops, so someone bleeding over spots + * that were plain blood would never stand in a pool. Onto drops it lets its own drips fall as ever, and turns + * the lot into its pool in the end. + */ +/obj/effect/decal/cleanable/blood/drip/mantis_drops + name = "blood drops" + icon = MANTIS_GORE_ICON + icon_state = "artery_drops_mid" + mergeable_decal = FALSE + // Thin enough that walking through it does not leave footprints. + bloodiness = 10 + drying_time = 3 MINUTES + beauty = -15 + base_name = null + base_suffix = "drops" + /// How many drips off a run have landed here, if this is the pool at someone's feet. + var/feet_drips = 0 + +// Too thin to dive into. +/obj/effect/decal/cleanable/blood/drip/mantis_drops/can_bloodcrawl_in() + return FALSE + +/// A spurt's drops come down on [land]: its spots are laid, [offset_x] and [offset_y] pixels from the tile's +/// middle. Wet spots already there from the same beat of the same wound are only freshened, and a tile holds +/// no more than a few. Returns the spots. +/proc/mantis_spurt_land(turf/land, state, spurt_dir, offset_x, offset_y, list/blood_dna, list/viruses) + if(!isturf(land) || !length(blood_dna) || hv_blood_spray_blocked(land) || isgroundlessturf(land) || !land.has_gravity()) + return null + var/laid = 0 + for(var/obj/effect/decal/cleanable/blood/drip/mantis_drops/wet in land) + if(wet.dried || wet.feet_drips || QDELETED(wet)) + continue + laid++ + if(laid >= 4 || (wet.icon_state == state && wet.dir == spurt_dir && wet.pixel_x == offset_x && wet.pixel_y == offset_y)) + wet.add_blood_DNA(blood_dna, viruses) + return wet + var/obj/effect/decal/cleanable/blood/drip/mantis_drops/drops = new(land, viruses, blood_dna) + if(QDELETED(drops)) + return null + drops.icon_state = state + drops.setDir(spurt_dir) + drops.pixel_x = offset_x + drops.pixel_y = offset_y + return drops + +/// The blood run down a body from a torn artery (mantis_artery_run_fx()). +/obj/effect/abstract/cyberware_anim/mantis_run + icon = MANTIS_GORE_ICON + layer = MANTIS_ANIM_TOP_LAYER + /// The part it runs from. + var/zone + +/// Run its length: a still picture from here on, whichever way the body turns. +/obj/effect/abstract/cyberware_anim/mantis_run/proc/ran() + icon_state = "artery_ran_[zone]" + +/// A drip falls off the run's lower end and lands at the feet. +/obj/effect/abstract/cyberware_anim/mantis_run/proc/drip() + var/mob/living/body = bearer + if(QDELETED(src) || !istype(body) || QDELETED(body) || body.body_position == LYING_DOWN) + return + mantis_feet_drip(body, zone) + +/// Where the run down a body from [zone] comes to the sole of a body facing [facing], in pixels across from the +/// middle of its tile: the lower end of the art's own run ("artery_ran_[zone]"). Where the part is on the body's +/// far side and the run can't be seen, the sole the blood comes down to all the same. +/proc/mantis_artery_run_foot(zone, facing) + var/static/list/feet = list( + BODY_ZONE_HEAD = list("[SOUTH]" = 0, "[NORTH]" = 0, "[EAST]" = 3, "[WEST]" = -2), + BODY_ZONE_CHEST = list("[SOUTH]" = 1, "[NORTH]" = 0, "[EAST]" = 3, "[WEST]" = -2), + BODY_ZONE_L_ARM = list("[SOUTH]" = 5, "[NORTH]" = -7, "[EAST]" = -1, "[WEST]" = 2), + BODY_ZONE_R_ARM = list("[SOUTH]" = -6, "[NORTH]" = 5, "[EAST]" = -1, "[WEST]" = 2), + BODY_ZONE_L_LEG = list("[SOUTH]" = 4, "[NORTH]" = -2, "[EAST]" = 0, "[WEST]" = 2), + BODY_ZONE_R_LEG = list("[SOUTH]" = -3, "[NORTH]" = 2, "[EAST]" = 0, "[WEST]" = 2), + ) + var/list/by_facing = feet[zone] + return by_facing?["[facing]"] + +/** + * A drip off the blood run down [victim] from [zone] lands at the feet, two pixels under the sole the run comes + * down to: a spot there ("artery_feet_1"), wider with the next, a small pool with the third. Nothing where no + * blood would lie. Returns the spot. + */ +/proc/mantis_feet_drip(mob/living/victim, zone) + if(QDELETED(victim) || !isturf(victim.loc) || victim.can_bleed(BLOOD_COVER_TURFS) != BLEED_SPLATTER) + return null + var/foot = mantis_artery_run_foot(zone, victim.dir) + if(isnull(foot)) + return null + // The sole is the body picture's lowest row, 15 pixels under the middle of the tile, wherever the body is drawn. + var/matrix/shape = victim.transform + var/drip_x = round(shape.a * foot + shape.b * -15 + shape.c, 1) + victim.pixel_x + victim.pixel_w + var/drip_y = round(shape.d * foot + shape.e * -15 + shape.f, 1) + victim.pixel_y + victim.pixel_z - 2 + var/turf/land = locate(victim.x + round(drip_x / ICON_SIZE_X, 1), victim.y + round(drip_y / ICON_SIZE_Y, 1), victim.z) + if(!isturf(land) || isgroundlessturf(land) || !land.has_gravity() || (land != victim.loc && hv_blood_spray_blocked(land))) + return null + var/offset_x = drip_x - (land.x - victim.x) * ICON_SIZE_X + var/offset_y = drip_y - (land.y - victim.y) * ICON_SIZE_Y + for(var/obj/effect/decal/cleanable/blood/drip/mantis_drops/wet in land) + if(!wet.feet_drips || wet.dried || QDELETED(wet) || wet.pixel_x != offset_x || wet.pixel_y != offset_y) + continue + wet.feet_drips = min(wet.feet_drips + 1, 3) + wet.icon_state = "artery_feet_[wet.feet_drips]" + wet.add_blood_DNA(victim.get_blood_dna_list(), victim.get_static_viruses()) + return wet + var/obj/effect/decal/cleanable/blood/drip/mantis_drops/pool = new(land, victim.get_static_viruses(), victim.get_blood_dna_list()) + if(QDELETED(pool)) + return null + pool.feet_drips = 1 + pool.icon_state = "artery_feet_1" + pool.pixel_x = offset_x + pool.pixel_y = offset_y + return pool + +/** + * The blood of a torn artery runs down [victim]'s body from the wound on [zone] to the feet: a thin broken + * line that grows over half a second and stays ("artery_run_[zone]", then "artery_ran_[zone]", drawn for the + * body's four facings; nothing where the part is on the body's far side). Part of the body: it turns and lies + * down with it. It lasts as long as [torn], the wound. Only on someone upright: lying down, the blood goes + * straight to the floor. Returns the picture. + */ +/proc/mantis_artery_run_fx(mob/living/victim, zone, datum/wound/torn) + if(QDELETED(victim) || QDELETED(torn) || victim.body_position == LYING_DOWN) + return null + if(!icon_exists(MANTIS_GORE_ICON, "artery_run_[zone]")) + return null + var/obj/effect/abstract/cyberware_anim/mantis_run/run = new(null) + run.bearer = victim + run.zone = zone + run.icon_state = "artery_run_[zone]" + run.appearance_flags |= RESET_COLOR + run.color = victim.get_blood_dna_color() || BLOOD_COLOR_RED + run.RegisterSignal(victim, COMSIG_QDELETING, TYPE_PROC_REF(/obj/effect/abstract/cyberware_anim, on_bearer_deleted)) + // The wound closing, or going with its limb, takes the run with it. + run.RegisterSignal(torn, COMSIG_QDELETING, TYPE_PROC_REF(/obj/effect/abstract/cyberware_anim, on_bearer_deleted)) + victim.vis_contents += run + addtimer(CALLBACK(run, TYPE_PROC_REF(/obj/effect/abstract/cyberware_anim/mantis_run, ran)), 0.8 SECONDS) + // It comes to the feet, and three drips fall off it there. + for(var/wait in list(0.6 SECONDS, 0.95 SECONDS, 1.25 SECONDS)) + addtimer(CALLBACK(run, TYPE_PROC_REF(/obj/effect/abstract/cyberware_anim/mantis_run, drip)), wait) + return run + +/// A Scorch cut: a white-hot seam across the limb that cools to char. +/proc/mantis_scorch_seam_fx(mob/living/carbon/victim, obj/item/bodypart/limb) + var/state = "scorch_gash_[limb.body_zone]" + if(!icon_exists(MANTIS_GORE_ICON, state)) + return null + return cyberware_anim_play(victim, MANTIS_GORE_ICON, state, MANTIS_ANIM_BLADE_LAYER, 1.5 SECONDS, glow = TRUE) + +/// The X-slash lands: a flash of light off the blades. The two crossed strokes are drawn with the blades' own +/// swings (mantis_xslash_cross(), mantis_swing.dm). +/proc/mantis_xslash_fx(mob/living/user, mob/living/victim, impact_state) + if(QDELETED(victim)) + return + cyberware_flash_fx(victim, 0.15 SECONDS) + victim.mob_light(2, 1.5, impact_state == "impact_scorch" ? LIGHT_COLOR_FIRE : "#bfe6ff", 0.2 SECONDS) + +// ========================================================================= +// IMPALE, SCISSOR, CROUCH +// ========================================================================= + +/// The way [looker] turns to look at [seen], as face_atom() picks it, whatever state [looker] is in. +/proc/mantis_face_dir(atom/looker, atom/seen) + var/dx = seen.x - looker.x + var/dy = seen.y - looker.y + if(abs(dx) < abs(dy)) + return dy > 0 ? NORTH : SOUTH + return dx > 0 ? EAST : WEST + +/// How [victim] lies, for the scissor's art: "stand", or "lie90"/"lie270" by the way tg has turned them. +/proc/mantis_scissor_posture(mob/living/victim) + if(victim.body_position != LYING_DOWN || !victim.rotate_on_lying) + return "stand" + return victim.lying_angle == 270 ? "lie270" : "lie90" + +/// Someone under the raised blades shudders: small sideways jolts, relative, ending where they began. +/proc/mantis_struggle_fx(mob/living/victim, duration) + if(QDELETED(victim)) + return + var/static/list/jolts = list(1, -1, 1, 0, -1, 1, -1, 0) + var/step_time = duration / length(jolts) + var/offset = 0 + for(var/i in 1 to length(jolts)) + var/shift = jolts[i] - offset + offset = jolts[i] + if(i == 1) + animate(victim, pixel_w = shift, time = step_time, flags = ANIMATION_RELATIVE|ANIMATION_PARALLEL) + else + animate(pixel_w = shift, time = step_time, flags = ANIMATION_RELATIVE) + +/// The crouched blade's glow, brightening over the charge. Gone with the crouch. +/proc/mantis_coil_glow_fx(mob/living/bearer, obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade) + var/state = "[blade.base_icon_state]_coil_glow_[blade.hand_side()]" + if(!icon_exists(MANTIS_GORE_ICON, state)) + return null + var/obj/effect/abstract/cyberware_anim/glow = cyberware_anim_play(bearer, MANTIS_GORE_ICON, state, MANTIS_ANIM_BLADE_LAYER, MANTIS_CHARGE_MAX_HOLD + 1 SECONDS, glow = TRUE) + if(!glow) + return null + // Side on, the far blade's glow stays behind the near blade. + glow.sort_as_arm(blade.hand_side()) + glow.alpha = 0 + animate(glow, alpha = 255, time = MANTIS_CHARGE_FULL - MANTIS_CHARGE_TAP) + return glow + +#undef MANTIS_LEAP_GLIDE +#undef MANTIS_SPURT_WAIT diff --git a/voidcrew/modules/mantis_gore/mantis_rig.dm b/voidcrew/modules/mantis_gore/mantis_rig.dm new file mode 100644 index 00000000000..ce74f3981f6 --- /dev/null +++ b/voidcrew/modules/mantis_gore/mantis_rig.dm @@ -0,0 +1,568 @@ +/** + * # The blade rig: the impale and the scissor, drawn around the victim + * + * Both moves need parts of the bearer under the victim and parts over it: in the side view the far blade + * and the bearer's body go under the person skewered and the near arm and blade over them, and the far + * blade passes under a neck on the floor while the bearer stands over it. Pictures attached to a mob + * (overlays, underlays, vis_contents) are drawn with the mob, so they can't sit between two mobs. So for + * these moves the bearer is drawn as separate pictures ("puppets") standing on their tile, each with its + * own layer next to the victim's, the way the Gorilla Arms finishers draw their arm rig + * (voidcrew/modules/hyperviolence_gorilla/chrome_puppet_rig.dm): + * + * - "body": a copy of the bearer's appearance without the held blades, and without the hands seen from the + * front or back, where the blades' forearms take their place. + * - The arms and blades of each beat, from mantis_gore_reach.dmi: "___", 96x96 with + * the bearer's tile in the middle. Steel inside the victim on the camera's side of them is cut out of its + * piece; steel on their far side is drawn under them and left to their outline. Blood on the blades is a coat over + * each piece ("_blood" or "_soak", the held art's two coats) tinted by the blood, read off the held + * blades, so a blade already wet stays wet and one drenched in the move turns red as it happens. The impale + * also has wet points from the moment they come out of the back, in the victim's blood. + * - Pieces of the victim's blood: "wound" (where the steel goes in and out) and "drip" (drops off the points), + * and "glint", the light on the near blade before the scissor. Sprays, and the crackle of the blades' light + * at the points as they punch out, are loose pictures (burst()) that stay where they started and outlive the beat. + * - The map is SIDE_MAP: rows sort before layers, so every picture is centred with pixel_w/pixel_z and stands on + * the row of what it must sort against (sort_y()). + * + * mantis_rig_beat() has each beat's stack, back to front, with "T" where the victim goes, and the lean. + * Puppets are plain objects on the bearer's tile, so nothing touches the real bearer's own picture, + * offsets or layer; the real bearer is hidden with a colour filter (still clickable over its whole tile) + * and comes back when the rig is deleted. Its owner deletes it on every way the move ends. + */ + +#define MANTIS_RIG_HIDE_FILTER "mantis_rig_hide" +/// The gap between two neighbours in the stack around the victim. +#define MANTIS_RIG_LAYER_STEP 0.001 + +/** + * One beat of [move] seen facing [facing], from the approved storyboards (S/mantis-storyboard): list(order, + * bearer_w, bearer_z, target_w, target_z, tilt, raise). Order is the stack back to front: "T" is the victim, + * "body" the bearer's flat picture without the held blades, "whole" that picture as the bearer is held (blades + * and all), anything else a piece. Bearer and target are pixel offsets from their own tiles; tilt turns the + * victim about the feet (degrees, clockwise); raise is how high the fists ride in the body picture (0 leaves + * it). West is east mirrored. + */ +/proc/mantis_rig_beat(move, beat, facing) + var/view = (facing & (EAST|WEST)) ? "E" : (facing == NORTH ? "N" : "S") + var/list/spec + switch("[move]_[beat]_[view]") + // ---- The impale. "arrive" glides in with the lunging body. "contact" is the slide onto the blades: whole + // blades, and everything on the far side of the target (the near blade past the fist, "nrest", in the side + // view) drawn under them, so the target itself covers the steel it has slid onto. Then they are in: "enter". + if("impale_arrive_E") + spec = list(list("T", "far", "body", "near"), 2, 0, 0, 0, 0, 2) + if("impale_contact_E") + spec = list(list("far", "body", "nrest", "T", "narm", "near"), 7, 0, -17, 0, 0, 1) + // From the stab to the hold the blades go through the same place on the target: "enter", "lift1" and "lift2" + // are the hold's blades 4, 2 and 1 px lower, with the target. The steel inside them is cut out of the near + // blade; the far blade is under them. + if("impale_enter_E") + spec = list(list("far", "body", "T", "wound", "narm", "near"), 7, 0, -17, 0, 0, 1) + if("impale_lift1_E") + spec = list(list("far", "body", "T", "wound", "narm", "near"), 7, 0, -17, 2, 0, 2) + if("impale_lift2_E") + spec = list(list("far", "body", "T", "wound", "narm", "near"), 7, 0, -17, 3, 0, 2) + if("impale_hold_E") + spec = list(list("far", "body", "T", "wound", "drip", "narm", "near"), 7, 0, -17, 4, 0, 2) + // The pull-back in three steps: the bearer leans back, the arms draw back and the target slides off, + // 3 px of steel out a step. Only what has come out of the front shows. + if("impale_pull1_E") + spec = list(list("far", "body", "T", "wound", "narm", "near"), 6, 0, -16, 3, 0, 2) + if("impale_pull2_E") + spec = list(list("far", "body", "T", "wound", "narm", "near"), 5, 0, -15, 2, 0, 2) + if("impale_pull3_E") + spec = list(list("far", "body", "T", "wound", "narm", "near"), 4, 0, -14, 1, 0, 2) + if("impale_rip_E") + spec = list(list("far", "body", "T", "near"), 6, 0, -12, 2, 14, 1) + if("impale_drop_E") + spec = list(list("T", "far", "body", "near"), 0, 0, 0, 0, 0, 2) + // Seen from behind the target is on the row beyond the bearer, facing the camera. The blades go into the + // chest a torso's width apart: "arms" is the forearms and the fists, which the bearer's back hides; "tips" + // is the blades, drawn behind the target: what shows of them is the points past the shoulders by the neck. + if("impale_arrive_N") + spec = list(list("T", "arms", "body"), 0, 2, 0, 0, 0, 0) + if("impale_contact_N", "impale_enter_N") + spec = list(list("tips", "T", "arms", "body"), 0, 24, 0, 0, 0, 0) + if("impale_lift1_N") + spec = list(list("tips", "T", "arms", "body"), 0, 24, 0, 2, 0, 0) + if("impale_lift2_N") + spec = list(list("tips", "T", "arms", "body"), 0, 24, 0, 3, 0, 0) + if("impale_hold_N") + spec = list(list("tips", "T", "arms", "body"), 0, 24, 0, 4, 0, 0) + if("impale_pull1_N") + spec = list(list("tips", "T", "arms", "body"), 0, 23, 0, 3, 0, 0) + if("impale_pull2_N") + spec = list(list("tips", "T", "arms", "body"), 0, 22, 0, 2, 0, 0) + if("impale_pull3_N") + spec = list(list("tips", "T", "arms", "body"), 0, 21, 0, 1, 0, 0) + if("impale_rip_N") + spec = list(list("T", "arms", "body"), 0, 15, 0, 0, 0, 0) + // The drop from the front and the back is the bearer as they are held again ("whole": the guard, blood and + // all), so nothing changes when the real bearer comes back. + if("impale_drop_N") + spec = list(list("T", "whole"), 0, 0, 0, 0, 0, 0) + // Seen from the front the target is on the row before the bearer, their back to the camera, and covers the + // bearer's arms and the steel going in. "tips" is the two points out of their back, over them. + if("impale_arrive_S") + spec = list(list("body", "arms", "T"), 0, -2, 0, 0, 0, 0) + if("impale_contact_S") + spec = list(list("body", "arms", "T"), 0, 0, 0, 24, 0, 0) + if("impale_enter_S") + spec = list(list("body", "arms", "T", "wound", "tips"), 0, 0, 0, 24, 0, 0) + if("impale_lift1_S") + spec = list(list("body", "arms", "T", "wound", "tips"), 0, 0, 0, 26, 0, 0) + if("impale_lift2_S") + spec = list(list("body", "arms", "T", "wound", "tips"), 0, 0, 0, 27, 0, 0) + if("impale_hold_S") + spec = list(list("body", "arms", "T", "wound", "tips", "drip"), 0, 0, 0, 28, 0, 0) + if("impale_pull1_S") + spec = list(list("body", "arms", "T", "wound", "tips"), 0, 0, 0, 27, 0, 0) + if("impale_pull2_S") + spec = list(list("body", "arms", "T", "wound", "tips"), 0, 0, 0, 25, 0, 0) + if("impale_pull3_S") + spec = list(list("body", "arms", "T", "wound", "tips"), 0, 0, 0, 23, 0, 0) + if("impale_rip_S") + spec = list(list("body", "arms", "T"), 0, -2, 0, 13, 0, 0) + // They fall in front of the bearer, and are drawn over them all the way down. + if("impale_drop_S") + spec = list(list("whole", "T"), 0, 0, 0, 0, 0, 0) + // ---- The scissor. + if("scissor_raise_E") + spec = list(list("T", "far", "body", "near"), 0, 0, 0, 0, 0, 3) + if("scissor_glint_E") + spec = list(list("T", "far", "body", "near", "glint"), 0, 0, 0, 0, 0, 3) + // Half way down from the raise to the close: the swing. + if("scissor_swing_E") + spec = list(list("T", "far", "body", "near"), 5, 0, 0, 0, 0, 2) + if("scissor_close_E", "scissor_cut_E") + spec = list(list("fblade", "T", "farm", "body", "near"), 10, 0, 0, 0, 0, 1) + if("scissor_recover_E") + spec = list(list("T", "far", "body", "near"), 0, 0, 0, 0, 0, 2) + if("scissor_raise_N", "scissor_recover_N") + spec = list(list("T", "arms", "body"), 0, 0, 0, 0, 0, 0) + if("scissor_glint_N") + spec = list(list("T", "arms", "glint", "body"), 0, 0, 0, 0, 0, 0) + if("scissor_close_N", "scissor_cut_N") + spec = list(list("T", "arms", "body"), 0, 10, 0, 0, 0, 0) + if("scissor_raise_S", "scissor_recover_S") + spec = list(list("T", "body", "arms"), 0, 0, 0, 0, 0, 0) + if("scissor_glint_S") + spec = list(list("T", "body", "arms", "glint"), 0, 0, 0, 0, 0, 0) + if("scissor_swing_S") + spec = list(list("T", "body", "arms"), 0, -8, 0, 0, 0, 0) + if("scissor_close_S", "scissor_cut_S") + spec = list(list("T", "body", "arms"), 0, -16, 0, 0, 0, 0) + if(isnull(spec)) + return null + if(facing & WEST) + spec[MANTIS_RIG_BEARER_W] = -spec[MANTIS_RIG_BEARER_W] + spec[MANTIS_RIG_TARGET_W] = -spec[MANTIS_RIG_TARGET_W] + spec[MANTIS_RIG_TILT] = -spec[MANTIS_RIG_TILT] + return spec + +/// The way the rig draws a move from [user] to [victim]: the side view for anything off to the side. +/proc/mantis_rig_facing(atom/user, atom/victim) + var/toward = get_dir(user, victim) || user.dir + if(toward & EAST) + return EAST + if(toward & WEST) + return WEST + return toward & NORTH ? NORTH : SOUTH + +/// One picture of the rig on the bearer's tile. +/obj/effect/abstract/mantis_puppet + name = "body" + mouse_opacity = MOUSE_OPACITY_TRANSPARENT + anchored = TRUE + appearance_flags = PIXEL_SCALE | TILE_BOUND | LONG_GLIDE + animate_movement = NO_STEPS + plane = GAME_PLANE + layer = MOB_LAYER + vis_flags = NONE + /// Pixels it is drawn off the bearer's lean (pixel_w, pixel_z): a 96x96 piece is centred on the tile, and + /// one standing on another row (mantis_rig/proc/set_row()) is drawn back where it belongs. + var/shift_w = 0 + var/shift_z = 0 + +/// A spray of the victim's blood drawn by the rig: it stays where it started and goes on its own. +/obj/effect/abstract/mantis_rig_fx + name = "blood" + icon = MANTIS_GORE_REACH_ICON + mouse_opacity = MOUSE_OPACITY_TRANSPARENT + anchored = TRUE + appearance_flags = PIXEL_SCALE | TILE_BOUND | LONG_GLIDE + animate_movement = NO_STEPS + plane = GAME_PLANE + layer = MOB_LAYER + vis_flags = NONE + +/datum/mantis_rig + /// Who is drawn + var/mob/living/carbon/bearer + /// Whom the stack is built around + var/mob/living/victim + /// The way the pictures face + var/facing + /// The blades' model, for the pieces + var/model + /// "impale" or "scissor" + var/move + /// Key -> /obj/effect/abstract/mantis_puppet + var/list/puppets = list() + /// The beat drawn now + var/beat + /// How high the fists ride in the body picture now + var/raise = 0 + /// The bearer's own offsets when the rig went up, under every lean + var/base_w = 0 + var/base_z = 0 + /// The lean drawn now, from base_w and base_z + var/lean_w = 0 + var/lean_z = 0 + /// TRUE while the real bearer is hidden + var/hidden = FALSE + var/old_mouse_opacity + /// The victim's layer when the beat drawn now went up + var/victim_layer = MOB_LAYER + /// The colour of the victim's blood, or null if they don't bleed + var/victim_color + /// TRUE once the points have been through the victim: wet with their blood even before a drench + var/wet = FALSE + /// The blood on the blades drawn now: null, "blood" or "soak" (the held art's coats), and its colour + var/coat + var/coat_color + /// TRUE while the pictures fade out and the real bearer fades back in (hand_back()) + var/handing_back = FALSE + /// TRUE while the body picture is the bearer as they are held, blades and all ("whole") + var/whole = FALSE + +/datum/mantis_rig/New(mob/living/carbon/bearer, mob/living/victim, facing, model, move) + . = ..() + src.bearer = bearer + src.victim = victim + src.facing = facing + src.model = model + src.move = move + RegisterSignal(bearer, COMSIG_QDELETING, PROC_REF(on_bearer_deleted)) + // A kill while the rig draws the blades only stains them: the rig draws the blood it leaves (mantis_kill_credit()). + bearer.get_mantis_state().rig = src + if(victim) + RegisterSignal(victim, COMSIG_QDELETING, PROC_REF(on_victim_deleted)) + if(victim.can_bleed(BLOOD_COVER_TURFS) == BLEED_SPLATTER) + var/datum/blood_type/blood = victim.get_bloodtype() + victim_color = blood?.get_color() + +/datum/mantis_rig/Destroy() + reveal() + for(var/key in puppets) + qdel(puppets[key]) + puppets = null + if(bearer) + UnregisterSignal(bearer, COMSIG_QDELETING) + if(bearer.mantis_state?.rig == src) + bearer.mantis_state.rig = null + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade as anything in mantis_held_blades(bearer)) + blade.show_inhand() + if(victim) + UnregisterSignal(victim, COMSIG_QDELETING) + bearer = null + victim = null + return ..() + +/datum/mantis_rig/proc/on_bearer_deleted(datum/source) + SIGNAL_HANDLER + qdel(src) + +/datum/mantis_rig/proc/on_victim_deleted(datum/source) + SIGNAL_HANDLER + UnregisterSignal(victim, COMSIG_QDELETING) + victim = null + +/** + * Puts the rig up: hides the held blades and the real bearer and stands the body picture in its place. + * FALSE if the bearer can't be drawn this way (not on a turf); the move goes on without the poses. + */ +/datum/mantis_rig/proc/start() + if(QDELETED(bearer) || !isturf(bearer.loc)) + return FALSE + base_w = bearer.pixel_w - bearer.has_offset(HV_FINISHER_OFFSET, PIXEL_W_OFFSET) + base_z = bearer.pixel_z - bearer.has_offset(HV_FINISHER_OFFSET, PIXEL_Z_OFFSET) + snapshot() + conceal() + return TRUE + +/** + * Draws the body puppet as the bearer looks now, without the held blades: a copy of the bearer's own + * appearance, so the client already has every icon in it and it never blinks while one downloads. Seen from + * the front or back the hands and gloves are left off: the forearms of the blades start at the elbows. + * [as_held]: the bearer exactly as they are held, blades, hands and all, for a beat that ends on the held art. + */ +/datum/mantis_rig/proc/snapshot(as_held = FALSE) + whole = as_held + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade as anything in mantis_held_blades(bearer)) + if(as_held) + blade.show_inhand() + else + blade.hide_inhand_for(10 SECONDS) + var/mutable_appearance/look = new(bearer.appearance) + look.filters = null + if(!as_held && (facing & (NORTH|SOUTH))) + for(var/image/part as anything in look.overlays.Copy()) + if(part.layer == -GLOVES_LAYER || findtext("[part.icon_state]", "_hand")) + look.overlays -= part + var/obj/effect/abstract/mantis_puppet/body = puppet("body") + var/body_layer = body.layer + var/body_row = body.pixel_y + body.appearance = look + body.dir = facing + body.layer = body_layer + body.mouse_opacity = MOUSE_OPACITY_TRANSPARENT + body.pixel_x = own_x() + body.pixel_y = body_row + body.pixel_w = base_w + lean_w + body.shift_w + body.pixel_z = base_z + lean_z + body.shift_z + +/** + * The bearer's pixel_x and pixel_y under the rig's own lean: without a #509 finisher's lean (pose_user()), which + * the rig draws itself. pixel_y is also the row the pictures sort on. + */ +/datum/mantis_rig/proc/own_x() + return bearer.pixel_x - bearer.has_offset(HV_FINISHER_OFFSET, PIXEL_X_OFFSET) + +/datum/mantis_rig/proc/own_y() + return bearer.pixel_y - bearer.has_offset(HV_FINISHER_OFFSET, PIXEL_Y_OFFSET) + +/// The fists ride [new_raise] pixels high in the body picture (mantis_stance_raise()). +/datum/mantis_rig/proc/set_raise(new_raise) + if(!new_raise || new_raise == raise || QDELETED(bearer)) + return + raise = new_raise + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade as anything in mantis_held_blades(bearer)) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing = blade.housing_ref?.resolve() + housing?.set_stance_raise(new_raise) + if(puppets["body"]) + snapshot(whole) + +/// The puppet under [key], made on the bearer's tile at the lean drawn now if there isn't one. +/datum/mantis_rig/proc/puppet(key) + var/obj/effect/abstract/mantis_puppet/picture = puppets[key] + if(picture) + return picture + picture = new(get_turf(bearer)) + picture.name = bearer.name + picture.pixel_x = own_x() + picture.pixel_y = own_y() + // Centred with pixel_w and pixel_z only: pixel_y picks the row it sorts on (set_row()). + if(key != "body") + picture.icon = MANTIS_GORE_REACH_ICON + picture.shift_w = -ICON_SIZE_X + picture.shift_z = -ICON_SIZE_Y + picture.pixel_w = base_w + lean_w + picture.shift_w + picture.pixel_z = base_z + lean_z + picture.shift_z + puppets[key] = picture + return picture + +/** + * The pixel_y, from the bearer's tile, of the row a picture drawn [behind] the victim (or in front of them) + * sorts on. The map is SIDE_MAP: BYOND sorts by row (a tile's y plus pixel_y) before layer, so a picture + * only sorts against the victim by its layer on the victim's own row. One the bearer's row already puts on + * the right side of the victim stays on the bearer's row, under or over everything else there as before. + */ +/datum/mantis_rig/proc/sort_y(behind) + var/own = own_y() + if(!victim || QDELETED(victim) || victim.z != bearer.z || !isturf(victim.loc)) + return own + var/theirs = (victim.y - bearer.y) * ICON_SIZE_Y + victim.pixel_y + if(behind ? own > theirs : own < theirs) + return own + return theirs + +/// Stands [picture] on the row [row_y], still drawn where it was. +/datum/mantis_rig/proc/set_row(obj/effect/abstract/mantis_puppet/picture, row_y) + var/change = row_y - picture.pixel_y + if(!change) + return + picture.pixel_y = row_y + picture.shift_z -= change + picture.pixel_z -= change + +/** + * Draws [new_beat]: each piece of its stack is swapped in at its layer next to the victim's, pieces it + * doesn't use go, and the whole bearer leans to the beat's lean, plus [extra_w] and [extra_z], over [time]. + * With [from_w] or [from_z] every picture starts that far off and glides into place over [time] instead, the + * way the lunging body glides in (mantis_lunge_dash_fx()): one animation, so the client sees the start. + * [ride_z] lifts everything but the bearer's body that far: the arms and the blades riding with someone who + * sags on them, so the steel in them stays where it is in them. [body_z] lifts the bearer's body and the arms + * on it ("arms": the forearms and fists) that far: the hands stay on the wrists while the blades' points stay put. + */ +/datum/mantis_rig/proc/show(new_beat, extra_w = 0, extra_z = 0, time = 0.1 SECONDS, from_w = 0, from_z = 0, easing = SINE_EASING, ride_z = 0, body_z = 0) + if(QDELETED(bearer)) + return + var/list/spec = mantis_rig_beat(move, new_beat, facing) + if(!spec) + return + beat = new_beat + set_raise(spec[MANTIS_RIG_RAISE]) + var/list/order = spec[MANTIS_RIG_ORDER] + var/victim_at = order.Find("T") + victim_layer = (victim && !QDELETED(victim)) ? victim.layer : bearer.layer + var/list/used = list() + for(var/i in 1 to length(order)) + var/key = order[i] + if(key == "T") + continue + // The victim's own blood: nothing to draw on someone who doesn't bleed. + var/bloody = (key == "wound" || key == "drip") + if(bloody && !victim_color) + continue + // The body picture, with or without the held blades. + if(key == "whole" || key == "body") + if((key == "whole") != whole) + snapshot(key == "whole") + key = "body" + var/obj/effect/abstract/mantis_puppet/picture = puppet(key) + if(key != "body") + var/state = "[model]_[move]_[beat]_[key]" + // A looping picture (the drops) would start over if it were set again. + if(picture.icon_state != state) + picture.icon_state = state + picture.dir = facing + if(bloody) + picture.color = victim_color + picture.layer = victim_layer + (i - victim_at) * MANTIS_RIG_LAYER_STEP + set_row(picture, sort_y(i < victim_at)) + used[key] = TRUE + for(var/key in puppets.Copy()) + if(!used[key]) + qdel(puppets[key]) + puppets -= key + dress() + lean_w = spec[MANTIS_RIG_BEARER_W] + extra_w + lean_z = spec[MANTIS_RIG_BEARER_Z] + extra_z + for(var/key in puppets) + var/obj/effect/abstract/mantis_puppet/picture = puppets[key] + var/to_w = base_w + lean_w + picture.shift_w + var/to_z = base_z + lean_z + picture.shift_z + (key == "body" ? body_z : ride_z) + (key == "arms" ? body_z : 0) + if(from_w || from_z) + picture.pixel_w = to_w + from_w + picture.pixel_z = to_z + from_z + // At once, ending whatever was still moving it. + if(!time) + animate(picture, pixel_w = to_w, pixel_z = to_z, time = 0) + continue + animate(picture, pixel_w = to_w, pixel_z = to_z, time = time, easing = easing) + +/** + * Blood on the blades as the held blades have it now: the heavier coat while one is drenched, the light one + * while one is only stained, and at least the light one in the victim's blood once the points have been + * through them. A blade that keeps itself clean (the Scorch) shows none. + */ +/datum/mantis_rig/proc/read_coat() + coat = null + coat_color = null + if(QDELETED(bearer)) + return + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade as anything in mantis_held_blades(bearer)) + if(blade.item_flags & NO_BLOOD_ON_ITEM) + coat = null + return + if(!blade.is_bloody() || coat == "soak") + continue + coat = world.time < blade.soaked_until ? "soak" : "blood" + coat_color = blade.get_blood_dna_color() + if(!coat && wet && victim_color) + coat = "blood" + coat_color = victim_color + +/// Puts the blood on every blade piece drawn now (read_coat()). +/datum/mantis_rig/proc/dress() + read_coat() + for(var/key in puppets) + if(key == "body" || key == "wound" || key == "drip" || key == "glint") + continue + var/obj/effect/abstract/mantis_puppet/picture = puppets[key] + picture.cut_overlays() + if(!coat) + continue + var/state = "[picture.icon_state]_[coat]" + if(!icon_exists(MANTIS_GORE_REACH_ICON, state)) + continue + var/mutable_appearance/blood = mutable_appearance(MANTIS_GORE_REACH_ICON, state) + blood.color = coat_color + picture.add_overlay(blood) + +/** + * A spray of the victim's blood, "__", drawn where the beat drawn now puts it and left + * there for [lifetime]: just over (or, with [under], just under) the piece [key], or the victim for "T". + * Not [blood]: a flash of the blades' own light, drawn in its own colours. + */ +/datum/mantis_rig/proc/burst(name, lifetime, key = "T", under = FALSE, blood = TRUE) + if(QDELETED(bearer) || (blood && !victim_color)) + return null + var/state = "[model]_[move]_[name]" + if(!icon_exists(MANTIS_GORE_REACH_ICON, state)) + return null + var/obj/effect/abstract/mantis_rig_fx/spray = new(get_turf(bearer)) + spray.icon_state = state + spray.dir = facing + if(blood) + spray.color = victim_color + else + spray.name = "light" + var/obj/effect/abstract/mantis_puppet/beside = puppets[key] + var/beside_layer = beside ? beside.layer : victim_layer + spray.layer = beside_layer + (under ? -0.5 : 0.5) * MANTIS_RIG_LAYER_STEP + // On the row of what it sorts against, centred with pixel_w and pixel_z (set_row()). + spray.pixel_x = own_x() + spray.pixel_y = beside ? beside.pixel_y : sort_y(under) + spray.pixel_w = base_w + lean_w - ICON_SIZE_X + spray.pixel_z = base_z + lean_z - ICON_SIZE_Y + own_y() - spray.pixel_y + QDEL_IN(spray, lifetime) + return spray + +/** + * The move is over: the real bearer, held blades and all, is drawn again at once, and the pictures, lifted + * over it in the same order, fade out over [time]. A pose that differs from the held art eases into it + * instead of jumping, and nothing is ever see-through: the real bearer underneath is whole. Then the rig goes. + */ +/datum/mantis_rig/proc/hand_back(time = MANTIS_RIG_HANDBACK) + if(handing_back || QDELETED(src)) + return + handing_back = TRUE + if(QDELETED(bearer) || !time) + qdel(src) + return + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade as anything in mantis_held_blades(bearer)) + blade.show_inhand() + reveal() + var/lowest + for(var/key in puppets) + var/obj/effect/abstract/mantis_puppet/picture = puppets[key] + lowest = isnull(lowest) ? picture.layer : min(lowest, picture.layer) + var/lift = isnull(lowest) ? 0 : max(0, bearer.layer - lowest + MANTIS_RIG_LAYER_STEP) + for(var/key in puppets) + var/obj/effect/abstract/mantis_puppet/picture = puppets[key] + picture.layer += lift + animate(picture, alpha = 0, time = time, flags = ANIMATION_PARALLEL) + QDEL_IN(src, time) + +/// Hides the real bearer. Its whole tile still takes clicks. +/datum/mantis_rig/proc/conceal() + if(hidden || QDELETED(bearer)) + return + hidden = TRUE + old_mouse_opacity = bearer.mouse_opacity + bearer.mouse_opacity = MOUSE_OPACITY_OPAQUE + bearer.add_filter(MANTIS_RIG_HIDE_FILTER, 1, color_matrix_filter(list(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0))) + +/// Shows the real bearer again. +/datum/mantis_rig/proc/reveal() + if(!hidden) + return + hidden = FALSE + if(QDELETED(bearer)) + return + bearer.mouse_opacity = old_mouse_opacity + bearer.remove_filter(MANTIS_RIG_HIDE_FILTER) + +#undef MANTIS_RIG_HIDE_FILTER +#undef MANTIS_RIG_LAYER_STEP diff --git a/voidcrew/modules/mantis_gore/mantis_scissor.dm b/voidcrew/modules/mantis_gore/mantis_scissor.dm new file mode 100644 index 00000000000..0972323df06 --- /dev/null +++ b/voidcrew/modules/mantis_gore/mantis_scissor.dm @@ -0,0 +1,348 @@ +// The scissor: both blades out, head aimed, a swing at someone adjacent who is dying. The blades rise, +// catch the light, then come down and close on the neck, one blade behind it and one in front, and #509's +// decapitation takes the head. The bearer is drawn by the blade rig (mantis_rig.dm) from the raise to the +// recovery, so the far blade can pass under the neck while the bearer stands over the body. A #509 finisher +// (voidcrew/modules/hyperviolence/finishers/), drawn the way the bosses' are rather than as real blows, +// so the bearer stands rooted and exposed through the wind-up and a hit makes them reel. No mark over the +// victim (owner D34): the wind-up reads only from the bodies. An Atlas frame stops the cut. + +/// Starts the scissor on [target] if this swing is one. Returns TRUE if it started. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/mantis_try_scissor(mob/living/target, mob/living/user) + if(!(gore_moves & MANTIS_MOVE_SCISSOR) || !iscarbon(target) || target == user) + return FALSE + if(!user.combat_mode || user.zone_selected != BODY_ZONE_HEAD || HAS_TRAIT(user, TRAIT_PACIFISM)) + return FALSE + // The cheap checks first: most head swings are at someone on their feet. + if(!mantis_in_crit(target) || length(mantis_held_blades(user, MANTIS_MOVE_SCISSOR)) < 2) + return FALSE + var/datum/mantis_bearer/state = user.get_mantis_state() + if(world.time < state.next_scissor || state.scissor) + return FALSE + var/datum/hv_finisher/mantis_scissor/scissor = new(user, target, CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(mantis_scissor_ended))) + scissor.model = base_icon_state + if(!scissor.start()) + scissor.on_end = null + qdel(scissor) + return FALSE + state.scissor = scissor + state.next_scissor = world.time + MANTIS_SCISSOR_COOLDOWN + // The swing never reaches the attack chain, so it counts at a trader outpost here, as the Gorilla finishers do. + gorilla_register_aggression(target, user) + return TRUE + +/// The scissor ended, however it ended: the blades go back to the guard, and the rig fades into the real bearer. +/proc/mantis_scissor_ended(datum/hv_finisher/mantis_scissor/scissor, result) + var/mob/living/bearer = scissor.user + var/datum/mantis_rig/rig = scissor.rig + scissor.rig = null + if(!QDELETED(bearer)) + if(bearer.mantis_state?.scissor == scissor) + bearer.mantis_state.scissor = null + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade as anything in mantis_held_blades(bearer)) + blade.set_mantis_pose(MANTIS_POSE_GUARD) + rig?.hand_back() + qdel(scissor) + +/datum/hv_finisher/mantis_scissor + name = "mantis scissor" + interrupt_damage = 15 + vulnerability = 1.25 + stagger_time = 1 SECONDS + zone_preference = list(BODY_ZONE_HEAD) + stages = list( + /datum/hv_finisher_stage/windup/mantis, + /datum/hv_finisher_stage/kill/decapitate/mantis, + /datum/hv_finisher_stage/recover/mantis, + ) + /// The model of the blades doing it, for the pictures. + var/model = "mantis" + /// The bearer drawn around the victim, while it runs. + var/datum/mantis_rig/rig + +/datum/hv_finisher/mantis_scissor/Destroy() + QDEL_NULL(rig) + return ..() + +/// Draws [beat] of the scissor, if the bearer is drawn by the rig, leaning into it over [time]. +/datum/hv_finisher/mantis_scissor/proc/show_beat(beat, time = 0.1 SECONDS) + rig?.show(beat, time = time) + +// Drawn, not real blows: a bearer with two blades fused to the arms makes no aggressive grab, and the +// head comes off by the finisher's own hand. That also roots them and makes them take more damage. +/datum/hv_finisher/mantis_scissor/New(mob/living/user, mob/living/carbon/victim, datum/callback/on_end) + . = ..() + real_hits = FALSE + +/** + * #509's check, made for people: it refuses anyone of the attacker's faction, and every player shares + * one. The scissor goes for anyone dying, as a gun execution does (owner D34). Dying means crit, not + * just lying down: a lunge knockdown alone is not enough. A human NPC only scissors at execution rank. + */ +/datum/hv_finisher/mantis_scissor/can_start() + if(QDELETED(user) || user.stat != CONSCIOUS || HAS_TRAIT(user, TRAIT_INCAPACITATED) || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || HAS_TRAIT(user, TRAIT_PACIFISM)) + return FALSE + if(!iscarbon(victim) || QDELETED(victim) || victim == user || HAS_TRAIT(victim, TRAIT_GODMODE)) + return FALSE + if(!mantis_in_crit(victim)) + return FALSE + if(victim.has_status_effect(/datum/status_effect/hv_finisher_hold) || HAS_TRAIT_FROM(victim, TRAIT_IMMOBILIZED, MANTIS_IMPALE_TRAIT)) + return FALSE + if(victim.buckled || !isturf(victim.loc) || !isturf(user.loc) || victim.z != user.z) + return FALSE + if(isnull(victim.get_bodypart(BODY_ZONE_HEAD))) + return FALSE + if(!user.hv_can_execute()) + return FALSE + if(length(mantis_held_blades(user, MANTIS_MOVE_SCISSOR)) < 2) + return FALSE + // Square on only: from a corner the swing is just a swing + return get_dist(user, victim) <= 1 && user.Adjacent(victim) && finisher_square_on(user, victim) + +// A blade stowed (an EMP, a retract) or the hands bound: it can't close. +/datum/hv_finisher/mantis_scissor/safety_check() + . = ..() + if(. || completed) + return + if(length(mantis_held_blades(user, MANTIS_MOVE_SCISSOR)) < 2 || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) + return HV_FINISHER_ATTACKER_DOWN + if(finisher_on_corner(user, victim)) + return HV_FINISHER_LOST_GRIP + +// #509's wording, but the bearer reels back rather than letting go of a grip they never took. +/datum/hv_finisher/mantis_scissor/interrupt(reason) + if(!running || completed) + return + for(var/datum/hv_finisher_stage/stage as anything in stages) + if(stage.entered) + stage.on_interrupt() + if(reason == HV_FINISHER_DAMAGED) + user.visible_message(span_danger("[user] reels back from [victim]!")) + user.apply_status_effect(/datum/status_effect/hv_finisher_reeling, stagger_time) + stop(reason) + +/// Puts the bearer's blades in [pose]. +/datum/hv_finisher/mantis_scissor/proc/pose_blades(pose) + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade as anything in mantis_held_blades(user)) + blade.set_mantis_pose(pose) + +// ---- The wind-up ----------------------------------------------------------- + +/// Someone on the floor is turned so their head lies toward [bearer], the way tg turns someone dragged. +/// Straight above or below them, the head goes to the left, where the blades are drawn to close on it. +/proc/mantis_turn_head_toward(mob/living/victim, mob/living/bearer) + if(victim.body_position != LYING_DOWN || !victim.rotate_on_lying || !victim.lying_angle) + return + if(bearer.x == victim.x) + victim.set_lying_angle(LYING_ANGLE_WEST) + return + victim.set_lying_angle(bearer.x > victim.x ? LYING_ANGLE_EAST : LYING_ANGLE_WEST) + +/// Both blades rise. A glint runs along them, and the victim shudders. +/datum/hv_finisher_stage/windup/mantis + duration = MANTIS_SCISSOR_WINDUP + rise = 1 + enter_sound = 'sound/items/unsheath.ogg' + enter_volume = 50 + /// Timer of the glint halfway through. + var/glint_timer + +/datum/hv_finisher_stage/windup/mantis/enter() + . = ..() + var/datum/hv_finisher/mantis_scissor/scissor = host + scissor.pose_blades(MANTIS_POSE_RAISE) + mantis_turn_head_toward(host.victim, host.user) + QDEL_NULL(scissor.rig) + scissor.rig = new(host.user, host.victim, mantis_rig_facing(host.user, host.victim), scissor.model, "scissor") + if(!scissor.rig.start()) + QDEL_NULL(scissor.rig) + scissor.show_beat("raise") + glint_timer = addtimer(CALLBACK(src, PROC_REF(glint)), duration * 0.5, TIMER_STOPPABLE|TIMER_DELETE_ME) + +/// Halfway through the wind-up the light runs along the near blade (the rig draws it) and the victim shudders. +/datum/hv_finisher_stage/windup/mantis/proc/glint() + glint_timer = null + if(!host?.running) + return + var/datum/hv_finisher/mantis_scissor/scissor = host + scissor.show_beat("glint") + mantis_struggle_fx(host.victim, duration * 0.5) + // Not drawn by the rig: the light runs along one held blade instead. + if(!scissor.rig) + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade = locate() in host.user.held_items + blade?.play_glint(MANTIS_POSE_RAISE) + +/datum/hv_finisher_stage/windup/mantis/on_stop() + if(glint_timer) + deltimer(glint_timer) + glint_timer = null + +/datum/hv_finisher_stage/windup/mantis/Destroy() + if(glint_timer) + deltimer(glint_timer) + glint_timer = null + return ..() + +/datum/hv_finisher_stage/windup/mantis/enter_message() + return "[host.user] raises both blades over [host.victim]!" + +// ---- The cut --------------------------------------------------------------- + +/datum/hv_finisher_stage/kill/decapitate/mantis + duration = 0.6 SECONDS + // The swing shuts the blades itself, on its own clock (strike()); this only catches a swing that never got there. + effect_delay = 0.4 SECONDS + // The blade rig draws the bearer's lean; without it, enter() leans the real bearer. + lunge = 0 + effect_sound = 'sound/items/weapons/bladeslice.ogg' + spray_strength = 4 + /// The swing's next frame and the blades shutting, to come. + var/close_timer + var/strike_timer + /// The bearer straightening up out of the cut, to come. + var/recover_timer + +/datum/hv_finisher_stage/kill/decapitate/mantis/Destroy() + stop_timers() + return ..() + +/datum/hv_finisher_stage/kill/decapitate/mantis/proc/stop_timers() + for(var/timer in list(close_timer, strike_timer, recover_timer)) + if(timer) + deltimer(timer) + close_timer = null + strike_timer = null + recover_timer = null + +/** + * The swing: the blades come down out of the raise, close on the neck (the far one passes under it, the near + * one over it; the blade rig draws both) and shut through it, a frame apart, and the head comes off as they + * shut. The bearer leans in as they come down. + */ +/datum/hv_finisher_stage/kill/decapitate/mantis/enter() + . = ..() + var/datum/hv_finisher/mantis_scissor/scissor = host + scissor.pose_blades(MANTIS_POSE_GUARD) + if(!scissor.rig) + // Drawn as the bearer: a lean, further if the head lies on the far side of the body. + var/posture = mantis_scissor_posture(host.victim) + var/toward = get_dir(host.user, host.victim) + var/far = (posture == "lie90" && (toward & EAST)) || (posture == "lie270" && (toward & WEST)) + host.pose_user(far ? MANTIS_SCISSOR_FAR_LEAN : MANTIS_SCISSOR_LEAN, rise) + scissor.show_beat("swing", MANTIS_SCISSOR_SWING_STEP) + close_timer = addtimer(CALLBACK(src, PROC_REF(close)), MANTIS_SCISSOR_SWING_STEP, TIMER_STOPPABLE|TIMER_DELETE_ME) + strike_timer = addtimer(CALLBACK(src, PROC_REF(strike)), 1.5 * MANTIS_SCISSOR_SWING_STEP, TIMER_STOPPABLE|TIMER_DELETE_ME) + +/// The blades meet at the neck. +/datum/hv_finisher_stage/kill/decapitate/mantis/proc/close() + close_timer = null + if(!host?.running) + return + var/datum/hv_finisher/mantis_scissor/scissor = host + scissor.show_beat("close", MANTIS_SCISSOR_SWING_STEP) + +/// The blades shut through the neck: the stage's beat (effect()), checked the way #509's tick checks it. +/datum/hv_finisher_stage/kill/decapitate/mantis/proc/strike() + strike_timer = null + if(!host?.running || host.current_stage != src || effect_done) + return + var/reason = host.safety_check() + if(reason) + host.end_early(reason) + return + host.fire_effect() + +/// The blades are through: the bearer straightens back to the guard. +/datum/hv_finisher_stage/kill/decapitate/mantis/proc/recover() + recover_timer = null + if(!host?.running) + return + var/datum/hv_finisher/mantis_scissor/scissor = host + scissor.show_beat("recover", MANTIS_SCISSOR_STRAIGHTEN) + +/datum/hv_finisher_stage/kill/decapitate/mantis/on_stop() + . = ..() + stop_timers() + +/** + * The blades come together at the neck: one line for the cut, a huge one if the head comes off. An + * Atlas frame (or anything else that won't let the head go) takes a deep cut instead. + */ +/datum/hv_finisher_stage/kill/decapitate/mantis/effect() + var/mob/living/carbon/victim = host.victim + var/mob/living/bearer = host.user + var/datum/hv_finisher/mantis_scissor/scissor = host + scissor.show_beat("cut", MANTIS_SCISSOR_SWING_STEP) + // The cut holds, then the bearer straightens. + if(!recover_timer) + recover_timer = addtimer(CALLBACK(src, PROC_REF(recover)), MANTIS_SCISSOR_RECOVER_BEAT, TIMER_STOPPABLE|TIMER_DELETE_ME) + if(effect_sound) + playsound(victim, effect_sound, effect_volume, TRUE) + var/spray_dir = away_dir() + mantis_note_hit(victim, bearer) + victim.hv_hold_attack_message( + "[bearer] brings both blades together at [victim]'s neck!", + "[bearer] brings both blades together at your neck!", + null, + null, + null, + DEFAULT_MESSAGE_RANGE, + ) + var/beheads = can_gore() + if(beheads) + victim.hv_add_hit_line("[victim]'s head comes off!", HV_LINE_HUGE, "Your head comes off!", DEFAULT_MESSAGE_RANGE) + gore(spray_dir) + else + fallback(spray_dir) + if(!QDELETED(victim)) + victim.hv_flush_hit() + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade as anything in mantis_held_blades(bearer)) + blade.drench(victim, light = TRUE) + // The blades come out of the neck red, and it sprays. + if(scissor.rig) + scissor.rig.dress() + switch(scissor.rig.facing) + if(NORTH) + scissor.rig.burst("cut_spray", 0.4 SECONDS, "T") + if(SOUTH) + scissor.rig.burst("cut_spray", 0.4 SECONDS, "arms") + else + scissor.rig.burst("cut_spray", 0.4 SECONDS, "near", under = TRUE) + log_combat(bearer, victim, "scissored", addition = "([beheads ? "beheaded" : "cut"])") + +// The head stays on: a deep cut across the neck. Atlas plating stops the blades on metal. +/datum/hv_finisher_stage/kill/decapitate/mantis/fallback(spray_dir) + var/mob/living/carbon/victim = host.victim + var/mob/living/bearer = host.user + if(HAS_TRAIT(victim, TRAIT_NODISMEMBER)) + victim.hv_add_hit_line("The blades grind to a stop on metal!", HV_LINE_BOLD, null, DEFAULT_MESSAGE_RANGE) + playsound(victim, 'sound/items/weapons/block_blade.ogg', 70, TRUE) + else + victim.hv_add_hit_line("[bearer]'s blades bite deep into [victim]'s neck!", HV_LINE_BOLD, "[bearer]'s blades bite deep into your neck!", DEFAULT_MESSAGE_RANGE) + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade = locate() in bearer.held_items + victim.apply_damage(MANTIS_SCISSOR_FALLBACK_DAMAGE, BRUTE, BODY_ZONE_HEAD, wound_bonus = 20, sharpness = SHARP_EDGED, attack_direction = spray_dir, attacking_item = blade) + if(!QDELETED(victim)) + victim.hv_blood_spray(spray_dir, 2) + +// #509's: the spray, and the head comes off. Then it comes away from the neck on the floor. +/datum/hv_finisher_stage/kill/decapitate/mantis/gore(spray_dir) + var/mob/living/carbon/victim = host.victim + var/angle = victim.lying_angle + victim.hv_blood_spray(spray_dir, spray_strength) + var/obj/item/bodypart/head/head = hv_finisher_take_head(victim, WOUND_SLASH) + mantis_roll_head(head, angle) + +/// [head], just cut off a body lying at [angle], comes away from the neck on the floor: from where the neck +/// was to a hand's width off it. Only where it is drawn on its tile. +/proc/mantis_roll_head(obj/item/bodypart/head/head, angle) + if(QDELETED(head) || !isturf(head.loc) || !angle) + return + var/side = angle == LYING_ANGLE_EAST ? 1 : -1 + head.pixel_w = side * MANTIS_HEAD_ROLL_FROM + head.pixel_z = -MANTIS_HEAD_ROLL_DROP + animate(head, pixel_w = side * MANTIS_HEAD_ROLL_TO, pixel_z = -MANTIS_HEAD_ROLL_DROP - 2, time = 0.3 SECONDS, easing = SINE_EASING|EASE_OUT) + +// ---- After ------------------------------------------------------------------- + +/// The bearer straightens up out of the cut. +/datum/hv_finisher_stage/recover/mantis + duration = 0.5 SECONDS diff --git a/voidcrew/modules/mantis_gore/mantis_swing.dm b/voidcrew/modules/mantis_gore/mantis_swing.dm new file mode 100644 index 00000000000..86f02e9f38b --- /dev/null +++ b/voidcrew/modules/mantis_gore/mantis_swing.dm @@ -0,0 +1,304 @@ +// The ordinary hit with a Mantis blade: the hand that hit swings its blade. The held blade cocks back, cuts +// through and follows down, then is back in the guard. Only the picture: the damage and tg's attack step land +// at the click as before. See mantis_core.dm for the overview. +// +// The swing is a fresh picture on the bearer (a fresh object always plays its frames from the first, an +// overlay does not), the held blade hidden under it while it plays. Its last frame is the guard itself, so the +// held blade comes back under an exact copy of itself whichever reaches the client first. +// +// Side on, the arm on the far side of the body swings under the near arm's swing, and whatever the near hand +// holds is cut out of it (sort_as_arm(), voidcrew/modules/cyberware/cyberware_anim.dm). The blood coat goes on +// after its swing, so it draws over it. + +/// 64x64 frames on the bearer's tile: "[model]_swing_[side]" and its "_blood" and "_soak" coats. And the slash +/// over the target, by the blade's impact_state: the impact art after half a beat of nothing, the swing's cock. +/// And one stroke of the X-slash, "xslash_[model]": a straight cut from the upper left to the lower right after +/// the same half beat, drawn so that it and its mirror image cross in the exact middle of the picture. +#define MANTIS_SWING_ICON 'voidcrew/modules/mantis_gore/icons/mantis_swing.dmi' +/// How long the held blade is hidden: the cock, the strike and the follow-through. +#define MANTIS_SWING_TIME (2.5 DECISECONDS) +/// How long the swing picture stays: one beat of the guard frame past the hide. +#define MANTIS_SWING_LIFETIME (3 DECISECONDS) +/// The impact over the target waits for the strike frame. +#define MANTIS_SWING_IMPACT_DELAY (0.5 DECISECONDS) +/// How long the slash over the target stays: that half beat, then its four frames. +#define MANTIS_SWING_IMPACT_LIFETIME (4.5 DECISECONDS) +/// The X-slash's other blade swings one beat behind the first, so its stroke crosses one already through. +#define MANTIS_XSLASH_SWING_DELAY (1 DECISECONDS) +/// Where an X-slash on a leg is centred, in pixels up from the middle of the tile: half way down the leg, whichever +/// way the body faces (a human leg runs from 7.5 to 15.5 pixels below the middle, and the strokes cross half a pixel +/// above the middle of their art). +#define MANTIS_XSLASH_LEG_Y -12 + +/obj/item/melee/energy/blade/hardlight/cyberware_mantis + /// The swing playing for this blade right now, if any. Weak: it deletes itself. + var/datum/weakref/swing_ref + /// The slash over the target of that swing, if any. Weak: it deletes itself. + var/datum/weakref/swing_impact_ref + +/// The swing playing for this blade right now, if any. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/mantis_swing() + return swing_ref?.resolve() + +/** + * The hand holding this blade swings it at [attacked_atom]. Called with tg's attack step, so it plays for + * every swing that steps, landed or blocked. Only from the guard, and never over a blade already drawn + * elsewhere (the unfold, the impale, the scissor). Returns the swing, or null if none plays. + */ +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/mantis_play_swing(mob/living/attacker, atom/attacked_atom) + if(!isliving(attacker) || QDELETED(attacker) || attacked_atom == attacker) + return null + var/held_index = attacker.get_held_index_of_item(src) + if(!held_index || mantis_pose != MANTIS_POSE_GUARD || world.time < inhand_hidden_until) + return null + var/side = IS_LEFT_INDEX(held_index) ? "left" : "right" + var/state = "[base_icon_state]_swing_[side]" + if(!icon_exists(MANTIS_SWING_ICON, state)) + return null + qdel(mantis_swing()) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing = housing_ref?.resolve() + housing?.unfold_overtaken(src) + var/obj/effect/abstract/cyberware_anim/mantis_swing/swing = new(null) + swing.start(attacker, src, state, side) + if(is_bloody()) + var/coat_state = "[state]_[world.time < soaked_until ? "soak" : "blood"]" + if(icon_exists(MANTIS_SWING_ICON, coat_state)) + swing.add_coat(coat_state, get_blood_dna_color()) + swing_ref = WEAKREF(swing) + // This blade leaves its guard, so a far swing behind it is no longer cut around it: its own swing is in + // front now. The hands redraw, and every arm's picture on the bearer sorts itself again. + hide_inhand_for(MANTIS_SWING_TIME) + return swing + +/** + * The slash over [attacked_atom] for this blade's swing, cut the way the blade crosses the target in the strike + * frame for the way [attacker] faces now, or [mirrored] if given. It goes up with the swing and shows nothing + * for the half beat the blade cocks back: the client plays both pictures from the same moment, so the slash + * comes up with the strike frame and never ahead of it (a timer on the server could). Returns it, or null. + */ +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/mantis_swing_impact(atom/movable/attacker, atom/attacked_atom, mirrored = null) + if(!impact_state || !ismovable(attacked_atom)) + return null + if(!icon_exists(MANTIS_SWING_ICON, impact_state)) + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(cyberware_play_impact), attacker, attacked_atom, impact_state, mirrored), MANTIS_SWING_IMPACT_DELAY) + return null + if(isnull(mirrored)) + var/obj/effect/abstract/cyberware_anim/mantis_swing/swing = mantis_swing() + if(swing && !QDELETED(attacker)) + mirrored = mantis_swing_impact_mirrored(attacker.dir, swing.side) + else + // Turned as any chrome hit's is (cyberware_play_impact()). + var/direction = get_dir(attacker, attacked_atom) + mirrored = (direction & WEST) || (!(direction & EAST) && prob(50)) + var/obj/effect/abstract/cyberware_anim/impact = cyberware_anim_play(attacked_atom, MANTIS_SWING_ICON, impact_state, MANTIS_ANIM_TOP_LAYER, MANTIS_SWING_IMPACT_LIFETIME, glow = impact_state != "impact_shiv") + if(isnull(impact)) + return null + // 64x64 around the target's tile, upright even on someone lying down. + impact.pixel_w = -16 + impact.pixel_z = -16 + impact.appearance_flags |= RESET_TRANSFORM + if(mirrored) + impact.transform = matrix(-1, 0, 0, 0, 1, 0) + swing_impact_ref = WEAKREF(impact) + return impact + +/** + * How far the [zone] part of [body] is drawn from the middle of its chest, as it stands, faces and lies now + * (wire_part_offset(), hyperviolence/wire/wire_held.dm): list(x, y) in pixels. The body's left and right swap + * on screen as it turns. + */ +/proc/mantis_part_shift(mob/living/body, zone) + var/list/part = wire_part_offset(zone, body.dir) + var/list/chest = wire_part_offset(BODY_ZONE_CHEST, body.dir) + var/across = part[1] - chest[1] + var/up = part[2] - chest[2] + var/matrix/shape = body.transform + return list(round(shape.a * across + shape.b * up), round(shape.d * across + shape.e * up)) + +/** + * Where the [zone] part of [body] is drawn, as it stands, faces and lies now, from the middle of its tile + * (wire_part_offset()): list(x, y) in pixels. Facing west it is the mirror of facing east. + */ +/proc/mantis_part_point(mob/living/body, zone) + var/list/part = wire_part_offset(zone, body.dir) + var/matrix/shape = body.transform + return list(round(shape.a * part[1] + shape.b * part[2] + shape.c), round(shape.d * part[1] + shape.e * part[2] + shape.f)) + +/// The slash of the swing playing now is set on the part of [victim] it cut ([zone]). +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/mantis_swing_impact_onto(mob/living/victim, zone) + var/obj/effect/abstract/cyberware_anim/impact = swing_impact_ref?.resolve() + if(isnull(impact) || impact.bearer != victim || !zone) + return + var/list/shift = mantis_part_shift(victim, zone) + impact.pixel_w = -16 + shift[1] + impact.pixel_z = -16 + shift[2] + +/** + * Whether the [side] hand's swing, its bearer facing [facing], shows the impact art mirrored. The art cuts + * clockwise: in along the top from the left, then down on the right. In mantis_swing.dmi, from the cock frame + * to the strike frame, facing south or north each hand cuts across the body toward the other: facing south the + * right hand cuts clockwise and the left anticlockwise, facing north the other way round. Side on both hands + * chop down in front, clockwise facing east and anticlockwise facing west. + */ +/proc/mantis_swing_impact_mirrored(facing, side) + if(facing & WEST) + return TRUE + if(facing & EAST) + return FALSE + return (facing == NORTH) == (side == "right") + +/** + * The X-slash as it looks: two straight strokes that cross on the part cut ([zone]). This blade's stroke comes + * up with its strike in place of its ordinary slash; the other blade swings a beat behind and its stroke, turned + * the other way, comes up with its own strike and crosses the first; the flash lands then. Without a swing + * playing (a blade out of its guard) the whole cross lands at once. + */ +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/mantis_xslash_cross(mob/living/user, mob/living/victim, obj/item/melee/energy/blade/hardlight/cyberware_mantis/off_blade, zone) + var/obj/effect/abstract/cyberware_anim/first = swing_impact_ref?.resolve() + if(first?.bearer != victim) + first = null + // This blade's stroke runs the way its own slash does. + var/flipped + if(first) + var/matrix/turned = first.transform + flipped = turned.a < 0 + else + flipped = mantis_swing_impact_mirrored(user.dir, hand_side()) + if(!mantis_swing() || isnull(first)) + mantis_xslash_stroke_fx(victim, impact_state, zone, flipped) + mantis_xslash_stroke_fx(victim, impact_state, zone, !flipped) + mantis_xslash_land(user, victim, off_blade) + return + // Made in the same instant as the slash it replaces, so only the stroke is ever seen. + var/obj/effect/abstract/cyberware_anim/stroke = mantis_xslash_stroke_fx(victim, impact_state, zone, flipped) + if(stroke) + qdel(first) + swing_impact_ref = WEAKREF(stroke) + addtimer(CALLBACK(src, PROC_REF(mantis_xslash_second), user, victim, off_blade, zone, !flipped), MANTIS_XSLASH_SWING_DELAY) + addtimer(CALLBACK(src, PROC_REF(mantis_xslash_land), user, victim, off_blade), MANTIS_XSLASH_SWING_DELAY + MANTIS_SWING_IMPACT_DELAY) + +/** + * One stroke of the X-slash over [victim], by [impact_state]'s model: a straight cut through the [zone] part from + * the upper left to the lower right, or the other way if [flipped]. A stroke and its mirror image cross in the + * middle of the art, and the art is centred on the part as it is drawn now, so the cross sits at the same place + * on the part whichever way the target faces. Returns the picture, or null if that model has no stroke art. + */ +/proc/mantis_xslash_stroke_fx(mob/living/victim, impact_state, zone, flipped) + if(QDELETED(victim) || !impact_state) + return null + var/state = replacetext(impact_state, "impact_", "xslash_") + if(!icon_exists(MANTIS_SWING_ICON, state)) + return null + var/obj/effect/abstract/cyberware_anim/stroke = cyberware_anim_play(victim, MANTIS_SWING_ICON, state, MANTIS_ANIM_TOP_LAYER, MANTIS_SWING_IMPACT_LIFETIME, glow = TRUE) + if(isnull(stroke)) + return null + // A body on fire draws its flames apart from the rest of it and over all of its own pictures, and tg throws + // its embers over those (a particle holder at ABOVE_ALL_MOB_LAYER): a cross on it lost its middle to them. + // There the stroke is drawn apart as well, just over the embers. It stays on the body's own row, so whoever + // stands in front of the body still covers it. + if(victim.on_fire) + stroke.appearance_flags |= KEEP_APART + stroke.layer = ABOVE_ALL_MOB_LAYER + 0.01 + var/list/point = mantis_xslash_point(victim, zone || BODY_ZONE_CHEST) + // 64x64 around the part, upright even on someone lying down. + stroke.pixel_w = -16 + point[1] + stroke.pixel_z = -16 + point[2] + stroke.appearance_flags |= RESET_TRANSFORM + if(flipped) + stroke.transform = matrix(-1, 0, 0, 0, 1, 0) + return stroke + +/** + * Where the X-slash's strokes cross on the [zone] part of [body], as mantis_part_point() gives it, but on a leg half + * way down it rather than at the hip a wire's lash ends on. + */ +/proc/mantis_xslash_point(mob/living/body, zone) + if(zone != BODY_ZONE_L_LEG && zone != BODY_ZONE_R_LEG) + return mantis_part_point(body, zone) + var/list/part = wire_part_offset(zone, body.dir) + var/matrix/shape = body.transform + return list(round(shape.a * part[1] + shape.b * MANTIS_XSLASH_LEG_Y + shape.c), round(shape.d * part[1] + shape.e * MANTIS_XSLASH_LEG_Y + shape.f)) + +/// The second stroke of the X-slash: [off_blade] swings, and its stroke goes up [flipped] to cross the first. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/mantis_xslash_second(mob/living/user, mob/living/victim, obj/item/melee/energy/blade/hardlight/cyberware_mantis/off_blade, zone, flipped) + if(QDELETED(victim) || QDELETED(user) || QDELETED(off_blade) || !user.is_holding(off_blade)) + return + off_blade.mantis_play_swing(user, victim) + // A model with no stroke art crosses with its ordinary slash. + if(!mantis_xslash_stroke_fx(victim, impact_state, zone, flipped)) + off_blade.mantis_swing_impact(user, victim, flipped) + +/// The crossed slash lands on [victim]: the flash, and both blades cut, so both run red. +/obj/item/melee/energy/blade/hardlight/cyberware_mantis/proc/mantis_xslash_land(mob/living/user, mob/living/victim, obj/item/melee/energy/blade/hardlight/cyberware_mantis/off_blade) + if(QDELETED(victim)) + return + mantis_xslash_fx(user, victim, impact_state) + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/crossed as anything in list(src, off_blade)) + if(!QDELETED(crossed) && user?.is_holding(crossed)) + crossed.drench(victim) + +// ========================================================================= +// THE PICTURE +// ========================================================================= + +/// One swing of one blade on its bearer, and the blood on it. Ends early if the blade leaves the hand. +/obj/effect/abstract/cyberware_anim/mantis_swing + icon = MANTIS_SWING_ICON + // The frames are 64x64 around the bearer's tile. Centred with pixel_w/pixel_z, which only draw elsewhere: + // the picture stays on the bearer's row, so it sorts against other mobs as the bearer does. + pixel_w = -16 + pixel_z = -16 + layer = MANTIS_ANIM_BLADE_LAYER + /// The blade swinging. + var/obj/item/blade + /// The hand it swings in: "left" or "right". + var/side + /// The blood on it, a picture of its own so its frames start with the swing's. + var/obj/effect/abstract/cyberware_anim/mantis_swing/coat + +/obj/effect/abstract/cyberware_anim/mantis_swing/Destroy() + if(blade) + UnregisterSignal(blade, list(COMSIG_MOVABLE_MOVED, COMSIG_QDELETING)) + blade = null + QDEL_NULL(coat) + return ..() + +/// Starts playing [state] for [swung], held in [bearer]'s [hand_side] hand. +/obj/effect/abstract/cyberware_anim/mantis_swing/proc/start(mob/living/bearer, obj/item/swung, state, hand_side) + icon_state = state + side = hand_side + blade = swung + RegisterSignals(blade, list(COMSIG_MOVABLE_MOVED, COMSIG_QDELETING), PROC_REF(on_blade_gone)) + attach(bearer) + sort_as_arm(side) + +/// Lays the blood coat [coat_state] in [blood_color] over the swing. +/obj/effect/abstract/cyberware_anim/mantis_swing/proc/add_coat(coat_state, blood_color) + coat = new(null) + coat.icon = MANTIS_SWING_ICON + coat.icon_state = coat_state + coat.pixel_w = pixel_w + coat.pixel_z = pixel_z + coat.color = blood_color + coat.appearance_flags |= RESET_COLOR + coat.attach(bearer) + coat.sort_as_arm(side) + +/obj/effect/abstract/cyberware_anim/mantis_swing/proc/on_blade_gone(datum/source) + SIGNAL_HANDLER + qdel(src) + +/// Puts this picture on [target] for the swing's lifetime. +/obj/effect/abstract/cyberware_anim/mantis_swing/proc/attach(atom/movable/target) + bearer = target + RegisterSignal(bearer, COMSIG_QDELETING, PROC_REF(on_bearer_deleted)) + bearer.vis_contents += src + QDEL_IN(src, MANTIS_SWING_LIFETIME) + +#undef MANTIS_SWING_ICON +#undef MANTIS_SWING_TIME +#undef MANTIS_SWING_LIFETIME +#undef MANTIS_SWING_IMPACT_DELAY +#undef MANTIS_SWING_IMPACT_LIFETIME +#undef MANTIS_XSLASH_SWING_DELAY +#undef MANTIS_XSLASH_LEG_Y diff --git a/voidcrew/modules/mantis_gore/mantis_wounds.dm b/voidcrew/modules/mantis_gore/mantis_wounds.dm new file mode 100644 index 00000000000..f93d959178e --- /dev/null +++ b/voidcrew/modules/mantis_gore/mantis_wounds.dm @@ -0,0 +1,90 @@ +// The torn limb artery the Mantis line leaves. A sibling of #509's slit throat +// (voidcrew/modules/hyperviolence/crits/crit_wounds.dm): the same clamp, then sutures or cautery, the same +// heavy bleed that never clots, but on an arm or a leg, with no gargle, and it pumps the way the cut went. +// Like the crit wounds, nothing in tg's random wound roll makes it; only the Mantis cut count does. + +/datum/wound/slash/flesh/critical/hv_carotid/limb + name = "Torn Artery" + undiagnosed_name = "Torn Artery" + desc = "Patient's limb is cut open through a major artery. Blood loss will kill within minutes." + treat_text = "Clamp the artery with a hemostat, then suture or cauterize the wound. Transfuse blood." + treat_text_short = "Clamp with a hemostat, then suture or cauterize." + simple_desc = "Patient's limb is cut open and pumping blood." + simple_treat_text = "Clamp the artery with a hemostat, then suture or cauterize it." + homemade_treat_text = "Tie it off tight above the cut and keep them still." + examine_desc = "is cut open to the artery, pumping out blood" + occur_text = "is cut open to the artery" + initial_flow = 3.5 + /// The way the cut travelled. The artery pumps along it. + var/spurt_dir + /// How far each pulse throws blood, in tiles. + var/spurt_strength = 2 + /// world.time of the next pulse. + var/next_pulse = 0 + +/datum/wound/slash/flesh/critical/hv_carotid/limb/wound_injury(datum/wound/old_wound = null, attack_direction = null) + // tg's own wound is told no direction. With one it throws its spray along it, a line of blood three tiles + // long, and this artery throws its own drops instead (mantis_spurt_fx()). + . = ..(old_wound, null) + spurt_dir = attack_direction || pick(GLOB.alldirs) + next_pulse = world.time + rand(2 SECONDS, 3 SECONDS) + // The throat's own pulse throws blood every which way. This one has its own, along the cut. + next_spurt = INFINITY + +// An arm or a leg doesn't drown the voice. +/datum/wound/slash/flesh/critical/hv_carotid/limb/gargle_speech(datum/source, list/message_args) + return + +/datum/wound/slash/flesh/critical/hv_carotid/limb/handle_process(seconds_per_tick, times_fired) + . = ..() + if(QDELETED(src) || !victim || !limb || victim.stat == DEAD || HAS_TRAIT(victim, TRAIT_STASIS)) + return + if(clamped || blood_flow < MANTIS_ARTERY_OPEN_FLOW || world.time < next_pulse || !limb.can_bleed()) + return + next_pulse = world.time + rand(2 SECONDS, 3 SECONDS) + pulse() + +/// One heartbeat out of the open artery. +/datum/wound/slash/flesh/critical/hv_carotid/limb/proc/pulse() + mantis_spurt_fx(victim, limb.body_zone, spurt_dir, spurt_strength < 2) + +/datum/wound/slash/flesh/critical/hv_carotid/limb/clamp_artery(obj/item/tool, mob/user) + if(clamped) + to_chat(user, span_warning("The artery is already clamped.")) + return TRUE + var/whose = (user == victim) ? "your" : "[victim]'s" + user.visible_message(span_danger("[user] reaches into the cut on [victim]'s [limb.plaintext_zone] with [tool]..."), span_warning("You reach into the cut on [whose] [limb.plaintext_zone] with [tool]...")) + if(!do_after(user, base_treat_time * (user == victim ? 2 : 1.5), target = victim, extra_checks = CALLBACK(src, PROC_REF(still_exists)))) + return TRUE + clamped = TRUE + user.visible_message(span_green("[user] clamps the artery in [victim]'s [limb.plaintext_zone]."), span_green("You clamp the artery in [whose] [limb.plaintext_zone].")) + adjust_blood_flow(-2.5) + return TRUE + +/datum/wound_pregen_data/flesh_slash/hv_limb_artery + abstract = FALSE + wound_path_to_generate = /datum/wound/slash/flesh/critical/hv_carotid/limb + wound_series = WOUND_SERIES_HV_LIMB_ARTERY + required_limb_biostate = (BIO_FLESH|BIO_BLOODED) + ignore_cannot_bleed = FALSE + viable_zones = list(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG) + can_be_randomly_generated = FALSE + threshold_minimum = 80 + +/** + * The Scorch's tear: the heat closes part of it as it cuts. It bleeds less, pumps weaker, and clots + * shut on its own in under a minute instead of killing. + */ +/datum/wound/slash/flesh/critical/hv_carotid/limb/seared + name = "Seared Artery" + undiagnosed_name = "Seared Artery" + desc = "Patient's limb is burned open to a major artery. The heat has partly closed it." + simple_desc = "Patient's limb is burned open and bleeding." + examine_desc = "is burned open to the artery, oozing blood" + occur_text = "is seared open to the artery" + initial_flow = 2 + clot_rate = 0.04 + spurt_strength = 1 + +/datum/wound_pregen_data/flesh_slash/hv_limb_artery/seared + wound_path_to_generate = /datum/wound/slash/flesh/critical/hv_carotid/limb/seared diff --git a/voidcrew/modules/unit_tests/_unit_tests.dm b/voidcrew/modules/unit_tests/_unit_tests.dm index 25c583bbf54..7a2504fde47 100644 --- a/voidcrew/modules/unit_tests/_unit_tests.dm +++ b/voidcrew/modules/unit_tests/_unit_tests.dm @@ -130,6 +130,8 @@ #include "voidcrew_lich.dm" #include "voidcrew_linda_space_share.dm" #include "voidcrew_loot.dm" +#include "voidcrew_mantis_gore.dm" +#include "voidcrew_mantis_swing.dm" #include "voidcrew_map_packing.dm" #include "voidcrew_mapload_floor_dir.dm" #include "voidcrew_medical_research_links.dm" diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware_anim.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware_anim.dm index 0565f4a137a..2ea0ee36e39 100644 --- a/voidcrew/modules/unit_tests/voidcrew_cyberware_anim.dm +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware_anim.dm @@ -54,6 +54,23 @@ TEST_ASSERT(!housing.fold_hide_until && !housing.fold_timer, "Pulling the housing left the folded housing waiting") TEST_ASSERT(!blade.inhand_hidden_until, "A pulled housing's blade stays hidden in its next hand") +/// Mantis: a pose taken while the blade is still unfolding (the charge's crouch) stops the unfold, so its +/// guard never draws over the new pose, and the held blade shows at once in it. +/datum/unit_test/voidcrew_cyberware_anim_unfold_handoff + +/datum/unit_test/voidcrew_cyberware_anim_unfold_handoff/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis) + TEST_ASSERT(housing.Insert(bearer, special = TRUE), "Test fixture: Mantis housing insert refused") + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade = housing.contents[1] + housing.Extend(blade) + var/obj/effect/abstract/cyberware_anim/unfold = housing.blade_anim() + TEST_ASSERT(unfold, "Test fixture: the unfold never played") + + blade.set_mantis_pose("coil") + TEST_ASSERT(QDELETED(unfold), "The unfold kept drawing its guard over the coiled blade") + TEST_ASSERT(!blade.inhand_hidden_until, "The coiled blade stayed hidden after the unfold stopped") + /// Ghostskin: the field flickers in to plain field alpha with nothing else on /// the bearer, and every way out (run out, switched off, knocked down, pulled, /// dead) ends at full view, back where the body started, with nothing left on it. diff --git a/voidcrew/modules/unit_tests/voidcrew_mantis_gore.dm b/voidcrew/modules/unit_tests/voidcrew_mantis_gore.dm new file mode 100644 index 00000000000..5e5a860c919 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_mantis_gore.dm @@ -0,0 +1,960 @@ +/** + * # Mantis Blades x hyperviolence (voidcrew/modules/mantis_gore/) + * + * Arterial gashes, the impaling lunge, the scissor, the kill reset, the charged leap and the safe dash, + * the X-slash, blood on the blades and the stance. Unit-test files compile before voidcrew/_DEFINES/, so + * the fork's numbers are restated below under MG_ names. + */ + +/// MANTIS_MOVE_IMPALE, MANTIS_MOVE_XSLASH +#define MG_MOVE_IMPALE (1<<1) +#define MG_MOVE_XSLASH (1<<3) +/// MANTIS_IMPALE_TRAIT, MANTIS_CHARGE_TRAIT +#define MG_IMPALE_TRAIT "mantis_impale" +#define MG_CHARGE_TRAIT "mantis_charge" +/// TRAIT_CYBER_CAMO +#define MG_TRAIT_CAMO "cyber_camo" +/// HV_FINISHER_DONE and HV_FINISHER_DAMAGED +#define MG_FINISHER_DONE 1 +#define MG_FINISHER_DAMAGED 3 +/// MANTIS_GORE_ICON, MANTIS_GORE_LARGE_ICON and the held-blade files +#define MANTIS_TEST_ICON 'voidcrew/modules/mantis_gore/icons/mantis_gore.dmi' +#define MANTIS_TEST_LARGE_ICON 'voidcrew/modules/mantis_gore/icons/mantis_gore_large.dmi' +#define MANTIS_TEST_ARTERY_ICON 'voidcrew/modules/mantis_gore/icons/mantis_artery.dmi' +/// MANTIS_ARTERY_WOUND_RISE +#define MG_ARTERY_WOUND_RISE 16 +#define MANTIS_TEST_LEFTHAND 'voidcrew/modules/mantis_gore/icons/mantis_lefthand.dmi' +#define MANTIS_TEST_RIGHTHAND 'voidcrew/modules/mantis_gore/icons/mantis_righthand.dmi' +/// MANTIS_GORE_REACH_ICON +#define MANTIS_TEST_REACH_ICON 'voidcrew/modules/mantis_gore/icons/mantis_gore_reach.dmi' +/// MANTIS_RIG_ORDER +#define MG_RIG_ORDER 1 + +/datum/unit_test/voidcrew_mantis_gore + abstract_type = /datum/unit_test/voidcrew_mantis_gore + +/// The floor [dx], [dy] tiles from the test room's bottom-left corner +/datum/unit_test/voidcrew_mantis_gore/proc/spot(dx, dy) + return locate(run_loc_floor_bottom_left.x + dx, run_loc_floor_bottom_left.y + dy, run_loc_floor_bottom_left.z) + +/// A human at [where] with both housings of [housing_type] installed. [out] extends the blades. +/datum/unit_test/voidcrew_mantis_gore/proc/bearer(turf/where, housing_type = /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis, out = TRUE) + var/mob/living/carbon/human/consistent/body = allocate(/mob/living/carbon/human/consistent, where) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/right = allocate(housing_type) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/left = allocate(text2path("[housing_type]/left")) + TEST_ASSERT(right.Insert(body, special = TRUE), "Fixture: the right housing would not install") + TEST_ASSERT(left.Insert(body, special = TRUE), "Fixture: the left housing would not install") + if(out) + right.Extend(right.contents[1]) + left.Extend(left.contents[1]) + TEST_ASSERT(right.blade_extended() && left.blade_extended(), "Fixture: the blades never came out") + return body + +/// [body]'s Mantis housings, right then left. +/datum/unit_test/voidcrew_mantis_gore/proc/housings(mob/living/carbon/body) + . = list() + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing in body.organs) + . += housing + +/// [body]'s held Mantis blade in its right hand, or the first one. +/datum/unit_test/voidcrew_mantis_gore/proc/right_blade(mob/living/carbon/body) + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing in body.organs) + if(housing.zone == BODY_ZONE_R_ARM) + return housing.active_item + return locate(/obj/item/melee/energy/blade/hardlight/cyberware_mantis) in body.held_items + +/// A landed cut on [victim]'s [zone] with [blade], as the blade's own swing reads it. 10 a cut, so five +/// fit on one arm before it is at its most damage. +/datum/unit_test/voidcrew_mantis_gore/proc/cut(obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade, mob/living/user, mob/living/victim, zone, damage = 10) + blade.mantis_watch_cut(victim, user) + victim.apply_damage(damage, BRUTE, zone, 0, wound_bonus = CANT_WOUND, sharpness = SHARP_EDGED, attack_direction = EAST, attacking_item = blade) + blade.mantis_unwatch_cut(victim) + +/// Puts [victim] in crit with plenty of health to spare before death. That much air loss also knocks +/// them out, which still counts: out cold at crit health. +/// The blade rig's pictures standing on [body]'s tile (mantis_rig.dm). +/datum/unit_test/voidcrew_mantis_gore/proc/rig_pictures(mob/living/body) + . = list() + for(var/obj/effect/abstract/mantis_puppet/picture in get_turf(body)) + . += picture + +/datum/unit_test/voidcrew_mantis_gore/proc/crit(mob/living/carbon/victim) + victim.adjustOxyLoss(110) + TEST_ASSERT(mantis_in_crit(victim), "Fixture: [victim] isn't dying (stat [victim.stat], health [victim.health])") + +// --------------------------------------------------------------------------------------------- + +/// Three cuts on a bare limb tear its artery, five under light cover, never under heavy cover. The count +/// starts over after a gap, the Shiv never tears, and an Atlas frame (bone only) doesn't stop it. +/datum/unit_test/voidcrew_mantis_gore/artery + +/datum/unit_test/voidcrew_mantis_gore/artery/Run() + var/mob/living/carbon/human/user = bearer(spot(0, 0)) + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade = right_blade(user) + var/limb_artery = /datum/wound/slash/flesh/critical/hv_carotid/limb + // One blade, so no X-slash follow-through adds to the limb between the counted cuts. + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/off_housing = housings(user)[2] + off_housing.Retract() + + var/mob/living/carbon/human/consistent/bare = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + var/obj/item/bodypart/arm = bare.get_bodypart(BODY_ZONE_L_ARM) + cut(blade, user, bare, BODY_ZONE_L_ARM) + cut(blade, user, bare, BODY_ZONE_L_ARM) + TEST_ASSERT(!arm.get_wound_type(limb_artery), "Two cuts tore the artery") + cut(blade, user, bare, BODY_ZONE_L_ARM) + var/datum/wound/slash/flesh/critical/hv_carotid/limb/torn = arm.get_wound_type(limb_artery) + TEST_ASSERT(torn, "Three cuts on a bare arm didn't tear its artery") + TEST_ASSERT_EQUAL(torn?.spurt_dir, EAST, "The artery doesn't pump the way the cut went") + var/found_line = FALSE + for(var/list/line as anything in bare.hv_hit?.lines) + if(findtext(line[1], "artery")) + found_line = TRUE + TEST_ASSERT(found_line, "The tear added no hit line") + TEST_ASSERT(blade.drenched_until > world.time, "A torn artery didn't drench the blade") + blade.stop_dripping() + + // Light cover (Slabskin-like plating 25, less the blade's 10): five cuts. + var/mob/living/carbon/human/consistent/plated = allocate(/mob/living/carbon/human/consistent, spot(1, 1)) + plated.physiology.armor = plated.physiology.armor.generate_new_with_modifiers(list(MELEE = 25)) + var/obj/item/bodypart/plated_arm = plated.get_bodypart(BODY_ZONE_R_ARM) + for(var/i in 1 to 4) + cut(blade, user, plated, BODY_ZONE_R_ARM) + TEST_ASSERT(!plated_arm.get_wound_type(limb_artery), "Four cuts tore a plated arm") + cut(blade, user, plated, BODY_ZONE_R_ARM) + TEST_ASSERT(plated_arm.get_wound_type(limb_artery), "Five cuts didn't tear a plated arm") + + // Heavy cover (45 less 10 = 35): never. + var/mob/living/carbon/human/consistent/armoured = allocate(/mob/living/carbon/human/consistent, spot(1, 2)) + armoured.physiology.armor = armoured.physiology.armor.generate_new_with_modifiers(list(MELEE = 45)) + var/obj/item/bodypart/armoured_leg = armoured.get_bodypart(BODY_ZONE_L_LEG) + for(var/i in 1 to 6) + cut(blade, user, armoured, BODY_ZONE_L_LEG) + TEST_ASSERT(!armoured_leg.get_wound_type(limb_artery), "A heavily armoured leg tore") + + // A gap starts the count over. + var/mob/living/carbon/human/consistent/patient = allocate(/mob/living/carbon/human/consistent, spot(2, 0)) + var/obj/item/bodypart/patient_leg = patient.get_bodypart(BODY_ZONE_R_LEG) + cut(blade, user, patient, BODY_ZONE_R_LEG) + cut(blade, user, patient, BODY_ZONE_R_LEG) + var/datum/status_effect/mantis_cuts/cuts = patient.has_status_effect(/datum/status_effect/mantis_cuts) + TEST_ASSERT(cuts, "Cuts left no count on the target") + cuts.limb_cut_times[BODY_ZONE_R_LEG] = world.time - 9 SECONDS + cut(blade, user, patient, BODY_ZONE_R_LEG) + TEST_ASSERT(!patient_leg.get_wound_type(limb_artery), "The count carried over a gap") + TEST_ASSERT_EQUAL(cuts.limb_cuts[BODY_ZONE_R_LEG], 1, "The count didn't start over after a gap") + + // A light cut doesn't count. + var/mob/living/carbon/human/consistent/grazed = allocate(/mob/living/carbon/human/consistent, spot(2, 1)) + var/obj/item/bodypart/grazed_arm = grazed.get_bodypart(BODY_ZONE_L_ARM) + for(var/i in 1 to 4) + cut(blade, user, grazed, BODY_ZONE_L_ARM, 5) + TEST_ASSERT(!grazed_arm.get_wound_type(limb_artery), "Grazes tore an artery") + + // Atlas covers bone, not soft tissue. + var/mob/living/carbon/human/consistent/framed = allocate(/mob/living/carbon/human/consistent, spot(2, 2)) + ADD_TRAIT(framed, TRAIT_NODISMEMBER, TRAIT_SOURCE_UNIT_TESTS) + for(var/i in 1 to 3) + cut(blade, user, framed, BODY_ZONE_R_ARM) + TEST_ASSERT(framed.get_bodypart(BODY_ZONE_R_ARM).get_wound_type(limb_artery), "An Atlas frame stopped the artery tear") + + // The neck is #509's slit throat. + var/mob/living/carbon/human/consistent/necked = allocate(/mob/living/carbon/human/consistent, spot(3, 0)) + for(var/i in 1 to 3) + cut(blade, user, necked, BODY_ZONE_HEAD) + TEST_ASSERT(necked.get_bodypart(BODY_ZONE_HEAD).get_wound_type(/datum/wound/slash/flesh/critical/hv_carotid), "Three cuts on the neck didn't slit the throat") + + // The Shiv only bleeds them. + var/mob/living/carbon/human/shiv_user = bearer(spot(4, 4), /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/street) + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/shiv = right_blade(shiv_user) + var/mob/living/carbon/human/consistent/shivved = allocate(/mob/living/carbon/human/consistent, spot(3, 4)) + for(var/i in 1 to 4) + cut(shiv, shiv_user, shivved, BODY_ZONE_L_ARM) + TEST_ASSERT(!shivved.get_bodypart(BODY_ZONE_L_ARM).get_wound_type(limb_artery), "The Shiv tore an artery") + + // The Scorch sears it half shut. + var/mob/living/carbon/human/scorch_user = bearer(spot(4, 0), /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/scorch) + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/scorch = right_blade(scorch_user) + var/mob/living/carbon/human/consistent/seared = allocate(/mob/living/carbon/human/consistent, spot(3, 1)) + for(var/i in 1 to 3) + cut(scorch, scorch_user, seared, BODY_ZONE_L_LEG) + var/datum/wound/seared_wound = seared.get_bodypart(BODY_ZONE_L_LEG).get_wound_type(/datum/wound/slash/flesh/critical/hv_carotid/limb/seared) + TEST_ASSERT(seared_wound, "Three scorch cuts didn't sear the artery open") + TEST_ASSERT(seared_wound?.blood_flow < torn?.blood_flow, "The seared artery bleeds as hard as a cut one") + +/// The limb artery: no gargle, a hemostat clamps it, and the seared one clots. +/datum/unit_test/voidcrew_mantis_gore/wounds + +/datum/unit_test/voidcrew_mantis_gore/wounds/Run() + var/mob/living/carbon/human/consistent/victim = allocate(/mob/living/carbon/human/consistent, spot(1, 1)) + var/obj/item/bodypart/arm = victim.get_bodypart(BODY_ZONE_R_ARM) + var/datum/wound/slash/flesh/critical/hv_carotid/limb/torn = hv_crit_apply_wound(arm, /datum/wound/slash/flesh/critical/hv_carotid/limb, WEST, null) + TEST_ASSERT(torn, "The limb artery wound would not apply") + TEST_ASSERT_EQUAL(torn.spurt_dir, WEST, "The limb artery forgot the cut's direction") + TEST_ASSERT_EQUAL(torn.next_spurt, INFINITY, "The throat's pulse still runs on a limb") + var/list/message_args = list("hello there") + torn.gargle_speech(victim, message_args) + TEST_ASSERT_EQUAL(message_args[TREAT_MESSAGE_ARG], "hello there", "An arm wound gargled speech") + var/before = torn.blood_flow + torn.clamped = TRUE + torn.adjust_blood_flow(-2.5) + TEST_ASSERT(torn.blood_flow < before, "Clamping did nothing") + var/obj/item/bodypart/leg = victim.get_bodypart(BODY_ZONE_L_LEG) + var/datum/wound/slash/flesh/critical/hv_carotid/limb/seared/seared = hv_crit_apply_wound(leg, /datum/wound/slash/flesh/critical/hv_carotid/limb/seared, EAST, null) + TEST_ASSERT(seared, "The seared artery would not apply") + TEST_ASSERT(seared.clot_rate > 0, "The seared artery never clots") + TEST_ASSERT(GLOB.all_wound_pregen_data[/datum/wound/slash/flesh/critical/hv_carotid/limb], "The limb artery has no pregen data") + TEST_ASSERT(!GLOB.all_wound_pregen_data[/datum/wound/slash/flesh/critical/hv_carotid/limb].can_be_randomly_generated, "The limb artery can come from tg's random wound roll") + +/// Two blades into someone hurt hold them; a wall behind pins them longer. Safety ends it with no rip, +/// the rip floors them, and everything is put back. +/datum/unit_test/voidcrew_mantis_gore/impale + +/datum/unit_test/voidcrew_mantis_gore/impale/Run() + var/mob/living/carbon/human/user = bearer(spot(0, 2)) + var/list/held_housings = housings(user) + var/datum/action/cooldown/cyberware/mantis_lunge/lunge = locate() in mantis_lunge_actions(user) + + var/mob/living/carbon/human/consistent/fresh = allocate(/mob/living/carbon/human/consistent, spot(1, 2)) + TEST_ASSERT(!mantis_can_impale(user, fresh, held_housings), "Someone unhurt can be skewered") + fresh.adjustBruteLoss(40) + TEST_ASSERT(mantis_can_impale(user, fresh, held_housings), "Someone at 60% health can't be skewered") + TEST_ASSERT(!mantis_can_impale(user, fresh, list(held_housings[1])), "One blade skewered") + fresh.mob_size = MOB_SIZE_LARGE + TEST_ASSERT(!mantis_can_impale(user, fresh, held_housings), "Something big was skewered") + fresh.mob_size = MOB_SIZE_HUMAN + var/mob/living/carbon/human/consistent/floored = allocate(/mob/living/carbon/human/consistent, spot(1, 3)) + floored.Knockdown(10 SECONDS) + TEST_ASSERT(mantis_can_impale(user, floored, held_housings), "Someone on the floor can't be skewered") + // Off the floor and up on the blades: drawn upright, still lying down to tg, and laid back down after. + var/datum/mantis_impale/hoisted = new(user, floored, held_housings, 2 SECONDS) + TEST_ASSERT(hoisted.start(), "Someone on the floor wasn't skewered") + TEST_ASSERT(hoisted.hoist_angle, "Someone on the floor wasn't brought up on the blades") + TEST_ASSERT(abs(floored.transform.b) < 0.01 && floored.transform.a > 0.99, "Someone brought up on the blades isn't drawn upright") + TEST_ASSERT_EQUAL(floored.body_position, LYING_DOWN, "Bringing them up stood them up") + hoisted.begin_rig() + hoisted.finish() + TEST_ASSERT(!hoisted.hoist_angle, "The hoist outlived the hold") + TEST_ASSERT(!length(rig_pictures(user)), "The blades stayed drawn after the hold") + var/mob/living/basic/mouse/mouse = allocate(/mob/living/basic/mouse, spot(1, 1)) + TEST_ASSERT(!mantis_can_impale(user, mouse, held_housings), "A mouse was skewered") + + // Open floor behind: held up for the short beat. + TEST_ASSERT(mantis_start_impale(lunge, user, fresh, held_housings, 2 SECONDS), "The impale didn't start") + var/datum/mantis_impale/skewer = lunge.impale + TEST_ASSERT(skewer, "The lunge doesn't know about its skewer") + TEST_ASSERT(!skewer.wall_pin, "Open floor counted as a wall") + TEST_ASSERT_EQUAL(skewer.hold_time, 0.8 SECONDS, "The open hold isn't 0.8 seconds") + TEST_ASSERT(HAS_TRAIT_FROM(user, TRAIT_IMMOBILIZED, MG_IMPALE_TRAIT) && HAS_TRAIT_FROM(user, TRAIT_HANDS_BLOCKED, MG_IMPALE_TRAIT), "The bearer isn't rooted with full hands") + TEST_ASSERT(HAS_TRAIT_FROM(fresh, TRAIT_IMMOBILIZED, MG_IMPALE_TRAIT), "The victim isn't held") + TEST_ASSERT(!HAS_TRAIT(fresh, TRAIT_HANDS_BLOCKED), "The victim's hands are tied") + TEST_ASSERT_EQUAL(fresh.dir, WEST, "The victim wasn't turned onto the blades") + // The bearer is drawn by the rig from the glide in; the lunging body lands and the blades go in: drawn + // under them and over them. + TEST_ASSERT(skewer.rig, "The lunging body isn't drawn by the rig") + skewer.begin_rig() + skewer.stab() + TEST_ASSERT(skewer.rig, "The bearer isn't drawn around the victim") + TEST_ASSERT(fresh.has_offset(MG_IMPALE_TRAIT, PIXEL_W_OFFSET) < 0, "The victim isn't drawn onto the blades") + var/list/pictures = rig_pictures(user) + TEST_ASSERT_EQUAL(length(pictures), 5, "The blades going in aren't drawn in four pieces and the wounds") + var/under = 0 + var/over = 0 + for(var/obj/effect/abstract/mantis_puppet/picture as anything in pictures) + if(picture.layer < fresh.layer) + under++ + else if(picture.layer > fresh.layer) + over++ + TEST_ASSERT(under == 2 && over == 3, "The bearer isn't split around the victim ([under] under, [over] over)") + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/held_blade = right_blade(user) + TEST_ASSERT(held_blade.inhand_hidden_until > world.time, "The held blade is drawn over the blades going in") + skewer.show_beat("hold") + TEST_ASSERT(fresh.has_offset(MG_IMPALE_TRAIT, PIXEL_Z_OFFSET) > 0, "The victim isn't lifted") + var/brute_before = fresh.getBruteLoss() + skewer.rip() + TEST_ASSERT(HAS_TRAIT_FROM(fresh, TRAIT_IMMOBILIZED, MG_IMPALE_TRAIT), "The pull-back let them go before the blades came out") + var/datum/mantis_rig/dropping = skewer.rig + skewer.tear_out() + TEST_ASSERT(!dropping || !QDELETED(dropping), "The bearer wasn't drawn through the drop") + qdel(dropping) + TEST_ASSERT(!length(rig_pictures(user)), "The blades stayed drawn in them after the rip") + TEST_ASSERT(!user.get_filter("mantis_rig_hide"), "The bearer is still hidden after the rip") + TEST_ASSERT(!held_blade.inhand_hidden_until, "The held blade never came back") + TEST_ASSERT(fresh.getBruteLoss() > brute_before, "The rip did no damage") + TEST_ASSERT(fresh.IsKnockdown(), "The rip didn't floor them") + TEST_ASSERT(!HAS_TRAIT_FROM(user, TRAIT_IMMOBILIZED, MG_IMPALE_TRAIT) && !HAS_TRAIT_FROM(user, TRAIT_HANDS_BLOCKED, MG_IMPALE_TRAIT), "The bearer is still held") + TEST_ASSERT(!HAS_TRAIT_FROM(fresh, TRAIT_IMMOBILIZED, MG_IMPALE_TRAIT), "The victim is still held") + TEST_ASSERT(!fresh.has_offset(MG_IMPALE_TRAIT, PIXEL_Z_OFFSET), "The victim's lift outlived the hold") + TEST_ASSERT(isnull(lunge.impale), "The lunge still holds a skewer") + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade = right_blade(user) + TEST_ASSERT_EQUAL(blade.mantis_pose, "guard", "The blades didn't come back to the guard") + TEST_ASSERT(blade.drenched_until > world.time, "The rip didn't drench the blades") + blade.stop_dripping() + + // A wall right behind: pinned for longer. + var/mob/living/carbon/human/consistent/pinned = allocate(/mob/living/carbon/human/consistent, spot(2, 2)) + pinned.adjustBruteLoss(40) + allocate(/obj/structure/window/fulltile, spot(3, 2)) + user.forceMove(spot(1, 2)) + TEST_ASSERT(mantis_start_impale(lunge, user, pinned, held_housings, 2 SECONDS), "The wall impale didn't start") + skewer = lunge.impale + TEST_ASSERT(skewer.wall_pin, "A window behind them didn't pin them") + TEST_ASSERT_EQUAL(skewer.hold_time, 1.5 SECONDS, "The pin isn't 1.5 seconds") + // It runs out on its own and rips: the 1.5 s hold, up to a 0.2 s tick, then the 0.4 s pull-back and tear-out. + sleep(2.5 SECONDS) + TEST_ASSERT(isnull(lunge.impale), "The pin never ended") + TEST_ASSERT(pinned.IsKnockdown(), "The pin ended without the rip") + + // An EMP stows a blade: it ends at once, no rip. + var/mob/living/carbon/human/consistent/emp_victim = allocate(/mob/living/carbon/human/consistent, spot(2, 1)) + emp_victim.adjustBruteLoss(40) + user.forceMove(spot(1, 1)) + TEST_ASSERT(mantis_start_impale(lunge, user, emp_victim, held_housings, 2 SECONDS), "The EMP impale didn't start") + skewer = lunge.impale + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing as anything in held_housings) + housing.Retract() + skewer.tick() + TEST_ASSERT(isnull(lunge.impale), "Stowed blades kept them held") + TEST_ASSERT(!emp_victim.IsKnockdown(), "Stowed blades still ripped out") + TEST_ASSERT(!HAS_TRAIT_FROM(emp_victim, TRAIT_IMMOBILIZED, MG_IMPALE_TRAIT), "Stowed blades left the victim held") + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing as anything in held_housings) + housing.Extend(housing.contents[1]) + + // Teleported out: ends. + var/mob/living/carbon/human/consistent/jaunter = allocate(/mob/living/carbon/human/consistent, spot(2, 1)) + jaunter.adjustBruteLoss(40) + TEST_ASSERT(mantis_start_impale(lunge, user, jaunter, held_housings, 2 SECONDS), "The teleport impale didn't start") + jaunter.forceMove(spot(4, 4)) + TEST_ASSERT(isnull(lunge.impale), "Teleporting away didn't end the hold") + TEST_ASSERT(!HAS_TRAIT_FROM(jaunter, TRAIT_IMMOBILIZED, MG_IMPALE_TRAIT), "Teleporting away left them held") + + // Died on the blades: ends. + var/mob/living/carbon/human/consistent/goner = allocate(/mob/living/carbon/human/consistent, spot(2, 1)) + goner.adjustBruteLoss(40) + TEST_ASSERT(mantis_start_impale(lunge, user, goner, held_housings, 2 SECONDS), "The death impale didn't start") + goner.death() + TEST_ASSERT(isnull(lunge.impale), "A death on the blades didn't end the hold") + TEST_ASSERT(!HAS_TRAIT_FROM(user, TRAIT_IMMOBILIZED, MG_IMPALE_TRAIT), "A death on the blades left the bearer rooted") + + // Hit hard while holding: lets go at half the rip, and staggers. + var/mob/living/carbon/human/consistent/rescued = allocate(/mob/living/carbon/human/consistent, spot(2, 1)) + rescued.adjustBruteLoss(40) + TEST_ASSERT(mantis_start_impale(lunge, user, rescued, held_housings, 2 SECONDS), "The interrupted impale didn't start") + user.apply_damage(16, BRUTE, BODY_ZONE_CHEST) + TEST_ASSERT(isnull(lunge.impale), "Taking a beating didn't break the hold") + TEST_ASSERT(user.has_status_effect(/datum/status_effect/staggered), "Losing the grip didn't stagger the bearer") + TEST_ASSERT(rescued.IsKnockdown(), "Losing the grip didn't drop them") + +/// Crit only, any player on any player, never someone strapped down; damage breaks it; Atlas keeps the +/// head on; otherwise the head comes off with the brain. +/datum/unit_test/voidcrew_mantis_gore/scissor + +/datum/unit_test/voidcrew_mantis_gore/scissor/Run() + var/mob/living/carbon/human/user = bearer(spot(1, 1)) + var/mob/living/carbon/human/consistent/victim = allocate(/mob/living/carbon/human/consistent, spot(2, 1)) + victim.Knockdown(30 SECONDS) + var/datum/hv_finisher/mantis_scissor/early = allocate(/datum/hv_finisher/mantis_scissor, user, victim) + TEST_ASSERT(!early.can_start(), "Someone only knocked down can be scissored") + crit(victim) + TEST_ASSERT(!hv_finisher_valid_victim(user, victim), "Test premise: #509's check now lets players finish players") + TEST_ASSERT(early.can_start(), "Someone dying can't be scissored by another player") + ADD_TRAIT(user, TRAIT_PACIFISM, TRAIT_SOURCE_UNIT_TESTS) + TEST_ASSERT(!early.can_start(), "A pacifist can scissor") + REMOVE_TRAIT(user, TRAIT_PACIFISM, TRAIT_SOURCE_UNIT_TESTS) + + var/obj/structure/chair/chair = allocate(/obj/structure/chair, spot(2, 1)) + chair.buckle_mob(victim, force = TRUE) + TEST_ASSERT(!early.can_start(), "Someone strapped to a chair can be scissored") + chair.unbuckle_mob(victim, force = TRUE) + + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/left = housings(user)[2] + left.Retract() + TEST_ASSERT(!early.can_start(), "One blade can scissor") + left.Extend(left.contents[1]) + + // Started by the swing: combat mode, head aimed. + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade = right_blade(user) + user.set_combat_mode(TRUE) + user.zone_selected = BODY_ZONE_CHEST + TEST_ASSERT(!blade.mantis_try_scissor(victim, user), "A chest swing started the scissor") + user.zone_selected = BODY_ZONE_HEAD + TEST_ASSERT(blade.attack(victim, user, list(), list()), "A head swing at someone dying didn't start the scissor") + var/datum/hv_finisher/mantis_scissor/scissor = user.mantis_state?.scissor + TEST_ASSERT(scissor?.running, "The scissor isn't running") + TEST_ASSERT_EQUAL(blade.mantis_pose, "raise", "The blades didn't rise for the wind-up") + + // Hurt it: it reels back. + user.apply_damage(16, BRUTE, BODY_ZONE_CHEST) + TEST_ASSERT_EQUAL(scissor.result, MG_FINISHER_DAMAGED, "Damage didn't break the scissor") + TEST_ASSERT(user.has_status_effect(/datum/status_effect/hv_finisher_reeling), "The bearer didn't reel") + TEST_ASSERT_EQUAL(blade.mantis_pose, "guard", "The blades stayed raised") + TEST_ASSERT(isnull(user.mantis_state.scissor), "The broken scissor is still on the bearer") + TEST_ASSERT(!blade.mantis_try_scissor(victim, user), "The scissor has no cooldown") + user.remove_status_effect(/datum/status_effect/hv_finisher_reeling) + user.mantis_state.next_scissor = 0 + user.heal_overall_damage(brute = 50) + + // Atlas: the blades stop on metal, the head stays. + ADD_TRAIT(victim, TRAIT_NODISMEMBER, TRAIT_SOURCE_UNIT_TESTS) + var/datum/hv_finisher/mantis_scissor/framed = allocate(/datum/hv_finisher/mantis_scissor, user, victim, CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(mantis_scissor_ended))) + TEST_ASSERT(framed.start(), "The scissor didn't start on an Atlas body") + var/head_brute = victim.get_bodypart(BODY_ZONE_HEAD).brute_dam + for(var/i in 1 to 20) + if(!framed.running) + break + framed.advance() + TEST_ASSERT(framed.completed, "The Atlas scissor never closed") + TEST_ASSERT(victim.get_bodypart(BODY_ZONE_HEAD), "An Atlas body lost its head") + TEST_ASSERT(victim.get_bodypart(BODY_ZONE_HEAD).brute_dam > head_brute, "The blades did nothing to the Atlas neck") + REMOVE_TRAIT(victim, TRAIT_NODISMEMBER, TRAIT_SOURCE_UNIT_TESTS) + // Ended as the game ends one (mantis_try_scissor()'s callback): the rig fades into the real bearer + sleep(0.25 SECONDS) // mantis_rig/hand_back(), MANTIS_RIG_HANDBACK 0.15 s + + // The head comes off, brain inside, and lands where they lie. + // Side on (west of the bearer), where the rig draws a far blade: north or south it draws both arms as one piece + var/mob/living/carbon/human/consistent/doomed = allocate(/mob/living/carbon/human/consistent, spot(0, 1)) + crit(doomed) + var/datum/hv_finisher/mantis_scissor/kill = allocate(/datum/hv_finisher/mantis_scissor, user, doomed, CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(mantis_scissor_ended))) + TEST_ASSERT(kill.start(), "The scissor didn't start") + TEST_ASSERT(kill.rig, "The bearer isn't drawn around the victim") + kill.advance() + // The cut opens on the swing down and shows the blades meeting a step later (MANTIS_SCISSOR_SWING_STEP): show + // that beat now, as its timer would + var/datum/hv_finisher_stage/kill/decapitate/mantis/cut = kill.current_stage + TEST_ASSERT(istype(cut), "The scissor's second stage isn't the cut") + cut.close() + var/list/closing = rig_pictures(user) + var/below = 0 + for(var/obj/effect/abstract/mantis_puppet/picture as anything in closing) + if(picture.layer < doomed.layer) + below++ + TEST_ASSERT(length(closing) == 4 && below == 1, "The closing blades aren't drawn with the far blade under the neck ([length(closing)] pieces, [below] under)") + TEST_ASSERT(right_blade(user).inhand_hidden_until > world.time, "The held blade is drawn over the closing blades") + for(var/i in 1 to 20) + if(!kill.running) + break + kill.advance() + TEST_ASSERT_EQUAL(kill.result, MG_FINISHER_DONE, "The scissor didn't finish") + sleep(0.25 SECONDS) // the rig fades out (mantis_rig/hand_back(), MANTIS_RIG_HANDBACK 0.15 s) + TEST_ASSERT(!length(rig_pictures(user)) && !user.get_filter("mantis_rig_hide"), "The bearer is still drawn by the rig after the scissor") + TEST_ASSERT_NULL(doomed.get_bodypart(BODY_ZONE_HEAD), "The head is still on") + var/obj/item/bodypart/head/head = locate() in get_turf(doomed) + TEST_ASSERT(head, "The head isn't at their feet") + TEST_ASSERT(locate(/obj/item/organ/brain) in head, "The brain didn't stay in the head") + + // A human NPC below boss rank never scissors. + var/mob/living/carbon/human/npc/grunt = allocate(/mob/living/carbon/human/npc, spot(3, 3)) + var/mob/living/carbon/human/consistent/npc_victim = allocate(/mob/living/carbon/human/consistent, spot(3, 2)) + crit(npc_victim) + var/datum/hv_finisher/mantis_scissor/npc_try = allocate(/datum/hv_finisher/mantis_scissor, grunt, npc_victim) + TEST_ASSERT(!grunt.hv_can_execute() && !npc_try.can_start(), "An ordinary NPC can scissor") + +/// From a corner a head swing at someone dying is only a swing: the scissor starts square on. +/datum/unit_test/voidcrew_mantis_gore/scissor_square_on + +/datum/unit_test/voidcrew_mantis_gore/scissor_square_on/Run() + var/mob/living/carbon/human/user = bearer(spot(1, 1)) + var/mob/living/carbon/human/consistent/victim = allocate(/mob/living/carbon/human/consistent, spot(2, 2)) + crit(victim) + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade = right_blade(user) + user.set_combat_mode(TRUE) + user.zone_selected = BODY_ZONE_HEAD + TEST_ASSERT(!blade.mantis_try_scissor(victim, user), "The scissor started on someone on a corner") + var/hurt_before = victim.getBruteLoss() + victim.getFireLoss() + blade.attack(victim, user, list(), list()) + TEST_ASSERT(isnull(user.mantis_state?.scissor), "A corner swing started the scissor") + TEST_ASSERT(victim.getBruteLoss() + victim.getFireLoss() > hurt_before, "The corner swing didn't cut") + + // Square on, it starts; dragged onto a corner before the cut, it stops + victim.forceMove(spot(2, 1)) + user.next_move = 0 + var/datum/outpost_pvp_enforcement/real_enforcement = GLOB.outpost_pvp_enforcement + var/datum/outpost_pvp_enforcement/gorilla_spy/spy = new + GLOB.outpost_pvp_enforcement = spy + var/started = blade.mantis_try_scissor(victim, user) + GLOB.outpost_pvp_enforcement = real_enforcement + TEST_ASSERT(started, "The scissor didn't start square on") + TEST_ASSERT(victim in spy.hits, "The scissor didn't count as an attack at a trader outpost") + var/datum/hv_finisher/mantis_scissor/scissor = user.mantis_state.scissor + TEST_ASSERT(scissor?.running, "The scissor isn't running") + victim.forceMove(spot(2, 2)) + TEST_ASSERT(QDELETED(scissor) || !scissor.running, "The scissor went on with the body on a corner") + TEST_ASSERT(isnull(user.mantis_state.scissor), "The stopped scissor is still on the bearer") + // The rig fades back into the real bearer (MANTIS_RIG_HANDBACK), then goes + sleep(0.35 SECONDS) // MANTIS_RIG_HANDBACK is 0.15 s + TEST_ASSERT(!length(rig_pictures(user)), "A scissor stopped on a corner left the bearer drawn by the rig") + +/// Who counts, at most once per bearer per 8 s and per body per 2 min, never prisoners, only kills +/// within 5 s of the bearer's cut, and never under 3 s. +/datum/unit_test/voidcrew_mantis_gore/reset + +/datum/unit_test/voidcrew_mantis_gore/reset/proc/cooldown_left(mob/living/carbon/body) + var/datum/action/cooldown/cyberware/mantis_lunge/lunge = locate() in mantis_lunge_actions(body) + return lunge.next_use_time - world.time + +/datum/unit_test/voidcrew_mantis_gore/reset/proc/wind_up(mob/living/carbon/body) + for(var/datum/action/cooldown/cyberware/mantis_lunge/lunge as anything in mantis_lunge_actions(body)) + lunge.StartCooldown(20 SECONDS) + +/datum/unit_test/voidcrew_mantis_gore/reset/Run() + var/mob/living/carbon/human/user = bearer(spot(0, 0)) + TEST_ASSERT(length(mantis_lunge_actions(user)) == 2, "Fixture: the bearer hasn't two lunge buttons") + + var/mob/living/carbon/human/consistent/person = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + var/mob/living/carbon/human/species/monkey/monkey = allocate(/mob/living/carbon/human/species/monkey, spot(1, 1)) + var/mob/living/basic/mouse/mouse = allocate(/mob/living/basic/mouse, spot(1, 2)) + TEST_ASSERT(mantis_kill_reset_counts(person), "A person doesn't count") + TEST_ASSERT(!mantis_kill_reset_counts(monkey), "A monkey counts") + TEST_ASSERT(!mantis_kill_reset_counts(mouse), "A mouse counts") + mouse.maxHealth = 150 + TEST_ASSERT(mantis_kill_reset_counts(mouse), "Something big doesn't count") + + wind_up(user) + TEST_ASSERT(mantis_try_kill_reset(user, person), "A kill didn't reset the lunge") + TEST_ASSERT(cooldown_left(user) <= 3 SECONDS && cooldown_left(user) > 0, "The reset isn't down to 3 seconds") + + // Once per 8 seconds. + var/mob/living/carbon/human/consistent/second = allocate(/mob/living/carbon/human/consistent, spot(2, 0)) + wind_up(user) + TEST_ASSERT(!mantis_try_kill_reset(user, second), "Two resets inside 8 seconds") + user.mantis_state.next_kill_reset = 0 + TEST_ASSERT(mantis_try_kill_reset(user, second), "The second kill after the 8 seconds didn't reset") + + // Once per body per 2 minutes. + user.mantis_state.next_kill_reset = 0 + wind_up(user) + TEST_ASSERT(!mantis_try_kill_reset(user, person), "The same body reset twice inside 2 minutes") + person.mantis_reset_given_at = world.time - 2 MINUTES - 1 + TEST_ASSERT(mantis_try_kill_reset(user, person), "The body still blocks after 2 minutes") + + // Never prisoners. + var/mob/living/carbon/human/consistent/prisoner = allocate(/mob/living/carbon/human/consistent, spot(2, 1)) + ADD_TRAIT(prisoner, TRAIT_RESTRAINED, TRAIT_SOURCE_UNIT_TESTS) + user.mantis_state.next_kill_reset = 0 + wind_up(user) + TEST_ASSERT(!mantis_try_kill_reset(user, prisoner), "Killing a cuffed prisoner reset the lunge") + var/mob/living/carbon/human/consistent/strapped = allocate(/mob/living/carbon/human/consistent, spot(2, 2)) + var/obj/structure/chair/chair = allocate(/obj/structure/chair, spot(2, 2)) + chair.buckle_mob(strapped, force = TRUE) + TEST_ASSERT(!mantis_try_kill_reset(user, strapped), "Killing someone strapped down reset the lunge") + + // Never shorter than the floor: a cooldown already under 3 s is left alone. + for(var/datum/action/cooldown/cyberware/mantis_lunge/lunge as anything in mantis_lunge_actions(user)) + lunge.StartCooldown(2 SECONDS) + var/mob/living/carbon/human/consistent/late = allocate(/mob/living/carbon/human/consistent, spot(3, 0)) + TEST_ASSERT(!mantis_try_kill_reset(user, late), "A reset lengthened a short cooldown") + TEST_ASSERT(cooldown_left(user) <= 2 SECONDS, "A short cooldown got longer") + + // Through the death signal: a cut 6 seconds back is not the kill; a fresh one is. + user.mantis_state.next_kill_reset = 0 + wind_up(user) + var/mob/living/carbon/human/consistent/bled_out = allocate(/mob/living/carbon/human/consistent, spot(3, 1)) + var/datum/status_effect/mantis_cuts/old_cuts = mantis_note_hit(bled_out, user) + old_cuts.last_hit = world.time - 6 SECONDS + bled_out.death() + TEST_ASSERT(cooldown_left(user) > 3 SECONDS, "A death long after the cut reset the lunge") + var/mob/living/carbon/human/consistent/killed = allocate(/mob/living/carbon/human/consistent, spot(3, 2)) + mantis_note_hit(killed, user) + killed.death() + TEST_ASSERT(cooldown_left(user) <= 3 SECONDS, "A fresh kill didn't reset the lunge") + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade = right_blade(user) + TEST_ASSERT(blade.drenched_until > world.time, "A kill didn't drench the blades") + blade.stop_dripping() + + // A plain NPC bearer gets no reset. + var/mob/living/carbon/human/npc/grunt = allocate(/mob/living/carbon/human/npc, spot(4, 4)) + var/mob/living/carbon/human/consistent/npc_kill = allocate(/mob/living/carbon/human/consistent, spot(4, 3)) + TEST_ASSERT(!mantis_try_kill_reset(grunt, npc_kill), "An ordinary NPC got a reset") + +/// The hold to charge: reach by hold time, the field drops at the press, a hit breaks the crouch for the +/// whole cooldown, a light hit doesn't, it straightens up on its own, and a release leaps. +/datum/unit_test/voidcrew_mantis_gore/charge + +/datum/unit_test/voidcrew_mantis_gore/charge/Run() + TEST_ASSERT_EQUAL(mantis_charge_range(0.2 SECONDS, 5), 5, "A tap reaches further than the lunge") + TEST_ASSERT_EQUAL(mantis_charge_range(0.35 SECONDS, 5), 5, "The start of the crouch reaches further than the lunge") + TEST_ASSERT_EQUAL(mantis_charge_range(0.775 SECONDS, 5), 6, "Halfway reaches the wrong distance") + TEST_ASSERT_EQUAL(mantis_charge_range(1.2 SECONDS, 5), 7, "A full charge doesn't reach 7") + TEST_ASSERT_EQUAL(mantis_charge_range(3 SECONDS, 5), 7, "A long hold reaches past 7") + + var/mob/living/carbon/human/user = bearer(spot(0, 0)) + var/obj/item/organ/cyberimp/cyberware/ghostskin/weave = allocate(/obj/item/organ/cyberimp/cyberware/ghostskin) + TEST_ASSERT(weave.Insert(user, special = TRUE), "Fixture: the weave would not install") + var/mob/living/carbon/human/consistent/target = allocate(/mob/living/carbon/human/consistent, spot(4, 0)) + var/datum/action/cooldown/cyberware/mantis_lunge/lunge = locate() in mantis_lunge_actions(user) + weave.engage_camo(user) + TEST_ASSERT(HAS_TRAIT(user, MG_TRAIT_CAMO), "Fixture: the field didn't come up") + TEST_ASSERT(lunge.begin_charge(target), "The charge didn't begin") + TEST_ASSERT(!HAS_TRAIT(user, MG_TRAIT_CAMO), "The field stayed up through the press") + + // The crouch, then a solid hit. + lunge.enter_crouch() + TEST_ASSERT(lunge.crouched, "The crouch didn't show") + TEST_ASSERT(HAS_TRAIT_FROM(user, TRAIT_IMMOBILIZED, MG_CHARGE_TRAIT), "The crouch isn't rooted") + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade = right_blade(user) + TEST_ASSERT_EQUAL(blade.mantis_pose, "coil", "The blades aren't drawn back") + user.apply_damage(5, BRUTE, BODY_ZONE_CHEST) + TEST_ASSERT(lunge.crouched, "A graze broke the crouch") + user.apply_damage(12, BRUTE, BODY_ZONE_CHEST) + TEST_ASSERT(!lunge.crouched, "A solid hit didn't break the crouch") + TEST_ASSERT(!HAS_TRAIT_FROM(user, TRAIT_IMMOBILIZED, MG_CHARGE_TRAIT), "The broken crouch is still rooted") + TEST_ASSERT(!user.has_offset(MG_CHARGE_TRAIT, PIXEL_Z_OFFSET), "The broken crouch left the bearer sunk") + for(var/datum/action/cooldown/cyberware/mantis_lunge/each as anything in mantis_lunge_actions(user)) + TEST_ASSERT(each.next_use_time - world.time > 15 SECONDS, "A broken crouch didn't cost the full cooldown") + each.ResetCooldown() + TEST_ASSERT_EQUAL(blade.mantis_pose, "guard", "The blades stayed drawn back") + user.heal_overall_damage(brute = 50) + user.mantis_state.next_charge = 0 + + // Held too long: straightens up, no cooldown, a moment before setting again. + TEST_ASSERT(lunge.begin_charge(target), "The second charge didn't begin") + lunge.enter_crouch() + lunge.charge_started = world.time - 3.1 SECONDS + lunge.crouch_tick() + TEST_ASSERT(!lunge.crouched, "A long hold never straightened up") + TEST_ASSERT(lunge.IsAvailable(), "Straightening up cost the cooldown") + TEST_ASSERT(!lunge.begin_charge(target), "The bearer set again at once") + user.mantis_state.next_charge = 0 + + // Released after a full charge: the leap lands next to them. + TEST_ASSERT(lunge.begin_charge(target), "The third charge didn't begin") + lunge.enter_crouch() + lunge.charge_started = world.time - 1.2 SECONDS + TEST_ASSERT(lunge.release_charge(), "The release didn't leap") + TEST_ASSERT(user.Adjacent(target), "The leap didn't land beside the target") + TEST_ASSERT(!lunge.crouched && !HAS_TRAIT_FROM(user, TRAIT_IMMOBILIZED, MG_CHARGE_TRAIT), "The leap left the bearer crouched") + TEST_ASSERT(!lunge.IsAvailable(), "The leap cost no cooldown") + // They go down with the impact, once the body has glided in (land_lunge(), mantis_lunge_knockdown()) + sleep(1 SECONDS) + TEST_ASSERT(target.IsKnockdown(), "The leap didn't drop the target") + +/// The dash stops at the edge of a chasm or lava, never on it. +/datum/unit_test/voidcrew_mantis_gore/lunge_path + var/list/turf/changed_turfs = list() + var/list/original_turf_types = list() + +/datum/unit_test/voidcrew_mantis_gore/lunge_path/Destroy() + for(var/i in 1 to length(changed_turfs)) + var/turf/changed = changed_turfs[i] + changed.ChangeTurf(original_turf_types[i]) + return ..() + +/datum/unit_test/voidcrew_mantis_gore/lunge_path/Run() + for(var/hazard in list(/turf/open/chasm, /turf/open/lava/smooth)) + var/mob/living/carbon/human/user = bearer(spot(0, 2)) + var/mob/living/carbon/human/consistent/target = allocate(/mob/living/carbon/human/consistent, spot(4, 2)) + var/turf/gap = spot(2, 2) + original_turf_types += gap.type + changed_turfs += gap.ChangeTurf(hazard) + var/datum/action/cooldown/cyberware/mantis_lunge/lunge = locate() in mantis_lunge_actions(user) + lunge.do_lunge(WEAKREF(target)) + TEST_ASSERT_EQUAL(get_turf(user), spot(1, 2), "The dash didn't stop at the edge of [hazard]") + TEST_ASSERT(!target.IsKnockdown(), "A dash stopped short of [hazard] still dropped the target") + var/turf/changed = changed_turfs[length(changed_turfs)] + changed.ChangeTurf(original_turf_types[length(original_turf_types)]) + changed_turfs.Cut() + original_turf_types.Cut() + qdel(user) + qdel(target) + TEST_ASSERT(mantis_lunge_unsafe_turf(null), "No turf counted as safe") + +/// Every third landed cut with both blades out, on the same target and inside the window, crosses both +/// blades; its follow-through never counts as a cut of its own. +/datum/unit_test/voidcrew_mantis_gore/xslash + +/datum/unit_test/voidcrew_mantis_gore/xslash/Run() + var/mob/living/carbon/human/user = bearer(spot(0, 0)) + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade = right_blade(user) + var/mob/living/carbon/human/consistent/target = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + cut(blade, user, target, BODY_ZONE_CHEST) + cut(blade, user, target, BODY_ZONE_CHEST) + TEST_ASSERT(!target.has_status_effect(/datum/status_effect/staggered), "Two cuts staggered them") + var/brute_before = target.getBruteLoss() + cut(blade, user, target, BODY_ZONE_CHEST) + TEST_ASSERT(target.has_status_effect(/datum/status_effect/staggered), "The third cut didn't stagger them") + TEST_ASSERT(target.getBruteLoss() - brute_before > 10, "The off blade didn't follow through") + TEST_ASSERT_EQUAL(user.mantis_state.xslash_count, 0, "The follow-through counted as a cut, or the count didn't reset") + + // A new target starts over. + var/mob/living/carbon/human/consistent/other = allocate(/mob/living/carbon/human/consistent, spot(1, 1)) + cut(blade, user, target, BODY_ZONE_CHEST) + cut(blade, user, target, BODY_ZONE_CHEST) + cut(blade, user, other, BODY_ZONE_CHEST) + TEST_ASSERT_EQUAL(user.mantis_state.xslash_count, 1, "Switching targets kept the count") + // So does a gap. + cut(blade, user, other, BODY_ZONE_CHEST) + user.mantis_state.xslash_last = world.time - 5 SECONDS + cut(blade, user, other, BODY_ZONE_CHEST) + TEST_ASSERT_EQUAL(user.mantis_state.xslash_count, 1, "A gap kept the count") + + // One blade out: never. + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/left = housings(user)[2] + left.Retract() + var/mob/living/carbon/human/consistent/single = allocate(/mob/living/carbon/human/consistent, spot(2, 0)) + for(var/i in 1 to 3) + cut(blade, user, single, BODY_ZONE_CHEST) + TEST_ASSERT(!single.has_status_effect(/datum/status_effect/staggered), "One blade crossed itself") + + // The Shiv has no X. + var/mob/living/carbon/human/shiv_user = bearer(spot(4, 4), /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/street) + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/shiv = right_blade(shiv_user) + TEST_ASSERT(!(shiv.gore_moves & MG_MOVE_XSLASH), "The Shiv can X-slash") + TEST_ASSERT(!(shiv.gore_moves & MG_MOVE_IMPALE), "The Shiv can impale") + +/// The Mantis blade takes blood, the Scorch doesn't. Stowing a bloody blade flicks it clean onto the +/// floor ahead and stains the housing until the bearer washes. +/datum/unit_test/voidcrew_mantis_gore/blood + +/datum/unit_test/voidcrew_mantis_gore/blood/Run() + var/mob/living/carbon/human/consistent/donor = allocate(/mob/living/carbon/human/consistent, spot(4, 4)) + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/loose = allocate(/obj/item/melee/energy/blade/hardlight/cyberware_mantis) + loose.add_mob_blood(donor) + TEST_ASSERT(loose.is_bloody(), "The Mantis blade refuses blood") + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/scorch/clean = allocate(/obj/item/melee/energy/blade/hardlight/cyberware_mantis/scorch) + clean.add_mob_blood(donor) + TEST_ASSERT(!clean.is_bloody(), "The Scorch blade took blood") + TEST_ASSERT(!clean.drench(donor), "The Scorch blade drenched") + + var/mob/living/carbon/human/user = bearer(spot(1, 1)) + user.setDir(EAST) + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade = right_blade(user) + TEST_ASSERT(blade.drench(donor), "The blade wouldn't drench") + TEST_ASSERT(blade.drenched_until > world.time && blade.drip_timer, "A drenched blade doesn't drip") + var/list/overlays = blade.worn_overlays(mutable_appearance(MANTIS_TEST_RIGHTHAND, "mantis_guard"), TRUE, MANTIS_TEST_RIGHTHAND) + var/stained_hand = FALSE + var/drips = FALSE + for(var/mutable_appearance/overlay as anything in overlays) + if(overlay.icon_state == "mantis_guard_soak") + stained_hand = TRUE + if(overlay.icon_state == "mantis_guard_drip") + drips = TRUE + TEST_ASSERT(stained_hand, "The held blade shows no blood") + TEST_ASSERT(drips, "The drenched held blade shows no drops") + + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/right = housings(user)[1] + right.Retract() + TEST_ASSERT(!blade.is_bloody(), "Stowing didn't flick the blade clean") + TEST_ASSERT(!blade.drip_timer, "A stowed blade still drips") + TEST_ASSERT(right.stained, "The housing kept no stain") + TEST_ASSERT(findtext(right.cyberware_worn_key(), "blood"), "The stain isn't part of the housing's look") + // Past the fold, the housing shows again, stain and all. + right.stop_blade_anim() + var/list/dressed = right.cyberware_dress_worn(list(image(icon = 'voidcrew/modules/cyberware/icons/cyberware_worn.dmi', icon_state = "mantis_right")), -27, user.get_bodypart(BODY_ZONE_R_ARM)) + var/stain_drawn = FALSE + for(var/image/part as anything in dressed) + if(part.icon_state == "mantis_right_stain") + stain_drawn = TRUE + TEST_ASSERT(stain_drawn, "The stained housing draws no stain") + // The flicked blood is in the air for a moment before it lands. + sleep(0.4 SECONDS) + var/obj/effect/decal/cleanable/blood/mantis_flick/spatter = locate() in spot(2, 1) + TEST_ASSERT_NOTNULL(spatter, "The flick left no spatter ahead") + TEST_ASSERT_EQUAL(spatter.dir, user.dir, "The flick's spatter doesn't point the way it was thrown") + TEST_ASSERT(icon_exists(spatter.icon, spatter.icon_state), "The flick's spatter has no picture") + TEST_ASSERT(!(locate(/obj/effect/decal/cleanable/blood/hv_spray/streak) in spot(2, 1)), "The flick still lays a streak") + user.wash(CLEAN_TYPE_BLOOD) + TEST_ASSERT(!right.stained, "Washing didn't clear the housing") + + // A clean blade just stows. + right.Extend(right.contents[1]) + right.Retract() + TEST_ASSERT(!right.stained, "A clean blade stained the housing") + +/// While a blade is out its fist rides up and it holds the guard; it glints now and then; all of it ends +/// when the blade is stowed or the housing pulled. Every pose has its art. +/datum/unit_test/voidcrew_mantis_gore/stance + +/datum/unit_test/voidcrew_mantis_gore/stance/Run() + var/mob/living/carbon/human/user = bearer(spot(1, 1), out = FALSE) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/right = housings(user)[1] + var/obj/item/bodypart/arm = user.get_bodypart(BODY_ZONE_R_ARM) + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade = right.contents[1] + right.Extend(blade) + TEST_ASSERT_EQUAL(blade.inhand_icon_state, "mantis_guard", "The blade isn't held in the guard") + TEST_ASSERT(right.stance_overlay && (right.stance_overlay in arm.bodypart_overlays), "The fist didn't come up") + TEST_ASSERT_EQUAL(right.stance_overlay.raise, 2, "The guard fist isn't 2 pixels up") + TEST_ASSERT(right.glint_timer, "No glint is coming") + blade.set_mantis_pose("raise") + TEST_ASSERT_EQUAL(blade.inhand_icon_state, "mantis_raise", "The raise pose didn't take") + TEST_ASSERT_EQUAL(right.stance_overlay.raise, 3, "The fist didn't follow the raise") + blade.set_mantis_pose("nonsense") + TEST_ASSERT_EQUAL(blade.inhand_icon_state, "mantis_guard", "A pose with no art didn't fall back to the guard") + right.Retract() + TEST_ASSERT(isnull(right.stance_overlay), "The stance outlived the blade") + for(var/datum/bodypart_overlay/overlay as anything in arm.bodypart_overlays) + TEST_ASSERT(!istype(overlay, /datum/bodypart_overlay/mantis_stance), "The raised fist stayed on the arm") + TEST_ASSERT(!right.glint_timer, "The glint outlived the blade") + right.Extend(blade) + right.Remove(user, special = TRUE) + TEST_ASSERT(isnull(right.stance_overlay), "A pulled housing left the fist raised") + + var/static/list/poses_by_model = list( + "mantis" = list("guard", "lunge", "raise", "coil"), + "mantis_street" = list("guard"), + "mantis_scorch" = list("guard", "lunge", "raise", "coil"), + ) + for(var/model in poses_by_model) + for(var/pose in poses_by_model[model]) + for(var/hand_file in list(MANTIS_TEST_LEFTHAND, MANTIS_TEST_RIGHTHAND)) + TEST_ASSERT(icon_exists(hand_file, "[model]_[pose]"), "[hand_file] has no [model]_[pose]") + for(var/state in list("mantis_trail", "mantis_scorch_trail", "mantis_impale", "mantis_scorch_impale", "mantis_coil_glow_right", "mantis_scorch_coil_glow_left", "mantis_guard_glint_right", "mantis_raise_glint_left", "scorch_gash_l_arm", "scorch_gash_head", "flick_spatter_right", "flick_spatter_left")) + TEST_ASSERT(icon_exists(MANTIS_TEST_ICON, state), "The gore sheet has no [state]") + for(var/state in list("mantis_flick_right", "mantis_flick_left")) + TEST_ASSERT(icon_exists(MANTIS_TEST_LARGE_ICON, state), "The large gore sheet has no [state]") + // Every piece the blade rig draws, for every model that can impale and scissor. + var/list/moves = list( + "impale" = list("arrive", "contact", "enter", "lift1", "lift2", "hold", "pull1", "pull2", "pull3", "rip", "drop"), + "scissor" = list("raise", "glint", "close", "cut", "recover"), + ) + for(var/model in list("mantis", "mantis_scorch")) + for(var/move in moves) + for(var/beat in moves[move]) + for(var/facing in GLOB.cardinals) + var/list/spec = mantis_rig_beat(move, beat, facing) + TEST_ASSERT(spec, "The rig has no [move] [beat] facing [dir2text(facing)]") + for(var/piece in spec[MG_RIG_ORDER]) + if(piece == "T" || piece == "body" || piece == "whole") + continue + TEST_ASSERT(icon_exists(MANTIS_TEST_REACH_ICON, "[model]_[move]_[beat]_[piece]"), "The reach sheet has no [model]_[move]_[beat]_[piece]") + // The beat only some views draw: the scissor's swing, seen from the side and the front. + var/list/side_moves = list("scissor" = list("swing")) + for(var/model in list("mantis", "mantis_scorch")) + for(var/move in side_moves) + for(var/beat in side_moves[move]) + for(var/facing in list(EAST, WEST, SOUTH)) + var/list/spec = mantis_rig_beat(move, beat, facing) + TEST_ASSERT(spec, "The rig has no [move] [beat] facing [dir2text(facing)]") + for(var/piece in spec[MG_RIG_ORDER]) + if(piece == "T" || piece == "body" || piece == "whole") + continue + TEST_ASSERT(icon_exists(MANTIS_TEST_REACH_ICON, "[model]_[move]_[beat]_[piece]"), "The reach sheet has no [model]_[move]_[beat]_[piece]") + +/// What a torn artery looks like: drops thrown the way the cut went that land as spots, and the blood running +/// down the body for as long as the wound is open. +/datum/unit_test/voidcrew_mantis_gore/artery_look + +/datum/unit_test/voidcrew_mantis_gore/artery_look/Run() + for(var/height in list("low", "mid", "high")) + for(var/strength in list("", "_weak")) + TEST_ASSERT(icon_exists(MANTIS_TEST_ARTERY_ICON, "spurt_[height][strength]"), "The artery sheet has no spurt_[height][strength]") + TEST_ASSERT(icon_exists(MANTIS_TEST_ICON, "artery_drops_[height][strength]"), "The gore sheet has no artery_drops_[height][strength]") + for(var/zone in GLOB.all_body_zones) + TEST_ASSERT(icon_exists(MANTIS_TEST_ICON, "artery_run_[zone]"), "The gore sheet has no artery_run_[zone]") + TEST_ASSERT(icon_exists(MANTIS_TEST_ICON, "artery_ran_[zone]"), "The gore sheet has no artery_ran_[zone]") + for(var/drips in 1 to 3) + TEST_ASSERT(icon_exists(MANTIS_TEST_ICON, "artery_feet_[drips]"), "The gore sheet has no artery_feet_[drips]") + + var/mob/living/carbon/human/consistent/victim = allocate(/mob/living/carbon/human/consistent, spot(1, 1)) + victim.setDir(SOUTH) + var/obj/item/bodypart/arm = victim.get_bodypart(BODY_ZONE_L_ARM) + var/datum/wound/slash/flesh/critical/hv_carotid/limb/torn = hv_crit_apply_wound(arm, /datum/wound/slash/flesh/critical/hv_carotid/limb, EAST, null) + TEST_ASSERT(torn, "The limb artery wound would not apply") + // The artery throws its own drops: tg's wound spray, a line of blood three tiles long, stays out of it. + TEST_ASSERT(!(locate(/obj/effect/decal/cleanable/blood/hitsplatter) in range(1, victim)), "The limb artery threw tg's own wound spray as well") + TEST_ASSERT_EQUAL(torn.spurt_dir, EAST, "The limb artery forgot the cut's direction") + TEST_ASSERT_EQUAL(mantis_artery_height(victim, BODY_ZONE_L_ARM), "mid", "An arm's artery is not at arm height") + TEST_ASSERT_EQUAL(mantis_artery_height(victim, BODY_ZONE_R_LEG), "low", "A leg's artery is not near the floor") + TEST_ASSERT_EQUAL(mantis_artery_height(victim, BODY_ZONE_HEAD), "high", "The neck's artery is not at neck height") + + // One spurt: drops in the air the way the cut went, then spots where they come down, a tile east. + var/obj/effect/abstract/cyberware_anim/jet = mantis_spurt_fx(victim, BODY_ZONE_L_ARM, EAST) + TEST_ASSERT_NOTNULL(jet, "A torn artery throws nothing") + TEST_ASSERT_EQUAL(jet.icon_state, "spurt_mid", "An arm's spurt isn't the arm-height one") + TEST_ASSERT_EQUAL(jet.dir, EAST, "The spurt doesn't fly the way the cut went") + TEST_ASSERT(!(locate(/obj/effect/decal/cleanable/blood/drip/mantis_drops) in spot(2, 1)), "The drops are on the floor before they have flown") + sleep(0.5 SECONDS) + var/obj/effect/decal/cleanable/blood/drip/mantis_drops/drops = locate() in spot(2, 1) + TEST_ASSERT_NOTNULL(drops, "The spurt's drops left no spots where they came down") + TEST_ASSERT_EQUAL(drops.icon_state, "artery_drops_mid", "The spots are not the spurt's own") + TEST_ASSERT_EQUAL(drops.dir, EAST, "The spots don't lie the way the drops flew") + TEST_ASSERT(!(locate(/obj/effect/decal/cleanable/blood/hv_spray) in spot(2, 1)), "A spurt still lays a spray") + // The next beat comes down on the same spots. + mantis_spurt_fx(victim, BODY_ZONE_L_ARM, EAST) + sleep(0.5 SECONDS) + var/spots = 0 + for(var/obj/effect/decal/cleanable/blood/drip/mantis_drops/laid in spot(2, 1)) + spots++ + TEST_ASSERT_EQUAL(spots, 1, "A second beat stacked its spots on the first's") + // A weak one falls close by. + var/obj/effect/abstract/cyberware_anim/weak_jet = mantis_spurt_fx(victim, BODY_ZONE_L_ARM, EAST, TRUE) + TEST_ASSERT_EQUAL(weak_jet?.icon_state, "spurt_mid_weak", "A weak spurt isn't the weak one") + // Thrown straight up or down the screen out of an arm, the drops lean out to that arm's side and land clear + // of the body. Thrown sideways they don't lean. + var/list/straight = mantis_spurt_spot(list(6, 1), "mid", FALSE, NORTH) + var/list/leaning = mantis_spurt_spot(list(6, 1), "mid", FALSE, NORTH, 1) + TEST_ASSERT(leaning[1] > straight[1], "Drops thrown up the screen out of an arm on the right don't lean out to the right") + TEST_ASSERT_EQUAL(leaning[2], straight[2], "Leaning out changed how far the drops fly") + TEST_ASSERT_EQUAL(mantis_spurt_lean(FALSE, EAST, 1), 0, "Drops thrown sideways lean") + // Every spurt's drops are still in its picture where they come down, on the last frame it holds. The neck's, + // thrown down the screen, fall furthest: the wound sits above the picture's middle to leave them the room. + // And its first frame is empty: the half beat a swinging blade cocks back, so no drop is out ahead of the cut. + var/icon/spurt_sheet = icon(MANTIS_TEST_ARTERY_ICON) + for(var/spurt_height in list("low", "mid", "high")) + for(var/spurt_weak in list(FALSE, TRUE)) + var/list/spurt_shape = mantis_spurt_shape(spurt_height, spurt_weak) + var/spurt_state = "spurt_[spurt_height][spurt_weak ? "_weak" : ""]" + var/last_frame = spurt_shape[3] / 0.5 + 2 + for(var/way in GLOB.alldirs) + var/list/landing = mantis_spurt_spot(list(0, 0), spurt_height, spurt_weak, way) + var/landed = FALSE + for(var/across in -3 to 3) + for(var/up in -3 to 3) + if(spurt_sheet.GetPixel(49 + landing[1] + across, 48 + MG_ARTERY_WOUND_RISE + landing[2] + up, spurt_state, way, last_frame)) + landed = TRUE + TEST_ASSERT(landed, "The [spurt_state] thrown [dir2text(way)] has left its picture before its drops come down") + var/early = FALSE + for(var/across in -2 to 2) + for(var/up in -2 to 2) + if(spurt_sheet.GetPixel(49 + across, 48 + MG_ARTERY_WOUND_RISE + up, spurt_state, way, 1)) + early = TRUE + TEST_ASSERT(!early, "The [spurt_state] thrown [dir2text(way)] has drops out of the wound before the blade has cut") + + // The blood runs down the body, and goes when the wound does. + var/obj/effect/abstract/cyberware_anim/mantis_run/run = mantis_artery_run_fx(victim, BODY_ZONE_L_ARM, torn) + TEST_ASSERT_NOTNULL(run, "A torn artery doesn't run down the body") + TEST_ASSERT(run in victim.vis_contents, "The run isn't drawn on the body") + TEST_ASSERT_EQUAL(run.icon_state, "artery_run_l_arm", "The run isn't the arm's") + sleep(0.9 SECONDS) + TEST_ASSERT_EQUAL(run.icon_state, "artery_ran_l_arm", "The run isn't held once it has run its length") + // Three drips fall off its lower end and make a small pool at the feet, just under the body's own tile. + sleep(0.5 SECONDS) + var/obj/effect/decal/cleanable/blood/drip/mantis_drops/pool + for(var/obj/effect/decal/cleanable/blood/drip/mantis_drops/found in get_step(victim, SOUTH)) + if(found.feet_drips) + pool = found + TEST_ASSERT_NOTNULL(pool, "The run dripped nothing at the feet") + TEST_ASSERT_EQUAL(pool.icon_state, "artery_feet_3", "Three drips at the feet did not make the small pool") + TEST_ASSERT_NOTNULL(mantis_artery_run_foot(BODY_ZONE_L_ARM, EAST), "The blood off a far arm comes down to no sole") + // tg's own bleeding still drips onto a tile that holds the artery's spots, and makes its pool there in the end. + var/turf/spotted = spot(2, 1) + for(var/drips in 1 to 6) + victim.get_bloodtype()?.make_blood_splatter(victim, spotted, TRUE) + var/pooled = FALSE + for(var/obj/effect/decal/cleanable/blood/splatter in spotted) + if(!istype(splatter, /obj/effect/decal/cleanable/blood/drip)) + pooled = TRUE + TEST_ASSERT(pooled, "Blood dripping onto the artery's spots never made a pool") + qdel(torn) + TEST_ASSERT(QDELETED(run), "The run outlived its wound") + + // Lying down the blood goes to the floor: low drops, and nothing runs down the body. + victim.set_body_position(LYING_DOWN) + TEST_ASSERT_EQUAL(mantis_artery_height(victim, BODY_ZONE_L_ARM), "low", "A body lying down still bleeds from arm height") + var/datum/wound/slash/flesh/critical/hv_carotid/limb/again = hv_crit_apply_wound(arm, /datum/wound/slash/flesh/critical/hv_carotid/limb, EAST, null) + TEST_ASSERT(again, "The limb artery wound would not apply a second time") + TEST_ASSERT_NULL(mantis_artery_run_fx(victim, BODY_ZONE_L_ARM, again), "Blood runs down a body lying flat") + +#undef MG_MOVE_IMPALE +#undef MG_MOVE_XSLASH +#undef MG_IMPALE_TRAIT +#undef MG_CHARGE_TRAIT +#undef MG_TRAIT_CAMO +#undef MG_FINISHER_DONE +#undef MG_FINISHER_DAMAGED +#undef MANTIS_TEST_ICON +#undef MANTIS_TEST_LARGE_ICON +#undef MANTIS_TEST_ARTERY_ICON +#undef MG_ARTERY_WOUND_RISE +#undef MANTIS_TEST_LEFTHAND +#undef MANTIS_TEST_RIGHTHAND +#undef MANTIS_TEST_REACH_ICON +#undef MG_RIG_ORDER diff --git a/voidcrew/modules/unit_tests/voidcrew_mantis_swing.dm b/voidcrew/modules/unit_tests/voidcrew_mantis_swing.dm new file mode 100644 index 00000000000..e70091c2d3e --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_mantis_swing.dm @@ -0,0 +1,181 @@ +/// An ordinary hit swings the hand that hit (voidcrew/modules/mantis_gore/mantis_swing.dm): the swing plays on +/// the bearer, the held blade hides under it, and putting the blade away ends it. Each hand's slash over the target +/// runs the way its own blade cuts. +/datum/unit_test/voidcrew_mantis_gore/swing + +/datum/unit_test/voidcrew_mantis_gore/swing/Run() + var/mob/living/carbon/human/user = bearer(spot(0, 0)) + var/mob/living/carbon/human/consistent/target = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade = right_blade(user) + user.swap_hand(user.get_held_index_of_item(blade)) + user.set_combat_mode(TRUE) + // The unfold still hides the blade; that wait is over in play. + blade.show_inhand() + + blade.melee_attack_chain(user, target) + var/obj/effect/abstract/cyberware_anim/swing = blade.mantis_swing() + TEST_ASSERT(swing && (swing in user.vis_contents), "A hit didn't swing the blade") + TEST_ASSERT_EQUAL(swing.icon_state, "mantis_swing_right", "The right hand swung the wrong picture") + TEST_ASSERT(blade.inhand_hidden_until > world.time, "The held blade draws under its own swing") + // The slash over the target goes up with the swing, so the client plays both from the same moment. + var/obj/effect/abstract/cyberware_anim/slash = blade.swing_impact_ref?.resolve() + TEST_ASSERT(slash && (slash in target.vis_contents), "The swing put no slash over its target") + + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/right = housings(user)[1] + right.Retract() + TEST_ASSERT(QDELETED(swing), "Putting the blade away left its swing playing") + + // Facing south the two hands cut toward each other, so their slashes are mirror images. + TEST_ASSERT(mantis_swing_impact_mirrored(SOUTH, "right") != mantis_swing_impact_mirrored(SOUTH, "left"), "Facing south both hands' swings show the same slash") + // The swing's say goes over the side the target is on (east of the user here, which draws it plain). + var/obj/effect/abstract/cyberware_anim/impact = cyberware_play_impact(user, target, "impact_mantis", TRUE) + TEST_ASSERT(impact, "No impact was drawn on the target") + var/matrix/turned = impact.transform + TEST_ASSERT(turned.a < 0, "An impact told to mirror was drawn plain") + +/// The name of the mask on a far arm's picture (CHROME_ANIM_ARM_COVER_FILTER, cyberware_anim.dm). +#define MANTIS_TEST_SWING_COVER "chrome_arm_cover" + +/// Whether [under] is drawn under [over] on [body]: pictures in vis_contents draw in the order they went in. +/datum/unit_test/voidcrew_mantis_gore/proc/drawn_under(mob/living/body, atom/movable/under, atom/movable/over) + var/list/order = list() + for(var/atom/movable/picture as anything in body.vis_contents) + order += picture + var/low = order.Find(under) + var/high = order.Find(over) + return low && high && low < high + +/// [body]'s other held Mantis blade, not [blade]. +/datum/unit_test/voidcrew_mantis_gore/proc/other_blade(mob/living/carbon/body, obj/item/blade) + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/held in body.held_items) + if(held != blade) + return held + +/// Side on, the far arm swings behind the near one: what the near hand holds is cut out of the far swing while +/// it is drawn in the hand, and not while the near blade swings itself, nor once the bearer turns around. +/datum/unit_test/voidcrew_mantis_gore/swing_far + +/datum/unit_test/voidcrew_mantis_gore/swing_far/Run() + var/mob/living/carbon/human/user = bearer(spot(0, 0)) + var/mob/living/carbon/human/consistent/target = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + ADD_TRAIT(target, TRAIT_GODMODE, TRAIT_SOURCE_UNIT_TESTS) + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/near = right_blade(user) + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/far = other_blade(user, near) + TEST_ASSERT(far, "Fixture: the bearer holds one blade") + near.show_inhand() + far.show_inhand() + user.set_combat_mode(TRUE) + user.setDir(EAST) + + user.swap_hand(user.get_held_index_of_item(far)) + far.melee_attack_chain(user, target) + var/obj/effect/abstract/cyberware_anim/mantis_swing/far_swing = far.mantis_swing() + TEST_ASSERT(far_swing, "The far hand didn't swing") + TEST_ASSERT(far_swing.get_filter(MANTIS_TEST_SWING_COVER), "The far arm's swing draws over the near blade") + + // The near blade swings too: it leaves the hand, and its own swing is drawn in front. + user.swap_hand(user.get_held_index_of_item(near)) + near.melee_attack_chain(user, target) + var/obj/effect/abstract/cyberware_anim/mantis_swing/near_swing = near.mantis_swing() + TEST_ASSERT(near_swing, "The near hand didn't swing") + TEST_ASSERT(!near_swing.get_filter(MANTIS_TEST_SWING_COVER), "Something is cut out of the near arm's swing") + TEST_ASSERT(drawn_under(user, far_swing, near_swing), "The near arm's swing is under the far arm's") + TEST_ASSERT(!far_swing.get_filter(MANTIS_TEST_SWING_COVER), "The far swing is still cut around a blade that left the hand") + + // Back in the hand, it is cut out again. + near.show_inhand() + far_swing.fit_to_facing() + TEST_ASSERT(far_swing.get_filter(MANTIS_TEST_SWING_COVER), "The near blade came back and the far swing draws over it") + + // Facing west the left hand is the near one. + user.setDir(WEST) + TEST_ASSERT(!far_swing.get_filter(MANTIS_TEST_SWING_COVER), "Turning around kept the left swing cut") + TEST_ASSERT(drawn_under(user, near_swing, far_swing), "Turning around kept the left swing under the right") + +/// Side on, the far blade unfolds and folds behind the near one, as it swings behind it: the near blade is cut out +/// of the far arm's picture, which goes under the near arm's. +/datum/unit_test/voidcrew_mantis_gore/unfold_far + +/datum/unit_test/voidcrew_mantis_gore/unfold_far/Run() + var/mob/living/carbon/human/user = bearer(spot(0, 0), out = FALSE) + user.setDir(EAST) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/right = housings(user)[1] + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/left = housings(user)[2] + + // Facing east the right arm is the near one. Its blade is out and drawn in the hand. + right.Extend(right.contents[1]) + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/near = right.active_item + near.show_inhand() + var/obj/effect/abstract/cyberware_anim/near_unfold = right.blade_anim() + TEST_ASSERT(near_unfold, "Fixture: the near blade's unfold never played") + TEST_ASSERT(!near_unfold.get_filter(MANTIS_TEST_SWING_COVER), "Something is cut out of the near arm's unfold") + + left.Extend(left.contents[1]) + var/obj/effect/abstract/cyberware_anim/far_unfold = left.blade_anim() + TEST_ASSERT(far_unfold, "Fixture: the far blade's unfold never played") + TEST_ASSERT(far_unfold.get_filter(MANTIS_TEST_SWING_COVER), "The far blade unfolds over the near blade") + TEST_ASSERT(drawn_under(user, far_unfold, near_unfold), "The far blade's unfold isn't under the near blade's") + + // And back in: the far blade folds behind the near one. + left.Retract() + var/obj/effect/abstract/cyberware_anim/far_fold = left.blade_anim() + TEST_ASSERT(far_fold, "Fixture: the far blade's fold never played") + TEST_ASSERT(far_fold.get_filter(MANTIS_TEST_SWING_COVER), "The far blade folds over the near blade") + + // Turned around, the left arm is the near one: nothing is cut out of its pictures. + left.Extend(left.contents[1]) + user.setDir(WEST) + var/obj/effect/abstract/cyberware_anim/left_unfold = left.blade_anim() + TEST_ASSERT(left_unfold && !left_unfold.get_filter(MANTIS_TEST_SWING_COVER), "The near blade's unfold is cut around the far blade") + +/// Only the blade that hit takes the blood: a hit or a kill with one blade leaves the other clean. The X-slash +/// cuts with both, so both run red. +/datum/unit_test/voidcrew_mantis_gore/swing_blood + +/datum/unit_test/voidcrew_mantis_gore/swing_blood/Run() + var/mob/living/carbon/human/user = bearer(spot(0, 0)) + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade = right_blade(user) + var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/other = other_blade(user, blade) + TEST_ASSERT(other, "Fixture: the bearer holds one blade") + blade.show_inhand() + user.set_combat_mode(TRUE) + user.swap_hand(user.get_held_index_of_item(blade)) + + // Ordinary hits, on two people in turn so none is an X-slash: any blood is on the blade that swung. + var/mob/living/carbon/human/consistent/first = allocate(/mob/living/carbon/human/consistent, spot(1, 0)) + var/mob/living/carbon/human/consistent/second = allocate(/mob/living/carbon/human/consistent, spot(0, 1)) + for(var/i in 1 to 6) + blade.melee_attack_chain(user, i % 2 ? first : second) + TEST_ASSERT(!other.is_bloody(), "A hit with one blade bloodied the other") + + // A kill: only the blade that made it runs red. + var/mob/living/carbon/human/consistent/killed = allocate(/mob/living/carbon/human/consistent, spot(1, 1)) + killed.adjustOxyLoss(185) + cut(blade, user, killed, BODY_ZONE_CHEST, 30) + TEST_ASSERT_EQUAL(killed.stat, DEAD, "Fixture: the cut didn't kill (health [killed.health])") + TEST_ASSERT(blade.drenched_until > world.time, "The killing blade didn't run red") + TEST_ASSERT(!other.is_bloody() && !other.drenched_until, "A kill with one blade bloodied the other") + + // The X-slash lands at once with no swing playing; both blades cut, both run red. + qdel(blade.mantis_swing()) + var/mob/living/carbon/human/consistent/crossed = allocate(/mob/living/carbon/human/consistent, spot(2, 0)) + for(var/i in 1 to 3) + cut(blade, user, crossed, BODY_ZONE_CHEST) + TEST_ASSERT(crossed.has_status_effect(/datum/status_effect/staggered), "Fixture: the third cut was no X-slash") + TEST_ASSERT(other.drenched_until > world.time, "The X-slash left the other blade clean") + // The cross is two strokes on the target, one the mirror of the other, both set on the part cut. + var/list/strokes = list() + for(var/obj/effect/abstract/cyberware_anim/picture in crossed.vis_contents) + if(picture.icon_state == "xslash_mantis") + strokes += picture + TEST_ASSERT_EQUAL(length(strokes), 2, "The X-slash didn't draw its two strokes") + var/obj/effect/abstract/cyberware_anim/one = strokes[1] + var/obj/effect/abstract/cyberware_anim/two = strokes[2] + var/matrix/one_way = one.transform + var/matrix/other_way = two.transform + TEST_ASSERT_EQUAL(one_way.a, -other_way.a, "The two strokes run the same way") + TEST_ASSERT(one.pixel_w == two.pixel_w && one.pixel_z == two.pixel_z, "The two strokes don't cross on the same point") + var/list/chest = mantis_part_point(crossed, BODY_ZONE_CHEST) + TEST_ASSERT(one.pixel_w == -16 + chest[1] && one.pixel_z == -16 + chest[2], "The cross isn't on the part cut") + +#undef MANTIS_TEST_SWING_COVER diff --git a/wiki/content/cyberware.md b/wiki/content/cyberware.md index 7943f2f77ab..a6838a6896a 100644 --- a/wiki/content/cyberware.md +++ b/wiki/content/cyberware.md @@ -77,7 +77,7 @@ Prices are the same at both counters, stock is limited per round, and load is th | Popup Ronin housing | *loot only* | 5 | Deployable full-auto machine pistol in 10x24mm caseless. Reloads are sold at the parlor or printed with Experimental Ammunition | | Rigger socket | 3 | 4 | Jack into your own ship's helm from anywhere aboard and fly it from a corridor | | Slabskin plate | 3 | 6 | Heavy built-in armor in every damage type. Solid hits visibly spark off you. Everyone can see you are plated | -| Mantis Blades (pair) | 4 | 3/arm | Deployable hardlight blades, plus a five-tile lunge that knocks the target down | +| Mantis Blades (pair) | 4 | 3/arm | Deployable hardlight blades, plus a five-tile lunge that knocks the target down. Press and hold the lunge on a target to crouch, and let go to spring up to seven tiles; a solid hit or a stun while you crouch wastes it. A kill brings the lunge back almost at once. Three quick cuts to one limb open its artery, a two-blade lunge skewers someone already hurt, every third cut with both blades out crosses them and staggers, and a swing at the head of someone dying takes it off | | Bunker Buster housing | *loot only* | 5 | Two shaped micro-rockets: 60 damage, no splash, will never breach a hull. Reloads are sold at the parlor or printed with Experimental Ammunition | | Ghostskin weave | 4 | 5 | Ten seconds of optical camo. NPCs will not target you, and Chrome Reads scatter. Attacking, throwing, taking a hit or a shock, or an EMP drops it | | Lazarus node | 4 | 5 | The moment you drop into crit, it charges for a second and shocks you back to your feet at 30% health. Once per six minutes | @@ -98,14 +98,14 @@ Six of the big pieces come in cheaper models from other makers. Each takes the s | Piece | Price | Load | What it does | |---|---|---|---| | Flickerskin weave | 2,400 cr | 2 | Seven seconds of patchy camo. It fools people, but NPCs still see you and Chrome Reads still land | -| Shiv Blades (pair) | 2,400 cr | 2/arm | Deployable hardlight blades, duller than the Mantis, with no lunge | +| Shiv Blades (pair) | 2,400 cr | 2/arm | Deployable hardlight blades, duller than the Mantis, with no lunge and none of its tricks. They still bleed people | | Governor Patch | 2,500 cr | 0 | +5 capacity. Occupies the chest OS slot | | Hothead core | 3,000 cr | 4 | Eight seconds of 20% less brute and burn and +3 unarmed damage, then the crash. No stun immunity and no roar | | Spliced reflex rig | 3,600 cr | 6 | Six seconds of quicker movement, melee cooldowns cut by a quarter and 30% dodge against blows, or against projectiles while moving, and harder-hitting strikes, then a long crash | | Governor Bypass | 3 vouchers | 0 | +10 capacity. Occupies the chest OS slot | | Service reflex lattice | 4 vouchers | 9 | Seven seconds of quicker movement, melee cooldowns cut by 40% and 45% dodge against blows, or against projectiles while moving, and harder-hitting strikes, then the crash | | Vanguard core | 4 vouchers | 8 | Ten seconds of stun immunity, 30% less brute and burn and +5 unarmed damage, opened by a roar that staggers people nearby, then the crash | -| Scorch Blades (pair) | 4 vouchers | 4/arm | Mantis Blades that set whoever they cut on fire. The lunge lights them harder | +| Scorch Blades (pair) | 4 vouchers | 4/arm | Mantis Blades that set whoever they cut on fire. The lunge lights them harder, and the heat half-seals the arteries they open | | Widowline Arc | 5 vouchers | 6 | A Widowline that shocks on every hit, cuts robots and mechs much harder, and briefly knocks out turrets, consoles and cameras it strikes | The **ammunition shelf** is the return-visit hook: Ronin magazines at 250 credits and Buster rocket pairs at 300, both at 4 [reputation](zone-reputation.md). Both ripperdocs buy back any *removed* chrome that sells for credits, even pieces they sold you, at half list price. Chrome paid for in vouchers is never bought back. From 93df2d02db81d48e7209c928c1967f126a5e8f88 Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Sun, 15 Nov 2026 18:07:32 -0800 Subject: [PATCH 13/29] More immersive missions - Big Game Hunt: staking the lure leaves an anchored rig that thumps; the beast and its pack appear out of sight and charge it. A fresh lure is sent if the planet unloads mid-hunt. - Rescue survivors hide in a locker or a sheltered corner, call for help on the contract ship's radio, react to rescuers and hostiles, and leave in a transporter beam. - Mission objectives never spawn where a player can see them, and planet spawns and wave arrivals skip lava, water and chasms. The mission pad flashes for every kit it delivers and every item it takes in. - Field Expedition, recovery, extraction and survey sites are dressed so they can be found by eye. The dressing is scenery only. - Prospect Stake names a planet; the claim beacon deploys on open ground there and its clock runs only while a crew member is near it and awake. - Exploration contracts hold position for a 30-second sensor sweep that can chart a nearby derelict. - Hot Extraction cargo needs a wrench to unbolt, and the Drug Run replacement ingredient grows near the original cache. --- tgstation.dme | 3 + voidcrew/modules/drug_smuggling/mission.dm | 29 +- voidcrew/modules/loot/zone_mobs.dm | 3 + voidcrew/modules/missions/_missions.dm | 4 + voidcrew/modules/missions/mission_pad.dm | 15 + voidcrew/modules/missions/mission_target.dm | 16 +- .../missions/missions/big_game_hunt.dm | 393 +++++- .../modules/missions/missions/exploration.dm | 279 ++++- .../missions/missions/field_expedition.dm | 4 +- .../modules/missions/missions/live_capture.dm | 1 + .../missions/missions/prospect_stake.dm | 181 ++- .../missions/missions/recovery_variants.dm | 21 +- voidcrew/modules/missions/missions/rescue.dm | 123 +- .../missions/missions/rescue_survivor.dm | 1092 +++++++++++++++++ .../modules/missions/objectives/site_ops.dm | 153 ++- voidcrew/modules/missions/site_dressing.dm | 375 ++++++ voidcrew/modules/missions/spawn_cover.dm | 103 ++ .../code/modules/overmap/space_ruin.dm | 12 +- voidcrew/modules/unit_tests/_unit_tests.dm | 2 + .../unit_tests/voidcrew_exploration_sweep.dm | 119 ++ .../voidcrew_mission_spawn_cover.dm | 52 + .../modules/unit_tests/voidcrew_missions.dm | 51 +- wiki/content/missions.md | 8 +- 23 files changed, 2786 insertions(+), 253 deletions(-) create mode 100644 voidcrew/modules/missions/missions/rescue_survivor.dm create mode 100644 voidcrew/modules/missions/site_dressing.dm create mode 100644 voidcrew/modules/missions/spawn_cover.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_exploration_sweep.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_mission_spawn_cover.dm diff --git a/tgstation.dme b/tgstation.dme index 3bd26b981b8..d36073d3a82 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -7364,6 +7364,8 @@ #include "voidcrew\modules\missions\mission_pad.dm" #include "voidcrew\modules\missions\mission_target.dm" #include "voidcrew\modules\missions\player_bounty.dm" +#include "voidcrew\modules\missions\site_dressing.dm" +#include "voidcrew\modules\missions\spawn_cover.dm" #include "voidcrew\modules\missions\code\controllers\subsystem\missions.dm" #include "voidcrew\modules\missions\missions\big_game_hunt.dm" #include "voidcrew\modules\missions\missions\delivery.dm" @@ -7376,6 +7378,7 @@ #include "voidcrew\modules\missions\missions\recovery.dm" #include "voidcrew\modules\missions\missions\recovery_variants.dm" #include "voidcrew\modules\missions\missions\rescue.dm" +#include "voidcrew\modules\missions\missions\rescue_survivor.dm" #include "voidcrew\modules\missions\missions\research.dm" #include "voidcrew\modules\missions\missions\suppression.dm" #include "voidcrew\modules\missions\missions\survey.dm" diff --git a/voidcrew/modules/drug_smuggling/mission.dm b/voidcrew/modules/drug_smuggling/mission.dm index 7255eb52cae..108fe1f2349 100644 --- a/voidcrew/modules/drug_smuggling/mission.dm +++ b/voidcrew/modules/drug_smuggling/mission.dm @@ -292,6 +292,7 @@ fail("No mission pad to deliver the formula chip to.") return formula = new(chip_turf) + mission_pad_delivery_effect(chip_turf) formula.recipe = recipe servant?.ship_notify("Formula chip for '[recipe.street_name]' delivered to your mission pad. Examine it for the shopping list.", "DRUG RUN", SHIP_NOTIFY_NOTICE, 'voidcrew/sound/notify.ogg', 50) @@ -433,6 +434,8 @@ fail("Nowhere to deliver the finished batch, contract void.") return var/obj/item/mission_recovery/drug_product/product = new(product_turf) + if(!preferred_turf) + mission_pad_delivery_effect(product_turf) // the pad fallback: it arrives like any other delivery product.configure(recipe, purity_tier) bind_item(product) register_quest_atom(product) @@ -496,6 +499,10 @@ var/respawns_left = 1 /// Guard so notify_when_loaded() is never double-registered var/awaiting_load = FALSE + /// Where the current harvest scene was laid; a replacement grows near it + var/turf/scene_anchor + /// How far from the cache a replacement specimen may grow + var/regrow_radius = 6 /datum/ingredient_site/New(datum/mission/drug_run/mission, list/entry) ..() @@ -508,6 +515,7 @@ release_item(delete_uncollected = TRUE) QDEL_NULL(site_target) mission = null + scene_anchor = null return ..() /** @@ -554,6 +562,7 @@ site_target?.notify_when_loaded() return spawned = TRUE + scene_anchor = scene_turf new /obj/structure/ingredient_cache(scene_turf) var/obj/item/drug_ingredient/ingredient = new ingredient_type(get_nearby_open_turf(scene_turf)) watch_item(ingredient) @@ -608,7 +617,7 @@ site_target.notify_when_loaded() return if(respawns_left > 0) - var/turf/retry_turf = site_target.get_spawn_turf() + var/turf/retry_turf = find_regrowth_turf() if(retry_turf) respawns_left-- var/obj/item/drug_ingredient/replacement = new ingredient_type(retry_turf) @@ -639,6 +648,24 @@ if(mission.active) mission.push_site_waypoint(src) +/** + * Where a replacement specimen grows: clear ground a few tiles from the cache, + * out of the crew's sight when there is any. Falls back to the whole site when + * the camp has no room (or the anchor isn't on this site any more). + */ +/datum/ingredient_site/proc/find_regrowth_turf() + if(scene_anchor && site_target.contains_turf(scene_anchor)) + var/list/nearby = list() + for(var/turf/open/tile in RANGE_TURFS(regrow_radius, scene_anchor)) + if(isgroundlessturf(tile) || tile.is_blocked_turf(exclude_mobs = TRUE)) + continue + if(istype(get_area(tile), /area/shuttle) || !site_target.contains_turf(tile)) + continue + nearby += tile + if(length(nearby)) + return pick_unwatched_turf(nearby) + return site_target.get_spawn_turf() + /// Stops watching the live field ingredient; optionally removes it outright /datum/ingredient_site/proc/release_item(delete_uncollected = FALSE) var/obj/item/drug_ingredient/ingredient = item_ref?.resolve() diff --git a/voidcrew/modules/loot/zone_mobs.dm b/voidcrew/modules/loot/zone_mobs.dm index bc2b62e4edc..2be63404698 100644 --- a/voidcrew/modules/loot/zone_mobs.dm +++ b/voidcrew/modules/loot/zone_mobs.dm @@ -134,5 +134,8 @@ // A wave never lands a pod or digs up under someone's feet if(tile.is_blocked_turf(exclude_mobs = !wave)) continue + // Nor drops one into lava, water or a pit + if(wave && (islava(tile) || ischasm(tile) || istype(tile, /turf/open/water))) + continue result += tile return result diff --git a/voidcrew/modules/missions/_missions.dm b/voidcrew/modules/missions/_missions.dm index a1108c51fd5..a8afff5c9f5 100644 --- a/voidcrew/modules/missions/_missions.dm +++ b/voidcrew/modules/missions/_missions.dm @@ -952,6 +952,8 @@ GLOBAL_VAR_INIT(mission_work_serial, 0) var/result = objective.accept_item(turned_in_item, reward_anchor) if(result == MISSION_ITEM_REFUSED) return FALSE + // The pad took something: every hand-over gets the effect, counted ones included + flash_reward_anchor(reward_anchor) if(result == MISSION_ITEM_PROGRESS) return TRUE // partial hand-over; mission continues if(!all_objectives_satisfied()) @@ -1222,6 +1224,8 @@ GLOBAL_VAR_INIT(mission_work_serial, 0) if(completed && !failed && guarded_prize_family && !guarded_prize_rolled) guarded_prize_rolled = TRUE guarded_prize = servant.award_guarded_prize(guarded_prize_family, quote_zone, reward_anchor, type) + if(guarded_prize) + flash_reward_anchor(reward_anchor) /** * Turn-in visual: pads get their teleport effect, other anchors stay quiet diff --git a/voidcrew/modules/missions/mission_pad.dm b/voidcrew/modules/missions/mission_pad.dm index f52ef602e19..d2ef0583733 100644 --- a/voidcrew/modules/missions/mission_pad.dm +++ b/voidcrew/modules/missions/mission_pad.dm @@ -23,6 +23,8 @@ var/datum/pirate_negotiation/tribute_negotiation /// The ship this pad is installed on var/obj/structure/overmap/ship/linked_ship + /// world.time of the last teleport effect, so several things moving through in one tick make one flash + var/last_teleport_effect = -1 /obj/machinery/mission_pad/Initialize(mapload) . = ..() @@ -160,6 +162,11 @@ * Called when items are teleported in (rewards) or out (turn-ins). */ /obj/machinery/mission_pad/proc/do_teleport_effect() + // A turn-in and its payout land in the same tick: one flash, one sound + if(last_teleport_effect == world.time) + return + last_teleport_effect = world.time + // Visual effect flick("lpad-idle", src) @@ -171,6 +178,14 @@ // Sound effect playsound(src, 'sound/effects/magic/teleport_diss.ogg', 50, TRUE) +/** + * Plays the pad effect for something a mission has just put on a pad's tile + * (kits, chips, finished batches). Does nothing where no pad stands there. + */ +/proc/mission_pad_delivery_effect(turf/where) + var/obj/machinery/mission_pad/pad = locate() in where + pad?.do_teleport_effect() + /** * Handle items entering the pad's turf (via signal from connect_loc element). * If we're linked to a tribute negotiation, check if the item is valid tribute. diff --git a/voidcrew/modules/missions/mission_target.dm b/voidcrew/modules/missions/mission_target.dm index 00f7d84bc2c..7fb44cf6f05 100644 --- a/voidcrew/modules/missions/mission_target.dm +++ b/voidcrew/modules/missions/mission_target.dm @@ -62,7 +62,8 @@ /datum/mission_target/proc/notify_when_loaded() return -/// A random open turf inside the loaded interior for objective spawns +/// A random open turf inside the loaded interior for objective spawns, out of +/// every living player's sight when there is one (see spawn_cover.dm) /datum/mission_target/proc/get_spawn_turf() return null @@ -222,7 +223,7 @@ mission?.on_target_interior_loaded() /datum/mission_target/space_ruin/get_spawn_turf() - return ruin?.get_random_interior_turf() || ruin?.ruin_bottom_left + return ruin?.get_random_interior_turf(unwatched = TRUE) || ruin?.ruin_bottom_left /datum/mission_target/space_ruin/contains_turf(turf/T) if(!ruin || !T) @@ -405,16 +406,23 @@ min_y = max(min_y, above_docks) if(min_x > max_x || min_y > max_y) return null + // A crew already on the surface must not watch the objective appear. Every + // sample that passes is kept as a fallback, farthest from them wins. + var/datum/spawn_cover/cover = new(site_z) for(var/_ in 1 to 40) var/turf/candidate = locate(rand(min_x, max_x), rand(min_y, max_y), site_z) if(!candidate || !isopenturf(candidate) || isspaceturf(candidate)) continue + // Lava burns the objective and a chasm swallows it before anyone arrives + if(islava(candidate) || ischasm(candidate)) + continue if(istype(get_area(candidate), /area/shuttle)) continue if(candidate.is_blocked_turf(exclude_mobs = TRUE)) continue - return candidate - return null + if(cover.is_hidden(candidate)) + return candidate + return cover.fallback /** * "Is the player at the site" - the primitive the pylon scatter and the hunting diff --git a/voidcrew/modules/missions/missions/big_game_hunt.dm b/voidcrew/modules/missions/missions/big_game_hunt.dm index ce3d5d7a760..511c4d39225 100644 --- a/voidcrew/modules/missions/missions/big_game_hunt.dm +++ b/voidcrew/modules/missions/missions/big_game_hunt.dm @@ -16,10 +16,32 @@ * the trophy after that. Losing any of them voids the contract (FAIL policy, * with exactly one planet of each type per round, a filtered retarget has * nowhere to go, and set_lure's one kit can't re-arm a fresh site anyway). + * + * The staked lure stays behind as an anchored rig that thumps and stinks of + * chum. It is scenery, not a quest atom. The beast does not appear beside it: + * a roar rolls in from one side, then after a short wait the beast and its + * entourage come into being out of every player's sight, a good way off, and + * walk in on the stake (AI planning subtree at the bottom of this file). The + * rig is trampled when the beast reaches it, or goes quiet when it dies. */ /// How long staking the hunting lure takes #define LURE_STAKE_TIME (8 SECONDS) +/// Wait between the lure going in and its quarry setting out (the walk in comes on top) +#define LURE_ARRIVAL_MIN (9 SECONDS) +#define LURE_ARRIVAL_MAX (16 SECONDS) +/// How far from the stake the quarry starts out, in tiles. An AI drops a movement +/// goal more than 14 tiles away, so the far edge stays under that. +#define LURE_APPROACH_MIN 10 +#define LURE_APPROACH_MAX 13 +/// Nearest a player may stand to a starting tile. A screen reaches 7 tiles each way. +#define LURE_UNSEEN_RANGE 9 +/// How long an animal keeps heading for the lure before it goes back to its own business +#define LURE_CHARGE_TIME (45 SECONDS) +/// The rumble before a beast climbs out of the ground (matches zone_mobs_arrival.dm) +#define LURE_EMERGE_TIME (2.5 SECONDS) +/// Blackboard key: world.time after which a lured animal stops heading for the lure +#define BB_LURE_CHARGE_EXPIRES "BB_lure_charge_expires" /datum/mission/big_game_hunt name = "Big Game Hunt" @@ -208,8 +230,8 @@ * A lure kit is dispensed at the servant's mission pad on accept (the * prospect-stake kit pattern) and tracked as the quest atom, burn the lure, * void the hunt. Staking it in open ground on the target planet records the - * stake position for the kill step and completes; the beast's spawn devours - * the kit. Assumes the FAIL loss policy: the one kit can't re-arm after a + * stake position for the kill step, stands the rig on that spot and + * completes. Assumes the FAIL loss policy: the one kit can't re-arm after a * retarget reset. */ /datum/mission_objective/set_lure @@ -217,12 +239,21 @@ var/obj/item/hunting_lure/kit /// The kill step this lure feeds its stake position to var/datum/mission_objective/field/kill_named/big_game/hunt_objective + /// The kit went into the ground; a rewind (the site unloaded) needs a fresh one + var/kit_spent = FALSE /datum/mission_objective/set_lure/Destroy() kit = null // the item survives; it self-reports expiry on use hunt_objective = null return ..() +/// Back on this step after the site unloaded with the beast in it: send a new lure +/datum/mission_objective/set_lure/activate() + . = ..() + if(kit_spent && QDELETED(kit)) + kit_spent = FALSE + dispense_kit() + /// Called by the mission at start: hand the lure over at the ship's pad /datum/mission_objective/set_lure/proc/dispense_kit() var/obj/structure/overmap/ship/ship = get_servant() @@ -235,6 +266,7 @@ mission.fail("No mission pad to dispense the hunting lure to.") return FALSE kit = new(kit_turf) + mission_pad_delivery_effect(kit_turf) kit.objective_ref = WEAKREF(src) // Losing the lure voids the hunt (and points the GPS chain at it meanwhile) mission.register_quest_atom(kit) @@ -245,13 +277,14 @@ /datum/mission_objective/set_lure/proc/on_planted(mob/living/user, turf/where) if(completed || !active || !where || !mission || mission.failed || mission.completed) return - if(hunt_objective) - hunt_objective.lure_turf = where + // The rig goes into the ground here and the kill step takes it from there + hunt_objective?.plant_lure(where) // The staked lure stops being the tracked objective; the beast that - // answers takes over the slot as soon as complete() advances the chain + // answers takes over the slot once it has been called in mission.forget_quest_atom(kit) QDEL_NULL(kit) - notify_crew("Lure staked. Something big is moving toward it - stand ready.", type = SHIP_NOTIFY_WARNING, sound = 'voidcrew/sound/notify2.ogg') + kit_spent = TRUE + notify_crew("Lure staked.", type = SHIP_NOTIFY_WARNING, sound = 'voidcrew/sound/notify2.ogg') complete() /datum/mission_objective/set_lure/get_progress_string() @@ -266,36 +299,231 @@ /** * kill_named pointed at the lure instead of a random stretch of surface: the - * beast (a trophy-grade specimen of the planet's apex fauna) breaks cover - * next to the stake the moment the lure objective completes, with its - * entourage of lesser fauna. Death drops the mission-bound trophy. + * beast (a trophy-grade specimen of the planet's apex fauna) answers the + * stake with its entourage of lesser fauna. It is called in after a roar and a + * short wait, starts well out of sight and heads for the stake; a site too + * cramped to hide an approach gets the beast climbing out of the ground next + * to it instead. Death drops the mission-bound trophy. */ /datum/mission_objective/field/kill_named/big_game proof_type = /obj/item/mission_recovery/trophy - /// Where the lure was staked; the beast breaks cover next to it + /// Where the lure was staked; the beast comes for it var/turf/lure_turf + /// The rig standing on lure_turf (weak: it goes with the site) + var/datum/weakref/lure_stake_ref + /// Pending arrival timer: the wait before the quarry sets out, or the rumble before it digs out + var/arrival_timer + /// Whether the beast has been called but is not out yet + var/arrival_pending = FALSE + /// Where the first roar came from; the quarry comes in from the same side + var/turf/approach_hint /// The trophy the beast drops ("tendril-crowned skull"), set by the mission var/trophy_part = "trophy" /// Trophy-grade specimen: raise maxHealth/health to this on spawn (0 = leave alone). /// A plain var-level scale-up, no new buff system. var/health_override = 0 +/datum/mission_objective/field/kill_named/big_game/Destroy() + cancel_arrival() + // Never leave the rig behind for a contract that no longer exists + var/obj/structure/hunting_lure_stake/stake = lure_stake_ref?.resolve() + stake?.topple() + lure_stake_ref = null + approach_hint = null + lure_turf = null + return ..() + +/datum/mission_objective/field/kill_named/big_game/deactivate() + // Completed, failed or rewound: nothing is on its way and the rig goes quiet + cancel_arrival() + var/obj/structure/hunting_lure_stake/stake = lure_stake_ref?.resolve() + stake?.topple() + lure_stake_ref = null + return ..() + /datum/mission_objective/field/kill_named/big_game/reset() . = ..() lure_turf = null - -/// The beast answers the lure, not a random spawn point + approach_hint = null + +/// Stops a call that is still waiting to be answered +/datum/mission_objective/field/kill_named/big_game/proc/cancel_arrival() + if(arrival_timer) + deltimer(arrival_timer) + arrival_timer = null + arrival_pending = FALSE + +/// The kit went into the ground: remember the spot and stand the rig on it +/datum/mission_objective/field/kill_named/big_game/proc/plant_lure(turf/where) + lure_turf = where + var/obj/structure/hunting_lure_stake/stake = new(where) + lure_stake_ref = WEAKREF(stake) + +/// The beast answers the lure, not a random spawn point, and not at once /datum/mission_objective/field/kill_named/big_game/do_field_spawn() if(spawned) return if(!lure_turf) return ..() spawned = TRUE - spawn_field_objects(get_nearby_open_turf(lure_turf, 4)) + arrival_pending = TRUE + // First sign of it: a roar from the side it will come in on (or from the + // ground itself where there is no hiding place) + var/list/approaches = approach_turfs() + approach_hint = length(approaches) ? pick(approaches) : null + var/turf/roar_from = approach_hint || lure_turf + playsound(roar_from, 'sound/mobs/non-humanoids/space_dragon/space_dragon_roar.ogg', 40, TRUE, extrarange = 20) + for(var/mob/living/hearer in GLOB.player_list) + if(hearer.z == lure_turf.z && get_dist(hearer, lure_turf) <= 14 && hearer.can_hear()) + to_chat(hearer, span_boldwarning("Something huge bellows in the distance.")) + arrival_timer = addtimer(CALLBACK(src, PROC_REF(answer_lure)), rand(LURE_ARRIVAL_MIN, LURE_ARRIVAL_MAX), TIMER_STOPPABLE | TIMER_DELETE_ME) + +/// The wait is over: the beast and its entourage set out for the stake +/datum/mission_objective/field/kill_named/big_game/proc/answer_lure() + arrival_timer = null + if(!arrival_still_wanted()) + return + var/datum/mission_target/site = mission.target + if(!lure_turf || !site?.is_valid() || !site.is_interior_loaded() || !site.contains_turf(lure_turf)) + // The hunting ground went away during the wait; arm again the ordinary way + cancel_arrival() + spawned = FALSE + lure_turf = null + arm() + return + var/list/approaches = approach_turfs() + if(!length(approaches)) + dig_out() + return + arrival_pending = FALSE + // Start on the side the roar came from where there is room, and where a + // straight run at the stake looks open + var/list/same_side = list() + for(var/turf/candidate as anything in approaches) + if(approach_hint && get_dist(candidate, approach_hint) <= 6) + same_side += candidate + var/list/pool = length(same_side) ? same_side : approaches + var/turf/lead = pick(pool) + for(var/_ in 1 to 12) + var/turf/candidate = pick(pool) + if(approach_is_clear(candidate)) + lead = candidate + break + // The entourage trails in beside it, on tiles that are also out of sight + var/list/guard_spots = list() + for(var/_ in guard_types) + var/list/beside = list() + for(var/turf/candidate as anything in approaches) + if(get_dist(candidate, lead) <= 4) + beside += candidate + guard_spots += length(beside) ? pick(beside) : lead + spawn_field_objects(lead, guard_spots) + playsound(lead, 'sound/mobs/non-humanoids/space_dragon/space_dragon_roar.ogg', 50, TRUE, extrarange = 20) + +/// Whether a delayed arrival should still go ahead +/datum/mission_objective/field/kill_named/big_game/proc/arrival_still_wanted() + return active && !completed && mission && !mission.failed && !mission.completed && !mission.named_kill_completed && !target_mob -/datum/mission_objective/field/kill_named/big_game/spawn_field_objects(turf/spawn_turf) +/** + * Open ground a good way from the stake that nobody is close enough to see: + * the quarry's starting tiles. Empty where the site is too small, too crowded + * or too cluttered to hide an approach. + */ +/datum/mission_objective/field/kill_named/big_game/proc/approach_turfs() + . = list() + var/datum/mission_target/site = mission?.target + if(!lure_turf || !site) + return + var/list/watchers = list() + for(var/mob/living/player in GLOB.player_list) + var/turf/watcher_turf = get_turf(player) + if(watcher_turf?.z == lure_turf.z && player.stat != DEAD) + watchers += watcher_turf + for(var/turf/open/candidate in RANGE_TURFS(LURE_APPROACH_MAX, lure_turf)) + if(get_dist(candidate, lure_turf) < LURE_APPROACH_MIN) + continue + if(isspaceturf(candidate) || islava(candidate) || ischasm(candidate)) + continue + // Open planet ground only: no landed ship, no ruin, nothing past the site's edge + if(!istype(get_area(candidate), /area/overmap_encounter/planetoid) || !site.contains_turf(candidate)) + continue + // Not the docking strip: a ship coming in to land would crush whatever stands on it + if((candidate.turf_flags & NO_RUINS) || candidate.is_blocked_turf(exclude_mobs = TRUE)) + continue + var/seen = FALSE + for(var/turf/watcher_turf as anything in watchers) + if(get_dist(watcher_turf, candidate) < LURE_UNSEEN_RANGE) + seen = TRUE + break + if(!seen) + . += candidate + +/// Whether a straight run from the tile to the stake is open ground +/datum/mission_objective/field/kill_named/big_game/proc/approach_is_clear(turf/from) + for(var/turf/along as anything in get_line(from, lure_turf)) + if(!isopenturf(along) || islava(along) || ischasm(along) || along.is_blocked_turf(exclude_mobs = TRUE)) + return FALSE + return TRUE + +/** + * No hiding place for an approach: the ground shakes beside the lure and the + * pack climbs out of it, the same rumble the mission waves use. + */ +/datum/mission_objective/field/kill_named/big_game/proc/dig_out() + var/turf/lead = get_nearby_open_turf(lure_turf, 4) + var/list/guard_spots = list() + for(var/_ in guard_types) + guard_spots += get_nearby_open_turf(lure_turf, 4) + for(var/turf/spot as anything in list(lead) + guard_spots) + new /obj/effect/temp_visual/zone_mobs_emerge(spot) + playsound(lead, 'sound/effects/break_stone.ogg', 60, TRUE) + arrival_timer = addtimer(CALLBACK(src, PROC_REF(emerge_pack), lead, guard_spots), LURE_EMERGE_TIME, TIMER_STOPPABLE | TIMER_DELETE_ME) + +/datum/mission_objective/field/kill_named/big_game/proc/emerge_pack(turf/lead, list/guard_spots) + arrival_timer = null + arrival_pending = FALSE + if(!arrival_still_wanted()) + return + spawn_field_objects(lead, guard_spots, emerge = TRUE) + +/// The ground gives up a body: rubble underneath, then it rises out of the dirt +/datum/mission_objective/field/kill_named/big_game/proc/rise_from_ground(mob/living/body) + if(QDELETED(body)) + return + var/turf/where = get_turf(body) + if(where) + new /obj/effect/decal/cleanable/rubble(where) + playsound(where, 'sound/effects/shovel_dig.ogg', 60, TRUE) + // Parallel and relative so a mob's own idle animation (floating, bobbing) survives + var/final_alpha = body.alpha + body.alpha = 0 + body.pixel_z -= 16 + animate(body, pixel_z = 16, 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) + +/** + * Points a lured animal at the stake. It walks there whenever it has nothing + * of its own to hunt, so it goes for the first crew member it sees and + * otherwise comes straight in. + */ +/datum/mission_objective/field/kill_named/big_game/proc/send_to_lure(mob/living/body) + var/datum/ai_controller/brain = body?.ai_controller + if(QDELETED(body) || !istype(brain) || !lure_turf) + return + brain.set_blackboard_key(BB_TRAVEL_DESTINATION, lure_turf) + brain.set_blackboard_key(BB_LURE_CHARGE_EXPIRES, world.time + LURE_CHARGE_TIME) + var/list/subtrees = brain.planning_subtrees ? brain.planning_subtrees.Copy() : list() + subtrees += GLOB.ai_subtrees[/datum/ai_planning_subtree/travel_to_point/lure_charge] + brain.planning_subtrees = subtrees + // An animal this far from anyone would otherwise stand about until somebody wandered close + brain.can_idle = FALSE + brain.reset_ai_status() + +/datum/mission_objective/field/kill_named/big_game/spawn_field_objects(turf/spawn_turf, list/guard_spots, emerge = FALSE) if(mission.named_kill_completed) return ..() + // Anything that did not climb out of the ground has come a long way to get here + var/charging = !emerge && lure_turf var/mob/living/beast = spawn_field_npc(target_mob_type, spawn_turf, finalize = FALSE) beast.name = mission.objective_name beast.desc += " This one is old, scarred, and much too big. The guild wants it as a wall piece." @@ -307,11 +535,20 @@ // The entourage: lesser fauna drawn in by the blood on the wind. Killing // them pays nothing - the contract is the name on the trophy. for(var/guard_type in guard_types) - var/mob/living/guard = spawn_field_npc(guard_type, get_nearby_open_turf(spawn_turf), finalize = FALSE) + var/turf/guard_turf = length(guard_spots) ? pick_n_take(guard_spots) : get_nearby_open_turf(spawn_turf) + var/mob/living/guard = spawn_field_npc(guard_type, guard_turf, finalize = FALSE) guard.desc += " It followed something much bigger here." guard.npc_spawn_context.finalize() - beast.visible_message(span_boldwarning("[beast] comes crashing in and goes straight for the lure!")) - notify_crew("The lure's been taken. [mission.objective_name] is out in the open - good hunting.", type = SHIP_NOTIFY_WARNING, sound = 'voidcrew/sound/notify2.ogg') + if(charging) + send_to_lure(guard) + if(emerge) + rise_from_ground(guard) + if(charging) + send_to_lure(beast) + if(emerge) + rise_from_ground(beast) + var/obj/structure/hunting_lure_stake/stake = lure_stake_ref?.resolve() + stake?.watch(beast) /datum/mission_objective/field/kill_named/big_game/get_proof_name() return "[mission.objective_name]'s [trophy_part]" @@ -319,6 +556,8 @@ /datum/mission_objective/field/kill_named/big_game/get_progress_string() if(!spawned) return "Draw [mission?.objective_name || "the beast"] out with the lure" + if(arrival_pending) + return "[mission?.objective_name || "The beast"] is coming for the lure" return "Bring down [mission?.objective_name || "the beast"]" // ========================================================================= @@ -335,8 +574,8 @@ * # Hunting Lure * * The kit handed over at accept. Stake it in hand, in open ground on the - * contracted planet's surface; the staking channel is not subtle, and the - * thing it calls arrives immediately. + * contracted planet's surface. The staking channel is not subtle; what it + * calls takes a little while to get there. */ /obj/item/hunting_lure name = "apex hunting lure" @@ -376,6 +615,87 @@ objective.on_planted(user, get_turf(user)) return TRUE +/** + * # Staked Hunting Lure + * + * What the kit turns into once it is in the ground: an anchored rig that + * thumps and stinks of chum until the beast it called tramples it or dies. + * Scenery only: not a quest atom, not an item, nothing to salvage, and the hunt + * carries on whatever happens to it. + */ +/obj/structure/hunting_lure_stake + name = "hunting lure" + desc = "A guild lure rig staked into the dirt. It stinks of chum and thumps like a heartbeat." + icon = 'voidcrew/modules/missions/icons/recovery.dmi' + icon_state = "recovery_anchored" + anchored = TRUE + density = FALSE + move_resist = INFINITY + resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF + /// Weakref to the beast that was called here + var/datum/weakref/watched_ref + /// Whether it is already coming down + var/toppled = FALSE + /// Process ticks since the last thump + var/thump_ticks = 0 + +/obj/structure/hunting_lure_stake/Initialize(mapload) + . = ..() + START_PROCESSING(SSobj, src) + +/obj/structure/hunting_lure_stake/Destroy() + STOP_PROCESSING(SSobj, src) + unwatch() + return ..() + +/obj/structure/hunting_lure_stake/process(seconds_per_tick) + thump_ticks++ + if(thump_ticks < 2) + return + thump_ticks = 0 + playsound(src, 'sound/effects/singlebeat.ogg', 40, TRUE, extrarange = 6) + animate(src, pixel_y = 2, time = 1) + animate(pixel_y = 0, time = 2) + +/// The beast it called is out: trample the rig when it gets here, drop it if the beast dies first +/obj/structure/hunting_lure_stake/proc/watch(mob/living/beast) + if(toppled || QDELETED(beast)) + return + unwatch() + watched_ref = WEAKREF(beast) + RegisterSignal(beast, COMSIG_MOVABLE_MOVED, PROC_REF(on_beast_moved)) + RegisterSignal(beast, list(COMSIG_LIVING_DEATH, COMSIG_QDELETING), PROC_REF(on_beast_gone)) + +/obj/structure/hunting_lure_stake/proc/unwatch() + var/mob/living/beast = watched_ref?.resolve() + if(beast) + UnregisterSignal(beast, list(COMSIG_MOVABLE_MOVED, COMSIG_LIVING_DEATH, COMSIG_QDELETING)) + watched_ref = null + +/obj/structure/hunting_lure_stake/proc/on_beast_moved(mob/living/source, atom/old_loc, movement_dir, forced, list/old_locs) + SIGNAL_HANDLER + if(get_dist(source, src) <= 1) + topple(source) + +/obj/structure/hunting_lure_stake/proc/on_beast_gone(datum/source) + SIGNAL_HANDLER + topple() + +/// The rig comes down and goes quiet, trampled by the beast if it got here +/obj/structure/hunting_lure_stake/proc/topple(mob/living/by) + if(toppled) + return + toppled = TRUE + STOP_PROCESSING(SSobj, src) + unwatch() + if(by) + visible_message(span_danger("[by] tramples [src].")) + else + visible_message(span_warning("[src] topples over and goes quiet.")) + playsound(src, 'sound/effects/clang.ogg', 50, TRUE) + animate(src, transform = turn(transform, 80), pixel_y = -4, alpha = 0, time = 1 SECONDS, easing = QUAD_EASING | EASE_IN) + QDEL_IN(src, 1 SECONDS) + /** * # Hunting Trophy * @@ -388,4 +708,39 @@ icon_state = "recovery" w_class = WEIGHT_CLASS_BULKY +// ========================================================================= +// THE CHARGE, lured animals walk in on the stake +// ========================================================================= + +/** + * The last thing a lured animal plans. Everything it can hunt on its own comes + * first, so it goes for the first crew member it sees and otherwise heads for + * the stake. Gives up after LURE_CHARGE_TIME and goes back to its own business. + */ +/datum/ai_planning_subtree/travel_to_point/lure_charge + travel_behaviour = /datum/ai_behavior/travel_towards/lure_charge + +/datum/ai_planning_subtree/travel_to_point/lure_charge/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick) + if(controller.blackboard[location_key] && world.time > controller.blackboard[BB_LURE_CHARGE_EXPIRES]) + controller.clear_blackboard_key(location_key) + return + return ..() + +/// Close enough to the stake counts as there; the goal is dropped once it is reached +/datum/ai_behavior/travel_towards/lure_charge + required_distance = 2 + +/datum/ai_behavior/travel_towards/lure_charge/finish_action(datum/ai_controller/controller, succeeded, target_key) + . = ..() + if(succeeded) + controller.clear_blackboard_key(target_key) + #undef LURE_STAKE_TIME +#undef LURE_ARRIVAL_MIN +#undef LURE_ARRIVAL_MAX +#undef LURE_APPROACH_MIN +#undef LURE_APPROACH_MAX +#undef LURE_UNSEEN_RANGE +#undef LURE_CHARGE_TIME +#undef LURE_EMERGE_TIME +#undef BB_LURE_CHARGE_EXPIRES diff --git a/voidcrew/modules/missions/missions/exploration.dm b/voidcrew/modules/missions/missions/exploration.dm index 9f94c4a82da..d719f8f0056 100644 --- a/voidcrew/modules/missions/missions/exploration.dm +++ b/voidcrew/modules/missions/missions/exploration.dm @@ -1,9 +1,15 @@ /** * # Exploration Mission * - * Fly the ship to marked coordinates, then come home for the pay. The - * coordinates come from the zone controller's own turf sets (no private ring - * math), and pay scales through the shared zone table. + * Fly the ship to marked coordinates, hold station there while the sensors sweep + * the sector, then come home for the pay. The coordinates come from the zone + * controller's own turf sets (no private ring math), and pay scales through the + * shared zone table. + * + * The sweep is the arrival beat: half a minute on station, a sonar ping, and + * sometimes a derelict signal nobody aboard had charted yet, pinned on the helm + * so the crew can decide whether to go and look. The signal is always one that + * is already out there; the sweep never makes anything. */ /datum/mission/exploration name = "Exploration Contract" @@ -12,6 +18,12 @@ // Green-band pay; apply_zone_scaling() raises it for deeper zones value_min = 150 value_max = 250 + /// The sweep step, for the waypoint label + var/datum/mission_objective/sector_sweep/sweep + +/datum/mission/exploration/Destroy() + sweep = null + return ..() /datum/mission/exploration/setup_target() var/datum/mission_target/coords/coords = new(src) @@ -28,17 +40,274 @@ return TRUE /datum/mission/exploration/build_objectives() - add_objective(new /datum/mission_objective/goto_coords) + var/datum/mission_objective/goto_coords/approach = new + // The sweep announces the arrival itself + approach.arrival_message = null + add_objective(approach) + sweep = new + add_objective(sweep) /datum/mission/exploration/update_text() name = "Exploration Contract: ([target.target_x], [target.target_y])" desc = "Chart the sector at ([target.target_x], [target.target_y]) in the [target_zone_name]." /datum/mission/exploration/waypoint_label() - return "Survey site" + return sweep?.completed ? "Charted sector" : "Survey site" /datum/mission/exploration/get_ui_data() var/list/data = ..() data["target_x"] = target.target_x data["target_y"] = target.target_y return data + +// ========================================================================= +// SECTOR SWEEP: hold station at the site while the sensors work +// ========================================================================= + +/** + * The ship holds within hold_range of the mission target for sweep_time. Drifting + * off pauses the sweep and keeps what it had; coming back resumes it. The possible + * find (an uncharted ordinary derelict signal near the site) is rolled once, the + * first time the sweep starts, so breaking off and coming back never rerolls it. + */ +/datum/mission_objective/sector_sweep + /// How long the ship has to hold station + var/sweep_time = 30 SECONDS + /// Overmap tiles from the site the ship may sit and keep sweeping + var/hold_range = 2 + /// How far from the site a derelict signal can show up on the sweep + var/find_range = 7 + /// Percent chance the sweep turns up a derelict signal, when one is out there + var/find_chance = 50 + /// Gap between "broken off" lines, so a ship drifting on the edge doesn't spam the crew + var/notice_gap = 10 SECONDS + /// Sweep time banked from earlier runs + var/banked_time = 0 + /// Whether the ship is on station and the sweep is running + var/running = FALSE + /// world.time the current run started + var/run_started = 0 + /// Whether the sweep has started at least once + var/started = FALSE + /// Timer: the sweep finishing + var/finish_timer + /// Timer: the faint return halfway through, when there is a find + var/return_timer + /// Whether the faint return has been called out + var/return_reported = FALSE + /// Whether a "broken off" line went out that still needs its "resumed" + var/break_reported = FALSE + /// Whether the find has been rolled for this sweep + var/find_rolled = FALSE + /// The derelict signal the sweep picked up, if any + var/datum/weakref/find_ref + COOLDOWN_DECLARE(break_notice_cooldown) + +/datum/mission_objective/sector_sweep/Destroy() + find_ref = null + return ..() + +/datum/mission_objective/sector_sweep/activate() + . = ..() + var/obj/structure/overmap/ship/ship = get_servant() + if(!ship) + return + RegisterSignal(ship, COMSIG_MOVABLE_MOVED, PROC_REF(on_ship_moved)) + check_station() + +/datum/mission_objective/sector_sweep/deactivate() + var/obj/structure/overmap/ship/ship = get_servant() + if(ship) + UnregisterSignal(ship, COMSIG_MOVABLE_MOVED) + stop_run() + return ..() + +/datum/mission_objective/sector_sweep/reset() + . = ..() + banked_time = 0 + running = FALSE + run_started = 0 + started = FALSE + return_reported = FALSE + break_reported = FALSE + find_rolled = FALSE + find_ref = null + +/datum/mission_objective/sector_sweep/proc/on_ship_moved(datum/source) + SIGNAL_HANDLER + check_station() + +/// Wrapped overmap distance from relative coordinates to the mission site, or null +/datum/mission_objective/sector_sweep/proc/distance_to_site(list/coords) + var/datum/mission_target/target = mission?.target + if(!coords || !target) + return null + var/dx = overmap_wrapped_delta(coords[1] - target.target_x, OVERMAP_SIZE - 2) + var/dy = overmap_wrapped_delta(coords[2] - target.target_y, OVERMAP_SIZE - 2) + return sqrt(dx * dx + dy * dy) + +/// Whether the servant ship is close enough to the site to sweep it +/datum/mission_objective/sector_sweep/proc/is_on_station() + var/obj/structure/overmap/ship/ship = get_servant() + if(!ship) + return FALSE + var/dist = distance_to_site(ship.get_relative_overmap_coords()) + return !isnull(dist) && dist <= hold_range + +/// Starts or pauses the sweep to match where the ship is +/datum/mission_objective/sector_sweep/proc/check_station() + if(completed || !active) + return + var/on_station = is_on_station() + if(on_station && !running) + start_run() + else if(!on_station && running) + stop_run() + if(COOLDOWN_FINISHED(src, break_notice_cooldown)) + COOLDOWN_START(src, break_notice_cooldown, notice_gap) + break_reported = TRUE + notify_crew("Sweep broken off.", type = SHIP_NOTIFY_WARNING, sound = 'voidcrew/sound/notify2.ogg') + +/datum/mission_objective/sector_sweep/proc/start_run() + running = TRUE + run_started = world.time + if(!find_rolled) + find_rolled = TRUE + roll_find() + finish_timer = addtimer(CALLBACK(src, PROC_REF(finish_sweep)), max(sweep_time - banked_time, 1), TIMER_STOPPABLE) + var/halfway = sweep_time / 2 + if(find_ref && !return_reported && banked_time < halfway) + return_timer = addtimer(CALLBACK(src, PROC_REF(report_return)), halfway - banked_time, TIMER_STOPPABLE) + if(!started) + started = TRUE + notify_crew("Survey site reached. Sweeping the sector.", sound = 'sound/machines/sonar-ping.ogg') + else if(break_reported) + break_reported = FALSE + notify_crew("Back on station. Sweep resumed.", sound = 'sound/machines/sonar-ping.ogg') + +/// Banks the current run and stops its timers (safe to call while already stopped) +/datum/mission_objective/sector_sweep/proc/stop_run() + if(running) + banked_time += world.time - run_started + running = FALSE + if(finish_timer) + deltimer(finish_timer) + finish_timer = null + if(return_timer) + deltimer(return_timer) + return_timer = null + +/** + * Picks what the sweep turns up: the nearest ordinary derelict signal just past the + * ship's own sight from the site, that this ship has neither seen nor charted. Only + * plain naturally seeded signals with nobody's claim on them count, so the sweep + * never points at a rumour site, a contract's site, a bounty lair or a broadcast. + */ +/datum/mission_objective/sector_sweep/proc/roll_find() + find_ref = null + if(!prob(find_chance)) + return + var/obj/structure/overmap/ship/ship = get_servant() + var/turf/ship_turf = get_turf(ship) + if(!ship_turf) + return + var/obj/structure/overmap/space_ruin/best + var/best_dist + for(var/obj/structure/overmap/space_ruin/ruin as anything in GLOB.space_ruin_signals) + if(!is_ordinary_signal(ruin)) + continue + var/turf/ruin_turf = get_turf(ruin) + if(ruin_turf?.z != ship_turf.z) + continue + var/ruin_ref = REF(ruin) + if(ship.get_waypoint(ruin_ref)) + continue + var/datum/weakref/seen = ship.discovered_contacts[ruin_ref] + if(seen?.resolve() == ruin) + continue + var/dist = distance_to_site(ruin.get_relative_overmap_coords()) + if(isnull(dist) || dist <= SHIP_VIEW_RANGE || dist > find_range) + continue + if(isnull(best_dist) || dist < best_dist) + best = ruin + best_dist = dist + if(best) + find_ref = WEAKREF(best) + +/// A plain derelict signal from natural seeding, with no claim, lock, broadcast or rumour on it +/datum/mission_objective/sector_sweep/proc/is_ordinary_signal(obj/structure/overmap/space_ruin/ruin) + if(QDELETED(ruin) || ruin.type != /obj/structure/overmap/space_ruin || !ruin.sensor_detectable) + return FALSE + if(ruin.rare || ruin.no_replacement || ruin.mission_locked || ruin.mission_exclusive || ruin.mission_claims) + return FALSE + return !(ruin in GLOB.overmap_fleet_beacons) + +/// The find, if it is still out there +/datum/mission_objective/sector_sweep/proc/get_find() + var/obj/structure/overmap/space_ruin/find = find_ref?.resolve() + if(QDELETED(find)) + find_ref = null + return null + return find + +/// " to the northeast" from the ship to `object`, or "" when there is no bearing +/datum/mission_objective/sector_sweep/proc/bearing_to(obj/structure/overmap/object) + var/static/list/compass_words = list( + "N" = "north", "NE" = "northeast", "E" = "east", "SE" = "southeast", + "S" = "south", "SW" = "southwest", "W" = "west", "NW" = "northwest", + ) + var/obj/structure/overmap/ship/ship = get_servant() + var/list/from = ship?.get_relative_overmap_coords() + var/list/to_coords = object?.get_relative_overmap_coords() + if(!from || !to_coords) + return "" + var/dx = overmap_wrapped_delta(to_coords[1] - from[1], OVERMAP_SIZE - 2) + var/dy = overmap_wrapped_delta(to_coords[2] - from[2], OVERMAP_SIZE - 2) + var/compass = overmap_delta_to_compass(dx, dy) + if(!compass) + return "" + return " to the [compass_words[compass]]" + +/datum/mission_objective/sector_sweep/proc/report_return() + return_timer = null + if(!active || completed) + return + var/obj/structure/overmap/space_ruin/find = get_find() + if(!find) + return + return_reported = TRUE + notify_crew("Faint return[bearing_to(find)].", sound = 'sound/machines/sonar-ping.ogg') + +/datum/mission_objective/sector_sweep/proc/finish_sweep() + finish_timer = null + if(!active || completed) + return + running = FALSE + banked_time = sweep_time + if(return_timer) + deltimer(return_timer) + return_timer = null + var/static/list/quiet_lines = list( + "Sector charted. Quiet out here.", + "Sector charted. Nothing but dust.", + "Sector charted. Just old drive wakes.", + ) + var/line = pick(quiet_lines) + var/obj/structure/overmap/ship/ship = get_servant() + var/obj/structure/overmap/space_ruin/find = get_find() + // A scan the crew ran themselves meanwhile may have charted it already: no news then + if(ship && find && ship.chart_as_waypoint(find)) + line = "Sector charted. Derelict signal logged[bearing_to(find)]." + notify_crew("[line] Pay's waiting on the board.", sound = 'voidcrew/sound/notify2.ogg') + var/datum/mission/owner = mission + complete() + owner?.push_waypoint() + +/datum/mission_objective/sector_sweep/get_progress_string() + if(completed) + return "Sector charted" + if(running) + return "Sweeping the sector" + if(started) + return "Sweep broken off" + return "Sweep the sector" diff --git a/voidcrew/modules/missions/missions/field_expedition.dm b/voidcrew/modules/missions/missions/field_expedition.dm index 5ca8eaec4e4..ce12215fa5c 100644 --- a/voidcrew/modules/missions/missions/field_expedition.dm +++ b/voidcrew/modules/missions/missions/field_expedition.dm @@ -51,7 +51,9 @@ )) /datum/mission/field_expedition/build_objectives() - add_objective(new /datum/mission_objective/field/plant_quest) + var/datum/mission_objective/field/plant_quest/plant = new + plant.scene_type = /datum/mission_scene/crash + add_objective(plant) add_objective(new /datum/mission_objective/deliver/bound) /// Picking the core up can wake the neighborhood (once per era) diff --git a/voidcrew/modules/missions/missions/live_capture.dm b/voidcrew/modules/missions/missions/live_capture.dm index 17090950e32..494fd5a7763 100644 --- a/voidcrew/modules/missions/missions/live_capture.dm +++ b/voidcrew/modules/missions/missions/live_capture.dm @@ -232,6 +232,7 @@ mission.fail("No mission pad to dispense the capture crate to.") return FALSE kit = new(kit_turf) + mission_pad_delivery_effect(kit_turf) kit.objective_ref = WEAKREF(src) mission.bind_item(kit) // One crate per contract: losing it voids the capture diff --git a/voidcrew/modules/missions/missions/prospect_stake.dm b/voidcrew/modules/missions/missions/prospect_stake.dm index adcc1ff938b..bb847a7d425 100644 --- a/voidcrew/modules/missions/missions/prospect_stake.dm +++ b/voidcrew/modules/missions/missions/prospect_stake.dm @@ -1,16 +1,17 @@ /** * # Prospect Stake * - * "Plant our claim beacon at these red-zone coordinates and keep it alive - * for eight minutes. The filing goes out on Wideband, so expect... interest." + * "Plant our claim beacon on this rock and keep it standing until the claim + * matures. The filing goes out on Wideband, so expect... interest." * * The announced PvP flashpoint as a mission: a claim kit is dispensed at - * accept; deploying it (ship holding at the marked coordinates) files the - * claim galaxy-wide - the contested-cache broadcast pattern - and starts a - * defend clock that only runs on station. Boarding waves answer the filing; - * red space means anyone else can too. The beacon survives, it prints a - * bonded deed for the pad. Objectives: [fly there] -> [deploy & defend] -> - * [carry the deed home]. + * accept, and the crew lands on a contested or lawless planet to raise it on + * open ground, clear of the landing field and any parked hull. Deploying it + * files the claim galaxy-wide - the contested-cache broadcast pattern - and + * starts a defend clock that only runs while a crew member stands guard at + * the beacon. Waves answer the filing on the ground around it; red space + * means anyone else can too. The beacon survives, it prints a bonded deed for + * the pad. Objectives: [deploy & defend] -> [carry the deed home]. */ /datum/mission/prospect_stake name = "Prospect Stake" @@ -29,6 +30,7 @@ var/wave_theme /// The defense objective (kit dispensing at start) var/datum/mission_objective/claim_defense/defense + /datum/mission/prospect_stake/Destroy() defense = null return ..() @@ -36,26 +38,40 @@ /datum/mission/prospect_stake/get_archetype() return "claim" +/** + * Picks the planet to stake. An offer pinned to a band (the reserved top-band + * slots, the unarmed green bias) only tries that band, and a green pin finds + * nothing. Otherwise the band is rolled, falling back to the other band when + * the rolled one has no world to offer. + */ /datum/mission/prospect_stake/setup_target() - var/datum/mission_target/coords/coords = new(src) - // Yellow stakes are the on-ramp; red is the real thing - coords.zone_weights = list( - "[ZONE_YELLOW]" = 45, - "[ZONE_RED]" = 55, - ) - if(!coords.resolve()) - qdel(coords) - return FALSE - target = coords - return TRUE + var/list/bands = list() + if(!isnull(preferred_zone)) + bands += preferred_zone + else + // Yellow stakes are the on-ramp; red is the real thing + var/list/weights = list( + "[ZONE_YELLOW]" = 45, + "[ZONE_RED]" = 55, + ) + while(length(weights)) + var/band_key = pick_weight(weights) + weights -= band_key + bands += text2num(band_key) + for(var/band in bands) + var/datum/mission_target/planet/claim_site/site = new(src) + site.preferred_zone = band + if(site.resolve()) + target = site + return TRUE + qdel(site) + return FALSE /datum/mission/prospect_stake/generate_details() objective_name = "notarized claim deed" wave_theme = pick_weight(MISSION_WAVE_THEMES) + /datum/mission/prospect_stake/build_objectives() - var/datum/mission_objective/goto_coords/approach = new - approach.arrival_message = "On station over the claim." - add_objective(approach) defense = new defense.wave_theme = wave_theme add_objective(defense) @@ -65,18 +81,89 @@ defense?.dispense_kit() /datum/mission/prospect_stake/update_text() - name = "Prospect Stake: ([target.target_x], [target.target_y])" - desc = "File our mineral-rights claim at ([target.target_x], [target.target_y]) in the [target_zone_name]." + var/datum/mission_target/planet/site = target + var/site_name = istype(site) ? (site.planet?.name || "the planet") : "the planet" + name = "Prospect Stake: [site_name]" + desc = "File our mineral-rights claim on [site_name] at ([target.target_x], [target.target_y]) in the [target_zone_name]." /datum/mission/prospect_stake/waypoint_label() return "Prospect stake" +// ========================================================================= +// CLAIM SITE: a real world to stand on +// ========================================================================= + +/** + * # Claim Site + * + * The planet target narrowed to ground a claim can stand on: terrain worlds + * only (GLOB.overmap_planets also holds empty-space dock placeholders, crash + * sites and weak signals, none of which have any), and never neutral space. + * Picks a biome first and hands it to the planet target's wanted_planet + * filter, so every other rule (exclusivity, occupancy, field contacts, + * relocation tracking) is the planet target's own. + */ +/datum/mission_target/planet/claim_site + /// Biomes a field contact may be minted as when no terrain world is on offer + var/static/list/claim_biomes = list( + /datum/overmap/planet/lava, + /datum/overmap/planet/ice, + /datum/overmap/planet/jungle, + /datum/overmap/planet/beach, + /datum/overmap/planet/wasteland, + ) + +/// Claims are filed in contested and lawless space only +/datum/mission_target/planet/claim_site/zone_is_eligible(band) + return band != ZONE_GREEN && ..() + +/datum/mission_target/planet/claim_site/resolve() + var/list/biomes = list() + for(var/obj/structure/overmap/planet/candidate as anything in GLOB.overmap_planets) + if(QDELETED(candidate) || candidate == planet || candidate.mission_exclusive || !candidate.is_terrain_planet()) + continue + if(!istype(get_turf(candidate), /turf/open/overmap) || !zone_is_eligible(SSovermap_zones?.get_zone_type(get_turf(candidate)))) + continue + biomes |= candidate.planet + if(!length(biomes)) + // Never mint a contact in a band no claim can use (a green-pinned reserved slot + // would leave a stray planet on the chart for an offer that then fails) + if(!mission?.create_field_contact || !zone_is_eligible(preferred_zone)) + unhook() + return FALSE + // Nothing standing in the band: the planet target mints a contact of this biome + biomes = claim_biomes + wanted_planet = pick(biomes) + return ..() + +/** + * Why a claim beacon can't stand on this turf, as a balloon line, or null if + * it can. Open, solid ground on this world's own surface or caves - never a + * deck, a ruin, space, lava, water or a chasm - and clear of the landing + * berths and any parked hull, so no ship comes down on the claim and no wave + * lands on somebody's floor. + */ +/datum/mission_target/planet/claim_site/proc/claim_ground_refusal(turf/spot) + if(!spot || !isopenturf(spot) || isgroundlessturf(spot) || !contains_turf(spot)) + return "no claim ground here!" + if(!istype(get_area(spot), /area/overmap_encounter/planetoid) || spot.is_blocked_turf(exclude_mobs = TRUE)) + return "no claim ground here!" + var/datum/space_level/level = length(planet.mapzone?.z_levels) ? planet.mapzone.z_levels[1] : null + var/strip_top = planet.get_dock_strip_top_y(level) + if(!isnull(strip_top) && spot.y <= strip_top) + return "too close to the landing field!" + // One tile past where a wave can scatter, so no arrival lands on a deck + for(var/turf/nearby as anything in RANGE_TURFS(ZONE_MOBS_WAVE_SCATTER + 1, spot)) + if(istype(nearby.loc, /area/shuttle)) + return "too close to a ship!" + return null + /** * # Claim Beacon Kit * - * The packed beacon handed over at accept. Use in hand while the ship holds - * at the stake coordinates; the deployment channel raises the beacon on the - * spot you're standing. + * The packed beacon handed over at accept. Use in hand on open ground at the + * claim site; the deployment channel raises the beacon on the spot you're + * standing. */ /obj/item/claim_beacon_kit name = "claim beacon kit" @@ -93,29 +180,40 @@ if(.) return var/datum/mission_objective/claim_defense/objective = objective_ref?.resolve() - if(!objective?.mission || objective.mission.failed || objective.mission.completed) + if(!objective?.mission || objective.mission.failed || objective.mission.completed || !objective.active) balloon_alert(user, "contract expired!") return TRUE - if(!objective.active || !objective.ship_on_station()) - balloon_alert(user, "ship not holding at the stake coordinates!") + var/refusal = claim_refusal(objective, get_turf(user)) + if(refusal) + balloon_alert(user, refusal) return TRUE balloon_alert(user, "deploying beacon...") playsound(src, 'sound/items/tools/ratchet.ogg', 60, TRUE) if(!do_after(user, 8 SECONDS, target = user)) balloon_alert(user, "deployment interrupted!") return TRUE - if(!objective.ship_on_station()) - balloon_alert(user, "drifted off station!") + if(!objective.mission || objective.mission.failed || objective.mission.completed || !objective.active) + return TRUE + refusal = claim_refusal(objective, get_turf(user)) + if(refusal) + balloon_alert(user, refusal) return TRUE objective.deploy(user, get_turf(user)) return TRUE +/// Why the beacon can't go up here, or null if it can +/obj/item/claim_beacon_kit/proc/claim_refusal(datum/mission_objective/claim_defense/objective, turf/spot) + var/datum/mission_target/planet/claim_site/site = objective.mission?.target + if(!istype(site)) + return "no claim ground here!" + return site.claim_ground_refusal(spot) + /** * # Claim Beacon * * The deployed stake: destructible on purpose - defending it is the mission. - * Ticks the defend clock while the ship holds station, calls its own waves, - * and files every beat on Wideband like the contested cache does. + * Ticks the defend clock while a crew member stands guard, calls its own + * waves, and files every beat on Wideband like the contested cache does. */ /obj/structure/mission_claim_beacon name = "prospecting claim beacon" @@ -125,15 +223,13 @@ anchored = TRUE density = TRUE max_integrity = 400 + // Driven into the ground: wind, force pushes and gravity never shift it off the claim + move_resist = INFINITY /// Weakref to the claim_defense objective driving this beacon var/datum/weakref/objective_ref /// Internal wideband transmitter (the contested-cache broadcast pattern) var/obj/item/radio/headset/radio - /// world.time gate for the next defender wave - var/next_wave_at = 0 - /// Throttle for off-station warnings - COOLDOWN_DECLARE(offstation_warn_cooldown) /obj/structure/mission_claim_beacon/Initialize(mapload) . = ..() @@ -142,7 +238,6 @@ radio.canhear_range = 0 radio.set_listening(FALSE) radio.recalculateChannels() - next_wave_at = world.time + 1 MINUTES START_PROCESSING(SSobj, src) /obj/structure/mission_claim_beacon/Destroy() @@ -164,14 +259,6 @@ priority_announce(message, "Prospect Filing", sender_override = "Sector Claims Registry") radio?.talk_into(src, message, RADIO_CHANNEL_WIDEBAND) -/obj/structure/mission_claim_beacon/proc/show_offstation_warning() - if(!COOLDOWN_FINISHED(src, offstation_warn_cooldown)) - return - COOLDOWN_START(src, offstation_warn_cooldown, 15 SECONDS) - balloon_alert_to_viewers("off station!") - var/datum/mission_objective/claim_defense/objective = objective_ref?.resolve() - objective?.notify_crew("Claim beacon reports the ship off station.", type = SHIP_NOTIFY_WARNING, sound = 'voidcrew/sound/notify2.ogg') - /// The claim matured: stop being a mission object, stay as scenery /obj/structure/mission_claim_beacon/proc/retire() STOP_PROCESSING(SSobj, src) diff --git a/voidcrew/modules/missions/missions/recovery_variants.dm b/voidcrew/modules/missions/missions/recovery_variants.dm index 2a53a981637..411e32095fc 100644 --- a/voidcrew/modules/missions/missions/recovery_variants.dm +++ b/voidcrew/modules/missions/missions/recovery_variants.dm @@ -165,6 +165,7 @@ /datum/mission/recovery/extraction/build_objectives() var/datum/mission_objective/field/plant_quest/plant = new plant.quest_item_type = /obj/item/mission_recovery/anchored + plant.scene_type = /datum/mission_scene/cargo_wreck add_objective(plant) add_objective(new /datum/mission_objective/deliver/bound) @@ -203,7 +204,7 @@ * # Anchored Recovery Cargo * * The extraction objective: a mission_recovery item that starts bolted to - * the deck. Unbolting is a channel that trips the mission's alarm. + * the deck. Unbolting is a wrench channel that trips the mission's alarm. */ /obj/item/mission_recovery/anchored desc = "Contracted salvage, bolted to the deck." @@ -214,26 +215,32 @@ /obj/item/mission_recovery/anchored/examine(mob/user) . = ..() if(anchored) - . += span_warning("It is bolted down.") + . += span_warning("It is bolted to the floor.") +/// Bare hands get nowhere with the bolts /obj/item/mission_recovery/anchored/attack_hand(mob/living/user, list/modifiers) if(!anchored) return ..() + balloon_alert(user, "it's bolted down") + return TRUE + +/obj/item/mission_recovery/anchored/wrench_act(mob/living/user, obj/item/tool) + if(!anchored) + return NONE balloon_alert(user, "wrenching it free...") - playsound(src, 'sound/items/tools/ratchet.ogg', 60, TRUE) - if(!do_after(user, EXTRACTION_UNBOLT_TIME, target = src)) + if(!tool.use_tool(src, user, EXTRACTION_UNBOLT_TIME, volume = 60)) balloon_alert(user, "still bolted!") - return TRUE + return ITEM_INTERACT_BLOCKING if(!anchored) balloon_alert(user, "already free") - return TRUE + return ITEM_INTERACT_BLOCKING anchored = FALSE balloon_alert(user, "wrenched free") playsound(src, 'sound/machines/click.ogg', 60, TRUE) var/datum/mission/recovery/extraction/mission = mission_ref?.resolve() if(istype(mission)) mission.trigger_extraction_alarm(src) - return TRUE + return ITEM_INTERACT_SUCCESS #undef SURVEY_CALIBRATE_TIME #undef EXTRACTION_UNBOLT_TIME diff --git a/voidcrew/modules/missions/missions/rescue.dm b/voidcrew/modules/missions/missions/rescue.dm index 626b0585f2a..fbae8504522 100644 --- a/voidcrew/modules/missions/missions/rescue.dm +++ b/voidcrew/modules/missions/missions/rescue.dm @@ -3,11 +3,11 @@ * * "A survivor's beacon is still pinging inside that wreck. Bring them home alive." * - * Recovery variant where the objective breathes: a survivor NPC spawns in - * the target ruin, follows whoever asks (or rides a fireman carry), and the - * mission turns in while they're alive beside the ship's mission pad. - * Survivor death burns a retarget ("another beacon"). The non-gunner's - * recovery mission. + * Recovery variant where the objective breathes: a survivor NPC hides in the + * target ruin, follows whoever asks, and the mission turns in while they're + * alive beside the ship's mission pad. Survivor death burns a retarget + * ("another beacon"). The non-gunner's recovery mission. The survivor + * themselves are in rescue_survivor.dm. */ /datum/mission/rescue name = "Rescue Contract" @@ -50,116 +50,3 @@ /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. 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. - * - * 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/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." - 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 - -/// 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") - npc_name = "survivor ([pick(survivor_names)])" - return ..() - -/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/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() - balloon_alert(user, "waiting here") - say("I'll... wait right here.") - else - start_following(user) - balloon_alert(user, "following you") - say("Right behind you. Please don't be wrong about the way out.") - return TRUE - -/mob/living/carbon/human/npc/mission_survivor/proc/start_following(mob/living/leader) - following_ref = WEAKREF(leader) - ai_controller?.set_blackboard_key(BB_MISSION_SURVIVOR_LEADER, leader) - -/mob/living/carbon/human/npc/mission_survivor/proc/stop_following() - following_ref = null - ai_controller?.clear_blackboard_key(BB_MISSION_SURVIVOR_LEADER) - -/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/missions/rescue_survivor.dm b/voidcrew/modules/missions/missions/rescue_survivor.dm new file mode 100644 index 00000000000..10683117d53 --- /dev/null +++ b/voidcrew/modules/missions/missions/rescue_survivor.dm @@ -0,0 +1,1092 @@ +/** + * # Rescue survivor + * + * The person a rescue contract sends a crew to fetch. They are an ambient NPC (the world population + * core in voidcrew/modules/ambient_npcs/), so they get its looks, its walking, its activities and + * its dialogue cooldowns, and a real human body (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. They behave like a frightened person: + * + * - placed somewhere sheltered in the wreck (a locker, a corner, an alcove), out of sight of + * whatever is loose in there (mission_survivor_hiding_place()); + * - hiding: crouched and quiet, fidgeting now and then; inside a locker, silent; + * - before anyone has found them, their beacon crackles a distress call to the contract crew's + * radios when they are a few screens away; + * - when they see a person, they call out and wave (or bang on the locker), and come over if + * nothing is about; + * - a hostile close by, or one going for them: they run, away from it, and hide again where they + * stop; one further off: they keep still, and if there are people about they shout a warning; + * - an empty hand makes them follow (or wait); following, they stay at their rescuer's side, + * duck and yelp at danger instead of running, climb out of anything they are shut in, and wait + * where they are if their rescuer goes; + * - they never fight; + * - removed by the contract (delivered, timed out, abandoned, re-targeted), they are taken up from + * orbit in the transporter's column of light (beam_out()), or deleted at once if nobody sees. + * + * 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). + */ + +/// How far they see people and threats +#define SURVIVOR_SIGHT 7 +/// How often they look around +#define SURVIVOR_LOOK_INTERVAL (1 SECONDS) +/// A threat this close, or one going for them, sends them running (until they have a rescuer) +#define SURVIVOR_FLEE_DISTANCE 4 +/// How far they run at most, per run +#define SURVIVOR_FLEE_RANGE 6 +/// How long one flight lasts before they settle wherever they got to +#define SURVIVOR_FLEE_TIME (12 SECONDS) +/// A threat that keeps coming can send them running this many more times in one flight +#define SURVIVOR_FLEE_RUNS 3 +/// The contract crew hear the distress call within this many tiles +#define SURVIVOR_DISTRESS_RANGE 30 +/// Between two distress calls +#define SURVIVOR_DISTRESS_GAP_LOW (50 SECONDS) +#define SURVIVOR_DISTRESS_GAP_HIGH (90 SECONDS) +/// Somebody they spotted this close (or nearer) gets walked up to, if nothing else is about +#define SURVIVOR_APPROACH_RANGE 6 +/// Somebody this close counts as right there (they stand up, they plead) +#define SURVIVOR_NEAR_RANGE 3 +/// Inside a locker they hear people this close +#define SURVIVOR_HEARING_RANGE 3 +/// Following: a leader further than this, or gone, or dead, is out of reach +#define SURVIVOR_FOLLOW_RANGE 14 +/// Following: a leader out of reach this long, and they stop and wait where they are +#define SURVIVOR_LOST_TIME (45 SECONDS) +/// Following outranks every reaction: nothing makes them run off from their rescuer +#define SURVIVOR_FOLLOW_PRIORITY 60 +/// Running outranks calling out +#define SURVIVOR_FLEE_PRIORITY 55 +/// Following: how long they stay down when they duck, and how soon they may duck again +#define SURVIVOR_DUCK_TIME (3 SECONDS) +#define SURVIVOR_DUCK_COOLDOWN (8 SECONDS) +/// Hiding place search: how far from the site's spawn point it looks +#define SURVIVOR_SHELTER_RADIUS 20 +/// Hiding place search: nothing hostile within this many tiles of it +#define SURVIVOR_SHELTER_THREAT_GAP 6 +/// Hiding place search: blocked neighbours (of 8) a floor tile needs to count as a corner or alcove +#define SURVIVOR_SHELTER_MIN_COVER 5 +/// The beam: the column comes down, they come apart in it, and they are gone this long after it started +#define SURVIVOR_BEAM_TIME (3 SECONDS) +/// The beam: how long the column takes to come down before they start to come apart +#define SURVIVOR_BEAM_DROP (0.4 SECONDS) +/// The beam is only drawn for someone with a client within this many tiles; otherwise they are deleted at once +#define SURVIVOR_BEAM_WATCH_RANGE 10 +/// Trait source for what the survivor puts on themselves +#define SURVIVOR_TRAIT "mission_survivor" + +// ========================================================================= +// THE SURVIVOR +// ========================================================================= + +/mob/living/carbon/human/npc/ambient_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 suit is patched in three places and still holding." + death_cash_low = 0 + death_cash_high = 0 + speech_pace = 1.5 + outfit = /datum/outfit/mission_survivor + // Their body is the contract's until it lets go of them (corpse_lifetime()) + npc_corpse_lifetime = 0 + routine = list(/datum/ambient_activity/survivor_hide = 1) + ai_controller = /datum/ai_controller/basic_controller/ambient_npc/mission_survivor + /// The contract they belong to (a /datum/mission), for the distress call and to know its crew + var/datum/weakref/contract_ref + /// Who they were before this ("salvage tech"), from the contract + var/story + /// Where they keep their head down when they are not doing anything else + var/turf/hide_spot + /// The locker they were put in to hide, while they are still in it + var/datum/weakref/hid_in_ref + /// Someone has made them follow at least once + var/rescued = FALSE + /// They have seen a person: no more distress calls + var/contacted = FALSE + /// They said something on first stepping aboard a ship + var/said_aboard = FALSE + /// Being taken up in the beam: nothing else happens to them + var/beaming_out = FALSE + /// REFs of the people they already called out to + var/list/greeted + /// world.time they next look around, call for help on the radio, or fidget + var/next_look = 0 + var/next_distress = 0 + var/next_fidget = 0 + /// world.time they last saw a threat + var/last_threat_at = 0 + +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/Initialize(mapload, datum/human_npc_order/order) + . = ..() + hide_spot = get_turf(src) + next_fidget = world.time + rand(20 SECONDS, 40 SECONDS) + +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/Destroy() + contract_ref = null + hide_spot = null + hid_in_ref = null + greeted = null + return ..() + +// A dead survivor can be brought back inside the contract's window: the corpse cleanup leaves them be +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/corpse_lifetime() + return 0 + +/// Ties them to `contract`: its crew hear their distress call, and they take its story +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/join_contract(datum/mission/contract) + if(!contract) + return + contract_ref = WEAKREF(contract) + story = contract.objective_name + if(story) + var/article = (LOWER_TEXT(copytext(story, 1, 2)) in list("a", "e", "i", "o", "u")) ? "An" : "A" + desc = "[article] [story] who has had a very long week. [p_Their()] emergency suit is patched in three places and still holding." + +/** + * Puts them in their hiding place: into `locker` (shut) if there is one, or down in a crouch where + * they stand. Where they stand is where they come back to. + */ +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/take_shelter(obj/structure/closet/locker) + hide_spot = get_turf(src) + if(QDELETED(locker)) + crouch() + return + if(locker.opened) + forceMove(locker.loc) + locker.close() + else + forceMove(locker) + if(loc == locker) + hid_in_ref = WEAKREF(locker) + +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/examine(mob/user) + . = ..() + if(stat != CONSCIOUS) + return + var/datum/ambient_activity/survivor_follow/follow = activity + var/mob/leader = istype(follow) ? follow.anchor() : null + if(leader) + . += span_notice("[p_Theyre()] sticking close to [leader].") + else if(crouching) + . += span_notice("[p_Theyre()] shaking.") + +// ========================================================================= +// FOLLOWING +// ========================================================================= + +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/talked_to(mob/living/user) + if(beaming_out || !talk_ready(user)) + return + if(!buckled) + face_atom(user) + var/datum/ambient_activity/survivor_follow/follow = activity + var/mob/living/leader = istype(follow) ? follow.anchor() : null + if(leader == user) + stop_following() + speak_context("wait", user, force = TRUE) + return + // Whoever came for them keeps them: a stranger can't walk off with them + if(leader && is_contract_crew(leader) && !is_contract_crew(user)) + speak_context("refuse", user, force = TRUE) + return + if(start_following(user)) + speak_context("follow", user, force = TRUE) + +/// They follow `leader` from now on. Returns the activity, or null. +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/start_following(mob/living/leader) + if(beaming_out || !isliving(leader)) + return null + rescued = TRUE + contacted = TRUE + return start_activity(new /datum/ambient_activity/survivor_follow(src, leader)) + +/// They stop following and wait where they are +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/stop_following() + hide_spot = get_turf(src) + if(is_following()) + end_activity() + +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/is_following() + return istype(activity, /datum/ambient_activity/survivor_follow) + +/// Their rescuer is out of reach: they wait where they are. Called by the follow activity as it ends. +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/lose_leader() + hide_spot = get_turf(src) + +/// Their rescuer went down in front of them +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/leader_fell(mob/living/leader) + hide_spot = get_turf(src) + if(!buckled) + face_atom(leader) + speak_context("leader_down", leader, force = TRUE) + +/// Whether `person` is crew of the ship that took their contract +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/is_contract_crew(mob/living/person) + var/datum/mission/contract = contract_ref?.resolve() + if(!contract?.servant || !isliving(person)) + return FALSE + return ambient_crew_ship(person) == contract.servant + +/// Shut in something while following: they push it open, or bang on it if it won't +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/climb_out() + var/obj/structure/closet/container = loc + if(!istype(container) || !reaction_ready("climb_out", 3 SECONDS)) + return + if(container.open()) + return + if(reaction_ready("trapped", 12 SECONDS)) + bang_on(container) + speak_context("trapped", null, force = TRUE) + +/// Bangs on the inside of `container` +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/bang_on(obj/structure/closet/container) + if(QDELETED(container)) + return + container.Shake(2, 1, 0.5 SECONDS) + playsound(container, 'sound/effects/bang.ogg', 30, TRUE, -2) + +/// The first time they step aboard a crew's ship +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/check_aboard() + if(said_aboard || !istype(get_area(src), /area/shuttle/voidcrew)) + return + said_aboard = TRUE + speak_context("aboard", null, force = TRUE) + +// ========================================================================= +// LOOKING AROUND +// ========================================================================= + +/** + * About once a second while their AI is on: who and what can they see, and what do they do about + * it. Starts reactions (calling out, running) as activities; never sleeps. + */ +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/look_around() + if(beaming_out || !can_act() || world.time < next_look) + return + next_look = world.time + SURVIVOR_LOOK_INTERVAL + var/turf/here = get_turf(src) + if(!here) + return + var/obj/structure/closet/container = istype(loc, /obj/structure/closet) ? loc : null + // Out of the locker they hid in: whoever let them out gets thanked + if(hid_in_ref && !container) + hid_in_ref = null + var/mob/living/opener = nearest_person(here, 2) + if(opener) + mark_greeted(opener) + contacted = TRUE + face_atom(opener) + speak_context("freed", opener, force = TRUE) + var/mob/living/threat = container ? null : nearest_threat(here) + if(threat) + last_threat_at = world.time + if(is_following()) + if(threat && reaction_ready("duck", SURVIVOR_DUCK_COOLDOWN)) + duck(threat) + return + if(threat) + react_threat(threat, here) + return + var/mob/living/person = new_person_in_sight(here, container) + if(person) + contacted = TRUE + start_activity(new /datum/ambient_activity/survivor_call(src, person)) + return + if(!contacted) + distress_call(here) + +/** + * A threat in sight, while nobody is leading them out. Close, or after them: they run. Further off: + * they keep still, and warn anyone there. + */ +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/react_threat(mob/living/threat, turf/here) + var/after_us = threat.ai_controller?.blackboard[BB_BASIC_MOB_CURRENT_TARGET] == src + if(get_dist(here, threat) <= SURVIVOR_FLEE_DISTANCE || after_us) + if(!istype(activity, /datum/ambient_activity/survivor_flee)) + start_activity(new /datum/ambient_activity/survivor_flee(src, threat)) + return + if(istype(activity, /datum/ambient_activity/survivor_flee)) + return + // Walking up to someone with that about? No. + if(istype(activity, /datum/ambient_activity/survivor_call)) + end_activity() + if(isturf(loc) && !crouching) + crouch() + var/mob/living/person = nearest_person(here, SURVIVOR_SIGHT) + if(person) + contacted = TRUE + mark_greeted(person) + if(reaction_ready("warn", 15 SECONDS)) + speak_context("warn", person, force = TRUE) + return + if(!reaction_ready("cower", 30 SECONDS)) + return + if(prob(50)) + speak_context("cower", threat, force = TRUE) + else + manual_emote(pick("freezes.", "holds [p_their()] breath.", "presses [p_themselves()] against the wall.")) + +/// Following, and something is coming: they duck down and yelp, and stay with their rescuer +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/duck(mob/living/threat) + if(!isturf(loc)) + return + speak_context("duck", threat, force = TRUE) + if(crouching || buckled) + return + crouch() + addtimer(CALLBACK(src, PROC_REF(stop_ducking)), SURVIVOR_DUCK_TIME, TIMER_UNIQUE | TIMER_OVERRIDE) + +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/stop_ducking() + if(crouching && is_following()) + stand_up() + +/// Whether `thing` is something they should be afraid of: awake, nobody's player, not a person, and out to hurt someone +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/is_threat(mob/living/thing) + if(thing == src || thing.stat != CONSCIOUS || thing.client || istype(thing, /mob/living/carbon/human/npc/ambient_npc)) + return FALSE + if(faction_check_atom(thing)) + return FALSE + return mission_survivor_dangerous(thing) + +/// The nearest threat they can see from `here`, or null +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/nearest_threat(turf/here) + var/mob/living/nearest + var/nearest_distance = INFINITY + for(var/mob/living/thing in hearers(SURVIVOR_SIGHT, here)) + if(!is_threat(thing)) + continue + var/distance = get_dist(here, thing) + if(distance < nearest_distance) + nearest = thing + nearest_distance = distance + return nearest + +/** + * The nearest awake person (someone played) within `range` of `here` that they can see, or null. + * From inside a locker they can't see out, so it goes by ear: anyone close enough counts. + * `skip_greeted` leaves out people they already called out to. + */ +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/nearest_person(turf/here, range, by_ear = FALSE, skip_greeted = FALSE) + var/mob/living/nearest + var/nearest_distance = INFINITY + for(var/mob/living/person in SSspatial_grid.orthogonal_range_search(here, SPATIAL_GRID_CONTENTS_TYPE_CLIENTS, range)) + if(person == src || person.stat != CONSCIOUS) + continue + var/turf/there = get_turf(person) + if(!there || there.z != here.z) + continue + var/distance = get_dist(here, there) + if(distance > range || distance >= nearest_distance) + continue + if(skip_greeted && LAZYFIND(greeted, REF(person))) + continue + if(!by_ear && !can_see(here, there, range)) + continue + nearest = person + nearest_distance = distance + return nearest + +/// Someone they have not called out to yet, in sight (or in earshot from a locker), or null. They count as called out to from now. +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/new_person_in_sight(turf/here, obj/structure/closet/container) + var/mob/living/person = container ? nearest_person(here, SURVIVOR_HEARING_RANGE, by_ear = TRUE, skip_greeted = TRUE) : nearest_person(here, SURVIVOR_SIGHT, skip_greeted = TRUE) + if(person) + mark_greeted(person) + return person + +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/mark_greeted(mob/living/person) + var/key = REF(person) + if(LAZYFIND(greeted, key)) + return + LAZYADD(greeted, key) + if(length(greeted) > 20) + greeted.Cut(1, 2) + +/** + * Nobody has found them yet: their beacon picks up the contract crew's ship and they talk into it. + * Heard on the radios of that crew within SURVIVOR_DISTRESS_RANGE, as a weak signal. + */ +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/distress_call(turf/here) + if(world.time < next_distress) + return + var/datum/mission/contract = contract_ref?.resolve() + var/obj/structure/overmap/ship/ship = contract?.servant + if(!ship) + return + var/list/listeners = list() + for(var/mob/living/person in SSspatial_grid.orthogonal_range_search(here, SPATIAL_GRID_CONTENTS_TYPE_CLIENTS, SURVIVOR_DISTRESS_RANGE)) + if(person.stat == DEAD) + continue + var/turf/there = get_turf(person) + if(!there || there.z != here.z || get_dist(here, there) > SURVIVOR_DISTRESS_RANGE) + continue + if(ambient_crew_ship(person) != ship) + continue + listeners += person + if(!length(listeners)) + return + next_distress = world.time + rand(SURVIVOR_DISTRESS_GAP_LOW, SURVIVOR_DISTRESS_GAP_HIGH) + var/list/lines = get_lines("distress") + if(!length(lines)) + return + var/line = fill_line(pick(lines)) + for(var/mob/living/person as anything in listeners) + to_chat(person, span_radio("\[Distress\] [real_name] says, \"[line]\"")) + person.playsound_local(get_turf(person), 'sound/misc/interference.ogg', 20, FALSE) + +/** + * Their hiding activity's tick: up on their feet when someone is right there, down again when + * they are alone; a plea to whoever is close; otherwise a fidget now and then. + */ +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/hide_tick() + var/turf/here = get_turf(src) + if(!here) + return + if(!isturf(loc)) + return // shut in somewhere, keeping quiet + var/mob/living/near = nearest_person(here, SURVIVOR_NEAR_RANGE) + var/scared = world.time - last_threat_at < 5 SECONDS + if(near && !scared) + if(crouching) + stand_up() + if(!buckled) + face_atom(near) + if(reaction_ready("plead", 40 SECONDS)) + speak_context(rescued ? "wait_idle" : "plead", near, force = TRUE) + return + if(!near && !crouching && !buckled) + crouch() + if(world.time < next_fidget) + return + next_fidget = world.time + rand(40 SECONDS, 80 SECONDS) + if(prob(40)) + speak_context(rescued ? "wait_idle" : "hide", null, force = TRUE) + return + manual_emote(pick( + "hugs [p_their()] knees.", + "shivers.", + "taps at the beacon on [p_their()] wrist.", + "listens, very still.", + "rocks back and forth.", + )) + +/** + * Where to run from `threat`: a free tile within SURVIVOR_FLEE_RANGE, further from it than they are, + * on their own side of it (so the way there doesn't pass it), in sight from where they stand (so + * the way there is short), best out of its sight with a wall at their back. Null if nowhere. + */ +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/flee_tile(mob/living/threat, list/avoid) + var/turf/here = get_turf(src) + var/turf/danger = get_turf(threat) + if(!here || !danger || here.z != danger.z) + return null + var/start_gap = get_dist(here, danger) + var/turf/best + var/best_score = -INFINITY + for(var/turf/tile as anything in RANGE_TURFS(SURVIVOR_FLEE_RANGE, here)) + var/gap = get_dist(tile, danger) + if(gap < start_gap + 2 || get_dist(tile, here) >= gap) + continue + if(!standable(tile, avoid) || !can_see(here, tile, SURVIVOR_FLEE_RANGE + 1)) + continue + var/score = gap + rand(0, 3) + if(!can_see(danger, tile, SURVIVOR_SIGHT + 2)) + score += 4 + if(ambient_backed_by_wall_or_table(tile)) + score += 1 + if(score > best_score) + best = tile + best_score = score + return best + +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/react_attacked(atom/attacker) + if(stat != CONSCIOUS || fading || beaming_out || !reaction_ready("attacked", 4 SECONDS)) + return + var/mob/living/hitter = isliving(attacker) ? attacker : null + speak_context(hitter?.client ? "hurt_by_person" : "hurt", attacker, force = TRUE) + if(is_following()) + if(hitter) + duck(hitter) + return + if(hitter) + start_activity(new /datum/ambient_activity/survivor_flee(src, hitter)) + +// ========================================================================= +// LEAVING: THE BEAM +// ========================================================================= + +/** + * Taken up from orbit: a column of light comes down on them, they lift and come apart in it, and + * they are gone. They are held still meanwhile. Somewhere nobody can see, they just go. + * `farewell` has them say goodbye first (delivered home). `force_visual` draws the beam even + * with nobody about (unit tests). + */ +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/beam_out(farewell = FALSE, force_visual = FALSE) + if(beaming_out || QDELETED(src)) + return + var/turf/spot = get_turf(src) + if(!spot || (!force_visual && !mission_survivor_watched(spot))) + beaming_out = TRUE + qdel(src) + return + var/was_awake = stat == CONSCIOUS && isturf(loc) + if(was_awake) + setDir(SOUTH) // face front, so the dissolve reads + if(farewell) + speak_context("goodbye", null, force = TRUE) + manual_emote("waves.") + else + manual_emote("looks up.") + beaming_out = TRUE + fading = TRUE + end_activity() + stand_up() + add_traits(list(TRAIT_AI_PAUSED, TRAIT_IMMOBILIZED, TRAIT_NO_FLOATING_ANIM), SURVIVOR_TRAIT) + pulledby?.stop_pulling() + stop_pulling() + buckled?.unbuckle_mob(src, force = TRUE) + set_anchored(TRUE) + move_resist = INFINITY + mouse_opacity = MOUSE_OPACITY_TRANSPARENT + playsound(spot, 'sound/effects/magic/teleport_diss.ogg', 40, TRUE) + new /obj/effect/temp_visual/transporter_beam(spot, SURVIVOR_BEAM_TIME + 0.5 SECONDS) + addtimer(CALLBACK(src, PROC_REF(beam_dissolve)), SURVIVOR_BEAM_DROP) + addtimer(CALLBACK(src, PROC_REF(beam_gone)), SURVIVOR_BEAM_TIME) + +/// The column is down: they lift a little and come apart in it, head first +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/beam_dissolve() + if(!isturf(loc)) + return // shut in a locker: the column takes them through it + var/dissolve_time = SURVIVOR_BEAM_TIME - SURVIVOR_BEAM_DROP + new /obj/effect/abstract/particle_holder(src, /particles/transporter_motes, PARTICLE_ATTACH_MOB) + transporter_dematerialise(src, dissolve_time) + animate(src, pixel_z = pixel_z + 8, time = dissolve_time, easing = SINE_EASING | EASE_IN, flags = ANIMATION_PARALLEL) + +/// Gone: the last flash where they stood, and the column lifts back up without them +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/proc/beam_gone() + var/turf/spot = get_turf(src) + if(spot) + new /obj/effect/temp_visual/transporter_flash/departure(spot) + playsound(spot, 'sound/effects/magic/teleport_app.ogg', 50, TRUE) + qdel(src) + +/// Whether anyone with a client is close enough to `spot` to see a beam come down there +/proc/mission_survivor_watched(turf/spot) + for(var/mob/viewer in SSspatial_grid.orthogonal_range_search(spot, SPATIAL_GRID_CONTENTS_TYPE_CLIENTS, SURVIVOR_BEAM_WATCH_RANGE)) + if(!viewer.client) + continue + var/turf/there = get_turf(viewer) + if(there?.z == spot.z && get_dist(there, spot) <= SURVIVOR_BEAM_WATCH_RANGE) + return TRUE + return FALSE + +// ========================================================================= +// WHAT THEY SAY +// ========================================================================= + +// Their own lines only: none of the ambient core's chatter fits someone in this state +/mob/living/carbon/human/npc/ambient_npc/mission_survivor/get_lines(context) + var/static/list/lines = list( + // Hiding alone, under their breath + "hide" = list( + "#Come on. Somebody heard it.", + "#Stay quiet. Stay quiet.", + "#Please, please, please.", + "#Beacon's still on. It's still on.", + ), + // A threat about and nobody there + "cower" = list( + "#Don't see me. Don't see me.", + "#Go away. Please go away.", + "#Oh no. Oh no.", + ), + // A threat about, and people there + "warn" = list( + "Look out!", + "There's more of them!", + "Watch it, they're coming!", + ), + // First sight of someone + "call" = list( + "Over here!", + "Hey! Hey, over here!", + "Is someone there? Please!", + "Here! I'm over here!", + "You came. You actually came.", + ), + // First sound of someone, from a locker + "call_locker" = list( + "In here! I'm in here!", + "Is someone out there? Let me out!", + "Don't go! I'm in here!", + ), + // Let out of the locker + "freed" = list( + "Oh, thank god.", + "Thank you. Thank you.", + "I thought you were one of them.", + ), + // Someone right there, not taking them yet + "plead" = list( + "Please, get me out of here.", + "Are you taking me out? Please say yes.", + "Can we go? Please?", + ), + "flee" = list( + "No no no!", + "Get away from me!", + "Help! Help!", + "Somebody help!", + ), + "hurt" = list( + "Agh!", + "Ow! Help!", + "Please! Stop!", + ), + "hurt_by_person" = list( + "Hey! I'm on your side!", + "Ow! What was that for?", + "Watch where you're shooting!", + ), + "follow" = list( + "Right behind you.", + "Okay. Okay. Let's go.", + "Don't leave me behind.", + "Right behind you. Please don't be wrong about the way out.", + ), + "wait" = list( + "I'll... wait right here.", + "Don't be long.", + "Okay. I'll be here.", + ), + "refuse" = list( + "I'm with them.", + "No. I'm going with them.", + ), + // Following, now and then + "follow_idle" = list( + "Is your ship far?", + "I thought nobody was coming.", + "How long was I in there?", + "Thank you. Really.", + "Do you have any water?", + ), + // Following, and something is coming + "duck" = list( + "What was that?", + "Something's moving!", + "Don't let it near me!", + "Get down!", + ), + "lost" = list( + "Hello? Where'd you go?", + "Don't leave me here!", + "Hello?", + ), + "leader_down" = list( + "No. No, no, no.", + "Get up. Please, get up.", + ), + "trapped" = list( + "Let me out!", + "Hey! Open this!", + ), + "aboard" = list( + "Is this your ship? Oh, thank god.", + "A real ship. Lights and everything.", + ), + // Waiting where they were told, or near someone after being rescued + "wait_idle" = list( + "Is it much further?", + "I'll stay right here.", + "Are we leaving soon?", + ), + "goodbye" = list( + "Thank you. I mean it.", + "I owe you. All of you.", + "Thank you. Really.", + ), + // Over the radio, before anyone has found them + "distress" = list( + "Is anyone out there? Please.", + "This is {name}. I'm still here.", + "I can hear a ship. Please don't leave.", + "Hello? Anyone? Please.", + "Still here. Still here. Please.", + ), + ) + var/list/found = lines[context] + return islist(found) ? found : list() + +// ========================================================================= +// THEIR LOOK +// ========================================================================= + +/// What they have been living in: an orange emergency suit over their work clothes, helmet on and a tank of air +/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/workboots + internals_slot = ITEM_SLOT_BACK + +// ========================================================================= +// THEIR BRAIN +// ========================================================================= + +/// The ambient routine runner, with their senses in front of it. Unlike the rest of the ambient +/// core they never resist being pulled, carried, buckled or shut in: that is how a crew gets them out. +/datum/ai_controller/basic_controller/ambient_npc/mission_survivor + planning_subtrees = list( + /datum/ai_planning_subtree/mission_survivor_senses, + /datum/ai_planning_subtree/ambient_routine, + ) + // Awake while a crew is still a few screens off, for the distress call + interesting_dist = 24 + +/// Looks around and reacts; the routine subtree after it does the walking +/datum/ai_planning_subtree/mission_survivor_senses + +/datum/ai_planning_subtree/mission_survivor_senses/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick) + var/mob/living/carbon/human/npc/ambient_npc/mission_survivor/survivor = controller.pawn + if(istype(survivor) && controller.ai_status == AI_STATUS_ON) + survivor.look_around() + +// ========================================================================= +// WHAT THEY DO +// ========================================================================= + +/// Keeping their head down where they are told to stay, or where they last stopped +/datum/ambient_activity/survivor_hide + name = "hiding" + +/datum/ambient_activity/survivor_hide/setup() + var/mob/living/carbon/human/npc/ambient_npc/mission_survivor/survivor = doer + var/turf/hide_at = istype(survivor) ? survivor.hide_spot : null + if(isturf(doer.loc) && hide_at && hide_at != doer.loc && hide_at.z == doer.z && get_dist(doer, hide_at) <= SURVIVOR_FOLLOW_RANGE && doer.standable(hide_at, failed_spots)) + go_to(hide_at) + return TRUE + +/datum/ambient_activity/survivor_hide/act(seconds) + var/mob/living/carbon/human/npc/ambient_npc/mission_survivor/survivor = doer + if(istype(survivor)) + survivor.hide_tick() + return AMBIENT_STEP_CONTINUE + +/datum/ambient_activity/survivor_hide/spot_unreachable() + . = ..() + var/mob/living/carbon/human/npc/ambient_npc/mission_survivor/survivor = doer + if(istype(survivor)) + survivor.hide_spot = get_turf(doer) + +/// Calling out to someone they spotted, waving, and coming over if it is safe; from a locker, banging on it +/datum/ambient_activity/survivor_call + name = "calling out" + priority = AMBIENT_PRIORITY_REACTION + duration_low = 15 SECONDS + duration_high = 20 SECONDS + +/datum/ambient_activity/survivor_call/setup() + var/mob/living/person = anchor() + var/mob/living/carbon/human/npc/ambient_npc/mission_survivor/survivor = doer + if(!isliving(person) || !istype(survivor)) + return FALSE + set_duration() + if(istype(doer.loc, /obj/structure/closet)) + survivor.bang_on(doer.loc) + doer.speak_context("call_locker", person, force = TRUE) + return TRUE + doer.stand_up() + doer.face_atom(person) + doer.manual_emote(pick("waves both arms.", "waves.", "waves weakly.")) + doer.speak_context("call", person, force = TRUE) + var/distance = get_dist(doer, person) + if(distance > 2 && distance <= SURVIVOR_APPROACH_RANGE) + go_to(get_turf(person), 2) + return TRUE + +/datum/ambient_activity/survivor_call/act(seconds) + var/mob/living/person = anchor() + var/turf/there = get_turf(person) + if(!person || person.stat == DEAD || there?.z != doer.z) + return AMBIENT_STEP_DONE + var/obj/structure/closet/container = doer.loc + if(istype(container)) + var/mob/living/carbon/human/npc/ambient_npc/mission_survivor/survivor = doer + // Right outside: they push it open themselves + if(get_dist(container, person) <= 1 && container.open()) + return AMBIENT_STEP_DONE + if(istype(survivor) && survivor.reaction_ready("bang", 6 SECONDS)) + survivor.bang_on(container) + return AMBIENT_STEP_CONTINUE + if(spot && get_dist(doer, person) > 2) + if(LAZYACCESS(failed_spots, there)) + return AMBIENT_STEP_DONE + go_to(there, 2) + return AMBIENT_STEP_MOVE + if(!doer.buckled) + doer.face_atom(person) + return AMBIENT_STEP_DONE + +/datum/ambient_activity/survivor_call/finish() + var/mob/living/carbon/human/npc/ambient_npc/mission_survivor/survivor = doer + if(istype(survivor) && isturf(survivor.loc)) + survivor.hide_spot = survivor.loc + return ..() + +/// Running from something, then down in a crouch wherever they got to +/datum/ambient_activity/survivor_flee + name = "running" + priority = SURVIVOR_FLEE_PRIORITY + /// How many more times a threat that keeps coming can send them on + var/runs_left = SURVIVOR_FLEE_RUNS + +/datum/ambient_activity/survivor_flee/setup() + var/mob/living/threat = anchor() + var/mob/living/carbon/human/npc/ambient_npc/mission_survivor/survivor = doer + if(!isliving(threat) || !istype(survivor)) + return FALSE + ends_at = world.time + SURVIVOR_FLEE_TIME + doer.set_pace(running = TRUE) + if(survivor.reaction_ready("flee_line", 6 SECONDS)) + doer.speak_context("flee", threat, force = TRUE) + var/turf/away = isturf(doer.loc) ? survivor.flee_tile(threat, failed_spots) : null + if(away) + doer.stand_up() + go_to(away) + else + // Nowhere to go: down, arms over their head + doer.crouch() + return TRUE + +/datum/ambient_activity/survivor_flee/arrive() + doer.crouch() + +/datum/ambient_activity/survivor_flee/act(seconds) + var/mob/living/threat = anchor() + if(!threat || threat.stat != CONSCIOUS) + return AMBIENT_STEP_DONE + if(runs_left > 0 && get_dist(doer, threat) <= 2 && isturf(doer.loc)) + var/mob/living/carbon/human/npc/ambient_npc/mission_survivor/survivor = doer + var/turf/away = survivor.flee_tile(threat, failed_spots) + if(away) + runs_left-- + doer.stand_up() + go_to(away) + return AMBIENT_STEP_MOVE + return AMBIENT_STEP_CONTINUE + +/datum/ambient_activity/survivor_flee/finish() + if(!QDELETED(doer)) + doer.set_pace(running = FALSE) + var/mob/living/carbon/human/npc/ambient_npc/mission_survivor/survivor = doer + if(istype(survivor) && isturf(survivor.loc)) + survivor.hide_spot = survivor.loc + return ..() + +/// At their rescuer's side as they move, facing them when they stop; out of anything they get shut in +/datum/ambient_activity/survivor_follow + name = "following" + priority = SURVIVOR_FOLLOW_PRIORITY + spot_distance = 1 + /// world.time their rescuer went out of reach, or 0 + var/lost_since = 0 + /// They called out for their rescuer since losing them + var/called_lost = FALSE + +/datum/ambient_activity/survivor_follow/setup() + if(!isliving(anchor())) + return FALSE + next_line = world.time + rand(40 SECONDS, 80 SECONDS) + // They keep up with whoever is getting them out + doer.set_pace(running = TRUE) + return TRUE + +/datum/ambient_activity/survivor_follow/finish() + if(!QDELETED(doer)) + doer.set_pace(running = FALSE) + return ..() + +/// Whether `leader` can still be followed: alive, on this level, near enough +/datum/ambient_activity/survivor_follow/proc/in_reach(mob/living/leader) + var/turf/there = get_turf(leader) + var/turf/here = get_turf(doer) + return leader && leader.stat != DEAD && there && here && there.z == here.z && get_dist(here, there) <= SURVIVOR_FOLLOW_RANGE + +// Where they go is wherever their rescuer is now +/datum/ambient_activity/survivor_follow/at_spot() + if(!isturf(doer.loc)) + return TRUE // act() gets them out first + var/mob/living/leader = anchor() + if(!in_reach(leader) || get_dist(doer, leader) <= 1) + return TRUE + if(doer.crouching) + doer.stand_up() + var/turf/there = get_turf(leader) + if(spot != there) + go_to(there, 1) + return FALSE + +/datum/ambient_activity/survivor_follow/act(seconds) + var/mob/living/carbon/human/npc/ambient_npc/mission_survivor/survivor = doer + if(!istype(survivor)) + return AMBIENT_STEP_DONE + if(!isturf(doer.loc)) + survivor.climb_out() + return AMBIENT_STEP_CONTINUE + var/mob/living/leader = anchor() + if(leader?.stat == DEAD && get_dist(doer, leader) <= SURVIVOR_SIGHT) + survivor.leader_fell(leader) + return AMBIENT_STEP_DONE + if(!in_reach(leader)) + if(!lost_since) + lost_since = world.time + if(!called_lost && world.time - lost_since > 8 SECONDS) + called_lost = TRUE + doer.speak_context("lost", null, force = TRUE) + if(world.time - lost_since >= SURVIVOR_LOST_TIME) + survivor.lose_leader() + return AMBIENT_STEP_DONE + return AMBIENT_STEP_CONTINUE + lost_since = 0 + called_lost = FALSE + if(get_dist(doer, leader) <= 2 && !doer.buckled) + doer.face_atom(leader) + survivor.check_aboard() + chatter("follow_idle", 60 SECONDS, 120 SECONDS) + return AMBIENT_STEP_CONTINUE + +// A spot they could not reach is just their rescuer's last one: they try again from where they are +/datum/ambient_activity/survivor_follow/spot_unreachable() + spot = null + arrived = FALSE + +// ========================================================================= +// WHERE THEY HIDE +// ========================================================================= + +/** + * Where a survivor hides at `target`, looking around `near` (the site's spawn point): list(turf, + * locker or null). Half the time a locker if there is one (they get in it), otherwise a corner or + * an alcove, never beside open space or on a docked ship, and never within + * SURVIVOR_SHELTER_THREAT_GAP of anything hostile already loose in there. Falls back to `near`. + * + * Bounded (a square of SURVIVOR_SHELTER_RADIUS around `near`) and never sleeps: it runs from the + * site's loaded signal. + */ +/proc/mission_survivor_hiding_place(turf/near, datum/mission_target/target) + . = list(near, null) + if(!near || !target) + return + var/list/dangers = list() + for(var/mob/living/thing as anything in GLOB.mob_living_list) + if(thing.z != near.z || thing.stat == DEAD || thing.client) + continue + if(get_dist(thing, near) > SURVIVOR_SHELTER_RADIUS + SURVIVOR_SHELTER_THREAT_GAP) + continue + if(FACTION_NEUTRAL in thing.faction) + continue + if(mission_survivor_dangerous(thing)) + dangers += get_turf(thing) + var/list/lockers = list() + var/list/nooks = list() + var/best_cover = 0 + for(var/turf/open/tile in RANGE_TURFS(SURVIVOR_SHELTER_RADIUS, near)) + if(isspaceturf(tile) || isgroundlessturf(tile) || islava(tile) || ischasm(tile)) + continue + if(istype(tile.loc, /area/shuttle) || !target.contains_turf(tile)) + continue + if(length(dangers) && ambient_too_close(tile, dangers, SURVIVOR_SHELTER_THREAT_GAP)) + continue + var/obj/structure/closet/locker = locate() in tile + if(locker) + if(mission_survivor_locker_ok(locker)) + lockers += locker + continue + if(tile.is_blocked_turf(exclude_mobs = TRUE)) + continue + var/cover = mission_survivor_cover(tile) + if(cover < SURVIVOR_SHELTER_MIN_COVER) + continue + nooks[tile] = cover + best_cover = max(best_cover, cover) + if(length(lockers) && (prob(50) || !length(nooks))) + var/obj/structure/closet/locker = pick(lockers) + return list(get_turf(locker), locker) + if(!length(nooks)) + return + // The snuggest spots, not always the single snuggest one + var/list/best = list() + for(var/turf/tile as anything in nooks) + if(nooks[tile] >= best_cover - 1) + best += tile + return list(pick(best), null) + +/// Neighbours (of 8) of `tile` that are walls or blocked, or 0 if it opens onto space or has no free way in +/proc/mission_survivor_cover(turf/tile) + var/blocked = 0 + var/way_in = FALSE + for(var/direction in GLOB.alldirs) + var/turf/neighbour = get_step(tile, direction) + if(!neighbour || isspaceturf(neighbour) || isgroundlessturf(neighbour)) + return 0 + if(neighbour.is_blocked_turf(exclude_mobs = TRUE)) + blocked++ + else if(direction in GLOB.cardinals) + way_in = TRUE + return way_in ? blocked : 0 + +/// A locker a survivor can shut themselves in, and that someone can get to and open +/proc/mission_survivor_locker_ok(obj/structure/closet/locker) + if(locker.locked || locker.welded || locker.wall_mounted || locker.horizontal) + return FALSE + if(istype(locker, /obj/structure/closet/body_bag) || (locker.resistance_flags & INDESTRUCTIBLE)) + return FALSE + if(locker.max_mob_size < MOB_SIZE_HUMAN || locker.mob_storage_capacity < 1 || (locate(/mob/living) in locker)) + return FALSE + if(locker.opened && !locker.can_close()) + return FALSE + for(var/direction in GLOB.cardinals) + var/turf/neighbour = get_step(locker, direction) + if(neighbour && !isspaceturf(neighbour) && !neighbour.is_blocked_turf(exclude_mobs = TRUE)) + return TRUE + return FALSE + +/** + * Whether `thing` is out to hurt people: a hostile legacy animal, or a mob whose AI picks targets. + * Faction is the caller's business. + */ +/proc/mission_survivor_dangerous(mob/living/thing) + if(istype(thing, /mob/living/simple_animal/hostile)) + return TRUE + return !!thing.ai_controller?.blackboard[BB_TARGETING_STRATEGY] + +#undef SURVIVOR_SIGHT +#undef SURVIVOR_LOOK_INTERVAL +#undef SURVIVOR_FLEE_DISTANCE +#undef SURVIVOR_FLEE_RANGE +#undef SURVIVOR_FLEE_TIME +#undef SURVIVOR_FLEE_RUNS +#undef SURVIVOR_DISTRESS_RANGE +#undef SURVIVOR_DISTRESS_GAP_LOW +#undef SURVIVOR_DISTRESS_GAP_HIGH +#undef SURVIVOR_APPROACH_RANGE +#undef SURVIVOR_NEAR_RANGE +#undef SURVIVOR_HEARING_RANGE +#undef SURVIVOR_FOLLOW_RANGE +#undef SURVIVOR_LOST_TIME +#undef SURVIVOR_FOLLOW_PRIORITY +#undef SURVIVOR_FLEE_PRIORITY +#undef SURVIVOR_DUCK_TIME +#undef SURVIVOR_DUCK_COOLDOWN +#undef SURVIVOR_SHELTER_RADIUS +#undef SURVIVOR_SHELTER_THREAT_GAP +#undef SURVIVOR_SHELTER_MIN_COVER +#undef SURVIVOR_BEAM_TIME +#undef SURVIVOR_BEAM_DROP +#undef SURVIVOR_BEAM_WATCH_RANGE +#undef SURVIVOR_TRAIT diff --git a/voidcrew/modules/missions/objectives/site_ops.dm b/voidcrew/modules/missions/objectives/site_ops.dm index ca946692ed3..519e75acb19 100644 --- a/voidcrew/modules/missions/objectives/site_ops.dm +++ b/voidcrew/modules/missions/objectives/site_ops.dm @@ -18,12 +18,15 @@ /datum/mission_objective/field/plant_quest /// The quest item type planted at the site var/quest_item_type = /obj/item/mission_recovery + /// Set dressing laid around the item (a /datum/mission_scene path, null for none) + var/scene_type = /datum/mission_scene/dropped_case /datum/mission_objective/field/plant_quest/spawn_field_objects(turf/spawn_turf) var/obj/item/mission_recovery/quest_item = new quest_item_type(spawn_turf) quest_item.name = mission.objective_name mission.bind_item(quest_item) mission.register_quest_atom(quest_item) + dress_mission_scene(scene_type, spawn_turf, mission.target) complete() /datum/mission_objective/field/plant_quest/get_progress_string() @@ -91,23 +94,30 @@ /datum/mission_objective/field/pylon_chain/proc/pick_spawn_spots(turf/anchor) var/list/spots = list(anchor) var/datum/mission_target/target = mission?.target + // Out of sight first; ground a crew can see is only used if the rest can't hold the set + var/datum/spawn_cover/cover = new(anchor.z) var/list/candidates = list() + var/list/in_view = list() for(var/turf/open/tile in RANGE_TURFS(PYLON_SCATTER_RADIUS, anchor)) if(isspaceturf(tile) || tile.is_blocked_turf(exclude_mobs = TRUE)) continue if(target && !target.contains_turf(tile)) continue - candidates += tile - while(length(spots) < points_total && length(candidates)) - var/turf/candidate = pick_n_take(candidates) - var/too_close = FALSE - for(var/turf/taken as anything in spots) - if(get_dist(candidate, taken) < PYLON_MIN_SPACING) - too_close = TRUE - break - if(too_close) - continue - spots += candidate + if(cover.is_hidden(tile)) + candidates += tile + else + in_view += tile + for(var/list/pool as anything in list(candidates, in_view)) + while(length(spots) < points_total && length(pool)) + var/turf/candidate = pick_n_take(pool) + var/too_close = FALSE + for(var/turf/taken as anything in spots) + if(get_dist(candidate, taken) < PYLON_MIN_SPACING) + too_close = TRUE + break + if(too_close) + continue + spots += candidate // Cramped site: take whatever's open rather than hand back a short set while(length(spots) < points_total) spots += get_nearby_open_turf(anchor, 3) @@ -121,6 +131,7 @@ pylon.name = "survey pylon [length(pylons) + 1] of [points_total]" pylon.objective_ref = WEAKREF(src) pylons += pylon + dress_mission_scene(/datum/mission_scene/pylon_drop, spawn_turf, mission?.target) /// The first pylon still waiting on calibration /datum/mission_objective/field/pylon_chain/proc/next_pylon() @@ -299,7 +310,7 @@ */ /datum/mission_objective/field/escort /// The survivor mob type - var/survivor_type = /mob/living/carbon/human/npc/mission_survivor + var/survivor_type = /mob/living/carbon/human/npc/ambient_npc/mission_survivor /// The live survivor var/mob/living/survivor /// Health fraction at turn-in for the "still walking" pay bonus @@ -341,6 +352,9 @@ * * The successful turn-in has already nulled the ref by the time deactivation * runs, so a repatriated survivor never reaches this. + * + * Whoever is watching sees them taken up from orbit in a column of light + * (beam_out()); this is usually aboard the crew's own ship, mid-escort. */ /datum/mission_objective/field/escort/proc/release_survivor() clear_grace() @@ -349,11 +363,20 @@ if(QDELETED(leaving)) return UnregisterSignal(leaving, list(COMSIG_LIVING_DEATH, COMSIG_LIVING_REVIVE)) - leaving.visible_message(span_notice("[leaving]'s beacon chirps, and they are teleported away.")) + var/mob/living/carbon/human/npc/ambient_npc/mission_survivor/person = leaving + if(istype(person)) + person.beam_out() + return qdel(leaving) +/// The survivor goes somewhere sheltered in the site (a locker, a corner), not just any open tile /datum/mission_objective/field/escort/spawn_field_objects(turf/spawn_turf) - survivor = new survivor_type(spawn_turf) + var/list/hiding_place = mission_survivor_hiding_place(spawn_turf, mission?.target) + survivor = new survivor_type(hiding_place[1] || spawn_turf) + var/mob/living/carbon/human/npc/ambient_npc/mission_survivor/person = survivor + if(istype(person)) + person.join_contract(mission) + person.take_shelter(hiding_place[2]) protect_field_mob(survivor) RegisterSignal(survivor, COMSIG_LIVING_DEATH, PROC_REF(on_survivor_death)) RegisterSignal(survivor, COMSIG_LIVING_REVIVE, PROC_REF(on_survivor_revived)) @@ -444,14 +467,17 @@ if(!was_revived && survivor.health >= survivor.maxHealth * unharmed_threshold) mission.value *= unharmed_bonus notify_crew("Survivor recovered unharmed.") - // Repatriation: they step onto the pad and ship out + // Repatriation: a goodbye, and the beam takes them home from beside the pad var/mob/living/leaving = survivor UnregisterSignal(leaving, list(COMSIG_LIVING_DEATH, COMSIG_LIVING_REVIVE)) survivor = null - leaving.visible_message(span_notice("[leaving] waves goodbye and is teleported out.")) if(istype(reward_anchor, /obj/machinery/mission_pad)) var/obj/machinery/mission_pad/pad = reward_anchor pad.do_teleport_effect() + var/mob/living/carbon/human/npc/ambient_npc/mission_survivor/person = leaving + if(istype(person)) + person.beam_out(farewell = TRUE) + return qdel(leaving) /datum/mission_objective/field/escort/get_progress_string() @@ -470,20 +496,28 @@ /** * The prospect-stake centerpiece: a claim beacon kit is dispensed at accept; - * deploying it (only with the ship holding at the target coordinates) files - * the claim on Wideband - everyone hears - and starts a defend clock that - * only runs while the ship stays on station. The beacon survives, it prints - * the deed; the beacon dies, the contract dies with it. + * deploying it on the site's open ground (the kit decides where) files the + * claim on Wideband - everyone hears - and starts a defend clock that only + * runs while a crew member stands guard at the beacon. Waves come on that + * clock, not the wall clock, so stepping away never calls extra company. The + * beacon survives, it prints the deed; the beacon dies, the contract dies + * with it. */ /datum/mission_objective/claim_defense /// How long the beacon must survive after deployment var/defend_duration = 8 MINUTES /// Seconds of defense remaining (set on deploy) var/defend_remaining = 0 - /// How far (overmap tiles) the ship may drift from the stake coordinates - var/hold_range = 2 - /// Interval between defender waves while the clock runs + /// How close (tiles) a crew member must stand to the beacon for the clock to run + var/guard_range = 7 + /// A guard idle at the keyboard this long stops counting + var/guard_afk_time = 3 MINUTES + /// Guarded time before the first defender wave + var/first_wave_delay = 1 MINUTES + /// Guarded time between defender waves var/wave_interval = 2 MINUTES + /// Seconds of guarded time left until the next wave + var/wave_countdown = 0 /// zone_mobs theme answering the claim (set by the mission) var/wave_theme /// The kit handed over at accept @@ -492,6 +526,10 @@ var/obj/structure/mission_claim_beacon/beacon /// Whether the deed has printed (beacon survived) var/deed_printed = FALSE + /// Whether the last tick found nobody standing guard + var/unguarded = FALSE + /// Throttle for the unattended-beacon notice + COOLDOWN_DECLARE(unguarded_notice_cooldown) /datum/mission_objective/claim_defense/deactivate() if(beacon) @@ -516,19 +554,33 @@ mission.fail("No mission pad to dispense the claim beacon to.") return FALSE kit = new(kit_turf) + mission_pad_delivery_effect(kit_turf) kit.objective_ref = WEAKREF(src) notify_crew("Claim beacon kit delivered.") return TRUE -/// Whether the ship is close enough to the stake coordinates to count -/datum/mission_objective/claim_defense/proc/ship_on_station() +/** + * Whether a crew member is standing guard: alive, awake, at the keyboard, out + * on the site's ground rather than inside a hull, and within guard_range of + * the beacon. Nobody there, no clock. + */ +/datum/mission_objective/claim_defense/proc/is_guarded() var/obj/structure/overmap/ship/ship = get_servant() - var/datum/mission_target/target = mission?.target - if(!ship || !target) + var/datum/team/crew_team = ship?.ship_team + var/turf/beacon_turf = get_turf(beacon) + if(!crew_team || !beacon_turf) return FALSE - var/rel_x = ship.x - var/rel_y = ship.y - OVERMAP_SOUTH_SIDE_COORD + 1 - return sqrt((rel_x - target.target_x) ** 2 + (rel_y - target.target_y) ** 2) <= hold_range + for(var/datum/mind/member as anything in crew_team.members) + var/mob/living/guard = member?.current + if(!istype(guard) || guard.stat >= UNCONSCIOUS || !guard.client || guard.client.is_afk(guard_afk_time)) + continue + var/turf/guard_turf = get_turf(guard) + if(!guard_turf || guard_turf.z != beacon_turf.z || get_dist(guard_turf, beacon_turf) > guard_range) + continue + if(istype(get_area(guard_turf), /area/shuttle) || !mission.target?.contains_turf(guard_turf)) + continue + return TRUE + return FALSE /// The kit was used in hand and the channel finished: raise the beacon /datum/mission_objective/claim_defense/proc/deploy(mob/living/user, turf/where) @@ -537,26 +589,38 @@ beacon = new(where) beacon.objective_ref = WEAKREF(src) QDEL_NULL(kit) + unguarded = FALSE + wave_countdown = first_wave_delay / 10 var/datum/mission_target/target = mission.target - beacon.file_claim("Prospect filing: mineral-rights claim staked at grid [target.target_x], [target.target_y]. Claim matures in [round(defend_duration / (1 MINUTES))] minutes. All counterclaims settled on-site.") + var/datum/mission_target/planet/site = target + var/site_name = istype(site) ? site.planet?.name : null + beacon.file_claim("Prospect filing: mineral-rights claim staked[site_name ? " on [site_name]" : ""] at grid [target.target_x], [target.target_y]. All counterclaims settled on-site.") notify_crew("Claim filed on Wideband.", type = SHIP_NOTIFY_WARNING) -/// One second of defending, ticked by the beacon's process +/// One tick of defending, from the beacon's process /datum/mission_objective/claim_defense/proc/tick_defense(seconds) if(deed_printed || !active || !beacon) return - if(!ship_on_station()) - beacon.show_offstation_warning() + if(!is_guarded()) + if(!unguarded && COOLDOWN_FINISHED(src, unguarded_notice_cooldown)) + COOLDOWN_START(src, unguarded_notice_cooldown, 1 MINUTES) + notify_crew("Claim beacon unattended.", type = SHIP_NOTIFY_WARNING, sound = 'voidcrew/sound/notify2.ogg') + unguarded = TRUE return + unguarded = FALSE defend_remaining -= seconds if(defend_remaining <= 0) print_deed() return - // 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), TRUE) - notify_crew("Claim jumpers inbound on the beacon!", type = SHIP_NOTIFY_WARNING, sound = 'voidcrew/sound/notify2.ogg') + // Periodic company, counted in guarded time + if(!wave_theme) + return + wave_countdown -= seconds + if(wave_countdown > 0) + return + wave_countdown += wave_interval / 10 + 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 /datum/mission_objective/claim_defense/proc/print_deed() @@ -578,14 +642,19 @@ beacon = null if(deed_printed || !mission || mission.failed || mission.completed) return + // Left alone long enough for the site to empty out and be torn down + var/datum/mission_target/planet/site = mission.target + if(istype(site) && site.planet?.unloading) + mission.fail("Claim abandoned - the filing is void.") + return mission.fail("Claim beacon destroyed - the filing is void.") /datum/mission_objective/claim_defense/get_progress_string() if(deed_printed) return "Deed printed" if(beacon) - if(!ship_on_station()) - return "OFF STATION - claim clock paused" + if(unguarded) + return "Beacon unattended" return "Defend the beacon ([round(defend_remaining / 60)]:[add_leading(num2text(round(defend_remaining) % 60), 2, "0")])" var/datum/mission_target/target = mission?.target - return target ? "Deploy the beacon at ([target.target_x], [target.target_y])" : "Deploy the beacon" + return target ? "Stake the claim at ([target.target_x], [target.target_y])" : "Stake the claim" diff --git a/voidcrew/modules/missions/site_dressing.dm b/voidcrew/modules/missions/site_dressing.dm new file mode 100644 index 00000000000..75e6363f01a --- /dev/null +++ b/voidcrew/modules/missions/site_dressing.dm @@ -0,0 +1,375 @@ +/** + * # Mission Site Dressing + * + * A recovery item on its own is one sprite on a random tile: nothing on the site + * says anything happened there, and nothing draws the eye to it. A scene lays a + * little set dressing around the objective's anchor turf (a crater and wreckage + * for a crash, a dropped flare and some litter for a lost case) so the spot can be + * found by looking and reads like the job's story. + * + * Everything placed here is an /obj/effect: it can't be picked up, taken apart, + * broken for parts or sold. Footprint is the anchor plus up to two tiles around + * it, only on open, unblocked ground inside the site, never on another objective. + * The only lasting cost is a smoke emitter and a couple of lights, which burn out + * on one timer each; nothing processes. + */ + +/// How long a crash keeps smoking and a dropped flare keeps burning +#define MISSION_SCENE_BURN_TIME (15 MINUTES) + +/// Lays a scene around an objective's anchor turf. Null or a bad path does nothing. +/proc/dress_mission_scene(scene_type, turf/anchor, datum/mission_target/target) + if(!anchor || !ispath(scene_type, /datum/mission_scene)) + return + var/datum/mission_scene/scene = new scene_type + scene.dress(anchor, target) + +/datum/mission_scene + +/// Places the scene. The anchor holds the objective; only flat ground marks go on it. +/datum/mission_scene/proc/dress(turf/anchor, datum/mission_target/target) + return + +/// Whether one piece of dressing may go on this turf +/datum/mission_scene/proc/can_use(turf/tile, datum/mission_target/target) + var/static/list/objective_types = typecacheof(list( + /obj/item/mission_recovery, + /obj/structure/mission_survey_pylon, + /obj/structure/mission_claim_beacon, + /obj/structure/ingredient_cache, + /obj/item/drug_ingredient, + /obj/effect/anomaly, + /obj/effect/decal/mission_scene, + )) + if(!isopenturf(tile) || isspaceturf(tile) || isgroundlessturf(tile)) + return FALSE + if(tile.is_blocked_turf(exclude_mobs = TRUE)) + return FALSE + // A landed ship's floor flies off with whatever is on it + if(istype(get_area(tile), /area/shuttle)) + return FALSE + if(target && !target.contains_turf(tile)) + return FALSE + for(var/atom/movable/thing as anything in tile) + if(objective_types[thing.type]) + return FALSE + return TRUE + +/// Usable turfs within range of the anchor, the anchor itself excluded +/datum/mission_scene/proc/spots_around(turf/anchor, datum/mission_target/target, range = 1) + var/list/spots = list() + for(var/turf/tile as anything in RANGE_TURFS(range, anchor)) + if(tile != anchor && can_use(tile, target)) + spots += tile + return spots + +/** + * Puts one piece on a spot from the list, preferring one no other piece of this + * scene took. Returns the piece, or null when there was nowhere to put it. + */ +/datum/mission_scene/proc/place(piece_type, list/spots, list/taken) + if(!length(spots)) + return null + var/list/free = spots - taken + var/turf/spot = pick(length(free) ? free : spots) + taken += spot + return new piece_type(spot) + +// ========================================================================= +// CRASH: something came down hard (Field Expedition) +// ========================================================================= + +/datum/mission_scene/crash + +/datum/mission_scene/crash/dress(turf/anchor, datum/mission_target/target) + new /obj/effect/decal/mission_scene/scorch(anchor) + new /obj/effect/decal/mission_scene/scorch/core(anchor) + var/list/near = spots_around(anchor, target, 1) + var/list/far = spots_around(anchor, target, 2) - near + var/list/taken = list() + // The furrow it ploughed coming in, and the hull it shed at the end of it + var/skid_dir = pick_skid_dir(anchor, target) + if(skid_dir) + var/obj/effect/decal/mission_scene/skid/skid = new(anchor) + skid.point(skid_dir) + var/turf/beyond = get_step(anchor, REVERSE_DIR(skid_dir)) + if(beyond in near) + taken += beyond + new /obj/effect/decal/mission_scene/wreck(beyond) + else + place(/obj/effect/decal/mission_scene/wreck, near, taken) + else + place(/obj/effect/decal/mission_scene/wreck, near, taken) + place(/obj/effect/decal/mission_scene/wreck/dish, near, taken) + place(/obj/effect/decal/mission_scene/debris, near, taken) + place(/obj/effect/decal/mission_scene/debris/glass, near, taken) + place(/obj/effect/decal/mission_scene/debris, length(far) ? far : near, taken) + for(var/_ in 1 to 3) + place(/obj/effect/decal/mission_scene/debris/rubble, length(far) ? far : near, taken) + +/// A direction with two clear tiles for the furrow, or null +/datum/mission_scene/crash/proc/pick_skid_dir(turf/anchor, datum/mission_target/target) + for(var/direction in shuffle(GLOB.alldirs)) + var/turf/first = get_step(anchor, direction) + var/turf/second = first && get_step(first, direction) + if(second && can_use(first, target) && can_use(second, target)) + return direction + return null + +// ========================================================================= +// DROPPED CASE: somebody lost it here and lit a flare (recovery) +// ========================================================================= + +/datum/mission_scene/dropped_case + +/datum/mission_scene/dropped_case/dress(turf/anchor, datum/mission_target/target) + new /obj/effect/decal/mission_scene/scorch/scuff(anchor) + var/list/near = spots_around(anchor, target, 1) + var/list/taken = list() + place(/obj/effect/decal/mission_scene/flare, near, taken) + place(/obj/effect/decal/mission_scene/debris/glass, near, taken) + place(/obj/effect/decal/mission_scene/debris, near, taken) + +// ========================================================================= +// CARGO WRECK: the crate it came in, broken open (extraction) +// ========================================================================= + +/datum/mission_scene/cargo_wreck + +/datum/mission_scene/cargo_wreck/dress(turf/anchor, datum/mission_target/target) + new /obj/effect/decal/mission_scene/scorch/scuff(anchor) + var/list/near = spots_around(anchor, target, 1) + var/list/taken = list() + place(/obj/effect/decal/mission_scene/crate, near, taken) + place(/obj/effect/decal/mission_scene/flare, near, taken) + place(/obj/effect/decal/mission_scene/debris, near, taken) + place(/obj/effect/decal/mission_scene/debris/glass, near, taken) + +// ========================================================================= +// PYLON DROP: a survey pylon landed from orbit (survey, core sample) +// ========================================================================= + +/datum/mission_scene/pylon_drop + +/datum/mission_scene/pylon_drop/dress(turf/anchor, datum/mission_target/target) + new /obj/effect/decal/mission_scene/scorch/pylon(anchor) + var/list/near = spots_around(anchor, target, 1) + var/list/taken = list() + for(var/_ in 1 to 2) + place(/obj/effect/decal/mission_scene/debris/rubble, near, taken) + +// ========================================================================= +// THE PIECES +// ========================================================================= + +/// Set dressing. An effect, so it gives nothing when attacked, wrenched or blown up. +/obj/effect/decal/mission_scene + name = "wreckage" + desc = "Torn plating and burnt wiring." + icon = 'icons/mob/silicon/robots.dmi' + icon_state = "gib1" + plane = GAME_PLANE + layer = LOW_OBJ_LAYER + /// Icon states picked from at random, if any + var/list/random_states + /// Largest random pixel nudge either way + var/jitter = 6 + +/obj/effect/decal/mission_scene/Initialize(mapload) + . = ..() + if(length(random_states)) + icon_state = pick(random_states) + if(jitter) + pixel_x = base_pixel_x + rand(-jitter, jitter) + pixel_y = base_pixel_y + rand(-jitter, jitter) + +/// Scraps of hull and wiring +/obj/effect/decal/mission_scene/debris + random_states = list("gib1", "gib2", "gib3", "gib4", "gib5", "gib6") + +/obj/effect/decal/mission_scene/debris/glass + name = "broken glass" + desc = "Glittering shards from a shattered panel." + icon = 'icons/obj/debris.dmi' + icon_state = "tiny" + random_states = list("tiny", "small") + +/obj/effect/decal/mission_scene/debris/glass/Initialize(mapload) + . = ..() + setDir(pick(GLOB.cardinals)) + +/obj/effect/decal/mission_scene/debris/rubble + name = "rubble" + desc = "Loose chunks thrown clear by the impact." + icon = 'icons/obj/debris.dmi' + icon_state = "rubble" + random_states = null + +/// The burn at the center. Wide and soft; the core darkens the middle off-center. +/obj/effect/decal/mission_scene/scorch + name = "scorched ground" + desc = "Blackened and still warm." + icon = 'icons/effects/light_overlays/light_96.dmi' + icon_state = "light" + color = "#1e1610" + alpha = 170 + plane = FLOOR_PLANE + layer = ABOVE_OPEN_TURF_LAYER + mouse_opacity = MOUSE_OPACITY_TRANSPARENT + blocks_emissive = EMISSIVE_BLOCK_NONE + jitter = 4 + SET_BASE_PIXEL(-32, -32) + /// Horizontal and vertical stretch of the sprite + var/spread_x = 0.95 + var/spread_y = 0.8 + +/obj/effect/decal/mission_scene/scorch/Initialize(mapload) + . = ..() + var/matrix/shape = matrix() + shape.Scale(spread_x, spread_y) + shape.Turn(rand(0, 179)) + transform = shape + +/obj/effect/decal/mission_scene/scorch/core + icon = 'icons/effects/light_overlays/light_64.dmi' + color = "#120c08" + alpha = 150 + jitter = 6 + SET_BASE_PIXEL(-16, -16) + spread_x = 0.6 + spread_y = 0.7 + +/// A light scuff where something heavy hit the deck +/obj/effect/decal/mission_scene/scorch/scuff + name = "scuff marks" + color = "#2a2420" + alpha = 110 + jitter = 0 + spread_x = 0.6 + spread_y = 0.6 + +/obj/effect/decal/mission_scene/scorch/pylon + alpha = 160 + jitter = 0 + spread_x = 0.7 + spread_y = 0.7 + +/// The furrow a crash ploughs: a long soft smudge pointed away from the anchor +/obj/effect/decal/mission_scene/skid + name = "furrow" + desc = "A long gouge in the ground." + icon = 'icons/effects/light_overlays/light_96.dmi' + icon_state = "light" + color = "#1a130d" + alpha = 150 + plane = FLOOR_PLANE + layer = ABOVE_OPEN_TURF_LAYER + mouse_opacity = MOUSE_OPACITY_TRANSPARENT + blocks_emissive = EMISSIVE_BLOCK_NONE + jitter = 0 + SET_BASE_PIXEL(-32, -32) + +/// Lays the furrow out from the anchor toward direction +/obj/effect/decal/mission_scene/skid/proc/point(direction) + var/matrix/shape = matrix() + shape.Scale(ISDIAGONALDIR(direction) ? 1.2 : 0.9, 0.38) + shape.Turn(dir2angle(direction) - 90) + transform = shape + var/dx = (direction & EAST) ? 1 : ((direction & WEST) ? -1 : 0) + var/dy = (direction & NORTH) ? 1 : ((direction & SOUTH) ? -1 : 0) + pixel_x = base_pixel_x + dx * 44 + pixel_y = base_pixel_y + dy * 44 + +/// The biggest piece of what came down, smoking until it burns out +/obj/effect/decal/mission_scene/wreck + name = "smoking wreckage" + desc = "A buckled hull section, still smoking." + icon = 'icons/obj/fluff/general.dmi' + icon_state = "broken_canister" + color = "#8a8078" + layer = BELOW_OBJ_LAYER + jitter = 4 + light_range = 2 + light_power = 0.8 + light_color = LIGHT_COLOR_FIRE + /// Whether this piece puts up the smoke column + var/smokes = TRUE + +/obj/effect/decal/mission_scene/wreck/Initialize(mapload) + . = ..() + if(smokes) + particles = new /particles/smoke/mission_plume + addtimer(CALLBACK(src, PROC_REF(burn_out)), MISSION_SCENE_BURN_TIME, TIMER_DELETE_ME) + +/obj/effect/decal/mission_scene/wreck/Destroy(force) + QDEL_NULL(particles) + return ..() + +/obj/effect/decal/mission_scene/wreck/proc/burn_out() + QDEL_NULL(particles) + set_light(0) + name = "wreckage" + desc = "A buckled hull section, scorched black." + +/obj/effect/decal/mission_scene/wreck/dish + name = "bent antenna dish" + desc = "Snapped off its mount on the way down." + icon_state = "sat_dish" + color = "#a09890" + light_range = 0 + smokes = FALSE + +/obj/effect/decal/mission_scene/wreck/dish/Initialize(mapload) + . = ..() + setDir(pick(GLOB.cardinals)) + transform = transform.Turn(pick(-70, 70, 110, -110)) + +/// The crate the cargo came in +/obj/effect/decal/mission_scene/crate + name = "smashed crate" + desc = "Split open and empty." + icon = 'icons/obj/storage/crates.dmi' + icon_state = "crateopen" + color = "#8a8078" + layer = BELOW_OBJ_LAYER + jitter = 3 + +/obj/effect/decal/mission_scene/crate/Initialize(mapload) + . = ..() + transform = transform.Turn(rand(-20, 20)) + +/// Somebody lit it to mark the spot +/obj/effect/decal/mission_scene/flare + name = "flare" + desc = "A road flare, burning low." + icon = 'icons/obj/lighting.dmi' + icon_state = "flare-on" + light_range = 3 + light_power = 1 + light_color = LIGHT_COLOR_FLARE + +/obj/effect/decal/mission_scene/flare/Initialize(mapload) + . = ..() + transform = transform.Turn(rand(0, 359)) + addtimer(CALLBACK(src, PROC_REF(burn_out)), MISSION_SCENE_BURN_TIME, TIMER_DELETE_ME) + +/obj/effect/decal/mission_scene/flare/proc/burn_out() + set_light(0) + icon_state = "flare-empty" + name = "spent flare" + desc = "Burnt down to the stub." + +/// A tall, slow column a crew can spot from across the site. Client-side only. +/particles/smoke/mission_plume + width = 192 + height = 320 + count = 150 + spawning = 2 + lifespan = 4 SECONDS + fade = 2 SECONDS + position = generator(GEN_SPHERE, 0, 4, NORMAL_RAND) + scale = list(1.5, 1.5) + grow = list(0.05, 0.05) + gravity = list(0.08, 0.95) + +#undef MISSION_SCENE_BURN_TIME diff --git a/voidcrew/modules/missions/spawn_cover.dm b/voidcrew/modules/missions/spawn_cover.dm new file mode 100644 index 00000000000..f1b2ccde122 --- /dev/null +++ b/voidcrew/modules/missions/spawn_cover.dm @@ -0,0 +1,103 @@ +/** + * # Mission Spawn Cover + * + * Field objectives are placed on whatever turf the site sampler rolls, and the + * site can already be loaded with a crew standing in it: accept a contract while + * landed and the survivor, the bounty, the anomaly or the crash site would wink + * into existence in front of them. The pickers here sample the same candidates, + * skip any turf a living player could see right now, and when nowhere is hidden + * fall back to the candidate farthest from everyone watching. + * + * "Could see" is the watcher's screen rectangle (their own view size, so a scope + * or zoom counts), widened by a few tiles so whatever scatters around the anchor + * (guards, dressing, the rest of a pylon set) doesn't land on the edge of the + * screen, then a straight line of sight that walls and other opaque turfs block. + * Darkness is ignored: a dark tile in view still counts as seen. + */ + +/// Tiles past the edge of a watcher's screen still treated as in view +#define MISSION_SPAWN_COVER_MARGIN 3 +/// Random samples a hidden pick takes from a candidate list before falling back +#define MISSION_SPAWN_COVER_TRIES 40 + +/** + * Everyone who could be looking at one z-level, taken once per pick so each + * candidate check is a few subtractions and, only for turfs on somebody's screen, + * one line-of-sight walk. + */ +/datum/spawn_cover + /// One entry per watcher: list(eye turf, half view width, half view height), margin included + var/list/watchers = list() + /// The seen candidate farthest from its nearest watcher, for when nothing is hidden + var/turf/fallback + /// Chebyshev distance from the fallback to its nearest watcher + var/fallback_distance = -1 + +/datum/spawn_cover/New(z) + . = ..() + if(!z) + return + for(var/mob/living/player as anything in GLOB.alive_player_list) + var/client/viewer = player.client + if(!viewer) + continue + // The client's eye, not the body: an AI looks through its camera eye + var/turf/eye_turf = get_turf(viewer.eye || player) + if(!eye_turf || eye_turf.z != z) + continue + var/list/view_size = getviewsize(viewer.view) + add_watcher(eye_turf, CEILING((view_size[1] - 1) / 2, 1), CEILING((view_size[2] - 1) / 2, 1)) + +/// Registers one pair of eyes. Half sizes are the screen's, before the margin. +/datum/spawn_cover/proc/add_watcher(turf/eye_turf, half_width, half_height) + watchers += list(list(eye_turf, half_width + MISSION_SPAWN_COVER_MARGIN, half_height + MISSION_SPAWN_COVER_MARGIN)) + +/datum/spawn_cover/proc/has_watchers() + return length(watchers) > 0 + +/** + * TRUE when no watcher could see the candidate. A seen candidate is remembered + * as the fallback if it sits farther from its nearest watcher than the last one. + */ +/datum/spawn_cover/proc/is_hidden(turf/candidate) + if(!length(watchers)) + return TRUE + var/nearest = INFINITY + var/seen = FALSE + for(var/list/watcher as anything in watchers) + var/turf/eye_turf = watcher[1] + var/dx = abs(candidate.x - eye_turf.x) + var/dy = abs(candidate.y - eye_turf.y) + nearest = min(nearest, max(dx, dy)) + if(seen || dx > watcher[2] || dy > watcher[3]) + continue + if(inLineOfSight(eye_turf.x, eye_turf.y, candidate.x, candidate.y, candidate.z)) + seen = TRUE + if(!seen) + return TRUE + if(nearest > fallback_distance) + fallback = candidate + fallback_distance = nearest + return FALSE + +/** + * A random turf from candidates that nobody can see, or the sampled candidate + * farthest from any watcher. Candidates must already be valid spawn turfs on one + * z-level; this only decides between them. With nobody on the level it is a + * plain pick(). + */ +/proc/pick_unwatched_turf(list/candidates, tries = MISSION_SPAWN_COVER_TRIES) + if(!length(candidates)) + return null + var/turf/first = candidates[1] + var/datum/spawn_cover/cover = new(first.z) + if(!cover.has_watchers()) + return pick(candidates) + for(var/_ in 1 to tries) + var/turf/candidate = pick(candidates) + if(cover.is_hidden(candidate)) + return candidate + return cover.fallback + +#undef MISSION_SPAWN_COVER_MARGIN +#undef MISSION_SPAWN_COVER_TRIES diff --git a/voidcrew/modules/overmap/code/modules/overmap/space_ruin.dm b/voidcrew/modules/overmap/code/modules/overmap/space_ruin.dm index 2a88700fb42..a6a43e9ced1 100644 --- a/voidcrew/modules/overmap/code/modules/overmap/space_ruin.dm +++ b/voidcrew/modules/overmap/code/modules/overmap/space_ruin.dm @@ -649,8 +649,12 @@ GLOBAL_LIST_EMPTY(space_ruin_signals) /** * Picks a random non-dense, non-space turf inside the loaded ruin's template footprint. * Used by recovery missions to place objectives. Returns null if the ruin isn't loaded. + * + * unwatched: mission field spawns. Prefer solid ground nothing dense is standing on, and + * ones no living player can see right now (pick_unwatched_turf()), so a crew already + * aboard doesn't watch the objective appear. */ -/obj/structure/overmap/space_ruin/proc/get_random_interior_turf() +/obj/structure/overmap/space_ruin/proc/get_random_interior_turf(unwatched = FALSE) if(!loaded || !ruin_bottom_left || !ruin_template?.width || !ruin_template?.height) return null var/turf/top_right = locate( @@ -679,6 +683,12 @@ GLOBAL_LIST_EMPTY(space_ruin_signals) candidates += interior_turf if(!length(candidates)) return null + if(unwatched) + var/list/clear = list() + for(var/turf/candidate as anything in candidates) + if(!candidate.is_blocked_turf(exclude_mobs = TRUE) && !isgroundlessturf(candidate)) + clear += candidate + return pick_unwatched_turf(length(clear) ? clear : candidates) return pick(candidates) /obj/structure/overmap/space_ruin/proc/remove_docks() diff --git a/voidcrew/modules/unit_tests/_unit_tests.dm b/voidcrew/modules/unit_tests/_unit_tests.dm index 3b533fd73dc..6cd702c5b8f 100644 --- a/voidcrew/modules/unit_tests/_unit_tests.dm +++ b/voidcrew/modules/unit_tests/_unit_tests.dm @@ -86,6 +86,7 @@ #include "voidcrew_dynamic_events.dm" #include "voidcrew_economy_metrics.dm" #include "voidcrew_event_horizon.dm" +#include "voidcrew_exploration_sweep.dm" #include "voidcrew_fleet_waypoints.dm" #include "voidcrew_fresh_cores.dm" #include "voidcrew_gear_behaviour.dm" @@ -126,6 +127,7 @@ #include "voidcrew_mission_console_rewards.dm" #include "voidcrew_mission_gps.dm" #include "voidcrew_mission_metrics.dm" +#include "voidcrew_mission_spawn_cover.dm" #include "voidcrew_missions.dm" #include "voidcrew_nanite_research.dm" #include "voidcrew_nanite_sync.dm" diff --git a/voidcrew/modules/unit_tests/voidcrew_exploration_sweep.dm b/voidcrew/modules/unit_tests/voidcrew_exploration_sweep.dm new file mode 100644 index 00000000000..79fe487f620 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_exploration_sweep.dm @@ -0,0 +1,119 @@ +/// An exploration contract aimed at whatever test-room spot the test caches into its target +/datum/mission/exploration/sweep_test + // Never rolled onto a real board + weight = 0 + +/datum/mission/exploration/sweep_test/setup_target() + target = new /datum/mission_target/exploration_sweep_test(src) + return TRUE + +/// A green destination with no overmap object behind it +/datum/mission_target/exploration_sweep_test + +/datum/mission_target/exploration_sweep_test/get_zone_type() + return 1 // ZONE_GREEN + +/** + * Arriving at an exploration site starts a sweep rather than finishing the job: the + * ship holds station, drifting off pauses it without losing it, two crews on one site + * sweep independently, and the only thing a sweep turns up is an ordinary derelict + * signal that was already out there. + */ +/datum/unit_test/voidcrew_exploration_sweep + +/datum/unit_test/voidcrew_exploration_sweep/proc/make_ship() + var/obj/structure/overmap/ship/ship = allocate(/obj/structure/overmap/ship) + ship.ship_team = allocate(/datum/team/voidcrew) + ship.ship_team.ship = ship + allocated += ship.get_crew_record() + return ship + +/datum/unit_test/voidcrew_exploration_sweep/proc/make_contract(turf/site) + var/datum/mission/exploration/sweep_test/contract = allocate(/datum/mission/exploration/sweep_test) + contract.target?.cache_coords_from(site) + return contract + +/datum/unit_test/voidcrew_exploration_sweep/Run() + var/turf/site = run_loc_floor_top_right + var/turf/away = run_loc_floor_bottom_left + // Two tiles off the site: past the arrival range, still on station for the sweep + var/turf/edge = locate(site.x - 2, site.y, site.z) + TEST_ASSERT_NOTNULL(edge, "The test room must have a tile two west of its top right corner.") + + var/obj/structure/overmap/ship/first_ship = make_ship() + var/obj/structure/overmap/ship/second_ship = make_ship() + first_ship.forceMove(away) + second_ship.forceMove(away) + + var/datum/mission/exploration/sweep_test/first = make_contract(site) + var/datum/mission/exploration/sweep_test/second = make_contract(site) + TEST_ASSERT(!first.generation_failed && !second.generation_failed, "The test exploration contracts must generate.") + var/datum/mission_objective/sector_sweep/first_sweep = first.sweep + var/datum/mission_objective/sector_sweep/second_sweep = second.sweep + TEST_ASSERT_NOTNULL(first_sweep, "Exploration must build a sweep step.") + TEST_ASSERT_EQUAL(length(first.objectives), 2, "Exploration is travel, then the sweep.") + var/datum/mission_objective/goto_coords/first_approach = first.objectives[1] + TEST_ASSERT(istype(first_approach), "Exploration must still open with the travel step.") + TEST_ASSERT_NULL(first_approach.arrival_message, "The sweep announces the arrival, not the travel step.") + TEST_ASSERT_EQUAL(first.objectives[2], first_sweep, "The sweep must be the contract's last step.") + TEST_ASSERT(!first.requires_item, "Exploration is still claimed at the board, with nothing to hand over.") + + // Only the second crew's sweep can pick anything up + first_sweep.find_chance = 0 + second_sweep.find_chance = 100 + var/obj/structure/overmap/space_ruin/rumour_site = allocate(/obj/structure/overmap/space_ruin, away) + rumour_site.rare = TRUE + var/obj/structure/overmap/space_ruin/derelict = allocate(/obj/structure/overmap/space_ruin, away) + + TEST_ASSERT(first.start_mission(first_ship), "The first exploration contract must start.") + TEST_ASSERT(second.start_mission(second_ship), "The second exploration contract must start.") + TEST_ASSERT(!first_sweep.active, "The sweep waits until the ship reaches the site.") + + // Arrival: the travel step is done, the sweep runs, and the contract is not claimable yet + first_ship.forceMove(site) + TEST_ASSERT(first_approach.completed, "Reaching the site must finish the travel step.") + TEST_ASSERT(first_sweep.active && first_sweep.running, "Reaching the site must start the sweep.") + TEST_ASSERT_NOTNULL(first_sweep.finish_timer, "A running sweep must have its finish timer armed.") + TEST_ASSERT(!first.can_complete(), "Arriving alone must not make the contract claimable.") + TEST_ASSERT(!second_sweep.active, "One crew reaching the site must not start another crew's sweep.") + + second_ship.forceMove(site) + TEST_ASSERT(second_sweep.running, "The second crew's sweep must start when its own ship arrives.") + TEST_ASSERT_EQUAL(second_sweep.find_ref?.resolve(), derelict, "The sweep must pick up the plain derelict signal and pass over the rumour site.") + + // Drifting to the edge of the site keeps sweeping + first_ship.forceMove(edge) + TEST_ASSERT(first_sweep.running, "A ship two tiles off the site is still on station.") + + // Leaving pauses this crew's sweep only, and keeps it + first_ship.forceMove(away) + TEST_ASSERT(!first_sweep.running, "Leaving the site must pause the sweep.") + TEST_ASSERT_NULL(first_sweep.finish_timer, "A paused sweep must not finish on its own.") + TEST_ASSERT(first_sweep.active && !first_sweep.completed, "A paused sweep stays the contract's current step.") + TEST_ASSERT_EQUAL(first_sweep.get_progress_string(), "Sweep broken off", "The board must show the sweep as broken off.") + TEST_ASSERT(!first.can_complete(), "A broken-off sweep must not make the contract claimable.") + TEST_ASSERT(second_sweep.running, "Another crew leaving must not pause this crew's sweep.") + + first_ship.forceMove(site) + TEST_ASSERT(first_sweep.running, "Coming back must resume the sweep.") + TEST_ASSERT_NOTNULL(first_sweep.finish_timer, "A resumed sweep must re-arm its finish timer.") + + // The find is rolled once: breaking off and coming back with no luck left keeps it + second_ship.forceMove(away) + second_sweep.find_chance = 0 + second_ship.forceMove(site) + TEST_ASSERT_EQUAL(second_sweep.find_ref?.resolve(), derelict, "Breaking off and coming back must not reroll the find.") + + first_sweep.finish_sweep() + TEST_ASSERT(first_sweep.completed, "A finished sweep must complete its step.") + TEST_ASSERT(first.can_complete(), "A finished sweep must leave the contract ready to claim at the board.") + var/datum/ship_waypoint/site_mark = first_ship.get_waypoint(REF(first)) + TEST_ASSERT_NOTNULL(site_mark, "The contract's site stays on the helm until it is claimed.") + TEST_ASSERT_EQUAL(site_mark.name, "Charted sector", "The site's helm label must change once it is charted.") + TEST_ASSERT_NULL(first_ship.get_waypoint(REF(derelict)), "A sweep with no find must chart nothing extra.") + + second_sweep.finish_sweep() + TEST_ASSERT(second.can_complete(), "The second crew's contract must finish on its own sweep.") + TEST_ASSERT_NOTNULL(second_ship.get_waypoint(REF(derelict)), "The find must be charted on the sweeping crew's helm.") + TEST_ASSERT_NULL(second_ship.get_waypoint(REF(rumour_site)), "A rumour site must never be charted by a sweep.") + TEST_ASSERT_NULL(first_ship.get_waypoint(REF(derelict)), "One crew's find must not chart on another crew's helm.") diff --git a/voidcrew/modules/unit_tests/voidcrew_mission_spawn_cover.dm b/voidcrew/modules/unit_tests/voidcrew_mission_spawn_cover.dm new file mode 100644 index 00000000000..2480c897343 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_mission_spawn_cover.dm @@ -0,0 +1,52 @@ +/// Mission field spawns stay off turfs a player could be looking at, and walls count as cover +/datum/unit_test/voidcrew_mission_spawn_cover + +/datum/unit_test/voidcrew_mission_spawn_cover/Run() + var/turf/eye_turf = run_loc_floor_bottom_left + var/turf/beside = locate(eye_turf.x + 1, eye_turf.y, eye_turf.z) + var/turf/near = locate(eye_turf.x + 2, eye_turf.y, eye_turf.z) + // Well past any screen, on the same level + var/far_x = (eye_turf.x + 40 <= world.maxx) ? eye_turf.x + 40 : eye_turf.x - 40 + var/turf/far = locate(far_x, eye_turf.y, eye_turf.z) + TEST_ASSERT_NOTNULL(near, "The test room must be at least three tiles wide.") + TEST_ASSERT_NOTNULL(far, "The test level must be wider than one screen.") + + // No z: nobody is registered as watching + var/datum/spawn_cover/cover = new + TEST_ASSERT(cover.is_hidden(near), "With nobody watching, every turf is hidden.") + + cover.add_watcher(eye_turf, 9, 7) + TEST_ASSERT(!cover.is_hidden(near), "A turf two tiles from a watcher, in the open, is in view.") + TEST_ASSERT(!cover.is_hidden(beside), "The turf next to a watcher is in view.") + TEST_ASSERT_EQUAL(cover.fallback, near, "The fallback is the seen turf farthest from the watcher.") + TEST_ASSERT(cover.is_hidden(far), "A turf forty tiles away is off the watcher's screen.") + + // An opaque wall between them hides what's behind it + allocate(/obj/structure/falsewall, beside) + TEST_ASSERT(IS_OPAQUE_TURF(beside), "The false wall must make its turf opaque.") + TEST_ASSERT(cover.is_hidden(near), "A turf behind a wall is hidden from the watcher.") + + // The list picker never hands back anything but one of its candidates + var/list/candidates = list(beside, near) + TEST_ASSERT(pick_unwatched_turf(candidates) in candidates, "The picker must return one of its candidates.") + TEST_ASSERT_NULL(pick_unwatched_turf(list()), "An empty candidate list has nothing to pick.") + +/// Set dressing is effects only, stays off walls, and leaves the objective's tile to the objective +/datum/unit_test/voidcrew_mission_site_dressing + +/datum/unit_test/voidcrew_mission_site_dressing/Run() + var/turf/anchor = locate(run_loc_floor_bottom_left.x + 2, run_loc_floor_bottom_left.y + 2, run_loc_floor_bottom_left.z) + var/obj/item/mission_recovery/objective = allocate(__IMPLIED_TYPE__, anchor) + for(var/scene_type in subtypesof(/datum/mission_scene)) + dress_mission_scene(scene_type, anchor, null) + var/pieces = 0 + for(var/turf/tile as anything in RANGE_TURFS(3, anchor)) + for(var/obj/item/loot in tile) + TEST_ASSERT_EQUAL(loot, objective, "Set dressing must not leave items lying around ([loot.type]).") + for(var/obj/effect/decal/mission_scene/piece in tile) + pieces++ + TEST_ASSERT(!isclosedturf(tile), "[piece.type] was placed on a wall.") + if(tile == anchor) + TEST_ASSERT(istype(piece, /obj/effect/decal/mission_scene/scorch) || istype(piece, /obj/effect/decal/mission_scene/skid), "Only ground marks may share the objective's tile, not [piece.type].") + TEST_ASSERT(pieces > 0, "The scenes must lay something down.") + TEST_ASSERT_EQUAL(objective.loc, anchor, "Dressing must not move the objective.") diff --git a/voidcrew/modules/unit_tests/voidcrew_missions.dm b/voidcrew/modules/unit_tests/voidcrew_missions.dm index afb948cbc1a..c9797953765 100644 --- a/voidcrew/modules/unit_tests/voidcrew_missions.dm +++ b/voidcrew/modules/unit_tests/voidcrew_missions.dm @@ -481,7 +481,7 @@ repeated.voucher_count = initial(rescue_type.voucher_count) var/datum/mission_objective/field/escort/repeated_escort = new repeated.add_objective(repeated_escort) - repeated_escort.survivor = allocate(/mob/living/carbon/human/npc/mission_survivor, pad_turf) + repeated_escort.survivor = allocate(/mob/living/carbon/human/npc/ambient_npc/mission_survivor, pad_turf) repeated_escort.on_turn_in_finalized(pad) TEST_ASSERT_EQUAL(repeated.value, 1250, "A healthy survivor must add 25% to credits") TEST_ASSERT_NULL(repeated_escort.survivor, "Finalization must clear the survivor reference") @@ -489,6 +489,28 @@ TEST_ASSERT_EQUAL(repeated.value, 1250, "Repeated finalization must not stack the bonus") TEST_ASSERT_EQUAL(repeated.voucher_count, initial(rescue_type.voucher_count), "Repeated finalization must not change vouchers") +/** + * A survivor the contract lets go of in front of someone is taken up in the transporter's beam: + * held still for the length of it, with the column on their tile, rather than + * blinking out. With nobody about they are simply deleted (the delivery test above relies on it). + */ +/datum/unit_test/voidcrew_mission_survivor_beam/Run() + var/turf/spot = run_loc_floor_bottom_left + var/mob/living/carbon/human/npc/ambient_npc/mission_survivor/watched = allocate(/mob/living/carbon/human/npc/ambient_npc/mission_survivor, spot) + watched.beam_out(force_visual = TRUE) + TEST_ASSERT(!QDELETED(watched), "A watched survivor must stay for the beam, not vanish on the spot") + TEST_ASSERT(watched.beaming_out, "A watched survivor must be marked as leaving") + TEST_ASSERT(!HAS_TRAIT(watched, TRAIT_GODMODE), "A survivor in the beam is still a person: no godmode") + TEST_ASSERT(HAS_TRAIT(watched, TRAIT_IMMOBILIZED), "A survivor in the beam must not walk out of it") + TEST_ASSERT(watched.anchored, "A survivor in the beam must not be pulled out of it") + TEST_ASSERT(locate(/obj/effect/temp_visual/transporter_beam) in spot, "A watched survivor must get the beam column on their tile") + watched.talked_to(allocate(/mob/living/carbon/human/consistent, get_step(spot, NORTH))) + TEST_ASSERT(!watched.is_following(), "A survivor in the beam must not start following anyone") + + var/mob/living/carbon/human/npc/ambient_npc/mission_survivor/unseen = allocate(/mob/living/carbon/human/npc/ambient_npc/mission_survivor, get_step(spot, EAST)) + unseen.beam_out() + TEST_ASSERT(QDELETED(unseen), "A survivor nobody can see must be deleted at once") + /** * A contract that marks itself exclusive_site must get a wreck to itself. * @@ -619,7 +641,7 @@ /datum/unit_test/voidcrew_mission_kill_rewind abstract_type = /datum/unit_test/voidcrew_mission_kill_rewind -/datum/unit_test/voidcrew_mission_kill_rewind/proc/make_hunt(big_game = FALSE) +/datum/unit_test/voidcrew_mission_kill_rewind/proc/make_hunt(big_game = FALSE, wait_for_beast = FALSE) var/datum/mission/kill_rewind_test/mission = allocate(__IMPLIED_TYPE__) mission.servant = allocate(/obj/structure/overmap/ship) mission.servant.ship_account = allocate(/datum/bank_account) @@ -652,8 +674,13 @@ mission.activate_current_objective() if(lure) lure.on_planted(null, target.spawn_turf) - // The single-turf fixture stands in for the whole hunting ground. - hunt.target_mob.forceMove(target.spawn_turf) + if(!wait_for_beast) + // In play the beast comes in after a wait and a walk; the fixture skips both. + var/datum/mission_objective/field/kill_named/big_game/trophy_hunt = hunt + trophy_hunt.cancel_arrival() + trophy_hunt.spawn_field_objects(target.spawn_turf) + // The single-turf fixture stands in for the whole hunting ground. + hunt.target_mob.forceMove(target.spawn_turf) return mission /datum/unit_test/voidcrew_mission_kill_rewind/proc/test_mobs() @@ -746,6 +773,22 @@ TEST_ASSERT(!mission.turn_in(run_loc_floor_bottom_left, null, TRUE), "Repeated forced turn-in must still honor mission completion") TEST_ASSERT_EQUAL(mission.reward_calls, 1, "Repeated turn-in must not distribute rewards twice") +/// The beast is called in with a wait, not conjured beside the staked lure. +/datum/unit_test/voidcrew_mission_kill_rewind/lure_wait/Run() + var/datum/mission/kill_rewind_test/mission = make_hunt(TRUE, wait_for_beast = TRUE) + var/datum/mission_objective/field/kill_named/big_game/hunt = mission.current_objective() + TEST_ASSERT_NULL(hunt.target_mob, "The beast must not appear in the tick the lure goes in") + TEST_ASSERT_EQUAL(length(test_mobs()), 0, "Neither the beast nor its guards may appear in the tick the lure goes in") + TEST_ASSERT(hunt.arrival_pending && hunt.arrival_timer, "The staked lure must call the beast in with a wait") + var/obj/structure/hunting_lure_stake/stake = hunt.lure_stake_ref?.resolve() + TEST_ASSERT_NOTNULL(stake, "The staked lure must stay in the world") + TEST_ASSERT(stake.anchored, "The staked lure must be anchored") + TEST_ASSERT_NULL(mission.quest_atom, "The staked lure is scenery, not the tracked quest atom") + hunt.deactivate() + TEST_ASSERT_NULL(hunt.arrival_timer, "A contract that ends during the wait must cancel the arrival") + TEST_ASSERT(stake.toppled, "A contract that ends must leave the lure down") + TEST_ASSERT_EQUAL(length(test_mobs()), 0, "A cancelled arrival must not spawn anything") + /// Carried proof stays valid while the crew revisits an emptied site. /datum/unit_test/voidcrew_mission_kill_rewind/carried/Run() for(var/big_game in list(FALSE, TRUE)) diff --git a/wiki/content/missions.md b/wiki/content/missions.md index 5265ce0d1dd..65983aa88cd 100644 --- a/wiki/content/missions.md +++ b/wiki/content/missions.md @@ -13,7 +13,7 @@ The mission board links to a nearby mission pad. Open **Available** to browse wo The console posts a set of **five offers every 20 minutes**, including a green-zone exploration job when one is available. Up to three slots are reserved for targeted work in the highest zone your crew's [reputation](zone-reputation.md) allows. Taking or losing a job leaves a vacancy until the next set arrives. **Refresh** becomes available when the next set is due; it does not give an early replacement. Reopening or rebuilding the console keeps the ship's offers and schedule. -For a starting job, look for an **Exploration Contract** in green space. Fly to its marked coordinates, then collect the listed fee at the board. +For a starting job, look for an **Exploration Contract** in green space. Fly to its marked coordinates and hold there while the sensors sweep the sector, then collect the listed fee at the board. Each offer shows its task, pay, and allowed time. Accepting starts its deadline and adds a helm waypoint when there is a destination. Some jobs also leave equipment on the mission pad: collect it before leaving. Tap a handheld GPS on the board to copy active mission beacons, or use **Link Mission Beacons** with a fitted MOD GPS. @@ -86,13 +86,13 @@ These prizes are separate from the offer's ordinary credits, vouchers and goods. | Contract | What it asks | |---|---| | Delivery Contract | Bring the listed goods to the pad: spice pods, sinew, goliath hides, glacial cores, raw telecrystals, a sea crystal, or Syndicate documents. Stored goods qualify. | -| Exploration Contract | Fly the ship to marked coordinates, then collect the fee. | +| Exploration Contract | Fly the ship to marked coordinates, hold position for the sensor sweep, then collect the fee. The sweep sometimes turns up a nearby derelict. | | Survey Contract | Scan the requested celestial objects with the orbital survey console. | | Telemetry Contract | Gather the requested survey scans and return for credits and research notes. | | Recovery Contract | Retrieve a named object from inside a space ruin. | | Kill Contract | Hunt a named pirate captain in a ruin and bring back their identification tag. | | Survey Contract (pylons) | Calibrate the ruin's survey pylons, survive their defenders, and bring back the printed core. | -| Extraction Contract | Unbolt cargo inside a ruin, deal with the defenders, and bring it home. | +| Extraction Contract | Unbolt cargo inside a ruin with a wrench, deal with the defenders, and bring it home. | | Rescue Contract | Escort a survivor out of a wreck and bring them back alive. | | Suppression Sweep | Confirm the requested pirate kills in the required area, then collect at the board. | | Gas Harvest Contract | Deliver a tank containing the requested gas and amount. Gas already aboard qualifies. See [Fuel & Gas](gas-economy.md). | @@ -100,7 +100,7 @@ These prizes are separate from the offer's ordinary credits, vouchers and goods. | Big Game Hunt | Deploy the supplied lure, kill the named beast, and return its trophy. | | Live Capture | Find the marked specimen, weaken it without killing it, and deliver it alive in the supplied capture crate. | | Poacher Bust | Clear a poacher camp and recover its evidence cache. | -| Prospect Stake | Deploy a claim beacon aboard your ship at the marked coordinates, hold station through its defense, and deliver the deed. | +| Prospect Stake | Land on the marked planet, deploy the claim beacon on open ground, stay with it through its defense, and deliver the deed. | | Containment Contract | Find and neutralize the named anomaly, then deliver its core. | | Core Sample Contract | Complete a planet's sampling work and return the sample. | From fb7eef276134eb7546fccba07d4e243912104ae3 Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Sun, 15 Nov 2026 18:11:25 -0800 Subject: [PATCH 14/29] Mount the chrome cradle's rig on a mast The cradle's surgical rig stands on a low plinth and mast behind the slab, drawn under the slab and the patient, instead of floating above it. The carried implant's path is moved so the gripper sets it down on the patient's chest, and it fades in as it leaves the rig's head. --- voidcrew/modules/cyberware/cyberware_anim2.dm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/voidcrew/modules/cyberware/cyberware_anim2.dm b/voidcrew/modules/cyberware/cyberware_anim2.dm index 0dd1adb2bbb..678644b6ad4 100644 --- a/voidcrew/modules/cyberware/cyberware_anim2.dm +++ b/voidcrew/modules/cyberware/cyberware_anim2.dm @@ -906,10 +906,11 @@ /// Layers on the cradle: the rig over the ware, both over the patient. #define RIG_LAYER (ABOVE_MOB_LAYER + 0.02) #define RIG_WARE_LAYER (ABOVE_MOB_LAYER + 0.01) -/// The gripper's tip, as pixel offsets of the carried ware's centre on the cradle tile. -#define RIG_WARE_X 4 -#define RIG_WARE_PARKED_Y 19 -#define RIG_WARE_WORK_Y 2 +/// The gripper's tip, as pixel offsets of the carried ware's centre on the cradle tile: +/// tucked in the rig's head, then down on the patient's chest. Matches the rig sheet's gripper. +#define RIG_WARE_X 1 +#define RIG_WARE_PARKED_Y 21 +#define RIG_WARE_WORK_Y -4 /// How long each move of the rig takes, matching its art. #define RIG_GRIP_TIME (0.6 SECONDS) #define RIG_PRESS_TIME (0.4 SECONDS) @@ -927,6 +928,11 @@ /obj/machinery/chrome_cradle/update_overlays() . = ..() + // The plinth and mast the rig stands on, behind the slab and under the patient. + var/mutable_appearance/frame = mutable_appearance(CHROME_CRADLE_RIG_ICON, "frame", layer - 0.01) + frame.pixel_x = -16 + frame.pixel_y = -16 + . += frame if(rig_phase) return // The parked rig, over whoever lies on the slab. @@ -981,7 +987,10 @@ carried.transform = matrix().Scale(0.45) carried.pixel_x = RIG_WARE_X carried.pixel_y = RIG_WARE_PARKED_Y + // It comes out of the head: unseen at first, in view as it clears the pod. + carried.alpha = 0 animate(carried, pixel_y = RIG_WARE_WORK_Y, time = RIG_GRIP_TIME, easing = CUBIC_EASING | EASE_OUT) + animate(carried, alpha = 255, time = 0.1 SECONDS, flags = ANIMATION_PARALLEL) rig_ware_ref = WEAKREF(carried) /// The sequence is over, done or not: the rig pulls back and parks. From 77b6798a221aff93ca0eac5c58a7f6a58d603bd5 Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Sun, 15 Nov 2026 18:18:59 -0800 Subject: [PATCH 15/29] Dermal plating deflects bullets from the front Dermal Mesh weave glances 15% of bullets, Hardweave plating 30% and Slabskin plate 45%. Only bullets and buckshot pellets that hit from the front, each pellet rolling on its own; lasers, energy, melee and shots into the back are never deflected. A glanced round turns off at a random angle and keeps flying at reduced damage, with sparks and a ricochet ping, and costs the wearer a little stamina. Deflect shares the cyberware dodge cap (dodge and deflect together never stop more than 60% of shots) and is off while the plating is EMP'd or browned out. Gear ratings and the cyberware wiki page are updated. --- tools/gear_catalog/ratings/cyberware.json | 12 +- .../modules/cyberware/ware_military_body.dm | 12 +- voidcrew/modules/cyberware/ware_models_b.dm | 3 +- voidcrew/modules/cyberware/ware_pro_combat.dm | 134 ++++++++++++++++-- voidcrew/modules/cyberware/ware_street.dm | 16 ++- voidcrew/modules/unit_tests/_unit_tests.dm | 1 + .../unit_tests/voidcrew_cyberware_deflect.dm | 72 ++++++++++ wiki/content/cyberware.md | 7 +- 8 files changed, 232 insertions(+), 25 deletions(-) create mode 100644 voidcrew/modules/unit_tests/voidcrew_cyberware_deflect.dm diff --git a/tools/gear_catalog/ratings/cyberware.json b/tools/gear_catalog/ratings/cyberware.json index d74071c1d64..f6116cd316f 100644 --- a/tools/gear_catalog/ratings/cyberware.json +++ b/tools/gear_catalog/ratings/cyberware.json @@ -449,11 +449,11 @@ "/obj/item/organ/cyberimp/cyberware/dermal_mesh": { "confidence": "high", "group": "Armor and frame", - "hash": "5b60dbb7a15c8084", + "hash": "", "name": "Dermal Mesh weave", - "note": "While online, adds physiology armor to a human wearer: melee 15, bullet 15, laser 10, wound 5. The armor is removed during an EMP reboot or an over-capacity brownout.", + "note": "While online, adds physiology armor to a human wearer: melee 15, bullet 15, laser 10, wound 5. Bullets and buckshot pellets from the front glance off at 15% (each pellet rolls on its own), keep flying at reduced damage and cost the wearer 5 stamina each. Never lasers, energy, melee or shots into the back. Shares the dodge arbiter: dodge plus glance never stop more than 60% of shots. The armor and the glance are off during an EMP reboot or an over-capacity brownout.", "rank": 5, - "reason": "15 melee, 15 bullet, 10 laser on the whole body, on top of whatever you wear. A clear step up for load 2 and 2,000 cr. EMP switches it off for 9 s.", + "reason": "15 melee, 15 bullet, 10 laser on the whole body, on top of whatever you wear, and one bullet in seven from the front glances off. A clear step up for load 2 and 2,000 cr. EMP switches it off for 9 s.", "tier": "yellow" }, "/obj/item/organ/cyberimp/cyberware/dermal_mesh/hardweave": { @@ -779,11 +779,11 @@ "/obj/item/organ/cyberimp/cyberware/slabskin": { "confidence": "high", "group": "Armor and frame", - "hash": "7b785a3adf8b7c37", + "hash": "", "name": "Slabskin plate", - "note": "While online it adds built-in armor to the bearer (melee 25, bullet 25, laser 25, energy 20, bomb 25, fire 20, acid 20, wound 15), and any brute or burn hit of 5 or more throws sparks and often a ricochet sound so others can see the plate. The armor switches off while the ware is EMP'd or browned out.", + "note": "While online it adds built-in armor to the bearer (melee 25, bullet 25, laser 25, energy 20, bomb 25, fire 20, acid 20, wound 15), and any brute or burn hit of 5 or more throws sparks and often a ricochet sound so others can see the plate. Bullets and buckshot pellets from the front glance off at 45% (each pellet rolls on its own), keep flying at reduced damage and cost the wearer 5 stamina each. Never lasers, energy, melee or shots into the back. Shares the dodge arbiter: dodge plus glance never stop more than 60% of shots. The armor and the glance switch off while the ware is EMP'd or browned out.", "rank": 1, - "reason": "25 armor against melee, bullets and lasers on the whole body, multiplied on top of whatever you wear, plus bomb, fire, acid and wounds. About a second armor vest that covers your head and limbs. Load 6, 3 vouchers at reputation 22. EMP switches it off for 9 s.", + "reason": "25 armor against melee, bullets and lasers on the whole body, multiplied on top of whatever you wear, plus bomb, fire, acid and wounds, and almost half of bullets from the front glance off. About a second armor vest that covers your head and limbs, and the best answer to a gunline in the game. Load 6, 3 vouchers at reputation 22. EMP switches it off for 9 s.", "tier": "red" }, "/obj/item/organ/cyberimp/cyberware/slipwire": { diff --git a/voidcrew/modules/cyberware/ware_military_body.dm b/voidcrew/modules/cyberware/ware_military_body.dm index a5cf534aba9..ffd818d7dd5 100644 --- a/voidcrew/modules/cyberware/ware_military_body.dm +++ b/voidcrew/modules/cyberware/ware_military_body.dm @@ -264,7 +264,7 @@ */ /obj/item/organ/cyberimp/cyberware/slabskin name = "\improper Slabskin plate" - desc = "A keel and rib plates of sintered ceramic, grown into the skin of the chest and back. Bullets leave scuffs and a noise like a dropped pan." + desc = "A keel and rib plates of sintered ceramic, grown into the skin of the chest and back. Bullets leave scuffs, when they don't bounce off with a noise like a dropped pan." icon_state = "slabskin" zone = BODY_ZONE_CHEST slot = ORGAN_SLOT_CYBERWARE_DERMAL @@ -276,6 +276,8 @@ /// TRUE while the plate armor is mixed into the bearer's physiology. /// Guards the failing-gated passive hooks against double add/subtract. var/plate_armor_applied = FALSE + /// Percent of bullets from the front that glance off, through the shared dodge arbiter. The top of the dermal ladder. + var/deflect_chance = 45 /obj/item/organ/cyberimp/cyberware/slabskin/on_mob_insert(mob/living/carbon/organ_owner, special = FALSE, movement_flags) . = ..() @@ -283,6 +285,7 @@ /obj/item/organ/cyberimp/cyberware/slabskin/chrome_passives_on(mob/living/carbon/bearer) . = ..() + cyberware_register_deflect_source(bearer, REF(src), CALLBACK(src, PROC_REF(get_deflect_chance))) if(plate_armor_applied || !ishuman(bearer)) return plate_armor_applied = TRUE @@ -291,6 +294,7 @@ /obj/item/organ/cyberimp/cyberware/slabskin/chrome_passives_off(mob/living/carbon/bearer) . = ..() + cyberware_unregister_deflect_source(bearer, REF(src)) if(!plate_armor_applied) return plate_armor_applied = FALSE // reset before the validity skip, or the plate never re-arms after a bearer deletes @@ -303,6 +307,12 @@ . = ..() UnregisterSignal(organ_owner, COMSIG_MOB_APPLY_DAMAGE) +/// Deflect-source callback: nothing while failing. +/obj/item/organ/cyberimp/cyberware/slabskin/proc/get_deflect_chance() + if(organ_flags & ORGAN_FAILING) + return 0 + return deflect_chance + /** * Signal proc for [COMSIG_MOB_APPLY_DAMAGE]: the telegraph. Solid brute or * burn hits spark and ping off the plate where everyone can see them. diff --git a/voidcrew/modules/cyberware/ware_models_b.dm b/voidcrew/modules/cyberware/ware_models_b.dm index 9db419c8cba..7de0991d93c 100644 --- a/voidcrew/modules/cyberware/ware_models_b.dm +++ b/voidcrew/modules/cyberware/ware_models_b.dm @@ -44,12 +44,13 @@ /obj/item/organ/cyberimp/cyberware/dermal_mesh/hardweave name = "\improper Hardweave plating" - desc = "Rib plates over the chest and back with a layered polymer weave sewn in below them, a size up from the usual mesh. The scarring is the part nobody mentions." + desc = "Rib plates over the chest and back with a layered polymer weave sewn in below them, a size up from the usual mesh. Rounds that come in at an angle skip off. The scarring is the part nobody mentions." icon_state = "dermal_mesh_hardweave" aug_overlay = "dermal_mesh_hardweave" chrome_load = 3 tier = CYBERWARE_TIER_2 mesh_armor = /datum/armor/cyberware_hardweave + deflect_chance = 30 // ========================================================================= // STRUT FRAME (T2): the bones and nothing else diff --git a/voidcrew/modules/cyberware/ware_pro_combat.dm b/voidcrew/modules/cyberware/ware_pro_combat.dm index 30371c5e83e..9a7e77c66a0 100644 --- a/voidcrew/modules/cyberware/ware_pro_combat.dm +++ b/voidcrew/modules/cyberware/ware_pro_combat.dm @@ -13,7 +13,10 @@ * COMSIG_ATOM_PRE_BULLET_ACT handler. A source registered with melee = TRUE * (the Cascade line's windows) also dodges blows, through tg's own * check_block() via COMSIG_LIVING_CHECK_BLOCK, so a dodged blow is a real - * miss and never fake damage. + * miss and never fake damage. The same arbiter rolls the dermal plating's + * bullet deflection (see cyberware_register_deflect_source()), capped so a + * dodge and a deflect together never stop more than CYBERWARE_AVOID_CAP + * percent of shots. * - cyberware_is_ally(): the crew filter for auto-targeting ware (Deadeye's * tag, Widowline's cleave). Allies are people who share a ship team with * you; NPC boarders standing on your deck are NOT allies, and rival players @@ -27,6 +30,10 @@ #define CYBERWARE_DODGE_MOVE_WINDOW (1 SECONDS) /// The shortest gap between two dodge lines from a bearer nobody is playing (an NPC under fire). #define CYBERWARE_DODGE_LINE_GAP (1.5 SECONDS) +/// Dodge and deflect together never stop more than this percent of shots. +#define CYBERWARE_AVOID_CAP 60 +/// Stamina each deflected bullet costs the bearer, so focused fire still wears them down. +#define CYBERWARE_DEFLECT_STAMINA 5 /** * The one dodge roll for all cyberware. Lives on the mob; wares and status @@ -53,6 +60,10 @@ var/list/dodge_sources = list() /// key -> /datum/callback for the sources that also dodge blows. Each is in dodge_sources too. var/list/melee_sources = list() + /// key -> /datum/callback returning that source's live bullet-deflect chance (the dermal plating). + var/list/deflect_sources = list() + /// Dodge and deflect together never stop more than this percent of shots. + var/avoid_cap = CYBERWARE_AVOID_CAP /// world.time of the bearer's last move. var/last_move_time = 0 /// world.time a dodge was last announced: an NPC under fire says it at most once every CYBERWARE_DODGE_LINE_GAP, so chat isn't flooded @@ -73,6 +84,7 @@ /datum/component/cyberware_dodge/Destroy() dodge_sources = null melee_sources = null + deflect_sources = null return ..() /// Signal proc for [COMSIG_MOVABLE_MOVED]: timestamp the movement window. @@ -80,25 +92,83 @@ SIGNAL_HANDLER last_move_time = world.time -/// Signal proc for [COMSIG_ATOM_PRE_BULLET_ACT]: the actual dodge roll. +/** + * Signal proc for [COMSIG_ATOM_PRE_BULLET_ACT]: the dodge roll, then the + * deflect roll. One handler for both, so the cap on the two together holds + * no matter which chrome registered first. + */ /datum/component/cyberware_dodge/proc/on_pre_bullet_act(mob/living/source, obj/projectile/hitting_projectile, def_zone, piercing_hit, blocked) SIGNAL_HANDLER - if(world.time - last_move_time > CYBERWARE_DODGE_MOVE_WINDOW) - return NONE - if(source.stat != CONSCIOUS || source.body_position == LYING_DOWN || source.buckled) - return NONE if(!istype(hitting_projectile) || !hitting_projectile.is_hostile_projectile()) return NONE + var/dodge_chance = live_dodge_chance(source, hitting_projectile) + if(dodge_chance > 0 && prob(dodge_chance)) + INVOKE_ASYNC(src, PROC_REF(perform_sidestep), source, hitting_projectile) + return COMPONENT_BULLET_PIERCED + var/deflect_chance = min(live_deflect_chance(source, hitting_projectile), cyberware_deflect_cap(dodge_chance, avoid_cap)) + if(deflect_chance <= 0 || !prob(deflect_chance)) + return NONE + glance(source, hitting_projectile) + return COMPONENT_BULLET_PIERCED + +/// The dodge chance against this shot right now: 0 unless the bearer is moving, upright and not point-blank. +/datum/component/cyberware_dodge/proc/live_dodge_chance(mob/living/source, obj/projectile/hitting_projectile) + if(!length(dodge_sources)) + return 0 + if(world.time - last_move_time > CYBERWARE_DODGE_MOVE_WINDOW) + return 0 + if(source.stat != CONSCIOUS || source.body_position == LYING_DOWN || source.buckled) + return 0 // Point-blank shots always land: an adjacent shooter is inside the // reflex loop. This is the anti-"unhittable in a brawl" rule. var/atom/shooter = hitting_projectile.firer if(shooter && shooter != source && get_dist(source, shooter) <= 1) - return NONE - var/best_chance = best_chance(dodge_sources) - if(best_chance <= 0 || !prob(best_chance)) - return NONE - INVOKE_ASYNC(src, PROC_REF(perform_sidestep), source, hitting_projectile) - return COMPONENT_BULLET_PIERCED + return 0 + return best_chance(dodge_sources) + +/** + * The deflect chance against this shot right now. Only real bullets (and + * each buckshot pellet on its own, since every pellet is its own projectile) + * glance off; lasers, energy and everything else never do. The plate only + * covers what the bearer is facing: a shot into the back always lands. + */ +/datum/component/cyberware_dodge/proc/live_deflect_chance(mob/living/source, obj/projectile/hitting_projectile) + if(!length(deflect_sources)) + return 0 + if(!istype(hitting_projectile, /obj/projectile/bullet) || hitting_projectile.armor_flag != BULLET) + return 0 + if(source.stat == DEAD) + return 0 + if(cyberware_shot_from_behind(source, hitting_projectile)) + return 0 + return best_chance(deflect_sources) + +/** + * The real glance: the bullet's heading turns back off the plate at a random + * angle and the round keeps flying (COMPONENT_BULLET_PIERCED, the same exit + * tg's own reflect takes), so it can still hit whoever stands in its new + * path. It loses energy like any tg ricochet. The bearer stays in the + * bullet's impacted list, so it can't come back for them. + */ +/datum/component/cyberware_dodge/proc/glance(mob/living/source, obj/projectile/bullet) + bullet.set_angle(SIMPLIFY_DEGREES(bullet.angle + pick(-1, 1) * rand(100, 170))) + bullet.damage *= bullet.ricochet_decay_damage + bullet.stamina *= bullet.ricochet_decay_damage + INVOKE_ASYNC(src, PROC_REF(perform_glance), source, bullet.name) + +/// The visible and physical half of a glance: sparks, a ping, and the stamina the hit still costs. +/datum/component/cyberware_dodge/proc/perform_glance(mob/living/source, bullet_name) + if(QDELETED(source)) + return + do_sparks(1, TRUE, source) + playsound(source, SFX_RICOCHET, 60, TRUE) + source.adjustStaminaLoss(CYBERWARE_DEFLECT_STAMINA) + if(source.client || world.time - last_message_at >= CYBERWARE_DODGE_LINE_GAP) + last_message_at = world.time + source.visible_message( + span_danger("\The [bullet_name] glances off [source]!"), + span_danger("\The [bullet_name] glances off you!"), + ) /// The highest live chance among these sources. Never additive. /datum/component/cyberware_dodge/proc/best_chance(list/sources) @@ -206,9 +276,45 @@ return arbiter.dodge_sources -= key arbiter.melee_sources -= key - if(!length(arbiter.dodge_sources)) + if(!length(arbiter.dodge_sources) && !length(arbiter.deflect_sources)) qdel(arbiter) +/** + * Adds (or refreshes) a keyed bullet-deflect source on the bearer, through + * the same arbiter as the dodge. The callback returns the source's CURRENT + * chance. Never additive: the highest live source rolls. + */ +/proc/cyberware_register_deflect_source(mob/living/bearer, key, datum/callback/chance_callback) + if(!istype(bearer) || !key || !chance_callback) + return + var/datum/component/cyberware_dodge/arbiter = bearer.LoadComponent(/datum/component/cyberware_dodge) + arbiter.deflect_sources[key] = chance_callback + +/// Removes a keyed deflect source; the arbiter cleans itself up with the last source of either kind. +/proc/cyberware_unregister_deflect_source(mob/living/bearer, key) + var/datum/component/cyberware_dodge/arbiter = bearer?.GetComponent(/datum/component/cyberware_dodge) + if(!arbiter) + return + arbiter.deflect_sources -= key + if(!length(arbiter.dodge_sources) && !length(arbiter.deflect_sources)) + qdel(arbiter) + +/** + * The most a deflect may roll after a dodge roll at dodge_chance missed, so + * that dodge and deflect together never stop more than avoid_cap + * percent of shots: dodge + (1 - dodge) * deflect <= cap. + */ +/proc/cyberware_deflect_cap(dodge_chance, avoid_cap = CYBERWARE_AVOID_CAP) + dodge_chance = clamp(dodge_chance, 0, 100) + if(dodge_chance >= avoid_cap) + return 0 + return (avoid_cap - dodge_chance) * 100 / (100 - dodge_chance) + +/// Whether this shot is travelling the way the bearer faces, so it strikes them in the back. +/proc/cyberware_shot_from_behind(mob/living/bearer, obj/projectile/shot) + var/offset = SIMPLIFY_DEGREES(shot.angle - dir2angle(bearer.dir) + 180) - 180 + return abs(offset) < 90 + // ---- Shared ally filter ------------------------------------------------ /** @@ -811,6 +917,8 @@ #undef CYBERWARE_DODGE_MOVE_WINDOW #undef CYBERWARE_DODGE_LINE_GAP +#undef CYBERWARE_AVOID_CAP +#undef CYBERWARE_DEFLECT_STAMINA #undef CYBERWARE_DEADEYE_TAG_RANGE #undef CYBERWARE_DEADEYE_TAG_SHOTS #undef CYBERWARE_DEADEYE_TAG_DURATION diff --git a/voidcrew/modules/cyberware/ware_street.dm b/voidcrew/modules/cyberware/ware_street.dm index 70d6d2a1751..9fe5c186db2 100644 --- a/voidcrew/modules/cyberware/ware_street.dm +++ b/voidcrew/modules/cyberware/ware_street.dm @@ -745,10 +745,14 @@ GLOBAL_LIST_INIT(cyberware_ink_palette, list( * add/subtract pair per flip is the whole lifecycle; re-applying on species * gain would stack the armor. The pair rides the failing-gated passive hooks * (BAL-4): EMP-scrambled or browned-out mesh armors nothing. + * + * The dermal ladder (Mesh, Hardweave, Slabskin) also turns bullets: a + * passive deflect source in the shared dodge arbiter (ware_pro_combat.dm), + * 15/30/45% by rung, front arc only, rides the same passive hooks. */ /obj/item/organ/cyberimp/cyberware/dermal_mesh name = "\improper Dermal Mesh weave" - desc = "A subdermal lattice of impact polymer. It won't stop anything serious, but it takes the edge off." + desc = "A subdermal lattice of impact polymer. It won't stop anything serious, but now and then a round skips off it." icon_state = "dermal_mesh" zone = BODY_ZONE_CHEST slot = ORGAN_SLOT_CYBERWARE_DERMAL @@ -761,9 +765,12 @@ GLOBAL_LIST_INIT(cyberware_ink_palette, list( var/datum/armor/mesh_armor = /datum/armor/cyberware_dermal_mesh /// TRUE while mesh_armor is mixed in; guards against double add/subtract. var/mesh_armor_applied = FALSE + /// Percent of bullets from the front that glance off, through the shared dodge arbiter. + var/deflect_chance = 15 /obj/item/organ/cyberimp/cyberware/dermal_mesh/chrome_passives_on(mob/living/carbon/bearer) . = ..() + cyberware_register_deflect_source(bearer, REF(src), CALLBACK(src, PROC_REF(get_deflect_chance))) if(mesh_armor_applied || !ishuman(bearer)) return mesh_armor_applied = TRUE @@ -772,6 +779,7 @@ GLOBAL_LIST_INIT(cyberware_ink_palette, list( /obj/item/organ/cyberimp/cyberware/dermal_mesh/chrome_passives_off(mob/living/carbon/bearer) . = ..() + cyberware_unregister_deflect_source(bearer, REF(src)) if(!mesh_armor_applied) return mesh_armor_applied = FALSE // reset before the validity skip, see Shock Coils @@ -780,6 +788,12 @@ GLOBAL_LIST_INIT(cyberware_ink_palette, list( var/mob/living/carbon/human/human_bearer = bearer human_bearer.physiology.armor = human_bearer.physiology.armor.subtract_other_armor(mesh_armor) +/// Deflect-source callback: nothing while failing. +/obj/item/organ/cyberimp/cyberware/dermal_mesh/proc/get_deflect_chance() + if(organ_flags & ORGAN_FAILING) + return 0 + return deflect_chance + // ---- 11. Gecko Grips --------------------------------------------------- /** diff --git a/voidcrew/modules/unit_tests/_unit_tests.dm b/voidcrew/modules/unit_tests/_unit_tests.dm index 7a2504fde47..0f99cc4f63d 100644 --- a/voidcrew/modules/unit_tests/_unit_tests.dm +++ b/voidcrew/modules/unit_tests/_unit_tests.dm @@ -76,6 +76,7 @@ #include "voidcrew_cyberware.dm" #include "voidcrew_cyberware_anim.dm" #include "voidcrew_cyberware_anim2.dm" +#include "voidcrew_cyberware_deflect.dm" #include "voidcrew_cyberware_kit.dm" #include "voidcrew_cyberware_mantis.dm" #include "voidcrew_cyberware_matrix.dm" diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware_deflect.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware_deflect.dm new file mode 100644 index 00000000000..696e4b85e95 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware_deflect.dm @@ -0,0 +1,72 @@ +/// The dermal ladder turns bullets from the front: a real glance that leaves +/// the bearer unhurt and keeps the round flying on a new heading, costs a +/// little stamina, never touches lasers or shots into the back, switches off +/// with the chrome, and never lifts dodge plus deflect past the shared cap. +/datum/unit_test/voidcrew_cyberware_deflect + +/datum/unit_test/voidcrew_cyberware_deflect/Run() + var/obj/item/organ/cyberimp/cyberware/dermal_mesh/mesh = allocate(/obj/item/organ/cyberimp/cyberware/dermal_mesh) + var/obj/item/organ/cyberimp/cyberware/dermal_mesh/hardweave/hardweave = allocate(/obj/item/organ/cyberimp/cyberware/dermal_mesh/hardweave) + var/obj/item/organ/cyberimp/cyberware/slabskin/slab = allocate(/obj/item/organ/cyberimp/cyberware/slabskin) + TEST_ASSERT_EQUAL(mesh.deflect_chance, 15, "Dermal Mesh deflects at the wrong chance") + TEST_ASSERT_EQUAL(hardweave.deflect_chance, 30, "Hardweave deflects at the wrong chance") + TEST_ASSERT_EQUAL(slab.deflect_chance, 45, "Slabskin deflects at the wrong chance") + + // The cap: dodge + (1 - dodge) * deflect never passes 60%. + TEST_ASSERT_EQUAL(cyberware_deflect_cap(0), 60, "The deflect cap is wrong with no dodge") + TEST_ASSERT_EQUAL(cyberware_deflect_cap(60), 0, "A full-cap dodge still left room to deflect") + for(var/dodge in list(0, 15, 30, 45, 59)) + var/deflect = min(slab.deflect_chance, cyberware_deflect_cap(dodge)) + var/combined = dodge + (100 - dodge) * deflect / 100 + TEST_ASSERT(combined <= 60.001, "Dodge [dodge] plus deflect stops [combined]% of shots") + + var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human/consistent) + var/mob/living/carbon/human/shooter = allocate(/mob/living/carbon/human/consistent, run_loc_floor_bottom_left) + TEST_ASSERT(slab.Insert(patient, TRUE), "Slabskin fixture failed") + var/datum/component/cyberware_dodge/arbiter = patient.GetComponent(/datum/component/cyberware_dodge) + TEST_ASSERT_NOTNULL(arbiter, "Slabskin didn't register a deflect source") + // Force every glance: a 100% plate under a lifted cap. The cap itself is checked above. + slab.deflect_chance = 100 + arbiter.avoid_cap = 100 + patient.setDir(SOUTH) + + // A bullet from the front (travelling north into a bearer facing south) glances off. + var/obj/projectile/bullet/c9mm/front = make_shot(/obj/projectile/bullet/c9mm, shooter, 0) + var/front_damage = front.damage + TEST_ASSERT_EQUAL(patient.bullet_act(front, BODY_ZONE_CHEST), BULLET_ACT_FORCE_PIERCE, "A bullet from the front didn't glance off") + TEST_ASSERT_EQUAL(patient.getBruteLoss(), 0, "A glanced bullet still hurt") + TEST_ASSERT(front.angle != 0, "The glanced bullet kept its heading") + TEST_ASSERT(front.damage < front_damage, "The glanced bullet lost no energy") + TEST_ASSERT(patient.getStaminaLoss() > 0, "A glance cost no stamina") + + // Every buckshot pellet is a bullet of its own and rolls on its own. + var/obj/projectile/bullet/pellet/shotgun_buckshot/pellet = make_shot(/obj/projectile/bullet/pellet/shotgun_buckshot, shooter, 0) + TEST_ASSERT_EQUAL(patient.bullet_act(pellet, BODY_ZONE_CHEST), BULLET_ACT_FORCE_PIERCE, "A buckshot pellet didn't glance off") + + // A bullet into the back always lands. + var/obj/projectile/bullet/c9mm/back = make_shot(/obj/projectile/bullet/c9mm, shooter, 180) + TEST_ASSERT_NOTEQUAL(patient.bullet_act(back, BODY_ZONE_CHEST), BULLET_ACT_FORCE_PIERCE, "A bullet into the back glanced off") + TEST_ASSERT(patient.getBruteLoss() > 0, "A bullet into the back did nothing") + + // Lasers are never deflected. + var/obj/projectile/beam/laser/laser = make_shot(/obj/projectile/beam/laser, shooter, 0) + TEST_ASSERT_NOTEQUAL(patient.bullet_act(laser, BODY_ZONE_CHEST), BULLET_ACT_FORCE_PIERCE, "A laser glanced off the plate") + TEST_ASSERT(patient.getFireLoss() > 0, "The laser did nothing") + + // A failing plate deflects nothing. + slab.organ_flags |= ORGAN_FAILING + var/obj/projectile/bullet/c9mm/failing = make_shot(/obj/projectile/bullet/c9mm, shooter, 0) + TEST_ASSERT_NOTEQUAL(patient.bullet_act(failing, BODY_ZONE_CHEST), BULLET_ACT_FORCE_PIERCE, "A failing plate still deflected") + slab.organ_flags &= ~ORGAN_FAILING + + // Taking the plate out takes the deflect with it. + slab.Remove(patient) + TEST_ASSERT_NULL(patient.GetComponent(/datum/component/cyberware_dodge), "The deflect source outlived the plate") + +/// A hostile shot from the shooter, heading at the given angle, ready for bullet_act(). +/datum/unit_test/voidcrew_cyberware_deflect/proc/make_shot(shot_type, mob/living/shooter, heading) + var/obj/projectile/shot = allocate(shot_type) + shot.firer = shooter + shot.def_zone = BODY_ZONE_CHEST + shot.set_angle(heading) + return shot diff --git a/wiki/content/cyberware.md b/wiki/content/cyberware.md index a6838a6896a..8339f1313e4 100644 --- a/wiki/content/cyberware.md +++ b/wiki/content/cyberware.md @@ -47,7 +47,7 @@ Prices are the same at both counters, stock is limited per round, and load is th | Cargo Cavity | 1,000 cr | 1 | A chest stash for one small item that no scanner, pat-down or Chrome Read finds | | Rockjaw drill fist | 1,200 cr | 2 | Deployable forearm mining drill; ore from walls you crack auto-pockets into a hopper | | Fixer's Fingers | 1,800 cr | 2 | Fingertip screwdriver, wrench and wirecutters, plus 25% faster timed actions full-time | -| Dermal Mesh weave | 2,000 cr | 2 | Light built-in armor: melee 15, bullet 15, laser 10 | +| Dermal Mesh weave | 2,000 cr | 2 | Light built-in armor: melee 15, bullet 15, laser 10. 15% of bullets from the front glance off | ### Tier 2: Pro chrome (credits or vouchers) @@ -76,7 +76,7 @@ Prices are the same at both counters, stock is limited per round, and load is th | Widowline monowire | 3 | 5 | A two-tile whip that ignores armor entirely and cuts through into one person standing right behind the target for 75% | | Popup Ronin housing | *loot only* | 5 | Deployable full-auto machine pistol in 10x24mm caseless. Reloads are sold at the parlor or printed with Experimental Ammunition | | Rigger socket | 3 | 4 | Jack into your own ship's helm from anywhere aboard and fly it from a corridor | -| Slabskin plate | 3 | 6 | Heavy built-in armor in every damage type. Solid hits visibly spark off you. Everyone can see you are plated | +| Slabskin plate | 3 | 6 | Heavy built-in armor in every damage type. 45% of bullets from the front glance off. Solid hits visibly spark off you. Everyone can see you are plated | | Mantis Blades (pair) | 4 | 3/arm | Deployable hardlight blades, plus a five-tile lunge that knocks the target down. Press and hold the lunge on a target to crouch, and let go to spring up to seven tiles; a solid hit or a stun while you crouch wastes it. A kill brings the lunge back almost at once. Three quick cuts to one limb open its artery, a two-blade lunge skewers someone already hurt, every third cut with both blades out crosses them and staggers, and a swing at the head of someone dying takes it off | | Bunker Buster housing | *loot only* | 5 | Two shaped micro-rockets: 60 damage, no splash, will never breach a hull. Reloads are sold at the parlor or printed with Experimental Ammunition | | Ghostskin weave | 4 | 5 | Ten seconds of optical camo. NPCs will not target you, and Chrome Reads scatter. Attacking, throwing, taking a hit or a shock, or an EMP drops it | @@ -118,7 +118,7 @@ The newer makers fill in the gaps under the big names. Each takes the same slot - **Brawler myomers**: a cased pair of forearms that hit hard, break rock, slam a held body down and force an airlock, slower than Gorilla Arms. - **Tinker's fingers** and the **Deepcore drill fist**: a looser set of fingertip tools, and a heavier drill on the same ore hopper. - **Holdout housing**: a snub revolver folded into the forearm, loaded one round at a time. -- **Hardweave plating** and the **Strut frame**: a heavier dermal weave, and a frame that keeps your bones whole. +- **Hardweave plating** and the **Strut frame**: a heavier dermal weave that turns 30% of bullets from the front, and a frame that keeps your bones whole. - **Deep-lung bladder**, **Heat-sink lining** and **Frostline lining**: a longer breath, a lining for the heat, a lining for the cold. - **Twitchwire** and the **Weaver shunt**: a twitchy reflex shunt, and the service model. - **Thumper ear**: a louder, shorter-ranged sonar behind the ear. @@ -137,4 +137,5 @@ Most of the roster also appears in zone loot caches. Street and utility chrome a - **EMP is the hard counter.** A pulse downs every piece you carry (nine seconds on a heavy blast, four and a half on a light one) then it reboots on its own. Gecko Grips spasm and throw whatever you are holding, Ghostskin camo collapses, and a Cascade window crashes on the spot. A Cradle tune-up cancels the reboot early. Actions and arm weapons stay unavailable while the chrome is offline. An EMP interrupting Lazarus during its charge does not spend the revival charge. - **Detection cuts both ways.** Chrome optics carry the Chrome Read, a scan that names a target's ware (street optics only count it), and the subject always feels the handshake. The Cargo Cavity never resolves on any scan, and Ghostskin scatters reads entirely. - **Death does not keep it.** Gibbing, dusting or destroying a limb ejects every piece onto the floor, and killers absolutely loot a chromed corpse. Cloning leaves the chrome on the body. +- **Plating turns bullets.** Dermal Mesh, Hardweave and Slabskin make bullets and buckshot pellets glance off with a spark and a ping, each pellet on its own. It never stops lasers, energy or blows, and never a shot into your back. The round keeps flying, so whoever stands beside you can still catch it. Each glance costs a little stamina, so steady fire still wears you down. A dodge and a glance together never stop more than 60% of shots. - **Nothing is subtle.** Slabskin sparks on every hit, the Chromatic Dermis flares whenever your chrome fires, and the heavy installs change how you look. Chromed is a fashion statement whether you want it or not. From 0f6cef40a27dd094e5dd286b1a578ddf6195723b Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Sun, 15 Nov 2026 18:29:59 -0800 Subject: [PATCH 16/29] Bounty criminals and companions get combat sense against stun weapons Normal criminals and their companions react to stun fire as pirates and prison guards do. Hit by a disabler or another stun shot, a criminal whose style shoots or throws from range runs for the nearest cover on its leash and looks out again a moment later; a fist, knife, bat or shotgun fighter charges the shooter. A Wanted criminal carries a stimpack and a Most Wanted one a combat stimpack, when the style leaves a pocket free, and jabs it when it tires in a fight. Petty criminals and companions carry none. Meek criminals, decoys and bosses have no combat sense. --- tgstation.dme | 1 + voidcrew/modules/bounties/bounty_ai_normal.dm | 22 ++++++-- .../modules/bounties/bounty_combat_sense.dm | 51 +++++++++++++++++++ .../modules/bounties/bounty_companions.dm | 1 + .../voidcrew_human_npcs_combat_sense.dm | 49 +++++++++++++++++- wiki/content/bounty-hunting.md | 2 + 6 files changed, 122 insertions(+), 4 deletions(-) create mode 100644 voidcrew/modules/bounties/bounty_combat_sense.dm diff --git a/tgstation.dme b/tgstation.dme index 264860bf390..3c452f62bb7 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -7103,6 +7103,7 @@ #include "voidcrew\modules\bounties\bounty_board.dm" #include "voidcrew\modules\bounties\bounty_boss.dm" #include "voidcrew\modules\bounties\bounty_boss_kits.dm" +#include "voidcrew\modules\bounties\bounty_combat_sense.dm" #include "voidcrew\modules\bounties\bounty_companions.dm" #include "voidcrew\modules\bounties\bounty_criminal.dm" #include "voidcrew\modules\bounties\bounty_identity.dm" diff --git a/voidcrew/modules/bounties/bounty_ai_normal.dm b/voidcrew/modules/bounties/bounty_ai_normal.dm index 6630df3e905..f8131b6a2bc 100644 --- a/voidcrew/modules/bounties/bounty_ai_normal.dm +++ b/voidcrew/modules/bounties/bounty_ai_normal.dm @@ -15,7 +15,8 @@ * - 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. + * and a bruise pack; a stimpack when Wanted, a combat stimpack when Most Wanted, if a pocket is free; + * - combat sense (bounty_combat_sense.dm): the stimpack when they tire, cover or a charge under stun fire. * * The shared vars are declared in bounty_types.dm and nowhere else; a var only P3 uses has an * `ai_` prefix. @@ -34,6 +35,7 @@ /datum/ai_planning_subtree/bounty_gate, /datum/ai_planning_subtree/bounty_notice, /datum/ai_planning_subtree/bounty_fight_target, + /datum/ai_planning_subtree/npc_combat_sense, /datum/ai_planning_subtree/bounty_arm, /datum/ai_planning_subtree/bounty_ranged, /datum/ai_planning_subtree/bounty_melee, @@ -51,9 +53,23 @@ return key return BOUNTY_STYLE_BRAWLER -/// Plain clothes for their zone, their tier's armour, their style's weapon and spares, and a bruise pack +/** + * Plain clothes for their zone, their tier's armour, their style's weapon and spares, a bruise pack, and a + * stimulant for when they tire in a fight (combat sense, bounty_combat_sense.dm): a stimpack when Wanted, + * a combat stimpack when Most Wanted. The stimulant goes in a pocket, if the style left one free: a pistol's + * spare magazine or a knife fills the second pocket, and a holster or bandolier takes nothing else. + */ /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) + var/datum/outfit/outfit = bounty_fighter_outfit(BOUNTY_ARCHETYPE_NORMAL, zone, record?.tier, ai_wanted_style(), ai_heavy_weapon(), /obj/item/stack/medical/bruise_pack) + var/stimulant + switch(record?.tier) + if(BOUNTY_TIER_WANTED) + stimulant = /obj/item/reagent_containers/hypospray/medipen/stimpack + if(BOUNTY_TIER_MOST_WANTED) + stimulant = /obj/item/reagent_containers/hypospray/medipen/stimpack/traitor + if(stimulant && outfit && (!outfit.r_pocket || !outfit.l_pocket)) + bounty_outfit_carry(outfit, stimulant) + return outfit /mob/living/carbon/human/npc/bounty_criminal/normal/ai_notice(mob/living/hunter) var/mob/living/watched = ai_threat() diff --git a/voidcrew/modules/bounties/bounty_combat_sense.dm b/voidcrew/modules/bounties/bounty_combat_sense.dm new file mode 100644 index 00000000000..4c7b16afc5a --- /dev/null +++ b/voidcrew/modules/bounties/bounty_combat_sense.dm @@ -0,0 +1,51 @@ +/** + * Combat sense for bounty fighters (voidcrew/modules/human_npcs/human_npc_combat_sense.dm): normal + * criminals and their companions. Meek criminals (they run), decoys (patrons) and bosses (their own + * stimulant and fallback, bounty_boss.dm) don't have it. + * + * What they carry: a Wanted normal criminal also packs a stimpack, a Most Wanted one a combat stimpack + * (bounty_ai_normal.dm, bounty_build_outfit()), used when it tires in a fight, when its style leaves a + * pocket free (brawler, club, bottle, shotgun; not pistol or knife). Petty criminals and companions carry + * none. Under stun fire a criminal whose style shoots or throws from range runs for + * cover; a brawler, knife, club or shotgun style charges the shooter. Cover stays on the criminal's leash + * (leash_ok(); a companion keeps to its criminal's), and the movement is the bounty AI's own leash pathing. + */ +/datum/npc_combat_sense/bounty + +/mob/living/carbon/human/npc/bounty_criminal/normal + npc_combat_sense = /datum/npc_combat_sense/bounty + +/mob/living/carbon/human/npc/bounty_companion + npc_combat_sense = /datum/npc_combat_sense/bounty + +/datum/npc_combat_sense/bounty/can_act(mob/living/carbon/human/npc, datum/ai_controller/controller) + if(!..()) + return FALSE + if(istype(npc, /mob/living/carbon/human/npc/bounty_criminal)) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = npc + return criminal.ai_can_act() && !criminal.hidden && !criminal.blended + if(istype(npc, /mob/living/carbon/human/npc/bounty_companion)) + var/mob/living/carbon/human/npc/bounty_companion/companion = npc + return companion.ai_can_fight() + return TRUE + +// A criminal shares the players' faction until its placement says otherwise: its gang is its side. +/datum/npc_combat_sense/bounty/allied(mob/living/carbon/human/npc, atom/shooter) + return bounty_ai_same_gang(npc, shooter) + +/datum/npc_combat_sense/bounty/in_fight(mob/living/carbon/human/npc, datum/ai_controller/controller, datum/component/npc_combat_sense/sense) + return bounty_ai_fighting(npc) || sense.under_fire() + +/// Its style's distance: a gun style's shooting range, 1 for the melee styles +/datum/npc_combat_sense/bounty/reach(mob/living/carbon/human/npc, datum/ai_controller/controller) + var/datum/bounty_style/style = bounty_ai_style(npc) + if(!style?.ranged) + return 1 + var/datum/ai_behavior/shoot = GET_AI_BEHAVIOR(style.ranged_behavior) + return shoot?.required_distance || BOUNTY_PISTOL_RANGE + +/datum/npc_combat_sense/bounty/tile_ok(mob/living/carbon/human/npc, datum/ai_controller/controller, turf/tile) + if(!..()) + return FALSE + var/mob/living/carbon/human/npc/bounty_criminal/side = bounty_ai_side_of(npc) + return isnull(side) || side.leash_ok(tile) diff --git a/voidcrew/modules/bounties/bounty_companions.dm b/voidcrew/modules/bounties/bounty_companions.dm index af7be6123ef..b2a0e4594a1 100644 --- a/voidcrew/modules/bounties/bounty_companions.dm +++ b/voidcrew/modules/bounties/bounty_companions.dm @@ -549,6 +549,7 @@ /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/npc_combat_sense, /datum/ai_planning_subtree/bounty_arm, /datum/ai_planning_subtree/bounty_ranged, /datum/ai_planning_subtree/bounty_melee, diff --git a/voidcrew/modules/unit_tests/voidcrew_human_npcs_combat_sense.dm b/voidcrew/modules/unit_tests/voidcrew_human_npcs_combat_sense.dm index b3f34f8905e..4150fb56244 100644 --- a/voidcrew/modules/unit_tests/voidcrew_human_npcs_combat_sense.dm +++ b/voidcrew/modules/unit_tests/voidcrew_human_npcs_combat_sense.dm @@ -56,6 +56,19 @@ bolt.starting = get_turf(hunter) target.bullet_act(bolt, BODY_ZONE_CHEST) +/// A normal criminal of `tier` fighting in `style`, made the way production makes one (its record as its look) +/datum/unit_test/voidcrew_human_npc_combat_sense/proc/make_normal_criminal(tier, style, turf/where) + var/datum/bounty_record/record = generate_bounty_record(tier, "normal", "planet", /datum/species/human) // BOUNTY_ARCHETYPE_NORMAL, BOUNTY_PLACEMENT_PLANET + record.tier = tier + record.style = style + var/datum/human_npc_order/order = spawn_human_npc(/mob/living/carbon/human/npc/bounty_criminal/normal, where, look = record, immediate = TRUE) + var/mob/living/carbon/human/npc/bounty_criminal/normal/criminal = order?.spawned_ref?.resolve() + qdel(order) + if(criminal) + allocated += criminal + criminal.ai_update_style() + return criminal + /// Whether `npc`'s rules let it act right now (false while a get-up do_after runs) /datum/unit_test/voidcrew_human_npc_combat_sense/proc/sense_acts_mid_get_up(mob/living/carbon/human/npc/npc) if(!LAZYLEN(npc.do_afters)) @@ -331,6 +344,8 @@ /mob/living/carbon/human/npc/faction_pirate/silverscale/ranged, /mob/living/carbon/human/npc/faction_pirate/grey/captain, /mob/living/carbon/human/npc/ruin/trooper/syndicate, + /mob/living/carbon/human/npc/bounty_criminal/normal, + /mob/living/carbon/human/npc/bounty_companion, /mob/living/carbon/human/npc/outpost_prison_guard, )) var/mob/living/carbon/human/npc/armed_path = armed_type @@ -343,10 +358,42 @@ TEST_ASSERT_NULL(civilian.GetComponent(/datum/component/npc_combat_sense), "A townsperson has combat sense") TEST_ASSERT_NULL(civilian.ai_controller?.blackboard["human_npc_cover"], "A townsperson ran for cover") -/// The families' rules: a pirate holding its ground stays put, and a pirate with no crew keeps near home. +/// The families' rules: a Wanted criminal carries a stimpack and keeps cover on its leash; a Petty one +/// carries none; a pirate holding its ground stays put, and a pirate with no crew keeps near home. /datum/unit_test/voidcrew_human_npc_combat_sense/families /datum/unit_test/voidcrew_human_npc_combat_sense/families/Run() + // BOUNTY_TIER_WANTED 2, BOUNTY_STYLE_BRAWLER: a free pocket for the stimpack + var/mob/living/carbon/human/npc/bounty_criminal/normal/wanted = make_normal_criminal(2, "brawler", tile(2, 2)) + TEST_ASSERT_NOTNULL(wanted, "Test fixture: no Wanted criminal was made") + var/obj/item/reagent_containers/hypospray/medipen/wanted_stim = human_npc_find_stim(wanted) + TEST_ASSERT_NOTNULL(wanted_stim, "A Wanted brawler carries no stimpack it can reach") + TEST_ASSERT_EQUAL(wanted_stim.type, /obj/item/reagent_containers/hypospray/medipen/stimpack, "A Wanted brawler carries the wrong stimulant") + var/datum/component/npc_combat_sense/sense = wanted.GetComponent(/datum/component/npc_combat_sense) + TEST_ASSERT_NOTNULL(sense, "A Wanted criminal has no combat sense") + TEST_ASSERT_EQUAL(sense.rules.reach(wanted, wanted.ai_controller), 1, "A brawler counts as a gunner") + var/turf/corner = tile(1, 1) + var/turf/far_corner = tile(3, 3) + wanted.site_bounds = list(corner.x, corner.y, far_corner.x, far_corner.y, corner.z) + TEST_ASSERT(sense.rules.tile_ok(wanted, wanted.ai_controller, tile(2, 3)), "A tile on the criminal's leash is refused") + TEST_ASSERT(!sense.rules.tile_ok(wanted, wanted.ai_controller, tile(4, 4)), "A tile off the criminal's leash is allowed") + + var/mob/living/carbon/human/npc/bounty_criminal/normal/petty = make_normal_criminal(1, "brawler", tile(0, 0)) // BOUNTY_TIER_PETTY + TEST_ASSERT_NOTNULL(petty, "Test fixture: no Petty criminal was made") + TEST_ASSERT_NULL(human_npc_find_stim(petty), "A Petty criminal carries a stimpack") + TEST_ASSERT_NOTNULL(petty.GetComponent(/datum/component/npc_combat_sense), "A Petty criminal has no combat sense") + + var/mob/living/carbon/human/npc/bounty_criminal/normal/most_wanted = make_normal_criminal(3, "club", tile(0, 4)) // BOUNTY_TIER_MOST_WANTED + TEST_ASSERT_NOTNULL(most_wanted, "Test fixture: no Most Wanted criminal was made") + var/obj/item/reagent_containers/hypospray/medipen/combat_stim = human_npc_find_stim(most_wanted) + TEST_ASSERT_NOTNULL(combat_stim, "A Most Wanted club fighter carries no stimulant") + TEST_ASSERT_EQUAL(combat_stim.type, /obj/item/reagent_containers/hypospray/medipen/stimpack/traitor, "A Most Wanted club fighter doesn't carry a combat stimpack") + + var/mob/living/carbon/human/npc/bounty_criminal/normal/gunman = make_normal_criminal(2, "pistol", tile(4, 4)) // BOUNTY_STYLE_PISTOL + TEST_ASSERT_NOTNULL(gunman, "Test fixture: no Wanted gunman was made") + var/datum/component/npc_combat_sense/gunman_sense = gunman.GetComponent(/datum/component/npc_combat_sense) + TEST_ASSERT(gunman_sense.rules.reach(gunman, gunman.ai_controller) > 3, "A pistol criminal counts as a close fighter") // HUMAN_NPC_SENSE_CLOSE_IN_REACH + var/datum/human_npc_order/order = spawn_human_npc(/mob/living/carbon/human/npc/faction_pirate/grey/ranged, tile(4, 0), immediate = TRUE) var/mob/living/carbon/human/npc/faction_pirate/grey/ranged/pirate = order?.spawned_ref?.resolve() qdel(order) diff --git a/wiki/content/bounty-hunting.md b/wiki/content/bounty-hunting.md index 0bf64a28862..917b32ce1f6 100644 --- a/wiki/content/bounty-hunting.md +++ b/wiki/content/bounty-hunting.md @@ -101,6 +101,8 @@ About 70% of Wanted criminals and 30% of Petty ones are normal. A Wanted crimina - Guns stay in a holster, on the belt or slung on the back until the fight. You see one drawn, and the first shot comes a moment later; hit them while they draw and they fumble it. - Their pistols fire single shots, two a second, in strings of six with a short pause between. So do the kingpin's goons and Club Volga's gunmen. The WT-550 fires bursts of four, and a burst stops as soon as the shooter goes down or loses you. - Wanted criminals wear an armour vest, and Most Wanted a vest and a helmet. Nothing a criminal carries can be taken: it goes with the body. +- Wanted criminals carry a stimpack if their pockets have room, and jab it when they tire in a fight. +- Hit by a disabler or other stun shot, a gunner or bottle thrower ducks behind the nearest cover and looks out again a moment later. A fist, knife, bat or shotgun fighter charges whoever shot it. - They may have up to two companions who fight beside them. Companions can be of any species and wear rough clothes for where they are. Companions pay nothing. They may run when badly hurt or when their criminal goes down, and when they come round from a stun they may give up or run. - Badly hurt, with two hunters nearby who can see them, they may give up: they put their weapon away, put their hands on their head and lie down for 20 seconds. Cuff them then for full pay. If nobody does, they get up and decide again. - Badly hurt with nobody around, they break off, sit down and patch themselves up with what they carry. From 8f3dc2be3de905080949f8fc720846f58398cfc0 Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Sun, 15 Nov 2026 18:35:55 -0800 Subject: [PATCH 17/29] Bounty criminals carry chrome; the cyberpsycho - Some criminals carry the cyberware players buy, installed in their real body, and fight with it: Cascade lattice, Mantis Blades, Gorilla Arms, Redline core, Meteor Piledriver, Lazarus and Deadeye. Higher tiers carry it more often; companions rarely and never more than one piece; meek criminals never. Every move has a visible wind-up, an EMP knocks a piece out, and NPC chrome never drops. - The cyberpsycho: a new Most Wanted mini-boss with Mantis on one arm, Gorilla on the other, the Piledriver, a Lazarus node and Deadeye optics, and Redline as its second phase. - Mini-bosses engage the whole hunting crew on the site, come through or break for cover when shot from somewhere they cannot reach, have their own answer to disablers each and carry a combat stimpack. In vacuum they seal up in locked MODsuits. The Pyromaniac carries a real flamethrower, a molotov, smoke grenades and a gas mask. - Companions back their criminal up, at most one per posting carries a gun, and the card says who the criminal was seen with. Bounty guns reach 7 tiles, and criminals, companions, mini-bosses, the kingpin's goons and Club Volga move at a person's pace in a fight. - Cyber optics read a criminal's chrome, and the criminal notices. The Bounty Panel can spawn a criminal with chosen chrome or a cyberpsycho. The wiki's bounty and pirate pages are updated. --- tgstation.dme | 9 + tools/gear_catalog/ratings/explosives.json | 1 + tools/gear_catalog/ratings/guns.json | 1 + tools/gear_catalog/ratings/modsuits.json | 6 + voidcrew/_DEFINES/bounties.dm | 2 + voidcrew/_DEFINES/bounty_ai.dm | 16 +- voidcrew/_DEFINES/bounty_bosses.dm | 98 +- voidcrew/_DEFINES/bounty_chrome.dm | 56 + voidcrew/modules/bounties/bounty_admin.dm | 76 +- voidcrew/modules/bounties/bounty_ai.dm | 49 +- voidcrew/modules/bounties/bounty_ai_human.dm | 2 +- voidcrew/modules/bounties/bounty_ai_normal.dm | 23 +- voidcrew/modules/bounties/bounty_boss.dm | 879 +++++++++- voidcrew/modules/bounties/bounty_boss_kits.dm | 653 +++++++- voidcrew/modules/bounties/bounty_chrome.dm | 1450 +++++++++++++++++ .../modules/bounties/bounty_combat_sense.dm | 4 +- .../modules/bounties/bounty_companions.dm | 156 +- voidcrew/modules/bounties/bounty_criminal.dm | 6 + voidcrew/modules/bounties/bounty_identity.dm | 5 + .../modules/bounties/bounty_lair_mafia.dm | 4 +- voidcrew/modules/bounties/bounty_outfits.dm | 3 + voidcrew/modules/bounties/bounty_outpost.dm | 12 + voidcrew/modules/bounties/bounty_placement.dm | 35 +- voidcrew/modules/bounties/bounty_posting.dm | 51 +- voidcrew/modules/bounties/bounty_styles.dm | 57 +- voidcrew/modules/bounties/bounty_suits.dm | 99 +- voidcrew/modules/bounties/bounty_types.dm | 2 + .../bounties/chrome/bounty_chrome_cascade.dm | 169 ++ .../bounties/chrome/bounty_chrome_deadeye.dm | 194 +++ .../bounties/chrome/bounty_chrome_gorilla.dm | 816 ++++++++++ .../bounties/chrome/bounty_chrome_mantis.dm | 354 ++++ .../chrome/bounty_chrome_piledriver.dm | 214 +++ .../bounties/chrome/bounty_chrome_redline.dm | 117 ++ .../bounties/chrome/bounty_cyberpsycho.dm | 348 ++++ .../bounties/strings/bounty_criminals.json | 132 +- voidcrew/modules/cyberware/cyberware_scan.dm | 2 + .../outpost_prison_boss_moves.dm | 3 + voidcrew/modules/unit_tests/_unit_tests.dm | 12 + .../unit_tests/voidcrew_bounty_admin.dm | 4 +- .../unit_tests/voidcrew_bounty_board.dm | 16 + .../unit_tests/voidcrew_bounty_boss_reach.dm | 561 +++++++ .../unit_tests/voidcrew_bounty_bosses.dm | 635 +++++++- .../unit_tests/voidcrew_bounty_chrome.dm | 687 ++++++++ .../voidcrew_bounty_chrome_cascade.dm | 289 ++++ .../voidcrew_bounty_chrome_deadeye.dm | 153 ++ .../voidcrew_bounty_chrome_gorilla.dm | 399 +++++ .../voidcrew_bounty_chrome_lazarus.dm | 103 ++ .../voidcrew_bounty_chrome_mantis.dm | 365 +++++ .../voidcrew_bounty_chrome_piledriver.dm | 344 ++++ .../voidcrew_bounty_chrome_redline.dm | 168 ++ .../voidcrew_bounty_companions_backup.dm | 372 +++++ .../unit_tests/voidcrew_bounty_cyberpsycho.dm | 423 +++++ .../unit_tests/voidcrew_bounty_identity.dm | 2 +- .../unit_tests/voidcrew_bounty_pace.dm | 183 +++ .../unit_tests/voidcrew_bounty_suits.dm | 143 +- .../voidcrew_human_npcs_combat_sense.dm | 5 +- wiki/content/bounty-hunting.md | 25 +- wiki/content/pirates-and-npc-ships.md | 1 + 58 files changed, 10679 insertions(+), 315 deletions(-) create mode 100644 voidcrew/_DEFINES/bounty_chrome.dm create mode 100644 voidcrew/modules/bounties/bounty_chrome.dm create mode 100644 voidcrew/modules/bounties/chrome/bounty_chrome_cascade.dm create mode 100644 voidcrew/modules/bounties/chrome/bounty_chrome_deadeye.dm create mode 100644 voidcrew/modules/bounties/chrome/bounty_chrome_gorilla.dm create mode 100644 voidcrew/modules/bounties/chrome/bounty_chrome_mantis.dm create mode 100644 voidcrew/modules/bounties/chrome/bounty_chrome_piledriver.dm create mode 100644 voidcrew/modules/bounties/chrome/bounty_chrome_redline.dm create mode 100644 voidcrew/modules/bounties/chrome/bounty_cyberpsycho.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_bounty_boss_reach.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_bounty_chrome.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_bounty_chrome_cascade.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_bounty_chrome_deadeye.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_bounty_chrome_gorilla.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_bounty_chrome_lazarus.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_bounty_chrome_mantis.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_bounty_chrome_piledriver.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_bounty_chrome_redline.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_bounty_companions_backup.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_bounty_cyberpsycho.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_bounty_pace.dm diff --git a/tgstation.dme b/tgstation.dme index 677d56edb48..6df51b361b5 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -6683,6 +6683,7 @@ #include "voidcrew\_DEFINES\bounty_ai.dm" #include "voidcrew\_DEFINES\bounty_board.dm" #include "voidcrew\_DEFINES\bounty_bosses.dm" +#include "voidcrew\_DEFINES\bounty_chrome.dm" #include "voidcrew\_DEFINES\bounty_criminals.dm" #include "voidcrew\_DEFINES\bounty_identity.dm" #include "voidcrew\_DEFINES\bounty_kingpin.dm" @@ -7109,6 +7110,7 @@ #include "voidcrew\modules\bounties\bounty_board.dm" #include "voidcrew\modules\bounties\bounty_boss.dm" #include "voidcrew\modules\bounties\bounty_boss_kits.dm" +#include "voidcrew\modules\bounties\bounty_chrome.dm" #include "voidcrew\modules\bounties\bounty_combat_sense.dm" #include "voidcrew\modules\bounties\bounty_companions.dm" #include "voidcrew\modules\bounties\bounty_criminal.dm" @@ -7129,6 +7131,13 @@ #include "voidcrew\modules\bounties\bounty_turn_in.dm" #include "voidcrew\modules\bounties\bounty_types.dm" #include "voidcrew\modules\bounties\bounty_weapons.dm" +#include "voidcrew\modules\bounties\chrome\bounty_chrome_cascade.dm" +#include "voidcrew\modules\bounties\chrome\bounty_chrome_deadeye.dm" +#include "voidcrew\modules\bounties\chrome\bounty_chrome_gorilla.dm" +#include "voidcrew\modules\bounties\chrome\bounty_chrome_mantis.dm" +#include "voidcrew\modules\bounties\chrome\bounty_chrome_piledriver.dm" +#include "voidcrew\modules\bounties\chrome\bounty_chrome_redline.dm" +#include "voidcrew\modules\bounties\chrome\bounty_cyberpsycho.dm" #include "voidcrew\modules\captain_management\captain_management.dm" #include "voidcrew\modules\captain_management\command_transfer.dm" #include "voidcrew\modules\captain_management\ship_applications.dm" diff --git a/tools/gear_catalog/ratings/explosives.json b/tools/gear_catalog/ratings/explosives.json index 719ee90c508..b0cefb79cfd 100644 --- a/tools/gear_catalog/ratings/explosives.json +++ b/tools/gear_catalog/ratings/explosives.json @@ -462,6 +462,7 @@ "/obj/item/grenade/hypnotic": "no route", "/obj/item/grenade/primer": "no route", "/obj/item/grenade/primer/stingbang": "no route", + "/obj/item/grenade/smokebomb/bounty_boss": "no route", "/obj/item/grenade/spawnergrenade": "no route", "/obj/item/grenade/spawnergrenade/buzzkill": "no route", "/obj/item/grenade/spawnergrenade/cat": "no route", diff --git a/tools/gear_catalog/ratings/guns.json b/tools/gear_catalog/ratings/guns.json index 93472b5b67c..30e11abdea1 100644 --- a/tools/gear_catalog/ratings/guns.json +++ b/tools/gear_catalog/ratings/guns.json @@ -2145,6 +2145,7 @@ }, "method": "Placed against the pilot's gun ratings with the same score: the formula where a gun has stats, and a judged score where its power is not in the stats. Bands: green under 40, yellow 40 to 109, red 110 and up.", "unrated": { + "/obj/item/flamethrower/full/tank/bounty_boss": "no route", "/obj/item/gun": "abstract", "/obj/item/gun/ballistic": "abstract", "/obj/item/gun/ballistic/automatic": "abstract", diff --git a/tools/gear_catalog/ratings/modsuits.json b/tools/gear_catalog/ratings/modsuits.json index c788db2588f..2a6731b4f8e 100644 --- a/tools/gear_catalog/ratings/modsuits.json +++ b/tools/gear_catalog/ratings/modsuits.json @@ -1428,6 +1428,12 @@ "/obj/item/mod/control/pre_equipped/administrative": "no route", "/obj/item/mod/control/pre_equipped/apocryphal": "no route", "/obj/item/mod/control/pre_equipped/apocryphal/officer": "no route", + "/obj/item/mod/control/pre_equipped/bounty_boss": "no route", + "/obj/item/mod/control/pre_equipped/bounty_boss/atmospheric": "no route", + "/obj/item/mod/control/pre_equipped/bounty_boss/civilian": "no route", + "/obj/item/mod/control/pre_equipped/bounty_boss/engineering": "no route", + "/obj/item/mod/control/pre_equipped/bounty_boss/magnate": "no route", + "/obj/item/mod/control/pre_equipped/bounty_boss/security": "no route", "/obj/item/mod/control/pre_equipped/chrono": "no route", "/obj/item/mod/control/pre_equipped/corporate": "no route", "/obj/item/mod/control/pre_equipped/cosmohonk": "leftover", diff --git a/voidcrew/_DEFINES/bounties.dm b/voidcrew/_DEFINES/bounties.dm index 7eb625ce9a0..ebb6fc1ec3b 100644 --- a/voidcrew/_DEFINES/bounties.dm +++ b/voidcrew/_DEFINES/bounties.dm @@ -48,6 +48,8 @@ #define BOUNTY_KIT_DEMOLITIONIST "demolitionist" #define BOUNTY_KIT_GHOST "ghost" #define BOUNTY_KIT_HEAVY "heavy" +/// Its kit is its chrome (chrome/bounty_cyberpsycho.dm): the rarest +#define BOUNTY_KIT_CYBERPSYCHO "cyberpsycho" // ===== PLACEMENT KINDS ===== diff --git a/voidcrew/_DEFINES/bounty_ai.dm b/voidcrew/_DEFINES/bounty_ai.dm index ed0c93adcae..258de038b5f 100644 --- a/voidcrew/_DEFINES/bounty_ai.dm +++ b/voidcrew/_DEFINES/bounty_ai.dm @@ -58,6 +58,8 @@ /// 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" +/// world.time the body may take its next step by hand (bounty_ai_step()): its last step, AI walk or by hand, plus its own move delay +#define BB_BOUNTY_NEXT_STEP_AT "bb_bounty_next_step_at" // ===== ACTIVITY STEPS ===== @@ -200,6 +202,16 @@ #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) +/// A companion joining a fight gets up first: no weapon out, no blow or shot, for this long, so their criminal draws first +#define BOUNTY_COMPANION_DRAW_DELAY (1 SECONDS) +/// A companion's gun is backup: pistol strings this long (a criminal's are BOUNTY_PISTOL_STRING_SHOTS)... +#define BOUNTY_COMPANION_PISTOL_STRING 3 +/// ...and SMG bursts this long (a criminal's are BOUNTY_SMG_BURST) +#define BOUNTY_COMPANION_SMG_BURST 2 +/// Company keys (bounty_roll_company()): one companion's fighting style (BOUNTY_STYLE_*)... +#define BOUNTY_COMPANY_STYLE "style" +/// ...and their chrome keys (BOUNTY_CHROME_*), or null for none +#define BOUNTY_COMPANY_CHROME "chrome" // ===== 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 @@ -220,7 +232,9 @@ #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 +/// A gun fires at anyone it can see this far off, while its holder still walks in to its style's own distance (BOUNTY_PISTOL_RANGE). The shotgun's spread and the bottle's throw keep them to their own. +#define BOUNTY_GUN_FIRE_RANGE 7 +/// Walks in to about this far away #define BOUNTY_PISTOL_RANGE 5 #define BOUNTY_PISTOL_MIN_RANGE 3 /// Raising the gun before the first shot of a string diff --git a/voidcrew/_DEFINES/bounty_bosses.dm b/voidcrew/_DEFINES/bounty_bosses.dm index b647004b3fd..8a720d57902 100644 --- a/voidcrew/_DEFINES/bounty_bosses.dm +++ b/voidcrew/_DEFINES/bounty_bosses.dm @@ -13,10 +13,14 @@ /// 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) +/// Its combat stimulant, used through combat sense's rule (human_npc_combat_sense.dm) when it tires in a fight, never while one is still in its blood (C8; it used to inject at the start of a fight, 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) +/// How many of BOUNTY_BOSS_STIMULANT it carries: one for when it first tires, one for a long fight (an ephedrine pen lasts about 100 s). (phase D) #define BOUNTY_BOSS_STIMULANTS 2 +/// Its combat stimpack, one per kit beside BOUNTY_BOSS_STIMULANTS: stimulants and omnizine, used through the same combat sense rule as the others, never while a stimulant is still in its blood +#define BOUNTY_BOSS_COMBAT_STIMULANT /obj/item/reagent_containers/hypospray/medipen/stimpack/traitor +/// The cell in the standard core of a mini-boss's MODsuit (bounty_suits.dm): about 2 hours of a suit running at tg's base drain. The suit doesn't run while its wearer is dormant. +#define BOUNTY_BOSS_MODSUIT_CELL /obj/item/stock_parts/power_store/cell/bluespace /// 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) @@ -60,6 +64,33 @@ /// A spot any player within this many tiles can see is in view. (phase D) #define BOUNTY_BOSS_REINFORCE_SIGHT 13 +// ===== HURT FROM WHERE IT CAN'T REACH (review r1 F4, r2) ===== + +/// Someone who hurt it from where it can't get at them (behind glass, a shut door or a gap, or off its site) is shunned this long: it doesn't go after them, and it keeps out of their sight +#define BOUNTY_BOSS_SHUN_TIME (60 SECONDS) +/// How far it walks for cover, in steps +#define BOUNTY_BOSS_COVER_RANGE 7 +/// How far a shooter is taken to see, for cover, at the least: one farther off sees as far as a clear line from them goes (a scope, or a shot from across the site) +#define BOUNTY_BOSS_COVER_SIGHT 9 +/// How far it works out its walk to someone behind something, in tiles, and how long that walk holds while it stands on the same tile. Someone farther off is in reach if the walk gets it at least half this much closer to them. +#define BOUNTY_BOSS_REACH_RANGE 10 +#define BOUNTY_BOSS_REACH_RETHINK (2 SECONDS) +/// It says a line as it breaks for cover at most this often +#define BOUNTY_BOSS_COVER_BARK_COOLDOWN (30 SECONDS) + +// ===== GORILLA ARMS THROUGH GLASS ===== + +/// The tell before its Gorilla Arms go at a window, grille, table or door: the fist drawn back, the pistons heard, the tile lit. At least 0.8 s (decision 5). +#define BOUNTY_BOSS_SMASH_WINDUP (0.9 SECONDS) +/// What one Gorilla Arms punch does to a structure, used only to count the punches something takes. The punch itself is the implant's (CYBERWARE_GORILLA_STRUCTURE_DAMAGE, which ware_military_arms.dm undefines); a test checks the two agree. +#define BOUNTY_BOSS_SMASH_BLOW 40 +/// It only goes at something it breaks in this many punches; anything tougher, it goes round or takes cover +#define BOUNTY_BOSS_SMASH_MOST_BLOWS 6 +/// The pause after the tell before its next ability may start +#define BOUNTY_BOSS_SMASH_RECOVER (1 SECONDS) +/// The tell's glow and floor mark: the piston punch's orange +#define BOUNTY_BOSS_SMASH_COLOR "#ff8a1f" + // ===== SUMMONED THINGS: CAPS AND LIFETIMES (P4) ===== /// Fire pools (flamer floors and molotovs) burning at once, server-wide @@ -75,6 +106,20 @@ /// 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 +// ===== EACH KIT'S ANSWER TO A DISABLER (C8) ===== +// Real gear a player can own too, worn and locked to the body like the rest of the kit (D3). Measured in +// the port's boss model: a solo hunter with a disabler stamcritted any of them in about two seconds before. + +/// The Juggernaut's tower shield, held from the start and raised as its fight starts: raised, it stops every shot from the half of the map the Juggernaut faces (the Phalanx buckler's own rule, loot/uniques/armory.dm). Flank it. +#define BOUNTY_JUGGERNAUT_SHIELD /obj/item/shield/riot/phalanx_buckler +/// The Heavy's coat: an ablative trenchcoat with its hood up, energy and laser armour 60 on every limb and its head, and half of all beams that hit it reflected (tg's own). Bullets go through it. Bring lethal, or a lot of shots. +#define BOUNTY_HEAVY_COAT /obj/item/clothing/suit/hooded/ablative +/// The Demolitionist's implant: tg's CNS rebooter, one neural load (cyberware_component.dm). Its first stamina crit of a minute lasts a second, then six seconds of stun immunity; cuff it on the second. +#define BOUNTY_DEMOLITIONIST_REBOOTER /obj/item/organ/cyberimp/brain/anti_stun +/// The Ghost's cover from stun fire (combat sense): how many steps it runs for cover, and how many runs it makes in one exchange of fire. Corner it. +#define BOUNTY_GHOST_COVER_STEPS 5 +#define BOUNTY_GHOST_COVER_MOVES 4 + // ===== JUGGERNAUT ===== /// Charge: a roar, a stamp and a cracked-floor line @@ -95,27 +140,37 @@ #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) +/// Slam: both fists up, a red ring. 0.7 -> 0.8 s after review r2, long enough to step out of on sight. +#define BOUNTY_JUGGERNAUT_SLAM_WINDUP (0.8 SECONDS) #define BOUNTY_JUGGERNAUT_SLAM_COOLDOWN (7 SECONDS) #define BOUNTY_JUGGERNAUT_SLAM_DAMAGE 20 #define BOUNTY_JUGGERNAUT_SLAM_KNOCKDOWN (1.5 SECONDS) // ===== PYROMANIAC ===== -/// 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) +/// Its flamethrower: tg's, igniter and full plasma tank fitted, held from the start (it doesn't holster) +#define BOUNTY_PYROMANIAC_FLAMETHROWER /obj/item/flamethrower/full/tank/bounty_boss +/// The bottle in its other hand: tg's molotov, filled with welding fuel +#define BOUNTY_PYROMANIAC_MOLOTOV_BOTTLE /obj/item/reagent_containers/cup/glass/bottle/molotov/bounty_boss +/// Flamer: the pilot light, an orange line on the floor. 0.5 -> 0.8 s after review r2, long enough to step out of on sight. +#define BOUNTY_PYROMANIAC_FLAMER_WINDUP (0.8 SECONDS) #define BOUNTY_PYROMANIAC_FLAMER_COOLDOWN (5 SECONDS) #define BOUNTY_PYROMANIAC_FLAMER_RANGE 3 -/// Full width of the cone, in degrees -#define BOUNTY_PYROMANIAC_FLAMER_ARC 90 +/// Tank pressure (kPa) under which its flamethrower is dry and it won't sweep +#define BOUNTY_PYROMANIAC_FLAMER_EMPTY ONE_ATMOSPHERE +/// The flamethrower stays lit this long after a sweep, then it shuts the valve +#define BOUNTY_PYROMANIAC_FLAMER_SHUTOFF (1 SECONDS) #define BOUNTY_PYROMANIAC_FLAMER_DAMAGE 18 -/// Fire stacks (tg's) the jet puts on anyone in the cone. (phase D, CB-8) +/// Fire stacks (tg's) the jet puts on anyone on its line. (phase D, CB-8) #define BOUNTY_PYROMANIAC_FLAMER_STACKS 4 -/// How long the floor the cone covered keeps burning +/// How long the floor the line covered keeps burning #define BOUNTY_PYROMANIAC_FLAMER_FLOOR (4 SECONDS) +/// Sweeps a plasma tank feeds before the flamethrower runs dry and it changes tanks +#define BOUNTY_PYROMANIAC_FLAMER_SWEEPS 4 +/// Full plasma tanks it carries in its bag for the change +#define BOUNTY_PYROMANIAC_SPARE_TANKS 2 +/// The tank change: it stops to wrench the empty off and fit a full one, at least this long, open the whole time +#define BOUNTY_PYROMANIAC_RELOAD_TIME (3 SECONDS) /// Molotov: a lit rag, the throw, a ring where it lands #define BOUNTY_PYROMANIAC_MOLOTOV_WINDUP (0.7 SECONDS) #define BOUNTY_PYROMANIAC_MOLOTOV_COOLDOWN (7 SECONDS) @@ -124,6 +179,17 @@ /// 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) +/// Smoke (C9): tg's smoke grenade, two in its pockets, on tg's shortest timed fuse (a screwdriver setting a player can pick too) +#define BOUNTY_PYROMANIAC_SMOKE /obj/item/grenade/smokebomb/bounty_boss +#define BOUNTY_PYROMANIAC_SMOKE_FUSE (3 SECONDS) +/// It takes a grenade out and stands this long, then pulls the pin and throws (the Heavy's barrier grenade wind-up) +#define BOUNTY_PYROMANIAC_SMOKE_WINDUP (0.6 SECONDS) +/// Longer than the cloud lasts (tg's 16 s), so it never stacks one on the last +#define BOUNTY_PYROMANIAC_SMOKE_COOLDOWN (20 SECONDS) +/// The furthest shooter it throws at; the nearest is anyone past its flamer's reach +#define BOUNTY_PYROMANIAC_SMOKE_RANGE 7 +/// How long after a hit from someone past its flamer's reach it still answers with smoke (stun fire counts while its combat sense says it is under fire) +#define BOUNTY_PYROMANIAC_SMOKE_HURT_WINDOW (3 SECONDS) // ===== DEMOLITIONIST ===== @@ -158,8 +224,8 @@ /// 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 -/// 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) +/// Dash: a blur line to the target, the Cascade lattice firing as it goes (OC-6 ruling). 0.3 -> 0.6 s after review r2: at 0.3 s only someone already moving could step off the line. +#define BOUNTY_GHOST_DASH_WINDUP (0.6 SECONDS) #define BOUNTY_GHOST_DASH_COOLDOWN (5 SECONDS) #define BOUNTY_GHOST_DASH_RANGE 5 /// Cloak: a shimmer, then a faint distortion. Only how it looks: nothing misses it for it (OC-6 ruling, CB-12) @@ -214,3 +280,7 @@ #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" +/// Where it is walking to, to go through the window, door or wall in its way +#define BB_BOUNTY_BOSS_SPOT "BB_bounty_boss_spot" +/// Where it is walking to, out of the sight of someone it can't get at +#define BB_BOUNTY_BOSS_COVER "BB_bounty_boss_cover" diff --git a/voidcrew/_DEFINES/bounty_chrome.dm b/voidcrew/_DEFINES/bounty_chrome.dm new file mode 100644 index 00000000000..8a9357d9daa --- /dev/null +++ b/voidcrew/_DEFINES/bounty_chrome.dm @@ -0,0 +1,56 @@ +// ===== BOUNTY CHROME (voidcrew/modules/bounties/bounty_chrome.dm) ===== + +/// Percent chance a criminal of each tier carries chrome at all +#define BOUNTY_CHROME_CHANCE_PETTY 10 +#define BOUNTY_CHROME_CHANCE_WANTED 35 +#define BOUNTY_CHROME_CHANCE_MOST_WANTED 60 +/// Percent chance a Wanted or Most Wanted carrier has a second piece, if one fits +#define BOUNTY_CHROME_SECOND_CHANCE 30 +/// A companion's chance is its criminal's tier chance divided by this, and it carries one piece at most +#define BOUNTY_CHROME_COMPANION_DIVISOR 3 +/// The archetype a companion rolls chrome as (the criminal archetypes are BOUNTY_ARCHETYPE_*) +#define BOUNTY_CHROME_COMPANION "companion" + +/// The chrome keys, one per /datum/bounty_chrome_piece subtype +#define BOUNTY_CHROME_CASCADE "cascade" +#define BOUNTY_CHROME_MANTIS "mantis" +#define BOUNTY_CHROME_GORILLA "gorilla" +#define BOUNTY_CHROME_REDLINE "redline" +#define BOUNTY_CHROME_PILEDRIVER "piledriver" +#define BOUNTY_CHROME_LAZARUS "lazarus" +#define BOUNTY_CHROME_DEADEYE "deadeye" + +/// The shortest tell a chrome move may have before it fires the implant (owner decision 5) +#define BOUNTY_CHROME_TELL_MIN (0.8 SECONDS) +/// After a fight starts, how long before the first chrome move may start +#define BOUNTY_CHROME_OPENING (1.5 SECONDS) +/// The shortest gap between two chrome moves of one NPC +#define BOUNTY_CHROME_MOVE_GAP (4 SECONDS) +/// The outline a tell shows, unless the move picks its own colour +#define BOUNTY_CHROME_TELL_COLOR "#ff2079" +/// Trait source for standing still through a tell +#define BOUNTY_CHROME_TRAIT "bounty_chrome" + +/// Why a tell was cut short (/datum/bounty_chrome_move/proc/cancel()) +#define BOUNTY_CHROME_CANCEL_DOWNED "downed" +#define BOUNTY_CHROME_CANCEL_STUNNED "stunned" +#define BOUNTY_CHROME_CANCEL_RESTRAINED "restrained" +#define BOUNTY_CHROME_CANCEL_EMP "emp" +#define BOUNTY_CHROME_CANCEL_DEATH "death" +#define BOUNTY_CHROME_CANCEL_GONE "gone" + +/// Sent on a carbon whose chrome a pair of cyber optics just read, if it felt the read (cyberware_scan.dm): (mob/living/carbon/reader) +#define COMSIG_CARBON_CHROME_READ "carbon_chrome_read" +/// How soon a bounty NPC answers another chrome read after answering one +#define BOUNTY_CHROME_READ_NOTICE_COOLDOWN (20 SECONDS) + +/// A malfunction (bounty_chrome_malfunction_fx()): how often it twitches and spits sparks, its outline's name, and its chrome blue +#define BOUNTY_CHROME_MALFUNCTION_PULSE (0.4 SECONDS) +#define BOUNTY_CHROME_MALFUNCTION_FILTER "bounty_chrome_malfunction" +#define BOUNTY_CHROME_MALFUNCTION_COLOR "#7fd4ff" +/// A colour matrix turning tg's yellow arcs a hot chrome blue, their brightest parts near white +#define BOUNTY_CHROME_MALFUNCTION_MATRIX list(0.25, 0.45, 0.55, 0.25, 0.45, 0.55, 0.25, 0.45, 0.55, 0, 0, 0) + +/// The Bounty Panel's chrome choices (bounty_admin.dm): roll it as usual, or every piece that fits +#define BOUNTY_ADMIN_CHROME_ROLL "roll" +#define BOUNTY_ADMIN_CHROME_ALL "all" diff --git a/voidcrew/modules/bounties/bounty_admin.dm b/voidcrew/modules/bounties/bounty_admin.dm index 28b4629f4db..d7285e7c793 100644 --- a/voidcrew/modules/bounties/bounty_admin.dm +++ b/voidcrew/modules/bounties/bounty_admin.dm @@ -57,6 +57,7 @@ // The main menu, in the order it shows #define BOUNTY_ADMIN_MENU_SPAWN "Spawn a criminal at my feet" +#define BOUNTY_ADMIN_MENU_SPAWN_CHROME "Spawn a criminal with chosen chrome" #define BOUNTY_ADMIN_MENU_DECOY "Spawn a decoy next to a criminal" #define BOUNTY_ADMIN_MENU_POST "Post a bounty now" #define BOUNTY_ADMIN_MENU_GIVE "Give a bounty to a player" @@ -132,6 +133,7 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a /datum/bounty_admin_panel/proc/run_menu(mob/user) var/static/list/menu = list( BOUNTY_ADMIN_MENU_SPAWN, + BOUNTY_ADMIN_MENU_SPAWN_CHROME, BOUNTY_ADMIN_MENU_DECOY, BOUNTY_ADMIN_MENU_POST, BOUNTY_ADMIN_MENU_GIVE, @@ -150,6 +152,8 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a switch(choice) if(BOUNTY_ADMIN_MENU_SPAWN) menu_spawn(user) + if(BOUNTY_ADMIN_MENU_SPAWN_CHROME) + menu_spawn(user, TRUE) if(BOUNTY_ADMIN_MENU_DECOY) menu_decoy(user) if(BOUNTY_ADMIN_MENU_POST) @@ -174,8 +178,12 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a var/about = length(live_criminals()) return "[open] open bount[open == 1 ? "y" : "ies"], [about] criminal\s about, [length(GLOB.bounty_prisoner_pool)] record\s in the prisoner pool." -/datum/bounty_admin_panel/proc/menu_spawn(mob/user) +/// The spawn menu. With `pick_chrome` it also asks which chrome they carry (C0); otherwise it is rolled as usual. +/datum/bounty_admin_panel/proc/menu_spawn(mob/user, pick_chrome = FALSE) var/list/archetypes = archetype_choices() + if(pick_chrome) + // The meek carry no chrome + archetypes -= "Meek" var/archetype_choice = ask_list(user, "Which archetype?", "Spawn a criminal", archetypes) if(!archetype_choice || !authorized(user)) return @@ -196,11 +204,18 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a if(!style_choice || !authorized(user)) return variant = styles[style_choice] + var/chrome = BOUNTY_ADMIN_CHROME_ROLL + if(pick_chrome) + var/list/chromes = chrome_choices() + var/chrome_choice = ask_list(user, "Which chrome?", "Spawn a criminal", chromes) + if(!chrome_choice || !authorized(user)) + return + chrome = chromes[chrome_choice] var/list/activities = list("None" = null) + activity_choices() var/activity_choice = ask_list(user, "Doing what?", "Spawn a criminal", activities) if(!activity_choice || !authorized(user)) return - admin_spawn_criminal(user, tier, archetype, variant, activities[activity_choice], get_turf(user)) + admin_spawn_criminal(user, tier, archetype, variant, activities[activity_choice], get_turf(user), chrome) /datum/bounty_admin_panel/proc/menu_decoy(mob/user) var/datum/weakref/wanted_ref = WEAKREF(pick_criminal(user, "Spawn a decoy next to whom?")) @@ -542,8 +557,47 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a "Demolitionist" = BOUNTY_KIT_DEMOLITIONIST, "Ghost" = BOUNTY_KIT_GHOST, "Heavy" = BOUNTY_KIT_HEAVY, + "Cyberpsycho" = BOUNTY_KIT_CYBERPSYCHO, ) +/** + * The chrome a spawned criminal can be given (C0): rolled as usual for the style or kit picked, none, + * any one piece whatever their style or kit, or every piece that fits in one body. Values are a list of + * BOUNTY_CHROME_* keys, BOUNTY_ADMIN_CHROME_ROLL or BOUNTY_ADMIN_CHROME_ALL. + */ +/datum/bounty_admin_panel/proc/chrome_choices() + var/list/choices = list("Roll as usual" = BOUNTY_ADMIN_CHROME_ROLL, "None" = list()) + for(var/key in GLOB.bounty_chrome_pieces) + var/datum/bounty_chrome_piece/piece = GLOB.bounty_chrome_pieces[key] + if(piece.weight > 0) + choices[piece.name] = list(key) + choices["All of it"] = BOUNTY_ADMIN_CHROME_ALL + return choices + +/** + * Gives `record` the chrome `chrome` asks for (a chrome_choices() value), for a criminal spawned by an + * admin: rolled as usual for the style or kit it ended up with (never the one P1 rolled first), every + * piece that fits, or exactly the pieces listed. What doesn't fit with its kit's own chrome is left + * off, and a style its chrome can't fight with is changed for one it can. + */ +/datum/bounty_admin_panel/proc/admin_set_chrome(datum/bounty_record/record, chrome) + var/list/kit_organs = record.archetype == BOUNTY_ARCHETYPE_BOSS ? bounty_chrome_kit_organs(record.kit) : list() + if(record.archetype != BOUNTY_ARCHETYPE_NORMAL && record.archetype != BOUNTY_ARCHETYPE_BOSS) + record.chrome = null + return + if(chrome == BOUNTY_ADMIN_CHROME_ALL) + chrome = admin_chrome_all(record, kit_organs) + if(!islist(chrome)) + record.chrome = bounty_chrome_roll(record.tier, record.archetype, record.style, record.kit, kit_organs) + return + var/list/fitted = bounty_chrome_fit_keys(chrome, kit_organs) + record.chrome = length(fitted) ? fitted : null + bounty_chrome_fit_style(record) + +/// "All of it": every piece that fits on top of its kit's chrome. The cyberpsycho kit (C6) takes this choice over. +/datum/bounty_admin_panel/proc/admin_chrome_all(datum/bounty_record/record, list/kit_organs) + return bounty_chrome_all_that_fits(kit_organs) + /// A normal criminal's styles; the meek always carry the holdout, so the menu doesn't offer it /datum/bounty_admin_panel/proc/style_choices() return list( @@ -699,7 +753,8 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a if(!record) return "no record" var/variant = record.kit || record.style - return "[bounty_tier_name(record.tier)] [record.archetype || "criminal"][variant ? " ([variant])" : ""]" + var/chrome = length(record.chrome) ? ", chrome: [jointext(record.chrome, ", ")]" : "" + return "[bounty_tier_name(record.tier)] [record.archetype || "criminal"][variant ? " ([variant])" : ""][chrome]" /datum/bounty_admin_panel/proc/criminal_label(mob/living/carbon/human/npc/bounty_criminal/criminal) var/area/place = get_area(criminal) @@ -801,10 +856,10 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a /** * Spawns a criminal of `tier` and `archetype` at `where`, with no posting: a new record from P1 with - * the kit (a boss) or style (anyone else) set to `variant` when given, then P2's spawn, then P3's - * `activity` when given. Returns the criminal, or null. + * the kit (a boss) or style (anyone else) set to `variant` when given, its chrome as `chrome` asks + * (admin_set_chrome(), C0), then P2's spawn, then P3's `activity` when given. Returns the criminal, or null. */ -/datum/bounty_admin_panel/proc/admin_spawn_criminal(mob/user, tier, archetype, variant, activity, turf/where) +/datum/bounty_admin_panel/proc/admin_spawn_criminal(mob/user, tier, archetype, variant, activity, turf/where, chrome = BOUNTY_ADMIN_CHROME_ROLL) error = null if(!authorized(user)) return null @@ -836,9 +891,17 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a record.kit = null if(variant) record.style = variant + var/list/asked_chrome + if(islist(chrome)) + var/list/chrome_keys = chrome + asked_chrome = chrome_keys.Copy() + admin_set_chrome(record, chrome) 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.") + var/list/left_off = asked_chrome ? asked_chrome - (record.chrome || list()) : null + if(length(left_off)) + tell(user, span_warning("[jointext(left_off, ", ")] didn't fit in them with the rest.")) if(activity) criminal.start_activity(activity, null) log_action(user, "spawn [criminal_name(criminal)], [record_kind(record)][activity ? ", [activity]" : ""], at [AREACOORD(where)]") @@ -1374,6 +1437,7 @@ ADMIN_VERB(bounty_panel, R_ADMIN, "Bounty Panel", "Spawn, post, give out, list a #undef BOUNTY_ADMIN_TEST_CAPTOR #undef BOUNTY_ADMIN_RELIST_REASON #undef BOUNTY_ADMIN_MENU_SPAWN +#undef BOUNTY_ADMIN_MENU_SPAWN_CHROME #undef BOUNTY_ADMIN_MENU_DECOY #undef BOUNTY_ADMIN_MENU_POST #undef BOUNTY_ADMIN_MENU_GIVE diff --git a/voidcrew/modules/bounties/bounty_ai.dm b/voidcrew/modules/bounties/bounty_ai.dm index 41ee248a3b8..a6f4a76f3b5 100644 --- a/voidcrew/modules/bounties/bounty_ai.dm +++ b/voidcrew/modules/bounties/bounty_ai.dm @@ -189,17 +189,53 @@ * 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. + * + * A `paced` step (a fighter's step aside or back) comes no sooner than a person could take it: the + * body's own move delay after its last step, by hand or on the AI's walk (bounty_ai_step_ready()). Any + * step taken here holds the AI's walk back by that delay too, so the two never add up to a double step. */ -/proc/bounty_ai_step(mob/living/mover, turf/destination) +/proc/bounty_ai_step(mob/living/mover, turf/destination, paced = FALSE) if(QDELETED(mover) || !isturf(mover.loc) || !isturf(destination) || get_dist(mover, destination) != 1) return FALSE + if(paced && !bounty_ai_step_ready(mover)) + 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 + var/direction = get_dir(mover, destination) + mover.Move(destination, direction) + if(mover.loc == was) + return FALSE + var/delay = bounty_ai_note_step(mover, direction) + mover.set_glide_size(DELAY_TO_GLIDE_SIZE(delay)) + // The AI's own walk waits as long before its next step + var/datum/move_loop/walk = GLOB.move_manager.processing_on(mover, SSai_movement) + if(walk && walk.timer < world.time + delay) + walk.pause_for(delay) + return TRUE + +/// Whether `mover` may take a step by hand now: its own move delay has passed since its last step (BB_BOUNTY_NEXT_STEP_AT) +/proc/bounty_ai_step_ready(mob/living/mover) + var/datum/ai_controller/controller = mover?.ai_controller + if(QDELETED(controller)) + return TRUE + return world.time >= controller.blackboard[BB_BOUNTY_NEXT_STEP_AT] + +/** + * `mover` just stepped in `direction`: its next step by hand waits out the body's own move delay + * (cached_multiplicative_slowdown, what a player's step costs them), longer after a diagonal one as a + * player's is. Returns that delay. + */ +/proc/bounty_ai_note_step(mob/living/mover, direction) + var/delay = max(mover.cached_multiplicative_slowdown, world.tick_lag) + if(ISDIAGONALDIR(direction)) + delay *= sqrt(2) + var/datum/ai_controller/controller = mover.ai_controller + if(!QDELETED(controller)) + controller.set_blackboard_key(BB_BOUNTY_NEXT_STEP_AT, world.time + delay) + return delay /// 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) @@ -624,6 +660,13 @@ if(isliving(mover) && !bounty_ai_step_allowed(mover, path[1])) return FALSE +// Each step of the walk counts as the body's last step, so a step by hand (bounty_ai_step()) waits a step's time after it +/datum/ai_movement/jps/bounty/post_move(datum/move_loop/source, succeeded) + . = ..() + var/mob/living/mover = source.moving + if(succeeded == MOVELOOP_SUCCESS && isliving(mover)) + bounty_ai_note_step(mover, mover.last_move) + /// Now and then a step in some direction, while nothing else is planned: never off the leash, never while hiding, cuffed or down /datum/idle_behavior/bounty_wander /// Chance a second of a step diff --git a/voidcrew/modules/bounties/bounty_ai_human.dm b/voidcrew/modules/bounties/bounty_ai_human.dm index ba71cdb90f2..753d930050c 100644 --- a/voidcrew/modules/bounties/bounty_ai_human.dm +++ b/voidcrew/modules/bounties/bounty_ai_human.dm @@ -12,7 +12,7 @@ * 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 + * - Injectors (bounty_ai_use_injector()): a meek criminal's * stimpack as it bolts: a real pen, used on itself. */ diff --git a/voidcrew/modules/bounties/bounty_ai_normal.dm b/voidcrew/modules/bounties/bounty_ai_normal.dm index f8131b6a2bc..5f8822c3ca5 100644 --- a/voidcrew/modules/bounties/bounty_ai_normal.dm +++ b/voidcrew/modules/bounties/bounty_ai_normal.dm @@ -15,7 +15,7 @@ * - 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; a stimpack when Wanted, a combat stimpack when Most Wanted, if a pocket is free; + * and a bruise pack; a stimpack when Wanted, if a pocket is free (a mini-boss carries the combat stimpack); * - combat sense (bounty_combat_sense.dm): the stimpack when they tire, cover or a charge under stun fire. * * The shared vars are declared in bounty_types.dm and nowhere else; a var only P3 uses has an @@ -35,6 +35,8 @@ /datum/ai_planning_subtree/bounty_gate, /datum/ai_planning_subtree/bounty_notice, /datum/ai_planning_subtree/bounty_fight_target, + // Its chrome: a tell, then the implant's own action (C0, bounty_chrome.dm) + /datum/ai_planning_subtree/bounty_chrome, /datum/ai_planning_subtree/npc_combat_sense, /datum/ai_planning_subtree/bounty_arm, /datum/ai_planning_subtree/bounty_ranged, @@ -54,21 +56,16 @@ return BOUNTY_STYLE_BRAWLER /** - * Plain clothes for their zone, their tier's armour, their style's weapon and spares, a bruise pack, and a - * stimulant for when they tire in a fight (combat sense, bounty_combat_sense.dm): a stimpack when Wanted, - * a combat stimpack when Most Wanted. The stimulant goes in a pocket, if the style left one free: a pistol's - * spare magazine or a knife fills the second pocket, and a holster or bandolier takes nothing else. + * Plain clothes for their zone, their tier's armour, their style's weapon and spares, a bruise pack, and + * when Wanted a stimpack for when they tire in a fight (combat sense, bounty_combat_sense.dm). Every Most + * Wanted is a mini-boss, which carries its own pens, combat stimpack included (boss_supplies()). The + * stimpack goes in a pocket, if the style left one free: a pistol's spare magazine or a knife fills the + * second pocket, and a holster or bandolier takes nothing else. */ /mob/living/carbon/human/npc/bounty_criminal/normal/bounty_build_outfit(zone) var/datum/outfit/outfit = bounty_fighter_outfit(BOUNTY_ARCHETYPE_NORMAL, zone, record?.tier, ai_wanted_style(), ai_heavy_weapon(), /obj/item/stack/medical/bruise_pack) - var/stimulant - switch(record?.tier) - if(BOUNTY_TIER_WANTED) - stimulant = /obj/item/reagent_containers/hypospray/medipen/stimpack - if(BOUNTY_TIER_MOST_WANTED) - stimulant = /obj/item/reagent_containers/hypospray/medipen/stimpack/traitor - if(stimulant && outfit && (!outfit.r_pocket || !outfit.l_pocket)) - bounty_outfit_carry(outfit, stimulant) + if(record?.tier == BOUNTY_TIER_WANTED && outfit && (!outfit.r_pocket || !outfit.l_pocket)) + bounty_outfit_carry(outfit, /obj/item/reagent_containers/hypospray/medipen/stimpack) return outfit /mob/living/carbon/human/npc/bounty_criminal/normal/ai_notice(mob/living/hunter) diff --git a/voidcrew/modules/bounties/bounty_boss.dm b/voidcrew/modules/bounties/bounty_boss.dm index 8c4b1680f80..5ada259688a 100644 --- a/voidcrew/modules/bounties/bounty_boss.dm +++ b/voidcrew/modules/bounties/bounty_boss.dm @@ -14,10 +14,11 @@ * 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. + * - Resistance to stuns is its armour, its kit's own answer to a disabler (bounty_boss_kits.dm, C8) and + * the real stimulant pens it carries, used the way combat sense uses them (human_npc_combat_sense.dm): + * when it tires in a fight, never while one is still in its blood (/datum/npc_combat_sense/bounty/boss). * - "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). + * says so, takes a pen if it wants one, and falls back (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). @@ -25,13 +26,24 @@ * 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. 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. + * joins its posse, and so does every crew member of a ship hunting it who is playing and at its site + * (on it, on its dock strip or aboard a ship landed there), seen or not. 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. Never health. * - 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. + * busy or disabled; worn out, it falls back; a target; its combat sense (its stimulant, and the kit's + * reaction to stun fire, if it has one); its kit's gear; an ability, + * never the same one twice in a row; the kit's way of closing in or keeping away; up to and through + * whatever is in its way, if its kit can go through it; its melee; patching itself up with nobody + * about; with nobody in sight, the hunt for the nearest hunter still on its site that it can get at; + * and with nobody it can get at, out of the sight of those shooting at it from where it can't. It + * calms down after BOUNTY_BOSS_CALM_TIME with nobody around. + * - Hurt by someone it can't get at (behind glass it can't break, a shut door, a gap, or off its site), + * it doesn't stand there: it stops going after them for BOUNTY_BOSS_SHUN_TIME and gets out of their + * sight (boss_find_cover()), however far off they are, with a line as it goes. Someone far off with a + * way to them on foot is in reach, and it goes after them. With real Gorilla Arms and an empty hand it + * punches through a window, grille, table or door it can break, after a tell (boss_start_smash()); the + * punches are the implant's own, and it only starts if it can break everything on the way. * - 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, knocked down or dead * in between (tg's states, CB-24), and nothing happens. @@ -45,6 +57,10 @@ /// Trait source for standing still while busy with an ability #define BOUNTY_BOSS_BUSY_TRAIT "bounty_boss_busy" +/// What boss_busy says while its Gorilla Arms go at a window, grille, table or door +#define BOUNTY_BOSS_BUSY_SMASH "smash" +/// The glow on it while they do +#define BOUNTY_BOSS_SMASH_FILTER "bounty_boss_smash" /// Fire pools the bosses have burning (/obj/effect/bounty_boss_fire_pool), for the cap GLOBAL_LIST_EMPTY(bounty_boss_fire_pools) @@ -96,6 +112,8 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades) // 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 + // Its stimulant pens, and a kit's answer to stun fire (C8). A kit with its own reaction uses a subtype. + npc_combat_sense = /datum/npc_combat_sense/bounty/boss /// BOUNTY_KIT_*: which kit it is, and the prefix of its dialogue contexts var/boss_kit /// The ability types it is given @@ -135,10 +153,22 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades) /// 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 + /// Hunters who hurt it from where it couldn't get at them: weakref -> world.time of the last such hit (boss_note_reach()) + var/list/boss_shunned = list() + /// The tiles it can walk to (boss_walkable()): turf -> steps, the tile it stood on then, and when that was worked out + var/list/boss_walk_cache + var/turf/boss_walk_origin + var/boss_walk_at = 0 + /// world.time it may look for new cover + var/boss_cover_rethink_at = 0 + /// world.time it may say a line again as it breaks for cover + var/boss_cover_bark_at = 0 + /// What its Gorilla Arms are going at (boss_start_smash()), the floor mark on it, and the punches thrown so far + var/datum/weakref/boss_smash_target + var/datum/weakref/boss_smash_mark + var/boss_smash_blows = 0 + /// A thrown item of its own, kept out of the world, that its throws are checked with (boss_throw_reaches()) + var/obj/item/bounty_boss_throw_probe/boss_throw_probe /mob/living/carbon/human/npc/bounty_criminal/boss/Initialize(mapload, datum/human_npc_order/order) . = ..() @@ -158,6 +188,10 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades) boss_reinforcement_refs = null boss_winding_ref = null boss_last_attacker = null + boss_shunned = null + boss_walk_cache = null + boss_walk_origin = null + QDEL_NULL(boss_throw_probe) return ..() /mob/living/carbon/human/npc/bounty_criminal/boss/death(gibbed) @@ -198,8 +232,11 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades) return boss_supplies(bounty_outfit_instance(/datum/outfit/bounty_boss)) /** - * 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. + * Packs what every boss carries into `outfit`, an instance: BOUNTY_BOSS_STIMULANTS stimulant pens and one + * combat stimpack (BOUNTY_BOSS_COMBAT_STIMULANT; its combat sense uses them when it tires, one at a time) + * and a bruise pack, in a bag on its back (one is added if it wears none; in vacuum its MODsuit's storage + * takes them, bounty_suits.dm). They are consumables: used up, never loot (human_npc_gear.dm). Returns + * the outfit. */ /mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_supplies(datum/outfit/outfit) if(!istype(outfit)) @@ -207,6 +244,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades) 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[BOUNTY_BOSS_COMBAT_STIMULANT] = (outfit.backpack_contents[BOUNTY_BOSS_COMBAT_STIMULANT] || 0) + 1 outfit.backpack_contents[/obj/item/stack/medical/bruise_pack] = (outfit.backpack_contents[/obj/item/stack/medical/bruise_pack] || 0) + 1 return outfit @@ -256,19 +294,12 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades) /// 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 ----- /** @@ -310,6 +341,7 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades) var/datum/action/cooldown/mob_cooldown/bounty_boss/winding = boss_winding_ref?.resolve() boss_winding_ref = null winding?.cancel_windup() + boss_end_smash() if(boss_busy) boss_clear_busy() boss_on_interrupted() @@ -369,7 +401,8 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades) /** * Turns hostile, with `instigator` (who attacked, confronted or was spotted) in its posse if they * 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. + * BOUNTY_BOSS_POSSE_RANGE and can see it joins too, mech pilots included, then the rest of every + * hunting crew at its site (boss_engage_hunting_crews()), and it says its intro line. */ /mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_turn_hostile(mob/living/instigator) if(stat == DEAD) @@ -387,9 +420,43 @@ 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_engage_hunting_crews() boss_bark("intro") return TRUE +/** + * Every crew member of a ship hunting its bounty who is playing (not SSD) and at its site joins its + * posse, seen or not (boss_crew_at_site()), so each owes a companion like anyone in sight: one hunter + * can't wake it alone while the rest of the crew wait on the dock strip or aboard their landed ship + * (review r1). Crew on another site sharing its level, or aboard a ship anywhere else, don't count + * (review r2). + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_engage_hunting_crews() + var/datum/criminal_bounty/posting = posting() + if(!posting || !get_turf(src)) + return + for(var/obj/structure/overmap/ship/ship as anything in posting.hunter_ships()) + for(var/datum/mind/member as anything in ship.ship_team?.members) + var/mob/living/body = member?.current + if(isliving(body) && GET_CLIENT(body) && boss_crew_at_site(body, ship)) + boss_engage(body, announce = FALSE) + +/** + * Whether `body`, of the crew of `ship`, is at its site for its posse: on its level, and on the site + * itself, or anywhere in the site's rectangle, which holds its dock strip and the ships landed on it. + * For a site with no rectangle (a pirate ship), aboard `ship` close alongside it. + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_crew_at_site(mob/living/body, obj/structure/overmap/ship/ship) + var/turf/here = get_turf(src) + var/turf/where = get_turf(body) + if(!here || !where || where.z != here.z) + return FALSE + if(body_on_site(where)) + return TRUE + if(site_bounds) + return where.z == site_bounds[5] && where.x >= site_bounds[1] && where.x <= site_bounds[3] && where.y >= site_bounds[2] && where.y <= site_bounds[4] + return ship?.is_aboard(where) && get_dist(here, where) <= BOUNTY_BOSS_HUNT_RANGE + /// 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 @@ -532,12 +599,19 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades) return who /** - * 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). + * Whether it chooses to go after `target`: one it may go after (boss_can_go_after()), and not one it + * keeps away from (boss_shuns()). */ /mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_valid_target(atom/target) + return boss_can_go_after(target) && !boss_shuns(target) + +/** + * Whether it may 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/carbon/human/npc/bounty_criminal/boss/proc/boss_can_go_after(atom/target) if(QDELETED(target) || target == src) return FALSE if(!boss_reach_ok(get_turf(target))) @@ -623,26 +697,36 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades) for(var/mob/living/hunter as anything in hunters) body_add_grudge(hunter) boss_turn_hostile(hunter) + boss_note_reach(hunter) 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/carbon/human/npc/bounty_criminal/boss/proc/boss_nearest_hunter() +/** + * The nearest hunter (or their mech) still on its site within BOUNTY_BOSS_HUNT_RANGE that it can get + * at (boss_can_reach()), for the hunt: it never walks back out to stand in front of someone behind + * glass. Only players with a client count, from SSmobs' list for its level; a test passes its own + * `candidates`. + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_nearest_hunter(list/candidates) var/turf/here = get_turf(src) - if(!here || here.z > length(SSmobs.clients_by_zlevel)) + if(!here) return null + if(isnull(candidates)) + if(here.z > length(SSmobs.clients_by_zlevel)) + return null + candidates = SSmobs.clients_by_zlevel[here.z] var/atom/best var/best_distance = BOUNTY_BOSS_HUNT_RANGE + 1 - for(var/mob/living/person as anything in SSmobs.clients_by_zlevel[here.z]) + for(var/mob/living/person in candidates) var/atom/target = boss_target_for(person) - if(!boss_valid_target(target)) - continue var/turf/spot = get_turf(target) - if(!spot || !leash_ok(spot)) + if(!spot || spot.z != here.z) continue var/distance = get_dist(here, spot) - if(distance < best_distance) - best = target - best_distance = distance + // Nearest first: the costly checks only for someone nearer than the best so far + if(distance >= best_distance || !leash_ok(spot) || !boss_valid_target(target) || !boss_can_reach(target)) + continue + best = target + best_distance = distance return best // ----- where it may reach, and what it may break ----- @@ -800,6 +884,538 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades) boss_walls_left-- return TRUE +// ===== HURT FROM WHERE IT CAN'T REACH (review r1 F4, r2) ===== + +/** + * Whether it can get at `target` (a person, or a mech) from where it stands: it may go after them + * there, and it is beside them, or nothing on the straight way stops it, or its kit goes through + * everything that does (boss_gets_through()), or it can walk round to them (boss_walks_to()). + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_can_reach(atom/target) + if(!boss_can_go_after(target)) + return FALSE + var/turf/here = get_turf(src) + var/turf/there = get_turf(target) + if(!here || !there || here.z != there.z) + return FALSE + if(Adjacent(target)) + return TRUE + var/list/blockers = boss_line_blockers(here, there) + if(!length(blockers) || boss_gets_through(blockers)) + return TRUE + return boss_walks_to(there) + +/** + * Whether it can walk to `there`, or beside it (someone up on a table or a crate), through nothing it + * can't open (boss_walkable()). Someone beyond BOUNTY_BOSS_REACH_RANGE is past the walk it works out: + * they count as reachable if that walk reaches its edge at least half its range closer to them, so a + * far shooter with open ground between is chased, and one across a gap or behind a wall near it is + * not (review r2). + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_walks_to(turf/there) + var/turf/here = get_turf(src) + if(!here || !there || here.z != there.z) + return FALSE + var/list/steps = boss_walkable() + if(!isnull(steps[there])) + return TRUE + for(var/direction in GLOB.cardinals) + var/turf/beside = get_step(there, direction) + if(beside && !isnull(steps[beside]) && !boss_border_between(beside, there)) + return TRUE + var/distance = get_dist(here, there) + if(distance <= BOUNTY_BOSS_REACH_RANGE) + return FALSE + var/closer_than = distance - BOUNTY_BOSS_REACH_RANGE / 2 + for(var/turf/spot as anything in steps) + if(get_dist(here, spot) >= BOUNTY_BOSS_REACH_RANGE && get_dist(spot, there) <= closer_than) + return TRUE + return FALSE + +/** + * Whether its kit gets through `barrier` (from boss_line_blockers()) to someone behind it: with real + * Gorilla Arms and an empty hand to punch with (boss_gorilla_goes_through()). Each kit adds its own + * (bounty_boss_kits.dm): a charge, a grenade or a molotov thrown over, a breaching charge, rounds that + * chip through. + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_goes_through(atom/barrier) + return boss_gorilla_goes_through(barrier) + +/// All or nothing: whether its kit goes through every one of `blockers` (boss_line_blockers()), so it never breaks a grille only to meet glass it can't +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_gets_through(list/blockers) + if(!length(blockers)) + return TRUE + for(var/atom/blocker as anything in blockers) + if(!boss_goes_through(blocker)) + return FALSE + return TRUE + +/** + * Whether what gets it through `barrier` is ready now, so walking up to it is worth more than going + * round: Gorilla Arms that aren't already at something. Each kit adds its own ability that breaks or + * crosses it, off cooldown. With it on cooldown, the boss goes round on foot if it can (the breach + * planner). + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_breaks_through_now(atom/barrier) + return boss_busy != BOUNTY_BOSS_BUSY_SMASH && boss_gorilla_goes_through(barrier) + +/// Its ability of `ability_type`, if it has one off cooldown +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_ability_off_cooldown(ability_type) + for(var/datum/action/cooldown/mob_cooldown/bounty_boss/ability as anything in boss_abilities) + if(!QDELETED(ability) && istype(ability, ability_type)) + return ability.next_use_time <= world.time ? ability : null + return null + +/// What it can open on its own feet, for working out a walk: the access its AI's pathing uses +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_pass_info() + return new /datum/can_pass_info(src, ai_controller ? ai_controller.get_access() : get_access()) + +/** + * The first thing on the straight way from `start` to `finish` that stops it walking: a wall, a gap + * (space, a drop, lava, a chasm), or something solid it can't open or climb (a window, a grille, a + * shut door, a table). Null if the way is clear. People never count. + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_barrier_between(turf/start, turf/finish) + var/list/blockers = boss_line_blockers(start, finish, TRUE) + return length(blockers) ? blockers[1] : null + +/** + * Everything on the straight way from `start` to `finish` that stops it walking, in order: walls, + * gaps, and every solid thing it can't open or climb on each step (a grille and the window on the + * same tile are both there). With `first_only`, only the first step that is blocked. + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_line_blockers(turf/start, turf/finish, first_only = FALSE) + . = list() + if(!start || !finish || start.z != finish.z) + return + var/datum/can_pass_info/pass_info = boss_pass_info() + var/turf/previous = start + for(var/turf/spot as anything in get_line(start, finish)) + if(spot == start) + continue + if(spot.density) + . += spot + else if(spot != finish && (isspaceturf(spot) || isopenspaceturf(spot) || isgroundlessturf(spot) || islava(spot) || ischasm(spot))) + . += spot + else if(previous.LinkBlockedWithAccess(spot, pass_info)) + var/list/on_step = boss_blockers_on_step(previous, spot, pass_info) + if(length(on_step)) + // A full-tile window blocks the step off its tile as well as the step onto it: once is enough + . |= on_step + else + . += spot + if(first_only && length(.)) + return + previous = spot + +/** + * What stops a step from `origin` onto `destination`: windows or doors on the edge between them, a + * window filling `origin` (tg's pathing counts one as blocking the step off its tile too), and + * everything solid on `destination`. A diagonal step is checked both ways round, giving what stops the + * first way. + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_blockers_on_step(turf/origin, turf/destination, datum/can_pass_info/pass_info) + . = list() + var/direction = get_dir(origin, destination) + if(origin.x != destination.x && origin.y != destination.y) + for(var/half in list(direction & (NORTH|SOUTH), direction & (EAST|WEST))) + var/turf/middle = get_step(origin, half) + if(!middle) + continue + if(middle.density) + return list(middle) + var/list/found = boss_blockers_on_step(origin, middle, pass_info) + boss_blockers_on_step(middle, destination, pass_info) + if(length(found)) + return found + return + for(var/obj/border in origin) + if(border.density && ((border.flags_1 & ON_BORDER_1) || istype(border, /obj/structure/window)) && !border.CanAStarPass(direction, pass_info)) + . += border + var/reverse = get_dir(destination, origin) + for(var/obj/thing in destination) + if(thing.density && !thing.CanAStarPass(reverse, pass_info)) + . += thing + +/// Whether a window or door stands on the edge between two tiles side by side +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_border_between(turf/origin, turf/destination) + var/direction = get_dir(origin, destination) + for(var/obj/border in origin) + if(border.density && (border.flags_1 & ON_BORDER_1) && (border.dir & direction)) + return TRUE + var/reverse = get_dir(destination, origin) + for(var/obj/border in destination) + if(border.density && (border.flags_1 & ON_BORDER_1) && (border.dir & reverse)) + return TRUE + return FALSE + +// ----- what a throw gets past ----- + +/** + * Something it throws, never in the world: an item with a throw of its own and the boss as its thrower, + * so tg's own CanPass() rules for a thrown item decide what stops it (windows, windoors, shut doors and + * grilles do; tables, railings and gaps don't). + */ +/obj/item/bounty_boss_throw_probe + name = "thrown thing" + item_flags = ABSTRACT + +/obj/item/bounty_boss_throw_probe/Destroy() + QDEL_NULL(throwing) + return ..() + +/// Its throw probe, made the first time it is needed +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_get_throw_probe() + if(QDELETED(boss_throw_probe)) + boss_throw_probe = new + if(QDELETED(boss_throw_probe.throwing)) + boss_throw_probe.throwing = new /datum/thrownthing(boss_throw_probe, src, SOUTH, world.maxx, 1, src) + return boss_throw_probe + +/** + * Whether something it throws from `start` lands on `finish`: it takes the steps tg's throw takes + * (throw_at() and /datum/thrownthing/tick()), and each one must be a move tg would let a thrown item + * make. People and mechs on the way never count. + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_throw_reaches(turf/start, turf/finish) + start = get_turf(start) + finish = get_turf(finish) + if(!start || !finish || start.z != finish.z) + return FALSE + if(start == finish) + return TRUE + var/obj/item/probe = boss_get_throw_probe() + var/dist_x = abs(finish.x - start.x) + var/dist_y = abs(finish.y - start.y) + var/dx = (finish.x > start.x) ? EAST : WEST + var/dy = (finish.y > start.y) ? NORTH : SOUTH + var/pure_diagonal = dist_x == dist_y + if(!pure_diagonal && dist_x <= dist_y) + var/old_dist = dist_x + dist_x = dist_y + dist_y = old_dist + var/old_dir = dx + dx = dy + dy = old_dir + var/longest = max(dist_x, dist_y) + var/diagonal_error = dist_x / 2 - dist_y + var/turf/at = start + for(var/travelled in 0 to longest) + if(at == finish) + return TRUE + var/turf/step = get_step(at, get_dir(at, finish)) + if(!pure_diagonal) + if(diagonal_error >= 0 && longest - travelled != 1) + step = get_step(at, dx) + diagonal_error += (diagonal_error < 0) ? dist_x / 2 : -dist_y + if(!step || !bounty_boss_throw_move(at, step, probe)) + return FALSE + at = step + return at == finish + +/// Whether a thrown thing gets past `barrier` (from boss_line_blockers()), by tg's rules for a thrown item: a gap yes, a wall no +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_throw_passes(atom/barrier) + if(isturf(barrier)) + return !barrier.density + var/border_dir = (barrier.flags_1 & ON_BORDER_1) ? barrier.dir : get_dir(barrier, src) + return barrier.CanPass(boss_get_throw_probe(), border_dir) + +/** + * Whether `probe`, thrown, moves from `origin` onto `destination` beside it. A diagonal goes the way + * tg's Move() takes one, north or south first; whatever stops that half is bumped, and a bump ends a + * throw (/atom/movable/Bump()), so it never gets to try east or west first. + */ +/proc/bounty_boss_throw_move(turf/origin, turf/destination, obj/item/probe) + var/direction = get_dir(origin, destination) + if(!(direction & (direction - 1))) + return bounty_boss_throw_step(origin, destination, probe) + var/turf/first = get_step(origin, direction & (NORTH|SOUTH)) + return first && bounty_boss_throw_step(origin, first, probe) && bounty_boss_throw_step(first, destination, probe) + +/// One straight step of a thrown `probe`: nothing on the edge of `origin` it leaves by, and tg's CanPass() of `destination` and all on it but people and mechs +/proc/bounty_boss_throw_step(turf/origin, turf/destination, obj/item/probe) + var/direction = get_dir(origin, destination) + for(var/atom/movable/border as anything in origin) + if(border != probe && (border.flags_1 & ON_BORDER_1) && border.density && (border.dir & direction) && !border.CanPass(probe, direction)) + return FALSE + var/from_dir = get_dir(destination, origin) + if(!destination.CanPass(probe, from_dir)) + return FALSE + for(var/atom/movable/thing as anything in destination) + if(thing == probe || isliving(thing) || ismecha(thing)) + continue + if(!thing.CanPass(probe, from_dir)) + return FALSE + return TRUE + +/** + * Every tile it could walk to from where it stands, within BOUNTY_BOSS_REACH_RANGE and on its leash, + * through nothing it can't open: turf -> steps, nearest first. Worked out again once it stands on + * another tile, or after BOUNTY_BOSS_REACH_RETHINK on the same one, so the steps and the range are + * always counted from where it is (review r2). + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_walkable() + var/turf/here = get_turf(src) + if(!here) + return list() + if(boss_walk_cache && boss_walk_origin == here && world.time < boss_walk_at + BOUNTY_BOSS_REACH_RETHINK) + return boss_walk_cache + var/datum/can_pass_info/pass_info = boss_pass_info() + var/list/steps = list() + steps[here] = 0 + var/list/queue = list(here) + var/index = 0 + while(index < length(queue)) + index++ + var/turf/spot = queue[index] + var/next_steps = steps[spot] + 1 + for(var/direction in GLOB.cardinals) + var/turf/next = get_step(spot, direction) + if(!next || next.density || !isnull(steps[next]) || get_dist(here, next) > BOUNTY_BOSS_REACH_RANGE) + continue + if(spot.LinkBlockedWithAccess(next, pass_info) || !leash_ok(next)) + continue + steps[next] = next_steps + queue += next + boss_walk_cache = steps + boss_walk_origin = here + boss_walk_at = world.time + return steps + +/// `hunter` just hurt it: if it can't get at them where they are, it keeps away from them for BOUNTY_BOSS_SHUN_TIME +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_note_reach(mob/living/hunter) + if(!boss_can_act() || boss_can_reach(boss_target_for(hunter))) + return FALSE + boss_shunned[WEAKREF(hunter)] = world.time + return TRUE + +/// Whether it keeps away from `target` (a person, or a mech): one of them hurt it lately from where it couldn't get at them, and it still can't +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_shuns(atom/target) + if(!length(boss_shunned)) + return FALSE + for(var/mob/living/person as anything in boss_people_in(target)) + var/last = person.weak_reference ? boss_shunned[person.weak_reference] : null + if(last && world.time < last + BOUNTY_BOSS_SHUN_TIME) + return !boss_can_reach(target) + return FALSE + +/// The hunters it shuns who are still up and still out of its reach (their mechs, for those in one): whose sight it keeps out of. Forgets those it has shunned long enough. +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_watchers() + . = list() + for(var/datum/weakref/ref as anything in boss_shunned.Copy()) + var/mob/living/person = ref.resolve() + if(QDELETED(person) || world.time >= boss_shunned[ref] + BOUNTY_BOSS_SHUN_TIME) + boss_shunned -= ref + continue + if(person.stat != CONSCIOUS) + continue + var/atom/watcher = boss_target_for(person) + if(!boss_can_reach(watcher)) + . |= watcher + +/** + * Whether any of `watchers` can see `spot`: a clear line from them on its level. Within + * BOUNTY_BOSS_COVER_SIGHT, and as far as the line goes past that, so a shooter further off (a scope, + * the dock strip) never leaves it standing in the open thinking it is hidden (review r2). + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_seen_from(turf/spot, list/watchers) + spot = get_turf(spot) + if(!spot) + return FALSE + for(var/atom/watcher as anything in watchers) + var/turf/from = get_turf(watcher) + if(!from || from.z != spot.z) + continue + if(can_see(from, spot, max(BOUNTY_BOSS_COVER_SIGHT, get_dist(from, spot)))) + return TRUE + return FALSE + +/// It breaks for cover from someone it can't get at: a line for it, at most every BOUNTY_BOSS_COVER_BARK_COOLDOWN, so it reads as biding its time, not running +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_cover_bark() + if(world.time < boss_cover_bark_at) + return FALSE + boss_cover_bark_at = world.time + BOUNTY_BOSS_COVER_BARK_COOLDOWN + boss_bark("cover") + return TRUE + +/// How far `spot` is from the nearest of `watchers` +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_distance_from(turf/spot, list/watchers) + . = INFINITY + for(var/atom/watcher as anything in watchers) + . = min(., get_dist(spot, watcher)) + +/** + * Cover from `watchers`: the nearest tile it can walk to within BOUNTY_BOSS_COVER_RANGE steps that + * none of them can see. With nowhere hidden, the one farthest from the nearest of them. Null if + * where it stands is as good as any. + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_find_cover(list/watchers) + var/list/steps = boss_walkable() + var/turf/here = get_turf(src) + var/turf/far = here + var/far_distance = boss_distance_from(here, watchers) + // In order of steps, nearest first + for(var/turf/spot as anything in steps) + if(steps[spot] > BOUNTY_BOSS_COVER_RANGE || (spot != here && boss_someone_on(spot))) + continue + if(!boss_seen_from(spot, watchers)) + return spot + var/distance = boss_distance_from(spot, watchers) + if(distance > far_distance) + far = spot + far_distance = distance + return far == here ? null : far + +/// Whether someone else stands on `spot`, so it can't +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_someone_on(turf/spot) + for(var/mob/living/other in spot) + if(other != src && other.density) + return TRUE + return FALSE + +/// The tile it walks to, to go through `barrier` at `target`: the last one before it on the straight way, if it can walk there +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_spot_before(atom/barrier, atom/target) + var/turf/here = get_turf(src) + var/turf/barrier_turf = get_turf(barrier) + if(!here || !barrier_turf) + return null + var/turf/before + for(var/turf/spot as anything in get_line(here, barrier_turf)) + if(spot == barrier_turf) + break + before = spot + if(!before || before == here) + return null + var/list/steps = boss_walkable() + return isnull(steps[before]) ? null : before + +// ===== GORILLA ARMS THROUGH GLASS ===== + +/// Its working Gorilla Arms: the real implant, not EMP'd, browned out or failing +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_gorilla_arms() + . = list() + for(var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm in organs) + var/datum/component/cyberware/ware = arm.GetComponent(/datum/component/cyberware) + if(ware?.is_running()) + . += arm + +/// The hand index of `arm`'s own hand, if that hand is empty (the implant only punches with its own fist), else 0 +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_gorilla_hand(obj/item/organ/cyberimp/cyberware/gorilla_arms/arm) + var/obj/item/bodypart/limb = get_bodypart(arm.zone) + if(!limb?.held_index || !isnull(get_item_for_held_index(limb.held_index))) + return 0 + return limb.held_index + +/// Whether it has a working Gorilla Arm with an empty hand to punch with +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_has_gorilla_fist() + for(var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm as anything in boss_gorilla_arms()) + if(boss_gorilla_hand(arm)) + return TRUE + return FALSE + +/// Whether its Gorilla Arms get it through `barrier`: one it may smash (boss_can_smash()), with a fist free to do it. Airlocks are left to the arms' own door forcing. +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_gorilla_goes_through(atom/barrier) + return boss_has_gorilla_fist() && boss_can_smash(barrier) + +/** + * Whether its Gorilla Arms may go at `barrier`: a window, a grille, a table or a door that isn't an + * airlock, where it may break things (boss_may_break(): its own site, indoors, never near a ship), and + * one the implant's punches break in at most BOUNTY_BOSS_SMASH_MOST_BLOWS through its armour. + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_can_smash(atom/barrier) + if(!isobj(barrier) || istype(barrier, /obj/machinery/door/airlock)) + return FALSE + if(!istype(barrier, /obj/structure/window) && !istype(barrier, /obj/structure/grille) && !istype(barrier, /obj/structure/table) && !istype(barrier, /obj/machinery/door)) + return FALSE + var/obj/thing = barrier + if(!thing.uses_integrity || !boss_may_break(thing)) + return FALSE + var/blow = thing.run_atom_armor(BOUNTY_BOSS_SMASH_BLOW, BRUTE, MELEE, get_dir(thing, src)) + return blow > 0 && thing.get_integrity() <= blow * BOUNTY_BOSS_SMASH_MOST_BLOWS + +/** + * Its Gorilla Arms go at `barrier`, right beside it. The tell first, for BOUNTY_BOSS_SMASH_WINDUP: + * rooted, an orange glow, the barrier's tile lit and the pistons heard. Then real punches with its + * empty Gorilla fists (boss_smash_blow()), each the implant's own, until the barrier is down, the + * punches run out or something stops it. Nobody is hurt by it. Returns TRUE if it started. + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_start_smash(atom/barrier) + if(!boss_can_use_ability() || !ai_controller || !Adjacent(barrier) || !boss_has_gorilla_fist() || !boss_can_smash(barrier)) + return FALSE + var/smash_time = BOUNTY_BOSS_SMASH_WINDUP + BOUNTY_BOSS_SMASH_MOST_BLOWS * 1 SECONDS + var/serial = boss_set_busy(BOUNTY_BOSS_BUSY_SMASH, smash_time + 1 SECONDS) + boss_next_ability_at = max(boss_next_ability_at, world.time + BOUNTY_BOSS_SMASH_WINDUP + BOUNTY_BOSS_SMASH_RECOVER) + boss_smash_target = WEAKREF(barrier) + boss_smash_blows = 0 + face_atom(barrier) + visible_message(span_boldwarning("[src] draws back a piston-driven fist at [barrier]!"), blind_message = span_hear("You hear pistons hiss.")) + playsound(src, 'sound/machines/piston/piston_raise.ogg', 60, TRUE) + add_filter(BOUNTY_BOSS_SMASH_FILTER, 2, outline_filter(1, BOUNTY_BOSS_SMASH_COLOR)) + boss_smash_mark = WEAKREF(new /obj/effect/temp_visual/bounty_boss_mark(get_turf(barrier), smash_time, BOUNTY_BOSS_SMASH_COLOR)) + addtimer(CALLBACK(src, PROC_REF(boss_smash_blow), serial), BOUNTY_BOSS_SMASH_WINDUP, TIMER_DELETE_ME) + return TRUE + +/** + * One punch of the smash under `serial` at its barrier: the empty fist of a working Gorilla Arm whose + * own cooldown is over is made the active hand, and the barrier is clicked with it in combat mode, the + * way a player punches (controller.ai_interact()). The implant does the damage. The next punch follows + * when the body and an arm are ready again. Returns TRUE if it threw one. + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_smash_blow(serial) + if(!boss_still(BOUNTY_BOSS_BUSY_SMASH, serial)) + return FALSE + var/obj/barrier = boss_smash_target?.resolve() + if(QDELETED(barrier) || !barrier.density || !Adjacent(barrier) || boss_smash_blows >= BOUNTY_BOSS_SMASH_MOST_BLOWS || !boss_may_break(barrier) || !boss_has_gorilla_fist()) + boss_end_smash(serial) + return FALSE + var/threw = FALSE + if(next_move <= world.time) + for(var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm as anything in boss_gorilla_arms()) + var/hand = boss_gorilla_hand(arm) + if(!hand || !COOLDOWN_FINISHED(arm, slam_cooldown)) + continue + swap_hand(hand, silent = TRUE) + if(get_active_held_item()) + continue + var/is_door = istype(barrier, /obj/machinery/door) + boss_smash_blows++ + ai_controller.ai_interact(target = barrier, combat_mode = TRUE) + threw = TRUE + // A door it punches down spends its wall budget, as one any ability breaks does + if(is_door && (QDELETED(barrier) || barrier.get_integrity() <= 0)) + boss_walls_left-- + break + if(QDELETED(barrier) || !barrier.density || boss_smash_blows >= BOUNTY_BOSS_SMASH_MOST_BLOWS) + boss_end_smash(serial) + return threw + addtimer(CALLBACK(src, PROC_REF(boss_smash_blow), serial), boss_smash_wait(), TIMER_DELETE_ME) + return threw + +/// How long until it can throw its next smash punch: its body's click and the soonest arm's own cooldown, at least a tick +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_smash_wait() + var/soonest = INFINITY + for(var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm as anything in boss_gorilla_arms()) + if(boss_gorilla_hand(arm)) + soonest = min(soonest, arm.slam_cooldown) + if(soonest == INFINITY) + soonest = world.time + return max(1, next_move - world.time, soonest - world.time) + +/// The smash is over, or never was: the tell goes, and with `serial` (or none) it is no longer busy with it +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_end_smash(serial) + boss_end_smash_telegraph() + boss_smash_target = null + boss_smash_blows = 0 + if(boss_busy == BOUNTY_BOSS_BUSY_SMASH && (!serial || serial == boss_busy_serial)) + boss_clear_busy(serial) + +/// The smash's glow and floor mark go +/mob/living/carbon/human/npc/bounty_criminal/boss/proc/boss_end_smash_telegraph() + remove_filter(BOUNTY_BOSS_SMASH_FILTER) + var/obj/effect/mark = boss_smash_mark?.resolve() + boss_smash_mark = null + if(!QDELETED(mark)) + qdel(mark) + // ===== SIGNALS ===== /** @@ -967,6 +1583,11 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades) var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner return istype(boss) && boss.boss_landing_ok(get_turf(target)) +/// Whether something it throws from where it stands would land where `target` stands, and not stop on glass or a door on the way +/datum/action/cooldown/mob_cooldown/bounty_boss/proc/throw_reaches(atom/target) + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner + return istype(boss) && boss.boss_throw_reaches(get_turf(boss), get_turf(target)) + /datum/action/cooldown/mob_cooldown/bounty_boss/Activate(atom/target) var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner if(!istype(boss) || QDELETED(target)) @@ -1227,10 +1848,13 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades) /** * 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. + * it is busy or can't act; worn out, it falls back; its target; its combat sense (a stimulant when it + * tires, and a kit's own reaction to stun fire); its kit's gear; drawing + * its weapon once its fight has started; an ability; the kit's way of closing in or keeping away; up to + * and through whatever is in its way; its melee with what it holds; patching itself up with nobody + * about; with nobody in sight, the hunt for the nearest hunter still on its site that it can get at; + * and with nobody it can get at, out of the sight of those shooting at it from where it can't. Bosses + * never surrender. */ /datum/ai_controller/basic_controller/bounty_boss blackboard = list( @@ -1245,16 +1869,18 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades) /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/npc_combat_sense, /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/bounty_boss_breach, /datum/ai_planning_subtree/human_npc_melee, /datum/ai_planning_subtree/bounty_treat_self, /datum/ai_planning_subtree/bounty_boss_hunt, + /datum/ai_planning_subtree/bounty_boss_cover, ) /datum/ai_controller/basic_controller/bounty_boss/TryPossessPawn(atom/new_pawn) @@ -1296,9 +1922,10 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades) /** * 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. + * the hunters (boss_wear_out()). If it wants a stimulant pen now (combat sense's own rule: winded, in a + * fight, none in its blood) it takes it first; then it falls back from whoever it was fighting for + * BOUNTY_BOSS_FALLBACK_TIME and fights on. Back above the line (healed, or its stamina back), it is fresh + * again. */ /datum/ai_planning_subtree/bounty_boss_worn_out @@ -1312,9 +1939,10 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades) return if(!boss.boss_worn_out) boss.boss_wear_out() + var/datum/component/npc_combat_sense/sense = boss.GetComponent(/datum/component/npc_combat_sense) + if(sense?.rules.can_act(boss, controller) && sense.rules.plan_stim(boss, controller, sense)) + return SUBTREE_RETURN_FINISH_PLANNING 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() @@ -1324,38 +1952,6 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades) 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 @@ -1481,6 +2077,129 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades) controller.queue_behavior(/datum/ai_behavior/travel_towards/adjacent, BB_BOUNTY_BOSS_PREY) return SUBTREE_RETURN_FINISH_PLANNING +/** + * Its target stands behind things its kit goes through, every one of them (boss_gets_through()): it + * walks up to the first, and with Gorilla Arms right beside it, smashes it. A kit's own ability (a + * charge, a grenade, a breaching charge) has had its turn already. It only does this while what breaks + * through is ready (boss_breaks_through_now()), or when there is no way round on foot; otherwise it + * leaves the walk round to the melee planner rather than wait at the glass (review r2). + */ +/datum/ai_planning_subtree/bounty_boss_breach + +/datum/ai_planning_subtree/bounty_boss_breach/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick) + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = controller.pawn + var/atom/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET] + if(!istype(boss) || QDELETED(target) || boss.Adjacent(target)) + return + var/turf/here = get_turf(boss) + var/turf/there = get_turf(target) + var/list/blockers = boss.boss_line_blockers(here, there) + if(!length(blockers) || !boss.boss_gets_through(blockers)) + return + var/atom/barrier = blockers[1] + if(!boss.boss_breaks_through_now(barrier) && boss.boss_walks_to(there)) + return + if(get_dist(here, barrier) <= 1) + if(boss.boss_start_smash(barrier)) + return SUBTREE_RETURN_FINISH_PLANNING + return + var/turf/spot = boss.boss_spot_before(barrier, target) + if(!spot) + return + if(controller.blackboard[BB_BOUNTY_BOSS_SPOT] != spot) + controller.CancelActions() + controller.set_blackboard_key(BB_BOUNTY_BOSS_SPOT, spot) + controller.queue_behavior(/datum/ai_behavior/travel_towards, BB_BOUNTY_BOSS_SPOT) + return SUBTREE_RETURN_FINISH_PLANNING + +/** + * Hurt lately by someone it can't get at (boss_shuns()), and nobody it can reach in sight or on the + * hunt: it gets out of their sight (boss_find_cover()) and waits there, rather than stand in the open + * for them, with a line as it goes (boss_cover_bark()). With nowhere hidden in reach it backs off as + * far from them as it can, and keeps going until it gets there. Anyone it can reach brings it out. + */ +/datum/ai_planning_subtree/bounty_boss_cover + +/datum/ai_planning_subtree/bounty_boss_cover/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick) + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = controller.pawn + if(!istype(boss) || !length(boss.boss_shunned) || controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET)) + return + var/list/watchers = boss.boss_watchers() + if(!length(watchers)) + return + var/turf/here = get_turf(boss) + if(!boss.boss_seen_from(here, watchers)) + controller.clear_blackboard_key(BB_BOUNTY_BOSS_COVER) + return SUBTREE_RETURN_FINISH_PLANNING + var/turf/spot = controller.blackboard[BB_BOUNTY_BOSS_COVER] + // On its way: it keeps walking (every plan, or the walk it queued last time is dropped) until it + // gets there, unless someone took the spot, or it may look again and finds the spot in their sight. + if(spot && spot != here && !boss.boss_someone_on(spot) && (world.time < boss.boss_cover_rethink_at || !boss.boss_seen_from(spot, watchers))) + controller.queue_behavior(/datum/ai_behavior/travel_towards, BB_BOUNTY_BOSS_COVER) + return SUBTREE_RETURN_FINISH_PLANNING + if(world.time < boss.boss_cover_rethink_at) + return SUBTREE_RETURN_FINISH_PLANNING + boss.boss_cover_rethink_at = world.time + BOUNTY_BOSS_REACH_RETHINK + spot = boss.boss_find_cover(watchers) + if(!spot) + controller.clear_blackboard_key(BB_BOUNTY_BOSS_COVER) + return + if(controller.blackboard[BB_BOUNTY_BOSS_COVER] != spot) + controller.CancelActions() + controller.set_blackboard_key(BB_BOUNTY_BOSS_COVER, spot) + boss.boss_cover_bark() + controller.queue_behavior(/datum/ai_behavior/travel_towards, BB_BOUNTY_BOSS_COVER) + return SUBTREE_RETURN_FINISH_PLANNING + +// ===== COMBAT SENSE: ITS STIMULANT, AND A KIT'S ANSWER TO STUN FIRE (C8) ===== + +/** + * A boss's combat sense (voidcrew/modules/human_npcs/human_npc_combat_sense.dm): the bounty family's leash + * and gang rules, and the stimulant pens it carries (boss_supplies()), taken when it tires in a fight and + * never while one is still in its blood. Nothing else injects them: its worn-out fall back asks this for + * the pen too (bounty_boss_worn_out). By default stun fire changes nothing else about how it fights; a + * kit with its own reaction sets it on a subtype (bounty_boss_kits.dm), and a ready ability always goes + * first, its wind-up being the kit's own answer. + */ +/datum/npc_combat_sense/bounty/boss + react_to_stun_fire = FALSE + +/datum/npc_combat_sense/bounty/boss/can_act(mob/living/carbon/human/npc, datum/ai_controller/controller) + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = npc + return istype(boss) && boss.boss_hostile && !boss.boss_busy && ..() + +/datum/npc_combat_sense/bounty/boss/in_fight(mob/living/carbon/human/npc, datum/ai_controller/controller, datum/component/npc_combat_sense/sense) + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = npc + return istype(boss) && boss.boss_hostile && (controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET) || sense.under_fire()) + +/datum/npc_combat_sense/bounty/boss/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) + if(plan_stim(npc, controller, sense)) + return SUBTREE_RETURN_FINISH_PLANNING + if(!under_fire || !react_to_stun_fire || !may_move(npc, controller)) + return + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = npc + var/atom/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET] + if(!QDELETED(target) && boss.boss_choose_ability(target)) + return + if(close_in_reach && reach(npc, controller) <= close_in_reach) + return plan_close_in(npc, controller, sense) + return plan_cover(npc, controller, sense) + +// The second pen of a fight comes with its "recover" line ("Round two."), as its second wind always did. +/datum/npc_combat_sense/bounty/boss/telegraph(mob/living/carbon/human/npc, kind, atom/about, obj/item/used) + . = ..() + if(kind != HUMAN_NPC_BARK_STIMULANT) + return + var/datum/component/npc_combat_sense/sense = npc.GetComponent(/datum/component/npc_combat_sense) + if(sense?.stims_used) + INVOKE_ASYNC(npc, TYPE_PROC_REF(/mob/living, bounty_say), "recover", null, TRUE) + // ===== LOOKS ===== /// A mini-boss's clothes before its kit's: plain dark clothes @@ -1491,3 +2210,5 @@ GLOBAL_LIST_EMPTY(bounty_boss_barricades) gloves = /obj/item/clothing/gloves/color/black #undef BOUNTY_BOSS_BUSY_TRAIT +#undef BOUNTY_BOSS_BUSY_SMASH +#undef BOUNTY_BOSS_SMASH_FILTER diff --git a/voidcrew/modules/bounties/bounty_boss_kits.dm b/voidcrew/modules/bounties/bounty_boss_kits.dm index 3e6d485036f..19c23093c19 100644 --- a/voidcrew/modules/bounties/bounty_boss_kits.dm +++ b/voidcrew/modules/bounties/bounty_boss_kits.dm @@ -7,29 +7,53 @@ * (/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. + * stimulants and bruise pack are packed by boss_supplies(), and its combat sense (bounty_boss.dm) uses + * the pens when it tires. Nothing it carries is ever loot. * - * - Juggernaut: riot armour and a body grown huge (tg's gigantism gene). Charges in a line, smashing + * - Juggernaut: riot armour, a body grown huge (tg's gigantism gene) and a tower shield it raises as its + * fight starts, stopping every shot from in front of it (C8: flank it). 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). + * when someone is close. Fights with its shield and its free fist. + * - Pyromaniac: a real firefighter suit and helmet (tg's thermal protection, CB-7), a gas mask, a real + * flamethrower with a plasma tank and a molotov in hand, and an ID with its name. Hoses a short line of + * fire with the flamethrower and throws molotovs that leave a burning patch; whoever it catches burns with + * tg's fire stacks (CB-8). Every BOUNTY_PYROMANIAC_FLAMER_SWEEPS sweeps the tank runs dry and it stops to + * change it for one of its spares, open while it does. Its mask keeps its own smoke out of its lungs. Shot with a disabler, it goes for the shooter until its flamer reaches + * them (C8: keep your distance and keep moving). Shot from past its flamer's reach, it pulls the pin + * on one of its two real smoke grenades and throws it halfway to the shooter, then comes through the + * cloud to where the shots came from (C9: back out of the smoke, flank it, or see through it). * - 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). + * someone behind cover. Whoever a blast catches takes tg's light explosion (CB-10). A real CNS + * rebooter in its head gets it up a second after its first stamina crit of a minute (C8: pile on, and + * cuff it on the second). * - 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: 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. + * cuts. Shot with a disabler from beyond its dash, it breaks the line and comes again from cover (C8: + * corner it). + * - Heavy: an ablative trenchcoat with its hood up (C8: energy armour everywhere and half of all beams + * reflected; bring lethal, or a lot of shots) 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. * - * 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. + * Where the air would kill it, each kit seals up in a real MODsuit of its own theme, close to the armour + * of what it wears in good air (bounty_sealed_gear(), bounty_suits.dm): the Juggernaut a security suit, + * the Pyromaniac an atmospherics one, the Demolitionist an engineering one, the Ghost a civilian one and + * the Heavy a magnate one. The suit takes its bag's place on its back, the bag's things in its storage. + * A coat or riot plates don't go over a MODsuit: the Juggernaut keeps its buckler, and the Heavy has the + * magnate suit's energy armour (its coat's) but no reflection out there. + * + * Behind something it can't walk through, a hunter is out of reach unless the kit gets through it + * (boss_goes_through(), bounty_boss.dm): the Juggernaut's charge, the Demolitionist's grenades and + * breaching charge, the Pyromaniac's molotovs, the Heavy's rounds, and real Gorilla Arms (the cyberpsycho's, + * or an admin's pick; no kit rolls them). A grenade or a molotov only goes where a thrown item would + * (boss_throw_passes(), boss_throw_reaches()): over a table, a railing or a gap, never through glass, + * a windoor, a grille or a shut door. + * The Ghost has nothing for it, and takes cover instead. It walks up to the barrier only while that + * ability is off cooldown (boss_breaks_through_now()), or when there is no way round; otherwise it goes + * round on foot. * * 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. @@ -39,7 +63,7 @@ /mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut name = "armoured criminal" - desc = "A huge criminal in riot plates, built like a door." + desc = "A huge criminal in riot plates behind a tower shield, built like a door." boss_kit = BOUNTY_KIT_JUGGERNAUT boss_ability_types = list( /datum/action/cooldown/mob_cooldown/bounty_boss/charge, @@ -55,14 +79,64 @@ return boss_supplies(bounty_outfit_instance(/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." + . = istype(wear_suit, /obj/item/clothing/suit/armor/riot) ? "Riot plates cover [p_them()] from neck to boots." : "[p_They()] [p_are()] built like a door." + if(boss_shield()) + . += " A tower shield covers [p_their()] front." + +/// The tower shield it holds, if it still has one (C8) +/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut/proc/boss_shield() + for(var/obj/item/shield/riot/phalanx_buckler/shield in held_items) + return shield + return null + +// Its fight on, it raises the shield it holds, the player's way (use in hand), and keeps it up. +/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut/boss_gear_plan(datum/ai_controller/controller) + var/obj/item/shield/riot/phalanx_buckler/shield = boss_shield() + if(isnull(shield) || shield.raised || HAS_TRAIT(src, TRAIT_HANDS_BLOCKED) || world.time < controller.blackboard[BB_HUMAN_NPC_ARMING_RETRY_AT]) + return FALSE + controller.queue_behavior(/datum/ai_behavior/bounty_juggernaut_raise_shield) + return TRUE + +/// The Juggernaut raises its shield: the shield in its active hand, then used in hand (tg's Z key) +/datum/ai_behavior/bounty_juggernaut_raise_shield + +/datum/ai_behavior/bounty_juggernaut_raise_shield/perform(seconds_per_tick, datum/ai_controller/controller) + var/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut/jugg = controller.pawn + var/obj/item/shield/riot/phalanx_buckler/shield = istype(jugg) ? jugg.boss_shield() : null + if(isnull(shield) || !human_npc_ready_item(jugg, shield)) + return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED + if(!shield.raised) + jugg.execute_mode() + if(!shield.raised) + return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED + jugg.visible_message(span_warning("[jugg] sets [jugg.p_their()] shield in front of [jugg.p_them()].")) + return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED -// Out where the air kills: a black and red space suit, as heavy as its riot plates +// A try that got nowhere: it fights on and tries again in a while, rather than fumble with it every plan +/datum/ai_behavior/bounty_juggernaut_raise_shield/finish_action(datum/ai_controller/controller, succeeded) + . = ..() + if(!succeeded) + controller.set_blackboard_key(BB_HUMAN_NPC_ARMING_RETRY_AT, world.time + 5 SECONDS) + +// Out where the air kills: a security MODsuit, the nearest to 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) + return list(/obj/item/mod/control/pre_equipped/bounty_boss/security) +// Its charge goes straight through a table, a chair, a plain window or a grille +/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut/boss_goes_through(atom/barrier) + if(..()) + return TRUE + var/datum/action/cooldown/mob_cooldown/bounty_boss/charge/charge = locate() in boss_abilities + return isobj(barrier) && charge?.smashes(barrier) && boss_may_break(barrier) + +// With its charge ready +/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut/boss_breaks_through_now(atom/barrier) + if(..()) + return TRUE + var/datum/action/cooldown/mob_cooldown/bounty_boss/charge/charge = boss_ability_off_cooldown(/datum/action/cooldown/mob_cooldown/bounty_boss/charge) + return isobj(barrier) && charge?.smashes(barrier) && boss_may_break(barrier) + +// The shield has no sling, so it is held from the start, in the off hand; the other fist stays free. /datum/outfit/bounty_boss/juggernaut name = "Bounty mini-boss: Juggernaut" uniform = /obj/item/clothing/under/syndicate/combat @@ -70,6 +144,7 @@ head = /obj/item/clothing/head/helmet/toggleable/riot gloves = /obj/item/clothing/gloves/combat shoes = /obj/item/clothing/shoes/jackboots + l_hand = BOUNTY_JUGGERNAUT_SHIELD /** * Charge: a roar, a stamp and a line on the floor, then a run down that line. The first person in @@ -274,7 +349,7 @@ */ /datum/action/cooldown/mob_cooldown/bounty_boss/slam name = "Ground Slam" - desc = "Bring both fists down on the floor and knock everyone around you off their feet." + desc = "Bring your whole weight down on the floor and knock everyone around you off their feet." cooldown_time = BOUNTY_JUGGERNAUT_SLAM_COOLDOWN windup = BOUNTY_JUGGERNAUT_SLAM_WINDUP @@ -282,7 +357,7 @@ return aimable(target) && get_dist(owner, target) <= 1 /datum/action/cooldown/mob_cooldown/bounty_boss/slam/telegraph(atom/target) - owner.visible_message(span_boldwarning("[owner] raises both fists high over [owner.p_their()] head!")) + owner.visible_message(span_boldwarning("[owner] raises both arms high over [owner.p_their()] head!")) playsound(owner, 'sound/effects/magic/tail_swing.ogg', 60, TRUE) mark_turfs(RANGE_TURFS(1, owner), COLOR_RED) var/matrix/rest = matrix(owner.transform) @@ -293,7 +368,7 @@ /datum/action/cooldown/mob_cooldown/bounty_boss/slam/effect(atom/target) var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner - boss.visible_message(span_danger("[boss] brings both fists down on the floor!")) + boss.visible_message(span_danger("[boss] brings [boss.p_their()] whole weight 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))) boss.boss_hit(victim, BOUNTY_JUGGERNAUT_SLAM_DAMAGE, BRUTE, MELEE, BOUNTY_JUGGERNAUT_SLAM_KNOCKDOWN) @@ -304,75 +379,342 @@ /mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac name = "scorched criminal" - desc = "A criminal in a blackened fire suit, with a lit torch in hand." + desc = "A criminal in a blackened fire suit and a gas mask, a flamethrower in one hand and a bottle in the other." boss_kit = BOUNTY_KIT_PYROMANIAC + npc_combat_sense = /datum/npc_combat_sense/bounty/boss/pyromaniac boss_ability_types = list( /datum/action/cooldown/mob_cooldown/bounty_boss/flamer, /datum/action/cooldown/mob_cooldown/bounty_boss/molotov, + /datum/action/cooldown/mob_cooldown/bounty_boss/smoke, ) + /// Sweeps fired off the tank in its flamethrower now + var/boss_flamer_sweeps = 0 + /// world.time its tank change may finish: it takes BOUNTY_PYROMANIAC_RELOAD_TIME + var/boss_reload_ready_at = 0 /mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/bounty_build_outfit(zone) - return boss_supplies(bounty_outfit_instance(/datum/outfit/bounty_boss/pyromaniac)) + var/datum/outfit/kit = boss_supplies(bounty_outfit_instance(/datum/outfit/bounty_boss/pyromaniac)) + if(istype(kit)) + kit.backpack_contents[/obj/item/tank/internals/plasma/full] = BOUNTY_PYROMANIAC_SPARE_TANKS + return kit + +// The flamethrower's tank runs dry: it changes it for a spare from its bag (bounty_pyro_reload) +/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/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/flamethrower/flamer = boss_flamethrower() + if(isnull(flamer) || bounty_pyro_flamer_fuelled(flamer) || isnull(boss_spare_tank())) + return FALSE + controller.queue_behavior(/datum/ai_behavior/bounty_pyro_reload) + return TRUE + +/// A full plasma tank it carries that isn't in its flamethrower, in hand or where it can draw it from +/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/proc/boss_spare_tank() + var/obj/item/flamethrower/flamer = boss_flamethrower() + for(var/obj/item/tank/internals/plasma/tank in get_all_contents_type(/obj/item/tank/internals/plasma)) + if(tank == flamer?.ptank || !(is_holding(tank) || human_npc_can_draw(src, tank))) + continue + var/datum/gas_mixture/tank_air = tank.return_air() + if(tank_air?.return_pressure() >= BOUNTY_PYROMANIAC_FLAMER_EMPTY) + return tank + return null + +/** + * One sweep's plasma out of its flamethrower's tank: an even share of what is left, so the tank is dry + * after BOUNTY_PYROMANIAC_FLAMER_SWEEPS sweeps. + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/proc/boss_spend_flamer_fuel(obj/item/flamethrower/flamer) + var/datum/gas_mixture/tank_air = flamer?.ptank?.return_air() + if(isnull(tank_air)) + return + boss_flamer_sweeps++ + var/sweeps_left = BOUNTY_PYROMANIAC_FLAMER_SWEEPS - boss_flamer_sweeps + tank_air.remove_ratio(sweeps_left <= 0 ? 1 : 1 / (sweeps_left + 1)) + if(sweeps_left <= 0) + visible_message(span_warning("[src]'s flamethrower coughs and sputters out.")) + +/** + * Changes the plasma tank on its flamethrower the way a player does: a hand freed (the bottle into its + * bag), a full tank out of the bag, and the flamethrower clicked with it, which swaps the tanks and drops + * the empty (tg's flamethrower; the empty is its locked gear, so it is gone once on the floor). It stops + * for it, with a line and the wrench of the fitting, and takes at least BOUNTY_PYROMANIAC_RELOAD_TIME. + * Gives up after a while and fights on. + */ +/datum/ai_behavior/bounty_pyro_reload + action_cooldown = 0.5 SECONDS + +/datum/ai_behavior/bounty_pyro_reload/setup(datum/ai_controller/controller) + . = ..() + var/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/pyro = controller.pawn + var/obj/item/flamethrower/flamer = istype(pyro) ? pyro.boss_flamethrower() : null + if(isnull(flamer)) + return FALSE + controller.set_blackboard_key(BB_BOUNTY_BOSS_RELOAD_UNTIL, world.time + 12 SECONDS) + pyro.boss_reload_ready_at = world.time + BOUNTY_PYROMANIAC_RELOAD_TIME + if(flamer.lit) + flamer.toggle_igniter(pyro) + pyro.visible_message(span_warning("[pyro] stops and wrenches the empty tank off [pyro.p_their()] flamethrower.")) + playsound(pyro, 'sound/items/tools/ratchet_slow.ogg', 60, TRUE) + pyro.boss_bark("reload") + +/datum/ai_behavior/bounty_pyro_reload/perform(seconds_per_tick, datum/ai_controller/controller) + var/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/pyro = controller.pawn + var/obj/item/flamethrower/flamer = istype(pyro) ? pyro.boss_flamethrower() : null + if(isnull(flamer) || world.time >= controller.blackboard[BB_BOUNTY_BOSS_RELOAD_UNTIL] || HAS_TRAIT(pyro, TRAIT_HANDS_BLOCKED)) + return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED + if(bounty_pyro_flamer_fuelled(flamer)) + return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED + if(pyro.next_move > world.time) + return AI_BEHAVIOR_DELAY + var/obj/item/tank/internals/plasma/tank = pyro.boss_spare_tank() + if(isnull(tank)) + return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED + if(!pyro.is_holding(tank)) + if(!length(pyro.get_empty_held_indexes())) + var/obj/item/bottle = locate(/obj/item/reagent_containers/cup/glass/bottle/molotov) in pyro.held_items + if(isnull(bottle) || !pyro.back?.atom_storage?.attempt_insert(bottle, pyro, messages = FALSE)) + return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED + return AI_BEHAVIOR_DELAY + if(!human_npc_take_in_hand(pyro, tank)) + return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED + return AI_BEHAVIOR_DELAY + if(world.time < pyro.boss_reload_ready_at) + return AI_BEHAVIOR_DELAY + if(!human_npc_ready_item(pyro, tank)) + return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_FAILED + controller.ai_interact(target = flamer, combat_mode = FALSE) + if(flamer.ptank == tank) + pyro.boss_flamer_sweeps = 0 + playsound(pyro, 'sound/items/tools/ratchet.ogg', 60, TRUE) + return AI_BEHAVIOR_DELAY + +/datum/ai_behavior/bounty_pyro_reload/finish_action(datum/ai_controller/controller, succeeded) + . = ..() + controller.clear_blackboard_key(BB_BOUNTY_BOSS_RELOAD_UNTIL) + if(!succeeded) + // A change that got nowhere: it fights on with what it has for a while + controller.set_blackboard_key(BB_HUMAN_NPC_ARMING_RETRY_AT, world.time + 10 SECONDS) /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." -// Out where the air kills: an EVA suit, as light as its fire suit. Nothing burns in vacuum. +// Out where the air kills: an atmospherics MODsuit, fireproof like its fire suit, its gas mask on under the helmet. 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) + return list(/obj/item/mod/control/pre_equipped/bounty_boss/atmospheric) + +// A molotov goes over anything a thrown bottle gets past (a table, a railing, a gap), never through glass or a door +/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/boss_goes_through(atom/barrier) + return ..() || boss_throw_passes(barrier) + +// With a molotov ready +/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/boss_breaks_through_now(atom/barrier) + return ..() || (boss_throw_passes(barrier) && !isnull(boss_ability_off_cooldown(/datum/action/cooldown/mob_cooldown/bounty_boss/molotov))) + +// Shot from past its flamer's reach, the smoke goes before anything else (C9) +/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/boss_choose_ability(atom/target) + var/datum/action/cooldown/mob_cooldown/bounty_boss/smoke/ability = boss_ability_off_cooldown(/datum/action/cooldown/mob_cooldown/bounty_boss/smoke) + if(ability && !QDELETED(target) && ability.IsAvailable() && ability.worth_using(target)) + return ability + return ..() + +// Its smoke has its own line +/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/boss_bark(suffix, fallback) + if(suffix == "ability" && istype(boss_winding(), /datum/action/cooldown/mob_cooldown/bounty_boss/smoke)) + return ..("smoke", "ability") + return ..() + +/// The flamethrower it holds, or null +/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/proc/boss_flamethrower() + return locate(/obj/item/flamethrower) in held_items + +/// Whether `flamer` has the igniter and the plasma for a sweep +/proc/bounty_pyro_flamer_fuelled(obj/item/flamethrower/flamer) + if(QDELETED(flamer) || !flamer.igniter || !flamer.status || QDELETED(flamer.ptank)) + return FALSE + var/datum/gas_mixture/tank_air = flamer.ptank.return_air() + return tank_air?.return_pressure() >= BOUNTY_PYROMANIAC_FLAMER_EMPTY + +/// The molotov it carries, in hand or in its bag, or null +/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/proc/boss_molotov() + for(var/obj/item/reagent_containers/cup/glass/bottle/molotov/bottle in get_all_contents_type(/obj/item/reagent_containers/cup/glass/bottle/molotov)) + if(is_holding(bottle) || human_npc_can_draw(src, bottle)) + return bottle + return null -// 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. +/// Whether it has a hand for a grenade: one free, or its bottle can go back in its bag +/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/proc/boss_hand_for_grenade() + if(length(get_empty_held_indexes())) + return TRUE + var/obj/item/bottle = locate(/obj/item/reagent_containers/cup/glass/bottle/molotov) in held_items + return !isnull(bottle) && !!back?.atom_storage?.can_insert(bottle, src, messages = FALSE) + +/// A smoke grenade it carries with the pin still in, in hand or where it can draw it from +/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/proc/boss_smoke_grenade() + // One already in hand first (kept from a wind-up it was stunned out of): a pocket one would need a free hand + for(var/obj/item/grenade/smokebomb/grenade in held_items) + if(!grenade.active) + return grenade + for(var/obj/item/grenade/smokebomb/grenade in get_all_contents_type(/obj/item/grenade/smokebomb)) + if(!grenade.active && (is_holding(grenade) || human_npc_can_draw(src, grenade))) + return grenade + return null + +/** + * The Pyromaniac's answer to stun fire (C8): it goes for whoever is shooting it, until its flamer + * reaches them (combat sense's close-in), throwing smoke, a molotov or sweeping the flamer the moment one + * is ready (the boss rules let a ready ability go first). Keep your distance and keep moving. + * + * Out of its sight (in its own smoke, or round a corner) it makes for where the shots last came from, + * not for where the shooter is now (C9): tg's targeting drops whoever it can't see, so this is how it + * comes through the cloud. There it looks again; if they moved, it is the hunt's to find them. + */ +/datum/npc_combat_sense/bounty/boss/pyromaniac + react_to_stun_fire = TRUE + close_in_reach = BOUNTY_PYROMANIAC_FLAMER_RANGE + +// It closes until its flamer reaches, not to arm's length +/datum/npc_combat_sense/bounty/boss/pyromaniac/reach(mob/living/carbon/human/npc, datum/ai_controller/controller) + return BOUNTY_PYROMANIAC_FLAMER_RANGE + +// Whoever is shooting it becomes who it goes for, if it may go after them +/datum/npc_combat_sense/bounty/boss/pyromaniac/plan_close_in(mob/living/carbon/human/npc, datum/ai_controller/controller, datum/component/npc_combat_sense/sense) + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = npc + var/atom/shooter = sense.threat() + if(istype(boss) && shooter) + var/atom/aim = boss.boss_target_for(shooter) + if(aim != controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET] && boss.boss_valid_target(aim)) + controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, aim) + if(!can_see(npc, shooter, HUMAN_NPC_SIGHT_RANGE)) + var/turf/spot = sense.threat_turf(npc) + if(isnull(spot) || get_dist(npc, spot) <= 1 || !tile_ok(npc, controller, spot)) + return + sense.charged_at = world.time + sense.decided_at = world.time + controller.set_blackboard_key(BB_HUMAN_NPC_STUN_SHOOTER, spot) + controller.queue_behavior(/datum/ai_behavior/human_npc_close_in, BB_HUMAN_NPC_STUN_SHOOTER, 1) + return SUBTREE_RETURN_FINISH_PLANNING + return ..() + +// The firefighter suit and helmet are what keep its own fire off it (tg's thermal protection, CB-7); the gas +// mask keeps smoke out of its lungs. The flamethrower doesn't holster, so it is in hand from the start, the +// bottle in the other. A smoke grenade in each pocket (C9). /datum/outfit/bounty_boss/pyromaniac name = "Bounty mini-boss: Pyromaniac" uniform = /obj/item/clothing/under/color/black suit = /obj/item/clothing/suit/utility/fire/firefighter head = /obj/item/clothing/head/utility/hardhat/red + mask = /obj/item/clothing/mask/gas gloves = /obj/item/clothing/gloves/color/black shoes = /obj/item/clothing/shoes/workboots - r_hand = BOUNTY_PYROMANIAC_TORCH + r_hand = BOUNTY_PYROMANIAC_FLAMETHROWER + l_hand = BOUNTY_PYROMANIAC_MOLOTOV_BOTTLE + l_pocket = BOUNTY_PYROMANIAC_SMOKE + r_pocket = BOUNTY_PYROMANIAC_SMOKE + id = /obj/item/card/id + +// Its ID carries its name, so with its face behind the mask it still goes by it (tg's own naming). No +// access and no account; a rename (the bounty record's name) follows it onto the card. +/datum/outfit/bounty_boss/pyromaniac/post_equip(mob/living/carbon/human/user, visuals_only = FALSE) + . = ..() + var/obj/item/card/id/card = user.wear_id + if(istype(card)) + card.registered_name = user.real_name + card.update_label() + +/// The Pyromaniac's flamethrower: tg's, built and fuelled. It is a kit item, so lighting it is no news for admins. +/obj/item/flamethrower/full/tank/bounty_boss + warned_admins = TRUE + +/// The Pyromaniac's bottle: tg's molotov, filled with welding fuel +/obj/item/reagent_containers/cup/glass/bottle/molotov/bounty_boss + list_reagents = list(/datum/reagent/fuel = 50) /** - * Flamer: the pilot light hisses and an orange cone shows on the floor, then a jet of fire sweeps - * 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. + * Flamer: it lights its flamethrower and an orange line shows on the floor, then a jet of fire hoses the + * line: BOUNTY_PYROMANIAC_FLAMER_DAMAGE burn and tg's fire stacks on whoever it catches, and the floor + * burns on for BOUNTY_PYROMANIAC_FLAMER_FLOOR (the boss fire, not loose plasma). Each sweep spends a + * share of the tank (boss_spend_flamer_fuel()); with it dry it doesn't sweep until it has changed tanks. + * It shuts the valve after each sweep. */ /datum/action/cooldown/mob_cooldown/bounty_boss/flamer name = "Flamer" - desc = "Sweep a cone of fire in front of you." + desc = "Sweep a line of fire in front of you." cooldown_time = BOUNTY_PYROMANIAC_FLAMER_COOLDOWN windup = BOUNTY_PYROMANIAC_FLAMER_WINDUP - /// The tiles it will cover, from the telegraph - var/list/cone + /// The tiles it will hose, from the telegraph + var/list/fire_line /datum/action/cooldown/mob_cooldown/bounty_boss/flamer/Destroy() - cone = null + fire_line = null return ..() /datum/action/cooldown/mob_cooldown/bounty_boss/flamer/worth_using(atom/target) - return aimable(target) && get_dist(owner, target) <= BOUNTY_PYROMANIAC_FLAMER_RANGE && can_see(owner, target, BOUNTY_PYROMANIAC_FLAMER_RANGE) && landing_ok(target) + var/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/boss = owner + if(!istype(boss) || !aimable(target) || !bounty_pyro_flamer_fuelled(boss.boss_flamethrower())) + return FALSE + return get_dist(owner, target) <= BOUNTY_PYROMANIAC_FLAMER_RANGE && can_see(owner, target, BOUNTY_PYROMANIAC_FLAMER_RANGE) && landing_ok(target) && !human_npc_ally_in_line(boss, target) && length(line_turfs(target)) -/datum/action/cooldown/mob_cooldown/bounty_boss/flamer/telegraph(atom/target) +/** + * The line its fire runs from it to `target`: as far as a flamethrower's flame gets (it stops where air + * can't pass, a wall, a window or a shut door) and as far as its fire may reach: never off its site or + * into a ship (M2) + */ +/datum/action/cooldown/mob_cooldown/bounty_boss/flamer/proc/line_turfs(atom/target) + . = list() 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)) - if(boss.boss_reach_ok(spot)) - cone += spot - owner.visible_message(span_boldwarning("[owner] opens the valve on [owner.p_their()] flamer. The pilot light hisses.")) + var/turf/start = get_turf(owner) + var/turf/aim = get_turf(target) + if(!istype(boss) || !start || !aim) + return + var/turf/previous = start + for(var/turf/spot as anything in get_line(start, aim)) + if(spot == start) + continue + if(!isopenturf(previous) || !(spot in previous.get_atmos_adjacent_turfs(alldir = TRUE)) || !boss.boss_reach_ok(spot)) + break + . += spot + previous = spot + +/datum/action/cooldown/mob_cooldown/bounty_boss/flamer/telegraph(atom/target) + var/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/boss = owner + var/list/line = line_turfs(target) + fire_line = line + var/obj/item/flamethrower/flamer = boss.boss_flamethrower() + if(flamer && human_npc_ready_item(boss, flamer) && !flamer.lit) + flamer.attack_self(boss) + owner.visible_message(span_boldwarning("[owner] opens the valve on [owner.p_their()] flamethrower. The pilot light hisses.")) playsound(owner, 'sound/effects/spray.ogg', 50, TRUE) - mark_turfs(cone, "#ff8a1f") + mark_turfs(line, "#ff8a1f") + +/datum/action/cooldown/mob_cooldown/bounty_boss/flamer/cancel_windup() + fire_line = null + shut_valve() + return ..() /datum/action/cooldown/mob_cooldown/bounty_boss/flamer/effect(atom/target) - var/list/fire_turfs = cone - cone = null - if(!length(fire_turfs)) + var/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/boss = owner + var/list/fire_turfs = fire_line + fire_line = null + var/obj/item/flamethrower/flamer = boss?.boss_flamethrower() + if(!length(fire_turfs) || !flamer?.lit || !bounty_pyro_flamer_fuelled(flamer) || !human_npc_ready_item(boss, flamer)) + shut_valve() return - owner.visible_message(span_danger("[owner] sweeps a jet of fire across the floor!")) + owner.visible_message(span_danger("[owner] hoses 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, BOUNTY_PYROMANIAC_FLAMER_STACKS) + boss.boss_spend_flamer_fuel(flamer) + addtimer(CALLBACK(src, PROC_REF(shut_valve)), BOUNTY_PYROMANIAC_FLAMER_SHUTOFF, TIMER_DELETE_ME) + +/// Puts its flamethrower out, if it is lit and done firing +/datum/action/cooldown/mob_cooldown/bounty_boss/flamer/proc/shut_valve() + var/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/boss = owner + if(!istype(boss) || QDELETED(boss)) + return + var/obj/item/flamethrower/flamer = boss.boss_flamethrower() + if(flamer?.lit && !flamer.operating) + flamer.toggle_igniter(boss) /** * Molotov: it lights the rag on a bottle and a ring shows where it will land, then it throws. The @@ -395,10 +737,16 @@ if(!aimable(target)) return FALSE var/distance = get_dist(owner, target) - return distance >= 2 && distance <= BOUNTY_PYROMANIAC_MOLOTOV_RANGE && can_see(owner, target, BOUNTY_PYROMANIAC_MOLOTOV_RANGE) && landing_ok(target) + return distance >= 2 && distance <= BOUNTY_PYROMANIAC_MOLOTOV_RANGE && can_see(owner, target, BOUNTY_PYROMANIAC_MOLOTOV_RANGE) && landing_ok(target) && throw_reaches(target) /datum/action/cooldown/mob_cooldown/bounty_boss/molotov/telegraph(atom/target) landing = get_turf(target) + // Its bottle back in hand, if the smoke put it away + var/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/pyro = owner + if(istype(pyro)) + var/obj/item/bottle = pyro.boss_molotov() + if(bottle) + human_npc_take_in_hand(pyro, bottle) owner.visible_message(span_boldwarning("[owner] lights the rag on a bottle and takes aim!")) playsound(owner, 'sound/items/match_strike.ogg', 60, TRUE) // The ring stays until the bottle lands (L3). @@ -417,7 +765,8 @@ /datum/action/cooldown/mob_cooldown/bounty_boss/molotov/effect(atom/target) var/turf/spot = landing landing = null - if(!spot) + // Glass or a door shut across the way during the wind-up: it holds the bottle. + if(!spot || !throw_reaches(spot)) return owner.visible_message(span_danger("[owner] throws a flaming bottle!")) playsound(owner, 'sound/items/weapons/fwoosh.ogg', 40, TRUE) @@ -431,6 +780,98 @@ 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, BOUNTY_PYROMANIAC_MOLOTOV_STACKS) +/** + * Smoke: it takes out a real smoke grenade it carries, then pulls the pin and throws it halfway to + * whoever shot it from past its flamer's reach (C9). The fuse and the cloud are tg's own: the cloud + * blinds everyone, weakens beams that cross it and makes anyone breathing it without internals cough and + * drop what they hold. Downed during the wind-up, the pin stays in and nothing happens (the grenade is + * kept for later). Two grenades, two clouds: then it has none left. + */ +/datum/action/cooldown/mob_cooldown/bounty_boss/smoke + name = "Smoke Grenade" + desc = "Throw a smoke grenade between you and whoever is shooting at you." + cooldown_time = BOUNTY_PYROMANIAC_SMOKE_COOLDOWN + windup = BOUNTY_PYROMANIAC_SMOKE_WINDUP + /// Where it will land, from the telegraph + var/turf/landing + +/datum/action/cooldown/mob_cooldown/bounty_boss/smoke/Destroy() + landing = null + return ..() + +// Someone it can see past its flamer's reach who has just shot it, with a grenade and a hand for it +/datum/action/cooldown/mob_cooldown/bounty_boss/smoke/worth_using(atom/target) + var/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/boss = owner + if(!aimable(target) || !istype(boss) || !boss.boss_valid_target(target)) + return FALSE + var/obj/item/grenade/smokebomb/grenade = boss.boss_smoke_grenade() + if(isnull(grenade) || (!boss.is_holding(grenade) && !boss.boss_hand_for_grenade())) + return FALSE + var/distance = get_dist(owner, target) + if(distance <= BOUNTY_PYROMANIAC_FLAMER_RANGE || distance > BOUNTY_PYROMANIAC_SMOKE_RANGE || !can_see(owner, target, BOUNTY_PYROMANIAC_SMOKE_RANGE) || !throw_reaches(target)) + return FALSE + var/datum/component/npc_combat_sense/sense = boss.GetComponent(/datum/component/npc_combat_sense) + var/shot = sense?.under_fire() && boss.boss_target_for(sense.threat()) == target + if(!shot && (world.time > boss.boss_last_attacked_at + BOUNTY_PYROMANIAC_SMOKE_HURT_WINDOW || boss.boss_last_attacker?.resolve() != target)) + return FALSE + return !isnull(find_spot(target)) + +/** + * Where it throws: halfway to `target` and at least two tiles out, short of anything in the way, on + * ground it may aim at. That rule keeps ships, hangars and outposts more than the cloud's reach away (M2). + */ +/datum/action/cooldown/mob_cooldown/bounty_boss/smoke/proc/find_spot(atom/target) + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner + var/turf/here = get_turf(owner) + var/turf/there = get_turf(target) + if(!istype(boss) || !here || !there) + return null + var/turf/spot = here + for(var/i in 1 to max(2, floor(get_dist(here, there) / 2))) + var/turf/next = get_step_towards(spot, there) + if(isnull(next) || next == there || next.is_blocked_turf(exclude_mobs = TRUE)) + break + spot = next + if(spot == here || !boss.boss_landing_ok(spot) || !boss.boss_throw_reaches(here, spot)) + return null + return spot + +/datum/action/cooldown/mob_cooldown/bounty_boss/smoke/telegraph(atom/target) + var/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/boss = owner + landing = find_spot(target) + var/obj/item/grenade/smokebomb/grenade = boss.boss_smoke_grenade() + if(isnull(grenade)) + return + // Both hands full: the bottle goes back in its bag for the grenade + if(!boss.is_holding(grenade) && !length(boss.get_empty_held_indexes())) + var/obj/item/bottle = locate(/obj/item/reagent_containers/cup/glass/bottle/molotov) in boss.held_items + if(bottle) + boss.back?.atom_storage?.attempt_insert(bottle, boss, messages = FALSE) + if(!human_npc_take_in_hand(boss, grenade) || !human_npc_ready_item(boss, grenade)) + return + owner.visible_message(span_boldwarning("[owner] pulls out a smoke grenade!")) + if(landing) + mark_turfs(list(landing), "#d8d8d8", "target_circle", /obj/effect/temp_visual/bounty_boss_thrown::duration) + +/datum/action/cooldown/mob_cooldown/bounty_boss/smoke/effect(atom/target) + var/turf/spot = landing || get_turf(target) + landing = null + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner + var/obj/item/grenade/smokebomb/grenade = locate() in boss.held_items + // Glass or a door shut across the way during the wind-up: the pin stays in. + if(isnull(grenade) || grenade.active || !spot || !throw_reaches(spot) || !human_npc_ready_item(boss, grenade)) + return + // The player's way: pull the pin in hand, then throw it. From here the fuse is the grenade's own. + 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) + +/// The Pyromaniac's smoke grenades: tg's smoke grenade, its fuse turned down to 3 seconds +/obj/item/grenade/smokebomb/bounty_boss + det_time = BOUNTY_PYROMANIAC_SMOKE_FUSE + /// Something thrown, flying from where it starts to `destination` /obj/effect/temp_visual/bounty_boss_thrown icon = 'icons/obj/weapons/grenade.dmi' @@ -459,15 +900,57 @@ /datum/action/cooldown/mob_cooldown/bounty_boss/breach, ) +/** + * Its rebooter (C8): tg's CNS rebooter, a real implant in its head, one neural load beside any chrome it + * rolled (a Demolitionist rolls at most Cascade and Lazarus, 17 of the body's 20). It is no chrome, so the + * chrome roll doesn't count it and it doesn't burn out when it dies. + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/demolitionist/Initialize(mapload, datum/human_npc_order/order) + . = ..() + if(QDELETED(src)) + return + var/obj/item/organ/implant = new BOUNTY_DEMOLITIONIST_REBOOTER() + if(!implant.Insert(src, special = TRUE)) + qdel(implant) + RegisterSignal(src, SIGNAL_ADDTRAIT(TRAIT_STUNIMMUNE), PROC_REF(boss_rebooted)) + /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/carbon/human/npc/bounty_criminal/boss/demolitionist/boss_gear_text() - return "A bandolier of grenades is slung across [p_their()] chest." + . = "A bandolier of grenades is slung across [p_their()] chest." + if(boss_rebooter()) + . += " A steel port glints at the base of [p_their()] skull." + +/// Its CNS rebooter, if it is still in its head +/mob/living/carbon/human/npc/bounty_criminal/boss/demolitionist/proc/boss_rebooter() + return locate(BOUNTY_DEMOLITIONIST_REBOOTER) in organs + +/// Its rebooter just fired (the implant's own stun immunity went on): everyone sees it get up +/mob/living/carbon/human/npc/bounty_criminal/boss/demolitionist/proc/boss_rebooted(datum/source) + SIGNAL_HANDLER + var/obj/item/organ/implant = boss_rebooter() + if(isnull(implant) || stat == DEAD || !HAS_TRAIT_FROM(src, TRAIT_STUNIMMUNE, REF(implant))) + return + visible_message(span_warning("[src] jerks back to [p_their()] feet, sparks spitting from the back of [p_their()] neck!")) -// Out where the air kills: a plain grey space suit over its work clothes +// Out where the air kills: an engineering MODsuit over its work clothes, as tough as its hard hat /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) + return list(/obj/item/mod/control/pre_equipped/bounty_boss/engineering) +// A grenade goes over anything a thrown grenade gets past (a table, a railing, a gap), and a breaching charge through an interior wall or door +/mob/living/carbon/human/npc/bounty_criminal/boss/demolitionist/boss_goes_through(atom/barrier) + if(..() || boss_throw_passes(barrier)) + return TRUE + return (iswallturf(barrier) || istype(barrier, /obj/machinery/door)) && boss_may_break(barrier) + +// With a grenade ready for anything a thrown grenade gets past, or a breaching charge for an interior wall or door +/mob/living/carbon/human/npc/bounty_criminal/boss/demolitionist/boss_breaks_through_now(atom/barrier) + if(..()) + return TRUE + if(boss_throw_passes(barrier) && boss_ability_off_cooldown(/datum/action/cooldown/mob_cooldown/bounty_boss/grenade)) + return TRUE + return (iswallturf(barrier) || istype(barrier, /obj/machinery/door)) && boss_may_break(barrier) \ + && !isnull(boss_ability_off_cooldown(/datum/action/cooldown/mob_cooldown/bounty_boss/breach)) /** * It keeps BOUNTY_DEMOLITIONIST_KEEP_MIN to _MAX tiles from its target while it has something it @@ -498,9 +981,9 @@ 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 - // A grenade needs the target in sight; its range is checked by the band itself. A breach only when one is possible now. + // A grenade needs the target in sight and a throw that lands on them; its range is checked by the band itself. A breach only when one is possible now. if(istype(ability, /datum/action/cooldown/mob_cooldown/bounty_boss/grenade)) - if(can_see(src, target, get_dist(src, target))) + if(can_see(src, target, get_dist(src, target)) && boss_throw_reaches(get_turf(src), get_turf(target))) return TRUE continue if(ability.worth_using(target)) @@ -542,7 +1025,7 @@ if(!aimable(target)) return FALSE var/distance = get_dist(owner, target) - return distance >= 2 && distance <= BOUNTY_DEMOLITIONIST_GRENADE_RANGE && can_see(owner, target, BOUNTY_DEMOLITIONIST_GRENADE_RANGE) && landing_ok(target) + return distance >= 2 && distance <= BOUNTY_DEMOLITIONIST_GRENADE_RANGE && can_see(owner, target, BOUNTY_DEMOLITIONIST_GRENADE_RANGE) && landing_ok(target) && throw_reaches(target) /datum/action/cooldown/mob_cooldown/bounty_boss/grenade/telegraph(atom/target) landing = get_turf(target) @@ -562,7 +1045,7 @@ 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)) + if(other != spot && !isclosedturf(other) && boss.boss_reach_ok(other) && boss.boss_throw_reaches(get_turf(owner), other)) near += other if(length(near)) addtimer(CALLBACK(src, PROC_REF(throw_grenade), pick(near)), 0.5 SECONDS, TIMER_DELETE_ME) @@ -571,7 +1054,8 @@ /datum/action/cooldown/mob_cooldown/bounty_boss/grenade/proc/throw_grenade(turf/spot) 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) + // Nor with glass or a door shut across the way since it aimed: it holds the grenade. + if(!istype(boss) || !boss.boss_can_act() || !spot || !throw_reaches(spot)) return boss.visible_message(span_danger("[boss] throws a grenade!")) new /obj/effect/temp_visual/bounty_boss_thrown(get_turf(boss), spot) @@ -789,6 +1273,7 @@ name = "hooded criminal" desc = "A lean criminal in a dark hooded cloak, a knife at the ready." boss_kit = BOUNTY_KIT_GHOST + npc_combat_sense = /datum/npc_combat_sense/bounty/boss/ghost // 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( @@ -817,9 +1302,21 @@ /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 +// Out where the air kills: a civilian MODsuit, hardly more armour than its hood and no slower /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) + return list(/obj/item/mod/control/pre_equipped/bounty_boss/civilian) + +/** + * The Ghost's answer to stun fire (C8): from beyond its dash, it breaks the shooter's line, running a few + * steps for cover (combat sense's cover, Slipwire dodging as it goes), and keeps down a moment, longer + * while winded; from cover it comes again with its dash once someone is in reach (the boss rules let a + * ready ability go first). Corner it. + */ +/datum/npc_combat_sense/bounty/boss/ghost + react_to_stun_fire = TRUE + close_in_reach = 0 + cover_steps = BOUNTY_GHOST_COVER_STEPS + cover_moves = BOUNTY_GHOST_COVER_MOVES // 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 @@ -1035,7 +1532,7 @@ /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." + desc = "A big criminal in an ablative coat, carrying a belt-fed gun." boss_kit = BOUNTY_KIT_HEAVY boss_ability_types = list( /datum/action/cooldown/mob_cooldown/bounty_boss/burst, @@ -1046,19 +1543,39 @@ return boss_supplies(bounty_outfit_instance(/datum/outfit/bounty_boss/heavy)) /mob/living/carbon/human/npc/bounty_criminal/boss/heavy/boss_gear_text() + if(istype(wear_suit, BOUNTY_HEAVY_COAT)) + return "[p_Their()] coat and hood are lined with reflective panels." 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 +// Out where the air kills: a magnate MODsuit (its coat and hood hold no pressure), with the coat's energy armour but no reflection /mob/living/carbon/human/npc/bounty_criminal/boss/heavy/bounty_sealed_gear() - return list(/obj/item/clothing/suit/space/syndicate/black, null) + return list(/obj/item/mod/control/pre_equipped/bounty_boss/magnate) +// Its rounds chip through a window or grille it may break, and fly over a gap +/mob/living/carbon/human/npc/bounty_criminal/boss/heavy/boss_goes_through(atom/barrier) + if(..()) + return TRUE + if(isturf(barrier)) + return !barrier.density + return (istype(barrier, /obj/structure/window) || istype(barrier, /obj/structure/grille)) && boss_may_break(barrier) + +// With its burst ready and a belt in its gun +/mob/living/carbon/human/npc/bounty_criminal/boss/heavy/boss_breaks_through_now(atom/barrier) + if(..()) + return TRUE + var/obj/item/gun/gun = boss_gun() + if(!gun?.can_shoot() || isnull(boss_ability_off_cooldown(/datum/action/cooldown/mob_cooldown/bounty_boss/burst))) + return FALSE + if(isturf(barrier)) + return !barrier.density + return (istype(barrier, /obj/structure/window) || istype(barrier, /obj/structure/grille)) && boss_may_break(barrier) // 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. +// A spare box rides in the bag; a barrier grenade in each pocket. The coat's hood goes up as it is put on +// (tg's hooded suits do that), so its own reflecting hood covers its head (C8). /datum/outfit/bounty_boss/heavy name = "Bounty mini-boss: Heavy" uniform = /obj/item/clothing/under/syndicate/combat - suit = /obj/item/clothing/suit/armor/swat - head = /obj/item/clothing/head/helmet/swat + suit = BOUNTY_HEAVY_COAT gloves = /obj/item/clothing/gloves/combat shoes = /obj/item/clothing/shoes/jackboots r_hand = BOUNTY_HEAVY_GUN diff --git a/voidcrew/modules/bounties/bounty_chrome.dm b/voidcrew/modules/bounties/bounty_chrome.dm new file mode 100644 index 00000000000..faf8dc603f3 --- /dev/null +++ b/voidcrew/modules/bounties/bounty_chrome.dm @@ -0,0 +1,1450 @@ +/** + * # Bounty hunting: chrome + * + * Owner: C0 chrome core. The pieces (C1-C4, voidcrew/modules/bounties/chrome/) and the cyberpsycho (C6) + * build on this file; the seams are listed in the port's SEAMS notes and in the doc comments below. + * + * Some criminals and their companions carry cyberware: the real implants players buy at a ripperdoc + * (voidcrew/modules/cyberware/), installed in their real body through the human NPC base's + * npc_cyberware (owner decision 5). Nothing here stands in for an implant. A Gorilla Arms carrier + * punches with the implant's own empowered punch, a Lazarus node jolts its bearer up by itself, an EMP + * reboots the chrome on its real timer, a brownout browns it out, and it all burns out to scrap when the + * NPC dies (the human NPC base, owner ruling). + * + * What this file adds, all of it AI or looks: + * - Who carries what (/datum/bounty_chrome_piece, GLOB.bounty_chrome_pieces): a roll when the record is + * made, by tier (bounty_chrome_roll()), and a rarer one for companions (bounty_chrome_roll_companion()). + * A roll never puts two implants in one organ slot and never goes over the body's capacity, kit chrome + * included, so nothing browns out. + * - The body (bounty_chrome_prepare(), bounty_chrome_equip()): the record's pieces become npc_cyberware + * before the base installs it, and carriers dress light enough that their worn chrome shows + * (bounty_chrome_expose_outfit()). A pressure suit or modsuit stays shut over it. + * - How the AI uses it (/datum/bounty_chrome_move, /datum/component/bounty_chrome): a tell everyone can + * see and hear, at least BOUNTY_CHROME_TELL_MIN long, then the implant's own action, Trigger()ed the + * way a player's click does. Downed, stunned, cuffed, killed or EMP'd during the tell, nothing fires. + * An area move never starts while someone outside the fight stands where it would land + * (bounty_chrome_area_clear()). Mini-bosses use their moves through their own ability rotation + * (/datum/action/cooldown/mob_cooldown/bounty_boss/chrome). + * - An EMP that knocks chrome out shows it: sparks, arcs and a flicker, as a picture only + * (bounty_chrome_malfunction_fx()). + * - A bounty NPC feels a chrome read and tells the reader off (COMSIG_CARBON_CHROME_READ). + */ + +// ===== THE PIECES ===== + +/// Every piece by key (BOUNTY_CHROME_*): built from the subtypes, so a piece needs no registry edit +GLOBAL_LIST_INIT(bounty_chrome_pieces, init_bounty_chrome_pieces()) + +/proc/init_bounty_chrome_pieces() + var/list/pieces = list() + for(var/datum/bounty_chrome_piece/piece_type as anything in subtypesof(/datum/bounty_chrome_piece)) + if(!initial(piece_type.key)) + continue + var/datum/bounty_chrome_piece/piece = new piece_type + pieces[piece.key] = piece + // The moves each piece drives: every /datum/bounty_chrome_move subtype names its piece by key + for(var/datum/bounty_chrome_move/move_type as anything in subtypesof(/datum/bounty_chrome_move)) + var/datum/bounty_chrome_piece/piece = pieces[initial(move_type.piece_key)] + piece?.move_types += move_type + return pieces + +/** + * The chrome a mini-boss kit (BOUNTY_KIT_*) already carries in its body, as organ typepaths: what a roll + * must fit around. It has to match the kit's own npc_cyberware (bounty_boss_kits.dm); a test spawns + * each kit and checks. + */ +/proc/bounty_chrome_kit_organs(kit) + switch(kit) + if(BOUNTY_KIT_GHOST) + return list(/obj/item/organ/cyberimp/cyberware/slipwire, /obj/item/organ/cyberimp/cyberware/cascade) + if(BOUNTY_KIT_CYBERPSYCHO) + return bounty_psycho_organs() + return list() + +/** + * One piece of chrome a criminal can carry: which real implants it is, and who can roll it. One + * subtype per key, below. The moves that drive it in a fight are /datum/bounty_chrome_move subtypes that + * name it by key (C1-C4), collected into move_types at start. + */ +/datum/bounty_chrome_piece + /// BOUNTY_CHROME_*; the subtype with no key is abstract + var/key + /// What admins see it called + var/name = "chrome" + /// Roll weight among the pieces that suit. 0 never rolls and isn't offered to admins. + var/weight = 10 + /// Lowest tier that rolls it (BOUNTY_TIER_*); a companion is checked against its criminal's tier + var/min_tier = BOUNTY_TIER_PETTY + /// The criminal archetypes that roll it (BOUNTY_ARCHETYPE_*). Never the meek: they run. + var/list/archetypes = list(BOUNTY_ARCHETYPE_NORMAL, BOUNTY_ARCHETYPE_BOSS) + /// Whether a companion can roll it + var/companion = TRUE + /// The fighting styles (BOUNTY_STYLE_*) that roll it, or null for any. Mini-bosses have no style. + var/list/styles + /// Only for styles that shoot (bounty_chrome_style_shoots()) + var/shooter = FALSE + /// The mini-boss kits (BOUNTY_KIT_*) that roll it, or null for any kit + var/list/kits + /// Keys it never rolls alongside (a design choice; organ slots are checked on their own) + var/list/exclusive_with + /// The real implant organs it is, as typepaths + var/list/organs + /// The /datum/bounty_chrome_move types that drive it, filled at start + var/list/move_types = list() + +/// Whether a new `archetype` fighter of `tier`, with `style` or `kit` and the keys `picked` so far, may roll it +/datum/bounty_chrome_piece/proc/can_roll(tier, archetype, style, kit, list/picked) + if(weight <= 0 || !tier || tier < min_tier) + return FALSE + if(archetype == BOUNTY_CHROME_COMPANION) + if(!companion) + return FALSE + else if(!(archetype in archetypes)) + return FALSE + if(archetype == BOUNTY_ARCHETYPE_BOSS) + if(kits && !(kit in kits)) + return FALSE + else + if(styles && !(style in styles)) + return FALSE + if(shooter && !bounty_chrome_style_shoots(style)) + return FALSE + for(var/other in picked) + if(other in exclusive_with) + return FALSE + var/datum/bounty_chrome_piece/other_piece = GLOB.bounty_chrome_pieces[other] + if(key in other_piece?.exclusive_with) + return FALSE + return TRUE + +/// A melee style this piece fights with when it has to change someone's style (an admin's pick), or null if any style will do +/datum/bounty_chrome_piece/proc/fitting_style(style) + if(!styles || (style in styles)) + return null + return styles[1] + +/// Whether fighting style `style` (BOUNTY_STYLE_*) shoots a gun +/proc/bounty_chrome_style_shoots(style) + var/datum/bounty_style/fighting_style = GLOB.bounty_styles[style] + return !!fighting_style?.ranged && ispath(fighting_style.weapon_type, /obj/item/gun) + +/datum/bounty_chrome_piece/cascade + key = BOUNTY_CHROME_CASCADE + name = "Cascade lattice" + // A legend piece: rare, and only on the dangerous + weight = 6 + min_tier = BOUNTY_TIER_WANTED + // The Ghost carries its own; the Heavy's whole fight is being slow and flanked + kits = list(BOUNTY_KIT_JUGGERNAUT, BOUNTY_KIT_PYROMANIAC, BOUNTY_KIT_DEMOLITIONIST) + organs = list(/obj/item/organ/cyberimp/cyberware/cascade) + +/datum/bounty_chrome_piece/redline + key = BOUNTY_CHROME_REDLINE + name = "Redline core" + weight = 6 + min_tier = BOUNTY_TIER_WANTED + // Not on the Juggernaut's riot plates or the Heavy's armour + kits = list(BOUNTY_KIT_PYROMANIAC, BOUNTY_KIT_DEMOLITIONIST, BOUNTY_KIT_GHOST) + organs = list(/obj/item/organ/cyberimp/cyberware/redline) + +/datum/bounty_chrome_piece/piledriver + key = BOUNTY_CHROME_PILEDRIVER + name = "Meteor Piledriver" + // The rarest: Wanted or worse, never a companion + weight = 4 + min_tier = BOUNTY_TIER_WANTED + companion = FALSE + // Of the mini-bosses only the Pyromaniac: the others already charge, dash or fight from range + kits = list(BOUNTY_KIT_PYROMANIAC) + // Two gap-closers that knock people down would be one too many + exclusive_with = list(BOUNTY_CHROME_MANTIS) + organs = list(/obj/item/organ/cyberimp/cyberware/piledriver) + +/datum/bounty_chrome_piece/gorilla + key = BOUNTY_CHROME_GORILLA + name = "Gorilla Arms" + weight = 12 + // The implant powers a bare-handed punch: brawlers only. Never a mini-boss: the Juggernaut's shield fills a hand, so its grab never fires + styles = list(BOUNTY_STYLE_BRAWLER) + archetypes = list(BOUNTY_ARCHETYPE_NORMAL) + organs = list( + /obj/item/organ/cyberimp/cyberware/gorilla_arms, + /obj/item/organ/cyberimp/cyberware/gorilla_arms/left, + ) + +/datum/bounty_chrome_piece/mantis + key = BOUNTY_CHROME_MANTIS + name = "Mantis Blades" + weight = 10 + // Fighters who close in. Never a mini-boss: the Juggernaut's charge and the Ghost's dash already close the gap. + archetypes = list(BOUNTY_ARCHETYPE_NORMAL) + styles = list(BOUNTY_STYLE_BRAWLER, BOUNTY_STYLE_KNIFE, BOUNTY_STYLE_CLUB) + exclusive_with = list(BOUNTY_CHROME_PILEDRIVER) + organs = list( + /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/left, + ) + +/datum/bounty_chrome_piece/lazarus + key = BOUNTY_CHROME_LAZARUS + name = "Lazarus node" + // A second round in one fight is a lot. Never a companion: putting one down has to stay the answer to every companion. + weight = 8 + min_tier = BOUNTY_TIER_WANTED + companion = FALSE + organs = list(/obj/item/organ/cyberimp/cyberware/lazarus) + +/datum/bounty_chrome_piece/deadeye + key = BOUNTY_CHROME_DEADEYE + name = "Deadeye link" + weight = 12 + // It walks rounds onto a mark: only for those who shoot + archetypes = list(BOUNTY_ARCHETYPE_NORMAL) + shooter = TRUE + organs = list(/obj/item/organ/eyes/robotic/cyberware/deadeye) + +// ===== WHAT AN IMPLANT TAKES ===== + +/// Organ type -> list("slot", "zone", "load", "bonus", "shows"), read off the type once +GLOBAL_LIST_EMPTY(bounty_chrome_organ_facts) + +/** + * What an organ type takes in a body, read off the type (no copy is made, so it works at any time): + * its organ slot and zone, the neural load and capacity bonus it brings (cyberware_component.dm), and + * whether it shows on the body as worn chrome (an aug_overlay). + */ +/proc/bounty_chrome_organ_facts(organ_type) + var/list/facts = GLOB.bounty_chrome_organ_facts[organ_type] + if(facts) + return facts + if(!ispath(organ_type, /obj/item/organ)) + return null + var/obj/item/organ/organ = organ_type + var/load = 0 + var/bonus = 0 + var/shows = FALSE + if(ispath(organ_type, /obj/item/organ/cyberimp/cyberware)) + var/obj/item/organ/cyberimp/cyberware/ware = organ_type + load = initial(ware.chrome_load) + bonus = initial(ware.chrome_capacity_bonus) + else if(ispath(organ_type, /obj/item/organ/cyberimp/arm/toolkit/cyberware)) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/arm_ware = organ_type + load = initial(arm_ware.chrome_load) + bonus = initial(arm_ware.chrome_capacity_bonus) + else if(ispath(organ_type, /obj/item/organ/eyes/robotic/cyberware)) + var/obj/item/organ/eyes/robotic/cyberware/optics = organ_type + load = initial(optics.chrome_load) + bonus = initial(optics.chrome_capacity_bonus) + else if(ispath(organ_type, /obj/item/organ/cyberimp) || (initial(organ.organ_flags) & ORGAN_ROBOTIC)) + // Robotic hardware that isn't chrome costs the body's flat rate (get_installed_capacity_cost()) + load = GLOB.installed_capacity_costs["robotic_organ"] + if(ispath(organ_type, /obj/item/organ/cyberimp)) + var/obj/item/organ/cyberimp/implant = organ_type + shows = !!initial(implant.aug_overlay) + facts = list("slot" = initial(organ.slot), "zone" = initial(organ.zone), "load" = load, "bonus" = bonus, "shows" = shows) + GLOB.bounty_chrome_organ_facts[organ_type] = facts + return facts + +/// Whether the organ types `organ_types` can all be in one body at once: one per organ slot, and no more load than the body's capacity (CYBERWARE_BASE_CAPACITY plus any Governor), so nothing browns out +/proc/bounty_chrome_organs_fit(list/organ_types) + var/list/slots = list() + var/load = 0 + var/capacity = CYBERWARE_BASE_CAPACITY + for(var/organ_type in organ_types) + var/list/facts = bounty_chrome_organ_facts(organ_type) + if(!facts) + return FALSE + var/slot = facts["slot"] + if(slot) + if(slots[slot]) + return FALSE + slots[slot] = TRUE + load += facts["load"] + capacity += facts["bonus"] + return load <= capacity + +/// The organ typepaths of the pieces `keys`, in order +/proc/bounty_chrome_organ_types(list/keys) + . = list() + for(var/key in keys) + var/datum/bounty_chrome_piece/piece = GLOB.bounty_chrome_pieces[key] + if(piece) + . += piece.organs + +/** + * The keys of `keys` that go in together on top of `existing_organs` (typepaths already bound for the + * body: a kit's own chrome), in order: a piece that would share an organ slot or take the body over its + * capacity is left out, and so is an unknown key or one listed twice. + */ +/proc/bounty_chrome_fit_keys(list/keys, list/existing_organs) + . = list() + var/list/organs = existing_organs ? existing_organs.Copy() : list() + for(var/key in keys) + var/datum/bounty_chrome_piece/piece = GLOB.bounty_chrome_pieces[key] + if(!piece || (key in .)) + continue + if(!bounty_chrome_organs_fit(organs + piece.organs)) + continue + organs += piece.organs + . += key + +// ===== ROLLING ===== + +/// Percent chance a criminal of `tier` carries chrome +/proc/bounty_chrome_tier_chance(tier) + switch(tier) + if(BOUNTY_TIER_MOST_WANTED) + return BOUNTY_CHROME_CHANCE_MOST_WANTED + if(BOUNTY_TIER_WANTED) + return BOUNTY_CHROME_CHANCE_WANTED + return BOUNTY_CHROME_CHANCE_PETTY + +/** + * The chrome keys a new criminal carries, or null for none: a roll by tier, then one piece (two, now and + * then, from Wanted up), weighted among the pieces that suit its archetype, style and kit and that fit in + * its body on top of `existing_organs` (its kit's own chrome, bounty_chrome_kit_organs()). The meek + * never carry any. Doesn't sleep. + */ +/proc/bounty_chrome_roll(tier, archetype, style, kit, list/existing_organs) + if(archetype != BOUNTY_ARCHETYPE_NORMAL && archetype != BOUNTY_ARCHETYPE_BOSS) + return null + if(!prob(bounty_chrome_tier_chance(tier))) + return null + var/count = (tier >= BOUNTY_TIER_WANTED && prob(BOUNTY_CHROME_SECOND_CHANCE)) ? 2 : 1 + return bounty_chrome_pick(count, tier, archetype, style, kit, existing_organs) + +/** + * The chrome a new companion of a `tier` criminal carries as a list of one key, or null: rarer than its + * criminal's, one piece at most, never Lazarus or the Piledriver. `style` is the companion's own. + * Companions call this as they are dressed (C4); see bounty_chrome_prepare_body(). + */ +/proc/bounty_chrome_roll_companion(tier, style) + if(!prob(bounty_chrome_tier_chance(tier) / BOUNTY_CHROME_COMPANION_DIVISOR)) + return null + return bounty_chrome_pick(1, tier, BOUNTY_CHROME_COMPANION, style, null, null) + +/// Up to `count` different keys, weighted, among the pieces that suit and fit together on top of `existing_organs`. Null if none do. +/proc/bounty_chrome_pick(count, tier, archetype, style, kit, list/existing_organs) + var/list/picked = list() + var/list/organs = existing_organs ? existing_organs.Copy() : list() + for(var/i in 1 to count) + var/list/weights = list() + for(var/key in GLOB.bounty_chrome_pieces) + var/datum/bounty_chrome_piece/piece = GLOB.bounty_chrome_pieces[key] + if((key in picked) || !piece.can_roll(tier, archetype, style, kit, picked)) + continue + if(!bounty_chrome_organs_fit(organs + piece.organs)) + continue + weights[key] = piece.weight + if(!length(weights)) + break + var/key = pick_weight(weights) + picked += key + var/datum/bounty_chrome_piece/chosen = GLOB.bounty_chrome_pieces[key] + organs += chosen.organs + return length(picked) ? picked : null + +/** + * The most pieces that fit in one body on top of `existing_organs`, whatever they would normally roll + * for, for the Bounty Panel's "All of it": the largest set, then the one with the most chrome in it. The + * cyberpsycho (C6) replaces this choice with its own kit. + */ +/proc/bounty_chrome_all_that_fits(list/existing_organs) + var/list/keys = list() + for(var/key in GLOB.bounty_chrome_pieces) + var/datum/bounty_chrome_piece/piece = GLOB.bounty_chrome_pieces[key] + if(piece.weight > 0) + keys += key + var/list/best = list() + var/best_load = -1 + var/combinations = 1 << length(keys) + for(var/mask in 1 to combinations - 1) + var/list/chosen = list() + for(var/i in 1 to length(keys)) + if(mask & (1 << (i - 1))) + chosen += keys[i] + if(length(chosen) < length(best)) + continue + var/list/organs = (existing_organs ? existing_organs.Copy() : list()) + bounty_chrome_organ_types(chosen) + if(!bounty_chrome_organs_fit(organs)) + continue + var/load = 0 + for(var/organ_type in bounty_chrome_organ_types(chosen)) + var/list/facts = bounty_chrome_organ_facts(organ_type) + load += facts["load"] + if(length(chosen) > length(best) || load > best_load) + best = chosen + best_load = load + return best + +/** + * Puts a normal criminal's record on a style its chrome fights with, for chrome it was given rather + * than rolled (an admin's pick): Gorilla Arms and Mantis Blades never come with a gun or a bottle. Rolled + * chrome already suits its style. Returns TRUE if the style changed. + */ +/proc/bounty_chrome_fit_style(datum/bounty_record/record) + if(!record || record.archetype != BOUNTY_ARCHETYPE_NORMAL) + return FALSE + for(var/key in record.chrome) + var/datum/bounty_chrome_piece/piece = GLOB.bounty_chrome_pieces[key] + var/new_style = piece?.fitting_style(record.style) + if(new_style) + record.style = new_style + return TRUE + return FALSE + +// ===== THE BODY ===== + +/// Whether `npc` is a bounty human whose record's chrome goes in its body: a normal criminal or a mini-boss. Never the meek, a decoy (it copies its fugitive's organs, body_match()) or the kingpin. +/proc/bounty_chrome_carrier(mob/living/carbon/human/npc/npc) + return istype(npc, /mob/living/carbon/human/npc/bounty_criminal/normal) || istype(npc, /mob/living/carbon/human/npc/bounty_criminal/boss) + +/** + * Before `npc`'s body is built: the organs of the pieces `keys` that fit on top of what it already + * carries go into its npc_cyberware, which the human NPC base installs once it is dressed (so its outfit + * can be cut to show them, bounty_chrome_expose_outfit()). Returns the keys that went in. + */ +/proc/bounty_chrome_prepare_body(mob/living/carbon/human/npc/npc, list/keys) + if(!ishumannpc(npc) || !length(keys)) + return list() + var/list/existing = npc.npc_cyberware ? npc.npc_cyberware.Copy() : list() + var/list/fitted = bounty_chrome_fit_keys(keys, existing) + if(length(fitted)) + npc.npc_cyberware = existing + bounty_chrome_organ_types(fitted) + return fitted + +/** + * A criminal's Initialize(), before the body is built: its record's chrome becomes npc_cyberware. What + * doesn't fit (an admin's pick that clashes with a kit's chrome) comes off the record, so the record + * stays the truth about the criminal. + */ +/proc/bounty_chrome_prepare(mob/living/carbon/human/npc/bounty_criminal/criminal) + if(!bounty_chrome_carrier(criminal) || !length(criminal.record?.chrome)) + return + var/list/fitted = bounty_chrome_prepare_body(criminal, criminal.record.chrome) + criminal.record.chrome = length(fitted) ? fitted : null + +/// A criminal's Initialize(), once its body is built: its chrome is watched for EMPs, and a carrier gets its moves +/proc/bounty_chrome_ready(mob/living/carbon/human/npc/bounty_criminal/criminal) + // Every criminal, decoys included: a decoy carries its fugitive's chrome and must spark the same way + criminal.AddElement(/datum/element/bounty_chrome_body) + if(bounty_chrome_carrier(criminal) && length(criminal.record?.chrome)) + bounty_chrome_equip(criminal, criminal.record.chrome) + +/** + * Once the chrome `keys` are in `npc`'s body: the AI side of it (the component and the moves of each + * piece), the EMP look, and for a mini-boss one ability in its rotation per move. Adds to chrome it + * has. Returns the component, or null for no keys. + */ +/proc/bounty_chrome_equip(mob/living/carbon/human/npc/npc, list/keys) + if(!ishumannpc(npc) || QDELETED(npc) || !length(keys)) + return null + npc.AddElement(/datum/element/bounty_chrome_body) + return npc.AddComponent(/datum/component/bounty_chrome, keys) + +/** + * Installs the pieces `keys` in `npc`'s live body now, real organs through the base's + * npc_install_cyberware(), as many as fit with what it already has in it, then equips them. For tests and + * admins with a body already built; a spawn goes through bounty_chrome_prepare_body(). Returns the keys + * that went in. + */ +/proc/bounty_chrome_install_now(mob/living/carbon/human/npc/npc, list/keys) + . = list() + if(!ishumannpc(npc) || QDELETED(npc)) + return + var/list/installed = list() + for(var/obj/item/organ/organ in npc.organs) + if(organ.GetComponent(/datum/component/cyberware)) + installed += organ.type + for(var/key in bounty_chrome_fit_keys(keys, installed)) + var/datum/bounty_chrome_piece/piece = GLOB.bounty_chrome_pieces[key] + for(var/organ_type in piece.organs) + npc.npc_install_cyberware(organ_type) + . += key + if(length(.)) + bounty_chrome_equip(npc, .) + +// A criminal or companion built with chrome that takes the place of an organ it was born with (a Deadeye +// link its eyes): the old organ goes, as tg's own regenerate_organs() does it, instead of the base's Insert() +// dropping it at its feet, a pair of loose eyes on the floor. Decoys copying their fugitive's chrome +// (body_match()) come through here too. +/mob/living/carbon/human/npc/bounty_criminal/npc_install_cyberware(ware_type) + bounty_chrome_clear_natural_slot(src, ware_type) + return ..() + +/mob/living/carbon/human/npc/bounty_companion/npc_install_cyberware(ware_type) + bounty_chrome_clear_natural_slot(src, ware_type) + return ..() + +/// Takes out and deletes the organ (never chrome) in the slot chrome of `ware_type` is about to fill in `npc` +/proc/bounty_chrome_clear_natural_slot(mob/living/carbon/human/npc/npc, ware_type) + var/list/facts = bounty_chrome_organ_facts(ware_type) + var/slot = facts?["slot"] + if(!slot) + return + var/obj/item/organ/born_with = npc.get_organ_slot(slot) + if(!born_with || born_with.GetComponent(/datum/component/cyberware)) + return + born_with.Remove(npc, special = TRUE) + qdel(born_with) + +// ===== DRESSED TO SHOW IT ===== + +/// Where the worn chrome in `organ_types` shows on a body: list("arms", "chest", "legs") of TRUE/FALSE, or null if it shows nowhere +/proc/bounty_chrome_shows(list/organ_types) + var/arms = FALSE + var/chest = FALSE + var/legs = FALSE + for(var/organ_type in organ_types) + var/list/facts = bounty_chrome_organ_facts(organ_type) + if(!facts?["shows"]) + continue + switch(facts["zone"]) + if(BODY_ZONE_R_ARM, BODY_ZONE_L_ARM) + arms = TRUE + if(BODY_ZONE_CHEST) + chest = TRUE + if(BODY_ZONE_R_LEG, BODY_ZONE_L_LEG) + legs = TRUE + if(!arms && !chest && !legs) + return null + return list("arms" = arms, "chest" = chest, "legs" = legs) + +/// Whether its clothes are cut to show the chrome it carries (bounty_chrome_expose_outfit(), from the bounty outfit table): yes, but for a mini-boss, whose kit is its look. The cyberpsycho (C6) may say yes. +/mob/living/carbon/human/npc/proc/bounty_dresses_to_show_chrome() + return !istype(src, /mob/living/carbon/human/npc/bounty_criminal/boss) + +/** + * `outfit` (a typepath or an instance) cut so the worn chrome in `organ_types` shows, as an instance + * (an instance passed in is changed in place). Worn chrome draws over the jumpsuit and under everything + * else (CYBERWARE_WORN_LAYER), so the jumpsuit stays and only what covers it goes: no coat over chest or + * arm chrome, no gloves over arm chrome. Armour stays on: a vest is the tier's toughness. A pressure suit + * or a modsuit stays shut, and so does everything under it. Chrome that doesn't show changes nothing. The + * site's layers (a space suit, cold-weather wear) go on afterwards, over it, as they would on anyone. + */ +/proc/bounty_chrome_expose_outfit(outfit, list/organ_types) + var/list/shows = bounty_chrome_shows(organ_types) + if(!shows) + return outfit + var/datum/outfit/dressed = ispath(outfit, /datum/outfit) ? new outfit() : outfit + if(!istype(dressed)) + return outfit + var/obj/item/clothing/suit = dressed.suit + if((ispath(suit, /obj/item/clothing) && (initial(suit.clothing_flags) & STOPSPRESSUREDAMAGE)) || ispath(dressed.back, /obj/item/mod/control)) + return dressed + var/arms = shows["arms"] + var/chest = shows["chest"] + if((arms || chest) && dressed.suit && !ispath(dressed.suit, /obj/item/clothing/suit/armor)) + // What the coat carried goes in the bag; with no bag the coat stays, it holds their gun + if(dressed.suit_store && dressed.back) + LAZYADDASSOC(dressed.backpack_contents, dressed.suit_store, 1) + dressed.suit_store = null + if(!dressed.suit_store) + dressed.suit = null + if(arms) + dressed.gloves = null + return dressed + +/** + * Bares the worn chrome in `npc`'s live body, as bounty_chrome_expose_outfit() does for an outfit: the + * coat and gloves over it come off. What comes off is deleted (it was locked gear, D3). A pressure suit + * or a modsuit stays shut. For a fugitive whose act drops (bounty_outpost.dm). + * Returns TRUE if anything came off. Doesn't sleep. + */ +/proc/bounty_chrome_bare(mob/living/carbon/human/npc/npc) + if(!ishumannpc(npc) || QDELETED(npc)) + return FALSE + var/list/installed = list() + for(var/obj/item/organ/organ in npc.organs) + if(organ.GetComponent(/datum/component/cyberware)) + installed += organ.type + var/list/shows = bounty_chrome_shows(installed) + if(!shows) + return FALSE + var/obj/item/clothing/suit = npc.wear_suit + if((istype(suit) && (suit.clothing_flags & STOPSPRESSUREDAMAGE)) || istype(npc.back, /obj/item/mod/control)) + return FALSE + var/arms = shows["arms"] + var/chest = shows["chest"] + var/coat_name + . = FALSE + if((arms || chest) && suit && !istype(suit, /obj/item/clothing/suit/armor) && !npc.s_store) + coat_name = "[suit.name]" + npc.temporarilyRemoveItemFromInventory(suit, force = TRUE) + qdel(suit) + . = TRUE + if(arms && npc.gloves) + var/obj/item/hand_wear = npc.gloves + npc.temporarilyRemoveItemFromInventory(hand_wear, force = TRUE) + qdel(hand_wear) + . = TRUE + if(coat_name) + npc.visible_message(span_warning("[npc] shrugs off the [coat_name].")) + +// ===== IN A FIGHT ===== + +/** + * Whether `npc` can use its chrome now: awake, on its feet and on a turf, out of crit, not cuffed, + * stunned or knocked down, not giving up, not hiding or passing as a patron, and not driven by a + * player. All read from tg. + */ +/proc/bounty_chrome_can_act(mob/living/carbon/human/npc/npc) + if(!ishumannpc(npc) || QDELETED(npc) || npc.stat != CONSCIOUS || !isturf(npc.loc) || npc.client) + return FALSE + if(HAS_TRAIT(npc, TRAIT_CRITICAL_CONDITION) || HAS_TRAIT(npc, TRAIT_RESTRAINED) || HAS_TRAIT(npc, TRAIT_INCAPACITATED) || HAS_TRAIT(npc, TRAIT_FLOORED)) + return FALSE + if(npc.npc_surrendering) + return FALSE + var/mob/living/carbon/human/npc/bounty_criminal/criminal = npc + if(istype(criminal) && (criminal.hidden || criminal.blended)) + return FALSE + return TRUE + +/// Whether `npc` is in a fight, by its AI's mode: a criminal fighting, a companion in it, a mini-boss turned hostile. Its state (stuns and the like) is bounty_chrome_can_act()'s. +/proc/bounty_chrome_in_fight(mob/living/carbon/human/npc/npc) + if(QDELETED(npc) || npc.stat == DEAD) + return FALSE + if(istype(npc, /mob/living/carbon/human/npc/bounty_criminal/boss)) + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = npc + return boss.boss_hostile + if(istype(npc, /mob/living/carbon/human/npc/bounty_criminal)) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = npc + return criminal.ai_mode == BOUNTY_AI_FIGHTING + if(istype(npc, /mob/living/carbon/human/npc/bounty_companion)) + var/mob/living/carbon/human/npc/bounty_companion/companion = npc + return companion.ai_in_fight + return FALSE + +/// Who `npc` is going for now (a person, or a mech), or null +/proc/bounty_chrome_target(mob/living/carbon/human/npc/npc) + var/datum/ai_controller/controller = npc?.ai_controller + if(QDELETED(controller)) + return null + var/atom/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET] || controller.blackboard[BB_BOUNTY_BOSS_PREY] + return QDELETED(target) ? null : target + +/** + * The first action of `action_type` on chrome in `npc` (its implants' own buttons), preferring one + * that can be used now, or null. + */ +/proc/bounty_chrome_action(mob/living/carbon/human/npc/npc, action_type) + if(!ispath(action_type, /datum/action) || QDELETED(npc)) + return null + var/datum/action/found + for(var/obj/item/organ/organ in npc.organs) + if(!organ.GetComponent(/datum/component/cyberware)) + continue + for(var/datum/action/action as anything in organ.actions) + if(!istype(action, action_type) || action.owner != npc) + continue + if(action.IsAvailable()) + return action + found ||= action + return found + +/** + * Fires `npc`'s implant action of `action_type` the way a player's click does: Trigger(), aimed at + * `target` for an action that is clicked onto something. Only an action that can be used now. Returns + * TRUE if it fired. + */ +/proc/bounty_chrome_trigger(mob/living/carbon/human/npc/npc, action_type, atom/target) + var/datum/action/action = bounty_chrome_action(npc, action_type) + if(!action || !action.IsAvailable()) + return FALSE + var/datum/action/cooldown/cooldown_action = action + if(istype(cooldown_action) && cooldown_action.click_to_activate) + if(QDELETED(target)) + return FALSE + return !!action.Trigger(target = target) + return !!action.Trigger() + +// ===== WHO AN AREA MOVE MAY CATCH ===== + +/** + * Whether `person` is in `npc`'s fight, so an area move may catch them: the one it is going for or + * `aimed` at, or a hunter after it. That is someone its side holds a grudge against (they attacked, + * confronted or cuffed it or a companion), in a mini-boss's posse, or crewing a ship hunting its + * bounty. Its own side never is, and nor is anyone else on the site. + */ +/proc/bounty_chrome_in_posse(mob/living/carbon/human/npc/npc, mob/living/person, atom/aimed) + if(QDELETED(npc) || !isliving(person) || person == npc || bounty_ai_same_gang(npc, person)) + return FALSE + for(var/atom/target in list(bounty_chrome_target(npc), aimed)) + if(target == person || (ismecha(target) && person.loc == target)) + return TRUE + var/mob/living/carbon/human/npc/bounty_criminal/side = bounty_ai_side_of(npc) + if(QDELETED(side)) + return FALSE + if(side.body_has_grudge(person)) + return TRUE + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = side + if(istype(boss) && boss.boss_engaged[REF(person)]) + return TRUE + if(!person.mind) + return FALSE + var/datum/criminal_bounty/posting = side.posting() + for(var/obj/structure/overmap/ship/ship as anything in posting?.hunter_ships()) + if(person.mind in ship.ship_team?.members) + return TRUE + // A crewmate of anyone in the fight is in it too: a crew can't keep the area moves off by standing an idle friend beside the shooter + for(var/atom/target in list(bounty_chrome_target(npc), aimed)) + if(bounty_chrome_crewmates(person, target)) + return TRUE + for(var/datum/weakref/enemy_ref as anything in side.grudge) + if(bounty_chrome_crewmates(person, enemy_ref?.resolve())) + return TRUE + return FALSE + +/// Whether `person` and `other` (a person, or a mech with one in it) crew the same ship +/proc/bounty_chrome_crewmates(mob/living/person, atom/other) + var/mob/living/other_person = ismecha(other) ? bounty_ai_pilot_of(other) : other + if(!isliving(other_person) || other_person == person || !LAZYLEN(person?.mind?.ship_teams) || !LAZYLEN(other_person.mind?.ship_teams)) + return FALSE + for(var/datum/team/voidcrew/crew as anything in person.mind.ship_teams) + if(crew in other_person.mind.ship_teams) + return TRUE + return FALSE + +/** + * Whether `npc` may start an area move over `turfs` (owner decision 5): nobody stands there who is + * outside its fight. Its own side and the site's people count as outside it (it doesn't land on its + * friends); the dead and creatures with nobody behind them (site fauna) don't count. The implant itself + * is never changed: once it fires it hits whoever is there, as it would for a player. + */ +/proc/bounty_chrome_area_clear(mob/living/carbon/human/npc/npc, list/turfs, atom/aimed, ignore_faction = FALSE) + if(QDELETED(npc)) + return FALSE + for(var/turf/spot as anything in turfs) + if(!isturf(spot)) + continue + for(var/mob/living/person in spot) + if(person == npc || person.stat == DEAD) + continue + // A move that spares its own side (the Redline roar) doesn't wait on its own companions + if(ignore_faction && bounty_ai_same_gang(npc, person)) + continue + if(!bounty_chrome_in_posse(npc, person, aimed) && bounty_chrome_counts_as_bystander(npc, person)) + return FALSE + for(var/obj/vehicle/sealed/mecha/mech in spot) + for(var/mob/living/pilot in mech.occupants) + if(!bounty_chrome_in_posse(npc, pilot, aimed) && bounty_chrome_counts_as_bystander(npc, pilot)) + return FALSE + return TRUE + +/// Whether `person`, not in `npc`'s fight, keeps an area move from starting: anyone with a player behind them, any person, and anyone on its side. Not a creature with nobody behind it. +/proc/bounty_chrome_counts_as_bystander(mob/living/carbon/human/npc/npc, mob/living/person) + if(person.mind || person.client || ishuman(person)) + return TRUE + return bounty_ai_same_gang(npc, person) || npc.faction_check_atom(person) + +// ===== MOVES ===== + +/** + * # A chrome move + * + * One thing an NPC's AI does with one piece of chrome: a tell, then the implant's own action. C1-C4 + * subtype it, one subtype per move, naming the piece by `piece_key`; nothing else registers it. Each + * NPC carrying the piece gets its own instance (/datum/component/bounty_chrome), so cooldowns are its + * own. + * + * How a normal criminal or a companion uses one (the bounty_chrome planning subtree): while it is in a + * fight and can act, plan() first (a move that queues behaviours of its own, a grab, returns TRUE), then + * a move whose can_start() passes starts: it stands still (tell_holds_still), its AI goes quiet, and + * tell() shows the outline, plays the sound and says the line. After tell_time (never under + * BOUNTY_CHROME_TELL_MIN) fire() runs effect(), which Trigger()s the implant's action. Downed, stunned, + * knocked down, cuffed, EMP'd or killed during the tell: cancel() and nothing fires. A mini-boss runs the + * same tell() and effect() through its ability rotation instead. + * + * The hooks below are called for every move of the NPC, in a fight or not. None may sleep. + */ +/datum/bounty_chrome_move + /// The BOUNTY_CHROME_* key of the piece this move drives; null for an abstract type + var/piece_key + /// What it is called (admins, the mini-boss's ability) + var/name = "chrome" + /// The implant action it fires (a /datum/action subtype on the piece's organs), or null for a move that fires nothing by itself + var/action_type + /// How long its tell lasts. Never under BOUNTY_CHROME_TELL_MIN. + var/tell_time = BOUNTY_CHROME_TELL_MIN + /// It stands still through the tell (TRAIT_IMMOBILIZED, as a mini-boss winding up does) + var/tell_holds_still = TRUE + /// Its AI carries on through the tell (drawing, shooting, moving) instead of going quiet: a tell that is only a look, a gunman's Deadeye lock. Interrupts still cut it short. + var/tell_keeps_acting = FALSE + /// The outline it glows with through the tell + var/tell_color = BOUNTY_CHROME_TELL_COLOR + /// The sound at the start of the tell + var/tell_sound = 'sound/effects/seedling_chargeup.ogg' + /// Lines it may say as the tell starts (short, in character), or null + var/list/tell_lines + /// It catches everyone in an area: it never starts while someone outside the fight stands in area_turfs() + var/area_move = FALSE + /// Furthest a target may be for it to start, in tiles + var/max_range = BOUNTY_FIGHT_VISION + /// Nearest a target may be for it to start, in tiles + var/min_range = 0 + /// How long after it fires before the NPC starts another chrome move (at least BOUNTY_CHROME_MOVE_GAP) + var/recover_time = BOUNTY_CHROME_MOVE_GAP + /// A mini-boss gets it as an ability in its rotation (a tell-then-fire move); a move that only plans behaviours sets FALSE + var/boss_usable = TRUE + /// The NPC it is in + var/mob/living/carbon/human/npc/owner + /// The mini-boss ability wrapping it, if its owner is a mini-boss + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/boss_ability + /// world.time it last fired, 0 if never + var/last_fired = 0 + /// Weakrefs to the marks it put down for its tell, removed when the tell ends + var/list/marks + +/datum/bounty_chrome_move/Destroy() + clear_tell() + if(boss_ability) + boss_ability.move = null + boss_ability = null + owner = null + return ..() + +/// Goes into `npc`. Subtypes register what they need here; call parent first. +/datum/bounty_chrome_move/proc/attach(mob/living/carbon/human/npc/npc) + owner = npc + +/// Comes out of its NPC, which may be being deleted. Undo what attach() and the fight did; call parent last. +/datum/bounty_chrome_move/proc/detach() + clear_tell() + owner = null + +/// Whether its implant can be used now: the action is there, its chrome running and off cooldown (an action-less move is always ready) +/datum/bounty_chrome_move/proc/ready() + if(!action_type) + return TRUE + var/datum/action/action = bounty_chrome_action(owner, action_type) + return !!action?.IsAvailable() + +/** + * Whether it should start on `target` now: its owner can act, the target is someone it may hit, in + * sight and in range, the implant is ready, and for an area move nobody outside the fight stands where + * it lands. Subtypes add their own reasons and call parent. + */ +/datum/bounty_chrome_move/proc/can_start(atom/target) + if(!bounty_chrome_can_act(owner) || QDELETED(target) || !bounty_ai_may_hit(owner, target)) + return FALSE + var/distance = bounty_ai_dist(owner, target) + if(distance > max_range || distance < min_range || !bounty_ai_can_see(owner, target, max_range)) + return FALSE + if(!ready()) + return FALSE + if(area_move && !area_clear(target)) + return FALSE + return TRUE + +/// Whether nobody outside the fight stands where it would land on `target` (the bystander gate). A move whose implant spares its own side overrides it. +/datum/bounty_chrome_move/proc/area_clear(atom/target) + return bounty_chrome_area_clear(owner, area_turfs(target), target) + +/// The turfs it would catch if it fired on `target` now, for the bystander gate. Area moves override it. +/datum/bounty_chrome_move/proc/area_turfs(atom/target) + return list() + +/// What its action is clicked on (a click-to-activate action): `target`, or for a leap the turf to land on +/datum/bounty_chrome_move/proc/trigger_target(atom/target) + return target + +/** + * The tell on `target`: an outline on its owner, the sound, a line. Subtypes add marks (add_mark()) and + * call parent. Doesn't sleep. + */ +/datum/bounty_chrome_move/proc/tell(atom/target) + if(QDELETED(owner)) + return + owner.add_filter(tell_filter(), 2, outline_filter(1, tell_color)) + var/outline = owner.get_filter(tell_filter()) + if(outline) + // A pulse, faint to full: the colour's own alpha, as filters have no alpha of their own + animate(outline, color = "[tell_color]40", time = 0.15 SECONDS, loop = -1) + animate(color = "[tell_color]ff", time = 0.15 SECONDS) + if(tell_sound) + playsound(owner, tell_sound, 60, TRUE) + var/text = tell_text(target) + if(text) + owner.visible_message(span_danger(text)) + if(length(tell_lines)) + INVOKE_ASYNC(src, PROC_REF(say_line), pick(tell_lines)) + +/// What onlookers see as the tell starts, or null. Plain, in the world: "[owner]'s spine lights up." +/datum/bounty_chrome_move/proc/tell_text(atom/target) + return null + +/// Its owner says `line`. Sleeps (say()). +/datum/bounty_chrome_move/proc/say_line(line) + if(!QDELETED(owner) && owner.stat == CONSCIOUS) + owner.say(line, forced = "bounty chrome tell") + +/// The outline's filter name, its own per move +/datum/bounty_chrome_move/proc/tell_filter() + return "bounty_chrome_tell_[REF(src)]" + +/// Keeps `thing` (a mark on the floor) until the tell ends +/datum/bounty_chrome_move/proc/add_mark(datum/thing) + if(thing) + LAZYADD(marks, WEAKREF(thing)) + return thing + +/// Ends the tell's look: the outline and the marks go +/datum/bounty_chrome_move/proc/clear_tell() + if(!QDELETED(owner)) + owner.remove_filter(tell_filter()) + for(var/datum/weakref/mark_ref as anything in marks) + var/datum/thing = mark_ref.resolve() + if(!QDELETED(thing)) + qdel(thing) + marks = null + +/// The tell is over: it fires on `target` (which may be gone by now). Returns what effect() does. +/datum/bounty_chrome_move/proc/fire(atom/target) + last_fired = world.time + return effect(target) + +/// What it does once the tell is over: by default, Trigger() the implant's action. Returns TRUE if it did something. +/datum/bounty_chrome_move/proc/effect(atom/target) + if(!action_type) + return FALSE + return bounty_chrome_trigger(owner, action_type, trigger_target(target)) + +/// The tell was cut short (BOUNTY_CHROME_CANCEL_*): nothing fires. The look is already gone. +/datum/bounty_chrome_move/proc/cancel(reason) + return + +/// For a move that drives behaviours itself (a grab, blades out): queue them on `controller` and return TRUE to end the planning. Called every planning tick in a fight, before any move starts. +/datum/bounty_chrome_move/proc/plan(datum/ai_controller/controller, atom/target) + return FALSE + +/// A fight starts against `target` +/datum/bounty_chrome_move/proc/on_fight_start(atom/target) + return + +/// The fight is over +/datum/bounty_chrome_move/proc/on_fight_end() + return + +/// Every Life tick of its owner (none while it is dormant); `fighting` is bounty_chrome_in_fight(), `target` who it is going for +/datum/bounty_chrome_move/proc/on_tick(seconds_per_tick, fighting, atom/target) + return + +/// Its owner went down into crit +/datum/bounty_chrome_move/proc/on_downed() + return + +/// Its owner died: end anything running +/datum/bounty_chrome_move/proc/on_death() + return + +/// An EMP of `severity` reached its owner (the implant reboots on its own timer) +/datum/bounty_chrome_move/proc/on_emp(severity) + return + +// ===== AN NPC'S CHROME, IN A FIGHT ===== + +/** + * A bounty NPC's chrome moves, and the one tell it may have going. Added by bounty_chrome_equip(); adding + * it again adds the new keys' moves. The tell is held to tg's state through signals: crit, a stun, a + * knockdown, cuffs, death or an EMP cuts it short. + */ +/datum/component/bounty_chrome + dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS + /// The piece keys it carries, in order + var/list/keys = list() + /// Its moves (/datum/bounty_chrome_move), one per move type of each piece + var/list/moves = list() + /// The move whose tell is running, or null + var/datum/bounty_chrome_move/telling + /// Weakref to what that tell is aimed at + var/datum/weakref/tell_target + /// Goes up with each tell, so a stale timer does nothing + var/tell_serial = 0 + var/tell_timer + /// In a fight at the last look (bounty_chrome_in_fight()), for the fight's start and end + var/fighting = FALSE + /// world.time its next chrome move may start + var/next_move_at = 0 + +/datum/component/bounty_chrome/Initialize(list/new_keys) + if(!ishumannpc(parent)) + return COMPONENT_INCOMPATIBLE + add_keys(new_keys) + +/datum/component/bounty_chrome/InheritComponent(datum/component/new_comp, i_am_original, list/new_keys) + add_keys(new_keys) + +/datum/component/bounty_chrome/Destroy(force) + end_tell() + for(var/datum/bounty_chrome_move/move as anything in moves) + move.detach() + qdel(move) + moves.Cut() + tell_target = null + return ..() + +/datum/component/bounty_chrome/RegisterWithParent() + RegisterSignal(parent, COMSIG_LIVING_LIFE, PROC_REF(on_life)) + RegisterSignal(parent, COMSIG_HUMAN_NPC_DOWNED, PROC_REF(on_downed)) + RegisterSignal(parent, COMSIG_LIVING_DEATH, PROC_REF(on_death)) + RegisterSignal(parent, COMSIG_ATOM_EMP_ACT, PROC_REF(on_emp)) + RegisterSignals(parent, list(SIGNAL_ADDTRAIT(TRAIT_INCAPACITATED), SIGNAL_ADDTRAIT(TRAIT_FLOORED)), PROC_REF(on_stunned)) + RegisterSignal(parent, SIGNAL_ADDTRAIT(TRAIT_RESTRAINED), PROC_REF(on_restrained)) + +/datum/component/bounty_chrome/UnregisterFromParent() + UnregisterSignal(parent, list( + COMSIG_LIVING_LIFE, + COMSIG_HUMAN_NPC_DOWNED, + COMSIG_LIVING_DEATH, + COMSIG_ATOM_EMP_ACT, + SIGNAL_ADDTRAIT(TRAIT_INCAPACITATED), + SIGNAL_ADDTRAIT(TRAIT_FLOORED), + SIGNAL_ADDTRAIT(TRAIT_RESTRAINED), + )) + +/// Adds the moves of the pieces `new_keys` it doesn't have yet; a mini-boss gets each as an ability in its rotation +/datum/component/bounty_chrome/proc/add_keys(list/new_keys) + var/mob/living/carbon/human/npc/npc = parent + for(var/key in new_keys) + var/datum/bounty_chrome_piece/piece = GLOB.bounty_chrome_pieces[key] + if(!piece || (key in keys)) + continue + keys += key + for(var/move_type in piece.move_types) + var/datum/bounty_chrome_move/move = new move_type + moves += move + move.attach(npc) + bounty_chrome_grant_boss_ability(npc, move) + +/// Its move of `move_type`, or null +/datum/component/bounty_chrome/proc/move_of(move_type) + for(var/datum/bounty_chrome_move/move as anything in moves) + if(istype(move, move_type)) + return move + return null + +/// Notes the fight starting or ending, and tells the moves +/datum/component/bounty_chrome/proc/update_fight() + var/now = bounty_chrome_in_fight(parent) + if(now == fighting) + return + fighting = now + if(now) + next_move_at = max(next_move_at, world.time + BOUNTY_CHROME_OPENING) + var/atom/target = bounty_chrome_target(parent) + for(var/datum/bounty_chrome_move/move as anything in moves) + move.on_fight_start(target) + return + interrupt(BOUNTY_CHROME_CANCEL_GONE) + for(var/datum/bounty_chrome_move/move as anything in moves) + move.on_fight_end() + +/** + * The bounty_chrome planning subtree's work: nothing else is planned while a tell runs (unless the move + * keeps acting through it, tell_keeps_acting, when only no other move starts); in a fight, a + * move that plans its own behaviours goes first, then, past the gap since the last one, a move that can + * start does. Returns the subtree's result. Doesn't sleep. + */ +/datum/component/bounty_chrome/proc/plan(datum/ai_controller/controller, seconds_per_tick) + if(telling) + return telling.tell_keeps_acting ? null : SUBTREE_RETURN_FINISH_PLANNING + update_fight() + if(!fighting || !bounty_chrome_can_act(parent)) + return + var/atom/target = bounty_chrome_target(parent) + if(QDELETED(target)) + return + for(var/datum/bounty_chrome_move/move as anything in moves) + if(move.plan(controller, target)) + return SUBTREE_RETURN_FINISH_PLANNING + if(world.time < next_move_at) + return + var/list/ready = list() + for(var/datum/bounty_chrome_move/move as anything in moves) + if(move.action_type && move.can_start(target)) + ready += move + if(length(ready) && start_move(pick(ready), target)) + return SUBTREE_RETURN_FINISH_PLANNING + +/** + * Starts `move`'s tell on `target`: it stands still with its AI quiet, and after the tell the move + * fires, unless something cuts it short. Returns TRUE if the tell started. + */ +/datum/component/bounty_chrome/proc/start_move(datum/bounty_chrome_move/move, atom/target) + var/mob/living/carbon/human/npc/npc = parent + if(telling || !(move in moves) || !bounty_chrome_can_act(npc)) + return FALSE + tell_serial++ + telling = move + tell_target = target ? WEAKREF(target) : null + if(move.tell_holds_still) + ADD_TRAIT(npc, TRAIT_IMMOBILIZED, BOUNTY_CHROME_TRAIT) + if(!move.tell_keeps_acting) + npc.ai_controller?.CancelActions() + if(target) + npc.face_atom(target) + move.tell(target) + tell_timer = addtimer(CALLBACK(src, PROC_REF(finish_tell), tell_serial), max(move.tell_time, BOUNTY_CHROME_TELL_MIN), TIMER_STOPPABLE | TIMER_DELETE_ME) + return TRUE + +/// The tell under `serial` is over: the move fires, if its owner can still act +/datum/component/bounty_chrome/proc/finish_tell(serial) + if(serial != tell_serial || !telling) + return FALSE + var/datum/bounty_chrome_move/move = telling + var/atom/target = tell_target?.resolve() + tell_timer = null + end_tell() + if(!bounty_chrome_can_act(parent)) + move.cancel(BOUNTY_CHROME_CANCEL_STUNNED) + return FALSE + next_move_at = world.time + max(move.recover_time, BOUNTY_CHROME_MOVE_GAP) + move.fire(target) + return TRUE + +/// Ends the running tell's hold and look, without firing or cancelling it +/datum/component/bounty_chrome/proc/end_tell() + var/datum/bounty_chrome_move/move = telling + telling = null + tell_target = null + if(tell_timer) + deltimer(tell_timer) + tell_timer = null + if(!QDELETED(parent)) + REMOVE_TRAIT(parent, TRAIT_IMMOBILIZED, BOUNTY_CHROME_TRAIT) + move?.clear_tell() + +/// Cuts the running tell short for `reason` (BOUNTY_CHROME_CANCEL_*): nothing fires. A mini-boss's chrome wind-up is cut short too. +/datum/component/bounty_chrome/proc/interrupt(reason) + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = parent + if(istype(boss) && istype(boss.boss_winding(), /datum/action/cooldown/mob_cooldown/bounty_boss/chrome)) + boss.boss_interrupt() + var/datum/bounty_chrome_move/move = telling + if(!move) + return FALSE + end_tell() + move.cancel(reason) + return TRUE + +/datum/component/bounty_chrome/proc/on_life(datum/source, seconds_per_tick, times_fired) + SIGNAL_HANDLER + update_fight() + var/atom/target = fighting ? bounty_chrome_target(parent) : null + for(var/datum/bounty_chrome_move/move as anything in moves) + move.on_tick(seconds_per_tick, fighting, target) + +/datum/component/bounty_chrome/proc/on_downed(datum/source) + SIGNAL_HANDLER + interrupt(BOUNTY_CHROME_CANCEL_DOWNED) + for(var/datum/bounty_chrome_move/move as anything in moves) + move.on_downed() + +/datum/component/bounty_chrome/proc/on_death(datum/source, gibbed) + SIGNAL_HANDLER + interrupt(BOUNTY_CHROME_CANCEL_DEATH) + fighting = FALSE + for(var/datum/bounty_chrome_move/move as anything in moves) + move.on_death() + +/datum/component/bounty_chrome/proc/on_emp(datum/source, severity, protection) + SIGNAL_HANDLER + if(protection & (EMP_PROTECT_SELF | EMP_PROTECT_CONTENTS)) + return + interrupt(BOUNTY_CHROME_CANCEL_EMP) + for(var/datum/bounty_chrome_move/move as anything in moves) + move.on_emp(severity) + +/datum/component/bounty_chrome/proc/on_stunned(datum/source) + SIGNAL_HANDLER + interrupt(BOUNTY_CHROME_CANCEL_STUNNED) + +/datum/component/bounty_chrome/proc/on_restrained(datum/source) + SIGNAL_HANDLER + interrupt(BOUNTY_CHROME_CANCEL_RESTRAINED) + +/** + * The AI's chrome: in the normal criminal's controller after bounty_fight_target (and in the + * companion's, C4). Nothing for an NPC with no chrome moves. + */ +/datum/ai_planning_subtree/bounty_chrome + +/datum/ai_planning_subtree/bounty_chrome/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick) + var/datum/component/bounty_chrome/chrome = controller.pawn?.GetComponent(/datum/component/bounty_chrome) + if(!chrome) + return + return chrome.plan(controller, seconds_per_tick) + +// ===== MINI-BOSSES ===== + +/// Gives mini-boss `npc` an ability in its rotation for `move`, if it is a mini-boss and the move is one its rotation can run +/proc/bounty_chrome_grant_boss_ability(mob/living/carbon/human/npc/npc, datum/bounty_chrome_move/move) + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = npc + if(!istype(boss) || !move.boss_usable || !move.action_type || move.boss_ability) + return null + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/ability = new(boss) + ability.set_move(move) + ability.Grant(boss) + boss.boss_abilities += ability + return ability + +/** + * A mini-boss's chrome move as one of its abilities, so its rotation, its busy rule and its interrupts + * (tg's stuns, crit, cuffs) run it the way they run its kit's: the wind-up is the move's tell, the effect + * the implant's action. + */ +/datum/action/cooldown/mob_cooldown/bounty_boss/chrome + name = "Chrome" + desc = "A wanted criminal's chrome." + cooldown_time = BOUNTY_CHROME_MOVE_GAP + /// The move it runs, one of its boss's own (/datum/component/bounty_chrome) + var/datum/bounty_chrome_move/move + +// A chrome move with lines of its own says one of them in its tell (move.tell()): its kit's ability line ("Grenade!" before a roar) would be a second line, and the wrong one +/mob/living/carbon/human/npc/bounty_criminal/boss/boss_bark(suffix, fallback) + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/winding = boss_winding() + if(suffix == "ability" && istype(winding) && length(winding.move?.tell_lines)) + return + return ..() + +/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/Destroy() + if(move?.boss_ability == src) + move.boss_ability = null + move = null + return ..() + +/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/proc/set_move(datum/bounty_chrome_move/new_move) + move = new_move + new_move.boss_ability = src + name = new_move.name + windup = max(new_move.tell_time, BOUNTY_CHROME_TELL_MIN) + cooldown_time = max(new_move.recover_time, BOUNTY_CHROME_MOVE_GAP) + +/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/worth_using(atom/target) + return ..() && move && move.owner == owner && move.can_start(target) + +/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/telegraph(atom/target) + move?.tell(target) + +/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/effect(atom/target) + if(!move) + return + move.clear_tell() + move.fire(target) + +/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/finish_windup(serial) + var/pending = serial && serial == pending_serial + . = ..() + // Its boss couldn't act when the wind-up ended: the tell's look goes too + if(pending && !. && move) + move.clear_tell() + move.cancel(BOUNTY_CHROME_CANCEL_STUNNED) + +/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/cancel_windup() + var/pending = pending_serial + . = ..() + if(pending && move) + move.clear_tell() + move.cancel(BOUNTY_CHROME_CANCEL_STUNNED) + +// ===== A MALFUNCTION ===== + +/** + * A bounty NPC's body with chrome in it, as others notice it: an EMP that knocks a piece out shows the + * malfunction (bounty_chrome_malfunction_fx()) for as long as the piece takes to reboot, and a chrome read + * is felt and answered (bounty_chrome_read_noticed()). On every criminal, decoys included (they carry + * their fugitive's chrome and must answer the same way), and on chromed companions. + */ +/datum/element/bounty_chrome_body + element_flags = ELEMENT_DETACH_ON_HOST_DESTROY + +/datum/element/bounty_chrome_body/Attach(datum/target) + . = ..() + if(!ishumannpc(target)) + return ELEMENT_INCOMPATIBLE + // Added again by bounty_chrome_equip() to a criminal that already has it: the same hooks + RegisterSignal(target, COMSIG_ATOM_EMP_ACT, PROC_REF(on_emp), override = TRUE) + RegisterSignal(target, COMSIG_CARBON_CHROME_READ, PROC_REF(on_read), override = TRUE) + +/datum/element/bounty_chrome_body/Detach(datum/source) + UnregisterSignal(source, list(COMSIG_ATOM_EMP_ACT, COMSIG_CARBON_CHROME_READ)) + return ..() + +/datum/element/bounty_chrome_body/proc/on_emp(mob/living/carbon/human/npc/source, severity, protection) + SIGNAL_HANDLER + if(protection & (EMP_PROTECT_SELF | EMP_PROTECT_CONTENTS)) + return + // The chrome takes the pulse after this signal (/mob/living/emp_act()): look a moment later + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(bounty_chrome_check_malfunction), WEAKREF(source)), 1) + +/datum/element/bounty_chrome_body/proc/on_read(mob/living/carbon/human/npc/source, mob/living/carbon/reader) + SIGNAL_HANDLER + bounty_chrome_read_noticed(source, reader) + +/// Whatever chrome of `npc_ref`'s an EMP just knocked out shows it, for as long as the longest reboot +/proc/bounty_chrome_check_malfunction(datum/weakref/npc_ref) + var/mob/living/carbon/human/npc/npc = npc_ref?.resolve() + if(QDELETED(npc) || npc.stat == DEAD) + return + var/longest = 0 + for(var/obj/item/organ/organ in npc.organs) + var/datum/component/cyberware/chrome = organ.GetComponent(/datum/component/cyberware) + if(!chrome?.emp_down) + continue + longest = max(longest, chrome.emp_timer ? timeleft(chrome.emp_timer) : 0) + if(longest <= 0) + return + var/fresh = !npc.has_status_effect(/datum/status_effect/bounty_chrome_malfunction) + bounty_chrome_malfunction_fx(npc, longest) + if(fresh) + npc.visible_message(span_warning("[npc]'s chrome sparks and stutters!")) + +/** + * Shows `npc`'s chrome malfunctioning for `duration`: arcs crawling over the body, tg's EMP sparkle, a + * flickering chrome-blue outline and light, twitches, and sparks spat onto the tiles around them with a + * crackle. Only a picture: nothing is hurt, set alight or switched off by it. A longer one extends it. + */ +/proc/bounty_chrome_malfunction_fx(mob/living/npc, duration) + if(QDELETED(npc) || npc.stat == DEAD || duration <= 0) + return null + return npc.apply_status_effect(/datum/status_effect/bounty_chrome_malfunction, duration) + +/// The arcs over a malfunctioning body, and their glow in the dark when `body` is given. For the overlay and the renders. +/proc/bounty_chrome_malfunction_arcs(atom/body) + . = list() + var/mutable_appearance/arcs = mutable_appearance('icons/effects/effects.dmi', "electricity", ABOVE_MOB_LAYER) + arcs.color = BOUNTY_CHROME_MALFUNCTION_MATRIX + . += arcs + . += mutable_appearance('icons/effects/effects.dmi', "empdisable", ABOVE_MOB_LAYER) + if(body) + . += emissive_appearance('icons/effects/effects.dmi', "electricity", body) + +/// The look of bounty_chrome_malfunction_fx(), for its duration. Purely visual; it ends early if they die. +/datum/status_effect/bounty_chrome_malfunction + id = "bounty_chrome_malfunction" + duration = 4 SECONDS + tick_interval = BOUNTY_CHROME_MALFUNCTION_PULSE + status_type = STATUS_EFFECT_REFRESH + alert_type = null + /// The arcs and the sparkle on the body + var/list/arcs + /// The flickering light they give off + var/obj/effect/dummy/lighting_obj/moblight/glow + +/datum/status_effect/bounty_chrome_malfunction/on_creation(mob/living/new_owner, new_duration) + if(new_duration > 0) + duration = new_duration + return ..() + +/datum/status_effect/bounty_chrome_malfunction/refresh(effect, new_duration) + duration = max(duration, world.time + max(new_duration, 0)) + +/datum/status_effect/bounty_chrome_malfunction/on_apply() + if(owner.stat == DEAD) + return FALSE + arcs = bounty_chrome_malfunction_arcs(owner) + owner.add_overlay(arcs) + owner.add_filter(BOUNTY_CHROME_MALFUNCTION_FILTER, 3, outline_filter(1, BOUNTY_CHROME_MALFUNCTION_COLOR)) + var/outline = owner.get_filter(BOUNTY_CHROME_MALFUNCTION_FILTER) + if(outline) + // A flicker, never steady + animate(outline, color = "#7fd4ff20", time = 0.1 SECONDS, loop = -1) + animate(color = "#7fd4ffff", time = 0.1 SECONDS) + animate(color = "#7fd4ff60", time = 0.2 SECONDS) + animate(color = "#c8f0ffff", time = 0.1 SECONDS) + glow = owner.mob_light(2, 1, BOUNTY_CHROME_MALFUNCTION_COLOR) + // A corpse's chrome is burnt out: the look ends the moment it dies + RegisterSignal(owner, COMSIG_LIVING_DEATH, PROC_REF(on_owner_death)) + playsound(owner, 'sound/effects/empulse.ogg', 40, TRUE) + playsound(owner, SFX_SPARKS, 60, TRUE) + pulse() + return TRUE + +/datum/status_effect/bounty_chrome_malfunction/tick(seconds_between_ticks) + if(owner.stat == DEAD) + qdel(src) + return + pulse() + +/// One beat of it: a twitch, sparks spat onto a tile or two around them, a crackle, the light jumping +/datum/status_effect/bounty_chrome_malfunction/proc/pulse() + if(prob(60)) + owner.Shake(rand(1, 2), rand(0, 1), 0.2 SECONDS) + glow?.set_light_power(pick(0.4, 1, 1.6)) + var/turf/here = get_turf(owner) + if(!here) + return + var/list/spots = list() + for(var/turf/spot as anything in RANGE_TURFS(1, here)) + if(spot != here && !isclosedturf(spot)) + spots += spot + for(var/i in 1 to rand(1, 2)) + if(!length(spots)) + break + var/turf/spot = pick_n_take(spots) + new /obj/effect/temp_visual/bounty_chrome_spark(spot, (here.x - spot.x) * ICON_SIZE_X / 2, (here.y - spot.y) * ICON_SIZE_Y / 2) + if(prob(50)) + playsound(owner, SFX_SPARKS, 35, TRUE, SILENCED_SOUND_EXTRARANGE) + +/datum/status_effect/bounty_chrome_malfunction/proc/on_owner_death(datum/source, gibbed) + SIGNAL_HANDLER + qdel(src) + +/datum/status_effect/bounty_chrome_malfunction/on_remove() + UnregisterSignal(owner, COMSIG_LIVING_DEATH) + if(arcs) + owner.cut_overlay(arcs) + arcs = null + owner.remove_filter(BOUNTY_CHROME_MALFUNCTION_FILTER) + QDEL_NULL(glow) + +/datum/status_effect/bounty_chrome_malfunction/Destroy() + QDEL_NULL(glow) + return ..() + +/// Sparks flung from a malfunctioning body onto a tile beside it: tg's spark art, and nothing else. Starts `from_x`, `from_y` pixels back toward the body. +/obj/effect/temp_visual/bounty_chrome_spark + icon = 'icons/effects/effects.dmi' + icon_state = "sparks" + layer = ABOVE_MOB_LAYER + duration = 0.5 SECONDS + mouse_opacity = MOUSE_OPACITY_TRANSPARENT + +/obj/effect/temp_visual/bounty_chrome_spark/Initialize(mapload, from_x = 0, from_y = 0) + . = ..() + setDir(pick(GLOB.cardinals)) + pixel_x = from_x + pixel_y = from_y + animate(src, pixel_x = 0, pixel_y = 0, time = 0.2 SECONDS, easing = QUAD_EASING | EASE_OUT) + animate(alpha = 0, time = 0.3 SECONDS) + +// ===== A CHROME READ ===== + +/mob/living/carbon/human/npc + /// world.time it may next answer a chrome read (bounty_chrome_read_noticed()) + var/chrome_read_answer_at = 0 + +/** + * `reader` just read `npc`'s chrome with cyber optics, and it felt it (COMSIG_CARBON_CHROME_READ, + * cyberware_scan.dm): one that isn't fighting turns to the reader and tells them off, at most once every + * BOUNTY_CHROME_READ_NOTICE_COOLDOWN. Never while hiding. Everyone at a trader outpost answers the same + * way, the fugitive and its decoys alike. Returns TRUE if it answers. Doesn't sleep. + */ +/proc/bounty_chrome_read_noticed(mob/living/carbon/human/npc/npc, mob/living/reader) + if(!ishumannpc(npc) || !isliving(reader) || reader == npc || world.time < npc.chrome_read_answer_at) + return FALSE + if(npc.stat != CONSCIOUS || npc.client || bounty_chrome_in_fight(npc) || !length(cyberware_scannable_hardware(npc))) + return FALSE + var/mob/living/carbon/human/npc/bounty_criminal/criminal = npc + if(istype(criminal) && criminal.hidden) + return FALSE + npc.chrome_read_answer_at = world.time + BOUNTY_CHROME_READ_NOTICE_COOLDOWN + INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(bounty_chrome_answer_read), npc, reader) + return TRUE + +/// `npc` looks round at `reader` and says something about being read. Sleeps (say()). +/proc/bounty_chrome_answer_read(mob/living/carbon/human/npc/npc, mob/living/reader) + if(QDELETED(npc) || QDELETED(reader) || npc.stat != CONSCIOUS) + return + if(isturf(npc.loc) && !npc.buckled && npc.body_position == STANDING_UP) + npc.face_atom(reader) + npc.say(pick("Who said you could scan me?", "Stop reading me, creep.", "Quit scanning me.", "Eyes off my chrome."), forced = "bounty chrome read") diff --git a/voidcrew/modules/bounties/bounty_combat_sense.dm b/voidcrew/modules/bounties/bounty_combat_sense.dm index 4c7b16afc5a..d0dcbbff588 100644 --- a/voidcrew/modules/bounties/bounty_combat_sense.dm +++ b/voidcrew/modules/bounties/bounty_combat_sense.dm @@ -3,8 +3,8 @@ * criminals and their companions. Meek criminals (they run), decoys (patrons) and bosses (their own * stimulant and fallback, bounty_boss.dm) don't have it. * - * What they carry: a Wanted normal criminal also packs a stimpack, a Most Wanted one a combat stimpack - * (bounty_ai_normal.dm, bounty_build_outfit()), used when it tires in a fight, when its style leaves a + * What they carry: a Wanted normal criminal also packs a stimpack (bounty_ai_normal.dm, + * bounty_build_outfit(); every Most Wanted is a mini-boss with its own pens), used when it tires in a fight, when its style leaves a * pocket free (brawler, club, bottle, shotgun; not pistol or knife). Petty criminals and companions carry * none. Under stun fire a criminal whose style shoots or throws from range runs for * cover; a brawler, knife, club or shotgun style charges the shooter. Cover stays on the criminal's leash diff --git a/voidcrew/modules/bounties/bounty_companions.dm b/voidcrew/modules/bounties/bounty_companions.dm index b2a0e4594a1..26eb0c8da65 100644 --- a/voidcrew/modules/bounties/bounty_companions.dm +++ b/voidcrew/modules/bounties/bounty_companions.dm @@ -23,6 +23,14 @@ * criminal's spawn context (/datum/npc_spawn_context/bounty_company), which is how they know all that * before they are dressed. * + * They back their criminal up (C4): at most one of a criminal's company carries a gun + * (bounty_roll_company()), and a posting rolls its company with its site, so the sighting can say who + * they were seen with and the same company comes back each time the site loads (bounty_placement.dm). + * Joining a fight, they get up first and get their weapon out BOUNTY_COMPANION_DRAW_DELAY after their + * criminal does, and their guns fire shorter pistol strings and SMG bursts (bounty_styles.dm). Now and + * then one carries a piece of real chrome, rarer than their criminal's (bounty_chrome_roll_companion()), + * installed in their body like a criminal's and driven by the same chrome subtree. + * * The shared vars are declared in bounty_types.dm and nowhere else (leader_ref); the rest here * have an `ai_` prefix. */ @@ -62,6 +70,17 @@ var/company_site_kind /// The /datum/outfit their rough clothes came from (bounty_site_clothes()), or null for their plain ones var/company_clothes + /// Their criminal's tier (BOUNTY_TIER_*), known as they are made: what their chrome rolls by + var/company_tier + /// Who the posting rolled them as (bounty_roll_company()): their style and chrome, or null to roll their own as they are dressed + var/list/company_member + /// Their criminal has an armed companion already: they roll no gun of their own + var/company_unarmed = FALSE + /// The chrome keys in their body (BOUNTY_CHROME_*), and whether that was settled as they were dressed + var/list/ai_chrome + var/ai_chrome_rolled = FALSE + /// world.time they are up and may get their weapon out, in a fight they just joined + var/ai_draw_at = 0 /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 @@ -70,10 +89,19 @@ if(!QDELETED(leader)) company_site_kind = leader.posting()?.placement_kind npc_always_site |= leader.npc_site + company_tier = leader.record?.tier + company_unarmed = bounty_company_armed(leader) else npc_always_site |= bounty_site_dress_for(order?.context) company_site_kind ||= bounty_site_kind_of(order?.context) - return ..() + // Who the posting rolled them as: the style they are dressed for, and their chrome + if(istype(company) && company.company_member) + company_member = company.company_member.Copy() + ai_style ||= company_member[BOUNTY_COMPANY_STYLE] + . = ..() + // Their chrome is in their body now (the base installed npc_cyberware): the AI side of it + if(length(ai_chrome)) + bounty_chrome_equip(src, ai_chrome) /mob/living/carbon/human/npc/bounty_companion/Destroy() ai_let_go() @@ -87,11 +115,23 @@ /** * 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. + * criminal's heavier one) and its spares, and a bruise pack. The style is the one the posting rolled + * for them, or picked here (never a second gun in their criminal's company), so the weapon they carry + * is the one they fight with. Their chrome is settled here too, once: the posting's, or a roll of their + * own (bounty_chrome_roll_companion()), into npc_cyberware, so the base installs it and the outfit table + * dresses them to show it. */ /mob/living/carbon/human/npc/bounty_companion/bounty_build_outfit(zone) - ai_style ||= pick_weight(list( + ai_style ||= bounty_roll_companion_style(no_gun = company_unarmed) + if(!ai_chrome_rolled) + ai_chrome_rolled = TRUE + var/list/keys = company_member ? company_member[BOUNTY_COMPANY_CHROME] : bounty_chrome_roll_companion(company_tier, ai_style) + ai_chrome = bounty_chrome_prepare_body(src, keys) + return bounty_fighter_outfit(BOUNTY_ARCHETYPE_NORMAL, zone, BOUNTY_TIER_PETTY, ai_style, FALSE, /obj/item/stack/medical/bruise_pack) + +/// Fighting style weights for a companion (BOUNTY_STYLE_* => weight): mostly fists and blades, a gun now and then +/proc/bounty_companion_style_weights() + return list( BOUNTY_STYLE_BRAWLER = 3, BOUNTY_STYLE_KNIFE = 2, BOUNTY_STYLE_CLUB = 2, @@ -100,8 +140,47 @@ BOUNTY_STYLE_SHOTGUN = 1, 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) + ) + +/** + * A companion's fighting style (BOUNTY_STYLE_*), by weight. `no_gun` (their criminal has an armed + * companion already) rolls among the rest: fists, a knife, a bat or bottles. + */ +/proc/bounty_roll_companion_style(no_gun = FALSE) + var/list/weights = bounty_companion_style_weights() + if(no_gun) + for(var/key in weights.Copy()) + if(bounty_style_is_gun(key)) + weights -= key + return pick_weight(weights) + +/** + * The company of `count` companions for a criminal of `tier` (BOUNTY_TIER_*): one list per companion, + * its fighting style (BOUNTY_COMPANY_STYLE) and its chrome (BOUNTY_COMPANY_CHROME, rolled for that style, + * or null). At most one of them carries a gun, and that one comes first, so a server short of room for + * companions still spawns the armed one the sighting names. + */ +/proc/bounty_roll_company(count, tier) + var/list/company = list() + var/armed = FALSE + for(var/i in 1 to count) + var/style = bounty_roll_companion_style(no_gun = armed) + var/list/member = list(BOUNTY_COMPANY_STYLE = style, BOUNTY_COMPANY_CHROME = bounty_chrome_roll_companion(tier, style)) + if(bounty_style_is_gun(style)) + armed = TRUE + company.Insert(1, list(member)) + else + company += list(member) + return company + +/// Whether any of `leader`'s company carries a gun: their style is one (bounty_style_is_gun()) +/proc/bounty_company_armed(mob/living/carbon/human/npc/bounty_criminal/leader) + if(QDELETED(leader)) + return FALSE + for(var/mob/living/carbon/human/npc/bounty_companion/buddy as anything in leader.ai_companions()) + if(bounty_style_is_gun(buddy.ai_style)) + return TRUE + return FALSE // 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() @@ -208,11 +287,16 @@ ai_controller.set_blackboard_key(BB_BASIC_MOB_REINFORCEMENT_TARGET, leader) ai_enter_fight() -/// Up from their seat, drink down, at a run. The weapon comes out through the arm subtree (bounty_styles.dm). +/** + * Up from their seat, drink down, at a run. Their weapon comes out through the arm subtree + * (bounty_styles.dm) once they are up, BOUNTY_COMPANION_DRAW_DELAY later (bounty_companion_getting_up), + * a beat after their criminal's. + */ /mob/living/carbon/human/npc/bounty_companion/proc/ai_enter_fight() if(ai_in_fight) return ai_in_fight = TRUE + ai_draw_at = world.time + BOUNTY_COMPANION_DRAW_DELAY ai_put_drink_away() ai_stand_up() bounty_ai_set_pace(src, BOUNTY_RUN_SPEED) @@ -222,6 +306,7 @@ if(!ai_in_fight) return ai_in_fight = FALSE + ai_draw_at = 0 bounty_ai_set_pace(src, BOUNTY_CALM_SPEED) bounty_ai_holster(src) @@ -448,26 +533,32 @@ * 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. + * made with its criminal's spawn context, so it is dressed for where they are. `member` (one entry of + * bounty_roll_company()) is who it is: its style and chrome; without it, it rolls its own. */ -/proc/bounty_spawn_companion(mob/living/carbon/human/npc/bounty_criminal/leader, turf/where, datum/callback/on_spawned, immediate = FALSE) +/proc/bounty_spawn_companion(mob/living/carbon/human/npc/bounty_criminal/leader, turf/where, datum/callback/on_spawned, immediate = FALSE, list/member) 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) + company.company_member = member 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. + * criminal it is made from), which criminal that is, and who the posting rolled the companion as, 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 + /// One entry of bounty_roll_company() (BOUNTY_COMPANY_STYLE, BOUNTY_COMPANY_CHROME), or null to roll their own + var/list/company_member /datum/npc_spawn_context/bounty_company/Destroy() company_leader_ref = null + company_member = null return ..() /** @@ -495,15 +586,25 @@ /** * Spawns `count` companions (clamped to BOUNTY_COMPANIONS_MIN-BOUNTY_COMPANIONS_MAX) on free tiles * 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. + * posting, as it is made. They are `company` (bounty_roll_company(), the posting's), and any more than + * it has are rolled here, never a second gun among them. Returns the companions already made: only with + * `immediate` (tests, admin tools), otherwise an empty list. */ -/mob/living/carbon/human/npc/bounty_criminal/proc/spawn_companions(count, immediate = FALSE) +/mob/living/carbon/human/npc/bounty_criminal/proc/spawn_companions(count, immediate = FALSE, list/company) . = list() count = clamp(count, BOUNTY_COMPANIONS_MIN, BOUNTY_COMPANIONS_MAX) var/turf/home = get_turf(src) if(!home || count <= 0) return + company = company ? company.Copy() : list() + if(length(company) < count) + var/armed = bounty_company_armed(src) + for(var/list/member as anything in company) + armed ||= bounty_style_is_gun(member[BOUNTY_COMPANY_STYLE]) + for(var/i in length(company) + 1 to count) + var/style = bounty_roll_companion_style(no_gun = armed) + armed ||= bounty_style_is_gun(style) + company += list(list(BOUNTY_COMPANY_STYLE = style, BOUNTY_COMPANY_CHROME = bounty_chrome_roll_companion(record?.tier, style))) var/list/spots = list() for(var/turf/tile as anything in RANGE_TURFS(1, home)) if(tile != home && ai_standable(tile)) @@ -515,7 +616,7 @@ for(var/i in 1 to count) if(!length(spots)) break - var/datum/human_npc_order/order = bounty_spawn_companion(src, pick_n_take(spots), null, immediate) + var/datum/human_npc_order/order = bounty_spawn_companion(src, pick_n_take(spots), null, immediate, company[i]) var/mob/living/carbon/human/npc/bounty_companion/buddy = order?.spawned_ref?.resolve() if(!QDELETED(buddy)) . += buddy @@ -535,9 +636,10 @@ // ===== AI ===== /** - * 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). + * A companion's controller: the trooper's peaceful pattern (retaliate, call the others in, get up, + * attack by style with the real weapon or their chrome, 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( @@ -549,6 +651,10 @@ /datum/ai_planning_subtree/flee_target/bounty, /datum/ai_planning_subtree/target_retaliate/bounty, /datum/ai_planning_subtree/call_reinforcements/bounty, + // Just joined the fight: up first, their criminal draws before they do + /datum/ai_planning_subtree/bounty_companion_getting_up, + // Their chrome, if they carry any: a tell, then the implant's own action (C0, bounty_chrome.dm) + /datum/ai_planning_subtree/bounty_chrome, /datum/ai_planning_subtree/npc_combat_sense, /datum/ai_planning_subtree/bounty_arm, /datum/ai_planning_subtree/bounty_ranged, @@ -629,6 +735,22 @@ if(QDELETED(threat) || bounty_ai_dist(companion, threat) >= (controller.blackboard[BB_BASIC_MOB_FLEE_DISTANCE] || BOUNTY_FLEE_DISTANCE)) return SUBTREE_RETURN_FINISH_PLANNING +/** + * Just in the fight (ai_enter_fight()), a companion gets up from where they were first: for + * BOUNTY_COMPANION_DRAW_DELAY they turn to face whoever they are going for, and no weapon comes out and + * no blow or shot is planned, so their criminal's draw comes first. Then the arm subtree draws as usual. + */ +/datum/ai_planning_subtree/bounty_companion_getting_up + +/datum/ai_planning_subtree/bounty_companion_getting_up/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick) + var/mob/living/carbon/human/npc/bounty_companion/companion = controller.pawn + if(!istype(companion) || !companion.ai_in_fight || world.time >= companion.ai_draw_at) + return + var/atom/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET] + if(!QDELETED(target)) + companion.face_atom(target) + return SUBTREE_RETURN_FINISH_PLANNING + /// tg's retaliation, while they can still fight. Its list is filled by the controller's hooks, not tg's element. /datum/ai_planning_subtree/target_retaliate/bounty operational_datums = null diff --git a/voidcrew/modules/bounties/bounty_criminal.dm b/voidcrew/modules/bounties/bounty_criminal.dm index e9849f8b481..d4e10fb8479 100644 --- a/voidcrew/modules/bounties/bounty_criminal.dm +++ b/voidcrew/modules/bounties/bounty_criminal.dm @@ -68,11 +68,15 @@ 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 record's chrome joins npc_cyberware, so the base installs the real implants once it is dressed (C0, bounty_chrome.dm) + bounty_chrome_prepare(src) . = ..() add_traits(list(TRAIT_NO_TELEPORT, TRAIT_NOMOBSWAP), BOUNTY_BODY_TRAIT) AddComponent(/datum/component/bounty_body) body_hook_cuffs() body_toughness() + // Its chrome's moves (a mini-boss's in its ability rotation), and the EMP look (C0) + bounty_chrome_ready(src) /mob/living/carbon/human/npc/bounty_criminal/Destroy() if(body_leaves_proof()) @@ -126,6 +130,8 @@ return /mob/living/carbon/human/npc/bounty_criminal/boss/ghost if(BOUNTY_KIT_HEAVY) return /mob/living/carbon/human/npc/bounty_criminal/boss/heavy + if(BOUNTY_KIT_CYBERPSYCHO) + return /mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho return pick( /mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut, /mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac, diff --git a/voidcrew/modules/bounties/bounty_identity.dm b/voidcrew/modules/bounties/bounty_identity.dm index 8ed130ed47b..439a0e08695 100644 --- a/voidcrew/modules/bounties/bounty_identity.dm +++ b/voidcrew/modules/bounties/bounty_identity.dm @@ -75,6 +75,9 @@ GLOBAL_LIST_INIT(bounty_species_weights, list( record.style = bounty_roll_style(concealed = (placement_kind == BOUNTY_PLACEMENT_TRADER_OUTPOST)) if(BOUNTY_ARCHETYPE_BOSS) record.kit = bounty_roll_kit() + // C0 chrome (bounty_chrome.dm): rolled once, so the same criminal always carries the same chrome. The kingpin carries none. + if(placement_kind != BOUNTY_PLACEMENT_KINGPIN) + record.chrome = bounty_chrome_roll(tier, archetype, record.style, record.kit, bounty_chrome_kit_organs(record.kit)) record.alias = bounty_roll_alias(record) record.crime = bounty_roll_crime(tier) record.features = bounty_roll_features(record) @@ -124,6 +127,8 @@ GLOBAL_LIST_INIT(bounty_species_weights, list( BOUNTY_KIT_PYROMANIAC = 20, BOUNTY_KIT_DEMOLITIONIST = 18, BOUNTY_KIT_GHOST = 18, + // The rarest: its kit is its chrome (chrome/bounty_cyberpsycho.dm) + BOUNTY_KIT_CYBERPSYCHO = 8, ) return pick_weight(weights) diff --git a/voidcrew/modules/bounties/bounty_lair_mafia.dm b/voidcrew/modules/bounties/bounty_lair_mafia.dm index a95fbb281f5..4b45b10147b 100644 --- a/voidcrew/modules/bounties/bounty_lair_mafia.dm +++ b/voidcrew/modules/bounties/bounty_lair_mafia.dm @@ -157,7 +157,7 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms) */ /proc/bounty_mafia_room_crew(area_type) var/type_text = "[area_type]" - var/static/marker = "/mafia_club/" + var/marker = "/mafia_club/" var/at = findtext(type_text, marker) if(!at) return null @@ -779,6 +779,8 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms) /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 + if(cyberware_camo_hides(target, src)) // optical camo (cyberware_stealth.dm) + return FALSE var/turf/spot = get_turf(target) return spot && spot.z == z && get_dist(src, spot) <= BOUNTY_MOBSTER_CHASE diff --git a/voidcrew/modules/bounties/bounty_outfits.dm b/voidcrew/modules/bounties/bounty_outfits.dm index 3eff08fd633..0005b1fe614 100644 --- a/voidcrew/modules/bounties/bounty_outfits.dm +++ b/voidcrew/modules/bounties/bounty_outfits.dm @@ -29,6 +29,9 @@ return null var/outfit = npc.bounty_build_outfit(zone || ZONE_GREEN) outfit = npc.bounty_site_clothes(outfit) + // Chrome carriers dress light, so their worn chrome shows (C0, bounty_chrome.dm). A mini-boss wears its kit. + if(length(npc.npc_cyberware) && npc.bounty_dresses_to_show_chrome()) + outfit = bounty_chrome_expose_outfit(outfit, npc.npc_cyberware) return bounty_seal_outfit(npc, outfit, src) /** diff --git a/voidcrew/modules/bounties/bounty_outpost.dm b/voidcrew/modules/bounties/bounty_outpost.dm index 3dbff01d01f..9ac8cecbc28 100644 --- a/voidcrew/modules/bounties/bounty_outpost.dm +++ b/voidcrew/modules/bounties/bounty_outpost.dm @@ -856,6 +856,9 @@ GLOBAL_LIST_INIT(bounty_outpost_trader_react_lines, list( if(QDELETED(owner)) return owner.blended = FALSE + // Out of the act, the coat over its chrome comes off and the chrome shows (C0, bounty_chrome.dm). Decoys never drop the act. + if(!decoy && !leaving) + bounty_chrome_bare(owner) REMOVE_TRAIT(owner, TRAIT_NO_CONTAINMENT, BOUNTY_OUTPOST_TRAIT) REMOVE_TRAIT(owner, TRAIT_NO_STORAGE_INSERT, BOUNTY_OUTPOST_TRAIT) if(added_turret_faction) @@ -1402,6 +1405,15 @@ 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()). diff --git a/voidcrew/modules/bounties/bounty_placement.dm b/voidcrew/modules/bounties/bounty_placement.dm index 6e28641c1ca..0ca7fddbb2f 100644 --- a/voidcrew/modules/bounties/bounty_placement.dm +++ b/voidcrew/modules/bounties/bounty_placement.dm @@ -491,17 +491,42 @@ return BOUNTY_ACTIVITY_BLEND 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/carbon/human/npc/bounty_criminal/criminal) +/** + * The company a normal criminal keeps at its site (bounty_roll_company(): a style and chrome a + * companion, at most one of them armed): 0 to BOUNTY_MAX_COMPANIONS in every zone (12.3 C9: the zone + * scales pay, never the fight). At most one aboard a pirate ship, whose crew are company enough, and + * nobody at a trader outpost or with any other kind of criminal. + */ +/datum/criminal_bounty/proc/board_roll_company() + if(record?.archetype != BOUNTY_ARCHETYPE_NORMAL || placement_kind == BOUNTY_PLACEMENT_TRADER_OUTPOST) + return list() var/count = rand(0, BOUNTY_MAX_COMPANIONS) - // The crew aboard a pirate ship are company enough if(placement_kind == BOUNTY_PLACEMENT_NPC_SHIP) count = min(count, 1) - count = min(count, BOUNTY_MAX_LIVE_COMPANIONS - SScriminal_bounties.board_live_companions()) + return bounty_roll_company(count, record?.tier) + +/** + * The company its criminal keeps at its site now, rolled the first time it is asked for at a site + * (board_roll_company()) and kept while the bounty stays there: the sighting names it, and the same + * company comes back each time the site loads. A new site rolls a new one. + */ +/datum/criminal_bounty/proc/board_company() + var/obj/structure/overmap/where = site() + if(where && board_company_site?.resolve() != where) + board_company = null + board_company_site = WEAKREF(where) + if(isnull(board_company)) + board_company = board_roll_company() + return board_company + +/// Spawns the company the posting rolled (board_company()) beside its criminal, within the server's cap on live companions +/datum/criminal_bounty/proc/board_spawn_companions(mob/living/carbon/human/npc/bounty_criminal/criminal) + var/list/company = board_company() + var/count = min(length(company), BOUNTY_MAX_LIVE_COMPANIONS - SScriminal_bounties.board_live_companions()) if(count <= 0) return list() // 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) + criminal.spawn_companions(count, FALSE, company) /** * Makes the criminal a friend of the site's own, so it doesn't fight the hostiles native to where diff --git a/voidcrew/modules/bounties/bounty_posting.dm b/voidcrew/modules/bounties/bounty_posting.dm index 9da2acf8d26..ea5b3445ca4 100644 --- a/voidcrew/modules/bounties/bounty_posting.dm +++ b/voidcrew/modules/bounties/bounty_posting.dm @@ -53,8 +53,14 @@ 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 + /// The company its criminal keeps at its site (board_company(): bounty_roll_company(), a style and chrome a companion), null until rolled + var/list/board_company + /// Weakref to the site board_company was rolled for: a new site rolls a new one + var/datum/weakref/board_company_site /datum/criminal_bounty/Destroy() // close() is the way out; this catches an admin qdel that skipped it @@ -186,7 +192,7 @@ if(record && !record.mugshot) bounty_queue_mugshot(record) board_push_waypoint(ship) - ship.ship_notify("WANTED: now hunting [record?.name]. [board_place_text()].", "MISSION CONTROL", SHIP_NOTIFY_NOTICE, 'voidcrew/sound/notify.ogg', 50) + ship.ship_notify("WANTED: now hunting [record?.name]. [board_sighting_text()].", "MISSION CONTROL", SHIP_NOTIFY_NOTICE, 'voidcrew/sound/notify.ogg', 50) log_game("BOUNTY: [ship.name] is hunting the [board_log_name()]") board_arm() return TRUE @@ -282,6 +288,7 @@ 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) @@ -451,7 +458,7 @@ SScriminal_bounties.board_changed() for(var/obj/structure/overmap/ship/hunter as anything in hunter_ships()) board_push_waypoint(hunter) - hunter.ship_notify("WANTED: new sighting of [record?.name]. [board_place_text()].", "MISSION CONTROL", SHIP_NOTIFY_NOTICE, 'voidcrew/sound/notify.ogg', 50) + hunter.ship_notify("WANTED: new sighting of [record?.name]. [board_sighting_text()].", "MISSION CONTROL", SHIP_NOTIFY_NOTICE, 'voidcrew/sound/notify.ogg', 50) log_game("BOUNTY: the [board_log_name()] relisted") board_arm() return TRUE @@ -550,6 +557,32 @@ return "Seen at the [site_name]" return "Seen on [site_name]" +/// The sighting as the card and the notices give it: where they were seen, and who with ("Seen on Kepler IV with two friends, one armed") +/datum/criminal_bounty/proc/board_sighting_text() + var/company = board_company_text() + return company ? "[board_place_text()] [company]" : board_place_text() + +/// Who they were seen with (board_company()), or null for nobody: "with a friend", "with an armed friend", "with two friends", "with two friends, one armed" +/datum/criminal_bounty/proc/board_company_text() + if(board_relisting) + return null + var/list/company = board_company() + if(!length(company)) + return null + var/armed = 0 + for(var/list/member as anything in company) + if(bounty_style_is_gun(member[BOUNTY_COMPANY_STYLE])) + armed++ + if(length(company) == 1) + return armed ? "with an armed friend" : "with a friend" + var/friends = "with [length(company) == 2 ? "two" : length(company)] friends" + switch(armed) + if(0) + return friends + if(1) + return "[friends], one armed" + return "[friends], all armed" + /// How the poster says they're wanted: alive, dead or alive, or dead /datum/criminal_bounty/proc/board_terms() return "Wanted alive" @@ -591,7 +624,7 @@ "tier" = record?.tier || BOUNTY_TIER_PETTY, "terms" = board_terms(), "crime" = record?.crime, - "place" = board_place_text(), + "place" = board_sighting_text(), "zone" = board_zone_name(), "zone_color" = board_zone_color(), "mugshot_id" = record?.id, @@ -622,8 +655,17 @@ 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" : ""]" : ""]" @@ -647,6 +689,9 @@ lines += "Wanted for: [record.crime].
    " lines += "[board_terms()].
    " lines += "[board_place_text()], [board_zone_name()].
    " + var/company = board_company_text() + if(company) + lines += "[capitalize(company)].
    " // One feature is left off, so what the traders say about them still tells a hunter something new var/list/features = record?.feature_lines() if(length(features)) diff --git a/voidcrew/modules/bounties/bounty_styles.dm b/voidcrew/modules/bounties/bounty_styles.dm index d8e81df3fd2..2ecc5690d8a 100644 --- a/voidcrew/modules/bounties/bounty_styles.dm +++ b/voidcrew/modules/bounties/bounty_styles.dm @@ -25,10 +25,13 @@ * 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. + * hit (bounty_ai_line_blocked()), one step at a time at the body's own pace (bounty_ai_step()). 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. A gun fires at anyone it sees + * within BOUNTY_GUN_FIRE_RANGE while its holder walks in to BOUNTY_PISTOL_RANGE; the shotgun and the + * bottle keep to their own distance. A companion's gun is backup: shorter pistol strings and SMG bursts + * (companion_string, companion_burst). 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 @@ -188,10 +191,10 @@ GLOBAL_LIST_INIT(bounty_styles, init_bounty_styles()) return TRUE return FALSE -/// One step sideways for a clear line to `target`, no further from them, on the leash +/// One step sideways for a clear line to `target`, no further from them, on the leash, and no sooner than the body's own next step (a person can't dart about faster than they walk) /proc/bounty_ai_sidestep(mob/living/fighter, atom/target) var/turf/here = get_turf(fighter) - if(!here || !isturf(fighter.loc)) + if(!here || !isturf(fighter.loc) || !bounty_ai_step_ready(fighter)) return FALSE var/list/options = list() for(var/direction in GLOB.alldirs) @@ -201,18 +204,18 @@ GLOBAL_LIST_INIT(bounty_styles, init_bounty_styles()) options += next shuffle_inplace(options) for(var/turf/next as anything in options) - if(bounty_ai_step(fighter, next)) + if(bounty_ai_step(fighter, next, paced = TRUE)) return TRUE return FALSE -/// A step straight back from `target`, now and then, on the leash +/// A step straight back from `target`, now and then, on the leash, and no sooner than the body's own next step /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)) + if(world.time < controller.blackboard[BB_BOUNTY_BACKSTEP_AT] || !isturf(fighter.loc) || !bounty_ai_step_ready(fighter)) 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)) + if(!away || !bounty_ai_step(fighter, away, paced = TRUE)) return FALSE fighter.face_atom(target) return TRUE @@ -270,6 +273,9 @@ GLOBAL_LIST_INIT(bounty_styles, init_bounty_styles()) /// 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 + /// A companion's burst and string, shorter: their gun is backup (null: the same as burst and string_shots) + var/companion_burst + var/companion_string /** * Puts this style's weapon and spares on `outfit` (an instance), the heavier weapon if `heavy`. The @@ -282,12 +288,16 @@ GLOBAL_LIST_INIT(bounty_styles, init_bounty_styles()) /datum/bounty_style/proc/weapon_for(heavy) return (heavy && heavy_weapon) || weapon -/// Trigger pulls in one burst for `fighter` +/// Trigger pulls in one burst for `fighter`: a companion's is companion_burst, if the style has one /datum/bounty_style/proc/burst_length(mob/living/carbon/fighter) + if(!isnull(companion_burst) && istype(fighter, /mob/living/carbon/human/npc/bounty_companion)) + return companion_burst return burst -/// Shots in one string for `fighter`, 0 for none +/// Shots in one string for `fighter`, 0 for none: a companion's is companion_string, if the style has one /datum/bounty_style/proc/string_length(mob/living/carbon/fighter) + if(!isnull(companion_string) && istype(fighter, /mob/living/carbon/human/npc/bounty_companion)) + return companion_string 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. @@ -487,6 +497,7 @@ GLOBAL_LIST_INIT(bounty_styles, init_bounty_styles()) single_fire = TRUE string_shots = BOUNTY_PISTOL_STRING_SHOTS string_pause = BOUNTY_PISTOL_STRING_PAUSE + companion_string = BOUNTY_COMPANION_PISTOL_STRING /datum/bounty_style/pistol/equip(datum/outfit/outfit, heavy = FALSE) var/obj/item/gun/ballistic/gun_type = weapon_for(heavy) @@ -512,6 +523,7 @@ GLOBAL_LIST_INIT(bounty_styles, init_bounty_styles()) burst = BOUNTY_SMG_BURST burst_gap = BOUNTY_SMG_BURST_GAP concealable = FALSE + companion_burst = BOUNTY_COMPANION_SMG_BURST /datum/bounty_style/smg/equip(datum/outfit/outfit, heavy = FALSE) var/obj/item/gun/ballistic/gun_type = weapon_for(heavy) @@ -796,17 +808,20 @@ GLOBAL_LIST_INIT(bounty_styles, init_bounty_styles()) 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. + * Shoots (or throws) at the target from the style's distance: walks in to required_distance, and fires + * at them on the way once it can see them within fire_range; 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 + /// How far off they shoot at someone they can see, walking in or not + var/fire_range = BOUNTY_GUN_FIRE_RANGE /datum/ai_behavior/bounty_shoot/setup(datum/ai_controller/controller, target_key, targeting_strategy_key) . = ..() @@ -831,7 +846,7 @@ GLOBAL_LIST_INIT(bounty_styles, init_bounty_styles()) 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)) + if(!can_see(fighter, target, fire_range)) style.end_burst(controller) return AI_BEHAVIOR_INSTANT var/winding = !!controller.blackboard[BB_BOUNTY_WINDUP_UNTIL] @@ -854,13 +869,15 @@ GLOBAL_LIST_INIT(bounty_styles, init_bounty_styles()) bounty_ai_clear_windup(controller) controller.clear_blackboard_key(BB_BOUNTY_BURST_LEFT) -/// The shotgun closes in to BOUNTY_SHOTGUN_RANGE +/// The shotgun closes in to BOUNTY_SHOTGUN_RANGE, and fires from there: buckshot spreads too wide to hit much further off /datum/ai_behavior/bounty_shoot/close required_distance = BOUNTY_SHOTGUN_RANGE + fire_range = BOUNTY_SHOTGUN_RANGE -/// The bottle thrower stays BOUNTY_BOTTLE_RANGE off +/// The bottle thrower stays BOUNTY_BOTTLE_RANGE off, and throws from there /datum/ai_behavior/bounty_shoot/throw required_distance = BOUNTY_BOTTLE_RANGE + fire_range = BOUNTY_BOTTLE_RANGE // ===== MELEE ===== diff --git a/voidcrew/modules/bounties/bounty_suits.dm b/voidcrew/modules/bounties/bounty_suits.dm index 48f3d798efd..bd53920b656 100644 --- a/voidcrew/modules/bounties/bounty_suits.dm +++ b/voidcrew/modules/bounties/bounty_suits.dm @@ -11,13 +11,16 @@ * 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. + * suit; a Wanted criminal, who wears an armour vest, an armoured space suit; a mini-boss (every Most + * Wanted is one) a MODsuit of its kit's own theme (bounty_boss_kits.dm), put on and sealed by tg's own + * outfit path (quick_activation()) and running on a charged core. It is real gear, locked to them like + * the rest (D3, human_npc_gear.dm): it can't be stripped and never becomes loot, and that goes for a + * MODsuit's pieces, core, cell, modules and what its storage holds, all inside the body's contents. * - 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. + * and can come off again like on anyone. An empty slot takes one the ordinary way. A MODsuit's helmet or + * chestplate is the whole suit's: the suit comes off as one and is gone, everything in it with it. * - The pad gives the crew back everything they put on the body (bounty_return_crew_items()). */ @@ -100,12 +103,42 @@ GLOBAL_LIST_INIT(bounty_armoured_suits, list( /** * 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 + * a null helmet keeping its own (already sealed), or list(MODsuit control unit typepath). 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 mini-boss's MODsuit (bounty_sealed_gear()): a real tg suit of one theme, a BOUNTY_BOSS_MODSUIT_CELL in its + * standard core, and an expanded storage module for what its bag would hold, the suit taking the bag's place + * on its back. No other modules than the theme's own built-in ones. + */ +/obj/item/mod/control/pre_equipped/bounty_boss + applied_cell = BOUNTY_BOSS_MODSUIT_CELL + applied_modules = list(/obj/item/mod/module/storage/large_capacity) + +/// The Juggernaut's: a security suit, the nearest to its riot plates +/obj/item/mod/control/pre_equipped/bounty_boss/security + theme = /datum/mod_theme/security + +/// The Pyromaniac's: an atmospherics suit, fireproof like its fire suit +/obj/item/mod/control/pre_equipped/bounty_boss/atmospheric + theme = /datum/mod_theme/atmospheric + +/// The Demolitionist's: an engineering suit, as tough as its hard hat +/obj/item/mod/control/pre_equipped/bounty_boss/engineering + theme = /datum/mod_theme/engineering + +/// The Ghost's and the cyberpsycho's: a civilian suit, as light as what they wear in good air +/obj/item/mod/control/pre_equipped/bounty_boss/civilian + theme = /datum/mod_theme/civilian + +/// The Heavy's: a magnate suit, its energy armour that of the ablative coat it can't wear out there +/obj/item/mod/control/pre_equipped/bounty_boss/magnate + theme = /datum/mod_theme/magnate + /// 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) @@ -118,9 +151,25 @@ GLOBAL_LIST_INIT(bounty_armoured_suits, list( /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 +// A mini-boss's kit sets its own MODsuit (bounty_boss_kits.dm); one with none (the cyberpsycho) wears plain clothes, so a civilian one /mob/living/carbon/human/npc/bounty_criminal/boss/bounty_sealed_gear() - return pick(GLOB.bounty_soft_suits) + return list(/obj/item/mod/control/pre_equipped/bounty_boss/civilian) + +/** + * A MODsuit draws on its core while it runs (tg's MOD processing), and a dormant body is frozen in time + * (human_npc.dm): like a space suit's thermal regulator, the suit is paused while its wearer is dormant + * and runs again when it wakes, so its core doesn't run flat before anyone arrives. Performance only: a + * waking boss's suit is the same suit with the same charge, sealed all along. + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/npc_set_suit_heating(on) + . = ..() + var/obj/item/mod/control/suit = back + if(!istype(suit)) + return + if(on) + START_PROCESSING(SSobj, suit) + else + STOP_PROCESSING(SSobj, suit) /mob/living/carbon/human/npc/bounty_companion/bounty_sealed_gear() return pick(GLOB.bounty_soft_suits) @@ -141,22 +190,33 @@ GLOBAL_LIST_INIT(bounty_armoured_suits, list( /** * `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). + * the air tank. Anything the old suit held moves to the backpack, as the base's layers do. A MODsuit goes + * on its back in place of its bag, what the bag held going in the suit's storage, and its suit and head + * slots are left for the chestplate and helmet it deploys (its gauntlets and boots go on over gloves and + * shoes). 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)) + if(!length(gear)) + return outfit + var/modsuit = ispath(gear[1], /obj/item/mod/control) + if(!modsuit && (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) + if(dressed.back || modsuit) LAZYADDASSOC(dressed.backpack_contents, dressed.suit_store, 1) dressed.suit_store = null + if(modsuit) + dressed.back = gear[1] + dressed.suit = null + dressed.head = null + return dressed dressed.suit = gear[1] var/obj/item/clothing/own_head = dressed.head if(ispath(gear[2], /obj/item/clothing/head)) @@ -185,6 +245,13 @@ GLOBAL_LIST_INIT(bounty_armoured_suits, list( * 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. */ +/// The MODsuit on its back, if `worn` is one of that suit's pieces +/mob/living/carbon/human/npc/bounty_criminal/proc/suits_modsuit_of(obj/item/worn) + var/obj/item/mod/control/suit = back + if(istype(suit) && (worn in suit.get_parts(all = TRUE))) + return suit + return null + /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 @@ -227,6 +294,9 @@ GLOBAL_LIST_INIT(bounty_armoured_suits, list( /** * 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. + * A MODsuit's helmet or chestplate takes the whole suit with it: it comes off its back (tg's own clean + * up unseals it and pulls its pieces back in, the gloves and shoes it covered going back on) and is gone, + * its core, modules and storage with it. * 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. */ @@ -241,7 +311,12 @@ GLOBAL_LIST_INIT(bounty_armoured_suits, list( return FALSE if(!user.temporarilyRemoveItemFromInventory(garment)) return FALSE - qdel(worn) + var/obj/item/mod/control/modsuit = suits_modsuit_of(worn) + if(modsuit) + temporarilyRemoveItemFromInventory(modsuit, force = TRUE) + qdel(modsuit) + else + 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 diff --git a/voidcrew/modules/bounties/bounty_types.dm b/voidcrew/modules/bounties/bounty_types.dm index 12943ae57fd..19c63aee04c 100644 --- a/voidcrew/modules/bounties/bounty_types.dm +++ b/voidcrew/modules/bounties/bounty_types.dm @@ -68,6 +68,8 @@ GLOBAL_LIST_EMPTY(bounty_prisoner_pool) var/style /// BOUNTY_KIT_* for a mini-boss, else null var/kit + /// The chrome they carry (BOUNTY_CHROME_* keys), rolled once with the record, or null (bounty_chrome.dm). Real implants in their body; a prisoner's isn't installed. + var/list/chrome /// Distinguishing features, as P1's feature keys; feature_lines() turns them into examine lines var/list/features /// What carries into the prison beyond the tier: P1's trait keys, which P7's danger helpers read diff --git a/voidcrew/modules/bounties/chrome/bounty_chrome_cascade.dm b/voidcrew/modules/bounties/chrome/bounty_chrome_cascade.dm new file mode 100644 index 00000000000..b4fbd38602a --- /dev/null +++ b/voidcrew/modules/bounties/chrome/bounty_chrome_cascade.dm @@ -0,0 +1,169 @@ +/** + * # Bounty chrome: the Cascade lattice + * + * Owner: C1. A criminal's Cascade lattice is the player's implant + * (/obj/item/organ/cyberimp/cyberware/cascade, ware_legend.dm): the surge, its eight seconds of + * speed, quicker blows, afterimages and dodge on the move, the six second crash, the minute's + * cooldown, and an EMP in the window crashing it, are all the implant's own. Nothing here changes + * them. This file is only how an NPC uses it (owner decision 5): + * - The tell (/datum/bounty_chrome_move/cascade, through C0's bounty_chrome.dm): a violet glow and + * a rising whine, standing still, for BOUNTY_CHROME_TELL_MIN; then the lattice's own Cascade Surge, + * Trigger()ed as a player's button press. It starts only with its target close and in sight, and + * never on a mini-boss whose kit fires the lattice itself (the Ghost's dash, bounty_boss_kits.dm): + * one lattice, one driver. + * - In the window its body has the lattice's speed, and its AI's own movement loop is paced by that + * body (the controller's movement_delay follows cached_multiplicative_slowdown), so a fighter who + * closes in runs a hunter down with no help from here. A gunman would stand and shoot, and the + * lattice only dodges on the move, so it strafes (strafe()): a step across its line to its target, + * never sooner than its body's own move delay allows, at most every BOUNTY_CASCADE_STRAFE_GAP, + * never while its AI is walking it and never off its leash (bounty_ai_step()). Each step leaves the + * lattice's afterimage, so the surge shows on a gunman too. + */ + +/// Furthest its target may be for it to surge, in tiles +#define BOUNTY_CASCADE_RANGE 7 +/// The glow through the tell +#define BOUNTY_CASCADE_COLOR "#c86bff" +/// How often the window's strafing looks for a step +#define BOUNTY_CASCADE_STRAFE_PULSE (0.1 SECONDS) +/// Shortest time between two strafing steps (its body's move delay may make it longer) +#define BOUNTY_CASCADE_STRAFE_GAP (0.4 SECONDS) + +/datum/bounty_chrome_move/cascade + piece_key = BOUNTY_CHROME_CASCADE + name = "Cascade surge" + action_type = /datum/action/cooldown/cyberware/cascade_surge + tell_time = BOUNTY_CHROME_TELL_MIN + tell_color = BOUNTY_CASCADE_COLOR + tell_sound = 'sound/effects/magic/charge.ogg' + tell_lines = list("Try and keep up.", "Watch this.", "Too slow.") + max_range = BOUNTY_CASCADE_RANGE + /// The window's strafing loop, while the lattice's window is open + var/strafe_timer + /// world.time its owner last took a step, by any means + var/last_step_at = 0 + /// world.time its next strafing step may come + var/next_strafe_at = 0 + /// The way its last strafing step went: the next one goes back the other way when it can, a zig-zag rather than a drift + var/last_strafe_dir = NONE + +/datum/bounty_chrome_move/cascade/Destroy() + stop_strafing() + return ..() + +/datum/bounty_chrome_move/cascade/detach() + stop_strafing() + return ..() + +/datum/bounty_chrome_move/cascade/can_start(atom/target) + if(kit_drives_lattice()) + return FALSE + return ..() + +/datum/bounty_chrome_move/cascade/tell_text(atom/target) + return "[owner]'s spine lights up with a rising whine." + +/datum/bounty_chrome_move/cascade/effect(atom/target) + . = ..() + if(.) + start_strafing() + +/datum/bounty_chrome_move/cascade/on_death() + stop_strafing() + +/// Whether its owner is a mini-boss whose kit fires this lattice itself (the Ghost's dash): the AI here never does too +/datum/bounty_chrome_move/cascade/proc/kit_drives_lattice() + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner + return istype(boss) && (/obj/item/organ/cyberimp/cyberware/cascade in bounty_chrome_kit_organs(boss.boss_kit)) + +/// Whether the lattice's window is open on its owner now +/datum/bounty_chrome_move/cascade/proc/surging() + return !QDELETED(owner) && !!owner.has_status_effect(/datum/status_effect/cyberware_cascade_window) + +/// The window just opened: a fighter with a gun or bottles strafes until the window closes (a brawler or a mini-boss just closes in) +/datum/bounty_chrome_move/cascade/proc/start_strafing() + stop_strafing() + var/datum/bounty_style/style = bounty_ai_style(owner) + if(!style?.ranged || !surging()) + return + RegisterSignal(owner, COMSIG_MOVABLE_MOVED, PROC_REF(on_owner_moved)) + last_step_at = world.time + next_strafe_at = world.time + BOUNTY_CASCADE_STRAFE_GAP + strafe_timer = addtimer(CALLBACK(src, PROC_REF(strafe_pulse)), BOUNTY_CASCADE_STRAFE_PULSE, TIMER_STOPPABLE | TIMER_DELETE_ME | TIMER_LOOP) + +/// Stops the strafing loop. Safe at any time. +/datum/bounty_chrome_move/cascade/proc/stop_strafing() + if(strafe_timer) + deltimer(strafe_timer) + strafe_timer = null + if(owner) + UnregisterSignal(owner, COMSIG_MOVABLE_MOVED) + +/// One beat of the loop: a strafing step if one is due, and the loop ends with the window +/datum/bounty_chrome_move/cascade/proc/strafe_pulse() + if(!surging()) + stop_strafing() + return + strafe() + +/datum/bounty_chrome_move/cascade/proc/on_owner_moved(atom/movable/source, atom/old_loc, dir, forced) + SIGNAL_HANDLER + last_step_at = world.time + +/** + * A gunman in the lattice's window takes a step across its line to its target, keeping its distance and its + * sight of them, the way a player with a lattice keeps moving to keep the dodge: never sooner than its + * body's move delay after its last step, at most every BOUNTY_CASCADE_STRAFE_GAP, never while its AI + * is walking it, held still or not able to fight, and only on its leash (bounty_ai_step()). A fighter + * without a gun ready in hand closes in through its AI instead. Returns TRUE if it stepped. + */ +/datum/bounty_chrome_move/cascade/proc/strafe() + if(QDELETED(owner) || world.time < next_strafe_at || world.time < last_step_at + owner.cached_multiplicative_slowdown) + return FALSE + if(!surging() || !bounty_chrome_can_act(owner) || !bounty_chrome_in_fight(owner) || !bounty_ai_fighting(owner)) + return FALSE + if(owner.buckled || owner.pulledby || HAS_TRAIT(owner, TRAIT_IMMOBILIZED) || !(owner.mobility_flags & MOBILITY_MOVE)) + return FALSE + var/datum/ai_controller/controller = owner.ai_controller + if(QDELETED(controller) || controller.ai_movement?.moving_controllers[controller]) + return FALSE + var/datum/bounty_style/style = bounty_ai_style(owner) + if(!style?.ranged || !style.ready_in_hand(owner)) + return FALSE + var/atom/target = bounty_chrome_target(owner) + var/turf/here = get_turf(owner) + var/turf/aim = get_turf(target) + if(!here || !aim || aim.z != here.z) + return FALSE + var/distance = get_dist(here, aim) + if(distance < 2 || distance > BOUNTY_FIGHT_VISION) + return FALSE + var/list/sides = shuffle(strafe_dirs(here, aim)) + var/back = REVERSE_DIR(last_strafe_dir) + if(back in sides) + sides -= back + sides.Insert(1, back) + for(var/side in sides) + var/turf/spot = get_step(here, side) + if(!spot || isspaceturf(spot) || isopenspaceturf(spot) || get_dist(spot, aim) > distance || !can_see(spot, aim, BOUNTY_FIGHT_VISION)) + continue + // The glide its body's own pace gives a step, as its movement loop sets it + owner.set_glide_size(DELAY_TO_GLIDE_SIZE(owner.cached_multiplicative_slowdown)) + if(!bounty_ai_step(owner, spot)) + continue + next_strafe_at = world.time + BOUNTY_CASCADE_STRAFE_GAP + last_strafe_dir = side + owner.face_atom(target) + return TRUE + return FALSE + +/// The two cardinal steps across the line from `here` to `aim`: north and south of a target mostly east or west, east and west of one mostly north or south +/datum/bounty_chrome_move/cascade/proc/strafe_dirs(turf/here, turf/aim) + if(abs(aim.x - here.x) >= abs(aim.y - here.y)) + return list(NORTH, SOUTH) + return list(EAST, WEST) + +#undef BOUNTY_CASCADE_RANGE +#undef BOUNTY_CASCADE_COLOR +#undef BOUNTY_CASCADE_STRAFE_PULSE +#undef BOUNTY_CASCADE_STRAFE_GAP diff --git a/voidcrew/modules/bounties/chrome/bounty_chrome_deadeye.dm b/voidcrew/modules/bounties/chrome/bounty_chrome_deadeye.dm new file mode 100644 index 00000000000..a78ba8add97 --- /dev/null +++ b/voidcrew/modules/bounties/chrome/bounty_chrome_deadeye.dm @@ -0,0 +1,194 @@ +/// How far it locks on: the implant's tag range (CYBERWARE_DEADEYE_TAG_RANGE, ware_pro_combat.dm) +#define BOUNTY_DEADEYE_RANGE 9 +/// The lock's tell: red eyes and a red laser line on the mark, before the tag lands +#define BOUNTY_DEADEYE_TELL (1 SECONDS) +/// After a fight starts, how soon it locks on: early, so the tell runs while it draws and the first homing rounds come while the fight is young +#define BOUNTY_DEADEYE_OPENING (0.5 SECONDS) +/// The same for an SMG, if that style exists (a homing burst that early outguns most hunters) +#define BOUNTY_DEADEYE_OPENING_SMG (2 SECONDS) +/// How often a held tag checks the mark is still in sight and on its feet +#define BOUNTY_DEADEYE_WATCH (0.5 SECONDS) +/// The red of the eyes, the line and the outline: the implant's reticle red +#define BOUNTY_DEADEYE_RED "#ff3300" +/// The eye-colour priority of the red eyes while it holds a lock (over a cultist's) +#define BOUNTY_DEADEYE_EYES_PRIORITY (EYE_COLOR_CULT_PRIORITY + 10) + +/** + * # Deadeye link on a bounty gunman + * + * The optics players buy (/obj/item/organ/eyes/robotic/cyberware/deadeye, ware_pro_combat.dm), used as a + * player would: tag whoever it is shooting at, then shoot. The tag, its reticle on the mark, its three + * homing rounds, its 15 seconds and its 25 second cooldown are all the implant's; the AI picks the moment, + * shows it coming, and lets go when the mark gets away. + * + * - The moment: in a fight with a gun style (bounty_chrome_style_shoots()), at someone it may shoot who + * is on their feet and in sight within the tag's range. The first lock comes BOUNTY_DEADEYE_OPENING + * into the fight (BOUNTY_DEADEYE_OPENING_SMG with an SMG), then whenever the implant is off cooldown. + * - The tell, BOUNTY_DEADEYE_TELL: its eyes go red, a red laser line runs from it to the mark, a red + * outline pulses on it and the scope whirs. It keeps drawing, moving and shooting meanwhile + * (tell_keeps_acting): the lock costs it no shots, which is what makes the optics worth a gunman's while. + * Out of sight when the tell ends, the implant itself refuses the tag. + * - Then the implant's Deadeye Tag, Trigger()ed on the mark as a player's click: its next three rounds + * home in. The eyes stay red while the tag holds. + * - It lets go (the implant's own end_tag(), with its "lost it" chirp) the moment the mark is out of its + * sight or down, and when it goes down itself or the fight ends: breaking line of sight is the answer, + * and a homing round never chases someone round a corner or into crit. Letting go only ever costs it. + */ +/datum/bounty_chrome_move/deadeye + piece_key = BOUNTY_CHROME_DEADEYE + name = "Deadeye tag" + action_type = /datum/action/cooldown/cyberware/deadeye_tag + tell_time = BOUNTY_DEADEYE_TELL + tell_holds_still = FALSE + tell_keeps_acting = TRUE + tell_color = BOUNTY_DEADEYE_RED + tell_sound = 'sound/items/weapons/scope.ogg' + max_range = BOUNTY_DEADEYE_RANGE + /// The opening lock's timer + var/opening_timer + /// The held tag's sight check + var/watch_timer + /// Weakref to who it tagged, while the tag holds + var/datum/weakref/mark_ref + +/datum/bounty_chrome_move/deadeye/detach() + stop() + return ..() + +/datum/bounty_chrome_move/deadeye/Destroy() + stop() + return ..() + +/// Its optics, if they are in its owner +/datum/bounty_chrome_move/deadeye/proc/optics() + var/obj/item/organ/eyes/robotic/cyberware/deadeye/optics = owner?.get_organ_slot(ORGAN_SLOT_EYES) + return istype(optics) ? optics : null + +/datum/bounty_chrome_move/deadeye/can_start(atom/target) + if(!..()) + return FALSE + var/mob/living/mark = target + if(!isliving(mark) || mark.stat != CONSCIOUS) + return FALSE + var/datum/bounty_style/style = bounty_ai_style(owner) + if(!bounty_chrome_style_shoots(style?.key)) + return FALSE + // One lock at a time: a tag still holding is the implant's to spend + var/obj/item/organ/eyes/robotic/cyberware/deadeye/optics = optics() + return !optics?.tagged_ref?.resolve() + +/datum/bounty_chrome_move/deadeye/tell_text(atom/target) + return "[owner]'s eyes flash red." + +/datum/bounty_chrome_move/deadeye/tell(atom/target) + ..() + if(QDELETED(owner) || QDELETED(target)) + return + bounty_chrome_red_eyes(owner, REF(src), BOUNTY_DEADEYE_EYES_PRIORITY, TRUE, BOUNTY_DEADEYE_RED) + add_mark(owner.Beam(target, icon_state = "r_beam", time = tell_time, maxdistance = BOUNTY_DEADEYE_RANGE + 1)) + +/datum/bounty_chrome_move/deadeye/effect(atom/target) + . = ..() + var/obj/item/organ/eyes/robotic/cyberware/deadeye/optics = optics() + if(!. || QDELETED(target) || optics?.tagged_ref?.resolve() != target) + eyes_off() + return + mark_ref = WEAKREF(target) + deltimer(watch_timer) + watch_timer = addtimer(CALLBACK(src, PROC_REF(watch)), BOUNTY_DEADEYE_WATCH, TIMER_STOPPABLE | TIMER_LOOP | TIMER_DELETE_ME) + +/datum/bounty_chrome_move/deadeye/cancel(reason) + eyes_off() + +/datum/bounty_chrome_move/deadeye/on_fight_start(atom/target) + deltimer(opening_timer) + opening_timer = addtimer(CALLBACK(src, PROC_REF(open)), opening_delay(), TIMER_STOPPABLE | TIMER_DELETE_ME) + +/datum/bounty_chrome_move/deadeye/on_fight_end() + deltimer(opening_timer) + opening_timer = null + let_go() + +/datum/bounty_chrome_move/deadeye/on_downed() + deltimer(opening_timer) + opening_timer = null + let_go() + +/datum/bounty_chrome_move/deadeye/on_death() + stop() + +/// How soon into a fight its first lock comes +/datum/bounty_chrome_move/deadeye/proc/opening_delay() +#ifdef BOUNTY_STYLE_SMG + var/datum/bounty_style/style = bounty_ai_style(owner) + if(style?.key == BOUNTY_STYLE_SMG) + return BOUNTY_DEADEYE_OPENING_SMG +#endif + return BOUNTY_DEADEYE_OPENING + +/// The opening lock, early in the fight: its tell starts now if it can (the framework's opening gap is for the other moves) +/datum/bounty_chrome_move/deadeye/proc/open() + opening_timer = null + var/datum/component/bounty_chrome/chrome = owner?.GetComponent(/datum/component/bounty_chrome) + if(!chrome?.fighting || chrome.telling) + return + var/atom/target = bounty_chrome_target(owner) + if(can_start(target)) + chrome.start_move(src, target) + +/// The held tag's look: it lets go when the mark is out of sight or down, or it can't shoot anyway; it stops looking once the implant has spent or dropped the tag +/datum/bounty_chrome_move/deadeye/proc/watch() + var/mob/living/mark = mark_ref?.resolve() + var/obj/item/organ/eyes/robotic/cyberware/deadeye/optics = optics() + if(!mark || QDELETED(owner) || optics?.tagged_ref?.resolve() != mark) + stop() + return + if(owner.stat != CONSCIOUS || mark.stat != CONSCIOUS || !bounty_ai_can_see(owner, mark, BOUNTY_DEADEYE_RANGE)) + let_go(lost = TRUE) + +/// Lets go of its tag through the implant's own end_tag(), if it holds one. `lost`: the mark got away, and the optics chirp. +/datum/bounty_chrome_move/deadeye/proc/let_go(lost = FALSE) + var/mob/living/mark = mark_ref?.resolve() + var/obj/item/organ/eyes/robotic/cyberware/deadeye/optics = optics() + if(mark && optics?.tagged_ref?.resolve() == mark) + optics.end_tag(owner) + if(lost && owner.stat == CONSCIOUS) + playsound(owner, 'sound/machines/synth/synth_no.ogg', 30, TRUE) + stop() + +/// Stops watching a tag (whatever became of it) and its eyes go back to their own colour +/datum/bounty_chrome_move/deadeye/proc/stop() + deltimer(watch_timer) + watch_timer = null + mark_ref = null + eyes_off() + +/datum/bounty_chrome_move/deadeye/proc/eyes_off() + if(owner) + bounty_chrome_red_eyes(owner, REF(src), BOUNTY_DEADEYE_EYES_PRIORITY, FALSE) + +/** + * Turns `npc`'s eyes `color` (on) or back (off) for `source`, at eye-colour `priority` (tg's own + * add_eye_color(), as a cultist's go red), and gives examine its "eyes are glowing" line. A look only. + * Each source keeps its own priority, so two of them never clear each other's. Redline uses it too. + */ +/proc/bounty_chrome_red_eyes(mob/living/carbon/human/npc, source, priority, on, color = BOUNTY_DEADEYE_RED) + if(!ishuman(npc) || QDELETED(npc)) + return + var/had = !isnull(LAZYACCESS(npc.eye_color_left_overrides, "[priority]")) + if(on) + ADD_TRAIT(npc, TRAIT_UNNATURAL_RED_GLOWY_EYES, source) + if(!had) + npc.add_eye_color(color, priority) + return + REMOVE_TRAIT(npc, TRAIT_UNNATURAL_RED_GLOWY_EYES, source) + if(had) + npc.remove_eye_color(priority) + +#undef BOUNTY_DEADEYE_RANGE +#undef BOUNTY_DEADEYE_TELL +#undef BOUNTY_DEADEYE_OPENING +#undef BOUNTY_DEADEYE_OPENING_SMG +#undef BOUNTY_DEADEYE_WATCH +#undef BOUNTY_DEADEYE_RED +#undef BOUNTY_DEADEYE_EYES_PRIORITY diff --git a/voidcrew/modules/bounties/chrome/bounty_chrome_gorilla.dm b/voidcrew/modules/bounties/chrome/bounty_chrome_gorilla.dm new file mode 100644 index 00000000000..30b56a46aa3 --- /dev/null +++ b/voidcrew/modules/bounties/chrome/bounty_chrome_gorilla.dm @@ -0,0 +1,816 @@ +/** + * # Bounty chrome: Gorilla Arms + * + * Owner: C2 (Mantis Blades and Gorilla Arms). Built on the chrome core, bounty_chrome.dm. + * + * The player's Gorilla Arms (voidcrew/modules/cyberware/ware_military_arms.dm), the real pair of myomer + * lattices, in a brawler, a brawler companion or a Juggernaut. Everything they do is the implant's: a punch + * from an arm whose own 4 second cooldown is over is its empowered punch (flat brute, wound bonus, a knock + * back a tile), the same punch on someone it holds in an aggressive grab hurls them across the room, and + * with both arms in it pries airlocks open by hand. The AI only chooses how to use them, with a tell of at + * least BOUNTY_CHROME_TELL_MIN before each big blow (owner decision 5): + * - Ordinary blows (/datum/ai_behavior/basic_melee_attack/human_npc/bounty/gorilla) are thrown with a fist + * whose punch isn't loaded, so they are plain punches. Its loaded fists wait for the two told moves. + * - The piston punch (/datum/bounty_chrome_move/gorilla_punch): it draws back a fist in an orange outline + * and the tile it aims at lights up, then it punches with a loaded arm: the implant's punch. Stepping off + * the lit tile makes it hit air. + * - The grab (/datum/bounty_chrome_move/gorilla_grab): with one fist just used and the other loaded, it + * reaches for someone beside it and takes hold, tg's own pull (the player's first ctrl-click), while an + * orange ring lights under them. A step away or Resist breaks that at once. If they stay, the grip + * tightens into tg's aggressive grab (the second ctrl-click); then two punches to the face with the used + * fist (tg's grapple pummel), and the loaded fist's punch, which on someone held fast is the implant's + * hurl. tg's grab rules hold throughout: Resist struggles free at tg's odds, a friend can pull them away, + * and a stun, a knockdown, cuffs or an EMP make it let go. It never grabs someone on the floor, held by + * someone else, or someone it just let go of (BOUNTY_GORILLA_GRAB_GUARD), and it never throws anyone + * toward a drop, lava or space. + * - Doors (/datum/bounty_chrome_move/gorilla_doors): when whoever it fights is behind a closed airlock + * near it, it puts a hand on the door out of combat mode, as the set bonus lets a player: an unpowered + * door gives at once, a powered one after the implant's slow pry, and bolts, welds and seals hold (the + * implant refuses them, and the AI leaves them alone). Only on its own ground (environment_damage_allowed()): + * never a ship, a hangar, an outpost, or a door with space or a big pressure difference behind it. + * + * A Juggernaut carrying the arms gets the grab as an ability in its own rotation (the core's adaptor); its + * own blows are its kit's melee, so the implant empowers them as it would a player's. + */ + +/// The piston punch's tell: the fist drawn back, long enough to step off the lit tile +#define BOUNTY_GORILLA_PUNCH_TELL (0.8 SECONDS) +/// The grab's tell, a hand on them: long enough to pull free before the grip tightens +#define BOUNTY_GORILLA_GRAB_TELL (0.8 SECONDS) +/// The first piston punch and the first grab of a fight come no sooner than these +#define BOUNTY_GORILLA_PUNCH_OPENING (1.5 SECONDS) +#define BOUNTY_GORILLA_GRAB_OPENING (3 SECONDS) +/// Between two grabs of one gorilla +#define BOUNTY_GORILLA_GRAB_COOLDOWN (12 SECONDS) +/// Someone it let go of isn't grabbed by it again for this long +#define BOUNTY_GORILLA_GRAB_GUARD (12 SECONDS) +/// Punches to the face before the finisher +#define BOUNTY_GORILLA_PUMMEL_PUNCHES 2 +/// It lets go after holding someone fast this long, whatever became of the punches +#define BOUNTY_GORILLA_HOLD_MAX (4 SECONDS) +/** + * A grab starts only while its used fist stays unloaded at least this long: the tell, the second + * ctrl-click and both face punches come a click apart (CLICK_CD_MELEE), so the face punches are plain + * ones and only the finisher is the implant's punch (its cooldown is per arm, CYBERWARE_GORILLA_PUNCH_COOLDOWN). + */ +#define BOUNTY_GORILLA_PUMMEL_FIST_LEFT (2.6 SECONDS) +/// How far the implant hurls someone held fast (CYBERWARE_GORILLA_HURL_RANGE), and knocks back anyone else +#define BOUNTY_GORILLA_HURL_RANGE 4 +#define BOUNTY_GORILLA_KNOCKBACK_RANGE 1 +/// Doors: how far one may be to go for, and how near its quarry has to be to it, out of sight, to be taken for behind it +#define BOUNTY_GORILLA_DOOR_REACH 2 +#define BOUNTY_GORILLA_BEHIND_RANGE 5 +/// Someone further off than this isn't worth breaking in for +#define BOUNTY_GORILLA_CHASE_RANGE 9 +/// Someone it lost sight of is still worth a door this long +#define BOUNTY_GORILLA_QUARRY_MEMORY (12 SECONDS) +/// A door it went for is left alone this long, so it doesn't paw at one that won't give +#define BOUNTY_GORILLA_DOOR_RETRY (10 SECONDS) +/// A door with more than this pressure (kPa) between its sides stays shut +#define BOUNTY_GORILLA_PRESSURE_GAP 20 +/// The arms' orange: the outline, and the ring under someone it reaches for (the mark art's red turned orange by a matrix) +#define BOUNTY_GORILLA_COLOR "#ff8a1f" +#define BOUNTY_GORILLA_MARK_MATRIX list(1, 0.54, 0.12, 0, 0, 0, 0, 0, 0) +/// Trait source for standing still while it holds someone +#define BOUNTY_GORILLA_TRAIT "bounty_chrome_gorilla" +/// What a mini-boss's boss_busy reads while it holds someone +#define BOUNTY_GORILLA_BOSS_BUSY "gorilla_hold" + +// ===== THE ARMS ===== + +/// The Gorilla Arms lattices in `npc` +/proc/bounty_gorilla_arms(mob/living/carbon/npc) + . = list() + if(QDELETED(npc)) + return + for(var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm in npc.organs) + . += arm + +/// Whether `arm`'s next punch is the implant's: its chrome running and its own cooldown over +/proc/bounty_gorilla_loaded(obj/item/organ/cyberimp/cyberware/gorilla_arms/arm) + var/datum/component/cyberware/chrome = arm?.GetComponent(/datum/component/cyberware) + if(!chrome?.is_running() || (arm.organ_flags & ORGAN_FAILING)) + return FALSE + return COOLDOWN_FINISHED(arm, slam_cooldown) + +/// How long until `arm`'s punch is loaded again: 0 if it is, INFINITY while its chrome is down (its punches are plain ones) +/proc/bounty_gorilla_reload_left(obj/item/organ/cyberimp/cyberware/gorilla_arms/arm) + var/datum/component/cyberware/chrome = arm?.GetComponent(/datum/component/cyberware) + if(!chrome?.is_running() || (arm.organ_flags & ORGAN_FAILING)) + return INFINITY + return COOLDOWN_TIMELEFT(arm, slam_cooldown) + +/// The free hand (a held index) on `arm`'s side of `npc`, or null +/proc/bounty_gorilla_hand(mob/living/carbon/npc, obj/item/organ/cyberimp/cyberware/gorilla_arms/arm) + return npc.get_empty_held_index_for_side(arm.zone == BODY_ZONE_R_ARM ? RIGHT_HANDS : LEFT_HANDS) + +/// The lattice in the arm of `npc`'s hand `index`, or null +/proc/bounty_gorilla_arm_of_hand(mob/living/carbon/npc, index) + var/zone = IS_RIGHT_INDEX(index) ? BODY_ZONE_R_ARM : BODY_ZONE_L_ARM + for(var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm as anything in bounty_gorilla_arms(npc)) + if(arm.zone == zone) + return arm + return null + +/// An arm of `npc`'s whose punch is loaded and whose hand is free, or null +/proc/bounty_gorilla_loaded_arm(mob/living/carbon/npc) + for(var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm as anything in bounty_gorilla_arms(npc)) + if(bounty_gorilla_loaded(arm) && bounty_gorilla_hand(npc, arm)) + return arm + return null + +/** + * An arm of `npc`'s whose loaded punch would hurl someone it holds fast, or null. Only the real Gorilla + * Arms hurl (heavy_moves and a hurl_range: Brawler myomers never do), and the hurl shares the bearer's + * grab-move cooldown with the slam (hyperviolence_gorilla/gorilla_punch.dm, piston_hit()). + */ +/proc/bounty_gorilla_hurl_arm(mob/living/carbon/npc) + if(!TIMER_COOLDOWN_FINISHED(npc, COOLDOWN_GORILLA_GRAB_MOVE)) + return null + for(var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm as anything in bounty_gorilla_arms(npc)) + if(arm.heavy_moves && arm.hurl_range > 0 && bounty_gorilla_loaded(arm) && bounty_gorilla_hand(npc, arm)) + return arm + return null + +/// A free hand of `npc`'s whose punch is a plain one (its arm's punch not loaded), the one furthest from loaded, or null +/proc/bounty_gorilla_plain_hand(mob/living/carbon/npc) + var/best + var/best_left = 0 + for(var/index in npc.get_empty_held_indexes()) + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm = bounty_gorilla_arm_of_hand(npc, index) + var/left = arm ? bounty_gorilla_reload_left(arm) : INFINITY + if(left > best_left) + best = index + best_left = left + return best + +/// Makes `npc`'s hand `index` the one it punches with. TRUE if it is. +/proc/bounty_gorilla_use_hand(mob/living/carbon/npc, index) + if(!index || npc.held_items[index]) + return FALSE + if(npc.active_hand_index != index) + npc.swap_hand(index, silent = TRUE) + return npc.active_hand_index == index + +/// Whether it has the two fists a grab needs: one loaded for the finisher that can hurl, and another that stays unloaded through the face punches +/proc/bounty_gorilla_fists_for_grab(mob/living/carbon/npc) + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/finisher = bounty_gorilla_hurl_arm(npc) + if(!finisher) + return FALSE + for(var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm as anything in bounty_gorilla_arms(npc)) + if(arm != finisher && bounty_gorilla_hand(npc, arm) && bounty_gorilla_reload_left(arm) >= BOUNTY_GORILLA_PUMMEL_FIST_LEFT) + return TRUE + return FALSE + +/// The way `npc` faces `victim` (face_atom()'s rule), which is the way the implant throws them +/proc/bounty_gorilla_facing(atom/npc, atom/victim) + var/dx = victim.x - npc.x + var/dy = victim.y - npc.y + if(abs(dx) < abs(dy)) + return dy > 0 ? NORTH : SOUTH + return dx > 0 ? EAST : WEST + +/// Whether nothing in the `tiles` tiles behind `victim`, seen from `npc`, is a drop, lava or space: where the implant would throw them +/proc/bounty_gorilla_safe_behind(atom/npc, mob/living/victim, tiles) + var/direction = bounty_gorilla_facing(npc, victim) + var/turf/spot = get_turf(victim) + for(var/i in 1 to tiles) + spot = get_step(spot, direction) + if(!spot || isclosedturf(spot)) + return TRUE + if(isspaceturf(spot) || isopenspaceturf(spot) || isgroundlessturf(spot) || islava(spot) || ischasm(spot)) + return FALSE + return TRUE + +// ===== ORDINARY BLOWS ===== + +/** + * A Gorilla Arms carrier's ordinary blows: the bounty brawler's melee (a punch, now and then a shove, + * bounty_styles.dm) thrown with a plain fist. Its loaded fists wait for the piston punch and the grab, + * which it tells first; with no plain fist free it stays on its target and throws nothing. A mech, or + * anything that isn't a person, takes whatever fist. + */ +/datum/ai_behavior/basic_melee_attack/human_npc/bounty/gorilla + +/datum/ai_behavior/basic_melee_attack/human_npc/bounty/gorilla/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key) + var/mob/living/carbon/fighter = controller.pawn + var/atom/target = controller.blackboard[target_key] + if(isliving(target) && !human_npc_held_melee_weapon(fighter)) + if(!bounty_gorilla_use_hand(fighter, bounty_gorilla_plain_hand(fighter))) + return AI_BEHAVIOR_DELAY + return ..() + +// ===== THE PISTON PUNCH ===== + +/** + * The piston punch: a fist drawn back in an orange outline over the lit tile for BOUNTY_GORILLA_PUNCH_TELL, + * then a loaded fist's punch at whoever still stands there, the implant's own. It also runs the gorilla's + * fighting each planning tick (plan()): the grab first when it can start, then this, else its ordinary blows. + */ +/datum/bounty_chrome_move/gorilla_punch + piece_key = BOUNTY_CHROME_GORILLA + name = "piston punch" + tell_time = BOUNTY_GORILLA_PUNCH_TELL + tell_color = BOUNTY_GORILLA_COLOR + tell_sound = 'sound/machines/piston/piston_raise.ogg' + max_range = 1 + // A mini-boss's own blows are the implant's punches already: the grab is the move it gets + boss_usable = FALSE + /// world.time its first piston punch of this fight may start + var/opens_at = 0 + /// world.time this fight started + var/fight_started_at = 0 + /// The tile the fist is aimed at, through the tell + var/turf/aimed_turf + +/datum/bounty_chrome_move/gorilla_punch/detach() + aimed_turf = null + return ..() + +/datum/bounty_chrome_move/gorilla_punch/on_fight_start(atom/target) + fight_started_at = world.time + opens_at = world.time + BOUNTY_GORILLA_PUNCH_OPENING + +/datum/bounty_chrome_move/gorilla_punch/can_start(atom/target) + var/mob/living/victim = target + if(!isliving(victim) || !isturf(victim.loc) || !owner.Adjacent(victim) || bounty_gorilla_held_by_another(victim, owner) || HAS_TRAIT(owner, TRAIT_HANDS_BLOCKED)) + return FALSE + if(!..()) + return FALSE + if(!bounty_gorilla_loaded_arm(owner)) + return FALSE + return bounty_gorilla_safe_behind(owner, victim, BOUNTY_GORILLA_KNOCKBACK_RANGE) + +/datum/bounty_chrome_move/gorilla_punch/plan(datum/ai_controller/controller, atom/target) + var/datum/component/bounty_chrome/chrome = owner.GetComponent(/datum/component/bounty_chrome) + if(!chrome) + return FALSE + var/datum/bounty_chrome_move/gorilla_grab/grab = chrome.move_of(/datum/bounty_chrome_move/gorilla_grab) + if(grab) + if(grab.held_ref) + // It is holding someone: its grab's own clock throws the punches + return TRUE + if(grab.may_go_now() && grab.can_start(target) && chrome.start_move(grab, target)) + return TRUE + if(grab.pending(target)) + // The fist it just used is the one the face punches come from: it closes in for the grab and throws nothing meanwhile + controller.queue_behavior(/datum/ai_behavior/human_npc_close_in, BB_BASIC_MOB_CURRENT_TARGET, 1) + return TRUE + if(bounty_melee_chrome_may_start(owner, opens_at, fight_started_at) && can_start(target) && chrome.start_move(src, target)) + return TRUE + // Another piece's move that plans its own behaviours, and comes after this one, plans first: ending the planning here would starve it + var/after = chrome.moves.Find(src) + for(var/index in after + 1 to length(chrome.moves)) + var/datum/bounty_chrome_move/later = chrome.moves[index] + if(later.piece_key != BOUNTY_CHROME_GORILLA && later.plan(controller, target)) + return TRUE + // Another piece's move is ready: the core starts it, so planning goes on to it + if(world.time >= chrome.next_move_at) + for(var/datum/bounty_chrome_move/other as anything in chrome.moves) + if(other.action_type && other.can_start(target)) + return FALSE + // Its ordinary blows, with a plain fist. Anything in its hands fights by the style's own melee. + if(!isliving(target) || human_npc_held_melee_weapon(owner)) + return FALSE + controller.queue_behavior(/datum/ai_behavior/basic_melee_attack/human_npc/bounty/gorilla, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETING_STRATEGY, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION) + return TRUE + +/datum/bounty_chrome_move/gorilla_punch/tell_text(atom/target) + return "[owner] draws back a chrome fist!" + +/datum/bounty_chrome_move/gorilla_punch/tell(atom/target) + ..() + aimed_turf = get_turf(target) + if(aimed_turf) + add_mark(new /obj/effect/temp_visual/bounty_boss_mark(aimed_turf, tell_time + 1)) + +/datum/bounty_chrome_move/gorilla_punch/effect(atom/target) + var/turf/spot = aimed_turf + aimed_turf = null + var/mob/living/victim = target + if(!isliving(victim) || QDELETED(victim) || get_turf(victim) != spot || !owner.Adjacent(victim)) + // They stepped off the lit tile + if(spot && owner.Adjacent(spot)) + owner.face_atom(spot) + owner.do_attack_animation(spot) + playsound(owner, 'sound/items/weapons/punchmiss.ogg', 50, TRUE) + owner.visible_message(span_warning("[owner]'s fist swings through empty air.")) + return FALSE + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm = bounty_gorilla_loaded_arm(owner) + if(!arm || !bounty_gorilla_safe_behind(owner, victim, BOUNTY_GORILLA_KNOCKBACK_RANGE)) + return FALSE + if(!bounty_gorilla_use_hand(owner, bounty_gorilla_hand(owner, arm))) + return FALSE + owner.zone_selected = BODY_ZONE_CHEST + return !!owner.ai_controller?.ai_interact(target = victim, combat_mode = TRUE) + +/// Whether someone other than `npc` holds `victim` fast: it doesn't swing at someone who can't step off the lit tile, or grab them from another +/proc/bounty_gorilla_held_by_another(mob/living/victim, mob/living/npc) + return !!victim.pulledby && victim.pulledby != npc && victim.pulledby.grab_state >= GRAB_AGGRESSIVE + +// ===== THE GRAB ===== + +/** + * The grab and pummel. Its tell is a hand on them (tg's pull) and an orange ring under them for + * BOUNTY_GORILLA_GRAB_TELL; then tg's aggressive grab, two face punches with a plain fist and the loaded + * fist's hurl, each a click apart, driven by its own clock (pummel()), not the AI's planning. A mini-boss + * gets it as an ability in its rotation, busy while it holds on. + */ +/datum/bounty_chrome_move/gorilla_grab + piece_key = BOUNTY_CHROME_GORILLA + name = "grab" + tell_time = BOUNTY_GORILLA_GRAB_TELL + tell_color = BOUNTY_GORILLA_COLOR + tell_sound = 'sound/machines/piston/piston_lower.ogg' + max_range = 1 + /// world.time its next grab may start (its opener, then BOUNTY_GORILLA_GRAB_COOLDOWN) + var/grab_ready_at = 0 + /// world.time this fight started + var/fight_started_at = 0 + /// Who its hand is on through the tell + var/datum/weakref/reach_ref + /// Who it holds fast now + var/datum/weakref/held_ref + /// Face punches thrown in this hold + var/punches = 0 + /// Goes up with every hold and every let-go, so a stale timer does nothing + var/hold_serial = 0 + /// The next click of the hold, and the hold's own clock + var/step_timer + var/hold_timer + /// A mini-boss's busy serial while it holds on + var/boss_serial = 0 + /// REF() of someone it let go of -> world.time it may grab them again + var/list/guard + +/datum/bounty_chrome_move/gorilla_grab/attach(mob/living/carbon/human/npc/npc) + . = ..() + // A mini-boss runs it through its own rotation; the core wraps only moves with an implant action, so this one is wrapped here + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = npc + if(istype(boss) && !boss_ability) + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/ability = new(boss) + ability.set_move(src) + ability.Grant(boss) + boss.boss_abilities += ability + +/datum/bounty_chrome_move/gorilla_grab/detach() + let_go() + reach_ref = null + guard = null + return ..() + +/datum/bounty_chrome_move/gorilla_grab/on_fight_start(atom/target) + fight_started_at = world.time + grab_ready_at = max(grab_ready_at, world.time + BOUNTY_GORILLA_GRAB_OPENING) + +/datum/bounty_chrome_move/gorilla_grab/on_fight_end() + let_go() + +/datum/bounty_chrome_move/gorilla_grab/on_downed() + let_go() + +/datum/bounty_chrome_move/gorilla_grab/on_death() + let_go() + +/datum/bounty_chrome_move/gorilla_grab/on_emp(severity) + // Its chrome glitching, it lets go + let_go() + +/datum/bounty_chrome_move/gorilla_grab/plan(datum/ai_controller/controller, atom/target) + // Holding someone, nothing else is planned: its own clock throws the punches + return !!held_ref + +/** + * Whether its other chrome lets the grab start now: past the gap after the last move fired, or straight + * after a piston punch, the fist that punch used being the one the face punches come from. + */ +/datum/bounty_chrome_move/gorilla_grab/proc/may_go_now() + var/datum/component/bounty_chrome/chrome = owner?.GetComponent(/datum/component/bounty_chrome) + if(!chrome || chrome.telling) + return FALSE + if(world.time >= chrome.next_move_at) + return TRUE + var/datum/bounty_chrome_move/gorilla_punch/punch = chrome.move_of(/datum/bounty_chrome_move/gorilla_punch) + if(!punch?.last_fired || punch.last_fired < fight_started_at) + return FALSE + return punch.last_fired > bounty_melee_chrome_last_move_at(owner, list(/datum/bounty_chrome_move/gorilla_punch)) + +/datum/bounty_chrome_move/gorilla_grab/can_start(atom/target) + var/mob/living/victim = target + if(held_ref || world.time < grab_ready_at || world.time < owner.next_move || HAS_TRAIT(owner, TRAIT_HANDS_BLOCKED) || !may_grab(victim)) + return FALSE + if(!..()) + return FALSE + if(!bounty_gorilla_fists_for_grab(owner)) + return FALSE + return bounty_gorilla_safe_behind(owner, victim, BOUNTY_GORILLA_HURL_RANGE) + +/// Whether a grab at `target` could follow as soon as it is beside them: its fists and its other chrome allow one now, and they are someone it may grab +/datum/bounty_chrome_move/gorilla_grab/proc/pending(atom/target) + if(held_ref || world.time < grab_ready_at || !may_go_now() || !bounty_gorilla_fists_for_grab(owner)) + return FALSE + var/mob/living/victim = target + return may_grab(victim, need_adjacent = FALSE) && bounty_ai_dist(owner, victim) <= 2 && bounty_chrome_can_act(owner) + +/** + * Whether it may take hold of `victim`: someone beside it (unless `need_adjacent` is FALSE), awake and on + * their feet on a tile of their own, whom tg's grab can take hold of and tighten on, not held by anyone + * else, and not someone it let go of in the last BOUNTY_GORILLA_GRAB_GUARD. + */ +/datum/bounty_chrome_move/gorilla_grab/proc/may_grab(mob/living/victim, need_adjacent = TRUE) + if(!isliving(victim) || QDELETED(victim) || victim == owner || !isturf(victim.loc) || victim.buckled || victim.anchored) + return FALSE + if(victim.stat != CONSCIOUS || victim.body_position == LYING_DOWN || (need_adjacent && !owner.Adjacent(victim))) + return FALSE + // tg's grab never tightens on these (grabbedby()) + if(issilicon(victim) || !(victim.status_flags & CANPUSH) || HAS_TRAIT(victim, TRAIT_PUSHIMMUNE)) + return FALSE + if(victim.pulledby && victim.pulledby != owner) + return FALSE + if(LAZYACCESS(guard, REF(victim)) > world.time) + return FALSE + return victim.can_be_pulled(owner, owner.pull_force) + +/datum/bounty_chrome_move/gorilla_grab/tell_text(atom/target) + return "[owner] reaches for [target] with both chrome hands!" + +/datum/bounty_chrome_move/gorilla_grab/tell(atom/target) + ..() + grab_ready_at = world.time + BOUNTY_GORILLA_GRAB_COOLDOWN + var/turf/spot = get_turf(target) + if(spot) + add_mark(new /obj/effect/temp_visual/bounty_boss_mark(spot, tell_time + 1, BOUNTY_GORILLA_MARK_MATRIX, "target_circle")) + var/mob/living/victim = target + if(!isliving(victim)) + return + // Its hand on them: tg's pull, a player's first ctrl-click. It hurts nobody, and a step or Resist breaks it. + reach_ref = WEAKREF(victim) + grab_click(victim) + +/// A player's ctrl-click on `victim`: tg's grab, a pull the first time and the grip tightened the next +/datum/bounty_chrome_move/gorilla_grab/proc/grab_click(mob/living/victim) + return !!owner.ai_controller?.ai_interact(target = victim, modifiers = list(CTRL_CLICK = TRUE)) + +/datum/bounty_chrome_move/gorilla_grab/cancel(reason) + // Cut short with its hand on them: it lets go + var/mob/living/victim = reach_ref?.resolve() + reach_ref = null + if(victim && !QDELETED(owner) && owner.pulling == victim && !held_ref) + owner.stop_pulling() + +/datum/bounty_chrome_move/gorilla_grab/effect(atom/target) + var/mob/living/victim = reach_ref?.resolve() + reach_ref = null + if(!isliving(victim) || victim != target || owner.pulling != victim) + return FALSE + if(!may_hold(victim)) + owner.stop_pulling() + return FALSE + // They stayed: the grip tightens, the second ctrl-click + grab_click(victim) + if(!holding(victim)) + if(owner.pulling == victim) + owner.stop_pulling() + return FALSE + start_hold(victim) + return TRUE + +/// Whether it holds `victim` fast now: tg's aggressive grab, its own +/datum/bounty_chrome_move/gorilla_grab/proc/holding(mob/living/victim) + return !QDELETED(owner) && !QDELETED(victim) && owner.pulling == victim && owner.grab_state >= GRAB_AGGRESSIVE + +/// Whether `victim` is someone it goes on holding: awake, on their feet and beside it +/datum/bounty_chrome_move/gorilla_grab/proc/may_hold(mob/living/victim) + return !QDELETED(victim) && victim.stat == CONSCIOUS && victim.body_position != LYING_DOWN && isturf(victim.loc) && owner.Adjacent(victim) + +/// Whether the hold goes on: it holds them fast, can still act with its hands, isn't cut off as a mini-boss, and they are still someone it holds +/datum/bounty_chrome_move/gorilla_grab/proc/hold_ok(mob/living/victim) + if(!holding(victim) || !may_hold(victim)) + return FALSE + if(!bounty_chrome_can_act(owner) || HAS_TRAIT(owner, TRAIT_HANDS_BLOCKED)) + return FALSE + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner + if(istype(boss) && (boss.boss_busy != BOUNTY_GORILLA_BOSS_BUSY || boss.boss_busy_serial != boss_serial)) + return FALSE + return TRUE + +/// It holds `victim` fast: it stands still, and its clock throws the punches a click apart +/datum/bounty_chrome_move/gorilla_grab/proc/start_hold(mob/living/victim) + held_ref = WEAKREF(victim) + punches = 0 + hold_serial++ + // Struggled free, pulled away by a friend, thrown by the finisher: tg lets go, and it hears of it + RegisterSignal(owner, COMSIG_ATOM_NO_LONGER_PULLING, PROC_REF(on_no_longer_pulling)) + RegisterSignals(owner, list(SIGNAL_ADDTRAIT(TRAIT_INCAPACITATED), SIGNAL_ADDTRAIT(TRAIT_FLOORED), SIGNAL_ADDTRAIT(TRAIT_HANDS_BLOCKED), SIGNAL_ADDTRAIT(TRAIT_RESTRAINED)), PROC_REF(on_disabled)) + ADD_TRAIT(owner, TRAIT_IMMOBILIZED, BOUNTY_GORILLA_TRAIT) + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner + if(istype(boss)) + boss.boss_next_ability_at = max(boss.boss_next_ability_at, world.time + BOUNTY_GORILLA_HOLD_MAX) + boss_serial = boss.boss_set_busy(BOUNTY_GORILLA_BOSS_BUSY, BOUNTY_GORILLA_HOLD_MAX + 1 SECONDS) + hold_timer = addtimer(CALLBACK(src, PROC_REF(hold_expired), hold_serial), BOUNTY_GORILLA_HOLD_MAX, TIMER_STOPPABLE | TIMER_DELETE_ME) + next_click() + +/// Its next click of the hold, the moment its hand is free to click again +/datum/bounty_chrome_move/gorilla_grab/proc/next_click() + deltimer(step_timer) + step_timer = addtimer(CALLBACK(src, PROC_REF(pummel), hold_serial), max(owner.next_move - world.time, 1), TIMER_STOPPABLE | TIMER_DELETE_ME) + +/** + * One click of the hold under `serial`: a punch to the face with a plain fist while any are left, then + * the loaded fist's punch, the implant's hurl. With no loaded fist yet it holds on and waits, until the + * hold's own clock lets them go. If the hold broke meanwhile it lets go and nothing lands. Returns TRUE if + * it threw a punch. + */ +/datum/bounty_chrome_move/gorilla_grab/proc/pummel(serial) + step_timer = null + if(serial != hold_serial || !held_ref) + return FALSE + var/mob/living/victim = held_ref.resolve() + if(!hold_ok(victim)) + let_go() + return FALSE + if(world.time < owner.next_move) + next_click() + return FALSE + if(punches < BOUNTY_GORILLA_PUMMEL_PUNCHES) + var/plain = bounty_gorilla_plain_hand(owner) + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/plain_arm = plain && bounty_gorilla_arm_of_hand(owner, plain) + if(plain && (!plain_arm || !bounty_gorilla_loaded(plain_arm))) + punches++ + punch(victim, plain) + if(serial == hold_serial && held_ref) + next_click() + return TRUE + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/finisher = bounty_gorilla_hurl_arm(owner) + if(!finisher) + // Its loaded fist isn't back yet: it holds on + step_timer = addtimer(CALLBACK(src, PROC_REF(pummel), hold_serial), 1, TIMER_STOPPABLE | TIMER_DELETE_ME) + return FALSE + if(!bounty_gorilla_safe_behind(owner, victim, BOUNTY_GORILLA_HURL_RANGE)) + let_go() + return FALSE + punch(victim, bounty_gorilla_hand(owner, finisher)) + // The fist lands a moment after the click (GORILLA_THRUST_LANDS), and only lands as the hurl while it still holds + // them. The hurl takes them out of its hands (tg ends the pull as they fly); if anything stopped it, it lets go then. + step_timer = addtimer(CALLBACK(src, PROC_REF(after_hurl), hold_serial), GORILLA_THRUST_LANDS + 1, TIMER_STOPPABLE | TIMER_DELETE_ME) + return TRUE + +/// The hurl's fist under `serial` has landed: if it still holds them, something stopped the hurl, and it lets go +/datum/bounty_chrome_move/gorilla_grab/proc/after_hurl(serial) + step_timer = null + if(serial == hold_serial && held_ref) + let_go() + +/// A punch to `victim`'s face with hand `index`: a player's click in combat mode, so tg's punch, or the implant's if that fist is loaded +/datum/bounty_chrome_move/gorilla_grab/proc/punch(mob/living/victim, index) + if(!bounty_gorilla_use_hand(owner, index)) + return FALSE + owner.zone_selected = BODY_ZONE_HEAD + return !!owner.ai_controller?.ai_interact(target = victim, combat_mode = TRUE) + +/// The hold's own clock under `serial` ran out: it lets go +/datum/bounty_chrome_move/gorilla_grab/proc/hold_expired(serial) + hold_timer = null + if(serial == hold_serial && held_ref) + let_go() + +/// tg let go of someone it pulled (inside stop_pulling()). If it was whoever it held, the hold is over. Must not sleep. +/datum/bounty_chrome_move/gorilla_grab/proc/on_no_longer_pulling(datum/source, atom/movable/was_pulling) + SIGNAL_HANDLER + if(was_pulling == held_ref?.resolve()) + end_hold() + +/// Stunned, knocked down, cuffed or its hands tied up mid-hold: it lets go. Inside a signal handler. +/datum/bounty_chrome_move/gorilla_grab/proc/on_disabled(datum/source) + SIGNAL_HANDLER + let_go() + +/// Lets go of whoever it holds, or has its hand on (tg's stop_pulling()). Safe at any time. +/datum/bounty_chrome_move/gorilla_grab/proc/let_go() + var/mob/living/victim = held_ref?.resolve() || reach_ref?.resolve() + end_hold() + reach_ref = null + if(victim && !QDELETED(owner) && owner.pulling == victim) + owner.stop_pulling() + +/// The hold is over: it may move again, a mini-boss is free, and whoever it held isn't grabbed by it again for a while +/datum/bounty_chrome_move/gorilla_grab/proc/end_hold() + if(!held_ref) + return + var/mob/living/victim = held_ref.resolve() + held_ref = null + punches = 0 + hold_serial++ + deltimer(step_timer) + step_timer = null + deltimer(hold_timer) + hold_timer = null + if(owner) + UnregisterSignal(owner, list(COMSIG_ATOM_NO_LONGER_PULLING, SIGNAL_ADDTRAIT(TRAIT_INCAPACITATED), SIGNAL_ADDTRAIT(TRAIT_FLOORED), SIGNAL_ADDTRAIT(TRAIT_HANDS_BLOCKED), SIGNAL_ADDTRAIT(TRAIT_RESTRAINED))) + REMOVE_TRAIT(owner, TRAIT_IMMOBILIZED, BOUNTY_GORILLA_TRAIT) + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner + if(istype(boss) && boss_serial && boss.boss_busy == BOUNTY_GORILLA_BOSS_BUSY && boss.boss_busy_serial == boss_serial) + boss.boss_clear_busy(boss_serial) + boss_serial = 0 + if(!victim) + return + // Forget the guards that are over, then guard this one + for(var/key in guard) + if(guard[key] <= world.time) + guard -= key + LAZYSET(guard, REF(victim), world.time + BOUNTY_GORILLA_GRAB_GUARD) + +// ===== DOORS ===== + +/** + * Doors. Whoever it fights got behind a closed airlock near it: it goes to the door and puts a hand on it + * out of combat mode, which the arms' set bonus turns into the implant's own pry (tg's door_pryer). Looked + * at every Life tick (on_tick()), since the one it fought may no longer be its target once out of sight. + */ +/datum/bounty_chrome_move/gorilla_doors + piece_key = BOUNTY_CHROME_GORILLA + name = "door pry" + boss_usable = FALSE + /// Who it was last fighting, and when it last saw them + var/datum/weakref/quarry_ref + var/quarry_seen_at = 0 + /// REF() of a door it went for -> world.time it may go for it again + var/list/tried + +/datum/bounty_chrome_move/gorilla_doors/detach() + quarry_ref = null + tried = null + return ..() + +/datum/bounty_chrome_move/gorilla_doors/plan(datum/ai_controller/controller, atom/target) + note_quarry(target) + return FALSE + +/datum/bounty_chrome_move/gorilla_doors/on_fight_end() + quarry_ref = null + +/datum/bounty_chrome_move/gorilla_doors/on_tick(seconds_per_tick, fighting, atom/target) + if(!fighting) + quarry_ref = null + return + note_quarry(target) + try_door() + +/// Remembers `target` as who it fights while it can see them +/datum/bounty_chrome_move/gorilla_doors/proc/note_quarry(atom/target) + if(!QDELETED(target) && (isliving(target) || ismecha(target)) && bounty_ai_can_see(owner, target, BOUNTY_GORILLA_CHASE_RANGE)) + quarry_ref = WEAKREF(target) + quarry_seen_at = world.time + +/// Whether the arms' set bonus is working: both arms in and synced, Gorilla or Brawler, so it can force doors +/datum/bounty_chrome_move/gorilla_doors/proc/can_pry() + return gorilla_synced(owner) || brawler_synced(owner) + +/** + * Whoever it is after and can't get at, its target out of sight or behind a closed glass door, or someone + * it lost sight of in the last BOUNTY_GORILLA_QUARRY_MEMORY: if a closed airlock near it is in the way, it + * goes for it, a step to it if need be, then a hand on it. Returns TRUE if it did something. + */ +/datum/bounty_chrome_move/gorilla_doors/proc/try_door() + if(!bounty_chrome_can_act(owner) || QDELETED(owner.ai_controller) || LAZYLEN(owner.do_afters) || HAS_TRAIT(owner, TRAIT_IMMOBILIZED) || HAS_TRAIT(owner, TRAIT_HANDS_BLOCKED) || !can_pry()) + return FALSE + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner + if(istype(boss) && boss.boss_busy) + return FALSE + var/datum/component/bounty_chrome/chrome = owner.GetComponent(/datum/component/bounty_chrome) + var/datum/bounty_chrome_move/gorilla_grab/grab = chrome?.move_of(/datum/bounty_chrome_move/gorilla_grab) + if(chrome?.telling || grab?.held_ref) + return FALSE + var/atom/quarry = bounty_chrome_target(owner) + var/in_sight = FALSE + if(!QDELETED(quarry)) + in_sight = bounty_ai_can_see(owner, quarry, BOUNTY_GORILLA_CHASE_RANGE) + if(in_sight && owner.Adjacent(quarry)) + return FALSE + else + quarry = quarry_ref?.resolve() + if(QDELETED(quarry) || world.time > quarry_seen_at + BOUNTY_GORILLA_QUARRY_MEMORY) + return FALSE + var/turf/goal = get_turf(quarry) + if(!goal || goal.z != owner.z || get_dist(owner, goal) > BOUNTY_GORILLA_CHASE_RANGE || !bounty_ai_may_hit(owner, quarry)) + return FALSE + var/obj/machinery/door/airlock/door = find_door(goal, in_sight) + if(!door) + return FALSE + var/turf/here = get_turf(owner) + var/turf/door_turf = get_turf(door) + if(get_dist(here, door_turf) == 1 && (get_dir(here, door_turf) in GLOB.cardinals)) + LAZYSET(tried, REF(door), world.time + BOUNTY_GORILLA_DOOR_RETRY) + if(!human_npc_ready_empty_hand(owner)) + return FALSE + owner.face_atom(door) + // A hand on the door out of combat mode: the set bonus pries it (tg's door_pryer) + INVOKE_ASYNC(owner.ai_controller, TYPE_PROC_REF(/datum/ai_controller, ai_interact), door, FALSE) + return TRUE + return step_to_door(door) + +/** + * The closed airlock within BOUNTY_GORILLA_DOOR_REACH of it that stands between it and `goal`, nearest + * first: on the straight line to `goal` when it can see there (a glass door), or else nearer `goal` than + * it is and within BOUNTY_GORILLA_BEHIND_RANGE of it. Only one it may force (may_force()). + */ +/datum/bounty_chrome_move/gorilla_doors/proc/find_door(turf/goal, in_sight) + var/turf/here = get_turf(owner) + var/list/line = in_sight ? get_line(here, goal) : null + var/to_goal = get_dist(here, goal) + var/obj/machinery/door/airlock/best + var/best_score = INFINITY + for(var/turf/spot as anything in RANGE_TURFS(BOUNTY_GORILLA_DOOR_REACH, here)) + var/obj/machinery/door/airlock/door = locate() in spot + if(!door) + continue + if(in_sight) + if(!(spot in line)) + continue + else if(get_dist(spot, goal) >= to_goal || get_dist(spot, goal) > BOUNTY_GORILLA_BEHIND_RANGE) + continue + if(!may_force(door)) + continue + var/score = get_dist(here, spot) * 10 + get_dist(spot, goal) + if(score < best_score) + best = door + best_score = score + return best + +/** + * Whether it may go at `door`: shut and not bolted, welded or sealed (the implant won't force those), not + * one it went for a moment ago, on its side's own ground where it may break things + * (environment_damage_allowed(): never a ship, a hangar, an outpost or a trader outpost), and one that lets + * no air out when it opens. + */ +/datum/bounty_chrome_move/gorilla_doors/proc/may_force(obj/machinery/door/airlock/door) + if(QDELETED(door) || !door.density || door.operating || door.locked || door.welded || door.seal) + return FALSE + // A trader outpost's doors refuse the pry (hyperviolence_gorilla/gorilla_pry.dm) + if(gorilla_pry_refused(door)) + return FALSE + if(LAZYACCESS(tried, REF(door)) > world.time) + return FALSE + var/mob/living/carbon/human/npc/bounty_criminal/side = bounty_ai_side_of(owner) + if(!side || !side.environment_damage_allowed(get_turf(door))) + return FALSE + return bounty_gorilla_door_holds_air(door) + +/// One step to a free side of `door` beside it, on its side's leash. Returns TRUE if it moved. +/datum/bounty_chrome_move/gorilla_doors/proc/step_to_door(obj/machinery/door/airlock/door) + var/turf/here = get_turf(owner) + var/turf/door_turf = get_turf(door) + for(var/direction in GLOB.cardinals) + var/turf/beside = get_step(door_turf, direction) + if(!beside || get_dist(here, beside) != 1) + continue + if(bounty_ai_step(owner, beside)) + owner.face_atom(door) + return TRUE + return FALSE + +/** + * Whether opening `door` lets no air out: none of its open sides is space, open space or a drop, and the + * pressures on them are within BOUNTY_GORILLA_PRESSURE_GAP of each other. + */ +/proc/bounty_gorilla_door_holds_air(obj/machinery/door/door) + var/turf/spot = get_turf(door) + if(!spot) + return FALSE + var/lowest = INFINITY + var/highest = 0 + var/sides = 0 + for(var/direction in GLOB.cardinals) + var/turf/beside = get_step(spot, direction) + if(!beside || isclosedturf(beside)) + continue + if(isspaceturf(beside) || isopenspaceturf(beside) || isgroundlessturf(beside)) + return FALSE + var/datum/gas_mixture/air = beside.return_air() + var/pressure = air ? air.return_pressure() : 0 + lowest = min(lowest, pressure) + highest = max(highest, pressure) + sides++ + return sides >= 2 && highest - lowest <= BOUNTY_GORILLA_PRESSURE_GAP + +#undef BOUNTY_GORILLA_PUNCH_TELL +#undef BOUNTY_GORILLA_GRAB_TELL +#undef BOUNTY_GORILLA_PUNCH_OPENING +#undef BOUNTY_GORILLA_GRAB_OPENING +#undef BOUNTY_GORILLA_GRAB_COOLDOWN +#undef BOUNTY_GORILLA_GRAB_GUARD +#undef BOUNTY_GORILLA_PUMMEL_PUNCHES +#undef BOUNTY_GORILLA_HOLD_MAX +#undef BOUNTY_GORILLA_PUMMEL_FIST_LEFT +#undef BOUNTY_GORILLA_HURL_RANGE +#undef BOUNTY_GORILLA_KNOCKBACK_RANGE +#undef BOUNTY_GORILLA_DOOR_REACH +#undef BOUNTY_GORILLA_BEHIND_RANGE +#undef BOUNTY_GORILLA_CHASE_RANGE +#undef BOUNTY_GORILLA_QUARRY_MEMORY +#undef BOUNTY_GORILLA_DOOR_RETRY +#undef BOUNTY_GORILLA_PRESSURE_GAP +#undef BOUNTY_GORILLA_COLOR +#undef BOUNTY_GORILLA_MARK_MATRIX +#undef BOUNTY_GORILLA_TRAIT +#undef BOUNTY_GORILLA_BOSS_BUSY diff --git a/voidcrew/modules/bounties/chrome/bounty_chrome_mantis.dm b/voidcrew/modules/bounties/chrome/bounty_chrome_mantis.dm new file mode 100644 index 00000000000..d62e8810a72 --- /dev/null +++ b/voidcrew/modules/bounties/chrome/bounty_chrome_mantis.dm @@ -0,0 +1,354 @@ +/** + * # Bounty chrome: Mantis Blades + * + * Owner: C2 (Mantis Blades and Gorilla Arms). Built on the chrome core, bounty_chrome.dm. + * + * The player's Mantis Blades (voidcrew/modules/cyberware/ware_military_arms.dm), the real pair of forearm + * housings, in a criminal or companion who fights up close (the piece rolls only on brawlers, knife and + * club fighters). The NPC uses them the way a player does, through the housings' own buttons: + * - Blades out (/datum/bounty_chrome_move/mantis_blades). Once its fight starts it presses each housing's + * button, and the blade comes out into that hand with the implant's own sound and line. From then on the + * blades are its weapon: its melee swings the strongest thing it holds, and a hardlight blade's force, + * edge and wound bonus are the blade's own, so its cuts are tg's slash wounds and bleed as those do. A + * knife in that hand goes back in its pocket first. A bat has nowhere to go on a body, so that arm keeps + * the bat and the other arm's blade does the work. + * - The blades go back in when the fight is over, or it goes down, is cuffed or gives up: the button + * again, or the implant's own stow when it is past pressing buttons. An EMP stows them by itself (the + * implant), and they stay in through the reboot. + * - They never leave its body. While out a blade is NODROP and indestructible (the toolkit's Extend()), + * and it is locked gear like the rest of its kit (human_npc_gear.dm): it can't be disarmed, stripped or + * dropped, and one forced out of its hand is deleted. When it dies, or a housing is cut or taken out of + * it, the housing burns out to scrap and its blade goes with it (the human NPC base). + * - The lunge (/datum/bounty_chrome_move/mantis_lunge). With someone two to five tiles off in a clear + * line, it turns its blades on them in a blue outline and a blue line lights the floor up to them, then + * it presses a housing's own Mantis Lunge on them: the implant's telegraph, dash, cuts and knockdown and + * its 20 second cooldown, all as written. The dash runs down the line it showed (the implant's dash_aim), + * so a hunter who steps off it is missed. The AI only picks when: never at someone already on the floor, + * never down a line with anything solid or anyone standing on it (the dash would fall short), and never where the dash + * could carry it off its side's site or past a drop, lava or space (the implant moves its bearer by + * force, so the AI looks first). The first lunge may come a second into a fight. + */ + +/// The furthest any model's lunge reaches, in tiles. The housing's own lunge_range (ware_military_arms.dm) +/// decides the real reach (can_start()). +#define BOUNTY_MANTIS_LUNGE_RANGE 5 +/// The closest a target may be for a lunge: right beside them it is a swing, not a lunge +#define BOUNTY_MANTIS_LUNGE_MIN 2 +/// The tell before the lunge, the line lit on the floor; the implant's own telegraph follows it +#define BOUNTY_MANTIS_LUNGE_TELL (0.9 SECONDS) +/// The first lunge of a fight may start this long after the fight does +#define BOUNTY_MANTIS_OPENING (1 SECONDS) +/// A hand it couldn't empty for a blade is left alone this long before it tries again +#define BOUNTY_MANTIS_STOW_RETRY (10 SECONDS) +/// The tell's outline, in the hardlight blade's blue +#define BOUNTY_MANTIS_COLOR "#6cb8ff" +/// The line on the floor: the mark art is pure red, which a plain colour only darkens, so a matrix turns it the blade's blue +#define BOUNTY_MANTIS_MARK_MATRIX list(0.42, 0.72, 1, 0, 0, 0, 0, 0, 0) +/// How long the line stays lit once the lunge is pressed: the implant's 0.3 second wind-up and the run itself +#define BOUNTY_MANTIS_LINE_HOLD (0.5 SECONDS) + +// ===== HELPERS ===== + +/// The Mantis Blade housings in `npc`'s arms +/proc/bounty_mantis_housings(mob/living/carbon/npc) + . = list() + if(QDELETED(npc)) + return + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing in npc.organs) + . += housing + +/// Whether `housing`'s chrome is running, so its blade can come out +/proc/bounty_mantis_running(obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing) + var/datum/component/cyberware/chrome = housing?.GetComponent(/datum/component/cyberware) + return !!chrome?.is_running() + +/// `housing`'s own button, the one that puts its blade out and away +/proc/bounty_mantis_toggle(obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing) + return locate(/datum/action/item_action/organ_action/toggle/toolkit) in housing?.actions + +/// The hands (RIGHT_HANDS or LEFT_HANDS) `housing`'s blade comes out into +/proc/bounty_mantis_side(obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing) + return housing.zone == BODY_ZONE_R_ARM ? RIGHT_HANDS : LEFT_HANDS + +/// The blades `housing` keeps, out or in (the toolkit's items_list) +/proc/bounty_mantis_blades(obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing) + . = list() + for(var/datum/weakref/blade_ref as anything in housing?.items_list) + var/obj/item/blade = blade_ref?.resolve() + if(!QDELETED(blade)) + . += blade + +/** + * Puts every blade of `npc`'s that is out back in its housing: the housing's own button, or, when it is + * past pressing buttons (down in crit), the implant's own stow. Doesn't sleep. + */ +/proc/bounty_mantis_put_away(mob/living/carbon/npc) + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing as anything in bounty_mantis_housings(npc)) + if(!housing.blade_extended()) + continue + var/datum/action/toggle = bounty_mantis_toggle(housing) + if(toggle?.IsAvailable()) + toggle.Trigger() + if(housing.blade_extended()) + housing.Retract() + +/// Whether a dash must never cross `spot`: open space or a drop, lava, a chasm, space +/proc/bounty_mantis_drop(turf/spot) + return isspaceturf(spot) || isopenspaceturf(spot) || isgroundlessturf(spot) || islava(spot) || ischasm(spot) + +/// world.time `npc` last fired any chrome move, leaving out moves of `except_types`, or 0 if none has fired +/proc/bounty_melee_chrome_last_move_at(mob/living/carbon/human/npc/npc, list/except_types) + . = 0 + var/datum/component/bounty_chrome/chrome = npc?.GetComponent(/datum/component/bounty_chrome) + for(var/datum/bounty_chrome_move/move as anything in chrome?.moves) + if(except_types && is_type_in_list(move, except_types)) + continue + . = max(., move.last_fired) + +/** + * Whether `npc`'s other chrome lets a move whose own opener is at `opens_at` start now: past the gap the + * last move to fire left (the component's next_move_at), or, with none fired since the fight started at + * `fight_started_at`, past the move's own opener, which comes before the core's (BOUNTY_CHROME_OPENING). + */ +/proc/bounty_melee_chrome_may_start(mob/living/carbon/human/npc/npc, opens_at, fight_started_at) + if(world.time < opens_at) + return FALSE + var/datum/component/bounty_chrome/chrome = npc?.GetComponent(/datum/component/bounty_chrome) + if(!chrome || chrome.telling) + return FALSE + if(world.time >= chrome.next_move_at) + return TRUE + return bounty_melee_chrome_last_move_at(npc) < fight_started_at + +// ===== BLADES OUT ===== + +/** + * The blades, out for a fight and away after it. It plans nothing of its own: in a fight it presses a + * housing's button for each blade still in (plan(), and on_tick() for a mini-boss, which plans no chrome + * of its own), and out of it, down, cuffed or giving up it puts them away. + */ +/datum/bounty_chrome_move/mantis_blades + piece_key = BOUNTY_CHROME_MANTIS + name = "Mantis Blades" + // No tell: putting a blade out hurts nobody, and the implant shows and sounds it + boss_usable = FALSE + /// REF() of a housing -> world.time it may try again to empty that hand for its blade + var/list/stow_retry_at + +/datum/bounty_chrome_move/mantis_blades/attach(mob/living/carbon/human/npc/npc) + . = ..() + // A body dressed before its housings went in (a test, an admin's install) has its blades locked now, like its other gear + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing as anything in bounty_mantis_housings(npc)) + for(var/obj/item/blade as anything in bounty_mantis_blades(housing)) + npc.npc_lock_item(blade) + RegisterSignals(npc, list(SIGNAL_ADDTRAIT(TRAIT_RESTRAINED), COMSIG_HUMAN_NPC_SURRENDERED), PROC_REF(on_out_of_it)) + +/datum/bounty_chrome_move/mantis_blades/detach() + if(owner) + UnregisterSignal(owner, list(SIGNAL_ADDTRAIT(TRAIT_RESTRAINED), COMSIG_HUMAN_NPC_SURRENDERED)) + if(!QDELETED(owner)) + bounty_mantis_put_away(owner) + stow_retry_at = null + return ..() + +/datum/bounty_chrome_move/mantis_blades/plan(datum/ai_controller/controller, atom/target) + // In its fight and able to act: a blade out is this moment's click + if(!bounty_chrome_in_fight(owner) || !bounty_chrome_can_act(owner)) + return FALSE + return draw_one() + +/datum/bounty_chrome_move/mantis_blades/on_tick(seconds_per_tick, fighting, atom/target) + if(fighting && !blades_go_away()) + if(bounty_chrome_can_act(owner)) + draw_one() + return + bounty_mantis_put_away(owner) + +/datum/bounty_chrome_move/mantis_blades/on_fight_end() + bounty_mantis_put_away(owner) + +/datum/bounty_chrome_move/mantis_blades/on_downed() + bounty_mantis_put_away(owner) + +/datum/bounty_chrome_move/mantis_blades/on_death() + bounty_mantis_put_away(owner) + +/// Whether the blades go away for now: down in crit, cuffed, giving up or dead. A knockdown or a stun keeps them out, as it would a player's. +/datum/bounty_chrome_move/mantis_blades/proc/blades_go_away() + return QDELETED(owner) || owner.stat != CONSCIOUS || HAS_TRAIT(owner, TRAIT_CRITICAL_CONDITION) || HAS_TRAIT(owner, TRAIT_RESTRAINED) || owner.npc_surrendering + +/// Cuffed, or giving up: the blades go in. Inside a signal handler. +/datum/bounty_chrome_move/mantis_blades/proc/on_out_of_it(datum/source) + SIGNAL_HANDLER + INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(bounty_mantis_put_away), owner) + +/** + * Puts out one blade that is still in, the way a player's button does: its housing's chrome running and + * its hand free. Returns TRUE if a blade came out. + */ +/datum/bounty_chrome_move/mantis_blades/proc/draw_one() + if(QDELETED(owner)) + return FALSE + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing as anything in bounty_mantis_housings(owner)) + if(housing.blade_extended() || !bounty_mantis_running(housing)) + continue + var/datum/action/toggle = bounty_mantis_toggle(housing) + if(!toggle?.IsAvailable() || !free_hand_for(housing)) + continue + toggle.Trigger() + if(housing.blade_extended()) + return TRUE + return FALSE + +/** + * Whether the hand `housing`'s blade comes out into is free, first putting away what it holds there if + * that has somewhere to go on its body (a knife into a pocket). Never drops anything. + */ +/datum/bounty_chrome_move/mantis_blades/proc/free_hand_for(obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing) + var/side = bounty_mantis_side(housing) + if(owner.get_empty_held_index_for_side(side)) + return TRUE + var/key = REF(housing) + if(world.time < LAZYACCESS(stow_retry_at, key)) + return FALSE + for(var/obj/item/held as anything in owner.get_held_items_for_side(side, all = TRUE)) + if(HAS_TRAIT(held, TRAIT_NODROP) || !held.equip_to_best_slot(owner)) + LAZYSET(stow_retry_at, key, world.time + BOUNTY_MANTIS_STOW_RETRY) + return FALSE + return !!owner.get_empty_held_index_for_side(side) + +// ===== THE LUNGE ===== + +/** + * The Mantis Lunge: the line lit on the floor and a blue outline for BOUNTY_MANTIS_LUNGE_TELL, then a + * housing's own Mantis Lunge pressed on the target, the housing with its blade out. + */ +/datum/bounty_chrome_move/mantis_lunge + piece_key = BOUNTY_CHROME_MANTIS + name = "Mantis Lunge" + action_type = /datum/action/cooldown/cyberware/mantis_lunge + tell_time = BOUNTY_MANTIS_LUNGE_TELL + tell_color = BOUNTY_MANTIS_COLOR + tell_lines = list("Hold still.", "You're mine.", "Got you now.") + max_range = BOUNTY_MANTIS_LUNGE_RANGE + min_range = BOUNTY_MANTIS_LUNGE_MIN + /// world.time its first lunge of this fight may start + var/opens_at = 0 + /// world.time this fight started + var/fight_started_at = 0 + /// The tile its tell's line ends on: the dash runs there, not to wherever the target has gone + var/turf/aimed_at + +/datum/bounty_chrome_move/mantis_lunge/on_fight_start(atom/target) + fight_started_at = world.time + opens_at = world.time + BOUNTY_MANTIS_OPENING + +/// A housing's Mantis Lunge it can press now: one whose blade is out, its chrome running and the lunge off cooldown +/datum/bounty_chrome_move/mantis_lunge/proc/lunge_action() + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing as anything in bounty_mantis_housings(owner)) + if(!housing.blade_extended()) + continue + var/datum/action/cooldown/cyberware/mantis_lunge/lunge = locate() in housing.actions + if(lunge?.owner == owner && lunge.IsAvailable()) + return lunge + return null + +/datum/bounty_chrome_move/mantis_lunge/ready() + return !!lunge_action() + +/datum/bounty_chrome_move/mantis_lunge/can_start(atom/target) + var/mob/living/victim = target + // The blades pass over someone on the floor: no lunge at them + if(!isliving(victim) || !isturf(victim.loc) || victim.body_position == LYING_DOWN) + return FALSE + if(!..()) + return FALSE + // Each model reaches as far as its own housing says + var/datum/action/cooldown/cyberware/mantis_lunge/lunge = lunge_action() + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing = lunge?.organ + if(!istype(housing) || get_dist(owner, victim) > housing.lunge_range) + return FALSE + return line_clear(victim) + +/** + * Whether the implant's dash at `victim` carries it only over its own ground: nothing solid on the way + * (or it falls short), every tile on its side's leash, and no drop, lava or space beside the line either, + * since they may step aside during the tell and the dash goes where they are then. + */ +/datum/bounty_chrome_move/mantis_lunge/proc/line_clear(mob/living/victim) + var/mob/living/carbon/human/npc/bounty_criminal/side = bounty_ai_side_of(owner) + var/turf/start = get_turf(owner) + var/turf/aim = get_turf(victim) + // A companion whose criminal is gone has no ground of its own to dash over + if(!side || !start || !aim || start.z != aim.z) + return FALSE + for(var/turf/spot as anything in get_line(start, aim)) + if(spot == start) + continue + if(spot == aim) + break + // A standing body stops the dash as a wall does + if(spot.is_blocked_turf(source_atom = owner) || !side.leash_ok(spot)) + return FALSE + for(var/turf/beside as anything in RANGE_TURFS(1, spot)) + if(bounty_mantis_drop(beside)) + return FALSE + return TRUE + +/datum/bounty_chrome_move/mantis_lunge/plan(datum/ai_controller/controller, atom/target) + // Its own opener, a little before the core's: early enough to show inside a short fight + if(!bounty_melee_chrome_may_start(owner, opens_at, fight_started_at) || !can_start(target)) + return FALSE + var/datum/component/bounty_chrome/chrome = owner.GetComponent(/datum/component/bounty_chrome) + return !!chrome?.start_move(src, target) + +/datum/bounty_chrome_move/mantis_lunge/tell_text(atom/target) + return "[owner] turns [owner.p_their()] blades on [target]." + +/datum/bounty_chrome_move/mantis_lunge/tell(atom/target) + ..() + var/turf/start = get_turf(owner) + aimed_at = get_turf(target) + if(!start || !aimed_at) + return + // The way it will come, lit up to whoever it is aimed at + light_line(start, aimed_at, tell_time + 1, TRUE) + +/// Lights the floor from `start` to `aim` for `time`, kept as the tell's marks if `as_tell` +/datum/bounty_chrome_move/mantis_lunge/proc/light_line(turf/start, turf/aim, time, as_tell) + for(var/turf/spot as anything in get_line(start, aim)) + if(spot == start) + continue + var/obj/effect/mark = new /obj/effect/temp_visual/bounty_boss_mark(spot, time, BOUNTY_MANTIS_MARK_MATRIX, spot == aim ? "target_circle" : null) + if(as_tell) + add_mark(mark) + +/datum/bounty_chrome_move/mantis_lunge/effect(atom/target) + var/turf/aim = aimed_at + aimed_at = null + var/datum/action/cooldown/cyberware/mantis_lunge/lunge = lunge_action() + if(!lunge || !isliving(target) || QDELETED(target)) + return FALSE + // The dash goes down the line the tell showed + lunge.dash_aim = aim + if(!lunge.Trigger(target = target)) + lunge.dash_aim = null + return FALSE + // The line stays lit through the implant's own wind-up and the run + var/turf/start = get_turf(owner) + if(start && aim) + light_line(start, aim, BOUNTY_MANTIS_LINE_HOLD, FALSE) + return TRUE + +/datum/bounty_chrome_move/mantis_lunge/detach() + aimed_at = null + return ..() + +#undef BOUNTY_MANTIS_LUNGE_RANGE +#undef BOUNTY_MANTIS_LUNGE_MIN +#undef BOUNTY_MANTIS_LUNGE_TELL +#undef BOUNTY_MANTIS_OPENING +#undef BOUNTY_MANTIS_STOW_RETRY +#undef BOUNTY_MANTIS_COLOR +#undef BOUNTY_MANTIS_MARK_MATRIX +#undef BOUNTY_MANTIS_LINE_HOLD diff --git a/voidcrew/modules/bounties/chrome/bounty_chrome_piledriver.dm b/voidcrew/modules/bounties/chrome/bounty_chrome_piledriver.dm new file mode 100644 index 00000000000..811e2cfb7b8 --- /dev/null +++ b/voidcrew/modules/bounties/chrome/bounty_chrome_piledriver.dm @@ -0,0 +1,214 @@ +/** + * # Bounty chrome: the Meteor Piledriver + * + * Owner: C1. A criminal's Meteor Piledriver is the player's leg frame + * (/obj/item/organ/cyberimp/cyberware/piledriver, ware_legend.dm): the leap, its reach, the warning + * shadow, the 0.8 s in the air, the crush on whoever is still under it, the shockwave around it, and + * the minute's cooldown are all the implant's own, and nothing here changes them. Once it is in the + * air it comes down, as a player's leap does: shot or stunned up there, it still lands. This file is + * only how an NPC uses it (owner decision 5): + * - When: in a fight, with its target BOUNTY_PILEDRIVER_MIN_RANGE to BOUNTY_PILEDRIVER_MAX_RANGE tiles + * off and in sight (anyone closer it fights hand to hand), and a landing it can make: the target's + * own tile, or the nearest free tile beside them, that the implant itself would take (in reach, in + * sight, an open arc, a surface to land on) and that the NPC would choose: on its leash (a mini-boss + * also where its abilities may land), never space, a chasm or lava. + * - Never onto people outside its fight (C0's bystander gate, over everything the landing reaches), + * and never onto anyone already down. Checked when it decides and again when it jumps. + * - The tell: it drops into a crouch with its pistons whining and an amber glow, and a red reticle + * sits where it means to land, following its target, for BOUNTY_PILEDRIVER_CROUCH. Then the + * implant's own Meteor Leap, Trigger()ed onto the landing tile as a player's click; the implant puts + * its own warning shadow down there for the time it is in the air. + * - If the landing is gone when the crouch ends (its target got behind a wall, a bystander walked in, + * its target went down), the pistons hiss and settle and nothing fires. + * A target in a mech isn't leapt at: the landing can't reach anyone inside one. + */ + +/// Nearest a target may be for a leap, in tiles: anyone closer is fought hand to hand +#define BOUNTY_PILEDRIVER_MIN_RANGE 3 +/// Furthest a target may be for a leap, in tiles: a tile beside them stays in the implant's reach +#define BOUNTY_PILEDRIVER_MAX_RANGE 7 +/// The implant's own reach (CYBERWARE_PILEDRIVER_RANGE, ware_legend.dm) +#define BOUNTY_PILEDRIVER_REACH 8 +/// How far around the landing the implant's shockwave reaches (CYBERWARE_PILEDRIVER_IMPACT_RANGE, ware_legend.dm) +#define BOUNTY_PILEDRIVER_IMPACT 2 +/// The crouch before the leap: its tell +#define BOUNTY_PILEDRIVER_CROUCH (1 SECONDS) +/// Pixels it sinks in the crouch +#define BOUNTY_PILEDRIVER_DIP 3 +/// The glow through the crouch, piston amber +#define BOUNTY_PILEDRIVER_COLOR "#ffb347" +/// Offset source for the crouch +#define BOUNTY_PILEDRIVER_SOURCE "bounty_chrome_piledriver" + +/datum/bounty_chrome_move/piledriver + piece_key = BOUNTY_CHROME_PILEDRIVER + name = "Meteor leap" + action_type = /datum/action/cooldown/cyberware/piledriver_leap + tell_time = BOUNTY_PILEDRIVER_CROUCH + tell_color = BOUNTY_PILEDRIVER_COLOR + tell_sound = 'sound/machines/piston/piston_lower.ogg' + tell_lines = list("Heads up!", "Stay right there.", "Look up.") + area_move = TRUE + min_range = BOUNTY_PILEDRIVER_MIN_RANGE + max_range = BOUNTY_PILEDRIVER_MAX_RANGE + // Its time in the air on top of the usual gap + recover_time = 5 SECONDS + /// What the crouch is aimed at, while the reticle follows it + var/atom/movable/tracked + +/datum/bounty_chrome_move/piledriver/can_start(atom/target) + if(ismecha(target) || !..()) + return FALSE + var/turf/spot = landing_for(target) + return !isnull(spot) && !downed_in(impact_turfs(spot)) + +/datum/bounty_chrome_move/piledriver/area_turfs(atom/target) + var/turf/spot = landing_for(target) + return spot ? impact_turfs(spot) : list() + +/datum/bounty_chrome_move/piledriver/tell(atom/target) + ..() + if(QDELETED(owner)) + return + owner.add_offsets(BOUNTY_PILEDRIVER_SOURCE, z_add = -BOUNTY_PILEDRIVER_DIP) + place_aim_mark(landing_for(target)) + stop_tracking() + if(ismovable(target)) + tracked = target + RegisterSignal(tracked, COMSIG_MOVABLE_MOVED, PROC_REF(on_tracked_moved)) + RegisterSignal(tracked, COMSIG_QDELETING, PROC_REF(stop_tracking)) + +/datum/bounty_chrome_move/piledriver/tell_text(atom/target) + return "[owner] drops into a crouch, [owner.p_their()] leg pistons whining." + +/datum/bounty_chrome_move/piledriver/clear_tell() + stop_tracking() + // Only its own crouch: offsets put back while it is up in the air would drop it out of its leap's rise. No animation: the rise starts from here a moment later. + if(!QDELETED(owner) && (BOUNTY_PILEDRIVER_SOURCE in owner.offsets?[PIXEL_Z_OFFSET])) + owner.remove_offsets(BOUNTY_PILEDRIVER_SOURCE, animate = FALSE) + return ..() + +/** + * The crouch is over: it jumps at where its target stands now, as a player clicks where they see + * them, if it still may. Otherwise the pistons settle and nothing fires. + */ +/datum/bounty_chrome_move/piledriver/effect(atom/target) + var/turf/spot + if(!QDELETED(target) && !ismecha(target) && bounty_ai_may_hit(owner, target)) + spot = landing_for(target) + if(!spot || !bounty_chrome_area_clear(owner, impact_turfs(spot), target) || downed_in(impact_turfs(spot))) + settle() + return FALSE + return bounty_chrome_trigger(owner, action_type, spot) + +/// The crouch came to nothing: the pistons hiss and settle +/datum/bounty_chrome_move/piledriver/proc/settle() + if(QDELETED(owner) || owner.stat != CONSCIOUS) + return + playsound(owner, 'sound/machines/steam_hiss.ogg', 40, TRUE) + owner.visible_message(span_notice("[owner]'s leg pistons hiss and settle.")) + +/// Everything a landing on `spot` reaches: the tile, and the shockwave's ring around it +/datum/bounty_chrome_move/piledriver/proc/impact_turfs(turf/spot) + return RANGE_TURFS(BOUNTY_PILEDRIVER_IMPACT, spot) + +/// Whether anyone in `turfs` is down and still alive: it never lands on a person who is down +/datum/bounty_chrome_move/piledriver/proc/downed_in(list/turfs) + for(var/turf/spot as anything in turfs) + for(var/mob/living/person in spot) + if(person != owner && person.stat != CONSCIOUS && person.stat != DEAD) + return TRUE + return FALSE + +/** + * The tile a leap at `target` comes down on now, or null if there is none: their own tile if it may + * land there, else the free tile beside them nearest to it, never one next to where it stands. + * Geometry only: who it may jump at is can_start()'s and effect()'s. + */ +/datum/bounty_chrome_move/piledriver/proc/landing_for(atom/target) + var/turf/here = get_turf(owner) + var/turf/aim = get_turf(target) + if(!here || !aim || here.z != aim.z || !isturf(owner.loc)) + return null + var/datum/action/cooldown/cyberware/piledriver_leap/leap = bounty_chrome_action(owner, action_type) + if(!leap) + return null + if(landing_ok(here, aim, leap)) + return aim + var/turf/best + var/best_distance = INFINITY + for(var/turf/beside as anything in RANGE_TURFS(1, aim)) + var/from_here = get_dist(here, beside) + if(beside == aim || from_here < 2 || from_here >= best_distance) + continue + if(!landing_ok(here, beside, leap)) + continue + best = beside + best_distance = from_here + return best + +/** + * Whether it may land on `spot` from `here`: what the implant itself takes (in reach and in sight, a + * surface to land on, an open arc, Activate() in ware_legend.dm) and what the NPC chooses: never + * space, a chasm or lava, and only on its own ground (on_its_ground()). + */ +/datum/bounty_chrome_move/piledriver/proc/landing_ok(turf/here, turf/spot, datum/action/cooldown/cyberware/piledriver_leap/leap) + if(!spot || spot == here || get_dist(here, spot) > BOUNTY_PILEDRIVER_REACH) + return FALSE + if(isspaceturf(spot) || isopenspaceturf(spot) || islava(spot) || ischasm(spot)) + return FALSE + if(spot.is_blocked_turf(exclude_mobs = TRUE)) + return FALSE + if(!can_see(owner, spot, BOUNTY_PILEDRIVER_REACH) || leap.arc_blocker(here, spot)) + return FALSE + return on_its_ground(spot) + +/// Whether `spot` is ground it would land on: its leash (a companion its criminal's), and for a mini-boss where its abilities may land +/datum/bounty_chrome_move/piledriver/proc/on_its_ground(turf/spot) + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = owner + if(istype(boss)) + return boss.boss_landing_ok(spot) + var/mob/living/carbon/human/npc/bounty_criminal/side = bounty_ai_side_of(owner) + if(side) + return side.leash_ok(spot) + return spot.can_cross_safely(owner) + +/// Puts the reticle on `spot`, or takes it away for a null one +/datum/bounty_chrome_move/piledriver/proc/place_aim_mark(turf/spot) + // The reticle is the only mark the crouch puts down (add_mark()) + var/obj/effect/temp_visual/bounty_boss_mark/mark + for(var/datum/weakref/mark_ref as anything in marks) + var/obj/effect/temp_visual/bounty_boss_mark/live = mark_ref.resolve() + if(!QDELETED(live)) + mark = live + break + if(!spot) + if(mark) + qdel(mark) + return + if(!mark) + // The bounty bosses' red floor mark (bounty_boss.dm) as a reticle, like every boss mark and the implant's own shadow; deleted when the crouch ends, its duration only a backstop + add_mark(new /obj/effect/temp_visual/bounty_boss_mark(spot, BOUNTY_PILEDRIVER_CROUCH * 3, null, "target_circle")) + return + mark.abstract_move(spot) + +/// Its target moved in the crouch: the reticle follows to where it would land now +/datum/bounty_chrome_move/piledriver/proc/on_tracked_moved(atom/movable/source, atom/old_loc, dir, forced) + SIGNAL_HANDLER + place_aim_mark(landing_for(source)) + +/// Stops following its target. Safe at any time. +/datum/bounty_chrome_move/piledriver/proc/stop_tracking() + SIGNAL_HANDLER + if(tracked) + UnregisterSignal(tracked, list(COMSIG_MOVABLE_MOVED, COMSIG_QDELETING)) + tracked = null + +#undef BOUNTY_PILEDRIVER_MIN_RANGE +#undef BOUNTY_PILEDRIVER_MAX_RANGE +#undef BOUNTY_PILEDRIVER_REACH +#undef BOUNTY_PILEDRIVER_IMPACT +#undef BOUNTY_PILEDRIVER_CROUCH +#undef BOUNTY_PILEDRIVER_DIP +#undef BOUNTY_PILEDRIVER_COLOR +#undef BOUNTY_PILEDRIVER_SOURCE diff --git a/voidcrew/modules/bounties/chrome/bounty_chrome_redline.dm b/voidcrew/modules/bounties/chrome/bounty_chrome_redline.dm new file mode 100644 index 00000000000..16806ed7d64 --- /dev/null +++ b/voidcrew/modules/bounties/chrome/bounty_chrome_redline.dm @@ -0,0 +1,117 @@ +/// Percent of its health at or under which it burns: the AI's moment (the implant fires whenever its bearer presses it) +#define BOUNTY_REDLINE_HURT_BELOW 75 +/// Stamina lost at or over which it burns too: halfway to a stamina crit, so a baton or a disabler gets an answer before the floor +#define BOUNTY_REDLINE_WINDED_AT 50 +/// The tell: the chest speaker charging before the roar +#define BOUNTY_REDLINE_TELL (1 SECONDS) +/// How far the implant's roar reaches (CYBERWARE_REDLINE_ROAR_RANGE, ware_legend.dm): the bystander gate looks this far +#define BOUNTY_REDLINE_ROAR_RANGE 5 +/// The red of the tell's outline, its light and the eyes through the burn +#define BOUNTY_REDLINE_COLOR "#ff2a2a" +/// The eye-colour priority of the red eyes through the burn (over a cultist's) +#define BOUNTY_REDLINE_EYES_PRIORITY (EYE_COLOR_CULT_PRIORITY + 11) + +/** + * # Redline core on a bounty NPC + * + * The rage OS players buy (/obj/item/organ/cyberimp/cyberware/redline, ware_legend.dm), used the way a + * player would: once a fight has turned on them. The AI picks the moment and shows it coming; everything + * after the button press is the implant's own. + * + * - The moment: in a fight, hurt to BOUNTY_REDLINE_HURT_BELOW percent of its health or winded to + * BOUNTY_REDLINE_WINDED_AT stamina, and nobody outside the fight within the roar's reach (the bystander + * gate, owner decision 5): its own side and the site's people keep it shut. + * - The tell, BOUNTY_REDLINE_TELL: it stands still, a red outline pulses over it, the chest speaker + * crackles and glows red, and it says so. A stun, a knockdown, cuffs, crit or an EMP in the tell and + * nothing happens (the framework). + * - Then the implant's Redline Burn, Trigger()ed as a player's button: the roar (it staggers everyone in + * reach who isn't crew with the bearer, so the gate is checked again as it fires), 12 seconds of stun + * immunity, a red outline over it the whole time (the implant's, as on a player), 40% less brute and + * burn through its physiology, harder fists, 90 seconds of cooldown, then + * the crash: a hundred stamina, which floors it in stamina crit, and leaden legs. That collapse is the + * hunters' window. An EMP in the burn drops it straight into the crash, as it does a player. + * - Its eyes stay red through the burn (the implant's own lines say they flood red and drain), a look only. + */ +/datum/bounty_chrome_move/redline + piece_key = BOUNTY_CHROME_REDLINE + name = "Redline burn" + action_type = /datum/action/cooldown/cyberware/redline_burn + tell_time = BOUNTY_REDLINE_TELL + tell_color = BOUNTY_REDLINE_COLOR + tell_lines = list("That's it.", "Now you've done it.", "You want to see red?") + area_move = TRUE + +// Hurt first: it is cheap, and the bystander gate's look around (view()) only runs once it would burn +/datum/bounty_chrome_move/redline/can_start(atom/target) + return bounty_redline_hurt(owner) && ..() + +/// Whether `npc` is hurt or winded enough to burn its Redline +/proc/bounty_redline_hurt(mob/living/npc) + if(QDELETED(npc)) + return FALSE + return npc.health <= npc.maxHealth * BOUNTY_REDLINE_HURT_BELOW / 100 || npc.getStaminaLoss() >= BOUNTY_REDLINE_WINDED_AT + +// The implant's roar staggers only those outside its side (cyberware_is_ally()), so its own companions don't hold it back +/datum/bounty_chrome_move/redline/area_clear(atom/target) + return bounty_chrome_area_clear(owner, area_turfs(target), target, TRUE) + +/// The roar's reach: every tile it can see within BOUNTY_REDLINE_ROAR_RANGE, as the implant's roar looks (oview()) +/datum/bounty_chrome_move/redline/area_turfs(atom/target) + . = list() + if(QDELETED(owner)) + return + for(var/turf/spot in view(BOUNTY_REDLINE_ROAR_RANGE, owner)) + . += spot + +/datum/bounty_chrome_move/redline/tell_text(atom/target) + return "[owner]'s chest speaker crackles and starts to glow red." + +/datum/bounty_chrome_move/redline/tell(atom/target) + ..() + if(QDELETED(owner)) + return + add_mark(owner.mob_light(1.5, 1, BOUNTY_REDLINE_COLOR)) + owner.Shake(1, 0, tell_time) + +// Someone outside the fight stepped into the roar's reach during the tell: the button stays unpressed (the gate, owner decision 5) +/datum/bounty_chrome_move/redline/effect(atom/target) + if(!area_clear(target)) + return FALSE + . = ..() + if(. && owner.has_status_effect(/datum/status_effect/cyberware_redline_window)) + owner.apply_status_effect(/datum/status_effect/bounty_redline_eyes) + +/datum/bounty_chrome_move/redline/detach() + owner?.remove_status_effect(/datum/status_effect/bounty_redline_eyes) + return ..() + +/** + * Red eyes through a Redline burn on a bounty NPC: what the implant's roar and crash lines say happens + * ("eyes flood red", "the red drains out of their eyes"). A look only; it ends with the burn. + */ +/datum/status_effect/bounty_redline_eyes + id = "bounty_redline_eyes" + // Past the implant's 12 second window; it ends with the window, this is a backstop + duration = 15 SECONDS + tick_interval = 0.5 SECONDS + alert_type = null + +/datum/status_effect/bounty_redline_eyes/on_apply() + if(owner.stat == DEAD || !owner.has_status_effect(/datum/status_effect/cyberware_redline_window)) + return FALSE + bounty_chrome_red_eyes(owner, id, BOUNTY_REDLINE_EYES_PRIORITY, TRUE, BOUNTY_REDLINE_COLOR) + return TRUE + +/datum/status_effect/bounty_redline_eyes/tick(seconds_between_ticks) + if(owner.stat == DEAD || !owner.has_status_effect(/datum/status_effect/cyberware_redline_window)) + qdel(src) + +/datum/status_effect/bounty_redline_eyes/on_remove() + bounty_chrome_red_eyes(owner, id, BOUNTY_REDLINE_EYES_PRIORITY, FALSE) + +#undef BOUNTY_REDLINE_HURT_BELOW +#undef BOUNTY_REDLINE_WINDED_AT +#undef BOUNTY_REDLINE_TELL +#undef BOUNTY_REDLINE_ROAR_RANGE +#undef BOUNTY_REDLINE_COLOR +#undef BOUNTY_REDLINE_EYES_PRIORITY diff --git a/voidcrew/modules/bounties/chrome/bounty_cyberpsycho.dm b/voidcrew/modules/bounties/chrome/bounty_cyberpsycho.dm new file mode 100644 index 00000000000..6857a41546e --- /dev/null +++ b/voidcrew/modules/bounties/chrome/bounty_cyberpsycho.dm @@ -0,0 +1,348 @@ +/** + * # Bounty hunting: the cyberpsycho + * + * Owner: C6. A mini-boss kit (BOUNTY_KIT_CYBERPSYCHO) whose kit is its chrome, the rarest of the kits + * (bounty_roll_kit()). Everything but its fight is any mini-boss's: the Most Wanted posting and pay, its + * stimulants, a sealed suit where the air would kill it, capture, and in prison the Juggernaut's charge + * (its chrome stays out of prison, decision 7). + * + * Its chrome is the real implants (decisions 4 and 5), as many of the seven pieces as one body's organ + * slots take. Six go in, in this order (bounty_psycho_organs()): + * - the Redline core in the operating-system slot. The Cascade lattice needs the same slot; Redline is + * its phase two, so the lattice is the piece left out; + * - a Mantis Blade housing in its right arm and Gorilla Arms in its left, one of each pair; + * - the Meteor Piledriver in its legs, a Lazarus node by its heart, and Deadeye optics for eyes. + * Their load is 32 (10 + 3 + 3 + 8 + 5 + 3), over a body's 20. It is augmented beyond anyone else: its + * Redline core carries the Governor Delete's capacity (BOUNTY_PSYCHO_EXTRA_CAPACITY) through the real + * capacity hook, the cyberware component's capacity_bonus, which get_chrome_capacity(), the brownout + * monitor, the cradle and a chrome read all go by. It is set on the core as the core goes in, first, so + * nothing browns out on the way. Chrome taken out of it burns to scrap (the human NPC base), so no core + * with that headroom ever leaves its body. + * + * How it fights, through the boss rotation (bounty_boss.dm), one move at a time and each with its tell: + * - its blade is out of its right forearm while it fights, and its melee is that blade (Mantis Blades); + * - the Mantis Lunge down a lit line, the Meteor Leap under a reticle, and a piston punch with its Gorilla + * fist (C2's told punch, put in its rotation here, since its melee is the blade); + * - its Gorilla hand stays empty, so it can punch through glass it may break (boss_start_smash()); + * - the Redline is its phase two (psycho_burn_due()): hurt to BOUNTY_PSYCHO_BURN_HURT percent of its + * health, or winded by a stamina weapon (BOUNTY_PSYCHO_BURN_WINDED), it drops what it was winding up + * and burns: C3's tell, then the implant's stun-proof window, then its crash into stamina crit, which is + * the capture. Once a spawn. Until then it doesn't wear out and fall back; it burns instead. Its roar + * holds off for people outside its fight, never for its own companions (psycho_roar_clear()); + * - Lazarus stands it up out of crit by itself, the node's own jolt; its six minute recharge outlasts a + * fight; + * - the Deadeye optics are only its eyes: it carries no gun for the tag to steer. + * An EMP takes its chrome down on the real reboot timers, sparking (C0's malfunction look); one during the + * burn crashes it, and with its core down it tires like any other mini-boss. + */ + +/// Neural capacity its Redline core carries: the Governor Delete's (its chrome_capacity_bonus, ware_legend.dm) +#define BOUNTY_PSYCHO_EXTRA_CAPACITY 15 +/// Hurt to this percent of its health, it burns its Redline (C3's line for any carrier) +#define BOUNTY_PSYCHO_BURN_HURT 75 +/// Winded this far (stamina loss), it burns too: one disabler bolt or baton blow, so a stamina weapon gets an answer before the floor +#define BOUNTY_PSYCHO_BURN_WINDED 25 + +/// The cyberpsycho's chrome as organ typepaths, in the order they go in: the Redline core first, as it carries the headroom for the rest +/proc/bounty_psycho_organs() + return list( + /obj/item/organ/cyberimp/cyberware/redline, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis, + /obj/item/organ/cyberimp/cyberware/gorilla_arms/left, + /obj/item/organ/cyberimp/cyberware/piledriver, + /obj/item/organ/cyberimp/cyberware/lazarus, + /obj/item/organ/eyes/robotic/cyberware/deadeye, + ) + +/// The pieces (BOUNTY_CHROME_*) its chrome AI drives: every one but the Cascade lattice +/proc/bounty_psycho_keys() + return list(BOUNTY_CHROME_REDLINE, BOUNTY_CHROME_MANTIS, BOUNTY_CHROME_GORILLA, BOUNTY_CHROME_PILEDRIVER, BOUNTY_CHROME_LAZARUS, BOUNTY_CHROME_DEADEYE) + +// ===== THE BOSS ===== + +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho + name = "chromed criminal" + desc = "A twitching criminal with more chrome than skin." + boss_kit = BOUNTY_KIT_CYBERPSYCHO + /// Its Redline has burned once: its phase two is spent + var/psycho_burned = FALSE + +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/Initialize(mapload, datum/human_npc_order/order) + // Its kit is its chrome: the base installs it once it is dressed + npc_cyberware = bounty_psycho_organs() + . = ..() + psycho_wire_chrome() + RegisterSignal(src, SIGNAL_ADDTRAIT(TRAIT_STUNIMMUNE), PROC_REF(psycho_burn_started)) + RegisterSignal(src, SIGNAL_REMOVETRAIT(TRAIT_STUNIMMUNE), PROC_REF(psycho_burn_ended)) + +// Its Redline core goes in first, with the headroom the rest of its chrome needs +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/npc_install_cyberware(ware_type) + var/obj/item/organ/ware = ..() + if(istype(ware, /obj/item/organ/cyberimp/cyberware/redline)) + var/datum/component/cyberware/chrome = ware.GetComponent(/datum/component/cyberware) + if(chrome && !chrome.capacity_bonus) + chrome.capacity_bonus = BOUNTY_PSYCHO_EXTRA_CAPACITY + cyberware_reevaluate_brownout(src) + return ware + +/** + * Its chrome's AI, once the implants are in (C0's bounty_chrome_equip()): every piece's moves, and its + * rotation set to what this body can do. Its own lines say what is coming (boss_bark()), not each move's. + * Its Redline is its own move (/datum/bounty_chrome_move/redline/psycho), its phase two, in place of the + * one every carrier gets, and its Gorilla fist gets the piston punch. The Gorilla grab needs two Gorilla + * fists and the Deadeye tag a gun, and it has neither, so they stay out of its rotation. + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/proc/psycho_wire_chrome() + var/datum/component/bounty_chrome/chrome = bounty_chrome_equip(src, bounty_psycho_keys()) + if(!chrome) + return + for(var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/unused in boss_abilities.Copy()) + if(istype(unused.move, /datum/bounty_chrome_move/redline) || istype(unused.move, /datum/bounty_chrome_move/gorilla_grab) || istype(unused.move, /datum/bounty_chrome_move/deadeye)) + boss_abilities -= unused + qdel(unused) + var/datum/bounty_chrome_move/redline/plain = chrome.move_of(/datum/bounty_chrome_move/redline) + if(plain) + chrome.moves -= plain + plain.detach() + qdel(plain) + psycho_add_move(chrome, /datum/bounty_chrome_move/redline/psycho) + psycho_add_move(chrome, /datum/bounty_chrome_move/gorilla_punch/psycho) + for(var/datum/bounty_chrome_move/move as anything in chrome.moves) + move.tell_lines = null + +/// Adds a move of `move_type` to its chrome AI `chrome`, as a move in its rotation (C0's adaptor). Returns the move. +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/proc/psycho_add_move(datum/component/bounty_chrome/chrome, move_type) + var/datum/bounty_chrome_move/move = new move_type + chrome.moves += move + move.attach(src) + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/ability = new(src) + ability.set_move(move) + ability.Grant(src) + boss_abilities += ability + return move + +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/bounty_build_outfit(zone) + return boss_supplies(bounty_outfit_instance(/datum/outfit/bounty_boss/cyberpsycho)) + +// No bag over its spine rig: its stimulants and bruise pack ride in a bum bag, where it reaches them as any boss reaches its bag. The bag holds three, so its combat stimpack rides in a pocket. +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/boss_supplies(datum/outfit/outfit) + if(!istype(outfit)) + return outfit + outfit.belt = /obj/item/storage/belt/fannypack/black + LAZYINITLIST(outfit.belt_contents) + outfit.belt_contents[BOUNTY_BOSS_STIMULANT] = BOUNTY_BOSS_STIMULANTS + outfit.belt_contents[/obj/item/stack/medical/bruise_pack] = 1 + if(isnull(outfit.l_pocket)) + outfit.l_pocket = BOUNTY_BOSS_COMBAT_STIMULANT + else if(isnull(outfit.r_pocket)) + outfit.r_pocket = BOUNTY_BOSS_COMBAT_STIMULANT + return outfit + +// Its chrome is its kit: it dresses to show it (C0's bounty_chrome_expose_outfit()) +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/bounty_dresses_to_show_chrome() + return TRUE + +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/boss_gear_text() + return "[p_They()] can't keep still, and there's more chrome on [p_them()] than skin." + +/// Shorts and boots: its arms, chest and legs are chrome, and they show +/datum/outfit/bounty_boss/cyberpsycho + name = "Bounty mini-boss: Cyberpsycho" + uniform = /obj/item/clothing/under/shorts/black + gloves = null + +// ----- its phase two ----- + +/// Its Redline core, if it is in it +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/proc/psycho_core() + return locate(/obj/item/organ/cyberimp/cyberware/redline) in organs + +/// Its Redline in its rotation, if it has one +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/proc/psycho_burn_ability() + var/datum/component/bounty_chrome/chrome = GetComponent(/datum/component/bounty_chrome) + var/datum/bounty_chrome_move/redline/psycho/burn = chrome?.move_of(/datum/bounty_chrome_move/redline/psycho) + return burn?.boss_ability + +/// Whether its phase two is still to come: it has never burned, and its Redline core is in it and running (an EMP or a brownout puts that off) +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/proc/psycho_burn_pending() + if(psycho_burned) + return FALSE + var/obj/item/organ/core = psycho_core() + var/datum/component/cyberware/ware = core?.GetComponent(/datum/component/cyberware) + return !!ware?.is_running() + +/// Hurt or winded enough to burn +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/proc/psycho_hurt_enough() + return health <= maxHealth * BOUNTY_PSYCHO_BURN_HURT / 100 || getStaminaLoss() >= BOUNTY_PSYCHO_BURN_WINDED + +/** + * Whether it burns its Redline now at `target` (or whoever it fights, for null): its phase two still to + * come, hurt or winded enough, in its fight, and a Redline move's own checks but its "hurt" reading (C3's + * line is any carrier's, this is its own): able to act, someone it may hit in sight, the implant ready, + * and nobody outside the fight within the roar's reach (psycho_roar_clear()). Never at someone it can't + * get at (boss_valid_target(): shot from behind glass it can't break, it takes cover instead, C5), so a + * crew can't spend its phase two from where it can't follow. + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/proc/psycho_burn_due(atom/target) + if(!boss_hostile || !psycho_burn_pending() || !psycho_hurt_enough()) + return FALSE + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/burn = psycho_burn_ability() + var/datum/bounty_chrome_move/redline/move = burn?.move + target ||= bounty_chrome_target(src) || boss_revenge_target() + if(!istype(move) || QDELETED(target) || !bounty_chrome_can_act(src) || !bounty_ai_may_hit(src, target) || !boss_valid_target(target)) + return FALSE + if(bounty_ai_dist(src, target) > move.max_range || !bounty_ai_can_see(src, target, move.max_range)) + return FALSE + return move.ready() && psycho_roar_clear(move.area_turfs(target), target) + +/** + * Whether its Redline's roar may go off over `turfs`: nobody stands there who is outside its fight and has + * a player behind them or is a person (C0's bystander gate, bounty_chrome_area_clear()), but its own + * companions don't count, and nor do creatures: a cyberpsycho doesn't mind staggering its friends. Its + * companions come in one for each extra hunter (OC-8), so C0's gate would keep its phase two shut in most + * fights against a crew. + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/proc/psycho_roar_clear(list/turfs, atom/aimed) + for(var/turf/spot as anything in turfs) + if(!isturf(spot)) + continue + var/list/people = list() + for(var/mob/living/person in spot) + people += person + for(var/obj/vehicle/sealed/mecha/mech in spot) + for(var/mob/living/pilot in mech.occupants) + people += pilot + for(var/mob/living/person as anything in people) + if(person == src || person.stat == DEAD || bounty_ai_same_gang(src, person)) + continue + if((person.mind || person.client || ishuman(person)) && !bounty_chrome_in_posse(src, person, aimed)) + return FALSE + return TRUE + +// Its phase two comes before any other move +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/boss_choose_ability(atom/target) + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/burn = psycho_burn_ability() + if(burn && !QDELETED(target) && boss_can_use_ability() && burn.IsAvailable() && burn.worth_using(target)) + return burn + return ..() + +// A stamina weapon or a bad wound: it doesn't wait its turn to burn. A moment later, once the hit is done with. +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/boss_took_damage(damage, damagetype) + if(!psycho_burned && psycho_hurt_enough()) + addtimer(CALLBACK(src, PROC_REF(psycho_burn_now)), 1, TIMER_UNIQUE | TIMER_DELETE_ME) + +/** + * Burns its Redline now if it should (psycho_burn_due()): whatever it was winding up, or the glass it was + * punching, it drops, and the burn's tell starts in the next move's place. Not while it is up in a leap, + * holding on to someone or already winding the burn up. Returns TRUE if the tell started. + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/proc/psycho_burn_now() + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/burn = psycho_burn_ability() + if(QDELETED(src) || !burn || HAS_TRAIT(src, TRAIT_HANDS_BLOCKED) || !boss_can_act()) + return FALSE + var/atom/target = bounty_chrome_target(src) || boss_revenge_target() + if(!burn.worth_using(target)) + return FALSE + if(boss_busy) + // A wind-up or a smash ("smash", BOUNTY_BOSS_BUSY_SMASH) gives way; anything else it sees through + if(boss_winding() == burn || (boss_busy != "windup" && boss_busy != "smash")) + return FALSE + boss_interrupt() + boss_next_ability_at = min(boss_next_ability_at, world.time) + boss_fallback_until = 0 + // Its own click, as its AI's Trigger() makes it: a timer's callback carries the usr of whoever hit it, and Trigger() would click as them + return !!burn.InterceptClickOn(src, null, target) + +// Tiring is what sets its Redline off: until its phase two is spent it burns instead of falling back, and burning, it doesn't tire +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/boss_is_worn_out() + if(psycho_burn_pending() || has_status_effect(/datum/status_effect/cyberware_redline_window)) + return FALSE + return ..() + +// The burn's tell gets its own lines, said over the cooldown on its talk +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/boss_bark(suffix, fallback) + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/winding = boss_winding() + if(suffix == "ability" && istype(winding) && istype(winding.move, /datum/bounty_chrome_move/redline/psycho)) + if(boss_kit && stat == CONSCIOUS) + INVOKE_ASYNC(src, TYPE_PROC_REF(/mob/living, bounty_say), "[boss_kit]_redline", null, TRUE) + return + return ..() + +/// The implant's burn started (its window's stun immunity went on): its phase two is spent +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/proc/psycho_burn_started(datum/source) + SIGNAL_HANDLER + var/datum/status_effect/window = /datum/status_effect/cyberware_redline_window + if(HAS_TRAIT_FROM(src, TRAIT_STUNIMMUNE, initial(window.id))) + psycho_burned = TRUE + +/// The burn is over (its stun immunity went), and the crash comes: it says so +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/proc/psycho_burn_ended(datum/source) + SIGNAL_HANDLER + if(psycho_burned && boss_kit && stat == CONSCIOUS) + INVOKE_ASYNC(src, TYPE_PROC_REF(/mob/living, bounty_say), "[boss_kit]_exhausted", null, TRUE) + +/** + * A player in its body (a brain transplant) loses its gear (the human NPC base's Login()), and the headroom + * only a cyberpsycho carries: with its core's capacity gone, its chrome browns out, all of it, as anyone's + * does over capacity. Admins driving it for an event keep it. + */ +/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/Login() + . = ..() + if(!. || isnull(client) || client.holder) + return + var/obj/item/organ/core = psycho_core() + var/datum/component/cyberware/core_ware = core?.GetComponent(/datum/component/cyberware) + if(core_ware?.capacity_bonus) + core_ware.capacity_bonus = 0 + cyberware_reevaluate_brownout(src) + +// ===== ITS MOVES ===== + +/** + * The cyberpsycho's Redline, its phase two, in place of the one every carrier gets: C3's tell (the chest + * speaker glowing red, standing still) and the implant's burn, on its own rules (psycho_burn_due()) and its + * own roar gate (psycho_roar_clear()), checked again as the button is pressed. Wired by the cyberpsycho + * itself (psycho_wire_chrome()), so no other Redline carrier gets it. + */ +/datum/bounty_chrome_move/redline/psycho + piece_key = null + +/datum/bounty_chrome_move/redline/psycho/can_start(atom/target) + var/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/psycho = owner + return istype(psycho) && psycho.psycho_burn_due(target) + +// Someone outside the fight stepped into the roar's reach during the tell: the button stays unpressed +/datum/bounty_chrome_move/redline/psycho/effect(atom/target) + var/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/psycho = owner + if(!istype(psycho) || !psycho.psycho_roar_clear(area_turfs(target), target)) + return FALSE + . = bounty_chrome_trigger(owner, action_type, trigger_target(target)) + if(. && owner.has_status_effect(/datum/status_effect/cyberware_redline_window)) + owner.apply_status_effect(/datum/status_effect/bounty_redline_eyes) + +/** + * Its Gorilla fist's piston punch as a move in its rotation: C2's punch, a fist drawn back over the lit + * tile for its tell, then the arm's own empowered punch. C2 leaves a mini-boss's Gorilla punches to its + * melee; this one's melee is its blade. Wired by the cyberpsycho itself (psycho_wire_chrome()), so no other + * Gorilla Arms carrier gets it. + */ +/datum/bounty_chrome_move/gorilla_punch/psycho + piece_key = null + boss_usable = TRUE + +// Its rotation throws it; it plans nothing of its own +/datum/bounty_chrome_move/gorilla_punch/psycho/plan(datum/ai_controller/controller, atom/target) + return FALSE + +// ===== THE BOUNTY PANEL ===== + +// "All of it" is the cyberpsycho: its body is the only one that carries it all (C0's seam) +/datum/bounty_admin_panel/admin_chrome_all(datum/bounty_record/record, list/kit_organs) + record.archetype = BOUNTY_ARCHETYPE_BOSS + record.kit = BOUNTY_KIT_CYBERPSYCHO + record.style = null + return list() + +#undef BOUNTY_PSYCHO_EXTRA_CAPACITY +#undef BOUNTY_PSYCHO_BURN_HURT +#undef BOUNTY_PSYCHO_BURN_WINDED diff --git a/voidcrew/modules/bounties/strings/bounty_criminals.json b/voidcrew/modules/bounties/strings/bounty_criminals.json index e87678a2b73..2461850b930 100644 --- a/voidcrew/modules/bounties/strings/bounty_criminals.json +++ b/voidcrew/modules/bounties/strings/bounty_criminals.json @@ -75,7 +75,8 @@ "pyromaniac": ["Matches", "Torch", "Cinders", "Smoky", "Blaze"], "demolitionist": ["Fuse", "Boomer", "Sticks", "Two-Fingers", "Detonator"], "ghost": ["Shade", "Blink", "Needle", "Nobody", "Quiet"], - "heavy": ["Gunner", "Big Iron", "Tank", "Belt", "Rattle"] + "heavy": ["Gunner", "Big Iron", "Tank", "Belt", "Rattle"], + "cyberpsycho": ["Static", "Glitch", "Hardwire", "Burnout", "Scrap Saint", "Sparks"] }, "features": { "scar": [ @@ -539,6 +540,25 @@ "Light them up!" ] }, + "pyromaniac_smoke": { + "any": [ + "Hold your breath.", + "Lights out.", + "Bit smoky in here.", + "Where'd I go?", + "Breathe deep.", + "Mind your eyes." + ] + }, + "pyromaniac_reload": { + "any": [ + "Hang on, changing tanks.", + "Fresh tank. Don't go anywhere.", + "Stay right there.", + "Just need a top-up.", + "Hold that thought." + ] + }, "pyromaniac_exhausted": { "any": [ "Running low on fuel...", @@ -678,6 +698,116 @@ "More targets. Fine.", "Hope you all brought armor." ] + }, + "juggernaut_cover": { + "any": [ + "Hiding back there? I'll wait.", + "Come out and face me.", + "You can't stay in there forever.", + "Come out from behind there!", + "I'll be right here when you come out.", + "Shooting from back there? Real brave." + ] + }, + "pyromaniac_cover": { + "any": [ + "Hiding? I can wait.", + "You'll have to come out sometime.", + "Come out, come out. It's warm out here.", + "I've got all day, and plenty of fuel.", + "Stay in there, then. I'll wait.", + "Shooting from back there? Come closer." + ] + }, + "demolitionist_cover": { + "any": [ + "Come out from behind there!", + "Hiding? I've got time.", + "You can't hide in there forever.", + "Shoot from back there all you like. I'll wait.", + "I know where you are.", + "Sooner or later, you come out." + ] + }, + "ghost_cover": { + "any": [ + "You'll come out eventually.", + "I'll be right here.", + "Hiding won't help you.", + "Take your time. I'm not going anywhere.", + "Come and find me.", + "I can wait all day." + ] + }, + "heavy_cover": { + "any": [ + "Can't hide in there forever.", + "Come out from behind there!", + "Stay in there, then. I'll wait.", + "Peek out again. Go on.", + "I've got all day.", + "Shooting from back there? Cute." + ] + }, + "cyberpsycho_intro": { + "any": [ + "Get out of my head!", + "Can you hear it humming? Can you?", + "More meat. Come here.", + "Don't look at me like that!", + "It won't stop. Nothing stops.", + "You're not real. None of you are real." + ] + }, + "cyberpsycho_ability": { + "any": [ + "Hold still!", + "There you are.", + "Got you now!", + "Come here!", + "Stay right there!", + "Don't run, meat!" + ] + }, + "cyberpsycho_redline": { + "any": [ + "Make it stop!", + "LOUDER!", + "Not now. Not now!", + "Everything's red.", + "Shut up! Shut up!", + "It's too loud!" + ] + }, + "cyberpsycho_exhausted": { + "any": [ + "Why is it so quiet?", + "Something's burning. Is that me?", + "I can't feel my arms.", + "Keep running, keep running...", + "My hands won't stop shaking.", + "Just let me sit down." + ] + }, + "cyberpsycho_posse": { + "any": [ + "More of you? Good. More meat.", + "All of you. I'll take all of you.", + "Bring the whole crew.", + "So many voices...", + "Line up.", + "Doesn't matter how many." + ] + }, + "cyberpsycho_cover": { + "any": [ + "Come out! Come OUT!", + "I can hear you breathing.", + "Where'd you go? Where'd you GO?", + "You can't stay in there forever!", + "Hiding won't help. I'll find you.", + "Come out and play." + ] } } } diff --git a/voidcrew/modules/cyberware/cyberware_scan.dm b/voidcrew/modules/cyberware/cyberware_scan.dm index c5fefbcf8ac..05dc2b89ae7 100644 --- a/voidcrew/modules/cyberware/cyberware_scan.dm +++ b/voidcrew/modules/cyberware/cyberware_scan.dm @@ -255,6 +255,8 @@ to_chat(subject, span_warning("[bearer] is reading your hardware. Every piece you have just answered a handshake you never authorized.")) else to_chat(subject, span_warning("Your hardware answers a handshake you never authorized. Someone nearby is reading you.")) + // Whoever is read can answer it: a bounty NPC turns and tells the reader off (voidcrew/modules/bounties/bounty_chrome.dm) + SEND_SIGNAL(subject, COMSIG_CARBON_CHROME_READ, bearer) StartCooldown() return TRUE diff --git a/voidcrew/modules/player_outposts/outpost_prison_boss_moves.dm b/voidcrew/modules/player_outposts/outpost_prison_boss_moves.dm index 918d96de83f..af42e46864b 100644 --- a/voidcrew/modules/player_outposts/outpost_prison_boss_moves.dm +++ b/voidcrew/modules/player_outposts/outpost_prison_boss_moves.dm @@ -78,6 +78,9 @@ return /datum/prison_boss_move/slip_cuffs if(BOUNTY_KIT_HEAVY) return /datum/prison_boss_move/barricade + // Its chrome stays out of prison (decision 7): the Juggernaut's charge + if(BOUNTY_KIT_CYBERPSYCHO) + return /datum/prison_boss_move/charge return null /** diff --git a/voidcrew/modules/unit_tests/_unit_tests.dm b/voidcrew/modules/unit_tests/_unit_tests.dm index 673ce9c3e66..6603f399176 100644 --- a/voidcrew/modules/unit_tests/_unit_tests.dm +++ b/voidcrew/modules/unit_tests/_unit_tests.dm @@ -44,8 +44,19 @@ #include "voidcrew_bounty_admin.dm" #include "voidcrew_bounty_ai.dm" #include "voidcrew_bounty_board.dm" +#include "voidcrew_bounty_boss_reach.dm" #include "voidcrew_bounty_bosses.dm" +#include "voidcrew_bounty_chrome.dm" +#include "voidcrew_bounty_chrome_cascade.dm" +#include "voidcrew_bounty_chrome_deadeye.dm" +#include "voidcrew_bounty_chrome_gorilla.dm" +#include "voidcrew_bounty_chrome_lazarus.dm" +#include "voidcrew_bounty_chrome_mantis.dm" +#include "voidcrew_bounty_chrome_piledriver.dm" +#include "voidcrew_bounty_chrome_redline.dm" +#include "voidcrew_bounty_companions_backup.dm" #include "voidcrew_bounty_criminal.dm" +#include "voidcrew_bounty_cyberpsycho.dm" #include "voidcrew_bounty_guns.dm" #include "voidcrew_bounty_identity.dm" #include "voidcrew_bounty_kingpin.dm" @@ -53,6 +64,7 @@ #include "voidcrew_bounty_lair_maps.dm" #include "voidcrew_bounty_lairs.dm" #include "voidcrew_bounty_outpost.dm" +#include "voidcrew_bounty_pace.dm" #include "voidcrew_bounty_seams.dm" #include "voidcrew_bounty_suits.dm" #include "voidcrew_camera_scope.dm" diff --git a/voidcrew/modules/unit_tests/voidcrew_bounty_admin.dm b/voidcrew/modules/unit_tests/voidcrew_bounty_admin.dm index 67e25b387fb..b7b6d74ecd0 100644 --- a/voidcrew/modules/unit_tests/voidcrew_bounty_admin.dm +++ b/voidcrew/modules/unit_tests/voidcrew_bounty_admin.dm @@ -140,7 +140,7 @@ // A random kit is still a kit. var/mob/living/carbon/human/npc/bounty_criminal/random_boss = spawn_criminal(panel, operator, 3, "boss", null, spot) // BOUNTY_TIER_MOST_WANTED - TEST_ASSERT((random_boss?.record?.kit in list("juggernaut", "pyromaniac", "demolitionist", "ghost", "heavy")), "A boss with a random kit has the kit [random_boss?.record?.kit]") + TEST_ASSERT((random_boss?.record?.kit in list("juggernaut", "pyromaniac", "demolitionist", "ghost", "heavy", "cyberpsycho")), "A boss with a random kit has the kit [random_boss?.record?.kit]") // Bad requests are refused, with a reason and no log line. var/logged = length(panel.operations) @@ -354,7 +354,7 @@ // A boss record always has a kit. var/datum/bounty_record/boss_record = panel.admin_pool_add(operator, 3, "boss", null) // BOUNTY_TIER_MOST_WANTED - TEST_ASSERT((boss_record?.kit in list("juggernaut", "pyromaniac", "demolitionist", "ghost", "heavy")), "A boss test record has the kit [boss_record?.kit]") + TEST_ASSERT((boss_record?.kit in list("juggernaut", "pyromaniac", "demolitionist", "ghost", "heavy", "cyberpsycho")), "A boss test record has the kit [boss_record?.kit]") TEST_ASSERT_EQUAL(length(panel.pool_rows()), 2, "The pool does not list both records") // Through the menu: the list names the records, and a record added there joins. diff --git a/voidcrew/modules/unit_tests/voidcrew_bounty_board.dm b/voidcrew/modules/unit_tests/voidcrew_bounty_board.dm index 7e83faaaf40..b9439b42f83 100644 --- a/voidcrew/modules/unit_tests/voidcrew_bounty_board.dm +++ b/voidcrew/modules/unit_tests/voidcrew_bounty_board.dm @@ -1071,6 +1071,22 @@ TEST_ASSERT(!findtext(text, features[length(features)]), "The warrant lists every feature") qdel(warrant) +/// A closed bounty's warrants burn away, on the floor or in a hand; a relist keeps them +/datum/unit_test/voidcrew_bounty_board/warrant_burns + +/datum/unit_test/voidcrew_bounty_board/warrant_burns/Run() + var/datum/criminal_bounty/posting = board_test_posting() + var/mob/living/carbon/human/consistent/hunter = allocate(/mob/living/carbon/human/consistent) + var/obj/item/paper/bounty_warrant/on_floor = posting.print_warrant(run_loc_floor_bottom_left) + var/obj/item/paper/bounty_warrant/in_hand = posting.print_warrant(run_loc_floor_bottom_left) + hunter.put_in_hands(in_hand) + TEST_ASSERT(hunter.is_holding(in_hand), "The hunter isn't holding the warrant") + posting.relist("slipped away") + TEST_ASSERT(!QDELETED(on_floor) && !QDELETED(in_hand), "A relist burned the warrants") + posting.close("admin") // BOUNTY_CLOSE_ADMIN + TEST_ASSERT(QDELETED(on_floor), "A closed bounty's warrant on the floor is still there") + TEST_ASSERT(QDELETED(in_hand), "A closed bounty's warrant in a hand is still there") + // ===== THE POLISH ROUND ===== /// The card and the warrant read like a poster: the terms, the old photo, one reward and no rules, and a ruin's real name (BUG-9) diff --git a/voidcrew/modules/unit_tests/voidcrew_bounty_boss_reach.dm b/voidcrew/modules/unit_tests/voidcrew_bounty_boss_reach.dm new file mode 100644 index 00000000000..bbf9f942544 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_bounty_boss_reach.dm @@ -0,0 +1,561 @@ +/** + * Bounty hunting: the mini-bosses' reach, cover, Gorilla Arms smash, longer tells and the whole hunting + * crew at the site, for voidcrew/modules/bounties/bounty_boss.dm and bounty_boss_kits.dm (port package + * C5 of PR #507 onto the human bosses). + * + * Fork defines are included after the tests, so a test uses the literal value with a comment naming the + * define. Every test calls the boss's procs, or one planning subtree, directly with the mob in place and + * its AI off; none waits on a timer or an AI walk. + */ + +/// Shared helpers for these tests; not a test itself +/datum/unit_test/voidcrew_bounty_boss/reach + abstract_type = /datum/unit_test/voidcrew_bounty_boss/reach + /// Turfs a test changed -> the type each had first, put back when it ends (outside the room they are space) + var/list/reach_turfs = list() + +/datum/unit_test/voidcrew_bounty_boss/reach/Destroy() + for(var/turf/changed as anything in reach_turfs) + changed.ChangeTurf(reach_turfs[changed]) + reach_turfs = null + return ..() + +// Remembers what the turf was, not plain floor: outside the test room it is space +/datum/unit_test/voidcrew_bounty_boss/reach/change_turf(turf/where, new_type) + if(isnull(reach_turfs[where])) + reach_turfs[where] = where.type + return where.ChangeTurf(new_type) + +/// The tile `dx`, `dy` from the test room's bottom-left corner, outside the room too (space on the test level until a test floors it) +/datum/unit_test/voidcrew_bounty_boss/reach/proc/outside(dx, dy) + return locate(clamp(run_loc_floor_bottom_left.x + dx, 1, world.maxx), clamp(run_loc_floor_bottom_left.y + dy, 1, world.maxy), run_loc_floor_bottom_left.z) + +/// Floors the rectangle `dx`..`dx2`, `dy`..`dy2` from the room's corner (outside the room), to be put back when the test ends +/datum/unit_test/voidcrew_bounty_boss/reach/proc/floor_area(dx, dy, dx2, dy2) + for(var/x_offset in dx to dx2) + for(var/y_offset in dy to dy2) + change_turf(outside(x_offset, y_offset), /turf/open/floor/iron) + +/// Whether `controller`'s last plan has `behavior_type` among its planned behaviours +/datum/unit_test/voidcrew_bounty_boss/reach/proc/planned(datum/ai_controller/controller, behavior_type) + return !!controller.planned_behaviors[GET_AI_BEHAVIOR(behavior_type)] + +/// Runs `boss`'s planning subtree of `subtree_type` once, as a planning pass would, and returns what it returned +/datum/unit_test/voidcrew_bounty_boss/reach/proc/plan_with(mob/living/carbon/human/npc/bounty_criminal/boss/boss, subtree_type) + var/datum/ai_controller/controller = boss.ai_controller + var/datum/ai_planning_subtree/subtree = locate(subtree_type) in controller.planning_subtrees + TEST_ASSERT_NOTNULL(subtree, "[boss.type] doesn't plan with [subtree_type]") + controller.planned_behaviors.Cut() + return subtree.SelectBehaviors(controller, 1) + +/// A boss of `boss_type` at `where` with its AI off, so it stays where the test puts it +/datum/unit_test/voidcrew_bounty_boss/reach/proc/boss_at(boss_type, turf/where) + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = allocate(boss_type, where) + boss.ai_controller?.set_ai_status(AI_STATUS_OFF) + return boss + +/// A Juggernaut at `where` with a real pair of Gorilla Arms put in, the way an NPC gets its chrome (npc_install_cyberware()) +/datum/unit_test/voidcrew_bounty_boss/reach/proc/gorilla_boss(turf/where) + var/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut/boss = boss_at(/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut, where) + TEST_ASSERT_NOTNULL(boss.npc_install_cyberware(/obj/item/organ/cyberimp/cyberware/gorilla_arms), "The right Gorilla Arm didn't go in") + TEST_ASSERT_NOTNULL(boss.npc_install_cyberware(/obj/item/organ/cyberimp/cyberware/gorilla_arms/left), "The left Gorilla Arm didn't go in") + TEST_ASSERT_EQUAL(length(boss.boss_gorilla_arms()), 2, "The boss's Gorilla Arms aren't both working") + return boss + +/// Every arm's own punch cooldown over, and its body ready to click +/datum/unit_test/voidcrew_bounty_boss/reach/proc/ready_fists(mob/living/carbon/human/npc/bounty_criminal/boss/boss) + ready_hands(boss) + for(var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm in boss.organs) + arm.slam_cooldown = 0 + +// ===== LONGER TELLS AND COVER LINES (review r2) ===== + +/datum/unit_test/voidcrew_bounty_boss/reach/tells + +/datum/unit_test/voidcrew_bounty_boss/reach/tells/Run() + var/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/ghost = boss_at(/mob/living/carbon/human/npc/bounty_criminal/boss/ghost, spot(0, 0)) + var/datum/action/cooldown/mob_cooldown/bounty_boss/dash/dash = ability_of(ghost, /datum/action/cooldown/mob_cooldown/bounty_boss/dash) + TEST_ASSERT(abs(dash.windup - 6) < 0.01, "The Ghost's dash tell is [dash.windup / 10] s") // BOUNTY_GHOST_DASH_WINDUP 0.6 s + var/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/pyro = boss_at(/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac, spot(2, 0)) + var/datum/action/cooldown/mob_cooldown/bounty_boss/flamer/flamer = ability_of(pyro, /datum/action/cooldown/mob_cooldown/bounty_boss/flamer) + TEST_ASSERT(abs(flamer.windup - 8) < 0.01, "The flamer's tell is [flamer.windup / 10] s") // BOUNTY_PYROMANIAC_FLAMER_WINDUP 0.8 s + var/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut/juggernaut = boss_at(/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut, spot(4, 0)) + var/datum/action/cooldown/mob_cooldown/bounty_boss/slam/slam = ability_of(juggernaut, /datum/action/cooldown/mob_cooldown/bounty_boss/slam) + TEST_ASSERT(abs(slam.windup - 8) < 0.01, "The slam's tell is [slam.windup / 10] s") // BOUNTY_JUGGERNAUT_SLAM_WINDUP 0.8 s + + // Every kit has its own lines for breaking cover (boss_bark("cover")), as many as any other context + var/list/lines = bounty_identity_strings("lines") + for(var/kit in list("juggernaut", "pyromaniac", "demolitionist", "ghost", "heavy")) // BOUNTY_KIT_* + TEST_ASSERT(length(lines["[kit]_cover"]?["any"]) >= 6, "The [kit] has fewer than 6 lines for taking cover") + +// ===== THE WHOLE HUNTING CREW AT ITS SITE OWES COMPANIONS (review r1, r2; OC-8) ===== + +/** + * Turning hostile, it counts every crew member of a ship hunting it who is playing and at its site, + * seen or not: on the site, on its dock strip. One hunter can't wake it alone while the crew waits by + * the ship. Crew elsewhere on its level (another site in the same lattice), SSD crew, and strangers + * don't count. Each one beyond the first owes it a companion; nothing changes its health. + */ +/datum/unit_test/voidcrew_bounty_boss/reach/crews + /// The test crew, let go of its minds before it goes + var/datum/team/voidcrew/crew + +/datum/unit_test/voidcrew_bounty_boss/reach/crews/Run() + board_test_begin() + var/datum/criminal_bounty/posting = board_test_posting(3, null, 3400, 2, "boss") + posting.record.kit = "juggernaut" // BOUNTY_KIT_JUGGERNAUT + var/obj/structure/overmap/ship/ship = board_test_ship() + crew = new + crew.ship = ship + ship.ship_team = crew + var/mob/living/carbon/human/consistent/tagger = hunter_at(spot(2, 0)) + // Out of its sight past the room's walls, but on its site + var/mob/living/carbon/human/consistent/on_site = hunter_at(outside(0, 20)) + // On the dock strip, at the bottom of its site + var/mob/living/carbon/human/consistent/on_dock = hunter_at(outside(3, -2)) + // On its level, off its site: another planet in the lattice + var/mob/living/carbon/human/consistent/elsewhere = hunter_at(outside(40, 0)) + // On its site, but SSD + var/mob/living/carbon/human/consistent/asleep = hunter_at(outside(1, 20)) + // On its site and playing, but not hunting it + var/mob/living/carbon/human/consistent/stranger = hunter_at(outside(2, 20)) + TEST_ASSERT(get_dist(on_site, run_loc_floor_bottom_left) > 9, "The on-site crewmate is within the boss's sight") // BOUNTY_BOSS_POSSE_RANGE + for(var/mob/living/carbon/human/consistent/playing as anything in list(tagger, on_site, on_dock, elsewhere, stranger)) + playing.mock_client = allocate(/datum/client_interface) + for(var/mob/living/carbon/human/consistent/member as anything in list(tagger, on_site, on_dock, elsewhere, asleep)) + crew.join_member(member.mind) + TEST_ASSERT_EQUAL(posting.hunt(ship), TRUE, "The test ship couldn't hunt the bounty") + var/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut/boss = spawn_bounty_criminal(posting.record, spot(0, 0), posting) + if(boss) + allocated += boss + TEST_ASSERT(istype(boss), "The posted Juggernaut spawned as [boss?.type]") + boss.ai_controller?.set_ai_status(AI_STATUS_OFF) + // Its site: the room and well around it, with a dock strip along the bottom + var/turf/corner = run_loc_floor_bottom_left + boss.site_bounds = list(corner.x - 3, corner.y - 3, corner.x + 25, corner.y + 25, corner.z) + boss.body_dock_top_y = corner.y - 1 + TEST_ASSERT(boss.body_on_site(get_turf(on_site)), "The test's on-site spot is off the site") + TEST_ASSERT(!boss.body_on_site(get_turf(on_dock)) && boss.body_on_dock_strip(get_turf(on_dock)), "The test's dock strip spot isn't on the dock strip") + TEST_ASSERT(!boss.body_on_site(get_turf(elsewhere)), "The test's off-site spot is on the site") + + boss.body_add_grudge(tagger) + boss.boss_turn_hostile(tagger) + TEST_ASSERT(boss.boss_engaged[REF(tagger)], "The hunter who woke it isn't in its posse") + TEST_ASSERT(boss.boss_engaged[REF(on_site)], "A crewmate out of its sight on its site isn't in its posse") + TEST_ASSERT(boss.boss_engaged[REF(on_dock)], "A crewmate waiting on the dock strip isn't in its posse") + TEST_ASSERT(!boss.boss_engaged[REF(elsewhere)], "A crewmate on another site on its level joined its posse") + TEST_ASSERT(!boss.boss_engaged[REF(asleep)], "An SSD crewmate joined its posse") + TEST_ASSERT(!boss.boss_engaged[REF(stranger)], "Someone out of its sight who isn't hunting it joined its posse") + // Three of the crew at its site: two companions owed (one per hunter beyond the first), and its body as it was + TEST_ASSERT_EQUAL(boss.boss_reinforcements_owed + boss.boss_reinforcements_sent, 2, "Woken with three of a crew at its site, it owes the wrong number of companions") + TEST_ASSERT_NOTNULL(boss.boss_reinforce_timer, "The companions owed weren't scheduled") + TEST_ASSERT_EQUAL(boss.maxHealth, 100, "The crew changed the boss's health") // MAX_LIVING_HEALTH + for(var/datum/mind/member as anything in crew.members.Copy()) + member.ship_teams = null + crew.members.Cut() + crew.ship = null + ship.ship_team = null + QDEL_NULL(crew) + board_test_end() + +// ===== HURT FROM WHERE IT CAN'T REACH (review r1 F4) ===== + +/** + * Shot from behind glass it can't break, with no way round: it doesn't go after the shooter, and it + * breaks for cover out of their sight on its own side, with a line. Once they come round, it goes after + * them again. + */ +/datum/unit_test/voidcrew_bounty_boss/reach/out_of_reach + +/datum/unit_test/voidcrew_bounty_boss/reach/out_of_reach/Run() + // A wall down the middle of the room: reinforced glass low, solid wall high + for(var/dy in 0 to 2) + allocate(/obj/structure/window/reinforced/fulltile, spot(2, dy)) + change_turf(spot(2, 3), /turf/closed/wall/r_wall) + change_turf(spot(2, 4), /turf/closed/wall/r_wall) + var/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/ghost = boss_at(/mob/living/carbon/human/npc/bounty_criminal/boss/ghost, spot(0, 0)) + var/datum/ai_controller/controller = ghost.ai_controller + var/mob/living/carbon/human/consistent/sniper = hunter_at(spot(4, 4)) + var/atom/barrier = ghost.boss_barrier_between(get_turf(ghost), get_turf(sniper)) + TEST_ASSERT(istype(barrier, /obj/structure/window), "The glass between them isn't what stops it: [barrier?.type]") + TEST_ASSERT(!ghost.boss_goes_through(barrier), "The Ghost goes through reinforced glass") + TEST_ASSERT(!ghost.boss_can_reach(sniper), "The Ghost can reach someone behind glass with no way round") + TEST_ASSERT(ghost.boss_valid_target(sniper), "Before a shot, the Ghost won't go after someone it can see") + + // Shot from there: it keeps away from them + ghost.body_add_grudge(sniper) + TEST_ASSERT(ghost.boss_note_attacker(sniper), "The shot wasn't noted") + TEST_ASSERT(ghost.boss_shuns(sniper), "Shot from behind glass, the Ghost doesn't keep away from the shooter") + TEST_ASSERT(!ghost.boss_valid_target(sniper), "Shot from behind glass, the Ghost still goes after the shooter") + TEST_ASSERT_NULL(ghost.boss_revenge_target(), "Shot from behind glass, the Ghost turns on the shooter") + var/datum/targeting_strategy/strategy = GET_TARGETING_STRATEGY(/datum/targeting_strategy/basic/human_npc/bounty_boss) + TEST_ASSERT(!strategy.can_attack(ghost, sniper, 9), "The boss's targeting picks a shooter it can't get at") // BOUNTY_BOSS_POSSE_RANGE + TEST_ASSERT_NULL(ghost.boss_nearest_hunter(list(sniper)), "The hunt walks it out at a shooter behind glass") + var/list/watchers = ghost.boss_watchers() + TEST_ASSERT(sniper in watchers, "The shooter isn't one it hides from") + TEST_ASSERT(ghost.boss_seen_from(get_turf(ghost), watchers), "The test needs the shooter to see the Ghost where it stands") + var/turf/cover = ghost.boss_find_cover(watchers) + TEST_ASSERT_NOTNULL(cover, "The Ghost found no cover on its side of the glass") + TEST_ASSERT(!can_see(sniper, cover, 9), "The Ghost's cover is in the shooter's sight") // BOUNTY_BOSS_COVER_SIGHT + TEST_ASSERT(cover.x < spot(2, 0).x, "The Ghost's cover is on the shooter's side") + + // Its planner breaks for that cover, with a line of its own + var/datum/component/bounty_identity_voice/voice = ghost.LoadComponent(/datum/component/bounty_identity_voice) + voice.line_cooldown = 0 + voice.last_line = null + TEST_ASSERT_EQUAL(plan_with(ghost, /datum/ai_planning_subtree/bounty_boss_cover), SUBTREE_RETURN_FINISH_PLANNING, "Seen by a shooter it can't get at, it planned nothing") + TEST_ASSERT_NOTNULL(controller.blackboard["BB_bounty_boss_cover"], "Seen by a shooter it can't get at, it stays put") // BB_BOUNTY_BOSS_COVER + TEST_ASSERT(planned(controller, /datum/ai_behavior/travel_towards), "It doesn't walk for cover") + TEST_ASSERT(voice.last_line in bounty_identity_strings("lines")["ghost_cover"]["any"], "Breaking for cover, the Ghost said [voice.last_line || "nothing"]") + controller.CancelActions() + controller.clear_blackboard_key("BB_bounty_boss_cover") + + // Come round: fair game again + sniper.forceMove(spot(1, 0)) + TEST_ASSERT(ghost.boss_can_reach(sniper), "The Ghost can't reach someone right beside it") + TEST_ASSERT(!ghost.boss_shuns(sniper), "The Ghost keeps away from someone who came round to it") + TEST_ASSERT(ghost.boss_valid_target(sniper), "The Ghost won't go after someone who came round to it") + TEST_ASSERT(!(sniper in ghost.boss_watchers()), "It still hides from someone who came round to it") + +/** + * A sniper far off (review r2): past the walk it works out, and past BOUNTY_BOSS_COVER_SIGHT. On its + * site with open ground round the table between them, it goes after them. Off its site (where it can't + * follow), it sees that they see it and backs off, keeps walking until it gets there, and hides + * behind a wall when one is near. Its walk is always worked out from the tile it stands on. + */ +/datum/unit_test/voidcrew_bounty_boss/reach/far_sniper + +/datum/unit_test/voidcrew_bounty_boss/reach/far_sniper/Run() + // Open floor north of the room: 21 wide, 5 deep + floor_area(0, 10, 20, 14) + var/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/ghost = boss_at(/mob/living/carbon/human/npc/bounty_criminal/boss/ghost, outside(0, 12)) + var/datum/ai_controller/controller = ghost.ai_controller + allocate(/obj/structure/table, outside(2, 12)) + var/mob/living/carbon/human/consistent/sniper = hunter_at(outside(13, 12)) + TEST_ASSERT(get_dist(ghost, sniper) > 10, "The sniper isn't past the walk it works out") // BOUNTY_BOSS_REACH_RANGE + TEST_ASSERT(istype(ghost.boss_barrier_between(get_turf(ghost), get_turf(sniper)), /obj/structure/table), "The table isn't between them") + + // On its site, open ground round the table: in reach, and it goes after them + TEST_ASSERT(ghost.boss_can_reach(sniper), "A sniper 13 tiles off across open ground is out of its reach") + ghost.body_add_grudge(sniper) + TEST_ASSERT(ghost.boss_note_attacker(sniper), "The shot wasn't noted") + TEST_ASSERT(!ghost.boss_shuns(sniper), "Shot from 13 tiles off across open ground, it keeps away from the shooter") + TEST_ASSERT(ghost.boss_valid_target(sniper), "Shot from 13 tiles off, it won't go after the shooter") + TEST_ASSERT(!(sniper in ghost.boss_watchers()), "It hides from a shooter it can walk to") + TEST_ASSERT_EQUAL(ghost.boss_nearest_hunter(list(sniper)), sniper, "The hunt doesn't pick the shooter") + controller.set_blackboard_key("BB_bounty_boss_prey", sniper) // BB_BOUNTY_BOSS_PREY + controller.set_blackboard_key("BB_bounty_boss_hunt_at", world.time + 10 SECONDS) // BB_BOUNTY_BOSS_HUNT_AT + TEST_ASSERT_EQUAL(plan_with(ghost, /datum/ai_planning_subtree/bounty_boss_hunt), SUBTREE_RETURN_FINISH_PLANNING, "The hunt planned nothing") + TEST_ASSERT(planned(controller, /datum/ai_behavior/travel_towards/adjacent), "It doesn't walk after the shooter") + controller.CancelActions() + controller.clear_blackboard_key("BB_bounty_boss_prey") + + // Walled in near it, the same sniper is out of reach: the walk never gets it closer to them + var/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/boxed = boss_at(/mob/living/carbon/human/npc/bounty_criminal/boss/ghost, outside(0, 12)) + for(var/dy in 10 to 14) + change_turf(outside(1, dy), /turf/closed/wall/r_wall) + TEST_ASSERT(!boxed.boss_can_reach(sniper), "Walled in, it can reach a sniper 13 tiles off") + for(var/dy in 10 to 14) + change_turf(outside(1, dy), /turf/open/floor/iron) + qdel(boxed) + + // Off its site (in their ship), 12 tiles off with a clear line: it can't follow, and it knows they see it + var/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/hider = boss_at(/mob/living/carbon/human/npc/bounty_criminal/boss/ghost, outside(7, 12)) + controller = hider.ai_controller + var/turf/ship_floor = make_ship_tile(outside(19, 12)) + sniper.forceMove(ship_floor) + hider.body_add_grudge(sniper) + TEST_ASSERT(hider.boss_note_attacker(sniper), "The shot from the ship wasn't noted") + TEST_ASSERT(hider.boss_shuns(sniper), "Shot from off its site, it doesn't keep away from the shooter") + var/list/watchers = hider.boss_watchers() + TEST_ASSERT(sniper in watchers, "The shooter in their ship isn't one it hides from") + TEST_ASSERT(hider.boss_seen_from(get_turf(hider), watchers), "12 tiles off with a clear line, it thinks the shooter can't see it") + + // Nowhere hidden in reach: it backs off as far as it can, saying so, and keeps going (review r2 bug 3) + var/datum/component/bounty_identity_voice/voice = hider.LoadComponent(/datum/component/bounty_identity_voice) + voice.line_cooldown = 0 + voice.last_line = null + var/turf/start = get_turf(hider) + TEST_ASSERT_EQUAL(plan_with(hider, /datum/ai_planning_subtree/bounty_boss_cover), SUBTREE_RETURN_FINISH_PLANNING, "In the open in a shooter's sight, it planned nothing") + var/turf/away = controller.blackboard["BB_bounty_boss_cover"] // BB_BOUNTY_BOSS_COVER + TEST_ASSERT_NOTNULL(away, "In the open in a shooter's sight, it stays put") + TEST_ASSERT(get_dist(away, sniper) > get_dist(start, sniper), "It doesn't back away from the shooter") + TEST_ASSERT(planned(controller, /datum/ai_behavior/travel_towards), "It doesn't walk away from the shooter") + TEST_ASSERT(voice.last_line in bounty_identity_strings("lines")["ghost_cover"]["any"], "Breaking for cover, the Ghost said [voice.last_line || "nothing"]") + // The next plan, still on its way: it keeps walking + TEST_ASSERT_EQUAL(plan_with(hider, /datum/ai_planning_subtree/bounty_boss_cover), SUBTREE_RETURN_FINISH_PLANNING, "On its way, it planned nothing") + TEST_ASSERT(planned(controller, /datum/ai_behavior/travel_towards), "On its way to the farthest spot, it dropped its own walk") + TEST_ASSERT_EQUAL(controller.blackboard["BB_bounty_boss_cover"], away, "On its way, it changed its mind") // BB_BOUNTY_BOSS_COVER + controller.CancelActions() + + // A wall near it: it hides behind that, out of the shooter's line + for(var/dy in 11 to 13) + change_turf(outside(5, dy), /turf/closed/wall/r_wall) + hider.boss_walk_cache = null + var/turf/cover = hider.boss_find_cover(watchers) + TEST_ASSERT_NOTNULL(cover, "With a wall near it, it found no cover from a shooter 12 tiles off") + TEST_ASSERT(!hider.boss_seen_from(cover, watchers), "Its cover is in the shooter's line") + TEST_ASSERT(cover.x < outside(5, 12).x, "Its cover isn't behind the wall") + + // Its walk is worked out from where it stands, not where it stood + var/list/steps = hider.boss_walkable() + TEST_ASSERT_EQUAL(steps[get_turf(hider)], 0, "Its walk doesn't start where it stands") + hider.forceMove(outside(8, 10)) + steps = hider.boss_walkable() + TEST_ASSERT_EQUAL(steps[get_turf(hider)], 0, "A step later, its walk still starts where it stood") + +/** + * The breach planner (review r2): with its charge on cooldown and a way round, the Juggernaut goes + * round rather than wait at the glass; with the charge ready it walks up; with no way round it waits + * at the glass for the charge. + */ +/datum/unit_test/voidcrew_bounty_boss/reach/breach + +/datum/unit_test/voidcrew_bounty_boss/reach/breach/Run() + var/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut/boss = boss_at(/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut, spot(0, 2)) + var/datum/ai_controller/controller = boss.ai_controller + var/mob/living/carbon/human/consistent/behind = hunter_at(spot(4, 2)) + var/obj/structure/window/fulltile/pane = allocate(/obj/structure/window/fulltile, spot(2, 2)) + var/datum/action/cooldown/mob_cooldown/bounty_boss/charge/charge = ability_of(boss, /datum/action/cooldown/mob_cooldown/bounty_boss/charge) + controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, behind) + TEST_ASSERT(boss.boss_goes_through(pane), "The Juggernaut's charge doesn't go through plain glass") + var/list/blockers = boss.boss_line_blockers(get_turf(boss), get_turf(behind)) + TEST_ASSERT_EQUAL(length(blockers), 1, "One plain window reads as [length(blockers)] things in its way") + TEST_ASSERT(boss.boss_gets_through(blockers), "The Juggernaut's charge doesn't get through one plain window") + TEST_ASSERT_EQUAL(controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET], behind, "The test's target didn't stick") + + // Charge on cooldown, a way round: no breach, so the melee planner walks it round + charge.next_use_time = world.time + 100 SECONDS + TEST_ASSERT(!boss.boss_breaks_through_now(pane), "The Juggernaut's charge is ready on cooldown") + TEST_ASSERT_NULL(plan_with(boss, /datum/ai_planning_subtree/bounty_boss_breach), "With its charge on cooldown and a way round, it went at the glass") + TEST_ASSERT_NULL(controller.blackboard["BB_bounty_boss_spot"], "With its charge on cooldown and a way round, it picked a spot at the glass") // BB_BOUNTY_BOSS_SPOT + + // Charge ready: it walks up to the glass + charge.next_use_time = 0 + TEST_ASSERT(boss.boss_breaks_through_now(pane), "The Juggernaut's charge isn't ready off cooldown") + TEST_ASSERT_EQUAL(plan_with(boss, /datum/ai_planning_subtree/bounty_boss_breach), SUBTREE_RETURN_FINISH_PLANNING, "With its charge ready, it didn't go at the glass") + TEST_ASSERT_EQUAL(controller.blackboard["BB_bounty_boss_spot"], spot(1, 2), "With its charge ready, it isn't walking up to the glass") // BB_BOUNTY_BOSS_SPOT + TEST_ASSERT(planned(controller, /datum/ai_behavior/travel_towards), "With its charge ready, it doesn't walk") + controller.CancelActions() + controller.clear_blackboard_key("BB_bounty_boss_spot") + + // No way round: it waits at the glass for its charge + for(var/dy in list(0, 1, 3, 4)) + allocate(/obj/structure/window/reinforced/fulltile, spot(2, dy)) + boss.boss_walk_cache = null + charge.next_use_time = world.time + 100 SECONDS + TEST_ASSERT(!boss.boss_walks_to(get_turf(behind)), "The test's glass wall has a way round") + TEST_ASSERT_EQUAL(plan_with(boss, /datum/ai_planning_subtree/bounty_boss_breach), SUBTREE_RETURN_FINISH_PLANNING, "With no way round, it didn't go at the glass") + TEST_ASSERT_EQUAL(controller.blackboard["BB_bounty_boss_spot"], spot(1, 2), "With no way round, it isn't walking up to the glass") // BB_BOUNTY_BOSS_SPOT + controller.CancelActions() + +// ===== GORILLA ARMS THROUGH GLASS: THE IMPLANT'S OWN PUNCHES ===== + +/** + * Smashing is all or nothing (review r2): Gorilla Arms leave alone a grille with glass behind it they + * can't break in a few punches, and go at one with glass they can. + */ +/datum/unit_test/voidcrew_bounty_boss/reach/smash_line + +/datum/unit_test/voidcrew_bounty_boss/reach/smash_line/Run() + var/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut/boss = gorilla_boss(spot(0, 1)) + var/datum/ai_controller/controller = boss.ai_controller + var/mob/living/carbon/human/consistent/behind = hunter_at(spot(4, 1)) + var/obj/structure/grille/grille = allocate(/obj/structure/grille, spot(2, 1)) + var/obj/structure/window/reinforced/fulltile/thick = allocate(/obj/structure/window/reinforced/fulltile, spot(2, 1)) + var/list/blockers = boss.boss_line_blockers(get_turf(boss), get_turf(behind)) + TEST_ASSERT((grille in blockers) && (thick in blockers), "The grille and the glass on one tile aren't both in its way") + TEST_ASSERT(boss.boss_gorilla_goes_through(grille), "Gorilla Arms don't go through a grille") + TEST_ASSERT(!boss.boss_gorilla_goes_through(thick), "Gorilla Arms go through reinforced glass") + TEST_ASSERT(!boss.boss_gets_through(blockers), "It goes at a grille with glass behind it it can't break") + controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, behind) + TEST_ASSERT_NULL(plan_with(boss, /datum/ai_planning_subtree/bounty_boss_breach), "It went at a grille with glass behind it it can't break") + TEST_ASSERT_NULL(controller.blackboard["BB_bounty_boss_spot"], "It picked a spot at glass it can't break") // BB_BOUNTY_BOSS_SPOT + + // Plain glass behind the grille: all of it breaks, so it goes at it, its Gorilla Arms ready with the charge on cooldown + qdel(thick) + var/obj/structure/window/fulltile/pane = allocate(/obj/structure/window/fulltile, spot(2, 1)) + var/datum/action/cooldown/mob_cooldown/bounty_boss/charge/charge = ability_of(boss, /datum/action/cooldown/mob_cooldown/bounty_boss/charge) + charge.next_use_time = world.time + 100 SECONDS + boss.boss_walk_cache = null + blockers = boss.boss_line_blockers(get_turf(boss), get_turf(behind)) + TEST_ASSERT((grille in blockers) && (pane in blockers), "The grille and the plain glass on one tile aren't both in its way") + TEST_ASSERT_EQUAL(length(blockers), 2, "A grille and a window on one tile read as [length(blockers)] things in its way") + TEST_ASSERT(boss.boss_gets_through(blockers), "It won't go at a grille with plain glass behind it") + TEST_ASSERT(boss.boss_breaks_through_now(grille), "Its Gorilla Arms aren't ready for the grille") + TEST_ASSERT_EQUAL(plan_with(boss, /datum/ai_planning_subtree/bounty_boss_breach), SUBTREE_RETURN_FINISH_PLANNING, "It didn't go at a grille and glass it can break") + TEST_ASSERT_EQUAL(controller.blackboard["BB_bounty_boss_spot"], spot(1, 1), "It isn't walking up to glass it can break") // BB_BOUNTY_BOSS_SPOT + controller.CancelActions() + +/** + * The smash: a tell first, then the implant's own punches through a plain window, never reinforced glass + * or an airlock, never off its site or near a ship, never with an EMP'd arm or a full hand, and nothing + * lands if it is stopped in the tell. Then what the other kits get through. + */ +/datum/unit_test/voidcrew_bounty_boss/reach/smash + +/datum/unit_test/voidcrew_bounty_boss/reach/smash/Run() + var/obj/structure/window/fulltile/pane = allocate(/obj/structure/window/fulltile, spot(1, 2)) + var/obj/structure/window/reinforced/fulltile/thick = allocate(/obj/structure/window/reinforced/fulltile, spot(1, 4)) + var/obj/machinery/door/airlock/door = allocate(/obj/machinery/door/airlock, spot(1, 0)) + var/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut/boss = gorilla_boss(spot(0, 2)) + TEST_ASSERT(boss.boss_gorilla_goes_through(pane), "Gorilla Arms don't go through plain glass") + TEST_ASSERT(!boss.boss_gorilla_goes_through(thick), "Gorilla Arms go through reinforced glass") + TEST_ASSERT(!boss.boss_can_smash(door), "Gorilla Arms smash an airlock instead of forcing it") + + // The tell: rooted, glowing, the tile lit, nothing broken yet + var/integrity = pane.get_integrity() + TEST_ASSERT(boss.boss_start_smash(pane), "The smash didn't start") + var/serial = boss.boss_busy_serial + TEST_ASSERT_EQUAL(boss.boss_busy, "smash", "The smash doesn't hold the boss") // BOUNTY_BOSS_BUSY_SMASH + TEST_ASSERT(HAS_TRAIT(boss, TRAIT_IMMOBILIZED), "It walks about mid-smash") + TEST_ASSERT_NOTNULL(boss.get_filter("bounty_boss_smash"), "The smash's tell doesn't glow") // BOUNTY_BOSS_SMASH_FILTER + TEST_ASSERT(marks_near(pane, 0) > 0, "The smash marks nothing") + TEST_ASSERT_EQUAL(pane.get_integrity(), integrity, "The glass broke before the tell was over") + TEST_ASSERT(!boss.boss_start_smash(pane), "A second smash started mid-smash") + + // The punches: the implant's own, each what one Gorilla Arms punch does to that glass + var/expected = pane.run_atom_armor(40, BRUTE, MELEE) // BOUNTY_BOSS_SMASH_BLOW, CYBERWARE_GORILLA_STRUCTURE_DAMAGE + ready_fists(boss) + TEST_ASSERT(boss.boss_smash_blow(serial), "The first punch wasn't thrown") + TEST_ASSERT(abs((integrity - pane.get_integrity()) - expected) < 0.1, "A Gorilla Arms punch took [integrity - pane.get_integrity()] off the glass, not the [expected] the smash counts on") + var/punches = 1 + for(var/i in 1 to 6) // BOUNTY_BOSS_SMASH_MOST_BLOWS + if(boss.boss_busy != "smash") + break + ready_fists(boss) + if(boss.boss_smash_blow(serial)) + punches++ + TEST_ASSERT(QDELETED(pane) || !pane.density, "[punches] punches didn't get it through the plain window") + TEST_ASSERT(punches <= 6, "It threw [punches] punches") // BOUNTY_BOSS_SMASH_MOST_BLOWS + TEST_ASSERT_NULL(boss.boss_busy, "The smash kept the boss after it got through") + TEST_ASSERT(!HAS_TRAIT(boss, TRAIT_IMMOBILIZED), "The boss is still rooted after the smash") + TEST_ASSERT_NULL(boss.get_filter("bounty_boss_smash"), "The smash's glow outlived it") + TEST_ASSERT_EQUAL(marks_near(spot(1, 2), 0), 0, "The smash's mark outlived it") + + // Stopped in the tell: nothing lands, the mark goes + var/obj/structure/window/fulltile/other_pane = allocate(/obj/structure/window/fulltile, spot(0, 3)) + boss.boss_next_ability_at = 0 + integrity = other_pane.get_integrity() + TEST_ASSERT(boss.boss_start_smash(other_pane), "The second smash didn't start") + serial = boss.boss_busy_serial + boss.boss_interrupt() + ready_fists(boss) + TEST_ASSERT(!boss.boss_smash_blow(serial), "An interrupted smash threw a punch") + TEST_ASSERT_EQUAL(other_pane.get_integrity(), integrity, "An interrupted smash hurt the glass") + TEST_ASSERT_EQUAL(marks_near(other_pane, 0), 0, "An interrupted smash left its mark") + + // EMP'd, the arms are dead weight until they reboot + boss.boss_next_ability_at = 0 + for(var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm in boss.organs) + var/datum/component/cyberware/ware = arm.GetComponent(/datum/component/cyberware) + ware.start_emp_reboot() + TEST_ASSERT(!boss.boss_gorilla_goes_through(other_pane), "EMP'd Gorilla Arms go through glass") + TEST_ASSERT(!boss.boss_start_smash(other_pane), "EMP'd Gorilla Arms smashed glass") + for(var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm in boss.organs) + var/datum/component/cyberware/ware = arm.GetComponent(/datum/component/cyberware) + ware.tune_up() + TEST_ASSERT(boss.boss_gorilla_goes_through(other_pane), "Rebooted Gorilla Arms don't go through glass") + + // Both hands full: no fist to punch with (the Juggernaut's off hand already holds its shield, C8) + var/obj/item/wrench/left_load = allocate(/obj/item/wrench) + var/obj/item/screwdriver/right_load = allocate(/obj/item/screwdriver) + if(length(boss.get_empty_held_indexes())) + boss.put_in_hands(left_load) + if(length(boss.get_empty_held_indexes())) + boss.put_in_hands(right_load) + TEST_ASSERT(!length(boss.get_empty_held_indexes()), "Test fixture: the boss couldn't fill both hands") + TEST_ASSERT(!boss.boss_has_gorilla_fist(), "With both hands full, it still has a fist to punch with") + TEST_ASSERT(!boss.boss_gorilla_goes_through(other_pane), "With both hands full, its Gorilla Arms go through glass") + qdel(left_load) + qdel(right_load) + TEST_ASSERT(boss.boss_has_gorilla_fist(), "Hands empty again, it has no fist") + + // Off its site: never + var/turf/corner = run_loc_floor_bottom_left + boss.site_bounds = list(corner.x, corner.y, corner.x + 1, corner.y + 2, corner.z) + TEST_ASSERT(!boss.boss_can_smash(other_pane), "Gorilla Arms go at glass off its site") + boss.site_bounds = null + + // The other kits + var/obj/structure/window/fulltile/plain = allocate(/obj/structure/window/fulltile, spot(3, 0)) + var/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut/juggernaut = boss_at(/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut, spot(4, 0)) + TEST_ASSERT(juggernaut.boss_goes_through(plain), "The Juggernaut's charge doesn't go through plain glass") + TEST_ASSERT(!juggernaut.boss_goes_through(thick), "The Juggernaut's charge goes through reinforced glass") + var/mob/living/carbon/human/npc/bounty_criminal/boss/heavy/heavy = boss_at(/mob/living/carbon/human/npc/bounty_criminal/boss/heavy, spot(4, 3)) + TEST_ASSERT(heavy.boss_goes_through(thick), "The Heavy's rounds don't chip interior glass") + var/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/pyro = boss_at(/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac, spot(3, 3)) + TEST_ASSERT(!pyro.boss_goes_through(thick), "The Pyromaniac's molotov goes through reinforced glass") + TEST_ASSERT(!pyro.boss_goes_through(door), "The Pyromaniac's molotov goes over a shut airlock") + var/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/ghost = boss_at(/mob/living/carbon/human/npc/bounty_criminal/boss/ghost, spot(4, 4)) + TEST_ASSERT(!ghost.boss_goes_through(plain), "The Ghost goes through glass") + + // Near a player's ship: never (BOUNTY_ENV_SAFE_RANGE) + make_ship_tile(spot(4, 1)) + TEST_ASSERT(!boss.boss_can_smash(other_pane), "Gorilla Arms go at glass near a player's ship") + TEST_ASSERT(!boss.boss_gorilla_goes_through(other_pane), "Gorilla Arms go through glass near a player's ship") + +// ===== THROWS STOP AT GLASS ===== + +/** + * A thrown molotov, grenade or smoke grenade goes where a real thrown item would: a hunter behind + * reinforced glass or a shut glass airlock is no throw target for the Pyromaniac or the Demolitionist, + * and their throws don't count as getting through it. Over a table, or with nothing in the way, they do. + */ +/datum/unit_test/voidcrew_bounty_boss/reach/throws_stop_at_glass + +/datum/unit_test/voidcrew_bounty_boss/reach/throws_stop_at_glass/Run() + var/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/pyro = boss_at(/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac, spot(0, 2)) + var/mob/living/carbon/human/consistent/hunter = hunter_at(spot(4, 2)) + var/datum/action/cooldown/mob_cooldown/bounty_boss/molotov/molotov = ability_of(pyro, /datum/action/cooldown/mob_cooldown/bounty_boss/molotov) + var/datum/action/cooldown/mob_cooldown/bounty_boss/smoke/smoke = ability_of(pyro, /datum/action/cooldown/mob_cooldown/bounty_boss/smoke) + TEST_ASSERT_NOTNULL(molotov, "The Pyromaniac has no molotov") + TEST_ASSERT_NOTNULL(smoke, "The Pyromaniac has no smoke") + TEST_ASSERT(fight(pyro, hunter), "Test fixture: the Pyromaniac didn't turn hostile") + + // Behind reinforced glass: seen, but no throw lands on them + var/obj/structure/window/reinforced/fulltile/glass = allocate(/obj/structure/window/reinforced/fulltile, spot(2, 2)) + TEST_ASSERT(can_see(pyro, hunter, 7), "Test fixture: the Pyromaniac can't see through the glass") + TEST_ASSERT(!pyro.boss_throw_reaches(spot(0, 2), spot(4, 2)), "A throw goes through reinforced glass") + TEST_ASSERT(!pyro.boss_goes_through(glass), "The Pyromaniac's molotov goes through reinforced glass") + TEST_ASSERT(!pyro.boss_breaks_through_now(glass), "The Pyromaniac walks up to glass to throw over it") + TEST_ASSERT(!molotov.worth_using(hunter), "The Pyromaniac throws a molotov at someone behind glass") + pyro.boss_last_attacker = WEAKREF(hunter) + pyro.boss_last_attacked_at = world.time + TEST_ASSERT(!smoke.worth_using(hunter), "The Pyromaniac throws smoke at someone behind glass") + + // A shut glass airlock: the same + qdel(glass) + var/obj/machinery/door/airlock/glass/airlock = allocate(/obj/machinery/door/airlock/glass, spot(2, 2)) + TEST_ASSERT(airlock.density && !airlock.opacity, "Test fixture: the glass airlock isn't shut and see-through") + TEST_ASSERT(!pyro.boss_throw_reaches(spot(0, 2), spot(4, 2)), "A throw goes through a shut glass airlock") + TEST_ASSERT(!pyro.boss_goes_through(airlock), "The Pyromaniac's molotov goes through a shut glass airlock") + TEST_ASSERT(!molotov.worth_using(hunter), "The Pyromaniac throws a molotov through a shut glass airlock") + qdel(airlock) + + // In the open: they are + TEST_ASSERT(pyro.boss_throw_reaches(spot(0, 2), spot(4, 2)), "A throw doesn't cross open floor") + TEST_ASSERT(molotov.worth_using(hunter), "The Pyromaniac won't throw a molotov at someone in the open") + pyro.boss_last_attacker = WEAKREF(hunter) + pyro.boss_last_attacked_at = world.time + TEST_ASSERT(smoke.worth_using(hunter), "The Pyromaniac won't throw smoke at someone in the open who shot it") + + // Over a table: still + var/obj/structure/table/table = allocate(/obj/structure/table, spot(2, 2)) + TEST_ASSERT(pyro.boss_throw_reaches(spot(0, 2), spot(4, 2)), "A throw doesn't go over a table") + TEST_ASSERT(pyro.boss_goes_through(table), "The Pyromaniac's molotov doesn't go over a table") + qdel(table) + + // The Demolitionist's grenades, from the same spot + qdel(pyro) + var/mob/living/carbon/human/npc/bounty_criminal/boss/demolitionist/demo = boss_at(/mob/living/carbon/human/npc/bounty_criminal/boss/demolitionist, spot(0, 2)) + var/datum/action/cooldown/mob_cooldown/bounty_boss/grenade/grenade = ability_of(demo, /datum/action/cooldown/mob_cooldown/bounty_boss/grenade) + TEST_ASSERT_NOTNULL(grenade, "The Demolitionist has no grenade") + TEST_ASSERT(fight(demo, hunter), "Test fixture: the Demolitionist didn't turn hostile") + TEST_ASSERT(grenade.worth_using(hunter), "The Demolitionist won't throw a grenade at someone in the open") + TEST_ASSERT(demo.boss_has_next_throw(hunter), "The Demolitionist has no throw for someone in the open") + glass = allocate(/obj/structure/window/reinforced/fulltile, spot(2, 2)) + TEST_ASSERT(!grenade.worth_using(hunter), "The Demolitionist throws a grenade at someone behind glass") + TEST_ASSERT(!demo.boss_goes_through(glass), "The Demolitionist's grenade goes through reinforced glass") + TEST_ASSERT(!demo.boss_breaks_through_now(glass), "The Demolitionist walks up to glass to throw over it") + TEST_ASSERT(!demo.boss_has_next_throw(hunter), "The Demolitionist holds its range for a throw that hits glass") diff --git a/voidcrew/modules/unit_tests/voidcrew_bounty_bosses.dm b/voidcrew/modules/unit_tests/voidcrew_bounty_bosses.dm index 3c40f30f99a..de17dafb544 100644 --- a/voidcrew/modules/unit_tests/voidcrew_bounty_bosses.dm +++ b/voidcrew/modules/unit_tests/voidcrew_bounty_bosses.dm @@ -104,6 +104,32 @@ /datum/unit_test/voidcrew_bounty_boss/proc/carried(mob/living/holder, item_type) return length(holder.get_all_contents_type(item_type)) +/** + * A real `projectile_type` landing on `target` from `from_turf`, the way a projectile's hit loop lands one + * (process_hit_loop(): its PREHIT, then projectile_hit()), aimed at `zone`. Returns what bullet_act() + * returned, or 0 if something stopped it before it landed (a shield). + */ +/datum/unit_test/voidcrew_bounty_boss/proc/shoot(mob/living/target, turf/from_turf, mob/living/firer, projectile_type = /obj/projectile/beam/disabler, zone = BODY_ZONE_CHEST) + var/obj/projectile/shot = allocate(projectile_type, from_turf) + shot.firer = firer + shot.fired_from = firer + shot.starting = from_turf + shot.def_zone = zone + if(SEND_SIGNAL(target, COMSIG_PROJECTILE_PREHIT, shot) & PROJECTILE_INTERRUPT_HIT) + return 0 + return target.projectile_hit(shot, zone) + +/// The combat sense planning subtree's shared instance, which every boss plans with +/datum/unit_test/voidcrew_bounty_boss/proc/sense_subtree() + return GLOB.ai_subtrees[/datum/ai_planning_subtree/npc_combat_sense] + +/// `boss` in a fight with `hunter`: on its grudge list, hostile, and its target +/datum/unit_test/voidcrew_bounty_boss/proc/fight(mob/living/carbon/human/npc/bounty_criminal/boss/boss, mob/living/hunter) + boss.body_add_grudge(hunter) + boss.boss_turn_hostile(hunter) + boss.ai_controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, hunter) + return boss.boss_hostile + // ===== EACH KIT IS A REAL HUMAN IN REAL GEAR, AND GOES CLEANLY ===== /datum/unit_test/voidcrew_bounty_boss/kits @@ -120,7 +146,8 @@ var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = allocate(kit_type) TEST_ASSERT(ishuman(boss), "[kit_type] isn't a real human") TEST_ASSERT_EQUAL(boss.boss_kit, kits[kit_type], "[kit_type] has the wrong kit") - TEST_ASSERT_EQUAL(length(boss.boss_abilities), 2, "[kit_type] doesn't have its two abilities") + // Two each; the Pyromaniac's smoke is a third (C9) + TEST_ASSERT_EQUAL(length(boss.boss_abilities), kit_type == /mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac ? 3 : 2, "[kit_type] has [length(boss.boss_abilities)] abilities") TEST_ASSERT(istype(boss.ai_controller, /datum/ai_controller/basic_controller/bounty_boss), "[kit_type] doesn't have the boss AI") TEST_ASSERT_EQUAL(boss.npc_rank, 2, "[kit_type] isn't ranked a boss") // HUMAN_NPC_RANK_BOSS // Toughness is armour and physiology, never health (defaults 1.5). @@ -129,9 +156,17 @@ TEST_ASSERT(abs(boss.physiology.burn_mod - 0.6) < 0.01, "[kit_type] takes [boss.physiology.burn_mod] burn, not 0.6") TEST_ASSERT(boss.status_flags & CANSTUN, "[kit_type] can't be stunned") TEST_ASSERT(boss.status_flags & CANKNOCKDOWN, "[kit_type] can't be knocked down") - // Its stimulants and a bruise pack, carried for real. - TEST_ASSERT_EQUAL(carried(boss, /obj/item/reagent_containers/hypospray/medipen/stimpack), 2, "[kit_type] doesn't carry its two stimulants") // BOUNTY_BOSS_STIMULANTS + // Its stimulants and a bruise pack, carried for real, the pens used by its combat sense (C8). + TEST_ASSERT_EQUAL(carried(boss, /obj/item/reagent_containers/hypospray/medipen/stimpack) - carried(boss, /obj/item/reagent_containers/hypospray/medipen/stimpack/traitor), 2, "[kit_type] doesn't carry its two stimulants") // BOUNTY_BOSS_STIMULANTS + // And one combat stimpack, issued to it: used up or gone, never loot (BOUNTY_BOSS_COMBAT_STIMULANT) + TEST_ASSERT_EQUAL(carried(boss, /obj/item/reagent_containers/hypospray/medipen/stimpack/traitor), 1, "[kit_type] doesn't carry one combat stimpack") + var/obj/item/reagent_containers/hypospray/medipen/combat_pen = locate(/obj/item/reagent_containers/hypospray/medipen/stimpack/traitor) in boss.get_all_contents() + TEST_ASSERT(human_npc_gear_consumable(combat_pen), "[kit_type]'s combat stimpack isn't issued to it") + TEST_ASSERT(human_npc_can_draw(boss, combat_pen), "[kit_type] can't reach its combat stimpack") TEST_ASSERT(carried(boss, /obj/item/stack/medical/bruise_pack) >= 1, "[kit_type] carries nothing to patch itself up with") + var/datum/component/npc_combat_sense/sense = boss.GetComponent(/datum/component/npc_combat_sense) + TEST_ASSERT(istype(sense?.rules, /datum/npc_combat_sense/bounty/boss), "[kit_type] has no boss combat sense") + TEST_ASSERT(sense_subtree() in boss.ai_controller.planning_subtrees, "[kit_type]'s AI doesn't plan its combat sense") TEST_ASSERT(boss.boss_gear_text(), "[kit_type] has no gear line on examine") var/list/abilities = boss.boss_abilities.Copy() qdel(boss) @@ -139,27 +174,54 @@ for(var/datum/ability as anything in abilities) TEST_ASSERT(QDELETED(ability), "[kit_type]'s [ability.type] outlived it") - // The Juggernaut: riot armour, and a real gene for its size (CB-5, CB-21). + // The Juggernaut: riot armour, a real gene for its size (CB-5, CB-21), and a real tower shield in hand, locked to it, not yet raised (C8). var/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut/jugg = allocate(/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut) TEST_ASSERT(istype(jugg.wear_suit, /obj/item/clothing/suit/armor/riot), "The Juggernaut isn't wearing riot armour") TEST_ASSERT(istype(jugg.head, /obj/item/clothing/head/helmet/toggleable/riot), "The Juggernaut isn't wearing a riot helmet") TEST_ASSERT(HAS_TRAIT(jugg, TRAIT_GIANT), "The Juggernaut isn't a giant") TEST_ASSERT_NOTNULL(jugg.dna.get_mutation(/datum/mutation/gigantism), "The Juggernaut's size isn't the gigantism gene") - - // The Pyromaniac: its fire suit and helmet keep fire off it, not a trait (CB-7). Its torch is a real one, lit. + var/obj/item/shield/riot/phalanx_buckler/shield = jugg.boss_shield() + TEST_ASSERT_NOTNULL(shield, "The Juggernaut holds no tower shield") // BOUNTY_JUGGERNAUT_SHIELD + TEST_ASSERT(human_npc_gear_locked(shield), "The Juggernaut's shield isn't locked to it") + TEST_ASSERT(!shield.raised, "The Juggernaut has its shield up before any fight") + TEST_ASSERT(length(jugg.get_empty_held_indexes()), "The Juggernaut has no free fist beside its shield") + TEST_ASSERT(findtext(jugg.boss_gear_text(), "shield"), "The Juggernaut's examine doesn't show its shield") + + // The Pyromaniac: its fire suit and helmet keep fire off it, not a trait (CB-7). A real flamethrower, fuelled, and a real molotov in hand; a real gas mask on. var/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/pyro = allocate(/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac) TEST_ASSERT(!HAS_TRAIT(pyro, TRAIT_NOFIRE), "The Pyromaniac is fireproof by a trait") TEST_ASSERT(!HAS_TRAIT(pyro, TRAIT_RESISTHEAT), "The Pyromaniac is heat-proof by a trait") TEST_ASSERT(istype(pyro.wear_suit, /obj/item/clothing/suit/utility/fire/firefighter), "The Pyromaniac isn't wearing a firefighter suit") TEST_ASSERT(istype(pyro.head, /obj/item/clothing/head/utility/hardhat/red), "The Pyromaniac isn't wearing a firefighter helmet") TEST_ASSERT(pyro.get_thermal_protection() >= FIRE_SUIT_MAX_TEMP_PROTECT, "The Pyromaniac's gear doesn't keep the fire off it") - var/obj/item/flashlight/flare/torch/torch = locate() in pyro.held_items - TEST_ASSERT_NOTNULL(torch, "The Pyromaniac holds no torch") - TEST_ASSERT(torch.light_on && torch.damtype == BURN, "The Pyromaniac's torch isn't lit") - - // The Demolitionist: a hard hat, and its crowbar in its bag until the fight starts. + var/obj/item/flamethrower/flamer = pyro.boss_flamethrower() + TEST_ASSERT_NOTNULL(flamer, "The Pyromaniac holds no flamethrower") + TEST_ASSERT(bounty_pyro_flamer_fuelled(flamer), "The Pyromaniac's flamethrower has no igniter or plasma") + TEST_ASSERT(!flamer.lit, "The Pyromaniac's flamethrower is lit before any fight") + TEST_ASSERT(human_npc_gear_locked(flamer), "The Pyromaniac's flamethrower isn't locked to it") + TEST_ASSERT(human_npc_gear_locked(flamer.ptank), "The Pyromaniac's plasma tank isn't locked to it") + var/obj/item/reagent_containers/cup/glass/bottle/molotov/bottle = locate() in pyro.held_items + TEST_ASSERT_NOTNULL(bottle, "The Pyromaniac holds no molotov") + TEST_ASSERT(human_npc_gear_consumable(bottle), "The Pyromaniac's molotov isn't issued as a consumable") + TEST_ASSERT(istype(pyro.wear_mask, /obj/item/clothing/mask/gas), "The Pyromaniac isn't wearing a gas mask") + TEST_ASSERT(pyro.has_smoke_protection(), "The Pyromaniac's mask doesn't keep smoke out") + TEST_ASSERT(pyro.boss_hand_for_grenade(), "The Pyromaniac has no hand for its smoke grenade") + var/obj/item/card/id/pyro_card = pyro.wear_id + TEST_ASSERT(istype(pyro_card), "The Pyromaniac has no ID") + TEST_ASSERT_EQUAL(pyro.get_visible_name(), pyro.real_name, "Masked, the Pyromaniac doesn't go by its name") + TEST_ASSERT(!length(pyro_card.access), "The Pyromaniac's ID opens doors") + TEST_ASSERT(!pyro_card.registered_account?.account_balance, "The Pyromaniac's ID holds money") + TEST_ASSERT(human_npc_gear_locked(pyro_card), "The Pyromaniac's ID isn't locked to it") + for(var/obj/item/tank/internals/plasma/spare as anything in pyro.get_all_contents_type(/obj/item/tank/internals/plasma)) + TEST_ASSERT(human_npc_gear_locked(spare), "A Pyromaniac's plasma tank isn't locked to it") + + // The Demolitionist: a hard hat, its crowbar in its bag until the fight starts, and a real CNS rebooter in its head (C8). var/mob/living/carbon/human/npc/bounty_criminal/boss/demolitionist/demo = allocate(/mob/living/carbon/human/npc/bounty_criminal/boss/demolitionist) TEST_ASSERT(istype(demo.head, /obj/item/clothing/head/utility/hardhat), "The Demolitionist isn't wearing a hard hat") + var/obj/item/organ/cyberimp/brain/anti_stun/implant = demo.boss_rebooter() + TEST_ASSERT_NOTNULL(implant, "The Demolitionist has no CNS rebooter") // BOUNTY_DEMOLITIONIST_REBOOTER + TEST_ASSERT_EQUAL(implant.owner, demo, "The Demolitionist's implant isn't in its body") + TEST_ASSERT(get_chrome_load(demo) <= get_chrome_capacity(demo), "The Demolitionist's rebooter puts it over its neural capacity") TEST_ASSERT(istype(demo.belt, /obj/item/storage/belt/bandolier), "The Demolitionist has no bandolier") var/obj/item/crowbar/large/crowbar = locate() in demo.get_all_contents_type(/obj/item/crowbar/large) TEST_ASSERT_NOTNULL(crowbar, "The Demolitionist carries no crowbar") @@ -174,10 +236,11 @@ TEST_ASSERT_NOTNULL(locate(/obj/item/organ/cyberimp/cyberware/slipwire) in ghost.organs, "The Ghost has no Slipwire") TEST_ASSERT_NOTNULL(locate(/obj/item/organ/cyberimp/cyberware/cascade) in ghost.organs, "The Ghost has no Cascade lattice") - // The Heavy: SWAT armour, a real L6 with a belt in it, a spare box and two barrier grenades (CB-13, CB-26). + // The Heavy: an ablative trenchcoat with its hood up (C8), a real L6 with a belt in it, a spare box and two barrier grenades (CB-13, CB-26). var/mob/living/carbon/human/npc/bounty_criminal/boss/heavy/heavy = allocate(/mob/living/carbon/human/npc/bounty_criminal/boss/heavy) - TEST_ASSERT(istype(heavy.wear_suit, /obj/item/clothing/suit/armor/swat), "The Heavy isn't wearing SWAT armour") - TEST_ASSERT(istype(heavy.head, /obj/item/clothing/head/helmet/swat), "The Heavy isn't wearing a SWAT helmet") + TEST_ASSERT(istype(heavy.wear_suit, /obj/item/clothing/suit/hooded/ablative), "The Heavy isn't wearing its ablative coat") // BOUNTY_HEAVY_COAT + TEST_ASSERT(istype(heavy.head, /obj/item/clothing/head/hooded/ablative), "The Heavy's ablative hood isn't up") + TEST_ASSERT(human_npc_gear_locked(heavy.wear_suit) && human_npc_gear_locked(heavy.head), "The Heavy's coat and hood aren't locked to it") var/obj/item/gun/ballistic/automatic/l6_saw/gun = heavy.boss_gun() TEST_ASSERT_NOTNULL(gun, "The Heavy holds no belt-fed gun") TEST_ASSERT(gun.can_shoot(), "The Heavy's gun isn't loaded") @@ -406,6 +469,68 @@ boss.boss_strict_rotation = TRUE TEST_ASSERT_NULL(boss.boss_choose_ability(far), "The strict rotation chose the same ability twice in a row") +// ===== THE PYROMANIAC'S FLAMETHROWER: SWEEPS, A DRY TANK, A TANK CHANGE ===== + +/// Lit for the wind-up, a jet of the boss fire down the lit line; each sweep spends a share of the tank, dry after four; then it changes tanks for a spare in no less than three seconds, the empty gone +/datum/unit_test/voidcrew_bounty_boss/flamethrower + +/datum/unit_test/voidcrew_bounty_boss/flamethrower/Run() + var/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/pyro = allocate(/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac, spot(0, 2)) + var/mob/living/carbon/human/consistent/hunter = hunter_at(spot(2, 2)) + pyro.ai_controller?.set_ai_status(AI_STATUS_OFF) + var/obj/item/flamethrower/flamer = pyro.boss_flamethrower() + TEST_ASSERT_NOTNULL(flamer, "The Pyromaniac holds no flamethrower") + TEST_ASSERT_EQUAL(carried(pyro, /obj/item/tank/internals/plasma), 3, "The Pyromaniac doesn't carry its flamethrower's tank and two spares") // BOUNTY_PYROMANIAC_SPARE_TANKS + var/datum/action/cooldown/mob_cooldown/bounty_boss/flamer/sweep = ability_of(pyro, /datum/action/cooldown/mob_cooldown/bounty_boss/flamer) + ready(pyro) + TEST_ASSERT(sweep.worth_using(hunter), "The flamer isn't worth using two tiles off") + var/pressure_before = flamer.ptank.return_air().return_pressure() + TEST_ASSERT(sweep.Trigger(target = hunter), "The flamer didn't start") + TEST_ASSERT(flamer.lit, "The flamethrower wasn't lit for the wind-up") + TEST_ASSERT(sweep.finish_windup(sweep.pending_serial), "The flamer's wind-up didn't finish") + TEST_ASSERT(hunter.on_fire && hunter.getFireLoss() > 0, "The jet didn't burn and light the hunter on its line") + TEST_ASSERT(locate(/obj/effect/bounty_boss_fire_pool) in GLOB.bounty_boss_fire_pools, "The jet left no burning floor") + var/datum/gas_mixture/spare_air = flamer.ptank.return_air() + TEST_ASSERT(spare_air.return_pressure() < pressure_before, "The sweep spent none of the tank") + TEST_ASSERT(spare_air.return_pressure() > pressure_before * 0.7, "One sweep spent more than its share of the tank") + sleep(1.2 SECONDS) // BOUNTY_PYROMANIAC_FLAMER_SHUTOFF + TEST_ASSERT(!flamer.lit, "The valve wasn't shut after the sweep") + hunter.extinguish_mob() + for(var/obj/effect/bounty_boss_fire_pool/pool as anything in GLOB.bounty_boss_fire_pools) + qdel(pool) + + // Three more sweeps and the tank is dry: no more sweeps until it changes tanks + for(var/i in 1 to 3) + pyro.boss_spend_flamer_fuel(flamer) + TEST_ASSERT(!bounty_pyro_flamer_fuelled(flamer), "The tank isn't dry after four sweeps") // BOUNTY_PYROMANIAC_FLAMER_SWEEPS + TEST_ASSERT(!sweep.worth_using(hunter), "The flamer is worth using on a dry tank") + + // The change: the plan picks it, and it takes at least three seconds + var/datum/ai_controller/controller = pyro.ai_controller + TEST_ASSERT(pyro.boss_gear_plan(controller), "With a dry tank and a spare, the Pyromaniac didn't plan a tank change") + controller.CancelActions() + var/obj/item/tank/internals/plasma/empty = flamer.ptank + var/datum/ai_behavior/bounty_pyro_reload/change = GET_AI_BEHAVIOR(/datum/ai_behavior/bounty_pyro_reload) + var/started = world.time + change.setup(controller) + var/result = 0 + for(var/i in 1 to 30) + pyro.next_move = 0 + result = change.perform(1, controller) + if(result & (AI_BEHAVIOR_SUCCEEDED | AI_BEHAVIOR_FAILED)) + break + sleep(0.5 SECONDS) + change.finish_action(controller, !!(result & AI_BEHAVIOR_SUCCEEDED)) + TEST_ASSERT(result & AI_BEHAVIOR_SUCCEEDED, "The tank change didn't finish") + TEST_ASSERT(world.time - started >= 3 SECONDS, "The tank change took [world.time - started] deciseconds, under three seconds") // BOUNTY_PYROMANIAC_RELOAD_TIME + TEST_ASSERT(bounty_pyro_flamer_fuelled(flamer), "The flamethrower isn't fuelled after the change") + TEST_ASSERT(flamer.ptank != empty, "The empty tank is still on the flamethrower") + TEST_ASSERT_EQUAL(pyro.boss_flamer_sweeps, 0, "The sweep count didn't start over on the new tank") + sleep(0.2 SECONDS) + TEST_ASSERT(QDELETED(empty), "The dropped empty tank is loot") + TEST_ASSERT_EQUAL(carried(pyro, /obj/item/tank/internals/plasma), 2, "The Pyromaniac doesn't have its flamethrower's tank and one spare left") + TEST_ASSERT(sweep.worth_using(hunter), "The flamer isn't worth using after the change") + // ===== FIRE IS TG'S FIRE, ON ANYONE IT CATCHES (CB-8, CB-11) ===== /datum/unit_test/voidcrew_bounty_boss/fire @@ -618,64 +743,95 @@ TEST_ASSERT(other.body_has_grudge(first), "A confronted boss has no grudge against who confronted it") TEST_ASSERT_EQUAL(other.ai_controller?.blackboard[BB_BASIC_MOB_CURRENT_TARGET], first, "A confronted boss isn't going after who confronted it") -// ===== WORN OUT AND THE STIMULANT: REAL STATE, REAL PENS (CB-2, CB-4, CR-4) ===== +// ===== WORN OUT AND THE STIMULANT: REAL STATE, REAL PENS (CB-2, CB-4, CR-4, C8) ===== +/** + * Its stimulant pens go in by combat sense's own rule (human_npc_combat_sense.dm): when it tires in a + * fight, never at the fight's start, never while one is still in its blood, and nothing else injects + * them. Worn out, it takes the pen first and then falls back. + */ /datum/unit_test/voidcrew_bounty_boss/stamina /datum/unit_test/voidcrew_bounty_boss/stamina/Run() var/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut/boss = allocate(/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut, spot(0, 0)) var/mob/living/carbon/human/consistent/hunter = hunter_at(spot(3, 0)) var/datum/ai_controller/controller = boss.ai_controller - boss.body_add_grudge(hunter) - boss.boss_turn_hostile(hunter) - TEST_ASSERT(boss.boss_hostile, "Test fixture: the boss didn't turn hostile") + var/datum/ai_planning_subtree/npc_combat_sense/subtree = sense_subtree() + var/datum/component/npc_combat_sense/sense = boss.GetComponent(/datum/component/npc_combat_sense) + var/datum/ai_behavior/npc_combat_sense_stim/stim = GET_AI_BEHAVIOR(/datum/ai_behavior/npc_combat_sense_stim) - // Stamina works on it from the first hit (CB-2): no fresh immunity. + // Winded but not yet hostile: nothing. + boss.setStaminaLoss(55) + TEST_ASSERT_NULL(subtree.SelectBehaviors(controller, 1), "A boss that isn't fighting used a stimulant") + boss.setStaminaLoss(0) + TEST_ASSERT(fight(boss, hunter), "Test fixture: the boss didn't turn hostile") + + // Stamina works on it from the first hit (CB-2): no fresh immunity, and no pen at the fight's start. boss.apply_damage(30, STAMINA) TEST_ASSERT(boss.getStaminaLoss() >= 30, "A fresh boss shrugged off stamina damage") - - // The fight starting, it injects a real stimulant it carries. - var/datum/ai_planning_subtree/bounty_boss_stimulant/stimulant = new - TEST_ASSERT_EQUAL(stimulant.SelectBehaviors(controller, 1), SUBTREE_RETURN_FINISH_PLANNING, "The boss didn't reach for its stimulant as its fight started") - TEST_ASSERT_EQUAL(boss.boss_stimulants_used, 1, "The boss didn't count its first stimulant") - var/datum/ai_behavior/human_npc_treat_self/treat = GET_AI_BEHAVIOR(/datum/ai_behavior/human_npc_treat_self) - TEST_ASSERT(controller.current_behaviors[treat], "The boss didn't plan to use its stimulant") + TEST_ASSERT_NULL(subtree.SelectBehaviors(controller, 1), "The boss reached for a stimulant before it tired") + + // Tired (55 of the 100 that stamcrit it), still short of worn out: it uses a real pen it carries. + boss.setStaminaLoss(55) + TEST_ASSERT(!boss.boss_is_worn_out(), "Test fixture: 55 stamina loss counts as worn out") + TEST_ASSERT_EQUAL(subtree.SelectBehaviors(controller, 1), SUBTREE_RETURN_FINISH_PLANNING, "The tired boss didn't reach for its stimulant") + TEST_ASSERT(controller.current_behaviors[stim], "The tired boss didn't plan to use its stimulant") + var/obj/item/reagent_containers/hypospray/medipen/stimpack/pen = controller.blackboard["human_npc_stim_item"] // BB_HUMAN_NPC_STIM_ITEM + TEST_ASSERT(istype(pen), "The boss reached for something other than its stimpack") var/finished = FALSE - for(var/step in 1 to 10) + for(var/step in 1 to 6) ready_hands(boss) - var/result = treat.perform(1, controller, "human_npc_treat_item") // BB_HUMAN_NPC_TREAT_ITEM + var/result = stim.perform(1, controller, "human_npc_stim_item") TEST_ASSERT(!(result & AI_BEHAVIOR_FAILED), "Using the stimulant failed at step [step]") if(result & AI_BEHAVIOR_SUCCEEDED) finished = TRUE break TEST_ASSERT(finished, "The boss never finished using its stimulant") + stim.finish_action(controller, TRUE, "human_npc_stim_item") TEST_ASSERT(boss.reagents.has_reagent(/datum/reagent/medicine/ephedrine), "The stimulant isn't in the boss's blood") - TEST_ASSERT_NOTNULL(bounty_ai_find_injector(boss, /obj/item/reagent_containers/hypospray/medipen/stimpack), "The boss has no second stimulant left for its second wind") - treat.finish_action(controller, TRUE, "human_npc_treat_item") - TEST_ASSERT(!boss.boss_wants_stimulant(), "The boss wants a second stimulant before its second wind") + TEST_ASSERT(pen.used_up, "The stimpack isn't spent") + TEST_ASSERT_EQUAL(sense.stims_used, 1, "The stimulant wasn't counted") + TEST_ASSERT(boss.boss_shield()?.loc == boss, "Using the stimulant cost the Juggernaut its shield") - // Worn out is its real stamina (over half its pool): it says so, shows the hunters, and falls back. - boss.setStaminaLoss(0) + // One in its blood: the second pen waits, however tired it gets. + TEST_ASSERT_NULL(subtree.SelectBehaviors(controller, 1), "With a stimulant already in its blood, it reached for another") + + // Worn out is its real stamina (over half its pool): it says so, shows the hunters, takes its second pen first... boss.reagents.clear_reagents() - boss.adjustStaminaLoss(70) + boss.setStaminaLoss(70) TEST_ASSERT(boss.boss_is_worn_out(), "A boss at [boss.getStaminaLoss()] stamina loss isn't worn out") - controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, hunter) var/datum/ai_planning_subtree/bounty_boss_worn_out/worn = new - TEST_ASSERT_EQUAL(worn.SelectBehaviors(controller, 1), SUBTREE_RETURN_FINISH_PLANNING, "A worn-out boss didn't fall back") + TEST_ASSERT_EQUAL(worn.SelectBehaviors(controller, 1), SUBTREE_RETURN_FINISH_PLANNING, "A worn-out boss did nothing") TEST_ASSERT(boss.boss_worn_out, "The boss didn't wear out") TEST_ASSERT_EQUAL(boss.body_last_alert, "worn out", "Wearing out showed [boss.body_last_alert || "nothing"] over the boss") + TEST_ASSERT(controller.current_behaviors[stim], "Worn out with a pen left, it fell back without it") + finished = FALSE + for(var/step in 1 to 6) + ready_hands(boss) + var/result = stim.perform(1, controller, "human_npc_stim_item") + if(result & AI_BEHAVIOR_SUCCEEDED) + finished = TRUE + break + TEST_ASSERT(finished, "The worn-out boss never used its second pen") + stim.finish_action(controller, TRUE, "human_npc_stim_item") + TEST_ASSERT_EQUAL(sense.stims_used, 2, "The second stimulant wasn't counted") + + // ...then falls back, its abilities waiting. + TEST_ASSERT_EQUAL(worn.SelectBehaviors(controller, 1), SUBTREE_RETURN_FINISH_PLANNING, "A worn-out boss didn't fall back") + TEST_ASSERT(controller.current_behaviors[GET_AI_BEHAVIOR(/datum/ai_behavior/run_away_from_target)], "A worn-out boss isn't falling back from its target") TEST_ASSERT(boss.boss_fallback_until > world.time, "A worn-out boss has no fall back") TEST_ASSERT(!boss.boss_can_use_ability(), "A boss falling back can still start an ability") - // The fall back over and still worn out: its second wind is due, the second pen with its "recover" line. + // No pens left: it just falls back, and once that is over it fights on. Its combat stimpack, its third pen, goes too. + boss.reagents.clear_reagents() + for(var/obj/item/reagent_containers/hypospray/medipen/left as anything in boss.get_all_contents_type(/obj/item/reagent_containers/hypospray/medipen)) + if(human_npc_is_stim(left)) + qdel(left) + TEST_ASSERT_NULL(human_npc_find_stim(boss), "Test fixture: the boss still has a stimulant") + TEST_ASSERT_EQUAL(worn.SelectBehaviors(controller, 1), SUBTREE_RETURN_FINISH_PLANNING, "With no pens left, the worn-out boss didn't fall back") + TEST_ASSERT(!controller.current_behaviors[stim], "With no pens left, it tried to use one") boss.boss_fallback_until = world.time - 1 - worn.SelectBehaviors(controller, 1) - TEST_ASSERT(boss.boss_second_wind_due, "The boss's second wind isn't due after its fall back") - TEST_ASSERT(boss.boss_wants_stimulant(), "The boss doesn't want its second stimulant") - controller.clear_blackboard_key("human_npc_treat_item") - TEST_ASSERT_EQUAL(stimulant.SelectBehaviors(controller, 1), SUBTREE_RETURN_FINISH_PLANNING, "The boss didn't take its second wind") - TEST_ASSERT_EQUAL(boss.boss_stimulants_used, 2, "The boss didn't count its second stimulant") - TEST_ASSERT(!boss.boss_second_wind_due, "The second wind is still due after it was taken") + TEST_ASSERT_NULL(worn.SelectBehaviors(controller, 1), "Its fall back over, the boss kept falling back") // Its stamina back, it is no longer worn out. boss.setStaminaLoss(0) @@ -950,3 +1106,394 @@ TEST_ASSERT(ghost.boss_surge(), "The Ghost's Cascade lattice didn't fire") TEST_ASSERT(ghost.has_status_effect(/datum/status_effect/cyberware_cascade_window), "The Cascade window didn't open") TEST_ASSERT(!ghost.boss_surge(), "The Cascade lattice fired twice in one cycle") + +// ===== EACH KIT'S ANSWER TO A DISABLER (C8) ===== + +/** + * The Juggernaut raises its real tower shield (the Phalanx buckler) the player's way once its fight is on. + * Raised, shots from the half of the map it faces stop at it; from the side or behind a disabler bolt + * lands (a riot shield lets beams through). It keeps hold of it through a stun, as locked gear does, and + * bullets from the flank wear it out until it breaks. + */ +/datum/unit_test/voidcrew_bounty_boss/juggernaut_shield + +/datum/unit_test/voidcrew_bounty_boss/juggernaut_shield/Run() + var/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut/boss = allocate(/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut, spot(2, 2)) + var/mob/living/carbon/human/consistent/hunter = hunter_at(spot(2, 4)) + var/datum/ai_controller/controller = boss.ai_controller + var/obj/item/shield/riot/phalanx_buckler/shield = boss.boss_shield() + TEST_ASSERT_NOTNULL(shield, "Test fixture: the Juggernaut has no shield") + var/datum/ai_planning_subtree/bounty_boss_gear/gear = GLOB.ai_subtrees[/datum/ai_planning_subtree/bounty_boss_gear] + TEST_ASSERT_NULL(gear.SelectBehaviors(controller, 1), "The Juggernaut raised its shield with no fight on") + + // Its fight on, it raises the shield it holds, used in hand + TEST_ASSERT(fight(boss, hunter), "Test fixture: the Juggernaut didn't turn hostile") + TEST_ASSERT_EQUAL(gear.SelectBehaviors(controller, 1), SUBTREE_RETURN_FINISH_PLANNING, "The Juggernaut didn't plan to raise its shield") + var/datum/ai_behavior/bounty_juggernaut_raise_shield/raise = GET_AI_BEHAVIOR(/datum/ai_behavior/bounty_juggernaut_raise_shield) + ready_hands(boss) + TEST_ASSERT(raise.perform(1, controller) & AI_BEHAVIOR_SUCCEEDED, "The Juggernaut couldn't raise its shield") + TEST_ASSERT(shield.raised, "The Juggernaut's shield isn't raised") + TEST_ASSERT(!boss.boss_gear_plan(controller), "With its shield up, it went to raise it again") + TEST_ASSERT(boss.has_movespeed_modifier(/datum/movespeed_modifier/phalanx_raised), "The raised shield doesn't slow it as it slows anyone") + + // Facing its shooter: bolts from in front, straight or at an angle, stop at the shield + boss.setDir(NORTH) + TEST_ASSERT_EQUAL(shoot(boss, spot(2, 4), hunter), 0, "A bolt from in front got past the raised shield") + TEST_ASSERT_EQUAL(shoot(boss, spot(4, 4), hunter), 0, "A bolt from in front and to one side got past the raised shield") + TEST_ASSERT_EQUAL(boss.getStaminaLoss(), 0, "Bolts from in front did [boss.getStaminaLoss()] stamina damage through the shield") + // From the side and from behind they land, through riot armour's energy 10 + for(var/turf/flank as anything in list(spot(4, 2), spot(0, 2), spot(2, 0))) + boss.setStaminaLoss(0) + TEST_ASSERT(shoot(boss, flank, hunter), "A bolt from [flank.x - boss.x], [flank.y - boss.y] never landed") + TEST_ASSERT(abs(boss.getStaminaLoss() - 27) < 1, "A bolt from [flank.x - boss.x], [flank.y - boss.y] did [boss.getStaminaLoss()] stamina, not 27") + // Turned round, the same shooter gets through + boss.setStaminaLoss(0) + boss.setDir(SOUTH) + TEST_ASSERT(shoot(boss, spot(2, 4), hunter) && boss.getStaminaLoss() > 0, "Its back to the shooter, the shield still stopped the bolt") + boss.setStaminaLoss(0) + + // Paralysed, it keeps hold of its shield (the gear lock refuses the drop), still raised and still facing + boss.setDir(NORTH) + boss.Paralyze(2 SECONDS) + TEST_ASSERT(shield.loc == boss && shield.raised, "Paralysed, the Juggernaut let go of its shield") + TEST_ASSERT_EQUAL(shoot(boss, spot(2, 4), hunter), 0, "Down and facing its shooter, the shield stopped nothing") + boss.SetParalyzed(0) + boss.setStaminaLoss(0) + + // Bullets from the flank: a riot shield's block, and every block wears it until it breaks + var/shots = 0 + while(!QDELETED(shield) && shots < 80) + shots++ + shoot(boss, spot(4, 2), hunter, /obj/projectile/bullet/c9mm) + boss.adjustBruteLoss(-100) + TEST_ASSERT(QDELETED(shield), "[shots] bullets from the flank didn't break the Juggernaut's shield") + TEST_ASSERT_NULL(boss.boss_shield(), "The broken shield is still in the Juggernaut's hand") + TEST_ASSERT(shoot(boss, spot(2, 4), hunter) && boss.getStaminaLoss() > 0, "With its shield broken, bolts from in front still stop") + TEST_ASSERT(!findtext(boss.boss_gear_text(), "shield"), "The Juggernaut's examine still shows a shield it has lost") + boss.setStaminaLoss(0) + +/** + * The Heavy's ablative coat and hood: half of the disabler bolts that hit it reflect, wherever they hit, + * and the rest do what energy armour 60 lets through. A bullet goes into it like into cloth. + */ +/datum/unit_test/voidcrew_bounty_boss/heavy_coat + +/datum/unit_test/voidcrew_bounty_boss/heavy_coat/Run() + var/mob/living/carbon/human/npc/bounty_criminal/boss/heavy/heavy = allocate(/mob/living/carbon/human/npc/bounty_criminal/boss/heavy, spot(2, 2)) + var/mob/living/carbon/human/consistent/hunter = hunter_at(spot(2, 4)) + TEST_ASSERT(findtext(heavy.boss_gear_text(), "reflective"), "The Heavy's examine doesn't show its coat") + var/blocks = 0 + var/list/zones = list() + for(var/i in 1 to 240) + var/zone = pick(BODY_ZONE_CHEST, BODY_ZONE_HEAD, BODY_ZONE_L_ARM, BODY_ZONE_R_LEG, BODY_ZONE_PRECISE_GROIN) + heavy.setStaminaLoss(0) + var/result = shoot(heavy, spot(2, 4), hunter, /obj/projectile/beam/disabler, zone) + if(result == BULLET_ACT_FORCE_PIERCE) + blocks++ + zones[zone] = TRUE + TEST_ASSERT_EQUAL(heavy.getStaminaLoss(), 0, "A bolt the coat reflected still did stamina damage") + continue + TEST_ASSERT(abs(heavy.getStaminaLoss() - 12) < 0.5, "A bolt on its [zone] did [heavy.getStaminaLoss()] stamina, not the 12 that energy armour 60 lets through") + TEST_ASSERT(blocks > 80 && blocks < 160, "The coat reflected [blocks] of 240 bolts, not about half") + for(var/zone in list(BODY_ZONE_CHEST, BODY_ZONE_HEAD, BODY_ZONE_L_ARM, BODY_ZONE_R_LEG)) + TEST_ASSERT(zones[zone], "No bolt to its [zone] was ever reflected") + heavy.setStaminaLoss(0) + + // Bullets are another matter: no reflection, and bullet armour 10 + var/result = shoot(heavy, spot(2, 4), hunter, /obj/projectile/bullet/c9mm) + TEST_ASSERT(result && result != BULLET_ACT_FORCE_PIERCE, "A bullet bounced off the Heavy's coat") + TEST_ASSERT(heavy.getBruteLoss() > 12, "A pistol round did only [heavy.getBruteLoss()] brute through the coat") + +/** + * The Demolitionist's CNS rebooter, tg's own: its first stamina crit of a minute is over in a second, then + * it can't be put down for six; the next one, inside that minute, holds as long as anyone's. + */ +/datum/unit_test/voidcrew_bounty_boss/demolitionist_rebooter + +/datum/unit_test/voidcrew_bounty_boss/demolitionist_rebooter/Run() + var/mob/living/carbon/human/npc/bounty_criminal/boss/demolitionist/demo = allocate(/mob/living/carbon/human/npc/bounty_criminal/boss/demolitionist, spot(2, 2)) + demo.ai_controller?.set_ai_status(AI_STATUS_OFF) + var/obj/item/organ/implant = demo.boss_rebooter() + TEST_ASSERT_NOTNULL(implant, "Test fixture: the Demolitionist has no implant") + TEST_ASSERT(findtext(demo.boss_gear_text(), "skull"), "The Demolitionist's examine doesn't show its implant") + + demo.apply_damage(120, STAMINA) + TEST_ASSERT(demo.has_status_effect(/datum/status_effect/incapacitating/stamcrit), "Test fixture: 120 stamina didn't stamcrit the Demolitionist") + sleep(1.5 SECONDS) + TEST_ASSERT(!demo.has_status_effect(/datum/status_effect/incapacitating/stamcrit), "The rebooter didn't get the Demolitionist up a second after it went down") + TEST_ASSERT_EQUAL(demo.getStaminaLoss(), 0, "The rebooter left it [demo.getStaminaLoss()] stamina loss") + TEST_ASSERT(HAS_TRAIT_FROM(demo, TRAIT_STUNIMMUNE, REF(implant)), "The implant gave it no stun immunity") + + // The window: it can't go down again + demo.apply_damage(120, STAMINA) + TEST_ASSERT(!demo.has_status_effect(/datum/status_effect/incapacitating/stamcrit), "It went down again inside its rebooter's window") + sleep(6 SECONDS) + TEST_ASSERT(!HAS_TRAIT(demo, TRAIT_STUNIMMUNE), "The rebooter's window never closed") + TEST_ASSERT_EQUAL(demo.getStaminaLoss(), 0, "The rebooter didn't clear its stamina as its window closed") + + // The gap: the rebooter is spent for a minute, and the next stamina crit holds long enough for cuffs + demo.apply_damage(120, STAMINA) + TEST_ASSERT(demo.has_status_effect(/datum/status_effect/incapacitating/stamcrit), "After the window it couldn't be put down") + sleep(4.5 SECONDS) + TEST_ASSERT(demo.has_status_effect(/datum/status_effect/incapacitating/stamcrit), "The rebooter got it up twice in a minute") + demo.setStaminaLoss(0) + +/** + * The Ghost under stun fire from beyond its dash: it breaks the shooter's line, a few steps to cover. + * With its dash ready and someone in reach, the dash goes first. + */ +/datum/unit_test/voidcrew_bounty_boss/ghost_cover + +/datum/unit_test/voidcrew_bounty_boss/ghost_cover/Run() + // A short wall east of the middle: the far corner behind it is out of a western hunter's line + change_turf(spot(3, 3), /turf/closed/wall) + change_turf(spot(3, 4), /turf/closed/wall) + var/mob/living/carbon/human/npc/bounty_criminal/boss/ghost/ghost = allocate(/mob/living/carbon/human/npc/bounty_criminal/boss/ghost, spot(2, 2)) + var/mob/living/carbon/human/consistent/hunter = hunter_at(spot(0, 2)) + var/datum/ai_controller/controller = ghost.ai_controller + var/datum/ai_planning_subtree/npc_combat_sense/subtree = sense_subtree() + var/datum/component/npc_combat_sense/sense = ghost.GetComponent(/datum/component/npc_combat_sense) + TEST_ASSERT(istype(sense?.rules, /datum/npc_combat_sense/bounty/boss/ghost), "The Ghost doesn't have its own combat sense") + TEST_ASSERT(fight(ghost, hunter), "Test fixture: the Ghost didn't turn hostile") + // Nothing of its own ready: its knife still in its pocket and its abilities waiting + ghost.boss_next_ability_at = world.time + 100 SECONDS + TEST_ASSERT_NULL(subtree.SelectBehaviors(controller, 1), "The Ghost took cover before anyone shot at it") + + TEST_ASSERT(shoot(ghost, spot(0, 2), hunter), "Test fixture: the bolt didn't land on the Ghost") + TEST_ASSERT(ghost.getStaminaLoss() > 0, "Test fixture: the bolt did no stamina damage") + TEST_ASSERT_EQUAL(subtree.SelectBehaviors(controller, 1), SUBTREE_RETURN_FINISH_PLANNING, "Shot with a disabler, the Ghost stood in the open") + var/turf/cover = controller.blackboard["human_npc_cover"] // BB_HUMAN_NPC_COVER + TEST_ASSERT_NOTNULL(cover, "The Ghost picked no cover") + TEST_ASSERT(!human_npc_line_of_fire(get_turf(hunter), cover, PASSTABLE | PASSGLASS | PASSGRILLE), "The Ghost's cover is in the hunter's line of fire") + TEST_ASSERT(get_dist(ghost, cover) <= 5, "The Ghost's cover is further than it runs") // BOUNTY_GHOST_COVER_STEPS + TEST_ASSERT(controller.current_behaviors[GET_AI_BEHAVIOR(/datum/ai_behavior/npc_combat_sense_take_cover)], "The Ghost didn't set off for its cover") + + // Its knife out and its dash ready, with the shooter in reach: the dash goes first + sense.end_exchange(controller) + controller.CancelActions() + var/obj/item/knife/combat/knife = locate() in ghost.get_all_contents_type(/obj/item/knife/combat) + TEST_ASSERT(human_npc_take_in_hand(ghost, knife), "Test fixture: the Ghost couldn't draw its knife") + ready(ghost) + ghost.setStaminaLoss(0) + shoot(ghost, spot(0, 2), hunter) + TEST_ASSERT_NULL(subtree.SelectBehaviors(controller, 1), "With its dash ready and the shooter in reach, the Ghost ran for cover") + TEST_ASSERT_NULL(controller.blackboard["human_npc_cover"], "With its dash ready, the Ghost picked cover") + ghost.setStaminaLoss(0) + +/** + * The Pyromaniac under stun fire goes for whoever is shooting it, until its flamer reaches them; a ready + * molotov or flamer goes first. The kits without a reaction of their own (Juggernaut, Heavy, Demolitionist) + * fight on as they were. + */ +/datum/unit_test/voidcrew_bounty_boss/pyromaniac_charge + +/datum/unit_test/voidcrew_bounty_boss/pyromaniac_charge/Run() + var/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/pyro = allocate(/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac, spot(0, 0)) + var/mob/living/carbon/human/consistent/first = hunter_at(spot(1, 0)) + var/mob/living/carbon/human/consistent/shooter = hunter_at(spot(4, 4)) + var/datum/ai_controller/controller = pyro.ai_controller + var/datum/ai_planning_subtree/npc_combat_sense/subtree = sense_subtree() + TEST_ASSERT(fight(pyro, first), "Test fixture: the Pyromaniac didn't turn hostile") + pyro.boss_next_ability_at = world.time + 100 SECONDS + + TEST_ASSERT(shoot(pyro, spot(4, 4), shooter), "Test fixture: the bolt didn't land on the Pyromaniac") + TEST_ASSERT_EQUAL(subtree.SelectBehaviors(controller, 1), SUBTREE_RETURN_FINISH_PLANNING, "Shot with a disabler, the Pyromaniac didn't go for the shooter") + TEST_ASSERT_EQUAL(controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET], shooter, "The Pyromaniac didn't turn on whoever shot it") + TEST_ASSERT(controller.current_behaviors[GET_AI_BEHAVIOR(/datum/ai_behavior/human_npc_close_in)], "The Pyromaniac isn't closing on its shooter") + TEST_ASSERT_EQUAL(controller.blackboard["human_npc_stun_shooter"], shooter, "The Pyromaniac is closing on someone else") // BB_HUMAN_NPC_STUN_SHOOTER + TEST_ASSERT_NULL(controller.blackboard["human_npc_cover"], "The Pyromaniac ran for cover") + controller.CancelActions() + + // Within its flamer's reach it stops closing: the flamer does the rest + pyro.forceMove(spot(2, 2)) + TEST_ASSERT_NULL(subtree.SelectBehaviors(controller, 1), "Within its flamer's reach, the Pyromaniac kept closing") + + // A molotov ready: it throws rather than runs + pyro.forceMove(spot(0, 0)) + ready(pyro) + shoot(pyro, spot(4, 4), shooter) + TEST_ASSERT_NULL(subtree.SelectBehaviors(controller, 1), "With its molotov ready, the Pyromaniac ran at the shooter instead") + pyro.setStaminaLoss(0) + + // The kits with no reaction of their own stand their ground (their answer is their gear) + for(var/kit_type in list(/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut, /mob/living/carbon/human/npc/bounty_criminal/boss/heavy, /mob/living/carbon/human/npc/bounty_criminal/boss/demolitionist)) + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = allocate(kit_type, spot(0, 4)) + TEST_ASSERT(fight(boss, shooter), "Test fixture: [kit_type] didn't turn hostile") + boss.boss_next_ability_at = world.time + 100 SECONDS + shoot(boss, spot(4, 4), shooter) + TEST_ASSERT_NULL(subtree.SelectBehaviors(boss.ai_controller, 1), "[kit_type] reacted to one disabler bolt with combat sense") + TEST_ASSERT_NULL(boss.ai_controller.blackboard["human_npc_cover"], "[kit_type] ran for cover") + qdel(boss) + +/** + * The Pyromaniac's smoke (C9): two real smoke grenades in its pockets, issued as consumables. Shot from + * past its flamer's reach it takes one out, pulls the pin and throws it halfway to the shooter: never at someone in its + * flamer's reach, never cuffed, never again inside its cooldown, and never more than the two it carries. + * The cloud is tg's. With the shooter out of sight, it makes for where the shots came from. + */ +/datum/unit_test/voidcrew_bounty_boss/pyromaniac_smoke + +/datum/unit_test/voidcrew_bounty_boss/pyromaniac_smoke/Run() + var/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/pyro = allocate(/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac, spot(0, 0)) + var/mob/living/carbon/human/consistent/shooter = hunter_at(spot(4, 4)) + var/mob/living/carbon/human/consistent/near = hunter_at(spot(1, 0)) + var/datum/ai_controller/controller = pyro.ai_controller + var/datum/action/cooldown/mob_cooldown/bounty_boss/smoke/smoke = ability_of(pyro, /datum/action/cooldown/mob_cooldown/bounty_boss/smoke) + TEST_ASSERT_NOTNULL(smoke, "The Pyromaniac has no smoke") + + // Two real smoke grenades, issued to it: nobody can strip them, and taken off it they are gone + TEST_ASSERT_EQUAL(carried(pyro, /obj/item/grenade/smokebomb), 2, "The Pyromaniac doesn't carry its two smoke grenades") + for(var/obj/item/grenade/smokebomb/grenade as anything in pyro.get_all_contents_type(/obj/item/grenade/smokebomb)) + TEST_ASSERT(human_npc_gear_consumable(grenade), "The Pyromaniac's smoke grenade isn't issued to it") + TEST_ASSERT(HAS_TRAIT(grenade, TRAIT_NO_STRIP), "The Pyromaniac's smoke grenade can be stripped") + TEST_ASSERT_EQUAL(grenade.det_time, 3 SECONDS, "The Pyromaniac's smoke grenade has a [grenade.det_time] fuse") // BOUNTY_PYROMANIAC_SMOKE_FUSE + TEST_ASSERT(!grenade.active && !pyro.is_holding(grenade), "The Pyromaniac has a smoke grenade out before any fight") + + TEST_ASSERT(fight(pyro, shooter), "Test fixture: the Pyromaniac didn't turn hostile") + ready(pyro) + TEST_ASSERT(!smoke.worth_using(shooter), "The Pyromaniac wanted its smoke before anyone shot it") + + // Shot from within its flamer's reach: no smoke + TEST_ASSERT(shoot(pyro, spot(1, 0), near), "Test fixture: the close bolt didn't land") + pyro.setStaminaLoss(0) + TEST_ASSERT(!smoke.worth_using(near), "The Pyromaniac wanted smoke for someone in its flamer's reach") + + // Shot from past it: the smoke goes first + TEST_ASSERT(shoot(pyro, spot(4, 4), shooter), "Test fixture: the bolt didn't land") + pyro.setStaminaLoss(0) + TEST_ASSERT_EQUAL(pyro.boss_choose_ability(shooter), smoke, "Shot from past its flamer's reach, the Pyromaniac didn't choose its smoke") + + // Stunned in its wind-up: the pin stays in, nothing is thrown, and the grenade is kept + TEST_ASSERT(smoke.Trigger(target = shooter), "The smoke didn't start for the stun check") + var/obj/item/grenade/smokebomb/kept = locate() in pyro.held_items + pyro.Paralyze(1 SECONDS) + TEST_ASSERT(!smoke.finish_windup(smoke.pending_serial), "The smoke went ahead with the Pyromaniac stunned") + TEST_ASSERT(!QDELETED(kept) && !kept.active, "A smoke grenade was set off by a stunned Pyromaniac") + pyro.SetParalyzed(0) + if(!QDELETED(kept) && !pyro.is_holding(kept)) + pyro.put_in_hands(kept) + TEST_ASSERT_EQUAL(carried(pyro, /obj/item/grenade/smokebomb), 2, "A stunned Pyromaniac lost a smoke grenade") + ready(pyro) + shoot(pyro, spot(4, 4), shooter) + pyro.setStaminaLoss(0) + + // Not while cuffed + var/obj/item/restraints/handcuffs/cuffs = new(pyro) + pyro.set_handcuffed(cuffs) + pyro.update_handcuffed() + TEST_ASSERT(pyro.is_restrained(), "Test fixture: the cuffs didn't go on") + TEST_ASSERT_NULL(pyro.boss_choose_ability(shooter), "The Pyromaniac chose an ability in cuffs") + pyro.set_handcuffed(null) + pyro.update_handcuffed() + qdel(cuffs) + // The cuffs knocked the grenade out of its hand (tg's): back in hand, so both stay its own + if(!QDELETED(kept) && !pyro.is_holding(kept)) + pyro.put_in_hands(kept) + TEST_ASSERT_EQUAL(carried(pyro, /obj/item/grenade/smokebomb), 2, "Test fixture: the Pyromaniac's dropped smoke grenade didn't go back in hand") + + // A lethal hit from past its reach counts too + controller.CancelActions() + var/datum/component/npc_combat_sense/sense = pyro.GetComponent(/datum/component/npc_combat_sense) + sense.end_exchange(controller) + pyro.boss_last_attacked_at = 0 + TEST_ASSERT(!smoke.worth_using(shooter), "The Pyromaniac wanted its smoke with nobody shooting at it") + pyro.boss_note_attacker(shooter) + TEST_ASSERT(smoke.worth_using(shooter), "Hurt from past its flamer's reach, the Pyromaniac didn't want its smoke") + + // It takes one out, aimed halfway to the shooter; the pin comes out as it throws + TEST_ASSERT(smoke.Trigger(target = shooter), "The smoke didn't start") + var/obj/item/grenade/smokebomb/first = locate() in pyro.held_items + TEST_ASSERT_NOTNULL(first, "The Pyromaniac didn't take out a smoke grenade") + TEST_ASSERT(!first.active, "The Pyromaniac pulled the pin before its wind-up was over") + TEST_ASSERT_EQUAL(smoke.landing, spot(2, 2), "The smoke is aimed at [smoke.landing], not halfway to the shooter") + TEST_ASSERT(smoke.next_use_time >= world.time + 19 SECONDS, "The smoke has no cooldown") // BOUNTY_PYROMANIAC_SMOKE_COOLDOWN + TEST_ASSERT(smoke.finish_windup(smoke.pending_serial), "The smoke's wind-up didn't finish") + TEST_ASSERT(!pyro.is_holding(first), "The Pyromaniac didn't throw its smoke grenade") + TEST_ASSERT(isturf(first.loc), "The thrown smoke grenade isn't loose") + TEST_ASSERT(first.active, "The Pyromaniac threw its smoke grenade with the pin in") + + // The cooldown holds, shot again or not + pyro.boss_next_ability_at = 0 + shoot(pyro, spot(4, 4), shooter) + pyro.setStaminaLoss(0) + TEST_ASSERT(pyro.boss_choose_ability(shooter) != smoke, "The Pyromaniac threw smoke again inside its cooldown") + + // The cloud is tg's: opaque smoke where the grenade goes off, and the grenade spent. tg starts the + // cloud inside the grenade and spreads it a tile per smoke tick, so give it time to fill in (and the + // Pyromaniac time to get back up from the stun above, tg's one-second get_up()) + var/turf/where = get_turf(first) + first.detonate() + TEST_ASSERT(QDELETED(first), "The smoke grenade wasn't used up") + controller.set_ai_status(AI_STATUS_OFF) + sleep(1.5 SECONDS) + controller.set_ai_status(AI_STATUS_ON) + var/obj/effect/particle_effect/fluid/smoke/cloud = locate() in where + TEST_ASSERT_NOTNULL(cloud, "No smoke came out of the grenade") + TEST_ASSERT(cloud.opacity, "The smoke can be seen through") + TEST_ASSERT_EQUAL(carried(pyro, /obj/item/grenade/smokebomb), 1, "The Pyromaniac doesn't have one smoke grenade left") + + // Out of sight in smoke, it makes for where the shots came from, not for where the shooter is now + var/obj/item/grenade/smokebomb/bounty_boss/wall = allocate(/obj/item/grenade/smokebomb/bounty_boss, spot(2, 2)) + wall.detonate() + TEST_ASSERT(!can_see(pyro, shooter, 9), "Test fixture: the Pyromaniac can see through the smoke") + controller.CancelActions() + pyro.boss_next_ability_at = world.time + 100 SECONDS + shoot(pyro, spot(4, 4), shooter) + pyro.setStaminaLoss(0) + shooter.forceMove(spot(3, 4)) + TEST_ASSERT(!can_see(pyro, shooter, 9), "Test fixture: the Pyromaniac can see its shooter round the smoke") + TEST_ASSERT_EQUAL(sense_subtree().SelectBehaviors(controller, 1), SUBTREE_RETURN_FINISH_PLANNING, "In smoke, the Pyromaniac stopped coming") + TEST_ASSERT_EQUAL(controller.blackboard["human_npc_stun_shooter"], spot(4, 4), "In smoke, the Pyromaniac isn't making for where the shots came from") // BB_HUMAN_NPC_STUN_SHOOTER + TEST_ASSERT(controller.current_behaviors[GET_AI_BEHAVIOR(/datum/ai_behavior/human_npc_close_in)], "In smoke, the Pyromaniac isn't moving") + controller.CancelActions() + + // Two grenades, two clouds: then none + ready(pyro) + TEST_ASSERT(smoke.Trigger(target = shooter), "The second smoke didn't start") + var/obj/item/grenade/smokebomb/second = locate() in pyro.held_items + TEST_ASSERT_NOTNULL(second, "The Pyromaniac didn't take out its second grenade") + smoke.finish_windup(smoke.pending_serial) + TEST_ASSERT(second.active, "The Pyromaniac didn't pull the pin on its second grenade") + if(!QDELETED(second)) + second.detonate() + ready(pyro) + pyro.boss_note_attacker(shooter) + TEST_ASSERT_EQUAL(carried(pyro, /obj/item/grenade/smokebomb), 0, "The Pyromaniac has smoke grenades left after two") + TEST_ASSERT(!smoke.worth_using(shooter), "The Pyromaniac wanted smoke with none left") + + for(var/turf/place as anything in RANGE_TURFS(9, spot(2, 2))) + for(var/obj/effect/particle_effect/fluid/smoke/puff in place) + qdel(puff) + +#ifdef BOUNTY_BOSS_RENDERS +/** + * Not a check: renders the kits whose looks changed (C8), before and after, facing each way, to + * data/c8_renders/. Compile with -DBOUNTY_BOSS_RENDERS to run it. "Before" puts the old kit back on the + * same body: no shield on the Juggernaut, SWAT armour and helmet on the Heavy. + */ +/datum/unit_test/voidcrew_bounty_boss/renders + +/datum/unit_test/voidcrew_bounty_boss/renders/Run() + var/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut/jugg = allocate(/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut, spot(1, 1)) + var/mob/living/carbon/human/npc/bounty_criminal/boss/heavy/heavy = allocate(/mob/living/carbon/human/npc/bounty_criminal/boss/heavy, spot(3, 1)) + jugg.ai_controller?.set_ai_status(AI_STATUS_OFF) + heavy.ai_controller?.set_ai_status(AI_STATUS_OFF) + var/obj/item/shield/riot/phalanx_buckler/shield = jugg.boss_shield() + shield?.raise_shield(jugg) + for(var/facing in list(SOUTH, EAST, NORTH, WEST)) + jugg.setDir(facing) + heavy.setDir(facing) + fcopy(getFlatIcon(jugg, facing, no_anim = TRUE), "data/c8_renders/juggernaut_after_[dir2text(facing)].png") + fcopy(getFlatIcon(heavy, facing, no_anim = TRUE), "data/c8_renders/heavy_after_[dir2text(facing)].png") + qdel(shield) + qdel(heavy.wear_suit) + if(heavy.head) + qdel(heavy.head) + heavy.equip_to_slot_or_del(new /obj/item/clothing/suit/armor/swat(heavy), ITEM_SLOT_OCLOTHING) + heavy.equip_to_slot_or_del(new /obj/item/clothing/head/helmet/swat(heavy), ITEM_SLOT_HEAD) + for(var/facing in list(SOUTH, EAST, NORTH, WEST)) + jugg.setDir(facing) + heavy.setDir(facing) + fcopy(getFlatIcon(jugg, facing, no_anim = TRUE), "data/c8_renders/juggernaut_before_[dir2text(facing)].png") + fcopy(getFlatIcon(heavy, facing, no_anim = TRUE), "data/c8_renders/heavy_before_[dir2text(facing)].png") +#endif diff --git a/voidcrew/modules/unit_tests/voidcrew_bounty_chrome.dm b/voidcrew/modules/unit_tests/voidcrew_bounty_chrome.dm new file mode 100644 index 00000000000..a1e064ba4f6 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_bounty_chrome.dm @@ -0,0 +1,687 @@ +/** + * Bounty hunting: chrome core's tests (C0), for voidcrew/modules/bounties/bounty_chrome.dm. + * + * Fork defines are included after the tests, so a test uses the literal value with a comment naming the + * define. Criminals are real human NPCs with the real implants in them; the tests read tg's own state. + * Their AI is switched off where a test drives the chrome by hand, so nothing else happens in between. + * + * Renders: compile with -DBOUNTY_CHROME_RENDERS and the dressed_to_show and malfunction tests write + * flat icons to data/bounty_chrome_renders/ (before: the same body and implants in the outfit it would + * have worn; after: the criminal as spawned). + */ + +/// A piece for the tests only: weight 0, so it never rolls and no admin is offered it. A Cascade lattice. +/datum/bounty_chrome_piece/unit_test + key = "unit_test" + name = "test chrome" + weight = 0 + organs = list(/obj/item/organ/cyberimp/cyberware/cascade) + +/// The test piece's move: a one second tell, then the lattice's own surge. It counts its hooks. +/datum/bounty_chrome_move/unit_test + piece_key = "unit_test" + name = "test surge" + action_type = /datum/action/cooldown/cyberware/cascade_surge + tell_time = 1 SECONDS + tell_sound = null + var/fights = 0 + var/ends = 0 + var/downs = 0 + var/deaths = 0 + var/emps = 0 + var/fired = 0 + var/list/cancels = list() + +/datum/bounty_chrome_move/unit_test/on_fight_start(atom/target) + fights++ + +/datum/bounty_chrome_move/unit_test/on_fight_end() + ends++ + +/datum/bounty_chrome_move/unit_test/on_downed() + downs++ + +/datum/bounty_chrome_move/unit_test/on_death() + deaths++ + +/datum/bounty_chrome_move/unit_test/on_emp(severity) + emps++ + +/datum/bounty_chrome_move/unit_test/cancel(reason) + cancels += reason + +/datum/bounty_chrome_move/unit_test/effect(atom/target) + fired++ + return ..() + +/// The chrome core's tests, and their helpers +/datum/unit_test/voidcrew_bounty_chrome + abstract_type = /datum/unit_test/voidcrew_bounty_chrome + +/// A record of `tier`, `archetype` and `style` or `kit`, carrying `chrome`, for a human +/datum/unit_test/voidcrew_bounty_chrome/proc/make_record(tier = 2, archetype = "normal", style = "brawler", kit, list/chrome) + var/datum/bounty_record/record = generate_bounty_record(tier, archetype, "planet", /datum/species/human) // BOUNTY_PLACEMENT_PLANET + record.tier = tier + record.archetype = archetype + record.style = archetype == "boss" ? null : style // BOUNTY_ARCHETYPE_BOSS + record.kit = kit + record.chrome = chrome + return record + +/// The criminal for `record` at `where`, built now, with no posting, deleted with the test +/datum/unit_test/voidcrew_bounty_chrome/proc/make_criminal(datum/bounty_record/record, turf/where) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = spawn_bounty_criminal(record, where || run_loc_floor_bottom_left, null) + if(criminal) + allocated += criminal + return criminal + +/// The organ types of the chrome in `body` +/datum/unit_test/voidcrew_bounty_chrome/proc/chrome_types(mob/living/carbon/body) + . = list() + for(var/obj/item/organ/organ in body.organs) + if(organ.GetComponent(/datum/component/cyberware)) + . += organ.type + +/// A person with a mind at `where`, deleted with the test +/datum/unit_test/voidcrew_bounty_chrome/proc/make_person(turf/where) + var/mob/living/carbon/human/person = allocate(/mob/living/carbon/human/consistent, where || run_loc_floor_top_right) + person.mind_initialize() + return person + +/// A turf `dx`, `dy` from the bottom left of the test room +/datum/unit_test/voidcrew_bounty_chrome/proc/spot(dx, dy) + return locate(run_loc_floor_bottom_left.x + dx, run_loc_floor_bottom_left.y + dy, run_loc_floor_bottom_left.z) + +// ===== THE PIECES ===== + +/// Every piece is real chrome that fits in a body on its own; the roll rules hold the design (companions never Lazarus or the Piledriver, the meek nothing, the fists and blades melee only); and the Ghost's kit chrome is what the roll fits around +/datum/unit_test/voidcrew_bounty_chrome/pieces + +/datum/unit_test/voidcrew_bounty_chrome/pieces/Run() + var/list/keys = list("cascade", "mantis", "gorilla", "redline", "piledriver", "lazarus", "deadeye") // BOUNTY_CHROME_* + for(var/key in keys) + var/datum/bounty_chrome_piece/piece = GLOB.bounty_chrome_pieces[key] + TEST_ASSERT_NOTNULL(piece, "There is no [key] piece") + TEST_ASSERT(length(piece.organs), "The [key] piece has no implants") + TEST_ASSERT(piece.weight > 0, "The [key] piece never rolls") + TEST_ASSERT(bounty_chrome_organs_fit(piece.organs), "The [key] piece doesn't fit in a body on its own") + for(var/organ_type in piece.organs) + TEST_ASSERT(ispath(organ_type, /obj/item/organ/cyberimp/cyberware) || ispath(organ_type, /obj/item/organ/cyberimp/arm/toolkit/cyberware) || ispath(organ_type, /obj/item/organ/eyes/robotic/cyberware), "The [key] piece's [organ_type] isn't chrome") + TEST_ASSERT(!("meek" in piece.archetypes), "The meek roll [key]") // BOUNTY_ARCHETYPE_MEEK + var/datum/bounty_chrome_piece/lazarus = GLOB.bounty_chrome_pieces["lazarus"] + var/datum/bounty_chrome_piece/piledriver = GLOB.bounty_chrome_pieces["piledriver"] + TEST_ASSERT(!lazarus.companion && !piledriver.companion, "Companions can roll Lazarus or the Piledriver") + for(var/melee_key in list("gorilla", "mantis")) + var/datum/bounty_chrome_piece/melee = GLOB.bounty_chrome_pieces[melee_key] + for(var/gun_style in list("pistol", "shotgun", "bottle")) + TEST_ASSERT(!melee.can_roll(3, "normal", gun_style, null, list()), "[melee_key] rolls on a [gun_style] criminal") + var/datum/bounty_chrome_piece/deadeye = GLOB.bounty_chrome_pieces["deadeye"] + TEST_ASSERT(deadeye.can_roll(1, "normal", "pistol", null, list()), "A pistol criminal can't roll Deadeye") + TEST_ASSERT(!deadeye.can_roll(3, "normal", "brawler", null, list()), "A brawler can roll Deadeye") + // Cascade and Redline share the operating-system slot + TEST_ASSERT(!bounty_chrome_organs_fit(bounty_chrome_organ_types(list("cascade", "redline"))), "Cascade and Redline fit in one body") + TEST_ASSERT(!bounty_chrome_organs_fit(bounty_chrome_organ_types(list("gorilla", "mantis"))), "Gorilla Arms and Mantis Blades fit in one pair of arms") + + // The Ghost's chrome, as the roll knows it, is what the real Ghost carries + var/mob/living/carbon/human/npc/bounty_criminal/ghost = make_criminal(make_record(3, "boss", null, "ghost")) // BOUNTY_TIER_MOST_WANTED, BOUNTY_KIT_GHOST + TEST_ASSERT(istype(ghost, /mob/living/carbon/human/npc/bounty_criminal/boss/ghost), "No Ghost spawned") + var/list/known = bounty_chrome_kit_organs("ghost") + var/list/carried = chrome_types(ghost) + for(var/organ_type in known) + TEST_ASSERT(organ_type in carried, "The Ghost doesn't carry [organ_type], which its rolls fit around") + for(var/organ_type in carried) + TEST_ASSERT(organ_type in known, "The Ghost carries [organ_type], which its rolls don't know about") + for(var/kit in list("juggernaut", "pyromaniac", "demolitionist", "heavy")) + var/mob/living/carbon/human/npc/bounty_criminal/boss = make_criminal(make_record(3, "boss", null, kit)) + TEST_ASSERT_EQUAL(length(chrome_types(boss)), length(bounty_chrome_kit_organs(kit)), "The [kit] carries chrome its rolls don't know about") + +// ===== ROLLING ===== + +/// Chrome rolls by tier, 10, 35 and 60 percent, with a second piece now and then from Wanted up; companions far less often, one piece, never Lazarus or the Piledriver; the meek never +/datum/unit_test/voidcrew_bounty_chrome/roll_odds + +/datum/unit_test/voidcrew_bounty_chrome/roll_odds/Run() + var/list/expected = list(10, 35, 60) // BOUNTY_CHROME_CHANCE_PETTY, _WANTED, _MOST_WANTED + var/tries = 1000 + for(var/tier in 1 to 3) + var/carriers = 0 + var/pairs = 0 + for(var/i in 1 to tries) + var/list/rolled = bounty_chrome_roll(tier, "normal", "brawler", null, list()) + if(!rolled) + continue + carriers++ + if(length(rolled) == 2) + pairs++ + TEST_ASSERT(length(rolled) <= (tier >= 2 ? 2 : 1), "A tier [tier] criminal rolled [length(rolled)] pieces") + var/percent = carriers * 100 / tries + TEST_ASSERT(abs(percent - expected[tier]) <= 5, "Tier [tier] carries chrome [percent]% of the time, not about [expected[tier]]%") + if(tier == 3) + var/second = pairs * 100 / max(carriers, 1) + TEST_ASSERT(abs(second - 30) <= 7, "A Most Wanted carrier has a second piece [second]% of the time, not about 30%") // BOUNTY_CHROME_SECOND_CHANCE + for(var/i in 1 to 200) + TEST_ASSERT_NULL(bounty_chrome_roll(3, "meek", "holdout", null, list()), "A meek criminal rolled chrome") + var/companions = 0 + for(var/i in 1 to tries) + var/list/rolled = bounty_chrome_roll_companion(3, "knife") + if(!rolled) + continue + companions++ + TEST_ASSERT_EQUAL(length(rolled), 1, "A companion rolled [length(rolled)] pieces") + TEST_ASSERT(!(rolled[1] in list("lazarus", "piledriver")), "A companion rolled [rolled[1]]") + var/companion_percent = companions * 100 / tries + TEST_ASSERT(abs(companion_percent - 20) <= 5, "A Most Wanted criminal's companion carries chrome [companion_percent]% of the time, not about 20%") // 60 / BOUNTY_CHROME_COMPANION_DIVISOR + +/// No roll ever puts two implants in one slot or goes over capacity, for any tier, style or kit (the Ghost's own chrome included), and the real bodies agree: nothing browns out +/datum/unit_test/voidcrew_bounty_chrome/no_brownout + +/datum/unit_test/voidcrew_bounty_chrome/no_brownout/Run() + var/list/styles = list("brawler", "knife", "pistol", "shotgun", "club", "bottle") + var/list/kits = list("juggernaut", "pyromaniac", "demolitionist", "ghost", "heavy") + for(var/tier in 1 to 3) + for(var/style in styles) + for(var/i in 1 to 150) + var/list/rolled = bounty_chrome_roll(tier, "normal", style, null, list()) + TEST_ASSERT(bounty_chrome_organs_fit(bounty_chrome_organ_types(rolled)), "A tier [tier] [style] criminal rolled [jointext(rolled, ", ")], which won't fit") + for(var/kit in kits) + var/list/kit_organs = bounty_chrome_kit_organs(kit) + for(var/i in 1 to 150) + var/list/rolled = bounty_chrome_roll(tier, "boss", null, kit, kit_organs) + TEST_ASSERT(bounty_chrome_organs_fit(kit_organs + bounty_chrome_organ_types(rolled)), "A [kit] rolled [jointext(rolled, ", ")], which won't fit beside its kit's chrome") + // Real bodies: each piece alone, all that fits, and the most that fits beside the Ghost's chrome + var/list/sets = list() + for(var/key in list("cascade", "mantis", "gorilla", "redline", "piledriver", "lazarus", "deadeye")) + sets += list(list("normal", key == "deadeye" ? "pistol" : (key == "mantis" ? "knife" : "brawler"), null, list(key))) + sets += list(list("normal", "brawler", null, bounty_chrome_all_that_fits(list()))) + sets += list(list("boss", null, "ghost", bounty_chrome_all_that_fits(bounty_chrome_kit_organs("ghost")))) + sets += list(list("boss", null, "juggernaut", list("cascade", "gorilla"))) + for(var/list/body_set as anything in sets) + var/list/chrome = body_set[4] + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_criminal(make_record(3, body_set[1], body_set[2], body_set[3], chrome.Copy())) + TEST_ASSERT_NOTNULL(criminal, "No criminal spawned with [jointext(chrome, ", ")]") + TEST_ASSERT(get_chrome_load(criminal) <= get_chrome_capacity(criminal), "[jointext(chrome, ", ")] put [get_chrome_load(criminal)] load on a body of [get_chrome_capacity(criminal)]") + var/list/carried = chrome_types(criminal) + for(var/organ_type in bounty_chrome_organ_types(chrome)) + TEST_ASSERT(organ_type in carried, "[jointext(chrome, ", ")]: [organ_type] isn't in the body") + for(var/obj/item/organ/organ in criminal.organs) + var/datum/component/cyberware/ware = organ.GetComponent(/datum/component/cyberware) + TEST_ASSERT(!ware?.browned_out, "[jointext(chrome, ", ")]: [organ] browned out") + TEST_ASSERT(isnull(locate(/obj/item/organ/eyes) in get_turf(criminal)), "[jointext(chrome, ", ")]: the eyes it was born with lie on the floor") + qdel(criminal) + +// ===== THE BODY ===== + +/// The record's chrome is real implants in the body, with its moves; they burn out to scrap when the criminal dies +/datum/unit_test/voidcrew_bounty_chrome/installed + +/datum/unit_test/voidcrew_bounty_chrome/installed/Run() + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_criminal(make_record(2, "normal", "brawler", null, list("gorilla", "lazarus"))) // BOUNTY_TIER_WANTED + var/list/carried = chrome_types(criminal) + for(var/organ_type in list(/obj/item/organ/cyberimp/cyberware/gorilla_arms, /obj/item/organ/cyberimp/cyberware/gorilla_arms/left, /obj/item/organ/cyberimp/cyberware/lazarus)) + TEST_ASSERT(organ_type in carried, "A criminal with Gorilla Arms and Lazarus doesn't carry [organ_type]") + TEST_ASSERT_EQUAL(length(criminal.record.chrome), 2, "The record lost chrome that fits") + var/datum/component/bounty_chrome/chrome = criminal.GetComponent(/datum/component/bounty_chrome) + TEST_ASSERT_NOTNULL(chrome, "A chromed criminal has no chrome AI") + TEST_ASSERT(("gorilla" in chrome.keys) && ("lazarus" in chrome.keys), "The chrome AI doesn't know what it carries") + var/turf/here = get_turf(criminal) + criminal.death() + TEST_ASSERT_EQUAL(length(chrome_types(criminal)), 0, "A dead criminal still carries working chrome") + var/scrap = 0 + for(var/obj/item/burnt_chrome/burnt in here) + scrap++ + TEST_ASSERT_EQUAL(scrap, 3, "A dead criminal's three implants left [scrap] pieces of scrap") + // Prisoners and decoys never take the record's chrome, nor does the kingpin's record roll any + var/datum/bounty_record/kingpin_record = generate_bounty_record(3, "normal", "kingpin_lounge") // BOUNTY_PLACEMENT_KINGPIN + TEST_ASSERT_NULL(kingpin_record.chrome, "A kingpin's record rolled chrome") + var/mob/living/carbon/human/npc/bounty_criminal/meek = make_criminal(make_record(2, "meek", "holdout", null, list("gorilla")), spot(1, 1)) + TEST_ASSERT_NULL(locate(/obj/item/organ/cyberimp/cyberware/gorilla_arms) in meek.organs, "A meek criminal took the chrome on its record") + TEST_ASSERT_NULL(meek.GetComponent(/datum/component/bounty_chrome), "A meek criminal got a chrome AI") + +/// Carriers dress so the chrome shows: their own jumpsuit stays on (chrome draws over it), no coat over arm or chest chrome, no gloves over arm chrome; armour stays on; a mini-boss wears its kit +/datum/unit_test/voidcrew_bounty_chrome/dressed_to_show + +/datum/unit_test/voidcrew_bounty_chrome/dressed_to_show/Run() + var/list/cases = list( + list("gorilla", "brawler", 1), + list("gorilla", "brawler", 2), + list("mantis", "knife", 1), + list("cascade", "brawler", 2), + list("redline", "club", 2), + list("piledriver", "brawler", 2), + list("lazarus", "brawler", 2), + list("deadeye", "pistol", 1), + ) + for(var/list/dress_case as anything in cases) + var/key = dress_case[1] + var/tier = dress_case[3] + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_criminal(make_record(tier, "normal", dress_case[2], null, list(key))) + var/label = "A tier [tier] [key] carrier" + if(key == "gorilla" || key == "mantis") + TEST_ASSERT_NULL(criminal.gloves, "[label] wears gloves over the arms") + // Chrome draws over the jumpsuit, so nobody trades theirs for trousers or shorts + TEST_ASSERT_NOTNULL(criminal.w_uniform, "[label] lost its clothes") + TEST_ASSERT(!istype(criminal.w_uniform, /obj/item/clothing/under/shorts), "[label] changed into [criminal.w_uniform] to show its chrome") + if(tier >= 2) + TEST_ASSERT(istype(criminal.wear_suit, /obj/item/clothing/suit/armor/vest), "[label] took its armour vest off") + else if(key in list("gorilla", "mantis", "cascade", "redline")) + TEST_ASSERT_NULL(criminal.wear_suit, "[label] wears a coat over the chrome") + TEST_ASSERT(criminal.belt || dress_case[2] == "brawler" || dress_case[2] == "knife" || dress_case[2] == "club", "[label] lost the belt its style carries") +#ifdef BOUNTY_CHROME_RENDERS + render_pair(criminal, "[key]_t[tier]") +#endif + qdel(criminal) + // A mini-boss keeps its kit on + var/mob/living/carbon/human/npc/bounty_criminal/juggernaut = make_criminal(make_record(3, "boss", null, "juggernaut", list("gorilla"))) // BOUNTY_KIT_JUGGERNAUT + TEST_ASSERT(istype(juggernaut.wear_suit, /obj/item/clothing/suit/armor/riot), "A Juggernaut with Gorilla Arms took its riot armour off") + TEST_ASSERT((/obj/item/organ/cyberimp/cyberware/gorilla_arms in chrome_types(juggernaut)), "A Juggernaut's Gorilla Arms didn't go in") + // An outfit with a sealed suit stays shut + var/datum/outfit/sealed = new + sealed.uniform = /obj/item/clothing/under/color/grey + sealed.suit = /obj/item/clothing/suit/space/eva + sealed.head = /obj/item/clothing/head/helmet/space/eva + bounty_chrome_expose_outfit(sealed, list(/obj/item/organ/cyberimp/cyberware/cascade)) + TEST_ASSERT_EQUAL(sealed.uniform, /obj/item/clothing/under/color/grey, "Chrome under a space suit undressed it") + TEST_ASSERT_EQUAL(sealed.suit, /obj/item/clothing/suit/space/eva, "Chrome under a space suit took the suit off") + qdel(sealed) + +#ifdef BOUNTY_CHROME_RENDERS +/// Writes `criminal` as spawned, and the same face and implants in the outfit it would have worn, to data/bounty_chrome_renders/ +/datum/unit_test/voidcrew_bounty_chrome/proc/render_pair(mob/living/carbon/human/npc/bounty_criminal/criminal, name) + for(var/facing in list(SOUTH, NORTH)) + fcopy(getFlatIcon(criminal, facing), "data/bounty_chrome_renders/[name]_after_[dir2text(facing)].png") + var/mob/living/carbon/human/dummy/before = bounty_look_dummy(criminal.record.look, criminal.bounty_build_outfit("green"), null) // ZONE_GREEN + if(!before) + return + for(var/organ_type in chrome_types(criminal)) + var/obj/item/organ/organ = new organ_type + organ.Insert(before, special = TRUE, movement_flags = DELETE_IF_REPLACED) + for(var/facing in list(SOUTH, NORTH)) + fcopy(getFlatIcon(before, facing), "data/bounty_chrome_renders/[name]_before_[dir2text(facing)].png") + qdel(before) +#endif + +// ===== MOVES ===== + +/// A move tells for its tell_time (never under 0.8 s), standing still and outlined, then fires the implant's own action; the fight's hooks reach it +/datum/unit_test/voidcrew_bounty_chrome/moves + +/datum/unit_test/voidcrew_bounty_chrome/moves/Run() + var/mob/living/carbon/human/hunter = make_person(spot(3, 0)) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_criminal(make_record(2, "normal", "brawler", null, list("unit_test"))) + criminal.ai_controller?.set_ai_status(AI_STATUS_OFF) + var/datum/component/bounty_chrome/chrome = criminal.GetComponent(/datum/component/bounty_chrome) + TEST_ASSERT_NOTNULL(chrome, "The test chrome gave no chrome AI") + var/datum/bounty_chrome_move/unit_test/move = chrome.move_of(/datum/bounty_chrome_move/unit_test) + TEST_ASSERT_NOTNULL(move, "The test piece's move wasn't made") + TEST_ASSERT_EQUAL(move.owner, criminal, "The move isn't in its criminal") + TEST_ASSERT_NULL(chrome.plan(criminal.ai_controller, 1), "A criminal out of a fight planned a chrome move") + + TEST_ASSERT(criminal.ai_start_fight(hunter), "The criminal wouldn't fight") + chrome.update_fight() + TEST_ASSERT_EQUAL(move.fights, 1, "The move didn't hear the fight start") + TEST_ASSERT_NULL(chrome.plan(criminal.ai_controller, 1), "A chrome move started before the fight's opening") + chrome.next_move_at = 0 + TEST_ASSERT(move.can_start(hunter), "The move won't start on a hunter in sight") + TEST_ASSERT_EQUAL(chrome.plan(criminal.ai_controller, 1), SUBTREE_RETURN_FINISH_PLANNING, "A ready move didn't start") + TEST_ASSERT_EQUAL(chrome.telling, move, "The move's tell isn't running") + TEST_ASSERT(HAS_TRAIT_FROM(criminal, TRAIT_IMMOBILIZED, "bounty_chrome"), "The criminal doesn't stand still through the tell") // BOUNTY_CHROME_TRAIT + TEST_ASSERT_NOTNULL(criminal.get_filter(move.tell_filter()), "The tell has no outline") + TEST_ASSERT_EQUAL(chrome.plan(criminal.ai_controller, 1), SUBTREE_RETURN_FINISH_PLANNING, "Something else was planned during the tell") + sleep(0.6 SECONDS) + TEST_ASSERT_EQUAL(move.fired, 0, "The move fired before its tell was over") + sleep(0.6 SECONDS) + TEST_ASSERT_EQUAL(move.fired, 1, "The move didn't fire after its tell") + TEST_ASSERT_NOTNULL(criminal.has_status_effect(/datum/status_effect/cyberware_cascade_window), "The tell ended but the lattice's own surge didn't run") + TEST_ASSERT(!HAS_TRAIT_FROM(criminal, TRAIT_IMMOBILIZED, "bounty_chrome"), "The criminal still stands still after the tell") + TEST_ASSERT_NULL(criminal.get_filter(move.tell_filter()), "The tell's outline stayed on") + TEST_ASSERT(chrome.next_move_at >= world.time + 3 SECONDS, "Another chrome move may start straight away") // BOUNTY_CHROME_MOVE_GAP + TEST_ASSERT(!move.can_start(hunter), "The move would start again with the lattice cycling") + + // The floor of a tell: a move asking for less still tells for 0.8 s + var/datum/bounty_chrome_move/unit_test/quick = new + quick.tell_time = 1 + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/wrapped = new(criminal) + wrapped.set_move(quick) + TEST_ASSERT(wrapped.windup >= 0.8 SECONDS, "A mini-boss chrome ability winds up for [wrapped.windup / 10] s") // BOUNTY_CHROME_TELL_MIN + qdel(wrapped) + qdel(quick) + + // The fight ending, and death, reach the move + criminal.ai_calm_down() + chrome.update_fight() + TEST_ASSERT_EQUAL(move.ends, 1, "The move didn't hear the fight end") + criminal.death() + TEST_ASSERT_EQUAL(move.deaths, 1, "The move didn't hear its criminal die") + +/// A tell cut short by a stun, an EMP, crit or cuffs fires nothing; a criminal that can't act starts nothing +/datum/unit_test/voidcrew_bounty_chrome/interrupted + +/datum/unit_test/voidcrew_bounty_chrome/interrupted/Run() + var/mob/living/carbon/human/hunter = make_person(spot(3, 0)) + var/list/ways = list("stunned", "emp", "downed", "restrained") + for(var/way in ways) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_criminal(make_record(2, "normal", "brawler", null, list("unit_test"))) + criminal.ai_controller?.set_ai_status(AI_STATUS_OFF) + var/datum/component/bounty_chrome/chrome = criminal.GetComponent(/datum/component/bounty_chrome) + var/datum/bounty_chrome_move/unit_test/move = chrome.move_of(/datum/bounty_chrome_move/unit_test) + criminal.ai_start_fight(hunter) + chrome.update_fight() + TEST_ASSERT(chrome.start_move(move, hunter), "[way]: the tell didn't start") + switch(way) + if("stunned") + criminal.Paralyze(3 SECONDS) + if("emp") + criminal.emp_act(EMP_HEAVY) + if("downed") + // Into soft crit, short of hard crit and death + criminal.setOxyLoss(criminal.health + 20) + if("restrained") + var/obj/item/restraints/handcuffs/cuffs = new(criminal) + criminal.set_handcuffed(cuffs) + criminal.update_handcuffed() + TEST_ASSERT_NULL(chrome.telling, "[way]: the tell kept running") + TEST_ASSERT(length(move.cancels), "[way]: the move wasn't told its tell was cut short") + TEST_ASSERT(!HAS_TRAIT_FROM(criminal, TRAIT_IMMOBILIZED, "bounty_chrome"), "[way]: the hold stayed on") + sleep(1.2 SECONDS) + TEST_ASSERT_EQUAL(move.fired, 0, "[way]: the move fired anyway") + TEST_ASSERT_NULL(criminal.has_status_effect(/datum/status_effect/cyberware_cascade_window), "[way]: the lattice surged anyway") + chrome.next_move_at = 0 + if(way != "emp") + TEST_ASSERT(!move.can_start(hunter), "[way]: a criminal that can't act would start a move") + if(way == "emp") + TEST_ASSERT_EQUAL(move.emps, 1, "The EMP didn't reach the move") + TEST_ASSERT(!move.ready(), "The lattice is ready through its EMP reboot") + if(way == "downed") + TEST_ASSERT_EQUAL(move.downs, 1, "Going down didn't reach the move") + qdel(criminal) + +/// A mini-boss uses its chrome through its own ability rotation: the wind-up is the move's tell, the effect the implant's own action +/datum/unit_test/voidcrew_bounty_chrome/boss + +/datum/unit_test/voidcrew_bounty_chrome/boss/Run() + var/mob/living/carbon/human/hunter = make_person(spot(3, 0)) + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = make_criminal(make_record(3, "boss", null, "juggernaut", list("unit_test"))) + boss.ai_controller?.set_ai_status(AI_STATUS_OFF) + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/ability = locate() in boss.boss_abilities + TEST_ASSERT_NOTNULL(ability, "The Juggernaut's chrome isn't in its ability rotation") + var/datum/bounty_chrome_move/unit_test/move = ability.move + TEST_ASSERT_NOTNULL(move, "The chrome ability runs no move") + TEST_ASSERT_EQUAL(move.owner, boss, "The chrome ability runs someone else's move") + TEST_ASSERT(ability.windup >= 0.8 SECONDS, "The chrome ability winds up for [ability.windup / 10] s") // BOUNTY_CHROME_TELL_MIN + TEST_ASSERT(ability.worth_using(hunter), "The chrome ability isn't worth using on a hunter in sight") + // A move with its own lines says one of them, and the kit's ability line stays unsaid: one line per tell + move.tell_lines = list("Watch this.") + var/datum/component/bounty_identity_voice/voice = boss.LoadComponent(/datum/component/bounty_identity_voice) + COOLDOWN_RESET(voice, line_cooldown) + voice.last_line = null + TEST_ASSERT(ability.Trigger(target = hunter), "The chrome ability wouldn't start") + TEST_ASSERT_NULL(voice.last_line, "The Juggernaut barked its kit's ability line over its chrome's own tell line") + TEST_ASSERT_EQUAL(boss.boss_busy, "windup", "The Juggernaut isn't winding up") + TEST_ASSERT_NOTNULL(boss.get_filter(move.tell_filter()), "The wind-up has no outline") + sleep(1.3 SECONDS) + TEST_ASSERT_EQUAL(move.fired, 1, "The chrome ability didn't fire after its wind-up") + TEST_ASSERT_NOTNULL(boss.has_status_effect(/datum/status_effect/cyberware_cascade_window), "The wind-up ended but the lattice's own surge didn't run") + TEST_ASSERT_NULL(boss.get_filter(move.tell_filter()), "The wind-up's outline stayed on") + // Cut short, nothing fires and the look goes + var/mob/living/carbon/human/npc/bounty_criminal/boss/second = make_criminal(make_record(3, "boss", null, "juggernaut", list("unit_test"))) + second.ai_controller?.set_ai_status(AI_STATUS_OFF) + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/second_ability = locate() in second.boss_abilities + var/datum/bounty_chrome_move/unit_test/second_move = second_ability.move + TEST_ASSERT(second_ability.Trigger(target = hunter), "The second chrome ability wouldn't start") + second.emp_act(EMP_HEAVY) + TEST_ASSERT_NULL(second.boss_busy, "An EMP didn't cut the Juggernaut's chrome wind-up short") + TEST_ASSERT_NULL(second.get_filter(second_move.tell_filter()), "The cut-short wind-up's outline stayed on") + sleep(1.3 SECONDS) + TEST_ASSERT_EQUAL(second_move.fired, 0, "A cut-short chrome wind-up fired anyway") + +// ===== WHO AN AREA MOVE MAY CATCH ===== + +/// An area move never starts with someone outside the fight where it lands: a bystander, its own companion; the one it is going for, someone it holds a grudge against, the dead and the site's creatures don't stop it +/datum/unit_test/voidcrew_bounty_chrome/bystanders + +/datum/unit_test/voidcrew_bounty_chrome/bystanders/Run() + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_criminal(make_record(2, "normal", "brawler")) + criminal.ai_controller?.set_ai_status(AI_STATUS_OFF) + var/turf/hunter_spot = spot(2, 0) + var/turf/bystander_spot = spot(2, 1) + var/mob/living/carbon/human/hunter = make_person(hunter_spot) + var/mob/living/carbon/human/bystander = make_person(bystander_spot) + TEST_ASSERT(!bounty_chrome_area_clear(criminal, list(hunter_spot)), "An area move starts on someone not in its fight") + criminal.body_add_grudge(hunter) + TEST_ASSERT(bounty_chrome_area_clear(criminal, list(hunter_spot)), "An area move won't start on someone who attacked it") + TEST_ASSERT(!bounty_chrome_area_clear(criminal, list(hunter_spot, bystander_spot)), "An area move starts with a bystander in it") + TEST_ASSERT(bounty_chrome_area_clear(criminal, list(bystander_spot), bystander), "An area move won't start on the one it is aimed at") + criminal.ai_controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, bystander) + TEST_ASSERT(bounty_chrome_area_clear(criminal, list(bystander_spot)), "An area move won't start on the one it is going for") + criminal.ai_controller.clear_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET) + // A crewmate of someone it holds a grudge against is in the fight too: an idle friend can't shield the crew + var/datum/team/voidcrew/crew = new + LAZYADD(hunter.mind.ship_teams, crew) + LAZYADD(bystander.mind.ship_teams, crew) + var/crewmate_clear = bounty_chrome_area_clear(criminal, list(bystander_spot)) + hunter.mind.ship_teams = null + bystander.mind.ship_teams = null + qdel(crew) + TEST_ASSERT(crewmate_clear, "An idle crewmate of the one who attacked it stops an area move") + // Its own companion is in the way, never a target + var/list/buddies = criminal.spawn_companions(1, TRUE) + TEST_ASSERT(length(buddies), "No companion spawned") + allocated += buddies + var/mob/living/carbon/human/npc/bounty_companion/buddy = buddies[1] + var/turf/buddy_spot = spot(4, 1) + buddy.forceMove(buddy_spot) + TEST_ASSERT(!bounty_chrome_area_clear(criminal, list(buddy_spot)), "An area move starts on its own companion") + TEST_ASSERT(!bounty_chrome_in_posse(buddy, criminal), "A companion counts its own criminal as fair game") + // The dead, and creatures with nobody behind them, don't stop it + bystander.death() + TEST_ASSERT(bounty_chrome_area_clear(criminal, list(bystander_spot)), "A dead bystander stops an area move") + var/turf/mouse_spot = spot(4, 0) + allocate(/mob/living/basic/mouse, mouse_spot) + TEST_ASSERT(bounty_chrome_area_clear(criminal, list(mouse_spot)), "A mouse stops an area move") + +// ===== NOTICED ===== + +/// A bounty NPC feels a chrome read through real optics and tells the reader off, once in a while; never while hiding or fighting, and never with nothing to read +/datum/unit_test/voidcrew_bounty_chrome/read_noticed + +/datum/unit_test/voidcrew_bounty_chrome/read_noticed/Run() + var/mob/living/carbon/human/reader = make_person(spot(3, 0)) + var/obj/item/organ/eyes/robotic/cyberware/deadeye/optics = new + TEST_ASSERT(optics.Insert(reader, special = TRUE, movement_flags = DELETE_IF_REPLACED), "The reader's optics didn't go in") + // Chrome abilities never join mob.actions (chrome_hud.dm): the read lives on the optics + var/datum/action/cooldown/cyberware/chrome_read/read = locate() in optics.actions + TEST_ASSERT_NOTNULL(read, "The reader's optics have no chrome read") + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_criminal(make_record(1, "normal", "brawler", null, list("gorilla"))) + criminal.ai_controller?.set_ai_status(AI_STATUS_OFF) + TEST_ASSERT(read.Trigger(target = criminal), "The chrome read didn't go off") + TEST_ASSERT(criminal.chrome_read_answer_at > world.time, "A calm criminal didn't feel the read") + TEST_ASSERT(!bounty_chrome_read_noticed(criminal, reader), "A criminal answered two reads in a row") + criminal.chrome_read_answer_at = 0 + criminal.hidden = TRUE + TEST_ASSERT(!bounty_chrome_read_noticed(criminal, reader), "A hiding criminal answered a read") + criminal.hidden = FALSE + criminal.ai_start_fight(reader) + TEST_ASSERT(!bounty_chrome_read_noticed(criminal, reader), "A fighting criminal stopped to answer a read") + var/mob/living/carbon/human/npc/bounty_criminal/clean = make_criminal(make_record(1, "normal", "brawler"), spot(1, 1)) + TEST_ASSERT(!bounty_chrome_read_noticed(clean, reader), "A criminal with no chrome answered a read") + +/// An NPC under fire says its dodge at most once every 1.5 s; a player always hears theirs +/datum/unit_test/voidcrew_bounty_chrome/dodge_line + +/datum/unit_test/voidcrew_bounty_chrome/dodge_line/Run() + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_criminal(make_record(1, "normal", "brawler")) + criminal.ai_controller?.set_ai_status(AI_STATUS_OFF) + var/datum/component/cyberware_dodge/arbiter = criminal.LoadComponent(/datum/component/cyberware_dodge) + var/obj/projectile/bullet/shot = allocate(/obj/projectile/bullet) + arbiter.perform_sidestep(criminal, shot) + TEST_ASSERT_EQUAL(arbiter.last_message_at, world.time, "An NPC's first dodge wasn't said") + var/said_at = world.time - 1 SECONDS + arbiter.last_message_at = said_at + arbiter.perform_sidestep(criminal, shot) + TEST_ASSERT_EQUAL(arbiter.last_message_at, said_at, "An NPC said a second dodge within 1.5 s") // CYBERWARE_DODGE_LINE_GAP + arbiter.last_message_at = world.time - 2 SECONDS + arbiter.perform_sidestep(criminal, shot) + TEST_ASSERT_EQUAL(arbiter.last_message_at, world.time, "An NPC never said its dodge again") + +// ===== A MALFUNCTION ===== + +/// An EMP that knocks chrome out shows it for the reboot, as a picture only; it ends when the NPC dies, and an NPC with no chrome shows nothing +/datum/unit_test/voidcrew_bounty_chrome/malfunction + +/datum/unit_test/voidcrew_bounty_chrome/malfunction/Run() + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_criminal(make_record(2, "normal", "brawler", null, list("gorilla"))) + criminal.ai_controller?.set_ai_status(AI_STATUS_OFF) + var/health_before = criminal.health + criminal.emp_act(EMP_HEAVY) + sleep(2) + var/datum/status_effect/bounty_chrome_malfunction/sparks = criminal.has_status_effect(/datum/status_effect/bounty_chrome_malfunction) + TEST_ASSERT_NOTNULL(sparks, "An EMP knocked chrome out with no malfunction to see") + TEST_ASSERT(sparks.duration > world.time + 5 SECONDS, "The malfunction is shorter than the chrome's reboot") + TEST_ASSERT_EQUAL(criminal.health, health_before, "The malfunction hurt them") +#ifdef BOUNTY_CHROME_RENDERS + fcopy(getFlatIcon(criminal, SOUTH), "data/bounty_chrome_renders/malfunction_south.png") +#endif + criminal.death() + TEST_ASSERT_NULL(criminal.has_status_effect(/datum/status_effect/bounty_chrome_malfunction), "A corpse kept malfunctioning") + var/mob/living/carbon/human/npc/bounty_criminal/clean = make_criminal(make_record(2, "normal", "brawler"), spot(1, 1)) + clean.emp_act(EMP_HEAVY) + sleep(2) + TEST_ASSERT_NULL(clean.has_status_effect(/datum/status_effect/bounty_chrome_malfunction), "An EMP on a criminal with no chrome showed a malfunction") + +// ===== FUGITIVES ===== + +/** + * A chromed fugitive passing as a patron looks and examines like its decoys, who carry the same chrome + * under the same clothes; when the act drops, the coat and gloves over its chrome come off and it shows. + * P6's helpers (voidcrew_bounty_outpost.dm) make the outpost. + */ +/datum/unit_test/voidcrew_bounty_outpost/chrome_fugitive + +/datum/unit_test/voidcrew_bounty_outpost/chrome_fugitive/Run() + outpost = make_outpost(/obj/structure/overmap/trader_outpost/outfitter) + outpost.lobby_alcove_turfs = list(run_loc_floor_top_right) + var/datum/bounty_record/record = generate_bounty_record(2, "normal", "trader_outpost", /datum/species/human) // BOUNTY_TIER_WANTED, BOUNTY_PLACEMENT_TRADER_OUTPOST + record.style = "brawler" // BOUNTY_STYLE_BRAWLER + record.chrome = list("gorilla") // BOUNTY_CHROME_GORILLA + var/datum/criminal_bounty/outpost_test/posting = allocate(/datum/criminal_bounty/outpost_test) + posting.record = record + posting.placement_kind = "trader_outpost" + posting.site_ref = WEAKREF(outpost) + posting.value = 1234 + var/mob/living/carbon/human/npc/bounty_criminal/fugitive = make_fugitive(/mob/living/carbon/human/npc/bounty_criminal/normal, null, record) + fugitive.posting_ref = WEAKREF(posting) + posting.criminal_ref = WEAKREF(fugitive) + GLOB.criminal_bounties += posting + fugitive.ai_controller?.set_ai_status(AI_STATUS_OFF) + TEST_ASSERT(locate(/obj/item/organ/cyberimp/cyberware/gorilla_arms) in fugitive.organs, "The fugitive's Gorilla Arms didn't go in") + TEST_ASSERT(posting.setup_outpost_blend(TRUE), "The posting could not be set up to blend in") + var/list/decoys = decoys_of(posting) + TEST_ASSERT(length(decoys), "No decoys to compare with") + var/mob/living/carbon/human/npc/bounty_criminal/decoy/decoy = decoys[1] + TEST_ASSERT(locate(/obj/item/organ/cyberimp/cyberware/gorilla_arms) in decoy.organs, "A decoy doesn't carry its fugitive's chrome") + TEST_ASSERT_NULL(locate(/obj/item/organ/eyes) in get_turf(decoy), "A decoy's own eyes lie on the floor") + // Under the same clothes + for(var/slot in list(ITEM_SLOT_ICLOTHING, ITEM_SLOT_OCLOTHING, ITEM_SLOT_GLOVES, ITEM_SLOT_FEET)) + var/obj/item/fugitive_wears = fugitive.get_item_by_slot(slot) + var/obj/item/decoy_wears = decoy.get_item_by_slot(slot) + TEST_ASSERT_EQUAL(fugitive_wears?.type, decoy_wears?.type, "Passing as a patron, the fugitive wears [fugitive_wears || "nothing"] where a decoy wears [decoy_wears || "nothing"]") + var/mob/living/carbon/human/viewer = make_hunter() + TEST_ASSERT_EQUAL(examine_without_features(decoy, viewer), examine_without_features(fugitive, viewer), "The chromed fugitive examines differently from a decoy") + // The act drops: the coat and gloves come off over the plating, the pockets stay + var/obj/item/pocketed = fugitive.l_store + var/obj/item/shirt = fugitive.w_uniform + posting.outpost_confront(fugitive, viewer) + TEST_ASSERT(!fugitive.blended, "The confronted fugitive is still blending in") + TEST_ASSERT_NULL(fugitive.wear_suit, "The exposed fugitive's coat still covers the plating") + TEST_ASSERT_NULL(fugitive.gloves, "The exposed fugitive's gloves still cover the plating") + TEST_ASSERT_EQUAL(fugitive.w_uniform, shirt, "The exposed fugitive changed its clothes: chrome shows over a jumpsuit") + if(pocketed) + TEST_ASSERT_EQUAL(fugitive.l_store, pocketed, "The exposed fugitive lost what was in its pocket") + TEST_ASSERT_NOTNULL(decoy.wear_suit, "A decoy took its coat off with the fugitive") + +/** + * `patron`'s examine as plain text without its own features: their lines, and the lines naming the + * glasses or scarf it wears for them, matched by the item's own name (an embedded "[item]" reads "the + * circle glasses", where examine says "some circle glasses"). + */ +/datum/unit_test/voidcrew_bounty_outpost/chrome_fugitive/proc/examine_without_features(mob/living/carbon/human/npc/bounty_criminal/patron, mob/viewer) + var/list/features = list() + for(var/line in patron.record?.feature_lines()) + features += trim(STRIP_HTML_FULL("[line]", MAX_MESSAGE_LEN)) + var/list/feature_items = list() + for(var/obj/item/worn in list(patron.glasses, patron.wear_neck)) + feature_items += worn.name + var/list/lines = list() + for(var/line in patron.examine(viewer)) + var/plain = trim(STRIP_HTML_FULL("[line]", MAX_MESSAGE_LEN)) + if(plain in features) + continue + var/names_feature_item = FALSE + for(var/item_name in feature_items) + if(findtext(plain, item_name)) + names_feature_item = TRUE + break + if(!names_feature_item) + lines += plain + return lines.Join(" | ") + +// ===== THE BOUNTY PANEL ===== + +/// The panel spawns a criminal with exactly the chrome asked for (any piece, none, all that fits) or rolls it as usual for the style or kit picked; a style the chrome can't fight with is changed, and what won't fit beside a kit's own chrome is left off with a word to the admin +/datum/unit_test/voidcrew_bounty_admin/chrome + +/datum/unit_test/voidcrew_bounty_admin/chrome/Run() + var/turf/spot = run_loc_floor_bottom_left + var/mob/living/carbon/human/operator = make_operator(run_loc_floor_top_right) + var/datum/bounty_admin_panel/unit_test/panel = allocate(__IMPLIED_TYPE__, operator) + var/list/choices = panel.chrome_choices() + TEST_ASSERT_EQUAL(length(choices), 10, "The chrome menu offers [length(choices)] choices, not rolled, none, the seven pieces and all of it") + TEST_ASSERT_EQUAL(choices["All of it"], "all", "The chrome menu has no all of it") // BOUNTY_ADMIN_CHROME_ALL + + // Deadeye on a brawler: a style it would never roll on, kept + var/mob/living/carbon/human/npc/bounty_criminal/deadeye = panel.admin_spawn_criminal(operator, 2, "normal", "brawler", null, spot, list("deadeye")) + allocated += deadeye + TEST_ASSERT(locate(/obj/item/organ/eyes/robotic/cyberware/deadeye) in deadeye.organs, "The chosen Deadeye isn't in them") + TEST_ASSERT(length(deadeye.record.chrome) == 1 && deadeye.record.chrome[1] == "deadeye", "The record doesn't carry the chosen chrome") + TEST_ASSERT_EQUAL(deadeye.record.style, "brawler", "Deadeye changed a brawler's style") + // Gorilla Arms on a pistol criminal: they fight with their fists instead + var/mob/living/carbon/human/npc/bounty_criminal/gorilla = panel.admin_spawn_criminal(operator, 2, "normal", "pistol", null, spot, list("gorilla")) + allocated += gorilla + TEST_ASSERT_EQUAL(gorilla.record.style, "brawler", "A pistol criminal given Gorilla Arms came out a [gorilla.record.style]") + TEST_ASSERT(locate(/obj/item/organ/cyberimp/cyberware/gorilla_arms/left) in gorilla.organs, "The chosen Gorilla Arms aren't in them") + // None + var/mob/living/carbon/human/npc/bounty_criminal/clean = panel.admin_spawn_criminal(operator, 3, "normal", null, null, spot, list()) + allocated += clean + TEST_ASSERT_NULL(clean.record.chrome, "Asking for no chrome still gave them some") + TEST_ASSERT_NULL(clean.GetComponent(/datum/component/bounty_chrome), "Asking for no chrome still gave them a chrome AI") + // All of it: the cyberpsycho (C6, chrome/bounty_cyberpsycho.dm), whose body carries it all, nothing browned out + var/mob/living/carbon/human/npc/bounty_criminal/all = panel.admin_spawn_criminal(operator, 3, "normal", "brawler", null, spot, "all") + allocated += all + TEST_ASSERT(istype(all, /mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho), "All of it spawned [all?.type], not the cyberpsycho") + TEST_ASSERT_EQUAL(all?.record?.kit, "cyberpsycho", "All of it isn't on the record as the cyberpsycho's kit") // BOUNTY_KIT_CYBERPSYCHO + TEST_ASSERT(get_chrome_load(all) > 20, "All of it carries only [get_chrome_load(all)] load") // CYBERWARE_BASE_CAPACITY + TEST_ASSERT(get_chrome_load(all) <= get_chrome_capacity(all), "All of it browned them out") + // Redline on a Ghost: its own Cascade has the slot, so it's left off and the admin hears why + var/mob/living/carbon/human/npc/bounty_criminal/ghost = panel.admin_spawn_criminal(operator, 3, "boss", "ghost", null, spot, list("redline")) + allocated += ghost + TEST_ASSERT_NULL(ghost.record.chrome, "A Ghost took a Redline core beside its Cascade lattice") + TEST_ASSERT_NULL(locate(/obj/item/organ/cyberimp/cyberware/redline) in ghost.organs, "A Ghost has a Redline core in it") + TEST_ASSERT(panel.said("didn't fit"), "The admin wasn't told the Redline didn't fit") + // Rolled as usual: for the style asked for + for(var/i in 1 to 40) + var/datum/bounty_record/pistol = generate_bounty_record(3, "normal", "planet") + pistol.style = "pistol" + panel.admin_set_chrome(pistol, "roll") // BOUNTY_ADMIN_CHROME_ROLL + for(var/key in pistol.chrome) + var/datum/bounty_chrome_piece/piece = GLOB.bounty_chrome_pieces[key] + TEST_ASSERT(piece?.can_roll(3, "normal", "pistol", null, list()), "A pistol criminal rolled as usual got [key]") + // Through the menu + panel.answers = list("Spawn a criminal with chosen chrome", "Normal", "Wanted", "Brawler", "Gorilla Arms", "None") + panel.run_menu(operator) + TEST_ASSERT_EQUAL(length(panel.missed), 0, "The chrome spawn menu did not offer: [jointext(panel.missed, "; ")]") + var/mob/living/carbon/human/npc/bounty_criminal/from_menu + for(var/mob/living/carbon/human/npc/bounty_criminal/found in get_turf(operator)) + from_menu = found + TEST_ASSERT_NOTNULL(from_menu, "The chrome spawn menu put nobody at the admin's feet") + allocated += from_menu + TEST_ASSERT(locate(/obj/item/organ/cyberimp/cyberware/gorilla_arms) in from_menu.organs, "The chrome spawn menu's criminal has no Gorilla Arms") diff --git a/voidcrew/modules/unit_tests/voidcrew_bounty_chrome_cascade.dm b/voidcrew/modules/unit_tests/voidcrew_bounty_chrome_cascade.dm new file mode 100644 index 00000000000..6bf48a69880 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_bounty_chrome_cascade.dm @@ -0,0 +1,289 @@ +/** + * Bounty hunting: the Cascade lattice on a criminal (C1), for + * voidcrew/modules/bounties/chrome/bounty_chrome_cascade.dm. + * + * Fork defines are included after the tests, so a test uses the literal value with a comment naming the + * define. Criminals are real human NPCs with the player's lattice in them; the tests read tg's state. + * Their AI is off, and each test drives the chrome by hand. + * + * Renders: compile with -DBOUNTY_CHROME_RENDERS and the renders test writes flat icons to + * data/bounty_chrome_renders/ (the carrier, and the lattice's afterimage at a few hues). + */ +/datum/unit_test/voidcrew_bounty_chrome_cascade + abstract_type = /datum/unit_test/voidcrew_bounty_chrome_cascade + +/// A record of `tier`, `archetype` and `style` or `kit`, carrying `chrome`, for a human +/datum/unit_test/voidcrew_bounty_chrome_cascade/proc/make_record(tier = 2, archetype = "normal", style = "brawler", kit, list/chrome) + var/datum/bounty_record/record = generate_bounty_record(tier, archetype, "planet", /datum/species/human) // BOUNTY_PLACEMENT_PLANET + record.tier = tier + record.archetype = archetype + record.style = archetype == "boss" ? null : style // BOUNTY_ARCHETYPE_BOSS + record.kit = kit + record.chrome = chrome + return record + +/// The criminal for `record` at `where`, its AI off, deleted with the test +/datum/unit_test/voidcrew_bounty_chrome_cascade/proc/make_criminal(datum/bounty_record/record, turf/where) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = spawn_bounty_criminal(record, where || run_loc_floor_bottom_left, null) + if(criminal) + allocated += criminal + criminal.ai_controller?.set_ai_status(AI_STATUS_OFF) + return criminal + +/// A person with a mind at `where`, deleted with the test +/datum/unit_test/voidcrew_bounty_chrome_cascade/proc/make_person(turf/where) + var/mob/living/carbon/human/person = allocate(/mob/living/carbon/human/consistent, where || run_loc_floor_top_right) + person.mind_initialize() + return person + +/// A turf `dx`, `dy` from the bottom left of the test room (a 5x5 floor) +/datum/unit_test/voidcrew_bounty_chrome_cascade/proc/spot(dx, dy) + return locate(run_loc_floor_bottom_left.x + dx, run_loc_floor_bottom_left.y + dy, run_loc_floor_bottom_left.z) + +/// Whether the lattice's window is open on `body` +/datum/unit_test/voidcrew_bounty_chrome_cascade/proc/surging(mob/living/body) + return !isnull(body.has_status_effect(/datum/status_effect/cyberware_cascade_window)) + +/// The lattice's own surge button in `body` +/datum/unit_test/voidcrew_bounty_chrome_cascade/proc/surge_action(mob/living/carbon/human/npc/body) + return bounty_chrome_action(body, /datum/action/cooldown/cyberware/cascade_surge) + +// ===== THE SURGE ===== + +/// The lattice's own surge fires after its tell (a glow and a whine, standing still, at least 0.8 s), early in a fight, and the body and its AI then run at the lattice's pace +/datum/unit_test/voidcrew_bounty_chrome_cascade/surge + +/datum/unit_test/voidcrew_bounty_chrome_cascade/surge/Run() + var/mob/living/carbon/human/hunter = make_person(spot(3, 0)) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_criminal(make_record(2, "normal", "brawler", null, list("cascade"))) // BOUNTY_TIER_WANTED, BOUNTY_CHROME_CASCADE + TEST_ASSERT_NOTNULL(locate(/obj/item/organ/cyberimp/cyberware/cascade) in criminal.organs, "The criminal has no lattice in it") + var/datum/component/bounty_chrome/chrome = criminal.GetComponent(/datum/component/bounty_chrome) + TEST_ASSERT_NOTNULL(chrome, "A criminal with a lattice has no chrome AI") + var/datum/bounty_chrome_move/cascade/move = chrome.move_of(/datum/bounty_chrome_move/cascade) + TEST_ASSERT_NOTNULL(move, "The lattice has no move") + TEST_ASSERT(move.tell_time >= 0.8 SECONDS, "The surge's tell is [move.tell_time / 10] s") // BOUNTY_CHROME_TELL_MIN + TEST_ASSERT(move.boss_usable, "A mini-boss can't use the lattice") + + TEST_ASSERT(criminal.ai_start_fight(hunter), "The criminal wouldn't fight") + chrome.update_fight() + TEST_ASSERT(chrome.next_move_at - world.time <= 1.5 SECONDS, "The first surge waits [(chrome.next_move_at - world.time) / 10] s into the fight") // BOUNTY_CHROME_OPENING + TEST_ASSERT_NULL(chrome.plan(criminal.ai_controller, 1), "It surged the moment the fight started") + chrome.next_move_at = 0 + TEST_ASSERT(move.can_start(hunter), "It won't surge with a hunter close and in sight") + var/slowdown_before = criminal.cached_multiplicative_slowdown + TEST_ASSERT_EQUAL(chrome.plan(criminal.ai_controller, 1), SUBTREE_RETURN_FINISH_PLANNING, "A ready surge didn't start") + TEST_ASSERT_EQUAL(chrome.telling, move, "The surge's tell isn't running") + TEST_ASSERT_NOTNULL(criminal.get_filter(move.tell_filter()), "The tell doesn't glow") + TEST_ASSERT(HAS_TRAIT_FROM(criminal, TRAIT_IMMOBILIZED, "bounty_chrome"), "It doesn't stand still through the tell") // BOUNTY_CHROME_TRAIT + sleep(0.6 SECONDS) + TEST_ASSERT(!surging(criminal), "The lattice surged before the tell was over") + sleep(0.4 SECONDS) + TEST_ASSERT(surging(criminal), "The tell ended but the lattice's own surge didn't run") + var/datum/action/cooldown/cyberware/cascade_surge/surge_button = surge_action(criminal) + TEST_ASSERT(surge_button.next_use_time > world.time + 50 SECONDS, "The surge didn't start the lattice's own minute of cooldown") + TEST_ASSERT(!HAS_TRAIT_FROM(criminal, TRAIT_IMMOBILIZED, "bounty_chrome"), "It still stands still in the window") + TEST_ASSERT_NULL(criminal.get_filter(move.tell_filter()), "The tell's glow stayed on") + // The lattice's speed is on the body, and the AI moves the body at its own pace + TEST_ASSERT(abs(criminal.cached_multiplicative_slowdown - (slowdown_before - 1)) < 0.01, "The window's pace is [criminal.cached_multiplicative_slowdown], not the lattice's [slowdown_before - 1]") + TEST_ASSERT(abs(criminal.ai_controller.movement_delay - criminal.cached_multiplicative_slowdown) < 0.01, "Its AI moves it every [criminal.ai_controller.movement_delay], not at its body's pace [criminal.cached_multiplicative_slowdown]") + TEST_ASSERT(!move.can_start(hunter), "It would surge again with the lattice cycling") + chrome.next_move_at = 0 + TEST_ASSERT_NULL(chrome.plan(criminal.ai_controller, 1), "It started a second surge in the window") + +/// An EMP, a stun or crit during the tell stops it: no surge and no cooldown spent; a stunned or downed criminal starts none +/datum/unit_test/voidcrew_bounty_chrome_cascade/interrupted + +/datum/unit_test/voidcrew_bounty_chrome_cascade/interrupted/Run() + var/mob/living/carbon/human/hunter = make_person(spot(3, 0)) + for(var/way in list("emp", "stunned", "downed")) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_criminal(make_record(2, "normal", "brawler", null, list("cascade"))) + var/datum/component/bounty_chrome/chrome = criminal.GetComponent(/datum/component/bounty_chrome) + var/datum/bounty_chrome_move/cascade/move = chrome.move_of(/datum/bounty_chrome_move/cascade) + TEST_ASSERT(criminal.ai_start_fight(hunter), "[way]: the criminal wouldn't fight") + chrome.update_fight() + TEST_ASSERT(chrome.start_move(move, hunter), "[way]: the tell didn't start") + switch(way) + if("emp") + criminal.emp_act(EMP_HEAVY) + if("stunned") + criminal.Paralyze(3 SECONDS) + if("downed") + // Into soft crit, short of hard crit and death + criminal.setOxyLoss(criminal.health + 20) + TEST_ASSERT_NULL(chrome.telling, "[way]: the tell kept running") + sleep(1.1 SECONDS) + TEST_ASSERT(!surging(criminal), "[way]: the lattice surged anyway") + var/datum/action/cooldown/cyberware/cascade_surge/surge_button = surge_action(criminal) + TEST_ASSERT(surge_button.next_use_time <= world.time, "[way]: the lattice's cooldown was spent on a surge that never came") + chrome.next_move_at = 0 + if(way == "emp") + TEST_ASSERT(!move.ready(), "The lattice is ready through its EMP reboot") + else + TEST_ASSERT(!move.can_start(hunter), "[way]: it would start a surge") + TEST_ASSERT_NULL(chrome.plan(criminal.ai_controller, 1), "[way]: it planned a surge") + qdel(criminal) + +// ===== IN THE WINDOW ===== + +/** + * A gunman in the window strafes across its line to its target, a step at a time, paced by its body: + * never twice inside the gap or its move delay, never held still, never off its leash, and a companion + * never off its criminal's. A fighter with no gun ready closes in through its AI instead, and the + * strafing ends with the window. + */ +/datum/unit_test/voidcrew_bounty_chrome_cascade/strafe + +/datum/unit_test/voidcrew_bounty_chrome_cascade/strafe/Run() + var/mob/living/carbon/human/hunter = make_person(spot(4, 2)) + var/mob/living/carbon/human/npc/bounty_criminal/gunman = make_criminal(make_record(2, "normal", "pistol", null, list("cascade")), spot(0, 2)) // BOUNTY_STYLE_PISTOL + var/datum/component/bounty_chrome/chrome = gunman.GetComponent(/datum/component/bounty_chrome) + var/datum/bounty_chrome_move/cascade/move = chrome.move_of(/datum/bounty_chrome_move/cascade) + TEST_ASSERT(gunman.ai_start_fight(hunter), "The gunman wouldn't fight") + chrome.update_fight() + var/datum/bounty_style/style = GLOB.bounty_styles["pistol"] + var/obj/item/gun/gun = style.carried_ranged(gunman) + TEST_ASSERT_NOTNULL(gun, "The gunman carries no pistol") + TEST_ASSERT(human_npc_take_in_hand(gunman, gun), "The gunman couldn't draw its pistol") + TEST_ASSERT_NOTNULL(style.ready_in_hand(gunman), "The pistol in its hand won't fire") + + TEST_ASSERT(!move.strafe(), "It strafed with no lattice running") + TEST_ASSERT(move.fire(hunter), "The lattice didn't surge") + TEST_ASSERT(surging(gunman), "The surge opened no window") + TEST_ASSERT_NOTNULL(move.strafe_timer, "Nothing strafes in the window") + move.next_strafe_at = 0 + move.last_step_at = 0 + var/turf/strafed_from = get_turf(gunman) + TEST_ASSERT(move.strafe(), "A gunman in the window didn't strafe") + TEST_ASSERT(get_turf(gunman) != strafed_from, "It strafed without moving") + TEST_ASSERT_EQUAL(gunman.x, strafed_from.x, "Its strafe went toward or away from its target") + TEST_ASSERT_EQUAL(get_dist(gunman, hunter), get_dist(strafed_from, hunter), "Its strafe changed its distance") + TEST_ASSERT_NOTNULL(locate(/obj/effect/temp_visual/decoy/fading/cascade) in strafed_from, "Its strafe left no afterimage") + TEST_ASSERT_EQUAL(move.last_step_at, world.time, "Its step wasn't noted") + + // Paced by its body: never again inside the gap, and never sooner than its move delay + TEST_ASSERT(!move.strafe(), "It strafed twice at once") + move.next_strafe_at = 0 + TEST_ASSERT(gunman.cached_multiplicative_slowdown > 0, "The gunman's body moves with no delay at all") + TEST_ASSERT(!move.strafe(), "It stepped again sooner than its body's move delay") + move.last_step_at = 0 + + // Held still, it doesn't + ADD_TRAIT(gunman, TRAIT_IMMOBILIZED, TRAIT_GENERIC) + TEST_ASSERT(!move.strafe(), "Held still, it strafed") + REMOVE_TRAIT(gunman, TRAIT_IMMOBILIZED, TRAIT_GENERIC) + + // Off its leash it doesn't: its site is the one row it stands on + var/turf/corner = spot(0, 0) + gunman.site_bounds = list(corner.x, gunman.y, corner.x + 4, gunman.y, corner.z) + var/turf/leashed_at = get_turf(gunman) + TEST_ASSERT(!move.strafe(), "It strafed off its leash") + TEST_ASSERT_EQUAL(get_turf(gunman), leashed_at, "It moved off its leash") + gunman.site_bounds = null + + // With no gun ready it closes in through its AI instead + bounty_ai_apply_style(gunman, "brawler") // BOUNTY_STYLE_BRAWLER + TEST_ASSERT(!move.strafe(), "A brawler strafed instead of closing in") + bounty_ai_apply_style(gunman, "pistol") + TEST_ASSERT(move.strafe(), "Its gun back in play, it didn't strafe") + + // A companion's steps stay on its criminal's leash + var/list/buddies = gunman.spawn_companions(1, TRUE) + TEST_ASSERT(length(buddies), "No companion spawned") + allocated += buddies + var/mob/living/carbon/human/npc/bounty_companion/buddy = buddies[1] + buddy.ai_controller?.set_ai_status(AI_STATUS_OFF) + buddy.forceMove(spot(1, 2)) + TEST_ASSERT("cascade" in bounty_chrome_install_now(buddy, list("cascade")), "The companion's lattice didn't go in") + var/datum/component/bounty_chrome/buddy_chrome = buddy.GetComponent(/datum/component/bounty_chrome) + var/datum/bounty_chrome_move/cascade/buddy_move = buddy_chrome?.move_of(/datum/bounty_chrome_move/cascade) + TEST_ASSERT_NOTNULL(buddy_move, "The companion's lattice has no move") + buddy.ai_join_fight(hunter) + buddy.ai_controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, hunter) + bounty_ai_apply_style(buddy, "pistol") + var/obj/item/gun/buddy_gun = new /obj/item/gun/ballistic/automatic/pistol/aps(get_turf(buddy)) + TEST_ASSERT(buddy.put_in_hands(buddy_gun), "The companion couldn't hold a pistol") + TEST_ASSERT(buddy_move.fire(hunter), "The companion's lattice didn't surge") + buddy_move.next_strafe_at = 0 + buddy_move.last_step_at = 0 + gunman.site_bounds = list(corner.x, buddy.y, corner.x + 4, buddy.y, corner.z) + var/turf/buddy_was = get_turf(buddy) + TEST_ASSERT(!buddy_move.strafe(), "A companion strafed off its criminal's leash") + TEST_ASSERT_EQUAL(get_turf(buddy), buddy_was, "A companion moved off its criminal's leash") + gunman.site_bounds = null + TEST_ASSERT(buddy_move.strafe(), "A companion on its criminal's ground didn't strafe") + + // The window ends, and the strafing with it + gunman.remove_status_effect(/datum/status_effect/cyberware_cascade_window) + move.strafe_pulse() + TEST_ASSERT_NULL(move.strafe_timer, "It kept strafing after the window") + TEST_ASSERT(gunman.has_status_effect(/datum/status_effect/cyberware_cascade_crash), "The window ended with no crash") + +// ===== MINI-BOSSES ===== + +/** + * One lattice, one driver: a Ghost's kit lattice is fired by its dash, so a rolled Cascade never goes + * in beside it, and a Cascade move handed to a Ghost never drives it. A Juggernaut with a rolled + * lattice surges through its ability rotation. + */ +/datum/unit_test/voidcrew_bounty_chrome_cascade/bosses + +/datum/unit_test/voidcrew_bounty_chrome_cascade/bosses/Run() + var/mob/living/carbon/human/hunter = make_person(spot(3, 0)) + var/mob/living/carbon/human/npc/bounty_criminal/boss/ghost = make_criminal(make_record(3, "boss", null, "ghost", list("cascade"))) // BOUNTY_TIER_MOST_WANTED, BOUNTY_KIT_GHOST + TEST_ASSERT(istype(ghost, /mob/living/carbon/human/npc/bounty_criminal/boss/ghost), "No Ghost spawned") + TEST_ASSERT_NULL(ghost.record.chrome, "A Ghost's record kept a second lattice") + var/lattices = 0 + for(var/obj/item/organ/cyberimp/cyberware/cascade/lattice in ghost.organs) + lattices++ + TEST_ASSERT_EQUAL(lattices, 1, "The Ghost carries [lattices] lattices") + var/datum/component/bounty_chrome/ghost_chrome = ghost.GetComponent(/datum/component/bounty_chrome) + TEST_ASSERT(!ghost_chrome?.move_of(/datum/bounty_chrome_move/cascade), "The Ghost's kit lattice got a chrome move") + ghost_chrome = bounty_chrome_equip(ghost, list("cascade")) + var/datum/bounty_chrome_move/cascade/ghost_move = ghost_chrome?.move_of(/datum/bounty_chrome_move/cascade) + TEST_ASSERT_NOTNULL(ghost_move, "A Cascade move handed to the Ghost wasn't made") + TEST_ASSERT(ghost_move.ready(), "The Ghost's lattice isn't ready") + TEST_ASSERT(!ghost_move.can_start(hunter), "A Cascade move would fire the lattice the Ghost's dash fires") + TEST_ASSERT(!ghost_move.boss_ability?.worth_using(hunter), "The Ghost's rotation would fire its kit lattice a second way") + + var/mob/living/carbon/human/npc/bounty_criminal/boss/juggernaut = make_criminal(make_record(3, "boss", null, "juggernaut", list("cascade")), spot(1, 1)) // BOUNTY_KIT_JUGGERNAUT + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/ability + for(var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/wrapped in juggernaut.boss_abilities) + if(istype(wrapped.move, /datum/bounty_chrome_move/cascade)) + ability = wrapped + TEST_ASSERT_NOTNULL(ability, "The Juggernaut's lattice isn't in its ability rotation") + TEST_ASSERT(ability.windup >= 0.8 SECONDS, "The Juggernaut's surge winds up for [ability.windup / 10] s") // BOUNTY_CHROME_TELL_MIN + TEST_ASSERT(ability.worth_using(hunter), "The Juggernaut won't surge at a hunter in sight") + TEST_ASSERT(ability.Trigger(target = hunter), "The Juggernaut's surge wouldn't start") + TEST_ASSERT(!surging(juggernaut), "The Juggernaut surged before its wind-up") + sleep(1.2 SECONDS) + TEST_ASSERT(surging(juggernaut), "The Juggernaut's wind-up ended with no surge") + +// ===== RENDERS ===== + +/** + * Not a check: with -DBOUNTY_CHROME_RENDERS, writes a Cascade carrier (a brawler and a gunman) and the + * lattice's afterimage at three hues to data/bounty_chrome_renders/, for a person to look at. + */ +/datum/unit_test/voidcrew_bounty_chrome_cascade/renders + +/datum/unit_test/voidcrew_bounty_chrome_cascade/renders/Run() + var/mob/living/carbon/human/npc/bounty_criminal/brawler = make_criminal(make_record(2, "normal", "brawler", null, list("cascade")), spot(1, 1)) + var/mob/living/carbon/human/npc/bounty_criminal/gunman = make_criminal(make_record(2, "normal", "pistol", null, list("cascade")), spot(3, 1)) + TEST_ASSERT_NOTNULL(locate(/obj/item/organ/cyberimp/cyberware/cascade) in brawler.organs, "The brawler has no lattice") + TEST_ASSERT_NOTNULL(locate(/obj/item/organ/cyberimp/cyberware/cascade) in gunman.organs, "The gunman has no lattice") +#ifdef BOUNTY_CHROME_RENDERS + var/datum/bounty_style/style = GLOB.bounty_styles["pistol"] + var/obj/item/gun/gun = style.carried_ranged(gunman) + if(gun) + human_npc_take_in_hand(gunman, gun) + for(var/facing in list(SOUTH, EAST)) + fcopy(getFlatIcon(brawler, facing), "data/bounty_chrome_renders/cascade_brawler_[dir2text(facing)].png") + fcopy(getFlatIcon(gunman, facing), "data/bounty_chrome_renders/cascade_gunman_[dir2text(facing)].png") + // The afterimage a step leaves, tinted as the lattice's trail is (a flat icon drops an atom's colour, so the tint goes on by hand) + var/obj/effect/temp_visual/decoy/fading/cascade/afterimage = new(spot(2, 3), gunman, 0) + for(var/hue in list(0, 120, 280)) + var/icon/trail = getFlatIcon(gunman, EAST) + trail.MapColors(arglist(afterimage.cascade_tint_matrix(hue))) + fcopy(trail, "data/bounty_chrome_renders/cascade_afterimage_[hue].png") + qdel(afterimage) +#endif diff --git a/voidcrew/modules/unit_tests/voidcrew_bounty_chrome_deadeye.dm b/voidcrew/modules/unit_tests/voidcrew_bounty_chrome_deadeye.dm new file mode 100644 index 00000000000..8c15708ab1f --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_bounty_chrome_deadeye.dm @@ -0,0 +1,153 @@ +/** + * Deadeye link on a bounty gunman (voidcrew/modules/bounties/chrome/bounty_chrome_deadeye.dm): the AI's + * opening lock and its tell, then the implant's own tag (ware_pro_combat.dm) homing its real rounds, and + * letting go when the mark breaks line of sight. Real human NPCs, real implants and a real pistol. + */ + +/// The test's record of the last round the gunman fired: the projectile, read after the optics have had their say +/datum/unit_test/voidcrew_bounty_chrome/var/obj/projectile/last_round + +/datum/unit_test/voidcrew_bounty_chrome/proc/note_round(mob/living/source, obj/projectile/shot, datum/fired_from, atom/clicked) + SIGNAL_HANDLER + last_round = shot + +/// A Petty pistol criminal with Deadeye optics, its AI off, fighting `hunter`. Returns the criminal. +/datum/unit_test/voidcrew_bounty_chrome/proc/deadeye_gunman(mob/living/hunter, style = "pistol") // BOUNTY_STYLE_PISTOL + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_criminal(make_record(1, "normal", style, null, list("deadeye"))) // BOUNTY_TIER_PETTY, BOUNTY_CHROME_DEADEYE + criminal.ai_controller?.set_ai_status(AI_STATUS_OFF) + criminal.ai_start_fight(hunter) + return criminal + +/// Its opening lock comes half a second into the fight: a one second tell (red eyes, a red line, and it keeps acting), then the implant's tag on the hunter, and its next real rounds home in +/datum/unit_test/voidcrew_bounty_chrome/deadeye_lock + +/datum/unit_test/voidcrew_bounty_chrome/deadeye_lock/Run() + var/mob/living/carbon/human/hunter = make_person(spot(4, 0)) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = deadeye_gunman(hunter) + var/obj/item/organ/eyes/robotic/cyberware/deadeye/optics = criminal.get_organ_slot(ORGAN_SLOT_EYES) + TEST_ASSERT(istype(optics), "The gunman has no Deadeye optics") + var/datum/component/bounty_chrome/chrome_ai = criminal.GetComponent(/datum/component/bounty_chrome) + var/datum/bounty_chrome_move/deadeye/move = chrome_ai?.move_of(/datum/bounty_chrome_move/deadeye) + TEST_ASSERT_NOTNULL(move, "A Deadeye carrier has no Deadeye move") + var/eyes_before = criminal.get_left_eye_color() + chrome_ai.update_fight() + TEST_ASSERT_NULL(chrome_ai.telling, "The lock started the moment the fight did") + sleep(0.7 SECONDS) // BOUNTY_DEADEYE_OPENING 0.5 seconds + TEST_ASSERT_EQUAL(chrome_ai.telling, move, "The opening lock didn't start half a second into the fight") + TEST_ASSERT_EQUAL(criminal.get_left_eye_color(), "#ff3300", "Its eyes didn't go red for the lock") + TEST_ASSERT(length(move.marks), "The lock has no red line on the mark") + TEST_ASSERT(!HAS_TRAIT_FROM(criminal, TRAIT_IMMOBILIZED, "bounty_chrome"), "The gunman stands still through its lock") // BOUNTY_CHROME_TRAIT + TEST_ASSERT_NULL(chrome_ai.plan(criminal.ai_controller, 1), "The lock's tell stopped the gunman's other planning") + TEST_ASSERT_NULL(optics.tagged_ref?.resolve(), "The tag landed before the tell was over") + sleep(0.4 SECONDS) + TEST_ASSERT_NULL(optics.tagged_ref?.resolve(), "The tag landed before the tell's 0.8 seconds were up") // BOUNTY_CHROME_TELL_MIN + sleep(0.8 SECONDS) + TEST_ASSERT_EQUAL(optics.tagged_ref?.resolve(), hunter, "The tell ended but the implant's tag isn't on the hunter") + TEST_ASSERT_NOTNULL(hunter.get_filter("deadeye_mark"), "The hunter carries no reticle") + TEST_ASSERT_EQUAL(criminal.get_left_eye_color(), "#ff3300", "Its eyes went back while the tag holds") + TEST_ASSERT(!move.ready(), "The tag isn't cooling down") + TEST_ASSERT_NULL(move.marks, "The red line outlived the tell") + + // A real round from a real pistol homes in + var/obj/item/gun/ballistic/automatic/pistol/gun = allocate(/obj/item/gun/ballistic/automatic/pistol) + TEST_ASSERT(criminal.put_in_hands(gun), "The gunman couldn't hold the test pistol") + RegisterSignal(criminal, COMSIG_PROJECTILE_FIRER_BEFORE_FIRE, PROC_REF(note_round)) + gun.process_fire(hunter, criminal) + UnregisterSignal(criminal, COMSIG_PROJECTILE_FIRER_BEFORE_FIRE) + TEST_ASSERT_NOTNULL(last_round, "The pistol fired no round") + TEST_ASSERT_EQUAL(last_round.homing_target, hunter, "The round didn't home in on the tagged hunter") + TEST_ASSERT_EQUAL(optics.shots_left, 2, "The tag didn't count the homing round") + last_round = null + + // The tag spent, it stops watching and its eyes go back + optics.end_tag(criminal) + sleep(0.6 SECONDS) + TEST_ASSERT_NULL(move.mark_ref, "It kept watching a spent tag") + TEST_ASSERT_EQUAL(criminal.get_left_eye_color(), eyes_before, "Its eyes stayed red after the tag") + +/// Breaking line of sight lets the tag go, and one broken during the tell never lands; a melee style, a downed mark or a mark out of sight never gets one +/datum/unit_test/voidcrew_bounty_chrome/deadeye_sight + /// The floor turned into a wall between them, and what it was, put back whatever happens + var/turf/between + var/floor_type + +/datum/unit_test/voidcrew_bounty_chrome/deadeye_sight/Destroy() + if(between && floor_type && between.type != floor_type) + between.ChangeTurf(floor_type) + restore_atmos() + between = null + return ..() + +/datum/unit_test/voidcrew_bounty_chrome/deadeye_sight/Run() + var/mob/living/carbon/human/hunter = make_person(spot(4, 0)) + between = spot(2, 0) + floor_type = between.type + var/mob/living/carbon/human/npc/bounty_criminal/criminal = deadeye_gunman(hunter) + var/obj/item/organ/eyes/robotic/cyberware/deadeye/optics = criminal.get_organ_slot(ORGAN_SLOT_EYES) + var/datum/component/bounty_chrome/chrome_ai = criminal.GetComponent(/datum/component/bounty_chrome) + var/datum/bounty_chrome_move/deadeye/move = chrome_ai.move_of(/datum/bounty_chrome_move/deadeye) + chrome_ai.update_fight() + TEST_ASSERT(chrome_ai.start_move(move, hunter), "The lock didn't start") + sleep(1.2 SECONDS) + TEST_ASSERT_EQUAL(optics.tagged_ref?.resolve(), hunter, "The tag didn't land") + // A wall between them + between.ChangeTurf(/turf/closed/wall/r_wall) + sleep(0.7 SECONDS) // BOUNTY_DEADEYE_WATCH 0.5 seconds + TEST_ASSERT_NULL(optics.tagged_ref?.resolve(), "The tag held with a wall between them") + TEST_ASSERT_NULL(hunter.get_filter("deadeye_mark"), "The reticle stayed on the hunter behind the wall") + TEST_ASSERT_NOTEQUAL(criminal.get_left_eye_color(), "#ff3300", "Its eyes stayed red after it let go") + between.ChangeTurf(floor_type) + restore_atmos() + qdel(criminal) + + // Line of sight broken during the tell: the implant refuses the tag + criminal = deadeye_gunman(hunter) + optics = criminal.get_organ_slot(ORGAN_SLOT_EYES) + chrome_ai = criminal.GetComponent(/datum/component/bounty_chrome) + move = chrome_ai.move_of(/datum/bounty_chrome_move/deadeye) + chrome_ai.update_fight() + TEST_ASSERT(chrome_ai.start_move(move, hunter), "The second lock didn't start") + between.ChangeTurf(/turf/closed/wall/r_wall) + sleep(1.2 SECONDS) + TEST_ASSERT_NULL(optics.tagged_ref?.resolve(), "The tag landed through a wall") + TEST_ASSERT_NOTEQUAL(criminal.get_left_eye_color(), "#ff3300", "Its eyes stayed red after the lock failed") + TEST_ASSERT(move.ready(), "A tag that never landed went on cooldown") + between.ChangeTurf(floor_type) + restore_atmos() + + // A downed mark is never tagged + hunter.adjustOxyLoss(hunter.health + 10) + hunter.updatehealth() + TEST_ASSERT(!move.can_start(hunter), "It would lock onto a hunter in crit") + qdel(criminal) + + // A brawler given the optics (an admin's pick) has nothing to home + var/mob/living/carbon/human/brawled = make_person(spot(4, 1)) + var/mob/living/carbon/human/npc/bounty_criminal/brawler = deadeye_gunman(brawled, "brawler") // BOUNTY_STYLE_BRAWLER + var/datum/component/bounty_chrome/brawler_ai = brawler.GetComponent(/datum/component/bounty_chrome) + var/datum/bounty_chrome_move/deadeye/brawler_move = brawler_ai.move_of(/datum/bounty_chrome_move/deadeye) + TEST_ASSERT(!brawler_move.can_start(brawled), "A brawler locks on with Deadeye") + brawler_ai.update_fight() + sleep(0.7 SECONDS) + TEST_ASSERT_NULL(brawler_ai.telling, "A brawler's opening lock started") + +/// Down or dead, it lets go of its tag and its eyes go back +/datum/unit_test/voidcrew_bounty_chrome/deadeye_downed + +/datum/unit_test/voidcrew_bounty_chrome/deadeye_downed/Run() + var/mob/living/carbon/human/hunter = make_person(spot(4, 0)) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = deadeye_gunman(hunter) + var/obj/item/organ/eyes/robotic/cyberware/deadeye/optics = criminal.get_organ_slot(ORGAN_SLOT_EYES) + var/datum/component/bounty_chrome/chrome_ai = criminal.GetComponent(/datum/component/bounty_chrome) + var/datum/bounty_chrome_move/deadeye/move = chrome_ai.move_of(/datum/bounty_chrome_move/deadeye) + chrome_ai.update_fight() + TEST_ASSERT(chrome_ai.start_move(move, hunter), "The lock didn't start") + sleep(1.2 SECONDS) + TEST_ASSERT_EQUAL(optics.tagged_ref?.resolve(), hunter, "The tag didn't land") + beat_down(criminal) + TEST_ASSERT(criminal.is_downed(), "The gunman didn't go down") + TEST_ASSERT_NULL(optics.tagged_ref?.resolve(), "A downed gunman kept its tag") + TEST_ASSERT_NULL(hunter.get_filter("deadeye_mark"), "The reticle stayed on the hunter when the gunman went down") + TEST_ASSERT_NOTEQUAL(criminal.get_left_eye_color(), "#ff3300", "A downed gunman's eyes stayed red") + criminal.death() + TEST_ASSERT_NULL(move.mark_ref, "A dead gunman kept watching a tag") diff --git a/voidcrew/modules/unit_tests/voidcrew_bounty_chrome_gorilla.dm b/voidcrew/modules/unit_tests/voidcrew_bounty_chrome_gorilla.dm new file mode 100644 index 00000000000..517363ed717 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_bounty_chrome_gorilla.dm @@ -0,0 +1,399 @@ +/** + * Bounty chrome: Gorilla Arms (C2), for voidcrew/modules/bounties/chrome/bounty_chrome_gorilla.dm. + * + * Criminals carry the real lattices; the tests read tg's own state (the arms' cooldowns, tg's pull and + * grab state, damage, throws, doors). The AI is switched off and the chrome driven through its own procs; + * the grab's own clock is left to run where the test is about its timing. Fork defines are included after + * the tests, so literals stand in for them with a comment naming the define. The test room is a 5x5 floor. + */ + +/// A Petty brawler with Gorilla Arms at `where`, its AI off +/datum/unit_test/voidcrew_bounty_chrome/proc/make_gorilla(turf/where) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_criminal(make_record(1, "normal", "brawler", null, list("gorilla")), where) // BOUNTY_CHROME_GORILLA + criminal?.ai_controller?.set_ai_status(AI_STATUS_OFF) + return criminal + +/// Sets `arm`'s punch to be loaded again in `left` (0: loaded now) +/datum/unit_test/voidcrew_bounty_chrome/proc/arm_reload(obj/item/organ/cyberimp/cyberware/gorilla_arms/arm, left) + arm.slam_cooldown = left ? world.time + left : 0 + +/// Whether `hunter` is held fast by `criminal`: tg's aggressive grab +/datum/unit_test/voidcrew_bounty_chrome/proc/held_by(mob/living/hunter, mob/living/criminal) + return hunter.pulledby == criminal && criminal.grab_state >= GRAB_AGGRESSIVE + +/// Plain fists only for its ordinary blows: with both fists loaded it throws nothing; with one used, every blow is that fist's, and the loaded one stays loaded +/datum/unit_test/voidcrew_bounty_chrome/gorilla_fists + +/datum/unit_test/voidcrew_bounty_chrome/gorilla_fists/Run() + var/mob/living/carbon/human/hunter = make_person(spot(2, 2)) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_gorilla(spot(1, 2)) + var/list/arms = bounty_gorilla_arms(criminal) + TEST_ASSERT_EQUAL(length(arms), 2, "The criminal carries [length(arms)] Gorilla lattices, not the pair") + var/datum/status_effect/organ_set_bonus/cyberware_gorilla/bonus = criminal.has_status_effect(/datum/status_effect/organ_set_bonus/cyberware_gorilla) + TEST_ASSERT(bonus?.bonus_active, "The pair's set bonus (prying doors) isn't working") + var/datum/component/bounty_chrome/chrome = chrome_fight(criminal, hunter) + var/datum/ai_controller/controller = criminal.ai_controller + var/datum/ai_behavior/basic_melee_attack/human_npc/bounty/gorilla/brawl = GET_AI_BEHAVIOR(/datum/ai_behavior/basic_melee_attack/human_npc/bounty/gorilla) + + // Planning in its fight queues its own blows, not the bounty melee's + var/datum/bounty_chrome_move/gorilla_punch/punch = chrome.move_of(/datum/bounty_chrome_move/gorilla_punch) + TEST_ASSERT_NOTNULL(punch, "The piston punch's move wasn't made") + TEST_ASSERT(punch.plan(controller, hunter), "The gorilla planned nothing in its fight") + TEST_ASSERT(controller.current_behaviors[brawl], "The gorilla's plain-fist blows weren't queued") + TEST_ASSERT_NULL(chrome.telling, "A piston punch started inside its opener") + + // Both fists loaded: nothing thrown + for(var/i in 1 to 3) + criminal.next_move = 0 + criminal.next_click = 0 + controller.set_blackboard_key(BB_BASIC_MOB_MELEE_COOLDOWN_TIMER, world.time - 1) + brawl.perform(1, controller, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETING_STRATEGY, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION) + TEST_ASSERT_EQUAL(hunter.getBruteLoss(), 0, "The gorilla threw a blow with both fists loaded") + for(var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm as anything in arms) + TEST_ASSERT(bounty_gorilla_loaded(arm), "An ordinary blow spent the [arm]'s punch") + + // One fist used: its blows are that fist's plain punches + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/used = arms[1] + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/loaded = arms[2] + arm_reload(used, 30 SECONDS) + for(var/i in 1 to 5) + criminal.next_move = 0 + criminal.next_click = 0 + controller.set_blackboard_key(BB_BASIC_MOB_MELEE_COOLDOWN_TIMER, world.time - 1) + var/before = hunter.getBruteLoss() + brawl.perform(1, controller, BB_BASIC_MOB_CURRENT_TARGET, BB_TARGETING_STRATEGY, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION) + TEST_ASSERT_EQUAL(bounty_gorilla_arm_of_hand(criminal, criminal.active_hand_index), used, "A blow was thrown with the loaded fist") + // A plain punch is 5 to 10 (a human arm's unarmed damage); the implant's is 20 + TEST_ASSERT(hunter.getBruteLoss() - before <= 10, "An ordinary blow did [hunter.getBruteLoss() - before] brute: it was the implant's punch") + hunter.forceMove(spot(2, 2)) + hunter.SetKnockdown(0) + hunter.get_up(instant = TRUE) + TEST_ASSERT(bounty_gorilla_loaded(loaded), "An ordinary blow spent the loaded fist's punch") + +/// The piston punch: an orange outline and the lit tile for its tell, then a loaded fist's punch, the implant's (its brute, its knock-back, that arm's cooldown); stepping off the lit tile, it hits air; never toward a drop +/datum/unit_test/voidcrew_bounty_chrome/gorilla_punch + /// Turfs it changed, put back when it ends + var/list/turf/changed_turfs = list() + +/datum/unit_test/voidcrew_bounty_chrome/gorilla_punch/Destroy() + for(var/turf/changed as anything in changed_turfs) + changed.ChangeTurf(/turf/open/floor/iron) + changed_turfs = null + return ..() + +/datum/unit_test/voidcrew_bounty_chrome/gorilla_punch/Run() + var/mob/living/carbon/human/hunter = make_person(spot(2, 2)) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_gorilla(spot(1, 2)) + var/list/arms = bounty_gorilla_arms(criminal) + var/datum/component/bounty_chrome/chrome = chrome_fight(criminal, hunter) + var/datum/bounty_chrome_move/gorilla_punch/punch = chrome.move_of(/datum/bounty_chrome_move/gorilla_punch) + TEST_ASSERT(punch.opens_at > world.time, "The first piston punch may come the moment the fight starts") + TEST_ASSERT(punch.opens_at <= world.time + 1.5 SECONDS, "The first piston punch waits more than 1.5 s") // BOUNTY_GORILLA_PUNCH_OPENING + TEST_ASSERT(punch.can_start(hunter), "The piston punch won't start at a hunter beside it") + + TEST_ASSERT(chrome.start_move(punch, hunter), "The piston punch's tell didn't start") + TEST_ASSERT(HAS_TRAIT_FROM(criminal, TRAIT_IMMOBILIZED, "bounty_chrome"), "The gorilla doesn't stand still through the tell") // BOUNTY_CHROME_TRAIT + TEST_ASSERT_NOTNULL(criminal.get_filter(punch.tell_filter()), "The tell has no outline") + var/obj/effect/temp_visual/bounty_boss_mark/mark = locate() in spot(2, 2) + TEST_ASSERT_NOTNULL(mark, "The tile it aims at isn't lit") + sleep(0.4 SECONDS) + TEST_ASSERT_EQUAL(hunter.getBruteLoss(), 0, "The punch landed before the tell was over") + // The tell, then the fist's own travel (hyperviolence_gorilla/gorilla_thrust.dm) + sleep(0.8 SECONDS) + TEST_ASSERT(hunter.getBruteLoss() >= 15, "The piston punch did [hunter.getBruteLoss()] brute, not the implant's 20") // CYBERWARE_GORILLA_PUNCH_DAMAGE + var/spent = 0 + for(var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm as anything in arms) + if(!bounty_gorilla_loaded(arm)) + spent++ + TEST_ASSERT_EQUAL(spent, 1, "[spent] arms went on cooldown, not the one that punched") + sleep(0.5 SECONDS) + TEST_ASSERT(get_dist(criminal, hunter) >= 2, "The punch didn't knock the hunter back") + + // Off the lit tile: it hits air, and spends nothing + for(var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm as anything in arms) + arm_reload(arm, 0) + hunter.forceMove(spot(2, 2)) + hunter.SetKnockdown(0) + hunter.get_up(instant = TRUE) + hunter.fully_heal() + chrome.next_move_at = 0 + criminal.next_move = 0 + criminal.next_click = 0 + TEST_ASSERT(chrome.start_move(punch, hunter), "The second piston punch's tell didn't start") + hunter.forceMove(spot(2, 3)) + sleep(1 SECONDS) + TEST_ASSERT_EQUAL(hunter.getBruteLoss(), 0, "The punch followed the hunter off the lit tile") + for(var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm as anything in arms) + TEST_ASSERT(bounty_gorilla_loaded(arm), "A punch at air spent the [arm]'s punch") + + // Never toward a drop: the tile behind the hunter is space + hunter.forceMove(spot(2, 2)) + var/turf/behind = spot(3, 2) + changed_turfs += behind + behind.ChangeTurf(/turf/open/space) + TEST_ASSERT(!punch.can_start(hunter), "A piston punch would knock the hunter out into space") + +/// The grab: a fist just used and one loaded; its hand on the hunter (tg's pull) and a ring for the tell; then tg's aggressive grab, two face punches with the used fist, and the loaded fist's punch, the implant's hurl; the guard after +/datum/unit_test/voidcrew_bounty_chrome/gorilla_grab + +/datum/unit_test/voidcrew_bounty_chrome/gorilla_grab/Run() + var/mob/living/carbon/human/hunter = make_person(spot(2, 2)) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_gorilla(spot(1, 2)) + var/list/arms = bounty_gorilla_arms(criminal) + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/used = arms[1] + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/loaded = arms[2] + var/datum/component/bounty_chrome/chrome = chrome_fight(criminal, hunter) + var/datum/bounty_chrome_move/gorilla_grab/grab = chrome.move_of(/datum/bounty_chrome_move/gorilla_grab) + TEST_ASSERT_NOTNULL(grab, "The grab's move wasn't made") + TEST_ASSERT(grab.grab_ready_at > world.time + 2 SECONDS, "The first grab may come inside the fight's first moments") // BOUNTY_GORILLA_GRAB_OPENING + TEST_ASSERT(!grab.can_start(hunter), "A grab could start inside its opener") + grab.grab_ready_at = 0 + TEST_ASSERT(!grab.can_start(hunter), "A grab could start with both fists loaded, so its face punches would be the implant's") + arm_reload(used, 3.9 SECONDS) + TEST_ASSERT(grab.can_start(hunter), "No grab with one fist just used and the other loaded") + + // The tell: its hand on them, a ring under them, nothing harmful yet + chrome.next_move_at = 0 + TEST_ASSERT(chrome.start_move(grab, hunter), "The grab's tell didn't start") + TEST_ASSERT_EQUAL(criminal.pulling, hunter, "The gorilla's hand isn't on the hunter through the tell") + TEST_ASSERT_EQUAL(criminal.grab_state, GRAB_PASSIVE, "The grip tightened before the tell was over") + var/obj/effect/temp_visual/bounty_boss_mark/ring = locate() in spot(2, 2) + TEST_ASSERT_EQUAL(ring?.icon_state, "target_circle", "No ring under the hunter it reaches for") + TEST_ASSERT_NOTNULL(criminal.get_filter(grab.tell_filter()), "The tell has no outline") + + // The grip tightens: tg's aggressive grab + sleep(1 SECONDS) + TEST_ASSERT(held_by(hunter, criminal), "The grip didn't tighten into an aggressive grab") + TEST_ASSERT(HAS_TRAIT_FROM(hunter, TRAIT_IMMOBILIZED, CHOKEHOLD_TRAIT), "The grabbed hunter can walk off, as in no aggressive grab of tg's") + TEST_ASSERT(HAS_TRAIT_FROM(hunter, TRAIT_HANDS_BLOCKED, CHOKEHOLD_TRAIT), "The grabbed hunter's hands are free, as in no aggressive grab of tg's") + TEST_ASSERT(HAS_TRAIT_FROM(criminal, TRAIT_IMMOBILIZED, "bounty_chrome_gorilla"), "Holding on, the gorilla can walk off") // BOUNTY_GORILLA_TRAIT + TEST_ASSERT(grab.plan(criminal.ai_controller, hunter), "Holding on, the gorilla would plan something else") + + // Two punches to the face, a click apart, still held + sleep(1 SECONDS) + TEST_ASSERT(held_by(hunter, criminal), "Let go after the first face punch") + sleep(0.8 SECONDS) + TEST_ASSERT(held_by(hunter, criminal), "Let go after the second face punch") + TEST_ASSERT_EQUAL(grab.punches, 2, "[grab.punches] face punches before the finisher") + TEST_ASSERT(bounty_gorilla_loaded(loaded), "A face punch spent the loaded fist") + var/before_finisher = hunter.getBruteLoss() + + // The finisher: the loaded fist's punch on someone held fast is the implant's hurl + sleep(0.8 SECONDS) + TEST_ASSERT(!held_by(hunter, criminal), "The finisher didn't let go") + TEST_ASSERT_NULL(criminal.pulling, "The finisher left the gorilla pulling the hunter") + TEST_ASSERT(!bounty_gorilla_loaded(loaded), "The finisher wasn't the loaded fist's punch") + TEST_ASSERT(hunter.getBruteLoss() >= before_finisher + 15, "The finisher did [hunter.getBruteLoss() - before_finisher] brute, not the implant's 20") // CYBERWARE_GORILLA_PUNCH_DAMAGE + TEST_ASSERT(!HAS_TRAIT_FROM(criminal, TRAIT_IMMOBILIZED, "bounty_chrome_gorilla"), "Still rooted after the finisher") + TEST_ASSERT_NULL(grab.held_ref, "The grab still holds someone after the finisher") + sleep(1 SECONDS) + TEST_ASSERT(get_dist(criminal, hunter) >= 3, "The finisher didn't hurl the hunter across the room") + + // The guard: not grabbed again straight away + hunter.forceMove(spot(2, 2)) + hunter.SetKnockdown(0) + hunter.SetParalyzed(0) + hunter.get_up(instant = TRUE) + arm_reload(used, 3.9 SECONDS) + arm_reload(loaded, 0) + grab.grab_ready_at = 0 + criminal.next_move = 0 + criminal.next_click = 0 + // The hurl's own wait, shared with the slam, is over too: only the guard is left + TIMER_COOLDOWN_END(criminal, "gorilla_grab_move") // COOLDOWN_GORILLA_GRAB_MOVE + TEST_ASSERT(!grab.can_start(hunter), "The hunter was grabbed again the moment they were let go") + grab.guard = null + TEST_ASSERT(grab.can_start(hunter), "With the guard gone, no second grab") + +/// Ways out, tg's: a step or Resist during the tell; Resist, a friend's pull, a stun or an EMP while held fast; anyone who goes down is let go and never grabbed from the floor; someone tg's grab can't hold, or held by another, isn't grabbed +/datum/unit_test/voidcrew_bounty_chrome/gorilla_grab_ways_out + +/datum/unit_test/voidcrew_bounty_chrome/gorilla_grab_ways_out/Run() + var/mob/living/carbon/human/hunter = make_person(spot(2, 2)) + var/mob/living/carbon/human/friend = make_person(spot(2, 3)) + var/list/ways = list("step", "resist_reach", "resist", "friend", "stunned", "emp", "knocked_down") + for(var/way in ways) + hunter.forceMove(spot(2, 2)) + hunter.fully_heal() + hunter.SetKnockdown(0) + hunter.SetParalyzed(0) + hunter.get_up(instant = TRUE) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_gorilla(spot(1, 2)) + var/list/arms = bounty_gorilla_arms(criminal) + arm_reload(arms[1], 3.9 SECONDS) + var/datum/component/bounty_chrome/chrome = chrome_fight(criminal, hunter) + var/datum/bounty_chrome_move/gorilla_grab/grab = chrome.move_of(/datum/bounty_chrome_move/gorilla_grab) + grab.grab_ready_at = 0 + chrome.next_move_at = 0 + TEST_ASSERT(grab.can_start(hunter), "[way]: no grab could start") + TEST_ASSERT(chrome.start_move(grab, hunter), "[way]: the grab's tell didn't start") + switch(way) + if("step") + hunter.forceMove(spot(3, 2)) + if("resist_reach") + hunter.next_move = 0 + hunter.execute_resist() + if(way == "step" || way == "resist_reach") + TEST_ASSERT_NULL(hunter.pulledby, "[way]: the hunter is still in the gorilla's hand") + sleep(1 SECONDS) + TEST_ASSERT(!held_by(hunter, criminal), "[way]: the hunter was grabbed anyway") + TEST_ASSERT_NULL(grab.held_ref, "[way]: the gorilla holds someone it never got") + sleep(2.4 SECONDS) + TEST_ASSERT_EQUAL(hunter.getBruteLoss(), 0, "[way]: the hunter was punched anyway") + qdel(criminal) + continue + sleep(1 SECONDS) + TEST_ASSERT(held_by(hunter, criminal), "[way]: the grip didn't tighten") + switch(way) + if("resist") + // tg's own resist at tg's odds: a few tries; a failed one costs stamina, put back between tries + for(var/attempt in 1 to 20) + if(!held_by(hunter, criminal)) + break + hunter.next_move = 0 + hunter.last_special = 0 + hunter.setStaminaLoss(0) + hunter.execute_resist() + if("friend") + TEST_ASSERT(friend.start_pulling(hunter), "The friend couldn't take hold of the held hunter") + if("stunned") + criminal.Paralyze(2 SECONDS) + if("emp") + criminal.emp_act(EMP_HEAVY) + if("knocked_down") + hunter.Knockdown(2 SECONDS) + TEST_ASSERT(!grab.may_grab(hunter), "Someone on the floor could be grabbed") + if(way == "knocked_down") + // Its next click finds them on the floor and lets go + sleep(1 SECONDS) + TEST_ASSERT(!held_by(hunter, criminal), "[way]: the gorilla kept hold") + TEST_ASSERT(criminal.pulling != hunter, "[way]: the gorilla still pulls the hunter") + TEST_ASSERT_NULL(grab.held_ref, "[way]: the grab still holds the hunter") + TEST_ASSERT(!HAS_TRAIT_FROM(criminal, TRAIT_IMMOBILIZED, "bounty_chrome_gorilla"), "[way]: the gorilla is still rooted") // BOUNTY_GORILLA_TRAIT + var/hurt = hunter.getBruteLoss() + sleep(2.4 SECONDS) + TEST_ASSERT_EQUAL(hunter.getBruteLoss(), hurt, "[way]: a punch landed after the hold ended") + if(way == "friend") + friend.stop_pulling() + friend.forceMove(spot(2, 3)) + qdel(criminal) + + // Never: someone tg's grab can't tighten on, or someone another holds fast + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_gorilla(spot(1, 2)) + arm_reload(bounty_gorilla_arms(criminal)[1], 3.9 SECONDS) + var/datum/component/bounty_chrome/chrome = chrome_fight(criminal, hunter) + var/datum/bounty_chrome_move/gorilla_grab/grab = chrome.move_of(/datum/bounty_chrome_move/gorilla_grab) + grab.grab_ready_at = 0 + hunter.forceMove(spot(2, 2)) + hunter.SetKnockdown(0) + hunter.get_up(instant = TRUE) + TEST_ASSERT(grab.can_start(hunter), "No grab could start for the last checks") + ADD_TRAIT(hunter, TRAIT_PUSHIMMUNE, "unit_test") + TEST_ASSERT(!grab.can_start(hunter), "A grab would start on someone tg's grab can't tighten on") + REMOVE_TRAIT(hunter, TRAIT_PUSHIMMUNE, "unit_test") + friend.forceMove(spot(2, 3)) + friend.start_pulling(hunter) + hunter.grabbedby(friend) + TEST_ASSERT(held_by(hunter, friend), "The friend didn't hold the hunter fast for the check") + TEST_ASSERT(!grab.can_start(hunter), "A grab would start on someone another holds fast") + +/// Doors: forced when the hunter is behind one, with the set bonus's own pry; never a bolted one, one onto space, or one on a ship +/datum/unit_test/voidcrew_bounty_chrome/gorilla_doors + /// Turfs it changed, put back when it ends + var/list/turf/changed_turfs = list() + /// Turf -> the area it had before it was made part of a ship + var/list/original_areas = list() + /// Areas it made + var/list/test_areas = list() + +/datum/unit_test/voidcrew_bounty_chrome/gorilla_doors/Destroy() + for(var/turf/changed as anything in changed_turfs) + changed.ChangeTurf(/turf/open/floor/iron) + changed_turfs = null + for(var/turf/moved as anything in original_areas) + moved.change_area(get_area(moved), original_areas[moved]) + original_areas = null + QDEL_LIST(test_areas) + return ..() + +/// A shut airlock at `where`, unpowered, so a pry opens it at once +/datum/unit_test/voidcrew_bounty_chrome/gorilla_doors/proc/make_door(turf/where) + var/obj/machinery/door/airlock/door = allocate(/obj/machinery/door/airlock, where) + door.set_machine_stat(door.machine_stat | NOPOWER) + return door + +/datum/unit_test/voidcrew_bounty_chrome/gorilla_doors/Run() + var/mob/living/carbon/human/hunter = make_person(spot(3, 2)) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_gorilla(spot(1, 2)) + var/datum/component/bounty_chrome/chrome = chrome_fight(criminal, hunter) + var/datum/bounty_chrome_move/gorilla_doors/doors = chrome.move_of(/datum/bounty_chrome_move/gorilla_doors) + TEST_ASSERT_NOTNULL(doors, "The door move wasn't made") + + // Bolted: left alone + var/obj/machinery/door/airlock/door = make_door(spot(2, 2)) + door.bolt() + TEST_ASSERT(!doors.try_door(), "The gorilla went for a bolted door") + door.unbolt() + + // Space behind it: left shut + var/turf/outside = spot(2, 3) + changed_turfs += outside + outside.ChangeTurf(/turf/open/space) + TEST_ASSERT(!doors.try_door(), "The gorilla went for a door with space behind it") + outside = spot(2, 3) + outside.ChangeTurf(/turf/open/floor/iron) + + // On a ship: left shut + var/area/shuttle/ship_area = new() + test_areas += ship_area + original_areas[spot(2, 2)] = get_area(spot(2, 2)) + var/turf/door_turf = spot(2, 2) + door_turf.change_area(get_area(door_turf), ship_area) + TEST_ASSERT(!doors.try_door(), "The gorilla went for a door on a ship") + door_turf.change_area(ship_area, original_areas[door_turf]) + original_areas -= door_turf + + // The hunter behind a plain shut door: a hand on it, and the set bonus forces it + TEST_ASSERT(doors.try_door(), "The gorilla didn't go for the door the hunter is behind") + sleep(2 SECONDS) + TEST_ASSERT(!door.density, "The set bonus didn't force the door open") + TEST_ASSERT_EQUAL(get_turf(criminal), spot(1, 2), "The gorilla walked through instead of forcing the door") + +/// A Juggernaut with the arms gets the grab in its own rotation: not while its shield fills a hand, then held busy while it holds on, and free again after +/datum/unit_test/voidcrew_bounty_chrome/gorilla_juggernaut + +/datum/unit_test/voidcrew_bounty_chrome/gorilla_juggernaut/Run() + var/mob/living/carbon/human/hunter = make_person(spot(2, 2)) + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = make_criminal(make_record(3, "boss", null, "juggernaut", list("gorilla")), spot(1, 2)) // BOUNTY_KIT_JUGGERNAUT + boss.ai_controller?.set_ai_status(AI_STATUS_OFF) + var/list/arms = bounty_gorilla_arms(boss) + TEST_ASSERT_EQUAL(length(arms), 2, "The Juggernaut's Gorilla Arms didn't go in") + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/ability + for(var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/wrapped in boss.boss_abilities) + if(istype(wrapped.move, /datum/bounty_chrome_move/gorilla_grab)) + ability = wrapped + TEST_ASSERT_NOTNULL(ability, "The Juggernaut's grab isn't in its ability rotation") + TEST_ASSERT(ability.windup >= 0.8 SECONDS, "The grab winds up for [ability.windup / 10] s") // BOUNTY_CHROME_TELL_MIN + arm_reload(arms[1], 3.9 SECONDS) + // Its tower shield fills its off hand (C8): one fist free, and the grab takes two + var/obj/item/shield/riot/phalanx_buckler/shield = locate() in boss.held_items + TEST_ASSERT_NOTNULL(shield, "The Juggernaut isn't holding its shield") + TEST_ASSERT_EQUAL(length(boss.get_empty_held_indexes()), 1, "With its shield in hand, the Juggernaut doesn't have one fist free") + TEST_ASSERT(!bounty_gorilla_fists_for_grab(boss), "With its shield in hand, the Juggernaut has two fists for the grab") + TEST_ASSERT(!ability.worth_using(hunter), "The Juggernaut wanted the grab with its shield in hand") + // Its shield broken (the gear lock keeps it from being dropped), both fists are free and the grab comes back + qdel(shield) + TEST_ASSERT(bounty_gorilla_fists_for_grab(boss), "Its shield gone, the Juggernaut doesn't have two fists for the grab") + TEST_ASSERT(ability.worth_using(hunter), "The grab isn't worth using on a hunter beside it") + TEST_ASSERT(ability.Trigger(target = hunter), "The grab ability wouldn't start") + TEST_ASSERT_EQUAL(boss.pulling, hunter, "The Juggernaut's hand isn't on the hunter through its wind-up") + sleep(1 SECONDS) + TEST_ASSERT(held_by(hunter, boss), "The Juggernaut's grip didn't tighten") + TEST_ASSERT_EQUAL(boss.boss_busy, "gorilla_hold", "Holding on, the Juggernaut isn't busy") // BOUNTY_GORILLA_BOSS_BUSY + // The finisher or the hold's own clock (BOUNTY_GORILLA_HOLD_MAX, 4 s from the grip) lets go, whichever comes first + var/waited = 0 + while((held_by(hunter, boss) || boss.boss_busy) && waited < 5 SECONDS) + sleep(0.2 SECONDS) + waited += 0.2 SECONDS + TEST_ASSERT(!held_by(hunter, boss), "The Juggernaut never let go") + TEST_ASSERT_NULL(boss.boss_busy, "The Juggernaut is still busy after the hold") diff --git a/voidcrew/modules/unit_tests/voidcrew_bounty_chrome_lazarus.dm b/voidcrew/modules/unit_tests/voidcrew_bounty_chrome_lazarus.dm new file mode 100644 index 00000000000..bf6f3bbea94 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_bounty_chrome_lazarus.dm @@ -0,0 +1,103 @@ +/** + * Lazarus on a bounty NPC: nothing to drive. The player node (ware_military_body.dm) fires itself when its + * bearer goes into crit, with its charge glow (cyberware_anim2.dm) through the windup. These run + * the node's real timers on a real human NPC, and on a plain human as a player would be. + */ + +/// Puts `body` down in crit with brute, as a beating would: on the floor, short of death +/datum/unit_test/voidcrew_bounty_chrome/proc/beat_down(mob/living/carbon/body) + for(var/i in 1 to 30) + if(body.stat != CONSCIOUS) + break + body.adjustBruteLoss(10) + body.updatehealth() + +/// The node stands a criminal beaten into crit back up after its real one second charge, its charge glowing on it meanwhile; cuffs put on mid-charge stay on, so it stands up cuffed; and it does it once in six minutes +/datum/unit_test/voidcrew_bounty_chrome/lazarus_jolt + +/datum/unit_test/voidcrew_bounty_chrome/lazarus_jolt/Run() + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_criminal(make_record(2, "normal", "brawler", null, list("lazarus"))) // BOUNTY_TIER_WANTED, BOUNTY_CHROME_LAZARUS + criminal.ai_controller?.set_ai_status(AI_STATUS_OFF) + var/obj/item/organ/cyberimp/cyberware/lazarus/node = locate() in criminal.organs + TEST_ASSERT_NOTNULL(node, "The criminal has no Lazarus node in it") + + beat_down(criminal) + TEST_ASSERT(criminal.is_downed(), "The beating didn't put the criminal in crit (health [criminal.health])") + TEST_ASSERT(node.jolting, "Going into crit didn't start the node's charge") + TEST_ASSERT_NOTNULL(criminal.get_filter("cyberware_lazarus_charge"), "No charge glow while the node charges") + TEST_ASSERT_EQUAL(criminal.capture_state(), "downed", "A criminal down and charging isn't downed for the pad") // BOUNTY_STATE_DOWNED + + // Cuffs go on mid-charge + sleep(0.4 SECONDS) + var/obj/item/restraints/handcuffs/cuffs = new(criminal) + criminal.set_handcuffed(cuffs) + criminal.update_handcuffed() + TEST_ASSERT(criminal.is_restrained(), "The cuffs didn't go on") + TEST_ASSERT_NOTNULL(criminal.get_filter("cyberware_lazarus_charge"), "The charge glow stopped when the cuffs went on") + sleep(0.9 SECONDS) + TEST_ASSERT(!node.jolting, "The charge never fired") + TEST_ASSERT_EQUAL(criminal.stat, CONSCIOUS, "The node didn't stand the criminal up (health [criminal.health])") + // The node heals "to 30%" of the damage it counts, but a body's health counts limb damage at three quarters (updatehealth()), so it lands a little under + TEST_ASSERT(criminal.health >= criminal.maxHealth * 0.15, "The node stood it up at only [criminal.health] health") + TEST_ASSERT_EQUAL(criminal.handcuffed, cuffs, "The jolt took the cuffs off") + TEST_ASSERT_EQUAL(criminal.capture_state(), "restrained", "A jolted criminal in cuffs isn't restrained for the pad") // BOUNTY_STATE_RESTRAINED + TEST_ASSERT_NULL(criminal.get_filter("cyberware_lazarus_charge"), "The charge glow outlived the jolt") + TEST_ASSERT(!COOLDOWN_FINISHED(node, jolt_cooldown), "The jolt didn't spend the node") + // Out of crit it gets up as anyone does, in tg's get_up() second, cuffs and all + TEST_ASSERT(!HAS_TRAIT(criminal, TRAIT_FLOORED), "The jolted criminal is still floored") + sleep(1.5 SECONDS) + TEST_ASSERT_EQUAL(criminal.body_position, STANDING_UP, "The jolted criminal never got up off the floor") + + // Once: down again within six minutes, it stays down + beat_down(criminal) + TEST_ASSERT(criminal.is_downed(), "The second beating didn't put the criminal in crit") + TEST_ASSERT(!node.jolting, "The node charged twice in six minutes") + TEST_ASSERT_NULL(criminal.get_filter("cyberware_lazarus_charge"), "The spent node showed its charge glow again") + sleep(1.2 SECONDS) + TEST_ASSERT(criminal.is_downed(), "The criminal got up a second time inside six minutes") + +/// Killed outright, the node does nothing; killed mid-charge, the charge glow goes at once and it stays dead +/datum/unit_test/voidcrew_bounty_chrome/lazarus_dead + +/datum/unit_test/voidcrew_bounty_chrome/lazarus_dead/Run() + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_criminal(make_record(2, "normal", "brawler", null, list("lazarus"))) + criminal.ai_controller?.set_ai_status(AI_STATUS_OFF) + criminal.death() + TEST_ASSERT_NULL(criminal.get_filter("cyberware_lazarus_charge"), "A criminal killed outright showed the node's charge glow") + sleep(1.2 SECONDS) + TEST_ASSERT_EQUAL(criminal.stat, DEAD, "The node brought a dead criminal back") + + var/mob/living/carbon/human/npc/bounty_criminal/second = make_criminal(make_record(2, "normal", "brawler", null, list("lazarus")), spot(1, 1)) + second.ai_controller?.set_ai_status(AI_STATUS_OFF) + beat_down(second) + TEST_ASSERT_NOTNULL(second.get_filter("cyberware_lazarus_charge"), "The second criminal's node didn't charge") + second.death() + TEST_ASSERT_NULL(second.get_filter("cyberware_lazarus_charge"), "The charge glow kept crawling over a corpse") + sleep(1.2 SECONDS) + TEST_ASSERT_EQUAL(second.stat, DEAD, "The node brought back someone killed mid-charge") + +/// The charge glow is the player node's own: a plain human (a player) shows it and is stood up the same way; an EMP mid-charge cuts the charge and its charge glow +/datum/unit_test/voidcrew_bounty_chrome/lazarus_player + +/datum/unit_test/voidcrew_bounty_chrome/lazarus_player/Run() + var/mob/living/carbon/human/patient = allocate(/mob/living/carbon/human/consistent, spot(1, 1)) + var/obj/item/organ/cyberimp/cyberware/lazarus/node = allocate(/obj/item/organ/cyberimp/cyberware/lazarus) + TEST_ASSERT(node.Insert(patient, special = TRUE), "The node didn't go in") + beat_down(patient) + TEST_ASSERT(patient.stat == SOFT_CRIT || patient.stat == HARD_CRIT, "The beating didn't put the patient in crit") + TEST_ASSERT_NOTNULL(patient.get_filter("cyberware_lazarus_charge"), "A player's node charges with no charge glow") + sleep(1.3 SECONDS) + TEST_ASSERT_EQUAL(patient.stat, CONSCIOUS, "The node didn't stand the patient up") + TEST_ASSERT_NULL(patient.get_filter("cyberware_lazarus_charge"), "The charge glow outlived the player's jolt") + + var/mob/living/carbon/human/second = allocate(/mob/living/carbon/human/consistent, spot(3, 1)) + var/obj/item/organ/cyberimp/cyberware/lazarus/second_node = allocate(/obj/item/organ/cyberimp/cyberware/lazarus) + TEST_ASSERT(second_node.Insert(second, special = TRUE), "The second node didn't go in") + beat_down(second) + TEST_ASSERT_NOTNULL(second.get_filter("cyberware_lazarus_charge"), "The second node charges with no charge glow") + second.emp_act(EMP_HEAVY) + TEST_ASSERT(!second_node.jolting, "An EMP didn't cut the node's charge") + sleep(0.7 SECONDS) + TEST_ASSERT_NULL(second.get_filter("cyberware_lazarus_charge"), "The charge glow kept going after an EMP cut the charge") + sleep(1 SECONDS) + TEST_ASSERT(second.stat != CONSCIOUS && second.stat != DEAD, "A node cut by an EMP still stood the patient up") diff --git a/voidcrew/modules/unit_tests/voidcrew_bounty_chrome_mantis.dm b/voidcrew/modules/unit_tests/voidcrew_bounty_chrome_mantis.dm new file mode 100644 index 00000000000..d280371e732 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_bounty_chrome_mantis.dm @@ -0,0 +1,365 @@ +/** + * Bounty chrome: Mantis Blades (C2), for voidcrew/modules/bounties/chrome/bounty_chrome_mantis.dm. + * + * Criminals carry the real housings; the tests read tg's own state (held items, wounds, knockdown, the + * lunge action's cooldown). The AI is switched off and the chrome driven through its own procs, so nothing + * else happens in between. Fork defines are included after the tests, so literals stand in for them with + * a comment naming the define. The test room is a 5x5 floor. + */ + +/// A Petty knife criminal with the blades in at `where`, its AI off +/datum/unit_test/voidcrew_bounty_chrome/proc/make_mantis(turf/where, style = "knife") + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_criminal(make_record(1, "normal", style, null, list("mantis")), where) // BOUNTY_CHROME_MANTIS + criminal?.ai_controller?.set_ai_status(AI_STATUS_OFF) + return criminal + +/// Starts `criminal`'s fight with `hunter` and returns its chrome +/datum/unit_test/voidcrew_bounty_chrome/proc/chrome_fight(mob/living/carbon/human/npc/bounty_criminal/criminal, mob/living/hunter) + criminal.ai_start_fight(hunter) + var/datum/component/bounty_chrome/chrome = criminal.GetComponent(/datum/component/bounty_chrome) + chrome?.update_fight() + return chrome + +/// The mantis blades `body` holds +/datum/unit_test/voidcrew_bounty_chrome/proc/held_blades(mob/living/carbon/body) + . = list() + for(var/obj/item/melee/energy/blade/hardlight/cyberware_mantis/blade in body.held_items) + . += blade + +/// Blades out in a fight, one a click, into free hands; its knife stays in its pocket; the blade is its weapon and cuts real wounds; it can't be made to drop them; they go back in when it goes down +/datum/unit_test/voidcrew_bounty_chrome/mantis_blades + +/datum/unit_test/voidcrew_bounty_chrome/mantis_blades/Run() + var/mob/living/carbon/human/hunter = make_person(spot(3, 2)) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_mantis(spot(1, 2)) + TEST_ASSERT_NOTNULL(criminal, "No Mantis criminal spawned") + var/list/housings = bounty_mantis_housings(criminal) + TEST_ASSERT_EQUAL(length(housings), 2, "The criminal carries [length(housings)] Mantis housings, not the pair") + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing as anything in housings) + TEST_ASSERT(!housing.blade_extended(), "A blade is out before any fight") + for(var/obj/item/blade as anything in bounty_mantis_blades(housing)) + TEST_ASSERT(human_npc_gear_locked(blade), "The [housing]'s blade isn't locked to the body like its other gear") + var/datum/component/bounty_chrome/chrome = criminal.GetComponent(/datum/component/bounty_chrome) + TEST_ASSERT_NOTNULL(chrome, "The Mantis criminal has no chrome AI") + var/datum/bounty_chrome_move/mantis_blades/blades = chrome.move_of(/datum/bounty_chrome_move/mantis_blades) + TEST_ASSERT_NOTNULL(blades, "The blades' move wasn't made") + TEST_ASSERT(!blades.plan(criminal.ai_controller, hunter), "A blade came out with no fight on") + + chrome_fight(criminal, hunter) + TEST_ASSERT(blades.plan(criminal.ai_controller, hunter), "No blade came out when the fight started") + TEST_ASSERT_EQUAL(length(held_blades(criminal)), 1, "Both blades came out in one click") + TEST_ASSERT(blades.plan(criminal.ai_controller, hunter), "The second blade didn't come out") + TEST_ASSERT(!blades.plan(criminal.ai_controller, hunter), "A third click put something out") + var/list/out = held_blades(criminal) + TEST_ASSERT_EQUAL(length(out), 2, "The criminal holds [length(out)] blades, not one in each hand") + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing as anything in housings) + TEST_ASSERT(housing.blade_extended(), "The [housing]'s blade isn't out") + TEST_ASSERT_NULL(locate(/obj/item/knife) in criminal.held_items, "The criminal drew its knife as well") + TEST_ASSERT_NOTNULL(locate(/obj/item/knife) in criminal.get_all_contents(), "The criminal lost its knife") + var/obj/item/weapon = human_npc_held_melee_weapon(criminal) + TEST_ASSERT(istype(weapon, /obj/item/melee/energy/blade/hardlight/cyberware_mantis), "The criminal fights with [weapon], not its blades") + + // They never leave its hands + var/obj/item/blade = out[1] + TEST_ASSERT(HAS_TRAIT(blade, TRAIT_NODROP), "A blade that is out can be dropped") + TEST_ASSERT(HAS_TRAIT(blade, TRAIT_NO_STRIP), "A blade that is out can be stripped") + criminal.dropItemToGround(blade) + criminal.drop_all_held_items() + TEST_ASSERT_EQUAL(length(held_blades(criminal)), 2, "Dropping things made the criminal let go of a blade") + TEST_ASSERT_NULL(locate(/obj/item/melee/energy/blade/hardlight/cyberware_mantis) in spot(1, 2), "A blade lies on the floor") + + // Its cuts are the blade's own: brute, and in time tg's slash wound + hunter.forceMove(spot(2, 2)) + var/datum/wound/slash/cut + for(var/i in 1 to 8) + criminal.next_move = 0 + criminal.next_click = 0 + criminal.zone_selected = BODY_ZONE_CHEST + human_npc_ready_item(criminal, blade) + criminal.ai_controller.ai_interact(target = hunter, combat_mode = TRUE) + cut = locate() in hunter.all_wounds + if(cut || hunter.stat == DEAD) + break + TEST_ASSERT(hunter.getBruteLoss() > 0, "The blades did nothing") + TEST_ASSERT_NOTNULL(cut, "Eight blade hits opened no slash wound") + + // Down in crit: they go back in, into the housings + criminal.setOxyLoss(criminal.health + 20) + TEST_ASSERT(HAS_TRAIT(criminal, TRAIT_CRITICAL_CONDITION), "The criminal isn't in crit for the downed check") + TEST_ASSERT_EQUAL(length(held_blades(criminal)), 0, "Downed, the criminal still holds its blades") + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing as anything in housings) + TEST_ASSERT(!housing.blade_extended(), "Downed, the [housing]'s blade is still out") + for(var/obj/item/housed as anything in bounty_mantis_blades(housing)) + TEST_ASSERT_EQUAL(housed.loc, housing, "Downed, a blade is somewhere other than its housing") + +/// The blades go away when the fight is over, when it is cuffed, during an EMP's reboot, and with the chrome when it dies; a bat stays in hand and the other blade does the work +/datum/unit_test/voidcrew_bounty_chrome/mantis_blades_away + +/datum/unit_test/voidcrew_bounty_chrome/mantis_blades_away/Run() + var/mob/living/carbon/human/hunter = make_person(spot(3, 2)) + var/list/ways = list("calm", "cuffed", "emp", "death") + for(var/way in ways) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_mantis(spot(1, 2)) + var/datum/component/bounty_chrome/chrome = chrome_fight(criminal, hunter) + var/datum/bounty_chrome_move/mantis_blades/blades = chrome.move_of(/datum/bounty_chrome_move/mantis_blades) + blades.plan(criminal.ai_controller, hunter) + blades.plan(criminal.ai_controller, hunter) + var/list/out = held_blades(criminal) + TEST_ASSERT_EQUAL(length(out), 2, "[way]: the blades didn't come out") + switch(way) + if("calm") + criminal.ai_calm_down() + chrome.update_fight() + if("cuffed") + var/obj/item/restraints/handcuffs/cuffs = new(criminal) + criminal.set_handcuffed(cuffs) + criminal.update_handcuffed() + if("emp") + criminal.emp_act(EMP_HEAVY) + if("death") + criminal.death() + TEST_ASSERT_EQUAL(length(held_blades(criminal)), 0, "[way]: a blade is still in hand") + if(way == "emp") + // Through the reboot nothing comes out, however often it plans + TEST_ASSERT(!blades.plan(criminal.ai_controller, hunter), "A blade came out during the EMP's reboot") + TEST_ASSERT_EQUAL(length(held_blades(criminal)), 0, "A blade is out during the EMP's reboot") + if(way == "death") + sleep(1) + for(var/obj/item/blade as anything in out) + TEST_ASSERT(QDELETED(blade), "A dead criminal's blade outlived its burnt-out housing") + TEST_ASSERT_NULL(locate(/obj/item/melee/energy/blade/hardlight/cyberware_mantis) in spot(1, 2), "A dead criminal left a blade on the floor") + qdel(criminal) + + // A club fighter's bat has nowhere to go: that arm keeps it, and the other blade comes out + var/mob/living/carbon/human/npc/bounty_criminal/clubber = make_mantis(spot(1, 2), "club") + var/datum/component/bounty_chrome/club_chrome = chrome_fight(clubber, hunter) + var/datum/bounty_chrome_move/mantis_blades/club_blades = club_chrome.move_of(/datum/bounty_chrome_move/mantis_blades) + var/obj/item/bat = locate(/obj/item/melee/baseball_bat) in clubber.held_items + TEST_ASSERT_NOTNULL(bat, "The club fighter holds no bat") + club_blades.plan(clubber.ai_controller, hunter) + club_blades.plan(clubber.ai_controller, hunter) + TEST_ASSERT_EQUAL(length(held_blades(clubber)), 1, "The club fighter has [length(held_blades(clubber))] blades out, not the one its free hand takes") + TEST_ASSERT(clubber.is_holding(bat), "The club fighter dropped its bat for a blade") + TEST_ASSERT_NULL(locate(/obj/item/melee/baseball_bat) in spot(1, 2), "The bat ended up on the floor") + TEST_ASSERT(istype(human_npc_held_melee_weapon(clubber), /obj/item/melee/energy/blade/hardlight/cyberware_mantis), "The club fighter swings its bat, not its blade") + +/// The lunge: never before its opener; a blue line and outline for its tell, standing still; then the housing's own Mantis Lunge: the dash, the cut and the knockdown, and its cooldown +/datum/unit_test/voidcrew_bounty_chrome/mantis_lunge + +/datum/unit_test/voidcrew_bounty_chrome/mantis_lunge/Run() + var/mob/living/carbon/human/hunter = make_person(spot(4, 2)) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_mantis(spot(1, 2)) + var/datum/component/bounty_chrome/chrome = chrome_fight(criminal, hunter) + var/datum/bounty_chrome_move/mantis_blades/blades = chrome.move_of(/datum/bounty_chrome_move/mantis_blades) + var/datum/bounty_chrome_move/mantis_lunge/lunge = chrome.move_of(/datum/bounty_chrome_move/mantis_lunge) + TEST_ASSERT_NOTNULL(lunge, "The lunge's move wasn't made") + TEST_ASSERT(!lunge.can_start(hunter), "The lunge would start with the blades in") + blades.plan(criminal.ai_controller, hunter) + blades.plan(criminal.ai_controller, hunter) + TEST_ASSERT(lunge.opens_at > world.time, "The first lunge may come the moment the fight starts") + TEST_ASSERT(lunge.opens_at <= world.time + 1 SECONDS, "The first lunge waits more than a second") // BOUNTY_MANTIS_OPENING + TEST_ASSERT(!lunge.plan(criminal.ai_controller, hunter), "A lunge started inside its opener") + lunge.opens_at = 0 + TEST_ASSERT(lunge.can_start(hunter), "The lunge won't start at a hunter three tiles off in a clear line") + TEST_ASSERT(lunge.plan(criminal.ai_controller, hunter), "A ready lunge didn't start") + TEST_ASSERT_EQUAL(chrome.telling, lunge, "The lunge's tell isn't running") + TEST_ASSERT(HAS_TRAIT_FROM(criminal, TRAIT_IMMOBILIZED, "bounty_chrome"), "The criminal doesn't stand still through the tell") // BOUNTY_CHROME_TRAIT + TEST_ASSERT_NOTNULL(criminal.get_filter(lunge.tell_filter()), "The tell has no outline") + for(var/dx in 2 to 4) + var/obj/effect/temp_visual/bounty_boss_mark/mark = locate() in spot(dx, 2) + TEST_ASSERT_NOTNULL(mark, "The line isn't marked [dx - 1] tiles out") + TEST_ASSERT_EQUAL(mark?.icon_state, dx == 4 ? "target_circle" : "target_box", "The line's mark [dx - 1] tiles out is the wrong one") + TEST_ASSERT_NULL(locate(/obj/effect/temp_visual/bounty_boss_mark) in spot(0, 2), "The line is marked behind the criminal") + sleep(0.6 SECONDS) + TEST_ASSERT_EQUAL(hunter.getBruteLoss(), 0, "The hunter was cut before the tell was over") + // Standing still through the tell greys the button out (the lunge checks immobility), so read its cooldown + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing as anything in bounty_mantis_housings(criminal)) + var/datum/action/cooldown/cyberware/mantis_lunge/housing_lunge = locate() in housing.actions + TEST_ASSERT(!housing_lunge || housing_lunge.next_use_time <= world.time, "The lunge was used before the tell was over") + // The tell ends at 0.9 s, the implant's own telegraph runs 0.3 s, then the dash + sleep(1 SECONDS) + TEST_ASSERT_NULL(lunge.lunge_action(), "The housing's own Mantis Lunge wasn't used: it isn't cooling down") + TEST_ASSERT_EQUAL(get_dist(criminal, hunter), 1, "The dash didn't carry the criminal to the hunter") + TEST_ASSERT(hunter.getBruteLoss() > 0, "The lunge didn't cut the hunter") + TEST_ASSERT(hunter.IsKnockdown() || hunter.body_position == LYING_DOWN, "The lunge didn't put the hunter down") + TEST_ASSERT(!HAS_TRAIT_FROM(criminal, TRAIT_IMMOBILIZED, "bounty_chrome"), "The criminal still stands still after the tell") + TEST_ASSERT_NULL(locate(/obj/effect/temp_visual/bounty_boss_mark) in spot(3, 2), "The line stayed lit after the tell") + TEST_ASSERT(!lunge.can_start(hunter), "The lunge would start again at once") + +/// No lunge at someone right beside it, on the floor, through a table, past a drop beside the line, or with a stun or an EMP in its tell +/datum/unit_test/voidcrew_bounty_chrome/mantis_lunge_refusals + /// Turfs it changed, put back when it ends + var/list/turf/changed_turfs = list() + +/datum/unit_test/voidcrew_bounty_chrome/mantis_lunge_refusals/Destroy() + for(var/turf/changed as anything in changed_turfs) + changed.ChangeTurf(/turf/open/floor/iron) + changed_turfs = null + return ..() + +/datum/unit_test/voidcrew_bounty_chrome/mantis_lunge_refusals/Run() + var/mob/living/carbon/human/hunter = make_person(spot(4, 2)) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_mantis(spot(1, 2)) + var/datum/component/bounty_chrome/chrome = chrome_fight(criminal, hunter) + var/datum/bounty_chrome_move/mantis_blades/blades = chrome.move_of(/datum/bounty_chrome_move/mantis_blades) + var/datum/bounty_chrome_move/mantis_lunge/lunge = chrome.move_of(/datum/bounty_chrome_move/mantis_lunge) + blades.plan(criminal.ai_controller, hunter) + blades.plan(criminal.ai_controller, hunter) + lunge.opens_at = 0 + TEST_ASSERT(lunge.can_start(hunter), "The lunge won't start in the clear") + + hunter.forceMove(spot(2, 2)) + TEST_ASSERT(!lunge.can_start(hunter), "A lunge would start at someone right beside it") + hunter.forceMove(spot(4, 2)) + + hunter.Knockdown(2 SECONDS) + TEST_ASSERT(!lunge.can_start(hunter), "A lunge would start at someone on the floor") + hunter.SetKnockdown(0) + hunter.get_up(instant = TRUE) + TEST_ASSERT(lunge.can_start(hunter), "The lunge won't start once the hunter is up") + + var/obj/structure/table/table = allocate(/obj/structure/table, spot(3, 2)) + TEST_ASSERT(!lunge.can_start(hunter), "A lunge would start through a table it falls short at") + qdel(table) + + var/turf/beside_line = spot(2, 3) + changed_turfs += beside_line + beside_line.ChangeTurf(/turf/open/space) + TEST_ASSERT(!lunge.can_start(hunter), "A lunge would start beside open space") + beside_line = spot(2, 3) + beside_line.ChangeTurf(/turf/open/floor/iron) + TEST_ASSERT(lunge.can_start(hunter), "The lunge won't start once the space is floor again") + + // Cut short: nothing fires, and the housing's lunge isn't spent + for(var/way in list("stunned", "emp")) + chrome.next_move_at = 0 + TEST_ASSERT(chrome.start_move(lunge, hunter), "[way]: the lunge's tell didn't start") + if(way == "stunned") + criminal.Paralyze(2 SECONDS) + else + criminal.emp_act(EMP_HEAVY) + TEST_ASSERT_NULL(chrome.telling, "[way]: the tell kept running") + sleep(1.4 SECONDS) + TEST_ASSERT_EQUAL(hunter.getBruteLoss(), 0, "[way]: the hunter was cut anyway") + TEST_ASSERT(get_dist(criminal, hunter) > 1, "[way]: the criminal dashed anyway") + criminal.SetParalyzed(0) + criminal.get_up(instant = TRUE) + // The EMP put the blades away for its reboot: no lunge with them in + TEST_ASSERT_EQUAL(length(held_blades(criminal)), 0, "The blades stayed out through the EMP") + TEST_ASSERT(!lunge.can_start(hunter), "A lunge would start with the blades in after the EMP") + +/// The dash runs down the line the tell lit: a hunter who steps off it is missed, and it stops on the tile before the line's end +/datum/unit_test/voidcrew_bounty_chrome/mantis_lunge_follows_line + +/datum/unit_test/voidcrew_bounty_chrome/mantis_lunge_follows_line/Run() + var/mob/living/carbon/human/hunter = make_person(spot(4, 2)) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_mantis(spot(1, 2)) + var/datum/component/bounty_chrome/chrome = chrome_fight(criminal, hunter) + var/datum/bounty_chrome_move/mantis_blades/blades = chrome.move_of(/datum/bounty_chrome_move/mantis_blades) + var/datum/bounty_chrome_move/mantis_lunge/lunge = chrome.move_of(/datum/bounty_chrome_move/mantis_lunge) + blades.plan(criminal.ai_controller, hunter) + blades.plan(criminal.ai_controller, hunter) + lunge.opens_at = 0 + chrome.next_move_at = 0 + TEST_ASSERT(chrome.start_move(lunge, hunter), "The lunge's tell didn't start") + // One step off the lit line during the tell: still next to where the dash stops, but off the marked tile + hunter.forceMove(spot(4, 3)) + sleep(1.6 SECONDS) + TEST_ASSERT_NULL(lunge.lunge_action(), "The housing's own Mantis Lunge wasn't used") + TEST_ASSERT_EQUAL(get_turf(criminal), spot(3, 2), "The dash didn't run down the lit line to its last tile") + TEST_ASSERT_EQUAL(hunter.getBruteLoss(), 0, "The dash cut a hunter who had stepped off its line") + +/// The player's lunge is the implant's ordinary one: it follows its target through the wind-up, passes over someone standing in the way, and stops at a window +/datum/unit_test/voidcrew_bounty_chrome/mantis_lunge_player + +/datum/unit_test/voidcrew_bounty_chrome/mantis_lunge_player/Run() + var/mob/living/carbon/human/lunger = make_person(spot(0, 2)) + var/mob/living/carbon/human/victim = make_person(spot(4, 2)) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing = allocate(/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis) + TEST_ASSERT(housing.Insert(lunger, special = TRUE), "The housing wouldn't go in") + housing.Extend(housing.contents[1]) + TEST_ASSERT(housing.blade_extended(), "The blade didn't come out") + var/datum/action/cooldown/cyberware/mantis_lunge/press = locate() in housing.actions + TEST_ASSERT_NOTNULL(press, "The housing has no lunge") + + var/mob/living/carbon/human/bystander = make_person(spot(2, 2)) + TEST_ASSERT(press.Trigger(target = victim), "The lunge wouldn't start past someone standing in the way") + sleep(0.8 SECONDS) + TEST_ASSERT_EQUAL(get_turf(lunger), spot(3, 2), "The player's lunge didn't pass over someone standing in the way") + TEST_ASSERT(victim.getBruteLoss() > 0, "The player's lunge didn't cut its target") + TEST_ASSERT_EQUAL(bystander.getBruteLoss(), 0, "The player's lunge cut whoever stood in the way") + bystander.forceMove(spot(2, 4)) + + // It follows its target through the wind-up + lunger.forceMove(spot(0, 2)) + victim.get_up(instant = TRUE) + var/brute_before = victim.getBruteLoss() + press.ResetCooldown() + TEST_ASSERT(press.Trigger(target = victim), "The lunge wouldn't start in the clear") + victim.forceMove(spot(4, 3)) + sleep(0.8 SECONDS) + TEST_ASSERT(lunger.Adjacent(victim), "The player's lunge didn't follow its target through the wind-up") + TEST_ASSERT(victim.getBruteLoss() > brute_before, "The player's lunge didn't cut a target who moved in the wind-up") + victim.forceMove(spot(4, 2)) + + lunger.forceMove(spot(0, 2)) + brute_before = victim.getBruteLoss() + var/obj/structure/window/fulltile/pane = allocate(/obj/structure/window/fulltile, spot(2, 2)) + press.ResetCooldown() + TEST_ASSERT(press.Trigger(target = victim), "The lunge wouldn't start at someone behind a window") + sleep(0.8 SECONDS) + TEST_ASSERT_EQUAL(get_turf(lunger), spot(1, 2), "The player's lunge went through a window") + // <=, not ==: the earlier cut may heal a little meanwhile + TEST_ASSERT(victim.getBruteLoss() <= brute_before, "A lunge stopped by a window still cut its target") + qdel(pane) + +/// The bounty NPC's shown-line dash is a real run: someone who steps onto its line during the tell stops it short, and nobody is cut +/datum/unit_test/voidcrew_bounty_chrome/mantis_lunge_npc_blocked + +/datum/unit_test/voidcrew_bounty_chrome/mantis_lunge_npc_blocked/Run() + var/mob/living/carbon/human/hunter = make_person(spot(4, 2)) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_mantis(spot(0, 2)) + var/datum/component/bounty_chrome/chrome = chrome_fight(criminal, hunter) + var/datum/bounty_chrome_move/mantis_blades/blades = chrome.move_of(/datum/bounty_chrome_move/mantis_blades) + var/datum/bounty_chrome_move/mantis_lunge/lunge = chrome.move_of(/datum/bounty_chrome_move/mantis_lunge) + blades.plan(criminal.ai_controller, hunter) + blades.plan(criminal.ai_controller, hunter) + lunge.opens_at = 0 + chrome.next_move_at = 0 + TEST_ASSERT(chrome.start_move(lunge, hunter), "The lunge's tell didn't start") + var/mob/living/carbon/human/bystander = make_person(spot(2, 2)) + sleep(1.6 SECONDS) + TEST_ASSERT_NULL(lunge.lunge_action(), "The housing's own Mantis Lunge wasn't used") + TEST_ASSERT_EQUAL(get_turf(criminal), spot(1, 2), "The NPC's dash went through someone standing on its line") + TEST_ASSERT_EQUAL(hunter.getBruteLoss(), 0, "A dash stopped short still cut its target") + TEST_ASSERT_EQUAL(bystander.getBruteLoss(), 0, "A dash stopped short cut whoever stopped it") + +#ifdef BOUNTY_CHROME_RENDERS +/// Writes a Mantis criminal with its blades out, a Gorilla brawler and the tells' floor marks to data/bounty_chrome_renders/ +/datum/unit_test/voidcrew_bounty_chrome/melee_chrome_renders + +/datum/unit_test/voidcrew_bounty_chrome/melee_chrome_renders/Run() + var/mob/living/carbon/human/hunter = make_person(spot(4, 2)) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_mantis(spot(1, 2)) + var/datum/component/bounty_chrome/chrome = chrome_fight(criminal, hunter) + var/datum/bounty_chrome_move/mantis_blades/blades = chrome.move_of(/datum/bounty_chrome_move/mantis_blades) + blades.plan(criminal.ai_controller, hunter) + blades.plan(criminal.ai_controller, hunter) + for(var/facing in list(SOUTH, NORTH, EAST, WEST)) + fcopy(getFlatIcon(criminal, facing), "data/bounty_chrome_renders/mantis_blades_out_[dir2text(facing)].png") + var/mob/living/carbon/human/npc/bounty_criminal/gorilla = make_criminal(make_record(1, "normal", "brawler", null, list("gorilla")), spot(0, 0)) // BOUNTY_CHROME_GORILLA + gorilla.ai_controller?.set_ai_status(AI_STATUS_OFF) + for(var/facing in list(SOUTH, NORTH, EAST)) + fcopy(getFlatIcon(gorilla, facing), "data/bounty_chrome_renders/gorilla_brawler_[dir2text(facing)].png") + var/list/marks = list( + "mark_mantis_line" = new /obj/effect/temp_visual/bounty_boss_mark(spot(0, 4), 10 SECONDS, list(0.42, 0.72, 1, 0, 0, 0, 0, 0, 0)), // BOUNTY_MANTIS_MARK_MATRIX + "mark_mantis_end" = new /obj/effect/temp_visual/bounty_boss_mark(spot(1, 4), 10 SECONDS, list(0.42, 0.72, 1, 0, 0, 0, 0, 0, 0), "target_circle"), + "mark_gorilla_punch" = new /obj/effect/temp_visual/bounty_boss_mark(spot(2, 4), 10 SECONDS), + "mark_gorilla_grab" = new /obj/effect/temp_visual/bounty_boss_mark(spot(3, 4), 10 SECONDS, list(1, 0.54, 0.12, 0, 0, 0, 0, 0, 0), "target_circle"), // BOUNTY_GORILLA_MARK_MATRIX + ) + for(var/name in marks) + var/obj/effect/mark = marks[name] + fcopy(getFlatIcon(mark, SOUTH), "data/bounty_chrome_renders/[name].png") + qdel(mark) + qdel(gorilla) +#endif diff --git a/voidcrew/modules/unit_tests/voidcrew_bounty_chrome_piledriver.dm b/voidcrew/modules/unit_tests/voidcrew_bounty_chrome_piledriver.dm new file mode 100644 index 00000000000..5caf16f3e32 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_bounty_chrome_piledriver.dm @@ -0,0 +1,344 @@ +/** + * Bounty hunting: the Meteor Piledriver on a criminal (C1), for + * voidcrew/modules/bounties/chrome/bounty_chrome_piledriver.dm. + * + * Fork defines are included after the tests, so a test uses the literal value with a comment naming the + * define. Criminals are real human NPCs with the player's leg frame in them; the leap, its shadow, the + * crush and the shockwave are the implant's. Their AI is off, and each test drives the chrome by hand. + * The test room is a 5x5 floor; turfs a test changes are put back when it ends. + * + * Renders: compile with -DBOUNTY_CHROME_RENDERS and the renders test writes the carrier's flat icons to + * data/bounty_chrome_renders/; the crouch's dip, glow and reticle are composited from them. + */ +/datum/unit_test/voidcrew_bounty_chrome_piledriver + abstract_type = /datum/unit_test/voidcrew_bounty_chrome_piledriver + /// Turfs a test changed, put back to plain floor when it ends + var/list/turf/changed_turfs = list() + +/datum/unit_test/voidcrew_bounty_chrome_piledriver/Destroy() + for(var/turf/changed as anything in changed_turfs) + changed.ChangeTurf(/turf/open/floor/iron) + changed_turfs = null + return ..() + +/// A record of `tier`, `archetype` and `style` or `kit`, carrying `chrome`, for a human +/datum/unit_test/voidcrew_bounty_chrome_piledriver/proc/make_record(tier = 2, archetype = "normal", style = "brawler", kit, list/chrome) + var/datum/bounty_record/record = generate_bounty_record(tier, archetype, "planet", /datum/species/human) // BOUNTY_PLACEMENT_PLANET + record.tier = tier + record.archetype = archetype + record.style = archetype == "boss" ? null : style // BOUNTY_ARCHETYPE_BOSS + record.kit = kit + record.chrome = chrome + return record + +/// The criminal for `record` at `where`, its AI off, deleted with the test +/datum/unit_test/voidcrew_bounty_chrome_piledriver/proc/make_criminal(datum/bounty_record/record, turf/where) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = spawn_bounty_criminal(record, where || run_loc_floor_bottom_left, null) + if(criminal) + allocated += criminal + criminal.ai_controller?.set_ai_status(AI_STATUS_OFF) + return criminal + +/// A Wanted brawler with the Piledriver at `where` +/datum/unit_test/voidcrew_bounty_chrome_piledriver/proc/make_leaper(turf/where) + return make_criminal(make_record(2, "normal", "brawler", null, list("piledriver")), where) // BOUNTY_TIER_WANTED, BOUNTY_CHROME_PILEDRIVER + +/// A person with a mind at `where`, deleted with the test +/datum/unit_test/voidcrew_bounty_chrome_piledriver/proc/make_person(turf/where) + var/mob/living/carbon/human/person = allocate(/mob/living/carbon/human/consistent, where || run_loc_floor_top_right) + person.mind_initialize() + return person + +/// A turf `dx`, `dy` from the bottom left of the test room +/datum/unit_test/voidcrew_bounty_chrome_piledriver/proc/spot(dx, dy) + return locate(run_loc_floor_bottom_left.x + dx, run_loc_floor_bottom_left.y + dy, run_loc_floor_bottom_left.z) + +/// Changes `where` to `new_type`, to be put back when the test ends +/datum/unit_test/voidcrew_bounty_chrome_piledriver/proc/change_turf(turf/where, new_type) + changed_turfs |= where + return where.ChangeTurf(new_type) + +/// `criminal`'s Piledriver move +/datum/unit_test/voidcrew_bounty_chrome_piledriver/proc/move_of(mob/living/carbon/human/npc/criminal) + var/datum/component/bounty_chrome/chrome = criminal.GetComponent(/datum/component/bounty_chrome) + return chrome?.move_of(/datum/bounty_chrome_move/piledriver) + +/// `criminal`'s own Meteor Leap button +/datum/unit_test/voidcrew_bounty_chrome_piledriver/proc/leap_action(mob/living/carbon/human/npc/criminal) + return bounty_chrome_action(criminal, /datum/action/cooldown/cyberware/piledriver_leap) + +/// Whether the implant's landing shadow is on `where` +/datum/unit_test/voidcrew_bounty_chrome_piledriver/proc/shadow_on(turf/where) + return !isnull(locate(/obj/effect/temp_visual/cyberware_piledriver_shadow) in where) + +/// Whether the crouch's reticle (a boss floor mark) is on `where` +/datum/unit_test/voidcrew_bounty_chrome_piledriver/proc/reticle_on(turf/where) + for(var/obj/effect/temp_visual/bounty_boss_mark/mark in where) + if(mark.icon_state == "target_circle") + return TRUE + return FALSE + +/// How many crouch reticles are anywhere in the test room +/datum/unit_test/voidcrew_bounty_chrome_piledriver/proc/reticles() + . = 0 + for(var/turf/room_turf as anything in block(spot(0, 0), spot(4, 4))) + for(var/obj/effect/temp_visual/bounty_boss_mark/mark in room_turf) + if(mark.icon_state == "target_circle") + .++ + +// ===== THE LEAP ===== + +/** + * A whole leap from the fight's planning: the crouch (standing still, sunk, glowing, a reticle on its + * target that follows them), then the implant's own leap onto where they stand when the crouch ends, + * its shadow, and its landing: the target crushed, a hunter in the ring knocked down, one outside it + * untouched. Never a companion's piece. + */ +/datum/unit_test/voidcrew_bounty_chrome_piledriver/leap + +/datum/unit_test/voidcrew_bounty_chrome_piledriver/leap/Run() + var/turf/start = spot(0, 0) + var/turf/aim = spot(3, 0) + var/turf/stepped_to = spot(3, 1) + var/datum/bounty_chrome_piece/piece = GLOB.bounty_chrome_pieces["piledriver"] + TEST_ASSERT(!piece.companion, "Companions can roll the Piledriver") + var/mob/living/carbon/human/target = make_person(aim) + var/mob/living/carbon/human/ring_hunter = make_person(spot(4, 2)) + var/mob/living/carbon/human/outside_hunter = make_person(spot(0, 4)) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_leaper(start) + TEST_ASSERT_NOTNULL(locate(/obj/item/organ/cyberimp/cyberware/piledriver) in criminal.organs, "The criminal has no Piledriver in it") + var/datum/component/bounty_chrome/chrome = criminal.GetComponent(/datum/component/bounty_chrome) + var/datum/bounty_chrome_move/piledriver/move = move_of(criminal) + TEST_ASSERT_NOTNULL(move, "The Piledriver has no move") + TEST_ASSERT(move.tell_time >= 0.8 SECONDS, "The crouch is [move.tell_time / 10] s") // BOUNTY_CHROME_TELL_MIN + TEST_ASSERT(move.area_move, "The leap isn't held to the bystander rule") + TEST_ASSERT(criminal.ai_start_fight(target), "The criminal wouldn't fight") + // In the fight too (it attacked them, say): the shockwave may catch them + criminal.body_add_grudge(ring_hunter) + chrome.update_fight() + TEST_ASSERT(chrome.next_move_at - world.time <= 1.5 SECONDS, "The first leap waits [(chrome.next_move_at - world.time) / 10] s into the fight") // BOUNTY_CHROME_OPENING + chrome.next_move_at = 0 + var/datum/action/cooldown/cyberware/piledriver_leap/leap = leap_action(criminal) + TEST_ASSERT_NOTNULL(leap, "The Piledriver has no Meteor Leap") + + TEST_ASSERT(move.can_start(target), "It won't leap at a hunter three tiles off in the open") + TEST_ASSERT_EQUAL(chrome.plan(criminal.ai_controller, 1), SUBTREE_RETURN_FINISH_PLANNING, "A ready leap didn't start") + TEST_ASSERT_EQUAL(chrome.telling, move, "The crouch isn't running") + TEST_ASSERT(HAS_TRAIT_FROM(criminal, TRAIT_IMMOBILIZED, "bounty_chrome"), "It doesn't stand still in the crouch") // BOUNTY_CHROME_TRAIT + TEST_ASSERT_NOTNULL(criminal.get_filter(move.tell_filter()), "The crouch doesn't glow") + TEST_ASSERT(criminal.pixel_z < criminal.base_pixel_z, "It doesn't sink into the crouch") + TEST_ASSERT(reticle_on(aim), "No reticle on its target in the crouch") + // Its target steps aside: the reticle follows + target.forceMove(stepped_to) + TEST_ASSERT(reticle_on(stepped_to), "The reticle didn't follow its target") + TEST_ASSERT_EQUAL(reticles(), 1, "The reticle was left behind or doubled") + sleep(0.6 SECONDS) + TEST_ASSERT(leap.next_use_time <= world.time, "It leapt before the crouch was over") + TEST_ASSERT_EQUAL(criminal.loc, start, "It moved in the crouch") + + sleep(0.5 SECONDS) + TEST_ASSERT(leap.next_use_time > world.time + 50 SECONDS, "The crouch ended with no leap (the implant's minute of cooldown didn't start)") + TEST_ASSERT(shadow_on(stepped_to), "The implant's shadow isn't where its target went") + TEST_ASSERT_EQUAL(reticles(), 0, "The reticle stayed on in the air") + TEST_ASSERT(!HAS_TRAIT_FROM(criminal, TRAIT_IMMOBILIZED, "bounty_chrome"), "The crouch's hold stayed on") + TEST_ASSERT(HAS_TRAIT(criminal, TRAIT_IMMOBILIZED), "It isn't held by its own leap in the air") + TEST_ASSERT_EQUAL(criminal.loc, start, "It arrived before its time in the air was over") + TEST_ASSERT(target.getBruteLoss() == 0, "The target was hurt before the landing") + + sleep(1 SECONDS) + TEST_ASSERT_EQUAL(criminal.loc, stepped_to, "It didn't land on the shadow") + TEST_ASSERT(target.getBruteLoss() > 0 && target.IsParalyzed(), "The hunter under it wasn't crushed") + TEST_ASSERT(ring_hunter.IsKnockdown(), "A hunter in the ring wasn't knocked down") + TEST_ASSERT(outside_hunter.getBruteLoss() == 0 && !outside_hunter.IsKnockdown(), "A hunter outside the ring was caught") + TEST_ASSERT(!HAS_TRAIT(criminal, TRAIT_IMMOBILIZED), "It is still held after landing") + TEST_ASSERT_EQUAL(criminal.pixel_z, criminal.base_pixel_z, "It is still up in the air, or still crouched") + TEST_ASSERT(!move.can_start(target), "It would leap again with the implant cooling down") + +/** + * Where it lands: never at someone too close; over a table; never through a wall; beside a target on + * lava, or off its leash; and in the air it comes down as the player's leap does, stunned or not. + */ +/datum/unit_test/voidcrew_bounty_chrome_piledriver/reach + +/datum/unit_test/voidcrew_bounty_chrome_piledriver/reach/Run() + var/turf/aim = spot(3, 0) + var/mob/living/carbon/human/target = make_person(aim) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_leaper(spot(0, 0)) + var/datum/bounty_chrome_move/piledriver/move = move_of(criminal) + TEST_ASSERT(criminal.ai_start_fight(target), "The criminal wouldn't fight") + TEST_ASSERT_EQUAL(move.landing_for(target), aim, "It wouldn't land on a hunter three tiles off in the open") + + target.forceMove(spot(2, 0)) + TEST_ASSERT(!move.can_start(target), "It would leap at a hunter two tiles off") // BOUNTY_PILEDRIVER_MIN_RANGE + target.forceMove(aim) + + var/obj/structure/table/table = allocate(/obj/structure/table, spot(2, 0)) + TEST_ASSERT_EQUAL(move.landing_for(target), aim, "A table between them stopped the leap") + qdel(table) + + // A target on a table: it lands beside them + table = allocate(/obj/structure/table, aim) + var/turf/off_table_landing = move.landing_for(target) + TEST_ASSERT(off_table_landing && off_table_landing != aim && get_dist(off_table_landing, aim) == 1, "With its target on a table it would land on the table, or not beside them") + qdel(table) + + for(var/dy in 0 to 4) + change_turf(spot(2, dy), /turf/closed/wall) + TEST_ASSERT_NULL(move.landing_for(target), "It would leap through a wall") + TEST_ASSERT(!move.can_start(target), "It would start a leap through a wall") + for(var/dy in 0 to 4) + change_turf(spot(2, dy), /turf/open/floor/iron) + + // Never onto lava: beside it instead + ADD_TRAIT(target, TRAIT_LAVA_IMMUNE, TRAIT_GENERIC) + change_turf(aim, /turf/open/lava/smooth) + var/turf/landing = move.landing_for(target) + TEST_ASSERT_NOTNULL(landing, "With its target on lava it found nowhere to land") + TEST_ASSERT(landing && !islava(landing) && get_dist(landing, aim) == 1, "It would land on lava, or not beside its target") + change_turf(aim, /turf/open/floor/iron) + REMOVE_TRAIT(target, TRAIT_LAVA_IMMUNE, TRAIT_GENERIC) + + // Never off its leash: its site ends a column short of its target + var/turf/corner = spot(0, 0) + criminal.site_bounds = list(corner.x, corner.y, corner.x + 2, corner.y + 4, corner.z) + landing = move.landing_for(target) + TEST_ASSERT(landing && criminal.leash_ok(landing), "It would land off its leash") + criminal.site_bounds = null + + // Shot or stunned in the air, it still comes down on the shadow, as a player's leap does + TEST_ASSERT(move.fire(target), "It didn't leap") + TEST_ASSERT(shadow_on(aim), "No shadow under its target") + criminal.Paralyze(2 SECONDS) + sleep(1 SECONDS) + TEST_ASSERT_EQUAL(criminal.loc, aim, "Stunned in the air, it didn't come down on the shadow") + TEST_ASSERT(target.getBruteLoss() > 0, "Its landing crushed nobody") + +/** + * Never onto anyone outside its fight, its own companion, or anyone down: it doesn't start, and someone + * stepping into the landing during the crouch calls it off with the pistons settling and nothing spent. + */ +/datum/unit_test/voidcrew_bounty_chrome_piledriver/bystanders + +/datum/unit_test/voidcrew_bounty_chrome_piledriver/bystanders/Run() + var/mob/living/carbon/human/target = make_person(spot(3, 0)) + var/mob/living/carbon/human/bystander = make_person(spot(4, 2)) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_leaper(spot(0, 0)) + var/datum/component/bounty_chrome/chrome = criminal.GetComponent(/datum/component/bounty_chrome) + var/datum/bounty_chrome_move/piledriver/move = move_of(criminal) + var/datum/action/cooldown/cyberware/piledriver_leap/leap = leap_action(criminal) + TEST_ASSERT(criminal.ai_start_fight(target), "The criminal wouldn't fight") + chrome.update_fight() + chrome.next_move_at = 0 + TEST_ASSERT(!move.can_start(target), "It would leap with a bystander in the landing") + TEST_ASSERT_NULL(chrome.plan(criminal.ai_controller, 1), "It planned a leap onto a bystander") + bystander.forceMove(spot(0, 4)) + TEST_ASSERT(move.can_start(target), "With the bystander clear it won't leap") + + // A bystander walks in during the crouch: it calls the leap off + TEST_ASSERT(chrome.start_move(move, target), "The crouch didn't start") + bystander.forceMove(spot(4, 1)) + sleep(1.2 SECONDS) + TEST_ASSERT_EQUAL(criminal.loc, spot(0, 0), "It leapt onto a bystander who walked in") + TEST_ASSERT(leap.next_use_time <= world.time, "Calling the leap off spent the implant's cooldown") + TEST_ASSERT(!shadow_on(spot(3, 0)), "A called-off leap left a shadow") + TEST_ASSERT_EQUAL(reticles(), 0, "A called-off leap left its reticle") + TEST_ASSERT_EQUAL(criminal.pixel_z, criminal.base_pixel_z, "It is still crouched") + bystander.forceMove(spot(0, 4)) + + // Its own companion in the landing + var/list/buddies = criminal.spawn_companions(1, TRUE) + TEST_ASSERT(length(buddies), "No companion spawned") + allocated += buddies + var/mob/living/carbon/human/npc/bounty_companion/buddy = buddies[1] + buddy.ai_controller?.set_ai_status(AI_STATUS_OFF) + buddy.forceMove(spot(4, 1)) + TEST_ASSERT(!move.can_start(target), "It would leap onto its own companion") + buddy.forceMove(spot(1, 4)) + TEST_ASSERT(move.can_start(target), "With its companion clear it won't leap") + + // A hunter in its fight, down in the landing + var/mob/living/carbon/human/fallen_hunter = make_person(spot(4, 0)) + criminal.body_add_grudge(fallen_hunter) + TEST_ASSERT(move.can_start(target), "A hunter on its feet in its fight stops the leap") + fallen_hunter.setOxyLoss(fallen_hunter.health + 20) + TEST_ASSERT(fallen_hunter.stat != CONSCIOUS && fallen_hunter.stat != DEAD, "The downed hunter isn't down") + TEST_ASSERT(!move.can_start(target), "It would leap onto someone who is down") + +/// An EMP, a stun or crit in the crouch stops it: no leap, nothing spent, the reticle and the crouch gone; a stunned criminal starts none +/datum/unit_test/voidcrew_bounty_chrome_piledriver/interrupted + +/datum/unit_test/voidcrew_bounty_chrome_piledriver/interrupted/Run() + var/turf/start = spot(0, 0) + var/turf/aim = spot(3, 0) + var/mob/living/carbon/human/target = make_person(aim) + for(var/way in list("emp", "stunned", "downed")) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_leaper(start) + var/datum/component/bounty_chrome/chrome = criminal.GetComponent(/datum/component/bounty_chrome) + var/datum/bounty_chrome_move/piledriver/move = move_of(criminal) + var/datum/action/cooldown/cyberware/piledriver_leap/leap = leap_action(criminal) + TEST_ASSERT(criminal.ai_start_fight(target), "[way]: the criminal wouldn't fight") + chrome.update_fight() + TEST_ASSERT(chrome.start_move(move, target), "[way]: the crouch didn't start") + TEST_ASSERT(reticle_on(aim), "[way]: no reticle in the crouch") + switch(way) + if("emp") + criminal.emp_act(EMP_HEAVY) + if("stunned") + criminal.Paralyze(3 SECONDS) + if("downed") + criminal.setOxyLoss(criminal.health + 20) + TEST_ASSERT_NULL(chrome.telling, "[way]: the crouch kept running") + TEST_ASSERT_EQUAL(reticles(), 0, "[way]: the reticle stayed") + TEST_ASSERT(!HAS_TRAIT_FROM(criminal, TRAIT_IMMOBILIZED, "bounty_chrome"), "[way]: the crouch's hold stayed on") + sleep(1.2 SECONDS) + TEST_ASSERT_EQUAL(criminal.loc, start, "[way]: it leapt anyway") + TEST_ASSERT(leap.next_use_time <= world.time, "[way]: the implant's cooldown was spent on a leap that never came") + TEST_ASSERT(!shadow_on(aim), "[way]: a shadow came down anyway") + TEST_ASSERT(target.getBruteLoss() == 0, "[way]: the target was hurt") + if(way == "emp") + TEST_ASSERT(!move.ready(), "The Piledriver is ready through its EMP reboot") + else + TEST_ASSERT(!move.can_start(target), "[way]: it would start a leap") + qdel(criminal) + +// ===== MINI-BOSSES ===== + +/// The Pyromaniac leaps through its ability rotation: the wind-up is the crouch, the effect the implant's own leap +/datum/unit_test/voidcrew_bounty_chrome_piledriver/boss + +/datum/unit_test/voidcrew_bounty_chrome_piledriver/boss/Run() + var/turf/aim = spot(3, 0) + var/mob/living/carbon/human/target = make_person(aim) + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = make_criminal(make_record(3, "boss", null, "pyromaniac", list("piledriver")), spot(0, 0)) // BOUNTY_TIER_MOST_WANTED, BOUNTY_KIT_PYROMANIAC + TEST_ASSERT(istype(boss, /mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac), "No Pyromaniac spawned") + TEST_ASSERT_NOTNULL(locate(/obj/item/organ/cyberimp/cyberware/piledriver) in boss.organs, "The Pyromaniac has no Piledriver in it") + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/ability + for(var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/wrapped in boss.boss_abilities) + if(istype(wrapped.move, /datum/bounty_chrome_move/piledriver)) + ability = wrapped + TEST_ASSERT_NOTNULL(ability, "The Pyromaniac's Piledriver isn't in its ability rotation") + TEST_ASSERT(ability.windup >= 0.8 SECONDS, "The Pyromaniac's crouch is [ability.windup / 10] s") // BOUNTY_CHROME_TELL_MIN + TEST_ASSERT(ability.worth_using(target), "The Pyromaniac won't leap at a hunter three tiles off") + TEST_ASSERT(ability.Trigger(target = target), "The Pyromaniac's leap wouldn't start") + TEST_ASSERT_EQUAL(boss.boss_busy, "windup", "The Pyromaniac isn't crouching") + TEST_ASSERT(reticle_on(aim), "The Pyromaniac's crouch has no reticle") + sleep(2.2 SECONDS) + TEST_ASSERT_EQUAL(boss.loc, aim, "The Pyromaniac didn't come down on its target") + TEST_ASSERT(target.getBruteLoss() > 0, "The Pyromaniac's landing crushed nobody") + TEST_ASSERT_EQUAL(reticles(), 0, "The Pyromaniac's reticle stayed") + +// ===== RENDERS ===== + +/// Not a check: with -DBOUNTY_CHROME_RENDERS, writes a Piledriver carrier's flat icons to data/bounty_chrome_renders/, for the crouch composite +/datum/unit_test/voidcrew_bounty_chrome_piledriver/renders + +/datum/unit_test/voidcrew_bounty_chrome_piledriver/renders/Run() + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_leaper(spot(1, 1)) + var/mob/living/carbon/human/target = make_person(spot(4, 1)) + TEST_ASSERT_NOTNULL(locate(/obj/item/organ/cyberimp/cyberware/piledriver) in criminal.organs, "The carrier has no Piledriver") + TEST_ASSERT_NOTNULL(target, "No one to leap at") +#ifdef BOUNTY_CHROME_RENDERS + for(var/facing in list(SOUTH, EAST)) + fcopy(getFlatIcon(criminal, facing), "data/bounty_chrome_renders/piledriver_carrier_[dir2text(facing)].png") + fcopy(getFlatIcon(target, WEST), "data/bounty_chrome_renders/piledriver_target_west.png") +#endif diff --git a/voidcrew/modules/unit_tests/voidcrew_bounty_chrome_redline.dm b/voidcrew/modules/unit_tests/voidcrew_bounty_chrome_redline.dm new file mode 100644 index 00000000000..0bdf6ca2d04 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_bounty_chrome_redline.dm @@ -0,0 +1,168 @@ +/** + * Redline core on a bounty NPC (voidcrew/modules/bounties/chrome/bounty_chrome_redline.dm): the AI picks + * the moment and tells it, then everything is the player implant's (ware_legend.dm). Real human NPCs, + * real implants, real timers; the AI is switched off so the test drives the chrome. Fork defines are + * included after the tests, so literals carry a comment naming theirs. + */ + +/// A Wanted brawler with a Redline core in, fighting `hunter`, its AI off and its chrome ready to move. Returns the criminal. +/datum/unit_test/voidcrew_bounty_chrome/proc/redliner(mob/living/hunter, archetype = "normal", kit) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = make_criminal(make_record(2, archetype, "brawler", kit, list("redline"))) // BOUNTY_TIER_WANTED, BOUNTY_CHROME_REDLINE + criminal.ai_controller?.set_ai_status(AI_STATUS_OFF) + if(hunter && archetype != "boss") // BOUNTY_ARCHETYPE_BOSS + criminal.ai_start_fight(hunter) + var/datum/component/bounty_chrome/chrome_ai = criminal.GetComponent(/datum/component/bounty_chrome) + chrome_ai?.update_fight() + if(chrome_ai) + chrome_ai.next_move_at = 0 + return criminal + +/// Hurts `criminal` with brute until it is at or under three quarters of its health, on its feet +/datum/unit_test/voidcrew_bounty_chrome/proc/hurt_to_redline(mob/living/carbon/human/npc/bounty_criminal/criminal) + for(var/i in 1 to 10) + if(criminal.health <= criminal.maxHealth * 0.7) + break + criminal.adjustBruteLoss(10) + criminal.updatehealth() + +/// Hurt in a fight, it tells for a second (standing still, outlined), then the implant's own burn: stun immunity, physiology, the roar on the hunter, red eyes; after the implant's 12 seconds, the crash floors it in stamina crit +/datum/unit_test/voidcrew_bounty_chrome/redline_burn + +/datum/unit_test/voidcrew_bounty_chrome/redline_burn/Run() + var/mob/living/carbon/human/hunter = make_person(spot(2, 0)) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = redliner(hunter) + TEST_ASSERT(locate(/obj/item/organ/cyberimp/cyberware/redline) in criminal.organs, "The criminal has no Redline core in it") + var/datum/component/bounty_chrome/chrome_ai = criminal.GetComponent(/datum/component/bounty_chrome) + var/datum/bounty_chrome_move/redline/move = chrome_ai?.move_of(/datum/bounty_chrome_move/redline) + TEST_ASSERT_NOTNULL(move, "A Redline carrier has no Redline move") + TEST_ASSERT(!move.can_start(hunter), "An unhurt criminal burns its Redline") + TEST_ASSERT_NULL(chrome_ai.plan(criminal.ai_controller, 1), "An unhurt criminal started a chrome move") + + hurt_to_redline(criminal) + TEST_ASSERT(criminal.stat == CONSCIOUS && criminal.health <= criminal.maxHealth * 0.75, "The criminal wasn't hurt to three quarters on its feet (health [criminal.health])") + TEST_ASSERT(move.can_start(hunter), "A hurt criminal in a fight won't burn its Redline") + var/brute_mod_before = criminal.physiology.brute_mod + TEST_ASSERT_EQUAL(chrome_ai.plan(criminal.ai_controller, 1), SUBTREE_RETURN_FINISH_PLANNING, "The Redline didn't start") + TEST_ASSERT_EQUAL(chrome_ai.telling, move, "The Redline's tell isn't running") + TEST_ASSERT(HAS_TRAIT_FROM(criminal, TRAIT_IMMOBILIZED, "bounty_chrome"), "The criminal doesn't stand still through the tell") // BOUNTY_CHROME_TRAIT + TEST_ASSERT_NOTNULL(criminal.get_filter(move.tell_filter()), "The tell has no outline") + sleep(0.7 SECONDS) + TEST_ASSERT_NULL(criminal.has_status_effect(/datum/status_effect/cyberware_redline_window), "The burn started before the tell's 0.8 seconds were up") // BOUNTY_CHROME_TELL_MIN + sleep(0.5 SECONDS) + + // The implant's own window + TEST_ASSERT_NOTNULL(criminal.has_status_effect(/datum/status_effect/cyberware_redline_window), "The tell ended but the implant's burn didn't start") + TEST_ASSERT(HAS_TRAIT(criminal, TRAIT_STUNIMMUNE), "The burn gives no stun immunity") + TEST_ASSERT(criminal.physiology.brute_mod < brute_mod_before * 0.61, "The burn didn't cut brute through the physiology ([brute_mod_before] to [criminal.physiology.brute_mod])") + TEST_ASSERT_NOTNULL(hunter.has_status_effect(/datum/status_effect/staggered), "The roar didn't stagger the hunter in the fight") + TEST_ASSERT_NOTNULL(criminal.has_status_effect(/datum/status_effect/bounty_redline_eyes), "Its eyes didn't go red for the burn") + TEST_ASSERT_EQUAL(criminal.get_left_eye_color(), "#ff2a2a", "Its eyes aren't red through the burn") + TEST_ASSERT(!move.ready(), "The implant isn't cooling down after the burn") + TEST_ASSERT_NULL(criminal.get_filter(move.tell_filter()), "The tell's outline stayed on") + TEST_ASSERT_NOTNULL(criminal.get_filter("cyberware_redline_window"), "The burn has no red outline") + criminal.Paralyze(3 SECONDS) + TEST_ASSERT(!criminal.IsParalyzed(), "A stun landed in the burn") + + // The implant's 12 seconds from the end of the tell, then the crash + sleep(12.4 SECONDS) + TEST_ASSERT_NULL(criminal.has_status_effect(/datum/status_effect/cyberware_redline_window), "The burn outlasted the implant's 12 seconds") + TEST_ASSERT_NULL(criminal.get_filter("cyberware_redline_window"), "The red outline outlasted the burn") + TEST_ASSERT_NOTNULL(criminal.has_status_effect(/datum/status_effect/cyberware_redline_crash), "No crash after the burn") + TEST_ASSERT_NOTNULL(criminal.has_status_effect(/datum/status_effect/incapacitating/stamcrit), "The crash didn't floor it in stamina crit") + TEST_ASSERT_EQUAL(criminal.capture_state(), "stunned", "The crash isn't a stunned capture") // BOUNTY_STATE_STUNNED + TEST_ASSERT(!HAS_TRAIT(criminal, TRAIT_STUNIMMUNE), "Stun immunity outlasted the burn") + TEST_ASSERT_EQUAL(criminal.physiology.brute_mod, brute_mod_before, "The physiology didn't go back after the burn") + sleep(0.6 SECONDS) + TEST_ASSERT_NULL(criminal.has_status_effect(/datum/status_effect/bounty_redline_eyes), "Its eyes stayed red after the burn") + TEST_ASSERT_NOTEQUAL(criminal.get_left_eye_color(), "#ff2a2a", "Its eyes stayed red after the burn") + +/// Winded by stamina it burns too; with someone outside the fight in the roar's reach it doesn't start, and someone stepping in during the tell keeps the button unpressed; its own companion does neither, and the roar spares it +/datum/unit_test/voidcrew_bounty_chrome/redline_gate + +/datum/unit_test/voidcrew_bounty_chrome/redline_gate/Run() + var/mob/living/carbon/human/hunter = make_person(spot(2, 0)) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = redliner(hunter) + var/datum/component/bounty_chrome/chrome_ai = criminal.GetComponent(/datum/component/bounty_chrome) + var/datum/bounty_chrome_move/redline/move = chrome_ai.move_of(/datum/bounty_chrome_move/redline) + criminal.adjustStaminaLoss(60) + TEST_ASSERT(bounty_redline_hurt(criminal), "Winded to 60 stamina doesn't count") + TEST_ASSERT(move.can_start(hunter), "A winded criminal won't burn its Redline") + + // A bystander a few tiles off, in the roar's reach + var/mob/living/carbon/human/bystander = make_person(spot(1, 2)) + TEST_ASSERT(!move.can_start(hunter), "It burns its Redline with a bystander in the roar's reach") + bystander.forceMove(run_loc_floor_top_right) + var/far = get_dist(criminal, bystander) > 5 // BOUNTY_REDLINE_ROAR_RANGE + if(far) + TEST_ASSERT(move.can_start(hunter), "A bystander out of the roar's reach keeps the Redline shut") + + // Someone steps in during the tell: the button stays unpressed + TEST_ASSERT(chrome_ai.start_move(move, hunter), "The tell didn't start") + bystander.forceMove(spot(1, 2)) + sleep(1.2 SECONDS) + TEST_ASSERT_NULL(criminal.has_status_effect(/datum/status_effect/cyberware_redline_window), "It roared at a bystander who stepped in during the tell") + TEST_ASSERT_NULL(bystander.has_status_effect(/datum/status_effect/staggered), "The bystander was staggered") + TEST_ASSERT(move.ready(), "The unpressed burn still went on cooldown") + + // Its own companion in the roar's reach doesn't hold it back, and the roar spares it + qdel(bystander) + var/datum/human_npc_order/order = bounty_spawn_companion(criminal, spot(1, 2), null, TRUE, bounty_test_company_member("brawler", null)) // BOUNTY_STYLE_BRAWLER + var/mob/living/carbon/human/npc/bounty_companion/buddy = order?.spawned_ref?.resolve() + qdel(order) + TEST_ASSERT_NOTNULL(buddy, "Test fixture: no companion was made") + allocated += buddy + buddy.ai_controller?.set_ai_status(AI_STATUS_OFF) + TEST_ASSERT(move.can_start(hunter), "Its own companion in the roar's reach keeps the Redline shut") + TEST_ASSERT(chrome_ai.start_move(move, hunter), "The tell didn't start with its companion near") + sleep(1.2 SECONDS) + TEST_ASSERT_NOTNULL(criminal.has_status_effect(/datum/status_effect/cyberware_redline_window), "It didn't burn with only its companion near") + TEST_ASSERT_NULL(buddy.has_status_effect(/datum/status_effect/staggered), "The roar staggered its own companion") + +/// An EMP in the tell fires nothing; one in the burn drops it straight into the implant's crash and back on its cooldown +/datum/unit_test/voidcrew_bounty_chrome/redline_emp + +/datum/unit_test/voidcrew_bounty_chrome/redline_emp/Run() + var/mob/living/carbon/human/hunter = make_person(spot(2, 0)) + var/mob/living/carbon/human/npc/bounty_criminal/criminal = redliner(hunter) + var/datum/component/bounty_chrome/chrome_ai = criminal.GetComponent(/datum/component/bounty_chrome) + var/datum/bounty_chrome_move/redline/move = chrome_ai.move_of(/datum/bounty_chrome_move/redline) + hurt_to_redline(criminal) + TEST_ASSERT(chrome_ai.start_move(move, hunter), "The tell didn't start") + criminal.emp_act(EMP_HEAVY) + TEST_ASSERT_NULL(chrome_ai.telling, "An EMP didn't cut the tell short") + sleep(1.2 SECONDS) + TEST_ASSERT_NULL(criminal.has_status_effect(/datum/status_effect/cyberware_redline_window), "It burned through an EMP in the tell") + qdel(criminal) + + criminal = redliner(hunter) + chrome_ai = criminal.GetComponent(/datum/component/bounty_chrome) + move = chrome_ai.move_of(/datum/bounty_chrome_move/redline) + hurt_to_redline(criminal) + TEST_ASSERT(chrome_ai.start_move(move, hunter), "The second tell didn't start") + sleep(1.2 SECONDS) + TEST_ASSERT_NOTNULL(criminal.has_status_effect(/datum/status_effect/cyberware_redline_window), "The second burn didn't start") + criminal.emp_act(EMP_HEAVY) + TEST_ASSERT_NULL(criminal.has_status_effect(/datum/status_effect/cyberware_redline_window), "An EMP in the burn didn't end it") + TEST_ASSERT_NOTNULL(criminal.has_status_effect(/datum/status_effect/cyberware_redline_crash), "An EMP in the burn didn't crash it") + TEST_ASSERT(!move.ready(), "The Redline is ready again straight after an EMP crash") + sleep(0.6 SECONDS) + TEST_ASSERT_NULL(criminal.has_status_effect(/datum/status_effect/bounty_redline_eyes), "Its eyes stayed red after the EMP crash") + +/// A mini-boss with a Redline core uses it through its ability rotation, only once it is hurt +/datum/unit_test/voidcrew_bounty_chrome/redline_boss + +/datum/unit_test/voidcrew_bounty_chrome/redline_boss/Run() + var/mob/living/carbon/human/hunter = make_person(spot(2, 0)) + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = redliner(null, "boss", "pyromaniac") // BOUNTY_KIT_PYROMANIAC + TEST_ASSERT(istype(boss), "No Pyromaniac spawned") + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/ability + for(var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/found in boss.boss_abilities) + if(istype(found.move, /datum/bounty_chrome_move/redline)) + ability = found + TEST_ASSERT_NOTNULL(ability, "The Pyromaniac's Redline isn't in its ability rotation") + boss.body_add_grudge(hunter) + boss.boss_turn_hostile(hunter) + TEST_ASSERT(!ability.worth_using(hunter), "An unhurt mini-boss reaches for its Redline") + hurt_to_redline(boss) + TEST_ASSERT(ability.worth_using(hunter), "A hurt mini-boss won't use its Redline") + TEST_ASSERT(ability.windup >= 0.8 SECONDS, "The mini-boss's Redline winds up for [ability.windup / 10] s") // BOUNTY_CHROME_TELL_MIN diff --git a/voidcrew/modules/unit_tests/voidcrew_bounty_companions_backup.dm b/voidcrew/modules/unit_tests/voidcrew_bounty_companions_backup.dm new file mode 100644 index 00000000000..2a700ea4284 --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_bounty_companions_backup.dm @@ -0,0 +1,372 @@ +/** + * Bounty hunting: companions back their criminal up (C4), for voidcrew/modules/bounties/bounty_companions.dm, + * bounty_placement.dm (the posting's company), bounty_posting.dm (the sighting) and bounty_styles.dm (the + * companions' strings and bursts). At most one of a criminal's company carries a gun; the posting rolls + * the company with its site, names it on the card, the notices and the warrant, and spawns that same + * company; companions get up before they draw, a beat after their criminal, fire pistol strings of three + * and SMG bursts of two; and now and then one carries a piece of real chrome, rarer than its criminal's. + * + * The tests drive the procs directly (a test world has no clients, so the AI is off), with the gun tests' + * helpers (voidcrew_bounty_guns.dm). Fork defines are included after the tests, so a test uses the + * literal value with a comment naming the define. + */ + +/// One companion of a company as bounty_roll_company() makes it: `style` (BOUNTY_STYLE_*) and `chrome` (keys, or null) +/proc/bounty_test_company_member(style, list/chrome) + return list("style" = style, "chrome" = chrome) // BOUNTY_COMPANY_STYLE, BOUNTY_COMPANY_CHROME + +/// The companion tests, in the bounty AI tests' room, with the gun tests' helpers +/datum/unit_test/voidcrew_bounty_companions + parent_type = /datum/unit_test/voidcrew_bounty_guns + abstract_type = /datum/unit_test/voidcrew_bounty_companions + +/// `leader`'s companion at `where`, made now as the posting's `member` would be (bounty_test_company_member()), its AI off +/datum/unit_test/voidcrew_bounty_companions/proc/make_companion(mob/living/carbon/human/npc/bounty_criminal/leader, turf/where, list/member) + var/datum/human_npc_order/order = bounty_spawn_companion(leader, where, null, TRUE, member) + var/mob/living/carbon/human/npc/bounty_companion/buddy = order?.spawned_ref?.resolve() + qdel(order) + TEST_ASSERT_NOTNULL(buddy, "Test fixture: no companion was made") + allocated += buddy + buddy.ai_controller.set_ai_status(AI_STATUS_OFF) + return buddy + +/// A hunter at `where` whom `buddy` and its criminal are out to get: on the criminal's grudge list, the companion's enemy and its target +/datum/unit_test/voidcrew_bounty_companions/proc/make_companion_target(mob/living/carbon/human/npc/bounty_companion/buddy, turf/where) + var/mob/living/carbon/human/consistent/hunter = allocate(/mob/living/carbon/human/consistent, where) + buddy.ai_leader()?.ai_add_grudge(hunter) + buddy.ai_mark_enemy(hunter) + buddy.ai_controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, hunter) + return hunter + +/// The chrome organ types in `body` +/datum/unit_test/voidcrew_bounty_companions/proc/chrome_in(mob/living/carbon/body) + . = list() + for(var/obj/item/organ/organ in body.organs) + if(organ.GetComponent(/datum/component/cyberware)) + . += organ.type + +// ===== THE COMPANY ===== + +/** + * A criminal's company: never two guns, and the gun (if any) first; a companion's chrome is one piece at + * most, never Lazarus or the Piledriver, rolled for its own style, and only now and then. Companions a + * criminal spawns without a posting's company follow the same rule, and so does one more joining a + * criminal who already has an armed companion. + */ +/datum/unit_test/voidcrew_bounty_companions/rolls + +/datum/unit_test/voidcrew_bounty_companions/rolls/Run() + var/chromed = 0 + var/members = 0 + for(var/i in 1 to 300) + var/list/company = bounty_roll_company(2, 3) // BOUNTY_TIER_MOST_WANTED + TEST_ASSERT_EQUAL(length(company), 2, "Two companions rolled as [length(company)]") + var/guns = 0 + for(var/j in 1 to length(company)) + var/list/member = company[j] + var/style = member["style"] // BOUNTY_COMPANY_STYLE + TEST_ASSERT_NOTNULL(GLOB.bounty_styles[style], "A companion rolled the style [style]") + if(bounty_style_is_gun(style)) + guns++ + TEST_ASSERT_EQUAL(j, 1, "The armed companion isn't first in the company") + members++ + var/list/chrome = member["chrome"] // BOUNTY_COMPANY_CHROME + if(!length(chrome)) + continue + chromed++ + TEST_ASSERT_EQUAL(length(chrome), 1, "A companion rolled [length(chrome)] pieces of chrome") + TEST_ASSERT(!(chrome[1] in list("lazarus", "piledriver")), "A companion rolled [chrome[1]]") // BOUNTY_CHROME_LAZARUS, BOUNTY_CHROME_PILEDRIVER + var/datum/bounty_chrome_piece/piece = GLOB.bounty_chrome_pieces[chrome[1]] + TEST_ASSERT(piece.can_roll(3, "companion", style, null, list()), "A [style] companion rolled [chrome[1]], which doesn't suit it") // BOUNTY_CHROME_COMPANION + TEST_ASSERT(guns <= 1, "A company rolled [guns] guns") + // A Most Wanted criminal's companion: 60 / 3 percent (BOUNTY_CHROME_CHANCE_MOST_WANTED / BOUNTY_CHROME_COMPANION_DIVISOR) + var/percent = chromed * 100 / members + TEST_ASSERT(percent >= 12 && percent <= 28, "A Most Wanted criminal's companions carry chrome [percent]% of the time, not about 20%") + // A Petty criminal's never roll the chrome that is Wanted or worse + for(var/i in 1 to 300) + var/list/petty_company = bounty_roll_company(1, 1) // BOUNTY_TIER_PETTY + var/list/member = petty_company[1] + for(var/key in member["chrome"]) + TEST_ASSERT(!(key in list("cascade", "redline")), "A Petty criminal's companion rolled [key]") // BOUNTY_CHROME_CASCADE, BOUNTY_CHROME_REDLINE + // The unarmed roll never gives a gun + for(var/i in 1 to 200) + TEST_ASSERT(!bounty_style_is_gun(bounty_roll_companion_style(no_gun = TRUE)), "The unarmed roll gave a gun") + + // Spawned by the criminal without a company: still at most one gun + var/mob/living/carbon/human/npc/bounty_criminal/normal/criminal = make_criminal(/mob/living/carbon/human/npc/bounty_criminal/normal, tile(2, 2), "brawler") // BOUNTY_STYLE_BRAWLER + for(var/i in 1 to 6) + var/list/gang = criminal.spawn_companions(2, TRUE) + var/guns = 0 + for(var/mob/living/carbon/human/npc/bounty_companion/member as anything in gang) + if(bounty_style_is_gun(member.ai_style)) + guns++ + TEST_ASSERT(guns <= 1, "A criminal's own company rolled [guns] guns") + QDEL_LIST(gang) + // One more joining a criminal with an armed companion carries no gun of its own + var/mob/living/carbon/human/npc/bounty_companion/gunner = make_companion(criminal, tile(1, 1), bounty_test_company_member("smg")) // BOUNTY_STYLE_SMG + TEST_ASSERT(bounty_company_armed(criminal), "A criminal with an SMG companion has no armed company") + for(var/i in 1 to 6) + var/mob/living/carbon/human/npc/bounty_companion/late = make_companion(criminal, tile(3, 1)) + TEST_ASSERT(!bounty_style_is_gun(late.ai_style), "A second companion rolled a [late.ai_style] beside an armed one") + allocated -= late + qdel(late) + allocated -= gunner + qdel(gunner) + +/** + * The posting's company is who comes: their styles, the weapons they carry, and their chrome, put in their + * bodies as real organs and driven by the chrome subtree; a companion the posting rolled no chrome for has + * none, and none is rolled for it as it is dressed. + */ +/datum/unit_test/voidcrew_bounty_companions/chrome + +/datum/unit_test/voidcrew_bounty_companions/chrome/Run() + var/mob/living/carbon/human/npc/bounty_criminal/normal/criminal = make_criminal(/mob/living/carbon/human/npc/bounty_criminal/normal, tile(2, 2), "brawler", 2) // BOUNTY_STYLE_BRAWLER, BOUNTY_TIER_WANTED + var/list/company = list( + bounty_test_company_member("pistol", list("deadeye")), // BOUNTY_STYLE_PISTOL, BOUNTY_CHROME_DEADEYE + bounty_test_company_member("knife"), // BOUNTY_STYLE_KNIFE + ) + var/list/buddies = criminal.spawn_companions(2, TRUE, company) + allocated += buddies + TEST_ASSERT_EQUAL(length(buddies), 2, "The company didn't spawn") + var/mob/living/carbon/human/npc/bounty_companion/shooter = buddies[1] + var/mob/living/carbon/human/npc/bounty_companion/blade = buddies[2] + TEST_ASSERT_EQUAL(shooter.ai_style, "pistol", "The first companion isn't the company's pistol") + TEST_ASSERT_EQUAL(blade.ai_style, "knife", "The second companion isn't the company's knife") + TEST_ASSERT_EQUAL(shooter.ai_controller.blackboard["bb_bounty_style"], "pistol", "The pistol companion fights in another style") // BB_BOUNTY_STYLE + TEST_ASSERT_NOTNULL(carried(shooter, /obj/item/gun/ballistic/automatic/pistol/aps), "The pistol companion carries no Stechkin") + TEST_ASSERT_NOTNULL(carried(blade, /obj/item/knife), "The knife companion carries no knife") + + // The pistol companion's Deadeye is a real organ in its eyes, and its chrome subtree has it + TEST_ASSERT(/obj/item/organ/eyes/robotic/cyberware/deadeye in chrome_in(shooter), "The pistol companion has no Deadeye link in its body") + TEST_ASSERT(length(shooter.ai_chrome) == 1 && shooter.ai_chrome[1] == "deadeye", "The pistol companion's chrome isn't the company's") // BOUNTY_CHROME_DEADEYE + var/datum/component/bounty_chrome/chrome = shooter.GetComponent(/datum/component/bounty_chrome) + TEST_ASSERT_NOTNULL(chrome, "The chromed companion's AI doesn't know its chrome") + TEST_ASSERT("deadeye" in chrome.keys, "The chromed companion's AI doesn't drive its Deadeye") + TEST_ASSERT(!length(chrome_in(blade)), "A companion the company rolled no chrome for carries some") + TEST_ASSERT_NULL(blade.GetComponent(/datum/component/bounty_chrome), "An unchromed companion has the chrome AI") + + // The companion's tree: up first, then its chrome, then its weapon + var/list/subtrees = shooter.ai_controller.planning_subtrees + var/getting_up = subtrees.Find(locate(/datum/ai_planning_subtree/bounty_companion_getting_up) in subtrees) + var/chrome_at = subtrees.Find(locate(/datum/ai_planning_subtree/bounty_chrome) in subtrees) + var/arm_at = subtrees.Find(locate(/datum/ai_planning_subtree/bounty_arm) in subtrees) + var/retaliate_at = subtrees.Find(locate(/datum/ai_planning_subtree/target_retaliate/bounty) in subtrees) + TEST_ASSERT(retaliate_at && getting_up && chrome_at && arm_at, "The companion's tree is missing its targeting, getting up, chrome or arming") + TEST_ASSERT(retaliate_at < getting_up && getting_up < chrome_at && chrome_at < arm_at, "The companion's tree isn't targeting, getting up, chrome, then arming") + + // Their chrome dies with them: scrap, as on every human NPC + shooter.death() + TEST_ASSERT(!(/obj/item/organ/eyes/robotic/cyberware/deadeye in chrome_in(shooter)), "A dead companion's Deadeye still works") + +/** + * Joining a fight, a companion gets up first: for a second (BOUNTY_COMPANION_DRAW_DELAY) nothing but + * facing the hunter is planned, so no weapon comes out and no blow or shot goes; then the arm subtree + * draws its gun with its line, as a criminal's does. Out of the fight and back in, it gets up again. + */ +/datum/unit_test/voidcrew_bounty_companions/draw_delay + +/datum/unit_test/voidcrew_bounty_companions/draw_delay/Run() + var/mob/living/carbon/human/npc/bounty_criminal/normal/criminal = make_criminal(/mob/living/carbon/human/npc/bounty_criminal/normal, tile(2, 2), "brawler") // BOUNTY_STYLE_BRAWLER + criminal.ai_controller.set_ai_status(AI_STATUS_OFF) + var/mob/living/carbon/human/npc/bounty_companion/buddy = make_companion(criminal, tile(1, 2), bounty_test_company_member("pistol")) // BOUNTY_STYLE_PISTOL + var/mob/living/carbon/human/hunter = make_companion_target(buddy, tile(4, 2)) + var/datum/ai_controller/controller = buddy.ai_controller + var/list/subtrees = controller.planning_subtrees + var/datum/ai_planning_subtree/getting_up = locate(/datum/ai_planning_subtree/bounty_companion_getting_up) in subtrees + var/datum/ai_planning_subtree/arm = locate(/datum/ai_planning_subtree/bounty_arm) in subtrees + var/datum/ai_behavior/draw = GET_AI_BEHAVIOR(/datum/ai_behavior/human_npc_draw/bounty) + + // Out of a fight, nothing holds them + TEST_ASSERT(!getting_up.SelectBehaviors(controller, 0.1), "A companion out of a fight is held getting up") + + // Rallied: in the fight, at a run, and getting up for a second + var/joined_at = world.time + buddy.ai_join_fight(hunter) + controller.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, hunter) + TEST_ASSERT(buddy.ai_in_fight, "Rallied, the companion didn't join the fight") + TEST_ASSERT(buddy.ai_draw_at >= joined_at + 10, "The companion may draw less than a second after joining the fight") // BOUNTY_COMPANION_DRAW_DELAY + TEST_ASSERT_EQUAL(getting_up.SelectBehaviors(controller, 0.1), 1, "Just in the fight, the companion's planning goes past getting up") // SUBTREE_RETURN_FINISH_PLANNING + var/obj/item/gun/stechkin = carried(buddy, /obj/item/gun/ballistic/automatic/pistol/aps) + TEST_ASSERT(!buddy.is_holding(stechkin), "The companion's pistol came out the moment they joined the fight") + + // Up: the arm subtree draws the pistol, with its line, holding the first shot as a criminal's draw does + buddy.ai_draw_at = world.time + TEST_ASSERT(!getting_up.SelectBehaviors(controller, 0.1), "Up again, the companion is still held getting up") + controller.planned_behaviors.Cut() + TEST_ASSERT_EQUAL(arm.SelectBehaviors(controller, 0.1), 1, "Up, the companion doesn't reach for its gun") // SUBTREE_RETURN_FINISH_PLANNING + TEST_ASSERT(controller.planned_behaviors[draw], "Up, the companion's arming didn't plan the draw") + TEST_ASSERT_EQUAL(controller.blackboard["human_npc_draw_item"], stechkin, "The companion reached for something other than its pistol") // BB_HUMAN_NPC_DRAW_ITEM + controller.CancelActions() + TEST_ASSERT_EQUAL(draw_gun(buddy), stechkin, "The companion didn't draw its pistol") + TEST_ASSERT(controller.blackboard["bb_bounty_windup_until"] >= world.time + 6, "The companion's draw doesn't hold its first shot") // BB_BOUNTY_WINDUP_UNTIL, BOUNTY_DRAW_TIME + + // Out of the fight and back in: up first again + buddy.ai_leave_fight() + TEST_ASSERT(!buddy.ai_in_fight && !buddy.ai_draw_at, "Out of the fight, the companion is still getting up") + buddy.ai_join_fight(hunter) + TEST_ASSERT_EQUAL(getting_up.SelectBehaviors(controller, 0.1), 1, "Back in the fight, the companion didn't get up first") // SUBTREE_RETURN_FINISH_PLANNING + controller.CancelActions() + +/** + * A companion's gun is backup: its Stechkin fires strings of three (BOUNTY_COMPANION_PISTOL_STRING), then the + * criminal's pause, and its WT-550 bursts of two (BOUNTY_COMPANION_SMG_BURST); a criminal's stay six and four. + */ +/datum/unit_test/voidcrew_bounty_companions/backup_fire + +/datum/unit_test/voidcrew_bounty_companions/backup_fire/Run() + var/mob/living/carbon/human/npc/bounty_criminal/normal/criminal = make_criminal(/mob/living/carbon/human/npc/bounty_criminal/normal, tile(2, 4), "brawler") // BOUNTY_STYLE_BRAWLER + criminal.ai_controller.set_ai_status(AI_STATUS_OFF) + var/datum/bounty_style/pistol = GLOB.bounty_styles["pistol"] // BOUNTY_STYLE_PISTOL + var/datum/bounty_style/smg = GLOB.bounty_styles["smg"] // BOUNTY_STYLE_SMG + var/datum/bounty_style/revolver = GLOB.bounty_styles["revolver"] // BOUNTY_STYLE_REVOLVER + + // The pistol: three shots half a second apart, then two seconds to the next string + var/mob/living/carbon/human/npc/bounty_companion/gunner = make_companion(criminal, tile(0, 2), bounty_test_company_member("pistol")) + var/mob/living/carbon/human/hunter = make_companion_target(gunner, tile(4, 2)) + TEST_ASSERT_EQUAL(pistol.string_length(gunner), 3, "A companion's pistol strings aren't three") + TEST_ASSERT_EQUAL(pistol.string_length(criminal), 6, "A criminal's pistol strings aren't six") // BOUNTY_PISTOL_STRING_SHOTS + TEST_ASSERT_EQUAL(revolver.string_length(gunner), 0, "A companion's revolver fires in strings") + var/obj/item/gun/ballistic/automatic/pistol/aps/stechkin = draw_gun(gunner) + var/datum/ai_controller/controller = gunner.ai_controller + controller.set_blackboard_key("bb_bounty_windup_until", world.time) // BB_BOUNTY_WINDUP_UNTIL + controller.set_blackboard_key("bb_bounty_next_shot", world.time) // BB_BOUNTY_NEXT_SHOT + var/full = bounty_gun_live_rounds(stechkin) + TEST_ASSERT(full >= 7, "Test fixture: the companion's Stechkin holds only [full]") + for(var/shot in 1 to 6) + shoot_step(gunner) + TEST_ASSERT_EQUAL(bounty_gun_live_rounds(stechkin), full - shot, "The companion's shot [shot] wasn't a single round") + var/wait = controller.blackboard["bb_bounty_next_shot"] - world.time // BB_BOUNTY_NEXT_SHOT + if(!(shot % 3)) + TEST_ASSERT_EQUAL(wait, 20, "After the companion's [shot]th shot, the next string isn't 2 seconds off") // BOUNTY_PISTOL_INTERVAL + BOUNTY_PISTOL_STRING_PAUSE + else + TEST_ASSERT_EQUAL(wait, 5, "The companion's shot [shot + 1] isn't half a second after shot [shot]") // BOUNTY_PISTOL_INTERVAL + next_pull(gunner, hunter) + if(shot == 3) + // The pause is waited out, not skipped: no new raise for the second string + controller.set_blackboard_key("bb_bounty_last_shot", world.time - 20) // BB_BOUNTY_LAST_SHOT + controller.set_blackboard_key("bb_bounty_drawn_at", world.time - 30) // BB_BOUNTY_DRAWN_AT + shoot_stopped(gunner) + allocated -= gunner + qdel(gunner) + + // The SMG: bursts of two pulls + var/mob/living/carbon/human/npc/bounty_companion/sprayer = make_companion(criminal, tile(0, 1), bounty_test_company_member("smg")) + var/mob/living/carbon/human/mark = make_companion_target(sprayer, tile(4, 1)) + TEST_ASSERT_EQUAL(smg.burst_length(sprayer), 2, "A companion's SMG bursts aren't two") + TEST_ASSERT_EQUAL(smg.burst_length(criminal), 4, "A criminal's SMG bursts aren't four") // BOUNTY_SMG_BURST + TEST_ASSERT_EQUAL(pistol.burst_length(sprayer), 1, "A companion's pistol fires bursts") + var/obj/item/gun/ballistic/automatic/wt550/wt550 = sprayer.belt + TEST_ASSERT(istype(wt550), "Test fixture: the SMG companion has no WT-550 on its belt") + TEST_ASSERT(human_npc_take_in_hand(sprayer, wt550), "The companion's WT-550 can't be drawn") + var/datum/ai_controller/smg_ai = sprayer.ai_controller + var/rounds = start_burst(sprayer, mark, wt550) + TEST_ASSERT_EQUAL(smg_ai.blackboard["bb_bounty_burst_left"], 1, "A companion's burst doesn't have one pull left after the first") // BB_BOUNTY_BURST_LEFT + shoot_step(sprayer) + TEST_ASSERT_EQUAL(bounty_gun_live_rounds(wt550), rounds - 1, "The companion's second pull didn't fire") + TEST_ASSERT_NULL(smg_ai.blackboard["bb_bounty_burst_left"], "A companion's burst didn't end after two pulls") // BB_BOUNTY_BURST_LEFT + TEST_ASSERT_EQUAL(smg_ai.blackboard["bb_bounty_next_shot"], world.time + 5, "After a companion's burst, the next one isn't half a second off") // BOUNTY_SMG_INTERVAL + shoot_stopped(sprayer) + allocated -= sprayer + qdel(sprayer) + +// ===== THE POSTING'S COMPANY ===== + +/** + * The company is rolled with the posting's site and named on the sighting: the card, the hunt notice and + * the warrant say who they were seen with, at most one of them armed. Nobody comes with a meek criminal, + * a mini-boss or at a trader outpost, one at most aboard a pirate ship; the same company stays while the + * bounty is at a site, a new site rolls a new one, and that company is who spawns beside the criminal. + */ +/datum/unit_test/voidcrew_bounty_company_card + parent_type = /datum/unit_test/voidcrew_bounty_board + +/datum/unit_test/voidcrew_bounty_company_card/Run() + var/datum/criminal_bounty/posting = board_test_posting(archetype = "normal") // BOUNTY_ARCHETYPE_NORMAL + // What the sighting says + posting.board_company = list(bounty_test_company_member("brawler")) // BOUNTY_STYLE_* + TEST_ASSERT_EQUAL(posting.board_company_text(), "with a friend", "One unarmed companion") + posting.board_company = list(bounty_test_company_member("pistol")) + TEST_ASSERT_EQUAL(posting.board_company_text(), "with an armed friend", "One armed companion") + posting.board_company = list(bounty_test_company_member("knife"), bounty_test_company_member("club")) + TEST_ASSERT_EQUAL(posting.board_company_text(), "with two friends", "Two unarmed companions") + posting.board_company = list(bounty_test_company_member("smg"), bounty_test_company_member("bottle")) + TEST_ASSERT_EQUAL(posting.board_company_text(), "with two friends, one armed", "Two companions, one armed") + TEST_ASSERT_EQUAL(posting.board_sighting_text(), "[posting.board_place_text()] with two friends, one armed", "The sighting doesn't name the company after the place") + var/obj/structure/overmap/ship/board_test_listener/ship = board_test_listener() + var/list/entry = posting.board_ui_entry(ship, null) + TEST_ASSERT_EQUAL(entry["place"], posting.board_sighting_text(), "The card doesn't name the company") + TEST_ASSERT(findtext(posting.board_warrant_text(), "With two friends, one armed."), "The warrant doesn't name the company") + TEST_ASSERT_EQUAL(posting.hunt(ship), TRUE, "The ship could not hunt the bounty") + TEST_ASSERT(ship.board_test_heard("WANTED: now hunting [posting.record.name]. [posting.board_sighting_text()]."), "The hunt notice doesn't name the company") + // Relisting, the company isn't known + posting.board_relisting = TRUE + TEST_ASSERT_NULL(posting.board_company_text(), "A relisting bounty names its company") + posting.board_relisting = FALSE + posting.board_company = list() + TEST_ASSERT_NULL(posting.board_company_text(), "A criminal on their own is seen with someone") + TEST_ASSERT_EQUAL(posting.board_sighting_text(), posting.board_place_text(), "A criminal on their own isn't seen just where they are") + + // The roll for where they are: at most two, one aboard a pirate ship, none at a trader outpost or with another kind of criminal + for(var/i in 1 to 50) + var/list/rolled = posting.board_roll_company() + TEST_ASSERT(length(rolled) <= 2, "A planet criminal rolled [length(rolled)] companions") // BOUNTY_MAX_COMPANIONS + var/guns = 0 + for(var/list/member as anything in rolled) + if(bounty_style_is_gun(member["style"])) + guns++ + TEST_ASSERT(guns <= 1, "A posting's company rolled [guns] guns") + posting.placement_kind = "npc_ship" // BOUNTY_PLACEMENT_NPC_SHIP + for(var/i in 1 to 50) + TEST_ASSERT(length(posting.board_roll_company()) <= 1, "A criminal aboard a pirate ship rolled more than one companion") + posting.placement_kind = "trader_outpost" // BOUNTY_PLACEMENT_TRADER_OUTPOST + TEST_ASSERT(!length(posting.board_roll_company()), "A trader-outpost fugitive rolled companions") + posting.placement_kind = "planet" // BOUNTY_PLACEMENT_PLANET + var/datum/criminal_bounty/runner = board_test_posting() // a meek criminal + var/datum/criminal_bounty/heavy = board_test_posting(tier = 3, archetype = "boss") // BOUNTY_TIER_MOST_WANTED, BOUNTY_ARCHETYPE_BOSS + for(var/i in 1 to 20) + TEST_ASSERT(!length(runner.board_roll_company()), "A meek criminal rolled companions") + TEST_ASSERT(!length(heavy.board_roll_company()), "A mini-boss rolled companions") + TEST_ASSERT_NULL(runner.board_company_text(), "A meek criminal is seen with someone") + + // Kept at its site, and rolled again for a new one + var/obj/structure/overmap/ship/first_site = board_test_ship() + var/obj/structure/overmap/ship/second_site = board_test_ship() + posting.site_ref = WEAKREF(first_site) + var/list/kept = posting.board_company() + TEST_ASSERT(posting.board_company() == kept, "The company changed while the bounty stayed at its site") + posting.site_ref = WEAKREF(second_site) + TEST_ASSERT(posting.board_company() != kept, "A new site didn't roll a new company") + posting.site_ref = null + + // The company the posting rolled is who spawns, through the human NPC queue + var/datum/criminal_bounty/gang_posting = board_test_posting(archetype = "normal") // BOUNTY_ARCHETYPE_NORMAL + var/mob/living/carbon/human/npc/bounty_criminal/criminal = spawn_bounty_criminal(gang_posting.record, run_loc_floor_bottom_left, gang_posting) + TEST_ASSERT_NOTNULL(criminal, "Test fixture: no criminal") + allocated += criminal + criminal.ai_controller.set_ai_status(AI_STATUS_OFF) + gang_posting.criminal_ref = WEAKREF(criminal) + criminal.posting_ref = WEAKREF(gang_posting) + gang_posting.board_company = list(bounty_test_company_member("revolver", list("deadeye")), bounty_test_company_member("club")) // BOUNTY_STYLE_REVOLVER, BOUNTY_CHROME_DEADEYE, BOUNTY_STYLE_CLUB + gang_posting.board_spawn_companions(criminal) + // Queued for the human NPC queue: built here and now, as the queue would build them (a test room has no zone to wait for) + var/list/datum/human_npc_order/orders = list() + for(var/datum/human_npc_order/order as anything in SShuman_npcs.queue) + var/datum/npc_spawn_context/bounty_company/context = order.context + if(istype(context) && context.company_leader_ref?.resolve() == criminal) + orders += order + TEST_ASSERT_EQUAL(length(orders), 2, "The posting queued [length(orders)] companions, not its company of two") + for(var/datum/human_npc_order/order as anything in orders) + order.fulfil() + qdel(order) + var/list/buddies = criminal.ai_companions() + allocated += buddies + TEST_ASSERT_EQUAL(length(buddies), 2, "The posting's company didn't spawn") + var/list/styles = list() + for(var/mob/living/carbon/human/npc/bounty_companion/buddy as anything in buddies) + buddy.ai_controller.set_ai_status(AI_STATUS_OFF) + styles += buddy.ai_style + TEST_ASSERT(WEAKREF(buddy) in gang_posting.companions, "A spawned companion isn't on the posting's list") + var/has_deadeye = !!buddy.get_organ_by_type(/obj/item/organ/eyes/robotic/cyberware/deadeye) + TEST_ASSERT_EQUAL(has_deadeye, buddy.ai_style == "revolver", "The [buddy.ai_style] companion's chrome isn't the company's") + TEST_ASSERT(("revolver" in styles) && ("club" in styles), "The company spawned as [jointext(styles, ", ")], not the revolver and the club") diff --git a/voidcrew/modules/unit_tests/voidcrew_bounty_cyberpsycho.dm b/voidcrew/modules/unit_tests/voidcrew_bounty_cyberpsycho.dm new file mode 100644 index 00000000000..e768780547a --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_bounty_cyberpsycho.dm @@ -0,0 +1,423 @@ +/** + * The cyberpsycho (voidcrew/modules/bounties/chrome/bounty_cyberpsycho.dm): where it sits among the kits, + * its chrome (the real implants, every one that fits, nothing browned out), its rotation, its Redline phase + * two against damage and against stamina weapons, Lazarus, an EMP, death, and the Bounty Panel. + * + * Real human NPCs with the real implants in them; the tests read tg's own state. The AI is switched off, + * so the tests drive the boss's procs and nothing else happens in between; timers run as they would. Fork + * defines are included after the tests, so a test uses the literal value with a comment naming the define. + * The test room is 5x5. + * + * Renders: compile with -DBOUNTY_CHROME_RENDERS and the renders test writes flat icons to + * data/bounty_chrome_renders/ (cyberpsycho__
    .png). + */ +/datum/unit_test/voidcrew_bounty_cyberpsycho + abstract_type = /datum/unit_test/voidcrew_bounty_cyberpsycho + +/// The floor tile `dx`, `dy` from the room's bottom left +/datum/unit_test/voidcrew_bounty_cyberpsycho/proc/tile(dx, dy) + return locate(run_loc_floor_bottom_left.x + dx, run_loc_floor_bottom_left.y + dy, run_loc_floor_bottom_left.z) + +/// A hunter at `where`: a human with a mind, as a player would be +/datum/unit_test/voidcrew_bounty_cyberpsycho/proc/hunter_at(turf/where) + var/mob/living/carbon/human/consistent/hunter = allocate(/mob/living/carbon/human/consistent, where) + hunter.mind_initialize() + return hunter + +/// A Most Wanted cyberpsycho's record, of `species` +/datum/unit_test/voidcrew_bounty_cyberpsycho/proc/psycho_record(species = /datum/species/human) + var/datum/bounty_record/record = generate_bounty_record(3, "boss", "planet", species) // BOUNTY_TIER_MOST_WANTED, BOUNTY_ARCHETYPE_BOSS, BOUNTY_PLACEMENT_PLANET + record.kit = "cyberpsycho" // BOUNTY_KIT_CYBERPSYCHO + record.chrome = null + return record + +/// A cyberpsycho at `where`, spawned as the board spawns one, its AI off; with `hunter`, turned on them (on its grudge list, in its posse, its target) +/datum/unit_test/voidcrew_bounty_cyberpsycho/proc/psycho_at(turf/where, mob/living/hunter) + var/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/psycho = spawn_bounty_criminal(psycho_record(), where, null) + if(!psycho) + return null + allocated += psycho + psycho.ai_controller?.set_ai_status(AI_STATUS_OFF) + if(hunter) + psycho.body_add_grudge(hunter) + psycho.boss_turn_hostile(hunter) + psycho.ai_controller?.set_blackboard_key(BB_BASIC_MOB_CURRENT_TARGET, hunter) + var/datum/component/bounty_chrome/chrome = psycho.GetComponent(/datum/component/bounty_chrome) + chrome?.update_fight() + return psycho + +/// The organ types of the chrome in `body` +/datum/unit_test/voidcrew_bounty_cyberpsycho/proc/chrome_in(mob/living/carbon/body) + . = list() + for(var/obj/item/organ/organ in body.organs) + if(organ.GetComponent(/datum/component/cyberware)) + . += organ.type + +/// Its ability running `move_type`, if it has one +/datum/unit_test/voidcrew_bounty_cyberpsycho/proc/ability_for(mob/living/carbon/human/npc/bounty_criminal/boss/boss, move_type) + for(var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/ability in boss.boss_abilities) + if(istype(ability.move, move_type)) + return ability + return null + +/// Ready for another move straight away: no gap, no ability cooldowns, hands free to click +/datum/unit_test/voidcrew_bounty_cyberpsycho/proc/ready(mob/living/carbon/human/npc/bounty_criminal/boss/boss) + boss.boss_next_ability_at = 0 + boss.next_move = 0 + boss.next_click = 0 + for(var/datum/action/cooldown/ability as anything in boss.boss_abilities) + ability.next_use_time = 0 + +/// Puts out its blade, as its chrome does on a Life tick in its fight +/datum/unit_test/voidcrew_bounty_cyberpsycho/proc/blade_out(mob/living/carbon/human/npc/bounty_criminal/boss/boss, atom/target) + var/datum/component/bounty_chrome/chrome = boss.GetComponent(/datum/component/bounty_chrome) + var/datum/bounty_chrome_move/mantis_blades/blades = chrome?.move_of(/datum/bounty_chrome_move/mantis_blades) + blades?.on_tick(2, TRUE, target) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/housing = locate() in boss.organs + return housing?.blade_extended() + +// ===== WHERE IT SITS ===== + +/** + * Where it sits: a kit like the others, the rarest; its record rolls no chrome on top (its kit is its + * chrome); its card's lines, its alias, the Bounty Panel's kit list and its prison riot move are a kit's. + */ +/datum/unit_test/voidcrew_bounty_cyberpsycho/kit + +/datum/unit_test/voidcrew_bounty_cyberpsycho/kit/Run() + var/list/counts = list() + for(var/i in 1 to 2000) + var/kit = bounty_roll_kit() + counts[kit] = (counts[kit] || 0) + 1 + TEST_ASSERT(counts["cyberpsycho"] > 0, "The cyberpsycho never rolled as a kit") + for(var/kit in list("juggernaut", "pyromaniac", "demolitionist", "ghost", "heavy")) // BOUNTY_KIT_* + TEST_ASSERT(counts["cyberpsycho"] < counts[kit], "The cyberpsycho ([counts["cyberpsycho"]]) rolled as often as the [kit] ([counts[kit]])") + var/datum/bounty_record/record = psycho_record() + TEST_ASSERT_EQUAL(bounty_criminal_type(record, null), /mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho, "A cyberpsycho record spawns the wrong type") + TEST_ASSERT_EQUAL(bounty_boss_move_type(record), /datum/prison_boss_move/charge, "A caught cyberpsycho's riot move is [bounty_boss_move_type(record)]") + for(var/i in 1 to 100) + TEST_ASSERT_NULL(bounty_chrome_roll(3, "boss", null, "cyberpsycho", bounty_chrome_kit_organs("cyberpsycho")), "A cyberpsycho's record rolled chrome on top of its own") + var/list/lines = bounty_identity_strings("lines") + for(var/context in list("intro", "ability", "redline", "exhausted", "posse", "cover")) + TEST_ASSERT(length(lines["cyberpsycho_[context]"]?["any"]) >= 6, "The cyberpsycho has fewer than 6 [context] lines") + var/list/aliases = bounty_identity_strings("aliases") + TEST_ASSERT(length(aliases["cyberpsycho"]) >= 5, "The cyberpsycho has too few aliases") + var/datum/bounty_admin_panel/panel = allocate(/datum/bounty_admin_panel, null) + TEST_ASSERT_EQUAL(panel.kit_choices()["Cyberpsycho"], "cyberpsycho", "The Bounty Panel doesn't offer the cyberpsycho") + +// ===== ITS CHROME ===== + +/** + * Its chrome: the six real implants that fit one body, Cascade left out for Redline's operating-system slot, + * Mantis in the right arm and Gorilla in the left; the kit's chrome as the rolls know it; its load over a + * body's 20 with its Redline core carrying the Governor's 15 of capacity through the real hook, so nothing + * browns out. Its rotation is the burn, the lunge, the leap and the piston punch, each told for at least + * 0.8 s. It dresses to show the chrome, and seals up like any mini-boss in the void. + */ +/datum/unit_test/voidcrew_bounty_cyberpsycho/chrome + +/datum/unit_test/voidcrew_bounty_cyberpsycho/chrome/Run() + var/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/psycho = psycho_at(tile(2, 2)) + TEST_ASSERT(istype(psycho), "No cyberpsycho spawned") + TEST_ASSERT_EQUAL(psycho.boss_kit, "cyberpsycho", "The cyberpsycho has the kit [psycho.boss_kit]") + var/list/carried = chrome_in(psycho) + var/list/expected = list( + /obj/item/organ/cyberimp/cyberware/redline, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis, + /obj/item/organ/cyberimp/cyberware/gorilla_arms/left, + /obj/item/organ/cyberimp/cyberware/piledriver, + /obj/item/organ/cyberimp/cyberware/lazarus, + /obj/item/organ/eyes/robotic/cyberware/deadeye, + ) + TEST_ASSERT_EQUAL(length(carried), length(expected), "The cyberpsycho carries [length(carried)] pieces of chrome: [jointext(carried, ", ")]") + for(var/organ_type in expected) + TEST_ASSERT(organ_type in carried, "The cyberpsycho doesn't carry [organ_type]") + var/list/known = bounty_chrome_kit_organs("cyberpsycho") + TEST_ASSERT_EQUAL(length(known), length(carried), "The rolls know of [length(known)] of its pieces") + for(var/organ_type in known) + TEST_ASSERT(organ_type in carried, "The rolls fit around [organ_type], which the cyberpsycho doesn't carry") + TEST_ASSERT_NULL(locate(/obj/item/organ/cyberimp/cyberware/cascade) in psycho.organs, "The cyberpsycho has a Cascade lattice beside its Redline core") + TEST_ASSERT_NULL(psycho.record.chrome, "The cyberpsycho's record lists rolled chrome") + TEST_ASSERT_NULL(locate(/obj/item/organ/eyes) in get_turf(psycho), "The eyes it was born with lie on the floor") + + // The real capacity: 32 load in a body that holds 35, its Redline core carrying the extra + TEST_ASSERT_EQUAL(get_chrome_load(psycho), 32, "The cyberpsycho's chrome loads it [get_chrome_load(psycho)]") + TEST_ASSERT_EQUAL(get_chrome_capacity(psycho), 35, "The cyberpsycho's body holds [get_chrome_capacity(psycho)]") // CYBERWARE_BASE_CAPACITY + BOUNTY_PSYCHO_EXTRA_CAPACITY + var/obj/item/organ/core = locate(/obj/item/organ/cyberimp/cyberware/redline) in psycho.organs + var/datum/component/cyberware/core_ware = core?.GetComponent(/datum/component/cyberware) + TEST_ASSERT_EQUAL(core_ware?.capacity_bonus, 15, "Its Redline core doesn't carry the Governor's capacity") // BOUNTY_PSYCHO_EXTRA_CAPACITY + for(var/obj/item/organ/organ in psycho.organs) + var/datum/component/cyberware/ware = organ.GetComponent(/datum/component/cyberware) + if(!ware) + continue + TEST_ASSERT(!ware.browned_out, "The cyberpsycho's [organ] browned out") + TEST_ASSERT(ware.is_running(), "The cyberpsycho's [organ] isn't running") + + // Its chrome AI, and its rotation: four moves, all told + var/datum/component/bounty_chrome/chrome = psycho.GetComponent(/datum/component/bounty_chrome) + TEST_ASSERT_NOTNULL(chrome, "The cyberpsycho has no chrome AI") + for(var/key in list("redline", "mantis", "gorilla", "piledriver", "lazarus", "deadeye")) // BOUNTY_CHROME_* + TEST_ASSERT(key in chrome.keys, "The cyberpsycho's chrome AI doesn't know its [key]") + var/list/moves = list( + /datum/bounty_chrome_move/redline, + /datum/bounty_chrome_move/mantis_lunge, + /datum/bounty_chrome_move/piledriver, + /datum/bounty_chrome_move/gorilla_punch/psycho, + ) + TEST_ASSERT_EQUAL(length(psycho.boss_abilities), length(moves), "The cyberpsycho has [length(psycho.boss_abilities)] abilities, not its four moves") + for(var/move_type in moves) + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/ability = ability_for(psycho, move_type) + TEST_ASSERT_NOTNULL(ability, "The cyberpsycho's [move_type] isn't in its rotation") + TEST_ASSERT(ability?.windup >= 0.8 SECONDS, "The cyberpsycho's [move_type] tells for [ability?.windup / 10] s") // BOUNTY_CHROME_TELL_MIN + TEST_ASSERT(!length(ability?.move?.tell_lines), "The cyberpsycho's [move_type] has its own lines besides the cyberpsycho's") + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/burn = ability_for(psycho, /datum/bounty_chrome_move/redline) + TEST_ASSERT(istype(burn?.move, /datum/bounty_chrome_move/redline/psycho), "Its Redline isn't its phase two: [burn?.move?.type]") + var/count = 0 + for(var/datum/bounty_chrome_move/redline/move in chrome.moves) + count++ + TEST_ASSERT_EQUAL(count, 1, "It has [count] Redline moves, not its own one") + + // Dressed to show it: shorts and boots, nothing on its arms or chest + TEST_ASSERT(psycho.bounty_dresses_to_show_chrome(), "The cyberpsycho dresses to hide its chrome") + TEST_ASSERT(istype(psycho.w_uniform, /obj/item/clothing/under/shorts), "The cyberpsycho wears [psycho.w_uniform] over its legs") + TEST_ASSERT_NULL(psycho.wear_suit, "The cyberpsycho wears [psycho.wear_suit] over its chrome") + TEST_ASSERT_NULL(psycho.gloves, "The cyberpsycho wears gloves over its arms") + TEST_ASSERT(psycho.boss_gear_text(), "The cyberpsycho has no gear line on examine") + // Its two stimulants and a bruise pack, as every mini-boss, where it can reach them; no bag over its spine rig + TEST_ASSERT_EQUAL(length(psycho.get_all_contents_type(/obj/item/reagent_containers/hypospray/medipen/stimpack)) - length(psycho.get_all_contents_type(/obj/item/reagent_containers/hypospray/medipen/stimpack/traitor)), 2, "The cyberpsycho doesn't carry its two stimulants") // BOUNTY_BOSS_STIMULANTS + // Its combat stimpack rides in a pocket, the bum bag being full (BOUNTY_BOSS_COMBAT_STIMULANT) + var/obj/item/combat_pen = locate(/obj/item/reagent_containers/hypospray/medipen/stimpack/traitor) in list(psycho.l_store, psycho.r_store) + TEST_ASSERT_NOTNULL(combat_pen, "The cyberpsycho has no combat stimpack in a pocket") + TEST_ASSERT_EQUAL(length(psycho.get_all_contents_type(/obj/item/reagent_containers/hypospray/medipen/stimpack/traitor)), 1, "The cyberpsycho doesn't carry one combat stimpack") + TEST_ASSERT(human_npc_gear_consumable(combat_pen), "The cyberpsycho's combat stimpack isn't issued to it") + TEST_ASSERT(length(psycho.get_all_contents_type(/obj/item/stack/medical/bruise_pack)), "The cyberpsycho carries nothing to patch itself up with") + TEST_ASSERT_NOTNULL(bounty_ai_find_injector(psycho, /obj/item/reagent_containers/hypospray/medipen/stimpack), "The cyberpsycho can't reach its stimulants") + TEST_ASSERT_NULL(psycho.back, "The cyberpsycho wears [psycho.back] over its spine rig") + // In the void, a civilian MODsuit: it wears no armour in good air either + var/list/gear = bounty_vacuum_gear(psycho) + TEST_ASSERT(length(gear) == 1 && gear[1] == /obj/item/mod/control/pre_equipped/bounty_boss/civilian, "The cyberpsycho's void suit isn't a civilian MODsuit: [jointext(gear, ", ")]") + + // Dead, its chrome burns out to scrap, all six pieces + var/turf/here = get_turf(psycho) + psycho.death() + TEST_ASSERT_EQUAL(length(chrome_in(psycho)), 0, "A dead cyberpsycho still carries working chrome") + var/scrap = 0 + for(var/obj/item/burnt_chrome/burnt in here) + scrap++ + TEST_ASSERT_EQUAL(scrap, 6, "A dead cyberpsycho's six implants left [scrap] pieces of scrap") + +// ===== ONE MOVE AT A TIME ===== + +/** + * The blade comes out of its right forearm in a fight and is its melee; its left hand, the Gorilla fist, + * stays empty, so it can punch through glass (C5). The piston punch is a told move: the arm's own punch + * lands only after the tell. While one move winds up, no other starts. + */ +/datum/unit_test/voidcrew_bounty_cyberpsycho/rotation + +/datum/unit_test/voidcrew_bounty_cyberpsycho/rotation/Run() + var/mob/living/carbon/human/hunter = hunter_at(tile(3, 2)) + var/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/psycho = psycho_at(tile(2, 2), hunter) + TEST_ASSERT(istype(psycho), "No cyberpsycho spawned") + TEST_ASSERT(psycho.boss_hostile, "The cyberpsycho didn't turn on the hunter") + TEST_ASSERT(blade_out(psycho, hunter), "The cyberpsycho's blade didn't come out in its fight") + var/obj/item/blade = psycho.get_item_for_held_index(RIGHT_HANDS) + TEST_ASSERT(istype(blade, /obj/item/melee/energy/blade/hardlight/cyberware_mantis), "The blade isn't in its right hand: [blade]") + TEST_ASSERT_NULL(psycho.get_item_for_held_index(LEFT_HANDS), "Its Gorilla hand holds [psycho.get_item_for_held_index(LEFT_HANDS)]") + TEST_ASSERT_EQUAL(human_npc_held_melee_weapon(psycho), blade, "Its melee isn't its blade") + TEST_ASSERT(psycho.boss_has_gorilla_fist(), "It has no Gorilla fist free to punch through glass with") + + // The piston punch, through its rotation: the tell, then the arm's own punch + ready(psycho) + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/punch = ability_for(psycho, /datum/bounty_chrome_move/gorilla_punch/psycho) + TEST_ASSERT(punch.worth_using(hunter), "The piston punch isn't worth using on a hunter beside it") + TEST_ASSERT(punch.Trigger(target = hunter), "The piston punch wouldn't start") + TEST_ASSERT_EQUAL(psycho.boss_busy, "windup", "The piston punch doesn't wind up") + TEST_ASSERT_NOTNULL(psycho.get_filter(punch.move.tell_filter()), "The piston punch's tell has no outline") + // One at a time: nothing else starts while it winds up + for(var/datum/action/cooldown/mob_cooldown/bounty_boss/ability as anything in psycho.boss_abilities) + ability.next_use_time = 0 + TEST_ASSERT_NULL(psycho.boss_choose_ability(hunter), "Another move would start while the piston punch winds up") + TEST_ASSERT_EQUAL(hunter.getBruteLoss(), 0, "The punch landed before its tell") + sleep(1 SECONDS) + TEST_ASSERT(hunter.getBruteLoss() >= 15, "The piston punch did [hunter.getBruteLoss()] brute, not the implant's") // CYBERWARE_GORILLA_PUNCH_DAMAGE + var/obj/item/organ/cyberimp/cyberware/gorilla_arms/arm = locate() in psycho.organs + TEST_ASSERT(!bounty_gorilla_loaded(arm), "The punch wasn't the Gorilla arm's own") + TEST_ASSERT_NULL(psycho.boss_busy, "Still busy after the punch") + TEST_ASSERT(world.time < psycho.boss_next_ability_at, "No gap after the punch before its next move") + +// ===== ITS PHASE TWO ===== + +/** + * A stamina weapon is answered with its Redline: one disabler bolt's worth and, a moment later, the burn's + * tell starts, cutting short whatever it was winding up. It doesn't wear out while its phase two is to + * come. After the tell, the implant's burn: stun-proof, so more stamina doesn't floor it, and still not worn + * out; then the crash floors it in stamina crit, the capture. Once: it never burns again. + */ +/datum/unit_test/voidcrew_bounty_cyberpsycho/burn_stamina + +/datum/unit_test/voidcrew_bounty_cyberpsycho/burn_stamina/Run() + var/mob/living/carbon/human/hunter = hunter_at(tile(4, 2)) + var/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/psycho = psycho_at(tile(1, 2), hunter) + TEST_ASSERT(istype(psycho), "No cyberpsycho spawned") + TEST_ASSERT(blade_out(psycho, hunter), "The cyberpsycho's blade didn't come out") + ready(psycho) + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/burn = ability_for(psycho, /datum/bounty_chrome_move/redline) + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/lunge = ability_for(psycho, /datum/bounty_chrome_move/mantis_lunge) + TEST_ASSERT(!burn.worth_using(hunter), "An unhurt cyberpsycho reaches for its Redline") + // Winding up a lunge when the bolt lands + TEST_ASSERT(lunge.worth_using(hunter), "The lunge isn't worth using on a hunter three tiles off") + TEST_ASSERT(lunge.Trigger(target = hunter), "The lunge wouldn't start") + TEST_ASSERT_EQUAL(psycho.boss_winding(), lunge, "The lunge isn't winding up") + psycho.apply_damage(30, STAMINA) // a disabler bolt + TEST_ASSERT(!psycho.boss_is_worn_out(), "One bolt wore it out") + sleep(0.2 SECONDS) + TEST_ASSERT_EQUAL(psycho.boss_winding(), burn, "A stamina hit didn't start its Redline's tell") + TEST_ASSERT(!lunge.pending_serial, "The lunge it was winding up still goes") + psycho.adjustStaminaLoss(30) + TEST_ASSERT(!psycho.boss_is_worn_out(), "Winded with its phase two to come, it wears out instead of burning") + TEST_ASSERT_NULL(psycho.has_status_effect(/datum/status_effect/cyberware_redline_window), "The burn started before its tell was over") + sleep(1.1 SECONDS) + + // The implant's own burn + TEST_ASSERT_NOTNULL(psycho.has_status_effect(/datum/status_effect/cyberware_redline_window), "The tell ended but the implant's burn didn't start") + TEST_ASSERT(psycho.psycho_burned, "Its phase two isn't spent") + TEST_ASSERT(HAS_TRAIT(psycho, TRAIT_STUNIMMUNE), "The burn gives no stun immunity") + psycho.apply_damage(60, STAMINA) + TEST_ASSERT_NULL(psycho.has_status_effect(/datum/status_effect/incapacitating/stamcrit), "Stamina floored it in the burn") + TEST_ASSERT(!psycho.boss_is_worn_out(), "It wears out in the burn") + TEST_ASSERT(!burn.worth_using(hunter), "It would burn again while burning") + + // The crash: stamina crit, the capture + sleep(12.4 SECONDS) + TEST_ASSERT_NULL(psycho.has_status_effect(/datum/status_effect/cyberware_redline_window), "The burn outlasted the implant's 12 seconds") + TEST_ASSERT_NOTNULL(psycho.has_status_effect(/datum/status_effect/incapacitating/stamcrit), "The crash didn't floor it in stamina crit") + TEST_ASSERT_EQUAL(psycho.capture_state(), "stunned", "The crash isn't a stunned capture") // BOUNTY_STATE_STUNNED + // Once a spawn: back on its feet and winded again, no second burn, and now it tires like any mini-boss + psycho.remove_status_effect(/datum/status_effect/incapacitating/stamcrit) + psycho.setStaminaLoss(70) + burn.next_use_time = 0 + TEST_ASSERT(!burn.worth_using(hunter), "It would burn its Redline a second time") + TEST_ASSERT(psycho.boss_is_worn_out(), "With its phase two spent, it doesn't tire") + +/** + * Damage sets it off too: hurt to three quarters of its health, it burns. Not with someone outside its + * fight in the roar's reach (the bystander gate). An EMP in the tell fires nothing and takes its core + * down, sparking; with its core down it tires like any mini-boss. + */ +/datum/unit_test/voidcrew_bounty_cyberpsycho/burn_hurt + +/datum/unit_test/voidcrew_bounty_cyberpsycho/burn_hurt/Run() + var/mob/living/carbon/human/hunter = hunter_at(tile(4, 2)) + var/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/psycho = psycho_at(tile(1, 2), hunter) + TEST_ASSERT(istype(psycho), "No cyberpsycho spawned") + ready(psycho) + var/datum/action/cooldown/mob_cooldown/bounty_boss/chrome/burn = ability_for(psycho, /datum/bounty_chrome_move/redline) + // A bystander in the roar's reach keeps it shut + var/mob/living/carbon/human/bystander = hunter_at(tile(1, 4)) + psycho.adjustBruteLoss(30) + TEST_ASSERT(psycho.psycho_hurt_enough(), "Hurt to [psycho.health] doesn't count") + TEST_ASSERT(!burn.worth_using(hunter), "It burns with a bystander in the roar's reach") + qdel(bystander) + TEST_ASSERT(burn.worth_using(hunter), "Hurt to [psycho.health] in its fight, it won't burn") + // Its own companion beside it doesn't keep it shut: a crew of hunters brings those in (C0's gate would) + var/datum/human_npc_order/order = bounty_spawn_companion(psycho, tile(1, 3), null, TRUE, bounty_test_company_member("brawler", null)) // BOUNTY_STYLE_BRAWLER + var/mob/living/carbon/human/npc/bounty_companion/buddy = order?.spawned_ref?.resolve() + qdel(order) + TEST_ASSERT_NOTNULL(buddy, "Test fixture: no companion was made") + allocated += buddy + buddy.ai_controller?.set_ai_status(AI_STATUS_OFF) + TEST_ASSERT(bounty_ai_same_gang(psycho, buddy), "Test fixture: the companion isn't on its side") + var/datum/bounty_chrome_move/redline/move = burn.move + TEST_ASSERT(!bounty_chrome_area_clear(psycho, move.area_turfs(hunter), hunter), "Test fixture: C0's gate lets the roar go over its own companion") + TEST_ASSERT(burn.worth_using(hunter), "Its own companion beside it keeps its phase two shut") + TEST_ASSERT_EQUAL(psycho.boss_choose_ability(hunter), burn, "Its rotation doesn't put its phase two first") + TEST_ASSERT(psycho.psycho_burn_now(), "The burn's tell didn't start") + TEST_ASSERT_EQUAL(psycho.boss_winding(), burn, "The burn isn't winding up") + + // An EMP in the tell: nothing fires, its chrome sparks and reboots, and now it tires + psycho.emp_act(EMP_HEAVY) + TEST_ASSERT_NULL(psycho.boss_winding(), "An EMP didn't cut the burn's tell short") + sleep(1.2 SECONDS) + TEST_ASSERT_NULL(psycho.has_status_effect(/datum/status_effect/cyberware_redline_window), "It burned through an EMP in the tell") + TEST_ASSERT(!psycho.psycho_burned, "An EMP'd tell spent its phase two") + TEST_ASSERT_NOTNULL(psycho.has_status_effect(/datum/status_effect/bounty_chrome_malfunction), "Its chrome doesn't spark after the EMP") + var/obj/item/organ/core = locate(/obj/item/organ/cyberimp/cyberware/redline) in psycho.organs + var/datum/component/cyberware/core_ware = core?.GetComponent(/datum/component/cyberware) + TEST_ASSERT(core_ware?.emp_down, "The EMP didn't take its core down") + TEST_ASSERT(!psycho.psycho_burn_pending(), "With its core down, its phase two still waits") + psycho.setStaminaLoss(70) + TEST_ASSERT(psycho.boss_is_worn_out(), "With its core down, it doesn't tire") + TEST_ASSERT_EQUAL(get_chrome_capacity(psycho), 35, "An EMP took its capacity away, browning its chrome out") // CYBERWARE_BASE_CAPACITY + BOUNTY_PSYCHO_EXTRA_CAPACITY + +// ===== LAZARUS ===== + +/// Beaten into crit, the node's own jolt stands it up after its charge; down again in the same fight, it stays down +/datum/unit_test/voidcrew_bounty_cyberpsycho/lazarus + +/datum/unit_test/voidcrew_bounty_cyberpsycho/lazarus/Run() + var/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/psycho = psycho_at(tile(2, 2)) + TEST_ASSERT(istype(psycho), "No cyberpsycho spawned") + var/obj/item/organ/cyberimp/cyberware/lazarus/node = locate() in psycho.organs + TEST_ASSERT_NOTNULL(node, "The cyberpsycho has no Lazarus node") + for(var/i in 1 to 30) + if(psycho.stat != CONSCIOUS) + break + psycho.adjustBruteLoss(10) + psycho.updatehealth() + TEST_ASSERT(psycho.is_downed(), "The beating didn't put it in crit (health [psycho.health])") + TEST_ASSERT(node.jolting, "Going into crit didn't start the node's charge") + sleep(1.3 SECONDS) + TEST_ASSERT_EQUAL(psycho.stat, CONSCIOUS, "The node didn't stand it up (health [psycho.health])") + for(var/i in 1 to 30) + if(psycho.stat != CONSCIOUS) + break + psycho.adjustBruteLoss(10) + psycho.updatehealth() + TEST_ASSERT(psycho.is_downed(), "The second beating didn't put it in crit") + sleep(1.3 SECONDS) + TEST_ASSERT(psycho.is_downed(), "It got up a second time in one fight") + +// ===== THE BOUNTY PANEL ===== + +/// The panel spawns one by its kit, and "All of it" is the cyberpsycho whatever archetype was picked +/datum/unit_test/voidcrew_bounty_cyberpsycho/admin + +/datum/unit_test/voidcrew_bounty_cyberpsycho/admin/Run() + var/mob/living/carbon/human/operator = allocate(/mob/living/carbon/human/consistent, tile(4, 4)) + var/datum/bounty_admin_panel/unit_test/panel = allocate(/datum/bounty_admin_panel/unit_test, operator) + var/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/spawned = panel.admin_spawn_criminal(operator, 3, "boss", "cyberpsycho", null, tile(1, 1), "roll") // BOUNTY_ADMIN_CHROME_ROLL + allocated += spawned + TEST_ASSERT(istype(spawned), "The panel's cyberpsycho spawned as [spawned?.type]: [panel.error]") + TEST_ASSERT_EQUAL(length(chrome_in(spawned)), 6, "The panel's cyberpsycho carries [length(chrome_in(spawned))] pieces") + TEST_ASSERT_NULL(spawned?.record?.chrome, "Rolled as usual, the cyberpsycho rolled chrome on top of its own") + var/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/all = panel.admin_spawn_criminal(operator, 3, "normal", "brawler", null, tile(3, 1), "all") // BOUNTY_ADMIN_CHROME_ALL + allocated += all + TEST_ASSERT(istype(all), "All of it spawned [all?.type], not the cyberpsycho") + TEST_ASSERT_EQUAL(all?.record?.archetype, "boss", "All of it's record isn't a mini-boss's") // BOUNTY_ARCHETYPE_BOSS + TEST_ASSERT_NULL(all?.record?.style, "All of it kept a fighting style") + TEST_ASSERT_EQUAL(length(chrome_in(all)), 6, "All of it carries [length(chrome_in(all))] pieces") + TEST_ASSERT(!panel.said("didn't fit"), "The admin was told some of it didn't fit") + +// ===== RENDERS ===== + +/// Not a check: with -DBOUNTY_CHROME_RENDERS, writes the cyberpsycho as spawned and with its blade out, every way it faces +/datum/unit_test/voidcrew_bounty_cyberpsycho/renders + +/datum/unit_test/voidcrew_bounty_cyberpsycho/renders/Run() +#ifdef BOUNTY_CHROME_RENDERS + var/mob/living/carbon/human/hunter = hunter_at(tile(4, 4)) + for(var/datum/species/kind as anything in list(/datum/species/human, /datum/species/lizard, /datum/species/moth)) + var/mob/living/carbon/human/npc/bounty_criminal/boss/cyberpsycho/psycho = spawn_bounty_criminal(psycho_record(kind), tile(2, 2), null) + allocated += psycho + psycho.ai_controller?.set_ai_status(AI_STATUS_OFF) + var/name = "[initial(kind.id)]" + for(var/facing in list(SOUTH, EAST, NORTH, WEST)) + fcopy(getFlatIcon(psycho, facing, no_anim = TRUE), "data/bounty_chrome_renders/cyberpsycho_[name]_[dir2text(facing)].png") + psycho.body_add_grudge(hunter) + psycho.boss_turn_hostile(hunter) + blade_out(psycho, hunter) + for(var/facing in list(SOUTH, EAST, NORTH, WEST)) + fcopy(getFlatIcon(psycho, facing, no_anim = TRUE), "data/bounty_chrome_renders/cyberpsycho_[name]_blade_[dir2text(facing)].png") + qdel(psycho) +#endif diff --git a/voidcrew/modules/unit_tests/voidcrew_bounty_identity.dm b/voidcrew/modules/unit_tests/voidcrew_bounty_identity.dm index 8bbbc927a63..b191be83929 100644 --- a/voidcrew/modules/unit_tests/voidcrew_bounty_identity.dm +++ b/voidcrew/modules/unit_tests/voidcrew_bounty_identity.dm @@ -10,7 +10,7 @@ /datum/unit_test/voidcrew_bounty_identity_records/Run() var/list/styles = list("brawler", "knife", "pistol", "shotgun", "smg", "revolver", "club", "bottle") // BOUNTY_STYLE_*, normal - var/list/kits = list("juggernaut", "pyromaniac", "demolitionist", "ghost", "heavy") // BOUNTY_KIT_* + var/list/kits = list("juggernaut", "pyromaniac", "demolitionist", "ghost", "heavy", "cyberpsycho") // BOUNTY_KIT_* var/list/labels = bounty_feature_labels() // BOUNTY_TIER_*, BOUNTY_ARCHETYPE_*, BOUNTY_PLACEMENT_* for(var/tier in list(1, 2, 3)) diff --git a/voidcrew/modules/unit_tests/voidcrew_bounty_pace.dm b/voidcrew/modules/unit_tests/voidcrew_bounty_pace.dm new file mode 100644 index 00000000000..fbf89637f7c --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_bounty_pace.dm @@ -0,0 +1,183 @@ +/** + * Bounty hunting: a fighter's pace and its guns' reach (C4), for voidcrew/modules/bounties/bounty_ai.dm + * (bounty_ai_step(), the AI's walk) and bounty_styles.dm (the side-step, the back-off, the fire range). + * Criminals and companions are real human bodies that walk and run at a person's pace; the steps the AI + * takes by hand (out of a friend's line of fire, back from someone too close) come no sooner than a step + * of the body's own, and hold the AI's walk back as long. A gun fires at anyone it sees within 7 tiles + * while walking in to 5; the shotgun fires from as close as it walks in. + * + * The tests drive the behaviours directly, with the gun tests' helpers (voidcrew_bounty_guns.dm). Fork + * defines are included after the tests, so a test uses the literal value with a comment naming the define. + */ + +/// The pace tests, in the bounty AI tests' room, with the gun tests' helpers +/datum/unit_test/voidcrew_bounty_pace + parent_type = /datum/unit_test/voidcrew_bounty_guns + abstract_type = /datum/unit_test/voidcrew_bounty_pace + +/// `mover`'s own delay for a step in `direction`: what a player's step costs, longer on a diagonal +/datum/unit_test/voidcrew_bounty_pace/proc/step_delay(mob/living/mover, direction) + var/delay = max(mover.cached_multiplicative_slowdown, world.tick_lag) + return ISDIAGONALDIR(direction) ? delay * sqrt(2) : delay + +/** + * A gunman steps out of a friend's line of fire at a person's pace. The shooting runs ten times a second; + * a second step the same tick, or before the body's own move delay is up, is refused, and once the delay + * is up it steps again. + */ +/datum/unit_test/voidcrew_bounty_pace/sidestep + +/datum/unit_test/voidcrew_bounty_pace/sidestep/Run() + var/mob/living/carbon/human/npc/bounty_criminal/normal/gunman = make_criminal(/mob/living/carbon/human/npc/bounty_criminal/normal, tile(0, 2), "pistol") // BOUNTY_STYLE_PISTOL + gunman.ai_controller.set_ai_status(AI_STATUS_OFF) + var/mob/living/carbon/human/target = make_target(gunman, tile(4, 2)) + draw_gun(gunman) + var/datum/ai_controller/controller = gunman.ai_controller + // A friend of theirs in the way + var/list/gang = gunman.spawn_companions(1, TRUE, list(list("style" = "brawler"))) // BOUNTY_COMPANY_STYLE, BOUNTY_STYLE_BRAWLER + TEST_ASSERT(length(gang), "Test fixture: no companion") + allocated += gang + var/mob/living/carbon/human/npc/bounty_companion/friend = gang[1] + friend.ai_controller.set_ai_status(AI_STATUS_OFF) + friend.forceMove(tile(2, 2)) + TEST_ASSERT(bounty_ai_line_blocked(gunman, target), "Test fixture: the friend isn't in the gunman's line of fire") + TEST_ASSERT(bounty_ai_step_ready(gunman), "Test fixture: the gunman can't step yet") + + // The first step aside comes at once + var/turf/start = get_turf(gunman) + shoot_step(gunman) + var/turf/first_step = get_turf(gunman) + TEST_ASSERT(first_step != start, "The gunman didn't step out of the friend's line of fire") + var/delay = step_delay(gunman, get_dir(start, first_step)) + TEST_ASSERT(controller.blackboard["bb_bounty_next_step_at"] >= world.time + delay - 0.01, "The gunman's next step by hand isn't a step's time away") // BB_BOUNTY_NEXT_STEP_AT + TEST_ASSERT(!bounty_ai_step_ready(gunman), "Right after a step, the gunman may step again") + + // The friend in the way again, the same tick: no second step + var/list/new_line = get_line(first_step, get_turf(target)) + TEST_ASSERT(length(new_line) >= 3, "Test fixture: the gunman stepped next to the hunter") + friend.forceMove(new_line[2]) + TEST_ASSERT(bounty_ai_line_blocked(gunman, target), "Test fixture: the friend isn't in the gunman's new line of fire") + for(var/i in 1 to 3) + shoot_step(gunman) + TEST_ASSERT_EQUAL(get_turf(gunman), first_step, "The gunman stepped twice in less than a step's time") + // The back-off waits for the body too + var/backstep_at = controller.blackboard["bb_bounty_backstep_at"] // BB_BOUNTY_BACKSTEP_AT + TEST_ASSERT(!bounty_ai_back_off(controller, gunman, target), "The gunman backed off in less than a step's time") + TEST_ASSERT_EQUAL(controller.blackboard["bb_bounty_backstep_at"], backstep_at, "A back-off refused for its pace still used up its turn") + + // Once a step's time is up, it steps aside again + controller.set_blackboard_key("bb_bounty_next_step_at", world.time) // BB_BOUNTY_NEXT_STEP_AT + shoot_step(gunman) + TEST_ASSERT(get_turf(gunman) != first_step, "Once a step's time was up, the gunman didn't step aside again") + shoot_stopped(gunman) + target.fully_heal(HEAL_ALL) + +/** + * The AI's walk and the steps by hand share the body's pace: a step of the walk holds the next step by + * hand back by the body's move delay, and a step by hand holds the walk back as long, so the two never + * add up to two steps in a step's time. A step that isn't paced (the meek's step onto a potted plant's + * tile) goes as before. + */ +/datum/unit_test/voidcrew_bounty_pace/walk + +/datum/unit_test/voidcrew_bounty_pace/walk/Run() + var/mob/living/carbon/human/npc/bounty_criminal/normal/walker = make_criminal(/mob/living/carbon/human/npc/bounty_criminal/normal, tile(1, 1), "brawler") // BOUNTY_STYLE_BRAWLER + var/datum/ai_controller/controller = walker.ai_controller + controller.set_ai_status(AI_STATUS_OFF) + TEST_ASSERT(istype(controller.ai_movement, /datum/ai_movement/jps/bounty), "Test fixture: the criminal doesn't walk with the bounty movement") + + // A step of the walk: its next step by hand waits + var/datum/move_loop/fake_step = new /datum/move_loop(null, null, walker, 0, 0, controller) + walker.Move(tile(2, 1), EAST) + TEST_ASSERT_EQUAL(get_turf(walker), tile(2, 1), "Test fixture: the walker didn't step") + controller.ai_movement.post_move(fake_step, 1) // MOVELOOP_SUCCESS + qdel(fake_step) + TEST_ASSERT(!bounty_ai_step_ready(walker), "Right after a step of its walk, the criminal may step by hand") + TEST_ASSERT(controller.blackboard["bb_bounty_next_step_at"] >= world.time + step_delay(walker, EAST) - 0.01, "A step of the walk doesn't hold the next step by hand a step's time") // BB_BOUNTY_NEXT_STEP_AT + TEST_ASSERT(!bounty_ai_step(walker, tile(3, 1), paced = TRUE), "A paced step went right after a step of the walk") + TEST_ASSERT_EQUAL(get_turf(walker), tile(2, 1), "The refused step moved the criminal") + // An unpaced step goes, as it always did + TEST_ASSERT(bounty_ai_step(walker, tile(3, 1)), "An unpaced step was refused") + + // A step by hand holds the walk back + controller.set_blackboard_key("bb_bounty_next_step_at", world.time) // BB_BOUNTY_NEXT_STEP_AT + GLOB.move_manager.move(walker, NORTH, 1, 5 SECONDS, SSai_movement) + var/datum/move_loop/walk = GLOB.move_manager.processing_on(walker, SSai_movement) + TEST_ASSERT_NOTNULL(walk, "Test fixture: no walk on the AI's movement") + TEST_ASSERT(walk.timer < world.time + step_delay(walker, NORTH), "Test fixture: the walk's next step is already a step's time off") + TEST_ASSERT(bounty_ai_step(walker, tile(3, 2), paced = TRUE), "A paced step with the time up was refused") + var/held_for = walk.timer - world.time + GLOB.move_manager.stop_looping(walker, SSai_movement) + TEST_ASSERT(held_for >= step_delay(walker, NORTH) - 0.01, "After a step by hand, the walk's next step is only [held_for] away") + +/** + * A gun fires at anyone it can see within 7 tiles (BOUNTY_GUN_FIRE_RANGE) while it walks in to 5 + * (BOUNTY_PISTOL_RANGE), and never further; the shotgun fires only from as close as it walks in to + * (BOUNTY_SHOTGUN_RANGE), and the bottle thrower throws from its own distance. + */ +/datum/unit_test/voidcrew_bounty_pace/gun_range + var/datum/turf_reservation/range + +/datum/unit_test/voidcrew_bounty_pace/gun_range/Destroy() + QDEL_LIST(allocated) + QDEL_NULL(range) + return ..() + +/datum/unit_test/voidcrew_bounty_pace/gun_range/Run() + var/datum/ai_behavior/bounty_shoot/shooting = GET_AI_BEHAVIOR(/datum/ai_behavior/bounty_shoot) + TEST_ASSERT_EQUAL(shooting.fire_range, 7, "Guns don't fire out to 7 tiles") + TEST_ASSERT_EQUAL(shooting.required_distance, 5, "Guns don't walk in to 5 tiles") + var/datum/ai_behavior/bounty_shoot/close/shotgun_range = GET_AI_BEHAVIOR(/datum/ai_behavior/bounty_shoot/close) + TEST_ASSERT_EQUAL(shotgun_range.fire_range, shotgun_range.required_distance, "The shotgun fires from further off than it walks in to") + var/datum/ai_behavior/bounty_shoot/throw/bottle_range = GET_AI_BEHAVIOR(/datum/ai_behavior/bounty_shoot/throw) + TEST_ASSERT_EQUAL(bottle_range.fire_range, bottle_range.required_distance, "Bottles fly from further off than the thrower keeps") + + // A corridor long enough to shoot down + range = SSmapping.request_turf_block_reservation(12, 3, 1, null, /datum/turf_reservation, /turf/open/floor/iron) + TEST_ASSERT_NOTNULL(range, "Could not reserve a corridor") + var/turf/anchor = range.bottom_left_turfs[1] + var/area/testroom = GLOB.areas_by_type[/area/misc/testroom] + for(var/dx in 0 to 11) + for(var/dy in 0 to 2) + var/turf/tile = locate(anchor.x + dx, anchor.y + dy, anchor.z) + tile.change_area(tile.loc, testroom) + + // The pistol: a shot at 7 tiles, none at 8 + var/mob/living/carbon/human/npc/bounty_criminal/normal/gunman = make_criminal(/mob/living/carbon/human/npc/bounty_criminal/normal, locate(anchor.x, anchor.y + 1, anchor.z), "pistol") // BOUNTY_STYLE_PISTOL + gunman.ai_controller.set_ai_status(AI_STATUS_OFF) + var/mob/living/carbon/human/target = make_target(gunman, locate(anchor.x + 7, anchor.y + 1, anchor.z)) + var/obj/item/gun/ballistic/stechkin = draw_gun(gunman) + var/datum/ai_controller/controller = gunman.ai_controller + controller.set_blackboard_key("bb_bounty_windup_until", world.time) // BB_BOUNTY_WINDUP_UNTIL + controller.set_blackboard_key("bb_bounty_next_shot", world.time) // BB_BOUNTY_NEXT_SHOT + var/rounds = bounty_gun_live_rounds(stechkin) + shoot_step(gunman) + TEST_ASSERT_EQUAL(bounty_gun_live_rounds(stechkin), rounds - 1, "The pistol didn't fire at someone 7 tiles off") + next_pull(gunman, target) + target.forceMove(locate(anchor.x + 8, anchor.y + 1, anchor.z)) + shoot_step(gunman) + TEST_ASSERT_EQUAL(bounty_gun_live_rounds(stechkin), rounds - 1, "The pistol fired at someone 8 tiles off") + shoot_stopped(gunman) + + // The shotgun: nothing at 3 tiles, a blast at 2 + var/mob/living/carbon/human/npc/bounty_criminal/normal/blaster = make_criminal(/mob/living/carbon/human/npc/bounty_criminal/normal, locate(anchor.x, anchor.y + 2, anchor.z), "shotgun") // BOUNTY_STYLE_SHOTGUN + blaster.ai_controller.set_ai_status(AI_STATUS_OFF) + var/mob/living/carbon/human/mark = make_target(blaster, locate(anchor.x + 3, anchor.y + 2, anchor.z)) + var/obj/item/gun/ballistic/shotgun = draw_gun(blaster) + var/datum/ai_controller/shotgun_ai = blaster.ai_controller + var/shells = bounty_gun_live_rounds(shotgun) + for(var/i in 1 to 2) + shotgun_ai.set_blackboard_key("bb_bounty_next_shot", world.time) // BB_BOUNTY_NEXT_SHOT + shotgun_ai.set_blackboard_key("bb_bounty_windup_until", world.time) // BB_BOUNTY_WINDUP_UNTIL + shoot_step(blaster) + TEST_ASSERT_EQUAL(bounty_gun_live_rounds(shotgun), shells, "The shotgun fired at someone 3 tiles off") + mark.forceMove(locate(anchor.x + 2, anchor.y + 2, anchor.z)) + bounty_ai_clear_windup(shotgun_ai) + shotgun_ai.set_blackboard_key("bb_bounty_next_shot", world.time) // BB_BOUNTY_NEXT_SHOT + shoot_step(blaster) + shotgun_ai.set_blackboard_key("bb_bounty_windup_until", world.time) // BB_BOUNTY_WINDUP_UNTIL: the pump done + shoot_step(blaster) + TEST_ASSERT_EQUAL(bounty_gun_live_rounds(shotgun), shells - 1, "The shotgun didn't fire at someone 2 tiles off") + shoot_stopped(blaster) + target.fully_heal(HEAL_ALL) + mark.fully_heal(HEAL_ALL) diff --git a/voidcrew/modules/unit_tests/voidcrew_bounty_suits.dm b/voidcrew/modules/unit_tests/voidcrew_bounty_suits.dm index f2aeb4bdc3c..7fa9c5017c1 100644 --- a/voidcrew/modules/unit_tests/voidcrew_bounty_suits.dm +++ b/voidcrew/modules/unit_tests/voidcrew_bounty_suits.dm @@ -43,6 +43,10 @@ /datum/unit_test/voidcrew_bounty_suits/proc/armoured(obj/item/item) return !isnull(item) && max(item.get_armor_rating(MELEE), item.get_armor_rating(BULLET)) >= 30 +/// Whether a mini-boss kit's `item` is in the armoured class: armoured, or energy armour of 30 or more (the Heavy's ablative coat and hood, C8) +/datum/unit_test/voidcrew_bounty_suits/proc/kit_armoured(obj/item/item) + return armoured(item) || (!isnull(item) && item.get_armor_rating(ENERGY) >= 30) + /// Checks `npc` is sealed up for vacuum in real, locked gear: a pressure suit and helmet that keep out the cold of space, and a tank it can breathe /datum/unit_test/voidcrew_bounty_suits/proc/check_sealed(mob/living/carbon/human/npc/npc, label) var/obj/item/clothing/suit = npc.wear_suit @@ -54,6 +58,35 @@ TEST_ASSERT(npc.can_breathe_internals(), "[label] has nothing to breathe its tank through") TEST_ASSERT(human_npc_gear_locked(suit) && human_npc_gear_locked(helmet), "[label]'s suit isn't locked to it") +/** + * Checks `npc` wears a running MODsuit of `suit_type` on its back, every piece deployed and sealed, and + * that none of it can become loot: the control unit, its pieces, core, cell and modules are locked to it + * and hidden from the strip menu, and what its storage holds is locked or a consumable it can reach. + */ +/datum/unit_test/voidcrew_bounty_suits/proc/check_modsuit(mob/living/carbon/human/npc/npc, suit_type, label) + var/obj/item/mod/control/suit = npc.back + TEST_ASSERT(istype(suit, suit_type), "[label] wears [suit?.type] on its back, not its MODsuit [suit_type]") + TEST_ASSERT(suit.active, "[label]'s MODsuit isn't running") + TEST_ASSERT(suit.get_charge() > 0, "[label]'s MODsuit has no charge") + TEST_ASSERT_EQUAL(suit.wearer, npc, "[label]'s MODsuit doesn't know its wearer") + for(var/obj/item/part as anything in suit.get_parts()) + TEST_ASSERT_EQUAL(part.loc, npc, "[label]'s [part] isn't deployed") + var/datum/mod_part/part_datum = suit.get_part_datum(part) + TEST_ASSERT(part_datum?.sealed, "[label]'s [part] isn't sealed") + TEST_ASSERT(istype(npc.wear_suit, /obj/item/clothing/suit/mod) && istype(npc.head, /obj/item/clothing/head/mod), "[label] isn't sealed in its MODsuit's chestplate and helmet") + var/list/pieces = suit.get_parts(all = TRUE) + suit.modules + suit.core + var/obj/item/mod/core/standard/core = suit.core + TEST_ASSERT(istype(core) && istype(core.cell, /obj/item/stock_parts/power_store/cell), "[label]'s MODsuit has no cell in its core") + pieces += core.cell + for(var/obj/item/piece as anything in pieces) + TEST_ASSERT(human_npc_gear_locked(piece), "[label]'s [piece] isn't locked to it") + TEST_ASSERT(HAS_TRAIT(piece, TRAIT_NO_STRIP), "[label]'s [piece] shows in the strip menu") + var/obj/item/mod/module/storage/pouch = locate() in suit.modules + TEST_ASSERT_NOTNULL(pouch, "[label]'s MODsuit has no storage") + for(var/obj/item/carried in pouch.contents) + TEST_ASSERT(human_npc_gear_locked(carried) || human_npc_gear_consumable(carried), "[label]'s [carried] in its MODsuit isn't locked or issued to it") + TEST_ASSERT(human_npc_can_draw(npc, carried), "[label] can't take its [carried] out of its MODsuit") + // ===== WHERE THEY ARE DRESSED FOR ===== /// At a space ruin a criminal and its companions arrive sealed up even on a tile with good air: a soft suit for a Petty one, an armoured one for a Wanted one @@ -91,26 +124,122 @@ TEST_ASSERT(!armoured(buddy.wear_suit), "A companion's soft suit is armoured ([buddy.wear_suit.type])") TEST_ASSERT_EQUAL(buddy.company_site_kind, "ruin", "A companion doesn't know its criminal is at a ruin") // BOUNTY_PLACEMENT_RUIN -/// Each mini-boss kit seals up in a suit of its own armour class: what protects it in good air protects it in vacuum about as well +/** + * Each mini-boss kit seals up in a running MODsuit of its own theme, of its own armour class: what protects + * it in good air protects it in vacuum about as well. What its bag holds rides in the suit's storage, where + * it reaches it, and none of the suit can be stripped or looted. + */ /datum/unit_test/voidcrew_bounty_suits/kits /datum/unit_test/voidcrew_bounty_suits/kits/Run() - for(var/kit in list("juggernaut", "pyromaniac", "demolitionist", "ghost", "heavy")) // BOUNTY_KIT_* + var/list/suit_types = list( + "juggernaut" = /obj/item/mod/control/pre_equipped/bounty_boss/security, + "pyromaniac" = /obj/item/mod/control/pre_equipped/bounty_boss/atmospheric, + "demolitionist" = /obj/item/mod/control/pre_equipped/bounty_boss/engineering, + "ghost" = /obj/item/mod/control/pre_equipped/bounty_boss/civilian, + "heavy" = /obj/item/mod/control/pre_equipped/bounty_boss/magnate, + ) + for(var/kit in suit_types) // BOUNTY_KIT_* var/mob/living/carbon/human/npc/bounty_criminal/boss/in_air = new_criminal("boss", 3, kit) // BOUNTY_TIER_MOST_WANTED var/mob/living/carbon/human/npc/bounty_criminal/boss/in_vacuum = new_criminal("boss", 3, kit, /obj/structure/overmap/space_ruin) TEST_ASSERT(istype(in_air) && istype(in_vacuum), "No [kit] was made") TEST_ASSERT_EQUAL(in_vacuum.boss_kit, kit, "Test fixture: the [kit] came out as a [in_vacuum.boss_kit]") check_sealed(in_vacuum, "The [kit] at a space ruin") - TEST_ASSERT_EQUAL(armoured(in_vacuum.wear_suit), armoured(in_air.wear_suit), "The [kit]'s space suit ([in_vacuum.wear_suit.type]) isn't in the armour class of its own suit ([in_air.wear_suit?.type])") - TEST_ASSERT_EQUAL(armoured(in_vacuum.head), armoured(in_air.head), "The [kit]'s space helmet ([in_vacuum.head.type]) isn't in the armour class of its own headgear ([in_air.head?.type])") - TEST_ASSERT(in_vacuum.boss_gear_text(), "The [kit] in its space suit has no gear line on examine") + TEST_ASSERT_EQUAL(kit_armoured(in_vacuum.wear_suit), kit_armoured(in_air.wear_suit), "The [kit]'s space suit ([in_vacuum.wear_suit.type]) isn't in the armour class of its own suit ([in_air.wear_suit?.type])") + TEST_ASSERT_EQUAL(kit_armoured(in_vacuum.head), kit_armoured(in_air.head), "The [kit]'s space helmet ([in_vacuum.head.type]) isn't in the armour class of its own headgear ([in_air.head?.type])") + TEST_ASSERT(in_vacuum.boss_gear_text(), "The [kit] in its MODsuit has no gear line on examine") var/list/gear = bounty_vacuum_gear(in_vacuum) - TEST_ASSERT(length(gear) == 2 && istype(in_vacuum.wear_suit, gear[1]), "The [kit] doesn't wear the suit it was given for vacuum") + TEST_ASSERT(length(gear) == 1 && gear[1] == suit_types[kit], "The [kit] was given [jointext(gear, ", ")] for vacuum") + check_modsuit(in_vacuum, suit_types[kit], "The [kit] at a space ruin") + // Everything its bag holds in good air, it carries in vacuum too + var/obj/item/bag = in_air.back + TEST_ASSERT(bag?.atom_storage, "Test fixture: the [kit] carries no bag in good air") + for(var/obj/item/packed as anything in bag.get_all_contents_type(/obj/item)) + if(packed == bag) + continue + TEST_ASSERT(length(in_vacuum.get_all_contents_type(packed.type)) >= length(bag.get_all_contents_type(packed.type)), "The [kit] left its [packed] behind for vacuum") + TEST_ASSERT_EQUAL(exact_count(in_vacuum, /obj/item/reagent_containers/hypospray/medipen/stimpack/traitor), 1, "The [kit] doesn't carry its combat stimpack in vacuum") // BOUNTY_BOSS_COMBAT_STIMULANT + // Paused while it is dormant, so its core doesn't run flat before anyone comes, and running again when it wakes + var/obj/item/mod/control/suit = in_vacuum.back + in_vacuum.npc_set_suit_heating(FALSE) + TEST_ASSERT(!(suit.datum_flags & DF_ISPROCESSING), "The [kit]'s MODsuit runs while it is dormant") + in_vacuum.npc_set_suit_heating(TRUE) + TEST_ASSERT(suit.datum_flags & DF_ISPROCESSING, "The [kit]'s MODsuit didn't start again when it woke") if(kit == "heavy") - TEST_ASSERT(istype(in_vacuum.head, /obj/item/clothing/head/helmet/swat), "The Heavy lost its SWAT helmet in vacuum") + // Its ablative coat and hood hold no pressure, and nothing goes over a MODsuit: out there it has the magnate suit's energy armour (C8) + TEST_ASSERT(istype(in_air.head, /obj/item/clothing/head/hooded/ablative), "The Heavy's ablative hood isn't up in good air") + TEST_ASSERT(in_vacuum.wear_suit.get_armor_rating(ENERGY) >= in_air.wear_suit.get_armor_rating(ENERGY), "The Heavy's MODsuit has less energy armour than its coat") + if(kit == "pyromaniac") + // Its gas mask and ID stay on under the suit, and its spare tanks are where it changes them from + var/mob/living/carbon/human/npc/bounty_criminal/boss/pyromaniac/pyro = in_vacuum + TEST_ASSERT(istype(pyro.wear_mask, /obj/item/clothing/mask/gas), "The Pyromaniac took its gas mask off for its MODsuit") + TEST_ASSERT(istype(pyro.wear_id, /obj/item/card/id), "The Pyromaniac has no ID in its MODsuit") + TEST_ASSERT(pyro.wear_suit.resistance_flags & FIRE_PROOF, "The Pyromaniac's MODsuit isn't fireproof") + TEST_ASSERT_NOTNULL(pyro.boss_spare_tank(), "The Pyromaniac can't reach a spare tank in its MODsuit") qdel(in_air) qdel(in_vacuum) +/// How many of exactly `item_type` (not its subtypes) `holder` carries +/datum/unit_test/voidcrew_bounty_suits/proc/exact_count(mob/living/holder, item_type) + . = 0 + for(var/obj/item/thing as anything in holder.get_all_contents_type(item_type)) + if(thing.type == item_type) + .++ + +/** + * A mini-boss's MODsuit never becomes loot: a core, cell or module forced out of it (the only way one + * leaves it on a body nobody can open) is gone by the next tick, and what spills from its storage is + * gone too, a consumable once it is in anyone's hands. A hunter suiting up a cuffed boss takes the whole + * MODsuit off with its helmet or chestplate, and it is gone, the gloves and boots it covered going back on. + */ +/datum/unit_test/voidcrew_bounty_suits/modsuit_loot + +/datum/unit_test/voidcrew_bounty_suits/modsuit_loot/Run() + var/mob/living/carbon/human/npc/bounty_criminal/boss/boss = new_criminal("boss", 3, "juggernaut", /obj/structure/overmap/space_ruin) // BOUNTY_TIER_MOST_WANTED, BOUNTY_KIT_JUGGERNAUT + TEST_ASSERT_NOTNULL(boss, "No Juggernaut was made") + var/obj/item/mod/control/suit = boss.back + TEST_ASSERT(istype(suit), "Test fixture: the Juggernaut wears no MODsuit") + var/turf/floor = get_turf(boss) + var/obj/item/mod/core/standard/core = suit.core + var/obj/item/cell = core.cell + var/obj/item/mod/module/storage/pouch = locate() in suit.modules + var/list/spilled = pouch.contents.Copy() + for(var/obj/item/piece as anything in list(cell, core, pouch)) + piece.forceMove(floor) + human_npc_gear_settle(piece) + TEST_ASSERT(QDELETED(piece), "A [piece] taken out of the Juggernaut's MODsuit is still about") + var/mob/living/carbon/human/consistent/hunter = allocate(/mob/living/carbon/human/consistent, get_step(floor, EAST)) + for(var/obj/item/thing as anything in spilled) + if(QDELETED(thing)) + continue + if(isturf(thing.loc) && human_npc_gear_consumable(thing)) + hunter.put_in_active_hand(thing) + human_npc_gear_settle(thing) + TEST_ASSERT(QDELETED(thing), "The [thing] from the Juggernaut's MODsuit storage became loot") + qdel(boss) + + // Suiting up a cuffed boss: its MODsuit comes off whole and is gone + boss = new_criminal("boss", 3, "juggernaut", /obj/structure/overmap/space_ruin) + suit = boss.back + var/list/parts = suit.get_parts(all = TRUE) + var/obj/item/chestplate = boss.wear_suit + TEST_ASSERT(chestplate in parts, "Test fixture: the Juggernaut's chestplate isn't its MODsuit's") + var/obj/item/clothing/suit/space/hunter_suit = allocate(/obj/item/clothing/suit/space) + hunter.put_in_active_hand(hunter_suit) + TEST_ASSERT_EQUAL(boss.suits_garment_offered(hunter, chestplate), hunter_suit, "A space suit in hand wasn't offered for the MODsuit's chestplate") + TEST_ASSERT(!boss.suits_swap_now(hunter, chestplate, hunter_suit), "A space suit went on a free boss") + TEST_ASSERT_EQUAL(boss.back, suit, "A free boss lost its MODsuit") + board_test_cuff(boss) + TEST_ASSERT(boss.suits_swap_now(hunter, chestplate, hunter_suit), "A space suit wouldn't go on a cuffed boss in a MODsuit") + TEST_ASSERT_EQUAL(boss.wear_suit, hunter_suit, "The hunter's suit isn't on the boss") + for(var/obj/item/part as anything in parts) + TEST_ASSERT(QDELETED(part), "The boss's [part] is still about after its MODsuit came off") + TEST_ASSERT_NULL(boss.back, "The boss still wears [boss.back] on its back") + TEST_ASSERT_NULL(boss.head, "The boss still wears [boss.head] after its MODsuit came off") + TEST_ASSERT(istype(boss.gloves, /obj/item/clothing/gloves/combat) && human_npc_gear_locked(boss.gloves), "The Juggernaut's own gloves didn't go back on") + TEST_ASSERT(istype(boss.shoes, /obj/item/clothing/shoes/jackboots) && human_npc_gear_locked(boss.shoes), "The Juggernaut's own boots didn't go back on") + TEST_ASSERT(!human_npc_gear_locked(hunter_suit), "The hunter's suit was locked to the boss") + // ===== SUITING UP A CATCH ===== /** diff --git a/voidcrew/modules/unit_tests/voidcrew_human_npcs_combat_sense.dm b/voidcrew/modules/unit_tests/voidcrew_human_npcs_combat_sense.dm index 4150fb56244..987bd53af49 100644 --- a/voidcrew/modules/unit_tests/voidcrew_human_npcs_combat_sense.dm +++ b/voidcrew/modules/unit_tests/voidcrew_human_npcs_combat_sense.dm @@ -385,9 +385,8 @@ var/mob/living/carbon/human/npc/bounty_criminal/normal/most_wanted = make_normal_criminal(3, "club", tile(0, 4)) // BOUNTY_TIER_MOST_WANTED TEST_ASSERT_NOTNULL(most_wanted, "Test fixture: no Most Wanted criminal was made") - var/obj/item/reagent_containers/hypospray/medipen/combat_stim = human_npc_find_stim(most_wanted) - TEST_ASSERT_NOTNULL(combat_stim, "A Most Wanted club fighter carries no stimulant") - TEST_ASSERT_EQUAL(combat_stim.type, /obj/item/reagent_containers/hypospray/medipen/stimpack/traitor, "A Most Wanted club fighter doesn't carry a combat stimpack") + // Every Most Wanted is a mini-boss, which carries the combat stimpack (boss_supplies()); a plain one made by hand carries none + TEST_ASSERT_NULL(human_npc_find_stim(most_wanted), "A plain Most Wanted club fighter carries a stimulant") var/mob/living/carbon/human/npc/bounty_criminal/normal/gunman = make_normal_criminal(2, "pistol", tile(4, 4)) // BOUNTY_STYLE_PISTOL TEST_ASSERT_NOTNULL(gunman, "Test fixture: no Wanted gunman was made") diff --git a/wiki/content/bounty-hunting.md b/wiki/content/bounty-hunting.md index 917b32ce1f6..c62f13f3166 100644 --- a/wiki/content/bounty-hunting.md +++ b/wiki/content/bounty-hunting.md @@ -22,7 +22,7 @@ Each card is a wanted poster: - **WANTED** or **MOST WANTED**, and **Private offer** on one made to your ship alone; - the mugshot, name, species, sex and alias. "Old photo" under the mugshot means it shows how they used to look (a trader-outpost fugitive); - how they're wanted and what for: **Wanted alive**, **Wanted dead or alive** (the kingpin) or **Wanted dead** (lairs and the lich); -- where they were last seen, and the zone; +- where they were last seen, who they were seen with ("with two friends, one armed"), and the zone; - the reward: the full pay, in credits and vouchers. The card doesn't show what a catch in critical condition or dead pays; see [the pad and turning in](#the-pad-and-turning-in); - the time left. @@ -98,12 +98,12 @@ About 70% of Wanted criminals and 30% of Petty ones are normal. A Wanted crimina - They notice anyone holding a weapon, cuffs or a warrant within 6 tiles. Cuffs or a warrant and they stop and watch you. A weapon out and they fight. - Each has one fighting style, with a real weapon they carry and draw when the fight starts: fists (and shoves), a knife, a machine pistol with a spare magazine, a WT-550 with a spare magazine, a .38 revolver with a speedloader, a pump shotgun with buckshot, a baseball bat or thrown bottles. Wanted criminals carry a combat knife or a semi-automatic shotgun instead. Their guns run dry and they reload them like you do. -- Guns stay in a holster, on the belt or slung on the back until the fight. You see one drawn, and the first shot comes a moment later; hit them while they draw and they fumble it. +- Guns stay in a holster, on the belt or slung on the back until the fight. You see one drawn, and the first shot comes a moment later; hit them while they draw and they fumble it. Gunmen open fire from about 7 tiles away and keep closing to about 5. A shotgun gets in close first. - Their pistols fire single shots, two a second, in strings of six with a short pause between. So do the kingpin's goons and Club Volga's gunmen. The WT-550 fires bursts of four, and a burst stops as soon as the shooter goes down or loses you. - Wanted criminals wear an armour vest, and Most Wanted a vest and a helmet. Nothing a criminal carries can be taken: it goes with the body. - Wanted criminals carry a stimpack if their pockets have room, and jab it when they tire in a fight. - Hit by a disabler or other stun shot, a gunner or bottle thrower ducks behind the nearest cover and looks out again a moment later. A fist, knife, bat or shotgun fighter charges whoever shot it. -- They may have up to two companions who fight beside them. Companions can be of any species and wear rough clothes for where they are. Companions pay nothing. They may run when badly hurt or when their criminal goes down, and when they come round from a stun they may give up or run. +- They may have up to two companions who fight beside them, and the card says who they were seen with. At most one companion carries a gun. Companions get up and draw a moment after their criminal, and their guns fire shorter strings and bursts. Now and then a companion has a piece of chrome. Companions can be of any species and wear rough clothes for where they are. Companions pay nothing. They may run when badly hurt or when their criminal goes down, and when they come round from a stun they may give up or run. - Badly hurt, with two hunters nearby who can see them, they may give up: they put their weapon away, put their hands on their head and lie down for 20 seconds. Cuff them then for full pay. If nobody does, they get up and decide again. - Badly hurt with nobody around, they break off, sit down and patch themselves up with what they carry. @@ -111,22 +111,23 @@ About 70% of Wanted criminals and 30% of Petty ones are normal. A Wanted crimina ### Mini-bosses -Every Most Wanted criminal is a mini-boss with one of five kits. The board's **Other crews hunting** line excludes your own active hunt. +Every Most Wanted criminal is a mini-boss with one of six kits. The board's **Other crews hunting** line excludes your own active hunt. - They wear their kit's armour and take hits better than most people. - Every hunter after the first brings one more of their crew, who turns up from somewhere out of sight. - Every ability winds up first, with a sound and a mark on the floor. Move out of the mark. Fire, blasts and blades hurt whoever is standing there, down or not. - They break tables, chairs, windows and grilles, and up to two interior walls or doors in a fight. -- At the start of a fight they jab a stimulant: for a while they shrug off batons and get up from stuns quickly. They carry a second for later. +- When they tire they jab a stimulant: for a while they shrug off batons and get up from stuns quickly. They carry three, one of them a combat stimpack that also heals them a little. - Badly hurt or out of breath they're **worn out**: "breathing hard and slowing down", and they fall back for a moment. That's the time to stun and cuff them. | Kit | Looks like | What it does | How to handle it | |---|---|---|---| -| Juggernaut | A giant in riot plates | Charges along a line after a roar, smashing what's in the way. Slams the floor around it when you're close. | Step off the charge line. If it charges into something it can't break, it hurts itself and falls down for a few seconds. | -| Pyromaniac | A scorched criminal in a fire suit | Sweeps a cone of fire 3 tiles long and throws molotovs that leave burning floor. Its fire suit keeps the flames off it; the space suit it wears where the air kills doesn't. | Stay more than 3 tiles away and off burning floor. If you catch fire, stop, drop and roll, or use an extinguisher. | -| Demolitionist | A criminal in a hard hat with a grenade bandolier | Keeps 4 to 6 tiles away and throws grenades with a blinking fuse. Blows holes in interior walls and doors to reach you behind cover. | Close the distance, and move off the blinking ring. | -| Ghost | A hooded criminal with a combat knife | Fast. Dashes in with knife cuts that bleed, cloaks into a shimmer, and backs off after two cuts. Its implants make shots miss now and then while it moves, much more often during its burst of speed. | A flash or a hit breaks the cloak, and an EMP ends the burst. Shoot it when it stops moving. | -| Heavy | A heavily armed criminal with a belt-fed gun | Heavy armour, slow. Shows a laser sight and a red cone, then fires a burst into it. Throws barrier grenades that open into a barricade. | Get out of the red cone before it fires. Go around the barricade. | +| Juggernaut | A giant in riot plates with a tower shield | Raises its shield when the fight starts; shots from in front stop at it. Charges along a line after a roar, smashing what's in the way. Slams the floor around it when you're close. | Hit it from the side or behind. Step off the charge line. If it charges into something it can't break, it hurts itself and falls down for a few seconds. | +| Pyromaniac | A scorched criminal in a fire suit and gas mask, a flamethrower in one hand and a molotov in the other | Goes for whoever shoots it. Hoses a line of fire up to 3 tiles out with its flamethrower; every few sweeps the tank runs dry and it stops for a few seconds to change it, and throws molotovs that leave burning floor. Shot from further off, it throws one of its two smoke grenades halfway to you and comes through the cloud. Its fire suit keeps the flames off it and its mask keeps the smoke out. | Keep your distance and keep moving. Stay more than 3 tiles away, off its line and off burning floor. Hit it while it changes tanks. Back out of the smoke before it reaches you: without internals or a gas mask you cough and drop what you're holding. Watch the cloud from the side, or see through it with thermals. If you catch fire, stop, drop and roll, or use an extinguisher. | +| Demolitionist | A criminal in a hard hat with a grenade bandolier | Keeps 4 to 6 tiles away and throws grenades with a blinking fuse. Blows holes in interior walls and doors to reach you behind cover. An implant gets it back up a second after you first drop it. | Close the distance, and move off the blinking ring. Put it down again and cuff it; an EMP knocks the implant out. | +| Ghost | A hooded criminal with a combat knife | Fast. Dashes in with knife cuts that bleed, cloaks into a shimmer, and backs off after two cuts. Shot from afar, it ducks out of your line and comes back from cover. Its implants make shots miss now and then while it moves, much more often during its burst of speed. | A flash or a hit breaks the cloak, and an EMP ends the burst. Shoot it when it stops moving. Corner it; hunters on more sides leave it nowhere to hide. | +| Heavy | A heavily armed criminal in a hooded coat, with a belt-fed gun | An ablative coat and hood turn aside about half of laser and disabler shots. Shows a laser sight and a red cone, then fires a burst into it. Throws barrier grenades that open into a barricade. | Get out of the red cone before it fires. Go around the barricade. Use bullets, or bring a lot of disablers. | +| Cyberpsycho (rare) | A twitching criminal in shorts, chrome on its arms, chest and legs | Fights with a blade from its forearm. Lunges down a lit line, leaps onto you under a red mark, and throws a piston punch. Its chrome fist breaks windows. Hurt, or hit with a stun weapon, it roars and shrugs off stuns for a while, then collapses. Gets up once after it goes down. | Get off the line and out from under the mark. Back off while it roars, and cuff it when it collapses. An EMP makes its chrome spark and shuts it down for a while, and then it tires like the others. | !!! warning "Worn out means switch to stuns" A mini-boss in critical condition only pays 60% on the pad. Once it's worn out, stun it and cuff it, or patch it up before you turn it in. @@ -142,8 +143,8 @@ Criminals are people. They bleed, break bones, fall into critical condition and - **Dragging and carrying** work as on anyone. A criminal who can still move pulls free of a grab or squirms off your shoulders. - **No shortcuts.** Criminals can't be teleported. Transporters won't beam a locker, crate or bag with a living one inside, fultons won't attach to them, and a bluespace body bag won't fold while someone alive is struggling inside. Carry them to your ship. - **Patching up.** Some criminals carry bandages or medipens and use them when nobody is shooting at them. -- **Space suits.** At space ruins, and on planets where the air would kill them, criminals and their companions arrive in space suits: soft ones for Petty criminals and companions, armoured ones for Wanted criminals, and each mini-boss its own. A criminal's suit can't be taken off them, like the rest of their gear. Out of a suit where the air kills, they suffocate and freeze like anyone. -- **Suiting up a catch.** To carry a criminal across vacuum, put your own space suit and helmet on them through the strip menu once they're down, cuffed or stunned. Yours goes on in place of theirs, and can come off again. +- **Space suits.** At space ruins, and on planets where the air would kill them, criminals and their companions arrive in space suits: soft ones for Petty criminals and companions, armoured ones for Wanted criminals, and a MODsuit for each mini-boss. A mini-boss in a MODsuit has no coat or riot plates over it. A criminal's suit can't be taken off them, like the rest of their gear. Out of a suit where the air kills, they suffocate and freeze like anyone. +- **Suiting up a catch.** To carry a criminal across vacuum, put your own space suit and helmet on them through the strip menu once they're down, cuffed or stunned. Yours goes on in place of theirs, and can come off again. On a MODsuit, theirs comes off whole. !!! tip "Bring cuffs and a stun" A stun only lasts a little while. Have the cuffs in hand before you stun them. diff --git a/wiki/content/pirates-and-npc-ships.md b/wiki/content/pirates-and-npc-ships.md index f1650dc6dde..29a71f0f616 100644 --- a/wiki/content/pirates-and-npc-ships.md +++ b/wiki/content/pirates-and-npc-ships.md @@ -82,3 +82,4 @@ The one exception is dispatched rather than roaming: **NTSV Vigilant**, a Nanotr - Paying is often cheaper than the repair bill. - If you intend to fight, do it in the Lawless Zone with shields up and your own [weapons](ship-combat.md) built. Getting jumped in the Contested Zone with no interdictor means you cannot chase, cannot board and cannot shoot back. - Bring guns before you board. Their crew does not stop being dangerous because their ship stopped moving. +- Pirate gunners hit by stun shots duck behind cover and look out again a moment later; their melee fighters and shotgunners charge whoever shot them. From 71c90cb1e63a69c9e93c34c95ac55079b0fb8af0 Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Mon, 16 Nov 2026 01:50:36 -0800 Subject: [PATCH 18/29] Burnt-out chrome is a scrap row both ripperdocs buy It was a ripperdoc trade-in row, and those buy back shelf stock; no shelf sells burnt chrome. Splice and Ratchet both take it as scrap now. --- voidcrew/modules/cyberware/ripperdoc_catalog.dm | 10 +++++++--- voidcrew/modules/cyberware/street_doc_catalog.dm | 1 + voidcrew/modules/unit_tests/voidcrew_cyberware.dm | 8 +++++++- voidcrew/modules/unit_tests/voidcrew_cyberware_npcs.dm | 4 +++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/voidcrew/modules/cyberware/ripperdoc_catalog.dm b/voidcrew/modules/cyberware/ripperdoc_catalog.dm index 226d1199621..19c053cba8f 100644 --- a/voidcrew/modules/cyberware/ripperdoc_catalog.dm +++ b/voidcrew/modules/cyberware/ripperdoc_catalog.dm @@ -178,7 +178,7 @@ /datum/shop_buyback/ripperdoc/cargo_cavity, /datum/shop_buyback/ripperdoc/gastro, /datum/shop_buyback/ripperdoc/chromatic_dermis, - /datum/shop_buyback/ripperdoc/burnt_chrome, + /datum/shop_buyback/burnt_chrome, ) trader_lines = list( TRADER_LINE_GREETING = list( @@ -730,9 +730,10 @@ /** * Dead chrome off a dead (or opened-up) human NPC (/obj/item/burnt_chrome, human_npc.dm). Scrap money only: * 50 cr is a fifth of the cheapest piece Splice sells for credits, so burning out bought chrome in a captive - * to sell the husk is always a loss, and the round's demand caps it. + * to sell the husk is always a loss, and the round's demand caps it. Not a ripperdoc trade-in row: those + * buy back shelf stock, and no shelf sells burnt chrome. */ -/datum/shop_buyback/ripperdoc/burnt_chrome +/datum/shop_buyback/burnt_chrome name = "Burnt-out chrome" desc = "Dead implants. Splice strips them for the parts that didn't melt." category = "Scrap" @@ -740,3 +741,6 @@ pay_credits = 50 demand_min = 4 demand_max = 8 + +/datum/shop_buyback/burnt_chrome/street_doc + desc = "Dead implants. Ratchet melts them down for the metal." diff --git a/voidcrew/modules/cyberware/street_doc_catalog.dm b/voidcrew/modules/cyberware/street_doc_catalog.dm index 40d0ba79934..70c2820dd94 100644 --- a/voidcrew/modules/cyberware/street_doc_catalog.dm +++ b/voidcrew/modules/cyberware/street_doc_catalog.dm @@ -102,6 +102,7 @@ // CYBERWARE LINES: T2 SKUS END ) buyback_types = list( + /datum/shop_buyback/burnt_chrome/street_doc, /datum/shop_buyback/ripperdoc/nightshade/street_doc, /datum/shop_buyback/ripperdoc/shock_coils/street_doc, /datum/shop_buyback/ripperdoc/second_wind/street_doc, diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware.dm index 15ec4e9376b..17de1d2c9a2 100644 --- a/voidcrew/modules/unit_tests/voidcrew_cyberware.dm +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware.dm @@ -369,7 +369,7 @@ var/datum/bank_account/account = allocate(/datum/bank_account, "Burnt chrome test", null, 1, FALSE) id.registered_account = account TEST_ASSERT(seller.put_in_hands(id), "The seller could not hold their ID") - var/datum/shop_buyback/ripperdoc/burnt_chrome/ledger = allocate(/datum/shop_buyback/ripperdoc/burnt_chrome) + var/datum/shop_buyback/burnt_chrome/ledger = allocate(/datum/shop_buyback/burnt_chrome) ledger.demand = 2 var/datum/outpost_shop/vendor/ripperdoc/splice = allocate(/datum/outpost_shop/vendor/ripperdoc) var/takes_burnt = FALSE @@ -377,6 +377,12 @@ if(intake.type == ledger.type) takes_burnt = TRUE TEST_ASSERT(takes_burnt, "Splice doesn't take burnt-out chrome") + var/datum/outpost_shop/vendor/street_doc/ratchet = allocate(/datum/outpost_shop/vendor/street_doc) + var/ratchet_takes_burnt = FALSE + for(var/datum/shop_buyback/intake as anything in ratchet.buybacks) + if(istype(intake, /datum/shop_buyback/burnt_chrome)) + ratchet_takes_burnt = TRUE + TEST_ASSERT(ratchet_takes_burnt, "Ratchet doesn't take burnt-out chrome") for(var/datum/shop_sku/sku as anything in subtypesof(/datum/shop_sku/ripperdoc)) var/price = initial(sku.price_credits) if(price > 0) diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware_npcs.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware_npcs.dm index 6a16bdef6ff..c3889e8e285 100644 --- a/voidcrew/modules/unit_tests/voidcrew_cyberware_npcs.dm +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware_npcs.dm @@ -68,12 +68,14 @@ TEST_ASSERT(!length(loose_chrome()), "A dead NPC left working chrome behind") TEST_ASSERT_EQUAL(scrap_count(), 3, "A dead NPC didn't leave one burnt-out scrap per piece") - // The scrap is no chrome: nothing can install it, and no ledger anywhere buys it. + // The scrap is no chrome: nothing can install it, and only the scrap rows buy it. var/obj/item/burnt_chrome/scrap = locate() in range(6, run_loc_floor_bottom_left) TEST_ASSERT_NOTNULL(scrap, "Fixture: no scrap to offer") TEST_ASSERT(!istype(scrap, /obj/item/organ), "Burnt-out chrome is still an organ") TEST_ASSERT_NULL(scrap.GetComponent(/datum/component/cyberware), "Burnt-out chrome still counts as chrome") for(var/buyback_type in subtypesof(/datum/shop_buyback)) + if(ispath(buyback_type, /datum/shop_buyback/burnt_chrome)) + continue var/datum/shop_buyback/ledger = new buyback_type if(ledger.item_path && ledger.matches(scrap)) TEST_FAIL("[buyback_type] buys burnt-out chrome") From 639d8d6b5b860ff53bc4bab0df6a35621530d150 Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Mon, 16 Nov 2026 01:50:37 -0800 Subject: [PATCH 19/29] A Widowline hit draws nothing over its target The wire's slash is not in the icon sheet. Neither wire plays an impact or tg's flying spool on what it hits. --- voidcrew/modules/cyberware/cyberware_anim.dm | 15 ++------------ .../unit_tests/voidcrew_cyberware_anim2.dm | 20 +++++++------------ 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/voidcrew/modules/cyberware/cyberware_anim.dm b/voidcrew/modules/cyberware/cyberware_anim.dm index 24a6049bc42..25958330faa 100644 --- a/voidcrew/modules/cyberware/cyberware_anim.dm +++ b/voidcrew/modules/cyberware/cyberware_anim.dm @@ -342,25 +342,14 @@ /obj/item/melee/energy/blade/hardlight/cyberware_mantis/scorch impact_state = "impact_scorch" -/obj/item/melee/cyberware_monowire - /// What a hit with this wire plays over its target, in place of tg's flying spool. - var/impact_state = "impact_widowline" - -/obj/item/melee/cyberware_monowire/live - // A landed Arc hit already lashes, crackles and bursts (cyberware_anim2.dm), so no impact goes on top. - impact_state = null - // The swinger's lunge stays; only the picture over the target changes. /obj/item/melee/energy/blade/hardlight/cyberware_mantis/animate_attack(atom/movable/attacker, atom/attacked_atom, animation_type) if(!cyberware_play_impact(attacker, attacked_atom, impact_state)) return ..() +// No picture over what a wire hits, nor tg's flying spool: the lash from the hand is its picture +// (hyperviolence/wire/wire_held.dm). Walls and floors keep tg's own. /obj/item/melee/cyberware_monowire/animate_attack(atom/movable/attacker, atom/attacked_atom, animation_type) - if(!cyberware_play_impact(attacker, attacked_atom, impact_state)) - return ..() - -// Nor tg's flying spool in its place: the Arc's shock is its picture. Walls and floors keep tg's own. -/obj/item/melee/cyberware_monowire/live/animate_attack(atom/movable/attacker, atom/attacked_atom, animation_type) if(!ismovable(attacked_atom)) return ..() diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware_anim2.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware_anim2.dm index 48bca84064a..b602044256a 100644 --- a/voidcrew/modules/unit_tests/voidcrew_cyberware_anim2.dm +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware_anim2.dm @@ -327,21 +327,15 @@ TEST_ASSERT(!length(impact.overlays), "The Shiv's steel impact glows") qdel(impact) - var/obj/item/melee/cyberware_monowire/wire = allocate(/obj/item/melee/cyberware_monowire) - wire.animate_attack(west, east) - impact = locate() in east.vis_contents - TEST_ASSERT(impact && impact.icon_state == "impact_widowline", "A Widowline hit drew the wrong impact") - qdel(impact) - TEST_ASSERT(!(locate(/obj/effect/abstract/cyberware_anim) in east.vis_contents), "The impact stayed on its target") - - // The Arc's lash, crackle and burst are its picture: nothing goes on top, not even tg's flying spool. - wire = allocate(/obj/item/melee/cyberware_monowire/live) - wire.animate_attack(west, east) - TEST_ASSERT(!(locate(/obj/effect/abstract/cyberware_anim) in east.vis_contents), "A Widowline Arc hit drew an impact over its shock") - TEST_ASSERT(!(locate(/atom/movable/flick_visual) in east.vis_contents), "A Widowline Arc hit drew tg's flying spool") + // The wire's lash from the hand is its picture: nothing goes over the target, not even tg's flying spool. + for(var/wire_type in list(/obj/item/melee/cyberware_monowire, /obj/item/melee/cyberware_monowire/live)) + var/obj/item/melee/cyberware_monowire/wire = allocate(wire_type) + wire.animate_attack(west, east) + TEST_ASSERT(!(locate(/obj/effect/abstract/cyberware_anim) in east.vis_contents), "[wire_type] drew an impact over its target") + TEST_ASSERT(!(locate(/atom/movable/flick_visual) in east.vis_contents), "[wire_type] drew tg's flying spool") // Its shock is a crackle along the wire, never a lightning bolt from the wielder. - var/obj/item/melee/cyberware_monowire/live/arc = wire + var/obj/item/melee/cyberware_monowire/live/arc = allocate(/obj/item/melee/cyberware_monowire/live) arc.arc_visuals(east, west) var/list/drawn = list() for(var/obj/effect/ebeam/segment in get_turf(west)) From 761c6df4024791c08e4552c8ac805bd1e3df0a1e Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Mon, 16 Nov 2026 01:50:37 -0800 Subject: [PATCH 20/29] Chrome scan test: an itemized read rates street chrome T1 --- voidcrew/modules/unit_tests/voidcrew_cyberware.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware.dm index 17de1d2c9a2..f06d4cf146a 100644 --- a/voidcrew/modules/unit_tests/voidcrew_cyberware.dm +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware.dm @@ -253,7 +253,7 @@ // printable augments unrated, and skips what it can't see. var/itemized = jointext(cyberware_scan_readout(lab_rat, 2), "\n") TEST_ASSERT(findtext(itemized, uppertext(optics.name)), "An itemized chrome read didn't name the installed optics: [itemized]") - TEST_ASSERT(findtext(itemized, "STREET"), "An itemized chrome read didn't rate the street-grade optics: [itemized]") + TEST_ASSERT(findtext(itemized, "T1"), "An itemized chrome read didn't rate the street-grade optics: [itemized]") TEST_ASSERT(findtext(itemized, "UNRATED"), "An itemized chrome read rated a printable augment as parlor chrome: [itemized]") TEST_ASSERT(!findtext(itemized, uppertext(stash.name)), "An itemized chrome read named the ORGAN_HIDDEN Cargo Cavity: [itemized]") TEST_ASSERT(findtext(itemized, "SIGNATURES 2"), "An itemized chrome read miscounted the visible signatures: [itemized]") From 238f8315cad6f4c3e9096b4520ec27a1176c01a1 Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Mon, 16 Nov 2026 01:50:37 -0800 Subject: [PATCH 21/29] Zone shop test: expect the permissions of the new chrome models --- .../modules/unit_tests/voidcrew_zone_shops.dm | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/voidcrew/modules/unit_tests/voidcrew_zone_shops.dm b/voidcrew/modules/unit_tests/voidcrew_zone_shops.dm index 8d28f05a27a..0caa49ff801 100644 --- a/voidcrew/modules/unit_tests/voidcrew_zone_shops.dm +++ b/voidcrew/modules/unit_tests/voidcrew_zone_shops.dm @@ -54,6 +54,11 @@ /datum/shop_sku/favor/freight_beacon = 1, /datum/shop_sku/favor/fitter_gauntlets = 1, /datum/shop_sku/ripperdoc/nightshade = 1, + /datum/shop_sku/ripperdoc/cascade_street = 1, + /datum/shop_sku/ripperdoc/redline_street = 1, + /datum/shop_sku/ripperdoc/ghostskin_street = 1, + /datum/shop_sku/ripperdoc/governor_street = 1, + /datum/shop_sku/ripperdoc/mantis_street = 1, /datum/shop_sku/ripperdoc/fixers = 1, /datum/shop_sku/ripperdoc/dermal_mesh = 1, /datum/shop_sku/ripperdoc/hopper = 1, @@ -62,6 +67,14 @@ /datum/shop_sku/ripperdoc/deadeye = 1, /datum/shop_sku/ripperdoc/slipwire = 1, /datum/shop_sku/ripperdoc/prospector = 1, + /datum/shop_sku/ripperdoc/hardweave = 1, + /datum/shop_sku/ripperdoc/atlas_street = 1, + /datum/shop_sku/ripperdoc/slipwire_street = 1, + /datum/shop_sku/ripperdoc/doppler_street = 1, + /datum/shop_sku/ripperdoc/adrenal_pump = 1, + /datum/shop_sku/ripperdoc/hopper_street = 1, + /datum/shop_sku/ripperdoc/gorilla_street = 1, + /datum/shop_sku/ripperdoc/ronin_holdout = 1, /datum/shop_sku/black_market/c4 = 1, /datum/shop_sku/black_market/emp_grenade = 1, /datum/shop_sku/black_market/frag_grenade = 1, @@ -111,6 +124,11 @@ /datum/shop_sku/ripperdoc/atlas = 2, /datum/shop_sku/ripperdoc/gorilla = 2, /datum/shop_sku/ripperdoc/rigger = 2, + /datum/shop_sku/ripperdoc/cascade_milspec = 2, + /datum/shop_sku/ripperdoc/redline_milspec = 2, + /datum/shop_sku/ripperdoc/governor_milspec = 2, + /datum/shop_sku/ripperdoc/slipwire_milspec = 2, + /datum/shop_sku/ripperdoc/hopper_milspec = 2, /datum/shop_sku/fitter/rare/mod_emp_shield_advanced = 2, /datum/shop_sku/fitter/rare/mod_projectile_dampener = 2, /datum/shop_sku/black_market/mod_chassis_syndicate = 2, @@ -143,11 +161,13 @@ /datum/shop_sku/ripperdoc/governor_delete = 3, /datum/shop_sku/ripperdoc/redline = 3, /datum/shop_sku/ripperdoc/cascade = 3, + /datum/shop_sku/ripperdoc/mantis_scorch = 3, + /datum/shop_sku/ripperdoc/monowire_live = 3, ) /datum/unit_test/voidcrew_zone_shops/catalog/Run() var/list/expected = expected_tags() - TEST_ASSERT_EQUAL(length(expected), 117, "The retained permission catalog is incomplete") + TEST_ASSERT_EQUAL(length(expected), 137, "The retained permission catalog is incomplete") var/datum/voidcrew_crew_record/crew = allocate(/datum/voidcrew_crew_record) for(var/datum/shop_sku/sku_type as anything in subtypesof(/datum/shop_sku)) var/permission = expected[sku_type] || 0 From 180d4b656847279f72c2c2436debb6bdf3b27a0a Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Mon, 16 Nov 2026 01:50:59 -0800 Subject: [PATCH 22/29] Chrome scan test: an itemized read rates street chrome by its tier word --- voidcrew/modules/unit_tests/voidcrew_cyberware.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware.dm index 476f84ad2f6..3fc329ee96c 100644 --- a/voidcrew/modules/unit_tests/voidcrew_cyberware.dm +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware.dm @@ -253,7 +253,7 @@ // printable augments unrated, and skips what it can't see. var/itemized = jointext(cyberware_scan_readout(lab_rat, 2), "\n") TEST_ASSERT(findtext(itemized, uppertext(optics.name)), "An itemized chrome read didn't name the installed optics: [itemized]") - TEST_ASSERT(findtext(itemized, "T1"), "An itemized chrome read didn't rate the street-grade optics: [itemized]") + TEST_ASSERT(findtext(itemized, "STREET"), "An itemized chrome read didn't rate the street-grade optics: [itemized]") TEST_ASSERT(findtext(itemized, "UNRATED"), "An itemized chrome read rated a printable augment as parlor chrome: [itemized]") TEST_ASSERT(!findtext(itemized, uppertext(stash.name)), "An itemized chrome read named the ORGAN_HIDDEN Cargo Cavity: [itemized]") TEST_ASSERT(findtext(itemized, "SIGNATURES 2"), "An itemized chrome read miscounted the visible signatures: [itemized]") From 75fb5123c6bba372e4995593d796a7c5caa63fc9 Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Mon, 16 Nov 2026 01:51:14 -0800 Subject: [PATCH 23/29] Zone shop test: expect the permissions of the optics models --- voidcrew/modules/unit_tests/voidcrew_zone_shops.dm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/voidcrew/modules/unit_tests/voidcrew_zone_shops.dm b/voidcrew/modules/unit_tests/voidcrew_zone_shops.dm index 0caa49ff801..1e80bea671c 100644 --- a/voidcrew/modules/unit_tests/voidcrew_zone_shops.dm +++ b/voidcrew/modules/unit_tests/voidcrew_zone_shops.dm @@ -75,6 +75,7 @@ /datum/shop_sku/ripperdoc/hopper_street = 1, /datum/shop_sku/ripperdoc/gorilla_street = 1, /datum/shop_sku/ripperdoc/ronin_holdout = 1, + /datum/shop_sku/ripperdoc/longsight = 1, /datum/shop_sku/black_market/c4 = 1, /datum/shop_sku/black_market/emp_grenade = 1, /datum/shop_sku/black_market/frag_grenade = 1, @@ -129,6 +130,8 @@ /datum/shop_sku/ripperdoc/governor_milspec = 2, /datum/shop_sku/ripperdoc/slipwire_milspec = 2, /datum/shop_sku/ripperdoc/hopper_milspec = 2, + /datum/shop_sku/ripperdoc/deadeye_milspec = 2, + /datum/shop_sku/ripperdoc/lookout = 2, /datum/shop_sku/fitter/rare/mod_emp_shield_advanced = 2, /datum/shop_sku/fitter/rare/mod_projectile_dampener = 2, /datum/shop_sku/black_market/mod_chassis_syndicate = 2, @@ -167,7 +170,7 @@ /datum/unit_test/voidcrew_zone_shops/catalog/Run() var/list/expected = expected_tags() - TEST_ASSERT_EQUAL(length(expected), 137, "The retained permission catalog is incomplete") + TEST_ASSERT_EQUAL(length(expected), 140, "The retained permission catalog is incomplete") var/datum/voidcrew_crew_record/crew = allocate(/datum/voidcrew_crew_record) for(var/datum/shop_sku/sku_type as anything in subtypesof(/datum/shop_sku)) var/permission = expected[sku_type] || 0 From 46501706a8c5d2642b9e3f57c9344a9b1a334c5d Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Mon, 16 Nov 2026 02:04:03 -0800 Subject: [PATCH 24/29] Prison barricade test: take the mess table out of the smoothing queue before the flip The test flips the table straight after the map loads. tg's flip clears the table's smoothing but leaves it queued, and the queued smooth then crashes. --- voidcrew/modules/unit_tests/voidcrew_outpost_prison_bounty.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/voidcrew/modules/unit_tests/voidcrew_outpost_prison_bounty.dm b/voidcrew/modules/unit_tests/voidcrew_outpost_prison_bounty.dm index bde196469a9..70931ff447d 100644 --- a/voidcrew/modules/unit_tests/voidcrew_outpost_prison_bounty.dm +++ b/voidcrew/modules/unit_tests/voidcrew_outpost_prison_bounty.dm @@ -1266,6 +1266,8 @@ TEST_ASSERT(!table.is_flipped, "The table went over before the wind-up was done") // Over it goes, toward the warden, where it stood and unbroken. + // A table fresh off the map may still be queued for its first smooth, and tg's flip leaves it in that queue. + SSicon_smooth.remove_from_queues(table) TEST_ASSERT(move.finish_windup(move.pending_serial), "The heavy did not flip the table") TEST_ASSERT(table.is_flipped, "The table is not flipped") TEST_ASSERT_EQUAL(table.dir, EAST, "The table went over toward [dir2text(table.dir)], not toward the warden") From 774e495501d203a6ad940c39a1880667e1ef7cf7 Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Mon, 16 Nov 2026 02:04:30 -0800 Subject: [PATCH 25/29] Hunting lure: watch the beast's death and deletion with RegisterSignals RegisterSignal was given a list of two signals. --- voidcrew/modules/missions/missions/big_game_hunt.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/voidcrew/modules/missions/missions/big_game_hunt.dm b/voidcrew/modules/missions/missions/big_game_hunt.dm index 511c4d39225..18892459239 100644 --- a/voidcrew/modules/missions/missions/big_game_hunt.dm +++ b/voidcrew/modules/missions/missions/big_game_hunt.dm @@ -664,7 +664,7 @@ unwatch() watched_ref = WEAKREF(beast) RegisterSignal(beast, COMSIG_MOVABLE_MOVED, PROC_REF(on_beast_moved)) - RegisterSignal(beast, list(COMSIG_LIVING_DEATH, COMSIG_QDELETING), PROC_REF(on_beast_gone)) + RegisterSignals(beast, list(COMSIG_LIVING_DEATH, COMSIG_QDELETING), PROC_REF(on_beast_gone)) /obj/structure/hunting_lure_stake/proc/unwatch() var/mob/living/beast = watched_ref?.resolve() From 786a29433a8a8f94d0dd3cab3c131e7a86e99847 Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Mon, 16 Nov 2026 02:08:10 -0800 Subject: [PATCH 26/29] Mafia club mobsters do not go after someone their eyes cannot see through camo --- voidcrew/modules/bounties/bounty_lair_mafia.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/voidcrew/modules/bounties/bounty_lair_mafia.dm b/voidcrew/modules/bounties/bounty_lair_mafia.dm index 822e2d3d63c..8f7bfbc1936 100644 --- a/voidcrew/modules/bounties/bounty_lair_mafia.dm +++ b/voidcrew/modules/bounties/bounty_lair_mafia.dm @@ -777,6 +777,8 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms) /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 + if(cyberware_camo_hides(target, src)) // optical camo (cyberware_stealth.dm) + return FALSE var/turf/spot = get_turf(target) return spot && spot.z == z && get_dist(src, spot) <= BOUNTY_MOBSTER_CHASE From 5305bc4c70e8ba3f7f2c8ae7fbc41f48512ba831 Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Mon, 16 Nov 2026 02:10:08 -0800 Subject: [PATCH 27/29] Take the mobsters' camo check out of bounty chrome It belongs with the change that makes NPCs lose sight of camo, which has the test for it. --- voidcrew/modules/bounties/bounty_lair_mafia.dm | 2 -- 1 file changed, 2 deletions(-) diff --git a/voidcrew/modules/bounties/bounty_lair_mafia.dm b/voidcrew/modules/bounties/bounty_lair_mafia.dm index 4b45b10147b..a92c8eba507 100644 --- a/voidcrew/modules/bounties/bounty_lair_mafia.dm +++ b/voidcrew/modules/bounties/bounty_lair_mafia.dm @@ -779,8 +779,6 @@ GLOBAL_LIST_EMPTY(bounty_mafia_rooms) /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 - if(cyberware_camo_hides(target, src)) // optical camo (cyberware_stealth.dm) - return FALSE var/turf/spot = get_turf(target) return spot && spot.z == z && get_dist(src, spot) <= BOUNTY_MOBSTER_CHASE From 7ef244545fa6803f75ad83b0a74abca867fb7bbf Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Sun, 15 Nov 2026 16:08:27 -0800 Subject: [PATCH 28/29] Chrome wheel, Chrome button, chrome keybinds and optics zoom - The chrome wheel (V): a radial of every ability the bearer's chrome carries, one arc per body region, with cooldown, offline and deployed states on each chip. - Use chrome (Shift+V), Use OS chrome (Ctrl+V) and Arm chrome (Alt+V), all rebindable. - One Chrome button shows the pick and opens the wheel; chrome abilities no longer get a button each. - Optics zoom on every chrome optic, from the wheel, further on better optics; no shooting while zoomed. - Five new optics: Spyglass, Assay optics, Longsight, Marksman link and Lookout, with shop stock, loot placement and gear ratings. - The cyberware matrix test and the opt-in soak test. --- tgstation.dme | 7 + tools/gear_catalog/ratings/organs.json | 45 + voidcrew/_DEFINES/keybindings.dm | 6 + voidcrew/modules/admin/chrome_test_kit.dm | 1 + voidcrew/modules/cyberware/chrome_hud.dm | 198 +++ voidcrew/modules/cyberware/chrome_wheel.dm | 1482 +++++++++++++++++ .../modules/cyberware/chrome_wheel_arms.dm | 111 ++ .../modules/cyberware/chrome_wheel_hud.dm | 142 ++ .../cyberware/chrome_wheel_keybindings.dm | 85 + voidcrew/modules/cyberware/cyberware_base.dm | 6 + voidcrew/modules/cyberware/cyberware_zoom.dm | 244 +++ .../modules/cyberware/icons/chrome_hud.dmi | Bin 0 -> 761 bytes .../modules/cyberware/icons/chrome_wheel.dmi | Bin 0 -> 1000 bytes .../cyberware/icons/chrome_wheel_ring.dmi | Bin 0 -> 29196 bytes .../modules/cyberware/ripperdoc_catalog.dm | 8 + .../modules/cyberware/street_doc_catalog.dm | 6 + voidcrew/modules/cyberware/ware_line_zoom.dm | 210 +++ .../modules/cyberware/ware_military_arms.dm | 5 +- voidcrew/modules/cyberware/ware_pro_combat.dm | 2 + .../modules/cyberware/ware_pro_utility.dm | 2 + voidcrew/modules/loot/themes/armory.dm | 4 + voidcrew/modules/loot/themes/expedition.dm | 6 + voidcrew/modules/loot/themes/research.dm | 4 + voidcrew/modules/loot/themes/wardrobe.dm | 2 + voidcrew/modules/unit_tests/_unit_tests.dm | 4 + .../unit_tests/voidcrew_chrome_wheel.dm | 473 ++++++ .../modules/unit_tests/voidcrew_cyberware.dm | 4 +- .../unit_tests/voidcrew_cyberware_matrix.dm | 775 +++++++++ .../unit_tests/voidcrew_cyberware_soak.dm | 935 +++++++++++ .../unit_tests/voidcrew_cyberware_zoom.dm | 368 ++++ wiki/content/cyberware.md | 4 + 31 files changed, 5136 insertions(+), 3 deletions(-) create mode 100644 voidcrew/modules/cyberware/chrome_hud.dm create mode 100644 voidcrew/modules/cyberware/chrome_wheel.dm create mode 100644 voidcrew/modules/cyberware/chrome_wheel_arms.dm create mode 100644 voidcrew/modules/cyberware/chrome_wheel_hud.dm create mode 100644 voidcrew/modules/cyberware/chrome_wheel_keybindings.dm create mode 100644 voidcrew/modules/cyberware/cyberware_zoom.dm create mode 100644 voidcrew/modules/cyberware/icons/chrome_hud.dmi create mode 100644 voidcrew/modules/cyberware/icons/chrome_wheel.dmi create mode 100644 voidcrew/modules/cyberware/icons/chrome_wheel_ring.dmi create mode 100644 voidcrew/modules/cyberware/ware_line_zoom.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_chrome_wheel.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_cyberware_matrix.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_cyberware_soak.dm create mode 100644 voidcrew/modules/unit_tests/voidcrew_cyberware_zoom.dm diff --git a/tgstation.dme b/tgstation.dme index 2c92d2beb2c..c497d823b59 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -7175,6 +7175,11 @@ #include "voidcrew\modules\cryo\despawn.dm" #include "voidcrew\modules\cryo\machine.dm" #include "voidcrew\modules\cyberware\chrome_cradle.dm" +#include "voidcrew\modules\cyberware\chrome_hud.dm" +#include "voidcrew\modules\cyberware\chrome_wheel.dm" +#include "voidcrew\modules\cyberware\chrome_wheel_arms.dm" +#include "voidcrew\modules\cyberware\chrome_wheel_hud.dm" +#include "voidcrew\modules\cyberware\chrome_wheel_keybindings.dm" #include "voidcrew\modules\cyberware\cradle_ui.dm" #include "voidcrew\modules\cyberware\cyberware_anim.dm" #include "voidcrew\modules\cyberware\cyberware_anim2.dm" @@ -7185,6 +7190,7 @@ #include "voidcrew\modules\cyberware\cyberware_scan.dm" #include "voidcrew\modules\cyberware\cyberware_scan_overlay.dm" #include "voidcrew\modules\cyberware\cyberware_stealth.dm" +#include "voidcrew\modules\cyberware\cyberware_zoom.dm" #include "voidcrew\modules\cyberware\parlor_fixtures.dm" #include "voidcrew\modules\cyberware\ripperdoc_catalog.dm" #include "voidcrew\modules\cyberware\street_doc_catalog.dm" @@ -7197,6 +7203,7 @@ #include "voidcrew\modules\cyberware\ware_line_models_a.dm" #include "voidcrew\modules\cyberware\ware_line_sandy.dm" #include "voidcrew\modules\cyberware\ware_line_widowline.dm" +#include "voidcrew\modules\cyberware\ware_line_zoom.dm" #include "voidcrew\modules\cyberware\ware_military_arms.dm" #include "voidcrew\modules\cyberware\ware_military_body.dm" #include "voidcrew\modules\cyberware\ware_models_b.dm" diff --git a/tools/gear_catalog/ratings/organs.json b/tools/gear_catalog/ratings/organs.json index 10e7be33481..c3b3e88ea39 100644 --- a/tools/gear_catalog/ratings/organs.json +++ b/tools/gear_catalog/ratings/organs.json @@ -487,6 +487,33 @@ "reason": "Tag a target and your next three shots curve onto it, every 25 s. Bullets stop missing for a burst, but the target gets a warning and walls stop it. Also zooms about 14 tiles out at a slight slowdown, though nobody can shoot while zoomed. Load 3, 2 vouchers at yellow reputation.", "tier": "yellow" }, + "/obj/item/organ/eyes/robotic/cyberware/deadeye/milspec": { + "confidence": "medium", + "group": "Eyes", + "hash": "", + "name": "marksman link", + "rank": 3, + "reason": "Tag a target and your next four shots curve onto it, every 18 s, out to 10 tiles. Also zooms the view about 19 tiles out at full speed, though nobody can shoot while zoomed. Load 4, 3 vouchers at advanced reputation.", + "tier": "red" + }, + "/obj/item/organ/eyes/robotic/cyberware/longsight": { + "confidence": "medium", + "group": "Eyes", + "hash": "", + "name": "longsight optics", + "rank": 9, + "reason": "Zooms the view about 19 tiles out at full speed and names implants out to 9 tiles. Scouting only, no help in a fight. Load 2, 2,400 cr at yellow reputation.", + "tier": "yellow" + }, + "/obj/item/organ/eyes/robotic/cyberware/lookout": { + "confidence": "medium", + "group": "Eyes", + "hash": "", + "name": "lookout optics", + "rank": 6, + "reason": "Zooms the view about 24 tiles out at full speed, sees in the dark, and names every implant on a body out to 11 tiles every 8 s. Pure scouting: no shooting while zoomed. Load 3, 3 vouchers at advanced reputation.", + "tier": "yellow" + }, "/obj/item/organ/eyes/robotic/cyberware/nightshade": { "confidence": "high", "group": "Eyes", @@ -506,6 +533,24 @@ "reason": "A pulse every 10 s shows ore through rock and loot caches within 9 tiles. Great for mining and ruin crews, no help in a fight. Also zooms about 14 tiles out at a slight slowdown. Load 2, 1 voucher at yellow reputation.", "tier": "yellow" }, + "/obj/item/organ/eyes/robotic/cyberware/prospector/street": { + "confidence": "high", + "group": "Eyes", + "hash": "", + "name": "assay optics", + "rank": 12, + "reason": "A 5-tile ore pulse through rock every 15 s with no cache marks, plus a short zoom that slows you. A cheap start for miners. Load 1, 900 cr.", + "tier": "green" + }, + "/obj/item/organ/eyes/robotic/cyberware/spyglass": { + "confidence": "high", + "group": "Eyes", + "hash": "", + "name": "spyglass optics", + "rank": 13, + "reason": "A short zoom, about 9 tiles, that slows you while you look, and a chrome read that only counts implants. Binoculars reach further but take both hands. Load 1, 400 cr.", + "tier": "green" + }, "/obj/item/organ/eyes/robotic/flashlight": { "confidence": "high", "group": "Eyes", diff --git a/voidcrew/_DEFINES/keybindings.dm b/voidcrew/_DEFINES/keybindings.dm index 921f55734d9..90380ab18c9 100644 --- a/voidcrew/_DEFINES/keybindings.dm +++ b/voidcrew/_DEFINES/keybindings.dm @@ -1,2 +1,8 @@ //Carbon #define COMSIG_KB_CARBON_TAKESHIPPART_DOWN "keybinding_carbon_takeshippart_down" + +//Cyberware (voidcrew/modules/cyberware/chrome_wheel_keybindings.dm) +#define COMSIG_KB_LIVING_CHROME_WHEEL_DOWN "keybinding_living_chrome_wheel_down" +#define COMSIG_KB_LIVING_USE_CHROME_DOWN "keybinding_living_use_chrome_down" +#define COMSIG_KB_LIVING_USE_OS_CHROME_DOWN "keybinding_living_use_os_chrome_down" +#define COMSIG_KB_LIVING_DEPLOY_ARM_CHROME_DOWN "keybinding_living_deploy_arm_chrome_down" diff --git a/voidcrew/modules/admin/chrome_test_kit.dm b/voidcrew/modules/admin/chrome_test_kit.dm index e562911d4ef..8ae937c8ac7 100644 --- a/voidcrew/modules/admin/chrome_test_kit.dm +++ b/voidcrew/modules/admin/chrome_test_kit.dm @@ -45,6 +45,7 @@ GLOBAL_LIST_INIT(chrome_test_loadouts, list( /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis/street/left, /obj/item/organ/cyberimp/cyberware/ghostskin/street, /obj/item/organ/cyberimp/cyberware/hopper/street, + /obj/item/organ/eyes/robotic/cyberware/spyglass, /obj/item/organ/cyberimp/cyberware/clotter_node, /obj/item/organ/cyberimp/cyberware/medic_palms, /obj/item/organ/cyberimp/cyberware/subvocal_mic, diff --git a/voidcrew/modules/cyberware/chrome_hud.dm b/voidcrew/modules/cyberware/chrome_hud.dm new file mode 100644 index 00000000000..c8c2a10b63c --- /dev/null +++ b/voidcrew/modules/cyberware/chrome_hud.dm @@ -0,0 +1,198 @@ +/** + * # Chrome on the HUD + * + * Chrome abilities are fired from the chrome wheel (chrome_wheel.dm), so none + * of them gets an action button of its own. One "Chrome" button stands in for + * all of them: it shows the pick (what Use chrome fires) with its cooldown and + * offline state, and a click opens the wheel. + * + * A chrome ability is any action whose target is installed chrome (an organ + * carrying /datum/component/cyberware), plus the wheel's own Arm chrome. Every + * other action, printable tg implants included, keeps its button. + * + * Hiding is tg's own way to keep an action without a button (the ninja dash, + * energy_katana.dm): GiveAction() does nothing for it. The action is still + * granted, so it keeps its owner, its keydown signal, its check_flags signals, + * its cooldown and its click intercepts, and Trigger() works as before. It + * just never joins anyone's actions list (so the HUD, observers and riders + * never see it) and never gets a button. Code that used to look for a chrome + * ability in mob.actions asks get_chrome_wheel_actions() instead. + * + * The chips on the wheel and the Chrome button still wear each ability's own + * button look: chrome_ability_look() builds a button that never goes on a + * screen and copies it. + */ + +/// Whether this action is a chrome ability: fired from the chrome wheel, never +/// given a button of its own. +/datum/action/proc/is_chrome_ability() + var/obj/item/organ/ware = target + return istype(ware) && !!ware.GetComponent(/datum/component/cyberware) + +/datum/action/GiveAction(mob/viewer) + if(is_chrome_ability()) + return + return ..() + +// GiveAction() is the only way in, but a button must never be built for one by any other road either. +/datum/action/ShowTo(mob/viewer) + if(is_chrome_ability()) + return + return ..() + +/datum/action/Grant(mob/grant_to) + . = ..() + if(owner && is_chrome_ability()) + chrome_hud_sync(owner, gained = TRUE) + +/datum/action/Remove(mob/remove_from) + // Grant() hands over by setting the new owner first, then removing the old one. + var/mob/losing = remove_from || owner + . = ..() + if(losing && is_chrome_ability()) + chrome_hud_sync(losing) + +/// A chrome ability's button would have been redrawn (a cooldown ticking, an +/// ability armed, a stun): the Chrome button redraws instead if it shows this one. +/datum/action/build_all_button_icons(update_flags = ALL, force) + . = ..() + if(owner && is_chrome_ability()) + var/datum/component/chrome_wheel/wheel = owner.GetComponent(/datum/component/chrome_wheel) + wheel?.on_ability_changed(src) + +/** + * Brings the bearer's Chrome button and Arm chrome up to date with the chrome + * they carry. [gained] makes the wheel if the body has none yet. + */ +/proc/chrome_hud_sync(mob/living/carbon/bearer, gained = FALSE) + if(!iscarbon(bearer) || QDELETED(bearer)) + return + var/datum/component/chrome_wheel/wheel = gained ? get_chrome_wheel(bearer) : bearer.GetComponent(/datum/component/chrome_wheel) + wheel?.sync_abilities() + +// ---- Ability looks ----------------------------------------------------- + +/// The last look built for this action's chip or Chrome button, and what it was built from. +/datum/action/var/tmp/mutable_appearance/chrome_look +/datum/action/var/tmp/chrome_look_key + +/// What an ability's look is built from. A change here rebuilds it. +/proc/chrome_ability_look_key(datum/action/ability) + var/atom/thing = isatom(ability.target) ? ability.target : null + return "[ability.button_icon]|[ability.button_icon_state]|[ability.overlay_icon_state]|[ability.name]|[thing?.icon]|[thing?.icon_state]|[length(thing?.overlays)]" + +/** + * An ability's own button look, without its background, text, tint or + * position: built on a button that never goes on a screen, so it carries the + * same icon and item overlay a button would. A fresh copy each call. + */ +/proc/chrome_ability_look(datum/action/ability) + RETURN_TYPE(/mutable_appearance) + var/key = chrome_ability_look_key(ability) + if(!ability.chrome_look || ability.chrome_look_key != key) + var/atom/movable/screen/movable/action_button/button = ability.create_button() + var/mutable_appearance/look = new(button) + qdel(button) + look.underlays = list() + look.plane = FLOAT_PLANE + look.layer = FLOAT_LAYER + look.pixel_x = 0 + look.pixel_y = 0 + look.pixel_w = 0 + look.pixel_z = 0 + look.screen_loc = null + look.maptext = null + look.color = null + look.alpha = 255 + look.transform = matrix() + look.appearance_flags = NONE + ability.chrome_look = look + ability.chrome_look_key = key + return new /mutable_appearance(ability.chrome_look) + +// ---- The Chrome button ------------------------------------------------- + +/// The pick's look, frame and anything else the Chrome button laid over itself. +/atom/movable/screen/movable/action_button/var/list/chrome_overlays + +/** + * The one HUD button chrome gets. Shows the wheel's pick framed in cyan, or + * the wheel itself with no pick; red like the pick's own button when it can't + * be used, with its cooldown in seconds and a lit background while it is out + * or armed. A click opens the wheel, and a chip clicked there is picked and fired. + */ +/datum/action/chrome_button + name = "Chrome" + button_icon = CHROME_HUD_ICON + button_icon_state = "chrome" + background_icon_state = "bg_tech_blue" + default_button_position = SCRN_OBJ_INSERT_FIRST + +/datum/action/chrome_button/proc/get_wheel() + RETURN_TYPE(/datum/component/chrome_wheel) + var/datum/component/chrome_wheel/wheel = target + return istype(wheel) ? wheel : null + +/// The ability the button shows, or null. +/datum/action/chrome_button/proc/get_pick() + return get_wheel()?.get_button_pick() + +/datum/action/chrome_button/Trigger(mob/clicker, trigger_flags) + . = ..() + if(!.) + return FALSE + if(clicker && clicker != owner) + return FALSE + var/datum/component/chrome_wheel/wheel = get_wheel() + if(!wheel) + return FALSE + wheel.button_clicked() + return TRUE + +/datum/action/chrome_button/create_button() + var/atom/movable/screen/movable/action_button/button = ..() + // Placed like a cooldown button's count. + button.maptext_x = 4 + button.maptext_y = 2 + button.maptext_width = 32 + button.maptext_height = 16 + return button + +/datum/action/chrome_button/is_action_active(atom/movable/screen/movable/action_button/current_button) + var/datum/action/pick = get_pick() + return pick && chrome_wheel_ability_active(pick, owner) + +/datum/action/chrome_button/apply_button_background(atom/movable/screen/movable/action_button/current_button, force) + // Lit while the pick is out or armed. + background_icon_state = is_action_active(current_button) ? "bg_tech_blue_active" : "bg_tech_blue" + return ..() + +/datum/action/chrome_button/apply_button_icon(atom/movable/screen/movable/action_button/current_button, force) + // With a pick, the pick's own look is laid over an empty button instead. + current_button.icon = get_pick() ? null : button_icon + current_button.icon_state = button_icon_state + +/datum/action/chrome_button/apply_button_overlay(atom/movable/screen/movable/action_button/current_button, force) + . = ..() + if(current_button.chrome_overlays) + current_button.cut_overlay(current_button.chrome_overlays) + current_button.chrome_overlays = null + var/datum/action/pick = get_pick() + if(!pick) + return + // No RESET_COLOR: the button's red goes over the pick, as it did on the pick's own button. + var/list/laid = list(chrome_ability_look(pick), chrome_wheel_marker("module_selected")) + current_button.add_overlay(laid) + current_button.chrome_overlays = laid + +/datum/action/chrome_button/update_button_status(atom/movable/screen/movable/action_button/current_button, force) + . = ..() + current_button.maptext = "" + var/datum/action/pick = get_pick() + if(!pick) + return + var/cooldown_left = chrome_wheel_cooldown_left(pick) + if(cooldown_left) + current_button.maptext = MAPTEXT_TINY_UNICODE("[CEILING(cooldown_left / 10, 1)]") + if(chrome_wheel_offline(pick) || !pick.IsAvailable()) + current_button.color = pick.transparent_when_unavailable ? rgb(128, 0, 0, 128) : rgb(128, 0, 0) diff --git a/voidcrew/modules/cyberware/chrome_wheel.dm b/voidcrew/modules/cyberware/chrome_wheel.dm new file mode 100644 index 00000000000..0e4a86c3f8a --- /dev/null +++ b/voidcrew/modules/cyberware/chrome_wheel.dm @@ -0,0 +1,1482 @@ +/** + * # Chrome wheel + * + * One wheel holding every ability the bearer's chrome carries, so nobody has + * to hunt a row of action buttons mid-fight. Three keybinds drive it + * (chrome_wheel_keybindings.dm): + * + * - Chrome wheel: hold it and the wheel opens at the centre of the view. Point + * at a chip and let go, or click one, to pick it. A quick tap leaves the + * wheel open for a click instead; pressing the key again shuts it. + * - Use chrome: fires the picked ability on key down. + * - Use OS chrome: fires the OS-slot ware's ability on key down, whatever is + * picked. + * + * A chip IS the bearer's existing /datum/action, fired through the same + * Trigger() a button click would use. Cooldowns, ORGAN_FAILING, check_flags + * and click-to-target modes are the ability's own, and nothing here copies or + * replaces one. Abilities are collected generically from every installed + * organ carrying /datum/component/cyberware, so new ware shows up without + * touching this file. Chrome abilities get no HUD button of their own + * (chrome_hud.dm): the wheel owns the one "Chrome" button that shows the pick + * and opens the wheel, and the Arm chrome ability (chrome_wheel_arms.dm) that + * deploys every arm at once. + * + * Looks: an outline of the bearer's body inside a ring cut into one arc per + * body region. Each ware sits in a socket (chrome_wheel_socket()), a run of + * fixed positions on its region's arc, with a leader line from the socket to + * the part of the body it lives in. A socket's chrome changing never moves + * another socket's chips, and an empty socket keeps a dim outline. Pointing at + * a chip grows it and lights its arc, its leader and its body part in its + * tier's colour, and a fixed readout under the ring names it. The pick wears + * the chrome read's corner brackets, and the Chrome button shows it in the + * MOD-style "selected" frame on the HUD. + * + * Pointing is by bearing from the ring's centre, so a flick outward picks the + * chip in that direction without landing on it. Inside the body nothing is + * pointed at. + * + * Sub-options: an ability can offer choices through + * /datum/action/proc/chrome_wheel_options(), empty by default. The wheel does + * not show them; a pick made with select(ability, option_id) makes Use chrome + * call the ability's use_chrome_wheel_option() with that id instead of Trigger(). + * + * Mouse handling: BYOND only reports the mouse over things it can hit, so the + * open wheel lays a full-view cursor catcher (tg's, as the scope uses) under + * its mouse-transparent pieces. Every move and click lands on the catcher, and + * the chip is worked out from where the mouse is relative to the centre. + */ + +// Readout panel under the ring, in pixels from the bottom left of the centre +// tile (y up). The panel's top edge, left edge and size. +#define CHROME_WHEEL_READOUT_TOP -108 +#define CHROME_WHEEL_READOUT_LEFT -66 +#define CHROME_WHEEL_READOUT_WIDTH 164 +#define CHROME_WHEEL_READOUT_HEIGHT 25 + +/// Organ slots that sort first inside their socket, in this order. Any other +/// slot follows them, alphabetically by slot name. +GLOBAL_LIST_INIT(chrome_wheel_slot_order, list( + ORGAN_SLOT_EYES, + ORGAN_SLOT_CYBERWARE_EARS, + ORGAN_SLOT_CYBERWARE_RIGGER, + ORGAN_SLOT_CYBERWARE_REGISTRY, + ORGAN_SLOT_CYBERWARE_OS, + ORGAN_SLOT_CYBERWARE_SKIN, + ORGAN_SLOT_CYBERWARE_FILTER, + ORGAN_SLOT_CYBERWARE_STASH, + ORGAN_SLOT_CYBERWARE_LEGS, +)) + +/** + * Where each socket's chips sit on the ring. "start" is the bearing of its + * first chip in degrees clockwise from twelve o'clock, "turn" the way the rest + * follow (1 clockwise, -1 counter-clockwise), "fits" how many its arc holds + * before another row starts further out. "arc" is the ring arc it lights and + * "region" the body part. The art in chrome_wheel_ring.dmi is drawn to match. + */ +GLOBAL_LIST_INIT(chrome_wheel_sockets, list( + CHROME_WHEEL_SOCKET_EYES = list("start" = -9, "turn" = -1, "fits" = 2, "arc" = "head", "region" = "head"), + CHROME_WHEEL_SOCKET_HEAD = list("start" = 9, "turn" = 1, "fits" = 2, "arc" = "head", "region" = "head"), + CHROME_WHEEL_SOCKET_OS = list("start" = 47, "turn" = 1, "fits" = 2, "arc" = "os", "region" = "spine"), + CHROME_WHEEL_SOCKET_RIGHT_ARM = list("start" = 83, "turn" = 1, "fits" = 4, "arc" = "r_arm", "region" = "r_arm"), + CHROME_WHEEL_SOCKET_LEGS = list("start" = 180, "turn" = 1, "fits" = 3, "arc" = "legs", "region" = "legs"), + CHROME_WHEEL_SOCKET_LEFT_ARM = list("start" = -83, "turn" = -1, "fits" = 4, "arc" = "l_arm", "region" = "l_arm"), + CHROME_WHEEL_SOCKET_SKIN = list("start" = -47, "turn" = -1, "fits" = 2, "arc" = "skin", "region" = "torso"), +)) + +/// Positions a socket holds for one organ slot, filled or not, so the rest of +/// that socket never moves when the slot is filled or emptied. Socket => +/// list(slot, positions held). The OS owns the first chip of its arc. Chrome +/// optics own the first three of theirs (their own ability, the chrome read and +/// the zoom, cyberware_zoom.dm); the third starts the eyes' second row. Arm +/// chrome (chrome_wheel_arms.dm) owns the top of the right arm's arc, where it +/// meets the torso. +GLOBAL_LIST_INIT(chrome_wheel_reserved, list( + CHROME_WHEEL_SOCKET_OS = list(ORGAN_SLOT_CYBERWARE_OS, 1), + CHROME_WHEEL_SOCKET_EYES = list(ORGAN_SLOT_EYES, 3), + CHROME_WHEEL_SOCKET_RIGHT_ARM = list(CHROME_WHEEL_ARMS_KEY, 1), +)) + +// ---- Collection -------------------------------------------------------- + +/** + * Every ability the bearer's installed chrome gives them, then Arm chrome if + * they have it. Offline ware stays in (it shows dark, and firing it gives the + * ability's own feedback); ware that is not in the body has no owner on its + * actions and drops out on its own. + */ +/proc/get_chrome_wheel_actions(mob/living/carbon/bearer) + RETURN_TYPE(/list) + . = list() + for(var/obj/item/organ/ware as anything in get_installed_cyberware(bearer)) + for(var/datum/action/ability in ware.actions) + if(QDELETED(ability) || ability.owner != bearer || !ability.owner_has_control) + continue + . += ability + var/datum/component/chrome_wheel/wheel = bearer?.GetComponent(/datum/component/chrome_wheel) + var/datum/action/chrome_arms/arms = wheel?.arm_action + if(arms && !QDELETED(arms) && arms.owner == bearer) + . += arms + +/// The ability of whatever OS-slot chrome the bearer runs, or null. +/proc/get_os_chrome_action(mob/living/carbon/bearer) + for(var/obj/item/organ/ware as anything in get_installed_cyberware(bearer)) + if(ware.slot != ORGAN_SLOT_CYBERWARE_OS) + continue + for(var/datum/action/ability in ware.actions) + if(!QDELETED(ability) && ability.owner == bearer && ability.owner_has_control) + return ability + return null + +/// The bearer's chrome wheel, made on first use. Null for a body with no chrome +/// abilities and no wheel yet, so a plain body never grows the component. +/proc/get_chrome_wheel(mob/living/carbon/bearer) + if(!iscarbon(bearer)) + return null + var/datum/component/chrome_wheel/wheel = bearer.GetComponent(/datum/component/chrome_wheel) + if(wheel || !length(get_chrome_wheel_actions(bearer))) + return wheel + wheel = bearer.AddComponent(/datum/component/chrome_wheel) + wheel?.sync_abilities() + return wheel + +// ---- Sub-option hooks -------------------------------------------------- + +/** + * One choice an ability offers. [id] must stay the same between calls for the + * same choice: the wheel remembers a pick by id and asks the ability for its + * options again before firing it. + */ +/datum/chrome_wheel_option + /// Stable key for this choice within its ability. Non-empty text: a false + /// id reads as "no option" and would fire the ability itself. + var/id + /// What the readout calls the pick. + var/name + var/icon + var/icon_state + +/datum/chrome_wheel_option/New(id, name, icon, icon_state) + src.id = id + src.name = name + src.icon = icon + src.icon_state = icon_state + +/** + * Choices this ability offers on top of firing it plainly: a list of + * /datum/chrome_wheel_option, or null for none (the default, and every ability + * today). + */ +/datum/action/proc/chrome_wheel_options(mob/living/carbon/bearer) + RETURN_TYPE(/list) + return null + +/** + * Fires one of this ability's chrome wheel sub-options. The default fires the + * ability itself; an override stashes the choice first, then calls Trigger() + * so the button's availability checks and targeting still apply. + */ +/datum/action/proc/use_chrome_wheel_option(mob/living/carbon/bearer, option_id) + return Trigger(bearer) + +/// The option with this id that the ability offers right now, or null. +/proc/chrome_wheel_find_option(datum/action/ability, mob/living/carbon/bearer, option_id) + for(var/datum/chrome_wheel_option/option in ability?.chrome_wheel_options(bearer)) + if(option.id == option_id) + return option + return null + +// ---- Names ------------------------------------------------------------- + +/** + * What the wheel calls this ability: its own name, or for a ware's plain + * deploy or use button, the ware without its housing ("Mantis Blade", not + * "Toggle Mantis Blade housing (left)"). Override for a better one. + */ +/datum/action/proc/chrome_wheel_name() + var/obj/item/organ/ware = target + if(istype(ware) && (istype(src, /datum/action/item_action/organ_action/toggle) || istype(src, /datum/action/item_action/organ_action/use))) + var/static/regex/hardware = regex(@"(\s+(spool\s+)?housing|\s+drill fist)?(\s*\((left|right)\))?$", "i") + return hardware.Replace(format_text(ware.name), "") + return format_text(name) + +/// The name of the chrome an ability lives in, or "" for one that lives in nothing. +/proc/chrome_wheel_ware_name(datum/action/ability) + var/obj/item/organ/ware = ability?.target + return istype(ware) ? format_text(ware.name) : "" + +/// Display names, ability => text. +/proc/chrome_wheel_names(list/abilities) + RETURN_TYPE(/list) + . = list() + for(var/datum/action/ability as anything in abilities) + .[ability] = ability.chrome_wheel_name() + +// ---- Layout ------------------------------------------------------------ + +/// Which socket an organ's abilities sit in, from its slot and the zone it lives in. +/proc/chrome_wheel_socket(obj/item/organ/ware) + if(!istype(ware)) + return CHROME_WHEEL_SOCKET_OS + if(ware.slot == ORGAN_SLOT_EYES || ware.zone == BODY_ZONE_PRECISE_EYES) + return CHROME_WHEEL_SOCKET_EYES + if(ware.slot == ORGAN_SLOT_CYBERWARE_OS) + return CHROME_WHEEL_SOCKET_OS + if(ware.slot == ORGAN_SLOT_CYBERWARE_SKIN) + return CHROME_WHEEL_SOCKET_SKIN + switch(ware.zone) + if(BODY_ZONE_HEAD, BODY_ZONE_PRECISE_MOUTH) + return CHROME_WHEEL_SOCKET_HEAD + if(BODY_ZONE_R_ARM, BODY_ZONE_PRECISE_R_HAND) + return CHROME_WHEEL_SOCKET_RIGHT_ARM + if(BODY_ZONE_L_ARM, BODY_ZONE_PRECISE_L_HAND) + return CHROME_WHEEL_SOCKET_LEFT_ARM + if(BODY_ZONE_R_LEG, BODY_ZONE_L_LEG, BODY_ZONE_PRECISE_R_FOOT, BODY_ZONE_PRECISE_L_FOOT) + return CHROME_WHEEL_SOCKET_LEGS + // The chest and anything else: the OS's arc, after the OS. + return CHROME_WHEEL_SOCKET_OS + +/// Which socket an ability's chip sits in: its chrome's, or for Arm chrome the right arm's. +/proc/chrome_wheel_ability_socket(datum/action/ability) + if(istype(ability, /datum/action/chrome_arms)) + return CHROME_WHEEL_SOCKET_RIGHT_ARM + return chrome_wheel_socket(ability.target) + +/// What claims an ability a reserved position (GLOB.chrome_wheel_reserved): +/// its chrome's organ slot, or CHROME_WHEEL_ARMS_KEY for Arm chrome. +/proc/chrome_wheel_reserve_key(datum/action/ability) + if(istype(ability, /datum/action/chrome_arms)) + return CHROME_WHEEL_ARMS_KEY + var/obj/item/organ/ware = ability.target + return istype(ware) ? ware.slot : null + +/// Hand chrome rides its arm's socket, after the arm's own chrome, with its +/// own leader to the hand. +/proc/chrome_wheel_is_hand(obj/item/organ/ware) + if(!istype(ware)) + return FALSE + return ware.slot == ORGAN_SLOT_CYBERWARE_HANDS || ware.zone == BODY_ZONE_PRECISE_L_HAND || ware.zone == BODY_ZONE_PRECISE_R_HAND + +/// Where an organ slot ranks inside its socket. Unlisted slots rank last. +/proc/chrome_wheel_slot_rank(obj/item/organ/ware) + var/rank = istype(ware) ? GLOB.chrome_wheel_slot_order.Find(ware.slot) : 0 + return rank || length(GLOB.chrome_wheel_slot_order) + 1 + +/// Order inside a socket: hand chrome last, then ranked organ slots, other +/// slots by name, and each organ's own button order. +/proc/cmp_chrome_wheel_abilities(datum/action/first, datum/action/second) + var/obj/item/organ/first_ware = first.target + var/obj/item/organ/second_ware = second.target + // Abilities that live in no organ (Arm chrome) go last; their place is reserved anyway. + if(!isorgan(first_ware) || !isorgan(second_ware)) + return !isorgan(first_ware) - !isorgan(second_ware) + var/hand_gap = chrome_wheel_is_hand(first_ware) - chrome_wheel_is_hand(second_ware) + if(hand_gap) + return hand_gap + var/rank_gap = chrome_wheel_slot_rank(first_ware) - chrome_wheel_slot_rank(second_ware) + if(rank_gap) + return rank_gap + if(first_ware != second_ware) + var/first_slot = istype(first_ware) ? first_ware.slot : "" + var/second_slot = istype(second_ware) ? second_ware.slot : "" + return sorttext(second_slot, first_slot) || sorttext(second.name, first.name) + return LAZYFIND(first_ware.actions, first) - LAZYFIND(second_ware.actions, second) + +/// How many chips the socket's arc holds before another row starts. +/proc/chrome_wheel_socket_fits(socket) + var/list/spec = GLOB.chrome_wheel_sockets[socket] + return spec ? spec["fits"] : 1 + +/** + * Pixel offset from the centre of the view of position [index] in [socket], + * as list(x, y). Positions run along the socket's arc CHROME_WHEEL_STEP + * degrees apart; once the arc is full they start again a row further out. + */ +/proc/chrome_wheel_position(socket, index) + RETURN_TYPE(/list) + var/list/spec = GLOB.chrome_wheel_sockets[socket] + var/fits = spec["fits"] + var/row = round((index - 1) / fits) + var/angle = spec["start"] + spec["turn"] * ((index - 1) % fits) * CHROME_WHEEL_STEP + var/radius = CHROME_WHEEL_RADIUS + row * CHROME_WHEEL_ROW_GAP + return list(round(sin(angle) * radius, 1), round(cos(angle) * radius + CHROME_WHEEL_CENTRE_Y, 1)) + +/** + * Sorts the abilities into sockets: ability => list("socket", "index", + * "hand"). Where an ability lands depends only on its own socket's chrome, + * never on what the rest of the body carries. + */ +/proc/chrome_wheel_placements(list/abilities) + RETURN_TYPE(/list) + var/list/by_socket = list() + for(var/datum/action/ability as anything in abilities) + var/socket = chrome_wheel_ability_socket(ability) + if(!by_socket[socket]) + by_socket[socket] = list() + var/list/members = by_socket[socket] + members += ability + var/list/placements = list() + for(var/socket in by_socket) + var/list/members = sortTim(by_socket[socket], GLOBAL_PROC_REF(cmp_chrome_wheel_abilities)) + var/list/reserved = GLOB.chrome_wheel_reserved[socket] + var/reserved_slot = length(reserved) ? reserved[1] : null + var/reserved_count = length(reserved) ? reserved[2] : 0 + var/next_reserved = 1 + var/next_free = reserved_count + 1 + for(var/datum/action/ability as anything in members) + var/obj/item/organ/ware = ability.target + var/index + if(reserved_slot && chrome_wheel_reserve_key(ability) == reserved_slot && next_reserved <= reserved_count) + index = next_reserved++ + else + index = next_free++ + placements[ability] = list("socket" = socket, "index" = index, "hand" = chrome_wheel_is_hand(ware)) + return placements + +/// Where each ability's chip sits: ability => list(x, y), from the centre of the view. +/proc/chrome_wheel_layout(list/abilities) + RETURN_TYPE(/list) + var/list/placements = chrome_wheel_placements(abilities) + . = list() + for(var/datum/action/ability as anything in placements) + var/list/placement = placements[ability] + .[ability] = chrome_wheel_position(placement["socket"], placement["index"]) + +// ---- Pointing ---------------------------------------------------------- + +/// Bearing of an offset from the centre of the view, as seen from the ring's +/// centre: degrees clockwise from twelve o'clock. +/proc/chrome_wheel_bearing(x, y) + return delta_to_angle(x, y - CHROME_WHEEL_CENTRE_Y) + +/** + * Which of [points] (a list of list(x, y) chip centres) the mouse at offset + * (dx, dy) means, as an index, or 0 for none. Inside the body nothing is + * pointed at. A chip right under the mouse is the one meant; anywhere else, + * the mouse points at the chip whose bearing from the ring's centre is + * nearest its own, so a quick flick outward works without landing on it. + * [on_ring], if given, says which points a bearing can pick (the first row); + * the rest only answer the mouse right on them. With [reach], a bearing only + * picks within that many pixels of the ring's centre. + */ +/proc/chrome_wheel_pick(dx, dy, list/points, list/on_ring, reach) + var/ring_y = dy - CHROME_WHEEL_CENTRE_Y + var/from_centre = sqrt(dx ** 2 + ring_y ** 2) + if(from_centre < CHROME_WHEEL_DEADZONE) + return 0 + var/nearest = 0 + var/nearest_gap = INFINITY + for(var/i in 1 to length(points)) + var/list/point = points[i] + var/gap = sqrt((point[1] - dx) ** 2 + (point[2] - dy) ** 2) + if(gap < nearest_gap) + nearest = i + nearest_gap = gap + if(nearest_gap <= CHROME_WHEEL_PICK_RANGE) + return nearest + if(reach && from_centre > reach) + return 0 + var/mouse_bearing = delta_to_angle(dx, ring_y) + var/pointed = 0 + var/pointed_turn = INFINITY + for(var/i in 1 to length(points)) + if(on_ring && !on_ring[i]) + continue + var/list/point = points[i] + var/turn = abs(WRAP(mouse_bearing - chrome_wheel_bearing(point[1], point[2]) + 180, 0, 360) - 180) + if(turn < pointed_turn) + pointed = i + pointed_turn = turn + return pointed_turn <= CHROME_WHEEL_POINT_TOLERANCE ? pointed : 0 + +/// The mouse position in a screen mouse params string, as pixels from the +/// centre of the viewer's map: list(x, y), or null if the params have none. +/proc/chrome_wheel_mouse_offset(params, client/viewer) + if(!viewer) + return null + var/list/modifiers = params2list(params) + var/screen_loc = LAZYACCESS(modifiers, SCREEN_LOC) + if(!screen_loc) + return null + var/list/pixels = screen_loc_to_offset(screen_loc, viewer.view) + var/list/view_pixels = view_to_pixels(viewer.view) + // screen_loc_to_offset counts tiles from 1, so the first tile starts a tile in. + return list(pixels[1] - ICON_SIZE_X - view_pixels[1] / 2, pixels[2] - ICON_SIZE_Y - view_pixels[2] / 2) + +/// The key a bind sits on, without its modifiers: "ShiftV" is held while "V" +/// is. Bare modifier binds ("Alt") stay as they are. +/proc/chrome_wheel_raw_key(full_key) + var/raw = full_key + var/last_modifier + for(var/modifier in list("Alt", "Ctrl", "Shift")) + if(findtextEx(raw, modifier) == 1) + raw = copytext(raw, length(modifier) + 1) + last_modifier = modifier + return raw || last_modifier + +// ---- Looks ------------------------------------------------------------- + +/// The radial.dmi "module_selected" frame the Chrome button puts round the pick, shared. +/proc/chrome_wheel_marker(frame_state) + var/static/list/markers = list() + if(!markers[frame_state]) + markers[frame_state] = mutable_appearance('icons/hud/radial.dmi', frame_state, FLOAT_LAYER - 0.1) + return markers[frame_state] + +/** + * What an ability's chip shows: the ability's own button look, minus the + * button background and text (chrome_ability_look(), chrome_hud.dm), so the + * chip carries the same icon and item overlay a button would. + */ +/proc/chrome_wheel_ability_look(datum/action/ability) + RETURN_TYPE(/mutable_appearance) + var/mutable_appearance/look = chrome_ability_look(ability) + // Keeps its own colour, follows the chip's pop, and shrinks smoothly. + look.appearance_flags = RESET_COLOR | NO_CLIENT_COLOR + return look + +/// Whether an ability is "on" right now: a toggled arm with its hardware out, +/// or a click-to-target ability armed and waiting for the click. +/proc/chrome_wheel_ability_active(datum/action/ability, mob/living/carbon/bearer) + // Arm chrome is on while any arm has its hardware out. + if(istype(ability, /datum/action/chrome_arms)) + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/housing as anything in get_chrome_arm_housings(bearer)) + if(housing.chrome_arm_deployed()) + return TRUE + return FALSE + // The zoom is a toggle, not a click-to-target: it is on while the optics are zoomed. + if(istype(ability, /datum/action/cooldown/cyberware/optics_zoom)) + var/datum/action/cooldown/cyberware/optics_zoom/zoom = ability + var/obj/item/organ/eyes/robotic/cyberware/optics = zoom.organ + return istype(optics) && optics.is_zoomed() + if(istype(ability, /datum/action/cooldown)) + return bearer.click_intercept == ability + var/obj/item/organ/cyberimp/arm/toolkit/arm = ability.target + if(istype(arm) && istype(ability, /datum/action/item_action/organ_action/toggle)) + return arm.active_item && !(arm.active_item in arm) + return FALSE + +/// Deciseconds left on an ability's cooldown, 0 for one that has none. +/proc/chrome_wheel_cooldown_left(datum/action/ability) + var/datum/action/cooldown/timed = ability + return istype(timed) ? max(timed.next_use_time - world.time, 0) : 0 + +/// Whether the chrome an ability lives in is down: rebooting from an EMP, or +/// browned out over capacity. Arm chrome is down when every arm is. +/proc/chrome_wheel_offline(datum/action/ability) + if(istype(ability, /datum/action/chrome_arms)) + var/list/housings = get_chrome_arm_housings(ability.owner) + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/housing as anything in housings) + var/datum/component/cyberware/arm_chrome = housing.GetComponent(/datum/component/cyberware) + if(arm_chrome?.is_running()) + return FALSE + return length(housings) > 0 + var/obj/item/organ/ware = ability.target + var/datum/component/cyberware/chrome = istype(ware) ? ware.GetComponent(/datum/component/cyberware) : null + return chrome && !chrome.is_running() + +/// Whether an ability can't be used right now for any other reason than its +/// chrome being down or its cooldown: its button's own checks say no. +/proc/chrome_wheel_unavailable(datum/action/ability, cooldown_left) + // On cooldown IsAvailable() is FALSE anyway; the shade shows that instead. + return !cooldown_left && !ability.IsAvailable() + +/// The tier colour of the chrome an ability lives in. Arm chrome wears the +/// colour of the best arm hardware it deploys. +/proc/chrome_wheel_tier_color(datum/action/ability) + if(istype(ability, /datum/action/chrome_arms)) + var/best_tier = 0 + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/housing as anything in get_chrome_arm_housings(ability.owner)) + var/datum/component/cyberware/arm_chrome = housing.GetComponent(/datum/component/cyberware) + best_tier = max(best_tier, arm_chrome?.tier || 0) + return best_tier ? cyberware_tier_color(best_tier) : CHROME_WHEEL_HUD_COLOR + var/obj/item/organ/ware = ability.target + var/datum/component/cyberware/chrome = istype(ware) ? ware.GetComponent(/datum/component/cyberware) : null + return chrome ? cyberware_tier_color(chrome.tier) : CHROME_WHEEL_HUD_COLOR + +/// [color] taken [amount] of the way to white. +/proc/chrome_wheel_lighten(color, amount) + var/list/channels = rgb2num(color) + return rgb(round(channels[1] + (255 - channels[1]) * amount), round(channels[2] + (255 - channels[2]) * amount), round(channels[3] + (255 - channels[3]) * amount)) + +/// One of the chip art states as an overlay that keeps its own colour. +/proc/chrome_wheel_chip_piece(piece_state, piece_color, piece_alpha = 255) + var/mutable_appearance/piece = mutable_appearance(CHROME_WHEEL_ICON, piece_state, FLOAT_LAYER, appearance_flags = RESET_COLOR | NO_CLIENT_COLOR | PIXEL_SCALE) + piece.color = piece_color + piece.alpha = piece_alpha + return piece + +/// Sorts chips clockwise from twelve o'clock, the order they pop in. +/proc/cmp_chrome_wheel_bearing(atom/movable/screen/chrome_wheel/chip/first, atom/movable/screen/chrome_wheel/chip/second) + return chrome_wheel_bearing(first.chip_x, first.chip_y) - chrome_wheel_bearing(second.chip_x, second.chip_y) + +// ---- The wheel --------------------------------------------------------- + +/datum/component/chrome_wheel + /// The ability Use chrome fires. + var/datum/weakref/selected_ref + /// The id of the sub-option of that ability Use chrome fires instead, if one was picked. + var/selected_option + /// The ability whose buttons carry the selection frame. + var/datum/weakref/marked_ref + /// CHROME_WHEEL_CLOSED, CHROME_WHEEL_HELD or CHROME_WHEEL_CLICK. + var/wheel_mode = CHROME_WHEEL_CLOSED + /// REALTIMEOFDAY when the wheel key went down. + var/press_time = 0 + /// The client the wheel is drawn on, so it comes off that screen even after + /// the client has moved to another mob. + var/client/shown_to + /// Screen-centre object every visible part of the wheel hangs off. + var/atom/movable/screen/chrome_wheel/hub/hub + /// Full-view mouse tracker under the wheel. + var/atom/movable/screen/fullscreen/cursor_catcher/chrome_wheel/catcher + /// Every screen object the open wheel made, for teardown. + var/list/parts + /// One chip per ability. + var/list/chips + /// Leader key => list("leader", "node", "node_state", "alpha"): the line + /// from a socket (or a hand chip) to the body, and its dot on the body. + var/list/leaders + /// Arc name => its piece of ring art. + var/list/arcs + /// The body part lit under the chip pointed at. + var/atom/movable/screen/chrome_wheel/art/glow + /// The chip the mouse is on. + var/atom/movable/screen/chrome_wheel/chip/highlighted + /// Readout lines, and the pick mark it shows when nothing is pointed at. + var/atom/movable/screen/chrome_wheel/readout/readout_title + var/atom/movable/screen/chrome_wheel/readout/readout_sub + var/atom/movable/screen/chrome_wheel/readout/readout_status + var/atom/movable/screen/chrome_wheel/readout/readout_mark + /// What the readout last showed. + var/readout_state + /// First mouse position reported after opening. Nothing is pointed at until + /// the mouse leaves it, so a cursor that was resting somewhere when the + /// key went down picks nothing by accident. + var/list/mouse_start + /// Whether the mouse has left [mouse_start]. + var/mouse_moved = FALSE + /// A closed wheel still fading out: its client, its pieces and the timer + /// that takes them away. + var/client/fading_client + var/list/fading_parts + var/fading_timer + /// The second body-part glow, for a chip that lights both arms. + var/atom/movable/screen/chrome_wheel/art/glow_twin + /// Opened from the Chrome button: a chip clicked is fired as well as picked. + var/fire_on_pick = FALSE + /// The one HUD button chrome gets (chrome_hud.dm), while any chrome has an ability. + var/datum/action/chrome_button/hud_button + /// Arm chrome (chrome_wheel_arms.dm), while there is arm hardware to deploy. + var/datum/action/chrome_arms/arm_action + /// What the Chrome button last showed, so it only redraws on a change. + var/button_state + /// Set while sync_abilities() runs: granting and removing actions calls back into it. + var/syncing = FALSE + +/datum/component/chrome_wheel/Initialize() + if(!iscarbon(parent)) + return COMPONENT_INCOMPATIBLE + +/datum/component/chrome_wheel/RegisterWithParent() + RegisterSignal(parent, COMSIG_MOB_LOGOUT, PROC_REF(on_logout)) + RegisterSignal(parent, COMSIG_MOB_STATCHANGE, PROC_REF(on_stat_change)) + // Things the Chrome button shows that no button redraw announces: chrome going + // down or coming back (checked every Life), an EMP, arm hardware in or out of a hand. + RegisterSignal(parent, COMSIG_LIVING_LIFE, PROC_REF(on_life)) + RegisterSignal(parent, COMSIG_ATOM_EMP_ACT, PROC_REF(on_emp)) + RegisterSignals(parent, list(COMSIG_MOB_EQUIPPED_ITEM, COMSIG_MOB_UNEQUIPPED_ITEM), PROC_REF(on_hands_changed)) + // A stun drops whatever chrome was armed, like death or passing out does. + RegisterSignal(parent, SIGNAL_ADDTRAIT(TRAIT_INCAPACITATED), PROC_REF(on_incapacitated)) + +/datum/component/chrome_wheel/UnregisterFromParent() + UnregisterSignal(parent, list(COMSIG_MOB_LOGOUT, COMSIG_MOB_STATCHANGE, COMSIG_LIVING_LIFE, COMSIG_ATOM_EMP_ACT, COMSIG_MOB_EQUIPPED_ITEM, COMSIG_MOB_UNEQUIPPED_ITEM, SIGNAL_ADDTRAIT(TRAIT_INCAPACITATED))) + +/datum/component/chrome_wheel/Destroy(force) + close_wheel() + clear_fading() + unmark() + selected_ref = null + QDEL_NULL(hud_button) + QDEL_NULL(arm_action) + return ..() + +/datum/component/chrome_wheel/proc/on_logout(datum/source) + SIGNAL_HANDLER + close_wheel() + clear_fading() + +/datum/component/chrome_wheel/proc/on_stat_change(datum/source, new_stat, old_stat) + SIGNAL_HANDLER + if(new_stat != CONSCIOUS) + disarm() + if(new_stat >= UNCONSCIOUS) + close_wheel() + refresh_button() + +/datum/component/chrome_wheel/proc/on_incapacitated(datum/source) + SIGNAL_HANDLER + disarm() + +/// Drops the aim of a chrome ability armed and waiting for its click. The cooldown is untouched. +/datum/component/chrome_wheel/proc/disarm() + var/mob/living/carbon/bearer = parent + var/datum/action/cooldown/cyberware/armed = bearer.click_intercept + if(istype(armed) && armed.owner == bearer) + armed.unset_click_ability(bearer, refund_cooldown = TRUE) + refresh_button() + +/datum/component/chrome_wheel/proc/on_life(datum/source, seconds_per_tick, times_fired) + SIGNAL_HANDLER + refresh_button() + +/datum/component/chrome_wheel/proc/on_emp(datum/source, severity, protection) + SIGNAL_HANDLER + // The chrome takes the pulse after the body's signal; look once it has. + addtimer(CALLBACK(src, PROC_REF(refresh_button)), 1, TIMER_UNIQUE | TIMER_OVERRIDE) + +/datum/component/chrome_wheel/proc/on_hands_changed(datum/source, obj/item/item) + SIGNAL_HANDLER + refresh_button() + +// ---- HUD --------------------------------------------------------------- + +/** + * Gives or takes the Chrome button and Arm chrome to match the chrome the + * body carries now. Runs whenever a chrome ability is granted or removed + * (chrome_hud.dm), so the button comes with the first chrome ability and + * goes with the last. + */ +/datum/component/chrome_wheel/proc/sync_abilities() + if(syncing || QDELETED(src)) + return + var/mob/living/carbon/bearer = parent + if(QDELETED(bearer)) + return + syncing = TRUE + if(length(get_chrome_arm_housings(bearer))) + if(!arm_action) + arm_action = new(src) + if(arm_action.owner != bearer) + arm_action.Grant(bearer) + else if(arm_action) + QDEL_NULL(arm_action) + if(length(get_chrome_wheel_actions(bearer))) + if(!hud_button) + hud_button = new(src) + if(hud_button.owner != bearer) + hud_button.Grant(bearer) + else if(hud_button) + QDEL_NULL(hud_button) + syncing = FALSE + refresh_button(force = TRUE) + +/// The ability the Chrome button shows: a chrome ability armed and waiting for +/// its click (Use OS chrome can arm one that isn't the pick), else the pick, +/// while its chrome is still in this body. +/datum/component/chrome_wheel/proc/get_button_pick() + var/mob/living/carbon/bearer = parent + var/datum/action/cooldown/cyberware/armed = bearer?.click_intercept + if(istype(armed) && armed.owner == bearer && !QDELETED(armed)) + return armed + var/datum/action/ability = selected_ref?.resolve() + if(!ability || QDELETED(ability) || ability.owner != parent) + return null + return ability + +/// A chrome ability's button would have redrawn: so does the Chrome button, if it shows that one. +/datum/component/chrome_wheel/proc/on_ability_changed(datum/action/ability) + // Or the one it showed until now: a disarmed ability hands the button back to the pick. + if(ability == get_button_pick() || (button_state && findtext(button_state, REF(ability)))) + refresh_button() + +/// Redraws the Chrome button when what it shows has changed, or always with [force]. +/datum/component/chrome_wheel/proc/refresh_button(force = FALSE) + // No HUD shows it (no client, an NPC): a button made later is drawn current anyway. + if(!hud_button || QDELETED(hud_button) || !length(hud_button.viewers)) + button_state = null + return + var/mob/living/carbon/bearer = parent + var/datum/action/pick = get_button_pick() + var/state = "none" + if(pick) + var/cooldown_left = chrome_wheel_cooldown_left(pick) + state = "[REF(pick)]|[chrome_ability_look_key(pick)]|[CEILING(cooldown_left / 10, 1)]|[chrome_wheel_offline(pick)]|[pick.IsAvailable()]|[chrome_wheel_ability_active(pick, bearer)]" + if(!force && state == button_state) + return + button_state = state + hud_button.build_all_button_icons(ALL, TRUE) + +/// The Chrome button was clicked: open the wheel for the mouse, or shut it. +/datum/component/chrome_wheel/proc/button_clicked() + if(is_open()) + close_wheel() + return + open_wheel(CHROME_WHEEL_CLICK, fire = TRUE) + +/// The "Deploy arm chrome" key: fire Arm chrome, as its chip would. +/datum/component/chrome_wheel/proc/use_arms() + var/mob/living/carbon/bearer = parent + if(!arm_action || arm_action.owner != bearer) + bearer.balloon_alert(bearer, "no arm chrome!") + return FALSE + return fire(arm_action) + +/// Whether the wheel is on screen. +/datum/component/chrome_wheel/proc/is_open() + return wheel_mode != CHROME_WHEEL_CLOSED + +// ---- Keys -------------------------------------------------------------- + +/// Wheel key down: open the wheel, or shut one a tap left open. +/datum/component/chrome_wheel/proc/wheel_key_down() + switch(wheel_mode) + if(CHROME_WHEEL_CLICK) + close_wheel() + return + if(CHROME_WHEEL_HELD) + return + if(open_wheel(CHROME_WHEEL_HELD)) + press_time = REALTIMEOFDAY + +/// Wheel key up: after a tap the wheel stays open for a click; after a hold, +/// whatever the mouse is on is picked and the wheel closes. +/datum/component/chrome_wheel/proc/wheel_key_up() + if(wheel_mode != CHROME_WHEEL_HELD) + return + if(REALTIMEOFDAY - press_time < CHROME_WHEEL_HOLD_TIME) + wheel_mode = CHROME_WHEEL_CLICK + return + choose(highlighted) + +/** + * Whether a key the "Chrome wheel" bind sits on is still down. keyUp only + * reaches binds by their bare key (bindings_client.dm), so a bind on a + * modifier combo such as ShiftV never hears its own release; while the wheel + * is held open, this poll catches it instead. + */ +/datum/component/chrome_wheel/proc/wheel_key_held() + var/mob/living/carbon/bearer = parent + var/client/viewer = bearer.client + if(!viewer) + return FALSE + var/list/bindings = viewer.prefs?.key_bindings + for(var/full_key in LAZYACCESS(bindings, CHROME_WHEEL_KEYBIND)) + if(viewer.keys_held[chrome_wheel_raw_key(full_key)]) + return TRUE + return FALSE + +/// Use chrome: fire the picked ability. With nothing picked, a lone ability +/// is fired; with several, the wheel opens for a click. +/datum/component/chrome_wheel/proc/use_selected() + if(wheel_mode != CHROME_WHEEL_CLOSED) + if(highlighted) + select_chip(highlighted, quiet = TRUE) + close_wheel() + var/datum/action/ability = get_selected_ability() + if(ability) + return fire(ability, selected_option) + var/mob/living/carbon/bearer = parent + var/list/abilities = get_chrome_wheel_actions(bearer) + switch(length(abilities)) + if(0) + bearer.balloon_alert(bearer, "no chrome!") + if(1) + select(abilities[1]) + return fire(abilities[1]) + else + open_wheel(CHROME_WHEEL_CLICK) + return FALSE + +/// Use OS chrome: fire the OS-slot ware's ability, leaving the pick alone. +/datum/component/chrome_wheel/proc/use_os() + var/mob/living/carbon/bearer = parent + var/datum/action/ability = get_os_chrome_action(bearer) + if(!ability) + bearer.balloon_alert(bearer, "no OS chrome!") + return FALSE + return fire(ability) + +/** + * Fires an ability exactly as its button would: Trigger() with the bearer as + * the clicker, so availability feedback, cooldowns and targeting modes are the + * button's own. Paced like a keybound action button (action.dm keydown()). + */ +/datum/component/chrome_wheel/proc/fire(datum/action/ability, option_id) + var/mob/living/carbon/bearer = parent + if(bearer.next_click > world.time) + return FALSE + bearer.next_click = world.time + CLICK_CD_ACTIVATE_ABILITY + // Async because some triggers wait on the player: a multi-tool arm opens its own radial. + if(option_id) + INVOKE_ASYNC(ability, TYPE_PROC_REF(/datum/action, use_chrome_wheel_option), bearer, option_id) + else + INVOKE_ASYNC(ability, TYPE_PROC_REF(/datum/action, Trigger), bearer) + // A toggle (zoom, arm hardware) changes nothing a redraw announces. + refresh_button() + return TRUE + +// ---- Selection --------------------------------------------------------- + +/datum/component/chrome_wheel/proc/select(datum/action/ability, option_id) + selected_ref = WEAKREF(ability) + selected_option = option_id + mark(ability) + for(var/atom/movable/screen/chrome_wheel/chip/chip as anything in chips) + draw_chip(chip) + update_readout() + +/datum/component/chrome_wheel/proc/deselect() + selected_ref = null + selected_option = null + unmark() + +/// The picked ability, while it is still chrome in this body and its picked +/// option is still on offer. A pick that went stale is dropped. +/datum/component/chrome_wheel/proc/get_selected_ability() + var/datum/action/ability = selected_ref?.resolve() + if(!ability) + if(selected_ref) + deselect() + return null + var/mob/living/carbon/bearer = parent + if(!(ability in get_chrome_wheel_actions(bearer)) || (selected_option && !chrome_wheel_find_option(ability, bearer, selected_option))) + deselect() + return null + return ability + +/// Shows the pick on the Chrome button, and watches it for leaving the body. +/datum/component/chrome_wheel/proc/mark(datum/action/ability) + if(marked_ref?.resolve() != ability) + unmark() + marked_ref = WEAKREF(ability) + RegisterSignal(ability, COMSIG_ACTION_REMOVED, PROC_REF(on_marked_removed)) + refresh_button() + +/datum/component/chrome_wheel/proc/unmark() + var/datum/action/marked = marked_ref?.resolve() + marked_ref = null + if(marked) + UnregisterSignal(marked, COMSIG_ACTION_REMOVED) + refresh_button() + +/// The picked ability left this body (the ware was cut out, or moved to someone +/// else): drop the pick now, so it never follows it into another body. +/datum/component/chrome_wheel/proc/on_marked_removed(datum/action/source, mob/old_owner) + SIGNAL_HANDLER + if(old_owner == parent) + deselect() + +/// Picks the ability on [chip] while it is still chrome in this body. Returns +/// whether it did: a ware cut out while the wheel was held open drops out here, +/// so its chip can't be picked and the pick can't follow it into someone else. +/datum/component/chrome_wheel/proc/select_chip(atom/movable/screen/chrome_wheel/chip/chip, quiet = FALSE) + var/datum/action/ability = chip?.ability_ref?.resolve() + if(!ability || !(ability in get_chrome_wheel_actions(parent))) + return FALSE + select(ability) + if(!quiet) + var/mob/living/carbon/bearer = parent + bearer.balloon_alert(bearer, lowertext(chip.name)) + return TRUE + +/// Pick [chip] (or nothing, for null) and close the wheel. The pick lands at +/// once; the wheel stays up a moment longer for the lock and the fade. A wheel +/// opened from the Chrome button fires the pick as well. +/datum/component/chrome_wheel/proc/choose(atom/movable/screen/chrome_wheel/chip/chip) + var/fire_it = fire_on_pick + var/picked = chip && select_chip(chip, quiet = fire_it) + close_wheel(linger = TRUE, chosen = picked ? chip : null) + if(picked && fire_it) + var/datum/action/ability = get_selected_ability() + if(ability) + fire(ability, selected_option) + +// ---- Opening and closing ----------------------------------------------- + +/// Opens the wheel in [mode]. With [fire], a chip clicked is fired as well as picked. +/datum/component/chrome_wheel/proc/open_wheel(mode, fire = FALSE) + var/mob/living/carbon/bearer = parent + var/client/viewer = bearer.client + if(wheel_mode != CHROME_WHEEL_CLOSED || !viewer || bearer.stat >= UNCONSCIOUS) + return FALSE + var/list/abilities = get_chrome_wheel_actions(bearer) + if(!length(abilities)) + bearer.balloon_alert(bearer, "no chrome!") + return FALSE + clear_fading() + build_wheel(abilities) + + catcher = new + catcher.wheel = src + catcher.assign_to_mob(bearer) + catcher.update_for_view(viewer.view) + shown_to = viewer + viewer.screen += catcher + viewer.screen += hub + play_open() + + wheel_mode = mode + fire_on_pick = fire + mouse_start = null + mouse_moved = FALSE + START_PROCESSING(SSfastprocess, src) + return TRUE + +/** + * Makes every piece of the wheel for [abilities] and hangs it off a new hub, + * without putting anything on a screen. + */ +/datum/component/chrome_wheel/proc/build_wheel(list/abilities) + var/list/placements = chrome_wheel_placements(abilities) + var/list/names = chrome_wheel_names(abilities) + parts = list() + chips = list() + leaders = list() + arcs = list() + readout_state = null + hub = new + parts += hub + add_piece(/atom/movable/screen/chrome_wheel/art/backdrop) + add_piece(/atom/movable/screen/chrome_wheel/art, "body") + glow = add_piece(/atom/movable/screen/chrome_wheel/art, null, 2.2) + glow.alpha = 0 + glow_twin = add_piece(/atom/movable/screen/chrome_wheel/art, null, 2.2) + glow_twin.alpha = 0 + var/list/arc_names = list() + for(var/socket in GLOB.chrome_wheel_sockets) + arc_names |= GLOB.chrome_wheel_sockets[socket]["arc"] + for(var/arc_name in arc_names) + arcs[arc_name] = add_piece(/atom/movable/screen/chrome_wheel/art, "arc_[arc_name]", 2.25) + + // Which sockets hold chrome of their own, and which positions are taken. + var/list/occupied = list() + var/list/taken = list() + for(var/datum/action/ability as anything in placements) + var/list/placement = placements[ability] + taken["[placement["socket"]]|[placement["index"]]"] = TRUE + // Arm chrome borrows the right arm's arc; it doesn't make the right arm chromed. + if(!placement["hand"] && !istype(ability, /datum/action/chrome_arms)) + occupied[placement["socket"]] = TRUE + for(var/socket in GLOB.chrome_wheel_sockets) + add_leader(socket, socket, occupied[socket]) + if(!taken["[socket]|1"]) + var/list/point = chrome_wheel_position(socket, 1) + var/atom/movable/screen/chrome_wheel/empty_socket/outline = add_piece(/atom/movable/screen/chrome_wheel/empty_socket) + outline.pixel_x = point[1] + outline.pixel_y = point[2] + + for(var/datum/action/ability as anything in abilities) + var/list/placement = placements[ability] + var/socket = placement["socket"] + var/list/point = chrome_wheel_position(socket, placement["index"]) + var/atom/movable/screen/chrome_wheel/chip/chip = add_piece(/atom/movable/screen/chrome_wheel/chip) + chip.ability_ref = WEAKREF(ability) + chip.name = names[ability] + chip.socket = socket + chip.index = placement["index"] + chip.leader_key = socket + chip.region = GLOB.chrome_wheel_sockets[socket]["region"] + if(istype(ability, /datum/action/chrome_arms)) + // Lights both arms: their arcs, their leaders and the arms on the body. + chip.region = CHROME_WHEEL_REGION_ARMS + else if(placement["hand"]) + var/hand = (socket == CHROME_WHEEL_SOCKET_LEFT_ARM) ? "l_hand" : "r_hand" + chip.region = hand + // The ring art has a run to the hand from each first-row position. + if(chip.index <= chrome_wheel_socket_fits(socket)) + chip.leader_key = "[hand]_[chip.index]" + add_leader(chip.leader_key, hand, TRUE) + chip.chip_x = point[1] + chip.chip_y = point[2] + chip.pixel_x = point[1] + chip.pixel_y = point[2] + chips += chip + draw_chip(chip) + // Nothing is pointed at yet: the arcs start dim, as they are whenever the pointer leaves a chip. + light_up(null) + build_readout() + update_readout() + +/// A new piece of the wheel on the hub. [art_state] sets its icon state and +/// [piece_layer] its layer, when given. +/datum/component/chrome_wheel/proc/add_piece(piece_type, art_state, piece_layer) + var/atom/movable/screen/chrome_wheel/piece = new piece_type + if(art_state) + piece.icon_state = art_state + if(piece_layer) + piece.layer = piece_layer + parts += piece + hub.vis_contents += piece + return piece + +/// The leader for [key] and the dot where it meets the body, from the ring art. +/datum/component/chrome_wheel/proc/add_leader(key, art_key, filled) + if(leaders[key]) + return + var/atom/movable/screen/chrome_wheel/art/line = add_piece(/atom/movable/screen/chrome_wheel/art, "leader_[key]", 2.3) + var/atom/movable/screen/chrome_wheel/art/dot = add_piece(/atom/movable/screen/chrome_wheel/art, "node_[art_key]", 2.4) + leaders[key] = list("leader" = line, "node" = dot, "node_state" = "node_[art_key]", "alpha" = filled ? 100 : 40) + style_leader(key, null) + +/// The readout panel's frame and its empty text lines. +/datum/component/chrome_wheel/proc/build_readout() + var/left = CHROME_WHEEL_READOUT_LEFT + var/top = CHROME_WHEEL_READOUT_TOP + var/width = CHROME_WHEEL_READOUT_WIDTH + var/height = CHROME_WHEEL_READOUT_HEIGHT + add_readout_block(left, top - height, width, height, CHROME_WHEEL_PANEL_COLOR, 205, 4) + add_readout_block(left, top - 1, width, 1, CHROME_WHEEL_HUD_COLOR, 120, 4.1) + add_readout_block(left, top - height, width, 1, CHROME_WHEEL_HUD_COLOR, 120, 4.1) + add_readout_block(left, top - height, 1, height, CHROME_WHEEL_HUD_COLOR, 120, 4.1) + add_readout_block(left + width - 1, top - height, 1, height, CHROME_WHEEL_HUD_COLOR, 120, 4.1) + add_readout_block(left, top - 12, 2, 12, CHROME_WHEEL_HUD_COLOR, 255, 4.1) + // Text boxes are taller than their line and centred on it, as the chrome + // read sets them: Grand9K caps start 5 px under a 16 px box's top, + // TinyUnicode caps 8 px under a 17 px one. + readout_title = add_readout_text(left + 5, top - 11 - 2, width - 9, 16) + readout_sub = add_readout_text(left + 5, top - 9 - 13, width - 9, 17) + readout_status = add_readout_text(left + 5, top - 11 - 3, width - 10, 16) + readout_mark = add_piece(/atom/movable/screen/chrome_wheel/readout, "pick_glyph", 4.3) + readout_mark.color = CHROME_WHEEL_PICKED_COLOR + readout_mark.alpha = 0 + readout_mark.pixel_x = left + 140 + readout_mark.pixel_y = top - 22 + +/datum/component/chrome_wheel/proc/add_readout_block(x, y, width, height, block_color, block_alpha, block_layer) + var/atom/movable/screen/chrome_wheel/readout/block = add_piece(/atom/movable/screen/chrome_wheel/readout, null, block_layer) + block.color = block_color + block.alpha = block_alpha + block.transform = chrome_readout_quad(x, y, width, height) + return block + +/datum/component/chrome_wheel/proc/add_readout_text(x, y, width, height) + var/atom/movable/screen/chrome_wheel/readout/line = add_piece(/atom/movable/screen/chrome_wheel/readout, null, 4.2) + line.icon_state = null + line.maptext_x = x + line.maptext_y = y + line.maptext_width = width + line.maptext_height = height + return line + +/// Fades the wheel in and pops the chips out one after another, clockwise from the top. +/datum/component/chrome_wheel/proc/play_open() + hub.alpha = 0 + animate(hub, alpha = 255, time = 1) + var/list/order = sortTim(chips.Copy(), GLOBAL_PROC_REF(cmp_chrome_wheel_bearing)) + for(var/i in 1 to length(order)) + var/atom/movable/screen/chrome_wheel/chip/chip = order[i] + var/matrix/small = matrix(0.6, 0, 0, 0, 0.6, 0) + chip.transform = small + animate(chip, transform = small, time = (i - 1) * 0.08) + animate(transform = matrix(), time = 0.8, easing = BACK_EASING | EASE_OUT) + +/** + * Shuts the wheel and gives the mouse back to the world. With [linger] the + * pieces stay on screen a moment to fade, after [chosen] locks. + */ +/datum/component/chrome_wheel/proc/close_wheel(linger = FALSE, atom/movable/screen/chrome_wheel/chip/chosen) + STOP_PROCESSING(SSfastprocess, src) + wheel_mode = CHROME_WHEEL_CLOSED + fire_on_pick = FALSE + if(shown_to) + shown_to.screen -= catcher + QDEL_NULL(catcher) + if(linger && shown_to && hub) + clear_fading() + fading_client = shown_to + fading_parts = parts + if(chosen) + play_lock(chosen) + animate(hub, alpha = hub.alpha, time = chosen ? 1 : 0) + animate(alpha = 0, time = 1) + fading_timer = addtimer(CALLBACK(src, PROC_REF(fade_done)), CHROME_WHEEL_LINGER_TIME, TIMER_STOPPABLE | TIMER_CLIENT_TIME | TIMER_DELETE_ME) + else + shown_to?.screen -= hub + QDEL_LIST(parts) + shown_to = null + hub = null + parts = null + chips = null + leaders = null + arcs = null + glow = null + glow_twin = null + highlighted = null + readout_title = null + readout_sub = null + readout_status = null + readout_mark = null + readout_state = null + mouse_start = null + mouse_moved = FALSE + +/datum/component/chrome_wheel/proc/fade_done() + fading_timer = null + clear_fading() + +/// Takes a fading wheel off its screen now. +/datum/component/chrome_wheel/proc/clear_fading() + if(fading_timer) + deltimer(fading_timer) + fading_timer = null + if(fading_client && length(fading_parts)) + fading_client.screen -= fading_parts[1] + fading_client = null + QDEL_LIST(fading_parts) + +/// The pick locking on: its frame flashes white and the brackets snap in. +/datum/component/chrome_wheel/proc/play_lock(atom/movable/screen/chrome_wheel/chip/chip) + var/settled = chip.color + chip.color = "#ffffff" + animate(chip, color = "#ffffff", time = 0.5) + animate(color = settled, time = 0) + for(var/atom/movable/screen/chrome_wheel/bracket/corner as anything in chip.brackets) + if(!corner.alpha) + continue + var/final_x = corner.pixel_x + var/final_y = corner.pixel_y + corner.pixel_x = final_x + corner.out_x * 7 + corner.pixel_y = final_y + corner.out_y * 7 + corner.color = "#ffffff" + animate(corner, pixel_x = final_x, pixel_y = final_y, time = 1, easing = BACK_EASING | EASE_OUT) + animate(corner, color = "#ffffff", time = 0.5, flags = ANIMATION_PARALLEL) + animate(color = CHROME_WHEEL_PICKED_COLOR, time = 0) + +/// While open: catch a modifier bind's release, and keep the chips current. +/datum/component/chrome_wheel/process(seconds_per_tick) + if(wheel_mode == CHROME_WHEEL_CLOSED) + return PROCESS_KILL + if(wheel_mode == CHROME_WHEEL_HELD && !wheel_key_held()) + wheel_key_up() + if(wheel_mode == CHROME_WHEEL_CLOSED) + return PROCESS_KILL + for(var/atom/movable/screen/chrome_wheel/chip/chip as anything in chips) + draw_chip(chip) + update_readout() + +// ---- Drawing ----------------------------------------------------------- + +/** + * Brings a chip up to date: its frame in its tier colour (blinking red while + * the chrome is down), the ability's icon, the green inner line while it is + * deployed or armed, the pick's brackets, and a draining shade with seconds + * while it cools down. Bigger and brighter while pointed at. Redraws only on + * change. + */ +/datum/component/chrome_wheel/proc/draw_chip(atom/movable/screen/chrome_wheel/chip/chip) + var/mob/living/carbon/bearer = parent + var/datum/action/ability = chip.ability_ref?.resolve() + if(!ability) + if(chip.drawn_state != "gone") + chip.drawn_state = "gone" + chip.cut_overlays() + chip.underlays.Cut() + chip.alpha = 70 + return + var/datum/action/cooldown/timed = istype(ability, /datum/action/cooldown) ? ability : null + var/cooldown_left = timed ? max(timed.next_use_time - world.time, 0) : 0 + var/offline = chrome_wheel_offline(ability) + var/unavailable = !offline && chrome_wheel_unavailable(ability, cooldown_left) + var/hovered = (chip == highlighted) + var/picked = (selected_ref?.resolve() == ability) + var/active = chrome_wheel_ability_active(ability, bearer) + var/state = "[offline]|[unavailable]|[hovered]|[picked]|[active]|[timed?.next_use_time]|[!!cooldown_left]|[chrome_ability_look_key(ability)]" + if(state != chip.drawn_state) + chip.drawn_state = state + paint_chip(chip, ability, offline, unavailable, hovered, picked, active) + update_shade(chip, cooldown_left, timed ? max(timed.cooldown_time, cooldown_left) : 0) + if(hovered) + light_up(chip) + update_count(chip, cooldown_left) + +/datum/component/chrome_wheel/proc/paint_chip(atom/movable/screen/chrome_wheel/chip/chip, datum/action/ability, offline, unavailable, hovered, picked, active) + var/size = hovered ? 26 : 22 + chip.size = size + var/base_color = offline ? CHROME_WHEEL_OFFLINE_COLOR : chrome_wheel_tier_color(ability) + chip.icon_state = "frame_[size][offline ? "_blink" : ""]" + chip.color = hovered ? chrome_wheel_lighten(base_color, 0.35) : base_color + chip.alpha = 255 + chip.cut_overlays() + chip.underlays.Cut() + chip.underlays += chrome_wheel_chip_piece("fill_[size]") + if(hovered) + chip.add_overlay(chrome_wheel_chip_piece("halo_26", base_color, 90)) + var/mutable_appearance/look = chrome_wheel_ability_look(ability) + // The icon fills the chip but for a pixel all round. + var/scale = (size - 2) / ICON_SIZE_X + look.transform = matrix(scale, 0, 0, 0, scale, 0) + // Red like its button when it can't be used. + if(offline || unavailable) + look.color = ability.transparent_when_unavailable ? rgb(128, 0, 0, 128) : rgb(128, 0, 0) + chip.add_overlay(look) + if(active) + chip.add_overlay(chrome_wheel_chip_piece("deployed_[size]")) + draw_brackets(chip, picked) + +/// The pick's corner brackets, a couple of pixels clear of the chip's corners. +/datum/component/chrome_wheel/proc/draw_brackets(atom/movable/screen/chrome_wheel/chip/chip, picked) + if(!picked) + for(var/atom/movable/screen/chrome_wheel/bracket/corner as anything in chip.brackets) + corner.alpha = 0 + return + if(!chip.brackets) + chip.brackets = list() + for(var/corner_name in list("nw", "ne", "sw", "se")) + var/atom/movable/screen/chrome_wheel/bracket/corner = new + corner.icon_state = "bracket_[corner_name]" + corner.out_x = findtext(corner_name, "w") ? -1 : 1 + corner.out_y = findtext(corner_name, "n") ? 1 : -1 + chip.brackets += corner + chip.vis_contents += corner + // The bracket art has its corner pixel one in from the edge of its tile; a + // chip's brackets sit two pixels outside its corners. + var/reach = chip.size / 2 + 2 - 15 + for(var/atom/movable/screen/chrome_wheel/bracket/corner as anything in chip.brackets) + animate(corner) + corner.alpha = 255 + corner.color = CHROME_WHEEL_PICKED_COLOR + corner.pixel_x = corner.out_x * reach + corner.pixel_y = corner.out_y * reach + +/// The cooldown wipe: a dark block over the chip's inside that drains downward +/// to nothing as the cooldown runs out, with a faint line along its top. +/// Animated on the client, so it costs no ticks. +/datum/component/chrome_wheel/proc/update_shade(atom/movable/screen/chrome_wheel/chip/chip, cooldown_left, cooldown_total) + if(!cooldown_left) + for(var/atom/movable/screen/chrome_wheel/chip_part/part in list(chip.shade, chip.shade_edge)) + animate(part) + part.alpha = 0 + return + if(!chip.shade) + chip.shade = new + chip.shade.color = COLOR_BLACK + chip.shade_edge = new + chip.shade_edge.layer = 3.2 + chip.vis_contents += list(chip.shade, chip.shade_edge) + var/list/start = chrome_wheel_shade_shape(chip.size, cooldown_left / max(cooldown_total, 1)) + var/list/finish = chrome_wheel_shade_shape(chip.size, 0) + chip.shade.alpha = 185 + chip.shade.transform = start[1] + animate(chip.shade, transform = finish[1], time = cooldown_left) + chip.shade_edge.alpha = 110 + chip.shade_edge.transform = start[2] + animate(chip.shade_edge, transform = finish[2], time = cooldown_left) + +/** + * The cooldown wipe's shape on a chip of [size] with [fraction] of its + * cooldown left: list(shade transform, edge transform). The px state is a + * full tile, squashed to the chip's inside and sitting on its floor; the edge + * is the wipe's top row. + */ +/proc/chrome_wheel_shade_shape(size, fraction) + RETURN_TYPE(/list) + var/inside = size - 2 + var/height = max(inside * min(fraction, 1), 0.3) + return list( + matrix(inside / 32, 0, 0, 0, height / 32, -(inside - height) / 2), + matrix(inside / 32, 0, 0, 0, 1 / 32, max(height, 1) - inside / 2 - 0.5), + ) + +/// Whole seconds left on the cooldown, in the chip's bottom left corner. +/datum/component/chrome_wheel/proc/update_count(atom/movable/screen/chrome_wheel/chip/chip, cooldown_left) + var/seconds = cooldown_left ? CEILING(cooldown_left / 10, 1) : 0 + var/state = "[seconds]|[chip.size]" + if(state == chip.count_state) + return + chip.count_state = state + if(!seconds) + if(chip.count) + chip.count.maptext = null + return + if(!chip.count) + chip.count = new + chip.count.icon_state = null + chip.count.layer = 3.3 + chip.count.maptext_width = 32 + chip.count.maptext_height = 17 + chip.vis_contents += chip.count + // Box centred like the readout's lines (caps 8 px under a 17 px box's top), + // putting the number three pixels in from the chip's bottom left corner. + chip.count.maptext = chrome_readout_tiny_html("[seconds]") + chip.count.maptext_x = 16 - chip.size / 2 + 3 + chip.count.maptext_y = 18 - chip.size / 2 + +/// Sets a leader and its node to [lit_color], or back to the dim HUD colour for null. +/datum/component/chrome_wheel/proc/style_leader(key, lit_color) + var/list/leader = leaders?[key] + if(!leader) + return + var/atom/movable/screen/chrome_wheel/art/line = leader["leader"] + var/atom/movable/screen/chrome_wheel/art/dot = leader["node"] + if(lit_color) + line.color = lit_color + line.alpha = 235 + dot.icon_state = "[leader["node_state"]]_lit" + dot.color = chrome_wheel_lighten(lit_color, 0.6) + dot.alpha = 255 + return + line.color = CHROME_WHEEL_HUD_COLOR + line.alpha = leader["alpha"] + dot.icon_state = leader["node_state"] + dot.color = CHROME_WHEEL_HUD_COLOR + dot.alpha = min(255, leader["alpha"] + 60) + +/// Lights the arc, leader and body part of [chip] in its colour, and puts +/// everything else back. Null lights nothing. +/datum/component/chrome_wheel/proc/light_up(atom/movable/screen/chrome_wheel/chip/chip) + var/datum/action/ability = chip?.ability_ref?.resolve() + var/lit_color + if(ability) + lit_color = chrome_wheel_offline(ability) ? CHROME_WHEEL_OFFLINE_COLOR : chrome_wheel_tier_color(ability) + // Arm chrome lights both arms; anything else its own socket and body part. + var/both_arms = lit_color && chip.region == CHROME_WHEEL_REGION_ARMS + var/list/lit_leaders = list() + var/list/lit_arcs = list() + var/list/lit_regions = list() + if(both_arms) + for(var/arm_socket in list(CHROME_WHEEL_SOCKET_LEFT_ARM, CHROME_WHEEL_SOCKET_RIGHT_ARM)) + lit_leaders += arm_socket + lit_arcs += GLOB.chrome_wheel_sockets[arm_socket]["arc"] + lit_regions += GLOB.chrome_wheel_sockets[arm_socket]["region"] + else if(lit_color) + lit_leaders += chip.leader_key + lit_arcs += GLOB.chrome_wheel_sockets[chip.socket]["arc"] + lit_regions += chip.region + for(var/key in leaders) + style_leader(key, (key in lit_leaders) ? lit_color : null) + for(var/arc_name in arcs) + var/atom/movable/screen/chrome_wheel/art/arc = arcs[arc_name] + var/lit = (arc_name in lit_arcs) + arc.color = lit ? lit_color : CHROME_WHEEL_HUD_COLOR + arc.alpha = lit ? 200 : 80 + var/list/glows = list(glow, glow_twin) + for(var/i in 1 to length(glows)) + var/atom/movable/screen/chrome_wheel/art/body_glow = glows[i] + if(!body_glow) + continue + if(i > length(lit_regions)) + body_glow.alpha = 0 + continue + body_glow.icon_state = "glow_[lit_regions[i]]" + body_glow.color = lit_color + body_glow.alpha = 255 + +/** + * The readout under the ring: the chip pointed at, the chrome it lives in in + * its tier colour, and on the right how it stands ("14s", "offline", "out"). + * With nothing pointed at it shows the pick, dim, with a small bracket mark. + */ +/datum/component/chrome_wheel/proc/update_readout() + if(!readout_title) + return + var/mob/living/carbon/bearer = parent + var/atom/movable/screen/chrome_wheel/chip/shown = highlighted + var/datum/action/ability = shown?.ability_ref?.resolve() + var/idle = !ability + var/title + if(idle) + ability = get_selected_ability() + if(ability) + var/datum/chrome_wheel_option/option = selected_option ? chrome_wheel_find_option(ability, bearer, selected_option) : null + title = option ? option.name : ability.chrome_wheel_name() + else + title = shown.name + var/sub = ability ? chrome_wheel_ware_name(ability) : "" + var/sub_color = CHROME_WHEEL_DIM_COLOR + var/title_color = CHROME_WHEEL_DIM_COLOR + var/status + var/status_color + if(ability && !idle) + title_color = CHROME_WHEEL_NAME_COLOR + var/datum/action/cooldown/timed = istype(ability, /datum/action/cooldown) ? ability : null + var/cooldown_left = timed ? max(timed.next_use_time - world.time, 0) : 0 + if(chrome_wheel_offline(ability)) + status = "offline" + status_color = CHROME_WHEEL_OFFLINE_COLOR + sub_color = CHROME_WHEEL_OFFLINE_NAME_COLOR + else + sub_color = chrome_wheel_tier_color(ability) + if(chrome_wheel_ability_active(ability, bearer)) + status = timed ? "armed" : "out" + status_color = CHROME_WHEEL_DEPLOYED_COLOR + else if(cooldown_left) + status = "[CEILING(cooldown_left / 10, 1)]s" + status_color = "#ffffff" + var/state = "[idle]|[title]|[title_color]|[sub]|[sub_color]|[status]" + if(state == readout_state) + return + readout_state = state + var/static/datum/font/header_font = new /datum/font/grand9k/size_6pt() + var/static/datum/font/list_font = new /datum/font/tiny_unicode/size_12pt() + var/status_width = status ? header_font.get_metrics(status) + 6 : 0 + if(title) + title = chrome_readout_fit(title, header_font, CHROME_WHEEL_READOUT_WIDTH - 10 - status_width) + readout_title.maptext = chrome_readout_header_html(html_encode(title), title_color) + else + readout_title.maptext = null + if(sub) + sub = chrome_readout_fit(sub, list_font, CHROME_WHEEL_READOUT_WIDTH - 10) + readout_sub.maptext = chrome_readout_tiny_html("[html_encode(sub)]") + else + readout_sub.maptext = null + readout_status.maptext = status ? chrome_readout_header_html(status, status_color, "right") : null + readout_mark.alpha = (idle && ability) ? 200 : 0 + +// ---- Mouse ------------------------------------------------------------- + +/datum/component/chrome_wheel/proc/mouse_moved(params) + if(wheel_mode == CHROME_WHEEL_CLOSED) + return + var/list/offset = chrome_wheel_mouse_offset(params, shown_to) + if(!offset) + return + if(!mouse_moved) + if(!mouse_start) + mouse_start = offset + return + if(abs(offset[1] - mouse_start[1]) + abs(offset[2] - mouse_start[2]) < 4) + return + mouse_moved = TRUE + point_at(offset) + +/datum/component/chrome_wheel/proc/mouse_clicked(params) + if(wheel_mode == CHROME_WHEEL_CLOSED) + return + var/list/offset = chrome_wheel_mouse_offset(params, shown_to) + if(!offset) + close_wheel() + return + point_at(offset) + choose(highlighted) + +/// Highlights whatever the mouse at [offset] points at. A wheel opened from the +/// Chrome button fires what a click picks, so out past the ring a click picks nothing. +/datum/component/chrome_wheel/proc/point_at(list/offset) + var/list/points = list() + var/list/on_ring = list() + for(var/atom/movable/screen/chrome_wheel/chip/chip as anything in chips) + points += list(list(chip.chip_x, chip.chip_y)) + on_ring += chip.index <= chrome_wheel_socket_fits(chip.socket) + var/index = chrome_wheel_pick(offset[1], offset[2], points, on_ring, fire_on_pick ? CHROME_WHEEL_FIRE_REACH : null) + set_highlight(index ? chips[index] : null) + +/// Moves the highlight: the old chip shrinks back, the new one grows and lights its part of the body. +/datum/component/chrome_wheel/proc/set_highlight(atom/movable/screen/chrome_wheel/chip/chip) + if(chip == highlighted) + return + var/atom/movable/screen/chrome_wheel/chip/old = highlighted + highlighted = chip + if(old) + draw_chip(old) + if(chip) + draw_chip(chip) + else + light_up(null) + update_readout() + +#undef CHROME_WHEEL_READOUT_TOP +#undef CHROME_WHEEL_READOUT_LEFT +#undef CHROME_WHEEL_READOUT_WIDTH +#undef CHROME_WHEEL_READOUT_HEIGHT diff --git a/voidcrew/modules/cyberware/chrome_wheel_arms.dm b/voidcrew/modules/cyberware/chrome_wheel_arms.dm new file mode 100644 index 00000000000..4a84015724f --- /dev/null +++ b/voidcrew/modules/cyberware/chrome_wheel_arms.dm @@ -0,0 +1,111 @@ +/** + * # Arm chrome + * + * One ability that deploys or stows all of the bearer's arm hardware at once: + * the toolkit arms that put something in a hand (Mantis, Shiv and Scorch + * pairs, Widowline, Rockjaw, Fixer's, Ronin and Holdout, Bunker Buster). Arm + * chrome with nothing to hand out (Icepick, Skyhook, Graverobber, Angler, + * Gorilla) is left alone. + * + * If anything is out, everything goes back in. Otherwise every arm that can + * deploys: running chrome, its own button usable, a free hand on its side. + * A held item is never dropped to make room, so a full hand just keeps its + * arm stowed, and an EMP'd or browned-out arm stays put. A pair comes out + * together because both housings deploy in the same press. + * + * The bearer's chrome wheel owns the ability (chrome_wheel.dm sync_abilities()) + * and gives it a fixed chip at the top of the right arm's arc. It has no HUD + * button, like every chrome ability (chrome_hud.dm); the "Deploy arm chrome" + * key fires it (chrome_wheel_keybindings.dm). + */ +/datum/action/chrome_arms + name = "Arm chrome" + button_icon = CHROME_HUD_ICON + button_icon_state = "arms" + check_flags = AB_CHECK_CONSCIOUS + +/datum/action/chrome_arms/is_chrome_ability() + return TRUE + +/datum/action/chrome_arms/Trigger(mob/clicker, trigger_flags) + . = ..() + if(!.) + return FALSE + return chrome_arms_toggle(owner) + +/// The bearer's installed arm chrome that hands something out, deployed or not. +/proc/get_chrome_arm_housings(mob/living/carbon/bearer) + RETURN_TYPE(/list) + . = list() + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/housing in get_installed_cyberware(bearer)) + if(housing.chrome_arm_item()) + . += housing + +/** + * Stows every deployed arm if any is out, or else deploys every arm that can. + * Returns whether anything moved. + */ +/proc/chrome_arms_toggle(mob/living/carbon/bearer) + var/list/housings = get_chrome_arm_housings(bearer) + if(!length(housings)) + bearer?.balloon_alert(bearer, "no arm chrome!") + return FALSE + var/list/deployed = list() + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/housing as anything in housings) + if(housing.chrome_arm_deployed()) + deployed += housing + if(length(deployed)) + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/housing as anything in deployed) + housing.Retract() + return TRUE + if(HAS_TRAIT(bearer, TRAIT_INCAPACITATED)) + bearer.balloon_alert(bearer, "incapacitated!") + return FALSE + if(HAS_TRAIT(bearer, TRAIT_HANDS_BLOCKED)) + bearer.balloon_alert(bearer, "hands blocked!") + return FALSE + var/out = 0 + var/hands_full = FALSE + for(var/obj/item/organ/cyberimp/arm/toolkit/cyberware/housing as anything in housings) + if(housing.chrome_arm_deploy()) + out++ + else if(housing.chrome_arm_can_run() && !housing.chrome_arm_hand_free()) + hands_full = TRUE + if(!out) + bearer.balloon_alert(bearer, hands_full ? "hands full!" : "chrome offline!") + return out > 0 + +/// The first thing this arm hands out, while it is still stowed in it or out in a hand; null for arm chrome with nothing to hand out. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/chrome_arm_item() + for(var/datum/weakref/item_ref as anything in items_list) + var/obj/item/stowed = item_ref.resolve() + if(stowed) + return stowed + return null + +/// Whether this arm's item is out of the housing. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/chrome_arm_deployed() + // The toolkit sets active_item before it knows a hand was free, so "out" is "not in us". + return active_item && !(active_item in src) + +/// Whether the chrome runs and its own deploy button could be pressed. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/chrome_arm_can_run() + var/datum/component/cyberware/chrome = GetComponent(/datum/component/cyberware) + if(!owner || !chrome?.is_running()) + return FALSE + var/datum/action/toggle = locate(/datum/action/item_action/organ_action/toggle) in actions + return !toggle || toggle.IsAvailable() + +/// Whether the hand on this arm's side is empty. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/chrome_arm_hand_free() + return !!owner?.get_empty_held_index_for_side(zone == BODY_ZONE_R_ARM ? RIGHT_HANDS : LEFT_HANDS) + +/// Puts this arm's first item in its hand, if the chrome runs and the hand is empty. Returns whether it came out. +/obj/item/organ/cyberimp/arm/toolkit/cyberware/proc/chrome_arm_deploy() + if(chrome_arm_deployed() || !chrome_arm_can_run() || !chrome_arm_hand_free()) + return FALSE + var/obj/item/augment = chrome_arm_item() + if(!augment || !(augment in src)) + return FALSE + Extend(augment) + return chrome_arm_deployed() diff --git a/voidcrew/modules/cyberware/chrome_wheel_hud.dm b/voidcrew/modules/cyberware/chrome_wheel_hud.dm new file mode 100644 index 00000000000..d3273eda2e3 --- /dev/null +++ b/voidcrew/modules/cyberware/chrome_wheel_hud.dm @@ -0,0 +1,142 @@ +/** + * Screen objects for the chrome wheel (chrome_wheel.dm). + * + * Everything the player sees hangs off one hub at the centre of the view, in + * its vis_contents, on the above-HUD plane. None of it takes the mouse: a + * near-invisible full-view catcher sits under it and reports every move and + * click to the wheel, which works out the chip from the mouse position. + * Every piece opts out of clear_screen(), because a knockdown rebuilds the HUD + * mid-hold; the wheel takes its own pieces off the screen when it closes. + * + * Pieces keep the alpha and transform of whatever they hang off, so the hub's + * fade reaches everything and a chip's pop carries its brackets, shade and + * count with it. Each sets its own colour. + * + * Layers, bottom up: backdrop, body, body glow, arcs, leaders, nodes, empty + * sockets, chips (and their shade, count and brackets), readout. + */ +/atom/movable/screen/chrome_wheel + icon = CHROME_WHEEL_ICON + icon_state = null + plane = ABOVE_HUD_PLANE + layer = 3 + mouse_opacity = MOUSE_OPACITY_TRANSPARENT + vis_flags = VIS_INHERIT_PLANE + clear_with_screen = FALSE + appearance_flags = RESET_COLOR | NO_CLIENT_COLOR | PIXEL_SCALE + +/// The wheel's anchor at the centre of the view. Draws nothing itself. +/atom/movable/screen/chrome_wheel/hub + screen_loc = "CENTER" + +/** + * A piece of the 240x240 ring art (chrome_wheel_ring.dmi). The art is centred + * on the ring, which sits CHROME_WHEEL_CENTRE_Y above the middle of the view. + */ +/atom/movable/screen/chrome_wheel/art + icon = CHROME_WHEEL_RING_ICON + layer = 2.1 + pixel_x = -104 + pixel_y = -102 + +/// The soft dark backdrop. Stored at half size and drawn doubled, smoothly. +/atom/movable/screen/chrome_wheel/art/backdrop + icon_state = "scrim" + layer = 2 + appearance_flags = RESET_COLOR | NO_CLIENT_COLOR + +/atom/movable/screen/chrome_wheel/art/backdrop/Initialize(mapload, datum/hud/hud_owner) + . = ..() + transform = matrix(2, 0, 0, 0, 2, 0) + +/// The dim dashed outline of a socket with nothing in it. +/atom/movable/screen/chrome_wheel/empty_socket + icon_state = "socket" + layer = 2.5 + +/// One ability on the ring. +/atom/movable/screen/chrome_wheel/chip + icon_state = "frame_22" + /// The ability this chip fires. + var/datum/weakref/ability_ref + /// CHROME_WHEEL_SOCKET_* it sits in, and its position there, from 1. + var/socket + var/index = 1 + /// Which leader lights when it is pointed at: its socket's, or for hand + /// chrome its own run to the hand ("l_hand_2"). + var/leader_key + /// Which part of the body lights when it is pointed at. + var/region + /// Offset of its centre from the centre of the view, in pixels. + var/chip_x = 0 + var/chip_y = 0 + /// What the chip was last drawn as, so unchanged chips are left alone. + var/drawn_state + /// What its cooldown count last showed. + var/count_state + /// Size it was last drawn at: 22, or 26 while pointed at. + var/size = 22 + /// Cooldown wipe and its top edge, made the first time the chip cools down. + var/atom/movable/screen/chrome_wheel/chip_part/shade + var/atom/movable/screen/chrome_wheel/chip_part/shade_edge + /// Cooldown seconds. + var/atom/movable/screen/chrome_wheel/chip_part/count + /// The pick's corner brackets, made the first time this chip is picked. + var/list/brackets + +/atom/movable/screen/chrome_wheel/chip/Destroy() + vis_contents.Cut() + QDEL_NULL(shade) + QDEL_NULL(shade_edge) + QDEL_NULL(count) + QDEL_LIST(brackets) + ability_ref = null + return ..() + +/// Something drawn on a chip: the cooldown wipe, its edge or its count. +/atom/movable/screen/chrome_wheel/chip_part + icon_state = "px" + layer = 3.1 + +/// One corner of the lock brackets on the picked chip. +/atom/movable/screen/chrome_wheel/bracket + icon = CHROME_WHEEL_BRACKET_ICON + layer = 3.4 + color = CHROME_WHEEL_PICKED_COLOR + /// Which way is outward from the chip, for the snap in: -1 or 1 on each axis. + var/out_x = 0 + var/out_y = 0 + +/// A part of the readout panel under the ring: a flat block, or a line of text. +/atom/movable/screen/chrome_wheel/readout + icon_state = "px" + layer = 4 + +/** + * tg's cursor catcher (the scope's), lifted above the HUD so the mouse reaches + * the wheel wherever it is on the map. Its icon is white at alpha 1: invisible, + * but solid to the mouse. + */ +/atom/movable/screen/fullscreen/cursor_catcher/chrome_wheel + // overlay_fullscreen() appends a severity to the base state; nothing here goes + // through it, so name the state that exists. + icon_state = "fullscreen_blocker0" + plane = ABOVE_HUD_PLANE + layer = 1 + clear_with_screen = FALSE + /// The wheel to report to. + var/datum/component/chrome_wheel/wheel + +/atom/movable/screen/fullscreen/cursor_catcher/chrome_wheel/Destroy() + wheel = null + owner = null + return ..() + +/atom/movable/screen/fullscreen/cursor_catcher/chrome_wheel/MouseMove(location, control, params) + . = ..() + if(usr == owner) + wheel?.mouse_moved(params) + +/atom/movable/screen/fullscreen/cursor_catcher/chrome_wheel/Click(location, control, params) + if(usr == owner) + wheel?.mouse_clicked(params) diff --git a/voidcrew/modules/cyberware/chrome_wheel_keybindings.dm b/voidcrew/modules/cyberware/chrome_wheel_keybindings.dm new file mode 100644 index 00000000000..2578ebd6ab1 --- /dev/null +++ b/voidcrew/modules/cyberware/chrome_wheel_keybindings.dm @@ -0,0 +1,85 @@ +/** + * The chrome wheel's binds (chrome_wheel.dm). Defaults sit on V, the one free + * letter by the movement keys: hold V for the wheel, Shift+V fires the pick + * (beside tg's Shift+E/Q/B variants), Ctrl+V fires the OS and Alt+V deploys or + * stows all arm chrome (chrome_wheel_arms.dm). Alt alone is tg's "Block + * movement", held only for the moment the combo is down. All of them rebind in + * the keybind settings like any other. + */ +/datum/keybinding/living/chrome + +/datum/keybinding/living/chrome/can_use(client/user) + return iscarbon(user.mob) + +/// The bearer's wheel, or null with a "no chrome" balloon for a body without any. +/datum/keybinding/living/chrome/proc/get_wheel(client/user) + var/mob/living/carbon/bearer = user.mob + if(bearer.stat == DEAD) + return null + var/datum/component/chrome_wheel/wheel = get_chrome_wheel(bearer) + if(!wheel) + bearer.balloon_alert(bearer, "no chrome!") + return wheel + +/datum/keybinding/living/chrome/wheel + hotkey_keys = list("V") + name = CHROME_WHEEL_KEYBIND + full_name = "Chrome wheel" + description = "Hold to pick a chrome ability." + keybind_signal = COMSIG_KB_LIVING_CHROME_WHEEL_DOWN + +/datum/keybinding/living/chrome/wheel/down(client/user, turf/target) + . = ..() + if(.) + return + get_wheel(user)?.wheel_key_down() + return TRUE + +/datum/keybinding/living/chrome/wheel/up(client/user, turf/target) + . = ..() + if(.) + return + var/datum/component/chrome_wheel/wheel = user.mob.GetComponent(/datum/component/chrome_wheel) + wheel?.wheel_key_up() + +/datum/keybinding/living/chrome/use + hotkey_keys = list("ShiftV") + name = "use_chrome" + full_name = "Use chrome" + description = "Use the chrome ability picked on the wheel." + keybind_signal = COMSIG_KB_LIVING_USE_CHROME_DOWN + +/datum/keybinding/living/chrome/use/down(client/user, turf/target) + . = ..() + if(.) + return + get_wheel(user)?.use_selected() + return TRUE + +/datum/keybinding/living/chrome/use_os + hotkey_keys = list("CtrlV") + name = "use_os_chrome" + full_name = "Use OS chrome" + description = "Use your operating system chrome." + keybind_signal = COMSIG_KB_LIVING_USE_OS_CHROME_DOWN + +/datum/keybinding/living/chrome/use_os/down(client/user, turf/target) + . = ..() + if(.) + return + get_wheel(user)?.use_os() + return TRUE + +/datum/keybinding/living/chrome/deploy_arms + hotkey_keys = list("AltV") + name = "deploy_arm_chrome" + full_name = "Deploy arm chrome" + description = "Deploy or stow all your arm chrome." + keybind_signal = COMSIG_KB_LIVING_DEPLOY_ARM_CHROME_DOWN + +/datum/keybinding/living/chrome/deploy_arms/down(client/user, turf/target) + . = ..() + if(.) + return + get_wheel(user)?.use_arms() + return TRUE diff --git a/voidcrew/modules/cyberware/cyberware_base.dm b/voidcrew/modules/cyberware/cyberware_base.dm index c3c034580bc..0836cb99609 100644 --- a/voidcrew/modules/cyberware/cyberware_base.dm +++ b/voidcrew/modules/cyberware/cyberware_base.dm @@ -171,6 +171,10 @@ * Every optic on this base carries the chrome read (cyberware_scan.dm), the * diagnostic bus is what makes chrome eyes chrome eyes. Subtypes that add * their own ability must keep the read in their actions_types list. + * + * Every optic also zooms (cyberware_zoom.dm). That button is added in + * Initialize() whenever optics_zoom is above 0, so it never goes in + * actions_types. */ /obj/item/organ/eyes/robotic/cyberware name = "cyberware optics" @@ -192,6 +196,8 @@ /obj/item/organ/eyes/robotic/cyberware/Initialize(mapload) . = ..() AddComponent(/datum/component/cyberware, chrome_load, tier, chrome_capacity_bonus) + // Zoom rides every optic on this base (cyberware_zoom.dm). + setup_optics_zoom() /obj/item/organ/eyes/robotic/cyberware/Destroy() var/turf/drop_turf = get_turf(src) diff --git a/voidcrew/modules/cyberware/cyberware_zoom.dm b/voidcrew/modules/cyberware/cyberware_zoom.dm new file mode 100644 index 00000000000..1dff620378b --- /dev/null +++ b/voidcrew/modules/cyberware/cyberware_zoom.dm @@ -0,0 +1,244 @@ +/** + * # Optics zoom + * + * Every set of chrome optics (/obj/item/organ/eyes/robotic/cyberware and its + * subtypes) can zoom: one toggle button pans the bearer's camera toward the + * cursor, using tg's scope component (code/datums/components/scope.dm), the + * same one binoculars and rifle scopes use. How far it reaches is the optics' + * optics_zoom, passed straight through as the scope's range_modifier; better + * optics reach further, and the cheap ones slow their bearer while they look. + * + * The button rides the /datum/action/cooldown/cyberware bridge, so browned-out, + * EMP-scrambled or failing eyes can't zoom, and the chrome wheel collects it + * like any other chrome button. + * + * Zoom is look-only: + * - A zoomed bearer can't fire a gun (COMSIG_MOB_TRYING_TO_FIRE_GUN is refused, + * and a burst already under autofire stops when the zoom starts). + * - Their clicks on the zoomed view reach nothing on the map. The scope's + * fullscreen cursor catcher already eats them; check_click_intercept() below + * takes them before any click intercept or ClickOn() sees them. + * + * The zoom drops on its own when the eyes stop working or the bearer can't + * look: EMP, brownout or damage failure (chrome_passives_off()), the eyes + * coming out, blindness, a flash, a stun, knockdown or paralysis, any stat + * change (crit, sleep, death), and everything the scope already stops for + * (no client, climbing into a locker or a mech, the organ moving). + */ + +/obj/item/organ/eyes/robotic/cyberware + /// How far the zoom pans, as the scope's range_modifier: 1 reaches as far + /// again as the edge of the normal view, 2 twice that. 0 means no zoom. + var/optics_zoom = 1 + /// Slowdown while zoomed (a multiplicative_slowdown). 0 for none. + var/zoom_walk_penalty = 1 + /// Throttles the "can't aim" balloon, so autofire and click spam don't stack it. + COOLDOWN_DECLARE(zoom_aim_warning) + /// Throttles the iris tell, so flicking the zoom on and off can't flood chat. + COOLDOWN_DECLARE(zoom_tell) + +/// Gives these optics their zoom: the scope that does the panning, and the +/// button. Called from Initialize() on the optics base (cyberware_base.dm). +/obj/item/organ/eyes/robotic/cyberware/proc/setup_optics_zoom() + if(optics_zoom <= 0) + return + // ZOOM_METHOD_ITEM_ACTION with no item_action_type: the scope adds no button + // and no examine line of its own, and only zooms when we tell it to. + AddComponent(/datum/component/scope, range_modifier = optics_zoom, zoom_method = ZOOM_METHOD_ITEM_ACTION) + add_item_action(/datum/action/cooldown/cyberware/optics_zoom) + +/// Whether our bearer is looking through these optics' zoom right now. +/obj/item/organ/eyes/robotic/cyberware/proc/is_zoomed() + return owner && HAS_TRAIT_FROM(owner, TRAIT_CYBER_ZOOMED, REF(src)) + +/// Starts the zoom for our bearer. Returns TRUE if they are now zoomed. +/obj/item/organ/eyes/robotic/cyberware/proc/start_zoom() + var/mob/living/carbon/bearer = owner + if(!iscarbon(bearer) || is_zoomed()) + return FALSE + var/datum/component/cyberware/chrome = GetComponent(/datum/component/cyberware) + var/datum/component/scope/scope = GetComponent(/datum/component/scope) + if(!scope || !chrome?.is_running()) + return FALSE + if(bearer.is_blind()) + bearer.balloon_alert(bearer, "optics dark!") + return FALSE + if(!isturf(bearer.loc)) + bearer.balloon_alert(bearer, "can't see out!") + return FALSE + if(HAS_TRAIT(bearer, TRAIT_INCAPACITATED)) + return FALSE + // The scope refuses a clientless bearer and anyone already scoped (a rifle, + // binoculars), with its own balloon for the second. + if(!scope.zoom(bearer)) + return FALSE + engage_zoom(bearer) + return TRUE + +/** + * Our half of a zoom, once the scope is panning: the trait, the stop hooks, + * the gun block and the walk penalty. Split from start_zoom() because the scope + * needs a client, and a unit test has none. + */ +/obj/item/organ/eyes/robotic/cyberware/proc/engage_zoom(mob/living/carbon/bearer) + ADD_TRAIT(bearer, TRAIT_CYBER_ZOOMED, REF(src)) + // The scope stops itself for a few reasons of its own (no client, the bearer + // climbing into something); it drops TRAIT_USER_SCOPED when it does. + RegisterSignal(bearer, SIGNAL_REMOVETRAIT(TRAIT_USER_SCOPED), PROC_REF(on_scope_lost)) + RegisterSignal(bearer, COMSIG_MOB_TRYING_TO_FIRE_GUN, PROC_REF(on_zoomed_fire)) + RegisterSignal(bearer, COMSIG_MOB_STATCHANGE, PROC_REF(on_zoomed_stat_change)) + RegisterSignal(bearer, COMSIG_MOB_FLASHED, PROC_REF(on_zoomed_flashed)) + RegisterSignal(bearer, COMSIG_LIVING_STATUS_APPLIED, PROC_REF(on_zoomed_status)) + RegisterSignals(bearer, list(COMSIG_LIVING_STATUS_STUN, COMSIG_LIVING_STATUS_KNOCKDOWN, COMSIG_LIVING_STATUS_PARALYZE), PROC_REF(on_zoomed_stunned)) + if(zoom_walk_penalty) + bearer.add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/cyberware_zoom, multiplicative_slowdown = zoom_walk_penalty) + // Autofire fires through process_fire() and never asks the signal above, so + // a burst already rolling when the zoom starts is stopped here instead. + for(var/obj/item/gun/held in bearer.held_items) + var/datum/component/automatic_fire/autofire = held.GetComponent(/datum/component/automatic_fire) + autofire?.stop_autofiring() + // The tell, the chrome read's pattern: only people close enough see it. + if(COOLDOWN_FINISHED(src, zoom_tell)) + COOLDOWN_START(src, zoom_tell, 5 SECONDS) + bearer.visible_message(span_notice("[bearer]'s irises whir and narrow."), vision_distance = 3, ignored_mobs = bearer) + update_zoom_button() + +/// Stops the zoom, scope and all. Safe to call when nothing is zoomed. +/obj/item/organ/eyes/robotic/cyberware/proc/stop_zoom(mob/living/carbon/bearer) + if(!bearer) + return + var/datum/component/scope/scope = GetComponent(/datum/component/scope) + // Only ever stop OUR scope: the fullscreen it clears is shared by every scope. + if(scope?.tracker && HAS_TRAIT_FROM(bearer, TRAIT_USER_SCOPED, REF(scope))) + scope.stop_zooming(bearer) // drops TRAIT_USER_SCOPED, so on_scope_lost() runs + disengage_zoom(bearer) + +/// Undoes engage_zoom(). Idempotent: the passive hook calls it on every flip. +/obj/item/organ/eyes/robotic/cyberware/proc/disengage_zoom(mob/living/carbon/bearer) + if(!bearer) + return + REMOVE_TRAIT(bearer, TRAIT_CYBER_ZOOMED, REF(src)) + UnregisterSignal(bearer, list( + SIGNAL_REMOVETRAIT(TRAIT_USER_SCOPED), + COMSIG_MOB_TRYING_TO_FIRE_GUN, + COMSIG_MOB_STATCHANGE, + COMSIG_MOB_FLASHED, + COMSIG_LIVING_STATUS_APPLIED, + COMSIG_LIVING_STATUS_STUN, + COMSIG_LIVING_STATUS_KNOCKDOWN, + COMSIG_LIVING_STATUS_PARALYZE, + )) + bearer.remove_movespeed_modifier(/datum/movespeed_modifier/cyberware_zoom) + update_zoom_button() + +/// The zoom button shows green while zoomed (the cooldown action's active look). +/obj/item/organ/eyes/robotic/cyberware/proc/update_zoom_button() + for(var/datum/action/cooldown/cyberware/optics_zoom/zoom in actions) + zoom.build_all_button_icons(UPDATE_BUTTON_STATUS) + +/// One short balloon when a zoomed bearer tries to shoot. +/obj/item/organ/eyes/robotic/cyberware/proc/refuse_zoomed_aim(mob/living/carbon/bearer) + if(!COOLDOWN_FINISHED(src, zoom_aim_warning)) + return + COOLDOWN_START(src, zoom_aim_warning, 1 SECONDS) + bearer.balloon_alert(bearer, "too zoomed in to aim!") + +// ---- Stop hooks ---------------------------------------------------------- + +/obj/item/organ/eyes/robotic/cyberware/chrome_passives_off(mob/living/carbon/bearer) + . = ..() + // EMP reboot, brownout, damage failure and removal all come through here. + stop_zoom(bearer) + +/obj/item/organ/eyes/robotic/cyberware/on_mob_remove(mob/living/carbon/organ_owner, special = FALSE, movement_flags) + stop_zoom(organ_owner) + return ..() + +/// Signal proc for [SIGNAL_REMOVETRAIT] of TRAIT_USER_SCOPED: the scope stopped. +/obj/item/organ/eyes/robotic/cyberware/proc/on_scope_lost(mob/living/carbon/source) + SIGNAL_HANDLER + disengage_zoom(source) + +/// Signal proc for [COMSIG_MOB_TRYING_TO_FIRE_GUN]: no shooting through the zoom. +/obj/item/organ/eyes/robotic/cyberware/proc/on_zoomed_fire(mob/living/carbon/source, obj/item/gun/gun, atom/target, flag, params) + SIGNAL_HANDLER + refuse_zoomed_aim(source) + return COMPONENT_CANCEL_GUN_FIRE + +/// Signal proc for [COMSIG_MOB_STATCHANGE]: crit, sleep and death end the zoom. +/obj/item/organ/eyes/robotic/cyberware/proc/on_zoomed_stat_change(mob/living/carbon/source, new_stat, old_stat) + SIGNAL_HANDLER + if(new_stat != CONSCIOUS) + stop_zoom(source) + +/// Signal proc for [COMSIG_MOB_FLASHED]. +/obj/item/organ/eyes/robotic/cyberware/proc/on_zoomed_flashed(mob/living/carbon/source) + SIGNAL_HANDLER + stop_zoom(source) + +/// Signal proc for [COMSIG_LIVING_STATUS_APPLIED]: going blind ends the zoom. +/obj/item/organ/eyes/robotic/cyberware/proc/on_zoomed_status(mob/living/carbon/source, datum/status_effect/effect) + SIGNAL_HANDLER + if(istype(effect, /datum/status_effect/grouped/blindness)) + stop_zoom(source) + +/// Signal proc for stun, knockdown and paralysis. Mirrors the scope's own check. +/obj/item/organ/eyes/robotic/cyberware/proc/on_zoomed_stunned(mob/living/carbon/source, amount = 0, ignore_canstun = FALSE) + SIGNAL_HANDLER + if(amount > 0) + stop_zoom(source) + +// ---- Clicking through the zoom ------------------------------------------- + +/** + * A click on the zoomed view, swallowed. Returns FALSE only for a click that + * isn't on our zoom, which the caller then handles as normal. + */ +/obj/item/organ/eyes/robotic/cyberware/proc/zoom_click(mob/living/carbon/bearer, atom/movable/screen/fullscreen/cursor_catcher/scope/tracker) + var/datum/component/scope/scope = GetComponent(/datum/component/scope) + if(!is_zoomed() || !scope || scope.tracker != tracker) + return FALSE + if(isgun(bearer.get_active_held_item())) + refuse_zoomed_aim(bearer) + return TRUE + +/** + * Zoomed clicks go to zoom_click() before the client's and the mob's click + * intercepts, so an armed ability never receives the scope's screen object as + * its target. The trait check keeps this to one lookup for everyone else. + */ +/mob/living/carbon/check_click_intercept(params, atom/A) + if(HAS_TRAIT(src, TRAIT_CYBER_ZOOMED) && istype(A, /atom/movable/screen/fullscreen/cursor_catcher/scope)) + var/obj/item/organ/eyes/robotic/cyberware/optics = get_organ_slot(ORGAN_SLOT_EYES) + if(istype(optics) && optics.zoom_click(src, A)) + return TRUE + return ..() + +// ---- The button ----------------------------------------------------------- + +/datum/action/cooldown/cyberware/optics_zoom + name = "Optic Zoom" + desc = "Focus your optics on something far off." + // tg's binoculars: reads as "look far", and stays clear of the Deadeye's crosshair. + button_icon = 'icons/obj/devices/tool.dmi' + button_icon_state = "binoculars" + +/datum/action/cooldown/cyberware/optics_zoom/chrome_wheel_name() + return "Zoom" + +/datum/action/cooldown/cyberware/optics_zoom/Activate(atom/target) + var/obj/item/organ/eyes/robotic/cyberware/optics = organ + if(!istype(optics) || !optics.owner) + return FALSE + if(optics.is_zoomed()) + optics.stop_zoom(optics.owner) + return TRUE + return optics.start_zoom() + +/datum/action/cooldown/cyberware/optics_zoom/is_action_active(atom/movable/screen/movable/action_button/current_button) + var/obj/item/organ/eyes/robotic/cyberware/optics = organ + return istype(optics) && optics.is_zoomed() + +/// The walk tax on cheap optics while they're zoomed. Strength set per optics. +/datum/movespeed_modifier/cyberware_zoom + variable = TRUE diff --git a/voidcrew/modules/cyberware/icons/chrome_hud.dmi b/voidcrew/modules/cyberware/icons/chrome_hud.dmi new file mode 100644 index 0000000000000000000000000000000000000000..2b65076978cf4ee3367344382e7d55b25f9b6960 GIT binary patch literal 761 zcmVV=-0C=2JR&a84_w-Y6@%7{?OD!tS%+FJ>RWQ*r;NmRLOex6#a*U0*I5Sc+ z(=$pSoZ^zil2jm5DLJDkKQ~p0i!&v&s2C_<$iQlzZl>gNKs z8~_@*B-+K3+5!Lo0zyedK~#90#4rqQqYgX-I#$?jga_!t!pcjq@(`@N1S>*f zxd(ue4dxRM!3N4n2A}1>q|Q;PpVU(>iJkg$?6hvzEgZcy;plYzjsK4ikLvu*_0``0 zua7r#joA}08b)hmv><>w1yHlrP_jS`u&xL)K;Q9dwb%c--R{Op*GSR=wO;1{x}u1s z#!G!3^p^1u(_9~gS8mEq$oD82n|DE}{+=r5JkJ?S7va1s>1ss)kWiw3z>2krmcbrE z@Yq~Vhh)V)=Y5#}{Q9!HaGxa`oe#JWs7ivPVm#+9Fr2mlAfu5`f=n2YW*J&SZn6@a zw6!nKFMj)=ZH0xkmSuR3eYiN_F)XK{=Wbjw0&jf|nTV2HpydH9S9`?aog%F@lpa-* z@lt|=HkW6f)+eeiE>zxcZ&aDHyZgVkW5*@WqFz|!OntbrjQ7q_30N9Zw{RryM4XiH z383}WqQx_Uq%%duxE24UXz?=UejSz`S2ZtdV=X)yh2&){lL42cOdF5%XgC2I;hc={ zoTQ`VX|N^If5)H)nXD4RO6DhP!jxSw=h%0>42=Q1!261Q2+}y+L;lH$D-Y%y<8GKM zY)V<*GQd+7YmqRsPLB8l4eo|;U5^$r@TtJP@W6aeIZeZqWa*Jjk`Pzaq(tD0j$>J> zb57{BEgZEKvEi2Yxxy^Sd+P#F2jKM3^%E7wTROsHIOb~#p$88EKm-Z3-vJ`NFH#xF rj((0GN4eUf^*w<5HsGyMc1y+&fM%t~Nv#ya00000NkvXXu0mjfw#H=e literal 0 HcmV?d00001 diff --git a/voidcrew/modules/cyberware/icons/chrome_wheel.dmi b/voidcrew/modules/cyberware/icons/chrome_wheel.dmi new file mode 100644 index 0000000000000000000000000000000000000000..a75f826549daa77a992bee93a46b04fcc83d6832 GIT binary patch literal 1000 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSyQ@MXN?cNllZ!G7N;32F7#J$% z%$;i4~ud6xy2qFs&?E%FC^~CGcmpwv0(&@E0@V%Gomyx8=;2 z+cZb@cu(8{bFb|=#~(fInzULd%xZI|#>53$nd-?p+aIJ9ysKn(6=9viaaCG;t)}E* z&;5-@IYXoCkHvN}JUP6$R&f6vts|DQOjcKzJLJFRq&NTP|6Xp>{yXwy;Q5C=df6M| z*6jW%7<$dM)meT2LPhV-DSzf$H~B2d&tL7w!N9=u!qdeuq+-t7yS71(4J3{g&Q8?O z)VO>pAfT8f=uH7*e6x&ljIwxw#v#EK+i#>rpVHm7q;e)hn$f{yViT8!SN_}I#v-hp zY(Gu3cETzqU=YpOmESxw@=DXIUE6i~pPKs$Z~b#MOEjcTtMvXse%l0Rr*AWN|5=u) z^No}H?(>r`Zx)~V6#wu4?9#vgG}06`_!$M<8IA}t6tXzT5XUss450~SP5xTB-@4Z( zul2g;%AfuqAwX_pn5ww-w!+WPe_sE4^v%NBJwJDz|NQOax?7pN2KTE&i@s|;Esf_* zNSpR*pH0ZMXDw^j>zz-YW?BF1?{;mL9#)GhopcUk?%0^+_fV+)>h?+ZSJ zpI&>syCL^SUuszI<~x;Vi=LRt1n_QnX}0h6j#J`qFYKCmH?1<6ReK}vh0vqHZ~sq8 z75fl&JmhW2|3(R3k?=>l41(bJkMU$&AgJ+2^TFE9=?W~#|JYcsGpt=Fe8w~U1!qq6 zFT1LLV$tDtwhioZ4d>t8`}Xrhu7rd8gdIY+89F*J<8DWInbw)osi*!-1f>*DS3j3^ HP6mi9b~D+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8^|KN=s-x<<@ijP-P6X-n7GJ zoPP;tcdFy}45wU&{kO_y<381hs|T#w_5ZlvN<|XrEgNnI?4!dfz`LW*ZvfNZvzoLJwA38#%9+XfwcnCzkDI=a=E|;83Ammp+!TT!tS3Z;hZGY zQVbq1CEdqEGo0wJ?b7)nqLeJK6p!ebks@DGxCa*bJ!6+UUT~Y$x+Qu}Lg=WTe*o9Y zol*Rj8NXgiz7*-bVD0Yqj=Jc9K;&_(XR*H{0Eb^%pS=*(ngO8=^^Z?edQQB$2H8x1 z)7>{R#PS@s;1KEr6!?f!Q#Of7{>mt$E<1u-1g6dAmCe9ggMi$oSQwR0AQCEJj-PS} z0cU83xx=T<_a-jLjzzf!F=jcKQB>A!-mMXYk world.time) + launched = TRUE + click_wrapper(body, victim) + if(launched) + sleep(3 SECONDS) + var/harm = victim.getBruteLoss() + victim.getFireLoss() + victim.getToxLoss() + victim.getOxyLoss() + victim.getStaminaLoss() + var/knocked = victim.IsKnockdown() || victim.IsParalyzed() || victim.IsStun() + if(harm > 0 || knocked) + cell(ware_type, "FAIL: hurt someone while a pacifist ([harm] damage[knocked ? ", knocked down" : ""])") + TEST_FAIL("[ware_type]: a pacifist hurt a bystander with it ([harm] damage[knocked ? ", knocked down" : ""])") + else + cell(ware_type, "ok") + qdel(victim) + qdel(body) + +/// Moving and striking buttons refuse a body that is stunned, paralysed, immobilised or +/// riding a mech, and still work for a healthy one. Only the buttons that carry the bearer +/// across the floor or into a blow are walked: the rest are covered by the other columns. +/datum/unit_test/voidcrew_cyberware_matrix/incapacitated + column = "stunned/mech" + +/datum/unit_test/voidcrew_cyberware_matrix/incapacitated/Run() + var/static/list/movers = list( + /datum/action/cooldown/cyberware/hopper_leap, + /datum/action/cooldown/cyberware/piledriver_leap, + /datum/action/cooldown/cyberware/mantis_lunge, + /datum/action/cooldown/cyberware/skyhook, + ) + for(var/ware_type in voidcrew_cyberware_pool()) + var/list/wares = list() + var/mob/living/carbon/human/body = fit(ware_type, wares) + if(!body) + continue + var/obj/item/organ/ware = wares[1] + var/list/walked = list() + for(var/datum/action/cooldown/cyberware/ability as anything in buttons(ware)) + for(var/mover_type in movers) + if(istype(ability, mover_type)) + walked += ability + if(!length(walked)) + qdel(body) + continue + var/turf/start = get_turf(body) + var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human/consistent, locate(start.x, start.y + 2, start.z)) + var/obj/item/arm_thing = arm_item(ware) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/arm_ware = ware + var/turf/landing = locate(start.x + 3, start.y, start.z) + var/turf/far_wall = locate(start.x, start.y + 5, start.z) + for(var/datum/action/cooldown/cyberware/ability as anything in walked) + var/list/results = list() + for(var/condition in list("healthy", "stunned", "paralyzed", "immobilized", "cuffed", "in a mech")) + body.forceMove(start) + body.SetStun(0) + body.SetParalyzed(0) + body.SetImmobilized(0) + body.set_handcuffed(null) + // The blade comes out while the body is still well. + if(arm_thing && !arm_ware.active_item) + arm_ware.Extend(arm_thing) + var/obj/vehicle/sealed/mecha/ripley/mech + switch(condition) + if("stunned") + body.Stun(30 SECONDS) + if("paralyzed") + body.Paralyze(30 SECONDS) + if("immobilized") + body.Immobilize(30 SECONDS) + if("cuffed") + body.set_handcuffed(new /obj/item/restraints/handcuffs(body)) + if("in a mech") + mech = new /obj/vehicle/sealed/mecha/ripley(start) + mech.mob_enter(body, silent = TRUE) + ability.next_use_time = 0 + ability.Trigger(body, NONE, victim) + var/fired = ability.next_use_time > world.time + if(!fired) + ability.next_use_time = 0 + ability.Trigger(body, NONE, landing) + fired = ability.next_use_time > world.time + if(!fired) + // The winch wants a wall: the far side of the room. + ability.next_use_time = 0 + ability.Trigger(body, NONE, far_wall) + fired = ability.next_use_time > world.time + results[condition] = fired + if(fired) + sleep(2 SECONDS) + if(mech) + mech.mob_exit(body, silent = TRUE) + qdel(mech) + body.SetStun(0) + body.SetParalyzed(0) + body.SetImmobilized(0) + body.set_handcuffed(null) + var/list/line = list() + for(var/condition in results) + line += "[condition] [results[condition] ? "fires" : "refuses"]" + if(!results["healthy"]) + // The fixture could not aim it; say so rather than pass quietly. + cell("[ware_type] / [ability.type]", "inconclusive, did not fire for a healthy body") + continue + cell("[ware_type] / [ability.type]", english_list(line)) + for(var/condition in list("stunned", "paralyzed", "immobilized", "in a mech")) + if(results[condition]) + TEST_FAIL("[ware_type] / [ability.type] fired for a body that is [condition]") + qdel(victim) + qdel(body) + +/// A button aimed at its own bearer. Click abilities get clicked on yourself, and every one has +/// to take it without a runtime and without leaving the bearer worse for it than a refusal +/// would. (The Angler's barb used to run a line from the bearer to the bearer.) +/datum/unit_test/voidcrew_cyberware_matrix/self_click + column = "self click" + +/datum/unit_test/voidcrew_cyberware_matrix/self_click/Run() + for(var/ware_type in voidcrew_cyberware_pool()) + var/list/wares = list() + var/mob/living/carbon/human/body = fit(ware_type, wares) + if(!body) + continue + var/obj/item/organ/ware = wares[1] + var/obj/item/arm_thing = arm_item(ware) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/arm_ware = ware + if(arm_thing) + arm_ware.Extend(arm_thing) + var/turf/before = get_turf(body) + for(var/datum/action/cooldown/cyberware/ability as anything in buttons(ware)) + ability.Trigger(body, NONE, body) + // Whatever it did, it did not carry the bearer off or take the bearer apart. + TEST_ASSERT(!QDELETED(body) && body.stat != DEAD, "[ware_type] / [ability.type] aimed at its own bearer killed or deleted them") + if(ware_type in list(/obj/item/organ/cyberimp/arm/toolkit/cyberware/angler)) + TEST_ASSERT_EQUAL(get_turf(body), before, "The Angler's barb moved a bearer who fired it at themselves") + cell(ware_type, "self click: ok") + sleep(1) + qdel(body) + +/// Taking a ware out, either way, leaves nothing of it listening to the body it left. +/datum/unit_test/voidcrew_cyberware_matrix/listeners + column = "removal" + +/datum/unit_test/voidcrew_cyberware_matrix/listeners/Run() + var/list/bare_state = voidcrew_cyberware_passive_state(allocate(/mob/living/carbon/human/consistent)) + for(var/ware_type in voidcrew_cyberware_pool()) + for(var/quick in list(FALSE, TRUE)) + var/list/wares = list() + var/mob/living/carbon/human/body = fit(ware_type, wares) + if(!body) + if(!quick) + cell(ware_type, "no home on a plain body") + continue + var/obj/item/organ/ware = wares[1] + var/obj/item/arm_thing = arm_item(ware) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/arm_ware = ware + if(arm_thing) + arm_ware.Extend(arm_thing) + for(var/datum/action/cooldown/cyberware/ability as anything in buttons(ware)) + ability.Trigger(body, NONE, body) + var/list/problems = list() + ware.Remove(body, special = quick) + var/list/stale = voidcrew_cyberware_stale_listeners(body) + if(length(stale)) + problems += "left listening to the body it was pulled from: [english_list(stale)]" + if(length(voidcrew_cyberware_held_traits(body, ware))) + problems += "left traits on the body it was pulled from" + if(length(body.actions)) + problems += "left [length(body.actions)] buttons on the body it was pulled from" + if(arm_thing && arm_ware.active_item) + problems += "still holds its deployed weapon after removal" + if(body.click_intercept) + problems += "left a targeting mode on the body it was pulled from" + var/list/leaks = voidcrew_cyberware_state_diff(bare_state, voidcrew_cyberware_passive_state(body)) + if(length(leaks)) + problems += "left the body changed: [english_list(leaks)]" + cell(ware_type, "[quick ? "quick" : "normal"] removal: [length(problems) ? "FAIL: [problems[1]]" : "ok"]") + if(length(problems)) + TEST_FAIL("[ware_type] ([quick ? "quick" : "normal"] removal): [english_list(problems)]") + qdel(ware) + qdel(body) + +/// Ship saves: a hull checkpoint rebuilds machinery and structures and wipes every loose item, +/// so chrome lying about on a ship is cleared like any other stock and bodies are never +/// kept. The one fitting is the cradle, which a saved ship must never rebuild. +/datum/unit_test/voidcrew_cyberware_matrix/ship_save + column = "ship save" + +/datum/unit_test/voidcrew_cyberware_matrix/ship_save/Run() + var/obj/machinery/chrome_cradle/cradle = allocate(/obj/machinery/chrome_cradle) + TEST_ASSERT(!outpost_checkpoint_saves(cradle), "A ship checkpoint would keep a chrome cradle") + TEST_ASSERT_NULL(cradle.checkpoint_type(), "A chrome cradle has a type to be rebuilt as") + cell("/obj/machinery/chrome_cradle", "not saved by a checkpoint") + // Every chrome organ is a plain item, which the clear-out takes, and none of them is a + // machine or a structure that the checkpoint would keep as a fitting. + for(var/ware_type in voidcrew_cyberware_pool()) + TEST_ASSERT(ispath(ware_type, /obj/item/organ), "[ware_type] is not an organ item") + TEST_ASSERT(!ispath(ware_type, /obj/machinery) && !ispath(ware_type, /obj/structure), "[ware_type] is a machine or structure") + cell("every ware", "organ items: cleared with the loose stock, never kept") + +/// The camo weave's own columns: what ends it. +/datum/unit_test/voidcrew_cyberware_matrix/camo + column = "camo" + +/datum/unit_test/voidcrew_cyberware_matrix/camo/Run() + var/obj/item/organ/cyberimp/cyberware/ghostskin/weave + for(var/weave_type in list(/obj/item/organ/cyberimp/cyberware/ghostskin, /obj/item/organ/cyberimp/cyberware/ghostskin/street)) + for(var/condition in list("emp", "brownout", "death", "stun", "paralyze", "cuffs", "mech", "zoom", "gib")) + var/mob/living/carbon/human/body = allocate(/mob/living/carbon/human/consistent) + weave = allocate(weave_type) + weave.Insert(body, special = TRUE) + weave.engage_camo(body) + var/engaged = HAS_TRAIT(body, MATRIX_TRAIT_CAMO) + var/obj/vehicle/sealed/mecha/ripley/mech + switch(condition) + if("emp") + body.emp_act(EMP_HEAVY) + if("brownout") + var/obj/item/organ/cyberimp/cyberware/matrix_ballast/ballast = allocate(/obj/item/organ/cyberimp/cyberware/matrix_ballast) + ballast.Insert(body, special = TRUE) + if("death") + body.death() + if("stun") + body.Stun(5 SECONDS) + if("paralyze") + body.Paralyze(5 SECONDS) + if("cuffs") + body.set_handcuffed(new /obj/item/restraints/handcuffs(body)) + if("mech") + mech = new /obj/vehicle/sealed/mecha/ripley(get_turf(body)) + mech.mob_enter(body, silent = TRUE) + if("zoom") + var/obj/item/organ/eyes/robotic/cyberware/spyglass/eyes = allocate(/obj/item/organ/eyes/robotic/cyberware/spyglass) + eyes.Insert(body, special = TRUE) + eyes.engage_zoom(body) + if("gib") + body.gib() + var/still = HAS_TRAIT(body, MATRIX_TRAIT_CAMO) + cell("[weave_type]", "[condition]: camo [engaged ? "was on" : "never came on"], then [still ? "stayed on" : "dropped"]") + if(weave_type == /obj/item/organ/cyberimp/cyberware/ghostskin) + TEST_ASSERT(engaged, "Ghostskin would not engage on a healthy body") + // Hard stops: a dark weave, a dead wearer, a stripped body. + if(condition in list("emp", "brownout", "death", "gib")) + TEST_ASSERT(!still, "Ghostskin stayed engaged through [condition]") + else + TEST_ASSERT(!engaged, "the street weave grants camo it should not") + if(mech) + mech.mob_exit(body, silent = TRUE) + qdel(mech) + qdel(body) + qdel(weave) + +/// Doing harm from inside the field drops it, whichever ware does the harm: a punch from a +/// fist that skips the ordinary attack chain, a lunge, a landing. +/datum/unit_test/voidcrew_cyberware_matrix/camo_harm + column = "camo (harm)" + +/datum/unit_test/voidcrew_cyberware_matrix/camo_harm/Run() + for(var/ware_type in list( + /obj/item/organ/cyberimp/cyberware/gorilla_arms, + /obj/item/organ/cyberimp/cyberware/gorilla_arms/street, + /obj/item/organ/cyberimp/cyberware/scrapper, + /obj/item/organ/cyberimp/arm/toolkit/cyberware/mantis, + /obj/item/organ/cyberimp/cyberware/piledriver, + )) + var/mob/living/carbon/human/body = allocate(/mob/living/carbon/human/consistent) + var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human/consistent, get_step(body, EAST)) + var/obj/item/organ/cyberimp/cyberware/ghostskin/weave = allocate(/obj/item/organ/cyberimp/cyberware/ghostskin) + weave.Insert(body, special = TRUE) + var/obj/item/organ/ware = allocate(ware_type) + TEST_ASSERT(ware.Insert(body, special = TRUE), "[ware_type] would not install beside the weave") + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/arm_ware = ware + if(istype(arm_ware)) + var/obj/item/blade = locate(/obj/item) in arm_ware.contents + arm_ware.Extend(blade) + body.set_combat_mode(TRUE) + body.face_atom(victim) + weave.engage_camo(body) + TEST_ASSERT(HAS_TRAIT(body, MATRIX_TRAIT_CAMO), "Ghostskin would not engage for [ware_type]") + if(ispath(ware_type, /obj/item/organ/cyberimp/cyberware/piledriver) || istype(arm_ware)) + for(var/datum/action/cooldown/cyberware/ability as anything in buttons(ware)) + ability.Trigger(body, NONE, victim) + else + click_wrapper(body, victim) + var/dropped = !HAS_TRAIT(body, MATRIX_TRAIT_CAMO) + cell("[ware_type]", "camo [dropped ? "dropped" : "stayed up"] when it hurt someone") + if(!dropped) + TEST_FAIL("[ware_type]: the field stayed up while the bearer attacked") + if(ispath(ware_type, /obj/item/organ/cyberimp/cyberware/piledriver) || istype(arm_ware)) + sleep(3 SECONDS) + qdel(body) + qdel(victim) + +#undef MATRIX_TRAIT_CAMO +#undef MATRIX_TRAIT_ZOOMED +#undef MATRIX_SLOT_SKIN diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware_soak.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware_soak.dm new file mode 100644 index 00000000000..4fa57d641bb --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware_soak.dm @@ -0,0 +1,935 @@ +/** + * # Chrome soak + * + * A long, loud, mostly random test for the cyberware module (voidcrew/modules/cyberware/). + * Ten humans get random chrome loadouts and are then put through five minutes of game time of + * everything players and the world do to chrome: every installed ability triggered (with real + * targets, so click abilities fire), EMPs on bodies and on single pieces, forced brownouts, + * cradle installs, removals and tune-ups, sell-backs at the ripperdoc ledgers, death and + * revival, gibbing and dusting (chrome salvage), lost limbs, stuns, cuffs, pacifism, zoom, + * a ride in a mech, speech. A sweep every two seconds checks that the ware's own bookkeeping + * stays consistent. At the end the survivors are healed, stripped of chrome, left alone and + * compared against a snapshot taken before they got any, and everything the soak made is + * deleted and checked for being garbage collected. + * + * It is a SOAK, not a regression test: it fails on any runtime (the error handler fails + * whichever test is running, see docs/UNIT_TESTING_LOCAL.md), on any inconsistency the sweep + * finds, and on anything left behind. It is also slow, so it extends voidcrew_opt_in and is + * left out of a general run. Run it on its own: + * + * dd.exe tgstation.dmb -port -close -trusted -invisible \ + * -params "log-directory=ci&test_only=/datum/unit_test/voidcrew_opt_in/cyberware_soak" + * + * Optional world params: soak_length (deciseconds of storm, default 3000) and soak_seed + * (a number, to repeat a roll of the dice). The report is also written to data/soak_report.txt. + * + * Unit-test files compile before voidcrew/_DEFINES/, so the fork defines this file needs are + * restated below under SOAK_ names. + */ + +/// ORGAN_SLOT_CYBERWARE_SKIN, the Ghostskin slot. +#define SOAK_SLOT_SKIN "cyberware_skin" +/// TRAIT_CYBER_CAMO and TRAIT_CYBER_ZOOMED. +#define SOAK_TRAIT_CAMO "cyber_camo" +#define SOAK_TRAIT_ZOOMED "cyber_zoomed" +/// CYBERWARE_INSTALL_TIME, CYBERWARE_REMOVAL_TIME, CYBERWARE_EMP_DOWNTIME and CYBERWARE_TUNEUP_FEE. +#define SOAK_INSTALL_TIME (4 SECONDS) +#define SOAK_REMOVAL_TIME (3 SECONDS) +#define SOAK_EMP_DOWNTIME (9 SECONDS) +#define SOAK_TUNEUP_FEE 200 +/// How long an inconsistency must hold before the sweep calls it a bug. SSmobs ticks every +/// two seconds and the ware's per-tick settle runs on it, so anything shorter is a race. +#define SOAK_PATIENCE (6 SECONDS) + +/// Ballast for forcing a brownout: far over any body's capacity, in a slot nothing else uses, +/// with no ability of its own. +/obj/item/organ/cyberimp/cyberware/soak_ballast + name = "soak ballast" + zone = BODY_ZONE_CHEST + slot = "voidcrew_soak_ballast" + chrome_load = 25 + +/datum/unit_test/voidcrew_opt_in/cyberware_soak + priority = TEST_LONGER + /// Game time the storm runs for. + var/storm_length = 3000 + /// Bodies kept in play. + var/crew_size = 10 + /// FALSE once the storm is over, so late async events stand down. + var/storming = FALSE + /// Live bodies. + var/list/crew = list() + /// Body -> its snapshot from before it had any chrome. + var/list/baselines = list() + /// Chrome that came off a body or out of a gib and lies about, for the cradle to reinstall. + var/list/loose_chrome = list() + /// Weakrefs to everything this test made that must be collected at the end. + var/list/made = list() + /// Every installable chrome typepath. + var/list/ware_pool = list() + /// Floor turfs in the room. + var/list/floor_turfs = list() + /// Splice's ledgers (the street doc's are the same entries with other words). + var/list/ledgers = list() + /// Problem category -> how many times it was seen. + var/list/problem_counts = list() + /// Problem category -> the first example. + var/list/problem_examples = list() + /// Counters for the report. + var/list/stats = list() + /// Sweep keys seen in this sweep. + var/list/seen_now = list() + /// Sweep key -> world.time it was first seen. + var/list/suspects = list() + /// Sweep keys already reported. + var/list/reported = list() + var/obj/machinery/chrome_cradle/cradle + /// The cradle is single-use at a time; this is the world.time its current user lets go. + var/cradle_lease = 0 + var/mech_lease = 0 + var/next_index = 0 + var/runtimes_at_start = 0 + var/skipped_runtimes_at_start = 0 + var/timers_at_start = 0 + /// SSgarbage failure and hard-delete counts per type before the storm. + var/list/gc_before = list() + +// ---- Bookkeeping --------------------------------------------------------- + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/note(category, detail) + problem_counts[category] = (problem_counts[category] || 0) + 1 + if(!problem_examples[category]) + problem_examples[category] = detail + log_world("SOAK PROBLEM: [category]: [detail]") + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/count(what, amount = 1) + stats[what] = (stats[what] || 0) + amount + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/track(datum/thing) + made += WEAKREF(thing) + return thing + +/// A sweep finding that only counts once it has held for `patience`. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/suspect(key, category, detail, patience = SOAK_PATIENCE) + seen_now[key] = TRUE + if(!suspects[key]) + suspects[key] = world.time + return + if(world.time - suspects[key] >= patience && !reported[key]) + reported[key] = TRUE + note(category, detail) + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/rng_seed() + var/seed = text2num(world.params["soak_seed"]) + if(isnull(seed)) + seed = rand(1, 999999) + rand_seed(seed) + log_world("SOAK seed [seed]") + return seed + +// ---- Setup --------------------------------------------------------------- + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/build_pool() + ware_pool = voidcrew_cyberware_pool().Copy() + TEST_ASSERT(length(ware_pool) > 40, "The chrome pool is only [length(ware_pool)] types, the walk of the subtypes found too little") + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/build_room() + var/turf/low = run_loc_floor_bottom_left + var/turf/high = run_loc_floor_top_right + for(var/x in min(low.x, high.x) to max(low.x, high.x)) + for(var/y in min(low.y, high.y) to max(low.y, high.y)) + var/turf/candidate = locate(x, y, low.z) + // The cradle's tile lifts whoever stands on it, which would be part of a snapshot. + if(isfloorturf(candidate) && candidate != run_loc_floor_top_right) + floor_turfs += candidate + TEST_ASSERT(length(floor_turfs) >= 12, "The test room only has [length(floor_turfs)] floor tiles") + +/// A fresh body. It stands bare for a few seconds first, so the snapshot it is later compared +/// with already has the modifiers every body picks up on its own (mood, for one). +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/spawn_body() + next_index++ + var/index = next_index + var/mob/living/carbon/human/body = new /mob/living/carbon/human/consistent(pick(floor_turfs)) + track(body) + body.fully_replace_character_name(body.real_name, "Soak [index]") + var/obj/item/card/id/id = new(body) + id.registered_account = allocate(/datum/bank_account, "Soak [index]", null, 1, FALSE) + id.registered_account.account_balance = 50000 + body.equip_to_slot_or_del(id, ITEM_SLOT_ID) + body.equip_to_slot_or_del(new /obj/item/clothing/under/color/grey(body), ITEM_SLOT_ICLOTHING) + sleep(6 SECONDS) + if(QDELETED(body) || !storming) + return body + baselines[body] = snapshot(body) + crew += body + random_loadout(body) + return body + +/// A random set of chrome in a random body. Most bodies fit their load; some are loaded +/// past capacity on purpose and start browned out. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/random_loadout(mob/living/carbon/human/body) + var/overshoot = prob(25) ? rand(1, 8) : 0 + var/pieces = rand(2, 7) + var/list/candidates = shuffle(ware_pool.Copy()) + for(var/ware_type in candidates) + if(pieces <= 0) + break + var/obj/item/organ/ware = track(new ware_type(get_turf(body))) + if(!body.get_bodypart(deprecise_zone(ware.zone))) + qdel(ware) + continue + var/datum/component/cyberware/chrome = ware.GetComponent(/datum/component/cyberware) + var/list/incumbents = ware.cyberware_get_incumbents(body) + // Keep most loadouts free of evictions, they are not what is being tested here. + if(length(incumbents) && prob(85)) + qdel(ware) + continue + var/projected = get_chrome_load(body) + (chrome?.chrome_load || 0) + for(var/obj/item/organ/incumbent in incumbents) + projected -= get_installed_capacity_cost(incumbent) + if(projected > get_chrome_capacity(body) + (chrome?.capacity_bonus || 0) + overshoot) + qdel(ware) + continue + if(!ware.Insert(body, special = TRUE)) + qdel(ware) + continue + pieces-- + count("pieces installed") + +/// Everything that should be back to normal once a body has no chrome and has been left alone. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/snapshot(mob/living/carbon/human/body) + var/list/snap = list() + snap["filters"] = length(body.filters) + snap["actions"] = length(body.actions) + // tg's eyelids join the body's vis_contents whenever eyes are drawn, and stay there after + // the eyes leave, so chrome optics going in and out would read as a leak. Not chrome's. + var/visible = 0 + for(var/atom/movable/thing as anything in body.vis_contents) + if(!istype(thing, /obj/effect/abstract/eyelid_effect)) + visible++ + snap["vis_contents"] = visible + var/list/statuses = list() + for(var/datum/status_effect/effect as anything in body.status_effects) + statuses += "[effect.type]" + snap["status effects"] = statuses + var/list/traits = list() + for(var/trait in body._status_traits) + traits[trait] = length(body._status_traits[trait]) + snap["traits"] = traits + var/list/speed = list() + for(var/modifier in body.movespeed_modification) + speed += "[modifier]" + snap["movespeed"] = speed + var/list/action_speed = list() + for(var/modifier in body.actionspeed_modification) + // Mood's own modifier arrives on its own schedule. + if(!findtext("[modifier]", "sanity_component")) + action_speed += "[modifier]" + snap["actionspeed"] = action_speed + var/list/physiology = list() + for(var/var_name in body.physiology.vars) + // The reference finder stamps every datum it walks after a failed GC. + if(var_name == "last_find_references") + continue + var/value = body.physiology.vars[var_name] + if(isnum(value)) + physiology[var_name] = value + for(var/rating in ARMOR_LIST_ALL()) + physiology["armor [rating]"] = body.physiology.armor.get_rating(rating) + snap["physiology"] = physiology + var/list/components = list() + for(var/component_type in body._datum_components) + components += "[component_type]" + snap["components"] = components + var/list/loose = list() + for(var/atom/movable/thing as anything in body.contents) + if(isorgan(thing) || isbodypart(thing) || istype(thing, /obj/item/clothing) || istype(thing, /obj/item/card/id)) + continue + loose += "[thing.type]" + snap["carried"] = loose + var/list/held = list() + for(var/obj/item/thing in body.held_items) + held += "[thing.type]" + snap["held"] = held + snap["intercept"] = body.click_intercept ? "[body.click_intercept.type]" : null + return snap + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/Run() + rng_seed() + var/length_param = text2num(world.params["soak_length"]) + if(length_param) + storm_length = length_param + runtimes_at_start = GLOB.total_runtimes + skipped_runtimes_at_start = GLOB.total_runtimes_skipped + timers_at_start = length(SStimer.timer_id_dict) + for(var/gc_type in SSgarbage.items) + var/datum/qdel_item/item = SSgarbage.items[gc_type] + gc_before[gc_type] = list(item.failures, item.hard_deletes) + + build_pool() + build_room() + for(var/ledger_type in typesof(/datum/shop_buyback/ripperdoc) - /datum/shop_buyback/ripperdoc) + // Ratchet's entries are the same ledger in other words. + if(findtext("[ledger_type]", "/street_doc")) + continue + ledgers += allocate(ledger_type) + cradle = track(new /obj/machinery/chrome_cradle(run_loc_floor_top_right)) + storming = TRUE + for(var/i in 1 to crew_size) + INVOKE_ASYNC(src, PROC_REF(spawn_body)) + sleep(8 SECONDS) + // Two bodies are pacifists for the whole storm. + for(var/i in 1 to min(2, length(crew))) + var/mob/living/carbon/human/pacifist = crew[i] + ADD_TRAIT(pacifist, TRAIT_PACIFISM, "soak") + + var/end_time = world.time + storm_length + var/next_sweep = world.time + var/next_heal = world.time + 20 SECONDS + while(world.time < end_time) + sleep(1 SECONDS) + storm_tick() + if(world.time >= next_sweep) + next_sweep = world.time + 2 SECONDS + sweep() + if(world.time >= next_heal) + next_heal = world.time + 20 SECONDS + top_up() + storming = FALSE + // Let the long events (a death waiting to revive, a brownout waiting to lift, a cradle + // sequence) finish before anyone looks at the wreckage. + sleep(15 SECONDS) + sweep() + sweep() + + audit_survivors() + var/list/leaks = clean_up() + report(leaks) + +// ---- The storm ----------------------------------------------------------- + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/storm_tick() + var/static/list/event_weights = list( + "trigger" = 30, "swing" = 12, "wheel" = 4, "emp" = 8, "emp_one" = 4, "brownout" = 6, + "cradle" = 5, "sell" = 3, "kill" = 5, "gib" = 2, "dust" = 1, "dismember" = 5, "stun" = 6, + "cuff" = 3, "pacifist" = 2, "zoom" = 6, "damage" = 4, "mech" = 2, "speak" = 2, "swap" = 4, + ) + for(var/mob/living/carbon/human/body as anything in crew.Copy()) + if(QDELETED(body)) + crew -= body + baselines -= body + INVOKE_ASYNC(src, PROC_REF(spawn_body)) + continue + if(!prob(35)) + continue + switch(pick_weight(event_weights)) + if("trigger") + INVOKE_ASYNC(src, PROC_REF(ev_trigger), body) + if("swing") + INVOKE_ASYNC(src, PROC_REF(ev_swing), body) + if("wheel") + INVOKE_ASYNC(src, PROC_REF(ev_wheel), body) + if("emp") + INVOKE_ASYNC(src, PROC_REF(ev_emp), body) + if("emp_one") + INVOKE_ASYNC(src, PROC_REF(ev_emp_one), body) + if("brownout") + INVOKE_ASYNC(src, PROC_REF(ev_brownout), body) + if("cradle") + INVOKE_ASYNC(src, PROC_REF(ev_cradle), body) + if("sell") + INVOKE_ASYNC(src, PROC_REF(ev_sell), body) + if("kill") + INVOKE_ASYNC(src, PROC_REF(ev_kill), body) + if("gib") + INVOKE_ASYNC(src, PROC_REF(ev_gib), body, FALSE) + if("dust") + INVOKE_ASYNC(src, PROC_REF(ev_gib), body, TRUE) + if("dismember") + INVOKE_ASYNC(src, PROC_REF(ev_dismember), body) + if("stun") + INVOKE_ASYNC(src, PROC_REF(ev_stun), body) + if("cuff") + INVOKE_ASYNC(src, PROC_REF(ev_cuff), body) + if("pacifist") + INVOKE_ASYNC(src, PROC_REF(ev_pacifist), body) + if("zoom") + INVOKE_ASYNC(src, PROC_REF(ev_zoom), body) + if("damage") + INVOKE_ASYNC(src, PROC_REF(ev_damage), body) + if("mech") + INVOKE_ASYNC(src, PROC_REF(ev_mech), body) + if("speak") + INVOKE_ASYNC(src, PROC_REF(ev_speak), body) + if("swap") + INVOKE_ASYNC(src, PROC_REF(ev_swap), body) + +/// Something for an ability to be pointed at. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/some_target(mob/living/carbon/human/body) + var/roll = rand(1, 10) + if(roll <= 5) + var/list/others = crew - body + for(var/mob/living/carbon/human/other as anything in others.Copy()) + if(QDELETED(other)) + others -= other + if(length(others)) + return pick(others) + if(roll <= 7 && !QDELETED(cradle)) + return cradle + // A click on yourself is a click like any other, and every button has to take it. + if(roll == 10) + return body + return pick(floor_turfs) + +/// Every installed ability, pointed at something. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_trigger(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + for(var/obj/item/organ/ware as anything in get_installed_cyberware(body)) + for(var/datum/action/ability as anything in LAZYCOPY(ware.actions)) + if(QDELETED(ability) || ability.owner != body) + continue + // Cooldowns would stop most of these after the first press. + if(istype(ability, /datum/action/cooldown) && prob(60)) + var/datum/action/cooldown/timed = ability + timed.next_use_time = 0 + count("ability presses") + INVOKE_ASYNC(ability, TYPE_PROC_REF(/datum/action, Trigger), body, NONE, some_target(body)) + +/// A melee swing or a shot, through the real click path, with whatever is in the hands. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_swing(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + body.set_combat_mode(TRUE) + count("clicks") + click_wrapper(body, some_target(body)) + +/// The chrome wheel's Use OS chrome, the one wheel path that needs no screen. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_wheel(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + var/datum/component/chrome_wheel/wheel = get_chrome_wheel(body) + if(!wheel) + return + body.next_click = 0 + count("wheel presses") + wheel.use_os() + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_emp(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + count("body emps") + body.emp_act(prob(50) ? EMP_HEAVY : EMP_LIGHT) + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_emp_one(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + var/list/installed = get_installed_cyberware(body) + if(!length(installed)) + return + var/obj/item/organ/ware = pick(installed) + count("piece emps") + ware.emp_act(prob(50) ? EMP_HEAVY : EMP_LIGHT) + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_brownout(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + var/obj/item/organ/cyberimp/cyberware/soak_ballast/ballast = new /obj/item/organ/cyberimp/cyberware/soak_ballast(get_turf(body)) + track(ballast) + if(!ballast.Insert(body, special = TRUE)) + qdel(ballast) + return + count("brownouts") + sleep(rand(3 SECONDS, 9 SECONDS)) + if(QDELETED(ballast)) + return + if(ballast.owner) + ballast.Remove(ballast.owner, special = TRUE) + qdel(ballast) + +/// A cradle visit: lie down, then install something, take something out, or tune up. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_cradle(mob/living/carbon/human/body) + if(!storming || QDELETED(body) || QDELETED(cradle) || cradle_lease > world.time || !isturf(body.loc)) + return + cradle_lease = world.time + 14 SECONDS + body.forceMove(get_turf(cradle)) + if(!cradle.buckle_mob(body, force = TRUE, check_loc = FALSE)) + cradle_lease = 0 + return + var/list/installed = get_installed_cyberware(body) + var/roll = rand(1, 10) + if(roll <= 2) + count("tune-ups") + var/obj/item/card/id/id = body.get_idcard(TRUE) + var/before = id?.registered_account?.account_balance + cradle.try_tune_up(body) + var/after = id?.registered_account?.account_balance + if(!isnull(before) && before != after && before - after != SOAK_TUNEUP_FEE) + note("tune-up charged the wrong fee", "balance went from [before] to [after]") + else if(roll <= 5 && length(installed)) + count("cradle removals") + cradle.begin_removal(pick(installed)) + sleep(SOAK_REMOVAL_TIME + 1 SECONDS) + else + // A used piece from the floor when there is one, otherwise a fresh one. + var/obj/item/organ/ware + if(length(loose_chrome) && prob(50)) + ware = pick(loose_chrome) + loose_chrome -= ware + if(QDELETED(ware)) + ware = null + for(var/attempt in 1 to 8) + var/candidate_type = pick(ware_pool) + var/obj/item/organ/candidate = track(new candidate_type(get_turf(cradle))) + if(cyberware_insert_check(candidate, body, silent = TRUE)) + ware = candidate + break + qdel(candidate) + if(ware) + count("cradle installs") + ware.forceMove(cradle) + cradle.begin_install(ware) + sleep(SOAK_INSTALL_TIME + 1 SECONDS) + if(!QDELETED(body) && body.buckled == cradle) + cradle.unbuckle_mob(body, force = TRUE) + cradle_lease = 0 + +/// A sale at Splice's ledger: pull a credit-priced piece and hand it over. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_sell(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + var/obj/item/card/id/id = body.get_idcard(TRUE) + if(!id?.registered_account) + return + for(var/obj/item/organ/ware as anything in shuffle(get_installed_cyberware(body))) + for(var/datum/shop_buyback/ledger as anything in ledgers) + if(!ledger.matches(ware)) + continue + ledger.demand = 50 + ware.Remove(body, special = TRUE) + body.put_in_hands(ware) + var/before = id.registered_account.account_balance + var/sold = ledger.try_sell(body, null) + var/gained = id.registered_account.account_balance - before + if(sold) + count("sell-backs") + if(gained != ledger.pay_credits) + note("sell-back paid the wrong amount", "[ware.type] paid [gained], the ledger says [ledger.pay_credits]") + else + if(gained) + note("a refused sell-back still paid", "[ware.type] paid [gained]") + // Not taken: it goes back on the floor for the cradle. + loose_chrome += ware + ware.forceMove(get_turf(body)) + return + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_kill(mob/living/carbon/human/body) + if(!storming || QDELETED(body) || body.stat == DEAD) + return + count("deaths") + body.death() + sleep(rand(2 SECONDS, 9 SECONDS)) + if(QDELETED(body)) + return + body.revive(HEAL_ALL) + count("revives") + +/// Gib or dust a body. Its chrome must come out whole; a fresh body takes its place. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_gib(mob/living/carbon/human/body, dust = FALSE) + if(!storming || QDELETED(body)) + return + var/list/pieces = get_installed_cyberware(body) + // The ballast belongs to its own event, which deletes it when it is done. + for(var/obj/item/organ/ware as anything in pieces.Copy()) + if(istype(ware, /obj/item/organ/cyberimp/cyberware/soak_ballast)) + pieces -= ware + count(dust ? "dustings" : "gibs") + crew -= body + baselines -= body + if(dust) + body.dust() + else + body.gib() + sleep(1 SECONDS) + for(var/obj/item/organ/ware as anything in pieces) + if(QDELETED(ware)) + note("gibbing destroyed a piece of chrome", "[ware.type]") + continue + if(ware.owner) + note("gibbed chrome is still owned by the corpse", "[ware.type]") + continue + if(!isturf(ware.loc)) + note("gibbed chrome did not land on the floor", "[ware.type] is in [ware.loc ? ware.loc.type : "nullspace"]") + continue + count("pieces salvaged") + loose_chrome += ware + spawn_body() + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_dismember(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + var/obj/item/bodypart/limb = body.get_bodypart(pick(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)) + if(!limb || !limb.dismember()) + return + count("limbs lost") + var/list/riders = list() + for(var/obj/item/organ/ware in limb) + riders += ware + if(prob(40)) + // Burned up on the floor: the chrome has to come out of it. + sleep(1 SECONDS) + qdel(limb) + for(var/obj/item/organ/ware as anything in riders) + if(QDELETED(ware)) + note("destroying a severed limb destroyed its chrome", "[ware.type]") + else if(!isturf(ware.loc)) + note("chrome from a destroyed limb did not land on the floor", "[ware.type] is in [ware.loc ? ware.loc.type : "nullspace"]") + else + loose_chrome += ware + sleep(rand(3 SECONDS, 10 SECONDS)) + if(!QDELETED(body)) + body.regenerate_limbs() + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_stun(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + count("stuns") + switch(rand(1, 3)) + if(1) + body.Paralyze(rand(1 SECONDS, 5 SECONDS)) + if(2) + body.Stun(rand(1 SECONDS, 4 SECONDS)) + if(3) + body.Knockdown(rand(1 SECONDS, 4 SECONDS)) + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_cuff(mob/living/carbon/human/body) + if(!storming || QDELETED(body) || body.handcuffed) + return + var/obj/item/restraints/handcuffs/cuffs = new(body) + body.set_handcuffed(cuffs) + count("cuffings") + sleep(rand(3 SECONDS, 8 SECONDS)) + if(!QDELETED(body) && body.handcuffed == cuffs) + body.set_handcuffed(null) + qdel(cuffs) + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_pacifist(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + // The first two bodies keep it for the whole storm. + if(crew.Find(body) <= 2) + return + if(HAS_TRAIT_FROM(body, TRAIT_PACIFISM, "soak")) + REMOVE_TRAIT(body, TRAIT_PACIFISM, "soak") + else + ADD_TRAIT(body, TRAIT_PACIFISM, "soak") + count("pacifism flips") + +/// Optics zoom. There is no client for tg's scope, so the optics' own half is driven. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_zoom(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + var/obj/item/organ/eyes/robotic/cyberware/optics = body.get_organ_slot(ORGAN_SLOT_EYES) + if(!istype(optics)) + return + count("zoom flips") + if(optics.is_zoomed()) + optics.stop_zoom(body) + return + var/datum/component/cyberware/chrome = optics.GetComponent(/datum/component/cyberware) + if(chrome?.is_running() && body.stat == CONSCIOUS) + optics.engage_zoom(body) + +/// Damage on a piece until it fails, then it is repaired a moment later. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_damage(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + var/list/installed = get_installed_cyberware(body) + if(!length(installed)) + return + var/obj/item/organ/ware = pick(installed) + count("damaged pieces") + ware.apply_organ_damage(ware.maxHealth) + sleep(rand(2 SECONDS, 7 SECONDS)) + if(!QDELETED(ware)) + ware.set_organ_damage(0) + +/// A short ride in a mech, with the abilities going the whole time. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_mech(mob/living/carbon/human/body) + if(!storming || QDELETED(body) || mech_lease > world.time || !isturf(body.loc)) + return + mech_lease = world.time + 12 SECONDS + var/obj/vehicle/sealed/mecha/ripley/mech = new /obj/vehicle/sealed/mecha/ripley(get_turf(body)) + track(mech) + if(!mech.mob_enter(body, silent = TRUE)) + qdel(mech) + mech_lease = 0 + return + count("mech rides") + for(var/i in 1 to 4) + sleep(1 SECONDS) + if(QDELETED(body) || body.loc != mech) + break + ev_trigger(body) + ev_swing(body) + if(!QDELETED(body) && body.loc == mech) + mech.mob_exit(body, silent = TRUE) + qdel(mech) + mech_lease = 0 + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_speak(mob/living/carbon/human/body) + // A dead mouth goes to deadchat, which asks for a ckey this test body never has. + if(!storming || QDELETED(body) || body.stat == DEAD) + return + count("lines spoken") + body.say(prob(50) ? ";soak check, over" : "soak check") + +/// Chrome in or out by hand: what an autosurgeon with a context, a surgeon or an admin does. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/ev_swap(mob/living/carbon/human/body) + if(!storming || QDELETED(body)) + return + var/list/installed = get_installed_cyberware(body) + if(length(installed) && prob(50)) + var/obj/item/organ/ware = pick(installed) + ware.Remove(body, special = TRUE) + ware.forceMove(get_turf(body)) + loose_chrome += ware + count("pieces pulled") + return + var/candidate_type = pick(ware_pool) + var/obj/item/organ/ware = track(new candidate_type(get_turf(body))) + if(!body.get_bodypart(deprecise_zone(ware.zone)) || !cyberware_insert_check(ware, body, silent = TRUE) || !ware.Insert(body, special = TRUE)) + qdel(ware) + return + count("pieces slotted") + +/// Keeps the bodies fit enough to keep going without undoing the chrome's own state. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/top_up() + for(var/mob/living/carbon/human/body as anything in crew) + if(QDELETED(body) || body.stat == DEAD) + continue + body.adjustBruteLoss(-60, updating_health = FALSE, forced = TRUE) + body.adjustFireLoss(-60, updating_health = FALSE, forced = TRUE) + body.adjustToxLoss(-30, updating_health = FALSE, forced = TRUE) + body.adjustOxyLoss(-60, updating_health = FALSE, forced = TRUE) + body.updatehealth() + +// ---- The sweep ----------------------------------------------------------- + +/// Checks the ware's own bookkeeping on every body. Each finding has to hold for a while +/// before it counts, because the ware settles itself on SSmobs' two-second tick. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/sweep() + seen_now = list() + for(var/mob/living/carbon/human/body as anything in crew) + if(QDELETED(body)) + continue + var/over = get_chrome_load(body) > get_chrome_capacity(body) + for(var/obj/item/organ/ware as anything in get_installed_cyberware(body)) + var/datum/component/cyberware/chrome = ware.GetComponent(/datum/component/cyberware) + if(!chrome) + continue + var/ware_ref = REF(ware) + if(ware.owner != body) + suspect("[ware_ref]|owner", "installed chrome whose owner is not its bearer", "[ware.type] owner [ware.owner || "none"] in [body]") + var/running = !!chrome.is_running() + if(!!chrome.passives_online != running) + suspect("[ware_ref]|passives", "passive layer out of step with the ware", "[ware.type] passives_online [chrome.passives_online], running [running] (emp [chrome.emp_down], brownout [chrome.browned_out], damage [ware.damage]/[ware.maxHealth], flags [ware.organ_flags])") + if(!!chrome.browned_out != over) + suspect("[ware_ref]|brownout", "brownout flag out of step with the body's load", "[ware.type] browned_out [chrome.browned_out], load [get_chrome_load(body)] of [get_chrome_capacity(body)]") + if(chrome.emp_down && !chrome.emp_timer) + suspect("[ware_ref]|emptimer", "EMP downtime with no reboot timer", "[ware.type]") + // A reboot always ends on its timer (a missing one is caught just above), but EMPs + // landing back to back can keep a piece down across sweeps. Only a timer set further + // out than any EMP's downtime is an outage that would not end. + if(chrome.emp_down && chrome.emp_timer && timeleft(chrome.emp_timer) > SOAK_EMP_DOWNTIME) + suspect("[ware_ref]|empstuck", "EMP downtime that never ended", "[ware.type] still down", SOAK_EMP_DOWNTIME) + if(istype(ware, /obj/item/organ/cyberimp/arm/toolkit/cyberware)) + var/obj/item/organ/cyberimp/arm/toolkit/cyberware/arm = ware + if(arm.active_item && !running && arm.active_item.loc == body) + suspect("[ware_ref]|armweapon", "arm weapon deployed on offline chrome", "[ware.type] holding [arm.active_item.type]") + if(HAS_TRAIT(body, SOAK_TRAIT_ZOOMED)) + var/obj/item/organ/eyes/robotic/cyberware/optics = body.get_organ_slot(ORGAN_SLOT_EYES) + var/datum/component/cyberware/optic_chrome = istype(optics) ? optics.GetComponent(/datum/component/cyberware) : null + if(!istype(optics) || !optics.is_zoomed()) + suspect("[REF(body)]|zoomtrait", "zoom trait with no zoomed optics behind it", "[body]") + else if(!optic_chrome?.is_running()) + suspect("[REF(body)]|zoomoffline", "zoom held open on offline optics", "[optics.type]") + else if(body.stat != CONSCIOUS) + suspect("[REF(body)]|zoomstat", "zoom held open on a body that is not awake", "[body] stat [body.stat]") + if(HAS_TRAIT(body, SOAK_TRAIT_CAMO)) + var/obj/item/organ/cyberimp/cyberware/ghostskin/weave = body.get_organ_slot(SOAK_SLOT_SKIN) + var/datum/component/cyberware/weave_chrome = istype(weave) ? weave.GetComponent(/datum/component/cyberware) : null + if(!istype(weave) || !weave.camo_active) + suspect("[REF(body)]|camotrait", "camo trait with no engaged weave behind it", "[body]") + else if(!weave_chrome?.is_running()) + suspect("[REF(body)]|camooffline", "camo held on an offline weave", "[weave.type]") + for(var/key in suspects.Copy()) + if(!seen_now[key]) + suspects -= key + reported -= key + +// ---- The audit ----------------------------------------------------------- + +/// Heal the survivors, take all their chrome out, leave them alone and compare with the +/// snapshot from before they had any. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/audit_survivors() + var/list/survivors = list() + for(var/mob/living/carbon/human/body as anything in crew) + if(QDELETED(body) || !baselines[body]) + continue + survivors += body + body.drop_all_held_items() + body.forceMove(run_loc_floor_bottom_left) + body.set_handcuffed(null) + REMOVE_TRAIT(body, TRAIT_PACIFISM, "soak") + body.revive(ADMIN_HEAL_ALL) + body.regenerate_limbs() + var/index = 0 + for(var/obj/item/organ/ware as anything in get_installed_cyberware(body)) + index++ + // Half through the normal removal, half the way a dying body does it. + ware.Remove(body, special = (index % 2 == 0)) + ware.forceMove(get_turf(body)) + loose_chrome += ware + if(get_chrome_load(body) != 0) + note("a body still carries load with no chrome in it", "[body] carries [get_chrome_load(body)]") + // Chrome optics and lungs replaced the body's own, so pulling them leaves gaps a + // body without chrome never had (no eyes means blind). + body.dna.species.regenerate_organs(body, replace_current = FALSE) + log_world("SOAK auditing [length(survivors)] survivors after a 20 second quiet") + sleep(20 SECONDS) + for(var/mob/living/carbon/human/body as anything in survivors) + if(QDELETED(body)) + continue + var/list/before = baselines[body] + var/list/now = snapshot(body) + for(var/key in before) + var/old_value = before[key] + var/new_value = now[key] + if(islist(old_value)) + var/list/old_list = old_value + var/list/new_list = new_value + var/list/gained = list() + var/list/lost = list() + if(key == "traits" || key == "physiology") + for(var/entry in new_list) + if(new_list[entry] != old_list[entry]) + gained += "[entry] [old_list[entry]] -> [new_list[entry]]" + for(var/entry in old_list) + if(isnull(new_list[entry])) + lost += "[entry]" + else + var/list/remaining = old_list.Copy() + for(var/entry in new_list) + if(entry in remaining) + remaining -= entry + else + gained += "[entry]" + lost = remaining + if(length(gained) || length(lost)) + // The chrome wheel is made on first use and kept for the body's life. + if(key == "components") + gained -= "[/datum/component/chrome_wheel]" + // A baseline taken mid-fight can hold a passing effect (a stagger); only + // what was ADDED by the chrome and never left counts for these. + if(key == "status effects" || key == "movespeed" || key == "actionspeed") + lost = list() + if(length(gained) || length(lost)) + note("after stripping the chrome, [key] differ from before it", "[body]: gained [english_list(gained)], lost [english_list(lost)]") + else if(old_value != new_value) + note("after stripping the chrome, [key] differs from before it", "[body]: was [old_value], now [new_value]") + for(var/stale in voidcrew_cyberware_stale_listeners(body)) + note("a stripped body still has chrome listening to it", "[body]: [stale]") + +/// Delete everything this test made, wait for the garbage collector, and return what survived. +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/clean_up() + // The cradle's own loose ends first. + var/tray_strays = 0 + if(!QDELETED(cradle)) + if(cradle.busy) + note("the cradle ended the soak mid-sequence", "[cradle.busy_action]") + list_clear_nulls(cradle.tray) + for(var/obj/item/organ/stray in cradle.tray) + if(QDELETED(stray)) + tray_strays++ + if(tray_strays) + note("the cradle's tray holds deleted chrome", "[tray_strays] pieces") + crew.Cut() + baselines.Cut() + loose_chrome.Cut() + suspects.Cut() + reported.Cut() + seen_now.Cut() + // The cradle first, because its tray empties onto the floor when it goes. + qdel(cradle) + cradle = null + // Everything in the room goes, bodies and chrome and gibs. Twice: the first pass can drop + // things (a dead body's pockets, a limb's chrome) that the second one picks up. + for(var/pass in 1 to 2) + for(var/turf/where as anything in floor_turfs + run_loc_floor_top_right) + for(var/atom/movable/thing as anything in where.contents.Copy()) + if(istype(thing, /obj/effect/landmark)) + continue + qdel(thing) + floor_turfs.Cut() + ledgers.Cut() + // Past the longest queue the collector has, plus a margin. + sleep(45 SECONDS) + var/list/leaks = list() + for(var/datum/weakref/ref as anything in made) + var/datum/survivor = ref.resolve() + if(survivor) + leaks["[survivor.type]"] = (leaks["[survivor.type]"] || 0) + 1 + made.Cut() + // Anything that ran out of patience with the collector is counted per type. + for(var/gc_type in SSgarbage.items) + var/datum/qdel_item/item = SSgarbage.items[gc_type] + var/list/before = gc_before[gc_type] || list(0, 0) + if(item.failures > before[1] || item.hard_deletes > before[2]) + var/path_text = "[gc_type]" + if(findtext(path_text, "cyberware") || findtext(path_text, "chrome") || findtext(path_text, "/mob/living/carbon/human") || findtext(path_text, "shop_buyback")) + leaks["GC [path_text]: [item.failures - before[1]] failures, [item.hard_deletes - before[2]] hard deletes"] = 1 + // A timer pointing at an object that is already gone should not exist. + var/orphaned = 0 + for(var/timer_id in SStimer.timer_id_dict) + var/datum/timedevent/timer = SStimer.timer_id_dict[timer_id] + var/datum/object = timer?.callBack?.object + if(isdatum(object) && QDELETED(object)) + orphaned++ + if(orphaned) + leaks["timers aimed at deleted objects"] = orphaned + stats["timers before"] = timers_at_start + stats["timers after"] = length(SStimer.timer_id_dict) + return leaks + +/datum/unit_test/voidcrew_opt_in/cyberware_soak/proc/report(list/leaks) + var/list/lines = list() + lines += "CHROME SOAK REPORT" + lines += "storm length [storm_length / 10] s, [crew_size] bodies, [length(ware_pool)] kinds of chrome in the pool" + lines += "runtimes during the soak: [GLOB.total_runtimes - runtimes_at_start] (plus [GLOB.total_runtimes_skipped - skipped_runtimes_at_start] silenced as repeats)" + lines += "-- what was done" + for(var/what in stats) + lines += " [what]: [stats[what]]" + lines += "-- problems ([length(problem_counts)] kinds)" + for(var/category in problem_counts) + lines += " [category] x[problem_counts[category]]: [problem_examples[category]]" + lines += "-- left behind ([length(leaks)] kinds)" + for(var/leak in leaks) + lines += " [leak]: [leaks[leak]]" + var/text = lines.Join("\n") + fdel("data/soak_report.txt") + text2file(text, "data/soak_report.txt") + log_world(text) + for(var/category in problem_counts) + Fail("[category] (x[problem_counts[category]]): [problem_examples[category]]") + for(var/leak in leaks) + Fail("left behind: [leak]: [leaks[leak]]") + +#undef SOAK_SLOT_SKIN +#undef SOAK_TRAIT_CAMO +#undef SOAK_TRAIT_ZOOMED +#undef SOAK_INSTALL_TIME +#undef SOAK_REMOVAL_TIME +#undef SOAK_EMP_DOWNTIME +#undef SOAK_TUNEUP_FEE +#undef SOAK_PATIENCE diff --git a/voidcrew/modules/unit_tests/voidcrew_cyberware_zoom.dm b/voidcrew/modules/unit_tests/voidcrew_cyberware_zoom.dm new file mode 100644 index 00000000000..719759ad15a --- /dev/null +++ b/voidcrew/modules/unit_tests/voidcrew_cyberware_zoom.dm @@ -0,0 +1,368 @@ +/** + * # Optics zoom (voidcrew/modules/cyberware/cyberware_zoom.dm, ware_line_zoom.dm) + * + * Every chrome optic zooms by tier, a zoomed bearer can't shoot, the zoom drops + * whenever the eyes or the bearer stop working, and a click on the zoomed view + * goes nowhere. There is no client here, so tg's scope never + * starts: these tests drive the optics' own half of a zoom (engage_zoom()) and + * stand in a hand-made cursor catcher for the scope's. + * + * Unit-test files compile before voidcrew/_DEFINES/, so fork defines are + * literals: TRAIT_CYBER_ZOOMED "cyber_zoomed", + * CYBERWARE_SCAN_SILHOUETTE 1 / _ITEMIZED 2, CYBERWARE_TIER_n n, and zone + * permissions Public/Yellow/Advanced 0/1/2. + */ + +/// Stands in for an armed click-to-target ability. +/datum/zoom_click_probe + /// How many clicks reached us as a click intercept. + var/intercepted = 0 + +/datum/zoom_click_probe/proc/InterceptClickOn(mob/user, params, atom/target) + intercepted++ + return TRUE + +/// The ladder: every optic zooms, carries the button and the scope, and reaches +/// what its tier says, never as far as binoculars (4). +/datum/unit_test/voidcrew_cyberware_zoom_ladder + +/datum/unit_test/voidcrew_cyberware_zoom_ladder/Run() + // optic => list(zoom, walk penalty) + var/list/expected = list( + /obj/item/organ/eyes/robotic/cyberware/spyglass = list(1, 1), + /obj/item/organ/eyes/robotic/cyberware/prospector/street = list(1, 1), + /obj/item/organ/eyes/robotic/cyberware/nightshade = list(1, 1), + /obj/item/organ/eyes/robotic/cyberware/prospector = list(1.5, 0.5), + /obj/item/organ/eyes/robotic/cyberware/deadeye = list(1.5, 0.5), + /obj/item/organ/eyes/robotic/cyberware/longsight = list(2, 0), + /obj/item/organ/eyes/robotic/cyberware/deadeye/milspec = list(2, 0), + /obj/item/organ/eyes/robotic/cyberware/lookout = list(2.5, 0), + ) + for(var/optic_type in subtypesof(/obj/item/organ/eyes/robotic/cyberware)) + var/obj/item/organ/eyes/robotic/cyberware/optics = allocate(optic_type) + TEST_ASSERT(optics.optics_zoom > 0, "[optic_type] doesn't zoom") + TEST_ASSERT(optics.optics_zoom < 4, "[optic_type] zooms as far as binoculars") + TEST_ASSERT_EQUAL(optics.slot, ORGAN_SLOT_EYES, "[optic_type] left the eye slot, so it would stack with other optics") + var/datum/component/scope/scope = optics.GetComponent(/datum/component/scope) + TEST_ASSERT_NOTNULL(scope, "[optic_type] has no scope to zoom with") + TEST_ASSERT_EQUAL(scope.range_modifier, optics.optics_zoom, "[optic_type]'s scope reaches a different distance from its zoom") + TEST_ASSERT(locate(/datum/action/cooldown/cyberware/optics_zoom) in optics.actions, "[optic_type] has no zoom button") + TEST_ASSERT(locate(/datum/action/cooldown/cyberware/chrome_read) in optics.actions, "[optic_type] lost its chrome read") + TEST_ASSERT(istype(optics.actions[length(optics.actions)], /datum/action/cooldown/cyberware/optics_zoom), "[optic_type]'s zoom is not its last button") + var/list/numbers = expected[optic_type] + if(!numbers) + continue + TEST_ASSERT_EQUAL(optics.optics_zoom, numbers[1], "[optic_type] zooms the wrong distance") + TEST_ASSERT_EQUAL(optics.zoom_walk_penalty, numbers[2], "[optic_type] has the wrong walk tax while zoomed") + for(var/optic_type in expected) + TEST_ASSERT(ispath(optic_type, /obj/item/organ/eyes/robotic/cyberware), "[optic_type] is no longer chrome optics") + +/// The existing optics keep their numbers now they're vars, and the new models +/// carry theirs. +/datum/unit_test/voidcrew_cyberware_zoom_models + +/datum/unit_test/voidcrew_cyberware_zoom_models/Run() + // Chrome read: 7 tiles every 12 seconds unless the optics say otherwise. + var/obj/item/organ/eyes/robotic/cyberware/nightshade/nightshade = allocate(/obj/item/organ/eyes/robotic/cyberware/nightshade) + var/datum/action/cooldown/cyberware/chrome_read/stock_read = locate() in nightshade.actions + TEST_ASSERT_EQUAL(nightshade.chrome_read_range, 7, "The stock chrome read range changed") + TEST_ASSERT_EQUAL(stock_read.cooldown_time, 12 SECONDS, "The stock chrome read cooldown changed") + + // Deadeye, unchanged. + var/obj/item/organ/eyes/robotic/cyberware/deadeye/deadeye = allocate(/obj/item/organ/eyes/robotic/cyberware/deadeye) + TEST_ASSERT_EQUAL(deadeye.tag_range, 9, "Deadeye tag range changed") + TEST_ASSERT_EQUAL(deadeye.tag_shots, 3, "Deadeye tracked shots changed") + TEST_ASSERT_EQUAL(deadeye.tag_duration, 15 SECONDS, "Deadeye tag length changed") + var/datum/action/cooldown/cyberware/deadeye_tag/deadeye_tag = locate() in deadeye.actions + TEST_ASSERT_EQUAL(deadeye_tag.type, /datum/action/cooldown/cyberware/deadeye_tag, "The Deadeye carries the wrong tag") + TEST_ASSERT_EQUAL(deadeye_tag.cooldown_time, 25 SECONDS, "Deadeye tag cooldown changed") + + // Marksman link: four shots, ten tiles, eighteen seconds, same tag length. + var/obj/item/organ/eyes/robotic/cyberware/deadeye/milspec/marksman = allocate(/obj/item/organ/eyes/robotic/cyberware/deadeye/milspec) + TEST_ASSERT_EQUAL(marksman.tag_range, 10, "Marksman tag range is not 10") + TEST_ASSERT_EQUAL(marksman.tag_shots, 4, "Marksman tracked shots are not 4") + TEST_ASSERT_EQUAL(marksman.tag_duration, 15 SECONDS, "Marksman tag length is not 15 s") + var/datum/action/cooldown/cyberware/deadeye_tag/marksman/marksman_tag = locate() in marksman.actions + TEST_ASSERT_NOTNULL(marksman_tag, "The Marksman link has no tag of its own") + TEST_ASSERT_EQUAL(marksman_tag.cooldown_time, 18 SECONDS, "Marksman tag cooldown is not 18 s") + check_chrome(marksman, 3, 4) + + // Prospector, unchanged; Assay optics shorter, slower and blind to caches. + var/obj/item/organ/eyes/robotic/cyberware/prospector/prospector = allocate(/obj/item/organ/eyes/robotic/cyberware/prospector) + TEST_ASSERT_EQUAL(prospector.pulse_range, 9, "Prospector pulse range changed") + TEST_ASSERT(prospector.pulse_marks_caches, "The Prospector stopped flagging caches") + var/datum/action/cooldown/cyberware/prospector_pulse/stock_pulse = locate() in prospector.actions + TEST_ASSERT_EQUAL(stock_pulse.cooldown_time, 10 SECONDS, "Prospector pulse cooldown changed") + var/obj/item/organ/eyes/robotic/cyberware/prospector/street/assay = allocate(/obj/item/organ/eyes/robotic/cyberware/prospector/street) + TEST_ASSERT_EQUAL(assay.pulse_range, 5, "Assay pulse range is not 5") + TEST_ASSERT(!assay.pulse_marks_caches, "Assay optics flag caches") + var/datum/action/cooldown/cyberware/prospector_pulse/assay/assay_pulse = locate() in assay.actions + TEST_ASSERT_NOTNULL(assay_pulse, "Assay optics have no pulse of their own") + TEST_ASSERT_EQUAL(assay_pulse.cooldown_time, 15 SECONDS, "Assay pulse cooldown is not 15 s") + TEST_ASSERT_EQUAL(assay.chrome_scan_resolution, 1, "Assay optics read at more than silhouette") + check_chrome(assay, 1, 1) + + // The plain scout line. + var/obj/item/organ/eyes/robotic/cyberware/spyglass/spyglass = allocate(/obj/item/organ/eyes/robotic/cyberware/spyglass) + TEST_ASSERT_EQUAL(spyglass.chrome_scan_resolution, 1, "Spyglass optics read at more than silhouette") + TEST_ASSERT_EQUAL(length(spyglass.actions), 2, "Spyglass optics should carry only the read and the zoom") + check_chrome(spyglass, 1, 1) + var/obj/item/organ/eyes/robotic/cyberware/longsight/longsight = allocate(/obj/item/organ/eyes/robotic/cyberware/longsight) + TEST_ASSERT_EQUAL(longsight.chrome_scan_resolution, 2, "Longsight optics don't name what they read") + TEST_ASSERT_EQUAL(longsight.chrome_read_range, 9, "Longsight read range is not 9") + check_chrome(longsight, 2, 2) + var/obj/item/organ/eyes/robotic/cyberware/lookout/lookout = allocate(/obj/item/organ/eyes/robotic/cyberware/lookout) + TEST_ASSERT_EQUAL(lookout.chrome_scan_resolution, 2, "Lookout optics don't name what they read") + TEST_ASSERT_EQUAL(lookout.chrome_read_range, 11, "Lookout read range is not 11") + var/datum/action/cooldown/cyberware/chrome_read/lookout_read = locate() in lookout.actions + TEST_ASSERT_EQUAL(lookout_read.cooldown_time, 8 SECONDS, "Lookout read cooldown is not 8 s") + TEST_ASSERT_EQUAL(lookout.lighting_cutoff, LIGHTING_CUTOFF_MEDIUM, "Lookout optics lost their low-light") + check_chrome(lookout, 3, 3) + +/datum/unit_test/voidcrew_cyberware_zoom_models/proc/check_chrome(obj/item/organ/eyes/robotic/cyberware/optics, tier, load) + var/datum/component/cyberware/chrome = optics.GetComponent(/datum/component/cyberware) + TEST_ASSERT_EQUAL(chrome.tier, tier, "[optics.type] is the wrong tier") + TEST_ASSERT_EQUAL(chrome.chrome_load, load, "[optics.type] carries the wrong neural load") + +/// A zoom holds the trait and the walk tax, refuses guns, and lets go cleanly. +/datum/unit_test/voidcrew_cyberware_zoom_state + +/datum/unit_test/voidcrew_cyberware_zoom_state/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/eyes/robotic/cyberware/spyglass/optics = allocate(/obj/item/organ/eyes/robotic/cyberware/spyglass) + TEST_ASSERT(optics.Insert(bearer, special = TRUE), "Spyglass staging insert was refused") + var/datum/action/cooldown/cyberware/optics_zoom/zoom = locate() in optics.actions + TEST_ASSERT_EQUAL(zoom.owner, bearer, "The zoom button didn't come with the eyes") + TEST_ASSERT(zoom.IsAvailable(), "Healthy installed optics can't zoom") + + // No client: the scope refuses, so the button can't zoom anyone here. + TEST_ASSERT(!optics.start_zoom(), "A clientless bearer zoomed") + TEST_ASSERT(!HAS_TRAIT(bearer, "cyber_zoomed"), "A refused zoom left the bearer zoomed") + + optics.engage_zoom(bearer) + TEST_ASSERT(optics.is_zoomed() && HAS_TRAIT(bearer, "cyber_zoomed"), "Engaging the zoom didn't mark the bearer zoomed") + TEST_ASSERT(zoom.is_action_active(null), "The zoom button doesn't show the zoom as on") + TEST_ASSERT(bearer.has_movespeed_modifier(/datum/movespeed_modifier/cyberware_zoom), "Cheap optics didn't slow their bearer while zoomed") + + var/obj/item/gun/ballistic/automatic/pistol/pistol = allocate(/obj/item/gun/ballistic/automatic/pistol) + TEST_ASSERT(bearer.put_in_active_hand(pistol), "Test fixture: the bearer couldn't hold the pistol") + var/rounds = pistol.get_ammo() + TEST_ASSERT(rounds > 0, "Test fixture: the pistol spawned empty") + TEST_ASSERT(SEND_SIGNAL(bearer, COMSIG_MOB_TRYING_TO_FIRE_GUN, pistol, run_loc_floor_top_right, FALSE, null) & COMPONENT_CANCEL_GUN_FIRE, "A zoomed bearer's gun wasn't stopped") + pistol.fire_gun(run_loc_floor_top_right, bearer, FALSE, null) + TEST_ASSERT_EQUAL(pistol.get_ammo(), rounds, "A zoomed bearer fired a gun") + + optics.stop_zoom(bearer) + TEST_ASSERT(!optics.is_zoomed() && !HAS_TRAIT(bearer, "cyber_zoomed"), "Stopping the zoom left the bearer zoomed") + TEST_ASSERT(!bearer.has_movespeed_modifier(/datum/movespeed_modifier/cyberware_zoom), "The walk tax outlived the zoom") + TEST_ASSERT(!(SEND_SIGNAL(bearer, COMSIG_MOB_TRYING_TO_FIRE_GUN, pistol, run_loc_floor_top_right, FALSE, null) & COMPONENT_CANCEL_GUN_FIRE), "The gun block outlived the zoom") + TEST_ASSERT(!zoom.is_action_active(null), "The zoom button still shows the zoom as on") + + // Scout optics zoom at full stride. + var/mob/living/carbon/human/scout = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/eyes/robotic/cyberware/longsight/scout_optics = allocate(/obj/item/organ/eyes/robotic/cyberware/longsight) + TEST_ASSERT(scout_optics.Insert(scout, special = TRUE), "Longsight staging insert was refused") + scout_optics.engage_zoom(scout) + TEST_ASSERT(!scout.has_movespeed_modifier(/datum/movespeed_modifier/cyberware_zoom), "Scout optics slowed their bearer while zoomed") + scout_optics.stop_zoom(scout) + +/// Everything that should end a zoom does. +/datum/unit_test/voidcrew_cyberware_zoom_drops + +/datum/unit_test/voidcrew_cyberware_zoom_drops/Run() + var/obj/item/organ/eyes/robotic/cyberware/optics = zoomed() + var/datum/component/cyberware/chrome = optics.GetComponent(/datum/component/cyberware) + var/datum/action/cooldown/cyberware/optics_zoom/zoom = locate() in optics.actions + chrome.start_emp_reboot() + check_dropped(optics, "an EMP") + TEST_ASSERT(!zoom.IsAvailable(), "EMP-scrambled optics can still zoom") + chrome.tune_up() + TEST_ASSERT(zoom.IsAvailable(), "Rebooted optics can't zoom again") + + optics = zoomed() + chrome = optics.GetComponent(/datum/component/cyberware) + chrome.set_browned_out(TRUE) + check_dropped(optics, "a brownout") + chrome.set_browned_out(FALSE) + + optics = zoomed() + chrome = optics.GetComponent(/datum/component/cyberware) + optics.set_organ_damage(optics.maxHealth) + chrome.update_failing() // the bearer's life tick, which settles damage failure + check_dropped(optics, "the eyes failing") + + optics = zoomed() + optics.owner.flash_act(1) + check_dropped(optics, "a flash") + + optics = zoomed() + optics.owner.become_blind("voidcrew_zoom_test") + check_dropped(optics, "going blind") + + optics = zoomed() + optics.owner.Stun(2 SECONDS) + check_dropped(optics, "a stun") + + optics = zoomed() + optics.owner.Knockdown(2 SECONDS) + check_dropped(optics, "a knockdown") + + optics = zoomed() + optics.owner.Paralyze(2 SECONDS) + check_dropped(optics, "paralysis") + + optics = zoomed() + optics.owner.death() + check_dropped(optics, "death") + + optics = zoomed() + var/mob/living/carbon/human/bearer = optics.owner + optics.Remove(bearer, special = TRUE) + TEST_ASSERT(!HAS_TRAIT(bearer, "cyber_zoomed"), "Pulling the optics out left their bearer zoomed") + TEST_ASSERT(!bearer.has_movespeed_modifier(/datum/movespeed_modifier/cyberware_zoom), "Pulling the optics out left the walk tax on") + +/// A fresh bearer, zoomed through a fresh pair of Spyglass optics. +/datum/unit_test/voidcrew_cyberware_zoom_drops/proc/zoomed() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/eyes/robotic/cyberware/spyglass/optics = allocate(/obj/item/organ/eyes/robotic/cyberware/spyglass) + TEST_ASSERT(optics.Insert(bearer, special = TRUE), "Spyglass staging insert was refused") + optics.engage_zoom(bearer) + TEST_ASSERT(optics.is_zoomed(), "Test fixture: the zoom didn't engage") + return optics + +/datum/unit_test/voidcrew_cyberware_zoom_drops/proc/check_dropped(obj/item/organ/eyes/robotic/cyberware/optics, cause) + var/mob/living/carbon/human/bearer = optics.owner + TEST_ASSERT(!optics.is_zoomed() && !HAS_TRAIT(bearer, "cyber_zoomed"), "The zoom survived [cause]") + TEST_ASSERT(!bearer.has_movespeed_modifier(/datum/movespeed_modifier/cyberware_zoom), "The walk tax survived [cause]") + TEST_ASSERT(!(SEND_SIGNAL(bearer, COMSIG_MOB_TRYING_TO_FIRE_GUN, null, null, FALSE, null) & COMPONENT_CANCEL_GUN_FIRE), "The gun block survived [cause]") + +/// A zoomed click never reaches a click intercept, and only while zoomed. +/datum/unit_test/voidcrew_cyberware_zoom_click + +/datum/unit_test/voidcrew_cyberware_zoom_click/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/mob/living/carbon/human/far_body = allocate(/mob/living/carbon/human/consistent, run_loc_floor_top_right) + var/obj/item/organ/eyes/robotic/cyberware/lookout/optics = allocate(/obj/item/organ/eyes/robotic/cyberware/lookout) + TEST_ASSERT(optics.Insert(bearer, special = TRUE), "Lookout staging insert was refused") + + // Stand in for the scope's cursor catcher, pointed at the far body. + var/datum/component/scope/scope = optics.GetComponent(/datum/component/scope) + var/atom/movable/screen/fullscreen/cursor_catcher/scope/catcher = new + catcher.owner = bearer + catcher.given_turf = get_turf(far_body) + scope.tracker = catcher + optics.engage_zoom(bearer) + + var/datum/zoom_click_probe/probe = allocate(/datum/zoom_click_probe) + bearer.click_intercept = probe + + bearer.ClickOn(catcher, "") + TEST_ASSERT_EQUAL(probe.intercepted, 0, "An armed click intercept saw a zoomed click") + + // Out of the zoom, clicks are ordinary again. + optics.stop_zoom(bearer) + bearer.next_click = 0 + bearer.ClickOn(catcher, "") + TEST_ASSERT_EQUAL(probe.intercepted, 1, "Clicks stayed swallowed after the zoom ended") + + bearer.click_intercept = null + scope.tracker = null + qdel(catcher) + +/// The zoom button sits on the chrome wheel, and swapping optics with a +/// different number of buttons never moves the ear chrome beside them. +/datum/unit_test/voidcrew_cyberware_zoom_wheel + +/datum/unit_test/voidcrew_cyberware_zoom_wheel/Run() + var/mob/living/carbon/human/bearer = allocate(/mob/living/carbon/human/consistent) + var/obj/item/organ/eyes/robotic/cyberware/spyglass/cheap = allocate(/obj/item/organ/eyes/robotic/cyberware/spyglass) + TEST_ASSERT(cheap.Insert(bearer, special = TRUE), "Spyglass staging insert was refused") + var/obj/item/organ/cyberimp/cyberware/doppler/ears = allocate(/obj/item/organ/cyberimp/cyberware/doppler) + TEST_ASSERT(ears.Insert(bearer, special = TRUE), "Doppler staging insert was refused") + var/datum/action/cheap_zoom = locate(/datum/action/cooldown/cyberware/optics_zoom) in cheap.actions + var/datum/action/sonar = locate(/datum/action/item_action/organ_action/toggle) in ears.actions + TEST_ASSERT(cheap_zoom && sonar, "A staged organ is missing its button") + + var/list/abilities = get_chrome_wheel_actions(bearer) + TEST_ASSERT(cheap_zoom in abilities, "The zoom button isn't on the chrome wheel") + var/list/positions = chrome_wheel_layout(abilities) + var/list/ears_at = positions[sonar] + + // Optics with an ability of their own: three eye buttons instead of two. + var/obj/item/organ/eyes/robotic/cyberware/deadeye/milspec/link = allocate(/obj/item/organ/eyes/robotic/cyberware/deadeye/milspec) + TEST_ASSERT(link.Insert(bearer, special = TRUE), "Marksman link staging insert was refused") + abilities = get_chrome_wheel_actions(bearer) + TEST_ASSERT(!(cheap_zoom in abilities), "The pulled optics' zoom stayed on the wheel") + TEST_ASSERT(locate(/datum/action/cooldown/cyberware/optics_zoom) in abilities, "The new optics' zoom isn't on the wheel") + positions = chrome_wheel_layout(abilities) + var/list/ears_now = positions[sonar] + TEST_ASSERT(ears_at[1] == ears_now[1] && ears_at[2] == ears_now[2], "Swapping optics moved the ear chrome on the wheel") + + // All three of the link's buttons get a place of their own in the eyes + // socket: none sits on another, and none sits on any other socket's chip. + var/list/placements = chrome_wheel_placements(abilities) + var/list/eye_buttons = list() + for(var/datum/action/ability as anything in link.actions) + if(ability in abilities) + eye_buttons += ability + TEST_ASSERT_EQUAL(length(eye_buttons), 3, "The marksman link should put three buttons on the wheel") + var/list/eye_indexes = list() + for(var/datum/action/ability as anything in eye_buttons) + var/list/placement = placements[ability] + TEST_ASSERT_EQUAL(placement["socket"], "eyes", "[ability.name] is not in the eyes socket") + eye_indexes |= placement["index"] + TEST_ASSERT_EQUAL(length(eye_indexes), 3, "Two optics buttons share a place on the wheel") + for(var/datum/action/ability as anything in eye_buttons) + var/list/here = positions[ability] + for(var/datum/action/other as anything in abilities) + if(other == ability) + continue + var/list/there = positions[other] + // Chips are 22 px across (26 when pointed at). + TEST_ASSERT(sqrt((here[1] - there[1]) ** 2 + (here[2] - there[2]) ** 2) >= 24, "[ability.name] overlaps [other.name] on the wheel") + // Nor on the first places of the head socket beside it. + for(var/head_index in 1 to 2) + var/list/head_point = chrome_wheel_position("head", head_index) + TEST_ASSERT(sqrt((here[1] - head_point[1]) ** 2 + (here[2] - head_point[2]) ** 2) >= 24, "[ability.name] sits on the head socket's place [head_index]") + var/datum/action/link_zoom = locate(/datum/action/cooldown/cyberware/optics_zoom) in link.actions + TEST_ASSERT_EQUAL(link_zoom?.chrome_wheel_name(), "Zoom", "The zoom chip isn't called Zoom") + +/// Shelf prices and gates, half-list trade-ins, and cradle quotes. +/datum/unit_test/voidcrew_cyberware_zoom_catalog + +/datum/unit_test/voidcrew_cyberware_zoom_catalog/Run() + // SKU => list(item, credits, vouchers, zone permission) + var/list/skus = list( + /datum/shop_sku/ripperdoc/spyglass = list(/obj/item/organ/eyes/robotic/cyberware/spyglass, 400, 0, 0), + /datum/shop_sku/ripperdoc/assay_optics = list(/obj/item/organ/eyes/robotic/cyberware/prospector/street, 900, 0, 0), + /datum/shop_sku/ripperdoc/longsight = list(/obj/item/organ/eyes/robotic/cyberware/longsight, 2400, 0, 1), + /datum/shop_sku/ripperdoc/deadeye_milspec = list(/obj/item/organ/eyes/robotic/cyberware/deadeye/milspec, 0, 3, 2), + /datum/shop_sku/ripperdoc/lookout = list(/obj/item/organ/eyes/robotic/cyberware/lookout, 0, 3, 2), + ) + build_cyberware_price_index() + for(var/datum/shop_sku/sku_type as anything in skus) + var/list/row = skus[sku_type] + TEST_ASSERT_EQUAL(initial(sku_type.item_path), row[1], "[sku_type] sells the wrong optics") + TEST_ASSERT_EQUAL(initial(sku_type.price_credits), row[2], "[sku_type] has the wrong credit price") + TEST_ASSERT_EQUAL(initial(sku_type.price_vouchers), row[3], "[sku_type] has the wrong voucher price") + TEST_ASSERT_EQUAL(initial(sku_type.zone_permission), row[4], "[sku_type] has the wrong reputation gate") + var/obj/item/organ/optics = allocate(row[1]) + var/list/quote = get_cyberware_price(optics) + TEST_ASSERT(quote && (quote["credits"] > 0 || quote["vouchers"] > 0), "The cradle quotes no price for [row[1]]") + + // Trade-in => the SKU it pays half of. + var/list/trade_ins = list( + /datum/shop_buyback/ripperdoc/spyglass = /datum/shop_sku/ripperdoc/spyglass, + /datum/shop_buyback/ripperdoc/assay_optics = /datum/shop_sku/ripperdoc/assay_optics, + /datum/shop_buyback/ripperdoc/longsight = /datum/shop_sku/ripperdoc/longsight, + /datum/shop_buyback/ripperdoc/spyglass/street_doc = /datum/shop_sku/ripperdoc/spyglass, + /datum/shop_buyback/ripperdoc/assay_optics/street_doc = /datum/shop_sku/ripperdoc/assay_optics, + /datum/shop_buyback/ripperdoc/longsight/street_doc = /datum/shop_sku/ripperdoc/longsight, + ) + for(var/buyback_type in trade_ins) + var/datum/shop_buyback/ledger = allocate(buyback_type) + var/datum/shop_sku/sku_type = trade_ins[buyback_type] + TEST_ASSERT_EQUAL(ledger.item_path, initial(sku_type.item_path), "[buyback_type] buys something its shelf doesn't sell") + TEST_ASSERT(!ledger.match_subtypes, "[buyback_type] buys subtypes too") + TEST_ASSERT_EQUAL(ledger.pay_credits * 2, initial(sku_type.price_credits), "[buyback_type] doesn't pay half list") + TEST_ASSERT(!ledger.pay_vouchers, "[buyback_type] pays vouchers") diff --git a/wiki/content/cyberware.md b/wiki/content/cyberware.md index b626d765f56..8b98378c3a1 100644 --- a/wiki/content/cyberware.md +++ b/wiki/content/cyberware.md @@ -124,6 +124,10 @@ The newer makers fill in the gaps under the big names. Each takes the same slot - **Thumper ear**: a louder, shorter-ranged sonar behind the ear. - Quiet pieces with no button: the **Clotter node** slows bleeding, the **Adrenal pump** kicks in when you're about to drop, **Medic's palms** and **Cuffer's wrists** do the glove's job without the glove, the **Subvocal mic** keeps your radio talk from the people next to you, and the **Muffler ear** shuts out a bang. +## Optics and zoom + +Every pair of chrome eyes can zoom: focus on something far off and your view pulls toward it. Better eyes see further, and cheap ones make you slow while you look. Nobody shoots straight through a zoom, so you have to look up before you fire. A flash, a stun or an EMP snaps you out of it. Spyglass and assay optics are the cheap way in; the Longsight, the marksman link and the Lookout are what scouts and sharpshooters save for. + ## Finding chrome in the wild Most of the roster also appears in zone loot caches. Street and utility chrome appears among themed supplies. Weapon chrome uses the cache's weapon roll; Popup Ronin and Bunker Buster housings are plunder-cache loot rather than trader stock. Higher zones improve the odds of stronger chrome. The exceptions: Legend chrome and ammunition never drop, the Skyhook drops *only* in expedition caches, and the Meteor Piledriver comes from eligible guarded mission prizes, including hunts and lair trophies. From d1e71954def1b3709c634408fc8c34f9477be037 Mon Sep 17 00:00:00 2001 From: Jackriip <97582790+Jackriip@users.noreply.github.com> Date: Mon, 16 Nov 2026 01:51:14 -0800 Subject: [PATCH 29/29] Zone shop test: expect the permissions of the optics models --- voidcrew/modules/unit_tests/voidcrew_zone_shops.dm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/voidcrew/modules/unit_tests/voidcrew_zone_shops.dm b/voidcrew/modules/unit_tests/voidcrew_zone_shops.dm index 0caa49ff801..1e80bea671c 100644 --- a/voidcrew/modules/unit_tests/voidcrew_zone_shops.dm +++ b/voidcrew/modules/unit_tests/voidcrew_zone_shops.dm @@ -75,6 +75,7 @@ /datum/shop_sku/ripperdoc/hopper_street = 1, /datum/shop_sku/ripperdoc/gorilla_street = 1, /datum/shop_sku/ripperdoc/ronin_holdout = 1, + /datum/shop_sku/ripperdoc/longsight = 1, /datum/shop_sku/black_market/c4 = 1, /datum/shop_sku/black_market/emp_grenade = 1, /datum/shop_sku/black_market/frag_grenade = 1, @@ -129,6 +130,8 @@ /datum/shop_sku/ripperdoc/governor_milspec = 2, /datum/shop_sku/ripperdoc/slipwire_milspec = 2, /datum/shop_sku/ripperdoc/hopper_milspec = 2, + /datum/shop_sku/ripperdoc/deadeye_milspec = 2, + /datum/shop_sku/ripperdoc/lookout = 2, /datum/shop_sku/fitter/rare/mod_emp_shield_advanced = 2, /datum/shop_sku/fitter/rare/mod_projectile_dampener = 2, /datum/shop_sku/black_market/mod_chassis_syndicate = 2, @@ -167,7 +170,7 @@ /datum/unit_test/voidcrew_zone_shops/catalog/Run() var/list/expected = expected_tags() - TEST_ASSERT_EQUAL(length(expected), 137, "The retained permission catalog is incomplete") + TEST_ASSERT_EQUAL(length(expected), 140, "The retained permission catalog is incomplete") var/datum/voidcrew_crew_record/crew = allocate(/datum/voidcrew_crew_record) for(var/datum/shop_sku/sku_type as anything in subtypesof(/datum/shop_sku)) var/permission = expected[sku_type] || 0