Files
Bubberstation/code/datums/components/caltrop.dm
SkyratBot 3916ea03de [MIRROR] Kapulimbs [MDB IGNORE] (#12497)
* Kapulimbs

* conflicts

* part one of fixes

* more fex

* ugh

* more fix

* eee

* e

* more fix

* Well it compiles, but we need to get digi legs working

* more fixes

* https://github.com/tgstation/tgstation/pull/65887

* https://github.com/tgstation/tgstation/pull/65904

* https://github.com/tgstation/tgstation/pull/65923

* more fix

* now uses dna specific icon overrides.

* species code no longer dictates what icon the limbs use

* digitigrade legs implemenation

* more fixes, species indexing, species bodyparts

* remaining mutant bois

* 0

* okay this work!

* IPC stuffs

* inv file uses

* optimisation and limb string rendering digitigrade stuff

* wew

* partial vox support

* bodymarkings are now stored on the bodypart

* limb key caching

* Update carbon_update_icons.dm

* Update carbon_update_icons.dm

* Moves our mutant variance to the new system and makes shoes squash.

* all legs do it

* https://github.com/tgstation/tgstation/pull/65918

* https://github.com/tgstation/tgstation/pull/65899

* https://github.com/tgstation/tgstation/pull/65990

* teshari bodytype

* them teshari's aren't humans

* bandaid for future proper teshari implementation

* Update vox_bodyparts.dm

* fixes chests and teshari implementation

* fixes

* fex

* Update mutant_zombie_bodyparts.dm

* oops

* Update synthetic_lizard_bodyparts.dm

* Update code/modules/mob/living/carbon/human/human_update_icons.dm

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>

* Update code/modules/mob/living/carbon/human/human_update_icons.dm

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>

* Update code/modules/mob/living/carbon/human/human_update_icons.dm

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>

* Update modular_skyrat/master_files/code/modules/surgery/bodyparts/species_parts/ghoul_bodyparts.dm

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>

* Update modular_skyrat/master_files/code/modules/surgery/bodyparts/species_parts/ghoul_bodyparts.dm

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>

* Update modular_skyrat/master_files/code/modules/surgery/bodyparts/species_parts/ghoul_bodyparts.dm

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>

* Update modular_skyrat/master_files/code/modules/surgery/bodyparts/species_parts/ghoul_bodyparts.dm

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>

* Update code/modules/mob/living/carbon/human/species.dm

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>

* Update scissors.dm

* wound stuff

* Update carbon_examine.dm

* more stuff

* Delete human_update_icons.dm

* begone thot

* https://github.com/tgstation/tgstation/pull/66065

* Update _external_organs.dm

Co-authored-by: Kapu1178 <75460809+Kapu1178@users.noreply.github.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
2022-04-11 02:40:05 +01:00

127 lines
3.6 KiB
Plaintext

/**
* Caltrop element; for hurting people when they walk over this.
*
* Used for broken glass, cactuses and four sided dice.
*/
/datum/component/caltrop
///Minimum damage done when crossed
var/min_damage
///Maximum damage done when crossed
var/max_damage
///Probability of actually "firing", stunning and doing damage
var/probability
///Miscelanous caltrop flags; shoe bypassing, walking interaction, silence
var/flags
///The sound that plays when a caltrop is triggered.
var/soundfile
///given to connect_loc to listen for something moving over target
var/static/list/crossed_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
///So we can update ant damage
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
/datum/component/caltrop/Initialize(min_damage = 0, max_damage = 0, probability = 100, flags = NONE, soundfile = null)
. = ..()
if(!isatom(parent))
return COMPONENT_INCOMPATIBLE
src.min_damage = min_damage
src.max_damage = max(min_damage, max_damage)
src.probability = probability
src.flags = flags
src.soundfile = soundfile
if(ismovable(parent))
AddComponent(/datum/component/connect_loc_behalf, parent, crossed_connections)
else
RegisterSignal(get_turf(parent), COMSIG_ATOM_ENTERED, .proc/on_entered)
// Inherit the new values passed to the component
/datum/component/caltrop/InheritComponent(datum/component/caltrop/new_comp, original, min_damage, max_damage, probability, flags, soundfile)
if(!original)
return
if(min_damage)
src.min_damage = min_damage
if(max_damage)
src.max_damage = max_damage
if(probability)
src.probability = probability
if(flags)
src.flags = flags
if(soundfile)
src.soundfile = soundfile
/datum/component/caltrop/proc/on_entered(datum/source, atom/movable/arrived, atom/old_loc, list/atom/old_locs)
SIGNAL_HANDLER
if(!prob(probability))
return
if(!ishuman(arrived))
return
var/mob/living/carbon/human/H = arrived
if(HAS_TRAIT(H, TRAIT_PIERCEIMMUNE))
return
if((flags & CALTROP_IGNORE_WALKERS) && H.m_intent == MOVE_INTENT_WALK)
return
if(H.movement_type & (FLOATING|FLYING)) //check if they are able to pass over us
//gravity checking only our parent would prevent us from triggering they're using magboots / other gravity assisting items that would cause them to still touch us.
return
if(H.buckled) //if they're buckled to something, that something should be checked instead.
return
if(H.body_position == LYING_DOWN && !(flags & CALTROP_NOCRAWL)) //if we're not standing we cant step on the caltrop
return
var/picked_def_zone = pick(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)
var/obj/item/bodypart/O = H.get_bodypart(picked_def_zone)
if(!istype(O))
return
if(!IS_ORGANIC_LIMB(O))
return
if (!(flags & CALTROP_BYPASS_SHOES))
// SKYRAT EDIT ADDITION BEGIN - Hardened Soles Quirk
if(HAS_TRAIT(H, TRAIT_HARD_SOLES))
return
// SKYRAT EDIT ADDITION END
if ((H.wear_suit?.body_parts_covered | H.w_uniform?.body_parts_covered | H.shoes?.body_parts_covered) & FEET)
return
var/damage = rand(min_damage, max_damage)
if(HAS_TRAIT(H, TRAIT_LIGHT_STEP))
damage *= 0.75
if(!(flags & CALTROP_SILENT) && !H.has_status_effect(/datum/status_effect/caltropped))
H.apply_status_effect(/datum/status_effect/caltropped)
H.visible_message(
span_danger("[H] steps on [parent]."),
span_userdanger("You step on [parent]!")
)
H.apply_damage(damage, BRUTE, picked_def_zone, wound_bonus = CANT_WOUND)
if(!(flags & CALTROP_NOSTUN)) // Won't set off the paralysis.
H.Paralyze(60)
if(!soundfile)
return
playsound(H, soundfile, 15, TRUE, -3)
/datum/component/caltrop/UnregisterFromParent()
if(ismovable(parent))
qdel(GetComponent(/datum/component/connect_loc_behalf))