Skip to content

Commit

Permalink
TGS Test Merge (#6072)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blue authored and Blue committed Oct 14, 2023
2 parents 57e7480 + a02b6e8 commit 895960a
Show file tree
Hide file tree
Showing 12 changed files with 90 additions and 146 deletions.
4 changes: 3 additions & 1 deletion code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@
var/fire_sound_text = "gunshot"
var/fire_anim = null
var/recoil = 0 //screen shake
var/silenced = 0
var/suppressible = FALSE
var/silenced = FALSE
var/silenced_icon = null
var/muzzle_flash = 3
var/accuracy = 65 //Accuracy is measured in percents. +15 accuracy means that everything is effectively one tile closer for the purpose of miss chance, -15 means the opposite. launchers are not supported, at the moment.
var/scoped_accuracy = null
Expand Down
37 changes: 37 additions & 0 deletions code/modules/projectiles/guns/ballistic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@
allowed_magazines += /obj/item/ammo_magazine/smart
update_icon()

/obj/item/gun/ballistic/update_icon_state()
. = ..()
if(magazine_type && ammo_magazine)
if(silenced)
icon_state = "[silenced_icon]"
else
icon_state = "[initial(icon_state)]"
else if(magazine_type && !ammo_magazine)
if(silenced)
icon_state = "[silenced_icon]-e"
else
icon_state = "[initial(icon_state)]-e"

/obj/item/gun/ballistic/consume_next_projectile()
//get the next casing
if(loaded.len)
Expand Down Expand Up @@ -236,6 +249,30 @@
..()
load_ammo(A, user)

if(suppressible)
if(istype(A, /obj/item/silencer))
if(!user.is_holding(src)) //if we're not in his hands
to_chat(user, "<span class='notice'>You'll need [src] in your hands to do that.</span>")
return CLICKCHAIN_DO_NOT_PROPAGATE
if(!user.attempt_insert_item_for_installation(A, src))
return CLICKCHAIN_DO_NOT_PROPAGATE
to_chat(user, "<span class='notice'>You screw [A] onto [src].</span>")
silenced = TRUE
w_class = ITEMSIZE_NORMAL
update_icon()
return CLICKCHAIN_DO_NOT_PROPAGATE
else if(istype(A, /obj/item/tool/wrench))
var/obj/item/silencer/S = new (get_turf(user))
if(silenced)
to_chat(user, "<span class='notice'>You unscrew [S]] from [src].</span>")
user.put_in_hands(S)
silenced = FALSE
w_class = ITEMSIZE_SMALL
update_icon()
return
else
return

/obj/item/gun/ballistic/attack_self(mob/user)
if(firemodes.len > 1)
switch_firemodes(user)
Expand Down
58 changes: 29 additions & 29 deletions code/modules/projectiles/guns/projectile/automatic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/obj/item/gun/ballistic/automatic/advanced_smg
name = "advanced SMG"
desc = "The NT-S3W is an advanced submachine gun design, using a reflective laser optic for increased accuracy over competing models. Chambered for 9mm rounds."
icon_state = "advanced_smg-empty"
icon_state = "advanced_smg-e"
w_class = ITEMSIZE_NORMAL
load_method = MAGAZINE
caliber = "9mm"
Expand All @@ -33,7 +33,7 @@

/obj/item/gun/ballistic/automatic/advanced_smg/update_icon_state()
. = ..()
icon_state = (ammo_magazine)? "advanced_smg" : "advanced_smg-empty"
icon_state = (ammo_magazine)? "advanced_smg" : "advanced_smg-e"

/obj/item/gun/ballistic/automatic/advanced_smg/loaded
magazine_type = /obj/item/ammo_magazine/m9mmAdvanced
Expand Down Expand Up @@ -96,7 +96,7 @@
if(istype(ammo_magazine,/obj/item/ammo_magazine/m556/small))
icon_state = "arifle-small" // If using the small magazines, use the small magazine sprite.
else
icon_state = (ammo_magazine)? "arifle" : "arifle-empty"
icon_state = (ammo_magazine)? "arifle" : "arifle-e"

/obj/item/gun/ballistic/automatic/sts35/update_icon(ignore_inhands)
. = ..()
Expand Down Expand Up @@ -275,8 +275,8 @@
icon_state = "l6[cover_open ? "open" : "closed"]mag"
item_state = icon_state
else
icon_state = "l6[cover_open ? "open" : "closed"][ammo_magazine ? round(ammo_magazine.stored_ammo.len, 10) : "-empty"]"
item_state = "l6[cover_open ? "open" : "closed"][ammo_magazine ? "" : "-empty"]"
icon_state = "l6[cover_open ? "open" : "closed"][ammo_magazine ? round(ammo_magazine.stored_ammo.len, 10) : "-e"]"
item_state = "l6[cover_open ? "open" : "closed"][ammo_magazine ? "" : "-e"]"

/obj/item/gun/ballistic/automatic/lmg/load_ammo(var/obj/item/A, mob/user)
if(!cover_open)
Expand Down Expand Up @@ -305,8 +305,8 @@

/obj/item/gun/ballistic/automatic/lmg/mg42/update_icon_state()
. = ..()
icon_state = "mg42[cover_open ? "open" : "closed"][ammo_magazine ? round(ammo_magazine.stored_ammo.len, 25) : "-empty"]"
item_state = "mg42[cover_open ? "open" : "closed"][ammo_magazine ? "" : "-empty"]"
icon_state = "mg42[cover_open ? "open" : "closed"][ammo_magazine ? round(ammo_magazine.stored_ammo.len, 25) : "-e"]"
item_state = "mg42[cover_open ? "open" : "closed"][ammo_magazine ? "" : "-e"]"

/obj/item/gun/ballistic/automatic/lmg/m60
name = "M60"
Expand All @@ -327,15 +327,15 @@

/obj/item/gun/ballistic/automatic/lmg/m60/update_icon_state()
. = ..()
icon_state = "M60[cover_open ? "open" : "closed"][ammo_magazine ? round(ammo_magazine.stored_ammo.len, 15) : "-empty"]"
item_state = "M60[cover_open ? "open" : "closed"][ammo_magazine ? "" : "-empty"]"
icon_state = "M60[cover_open ? "open" : "closed"][ammo_magazine ? round(ammo_magazine.stored_ammo.len, 15) : "-e"]"
item_state = "M60[cover_open ? "open" : "closed"][ammo_magazine ? "" : "-e"]"

//Future AA-12
/obj/item/gun/ballistic/automatic/as24
name = "automatic shotgun"
desc = "The AS-24 is a rugged looking automatic shotgun produced for the military by Gurov Projectile Weapons LLC. For very obvious reasons, it's illegal to own in many juristictions. Uses 12g rounds."
icon_state = "ashot"
item_state = null
item_state = "ashot"
w_class = ITEMSIZE_LARGE
damage_force = 10
caliber = "12g"
Expand All @@ -361,7 +361,7 @@
if(ammo_magazine)
icon_state = "ashot"
else
icon_state = "ashot-empty"
icon_state = "ashot-e"
return

/obj/item/gun/ballistic/automatic/mini_uzi
Expand All @@ -385,7 +385,7 @@
if(ammo_magazine)
icon_state = "mini-uzi"
else
icon_state = "mini-uzi-empty"
icon_state = "mini-uzi-e"

/obj/item/gun/ballistic/automatic/mini_uzi/custom
name = "\improper custom Uzi"
Expand All @@ -398,7 +398,7 @@
if(ammo_magazine)
icon_state = "mini-uzi-custom"
else
icon_state = "mini-uzi-custom-empty"
icon_state = "mini-uzi-custom-e"

/obj/item/gun/ballistic/automatic/mini_uzi/taj
name = "\improper Adhomai Uzi"
Expand All @@ -412,8 +412,8 @@
icon_state = "mini-uzi-taj"
item_state = "mini-uzi-taj"
else
icon_state = "mini-uzi-taj-empty"
item_state = "mini-uzi-taj-empty"
icon_state = "mini-uzi-taj-e"
item_state = "mini-uzi-taj-e"

/obj/item/gun/ballistic/automatic/p90
name = "personal defense weapon"
Expand All @@ -436,7 +436,7 @@

/obj/item/gun/ballistic/automatic/p90/update_icon_state()
. = ..()
icon_state = "p90smg-[ammo_magazine ? round(ammo_magazine.stored_ammo.len, 6) : "empty"]"
icon_state = "p90smg-[ammo_magazine ? round(ammo_magazine.stored_ammo.len, 6) : "e"]"

/obj/item/gun/ballistic/automatic/p90/custom
name = "custom personal defense weapon"
Expand All @@ -448,7 +448,7 @@

/obj/item/gun/ballistic/automatic/p90/custom/update_icon_state()
. = ..()
icon_state = "p90smgC-[ammo_magazine ? round(ammo_magazine.stored_ammo.len, 6) : "empty"]"
icon_state = "p90smgC-[ammo_magazine ? round(ammo_magazine.stored_ammo.len, 6) : "e"]"

/obj/item/gun/ballistic/automatic/tommygun
name = "\improper Tommy Gun"
Expand All @@ -469,7 +469,7 @@

/obj/item/gun/ballistic/automatic/tommygun/update_icon_state()
. = ..()
icon_state = (ammo_magazine)? "tommygun" : "tommygun-empty"
icon_state = (ammo_magazine)? "tommygun" : "tommygun-e"
// update_held_icon()

/obj/item/gun/ballistic/automatic/bullpup // Admin abuse assault rifle. ToDo: Make this less shit. Maybe remove its autofire, and make it spawn with only 10 rounds at start.
Expand Down Expand Up @@ -501,7 +501,7 @@
else if(istype(ammo_magazine,/obj/item/ammo_magazine/m762m))
icon_state = "bullpup"
else
item_state = "bullpup-empty"
item_state = "bullpup-e"

/obj/item/gun/ballistic/automatic/bullpup/update_icon()
. = ..()
Expand Down Expand Up @@ -533,7 +533,7 @@
if(ammo_magazine)
icon_state = initial(icon_state)
else
icon_state = "[initial(icon_state)]-empty"
icon_state = "[initial(icon_state)]-e"

/obj/item/gun/ballistic/automatic/automat
name = "Avtomat Rifle"
Expand Down Expand Up @@ -572,7 +572,7 @@
name = "Holy automatic shotgun"
desc = "Based off of an ancient design, this hand crafted weapon has been gilded with the gold of melted icons and inscribed with sacred runes and hexagrammic wards. Works best with blessed 12g rounds."
icon_state = "holyshotgun"
item_state = null
item_state = "holy_shot"
w_class = ITEMSIZE_LARGE
heavy = TRUE
damage_force = 10
Expand All @@ -596,7 +596,7 @@
if(ammo_magazine)
icon_state = "holyshotgun"
else
icon_state = "holyshotgun_empty"
icon_state = "holyshotgun-e"

//Clown Rifle
/obj/item/gun/ballistic/automatic/clown_rifle
Expand Down Expand Up @@ -629,7 +629,7 @@
if(ammo_magazine)
icon_state = "[initial(icon_state)]"
else
icon_state = "[initial(icon_state)]-empty"
icon_state = "[initial(icon_state)]-e"

//Muh Alternator
/obj/item/gun/ballistic/automatic/wt274
Expand All @@ -654,7 +654,7 @@
if(ammo_magazine)
icon_state = "[initial(icon_state)]"
else
icon_state = "[initial(icon_state)]-empty"
icon_state = "[initial(icon_state)]-e"

//NT SpecOps SMG
/obj/item/gun/ballistic/automatic/combat
Expand All @@ -679,7 +679,7 @@

/obj/item/gun/ballistic/automatic/combat/update_icon_state()
. = ..()
icon_state = (ammo_magazine)? "combatsmg" : "combatsmg-empty"
icon_state = (ammo_magazine)? "combatsmg" : "combatsmg-e"

//Foam Weapons
/obj/item/gun/ballistic/automatic/advanced_smg/foam
Expand All @@ -694,7 +694,7 @@

/obj/item/gun/ballistic/automatic/advanced_smg/foam/update_icon_state()
. = ..()
icon_state = (ammo_magazine)? "toy_smg" : "toy_smg-empty"
icon_state = (ammo_magazine)? "toy_smg" : "toy_smg-e"

/obj/item/gun/ballistic/automatic/advanced_smg/foam/handle_suicide(mob/living/user)
user.show_message("<span class = 'warning'>You feel rather silly, trying to commit suicide with a toy.</span>")
Expand All @@ -705,7 +705,7 @@

/obj/item/gun/ballistic/automatic/advanced_smg/foam/blue/update_icon_state()
. = ..()
icon_state = (ammo_magazine)? "toy_smg_blue" : "toy_smg_blue-empty"
icon_state = (ammo_magazine)? "toy_smg_blue" : "toy_smg_blue-e"

//Foam c20r
/obj/item/gun/ballistic/automatic/c20r/foam
Expand Down Expand Up @@ -750,8 +750,8 @@

/obj/item/gun/ballistic/automatic/lmg/foam/update_icon_state()
. = ..()
icon_state = "toy_lmg[cover_open ? "open" : "closed"][ammo_magazine ? round(ammo_magazine.stored_ammo.len, 10) : "-empty"]"
item_state = "toy_lmg[cover_open ? "open" : "closed"][ammo_magazine ? "" : "-empty"]"
icon_state = "toy_lmg[cover_open ? "open" : "closed"][ammo_magazine ? round(ammo_magazine.stored_ammo.len, 10) : "-e"]"
item_state = "toy_lmg[cover_open ? "open" : "closed"][ammo_magazine ? "" : "-e"]"

/obj/item/gun/ballistic/automatic/lmg/foam/update_icon()
. = ..()
Expand Down
Loading

0 comments on commit 895960a

Please sign in to comment.