From 48098c32493a09fb4a4f8a2be535702f93b49915 Mon Sep 17 00:00:00 2001 From: advomach Date: Tue, 24 Jun 2014 11:37:03 -0400 Subject: [PATCH 1/2] Replaced var/sizes_to_number with weirdass formula that is faster and takes up less space in code than list lookups --- code/modules/power/singularity/singularity.dm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index ffe2e10a903..386e0fee913 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -26,7 +26,6 @@ var/target = null //its target. moves towards the target if it has one var/last_failed_movement = 0//Will not move in the same dir if it couldnt before, will help with the getting stuck on fields thing var/teleport_del = 0 - var/sizes_to_number = list("1" = 0, "3" = 1, "5" = 2, "7" = 3, "9" = 4) //so i dont have to mess around with weirdass formulas to get this done. var/last_warning var/list/uneatable = list(/turf/space, /obj/effect/overlay) @@ -230,7 +229,7 @@ if(current_size >= 5) var/list/handlist = list(H.l_hand, H.r_hand) for(var/obj/item/hand in handlist) - if(prob(current_size * 5) && hand.w_class >= 5 - sizes_to_number["[current_size]"] && H.unEquip(hand)) + if(prob(current_size * 5) && hand.w_class >= ((11-current_size)/2) && H.unEquip(hand)) //This weird math is much faster than list lookups. Supposed to suck small items but larger items get sucked as singularity grows larger step_towards(hand, src) H << "\The [src] pulls \the [hand] from your grip!" From 79447673a088fcffe9b276c3fd369f3f8126317a Mon Sep 17 00:00:00 2001 From: advomach Date: Tue, 24 Jun 2014 19:00:41 -0400 Subject: [PATCH 2/2] Update singularity.dm Removed comment --- code/modules/power/singularity/singularity.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index 386e0fee913..9016f1278a4 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -229,7 +229,7 @@ if(current_size >= 5) var/list/handlist = list(H.l_hand, H.r_hand) for(var/obj/item/hand in handlist) - if(prob(current_size * 5) && hand.w_class >= ((11-current_size)/2) && H.unEquip(hand)) //This weird math is much faster than list lookups. Supposed to suck small items but larger items get sucked as singularity grows larger + if(prob(current_size * 5) && hand.w_class >= ((11-current_size)/2) && H.unEquip(hand)) step_towards(hand, src) H << "\The [src] pulls \the [hand] from your grip!"