Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limb tweaks #562

Merged
merged 2 commits into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions code/__defines/damage_organs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@
// that dealing just enough burn damage to kill the player will cause the given
// proportion of their max blood volume to be lost
// (e.g. 0.6 == 60% lost if 200 burn damage is taken).
#define FLUIDLOSS_WIDE_BURN 0.6 //for burns from heat applied over a wider area, like from fire
#define FLUIDLOSS_CONC_BURN 0.4 //for concentrated burns, like from lasers
#define FLUIDLOSS_WIDE_BURN 0.2 //for burns from heat applied over a wider area, like from fire
#define FLUIDLOSS_CONC_BURN 0.1 //for concentrated burns, like from lasers

// Damage above this value must be repaired with surgery.
#define ROBOLIMB_SELF_REPAIR_CAP 30
Expand Down
18 changes: 9 additions & 9 deletions code/modules/mob/living/carbon/human/human_organs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@
else if (E.is_dislocated())
stance_damage += 0.5

if(E) limb_pain = E.can_feel_pain()
if(E)
limb_pain = E.can_feel_pain()

// Canes and crutches help you stand (if the latter is ever added)
// One cane mitigates a broken leg+foot, or a missing foot.
Expand Down Expand Up @@ -195,9 +196,9 @@
to_chat(src, SPAN_WARNING("You lose your balance as [affected.name] [pick("malfunctions", "freezes","shudders")]!"))
else
return
Weaken(4)
Weaken(1)

/mob/living/carbon/human/proc/grasp_damage_disarm(var/obj/item/organ/external/affected)
/mob/living/carbon/human/proc/grasp_damage_disarm(obj/item/organ/external/affected)
var/disarm_slot
switch(affected.body_part)
if(HAND_LEFT, ARM_LEFT)
Expand All @@ -217,14 +218,13 @@
return

if(BP_IS_ROBOTIC(affected))
visible_message("<B>\The [src]</B> drops what they were holding, \his [affected.name] malfunctioning!")
visible_message(SPAN_WARNING("<b>\The [src]</b> drops what they were holding, \his [affected.name] malfunctioning!"))

var/datum/effect/effect/system/spark_spread/spark_system = new /datum/effect/effect/system/spark_spread()
spark_system.set_up(5, 0, src)
spark_system.attach(src)
spark_system.start()
spawn(10)
qdel(spark_system)
QDEL_IN(spark_system, 10)

else
var/grasp_name = affected.name
Expand All @@ -236,13 +236,13 @@
var/emote_scream = pick("screams in pain", "lets out a sharp cry", "cries out")
var/emote_scream_alt = pick("scream in pain", "let out a sharp cry", "cry out")
visible_message(
"<B>\The [src]</B> [emote_scream] and drops what they were holding in their [grasp_name]!",
SPAN_WARNING("<b>\The [src]</b> [emote_scream] and drops what they were holding in their [grasp_name]!"),
null,
"You hear someone [emote_scream_alt]!"
SPAN_WARNING("You hear someone [emote_scream_alt]!"),
)
custom_pain("The sharp pain in your [affected.name] forces you to drop [thing]!", 30)
else
visible_message("<B>\The [src]</B> drops what they were holding in their [grasp_name]!")
visible_message(SPAN_WARNING("<b>\The [src]</b> drops what they were holding in their [grasp_name]!"))

/mob/living/carbon/human/proc/sync_organ_dna()
var/list/all_bits = internal_organs|organs
Expand Down
25 changes: 16 additions & 9 deletions code/modules/organs/external/_external.dm
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ r/****************************************************
var/sever_artery_threshold
/// Minimum amount of damage required to have a chance to sever tendons upon receiving new wound
var/sever_tendon_threshold
/// Minimum amount of damage required for robotic limb to be considered malfunctioning (causes dropping items and such)
var/malfunction_threshold = 20

/obj/item/organ/external/proc/get_fingerprint()

Expand Down Expand Up @@ -494,8 +496,10 @@ This function completely restores a damaged organ to perfect condition.
if((type in list(BURN, LASER)) && (damage > 5 || damage + burn_dam >= 15) && !BP_IS_ROBOTIC(src))
var/fluid_loss_severity
switch(type)
if(BURN) fluid_loss_severity = FLUIDLOSS_WIDE_BURN
if(LASER) fluid_loss_severity = FLUIDLOSS_CONC_BURN
if(BURN)
fluid_loss_severity = FLUIDLOSS_WIDE_BURN
if(LASER)
fluid_loss_severity = FLUIDLOSS_CONC_BURN
var/fluid_loss = (damage/(owner.maxHealth - config.health_threshold_dead)) * SPECIES_BLOOD_DEFAULT * fluid_loss_severity
owner.remove_blood(fluid_loss)

Expand Down Expand Up @@ -1118,25 +1122,21 @@ obj/item/organ/external/proc/remove_clamps()
return 0

/obj/item/organ/external/robotize(company, skip_prosthetics = 0, keep_organs = 0)

if(BP_IS_ROBOTIC(src))
return

..()


if(company)
var/datum/robolimb/R = all_robolimbs[company]
if(!istype(R) || (species && (species.name in R.species_cannot_use)) || \
(species && !(species.get_bodytype(owner) in R.allowed_bodytypes)) || \
(R.applies_to_part.len && !(organ_tag in R.applies_to_part)))
R = basic_robolimb
else
model = company
force_icon = R.icon
name = "robotic [initial(name)]"
desc = "[R.desc] It looks like it was produced by [R.company]."
ApplyModel(R)

name = "robotic [initial(name)]"
dislocated = -1
remove_splint()
update_icon(1)
Expand Down Expand Up @@ -1168,6 +1168,13 @@ obj/item/organ/external/proc/remove_clamps()

return 1

/obj/item/organ/external/proc/ApplyModel(datum/robolimb/R)
model = R.company
force_icon = R.icon
desc = "[R.desc] It looks like it was produced by [R.company]."
malfunction_threshold = R.limb_malfunction_threshold
return TRUE

/obj/item/organ/external/proc/get_damage() //returns total damage
return (brute_dam+burn_dam) //could use max_damage?

Expand All @@ -1181,7 +1188,7 @@ obj/item/organ/external/proc/remove_clamps()
return ..() && !is_stump() && !(status & ORGAN_TENDON_CUT) && (!can_feel_pain() || get_pain() < pain_disability_threshold) && brute_ratio < 1 && burn_ratio < 1

/obj/item/organ/external/proc/is_malfunctioning()
return (BP_IS_ROBOTIC(src) && (brute_dam + burn_dam) >= 10 && prob(brute_dam + burn_dam))
return (BP_IS_ROBOTIC(src) && (brute_dam + burn_dam) >= malfunction_threshold && prob((brute_dam + burn_dam) - malfunction_threshold))

/obj/item/organ/external/proc/embed(var/obj/item/W, var/silent = 0, var/supplied_message, var/datum/wound/supplied_wound)
if(!owner || loc != owner)
Expand Down
1 change: 1 addition & 0 deletions code/modules/organs/robolimbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var/datum/robolimb/basic_robolimb
var/list/restricted_to = list()
var/list/applies_to_part = list() //TODO.
var/list/allowed_bodytypes = list(SPECIES_HUMAN, SPECIES_IPC, SPECIES_SKRELL, SPECIES_UNATHI)
var/limb_malfunction_threshold = 20

/datum/robolimb/bishop
company = "Bishop"
Expand Down
1 change: 0 additions & 1 deletion test/check-paths.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ exactly 144 "<< uses" '(?<!<)<<(?!<)' -P
exactly 0 "incorrect indentations" '^( {4,})' -P
exactly 1 "goto use" 'goto '
exactly 1 "NOOP match" 'NOOP'
exactly 413 "spawn uses" 'spawn\s*\(\s*(-\s*)?\d*\s*\)' -P
exactly 0 "tag uses" '\stag = ' -P '**/*.dmm'
exactly 4 ".Replace( matches" '\.Replace(_char)?\(' -P
exactly 0 "anchored = 0/1" 'anchored\s*=\s*\d' -P
Expand Down
Loading