Page 1 of 1

Out of juice event callback

Posted: Mon Sep 15, 2008 3:56 am
by chuck_starchaser
In the original game Privateer, when energy ran out, it triggered a change in shield setting, and I wonder if there's an easy way to implement that.
It goes as follows:
Say you hit afterburner, and it consumes more energy than your power plant can produce.
The energy reservoir keeps going down....
When energy hits bottom, the afterburner would start sputtering.
This we got right.
But after a few seconds of sputtering, the shields would automatically go down to a 2/3 strength setting.
Then your energy would start going up again.
Where would be the code to look at to try and implement this behavior?

Posted: Fri Sep 19, 2008 1:03 am
by ace123
That would be awesome...

At the moment the engine doesn't really have much of what you would call an "event callback".. it's more like a python function that gets called once per simulation frame, and a few GUI callbacks.

We can't really have a good stateful system without having useful callbacks.

Posted: Sat Sep 20, 2008 10:36 am
by chuck_starchaser
Almost missed your post.
Any way then to query the energy reserve from within Python? In fact, is there some place where to put user code that executes out of that per-physics frame call?