Out of juice event callback

For collaboration on developing the mod capabilities of VS; request new features, report bugs, or suggest improvements

Moderator: Mod Contributor

Post Reply
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Out of juice event callback

Post 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?
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post 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.
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Post 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?
Post Reply