Revert "Optimize (#10185)"

This reverts commit 5b44f36a07.
This commit is contained in:
Jamie D
2020-10-28 15:09:31 +00:00
parent b37df0036a
commit afda4150e6
5 changed files with 35 additions and 29 deletions

View File

@@ -934,6 +934,11 @@
/* 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
@@ -977,4 +982,4 @@
M.Turn(pick(-30, 30))
animate(I, alpha = 175, pixel_x = to_x, pixel_y = to_y, time = 3, transform = M, easing = CUBIC_EASING)
sleep(1)
animate(I, alpha = 0, transform = matrix(), time = 1)
animate(I, alpha = 0, transform = matrix(), time = 1)

View File

@@ -46,6 +46,9 @@
qdel(src)
return 0
/obj/effect/ConveyorMove()
return
/obj/effect/abstract/ex_act(severity, target)
return

View File

@@ -31,6 +31,9 @@ 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)

View File

@@ -1077,6 +1077,11 @@
"[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)

View File

@@ -14,6 +14,8 @@ 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
@@ -55,7 +57,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")
@@ -129,36 +131,24 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
return
use_power(6)
//get the first 30 items in contents
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
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)
conveying = TRUE
addtimer(CALLBACK(src, .proc/convey, affecting), 1)//Movement effect
addtimer(CALLBACK(src, .proc/convey, affecting), 1)
/obj/machinery/conveyor/proc/convey(list/affecting)
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)
for(var/atom/movable/A in affecting)
if(!QDELETED(A) && (A.loc == loc))
A.ConveyorMove(movedir)
//Give this a chance to yield if the server is busy
stoplag()
conveying = FALSE
// attack with item, place item on conveyor