From 5f496524d23d9bf1dbd193c6aa82d47bcb000e95 Mon Sep 17 00:00:00 2001 From: Kelenius Date: Sat, 17 Jan 2015 19:11:41 +0300 Subject: [PATCH] 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. --- code/game/objects/structures/window.dm | 89 +++++++++++++------ code/game/turfs/simulated/walls.dm | 5 +- code/game/turfs/simulated/walls_reinforced.dm | 3 + code/modules/reagents/Chemistry-Reagents.dm | 30 +------ code/modules/reagents/Chemistry-Recipes.dm | 4 +- .../reagents/reagent_containers/spray.dm | 53 ++++++----- 6 files changed, 106 insertions(+), 78 deletions(-) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index cd55637b355..db4617d35a4 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -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 << "It looks fully intact." + else + var/perc = health / maxhealth + if(perc > 0.75) + user << "It has a few cracks." + else if(perc > 0.5) + user << "It looks slightly damaged." + else if(perc > 0.25) + user << "It looks moderately damaged." + else + user << "It looks heavily damaged." + if(silicate) + if (silicate < 30) + user << "It has a thin layer of silicate." + else if (silicate < 70) + user << "It is covered in silicate." + else + user << "There is a thick layer of silicate covering it." /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) ..() diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index 7158a866cf1..783ed17ba29 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -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) diff --git a/code/game/turfs/simulated/walls_reinforced.dm b/code/game/turfs/simulated/walls_reinforced.dm index e06f9ba980a..d4eae2aa634 100644 --- a/code/game/turfs/simulated/walls_reinforced.dm +++ b/code/game/turfs/simulated/walls_reinforced.dm @@ -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) diff --git a/code/modules/reagents/Chemistry-Reagents.dm b/code/modules/reagents/Chemistry-Reagents.dm index 6fd9de29f78..1e7d7bdd56f 100644 --- a/code/modules/reagents/Chemistry-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents.dm @@ -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" diff --git a/code/modules/reagents/Chemistry-Recipes.dm b/code/modules/reagents/Chemistry-Recipes.dm index df9c8a219a4..b9c657f97ec 100644 --- a/code/modules/reagents/Chemistry-Recipes.dm +++ b/code/modules/reagents/Chemistry-Recipes.dm @@ -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" diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index 1db8fa1aa4b..d3a118207e3 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -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 << "\The [src] is empty!" 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