Skip to content

Commit

Permalink
Breech loaded tank magazines (#16267)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lumipharon committed Jul 6, 2024
1 parent 6bddc24 commit 69f8f44
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion code/datums/storage/subtypes/tank.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
allow_drawing_method = FALSE /// Unable to set draw_mode ourselves
max_w_class = WEIGHT_CLASS_GIGANTIC //they're all WEIGHT_CLASS_GIGANTIC which is 6
max_storage_space = 120
storage_slots = 20
storage_slots = 40

/datum/storage/tank/on_attack_hand(datum/source, mob/living/user) //Override for tank subtype since this is deployed storage
if(parent.Adjacent(user))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
equipment_list = list(
/obj/item/armored_weapon/coilgun = 1,
/obj/item/armored_weapon/secondary_mlrs = 1,
/obj/item/ammo_magazine/tank/coilgun = 15,
/obj/item/ammo_magazine/tank/coilgun = 40,
/obj/item/ammo_magazine/tank/secondary_mlrs = 8,
)

Expand Down
6 changes: 3 additions & 3 deletions code/modules/vehicles/armored/ammo_magazine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@
desc = "A set of extremely dense kinetic penetrator rounds for a tank mounted coilgun."
caliber = CALIBER_84MM
icon_state = "coilgun"
w_class = WEIGHT_CLASS_GIGANTIC
w_class = WEIGHT_CLASS_NORMAL
default_ammo = /datum/ammo/rocket/coilgun/holder //this doesn't strictly matter since its overridden
max_rounds = 4
loading_sound = 'sound/vehicles/weapons/ltb_reload.ogg'
max_rounds = 1
loading_sound = 'sound/vehicles/weapons/coilgun_cycle.ogg'

/obj/item/ammo_magazine/tank/secondary_flamer_tank
name = "napalm stream tank"
Expand Down
5 changes: 1 addition & 4 deletions code/modules/vehicles/armored/armored_weapons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
///Current loaded magazines: top one empties into ammo
var/list/obj/item/ammo_magazine/ammo_magazine = list()
///maximum magazines ammo_magazine can hold
var/maximum_magazines = 5
var/maximum_magazines = 0
///ammo types we'll be able to accept
var/list/accepted_ammo = list(
/obj/item/ammo_magazine/tank/ltb_cannon,
Expand Down Expand Up @@ -320,7 +320,6 @@
projectile_delay = 2
variance = 5
rearm_time = 1 SECONDS
maximum_magazines = 5
hud_state_empty = "rifle_empty"

/obj/item/armored_weapon/ltaap
Expand All @@ -336,7 +335,6 @@
variance = 5
projectile_delay = 0.1 SECONDS
rearm_time = 3 SECONDS
maximum_magazines = 5
hud_state_empty = "rifle_empty"

/obj/item/armored_weapon/apc_cannon
Expand All @@ -362,7 +360,6 @@
fire_mode = GUN_FIREMODE_AUTOMATIC
variance = 5
rearm_time = 1 SECONDS
maximum_magazines = 5
accepted_ammo = list(
/obj/item/ammo_magazine/tank/secondary_flamer_tank,
)
Expand Down
19 changes: 9 additions & 10 deletions code/modules/vehicles/armored/interiors/breech.dm
Original file line number Diff line number Diff line change
Expand Up @@ -79,29 +79,29 @@
/obj/structure/gun_breech/proc/do_load(mob/living/user, obj/item/armored_weapon/weapon, obj/item/ammo_magazine/mag)
user.temporarilyRemoveItemFromInventory(mag)
mag.forceMove(weapon)
weapon.ammo = mag
weapon.ammo_magazine +=mag
if(weapon.ammo)
return
weapon.reload()
update_appearance(UPDATE_ICON)
user.say(is_secondary ? "Loaded!" : "Up!")
for(var/mob/occupant AS in owner.interior.occupants)
occupant.hud_used.update_ammo_hud(weapon, list(
mag.default_ammo.hud_state,
mag.default_ammo.hud_state_empty),
mag.current_rounds
)

///Unloads the weapon attached to the breech
/obj/structure/gun_breech/proc/do_unload(mob/living/user, obj/item/armored_weapon/weapon)
owner.balloon_alert(user, "breech unloaded")
user.put_in_hands(weapon.ammo)
weapon.ammo.update_appearance()
weapon.ammo = null
weapon.reload()
update_appearance(UPDATE_ICON)

///checks to perform while reloading
/obj/structure/gun_breech/proc/reload_checks(mob/user)
var/obj/item/armored_weapon/weapon = is_secondary ? owner.secondary_weapon : owner.primary_weapon
if(!weapon)
balloon_alert(user, "no weapon")
return FALSE
if(weapon.ammo)
if(weapon.ammo && length(weapon.ammo_magazine) >= weapon.maximum_magazines)
balloon_alert(user, "already loaded")
return FALSE
return TRUE
Expand Down Expand Up @@ -234,7 +234,6 @@
update_gun_appearance(weapon_type)
if(weapon_type.type == /obj/item/armored_weapon/coilgun)
flick("[ammo_overlay.icon_state]_flick", ammo_overlay)
playsound(src, 'sound/vehicles/weapons/coilgun_cycle.ogg', 60, FALSE)

///Updates breech and barrel vis_obj appearance
/obj/structure/gun_breech/som/proc/update_gun_appearance(obj/item/armored_weapon/current_weapon)
Expand All @@ -255,7 +254,7 @@
pixel_x = -12
pixel_y = -32
barrel_overlay.pixel_y = 76
ammo_overlay.icon_state = "[icon_state]_[weapon_type?.ammo?.current_rounds]"
ammo_overlay.icon_state = "[icon_state]_[length(weapon_type?.ammo_magazine) + weapon_type.ammo.current_rounds]"
else if(weapon_type.type == /obj/item/armored_weapon/particle_lance)
pixel_x = -8
pixel_y = -7
Expand Down
3 changes: 2 additions & 1 deletion code/modules/vehicles/armored/som_armored_weapons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@
windup_sound = 'sound/vehicles/weapons/coil_charge.ogg'
windup_delay = 0.6 SECONDS
projectile_delay = 3 SECONDS
maximum_magazines = 3
rearm_time = 0.5 SECONDS
///Power setting of the weapon. Effect the projectile fired
var/power_level = COILGUN_MED_POWER
///Current ammo override to use based on power level
Expand Down Expand Up @@ -241,7 +243,6 @@
projectile_delay = 0.2 SECONDS
variance = 40
rearm_time = 5 SECONDS
maximum_magazines = 0
hud_state_empty = "rocket_empty"

/datum/action/item_action/coilgun_power
Expand Down
Binary file modified icons/obj/items/ammo/tank.dmi
Binary file not shown.

0 comments on commit 69f8f44

Please sign in to comment.