/// The minimum for glide_size to be clamped to. #define MIN_GLIDE_SIZE 1 /// The maximum for glide_size to be clamped to. /// This shouldn't be higher than the icon size, and generally you shouldn't be changing this, but it's here just in case. #define MAX_GLIDE_SIZE ICON_SIZE_ALL /// Compensating for time dilation GLOBAL_VAR_INIT(glide_size_multiplier, 1.0) ///Broken down, here's what this does: /// divides the world icon_size by delay divided by ticklag to get the number of pixels something should be moving each tick. /// The division result is given a min value of 1 to prevent obscenely slow glide sizes from being set /// Then that's multiplied by the global glide size multiplier. 1.25 by default feels pretty close to spot on. This is just to try to get byond to behave. /// The whole result is then clamped to within the range above. /// Not very readable but it works #define DELAY_TO_GLIDE_SIZE(delay) (clamp(((ICON_SIZE_ALL / max((delay) / world.tick_lag, 1)) * GLOB.glide_size_multiplier), MIN_GLIDE_SIZE, MAX_GLIDE_SIZE)) ///Similar to DELAY_TO_GLIDE_SIZE, except without the clamping, and it supports piping in an unrelated scalar #define MOVEMENT_ADJUSTED_GLIDE_SIZE(delay, movement_disparity) (ICON_SIZE_ALL / ((delay) / world.tick_lag) * movement_disparity * GLOB.glide_size_multiplier) //Movement loop priority. Only one loop can run at a time, this dictates that // Higher numbers beat lower numbers ///Standard, go lower then this if you want to override, higher otherwise #define MOVEMENT_DEFAULT_PRIORITY 10 ///Very few things should override this #define MOVEMENT_SPACE_PRIORITY 100 ///Higher then the heavens #define MOVEMENT_ABOVE_SPACE_PRIORITY (MOVEMENT_SPACE_PRIORITY + 1) //Movement loop flags ///Should the loop act immediately following its addition? #define MOVEMENT_LOOP_START_INSTANT (1<<0) ///Should the loop act as soon as is reasonable? ///(always 1 tick after the next visual tick, makes behavior consistent regardless of when the SS fires in the tick) #define MOVEMENT_LOOP_START_FAST (1<<1) ///Do we not use the priority system? #define MOVEMENT_LOOP_IGNORE_PRIORITY (1<<2) ///Should we override the loop's glide? #define MOVEMENT_LOOP_IGNORE_GLIDE (1<<3) ///Should we not update our movables dir on move? #define MOVEMENT_LOOP_NO_DIR_UPDATE (1<<4) ///Is the loop moving the movable outside its control, like it's an external force? e.g. footsteps won't play if enabled. #define MOVEMENT_LOOP_OUTSIDE_CONTROL (1<<5) // Movement loop status flags /// Has the loop been paused, soon to be resumed? #define MOVELOOP_STATUS_PAUSED (1<<0) /// Is the loop running? (Is true even when paused) #define MOVELOOP_STATUS_RUNNING (1<<1) /// Is the loop queued in a subsystem? #define MOVELOOP_STATUS_QUEUED (1<<2) /** * Returns a bitfield containing flags both present in `flags` arg and the `processing_move_loop_flags` move_packet variable. * Has no use outside of procs called within the movement proc chain. */ #define CHECK_MOVE_LOOP_FLAGS(movable, flags) (movable.move_packet ? (movable.move_packet.processing_move_loop_flags & (flags)) : NONE) //Index defines for movement bucket data packets #define MOVEMENT_BUCKET_TIME 1 #define MOVEMENT_BUCKET_LIST 2 /** * currently_z_moving defines. Higher numbers mean higher priority. * This one is for falling down open space from stuff such as deleted tile, pit grate... */ #define CURRENTLY_Z_FALLING 1 /// currently_z_moving is set to this in zMove() if 0. #define CURRENTLY_Z_MOVING_GENERIC 2 /// This one is for falling down open space from movement. #define CURRENTLY_Z_FALLING_FROM_MOVE 3 /// This one is for going upstairs. #define CURRENTLY_Z_ASCENDING 4 /// possible bitflag return values of [atom/proc/intercept_zImpact] calls /// Stops the movable from falling further and crashing on the ground. Example: stairs. #define FALL_INTERCEPTED (1<<0) /// Suppresses the "[movable] falls through [old_turf]" message because it'd make little sense in certain contexts like climbing stairs. #define FALL_NO_MESSAGE (1<<1) /// Used when the whole intercept_zImpact forvar loop should be stopped. For example: when someone falls into the supermatter and becomes dust. #define FALL_STOP_INTERCEPTING (1<<2) /// Used when the grip on a pulled object shouldn't be broken. #define FALL_RETAIN_PULL (1<<3) /// Runs check_pulling() by the end of [/atom/movable/proc/zMove] for every movable that's pulling something. Should be kept enabled unless you know what you are doing. #define ZMOVE_CHECK_PULLING (1<<0) /// Checks if pulledby is nearby. if not, stop being pulled. #define ZMOVE_CHECK_PULLEDBY (1<<1) /// flags for different checks done in [/atom/movable/proc/can_z_move]. Should be self-explainatory. #define ZMOVE_FALL_CHECKS (1<<2) #define ZMOVE_CAN_FLY_CHECKS (1<<3) #define ZMOVE_INCAPACITATED_CHECKS (1<<4) /// Doesn't call zPassIn() and zPassOut() #define ZMOVE_IGNORE_OBSTACLES (1<<5) /// Gives players chat feedbacks if they're unable to move through z levels. #define ZMOVE_FEEDBACK (1<<6) /// Whether we check the movable (if it exists) the living mob is buckled on or not. #define ZMOVE_ALLOW_BUCKLED (1<<7) /// If the movable is actually ventcrawling vertically. #define ZMOVE_VENTCRAWLING (1<<8) /// Includes movables that're either pulled by the source or mobs buckled to it in the list of moving movables. #define ZMOVE_INCLUDE_PULLED (1<<9) /// Skips check for whether the moving atom is anchored or not. #define ZMOVE_ALLOW_ANCHORED (1<<10) #define ZMOVE_CHECK_PULLS (ZMOVE_CHECK_PULLING|ZMOVE_CHECK_PULLEDBY) /// Flags used in "Move Upwards" and "Move Downwards" verbs. #define ZMOVE_FLIGHT_FLAGS (ZMOVE_CAN_FLY_CHECKS|ZMOVE_INCAPACITATED_CHECKS|ZMOVE_CHECK_PULLS|ZMOVE_ALLOW_BUCKLED|ZMOVE_INCLUDE_PULLED) /// Used when walking upstairs #define ZMOVE_STAIRS_FLAGS (ZMOVE_CHECK_PULLEDBY|ZMOVE_ALLOW_BUCKLED) /// Used for falling down open space. #define ZMOVE_FALL_FLAGS (ZMOVE_FALL_CHECKS|ZMOVE_ALLOW_BUCKLED) //Diagonal movement is split into two cardinal moves /// The first step of the diagnonal movement #define FIRST_DIAG_STEP 1 /// The second step of the diagnonal movement #define SECOND_DIAG_STEP 2 /// Classic bluespace teleportation, requires a sender but no receiver #define TELEPORT_CHANNEL_BLUESPACE "bluespace" /// Quantum-based teleportation, requires both sender and receiver, but is free from normal disruption #define TELEPORT_CHANNEL_QUANTUM "quantum" /// Wormhole teleportation, is not disrupted by bluespace fluctuations but tends to be very random or unsafe #define TELEPORT_CHANNEL_WORMHOLE "wormhole" /// Magic teleportation, does whatever it wants (unless there's antimagic) #define TELEPORT_CHANNEL_MAGIC "magic" /// Cult teleportation, does whatever it wants (unless there's holiness) #define TELEPORT_CHANNEL_CULT "cult" /// Anything else #define TELEPORT_CHANNEL_FREE "free" // Container flags for get_teleportable_container /// Count mob inventory as a valid container #define TELEPORT_CONTAINER_INCLUDE_INVENTORY (1<<0) /// Count modsuits with at least one sealed part as valid containers, even if mob inventory is not a valid container #define TELEPORT_CONTAINER_INCLUDE_SEALED_MODSUIT (1<<1) /// Count atom storage as a valid container #define TELEPORT_CONTAINER_INCLUDE_STORAGE (1<<2) /// Count closets as a valid container #define TELEPORT_CONTAINER_INCLUDE_CLOSET (1<<3) /// Count vehicles as a valid container #define TELEPORT_CONTAINER_INCLUDE_VEHICLE (1<<4) /// Count mech equipment (particularly cargo holds and sleepers) as a valid container #define TELEPORT_CONTAINER_INCLUDE_MECH_EQUIPMENT (1<<5) /// Count stomachs as a valid container (ew) #define TELEPORT_CONTAINER_INCLUDE_STOMACH (1<<6) ///Return values for moveloop Move() #define MOVELOOP_FAILURE 0 #define MOVELOOP_SUCCESS 1 #define MOVELOOP_NOT_READY 2 #define NEWTONS *1 #define DEFAULT_INERTIA_SPEED 5 /// Maximum inertia that an object can hold. Used to prevent objects from getting to stupid speeds. #define INERTIA_FORCE_CAP 25 NEWTONS // Results in maximum speed of 1 tile per tick, capped at about 2/3rds of maximum force #define INERTIA_SPEED_COEF 0.375