mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Merge pull request #2013 from CHOMPStationBot/upstream-merge-10399
[MIRROR] [MIRROR] phoron bore stock parts now affect range, along with other bits
This commit is contained in:
@@ -6,14 +6,22 @@
|
||||
var/mat_cost = 500 // How much material is used per-shot?
|
||||
var/ammo_material
|
||||
var/obj/item/weapon/stock_parts/manipulator/manipulator // Installed manipulator. Mostly for Phoron Bore, higher rating == less mats consumed upon firing. Set to a path to spawn with one of that type.
|
||||
var/rating_modifier = 0 // rating of installed capacitor + manipulator
|
||||
var/loading = FALSE
|
||||
|
||||
/obj/item/weapon/gun/magnetic/matfed/proc/update_rating_mod()
|
||||
if(capacitor && manipulator)
|
||||
rating_modifier = capacitor.get_rating() + manipulator.get_rating()
|
||||
else
|
||||
rating_modifier = FALSE
|
||||
|
||||
/obj/item/weapon/gun/magnetic/matfed/Initialize()
|
||||
. = ..()
|
||||
if(ispath(manipulator))
|
||||
manipulator = new manipulator(src)
|
||||
if(manipulator)
|
||||
mat_cost = initial(mat_cost) / (2*manipulator.rating)
|
||||
update_rating_mod()
|
||||
|
||||
/obj/item/weapon/gun/magnetic/matfed/Destroy()
|
||||
QDEL_NULL(manipulator)
|
||||
@@ -21,9 +29,10 @@
|
||||
|
||||
/obj/item/weapon/gun/magnetic/matfed/examine(mob/user)
|
||||
. = ..()
|
||||
var/ammotext = show_ammo()
|
||||
if(ammotext)
|
||||
. += ammotext
|
||||
if(manipulator)
|
||||
. += "<span class='notice'>The installed [manipulator.name] consumes [mat_cost] units of [ammo_material] per shot.</span>"
|
||||
else
|
||||
. += "<span class='notice'>The \"manipulator missing\" indicator is lit. [src] consumes [mat_cost] units of [ammo_material] per shot.</span>"
|
||||
|
||||
/obj/item/weapon/gun/magnetic/matfed/update_icon()
|
||||
var/list/overlays_to_add = list()
|
||||
@@ -70,7 +79,10 @@
|
||||
|
||||
/obj/item/weapon/gun/magnetic/matfed/show_ammo()
|
||||
if(mat_storage)
|
||||
return list("<span class='notice'>It has [mat_storage] out of [max_mat_storage] units of [ammo_material] loaded.</span>")
|
||||
return "<span class='notice'>It has [mat_storage] out of [max_mat_storage] units of [ammo_material] loaded.</span>"
|
||||
else
|
||||
return "<span class='warning'>It\'s out of [ammo_material]!</span>"
|
||||
|
||||
|
||||
/obj/item/weapon/gun/magnetic/matfed/attackby(var/obj/item/thing, var/mob/user)
|
||||
if(removable_components)
|
||||
@@ -84,6 +96,7 @@
|
||||
mat_cost = initial(mat_cost)
|
||||
manipulator = null
|
||||
update_icon()
|
||||
update_rating_mod()
|
||||
return
|
||||
|
||||
if(istype(thing, /obj/item/weapon/stock_parts/manipulator))
|
||||
@@ -96,12 +109,13 @@
|
||||
mat_cost = initial(mat_cost) / (2*manipulator.rating)
|
||||
user.visible_message("<span class='notice'>\The [user] slots \the [manipulator] into \the [src].</span>")
|
||||
update_icon()
|
||||
update_rating_mod()
|
||||
return
|
||||
|
||||
|
||||
if(is_type_in_list(thing, load_type))
|
||||
var/obj/item/stack/material/M = thing
|
||||
|
||||
var/success = FALSE
|
||||
if(istype(M)) //stack
|
||||
if(!M.material || M.material.name != ammo_material || loading)
|
||||
return
|
||||
@@ -109,14 +123,12 @@
|
||||
if(mat_storage + SHEET_MATERIAL_AMOUNT > max_mat_storage)
|
||||
to_chat(user, "<span class='warning'>\The [src] cannot hold more [ammo_material].</span>")
|
||||
return
|
||||
|
||||
var/can_hold_val = 0
|
||||
loading = TRUE
|
||||
while(can_hold_val < M.amount && mat_storage + SHEET_MATERIAL_AMOUNT <= max_mat_storage && do_after(user,1.5 SECONDS)) //CHOMPEdit
|
||||
can_hold_val ++
|
||||
while(mat_storage + SHEET_MATERIAL_AMOUNT <= max_mat_storage && do_after(user,1.5 SECONDS))
|
||||
mat_storage += SHEET_MATERIAL_AMOUNT
|
||||
playsound(src, 'sound/effects/phasein.ogg', 15, 1)
|
||||
M.use(can_hold_val)
|
||||
M.use(1)
|
||||
success = TRUE
|
||||
loading = FALSE
|
||||
|
||||
else //ore
|
||||
@@ -129,13 +141,12 @@
|
||||
|
||||
qdel(M)
|
||||
mat_storage += (SHEET_MATERIAL_AMOUNT/2*0.8) //two plasma ores needed per sheet, some inefficiency for not using refined product
|
||||
|
||||
|
||||
user.visible_message("<span class='notice'>\The [user] loads \the [src] with \the [M].</span>")
|
||||
playsound(src, 'sound/weapons/flipblade.ogg', 50, 1)
|
||||
success = TRUE
|
||||
if(success)
|
||||
user.visible_message("<span class='notice'>\The [user] loads \the [src] with \the [M].</span>")
|
||||
playsound(src, 'sound/weapons/flipblade.ogg', 50, 1)
|
||||
update_icon()
|
||||
return
|
||||
|
||||
. = ..()
|
||||
|
||||
#define GEN_STARTING -1
|
||||
@@ -167,6 +178,23 @@
|
||||
var/datum/looping_sound/small_motor/soundloop
|
||||
var/time_started //to keep the soundloop from being "stopped" too soon and playing indefinitely
|
||||
|
||||
/obj/item/weapon/gun/magnetic/matfed/phoronbore/consume_next_projectile()
|
||||
if(!check_ammo() || !capacitor || capacitor.charge < power_cost)
|
||||
return
|
||||
|
||||
use_ammo()
|
||||
capacitor.use(power_cost)
|
||||
update_icon()
|
||||
|
||||
return new projectile_type(src, rating_modifier)
|
||||
|
||||
/obj/item/weapon/gun/magnetic/matfed/phoronbore/examine(mob/user)
|
||||
. = ..()
|
||||
if(rating_modifier)
|
||||
. += "<span class='notice'>A display on the side slowly scrolls the text \"BLAST EFFICIENCY [rating_modifier]\".</span>"
|
||||
else // rating_mod 0 = something's not right
|
||||
. += "<span class='warning'>A display on the side slowly scrolls the text \"ERR: MISSING COMPONENT - EFFICIENCY MODIFICATION INCOMPLETE\".</span>"
|
||||
|
||||
/obj/item/weapon/gun/magnetic/matfed/phoronbore/Initialize()
|
||||
. = ..()
|
||||
soundloop = new(list(src), 0)
|
||||
|
||||
@@ -162,6 +162,10 @@
|
||||
irradiate = 20
|
||||
range = 6
|
||||
|
||||
/obj/item/projectile/bullet/magnetic/bore/Initialize(loc, range_mod) // i'm gonna be real honest i dunno how this works but it does
|
||||
. = ..()
|
||||
range += range_mod
|
||||
|
||||
/obj/item/projectile/bullet/magnetic/bore/get_structure_damage()
|
||||
return damage * 3 //made for boring holes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user