Skip to content

Commit

Permalink
Ports Mecha Ammo Management, readds researchable mech missiles (BeeSt…
Browse files Browse the repository at this point in the history
…ation#11480)

* Ammo management

* ammo fixes

* readd missiles

* missingicon
  • Loading branch information
Tsar-Salat authored Oct 10, 2024
1 parent 4d57f43 commit 29f7d7f
Show file tree
Hide file tree
Showing 17 changed files with 419 additions and 22 deletions.
1 change: 1 addition & 0 deletions beestation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -4158,6 +4158,7 @@
#include "code\modules\vehicles\mecha\equipment\tools\other_tools.dm"
#include "code\modules\vehicles\mecha\equipment\tools\weapon_bay.dm"
#include "code\modules\vehicles\mecha\equipment\tools\work_tools.dm"
#include "code\modules\vehicles\mecha\equipment\weapons\mecha_ammo.dm"
#include "code\modules\vehicles\mecha\equipment\weapons\weapons.dm"
#include "code\modules\vehicles\mecha\medical\odysseus.dm"
#include "code\modules\vehicles\mecha\working\clarke.dm"
Expand Down
1 change: 1 addition & 0 deletions code/game/machinery/fabricators/exosuit_fab.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"H.O.N.K",
"Phazon",
"Exosuit Equipment",
"Exosuit Ammunition",
"Cyborg Upgrade Modules",
"IPC Components",
"Cybernetics",
Expand Down
25 changes: 25 additions & 0 deletions code/game/objects/items/storage/backpack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,31 @@
for(var/i in 1 to 9)
new /obj/item/ammo_box/magazine/smgm45(src)

/obj/item/storage/backpack/duffelbag/syndie/ammo/dark_gygax
desc = "A large duffel bag, packed to the brim with various exosuit ammo."

/obj/item/storage/backpack/duffelbag/syndie/ammo/dark_gygax/PopulateContents()
new /obj/item/mecha_ammo/incendiary(src)
new /obj/item/mecha_ammo/incendiary(src)
new /obj/item/mecha_ammo/incendiary(src)
new /obj/item/mecha_ammo/flashbang(src)
new /obj/item/mecha_ammo/flashbang(src)
new /obj/item/mecha_ammo/flashbang(src)

/obj/item/storage/backpack/duffelbag/syndie/ammo/mauler
desc = "A large duffel bag, packed to the brim with various exosuit ammo."

/obj/item/storage/backpack/duffelbag/syndie/ammo/mauler/PopulateContents()
new /obj/item/mecha_ammo/lmg(src)
new /obj/item/mecha_ammo/lmg(src)
new /obj/item/mecha_ammo/lmg(src)
new /obj/item/mecha_ammo/scattershot(src)
new /obj/item/mecha_ammo/scattershot(src)
new /obj/item/mecha_ammo/scattershot(src)
new /obj/item/mecha_ammo/missiles_he(src)
new /obj/item/mecha_ammo/missiles_he(src)
new /obj/item/mecha_ammo/missiles_he(src)

/obj/item/storage/backpack/duffelbag/syndie/c20rbundle
desc = "A large duffel bag containing a C-20r, some magazines, and a cheap looking suppressor."

Expand Down
35 changes: 34 additions & 1 deletion code/modules/projectiles/projectile/special/rocket.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
return BULLET_ACT_HIT

/obj/projectile/bullet/a84mm_he
name ="\improper HE rocket"
name ="\improper HE missile"
desc = "Boom."
icon_state = "missile"
damage = 30
Expand All @@ -43,3 +43,36 @@
else
explosion(target, 0, 0, 2, 4)
return BULLET_ACT_HIT

/// Mech BRM-6 missile
/obj/projectile/bullet/a84mm_br
name ="\improper HE missile"
desc = "Boom."
icon_state = "missile"
damage = 30
ricochets_max = 0 //it's a MISSILE
shrapnel_type = null
var/sturdy = list(
/turf/closed,
/obj/vehicle/sealed/mecha,
/obj/machinery/door,
/obj/structure/window,
/obj/structure/grille
)

/obj/item/broken_missile
name = "\improper broken missile"
desc = "A missile that did not detonate. The tail has snapped and it is in no way fit to be used again."
icon = 'icons/obj/projectiles.dmi'
icon_state = "missile_broken"
w_class = WEIGHT_CLASS_TINY


/obj/projectile/bullet/a84mm_br/on_hit(atom/target, blocked=0)
..()
for(var/i in sturdy)
if(istype(target, i))
explosion(target, 0, 1, 1, 2)
return BULLET_ACT_HIT
//if(istype(target, /turf/closed) || ismecha(target))
new /obj/item/broken_missile(get_turf(src), 1)
75 changes: 75 additions & 0 deletions code/modules/research/designs/mecha_designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@
category = list("Weapons")
departmental_flags = DEPARTMENTAL_FLAG_SECURITY

/datum/design/mech_scattershot_ammo
name = "LBX AC 10 Scattershot Ammunition"
desc = "Ammunition for the LBX AC 10 exosuit weapon."
id = "mech_scattershot_ammo"
build_type = PROTOLATHE | MECHFAB
build_path = /obj/item/mecha_ammo/scattershot
materials = list(/datum/material/iron=6000)
construction_time = 20
category = list("Exosuit Ammunition", "Ammo")
departmental_flags = DEPARTMENTAL_FLAG_SECURITY

/datum/design/mech_carbine
name = "Exosuit Weapon (FNX-99 \"Hades\" Carbine)"
Expand All @@ -176,6 +186,17 @@
category = list("Weapons")
departmental_flags = DEPARTMENTAL_FLAG_SECURITY

/datum/design/mech_carbine_ammo
name = "FNX-99 Carbine Ammunition"
desc = "Ammunition for the FNX-99 \"Hades\" Carbine."
id = "mech_carbine_ammo"
build_type = PROTOLATHE | MECHFAB
build_path = /obj/item/mecha_ammo/incendiary
materials = list(/datum/material/iron=6000)
construction_time = 20
category = list("Exosuit Ammunition", "Ammo")
departmental_flags = DEPARTMENTAL_FLAG_SECURITY

/datum/design/mech_ion
name = "Exosuit Weapon (MKIV Ion Heavy Cannon)"
desc = "Allows for the construction of MKIV Ion Heavy Cannon."
Expand Down Expand Up @@ -240,6 +261,38 @@
construction_time = 100
category = list("Exosuit Equipment")

/datum/design/mech_grenade_launcher_ammo
name = "SGL-6 Grenade Launcher Ammunition"
desc = "Ammunition for the SGL-6 Grenade Launcher."
id = "mech_grenade_launcher_ammo"
build_type = PROTOLATHE | MECHFAB
build_path = /obj/item/mecha_ammo/flashbang
materials = list(/datum/material/iron=4000,/datum/material/gold=500)
construction_time = 20
category = list("Exosuit Ammunition", "Ammo")
departmental_flags = DEPARTMENTAL_FLAG_SECURITY

/datum/design/mech_missile_rack
name = "Exosuit Weapon (BRM-6 Missile Rack)"
desc = "Allows for the construction of an BRM-6 Breaching Missile Rack."
id = "mech_missile_rack"
build_type = MECHFAB
build_path = /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/missile_rack/breaching
materials = list(/datum/material/iron=22000,/datum/material/gold=6000,/datum/material/silver=8000)
construction_time = 100
category = list("Exosuit Equipment")

/datum/design/mech_missile_rack_ammo
name = "BRM-6 Missile Rack Ammunition"
desc = "Ammunition for the BRM-6 Missile Rack."
id = "mech_missile_rack_ammo"
build_type = PROTOLATHE | MECHFAB
build_path = /obj/item/mecha_ammo/missiles_br
materials = list(/datum/material/iron=8000,/datum/material/gold=500)
construction_time = 20
category = list("Exosuit Ammunition", "Ammo")
departmental_flags = DEPARTMENTAL_FLAG_SECURITY

/datum/design/clusterbang_launcher
name = "Exosuit Weapon (SOB-3 Clusterbang Launcher)"
desc = "A weapon that violates the Geneva Convention at 3 rounds per minute"
Expand All @@ -251,6 +304,17 @@
category = list("Weapons")
departmental_flags = DEPARTMENTAL_FLAG_SECURITY

/datum/design/clusterbang_launcher_ammo
name = "SOB-3 Clusterbang Launcher Ammunition"
desc = "Ammunition for the SOB-3 Clusterbang Launcher"
id = "clusterbang_launcher_ammo"
build_type = PROTOLATHE | MECHFAB
build_path = /obj/item/mecha_ammo/clusterbang
materials = list(/datum/material/iron=6000,/datum/material/gold=1500,/datum/material/uranium=1500)
construction_time = 20
category = list("Exosuit Ammunition", "Ammo")
departmental_flags = DEPARTMENTAL_FLAG_SECURITY

/datum/design/mech_wormhole_gen
name = "Exosuit Module (Localized Wormhole Generator)"
desc = "An exosuit module that allows generating of small quasi-stable wormholes."
Expand Down Expand Up @@ -392,6 +456,17 @@
category = list("Weapons")
departmental_flags = DEPARTMENTAL_FLAG_SECURITY

/datum/design/mech_lmg_ammo
name = "Ultra AC 2 Ammunition"
desc = "Ammunition for the Ultra AC 2 LMG"
id = "mech_lmg_ammo"
build_type = PROTOLATHE | MECHFAB
build_path = /obj/item/mecha_ammo/lmg
materials = list(/datum/material/iron=4000)
construction_time = 20
category = list("Exosuit Ammunition", "Ammo")
departmental_flags = DEPARTMENTAL_FLAG_SECURITY

/datum/design/mech_sleeper
name = "Exosuit Medical (Mounted Sleeper)"
desc = "Equipment for medical exosuits. A mounted sleeper that stabilizes patients and can inject reagents in the exosuit's reserves."
Expand Down
19 changes: 14 additions & 5 deletions code/modules/research/techweb/all_nodes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2003,7 +2003,7 @@
display_name = "Exosuit Weapon (LBX AC 10 \"Scattershot\")"
description = "An advanced piece of mech weaponry"
prereq_ids = list("ballistic_weapons")
design_ids = list("mech_scattershot")
design_ids = list("mech_scattershot", "mech_scattershot_ammo")
research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 2500)
export_price = 5000

Expand All @@ -2013,7 +2013,7 @@
display_name = "Exosuit Weapon (FNX-99 \"Hades\" Carbine)"
description = "An advanced piece of mech weaponry"
prereq_ids = list("ballistic_weapons")
design_ids = list("mech_carbine")
design_ids = list("mech_carbine", "mech_carbine_ammo")
research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 2500)
export_price = 5000

Expand Down Expand Up @@ -2077,7 +2077,16 @@
display_name = "Exosuit Weapon (SGL-6 Grenade Launcher)"
description = "An advanced piece of mech weaponry"
prereq_ids = list("explosive_weapons")
design_ids = list("mech_grenade_launcher")
design_ids = list("mech_grenade_launcher", "mech_grenade_launcher_ammo")
research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 2500)
export_price = 5000

/datum/techweb_node/mech_missile_rack
id = "mech_missile_rack"
display_name = "Exosuit Weapon (BRM-6 Missile Rack)"
description = "An advanced piece of mech weaponry"
prereq_ids = list("explosive_weapons")
design_ids = list("mech_missile_rack", "mech_missile_rack_ammo")
research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 2500)
export_price = 5000

Expand All @@ -2087,7 +2096,7 @@
display_name = "Exosuit Module (SOB-3 Clusterbang Launcher)"
description = "An advanced piece of mech weaponry"
prereq_ids = list("explosive_weapons")
design_ids = list("clusterbang_launcher")
design_ids = list("clusterbang_launcher", "clusterbang_launcher_ammo")
research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 2500)
export_price = 5000

Expand Down Expand Up @@ -2117,7 +2126,7 @@
display_name = "Exosuit Weapon (\"Ultra AC 2\" LMG)"
description = "An advanced piece of mech weaponry"
prereq_ids = list("ballistic_weapons")
design_ids = list("mech_lmg")
design_ids = list("mech_lmg", "mech_lmg_ammo")
research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 2500)
export_price = 5000

Expand Down
14 changes: 14 additions & 0 deletions code/modules/uplink/uplink_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,20 @@ GLOBAL_LIST_INIT(illegal_tech_blacklist, typecacheof(list(
illegal_tech = FALSE
contents_are_illegal_tech = FALSE

/datum/uplink_item/ammo/dark_gygax/bag
name = "Dark Gygax Ammo Bag"
desc = "A duffel bag containing ammo for three full reloads of the incendiary carbine and flash bang launcher that are equipped on a standard Dark Gygax exosuit."
item = /obj/item/storage/backpack/duffelbag/syndie/ammo/dark_gygax
cost = 4
purchasable_from = UPLINK_NUKE_OPS

/datum/uplink_item/ammo/mauler/bag
name = "Mauler Ammo Bag"
desc = "A duffel bag containing ammo for three full reloads of the LMG, scattershot carbine, and SRM-8 missile laucher that are equipped on a standard Mauler exosuit."
item = /obj/item/storage/backpack/duffelbag/syndie/ammo/mauler
cost = 6
purchasable_from = UPLINK_NUKE_OPS

//Grenades and Explosives
/datum/uplink_item/explosives
category = "Explosives"
Expand Down
61 changes: 61 additions & 0 deletions code/modules/vehicles/mecha/_mecha.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,67 @@
/obj/vehicle/sealed/mecha/portableConnectorReturnAir()
return internal_tank.return_air()

///////////////////////
////// Ammo stuff /////
///////////////////////

/obj/vehicle/sealed/mecha/proc/ammo_resupply(obj/item/mecha_ammo/A, mob/user,fail_chat_override = FALSE)
if(!A.rounds)
if(!fail_chat_override)
to_chat(user, "<span class='warning'>This box of ammo is empty!</span>")
return FALSE
var/ammo_needed
var/found_gun
for(var/obj/item/mecha_parts/mecha_equipment/weapon/ballistic/gun in equipment)
ammo_needed = 0

if(gun.ammo_type != A.ammo_type)
continue
found_gun = TRUE
if(A.direct_load)
ammo_needed = initial(gun.projectiles) - gun.projectiles
else
ammo_needed = gun.projectiles_cache_max - gun.projectiles_cache

if(!ammo_needed)
continue
if(ammo_needed < A.rounds)
if(A.direct_load)
gun.projectiles = gun.projectiles + ammo_needed
else
gun.projectiles_cache = gun.projectiles_cache + ammo_needed
playsound(get_turf(user),A.load_audio,50,TRUE)
to_chat(user, "<span class='notice'>You add [ammo_needed] [A.round_term][ammo_needed > 1?"s":""] to the [gun.name]</span>")
A.rounds = A.rounds - ammo_needed
if(A.custom_materials) //Change material content of the ammo box according to the amount of ammo deposited into the weapon
/// list of materials contained in the ammo box after we put it through the equation so we can stick this list into set_custom_materials()
var/list/new_material_content = list()
for(var/datum/material/current_material in A.custom_materials)
if(istype(current_material, /datum/material/iron)) //we can flatten an empty ammo box into a sheet of iron (2000 units) so we have to make sure the box always has this amount at minimum
new_material_content[current_material] = (A.custom_materials[current_material] - 2000) * (A.rounds / initial(A.rounds)) + 2000
else
new_material_content[current_material] = A.custom_materials[current_material] * (A.rounds / initial(A.rounds))
A.set_custom_materials(new_material_content)
A.update_name()
return TRUE

if(A.direct_load)
gun.projectiles = gun.projectiles + A.rounds
else
gun.projectiles_cache = gun.projectiles_cache + A.rounds
playsound(get_turf(user),A.load_audio,50,TRUE)
to_chat(user, "<span class='notice'>You add [A.rounds] [A.round_term][A.rounds > 1?"s":""] to the [gun.name]</span>")
A.rounds = 0
A.set_custom_materials(list(/datum/material/iron=2000))
A.update_appearance()
return TRUE
if(!fail_chat_override)
if(found_gun)
to_chat(user, "<span class='notice'>You can't fit any more ammo of this type!</span>")
else
to_chat(user, "<span class='notice'>None of the equipment on this exosuit can use this ammo!</span>")
return FALSE

/obj/vehicle/sealed/mecha/lighteater_act(obj/item/light_eater/light_eater, atom/parent)
..()
if(mecha_flags & HAS_LIGHTS)
Expand Down
6 changes: 6 additions & 0 deletions code/modules/vehicles/mecha/combat/combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@
/obj/vehicle/sealed/mecha/combat/restore_equipment()
mouse_pointer = 'icons/mecha/mecha_mouse.dmi'
return ..()

/obj/vehicle/sealed/mecha/combat/proc/max_ammo() //Max the ammo stored for Nuke Ops mechs, or anyone else that calls this
for(var/obj/item/I in equipment)
if(istype(I, /obj/item/mecha_parts/mecha_equipment/weapon/ballistic/))
var/obj/item/mecha_parts/mecha_equipment/weapon/ballistic/gun = I
gun.projectiles_cache = gun.projectiles_cache_max
1 change: 1 addition & 0 deletions code/modules/vehicles/mecha/combat/gygax.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
ME.attach(src)
ME = new /obj/item/mecha_parts/mecha_equipment/tesla_energy_relay
ME.attach(src)
max_ammo()

/obj/vehicle/sealed/mecha/combat/gygax/dark/add_cell(obj/item/stock_parts/cell/C=null)
if(C)
Expand Down
3 changes: 3 additions & 0 deletions code/modules/vehicles/mecha/combat/marauder.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
ME.attach(src)
ME = new /obj/item/mecha_parts/mecha_equipment/antiproj_armor_booster(src)
ME.attach(src)
max_ammo()

/obj/vehicle/sealed/mecha/combat/marauder/seraph
desc = "Heavy-duty, command-type exosuit. This is a custom model, utilized only by high-ranking military personnel."
Expand Down Expand Up @@ -64,6 +65,7 @@
ME.attach(src)
ME = new /obj/item/mecha_parts/mecha_equipment/antiproj_armor_booster(src)
ME.attach(src)
max_ammo()

/obj/vehicle/sealed/mecha/combat/marauder/mauler
desc = "Heavy-duty, combat exosuit, developed off of the existing Marauder model."
Expand Down Expand Up @@ -93,5 +95,6 @@
ME.attach(src)
ME = new /obj/item/mecha_parts/mecha_equipment/antiproj_armor_booster(src)
ME.attach(src)
max_ammo()


Loading

0 comments on commit 29f7d7f

Please sign in to comment.