Commit graph

20 commits

Author SHA1 Message Date
Jordan Leppert
14961e3c6b Increasing vertical collision box when determining if pathfinding goal is inside box, fixes pathfinding with dragons 2022-03-20 12:03:26 +00:00
Jordan Leppert
f096939f27 Restore 0.2 padding in pathfinder.moveable 2022-03-20 11:33:23 +00:00
Jordan Leppert
076e8423ae Movement Improvements
Pathfinding movement functions for A* and theta have been combined into one generic function.
Ensure next goal is always set if there is a valid path.
Checking if mob has reached the next goal improved - now works no matter the mob height, and the height of the node below the goal.
mob:pos_in_box now can take a size param that is a table. Using this to add stepheight to the box height, to fix issues with mobs stepping up onto next node before hitting the goal.
Mobs now won't overshoot their goal, if they're very close to it (less than mob width) their speed reduces.
The more a mob is turning, the less forward velocity it has. This should fix spinning a lot.

mob:pos_in_box now can take a size param that is a table, containing the separate width and height.

pathfinding.moveable no longer pads an extra 0.2 around the width of mob when checking if there is sufficient space for the mob.

pathfinding.get_neighbors now uses max_fall for the maximum distance we can go down, instead of stepheight.
2022-02-23 18:00:42 +00:00
Jordan Leppert
35069011d6 Pathfinding Fixes
mob_meta.get_node_height:
Moved to pathfinding, and made public (creatura.get_node_height).
Now uses collision box rather than node box, if available, unless flag specifies not to.
Fix for getting node height for nodes with connected node boxes

pathfinding.get_ground_level:
We now have one copy between pathfinding and mob_meta.
Can check a larger range of nodes at different heights.
Takes into account node height of both target node, and the height of the node we're coming from.

pathfinding.get_neighbors:
Get maximum distance mob can travel up/down from mob stepheight.
Improved checking diagonals are clear.
Improved checking vertical clearance, takes into account height of current and target node.
Vertical clearance can cope with nodes that have a different collision and node boxes, like snow.
Vertical clearance has a tiny height adjustment so a 2 node heigh entity can fit through a 2 node gap.
Fixed bug where it was assumed a node was reachable if it's the end goal.

methods.movement_theta_pathfind and movement_pathfind:
Fixed bug that raised goal pos by 0.5 nodes.
2022-02-22 15:16:33 +00:00
ElCeejo
23c61e0751
Merge pull request #7 from JordanL2/damage_texture_mod
Texture mod fix when indicating damage
2022-02-20 14:54:19 -08:00
Jordan Leppert
3bb1119017 Texture mod fix 2022-02-20 21:35:36 +00:00
ElCeejo
8273f25207 Fix multiple warnings, Add shallow walkable node check, Improve get_wander_pos 2022-02-20 11:37:39 -08:00
ElCeejo
43c124db15
Merge pull request #3 from JordanL2/spawn_cap
Spawning fixes: Min/max radius, node light check, spawn cap, biome check
2022-02-16 18:20:39 -08:00
ElCeejo
2cea35a282
Merge pull request #4 from appgurueu/main
Node def handling fixes
2022-02-16 14:46:13 -08:00
Lars Mueller
6ffde2fc17 Fix checks for water & fire groups 2022-02-16 21:58:05 +01:00
Lars Mueller
8b0e23f97e Fix crash with unknown or ignore nodes 2022-02-16 21:57:05 +01:00
Jordan Leppert
10d250fdbf Mob despawn_after defaults to never 2022-02-16 15:34:17 +00:00
Jordan Leppert
7f3d4cc77a Biome check is done on the spawn position, not the player's position. This fixes mobs spawning in the wrong biome, and eg no forest mobs spawning if you're in grasslands just outside a forest. This means we can't (easily) use mob-specific spawn min/max radius, so it is currently removed. 2022-02-16 13:10:41 +00:00
Jordan Leppert
9a623fa47c Increasing min/max spawn radius to 32/128. Fixing spawn pos distance check - we now check after we have the actual Y coord. 2022-02-16 12:20:52 +00:00
Jordan Leppert
c99837fbde Fixing max spawn radius to also be spherical, like the spawn cap check 2022-02-16 09:51:22 +00:00
Jordan Leppert
fe4f065bfc Spawn cap: Limit spawning of animals to 5 (default) of each type within spawn radius 2022-02-15 21:16:31 +00:00
Jordan Leppert
d7b880da1e Spawning light check - only check node above when spawn_in_nodes is false 2022-02-15 10:45:50 +00:00
Jordan Leppert
cea6d15965 Spawning fixes:
1. Spawning radius fixed, we now have a cubic max radius mobs will spawn within, and a spherical min radius mobs won't spawn within.
2. Node light check fixed - we need to check the node above the spawn node, otherwise it always returns zero.
2022-02-14 16:18:07 +00:00
ElCeejo
c251f07ae5
Initial Commit 2022-02-10 16:32:53 -08:00
ElCeejo
f72b110b33
Initial commit 2022-02-10 16:31:46 -08:00