Skip to content

Commit

Permalink
energy weapons this time
Browse files Browse the repository at this point in the history
  • Loading branch information
FalloutFalcon committed Sep 25, 2024
1 parent f3c9cd2 commit 9254f49
Show file tree
Hide file tree
Showing 15 changed files with 109 additions and 59 deletions.
4 changes: 0 additions & 4 deletions code/__DEFINES/guns.dm
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,6 @@
///ammo box will have a different state for full and empty; <icon_state>-max_ammo and <icon_state>-0
#define AMMO_BOX_FULL_EMPTY 2

#define MAG_SIZE_SMALL 1
#define MAG_SIZE_MEDIUM 2
#define MAG_SIZE_LARGE 3

//Projectile Reflect
#define REFLECT_NORMAL (1<<0)
#define REFLECT_FAKEPROJECTILE (1<<1)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mining/lavaland/necropolis_chests.dm
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@
slot_flags = ITEM_SLOT_BELT
fire_delay = 0.1 SECONDS
recoil = 1
cell_type = /obj/item/stock_parts/cell/gun
default_ammo_type = /obj/item/stock_parts/cell/gun
ammo_type = list(/obj/item/ammo_casing/energy/spur)
supports_variations = VOX_VARIATION
var/chargesound
Expand Down
3 changes: 0 additions & 3 deletions code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,13 @@
//ENERGY
//What type of power cell this uses
var/obj/item/stock_parts/cell/gun/cell
var/cell_type = /obj/item/stock_parts/cell/gun
//Can it be charged in a recharger?
var/can_charge = TRUE
var/selfcharge = FALSE
var/charge_tick = 0
var/charge_delay = 4
//whether the gun's cell drains the cyborg user's cell to recharge
var/use_cyborg_cell = FALSE
///Used for large and small cells
var/mag_size = MAG_SIZE_MEDIUM
//Time it takes to unscrew the cell
var/unscrewing_time = 2 SECONDS

Expand Down
15 changes: 12 additions & 3 deletions code/modules/projectiles/guns/ballistic/gauss.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@
item_state = "model-h"
fire_sound = 'sound/weapons/gun/gauss/modelh.ogg'
load_sound = 'sound/weapons/gun/gauss/pistol_reload.ogg'
cell_type = /obj/item/stock_parts/cell/gun/solgov
default_ammo_type = /obj/item/stock_parts/cell/gun/solgov
allowed_ammo_types = list(
/obj/item/stock_parts/cell/gun/solgov,
)
slot_flags = ITEM_SLOT_BELT
w_class = WEIGHT_CLASS_SMALL
fire_delay = 0.6 SECONDS //pistol, but heavy caliber.
Expand Down Expand Up @@ -88,7 +91,10 @@
item_state = "claris"
fire_sound = 'sound/weapons/gun/gauss/claris.ogg'
load_sound = 'sound/weapons/gun/gauss/sniper_reload.ogg'
cell_type = /obj/item/stock_parts/cell/gun/solgov
default_ammo_type = /obj/item/stock_parts/cell/gun/solgov
allowed_ammo_types = list(
/obj/item/stock_parts/cell/gun/solgov,
)
fire_delay = 0.4 SECONDS
bolt_type = BOLT_TYPE_NO_BOLT
internal_magazine = TRUE
Expand Down Expand Up @@ -117,7 +123,10 @@
item_state = "gar"
fire_sound = 'sound/weapons/gun/gauss/gar.ogg'
load_sound = 'sound/weapons/gun/gauss/rifle_reload.ogg'
cell_type = /obj/item/stock_parts/cell/gun/solgov
default_ammo_type = /obj/item/stock_parts/cell/gun/solgov
allowed_ammo_types = list(
/obj/item/stock_parts/cell/gun/solgov,
)
burst_size = 1

fire_delay = 0.2 SECONDS
Expand Down
20 changes: 11 additions & 9 deletions code/modules/projectiles/guns/energy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@

fire_select_icon_state_prefix = "laser_"

default_ammo_type = /obj/item/stock_parts/cell/gun
allowed_ammo_types = list(
/obj/item/stock_parts/cell/gun,
/obj/item/stock_parts/cell/gun/upgraded,
/obj/item/stock_parts/cell/cell/gun/empty,
/obj/item/stock_parts/cell/gun/upgraded/empty,
)

tac_reloads = FALSE
tactical_reload_delay = 1.2 SECONDS

Expand Down Expand Up @@ -51,8 +59,8 @@

/obj/item/gun/energy/Initialize()
. = ..()
if(cell_type)
cell = new cell_type(src)
if(default_ammo_type)
cell = new default_ammo_type(src)
else
cell = new(src)
if(dead_cell)
Expand Down Expand Up @@ -114,7 +122,7 @@
update_appearance()

/obj/item/gun/energy/attackby(obj/item/A, mob/user, params)
if (!internal_cell && istype(A, /obj/item/stock_parts/cell/gun))
if (!internal_cell && A.type in allowed_ammo_types)
var/obj/item/stock_parts/cell/gun/C = A
if (!cell)
insert_cell(user, C)
Expand All @@ -125,12 +133,6 @@
return ..()

/obj/item/gun/energy/proc/insert_cell(mob/user, obj/item/stock_parts/cell/gun/C)
if(mag_size == MAG_SIZE_SMALL && !istype(C, /obj/item/stock_parts/cell/gun/mini))
to_chat(user, span_warning("\The [C] doesn't seem to fit into \the [src]..."))
return FALSE
if(mag_size == MAG_SIZE_LARGE && !istype(C, /obj/item/stock_parts/cell/gun/large))
to_chat(user, span_warning("\The [C] doesn't seem to fit into \the [src]..."))
return FALSE
if(user.transferItemToLoc(C, src))
cell = C
to_chat(user, span_notice("You load the [C] into \the [src]."))
Expand Down
16 changes: 10 additions & 6 deletions code/modules/projectiles/guns/energy/energy_gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
icon_state = "mini"
item_state = "gun"
w_class = WEIGHT_CLASS_SMALL
cell_type = /obj/item/stock_parts/cell/gun/mini
mag_size = MAG_SIZE_SMALL
default_ammo_type = /obj/item/stock_parts/cell/gun/mini
allowed_ammo_types = list(
/obj/item/stock_parts/cell/gun/mini,
)
throwforce = 11 //This is funny, trust me.
ammo_x_offset = 2
charge_sections = 3
Expand All @@ -43,7 +45,7 @@
ammo_x_offset = 2
charge_sections = 5
ammo_type = list(/obj/item/ammo_casing/energy/laser/assault, /obj/item/ammo_casing/energy/disabler)
cell_type = /obj/item/stock_parts/cell/gun/upgraded
default_ammo_type = /obj/item/stock_parts/cell/gun/upgraded

weapon_weight = WEAPON_MEDIUM
w_class = WEIGHT_CLASS_BULKY
Expand All @@ -69,7 +71,7 @@
/obj/item/gun/energy/e_gun/hos
name = "\improper X-01 MultiPhase Energy Gun"
desc = "This is an expensive, modern recreation of an antique laser gun. This gun has several unique firemodes, but lacks the ability to recharge over time."
cell_type = /obj/item/stock_parts/cell/gun/upgraded
default_ammo_type = /obj/item/stock_parts/cell/gun/upgraded
icon_state = "hoslaser"
force = 10
ammo_type = list(/obj/item/ammo_casing/energy/disabler/hos, /obj/item/ammo_casing/energy/laser/hos, /obj/item/ammo_casing/energy/ion/hos, /obj/item/ammo_casing/energy/electrode/hos)
Expand Down Expand Up @@ -184,7 +186,6 @@
item_state = "gun"
ammo_x_offset = 2
charge_sections = 6
mag_size = MAG_SIZE_SMALL

wield_delay = 0.2 SECONDS
wield_slowdown = 0.15
Expand All @@ -193,7 +194,10 @@
spread_unwielded = 5

ammo_type = list(/obj/item/ammo_casing/energy/disabler/hitscan, /obj/item/ammo_casing/energy/ion/cheap)
cell_type = /obj/item/stock_parts/cell/gun/mini
default_ammo_type = /obj/item/stock_parts/cell/gun/mini
allowed_ammo_types = list(
/obj/item/stock_parts/cell/gun/mini,
)

/obj/item/gun/energy/e_gun/adv_stopping
name = "advanced stopping revolver"
Expand Down
5 changes: 4 additions & 1 deletion code/modules/projectiles/guns/energy/kinetic_accelerator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
icon_state = "kineticgun"
item_state = "kineticgun"
ammo_type = list(/obj/item/ammo_casing/energy/kinetic)
cell_type = /obj/item/stock_parts/cell/emproof
default_ammo_type = /obj/item/stock_parts/cell/emproof
allowed_ammo_types = list(
/obj/item/stock_parts/cell/emproof,
)
item_flags = NONE
obj_flags = UNIQUE_RENAME
weapon_weight = WEAPON_LIGHT
Expand Down
18 changes: 12 additions & 6 deletions code/modules/projectiles/guns/energy/laser.dm
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@
icon_state = "lasercannon"
item_state = "laser"
w_class = WEIGHT_CLASS_BULKY
mag_size = MAG_SIZE_LARGE
cell_type = "/obj/item/stock_parts/cell/gun/large"
default_ammo_type = /obj/item/stock_parts/cell/gun/large
allowed_ammo_types = list(
/obj/item/stock_parts/cell/gun/large,
)
force = 10
flags_1 = CONDUCT_1
slot_flags = ITEM_SLOT_BACK
Expand Down Expand Up @@ -203,9 +205,11 @@
item_state = "gun"
ammo_x_offset = 2
charge_sections = 4
mag_size = MAG_SIZE_SMALL
w_class = WEIGHT_CLASS_NORMAL
cell_type = /obj/item/stock_parts/cell/gun/mini
default_ammo_type = /obj/item/stock_parts/cell/gun/mini
allowed_ammo_types = list(
/obj/item/stock_parts/cell/gun/mini,
)
ammo_type = list(/obj/item/ammo_casing/energy/lasergun/hitscan)
manufacturer = MANUFACTURER_SHARPLITE_NEW

Expand Down Expand Up @@ -245,8 +249,10 @@
icon_state = "e50"
item_state = "e50"

mag_size = MAG_SIZE_LARGE
cell_type = /obj/item/stock_parts/cell/gun/large
default_ammo_type = /obj/item/stock_parts/cell/gun/large
allowed_ammo_types = list(
/obj/item/stock_parts/cell/gun/large,
)
ammo_type = list(/obj/item/ammo_casing/energy/laser/eoehoma/e50)
weapon_weight = WEAPON_HEAVY
manufacturer = MANUFACTURER_EOEHOMA
Expand Down
5 changes: 4 additions & 1 deletion code/modules/projectiles/guns/energy/laser_gatling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@
custom_materials = null
weapon_weight = WEAPON_MEDIUM
ammo_type = list(/obj/item/ammo_casing/energy/laser/minigun)
cell_type = /obj/item/stock_parts/cell/crap
default_ammo_type = /obj/item/stock_parts/cell/crap
allowed_ammo_types = list(
/obj/item/stock_parts/cell/crap,
)
item_flags = NEEDS_PERMIT | SLOWS_WHILE_IN_HAND
can_charge = FALSE
var/obj/item/minigunpack/ammo_pack
Expand Down
21 changes: 16 additions & 5 deletions code/modules/projectiles/guns/energy/pulse.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
slot_flags = ITEM_SLOT_BACK
ammo_type = list(/obj/item/ammo_casing/energy/laser/pulse, /obj/item/ammo_casing/energy/laser)
internal_cell = TRUE //prevents you from giving it an OP cell - WS Edit
cell_type = /obj/item/stock_parts/cell/pulse //somone make this backpack mounted, or connected to the deathsquad suit at some point
default_ammo_type = /obj/item/stock_parts/cell/pulse
allowed_ammo_types = list(
/obj/item/stock_parts/cell/pulse,
) //somone make this backpack mounted, or connected to the deathsquad suit at some point
manufacturer = MANUFACTURER_SHARPLITE_NEW
ammo_x_offset = 2
charge_sections = 6
Expand All @@ -39,8 +42,10 @@
icon_state = "pulse_carbine"
item_state = null
internal_cell = FALSE
mag_size = MAG_SIZE_LARGE //haha gun go brr
cell_type = /obj/item/stock_parts/cell/gun/large
default_ammo_type = /obj/item/stock_parts/cell/gun/large
allowed_ammo_types = list(
/obj/item/stock_parts/cell/gun/large,
)
ammo_x_offset = 2
charge_sections = 4

Expand Down Expand Up @@ -69,14 +74,20 @@
slot_flags = ITEM_SLOT_BELT
icon_state = "pulse_pistol"
item_state = "gun"
cell_type = /obj/item/stock_parts/cell/pulse/pistol
default_ammo_type = /obj/item/stock_parts/cell/pulse/pistol
allowed_ammo_types = list(
/obj/item/stock_parts/cell/pulse/pistol,
)
ammo_x_offset = 2
charge_sections = 4

/obj/item/gun/energy/pulse/destroyer
name = "pulse destroyer"
desc = "A heavy-duty energy rifle built for pure destruction."
cell_type = /obj/item/stock_parts/cell/infinite
default_ammo_type = /obj/item/stock_parts/cell/infinite
allowed_ammo_types = list(
/obj/item/stock_parts/cell/infinite,
)
ammo_type = list(/obj/item/ammo_casing/energy/laser/pulse)

/obj/item/gun/energy/pulse/destroyer/attack_self(mob/living/user)
Expand Down
13 changes: 9 additions & 4 deletions code/modules/projectiles/guns/energy/special.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
ammo_x_offset = 2
ammo_y_offset = 2
w_class = WEIGHT_CLASS_HUGE
mag_size = MAG_SIZE_LARGE //yes, you can put the comically large cell in it. No, you aren't getting it roundstart. You slut.
flags_1 = CONDUCT_1
slot_flags = ITEM_SLOT_BACK
ammo_type = list(/obj/item/ammo_casing/energy/ion)
Expand Down Expand Up @@ -59,7 +58,10 @@
item_state = "c20r"
w_class = WEIGHT_CLASS_BULKY
ammo_type = list(/obj/item/ammo_casing/energy/meteor)
cell_type = /obj/item/stock_parts/cell/potato
default_ammo_type = /obj/item/stock_parts/cell/potato
allowed_ammo_types = list(
/obj/item/stock_parts/cell/potato,
)
selfcharge = 1

/obj/item/gun/energy/meteorgun/pen
Expand Down Expand Up @@ -282,7 +284,10 @@
desc = "A modified energy weapon re-designed to fire 3D-printed flechettes, pulled directly from the cyborg's internal power source."
icon_state = "l6_cyborg"
icon = 'icons/obj/guns/projectile.dmi'
cell_type = /obj/item/stock_parts/cell/secborg
default_ammo_type = /obj/item/stock_parts/cell/secborg
allowed_ammo_types = list(
/obj/item/stock_parts/cell/secborg,
)
ammo_type = list(/obj/item/ammo_casing/energy/c3dbullet)
can_charge = FALSE
use_cyborg_cell = TRUE
Expand Down Expand Up @@ -340,7 +345,7 @@
icon_state = "freezegun"
desc = "A gun that changes temperatures."
ammo_type = list(/obj/item/ammo_casing/energy/temp, /obj/item/ammo_casing/energy/temp/hot)
cell_type = /obj/item/stock_parts/cell/gun/upgraded
default_ammo_type = /obj/item/stock_parts/cell/gun/upgraded
ammo_x_offset = 2

/obj/item/gun/energy/temperature/security
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
gun_firemodes = list(FIREMODE_SEMIAUTO, FIREMODE_FULLAUTO)
default_firemode = FIREMODE_SEMIAUTO

cell_type = /obj/item/stock_parts/cell/gun
default_ammo_type = /obj/item/stock_parts/cell/gun
allowed_ammo_types = list(
/obj/item/stock_parts/cell/gun,
/obj/item/stock_parts/cell/gun/upgraded,
/obj/item/stock_parts/cell/cell/gun/empty,
/obj/item/stock_parts/cell/gun/upgraded/empty,
)
ammo_type = list(/obj/item/ammo_casing/energy/kalix, /obj/item/ammo_casing/energy/disabler/hitscan)

manufacturer = MANUFACTURER_MINUTEMAN_LASER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
wield_delay = 0.7 SECONDS
wield_slowdown = 0.35

cell_type = /obj/item/stock_parts/cell/gun/kalix
default_ammo_type = /obj/item/stock_parts/cell/gun/kalix
allowed_ammo_types = list(
/obj/item/stock_parts/cell/gun/kalix,
)
ammo_type = list(/obj/item/ammo_casing/energy/kalix, /obj/item/ammo_casing/energy/disabler/hitscan)

load_sound = 'sound/weapons/gun/gauss/pistol_reload.ogg'
Expand Down Expand Up @@ -54,7 +57,10 @@
gun_firemodes = list(FIREMODE_SEMIAUTO, FIREMODE_FULLAUTO)
default_firemode = FIREMODE_SEMIAUTO

cell_type = /obj/item/stock_parts/cell/gun/pgf
default_ammo_type = /obj/item/stock_parts/cell/gun/pgf
allowed_ammo_types = list(
/obj/item/stock_parts/cell/gun/pgf,
)
ammo_type = list(/obj/item/ammo_casing/energy/kalix/pgf , /obj/item/ammo_casing/energy/disabler/hitscan)

/obj/projectile/beam/hitscan/kalix/pgf
Expand Down Expand Up @@ -86,7 +92,10 @@
spread = 2
spread_unwielded = 5

cell_type = /obj/item/stock_parts/cell/gun/kalix
default_ammo_type = /obj/item/stock_parts/cell/gun/kalix
allowed_ammo_types = list(
/obj/item/stock_parts/cell/gun/kalix,
)
ammo_type = list(/obj/item/ammo_casing/energy/kalix/pistol)


Expand Down
Loading

0 comments on commit 9254f49

Please sign in to comment.