Ballista adjustments (#94724)

Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
This commit is contained in:
Jacquerel
2026-01-15 20:45:43 +00:00
committed by GitHub
co-authored by SmArtKar
parent 5581dd6b69
commit 6916730eca
9 changed files with 401 additions and 257 deletions
@@ -328,7 +328,7 @@
category = CAT_WEAPON_RANGED
crafting_flags = CRAFT_CHECK_DENSITY
/datum/crafting_recipe/Ratvarian_Repeater
/datum/crafting_recipe/ratvarian_repeater
name = "Emplaced Ratvarian Repeater"
tool_behaviors = list(TOOL_SCREWDRIVER,TOOL_WRENCH)
result = /obj/structure/mounted_gun/ratvarian_repeater
@@ -344,7 +344,7 @@
category = CAT_WEAPON_RANGED
crafting_flags = CRAFT_CHECK_DENSITY
/datum/crafting_recipe/Detached_Ratvarian_Repeater
/datum/crafting_recipe/detached_ratvarian_repeater
name = "Iconoclast's Repeater"
tool_behaviors = list(TOOL_WELDER)
result = /obj/item/gun/energy/laser/musket/repeater
@@ -0,0 +1,50 @@
/// Similar to the projectile drop element but holds an instance of an atom instead
/datum/component/projectile_instance_drop
dupe_mode = COMPONENT_DUPE_ALLOWED
var/atom/movable/dropped_atom
/datum/component/projectile_instance_drop/Initialize(atom/movable/dropped_atom)
if(!isprojectile(parent))
return COMPONENT_INCOMPATIBLE
if (!dropped_atom)
stack_trace("[type] created with no atom to drop.")
return COMPONENT_INCOMPATIBLE
src.dropped_atom = dropped_atom
/datum/component/projectile_instance_drop/RegisterWithParent()
dropped_atom.forceMove(parent)
RegisterSignal(parent, COMSIG_PROJECTILE_RANGE_OUT, PROC_REF(drop_item))
RegisterSignal(parent, COMSIG_PROJECTILE_SELF_ON_HIT, PROC_REF(on_projectile_hit))
RegisterSignals(dropped_atom, list(COMSIG_MOVABLE_MOVED, COMSIG_QDELETING), PROC_REF(on_instance_left))
/datum/component/projectile_instance_drop/UnregisterFromParent()
UnregisterSignal(parent, list(COMSIG_PROJECTILE_RANGE_OUT, COMSIG_PROJECTILE_SELF_ON_HIT))
if (dropped_atom)
UnregisterSignal(dropped_atom, list(COMSIG_MOVABLE_MOVED, COMSIG_QDELETING))
QDEL_NULL(dropped_atom) // If it left our atom's contents then this is a null reference, if it didn't then it's fucked I guess
/datum/component/projectile_instance_drop/Destroy(force)
dropped_atom = null
return ..()
/// When we hit something check if we should hit the floor
/datum/component/projectile_instance_drop/proc/on_projectile_hit(obj/projectile/source, atom/movable/firer, atom/target, angle, hit_limb_zone, blocked, pierce_hit)
SIGNAL_HANDLER
if (blocked < 100 && !pierce_hit)
drop_item(source)
/// Drop item to ground
/datum/component/projectile_instance_drop/proc/drop_item(obj/projectile/source)
SIGNAL_HANDLER
var/turf/drop_turf = source.drop_location()
var/atom/movable/dropping = dropped_atom
dropping.forceMove(drop_turf)
if (isitem(dropping))
var/obj/item/item_dropped = dropping
item_dropped.do_drop_animation(drop_turf)
/// If our projectile exits our contents then remove the component
/datum/component/projectile_instance_drop/proc/on_instance_left()
SIGNAL_HANDLER
dropped_atom = null
qdel(src)