Skip to content

Commit

Permalink
please let this fix the merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Pockets-byte committed Aug 25, 2024
1 parent cec528d commit 255781d
Showing 1 changed file with 35 additions and 26 deletions.
61 changes: 35 additions & 26 deletions nsv13/code/modules/munitions/ship_weapons/_ship_weapon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,9 @@

// These variables only pertain to energy weapons, but need to be checked later in /proc/fire
var/charge = 0
var/heat = 0
var/charge_rate = 0 //How quickly do we charge?
var/charge_per_shot = 0 //How much power per shot do we have to use?
var/heat_per_shot = 0 //how much heat do we make per shot
var/heat_rate = 0 // how fast do we discharge heat
var/max_heat = 0 //how much heat before ::fun:: happens
var/overloaded = 0 //have we cooked ourself

/**
* Constructor for /obj/machinery/ship_weapon
* Attempts to link the weapon to an overmap ship.
Expand Down Expand Up @@ -271,6 +267,9 @@
to_chat(user, "<span class='notice'>You start to load [A] into [src].</span>")
loading = TRUE
if(do_after(user, load_delay, target = src))
if ( !user_has_payload( A, user ) )
loading = FALSE
return FALSE
if(mag_load_sound)
playsound(src, mag_load_sound, 100, 1)

Expand All @@ -295,6 +294,19 @@

return FALSE

/obj/machinery/ship_weapon/proc/user_has_payload(obj/item/A, mob/user) // Searches humans and borgs for gunpowder before depositing
if ( !user )
return FALSE

// Prove you're not human
if ( istype( user, /mob/living/silicon/robot ) )
// Give me your hands
var/obj/item/borg/apparatus/munitions/hands = locate( /obj/item/borg/apparatus/munitions ) in user.contents
if ( !hands?.stored )
return FALSE

return TRUE

/**
* If we're not magazine-fed, eject round(s) from the weapon.
* Transitions to STATE_NOTLOADED from higher states.
Expand Down Expand Up @@ -469,28 +481,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
heat += heat_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 @@ -514,6 +506,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

0 comments on commit 255781d

Please sign in to comment.