Files
GhomandGitHub 6eb2d1674a Implementing materials checks for techweb designs. (#96257)
## 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.
/🆑
2026-07-06 00:13:02 -07:00

196 lines
7.6 KiB
Plaintext

/// Belt which can turn you into a beast, once an anomaly core is inserted
/obj/item/polymorph_belt
name = "polymorphic field inverter"
desc = "This device can scan and store DNA from other life forms."
slot_flags = ITEM_SLOT_BELT
icon = 'icons/obj/clothing/belts.dmi'
icon_state = "polybelt_inactive"
worn_icon_state = "polybelt_inactive"
base_icon_state = "polybelt"
item_flags = NOBLUDGEON
custom_materials = list(/datum/material/silver = SHEET_MATERIAL_AMOUNT * 2, /datum/material/uranium = SHEET_MATERIAL_AMOUNT, /datum/material/diamond = SHEET_MATERIAL_AMOUNT)
/// Typepath of a mob we have scanned, we only store one at a time
var/stored_mob_type
/// Have we activated the belt?
var/active = FALSE
/// Our current transformation action
var/datum/action/cooldown/spell/shapeshift/polymorph_belt/transform_action
/obj/item/polymorph_belt/Initialize(mapload)
. = ..()
AddElement(/datum/element/update_icon_updates_onmob)
/obj/item/polymorph_belt/Destroy(force)
QDEL_NULL(transform_action)
return ..()
/obj/item/polymorph_belt/examine(mob/user)
. = ..()
if (stored_mob_type)
var/mob/living/will_become = stored_mob_type
. += span_notice("It contains digitised [initial(will_become.name)] DNA.")
if (!active)
. += span_warning("It requires a Bioscrambler Anomaly Core in order to function.")
/obj/item/polymorph_belt/update_icon_state()
icon_state = base_icon_state + (active ? "" : "_inactive")
worn_icon_state = base_icon_state + (active ? "" : "_inactive")
return ..()
/obj/item/polymorph_belt/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if (!istype(tool, /obj/item/assembly/signaler/anomaly/bioscrambler))
return NONE
if (active)
balloon_alert(user, "core already inserted!")
return ITEM_INTERACT_BLOCKING
balloon_alert(user, "inserting...")
if (!do_after(user, delay = 3 SECONDS, target = src))
balloon_alert(user, "interrupted!")
return ITEM_INTERACT_BLOCKING
if (active)
balloon_alert(user, "core already inserted!")
return ITEM_INTERACT_BLOCKING
active = TRUE
update_appearance(UPDATE_ICON_STATE)
update_transform_action()
playsound(src, 'sound/machines/crate/crate_open.ogg', 50, FALSE)
qdel(tool)
return ITEM_INTERACT_SUCCESS
/obj/item/polymorph_belt/attack(mob/living/target_mob, mob/living/user, list/modifiers, list/attack_modifiers)
. = ..()
if (.)
return
if (!isliving(target_mob))
return
if (!isanimal_or_basicmob(target_mob))
balloon_alert(user, "target too complex!")
return TRUE
if (target_mob.mob_biotypes & (MOB_HUMANOID|MOB_ROBOTIC|MOB_SPECIAL|MOB_SPIRIT|MOB_UNDEAD))
balloon_alert(user, "incompatible!")
return TRUE
if (!target_mob.compare_sentience_type(SENTIENCE_ORGANIC))
balloon_alert(user, "target too intelligent!")
return TRUE
if (stored_mob_type == target_mob.type)
balloon_alert(user, "already scanned!")
return TRUE
if (DOING_INTERACTION_WITH_TARGET(user, target_mob))
balloon_alert(user, "busy!")
return TRUE
balloon_alert(user, "scanning...")
visible_message(span_notice("[user] begins scanning [target_mob] with [src]."))
if (!do_after(user, delay = 5 SECONDS, target = target_mob))
return TRUE
visible_message(span_notice("[user] scans [target_mob] with [src]."))
stored_mob_type = target_mob.type
update_transform_action()
playsound(src, 'sound/machines/ping.ogg', 50, FALSE)
return TRUE
/// Make sure we can transform into the scanned target
/obj/item/polymorph_belt/proc/update_transform_action()
if (isnull(stored_mob_type) || !active)
return
if (isnull(transform_action))
transform_action = add_item_action(/datum/action/cooldown/spell/shapeshift/polymorph_belt)
transform_action.update_type(stored_mob_type)
/// Pre-activated polymorph belt
/obj/item/polymorph_belt/functioning
active = TRUE
icon_state = "polybelt"
worn_icon_state = "polybelt"
/// Ability provided by the polymorph belt
/datum/action/cooldown/spell/shapeshift/polymorph_belt
name = "Invert Polymorphic Field"
cooldown_time = 30 SECONDS
school = SCHOOL_UNSET
invocation_type = INVOCATION_NONE
spell_requirements = NONE
possible_shapes = list(/mob/living/basic/cockroach)
can_be_shared = FALSE
shapechange_type = /datum/status_effect/shapechange_mob/from_spell/polymorph_belt
/// Amount of time it takes us to transform back or forth
var/channel_time = 3 SECONDS
/datum/action/cooldown/spell/shapeshift/polymorph_belt/cast(mob/living/cast_on)
cast_on = owner //make sure this is only affecting the wearer of the belt
return ..()
/datum/action/cooldown/spell/shapeshift/polymorph_belt/Remove(mob/remove_from)
var/datum/status_effect/shapechange_mob/shapechange = remove_from.has_status_effect(/datum/status_effect/shapechange_mob/from_spell)
var/atom/changer = shapechange?.caster_mob || remove_from
changer?.transform = matrix()
return ..()
/datum/action/cooldown/spell/shapeshift/polymorph_belt/before_cast(mob/living/cast_on)
cast_on = owner
. = ..()
if (. & SPELL_CANCEL_CAST)
return
if (channel_time <= 0)
return
if (DOING_INTERACTION_WITH_TARGET(cast_on, cast_on))
return . | SPELL_CANCEL_CAST
var/old_transform = cast_on.transform
var/animate_step = channel_time / 6
playsound(cast_on, 'sound/effects/wounds/crack1.ogg', 50)
animate(cast_on, transform = matrix() * 1.1, time = animate_step, easing = SINE_EASING)
animate(transform = matrix() * 0.9, time = animate_step, easing = SINE_EASING)
animate(transform = matrix() * 1.2, time = animate_step, easing = SINE_EASING)
animate(transform = matrix() * 0.8, time = animate_step, easing = SINE_EASING)
animate(transform = matrix() * 1.3, time = animate_step, easing = SINE_EASING)
animate(transform = matrix() * 0.1, time = animate_step, easing = SINE_EASING)
cast_on.balloon_alert(cast_on, "transforming...")
if (!do_after(cast_on, delay = channel_time, target = cast_on))
animate(cast_on, transform = matrix(), time = 0, easing = SINE_EASING)
cast_on.transform = old_transform
return . | SPELL_CANCEL_CAST
cast_on.visible_message(span_warning("[cast_on]'s body rearranges itself with a horrible crunching sound!"))
playsound(cast_on, 'sound/effects/magic/demon_consume.ogg', 50, TRUE)
/datum/action/cooldown/spell/shapeshift/polymorph_belt/after_cast(atom/cast_on)
. = ..()
if (QDELETED(owner))
return
animate(owner, transform = matrix() * 0.1, time = 0, easing = JUMP_EASING)
animate(transform = matrix(), time = 0.25 SECONDS, easing = SINE_EASING)
/// Update what you are transforming to or from
/datum/action/cooldown/spell/shapeshift/polymorph_belt/proc/update_type(transform_type)
unshift_owner()
shapeshift_type = transform_type
possible_shapes = list(transform_type)
var/mob/living/will_become = transform_type
desc = "Assume your [initial(will_become.name)] form!"
build_all_button_icons(update_flags = UPDATE_BUTTON_NAME)
/// Subtype of the polymorph status effect which tracks arbitrary mob transformation
/datum/status_effect/shapechange_mob/from_spell/polymorph_belt
/datum/status_effect/shapechange_mob/from_spell/polymorph_belt/on_apply()
. = ..()
RegisterSignal(owner, COMSIG_MOB_CHANGED_TYPE, PROC_REF(on_type_change))
/datum/status_effect/shapechange_mob/from_spell/polymorph_belt/on_pre_type_change(mob/living/source)
return // Stub out base effect because we don't want to cancel if they transform
/// If our mob transforms (via aging usually) then move the status effect across to the new mob
/datum/status_effect/shapechange_mob/from_spell/polymorph_belt/proc/on_type_change(mob/living/source, mob/living/new_mob)
SIGNAL_HANDLER
var/caster = caster_mob // Will be unset when the mob is unshifted
var/datum/action/cooldown/spell/shapeshift/transform_action = source_weakref?.resolve()
transform_action.possible_shapes |= new_mob.type
restore_caster()
new_mob.apply_status_effect(type, caster, transform_action)