Skip to content

Commit

Permalink
fixed powered weapons (my hated)
Browse files Browse the repository at this point in the history
  • Loading branch information
FalloutFalcon committed Sep 26, 2024
1 parent 2d53e6d commit 901559a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
12 changes: 6 additions & 6 deletions code/modules/projectiles/guns/ballistic/gauss.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
item_state = "model-h"
fire_sound = 'sound/weapons/gun/gauss/modelh.ogg'
load_sound = 'sound/weapons/gun/gauss/pistol_reload.ogg'
default_ammo_type = /obj/item/stock_parts/cell/gun/solgov
allowed_ammo_types = list(
default_cell_type = /obj/item/stock_parts/cell/gun/solgov
allowed_cell_types = list(
/obj/item/stock_parts/cell/gun/solgov,
)
slot_flags = ITEM_SLOT_BELT
Expand Down Expand Up @@ -91,8 +91,8 @@
item_state = "claris"
fire_sound = 'sound/weapons/gun/gauss/claris.ogg'
load_sound = 'sound/weapons/gun/gauss/sniper_reload.ogg'
default_ammo_type = /obj/item/stock_parts/cell/gun/solgov
allowed_ammo_types = list(
default_cell_type = /obj/item/stock_parts/cell/gun/solgov
allowed_cell_types = list(
/obj/item/stock_parts/cell/gun/solgov,
)
fire_delay = 0.4 SECONDS
Expand Down Expand Up @@ -123,8 +123,8 @@
item_state = "gar"
fire_sound = 'sound/weapons/gun/gauss/gar.ogg'
load_sound = 'sound/weapons/gun/gauss/rifle_reload.ogg'
default_ammo_type = /obj/item/stock_parts/cell/gun/solgov
allowed_ammo_types = list(
default_cell_type = /obj/item/stock_parts/cell/gun/solgov
default_cell_types = list(
/obj/item/stock_parts/cell/gun/solgov,
)
burst_size = 1
Expand Down
15 changes: 10 additions & 5 deletions code/modules/projectiles/guns/powered.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
allowed_ammo_types = list(
/obj/item/ammo_box/magazine/gauss,
)
var/default_cell_type = /obj/item/stock_parts/cell/gun
var/list/allowed_cell_types = list(
/obj/item/stock_parts/cell/gun,
/obj/item/stock_parts/cell/gun/upgraded,
/obj/item/stock_parts/cell/gun/empty,
/obj/item/stock_parts/cell/gun/upgraded/empty,
)
charge_sections = 3

/obj/item/gun/ballistic/automatic/powered/Initialize()
. = ..()
if(default_ammo_type)
cell = new default_ammo_type(src)
else
cell = new(src)
if(default_cell_type)
cell = new default_cell_type(src)
update_appearance()

/obj/item/gun/ballistic/automatic/powered/examine(mob/user)
Expand Down Expand Up @@ -42,7 +47,7 @@

//the things below were taken from energy gun code. blame whoever coded this, not me
/obj/item/gun/ballistic/automatic/powered/attackby(obj/item/A, mob/user, params)
if (!internal_cell && A.type in allowed_ammo_types)
if (!internal_cell && (A.type in allowed_cell_types))
var/obj/item/stock_parts/cell/gun/C = A
if (!cell)
insert_cell(user, C)
Expand Down

0 comments on commit 901559a

Please sign in to comment.