Skip to content

Commit

Permalink
[knockback3] knockback3 ignore air units by default (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cokemonkey11 committed Apr 6, 2021
1 parent b67b8e7 commit 3c1ff4f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions wurst/util/Knockback3.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ import Objects
public interface TerrainZProvider
function get(vec3 where) returns real

/** A unit -> bool function. */
public interface UnitFilter
function get(unit which) returns bool

/**
If configured, provides an alternative source for getting terrain z-height.
This can be useful for avoiding a desync in some cases.
Expand All @@ -57,6 +61,10 @@ Warning: this is not a lock-safe form of crowd control.
*/
@configurable let USE_PROP_WINDOW_MODIFIERS = true

/** Units must match this filter, or Knockback3 takes no effect. */
@configurable UnitFilter UNIT_FILTER = (unit u) -> not u.isType(UNIT_TYPE_FLYING)


public class Knockback3
use LinkedListModule

Expand Down Expand Up @@ -107,6 +115,9 @@ public class Knockback3
parameters, respectively. Example:
*/
static function add(unit u, real velocity, angle groundAngle, angle airAngle)
if not UNIT_FILTER.get(u)
return

let instVel = velocity * ANIMATION_PERIOD
let v = ZERO3.polarProject(instVel, groundAngle, airAngle)
if unitNodes.has(u)
Expand Down

0 comments on commit 3c1ff4f

Please sign in to comment.