Skip to content

Commit

Permalink
SMARTGUN changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirshbia committed Apr 1, 2024
1 parent 8628bff commit 837e3f7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
9 changes: 5 additions & 4 deletions code/datums/ammo/bullet/special_ammo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@

max_range = 12
accuracy = HIT_ACCURACY_TIER_4
damage = 36
damage = 35
penetration = 0


/datum/ammo/bullet/smartgun/armor_piercing
name = "armor-piercing smartgun bullet"
icon_state = "bullet"

accurate_range = 12
accuracy = HIT_ACCURACY_TIER_2
damage = 24
damage = 30
penetration = ARMOR_PENETRATION_TIER_8
damage_armor_punch = 1

Expand All @@ -39,13 +40,13 @@

accurate_range = 22
accuracy = HIT_ACCURACY_TIER_3
damage = 30
damage = 35
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
name = "holo-targeting smartgun bullet"
damage = 30
damage = 32
///Stuff for the HRP holotargetting stacks
var/holo_stacks = 15

Expand Down
28 changes: 19 additions & 9 deletions code/modules/projectiles/guns/smartgun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@
reload_sound = 'sound/weapons/handling/gun_sg_reload.ogg'
unload_sound = 'sound/weapons/handling/gun_sg_unload.ogg'
current_mag = /obj/item/ammo_magazine/smartgun

accepted_ammo = list(
/obj/item/ammo_magazine/smartgun,
/obj/item/ammo_magazine/smartgun/holo_targetting,
/obj/item/ammo_magazine/smartgun/dirty,
)
flags_equip_slot = NO_FLAGS
w_class = SIZE_HUGE
force = 20
Expand All @@ -34,11 +28,14 @@
ammo = /datum/ammo/bullet/smartgun
actions_types = list(
/datum/action/item_action/smartgun/toggle_accuracy_improvement,
///datum/action/item_action/smartgun/toggle_auto_fire,
/datum/action/item_action/smartgun/toggle_ammo_type,
///datum/action/item_action/smartgun/toggle_auto_fire,
/datum/action/item_action/smartgun/toggle_lethal_mode,
///datum/action/item_action/smartgun/toggle_motion_detector,
///datum/action/item_action/smartgun/toggle_recoil_compensation,
/datum/action/item_action/smartgun/toggle_recoil_compensation,
)
var/datum/ammo/ammo_primary = /datum/ammo/bullet/smartgun/holo_target //Toggled ammo type
var/datum/ammo/ammo_secondary = /datum/ammo/bullet/smartgun/armor_piercing //Toggled ammo type
var/iff_enabled = TRUE //Begin with the safety on.
var/secondary_toggled = 0 //which ammo we use
var/recoil_compensation = 0
Expand Down Expand Up @@ -71,12 +68,16 @@


/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]
MD = new(src)
battery = new /obj/item/smartgun_battery(src)
. = ..()
update_icon()

/obj/item/weapon/gun/smartgun/Destroy()
ammo_primary = null
ammo_secondary = null
QDEL_NULL(MD)
QDEL_NULL(battery)
. = ..()
Expand Down Expand Up @@ -339,15 +340,20 @@
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()

/obj/item/weapon/gun/smartgun/replace_ammo()
..()
ammo = secondary_toggled ? ammo_secondary : 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
if(iff_enabled)
add_bullet_trait(BULLET_TRAIT_ENTRY_ID("iff", /datum/element/bullet_trait_iff))
drain += 10
Expand Down Expand Up @@ -664,6 +670,8 @@
desc = "The actual firearm in the 4-piece M56D Smartgun System. If you have this, you're about to bring some serious pain to anyone in your way.\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/dirty
ammo = /obj/item/ammo_magazine/smartgun/dirty
ammo_primary = /datum/ammo/bullet/smartgun/dirty//Toggled ammo type
ammo_secondary = /datum/ammo/bullet/smartgun/dirty/armor_piercing///Toggled ammo type
flags_gun_features = GUN_WY_RESTRICTED|GUN_SPECIALIST|GUN_WIELDED_FIRING_ONLY

/obj/item/weapon/gun/smartgun/dirty/Initialize(mapload, ...)
Expand Down Expand Up @@ -737,6 +745,8 @@
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
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

0 comments on commit 837e3f7

Please sign in to comment.