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

Adds Holo targeting Bullets for the SG to switch to #6746

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions code/datums/ammo/bullet/special_ammo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@
penetration = ARMOR_PENETRATION_TIER_8
damage_armor_punch = 1

/datum/ammo/bullet/smartgun/holo_target
name = "holo-targeting smartgun bullet"
damage = 15
/// inflicts this many holo stacks per bullet hit
var/holo_stacks = 15
/// modifies the default cap limit of 100 by this amount
var/bonus_damage_cap_increase = 0
/// multiplies the default drain of 5 holo stacks per second by this amount
var/stack_loss_multiplier = 1

/datum/ammo/bullet/smartgun/holo_target/on_hit_mob(mob/hit_mob, obj/projectile/bullet)
. = ..()
hit_mob.AddComponent(/datum/component/bonus_damage_stack, holo_stacks, world.time, bonus_damage_cap_increase, stack_loss_multiplier)

/datum/ammo/bullet/smartgun/dirty
name = "irradiated smartgun bullet"
debilitate = list(0,0,0,3,0,0,0,1)
Expand All @@ -43,21 +57,12 @@
penetration = ARMOR_PENETRATION_TIER_7
damage_armor_punch = 3

/datum/ammo/bullet/smartgun/holo_target //Royal marines smartgun bullet has only diff between regular ammo is this one does holostacks
/datum/ammo/bullet/smartgun/holo_target/rmc //Royal marines smartgun bullet has only diff between regular ammo is this one does holostacks
name = "holo-targeting smartgun bullet"
damage = 30
/// inflicts this many holo stacks per bullet hit
var/holo_stacks = 15
/// modifies the default cap limit of 100 by this amount
var/bonus_damage_cap_increase = 0
/// multiplies the default drain of 5 holo stacks per second by this amount
var/stack_loss_multiplier = 1

/datum/ammo/bullet/smartgun/holo_target/on_hit_mob(mob/hit_mob, obj/projectile/bullet)
. = ..()
hit_mob.AddComponent(/datum/component/bonus_damage_stack, holo_stacks, world.time, bonus_damage_cap_increase, stack_loss_multiplier)

/datum/ammo/bullet/smartgun/holo_target/ap
/datum/ammo/bullet/smartgun/holo_target/rmc/ap
name = "armor-piercing smartgun bullet"
icon_state = "bullet"

Expand Down
40 changes: 26 additions & 14 deletions code/modules/projectiles/guns/smartgun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
)
var/datum/ammo/ammo_primary = /datum/ammo/bullet/smartgun //Toggled ammo type
var/datum/ammo/ammo_secondary = /datum/ammo/bullet/smartgun/armor_piercing //Toggled ammo type
var/datum/ammo/ammo_tertiary = /datum/ammo/bullet/smartgun/holo_target //Toggled ammo type
var/iff_enabled = TRUE //Begin with the safety on.
var/secondary_toggled = 0 //which ammo we use
var/ammo_selection = /datum/ammo/bullet/smartgun //which ammo we use
var/recoil_compensation = 0
var/accuracy_improvement = 0
var/auto_fire = 0
Expand Down Expand Up @@ -70,6 +71,7 @@
/obj/item/weapon/gun/smartgun/Initialize(mapload, ...)
ammo_primary = GLOB.ammo_list[ammo_primary] //Gun initialize calls replace_ammo() so we need to set these first.
ammo_secondary = GLOB.ammo_list[ammo_secondary]
ammo_tertiary = GLOB.ammo_list[ammo_tertiary]
MD = new(src)
battery = new /obj/item/smartgun_battery(src)
. = ..()
Expand All @@ -78,6 +80,7 @@
/obj/item/weapon/gun/smartgun/Destroy()
ammo_primary = null
ammo_secondary = null
ammo_tertiary = null
QDEL_NULL(MD)
QDEL_NULL(battery)
. = ..()
Expand Down Expand Up @@ -301,8 +304,10 @@

/datum/action/item_action/smartgun/toggle_ammo_type/proc/update_icon()
var/obj/item/weapon/gun/smartgun/G = holder_item
if(G.secondary_toggled)
if(ammo_secondary)

Check failure on line 307 in code/modules/projectiles/guns/smartgun.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var: "ammo_secondary"
action_icon_state = "ammo_swap_ap"
else if(ammo_tertiary)

Check failure on line 309 in code/modules/projectiles/guns/smartgun.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var: "ammo_tertiary"
action_icon_state = "ammo_swap_holo"
else
action_icon_state = "ammo_swap_normal"
button.overlays.Cut()
Expand Down Expand Up @@ -337,24 +342,31 @@
if(!iff_enabled)
to_chat(user, "[icon2html(src, usr)] Can't switch ammunition type when \the [src]'s fire restriction is disabled.")
return
secondary_toggled = !secondary_toggled
to_chat(user, "[icon2html(src, usr)] You changed \the [src]'s ammo preparation procedures. You now fire [secondary_toggled ? "armor shredding rounds" : "highly precise rounds"].")
balloon_alert(user, "firing [secondary_toggled ? "armor shredding" : "highly precise"]")
playsound(loc,'sound/machines/click.ogg', 25, 1)
ammo = secondary_toggled ? ammo_secondary : ammo_primary
var/datum/action/item_action/smartgun/toggle_ammo_type/TAT = locate(/datum/action/item_action/smartgun/toggle_ammo_type) in actions
TAT.update_icon()
if(ammo_secondary)
to_chat(user, "[icon2html(src, usr)] You changed \the [src]'s ammo preparation procedures. You now fire holo-targeting rounds.")
ammo_selection = ammo_tertiary
else if(ammo_tertiary)
to_chat(user, "[icon2html(src, usr)] You changed \the [src]'s ammo preparation procedures. You now fire highly precise rounds.")
ammo_selection = ammo_primary
else
to_chat(user, "[icon2html(src, usr)] You changed \the [src]'s ammo preparation procedures. You now fire armor shredding rounds.")
ammo_selection = ammo_secondary

/obj/item/weapon/gun/smartgun/replace_ammo()
..()
ammo = secondary_toggled ? ammo_secondary : ammo_primary
if(ammo_secondary)
ammo_selection = ammo_secondary
else if(ammo_tertiary)
ammo_selection = ammo_tertiary
else
ammo_selection = ammo_primary

/obj/item/weapon/gun/smartgun/proc/toggle_lethal_mode(mob/user)
to_chat(user, "[icon2html(src, usr)] You [iff_enabled? "<B>disable</b>" : "<B>enable</b>"] \the [src]'s fire restriction. You will [iff_enabled ? "harm anyone in your way" : "target through IFF"].")
playsound(loc,'sound/machines/click.ogg', 25, 1)
iff_enabled = !iff_enabled
ammo = ammo_primary
secondary_toggled = FALSE
ammo_selection = FALSE
if(iff_enabled)
add_bullet_trait(BULLET_TRAIT_ENTRY_ID("iff", /datum/element/bullet_trait_iff))
drain += 10
Expand Down Expand Up @@ -745,9 +757,9 @@
name = "\improper L56A2 smartgun"
desc = "The actual firearm in the 2-piece L56A2 Smartgun System. This Variant is used by the Three World Empires Royal Marines Commando units.\nYou may toggle firing restrictions by using a special action.\nAlt-click it to open the feed cover and allow for reloading."
current_mag = /obj/item/ammo_magazine/smartgun/holo_targetting
ammo = /obj/item/ammo_magazine/smartgun/holo_targetting
ammo_primary = /datum/ammo/bullet/smartgun/holo_target //Toggled ammo type
ammo_secondary = /datum/ammo/bullet/smartgun/holo_target/ap ///Toggled ammo type
ammo = /obj/item/ammo_magazine/smartgun/holo_targetting/rmc
ammo_primary = /datum/ammo/bullet/smartgun/holo_target/rmc //Toggled ammo type
ammo_secondary = /datum/ammo/bullet/smartgun/holo_target/rmc/ap ///Toggled ammo type
flags_gun_features = GUN_SPECIALIST|GUN_WIELDED_FIRING_ONLY
icon = 'icons/obj/items/weapons/guns/guns_by_faction/twe_guns.dmi'
icon_state = "magsg"
Expand Down
4 changes: 2 additions & 2 deletions code/modules/projectiles/magazines/specialist.dm
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@
default_ammo = /datum/ammo/bullet/smartgun/dirty
gun_type = /obj/item/weapon/gun/smartgun/dirty

/obj/item/ammo_magazine/smartgun/holo_targetting
/obj/item/ammo_magazine/smartgun/holo_targetting/rmc
name = "holotargetting smartgun drum"
desc = "Holotargetting rounds for use in the royal marines commando L56A2 smartgun."
icon_state = "m56_drum"
default_ammo = /datum/ammo/bullet/smartgun/holo_target
default_ammo = /datum/ammo/bullet/smartgun/holo_target/rmc
gun_type = /obj/item/weapon/gun/smartgun/rmc
//-------------------------------------------------------
//Flare gun. Close enough?
Expand Down
Binary file modified icons/mob/hud/actions.dmi
Binary file not shown.
Loading