mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-23 04:51:32 +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.
86 lines
2.4 KiB
Plaintext
86 lines
2.4 KiB
Plaintext
//
|
|
// Tesla Beacon
|
|
//
|
|
|
|
/obj/machinery/power/tesla_beacon
|
|
name = "emergency tesla beacon"
|
|
desc = "A beacon that is designed to be used as last resort to contain a tesla reactor's energy ball. " + SPAN_DANGER("A one time use device.")
|
|
icon = 'icons/obj/tesla_beacon.dmi'
|
|
icon_state = "beacon_off"
|
|
anchored = FALSE
|
|
density = TRUE
|
|
|
|
var/active = FALSE
|
|
|
|
/obj/machinery/power/tesla_beacon/proc/activate(mob/user = null)
|
|
if(surplus() < 1500)
|
|
if(user) to_chat(user, SPAN_NOTICE("The connected wire doesn't have enough current."))
|
|
return
|
|
for(var/A in SScalamity.singularities)
|
|
var/obj/singularity/singulo = A
|
|
if(singulo.z == z)
|
|
singulo.target = src
|
|
icon_state = "beacon_on"
|
|
active = TRUE
|
|
START_PROCESSING_MACHINE(src, MACHINERY_PROCESS_SELF)
|
|
if(user)
|
|
to_chat(user, SPAN_NOTICE("You activate \the [src]."))
|
|
|
|
|
|
/obj/machinery/power/tesla_beacon/proc/deactivate(mob/user = null)
|
|
for(var/A in SScalamity.singularities)
|
|
var/obj/singularity/singulo = A
|
|
if(singulo.target == src)
|
|
singulo.target = null
|
|
icon_state = "beacon_off"
|
|
active = FALSE
|
|
STOP_PROCESSING_MACHINE(src, MACHINERY_PROCESS_SELF)
|
|
if(user)
|
|
to_chat(user, SPAN_NOTICE("You deactivate \the [src]."))
|
|
|
|
/obj/machinery/power/tesla_beacon/attack_ai(mob/user)
|
|
if(Adjacent(user))
|
|
return attack_hand(user)
|
|
else
|
|
to_chat(user, SPAN_WARNING("You need to be adjacent to \the [src] to activate it!"))
|
|
|
|
/obj/machinery/power/tesla_beacon/attack_hand(mob/user)
|
|
if(anchored)
|
|
return active ? deactivate(user) : activate(user)
|
|
else
|
|
to_chat(user, SPAN_WARNING("You need to screw \the [src] to the floor first!"))
|
|
return
|
|
|
|
/obj/machinery/power/tesla_beacon/attackby(obj/item/attacking_item, mob/user)
|
|
if(attacking_item.tool_behaviour == TOOL_SCREWDRIVER)
|
|
if(active)
|
|
to_chat(user, SPAN_WARNING("You need to deactivate \the [src] first!"))
|
|
return TRUE
|
|
|
|
if(anchored)
|
|
anchored = 0
|
|
to_chat(user, SPAN_NOTICE("You unscrew \the [src] from the floor."))
|
|
disconnect_from_network()
|
|
return TRUE
|
|
else
|
|
if(!connect_to_network())
|
|
to_chat(user, SPAN_NOTICE("\The [src] must be placed over an exposed cable."))
|
|
return TRUE
|
|
anchored = 1
|
|
to_chat(user, SPAN_NOTICE("You screw \the [src] to the floor and attach the cable."))
|
|
return TRUE
|
|
return ..()
|
|
|
|
/obj/machinery/power/tesla_beacon/Destroy()
|
|
if(active)
|
|
deactivate()
|
|
return ..()
|
|
|
|
//stealth direct power usage
|
|
/obj/machinery/power/tesla_beacon/process()
|
|
if(!active)
|
|
return PROCESS_KILL
|
|
else
|
|
if(draw_power(1500) < 1500)
|
|
deactivate()
|