Imported from trollstream "ContentDB"

master
OldCoder 2022-09-04 22:03:37 -07:00
commit 033e85d534
9 changed files with 150 additions and 0 deletions

21
LICENSE.txt Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 ymte
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

BIN
__MACOSX/._LICENSE.txt Normal file

Binary file not shown.

BIN
__MACOSX/._depends.txt Normal file

Binary file not shown.

BIN
__MACOSX/._init.lua Normal file

Binary file not shown.

BIN
__MACOSX/._mod.conf Normal file

Binary file not shown.

1
depends.txt Normal file
View File

@ -0,0 +1 @@
mcl_init

119
init.lua Normal file
View File

@ -0,0 +1,119 @@
local minx, minz, maxx, maxz
local border_name = "mcl_core:obsidian"
local border_built = false
function build_border()
if border_built then return end
border_built = true
-- place border
for dx=-1,16 do
local x = minx + dx
do
local z = maxz + 1
local y = minetest.get_spawn_level(x,z)
if y then
y = y - 2
minetest.set_node({x=x, y=y, z=z}, {name=border_name})
else
border_built = false
end
end
do
local z = minz - 1
local y = minetest.get_spawn_level(x,z)
if y then
y = y - 2
minetest.set_node({x=x, y=y, z=z}, {name=border_name})
else
border_built = false
end
end
end
for dz=-1,16 do
local z = minz + dz
do
local x = maxx + 1
local y = minetest.get_spawn_level(x,z)
if y then
y = y - 2
minetest.set_node({x=x, y=y, z=z}, {name=border_name})
else
border_built = false
end
end
do
local x = minx - 1
local y = minetest.get_spawn_level(x,z)
if y then
y = y - 2
minetest.set_node({x=x, y=y, z=z}, {name=border_name})
else
border_built = false
end
end
end
end
function gegenereerd()
if not minx or border_built then
return
end
build_border()
end
function join(player)
local startpos = player:get_pos()
if not minx then
minx = math.floor(startpos.x / 16) * 16
minz = math.floor(startpos.z / 16) * 16
maxx = minx + 15
maxz = minz + 15
build_border()
end
end
function mag(pos)
if pos.x < minx then return false end
if pos.z < minz then return false end
if pos.x > maxx then return false end
if pos.z > maxz then return false end
return true
end
function inhoude(dtime)
local players = minetest.get_connected_players()
for _, player in pairs(players) do
local pos = player:get_pos()
if not mag(pos) then
if pos.x < minx then pos.x = minx end
if pos.z < minz then pos.z = minz end
if pos.x > maxx then pos.x = maxx end
if pos.z > maxz then pos.z = maxz end
player:set_pos(pos)
end
end
end
function place(pos, newnode, placer, oldnode, stemstack, pointed_thing)
if not mag(pos) then
minetest.set_node(pos, oldnode)
return true
else
return false
end
end
function dig(pos, oldnode, digger)
if not mag(pos) then
minetest.set_node(pos, oldnode)
end
end
minetest.register_on_generated(gegenereerd)
minetest.register_globalstep(inhoude)
minetest.register_on_joinplayer(join)
minetest.register_on_placenode(place)
minetest.register_on_dignode(dig)

9
mod.conf Normal file
View File

@ -0,0 +1,9 @@
name = spawn_chunk
title = Spawn Chunk
description = Limits the player and its actions to the spawn chunk. Works only for MineClone. Credits to MineClone 5 for the screenshot.
author = ymte
license = LICENSE.txt
forum = https://content.minetest.net/threads/2775/
version = 1.0-RC3
depends = mcl_init
optional_depends =

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 KiB