mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-25 09:01:40 +00:00
* Adds a new component so that items that are "attached" to walls will now drop/deconstruct on turf destruction. (#77417) ## About The Pull Request Adds a new component, called wall_mounted, which applies on the wallframe objects on construction, as well as a number of wall frame objects and structures to cover mapped in, roundstart objects of the like. I might have forgotten a few, but this covers the vast majority that players will run into in a given round. This will cover wall destruction, turf explosion, the whole nine yards, and call that object/structure/machine's deconstruct proc. We have some special handling for intercoms as well since they're apparently items. So most basic case is this: You have a wall. that wall holds a sign. If you examine the wall, it tells you that the wall is currently supporting the **Example Sign**. It tells you that if the wall is damaged or destroyed, the sign will **fall off the wall.** So, if you were to welder, bomb, or hulk your way through that wall, it would call the deconstruct() proc on that sign, and fall off the wall, leaving an item sign at the foot of the wall. ## To-Do - [x] Stop breaking all wallmounts when operating shuttles (Signal conflict with COMSIG_TURF_CHANGED 😔) - [x] Confirm that the ~~deconstruct~~ designated proc of each wallmount falling is sane for the intended object - [x] Clean up the contents of the wall_mounted component to reduce copy-paste on object init. - [x] Add it to more stuff that may just not have a directional helper? - [x] ~~Change how APC construction is handled to make it easier!~~ - [x] ~~Don't accidently nerf malf AI into the ground I guess~~ ## Why It's Good For The Game Closes #22283. Helps close more of #47526. Closes #54983. Closes https://github.com/wall-nerds/wallening/issues/90. All of these objects are "wall mounts". It stands to reason that they're mounted to the walls they appear to be attached to. This attempts to rectify them by giving them a turf link to the turf they're mounted to, and then upon changes to that turf, dropping or breaking that object. It'll need a little more polish to get to 100%, since I can see a few more issues to iron out first, but I'm dropping this here for now to get some feedback and put some fire under me to get this completed. ## Changelog 🆑 add: Wall mounted objects (Things like APCs, Air Alarms, Light switches, Signs, Posters, Newscasters, you name it) will now fall to the ground and break or deconstruct when their attaching wall is changed or broken. /🆑 * Adds a new component so that items that are "attached" to walls will now drop/deconstruct on turf destruction. --------- Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com>
176 lines
5.6 KiB
Plaintext
176 lines
5.6 KiB
Plaintext
/obj/structure/light_construct
|
|
name = "light fixture frame"
|
|
desc = "A light fixture under construction."
|
|
icon = 'icons/obj/lighting.dmi'
|
|
icon_state = "tube-construct-stage1"
|
|
anchored = TRUE
|
|
layer = WALL_OBJ_LAYER
|
|
plane = GAME_PLANE_UPPER
|
|
max_integrity = 200
|
|
armor_type = /datum/armor/structure_light_construct
|
|
|
|
///Light construction stage (LIGHT_CONSTRUCT_EMPTY, LIGHT_CONSTRUCT_WIRED, LIGHT_CONSTRUCT_CLOSED)
|
|
var/stage = LIGHT_CONSTRUCT_EMPTY
|
|
///Type of fixture for icon state
|
|
var/fixture_type = "tube"
|
|
///Amount of sheets gained on deconstruction
|
|
var/sheets_refunded = 2
|
|
///Reference for light object
|
|
var/obj/machinery/light/new_light = null
|
|
///Reference for the internal cell
|
|
var/obj/item/stock_parts/cell/cell
|
|
///Can we support a cell?
|
|
var/cell_connectors = TRUE
|
|
|
|
/datum/armor/structure_light_construct
|
|
melee = 50
|
|
bullet = 10
|
|
laser = 10
|
|
fire = 80
|
|
acid = 50
|
|
|
|
/obj/structure/light_construct/Initialize(mapload, ndir, building)
|
|
. = ..()
|
|
if(building)
|
|
setDir(ndir)
|
|
find_and_hang_on_wall()
|
|
|
|
/obj/structure/light_construct/Destroy()
|
|
QDEL_NULL(cell)
|
|
return ..()
|
|
|
|
/obj/structure/light_construct/get_cell()
|
|
return cell
|
|
|
|
/obj/structure/light_construct/examine(mob/user)
|
|
. = ..()
|
|
switch(stage)
|
|
if(LIGHT_CONSTRUCT_EMPTY)
|
|
. += "It's an empty frame."
|
|
if(LIGHT_CONSTRUCT_WIRED)
|
|
. += "It's wired."
|
|
if(LIGHT_CONSTRUCT_CLOSED)
|
|
. += "The casing is closed."
|
|
if(cell_connectors)
|
|
if(cell)
|
|
. += "You see [cell] inside the casing."
|
|
else
|
|
. += "The casing has no power cell for backup power."
|
|
else
|
|
. += span_danger("This casing doesn't support power cells for backup power.")
|
|
|
|
/obj/structure/light_construct/attack_hand(mob/user, list/modifiers)
|
|
if(!cell)
|
|
return
|
|
user.visible_message(span_notice("[user] removes [cell] from [src]!"), span_notice("You remove [cell]."))
|
|
user.put_in_hands(cell)
|
|
cell.update_appearance()
|
|
cell = null
|
|
add_fingerprint(user)
|
|
|
|
/obj/structure/light_construct/attack_tk(mob/user)
|
|
if(!cell)
|
|
return
|
|
to_chat(user, span_notice("You telekinetically remove [cell]."))
|
|
var/obj/item/stock_parts/cell/cell_reference = cell
|
|
cell = null
|
|
cell_reference.forceMove(drop_location())
|
|
return cell_reference.attack_tk(user)
|
|
|
|
/obj/structure/light_construct/attackby(obj/item/tool, mob/user, params)
|
|
add_fingerprint(user)
|
|
if(istype(tool, /obj/item/stock_parts/cell))
|
|
if(!cell_connectors)
|
|
to_chat(user, span_warning("This [name] can't support a power cell!"))
|
|
return
|
|
if(HAS_TRAIT(tool, TRAIT_NODROP))
|
|
to_chat(user, span_warning("[tool] is stuck to your hand!"))
|
|
return
|
|
if(cell)
|
|
to_chat(user, span_warning("There is a power cell already installed!"))
|
|
return
|
|
if(user.temporarilyRemoveItemFromInventory(tool))
|
|
user.visible_message(span_notice("[user] hooks up [tool] to [src]."), \
|
|
span_notice("You add [tool] to [src]."))
|
|
playsound(src, 'sound/machines/click.ogg', 50, TRUE)
|
|
tool.forceMove(src)
|
|
cell = tool
|
|
add_fingerprint(user)
|
|
return
|
|
if(istype(tool, /obj/item/light))
|
|
to_chat(user, span_warning("This [name] isn't finished being setup!"))
|
|
return
|
|
|
|
switch(stage)
|
|
if(LIGHT_CONSTRUCT_EMPTY)
|
|
if(tool.tool_behaviour == TOOL_WRENCH)
|
|
if(cell)
|
|
to_chat(user, span_warning("You have to remove the cell first!"))
|
|
return
|
|
to_chat(user, span_notice("You begin deconstructing [src]..."))
|
|
if (tool.use_tool(src, user, 30, volume=50))
|
|
new /obj/item/stack/sheet/iron(drop_location(), sheets_refunded)
|
|
user.visible_message(span_notice("[user.name] deconstructs [src]."), \
|
|
span_notice("You deconstruct [src]."), span_hear("You hear a ratchet."))
|
|
playsound(src, 'sound/items/deconstruct.ogg', 75, TRUE)
|
|
qdel(src)
|
|
return
|
|
|
|
if(istype(tool, /obj/item/stack/cable_coil))
|
|
var/obj/item/stack/cable_coil/coil = tool
|
|
if(coil.use(1))
|
|
icon_state = "[fixture_type]-construct-stage2"
|
|
stage = LIGHT_CONSTRUCT_WIRED
|
|
user.visible_message(span_notice("[user.name] adds wires to [src]."), \
|
|
span_notice("You add wires to [src]."))
|
|
else
|
|
to_chat(user, span_warning("You need one length of cable to wire [src]!"))
|
|
return
|
|
if(LIGHT_CONSTRUCT_WIRED)
|
|
if(tool.tool_behaviour == TOOL_WRENCH)
|
|
to_chat(usr, span_warning("You have to remove the wires first!"))
|
|
return
|
|
|
|
if(tool.tool_behaviour == TOOL_WIRECUTTER)
|
|
stage = LIGHT_CONSTRUCT_EMPTY
|
|
icon_state = "[fixture_type]-construct-stage1"
|
|
new /obj/item/stack/cable_coil(drop_location(), 1, "red")
|
|
user.visible_message(span_notice("[user.name] removes the wiring from [src]."), \
|
|
span_notice("You remove the wiring from [src]."), span_hear("You hear clicking."))
|
|
tool.play_tool_sound(src, 100)
|
|
return
|
|
|
|
if(tool.tool_behaviour == TOOL_SCREWDRIVER)
|
|
user.visible_message(span_notice("[user.name] closes [src]'s casing."), \
|
|
span_notice("You close [src]'s casing."), span_hear("You hear screwing."))
|
|
tool.play_tool_sound(src, 75)
|
|
switch(fixture_type)
|
|
if("tube")
|
|
new_light = new /obj/machinery/light/built(loc)
|
|
if("bulb")
|
|
new_light = new /obj/machinery/light/small/built(loc)
|
|
new_light.setDir(dir)
|
|
transfer_fingerprints_to(new_light)
|
|
if(!QDELETED(cell))
|
|
new_light.cell = cell
|
|
cell.forceMove(new_light)
|
|
cell = null
|
|
qdel(src)
|
|
return
|
|
return ..()
|
|
|
|
/obj/structure/light_construct/blob_act(obj/structure/blob/attacking_blob)
|
|
if(attacking_blob && attacking_blob.loc == loc)
|
|
qdel(src)
|
|
|
|
/obj/structure/light_construct/deconstruct(disassembled = TRUE)
|
|
if(!(flags_1 & NODECONSTRUCT_1))
|
|
new /obj/item/stack/sheet/iron(loc, sheets_refunded)
|
|
qdel(src)
|
|
|
|
/obj/structure/light_construct/small
|
|
name = "small light fixture frame"
|
|
icon_state = "bulb-construct-stage1"
|
|
fixture_type = "bulb"
|
|
sheets_refunded = 1
|