mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-17 18:09:26 +01:00
Repaths obj/machinery to obj/structure/machinery. **Note for reviewers:** the only meaningful changed code exists within **code/game/objects/structures.dm** and **code/game/objects/structures/_machinery.dm**, largely concerning damage procs. With the exception of moving airlock defines to their own file, ALL OTHER CHANGES ARE STRICTLY PATH CHANGES. Objects, _categorically_, are largely divided between those you can hold in your hand/inventory and those you can't. Machinery objects are already subtypes of Structures behaviorally, this PR just makes their pathing reflect that, and allows for future work (tool actions, more health/destruction functionality) to be developed without unnecessary code duplication. I have tested this PR by loading up the Horizon and dismantling various machines and structures with tools, shooting guns of various types throughout the ship, and detonating a bunch of explosions throughout the ship.
122 lines
4.1 KiB
Plaintext
122 lines
4.1 KiB
Plaintext
// Used to deploy the bacon.
|
|
/obj/item/supply_beacon
|
|
name = "inactive supply beacon"
|
|
icon = 'icons/obj/supplybeacon.dmi'
|
|
desc = "An inactive, hacked supply beacon stamped with the Tau Ceti Rapid Fabrication logo. Good for one (1) ballistic supply pod shipment."
|
|
icon_state = "beacon"
|
|
var/deploy_path = /obj/structure/machinery/power/supply_beacon
|
|
var/deploy_time = 30
|
|
|
|
/obj/item/supply_beacon/supermatter
|
|
name = "inactive supermatter supply beacon"
|
|
deploy_path = /obj/structure/machinery/power/supply_beacon/supermatter
|
|
|
|
/obj/item/supply_beacon/attack_self(var/mob/user)
|
|
user.visible_message(SPAN_NOTICE("\The [user] begins setting up \the [src]."))
|
|
if(!do_after(user, deploy_time, src, DO_REPAIR_CONSTRUCT))
|
|
return
|
|
var/obj/S = new deploy_path(get_turf(user))
|
|
user.visible_message(SPAN_NOTICE("\The [user] deploys \the [S]."))
|
|
user.unEquip(src)
|
|
qdel(src)
|
|
|
|
/obj/structure/machinery/power/supply_beacon
|
|
name = "supply beacon"
|
|
desc = "A bulky moonshot supply beacon. Someone has been messing with the wiring."
|
|
icon = 'icons/obj/supplybeacon.dmi'
|
|
icon_state = "beacon"
|
|
|
|
anchored = 0
|
|
density = 1
|
|
stat = 0
|
|
|
|
var/target_drop_time
|
|
var/drop_delay = 450
|
|
var/expended
|
|
var/drop_type
|
|
|
|
/obj/structure/machinery/power/supply_beacon/New()
|
|
..()
|
|
if(!drop_type) drop_type = pick(supply_drop_random_loot_types())
|
|
|
|
/obj/structure/machinery/power/supply_beacon/supermatter
|
|
name = "supermatter supply beacon"
|
|
drop_type = "supermatter"
|
|
|
|
/obj/structure/machinery/power/supply_beacon/attackby(obj/item/attacking_item, mob/user)
|
|
if(!use_power && attacking_item.tool_behaviour == TOOL_WRENCH)
|
|
if(!anchored && !connect_to_network())
|
|
to_chat(user, SPAN_WARNING("This device must be placed over an exposed cable."))
|
|
return TRUE
|
|
anchored = !anchored
|
|
user.visible_message(SPAN_NOTICE("\The [user] [anchored ? "secures" : "unsecures"] \the [src]."))
|
|
attacking_item.play_tool_sound(get_turf(src), 50)
|
|
return TRUE
|
|
return ..()
|
|
|
|
/obj/structure/machinery/power/supply_beacon/attack_hand(var/mob/user)
|
|
|
|
if(expended)
|
|
update_use_power(POWER_USE_OFF)
|
|
to_chat(user, SPAN_WARNING("\The [src] has used up its charge."))
|
|
return
|
|
|
|
if(anchored)
|
|
return use_power ? deactivate(user) : activate(user)
|
|
else
|
|
to_chat(user, SPAN_WARNING("You need to secure the beacon with a wrench first!"))
|
|
return
|
|
|
|
/obj/structure/machinery/power/supply_beacon/attack_ai(var/mob/user)
|
|
if(user.Adjacent(src))
|
|
attack_hand(user)
|
|
|
|
/obj/structure/machinery/power/supply_beacon/proc/activate(var/mob/user)
|
|
if(expended)
|
|
return
|
|
if(POWER_SURPLUS(src) < 500)
|
|
if(user) to_chat(user, SPAN_NOTICE("The connected wire doesn't have enough current."))
|
|
return
|
|
set_light(3, 3, "#00CCAA")
|
|
icon_state = "beacon_active"
|
|
if(user) to_chat(user, SPAN_NOTICE("You activate the beacon. The supply drop will be dispatched soon."))
|
|
|
|
/obj/structure/machinery/power/supply_beacon/proc/deactivate(var/mob/user, var/permanent)
|
|
if(permanent)
|
|
expended = 1
|
|
icon_state = "beacon_depleted"
|
|
else
|
|
icon_state = "beacon"
|
|
set_light(0)
|
|
update_use_power(POWER_USE_OFF)
|
|
target_drop_time = null
|
|
if(user) to_chat(user, SPAN_NOTICE("You deactivate the beacon."))
|
|
|
|
/obj/structure/machinery/power/supply_beacon/Destroy()
|
|
if(use_power)
|
|
deactivate()
|
|
return ..()
|
|
|
|
/obj/structure/machinery/power/supply_beacon/process()
|
|
if(expended)
|
|
return PROCESS_KILL
|
|
if(!use_power)
|
|
return
|
|
var/can_draw = (POWER_DRAW(src, 500) >= 500)
|
|
DRAW_POWER(src, can_draw)
|
|
if(!can_draw)
|
|
deactivate()
|
|
return
|
|
if(!target_drop_time)
|
|
target_drop_time = world.time + drop_delay
|
|
else if(world.time >= target_drop_time)
|
|
deactivate(permanent = 1)
|
|
var/drop_x = src.x-2
|
|
var/drop_y = src.y-2
|
|
var/drop_z = src.z
|
|
command_announcement.Announce("Tau Ceti Rapid Fabrication priority supply request #[rand(1000,9999)]-[rand(100,999)] received. Shipment dispatched via ballistic supply pod for immediate delivery. Have a nice day.", "Thank You For Your Patronage")
|
|
addtimer(CALLBACK(src, PROC_REF(make_supply_beacon), drop_x, drop_y, drop_z), rand(10, 30) SECONDS)
|
|
|
|
/obj/structure/machinery/power/supply_beacon/proc/make_supply_beacon(drop_x, drop_y, drop_z)
|
|
new /datum/random_map/droppod/supply(null, drop_x, drop_y, drop_z, supplied_drop = drop_type) // Splat.
|