Files
Aurora.3/code/modules/mining/satchel_ore_boxdm.dm
Batrachophreno 387cee9243 Object Examine Text Overhaul (#20923)
Extends and reworks how various extended information text (desc_info,
desc_build, desc_upgrades) are handled to make object interactions and
mechanics A.) much more clearly documented in-game and B.) much easier
to support from the back-end.

Almost certainly a candidate for test merge.

Assembly/Disassembly instructions are noticeably sporadic, largely due
to our current lack of a unified framework. That's a future thing I'd
like to attack so that it can be handled programmatically, but for now I
only targeted the biggest culprits as I came across them.

---------

Signed-off-by: Batrachophreno <Batrochophreno@gmail.com>
2025-07-21 15:35:14 +00:00

136 lines
4.4 KiB
Plaintext

/**********************Ore box**************************/
/obj/structure/ore_box
name = "ore box"
desc = "A heavy box used for storing ore."
icon = 'icons/obj/mining.dmi'
icon_state = "orebox0"
density = TRUE
build_amt = 10
var/last_update = 0
var/obj/item/warp_core/warp_core // to set up the bluespace network
var/list/stored_ore = list()
/obj/structure/ore_box/mechanics_hints(mob/user, distance, is_adjacent)
. += ..()
. += "You can attach a warp extraction beacon signaller to this, then click on it with an ore satchel that has a warp extraction pack attached, to link them."
/obj/structure/ore_box/feedback_hints(mob/user, distance, is_adjacent)
. += ..()
if(!is_adjacent) //Can only check the contents of ore boxes if you can physically reach them.
return
add_fingerprint(user)
if(warp_core)
. += FONT_SMALL(SPAN_NOTICE("It has a <b>warp extraction beacon signaller</b> attached to it."))
if(!length(contents))
. += SPAN_NOTICE("It is empty.")
return
if(world.time > last_update + 10)
update_ore_count()
last_update = world.time
. += SPAN_NOTICE("It holds:")
for(var/ore in stored_ore)
. += SPAN_NOTICE("- [stored_ore[ore]] [ore]")
/obj/structure/ore_box/attackby(obj/item/attacking_item, mob/user)
if(istype(attacking_item, /obj/item/ore))
user.drop_from_inventory(attacking_item, src)
else if(istype(attacking_item, /obj/item/storage))
if(istype(attacking_item, /obj/item/storage/bag/ore))
var/obj/item/storage/bag/ore/satchel = attacking_item
if(satchel.linked_beacon)
if(!warp_core)
to_chat(user, SPAN_WARNING("\The [src] doesn't have a warp beacon!"))
return
satchel.linked_box = src
to_chat(user, SPAN_NOTICE("You link \the [satchel] to \the [src]."))
return
var/obj/item/storage/S = attacking_item
S.hide_from(user)
for(var/obj/item/ore/O in S.contents)
S.remove_from_storage_deferred(O, src, user) //This will move the item to this item's contents
CHECK_TICK
S.post_remove_from_storage_deferred(loc, user)
to_chat(user, SPAN_NOTICE("You empty the satchel into the box."))
else if(istype(attacking_item, /obj/item/warp_core))
if(warp_core)
to_chat(user, SPAN_WARNING("\The [src] already has a warp core attached!"))
return
user.drop_from_inventory(attacking_item, src)
warp_core = attacking_item
to_chat(user, SPAN_NOTICE("You carefully attach \the [attacking_item] to \the [src], connecting it to the bluespace network."))
else if(istype(attacking_item, /obj/item/gripper/miner)) // myazaki's gonna be so mad at me
var/obj/item/gripper/miner/GM = attacking_item
if(!warp_core)
to_chat(user, SPAN_WARNING("\The [src] has no warp core to detach."))
return
// we don't need to check if it has a held item because the gripper code attacks with the held item if it has one, not the gripper itself
warp_core.forceMove(get_turf(src))
GM.grip_item(warp_core, user, FALSE)
to_chat(user, SPAN_NOTICE("You detach \the [warp_core] from \the [src], disconnecting it from the bluespace network."))
warp_core = null
update_ore_count()
return
/obj/structure/ore_box/attack_hand(mob/user)
if(warp_core)
warp_core.forceMove(get_turf(user))
user.put_in_hands(warp_core)
to_chat(user, SPAN_NOTICE("You detach \the [warp_core] from \the [src], disconnecting it from the bluespace network."))
warp_core = null
else
..()
/obj/structure/ore_box/proc/update_ore_count()
stored_ore = list()
for(var/obj/item/ore/O in contents)
if(stored_ore[O.name])
stored_ore[O.name]++
else
stored_ore[O.name] = 1
/obj/structure/ore_box/verb/empty_box()
set name = "Empty Ore Box"
set category = "Object"
set src in view(1)
if(!istype(usr, /mob/living/carbon/human)) //Only living, intelligent creatures with hands can empty ore boxes.
to_chat(usr, SPAN_WARNING("You are physically incapable of emptying \the [src]."))
return
if(use_check_and_message(usr))
return
if(!Adjacent(usr)) //You can only empty the box if you can physically reach it
to_chat(usr, SPAN_NOTICE("You cannot reach \the [src]."))
return
add_fingerprint(usr)
if(!length(contents))
to_chat(usr, SPAN_WARNING("\The [src] is empty."))
return
for(var/obj/item/ore/O in contents)
contents -= O
O.forceMove(get_turf(src))
to_chat(usr, SPAN_NOTICE("You empty \the [src]."))
return
/obj/structure/ore_box/ex_act(severity)
if(severity == 1.0 || (severity < 3.0 && prob(50)))
for(var/obj/item/ore/O in contents)
O.forceMove(src.loc)
O.ex_act(severity++)
CHECK_TICK
qdel(src)
return