Commit 695ab1ce authored by Aaron Suen's avatar Aaron Suen
Browse files

Merge branch 'dev' into mapocalypse

parents 742c5896 8074e0a6
.cdb-release.jpg

307 KB | W: | H:

.cdb-release.jpg

309 KB | W: | H:

.cdb-release.jpg
.cdb-release.jpg
.cdb-release.jpg
.cdb-release.jpg
  • 2-up
  • Swipe
  • Onion skin
......@@ -27,6 +27,7 @@ return {
repo = "https://gitlab.com/sztest/nodecore",
website = "https://nodecore.mine.nu",
issueTracker = "https://discord.gg/NNYeF6f",
forums = "https://forum.minetest.net/viewtopic.php?f=15&t=24857",
screenshots = alpha
and {readbinary('.cdb-alpha.jpg'), readbinary('.cdb-release.jpg')}
or {readbinary('.cdb-release.jpg')}
......
......@@ -15,8 +15,6 @@ ISSUES-DOCS: Issues related to documentation
- Add a credits file with more extensive/specific credits, including
non-copyrightable contributions to core project...?
- Add a README to the official screenshot world explaining how to use
- Design doc needs another shakedown.
- Expecially: what has "nodecorian" come to mean?
......
------------------------------------------------------------------------
This world is maintained as a "standard" screenshot to show a visual
example of a plausible game scene, including a variety of in-game
elements. It can be used freely (MIT licensed like the rest of the
game) for making screenshots for texture packs.
How To Use:
- Copy or symlink this dir into ~/.minetest/worlds, or wherever your
minetest worlds are stored.
- Copy the world.mt.dist file to world.mt.
- Enter the world (singleplayer or "host game"; either is fine).
- Do NOT move the mouse or any other controls; keep your exact position
and looking angle. If you mess up, leave and rejoin.
- Hide the chat (F2) and wait for on-screen messages to fade.
- Select the "empty" hotbar slot #6.
- Resize your window to the largest size possible, with a ~16:9 or
~16:10 aspect ratio.
- Hold the zoom key (and no other key).
- Capture an in-game screenshot (F12).
------------------------------------------------------------------------
\ No newline at end of file
gameid = nodecore
backend = sqlite3
load_mod_nc_reative = true
-- LUALOCALS < ---------------------------------------------------------
local ItemStack, math, minetest, nodecore, pairs
= ItemStack, math, minetest, nodecore, pairs
local math_pi
= math.pi
local ItemStack, minetest, nodecore, pairs, vector
= ItemStack, minetest, nodecore, pairs, vector
-- LUALOCALS > ---------------------------------------------------------
local modname = minetest.get_current_modname();
minetest.settings:set("time_speed", 0)
minetest.after(0, function() minetest.set_timeofday(0.5) end)
local setinv = {
{"nc_stonework:tool_pick", 1, 0.7},
{"nc_stonework:tool_spade", 1, 0.8},
......@@ -38,23 +33,8 @@ for _, v in pairs(setinv) do
v[1] = n
end
local startpos = {}
local function setup(p)
local n = p:get_player_name()
local r = minetest.get_player_privs(n)
r.fly = true
r.fast = true
r.give = true
r.interact = true
r.nc_reative = true
minetest.set_player_privs(n, r)
p:set_pos({x = -112.6, y = 5, z = -92.6})
p:set_look_horizontal(163.8 * math_pi / 180)
p:set_look_vertical(9 * math_pi / 180)
p:hud_set_flags({crosshair = false})
local inv = p:get_inventory()
for i, v in pairs(setinv) do
if v then
......@@ -64,6 +44,30 @@ local function setup(p)
inv:set_stack("main", i, s)
end
end
local pname = p:get_player_name()
minetest.after(0, function()
p = minetest.get_player_by_name(pname)
if not p then return end
startpos[pname] = p:get_pos()
end)
end
nodecore.register_on_joinplayer("mock setup on join", setup)
nodecore.register_on_respawnplayer("mock setup on respawn", setup)
nodecore.register_on_joinplayer(setup)
nodecore.register_on_respawnplayer(setup)
nodecore.register_playerstep({
label = "mock inv clear",
action = function(p)
local pname = p:get_player_name()
local pos = p:get_pos()
local spos = startpos[pname]
if not spos or vector.distance(pos, spos) < 1 then return end
startpos[pname] = nil
local inv = p:get_inventory()
for i = 1, inv:get_size("main") do
local sn = inv:get_stack("main", i):get_name()
if sn:sub(1, #modname + 1) == modname .. ":" then
inv:set_stack("main", i, "")
end
end
end
})
-- LUALOCALS < ---------------------------------------------------------
local include
= include
-- LUALOCALS > ---------------------------------------------------------
include("wield")
include("model")
depends = nc_api_all, nc_player_model, nc_player_wield
\ No newline at end of file
-- LUALOCALS < ---------------------------------------------------------
local minetest, nodecore, pairs, vector
= minetest, nodecore, pairs, vector
-- LUALOCALS > ---------------------------------------------------------
local modname = minetest.get_current_modname()
local anims = {}
do
local raw = {0, 53, 165}
raw[#raw + 1] = raw[1]
for i = 1, #raw - 1 do
anims[raw[i]] = raw[i + 1]
end
end
minetest.register_entity(modname .. ":ent", {
initial_properties = {
visual = "mesh",
visual_size = {x = 0.9, y = 0.9, z = 0.9},
mesh = "nc_player_model.b3d",
textures = {"nc_player_model_base.png"},
collisionbox = {-0.25, 0, -0.25, 0.25, 2, 0.25},
physical = true
},
get_staticdata = function(self)
return minetest.serialize(self.data)
end,
on_activate = function(self, data)
self.data = data and minetest.deserialize(data) or {}
local obj = self.object
obj:set_acceleration({x = 0, y = -10, z = 0})
local anim = self.data.anim or 0
obj:set_animation({x = anim, y = anim}, 1)
nodecore.mock_player_wieldview(self)
end,
on_punch = function(self, whom)
if not whom then return end
local obj = self.object
local ctl = whom:get_player_control()
if ctl.RMB and ctl.sneak then
return obj:remove()
end
if ctl.RMB then
local pos = obj:get_pos()
if not pos then return end
pos = vector.add(pos, vector.multiply(vector.direction(
whom:get_pos(), pos), 0.25))
pos.y = pos.y + 1
return obj:set_pos(pos)
end
if ctl.sneak then
self.data.wield = {
inv = whom:get_inventory():get_list("main"),
widx = whom:get_wield_index()
}
for k, v in pairs(self.data.wield.inv) do
self.data.wield.inv[k] = v:get_name()
end
nodecore.mock_player_wieldview(self)
return
end
local pos = obj:get_pos()
if not pos then return end
local dir = vector.direction(pos, whom:get_pos())
obj:set_yaw(minetest.dir_to_yaw(dir))
local anim = anims[self.data.anim or 0]
self.data.anim = anim
obj:set_animation({x = anim, y = anim}, 1)
end
})
-- LUALOCALS < ---------------------------------------------------------
local minetest, nodecore, pairs
= minetest, nodecore, pairs
-- LUALOCALS > ---------------------------------------------------------
nodecore.amcoremod()
local modname = minetest.get_current_modname()
local xyz = function(n) return {x = n, y = n, z = n} end
local size_w_item = xyz(0.2)
local size_w_tool = xyz(0.3)
local size_slot = xyz(0.075)
local size_item = xyz(0.1)
local hidden = {is_visible = false}
local selslot = {is_visible = true, visual_size = size_slot, textures = {"nc_player_wield:sel"}}
local emptyslot = {is_visible = true, visual_size = size_slot, textures = {"nc_player_wield:slot"}}
local function calcprops(itemname, iswield)
local def = minetest.registered_items[itemname]
if def and def.virtual_item then return hidden end
if itemname == "" then return iswield and hidden or emptyslot end
return {
is_visible = true,
visual_size = iswield and (def and def.type == "tool" and size_w_tool
or size_w_item) or (itemname == "" and size_slot) or size_item,
textures = {itemname},
glow = def and (def.light_source or def.glow or 0)
}
end
local propcache_item = {}
local propcache_wield = {}
local function itemprops(itemname, iswield)
local cache = iswield and propcache_wield or propcache_item
local found = cache[itemname]
if found then return found end
found = calcprops(itemname, iswield)
cache[itemname] = found
return found
end
local entname = modname .. ":wv"
local entdef
entdef = {
initial_properties = {
hp_max = 1,
physical = false,
collide_with_objects = false,
collisionbox = {0, 0, 0, 0, 0, 0},
visual = "wielditem",
textures = {""},
is_visible = false,
static_save = false,
glow = 0
},
on_activate = function(self)
self.on_step = entdef.on_step
end,
on_step = function(self)
local conf = self.conf
if not conf then return self.object:remove() end
local pdata = self.conf.ent.data.wield
if pdata == nil then return self.object:remove() end
if not pdata then return self.object:set_properties(hidden) end
if not self.att then
self.att = true
return self.object:set_attach(self.conf.ent.object,
conf.bone, conf.apos, conf.arot)
end
local widx = pdata.widx
if conf.slot == widx then
return self.object:set_properties(selslot)
end
return self.object:set_properties(itemprops(
pdata.inv[conf.slot or widx],
not conf.slot))
end
}
minetest.register_entity(entname, entdef)
function nodecore.mock_player_wieldview(ent)
local pos = ent.object:get_pos()
if not pos then return end
for _, wv in pairs(minetest.luaentities) do
if wv.name == entname and wv.conf.ent == ent then
wv.object:remove()
end
end
local function addslot(n, b, x, y, z, rx, ry, rz)
local obj = minetest.add_entity(pos, entname)
obj:get_luaentity().conf = {
ent = ent,
slot = n,
pos = pos,
bone = b,
apos = {
x = x,
y = y,
z = z
},
arot = {
x = rx or 0,
y = ry or 180,
z = rz or 0
}
}
end
addslot(nil, "Arm_Right", 0, 7, 2, -90, 200, 90)
local function cslot(n, x, y, z)
return addslot(n, "Bandolier", x * 0.8,
0.75 + y * 1.6,
-0.25 + z)
end
cslot(1, 1.75, 0, 0)
cslot(2, -1, 1, 0.05)
cslot(3, 1, 2, 0.1)
cslot(4, -1.75, 3, 0.02)
cslot(5, 1.75, 3, 0.02)
cslot(6, -1, 2, 0.1)
cslot(7, 1, 1, 0.05)
cslot(8, -1.75, 0, 0)
end
-- LUALOCALS < ---------------------------------------------------------
local math, minetest, nodecore
= math, minetest, nodecore
local math_pi
= math.pi
-- LUALOCALS > ---------------------------------------------------------
local function setup(p)
local n = p:get_player_name()
local r = minetest.get_player_privs(n)
r.fly = true
r.fast = true
r.give = true
r.interact = true
r.nc_reative = true
minetest.set_player_privs(n, r)
p:set_pos({x = -112.6, y = 5, z = -92.6})
p:set_look_horizontal(163.8 * math_pi / 180)
p:set_look_vertical(9 * math_pi / 180)
p:hud_set_flags({crosshair = false})
end
nodecore.register_on_joinplayer(setup)
nodecore.register_on_respawnplayer(setup)
depends = nc_api_all
\ No newline at end of file
-- LUALOCALS < ---------------------------------------------------------
local minetest, nodecore, pairs, rawset, type
= minetest, nodecore, pairs, rawset, type
-- LUALOCALS > ---------------------------------------------------------
local function noanim(t)
if type(t) ~= "table" then return t end
if t.animation then
rawset(t.animation, "length", 1000000)
end
for _, v in pairs(t) do noanim(v) end
return t
end
for _, v in pairs(minetest.registered_nodes) do
noanim(v.tiles)
noanim(v.special_tiles)
end
nodecore.register_on_register_item(function(_, def)
noanim(def.tiles)
noanim(def.special_tiles)
end)
depends = nc_api_all
\ No newline at end of file
-- LUALOCALS < ---------------------------------------------------------
local PcgRandom, minetest, nodecore
= PcgRandom, minetest, nodecore
-- LUALOCALS > ---------------------------------------------------------
local modname = minetest.get_current_modname()
local genname = modname .. ":gen"
minetest.register_node(genname, {
description = "Smoke Generator",
inventory_image = "nc_api_craft_smoke.png",
wield_image = "nc_api_craft_smoke.png",
drawtype = "airlike",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
groups = {snappy = 1}
})
nodecore.register_dnt({
name = genname,
nodenames = {genname},
time = 2,
loop = true,
ignore_stasis = true,
action = function(pos)
local pcg = PcgRandom(minetest.hash_node_position(pos))
local rng = function() return pcg:next() / 2 ^ 32 + 0.5 end
for _ = 1, 10 do
local p = {
x = pos.x + rng() - 0.5,
y = pos.y + rng() * 2 - 0.5,
z = pos.z + rng() - 0.5,
}
minetest.add_particle({
pos = p,
texture = "nc_api_craft_smoke.png",
size = rng() * 2 + 1,
expirationtime = 2.1
})
end
end
})
nodecore.register_abm({
label = "smokegen",
nodenames = {genname},
interval = 1,
chance = 1,
ignore_stasis = true,
action = function(pos) return nodecore.dnt_set(pos, genname) end
})
nodecore.register_lbm({
name = genname,
nodenames = {genname},
run_at_every_load = true,
action = function(pos) return nodecore.dnt_reset(pos, genname, 0.01) end
})
depends = nc_api_all
\ No newline at end of file
-- LUALOCALS < ---------------------------------------------------------
local nodecore
= nodecore
-- LUALOCALS > ---------------------------------------------------------
nodecore.stasis = true
depends = nc_api_all
\ No newline at end of file
......@@ -58,7 +58,7 @@ function nodecore.log(level, ...)
return minetest.log(level, ...)
end
nodecore.log("info", nodecore.product .. (nodecore.version and (" Version " .. nodecore.version)
nodecore.log("action", nodecore.product .. (nodecore.version and (" Version " .. nodecore.version)
or " DEVELOPMENT VERSION"))
do
......@@ -70,11 +70,11 @@ do
local t = {}
for k, v in pairs(nodecore) do
if k:sub(1, #reg) == reg and type(v) == "table" and #v > 0 then
t[#t + 1] = k .. ": " .. #v
t[#t + 1] = k:sub(#reg + 1) .. "=" .. #v
end
end
table_sort(t)
for _, x in pairs(t) do nodecore.log("info", x) end
nodecore.log("action", "registered: " .. table_concat(t, " "))
end
minetest.after(0, regreport)
end
......
-- LUALOCALS < ---------------------------------------------------------
local minetest, nodecore
= minetest, nodecore
local minetest, nodecore, vector
= minetest, nodecore, vector
-- LUALOCALS > ---------------------------------------------------------
local lasthit = {}
local function wearfx(puncher, wield)
nodecore.sound_play("nc_api_toolwear",
{object = puncher, gain = 0.5})
local ppos = puncher:get_pos()
if not ppos then return end
ppos.y = ppos.y + puncher:get_properties().eye_height - 0.1
local look = puncher:get_look_dir()
for _ = 1, 3 do
nodecore.digparticles(wield:get_definition(), {
time = 0.05,
amount = 1,
minpos = ppos,
maxpos = ppos,
minvel = vector.add(look, {x = -1, y = -1, z = -1}),
maxvel = vector.add(look, {x = 1, y = 1, z = 1}),
minacc = {x = 0, y = -8, z = 0},
maxacc = {x = 0, y = -8, z = 0},
minexptime = 0.25,
maxexptime = 1
})
end
end
nodecore.register_on_punchnode("node punch sounds", function(pos, node, puncher)
if not nodecore.player_visible(puncher) then return end
......@@ -25,8 +48,7 @@ nodecore.register_on_punchnode("node punch sounds", function(pos, node, puncher)
end
if wield:get_wear() >= (65536 * 0.95) then
nodecore.sound_play("nc_api_toolwear",
{object = puncher, gain = 0.5})
wearfx(puncher, wield)
end
end)
......