Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XM88 Spotter Variant for spotter #3733

Closed
wants to merge 11 commits into from
2 changes: 2 additions & 0 deletions code/modules/cm_marines/equipment/kit_boxes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,8 @@
pro_case_overlay = "spotter"

/obj/item/storage/box/kit/spotter/fill_preset_inventory()
new /obj/item/weapon/gun/lever_action/xm88/spotter(src)
new /obj/item/ammo_magazine/internal/lever_action/xm88/spotter/box(src)
new /obj/item/clothing/head/helmet/marine/ghillie(src)
new /obj/item/clothing/suit/storage/marine/ghillie(src)
new /obj/item/clothing/glasses/night/m42_night_goggles/spotter(src)
Expand Down
14 changes: 12 additions & 2 deletions code/modules/projectiles/ammo_datums.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1443,15 +1443,25 @@
//unused and not working. need to refactor MD code. Unobtainable.
//intended mechanic is to have xenos hit with it show up very frequently on any MDs around
/datum/ammo/bullet/lever_action/tracker
name = "tracking lever-action bullet"
name = ".458 tracker round"
Hopekz marked this conversation as resolved.
Show resolved Hide resolved
icon_state = "redbullet"
damage = 70
penetration = ARMOR_PENETRATION_TIER_3
accuracy = HIT_ACCURACY_TIER_1
handful_state = "tracking_lever_action_bullet"

/datum/ammo/bullet/lever_action/tracker/proc/tracker_remove(mob/M, icon)
REMOVE_TRAIT(M, TRAIT_SPOTTER_LAZED, TRAIT_SOURCE_EQUIPMENT(2000))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's 2000 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the CAS tracker for the bullet.

The way I see it I had 4 solutions for CAS ID for this PR:
1: Give every single bullet a CAS ID round-start which would increment the CAS ID number by +40
2: Give a incremented CAS ID every time a tracking bullet fires
3: Set the CAS ID to some really high number that I don't think can be reached in-game like 2000
4: Rework the gun systems to support having a CAS ID linked to the gun itself for my one-off item.

I chose number 3 so I set the CAS ID to 2000 because I don't think we'll ever get to 2000 laser binos and rangefinders on the map.

M.overlays -= icon


/datum/ammo/bullet/lever_action/tracker/on_hit_mob(mob/M, obj/item/projectile/P, mob/user)
//SEND_SIGNAL(user, COMSIG_BULLET_TRACKING, user, M)
var/image/I = image(icon = 'icons/effects/Targeted.dmi', icon_state = "spotter_lockon")
Hopekz marked this conversation as resolved.
Show resolved Hide resolved
I.pixel_x = -M.pixel_x + M.base_pixel_x
I.pixel_y = (M.icon_size - world.icon_size) * 0.5 - M.pixel_y + M.base_pixel_y
M.overlays += I
ADD_TRAIT(M, TRAIT_SPOTTER_LAZED, TRAIT_SOURCE_EQUIPMENT(2000))
addtimer(CALLBACK(src, PROC_REF(tracker_remove), M, I), 20 SECONDS)
M.visible_message(SPAN_DANGER("You hear a faint beep under [M]'s [M.mob_size > MOB_SIZE_HUMAN ? "chitin" : "skin"]."))

/datum/ammo/bullet/lever_action/training
Expand Down
5 changes: 5 additions & 0 deletions code/modules/projectiles/gun_attachables.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,11 @@ Defined in conflicts.dm of the #defines folder.
desc = "Oppa! How did you get this off glorious Stalin weapon? Blyat, put back on and do job tovarish. Yankee is not shoot self no?"


/obj/item/attachable/scope/mini_iff/spotter
name = "S6 Solo x4 Scope"
Hopekz marked this conversation as resolved.
Show resolved Hide resolved
desc = "This scope is meant to be unobtainium, only existing on the XM88 Spotter rifle. If you obtained this without spawning it in please let a coder know how so they can fix it."
zoom_offset = 11
zoom_viewsize = 12

// ======== Stock attachments ======== //

Expand Down
32 changes: 32 additions & 0 deletions code/modules/projectiles/guns/lever_action.dm
Original file line number Diff line number Diff line change
Expand Up @@ -541,3 +541,35 @@ their unique feature is that a direct hit will buff your damage and firerate
#undef FLOATING_PENETRATION_TIER_2
#undef FLOATING_PENETRATION_TIER_3
#undef FLOATING_PENETRATION_TIER_4


/obj/item/weapon/gun/lever_action/xm88/spotter
name = "XM88 Spotter Variant"
Hopekz marked this conversation as resolved.
Show resolved Hide resolved
desc = "ARMAT's XM88 Scout Rifle, uniquely designed with a proprietary optics mount, synergizes flawlessly with the S6 Solo Scope, ensuring zero shift during recoil. Enhanced by a dynamic electronic interlink, the scope and rifle communicate rapidly, adjusting to atmospheric conditions for perfect aim. This pairing shines particularly with the XM88's single-shot operation, which permits the scope's advanced Recoil Compensation System (RCS) to reset after each shot, optimizing accuracy. This exquisite fusion of mechanics and electronics, born of ARMAT's precise engineering, makes the XM88 and S6 Solo Scope a peerless duo in terms of precision."
desc_lore = "The distinctiveness of the S6 Solo Scope's fit to the XM88 Scout Rifle springs from the deep-rooted secrets of ARMAT's engineering. The XM88, under its metallic skin, hides an exclusive, proprietary optics mount, a feat of craftsmanship from ARMAT. This bespoke design meshes flawlessly with the Solo Scope, creating a harmonious union that is the mark of an expert rifleman. Upon first glance, you might think it's just a unique mount, but it's more than that. The optics mount is engineered with an advanced mechanical lock-in mechanism, fortified with a responsive electronic interlink. When the S6 Solo Scope is placed onto the XM88, the lock-in mechanism secures the scope firmly, ensuring zero shift during recoil. Then, the electronic interlink takes over - the microprocessors within the XM88 and the Solo Scope commence a rapid series of high-speed data transfers, fine-tuning the scope's range settings to match the current atmospheric conditions, as detected by the XM88's internal barometric and temperature sensors. This ingenious pairing of mechanical design and electronic interfacing enables the rifleman to unlock the full lethal precision the XM88 offers. And it's in this masterful interplay between steel and silicon, the convergence of mechanics and electronics, that the XM88 and the S6 Solo Scope truly become a force to be reckoned with in the right hands. The sophisticated technology underlying the Solo Scope's functionality is best matched to a single-shot rifle like the XM88, and there's a crucial reason for that. Automatic or semi-automatic rifles may seem more powerful due to their rapid-fire capabilities, but this often comes with an unavoidable trade-off: accuracy. With each successive shot, recoil accumulates, leading to a shift in the rifle's position which can throw off the aim considerably, rendering even the best scopes less effective. However, the XM88's single-shot mechanism sidesteps this issue elegantly. After each shot, the shooter manually reloads, which provides a moment for the rifle to return to its original position, minimizing the impact of recoil on aim. Further, the Solo Scope is integrated with a Recoil Compensation System (RCS). This sophisticated feature uses high-speed gyroscopes to detect the minute shifts from the rifle's recoil. The RCS then rapidly calculates and adjusts the scope's reticle, compensating for the minute change in angle. Yet, such a system requires a brief moment to reset and recalibrate after each shot, a time luxury that isn't available in rapid-fire firearms. The XM88, with its single-shot operation, offers just enough pause for the RCS to perform its recalibration, ensuring maximum accuracy for the next shot. This perfect harmony between the rifle and scope, built on the back of ARMAT's precision engineering, makes the XM88 and the S6 Solo Scope an unmatched combination in terms of accuracy and precision."
fire_delay = FIRE_DELAY_TIER_3 // Slow fire rate due to being a single shot rifle.
accuracy_mult = BASE_ACCURACY_MULT + HIT_ACCURACY_MULT_TIER_10 // High accuracy due to being a sniper rifle
recoil = RECOIL_AMOUNT_TIER_1 // Low recoil due to having a recoil control system

// internal magazine
current_mag = /obj/item/ammo_magazine/internal/lever_action/xm88/spotter

// scope
attachable_allowed = list(
/obj/item/attachable/scope/mini_iff/spotter,
)

attachable_offset = list("scope_x" = 11, "scope_y" = 21)

// Initializes the gun with the scope attached
/obj/item/weapon/gun/lever_action/xm88/spotter/handle_starting_attachment()
..()
var/obj/item/attachable/scope/mini_iff/spotter/SCOPE = new(src)
Hopekz marked this conversation as resolved.
Show resolved Hide resolved
SCOPE.flags_attach_features &= ~ATTACH_REMOVABLE
SCOPE.hidden = FALSE
SCOPE.Attach(src)
update_attachable(SCOPE.slot)

/obj/item/weapon/gun/lever_action/xm88/spotter/Initialize(mapload, spawn_empty)
. = ..()
src.color = "#FFCC00" // Yes recoloring things is the new coder sprites what about it
22 changes: 22 additions & 0 deletions code/modules/projectiles/magazines/lever_action.dm
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,28 @@ Similar to shotguns.dm but not exactly.
max_rounds = 9
chamber_closed = 0

// This is the internal magazine of the spotter XM rifle
/obj/item/ammo_magazine/internal/lever_action/xm88/spotter
name = "XM88 spotter rifle internal magazine"
Hopekz marked this conversation as resolved.
Show resolved Hide resolved
desc = "If you see this something went wrong and the world is ending!!"
icon = 'icons/obj/items/weapons/guns/ammo_by_faction/uscm.dmi'
icon_state = "458-box"
item_state = "458-box"
default_ammo = /datum/ammo/bullet/lever_action/tracker
caliber = ".458 tracker"
gun_type = /obj/item/weapon/gun/lever_action/xm88/spotter
max_rounds = 1

/obj/item/ammo_magazine/internal/lever_action/xm88/spotter/Initialize(mapload, spawn_empty)
. = ..()
src.color = "#FFCC00" // Yes recoloring things is the new coder sprites what about it
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one shouldn't be visible so why change the color?

Copy link
Contributor Author

@Hopekz Hopekz Jun 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a way to recolor the child one step below. I can change this if really needed and I don't see this making any impact.


// This si the box that comes in the spotter kit
/obj/item/ammo_magazine/internal/lever_action/xm88/spotter/box
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use internal magazines for this, these are meant for internal firearms usage (holding rounds as a revolver barrel or shotgun tube, etc) and not as usable items

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funny enough the reason that I put that in there is intentional if I remove the internal it causes the box to spawn fine but the rounds inside the box will be the SOCOM rounds not the tracer rounds.

Maybe some kind of bug with how the parents over-write ammo box contents but the way I solved this was to change the parent before we get to lever_action and "internal" works for my needs.

dreamseeker_7hcTAkPHf7

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See /obj/item/ammo_magazine/lever_action/tracker. If you inherit /obj/item/ammo_magazine/lever_action/xm88 then of course its going to contain /datum/ammo/bullet/lever_action/xm88 unless you alter default_ammo

name = "box of .458 tracker rounds"
desc = "A box filled with handfuls of .458 tracker rounds, designed for use with the XM88 spotter rifle."
max_rounds = 40

//-------------------------------------------------------

/*
Expand Down