Skip to content

Commit

Permalink
Wounds Atomization: repairing clothes (#10782)
Browse files Browse the repository at this point in the history
* finished, basically

* 515

* fix broken overlays
  • Loading branch information
Tsar-Salat authored Aug 11, 2024
1 parent f3e2e92 commit ddb6f3c
Show file tree
Hide file tree
Showing 16 changed files with 274 additions and 85 deletions.
8 changes: 7 additions & 1 deletion code/__DEFINES/obj_flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@
#define SCAN_BOOZEPOWER (1<<12) //! Allows helmets and glasses to scan reagents.
#define MASKEXTENDRANGE (1<<13) //! For masks, allows you to breathe from internals on adjecent tiles
#define NOTCONSUMABLE (1<<14) //! Moths cannot eat clothing with that flag
#define HEADINTERNALS (1<<15) //! Headgear/helmet allows internals
/// Headgear/helmet allows internals
#define HEADINTERNALS (1<<18)

/// Integrity defines for clothing (not flags but close enough)
#define CLOTHING_PRISTINE 0 // We have no damage on the clothing
#define CLOTHING_DAMAGED 1 // There's some damage on the clothing but it still has at least one functioning bodypart and can be equipped
#define CLOTHING_SHREDDED 2 // The clothing is useless and cannot be equipped unless repaired first

/// Flags for the organ_flags var on /obj/item/organ

Expand Down
16 changes: 16 additions & 0 deletions code/__HELPERS/type2type.dm
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,22 @@
. = "NONE"
return .

/// For finding out what body parts a body zone covers, the inverse of the below basically
/proc/body_zone2cover_flags(def_zone)
switch(def_zone)
if(BODY_ZONE_CHEST)
return CHEST|GROIN
if(BODY_ZONE_HEAD)
return HEAD
if(BODY_ZONE_L_ARM)
return ARM_LEFT|HAND_LEFT
if(BODY_ZONE_R_ARM)
return ARM_RIGHT|HAND_RIGHT
if(BODY_ZONE_L_LEG)
return LEG_LEFT|FOOT_LEFT
if(BODY_ZONE_R_LEG)
return LEG_RIGHT|FOOT_RIGHT

/// Converts an RGB color to an HSL color
/proc/rgb2hsl(red, green, blue)
red /= 255;green /= 255;blue /= 255;
Expand Down
41 changes: 21 additions & 20 deletions code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,21 @@
return I.attack(src, user)

/**
* Called from [/mob/living/attackby]
*
* Arguments:
* * mob/living/M - The mob being hit by this item
* * mob/living/user - The mob hitting with this item
*/
/obj/item/proc/attack(mob/living/M, mob/living/user)
var/signal_return = SEND_SIGNAL(src, COMSIG_ITEM_ATTACK, M, user)
* Called from [/mob/living/proc/attackby]
*
* Arguments:
* * mob/living/target_mob - The mob being hit by this item
* * mob/living/user - The mob hitting with this item
* * params - Click params of this attack
*/
/obj/item/proc/attack(mob/living/M, mob/living/user, params)
var/signal_return = SEND_SIGNAL(src, COMSIG_ITEM_ATTACK, M, user, params)
if(signal_return & COMPONENT_CANCEL_ATTACK_CHAIN)
return TRUE
if(signal_return & COMPONENT_SKIP_ATTACK)
return

SEND_SIGNAL(user, COMSIG_MOB_ITEM_ATTACK, M, user)
SEND_SIGNAL(user, COMSIG_MOB_ITEM_ATTACK, M, user, params)
SEND_SIGNAL(M, COMSIG_MOB_ITEM_ATTACKBY, user, src)

var/nonharmfulhit = FALSE
Expand Down Expand Up @@ -165,17 +166,17 @@

/mob/living/attacked_by(obj/item/I, mob/living/user)
send_item_attack_message(I, user)
if(I.force)
var/armour_block = run_armor_check(null, MELEE, armour_penetration = I.armour_penetration)
apply_damage(I.force, I.damtype, blocked = armour_block)
if(I.damtype == BRUTE)
if(prob(33))
I.add_mob_blood(src)
var/turf/location = get_turf(src)
add_splatter_floor(location)
if(get_dist(user, src) <= 1) //people with TK won't get smeared with blood
user.add_mob_blood(src)
return TRUE //successful attack
if(!I.force)
return FALSE
var/armour_block = run_armor_check(null, MELEE, armour_penetration = I.armour_penetration)
apply_damage(I.force, I.damtype, blocked = armour_block)
if(I.damtype == BRUTE && prob(33))
I.add_mob_blood(src)
var/turf/location = get_turf(src)
add_splatter_floor(location)
if(get_dist(user, src) <= 1) //people with TK won't get smeared with blood
user.add_mob_blood(src)
return TRUE //successful attack

/mob/living/simple_animal/attacked_by(obj/item/I, mob/living/user, nonharmfulhit = FALSE)
if(I.force < force_threshold || I.damtype == STAMINA || nonharmfulhit)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/traits/negative_quirk.dm
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
var/mob/living/carbon/human/H = quirk_target
var/obj/item/heirloom_type

if(is_species(H, /datum/species/moth) && prob(50))
if((ismoth(H)) && prob(50))
heirloom_type = /obj/item/flashlight/lantern/heirloom_moth
else
switch(quirk_holder.assigned_role)
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/obj_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ GLOBAL_DATUM_INIT(acid_overlay, /mutable_appearance, mutable_appearance('icons/e

//what happens when the obj's integrity reaches zero.
/obj/proc/obj_destruction(damage_flag)

if(damage_flag == ACID)
acid_melt()
else if(damage_flag == FIRE)
Expand Down
Loading

0 comments on commit ddb6f3c

Please sign in to comment.