[MIRROR] Refactors embedding to use datums instead of storing data in bespoke elements (#28699)

* Refactors embedding to use datums instead of storing data in bespoke elements (#84599)

## About The Pull Request

This refactors embedding elements to make them use singleton datums
(similarly to armor) instead being bespoke and creating a new element
every time armor values are supposed to be adjusted.
Default values have been removed from defines due to now being declared
in base class itself.
Additionally fixes vending machines and tackling gloves setting
generated shards (which they instantly embed into their victim) embed
properties to null after running the embedding code, despite said shards
having non-null embedding values by default, making them not be able to
embed into anyone else, also potentially breaking the pain/jostling code
if they somehow get updated.

## Why It's Good For The Game

Current embedding system is an unnecessarily complicated mess as bespoke
elements are hard to work with, and creating a new element every time
you change values is hacky at best. This change should make it easier to
read and work with.

## Changelog
🆑
fix: Fixed glass shards generated from falling vending machines or
tackling windows not being able to embed into anyone.
refactor: Refactored embedding code to use datums instead of bespoke
elements and ugly associated lists.
/🆑

* Refactors embedding to use datums instead of storing data in bespoke elements

* modular fixes

* fix c14

* paint -> pain ugggh

---------

Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
Co-authored-by: SpaceLoveSs13 <68121607+SpaceLoveSs13@users.noreply.github.com>
This commit is contained in:
SkyratBot
2024-07-08 11:20:05 +02:00
committed by GitHub
parent 6da3dcaa04
commit f4e244fb49
71 changed files with 701 additions and 450 deletions
+4 -1
View File
@@ -33,13 +33,16 @@ GLOBAL_LIST_INIT(rod_recipes, list ( \
attack_verb_continuous = list("hits", "bludgeons", "whacks")
attack_verb_simple = list("hit", "bludgeon", "whack")
hitsound = 'sound/weapons/gun/general/grenade_launch.ogg'
embedding = list(embed_chance = 50)
embed_type = /datum/embed_data/rods
novariants = TRUE
matter_amount = 2
cost = HALF_SHEET_MATERIAL_AMOUNT
source = /datum/robot_energy_storage/material/iron
merge_type = /obj/item/stack/rods
/datum/embed_data/rods
embed_chance = 50
/obj/item/stack/rods/suicide_act(mob/living/carbon/user)
user.visible_message(span_suicide("[user] begins to stuff \the [src] down [user.p_their()] throat! It looks like [user.p_theyre()] trying to commit suicide!"))//it looks like theyre ur mum
return BRUTELOSS
+10 -1
View File
@@ -293,7 +293,16 @@ GLOBAL_LIST_INIT(plastitaniumglass_recipes, list(
var/shiv_type = /obj/item/knife/shiv
var/craft_time = 3.5 SECONDS
var/obj/item/stack/sheet/weld_material = /obj/item/stack/sheet/glass
embedding = list("embed_chance" = 65)
embed_type = /datum/embed_data/shard
/datum/embed_data/shard
embed_chance = 65
/datum/embed_data/glass_candy
embed_chance = 100
ignore_throwspeed_threshold = TRUE
impact_pain_mult = 1
pain_chance = 5
/datum/armor/item_shard
melee = 100
+22 -8
View File
@@ -14,12 +14,17 @@
grind_results = list(/datum/reagent/cellulose = 5)
splint_factor = 0.65
merge_type = /obj/item/stack/sticky_tape
var/list/conferred_embed = EMBED_HARMLESS
var/conferred_embed = /datum/embed_data/sticky_tape
///The tape type you get when ripping off a piece of tape.
var/obj/tape_gag = /obj/item/clothing/mask/muzzle/tape
greyscale_config = /datum/greyscale_config/tape
greyscale_colors = "#B2B2B2#BD6A62"
/datum/embed_data/sticky_tape
pain_mult = 0
jostle_pain_mult = 0
ignore_throwspeed_threshold = 0
/obj/item/stack/sticky_tape/attack_hand(mob/user, list/modifiers)
if(user.get_inactive_held_item() == src)
if(is_zero_amount(delete_if_zero = TRUE))
@@ -43,7 +48,7 @@
if(!isitem(target))
return NONE
if(target.embedding && target.embedding == conferred_embed)
if(target.get_embed()?.type == conferred_embed)
to_chat(user, span_warning("[target] is already coated in [src]!"))
return ITEM_INTERACT_BLOCKING
@@ -60,12 +65,11 @@
user.put_in_hands(O)
return ITEM_INTERACT_SUCCESS
if(target.embedding && target.embedding == conferred_embed)
if(target.get_embed() && target.get_embed().type == conferred_embed)
to_chat(user, span_warning("[target] is already coated in [src]!"))
return ITEM_INTERACT_BLOCKING
target.embedding = conferred_embed
target.updateEmbedding()
target.set_embed(conferred_embed)
to_chat(user, span_notice("You finish wrapping [target] with [src]."))
target.name = "[prefix] [target.name]"
@@ -80,34 +84,44 @@
singular_name = "super sticky tape"
desc = "Quite possibly the most mischevious substance in the galaxy. Use with extreme lack of caution."
prefix = "super sticky"
conferred_embed = EMBED_HARMLESS_SUPERIOR
conferred_embed = /datum/embed_data/sticky_tape/super
splint_factor = 0.4
merge_type = /obj/item/stack/sticky_tape/super
greyscale_colors = "#4D4D4D#75433F"
tape_gag = /obj/item/clothing/mask/muzzle/tape/super
/datum/embed_data/sticky_tape/super
embed_chance = 100
fall_chance = 0.1
/obj/item/stack/sticky_tape/pointy
name = "pointy tape"
singular_name = "pointy tape"
desc = "Used for sticking to things for sticking said things inside people."
icon_state = "tape_spikes"
prefix = "pointy"
conferred_embed = EMBED_POINTY
conferred_embed = /datum/embed_data/pointy_tape
merge_type = /obj/item/stack/sticky_tape/pointy
greyscale_config = /datum/greyscale_config/tape/spikes
greyscale_colors = "#E64539#808080#AD2F45"
tape_gag = /obj/item/clothing/mask/muzzle/tape/pointy
/datum/embed_data/pointy_tape
ignore_throwspeed_threshold = TRUE
/obj/item/stack/sticky_tape/pointy/super
name = "super pointy tape"
singular_name = "super pointy tape"
desc = "You didn't know tape could look so sinister. Welcome to Space Station 13."
prefix = "super pointy"
conferred_embed = EMBED_POINTY_SUPERIOR
conferred_embed = /datum/embed_data/pointy_tape/super
merge_type = /obj/item/stack/sticky_tape/pointy/super
greyscale_colors = "#8C0A00#4F4F4F#300008"
tape_gag = /obj/item/clothing/mask/muzzle/tape/pointy/super
/datum/embed_data/pointy_tape/super
embed_chance = 100
/obj/item/stack/sticky_tape/surgical
name = "surgical tape"
singular_name = "surgical tape"