Files
Aurora.3/code/game/objects/items/weapons/material/shards.dm
T
AlberykandErki f2d48983c4 Bug fixes: trial by fire (#4990)
-fixes #4697
-fixes #3913
-fixes #3216
-fixes #1854
-fixes #901
-fixes #1597
-fixes #4469
-fixes #1215
-fixes #3681
-fixes #3567
2018-07-17 22:55:01 +03:00

105 lines
3.2 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.2 // 6 with hardness 30 (glass)
thrown_force_divisor = 0.4 // 4 with weight 15 (glass)
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/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(iswelder(W) && material.shard_can_repair)
var/obj/item/weapon/weldingtool/WT = W
if(WT.remove_fuel(0, user))
material.place_sheet(user.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
M << "<span class='danger'>You step on \the [src]!</span>"
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 || isvaurca(H) || (H.species.flags & (NO_EMBED))) //Thick skin.
return
if( H.shoes || ( H.wear_suit && (H.wear_suit.body_parts_covered & FEET) ) )
return
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.status & ORGAN_ROBOT)
return
if(affecting.take_damage(5, 0))
H.UpdateDamageIcon()
H.updatehealth()
if(!(H.species.flags & NO_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/shrapnel/flechette/New(loc)
..(loc, "titanium")
/obj/item/weapon/material/shard/phoron/New(loc)
..(loc, "phglass")
/obj/item/weapon/material/shard/wood/New(loc)
..(loc, "wood")