Dual Wielding (#10296)

Added dual wielding. Firing a gun while another is in the off-hand will fire that one as well, at the cost of lost accuracy. You must be on harm intent to do this.
This commit is contained in:
Geeves
2020-10-28 19:53:12 +02:00
committed by GitHub
parent 857a2b5938
commit 08ca1a7420
9 changed files with 30 additions and 2 deletions

View File

@@ -73,6 +73,7 @@
var/silenced = 0
var/muzzle_flash = 3
var/accuracy = 0 //accuracy is measured in tiles. +1 accuracy means that everything is effectively one tile closer for the purpose of miss chance, -1 means the opposite. launchers are not supported, at the moment.
var/offhand_accuracy = 0 // the higher this number, the more accurate this weapon is when fired from the off-hand
var/scoped_accuracy = null
var/list/burst_accuracy = list(0) //allows for different accuracies for each shot in a burst. Applied on top of accuracy
var/list/dispersion = list(0)
@@ -308,10 +309,16 @@
return TRUE
/obj/item/gun/proc/Fire(atom/target, mob/living/user, clickparams, pointblank=0, reflex=0)
/obj/item/gun/proc/Fire(atom/target, mob/living/user, clickparams, pointblank=0, reflex=0, accuracy_decrease=0, is_offhand=0)
if(!fire_checks(target,user,clickparams,pointblank,reflex))
return FALSE
if(!is_offhand && user.a_intent == I_HURT) // no recursion
var/obj/item/gun/SG = user.get_inactive_hand()
if(istype(SG))
var/decreased_accuracy = (SG.w_class * 2) - SG.offhand_accuracy
addtimer(CALLBACK(SG, .proc/Fire, target, user, clickparams, pointblank, reflex, decreased_accuracy, TRUE), 5)
//actually attempt to shoot
var/turf/targloc = get_turf(target) //cache this in case target gets deleted during shooting, e.g. if it was a securitron that got destroyed.
for(var/i in 1 to burst)
@@ -320,7 +327,7 @@
handle_click_empty(user)
break
var/acc = burst_accuracy[min(i, burst_accuracy.len)]
var/acc = burst_accuracy[min(i, burst_accuracy.len)] - accuracy_decrease
var/disp = dispersion[min(i, dispersion.len)]
process_accuracy(projectile, user, target, acc, disp)

View File

@@ -11,6 +11,7 @@
force = 5
origin_tech = list(TECH_COMBAT = 2, TECH_MAGNET = 2)
matter = list(DEFAULT_WALL_MATERIAL = 2000)
offhand_accuracy = 1
projectile_type = /obj/item/projectile/energy/blaster
max_shots = 6
@@ -73,6 +74,7 @@
item_state = "blaster_carbine"
max_shots = 12
origin_tech = list(TECH_COMBAT = 3, TECH_MAGNET = 2)
offhand_accuracy = 0
projectile_type = /obj/item/projectile/energy/blaster
slot_flags = SLOT_BELT
w_class = ITEMSIZE_NORMAL
@@ -85,6 +87,7 @@
item_state = "blaster_rifle"
max_shots = 20
origin_tech = list(TECH_COMBAT = 4, TECH_MAGNET = 3)
offhand_accuracy = 0
projectile_type = /obj/item/projectile/energy/blaster/heavy
slot_flags = SLOT_BACK

View File

@@ -45,6 +45,7 @@ obj/item/gun/energy/retro
fire_sound = 'sound/weapons/laser1.ogg'
slot_flags = SLOT_BELT
w_class = ITEMSIZE_NORMAL
offhand_accuracy = 1
projectile_type = /obj/item/projectile/beam
fire_delay = 10 //old technology
can_turret = 1
@@ -66,6 +67,7 @@ obj/item/gun/energy/retro
fire_sound = 'sound/weapons/laser1.ogg'
slot_flags = SLOT_BELT
w_class = ITEMSIZE_NORMAL
offhand_accuracy = 2
projectile_type = /obj/item/projectile/beam
origin_tech = null
max_shots = 5 //to compensate a bit for self-recharging

View File

@@ -39,4 +39,5 @@
icon = 'icons/obj/guns/pulse_pistol.dmi'
icon_state = "pulse_pistol"
item_state = "pulse_pistol"
offhand_accuracy = 1
max_shots = 5

View File

@@ -140,6 +140,7 @@
max_shells = 7
recoil = 2
accuracy = -1
offhand_accuracy = 1
fire_delay = 9
icon = 'icons/obj/guns/ipistol.dmi'
icon_state = "ipistol"

View File

@@ -8,6 +8,7 @@
item_state = "colt"
caliber = ".45"
accuracy = 1
offhand_accuracy = 1
origin_tech = list(TECH_COMBAT = 2, TECH_MATERIAL = 2)
fire_sound = 'sound/weapons/gunshot/gunshot_light.ogg'
load_method = MAGAZINE
@@ -51,6 +52,7 @@
allowed_magazines = list(/obj/item/ammo_magazine/c45m)
caliber = ".45"
accuracy = 1
offhand_accuracy = 1
origin_tech = list(TECH_COMBAT = 2, TECH_MATERIAL = 2)
fire_sound = 'sound/weapons/gunshot/gunshot_pistol.ogg'
load_method = MAGAZINE
@@ -92,6 +94,7 @@
item_state = "x9"
w_class = ITEMSIZE_NORMAL
accuracy = 1
offhand_accuracy = 1
load_method = MAGAZINE
slot_flags = SLOT_BELT|SLOT_HOLSTER
max_shells = 16
@@ -114,6 +117,7 @@
allowed_magazines = list(/obj/item/ammo_magazine/mc10mm)
caliber = "10mm"
accuracy = 1
offhand_accuracy = 1
origin_tech = list(TECH_COMBAT = 3, TECH_MATERIAL = 2)
fire_sound = 'sound/weapons/gunshot/gunshot_pistol.ogg'
load_method = MAGAZINE
@@ -141,6 +145,7 @@
fire_sound = 'sound/weapons/gunshot/gunshot_suppressed.ogg'
w_class = ITEMSIZE_NORMAL
accuracy = 1
offhand_accuracy = 1
caliber = ".45"
silenced = 1
origin_tech = list(TECH_COMBAT = 2, TECH_MATERIAL = 2, TECH_ILLEGAL = 8)
@@ -225,6 +230,7 @@
item_state = "pistol"
w_class = ITEMSIZE_SMALL
accuracy = 1
offhand_accuracy = 2
caliber = "9mm"
silenced = 0
origin_tech = list(TECH_COMBAT = 2, TECH_MATERIAL = 2, TECH_ILLEGAL = 2)

View File

@@ -5,6 +5,7 @@
icon_state = "revolver"
item_state = "revolver"
accuracy = 1
offhand_accuracy = 1
caliber = "357"
origin_tech = list(TECH_COMBAT = 2, TECH_MATERIAL = 2)
handle_casings = CYCLE_CASINGS

View File

@@ -19,6 +19,7 @@
ammo_type = /obj/item/ammo_casing/a145
//+2 accuracy over the LWAP because only one shot
accuracy = -3
offhand_accuracy = -1
scoped_accuracy = 4
var/bolt_open = 0
var/has_scope = TRUE