mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-15 20:52:41 +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
135 lines
4.8 KiB
Plaintext
135 lines
4.8 KiB
Plaintext
#define CONSTRUCTION_UNANCHORED 0
|
|
#define CONSTRUCTION_WRENCHED 1
|
|
#define CONSTRUCTION_WELDED 2
|
|
|
|
/obj/structure/ladder_assembly
|
|
name = "ladder assembly"
|
|
icon = 'icons/obj/structures.dmi'
|
|
icon_state = "ladder00"
|
|
density = 0
|
|
opacity = 0
|
|
anchored = 0
|
|
w_class = ITEMSIZE_HUGE
|
|
|
|
var/state = 0
|
|
var/created_name = null
|
|
|
|
/obj/structure/ladder_assembly/attackby(obj/item/W, mob/user)
|
|
if(istype(W, /obj/item/weapon/pen))
|
|
var/t = sanitizeSafe(input(user, "Enter the name for the ladder.", "Ladder Name", src.created_name), MAX_NAME_LEN)
|
|
if(in_range(src, user))
|
|
created_name = t
|
|
return
|
|
|
|
if(W.is_wrench())
|
|
switch(state)
|
|
if(CONSTRUCTION_UNANCHORED)
|
|
state = CONSTRUCTION_WRENCHED
|
|
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
|
user.visible_message("\The [user] secures \the [src]'s reinforcing bolts.", \
|
|
"You secure the reinforcing bolts.", \
|
|
"You hear a ratchet")
|
|
src.anchored = 1
|
|
if(CONSTRUCTION_WRENCHED)
|
|
state = CONSTRUCTION_UNANCHORED
|
|
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
|
user.visible_message("\The [user] unsecures \the [src]'s reinforcing bolts.", \
|
|
"You undo the reinforcing bolts.", \
|
|
"You hear a ratchet")
|
|
src.anchored = 0
|
|
if(CONSTRUCTION_WELDED)
|
|
to_chat(user, "<span class='warning'>\The [src] needs to be unwelded.</span>")
|
|
return
|
|
|
|
if(istype(W, /obj/item/weapon/weldingtool))
|
|
var/obj/item/weapon/weldingtool/WT = W
|
|
switch(state)
|
|
if(CONSTRUCTION_UNANCHORED)
|
|
to_chat(user, "<span class='warning'>The refinforcing bolts need to be secured.</span>")
|
|
if(CONSTRUCTION_WRENCHED)
|
|
if(WT.remove_fuel(0, user))
|
|
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
|
|
user.visible_message("\The [user] starts to weld \the [src] to the floor.", \
|
|
"You start to weld \the [src] to the floor.", \
|
|
"You hear welding")
|
|
if(do_after(user, 2 SECONDS))
|
|
if(QDELETED(src) || !WT.isOn()) return
|
|
state = CONSTRUCTION_WELDED
|
|
to_chat(user, "You weld \the [src] to the floor.")
|
|
try_construct(user)
|
|
else
|
|
to_chat(user, "<span class='warning'>You need more welding fuel to complete this task.</span>")
|
|
if(CONSTRUCTION_WELDED)
|
|
if(WT.remove_fuel(0, user))
|
|
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
|
|
user.visible_message("\The [user] starts to cut \the [src] free from the floor.", \
|
|
"You start to cut \the [src] free from the floor.", \
|
|
"You hear welding")
|
|
if(do_after(user, 2 SECONDS))
|
|
if(QDELETED(src) || !WT.isOn()) return
|
|
state = CONSTRUCTION_WRENCHED
|
|
to_chat(user, "You cut \the [src] free from the floor.")
|
|
else
|
|
user << "<span class='warning'>You need more welding fuel to complete this task.</span>"
|
|
return
|
|
|
|
// Try to construct this into a real stairway.
|
|
// It must have a matching ladder assembly above and/or below, and both must be welded in place
|
|
// NOTE - Currently this design only supports three story tall ladders. Its fine for our map tho.
|
|
// A better way would search upwards until finding the top, then call a proc on that to build the string.
|
|
/obj/structure/ladder_assembly/proc/try_construct(mob/user)
|
|
var/obj/structure/ladder_assembly/below
|
|
var/obj/structure/ladder_assembly/above
|
|
|
|
for(var/direction in list(DOWN, UP))
|
|
var/turf/T = get_zstep(src, direction)
|
|
if(!T) continue
|
|
var/obj/structure/ladder_assembly/LA = locate(/obj/structure/ladder_assembly, T)
|
|
if(!LA) continue
|
|
if(LA.state != CONSTRUCTION_WELDED)
|
|
to_chat(user, "<span class='warning'>\The [LA] [direction == UP ? "above" : "below"] must be secured and welded.</span>")
|
|
return
|
|
if(direction == UP)
|
|
above = LA
|
|
if(direction == DOWN)
|
|
below = LA
|
|
|
|
if(!above && !below)
|
|
to_chat(user, "<span class='notice'>\The [src] is ready to be connected to from above or below.</span>")
|
|
return
|
|
|
|
// Construct them from bottom to top, because they initialize from top to bottom.
|
|
// If we made bottom last, nothing would initialize it.
|
|
var/obj/structure/ladder_assembly/me = src
|
|
src = null // So we can delete ourselves etc.
|
|
|
|
if(below)
|
|
var/obj/structure/ladder/L = new(get_turf(below))
|
|
L.allowed_directions = UP
|
|
if(below.created_name) L.name = below.created_name
|
|
L.initialize()
|
|
qdel(below)
|
|
|
|
if(me)
|
|
var/obj/structure/ladder/L = new(get_turf(me))
|
|
L.allowed_directions = (below ? DOWN : 0) | (above ? UP : 0)
|
|
if(me.created_name) L.name = me.created_name
|
|
L.initialize()
|
|
qdel(me)
|
|
|
|
if(above)
|
|
var/obj/structure/ladder/L = new(get_turf(above))
|
|
L.allowed_directions = DOWN
|
|
if(above.created_name) L.name = above.created_name
|
|
L.initialize()
|
|
qdel(above)
|
|
|
|
// Make them constructable in hand
|
|
/material/steel/generate_recipes()
|
|
..()
|
|
recipes += new/datum/stack_recipe("ladder assembly", /obj/structure/ladder_assembly, 4, time = 50, one_per_turf = 1, on_floor = 1)
|
|
|
|
#undef CONSTRUCTION_UNANCHORED
|
|
#undef CONSTRUCTION_WRENCHED
|
|
#undef CONSTRUCTION_WELDED
|