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.
|
||||
- Run `make` in the world dir.
|
||||
- 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.
|
||||
- Stand still at the position where you first start, and try not to
|
||||
move or press any controls.
|
||||
- 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).
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
@ -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
|
||||
|
||||
minetest.register_entity(modname .. ":ent", {
|
||||
description = "Mannequin",
|
||||
initial_properties = {
|
||||
visual = "mesh",
|
||||
visual_size = {x = 0.9, y = 0.9, z = 0.9},
|
||||
|
@ -1,12 +1,48 @@
|
||||
-- LUALOCALS < ---------------------------------------------------------
|
||||
local math, minetest, nodecore, pairs
|
||||
= math, minetest, nodecore, pairs
|
||||
local math_pi
|
||||
= math.pi
|
||||
local ItemStack, math, minetest, nodecore, pairs, vector
|
||||
= ItemStack, math, minetest, nodecore, pairs, vector
|
||||
local math_abs, math_pi
|
||||
= math.abs, math.pi
|
||||
-- LUALOCALS > ---------------------------------------------------------
|
||||
|
||||
local function setup(p)
|
||||
local n = p:get_player_name()
|
||||
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 = {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)
|
||||
r.fly = true
|
||||
@ -22,17 +58,51 @@ local function setup(p)
|
||||
r.teleport = true
|
||||
minetest.set_player_privs(n, r)
|
||||
|
||||
p:set_pos({x = -112.4, y = 5, z = -91.8})
|
||||
p:set_look_horizontal(163.8 * math_pi / 180)
|
||||
p:set_look_vertical(9 * math_pi / 180)
|
||||
if math_abs(ppos.x - startpos.x) >= 0.001
|
||||
or math_abs(ppos.z - startpos.z) >= 0.001 then
|
||||
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})
|
||||
end
|
||||
nodecore.register_on_joinplayer(setup)
|
||||
nodecore.register_on_respawnplayer(setup)
|
||||
nodecore.hud_set(player, {label = "crosshair", ttl = 0})
|
||||
player:set_fov(60)
|
||||
|
||||
minetest.register_globalstep(function()
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
nodecore.hud_set(player, {label = "cheats", ttl = 0})
|
||||
local inv = player: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)
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user