/tg/ Station 13 - Modules - Types — Var Details - Proc Details

Bouncy element

Makes a thrown movable rebound after it hits something, losing distance on every rebound.

Rebounds of a tile or more are real throws with a hop arc. A rebound under a tile cannot leave its turf, so it becomes a decelerating slide within the turf, which ends the chain.

The throw a player makes behaves exactly as before, including damage and catching. Only the rebounds are new, and a rebound never strikes the obstacles it runs into: it does no damage, pushes nothing, cannot be caught and sets off no hitby() reactions. Bump reactions, such as a door opening or a portal teleporting it, still happen. Rebounds are skipped without gravity, where thrown objects already drift.

Vars

bounce_soundSound played at each rebound, on top of the object's own landing sounds. Null for none.
bounce_sound_volumeVolume of /datum/element/bouncy/var/bounce_sound.
bounces_this_tickBounces started in the current tick, across every bouncy profile. See BOUNCE_MAX_PER_TICK.
budget_tickworld.time of the tick /datum/element/bouncy/var/bounces_this_tick counts. Shared by every bouncy profile.
deflect_chancePercent chance for each rebound to veer 45 degrees off its ideal direction.
eject_hop_rangeTiles the object travels in a random direction when ejected from a ballistic gun as a casing. Zero disables ejection hops.
max_bouncesMost rebounds one throw or ejection can chain into.
restitutionFraction (0 to 1) of the incoming travel distance each rebound keeps. Lower values settle sooner.

Procs

hopPlays a rise-and-fall arc on the object's vertical draw offset, without moving it.
on_ejectedSends an ejected ammo casing hopping away from the gun.
on_impactQueues the first rebound after an ordinary throw, unless the thing hit caught or blocked the object.
queue_reboundWorks out where the rebound from one impact goes and schedules it.
reboundPerforms one rebound, if the object is still loose where it landed.
reflect_directionReflects a travel direction off an obstacle.
schedule_reboundSchedules a bounce, if it is at least BOUNCE_MINIMUM_DISTANCE and the shared per-tick budget has room for it. The bounce is capped at BOUNCE_MAX_DISTANCE.
slide_within_turfSlides the object part of a tile in a direction, decelerating to rest without leaving its turf.

Var Details

bounce_sound

Sound played at each rebound, on top of the object's own landing sounds. Null for none.

bounce_sound_volume

Volume of /datum/element/bouncy/var/bounce_sound.

bounces_this_tick

Bounces started in the current tick, across every bouncy profile. See BOUNCE_MAX_PER_TICK.

budget_tick

world.time of the tick /datum/element/bouncy/var/bounces_this_tick counts. Shared by every bouncy profile.

deflect_chance

Percent chance for each rebound to veer 45 degrees off its ideal direction.

eject_hop_range

Tiles the object travels in a random direction when ejected from a ballistic gun as a casing. Zero disables ejection hops.

max_bounces

Most rebounds one throw or ejection can chain into.

restitution

Fraction (0 to 1) of the incoming travel distance each rebound keeps. Lower values settle sooner.

Proc Details

hop

Plays a rise-and-fall arc on the object's vertical draw offset, without moving it.

Uses relative pixel_z steps in parallel, so it composes with spin animations, movement gliding and the pixel_x/pixel_y offsets items rest at.

Arguments:

on_ejected

Sends an ejected ammo casing hopping away from the gun.

COMSIG_CASING_EJECTED is sent before the wielder tries to catch the casing, so a caught casing is in a hand by the time /datum/element/bouncy/proc/rebound checks it, and stays there. The hop lands silently, since everything that sends the signal also plays the casing's clatter itself, through bounce_away().

on_impact

Queues the first rebound after an ordinary throw, unless the thing hit caught or blocked the object.

A throw with no thrower aimed at the object's own tile, such as a slimeperson's core tossed loose by its melting body, lands at once. The object then pops away in a random direction as far as the throw's range. Small explosions can toss things the same way, too weakly to do more than nudge them.

queue_rebound

Works out where the rebound from one impact goes and schedules it.

Arguments:

rebound

Performs one rebound, if the object is still loose where it landed.

A rebound of at least one tile is thrown. A shorter one slides within the turf instead and ends the chain.

Arguments:

reflect_direction

Reflects a travel direction off an obstacle.

Flips each axis of travel that points toward the obstacle, like a ball glancing off a wall. An obstacle that no travel axis points toward, such as one sharing the object's turf, sends it straight back.

Arguments:

schedule_rebound

Schedules a bounce, if it is at least BOUNCE_MINIMUM_DISTANCE and the shared per-tick budget has room for it. The bounce is capped at BOUNCE_MAX_DISTANCE.

Arguments:

Returns whether the bounce was scheduled.

slide_within_turf

Slides the object part of a tile in a direction, decelerating to rest without leaving its turf.

Arguments: