mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-02-09 07:49:09 +00:00
## About The Pull Request
516 requires float layered overlays to be using pixel_w and pixel_z
instead of pixel_x and pixel_y respectively, unless we want
visual/layering errors. This makes sense, as w,z are for visual effects
only. Sadly seems we were not entirely consistent in this, and many
things seem to have been using x,y incorrectly.
This hopefully fixes that, and thus also fixes layering issues. Complete
1:1 compatibility not guaranteed.
I did the lazy way suggested to me by SmArtKar to speed it up (Runtiming
inside apply_overlays), and this is still included in the PR to flash
out possible issues in a TM (Plus I will need someone to grep the
runtimes for me after the TM period to make sure nothing was missed).
After this is done I'll remove all these extra checks.
Lints will probably be failing for a bit, got to wait for [this
update](4b77cd487d)
to them to make it into release. Or just unlint the lines, though that's
probably gonna produce code debt
## Why It's Good For The Game
Fixes this massive 516 mess, hopefully.
closes #90281
## Changelog
🆑
refactor: Changed many of our use cases for pixel_x and pixel_y
correctly into pixel_w and pixel_z, fixing layering issues in the
process.
/🆑
---------
Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
Co-authored-by: SmArtKar <master.of.bagets@gmail.com>
166 lines
5.0 KiB
Plaintext
166 lines
5.0 KiB
Plaintext
/obj/item/flatpack
|
|
name = "flatpack"
|
|
desc = "A box containing a compactly packed machine. Use multitool to deploy."
|
|
icon = 'icons/obj/devices/circuitry_n_data.dmi'
|
|
icon_state = "flatpack"
|
|
density = TRUE
|
|
w_class = WEIGHT_CLASS_HUGE //cart time
|
|
throw_range = 2
|
|
item_flags = SLOWS_WHILE_IN_HAND | IMMUTABLE_SLOW
|
|
slowdown = 2.5
|
|
drag_slowdown = 3.5 //use the cart stupid
|
|
custom_premium_price = PAYCHECK_COMMAND * 1.5
|
|
|
|
/// The board we deploy
|
|
var/obj/item/circuitboard/machine/board
|
|
|
|
/obj/item/flatpack/Initialize(mapload, obj/item/circuitboard/machine/new_board)
|
|
if(isnull(board) && isnull(new_board))
|
|
return INITIALIZE_HINT_QDEL //how
|
|
|
|
. = ..()
|
|
|
|
var/static/list/tool_behaviors = list(
|
|
TOOL_MULTITOOL = list(
|
|
SCREENTIP_CONTEXT_LMB = "Deploy",
|
|
),
|
|
)
|
|
AddElement(/datum/element/contextual_screentip_tools, tool_behaviors)
|
|
|
|
board = !isnull(new_board) ? new_board : new board(src) // i got board
|
|
if(board.loc != src)
|
|
board.forceMove(src)
|
|
var/obj/machinery/build = initial(board.build_path)
|
|
name = "flatpack ([initial(build.name)])"
|
|
|
|
/obj/item/flatpack/Destroy()
|
|
QDEL_NULL(board)
|
|
. = ..()
|
|
|
|
/obj/item/flatpack/examine(mob/user)
|
|
. = ..()
|
|
if(!in_range(user, src) && !isobserver(user))
|
|
return
|
|
|
|
if(loc == user)
|
|
. += span_warning("You can't deploy while holding it in your hand.")
|
|
else if(isturf(loc))
|
|
var/turf/location = loc
|
|
if(!isopenturf(location))
|
|
. += span_warning("Can't deploy in this location")
|
|
else if(location.is_blocked_turf(source_atom = src))
|
|
. += span_warning("No space for deployment")
|
|
|
|
/obj/item/flatpack/multitool_act(mob/living/user, obj/item/tool)
|
|
. = NONE
|
|
|
|
if(isnull(board))
|
|
return ITEM_INTERACT_BLOCKING
|
|
if(loc == user)
|
|
balloon_alert(user, "can't deploy in hand")
|
|
return ITEM_INTERACT_BLOCKING
|
|
else if(isturf(loc))
|
|
var/turf/location = loc
|
|
if(!isopenturf(location))
|
|
balloon_alert(user, "can't deploy here")
|
|
return ITEM_INTERACT_BLOCKING
|
|
else if(location.is_blocked_turf(source_atom = src))
|
|
balloon_alert(user, "no space for deployment")
|
|
return ITEM_INTERACT_BLOCKING
|
|
balloon_alert_to_viewers("deploying!")
|
|
if(!do_after(user, 1 SECONDS, target = src))
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
new /obj/effect/temp_visual/mook_dust(loc)
|
|
var/obj/machinery/new_machine = new board.build_path(loc)
|
|
loc.visible_message(span_warning("[src] deploys!"))
|
|
playsound(src, 'sound/machines/terminal/terminal_eject.ogg', 70, TRUE)
|
|
new_machine.on_construction(user)
|
|
qdel(src)
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
///Maximum number of flatpacks in a cart
|
|
#define MAX_FLAT_PACKS 3
|
|
|
|
/obj/structure/flatpack_cart
|
|
name = "flatpack cart"
|
|
desc = "A cart specifically made to hold flatpacks from a flatpacker, evenly distributing weight. Convenient!"
|
|
icon = 'icons/obj/structures.dmi'
|
|
icon_state = "flatcart"
|
|
density = TRUE
|
|
opacity = FALSE
|
|
|
|
/obj/structure/flatpack_cart/Initialize(mapload)
|
|
. = ..()
|
|
|
|
register_context()
|
|
|
|
AddElement(/datum/element/noisy_movement, volume = 45) // i hate noise
|
|
|
|
/obj/structure/flatpack_cart/atom_deconstruct(disassembled)
|
|
for(var/atom/movable/content as anything in contents)
|
|
content.forceMove(drop_location())
|
|
|
|
/obj/structure/flatpack_cart/add_context(atom/source, list/context, obj/item/held_item, mob/user)
|
|
. = NONE
|
|
if(isnull(held_item))
|
|
return
|
|
|
|
if(istype(held_item, /obj/item/flatpack))
|
|
context[SCREENTIP_CONTEXT_LMB] = "Load pack"
|
|
return CONTEXTUAL_SCREENTIP_SET
|
|
|
|
/obj/structure/flatpack_cart/examine(mob/user)
|
|
. = ..()
|
|
if(!in_range(user, src) && !isobserver(user))
|
|
return
|
|
|
|
. += "From bottom to top, this cart contains:"
|
|
for(var/obj/item/flatpack as anything in contents)
|
|
. += flatpack.name
|
|
|
|
/obj/structure/flatpack_cart/update_overlays()
|
|
. = ..()
|
|
|
|
var/offset = 0
|
|
for(var/item in contents)
|
|
var/mutable_appearance/flatpack_overlay = mutable_appearance(icon, "flatcart_flat", layer = layer + (offset * 0.01))
|
|
flatpack_overlay.pixel_z = offset
|
|
offset += 4
|
|
. += flatpack_overlay
|
|
|
|
/obj/structure/flatpack_cart/attack_hand(mob/user, list/modifiers)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
user.put_in_hands(contents[length(contents)]) //topmost box
|
|
update_appearance(UPDATE_OVERLAYS)
|
|
|
|
/obj/structure/flatpack_cart/item_interaction(mob/living/user, obj/item/attacking_item, params)
|
|
if(!istype(attacking_item, /obj/item/flatpack) || user.combat_mode || attacking_item.flags_1 & HOLOGRAM_1 || attacking_item.item_flags & ABSTRACT)
|
|
return ITEM_INTERACT_SKIP_TO_ATTACK
|
|
|
|
if (length(contents) >= MAX_FLAT_PACKS)
|
|
balloon_alert(user, "full!")
|
|
return ITEM_INTERACT_BLOCKING
|
|
if (!user.transferItemToLoc(attacking_item, src))
|
|
return ITEM_INTERACT_BLOCKING
|
|
update_appearance(UPDATE_OVERLAYS)
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
#undef MAX_FLAT_PACKS
|
|
|
|
// Engineering flatpacks
|
|
|
|
/obj/item/flatpack/flatpacker // a roundstart flatpacker is NICE you can gahdamn tell the time and everythin'
|
|
name = "flatpacker"
|
|
board = /obj/item/circuitboard/machine/flatpacker
|
|
custom_premium_price = PAYCHECK_COMMAND
|
|
|
|
// Cargo flatpacks
|
|
|
|
/obj/item/flatpack/mailsorter // to have a roundstart mail sorter at cargo
|
|
name = "mail sorter"
|
|
board = /obj/item/circuitboard/machine/mailsorter
|
|
custom_premium_price = PAYCHECK_CREW * 1.5
|