Format code

This commit is contained in:
IamPyu 2024-11-16 10:05:03 -06:00
parent 7b0252863b
commit 362c60e67f
57 changed files with 545 additions and 538 deletions

View File

@ -7,7 +7,7 @@ PyuTest.deal_damage = function(target, damage, reason)
end
PyuTest.DAMAGE_TYPES = {
explosion = function (range)
explosion = function(range)
return {
type = "set_hp",
_pyutest = {

View File

@ -1,5 +1,5 @@
PyuTest = {}
Translate = function (s)
Translate = function(s)
return minetest.get_translator(minetest.get_current_modname())(s)
end
@ -22,7 +22,7 @@ PyuTest.OVERWORLD_DEEP_OCEAN_MIN = -31
PyuTest.NODEBOX_DEFAULT = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
}
PyuTest.DEFAULT_EFFECTS = {
@ -35,10 +35,10 @@ PyuTest.DEFAULT_EFFECTS = {
PyuTest.WORLD_GRAVITY = minetest.settings:get("movement_gravity")
PyuTest.get_schematic_path = function (name)
return minetest.get_modpath("pyutest") .. "/schematics/"..name..".mts"
PyuTest.get_schematic_path = function(name)
return minetest.get_modpath("pyutest") .. "/schematics/" .. name .. ".mts"
end
local modpath = minetest.get_modpath("pyutest")
dofile(modpath.."/damage.lua")
dofile(modpath.."/util.lua")
dofile(modpath .. "/damage.lua")
dofile(modpath .. "/util.lua")

View File

@ -2,13 +2,13 @@ PyuTest.util = {
tablecopy = function(t)
if t == nil then return nil end
local t2 = {}
for k,v in pairs(t) do
for k, v in pairs(t) do
t2[k] = v
end
return t2
end,
tableconcat = function (t1, t2)
tableconcat = function(t1, t2)
local nt = PyuTest.util.tablecopy(t1)
for k, v in pairs(t2) do
nt[k] = v
@ -19,7 +19,7 @@ PyuTest.util = {
tableconcat2 = function(t1, t2)
local nt = PyuTest.util.tablecopy(t1)
for i = 1, #t2 do
nt[#nt+i] = t2[i]
nt[#nt + i] = t2[i]
end
return nt
end,
@ -92,7 +92,7 @@ PyuTest.node_beside_group = function(pos, group)
return false
end
PyuTest.create_explosion = function (pos, range, rm_pos, dmg, damage_whitelist)
PyuTest.create_explosion = function(pos, range, rm_pos, dmg, damage_whitelist)
if rm_pos then
minetest.remove_node(pos)
end
@ -111,7 +111,7 @@ PyuTest.create_explosion = function (pos, range, rm_pos, dmg, damage_whitelist)
for _, v in pairs(minetest.get_objects_inside_radius(pos, range)) do
local function damage()
v:punch(v, nil, {
damage_groups = {fleshy = dmg}
damage_groups = { fleshy = dmg }
}, nil)
PyuTest.deal_damage(v, dmg, PyuTest.DAMAGE_TYPES.explosion(range))
end
@ -136,8 +136,8 @@ PyuTest.create_explosion = function (pos, range, rm_pos, dmg, damage_whitelist)
local r = range
local minpos = {x = pos.x - r, y = pos.y - r, z = pos.z - r}
local maxpos = {x = pos.x + r, y = pos.y + r, z = pos.z + r}
local minpos = { x = pos.x - r, y = pos.y - r, z = pos.z - r }
local maxpos = { x = pos.x + r, y = pos.y + r, z = pos.z + r }
minetest.add_particlespawner({
amount = range * 8,
@ -174,7 +174,7 @@ PyuTest.create_explosion = function (pos, range, rm_pos, dmg, damage_whitelist)
minpos = minpos,
maxpos = maxpos,
minvel = vector.new(-6, -6, -6),
maxvel = vector.new( 6, 6, 6),
maxvel = vector.new(6, 6, 6),
})
minetest.add_particlespawner({
@ -193,7 +193,7 @@ PyuTest.create_explosion = function (pos, range, rm_pos, dmg, damage_whitelist)
minpos = minpos,
maxpos = maxpos,
minvel = vector.new(-6, -6, -6),
maxvel = vector.new( 6, 6, 6),
maxvel = vector.new(6, 6, 6),
})
minetest.sound_play("block_break", {
@ -221,7 +221,7 @@ PyuTest.tool_caps = function(options)
return {
groupcaps = groupcaps,
punch_attack_uses = options.attack_uses,
damage_groups = options.damage_groups or {fleshy=3},
damage_groups = options.damage_groups or { fleshy = 3 },
full_punch_interval = options.full_punch_interval
}
end
@ -248,7 +248,7 @@ PyuTest.rotate_and_place = function(itemstack, placer, pointed_thing)
local fpos = finepos.y % 1
if p0.y - 1 == p1.y or (fpos > 0 and fpos < 0.5)
or (fpos < -0.5 and fpos > -0.999999999) then
or (fpos < -0.5 and fpos > -0.999999999) then
param2 = param2 + 20
if param2 == 21 then
param2 = 23
@ -304,7 +304,7 @@ function PyuTest.get_inventory_drops(pos, inventory, drops)
end
end
PyuTest.drop_item = function (pos, name)
PyuTest.drop_item = function(pos, name)
local o = minetest.add_item(pos, name)
if o then

View File

@ -1,4 +1,4 @@
minetest.register_globalstep(function ()
minetest.register_globalstep(function()
if minetest.settings:get_bool("always_day", false) then
minetest.set_timeofday(0.5)
end

View File

@ -4,9 +4,9 @@ PATH_FIND_ALGORITHM = "Dijkstra"
-- PATH_FIND_ALGORITHM = "A*"
PyuTest.ENTITY_BLOOD_AMOUNT = 6
PyuTest.HUMAN_LIKE_CBOX = {-0.25, -1, -0.25, 0.25, 1, 0.25}
PyuTest.HUMAN_LIKE_CBOX = { -0.25, -1, -0.25, 0.25, 1, 0.25 }
PyuTest.get_nearest_entity = function (entity, pos, range, only_player, dont_ignore_allies)
PyuTest.get_nearest_entity = function(entity, pos, range, only_player, dont_ignore_allies)
local closet_distance = math.huge
local nearest
@ -48,7 +48,7 @@ PyuTest.get_nearest_entity = function (entity, pos, range, only_player, dont_ign
return nearest
end
PyuTest.register_entity_spawn = function (name, entity, def)
PyuTest.register_entity_spawn = function(name, entity, def)
if def == nil then
error("Table expected for options!")
end
@ -77,10 +77,10 @@ PyuTest.register_entity_spawn = function (name, entity, def)
})
minetest.register_lbm({
name = name.."_spawn",
name = name .. "_spawn",
run_at_every_load = true,
nodenames = {name},
action = function (pos)
nodenames = { name },
action = function(pos)
minetest.remove_node(pos)
local min = def.min or 1
@ -93,7 +93,6 @@ PyuTest.register_entity_spawn = function (name, entity, def)
minetest.add_entity(pos, entity)
end
end
end
})
end
@ -129,7 +128,8 @@ function class:path_find_nearest_entity(follow_only_player)
end
state.target.position = state.target.object:get_pos()
state.target.path = minetest.find_path(pos, state.target.position, cfg.view_range, cfg.max_jump, cfg.max_drop, PATH_FIND_ALGORITHM)
state.target.path = minetest.find_path(pos, state.target.position, cfg.view_range, cfg.max_jump, cfg.max_drop,
PATH_FIND_ALGORITHM)
state.target.pathindex = 1
else
if state.target.pathindex == #state.target.path then
@ -146,8 +146,7 @@ function class:path_find_nearest_entity(follow_only_player)
end
end
PyuTest.make_mob = function (name, properties, options)
PyuTest.make_mob = function(name, properties, options)
local default_options = {
ai = "dummy",
max_jump = 1,
@ -199,7 +198,7 @@ PyuTest.make_mob = function (name, properties, options)
}
},
on_step = function (self, dtime, moveresult)
on_step = function(self, dtime, moveresult)
self.dtime = dtime
self.moveresult = moveresult
@ -217,7 +216,7 @@ PyuTest.make_mob = function (name, properties, options)
obj:set_hp(p.hp_max)
end
p.infotext = string.format("Mob Health: %d/%d", obj:get_hp(), p.hp_max)
p.infotext = string.format("Mob Health: %d/%d", obj:get_hp(), p.hp_max)
obj:set_properties(p)
if ai == nil or ai == "dummy" then
@ -231,12 +230,12 @@ PyuTest.make_mob = function (name, properties, options)
end
end,
on_punch = function (self)
on_punch = function(self)
local pos = self.object:get_pos()
minetest.sound_play(self.options.sounds.hurt, {pos = pos})
minetest.sound_play(self.options.sounds.hurt, { pos = pos })
minetest.add_particlespawner({
amount = 8,
amount = 8,
time = 0.4,
minexptime = 0.4,
maxexptime = 0.8,
@ -255,12 +254,12 @@ PyuTest.make_mob = function (name, properties, options)
})
end,
on_death = function (self)
on_death = function(self)
local pos = self.object:get_pos()
for _, v in pairs(self.options.drops) do
PyuTest.drop_item(pos, v)
end
end
}, {__index = class}))
}, { __index = class }))
end

View File

@ -3,7 +3,7 @@ dofile(modpath .. "/api.lua")
PyuTest.make_mob("pyutest_entities:test_follower", {
visual = "upright_sprite",
visual_size = {x = 1, y = 2},
visual_size = { x = 1, y = 2 },
makes_footstep_sound = true,
textures = {
"pyutest-monster.png", "pyutest-monster_back.png"
@ -22,7 +22,7 @@ PyuTest.make_mob("pyutest_entities:test_follower", {
PyuTest.make_mob("pyutest_entities:dummy", {
visual = "upright_sprite",
visual_size = {x = 1, y = 2},
visual_size = { x = 1, y = 2 },
makes_footstep_sound = true,
textures = {
"player.png", "player_back.png"

View File

@ -1,3 +0,0 @@
# pyutest_mobs
Mobs and entities

View File

@ -4,19 +4,19 @@ PyuTest.create_boss_egg = function(mob_id, desc, texture, addegg, no_creative, c
minetest.register_craft({
output = mob_id,
recipe = {
{"", craft, ""},
{craft, "pyutest_ores:emerald_shard", craft},
{"", craft, ""}
{ "", craft, "" },
{ craft, "pyutest_ores:emerald_shard", craft },
{ "", craft, "" }
}
})
local t = mob_id:split(":")
local mob_name = t[#t]
local cage_id = "pyutest_mobs:"..mob_name.."_spawn_cage"
local cage_id = "pyutest_mobs:" .. mob_name .. "_spawn_cage"
PyuTest.make_node(cage_id, desc:gsub("Spawn Egg", "") .. "Boss Spawner Cage", {
cracky = PyuTest.BLOCK_SLOW
}, {"pyutest-cage.png"}, {
}, { "pyutest-cage.png" }, {
drawtype = "glasslike",
on_rightclick = function(pos)
mobs:add_mob(vector.add(pos, vector.new(0, 1, 0)), {

View File

@ -13,7 +13,7 @@ mobs:register_mob("pyutest_mobs:monster", {
attack_type = "dogfight",
pathfinding = 1,
visual = "upright_sprite",
visual_size = {x = 1, y = 2},
visual_size = { x = 1, y = 2 },
collisionbox = PyuTest.HUMAN_LIKE_CBOX,
physical = true,
blood_amount = PyuTest.ENTITY_BLOOD_AMOUNT,
@ -52,10 +52,10 @@ mobs:register_mob("pyutest_mobs:human", {
attack_type = "dogfight",
pathfinding = 1,
visual = "upright_sprite",
visual_size = {x = 1, y = 2},
visual_size = { x = 1, y = 2 },
collisionbox = PyuTest.HUMAN_LIKE_CBOX,
textures = {"player.png", "player_back.png"},
follow = {"pyutest_tools:coin"},
textures = { "player.png", "player_back.png" },
follow = { "pyutest_tools:coin" },
runaway = true,
view_range = 15,
reach = 2,
@ -93,7 +93,7 @@ mobs:register_mob("pyutest_mobs:mimic", {
attack_type = "dogfight",
pathfinding = 1,
visual = "cube",
visual_size = {x = 1, y = 1, z = 1},
visual_size = { x = 1, y = 1, z = 1 },
collisionbox = {
-0.25, -0.5, -0.25, 0.25, 0.5, 0.25
},
@ -124,11 +124,11 @@ mobs:register_mob("pyutest_mobs:firefly", {
fly = true,
keep_flying = true,
visual = "sprite",
visual_size = {x = 0.05, y = 0.05},
visual_size = { x = 0.05, y = 0.05 },
collisionbox = {
-0.0, -0.0, -0.0, 0.0, 0.0, 0.0
},
textures = {"pyutest-firefly.png"},
textures = { "pyutest-firefly.png" },
blood_amount = PyuTest.ENTITY_BLOOD_AMOUNT,
glow = 7,
})

View File

@ -2,17 +2,17 @@ local modpath = minetest.get_modpath("pyutest_mobs")
mobs.fallback_node = "pyutest_blocks:dirt_block"
dofile(modpath.."/api.lua")
dofile(modpath .. "/api.lua")
dofile(modpath.."/basic.lua")
dofile(modpath.."/snowman.lua")
dofile(modpath.."/wind_warrior.lua")
dofile(modpath.."/necromancer.lua")
dofile(modpath .. "/basic.lua")
dofile(modpath .. "/snowman.lua")
dofile(modpath .. "/wind_warrior.lua")
dofile(modpath .. "/necromancer.lua")
if not PyuTest.is_flat() then
mobs:spawn({
name = "pyutest_mobs:monster",
nodes = {"group:ground"},
nodes = { "group:ground" },
interval = 4,
chance = 1,
active_object_count = 5,
@ -25,19 +25,19 @@ if not PyuTest.is_flat() then
mobs:spawn({
name = "pyutest_mobs:monster",
nodes = {"group:ground"},
nodes = { "group:ground" },
interval = 2,
chance = 2,
active_object_count = 7,
min_light = 0,
max_light = minetest.LIGHT_MAX,
min_height = PyuTest.OVERWORLD_SURFACE_BOTTOM - 1,
max_height= PyuTest.OVERWORLD_BOTTOM
max_height = PyuTest.OVERWORLD_BOTTOM
})
mobs:spawn({
name = "pyutest_mobs:human",
nodes = {"group:ground"},
nodes = { "group:ground" },
interval = 3,
chance = 4,
active_object_count = 3,
@ -49,7 +49,7 @@ if not PyuTest.is_flat() then
mobs:spawn({
name = "pyutest_mobs:mimic",
nodes = {"group:ground"},
nodes = { "group:ground" },
interval = 3,
chance = 18,
active_object_count = 2,
@ -60,7 +60,7 @@ if not PyuTest.is_flat() then
mobs:spawn({
name = "pyutest_mobs:firefly",
nodes = {"group:ground", "air"},
nodes = { "group:ground", "air" },
interval = 3,
chance = 3,
active_object_count = 4,

View File

@ -1,13 +1,13 @@
local necroball_hit_player = function (self, player)
local necroball_hit_player = function(self, player)
player:punch(self.object, nil, {
damage_groups = {fleshy = 3}
damage_groups = { fleshy = 3 }
}, nil)
end
mobs:register_arrow("pyutest_mobs:arrow_necroball", {
visual = "sprite",
visual_size = {x = 1, y = 1},
textures = {"pyutest-necroball.png"},
visual_size = { x = 1, y = 1 },
textures = { "pyutest-necroball.png" },
hit_player = necroball_hit_player,
hit_mob = necroball_hit_player,
@ -46,7 +46,7 @@ mobs:register_mob("pyutest_mobs:necromancer", {
armor = 100,
passive = false,
visual = "upright_sprite",
visual_size = {x = 1, y = 2},
visual_size = { x = 1, y = 2 },
collisionbox = PyuTest.HUMAN_LIKE_CBOX,
physical = true,
blood_amount = PyuTest.ENTITY_BLOOD_AMOUNT,
@ -83,5 +83,5 @@ mobs:register_mob("pyutest_mobs:necromancer", {
dogshoot_count2_max = 6,
})
PyuTest.create_boss_egg("pyutest_mobs:necromancer", "Necromancer Spawn Egg",
"pyutest-egg.png^[multiply:dimgray", 0, nil,
"pyutest_tools:bone")
"pyutest-egg.png^[multiply:dimgray", 0, nil,
"pyutest_tools:bone")

View File

@ -1,15 +1,15 @@
local snowball_hit_player = function (self, player)
local snowball_hit_player = function(self, player)
player:punch(self.object, nil, {
damage_groups = {fleshy = 5}
damage_groups = { fleshy = 5 }
}, nil)
end
mobs:register_arrow("pyutest_mobs:arrow_snowball", {
visual = "sprite",
visual_size = {x = 1, y = 1},
textures = {"pyutest-snowball.png"},
hit_node = function (self, pos)
PyuTest.create_explosion(pos, 1, false, 9, {self.object})
visual_size = { x = 1, y = 1 },
textures = { "pyutest-snowball.png" },
hit_node = function(self, pos)
PyuTest.create_explosion(pos, 1, false, 9, { self.object })
end,
hit_player = snowball_hit_player,
hit_mob = snowball_hit_player,
@ -39,7 +39,7 @@ mobs:register_mob("pyutest_mobs:snowman", {
homing = true,
pathfinding = 1,
visual = "upright_sprite",
visual_size = {x = 1, y = 2},
visual_size = { x = 1, y = 2 },
collisionbox = PyuTest.HUMAN_LIKE_CBOX,
physical = true,
blood_amount = PyuTest.ENTITY_BLOOD_AMOUNT,
@ -73,5 +73,5 @@ mobs:register_mob("pyutest_mobs:snowman", {
}
})
PyuTest.create_boss_egg("pyutest_mobs:snowman", "Snowman Spawn Egg",
"pyutest-egg.png^[multiply:skyblue", 0, nil,
"pyutest_blocks:snow_block")
"pyutest-egg.png^[multiply:skyblue", 0, nil,
"pyutest_blocks:snow_block")

View File

@ -1,6 +1,6 @@
local windball_hit_player = function (self, player)
local windball_hit_player = function(self, player)
player:punch(self.object, nil, {
damage_groups = {fleshy = 3}
damage_groups = { fleshy = 3 }
}, nil)
math.randomseed(os.time())
@ -13,8 +13,8 @@ end
mobs:register_arrow("pyutest_mobs:arrow_windball", {
visual = "sprite",
visual_size = {x = 1, y = 1},
textures = {"pyutest-windball.png"},
visual_size = { x = 1, y = 1 },
textures = { "pyutest-windball.png" },
hit_player = windball_hit_player,
hit_mob = windball_hit_player,
velocity = 9,
@ -42,7 +42,7 @@ mobs:register_mob("pyutest_mobs:wind_warrior", {
homing = true,
pathfinding = 1,
visual = "upright_sprite",
visual_size = {x = 1, y = 2},
visual_size = { x = 1, y = 2 },
collisionbox = PyuTest.HUMAN_LIKE_CBOX,
physical = true,
blood_amount = PyuTest.ENTITY_BLOOD_AMOUNT,
@ -76,6 +76,6 @@ mobs:register_mob("pyutest_mobs:wind_warrior", {
}
})
PyuTest.create_boss_egg("pyutest_mobs:wind_warrior", "Wind Warrior Spawn Egg",
"pyutest-egg.png^[multiply:white", 0, nil,
-- just a place holder until more wind-related items come.
"pyutest_ores:iron_ingot")
"pyutest-egg.png^[multiply:white", 0, nil,
-- just a place holder until more wind-related items come.
"pyutest_ores:iron_ingot")

View File

@ -51,7 +51,7 @@ PyuTest.NODE_BOXES = {
SLIGHTLY_SMALLER = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.45, 0.5},
{ -0.5, -0.5, -0.5, 0.5, 0.45, 0.5 },
}
}
}
@ -243,8 +243,8 @@ PyuTest.make_liquid = function(name, desc, groups, texture, speed, extra_conf)
}), { texture }, make_liquid_flags("source"))
PyuTest.make_node(name .. "_flowing", "Flowing " .. desc, g, { texture }, make_liquid_flags("flowing"))
PyuTest.make_node(name .. "_infinite", "Infinite " .. desc, PyuTest.util.tableconcat(g, {
not_in_creative_inventory = 0
not_in_creative_inventory = 0
}), { texture }, make_liquid_flags("source", {
liquid_alternative_flowing = name .. "_infinite",
liquid_alternative_flowing = name .. "_infinite",
}))
end

View File

@ -11,7 +11,7 @@ PyuTest.make_building_blocks("pyutest_blocks:podzol", "Podzol", { "pyutest-dirt.
acid_vulnerable = 1,
crumbly = PyuTest.BLOCK_FAST
}, {
overlay_tiles = {{name = "pyutest-ore-overlay.png", color = "#54623c"}}
overlay_tiles = { { name = "pyutest-ore-overlay.png", color = "#54623c" } }
})
PyuTest.make_building_blocks("pyutest_blocks:snow", "Snow", { "pyutest-snow.png" }, nil, {
@ -29,13 +29,13 @@ PyuTest.make_building_blocks("pyutest_blocks:sand", "Sand", { "pyutest-sand.png"
})
PyuTest.make_building_blocks("pyutest_blocks:mycelium", "Mycelium", {
{name = "pyutest-grass-top.png", color = "#5c455e"}, "pyutest-dirt.png"
{ name = "pyutest-grass-top.png", color = "#5c455e" }, "pyutest-dirt.png"
}, nil, {
ground = 1,
dirt = 1,
crumbly = PyuTest.BLOCK_FAST,
}, {
overlay_tiles = {"", "", {name = "pyutest-grass-side.png", color = "#5c455e"}}
overlay_tiles = { "", "", { name = "pyutest-grass-side.png", color = "#5c455e" } }
})
PyuTest.make_building_blocks("pyutest_blocks:clay", "Clay", { "pyutest-clay-block.png" }, nil, {
@ -62,31 +62,31 @@ PyuTest.make_building_blocks("pyutest_blocks:darkstone", "Darkstone", { "pyutest
cracky = PyuTest.BLOCK_NORMAL,
}, { is_ground_content = true })
PyuTest.make_building_blocks("pyutest_blocks:granite", "Granite", {"pyutest-granite.png"}, nil, {
PyuTest.make_building_blocks("pyutest_blocks:granite", "Granite", { "pyutest-granite.png" }, nil, {
ground = 1,
stone = 1,
cracky = PyuTest.BLOCK_NORMAL,
})
PyuTest.make_building_blocks("pyutest_blocks:andesite", "Andesite", {"pyutest-andesite.png"}, nil, {
PyuTest.make_building_blocks("pyutest_blocks:andesite", "Andesite", { "pyutest-andesite.png" }, nil, {
ground = 1,
stone = 1,
cracky = PyuTest.BLOCK_NORMAL,
})
PyuTest.make_building_blocks("pyutest_blocks:diorite", "Diorite", {"pyutest-diorite.png"}, nil, {
PyuTest.make_building_blocks("pyutest_blocks:diorite", "Diorite", { "pyutest-diorite.png" }, nil, {
ground = 1,
stone = 1,
cracky = PyuTest.BLOCK_NORMAL,
})
PyuTest.make_building_blocks("pyutest_blocks:tuff", "Tuff", {"pyutest-tuff.png"}, nil, {
PyuTest.make_building_blocks("pyutest_blocks:tuff", "Tuff", { "pyutest-tuff.png" }, nil, {
ground = 1,
stone = 1,
cracky = PyuTest.BLOCK_NORMAL,
})
PyuTest.make_building_blocks("pyutest_blocks:calcite", "Calcite", {"pyutest-calcite.png"}, nil, {
PyuTest.make_building_blocks("pyutest_blocks:calcite", "Calcite", { "pyutest-calcite.png" }, nil, {
ground = 1,
stone = 1,
cracky = PyuTest.BLOCK_NORMAL,
@ -175,9 +175,10 @@ PyuTest.make_building_blocks("pyutest_blocks:obsidian", "Obsidian", { "pyutest-o
cracky = PyuTest.BLOCK_NORMAL,
}, { is_ground_content = false })
PyuTest.make_building_blocks("pyutest_blocks:crystal_lantern", "Crystal Lantern", { "pyutest-crystal-lantern.png" }, nil, {
cracky = PyuTest.BLOCK_FAST
}, {
PyuTest.make_building_blocks("pyutest_blocks:crystal_lantern", "Crystal Lantern", { "pyutest-crystal-lantern.png" }, nil,
{
cracky = PyuTest.BLOCK_FAST
}, {
light_source = minetest.LIGHT_MAX,
paramtype = "light"
})

View File

@ -7,7 +7,7 @@ PyuTest.make_node("pyutest_blocks:crate", "Crate", {
inventory:set_size("main", 8 * 4)
end,
on_destruct = function (pos)
on_destruct = function(pos)
local drops = {}
PyuTest.get_inventory_drops(pos, "main", drops)
@ -19,11 +19,11 @@ PyuTest.make_node("pyutest_blocks:crate", "Crate", {
on_rightclick = function(pos, node, clicker)
local spos = string.format("%d,%d,%d", pos.x, pos.y, pos.z)
local formspec =
"size[8,9]" ..
"list[nodemeta:" .. spos .. ";main;0,0;8,4;]" ..
"list[current_player;main;0,5;8,4;]" ..
"listring[nodemeta:" .. spos .. ";main]" ..
"listring[current_player;main]"
"size[8,9]" ..
"list[nodemeta:" .. spos .. ";main;0,0;8,4;]" ..
"list[current_player;main;0,5;8,4;]" ..
"listring[nodemeta:" .. spos .. ";main]" ..
"listring[current_player;main]"
minetest.show_formspec(clicker:get_player_name(), string.format("pyutest_blocks:crate_%d_%d_%d", pos.x, pos.y, pos.z),
formspec)
minetest.sound_play({ name = "crate_open", gain = 1 }, { pos = pos })

View File

@ -129,15 +129,15 @@ PyuTest.make_node("pyutest_blocks:ladder", "Ladder", {
})
PyuTest.make_node("pyutest_blocks:magma", "Magma", {
cracky = PyuTest.BLOCK_FAST,
fire_persist = 1
cracky = PyuTest.BLOCK_FAST,
fire_persist = 1
}, { "pyutest-molten-rock.png" }, {
paramtype = "light",
light_source = 11,
overlay_tiles = {
{name = "pyutest-ore-overlay.png", color = "darkorange"}
{ name = "pyutest-ore-overlay.png", color = "darkorange" }
},
on_walk_over = function (pos, node, player)
on_walk_over = function(pos, node, player)
if player then
PyuTest.deal_damage(player, 3)
end
@ -145,7 +145,7 @@ PyuTest.make_node("pyutest_blocks:magma", "Magma", {
})
PyuTest.make_node("pyutest_blocks:bedrock", "Bedrock", {
}, {"pyutest-bedrock.png"}, {
}, { "pyutest-bedrock.png" }, {
diggable = false,
pointable = "blocking",
is_ground_content = false
@ -153,9 +153,9 @@ PyuTest.make_node("pyutest_blocks:bedrock", "Bedrock", {
PyuTest.make_node("pyutest_blocks:weak_ice", "Weak Ice", {
cracky = PyuTest.BLOCK_FAST
}, {"pyutest-ice.png"}, {
}, { "pyutest-ice.png" }, {
on_walk_over = function(pos)
minetest.set_node(pos, {name = "pyutest_blocks:water_source"})
minetest.set_node(pos, { name = "pyutest_blocks:water_source" })
end
})

View File

@ -5,7 +5,7 @@ PyuTest.make_item("pyutest_buckets:bucket", "Empty Bucket", {}, "pyutest-bucket.
}
},
on_place = function (itemstack, user, pointed_thing)
on_place = function(itemstack, user, pointed_thing)
if user == nil then
return
end
@ -29,12 +29,12 @@ PyuTest.make_item("pyutest_buckets:bucket", "Empty Bucket", {}, "pyutest-bucket.
minetest.register_craft({
output = "pyutest_buckets:bucket",
recipe = {
{"pyutest_ores:iron_ingot", "", "pyutest_ores:iron_ingot"},
{"", "pyutest_ores:iron_ingot", ""}
{ "pyutest_ores:iron_ingot", "", "pyutest_ores:iron_ingot" },
{ "", "pyutest_ores:iron_ingot", "" }
}
})
PyuTest.make_liquid_bucket = function (name, desc, source, color)
PyuTest.make_liquid_bucket = function(name, desc, source, color)
local texture = string.format("pyutest-bucket.png^(pyutest-bucket-overlay.png^[colorize:%s)", color)
PyuTest.make_node(name, desc, {
@ -46,10 +46,10 @@ PyuTest.make_liquid_bucket = function (name, desc, source, color)
wield_image = texture,
inventory_image = texture,
after_place_node = function (pos, placer)
after_place_node = function(pos, placer)
if placer == nil then return end
PyuTest.give_item_or_drop(ItemStack("pyutest_buckets:bucket"), placer:get_inventory(), "main", placer:get_pos())
minetest.set_node(pos, {name = source})
minetest.set_node(pos, { name = source })
end,
})

View File

@ -1,90 +1,90 @@
minetest.register_craft({
output = "pyutest_tools:wooden_pickaxe 1",
recipe = {
{"group:wooden_planks", "group:wooden_planks", "group:wooden_planks"},
{"", "pyutest_tools:stick", ""},
{"", "pyutest_tools:stick", ""}
{ "group:wooden_planks", "group:wooden_planks", "group:wooden_planks" },
{ "", "pyutest_tools:stick", "" },
{ "", "pyutest_tools:stick", "" }
}
})
minetest.register_craft({
output = "pyutest_tools:wooden_axe 1",
recipe = {
{"group:wooden_planks", "group:wooden_planks", ""},
{"group:wooden_planks", "pyutest_tools:stick", ""},
{"", "pyutest_tools:stick", ""}
{ "group:wooden_planks", "group:wooden_planks", "" },
{ "group:wooden_planks", "pyutest_tools:stick", "" },
{ "", "pyutest_tools:stick", "" }
}
})
minetest.register_craft({
output = "pyutest_tools:wooden_sword 1",
recipe = {
{"", "group:wooden_planks", ""},
{"", "group:wooden_planks", ""},
{"", "pyutest_tools:stick", ""}
{ "", "group:wooden_planks", "" },
{ "", "group:wooden_planks", "" },
{ "", "pyutest_tools:stick", "" }
}
})
minetest.register_craft({
output = "pyutest_tools:stone_pickaxe",
recipe = {
{"group:stone", "group:stone", "group:stone"},
{"", "pyutest_tools:stick", ""},
{"", "pyutest_tools:stick", ""}
{ "group:stone", "group:stone", "group:stone" },
{ "", "pyutest_tools:stick", "" },
{ "", "pyutest_tools:stick", "" }
}
})
minetest.register_craft({
output = "pyutest_tools:stone_axe",
recipe = {
{"group:stone", "group:stone", ""},
{"group:stone", "pyutest_tools:stick", ""},
{"", "pyutest_tools:stick", ""}
{ "group:stone", "group:stone", "" },
{ "group:stone", "pyutest_tools:stick", "" },
{ "", "pyutest_tools:stick", "" }
}
})
minetest.register_craft({
output = "pyutest_tools:stone_sword",
recipe = {
{"", "group:stone", ""},
{"", "group:stone", ""},
{"", "pyutest_tools:stick", ""}
{ "", "group:stone", "" },
{ "", "group:stone", "" },
{ "", "pyutest_tools:stick", "" }
}
})
minetest.register_craft({
output = "pyutest_tools:iron_pickaxe",
recipe = {
{"pyutest_ores:iron_ingot", "pyutest_ores:iron_ingot", "pyutest_ores:iron_ingot"},
{"", "pyutest_tools:stick", ""},
{"", "pyutest_tools:stick", ""}
{ "pyutest_ores:iron_ingot", "pyutest_ores:iron_ingot", "pyutest_ores:iron_ingot" },
{ "", "pyutest_tools:stick", "" },
{ "", "pyutest_tools:stick", "" }
}
})
minetest.register_craft({
output = "pyutest_tools:iron_axe",
recipe = {
{"pyutest_ores:iron_ingot", "pyutest_ores:iron_ingot", ""},
{"pyutest_ores:iron_ingot", "pyutest_tools:stick", ""},
{"", "pyutest_tools:stick", ""}
{ "pyutest_ores:iron_ingot", "pyutest_ores:iron_ingot", "" },
{ "pyutest_ores:iron_ingot", "pyutest_tools:stick", "" },
{ "", "pyutest_tools:stick", "" }
}
})
minetest.register_craft({
output = "pyutest_tools:iron_sword",
recipe = {
{"pyutest_ores:iron_ingot"},
{"pyutest_ores:iron_ingot"},
{"pyutest_tools:stick"}
{ "pyutest_ores:iron_ingot" },
{ "pyutest_ores:iron_ingot" },
{ "pyutest_tools:stick" }
}
})
minetest.register_craft({
output = "pyutest_farming:hoe",
recipe = {
{"pyutest_ores:iron_ingot", "pyutest_ores:iron_ingot", ""},
{"", "pyutest_tools:stick", ""},
{"", "pyutest_tools:stick", ""}
{ "pyutest_ores:iron_ingot", "pyutest_ores:iron_ingot", "" },
{ "", "pyutest_tools:stick", "" },
{ "", "pyutest_tools:stick", "" }
}
})
@ -100,27 +100,27 @@ minetest.register_craft({
minetest.register_craft({
output = "pyutest_tools:diamond_pickaxe",
recipe = {
{"pyutest_ores:diamond_shard", "pyutest_ores:diamond_shard", "pyutest_ores:diamond_shard"},
{"", "pyutest_tools:stick", ""},
{"", "pyutest_tools:stick", ""}
{ "pyutest_ores:diamond_shard", "pyutest_ores:diamond_shard", "pyutest_ores:diamond_shard" },
{ "", "pyutest_tools:stick", "" },
{ "", "pyutest_tools:stick", "" }
}
})
minetest.register_craft({
output = "pyutest_tools:diamond_axe",
recipe = {
{"pyutest_ores:diamond_shard", "pyutest_ores:diamond_shard", ""},
{"pyutest_ores:diamond_shard", "pyutest_tools:stick", ""},
{"", "pyutest_tools:stick", ""}
{ "pyutest_ores:diamond_shard", "pyutest_ores:diamond_shard", "" },
{ "pyutest_ores:diamond_shard", "pyutest_tools:stick", "" },
{ "", "pyutest_tools:stick", "" }
}
})
minetest.register_craft({
output = "pyutest_tools:diamond_sword",
recipe = {
{"pyutest_ores:diamond_shard"},
{"pyutest_ores:diamond_shard"},
{"pyutest_tools:stick"}
{ "pyutest_ores:diamond_shard" },
{ "pyutest_ores:diamond_shard" },
{ "pyutest_tools:stick" }
}
})
@ -136,34 +136,34 @@ minetest.register_craft({
minetest.register_craft({
output = "pyutest_blocks:crate",
recipe = {
{"group:wooden_planks", "group:wooden_planks", "group:wooden_planks"},
{"group:wooden_planks", "", "group:wooden_planks"},
{"group:wooden_planks", "group:wooden_planks", "group:wooden_planks"}
{ "group:wooden_planks", "group:wooden_planks", "group:wooden_planks" },
{ "group:wooden_planks", "", "group:wooden_planks" },
{ "group:wooden_planks", "group:wooden_planks", "group:wooden_planks" }
}
})
minetest.register_craft({
output = "pyutest_blocks:brick_block 4",
recipe = {
{"pyutest_tools:brick", "pyutest_tools:brick"},
{"pyutest_tools:brick", "pyutest_tools:brick"}
{ "pyutest_tools:brick", "pyutest_tools:brick" },
{ "pyutest_tools:brick", "pyutest_tools:brick" }
}
})
minetest.register_craft({
output = "pyutest_furnace:furnace",
recipe = {
{"group:stone", "group:stone", "group:stone"},
{"group:stone", "", "group:stone"},
{"group:stone", "group:stone", "group:stone"}
{ "group:stone", "group:stone", "group:stone" },
{ "group:stone", "", "group:stone" },
{ "group:stone", "group:stone", "group:stone" }
}
})
minetest.register_craft({
output = "pyutest_blocks:workbench",
recipe = {
{"group:wooden_planks", "group:wooden_planks"},
{"group:wooden_planks", "group:wooden_planks"},
{ "group:wooden_planks", "group:wooden_planks" },
{ "group:wooden_planks", "group:wooden_planks" },
}
})
@ -187,40 +187,40 @@ minetest.register_craft({
minetest.register_craft({
output = "pyutest_blocks:clay_block 4",
recipe = {
{"pyutest_tools:clay", "pyutest_tools:clay"},
{"pyutest_tools:clay", "pyutest_tools:clay"}
{ "pyutest_tools:clay", "pyutest_tools:clay" },
{ "pyutest_tools:clay", "pyutest_tools:clay" }
}
})
minetest.register_craft({
output = "pyutest_blocks:bone_block 4",
recipe = {
{"pyutest_tools:bone", "pyutest_tools:bone"},
{"pyutest_tools:bone", "pyutest_tools:bone"}
{ "pyutest_tools:bone", "pyutest_tools:bone" },
{ "pyutest_tools:bone", "pyutest_tools:bone" }
}
})
minetest.register_craft({
output = "pyutest_tools:stick 4",
recipe = {
{"group:wooden_planks"},
{"group:wooden_planks"}
{ "group:wooden_planks" },
{ "group:wooden_planks" }
}
})
minetest.register_craft({
output = "pyutest_tools:coin",
recipe = {
{"pyutest_ores:gold_ingot", "pyutest_ores:gold_ingot", "pyutest_ores:gold_ingot"},
{"pyutest_ores:gold_ingot", "pyutest_ores:gold_ingot", "pyutest_ores:gold_ingot"},
{"pyutest_ores:gold_ingot", "pyutest_ores:gold_ingot", "pyutest_ores:gold_ingot"}
{ "pyutest_ores:gold_ingot", "pyutest_ores:gold_ingot", "pyutest_ores:gold_ingot" },
{ "pyutest_ores:gold_ingot", "pyutest_ores:gold_ingot", "pyutest_ores:gold_ingot" },
{ "pyutest_ores:gold_ingot", "pyutest_ores:gold_ingot", "pyutest_ores:gold_ingot" }
}
})
minetest.register_craft({
output = "pyutest_ores:gold_ingot 9",
recipe = {
{"pyutest_tools:coin"}
{ "pyutest_tools:coin" }
}
})
@ -239,41 +239,41 @@ minetest.register_craft({
minetest.register_craft({
output = "pyutest_blocks:light 4",
recipe = {
{"pyutest_blocks:torch", "pyutest_blocks:torch"},
{"pyutest_blocks:torch", "pyutest_blocks:torch"}
{ "pyutest_blocks:torch", "pyutest_blocks:torch" },
{ "pyutest_blocks:torch", "pyutest_blocks:torch" }
}
})
minetest.register_craft({
output = "pyutest_blocks:tnt 4",
recipe = {
{"pyutest_blocks:sand_block", "pyutest_tools:gunpowder"},
{"pyutest_tools:gunpowder", "pyutest_blocks:sand_block"}
{ "pyutest_blocks:sand_block", "pyutest_tools:gunpowder" },
{ "pyutest_tools:gunpowder", "pyutest_blocks:sand_block" }
}
})
minetest.register_craft({
output = "pyutest_blocks:tnt 4",
recipe = {
{"pyutest_tools:gunpowder", "pyutest_blocks:sand_block"},
{"pyutest_blocks:sand_block", "pyutest_tools:gunpowder"}
{ "pyutest_tools:gunpowder", "pyutest_blocks:sand_block" },
{ "pyutest_blocks:sand_block", "pyutest_tools:gunpowder" }
}
})
minetest.register_craft({
output = "pyutest_blocks:torch 4",
recipe = {
{"pyutest_ores:coal_lump"},
{"pyutest_tools:stick"}
{ "pyutest_ores:coal_lump" },
{ "pyutest_tools:stick" }
}
})
minetest.register_craft({
output = "pyutest_blocks:ladder 16",
recipe = {
{"pyutest_tools:stick", "", "pyutest_tools:stick"},
{"pyutest_tools:stick", "pyutest_tools:stick", "pyutest_tools:stick"},
{"pyutest_tools:stick", "", "pyutest_tools:stick"}
{ "pyutest_tools:stick", "", "pyutest_tools:stick" },
{ "pyutest_tools:stick", "pyutest_tools:stick", "pyutest_tools:stick" },
{ "pyutest_tools:stick", "", "pyutest_tools:stick" }
}
})
@ -288,15 +288,15 @@ minetest.register_craft({
minetest.register_craft({
output = "pyutest_blocks:haybale_block",
recipe = {
{"pyutest_tools:wheat", "pyutest_tools:wheat"},
{"pyutest_tools:wheat", "pyutest_tools:wheat"}
{ "pyutest_tools:wheat", "pyutest_tools:wheat" },
{ "pyutest_tools:wheat", "pyutest_tools:wheat" }
}
})
minetest.register_craft({
output = "pyutest_tools:bread 3",
recipe = {
{"pyutest_tools:wheat", "pyutest_tools:wheat", "pyutest_tools:wheat"}
{ "pyutest_tools:wheat", "pyutest_tools:wheat", "pyutest_tools:wheat" }
}
})

View File

@ -19,7 +19,7 @@ for i, v in ipairs(delay_multipliers) do
not_in_creative_inventory = i ~= 1 and 1 or nil
}, "#bed3d4", {
drop = index_name(),
on_rightclick = function (pos, node, clicker)
on_rightclick = function(pos, node, clicker)
local ni = v
if i == #delay_multipliers then
@ -28,7 +28,7 @@ for i, v in ipairs(delay_multipliers) do
ni = i + 1
end
minetest.set_node(pos, {name = index_name(ni)})
minetest.set_node(pos, { name = index_name(ni) })
end
}, string.format("pyutest-wire-d%d.png", i), v)
end

View File

@ -2,7 +2,7 @@
PyuTest.make_electricity_device("pyutest_electricity:freezer_device", "Freezer Device", {
cracky = PyuTest.BLOCK_FAST
}, {"pyutest-freezer.png"}, "pyutest_blocks:ice_block", nil, function (pos, node, sender_pos)
}, { "pyutest-freezer.png" }, "pyutest_blocks:ice_block", nil, function(pos, node, sender_pos)
PyuTest.dorange(pos, 2, function(p)
local n = minetest.get_node(p)
@ -18,7 +18,7 @@ end)
PyuTest.make_electricity_device("pyutest_electricity:heater_device", "Heater Device", {
cracky = PyuTest.BLOCK_FAST
}, {"pyutest-heater.png"}, "pyutest_blocks:fire", nil, function (pos, node, sender_pos)
}, { "pyutest-heater.png" }, "pyutest_blocks:fire", nil, function(pos, node, sender_pos)
PyuTest.dorange(pos, 2, function(p)
local n = minetest.get_node(p)
@ -37,23 +37,23 @@ end)
PyuTest.make_electricity_device("pyutest_electricity:lamp_device", "Lamp Device", {
cracky = PyuTest.BLOCK_FAST,
}, {"pyutest-lamp.png"}, "pyutest_blocks:light", nil, function (pos, node, sender_pos)
minetest.set_node(pos, {name = "pyutest_electricity:lamp_device_on"})
}, { "pyutest-lamp.png" }, "pyutest_blocks:light", nil, function(pos, node, sender_pos)
minetest.set_node(pos, { name = "pyutest_electricity:lamp_device_on" })
end)
PyuTest.make_electricity_device("pyutest_electricity:lamp_device_on", "Lamp Device", {
cracky = PyuTest.BLOCK_FAST,
not_in_creative_inventory = 1
}, {"pyutest-lamp.png"}, nil, {
}, { "pyutest-lamp.png" }, nil, {
light_source = minetest.LIGHT_MAX,
drop = "pyutest_electricity:lamp_device"
}, function (pos, node, sender_pos)
minetest.set_node(pos, {name = "pyutest_electricity:lamp_device"})
}, function(pos, node, sender_pos)
minetest.set_node(pos, { name = "pyutest_electricity:lamp_device" })
end)
PyuTest.make_electricity_device("pyutest_electricity:time_device", "Time Device", {
cracky = PyuTest.BLOCK_FAST
}, {"pyutest-time-device.png"}, nil, nil, function (pos, node)
}, { "pyutest-time-device.png" }, nil, nil, function(pos, node)
local time = minetest.get_timeofday()
if math.round(time) ~= 1 then

View File

@ -56,10 +56,10 @@ PyuTest.make_wire = function(id, desc, groups, color, opts, texture, delay)
local n = minetest.get_node(v)
-- To prevent infinite loops
if v ~= sender_pos then
minetest.after(del, function()
PyuTest.electricity_activate(v, n, pos)
end)
if v ~= sender_pos then
minetest.after(del, function()
PyuTest.electricity_activate(v, n, pos)
end)
end
end
end
@ -79,7 +79,7 @@ PyuTest.make_electricity_device = function(id, desc, groups, tiles, craftitem, o
output = id,
recipe = {
{ "pyutest_blocks:stone_block", "pyutest_blocks:stone_block", "pyutest_blocks:stone_block" },
{ "pyutest_blocks:stone_block", craftitem, "pyutest_blocks:stone_block" },
{ "pyutest_blocks:stone_block", craftitem, "pyutest_blocks:stone_block" },
{ "pyutest_blocks:stone_block", "pyutest_blocks:stone_block", "pyutest_blocks:stone_block" }
},
})
@ -106,12 +106,12 @@ minetest.register_craft({
minetest.register_craft({
output = "pyutest_electricity:button",
recipe = {
{ "pyutest_blocks:stone_block", "pyutest_blocks:stone_block", "pyutest_blocks:stone_block" },
{ "pyutest_blocks:stone_block", "pyutest_ores:copper_ingot", "pyutest_blocks:stone_block" },
{ "pyutest_blocks:stone_block", "pyutest_blocks:stone_block", "pyutest_blocks:stone_block" }
{ "pyutest_blocks:stone_block", "pyutest_blocks:stone_block", "pyutest_blocks:stone_block" },
{ "pyutest_blocks:stone_block", "pyutest_ores:copper_ingot", "pyutest_blocks:stone_block" },
{ "pyutest_blocks:stone_block", "pyutest_blocks:stone_block", "pyutest_blocks:stone_block" }
},
})
dofile(modpath.."/devices.lua")
dofile(modpath.."/delayer.lua")
dofile(modpath.."/components.lua")
dofile(modpath .. "/devices.lua")
dofile(modpath .. "/delayer.lua")
dofile(modpath .. "/components.lua")

View File

@ -2,7 +2,7 @@ PyuTest.make_node("pyutest_farming:farmland", "Farmland", {
ground = 1,
acid_vulnerable = 1,
crumbly = PyuTest.BLOCK_FAST
}, {"pyutest-farmland.png", "pyutest-dirt.png"}, {
}, { "pyutest-farmland.png", "pyutest-dirt.png" }, {
drop = "pyutest_blocks:dirt_block",
drawtype = "nodebox",
node_box = PyuTest.NODE_BOXES.SLIGHTLY_SMALLER
@ -12,36 +12,36 @@ PyuTest.make_item("pyutest_farming:hoe", "Hoe", {
tool = 1
}, "pyutest-hoe.png", {
stack_max = 1,
on_place = function (itemstack, user, pointed_thing)
on_place = function(itemstack, user, pointed_thing)
if pointed_thing.type == "node" then
local pos = pointed_thing.under
local node = minetest.get_node(pos)
if minetest.get_item_group(node.name, "dirt") ~= 0 then
minetest.set_node(pos, {name = "pyutest_farming:farmland"})
minetest.set_node(pos, { name = "pyutest_farming:farmland" })
end
end
end
})
PyuTest.make_crop = function (name, desc, output, growtime, water_multiplier, textures, grow_into)
PyuTest.make_crop = function(name, desc, output, growtime, water_multiplier, textures, grow_into)
local t = textures or {}
PyuTest.make_node(name.."_crop", desc .. "Crop", {
PyuTest.make_node(name .. "_crop", desc .. "Crop", {
flammable = 1,
dig_immediate = 3,
attached_node = 3,
oddly_breakable_by_hand = PyuTest.BLOCK_FAST,
not_in_creative_inventory = 1
}, {t["crop"] or "pyutest-crop.png"}, {
}, { t["crop"] or "pyutest-crop.png" }, {
drawtype = "plantlike",
color = t["crop_color"],
drop = name.."_seeds",
drop = name .. "_seeds",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
floodable = true,
on_construct = function (pos)
on_construct = function(pos)
local time = growtime
if PyuTest.node_beside_group(pos - vector.new(0, 1, 0), "water") then
@ -51,19 +51,19 @@ PyuTest.make_crop = function (name, desc, output, growtime, water_multiplier, te
local timer = minetest.get_node_timer(pos)
timer:start(time)
end,
on_timer = function (pos)
minetest.set_node(pos, {name = grow_into or name.."_grown"})
on_timer = function(pos)
minetest.set_node(pos, { name = grow_into or name .. "_grown" })
end
})
if not grow_into then
PyuTest.make_node(name.."_grown", desc .. " Crop", {
PyuTest.make_node(name .. "_grown", desc .. " Crop", {
flammable = 1,
dig_immediate = 3,
attached_node = 3,
oddly_breakable_by_hand = PyuTest.BLOCK_FAST,
not_in_creative_inventory = 1
}, {t["grown"] or "pyutest-crop-grown.png"}, {
}, { t["grown"] or "pyutest-crop-grown.png" }, {
drawtype = "plantlike",
color = t["grown_color"],
paramtype = "light",
@ -74,22 +74,22 @@ PyuTest.make_crop = function (name, desc, output, growtime, water_multiplier, te
max_items = 1,
items = {
{
items = {ItemStack(name.."_seeds 3"), ItemStack(output)}
items = { ItemStack(name .. "_seeds 3"), ItemStack(output) }
}
}
},
})
end
PyuTest.make_item(name.."_seeds", desc.." Seeds", {seeds = 1}, t["seed"] or "pyutest-seeds.png", {
PyuTest.make_item(name .. "_seeds", desc .. " Seeds", { seeds = 1 }, t["seed"] or "pyutest-seeds.png", {
color = t["seed_color"],
on_place = function (itemstack, user, pointed_thing)
on_place = function(itemstack, user, pointed_thing)
if pointed_thing.type == "node" then
local pos = pointed_thing.under
local node = minetest.get_node(pos)
if node.name == "pyutest_farming:farmland" then
minetest.place_node(pointed_thing.under + vector.new(0, 1, 0), {name = name.."_crop"}, user)
minetest.place_node(pointed_thing.under + vector.new(0, 1, 0), { name = name .. "_crop" }, user)
itemstack:set_count(itemstack:get_count() - 1)
return itemstack
end

View File

@ -1,5 +1,5 @@
PyuTest.registered_flowers = {}
PyuTest.make_flower = function (name, desc, texture, dye, add_to_registry, drawtype, econf)
PyuTest.make_flower = function(name, desc, texture, dye, add_to_registry, drawtype, econf)
PyuTest.make_node(name, desc, {
flammable = 1,
flower = 1,
@ -7,7 +7,7 @@ PyuTest.make_flower = function (name, desc, texture, dye, add_to_registry, drawt
dig_immediate = 1,
oddly_breakable_by_hand = PyuTest.BLOCK_FAST,
snappy = PyuTest.BLOCK_FAST
}, {texture}, PyuTest.util.tableconcat({
}, { texture }, PyuTest.util.tableconcat({
drawtype = drawtype or "plantlike",
walkable = false,
waving = 1,
@ -21,7 +21,7 @@ PyuTest.make_flower = function (name, desc, texture, dye, add_to_registry, drawt
if dye ~= nil then
minetest.register_craft({
output = dye .. " 2",
recipe = {name},
recipe = { name },
type = "shapeless"
})
end
@ -39,13 +39,15 @@ PyuTest.make_flower("pyutest_flowers:lavender", "Lavender", "pyutest-flower4.png
PyuTest.make_flower("pyutest_flowers:deadbush", "Deadbush", "pyutest-deadbush.png", "pyutest_flowers:brown_dye")
PyuTest.make_flower("pyutest_flowers:maybell", "Maybell", "pyutest-maybell.png", "pyutest_flowers:white_dye", true)
PyuTest.make_flower("pyutest_flowers:orange_tulip", "Orange Tulip", "pyutest-orange-tulip.png", "pyutest_flowers:orange_dye", true)
PyuTest.make_flower("pyutest_flowers:black_rose", "Black Rose", "pyutest-black-rose.png", "pyutest_flowers:black_dye", false)
PyuTest.make_flower("pyutest_flowers:orange_tulip", "Orange Tulip", "pyutest-orange-tulip.png",
"pyutest_flowers:orange_dye", true)
PyuTest.make_flower("pyutest_flowers:black_rose", "Black Rose", "pyutest-black-rose.png", "pyutest_flowers:black_dye",
false)
PyuTest.make_node("pyutest_flowers:vines", "Vines", {
snappy = PyuTest.BLOCK_FAST,
flammable = 1,
}, {"pyutest-vines.png"}, {
}, { "pyutest-vines.png" }, {
drawtype = "signlike",
paramtype = "light",
walkable = false,
@ -64,7 +66,7 @@ PyuTest.make_node("pyutest_flowers:vines", "Vines", {
PyuTest.make_node("pyutest_flowers:lilypad", "Lily Pad", {
oddly_breakable_by_hand = PyuTest.BLOCK_FAST,
dig_immediate = 1,
}, {"pyutest-lilypad.png"}, {
}, { "pyutest-lilypad.png" }, {
drawtype = "signlike",
paramtype = "light",
paramtype2 = "facedir",
@ -72,20 +74,21 @@ PyuTest.make_node("pyutest_flowers:lilypad", "Lily Pad", {
sunlight_propagates = true,
selection_box = {
type = "fixed",
fixed = {-0.5, -31/64, -0.5, 0.5, -15/32, 0.5}
fixed = { -0.5, -31 / 64, -0.5, 0.5, -15 / 32, 0.5 }
},
collision_box = {
type = "fixed",
fixed = {-0.5, -31/64, -0.5, 0.5, -15/32, 0.5}
fixed = { -0.5, -31 / 64, -0.5, 0.5, -15 / 32, 0.5 }
},
floodable = true,
})
PyuTest.make_flower("pyutest_flowers:sugarcane", "Sugarcane", "pyutest-sugarcane.png", "pyutest_flowers:green_dye", false, nil)
PyuTest.make_flower("pyutest_flowers:sugarcane", "Sugarcane", "pyutest-sugarcane.png", "pyutest_flowers:green_dye", false,
nil)
PyuTest.make_node("pyutest_flowers:sugarcane", "Sugarcane", {
oddly_breakable_by_hand = PyuTest.BLOCK_FAST,
dig_immediate = 1,
}, {"pyutest-sugarcane.png"}, {
}, { "pyutest-sugarcane.png" }, {
drawtype = "plantlike",
paramtype = "light",
sunlight_propagates = true,
@ -93,7 +96,8 @@ PyuTest.make_node("pyutest_flowers:sugarcane", "Sugarcane", {
floodable = true,
})
PyuTest.make_flower("pyutest_flowers:kelp", "Kelp", "pyutest-kelp.png", "pyutest_flowers:green_dye", false, "plantlike_rooted", {
PyuTest.make_flower("pyutest_flowers:kelp", "Kelp", "pyutest-kelp.png", "pyutest_flowers:green_dye", false,
"plantlike_rooted", {
paramtype2 = "leveled",
place_param2 = 16,
wield_image = "pyutest-kelp.png",
@ -111,7 +115,8 @@ PyuTest.make_flower("pyutest_flowers:kelp", "Kelp", "pyutest-kelp.png", "pyutest
})
PyuTest.make_flower("pyutest_flowers:small_mushroom", "Small Mushroom", "pyutest-mushroom-small.png", "pyutest_flowers:red_dye", false, nil, {
PyuTest.make_flower("pyutest_flowers:small_mushroom", "Small Mushroom", "pyutest-mushroom-small.png",
"pyutest_flowers:red_dye", false, nil, {
groups = {
oddly_breakable_by_hand = PyuTest.BLOCK_FAST,
flammable = 1,

View File

@ -59,20 +59,20 @@ PyuTest.make_node("pyutest_furnace:furnace", "Furnace", {
local fuel = inv:get_stack("fuel", 1)
if minetest.get_item_group(fuel:get_name(), "fuel") == 0 then
return
return
end
local output, decremented_input = minetest.get_craft_result({
method = "cooking",
width = 1,
items = {
src
}
method = "cooking",
width = 1,
items = {
src
}
})
if output.item:is_empty() then
return
return
end
inv:add_item("dst", output.item)
@ -88,7 +88,7 @@ PyuTest.make_node("pyutest_furnace:furnace", "Furnace", {
if fields.smelt3 then
for i = 1, 3 do
smelt()
smelt()
end
end
end,

View File

@ -117,5 +117,6 @@ PyuTest.make_furniture = function(name, desc, craft, tiles, cgroups, extra_conf)
end
for _, v in pairs(PyuTest.building_blocks) do
PyuTest.make_furniture("pyutest_furniture:"..v.name, v.desc, v.ns..":"..v.name .. "_block", v.tiles, v.groups, v.econf)
PyuTest.make_furniture("pyutest_furniture:" .. v.name, v.desc, v.ns .. ":" .. v.name .. "_block", v.tiles, v.groups,
v.econf)
end

View File

@ -4,13 +4,13 @@ PyuTest.make_leaves = function(id, desc, color, overlay, special_drops, drops)
acid_vulnerable = 1,
flammable = 1,
snappy = PyuTest.BLOCK_FAST
}, {{name = "pyutest-leaves.png", color = color}}, {
}, { { name = "pyutest-leaves.png", color = color } }, {
drawtype = "allfaces_optional",
waving = 2,
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
overlay_tiles = {overlay},
overlay_tiles = { overlay },
})
if special_drops == nil or special_drops == true then
minetest.override_item(leaves_id, {
@ -21,27 +21,27 @@ PyuTest.make_leaves = function(id, desc, color, overlay, special_drops, drops)
tool_groups = {
"shears"
},
items = {leaves_id}
items = { leaves_id }
},
{
rarity = 2.2,
items = {"pyutest_tools:apple"}
items = { "pyutest_tools:apple" }
},
{
rarity = 2.2,
items = {"pyutest_tools:banana"}
items = { "pyutest_tools:banana" }
},
{
rarity = 2.2,
items = {"pyutest_tools:stick 2"}
items = { "pyutest_tools:stick 2" }
},
{
rarity = 1.6,
items = {"pyutest_tools:stick 1"}
items = { "pyutest_tools:stick 1" }
}
}
}

View File

@ -1,17 +1,17 @@
PyuTest.registered_lootboxes = {}
PyuTest.spawning_lootboxes = {}
PyuTest.make_lootbox = function (name, dname, items, spawn)
local id = name.."_lootbox"
PyuTest.make_lootbox = function(name, dname, items, spawn)
local id = name .. "_lootbox"
minetest.register_node(id, {
description = Translate(dname .. " Lootbox"),
groups = {
choppy = PyuTest.BLOCK_NORMAL,
not_in_creative_inventory = 1
},
tiles = {"pyutest-crate.png"},
tiles = { "pyutest-crate.png" },
sounds = PyuTest.make_node_sounds(),
drop = "",
after_destruct = function (pos)
after_destruct = function(pos)
for _, v in pairs(items) do
minetest.add_item(pos, v)
end
@ -29,7 +29,7 @@ PyuTest.make_lootbox = function (name, dname, items, spawn)
}
if spawn == true then
PyuTest.spawning_lootboxes[#PyuTest.spawning_lootboxes+1] = id
PyuTest.spawning_lootboxes[#PyuTest.spawning_lootboxes + 1] = id
end
end

View File

@ -1,17 +1,17 @@
PyuTest.make_item("pyutest_magic:magic_shards", "Magic Shards", {}, "pyutest-magic-shards.png")
PyuTest.registered_spellbooks = {}
PyuTest.make_spellbook = function (nsname, desc, color, craftitem, action)
PyuTest.make_spellbook = function(nsname, desc, color, craftitem, action)
if action == nil then
action = function(_, _, _)end
action = function(_, _, _) end
end
PyuTest.make_item(nsname, desc, {}, "pyutest-spellbook.png", {
stack_max = 1,
color = color,
on_use = function (itemstack, user, pointed_thing)
on_use = function(itemstack, user, pointed_thing)
local pos = user:get_pos()
minetest.sound_play({name = "spellbook_action", gain = 0.75}, {pos = pos})
minetest.sound_play({ name = "spellbook_action", gain = 0.75 }, { pos = pos })
action(itemstack, user, pointed_thing)
end
})
@ -19,9 +19,9 @@ PyuTest.make_spellbook = function (nsname, desc, color, craftitem, action)
minetest.register_craft({
output = nsname,
recipe = {
{"", "pyutest_magic:magic_shards", ""},
{"pyutest_magic:magic_shards", craftitem, "pyutest_magic:magic_shards"},
{"", "pyutest_magic:magic_shards", ""}
{ "", "pyutest_magic:magic_shards", "" },
{ "pyutest_magic:magic_shards", craftitem, "pyutest_magic:magic_shards" },
{ "", "pyutest_magic:magic_shards", "" }
}
})
@ -32,33 +32,34 @@ PyuTest.make_spellbook = function (nsname, desc, color, craftitem, action)
}
end
PyuTest.make_spellbook("pyutest_magic:explosions_spellbook", "Spellbook of Explosions", "gray", "pyutest_tools:bomb", function (itemstack, user)
PyuTest.create_explosion(user:get_pos(), 2, false, 7, {user})
PyuTest.make_spellbook("pyutest_magic:explosions_spellbook", "Spellbook of Explosions", "gray", "pyutest_tools:bomb",
function(itemstack, user)
PyuTest.create_explosion(user:get_pos(), 2, false, 7, { user })
end)
end)
PyuTest.make_spellbook("pyutest_magic:fire_spellbook", "Spellbook of Fire", "crimson", "pyutest_blocks:magma",
function(itemstack, user)
local range = 2
PyuTest.make_spellbook("pyutest_magic:fire_spellbook", "Spellbook of Fire", "crimson", "pyutest_blocks:magma", function (itemstack, user)
local range = 2
local function replace(pos)
local node = minetest.get_node_or_nil(pos)
if node == nil then return end
if node.name ~= "air" then return end
local pos2 = vector.new(pos.x, pos.y - 1, pos.z)
node = minetest.get_node_or_nil(pos)
if node == nil then return end
if node.name ~= "air" then return end
local function replace(pos)
local node = minetest.get_node_or_nil(pos)
if node == nil then return end
if node.name ~= "air" then return end
local pos2 = vector.new(pos.x, pos.y - 1, pos.z)
node = minetest.get_node_or_nil(pos)
if node == nil then return end
if node.name ~= "air" then return end
minetest.set_node(pos, {name = "pyutest_blocks:fire"})
end
for dx = -range, range do
for dz = -range, range do
local pos = user:get_pos()
replace({x = pos.x + dx, y = pos.y, z = pos.z + dz})
minetest.set_node(pos, { name = "pyutest_blocks:fire" })
end
end
end)
for dx = -range, range do
for dz = -range, range do
local pos = user:get_pos()
replace({ x = pos.x + dx, y = pos.y, z = pos.z + dz })
end
end
end)
PyuTest.make_item("pyutest_magic:enchanted_shard", "Enchanted Shard", {}, "pyutest-shard.png", {
@ -68,9 +69,9 @@ PyuTest.make_item("pyutest_magic:enchanted_shard", "Enchanted Shard", {}, "pyute
minetest.register_craft({
output = "pyutest_magic:enchanted_shard 2",
recipe = {
{"pyutest_magic:magic_shards", "pyutest_ores:diamond_shard", "pyutest_magic:magic_shards"},
{"pyutest_ores:diamond_shard", "pyutest_magic:magic_shards", "pyutest_ores:diamond_shard"},
{"pyutest_magic:magic_shards", "pyutest_ores:diamond_shard", "pyutest_magic:magic_shards"}
{ "pyutest_magic:magic_shards", "pyutest_ores:diamond_shard", "pyutest_magic:magic_shards" },
{ "pyutest_ores:diamond_shard", "pyutest_magic:magic_shards", "pyutest_ores:diamond_shard" },
{ "pyutest_magic:magic_shards", "pyutest_ores:diamond_shard", "pyutest_magic:magic_shards" }
}
})
@ -94,9 +95,9 @@ PyuTest.make_tool("pyutest_magic:enchanted_pickaxe", "Enchanted Pickaxe", {}, "p
minetest.register_craft({
output = "pyutest_magic:enchanted_pickaxe",
recipe = {
{"pyutest_magic:enchanted_shard", "pyutest_magic:enchanted_shard", "pyutest_magic:enchanted_shard"},
{"", "pyutest_tools:stick", ""},
{"", "pyutest_tools:stick", ""}
{ "pyutest_magic:enchanted_shard", "pyutest_magic:enchanted_shard", "pyutest_magic:enchanted_shard" },
{ "", "pyutest_tools:stick", "" },
{ "", "pyutest_tools:stick", "" }
}
})
@ -105,7 +106,7 @@ PyuTest.make_tool("pyutest_magic:enchanted_axe", "Enchanted Axe", {}, "pyutest-e
tool_capabilities = PyuTest.tool_caps({
uses = 2768,
attack_uses = 2768,
damage_groups = {fleshy = 10},
damage_groups = { fleshy = 10 },
groupcaps = {
choppy = {
times = {
@ -121,9 +122,9 @@ PyuTest.make_tool("pyutest_magic:enchanted_axe", "Enchanted Axe", {}, "pyutest-e
minetest.register_craft({
output = "pyutest_magic:enchanted_axe",
recipe = {
{"pyutest_magic:enchanted_shard", "pyutest_magic:enchanted_shard", ""},
{"pyutest_magic:enchanted_shard", "pyutest_tools:stick", ""},
{"", "pyutest_tools:stick", ""}
{ "pyutest_magic:enchanted_shard", "pyutest_magic:enchanted_shard", "" },
{ "pyutest_magic:enchanted_shard", "pyutest_tools:stick", "" },
{ "", "pyutest_tools:stick", "" }
}
})
@ -133,22 +134,22 @@ PyuTest.make_sword("pyutest_magic:enchanted_sword", "Enchanted Sword", "pyutest-
minetest.register_craft({
output = "pyutest_magic:enchanted_sword",
recipe = {
{"pyutest_magic:enchanted_shard"},
{"pyutest_magic:enchanted_shard"},
{"pyutest_tools:stick"}
{ "pyutest_magic:enchanted_shard" },
{ "pyutest_magic:enchanted_shard" },
{ "pyutest_tools:stick" }
}
})
PyuTest.make_item("pyutest_magic:windball", "Windball", {}, "pyutest-windball.png", {
stack_max = 16,
on_use = function (_, user)
on_use = function(_, user)
if user == nil then
return
end
local pos = user:get_pos()
minetest.sound_play({name = "spellbook_action", gain = 0.75}, {pos = pos})
minetest.sound_play({ name = "spellbook_action", gain = 0.75 }, { pos = pos })
local vel = user:get_velocity()

View File

@ -13,11 +13,11 @@ minetest.override_item("pyutest_blocks:gravel_block", {
items = {
{
rarity = 3.1,
items = {"pyutest_tools:flint"}
items = { "pyutest_tools:flint" }
},
{
items = {"pyutest_blocks:gravel_block"}
items = { "pyutest_blocks:gravel_block" }
}
}
}

View File

@ -1,4 +1,4 @@
PyuTest.make_item = function (nsname, desc, groups, wield_image, extra_conf)
PyuTest.make_item = function(nsname, desc, groups, wield_image, extra_conf)
local conf = {
description = Translate(desc),
wield_image = wield_image,
@ -15,7 +15,7 @@ PyuTest.make_item = function (nsname, desc, groups, wield_image, extra_conf)
minetest.register_craftitem(nsname, conf)
end
PyuTest.make_tool = function (nsname, desc, groups, wield_image, extra_conf)
PyuTest.make_tool = function(nsname, desc, groups, wield_image, extra_conf)
local conf = {
description = Translate(desc),
wield_image = wield_image,
@ -34,7 +34,7 @@ PyuTest.make_tool = function (nsname, desc, groups, wield_image, extra_conf)
minetest.register_tool(nsname, conf)
end
PyuTest.make_sword = function (nsname, desc, texture, damage, durability, atkspeed)
PyuTest.make_sword = function(nsname, desc, texture, damage, durability, atkspeed)
PyuTest.make_tool(nsname, desc, {
weapon = 1,
sword = 1
@ -43,19 +43,19 @@ PyuTest.make_sword = function (nsname, desc, texture, damage, durability, atkspe
tool_capabilities = PyuTest.tool_caps({
uses = durability / 2,
attack_uses = durability,
damage_groups = {fleshy = damage or 3},
damage_groups = { fleshy = damage or 3 },
full_punch_interval = atkspeed or 1
})
})
end
PyuTest.make_food = function (nsname, desc, wield_image, health_fill, cook_into, extra_code)
PyuTest.make_food = function(nsname, desc, wield_image, health_fill, cook_into, extra_code)
PyuTest.make_item(nsname, desc, {
food = 1
}, wield_image, {
on_use = function (itemstack, user, pt)
on_use = function(itemstack, user, pt)
if user == nil then return end
minetest.sound_play({name = "eat", gain = 1}, {pos = user:get_pos(), start_time = 1.2})
minetest.sound_play({ name = "eat", gain = 1 }, { pos = user:get_pos(), start_time = 1.2 })
minetest.do_item_eat(health_fill, "", itemstack, user, pt)
if extra_code then extra_code() end
end,

View File

@ -6,6 +6,7 @@ PyuTest.make_food("pyutest_tools:water_bottle", "Water Bottle", "pyutest-water-b
PyuTest.make_food("pyutest_tools:potato", "Potato", "pyutest-potato.png", 3, "pyutest_tools:cooked_potato")
PyuTest.make_food("pyutest_tools:cooked_potato", "Cooked Potato", "pyutest-cooked-potato.png", 7)
PyuTest.make_food("pyutest_tools:sliced_potato", "Sliced Potato", "pyutest-sliced-potato.png", 0.5, "pyutest_tools:french_fries")
PyuTest.make_food("pyutest_tools:sliced_potato", "Sliced Potato", "pyutest-sliced-potato.png", 0.5,
"pyutest_tools:french_fries")
PyuTest.make_food("pyutest_tools:french_fries", "French Fries", "pyutest-french-fries.png", 6.5)

View File

@ -1,7 +1,7 @@
local modpath = minetest.get_modpath("pyutest_tools")
dofile(modpath.."/api.lua")
dofile(modpath.."/tools.lua")
dofile(modpath.."/items.lua")
dofile(modpath.."/combat.lua")
dofile(modpath.."/food.lua")
dofile(modpath .. "/api.lua")
dofile(modpath .. "/tools.lua")
dofile(modpath .. "/items.lua")
dofile(modpath .. "/combat.lua")
dofile(modpath .. "/food.lua")

View File

@ -1,33 +1,33 @@
PyuTest.make_item("pyutest_tools:stick", "Stick", {}, "pyutest-stick.png")
PyuTest.make_item("pyutest_tools:bone", "Bone", {}, "pyutest-bone.png", {})
PyuTest.make_item("pyutest_tools:gunpowder", "Gunpowder", {}, "pyutest-powder.png", {
color = "dimgray",
color = "dimgray",
})
PyuTest.make_item("pyutest_tools:ash", "Ash", {}, "pyutest-powder.png", {
color = "gray",
color = "gray",
})
PyuTest.make_item("pyutest_tools:sugar", "Sugar", {}, "pyutest-powder.png")
PyuTest.make_item("pyutest_tools:coin", "Coin", {}, "pyutest-coin.png", {
on_secondary_use = function (_, user)
local pos = user:get_pos()
minetest.sound_play({name = "coin", gain = 1}, {
pos = pos
})
return nil
end
on_secondary_use = function(_, user)
local pos = user:get_pos()
minetest.sound_play({ name = "coin", gain = 1 }, {
pos = pos
})
return nil
end
})
PyuTest.make_item("pyutest_tools:wheat", "Wheat", {}, "pyutest-wheat.png")
PyuTest.make_item("pyutest_tools:string", "String", {}, "pyutest-string.png")
PyuTest.make_item("pyutest_tools:egg", "Egg", {}, "pyutest-egg.png", {
color = "peachpuff"
color = "peachpuff"
})
PyuTest.make_item("pyutest_tools:clay", "Clay Ball", {}, "pyutest-clay.png")
PyuTest.make_item("pyutest_tools:glass_bottle", "Glass Bottle", {}, "pyutest-glass-bottle.png", {
stack_max = 16
stack_max = 16
})
PyuTest.make_item("pyutest_tools:brick", "Brick", {}, "pyutest-brick.png")
PyuTest.make_item("pyutest_tools:snowball", "Snowball", {}, "pyutest-snowball.png")

View File

@ -68,7 +68,7 @@ PyuTest.make_tool("pyutest_tools:wooden_axe", "Wooden Axe", {}, "pyutest-wooden-
tool_capabilities = PyuTest.tool_caps({
uses = 69,
attack_uses = 69,
damage_groups = {fleshy = 7},
damage_groups = { fleshy = 7 },
groupcaps = {
choppy = {
times = {
@ -86,7 +86,7 @@ PyuTest.make_tool("pyutest_tools:stone_axe", "Stone Axe", {}, "pyutest-stone-axe
tool_capabilities = PyuTest.tool_caps({
uses = 274,
attack_uses = 274,
damage_groups = {fleshy = 9},
damage_groups = { fleshy = 9 },
groupcaps = {
choppy = {
times = {
@ -104,7 +104,7 @@ PyuTest.make_tool("pyutest_tools:iron_axe", "Iron Axe", {}, "pyutest-iron-axe.pn
tool_capabilities = PyuTest.tool_caps({
uses = 689,
attack_uses = 689,
damage_groups = {fleshy = 9},
damage_groups = { fleshy = 9 },
groupcaps = {
choppy = {
times = {
@ -122,7 +122,7 @@ PyuTest.make_tool("pyutest_tools:diamond_axe", "Diamond Axe", {}, "pyutest-diamo
tool_capabilities = PyuTest.tool_caps({
uses = 1345,
attack_uses = 1345,
damage_groups = {fleshy = 9},
damage_groups = { fleshy = 9 },
groupcaps = {
choppy = {
times = {
@ -165,12 +165,12 @@ PyuTest.make_tool("pyutest_tools:shears", "Shears", {
PyuTest.make_item("pyutest_tools:bomb", "Bomb", {}, "pyutest-bomb.png", {
stack_max = 16,
on_use = function (_, user)
on_use = function(_, user)
if user == nil then
return
end
local pos = user:get_pos()
PyuTest.create_explosion(pos, 1, false, 6, {user})
PyuTest.create_explosion(pos, 1, false, 6, { user })
local stack = user:get_wielded_item()
stack:set_count(stack:get_count() - 1)
@ -180,9 +180,9 @@ PyuTest.make_item("pyutest_tools:bomb", "Bomb", {}, "pyutest-bomb.png", {
PyuTest.make_item("pyutest_tools:flint_and_steel", "Flint and Steel", {}, "pyutest-flint-and-steel.png", {
stack_max = 1,
on_place = function (itemstack, user, pointed_thing)
on_place = function(itemstack, user, pointed_thing)
if pointed_thing.type == "node" then
minetest.set_node(pointed_thing.above, {name = "pyutest_blocks:fire"})
minetest.set_node(pointed_thing.above, { name = "pyutest_blocks:fire" })
minetest.sound_play({
name = "alt_place",

View File

@ -1,9 +1,9 @@
PyuTest.make_upgrade_rune = function (name, desc, stat, increase, max, color, craftitem)
PyuTest.make_upgrade_rune = function(name, desc, stat, increase, max, color, craftitem)
PyuTest.make_item(name, desc, {
upgrade_rune = 1,
}, "pyutest-rune.png", {
color = color,
on_use = function (itemstack, user, pointed_thing)
on_use = function(itemstack, user, pointed_thing)
if not user then return end
if not user:is_player() then return end
@ -20,7 +20,7 @@ PyuTest.make_upgrade_rune = function (name, desc, stat, increase, max, color, cr
PyuTest.set_player_stat(user, stat, value + increase)
minetest.sound_play({name = "spellbook_action", gain = 0.75}, {pos = user:get_pos()})
minetest.sound_play({ name = "spellbook_action", gain = 0.75 }, { pos = user:get_pos() })
itemstack:take_item()
return itemstack
end
@ -30,13 +30,15 @@ PyuTest.make_upgrade_rune = function (name, desc, stat, increase, max, color, cr
minetest.register_craft({
output = name,
recipe = {
{"", "pyutest_ores:emerald_shard", ""},
{"pyutest_ores:emerald_shard", craftitem, "pyutest_ores:emerald_shard"},
{"", "pyutest_ores:emerald_shard", ""},
{ "", "pyutest_ores:emerald_shard", "" },
{ "pyutest_ores:emerald_shard", craftitem, "pyutest_ores:emerald_shard" },
{ "", "pyutest_ores:emerald_shard", "" },
}
})
end
end
PyuTest.make_upgrade_rune("pyutest_upgrades:defense", "Defense Upgrade Rune", "defense", 0.5, 5, "green", "pyutest_ores:diamond_shard")
PyuTest.make_upgrade_rune("pyutest_upgrades:attack", "Attack Upgrade Rune", "attack", 0.5, 3, "red", "pyutest_ores:gold_ingot")
PyuTest.make_upgrade_rune("pyutest_upgrades:defense", "Defense Upgrade Rune", "defense", 0.5, 5, "green",
"pyutest_ores:diamond_shard")
PyuTest.make_upgrade_rune("pyutest_upgrades:attack", "Attack Upgrade Rune", "attack", 0.5, 3, "red",
"pyutest_ores:gold_ingot")

View File

@ -17,7 +17,7 @@ minetest.register_chatcommand("explode", {
return false, "Please use a number for the range."
end
PyuTest.create_explosion(player:get_pos(), range, false, range, {player})
PyuTest.create_explosion(player:get_pos(), range, false, range, { player })
end
})

View File

@ -1,6 +1,6 @@
minetest.register_chatcommand("biome", {
description = "Return the current biome name",
func = function (name)
func = function(name)
local player = minetest.get_player_by_name(name)
if player == nil then return end
@ -13,7 +13,7 @@ minetest.register_chatcommand("biome", {
minetest.register_chatcommand("day", {
description = "Return the current day",
func = function (name)
func = function(name)
local day = minetest.get_day_count()
return true, string.format("Current day is: %d", day)
end

View File

@ -1,4 +1,4 @@
local modpath = minetest.get_modpath("pyutest_cmds")
dofile(modpath.."/worldedit.lua")
dofile(modpath.."/gameplay.lua")
dofile(modpath.."/fun.lua")
dofile(modpath .. "/worldedit.lua")
dofile(modpath .. "/gameplay.lua")
dofile(modpath .. "/fun.lua")

View File

@ -12,7 +12,7 @@ minetest.register_chatcommand("replacenear", {
privs = {
builder = true
},
func = function (name, param)
func = function(name, param)
local parts = param:split(" ")
if #parts == 3 then
local player = minetest.get_player_by_name(name)
@ -28,7 +28,7 @@ minetest.register_chatcommand("replacenear", {
local anyblock_match = (v == "anyblock" or v == "anynode" and name ~= "air" and name ~= "ignore")
if name == v or v == "any" or anyblock_match then
minetest.set_node(p, {name = to})
minetest.set_node(p, { name = to })
replaced = replaced + 1
end
end
@ -53,11 +53,11 @@ minetest.register_chatcommand("place", {
func = function(name, param)
local player = minetest.get_player_by_name(name)
minetest.place_schematic(player:get_pos(),
PyuTest.get_schematic_path(param),
"random",
nil,
false,
"place_center_x, place_center_z"
PyuTest.get_schematic_path(param),
"random",
nil,
false,
"place_center_x, place_center_z"
)
end
})
@ -68,11 +68,11 @@ minetest.register_chatcommand("drain", {
privs = {
builder = true
},
func = function (name, param)
func = function(name, param)
local player = minetest.get_player_by_name(name)
local range = tonumber(param) or 1
PyuTest.dorange(player:get_pos(), range, function (p)
PyuTest.dorange(player:get_pos(), range, function(p)
local node = minetest.get_node(p)
if minetest.get_item_group(node.name, "liquid") ~= 0 then

View File

@ -1,7 +1,7 @@
local storage = minetest.get_mod_storage()
local homes = minetest.deserialize(storage:get("player_homes")) or {}
minetest.register_on_joinplayer(function (player)
minetest.register_on_joinplayer(function(player)
local name = player:get_player_name()
if homes[name] == nil then
homes[name] = {}
@ -11,7 +11,7 @@ end)
minetest.register_chatcommand("sethome", {
params = "<name>",
description = "Sets the position of home <NAME>",
func = function (name, param)
func = function(name, param)
local player = minetest.get_player_by_name(name)
local pos = player:get_pos()
homes[name][param] = pos
@ -22,7 +22,7 @@ minetest.register_chatcommand("sethome", {
minetest.register_chatcommand("tphome", {
params = "<name>",
description = "Teleports to home <NAME>",
func = function (name, param)
func = function(name, param)
local player = minetest.get_player_by_name(name)
local home = homes[name][param]
@ -37,7 +37,7 @@ minetest.register_chatcommand("tphome", {
minetest.register_chatcommand("listhomes", {
description = "Lists all your homes",
func = function (name)
func = function(name)
for k, v in pairs(homes[name]) do
minetest.chat_send_player(name, string.format("%s - (%d, %d, %d)", k, v.x, v.y, v.z))
end
@ -47,7 +47,7 @@ minetest.register_chatcommand("listhomes", {
minetest.register_chatcommand("deletehome", {
description = "Delete a home",
func = function (name, param)
func = function(name, param)
homes[name][param] = nil
return true, string.format("Home `%s` has been deleted", param)
end

View File

@ -1,9 +1,9 @@
local modpath = minetest.get_modpath(minetest.get_current_modname())
dofile(modpath.."/stats.lua")
dofile(modpath .. "/stats.lua")
-- player setup
minetest.register_on_joinplayer(function (player)
minetest.register_on_joinplayer(function(player)
if player == nil then return end
local name = player:get_player_name()
@ -42,7 +42,7 @@ end
minetest.register_globalstep(function(dtime)
local players = minetest.get_connected_players()
for p=1, #players do
for p = 1, #players do
local ctrl = players[p]:get_player_control()
if ctrl.aux1 then
set_player_speed(players[p], 1.60)
@ -62,7 +62,7 @@ minetest.register_item(":", {
}
})
if minetest.is_creative_enabled("") then
if minetest.is_creative_enabled("") then
minetest.override_item("", {
range = 9,
tool_capabilities = PyuTest.tool_caps({
@ -79,7 +79,7 @@ if minetest.is_creative_enabled("") then
},
attack_uses = 0,
damage_groups = {fleshy = 10000}
damage_groups = { fleshy = 10000 }
})
})
else
@ -88,7 +88,7 @@ else
tool_capabilities = PyuTest.tool_caps({
uses = 0,
attck_uses = 0,
damage_groups = {fleshy = 2},
damage_groups = { fleshy = 2 },
groupcaps = {
oddly_breakable_by_hand = {
@ -173,7 +173,7 @@ minetest.register_on_dieplayer(function(player, reason)
end)
-- player lighting, and sky effects for different biomes
minetest.register_globalstep(function ()
minetest.register_globalstep(function()
local players = minetest.get_connected_players()
for _, player in pairs(players) do

View File

@ -3,12 +3,12 @@ PyuTest.DEFAULT_PLAYER_STATS = {
defense = 1,
}
PyuTest.get_player_stats = function (player)
PyuTest.get_player_stats = function(player)
local meta = player:get_meta()
return minetest.deserialize(meta:get("stats") or minetest.serialize(PyuTest.DEFAULT_PLAYER_STATS))
end
PyuTest.save_player_stats = function (player, stats)
PyuTest.save_player_stats = function(player, stats)
local meta = player:get_meta()
meta:set_string("stats", minetest.serialize(stats))
end
@ -24,7 +24,7 @@ PyuTest.get_player_stat = function(player, stat)
return stats[stat]
end
minetest.register_on_player_hpchange(function (player, hp_change, reason)
minetest.register_on_player_hpchange(function(player, hp_change, reason)
local max_hp = player:get_properties().hp_max
local current_hp = player:get_hp()
local new_hp_change = hp_change
@ -65,7 +65,7 @@ minetest.register_on_player_hpchange(function (player, hp_change, reason)
return new_hp_change
end, true)
minetest.register_on_joinplayer(function (player)
minetest.register_on_joinplayer(function(player)
if player == nil then return end
-- This saves the default stats if none exist.
@ -78,7 +78,7 @@ minetest.register_chatcommand("setstat", {
give = 1
},
description = "Set the value of PLAYER's player stat STAT to VALUE",
func = function (name, param)
func = function(name, param)
local split = param:split(" ")
local statname = split[1]
local value = tonumber(split[2])
@ -97,7 +97,7 @@ minetest.register_chatcommand("setstat", {
minetest.register_chatcommand("getstat", {
params = "<stat> [<player>]",
description = "Gets the value of PLAYER's player stat: STAT",
func = function (name, param)
func = function(name, param)
local split = param:split(" ")
local statname = split[1]
local player = split[2] or name

View File

@ -1,19 +1,19 @@
local storage = minetest.get_mod_storage()
local spawnpoints = minetest.deserialize(storage:get("player_spawns")) or {}
minetest.register_on_joinplayer(function (player)
local name = player:get_player_name()
if spawnpoints[name] == nil then
spawnpoints[name] = player:get_pos()
end
minetest.register_on_joinplayer(function(player)
local name = player:get_player_name()
if spawnpoints[name] == nil then
spawnpoints[name] = player:get_pos()
end
end)
minetest.register_on_respawnplayer(function(player)
local name = player:get_player_name()
if spawnpoints[name] ~= nil then
player:set_pos(spawnpoints[name])
return true
end
local name = player:get_player_name()
if spawnpoints[name] ~= nil then
player:set_pos(spawnpoints[name])
return true
end
end)
local function save_data()
@ -24,22 +24,22 @@ minetest.register_on_shutdown(save_data)
PyuTest.register_interval(save_data, 10)
PyuTest.make_node("pyutest_spawnpoints:spawnpoint", "Spawnpoint", {
choppy = PyuTest.BLOCK_FAST
}, {"pyutest-spawnpoint.png"}, {
on_rightclick = function (pos, node, clicker)
if clicker == nil then return end
if not clicker:is_player() then return end
choppy = PyuTest.BLOCK_FAST
}, { "pyutest-spawnpoint.png" }, {
on_rightclick = function(pos, node, clicker)
if clicker == nil then return end
if not clicker:is_player() then return end
local name = clicker:get_player_name()
spawnpoints[name] = pos
end
local name = clicker:get_player_name()
spawnpoints[name] = pos
end
})
minetest.register_craft({
output = "pyutest_spawnpoints:spawnpoint",
recipe = {
{"pyutest_blocks:stone_block", "pyutest_blocks:stone_block", "pyutest_blocks:stone_block"},
{"pyutest_blocks:stone_block", "pyutest_blocks:stone_block", "pyutest_blocks:stone_block"},
{"pyutest_blocks:stone_block", "pyutest_blocks:stone_block", "pyutest_blocks:stone_block"},
}
output = "pyutest_spawnpoints:spawnpoint",
recipe = {
{ "pyutest_blocks:stone_block", "pyutest_blocks:stone_block", "pyutest_blocks:stone_block" },
{ "pyutest_blocks:stone_block", "pyutest_blocks:stone_block", "pyutest_blocks:stone_block" },
{ "pyutest_blocks:stone_block", "pyutest_blocks:stone_block", "pyutest_blocks:stone_block" },
}
})

View File

@ -1,10 +1,10 @@
minetest.register_abm({
label = "Water freezing/evaporating",
nodenames = {"group:water"},
nodenames = { "group:water" },
interval = 1.2,
chance = 1.8,
catch_up = true,
action = function (pos)
action = function(pos)
if pos.y < PyuTest.OVERWORLD_SURFACE_BOTTOM and pos.y >= PyuTest.OVERWORLD_DEEP_OCEAN_MIN then
return
end
@ -13,20 +13,20 @@ minetest.register_abm({
if not def then return end
local heat = def.heat_point or 50
local found = minetest.find_node_near(pos, 2, {"group:emits_heat"}) ~= nil
local found = minetest.find_node_near(pos, 2, { "group:emits_heat" }) ~= nil
if heat <= 12 and not found then
minetest.set_node(pos, {name = "pyutest_blocks:ice_block"})
minetest.set_node(pos, { name = "pyutest_blocks:ice_block" })
end
end
})
minetest.register_abm({
label = "Water evaporating",
nodenames = {"group:water"},
nodenames = { "group:water" },
interval = 0.1,
chance = 1,
action = function (pos)
action = function(pos)
local def = PyuTest.get_biome_def(pos)
if not def then return end
@ -40,12 +40,12 @@ minetest.register_abm({
minetest.register_abm({
label = "Ice thawing",
nodenames = {"group:thawable"},
neighbors = {"group:emits_heat"},
nodenames = { "group:thawable" },
neighbors = { "group:emits_heat" },
interval = 3,
chance = 2.5,
catch_up = true,
action = function (pos, node)
action = function(pos, node)
local def = minetest.registered_nodes[node.name]
local thaw_into = def.__thaw_into or "pyutest_blocks:water_source"
minetest.set_node(pos, { name = thaw_into })
@ -53,25 +53,25 @@ minetest.register_abm({
})
minetest.register_abm({
nodenames = {"group:lava"},
nodenames = { "group:lava" },
interval = 0.25,
chance = 1,
action = function (pos)
action = function(pos)
local function is_water(p)
local name = minetest.get_node(p).name
if minetest.get_item_group(name, "water") ~= 0 then
return true
end
return false
end
local function replace(name, p)
minetest.set_node(p or pos, {name = name})
minetest.set_node(p or pos, { name = name })
end
PyuTest.dorange(pos, 1, function (p)
PyuTest.dorange(pos, 1, function(p)
if is_water(p) then
if p.y > pos.y then
replace("pyutest_blocks:obsidian_block")

View File

@ -1,6 +1,6 @@
-- This function is used for structures because it will update the lighting when placed.
PyuTest.register_structure = function (name, schematic, def)
local id = minetest.get_current_modname()..":structure_block_"..name
PyuTest.register_structure = function(name, schematic, def)
local id = minetest.get_current_modname() .. ":structure_block_" .. name
minetest.register_node(id, {
description = string.format("Structure Block (%s)", name),
groups = {
@ -27,12 +27,13 @@ PyuTest.register_structure = function (name, schematic, def)
})
minetest.register_lbm({
name = minetest.get_current_modname()..":spawn_"..name,
name = minetest.get_current_modname() .. ":spawn_" .. name,
run_at_every_load = true,
nodenames = {id},
action = function (pos, node)
nodenames = { id },
action = function(pos, node)
minetest.remove_node(pos)
minetest.place_schematic(pos, PyuTest.get_schematic_path(schematic), def.rotation or "random", def.replacements or {}, def.force_placement or true, def.flags or "place_center_x, place_center_z")
minetest.place_schematic(pos, PyuTest.get_schematic_path(schematic), def.rotation or "random",
def.replacements or {}, def.force_placement or true, def.flags or "place_center_x, place_center_z")
end
})
end
@ -44,7 +45,7 @@ end
PyuTest.SPECIAL_STONE_NOISE_PARAMS = {
offset = 0,
scale = 1,
spread = {x = 250, y = 250, z = 250},
spread = { x = 250, y = 250, z = 250 },
seed = 1536,
octaves = 3,
persist = 0.4,
@ -55,7 +56,7 @@ PyuTest.SPECIAL_STONE_NOISE_PARAMS = {
PyuTest.MOUNTAIN_STRIP_NOISE_PARAMS = {
offset = 0,
scale = 1,
spread = {x = 512, y = 512, z = 512},
spread = { x = 512, y = 512, z = 512 },
-- seed = 8425,
octaves = 6,
persist = 0.4,
@ -115,7 +116,7 @@ PyuTest.get_biomes_from_type = function(type)
return biomes
end
PyuTest.get_flowering_biomes = function ()
PyuTest.get_flowering_biomes = function()
local biomes = {}
for k, v in pairs(minetest.registered_biomes) do
@ -127,7 +128,7 @@ PyuTest.get_flowering_biomes = function ()
return biomes
end
PyuTest.get_extra_flowering_biomes = function ()
PyuTest.get_extra_flowering_biomes = function()
local biomes = {}
for k, v in pairs(minetest.registered_biomes) do
@ -153,7 +154,7 @@ PyuTest.register_overworld_biome = function(name, type, opts, only_base)
nopts["node_riverbed"] = nopts["node_riverbed"] or "pyutest_blocks:gravel_block"
nopts["node_sand"] = nopts["node_sand"] or "pyutest_blocks:sand_block"
nopts["node_sandstone"] = nopts["node_sandstone"] or "pyutest_blocks:sandstone_block"
nopts["_pyutest_biome_flowering"] = nopts["_pyutest_biome_flowering"] or false
nopts["_pyutest_biome_flowering_extra"] = nopts["_pyutest_biome_flowering_extra"] or false
@ -174,7 +175,7 @@ PyuTest.register_overworld_biome = function(name, type, opts, only_base)
if nopts["enable_beaches"] then
minetest.register_biome(PyuTest.util.tableconcat(nopts, {
name = name.."_beach",
name = name .. "_beach",
y_max = y_min,
y_min = PyuTest.OVERWORLD_SURFACE_BOTTOM,
node_top = nopts["node_sand"],
@ -190,7 +191,7 @@ PyuTest.register_overworld_biome = function(name, type, opts, only_base)
end
minetest.register_biome(PyuTest.util.tableconcat({
name = name.."_ocean",
name = name .. "_ocean",
node_top = nopts["node_riverbed"],
depth_top = 2,
node_filler = nopts["node_riverbed"],
@ -211,7 +212,7 @@ PyuTest.register_overworld_biome = function(name, type, opts, only_base)
}))
minetest.register_biome(PyuTest.util.tableconcat({
name = name.."_deep_ocean",
name = name .. "_deep_ocean",
node_top = nopts["node_riverbed"],
depth_top = 2,
@ -234,7 +235,7 @@ PyuTest.register_overworld_biome = function(name, type, opts, only_base)
}))
minetest.register_biome(PyuTest.util.tableconcat({
name = name.."_cave",
name = name .. "_cave",
heat_point = nopts["heat_point"],
humidity_point = nopts["humidity_point"],
y_max = PyuTest.OVERWORLD_DEEP_OCEAN_MIN - 1,

View File

@ -1,4 +1,4 @@
local modpath = minetest.get_modpath("pyutest_mapgen")
dofile(modpath.."/api.lua")
dofile(modpath.."/mapgen.lua")
dofile(modpath .. "/api.lua")
dofile(modpath .. "/mapgen.lua")

View File

@ -14,13 +14,13 @@ mg_flags.dungeons = false
-- https://git.minetest.land/VoxeLibre/VoxeLibre/src/branch/master/mods/MAPGEN/mcl_mapgen_core/init.lua#L127
local mg_flags_str = ""
for k,v in pairs(mg_flags) do
for k, v in pairs(mg_flags) do
if v == false then
k = "no" .. k
end
mg_flags_str = mg_flags_str .. k .. ","
end
if string.len(mg_flags_str) > 0 then
mg_flags_str = string.sub(mg_flags_str, 1, string.len(mg_flags_str)-1)
mg_flags_str = string.sub(mg_flags_str, 1, string.len(mg_flags_str) - 1)
end
minetest.set_mapgen_setting("mg_flags", mg_flags_str, true)

View File

@ -11,7 +11,7 @@ PyuTest.make_ore = function(id, desc, options)
ore_drop = nil,
ore_drop_count = 1,
ore_sounds = nil,
ore_stone = {"pyutest-stone.png"},
ore_stone = { "pyutest-stone.png" },
ore_color = nil,
}
@ -36,7 +36,7 @@ PyuTest.make_ore = function(id, desc, options)
drop = conf.ore_drop .. " " .. tostring(conf.ore_drop_count or 1),
sounds = PyuTest.make_node_sounds(conf.ore_sounds),
tiles = conf.ore_stone,
overlay_tiles = {{name = "pyutest-ore-overlay.png", color = conf.ore_color}}
overlay_tiles = { { name = "pyutest-ore-overlay.png", color = conf.ore_color } }
}, conf.ore_conf))
minetest.register_ore({
@ -106,9 +106,9 @@ PyuTest.make_ore_and_item = function(id, desc, item_id_suffix, item_description_
end
end
local oid = id.."_ore"
local iid = id.."_"..item_id_suffix
local rid = conf.make_raw and id.."_raw" or nil
local oid = id .. "_ore"
local iid = id .. "_" .. item_id_suffix
local rid = conf.make_raw and id .. "_raw" or nil
local ore_conf = PyuTest.make_ore(oid, desc .. " Ore", PyuTest.util.tableconcat(conf.ore_options, {
ore_drop = conf.ore_options.ore_drop or (rid or iid)
@ -127,8 +127,8 @@ PyuTest.make_ore_and_item = function(id, desc, item_id_suffix, item_description_
minetest.register_craftitem(rid, PyuTest.util.tableconcat({
description = Translate("Raw " .. desc),
groups = PyuTest.util.tableconcat({
mineral = 1,
raw_mineral = 1
mineral = 1,
raw_mineral = 1
}, conf.raw_groups),
wield_image = conf.raw_texture,
inventory_image = conf.raw_texture
@ -158,8 +158,8 @@ PyuTest.make_ore_and_item = function(id, desc, item_id_suffix, item_description_
minetest.register_craft({
output = bid,
recipe = {
{iid, iid},
{iid, iid}
{ iid, iid },
{ iid, iid }
}
})

View File

@ -1,5 +1,5 @@
local modpath = minetest.get_modpath(minetest.get_current_modname())
dofile(modpath.."/api.lua")
dofile(modpath .. "/api.lua")
minetest.register_ore({
ore_type = "blob",
@ -91,19 +91,19 @@ PyuTest.make_ore_and_item("pyutest_ores:coal", "Coal", "lump", "Lump", {
ore_strength = PyuTest.BLOCK_NORMAL,
ore_drop_count = 2,
ore_color = {r = 32, g = 32, b = 32},
ore_color = { r = 32, g = 32, b = 32 },
},
item_texture = "pyutest-lump.png",
item_conf = {
color = {r = 32, g = 32, b = 32}
color = { r = 32, g = 32, b = 32 }
},
item_groups = {
fuel = 1
},
block_tiles = {"pyutest-metal.png"},
block_color = {r = 32, g = 32, b = 32}
block_tiles = { "pyutest-metal.png" },
block_color = { r = 32, g = 32, b = 32 }
})
PyuTest.make_ore_and_item("pyutest_ores:iron", "Iron", "ingot", "Ingot", {
@ -120,7 +120,7 @@ PyuTest.make_ore_and_item("pyutest_ores:iron", "Iron", "ingot", "Ingot", {
make_raw = true,
raw_texture = "pyutest-lump.png",
block_tiles = {"pyutest-metal.png"},
block_tiles = { "pyutest-metal.png" },
})
PyuTest.make_ore_and_item("pyutest_ores:zinc", "Zinc", "ingot", "Ingot", {
@ -144,7 +144,7 @@ PyuTest.make_ore_and_item("pyutest_ores:zinc", "Zinc", "ingot", "Ingot", {
color = "#bed3d4"
},
block_tiles = {"pyutest-metal.png"},
block_tiles = { "pyutest-metal.png" },
block_color = "#bed3d4"
})
@ -169,7 +169,7 @@ PyuTest.make_ore_and_item("pyutest_ores:copper", "Copper", "ingot", "Ingot", {
color = "darkgoldenrod"
},
block_tiles = {"pyutest-metal.png"},
block_tiles = { "pyutest-metal.png" },
block_color = "darkgoldenrod"
})
@ -194,7 +194,7 @@ PyuTest.make_ore_and_item("pyutest_ores:tin", "Tin", "ingot", "Ingot", {
color = "#686569"
},
block_tiles = {"pyutest-metal.png"},
block_tiles = { "pyutest-metal.png" },
block_color = "#686569"
})
@ -219,7 +219,7 @@ PyuTest.make_ore_and_item("pyutest_ores:gold", "Gold", "ingot", "Ingot", {
color = "gold"
},
block_tiles = {"pyutest-metal.png"},
block_tiles = { "pyutest-metal.png" },
block_color = "gold",
block_shiny = true,
})
@ -239,7 +239,7 @@ PyuTest.make_ore_and_item("pyutest_ores:diamond", "Diamond", "shard", "Shard", {
color = "cyan"
},
block_tiles = {"pyutest-metal.png"},
block_tiles = { "pyutest-metal.png" },
block_color = "cyan",
block_shiny = true,
})
@ -259,7 +259,7 @@ PyuTest.make_ore_and_item("pyutest_ores:emerald", "Emerald", "shard", "Shard", {
color = "seagreen"
},
block_tiles = {"pyutest-metal.png"},
block_tiles = { "pyutest-metal.png" },
block_color = "seagreen",
block_shiny = true,
})

View File

@ -1,9 +1,9 @@
local modpath = minetest.get_modpath("pyutest_overworld")
dofile(modpath.."/biomes.lua")
dofile(modpath .. "/biomes.lua")
if not PyuTest.is_flat() then
dofile(modpath.."/features.lua")
dofile(modpath.."/structures.lua")
dofile(modpath.."/trees.lua")
dofile(modpath .. "/features.lua")
dofile(modpath .. "/structures.lua")
dofile(modpath .. "/trees.lua")
end

View File

@ -2,23 +2,23 @@ minetest.register_decoration({
deco_type = "simple",
sidelen = 16,
fill_ratio = 0.0003,
place_on = {"group:ground"},
place_on = { "group:ground" },
decoration = PyuTest.spawning_lootboxes
})
PyuTest.register_structure("igloo", "Igloo", {
place_on = {"pyutest_blocks:snow_block"},
place_on = { "pyutest_blocks:snow_block" },
fill_ratio = 0.00004,
biomes = {"FrozenPlains"},
biomes = { "FrozenPlains" },
rotation = "random",
flags = "place_center_x, place_center_z",
place_offset_y = 1
})
PyuTest.register_structure("desert_well", "DesertWell", {
place_on = {"pyutest_blocks:sand_block"},
place_on = { "pyutest_blocks:sand_block" },
fill_ratio = 0.00006,
biomes = {"Desert"},
biomes = { "Desert" },
rotation = "random"
})
@ -34,11 +34,11 @@ PyuTest.register_structure("ice_spike", "IceSpike", {
PyuTest.register_structure("ocean_ruins", "OceanRuins", {
fill_ratio = 0.0002,
place_on = {"pyutest_blocks:gravel_block"},
place_on = { "pyutest_blocks:gravel_block" },
biomes = PyuTest.get_biomes_from_type(PyuTest.BIOME_TYPES.OCEAN),
y_max = PyuTest.OVERWORLD_DEEP_OCEAN_MAX + 4,
y_min = PyuTest.OVERWORLD_DEEP_OCEAN_MIN,
spawn_by = {"pyutest_blocks:water_source"},
spawn_by = { "pyutest_blocks:water_source" },
num_spawn_by = 2
})

View File

@ -1,7 +1,7 @@
-- plants and other small decorations
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:grass"},
place_on = { "group:grass" },
sidelen = 16,
fill_ratio = 0.009,
biomes = PyuTest.get_flowering_biomes(),
@ -10,7 +10,7 @@ minetest.register_decoration({
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:grass"},
place_on = { "group:grass" },
sidelen = 16,
fill_ratio = 0.032,
biomes = PyuTest.get_extra_flowering_biomes(),
@ -19,28 +19,28 @@ minetest.register_decoration({
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:grass"},
place_on = { "group:grass" },
sidelen = 16,
fill_ratio = 0.048,
biomes = {"Grassland"},
biomes = { "Grassland" },
decoration = "pyutest_grass:grass_plant"
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:grass"},
place_on = { "group:grass" },
sidelen = 16,
fill_ratio = 0.0018,
biomes = {"Grassland"},
biomes = { "Grassland" },
decoration = "pyutest_blocks:haybale_block"
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"pyutest_blocks:dirt_block", "pyutest_blocks:sand_block"},
place_on = { "pyutest_blocks:dirt_block", "pyutest_blocks:sand_block" },
sidelen = 16,
fill_ratio = 0.019,
biomes = {"Desert"},
biomes = { "Desert" },
decoration = "pyutest_flowers:deadbush"
})
@ -48,8 +48,8 @@ minetest.register_decoration({
deco_type = "simple",
sidelen = 16,
fill_ratio = 0.03,
place_on = {"pyutest_blocks:water_source"},
biomes = {"Swamp", "Swamp_ocean"},
place_on = { "pyutest_blocks:water_source" },
biomes = { "Swamp", "Swamp_ocean" },
y_max = PyuTest.OVERWORLD_TOP,
y_min = 0,
decoration = "pyutest_flowers:lilypad",
@ -60,11 +60,11 @@ minetest.register_decoration({
deco_type = "simple",
sidelen = 16,
fill_ratio = 0.04,
place_on = {"group:sugarcane_spawn_on"},
place_on = { "group:sugarcane_spawn_on" },
decoration = "pyutest_flowers:sugarcane",
y_max = PyuTest.OVERWORLD_SURFACE_BOTTOM,
y_min = 0,
spawn_by = {"pyutest_blocks:water_source"},
spawn_by = { "pyutest_blocks:water_source" },
num_spawn_by = 1,
height = 1,
height_max = 4
@ -73,10 +73,10 @@ minetest.register_decoration({
-- trees
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass"},
place_on = { "group:grass" },
sidelen = 16,
fill_ratio = 0.03,
biomes = {"Forest"},
biomes = { "Forest" },
schematic = PyuTest.get_schematic_path("Tree"),
rotation = "random",
flags = "place_center_x, place_center_z",
@ -85,10 +85,10 @@ minetest.register_decoration({
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass"},
place_on = { "group:grass" },
sidelen = 16,
fill_ratio = 0.00045,
biomes = {"Grassland"},
biomes = { "Grassland" },
schematic = PyuTest.get_schematic_path("Tree"),
rotation = "random",
flags = "place_center_x, place_center_z",
@ -97,10 +97,10 @@ minetest.register_decoration({
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass"},
place_on = { "group:grass" },
sidelen = 16,
fill_ratio = 0.00085,
biomes = {"Savanna"},
biomes = { "Savanna" },
schematic = PyuTest.get_schematic_path("SavannaTree"),
rotation = "random",
flags = "place_center_x, place_center_z",
@ -110,10 +110,10 @@ minetest.register_decoration({
minetest.register_decoration({
deco_type = "schematic",
place_on = {"pyutest_blocks:mycelium_block"},
place_on = { "pyutest_blocks:mycelium_block" },
sidelen = 16,
fill_ratio = 0.003,
biomes = {"MushroomFields", "LargeMushroomForest"},
biomes = { "MushroomFields", "LargeMushroomForest" },
schematic = PyuTest.get_schematic_path("Mushroom"),
rotation = "random",
flags = "place_center_x, place_center_z",
@ -123,10 +123,10 @@ minetest.register_decoration({
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass"},
place_on = { "group:grass" },
sidelen = 16,
fill_ratio = 0.005,
biomes = {"Taiga"},
biomes = { "Taiga" },
schematic = PyuTest.get_schematic_path("TaigaTree"),
rotation = "random",
flags = "place_center_x, place_center_z",
@ -136,10 +136,10 @@ minetest.register_decoration({
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass"},
place_on = { "group:grass" },
sidelen = 16,
fill_ratio = 0.03,
biomes = {"BirchForest"},
biomes = { "BirchForest" },
schematic = PyuTest.get_schematic_path("BirchTree"),
rotation = "random",
flags = "place_center_x, place_center_z",
@ -148,10 +148,10 @@ minetest.register_decoration({
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass"},
place_on = { "group:grass" },
sidelen = 16,
fill_ratio = 0.02,
biomes = {"BirchForest", "OldGrowthBirchForest"},
biomes = { "BirchForest", "OldGrowthBirchForest" },
schematic = PyuTest.get_schematic_path("TallBirchTree"),
rotation = "random",
flags = "place_center_x, place_center_z",
@ -160,10 +160,10 @@ minetest.register_decoration({
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass"},
place_on = { "group:grass" },
sidelen = 16,
fill_ratio = 0.005,
biomes = {"CherryGrove"},
biomes = { "CherryGrove" },
schematic = PyuTest.get_schematic_path("CherryTree"),
rotation = "random",
flags = "place_center_x, place_center_z",
@ -173,10 +173,10 @@ minetest.register_decoration({
minetest.register_decoration({
deco_type = "schematic",
place_on = {"pyutest_blocks:snow_block"},
place_on = { "pyutest_blocks:snow_block" },
sidelen = 16,
fill_ratio = 0.004,
biomes = {"SnowyForest"},
biomes = { "SnowyForest" },
schematic = PyuTest.get_schematic_path("SnowyTree1"),
rotation = "random",
flags = "place_center_x, place_center_z",
@ -185,10 +185,10 @@ minetest.register_decoration({
minetest.register_decoration({
deco_type = "schematic",
place_on = {"pyutest_blocks:snow_block"},
place_on = { "pyutest_blocks:snow_block" },
sidelen = 16,
fill_ratio = 0.004,
biomes = {"SnowyForest"},
biomes = { "SnowyForest" },
schematic = PyuTest.get_schematic_path("SnowyTree2"),
rotation = "random",
flags = "place_center_x, place_center_z",
@ -198,10 +198,10 @@ minetest.register_decoration({
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass"},
place_on = { "group:grass" },
sidelen = 16,
fill_ratio = 0.004,
biomes = {"Swamp"},
biomes = { "Swamp" },
schematic = PyuTest.get_schematic_path("SwampTree"),
rotation = "random",
flags = "place_center_x, place_center_z",
@ -210,10 +210,10 @@ minetest.register_decoration({
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass"},
place_on = { "group:grass" },
sidelen = 16,
fill_ratio = 0.004,
biomes = {"OldGrowthBirchForest"},
biomes = { "OldGrowthBirchForest" },
schematic = PyuTest.get_schematic_path("VeryTallBirchTree"),
rotation = "random",
flags = "place_center_x, place_center_z",
@ -222,10 +222,10 @@ minetest.register_decoration({
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass"},
place_on = { "group:grass" },
sidelen = 16,
fill_ratio = 0.016,
biomes = {"AspenForest"},
biomes = { "AspenForest" },
schematic = PyuTest.get_schematic_path("AspenTree1"),
rotation = "random",
flags = "place_center_x, place_center_z",
@ -234,10 +234,10 @@ minetest.register_decoration({
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass"},
place_on = { "group:grass" },
sidelen = 16,
fill_ratio = 0.008,
biomes = {"AspenForest"},
biomes = { "AspenForest" },
schematic = PyuTest.get_schematic_path("AspenTree2"),
rotation = "random",
flags = "place_center_x, place_center_z",
@ -246,10 +246,10 @@ minetest.register_decoration({
minetest.register_decoration({
deco_type = "schematic",
place_on = {"pyutest_blocks:podzol_block"},
place_on = { "pyutest_blocks:podzol_block" },
sidelen = 16,
fill_ratio = 0.019,
biomes = {"RedwoodForest"},
biomes = { "RedwoodForest" },
schematic = PyuTest.get_schematic_path("RedwoodTree"),
rotation = "random",
flags = "place_center_x, place_center_z",
@ -258,10 +258,10 @@ minetest.register_decoration({
minetest.register_decoration({
deco_type = "schematic",
place_on = {"pyutest_blocks:mycelium_block"},
place_on = { "pyutest_blocks:mycelium_block" },
sidelen = 16,
fill_ratio = 0.006,
biomes = {"LargeMushroomForest"},
biomes = { "LargeMushroomForest" },
schematic = PyuTest.get_schematic_path("TallMushroom"),
rotation = "random",
flags = "place_center_x, place_center_z",
@ -270,10 +270,10 @@ minetest.register_decoration({
minetest.register_decoration({
deco_type = "schematic",
place_on = {"pyutest_blocks:mycelium_block"},
place_on = { "pyutest_blocks:mycelium_block" },
sidelen = 16,
fill_ratio = 0.002,
biomes = {"LargeMushroomForest"},
biomes = { "LargeMushroomForest" },
schematic = PyuTest.get_schematic_path("SmallMushroom"),
rotation = "random",
flags = "place_center_x, place_center_z",
@ -283,10 +283,10 @@ minetest.register_decoration({
minetest.register_decoration({
deco_type = "schematic",
place_on = {"pyutest_blocks:mycelium_block"},
place_on = { "pyutest_blocks:mycelium_block" },
sidelen = 16,
fill_ratio = 0.007,
biomes = {"LargeMushroomForest"},
biomes = { "LargeMushroomForest" },
schematic = PyuTest.get_schematic_path("FallenMushroom"),
rotation = "random",
flags = "place_center_x, place_center_z",

View File

@ -1,4 +1,4 @@
PyuTest.register_world = function (options)
PyuTest.register_world = function(options)
local default_options = {}
local conf = {}
@ -69,7 +69,7 @@ PyuTest.register_world = function (options)
node_cave_liquid = opts.node_water or "air",
}), not overworld)
self.biome_names[#self.biome_names+1] = newname
self.biome_names[#self.biome_names + 1] = newname
return name
end
@ -95,14 +95,14 @@ PyuTest.register_world = function (options)
}, "pyutest-world-token.png", {
color = color,
stack_max = 16,
on_use = function (itemstack, user, pointed_thing)
on_use = function(itemstack, user, pointed_thing)
local pos = user:get_pos()
local npos = vector.new(pos.x, average, pos.y)
local range = 1
itemstack:take_item()
user:set_pos(npos)
minetest.sound_play({name = "spellbook_action", gain = 1}, {pos = npos})
minetest.sound_play({ name = "spellbook_action", gain = 1 }, { pos = npos })
local min = npos - vector.new(range, range, range)
local max = npos + vector.new(range, range, range)
@ -112,7 +112,7 @@ PyuTest.register_world = function (options)
local vm = minetest.get_voxel_manip()
local emin, emax = vm:read_from_map(min, max)
local a = VoxelArea:new{
local a = VoxelArea:new {
MinEdge = emin,
MaxEdge = emax
}
@ -165,4 +165,3 @@ PyuTest.register_world = function (options)
return World
end

View File

@ -19,7 +19,7 @@ PyuTest.IceWorld:register_ore({
clust_scarcity = 3 * 3 * 3,
clust_num_ores = 35,
clust_size = 5,
biomes = {icy_cavern},
biomes = { icy_cavern },
noise_params = PyuTest.SPECIAL_STONE_NOISE_PARAMS
})
@ -30,6 +30,6 @@ PyuTest.IceWorld:register_ore({
clust_scarcity = 4.5 * 4.5 * 4.5,
clust_num_ores = 6,
clust_size = 5,
biomes = {icy_cavern},
biomes = { icy_cavern },
noise_params = PyuTest.SPECIAL_STONE_NOISE_PARAMS
})

View File

@ -1,7 +1,7 @@
local modpath = minetest.get_modpath("pyutest_worlds")
dofile(modpath.."/api.lua")
dofile(modpath .. "/api.lua")
dofile(modpath.."/ice.lua")
dofile(modpath.."/lava.lua")
dofile(modpath.."/sky.lua")
dofile(modpath .. "/ice.lua")
dofile(modpath .. "/lava.lua")
dofile(modpath .. "/sky.lua")

View File

@ -30,7 +30,7 @@ PyuTest.LavaWorld:register_ore({
clust_scarcity = 4.5 * 4.5 * 4.5,
clust_num_ores = 6,
clust_size = 5,
biomes = {lava_cavern},
biomes = { lava_cavern },
noise_params = PyuTest.SPECIAL_STONE_NOISE_PARAMS
})
@ -47,14 +47,14 @@ PyuTest.LavaWorld:register_ore({
PyuTest.make_ore("pyutest_worlds:magic_shards_ore", "Magic Shards Ore", {
scarcity = 12 * 12 * 12,
wherein = {"pyutest_blocks:molten_rock_block"},
wherein = { "pyutest_blocks:molten_rock_block" },
y_max = PyuTest.LavaWorld.y_max,
y_min = PyuTest.LavaWorld.y_min,
ore_strength = PyuTest.BLOCK_NORMAL,
ore_drop = "pyutest_magic:magic_shards",
ore_color = "#24152a",
ore_stone = {"pyutest-molten-rock.png"},
ore_stone = { "pyutest-molten-rock.png" },
ore_conf = {
light_source = 6
}