Standardizes object deconstruction throughout the codebase. (#82280)

## About The Pull Request
When it comes to deconstructing an object we have `proc/deconstruct()` &
`NO_DECONSTRUCT`

Lets talk about the flag first. 

**Problems with `NO_DECONSTRUCTION`**
I know what the comment says on what it should do

https://github.com/tgstation/tgstation/blob/b5593bc6930cb60803214869a7b94c84e7baa02c/code/__DEFINES/obj_flags.dm#L18

But everywhere people have decided to give their own meaning/definition
to this flag. Here are some examples on how this flag is used

**1. Make the object just disappear(not drop anything) when
deconstructed**
This is by far the largest use case everywhere. If an object is
deconstructed(either via tools or smashed apart) then if it has this
flag it should not drop any of its contents but just disappear. You have
seen this code pattern used everywhere

https://github.com/tgstation/tgstation/blob/b5593bc6930cb60803214869a7b94c84e7baa02c/code/game/machinery/constructable_frame.dm#L26-L31

This behaviour is then leveraged by 2 important components.

When an object is frozen, if it is deconstructed it should just
disappear without leaving any traces behind

https://github.com/tgstation/tgstation/blob/b5593bc6930cb60803214869a7b94c84e7baa02c/code/datums/elements/frozen.dm#L66-L67

By hologram objects. Obviously if you destroy an hologram nothing real
should drop out

https://github.com/tgstation/tgstation/blob/b5593bc6930cb60803214869a7b94c84e7baa02c/code/modules/holodeck/computer.dm#L301-L304

And there are other use cases as well but we won't go into them as they
aren't as significant as these.

**2. To stop an object from being wrenched ??**
Yeah this one is weird. Like why? I understand in some instances (chair,
table, rack etc) a wrench can be used to deconstruct a object so using
the flag there to stop it from happening makes sense but why can't we
even anchor an object just because of this flag?

https://github.com/tgstation/tgstation/blob/b5593bc6930cb60803214869a7b94c84e7baa02c/code/game/objects/objs.dm#L368-L369
This is one of those instances where somebody just decided this
behaviour for their own convenience just like the above example with no
explanation as to why

**3. To stop using tools to deconstruct the object** 
This was the original intent of the flag but it is enforced in few
places far & between. One example is when deconstructing the a machine
via crowbar.

https://github.com/tgstation/tgstation/blob/b5593bc6930cb60803214869a7b94c84e7baa02c/code/game/machinery/_machinery.dm#L811

But machines are a special dual use case for this flag. Because if you
look at its deconstruct proc the flag also prevents the machine from
spawning a frame.

https://github.com/tgstation/tgstation/blob/b5593bc6930cb60803214869a7b94c84e7baa02c/code/game/machinery/_machinery.dm#L820-L822

How can 1 flag serve 2 purposes within the same type?

**4. Simply forget to check for this flag altogether**
Yup if you find this flag not doing its job for some objects don't be
surprised. People & sometimes even maintainers just forget that it even
exists

https://github.com/tgstation/tgstation/blob/b5593bc6930cb60803214869a7b94c84e7baa02c/code/game/objects/items/piggy_bank.dm#L66-L67

**Solution**
These are the main examples i found. As you can see the same flag can
perform 2 different functions within the same type and do something else
in a different object & in some instances don't even work cause people
just forget, etc.

In order to bring consistency to this flag we need to move it to the
atom level where it means the same thing everywhere. Where in the atom
you may ask? .Well, I'll just post what MrMelbert said in
https://github.com/tgstation/tgstation/pull/81656#discussion_r1503086862

> ...Ideally the .deconstruct call would handle NO_DECONSTRUCTION
handling as it wants,

Yup that's the ideal case now. This flag is checked directly in
`deconstruct()`. Now like i said we want to give a universal definition
to this flag and as you have seen from my examples it is used in 3 cases
1) Make an object disappear(doesn't dropping anything) when
deconstructed
2) Stop it from being wrenched
3) Stop it from being deconstructed via tools

We can't enforce points 2 & 3 inside `deconstruct()` which leaves us
with only case 1) i.e. make the object disappear. And that's what i have
done. Therefore after more than a decade or since this flag got
introduced `NO_DECONSTRUCT` now has a new definition as of 2024

_"Make an object disappear(don't dropping anything) when deconstructed
either via tools or forcefully smashed apart"_

Now i very well understand this will open up bugs in places where cases
2 & 3 are required but its worth it. In fact they could even be qol
changes for all we know so who knows it might even benefit us but for
now we need to give a universal definition to this flag to bring some
consistency & that's what this PR does.

**Problem with deconstruct()**
This proc actually sends out a signal which is currently used by the
material container but could be used by other objects later on.

https://github.com/tgstation/tgstation/blob/3e84c3e6dad33c831ac259f52f2f023680e4899b/code/game/objects/obj_defense.dm#L160

So objects that override this proc should call its parent. Sadly that
isn't the case in many instances like such

https://github.com/tgstation/tgstation/blob/3e84c3e6dad33c831ac259f52f2f023680e4899b/code/game/machinery/deployable.dm#L20-L23

Instead of `return ..()` which would delete the object & send the signal
it deletes the object directly thus the signal never gets sent.

**Solution**
Make this proc non overridable. For objects to add their own custom
deconstruction behaviour a new proc has been introduced
`atom_deconstruct()` Subtypes should now override this proc to handle
object deconstruction.

If objects have certain important stuff inside them (like mobs in
machines for example) they want to drop by handling `NO_DECONSTRUCT`
flag in a more carefully customized way they can do this by overriding
`handle_deconstruct()` which by default delegates to
`atom_deconstruct()` if the `NO_DECONSTRUCT` flag is absent. This proc
will allow you to handle the flag in a more customized way if you ever
need to.

## Why It's Good For The Game
1) I'm goanna post the full comment from MrMelbert
https://github.com/tgstation/tgstation/pull/81656#discussion_r1503086862

> ...Ideally the .deconstruct call would handle NO_DECONSTRUCTION
handling as it wants, but there's a shocking lack of consistency around
NO_DECONSTRUCTION, where some objects treat it as "allow deconstruction,
but make it drop no parts" and others simply "disallow deconstruction at
all"

This PR now makes `NO_DECONSTRUCTION` handled by `deconstruct()` & gives
this flag the consistency it deserves. Not to mention as shown in case 4
there are objects that simply forgot to check for this flag. Now it
applies for those missing instances as well.

2) No more copying pasting the most overused code pattern in this code
base history `if(obj_flags & NO_DECONSTRUCTION)`. Just makes code
cleaner everywhere

3) All objects now send the `COMSIG_OBJ_DECONSTRUCT` signal on object
deconstruction which is now available for use should you need it

## Changelog
🆑
refactor: refactors how objects are deconstructed in relation to the
`NO_DECONSTRUCTION` flag. Certain objects & machinery may display
different tool interactions & behaviours when destroyed/deconstructed.
Report these changes if you feel like they are bugs
/🆑

---------

Co-authored-by: san7890 <the@san7890.com>
This commit is contained in:
SyncIt21
2024-04-04 18:55:51 -06:00
committed by GitHub
co-authored by san7890
parent ec991f8c1d
commit 6dc40ca522
106 changed files with 488 additions and 662 deletions
+1 -2
View File
@@ -380,7 +380,7 @@
icon_state = "ai-empty"
return ..()
/obj/structure/ai_core/deconstruct(disassembled = TRUE)
/obj/structure/ai_core/atom_deconstruct(disassembled = TRUE)
if(state >= GLASS_CORE)
new /obj/item/stack/sheet/rglass(loc, 2)
if(state >= CABLED_CORE)
@@ -389,7 +389,6 @@
circuit.forceMove(loc)
circuit = null
new /obj/item/stack/sheet/plasteel(loc, 4)
qdel(src)
/// Quick proc to call to see if the brainmob inside of us has suicided. Returns TRUE if we have, FALSE in any other scenario.
/obj/structure/ai_core/proc/suicide_check()
+4 -7
View File
@@ -41,10 +41,8 @@
icon = 'icons/obj/fluff/general.dmi'
icon_state = "gelmound"
/obj/structure/alien/gelpod/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
new /obj/effect/mob_spawn/corpse/human/damaged(get_turf(src))
qdel(src)
/obj/structure/alien/gelpod/atom_deconstruct(disassembled = TRUE)
new /obj/effect/mob_spawn/corpse/human/damaged(get_turf(src))
/*
* Resin
@@ -446,9 +444,8 @@
/obj/structure/alien/egg/atom_break(damage_flag)
. = ..()
if(!(obj_flags & NO_DECONSTRUCTION))
if(status != BURST)
Burst(kill=TRUE)
if(status != BURST)
Burst(kill=TRUE)
/obj/structure/alien/egg/HasProximity(atom/movable/AM)
if(status == GROWN)
@@ -12,10 +12,18 @@
smoothing_groups = SMOOTH_GROUP_ALIEN_NEST
canSmoothWith = SMOOTH_GROUP_ALIEN_NEST
build_stack_type = null
obj_flags = parent_type::obj_flags | NO_DECONSTRUCTION
elevation = 0
var/static/mutable_appearance/nest_overlay = mutable_appearance('icons/mob/nonhuman-player/alien.dmi', "nestoverlay", LYING_MOB_LAYER)
/obj/structure/bed/nest/add_context(atom/source, list/context, obj/item/held_item, mob/living/user)
if(held_item?.tool_behaviour == TOOL_WRENCH)
return NONE
return ..()
/obj/structure/bed/nest/wrench_act_secondary(mob/living/user, obj/item/weapon)
return ITEM_INTERACT_BLOCKING
/obj/structure/bed/nest/user_unbuckle_mob(mob/living/buckled_mob, mob/living/user)
if(has_buckled_mobs())
for(var/buck in buckled_mobs) //breaking a nest releases all the buckled mobs, because the nest isn't holding them down anymore
@@ -34,12 +34,11 @@
/obj/structure/bed/examine(mob/user)
. = ..()
if(!(obj_flags & NO_DECONSTRUCTION))
. += span_notice("It's held together by a couple of <b>bolts</b>.")
. += span_notice("It's held together by a couple of <b>bolts</b>.")
/obj/structure/bed/add_context(atom/source, list/context, obj/item/held_item, mob/living/user)
if(held_item)
if(held_item.tool_behaviour != TOOL_WRENCH || obj_flags & NO_DECONSTRUCTION)
if(held_item.tool_behaviour != TOOL_WRENCH)
return
context[SCREENTIP_CONTEXT_RMB] = "Dismantle"
@@ -49,19 +48,14 @@
context[SCREENTIP_CONTEXT_LMB] = "Unbuckle"
return CONTEXTUAL_SCREENTIP_SET
/obj/structure/bed/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
if(build_stack_type)
new build_stack_type(loc, build_stack_amount)
..()
/obj/structure/bed/atom_deconstruct(disassembled = TRUE)
if(build_stack_type)
new build_stack_type(loc, build_stack_amount)
/obj/structure/bed/attack_paw(mob/user, list/modifiers)
return attack_hand(user, modifiers)
/obj/structure/bed/wrench_act_secondary(mob/living/user, obj/item/weapon)
if(obj_flags & NO_DECONSTRUCTION)
return TRUE
..()
weapon.play_tool_sound(src)
deconstruct(disassembled = TRUE)
@@ -36,16 +36,12 @@
SSjob.latejoin_trackers -= src //These may be here due to the arrivals shuttle
return ..()
/obj/structure/chair/deconstruct(disassembled)
// If we have materials, and don't have the NOCONSTRUCT flag
if(!(obj_flags & NO_DECONSTRUCTION))
if(buildstacktype)
new buildstacktype(loc,buildstackamount)
else
for(var/i in custom_materials)
var/datum/material/M = i
new M.sheet_type(loc, FLOOR(custom_materials[M] / SHEET_MATERIAL_AMOUNT, 1))
..()
/obj/structure/chair/atom_deconstruct(disassembled)
if(buildstacktype)
new buildstacktype(loc,buildstackamount)
else
for(var/datum/material/mat as anything in custom_materials)
new mat.sheet_type(loc, FLOOR(custom_materials[mat] / SHEET_MATERIAL_AMOUNT, 1))
/obj/structure/chair/attack_paw(mob/user, list/modifiers)
return attack_hand(user, modifiers)
@@ -56,8 +52,6 @@
qdel(src)
/obj/structure/chair/attackby(obj/item/W, mob/user, params)
if(obj_flags & NO_DECONSTRUCTION)
return . = ..()
if(istype(W, /obj/item/assembly/shock_kit) && !HAS_TRAIT(src, TRAIT_ELECTRIFIED_BUCKLE))
electrify_self(W, user)
return
@@ -85,8 +79,6 @@
/obj/structure/chair/wrench_act_secondary(mob/living/user, obj/item/weapon)
if(obj_flags & NO_DECONSTRUCTION)
return TRUE
..()
weapon.play_tool_sound(src)
deconstruct(disassembled = TRUE)
@@ -274,7 +266,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/chair/stool, 0)
/obj/structure/chair/MouseDrop(over_object, src_location, over_location)
. = ..()
if(over_object == usr && Adjacent(usr))
if(!item_chair || has_buckled_mobs() || src.obj_flags & NO_DECONSTRUCTION)
if(!item_chair || has_buckled_mobs())
return
if(!usr.can_perform_action(src, NEED_DEXTERITY|NEED_HANDS))
return
@@ -490,6 +482,9 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/chair/stool/bar, 0)
obj_flags = parent_type::obj_flags | NO_DECONSTRUCTION
alpha = 0
/obj/structure/chair/mime/wrench_act_secondary(mob/living/user, obj/item/weapon)
return ITEM_INTERACT_BLOCKING
/obj/structure/chair/mime/post_buckle_mob(mob/living/M)
M.pixel_y += 5
@@ -609,8 +609,6 @@ LINEN BINS
..()
/obj/structure/bedsheetbin/screwdriver_act(mob/living/user, obj/item/tool)
if(obj_flags & NO_DECONSTRUCTION)
return FALSE
if(amount)
to_chat(user, span_warning("The [src] must be empty first!"))
return ITEM_INTERACT_SUCCESS
@@ -581,25 +581,23 @@ GLOBAL_LIST_EMPTY(roundstart_station_closets)
else
return open(user)
/obj/structure/closet/deconstruct(disassembled = TRUE)
if (!(obj_flags & NO_DECONSTRUCTION))
if(ispath(material_drop) && material_drop_amount)
new material_drop(loc, material_drop_amount)
if (secure)
var/obj/item/electronics/airlock/electronics = new(drop_location())
if(length(req_one_access))
electronics.one_access = TRUE
electronics.accesses = req_one_access
else
electronics.accesses = req_access
if(card_reader_installed)
new /obj/item/stock_parts/card_reader(drop_location())
/obj/structure/closet/atom_deconstruct(disassembled = TRUE)
if(ispath(material_drop) && material_drop_amount)
new material_drop(loc, material_drop_amount)
if (secure)
var/obj/item/electronics/airlock/electronics = new(drop_location())
if(length(req_one_access))
electronics.one_access = TRUE
electronics.accesses = req_one_access
else
electronics.accesses = req_access
if(card_reader_installed)
new /obj/item/stock_parts/card_reader(drop_location())
dump_contents()
qdel(src)
/obj/structure/closet/atom_break(damage_flag)
. = ..()
if(!broken && !(obj_flags & NO_DECONSTRUCTION))
if(!broken)
bust_open()
/obj/structure/closet/CheckParts(list/parts_list)
@@ -36,10 +36,8 @@
flags_1 &= ~PREVENT_CONTENTS_EXPLOSION_1
return FALSE
/obj/structure/closet/secure_closet/freezer/deconstruct(disassembled)
if (!(obj_flags & NO_DECONSTRUCTION))
new /obj/item/assembly/igniter/condenser(drop_location())
. = ..()
/obj/structure/closet/secure_closet/freezer/atom_deconstruct(disassembled)
new /obj/item/assembly/igniter/condenser(drop_location())
/obj/structure/closet/secure_closet/freezer/empty
name = "freezer"
@@ -4,16 +4,13 @@
var/break_sound = 'sound/magic/clockwork/invoke_general.ogg' //The sound played when a structure breaks
var/list/debris = null //Parts left behind when a structure breaks, takes the form of list(path = amount_to_spawn)
/obj/structure/destructible/deconstruct(disassembled = TRUE)
/obj/structure/destructible/atom_deconstruct(disassembled = TRUE)
if(!disassembled)
if(!(obj_flags & NO_DECONSTRUCTION))
if(islist(debris))
for(var/I in debris)
for(var/i in 1 to debris[I])
new I (get_turf(src))
if(break_message)
visible_message(break_message)
if(break_sound)
playsound(src, break_sound, 50, TRUE)
qdel(src)
return 1
if(islist(debris))
for(var/I in debris)
for(var/i in 1 to debris[I])
new I (get_turf(src))
if(break_message)
visible_message(break_message)
if(break_sound)
playsound(src, break_sound, 50, TRUE)
+7 -9
View File
@@ -81,17 +81,15 @@
if(BURN)
playsound(src, 'sound/items/welder.ogg', 100, TRUE)
/obj/structure/displaycase/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
dump()
if(!disassembled)
new /obj/item/shard(drop_location())
trigger_alarm()
qdel(src)
/obj/structure/displaycase/atom_deconstruct(disassembled = TRUE)
dump()
if(!disassembled)
new /obj/item/shard(drop_location())
trigger_alarm()
/obj/structure/displaycase/atom_break(damage_flag)
. = ..()
if(!broken && !(obj_flags & NO_DECONSTRUCTION))
if(!broken)
set_density(FALSE)
broken = TRUE
new /obj/item/shard(drop_location())
@@ -673,7 +671,7 @@
/obj/structure/displaycase/forsale/atom_break(damage_flag)
. = ..()
if(!broken && !(obj_flags & NO_DECONSTRUCTION))
if(!broken)
broken = TRUE
playsound(src, SFX_SHATTER, 70, TRUE)
update_appearance()
+15 -18
View File
@@ -363,25 +363,22 @@
target.update_name()
qdel(source)
/obj/structure/door_assembly/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
var/turf/T = get_turf(src)
if(!disassembled)
material_amt = rand(2,4)
new material_type(T, material_amt)
if(glass)
if(disassembled)
if(heat_proof_finished)
new /obj/item/stack/sheet/rglass(T)
else
new /obj/item/stack/sheet/glass(T)
/obj/structure/door_assembly/atom_deconstruct(disassembled = TRUE)
var/turf/target_turf = get_turf(src)
if(!disassembled)
material_amt = rand(2,4)
new material_type(target_turf, material_amt)
if(glass)
if(disassembled)
if(heat_proof_finished)
new /obj/item/stack/sheet/rglass(target_turf)
else
new /obj/item/shard(T)
if(mineral)
var/obj/item/stack/sheet/mineral/mineral_path = text2path("/obj/item/stack/sheet/mineral/[mineral]")
new mineral_path(T, 2)
qdel(src)
new /obj/item/stack/sheet/glass(target_turf)
else
new /obj/item/shard(target_turf)
if(mineral)
var/obj/item/stack/sheet/mineral/mineral_path = text2path("/obj/item/stack/sheet/mineral/[mineral]")
new mineral_path(target_turf, 2)
/obj/structure/door_assembly/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd)
if(the_rcd.mode == RCD_DECONSTRUCT)
@@ -271,24 +271,21 @@
name = "large public airlock assembly"
base_name = "large public airlock"
/obj/structure/door_assembly/door_assembly_material/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
var/turf/T = get_turf(src)
for(var/material in custom_materials)
var/datum/material/material_datum = material
var/material_count = FLOOR(custom_materials[material_datum] / SHEET_MATERIAL_AMOUNT, 1)
if(!disassembled)
material_count = rand(FLOOR(material_count/2, 1), material_count)
new material_datum.sheet_type(T, material_count)
if(glass)
if(disassembled)
if(heat_proof_finished)
new /obj/item/stack/sheet/rglass(T)
else
new /obj/item/stack/sheet/glass(T)
/obj/structure/door_assembly/door_assembly_material/atom_deconstruct(disassembled = TRUE)
var/turf/target_turf = get_turf(src)
for(var/datum/material/material_datum as anything in custom_materials)
var/material_count = FLOOR(custom_materials[material_datum] / SHEET_MATERIAL_AMOUNT, 1)
if(!disassembled)
material_count = rand(FLOOR(material_count/2, 1), material_count)
new material_datum.sheet_type(target_turf, material_count)
if(glass)
if(disassembled)
if(heat_proof_finished)
new /obj/item/stack/sheet/rglass(target_turf)
else
new /obj/item/shard(T)
qdel(src)
new /obj/item/stack/sheet/glass(target_turf)
else
new /obj/item/shard(target_turf)
/obj/structure/door_assembly/door_assembly_material/finish_door()
var/obj/machinery/door/airlock/door = ..()
+2 -4
View File
@@ -16,10 +16,8 @@
else
return ..()
/obj/structure/dresser/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
new /obj/item/stack/sheet/mineral/wood(drop_location(), 10)
qdel(src)
/obj/structure/dresser/atom_deconstruct(disassembled = TRUE)
new /obj/item/stack/sheet/mineral/wood(drop_location(), 10)
/obj/structure/dresser/attack_hand(mob/user, list/modifiers)
. = ..()
+9 -11
View File
@@ -160,7 +160,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/extinguisher_cabinet, 29)
/obj/structure/extinguisher_cabinet/atom_break(damage_flag)
. = ..()
if(!broken && !(obj_flags & NO_DECONSTRUCTION))
if(!broken)
broken = 1
opened = 1
if(stored_extinguisher)
@@ -169,16 +169,14 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/extinguisher_cabinet, 29)
update_appearance(UPDATE_ICON)
/obj/structure/extinguisher_cabinet/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
if(disassembled)
new /obj/item/wallframe/extinguisher_cabinet(loc)
else
new /obj/item/stack/sheet/iron (loc, 2)
if(stored_extinguisher)
stored_extinguisher.forceMove(loc)
stored_extinguisher = null
qdel(src)
/obj/structure/extinguisher_cabinet/atom_deconstruct(disassembled = TRUE)
if(disassembled)
new /obj/item/wallframe/extinguisher_cabinet(loc)
else
new /obj/item/stack/sheet/iron (loc, 2)
if(stored_extinguisher)
stored_extinguisher.forceMove(loc)
stored_extinguisher = null
/obj/item/wallframe/extinguisher_cabinet
name = "extinguisher cabinet frame"
+12 -16
View File
@@ -133,14 +133,12 @@
playsound(src, 'sound/items/welder.ogg', 100, TRUE)
deconstruct(disassembled)
/obj/structure/falsewall/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
if(disassembled)
new girder_type(loc)
if(mineral_amount)
for(var/i in 1 to mineral_amount)
new mineral(loc)
qdel(src)
/obj/structure/falsewall/atom_deconstruct(disassembled = TRUE)
if(disassembled)
new girder_type(loc)
if(mineral_amount)
for(var/i in 1 to mineral_amount)
new mineral(loc)
/obj/structure/falsewall/get_dumping_location()
return null
@@ -387,14 +385,12 @@
canSmoothWith = SMOOTH_GROUP_MATERIAL_WALLS
material_flags = MATERIAL_EFFECTS | MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS
/obj/structure/falsewall/material/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
if(disassembled)
new girder_type(loc)
for(var/material in custom_materials)
var/datum/material/material_datum = material
new material_datum.sheet_type(loc, FLOOR(custom_materials[material_datum] / SHEET_MATERIAL_AMOUNT, 1))
qdel(src)
/obj/structure/falsewall/material/atom_deconstruct(disassembled = TRUE)
if(disassembled)
new girder_type(loc)
for(var/material in custom_materials)
var/datum/material/material_datum = material
new material_datum.sheet_type(loc, FLOOR(custom_materials[material_datum] / SHEET_MATERIAL_AMOUNT, 1))
/obj/structure/falsewall/material/mat_update_desc(mat)
desc = "A huge chunk of [mat] used to separate rooms."
+4 -10
View File
@@ -10,21 +10,15 @@
var/buildstackamount = 5
can_atmos_pass = ATMOS_PASS_NO
/obj/structure/fans/deconstruct()
if(!(obj_flags & NO_DECONSTRUCTION))
if(buildstacktype)
new buildstacktype(loc,buildstackamount)
qdel(src)
/obj/structure/fans/atom_deconstruct(disassembled = TRUE)
if(buildstacktype)
new buildstacktype(loc,buildstackamount)
/obj/structure/fans/wrench_act(mob/living/user, obj/item/I)
..()
if(obj_flags & NO_DECONSTRUCTION)
return TRUE
user.visible_message(span_warning("[user] disassembles [src]."),
span_notice("You start to disassemble [src]..."), span_hear("You hear clanking and banging noises."))
if(I.use_tool(src, user, 20, volume=50))
deconstruct()
deconstruct(TRUE)
return TRUE
/obj/structure/fans/tiny
+9 -13
View File
@@ -108,19 +108,17 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/fireaxecabinet, 32)
/obj/structure/fireaxecabinet/atom_break(damage_flag)
. = ..()
if(!broken && !(obj_flags & NO_DECONSTRUCTION))
if(!broken)
update_appearance()
broken = TRUE
playsound(src, 'sound/effects/glassbr3.ogg', 100, TRUE)
new /obj/item/shard(loc)
new /obj/item/shard(loc)
/obj/structure/fireaxecabinet/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
if(held_item && loc)
held_item.forceMove(loc)
new /obj/item/wallframe/fireaxecabinet(loc)
qdel(src)
/obj/structure/fireaxecabinet/atom_deconstruct(disassembled = TRUE)
if(held_item && loc)
held_item.forceMove(loc)
new /obj/item/wallframe/fireaxecabinet(loc)
/obj/structure/fireaxecabinet/blob_act(obj/structure/blob/B)
if(held_item)
@@ -230,12 +228,10 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/fireaxecabinet/empty, 32)
MAPPING_DIRECTIONAL_HELPERS(/obj/structure/fireaxecabinet/mechremoval, 32)
/obj/structure/fireaxecabinet/mechremoval/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
if(held_item && loc)
held_item.forceMove(loc)
new /obj/item/wallframe/fireaxecabinet/mechremoval(loc)
qdel(src)
/obj/structure/fireaxecabinet/mechremoval/atom_deconstruct(disassembled = TRUE)
if(held_item && loc)
held_item.forceMove(loc)
new /obj/item/wallframe/fireaxecabinet/mechremoval(loc)
/obj/structure/fireaxecabinet/mechremoval/empty
populate_contents = FALSE
+4 -6
View File
@@ -263,13 +263,11 @@
var/matrix/M = matrix(transform)
transform = M.Turn(-previous_rotation)
/obj/structure/flora/deconstruct()
if(!(obj_flags & NO_DECONSTRUCTION))
if(harvested)
return ..()
/obj/structure/flora/atom_deconstruct(disassembled = TRUE)
if(harvested)
return ..()
harvest(product_amount_multiplier = 0.6)
. = ..()
harvest(product_amount_multiplier = 0.6)
/*********
* Trees *
+5 -9
View File
@@ -384,11 +384,9 @@
return TRUE
return FALSE
/obj/structure/girder/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
var/remains = pick(/obj/item/stack/rods, /obj/item/stack/sheet/iron)
new remains(loc)
qdel(src)
/obj/structure/girder/atom_deconstruct(disassembled = TRUE)
var/remains = pick(/obj/item/stack/rods, /obj/item/stack/sheet/iron)
new remains(loc)
/obj/structure/girder/narsie_act()
new /obj/structure/girder/cult(loc)
@@ -461,10 +459,8 @@
/obj/structure/girder/cult/narsie_act()
return
/obj/structure/girder/cult/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
new /obj/item/stack/sheet/runed_metal(drop_location(), 1)
qdel(src)
/obj/structure/girder/cult/atom_deconstruct(disassembled = TRUE)
new /obj/item/stack/sheet/runed_metal(drop_location(), 1)
/obj/structure/girder/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd)
switch(the_rcd.mode)
+5 -16
View File
@@ -52,8 +52,6 @@
/obj/structure/grille/examine(mob/user)
. = ..()
if(obj_flags & NO_DECONSTRUCTION)
return
if(anchored)
. += span_notice("It's secured in place with <b>screws</b>. The rods look like they could be <b>cut</b> through.")
@@ -200,10 +198,8 @@
add_fingerprint(user)
if(shock(user, 100))
return
if(obj_flags & NO_DECONSTRUCTION)
return FALSE
tool.play_tool_sound(src, 100)
deconstruct()
deconstruct(TRUE)
return ITEM_INTERACT_SUCCESS
/obj/structure/grille/screwdriver_act(mob/living/user, obj/item/tool)
@@ -212,8 +208,6 @@
add_fingerprint(user)
if(shock(user, 90))
return FALSE
if(obj_flags & NO_DECONSTRUCTION)
return FALSE
if(!tool.use_tool(src, user, 0, volume=100))
return FALSE
set_anchored(!anchored)
@@ -296,18 +290,13 @@
playsound(src, 'sound/items/welder.ogg', 80, TRUE)
/obj/structure/grille/deconstruct(disassembled = TRUE)
if(!loc) //if already qdel'd somehow, we do nothing
return
if(!(obj_flags & NO_DECONSTRUCTION))
var/obj/R = new rods_type(drop_location(), rods_amount)
transfer_fingerprints_to(R)
qdel(src)
..()
/obj/structure/grille/atom_deconstruct(disassembled = TRUE)
var/obj/rods = new rods_type(drop_location(), rods_amount)
transfer_fingerprints_to(rods)
/obj/structure/grille/atom_break()
. = ..()
if(!broken && !(obj_flags & NO_DECONSTRUCTION))
if(!broken)
icon_state = "brokengrille"
set_density(FALSE)
atom_integrity = 20
+1 -2
View File
@@ -64,7 +64,7 @@
if(!QDELETED(src))
deconstruct(TRUE)
/obj/structure/headpike/deconstruct(disassembled)
/obj/structure/headpike/atom_deconstruct(disassembled)
var/obj/item/bodypart/head/our_head = victim
var/obj/item/spear/our_spear = spear
victim = null
@@ -73,7 +73,6 @@
if(!disassembled)
return ..()
our_spear?.forceMove(drop_location())
return ..()
/obj/structure/headpike/attack_hand(mob/user, list/modifiers)
. = ..()
@@ -40,10 +40,9 @@ GLOBAL_LIST_INIT(ore_probability, list(
var/turf/closed/mineral/clearable = potential
clearable.ScrapeAway(flags = CHANGETURF_IGNORE_AIR)
/obj/structure/spawner/ice_moon/deconstruct(disassembled)
/obj/structure/spawner/ice_moon/atom_deconstruct(disassembled)
destroy_effect()
drop_loot()
return ..()
/**
* Effects and messages created when the spawner is destroyed
@@ -159,13 +159,12 @@
buckled_mob.pixel_y = buckled_mob.base_pixel_y + PIXEL_Y_OFFSET_LYING
REMOVE_TRAIT(buckled_mob, TRAIT_MOVE_UPSIDE_DOWN, REF(src))
/obj/structure/kitchenspike/deconstruct(disassembled = TRUE)
/obj/structure/kitchenspike/atom_deconstruct(disassembled = TRUE)
if(disassembled)
var/obj/structure/meatspike_frame = new /obj/structure/kitchenspike_frame(src.loc)
transfer_fingerprints_to(meatspike_frame)
else
new /obj/item/stack/sheet/iron(src.loc, 4)
new /obj/item/stack/rods(loc, MEATSPIKE_IRONROD_REQUIREMENT)
qdel(src)
#undef MEATSPIKE_IRONROD_REQUIREMENT
+3 -6
View File
@@ -57,10 +57,8 @@
var/turf/T = get_turf(src)
return T.attackby(C, user) //hand this off to the turf instead (for building plating, catwalks, etc)
/obj/structure/lattice/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
new build_material(get_turf(src), number_of_mats)
qdel(src)
/obj/structure/lattice/atom_deconstruct(disassembled = TRUE)
new build_material(get_turf(src), number_of_mats)
/obj/structure/lattice/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd)
if(the_rcd.mode == RCD_TURF)
@@ -113,11 +111,10 @@
C.deconstruct()
..()
/obj/structure/lattice/catwalk/deconstruct()
/obj/structure/lattice/catwalk/atom_deconstruct(disassembled = TRUE)
var/turf/T = loc
for(var/obj/structure/cable/C in T)
C.deconstruct()
..()
/obj/structure/lattice/catwalk/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd)
if(the_rcd.mode == RCD_DECONSTRUCT)
@@ -42,9 +42,8 @@ GLOBAL_LIST_INIT(tendrils, list())
AddComponent(/datum/component/gps, "Eerie Signal")
GLOB.tendrils += src
/obj/structure/spawner/lavaland/deconstruct(disassembled)
/obj/structure/spawner/lavaland/atom_deconstruct(disassembled)
new /obj/effect/collapse(loc)
return ..()
/obj/structure/spawner/lavaland/examine(mob/user)
var/list/examine_messages = ..()
+3 -5
View File
@@ -303,11 +303,9 @@ at the cost of risking a vicious bite.**/
deconstruct()
return TRUE
/obj/structure/steam_vent/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
new /obj/item/stack/sheet/iron(loc, 1)
new /obj/item/stock_parts/water_recycler(loc, 1)
qdel(src)
/obj/structure/steam_vent/atom_deconstruct(disassembled = TRUE)
new /obj/item/stack/sheet/iron(loc, 1)
new /obj/item/stock_parts/water_recycler(loc, 1)
/**
* Creates "steam" smoke, and determines when the vent needs to block line of sight via reset_opacity.
@@ -204,14 +204,12 @@
/////////////////////// END TOOL OVERRIDES ///////////////////////
/obj/structure/mineral_door/deconstruct(disassembled = TRUE)
/obj/structure/mineral_door/atom_deconstruct(disassembled = TRUE)
var/turf/T = get_turf(src)
if(disassembled)
new sheetType(T, sheetAmount)
else
new sheetType(T, max(sheetAmount - 2, 1))
qdel(src)
/obj/structure/mineral_door/iron
name = "iron door"
+6 -8
View File
@@ -260,7 +260,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror/broken, 28)
/obj/structure/mirror/atom_break(damage_flag, mapload)
. = ..()
if(broken || (obj_flags & NO_DECONSTRUCTION))
if(broken)
return
icon_state = "mirror_broke"
if(!mapload)
@@ -269,13 +269,11 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror/broken, 28)
desc = "Oh no, seven years of bad luck!"
broken = TRUE
/obj/structure/mirror/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
if(!disassembled)
new /obj/item/shard(loc)
else
new /obj/item/wallframe/mirror(loc)
qdel(src)
/obj/structure/mirror/atom_deconstruct(disassembled = TRUE)
if(!disassembled)
new /obj/item/shard(loc)
else
new /obj/item/wallframe/mirror(loc)
/obj/structure/mirror/welder_act(mob/living/user, obj/item/I)
..()
+3 -6
View File
@@ -104,10 +104,8 @@ GLOBAL_LIST_EMPTY(bodycontainers) //Let them act as spawnpoints for revenants an
return
return attack_hand(user)
/obj/structure/bodycontainer/deconstruct(disassembled = TRUE)
if (!(obj_flags & NO_DECONSTRUCTION))
new /obj/item/stack/sheet/iron(loc, 5)
qdel(src)
/obj/structure/bodycontainer/atom_deconstruct(disassembled = TRUE)
new /obj/item/stack/sheet/iron(loc, 5)
/obj/structure/bodycontainer/container_resist_act(mob/living/user)
if(!locked)
@@ -473,9 +471,8 @@ GLOBAL_LIST_EMPTY(crematoriums)
connected = null
return ..()
/obj/structure/tray/deconstruct(disassembled = TRUE)
/obj/structure/tray/atom_deconstruct(disassembled = TRUE)
new /obj/item/stack/sheet/iron (loc, 2)
qdel(src)
/obj/structure/tray/attack_paw(mob/user, list/modifiers)
return attack_hand(user, modifiers)
+5 -7
View File
@@ -110,15 +110,13 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/noticeboard, 32)
notices--
update_appearance(UPDATE_ICON)
/obj/structure/noticeboard/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
if(!disassembled)
new /obj/item/stack/sheet/mineral/wood(loc)
else
new /obj/item/wallframe/noticeboard(loc)
/obj/structure/noticeboard/atom_deconstruct(disassembled = TRUE)
if(!disassembled)
new /obj/item/stack/sheet/mineral/wood(loc)
else
new /obj/item/wallframe/noticeboard(loc)
for(var/obj/item/content in contents)
remove_item(content)
qdel(src)
/obj/item/wallframe/noticeboard
name = "notice board"
@@ -73,7 +73,7 @@
petrified_mob.forceMove(loc)
return ..()
/obj/structure/statue/petrified/deconstruct(disassembled = TRUE)
/obj/structure/statue/petrified/atom_deconstruct(disassembled = TRUE)
var/destruction_message = "[src] shatters!"
if(!disassembled)
if(petrified_mob)
@@ -89,7 +89,6 @@
destruction_message = "[src] shatters, a solid brain tumbling out!"
petrified_mob.dust()
visible_message(span_danger(destruction_message))
qdel(src)
/obj/structure/statue/petrified/animate_atom_living(mob/living/owner)
if(isnull(petrified_mob))
+2 -3
View File
@@ -41,9 +41,8 @@
if(BURN)
playsound(src, 'sound/items/welder.ogg', 100, TRUE)
/obj/structure/pinata/deconstruct(disassembled)
/obj/structure/pinata/atom_deconstruct(disassembled)
new debris(get_turf(src))
return ..()
///An item that when used inhand spawns an immovable pinata
/obj/item/pinata
@@ -72,7 +71,7 @@
base_icon_state = "pinata_syndie_placed"
destruction_loot = 2
debris = /obj/effect/decal/cleanable/wrapping/pinata/syndie
candy_options = list(
candy_options = list(
/obj/item/food/bubblegum,
/obj/item/food/candy,
/obj/item/food/chocolatebar,
+2 -4
View File
@@ -124,10 +124,8 @@
return FALSE //If you're not laying down, or a small creature, or a ventcrawler, then no pass.
/obj/structure/plasticflaps/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
new /obj/item/stack/sheet/plastic/five(loc)
qdel(src)
/obj/structure/plasticflaps/atom_deconstruct(disassembled = TRUE)
new /obj/item/stack/sheet/plastic/five(loc)
/obj/structure/plasticflaps/Initialize(mapload)
. = ..()
+1 -6
View File
@@ -98,19 +98,14 @@
deconstruct()
return TRUE
/obj/structure/railing/deconstruct(disassembled)
if((obj_flags & NO_DECONSTRUCTION))
return ..()
/obj/structure/railing/atom_deconstruct(disassembled)
var/rods_to_make = istype(src,/obj/structure/railing/corner) ? 1 : 2
var/obj/rod = new item_deconstruct(drop_location(), rods_to_make)
transfer_fingerprints_to(rod)
return ..()
///Implements behaviour that makes it possible to unanchor the railing.
/obj/structure/railing/wrench_act(mob/living/user, obj/item/I)
. = ..()
if(obj_flags & NO_DECONSTRUCTION)
return
to_chat(user, span_notice("You begin to [anchored ? "unfasten the railing from":"fasten the railing to"] the floor..."))
if(I.use_tool(src, user, volume = 75, extra_checks = CALLBACK(src, PROC_REF(check_anchored), anchored)))
set_anchored(!anchored)
+1 -2
View File
@@ -45,12 +45,11 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/secure_safe, 32)
if(mapload)
PopulateContents()
/obj/structure/secure_safe/deconstruct(disassembled)
/obj/structure/secure_safe/atom_deconstruct(disassembled)
if(!density) //if we're a wall item, we'll drop a wall frame.
var/obj/item/wallframe/secure_safe/new_safe = new(get_turf(src))
for(var/obj/item in contents)
item.forceMove(new_safe)
return ..()
/obj/structure/secure_safe/proc/PopulateContents()
new /obj/item/paper(src)
-3
View File
@@ -184,9 +184,6 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/shower, (-16))
/obj/machinery/shower/wrench_act(mob/living/user, obj/item/I)
. = ..()
if(obj_flags & NO_DECONSTRUCTION)
return
I.play_tool_sound(src)
deconstruct()
return TRUE
+1 -2
View File
@@ -209,9 +209,8 @@
deconstruct(TRUE)
return TRUE
/obj/structure/stairs_frame/deconstruct(disassembled = TRUE)
/obj/structure/stairs_frame/atom_deconstruct(disassembled = TRUE)
new frame_stack(get_turf(src), frame_stack_amount)
qdel(src)
/obj/structure/stairs_frame/attackby(obj/item/attacked_by, mob/user, params)
if(!isstack(attacked_by))
+1 -2
View File
@@ -75,9 +75,8 @@
T.set_custom_materials(custom_materials)
qdel(src)
/obj/structure/table_frame/deconstruct(disassembled = TRUE)
/obj/structure/table_frame/atom_deconstruct(disassembled = TRUE)
new framestack(get_turf(src), framestackamount)
qdel(src)
/obj/structure/table_frame/narsie_act()
new /obj/structure/table_frame/wood(src.loc)
+34 -54
View File
@@ -73,7 +73,7 @@
context[SCREENTIP_CONTEXT_RMB] = "Deal card faceup"
. = CONTEXTUAL_SCREENTIP_SET
if(!(obj_flags & NO_DECONSTRUCTION) && deconstruction_ready)
if(deconstruction_ready)
if(held_item.tool_behaviour == TOOL_SCREWDRIVER)
context[SCREENTIP_CONTEXT_RMB] = "Disassemble"
. = CONTEXTUAL_SCREENTIP_SET
@@ -207,7 +207,7 @@
pushed_mob.add_mood_event("table", /datum/mood_event/table_limbsmash, banged_limb)
/obj/structure/table/screwdriver_act_secondary(mob/living/user, obj/item/tool)
if(obj_flags & NO_DECONSTRUCTION || !deconstruction_ready)
if(!deconstruction_ready)
return FALSE
to_chat(user, span_notice("You start disassembling [src]..."))
if(tool.use_tool(src, user, 2 SECONDS, volume=50))
@@ -215,12 +215,12 @@
return ITEM_INTERACT_SUCCESS
/obj/structure/table/wrench_act_secondary(mob/living/user, obj/item/tool)
if(obj_flags & NO_DECONSTRUCTION || !deconstruction_ready)
if(!deconstruction_ready)
return FALSE
to_chat(user, span_notice("You start deconstructing [src]..."))
if(tool.use_tool(src, user, 4 SECONDS, volume=50))
playsound(loc, 'sound/items/deconstruct.ogg', 50, TRUE)
deconstruct(TRUE, 1)
deconstruct(TRUE)
return ITEM_INTERACT_SUCCESS
/obj/structure/table/attackby(obj/item/I, mob/living/user, params)
@@ -297,20 +297,14 @@
/obj/structure/table/proc/AfterPutItemOnTable(obj/item/thing, mob/living/user)
return
/obj/structure/table/deconstruct(disassembled = TRUE, wrench_disassembly = 0)
if(!(obj_flags & NO_DECONSTRUCTION))
var/turf/T = get_turf(src)
if(buildstack)
new buildstack(T, buildstackamount)
else
for(var/i in custom_materials)
var/datum/material/M = i
new M.sheet_type(T, FLOOR(custom_materials[M] / SHEET_MATERIAL_AMOUNT, 1))
if(!wrench_disassembly)
new frame(T)
else
new framestack(T, framestackamount)
qdel(src)
/obj/structure/table/atom_deconstruct(disassembled = TRUE)
var/turf/target_turf = get_turf(src)
if(buildstack)
new buildstack(target_turf, buildstackamount)
else
for(var/datum/material/mat in custom_materials)
new mat.sheet_type(target_turf, FLOOR(custom_materials[mat] / SHEET_MATERIAL_AMOUNT, 1))
new framestack(target_turf, framestackamount)
/obj/structure/table/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd)
if(the_rcd.mode == RCD_DECONSTRUCT)
@@ -437,8 +431,7 @@
/obj/structure/table/glass/proc/on_entered(datum/source, atom/movable/AM)
SIGNAL_HANDLER
if(obj_flags & NO_DECONSTRUCTION)
return
if(!isliving(AM))
return
// Don't break if they're just flying past
@@ -469,19 +462,16 @@
victim.Paralyze(100)
qdel(src)
/obj/structure/table/glass/deconstruct(disassembled = TRUE, wrench_disassembly = 0)
if(!(obj_flags & NO_DECONSTRUCTION))
if(disassembled)
..()
return
else
var/turf/T = get_turf(src)
playsound(T, SFX_SHATTER, 50, TRUE)
/obj/structure/table/glass/atom_deconstruct(disassembled = TRUE)
if(disassembled)
..()
return
else
var/turf/T = get_turf(src)
playsound(T, SFX_SHATTER, 50, TRUE)
new frame(loc)
new glass_shard_type(loc)
qdel(src)
new frame(loc)
new glass_shard_type(loc)
/obj/structure/table/glass/narsie_act()
color = NARSIE_WINDOW_COLOUR
@@ -841,10 +831,9 @@
if(isnull(held_item))
return NONE
if(!(obj_flags & NO_DECONSTRUCTION))
if(held_item.tool_behaviour == TOOL_WRENCH)
context[SCREENTIP_CONTEXT_RMB] = "Deconstruct"
return CONTEXTUAL_SCREENTIP_SET
if(held_item.tool_behaviour == TOOL_WRENCH)
context[SCREENTIP_CONTEXT_RMB] = "Deconstruct"
return CONTEXTUAL_SCREENTIP_SET
return NONE
@@ -860,8 +849,6 @@
return TRUE
/obj/structure/rack/wrench_act_secondary(mob/living/user, obj/item/tool)
if(obj_flags & NO_DECONSTRUCTION)
return NONE
tool.play_tool_sound(src)
deconstruct(TRUE)
return ITEM_INTERACT_SUCCESS
@@ -901,12 +888,10 @@
* Rack destruction
*/
/obj/structure/rack/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
set_density(FALSE)
var/obj/item/rack_parts/newparts = new(loc)
transfer_fingerprints_to(newparts)
qdel(src)
/obj/structure/rack/atom_deconstruct(disassembled = TRUE)
set_density(FALSE)
var/obj/item/rack_parts/newparts = new(loc)
transfer_fingerprints_to(newparts)
/*
@@ -935,24 +920,19 @@
context[SCREENTIP_CONTEXT_LMB] = "Construct Rack"
return CONTEXTUAL_SCREENTIP_SET
if(!(obj_flags & NO_DECONSTRUCTION))
if(held_item.tool_behaviour == TOOL_WRENCH)
context[SCREENTIP_CONTEXT_LMB] = "Deconstruct"
return CONTEXTUAL_SCREENTIP_SET
if(held_item.tool_behaviour == TOOL_WRENCH)
context[SCREENTIP_CONTEXT_LMB] = "Deconstruct"
return CONTEXTUAL_SCREENTIP_SET
return NONE
/obj/item/rack_parts/wrench_act(mob/living/user, obj/item/tool)
if(obj_flags & NO_DECONSTRUCTION)
return NONE
tool.play_tool_sound(src)
deconstruct(TRUE)
return ITEM_INTERACT_SUCCESS
/obj/item/rack_parts/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
new /obj/item/stack/sheet/iron(drop_location())
return ..()
/obj/item/rack_parts/atom_deconstruct(disassembled = TRUE)
new /obj/item/stack/sheet/iron(drop_location())
/obj/item/rack_parts/attack_self(mob/user)
if(building)
@@ -103,13 +103,11 @@
return TRUE
/obj/structure/tank_dispenser/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
for(var/X in src)
var/obj/item/I = X
I.forceMove(loc)
new /obj/item/stack/sheet/iron (loc, 2)
qdel(src)
/obj/structure/tank_dispenser/atom_deconstruct(disassembled = TRUE)
for(var/X in src)
var/obj/item/I = X
I.forceMove(loc)
new /obj/item/stack/sheet/iron (loc, 2)
/obj/structure/tank_dispenser/proc/dispense(tank_type, mob/receiver)
var/existing_tank = locate(tank_type) in src
+1 -2
View File
@@ -63,12 +63,11 @@
deconstruct(TRUE)
return TRUE
/obj/structure/tank_holder/deconstruct(disassembled = TRUE)
/obj/structure/tank_holder/atom_deconstruct(disassembled = TRUE)
var/atom/Tsec = drop_location()
new /obj/item/stack/rods(Tsec, 2)
if(tank)
tank.forceMove(Tsec)
qdel(src)
/obj/structure/tank_holder/attack_paw(mob/user, list/modifiers)
return attack_hand(user, modifiers)
@@ -35,22 +35,16 @@
user.visible_message(span_notice("[user] empties \the [src]."), span_notice("You empty \the [src]."))
empty_pod()
else
deconstruct(TRUE, user)
deconstruct(TRUE)
else
return ..()
/obj/structure/transit_tube_pod/deconstruct(disassembled = TRUE, mob/user)
if(!(obj_flags & NO_DECONSTRUCTION))
var/atom/location = get_turf(src)
if(user)
location = user.loc
add_fingerprint(user)
user.visible_message(span_notice("[user] removes [src]."), span_notice("You remove [src]."))
var/obj/structure/c_transit_tube_pod/R = new/obj/structure/c_transit_tube_pod(location)
transfer_fingerprints_to(R)
R.setDir(dir)
empty_pod(location)
qdel(src)
/obj/structure/transit_tube_pod/atom_deconstruct(disassembled = TRUE)
var/atom/location = get_turf(src)
var/obj/structure/c_transit_tube_pod/tube_pod = new/obj/structure/c_transit_tube_pod(location)
transfer_fingerprints_to(tube_pod)
tube_pod.setDir(dir)
empty_pod(location)
/obj/structure/transit_tube_pod/ex_act(severity, target)
. = ..()
+1 -2
View File
@@ -149,9 +149,8 @@
for(var/atom/movable/AM in contents)
AM.forceMove(droppoint)
/obj/structure/votebox/deconstruct(disassembled)
/obj/structure/votebox/atom_deconstruct(disassembled)
dump_contents()
. = ..()
/obj/structure/votebox/proc/raffle(mob/user)
var/list/options = list()
+21 -34
View File
@@ -83,17 +83,15 @@
icon_state = "toilet[open][cistern]"
return ..()
/obj/structure/toilet/deconstruct()
if(!(obj_flags & NO_DECONSTRUCTION))
for(var/obj/toilet_item in contents)
toilet_item.forceMove(drop_location())
if(buildstacktype)
new buildstacktype(loc,buildstackamount)
else
for(var/i in custom_materials)
var/datum/material/M = i
new M.sheet_type(loc, FLOOR(custom_materials[M] / SHEET_MATERIAL_AMOUNT, 1))
..()
/obj/structure/toilet/atom_deconstruct(dissambled = TRUE)
for(var/obj/toilet_item in contents)
toilet_item.forceMove(drop_location())
if(buildstacktype)
new buildstacktype(loc,buildstackamount)
else
for(var/i in custom_materials)
var/datum/material/M = i
new M.sheet_type(loc, FLOOR(custom_materials[M] / SHEET_MATERIAL_AMOUNT, 1))
/obj/structure/toilet/attackby(obj/item/I, mob/living/user, params)
add_fingerprint(user)
@@ -105,7 +103,7 @@
cistern = !cistern
update_appearance()
return COMPONENT_CANCEL_ATTACK_CHAIN
else if(I.tool_behaviour == TOOL_WRENCH && !(obj_flags & NO_DECONSTRUCTION))
else if(I.tool_behaviour == TOOL_WRENCH)
I.play_tool_sound(src)
deconstruct()
return TRUE
@@ -227,10 +225,8 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/urinal, 32)
exposed = !exposed
return TRUE
/obj/structure/urinal/deconstruct(disassembled = TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
new /obj/item/wallframe/urinal(loc)
qdel(src)
/obj/structure/urinal/atom_deconstruct(disassembled = TRUE)
new /obj/item/wallframe/urinal(loc)
/obj/item/wallframe/urinal
name = "urinal frame"
@@ -419,7 +415,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/sink, (-14))
playsound(loc, 'sound/effects/slosh.ogg', 25, TRUE)
return
if(O.tool_behaviour == TOOL_WRENCH && !(obj_flags & NO_DECONSTRUCTION))
if(O.tool_behaviour == TOOL_WRENCH)
O.play_tool_sound(src)
deconstruct()
return
@@ -495,12 +491,10 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/sink, (-14))
else
return ..()
/obj/structure/sink/deconstruct()
if(!(obj_flags & NO_DECONSTRUCTION))
drop_materials()
if(has_water_reclaimer)
new /obj/item/stock_parts/water_recycler(drop_location())
..()
/obj/structure/sink/atom_deconstruct(dissambled = TRUE)
drop_materials()
if(has_water_reclaimer)
new /obj/item/stock_parts/water_recycler(drop_location())
/obj/structure/sink/process(seconds_per_tick)
// Water reclamation complete?
@@ -571,10 +565,8 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/sink/kitchen, (-16))
deconstruct()
return TRUE
/obj/structure/sinkframe/deconstruct()
if(!(obj_flags & NO_DECONSTRUCTION))
drop_materials()
return ..()
/obj/structure/sinkframe/atom_deconstruct(dissambled = TRUE)
drop_materials()
/obj/structure/sinkframe/proc/drop_materials()
for(var/datum/material/material as anything in custom_materials)
@@ -725,9 +717,6 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/sink/kitchen, (-16))
. = ..()
icon_state = "puddle"
/obj/structure/water_source/puddle/deconstruct(disassembled = TRUE)
qdel(src)
//End legacy sink
@@ -804,11 +793,10 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/sink/kitchen, (-16))
playsound(loc, 'sound/effects/curtain.ogg', 50, TRUE)
toggle()
/obj/structure/curtain/deconstruct(disassembled = TRUE)
/obj/structure/curtain/atom_deconstruct(disassembled = TRUE)
new /obj/item/stack/sheet/cloth (loc, 2)
new /obj/item/stack/sheet/plastic (loc, 2)
new /obj/item/stack/rods (loc, 1)
qdel(src)
/obj/structure/curtain/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
switch(damage_type)
@@ -840,10 +828,9 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/sink/kitchen, (-16))
alpha = 255
opaque_closed = TRUE
/obj/structure/curtain/cloth/deconstruct(disassembled = TRUE)
/obj/structure/curtain/cloth/atom_deconstruct(disassembled = TRUE)
new /obj/item/stack/sheet/cloth (loc, 4)
new /obj/item/stack/rods (loc, 1)
qdel(src)
/obj/structure/curtain/cloth/fancy
icon_type = "cur_fancy"
+8 -21
View File
@@ -78,8 +78,6 @@
/obj/structure/window/examine(mob/user)
. = ..()
if(obj_flags & NO_DECONSTRUCTION)
return
switch(state)
if(WINDOW_SCREWED_TO_FRAME)
@@ -210,8 +208,6 @@
return ITEM_INTERACT_SUCCESS
/obj/structure/window/screwdriver_act(mob/living/user, obj/item/tool)
if(obj_flags & NO_DECONSTRUCTION)
return
switch(state)
if(WINDOW_SCREWED_TO_FRAME)
@@ -240,7 +236,7 @@
/obj/structure/window/wrench_act(mob/living/user, obj/item/tool)
if(anchored)
return FALSE
if((obj_flags & NO_DECONSTRUCTION) || (reinf && state >= RWINDOW_FRAME_BOLTED))
if(reinf && state >= RWINDOW_FRAME_BOLTED)
return FALSE
to_chat(user, span_notice("You begin to disassemble [src]..."))
@@ -255,7 +251,7 @@
return ITEM_INTERACT_SUCCESS
/obj/structure/window/crowbar_act(mob/living/user, obj/item/tool)
if(!anchored || (obj_flags & NO_DECONSTRUCTION))
if(!anchored)
return FALSE
switch(state)
@@ -330,18 +326,13 @@
playsound(src, 'sound/items/welder.ogg', 100, TRUE)
/obj/structure/window/deconstruct(disassembled = TRUE)
if(QDELETED(src))
return
/obj/structure/window/atom_deconstruct(disassembled = TRUE)
if(!disassembled)
playsound(src, break_sound, 70, TRUE)
if(!(obj_flags & NO_DECONSTRUCTION))
for(var/obj/item/shard/debris in spawn_debris(drop_location()))
transfer_fingerprints_to(debris) // transfer fingerprints to shards only
qdel(src)
for(var/obj/item/shard/debris in spawn_debris(drop_location()))
transfer_fingerprints_to(debris) // transfer fingerprints to shards only
update_nearby_icons()
///Spawns shard and debris decal based on the glass_material_datum, spawns rods if window is reinforned and number of shards/rods is determined by the window being fulltile or not.
/obj/structure/window/proc/spawn_debris(location)
var/datum/material/glass_material_ref = GET_MATERIAL_REF(glass_material_datum)
@@ -480,9 +471,6 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/window/unanchored/spawner, 0)
return FALSE
/obj/structure/window/reinforced/attackby_secondary(obj/item/tool, mob/user, params)
if(obj_flags & NO_DECONSTRUCTION)
return ..()
switch(state)
if(RWINDOW_SECURE)
if(tool.tool_behaviour == TOOL_WELDER)
@@ -546,7 +534,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/window/unanchored/spawner, 0)
/obj/structure/window/reinforced/crowbar_act(mob/living/user, obj/item/tool)
if(!anchored)
return FALSE
if((obj_flags & NO_DECONSTRUCTION) || (state != WINDOW_OUT_OF_FRAME))
if(state != WINDOW_OUT_OF_FRAME)
return FALSE
to_chat(user, span_notice("You begin to lever the window back into the frame..."))
if(tool.use_tool(src, user, 10 SECONDS, volume = 75, extra_checks = CALLBACK(src, PROC_REF(check_state_and_anchored), state, anchored)))
@@ -561,8 +549,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/window/unanchored/spawner, 0)
/obj/structure/window/reinforced/examine(mob/user)
. = ..()
if(obj_flags & NO_DECONSTRUCTION)
return
switch(state)
if(RWINDOW_SECURE)
. += span_notice("It's been screwed in with one way screws, you'd need to <b>heat them</b> to have any chance of backing them out.")
@@ -803,9 +790,9 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/window/reinforced/tinted/frosted/spaw
/obj/structure/window/reinforced/shuttle/indestructible
name = "hardened shuttle window"
obj_flags = parent_type::obj_flags | NO_DECONSTRUCTION
flags_1 = PREVENT_CLICK_UNDER_1
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
obj_flags = parent_type::obj_flags | NO_DECONSTRUCTION
/obj/structure/window/reinforced/shuttle/indestructible/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd)
return FALSE