Skip to content

Commit

Permalink
splits the two vars in research datums (#6507)
Browse files Browse the repository at this point in the history
# 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
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog
:cl:
code: Prevented potential unintended behavior with research upgrade
items on initialize
/:cl:
  • Loading branch information
kiVts committed Jun 27, 2024
1 parent 44dfc79 commit 9ecc2d5
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 21 deletions.
3 changes: 2 additions & 1 deletion code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
51 changes: 34 additions & 17 deletions code/datums/research_upgrade_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -33,36 +35,41 @@
/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


/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
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -175,18 +190,20 @@
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
item_reference = /obj/item/clothing/accessory/health/ceramic_plate

/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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand All @@ -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))

0 comments on commit 9ecc2d5

Please sign in to comment.