fuaZandroX modding reference

Sticking

A sticky projectile latches onto the wall, floor, ceiling or actor it hits instead of exploding on it, and rides it from then on: a bomb that clings to a player until it goes off, a dart stuck in a monster, a mine on a lift that rides up with it.

Availability

ZandroX only. Does not exist in Zandronum 3.2 or in any other port.

Projectiles stick on impact (+MISSILE, which Projectile sets). Any actor but a player's body can be stuck to another by A_fua_Stick or ACS. Works in netgames: the server decides every stick, and each client keeps its copy on its own copy of the host, with no traffic while it rides.

The short version

ACTOR StickyBomb
{
    Radius 6
    Height 6
    Speed 30
    Damage 1
    Projectile
    +STICKY
    +HITTRACER
    States
    {
    Spawn:
        BAL1 A 1
        Loop
    Stick:
        BAL1 AB 4
        BAL1 ABABABAB 2
        Goto Detonate
    Stick.Lost:
    Detonate:
        BAL1 C 0 A_fua_Unstick
        BAL1 C 4 A_Explode(64, 96)
        BAL1 DE 4
        Stop
    }
}

Fired at anything, it clings there for about a second, flashing, then lets go and blows up. Stuck to a monster or a player it rides along with them; if they die first it blows up at once.

What it sticks to

Flag Sticks to
+STICKY all four below at once
+STICKTOWALLS a wall: a line's face, a step's riser, a door's face, a 3D floor's side
+STICKTOFLOORS a floor it comes down on, a 3D floor's top included
+STICKTOCEILINGS a ceiling it goes up into, a 3D floor's bottom included
+STICKTOACTORS an actor it strikes

It sticks where it would have exploded, and only there: an A_Die, a countdown or anything else that explodes it without an impact explodes it as before. Where a surface's flag is missing it explodes as before. A bouncer sticks where its last bounce would have ended it, and a burrowing projectile sticks to what it cannot burrow through. One fired point-blank into a door or a lift rides it as one that flew into it would.

A burrowing projectile that sticks to what it strikes on its way through sticks where it would have exploded, in the open (just outside the face it came out of when what it struck stands beside that face), and leaves its Burrow state as it would on coming out: back to Spawn if a Burrow state took it, then into its Stick state if it has one.

These refuse it, and it explodes instead:

How it rides

  • On an actor it keeps the offset it struck at, world-aligned, so it stays on the same side of the actor however the actor turns. With +STICKFOLLOWANGLE the offset and its facing turn with the actor instead: stuck in a monster's back, it stays in its back.
  • On moving geometry it rides what moves that part of the wall: a lift's riser with the lift, a door's face with the door, a 3D floor's side or top with the 3D floor, a polyobject's face with the polyobject (turning with it too). A floor or ceiling it stuck to carries it up and down.
  • Each tic the engine places it on its host after everything has moved, so it never trails a tic behind, and a script reading it sees it on its host.
  • It is never clipped while stuck: on a player walking under a low ceiling it pokes into the ceiling.
  • An actor and what rides it are one body. The actor's own shots, projectiles and moves pass what is stuck to it, and what is stuck to it passes the actor, so a shootable bomb on a player is never set off by that player's own fire, while anyone else can still shoot it. A projectile with +HITOWNER can hit its shooter's riders as it can its shooter.

Losing its host

When the actor it rides is removed, becomes a spectator or dies, it goes to its Stick.Lost state; without one it explodes as it would have on impact. With +STICKPASTDEATH it stays on the body until the body is removed, even when the player respawns elsewhere. An actor that morphs, or turns back (its death undoing the morph included), carries it into its new body.

States and calls

  • Stick, Stick.Actor, Stick.Wall, Stick.Floor, Stick.Ceiling are entered on sticking, and Stick.Lost when the host is lost.
  • A_fua_Unstick lets go; it stays where it is, at rest, and flies or falls again as its flags and velocity say. It can stick again on its next impact.
  • A_fua_Stick sticks any actor to another, at an offset if asked.
  • StickHostAlpha fades it for the view from its host's own body, so a bomb on a player does not hide what they see.
  • +HITTRACER, +HITMASTER and +HITTARGET take the actor it stuck to, as on an explosion.
  • ACS sticks, reads and lets go the same way, and finds what is stuck to an actor: Sticking in ACS.

What its states can read

Expression What it is
StuckTo what holds it: 0 nothing, 1 an actor, 2 a wall, 3 a floor, 4 a ceiling (FUA_STUCK_NONE to FUA_STUCK_CEILING)
StuckTics how many tics it has been stuck
StuckOffsetX, StuckOffsetY, StuckOffsetZ its offset from the actor it rides (forward, left and up of it under +STICKFOLLOWANGLE); for a wall, floor or ceiling, where it stuck, its z above the plane that carries it
StuckCount how many actors are stuck to this one, for the host's own states

Replacing a warp loop

Before, a bomb that clings to a player meant a Death state of dozens of A_Warp(AAPTR_TRACER, user_x, user_y, user_z, ...) frames, each checked against an ACS script that asks whether the player still exists, user variables for the offset and another script to work it out. It ran on the server alone, sent a move every tic, and trailed the player by a tic whenever the player thought after it. +STICKY with a Stick.Actor state and a Stick.Lost state does all of that, with none of the ACS.

Netplay

  • The server decides each stick and sends it once; every client places its copy from its own copy of the host each tic. A client never sticks a server's projectile itself: where its copy strikes something it would stick to, it waits there for the server's word.
  • A player who joins later sees every stuck actor on its host, in the frame it is in.
  • Under the snapshot netcode, a projectile stuck to your own player is drawn on your player as you move, not a ping behind.

See also