diff --git a/code/modules/projectiles/guns/magnetic/bore.dm b/code/modules/projectiles/guns/magnetic/bore.dm index 0c51d392a4..99ac3bda14 100644 --- a/code/modules/projectiles/guns/magnetic/bore.dm +++ b/code/modules/projectiles/guns/magnetic/bore.dm @@ -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) + . += "The installed [manipulator.name] consumes [mat_cost] units of [ammo_material] per shot." + else + . += "The \"manipulator missing\" indicator is lit. [src] consumes [mat_cost] units of [ammo_material] per shot." /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("It has [mat_storage] out of [max_mat_storage] units of [ammo_material] loaded.") + return "It has [mat_storage] out of [max_mat_storage] units of [ammo_material] loaded." + else + return "It\'s out of [ammo_material]!" + /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("\The [user] slots \the [manipulator] into \the [src].") 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,20 @@ if(mat_storage + SHEET_MATERIAL_AMOUNT > max_mat_storage) to_chat(user, "\The [src] cannot hold more [ammo_material].") return - - var/can_hold_val = 0 loading = TRUE +<<<<<<< HEAD while(can_hold_val < M.amount && mat_storage + SHEET_MATERIAL_AMOUNT <= max_mat_storage && do_after(user,1.5 SECONDS)) //CHOMPEdit can_hold_val ++ +||||||| parent of fb4cee4e88... Merge pull request #10399 from VOREStation/upstream-merge-8094 + while(mat_storage + SHEET_MATERIAL_AMOUNT <= max_mat_storage && do_after(user,1.5 SECONDS)) + can_hold_val ++ +======= + while(mat_storage + SHEET_MATERIAL_AMOUNT <= max_mat_storage && do_after(user,1.5 SECONDS)) +>>>>>>> fb4cee4e88... Merge pull request #10399 from VOREStation/upstream-merge-8094 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 +149,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("\The [user] loads \the [src] with \the [M].") - playsound(src, 'sound/weapons/flipblade.ogg', 50, 1) + success = TRUE + if(success) + user.visible_message("\The [user] loads \the [src] with \the [M].") + playsound(src, 'sound/weapons/flipblade.ogg', 50, 1) update_icon() return - . = ..() #define GEN_STARTING -1 @@ -167,6 +186,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) + . += "A display on the side slowly scrolls the text \"BLAST EFFICIENCY [rating_modifier]\"." + else // rating_mod 0 = something's not right + . += "A display on the side slowly scrolls the text \"ERR: MISSING COMPONENT - EFFICIENCY MODIFICATION INCOMPLETE\"." + /obj/item/weapon/gun/magnetic/matfed/phoronbore/Initialize() . = ..() soundloop = new(list(src), 0) diff --git a/code/modules/projectiles/projectile/magnetic.dm b/code/modules/projectiles/projectile/magnetic.dm index 0293ea1383..2a96471215 100644 --- a/code/modules/projectiles/projectile/magnetic.dm +++ b/code/modules/projectiles/projectile/magnetic.dm @@ -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