/obj/item/vertibore
name = "portable shaft excavation device"
desc = "A heavily modified shaft bore utilizing phorogenic blasts to tunnel vertically through rock. Much faster than a large industrial drill unit, but is very resource- and power-intensive."
description_fluff = "A phoron bore used for rapidly digging through rock that has been modified to allow it to fire straight down at a much higher power. However, this has resulted in a loss of power and resource efficiency, compactness, and modularity as the proprietary capacitor and manipulator cannot be swapped."
w_class = WEIGHT_CLASS_HUGE
icon = 'icons/obj/mining.dmi'
icon_state = "vertibore"
item_state = "vertibore"
var/cell_type
var/cell_accept = CELL_TYPE_SMALL | CELL_TYPE_WEAPON | CELL_TYPE_MEDIUM
var/power_cost = 1000 //10 shots off a highcap
var/load_type = /obj/item/stack/material
var/mat_storage = 0 // How much material is stored inside? Input in multiples of 2000 as per auto/protolathe.
var/max_mat_storage = 50000 // 25 sheets
var/mat_cost = 1000 // 100 shots off of a full stack.
var/ammo_material = MAT_PHORON
var/loading = FALSE
/obj/item/vertibore/Initialize(mapload)
. = ..()
init_cell_slot_easy_tool(cell_type, cell_accept)
/obj/item/vertibore/examine(mob/user, dist)
. = ..()
var/obj/item/cell/cell = get_cell()
. += "The shaft excavator has [mat_storage]cm^3 of phoron inside, and can hold a maximum of [max_mat_storage]."
if(cell)
. += "The installed [cell.name] has a charge level of [round((cell.charge/cell.max_charge)*100)]%."
/obj/item/vertibore/attackby(var/obj/item/thing, var/mob/user)
if(istype(thing, load_type))
loading = TRUE
var/obj/item/stack/material/M = thing
if(!M.material || M.material.name != ammo_material)
return
if(mat_storage + 2000 > 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))
can_hold_val ++
mat_storage += 2000
playsound(loc, 'sound/effects/phasein.ogg', 15, 1)
else
loading = FALSE
break
M.use(can_hold_val)
user.visible_message("\The [user] loads \the [src] with \the [M].")
playsound(loc, 'sound/weapons/flipblade.ogg', 50, 1)
update_icon()
return
. = ..()
/obj/item/vertibore/attack_self(mob/user, datum/event_args/actor/actor)
. = ..()
if(.)
return
if(mat_cost > mat_storage)
to_chat(user, "The [src] shudders, the phoron feeding mechanism attempting to move things that aren't there.")
return
var/obj/item/cell/cell = get_cell()
if(power_cost > cell.charge)
to_chat(user, "The [src] flashes a warning light, it doesn't have enough charge to dig.")
return
if(do_after(user, 2.5 SECONDS) && cell.use(power_cost))
var/turf/T = get_turf(user)
LEGACY_EX_ACT(T, 1, null)
/obj/item/vertibore/update_icon()
cut_overlays()
var/obj/item/cell/cell = get_cell()
if(cell)
add_overlay("[icon_state]_cell")
return ..()