From 9ecc2d503d35c75aa0d50f77f128691ae726a4e3 Mon Sep 17 00:00:00 2001 From: kiVts <48099872+kiVts@users.noreply.github.com> Date: Wed, 26 Jun 2024 23:32:45 -0400 Subject: [PATCH] splits the two vars in research datums (#6507) # About the pull request Splits the two vars of init argument and the behavior, should have been like that from the very start. # Explain why it's good for the game less potential runtimes # Testing Photographs and Procedure
Screenshots & Videos Put screenshots and videos here with an empty line between the screenshots and the `
` tags.
# Changelog :cl: code: Prevented potential unintended behavior with research upgrade items on initialize /:cl: --- code/__DEFINES/misc.dm | 3 +- code/datums/research_upgrade_datum.dm | 51 ++++++++++++------- .../chemistry_machinery/xenomorph_analyzer.dm | 9 ++-- 3 files changed, 42 insertions(+), 21 deletions(-) diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index bea1d7975688..cf6d6c64d9a9 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -163,9 +163,10 @@ #define MATRIX_NVG 1 #define MATRIX_WIDE 2 -#define RESEARCH_UPGRADE_NULL null +#define RESEARCH_UPGRADE_NOTHING_TO_PASS null #define RESEARCH_UPGRADE_EXCLUDE_BUY -2 #define RESEARCH_UPGRADE_CATEGORY -1 //lord forgive me +#define RESEARCH_UPGRADE_ITEM 1 #define RESEARCH_UPGRADE_TIER_1 1 #define RESEARCH_UPGRADE_TIER_2 2 #define RESEARCH_UPGRADE_TIER_3 3 diff --git a/code/datums/research_upgrade_datum.dm b/code/datums/research_upgrade_datum.dm index 8b19bafad1cd..fd571afdfcf0 100644 --- a/code/datums/research_upgrade_datum.dm +++ b/code/datums/research_upgrade_datum.dm @@ -3,8 +3,10 @@ var/name = "Upgrade." ///name of upgrades, not items. Items are at research_upgrades.dm somewhere in item folder. var/desc = "something is broken. yippee!!" - ///which behavior should this type follow. Should this be completely excluded from the buy menu? should it be one of the dropdown options? This is also what gets passed to the initizialize of an item, this can be any number *but* it cannot be -1 or -2, as it messes with the buy menu. + ///which behavior should this type follow. Should this be completely excluded from the buy menu? should it be one of the dropdown options? or a normal item? var/behavior = RESEARCH_UPGRADE_EXCLUDE_BUY // should this be on the list? + //This is what gets passed to the initizialize of an item, RESEARCH_UPGRADE_NOTHING_TO_PASS to not pass anything. + var/on_init_argument = RESEARCH_UPGRADE_NOTHING_TO_PASS /// the price of the upgrade, refer to this: 500 is a runner, 8k is queen. T3 is usually 3k, woyer is 2k. var/value_upgrade = 1000 /// actual path to the item.(upgrade) @@ -33,28 +35,32 @@ /datum/research_upgrades/machinery/autodoc/internal_bleed name = "AutoDoc Internal Bleeding Repair" desc = "A data and instruction set for the AutoDoc, making it capable of rapidly fixing internal bleeding." - behavior = RESEARCH_UPGRADE_TIER_1 + on_init_argument = RESEARCH_UPGRADE_TIER_1 + behavior = RESEARCH_UPGRADE_ITEM value_upgrade = 200 clearance_req = 1 /datum/research_upgrades/machinery/autodoc/broken_bone name = "AutoDoc Bone Fracture Repair" desc = "A data instruction set for the AutoDoc, making it capable of setting fractures and applying bonegel." - behavior = RESEARCH_UPGRADE_TIER_2 + on_init_argument = RESEARCH_UPGRADE_TIER_2 + behavior = RESEARCH_UPGRADE_ITEM value_upgrade = 2000 clearance_req = 3 /datum/research_upgrades/machinery/autodoc/organ_damage name = "AutoDoc Broken Organ Repair" desc = "A data and instruction set for the AutoDoc, making it capable of fixing organ damage." - behavior = RESEARCH_UPGRADE_TIER_3 + on_init_argument = RESEARCH_UPGRADE_TIER_3 + behavior = RESEARCH_UPGRADE_ITEM value_upgrade = 1500 clearance_req = 2 /datum/research_upgrades/machinery/autodoc/larva_removal name = "AutoDoc Embryo Removal" desc = "Data and instruction set for AutoDoc making it mildly proficient in removing parasites left by unknown organism." - behavior = RESEARCH_UPGRADE_TIER_4 + on_init_argument = RESEARCH_UPGRADE_TIER_4 + behavior = RESEARCH_UPGRADE_ITEM value_upgrade = 4000 clearance_req = 6 @@ -62,7 +68,8 @@ /datum/research_upgrades/machinery/sleeper name = "Sleeper Upgrade" desc = "Research upgrade for Sleeper system, technology on this disk is used on a sleeper to allow wider spectrum of chemicals to be administered, as well as upgrading dialysis software." - behavior = RESEARCH_UPGRADE_TIER_1 + on_init_argument = RESEARCH_UPGRADE_NOTHING_TO_PASS + behavior = RESEARCH_UPGRADE_ITEM value_upgrade = 500 item_reference = /obj/item/research_upgrades/sleeper upgrade_type = ITEM_MACHINERY_UPGRADE @@ -77,7 +84,8 @@ desc = "Sell the data acquired to the nearest Weyland-Yutani Science division team for 8 or 9 points." value_upgrade = 2000 item_reference = /obj/item/research_upgrades/credits - behavior = RESEARCH_UPGRADE_TIER_1 + on_init_argument = RESEARCH_UPGRADE_NOTHING_TO_PASS + behavior = RESEARCH_UPGRADE_ITEM upgrade_type = ITEM_ACCESSORY_UPGRADE change_purchase = 500 maximum_price = 5000 @@ -88,7 +96,8 @@ desc = "An advanced, robust version of the normal scalpel, allowing it to pierce through thick skin and chitin alike with extreme ease." value_upgrade = 3000 item_reference = /obj/item/tool/surgery/scalpel/laser/advanced - behavior = RESEARCH_UPGRADE_TIER_1 + on_init_argument = RESEARCH_UPGRADE_NOTHING_TO_PASS + behavior = RESEARCH_UPGRADE_ITEM upgrade_type = ITEM_ACCESSORY_UPGRADE clearance_req = 3 @@ -97,7 +106,8 @@ desc = "A true extension of the surgeon's body, this marvel instantly and completely prepares an incision, allowing for the immediate commencement of therapeutic steps." value_upgrade = 3000 item_reference = /obj/item/tool/surgery/scalpel/manager - behavior = RESEARCH_UPGRADE_TIER_1 + on_init_argument = RESEARCH_UPGRADE_NOTHING_TO_PASS + behavior = RESEARCH_UPGRADE_ITEM upgrade_type = ITEM_ACCESSORY_UPGRADE clearance_req = 4 @@ -109,7 +119,8 @@ change_purchase = -200 minimum_price = 200 item_reference = /obj/item/stack/medical/splint/nano/research - behavior = RESEARCH_UPGRADE_TIER_5 //adjust this to change amount of nanosplints in a stack, cant be higher than five, go change max_amount in the nanosplint itself, then change it. + on_init_argument = RESEARCH_UPGRADE_TIER_5 //adjust this to change amount of nanosplints in a stack, cant be higher than five, go change max_amount in the nanosplint itself, then change it. + behavior = RESEARCH_UPGRADE_ITEM upgrade_type = ITEM_ACCESSORY_UPGRADE /datum/research_upgrades/item/flamer_tank @@ -121,7 +132,8 @@ minimum_price = 100 maximum_price = 1000 item_reference = /obj/item/ammo_magazine/flamer_tank/custom/upgraded - behavior = RESEARCH_UPGRADE_NULL + on_init_argument = RESEARCH_UPGRADE_NOTHING_TO_PASS + behavior = RESEARCH_UPGRADE_ITEM upgrade_type = ITEM_ACCESSORY_UPGRADE /datum/research_upgrades/item/flamer_tank/smoke @@ -142,7 +154,8 @@ name = "Universal Translator Plate" desc = "A uniform-attachable plate capable of translating any unknown language heard by the wearer." value_upgrade = 2000 - behavior = RESEARCH_UPGRADE_TIER_1 + on_init_argument = RESEARCH_UPGRADE_NOTHING_TO_PASS + behavior = RESEARCH_UPGRADE_ITEM clearance_req = 6 upgrade_type = ITEM_ARMOR_UPGRADE item_reference = /obj/item/clothing/accessory/health/research_plate/translator @@ -152,7 +165,8 @@ name = "Active Blood Coagulator Plate" desc = "A uniform-attachable plate capable of coagulating any bleeding wounds the user possesses." value_upgrade = 1200 - behavior = RESEARCH_UPGRADE_TIER_1 + on_init_argument = RESEARCH_UPGRADE_NOTHING_TO_PASS + behavior = RESEARCH_UPGRADE_ITEM clearance_req = 2 change_purchase = -200 minimum_price = 200 @@ -164,7 +178,8 @@ desc = "A medical plate with two buttons on the sides and a hefty chemical tank. Attached to a uniform and on a simultaneous press, it injects an emergency dose of medical chemicals much larger than a normal emergency autoinjector. Single time use and is recycled in biomass printer. Features overdose protection." value_upgrade = 250 clearance_req = 1 - behavior = RESEARCH_UPGRADE_TIER_1 + on_init_argument = RESEARCH_UPGRADE_NOTHING_TO_PASS + behavior = RESEARCH_UPGRADE_ITEM change_purchase = -100 minimum_price = 100 upgrade_type = ITEM_ARMOR_UPGRADE @@ -175,7 +190,8 @@ desc = "A strong trauma plate, able to protect the user from a large amount of bullets. Completely useless against sharp objects." value_upgrade = 500 clearance_req = 4 - behavior = RESEARCH_UPGRADE_TIER_1 + on_init_argument = RESEARCH_UPGRADE_NOTHING_TO_PASS + behavior = RESEARCH_UPGRADE_ITEM upgrade_type = ITEM_ARMOR_UPGRADE change_purchase = -50 minimum_price = 200 @@ -183,10 +199,11 @@ /datum/research_upgrades/armor/preservation name = "Death Preservation Plate" - desc = "preservation plate which activates once the user is dead, uses variety of different substances and sensors to slow down the decay and increase the time before the user is permanently dead, due to small tank of preservatives, it needs to be replaced on each death. Extends time to permadeath by around four minutes." + desc = "Preservation plate which activates once the user is dead, uses variety of different substances and sensors to slow down the decay and increase the time before the user is permanently dead, due to small tank of preservatives, it needs to be replaced on each death. Extends time to permadeath by around four minutes." value_upgrade = 500 clearance_req = 4 - behavior = RESEARCH_UPGRADE_TIER_1 + on_init_argument = RESEARCH_UPGRADE_NOTHING_TO_PASS + behavior = RESEARCH_UPGRADE_ITEM upgrade_type = ITEM_ARMOR_UPGRADE change_purchase = -100 minimum_price = 100 diff --git a/code/modules/reagents/chemistry_machinery/xenomorph_analyzer.dm b/code/modules/reagents/chemistry_machinery/xenomorph_analyzer.dm index 5bf6561b28f4..62ceb37386ff 100644 --- a/code/modules/reagents/chemistry_machinery/xenomorph_analyzer.dm +++ b/code/modules/reagents/chemistry_machinery/xenomorph_analyzer.dm @@ -96,7 +96,7 @@ data["upgrades"] += list(list( "name" = capitalize_first_letters(upgrade.name), "desc" = upgrade.desc, - "vari" = upgrade.behavior, + "vari" = upgrade.on_init_argument, "cost" = price_adjustment, "ref" = upgrade.item_reference, "category" = upgrade.upgrade_type, @@ -158,7 +158,7 @@ upgrade = datum_upgrades if(upgrade.behavior == RESEARCH_UPGRADE_CATEGORY || upgrade.behavior == RESEARCH_UPGRADE_EXCLUDE_BUY) continue - if(produce_path == upgrade.item_reference && upgrade.behavior == variation) + if(produce_path == upgrade.item_reference && upgrade.on_init_argument == variation) path_exists = TRUE break if(!path_exists) @@ -178,5 +178,8 @@ /obj/structure/machinery/xenoanalyzer/proc/print_upgrade(produce_path, variation) busy = FALSE - new produce_path(get_turf(src), variation) + if(variation != RESEARCH_UPGRADE_NOTHING_TO_PASS) + new produce_path(get_turf(src), variation) + return + new produce_path(get_turf(src))