added in the command to create a node,satisfied SP

master
Samarth Ramesh 2020-08-14 12:47:39 +05:30
parent 8651da61d7
commit 945cb2f5a3
3 changed files with 700 additions and 691 deletions

1348
LICENSE

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +1,25 @@
local storage = minetest.get_mod_storage()
print("[spacer] loaded")
minetest.register_chatcommand("space", {
description = "adds a node under a player, if they are 1) In space \n2) NOT in a protected area \n3)have not used it in the last 15 seconds",
func = function(name)
local player = minetest.get_player_by_name(name)
local pos = player:get_pos()
if pos["y"]>=20000 then
print("yay")
minetest.add_node(pos, "air")
else
print("feck off")
end
end
local storage = minetest.get_mod_storage()
local maxTimes = 6-- maximum times -1 the command space can be used on one loading of the mod
print("[spacer] loaded")
local numTimes= {}
minetest.register_chatcommand("space", {
description = "adds a node under a player, if they are 1) In space \n2) NOT in a protected area \n3)have not used it in the last 15 seconds",
func = function(name)
local player = minetest.get_player_by_name(name)
local pos = player:get_pos()
local area= areas:getAreasAtPos(pos)
local numAreas= 0
for k in pairs(area) do
numAreas=numAreas+1 -- gets no of areas at pos
end
if (pos["y"]>=20000 and numAreas==0 and ((not numTimes[name]) or numTimes[name] >= maxTimes) ) then
minetest.set_node(pos, {name="default:dirt"})
numTimes[name]=(numTimes[name]or 0) +1
print(numTimes[name])
else
print("hey you idiot get out of a protected place/goto space")
end
end
})

View File

@ -1,3 +1,3 @@
name = spacer
descriptions = adds a node under a person, if they are in space, and not in a protected are, upto 5 times, with a resettable counter.
name = spacer
descriptions = adds a node under a person, if they are in space, and not in a protected are, upto 5 times, with a resettable counter.
depends = areas,default