mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-30 15:37:36 +01:00
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:
@@ -1458,3 +1458,14 @@ mob/living/carbon/human/yank_out_object()
|
||||
drop_from_inventory(head)
|
||||
update_hair()
|
||||
update_body()
|
||||
|
||||
/mob/living/carbon/human/canSingulothPull(var/obj/machinery/singularity/singulo)
|
||||
if(!..())
|
||||
return 0
|
||||
|
||||
if(istype(shoes,/obj/item/clothing/shoes/magboots))
|
||||
var/obj/item/clothing/shoes/magboots/M = shoes
|
||||
if(M.magpulse)
|
||||
return 0
|
||||
return 1
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user