mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 12:41:09 +01:00
## About The Pull Request In similar fashion to what was done with crafting recipes last year, this year it's time for techweb designs and printed items to be audited. This is mostly just about consistency, we've a lot of items that can be printed by protolathes, autolathes, circuit printers and techfab etc. However they almost all (except most stacks, mainly) have custom materials that do not match in one way or another with the materials used by the design, which is what this PR is for. "But items printed from lathes etc. already get the mats used to make them." Yes, they do, however that isn't the case for items of the same type that were spawned in some other way (cargo shuttle, space/maints loot, mapped, admins), this create a subtle discrepancy. It isn't a huge deal (in spite of the size of this PR, ton of designs), but given that I have done something similar with crafting recipes before, I may as well give it a second arc of some sort and bring things to completion. And fix a few possible oversights. TL;DR consistency and stuff ## Why It's Good For The Game Consistency, unit test checks to make it harder not to be consistent in the future. Still has a few TODOs like: - [x] Fixed newly printed, fully charged RCDs costing less than the RCD cartridges required to fully charge one. EDIT: I had to tweak the newly added RDD as well because it suffered from the same fundamental issue. - [x] Fixed plates being made of iron and yet shattering like ceramic ones. A new subtype for metallic ones has been made. ## Changelog 🆑 refactor: Refactored a few things with techweb designs (the ones for autolathes, protolathes, circuit printers, mechfabs etc.) to make sure that the materials of items that can be made from these designs more closely match the materials used to make them. fix: Lizard fries no longer need a plate to be made, like all other treats that used to require plates in a distant past. balance: Tweaked the materials cost of RCD, RDD and RCD cartridges. image: Oven trays now have a more metallic hue. balance: Plates printed printed from lathes won't shatter like ceramic ones, in virtue of them being made out of iron instead. /🆑
281 lines
10 KiB
Plaintext
281 lines
10 KiB
Plaintext
|
|
// Drill, Diamond drill, Mining scanner
|
|
|
|
#define DRILL_BASIC 1
|
|
#define DRILL_HARDENED 2
|
|
|
|
|
|
/obj/item/mecha_parts/mecha_equipment/drill
|
|
name = "exosuit drill"
|
|
desc = "Equipment for engineering and combat exosuits. This is the drill that'll pierce the heavens!"
|
|
icon_state = "mecha_drill"
|
|
equipment_slot = MECHA_UTILITY
|
|
can_be_toggled = TRUE
|
|
equip_cooldown = 1.5 SECONDS
|
|
energy_drain = 0.01 * STANDARD_CELL_CHARGE
|
|
force = 15
|
|
harmful = TRUE
|
|
range = MECHA_MELEE
|
|
tool_behaviour = TOOL_DRILL
|
|
toolspeed = 0.9
|
|
mech_flags = EXOSUIT_MODULE_WORKING | EXOSUIT_MODULE_COMBAT
|
|
custom_materials = list(/datum/material/iron = SHEET_MATERIAL_AMOUNT * 5)
|
|
var/drill_delay = 7
|
|
var/drill_level = DRILL_BASIC
|
|
|
|
/obj/item/mecha_parts/mecha_equipment/drill/Initialize(mapload)
|
|
. = ..()
|
|
AddComponent(/datum/component/butchering/mecha, \
|
|
speed = 5 SECONDS, \
|
|
effectiveness = 100, \
|
|
bonus_modifier = null, \
|
|
butcher_sound = null, \
|
|
disabled = TRUE, \
|
|
)
|
|
ADD_TRAIT(src, TRAIT_INSTANTLY_PROCESSES_BOULDERS, INNATE_TRAIT)
|
|
ADD_TRAIT(src, TRAIT_BOULDER_BREAKER, INNATE_TRAIT)
|
|
|
|
/obj/item/mecha_parts/mecha_equipment/drill/handle_ui_act(action, list/params)
|
|
if(action != "toggle")
|
|
return
|
|
if(active)
|
|
RegisterSignal(chassis, COMSIG_MECHA_MELEE_CLICK, PROC_REF(on_mech_click))
|
|
log_message("Activated.", LOG_MECHA)
|
|
else
|
|
UnregisterSignal(chassis, COMSIG_MECHA_MELEE_CLICK)
|
|
log_message("Deactivated.", LOG_MECHA)
|
|
return TRUE
|
|
|
|
/obj/item/mecha_parts/mecha_equipment/drill/attach(obj/vehicle/sealed/mecha/new_mecha, attach_right)
|
|
. = ..()
|
|
RegisterSignal(chassis, COMSIG_MOVABLE_BUMP, PROC_REF(bump_mine))
|
|
|
|
/obj/item/mecha_parts/mecha_equipment/drill/detach(atom/moveto)
|
|
UnregisterSignal(chassis, COMSIG_MOVABLE_BUMP)
|
|
return ..()
|
|
|
|
/obj/item/mecha_parts/mecha_equipment/drill/Destroy()
|
|
if(chassis)
|
|
UnregisterSignal(chassis, COMSIG_MOVABLE_BUMP)
|
|
return ..()
|
|
|
|
///Called whenever the mech bumps into something; action() handles checking if it is a mineable turf
|
|
/obj/item/mecha_parts/mecha_equipment/drill/proc/bump_mine(obj/vehicle/sealed/mecha/bumper, atom/bumped_into)
|
|
SIGNAL_HANDLER
|
|
var/list/drivers = chassis.return_drivers()
|
|
if(!LAZYLEN(drivers)) //I don't know if this is possible but just in case
|
|
return
|
|
|
|
//Just use the first one /shrug
|
|
INVOKE_ASYNC(src, PROC_REF(action), drivers[1], bumped_into, null, TRUE)
|
|
|
|
/obj/item/mecha_parts/mecha_equipment/drill/do_after_checks(atom/target)
|
|
// Gotta be close to the target
|
|
if(!loc.Adjacent(target))
|
|
return FALSE
|
|
// Check if we can still use the equipment & use power for every iteration of do after
|
|
if(!action_checks(target))
|
|
return FALSE
|
|
return ..()
|
|
|
|
///Redirects clicks to use the drill if possible when enabled
|
|
/obj/item/mecha_parts/mecha_equipment/drill/proc/on_mech_click(atom/mech, mob/source, atom/target, on_cooldown, adjacent)
|
|
SIGNAL_HANDLER
|
|
if(on_cooldown || !adjacent)
|
|
return
|
|
INVOKE_ASYNC(src, PROC_REF(action), source, target, null, FALSE)
|
|
return COMPONENT_CANCEL_MELEE_CLICK
|
|
|
|
/obj/item/mecha_parts/mecha_equipment/drill/action(mob/source, atom/target, list/modifiers, bumped)
|
|
//If bumped, only bother drilling mineral turfs
|
|
if(bumped)
|
|
if(!ismineralturf(target))
|
|
return
|
|
|
|
//Prevent drilling into gibtonite more than once; code mostly from MODsuit drill
|
|
if(istype(target, /turf/closed/mineral/gibtonite))
|
|
var/turf/closed/mineral/gibtonite/giberal_turf = target
|
|
if(giberal_turf.stage != GIBTONITE_UNSTRUCK)
|
|
playsound(chassis, 'sound/machines/scanner/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE)
|
|
to_chat(source, span_warning("[icon2html(src, source)] Active gibtonite ore deposit detected! Safety protocols preventing continued drilling."))
|
|
return
|
|
|
|
else
|
|
// We can only drill non-space turfs, living mobs and objects.
|
|
if(isspaceturf(target) || !(isliving(target) || isobj(target) || isturf(target)))
|
|
return
|
|
|
|
// For whatever reason we can't drill things that acid won't even stick too, and probably
|
|
// shouldn't waste our time drilling indestructible things.
|
|
if(isobj(target))
|
|
var/obj/target_obj = target
|
|
if(target_obj.resistance_flags & (UNACIDABLE | INDESTRUCTIBLE))
|
|
return
|
|
|
|
// Check if we can even use the equipment to begin with.
|
|
if(!action_checks(target))
|
|
return
|
|
|
|
// You can't drill harder by clicking more.
|
|
if(DOING_INTERACTION_WITH_TARGET(source, target) && do_after_cooldown(target, source, DOAFTER_SOURCE_MECHADRILL))
|
|
return
|
|
|
|
target.visible_message(span_warning("[chassis] starts to drill [target]."), \
|
|
span_userdanger("[chassis] starts to drill you!"), \
|
|
span_hear("You hear drilling."))
|
|
|
|
log_message("Started drilling [target]", LOG_MECHA)
|
|
|
|
// Drilling a turf is a one-and-done procedure.
|
|
if(isturf(target))
|
|
var/turf/T = target
|
|
. = ..()
|
|
T.drill_act(src, source)
|
|
return
|
|
|
|
// Drilling objects and mobs is a repeating procedure.
|
|
while(do_after_mecha(target, source, drill_delay))
|
|
if(isliving(target))
|
|
drill_mob(target, source)
|
|
playsound(src,'sound/items/weapons/drill.ogg',40,TRUE)
|
|
else if(isobj(target))
|
|
var/obj/obj_target = target
|
|
if(istype(obj_target, /obj/item/boulder))
|
|
var/obj/item/boulder/nu_boulder = obj_target
|
|
nu_boulder.manual_process(src, source)
|
|
else
|
|
obj_target.take_damage(15, BRUTE, 0, FALSE, get_dir(chassis, target))
|
|
playsound(src,'sound/items/weapons/drill.ogg', 40, TRUE)
|
|
|
|
// If we caused a qdel drilling the target, we can stop drilling them.
|
|
// Prevents starting a do_after on a qdeleted target.
|
|
if(QDELETED(target))
|
|
break
|
|
|
|
return ..()
|
|
|
|
/obj/item/mecha_parts/mecha_equipment/drill/get_equip_cooldown(atom/target)
|
|
if (isturf(target))
|
|
return equip_cooldown * 0.1
|
|
return equip_cooldown
|
|
|
|
/turf/proc/drill_act(obj/item/mecha_parts/mecha_equipment/drill/drill, mob/user)
|
|
return
|
|
|
|
/turf/closed/wall/drill_act(obj/item/mecha_parts/mecha_equipment/drill/drill, mob/user)
|
|
if(drill.do_after_mecha(src, user, 60 / drill.drill_level))
|
|
drill.log_message("Drilled through [src]", LOG_MECHA)
|
|
dismantle_wall(TRUE, FALSE)
|
|
|
|
/turf/closed/wall/r_wall/drill_act(obj/item/mecha_parts/mecha_equipment/drill/drill, mob/user)
|
|
if(drill.drill_level >= DRILL_HARDENED)
|
|
if(drill.do_after_mecha(src, user, 120 / drill.drill_level))
|
|
drill.log_message("Drilled through [src]", LOG_MECHA)
|
|
dismantle_wall(TRUE, FALSE)
|
|
else
|
|
to_chat(user, "[icon2html(src, user)][span_danger("[src] is too durable to drill through.")]")
|
|
|
|
/turf/closed/mineral/drill_act(obj/item/mecha_parts/mecha_equipment/drill/drill, mob/user)
|
|
for(var/turf/closed/mineral/wall in range(drill.chassis, 1))
|
|
if(get_dir(drill.chassis, wall) & drill.chassis.dir)
|
|
wall.gets_drilled()
|
|
drill.log_message("[user] drilled through [src]", LOG_MECHA)
|
|
drill.move_ores()
|
|
|
|
/turf/open/misc/asteroid/drill_act(obj/item/mecha_parts/mecha_equipment/drill/drill)
|
|
for(var/turf/open/misc/asteroid/floor in range(1, drill.chassis))
|
|
if((get_dir(drill.chassis, floor) & drill.chassis.dir) && floor.can_dig())
|
|
floor.getDug()
|
|
drill.log_message("Drilled through [src]", LOG_MECHA)
|
|
drill.move_ores()
|
|
|
|
/obj/item/mecha_parts/mecha_equipment/drill/proc/move_ores()
|
|
chassis.collect_ore()
|
|
|
|
/obj/item/mecha_parts/mecha_equipment/drill/proc/drill_mob(mob/living/target, mob/living/user)
|
|
target.visible_message(span_danger("[chassis] is drilling [target] with [src]!"), \
|
|
span_userdanger("[chassis] is drilling you with [src]!"))
|
|
log_combat(user, target, "drilled", "[name]", "Combat mode: [user.combat_mode ? "On" : "Off"])(DAMTYPE: [uppertext(damtype)])")
|
|
if(target.stat == DEAD && target.get_brute_loss() >= (target.maxHealth * 2))
|
|
log_combat(user, target, "gibbed", name)
|
|
if(LAZYLEN(target.butcher_results) || LAZYLEN(target.guaranteed_butcher_results))
|
|
SEND_SIGNAL(src, COMSIG_MECHA_DRILL_MOB, chassis, target)
|
|
else
|
|
target.investigate_log("has been gibbed by [src] (attached to [chassis]).", INVESTIGATE_DEATHS)
|
|
target.gib(DROP_ALL_REMAINS)
|
|
return
|
|
|
|
//drill makes a hole
|
|
var/def_zone = target.get_random_valid_zone(user.zone_selected)
|
|
target.apply_damage(
|
|
10,
|
|
BRUTE,
|
|
def_zone,
|
|
blocked = target.run_armor_check(def_zone, MELEE),
|
|
wound_bonus = 30,
|
|
exposed_wound_bonus = 50,
|
|
sharpness = SHARP_POINTY
|
|
)
|
|
|
|
//blood splatters
|
|
target.create_splatter(get_dir(chassis, target))
|
|
|
|
/obj/item/mecha_parts/mecha_equipment/drill/diamonddrill
|
|
name = "diamond-tipped exosuit drill"
|
|
desc = "Equipment for engineering and combat exosuits. This is an upgraded version of the drill that'll pierce the heavens!"
|
|
icon_state = "mecha_diamond_drill"
|
|
equip_cooldown = 10
|
|
drill_delay = 4
|
|
drill_level = DRILL_HARDENED
|
|
force = 15
|
|
toolspeed = 0.7
|
|
custom_materials = list(/datum/material/iron = SHEET_MATERIAL_AMOUNT * 5, /datum/material/diamond = SHEET_MATERIAL_AMOUNT * 3.25)
|
|
|
|
/obj/item/mecha_parts/mecha_equipment/mining_scanner
|
|
name = "exosuit mining scanner"
|
|
desc = "Equipment for working exosuits. It will automatically check surrounding rock for useful minerals."
|
|
icon_state = "mecha_analyzer"
|
|
equip_cooldown = 1.5 SECONDS
|
|
equipment_slot = MECHA_UTILITY
|
|
mech_flags = EXOSUIT_MODULE_WORKING
|
|
custom_materials = list(/datum/material/iron = SHEET_MATERIAL_AMOUNT * 2.5, /datum/material/glass = SHEET_MATERIAL_AMOUNT * 1.25)
|
|
var/scanning_time = 0
|
|
COOLDOWN_DECLARE(area_scan_cooldown)
|
|
|
|
/obj/item/mecha_parts/mecha_equipment/mining_scanner/Initialize(mapload)
|
|
. = ..()
|
|
START_PROCESSING(SSfastprocess, src)
|
|
|
|
/obj/item/mecha_parts/mecha_equipment/mining_scanner/process()
|
|
if(!loc)
|
|
STOP_PROCESSING(SSfastprocess, src)
|
|
qdel(src)
|
|
if(scanning_time > world.time)
|
|
return
|
|
if(!chassis || !ismecha(loc))
|
|
return
|
|
if(!LAZYLEN(chassis.occupants))
|
|
return
|
|
scanning_time = world.time + get_equip_cooldown()
|
|
mineral_scan_pulse(get_turf(src), scanner = src)
|
|
|
|
/obj/item/mecha_parts/mecha_equipment/mining_scanner/get_snowflake_data()
|
|
return list(
|
|
"snowflake_id" = MECHA_SNOWFLAKE_ID_ORE_SCANNER,
|
|
"cooldown" = COOLDOWN_TIMELEFT(src, area_scan_cooldown),
|
|
)
|
|
|
|
/obj/item/mecha_parts/mecha_equipment/mining_scanner/handle_ui_act(action, list/params)
|
|
switch(action)
|
|
if("area_scan")
|
|
if(!COOLDOWN_FINISHED(src, area_scan_cooldown))
|
|
return FALSE
|
|
COOLDOWN_START(src, area_scan_cooldown, 15 SECONDS)
|
|
for(var/mob/living/driver in chassis.return_drivers())
|
|
for(var/obj/structure/ore_vent/vent in range(5, chassis))
|
|
vent.scan_and_confirm(driver, TRUE)
|
|
return TRUE
|
|
|
|
#undef DRILL_BASIC
|
|
#undef DRILL_HARDENED
|