Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: Flipping helper #5935

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions _maps/map_files/Delta/delta.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -93575,10 +93575,9 @@
/area/engine/engineering)
"qDc" = (
/obj/effect/decal/cleanable/dirt,
/obj/structure/table/wood{
flipped = 1
},
/obj/structure/table/wood,
/obj/effect/spawner/lootdrop/maintenance,
/obj/effect/mapping_helpers/table_flip,
/turf/simulated/floor/plasteel{
dir = 8;
icon_state = "neutralcorner"
Expand Down
12 changes: 12 additions & 0 deletions code/game/objects/effects/mapping_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,18 @@
T.light_range = light_range
. = ..()

/obj/effect/mapping_helpers/table_flip //used to flip tables. That's all.
name = "Table flip"
icon_state = "table_flip"
late = TRUE //initialize table and loot first

/obj/effect/mapping_helpers/table_flip/LateInitialize()
. = ..()
var/obj/structure/table/to_flip = locate(/obj/structure/table) in get_turf(src)
if(to_flip)
to_flip.flip(dir, throw_around = FALSE) //subsytems aren't ready for things go flying
qdel(src)

// Used by mapmerge2 to denote the existence of a merge conflict (or when it has to complete a "best intent" merge where it dumps the movable contents of an old key and a new key on the same tile).
// We define it explicitly here to ensure that it shows up on the highest possible plane (while giving off a verbose icon) to aide mappers in resolving these conflicts.
// DO NOT USE THIS IN NORMAL MAPPING!!! Linters WILL fail.
Expand Down
16 changes: 8 additions & 8 deletions code/game/objects/structures/tables_racks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@

/obj/structure/table/Initialize(mapload)
. = ..()
if(flipped)
update_icon(UPDATE_ICON_STATE)
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = PROC_REF(on_entered),
COMSIG_ATOM_EXIT = PROC_REF(on_exit),
Expand Down Expand Up @@ -388,16 +386,18 @@



/obj/structure/table/proc/flip(direction)
/obj/structure/table/proc/flip(direction, throw_around = TRUE)
if(flipped)
return FALSE

if(!straight_table_check(turn(direction, 90)) || !straight_table_check(turn(direction, -90)))
return FALSE

var/list/targets = list(get_step(src, dir), get_step(src, turn(dir, 45)), get_step(src, turn(dir, -45)))
for(var/atom/movable/thing in get_turf(src))
if(!thing.anchored)
if(throw_around)
var/list/targets = list(get_step(src, dir), get_step(src, turn(dir, 45)), get_step(src, turn(dir, -45)))
for(var/atom/movable/thing in get_turf(src))
if(thing.anchored)
continue
INVOKE_ASYNC(thing, TYPE_PROC_REF(/atom/movable, throw_at), pick(targets), 1, 1)

dir = direction
Expand All @@ -412,7 +412,7 @@
for(var/check_dir in list(turn(direction, 90), turn(direction, -90)))
var/obj/structure/table/other_table = locate(/obj/structure/table, get_step(src, check_dir))
if(other_table)
other_table.flip(direction)
other_table.flip(direction, throw_around)
update_icon(UPDATE_ICON_STATE)

creates_cover = FALSE
Expand Down Expand Up @@ -523,7 +523,7 @@
table_shatter(M)


/obj/structure/table/glass/flip(direction)
/obj/structure/table/glass/flip(direction, throw_around = TRUE)
deconstruct(FALSE)
return TRUE

Expand Down
Binary file modified icons/effects/mapping_helpers.dmi
Binary file not shown.