A_LightningClip

From ZDoom Wiki
Jump to navigation Jump to search

A_LightningClip
(no parameters)

If the calling actor has the FLOORHUGGER flag and does not have a valid lastenemy field, the function does nothing.

Otherwise, clips to the appropriate surface (the floor if a floorhugger, the ceiling otherwise — this function will not work logically if the calling actor has neither the FLOORHUGGER nor the CEILINGHUGGER flags). A floorhugger's target is set to its lastenemy's tracer, a ceilinghugger's target is instead set directly to its tracer. (A missile normally uses the target field to keep track of its owner, but a missile using this codepointer cannot.)

If a floorhugger, the calling actor and its companion designated by the lastenemy field are then thrust by one unit either to the left (50% chance if its special1 field is less than 2, 100% if that field is less than -2) or to the right (the rest of the time). The special1 field is incremented when going to the left, and decremented when going to the right.

If its target is dead, the calling actor then explodes, otherwise it is aimed, and thrust by half its speed, towards the target.

This codepointer is restricted to LightningCeiling and derived classes.