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

Manual COCKING [DNM] #368

Open
wants to merge 5 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: 18 additions & 3 deletions code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
///world.time value, to prevent COCK COCK COCK COCK
var/cock_cooldown = 0
///Delay before we can cock again, in tenths of seconds
var/cock_delay = 30
var/cock_delay = 5
//it's a lot easier to give things a var than throw the code in everywhere
var/special_chamber = FALSE

/**How the bullet will behave once it leaves the gun, also used for basic bullet damage and effects, etc.
Ammo will be replaced on New() for things that do not use mags.**/
Expand Down Expand Up @@ -855,7 +857,7 @@ User can be passed as null, (a gun reloading itself for instance), so we need to
user.drop_inv_item_to_loc(magazine, src) //Click!
current_mag = magazine
replace_ammo(user,magazine)
if(!in_chamber)
if(!in_chamber&&special_chamber)
ready_in_chamber()
cock_gun(user)
user.visible_message(SPAN_NOTICE("[user] loads [magazine] into [src]!"),
Expand Down Expand Up @@ -1075,7 +1077,9 @@ and you're good to go.

/obj/item/weapon/gun/proc/Fire(atom/target, mob/living/user, params, reflex = FALSE, dual_wield)
set waitfor = FALSE

if(!in_chamber&&!special_chamber)
click_empty(user)
return
if(!able_to_fire(user) || !target || !get_turf(user) || !get_turf(target))
return NONE

Expand Down Expand Up @@ -1297,6 +1301,9 @@ and you're good to go.

if(active_attachable && !(active_attachable.flags_attach_features & ATTACH_PROJECTILE))
active_attachable.activate_attachment(src, null, TRUE)//We're not firing off a nade into our mouth.
if(!in_chamber&&!special_chamber) //did you even cock it?
click_empty(user)
return
var/obj/projectile/projectile_to_fire = load_into_chamber(user)
if(projectile_to_fire) //We actually have a projectile, let's move on.
user.visible_message(SPAN_WARNING("[user] pulls the trigger!"))
Expand Down Expand Up @@ -1353,18 +1360,26 @@ and you're good to go.
flags_gun_features ^= GUN_CAN_POINTBLANK //Reset this.
return TRUE


if(EXECUTION_CHECK) //Execution
if(!able_to_fire(user)) //Can they actually use guns in the first place?
return ..()
user.visible_message(SPAN_DANGER("[user] puts [src] up to [attacked_mob], steadying their aim."), SPAN_WARNING("You put [src] up to [attacked_mob], steadying your aim."),null, null, CHAT_TYPE_COMBAT_ACTION)
if(!do_after(user, 3 SECONDS, INTERRUPT_ALL|INTERRUPT_DIFF_INTENT, BUSY_ICON_HOSTILE))
return TRUE
if(!in_chamber&&!special_chamber) //did you even cock it?
click_empty(user)
return
else if(user.a_intent != INTENT_HARM) //Thwack them
return ..()

if(MODE_HAS_TOGGLEABLE_FLAG(MODE_NO_ATTACK_DEAD) && attacked_mob.stat == DEAD) // don't shoot dead people
return afterattack(attacked_mob, user, TRUE)

if(!in_chamber&&!special_chamber) //did you even cock it?
click_empty(user)
return

user.next_move = world.time //No click delay on PBs.

//Point blanking doesn't actually fire the projectile. Instead, it simulates firing the bullet proper.
Expand Down
1 change: 1 addition & 0 deletions code/modules/projectiles/guns/flare_gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
flags_gun_features = GUN_INTERNAL_MAG|GUN_CAN_POINTBLANK
gun_category = GUN_CATEGORY_HANDGUN
attachable_allowed = list(/obj/item/attachable/scope/mini/flaregun)
special_chamber = TRUE

var/last_signal_flare_name

Expand Down
1 change: 1 addition & 0 deletions code/modules/projectiles/guns/revolvers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
has_empty_icon = FALSE
has_open_icon = TRUE
current_mag = /obj/item/ammo_magazine/internal/revolver
special_chamber = TRUE

/obj/item/weapon/gun/revolver/Initialize(mapload, spawn_empty)
. = ..()
Expand Down
8 changes: 8 additions & 0 deletions code/modules/projectiles/guns/rifles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
fire_sound = "gun_pulse"
reload_sound = 'sound/weapons/handling/m41_reload.ogg'
unload_sound = 'sound/weapons/handling/m41_unload.ogg'
special_chamber = TRUE
current_mag = /obj/item/ammo_magazine/rifle
attachable_allowed = list(
/obj/item/attachable/suppressor,
Expand Down Expand Up @@ -120,6 +121,7 @@
reload_sound = 'sound/weapons/handling/nsg23_reload.ogg'
unload_sound = 'sound/weapons/handling/nsg23_unload.ogg'
cocked_sound = 'sound/weapons/handling/nsg23_cocked.ogg'
special_chamber = TRUE
aim_slowdown = SLOWDOWN_ADS_QUICK
wield_delay = WIELD_DELAY_VERY_FAST
current_mag = /obj/item/ammo_magazine/rifle/nsg23
Expand Down Expand Up @@ -291,6 +293,7 @@
item_state = "m40sd"
reload_sound = 'sound/weapons/handling/m40sd_reload.ogg'
unload_sound = 'sound/weapons/handling/m40sd_unload.ogg'
special_chamber = FALSE //because FUCK you
unacidable = TRUE
indestructible = TRUE

Expand Down Expand Up @@ -371,6 +374,7 @@
fire_sound = "gun_pulse"
reload_sound = 'sound/weapons/handling/m41_reload.ogg'
unload_sound = 'sound/weapons/handling/m41_unload.ogg'
special_chamber = TRUE
current_mag = /obj/item/ammo_magazine/rifle/m41aMK1
attachable_allowed = list(
/obj/item/attachable/suppressor,
Expand Down Expand Up @@ -448,6 +452,7 @@
fire_sound = "gun_pulse"
reload_sound = 'sound/weapons/handling/m41_reload.ogg'
unload_sound = 'sound/weapons/handling/m41_unload.ogg'
special_chamber = TRUE
current_mag = /obj/item/ammo_magazine/rifle/incendiary

accepted_ammo = list(
Expand Down Expand Up @@ -1238,6 +1243,7 @@

reload_sound = 'sound/weapons/handling/hpr_reload.ogg'
unload_sound = 'sound/weapons/handling/hpr_unload.ogg'
special_chamber = TRUE
fire_sound = 'sound/weapons/gun_hpr.ogg'
aim_slowdown = SLOWDOWN_ADS_LMG
current_mag = /obj/item/ammo_magazine/rifle/lmg
Expand Down Expand Up @@ -1296,6 +1302,7 @@
fire_sound = 'sound/weapons/gun_type71.ogg'
reload_sound = 'sound/weapons/handling/m41_reload.ogg'
unload_sound = 'sound/weapons/handling/m41_unload.ogg'
special_chamber = TRUE
current_mag = /obj/item/ammo_magazine/rifle/type71
wield_delay = WIELD_DELAY_FAST
attachable_allowed = list(
Expand Down Expand Up @@ -1555,6 +1562,7 @@
fire_sound = 'sound/weapons/gun_m4ra.ogg'
reload_sound = 'sound/weapons/handling/l42_reload.ogg'
unload_sound = 'sound/weapons/handling/l42_unload.ogg'
special_chamber = TRUE
current_mag = /obj/item/ammo_magazine/rifle/m4ra
attachable_allowed = list(
/obj/item/attachable/suppressor,
Expand Down
1 change: 1 addition & 0 deletions code/modules/projectiles/guns/smartgun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
auto_retrieval_slot = WEAR_J_STORE
start_semiauto = FALSE
start_automatic = TRUE
special_chamber = TRUE


/obj/item/weapon/gun/smartgun/Initialize(mapload, ...)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
gun_category = GUN_CATEGORY_HEAVY
has_empty_icon = FALSE
has_open_icon = FALSE
special_chamber = TRUE
///gun update_icon doesn't detect that guns with no magazine are loaded or not, and will always append _o or _e if possible.
var/GL_has_empty_icon = TRUE
///gun update_icon doesn't detect that guns with no magazine are loaded or not, and will always append _o or _e if possible.
Expand Down
Loading