mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 04:22:39 +01:00
For a robust crafting system, I need a new materials framework. For a new materials framework, I need to clean up reagents. To clean up reagents, I need to pare down foods from reagent holders. To pare down foods from reagent holders, I need to port edibility components. To port edibility components, I need to port processing components. To port processing components, I need to port tool behaviors. This is all back-end code, no new features or functionality from this.
120 lines
3.9 KiB
Plaintext
120 lines
3.9 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/machinery/power/supply_beacon
|
|
var/deploy_time = 30
|
|
|
|
/obj/item/supply_beacon/supermatter
|
|
name = "inactive supermatter supply beacon"
|
|
deploy_path = /obj/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/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/machinery/power/supply_beacon/New()
|
|
..()
|
|
if(!drop_type) drop_type = pick(supply_drop_random_loot_types())
|
|
|
|
/obj/machinery/power/supply_beacon/supermatter
|
|
name = "supermatter supply beacon"
|
|
drop_type = "supermatter"
|
|
|
|
/obj/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/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/machinery/power/supply_beacon/attack_ai(var/mob/user)
|
|
if(user.Adjacent(src))
|
|
attack_hand(user)
|
|
|
|
/obj/machinery/power/supply_beacon/proc/activate(var/mob/user)
|
|
if(expended)
|
|
return
|
|
if(surplus() < 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/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/machinery/power/supply_beacon/Destroy()
|
|
if(use_power)
|
|
deactivate()
|
|
return ..()
|
|
|
|
/obj/machinery/power/supply_beacon/process()
|
|
if(expended)
|
|
return PROCESS_KILL
|
|
if(!use_power)
|
|
return
|
|
if(draw_power(500) < 500)
|
|
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/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.
|