Execute function pending AI command has finished #3787

Open
impaktor opened this Issue Aug 17, 2016 · 4 comments

Projects

None yet

3 participants

@impaktor
Member
impaktor commented Aug 17, 2016 edited

This is left over to do from #3753, where we need a (general?) way to tell an AI ship to wait with hyperjumping until after AIEnterLowOrbit has compleated.

Also AIEnterLowOrbit is a hack to get the ship to fly somewhere.

Thus at the moment, NPC ships violate the law when hyperjumping.

Maybe slightly related: #1990 (Since we really want some AIFlyTo(path, distance) with settable distance.

More related: #2376

@impaktor impaktor added the To do label Aug 17, 2016
@mike-f1
Contributor
mike-f1 commented Feb 7, 2017 edited

@impaktor, while waiting for a "more general way", we could use the change @walterar suggested on #2639, using following line instead of actual one's (it seems working)? [line is 685 in TradeShip.lua]]

ship:AIFlyTo(ship.frameBody)

...So at least ships will broke laws but don't fall on their pad... Trying to solve docking issue I think I seen enough of them falling down and hyperjumping ON pad :-/

Then I would have a clarification: there's a problem with some AI function that terminate before
expected or there's only a lack of a function needed to fly to a point where hyperspace is allowed?

@laarmen
Contributor
laarmen commented Feb 7, 2017

Neither. There is a lack of a mechanism to hand back control to the Lua side after an AI function terminates.

@laarmen
Contributor
laarmen commented Feb 7, 2017

Well, actually, there's a lack of the latter, but that is not the critical point right now, we can fake it with AIEnterLowOrbit.

@mike-f1
Contributor
mike-f1 commented Feb 7, 2017

@laarmen , I don't know if AIEnterLowOrbit could be an answer, because then you need to check
if you need to orbit (as for orbital stations)...
Said that, ok: if this works, there are reasons against a PR?

...I suggest a fast&dirty way because it's very "bad" to see ships bouncing again on pads...

Talking about mechanism, you should see in Ship-AI.cpp (lines 77-83) how things are done C side:
you call AI until TimeStepUpdate return true, then you trigger an event LUA side.
I imagine LUA side you then handle this event, and this actually works for every method of AI.

So I don't understand if you mean that there's a need for an [improved|new|changed] mechanism to
bounce info between C and LUA, or if you mean "I doubt AIEnterLowOrbit works fine"...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment