mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-17 12:35:26 +00:00
## About The Pull Request Heavily refactors wounds AGAIN. The primary thing this PR does is completely change how wounds are generated and added - while the normal "hit a guy til they bleed" stuff works about the same, asking for a specific type of wound, say, like how vending machines try to apply a compound fracture sometimes, isnt going to work if we ever get any non-organic wounds, which the previous refactor allowed. With this PR, however... * You can now ask for a specific type of wound via get_corresponding_wound_type(), which takes wound types, a limb, wound series, etc. and will try to give you a wound fitting those specifications - but also, a wound that can be applied to a limb. * This will allow for a vending machine to apply a compound fracture to a human, but a collapsed superstructure (assuming my synth wounds go in) to a robot There are now new "series types" and "wound specific types" that allow us to designate what series are "mainline" and randomly generatable, and what are "alternate types" and must be generated manually - you can see the documentation in wounds.dm. The behavior of limping and interaction delays has been abstracted to datum/wound from bone wounds to allow just, general ease of development Pregen data now allows for series-specific wound penalties. Example: You could set a burn wound's series wound penalty to 40, which would make wound progression in the burn category easier - but it would not make it any easier to get a slashing wound. As it stands wound penalties are for wounds globally Scar files are now picked in a "priority" list, where the wound checks to see if the limb has a biostate before moving down in said list. Example: Wounds will check for flesh first, if it finds it - it will use the flesh scar list. Failing that, they then check bone - if it uses that, it will use the bone scar list. This allows for significantly more modular scars that dont even need much proc editing when a new wound type is added Misc changes: most initial() usage has been replaced by singleton datums, wound_type is now wound_types and thus wounds can accept multiple wound types, wounds can now accept multiple tool behaviors for treatment, wounds now have a picking weight so we can make certain wounds rarer flatly, This PR also allows for wounds to override lower severity wounds on generation, allowing eswords to jump to avulsions - but in spirit of refactoring, this has been disabled by default (see pregen data's competition_mode var). ## Why It's Good For The Game Code quality is good! Also, all the changes above allow wounds to be a MUCH more modular system, which is one of its biggest problems right now - everything is kinda hardcoded and static, making creative work within wounds harder to do. ## Changelog 🆑 refactor: Refactored wounds yet again fix: Wounds are now picked from the most severe down again, meaning eswords can jump to avulsions fix: Scar descs are now properly applied /🆑
93 lines
4.2 KiB
Plaintext
93 lines
4.2 KiB
Plaintext
/**
|
|
* Kneecapping element replaces the item's secondary attack with an aimed attack at the kneecaps under certain circumstances.
|
|
*
|
|
* Element is incompatible with non-items. Requires the parent item to have a force equal to or greater than WOUND_MINIMUM_DAMAGE.
|
|
* Also requires that the parent can actually get past pre_secondary_attack without the attack chain cancelling.
|
|
*
|
|
* Kneecapping attacks have a wounding bonus between severe and critical+10 wound thresholds. Without some serious wound protecting
|
|
* armour this all but guarantees a wound of some sort. The attack is directed specifically at a limb and the limb takes the damage.
|
|
*
|
|
* Requires the attacker to be aiming for either leg zone, which will be targetted specifically. They will than have a 3-second long
|
|
* do_after before executing the attack.
|
|
*
|
|
* Kneecapping requires the target to either be on the floor, immobilised or buckled to something. And also to have an appropriate leg.
|
|
*
|
|
* Passing all the checks will cancel the entire attack chain.
|
|
*/
|
|
/datum/element/kneecapping
|
|
|
|
/datum/element/kneecapping/Attach(datum/target)
|
|
if(!isitem(target))
|
|
stack_trace("Kneecapping element added to non-item object: \[[target]\]")
|
|
return ELEMENT_INCOMPATIBLE
|
|
|
|
var/obj/item/target_item = target
|
|
|
|
if(target_item.force < WOUND_MINIMUM_DAMAGE)
|
|
stack_trace("Kneecapping element added to item with too little force to wound: \[[target]\]")
|
|
return ELEMENT_INCOMPATIBLE
|
|
|
|
. = ..()
|
|
|
|
if(. == ELEMENT_INCOMPATIBLE)
|
|
return
|
|
|
|
RegisterSignal(target, COMSIG_ITEM_ATTACK_SECONDARY , PROC_REF(try_kneecap_target))
|
|
|
|
/datum/element/kneecapping/Detach(datum/target)
|
|
UnregisterSignal(target, COMSIG_ITEM_ATTACK_SECONDARY)
|
|
|
|
return ..()
|
|
|
|
/**
|
|
* Signal handler for COMSIG_ITEM_ATTACK_SECONDARY. Does checks for pacifism, zones and target state before either returning nothing
|
|
* if the special attack could not be attempted, performing the ordinary attack procs instead - Or cancelling the attack chain if
|
|
* the attack can be started.
|
|
*/
|
|
/datum/element/kneecapping/proc/try_kneecap_target(obj/item/source, mob/living/carbon/target, mob/attacker, params)
|
|
SIGNAL_HANDLER
|
|
|
|
if((attacker.zone_selected != BODY_ZONE_L_LEG) && (attacker.zone_selected != BODY_ZONE_R_LEG))
|
|
return
|
|
|
|
if(HAS_TRAIT(attacker, TRAIT_PACIFISM))
|
|
return
|
|
|
|
if(!iscarbon(target))
|
|
return
|
|
|
|
if(!target.buckled && !HAS_TRAIT(target, TRAIT_FLOORED) && !HAS_TRAIT(target, TRAIT_IMMOBILIZED))
|
|
return
|
|
|
|
var/obj/item/bodypart/leg = target.get_bodypart(attacker.zone_selected)
|
|
|
|
if(!leg)
|
|
return
|
|
|
|
. = COMPONENT_SECONDARY_CANCEL_ATTACK_CHAIN
|
|
|
|
INVOKE_ASYNC(src, PROC_REF(do_kneecap_target), source, leg, target, attacker)
|
|
|
|
/**
|
|
* After a short do_after, attacker applies damage to the given leg with a significant wounding bonus, applying the weapon's force as damage.
|
|
*/
|
|
/datum/element/kneecapping/proc/do_kneecap_target(obj/item/weapon, obj/item/bodypart/leg, mob/living/carbon/target, mob/attacker)
|
|
if(LAZYACCESS(attacker.do_afters, weapon))
|
|
return
|
|
|
|
attacker.visible_message(span_warning("[attacker] carefully aims [attacker.p_their()] [weapon] for a swing at [target]'s kneecaps!"), span_danger("You carefully aim \the [weapon] for a swing at [target]'s kneecaps!"))
|
|
log_combat(attacker, target, "started aiming a swing to break the kneecaps of", weapon)
|
|
|
|
if(do_after(attacker, 3 SECONDS, target, interaction_key = weapon))
|
|
attacker.visible_message(span_warning("[attacker] swings [attacker.p_their()] [weapon] at [target]'s kneecaps!"), span_danger("You swing \the [weapon] at [target]'s kneecaps!"))
|
|
|
|
var/min_wound = leg.get_wound_threshold_of_wound_type(WOUND_BLUNT, WOUND_SEVERITY_SEVERE, return_value_if_no_wound = 30, wound_source = weapon)
|
|
var/max_wound = leg.get_wound_threshold_of_wound_type(WOUND_BLUNT, WOUND_SEVERITY_CRITICAL, return_value_if_no_wound = 50, wound_source = weapon)
|
|
|
|
leg.receive_damage(brute = weapon.force, wound_bonus = rand(min_wound, max_wound + 10), damage_source = "kneecapping")
|
|
target.emote("scream")
|
|
log_combat(attacker, target, "broke the kneecaps of", weapon)
|
|
target.update_damage_overlays()
|
|
attacker.do_attack_animation(target, used_item = weapon)
|
|
playsound(source = get_turf(weapon), soundin = weapon.hitsound, vol = weapon.get_clamped_volume(), vary = TRUE)
|