Commit Graph

53 Commits

Author SHA1 Message Date
DokaDoka
f8788d74b6 fix(client/zones): abort triangle creation if polygon is not simple 2023-01-15 16:20:11 +11:00
DokaDoka
ba9380b39a feat(client/zones): ensure polyzone is coplanar 2023-01-13 22:26:50 +11:00
DokaDoka
6e10ebe464 feat(client/zones): break triangle creating loop of it is going to deadloop 2023-01-13 16:08:37 +11:00
DokaDoka
0e052ed7c5 fix(client/zones): get diagonal offsets in 2d
avoids floating point weirdness with the z coord
2023-01-13 16:07:25 +11:00
DokaDoka
6bfd6091d7 refactor(client/zones): break polygon into triangles with the ear clipping method 2023-01-07 19:16:36 +11:00
Linden
012b68a3be fix(client/zones): remove all zone references
Should resolve #191.
2022-12-30 21:07:32 +11:00
Linden
6a704c40fe refactor(client/zones): re-order zones and call onExit before onEnter
insideZones will be stored as a map rather than an array for simplicity.
Store zones the player is entering and exiting, then sort based on distance;
always triggering onExit for all zones before onEnter.
See #179.
2022-12-24 16:08:21 +11:00
Linden
08a725105b fix(client/zones): disable marker rotation 2022-12-17 06:21:22 +11:00
DokaDoka
61a940a188 refactor(client/zones): redo triangle algorithm 2022-12-13 14:29:23 +11:00
Linden
9b7eef2880 fix(client/zones): convert vector4 to vector3
Sometimes people send the incorrect types, and it's apparently on us (???)
to allow them to do the wrong thing and catch their mistakes for them.
2022-11-09 16:04:03 +11:00
Linden
0e9ad23fb3 fix: types 2022-10-02 20:19:35 +11:00
DokaDoka
0014dfbe1f fix(client/zones): expand vectors
for oal enjoyers
2022-09-21 14:45:22 +10:00
DokaDoka
ad219b2508 feat(client/zones): debug walls
brings the debug display more in line with the creator
2022-09-20 23:52:56 +10:00
Linden
cd8e4bbd4d fix(client/zones): yet another debug fix
Because a zone vanishing upon entry is of no use.
2022-09-17 18:21:38 +10:00
Linden
032e0e2db1 fix(client/zones): CZone.contains return type 2022-09-14 08:12:12 +10:00
Linden
62d56fa885 refactor(client/zones): add types and change indentation 2022-09-14 08:08:00 +10:00
Linden
26538b8148 refactor(imports): assign modules directly to lib namespace
Mostly a change for improved intellisense with sumneko lua.
Includes some type fixes and deprecation notices.
2022-09-14 01:20:50 +10:00
Linden
0ccdf5675c fix(client/zones): scuffed ternary
Since Lua "ternary" expressions run until they have a truthy value,
boxzone and polyzone will try compare distance to radius.
2022-09-11 12:27:23 +10:00
Linden
57187c8c30 perf(client/zones): reduce overhead
In a naive test with 10k sphere zones vs points, zones ran 0.02~0.04ms higher.
Overhead is roughly halved with these tweaks.
2022-09-11 12:06:30 +10:00
Linden
77ff8e977b feat(client/zones): set cache.coords
People keep asking for coords to be added to cache, but it be problematic
to spam the events system every tick with that information.
If zones is loaded, we can set cache locally without relying on events.
2022-09-11 11:06:38 +10:00
Linden
99b146d7b9 fix(client/zones): zone triggers twice when inside and debug is enabled
Zones would be added to the temporary array twice, so callback functions
and the zone draw would trigger twice.
2022-09-11 11:02:04 +10:00
Linden
5d71c4efdf fix(client/zones): debug erroneously triggers zone:inside
Should only trigger when the player is, in fact, inside the zone.
2022-09-02 22:23:24 +10:00
Linden
3a97a0c569 fix(client/zones): convert tables to vectors
Ensure tables (either array or map) set as points, coords, or size are
converted into vectors.
Includes complementary reformatting.
2022-08-30 02:58:41 +10:00
Linden
46a525e057 fix(zones/client): debug DrawPoly and DrawLine
Debug for boxes broke with the oal fixes, since vectors don't unpack.
Also fixes flicker when entering a debug zone.
2022-08-13 17:08:39 +10:00
Linden
231ca90b8f fix(zones/client): do not overwrite zone.distance with contains
Manually calling the contains method would overwrite zone distance.
Also move Wait to the end of the thread to prevent race conditions.
2022-08-10 23:45:48 +10:00
Linden
d33df54f0e tweak(zones): store distance to zone center
Should make sphere "zones" nearly 1:1 with the points api.
Distance added for polygons too for consistency and some use-cases,
but generally only worthwhile for smaller zones.
2022-06-26 12:30:25 +10:00
Linden
84867900eb fix(zones): zone.inside should not depend on zone.onEnter 2022-05-18 01:46:58 +10:00
DokaDoka
d52d5adac2 fix(zones): debug thickness misalignment and standardize defaults
all total sizes now default to 4
2022-05-14 12:45:50 +10:00
DokaDoka
14ce365de1 fix(zones): thickness workaround
thickness is calculated incorrectly by glm.polygon.contains so this is required until it is fixed
2022-05-14 12:34:12 +10:00
DokaDoka
6a8ebb5a0d chore(zones): rearrange variables 2022-05-11 13:38:27 +10:00
DokaDoka
2a1ae2e287 feat(zones): consistent zone debug appearance
through merging debugPoly and debugBox
2022-05-11 13:36:36 +10:00
DokaDoka
38dbc2ac34 refactor(zones): create data.triangles even if the polygon is convex 2022-05-11 13:34:06 +10:00
DokaDoka
9b5ac35ab3 refactior(zones): make makeTriangles available outside of getTriangles 2022-05-11 13:29:18 +10:00
Linden
7a4745c0da chore(zones): adjust debug rgba 2022-05-10 15:29:07 +10:00
Linden
55bfa7ca3d refactor(zones): global Zones 2022-05-07 11:47:39 +10:00
Linden
ce3f916c42 refactor(zones): centroid -> coords
While centroid is a more accurate term, coords is a little simpler when
writing it a million times.
Prefer to use a single term (sphere was using coords) to simplify API.
2022-05-07 11:19:27 +10:00
Linden
d3718622cf feat(zones): sphere zone
It's just a distance check and works exactly like lib.points, with some
minor API changes for consistency.
2022-05-06 14:28:45 +10:00
Linden
4555fa0a22 refactor(zones): call zone:contains instead of zone.polygon:contains
Added this function earlier but forgot to include thickness, so
it didn't work.
2022-05-06 14:26:56 +10:00
DokaDoka
18f55ffefe refactor(zones): handle multiple points in the same horizontal line
- new intersection points are generated per vertical coord present in the original polygon rather than per vertex and are grouped together rather than associated directly with the parent
- hopefully better code structure and organisation for the entire triangle generating section
2022-05-01 12:49:56 +10:00
Linden
c7bab9b47f fix(zones): debug functions should not be global 2022-04-29 02:01:51 +10:00
Linden
634dd747b7 refactor(zones): assign X directly and store triangles as matrices 2022-04-29 02:01:17 +10:00
Linden
754ae1bd8d refactor(zones): use array table structure when creating triangles 2022-04-29 01:50:31 +10:00
Linden
247b9916e1 refactor(zones): rename variables and minor perf
Set box vertices and poly triangles once during creation (with debug).
2022-04-29 01:38:01 +10:00
DokaDoka
65787d3b6d fix(zones): draw complex polygons properly
convex polygons are split into triangles more simply
complex polygons are split into trapezoids and then triangles to be drawn
2022-04-29 00:41:21 +10:00
Linden
cfffcee577 feat(zones): debugBox draw lines on edges
It's an abomination until Doka works his magic.
2022-04-27 17:13:26 +10:00
Linden
5dce90682f refactor(zones): reduce value reassignments 2022-04-27 17:11:36 +10:00
Linden
fc3e5d6339 feat(zones): add contains method to zones
Reduces number of table lookups for micro-optimisation.
zone:contains(coords) is also a bit nicer than zone.polygon:contains(coords).
2022-04-27 17:09:32 +10:00
Linden
a340c83e1a perf(zones): assign inside count and index to local
Reduce number of times the inside table needs to be indexed or have length checked.
Also assign debug zones to table without having to be inside the zone.
2022-04-27 17:07:24 +10:00
Linden
cc770ada64 refactor(zones): change new to poly, default box rotation 2022-04-27 10:33:18 +10:00
DokaDoka
de201dcf03 feat(zones): box
streamlined rectangle polygon creation for the lazy, with rotation
2022-04-26 23:06:23 +10:00