mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 11:37:40 +01:00
Merge pull request #6025 from KasparoVy/fixes-ordered-PAs-and-moving-machines
Fixes Cargo-ordered PAs and Wrenching-down Machines in Powered/Powerless Areas
This commit is contained in:
@@ -154,7 +154,7 @@ Class Procs:
|
||||
if(use_power && stat == 0)
|
||||
use_power(7500/severity)
|
||||
|
||||
new/obj/effect/overlay/temp/emp(src.loc)
|
||||
new/obj/effect/overlay/temp/emp(loc)
|
||||
..()
|
||||
|
||||
/obj/machinery/ex_act(severity)
|
||||
@@ -184,9 +184,9 @@ Class Procs:
|
||||
/obj/machinery/proc/auto_use_power()
|
||||
if(!powered(power_channel))
|
||||
return 0
|
||||
if(src.use_power == 1)
|
||||
if(use_power == 1)
|
||||
use_power(idle_power_usage,power_channel, 1)
|
||||
else if(src.use_power >= 2)
|
||||
else if(use_power >= 2)
|
||||
use_power(active_power_usage,power_channel, 1)
|
||||
return 1
|
||||
|
||||
@@ -229,7 +229,7 @@ Class Procs:
|
||||
if(!(href_list["set_tag"] in vars))
|
||||
to_chat(usr, "<span class='warning'>Something went wrong: Unable to find [href_list["set_tag"]] in vars!</span>")
|
||||
return 1
|
||||
var/current_tag = src.vars[href_list["set_tag"]]
|
||||
var/current_tag = vars[href_list["set_tag"]]
|
||||
var/newid = copytext(reject_bad_text(input(usr, "Specify the new value", src, current_tag) as null|text),1,MAX_MESSAGE_LEN)
|
||||
if(newid)
|
||||
vars[href_list["set_tag"]] = newid
|
||||
@@ -355,13 +355,13 @@ Class Procs:
|
||||
return 1
|
||||
|
||||
if(panel_open)
|
||||
src.add_fingerprint(user)
|
||||
add_fingerprint(user)
|
||||
return 0
|
||||
|
||||
if(!interact_offline && stat & (NOPOWER|BROKEN|MAINT))
|
||||
return 1
|
||||
|
||||
src.add_fingerprint(user)
|
||||
add_fingerprint(user)
|
||||
|
||||
return ..()
|
||||
|
||||
@@ -379,8 +379,8 @@ Class Procs:
|
||||
|
||||
/obj/machinery/proc/default_deconstruction_crowbar(var/obj/item/weapon/crowbar/C, var/ignore_panel = 0)
|
||||
if(istype(C) && (panel_open || ignore_panel))
|
||||
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
|
||||
var/obj/machinery/constructable_frame/machine_frame/M = new /obj/machinery/constructable_frame/machine_frame(src.loc)
|
||||
playsound(loc, 'sound/items/Crowbar.ogg', 50, 1)
|
||||
var/obj/machinery/constructable_frame/machine_frame/M = new /obj/machinery/constructable_frame/machine_frame(loc)
|
||||
M.state = 2
|
||||
M.icon_state = "box_1"
|
||||
for(var/obj/item/I in component_parts)
|
||||
@@ -393,7 +393,7 @@ Class Procs:
|
||||
|
||||
/obj/machinery/proc/default_deconstruction_screwdriver(var/mob/user, var/icon_state_open, var/icon_state_closed, var/obj/item/weapon/screwdriver/S)
|
||||
if(istype(S))
|
||||
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
|
||||
playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1)
|
||||
if(!panel_open)
|
||||
panel_open = 1
|
||||
icon_state = icon_state_open
|
||||
@@ -407,7 +407,7 @@ Class Procs:
|
||||
|
||||
/obj/machinery/proc/default_change_direction_wrench(var/mob/user, var/obj/item/weapon/wrench/W)
|
||||
if(panel_open && istype(W))
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
dir = turn(dir,-90)
|
||||
to_chat(user, "<span class='notice'>You rotate [src].</span>")
|
||||
return 1
|
||||
@@ -416,11 +416,14 @@ Class Procs:
|
||||
/obj/proc/default_unfasten_wrench(mob/user, obj/item/weapon/wrench/W, time = 20)
|
||||
if(istype(W))
|
||||
to_chat(user, "<span class='notice'>Now [anchored ? "un" : ""]securing [name].</span>")
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
|
||||
if(do_after(user, time, target = src))
|
||||
to_chat(user, "<span class='notice'>You've [anchored ? "un" : ""]secured [name].</span>")
|
||||
anchored = !anchored
|
||||
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
if(istype(src, /obj/machinery))
|
||||
var/obj/machinery/M = src
|
||||
M.power_change() //Turn on or off the machine depending on the status of power in the new area.
|
||||
playsound(loc, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
@@ -506,7 +509,7 @@ Class Procs:
|
||||
if(check_access && !allowed(perp))
|
||||
threatcount += 4
|
||||
|
||||
if(auth_weapons && !src.allowed(perp))
|
||||
if(auth_weapons && !allowed(perp))
|
||||
if(istype(perp.l_hand, /obj/item/weapon/gun) || istype(perp.l_hand, /obj/item/weapon/melee))
|
||||
threatcount += 4
|
||||
|
||||
|
||||
@@ -95,10 +95,10 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
|
||||
|
||||
if(usr.stat || !usr.canmove || usr.restrained())
|
||||
return
|
||||
if(src.anchored)
|
||||
if(anchored)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.dir = turn(src.dir, 270)
|
||||
dir = turn(dir, 270)
|
||||
return 1
|
||||
|
||||
/obj/structure/particle_accelerator/AltClick(mob/user)
|
||||
@@ -116,29 +116,29 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
|
||||
|
||||
if(usr.stat || !usr.canmove || usr.restrained())
|
||||
return
|
||||
if(src.anchored)
|
||||
if(anchored)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.dir = turn(src.dir, 90)
|
||||
dir = turn(dir, 90)
|
||||
return 1
|
||||
|
||||
/obj/structure/particle_accelerator/examine(mob/user)
|
||||
switch(src.construction_state)
|
||||
switch(construction_state)
|
||||
if(0)
|
||||
src.desc = text("A [name], looks like it's not attached to the flooring")
|
||||
desc = text("A [name], looks like it's not attached to the flooring")
|
||||
if(1)
|
||||
src.desc = text("A [name], it is missing some cables")
|
||||
desc = text("A [name], it is missing some cables")
|
||||
if(2)
|
||||
src.desc = text("A [name], the panel is open")
|
||||
desc = text("A [name], the panel is open")
|
||||
if(3)
|
||||
src.desc = text("The [name] is assembled")
|
||||
desc = text("The [name] is assembled")
|
||||
if(powered)
|
||||
src.desc = src.desc_holder
|
||||
desc = desc_holder
|
||||
..(user)
|
||||
|
||||
/obj/structure/particle_accelerator/attackby(obj/item/W, mob/user, params)
|
||||
if(istool(W))
|
||||
if(src.process_tool_hit(W,user))
|
||||
if(process_tool_hit(W,user))
|
||||
return
|
||||
..()
|
||||
return
|
||||
@@ -208,7 +208,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
|
||||
|
||||
/obj/structure/particle_accelerator/proc/connect_master(var/obj/O)
|
||||
if(O && istype(O,/obj/machinery/particle_accelerator/control_box))
|
||||
if(O.dir == src.dir)
|
||||
if(O.dir == dir)
|
||||
master = O
|
||||
return 1
|
||||
return 0
|
||||
@@ -219,51 +219,51 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
|
||||
return 0
|
||||
if(!ismob(user) || !isobj(O))
|
||||
return 0
|
||||
var/temp_state = src.construction_state
|
||||
var/temp_state = construction_state
|
||||
|
||||
switch(src.construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps
|
||||
switch(construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps
|
||||
if(0)
|
||||
if(iswrench(O) && !isinspace())
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
src.anchored = 1
|
||||
user.visible_message("[user.name] secures the [src.name] to the floor.", \
|
||||
playsound(loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
anchored = 1
|
||||
user.visible_message("[user.name] secures the [name] to the floor.", \
|
||||
"You secure the external bolts.")
|
||||
temp_state++
|
||||
if(1)
|
||||
if(iswrench(O))
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
src.anchored = 0
|
||||
user.visible_message("[user.name] detaches the [src.name] from the floor.", \
|
||||
playsound(loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
anchored = 0
|
||||
user.visible_message("[user.name] detaches the [name] from the floor.", \
|
||||
"You remove the external bolts.")
|
||||
temp_state--
|
||||
else if(iscoil(O))
|
||||
var/obj/item/stack/cable_coil/C = O
|
||||
if(C.use(1))
|
||||
user.visible_message("[user.name] adds wires to the [src.name].", \
|
||||
user.visible_message("[user.name] adds wires to the [name].", \
|
||||
"You add some wires.")
|
||||
temp_state++
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need one length of cable to wire the [src.name]!</span>")
|
||||
to_chat(user, "<span class='warning'>You need one length of cable to wire the [name]!</span>")
|
||||
return
|
||||
if(2)
|
||||
if(iswirecutter(O))//TODO:Shock user if its on?
|
||||
user.visible_message("[user.name] removes some wires from the [src.name].", \
|
||||
user.visible_message("[user.name] removes some wires from the [name].", \
|
||||
"You remove some wires.")
|
||||
temp_state--
|
||||
else if(isscrewdriver(O))
|
||||
user.visible_message("[user.name] closes the [src.name]'s access panel.", \
|
||||
user.visible_message("[user.name] closes the [name]'s access panel.", \
|
||||
"You close the access panel.")
|
||||
temp_state++
|
||||
if(3)
|
||||
if(isscrewdriver(O))
|
||||
user.visible_message("[user.name] opens the [src.name]'s access panel.", \
|
||||
user.visible_message("[user.name] opens the [name]'s access panel.", \
|
||||
"You open the access panel.")
|
||||
temp_state--
|
||||
if(temp_state == src.construction_state)//Nothing changed
|
||||
if(temp_state == construction_state)//Nothing changed
|
||||
return 0
|
||||
else
|
||||
src.construction_state = temp_state
|
||||
if(src.construction_state < 3)//Was taken apart, update state
|
||||
construction_state = temp_state
|
||||
if(construction_state < 3)//Was taken apart, update state
|
||||
update_state()
|
||||
update_icon()
|
||||
return 1
|
||||
@@ -296,10 +296,10 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
|
||||
|
||||
if(usr.stat || !usr.canmove || usr.restrained())
|
||||
return
|
||||
if(src.anchored)
|
||||
if(anchored)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.dir = turn(src.dir, 270)
|
||||
dir = turn(dir, 270)
|
||||
return 1
|
||||
|
||||
/obj/machinery/particle_accelerator/verb/rotateccw()
|
||||
@@ -309,10 +309,10 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
|
||||
|
||||
if(usr.stat || !usr.canmove || usr.restrained())
|
||||
return
|
||||
if(src.anchored)
|
||||
if(anchored)
|
||||
to_chat(usr, "It is fastened to the floor!")
|
||||
return 0
|
||||
src.dir = turn(src.dir, 90)
|
||||
dir = turn(dir, 90)
|
||||
return 1
|
||||
|
||||
/obj/machinery/particle_accelerator/update_icon()
|
||||
@@ -320,7 +320,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
|
||||
|
||||
/obj/machinery/particle_accelerator/attackby(obj/item/W, mob/user, params)
|
||||
if(istool(W))
|
||||
if(src.process_tool_hit(W,user))
|
||||
if(process_tool_hit(W,user))
|
||||
return
|
||||
..()
|
||||
return
|
||||
@@ -357,51 +357,53 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
|
||||
return 0
|
||||
if(!ismob(user) || !isobj(O))
|
||||
return 0
|
||||
var/temp_state = src.construction_state
|
||||
switch(src.construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps
|
||||
var/temp_state = construction_state
|
||||
switch(construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps
|
||||
if(0)
|
||||
if(iswrench(O))
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
src.anchored = 1
|
||||
user.visible_message("[user.name] secures the [src.name] to the floor.", \
|
||||
playsound(loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
anchored = 1
|
||||
user.visible_message("[user.name] secures the [name] to the floor.", \
|
||||
"You secure the external bolts.")
|
||||
temp_state++
|
||||
power_change()
|
||||
if(1)
|
||||
if(iswrench(O))
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
src.anchored = 0
|
||||
user.visible_message("[user.name] detaches the [src.name] from the floor.", \
|
||||
playsound(loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
anchored = 0
|
||||
user.visible_message("[user.name] detaches the [name] from the floor.", \
|
||||
"You remove the external bolts.")
|
||||
temp_state--
|
||||
power_change()
|
||||
else if(iscoil(O))
|
||||
if(O:use(1))
|
||||
user.visible_message("[user.name] adds wires to the [src.name].", \
|
||||
user.visible_message("[user.name] adds wires to the [name].", \
|
||||
"You add some wires.")
|
||||
temp_state++
|
||||
if(2)
|
||||
if(iswirecutter(O))//TODO:Shock user if its on?
|
||||
user.visible_message("[user.name] removes some wires from the [src.name].", \
|
||||
user.visible_message("[user.name] removes some wires from the [name].", \
|
||||
"You remove some wires.")
|
||||
temp_state--
|
||||
else if(isscrewdriver(O))
|
||||
user.visible_message("[user.name] closes the [src.name]'s access panel.", \
|
||||
user.visible_message("[user.name] closes the [name]'s access panel.", \
|
||||
"You close the access panel.")
|
||||
temp_state++
|
||||
if(3)
|
||||
if(isscrewdriver(O))
|
||||
user.visible_message("[user.name] opens the [src.name]'s access panel.", \
|
||||
user.visible_message("[user.name] opens the [name]'s access panel.", \
|
||||
"You open the access panel.")
|
||||
temp_state--
|
||||
active = 0
|
||||
if(temp_state == src.construction_state)//Nothing changed
|
||||
if(temp_state == construction_state)//Nothing changed
|
||||
return 0
|
||||
else
|
||||
if(src.construction_state < 3)//Was taken apart, update state
|
||||
if(construction_state < 3)//Was taken apart, update state
|
||||
update_state()
|
||||
if(use_power)
|
||||
use_power = 0
|
||||
src.construction_state = temp_state
|
||||
if(src.construction_state >= 3)
|
||||
construction_state = temp_state
|
||||
if(construction_state >= 3)
|
||||
use_power = 1
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
/obj/machinery/particle_accelerator/control_box/New()
|
||||
wires = new(src)
|
||||
connected_parts = list()
|
||||
update_icon()
|
||||
..()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/Destroy()
|
||||
@@ -34,7 +35,7 @@
|
||||
return ..()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/attack_ghost(user as mob)
|
||||
return src.attack_hand(user)
|
||||
return attack_hand(user)
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/attack_hand(mob/user as mob)
|
||||
if(construction_state >= 3)
|
||||
@@ -62,9 +63,12 @@
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/update_icon()
|
||||
if(active)
|
||||
icon_state = "[reference]p1"
|
||||
icon_state = "[reference]p[strength]"
|
||||
else
|
||||
if(use_power)
|
||||
if(stat & NOPOWER)
|
||||
icon_state = "[reference]w"
|
||||
return
|
||||
else if(use_power)
|
||||
if(assembled)
|
||||
icon_state = "[reference]p"
|
||||
else
|
||||
@@ -89,16 +93,16 @@
|
||||
to_chat(usr, "<span class='error'>ERROR: Request timed out. Check wire contacts.</span>")
|
||||
return
|
||||
|
||||
if( href_list["close"] )
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=pacontrol")
|
||||
usr.unset_machine()
|
||||
return
|
||||
if(href_list["togglep"])
|
||||
if(!wires.IsIndexCut(PARTICLE_TOGGLE_WIRE))
|
||||
src.toggle_power()
|
||||
toggle_power()
|
||||
|
||||
else if(href_list["scan"])
|
||||
src.part_scan()
|
||||
part_scan()
|
||||
|
||||
else if(href_list["strengthup"])
|
||||
if(!wires.IsIndexCut(PARTICLE_STRENGTH_WIRE))
|
||||
@@ -108,8 +112,8 @@
|
||||
if(!wires.IsIndexCut(PARTICLE_STRENGTH_WIRE))
|
||||
remove_strength()
|
||||
|
||||
src.updateDialog()
|
||||
src.update_icon()
|
||||
updateDialog()
|
||||
update_icon()
|
||||
return
|
||||
|
||||
|
||||
@@ -152,32 +156,39 @@
|
||||
use_power = 0
|
||||
else if(!stat && construction_state <= 3)
|
||||
use_power = 1
|
||||
update_icon()
|
||||
|
||||
if((stat & NOPOWER) || (!stat && construction_state <= 3)) //Only update the part icons if something's changed (i.e. any of the above condition sets are met).
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = null
|
||||
part.powered = 0
|
||||
part.update_icon()
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/process()
|
||||
if(src.active)
|
||||
if(active)
|
||||
//a part is missing!
|
||||
if( length(connected_parts) < 6 )
|
||||
if(length(connected_parts) < 6)
|
||||
investigate_log("lost a connected part; It <font color='red'>powered down</font>.","singulo")
|
||||
src.toggle_power()
|
||||
toggle_power()
|
||||
return
|
||||
//emit some particles
|
||||
for(var/obj/structure/particle_accelerator/particle_emitter/PE in connected_parts)
|
||||
if(PE)
|
||||
PE.emit_particle(src.strength)
|
||||
PE.emit_particle(strength)
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/part_scan()
|
||||
for(var/obj/structure/particle_accelerator/fuel_chamber/F in orange(1,src))
|
||||
src.dir = F.dir
|
||||
dir = F.dir
|
||||
connected_parts = list()
|
||||
var/tally = 0
|
||||
var/ldir = turn(dir,-90)
|
||||
var/rdir = turn(dir,90)
|
||||
var/odir = turn(dir,180)
|
||||
var/turf/T = src.loc
|
||||
var/turf/T = loc
|
||||
T = get_step(T,rdir)
|
||||
if(check_part(T,/obj/structure/particle_accelerator/fuel_chamber))
|
||||
tally++
|
||||
@@ -213,26 +224,26 @@
|
||||
if(istype(PA, type))
|
||||
if(PA.connect_master(src))
|
||||
if(PA.report_ready(src))
|
||||
src.connected_parts.Add(PA)
|
||||
connected_parts.Add(PA)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/toggle_power()
|
||||
src.active = !src.active
|
||||
active = !active
|
||||
investigate_log("turned [active?"<font color='red'>ON</font>":"<font color='green'>OFF</font>"] by [usr ? usr.key : "outside forces"]","singulo")
|
||||
if(active)
|
||||
msg_admin_attack("PA Control Computer turned ON by [key_name(usr, usr.client)](<A HREF='?_src_=holder;adminmoreinfo=\ref[usr]'>?</A>) in ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
|
||||
log_game("PA Control Computer turned ON by [usr.ckey]([usr]) in ([x],[y],[z])")
|
||||
use_log += text("\[[time_stamp()]\] <font color='red'>[usr.name] ([usr.ckey]) has turned on the PA Control Computer.</font>")
|
||||
if(src.active)
|
||||
src.use_power = 2
|
||||
if(active)
|
||||
use_power = 2
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = src.strength
|
||||
part.strength = strength
|
||||
part.powered = 1
|
||||
part.update_icon()
|
||||
else
|
||||
src.use_power = 1
|
||||
use_power = 1
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
part.strength = null
|
||||
part.powered = 0
|
||||
@@ -262,13 +273,13 @@
|
||||
else
|
||||
dat += "Off <BR>"
|
||||
dat += "<A href='?src=[UID()];togglep=1'>Toggle Power</A><BR><BR>"
|
||||
dat += "Particle Strength: [src.strength] "
|
||||
dat += "Particle Strength: [strength] "
|
||||
dat += "<A href='?src=[UID()];strengthdown=1'>--</A>|<A href='?src=[UID()];strengthup=1'>++</A><BR><BR>"
|
||||
|
||||
//user << browse(dat, "window=pacontrol;size=420x500")
|
||||
//onclose(user, "pacontrol")
|
||||
var/datum/browser/popup = new(user, "pacontrol", name, 420, 500)
|
||||
popup.set_content(dat)
|
||||
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
|
||||
popup.set_title_image(user.browse_rsc_icon(icon, icon_state))
|
||||
popup.open()
|
||||
return
|
||||
Reference in New Issue
Block a user