mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Optimize (#10185)
Co-authored-by: TiviPlus <57223640+TiviPlus@users.noreply.github.com>
This commit is contained in:
@@ -934,11 +934,6 @@
|
||||
|
||||
/* End language procs */
|
||||
|
||||
/atom/movable/proc/ConveyorMove(movedir)
|
||||
set waitfor = FALSE
|
||||
if(!anchored && has_gravity())
|
||||
step(src, movedir)
|
||||
|
||||
//Returns an atom's power cell, if it has one. Overload for individual items.
|
||||
/atom/movable/proc/get_cell()
|
||||
return
|
||||
|
||||
@@ -46,9 +46,6 @@
|
||||
qdel(src)
|
||||
return 0
|
||||
|
||||
/obj/effect/ConveyorMove()
|
||||
return
|
||||
|
||||
/obj/effect/abstract/ex_act(severity, target)
|
||||
return
|
||||
|
||||
|
||||
@@ -31,9 +31,6 @@ INITIALIZE_IMMEDIATE(/mob/dead)
|
||||
/mob/dead/gib() //ghosts can't be gibbed.
|
||||
return
|
||||
|
||||
/mob/dead/ConveyorMove() //lol
|
||||
return
|
||||
|
||||
/mob/dead/forceMove(atom/destination)
|
||||
var/turf/old_turf = get_turf(src)
|
||||
var/turf/new_turf = get_turf(destination)
|
||||
|
||||
@@ -1077,11 +1077,6 @@
|
||||
"[C] leaps out of [src]'s way!")]</span>")
|
||||
C.Paralyze(40)
|
||||
|
||||
/mob/living/ConveyorMove()
|
||||
if((movement_type & FLYING) && !stat)
|
||||
return
|
||||
..()
|
||||
|
||||
/mob/living/can_be_pulled()
|
||||
return ..() && !(buckled && buckled.buckle_prevents_pull)
|
||||
|
||||
|
||||
@@ -14,8 +14,6 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
|
||||
var/forwards // this is the default (forward) direction, set by the map dir
|
||||
var/backwards // hopefully self-explanatory
|
||||
var/movedir // the actual direction to move stuff in
|
||||
|
||||
var/list/affecting // the list of all items that will be moved this ptick
|
||||
var/id = "" // the control ID - must match controller ID
|
||||
var/verted = 1 // Inverts the direction the conveyor belt moves.
|
||||
speed_process = TRUE
|
||||
@@ -57,7 +55,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
|
||||
|
||||
/obj/machinery/conveyor/Destroy()
|
||||
LAZYREMOVE(GLOB.conveyors_by_id[id], src)
|
||||
. = ..()
|
||||
return ..()
|
||||
|
||||
/obj/machinery/conveyor/vv_edit_var(var_name, var_value)
|
||||
if (var_name == "id")
|
||||
@@ -131,24 +129,36 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
|
||||
return
|
||||
use_power(6)
|
||||
//get the first 30 items in contents
|
||||
affecting = list()
|
||||
var/i = 0
|
||||
for(var/item in loc.contents)
|
||||
if(item == src)
|
||||
continue
|
||||
i++ // we're sure it's a real target to move at this point
|
||||
if(i >= MAX_CONVEYOR_ITEMS_MOVE)
|
||||
break
|
||||
affecting.Add(item)
|
||||
var/turf/locturf = loc
|
||||
var/list/items = locturf.contents - src - locturf.lighting_object
|
||||
if(!LAZYLEN(items))//Dont do anything at all if theres nothing there but the conveyor
|
||||
return
|
||||
var/list/affecting
|
||||
if(length(items) > MAX_CONVEYOR_ITEMS_MOVE)
|
||||
affecting = items.Copy(1, MAX_CONVEYOR_ITEMS_MOVE + 1)//Lists start at 1 lol
|
||||
else
|
||||
affecting = items
|
||||
conveying = TRUE
|
||||
addtimer(CALLBACK(src, .proc/convey, affecting), 1)
|
||||
|
||||
addtimer(CALLBACK(src, .proc/convey, affecting), 1)//Movement effect
|
||||
|
||||
/obj/machinery/conveyor/proc/convey(list/affecting)
|
||||
for(var/atom/movable/A in affecting)
|
||||
if(!QDELETED(A) && (A.loc == loc))
|
||||
A.ConveyorMove(movedir)
|
||||
for(var/am in affecting)
|
||||
if(!ismovable(am)) //This is like a third faster than for(var/atom/movable in affecting)
|
||||
continue
|
||||
var/atom/movable/movable_thing = am
|
||||
//Give this a chance to yield if the server is busy
|
||||
stoplag()
|
||||
if(QDELETED(movable_thing) || (movable_thing.loc != loc))
|
||||
continue
|
||||
if(iseffect(movable_thing) || isdead(movable_thing))
|
||||
continue
|
||||
if(isliving(movable_thing))
|
||||
var/mob/living/zoommob = movable_thing
|
||||
if((zoommob.movement_type & FLYING) && !zoommob.stat)
|
||||
continue
|
||||
if(!movable_thing.anchored && movable_thing.has_gravity())
|
||||
step(movable_thing, movedir)
|
||||
conveying = FALSE
|
||||
|
||||
// attack with item, place item on conveyor
|
||||
|
||||
Reference in New Issue
Block a user