Skip to content

Commit

Permalink
renames a couple of one letter vars in bipod code, tweaks the icon sl…
Browse files Browse the repository at this point in the history
…ightly

lightly tested, seems to work
  • Loading branch information
VileBeggar committed Feb 2, 2024
1 parent a981b42 commit 34a5029
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
70 changes: 35 additions & 35 deletions code/modules/projectiles/gun_attachables.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3278,18 +3278,18 @@ Defined in conflicts.dm of the #defines folder.
scatter_mod = SCATTER_AMOUNT_TIER_9
recoil_mod = RECOIL_AMOUNT_TIER_5

/obj/item/attachable/bipod/Attach(obj/item/weapon/gun/G)
/obj/item/attachable/bipod/Attach(obj/item/weapon/gun/gun)
..()

if((GUN_FIREMODE_AUTOMATIC in G.gun_firemode_list) || (G.flags_gun_features & GUN_SUPPORT_PLATFORM))
if((GUN_FIREMODE_AUTOMATIC in gun.gun_firemode_list) || (gun.flags_gun_features & GUN_SUPPORT_PLATFORM))
var/given_action = FALSE
if(usr && (G == usr.l_hand || G == usr.r_hand))
give_action(usr, /datum/action/item_action/bipod/toggle_full_auto_switch, src, G)
if(usr && (gun == usr.l_hand || gun == usr.r_hand))
give_action(usr, /datum/action/item_action/bipod/toggle_full_auto_switch, src, gun)
given_action = TRUE
if(!given_action)
new /datum/action/item_action/bipod/toggle_full_auto_switch(src, G)
new /datum/action/item_action/bipod/toggle_full_auto_switch(src, gun)

RegisterSignal(G, COMSIG_ITEM_DROPPED, PROC_REF(handle_drop))
RegisterSignal(gun, COMSIG_ITEM_DROPPED, PROC_REF(handle_drop))

/obj/item/attachable/bipod/Detach(mob/user, obj/item/weapon/gun/detaching_gub)
UnregisterSignal(detaching_gub, COMSIG_ITEM_DROPPED)
Expand Down Expand Up @@ -3320,18 +3320,18 @@ Defined in conflicts.dm of the #defines folder.
if(!istype(item_action, /datum/action/item_action/bipod/toggle_full_auto_switch))
item_action.update_button_icon()

/obj/item/attachable/bipod/proc/handle_drop(obj/item/weapon/gun/G, mob/living/carbon/human/user)
/obj/item/attachable/bipod/proc/handle_drop(obj/item/weapon/gun/gun, mob/living/carbon/human/user)
SIGNAL_HANDLER

UnregisterSignal(user, COMSIG_MOB_MOVE_OR_LOOK)

if(bipod_deployed)
undeploy_bipod(G)
undeploy_bipod(gun)
user.apply_effect(1, SUPERSLOW)
user.apply_effect(2, SLOW)

/obj/item/attachable/bipod/proc/undeploy_bipod(obj/item/weapon/gun/G)
REMOVE_TRAIT(G, TRAIT_GUN_BIPODDED, "attached_bipod")
/obj/item/attachable/bipod/proc/undeploy_bipod(obj/item/weapon/gun/gun)
REMOVE_TRAIT(gun, TRAIT_GUN_BIPODDED, "attached_bipod")
bipod_deployed = FALSE
accuracy_mod = -HIT_ACCURACY_MULT_TIER_5
scatter_mod = SCATTER_AMOUNT_TIER_9
Expand All @@ -3340,72 +3340,72 @@ Defined in conflicts.dm of the #defines folder.
delay_mod = FIRE_DELAY_TIER_12

//if we are no longer on fullauto, don't bother switching back to the old firemode
if(full_auto_switch && G.gun_firemode == GUN_FIREMODE_AUTOMATIC)
G.do_toggle_firemode(usr, null, old_firemode)
if(full_auto_switch && gun.gun_firemode == GUN_FIREMODE_AUTOMATIC)
gun.do_toggle_firemode(usr, null, old_firemode)

G.recalculate_attachment_bonuses()
G.stop_fire()
gun.recalculate_attachment_bonuses()
gun.stop_fire()
var/mob/living/user
if(isliving(G.loc))
user = G.loc
if(isliving(gun.loc))
user = gun.loc
SEND_SIGNAL(user, COMSIG_MOB_UNDEPLOYED_BIPOD)
UnregisterSignal(user, COMSIG_MOB_MOVE_OR_LOOK)

if(G.flags_gun_features & GUN_SUPPORT_PLATFORM)
G.remove_firemode(GUN_FIREMODE_AUTOMATIC)
if(gun.flags_gun_features & GUN_SUPPORT_PLATFORM)
gun.remove_firemode(GUN_FIREMODE_AUTOMATIC)

if(heavy_bipod)
user.anchored = FALSE

if(!QDELETED(G))
if(!QDELETED(gun))
playsound(user,'sound/items/m56dauto_rotate.ogg', 55, 1)
update_icon()

/obj/item/attachable/bipod/activate_attachment(obj/item/weapon/gun/G,mob/living/user, turn_off)
/obj/item/attachable/bipod/activate_attachment(obj/item/weapon/gun/gun, mob/living/user, turn_off)
if(turn_off)
if(bipod_deployed)
undeploy_bipod(G)
undeploy_bipod(gun)
else
var/obj/support = check_bipod_support(G, user)
var/obj/support = check_bipod_support(gun, user)
if(!support&&!bipod_deployed)
to_chat(user, SPAN_NOTICE("You start deploying [src] on the ground."))
if(!do_after(user, 15, INTERRUPT_ALL, BUSY_ICON_HOSTILE, G,INTERRUPT_DIFF_LOC))
if(!do_after(user, 15, INTERRUPT_ALL, BUSY_ICON_HOSTILE, gun, INTERRUPT_DIFF_LOC))
return FALSE

bipod_deployed = !bipod_deployed
if(user)
if(bipod_deployed)
ADD_TRAIT(G, TRAIT_GUN_BIPODDED, "attached_bipod")
ADD_TRAIT(gun, TRAIT_GUN_BIPODDED, "attached_bipod")
to_chat(user, SPAN_NOTICE("You deploy [src] [support ? "on [support]" : "on the ground"]."))
SEND_SIGNAL(user, COMSIG_MOB_DEPLOYED_BIPOD)
playsound(user,'sound/items/m56dauto_rotate.ogg', 55, 1)
accuracy_mod = HIT_ACCURACY_MULT_TIER_5
scatter_mod = -SCATTER_AMOUNT_TIER_10
recoil_mod = -RECOIL_AMOUNT_TIER_4
burst_scatter_mod = -SCATTER_AMOUNT_TIER_8
if(istype(G,/obj/item/weapon/gun/rifle/sniper/M42A))
if(istype(gun, /obj/item/weapon/gun/rifle/sniper/M42A))
delay_mod = -FIRE_DELAY_TIER_7
else
delay_mod = -FIRE_DELAY_TIER_12
G.recalculate_attachment_bonuses()
G.stop_fire()
gun.recalculate_attachment_bonuses()
gun.stop_fire()

initial_mob_dir = user.dir
RegisterSignal(user, COMSIG_MOB_MOVE_OR_LOOK, PROC_REF(handle_mob_move_or_look))

if(G.flags_gun_features & GUN_SUPPORT_PLATFORM)
G.add_firemode(GUN_FIREMODE_AUTOMATIC)
if(gun.flags_gun_features & GUN_SUPPORT_PLATFORM)
gun.add_firemode(GUN_FIREMODE_AUTOMATIC)

if(heavy_bipod)
user.anchored = TRUE

if(full_auto_switch && G.gun_firemode != GUN_FIREMODE_AUTOMATIC)
old_firemode = G.gun_firemode
G.do_toggle_firemode(user, null, GUN_FIREMODE_AUTOMATIC)
if(full_auto_switch && gun.gun_firemode != GUN_FIREMODE_AUTOMATIC)
old_firemode = gun.gun_firemode
gun.do_toggle_firemode(user, null, GUN_FIREMODE_AUTOMATIC)

else
to_chat(user, SPAN_NOTICE("You retract [src]."))
undeploy_bipod(G)
undeploy_bipod(gun)

update_icon()

Expand All @@ -3422,10 +3422,10 @@ Defined in conflicts.dm of the #defines folder.


//when user fires the gun, we check if they have something to support the gun's bipod.
/obj/item/attachable/proc/check_bipod_support(obj/item/weapon/gun/G, mob/living/user)
/obj/item/attachable/proc/check_bipod_support(obj/item/weapon/gun/gun, mob/living/user)
return 0

/obj/item/attachable/bipod/check_bipod_support(obj/item/weapon/gun/G, mob/living/user)
/obj/item/attachable/bipod/check_bipod_support(obj/item/weapon/gun/gun, mob/living/user)
var/turf/T = get_turf(user)
for(var/obj/O in T)
if(O.throwpass && O.density && O.dir == user.dir && O.flags_atom & ON_BORDER)
Expand Down
Binary file modified icons/mob/hud/actions.dmi
Binary file not shown.

0 comments on commit 34a5029

Please sign in to comment.