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

[READY] Adds Reloading to pretty much all guns #2017

Merged
merged 9 commits into from
Jun 6, 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
41 changes: 0 additions & 41 deletions code/game/objects/items/ego_weapons/non_abnormality/_ammoguns.dm

This file was deleted.

35 changes: 3 additions & 32 deletions code/game/objects/items/ego_weapons/non_abnormality/fullstop.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +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

/obj/item/gun/ego_gun/city/fullstop/process_chamber()
if(shotsleft)
shotsleft-=1
..()

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

/obj/item/gun/ego_gun/city/fullstop/attack_self(mob/user)
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)

/obj/item/gun/ego_gun/city/fullstop/EgoAttackInfo(mob/user)
if(chambered && chambered.BB)
return span_notice("Its bullets deal [chambered.BB.damage*projectile_damage_multiplier] [chambered.BB.damage_type] damage.")
return

/obj/item/gun/ego_gun/city/fullstop/examine(mob/user)
. = ..()
. += "Ammo Counter: [shotsleft]/[initial(shotsleft)]."
shotsleft = 10
reloadtime = 2 SECONDS

//The actual weapons
/obj/item/gun/ego_gun/city/fullstop/assault
Expand All @@ -64,7 +35,7 @@
inhand_icon_state = "fullstopsniper"
shotsleft = 17
fire_delay = 5
reloadtime = 2 SECONDS
reloadtime = 1.3 SECONDS
attribute_requirements = list(
FORTITUDE_ATTRIBUTE = 60,
PRUDENCE_ATTRIBUTE = 60,
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//Pistol
/obj/item/gun/ego_gun/city/ammogun/limbuspistol
/obj/item/gun/ego_gun/city/limbuspistol
name = "LCCB pistol"
desc = "A pistol often found in the hands of LCCB staff."
icon_state = "lccb_pistol"
Expand All @@ -11,7 +11,7 @@
fire_delay = 5

//Auto Pistol
/obj/item/gun/ego_gun/city/ammogun/limbusautopistol
/obj/item/gun/ego_gun/city/limbusautopistol
name = "LCCB auto pistol"
desc = "A pistol often found in the hands of LCCB staff. This one is fully automatic"
icon_state = "lccb_burstpistol"
Expand All @@ -24,7 +24,7 @@
autofire = 0.12 SECONDS

//Magnum
/obj/item/gun/ego_gun/city/ammogun/limbusmagnum
/obj/item/gun/ego_gun/city/limbusmagnum
name = "LCCB magnum"
desc = "A pistol often found in the hands of LCCB combat officers."
icon_state = "lccb_magnum"
Expand All @@ -37,7 +37,7 @@
fire_delay = 12

//SMG
/obj/item/gun/ego_gun/city/ammogun/limbussmg
/obj/item/gun/ego_gun/city/limbussmg
name = "LCCB submachine gun"
desc = "An SMG often found in the hands of LCCB staff. This one is fully automatic, but requires two hands."
icon_state = "lccb_smg"
Expand All @@ -49,7 +49,7 @@
autofire = 0.12 SECONDS

//Shottie
/obj/item/gun/ego_gun/city/ammogun/limbusshottie
/obj/item/gun/ego_gun/city/limbusshottie
name = "LCCB shotgun"
desc = "A shotgun found in the hands of LCCB staff. Has limited ammo and a long reload."
icon_state = "lccb_shotgun"
Expand All @@ -65,7 +65,7 @@
damtype = RED_DAMAGE


/obj/item/gun/ego_gun/city/ammogun/limbusshottie/attack(mob/living/target, mob/living/user)
/obj/item/gun/ego_gun/city/limbusshottie/attack(mob/living/target, mob/living/user)
. = ..()
user.changeNext_move(CLICK_CD_MELEE * 1.5)
if(!.)
Expand Down
36 changes: 3 additions & 33 deletions code/game/objects/items/ego_weapons/non_abnormality/thumb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,54 +9,24 @@
ammo_type = /obj/item/ammo_casing/caseless/fullstop //Does 10 damage
weapon_weight = WEAPON_HEAVY
fire_sound = 'sound/weapons/gun/rifle/shot_alt.ogg'
special = "Use in hand to reload. Attack an enemy with your bayonet to reload."
special = "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 Girlfriend things it looks like. Holds 5 bullets.
reloadtime = 5 SECONDS
attribute_requirements = list(
FORTITUDE_ATTRIBUTE = 80,
PRUDENCE_ATTRIBUTE = 60,
TEMPERANCE_ATTRIBUTE = 60,
JUSTICE_ATTRIBUTE = 60,
)


/obj/item/gun/ego_gun/city/thumb/process_chamber()
if(shotsleft)
shotsleft-=1
..()

/obj/item/gun/ego_gun/city/thumb/attack(mob/living/target, mob/living/carbon/human/user)
..()
if(shotsleft < initial(shotsleft))
shotsleft += 1
user.changeNext_move(CLICK_CD_MELEE * attack_speed)

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

/obj/item/gun/ego_gun/city/thumb/attack_self(mob/user)
to_chat(user,span_notice("You start loading a new clip, one bullet at a time."))
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)

/obj/item/gun/ego_gun/city/thumb/EgoAttackInfo(mob/user)
if(chambered && chambered.BB)
return span_notice("Its bullets deal [chambered.BB.damage*projectile_damage_multiplier] [chambered.BB.damage_type] damage.")
return

/obj/item/gun/ego_gun/city/thumb/examine(mob/user)
. = ..()
. += "Ammo Counter: [shotsleft]/[initial(shotsleft)]."

//Capo
/obj/item/gun/ego_gun/city/thumb/capo
name = "thumb capo rifle"
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
51 changes: 50 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 @@
var/autofire //In Rounds per decisecond
var/equip_bonus

//Reload mechanics
var/shotsleft
LanceSmites328 marked this conversation as resolved.
Show resolved Hide resolved
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(0 to 0.71 SECONDS)
. += "<span class='notice'>This weapon has a very fast reload.</span>"
if(0.71 SECONDS to 1.21 SECONDS)
. += "<span class='notice'>This weapon has a fast reload.</span>"
if(1.21 SECONDS to 1.71 SECONDS)
. += "<span class='notice'>This weapon has a normal reload speed.</span>"
if(1.71 SECONDS to 2.51 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,20 @@
before_firing(user = user)
return ..()

/obj/item/gun/ego_gun/attack_self(mob/user)
if(reloadtime && !is_reloading)
INVOKE_ASYNC(src, PROC_REF(reload_ego), user)
..()

/obj/item/gun/ego_gun/proc/reload_ego(mob/user)
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
2 changes: 2 additions & 0 deletions 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
Loading
Loading