mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 02:09:41 +00:00
105 lines
3.3 KiB
Plaintext
105 lines
3.3 KiB
Plaintext
// Glass shards
|
|
|
|
/obj/item/weapon/material/shard
|
|
name = "shard"
|
|
icon = 'icons/obj/shards.dmi'
|
|
desc = "Made of nothing. How does this even exist?" // set based on material, if this desc is visible it's a bug (shards default to being made of glass)
|
|
icon_state = "large"
|
|
sharp = 1
|
|
edge = 1
|
|
w_class = 2
|
|
force_divisor = 0.25 // 7.5 with hardness 30 (glass)
|
|
thrown_force_divisor = 0.5
|
|
item_state = "shard-glass"
|
|
attack_verb = list("stabbed", "slashed", "sliced", "cut")
|
|
default_material = "glass"
|
|
unbreakable = 1 //It's already broken.
|
|
drops_debris = 0
|
|
|
|
/obj/item/weapon/material/shard/suicide_act(mob/user)
|
|
viewers(user) << pick("<span class='danger'>\The [user] is slitting \his wrists with \the [src]! It looks like \he's trying to commit suicide.</span>",
|
|
"<span class='danger'>\The [user] is slitting \his throat with \the [src]! It looks like \he's trying to commit suicide.</span>")
|
|
return (BRUTELOSS)
|
|
|
|
/obj/item/weapon/material/shard/set_material(var/new_material)
|
|
..(new_material)
|
|
if(!istype(material))
|
|
return
|
|
|
|
icon_state = "[material.shard_icon][pick("large", "medium", "small")]"
|
|
pixel_x = rand(-8, 8)
|
|
pixel_y = rand(-8, 8)
|
|
update_icon()
|
|
|
|
if(material.shard_type)
|
|
name = "[material.display_name] [material.shard_type]"
|
|
desc = "A small piece of [material.display_name]. It looks sharp, you wouldn't want to step on it barefoot. Could probably be used as ... a throwing weapon?"
|
|
switch(material.shard_type)
|
|
if(SHARD_SPLINTER, SHARD_SHRAPNEL)
|
|
gender = PLURAL
|
|
else
|
|
gender = NEUTER
|
|
else
|
|
qdel(src)
|
|
|
|
/obj/item/weapon/material/shard/update_icon()
|
|
if(material)
|
|
color = material.icon_colour
|
|
// 1-(1-x)^2, so that glass shards with 0.3 opacity end up somewhat visible at 0.51 opacity
|
|
alpha = 255 * (1 - (1 - material.opacity)*(1 - material.opacity))
|
|
else
|
|
color = "#ffffff"
|
|
alpha = 255
|
|
|
|
/obj/item/weapon/material/shard/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
|
if(istype(W, /obj/item/weapon/weldingtool) && material.shard_can_repair)
|
|
var/obj/item/weapon/weldingtool/WT = W
|
|
if(WT.remove_fuel(0, user))
|
|
material.place_sheet(loc)
|
|
qdel(src)
|
|
return
|
|
return ..()
|
|
|
|
/obj/item/weapon/material/shard/Crossed(AM as mob|obj)
|
|
..()
|
|
if(isliving(AM))
|
|
var/mob/M = AM
|
|
|
|
if(M.buckled) //wheelchairs, office chairs, rollerbeds
|
|
return
|
|
|
|
playsound(src.loc, 'sound/effects/glass_step.ogg', 50, 1) // not sure how to handle metal shards with sounds
|
|
if(ishuman(M))
|
|
var/mob/living/carbon/human/H = M
|
|
|
|
if(H.species.siemens_coefficient<0.5) //Thick skin.
|
|
return
|
|
|
|
if( H.shoes || ( H.wear_suit && (H.wear_suit.body_parts_covered & FEET) ) )
|
|
return
|
|
|
|
M << "<span class='danger'>You step on \the [src]!</span>"
|
|
|
|
var/list/check = list("l_foot", "r_foot")
|
|
while(check.len)
|
|
var/picked = pick(check)
|
|
var/obj/item/organ/external/affecting = H.get_organ(picked)
|
|
if(affecting)
|
|
if(affecting.robotic >= ORGAN_ROBOT)
|
|
return
|
|
if(affecting.take_damage(force, 0))
|
|
H.UpdateDamageIcon()
|
|
H.updatehealth()
|
|
if(affecting.can_feel_pain())
|
|
H.Weaken(3)
|
|
return
|
|
check -= picked
|
|
return
|
|
|
|
// Preset types - left here for the code that uses them
|
|
/obj/item/weapon/material/shard/shrapnel/New(loc)
|
|
..(loc, "steel")
|
|
|
|
/obj/item/weapon/material/shard/phoron/New(loc)
|
|
..(loc, "phglass")
|