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 */
|
/* 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.
|
//Returns an atom's power cell, if it has one. Overload for individual items.
|
||||||
/atom/movable/proc/get_cell()
|
/atom/movable/proc/get_cell()
|
||||||
return
|
return
|
||||||
@@ -982,4 +977,4 @@
|
|||||||
M.Turn(pick(-30, 30))
|
M.Turn(pick(-30, 30))
|
||||||
animate(I, alpha = 175, pixel_x = to_x, pixel_y = to_y, time = 3, transform = M, easing = CUBIC_EASING)
|
animate(I, alpha = 175, pixel_x = to_x, pixel_y = to_y, time = 3, transform = M, easing = CUBIC_EASING)
|
||||||
sleep(1)
|
sleep(1)
|
||||||
animate(I, alpha = 0, transform = matrix(), time = 1)
|
animate(I, alpha = 0, transform = matrix(), time = 1)
|
||||||
|
|||||||
@@ -46,9 +46,6 @@
|
|||||||
qdel(src)
|
qdel(src)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
/obj/effect/ConveyorMove()
|
|
||||||
return
|
|
||||||
|
|
||||||
/obj/effect/abstract/ex_act(severity, target)
|
/obj/effect/abstract/ex_act(severity, target)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -31,9 +31,6 @@ INITIALIZE_IMMEDIATE(/mob/dead)
|
|||||||
/mob/dead/gib() //ghosts can't be gibbed.
|
/mob/dead/gib() //ghosts can't be gibbed.
|
||||||
return
|
return
|
||||||
|
|
||||||
/mob/dead/ConveyorMove() //lol
|
|
||||||
return
|
|
||||||
|
|
||||||
/mob/dead/forceMove(atom/destination)
|
/mob/dead/forceMove(atom/destination)
|
||||||
var/turf/old_turf = get_turf(src)
|
var/turf/old_turf = get_turf(src)
|
||||||
var/turf/new_turf = get_turf(destination)
|
var/turf/new_turf = get_turf(destination)
|
||||||
|
|||||||
@@ -1077,11 +1077,6 @@
|
|||||||
"[C] leaps out of [src]'s way!")]</span>")
|
"[C] leaps out of [src]'s way!")]</span>")
|
||||||
C.Paralyze(40)
|
C.Paralyze(40)
|
||||||
|
|
||||||
/mob/living/ConveyorMove()
|
|
||||||
if((movement_type & FLYING) && !stat)
|
|
||||||
return
|
|
||||||
..()
|
|
||||||
|
|
||||||
/mob/living/can_be_pulled()
|
/mob/living/can_be_pulled()
|
||||||
return ..() && !(buckled && buckled.buckle_prevents_pull)
|
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/forwards // this is the default (forward) direction, set by the map dir
|
||||||
var/backwards // hopefully self-explanatory
|
var/backwards // hopefully self-explanatory
|
||||||
var/movedir // the actual direction to move stuff in
|
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/id = "" // the control ID - must match controller ID
|
||||||
var/verted = 1 // Inverts the direction the conveyor belt moves.
|
var/verted = 1 // Inverts the direction the conveyor belt moves.
|
||||||
speed_process = TRUE
|
speed_process = TRUE
|
||||||
@@ -57,7 +55,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
|
|||||||
|
|
||||||
/obj/machinery/conveyor/Destroy()
|
/obj/machinery/conveyor/Destroy()
|
||||||
LAZYREMOVE(GLOB.conveyors_by_id[id], src)
|
LAZYREMOVE(GLOB.conveyors_by_id[id], src)
|
||||||
. = ..()
|
return ..()
|
||||||
|
|
||||||
/obj/machinery/conveyor/vv_edit_var(var_name, var_value)
|
/obj/machinery/conveyor/vv_edit_var(var_name, var_value)
|
||||||
if (var_name == "id")
|
if (var_name == "id")
|
||||||
@@ -131,24 +129,36 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
|
|||||||
return
|
return
|
||||||
use_power(6)
|
use_power(6)
|
||||||
//get the first 30 items in contents
|
//get the first 30 items in contents
|
||||||
affecting = list()
|
var/turf/locturf = loc
|
||||||
var/i = 0
|
var/list/items = locturf.contents - src - locturf.lighting_object
|
||||||
for(var/item in loc.contents)
|
if(!LAZYLEN(items))//Dont do anything at all if theres nothing there but the conveyor
|
||||||
if(item == src)
|
return
|
||||||
continue
|
var/list/affecting
|
||||||
i++ // we're sure it's a real target to move at this point
|
if(length(items) > MAX_CONVEYOR_ITEMS_MOVE)
|
||||||
if(i >= MAX_CONVEYOR_ITEMS_MOVE)
|
affecting = items.Copy(1, MAX_CONVEYOR_ITEMS_MOVE + 1)//Lists start at 1 lol
|
||||||
break
|
else
|
||||||
affecting.Add(item)
|
affecting = items
|
||||||
conveying = TRUE
|
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)
|
/obj/machinery/conveyor/proc/convey(list/affecting)
|
||||||
for(var/atom/movable/A in affecting)
|
for(var/am in affecting)
|
||||||
if(!QDELETED(A) && (A.loc == loc))
|
if(!ismovable(am)) //This is like a third faster than for(var/atom/movable in affecting)
|
||||||
A.ConveyorMove(movedir)
|
continue
|
||||||
//Give this a chance to yield if the server is busy
|
var/atom/movable/movable_thing = am
|
||||||
stoplag()
|
//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
|
conveying = FALSE
|
||||||
|
|
||||||
// attack with item, place item on conveyor
|
// attack with item, place item on conveyor
|
||||||
|
|||||||
Reference in New Issue
Block a user