Clean up the screenshot mods a bit
- Unify setup and inv mods so they can share some logic - Lock more things when player is standing in the "home" position. - Automatically re-lock player if they return to the "home" position and stay still.
This commit is contained in:
parent
bd4cc715fa
commit
5e0da66653
@ -10,13 +10,12 @@ How To Use:
|
|||||||
minetest worlds are stored.
|
minetest worlds are stored.
|
||||||
- Run `make` in the world dir.
|
- Run `make` in the world dir.
|
||||||
- Enter the world (singleplayer or "host game"; either is fine).
|
- Enter the world (singleplayer or "host game"; either is fine).
|
||||||
- Do NOT move the mouse or any other controls; keep your exact position
|
- Stand still at the position where you first start, and try not to
|
||||||
and looking angle. If you mess up, leave and rejoin.
|
move or press any controls.
|
||||||
- Hide the chat (F2) and wait for on-screen messages to fade.
|
- Hide the chat (F2) and wait for on-screen messages to fade.
|
||||||
- Select the "empty" hotbar slot #6.
|
- Select the "empty" hotbar slot #6.
|
||||||
- Resize your window to the largest size possible, with a ~16:9 or
|
- Resize your window to the largest size possible, with a ~16:9 or
|
||||||
~16:10 aspect ratio.
|
~16:10 aspect ratio.
|
||||||
- Hold the zoom key (and no other key).
|
|
||||||
- Capture an in-game screenshot (F12).
|
- Capture an in-game screenshot (F12).
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
@ -1,73 +0,0 @@
|
|||||||
-- LUALOCALS < ---------------------------------------------------------
|
|
||||||
local ItemStack, minetest, nodecore, pairs, vector
|
|
||||||
= ItemStack, minetest, nodecore, pairs, vector
|
|
||||||
-- LUALOCALS > ---------------------------------------------------------
|
|
||||||
|
|
||||||
local modname = minetest.get_current_modname();
|
|
||||||
|
|
||||||
local setinv = {
|
|
||||||
{"nc_stonework:tool_pick", 1, 0.7},
|
|
||||||
{"nc_stonework:tool_spade", 1, 0.8},
|
|
||||||
{"nc_stonework:tool_hatchet", 1, 0.4},
|
|
||||||
{"nc_stonework:tool_mallet", 1, 0.2},
|
|
||||||
{"nc_stonework:chip", 54},
|
|
||||||
{"air", 1, nil, "[combine:1x1"},
|
|
||||||
{"nc_terrain:sand_loose", 14},
|
|
||||||
{"nc_terrain:dirt_loose", 47}
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, v in pairs(setinv) do
|
|
||||||
local n = modname .. ":" .. v[1]:gsub(":", "_")
|
|
||||||
if not minetest.registered_items[n] then
|
|
||||||
local def = minetest.registered_items[v[1]]
|
|
||||||
minetest.register_item(n, {
|
|
||||||
["type"] = def["type"],
|
|
||||||
tiles = def.tiles,
|
|
||||||
inventory_image = v[4] or def.inventory_image,
|
|
||||||
wield_image = v[4] or def.wield_image,
|
|
||||||
on_drop = function() return ItemStack("") end,
|
|
||||||
on_place = function() end,
|
|
||||||
on_use = function() end
|
|
||||||
})
|
|
||||||
end
|
|
||||||
v[1] = n
|
|
||||||
end
|
|
||||||
|
|
||||||
local startpos = {}
|
|
||||||
local function setup(p)
|
|
||||||
local inv = p:get_inventory()
|
|
||||||
for i, v in pairs(setinv) do
|
|
||||||
if v then
|
|
||||||
local s = ItemStack(v[1])
|
|
||||||
s:set_count(v[2])
|
|
||||||
if v[3] then s:set_wear(65535 * v[3]) end
|
|
||||||
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(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
|
|
||||||
})
|
|
@ -1,2 +0,0 @@
|
|||||||
depends = nc_api_all, nc_terrain, nc_stonework
|
|
||||||
name = mockinv
|
|
@ -15,6 +15,7 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_entity(modname .. ":ent", {
|
minetest.register_entity(modname .. ":ent", {
|
||||||
|
description = "Mannequin",
|
||||||
initial_properties = {
|
initial_properties = {
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
visual_size = {x = 0.9, y = 0.9, z = 0.9},
|
visual_size = {x = 0.9, y = 0.9, z = 0.9},
|
||||||
|
@ -1,12 +1,48 @@
|
|||||||
-- LUALOCALS < ---------------------------------------------------------
|
-- LUALOCALS < ---------------------------------------------------------
|
||||||
local math, minetest, nodecore, pairs
|
local ItemStack, math, minetest, nodecore, pairs, vector
|
||||||
= math, minetest, nodecore, pairs
|
= ItemStack, math, minetest, nodecore, pairs, vector
|
||||||
local math_pi
|
local math_abs, math_pi
|
||||||
= math.pi
|
= math.abs, math.pi
|
||||||
-- LUALOCALS > ---------------------------------------------------------
|
-- LUALOCALS > ---------------------------------------------------------
|
||||||
|
|
||||||
local function setup(p)
|
local modname = minetest.get_current_modname();
|
||||||
local n = p:get_player_name()
|
|
||||||
|
local setinv = {
|
||||||
|
{"nc_stonework:tool_pick", 1, 0.7},
|
||||||
|
{"nc_stonework:tool_spade", 1, 0.8},
|
||||||
|
{"nc_stonework:tool_hatchet", 1, 0.4},
|
||||||
|
{"nc_stonework:tool_mallet", 1, 0.2},
|
||||||
|
{"nc_stonework:chip", 54},
|
||||||
|
{"air", 1, nil, "[combine:1x1"},
|
||||||
|
{"nc_terrain:sand_loose", 14},
|
||||||
|
{"nc_terrain:dirt_loose", 47}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v in pairs(setinv) do
|
||||||
|
local n = modname .. ":" .. v[1]:gsub(":", "_")
|
||||||
|
if not minetest.registered_items[n] then
|
||||||
|
local def = minetest.registered_items[v[1]]
|
||||||
|
minetest.register_item(n, {
|
||||||
|
["type"] = def["type"],
|
||||||
|
tiles = def.tiles,
|
||||||
|
inventory_image = v[4] or def.inventory_image,
|
||||||
|
wield_image = v[4] or def.wield_image,
|
||||||
|
on_drop = function() return ItemStack("") end,
|
||||||
|
on_place = function() end,
|
||||||
|
on_use = function() end
|
||||||
|
})
|
||||||
|
end
|
||||||
|
v[1] = n
|
||||||
|
end
|
||||||
|
|
||||||
|
local startpos = {x = -112.4, y = 4.55, z = -91.8}
|
||||||
|
|
||||||
|
nodecore.register_on_joinplayer(function(player)
|
||||||
|
return player:set_pos(startpos)
|
||||||
|
end)
|
||||||
|
|
||||||
|
local function enable_setup(player, ppos)
|
||||||
|
local n = player:get_player_name()
|
||||||
|
|
||||||
local r = minetest.get_player_privs(n)
|
local r = minetest.get_player_privs(n)
|
||||||
r.fly = true
|
r.fly = true
|
||||||
@ -22,17 +58,51 @@ local function setup(p)
|
|||||||
r.teleport = true
|
r.teleport = true
|
||||||
minetest.set_player_privs(n, r)
|
minetest.set_player_privs(n, r)
|
||||||
|
|
||||||
p:set_pos({x = -112.4, y = 5, z = -91.8})
|
if math_abs(ppos.x - startpos.x) >= 0.001
|
||||||
p:set_look_horizontal(163.8 * math_pi / 180)
|
or math_abs(ppos.z - startpos.z) >= 0.001 then
|
||||||
p:set_look_vertical(9 * math_pi / 180)
|
player:set_pos(startpos)
|
||||||
|
end
|
||||||
|
player:set_look_horizontal(163.8 * math_pi / 180)
|
||||||
|
player:set_look_vertical(9 * math_pi / 180)
|
||||||
|
|
||||||
p:hud_set_flags({crosshair = false})
|
nodecore.hud_set(player, {label = "crosshair", ttl = 0})
|
||||||
end
|
player:set_fov(60)
|
||||||
nodecore.register_on_joinplayer(setup)
|
|
||||||
nodecore.register_on_respawnplayer(setup)
|
|
||||||
|
|
||||||
minetest.register_globalstep(function()
|
local inv = player:get_inventory()
|
||||||
for _, player in pairs(minetest.get_connected_players()) do
|
for i, v in pairs(setinv) do
|
||||||
nodecore.hud_set(player, {label = "cheats", ttl = 0})
|
if v then
|
||||||
|
local s = ItemStack(v[1])
|
||||||
|
s:set_count(v[2])
|
||||||
|
if v[3] then s:set_wear(65535 * v[3]) end
|
||||||
|
inv:set_stack("main", i, s)
|
||||||
end
|
end
|
||||||
end)
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function disable_setup(player)
|
||||||
|
player:set_fov(0, false, 0.25)
|
||||||
|
|
||||||
|
local inv = player: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
|
||||||
|
|
||||||
|
nodecore.register_playerstep({
|
||||||
|
label = "mock hud/fov clear",
|
||||||
|
action = function(player)
|
||||||
|
nodecore.hud_set(player, {label = "cheats", ttl = 0})
|
||||||
|
nodecore.hud_set(player, {label = "hintcomplete", ttl = 0})
|
||||||
|
|
||||||
|
local ppos = player:get_pos()
|
||||||
|
if vector.distance(ppos, startpos) <= 1
|
||||||
|
and player:get_player_control_bits() == 0 then
|
||||||
|
enable_setup(player, ppos)
|
||||||
|
else
|
||||||
|
disable_setup(player)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
depends = nc_api_all
|
depends = nc_api_all, nc_terrain, nc_stonework
|
||||||
name = mocksetup
|
name = mocksetup
|
||||||
|
Loading…
x
Reference in New Issue
Block a user