Skip to content

Commit

Permalink
herewego
Browse files Browse the repository at this point in the history
  • Loading branch information
TobyThorne committed Aug 27, 2024
1 parent 227dcb2 commit a47afd2
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 29 deletions.
99 changes: 70 additions & 29 deletions code/modules/projectiles/guns/energy/charge.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

var/mag_insert_sound = 'sound/effects/weapons/gun/assaultrifle_magin.ogg'
var/mag_eject_sound = 'sound/effects/weapons/gun/assaultrifle_magout.ogg'
var/charge_cost = 15
var/charge_cost = 16
var/charge_multiplier = 1.0
var/modifystate = "charge_rifle"
var/barrel_overlay = ""
Expand Down Expand Up @@ -109,10 +109,10 @@
..()
ClearOverlays()
if(!power_supply)
icon_state = "[modifystate]-empty"
icon_state = "[base_icon_state]-empty"
return

icon_state = modifystate
icon_state = base_icon_state

if(round(power_supply.charge / (charge_cost * charge_multiplier)) == 0)
AddOverlays("[modifystate]-noammo")
Expand All @@ -121,15 +121,17 @@
else
AddOverlays("[modifystate]-burst")

AddOverlays("[modifystate]-[power_supply.barrel_overlay]")
var/ratio = (power_supply.charge >= (charge_cost * charge_multiplier)) ? max(round(CELL_PERCENT(power_supply), 25), 25) : 0
AddOverlays("[modifystate]-[power_supply.barrel_overlay][ratio]")
if(ratio < 100)
AddOverlays("[modifystate]-[ratio]")

/obj/item/gun/charge/proc/update_barrel_overlay(opening)
if(opening)
CutOverlays(barrel_overlay, ATOM_ICON_CACHE_PROTECTED)
CutOverlays("[modifystate]_closing", ATOM_ICON_CACHE_PROTECTED)

barrel_overlay = "[modifystate]-[power_supply.barrel_overlay]"
barrel_overlay = "[modifystate]_barrel-[power_supply.barrel_overlay]"
AddOverlays(barrel_overlay, ATOM_ICON_CACHE_PROTECTED)
AddOverlays("[modifystate]_opening", ATOM_ICON_CACHE_PROTECTED)
ImmediateOverlayUpdate()
Expand Down Expand Up @@ -228,23 +230,62 @@
update_cell()
return

/obj/item/gun/charge/advanced
name = "advanced charge carbine"
desc = "C-13S Charge Carbine, an improved modification of NanoTrasen's C-13. Compared to the basic version, this one has ergonomic grips and a high-contrast sight, while its internal autolathe uses more expensive materials."

icon_state = "adv_charge_rifle-preview"
item_state = "charge_rifle"
base_icon_state = "adv_charge_rifle"
modifystate = "charge_rifle"

one_hand_penalty = 2.5
accuracy = 3.0

/obj/item/gun/charge/pistol
name = "charge pistol"
desc = "P-7 Charge Pistol, NanoTrasen's standard issue handgun. Even though it's rather cheap and somewhat unwieldy, it can use a wide range of energy-based ammunition because of its internal miniature autolathe that effectively reassembles the gun on the run."

icon_state = "charge_pistol-preview"
item_state = "charge_pistol"
wielded_item_state = null
base_icon_state = "charge_pistol"
modifystate = "charge_pistol"
improper_held_icon = FALSE

w_class = ITEM_SIZE_NORMAL
slot_flags = SLOT_BELT|SLOT_HOLSTER

force = 8.5
mod_weight = 0.7
mod_reach = 0.5
mod_handy = 1.0

one_hand_penalty = 0
accuracy = -0.35

charge_multiplier = 1.25

/obj/item/gun/charge/pistol/switch_firemodes()
return null


/obj/item/cell/ammo/charge
name = "charge magazine"
desc = "A power cell designed to be used as a magazine for charge-based weapons. This one must not be seen at all."
icon = 'icons/obj/ammo.dmi'
item_state = "cell"
icon_state = "charge"
maxcharge = 150
maxcharge = 160
overlay_key = "charge_over"
w_class = ITEM_SIZE_SMALL

var/tier = 0
var/fire_sound
var/barrel_overlay = ""
var/firemodes = list(
list(mode_name = "semiauto", fire_delay = 1, charge_cost = 15, burst = 1, projectile_type = null),
list(mode_name = "2-round bursts", fire_delay = 1, charge_cost = 15, burst = 2, projectile_type = null)
list(mode_name = "semiauto", fire_delay = 1, charge_cost = 16, burst = 1, projectile_type = null),
list(mode_name = "2-round bursts", fire_delay = 1, charge_cost = 16, burst = 2, projectile_type = null)
)

/obj/item/cell/ammo/charge/on_update_icon()
Expand All @@ -264,8 +305,8 @@
fire_sound = 'sound/effects/weapons/energy/Taser.ogg'
barrel_overlay = "stun"
firemodes = list(
list(mode_name = "semiauto", fire_delay = 1, charge_cost = 15, burst = 1, projectile_type = /obj/item/projectile/energy/electrode/lesser),
list(mode_name = "2-round bursts", fire_delay = 1, charge_cost = 15, burst = 2, projectile_type = /obj/item/projectile/energy/electrode/lesser)
list(mode_name = "semiauto", fire_delay = 1, charge_cost = 16, burst = 1, projectile_type = /obj/item/projectile/energy/electrode/lesser),
list(mode_name = "2-round bursts", fire_delay = 1, charge_cost = 16, burst = 2, projectile_type = /obj/item/projectile/energy/electrode/lesser)
)

/obj/item/cell/ammo/charge/blaster
Expand All @@ -277,21 +318,8 @@
fire_sound = 'sound/effects/weapons/energy/fire14.ogg'
barrel_overlay = "blaster"
firemodes = list(
list(mode_name = "semiauto", fire_delay = 1, charge_cost = 15, burst = 1, projectile_type = /obj/item/projectile/energy/laser/lesser),
list(mode_name = "2-round bursts", fire_delay = 1, charge_cost = 15, burst = 2, projectile_type = /obj/item/projectile/energy/laser/lesser)
)

/obj/item/cell/ammo/charge/kinetic
name = "charge magazine (kinetic)"
desc = "A power cell designed to be used as a magazine for charge-based weapons. This one allows the weapon to synthesize \"soft\" chunks of unstable particles and accelerate them, shooting bullets with high stopping power and lowered penetration."
icon_state = "charge_kinetic"

tier = 1
fire_sound = 'sound/effects/weapons/gun/fire_generic_smg.ogg'
barrel_overlay = "kinetic"
firemodes = list(
list(mode_name = "semiauto", fire_delay = 1, charge_cost = 15, burst = 1, projectile_type = /obj/item/projectile/bullet/charge/kinetic),
list(mode_name = "2-round bursts", fire_delay = 1, charge_cost = 15, burst = 2, projectile_type = /obj/item/projectile/bullet/charge/kinetic)
list(mode_name = "semiauto", fire_delay = 1, charge_cost = 16, burst = 1, projectile_type = /obj/item/projectile/energy/laser/lesser),
list(mode_name = "2-round bursts", fire_delay = 1, charge_cost = 16, burst = 2, projectile_type = /obj/item/projectile/energy/laser/lesser)
)

/obj/item/cell/ammo/charge/accelerator
Expand All @@ -303,8 +331,21 @@
fire_sound = 'sound/effects/weapons/gun/gunshot3.ogg'
barrel_overlay = "phazer"
firemodes = list(
list(mode_name = "semiauto", fire_delay = 1, charge_cost = 15, burst = 1, projectile_type = /obj/item/projectile/bullet/charge),
list(mode_name = "2-round bursts", fire_delay = 1, charge_cost = 15, burst = 2, projectile_type = /obj/item/projectile/bullet/charge)
list(mode_name = "semiauto", fire_delay = 1, charge_cost = 16, burst = 1, projectile_type = /obj/item/projectile/bullet/charge),
list(mode_name = "2-round bursts", fire_delay = 1, charge_cost = 16, burst = 2, projectile_type = /obj/item/projectile/bullet/charge)
)

/obj/item/cell/ammo/charge/kinetic
name = "charge magazine (kinetic)"
desc = "A power cell designed to be used as a magazine for charge-based weapons. This one allows the weapon to synthesize \"soft\" chunks of unstable particles and accelerate them, shooting bullets with high stopping power and lowered penetration."
icon_state = "charge_kinetic"

tier = 1
fire_sound = 'sound/effects/weapons/gun/fire_generic_smg.ogg'
barrel_overlay = "kinetic"
firemodes = list(
list(mode_name = "semiauto", fire_delay = 1, charge_cost = 16, burst = 1, projectile_type = /obj/item/projectile/bullet/charge/kinetic),
list(mode_name = "2-round bursts", fire_delay = 1, charge_cost = 16, burst = 2, projectile_type = /obj/item/projectile/bullet/charge/kinetic)
)

/obj/item/cell/ammo/charge/accelerator_adv
Expand All @@ -316,8 +357,8 @@
fire_sound = 'sound/effects/weapons/gun/gunshot3.ogg'
barrel_overlay = "phazer"
firemodes = list(
list(mode_name = "semiauto", fire_delay = 1, charge_cost = 15, burst = 1, projectile_type = /obj/item/projectile/bullet/charge),
list(mode_name = "2-round bursts", fire_delay = 1, charge_cost = 15, burst = 2, projectile_type = /obj/item/projectile/bullet/charge)
list(mode_name = "semiauto", fire_delay = 1, charge_cost = 16, burst = 1, projectile_type = /obj/item/projectile/bullet/charge),
list(mode_name = "2-round bursts", fire_delay = 1, charge_cost = 16, burst = 2, projectile_type = /obj/item/projectile/bullet/charge)
)

#undef BARREL_TIMER
Binary file modified icons/mob/onmob/items/lefthand_guns.dmi
Binary file not shown.
Binary file modified icons/mob/onmob/items/righthand_guns.dmi
Binary file not shown.
Binary file modified icons/obj/guns/charge.dmi
Binary file not shown.

0 comments on commit a47afd2

Please sign in to comment.