Project Zomboid
4,220 ψήφοι
Moodle Framework B41
5
6
4
2
2
2
   
Βραβείο
Αγαπημένο
Αγαπημένο
Μη αγαπημένο
Μέγεθος αρχείου
Αναρτήθηκε
Ενημερώθηκε
111.139 KB
5 Σεπ 2022, 16:22
21 Ιαν, 16:17
15 σημειώσεις αλλαγών ( προβολή )

Συνδρομή για λήψη
Moodle Framework B41

ΣΕ 2 ΣΥΛΛΟΓΕΣ ΑΠΟ Tchernobill
PZ Build 41
27 αντικείμενα
Modder Tools
5 αντικείμενα
ΠΕΡΙΓΡΑΦΗ
Makes it easy to add moodles for modders.


Moodle Framework Configuration
If you want colors to be easier to distinguish, you can set to white the reference color for moodles.
This applies to both vanilla and modded moodles.
You can also deactivate various displays to enhance mod compatibility.
Modded Backgrounds with small extensions right or down are now handled too.


How to create a new moodle
If you wanna create a Moodle * then follow the next steps, replacing * by your moodle name.

1/ Moodle Texture
Add Moodle *.png under media\ui.
Should be 30 by 30 pixels png with alpha enabled.

2/ Texture
Add the following text under media\lua\shared\Translate\EN
Moodles_EN { Moodles_*_Good_lvl1 = "text_1", Moodles_*_Good_desc_lvl1 = "text_desc_1", Moodles_*_Good_lvl2 = "text_2", Moodles_*_Good_desc_lvl2 = "text_desc_2", Moodles_*_Good_lvl3 = "text_3", Moodles_*_Good_desc_lvl3 = "text_desc_3", Moodles_*_Good_lvl4 = "text_4", Moodles_*_Good_desc_lvl4 = "text_desc_4", Moodles_*_Bad_lvl1 = "text_1", Moodles_*_Bad_desc_lvl1 = "text_desc_1", Moodles_*_Bad_lvl2 = "text_2", Moodles_*_Bad_desc_lvl2 = "text_desc_2", Moodles_*_Bad_lvl3 = "text_3", Moodles_*_Bad_desc_lvl3 = "text_desc_3", Moodles_*_Bad_lvl4 = "text_4", Moodles_*_Bad_desc_lvl4 = "text_desc_4", }
You can implement only a subset of this as long as you call only the implemented part.

3/ Moodle object creation
Add these lines in your mod:
require "MF_ISMoodle" MF.createMoodle(*);

4/ Moodle value updates
Access your moodle from your code with
require "MF_ISMoodle" MF.getMoodle(*,playerNum):setValue(myNewMoodleValue)--float
0.0 <= myNewMoodleValue <=1.0
Missing playerNum will make the mod incompatible with SplitScreen.

For tuning options see dedicated discussion


Limitations
  • Not tested with multiplayer. (it is expected to work)
  • Not tested with splitscreen. (it is expected to work since last version)
  • Oscillations are not based on vanilla value and the behaviour may depend on performances.


Credits where it is due


Known mods using this
Have a look at how they use this mod.


Ask for permission[theindiestone.com]
This mod can only be added to and extended with the express permission from the original creator. Having received permission, credit must be given to the original creator, both within the files of the mod and wherever the mod roams online.

If no permission is received you may not alter the mod.

You wanna support? A nice word is always welcome. Constructive feedback too.

Workshop ID: 2859296947
Mod ID: MoodleFramework
Δημοφιλείς συζητήσεις ΠΡΟΒΟΛΗ ΟΛΩΝ (1)
5
16 Δεκ 2024, 5:22
ΕΠΙΣΗΜΑΣΜΕΝΟ: Moodle Framework For Modders
Tchernobill
167 σχόλια
PepperCat 21 Ιαν, 11:08 
My mod is B41/B42 so I'm using the original one.

Code for one of my moodles:

local moodle = MF.getMoodle("dtemcaffeine", player:getPlayerNum())
if moodle ~= nil then
if player:getModData().DTEMcaffeineOnBody > 0 and player:HasTrait("AddictedToCaffeine") then
moodle:setValue(0.6);
moodle:setBackground(moodle:getGoodBadNeutral(), moodle:getLevel(), getTexture("media/ui/dtemcaffeine.png"))
--print("Moodle 1 positive")
elseif player:getModData().DTEMtimeSinceLastCaffeine > 1440 and player:HasTrait("AddictedToCaffeine") then
moodle:setValue(0.4);
moodle:setBackground(moodle:getGoodBadNeutral(), moodle:getLevel(), getTexture("media/ui/dtemcaffeine.png"))
--print("Moodle 1 negative")
else
moodle:setValue(0.5);
--print("No Moodle")
end
end

I still can't see the red/green background circle in the moodle. It just displays the icon
Tchernobill  [Δημιουργός] 21 Ιαν, 11:02 
@PepperCat For B42, yes. You probably modified the related mod options.
Aside, if your mod is not hybrid B41/42, I suggest you link to B42 version of this. (not both)
PepperCat 21 Ιαν, 9:35 
Hello!
Question. I had my Moodles working all good but now, my image is being displayed but the green/red circle behind the Moodle icon is not displayed anymore, do I need to add an additional line of code for that? Did something related to that changed in the latest update?
Tchernobill  [Δημιουργός] 30 Δεκ 2024, 15:11 
While this version works for both B41 and B42,
I uploaded a B42 only version with higher update frequency here . It already includes minors updates and is likely to include more in the future.
vsnegupal 29 Δεκ 2024, 1:02 
Greetings. Can you please give me permission to include this mod in my modpack for the server? There will be a link to this mod in the description, and I will always be in touch, if you change your mind. You can post your approval/disapproval here or in private messages.
thesimphany 28 Δεκ 2024, 16:13 
Please consider to keep a build 41 Version for those of us That will be remaining on Build 41 And the servers and files we have used for Years
UnCheat 27 Δεκ 2024, 15:36 
@Tchernobill
Here is a screenshot with the ProteinsMoodle
I don't think that overwriting the MF.ISMoodle.render by 3-rd patrty mods is the best solution to fix that
UnCheat 27 Δεκ 2024, 15:16 
@Tchernobill Please consider adding support for uneven textures backgrounds
For example neonMoodleIndicatorVertical vertical version is 128x138 px size or other mods where background is wider
So the aspect ratio scaling is needed to respect that.
To get the propper width you can use:
finalWidth = round(texture:getWidth() * moodleSize / texture:getHeight(), 0)

And you can calculate ratio only when:
texture:getWidth() ~= texture:getHeight()
Kacpix 21 Δεκ 2024, 2:14 
will it break one of my moodle mod (plain moodles, b41)?
Tchernobill  [Δημιουργός] 18 Δεκ 2024, 23:39 
@PepperCat & Enthuziazt :steamhappy:
@Additive yes. you can check mods tags for that