From 74e43bc556209d91e60d5576debe9a7b6a15d1e2 Mon Sep 17 00:00:00 2001 From: oranges Date: Sun, 20 Nov 2022 14:04:28 +1300 Subject: [PATCH] Improve the naming of the element argument hash index selector (#71319) So confusing name --- code/__DEFINES/dcs/flags.dm | 2 +- code/controllers/subsystem/dcs.dm | 2 +- code/datums/elements/ELEMENT_TEMPLATE.md | 2 +- code/datums/elements/_element.dm | 5 ++++- code/datums/elements/art.dm | 2 +- code/datums/elements/atmos_requirements.dm | 2 +- code/datums/elements/backblast.dm | 2 +- code/datums/elements/bane.dm | 2 +- code/datums/elements/basic_body_temp_sensitive.dm | 2 +- code/datums/elements/basic_eating.dm | 2 +- code/datums/elements/beauty.dm | 2 +- code/datums/elements/bed_tucking.dm | 2 +- code/datums/elements/bump_click.dm | 2 +- code/datums/elements/can_barricade.dm | 2 +- code/datums/elements/chemical_transfer.dm | 2 +- code/datums/elements/chewable.dm | 2 +- code/datums/elements/climbable.dm | 2 +- code/datums/elements/connect_loc.dm | 2 +- code/datums/elements/content_barfer.dm | 2 +- code/datums/elements/crackable.dm | 2 +- code/datums/elements/crusher_loot.dm | 2 +- code/datums/elements/curse_announcement.dm | 2 +- code/datums/elements/death_drops.dm | 2 +- code/datums/elements/decals/_decal.dm | 2 +- code/datums/elements/deliver_first.dm | 2 +- code/datums/elements/diggable.dm | 2 +- code/datums/elements/dryable.dm | 2 +- code/datums/elements/easily_fragmented.dm | 2 +- code/datums/elements/embed.dm | 2 +- code/datums/elements/empprotection.dm | 2 +- code/datums/elements/eyestab.dm | 2 +- code/datums/elements/falling_hazard.dm | 2 +- code/datums/elements/firestacker.dm | 2 +- code/datums/elements/food/dunkable.dm | 2 +- code/datums/elements/food/food_trash.dm | 2 +- code/datums/elements/food/microwavable.dm | 2 +- code/datums/elements/food/processable.dm | 2 +- code/datums/elements/food/venue_price.dm | 2 +- code/datums/elements/footstep.dm | 2 +- code/datums/elements/forced_gravity.dm | 2 +- code/datums/elements/item_fov.dm | 2 +- code/datums/elements/item_scaling.dm | 2 +- code/datums/elements/lazy_fishing_spot.dm | 2 +- code/datums/elements/lifesteal.dm | 2 +- code/datums/elements/mob_killed_tally.dm | 2 +- code/datums/elements/movement_turf_changer.dm | 2 +- code/datums/elements/nerfed_pulling.dm | 2 +- code/datums/elements/obj_regen.dm | 2 +- code/datums/elements/pet_bonus.dm | 2 +- code/datums/elements/plant_backfire.dm | 2 +- code/datums/elements/prevent_attacking_of_types.dm | 2 +- code/datums/elements/ranged_attacks.dm | 2 +- code/datums/elements/ridable.dm | 2 +- code/datums/elements/rust.dm | 2 +- .../elements/screentips/contextual_screentip_bare_hands.dm | 2 +- .../screentips/contextual_screentip_item_typechecks.dm | 2 +- .../elements/screentips/contextual_screentip_sharpness.dm | 2 +- .../elements/screentips/contextual_screentip_tools.dm | 2 +- code/datums/elements/selfknockback.dm | 2 +- code/datums/elements/series.dm | 2 +- code/datums/elements/spooky.dm | 2 +- code/datums/elements/strippable.dm | 2 +- code/datums/elements/swabbable.dm | 2 +- code/datums/elements/tool_flash.dm | 2 +- code/datums/elements/trait_loc.dm | 2 +- code/datums/elements/undertile.dm | 2 +- code/datums/elements/update_icon_updates_onmob.dm | 2 +- code/datums/elements/venomous.dm | 2 +- code/datums/elements/volatile_gas_storage.dm | 2 +- code/datums/elements/weapon_description.dm | 2 +- code/datums/elements/weather_listener.dm | 2 +- code/modules/unit_tests/bespoke_id.dm | 6 +++--- code/modules/unit_tests/dcs_get_id_from_elements.dm | 6 +++--- 73 files changed, 80 insertions(+), 77 deletions(-) diff --git a/code/__DEFINES/dcs/flags.dm b/code/__DEFINES/dcs/flags.dm index 6cc721a81f1..fef738e4111 100644 --- a/code/__DEFINES/dcs/flags.dm +++ b/code/__DEFINES/dcs/flags.dm @@ -15,7 +15,7 @@ /// You would need it if you are doing something like removing the target from a processing list. #define ELEMENT_DETACH_ON_HOST_DESTROY (1 << 0) /** - * Only elements created with the same arguments given after `id_arg_index` share an element instance + * Only elements created with the same arguments given after `argument_hash_start_idx` share an element instance * The arguments are the same when the text and number values are the same and all other values have the same ref */ #define ELEMENT_BESPOKE (1 << 1) diff --git a/code/controllers/subsystem/dcs.dm b/code/controllers/subsystem/dcs.dm index a6fafed4511..4fa8581f66a 100644 --- a/code/controllers/subsystem/dcs.dm +++ b/code/controllers/subsystem/dcs.dm @@ -34,7 +34,7 @@ PROCESSING_SUBSYSTEM_DEF(dcs) var/list/fullid = list("[eletype]") var/list/named_arguments = list() - for(var/i in initial(eletype.id_arg_index) to length(arguments)) + for(var/i in initial(eletype.argument_hash_start_idx) to length(arguments)) var/key = arguments[i] if(istext(key)) diff --git a/code/datums/elements/ELEMENT_TEMPLATE.md b/code/datums/elements/ELEMENT_TEMPLATE.md index ce6ab0a3c6b..8dedfbaef43 100644 --- a/code/datums/elements/ELEMENT_TEMPLATE.md +++ b/code/datums/elements/ELEMENT_TEMPLATE.md @@ -6,7 +6,7 @@ See _element.dm for detailed explanations ```dm /datum/element/myelement element_flags = ELEMENT_BESPOKE | ELEMENT_COMPLEX_DETACH | ELEMENT_DETACH_ON_HOST_DESTROY | ELEMENT_NOTAREALFLAG // code/__DEFINES/dcs/flags.dm - //id_arg_index = 2 // Use with ELEMENT_BESPOKE + //argument_hash_start_idx = 2 // Use with ELEMENT_BESPOKE var/list/myvar = list() /datum/element/myelement/Attach(datum/target) diff --git a/code/datums/elements/_element.dm b/code/datums/elements/_element.dm index 28df9188881..154d0da9dce 100644 --- a/code/datums/elements/_element.dm +++ b/code/datums/elements/_element.dm @@ -9,12 +9,15 @@ var/element_flags = NONE /** * The index of the first attach argument to consider for duplicate elements + * + * All arguments from this index onwards (1 based) are hashed into the key to determine + * if this is a new unique element or one already exists * * Is only used when flags contains [ELEMENT_BESPOKE] * * This is infinity so you must explicitly set this */ - var/id_arg_index = INFINITY + var/argument_hash_start_idx = INFINITY /// Activates the functionality defined by the element on the given target datum /datum/element/proc/Attach(datum/target) diff --git a/code/datums/elements/art.dm b/code/datums/elements/art.dm index 46b97448001..7a8ec2d435a 100644 --- a/code/datums/elements/art.dm +++ b/code/datums/elements/art.dm @@ -1,6 +1,6 @@ /datum/element/art element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY // Detach for turfs - id_arg_index = 2 + argument_hash_start_idx = 2 var/impressiveness = 0 /datum/element/art/Attach(datum/target, impress) diff --git a/code/datums/elements/atmos_requirements.dm b/code/datums/elements/atmos_requirements.dm index 7feed788ff9..caa800bfa9b 100644 --- a/code/datums/elements/atmos_requirements.dm +++ b/code/datums/elements/atmos_requirements.dm @@ -5,7 +5,7 @@ */ /datum/element/atmos_requirements element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /// An assoc list of "what atmos does this mob require to survive in". var/list/atmos_requirements /// How much (brute) damage we take from being in unsuitable atmos. diff --git a/code/datums/elements/backblast.dm b/code/datums/elements/backblast.dm index 4daece9f5c9..169f961b3d3 100644 --- a/code/datums/elements/backblast.dm +++ b/code/datums/elements/backblast.dm @@ -6,7 +6,7 @@ */ /datum/element/backblast element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /// How many "pellets" of backblast we're shooting backwards, spread between the angle defined in angle_spread var/plumes diff --git a/code/datums/elements/bane.dm b/code/datums/elements/bane.dm index 377ba8a7242..ce149e98dca 100644 --- a/code/datums/elements/bane.dm +++ b/code/datums/elements/bane.dm @@ -1,7 +1,7 @@ /// Deals extra damage to mobs of a certain type or species. /datum/element/bane element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /// can be a mob or a species. var/target_type /// multiplier of the extra damage based on the force of the item. diff --git a/code/datums/elements/basic_body_temp_sensitive.dm b/code/datums/elements/basic_body_temp_sensitive.dm index 36755252de0..97dea51d040 100644 --- a/code/datums/elements/basic_body_temp_sensitive.dm +++ b/code/datums/elements/basic_body_temp_sensitive.dm @@ -3,7 +3,7 @@ */ /datum/element/basic_body_temp_sensitive element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 ///Min body temp var/min_body_temp = 250 diff --git a/code/datums/elements/basic_eating.dm b/code/datums/elements/basic_eating.dm index 2ddb2bf702b..593aa24adee 100644 --- a/code/datums/elements/basic_eating.dm +++ b/code/datums/elements/basic_eating.dm @@ -5,7 +5,7 @@ */ /datum/element/basic_eating element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 ///Path of the reagent added var/heal_amt /// Types the animal can eat. diff --git a/code/datums/elements/beauty.dm b/code/datums/elements/beauty.dm index 8946a5020ba..ddd3a8f5eab 100644 --- a/code/datums/elements/beauty.dm +++ b/code/datums/elements/beauty.dm @@ -5,7 +5,7 @@ */ /datum/element/beauty element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH_ON_HOST_DESTROY - id_arg_index = 2 + argument_hash_start_idx = 2 var/beauty = 0 /** * Assoc list of atoms as keys and number of time the same element instance has been attached to them as assoc value. diff --git a/code/datums/elements/bed_tucking.dm b/code/datums/elements/bed_tucking.dm index a24debe3b83..d5030a44ebd 100644 --- a/code/datums/elements/bed_tucking.dm +++ b/code/datums/elements/bed_tucking.dm @@ -1,7 +1,7 @@ /// Tucking element, for things that can be tucked into bed. /datum/element/bed_tuckable element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /// our pixel_x offset - how much the item moves x when in bed (+x is closer to the pillow) var/x_offset = 0 /// our pixel_y offset - how much the item move y when in bed (-y is closer to the middle) diff --git a/code/datums/elements/bump_click.dm b/code/datums/elements/bump_click.dm index 0011cd46901..26c188d0ac3 100644 --- a/code/datums/elements/bump_click.dm +++ b/code/datums/elements/bump_click.dm @@ -5,7 +5,7 @@ */ /datum/element/bump_click element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY // Detach for turfs - id_arg_index = 2 + argument_hash_start_idx = 2 ///Tool behaviours to check for on the bumper's active held item before clicking the attached atom with it. var/list/tool_behaviours ///Types (and their subtypes) of item to look for in the bumper's active hand before clicking the attached atom. diff --git a/code/datums/elements/can_barricade.dm b/code/datums/elements/can_barricade.dm index 480a06df175..dd53ed73804 100644 --- a/code/datums/elements/can_barricade.dm +++ b/code/datums/elements/can_barricade.dm @@ -2,7 +2,7 @@ /datum/element/can_barricade element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /datum/element/can_barricade/Attach(atom/target) . = ..() diff --git a/code/datums/elements/chemical_transfer.dm b/code/datums/elements/chemical_transfer.dm index cf6f5e82f74..60d833cedec 100644 --- a/code/datums/elements/chemical_transfer.dm +++ b/code/datums/elements/chemical_transfer.dm @@ -13,7 +13,7 @@ */ /datum/element/chemical_transfer element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 ///chance for the chemical transfer to proc. var/transfer_prob ///message attacker gets when the chemical transfer procs diff --git a/code/datums/elements/chewable.dm b/code/datums/elements/chewable.dm index 8735e526cd1..9dd1e3647b7 100644 --- a/code/datums/elements/chewable.dm +++ b/code/datums/elements/chewable.dm @@ -2,7 +2,7 @@ /// item to the user when it is equipped. /datum/element/chewable element_flags = ELEMENT_DETACH_ON_HOST_DESTROY | ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /// The amount to metabolize per second var/metabolization_amount = REAGENTS_METABOLISM diff --git a/code/datums/elements/climbable.dm b/code/datums/elements/climbable.dm index b82a5d288ab..e88af1961ba 100644 --- a/code/datums/elements/climbable.dm +++ b/code/datums/elements/climbable.dm @@ -1,6 +1,6 @@ /datum/element/climbable element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY // Detach for turfs - id_arg_index = 2 + argument_hash_start_idx = 2 ///Time it takes to climb onto the object var/climb_time = (2 SECONDS) ///Stun duration for when you get onto the object diff --git a/code/datums/elements/connect_loc.dm b/code/datums/elements/connect_loc.dm index 12fa35ea3fa..e6aecbe6ade 100644 --- a/code/datums/elements/connect_loc.dm +++ b/code/datums/elements/connect_loc.dm @@ -2,7 +2,7 @@ /// When the object moves, it will unhook the signal and rehook it to the new object. /datum/element/connect_loc element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /// An assoc list of signal -> procpath to register to the loc this object is on. var/list/connections diff --git a/code/datums/elements/content_barfer.dm b/code/datums/elements/content_barfer.dm index 7b802ba2eac..d1a52b864b8 100644 --- a/code/datums/elements/content_barfer.dm +++ b/code/datums/elements/content_barfer.dm @@ -4,7 +4,7 @@ * Used for morphs and bileworms! */ /datum/element/content_barfer - id_arg_index = 2 + argument_hash_start_idx = 2 /datum/element/content_barfer/Attach(datum/target, tally_string) . = ..() diff --git a/code/datums/elements/crackable.dm b/code/datums/elements/crackable.dm index 8a517a0f375..d3037afdf3b 100644 --- a/code/datums/elements/crackable.dm +++ b/code/datums/elements/crackable.dm @@ -1,7 +1,7 @@ /// Adds crack overlays to an object when integrity gets low /datum/element/crackable element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 var/list/icon/crack_icons /// The level at which the object starts showing cracks, 1 being at full health and 0.5 being at half health var/crack_integrity = 1 diff --git a/code/datums/elements/crusher_loot.dm b/code/datums/elements/crusher_loot.dm index ee214ba768f..c13c62a52ce 100644 --- a/code/datums/elements/crusher_loot.dm +++ b/code/datums/elements/crusher_loot.dm @@ -5,7 +5,7 @@ */ /datum/element/crusher_loot element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /// Path of the trophy dropped var/trophy_type /// chance to drop the trophy, lowered by the mob only taking partial crusher damage instead of full diff --git a/code/datums/elements/curse_announcement.dm b/code/datums/elements/curse_announcement.dm index 0c048178af5..49001f7fe13 100644 --- a/code/datums/elements/curse_announcement.dm +++ b/code/datums/elements/curse_announcement.dm @@ -7,7 +7,7 @@ */ /datum/element/curse_announcement element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 ///message sent on announce var/announcement_message ///color of the outline filter on announce diff --git a/code/datums/elements/death_drops.dm b/code/datums/elements/death_drops.dm index 3c5de1889a0..c02ba37cad7 100644 --- a/code/datums/elements/death_drops.dm +++ b/code/datums/elements/death_drops.dm @@ -5,7 +5,7 @@ */ /datum/element/death_drops element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 ///what items the target drops when killed var/list/loot diff --git a/code/datums/elements/decals/_decal.dm b/code/datums/elements/decals/_decal.dm index ab20a6eee83..fefbd7b5170 100644 --- a/code/datums/elements/decals/_decal.dm +++ b/code/datums/elements/decals/_decal.dm @@ -1,6 +1,6 @@ /datum/element/decal element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH_ON_HOST_DESTROY - id_arg_index = 2 + argument_hash_start_idx = 2 /// Whether this decal can be cleaned. var/cleanable /// A description this decal appends to the target's examine message. diff --git a/code/datums/elements/deliver_first.dm b/code/datums/elements/deliver_first.dm index dc7b3a52460..7c674bf9c71 100644 --- a/code/datums/elements/deliver_first.dm +++ b/code/datums/elements/deliver_first.dm @@ -10,7 +10,7 @@ #define DENY_SOUND_COOLDOWN (2 SECONDS) /datum/element/deliver_first element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 ///typepath of the area we will be allowed to be opened in var/goal_area_type ///how much is earned on delivery of the crate diff --git a/code/datums/elements/diggable.dm b/code/datums/elements/diggable.dm index c8e7734e329..eb5c8470a9a 100644 --- a/code/datums/elements/diggable.dm +++ b/code/datums/elements/diggable.dm @@ -1,7 +1,7 @@ /// Lets you make hitting a turf with a shovel pop something out, and scrape the turf /datum/element/diggable element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY // Detach for turfs - id_arg_index = 2 + argument_hash_start_idx = 2 /// Typepath of what we spawn on shovel var/atom/to_spawn /// Amount to spawn on shovel diff --git a/code/datums/elements/dryable.dm b/code/datums/elements/dryable.dm index 046d30c1941..ede9d8d0a3d 100644 --- a/code/datums/elements/dryable.dm +++ b/code/datums/elements/dryable.dm @@ -1,7 +1,7 @@ // If an item has this element, it can be dried on a drying rack. /datum/element/dryable element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /// The type of atom that is spawned by this element on drying. var/dry_result diff --git a/code/datums/elements/easily_fragmented.dm b/code/datums/elements/easily_fragmented.dm index f5e8e244d8a..905bb6a516b 100644 --- a/code/datums/elements/easily_fragmented.dm +++ b/code/datums/elements/easily_fragmented.dm @@ -5,7 +5,7 @@ /datum/element/easily_fragmented element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 var/break_chance diff --git a/code/datums/elements/embed.dm b/code/datums/elements/embed.dm index f628e616ef1..c5e87e13978 100644 --- a/code/datums/elements/embed.dm +++ b/code/datums/elements/embed.dm @@ -11,7 +11,7 @@ /datum/element/embed element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 var/initialized = FALSE /// whether we can skip assigning all the vars (since these are bespoke elements, we don't have to reset the vars every time we attach to something, we already know what we are!) // all of this stuff is explained in _DEFINES/combat.dm diff --git a/code/datums/elements/empprotection.dm b/code/datums/elements/empprotection.dm index ed0f3f6c76d..ab69c48988d 100644 --- a/code/datums/elements/empprotection.dm +++ b/code/datums/elements/empprotection.dm @@ -1,6 +1,6 @@ /datum/element/empprotection element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY // Detach for turfs - id_arg_index = 2 + argument_hash_start_idx = 2 var/flags = NONE /datum/element/empprotection/Attach(datum/target, _flags) diff --git a/code/datums/elements/eyestab.dm b/code/datums/elements/eyestab.dm index 79785a0ea9e..94594bcbf52 100644 --- a/code/datums/elements/eyestab.dm +++ b/code/datums/elements/eyestab.dm @@ -4,7 +4,7 @@ /// An element that lets you stab people in the eyes when targeting them /datum/element/eyestab element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /// The amount of damage to do per eyestab var/damage = 7 diff --git a/code/datums/elements/falling_hazard.dm b/code/datums/elements/falling_hazard.dm index cfa9285e7f8..acf0968b5b3 100644 --- a/code/datums/elements/falling_hazard.dm +++ b/code/datums/elements/falling_hazard.dm @@ -1,7 +1,7 @@ /// An element that will make a target thing do damage to any mob that it falls on from a z-level above /datum/element/falling_hazard element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /// The amount of damage to do when the target falls onto a mob var/fall_damage = 5 diff --git a/code/datums/elements/firestacker.dm b/code/datums/elements/firestacker.dm index 634ec18f549..b7bad65cc6c 100644 --- a/code/datums/elements/firestacker.dm +++ b/code/datums/elements/firestacker.dm @@ -3,7 +3,7 @@ */ /datum/element/firestacker element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /// How many firestacks to apply per hit var/amount diff --git a/code/datums/elements/food/dunkable.dm b/code/datums/elements/food/dunkable.dm index 7de8c9f8096..51bf6faefad 100644 --- a/code/datums/elements/food/dunkable.dm +++ b/code/datums/elements/food/dunkable.dm @@ -2,7 +2,7 @@ // Dunking the item into a container will transfer reagents from the container to the item. /datum/element/dunkable element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 var/dunk_amount // the amount of reagents that will be transfered from the container to the item on each click /datum/element/dunkable/Attach(datum/target, amount_per_dunk) diff --git a/code/datums/elements/food/food_trash.dm b/code/datums/elements/food/food_trash.dm index 03ae588e60f..b20a5649a65 100644 --- a/code/datums/elements/food/food_trash.dm +++ b/code/datums/elements/food/food_trash.dm @@ -1,7 +1,7 @@ // If an item has the food_trash element it will drop an item when it is consumed. /datum/element/food_trash element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /// The type of trash that is spawned by this element var/atom/trash ///Flags of the trash element that change its behavior diff --git a/code/datums/elements/food/microwavable.dm b/code/datums/elements/food/microwavable.dm index ad707501b43..39702b6745d 100644 --- a/code/datums/elements/food/microwavable.dm +++ b/code/datums/elements/food/microwavable.dm @@ -1,7 +1,7 @@ /// Atoms that can be microwaved from one type to another. /datum/element/microwavable element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /// The typepath we default to if we were passed no microwave result var/atom/default_typepath = /obj/item/food/badrecipe /// Resulting atom typepath on a completed microwave. diff --git a/code/datums/elements/food/processable.dm b/code/datums/elements/food/processable.dm index 3da0dacd3bd..754f221f810 100644 --- a/code/datums/elements/food/processable.dm +++ b/code/datums/elements/food/processable.dm @@ -1,7 +1,7 @@ // If an item has the processable item, it can be processed into another item with a specific tool. This adds generic behavior for those actions to make it easier to set-up generically. /datum/element/processable element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 ///The type of atom this creates when the processing recipe is used. var/atom/result_atom_type ///The tool behaviour for this processing recipe diff --git a/code/datums/elements/food/venue_price.dm b/code/datums/elements/food/venue_price.dm index 37a6bed8169..514346a22e3 100644 --- a/code/datums/elements/food/venue_price.dm +++ b/code/datums/elements/food/venue_price.dm @@ -1,7 +1,7 @@ ///This component can be used to give something value for venues /datum/element/venue_price element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 var/venue_price /datum/element/venue_price/Attach(datum/target, venue_price) diff --git a/code/datums/elements/footstep.dm b/code/datums/elements/footstep.dm index 77f118fd531..af0331122dd 100644 --- a/code/datums/elements/footstep.dm +++ b/code/datums/elements/footstep.dm @@ -3,7 +3,7 @@ ///Footstep element. Plays footsteps at parents location when it is appropriate. /datum/element/footstep element_flags = ELEMENT_DETACH_ON_HOST_DESTROY|ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 ///A list containing living mobs and the number of steps they have taken since the last time their footsteps were played. var/list/steps_for_living = list() ///volume determines the extra volume of the footstep. This is multiplied by the base volume, should there be one. diff --git a/code/datums/elements/forced_gravity.dm b/code/datums/elements/forced_gravity.dm index 39bf0b769da..dfe01c10fb7 100644 --- a/code/datums/elements/forced_gravity.dm +++ b/code/datums/elements/forced_gravity.dm @@ -1,6 +1,6 @@ /datum/element/forced_gravity element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 ///the level of gravity we force unto our target var/gravity ///whether we will override the turf if it forces no gravity diff --git a/code/datums/elements/item_fov.dm b/code/datums/elements/item_fov.dm index a16e1e90c20..0d4e6a7ec4f 100644 --- a/code/datums/elements/item_fov.dm +++ b/code/datums/elements/item_fov.dm @@ -1,7 +1,7 @@ /// An element to unconditonally add a FOV trait to the wearer, removing it when an item is unequipped /datum/element/item_fov element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /// Angle of the FoV we will apply when someone wears the clothing this element is attached to. var/fov_angle diff --git a/code/datums/elements/item_scaling.dm b/code/datums/elements/item_scaling.dm index bf8ca30dccf..cec1a511643 100644 --- a/code/datums/elements/item_scaling.dm +++ b/code/datums/elements/item_scaling.dm @@ -9,7 +9,7 @@ */ /datum/element/item_scaling element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /// Scaling value when the attached item is in the overworld (on a turf). var/overworld_scaling /// Scaling value when the attached item is in a storage component or inventory slot. diff --git a/code/datums/elements/lazy_fishing_spot.dm b/code/datums/elements/lazy_fishing_spot.dm index 18b62bdcf45..ad8b744f364 100644 --- a/code/datums/elements/lazy_fishing_spot.dm +++ b/code/datums/elements/lazy_fishing_spot.dm @@ -1,7 +1,7 @@ // Lazy fishing spot element so fisheable turfs do not have a component each since they're usually pretty common on their respective maps (lava/water/etc) /datum/element/lazy_fishing_spot element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY // Detach for turfs - id_arg_index = 2 + argument_hash_start_idx = 2 var/configuration /datum/element/lazy_fishing_spot/Attach(datum/target, configuration) diff --git a/code/datums/elements/lifesteal.dm b/code/datums/elements/lifesteal.dm index cd9889b2cb6..d1406121546 100644 --- a/code/datums/elements/lifesteal.dm +++ b/code/datums/elements/lifesteal.dm @@ -4,7 +4,7 @@ */ /datum/element/lifesteal element_flags = ELEMENT_DETACH_ON_HOST_DESTROY|ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /// heals a constant amount every time a hit occurs var/flat_heal var/static/list/damage_heal_order = list(BRUTE, BURN, OXY) diff --git a/code/datums/elements/mob_killed_tally.dm b/code/datums/elements/mob_killed_tally.dm index 00ea748bb40..3f882b1cb71 100644 --- a/code/datums/elements/mob_killed_tally.dm +++ b/code/datums/elements/mob_killed_tally.dm @@ -5,7 +5,7 @@ */ /datum/element/mob_killed_tally element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /// Which tally needs to be ticked up in the blackbox var/tally_string diff --git a/code/datums/elements/movement_turf_changer.dm b/code/datums/elements/movement_turf_changer.dm index a5de3d2356d..1147c3a8353 100644 --- a/code/datums/elements/movement_turf_changer.dm +++ b/code/datums/elements/movement_turf_changer.dm @@ -5,7 +5,7 @@ */ /datum/element/movement_turf_changer element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 ///Path of the turf added on top var/turf_type diff --git a/code/datums/elements/nerfed_pulling.dm b/code/datums/elements/nerfed_pulling.dm index 125ddf3957b..e4643551a8d 100644 --- a/code/datums/elements/nerfed_pulling.dm +++ b/code/datums/elements/nerfed_pulling.dm @@ -1,7 +1,7 @@ /// This living will be slower when pulling/moving anything in the given typecache /datum/element/nerfed_pulling element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY - id_arg_index = 2 + argument_hash_start_idx = 2 /// The typecache of things that shouldn't be easily movable var/list/typecache diff --git a/code/datums/elements/obj_regen.dm b/code/datums/elements/obj_regen.dm index f97be980858..fd045e638a3 100644 --- a/code/datums/elements/obj_regen.dm +++ b/code/datums/elements/obj_regen.dm @@ -2,7 +2,7 @@ */ /datum/element/obj_regen element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY - id_arg_index = 2 + argument_hash_start_idx = 2 /// The rate of regeneration as a function of maximum integrity. var/rate /// The objects that are regenerating due to this element. diff --git a/code/datums/elements/pet_bonus.dm b/code/datums/elements/pet_bonus.dm index 390b8d16010..41977da31c0 100644 --- a/code/datums/elements/pet_bonus.dm +++ b/code/datums/elements/pet_bonus.dm @@ -6,7 +6,7 @@ */ /datum/element/pet_bonus element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 ///optional cute message to send when you pet your pet! var/emote_message diff --git a/code/datums/elements/plant_backfire.dm b/code/datums/elements/plant_backfire.dm index e6b457bd309..e29097032a9 100644 --- a/code/datums/elements/plant_backfire.dm +++ b/code/datums/elements/plant_backfire.dm @@ -4,7 +4,7 @@ /// If they're not protected properly, we invoke a callback on the user, harming or inconveniencing them. /datum/element/plant_backfire element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /// Whether we stop the current action if backfire is triggered (EX: returning CANCEL_ATTACK_CHAIN) var/cancel_action = FALSE /// Any extra traits we want to check in addition to TRAIT_PLANT_SAFE. Mobs with a trait in this list will be considered safe. List of traits. diff --git a/code/datums/elements/prevent_attacking_of_types.dm b/code/datums/elements/prevent_attacking_of_types.dm index d4fb750e222..a7f961800a9 100644 --- a/code/datums/elements/prevent_attacking_of_types.dm +++ b/code/datums/elements/prevent_attacking_of_types.dm @@ -2,7 +2,7 @@ /// a balloon alert when it tries to. /datum/element/prevent_attacking_of_types element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /// The typecache of things this hostile can't attack var/list/typecache diff --git a/code/datums/elements/ranged_attacks.dm b/code/datums/elements/ranged_attacks.dm index 9f54f7eab57..6daaaaf2f88 100644 --- a/code/datums/elements/ranged_attacks.dm +++ b/code/datums/elements/ranged_attacks.dm @@ -1,7 +1,7 @@ ///This proc is used by basic mobs to give them a simple ranged attack! In theory this could be extended to /datum/element/ranged_attacks element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 var/casingtype = /obj/item/ammo_casing/glockroach var/projectilesound = 'sound/weapons/gun/pistol/shot.ogg' var/projectiletype diff --git a/code/datums/elements/ridable.dm b/code/datums/elements/ridable.dm index bca5716de56..2ddf3e9ed0f 100644 --- a/code/datums/elements/ridable.dm +++ b/code/datums/elements/ridable.dm @@ -8,7 +8,7 @@ */ /datum/element/ridable element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH_ON_HOST_DESTROY - id_arg_index = 2 + argument_hash_start_idx = 2 /// The specific riding component subtype we're loading our instructions from, don't leave this as default please! var/riding_component_type = /datum/component/riding diff --git a/code/datums/elements/rust.dm b/code/datums/elements/rust.dm index f0f3a8884f6..333829b3c01 100644 --- a/code/datums/elements/rust.dm +++ b/code/datums/elements/rust.dm @@ -4,7 +4,7 @@ */ /datum/element/rust element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY // Detach for turfs - id_arg_index = 2 + argument_hash_start_idx = 2 /// The rust image itself, since the icon and icon state are only used as an argument var/image/rust_overlay diff --git a/code/datums/elements/screentips/contextual_screentip_bare_hands.dm b/code/datums/elements/screentips/contextual_screentip_bare_hands.dm index 824cc0f3eac..a0703989e7f 100644 --- a/code/datums/elements/screentips/contextual_screentip_bare_hands.dm +++ b/code/datums/elements/screentips/contextual_screentip_bare_hands.dm @@ -3,7 +3,7 @@ /// This stacks with other contextual screentip elements, though you may want to register the signal/flag manually at that point for performance. /datum/element/contextual_screentip_bare_hands element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY // Detach for turfs - id_arg_index = 2 + argument_hash_start_idx = 2 /// If set, the text to show for LMB var/lmb_text diff --git a/code/datums/elements/screentips/contextual_screentip_item_typechecks.dm b/code/datums/elements/screentips/contextual_screentip_item_typechecks.dm index b57b75436fd..5dd11f54bee 100644 --- a/code/datums/elements/screentips/contextual_screentip_item_typechecks.dm +++ b/code/datums/elements/screentips/contextual_screentip_item_typechecks.dm @@ -3,7 +3,7 @@ /// This stacks with other contextual screentip elements, though you may want to register the signal/flag manually at that point for performance. /datum/element/contextual_screentip_item_typechecks element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY // Detach for turfs - id_arg_index = 2 + argument_hash_start_idx = 2 /// Map of item paths to contexts to usages var/list/item_paths_to_contexts diff --git a/code/datums/elements/screentips/contextual_screentip_sharpness.dm b/code/datums/elements/screentips/contextual_screentip_sharpness.dm index a2e5baa054e..63e34993824 100644 --- a/code/datums/elements/screentips/contextual_screentip_sharpness.dm +++ b/code/datums/elements/screentips/contextual_screentip_sharpness.dm @@ -3,7 +3,7 @@ /// This stacks with other contextual screentip elements, though you may want to register the signal/flag manually at that point for performance. /datum/element/contextual_screentip_sharpness element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY // Detach for turfs - id_arg_index = 2 + argument_hash_start_idx = 2 /// If set, the text to show for LMB var/lmb_text diff --git a/code/datums/elements/screentips/contextual_screentip_tools.dm b/code/datums/elements/screentips/contextual_screentip_tools.dm index f23c94096eb..666ddaaf284 100644 --- a/code/datums/elements/screentips/contextual_screentip_tools.dm +++ b/code/datums/elements/screentips/contextual_screentip_tools.dm @@ -3,7 +3,7 @@ /// This stacks with other contextual screentip elements, though you may want to register the signal/flag manually at that point for performance. /datum/element/contextual_screentip_tools element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY // Detach for turfs - id_arg_index = 2 + argument_hash_start_idx = 2 /// Map of tool behaviors to contexts to usages var/list/tool_behaviors diff --git a/code/datums/elements/selfknockback.dm b/code/datums/elements/selfknockback.dm index f12ba1d735d..61b2d17c3db 100644 --- a/code/datums/elements/selfknockback.dm +++ b/code/datums/elements/selfknockback.dm @@ -1,6 +1,6 @@ /datum/element/selfknockback element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 var/override_throw_val var/override_speed_val diff --git a/code/datums/elements/series.dm b/code/datums/elements/series.dm index 3ebfb64c456..398c28a47ca 100644 --- a/code/datums/elements/series.dm +++ b/code/datums/elements/series.dm @@ -6,7 +6,7 @@ */ /datum/element/series element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY // Detach for turfs - id_arg_index = 2 + argument_hash_start_idx = 2 var/list/subtype_list var/series_name diff --git a/code/datums/elements/spooky.dm b/code/datums/elements/spooky.dm index 06f8fded9c7..28341110aba 100644 --- a/code/datums/elements/spooky.dm +++ b/code/datums/elements/spooky.dm @@ -1,6 +1,6 @@ /datum/element/spooky element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 var/too_spooky = TRUE //will it spawn a new instrument? /datum/element/spooky/Attach(datum/target, too_spooky = TRUE) diff --git a/code/datums/elements/strippable.dm b/code/datums/elements/strippable.dm index 24f45432557..5026f106505 100644 --- a/code/datums/elements/strippable.dm +++ b/code/datums/elements/strippable.dm @@ -1,7 +1,7 @@ /// An element for atoms that, when dragged and dropped onto a mob, opens a strip panel. /datum/element/strippable element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH_ON_HOST_DESTROY - id_arg_index = 2 + argument_hash_start_idx = 2 /// An assoc list of keys to /datum/strippable_item var/list/items diff --git a/code/datums/elements/swabbable.dm b/code/datums/elements/swabbable.dm index 03c328e7cfb..44b03ca00d9 100644 --- a/code/datums/elements/swabbable.dm +++ b/code/datums/elements/swabbable.dm @@ -5,7 +5,7 @@ This element is used in vat growing to allow for the object to be */ /datum/element/swabable element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 ///The define of the cell_line list to use var/cell_line_define ///The define of the cell_virus list to use diff --git a/code/datums/elements/tool_flash.dm b/code/datums/elements/tool_flash.dm index c6e35d7d222..fd7c298d6c5 100644 --- a/code/datums/elements/tool_flash.dm +++ b/code/datums/elements/tool_flash.dm @@ -5,7 +5,7 @@ */ /datum/element/tool_flash element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /// Strength of the flash var/flash_strength diff --git a/code/datums/elements/trait_loc.dm b/code/datums/elements/trait_loc.dm index 24fa2b17a9c..512a1edb527 100644 --- a/code/datums/elements/trait_loc.dm +++ b/code/datums/elements/trait_loc.dm @@ -5,7 +5,7 @@ */ /datum/element/trait_loc element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH_ON_HOST_DESTROY // handles if our movable is deleted - id_arg_index = 2 + argument_hash_start_idx = 2 /// What trait to apply to the movable's loc. var/trait_to_give diff --git a/code/datums/elements/undertile.dm b/code/datums/elements/undertile.dm index 9348ac18d0f..a1e0690b35a 100644 --- a/code/datums/elements/undertile.dm +++ b/code/datums/elements/undertile.dm @@ -4,7 +4,7 @@ ///Add to an object if you want to be able to be hidden under tiles /datum/element/undertile element_flags = ELEMENT_BESPOKE | COMPONENT_DUPE_HIGHLANDER - id_arg_index = 2 + argument_hash_start_idx = 2 ///the invisiblity trait applied, like TRAIT_T_RAY_VISIBLE var/invisibility_trait diff --git a/code/datums/elements/update_icon_updates_onmob.dm b/code/datums/elements/update_icon_updates_onmob.dm index 21a6ba13fd9..a056801fba2 100644 --- a/code/datums/elements/update_icon_updates_onmob.dm +++ b/code/datums/elements/update_icon_updates_onmob.dm @@ -2,7 +2,7 @@ //Very good name, I know /datum/element/update_icon_updates_onmob element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 ///The ITEM_SLOT_X flags to update on the parent mob. (Ex: ITEM_SLOT_HANDS|ITEM_SLOT_FEET) var/update_flags = NONE ///Should the element call [/mob/proc/update_body()] in addition to clothing updates? diff --git a/code/datums/elements/venomous.dm b/code/datums/elements/venomous.dm index 6488119f7a0..c15ad2f6915 100644 --- a/code/datums/elements/venomous.dm +++ b/code/datums/elements/venomous.dm @@ -5,7 +5,7 @@ */ /datum/element/venomous element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 ///Path of the reagent added var/poison_type ///How much of the reagent added. if it's a list, it'll pick a range with the range being list(lower_value, upper_value) diff --git a/code/datums/elements/volatile_gas_storage.dm b/code/datums/elements/volatile_gas_storage.dm index 14864b08bfd..47f162445f4 100644 --- a/code/datums/elements/volatile_gas_storage.dm +++ b/code/datums/elements/volatile_gas_storage.dm @@ -1,7 +1,7 @@ /// An element to make an /obj explode based on gas pressure when broken /datum/element/volatile_gas_storage element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 /// The minimum pressure of the gas storage to consider an explosion when broken var/minimum_explosive_pressure diff --git a/code/datums/elements/weapon_description.dm b/code/datums/elements/weapon_description.dm index 9dcc6cfa2bd..e359be2c583 100644 --- a/code/datums/elements/weapon_description.dm +++ b/code/datums/elements/weapon_description.dm @@ -7,7 +7,7 @@ */ /datum/element/weapon_description element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 // Additional proc to be run for specific object types var/attached_proc diff --git a/code/datums/elements/weather_listener.dm b/code/datums/elements/weather_listener.dm index b9ab713c277..d6b9cd0182d 100644 --- a/code/datums/elements/weather_listener.dm +++ b/code/datums/elements/weather_listener.dm @@ -1,7 +1,7 @@ ///This element just handles creating and destroying an area sound manager that's hooked into weather stuff /datum/element/weather_listener element_flags = ELEMENT_BESPOKE - id_arg_index = 2 + argument_hash_start_idx = 2 var/weather_type //What events to change the track on var/list/sound_change_signals diff --git a/code/modules/unit_tests/bespoke_id.dm b/code/modules/unit_tests/bespoke_id.dm index e1356650ded..5f6ee1a5d32 100644 --- a/code/modules/unit_tests/bespoke_id.dm +++ b/code/modules/unit_tests/bespoke_id.dm @@ -1,8 +1,8 @@ /datum/unit_test/bespoke_id/Run() var/datum/element/base = /datum/element - var/base_index = initial(base.id_arg_index) + var/base_index = initial(base.argument_hash_start_idx) for(var/i in subtypesof(/datum/element)) var/datum/element/faketype = i - if((initial(faketype.element_flags) & ELEMENT_BESPOKE) && initial(faketype.id_arg_index) == base_index) - TEST_FAIL("A bespoke element was not configured with a proper id_arg_index: [faketype]") + if((initial(faketype.element_flags) & ELEMENT_BESPOKE) && initial(faketype.argument_hash_start_idx) == base_index) + TEST_FAIL("A bespoke element was not configured with a proper argument_hash_start_idx: [faketype]") diff --git a/code/modules/unit_tests/dcs_get_id_from_elements.dm b/code/modules/unit_tests/dcs_get_id_from_elements.dm index 3a6e1447657..5e6c7b7eaa8 100644 --- a/code/modules/unit_tests/dcs_get_id_from_elements.dm +++ b/code/modules/unit_tests/dcs_get_id_from_elements.dm @@ -38,9 +38,9 @@ /datum/unit_test/dcs_get_id_from_arguments/proc/get_id_from_arguments(list/arguments) return SSdcs.GetIdFromArguments(list(/datum/element/dcs_get_id_from_arguments_mock_element) + arguments) -// Necessary because GetIdFromArguments uses id_arg_index from an element type +// Necessary because GetIdFromArguments uses argument_hash_start_idx from an element type /datum/element/dcs_get_id_from_arguments_mock_element - id_arg_index = 2 + argument_hash_start_idx = 2 /datum/element/dcs_get_id_from_arguments_mock_element2 - id_arg_index = 2 + argument_hash_start_idx = 2