Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for hardsuit modules that use ammo instead of energy #18645

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
2 changes: 2 additions & 0 deletions code/__DEFINES/is_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 70,5 @@
#define isprojectile(A) istype(A, /obj/projectile)
#define isbeam(A) istype(A, /obj/projectile/beam)
#define isenergy(A) istype(A, /obj/projectile/energy)

#define ismagazine(A) istype(A, /obj/item/ammo_magazine)
2 changes: 1 addition & 1 deletion code/datums/uplink/hardsuit_modules.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 27,7 @@
/datum/uplink_item/item/hardsuit_modules/egun
name = "Mounted Energy Gun"
telecrystal_cost = 6
path = /obj/item/rig_module/mounted/egun
path = /obj/item/rig_module/mounted/energy/egun

/datum/uplink_item/item/hardsuit_modules/power_sink
name = "Power Sink"
Expand Down
2 changes: 1 addition & 1 deletion code/datums/uplink/ninja_modules.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 32,7 @@
name = "Energy Blade and dart launcher."
desc = "A module that can produce a powerful energy blade in the users hand. It can also shoot stun-darts."
telecrystal_cost = 4
path = /obj/item/rig_module/mounted/energy_blade
path = /obj/item/rig_module/mounted/energy/energy_blade

/datum/uplink_item/item/ninja_modules/matter_fab
name = "Matter Fabricator"
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/random/tech.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 110,8 @@
/obj/item/rig_module/fabricator = 0.5,
/obj/item/rig_module/grenade_launcher = 0.5,
/obj/item/rig_module/maneuvering_jets = 0.5,
/obj/item/rig_module/mounted/egun = 1,
/obj/item/rig_module/mounted/smg = 0.5,
/obj/item/rig_module/mounted/energy/egun = 1,
/obj/item/rig_module/mounted/ballistic/machine_pistol = 0.5,
/obj/item/rig_module/vision/multi = 0.5
)

Expand Down
168 changes: 121 additions & 47 deletions code/modules/clothing/spacesuits/rig/modules/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 2,7 @@
* Contains
* /obj/item/rig_module/grenade_launcher
* /obj/item/rig_module/mounted
* /obj/item/rig_module/mounted/taser
* /obj/item/rig_module/mounted/energy/taser
* /obj/item/rig_module/shield
* /obj/item/rig_module/fabricator
* /obj/item/rig_module/device/flash
Expand Down Expand Up @@ -113,47 113,109 @@

/obj/item/rig_module/mounted
name = "mounted laser cannon"
desc = "A shoulder-mounted battery-powered laser cannon mount."
desc = "Some sort of mounted gun."
selectable = TRUE
usable = TRUE
module_cooldown = 0
icon_state = "lcannon"

engage_string = "Configure"

category = MODULE_HEAVY_COMBAT
category = MODULE_LIGHT_COMBAT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the re-classifies a lot of modules as light combat.

I think we should add a ballistic category (as the Primary balance there is the ammo usage) and update the combat category names to indicate that those are laser weapons.

(Maybe even a ballistic heavy / ballistic light/ launcher category)


interface_name = "mounted laser cannon"
interface_desc = "A shoulder-mounted cell-powered laser cannon."
interface_name = "mounted gun"
interface_desc = "A suit mounted gun."

var/gun_type = /obj/item/gun/energy/lasercannon/mounted
var/obj/item/gun/gun
/obj/item/rig_module/mounted/energy
abstract_type = /obj/item/rig_module/mounted/energy
var/obj/item/gun/energy/laser

/obj/item/rig_module/mounted/New()
..()
gun = new gun_type(src)
if(istype(gun, /obj/item/gun))
gun.has_safety = FALSE
/obj/item/rig_module/mounted/energy/Initialize()
. = ..()
if(ispath(laser))
laser = new laser(src)
laser.canremove = FALSE
laser.has_safety = FALSE
NonQueueingMatt marked this conversation as resolved.
Show resolved Hide resolved

/obj/item/rig_module/mounted/energy/engage(atom/target, mob/user)

if(!..() || !laser)
return FALSE

if(!target)
var/list/extra_mobs = list()
if(holder.wearer != user)
extra_mobs = holder.wearer
laser.toggle_firing_mode(user, extra_mobs)
return TRUE

/obj/item/rig_module/mounted/Destroy()
QDEL_NULL(gun)
laser.Fire(target, holder.wearer)
return TRUE

/obj/item/rig_module/mounted/energy/Destroy()
QDEL_NULL(laser)
. = ..()

/obj/item/rig_module/mounted/engage(atom/target, mob/user)
if(!..())
/obj/item/rig_module/mounted/ballistic
abstract_type = /obj/item/rig_module/mounted/ballistic
var/obj/item/gun/projectile/ballistic

/obj/item/rig_module/mounted/ballistic/Initialize()
. = ..()
if(ispath(ballistic))
ballistic = new ballistic(src)
ballistic.canremove = FALSE
ballistic.has_safety = FALSE
Generalcamo marked this conversation as resolved.
Show resolved Hide resolved

/obj/item/rig_module/mounted/ballistic/engage(atom/target, mob/user)

if(!..() || !ballistic)
return FALSE

if(!target)
var/list/extra_mobs = list()
if(holder.wearer != user)
extra_mobs = holder.wearer
gun.toggle_firing_mode(user, extra_mobs)
ballistic.toggle_firing_mode(user, extra_mobs)
return TRUE

gun.Fire(target, user)
ballistic.Fire(target, holder.wearer)
return TRUE

/obj/item/rig_module/mounted/egun
/obj/item/rig_module/mounted/ballistic/accepts_item(obj/item/input, mob/living/user)
var/obj/item/rig/rig = get_rig(src)

if(!istype(input) || !istype(user) || !rig)
return FALSE

if (ismagazine(input) && ballistic.ammo_magazine)
ballistic.unload_ammo(user, FALSE)

else
ballistic.load_ammo(input, user)

/obj/item/rig_module/mounted/ballistic/Destroy()
QDEL_NULL(ballistic)
. = ..()

/obj/item/rig_module/mounted/energy/lcannon
name = "mounted laser cannon"
desc = "A shoulder-mounted battery-powered laser cannon mount."
selectable = TRUE
usable = TRUE
module_cooldown = 0
icon_state = "lcannon"

engage_string = "Configure"

category = MODULE_HEAVY_COMBAT

interface_name = "mounted laser cannon"
interface_desc = "A shoulder-mounted cell-powered laser cannon."

laser = /obj/item/gun/energy/lasercannon/mounted

/obj/item/rig_module/mounted/energy/egun
name = "mounted energy gun"
desc = "A forearm-mounted energy projector."
icon_state = "egun"
Expand All @@ -163,11 225,11 @@
interface_name = "mounted energy gun"
interface_desc = "A forearm-mounted suit-powered energy gun."

gun_type = /obj/item/gun/energy/gun/mounted
laser = /obj/item/gun/energy/gun/mounted

category = MODULE_LIGHT_COMBAT

/obj/item/rig_module/mounted/taser
/obj/item/rig_module/mounted/energy/taser
name = "mounted taser"
desc = "A palm-mounted nonlethal energy projector."
icon_state = "taser"
Expand All @@ -182,21 244,21 @@
interface_name = "mounted taser"
interface_desc = "A shoulder-mounted cell-powered taser."

gun_type = /obj/item/gun/energy/taser/mounted
laser = /obj/item/gun/energy/taser/mounted

category = MODULE_LIGHT_COMBAT

/obj/item/rig_module/mounted/pulse
/obj/item/rig_module/mounted/energy/pulse
name = "mounted pulse rifle"
desc = "A shoulder-mounted battery-powered pulse rifle mount."
icon_state = "pulse"

interface_name = "mounted pulse rifle"
interface_desc = "A shoulder-mounted cell-powered pulse rifle."

gun_type = /obj/item/gun/energy/pulse/mounted
laser = /obj/item/gun/energy/pulse/mounted

/obj/item/rig_module/mounted/plasma
/obj/item/rig_module/mounted/energy/plasma

name = "mounted plasma cannon"
desc = "A marvel of Elyran weapons technology which utilizes superheated plasma to pierce thick armor with gruesome results. This one seems fitted for RIG usage."
Expand All @@ -205,49 267,61 @@
interface_name = "mounted plasma cannon"
interface_desc = "A shoulder-mounted cell-powered burst plasma cannon."

gun_type = /obj/item/gun/energy/mountedplasma
laser = /obj/item/gun/energy/mountedplasma

/obj/item/rig_module/mounted/smg
/obj/item/rig_module/mounted/ballistic/smg
name = "mounted submachine gun"
desc = "A forearm-mounted suit-powered ballistic submachine gun."
desc = "A forearm-mounted ballistic submachine gun."
icon_state = "smg"

interface_name = "mounted submachine gun"
interface_desc = "A forearm-mounted suit-powered ballistic submachine gun."
interface_desc = "A forearm-mounted ballistic submachine gun. Use a prototype SMG magazine (4mm) on your suit control module to reload."

ballistic = /obj/item/gun/projectile/automatic/mounted

/obj/item/rig_module/mounted/ballistic/machine_pistol
name = "mounted machine pistol"
desc = "A wrist-mounted ballistic machine pistol."
icon_state = "machine_oistol"

gun_type = /obj/item/gun/energy/mountedsmg
interface_name = "mounted machine pistol"
interface_desc = "A wrist-mounted ballistic machine pistol. Use a top mounted magazine (9mm) on your suit control module to reload."

ballistic = /obj/item/gun/projectile/automatic/wt550/mounted

category = MODULE_LIGHT_COMBAT

/obj/item/rig_module/mounted/xray
/obj/item/rig_module/mounted/energy/xray
name = "mounted xray laser gun"
desc = "A forearm-mounted suit-powered xray laser gun."
icon_state = "xray"

interface_name = "mounted xray laser gun"
interface_desc = "A forearm-mounted suit-powered xray laser gun."

gun_type = /obj/item/gun/energy/xray/mounted
laser = /obj/item/gun/energy/xray/mounted

/obj/item/rig_module/mounted/ion
/obj/item/rig_module/mounted/energy/ion
name = "mounted ion rifle"
desc = "A shoulder-mounted battery-powered ion rifle mount."
icon_state = "ion"

interface_name = "mounted ion rifle"
interface_desc = "A shoulder-mounted cell-powered ion rifle."

gun_type = /obj/item/gun/energy/rifle/ionrifle/mounted
laser = /obj/item/gun/energy/rifle/ionrifle/mounted

/obj/item/rig_module/mounted/tesla
/obj/item/rig_module/mounted/energy/tesla
name = "mounted tesla carbine"
desc = "A shoulder-mounted battery-powered tesla carbine mount."
icon_state = "tesla"

interface_name = "mounted tesla carbine"
interface_desc = "A shoulder-mounted cell-powered tesla carbine."

gun_type = /obj/item/gun/energy/tesla/mounted
laser = /obj/item/gun/energy/tesla/mounted

/obj/item/rig_module/mounted/plasmacutter
/obj/item/rig_module/mounted/energy/plasmacutter
name = "hardsuit plasma cutter"
desc = "A forearm mounted kinetic accelerator"
icon_state = "plasmacutter"
Expand All @@ -260,20 334,20 @@

category = MODULE_UTILITY

gun_type = /obj/item/gun/energy/plasmacutter/mounted
laser = /obj/item/gun/energy/plasmacutter/mounted

/obj/item/rig_module/mounted/thermalldrill
/obj/item/rig_module/mounted/energy/thermalldrill
name = "hardsuit thermal drill"
desc = "An incredibly lethal looking thermal drill."
icon_state = "thermaldrill"
interface_name = "thermal drill"
interface_desc = "A potent drill that can pierce rock walls over long distances."

gun_type = /obj/item/gun/energy/vaurca/thermaldrill/mounted
laser = /obj/item/gun/energy/vaurca/thermaldrill/mounted

category = MODULE_UTILITY

/obj/item/rig_module/mounted/energy_blade
/obj/item/rig_module/mounted/energy/energy_blade
name = "energy blade projector"
desc = "A powerful cutting beam projector."
icon_state = "eblade"
Expand All @@ -291,19 365,19 @@
active_power_cost = 10
passive_power_cost = 0

gun_type = /obj/item/gun/energy/crossbow/ninja
laser = /obj/item/gun/energy/crossbow/ninja

category = MODULE_SPECIAL

/obj/item/rig_module/mounted/energy_blade/process()
/obj/item/rig_module/mounted/energy/energy_blade/process()
if(holder && holder.wearer)
if(!(locate(/obj/item/melee/energy/blade) in holder.wearer))
deactivate(holder.wearer)
return FALSE

return ..()

/obj/item/rig_module/mounted/energy_blade/activate(mob/user)
/obj/item/rig_module/mounted/energy/energy_blade/activate(mob/user)
..()

var/mob/living/M = holder.wearer
Expand All @@ -320,7 394,7 @@
blade.creator = M
M.put_in_hands(blade)

/obj/item/rig_module/mounted/energy_blade/deactivate()
/obj/item/rig_module/mounted/energy/energy_blade/deactivate()
..()

var/mob/living/M = holder.wearer
Expand Down Expand Up @@ -409,10 483,10 @@
tesla_zap(H, 5, 5000)
return TRUE

/obj/item/rig_module/mounted/skrell_gun
/obj/item/rig_module/mounted/energy/skrell_gun
name = "mounted tqi-qop carbine"
desc = "A shoulder-mounted cell-powered tqi-qop carbine."
icon_state = "pulse"
interface_name = "mounted tqi-qop carbine"
interface_desc = "A shoulder-mounted cell-powered tqi-qop carbine."
gun_type = /obj/item/gun/energy/gun/qukala/mounted
laser = /obj/item/gun/energy/gun/qukala/mounted
6 changes: 5 additions & 1 deletion code/modules/clothing/spacesuits/rig/rig.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 1027,11 @@
cell.use(10)
wearer.Move(get_step(get_turf(wearer),direction),direction)

// This returns the rig if you are contained inside one, but not if you are wearing it
/**
* Retrieves the rig the atom is located inside of, recursively checking parent locs until it find one.
*
* Returns instead of `/obj/item/rig`.
*/
/atom/proc/get_rig()
if(loc)
return loc.get_rig()
Expand Down
Loading
Loading