mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-06-28 14:16:06 +02:00
improve pclasses to fix class stats don't change on equip/unequip/destroy armor
This commit is contained in:
@ -42,6 +42,7 @@ Yet another class mod for Minetest.
|
||||
- Def is a definition table that can contain many functions/values :
|
||||
- `on_assigned` which is a function, receiving as argument the player name
|
||||
- `on_unassigned` which is a function, receiving as argument the player name
|
||||
- `on_update` which is a function, receiving as argument the player name
|
||||
- `switch_params`, which is a table, containing parameters for the switch pedestal :
|
||||
- `holo_item` is mandatory. It's the itemstring of the item to be put over the pedestal
|
||||
- `color` is optional. Default is white. It's a RGB table.
|
||||
@ -78,6 +79,10 @@ Yet another class mod for Minetest.
|
||||
- Arguments : pname, itemname
|
||||
- Returns true if player `pname` can have items `itemstring` in his main inventory, according to his class
|
||||
|
||||
### pclasses.api.util.on_update
|
||||
- Arguments : pname
|
||||
- Update player's stats
|
||||
|
||||
### pclasses.api.reserve_item
|
||||
- Arguments : cname, itemstring
|
||||
- Adds an entry in the reserved items' table. Players will need to belong to class `cname` in order to have items `itemstring` in their main inventory
|
||||
|
@ -12,9 +12,16 @@ pclasses.api.register_class("adventurer", {
|
||||
if inform then
|
||||
minetest.chat_send_player(pname, "You are now an adventurer")
|
||||
end
|
||||
pclasses.api.util.on_update(pname)
|
||||
end,
|
||||
on_unassigned = function(pname)
|
||||
end,
|
||||
on_update = function(pname)
|
||||
local staminavalue = 10
|
||||
local manavalue = 100
|
||||
sprint.set_maxstamina(pname, staminavalue)
|
||||
mana.setmax(pname, manavalue)
|
||||
end,
|
||||
informations = pclasses.api.textify("Adventurer, the casual players, or hardcore players. Whatever end of the spectrum\n" ..
|
||||
"you're in, adventurer will bring you what you want : no advantages, no help. Maybe you\n" ..
|
||||
"don't want that if you just began playing. If that's the case.. just pick another tab and\n" ..
|
||||
|
@ -100,6 +100,13 @@ function pclasses.api.util.can_have_item(pname, itemname)
|
||||
return false
|
||||
end
|
||||
|
||||
function pclasses.api.util.on_update(pname)
|
||||
local cname = pclasses.api.get_player_class(pname)
|
||||
if cname ~= nil and pclasses.api.get_class_by_name(cname) and pclasses.api.get_class_by_name(cname).on_update then
|
||||
pclasses.api.get_class_by_name(cname).on_update(pname)
|
||||
end
|
||||
end
|
||||
|
||||
-- TEMPORARY CLASS SHIFT SYSTEM
|
||||
-- Used to test on local servers
|
||||
--
|
||||
|
Reference in New Issue
Block a user