Skip to content

Commit

Permalink
adds reloading to all guns
Browse files Browse the repository at this point in the history
asd

Update ego_gun.dm

Update ego_gun.dm
  • Loading branch information
Kitsunemitsu committed Apr 12, 2024
1 parent b4f3f94 commit d3234bb
Show file tree
Hide file tree
Showing 11 changed files with 172 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
weapon_weight = WEAPON_HEAVY
fire_sound = 'sound/weapons/gun/rifle/shot_alt.ogg'
special = "Use in hand to reload"
var/shotsleft = 10
var/reloadtime = 3 SECONDS
shotsleft = 10
reloadtime = 3 SECONDS

/obj/item/gun/ego_gun/city/fullstop/process_chamber()
if(shotsleft)
Expand Down
8 changes: 7 additions & 1 deletion code/game/objects/items/ego_weapons/non_abnormality/kcorp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@
righthand_file = 'ModularTegustation/Teguicons/lc13_right.dmi'
ammo_type = /obj/item/ammo_casing/caseless/ego_kcorp
fire_delay = 5
shotsleft = 12
reloadtime = 0.8 SECONDS
fire_sound = 'sound/weapons/gun/pistol/shot.ogg'
fire_sound_volume = 70

Expand All @@ -110,6 +112,8 @@
fire_sound = 'sound/weapons/gun/smg/mp7.ogg'
autofire = 0.08 SECONDS
fire_delay = 1
shotsleft = 40
reloadtime = 1.2 SECONDS
attribute_requirements = list(
FORTITUDE_ATTRIBUTE = 80,
PRUDENCE_ATTRIBUTE = 60,
Expand All @@ -124,7 +128,9 @@
icon_state = "kgrenade"
inhand_icon_state = "kgrenade"
ammo_type = /obj/item/ammo_casing/caseless/ego_knade
fire_delay = 15
fire_delay = 7
shotsleft = 6
reloadtime = 1.8 SECONDS
fire_sound = 'sound/weapons/gun/general/grenade_launch.ogg'
fire_sound_volume = 70
attribute_requirements = list(
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/ego_weapons/non_abnormality/thumb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
special = "Use in hand to reload. Attack an enemy with your bayonet to reload."
projectile_damage_multiplier = 3 //30 damage per bullet
fire_delay = 7
var/shotsleft = 5 //Based off the Mas 36, That's what my Girlfirend things it looks like. Holds 5 bullets.
var/reloadtime = 5 SECONDS
shotsleft = 5 //Based off the Mas 36, That's what my Girlfirend things it looks like. Holds 5 bullets.
reloadtime = 5 SECONDS
attribute_requirements = list(
FORTITUDE_ATTRIBUTE = 80,
PRUDENCE_ATTRIBUTE = 60,
Expand Down
2 changes: 1 addition & 1 deletion code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
for(var/obj/item/gun/G in H.held_items)
if(G == src || G.weapon_weight >= WEAPON_MEDIUM)
continue
else if(G.can_trigger_gun(user))
else if(G.can_trigger_gun(user) && G.can_shoot())
bonus_spread += dual_wield_spread
loop_counter++
addtimer(CALLBACK(G, TYPE_PROC_REF(/obj/item/gun, process_fire), target, user, TRUE, params, null, bonus_spread), loop_counter)
Expand Down
48 changes: 47 additions & 1 deletion code/modules/projectiles/guns/ego_gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
///In deciseconds per round
var/autofire

//Reload mechanics
var/shotsleft
var/reloadtime
var/is_reloading

/obj/item/gun/ego_gun/Initialize()
. = ..()
chambered = new ammo_type(src)
Expand All @@ -28,6 +33,25 @@
. += "<span class='notice'>[special]</span>"
if(weapon_weight != WEAPON_HEAVY)
. += "<span class='notice'>This weapon can be fired with one hand.</span>"

if(reloadtime)
. += "Ammo Counter: [shotsleft]/[initial(shotsleft)]."
else
. += "This weapon has unlimited ammo."

if(reloadtime)
switch(reloadtime)
if(1 to 0.7 SECONDS)
. += "<span class='notice'>This weapon has a very fast reload.</span>"
if(0.71 SECONDS to 1.2 SECONDS)
. += "<span class='notice'>This weapon has a fast reload.</span>"
if(1.21 SECONDS to 1.7 SECONDS)
. += "<span class='notice'>This weapon has a normal reload speed.</span>"
if(1.71 SECONDS to 2.5 SECONDS)
. += "<span class='notice'>This weapon has a slow reload.</span>"
if(2.51 to INFINITY)
. += "<span class='notice'>This weapon has an extremely slow reload.</span>"

if(!autofire)
switch(fire_delay)
if(0 to 5)
Expand All @@ -40,7 +64,6 @@
. += "<span class='notice'>This weapon fires slowly.</span>"
else
. += "<span class='notice'>This weapon fires extremely slowly.</span>"

else
//Give it to 'em in true rounds per minute, accurate to the 5s
var/rpm = 600 / autofire
Expand Down Expand Up @@ -95,9 +118,21 @@
return

/obj/item/gun/ego_gun/can_shoot()
if(reloadtime)
if(!shotsleft)
visible_message(span_notice("The gun is out of ammo."))
playsound(src, dry_fire_sound, 30, TRUE)
return FALSE
if(is_reloading)
return FALSE

return TRUE

/obj/item/gun/ego_gun/process_chamber()

if(reloadtime && shotsleft)
shotsleft-=1

if(chambered && !chambered.BB)
recharge_newshot()

Expand All @@ -114,6 +149,17 @@
before_firing(user = user)
return ..()

/obj/item/gun/ego_gun/attack_self(mob/user)
if(reloadtime)
is_reloading = TRUE
to_chat(user,span_notice("You start loading a new magazine."))
playsound(src, 'sound/weapons/gun/general/slide_lock_1.ogg', 50, TRUE)
if(do_after(user, reloadtime, src)) //gotta reload
playsound(src, 'sound/weapons/gun/general/bolt_rack.ogg', 50, TRUE)
shotsleft = initial(shotsleft)
is_reloading = FALSE
..()

//Examine text for pistols.
/obj/item/gun/ego_gun/pistol/examine(mob/user)
. = ..()
Expand Down
6 changes: 5 additions & 1 deletion code/modules/projectiles/guns/ego_gun/aleph.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
vary_fire_sound = TRUE
fire_sound_volume = 25
autofire = 0.25 SECONDS
shotsleft = 333
reloadtime = 2.1 SECONDS

attribute_requirements = list(
FORTITUDE_ATTRIBUTE = 80,
Expand Down Expand Up @@ -146,7 +148,9 @@
ammo_type = /obj/item/ammo_casing/caseless/pink
weapon_weight = WEAPON_HEAVY
fire_sound = 'sound/abnormalities/armyinblack/pink.ogg'
fire_delay = 18
fire_delay = 9
shotsleft = 8
reloadtime = 2.1 SECONDS
zoomable = TRUE
zoom_amt = 10
zoom_out_amt = 13
Expand Down
25 changes: 21 additions & 4 deletions code/modules/projectiles/guns/ego_gun/he.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
inhand_icon_state = "prank"
ammo_type = /obj/item/ammo_casing/caseless/ego_prank
weapon_weight = WEAPON_HEAVY
fire_delay = 10
fire_delay = 5
shotsleft = 10
reloadtime = 1.4 SECONDS
damtype = BLACK_DAMAGE
fire_sound = 'sound/weapons/gun/rifle/shot_alt.ogg'
attribute_requirements = list(
Expand All @@ -19,7 +21,9 @@
icon_state = "gaze"
inhand_icon_state = "gaze"
ammo_type = /obj/item/ammo_casing/caseless/ego_gaze
fire_delay = 20
fire_delay = 10
shotsleft = 8
reloadtime = 1.8 SECONDS
fire_sound = 'sound/weapons/gun/pistol/deagle.ogg'
vary_fire_sound = FALSE
weapon_weight = WEAPON_HEAVY
Expand Down Expand Up @@ -144,6 +148,9 @@
vary_fire_sound = FALSE
weapon_weight = WEAPON_HEAVY
fire_sound_volume = 70
shotsleft = 18
reloadtime = 1.6 SECONDS

autofire = 0.35 SECONDS
attribute_requirements = list(
FORTITUDE_ATTRIBUTE = 40
Expand All @@ -156,7 +163,9 @@
inhand_icon_state = "transmission"
ammo_type = /obj/item/ammo_casing/caseless/ego_transmission
weapon_weight = WEAPON_HEAVY
fire_delay = 10
fire_delay = 5
shotsleft = 10
reloadtime = 1.4 SECONDS
fire_sound = 'sound/weapons/gun/rifle/shot_alt.ogg'
attribute_requirements = list(
FORTITUDE_ATTRIBUTE = 40
Expand All @@ -170,6 +179,8 @@
ammo_type = /obj/item/ammo_casing/caseless/ego_song
fire_sound = 'sound/weapons/gun/pistol/shot_alt.ogg'
weapon_weight = WEAPON_HEAVY
shotsleft = 10
reloadtime = 1.6 SECONDS
spread = 8
autofire = 0.15 SECONDS
attribute_requirements = list(
Expand All @@ -184,6 +195,8 @@
special = "This weapon fires 3 pellets."
ammo_type = /obj/item/ammo_casing/caseless/ego_songmini
fire_sound = 'sound/weapons/gun/revolver/shot_light.ogg'
shotsleft = 16
reloadtime = 2.1 SECONDS
spread = 8
autofire = 0.3 SECONDS
attribute_requirements = list(
Expand Down Expand Up @@ -215,7 +228,9 @@
special = "This weapon fires dice that deal varying amounts of damage."
ammo_type = /obj/item/ammo_casing/caseless/ego_swindle
weapon_weight = WEAPON_HEAVY
fire_delay = 10
fire_delay = 5
shotsleft = 12
reloadtime = 1.5 SECONDS
fire_sound = 'sound/weapons/gun/pistol/shot.ogg'
attribute_requirements = list(
FORTITUDE_ATTRIBUTE = 40
Expand Down Expand Up @@ -267,6 +282,8 @@
ammo_type = /obj/item/ammo_casing/caseless/ego_syrinx
weapon_weight = WEAPON_HEAVY
spread = 40
shotsleft = 40
reloadtime = 2 SECONDS
fire_sound = 'sound/weapons/ego/ecstasy.ogg'
autofire = 0.08 SECONDS
attribute_requirements = list(
Expand Down
30 changes: 23 additions & 7 deletions code/modules/projectiles/guns/ego_gun/teth.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
special = "This weapon does AOE damage."
ammo_type = /obj/item/ammo_casing/caseless/ego_match
weapon_weight = WEAPON_HEAVY
fire_delay = 30
fire_delay = 15
shotsleft = 8
reloadtime = 2.2 SECONDS
fire_sound = 'sound/weapons/ego/cannon.ogg'

/obj/item/gun/ego_gun/beak
Expand All @@ -23,6 +25,8 @@
ammo_type = /obj/item/ammo_casing/caseless/ego_beak
weapon_weight = WEAPON_HEAVY
spread = 10
shotsleft = 30
reloadtime = 1.3 SECONDS
fire_sound = 'sound/weapons/gun/smg/mp7.ogg'
autofire = 0.14 SECONDS

Expand All @@ -33,7 +37,9 @@
inhand_icon_state = "beakmagnum"
special = "This weapon has pinpoint accuracy when dual wielded."
ammo_type = /obj/item/ammo_casing/caseless/ego_beakmagnum
fire_delay = 20
fire_delay = 10
shotsleft = 7
reloadtime = 2.1 SECONDS
fire_sound = 'sound/weapons/gun/revolver/shot_alt.ogg'
vary_fire_sound = FALSE
fire_sound_volume = 70
Expand All @@ -47,7 +53,9 @@
special = "This weapon fires 5 pellets."
ammo_type = /obj/item/ammo_casing/caseless/ego_noise
weapon_weight = WEAPON_HEAVY
fire_delay = 20
fire_delay = 10
shotsleft = 8
reloadtime = 1.6 SECONDS
fire_sound = 'sound/weapons/gun/shotgun/shot_auto.ogg'

/obj/item/gun/ego_gun/pistol/solitude
Expand All @@ -56,7 +64,9 @@
icon_state = "solitude"
inhand_icon_state = "solitude"
ammo_type = /obj/item/ammo_casing/caseless/ego_solitude
fire_delay = 25
fire_delay = 10
shotsleft = 5
reloadtime = 2 SECONDS
fire_sound = 'sound/weapons/gun/revolver/shot_light.ogg'
vary_fire_sound = FALSE
fire_sound_volume = 70
Expand All @@ -70,6 +80,8 @@
ammo_type = /obj/item/ammo_casing/caseless/ego_shy
fire_sound = 'sound/effects/meatslap.ogg'
vary_fire_sound = FALSE
shotsleft = 20
reloadtime = 1.2 SECONDS
autofire = 0.2 SECONDS

/obj/item/gun/ego_gun/dream
Expand All @@ -80,7 +92,7 @@
ammo_type = /obj/item/ammo_casing/caseless/ego_dream
weapon_weight = WEAPON_HEAVY
fire_sound = "dreamy_gun"
autofire = 0.2 SECONDS
autofire = 0.25 SECONDS

/obj/item/gun/ego_gun/page
name = "page"
Expand All @@ -89,7 +101,9 @@
inhand_icon_state = "page"
ammo_type = /obj/item/ammo_casing/caseless/ego_page
weapon_weight = WEAPON_HEAVY
fire_delay = 10
fire_delay = 5
shotsleft = 10
reloadtime = 1.4 SECONDS
damtype = BLACK_DAMAGE
fire_sound = 'sound/weapons/gun/rifle/shot_alt.ogg'

Expand Down Expand Up @@ -158,5 +172,7 @@
special = "This weapon fires 4 pellets."
ammo_type = /obj/item/ammo_casing/caseless/ego_patriot
weapon_weight = WEAPON_HEAVY
fire_delay = 25
fire_delay = 12
shotsleft = 8
reloadtime = 1.4 SECONDS
fire_sound = 'sound/weapons/gun/shotgun/shot.ogg'
Loading

0 comments on commit d3234bb

Please sign in to comment.