From 255781dcfe294f8f863ba1ad6a3c03fc6cb807e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=9B=88=E1=9B=9F=E1=9A=B2=E1=9A=B2=E1=9B=96=E1=9B=8F?= =?UTF-8?q?=E1=9B=8B?= <55299415+Pockets-byte@users.noreply.github.com> Date: Sun, 25 Aug 2024 15:47:50 -0600 Subject: [PATCH] please let this fix the merge conflict --- .../munitions/ship_weapons/_ship_weapon.dm | 61 +++++++++++-------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/nsv13/code/modules/munitions/ship_weapons/_ship_weapon.dm b/nsv13/code/modules/munitions/ship_weapons/_ship_weapon.dm index 1e4eb464c52..3072234350b 100644 --- a/nsv13/code/modules/munitions/ship_weapons/_ship_weapon.dm +++ b/nsv13/code/modules/munitions/ship_weapons/_ship_weapon.dm @@ -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. @@ -271,6 +267,9 @@ to_chat(user, "You start to load [A] into [src].") 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) @@ -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. @@ -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 @@ -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