Commit Graph
139 Commits
Author SHA1 Message Date
asarium 8fcb05bfd0 Add scripting API for custom execution context
This allows a script to create its own execution context so that it can
control when a coroutine is valid to play based on custom data.

Also adds a function which causes a coroutine to end in an error.
2020-08-11 09:38:39 +02:00
Goober5000 83d9d352ff Merge pull request #2604 from Baezon/consistent-apply-whack-args
Supply world coordinates in whack function calls
2020-08-09 15:32:41 -04:00
asarium 1001bfb760 Add generic audio stream API
The previous API only allowed very limited access to the audio stream
system. These changes add full support for playing all types of audio
streams via a dedicated API.
2020-08-08 19:36:39 +02:00
Goober5000 d841d2a91b Merge pull request #2603 from Goober5000/on_debris_created
more complete scripting support for debris
2020-07-30 21:42:05 -04:00
Baezon 20acea31f2 review changes 2020-07-30 15:06:36 -04:00
Goober5000 2dddbaa6ae add some more useful functions 2020-07-29 21:26:16 -04:00
Goober5000 9b7549213d might as well add these too 2020-07-27 13:38:44 -04:00
Baezon f95f48448e world coords for all whacks 2020-07-27 01:11:00 -04:00
Goober5000 83d2ac8818 more complete scripting support for debris
Adds a hook for debris creation, and adds DoNotExpire and LifeLeft virtual variables for controlling debris removal.
2020-07-26 22:02:51 -04:00
Goober5000 8bc57c3cd2 add several more scripting functions
Add ba.rand32() and ba.rand32f(), and gr.clear(); enhance streaminganim:process(); fix streaminganim:timeLeft().
2020-07-25 23:21:40 -04:00
Goober5000 6e40248490 add vector interpolation, sexp variable name, and joystick axis inversion
add several more vecmat functions to scripting
2020-07-23 14:43:02 -04:00
Goober5000 cd2a0437e0 Merge pull request #2573 from Goober5000/tech_db_scripting_vars
cleanup of tech room, and scripting stuff
2020-07-21 22:38:58 -04:00
Goober5000 31fa2ac444 cleanup of tech room, and scripting stuff
1) Upgrade the pilot file code to correctly save flags whether entries are added *or* removed
2) Make the tech-db/tech-db-multi ship flag handling consistent
3) Add scripting support for intel entries
4) Add scripting support for adding and removing entries from the tech room
5) Minor cleanup
2020-07-15 13:27:27 -04:00
Baezon 9b33685598 Fix physics whack for docked ships
Properly whacks all ships that are docked together when any are whacked, makes everything more consistent by calling ship_apply_whack instead of physics_apply_whack, whacking in general now unrotates its hit pos to get a world pos like physics whack was expecting and adds a few matrix helper functions.
2020-07-11 00:04:48 -04:00
niffiwan 647081a547 Merge pull request #2492 from asarium/feature/scriptingTypesValidation
Validate scripting documentation type names
2020-06-25 17:05:38 +10:00
asarium 0d7ade0ca8 Validate scripting documentation type names
This will check if the type names specified in the argument lists of
scripting functions actually refer to valid type scripting names.
2020-06-24 17:52:33 +02:00
wookieejedi 050e9ad67a Merge pull request #2503 from wookieejedi/add-shield-weapon-recharge-to-ship-object
Add Shield and Weapon Regen Rates to Ship Object and Expose to Scripting
2020-06-23 22:17:22 -04:00
Fabian Woltermann c2b7374dc3 Merge pull request #2493 from The-E/feature/more_lab_things
Animations in the lab and code cleanup
2020-06-23 22:44:45 +02:00
wookieejedi 52030b1cc6 Add Shield and Weapon Regen Rates to Ship Object and Expose to Scripting
Previously a ship's shields and weapon regeneration per second rates were only stored in the ship_info strut, thus they should not be changed during a mission or via scripting (see #2236 and and #2239). There are many precedents for taking a ship_info value ans copying it to a ship_object value so the value can be changed on a per ship basis in mission (auto aim FOV is one of many examples). This PR thus copies the shield and weapon recharge values to the ship_object and exposes those new values to scripting.
2020-06-23 10:45:45 -04:00
wookieejedi dd31579397 Update info 2020-06-21 15:25:36 -04:00
wookieejedi 21342f83c4 Expose 'Damp' to Scripting
Many physics values are exposed to scripting, including rotational damp. This PR exposes the linear damp to scripting. Note that in the code the linear damp is called `side_slip_time_const`.
2020-06-21 14:23:37 -04:00
Fabian Woltermann ec494f0229 Change the model anim type enums to a enum class 2020-06-21 14:51:43 +02:00
asarium ef395640d3 Add support for libRocket command briefing
This adds access to the command briefing data parsed from the mission
file to the scripting API so it can be used by the UI scripts for the
high res UI.

Also switches the animation support to using the generic anim to use
streaming to improve performance.
2020-06-20 18:17:01 +02:00
asarium 15db77d7fe Add capability to have comments in scripting args
Putting something between /* and */ behind a parameter will make that
appear in the HTML and JSON output now.
2020-06-13 21:03:22 +02:00
asarium ca27ae16f2 Use Antlr for generating argument list parser
This adds an Antlr grammar for parsing argument lists instead of using a
hand written parser. This allows to write much more complicated syntax
constructs and have all the code being auto-generated. It will also
produce a much more correct parser instead of having all those hacks in
the hand-written one.

This also adds (in addition to supporting the previous syntax) support
for function types along with support for them in HTML and JSON output
formats.

The ANTLR generated parser is included in source form so that it is not
necessary to have an ANTLR installation around if you are not going to
change the grammar. Also includes the necessary runtime code from Antlr.
2020-06-11 21:57:52 +02:00
m!m 25d16c3102 Merge pull request #2446 from asarium/feature/scriptingArgParsing
Add parser for scripting argument documentation
2020-06-07 12:06:28 +02:00
asarium d54d7d41e6 Output parameter information to JSON
Also fixes the parameter strings which currently could not be parsed by
the argument parser.
2020-06-06 23:45:36 +02:00
asarium 614a636ed5 Fix clang-tidy issues
Not sure why travis saw these since I didn't change anything there but
fixing these is also good.
2020-06-06 23:24:08 +02:00
asarium 016c07dc3a Add feature to execute Lua coroutines at specific points
This adds a mechanism for running generic operations at specific points
of the frame execution. This can be used by any part of the code an not
just Lua since it simply executes std::functions. It also adds an
"execution context" concept that specifies in which situation an
operation should be executed.

This is then used by the Lua Coroutines code for resuming coroutines at
specific points instead of always when the awaited promise resolves.
2020-06-06 21:29:48 +02:00
asarium 367564733e Add parser for scripting argument documentation
This adds a simple parser that takes the existing argument
documentations and parses them so that better documentation can be
generated from that information. This should be sufficient for providing
proper documentation generation for the most common and simple cases of
argument lists (type, name, possible default value, and optional
groups).
2020-06-06 14:02:33 +02:00
asarium 04174e00f8 Ensure Lua functions are executed in correct state
This will ensure that Lua functions will always be executed in the
correct Lua state. Since we now have multiple threads (which are
different lua_State objects) it is possible that the current code could
execute a Lua function in the main state instead of the thread that is
currently executing. This can lead to weird behavior and probably also
to issues inside Lua.
2020-06-06 14:00:23 +02:00
asarium e8e549ff08 Add scripting API for tracing custom code
This can be used by Lua code to trace the runtime of their code in the
same way the engine already is capable of doing for most in-mission and
mission loading code.

Also adds some tracing scopes to the libRocket code
2020-06-05 22:14:55 +02:00
wookieejedi 59073533a8 Fix minor missetting of script function for displaying armor string
Previosuly, using the script function ArmorClass did not properly display the actual armor class, instead it always displayed -1. This PR fixes that. I have tested these changes and they now proprely display the armor class.
2020-06-04 18:06:03 -04:00
asarium 08c6e0d072 Introduce error state of promises
This is necessary after all to properly clean up resources if an
operation becomes invalid.

Also bumps Visual Studio version to 2017 on Appveyor.
2020-05-24 22:07:09 +02:00
asarium ebcf686cf7 Add Lua API for promises and async coroutines
This adds a Lua API for representing asynchronous operations and running
coroutines based on those operations comfortably. This is very similar
to features other languages have introduced such as C# or JavaScript. In
fact, the whole "promise" thing is derived from how JavaScript
represents these operations.

This is the initial and very basic system for supporting async
coroutines in Lua. There is no native support for running these
operations at specific points (they run whenever the awaited promise
resolved) or making sure they do not leak through different game states.
2020-05-24 12:36:01 +02:00
Goober5000 1ef90d79c4 Apply suggestions from code review
some comment tweaks
2020-05-13 20:15:36 -04:00
wookieejedi 280ff2d4f0 Incorporate feedback 2020-05-08 22:40:58 -04:00
wookieejedi 45775a0d97 One more update to the scripting function calls 2020-05-08 11:29:07 -04:00
wookieejedi c4d405e33e change to nullptr 2020-05-08 11:14:53 -04:00
wookieejedi 86e1ebaf08 fixed copy paste error with new script function 2020-05-08 10:34:20 -04:00
wookieejedi 82921467a5 Update ship.cpp 2020-05-08 09:58:35 -04:00
wookieejedi c2820f10c8 Updates and fixes multiple warp out related code 2020-05-08 09:53:32 -04:00
Goober5000 c8b1f56a09 missed one 2020-04-16 13:37:36 -04:00
JohnAFernandez 6b7df053fa Make sure aip->net_signature always defaults to -1 for no target.
Although not used very often, ai_info.target_signature should be set to -1 whenever no target is specified, just like everywhere else to make sure that the code is as predictable as possible.

(Found while trying to figure out why the heck would the Object update packet send this at all??)
2020-03-27 23:11:19 -04:00
Goober5000 c9df8a13f1 add functions to remove the clutter of static casts for ship and weapon info vectors 2020-03-14 13:02:12 -04:00
Goober5000 20835adef6 convert Weapon_info to a SCP_vector 2020-03-05 19:12:43 -05:00
asarium a13b503b83 Add more features for the new Options UI
The largest new feature is that it is now possible to include other
files into the RML by using the "include" tag. This is useful for making
markup files more modular.

Also added some more options for existing things (e.g. built-in detail
options).
2020-02-08 13:28:53 +01:00
wookieejedi 0b6a642a17 Revert "Adds Scripting Support for the Ship Flag gun convergence" 2020-01-13 23:32:03 -05:00
wookieejedi 51bbb0c1d2 Adds Scripting Support for the Ship Flag Gun Convergence 2020-01-12 15:37:31 -05:00
Goober5000 d9dfce3c25 Merge pull request #2147 from asarium/feature/luaParseObjects
Add Lua access to not yet arrived ships
2019-12-17 02:35:14 -05:00