mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 19:22:56 +00:00
# Conflicts: # code/__defines/holomap.dm # code/__defines/mobs.dm # code/_helpers/icons.dm # code/_helpers/unsorted.dm # code/_onclick/hud/hud.dm # code/_onclick/item_attack.dm # code/controllers/Processes/supply.dm # code/controllers/subsystems/planets.dm # code/datums/supplypacks/munitions.dm # code/datums/supplypacks/science.dm # code/datums/supplypacks/security.dm # code/datums/supplypacks/supply.dm # code/game/area/Space Station 13 areas.dm # code/game/atoms_movable.dm # code/game/machinery/autolathe.dm # code/game/machinery/doors/door.dm # code/game/machinery/jukebox.dm # code/game/machinery/recharger.dm # code/game/machinery/vending.dm # code/game/mecha/equipment/tools/medical_tools.dm # code/game/mecha/equipment/weapons/weapons.dm # code/game/objects/items/devices/PDA/PDA.dm # code/game/objects/items/devices/megaphone.dm # code/game/objects/items/poi_items.dm # code/game/objects/items/weapons/implants/implantlanguage.dm # code/game/objects/items/weapons/storage/firstaid.dm # code/game/objects/items/weapons/tools/weldingtool.dm # code/game/objects/structures/flora/trees.dm # code/game/objects/structures/plasticflaps.dm # code/game/supplyshuttle.dm # code/game/turfs/simulated/wall_attacks.dm # code/modules/admin/admin_verbs.dm # code/modules/assembly/infrared.dm # code/modules/client/client procs.dm # code/modules/client/preference_setup/loadout/loadout_utility.dm # code/modules/client/preferences.dm # code/modules/clothing/suits/miscellaneous.dm # code/modules/holomap/holomap_datum.dm # code/modules/holomap/station_holomap.dm # code/modules/integrated_electronics/core/printer.dm # code/modules/mining/machine_processing.dm # code/modules/mob/living/carbon/human/human_defense.dm # code/modules/mob/living/carbon/human/species/virtual_reality/avatar.dm # code/modules/mob/living/death.dm # code/modules/mob/living/silicon/ai/ai.dm # code/modules/mob/living/silicon/pai/pai.dm # code/modules/mob/living/silicon/robot/robot.dm # code/modules/mob/living/simple_animal/animals/parrot.dm # code/modules/mob/mob_movement.dm # code/modules/organs/organ_external.dm # code/modules/organs/organ_icon.dm # code/modules/organs/subtypes/standard.dm # code/modules/planet/weather.dm # code/modules/power/cable.dm # code/modules/power/fusion/core/core_control.dm # code/modules/power/fusion/fuel_assembly/fuel_control.dm # code/modules/power/fusion/gyrotron/gyrotron_control.dm # code/modules/projectiles/gun.dm # code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Food-Drinks.dm # config/names/first_name_skrell.txt # config/names/last_name_skrell.txt # icons/mob/head.dmi # icons/mob/robots.dmi # icons/mob/species/tajaran/helmet.dmi # icons/obj/ammo.dmi # icons/obj/gun.dmi # icons/obj/mining.dmi # icons/obj/projectiles.dmi # icons/obj/rig_modules.dmi # icons/obj/surgery.dmi # icons/turf/walls.dmi # maps/southern_cross/southern_cross-1.dmm # maps/southern_cross/southern_cross-3.dmm # maps/southern_cross/southern_cross-6.dmm # maps/southern_cross/southern_cross-8.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1A.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1B.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1C.dmm # maps/submaps/surface_submaps/mountains/crashedcontainmentshuttle.dmm # maps/submaps/surface_submaps/mountains/deadspy.dmm # maps/submaps/surface_submaps/mountains/mountains_areas.dm # maps/submaps/surface_submaps/plains/Thiefc.dmm # maps/~map_system/maps.dm # vorestation.dme
174 lines
5.8 KiB
Plaintext
174 lines
5.8 KiB
Plaintext
//
|
|
// Lightswitch Construction
|
|
// Note: This does not use the normal frame.dm approach becuase:
|
|
// 1) That requires circuits, and I don't want a circuit board instance in every lightswitch.
|
|
// 2) This is an experiment in modernizing construction steps and examine tabs.
|
|
|
|
// The frame item in hand
|
|
/obj/item/frame/lightswitch
|
|
name = "light switch frame"
|
|
desc = "Used for building light switches."
|
|
icon = 'icons/obj/power_vr.dmi'
|
|
icon_state = "lightswitch-s1"
|
|
build_machine_type = /obj/structure/construction/lightswitch
|
|
refund_amt = 2
|
|
|
|
// The under construction light switch
|
|
/obj/structure/construction/lightswitch
|
|
name = "light switch frame"
|
|
desc = "A light switch under construction."
|
|
icon = 'icons/obj/power_vr.dmi'
|
|
icon_state = "lightswitch-s1"
|
|
base_icon = "lightswitch-s"
|
|
build_machine_type = /obj/machinery/light_switch
|
|
x_offset = 26
|
|
y_offset = 26
|
|
|
|
// Attackby on the lightswitch for deconstruction steps.
|
|
/obj/machinery/light_switch/attackby(obj/item/W, mob/user, params)
|
|
src.add_fingerprint(user)
|
|
if(default_deconstruction_screwdriver(user, W))
|
|
return
|
|
if(default_deconstruction_crowbar(user, W))
|
|
return
|
|
return ..()
|
|
|
|
/obj/machinery/light_switch/dismantle()
|
|
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
|
|
var/obj/structure/construction/lightswitch/A = new(src.loc, src.dir)
|
|
A.stage = FRAME_WIRED
|
|
A.pixel_x = pixel_x
|
|
A.pixel_y = pixel_y
|
|
A.update_icon()
|
|
qdel(src)
|
|
return 1
|
|
|
|
//
|
|
// Simple Construction Frame - Simpler than the full frame system for circuitless construction.
|
|
// If this works out well for light switches we can use it for other lightweight constructables.
|
|
//
|
|
|
|
/obj/structure/construction
|
|
name = "simple frame prototype"
|
|
desc = "This is a prototype object and you should not see it, report to a developer"
|
|
anchored = TRUE
|
|
var/base_icon = "something"
|
|
var/stage = FRAME_UNFASTENED
|
|
var/build_machine_type = null
|
|
var/x_offset = 26
|
|
var/y_offset = 26
|
|
|
|
/obj/structure/construction/initialize(var/mapload, var/ndir, var/building = FALSE)
|
|
. = ..()
|
|
if(ndir)
|
|
set_dir(ndir)
|
|
if(x_offset)
|
|
pixel_x = (dir & 3) ? 0 : (dir == EAST ? -x_offset : x_offset)
|
|
if(y_offset)
|
|
pixel_y = (dir & 3) ? (dir == NORTH ? -y_offset : y_offset) : 0
|
|
|
|
/obj/structure/construction/examine(mob/user)
|
|
if(!..(user, 2))
|
|
return
|
|
switch(stage)
|
|
if(FRAME_UNFASTENED)
|
|
to_chat(user, "It's an empty frame.")
|
|
if(FRAME_FASTENED)
|
|
to_chat(user, "It's fixed to the wall.")
|
|
if(FRAME_WIRED)
|
|
to_chat(user, "It's wired.")
|
|
|
|
/obj/structure/construction/update_icon()
|
|
icon_state = "[base_icon][stage]"
|
|
|
|
/obj/structure/construction/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
|
add_fingerprint(user)
|
|
if(W.is_welder())
|
|
if(stage == FRAME_UNFASTENED)
|
|
var/obj/item/weapon/weldingtool/WT = W
|
|
if(!WT.remove_fuel(0, user))
|
|
to_chat(user, "<span class='warning'>\The [src] must be on to complete this task.</span>")
|
|
return
|
|
playsound(src.loc, WT.usesound, 50, 1)
|
|
user.visible_message( \
|
|
"<span class='warning'>\The [user] begins deconstructing \the [src].</span>", \
|
|
"<span class='notice'>You start deconstructing \the [src].</span>")
|
|
if(do_after(user, 20 * WT.toolspeed, target = src) && WT.isOn())
|
|
new /obj/item/stack/material/steel(get_turf(src), 2)
|
|
user.visible_message( \
|
|
"<span class='warning'>\The [user] has deconstructed \the [src].</span>", \
|
|
"<span class='notice'>You deconstruct \the [src].</span>")
|
|
playsound(src.loc, 'sound/items/Deconstruct.ogg', 75, 1)
|
|
qdel(src)
|
|
else if (stage == FRAME_FASTENED)
|
|
to_chat(user, "You have to unscrew the case first.")
|
|
else if (stage == FRAME_WIRED)
|
|
to_chat(user, "You have to remove the wires first.")
|
|
return
|
|
|
|
else if(W.is_wirecutter())
|
|
if (stage == FRAME_WIRED)
|
|
stage = FRAME_FASTENED
|
|
user.update_examine_panel(src)
|
|
new /obj/item/stack/cable_coil(get_turf(src), 1, "red")
|
|
user.visible_message("\The [user] removes the wiring from \the [src].", \
|
|
"You remove the wiring from \the [src].", "You hear a snip.")
|
|
playsound(src.loc, W.usesound, 50, 1)
|
|
update_icon()
|
|
return
|
|
|
|
else if(W.is_cable_coil())
|
|
if (stage == FRAME_FASTENED)
|
|
var/obj/item/stack/cable_coil/coil = W
|
|
if (coil.use(1))
|
|
stage = FRAME_WIRED
|
|
user.update_examine_panel(src)
|
|
user.visible_message("\The [user] adds wires to \the [src].", \
|
|
"You add wires to \the [src].", "You hear a noise.")
|
|
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
|
|
update_icon()
|
|
return
|
|
|
|
else if(W.is_screwdriver())
|
|
if (stage == FRAME_UNFASTENED)
|
|
stage = FRAME_FASTENED
|
|
user.update_examine_panel(src)
|
|
user.visible_message("\The [user] screws \the [src] i nplace.", \
|
|
"You screw \the [src] in place.", "You hear a noise.")
|
|
playsound(src, W.usesound, 75, 1)
|
|
update_icon()
|
|
else if (stage == FRAME_FASTENED)
|
|
stage = FRAME_UNFASTENED
|
|
user.update_examine_panel(src)
|
|
user.visible_message("\The [user] unscrews \the [src].", \
|
|
"You unscrew \the [src].", "You hear a noise.")
|
|
playsound(src, W.usesound, 75, 1)
|
|
update_icon()
|
|
else if (stage == FRAME_WIRED)
|
|
user.visible_message("\The [user] closes \the [src]'s casing.", \
|
|
"You close \the [src]'s casing.", "You hear a click.")
|
|
playsound(src, W.usesound, 75, 1)
|
|
var/obj/newmachine = new build_machine_type(get_turf(src), src.dir)
|
|
newmachine.pixel_x = pixel_x
|
|
newmachine.pixel_y = pixel_y
|
|
transfer_fingerprints_to(newmachine)
|
|
qdel(src)
|
|
return
|
|
. = ..()
|
|
|
|
/obj/structure/construction/get_description_interaction()
|
|
. = list()
|
|
switch(stage)
|
|
if(FRAME_UNFASTENED)
|
|
. += list(
|
|
"[desc_panel_image("screwdriver")]to continue construction.",
|
|
"[desc_panel_image("welder")]to deconstruct.")
|
|
if(FRAME_FASTENED)
|
|
. += list(
|
|
"[desc_panel_image("cable coil")]to continue construction.",
|
|
"[desc_panel_image("screwdriver")]to reverse construction.")
|
|
if(FRAME_WIRED)
|
|
. += list(
|
|
"[desc_panel_image("screwdriver")]to finish construction.",
|
|
"[desc_panel_image("wirecutters")]to reverse construction.")
|