Files
Aurora.3/code/game/objects/structures/carts/carts.dm
T
Casper3667andGitHub 9a9e259104 Adds the parcel cart to operations. (#21288)
This adds a parcel cart to the mail room in operations, which can be
loaded with up to 17 packages. These packages can be any that can be
held in the hand, so not crates but anything smaller effectively yes as
long as it can be wrapped in package wrapper.
When it is loaded with 5 packages, it gives a slowdown to the person
pushing it, and further slowdown at 11 packages.
The cart can have a total of 17 packages at the moment, as that is the
amount of different sprites I have for it.
The code is based on the engineering cart, and also contain a small
bugfix so the engineering cart give back steel when taken apart, as that
is what is used to build it.


https://github.com/user-attachments/assets/b8613c9e-55e1-4f76-926a-60f4acd6269e

### Asset Licenses
The following assets that **have not** been created by myself are
included in this PR:

| Path | Original Author | License |
| --- | --- | --- |
| icons/obj/parcelcart.dmi | Tomixcomics (Aurora Station) | CC-BY |
2025-09-10 19:05:19 +00:00

142 lines
3.9 KiB
Plaintext

ABSTRACT_TYPE(/obj/structure/cart)
name = "cart parent item"
desc = DESC_PARENT
icon_state = "cart"
anchored = FALSE
density = TRUE
climbable = TRUE
build_amt = 15
material = DEFAULT_WALL_MATERIAL
slowdown = 0
var/movesound = 'sound/effects/roll.ogg'
var/driving
var/mob/living/pulling
/obj/structure/cart/mechanics_hints(mob/user, distance, is_adjacent)
. += ..()
. += "\
You can <b>CTRL-Click</b> to start dragging this cart. This object has a special dragging behaviour: when dragged, character's movement \
directs the cart and the character is subsequently pulled by it. \
"
/obj/structure/cart/disassembly_hints(mob/user, distance, is_adjacent)
. += ..()
. += "An empty cart can be taken apart with a <b>wrench</b> or a <b>welder</b>. Or a <b>plasma cutter</b>, if you're that hardcore."
/obj/structure/cart/proc/take_apart(var/mob/user = null, var/obj/I)
if(user)
if(iswelder(I))
var/obj/item/welder = I
welder.play_tool_sound(get_turf(src), 50)
user.visible_message("<b>[user]</b> starts taking apart the [src]...", SPAN_NOTICE("You start disassembling the [src]..."))
if (!do_after(user, 30, do_flags = DO_DEFAULT & ~DO_USER_SAME_HAND))
return
dismantle()
/obj/structure/cart/ex_act(severity)
spill(100 / severity)
..()
/obj/structure/cart/proc/spill(var/chance = 100)
/obj/structure/cart/proc/update_slowdown()
/obj/structure/cart/relaymove(mob/living/user, direction)
. = ..()
if(user.stat || user.stunned || user.weakened || user.paralysis || user.lying || user.restrained())
if(user==pulling)
pulling = null
user.pulledby = null
to_chat(user, SPAN_WARNING("You lost your grip!"))
return
if(user.pulling && (user == pulling))
pulling = null
user.pulledby = null
return
if(pulling && (get_dist(src, pulling) > 1))
pulling = null
user.pulledby = null
if(user==pulling)
return
if(pulling && (get_dir(src.loc, pulling.loc) == direction))
to_chat(user, SPAN_WARNING("You cannot go there."))
return
driving = 1
var/turf/T = null
if(pulling)
T = pulling.loc
if(get_dist(src, pulling) >= 1)
step(pulling, get_dir(pulling.loc, src.loc))
step(src, direction)
set_dir(direction)
if(pulling)
if(pulling.loc == src.loc)
pulling.forceMove(T)
else
spawn(0)
if(get_dist(src, pulling) > 1)
pulling = null
user.pulledby = null
pulling.set_dir(get_dir(pulling, src))
driving = 0
/obj/structure/cart/Move()
. = ..()
if (pulling && (get_dist(src, pulling) > 1))
pulling.pulledby = null
to_chat(pulling, SPAN_WARNING("You lost your grip!"))
pulling = null
if(has_gravity())
playsound(src, movesound, 50, 1)
/obj/structure/cart/CtrlClick(var/mob/user)
if(in_range(src, user))
if(!ishuman(user)) return
if(!pulling)
pulling = user
user.pulledby = src
if(user.pulling)
user.stop_pulling()
user.set_dir(get_dir(user, src))
to_chat(user, SPAN_NOTICE("You grip \the [name]'s handles."))
else
to_chat(user, SPAN_NOTICE("You let go of \the [name]'s handles."))
pulling.pulledby = null
pulling = null
return
/obj/structure/cart/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(air_group || (height==0))
return TRUE
if(mover?.movement_type & PHASING)
return TRUE
if(istype(mover) && mover.pass_flags & PASSTABLE)
return TRUE
if(istype(mover, /mob/living) && mover == pulling)
return TRUE
else
if(istype(mover, /obj/projectile))
return prob(20)
else
return !density
ABSTRACT_TYPE(/obj/structure/cart/storage)
var/has_items = FALSE
/// Used for displaying and handling radial menu. Collective list of every single item this object contains.
var/list/storage_contents = list()
/obj/structure/cart/storage/proc/handle_storing(var/attacking_item, var/mob/user, var/should_store, var/storage_is_full)
/obj/structure/cart/storage/proc/get_storage_contents_list()
/obj/structure/cart/storage/take_apart(var/mob/user = null, var/obj/I)
if(has_items)
spill()
. = ..()