[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 14:50:05 +05:30
committed by GitHub
co-authored by SmArtKar SpaceLoveSs13
parent 6da3dcaa04
commit f4e244fb49
71 changed files with 701 additions and 450 deletions
+29 -5
View File
@@ -17,8 +17,7 @@
name = "bullet"
icon = 'icons/obj/weapons/guns/ammo.dmi'
icon_state = "s-casing"
embedding = null // embedding vars are taken from the projectile itself
embed_type = null
/obj/projectile/bullet/shrapnel
name = "flying shrapnel shard"
@@ -34,7 +33,12 @@
ignore_range_hit_prone_targets = TRUE
sharpness = SHARP_EDGED
wound_bonus = 30
embedding = list(embed_chance=70, ignore_throwspeed_threshold=TRUE, fall_chance=1)
embed_type = /datum/embed_data/shrapnel
/datum/embed_data/shrapnel
embed_chance = 70
ignore_throwspeed_threshold = TRUE
fall_chance = 1
/obj/projectile/bullet/shrapnel/short_range
range = 5
@@ -70,7 +74,17 @@
ricochet_incidence_leeway = 0
embed_falloff_tile = -2
shrapnel_type = /obj/item/shrapnel/stingball
embedding = list(embed_chance=55, fall_chance=2, jostle_chance=7, ignore_throwspeed_threshold=TRUE, pain_stam_pct=0.7, pain_mult=3, jostle_pain_mult=3, rip_time=15)
embed_type = /datum/embed_data/stingball
/datum/embed_data/stingball
embed_chance = 55
fall_chance = 2
jostle_chance = 7
ignore_throwspeed_threshold = TRUE
pain_stam_pct = 0.7
pain_mult = 3
jostle_pain_mult = 3
rip_time = 15
/obj/projectile/bullet/pellet/stingball/on_ricochet(atom/A)
hit_prone_targets = TRUE // ducking will save you from the first wave, but not the rebounds
@@ -92,10 +106,20 @@
ricochets_max = 2
ricochet_chance = 140
shrapnel_type = /obj/item/shrapnel/capmine
embedding = list(embed_chance=90, fall_chance=3, jostle_chance=7, ignore_throwspeed_threshold=TRUE, pain_stam_pct=0.7, pain_mult=5, jostle_pain_mult=6, rip_time=15)
embed_type = /datum/embed_data/capmine
wound_falloff_tile = 0
embed_falloff_tile = 0
/datum/embed_data/capmine
embed_chance = 90
fall_chance = 3
jostle_chance = 7
ignore_throwspeed_threshold = TRUE
pain_stam_pct = 0.7
pain_mult = 5
jostle_pain_mult = 6
rip_time = 15
/obj/item/shrapnel/capmine
name = "\improper AP shrapnel shard"
custom_materials = list(/datum/material/iron= SMALL_MATERIAL_AMOUNT * 0.5)