Merge branch 'master' into xenobio-upgrades

This commit is contained in:
FartMaster69420
2022-04-09 12:53:04 -04:00
444 changed files with 247016 additions and 2435 deletions
+25
View File
@@ -91,6 +91,9 @@
power_supply.give(rechargeamt) //... to recharge 1/5th the battery
update_icon()
var/mob/living/M = loc // TGMC Ammo HUD
if(istype(M)) // TGMC Ammo HUD
M?.hud_used.update_ammo_hud(M, src) // TGMC Ammo HUD
else
charge_tick = 0
return 1
@@ -110,6 +113,9 @@
if(!power_supply) return null
if(!ispath(projectile_type)) return null
if(!power_supply.checked_use(charge_cost)) return null
var/mob/living/M = loc // TGMC Ammo HUD
if(istype(M)) // TGMC Ammo HUD
M?.hud_used.update_ammo_hud(M, src)
return new projectile_type(src)
/obj/item/weapon/gun/energy/proc/load_ammo(var/obj/item/C, mob/user)
@@ -131,6 +137,7 @@
playsound(src, 'sound/weapons/flipblade.ogg', 50, 1)
update_icon()
update_held_icon()
user.hud_used.update_ammo_hud(user, src) // TGMC Ammo HUD
else
to_chat(user, "<span class='notice'>This cell is not fitted for [src].</span>")
return
@@ -147,6 +154,7 @@
playsound(src, 'sound/weapons/empty.ogg', 50, 1)
update_icon()
update_held_icon()
user.hud_used.update_ammo_hud(user, src) // TGMC Ammo HUD
else
to_chat(user, "<span class='notice'>[src] does not have a power cell.</span>")
@@ -234,3 +242,20 @@
results += ..()
return results
// TGMC AMMO HUD
/obj/item/weapon/gun/energy/has_ammo_counter()
return TRUE
/obj/item/weapon/gun/energy/get_ammo_type()
if(!projectile_type)
return list("unknown", "unknown")
else
var/obj/item/projectile/P = projectile_type
return list(initial(P.hud_state), initial(P.hud_state_empty))
/obj/item/weapon/gun/energy/get_ammo_count()
if(!power_supply)
return 0
else
return FLOOR(power_supply.charge / max(charge_cost, 1), 1)
@@ -49,8 +49,6 @@
var/obj/item/ammo_casing/microbattery/batt = chambered
charge_left = batt.shots_left
max_charge = initial(batt.shots_left)
if(ammo_magazine) //Crawl to find more
for(var/obj/item/ammo_casing/microbattery/bullet as anything in ammo_magazine.stored_ammo)
if(istype(bullet,batt.type))
@@ -67,6 +65,9 @@
chambered = new_batt
update_charge()
update_icon()
var/mob/living/M = loc // TGMC Ammo HUD
if(istype(M)) // TGMC Ammo HUD
M?.hud_used.update_ammo_hud(M, src)
/obj/item/weapon/gun/projectile/cell_loaded/attack_self(mob/user)
if(!chambered)
@@ -169,6 +170,11 @@
update_icon()
playsound(src, 'sound/weapons/flipblade.ogg', 50, 1)
update_icon()
if(istype(loc, /obj/item/weapon/gun/projectile/cell_loaded)) // Update the HUD if we're in a gun + have a user. Not that one should be able to reload the mag while it's in a gun, but just in caaaaase.
var/obj/item/weapon/gun/projectile/cell_loaded/cell_load = loc
var/mob/living/M = cell_load.loc
if(istype(M))
M?.hud_used.update_ammo_hud(M, cell_load)
/obj/item/ammo_magazine/cell_mag/update_icon()
cut_overlays()
@@ -277,4 +283,31 @@
new /obj/item/ammo_casing/microbattery/combat/xray(src)
new /obj/item/ammo_casing/microbattery/medical/stabilize2(src)
new /obj/item/ammo_casing/microbattery/medical/haste(src)
new /obj/item/ammo_casing/microbattery/medical/resist(src)
new /obj/item/ammo_casing/microbattery/medical/resist(src)
// TGMC Ammo HUD: Custom handling for cell-loaded weaponry.
/*
/obj/item/weapon/gun/projectile/cell_loaded/get_ammo_type()
if(!projectile_type)
return list("unknown", "unknown")
else
var/obj/item/projectile/P = projectile_type
return list(initial(P.hud_state), initial(P.hud_state_empty))
*/
/obj/item/weapon/gun/projectile/cell_loaded/get_ammo_count()
if(!chambered)
return 0 // We're not chambered, so we have 0 rounds loaded.
var/obj/item/ammo_casing/microbattery/batt = chambered
var/shots
if(ammo_magazine) // Check how much ammo we have
for(var/obj/item/ammo_casing/microbattery/bullet as anything in ammo_magazine.stored_ammo)
if(istype(bullet,batt.type))
shots += bullet.shots_left
if(shots > 0) // We have shots ready to fire.
return shots
else // We're out of shots.
return 0
else // Else, we're unloaded/don't have a magazine.
return 0
@@ -13,6 +13,7 @@
damage = 0
check_armour = "laser"
light_color = "#80F5FF"
hud_state = "laser_disabler"
combustion = FALSE
@@ -57,4 +57,16 @@
/obj/item/weapon/gun/projectile/multi_cannon/unload_ammo(mob/user, var/allow_dump=1)
.=..()
update_icon()
chambered = null
chambered = null
/obj/item/weapon/gun/projectile/multi_cannon/get_ammo_count() // Custom handling for the Curabitur.
if(istype(chambered, /obj/item/ammo_casing/macrobattery))
var/obj/item/ammo_casing/macrobattery/battery = chambered
if(battery.charge) // Does the battery have charge?
return battery.charge // This should safely return the amount of shots we have. Every time we fire, we decrement charge by 1, at least in all the cells I can see.
else // No charge in the battery.
return 0 // Return 0 ammo to the HUD.
else if(chambered == null)
return 0
else
CRASH("/obj/item/weapon/gun/projectile/multi_cannon/get_ammo_count() was called from [src] but did not have a valid magazine loaded, somehow! Chambered is currently [chambered].")
@@ -38,6 +38,12 @@
//alright, the below seems jank. it IS jank, but for whatever reason I can't reuse BB. big bad
BB = null
BB = new projectile_type
// TGMC Ammo HUD - Update the HUD every time we expend/fire, given the Curabitur's method of handling firing.
if(istype(loc, /obj/item/weapon/gun/projectile/multi_cannon))
var/obj/item/weapon/gun/projectile/multi_cannon = loc
var/mob/living/user = multi_cannon.loc
if(istype(user))
user?.hud_used.update_ammo_hud(user, multi_cannon)
return
else
BB = null
@@ -52,6 +58,13 @@
STOP_PROCESSING(SSobj, src)
if(istype(loc,/obj/item/weapon/gun/projectile/multi_cannon))
loc.update_icon()
// TGMC Ammo HUD - Update the HUD every time we're called to recharge.
if(istype(loc, /obj/item/weapon/gun/projectile/multi_cannon))
var/obj/item/weapon/gun/projectile/multi_cannon = loc
var/mob/living/user = multi_cannon.loc
if(istype(user))
user?.hud_used.update_ammo_hud(user, multi_cannon)
//variants here, there's not many of them.
@@ -184,11 +184,13 @@
if(!do_after(user, 10, src))
break
playsound(src,'sound/items/change_drill.ogg',25,1)
user.hud_used.update_ammo_hud(user, src)
if(power_supply.give(phase_power) < phase_power)
break
recharging = 0
update_icon()
user.hud_used.update_ammo_hud(user, src) // Update one last time once we're finished!
/obj/item/weapon/gun/energy/locked/frontier/update_icon()
if(recharging)
@@ -54,6 +54,10 @@
chambered = ammo_magazine.stored_ammo[ammo_magazine.stored_ammo.len]
if(handle_casings != HOLD_CASINGS)
ammo_magazine.stored_ammo -= chambered
var/mob/living/M = loc // TGMC Ammo HUD
if(istype(M)) // TGMC Ammo HUD
M?.hud_used.update_ammo_hud(M, src)
if (chambered)
return chambered.BB
@@ -98,6 +102,10 @@
if(handle_casings != HOLD_CASINGS)
chambered = null
var/mob/living/M = loc // TGMC Ammo HUD
if(istype(M)) // TGMC Ammo HUD
M?.hud_used.update_ammo_hud(M, src)
//Attempts to load A into src, depending on the type of thing being loaded and the load_method
@@ -117,6 +125,7 @@
AM.loc = src
ammo_magazine = AM
user.visible_message("[user] inserts [AM] into [src].", "<span class='notice'>You insert [AM] into [src].</span>")
user.hud_used.update_ammo_hud(user, src)
playsound(src, 'sound/weapons/flipblade.ogg', 50, 1)
if(SPEEDLOADER)
if(loaded.len >= max_shells)
@@ -131,8 +140,10 @@
loaded += C
AM.stored_ammo -= C //should probably go inside an ammo_magazine proc, but I guess less proc calls this way...
count++
user.hud_used.update_ammo_hud(user, src)
if(count)
user.visible_message("[user] reloads [src].", "<span class='notice'>You load [count] round\s into [src].</span>")
user.hud_used.update_ammo_hud(user, src)
playsound(src, 'sound/weapons/empty.ogg', 50, 1)
AM.update_icon()
else if(istype(A, /obj/item/ammo_casing))
@@ -168,6 +179,7 @@
sleep(1 SECOND)
update_icon()
user.hud_used.update_ammo_hud(user, src)
//attempts to unload src. If allow_dump is set to 0, the speedloader unloading method will be disabled
/obj/item/weapon/gun/projectile/proc/unload_ammo(mob/user, var/allow_dump=1)
@@ -177,6 +189,7 @@
playsound(src, 'sound/weapons/empty.ogg', 50, 1)
ammo_magazine.update_icon()
ammo_magazine = null
user.hud_used.update_ammo_hud(user, src)
else if(loaded.len)
//presumably, if it can be speed-loaded, it can be speed-unloaded.
if(allow_dump && (load_method & SPEEDLOADER))
@@ -195,9 +208,11 @@
user.put_in_hands(C)
user.visible_message("[user] removes \a [C] from [src].", "<span class='notice'>You remove \a [C] from [src].</span>")
playsound(src, 'sound/weapons/empty.ogg', 50, 1)
user.hud_used.update_ammo_hud(user, src)
else
to_chat(user, "<span class='warning'>[src] is empty.</span>")
update_icon()
user.hud_used.update_ammo_hud(user, src)
/obj/item/weapon/gun/projectile/attackby(var/obj/item/A as obj, mob/user as mob)
..()
@@ -228,6 +243,7 @@
ammo_magazine.update_icon()
ammo_magazine = null
update_icon() //make sure to do this after unsetting ammo_magazine
user.hud_used.update_ammo_hud(user, src)
/obj/item/weapon/gun/projectile/examine(mob/user)
. = ..()
@@ -256,3 +272,72 @@
unload_ammo(usr)
*/
// TGMC Ammo HUD Insertion
/obj/item/weapon/gun/projectile/has_ammo_counter()
return TRUE
/obj/item/weapon/gun/projectile/get_ammo_type()
if(load_method & MAGAZINE)
if(chambered) // Do we have an ammo casing chambered
var/obj/item/ammo_casing/A = chambered
var/obj/item/projectile/P = A.projectile_type
return list(initial(P.hud_state), initial(P.hud_state_empty))
else if(ammo_magazine && ammo_magazine.stored_ammo.len) // Do we have a mag, and have ammo in the mag, but nothing chambered?
var/obj/item/ammo_casing/A = ammo_magazine.stored_ammo[1]
var/obj/item/projectile/P = A.projectile_type
return list(initial(P.hud_state), initial(P.hud_state_empty))
else if(src.projectile_type) // Else, we're entirely empty, and irregardless of the mag we have loaded (as it's empty, or it would've passed the length check above), return the DEFAULT projectile_type on the gun, if set.
var/obj/item/projectile/P = src.projectile_type
return list(initial(P.hud_state), initial(P.hud_state_empty))
else
return list("unknown", "unknown") // Safety, this shouldn't happen, but just in case
else if(load_method & (SINGLE_CASING|SPEEDLOADER)) // Do we load with single casings OR speedloaders?
if(chambered) // Do we have an ammo casing loaded in the chamber? All casings still have a projectile_type var.
var/obj/item/ammo_casing/A = chambered
var/obj/item/projectile/P = A.projectile_type
return list(initial(P.hud_state), initial(P.hud_state_empty)) // Return the casing's projectile_type ammo hud state
else if(loaded.len) // Else, is the gun loaded, but no ammo casings in chamber currently?
var/obj/item/ammo_casing/A = loaded[1]
var/obj/item/projectile/P = A.projectile_type
return list(initial(P.hud_state), initial(P.hud_state_empty)) // Return the ammunition loaded in the gun's hud_state
else if(src.projectile_type) // Else, we're entirely empty, and have nothing loaded in the gun, and nothing in the chamber. Return the DEFAULT projectile_type on the gun, if set.
var/obj/item/projectile/P = src.projectile_type
return list(initial(P.hud_state), initial(P.hud_state_empty))
else
return list("unknown", "unknown") // Safety, this shouldn't happen, but just in case
else if(src.projectile_type) // Failsafe if we somehow don't pass the above. Return the DEFAULT projectile_type on the gun, if set.
var/obj/item/projectile/P = src.projectile_type
return list(initial(P.hud_state), initial(P.hud_state_empty))
else // Failsafe if we somehow fail all three methods
return list("unknown", "unknown")
/obj/item/weapon/gun/projectile/get_ammo_count()
if(ammo_magazine) // Do we have a magazine loaded?
var/shots_left
if(chambered && chambered.BB) // Do we have a bullet in the currently-chambered casing, if any?
shots_left++
for(var/obj/item/ammo_casing/bullet in ammo_magazine.stored_ammo)
if(bullet.BB)
shots_left++
if(shots_left > 0)
return shots_left
else
return 0 // No ammo left or failsafe.
else if(loaded) // Do we use internal ammunition
var/shots_left
if(chambered && chambered.BB) // Do we have a bullet in the currently-chambered casing, if any?
shots_left++
for(var/obj/item/ammo_casing/bullet in loaded)
if(bullet.BB) // Only increment how many shots we have left if we're loaded.
shots_left++
if(shots_left > 0)
return shots_left
else
return 0 // No ammo left or failsafe.
else if(chambered) // If we don't have a magazine or internal ammunition loaded, but we have a casing in chamber, return the amount.
return chambered.BB ? 1 : 0
else // Failsafe, or completely unloaded
return 0
@@ -1,6 +1,7 @@
/*
* Shotgun
*/
/obj/item/weapon/gun/projectile/shotgun/pump
name = "shotgun"
desc = "The mass-produced MarsTech Meteor 29 shotgun is a favourite of police and security forces on many worlds. Uses 12g rounds."
@@ -43,12 +44,14 @@
else
chambered.loc = get_turf(src) // Eject casing
chambered = null
M.hud_used.update_ammo_hud(M, src) // TGMC Ammo HUD Port
// Load next shell
if(loaded.len)
var/obj/item/ammo_casing/AC = loaded[1] // Load next casing.
loaded -= AC // Remove casing from loaded list.
chambered = AC
M.hud_used.update_ammo_hud(M, src) // TGMC Ammo HUD Port
if(pump_animation) // This affects all bolt action and shotguns.
flick("[pump_animation]", src) // This plays any pumping
@@ -180,6 +183,7 @@
burst = 2
user.visible_message("<span class='danger'>The shotgun goes off!</span>", "<span class='danger'>The shotgun goes off in your face!</span>")
Fire_userless(user)
user.hud_used.update_ammo_hud(user, src) // TGMC Ammo HUD Port
burst = burstsetting
return
if(do_after(user, 30)) // SHIT IS STEALTHY EYYYYY