Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lua minigame for micrometeorites point defense #1886

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

aBlueShadow
Copy link
Contributor

This is some plugin style lua script that provides an extremly simple "minigame" for the weapons console.
micrometeorite

It is basically an attempt to keep weapons on their toes outside of combat or scripted events.
Every now and then, a micrometeorite is detected, and weapons has a short time windows to shoot it down by pressing the right button.
In can be en- and disabled per player ship. With shields on, it is always inactive, as this is a rough indicator of being in combat. In game, this could be explained by stating that micrometeorites are just absorbed by the shield.
It is also inactive when no weapons officer is present, as tactical and single pilot are busy enough.

I am not quite sure about the actual utility of this, but I figured publishing I might be useful anyways, at the very least as an example of modularization for scenario writers, so one might be encouraged to outsource systems so that they can be reused in other scenarios.
Shoutout to @hemmond, looking into the custom elements wrapper helped me a lot with OOP-izing the minigame.

I also added translation tags, although I am not sure if utility scripts are translatable at all. But as those tags did no harm either, I added them anyway

@aBlueShadow
Copy link
Contributor Author

aBlueShadow commented Feb 5, 2023

As I successfully tested that the language tags do work indeed, I added a german .po file as well

@aBlueShadow
Copy link
Contributor Author

Some changes:

  • Small fixes like the removal of debug messages.
  • Lowered the volume so the beam sound is more subtle.
  • Unicode characters are outside of the translation strings now, as those seemed to cause problems.
  • Convenient updateAll() function, so you won't need to manually update for any ship with point defense.

@DansDesigns
Copy link

This is really cool, is it possible to have this as an add-on? How would one add this to EE?

@aBlueShadow
Copy link
Contributor Author

aBlueShadow commented Nov 10, 2024

@DansDesigns given that this PR did not get merged, the first step would be to download the utils_micrometeorites.lua file and save it into your scripts folder. That file is only needed on your server, not on the clients.
There is no way to have global addons, I think even as a mod it won't be possible to get it started automatically. Which means you will have to include it into the scenario where you want that feature, the description is in the "Usage" section in the file.
If you want to have a convenient way to add/clear that minigame from selected ships in the GM screen, this howto would be slightly different:

  1. At the top of the scenario script (after the description section), insert
    require('utils_micrometeorites.lua')

  2. Add those lines somewhere within the init() function:

    addGMFunction(_("Remove MMPD"), function() for _, obj in ipairs(getGMSelection()) do MicroMeteorites:remove(obj) end end)
    addGMFunction(_("Add MMPD"), function() for _, obj in ipairs(getGMSelection()) do MicroMeteorites:init(obj) end end)

  1. Add this line somewhere within the update() function:
    MicroMeteorites:updateAll(delta)

I also thought about preparing this library for usage with the Script() object, so you would only need a single line to include and activate it, but as daid does not like Script(), I hesitated to include something like that in this PR. But as this PR has been pending for more than 1 1/2 years now, it probably won't matter much anyways :-)

@DansDesigns
Copy link

@aBlueShadow aha that's exactly what i'm looking for! thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants