Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improves a little bit of cursed weapon code #2676

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions nsv13/code/modules/munitions/ship_weapons/_ship_weapon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -465,27 +465,8 @@
* Returns projectile if successfully fired, FALSE otherwise.
*/
/obj/machinery/ship_weapon/proc/fire(atom/target, shots = weapon_type.burst_size, manual = TRUE)
//Fun fact: set [waitfor, etc] is special, and is inherited by child procs even if they do not call parent!
set waitfor = FALSE //As to not hold up any feedback messages.

// Energy weapons fire behavior
if(istype(src, /obj/machinery/ship_weapon/energy)) // Now 100% more modular!
if(can_fire(target, shots))
if(manual)
linked.last_fired = overlay
for(var/i = 0, i < shots, i++)
do_animation()

local_fire()
overmap_fire(target)
charge -= charge_per_shot

after_fire()
if(shots > 1)
sleep(weapon_type.burst_fire_delay)
return TRUE
return FALSE

// Default weapons fire behavior
if(can_fire(target, shots))
if(manual)
linked.last_fired = overlay
Expand All @@ -509,6 +490,23 @@
if(semi_auto)
chamber(rapidfire = TRUE)
after_fire()
. = TRUE //waitfor = FALSE early return returns the current . value at the time of sleeping, so this makes it return the correct value for burst fire weapons.
if(shots > 1)
sleep(weapon_type.burst_fire_delay)
return TRUE
return FALSE

/obj/machinery/ship_weapon/energy/fire(atom/target, shots = weapon_type.burst_size, manual = TRUE)
if(can_fire(target, shots))
if(manual)
linked.last_fired = overlay
for(var/i = 0, i < shots, i++)
do_animation()
local_fire()
overmap_fire(target)
charge -= charge_per_shot
after_fire()
. = TRUE
if(shots > 1)
sleep(weapon_type.burst_fire_delay)
return TRUE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@
animate_projectile(target)

/obj/machinery/ship_weapon/broadside/fire(atom/target, shots = weapon_type.burst_size, manual = TRUE)
..()
new /obj/effect/particle_effect/muzzleflash(loc)
. = ..()
if(.)
new /obj/effect/particle_effect/muzzleflash(loc)

/obj/machinery/ship_weapon/broadside/local_fire(shots = weapon_type.burst_size, atom/target) //For the broadside cannons, we want to eject spent casings
var/obj/R = new /obj/item/ship_weapon/parts/broadside_casing(get_ranged_target_turf(src, NORTH, 4)) //Right
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
say("Cycling complete: Configuration - 400mm Slug Selected")

/obj/machinery/ship_weapon/hybrid_rail/fire(atom/target, shots = weapon_type.burst_size, manual = TRUE)
set waitfor = FALSE //As to not hold up any feedback messages.
if(can_fire(target, shots))
if(manual)
linked.last_fired = overlay
Expand All @@ -114,6 +113,8 @@
else
state = STATE_NOTLOADED
after_fire()
. = TRUE
return TRUE //I don't know why it didn't return true if successful but I assume someone just forgot.
return FALSE

/obj/machinery/ship_weapon/hybrid_rail/can_fire(target, shots = weapon_type.burst_size) //Target is for the passed target variable, Shots is for the burst fire size
Expand Down
Loading