[update] more changes and stuff, but still not released
This commit is contained in:
parent
5f5d2ea48e
commit
b4e0b9a787
15
CHANGELOG.md
15
CHANGELOG.md
@ -35,6 +35,19 @@
|
||||
- "Decentralize" PyuTest APIs
|
||||
- This means that PyuTest APIs no longer assume blocks, entities, bla bla bla are being defined for the pyutest_core mod
|
||||
- Remove Colors from Lootboxes
|
||||
- Unlimited Blocks in Creative Mode
|
||||
- Fast Breaking Speeds in Creative Mode
|
||||
- Added Clay along with Terracotta
|
||||
- Added More Decorative Blocks
|
||||
- Added Bricks
|
||||
- Added `acid_vulnerable` Group Blocks without this Group will no Longer be Destroyed by Contagious Acid
|
||||
- Revamped Sponge
|
||||
- Added Freezer Device
|
||||
- Freezer Device Turns Water to Ice
|
||||
- Freezer Device Turns Lava to Stone
|
||||
- Added Heater Device
|
||||
- Added Switches
|
||||
- Added Negated Copper Wires
|
||||
|
||||
## [Some Day I Don't Remember] Unnamed Minor Update
|
||||
|
||||
@ -173,7 +186,7 @@
|
||||
- New Grass Texture
|
||||
- Add Placeholder for Trapdoors
|
||||
|
||||
## [Jun 8 2024] Unnamed Major Update
|
||||
## [Jun 8 2024] Unnamed Update
|
||||
|
||||
- Added Logo
|
||||
- Added Colored Blocks
|
||||
|
@ -1,5 +1,5 @@
|
||||
minetest.register_privilege("builder", {
|
||||
description = "Builder Privilege",
|
||||
description = "Builder/World Edit Privilege",
|
||||
give_to_singeplayer = true
|
||||
})
|
||||
|
||||
@ -34,14 +34,10 @@ Or it can be `anyblock` which replaces any block other than air and ignore.
|
||||
end
|
||||
end
|
||||
|
||||
for dx = -range, range do
|
||||
for dz = -range, range do
|
||||
for dy = -range, range do
|
||||
local npos = {x = pos.x + dx, y = pos.y + dy, z = pos.z + dz}
|
||||
replace(npos)
|
||||
end
|
||||
end
|
||||
end
|
||||
PyuTestCore.dorange(pos, range, function(p)
|
||||
replace(p)
|
||||
end)
|
||||
|
||||
return true, string.format("Replaced %d blocks", replaced)
|
||||
end
|
||||
return false, "Requires 3 arguments"
|
||||
|
@ -1,29 +1,38 @@
|
||||
minetest.register_abm({
|
||||
label = "Sponge Loop",
|
||||
nodenames = {"pyutest_core:water_source", "pyutest_core:water_flowing"},
|
||||
neighbors = {"pyutest_core:sponge"},
|
||||
interval = 0.1,
|
||||
nodenames = {"pyutest_core:sponge"},
|
||||
neighbors = {"group:liquid"},
|
||||
interval = 0,
|
||||
chance = 1,
|
||||
action = function (pos)
|
||||
minetest.remove_node(pos)
|
||||
local range = 4
|
||||
|
||||
local function replace(npos)
|
||||
local node = minetest.get_node(npos)
|
||||
if node.name == "air" then return end
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
|
||||
if def.groups["liquid"] == 1 then
|
||||
minetest.remove_node(npos)
|
||||
end
|
||||
end
|
||||
|
||||
PyuTestCore.dorange(pos, range, function(p)
|
||||
replace(p)
|
||||
end)
|
||||
end
|
||||
})
|
||||
|
||||
local blocks = {}
|
||||
for k, v in pairs(minetest.registered_nodes) do
|
||||
if v.groups["block"] ~= nil and k:find("acid") == nil then
|
||||
table.insert(blocks, k)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Contagious Acid Spread",
|
||||
nodenames = blocks,
|
||||
nodenames = {"group:acid_vulnerable"},
|
||||
neighbors = {"pyutest_core:contagious_acid"},
|
||||
interval = 3.4,
|
||||
chance = 3.7,
|
||||
catchup = true,
|
||||
action = function (pos)
|
||||
minetest.set_node(pos, {name = "pyutest_core:contagious_acid"})
|
||||
minetest.set_node(pos, {
|
||||
name = "pyutest_core:contagious_acid"
|
||||
})
|
||||
end
|
||||
})
|
||||
|
@ -47,6 +47,8 @@ PyuTestCore.make_building_blocks = function (name, desc, tex, colortint, cgroups
|
||||
groups["block"] = groups["block"] or PyuTestCore.BLOCK_BREAKABLE_NORMAL
|
||||
|
||||
local econf = extra_conf or {}
|
||||
econf["is_ground_content"] = econf["is_ground_content"] or true
|
||||
|
||||
local id_block = name.."_block"
|
||||
local id_carpet = name.."_carpet"
|
||||
local id_slab = name.."_slab"
|
||||
@ -124,24 +126,73 @@ PyuTestCore.make_building_blocks = function (name, desc, tex, colortint, cgroups
|
||||
})
|
||||
end
|
||||
|
||||
PyuTestCore.make_building_blocks("pyutest_core:grass", "Grass", {"grass.png"}, nil, {ground = 1}, {drop = "pyutest_core:dirt_block"})
|
||||
PyuTestCore.make_building_blocks("pyutest_core:dirt", "Dirt", {"dirt.png"}, nil, {ground = 1})
|
||||
PyuTestCore.make_building_blocks("pyutest_core:stone", "Stone", {"stone.png"}, nil, {ground = 1, block = PyuTestCore.BLOCK_BREAKABLE_MIDDLE})
|
||||
PyuTestCore.make_building_blocks("pyutest_core:wooden", "Wooden", {"wood.png"}, nil, {block = PyuTestCore.BLOCK_BREAKABLE_CHOPPY})
|
||||
PyuTestCore.make_building_blocks("pyutest_core:snow", "Snow", {"snow.png"}, nil, {ground = 1})
|
||||
PyuTestCore.make_building_blocks("pyutest_core:sand", "Sand", {"sand.png"}, nil, {ground = 1})
|
||||
PyuTestCore.make_building_blocks("pyutest_core:sandstone", "Sandstone", {"sandstone.png"}, nil, {ground = 1})
|
||||
PyuTestCore.make_building_blocks("pyutest_core:ice", "Ice", {"ice.png"}, nil, {ground = 1})
|
||||
PyuTestCore.make_building_blocks("pyutest_core:leaves", "Leaves", {"leaves.png"}, nil)
|
||||
PyuTestCore.make_building_blocks("pyutest_core:mushroom", "Mushroom", {"mushroom.png"}, nil)
|
||||
PyuTestCore.make_building_blocks("pyutest_core:mushroom_stem", "Mushroom Stem", {"mushroom-stem.png"}, nil)
|
||||
PyuTestCore.make_building_blocks("pyutest_core:grass", "Grass", {"grass.png"}, nil, {
|
||||
ground = 1,
|
||||
acid_vulnerable = 1
|
||||
})
|
||||
PyuTestCore.make_building_blocks("pyutest_core:dirt", "Dirt", {"dirt.png"}, nil, {
|
||||
ground = 1,
|
||||
acid_vulnerable = 1
|
||||
})
|
||||
|
||||
PyuTestCore.make_building_blocks("pyutest_core:stone", "Stone", {"stone.png"}, nil, {
|
||||
ground = 1,
|
||||
block = PyuTestCore.BLOCK_BREAKABLE_MIDDLE,
|
||||
}, {is_ground_content = false})
|
||||
|
||||
PyuTestCore.make_building_blocks("pyutest_core:wooden", "Wooden", {"wood.png"}, nil, {
|
||||
block = PyuTestCore.BLOCK_BREAKABLE_CHOPPY,
|
||||
acid_vulnerable = 1
|
||||
}, {is_ground_content = false})
|
||||
|
||||
PyuTestCore.make_building_blocks("pyutest_core:snow", "Snow", {"snow.png"}, nil, {
|
||||
ground = 1,
|
||||
acid_vulnerable = 1
|
||||
})
|
||||
|
||||
PyuTestCore.make_building_blocks("pyutest_core:sand", "Sand", {"sand.png"}, nil, {
|
||||
ground = 1,
|
||||
acid_vulnerable = 1
|
||||
})
|
||||
|
||||
PyuTestCore.make_building_blocks("pyutest_core:sandstone", "Sandstone", {"sandstone.png"}, nil, {
|
||||
ground = 1,
|
||||
acid_vulnerable = 1
|
||||
}, {is_ground_content = false})
|
||||
|
||||
PyuTestCore.make_building_blocks("pyutest_core:ice", "Ice", {"ice.png"}, nil, {
|
||||
ground = 1,
|
||||
acid_vulnerable = 1,
|
||||
ice = 1
|
||||
})
|
||||
|
||||
PyuTestCore.make_building_blocks("pyutest_core:leaves", "Leaves", {"leaves.png"}, nil, {}, {
|
||||
is_ground_content = false,
|
||||
acid_vulnerable = 1
|
||||
})
|
||||
|
||||
PyuTestCore.make_building_blocks("pyutest_core:mushroom", "Mushroom", {"mushroom.png"}, nil, {}, {is_ground_content = false})
|
||||
PyuTestCore.make_building_blocks("pyutest_core:mushroom_stem", "Mushroom Stem", {"mushroom-stem.png"}, nil, {}, {is_ground_content = false})
|
||||
PyuTestCore.make_building_blocks("pyutest_core:mycelium", "Mycelium", {"mycelium.png"}, nil, {ground = 1})
|
||||
PyuTestCore.make_building_blocks("pyutest_core:hellstone", "Hellstone", {"hellstone.png"}, nil, {ground = 1, block = PyuTestCore.BLOCK_BREAKABLE_MIDDLE})
|
||||
PyuTestCore.make_building_blocks("pyutest_core:basalt", "Basalt", {"basalt.png"}, nil, {ground = 1, block = PyuTestCore.BLOCK_BREAKABLE_MIDDLE})
|
||||
PyuTestCore.make_building_blocks("pyutest_core:obsidian", "Obsidian", {"obsidian.png"}, nil, {block = PyuTestCore.BLOCK_BREAKABLE_VERYLONG})
|
||||
PyuTestCore.make_building_blocks("pyutest_core:hellstone", "Hellstone", {"hellstone.png"}, nil, {
|
||||
ground = 1,
|
||||
block = PyuTestCore.BLOCK_BREAKABLE_MIDDLE
|
||||
}, {is_ground_content = false})
|
||||
|
||||
PyuTestCore.make_building_blocks("pyutest_core:basalt", "Basalt", {"basalt.png"}, nil, {
|
||||
ground = 1,
|
||||
block = PyuTestCore.BLOCK_BREAKABLE_MIDDLE
|
||||
}, {is_ground_content = false})
|
||||
|
||||
PyuTestCore.make_building_blocks("pyutest_core:obsidian", "Obsidian", {"obsidian.png"}, nil, {
|
||||
block = PyuTestCore.BLOCK_BREAKABLE_VERYLONG
|
||||
}, {is_ground_content = false})
|
||||
|
||||
PyuTestCore.make_building_blocks("pyutest_core:haybale", "Haybale", {"haybale-top-bottom.png", "haybale-top-bottom.png", "haybale.png"}, nil)
|
||||
-- keeping old ID for backwards compatibility
|
||||
PyuTestCore.make_building_blocks("pyutest_core:crying_obsidian", "Enchanted Obsidian", {"enchanted-obsidian.png"}, nil, {block = PyuTestCore.BLOCK_BREAKABLE_VERYLONG})
|
||||
|
||||
-- keeping old ID for backwards compatibility -- that's almost 200 columns!
|
||||
PyuTestCore.make_building_blocks("pyutest_core:crying_obsidian", "Enchanted Obsidian", {"enchanted-obsidian.png"}, nil, {block = PyuTestCore.BLOCK_BREAKABLE_VERYLONG}, {is_ground_content = false})
|
||||
PyuTestCore.make_building_blocks("pyutest_core:brick", "Brick", {"bricks.png"}, nil, {block = PyuTestCore.BLOCK_BREAKABLE_MIDDLE}, {is_ground_content = false})
|
||||
|
||||
PyuTestCore.make_node("pyutest_core:light", "Light", {
|
||||
block = PyuTestCore.BLOCK_BREAKABLE_INSTANT,
|
||||
@ -178,7 +229,11 @@ PyuTestCore.make_node("pyutest_core:torch", "Torch", {
|
||||
|
||||
PyuTestCore.make_node("pyutest_core:sponge", "Sponge", {
|
||||
block = PyuTestCore.BLOCK_BREAKABLE_INSTANT
|
||||
}, {"sponge.png"})
|
||||
}, {"sponge.png"}, {
|
||||
on_timer = function(pos)
|
||||
|
||||
end
|
||||
})
|
||||
|
||||
PyuTestCore.make_node("pyutest_core:glass", "Glass", {
|
||||
block = PyuTestCore.BLOCK_BREAKABLE_INSTANT
|
||||
@ -392,7 +447,15 @@ PyuTestCore.make_node("pyutest_core:crate", "Crate", {
|
||||
end
|
||||
})
|
||||
|
||||
PyuTestCore.make_liquid = function (name, desc, groups, tiles, extra_conf)
|
||||
PyuTestCore.make_node("pyutest_core:workbench", "Workbench", {
|
||||
block = PyuTestCore.BLOCK_BREAKABLE_CHOPPY
|
||||
}, {"workbench-top.png", "workbench-bottom.png", "workbench-sides.png"}, {
|
||||
on_rightclick = function(pos, clicker)
|
||||
|
||||
end
|
||||
})
|
||||
|
||||
PyuTestCore.make_liquid = function (name, desc, groups, tiles, speed, extra_conf)
|
||||
local function make_liquid_flags(liquidtype)
|
||||
local drawtype = ""
|
||||
|
||||
@ -414,24 +477,31 @@ PyuTestCore.make_liquid = function (name, desc, groups, tiles, extra_conf)
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = liquidtype,
|
||||
liquid_viscosity = 1,
|
||||
liquid_viscosity = speed or 1,
|
||||
liquid_alternative_flowing = name.."_flowing",
|
||||
liquid_alternative_source = name.."_source"
|
||||
}, extra_conf or {})
|
||||
return t
|
||||
end
|
||||
groups["liquid"] = 1
|
||||
|
||||
local g = groups or {}
|
||||
g["liquid"] = 1
|
||||
|
||||
PyuTestCore.make_node(name.."_source", desc .. " Source", groups, tiles, make_liquid_flags("source"))
|
||||
PyuTestCore.make_node(name.."_flowing", "Flowing " .. desc, groups, tiles, make_liquid_flags("flowing"))
|
||||
PyuTestCore.make_node(name.."_source", desc .. " Source", g, tiles, make_liquid_flags("source"))
|
||||
PyuTestCore.make_node(name.."_flowing", "Flowing " .. desc, g, tiles, make_liquid_flags("flowing"))
|
||||
end
|
||||
|
||||
PyuTestCore.make_liquid("pyutest_core:water", "Water", {}, {"water.png"})
|
||||
PyuTestCore.make_liquid("pyutest_core:lava", "Lava", {}, {"lava.png"}, {
|
||||
PyuTestCore.make_liquid("pyutest_core:water", "Water", {
|
||||
water = 1
|
||||
}, {"water.png"}, 1)
|
||||
|
||||
PyuTestCore.make_liquid("pyutest_core:lava", "Lava", {
|
||||
lava = 1
|
||||
}, {"lava.png"}, 5, {
|
||||
damage_per_second = 2,
|
||||
light_source = 8
|
||||
})
|
||||
PyuTestCore.make_liquid("pyutest_core:oil", "Oil", {}, {"oil.png"})
|
||||
PyuTestCore.make_liquid("pyutest_core:liquid_acid", "Acid", {}, {"acid.png"}, {
|
||||
PyuTestCore.make_liquid("pyutest_core:oil", "Oil", {}, {"oil.png"}, 3)
|
||||
PyuTestCore.make_liquid("pyutest_core:liquid_acid", "Acid", {}, {"acid.png"}, 7, {
|
||||
damage_per_second = 2
|
||||
})
|
||||
|
@ -1,7 +1,11 @@
|
||||
PyuTestCore.ELECTRICITY_UPDATE_TIME = 0.1
|
||||
|
||||
local function xor(x, y)
|
||||
return (x or y) and (x ~= y)
|
||||
end
|
||||
|
||||
local function set_powered(pos, value)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if value then
|
||||
meta:set_int("powered", 1)
|
||||
else
|
||||
@ -9,12 +13,35 @@ local function set_powered(pos, value)
|
||||
end
|
||||
end
|
||||
|
||||
local function get_powered(pos)
|
||||
local function set_source(pos, value)
|
||||
local meta = minetest.get_meta(pos)
|
||||
return meta:get_int("powered") == 1 and true or false
|
||||
if value then
|
||||
meta:set_int("source", 1)
|
||||
else
|
||||
meta:set_int("source", 0)
|
||||
end
|
||||
end
|
||||
|
||||
local function is_electrified(pos)
|
||||
local function get_powered(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
return xor((meta:get_int("powered") == 1 and true or false), (meta:get_int("source") == 1 and true or false))
|
||||
end
|
||||
|
||||
local function set_negated(pos, value)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if value then
|
||||
meta:set_int("negated", 1)
|
||||
else
|
||||
meta:set_int("negated", 0)
|
||||
end
|
||||
end
|
||||
|
||||
local function get_negated(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
return meta:get_int("negated") == 1 and true or false
|
||||
end
|
||||
|
||||
local function is_electrified(pos, log)
|
||||
local positions = {
|
||||
vector.new(pos.x + 1, pos.y, pos.z),
|
||||
vector.new(pos.x - 1, pos.y, pos.z),
|
||||
@ -26,7 +53,17 @@ local function is_electrified(pos)
|
||||
|
||||
local result = false
|
||||
for _, v in pairs(positions) do
|
||||
if get_powered(v) then
|
||||
local powered = get_powered(v)
|
||||
local negated = get_negated(v)
|
||||
if log then minetest.log(string.format("Powered: %s", tostring(powered))) end
|
||||
if log then minetest.log(string.format("Negated: %s", tostring(negated))) end
|
||||
|
||||
if powered and not negated then
|
||||
result = true
|
||||
break
|
||||
end
|
||||
|
||||
if not powered and negated then
|
||||
result = true
|
||||
break
|
||||
end
|
||||
@ -38,9 +75,11 @@ end
|
||||
PyuTestCore.make_ore("pyutest_core:copper", "Copper", "ingot", "Ingot", "ore-copper.png", "ingot.png", "darkgoldenrod", 21, 9, 2, nil, nil, {
|
||||
on_construct = function (pos)
|
||||
set_powered(pos, true)
|
||||
set_source(pos, true)
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
PyuTestCore.make_node("pyutest_core:copper_wire", "Copper Wire", {
|
||||
block = PyuTestCore.BLOCK_BREAKABLE_INSTANT
|
||||
}, {"wire.png"}, {
|
||||
@ -81,6 +120,52 @@ minetest.register_craft({
|
||||
type = "shapeless"
|
||||
})
|
||||
|
||||
PyuTestCore.make_node("pyutest_core:negator", "Negated Copper Wire", {
|
||||
block = PyuTestCore.BLOCK_BREAKABLE_INSTANT
|
||||
}, {"wire.png"}, {
|
||||
drawtype = "signlike",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
color = "yellowgreen",
|
||||
walkable = false,
|
||||
inventory_image = "wire.png",
|
||||
paramtype2 = "wallmounted",
|
||||
selection_box = {
|
||||
type = "wallmounted"
|
||||
},
|
||||
|
||||
on_construct = function (pos)
|
||||
set_negated(pos, true)
|
||||
set_powered(pos, false)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(PyuTestCore.ELECTRICITY_UPDATE_TIME)
|
||||
end,
|
||||
|
||||
on_timer = function (pos)
|
||||
if is_electrified(pos) then
|
||||
set_powered(pos, true)
|
||||
else
|
||||
set_powered(pos, false)
|
||||
end
|
||||
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(PyuTestCore.ELECTRICITY_UPDATE_TIME)
|
||||
end
|
||||
})
|
||||
|
||||
PyuTestCore.make_node("pyutest_core:switch", "Switch", {
|
||||
block = PyuTestCore.BLOCK_BREAKABLE_NORMAL
|
||||
}, {"device.png"}, {
|
||||
color = "dimgray",
|
||||
on_construct = function(pos)
|
||||
set_powered(pos, false)
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos)
|
||||
set_powered(pos, not get_powered(pos))
|
||||
end
|
||||
})
|
||||
|
||||
PyuTestCore.make_device = function (name, desc, color, craftitem, action, setup, extra_conf)
|
||||
PyuTestCore.make_node(name.."_device", desc, {
|
||||
block = PyuTestCore.BLOCK_BREAKABLE_NORMAL
|
||||
@ -94,7 +179,7 @@ PyuTestCore.make_device = function (name, desc, color, craftitem, action, setup,
|
||||
timer:start(PyuTestCore.ELECTRICITY_UPDATE_TIME)
|
||||
end,
|
||||
on_timer = function (pos)
|
||||
if is_electrified(pos) then
|
||||
if is_electrified(pos, true) then
|
||||
action(true, pos)
|
||||
else
|
||||
action(false, pos)
|
||||
@ -134,3 +219,31 @@ PyuTestCore.make_device("pyutest_core:block_setter", "Block Setter Device", "blu
|
||||
minetest.remove_node(pos)
|
||||
minetest.place_node(pos, {name = blocks[math.random(#blocks)]})
|
||||
end)
|
||||
|
||||
PyuTestCore.make_device("pyutest_core:freezer", "Freezer Device", "skyblue", "pyutest_core:ice_block", function(e, pos)
|
||||
if not e then return end
|
||||
|
||||
PyuTestCore.dorange(pos, 3, function(p)
|
||||
local node = minetest.get_node_or_nil(p)
|
||||
if node == nil then return end
|
||||
|
||||
if minetest.get_item_group(node.name, "water") ~= 0 then
|
||||
minetest.set_node(p, {name = "pyutest_core:ice_block"})
|
||||
elseif minetest.get_item_group(node.name, "lava") ~= 0 then
|
||||
minetest.set_node(p, {name = "pyutest_core:hellstone_block"})
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
PyuTestCore.make_device("pyutest_core:heater", "Heater Device", "maroon", "pyutest_core:ash", function(e, pos)
|
||||
if not e then return end
|
||||
|
||||
PyuTestCore.dorange(pos, 3, function(p)
|
||||
local node = minetest.get_node_or_nil(p)
|
||||
if node == nil then return end
|
||||
|
||||
if minetest.get_item_group(node.name, "ice") ~= 0 then
|
||||
minetest.set_node(p, {name = "pyutest_core:water_source"})
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
@ -7,20 +7,6 @@ PyuTestCore = {
|
||||
BLOCK_BREAKABLE_LONG = 3,
|
||||
BLOCK_BREAKABLE_VERYLONG = 2,
|
||||
BLOCK_BREAKABLE_FOREVER = 1,
|
||||
|
||||
util = {
|
||||
toint = function (float)
|
||||
return tonumber(string.format("%d", float))
|
||||
end,
|
||||
|
||||
tableconcat = function (t1, t2)
|
||||
local nt = t1
|
||||
for k, v in pairs(t2) do
|
||||
nt[k] = v
|
||||
end
|
||||
return nt
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
PyuTestCore.get_schem_path = function (name)
|
||||
@ -38,7 +24,6 @@ dofile(PyuTestCore_Path.."/tools.lua")
|
||||
dofile(PyuTestCore_Path.."/wool.lua")
|
||||
dofile(PyuTestCore_Path.."/player.lua")
|
||||
dofile(PyuTestCore_Path.."/lootboxes.lua")
|
||||
dofile(PyuTestCore_Path.."/sfinv.lua")
|
||||
dofile(PyuTestCore_Path.."/ores.lua")
|
||||
dofile(PyuTestCore_Path.."/abms.lua")
|
||||
dofile(PyuTestCore_Path.."/mobs.lua")
|
||||
@ -46,3 +31,4 @@ dofile(PyuTestCore_Path.."/combat.lua")
|
||||
dofile(PyuTestCore_Path.."/magic.lua")
|
||||
dofile(PyuTestCore_Path.."/electricity.lua")
|
||||
dofile(PyuTestCore_Path.."/crafts.lua")
|
||||
dofile(PyuTestCore_Path.."/overrides.lua")
|
||||
|
@ -2,7 +2,10 @@ PyuTestCore.make_lootbox = function (name, dname, items)
|
||||
local id = name.."_lootbox"
|
||||
minetest.register_node(id, {
|
||||
description = Translate(dname .. " Lootbox"),
|
||||
groups = {block = PyuTestCore.BLOCK_BREAKABLE_CHOPPY},
|
||||
groups = {
|
||||
block = PyuTestCore.BLOCK_BREAKABLE_CHOPPY,
|
||||
not_in_creative_inventory = 1
|
||||
},
|
||||
tiles = {"crate.png"},
|
||||
sounds = PyuTestCore.make_node_sounds(),
|
||||
on_rightclick = function (pos, _, clicker)
|
||||
|
@ -33,15 +33,6 @@ mobs:register_mob("pyutest_core:monster", {
|
||||
}
|
||||
})
|
||||
mobs:register_egg("pyutest_core:monster", "Monster Spawn Egg", "egg.png", 0)
|
||||
mobs:spawn({
|
||||
name = "pyutest_core:monster",
|
||||
nodes = {"group:ground"},
|
||||
interval = 2,
|
||||
chance = 2,
|
||||
active_object_count = 8,
|
||||
min_light = 0,
|
||||
max_light = 9,
|
||||
})
|
||||
|
||||
mobs:register_mob("pyutest_core:human", {
|
||||
type = "npc",
|
||||
@ -68,16 +59,6 @@ mobs:register_mob("pyutest_core:human", {
|
||||
blood_amount = PyuTestCore.ENTITY_BLOOD_AMOUNT,
|
||||
})
|
||||
mobs:register_egg("pyutest_core:human", "Human Spawn Egg", "egg.png", 0)
|
||||
mobs:spawn({
|
||||
name = "pyutest_core:human",
|
||||
nodes = {"group:ground"},
|
||||
interval = 3,
|
||||
chance = 4,
|
||||
active_object_count = 5,
|
||||
min_light = 9,
|
||||
max_light = 15,
|
||||
day_toggle = true,
|
||||
})
|
||||
|
||||
mobs:register_mob("pyutest_core:mimic", {
|
||||
type = "monster",
|
||||
@ -103,13 +84,39 @@ mobs:register_mob("pyutest_core:mimic", {
|
||||
reach = 2
|
||||
})
|
||||
mobs:register_egg("pyutest_core:mimic", "Mimic Spawn Egg", "egg.png", 0)
|
||||
mobs:spawn({
|
||||
name = "pyutest_core:mimic",
|
||||
nodes = {"group:ground"},
|
||||
interval = 3,
|
||||
chance = 18,
|
||||
active_object_count = 2,
|
||||
min_light = 0,
|
||||
max_light = 15,
|
||||
day_toggle = true,
|
||||
})
|
||||
|
||||
|
||||
local mapgen = minetest.get_mapgen_params().mgname or "???"
|
||||
if mapgen ~= "flat" and mapgen ~= "singlenode" then
|
||||
mobs:spawn({
|
||||
name = "pyutest_core:monster",
|
||||
nodes = {"group:ground"},
|
||||
interval = 2,
|
||||
chance = 2,
|
||||
active_object_count = 8,
|
||||
min_light = 0,
|
||||
max_light = 9,
|
||||
})
|
||||
|
||||
mobs:spawn({
|
||||
name = "pyutest_core:human",
|
||||
nodes = {"group:ground"},
|
||||
interval = 3,
|
||||
chance = 4,
|
||||
active_object_count = 5,
|
||||
min_light = 9,
|
||||
max_light = 15,
|
||||
day_toggle = true,
|
||||
})
|
||||
|
||||
mobs:spawn({
|
||||
name = "pyutest_core:mimic",
|
||||
nodes = {"group:ground"},
|
||||
interval = 3,
|
||||
chance = 18,
|
||||
active_object_count = 2,
|
||||
min_light = 0,
|
||||
max_light = 15,
|
||||
day_toggle = true,
|
||||
})
|
||||
end
|
||||
|
@ -1,6 +1,7 @@
|
||||
-- player setup
|
||||
minetest.register_on_joinplayer(function (player)
|
||||
if player == nil then return end
|
||||
local name = player:get_player_name()
|
||||
player:set_properties({
|
||||
hp_max = 30
|
||||
})
|
||||
@ -8,6 +9,20 @@ minetest.register_on_joinplayer(function (player)
|
||||
player:get_inventory():set_width("main", 8)
|
||||
player:get_inventory():set_size("main", 8 * 4)
|
||||
player:hud_set_hotbar_itemcount(9)
|
||||
|
||||
-- creative mode privs
|
||||
if minetest.is_creative_enabled(name) then
|
||||
minetest.set_player_privs(name, PyuTestCore.util.tableconcat({
|
||||
fly = true,
|
||||
fast = true,
|
||||
noclip = true,
|
||||
builder = true,
|
||||
settime = true,
|
||||
creative = true,
|
||||
peaceful_player = true, -- from mobs_redo
|
||||
teleport = true,
|
||||
}, minetest.get_player_privs(name)))
|
||||
end
|
||||
end)
|
||||
|
||||
-- player physics
|
||||
@ -35,24 +50,57 @@ minetest.register_item(":", {
|
||||
wield_image = "hand.png"
|
||||
})
|
||||
|
||||
minetest.override_item("", {
|
||||
range = 6,
|
||||
tool_capabilities = {
|
||||
groupcaps = {
|
||||
block = {
|
||||
times = {
|
||||
[PyuTestCore.BLOCK_BREAKABLE_INSTANT] = 0.35,
|
||||
[PyuTestCore.BLOCK_BREAKABLE_NORMAL] = 0.85,
|
||||
[PyuTestCore.BLOCK_BREAKABLE_CHOPPY] = 3,
|
||||
[PyuTestCore.BLOCK_BREAKABLE_MIDDLE] = 5.5,
|
||||
[PyuTestCore.BLOCK_BREAKABLE_LONG] = 9,
|
||||
[PyuTestCore.BLOCK_BREAKABLE_VERYLONG] = 12,
|
||||
[PyuTestCore.BLOCK_BREAKABLE_FOREVER] = 18
|
||||
},
|
||||
uses = 0
|
||||
}
|
||||
},
|
||||
punch_attack_uses = 0,
|
||||
damage_groups = {fleshy = 1}
|
||||
}
|
||||
})
|
||||
if minetest.is_creative_enabled("") then
|
||||
local break_speed = 0.2
|
||||
|
||||
minetest.override_item("", {
|
||||
range = 9,
|
||||
tool_capabilities = {
|
||||
groupcaps = {
|
||||
block = {
|
||||
times = {
|
||||
[PyuTestCore.BLOCK_BREAKABLE_INSTANT] = break_speed,
|
||||
[PyuTestCore.BLOCK_BREAKABLE_NORMAL] = break_speed,
|
||||
[PyuTestCore.BLOCK_BREAKABLE_CHOPPY] = break_speed,
|
||||
[PyuTestCore.BLOCK_BREAKABLE_MIDDLE] = break_speed,
|
||||
[PyuTestCore.BLOCK_BREAKABLE_LONG] = break_speed,
|
||||
[PyuTestCore.BLOCK_BREAKABLE_VERYLONG] = break_speed,
|
||||
[PyuTestCore.BLOCK_BREAKABLE_FOREVER] = break_speed
|
||||
},
|
||||
uses = 0
|
||||
}
|
||||
},
|
||||
punch_attack_uses = 0,
|
||||
damage_groups = {fleshy = 100}
|
||||
}
|
||||
})
|
||||
else
|
||||
minetest.override_item("", {
|
||||
range = 6,
|
||||
tool_capabilities = {
|
||||
groupcaps = {
|
||||
block = {
|
||||
times = {
|
||||
[PyuTestCore.BLOCK_BREAKABLE_INSTANT] = 0.35,
|
||||
[PyuTestCore.BLOCK_BREAKABLE_NORMAL] = 0.85,
|
||||
[PyuTestCore.BLOCK_BREAKABLE_CHOPPY] = 3,
|
||||
[PyuTestCore.BLOCK_BREAKABLE_MIDDLE] = 5.5,
|
||||
[PyuTestCore.BLOCK_BREAKABLE_LONG] = 9,
|
||||
[PyuTestCore.BLOCK_BREAKABLE_VERYLONG] = 12,
|
||||
[PyuTestCore.BLOCK_BREAKABLE_FOREVER] = 18
|
||||
},
|
||||
uses = 0
|
||||
}
|
||||
},
|
||||
punch_attack_uses = 0,
|
||||
damage_groups = {fleshy = 1}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
-- unlimited blocks in creative mode
|
||||
minetest.register_on_placenode(function(_, _, placer)
|
||||
if placer and placer:is_player() then
|
||||
return minetest.is_creative_enabled(placer:get_player_name())
|
||||
end
|
||||
end)
|
||||
|
BIN
mods/pyutest_core/textures/bricks.png
Normal file
BIN
mods/pyutest_core/textures/bricks.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 150 B |
Binary file not shown.
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 237 B |
BIN
mods/pyutest_core/textures/workbench-bottom.png
Normal file
BIN
mods/pyutest_core/textures/workbench-bottom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 151 B |
BIN
mods/pyutest_core/textures/workbench-sides.png
Normal file
BIN
mods/pyutest_core/textures/workbench-sides.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 232 B |
BIN
mods/pyutest_core/textures/workbench-top.png
Normal file
BIN
mods/pyutest_core/textures/workbench-top.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 217 B |
@ -1,26 +1,49 @@
|
||||
PyuTestCore.util = {
|
||||
toint = function (float)
|
||||
return tonumber(string.format("%d", float))
|
||||
end,
|
||||
|
||||
tableconcat = function (t1, t2)
|
||||
local nt = t1
|
||||
for k, v in pairs(t2) do
|
||||
nt[k] = v
|
||||
end
|
||||
return nt
|
||||
end
|
||||
}
|
||||
|
||||
PyuTestCore.dorange = function(origin, range, action)
|
||||
for dx = -range, range do
|
||||
for dz = -range, range do
|
||||
for dy = -range, range do
|
||||
action(vector.new(origin.x + dx, origin.y + dy, origin.z + dz))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
PyuTestCore.create_explosion = function (pos, range, rm_pos, dmg, creator)
|
||||
if rm_pos then
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
|
||||
for dx = -range, range do
|
||||
for dz = -range, range do
|
||||
for dy = -range, range do
|
||||
local npos = {x = pos.x + dx, y = pos.y + dy, z = pos.z + dz}
|
||||
if minetest.get_node(npos).name == "pyutest_core:tnt" then
|
||||
minetest.get_node_timer(npos):start(0.2)
|
||||
else
|
||||
minetest.dig_node(npos)
|
||||
end
|
||||
end
|
||||
PyuTestCore.dorange(pos, range, function(p)
|
||||
if minetest.get_node(p).name == "pyutest_core:tnt" then
|
||||
minetest.get_node_timer(p):start(0.2)
|
||||
else
|
||||
minetest.dig_node(p)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
for _, v in pairs(minetest.get_objects_inside_radius(pos, range)) do
|
||||
if v ~= nil and v ~= creator then
|
||||
v:punch(creator, nil, {
|
||||
damage_groups = {fleshy = dmg}
|
||||
}, nil)
|
||||
if creator ~= nil then
|
||||
v:punch(creator, nil, {
|
||||
damage_groups = {fleshy = dmg}
|
||||
}, nil)
|
||||
else
|
||||
v:set_hp(v:get_hp() - dmg)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -28,12 +51,11 @@ PyuTestCore.create_explosion = function (pos, range, rm_pos, dmg, creator)
|
||||
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 * 2,
|
||||
time = 1,
|
||||
minexptime = 1,
|
||||
maxexptime = 1,
|
||||
amount = range * 3,
|
||||
time = 0.1,
|
||||
minexptime = 0.4,
|
||||
maxexptime = 1.4,
|
||||
minsize = 32,
|
||||
maxsize = 64,
|
||||
|
||||
@ -49,3 +71,5 @@ PyuTestCore.create_explosion = function (pos, range, rm_pos, dmg, creator)
|
||||
gain = 1.5
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
|
@ -1,11 +1,10 @@
|
||||
PyuTestCore.make_wool_and_dyes = function(name, desc, color)
|
||||
PyuTestCore.make_colored_blocks = function(name, desc, color)
|
||||
PyuTestCore.make_building_blocks(name.."_wool", desc.." Wool", {"wool.png"}, color or "white")
|
||||
|
||||
PyuTestCore.make_item(name.."_dye", desc.." Dye", {}, "dye.png", {
|
||||
color = color or "white"
|
||||
})
|
||||
|
||||
-- if nomakecraft then return end
|
||||
|
||||
minetest.register_craft({
|
||||
output = name.."_wool_block",
|
||||
@ -17,7 +16,7 @@ PyuTestCore.make_wool_and_dyes = function(name, desc, color)
|
||||
})
|
||||
end
|
||||
|
||||
PyuTestCore.make_wool_and_dyes("pyutest_core:white", "White", "white")
|
||||
PyuTestCore.make_colored_blocks("pyutest_core:white", "White", "white")
|
||||
minetest.register_craft({
|
||||
output = "pyutest_core:white_wool_block 4",
|
||||
recipe = {
|
||||
@ -26,13 +25,13 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
PyuTestCore.make_wool_and_dyes("pyutest_core:black", "Black", "black")
|
||||
PyuTestCore.make_wool_and_dyes("pyutest_core:brown", "Brown", "brown")
|
||||
PyuTestCore.make_colored_blocks("pyutest_core:black", "Black", "black")
|
||||
PyuTestCore.make_colored_blocks("pyutest_core:brown", "Brown", "brown")
|
||||
|
||||
PyuTestCore.make_wool_and_dyes("pyutest_core:red", "Red", "red")
|
||||
PyuTestCore.make_wool_and_dyes("pyutest_core:orange", "Orange", "orange")
|
||||
PyuTestCore.make_wool_and_dyes("pyutest_core:yellow", "Yellow", "yellow")
|
||||
PyuTestCore.make_wool_and_dyes("pyutest_core:green", "Green", "green")
|
||||
PyuTestCore.make_wool_and_dyes("pyutest_core:blue", "Blue", "blue")
|
||||
PyuTestCore.make_wool_and_dyes("pyutest_core:purple", "Purple", "purple")
|
||||
PyuTestCore.make_wool_and_dyes("pyutest_core:pink", "Pink", "pink")
|
||||
PyuTestCore.make_colored_blocks("pyutest_core:red", "Red", "red")
|
||||
PyuTestCore.make_colored_blocks("pyutest_core:orange", "Orange", "orange")
|
||||
PyuTestCore.make_colored_blocks("pyutest_core:yellow", "Yellow", "yellow")
|
||||
PyuTestCore.make_colored_blocks("pyutest_core:green", "Green", "green")
|
||||
PyuTestCore.make_colored_blocks("pyutest_core:blue", "Blue", "blue")
|
||||
PyuTestCore.make_colored_blocks("pyutest_core:purple", "Purple", "purple")
|
||||
PyuTestCore.make_colored_blocks("pyutest_core:pink", "Pink", "pink")
|
||||
|
Loading…
x
Reference in New Issue
Block a user