mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-14 11:42:27 +00:00
* 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>
140 lines
5.8 KiB
Plaintext
140 lines
5.8 KiB
Plaintext
/obj/projectile/bullet/gyro
|
|
name ="explosive bolt"
|
|
icon_state= "bolter"
|
|
damage = 50
|
|
embed_type = null
|
|
shrapnel_type = null
|
|
|
|
/obj/projectile/bullet/gyro/on_hit(atom/target, blocked = 0, pierce_hit)
|
|
..()
|
|
explosion(target, devastation_range = -1, light_impact_range = 2, explosion_cause = src)
|
|
return BULLET_ACT_HIT
|
|
|
|
/// PM9 standard HE rocket
|
|
/obj/projectile/bullet/rocket
|
|
name = "\improper HE rocket"
|
|
desc = "Boom."
|
|
icon_state= "missile"
|
|
damage = 50
|
|
sharpness = NONE
|
|
embed_type = null
|
|
shrapnel_type = null
|
|
ricochets_max = 0
|
|
/// Whether we do extra damage when hitting a mech or silicon
|
|
var/anti_armour_damage = 0
|
|
/// Whether the rocket is capable of instantly killing a living target
|
|
var/random_crits_enabled = TRUE // Worst thing Valve ever added
|
|
|
|
/obj/projectile/bullet/rocket/on_hit(atom/target, blocked = 0, pierce_hit)
|
|
var/random_crit_gib = FALSE
|
|
if(isliving(target) && prob(1) && random_crits_enabled)
|
|
var/mob/living/gibbed_dude = target
|
|
if(gibbed_dude.stat < HARD_CRIT)
|
|
gibbed_dude.say("Is that a fucking ro-", forced = "hit by rocket")
|
|
random_crit_gib = TRUE
|
|
..()
|
|
|
|
do_boom(target, random_crit_gib)
|
|
if(anti_armour_damage && ismecha(target))
|
|
var/obj/vehicle/sealed/mecha/M = target
|
|
M.take_damage(anti_armour_damage)
|
|
if(issilicon(target))
|
|
var/mob/living/silicon/S = target
|
|
S.take_overall_damage(anti_armour_damage*0.75, anti_armour_damage*0.25)
|
|
return BULLET_ACT_HIT
|
|
|
|
/** This proc allows us to customize the conditions necesary for the rocket to detonate, allowing for different explosions for living targets, turf targets,
|
|
among other potential differences. This granularity is helpful for things like the special rockets mechs use. */
|
|
/obj/projectile/bullet/rocket/proc/do_boom(atom/target, random_crit_gib = FALSE)
|
|
if(!isliving(target)) //if the target isn't alive, so is a wall or something
|
|
explosion(target, heavy_impact_range = 1, light_impact_range = 2, flame_range = 3, flash_range = 4, explosion_cause = src)
|
|
else
|
|
explosion(target, light_impact_range = 2, flame_range = 3, flash_range = 4, explosion_cause = src)
|
|
if(random_crit_gib)
|
|
var/mob/living/gibbed_dude = target
|
|
new /obj/effect/temp_visual/crit(get_turf(gibbed_dude))
|
|
gibbed_dude.gib(DROP_ALL_REMAINS)
|
|
|
|
/// PM9 HEAP rocket - the anti-anything missile you always craved.
|
|
/obj/projectile/bullet/rocket/heap
|
|
name = "\improper HEAP rocket"
|
|
desc = "I am become death."
|
|
icon_state = "84mm-heap"
|
|
damage = 80
|
|
armour_penetration = 100
|
|
dismemberment = 100
|
|
anti_armour_damage = 200
|
|
|
|
/obj/projectile/bullet/rocket/heap/do_boom(atom/target, blocked=0)
|
|
explosion(target, devastation_range = -1, heavy_impact_range = 1, light_impact_range = 3, flame_range = 4, flash_range = 1, adminlog = FALSE)
|
|
|
|
/// PM9 weak rocket - just kind of a failure
|
|
/obj/projectile/bullet/rocket/weak
|
|
name = "low-yield rocket"
|
|
desc = "Boom, but less so."
|
|
icon_state = "low_yield_rocket"
|
|
damage = 30
|
|
|
|
/obj/projectile/bullet/rocket/weak/do_boom(atom/target, blocked=0)
|
|
if(!isliving(target)) //if the target isn't alive, so is a wall or something
|
|
explosion(target, heavy_impact_range = 1, light_impact_range = 2, flame_range = 3, flash_range = 4, explosion_cause = src)
|
|
else
|
|
explosion(target, light_impact_range = 2, flame_range = 3, flash_range = 4, explosion_cause = src)
|
|
|
|
/** SRM-8 Missile - Used by the SRM-8 Exosuit missile rack.
|
|
* Employed by Nuclear Operatives Maulers and Nanotrasen Marauders and Seraphs to kill everything and anyone.
|
|
*
|
|
* Explodes when it hits literally anything.
|
|
*/
|
|
/obj/projectile/bullet/rocket/srm
|
|
name = "short range missile"
|
|
desc = "Today's not your day, pal."
|
|
|
|
/** PEP-6 Missile - Used by the PEP-6 Exosuit missile rack.
|
|
* Employed by Roboticists out of spite to put down enemy hereteks, mechanized nuclear operatives, the janitor's hot rod,
|
|
* the clown's 'taxi service', uppity borgs, vengeful ais, doors they don't like, the escape shuttle's hull, and more!
|
|
*
|
|
* Explodes only when it hits specifically one of the following types:
|
|
* (/obj/structure), (/obj/machinery), (/obj/vehicle), (/turf/closed), (/mob/living/silicon)
|
|
*
|
|
* Does NOT explode if it hits any random mob, or any random object. Only if it is a subtype of one of the above valid atoms.
|
|
*/
|
|
/obj/projectile/bullet/rocket/pep
|
|
name = "precise explosive missile"
|
|
desc = "Human friendly, metal unfriendly."
|
|
icon_state = "low_yield_rocket"
|
|
damage = 30
|
|
anti_armour_damage = 80 //Doesn't (probably) kill borgs in one shot, but it will hurt
|
|
random_crits_enabled = FALSE //yeah, no
|
|
|
|
/obj/projectile/bullet/rocket/pep/do_boom(atom/target, blocked=0)
|
|
if(issilicon(target)) //if the target is a borg, just give them one of these to make it loud, most of the damage is in the projectile itself
|
|
explosion(target, light_impact_range = 1, flash_range = 2, explosion_cause = src)
|
|
return
|
|
if(isstructure(target) || isvehicle (target) || isclosedturf (target) || ismachinery (target)) //if the target is a structure, machine, vehicle or closed turf like a wall, explode that shit
|
|
if(target.density) //Dense objects get blown up a bit harder
|
|
explosion(target, heavy_impact_range = 1, light_impact_range = 1, flash_range = 2, explosion_cause = src)
|
|
return
|
|
else
|
|
explosion(target, light_impact_range = 1, flash_range = 2, explosion_cause = src)
|
|
return
|
|
else //if the target is anything else, we drop a missile on the ground and do nothing
|
|
new /obj/item/broken_missile(get_turf(src), 1)
|
|
|
|
/obj/item/broken_missile
|
|
name = "broken missile"
|
|
desc = "A missile that did not detonate. The tail has snapped and it is in no way fit to be used again."
|
|
icon = 'icons/obj/weapons/guns/projectiles.dmi'
|
|
icon_state = "missile_broken"
|
|
w_class = WEIGHT_CLASS_TINY
|
|
|
|
//immediately hits firer
|
|
/obj/projectile/bullet/rocket/reverse
|
|
name = "faulty rocket"
|
|
|
|
/obj/projectile/bullet/rocket/reverse/fire(angle, atom/direct_target)
|
|
..()
|
|
if(firer) //troll
|
|
firer.visible_message(span_danger("[src] blows up as soon as [firer] fires it!"))
|
|
on_hit(firer)
|