mekanism / Mekanism-Feature-Requests

All enhancements and feature requests for Mekanism (for current and future releases) should go here.
11 stars 4 forks source link

Mekanism / Project MMO cross-compatibility #273

Open XxInvictus opened 3 years ago

XxInvictus commented 3 years ago

Describe the feature you'd like

Project MMO being a popular skill-based levelling mod with the ability to lock functionality of certain items and actions behind skill-based minimum levels. It would greatly serve both mods to have the Mekanism machines both contributing to the XP of these skills while also having the ability to lock these machines behind the level limits of PMMO.

The developer of Project MMO has stated they are open for communication with developers of other modpacks to assist with integration and have a link to their Discord on the mod page linked below: https://www.curseforge.com/minecraft/mc-mods/project-mmo

Potential cross-compatibility functions:

Describe alternatives you've considered

The parts relating to XP levels and restrictions being set in the PMMO config can be configured on PMMO's side or with user-level overrides obviously, but it may be beneficial to get your input on what you think is appropriate for these values.

The XP being granted is a bit more complicated from my end. Something as simple as Energised Smelter providing Smelting XP could be done via a compatibility pack with listens for the appropriate events (unfortunately I am not sure at this time exactly what event is called when the Energised Smelter processes an item) and then interacting with the PMMO API to grant XP. This is currently limited by my not knowing the Mekanism events and also the fact that, if possible, it would be much cleaner to do from within Mekanism without the requirement for an additional mod.

Additional context

The first consideration in this is that currently, none of the Mekanism machines provide XP via the PMMO system (particular issue being the Energised Smelter) which either a. Forces the player to use a regular Furnace to attain the Smelting XP b. Forces the player to forego Smelting XP which then has further consequences of other items not DIRECTLY correlating to Smelting which require a certain Smelting level to use/craft/place

The second consideration is that currently, Mekanism being outside of the PMMO levelling system allows players to bypass the "manual" limits when performing the task themselves. For example, the Digital Miner can currently be used to bypass any of the Mining based level limits and mine ore the player would be otherwise unable to. The materials can be mined and collected off mob drops/chests, then the parts for a digital miner created and the digital miner used long before a player would ever get to the required levels to mine certain ores manually.

At this link, for extra information, is a tree-diagram of the current PMMO layout https://harmonised7.github.io/minecraft/pmmo/Features.html

pupnewfster commented 3 years ago

This is by no means a priority but may happen at some point. But if the digital miner bypasses anything that is on PMMO's end as the fake player it breaks blocks with has the same UUID as the player.

XxInvictus commented 3 years ago

Thanks for taking the time to respond, in the meantime in order to enable Energised Smelter XP is there an Event which is triggered when an item is smelted in the machine? This way I can create a bridge mod to at least get past the part which can interrupt progression :)

pupnewfster commented 3 years ago

No, and adding one would probably be a decent performance impact. I have some ideas how add in requirement/recipe based locking for various machines based on the owner of the machine, but it is by no means a priority especially given if it isn't done carefully may result in a fair bit of overhead when there are lots of machines/factories.

XxInvictus commented 3 years ago

That's okay, I understand you are busy, thanks again for the consideration and taking the time to respond! Manual furnacing for the near-future it is :)

XxInvictus commented 1 year ago

Hi pupnewfster,

I was just wondering if there had been any more thought put to this? I am not really too concerned about being able to lock down machines.

I have been doing some work to cleanup Project MMO for 1.16.5 so the dev no longer needs to maintain this version and two other compat mods so thought I would take the chance to revisit this one and see if I might be able to bring it into the fold.

I understand your team have their own priorities I just wanted to stop in and see if there was any clearer path for implementation. The problem is that without some sort of integration players are faced with two options, either don't use Mekanism, or run a chance of soft-locking yourself as you have not received any levels in Smithing while using Mekanism machines to perform actions like Smelting.

I don't wanna become another Mekanism Addons doing shady stuff just to be able to capture these occurrences 😆

pupnewfster commented 1 year ago

Not sure of a good way to have this done honestly. One idea I had back during late 1.12 and early porting I was thinking one way to lock machines' ability to do recipes would basically be to check the machine owner's uuid as the "user" but I never got around to doing so and also didn't have a good idea of how to do so without worrying about performance concerns of checking it often to make sure permission state hasn't changed.

For the digital miner at least though as of sometime in 1.16 we have started properly applying the UUID of the owner to the FakePlayer that the digital miner uses to break the blocks so you could grab the UUID for the miner via that and then pair that with the actual player in the Project MMO checks potentially.

Though at least for purposes of your latest questions, one potential solution on our end would be to fire some sort of custom RecipesProcessedEvent. Slightly unsure of what the overhead would be for that, but I presume a lot lower than the locking idea, as: a. Would only happen when the recipes complete instead potentially having to happen every tick b. For factories we could batch all recipes that completed in that tick into a single event rather than having to separately check each one on mek's end

Not quite sure when I will get around to doing something like that though (going to assign the issue to myself so that there is a higher chance I will remember to look into this when I get through some of the backlog of things I want to fix/rework), but definitely won't be done for 1.16 as that version is EOL for us (which also means that it is relatively safe tm to do semi shady stuff in terms of coremodding it)