Changes how sprays work and re-adds silicate

Sprays will spray directly at solid objects if they are clicked (walls,
windows, etc).
Makes removal of wall rot with plant-b-gone actually work.
Re-adds silicate with the old recipe. It repairs windows and makes them
more damage-resistant up to half damage taken.
This commit is contained in:
Kelenius
2015-01-17 19:11:41 +03:00
parent d65c8f366e
commit 5f496524d2
6 changed files with 106 additions and 78 deletions
+61 -28
View File
@@ -15,25 +15,75 @@
var/basestate
var/shardtype = /obj/item/weapon/shard
var/glasstype = null // Set this in subtypes. Null is assumed strange or otherwise impossible to dismantle, such as for shuttle glass.
// var/silicate = 0 // number of units of silicate
// var/icon/silicateIcon = null // the silicated icon
var/silicate = 0 // number of units of silicate
var/icon/silicateIcon = null // the silicated icon
/obj/structure/window/examine(mob/user)
. = ..(user)
if(health == maxhealth)
user << "<span class='notice'>It looks fully intact.</span>"
else
var/perc = health / maxhealth
if(perc > 0.75)
user << "<span class='notice'>It has a few cracks.</span>"
else if(perc > 0.5)
user << "<span class='warning'>It looks slightly damaged.</span>"
else if(perc > 0.25)
user << "<span class='warning'>It looks moderately damaged.</span>"
else
user << "<span class='danger'>It looks heavily damaged.</span>"
if(silicate)
if (silicate < 30)
user << "<span class='notice'>It has a thin layer of silicate.</span>"
else if (silicate < 70)
user << "<span class='notice'>It is covered in silicate.</span>"
else
user << "<span class='notice'>There is a thick layer of silicate covering it.</span>"
/obj/structure/window/proc/take_damage(var/damage = 0, var/sound_effect = 1)
var/initialhealth = src.health
src.health = max(0, src.health - damage)
if(src.health <= 0)
src.shatter()
var/initialhealth = health
if(silicate)
world << "[silicate] silicate, damage is reduced from [damage] to [round(damage * (1 - silicate / 200))]"
damage = damage * (1 - silicate / 200)
health = max(0, health - damage)
if(health <= 0)
shatter()
else
if(sound_effect)
playsound(loc, 'sound/effects/Glasshit.ogg', 100, 1)
if(src.health < src.maxhealth / 4 && initialhealth >= src.maxhealth / 4)
if(health < maxhealth / 4 && initialhealth >= maxhealth / 4)
visible_message("[src] looks like it's about to shatter!" )
else if(src.health < src.maxhealth / 2 && initialhealth >= src.maxhealth / 2)
else if(health < maxhealth / 2 && initialhealth >= maxhealth / 2)
visible_message("[src] looks seriously damaged!" )
else if(src.health < src.maxhealth * 3/4 && initialhealth >= src.maxhealth * 3/4)
else if(health < maxhealth * 3/4 && initialhealth >= maxhealth * 3/4)
visible_message("Cracks begin to appear in [src]!" )
return
/obj/structure/window/proc/apply_silicate(var/amount)
if(health < maxhealth) // Mend the damage
health = min(health + amount * 3, maxhealth)
if(health == maxhealth)
visible_message("[src] looks fully repaired." )
else // Reinforce
silicate = min(silicate + amount, 100)
updateSilicate()
/obj/structure/window/proc/updateSilicate()
if(!silicate)
icon = initial(icon)
return
var/icon/I = icon(initial(icon))
var/r = (silicate / 100) + 1
var/g = (silicate / 70) + 1
var/b = (silicate / 50) + 1
I.SetIntensity(r,g,b)
icon = I
/obj/structure/window/proc/shatter(var/display_message = 1)
playsound(src, "shatter", 70, 1)
if(display_message)
@@ -251,7 +301,7 @@
update_nearby_tiles(need_rebuild=1) //Compel updates before
set_dir(turn(dir, 90))
// updateSilicate()
updateSilicate()
update_nearby_tiles(need_rebuild=1)
return
@@ -267,27 +317,10 @@
update_nearby_tiles(need_rebuild=1) //Compel updates before
set_dir(turn(dir, 270))
// updateSilicate()
updateSilicate()
update_nearby_tiles(need_rebuild=1)
return
/*
/obj/structure/window/proc/updateSilicate()
if(silicateIcon && silicate)
icon = initial(icon)
var/icon/I = icon(icon,icon_state,dir)
var/r = (silicate / 100) + 1
var/g = (silicate / 70) + 1
var/b = (silicate / 50) + 1
I.SetIntensity(r,g,b)
icon = I
silicateIcon = I
*/
/obj/structure/window/New(Loc, start_dir=null, constructed=0)
..()