-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIRROR] Living Limb fixes (feat: Basic mobs attack random body zones…
… again) (#1969) (#2873) * Living Limb fixes (feat: Basic mobs attack random body zones again) (#82556) ## About The Pull Request Reworks Living Limb code to fix a bunch of runtimes and issues I saw while testing Bioscrambler. Specifically, the contained mobs are now initialised via element following attachment so that signal registration can occur at the correct time. This allows limbs to function correctly when added from nullspace via admin panel or bioscrambler. Secondarily (and more wide-ranging) at some point (probably #79563) we inadvertently made basic mobs only attack the target's chest instead of spreading damage. This is problematic for Living Flesh which can only attach itself to damaged limbs but was left unable to attack damaged limbs. I've fixed this in a way which is maybe stupid: adding an element which randomises attack zone pre-attack. Living limbs also limit this to _only_ limbs (although it will fall back to chest if you have no limbs at all). This is _technically_ still different, the previous behaviour used `adjustBruteLoss` and `adjustFireLoss` and would spread the damage across your entire body, but there isn't a route to that via the new interface and this seems close enough. ## Changelog :cl: fix: Living Limbs created by Bioscrambler will be alive. fix: Living Limbs can once more attach themselves to your body. balance: Living Limbs will prioritise attacking your limbs. fix: Basic Mobs will once again spread their damage across body zones instead of only attacking your chest. /:cl: * Living Limb fixes (feat: Basic mobs attack random body zones again) --------- Co-authored-by: NovaBot <[email protected]> Co-authored-by: Jacquerel <[email protected]>
- Loading branch information
1 parent
e7ce24b
commit 8c17f50
Showing
13 changed files
with
86 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/// Pick a random attack zone before you attack something | ||
/datum/element/attack_zone_randomiser | ||
element_flags = ELEMENT_BESPOKE | ||
argument_hash_start_idx = 2 | ||
/// List of attack zones you can select, should be a subset of GLOB.all_body_zones | ||
var/list/valid_attack_zones | ||
|
||
/datum/element/attack_zone_randomiser/Attach(datum/target, list/valid_attack_zones = GLOB.all_body_zones) | ||
. = ..() | ||
if (!isliving(target)) | ||
return ELEMENT_INCOMPATIBLE | ||
RegisterSignals(target, list(COMSIG_HOSTILE_PRE_ATTACKINGTARGET, COMSIG_LIVING_UNARMED_ATTACK), PROC_REF(randomise)) | ||
src.valid_attack_zones = valid_attack_zones | ||
|
||
/datum/element/attack_zone_randomiser/Detach(datum/source) | ||
UnregisterSignal(source, list (COMSIG_HOSTILE_PRE_ATTACKINGTARGET, COMSIG_LIVING_UNARMED_ATTACK)) | ||
return ..() | ||
|
||
/// If we're attacking a carbon, pick a random defence zone | ||
/datum/element/attack_zone_randomiser/proc/randomise(mob/living/source, atom/target) | ||
SIGNAL_HANDLER | ||
if (!iscarbon(target)) | ||
return | ||
var/mob/living/living_target = target | ||
var/list/blacklist_zones = GLOB.all_body_zones - valid_attack_zones | ||
var/new_zone = living_target.get_random_valid_zone(blacklisted_parts = blacklist_zones, bypass_warning = TRUE) | ||
if (isnull(new_zone)) | ||
new_zone = BODY_ZONE_CHEST | ||
var/atom/movable/screen/zone_sel/zone_selector = source.hud_used?.zone_select | ||
if (isnull(zone_selector)) | ||
source.zone_selected = new_zone | ||
else | ||
zone_selector.set_selected_zone(new_zone, source, should_log = FALSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/// Spawns a living limb mob inside a limb upon attachment if it doesn't have one | ||
/datum/element/living_limb_initialiser | ||
|
||
/datum/element/living_limb_initialiser/Attach(atom/target) | ||
. = ..() | ||
if(!isbodypart(target)) | ||
return ELEMENT_INCOMPATIBLE | ||
RegisterSignal(target, COMSIG_BODYPART_CHANGED_OWNER, PROC_REF(try_animate_limb)) | ||
|
||
/datum/element/living_limb_initialiser/Detach(atom/target) | ||
UnregisterSignal(target, COMSIG_BODYPART_CHANGED_OWNER) | ||
return ..() | ||
|
||
/// Create a living limb mob inside the limb if it doesn't already have one | ||
/datum/element/living_limb_initialiser/proc/try_animate_limb(obj/item/bodypart/part) | ||
SIGNAL_HANDLER | ||
if (locate(/mob/living/basic/living_limb_flesh) in part) | ||
return | ||
new /mob/living/basic/living_limb_flesh(part, part) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters