mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-26 06:22:26 +01:00
Moves wielding firearms to attack_self, adds unique-action and toggle-firing-mode hotkeys. (#11205)
This commit is contained in:
@@ -148,8 +148,6 @@
|
||||
if(istype(loc, /obj/item/rig_module))
|
||||
has_safety = FALSE
|
||||
|
||||
update_wield_verb()
|
||||
|
||||
queue_icon_update()
|
||||
|
||||
/obj/item/gun/update_icon()
|
||||
@@ -179,6 +177,17 @@
|
||||
|
||||
update_held_icon()
|
||||
|
||||
/obj/item/gun/proc/unique_action(var/mob/user)
|
||||
return
|
||||
|
||||
/obj/item/gun/proc/toggle_firing_mode(var/mob/user, var/list/message_mobs)
|
||||
var/datum/firemode/new_mode = switch_firemodes(user)
|
||||
if(new_mode)
|
||||
playsound(user, safetyoff_sound, 25)
|
||||
to_chat(user, SPAN_NOTICE("\The [src] is now set to [new_mode.name]."))
|
||||
for(var/M in message_mobs)
|
||||
to_chat(M, SPAN_NOTICE("[user] has set \the [src] to [new_mode.name]."))
|
||||
|
||||
//Checks whether a given mob can use the gun
|
||||
//Any checks that shouldn't result in handle_click_empty() being called if they fail should go here.
|
||||
//Otherwise, if you want handle_click_empty() to be called, check in consume_next_projectile() and return null there.
|
||||
@@ -233,29 +242,6 @@
|
||||
else
|
||||
return TRUE
|
||||
|
||||
/obj/item/gun/verb/wield_gun()
|
||||
set name = "Wield Firearm"
|
||||
set category = "Object"
|
||||
set src in usr
|
||||
|
||||
if(is_wieldable)
|
||||
toggle_wield(usr)
|
||||
update_held_icon()
|
||||
else
|
||||
to_chat(usr, SPAN_WARNING("You can't wield \the [src]!"))
|
||||
|
||||
/obj/item/gun/ui_action_click()
|
||||
if(src in usr)
|
||||
wield_gun()
|
||||
|
||||
/obj/item/gun/proc/update_wield_verb()
|
||||
if(is_wieldable) //If the gun is marked as wieldable, make the action button appear and add the verb.
|
||||
action_button_name = "Wield Firearm"
|
||||
verbs += /obj/item/gun/verb/wield_gun
|
||||
else
|
||||
action_button_name = ""
|
||||
verbs -= /obj/item/gun/verb/wield_gun
|
||||
|
||||
/obj/item/gun/afterattack(atom/A, mob/living/user, adjacent, params)
|
||||
if(adjacent) return //A is adjacent, is the user, or is on the user's person
|
||||
|
||||
@@ -656,12 +642,12 @@
|
||||
|
||||
return new_mode
|
||||
|
||||
/obj/item/gun/attack_self(mob/user, var/list/message_mobs)
|
||||
var/datum/firemode/new_mode = switch_firemodes(user)
|
||||
if(new_mode)
|
||||
to_chat(user, SPAN_NOTICE("\The [src] is now set to [new_mode.name]."))
|
||||
for(var/M in message_mobs)
|
||||
to_chat(M, SPAN_NOTICE("[user] has set \the [src] to [new_mode.name]."))
|
||||
/obj/item/gun/attack_self(mob/user)
|
||||
if(is_wieldable)
|
||||
toggle_wield(usr)
|
||||
update_held_icon()
|
||||
else
|
||||
to_chat(usr, SPAN_WARNING("You can't wield \the [src]!"))
|
||||
|
||||
// Safety Procs
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
concentrated energy are used by high ranking soldiers or special operatives of the Republican army, but their durability is dubious in comparison to the mass-produced, \
|
||||
single shot or bolt action rifles that the majority of Tajaran soldiers use."
|
||||
|
||||
/obj/item/gun/energy/rifle/icelance/attack_self(mob/living/user as mob)
|
||||
/obj/item/gun/energy/rifle/icelance/unique_action(mob/living/user)
|
||||
if(is_charging)
|
||||
to_chat(user, "<span class='warning'>You are already charging \the [src].</span>")
|
||||
return
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
message_enabled = 0
|
||||
message_disable = 0
|
||||
|
||||
/obj/item/gun/energy/lawgiver/attack_self(mob/living/carbon/user as mob) //can probably remove this in favor of the DNA locked firing pins. not touching that now though. edit: lol nevermind snowflake code of the year
|
||||
/obj/item/gun/energy/lawgiver/unique_action(mob/living/carbon/user) //can probably remove this in favor of the DNA locked firing pins. not touching that now though. edit: lol nevermind snowflake code of the year
|
||||
if(dna != null)
|
||||
return
|
||||
else
|
||||
|
||||
@@ -133,7 +133,7 @@ obj/item/gun/energy/staff/focus/special_check(var/mob/living/user)
|
||||
return 1
|
||||
|
||||
|
||||
obj/item/gun/energy/staff/focus/attack_self(mob/living/user as mob)
|
||||
obj/item/gun/energy/staff/focus/toggle_firing_mode(mob/living/user)
|
||||
if(projectile_type == /obj/item/projectile/forcebolt)
|
||||
charge_cost = 400
|
||||
to_chat(user, "<span class='warning'>The [src.name] will now strike a small area.</span>")
|
||||
|
||||
@@ -139,7 +139,6 @@
|
||||
slot_flags = SLOT_BACK
|
||||
item_state = "large_3"
|
||||
is_wieldable = TRUE
|
||||
update_wield_verb()
|
||||
|
||||
/obj/item/gun/energy/laser/prototype/proc/handle_mod()
|
||||
for(var/obj/item/laser_components/modifier/modifier in gun_mods)
|
||||
|
||||
@@ -136,7 +136,7 @@
|
||||
secondary_projectile_type = null
|
||||
secondary_fire_sound = null
|
||||
|
||||
/obj/item/gun/energy/rifle/pulse/destroyer/attack_self(mob/living/user as mob)
|
||||
/obj/item/gun/energy/rifle/pulse/destroyer/toggle_firing_mode(mob/living/user)
|
||||
to_chat(user, "<span class='warning'>[src.name] has three settings, and they are all DESTROY.</span>")
|
||||
|
||||
/obj/item/gun/energy/rifle/laser/tachyon
|
||||
|
||||
@@ -370,8 +370,6 @@
|
||||
|
||||
is_wieldable = TRUE
|
||||
|
||||
action_button_name = "Wield thermal lance"
|
||||
|
||||
/obj/item/gun/energy/vaurca/typec/attack(mob/living/carbon/human/M as mob, mob/living/carbon/user as mob)
|
||||
user.setClickCooldown(16)
|
||||
..()
|
||||
@@ -462,8 +460,6 @@
|
||||
list(mode_name="point-burst auto", can_autofire = TRUE, burst = 1, fire_delay = 1, burst_accuracy = list(0,-1,-1,-2,-2,-2,-3,-3), dispersion = list(1.0, 1.0, 1.0, 1.0, 1.2))
|
||||
)
|
||||
|
||||
action_button_name = "Wield thermal drill"
|
||||
|
||||
needspin = FALSE
|
||||
|
||||
/obj/item/gun/energy/vaurca/thermaldrill/special_check(var/mob/user)
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
update_icon()
|
||||
..()
|
||||
|
||||
/obj/item/gun/launcher/crossbow/attack_self(mob/living/user)
|
||||
/obj/item/gun/launcher/crossbow/unique_action(mob/living/user)
|
||||
if(tension)
|
||||
if(bolt)
|
||||
user.visible_message("<b>[user]</b> relaxes the tension on \the [src]'s string and removes \the [bolt].", SPAN_NOTICE("You relax the tension on \the [src]'s string and remove \the [bolt]."))
|
||||
@@ -319,7 +319,7 @@
|
||||
playsound(loc, 'sound/items/rfd_empty.ogg', 50, FALSE)
|
||||
flick("[icon_state]-empty", src)
|
||||
|
||||
/obj/item/gun/launcher/crossbow/RFD/attack_self(mob/living/user as mob)
|
||||
/obj/item/gun/launcher/crossbow/RFD/unique_action(mob/living/user as mob)
|
||||
if(tension)
|
||||
user.visible_message("<b>[user]</b> relaxes the tension on \the [src]'s string.", SPAN_NOTICE("You relax the tension on \the [src]'s string."))
|
||||
playsound(loc, 'sound/weapons/holster/tactiholsterout.ogg', 50, FALSE)
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/item/gun/launcher/grenade/attack_self(mob/user)
|
||||
/obj/item/gun/launcher/grenade/unique_action(mob/user)
|
||||
pump(user)
|
||||
|
||||
/obj/item/gun/launcher/grenade/attackby(obj/item/I, mob/user)
|
||||
@@ -116,9 +116,6 @@
|
||||
force = 5
|
||||
max_grenades = 0
|
||||
|
||||
/obj/item/gun/launcher/grenade/underslung/attack_self()
|
||||
return
|
||||
|
||||
//load and unload directly into chambered
|
||||
/obj/item/gun/launcher/grenade/underslung/load(obj/item/grenade/G, mob/user)
|
||||
if(chambered)
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
else if(istype(W) && item_storage.can_be_inserted(W))
|
||||
item_storage.handle_item_insertion(W)
|
||||
|
||||
/obj/item/gun/launcher/pneumatic/attack_self(mob/user as mob)
|
||||
/obj/item/gun/launcher/pneumatic/unique_action(mob/user)
|
||||
eject_tank(user)
|
||||
|
||||
/obj/item/gun/launcher/pneumatic/consume_next_projectile(mob/user=null)
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
darts -= next
|
||||
next = null
|
||||
|
||||
/obj/item/gun/launcher/syringe/attack_self(mob/living/user as mob)
|
||||
/obj/item/gun/launcher/syringe/unique_action(mob/living/user)
|
||||
if(next)
|
||||
user.visible_message("[user] unlatches and carefully relaxes the bolt on [src].", "<span class='warning'>You unlatch and carefully relax the bolt on [src], unloading the spring.</span>")
|
||||
playsound(src.loc, 'sound/weapons/blade_close.ogg', 50, 1)
|
||||
|
||||
@@ -214,7 +214,7 @@
|
||||
..()
|
||||
load_ammo(A, user)
|
||||
|
||||
/obj/item/gun/projectile/attack_self(mob/user)
|
||||
/obj/item/gun/projectile/toggle_firing_mode(mob/user)
|
||||
if(jam_num)
|
||||
playsound(src.loc, 'sound/weapons/click.ogg', 50, TRUE)
|
||||
jam_num--
|
||||
|
||||
@@ -279,11 +279,14 @@
|
||||
playsound(user, 'sound/weapons/sawclose.ogg', 60, 1)
|
||||
update_icon()
|
||||
|
||||
/obj/item/gun/projectile/automatic/rifle/l6_saw/attack_self(mob/user as mob)
|
||||
/obj/item/gun/projectile/automatic/rifle/l6_saw/unique_action(mob/user)
|
||||
toggle_cover(user)
|
||||
|
||||
/obj/item/gun/projectile/automatic/rifle/l6_saw/toggle_firing_mode(mob/user)
|
||||
if(cover_open)
|
||||
toggle_cover(user) //close the cover
|
||||
else
|
||||
return ..() //once closed, behave like normal
|
||||
to_chat(user, SPAN_WARNING("The cover must be closed!"))
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/gun/projectile/automatic/rifle/l6_saw/attack_hand(mob/user as mob)
|
||||
if(!cover_open && user.get_inactive_hand() == src)
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
for(var/obj/item/reagent_containers/glass/beaker/B in mixing)
|
||||
B.reagents.trans_to_obj(dart, mix_amount)
|
||||
|
||||
/obj/item/gun/projectile/dartgun/attack_self(mob/user)
|
||||
/obj/item/gun/projectile/dartgun/unique_action(mob/user)
|
||||
user.set_machine(src)
|
||||
var/dat = "<b>[src] mixing control:</b><br><br>"
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
return 0
|
||||
return ..()
|
||||
|
||||
/obj/item/gun/projectile/contender/attack_self(mob/user as mob)
|
||||
/obj/item/gun/projectile/contender/unique_action(mob/user as mob)
|
||||
if(chambered)
|
||||
chambered.forceMove(get_turf(src))
|
||||
chambered = null
|
||||
@@ -176,7 +176,7 @@
|
||||
var/open_bolt = 0
|
||||
var/obj/item/ammo_magazine/boltaction/vintage/has_clip
|
||||
|
||||
/obj/item/gun/projectile/shotgun/pump/rifle/vintage/attack_self(mob/living/user as mob)
|
||||
/obj/item/gun/projectile/shotgun/pump/rifle/vintage/unique_action(mob/living/user as mob)
|
||||
if(wielded)
|
||||
if(world.time >= recentpump + 10)
|
||||
pump(user)
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
if(do_after(user, 30, act_target = src)) //SHIT IS STEALTHY EYYYYY
|
||||
sawing_in_progress = FALSE
|
||||
saw_off(user, A)
|
||||
else
|
||||
sawing_in_progress = FALSE
|
||||
else
|
||||
..()
|
||||
|
||||
@@ -38,7 +40,7 @@
|
||||
name = "pump shotgun"
|
||||
desc = "An ubiquitous unbranded shotgun. Useful for sweeping alleys."
|
||||
desc_info = "This is a ballistic weapon. To fire the weapon, ensure your intent is *not* set to 'help', have your gun mode set to 'fire', \
|
||||
then click where you want to fire. After firing, you will need to pump the gun, by clicking on the gun in your hand. To reload, load more shotgun \
|
||||
then click where you want to fire. After firing, you will need to pump the gun, by using the unique-action verb. To reload, load more shotgun \
|
||||
shells into the gun."
|
||||
icon = 'icons/obj/guns/shotgun.dmi'
|
||||
icon_state = "shotgun"
|
||||
@@ -64,9 +66,9 @@
|
||||
return chambered.BB
|
||||
return null
|
||||
|
||||
/obj/item/gun/projectile/shotgun/pump/attack_self(mob/living/user)
|
||||
/obj/item/gun/projectile/shotgun/pump/unique_action(mob/living/user)
|
||||
if(jam_num)
|
||||
return ..()
|
||||
return
|
||||
else if(unjam_cooldown + 2 SECONDS > world.time)
|
||||
return
|
||||
if(world.time >= recentpump + 10)
|
||||
@@ -146,7 +148,7 @@
|
||||
can_sawoff = TRUE
|
||||
sawnoff_workmsg = "shorten the barrel"
|
||||
|
||||
/obj/item/gun/projectile/shotgun/doublebarrel/attack_self(mob/user)
|
||||
/obj/item/gun/projectile/shotgun/doublebarrel/unique_action(mob/user)
|
||||
unload_ammo(user, TRUE)
|
||||
|
||||
/obj/item/gun/projectile/shotgun/doublebarrel/AltClick(mob/user)
|
||||
@@ -229,7 +231,7 @@
|
||||
to_chat(user, "You [folded ? "fold" : "unfold"] \the [src].")
|
||||
update_icon()
|
||||
|
||||
/obj/item/gun/projectile/shotgun/foldable/attack_self(mob/living/user)
|
||||
/obj/item/gun/projectile/shotgun/foldable/unique_action(mob/living/user)
|
||||
toggle_folded(user)
|
||||
|
||||
/obj/item/gun/projectile/shotgun/foldable/special_check(mob/user)
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
else
|
||||
icon_state = "heavysniper"
|
||||
|
||||
/obj/item/gun/projectile/heavysniper/attack_self(mob/user as mob)
|
||||
/obj/item/gun/projectile/heavysniper/unique_action(mob/user as mob)
|
||||
bolt_open = !bolt_open
|
||||
if(bolt_open)
|
||||
playsound(src.loc, 'sound/weapons/blade_open.ogg', 50, 1)
|
||||
|
||||
Reference in New Issue
Block a user