mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 08:08:49 +01:00
Code improvement v1
This commit is contained in:
@@ -13,18 +13,17 @@
|
||||
|
||||
resistance_flags = FIRE_PROOF
|
||||
|
||||
var/obj/item/tank = null
|
||||
/// The stored tank. If this is a path, it gets created into contents at Initialize.
|
||||
var/obj/item/tank
|
||||
|
||||
/obj/structure/tank_holder/Initialize()
|
||||
. = ..()
|
||||
if(tank)
|
||||
density = TRUE
|
||||
tank = new tank(src)
|
||||
after_put_tank(new tank)
|
||||
|
||||
/obj/structure/tank_holder/Destroy()
|
||||
if(tank)
|
||||
tank.forceMove(get_turf(src))
|
||||
tank = null
|
||||
QDEL_NULL(tank)
|
||||
return ..()
|
||||
|
||||
/obj/structure/tank_holder/CanAllowThrough(atom/movable/mover, turf/target)
|
||||
@@ -32,26 +31,24 @@
|
||||
if(istype(mover) && mover.throwing)
|
||||
return TRUE
|
||||
|
||||
/obj/structure/closet/examine(mob/user)
|
||||
/obj/structure/tank_holder/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>It is held together by some <b>screws</b>.</span>"
|
||||
|
||||
/obj/structure/tank_holder/attackby(obj/item/W, mob/user, params)
|
||||
if(user.a_intent == INTENT_HARM)
|
||||
return ..()
|
||||
if(contents.len != 0)
|
||||
to_chat(user, "<span class='warning'>There's already something in \the [src].</span>")
|
||||
if(contents.len)
|
||||
to_chat(user, "<span class='warning'>There's already something in [src].</span>")
|
||||
return
|
||||
|
||||
if(!W.tank_holder_icon_state)
|
||||
to_chat(user, "<span class='warning'>\The [W] does not fit in \the [src].</span>")
|
||||
to_chat(user, "<span class='warning'>[W] does not fit in [src].</span>")
|
||||
return
|
||||
|
||||
if(!user.transferItemToLoc(W, src))
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You put \the [W] into \the [src].</span>")
|
||||
if(!user.transferItemToLoc(W, src))
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You put [W] into [src].</span>")
|
||||
after_put_tank(W)
|
||||
|
||||
/obj/structure/tank_holder/screwdriver_act(mob/living/user, obj/item/I)
|
||||
@@ -63,8 +60,11 @@
|
||||
deconstruct(TRUE)
|
||||
return TRUE
|
||||
|
||||
/obj/structure/table_frame/deconstruct(disassembled = TRUE)
|
||||
/obj/structure/tank_holder/deconstruct(disassembled = TRUE)
|
||||
new /obj/item/stack/rods(get_turf(src), 2)
|
||||
if(tank)
|
||||
tank.forceMove(get_turf(src))
|
||||
tank = null
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/tank_holder/attack_paw(mob/user)
|
||||
@@ -73,16 +73,31 @@
|
||||
/obj/structure/tank_holder/attack_hand(mob/user)
|
||||
if(!tank)
|
||||
return ..()
|
||||
to_chat(user, "<span class='notice'>You take \the [tank] from \the [src].</span>")
|
||||
if(!Adjacent(user) || issilicon(user))
|
||||
return ..()
|
||||
to_chat(user, "<span class='notice'>You take [tank] from [src].</span>")
|
||||
add_fingerprint(user)
|
||||
user.put_in_hands(tank)
|
||||
after_remove_tank()
|
||||
|
||||
/obj/structure/tank_holder/proc/after_put_tank(obj/item/tank)
|
||||
tank = tank
|
||||
/obj/structure/tank_holder/handle_atom_del(atom/A)
|
||||
if(A == tank)
|
||||
after_remove_tank()
|
||||
return ..()
|
||||
|
||||
/obj/structure/tank_holder/contents_explosion(severity, target)
|
||||
if(tank)
|
||||
tank.ex_act(severity, target)
|
||||
|
||||
/// Call this after inserting the tank into contents in order to update references, icon
|
||||
/// and density.
|
||||
/obj/structure/tank_holder/proc/after_put_tank(obj/item/tank_)
|
||||
tank = tank_
|
||||
icon_state = tank.tank_holder_icon_state
|
||||
density = TRUE
|
||||
|
||||
/// Call this after taking the tank from contents in order to update references, icon
|
||||
/// and density.
|
||||
/obj/structure/tank_holder/proc/after_remove_tank()
|
||||
tank = null
|
||||
icon_state = "holder"
|
||||
@@ -90,45 +105,36 @@
|
||||
|
||||
/obj/structure/tank_holder/oxygen
|
||||
icon_state = "holder_oxygen"
|
||||
density = TRUE
|
||||
tank = /obj/item/tank/internals/oxygen
|
||||
|
||||
/obj/structure/tank_holder/anesthetic
|
||||
icon_state = "holder_anesthetic"
|
||||
density = TRUE
|
||||
tank = /obj/item/tank/internals/anesthetic
|
||||
|
||||
/obj/structure/tank_holder/oxygen/yellow
|
||||
icon_state = "holder_oxygen_f"
|
||||
density = TRUE
|
||||
tank = /obj/item/tank/internals/oxygen/yellow
|
||||
|
||||
/obj/structure/tank_holder/oxygen/red
|
||||
icon_state = "holder_oxygen_fr"
|
||||
density = TRUE
|
||||
tank = /obj/item/tank/internals/oxygen/red
|
||||
|
||||
/obj/structure/tank_holder/emergency_oxygen
|
||||
icon_state = "holder_emergency"
|
||||
density = TRUE
|
||||
tank = /obj/item/tank/internals/emergency_oxygen
|
||||
|
||||
/obj/structure/tank_holder/emergency_oxygen/engi
|
||||
icon_state = "holder_emergency_engi"
|
||||
density = TRUE
|
||||
tank = /obj/item/tank/internals/emergency_oxygen/engi
|
||||
|
||||
/obj/structure/tank_holder/generic
|
||||
icon_state = "holder_generic"
|
||||
density = TRUE
|
||||
tank = /obj/item/tank/internals/generic
|
||||
|
||||
/obj/structure/tank_holder/extinguisher
|
||||
icon_state = "holder_extinguisher"
|
||||
density = TRUE
|
||||
tank = /obj/item/extinguisher
|
||||
|
||||
/obj/structure/tank_holder/extinguisher/advanced
|
||||
icon_state = "holder_foam_extinguisher"
|
||||
density = TRUE
|
||||
tank = /obj/item/extinguisher/advanced
|
||||
|
||||
Reference in New Issue
Block a user