Add caltrop component for spikey floor objects (#33280)
* Add caltrop component for spikey floor objects The caltrop component now can be added to any crossable atom, and it'll act like a shard of glass, or a d4. Additional flags are possible for it to bypass shoes or ignore people who are walking. This means d4 don't reimplement shard logic, and also open the window for caltrop grenades later. Also, it taught me how components work. * Code review I * Caltrop damage is 4 * Cactus hurts * Whoops * Ignore restraints = true
This commit is contained in:
@@ -137,18 +137,10 @@
|
||||
regrowth_time_low = 4800
|
||||
regrowth_time_high = 7200
|
||||
|
||||
/obj/structure/flora/ash/cacti/Crossed(mob/AM)
|
||||
if(ishuman(AM) && has_gravity(loc) && prob(70))
|
||||
var/mob/living/carbon/human/H = AM
|
||||
if(!H.shoes && !H.lying) //ouch, my feet.
|
||||
var/picked_def_zone = pick("l_leg", "r_leg")
|
||||
var/obj/item/bodypart/O = H.get_bodypart(picked_def_zone)
|
||||
if(!istype(O) || (PIERCEIMMUNE in H.dna.species.species_traits))
|
||||
return
|
||||
H.apply_damage(rand(3, 6), BRUTE, picked_def_zone)
|
||||
H.Knockdown(40)
|
||||
H.visible_message("<span class='danger'>[H] steps on a cactus!</span>", \
|
||||
"<span class='userdanger'>You step on a cactus!</span>")
|
||||
/obj/structure/flora/ash/cacti/Initialize(mapload)
|
||||
. = ..()
|
||||
// min dmg 3, max dmg 6, prob(70)
|
||||
AddComponent(/datum/component/caltrop, 3, 6, 70)
|
||||
|
||||
/obj/item/reagent_containers/food/snacks/grown/ash_flora
|
||||
name = "mushroom shavings"
|
||||
|
||||
Reference in New Issue
Block a user