Gun Reloading Microtweaks

This commit is contained in:
Heroman3003
2023-05-27 13:30:00 +10:00
committed by CHOMPStation2
parent 5f07c2a152
commit 8826718f1c
3 changed files with 47 additions and 26 deletions

View File

@@ -80,6 +80,8 @@
var/sel_mode = 1 //index of the currently selected mode
var/list/firemodes = list()
var/reload_time = 1 //Base reload time in seconds
//aiming system stuff
var/keep_aim = 1 //1 for keep shooting until aim is lowered
//0 for one bullet after tarrget moves and aim is lowered

View File

@@ -15,6 +15,8 @@
var/modifystate
var/charge_meter = 1 //if set, the icon state will be chosen based on the current charge
reload_time = 5 //Energy weapons are slower to reload than ballistics by default, but this is no change from current values
//self-recharging
var/self_recharge = 0 //if set, the weapon will recharge itself
var/use_external_power = 0 //if set, the weapon will look for an external power source to draw from, otherwise it recharges magically
@@ -133,7 +135,7 @@
to_chat(user, "<span class='notice'>[src] already has a power cell.</span>")
else
user.visible_message("[user] is reloading [src].", "<span class='notice'>You start to insert [P] into [src].</span>")
if(do_after(user, 5 * P.w_class))
if(do_after(user, reload_time * P.w_class))
user.remove_from_mob(P)
power_supply = P
P.loc = src

View File

@@ -17,6 +17,8 @@
var/load_method = SINGLE_CASING|SPEEDLOADER //1 = Single shells, 2 = box or quick loader, 3 = magazine
var/obj/item/ammo_casing/chambered = null
reload_time = 1 //Ballistics reload fast, but not instantly
//For SINGLE_CASING or SPEEDLOADER guns
var/max_shells = 0 //the number of casings that will fit inside
var/ammo_type = null //the type of ammo that the gun comes preloaded with
@@ -54,9 +56,15 @@
chambered = ammo_magazine.stored_ammo[ammo_magazine.stored_ammo.len]
if(handle_casings != HOLD_CASINGS)
ammo_magazine.stored_ammo -= chambered
<<<<<<< HEAD
var/mob/living/M = loc
if(istype(M))
=======
var/mob/living/M = loc // TGMC Ammo HUD
if(istype(M)) // TGMC Ammo HUD
>>>>>>> 0cd26259eb... Merge pull request #14901 from KillianKirilenko/kk-guntweaks
M?.hud_used.update_ammo_hud(M, src)
if (chambered)
@@ -102,9 +110,15 @@
if(handle_casings != HOLD_CASINGS)
chambered = null
<<<<<<< HEAD
var/mob/living/M = loc
if(istype(M))
=======
var/mob/living/M = loc // TGMC Ammo HUD
if(istype(M)) // TGMC Ammo HUD
>>>>>>> 0cd26259eb... Merge pull request #14901 from KillianKirilenko/kk-guntweaks
M?.hud_used.update_ammo_hud(M, src)
@@ -121,6 +135,7 @@
if(ammo_magazine)
to_chat(user, "<span class='warning'>[src] already has a magazine loaded.</span>") //already a magazine here
return
if(do_after(user, reload_time * AM.w_class))
user.remove_from_mob(AM)
AM.loc = src
ammo_magazine = AM
@@ -141,6 +156,7 @@
AM.stored_ammo -= C //should probably go inside an ammo_magazine proc, but I guess less proc calls this way...
count++
user.hud_used.update_ammo_hud(user, src)
if(do_after(user, reload_time * AM.w_class))
if(count)
user.visible_message("[user] reloads [src].", "<span class='notice'>You load [count] round\s into [src].</span>")
user.hud_used.update_ammo_hud(user, src)
@@ -154,6 +170,7 @@
to_chat(user, "<span class='warning'>[src] is full.</span>")
return
if(do_after(user, reload_time * C.w_class))
user.remove_from_mob(C)
C.loc = src
loaded.Insert(1, C) //add to the head of the list