Skip to content

Commit

Permalink
TGS Test Merge (#8273)
Browse files Browse the repository at this point in the history
  • Loading branch information
cm13-github committed Feb 12, 2025
2 parents 9f60786 + 61e30f0 commit 55b9e61
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 53 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/dcs/signals/atom/signals_gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#define COMSIG_GUN_AUTOFIREDELAY_MODIFIED "gun_autofiredelay_modified"
#define COMSIG_GUN_BURST_SHOTS_TO_FIRE_MODIFIED "gun_burst_shots_to_fire_modified"
#define COMSIG_GUN_BURST_SHOT_DELAY_MODIFIED "gun_burst_shot_delay_modified"
#define COMSIG_GUN_NEXT_FIRE_MODIFIED "gun_next_fire_modified"

#define COMSIG_GUN_VULTURE_FIRED_ONEHAND "gun_vulture_fired_onehand"
#define COMSIG_VULTURE_SCOPE_MOVED "vulture_scope_moved"
Expand Down
5 changes: 5 additions & 0 deletions code/datums/components/autofire/autofire.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
RegisterSignal(parent, COMSIG_GUN_FIRE, PROC_REF(initiate_shot))
RegisterSignal(parent, COMSIG_GUN_STOP_FIRE, PROC_REF(stop_firing))
RegisterSignal(parent, COMSIG_GUN_INTERRUPT_FIRE, PROC_REF(hard_reset))
RegisterSignal(parent, COMSIG_GUN_NEXT_FIRE_MODIFIED, PROC_REF(set_next_fire))

src.auto_fire_shot_delay = auto_fire_shot_delay
src.burstfire_shot_delay = burstfire_shot_delay
Expand Down Expand Up @@ -111,6 +112,10 @@
callback_bursting.Invoke(FALSE)
shooting = FALSE

///Manually sets firedelay
/datum/component/automatedfire/autofire/proc/set_next_fire(gun, new_next_fire)
SIGNAL_HANDLER
next_fire = new_next_fire

///Ask the shooter to fire and schedule the next shot if need
/datum/component/automatedfire/autofire/process_shot()
Expand Down
8 changes: 6 additions & 2 deletions code/datums/components/iff_fire_prevention.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@
if(iff_additional_fire_delay)
var/obj/item/weapon/gun/gun = firing_weapon
if(istype(gun))
LAZYSET(user.fire_delay_next_fire, gun, world.time + iff_additional_fire_delay)
gun.last_fired = world.time + iff_additional_fire_delay
SEND_SIGNAL(gun, COMSIG_GUN_STOP_FIRE) //for autofire
SEND_SIGNAL(gun, COMSIG_GUN_NEXT_FIRE_MODIFIED, gun.last_fired) //for autofire
return COMPONENT_CANCEL_GUN_BEFORE_FIRE

//At some angles (scatter or otherwise) the original target is not in checked_turfs so we put it in there in order based on distance from user
Expand Down Expand Up @@ -88,7 +90,9 @@
if(iff_additional_fire_delay)
var/obj/item/weapon/gun/gun = firing_weapon
if(istype(gun))
LAZYSET(user.fire_delay_next_fire, gun, world.time + iff_additional_fire_delay)
gun.last_fired = world.time + iff_additional_fire_delay
SEND_SIGNAL(gun, COMSIG_GUN_STOP_FIRE) //for autofire
SEND_SIGNAL(gun, COMSIG_GUN_NEXT_FIRE_MODIFIED, gun.last_fired) //for autofire
return COMPONENT_CANCEL_GUN_BEFORE_FIRE

return //if we have a target we *can* hit and find it before any IFF targets we want to fire
Expand Down
4 changes: 2 additions & 2 deletions code/datums/emergency_calls/supplies.dm
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,5 @@
new /obj/item/ammo_magazine/rifle/l42a/ap(W)
new /obj/item/attachable/stock/carbine(W)
new /obj/item/attachable/stock/carbine(W)
new /obj/item/attachable/scope/mini_iff(W)
new /obj/item/attachable/scope/mini_iff(W)
new /obj/item/attachable/alt_iff_scope(W)
new /obj/item/attachable/alt_iff_scope(W)
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
list("Suppressor", 6.5, /obj/item/attachable/suppressor, VENDOR_ITEM_REGULAR),

list("RAIL", -1, null, null),
list("B8 Smart-Scope", 3.5, /obj/item/attachable/scope/mini_iff, VENDOR_ITEM_REGULAR),
list("B8 Smart-Scope", 3.5, /obj/item/attachable/alt_iff_scope, VENDOR_ITEM_REGULAR),
list("Magnetic Harness", 8.5, /obj/item/attachable/magnetic_harness, VENDOR_ITEM_REGULAR),
list("Rail Flashlight", 10.5, /obj/item/attachable/flashlight, VENDOR_ITEM_REGULAR),
list("S4 2x Telescopic Mini-Scope", 4.5, /obj/item/attachable/scope/mini, VENDOR_ITEM_REGULAR),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
list("Suppressor", 2.5, /obj/item/attachable/suppressor, VENDOR_ITEM_REGULAR),

list("RAIL", -1, null, null),
list("B8 Smart-Scope", 1.5, /obj/item/attachable/scope/mini_iff, VENDOR_ITEM_REGULAR),
list("B8 Smart-Scope", 1.5, /obj/item/attachable/alt_iff_scope, VENDOR_ITEM_REGULAR),
list("Magnetic Harness", 4, /obj/item/attachable/magnetic_harness, VENDOR_ITEM_REGULAR),
list("S4 2x Telescopic Mini-Scope", 2, /obj/item/attachable/scope/mini, VENDOR_ITEM_REGULAR),
list("S5 Red-Dot Sight", 3, /obj/item/attachable/reddot, VENDOR_ITEM_REGULAR),
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/vending/vendor_types/requisitions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@
list("Shotgun Choke", 4.5, /obj/item/attachable/shotgun_choke, VENDOR_ITEM_REGULAR),

list("RAIL", -1, null, null),
list("B8 Smart-Scope", 3.5, /obj/item/attachable/scope/mini_iff, VENDOR_ITEM_REGULAR),
list("B8 Smart-Scope", 3.5, /obj/item/attachable/alt_iff_scope, VENDOR_ITEM_REGULAR),
list("Magnetic Harness", 8.5, /obj/item/attachable/magnetic_harness, VENDOR_ITEM_REGULAR),
list("Rail Flashlight", 10.5, /obj/item/attachable/flashlight, VENDOR_ITEM_REGULAR),
list("S4 2x Telescopic Mini-Scope", 4.5, /obj/item/attachable/scope/mini, VENDOR_ITEM_REGULAR),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@
list("Shotgun Choke", 1.5, /obj/item/attachable/shotgun_choke, VENDOR_ITEM_REGULAR),

list("RAIL", -1, null, null),
list("B8 Smart-Scope", 1.5, /obj/item/attachable/scope/mini_iff, VENDOR_ITEM_REGULAR),
list("B8 Smart-Scope", 1.5, /obj/item/attachable/alt_iff_scope, VENDOR_ITEM_REGULAR),
list("Magnetic Harness", 4, /obj/item/attachable/magnetic_harness, VENDOR_ITEM_REGULAR),
list("S4 2x Telescopic Mini-Scope", 2, /obj/item/attachable/scope/mini, VENDOR_ITEM_REGULAR),
list("S5 Red-Dot Sight", 3, /obj/item/attachable/reddot, VENDOR_ITEM_REGULAR),
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/effects/spawners/random.dm
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
prob(2);/obj/item/attachable/suppressor,\
prob(2);/obj/item/attachable/burstfire_assembly,\
prob(2);/obj/item/attachable/compensator,\
prob(1);/obj/item/attachable/scope/mini_iff,\
prob(1);/obj/item/attachable/alt_iff_scope,\
prob(1);/obj/item/attachable/heavy_barrel,\
prob(1);/obj/item/attachable/scope/mini)

Expand Down
71 changes: 31 additions & 40 deletions code/modules/projectiles/gun_attachables.dm
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,37 @@ Defined in conflicts.dm of the #defines folder.
. = TRUE
return .

/obj/item/attachable/alt_iff_scope
name = "B8 Smart-Scope"
icon = 'icons/obj/items/weapons/guns/attachments/rail.dmi'
icon_state = "iffbarrel"
attach_icon = "iffbarrel_a"
desc = "An experimental B8 Smart-Scope. Based on the technologies used in the Smart Gun by ARMAT, this sight has integrated IFF systems. It can only attach to the M4RA Battle Rifle, the M44 Combat Revolver, and the M41A MK2 Pulse Rifle."
desc_lore = "An experimental fire-control optic capable of linking into compatible IFF systems on certain weapons, designated the XAN/PVG-110 Smart Scope. Currently programmed for usage with the M4RA battle rifle the M44 combat revolver, and the M41A MK2 pulse rifle. Experimental technology developed by Armat, who have assured that all previously reported issues with false-negative IFF recognitions have been solved. Make sure to check the sight after every op, just in case."
slot = "rail"
pixel_shift_y = 15

/obj/item/attachable/alt_iff_scope/New()
..()
damage_mod = -BULLET_DAMAGE_MULT_TIER_2
damage_falloff_mod = 0.2

/obj/item/attachable/alt_iff_scope/set_bullet_traits()
LAZYADD(traits_to_give, list(
BULLET_TRAIT_ENTRY(/datum/element/bullet_trait_iff)
))

/obj/item/attachable/alt_iff_scope/Attach(obj/item/weapon/gun/attaching_gun)
. = ..()
if(!GetComponent(attaching_gun, /datum/component/iff_fire_prevention))
attaching_gun.AddComponent(/datum/component/iff_fire_prevention, 5)
SEND_SIGNAL(attaching_gun, COMSIG_GUN_ALT_IFF_TOGGLED, TRUE)

/obj/item/attachable/alt_iff_scope/Detach(mob/user, obj/item/weapon/gun/detaching_gun)
. = ..()
SEND_SIGNAL(detaching_gun, COMSIG_GUN_ALT_IFF_TOGGLED, FALSE)
detaching_gun.GetExactComponent(/datum/component/iff_fire_prevention).RemoveComponent()

/obj/item/attachable/scope
name = "S8 4x telescopic scope"
icon = 'icons/obj/items/weapons/guns/attachments/rail.dmi'
Expand Down Expand Up @@ -1220,46 +1251,6 @@ Defined in conflicts.dm of the #defines folder.
select_gamemode_skin(type)
attach_icon = icon_state

/obj/item/attachable/scope/mini_iff
name = "B8 Smart-Scope"
icon_state = "iffbarrel"
attach_icon = "iffbarrel_a"
desc = "An experimental B8 Smart-Scope. Based on the technologies used in the Smart Gun by ARMAT, this sight has integrated IFF systems. It can only attach to the M4RA Battle Rifle and M44 Combat Revolver."
desc_lore = "An experimental fire-control optic capable of linking into compatible IFF systems on certain weapons, designated the XAN/PVG-110 Smart Scope. Currently programmed for usage with the M4RA battle rifle and M44 Combat Revolver, due to their relatively lower rates of fire. Experimental technology developed by Armat, who have assured that all previously reported issues with false-negative IFF recognitions have been solved. Make sure to check the sight after every op, just in case."
slot = "rail"
zoom_offset = 6
zoom_viewsize = 7
pixel_shift_y = 15
var/dynamic_aim_slowdown = SLOWDOWN_ADS_MINISCOPE_DYNAMIC

/obj/item/attachable/scope/mini_iff/New()
..()
movement_onehanded_acc_penalty_mod = MOVEMENT_ACCURACY_PENALTY_MULT_TIER_6
accuracy_unwielded_mod = 0

accuracy_scoped_buff = HIT_ACCURACY_MULT_TIER_1
delay_scoped_nerf = 0
damage_falloff_scoped_buff = 0

/obj/item/attachable/scope/mini_iff/set_bullet_traits()
LAZYADD(traits_to_give, list(
BULLET_TRAIT_ENTRY(/datum/element/bullet_trait_iff)
))

/obj/item/attachable/scope/mini_iff/activate_attachment(obj/item/weapon/gun/G, mob/living/carbon/user, turn_off)
if(do_after(user, 4, INTERRUPT_ALL, BUSY_ICON_HOSTILE))
allows_movement = 1
. = ..()

/obj/item/attachable/scope/mini_iff/apply_scoped_buff(obj/item/weapon/gun/G, mob/living/carbon/user)
. = ..()
if(G.zoom)
G.slowdown += dynamic_aim_slowdown

/obj/item/attachable/scope/mini_iff/remove_scoped_buff(mob/living/carbon/user, obj/item/weapon/gun/G)
G.slowdown -= dynamic_aim_slowdown
..()

/obj/item/attachable/scope/slavic
icon_state = "slavicscope"
attach_icon = "slavicscope"
Expand Down
4 changes: 2 additions & 2 deletions code/modules/projectiles/guns/revolvers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@
/obj/item/attachable/scope,
/obj/item/attachable/lasersight,
/obj/item/attachable/scope/mini,
/obj/item/attachable/scope/mini_iff,
/obj/item/attachable/alt_iff_scope,
)
var/folded = FALSE // Used for the stock attachment, to check if we can shoot or not

Expand Down Expand Up @@ -406,7 +406,7 @@
/obj/item/attachable/reflex,
/obj/item/attachable/scope,
/obj/item/attachable/scope/mini,
/obj/item/attachable/scope/mini_iff,
/obj/item/attachable/alt_iff_scope,
)

/obj/item/weapon/gun/revolver/m44/custom/pkd_special/k2049/set_gun_attachment_offsets()
Expand Down
5 changes: 3 additions & 2 deletions code/modules/projectiles/guns/rifles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
/obj/item/attachable/attached_gun/flamer/advanced,
/obj/item/attachable/attached_gun/shotgun,
/obj/item/attachable/attached_gun/extinguisher,
/obj/item/attachable/alt_iff_scope,
/obj/item/attachable/scope,
/obj/item/attachable/scope/mini,
)
Expand Down Expand Up @@ -1621,7 +1622,7 @@
/obj/item/attachable/lasersight,
/obj/item/attachable/scope,
/obj/item/attachable/scope/mini,
/obj/item/attachable/scope/mini_iff,
/obj/item/attachable/alt_iff_scope,
/obj/item/attachable/flashlight/grip,
)

Expand Down Expand Up @@ -1697,7 +1698,7 @@
/obj/item/attachable/lasersight,
/obj/item/attachable/scope,
/obj/item/attachable/scope/mini,
/obj/item/attachable/scope/mini_iff,
/obj/item/attachable/alt_iff_scope,
/obj/item/attachable/flashlight/grip,
)

Expand Down

0 comments on commit 55b9e61

Please sign in to comment.