Comments (5)
@BrunoMine oh, I thought your area would span multiple claim sectors. In this case it's much simpler:
local data, index = s_protect.get_claim({
x = -42,
y = 20,
z = 101
})
data = {
owner = "yourname",
shared = {}
}
s_protect.set_claim(data, index)
from simple_protection.
Untested
local minp = {x = -100, y = -20, z = 80} -- area start (world coordiantes)
local maxp = {x = 250, y = 120, z = 200} -- area end (world coordiantes)
-- Ensure the loop reaches all mapblocks
local _
minp, _ = s_protect.get_area_bounds(minp)
_, maxp = s_protect.get_area_bounds(maxp)
-- Iterate through the entire volume
local update_table = {}
for z = minp.z, maxp.z, s_protect.claim_size do
for y = minp.y, maxp.y, s_protect.claim_height do
for x = minp.x, maxp.x, s_protect.claim_size do
local data, index = s_protect.get_claim({
x = x,
y = y,
z = z
})
data = {
owner = "yourname",
shared = {}
}
update_table[index] = data
end
end
end
s_protect.update_claims(update_table)
minetest.log("action", "Protected an area spanning from "
.. minetest.pos_to_string(minp) .. " to "
.. minetest.pos_to_string(maxp))
from simple_protection.
I do not want to protect a custom area.
I want to claim a normal block like a common player, but for internal use.
from simple_protection.
Here are two examples to help you understand what I need.
-- Checks the square where the pos coordinate is inserted.
local minp, maxp = get_square_coordinates(pos)
-- Claim the square for internal use of the mod
protect_this_square("mymod:a_protected_square", minp, maxp)
from simple_protection.
Thank you!
from simple_protection.
Related Issues (20)
- Formspec GUI HOT 4
- Maximum number of claims HOT 7
- s_protect.claim_to_dig = true -> server crash HOT 1
- Support parallel running protection mods HOT 5
- Text-like map of surrounding areas HOT 10
- Use mod storage HOT 2
- Shared chests HOT 1
- Use sqlite storage HOT 1
- API Documentation HOT 7
- not all the commands / areas worm in the chat window HOT 1
- List of mods that have player grouping features HOT 2
- Move files to a separate folder HOT 2
- Add Mineclone 2 Compatibility HOT 1
- A bit confusing HOT 12
- Can't Check if a Node is in Area Protected by Player Name HOT 2
- /area shareall command not working as intended HOT 1
- Improve Area HUD to show unclaimed areas
- [Q]: How do we handle Spawn? HOT 1
- breaks tnt on entire world HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simple_protection.