SINGULOTH OPTIMIZATIONS - See full commit for details.

* qdel() instead of del(), wherever possible.
* Optimized gravpull logic
* /atom/movables can override canSingulothPull() logic to add gravpull exceptions (unless singuloth is 2fat)
* assigned_role energy boosts changed into a switch() statement

Conflicts:
	code/modules/mob/living/carbon/human/human.dm
	code/modules/mob/mob.dm
	code/modules/power/singularity/singularity.dm
This commit is contained in:
Rob Nelson
2014-01-31 02:34:39 -05:00
committed by ZomgPonies
parent b8a6504be3
commit ec70d13056
3 changed files with 45 additions and 15 deletions
+26 -14
View File
@@ -214,7 +214,10 @@ var/global/list/uneatable = list(
// Movable atoms only
if(dist > consume_range && istype(X, /atom/movable))
if(is_type_in_list(X, uneatable)) continue
if(((X) &&(!X:anchored) && (!istype(X,/mob/living/carbon/human)))|| (src.current_size >= 9))
if(canPull(X))
step_towards(X,src)
/*
if((X &&!X:anchored && !istype(X,/mob/living/carbon/human))|| (src.current_size >= 9))
step_towards(X,src)
else if(istype(X,/mob/living/carbon/human))
var/mob/living/carbon/human/H = X
@@ -223,6 +226,7 @@ var/global/list/uneatable = list(
if(M.magpulse)
continue
step_towards(H,src)
*/
// Turf and movable atoms
else if(dist <= consume_range && (isturf(X) || istype(X, /atom/movable)))
consume(X)
@@ -231,6 +235,18 @@ var/global/list/uneatable = list(
defer_powernet_rebuild = 0
return
// Singulo optimization:
// Jump out whenever we've made a decision.
/obj/machinery/singularity/proc/canPull(var/atom/movable/A)
// If we're big enough, stop checking for this and that and JUST EAT.
if(current_size >= 9)
return 1
else
if(A && !A:anchored)
if(A.canSingulothPull(src))
return 1
return 0
/obj/machinery/singularity/proc/consume(var/atom/A)
var/gain = 0
@@ -241,15 +257,14 @@ var/global/list/uneatable = list(
if(istype(A,/mob/living/carbon/human))
var/mob/living/carbon/human/H = A
if(H.mind)
if((H.mind.assigned_role == "Station Engineer") || (H.mind.assigned_role == "Chief Engineer") )
gain = 100
if(H.mind.assigned_role == "Clown")
gain = rand(-300, 300) // HONK
switch(H.mind.assigned_role)
if("Station Engineer","Chief Engineer")
gain = 100
if("Clown")
gain = rand(-300, 300) // HONK
spawn()
A:gib()
// Why
sleep(1)
else if(istype(A,/obj/))
@@ -257,7 +272,6 @@ var/global/list/uneatable = list(
var/dist = max((current_size - 2),1)
explosion(src.loc,(dist),(dist*2),(dist*4))
return
if(istype(A, /obj/machinery/singularity))//Welp now you did it
var/obj/machinery/singularity/S = A
src.energy += (S.energy/2)//Absorb most of it
@@ -267,13 +281,11 @@ var/global/list/uneatable = list(
return//Quits here, the obj should be gone, hell we might be
if((teleport_del) && (!istype(A, /obj/machinery)))//Going to see if it does not lag less to tele items over to Z 2
var/obj/O = A
O.x = 2
O.y = 2
O.z = 2
qdel(A)
else
A.ex_act(1.0)
if(A) del(A)
if(A)
qdel(A)
gain = 2
else if(isturf(A))
var/turf/T = A