Removes amount_list_postion from reagent containers, adds related unit test. (#76057)

We had more issues like what #76013 addressed, now they're gone.
Variable transfer amount is now explicit. 
Amount is now inferred from current value, performance concern here is
minimal. Less work and mistakes when making new types.
This commit is contained in:
AnturK
2023-06-16 03:58:58 +02:00
committed by GitHub
parent 7eed7de897
commit bd1098b874
13 changed files with 38 additions and 21 deletions
+1
View File
@@ -183,6 +183,7 @@
#include "quirks.dm"
#include "range_return.dm"
#include "rcd.dm"
#include "reagent_container_defaults.dm"
#include "reagent_id_typos.dm"
#include "reagent_mob_expose.dm"
#include "reagent_mod_procs.dm"
@@ -0,0 +1,12 @@
/// Checks if reagent container transfer amount defaults match with actual possible values
/datum/unit_test/reagent_container_defaults
/datum/unit_test/reagent_container_defaults/Run()
for(var/container_type in subtypesof(/obj/item/reagent_containers))
var/obj/item/reagent_containers/container = allocate(container_type)
if(!container.has_variable_transfer_amount)
continue
var/initial_value = initial(container.amount_per_transfer_from_this)
var/index_of_initial_value = container.possible_transfer_amounts.Find(initial_value)
if(index_of_initial_value == 0)
TEST_FAIL("Reagent container [container_type]: initial value of amount_per_transfer_from_this value ([initial_value]) not found in possible_transfer_amounts list")