mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-10-06 14:22:33 +00:00
Lua functions:
- Change entity_handleShotCollisionsHair(): Allow setting hair collision width percent - Change entity_collideSkeletalVsCircle(): Allow colliding with any RenderObject - Add entity_collideSkeletalVsCirclePos(): Allow specifying (x,y,radius)
This commit is contained in:
parent
b8af382bd9
commit
664b2bd5f2
3 changed files with 20 additions and 10 deletions
|
@ -8191,11 +8191,9 @@ bool Game::collideHairVsCircle(Entity *a, int num, const Vector &pos2, float rad
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE THIS FUNCTION ASSUMES THAT IF A BONE ISN'T AT FULL ALPHA (1.0) IT IS DISABLED
|
// NOTE THIS FUNCTION ASSUMES THAT IF A BONE ISN'T AT FULL ALPHA (1.0) IT IS DISABLED
|
||||||
Bone *Game::collideSkeletalVsCircle(Entity *skeletal, Entity *circle)
|
Bone *Game::collideSkeletalVsCircle(Entity *skeletal, RenderObject *circle)
|
||||||
{
|
{
|
||||||
Vector pos = circle->position;
|
return collideSkeletalVsCircle(skeletal, circle->position, circle->collideRadius);
|
||||||
|
|
||||||
return collideSkeletalVsCircle(skeletal, pos, circle->collideRadius);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Bone *Game::collideSkeletalVsLine(Entity *skeletal, Vector start, Vector end, float radius)
|
Bone *Game::collideSkeletalVsLine(Entity *skeletal, Vector start, Vector end, float radius)
|
||||||
|
@ -8464,14 +8462,14 @@ void Game::handleShotCollisionsSkeletal(Entity *e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::handleShotCollisionsHair(Entity *e, int num)
|
void Game::handleShotCollisionsHair(Entity *e, int num, float perc)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < Shot::shots.size(); ++i)
|
for (size_t i = 0; i < Shot::shots.size(); ++i)
|
||||||
{
|
{
|
||||||
Shot *shot = Shot::shots[i];
|
Shot *shot = Shot::shots[i];
|
||||||
if (shot->isActive() && isEntityCollideWithShot(e, shot))
|
if (shot->isActive() && isEntityCollideWithShot(e, shot))
|
||||||
{
|
{
|
||||||
bool b = collideHairVsCircle(e, num, shot->position, 8);
|
bool b = collideHairVsCircle(e, num, shot->position, 8, perc);
|
||||||
if (b)
|
if (b)
|
||||||
{
|
{
|
||||||
lastCollidePosition = shot->position;
|
lastCollidePosition = shot->position;
|
||||||
|
|
|
@ -661,14 +661,14 @@ public:
|
||||||
bool collideHairVsCircle(Entity *a, int num, const Vector &pos2, float radius, float perc=0, int *colSegment=0);
|
bool collideHairVsCircle(Entity *a, int num, const Vector &pos2, float radius, float perc=0, int *colSegment=0);
|
||||||
|
|
||||||
bool collideCircleVsCircle(Entity *a, Entity *b);
|
bool collideCircleVsCircle(Entity *a, Entity *b);
|
||||||
Bone *collideSkeletalVsCircle(Entity *skeletal, Entity *circle);
|
Bone *collideSkeletalVsCircle(Entity *skeletal, RenderObject *circle);
|
||||||
Bone *collideSkeletalVsLine(Entity *skeletal, Vector start, Vector end, float radius);
|
Bone *collideSkeletalVsLine(Entity *skeletal, Vector start, Vector end, float radius);
|
||||||
bool collideCircleVsLine(RenderObject *r, Vector start, Vector end, float radius);
|
bool collideCircleVsLine(RenderObject *r, Vector start, Vector end, float radius);
|
||||||
bool collideCircleVsLineAngle(RenderObject *r, float angle, float startLen, float endLen, float radius, Vector basePos);
|
bool collideCircleVsLineAngle(RenderObject *r, float angle, float startLen, float endLen, float radius, Vector basePos);
|
||||||
Bone *collideSkeletalVsCircle(Entity *skeletal, Vector pos, float radius);
|
Bone *collideSkeletalVsCircle(Entity *skeletal, Vector pos, float radius);
|
||||||
void handleShotCollisions(Entity *e, bool hasShield=false);
|
void handleShotCollisions(Entity *e, bool hasShield=false);
|
||||||
void handleShotCollisionsSkeletal(Entity *e);
|
void handleShotCollisionsSkeletal(Entity *e);
|
||||||
void handleShotCollisionsHair(Entity *e, int num = 0);
|
void handleShotCollisionsHair(Entity *e, int num = 0, float perc = 0);
|
||||||
|
|
||||||
std::vector<ElementTemplate> elementTemplates;
|
std::vector<ElementTemplate> elementTemplates;
|
||||||
std::string sceneName;
|
std::string sceneName;
|
||||||
|
|
|
@ -5075,7 +5075,7 @@ luaFunc(entity_handleShotCollisionsHair)
|
||||||
Entity *e = entity(L);
|
Entity *e = entity(L);
|
||||||
if (e)
|
if (e)
|
||||||
{
|
{
|
||||||
dsq->game->handleShotCollisionsHair(e, lua_tonumber(L, 2));
|
dsq->game->handleShotCollisionsHair(e, lua_tointeger(L, 2), lua_tonumber(L, 3));
|
||||||
}
|
}
|
||||||
luaReturnNil();
|
luaReturnNil();
|
||||||
}
|
}
|
||||||
|
@ -5083,7 +5083,7 @@ luaFunc(entity_handleShotCollisionsHair)
|
||||||
luaFunc(entity_collideSkeletalVsCircle)
|
luaFunc(entity_collideSkeletalVsCircle)
|
||||||
{
|
{
|
||||||
Entity *e = entity(L);
|
Entity *e = entity(L);
|
||||||
Entity *e2 = entity(L,2);
|
RenderObject *e2 = robj(L,2);
|
||||||
Bone *b = 0;
|
Bone *b = 0;
|
||||||
if (e && e2)
|
if (e && e2)
|
||||||
{
|
{
|
||||||
|
@ -5092,6 +5092,17 @@ luaFunc(entity_collideSkeletalVsCircle)
|
||||||
luaReturnPtr(b);
|
luaReturnPtr(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
luaFunc(entity_collideSkeletalVsCirclePos)
|
||||||
|
{
|
||||||
|
Entity *e = entity(L);
|
||||||
|
Bone *b = 0;
|
||||||
|
if (e)
|
||||||
|
{
|
||||||
|
b = dsq->game->collideSkeletalVsCircle(e, Vector(lua_tonumber(L, 2), lua_tonumber(L, 3)), lua_tonumber(L, 4));
|
||||||
|
}
|
||||||
|
luaReturnPtr(b);
|
||||||
|
}
|
||||||
|
|
||||||
luaFunc(entity_collideSkeletalVsLine)
|
luaFunc(entity_collideSkeletalVsLine)
|
||||||
{
|
{
|
||||||
Entity *e = entity(L);
|
Entity *e = entity(L);
|
||||||
|
@ -9598,6 +9609,7 @@ static const struct {
|
||||||
luaRegister(entity_handleShotCollisionsSkeletal),
|
luaRegister(entity_handleShotCollisionsSkeletal),
|
||||||
luaRegister(entity_handleShotCollisionsHair),
|
luaRegister(entity_handleShotCollisionsHair),
|
||||||
luaRegister(entity_collideSkeletalVsCircle),
|
luaRegister(entity_collideSkeletalVsCircle),
|
||||||
|
luaRegister(entity_collideSkeletalVsCirclePos),
|
||||||
luaRegister(entity_collideSkeletalVsLine),
|
luaRegister(entity_collideSkeletalVsLine),
|
||||||
luaRegister(entity_collideSkeletalVsCircleForListByName),
|
luaRegister(entity_collideSkeletalVsCircleForListByName),
|
||||||
luaRegister(entity_collideCircleVsLine),
|
luaRegister(entity_collideCircleVsLine),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue