You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: common/systems/LuaCollisionSystem.md
+4-11Lines changed: 4 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,19 +4,12 @@
4
4
5
5
### Behavior
6
6
7
-
##### *"collisions"* table
8
-
9
-
Whenever a `Collision` packet is received, the `LuaCollisionSystem` adds an entry to the ***"collisions"*** table in the `LuaSystem`'s state.
10
-
11
-
After receiving a `Collision` between two entities *"A"* and *"B"*, the following will be true:
7
+
Upon construction, a global `collisionHandlers` table is definde in the `LuaSystem`'s state. This table can be populated by scripts by adding functions with the following prototype:
12
8
13
9
```lua
14
-
collisions["A"] =="B"
15
-
collisions["B"] =="A"
10
+
function (name, otherName) end
16
11
```
17
12
18
-
The table is never purged or reset. Once a collision is processed, scripts should remove it from the table.
19
-
20
-
##### Collision handlers
13
+
`name` and `otherName` are the names of the [GameObjects](../../GameObject.md) involved in the collision.
21
14
22
-
Whenever a `Collision` packet is received, the `LuaCollisionSystem`also looks for a `collis
15
+
Whenever a `Collision` packet is received, the `LuaCollisionSystem`iterates over the `collisionHandlers` table and calls each handler it contains with the name of the two `GameObjects` involved.
0 commit comments