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

Add an unconditional Lua script to mods #199

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

piepie62
Copy link
Contributor

@piepie62 piepie62 commented Dec 6, 2023

This allows "override-style" ScriptExtender mods: mods that are active even when they aren't in the load order. This can be especially useful for client-side enhancements. I figured that doing it unconditionally made a little more sense than doing it only when it was unloaded.
I'm also not certain that a server version of this is useful, but it was really simple to add so I just have it in there, as it seems somewhat odd to not support it given the ease.

@Varriount
Copy link
Contributor

Just out of curiosity, what can actually be done with client-side scripts at the moment? Looking through the available functions, it doesn't seem like it's possible to do much.

@piepie62
Copy link
Contributor Author

piepie62 commented Dec 16, 2023

I currently use it to modify some resources (the mappings for which I added in a different PR) without changing the hash of the game PAKs. This lets me have a few client-side visual mods that my multiplayer friend does not, even when some extra dependencies that check hashes are in place. Without this change, I wasn't able to apply those changes because the mod wouldn't execute them, as mod lists are apparently sent from server to client and disable ones that aren't present on the server.

@piepie62
Copy link
Contributor Author

Theoretically this could also be extended by allowing clients to remote query Osiris, which would theoretically allow for mods like Aura of Revealing or Camp Event Notifications to also be client-side. Haven't started considering how that might be done yet, though.

@piepie62
Copy link
Contributor Author

piepie62 commented Jan 11, 2024

I'm currently in the process of that expansion, and I'm hitting a bit of a snafu. I can send messages that contain the required data (which actually works wonderfully) but I'm not sure how to get the data to send and receive while the Lua function is still running. Is that at all possible given what is currently documented? I tried the same mutex-condvar trick that's used in some places, but I believe the network interface isn't being updated when the thread that the Lua ends up running on starts sleeping; the server never receives the message I'm trying to send.

@piepie62
Copy link
Contributor Author

I've come back to this after, amusingly, exactly two months and have figured out how to do a client-side Osiris query: I simply ignore the synchronous interface and build an asynchronous one. My next question is whether this should actually exist for both sides (allowing a mod to be able to use either on the server) or if it makes more sense to leave it as a client-only interface. I'm also curious whether this would be best in a separate PR or in this one, as either seems valid.

@piepie62
Copy link
Contributor Author

As a side note, I've only allowed :Get on databases currently, as that's the only interface that I personally know for a fact will not cause any changes on the server side. Can queries change Osiris parameters, and, whether or not they can, should they be allowed from the client? I'm not certain. Adding to and deleting from databases from the client seems like a bad idea, as does calling procedures.

@piepie62
Copy link
Contributor Author

Force-pushed to rebase onto main

@GustopaSchapi
Copy link

This is actually a really cool idea, and it makes sense to have a client sided option. This would open up a lot of possibilities for multiplayer, I think I'll mess around with this current implementation and report back if I find anything worth noting.
Thanks for this amazing PR! @piepie62

@piepie62
Copy link
Contributor Author

Once again rebased

@piepie62
Copy link
Contributor Author

piepie62 commented Sep 5, 2024

And, again, rebased.

@piepie62
Copy link
Contributor Author

Rebased again. Just wondering, @Norbyte, is this at all under consideration? Is there a reason it hasn't yet been merged?

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.

3 participants