mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 07:08:00 +01:00
Merge pull request #905 from Aranclanos/MachineryTopic
Machinery Topic(): mob and self checks fix.
This commit is contained in:
@@ -32,24 +32,22 @@
|
||||
return
|
||||
|
||||
/obj/machinery/artillerycontrol/Topic(href, href_list)
|
||||
..()
|
||||
if (usr.stat || usr.restrained())
|
||||
if(..())
|
||||
return
|
||||
var/A
|
||||
A = input("Area to jump bombard", "Open Fire", A) in teleportlocs
|
||||
var/area/thearea = teleportlocs[A]
|
||||
if (usr.stat || usr.restrained()) return
|
||||
if(src.reload < 180) return
|
||||
if ((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon)))
|
||||
var/A
|
||||
A = input("Area to jump bombard", "Open Fire", A) in teleportlocs
|
||||
var/area/thearea = teleportlocs[A]
|
||||
if (usr.stat || usr.restrained()) return
|
||||
if(src.reload < 180) return
|
||||
if ((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon)))
|
||||
command_alert("Bluespace artillery fire detected. Brace for impact.")
|
||||
message_admins("[key_name_admin(usr)] has launched an artillery strike.", 1)
|
||||
var/list/L = list()
|
||||
for(var/turf/T in get_area_turfs(thearea.type))
|
||||
L+=T
|
||||
var/loc = pick(L)
|
||||
explosion(loc,2,5,11)
|
||||
reload = 0
|
||||
command_alert("Bluespace artillery fire detected. Brace for impact.")
|
||||
message_admins("[key_name_admin(usr)] has launched an artillery strike.", 1)
|
||||
var/list/L = list()
|
||||
for(var/turf/T in get_area_turfs(thearea.type))
|
||||
L+=T
|
||||
var/loc = pick(L)
|
||||
explosion(loc,2,5,11)
|
||||
reload = 0
|
||||
|
||||
/*mob/proc/openfire()
|
||||
var/A
|
||||
|
||||
@@ -220,9 +220,8 @@
|
||||
return 1
|
||||
|
||||
/obj/machinery/biogenerator/Topic(href, href_list)
|
||||
if(stat & BROKEN) return
|
||||
if(usr.stat || usr.restrained()) return
|
||||
if(!in_range(src, usr)) return
|
||||
if(..())
|
||||
return
|
||||
|
||||
usr.set_machine(src)
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@
|
||||
onclose(user, "copier")
|
||||
|
||||
/obj/machinery/photocopier/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
if(href_list["copy"])
|
||||
if(copy)
|
||||
for(var/i = 0, i < copies, i++)
|
||||
|
||||
@@ -300,11 +300,7 @@
|
||||
|
||||
|
||||
/obj/machinery/power/am_control_unit/Topic(href, href_list)
|
||||
..()
|
||||
//Ignore input if we are broken or guy is not touching us, AI can control from a ways away
|
||||
if(stat & (BROKEN|NOPOWER) || (get_dist(src, usr) > 1 && !istype(usr, /mob/living/silicon/ai)))
|
||||
usr.unset_machine()
|
||||
usr << browse(null, "window=AMcontrol")
|
||||
if(..())
|
||||
return
|
||||
|
||||
if(href_list["close"])
|
||||
|
||||
@@ -694,11 +694,12 @@
|
||||
return 1
|
||||
|
||||
/obj/machinery/power/apc/Topic(href, href_list, var/usingUI = 1)
|
||||
if(..())
|
||||
return
|
||||
if(!isrobot(usr))
|
||||
if(!can_use(usr, 1))
|
||||
return
|
||||
|
||||
src.add_fingerprint(usr)
|
||||
usr.set_machine(src)
|
||||
|
||||
if (href_list["lock"])
|
||||
|
||||
@@ -151,7 +151,8 @@
|
||||
|
||||
|
||||
/obj/machinery/power/generator/Topic(href, href_list)
|
||||
..()
|
||||
if(..())
|
||||
return
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=teg")
|
||||
usr.unset_machine()
|
||||
|
||||
@@ -128,7 +128,8 @@
|
||||
|
||||
|
||||
/obj/machinery/power/generator_type2/Topic(href, href_list)
|
||||
..()
|
||||
if(..())
|
||||
return
|
||||
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=teg")
|
||||
|
||||
@@ -114,13 +114,9 @@
|
||||
|
||||
/obj/machinery/computer/gravity_control_computer/Topic(href, href_list)
|
||||
set background = 1
|
||||
..()
|
||||
|
||||
if ( (get_dist(src, usr) > 1 ))
|
||||
if (!istype(usr, /mob/living/silicon))
|
||||
usr.unset_machine()
|
||||
usr << browse(null, "window=air_alarm")
|
||||
return
|
||||
if(..())
|
||||
return
|
||||
|
||||
if(href_list["gentoggle"])
|
||||
if(gravity_generator:on)
|
||||
|
||||
@@ -73,11 +73,7 @@
|
||||
return
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/Topic(href, href_list)
|
||||
..()
|
||||
//Ignore input if we are broken, !silicon guy cant touch us, or nonai controlling from super far away
|
||||
if(stat & (BROKEN|NOPOWER) || (get_dist(src, usr) > 1 && !istype(usr, /mob/living/silicon)) || (get_dist(src, usr) > 8 && !istype(usr, /mob/living/silicon/ai)))
|
||||
usr.unset_machine()
|
||||
usr << browse(null, "window=pacontrol")
|
||||
if(..())
|
||||
return
|
||||
|
||||
if(!interface_control)
|
||||
|
||||
+57
-71
@@ -210,96 +210,82 @@
|
||||
|
||||
|
||||
/obj/machinery/power/smes/Topic(href, href_list)
|
||||
..()
|
||||
|
||||
if (usr.stat || usr.restrained() )
|
||||
if(..())
|
||||
return
|
||||
if (!(istype(usr, /mob/living/carbon/human) || ticker) && ticker.mode.name != "monkey")
|
||||
if(!istype(usr, /mob/living/silicon/ai))
|
||||
usr << "\red You don't have the dexterity to do this!"
|
||||
return
|
||||
|
||||
//world << "[href] ; [href_list[href]]"
|
||||
|
||||
if (( usr.machine==src && ((get_dist(src, usr) <= 1) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon/ai)))
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=smes")
|
||||
usr.unset_machine()
|
||||
return
|
||||
|
||||
else if( href_list["cmode"] )
|
||||
chargemode = !chargemode
|
||||
if(!chargemode)
|
||||
charging = 0
|
||||
updateicon()
|
||||
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=smes")
|
||||
usr.unset_machine()
|
||||
return
|
||||
else if( href_list["online"] )
|
||||
online = !online
|
||||
updateicon()
|
||||
else if( href_list["input"] )
|
||||
|
||||
else if( href_list["cmode"] )
|
||||
chargemode = !chargemode
|
||||
if(!chargemode)
|
||||
charging = 0
|
||||
updateicon()
|
||||
var/i = text2num(href_list["input"])
|
||||
|
||||
else if( href_list["online"] )
|
||||
online = !online
|
||||
updateicon()
|
||||
else if( href_list["input"] )
|
||||
var/d = 0
|
||||
switch(i)
|
||||
if(-4)
|
||||
chargelevel = 0
|
||||
if(4)
|
||||
chargelevel = SMESMAXCHARGELEVEL //30000
|
||||
|
||||
var/i = text2num(href_list["input"])
|
||||
if(1)
|
||||
d = 100
|
||||
if(-1)
|
||||
d = -100
|
||||
if(2)
|
||||
d = 1000
|
||||
if(-2)
|
||||
d = -1000
|
||||
if(3)
|
||||
d = 10000
|
||||
if(-3)
|
||||
d = -10000
|
||||
|
||||
var/d = 0
|
||||
switch(i)
|
||||
if(-4)
|
||||
chargelevel = 0
|
||||
if(4)
|
||||
chargelevel = SMESMAXCHARGELEVEL //30000
|
||||
chargelevel += d
|
||||
chargelevel = max(0, min(SMESMAXCHARGELEVEL, chargelevel)) // clamp to range
|
||||
|
||||
if(1)
|
||||
d = 100
|
||||
if(-1)
|
||||
d = -100
|
||||
if(2)
|
||||
d = 1000
|
||||
if(-2)
|
||||
d = -1000
|
||||
if(3)
|
||||
d = 10000
|
||||
if(-3)
|
||||
d = -10000
|
||||
else if( href_list["output"] )
|
||||
|
||||
chargelevel += d
|
||||
chargelevel = max(0, min(SMESMAXCHARGELEVEL, chargelevel)) // clamp to range
|
||||
var/i = text2num(href_list["output"])
|
||||
|
||||
else if( href_list["output"] )
|
||||
var/d = 0
|
||||
switch(i)
|
||||
if(-4)
|
||||
output = 0
|
||||
if(4)
|
||||
output = SMESMAXOUTPUT //30000
|
||||
|
||||
var/i = text2num(href_list["output"])
|
||||
if(1)
|
||||
d = 100
|
||||
if(-1)
|
||||
d = -100
|
||||
if(2)
|
||||
d = 1000
|
||||
if(-2)
|
||||
d = -1000
|
||||
if(3)
|
||||
d = 10000
|
||||
if(-3)
|
||||
d = -10000
|
||||
|
||||
var/d = 0
|
||||
switch(i)
|
||||
if(-4)
|
||||
output = 0
|
||||
if(4)
|
||||
output = SMESMAXOUTPUT //30000
|
||||
|
||||
if(1)
|
||||
d = 100
|
||||
if(-1)
|
||||
d = -100
|
||||
if(2)
|
||||
d = 1000
|
||||
if(-2)
|
||||
d = -1000
|
||||
if(3)
|
||||
d = 10000
|
||||
if(-3)
|
||||
d = -10000
|
||||
|
||||
output += d
|
||||
output = max(0, min(SMESMAXOUTPUT, output)) // clamp to range
|
||||
output += d
|
||||
output = max(0, min(SMESMAXOUTPUT, output)) // clamp to range
|
||||
|
||||
investigate_log("input/output; [chargelevel>output?"<font color='green'>":"<font color='red'>"][chargelevel]/[output]</font> | Output-mode: [online?"<font color='green'>on</font>":"<font color='red'>off</font>"] | Input-mode: [chargemode?"<font color='green'>auto</font>":"<font color='red'>off</font>"] by [usr.key]","singulo")
|
||||
src.updateUsrDialog()
|
||||
|
||||
else
|
||||
usr << browse(null, "window=smes")
|
||||
usr.unset_machine()
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/power/smes/proc/ion_act()
|
||||
if(src.z == 1)
|
||||
|
||||
@@ -185,39 +185,21 @@
|
||||
return
|
||||
|
||||
/obj/machinery/power/turbine/Topic(href, href_list)
|
||||
..()
|
||||
if(stat & BROKEN)
|
||||
if(..())
|
||||
return
|
||||
if (usr.stat || usr.restrained() )
|
||||
return
|
||||
if (!(istype(usr, /mob/living/carbon/human) || ticker) && ticker.mode.name != "monkey")
|
||||
if(!istype(usr, /mob/living/silicon/ai))
|
||||
usr << "\red You don't have the dexterity to do this!"
|
||||
return
|
||||
|
||||
if (( usr.machine==src && ((get_dist(src, usr) <= 1) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon/ai)))
|
||||
|
||||
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=turbine")
|
||||
usr.machine = null
|
||||
return
|
||||
|
||||
else if( href_list["str"] )
|
||||
compressor.starter = !compressor.starter
|
||||
|
||||
spawn(0)
|
||||
for(var/mob/M in viewers(1, src))
|
||||
if ((M.client && M.machine == src))
|
||||
src.interact(M)
|
||||
|
||||
else
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=turbine")
|
||||
usr.machine = null
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
else if( href_list["str"] )
|
||||
compressor.starter = !compressor.starter
|
||||
|
||||
spawn(0)
|
||||
for(var/mob/M in viewers(1, src))
|
||||
if ((M.client && M.machine == src))
|
||||
src.interact(M)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -243,11 +243,9 @@
|
||||
return
|
||||
|
||||
/obj/machinery/chem_master/Topic(href, href_list)
|
||||
if(stat & (BROKEN|NOPOWER)) return
|
||||
if(usr.stat || usr.restrained()) return
|
||||
if(!in_range(src, usr)) return
|
||||
if(..())
|
||||
return
|
||||
|
||||
src.add_fingerprint(usr)
|
||||
usr.set_machine(src)
|
||||
|
||||
|
||||
|
||||
@@ -259,6 +259,8 @@
|
||||
// handle machine interaction
|
||||
|
||||
Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
if(usr.loc == src)
|
||||
usr << "\red You cannot reach the controls from inside."
|
||||
return
|
||||
@@ -267,37 +269,26 @@
|
||||
usr << "\red The disposal units power is disabled."
|
||||
return
|
||||
..()
|
||||
src.add_fingerprint(usr)
|
||||
if(stat & BROKEN)
|
||||
return
|
||||
if(usr.stat || usr.restrained() || src.flushing)
|
||||
return
|
||||
usr.set_machine(src)
|
||||
|
||||
if (in_range(src, usr) && istype(src.loc, /turf))
|
||||
usr.set_machine(src)
|
||||
|
||||
if(href_list["close"])
|
||||
usr.unset_machine()
|
||||
usr << browse(null, "window=disposal")
|
||||
return
|
||||
|
||||
if(href_list["pump"])
|
||||
if(text2num(href_list["pump"]))
|
||||
mode = 1
|
||||
else
|
||||
mode = 0
|
||||
update()
|
||||
|
||||
if(href_list["handle"])
|
||||
flush = text2num(href_list["handle"])
|
||||
update()
|
||||
|
||||
if(href_list["eject"])
|
||||
eject()
|
||||
else
|
||||
usr << browse(null, "window=disposal")
|
||||
if(href_list["close"])
|
||||
usr.unset_machine()
|
||||
usr << browse(null, "window=disposal")
|
||||
return
|
||||
|
||||
if(href_list["pump"])
|
||||
if(text2num(href_list["pump"]))
|
||||
mode = 1
|
||||
else
|
||||
mode = 0
|
||||
update()
|
||||
|
||||
if(href_list["handle"])
|
||||
flush = text2num(href_list["handle"])
|
||||
update()
|
||||
|
||||
if(href_list["eject"])
|
||||
eject()
|
||||
return
|
||||
|
||||
// eject the contents of the disposal unit
|
||||
|
||||
@@ -80,13 +80,11 @@
|
||||
|
||||
|
||||
/obj/machinery/keycard_auth/Topic(href, href_list)
|
||||
..()
|
||||
if(..())
|
||||
return
|
||||
if(busy)
|
||||
usr << "This device is busy."
|
||||
return
|
||||
if(usr.stat || stat & (BROKEN|NOPOWER))
|
||||
usr << "This device is without power."
|
||||
return
|
||||
if(href_list["triggerevent"])
|
||||
event = href_list["triggerevent"]
|
||||
screen = 2
|
||||
@@ -94,7 +92,6 @@
|
||||
reset()
|
||||
|
||||
updateUsrDialog()
|
||||
add_fingerprint(usr)
|
||||
return
|
||||
|
||||
/obj/machinery/keycard_auth/proc/reset()
|
||||
|
||||
Reference in New Issue
Block a user