mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Added functionality for two-handed gun use.
This commit is contained in:
@@ -85,6 +85,7 @@ var/const/tk_maxrange = 15
|
|||||||
|
|
||||||
//stops TK grabs being equipped anywhere but into hands
|
//stops TK grabs being equipped anywhere but into hands
|
||||||
/obj/item/tk_grab/equipped(var/mob/user, var/slot)
|
/obj/item/tk_grab/equipped(var/mob/user, var/slot)
|
||||||
|
..()
|
||||||
if( (slot == slot_l_hand) || (slot== slot_r_hand) ) return
|
if( (slot == slot_l_hand) || (slot== slot_r_hand) ) return
|
||||||
qdel(src)
|
qdel(src)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -71,6 +71,16 @@
|
|||||||
// Works similarly to worn sprite_sheets, except the alternate sprites are used when the clothing/refit_for_species() proc is called.
|
// Works similarly to worn sprite_sheets, except the alternate sprites are used when the clothing/refit_for_species() proc is called.
|
||||||
var/list/sprite_sheets_obj = list()
|
var/list/sprite_sheets_obj = list()
|
||||||
|
|
||||||
|
/obj/item/equipped()
|
||||||
|
..()
|
||||||
|
var/mob/M = loc
|
||||||
|
if(!istype(M))
|
||||||
|
return
|
||||||
|
if(M.l_hand)
|
||||||
|
M.l_hand.update_held_icon()
|
||||||
|
if(M.r_hand)
|
||||||
|
M.r_hand.update_held_icon()
|
||||||
|
|
||||||
/obj/item/Destroy()
|
/obj/item/Destroy()
|
||||||
if(ismob(loc))
|
if(ismob(loc))
|
||||||
var/mob/m = loc
|
var/mob/m = loc
|
||||||
@@ -89,7 +99,7 @@
|
|||||||
var/mob/M = src.loc
|
var/mob/M = src.loc
|
||||||
if(M.l_hand == src)
|
if(M.l_hand == src)
|
||||||
M.update_inv_l_hand()
|
M.update_inv_l_hand()
|
||||||
if(M.r_hand == src)
|
else if(M.r_hand == src)
|
||||||
M.update_inv_r_hand()
|
M.update_inv_r_hand()
|
||||||
|
|
||||||
/obj/item/ex_act(severity)
|
/obj/item/ex_act(severity)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
disrupt()
|
disrupt()
|
||||||
|
|
||||||
/obj/item/device/chameleon/equipped()
|
/obj/item/device/chameleon/equipped()
|
||||||
|
..()
|
||||||
disrupt()
|
disrupt()
|
||||||
|
|
||||||
/obj/item/device/chameleon/attack_self()
|
/obj/item/device/chameleon/attack_self()
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ var/list/slot_equipment_priority = list( \
|
|||||||
wear_mask = null
|
wear_mask = null
|
||||||
update_inv_wear_mask(0)
|
update_inv_wear_mask(0)
|
||||||
return
|
return
|
||||||
|
|
||||||
/mob/proc/isEquipped(obj/item/I)
|
/mob/proc/isEquipped(obj/item/I)
|
||||||
if(!I)
|
if(!I)
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -171,9 +171,15 @@ This saves us from having to call add_fingerprint() any time something is put in
|
|||||||
update_inv_legcuffed()
|
update_inv_legcuffed()
|
||||||
else if (W == r_hand)
|
else if (W == r_hand)
|
||||||
r_hand = null
|
r_hand = null
|
||||||
|
if(l_hand)
|
||||||
|
l_hand.update_held_icon()
|
||||||
|
update_inv_l_hand()
|
||||||
update_inv_r_hand()
|
update_inv_r_hand()
|
||||||
else if (W == l_hand)
|
else if (W == l_hand)
|
||||||
l_hand = null
|
l_hand = null
|
||||||
|
if(r_hand)
|
||||||
|
r_hand.update_held_icon()
|
||||||
|
update_inv_l_hand()
|
||||||
update_inv_l_hand()
|
update_inv_l_hand()
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ var/const/MAX_ACTIVE_TIME = 400
|
|||||||
return
|
return
|
||||||
|
|
||||||
/obj/item/clothing/mask/facehugger/equipped(mob/M)
|
/obj/item/clothing/mask/facehugger/equipped(mob/M)
|
||||||
|
..()
|
||||||
Attach(M)
|
Attach(M)
|
||||||
|
|
||||||
/obj/item/clothing/mask/facehugger/Crossed(atom/target)
|
/obj/item/clothing/mask/facehugger/Crossed(atom/target)
|
||||||
|
|||||||
@@ -64,6 +64,8 @@
|
|||||||
var/list/burst_accuracy = list(0) //allows for different accuracies for each shot in a burst. Applied on top of accuracy
|
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)
|
var/list/dispersion = list(0)
|
||||||
var/mode_name = null
|
var/mode_name = null
|
||||||
|
var/requires_two_hands
|
||||||
|
var/wielded_icon = "gun_wielded"
|
||||||
|
|
||||||
var/next_fire_time = 0
|
var/next_fire_time = 0
|
||||||
|
|
||||||
@@ -87,17 +89,28 @@
|
|||||||
if(isnull(scoped_accuracy))
|
if(isnull(scoped_accuracy))
|
||||||
scoped_accuracy = accuracy
|
scoped_accuracy = accuracy
|
||||||
|
|
||||||
|
/obj/item/weapon/gun/update_held_icon()
|
||||||
|
if(requires_two_hands)
|
||||||
|
var/mob/living/M = loc
|
||||||
|
if(istype(M))
|
||||||
|
if((M.l_hand == src && !M.r_hand) || (M.r_hand == src && !M.l_hand))
|
||||||
|
item_state = wielded_icon
|
||||||
|
else
|
||||||
|
item_state = initial(item_state)
|
||||||
|
update_icon() // In case item_state is set somewhere else.
|
||||||
|
..()
|
||||||
|
|
||||||
//Checks whether a given mob can use the gun
|
//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.
|
//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.
|
//Otherwise, if you want handle_click_empty() to be called, check in consume_next_projectile() and return null there.
|
||||||
/obj/item/weapon/gun/proc/special_check(var/mob/user)
|
/obj/item/weapon/gun/proc/special_check(var/mob/user)
|
||||||
|
|
||||||
if(!istype(user, /mob/living))
|
if(!istype(user, /mob/living))
|
||||||
return 0
|
return 0
|
||||||
if(!user.IsAdvancedToolUser())
|
if(!user.IsAdvancedToolUser())
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
var/mob/living/M = user
|
var/mob/living/M = user
|
||||||
|
|
||||||
if(HULK in M.mutations)
|
if(HULK in M.mutations)
|
||||||
M << "<span class='danger'>Your fingers are much too large for the trigger guard!</span>"
|
M << "<span class='danger'>Your fingers are much too large for the trigger guard!</span>"
|
||||||
return 0
|
return 0
|
||||||
@@ -161,6 +174,14 @@
|
|||||||
user.setMoveCooldown(shoot_time) //no moving while shooting either
|
user.setMoveCooldown(shoot_time) //no moving while shooting either
|
||||||
next_fire_time = world.time + shoot_time
|
next_fire_time = world.time + shoot_time
|
||||||
|
|
||||||
|
var/held_acc_mod = 0
|
||||||
|
var/held_disp_mod = 0
|
||||||
|
if(requires_two_hands)
|
||||||
|
update_held_icon()
|
||||||
|
if((user.l_hand == src && user.r_hand) || (user.r_hand == src && user.l_hand))
|
||||||
|
held_acc_mod = -3
|
||||||
|
held_disp_mod = 3
|
||||||
|
|
||||||
//actually attempt to shoot
|
//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.
|
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)
|
for(var/i in 1 to burst)
|
||||||
@@ -169,8 +190,8 @@
|
|||||||
handle_click_empty(user)
|
handle_click_empty(user)
|
||||||
break
|
break
|
||||||
|
|
||||||
var/acc = burst_accuracy[min(i, burst_accuracy.len)]
|
var/acc = burst_accuracy[min(i, burst_accuracy.len)] + held_acc_mod
|
||||||
var/disp = dispersion[min(i, dispersion.len)]
|
var/disp = dispersion[min(i, dispersion.len)] + held_disp_mod
|
||||||
process_accuracy(projectile, user, target, acc, disp)
|
process_accuracy(projectile, user, target, acc, disp)
|
||||||
|
|
||||||
if(pointblank)
|
if(pointblank)
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 30 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 32 KiB |
Reference in New Issue
Block a user