Set tow rope attach distance to same as separation distance. Fire script when attached.

This commit is contained in:
Steve 2015-11-28 14:33:40 +00:00
parent dec3538956
commit 633f6d646e
2 changed files with 4 additions and 1 deletions

View File

@ -35,7 +35,7 @@ void attachRope(void)
{ {
distance = getDistance(e->x, e->y, self->x, self->y); distance = getDistance(e->x, e->y, self->x, self->y);
if (distance > 0 && distance <= 64) if (distance > 0 && distance <= self->separationRadius)
{ {
self->towing = e; self->towing = e;
e->owner = self; e->owner = self;
@ -44,6 +44,8 @@ void attachRope(void)
e->flags |= EF_RETREATING; e->flags |= EF_RETREATING;
runScriptFunction("TOWING %s", e->name);
if (self == player) if (self == player)
{ {
battle.stats[STAT_NUM_TOWED]++; battle.stats[STAT_NUM_TOWED]++;

View File

@ -29,6 +29,7 @@ extern float getAngle(int x1, int y1, int x2, int y2);
extern int getDistance(int x1, int y1, int x2, int y2); extern int getDistance(int x1, int y1, int x2, int y2);
extern Entity **getAllEntsWithin(int x, int y, int w, int h, Entity *ignore); extern Entity **getAllEntsWithin(int x, int y, int w, int h, Entity *ignore);
extern void addHudMessage(SDL_Color c, char *format, ...); extern void addHudMessage(SDL_Color c, char *format, ...);
extern void runScriptFunction(char *format, ...);
extern App app; extern App app;
extern Battle battle; extern Battle battle;