merge from master
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
return ..()
|
||||
|
||||
//ATTACK HAND IGNORING PARENT RETURN VALUE
|
||||
/obj/machinery/field/containment/attack_hand(mob/user)
|
||||
/obj/machinery/field/containment/attack_hand(mob/user, act_intent = user.a_intent, unarmed_attack_flags)
|
||||
if(get_dist(src, user) > 1)
|
||||
return FALSE
|
||||
else
|
||||
|
||||
@@ -9,15 +9,17 @@
|
||||
idle_power_usage = 500
|
||||
active_power_usage = 10000
|
||||
dir = NORTH
|
||||
var/strength_upper_limit = 2
|
||||
var/interface_control = 1
|
||||
var/list/obj/structure/particle_accelerator/connected_parts
|
||||
var/assembled = 0
|
||||
var/construction_state = PA_CONSTRUCTION_UNSECURED
|
||||
var/active = 0
|
||||
var/strength = 0
|
||||
var/powered = 0
|
||||
mouse_opacity = MOUSE_OPACITY_OPAQUE
|
||||
ui_x = 350
|
||||
ui_y = 185
|
||||
var/strength_upper_limit = 2
|
||||
var/interface_control = TRUE
|
||||
var/list/obj/structure/particle_accelerator/connected_parts
|
||||
var/assembled = FALSE
|
||||
var/construction_state = PA_CONSTRUCTION_UNSECURED
|
||||
var/active = FALSE
|
||||
var/strength = 0
|
||||
var/powered = FALSE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/Initialize()
|
||||
. = ..()
|
||||
@@ -34,30 +36,27 @@
|
||||
QDEL_NULL(wires)
|
||||
return ..()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/attack_hand(mob/user)
|
||||
/obj/machinery/particle_accelerator/control_box/multitool_act(mob/living/user, obj/item/I)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
if(construction_state == PA_CONSTRUCTION_COMPLETE)
|
||||
interact(user)
|
||||
else if(construction_state == PA_CONSTRUCTION_PANEL_OPEN)
|
||||
if(construction_state == PA_CONSTRUCTION_PANEL_OPEN)
|
||||
wires.interact(user)
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/update_state()
|
||||
if(construction_state < PA_CONSTRUCTION_COMPLETE)
|
||||
use_power = NO_POWER_USE
|
||||
assembled = 0
|
||||
active = 0
|
||||
assembled = FALSE
|
||||
active = FALSE
|
||||
for(var/CP in connected_parts)
|
||||
var/obj/structure/particle_accelerator/part = CP
|
||||
part.strength = null
|
||||
part.powered = 0
|
||||
part.powered = FALSE
|
||||
part.update_icon()
|
||||
connected_parts.Cut()
|
||||
return
|
||||
if(!part_scan())
|
||||
use_power = IDLE_POWER_USE
|
||||
active = 0
|
||||
active = FALSE
|
||||
connected_parts.Cut()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/update_icon_state()
|
||||
@@ -78,36 +77,6 @@
|
||||
else
|
||||
icon_state = "control_boxc"
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
|
||||
if(!interface_control)
|
||||
to_chat(usr, "<span class='error'>ERROR: Request timed out. Check wire contacts.</span>")
|
||||
return
|
||||
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=pacontrol")
|
||||
usr.unset_machine()
|
||||
return
|
||||
if(href_list["togglep"])
|
||||
if(!wires.is_cut(WIRE_POWER))
|
||||
toggle_power()
|
||||
|
||||
else if(href_list["scan"])
|
||||
part_scan()
|
||||
|
||||
else if(href_list["strengthup"])
|
||||
if(!wires.is_cut(WIRE_STRENGTH))
|
||||
add_strength()
|
||||
|
||||
else if(href_list["strengthdown"])
|
||||
if(!wires.is_cut(WIRE_STRENGTH))
|
||||
remove_strength()
|
||||
|
||||
updateDialog()
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/strength_change()
|
||||
for(var/CP in connected_parts)
|
||||
var/obj/structure/particle_accelerator/part = CP
|
||||
@@ -123,7 +92,6 @@
|
||||
log_game("PA Control Computer increased to [strength] by [key_name(usr)] in [AREACOORD(src)]")
|
||||
investigate_log("increased to <font color='red'>[strength]</font> by [key_name(usr)] at [AREACOORD(src)]", INVESTIGATE_SINGULO)
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/remove_strength(s)
|
||||
if(assembled && (strength > 0))
|
||||
strength--
|
||||
@@ -133,11 +101,10 @@
|
||||
log_game("PA Control Computer decreased to [strength] by [key_name(usr)] in [AREACOORD(src)]")
|
||||
investigate_log("decreased to <font color='green'>[strength]</font> by [key_name(usr)] at [AREACOORD(src)]", INVESTIGATE_SINGULO)
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/power_change()
|
||||
..()
|
||||
. = ..()
|
||||
if(stat & NOPOWER)
|
||||
active = 0
|
||||
active = FALSE
|
||||
use_power = NO_POWER_USE
|
||||
else if(!stat && construction_state == PA_CONSTRUCTION_COMPLETE)
|
||||
use_power = IDLE_POWER_USE
|
||||
@@ -160,49 +127,48 @@
|
||||
var/odir = turn(dir,180)
|
||||
var/turf/T = loc
|
||||
|
||||
assembled = 0
|
||||
assembled = FALSE
|
||||
critical_machine = FALSE
|
||||
|
||||
var/obj/structure/particle_accelerator/fuel_chamber/F = locate() in orange(1,src)
|
||||
if(!F)
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
setDir(F.dir)
|
||||
connected_parts.Cut()
|
||||
|
||||
T = get_step(T,rdir)
|
||||
if(!check_part(T, /obj/structure/particle_accelerator/fuel_chamber))
|
||||
return 0
|
||||
return FALSE
|
||||
T = get_step(T,odir)
|
||||
if(!check_part(T, /obj/structure/particle_accelerator/end_cap))
|
||||
return 0
|
||||
return FALSE
|
||||
T = get_step(T,dir)
|
||||
T = get_step(T,dir)
|
||||
if(!check_part(T, /obj/structure/particle_accelerator/power_box))
|
||||
return 0
|
||||
return FALSE
|
||||
T = get_step(T,dir)
|
||||
if(!check_part(T, /obj/structure/particle_accelerator/particle_emitter/center))
|
||||
return 0
|
||||
return FALSE
|
||||
T = get_step(T,ldir)
|
||||
if(!check_part(T, /obj/structure/particle_accelerator/particle_emitter/left))
|
||||
return 0
|
||||
return FALSE
|
||||
T = get_step(T,rdir)
|
||||
T = get_step(T,rdir)
|
||||
if(!check_part(T, /obj/structure/particle_accelerator/particle_emitter/right))
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
assembled = 1
|
||||
assembled = TRUE
|
||||
critical_machine = TRUE //Only counts if the PA is actually assembled.
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/check_part(turf/T, type)
|
||||
var/obj/structure/particle_accelerator/PA = locate(/obj/structure/particle_accelerator) in T
|
||||
if(istype(PA, type) && (PA.construction_state == PA_CONSTRUCTION_COMPLETE))
|
||||
if(PA.connect_master(src))
|
||||
connected_parts.Add(PA)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/toggle_power()
|
||||
active = !active
|
||||
@@ -214,47 +180,16 @@
|
||||
for(var/CP in connected_parts)
|
||||
var/obj/structure/particle_accelerator/part = CP
|
||||
part.strength = strength
|
||||
part.powered = 1
|
||||
part.powered = TRUE
|
||||
part.update_icon()
|
||||
else
|
||||
use_power = IDLE_POWER_USE
|
||||
for(var/CP in connected_parts)
|
||||
var/obj/structure/particle_accelerator/part = CP
|
||||
part.strength = null
|
||||
part.powered = 0
|
||||
part.powered = FALSE
|
||||
part.update_icon()
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/ui_interact(mob/user)
|
||||
. = ..()
|
||||
if((get_dist(src, user) > 1) || (stat & (BROKEN|NOPOWER)))
|
||||
if(!issilicon(user))
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=pacontrol")
|
||||
return
|
||||
|
||||
var/dat = ""
|
||||
dat += "<A href='?src=[REF(src)];close=1'>Close</A><BR><BR>"
|
||||
dat += "<h3>Status</h3>"
|
||||
if(!assembled)
|
||||
dat += "Unable to detect all parts!<BR>"
|
||||
dat += "<A href='?src=[REF(src)];scan=1'>Run Scan</A><BR><BR>"
|
||||
else
|
||||
dat += "All parts in place.<BR><BR>"
|
||||
dat += "Power:"
|
||||
if(active)
|
||||
dat += "On<BR>"
|
||||
else
|
||||
dat += "Off <BR>"
|
||||
dat += "<A href='?src=[REF(src)];togglep=1'>Toggle Power</A><BR><BR>"
|
||||
dat += "Particle Strength: [strength] "
|
||||
dat += "<A href='?src=[REF(src)];strengthdown=1'>--</A>|<A href='?src=[REF(src)];strengthup=1'>++</A><BR><BR>"
|
||||
|
||||
var/datum/browser/popup = new(user, "pacontrol", name, 420, 300)
|
||||
popup.set_content(dat)
|
||||
popup.set_title_image(user.browse_rsc_icon(icon, icon_state))
|
||||
popup.open()
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/examine(mob/user)
|
||||
. = ..()
|
||||
@@ -266,48 +201,47 @@
|
||||
if(PA_CONSTRUCTION_PANEL_OPEN)
|
||||
. += "The panel is open."
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/attackby(obj/item/W, mob/user, params)
|
||||
var/did_something = FALSE
|
||||
|
||||
switch(construction_state)
|
||||
if(PA_CONSTRUCTION_UNSECURED)
|
||||
if(istype(W, /obj/item/wrench) && !isinspace())
|
||||
if(W.tool_behaviour == TOOL_WRENCH && !isinspace())
|
||||
W.play_tool_sound(src, 75)
|
||||
anchored = TRUE
|
||||
user.visible_message("[user.name] secures the [name] to the floor.", \
|
||||
"You secure the external bolts.")
|
||||
user.visible_message("<span class='notice'>[user.name] secures the [name] to the floor.</span>", \
|
||||
"<span class='notice'>You secure the external bolts.</span>")
|
||||
construction_state = PA_CONSTRUCTION_UNWIRED
|
||||
did_something = TRUE
|
||||
if(PA_CONSTRUCTION_UNWIRED)
|
||||
if(istype(W, /obj/item/wrench))
|
||||
if(W.tool_behaviour == TOOL_WRENCH)
|
||||
W.play_tool_sound(src, 75)
|
||||
anchored = FALSE
|
||||
user.visible_message("[user.name] detaches the [name] from the floor.", \
|
||||
"You remove the external bolts.")
|
||||
user.visible_message("<span class='notice'>[user.name] detaches the [name] from the floor.</span>", \
|
||||
"<span class='notice'>You remove the external bolts.</span>")
|
||||
construction_state = PA_CONSTRUCTION_UNSECURED
|
||||
did_something = TRUE
|
||||
else if(istype(W, /obj/item/stack/cable_coil))
|
||||
if(W.use_tool(src, user, 0, 1))
|
||||
user.visible_message("[user.name] adds wires to the [name].", \
|
||||
"You add some wires.")
|
||||
user.visible_message("<span class='notice'>[user.name] adds wires to the [name].</span>", \
|
||||
"<span class='notice'>You add some wires.</span>")
|
||||
construction_state = PA_CONSTRUCTION_PANEL_OPEN
|
||||
did_something = TRUE
|
||||
if(PA_CONSTRUCTION_PANEL_OPEN)
|
||||
if(istype(W, /obj/item/wirecutters))//TODO:Shock user if its on?
|
||||
user.visible_message("[user.name] removes some wires from the [name].", \
|
||||
"You remove some wires.")
|
||||
if(W.tool_behaviour == TOOL_WIRECUTTER)//TODO:Shock user if its on?
|
||||
user.visible_message("<span class='notice'>[user.name] removes some wires from the [name].</span>", \
|
||||
"<span class='notice'>You remove some wires.</span>")
|
||||
construction_state = PA_CONSTRUCTION_UNWIRED
|
||||
did_something = TRUE
|
||||
else if(istype(W, /obj/item/screwdriver))
|
||||
user.visible_message("[user.name] closes the [name]'s access panel.", \
|
||||
"You close the access panel.")
|
||||
else if(W.tool_behaviour == TOOL_SCREWDRIVER)
|
||||
user.visible_message("<span class='notice'>[user.name] closes the [name]'s access panel.</span>", \
|
||||
"<span class='notice'>You close the access panel.</span>")
|
||||
construction_state = PA_CONSTRUCTION_COMPLETE
|
||||
did_something = TRUE
|
||||
if(PA_CONSTRUCTION_COMPLETE)
|
||||
if(istype(W, /obj/item/screwdriver))
|
||||
user.visible_message("[user.name] opens the [name]'s access panel.", \
|
||||
"You open the access panel.")
|
||||
if(W.tool_behaviour == TOOL_SCREWDRIVER)
|
||||
user.visible_message("<span class='notice'>[user.name] opens the [name]'s access panel.</span>", \
|
||||
"<span class='notice'>You open the access panel.</span>")
|
||||
construction_state = PA_CONSTRUCTION_PANEL_OPEN
|
||||
did_something = TRUE
|
||||
|
||||
@@ -323,6 +257,65 @@
|
||||
if(prob(50))
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/interact(mob/user)
|
||||
if(construction_state == PA_CONSTRUCTION_PANEL_OPEN)
|
||||
wires.interact(user)
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/is_interactive(mob/user)
|
||||
if(!interface_control)
|
||||
to_chat(user, "<span class='alert'>ERROR: Request timed out. Check wire contacts.</span>")
|
||||
return FALSE
|
||||
if(construction_state != PA_CONSTRUCTION_COMPLETE)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/ui_status(mob/user)
|
||||
if(is_interactive(user))
|
||||
return ..()
|
||||
return UI_CLOSE
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "ParticleAccelerator", name, ui_x, ui_y, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["assembled"] = assembled
|
||||
data["power"] = active
|
||||
data["strength"] = strength
|
||||
return data
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("power")
|
||||
if(wires.is_cut(WIRE_POWER))
|
||||
return
|
||||
toggle_power()
|
||||
. = TRUE
|
||||
if("scan")
|
||||
part_scan()
|
||||
. = TRUE
|
||||
if("add_strength")
|
||||
if(wires.is_cut(WIRE_STRENGTH))
|
||||
return
|
||||
add_strength()
|
||||
. = TRUE
|
||||
if("remove_strength")
|
||||
if(wires.is_cut(WIRE_STRENGTH))
|
||||
return
|
||||
remove_strength()
|
||||
. = TRUE
|
||||
|
||||
update_icon()
|
||||
|
||||
#undef PA_CONSTRUCTION_UNSECURED
|
||||
#undef PA_CONSTRUCTION_UNWIRED
|
||||
#undef PA_CONSTRUCTION_PANEL_OPEN
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
last_failed_movement = direct
|
||||
return 0
|
||||
|
||||
/obj/singularity/attack_hand(mob/user)
|
||||
/obj/singularity/attack_hand(mob/user, act_intent = user.a_intent, unarmed_attack_flags)
|
||||
consume(user)
|
||||
return TRUE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user