diff --git a/code/datums/looping_sounds/item_sounds.dm b/code/datums/looping_sounds/item_sounds.dm
index 4619acd3b5..855f4c5213 100644
--- a/code/datums/looping_sounds/item_sounds.dm
+++ b/code/datums/looping_sounds/item_sounds.dm
@@ -27,3 +27,19 @@
/datum/looping_sound/geiger/stop()
. = ..()
last_radiation = 0
+
+/datum/looping_sound/small_motor
+ start_sound = 'sound/items/small_motor/motor_start_nopull.ogg'
+ start_length = 2 SECONDS
+ mid_sounds = list(
+ 'sound/items/small_motor/motor_idle.ogg',
+ 'sound/items/small_motor/motor_fast.ogg',
+ 'sound/items/small_motor/motor_faster.ogg'
+ )
+ mid_length = 1.9 SECONDS //someone make this loop better please, i'm no good at sound. the clips should be 2 seconds exact but there's a gap if it's set to 2
+ end_sound = 'sound/items/small_motor/motor_end.ogg'
+ var/speed = 1
+
+/datum/looping_sound/small_motor/get_sound(starttime)
+ speed = clamp(speed, 1, 3)
+ return ..(starttime, mid_sounds[speed])
\ No newline at end of file
diff --git a/code/modules/mining/ore_redemption_machine/equipment_vendor.dm b/code/modules/mining/ore_redemption_machine/equipment_vendor.dm
index 32f97919fd..393f97c30b 100644
--- a/code/modules/mining/ore_redemption_machine/equipment_vendor.dm
+++ b/code/modules/mining/ore_redemption_machine/equipment_vendor.dm
@@ -39,7 +39,7 @@
new /datum/data/mining_equipment("Industrial Hardsuit - Maneuvering Jets", /obj/item/rig_module/maneuvering_jets, 1250),
new /datum/data/mining_equipment("Hardsuit - Intelligence Storage", /obj/item/rig_module/ai_container, 2500),
new /datum/data/mining_equipment("Hardsuit - Smoke Bomb Deployer", /obj/item/rig_module/grenade_launcher/smoke, 2000),
- new /datum/data/mining_equipment("Industrial Equipment - Phoron Bore", /obj/item/weapon/gun/magnetic/matfed, 3000),
+ new /datum/data/mining_equipment("Industrial Equipment - Phoron Bore", /obj/item/weapon/gun/magnetic/matfed/phoronbore/loaded, 3000),
new /datum/data/mining_equipment("Industrial Equipment - Sheet-Snatcher",/obj/item/weapon/storage/bag/sheetsnatcher, 500), new /datum/data/mining_equipment("Digital Tablet - Standard", /obj/item/modular_computer/tablet/preset/custom_loadout/standard, 500),
new /datum/data/mining_equipment("Digital Tablet - Advanced", /obj/item/modular_computer/tablet/preset/custom_loadout/advanced, 1000),
new /datum/data/mining_equipment("Fine Excavation Kit - Chisels",/obj/item/weapon/storage/excavation, 500),
diff --git a/code/modules/mining/ore_redemption_machine/survey_vendor.dm b/code/modules/mining/ore_redemption_machine/survey_vendor.dm
index 5e6009c4cf..b49dbe2c0e 100644
--- a/code/modules/mining/ore_redemption_machine/survey_vendor.dm
+++ b/code/modules/mining/ore_redemption_machine/survey_vendor.dm
@@ -25,7 +25,7 @@
new /datum/data/mining_equipment("Fishing Net", /obj/item/weapon/material/fishing_net, 50),
new /datum/data/mining_equipment("Titanium Fishing Rod", /obj/item/weapon/material/fishing_rod/modern, 50),
new /datum/data/mining_equipment("Direct Payment - 1000", /obj/item/weapon/spacecash/c1000, 500),
- new /datum/data/mining_equipment("Industrial Equipment - Phoron Bore", /obj/item/weapon/gun/magnetic/matfed, 500),
+ new /datum/data/mining_equipment("Industrial Equipment - Phoron Bore", /obj/item/weapon/gun/magnetic/matfed/phoronbore/loaded, 500),
new /datum/data/mining_equipment("Survey Tools - Shovel", /obj/item/weapon/shovel, 20),
new /datum/data/mining_equipment("Survey Tools - Mechanical Trap", /obj/item/weapon/beartrap, 30),
new /datum/data/mining_equipment("Digital Tablet - Standard", /obj/item/modular_computer/tablet/preset/custom_loadout/standard, 100),
diff --git a/code/modules/projectiles/guns/magnetic/bore.dm b/code/modules/projectiles/guns/magnetic/bore.dm
index 0594e2abb3..d70439a440 100644
--- a/code/modules/projectiles/guns/magnetic/bore.dm
+++ b/code/modules/projectiles/guns/magnetic/bore.dm
@@ -1,27 +1,24 @@
/obj/item/weapon/gun/magnetic/matfed
- name = "portable phoron bore"
- desc = "A large man-portable tunnel bore, using phorogenic plasma blasts. Point away from user."
- description_fluff = "An aging Grayson Manufactories mining tool used for rapidly digging through rock. Mass production was discontinued when many of the devices were stolen and used to break into a high security facility by Boiling Point drones."
- description_antag = "This device is exceptional at breaking down walls, though it is incredibly loud when doing so."
- description_info = "The projectile of this tool will travel six tiles before dissipating, excavating mineral walls as it does so. It can be reloaded with phoron sheets."
-
- icon_state = "bore"
- item_state = "bore"
- wielded_item_state = "bore-wielded"
- one_handed_penalty = 5
-
- projectile_type = /obj/item/projectile/bullet/magnetic/bore
-
- gun_unreliable = 0
-
power_cost = 750
- load_type = /obj/item/stack/material
+ load_type = list(/obj/item/stack/material, /obj/item/weapon/ore)
var/mat_storage = 0 // How much material is stored inside? Input in multiples of 2000 as per auto/protolathe.
var/max_mat_storage = 8000 // How much material can be stored inside?
var/mat_cost = 500 // How much material is used per-shot?
- var/ammo_material = MAT_PHORON
+ 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/loading = 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)
+
+/obj/item/weapon/gun/magnetic/matfed/Destroy()
+ QDEL_NULL(manipulator)
+ . = ..()
+
/obj/item/weapon/gun/magnetic/matfed/examine(mob/user)
. = ..()
var/ammotext = show_ammo()
@@ -46,6 +43,7 @@
overlays = overlays_to_add
..()
+
/obj/item/weapon/gun/magnetic/matfed/attack_hand(var/mob/user) // It doesn't keep a loaded item inside.
if(user.get_inactive_hand() == src)
var/obj/item/removing
@@ -55,7 +53,6 @@
cell = null
if(removing)
- removing.forceMove(get_turf(src))
user.put_in_hands(removing)
user.visible_message("\The [user] removes \the [removing] from \the [src].")
playsound(src, 'sound/machines/click.ogg', 10, 1)
@@ -77,91 +74,170 @@
/obj/item/weapon/gun/magnetic/matfed/attackby(var/obj/item/thing, var/mob/user)
if(removable_components)
- if(istype(thing, /obj/item/weapon/cell))
- if(cell)
- to_chat(user, "\The [src] already has \a [cell] installed.")
- return
- cell = thing
- user.drop_from_inventory(cell)
- cell.forceMove(src)
- playsound(src, 'sound/machines/click.ogg', 10, 1)
- user.visible_message("\The [user] slots \the [cell] into \the [src].")
- update_icon()
- return
if(thing.is_crowbar())
if(!manipulator)
to_chat(user, "\The [src] has no manipulator installed.")
return
- manipulator.forceMove(get_turf(src))
user.put_in_hands(manipulator)
user.visible_message("\The [user] levers \the [manipulator] from \the [src].")
- playsound(src, 'sound/items/Crowbar.ogg', 50, 1)
+ playsound(src, thing.usesound, 50, 1)
+ mat_cost = initial(mat_cost)
manipulator = null
update_icon()
return
- if(thing.is_screwdriver())
- if(!capacitor)
- to_chat(user, "\The [src] has no capacitor installed.")
- return
- capacitor.forceMove(get_turf(src))
- user.put_in_hands(capacitor)
- user.visible_message("\The [user] unscrews \the [capacitor] from \the [src].")
- playsound(src, 'sound/items/Screwdriver.ogg', 50, 1)
- capacitor = null
- update_icon()
- return
-
- if(istype(thing, /obj/item/weapon/stock_parts/capacitor))
- if(capacitor)
- to_chat(user, "\The [src] already has \a [capacitor] installed.")
- return
- capacitor = thing
- user.drop_from_inventory(capacitor)
- capacitor.forceMove(src)
- playsound(src, 'sound/machines/click.ogg', 10, 1)
- power_per_tick = (power_cost*0.15) * capacitor.rating
- user.visible_message("\The [user] slots \the [capacitor] into \the [src].")
- update_icon()
- return
if(istype(thing, /obj/item/weapon/stock_parts/manipulator))
if(manipulator)
to_chat(user, "\The [src] already has \a [manipulator] installed.")
return
manipulator = thing
- user.drop_from_inventory(manipulator)
- manipulator.forceMove(src)
+ user.drop_from_inventory(manipulator, src)
playsound(src, 'sound/machines/click.ogg', 10,1)
- mat_cost = initial(mat_cost) % (2*manipulator.rating)
+ mat_cost = initial(mat_cost) / (2*manipulator.rating)
user.visible_message("\The [user] slots \the [manipulator] into \the [src].")
update_icon()
return
- if(istype(thing, load_type))
- loading = TRUE
+ if(is_type_in_list(thing, load_type))
var/obj/item/stack/material/M = thing
- if(!M.material || M.material.name != ammo_material)
- return
+ if(istype(M)) //stack
+ if(!M.material || M.material.name != ammo_material || loading)
+ return
- if(mat_storage + 2000 > max_mat_storage)
- to_chat(user, "\The [src] cannot hold more [ammo_material].")
- return
+ 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
- while(can_hold_val < round(max_mat_storage / 2000))
- if(mat_storage + 2000 <= max_mat_storage && do_after(user,1.5 SECONDS))
+ var/can_hold_val = 0
+ loading = TRUE
+ while(mat_storage + SHEET_MATERIAL_AMOUNT <= max_mat_storage && do_after(user,1.5 SECONDS))
can_hold_val ++
- mat_storage += 2000
+ mat_storage += SHEET_MATERIAL_AMOUNT
playsound(src, 'sound/effects/phasein.ogg', 15, 1)
- else
- loading = FALSE
- break
- M.use(can_hold_val)
+ M.use(can_hold_val)
+ loading = FALSE
+
+ else //ore
+ if(M.material != ammo_material)
+ return
+
+ if(mat_storage + (SHEET_MATERIAL_AMOUNT/2*0.8) > max_mat_storage)
+ to_chat(user, "\The [src] cannot hold more [ammo_material].")
+ return
+
+ 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)
update_icon()
return
+
. = ..()
+
+#define GEN_STARTING -1
+#define GEN_OFF 0
+#define GEN_IDLE 1
+#define GEN_ACTIVE 2
+
+/obj/item/weapon/gun/magnetic/matfed/phoronbore
+ name = "portable phoron bore"
+ desc = "A large man-portable tunnel bore, using phorogenic plasma blasts. Point away from user."
+ description_fluff = "An aging Grayson Manufactories mining tool used for rapidly digging through rock. Mass production was discontinued when many of the devices were stolen and used to break into a high security facility by Boiling Point drones."
+ description_antag = "This device is exceptional at breaking down walls, though it is incredibly loud when doing so."
+ description_info = "The projectile of this tool will travel six tiles before dissipating, excavating mineral walls as it does so. It can be reloaded with phoron sheets or ore, and has a togglable generator that can recharge the power cell using stored phoron."
+
+ icon_state = "bore"
+ item_state = "bore"
+ wielded_item_state = "bore-wielded"
+ one_handed_penalty = 5
+
+ projectile_type = /obj/item/projectile/bullet/magnetic/bore
+
+ gun_unreliable = 0
+ power_cost = 100
+ ammo_material = MAT_PHORON
+
+ action_button_name = "Toggle internal generator"
+
+ var/generator_state = GEN_OFF
+ 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/Initialize()
+ . = ..()
+ soundloop = new(list(src), 0)
+
+/obj/item/weapon/gun/magnetic/matfed/phoronbore/Destroy()
+ QDEL_NULL(soundloop)
+ . = ..()
+
+/obj/item/weapon/gun/magnetic/matfed/phoronbore/ui_action_click()
+ toggle_generator(usr)
+
+/obj/item/weapon/gun/magnetic/matfed/phoronbore/process()
+ if(generator_state && !mat_storage)
+ audible_message(SPAN_NOTICE("\The [src] goes quiet."),SPAN_NOTICE("A motor noise cuts out."))
+ soundloop.stop()
+ generator_state = GEN_OFF
+
+ else if(generator_state > GEN_OFF)
+ if(generator_state == GEN_IDLE && (cell?.percent() < 80 || (!cell && capacitor && capacitor.charge/capacitor.max_charge < 0.8)))
+ generator_state = GEN_ACTIVE
+ else if(generator_state == GEN_ACTIVE && (!cell || cell.fully_charged()) && (!capacitor || capacitor.charge == capacitor.max_charge))
+ generator_state = GEN_IDLE
+ soundloop.speed = generator_state
+ generator_generate()
+
+ if(capacitor)
+ if(cell)
+ if(capacitor.charge < capacitor.max_charge && cell.checked_use(power_per_tick))
+ capacitor.charge(power_per_tick)
+ else if(!generator_state)
+ capacitor.use(capacitor.charge * 0.05)
+
+ update_state()
+
+/obj/item/weapon/gun/magnetic/matfed/phoronbore/proc/generator_generate()
+ var/fuel_used = generator_state == GEN_IDLE ? 5 : 25
+ var/power_made = fuel_used * 800 * CELLRATE //20kW when active, same power as a pacman on setting one, but less efficient because compact and portable
+ if(cell)
+ cell.give(power_made)
+ else if(capacitor)
+ capacitor.charge(power_made)
+ mat_storage = max(mat_storage - fuel_used, 0)
+ var/turf/T = get_turf(src)
+ if(T)
+ T.assume_gas("carbon_dioxide", fuel_used * 0.01, T0C+200)
+
+/obj/item/weapon/gun/magnetic/matfed/phoronbore/proc/toggle_generator(mob/living/user)
+ if(!generator_state && !mat_storage)
+ to_chat(user, SPAN_NOTICE("\The [src] has no fuel!"))
+ return
+
+ else if(!generator_state)
+ generator_state = GEN_STARTING
+ var/pull = (!cell || cell.charge < 100) ? rand(1,4) : 0
+ while(pull)
+ playsound(src, 'sound/items/small_motor/motor_pull_attempt.ogg', 100)
+ if(!do_after(user, 2 SECONDS, src))
+ generator_state = GEN_OFF
+ return
+ pull--
+ soundloop.start()
+ time_started = world.time
+ cell?.use(100)
+ audible_message(SPAN_NOTICE("\The [src] starts chugging."),SPAN_NOTICE("A motor noise starts up."))
+ generator_state = GEN_IDLE
+
+ else if(generator_state > GEN_OFF && time_started + 3 SECONDS < world.time)
+ soundloop.stop()
+ audible_message(SPAN_NOTICE("\The [src] goes quiet."),SPAN_NOTICE("A motor noise cuts out."))
+ generator_state = GEN_OFF
+
+/obj/item/weapon/gun/magnetic/matfed/phoronbore/loaded
+ cell = /obj/item/weapon/cell/apc
+ capacitor = /obj/item/weapon/stock_parts/capacitor
diff --git a/code/modules/projectiles/guns/magnetic/magnetic.dm b/code/modules/projectiles/guns/magnetic/magnetic.dm
index bbdcc29936..1b13bd8f8c 100644
--- a/code/modules/projectiles/guns/magnetic/magnetic.dm
+++ b/code/modules/projectiles/guns/magnetic/magnetic.dm
@@ -17,7 +17,6 @@
var/obj/item/weapon/cell/cell // Currently installed powercell.
var/obj/item/weapon/stock_parts/capacitor/capacitor // Installed capacitor. Higher rating == faster charge between shots. Set to a path to spawn with one of that type.
- 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/removable_components = TRUE // Whether or not the gun can be dismantled.
var/gun_unreliable = 15 // Percentage chance of detonating in your hands.
@@ -38,16 +37,14 @@
if(ispath(capacitor))
capacitor = new capacitor(src)
capacitor.charge = capacitor.max_charge
- if(ispath(manipulator))
- manipulator = new manipulator(src)
if(ispath(loaded))
loaded = new loaded(src)
-
+
START_PROCESSING(SSobj, src)
-
+
if(capacitor)
power_per_tick = (power_cost*0.15) * capacitor.rating
-
+
update_icon()
/obj/item/weapon/gun/magnetic/Destroy()
@@ -55,7 +52,6 @@
QDEL_NULL(cell)
QDEL_NULL(loaded)
QDEL_NULL(capacitor)
- QDEL_NULL(manipulator)
. = ..()
/obj/item/weapon/gun/magnetic/get_cell()
@@ -68,7 +64,7 @@
capacitor.charge(power_per_tick)
else
capacitor.use(capacitor.charge * 0.05)
-
+
update_state() // May update icon, only if things changed.
/obj/item/weapon/gun/magnetic/proc/update_state()
@@ -80,7 +76,7 @@
newstate |= ICON_CELL
if(capacitor)
newstate |= ICON_CAP
-
+
// Functional state
if(!cell || !capacitor)
newstate |= ICON_BAD
@@ -88,7 +84,7 @@
newstate |= ICON_CHARGE
else
newstate |= ICON_READY
-
+
// Ammo indicator
if(loaded)
newstate |= ICON_LOADED
@@ -99,7 +95,7 @@
needs_update = TRUE
state = newstate
-
+
if(needs_update)
update_icon()
@@ -153,8 +149,7 @@
to_chat(user, "\The [src] already has \a [cell] installed.")
return
cell = thing
- user.drop_from_inventory(cell)
- cell.forceMove(src)
+ user.drop_from_inventory(cell, src)
playsound(src, 'sound/machines/click.ogg', 10, 1)
user.visible_message("\The [user] slots \the [cell] into \the [src].")
update_icon()
@@ -164,10 +159,9 @@
if(!capacitor)
to_chat(user, "\The [src] has no capacitor installed.")
return
- capacitor.forceMove(get_turf(src))
user.put_in_hands(capacitor)
user.visible_message("\The [user] unscrews \the [capacitor] from \the [src].")
- playsound(src, 'sound/items/Screwdriver.ogg', 50, 1)
+ playsound(src, thing.usesound, 50, 1)
capacitor = null
update_icon()
return
@@ -177,8 +171,7 @@
to_chat(user, "\The [src] already has \a [capacitor] installed.")
return
capacitor = thing
- user.drop_from_inventory(capacitor)
- capacitor.forceMove(src)
+ user.drop_from_inventory(capacitor, src)
playsound(src, 'sound/machines/click.ogg', 10, 1)
power_per_tick = (power_cost*0.15) * capacitor.rating
user.visible_message("\The [user] slots \the [capacitor] into \the [src].")
diff --git a/code/modules/projectiles/projectile/magnetic.dm b/code/modules/projectiles/projectile/magnetic.dm
index c4e0ab5e9d..d826ac7a34 100644
--- a/code/modules/projectiles/projectile/magnetic.dm
+++ b/code/modules/projectiles/projectile/magnetic.dm
@@ -161,6 +161,9 @@
irradiate = 20
range = 6
+/obj/item/projectile/bullet/magnetic/bore/get_structure_damage()
+ return damage * 3 //made for boring holes
+
/obj/item/projectile/bullet/magnetic/bore/Bump(atom/A, forced=0)
if(istype(A, /turf/simulated/mineral))
var/turf/simulated/mineral/MI = A
@@ -170,7 +173,6 @@
return 0
else if(istype(A, /turf/simulated/wall) || istype(A, /turf/simulated/shuttle/wall)) // Cause a loud, but relatively minor explosion on the wall it hits.
explosion(A, -1, -1, 1, 3)
- qdel(src)
- return 1
+ return ..()
else
..()
diff --git a/sound/items/small_motor/motor_end.ogg b/sound/items/small_motor/motor_end.ogg
new file mode 100644
index 0000000000..e175bfad46
Binary files /dev/null and b/sound/items/small_motor/motor_end.ogg differ
diff --git a/sound/items/small_motor/motor_fast.ogg b/sound/items/small_motor/motor_fast.ogg
new file mode 100644
index 0000000000..317ca4be4f
Binary files /dev/null and b/sound/items/small_motor/motor_fast.ogg differ
diff --git a/sound/items/small_motor/motor_faster.ogg b/sound/items/small_motor/motor_faster.ogg
new file mode 100644
index 0000000000..bc8e89d495
Binary files /dev/null and b/sound/items/small_motor/motor_faster.ogg differ
diff --git a/sound/items/small_motor/motor_idle.ogg b/sound/items/small_motor/motor_idle.ogg
new file mode 100644
index 0000000000..01bc22de51
Binary files /dev/null and b/sound/items/small_motor/motor_idle.ogg differ
diff --git a/sound/items/small_motor/motor_pull_attempt.ogg b/sound/items/small_motor/motor_pull_attempt.ogg
new file mode 100644
index 0000000000..d7475dbae2
Binary files /dev/null and b/sound/items/small_motor/motor_pull_attempt.ogg differ
diff --git a/sound/items/small_motor/motor_start_nopull.ogg b/sound/items/small_motor/motor_start_nopull.ogg
new file mode 100644
index 0000000000..35bb4c6e6c
Binary files /dev/null and b/sound/items/small_motor/motor_start_nopull.ogg differ
diff --git a/sound/items/small_motor/motor_start_pull.ogg b/sound/items/small_motor/motor_start_pull.ogg
new file mode 100644
index 0000000000..45e456077e
Binary files /dev/null and b/sound/items/small_motor/motor_start_pull.ogg differ