mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-24 04:27:35 +01:00
Refactors the atmos watertank backpack (#24177)
* Refactors the atmos watertank backpack * Update code/game/objects/items/weapons/tanks/watertank.dm Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com> * Update code/game/objects/items/weapons/tanks/watertank.dm Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com> * Adds spans * Henri review --------- Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>
This commit is contained in:
@@ -77,6 +77,11 @@
|
||||
icon = 'icons/effects/effects.dmi'
|
||||
icon_state = "flour"
|
||||
|
||||
/obj/effect/decal/cleanable/flour/nanofrost
|
||||
name = "nanofrost residue"
|
||||
desc = "Residue left behind from a nanofrost detonation. Perhaps there was a fire here?"
|
||||
color = "#B2FFFF"
|
||||
|
||||
/obj/effect/decal/cleanable/flour/foam
|
||||
name = "Fire fighting foam"
|
||||
desc = "It's foam."
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
var/expand = 1
|
||||
var/metal = 0
|
||||
|
||||
/obj/effect/particle_effect/foam/New(loc, ismetal=0)
|
||||
/obj/effect/particle_effect/foam/New(loc, ismetal = FALSE)
|
||||
..(loc)
|
||||
icon_state = "[ismetal ? "m":""]foam"
|
||||
if(!ismetal && reagents)
|
||||
color = mix_color_from_reagents(reagents.reagent_list)
|
||||
metal = ismetal
|
||||
playsound(src, 'sound/effects/bubbles2.ogg', 80, 1, -3)
|
||||
spawn(3 + metal*3)
|
||||
playsound(src, 'sound/effects/bubbles2.ogg', 80, TRUE, -3)
|
||||
spawn(3 + metal * 3)
|
||||
process()
|
||||
spawn(120)
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
for(var/obj/item/Item in T)
|
||||
Item.extinguish()
|
||||
|
||||
/datum/effect_system/smoke_spread/freezing/set_up(amount = 5, only_cardinals = FALSE, source, desired_direction, blasting = 0)
|
||||
/datum/effect_system/smoke_spread/freezing/set_up(amount = 5, only_cardinals = FALSE, source, desired_direction, blasting = FALSE)
|
||||
..()
|
||||
blast = blasting
|
||||
|
||||
|
||||
@@ -85,7 +85,6 @@
|
||||
safety = old_safety
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/extinguisher/afterattack(atom/target, mob/user, flag)
|
||||
. = ..()
|
||||
//TODO; Add support for reagents in water.
|
||||
|
||||
@@ -230,10 +230,14 @@
|
||||
cooling_power = 5
|
||||
w_class = WEIGHT_CLASS_HUGE
|
||||
flags = NODROP //Necessary to ensure that the nozzle and tank never seperate
|
||||
/// A reference to the tank that this nozzle is linked to
|
||||
var/obj/item/watertank/tank
|
||||
var/nozzle_mode = 0
|
||||
/// What mode are we currently in?
|
||||
var/nozzle_mode = EXTINGUISHER
|
||||
/// Are we overusing the metal synthesizer? can be used 5 times in quick succession, regains 1 use per 10 seconds
|
||||
var/metal_synthesis_cooldown = 0
|
||||
var/nanofrost_cooldown = 0
|
||||
/// Is our nanofrost on cooldown?
|
||||
var/nanofrost_cooldown = FALSE
|
||||
|
||||
/obj/item/extinguisher/mini/nozzle/Initialize(mapload)
|
||||
if(!check_tank_exists(loc, src))
|
||||
@@ -253,29 +257,24 @@
|
||||
/obj/item/extinguisher/mini/nozzle/Move()
|
||||
..()
|
||||
if(tank && loc != tank.loc)
|
||||
loc = tank
|
||||
return
|
||||
forceMove(tank)
|
||||
|
||||
/obj/item/extinguisher/mini/nozzle/attack_self(mob/user as mob)
|
||||
/obj/item/extinguisher/mini/nozzle/attack_self(mob/user)
|
||||
switch(nozzle_mode)
|
||||
if(EXTINGUISHER)
|
||||
nozzle_mode = NANOFROST
|
||||
tank.icon_state = "waterbackpackatmos_1"
|
||||
to_chat(user, "Swapped to nanofrost launcher")
|
||||
return
|
||||
if(NANOFROST)
|
||||
nozzle_mode = METAL_FOAM
|
||||
tank.icon_state = "waterbackpackatmos_2"
|
||||
to_chat(user, "Swapped to metal foam synthesizer")
|
||||
return
|
||||
if(METAL_FOAM)
|
||||
nozzle_mode = EXTINGUISHER
|
||||
tank.icon_state = "waterbackpackatmos_0"
|
||||
to_chat(user, "Swapped to water extinguisher")
|
||||
return
|
||||
return
|
||||
|
||||
/obj/item/extinguisher/mini/nozzle/dropped(mob/user as mob)
|
||||
/obj/item/extinguisher/mini/nozzle/dropped(mob/user)
|
||||
..()
|
||||
to_chat(user, "<span class='notice'>The nozzle snaps back onto the tank!</span>")
|
||||
tank.on = FALSE
|
||||
@@ -288,42 +287,40 @@
|
||||
var/Adj = user.Adjacent(target)
|
||||
if(Adj)
|
||||
AttemptRefill(target, user)
|
||||
if(nozzle_mode == NANOFROST)
|
||||
if(Adj)
|
||||
return //Safety check so you don't blast yourself trying to refill your tank
|
||||
var/datum/reagents/R = reagents
|
||||
if(R.total_volume < 100)
|
||||
to_chat(user, "You need at least 100 units of water to use the nanofrost launcher!")
|
||||
return
|
||||
if(nanofrost_cooldown)
|
||||
to_chat(user, "Nanofrost launcher is still recharging")
|
||||
return
|
||||
nanofrost_cooldown = 1
|
||||
R.remove_any(100)
|
||||
var/obj/effect/nanofrost_container/A = new /obj/effect/nanofrost_container(get_turf(src))
|
||||
log_game("[key_name(user)] used Nanofrost at [get_area(user)] ([user.x], [user.y], [user.z]).")
|
||||
playsound(src,'sound/items/syringeproj.ogg',40,1)
|
||||
for(var/a=0, a<5, a++)
|
||||
step_towards(A, target)
|
||||
sleep(2)
|
||||
A.Smoke()
|
||||
spawn(100)
|
||||
if(src)
|
||||
nanofrost_cooldown = 0
|
||||
return
|
||||
if(nozzle_mode == METAL_FOAM)
|
||||
if(!Adj|| !isturf(target))
|
||||
return
|
||||
if(metal_synthesis_cooldown < 5)
|
||||
var/obj/effect/particle_effect/foam/F = new /obj/effect/particle_effect/foam(get_turf(target), 1)
|
||||
|
||||
switch(nozzle_mode)
|
||||
if(NANOFROST)
|
||||
if(Adj)
|
||||
return //Safety check so you don't blast yourself trying to refill your tank
|
||||
if(reagents.total_volume < 100)
|
||||
to_chat(user, "<span class='notice'>You need at least 100 units of water to use the nanofrost launcher!</span>")
|
||||
return
|
||||
if(nanofrost_cooldown)
|
||||
to_chat(user, "<span class='notice'>Nanofrost launcher is still recharging.</span>")
|
||||
return
|
||||
nanofrost_cooldown = TRUE
|
||||
reagents.remove_any(100)
|
||||
var/obj/effect/nanofrost_container/A = new /obj/effect/nanofrost_container(get_turf(src))
|
||||
log_game("[key_name(user)] used Nanofrost at [get_area(user)] ([user.x], [user.y], [user.z]).")
|
||||
playsound(src,'sound/items/syringeproj.ogg', 40, TRUE)
|
||||
for(var/a in 1 to 6)
|
||||
step_towards(A, target)
|
||||
sleep(2)
|
||||
A.Smoke()
|
||||
addtimer(VARSET_CALLBACK(src, nanofrost_cooldown, FALSE))
|
||||
if(METAL_FOAM)
|
||||
if(!Adj)
|
||||
return
|
||||
if(metal_synthesis_cooldown >= 5)
|
||||
to_chat(user, "<span class='notice'>Metal foam mix is still being synthesized.</span>")
|
||||
return
|
||||
var/obj/effect/particle_effect/foam/F = new /obj/effect/particle_effect/foam(get_turf(target), TRUE)
|
||||
F.amount = 0
|
||||
metal_synthesis_cooldown++
|
||||
spawn(100)
|
||||
if(src)
|
||||
metal_synthesis_cooldown--
|
||||
else
|
||||
to_chat(user, "Metal foam mix is still being synthesized.")
|
||||
return
|
||||
addtimer(CALLBACK(src, PROC_REF(metal_cooldown)), 10 SECONDS)
|
||||
|
||||
/obj/item/extinguisher/mini/nozzle/proc/metal_cooldown()
|
||||
metal_synthesis_cooldown--
|
||||
|
||||
/obj/effect/nanofrost_container
|
||||
name = "nanofrost container"
|
||||
@@ -335,13 +332,10 @@
|
||||
|
||||
/obj/effect/nanofrost_container/proc/Smoke()
|
||||
var/datum/effect_system/smoke_spread/freezing/S = new
|
||||
S.set_up(6, FALSE, loc, null, 1)
|
||||
S.set_up(6, FALSE, loc, null, TRUE)
|
||||
S.start()
|
||||
var/obj/effect/decal/cleanable/flour/F = new /obj/effect/decal/cleanable/flour(src.loc)
|
||||
F.color = "#B2FFFF"
|
||||
F.name = "nanofrost residue"
|
||||
F.desc = "Residue left behind from a nanofrost detonation. Perhaps there was a fire here?"
|
||||
playsound(src,'sound/effects/bamf.ogg',100,1)
|
||||
new /obj/effect/decal/cleanable/flour/nanofrost(get_turf(src))
|
||||
playsound(src, 'sound/effects/bamf.ogg', 100, TRUE)
|
||||
qdel(src)
|
||||
|
||||
#undef EXTINGUISHER
|
||||
|
||||
@@ -55,18 +55,18 @@
|
||||
//Puts the item into your l_hand if possible and calls all necessary triggers/updates. returns 1 on success.
|
||||
/mob/proc/put_in_l_hand(obj/item/W, skip_blocked_hands_check = FALSE)
|
||||
if(!put_in_hand_check(W, skip_blocked_hands_check))
|
||||
return 0
|
||||
return FALSE
|
||||
if(!l_hand && has_left_hand())
|
||||
W.forceMove(src) //TODO: move to equipped?
|
||||
l_hand = W
|
||||
W.layer = ABOVE_HUD_LAYER //TODO: move to equipped?
|
||||
W.plane = ABOVE_HUD_PLANE //TODO: move to equipped?
|
||||
W.equipped(src,SLOT_HUD_LEFT_HAND)
|
||||
W.equipped(src, SLOT_HUD_LEFT_HAND)
|
||||
if(pulling == W)
|
||||
stop_pulling()
|
||||
update_inv_l_hand()
|
||||
return 1
|
||||
return 0
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
//Puts the item into your r_hand if possible and calls all necessary triggers/updates. returns 1 on success.
|
||||
/mob/proc/put_in_r_hand(obj/item/W, skip_blocked_hands_check = FALSE)
|
||||
@@ -96,8 +96,10 @@
|
||||
|
||||
//Puts the item into our active hand if possible. returns 1 on success.
|
||||
/mob/proc/put_in_active_hand(obj/item/W)
|
||||
if(hand) return put_in_l_hand(W)
|
||||
else return put_in_r_hand(W)
|
||||
if(hand)
|
||||
return put_in_l_hand(W)
|
||||
else
|
||||
return put_in_r_hand(W)
|
||||
|
||||
//Puts the item into our inactive hand if possible. returns 1 on success.
|
||||
/mob/proc/put_in_inactive_hand(obj/item/W)
|
||||
|
||||
Reference in New Issue
Block a user