Jump to content

Reusing code between disparate mods


Recommended Posts

Hey,

I wanna make a mod that can be run [client-only], OR [all-clients-require] server side.

And I want to, when I update them, do so at the same time.

To that end, I think making a "dummy mod", and extract common code there would make sense. But I'm not entirely sure how mod inheritance works.

 

Like, I tried to make a [client-only] mod that would use GEM core API (since that's a server-side mod). But that didn't seem to work for me.

https://gitlab.com/DSTAPIS/GemCore/-/wikis/Home

 

So is there any way I can make them pull code from the same place? Am I doing something wrong?

Or do I have to upload 2 separate mods with the same exact mod code, and two lines changed in the modinfo?

Thank you ahead of time for reading

Link to comment
Share on other sites

6 hours ago, Bigfootmech said:

To that end, I think making a "dummy mod", and extract common code there would make sense.

That's sort of the approach you want to take.

You just make a mod that works as a library, and you use stuff from it in other mods.

They both have to be running on the same side though (client library for client mods, server library for server mods). Using GemCore for a client only mod is not practical.

6 hours ago, Bigfootmech said:

So is there any way I can make them pull code from the same place? Am I doing something wrong?

Entirely up to you. You can put your library in the global environment, or take a variety of other approaches.

  • Like 1
Link to comment
Share on other sites

15 minutes ago, Bigfootmech said:

That's the crux. I want 2 on different sides :p

That would defeat the purpose of a mod being client or server, especially client.

8 hours ago, Bigfootmech said:

Or do I have to upload 2 separate mods with the same exact mod code, and two lines changed in the modinfo?

Yep, since you're trying to get code from the opposite side. Probably the best way to do it.

Edited by penguin0616
  • Like 2
Link to comment
Share on other sites

The point of the client and server is: having something rather than nothing.

 

For example: The Show Me and Insight mods do show a LOT of things.

But aren't available at all if you're gonna go on a Klei official server

Even though some of the things would be doable only client-side

 

The same way, for the Chat History stuff - it's great if you're headed in to a mod friendly server, that already has it.

But if not, I wanna create an option for the user, that they can have at least something. Because (incomplete) chat logs do exist client-side.

 

I tend to play a lot of unmodded though, so maybe that's just my take on things

Link to comment
Share on other sites

34 minutes ago, Bigfootmech said:

The point of the client and server is: having something rather than nothing.

I have to disagree with this. The point of mods is to have something rather than nothing.
Mods are separated into client and server to ensure game integrity and security, it's practical, and just because it's good and proper game design.

34 minutes ago, Bigfootmech said:

For example: The Show Me and Insight mods do show a LOT of things.

But aren't available at all if you're gonna go on a Klei official server

That's the tough part about server mods. A wider realm of possibilities, and less ways to get to that realm. You can still sort of search for servers with specific mods (tags) though.

Edited by penguin0616
  • Like 1
Link to comment
Share on other sites

21 hours ago, penguin0616 said:

I have to disagree with this.

21 hours ago, penguin0616 said:

 game integrity and security, it's practical, and just because it's good and proper game design.

Agree to disagree :p

Yes, I agree to non-hacking. It would ruin the game for everybody.

But your argument doesn't make much sense to me in the context of "doing your best to not miss client-to-client messages while going to/from caves".

Or "showing food hunger satisfying values for the client, so you don't have to have the wiki page open"

But I also don't want to change your mind at all costs :p

So I'm happy to cut it here

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...