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

Adds functionality for loading tactical guns tacticaly without needing to use your off hand #3070

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
21 changes: 21 additions & 0 deletions code/modules/projectiles/boxes_magazines/_box_magazine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,27 @@
temp_materials[material] = (bullet_cost[material] * stored_ammo.len) + base_cost[material]
set_custom_materials(temp_materials)

/// Reverse tactical tac_reloads
/obj/item/ammo_box/magazine/attackby(obj/item/OB, mob/user, params)
.=..()
if(istype(OB, /obj/item/gun/ballistic))
var/obj/item/gun/ballistic/Ballistic = OB;
if(Ballistic.tac_reloads == TRUE && do_after(user, 0.5 SECONDS, target=user))
if (Ballistic.magazine != null)
Ballistic.eject_magazine(user, FALSE, src)
return
Ballistic.insert_magazine(user, src)


//handling MOSTLY for the bulldog shotgun
/obj/item/ammo_box/magazine/attackby_secondary(obj/item/OB, mob/user, params)
.=..()
if(istype(OB, /obj/item/gun/ballistic))
var/obj/item/gun/ballistic/Ballistic = OB;
if(Ballistic.tac_reloads == TRUE && do_after(user, 0.5 SECONDS, target=user))
Ballistic.replace_secondary_magazine(src, user)
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN

///Count of number of bullets in the magazine
/obj/item/ammo_box/magazine/proc/ammo_count(countempties = TRUE)
var/boolets = 0
Expand Down
3 changes: 3 additions & 0 deletions code/modules/projectiles/guns/ballistic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,9 @@ GLOBAL_LIST_INIT(gun_saw_types, typecacheof(list(
chamber_round()
update_appearance()

//modularization
/obj/item/gun/ballistic/proc/replace_secondary_magazine(obj/item/weapon, mob/user)

/obj/item/suppressor
name = "suppressor"
desc = "A syndicate small-arms suppressor for maximum espionage."
Expand Down
42 changes: 24 additions & 18 deletions code/modules/projectiles/guns/ballistic/shotgun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -212,28 +212,12 @@
return SECONDARY_ATTACK_CALL_NORMAL

/obj/item/gun/ballistic/shotgun/bulldog/attackby_secondary(obj/item/weapon, mob/user, params)
if(!istype(weapon, secondary_magazine_type))
balloon_alert(user, "[weapon.name] doesn't fit!")
return SECONDARY_ATTACK_CALL_NORMAL
if(!user.transferItemToLoc(weapon, src))
to_chat(user, span_warning("You cannot seem to get [src] out of your hands!"))
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
var/obj/item/ammo_box/magazine/old_mag = secondary_magazine
secondary_magazine = weapon
if(old_mag)
user.put_in_hands(old_mag)
balloon_alert(user, "secondary [magazine_wording] loaded")
playsound(src, load_empty_sound, load_sound_volume, load_sound_vary)
update_appearance()
replace_secondary_magazine(weapon, user)
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN

/obj/item/gun/ballistic/shotgun/bulldog/alt_click_secondary(mob/user)
if(secondary_magazine)
var/obj/item/ammo_box/magazine/old_mag = secondary_magazine
secondary_magazine = null
user.put_in_hands(old_mag)
update_appearance()
playsound(src, load_empty_sound, load_sound_volume, load_sound_vary)
unload_secondary_magazine(user)
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN

/obj/item/gun/ballistic/shotgun/bulldog/proc/toggle_magazine()
Expand All @@ -244,6 +228,28 @@
playsound(src, load_empty_sound, load_sound_volume, load_sound_vary)
update_appearance()

/obj/item/gun/ballistic/shotgun/bulldog/proc/unload_secondary_magazine(mob/user)
var/obj/item/ammo_box/magazine/old_mag = secondary_magazine
secondary_magazine = null
user.put_in_hands(old_mag)
update_appearance()
playsound(src, load_empty_sound, load_sound_volume, load_sound_vary)

/obj/item/gun/ballistic/shotgun/bulldog/replace_secondary_magazine(obj/item/weapon, mob/user)
if(!istype(weapon, secondary_magazine_type))
balloon_alert(user, "[weapon.name] doesn't fit!")
return SECONDARY_ATTACK_CALL_NORMAL
if(!user.transferItemToLoc(weapon, src))
to_chat(user, span_warning("You cannot seem to get [src] out of your hands!"))
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
var/obj/item/ammo_box/magazine/old_mag = secondary_magazine
secondary_magazine = weapon
if(old_mag)
user.put_in_hands(old_mag)
balloon_alert(user, "secondary [magazine_wording] loaded")
playsound(src, load_empty_sound, load_sound_volume, load_sound_vary)
update_appearance()

/obj/item/gun/ballistic/shotgun/bulldog/unrestricted
pin = /obj/item/firing_pin
/////////////////////////////
Expand Down