From 200a7503937c6fe6c94bc45efc7550f5cd290b8d Mon Sep 17 00:00:00 2001 From: Ian Docherty Date: Sat, 21 Jul 2012 15:51:27 -0400 Subject: [PATCH 1/2] Add some hysterisis to allow for rounding of resources before doing damage --- lib/Lacuna/DB/Result/Map/Body/Planet.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Lacuna/DB/Result/Map/Body/Planet.pm b/lib/Lacuna/DB/Result/Map/Body/Planet.pm index 86d273e7..a05c16e1 100644 --- a/lib/Lacuna/DB/Result/Map/Body/Planet.pm +++ b/lib/Lacuna/DB/Result/Map/Body/Planet.pm @@ -1490,7 +1490,7 @@ sub tick_to { } # if we *still* have ore to consume when we have nothing then we are in trouble! - if ($ore_consumed > 0) { + if ($ore_consumed > 20) { # deduct an arbitrary ore-stuff $self->spend_ore_type('gold', $ore_consumed, 'complain'); } @@ -1545,7 +1545,7 @@ sub tick_to { } } # if we *still* have food to consume when we have nothing then we are in trouble! - if ($food_consumed > 0) { + if ($food_consumed > 20) { # deduct an arbitrary food-stuff $self->spend_food_type('algae', $food_consumed, 'complain'); } -- 2.51.2 From daeffd79d2da418c073f3e7cf96bf16a19b200e8 Mon Sep 17 00:00:00 2001 From: Ian Docherty Date: Sat, 21 Jul 2012 16:16:32 -0400 Subject: [PATCH 2/2] Add hysterisis so that rounding down errors does not cause building damage --- lib/Lacuna/DB/Result/Map/Body/Planet.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Lacuna/DB/Result/Map/Body/Planet.pm b/lib/Lacuna/DB/Result/Map/Body/Planet.pm index 86d273e7..c18e614c 100644 --- a/lib/Lacuna/DB/Result/Map/Body/Planet.pm +++ b/lib/Lacuna/DB/Result/Map/Body/Planet.pm @@ -1490,8 +1490,8 @@ sub tick_to { } # if we *still* have ore to consume when we have nothing then we are in trouble! - if ($ore_consumed > 0) { - # deduct an arbitrary ore-stuff + if ($ore_consumed > 20) { + # deduct an arbitrary ore-stuff, but allow for rounding (hence the '20') $self->spend_ore_type('gold', $ore_consumed, 'complain'); } } @@ -1545,7 +1545,7 @@ sub tick_to { } } # if we *still* have food to consume when we have nothing then we are in trouble! - if ($food_consumed > 0) { + if ($food_consumed > 20) { # deduct an arbitrary food-stuff $self->spend_food_type('algae', $food_consumed, 'complain'); } -- 2.51.2