mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-30 11:01:35 +00:00
## About The Pull Request Adds cliffs to the game! They're tiles usable for mapping to make mountainy area's and cliffs! I don't have any sprites for them yet, so just imagine it's a cliff really hard  THESE DO NOT REPLACE MULTI-Z AND NEVER WILL! They're just a neat way to add more depth to the game. You can’t really add 10 different z’s for one mountain, so this can be used to help map area’s with depth without overusing z-levels They've been mapped into the top part of the icebox outside. There's not a good way to do sides of cliffs yet (will need some thinking), so they're mapped in such a fashion where it doesn't matter much. Later, this area above icebox can be expanded with properly done side-cliffs, something like in stardew-valley would work for our grid-system:  Longer demonstration: https://www.youtube.com/watch?v=Eig4jXNZZRQ Eventually, I'll redo mapgen and add 3x3 icebox (definitely not coping) ## Why It's Good For The Game The incredible flatness of icebox drives me insane. While multi-z is great at giving it more depth, the actual terrain itself is still completely flat. Adding cliffs let's us add 'soft-mountains', which does wonders for making an area feel more alive (And I absolutely adore snowy mountains) ## Changelog 🆑 add: Adds cliffs to the north of icebox. Try not to fall of of them! /🆑 <details> <summary>Additional images (now outdated)</summary> https://github.com/tgstation/tgstation/assets/7501474/572dc749-596c-4cab-9693-43c2270aca96     </details> --------- Co-authored-by: Jacquerel <hnevard@gmail.com>
62 lines
2.3 KiB
Plaintext
62 lines
2.3 KiB
Plaintext
/// Subsystem to handle falling of off cliffs
|
|
MOVEMENT_SUBSYSTEM_DEF(cliff_falling)
|
|
name = "Cliff Falling"
|
|
priority = FIRE_PRIORITY_CLIFF_FALLING
|
|
flags = SS_NO_INIT|SS_TICKER
|
|
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
|
|
|
|
/// Who are currently falling and with which movemanager?
|
|
var/list/cliff_grinders = list()
|
|
|
|
/datum/controller/subsystem/movement/cliff_falling/proc/start_falling(atom/movable/faller, turf/open/cliff/cliff)
|
|
// Make them move
|
|
var/mover = SSmove_manager.move(moving = faller, direction = cliff.fall_direction, delay = cliff.fall_speed, subsystem = src, priority = MOVEMENT_ABOVE_SPACE_PRIORITY, flags = MOVEMENT_LOOP_OUTSIDE_CONTROL | MOVEMENT_LOOP_NO_DIR_UPDATE)
|
|
|
|
cliff_grinders[faller] = mover
|
|
|
|
RegisterSignal(faller, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
|
|
RegisterSignal(faller, COMSIG_QDELETING, PROC_REF(clear_references))
|
|
RegisterSignal(faller, COMSIG_MOVABLE_PRE_MOVE, PROC_REF(check_move))
|
|
|
|
/// We just moved, so check if we're still moving right
|
|
/datum/controller/subsystem/movement/cliff_falling/proc/on_moved(atom/movable/mover, turf/old_loc)
|
|
SIGNAL_HANDLER
|
|
|
|
var/turf/open/cliff/new_cliff = mover.loc
|
|
if(!iscliffturf(new_cliff)) //not a cliff, lets clean up
|
|
var/datum/move_loop/move/falling = cliff_grinders[mover]
|
|
clear_references(mover)
|
|
qdel(falling)
|
|
return
|
|
|
|
new_cliff.on_fall(mover)
|
|
|
|
if(old_loc.type == new_cliff) //same type of cliff, no worries
|
|
return
|
|
|
|
var/datum/move_loop/move/fall = cliff_grinders[mover]
|
|
fall.set_delay(new_cliff.fall_speed) //different cliff, so set the speed
|
|
|
|
/datum/controller/subsystem/movement/cliff_falling/proc/on_qdel(atom/movable/deletee)
|
|
SIGNAL_HANDLER
|
|
|
|
clear_references(deletee)
|
|
|
|
/datum/controller/subsystem/movement/cliff_falling/proc/clear_references(atom/movable/deletee)
|
|
cliff_grinders -= deletee
|
|
|
|
UnregisterSignal(deletee, list(COMSIG_MOVABLE_MOVED, COMSIG_QDELETING, COMSIG_MOVABLE_PRE_MOVE))
|
|
|
|
/// Check if we can move! We do this mostly to determine falling behaviour and make sure we're moving to valid tiles
|
|
/datum/controller/subsystem/movement/cliff_falling/proc/check_move(atom/movable/mover, turf/target)
|
|
SIGNAL_HANDLER
|
|
|
|
var/turf/open/cliff/cliff_turf = get_turf(mover)
|
|
|
|
if(!iscliffturf(cliff_turf)) //we arent on a cliff, WHY ARE WE HERE???
|
|
clear_references(mover)
|
|
return
|
|
|
|
if(!cliff_turf.can_move(mover, target))
|
|
return COMPONENT_MOVABLE_BLOCK_PRE_MOVE
|