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)
..()
+4 -1
View File
@@ -273,7 +273,7 @@
user << rotting_touch_message
if(rotting_destroy_touch)
dismantle_wall()
return 1
return 1
if(..()) return 1
@@ -475,6 +475,9 @@
else if(istype(W,/obj/item/weapon/rcd)) //I bitterly resent having to write this. ~Z
return
else if(istype(W, /obj/item/weapon/reagent_containers))
return // They tend to have meaningful afterattack - let them apply it without destroying a rotting wall
else
return attack_hand(user)
@@ -292,6 +292,9 @@
AH.try_build(src)
return
else if(istype(W, /obj/item/weapon/reagent_containers))
return // They tend to have meaningful afterattack - let them apply it without destroying a rotting wall
//Finally, CHECKING FOR FALSE WALLS if it isn't damaged
else if(!d_state)
return attack_hand(user)
+4 -26
View File
@@ -427,7 +427,7 @@ datum
holder.remove_reagent(src.id, 0.25 * REAGENTS_METABOLISM)
return
/* silicate
silicate
name = "Silicate"
id = "silicate"
description = "A compound that can be used to reinforce glass."
@@ -437,31 +437,9 @@ datum
reaction_obj(var/obj/O, var/volume)
src = null
if(istype(O,/obj/structure/window))
if(O:silicate <= 200)
O:silicate += volume
O:health += volume * 3
if(!O:silicateIcon)
var/icon/I = icon(O.icon,O.icon_state,O.dir)
var/r = (volume / 100) + 1
var/g = (volume / 70) + 1
var/b = (volume / 50) + 1
I.SetIntensity(r,g,b)
O.icon = I
O:silicateIcon = I
else
var/icon/I = O:silicateIcon
var/r = (volume / 100) + 1
var/g = (volume / 70) + 1
var/b = (volume / 50) + 1
I.SetIntensity(r,g,b)
O.icon = I
O:silicateIcon = I
return*/
var/obj/structure/window/W = O
W.apply_silicate(volume)
return
oxygen
name = "Oxygen"
+2 -2
View File
@@ -55,14 +55,14 @@ datum
empulse(location, round(created_volume / 24), round(created_volume / 14), 1)
holder.clear_reagents()
return
/*
silicate
name = "Silicate"
id = "silicate"
result = "silicate"
required_reagents = list("aluminum" = 1, "silicon" = 1, "oxygen" = 1)
result_amount = 3
*/
stoxin
name = "Soporific"
id = "stoxin"
@@ -21,7 +21,7 @@
..()
src.verbs -= /obj/item/weapon/reagent_containers/verb/set_APTFT
/obj/item/weapon/reagent_containers/spray/afterattack(atom/A as mob|obj, mob/user as mob)
/obj/item/weapon/reagent_containers/spray/afterattack(atom/A as mob|obj, mob/user as mob, proximity)
if(istype(A, /obj/item/weapon/storage) || istype(A, /obj/structure/table) || istype(A, /obj/structure/closet) \
|| istype(A, /obj/item/weapon/reagent_containers) || istype(A, /obj/structure/sink) || istype(A, /obj/structure/janitorialcart))
return
@@ -46,7 +46,7 @@
user << "<span class='notice'>\The [src] is empty!</span>"
return
Spray_at(A)
Spray_at(A, user, proximity)
playsound(src.loc, 'sound/effects/spray2.ogg', 50, 1, -6)
@@ -61,28 +61,39 @@
log_game("[key_name(user)] fired Space lube from \a [src].")
return
/obj/item/weapon/reagent_containers/spray/proc/Spray_at(atom/A as mob|obj)
var/obj/effect/decal/chempuff/D = new/obj/effect/decal/chempuff(get_turf(src))
D.create_reagents(amount_per_transfer_from_this)
reagents.trans_to(D, amount_per_transfer_from_this, 1/spray_size)
D.icon += mix_color_from_reagents(D.reagents.reagent_list)
/obj/item/weapon/reagent_containers/spray/proc/Spray_at(atom/A as mob|obj, mob/user as mob, proximity)
if (A.density && proximity)
A.visible_message("[usr] sprays [A] with [src].")
var/obj/D = new/obj()
D.create_reagents(amount_per_transfer_from_this)
reagents.trans_to(D, amount_per_transfer_from_this)
D.icon += mix_color_from_reagents(D.reagents.reagent_list)
spawn(0)
D.reagents.reaction(A)
sleep(5)
del(D)
else
var/obj/effect/decal/chempuff/D = new/obj/effect/decal/chempuff(get_turf(src))
D.create_reagents(amount_per_transfer_from_this)
reagents.trans_to(D, amount_per_transfer_from_this, 1/spray_size)
D.icon += mix_color_from_reagents(D.reagents.reagent_list)
var/turf/A_turf = get_turf(A)//BS12
var/turf/A_turf = get_turf(A)//BS12
spawn(0)
for(var/i=0, i<spray_size, i++)
step_towards(D,A)
D.reagents.reaction(get_turf(D))
for(var/atom/T in get_turf(D))
D.reagents.reaction(T)
spawn(0)
for(var/i=0, i<spray_size, i++)
step_towards(D,A)
D.reagents.reaction(get_turf(D))
for(var/atom/T in get_turf(D))
D.reagents.reaction(T)
// When spraying against the wall, also react with the wall, but
// not its contents. BS12
if(get_dist(D, A_turf) == 1 && A_turf.density)
D.reagents.reaction(A_turf)
sleep(2)
sleep(3)
del(D)
// When spraying against the wall, also react with the wall, but
// not its contents. BS12
if(get_dist(D, A_turf) == 1 && A_turf.density)
D.reagents.reaction(A_turf)
sleep(2)
sleep(3)
del(D)
return