mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-24 20:47:10 +01:00
Revert "Optimize the fuck out of using checks in machines."
This reverts commit 5649e2c34d.
Conflicts:
code/game/objects/objs.dm
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
if (!target)
|
||||
usr.unset_machine()
|
||||
usr.reset_view(usr)
|
||||
src.in_use = 0
|
||||
return
|
||||
for (var/obj/machinery/camera/C in cameras)
|
||||
if (C.c_tag == target)
|
||||
@@ -33,8 +34,10 @@
|
||||
usr.client.eye = target
|
||||
usr.set_machine(src)
|
||||
src.current = target
|
||||
src.in_use = 1
|
||||
else
|
||||
usr.unset_machine()
|
||||
src.in_use = 0
|
||||
return
|
||||
|
||||
/obj/item/device/handtv/check_eye(var/mob/usr as mob)
|
||||
|
||||
+27
-37
@@ -12,7 +12,6 @@
|
||||
var/list/attack_verb = list() //Used in attackby() to say how something was attacked "[x] has been [z.attack_verb] by [y] with [z]"
|
||||
var/sharp = 0 // whether this object cuts
|
||||
var/in_use = 0 // If we have a user using us, this will be set on. We will check if the user has stopped using us, and thus stop updating and LAGGING EVERYTHING!
|
||||
var/list/mob/_using = list() // All mobs dicking with us.
|
||||
|
||||
var/damtype = "brute"
|
||||
var/force = 0
|
||||
@@ -66,26 +65,24 @@
|
||||
if(in_use)
|
||||
var/is_in_use = 0
|
||||
var/list/nearby = viewers(1, src)
|
||||
for(var/mob/M in _using.Copy()) // Only check things actually messing with us.
|
||||
if (!M || !M.client || M.machine != src)
|
||||
_using.Remove(M)
|
||||
continue
|
||||
|
||||
if(!M in nearby) // NOT NEARBY
|
||||
// AIs/Robots can do shit from afar.
|
||||
if (istype(usr, /mob/living/silicon/ai) || istype(usr, /mob/living/silicon/robot))
|
||||
is_in_use = 1
|
||||
src.attack_ai(M)
|
||||
|
||||
// check for TK users
|
||||
else if (istype(usr, /mob/living/carbon/human))
|
||||
if(istype(usr.l_hand, /obj/item/tk_grab) || istype(usr.r_hand, /obj/item/tk_grab))
|
||||
if(usr.client && usr.machine==src)
|
||||
is_in_use = 1
|
||||
src.attack_hand(usr)
|
||||
else // EVERYTHING FROM HERE DOWN MUST BE NEARBY
|
||||
for(var/mob/M in nearby)
|
||||
if ((M.client && M.machine == src))
|
||||
is_in_use = 1
|
||||
attack_hand(usr)
|
||||
src.attack_hand(M)
|
||||
if (istype(usr, /mob/living/silicon/ai) || istype(usr, /mob/living/silicon/robot))
|
||||
if (!(usr in nearby))
|
||||
if (usr.client && usr.machine==src) // && M.machine == src is omitted because if we triggered this by using the dialog, it doesn't matter if our machine changed in between triggering it and this - the dialog is probably still supposed to refresh.
|
||||
is_in_use = 1
|
||||
src.attack_ai(usr)
|
||||
|
||||
// check for TK users
|
||||
|
||||
if (istype(usr, /mob/living/carbon/human))
|
||||
if(istype(usr.l_hand, /obj/item/tk_grab) || istype(usr.r_hand, /obj/item/tk_grab/))
|
||||
if(!(usr in nearby))
|
||||
if(usr.client && usr.machine==src)
|
||||
is_in_use = 1
|
||||
src.attack_hand(usr)
|
||||
in_use = is_in_use
|
||||
|
||||
/obj/proc/updateDialog()
|
||||
@@ -93,18 +90,14 @@
|
||||
if(in_use)
|
||||
var/list/nearby = viewers(1, src)
|
||||
var/is_in_use = 0
|
||||
for(var/mob/M in _using.Copy()) // Only check things actually messing with us.
|
||||
// Not actually using the fucking thing?
|
||||
if (!M || !M.client || M.machine != src)
|
||||
_using.Remove(M)
|
||||
continue
|
||||
// Not robot or AI, and not nearby?
|
||||
if(!isAI(M) && !isrobot(M) && !(M in nearby))
|
||||
_using.Remove(M)
|
||||
continue
|
||||
is_in_use = 1
|
||||
src.interact(M)
|
||||
in_use = is_in_use
|
||||
for(var/mob/M in nearby)
|
||||
if ((M.client && M.machine == src))
|
||||
is_in_use = 1
|
||||
src.interact(M)
|
||||
var/ai_in_use = AutoUpdateAI(src)
|
||||
|
||||
if(!ai_in_use && !is_in_use)
|
||||
in_use = 0
|
||||
|
||||
/obj/proc/interact(mob/user)
|
||||
return
|
||||
@@ -113,9 +106,7 @@
|
||||
return
|
||||
|
||||
/mob/proc/unset_machine()
|
||||
if(machine && istype(machine, /obj/machinery))
|
||||
machine._using -= src
|
||||
machine = null
|
||||
src.machine = null
|
||||
|
||||
/mob/proc/set_machine(var/obj/O)
|
||||
if(src.machine)
|
||||
@@ -123,7 +114,6 @@
|
||||
src.machine = O
|
||||
if(istype(O))
|
||||
O.in_use = 1
|
||||
O._using += src
|
||||
|
||||
/obj/item/proc/updateSelfDialog()
|
||||
var/mob/M = src.loc
|
||||
@@ -145,4 +135,4 @@
|
||||
var/rendered = "<span class='game say'><span class='name'>[M.name]: </span> <span class='message'>[text]</span></span>"
|
||||
mo.show_message(rendered, 2)
|
||||
*/
|
||||
return
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user