forked from minetest-mods/player_monoids
Tests: ensure integrity and fix up style issues
This change also greatly reduces the execution time of the tests.
This commit is contained in:
7
init.lua
7
init.lua
@ -26,7 +26,7 @@ In def, you can optionally define:
|
||||
These hooks allow you to respond to monoid changes, branch creation, and branch deletion.
|
||||
]]
|
||||
|
||||
local function monoid(def)
|
||||
player_monoids.make_monoid = function(def)
|
||||
local mon = {}
|
||||
|
||||
-- Clone the definition to avoid mutating the original
|
||||
@ -82,8 +82,6 @@ local function monoid(def)
|
||||
return mon
|
||||
end
|
||||
|
||||
player_monoids.make_monoid = monoid
|
||||
|
||||
local function init_player_branches_if_missing(self, p_name)
|
||||
if not self.player_map[p_name] then
|
||||
self:init_branches(p_name)
|
||||
@ -188,9 +186,6 @@ function mon_meta:reset_branch(player, branch_name)
|
||||
bdata.value = new_total
|
||||
|
||||
-- Update active branch
|
||||
local active_branch = self.player_map[p_name].active_branch or "main"
|
||||
local active_branch_data = self.player_map[p_name].branches[active_branch]
|
||||
|
||||
local active_branch = self.player_map[p_name].active_branch or "main"
|
||||
local active_branch_data = self.player_map[p_name].branches[active_branch]
|
||||
self.value_cache[p_name] = active_branch_data.value
|
||||
|
Reference in New Issue
Block a user