From f3bbe830b0dac8379b7a90406c7e8d7410bb30ed Mon Sep 17 00:00:00 2001 From: Kenionatus Date: Fri, 12 Jul 2024 20:11:33 +0200 Subject: [PATCH] Sort projectiles fx.dm better (#2675) --- nsv13/code/datums/weapon_types.dm | 6 +- .../modules/overmap/weapons/projectiles_fx.dm | 202 +++++++++--------- 2 files changed, 104 insertions(+), 104 deletions(-) diff --git a/nsv13/code/datums/weapon_types.dm b/nsv13/code/datums/weapon_types.dm index 9ee7c1a34fd..4d4f32881ce 100644 --- a/nsv13/code/datums/weapon_types.dm +++ b/nsv13/code/datums/weapon_types.dm @@ -125,6 +125,7 @@ range_modifier = 5 overmap_firing_sounds = list('nsv13/sound/effects/fighters/autocannon.ogg') + //Energy Weapons /datum/ship_weapon/burst_phaser // Little red laser @@ -293,8 +294,7 @@ special_fire_proc = /obj/structure/overmap/proc/secondary_fire ai_fire_delay = 1 SECONDS -//You don't ever actually select this. Crew act as gunners. - +///You don't ever actually select this. Crew act as gunners. /datum/ship_weapon/gauss name = "Gauss guns" default_projectile_type = /obj/item/projectile/bullet/gauss_slug @@ -310,7 +310,7 @@ ai_fire_delay = 2 SECONDS allowed_roles = OVERMAP_USER_ROLE_SECONDARY_GUNNER -/datum/ship_weapon/pdc_mount // .50 cal flavored PDC bullets, which were previously just PDC flavored .50 cal turrets +/datum/ship_weapon/pdc_mount //! .50 cal flavored PDC bullets, which were previously just PDC flavored .50 cal turrets name = "PDC" default_projectile_type = /obj/item/projectile/bullet/pdc_round burst_size = 3 diff --git a/nsv13/code/modules/overmap/weapons/projectiles_fx.dm b/nsv13/code/modules/overmap/weapons/projectiles_fx.dm index 11c8505baa9..10e23391736 100644 --- a/nsv13/code/modules/overmap/weapons/projectiles_fx.dm +++ b/nsv13/code/modules/overmap/weapons/projectiles_fx.dm @@ -3,6 +3,9 @@ /obj/item/projectile/proc/spec_overmap_hit(obj/structure/overmap/target) return +/obj/item/projectile/bullet/proc/stop_homing() + homing = FALSE + /** Misc projectile types, effects, think of this as the special FX file. @@ -22,7 +25,7 @@ Misc projectile types, effects, think of this as the special FX file. flag = "overmap_heavy" spread = 5 -/obj/item/projectile/bullet/mac_relayed_round //Projectile relayed by all default MAC shells on overmap hit. No difference for AP / others as their values don't really matter on z level. +/obj/item/projectile/bullet/mac_relayed_round //!Projectile relayed by all default MAC shells on overmap hit. No difference for AP / others as their values don't really matter on z level. icon = 'nsv13/icons/obj/projectiles_nsv.dmi' icon_state = "railgun" name = "artillery round" @@ -66,9 +69,6 @@ Misc projectile types, effects, think of this as the special FX file. else addtimer(CALLBACK(src, PROC_REF(stop_homing)), 0.2 SECONDS) //Because all deck guns apparently have slight homing. -/obj/item/projectile/bullet/proc/stop_homing() - homing = FALSE - /obj/item/projectile/bullet/mac_round/ap damage = 250 armour_penetration = 70 @@ -82,32 +82,32 @@ Misc projectile types, effects, think of this as the special FX file. homing_benefit_time = 2.5 SECONDS homing_turn_speed = 30 -//Improvised ammunition, does terrible damage but is cheap to produce +///Improvised ammunition, does terrible damage but is cheap to produce /obj/item/projectile/bullet/mac_round/cannonshot name = "cannonball" damage = 350 icon_state = "cannonshot" flag = "overmap_medium" -//You somehow loaded a magic entrapment ball into a cannon. This is your reward. +///You somehow loaded a magic entrapment ball into a cannon. This is your reward. /obj/item/projectile/bullet/mac_round/cannonshot/admin damage = 600 speed = 3 flag = "overmap_heavy" -#define DIRTY_SHELL_TURF_SLUDGE_PROB 70 //Chance for sludge to spawn on a turf within the sludge range of the detonation turf. Detonation turf always gets an epicenter sludge. -#define DIRTY_SHELL_SLUDGE_RANGE 3 //Un-random sludge event radius (for the shell detonating) -#define DIRTY_SHELL_PELLET_PROB 80 //Chance for a pellet per tile from the outer circle -#define DIRTY_SHELL_PELLET_RANGE 6 //Picks all turfs on the other circle of this range and uses them as possible targets for pellets. +#define DIRTY_SHELL_TURF_SLUDGE_PROB 70 //!Chance for sludge to spawn on a turf within the sludge range of the detonation turf. Detonation turf always gets an epicenter sludge. +#define DIRTY_SHELL_SLUDGE_RANGE 3 //!Un-random sludge event radius (for the shell detonating) +#define DIRTY_SHELL_PELLET_PROB 80 //!Chance for a pellet per tile from the outer circle +#define DIRTY_SHELL_PELLET_RANGE 6 //!Picks all turfs on the other circle of this range and uses them as possible targets for pellets. -//Dirty shell: Stage 1 - overmap projectile +///Dirty shell: Stage 1 - overmap projectile /obj/item/projectile/bullet/mac_round/dirty damage = 150 name = "dirty artillery round" relay_projectile_type = /obj/item/projectile/bullet/delayed_prime/dirty_shell_stage_two -//Delayed priming projectile parent type - useful for a few different kinds of projectiles so why not. +///Delayed priming projectile parent type - useful for a few different kinds of projectiles so why not. /obj/item/projectile/bullet/delayed_prime icon = 'nsv13/icons/obj/projectiles_nsv.dmi' icon_state = "railgun" @@ -117,7 +117,7 @@ Misc projectile types, effects, think of this as the special FX file. movement_type = FLYING projectile_piercing = ALL damage = 45 //It's on a z now, lets not instakill people / objects this happens to hit. - var/penetration_fuze = 1 //Will pen through this many things considered valid for reducing this before arming. Can overpenetrate if it happens to pen through windows or other things with not enough resistance. + var/penetration_fuze = 1 //!Will pen through this many things considered valid for reducing this before arming. Can overpenetrate if it happens to pen through windows or other things with not enough resistance. /obj/item/projectile/bullet/delayed_prime/on_hit(atom/target, blocked) . = ..() @@ -140,7 +140,7 @@ Misc projectile types, effects, think of this as the special FX file. /obj/item/projectile/bullet/delayed_prime/proc/release_payload(atom/detonation_location) return -//Dirty shell: Stage 2 - z level sludge payload projectile +///Dirty shell: Stage 2 - z level sludge payload projectile /obj/item/projectile/bullet/delayed_prime/dirty_shell_stage_two name = "dirty artillery round" icon_state = "railgun" @@ -186,7 +186,7 @@ Misc projectile types, effects, think of this as the special FX file. P.fire() -//Dirty Shell: Stage 3 - spread of irradiating pellets +///Dirty Shell: Stage 3 - spread of irradiating pellets /obj/item/projectile/energy/nuclear_particle/dirty_shell_stage_three irradiate = 300 //Less radiation than the "true" gumballs name = "irradiated pellet" @@ -352,6 +352,53 @@ Misc projectile types, effects, think of this as the special FX file. can_home = TRUE armor = list("overmap_light" = 10, "overmap_medium" = 0, "overmap_heavy" = 0) +/obj/item/projectile/guided_munition/Initialize(mapload) + . = ..() + addtimer(CALLBACK(src, PROC_REF(windup)), 1 SECONDS) + + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = PROC_REF(on_entered), + ) + AddElement(/datum/element/connect_loc, loc_connections) + +/obj/item/projectile/guided_munition/proc/windup() + valid_angle = 360 //Torpedoes "wind up" to hit their target + homing_turn_speed *= 5 + homing_turn_speed = CLAMP(homing_turn_speed, 0, 360) + sleep(clearance_time) //Let it get clear of the sender. + valid_angle = initial(valid_angle) + homing_turn_speed = initial(homing_turn_speed) + +//Corvid or someone please refactor this to be less messy. +/obj/item/projectile/guided_munition/on_hit(atom/target, blocked = FALSE) + ..() + if(!check_faction(target)) + return FALSE //Faction checking for overmaps. We're gonna just cut off real early and save some math if the IFF doesn't check out. + if(isovermap(target)) //Were we to explode on an actual overmap, this would oneshot the ship as it's a powerful explosion. + return BULLET_ACT_HIT + var/obj/item/projectile/P = target //This is hacky, refactor check_faction to unify both of these. I'm bodging it for now. + if(isprojectile(target) && P.faction != faction && !P.nodamage) //Because we could be in the same faction and collide with another bullet. Let's not blow ourselves up ok? + if(obj_integrity <= P.damage) //Tank the hit, take some damage + qdel(P) + explode() + return BULLET_ACT_HIT + else + take_damage(P.damage) + qdel(P) + return FALSE //Didn't take the hit + if(!isprojectile(target)) //This is lazy as shit but is necessary to prevent explosions triggering on the overmap when two bullets collide. Fix this shit please. + detonate(target) + else + return FALSE + return BULLET_ACT_HIT + +/obj/item/projectile/guided_munition/bullet_act(obj/item/projectile/P) + . = ..() + on_hit(P) + +/obj/item/projectile/guided_munition/proc/detonate(atom/target) + explosion(target, 2, 4, 4) + /obj/item/projectile/guided_munition/torpedo icon_state = "torpedo" name = "plasma torpedo" @@ -402,6 +449,13 @@ Misc projectile types, effects, think of this as the special FX file. /obj/item/projectile/guided_munition/torpedo/hellfire/player_version damage = 300 //A bit less initial damage to compensate for the /guaranteed/ hellburn effect dealing hefty damage. +/obj/item/projectile/guided_munition/torpedo/hellfire/spec_overmap_hit(obj/structure/overmap/target) + if(length(target.occupying_levels)) + return //Ship with internal zs, let them burn + if(target.ai_controlled || istype(target, /obj/structure/overmap/small_craft)) + target.hullburn += 60 //hullburn DoT for AIs. Player Fighters get it too, did you expect to just eat one of these? + target.hullburn_power = max(target.hullburn_power, 6) + /obj/item/projectile/guided_munition/torpedo/plushtide name = "emotional support torpedo" damage = 0 @@ -423,81 +477,12 @@ Misc projectile types, effects, think of this as the special FX file. var/ai_disruption = 30 var/ai_disruption_cap = 120 -//Player-accessible version of the above. Weaker because reverse engineered ~~and balance~~ +///Player-accessible version of parent. Weaker because reverse engineered ~~and balance~~ /obj/item/projectile/guided_munition/torpedo/disruptor/prototype name = "prototype disruption torpedo" ai_disruption = 15 //Do you like stuncombat? Well the AI doesn't. ai_disruption_cap = 30 //Very effective if applied spaced out over time against damage-resistant ships. -//What you get from an incomplete torpedo. -/obj/item/projectile/guided_munition/torpedo/dud - icon_state = "torpedo_dud" - damage = 0 - can_home = FALSE - -/obj/item/projectile/guided_munition/Initialize(mapload) - . = ..() - addtimer(CALLBACK(src, PROC_REF(windup)), 1 SECONDS) - - var/static/list/loc_connections = list( - COMSIG_ATOM_ENTERED = PROC_REF(on_entered), - ) - AddElement(/datum/element/connect_loc, loc_connections) - -/obj/item/projectile/guided_munition/proc/windup() - valid_angle = 360 //Torpedoes "wind up" to hit their target - homing_turn_speed *= 5 - homing_turn_speed = CLAMP(homing_turn_speed, 0, 360) - sleep(clearance_time) //Let it get clear of the sender. - valid_angle = initial(valid_angle) - homing_turn_speed = initial(homing_turn_speed) - -/obj/item/projectile/guided_munition/missile - name = "\improper Triton cruise missile" - icon = 'nsv13/icons/obj/projectiles_nsv.dmi' - icon_state = "conventional_missile" - speed = 1 - damage = 175 - valid_angle = 120 - homing_turn_speed = 25 - range = 250 - flag = "overmap_medium" - impact_effect_type = /obj/effect/temp_visual/impact_effect/torpedo - spread = 5 //Helps them not get insta-bonked when launching - -/obj/effect/temp_visual/overmap_explosion - icon = 'nsv13/goonstation/icons/hugeexplosion.dmi' - icon_state = "explosion" - duration = 10 - -/obj/effect/temp_visual/overmap_explosion/alt - icon = 'nsv13/goonstation/icons/hugeexplosion2.dmi' - icon_state = "explosion" - duration = 10 - -//Corvid or someone please refactor this to be less messy. -/obj/item/projectile/guided_munition/on_hit(atom/target, blocked = FALSE) - ..() - if(!check_faction(target)) - return FALSE //Nsv13 - faction checking for overmaps. We're gonna just cut off real early and save some math if the IFF doesn't check out. - if(isovermap(target)) //Were we to explode on an actual overmap, this would oneshot the ship as it's a powerful explosion. - return BULLET_ACT_HIT - var/obj/item/projectile/P = target //This is hacky, refactor check_faction to unify both of these. I'm bodging it for now. - if(isprojectile(target) && P.faction != faction && !P.nodamage) //Because we could be in the same faction and collide with another bullet. Let's not blow ourselves up ok? - if(obj_integrity <= P.damage) //Tank the hit, take some damage - qdel(P) - explode() - return BULLET_ACT_HIT - else - take_damage(P.damage) - qdel(P) - return FALSE //Didn't take the hit - if(!isprojectile(target)) //This is lazy as shit but is necessary to prevent explosions triggering on the overmap when two bullets collide. Fix this shit please. - detonate(target) - else - return FALSE - return BULLET_ACT_HIT - /obj/item/projectile/guided_munition/torpedo/disruptor/spec_overmap_hit(obj/structure/overmap/target) if(length(target.occupying_levels)) return //Detonate is gonna handle this for us. @@ -514,25 +499,29 @@ Misc projectile types, effects, think of this as the special FX file. //Neither of these? I guess just some visibility penalty it is. target.add_sensor_profile_penalty(150, 10 SECONDS) -/obj/item/projectile/guided_munition/torpedo/hellfire/spec_overmap_hit(obj/structure/overmap/target) - if(length(target.occupying_levels)) - return //Ship with internal zs, let them burn - if(target.ai_controlled || istype(target, /obj/structure/overmap/small_craft)) - target.hullburn += 60 //hullburn DoT for AIs. Player Fighters get it too, did you expect to just eat one of these? - target.hullburn_power = max(target.hullburn_power, 6) - - -/obj/item/projectile/guided_munition/bullet_act(obj/item/projectile/P) - . = ..() - on_hit(P) - -/obj/item/projectile/guided_munition/proc/detonate(atom/target) - explosion(target, 2, 4, 4) - /obj/item/projectile/guided_munition/torpedo/disruptor/detonate(atom/target) empulse(get_turf(target), 5, 12) //annoying emp. explosion(target, 0, 2, 6, 4) //but only a light explosion. +///What you get from an incomplete torpedo. +/obj/item/projectile/guided_munition/torpedo/dud + icon_state = "torpedo_dud" + damage = 0 + can_home = FALSE + +/obj/item/projectile/guided_munition/missile + name = "\improper Triton cruise missile" + icon = 'nsv13/icons/obj/projectiles_nsv.dmi' + icon_state = "conventional_missile" + speed = 1 + damage = 175 + valid_angle = 120 + homing_turn_speed = 25 + range = 250 + flag = "overmap_medium" + impact_effect_type = /obj/effect/temp_visual/impact_effect/torpedo + spread = 5 //!Helps them not get insta-bonked when launching + /* Sleep for now, we'll see you again /obj/item/projectile/guided_munition/torpedo/nuclear/detonate(atom/target) var/obj/structure/overmap/OM = target.get_overmap() //What if I just.......... @@ -544,6 +533,7 @@ Misc projectile types, effects, think of this as the special FX file. return BULLET_ACT_HIT */ + /obj/item/projectile/bullet/pdc_round icon_state = "pdc" name = "PDC round" @@ -606,7 +596,7 @@ Misc projectile types, effects, think of this as the special FX file. projectile_piercing = PASSGLASS|PASSGRILLE|PASSTABLE flag = "laser" -//Designed to be spammed like crazy, but can be buffed to do extremely solid damage when you overclock the guns. +///Designed to be spammed like crazy, but can be buffed to do extremely solid damage when you overclock the guns. /obj/item/projectile/beam/laser/phaser damage = 30 flag = "overmap_medium" @@ -637,3 +627,13 @@ Misc projectile types, effects, think of this as the special FX file. damage = 175 armour_penetration = 10 speed = 0.4 + +/obj/effect/temp_visual/overmap_explosion + icon = 'nsv13/goonstation/icons/hugeexplosion.dmi' + icon_state = "explosion" + duration = 10 + +/obj/effect/temp_visual/overmap_explosion/alt + icon = 'nsv13/goonstation/icons/hugeexplosion2.dmi' + icon_state = "explosion" + duration = 10