From eea78b8f0a2e1fcc32686a756139f7d96caac91c Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 3 Sep 2019 17:12:16 +0200 Subject: [PATCH] Restrict number of music players per village --- mods/village/generate.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mods/village/generate.lua b/mods/village/generate.lua index 558be31..d21dd53 100644 --- a/mods/village/generate.lua +++ b/mods/village/generate.lua @@ -258,13 +258,17 @@ function village.spawn_chunk(pos, orient, replace, pr, chunktype, nofill) goodies.fill(pos, chunktype, pr, "main", 3) end, true) + -- Restrict number of music players + local music = 0 util.nodefunc( pos, {x = pos.x+12, y = pos.y+12, z = pos.z+12}, "music:player", function(pos) - if pr:next(1, 2) > 1 then + if music >= 1 or pr:next(1, 2) > 1 then minetest.remove_node(pos) + else + music = music + 1 end end, true)