Function TerrainDeformationWaveBJ
- Line
- 1984
- Location
- blizzard.j
- Constant?
- no
- Type
- function
- Arguments
- real duration, location source, location target, real radius, real depth, real trailDelay
- Returns
- terraindeformation
| 1984 | function TerrainDeformationWaveBJ takes real duration, location source, location target, real radius, real depth, real trailDelay returns terraindeformation |
| 1985 | local real distance |
| 1986 | local real dirX |
| 1987 | local real dirY |
| 1988 | local real speed |
| 1989 | |
| 1990 | set distance = DistanceBetweenPoints(source, target) |
| 1991 | if (distance == 0 or duration <= 0) then |
| 1992 | return null |
| 1993 | endif
|
| 1994 | |
| 1995 | set dirX = (GetLocationX(target) - GetLocationX(source)) / distance |
| 1996 | set dirY = (GetLocationY(target) - GetLocationY(source)) / distance |
| 1997 | set speed = distance / duration |
| 1998 | |
| 1999 | set bj_lastCreatedTerrainDeformation = TerrainDeformWave(GetLocationX(source), GetLocationY(source), dirX, dirY, distance, speed, radius, depth, R2I(trailDelay * 1000), 1) |
| 2000 | return bj_lastCreatedTerrainDeformation |
| 2001 | endfunction
|