lol you lost me even moreVanessaE wrote:Most elementary way I can think of: ...
lol you lost me even moreVanessaE wrote:Most elementary way I can think of: ...
tinoesroho wrote:Before you contributed 3d models to Simple Mobs, it made use of 2D Mobs. The repo's here. Take a look at the earlier revisions with the 2D mobs; I don't think there are too many limitations.
EDIT:
You might also want to look at how the torch animation is done. If you can unite the two techniques, the world'll be a better place.

tree={
axiom="A-T-TA-T-TA",
rules_a="A+TA-T-TA+TA",
trunk="default:tree",
leaves="default:leaves",
angle=60,
iterations=2,
random_level=0,
trunk_type="single",
thin_branches=true,
fruit_chance=10,
fruit="default:apple"
}
minetest.register_craftitem("tree:spawner", {
description = "Treespawner",
inventory_image = "default_stick.png",
on_use = function(itemstack, user, pointed_thing)
local pos = pointed_thing.under
minetest.spawn_tree(pos,tree)
print("[tree] New tree at "..pos.x..", "..pos.y..", "..pos.z.."")
end
})

hilbert = {
angle = 90,
iterations = 6,
axiom = "X",
constants = "XY",
rules = {
X="-YFF+XFFX+FFY-",
Y="+XFF-YFFY-FFX+"
},
materials = { "wool:cyan" }
}
sierp = {
angle = 120,
iterations = 6,
axiom = "f-g-g",
rules = {
f = "f-g+f+g-f",
g = "gg"
},
materials = {"wool:red"}
}
penrose = {
angle = 36,
iterations = 5,
constants="6789",
axiom="[7]++[7]++[7]++[7]++[7]",
rules={
["6"]="81++91----71[-81----61]++",
["7"]="+81--91[---61--71]+",
["8"]="-61++71[+++81++91]-",
["9"]="--81++++61[+91++++71]--71",
["1"]="",
},
scale=12,
materials = {"wool:yellow"}
}
lsystem = {}
local matrix = {}
local x = { x=1, y=0, z=0 }
local y = { x=0, y=1, z=0 }
local z = { x=0, y=0, z=1 }
local round = function(n)
return math.floor(n+0.5)
end
function lsystem.lproc(def)
local axiom = def.axiom--""
local tmp = ""
for i=1, def.iterations do
if i==1 then
axiom = def.axiom
else
axiom = tmp
end
tmp = ""
for c in axiom:gmatch(".") do
local rule = def.rules[c] or c
tmp = tmp..rule
end
end
return tmp
end
lsystem.spawn = function (pos, def)
local min = { x = pos.x, y = pos.y, z = pos.z }
local max = { x = pos.x, y = pos.y, z = pos.z }
local nodes = {}
local materials = {}
for _, mat in pairs(def.materials) do
table.insert( materials, minetest.get_content_id(mat) )
end
local tmp = matrix.new()
local rot = matrix.orient(tmp, math.pi/2, z )
local pos = vector.new(pos)
local mat = 1
local stk = {}
local axiom = lsystem.lproc(def)
print(axiom)
local axpos = 1
for c in axiom:gmatch"." do
if c == "[" then
table.insert(stk, { rot=rot, pos=pos } )
elseif c == "]" then
local s = table.remove(stk)
rot = s.rot
pos = s.pos
elseif c == "+" then
tmp = matrix.id()
tmp = matrix.orient(tmp, def.angle*math.pi/180, y)
rot = matrix.mul(tmp, rot)
elseif c == "-" then
tmp = matrix.id()
tmp = matrix.orient(tmp, -def.angle*math.pi/180, y)
rot = matrix.mul(tmp, rot)
elseif c == "&" then
tmp = matrix.id()
tmp = matrix.orient(tmp, def.angle*math.pi/180, z)
rot = matrix.mul(tmp, rot)
elseif c == "^" then
tmp = matrix.id()
tmp = matrix.orient(tmp, -def.angle*math.pi/180, z)
rot = matrix.mul(tmp, rot)
elseif c == "/" then
tmp = matrix.id()
tmp = matrix.orient(tmp, def.angle*math.pi/180, x)
rot = matrix.mul(tmp, rot)
elseif c == "*" then
tmp = matrix.id()
tmp = matrix.orient(tmp, -def.angle*math.pi/180, x)
rot = matrix.mul(tmp, rot)
elseif c == "C" then
mat = tonumber(axiom:sub(axpos+1, axpos+1))
elseif not string.match(def.constants or "", c) then
for i=1, def.scale or 1 do
if pos.x < min.x then min.x = pos.x end
if pos.y < min.y then min.y = pos.y end
if pos.z < min.z then min.z = pos.z end
if pos.x > max.x then max.x = pos.x end
if pos.y > max.y then max.y = pos.y end
if pos.z > max.z then max.z = pos.z end
local rpos = { x=round(pos.x), y=round(pos.y), z=round(pos.z)}
table.insert(nodes, { pos=rpos, mat=materials[mat] } )
pos = pos + matrix.transpose(rot, x)
end
end
axpos = axpos+1
end
local vm = VoxelManip()
min, max = vm:read_from_map(min, max)
local area = VoxelArea:new{ MinEdge = min, MaxEdge = max }
local data = vm:get_data()
for _, node in pairs(nodes) do
local index = area:indexp(node.pos)
data[index] = node.mat
end
vm:set_data(data)
vm:write_to_map()
vm:update_map()
print(string.format("placed %i nodes", #nodes))
end
minetest.register_tool("lsystem:ltool", {
description = "lsystem spawner",
inventory_image = "default_stick.png",
on_use = function(itemstack, user, pointed_thing)
local t1 = os.clock()
local pos = pointed_thing.above
if not pos then return end
lsystem.spawn(pos, penrose)
local time = (os.clock() - t1) * 1000
print(string.format("elapsed time: %.2fms", time))
end
})
matrix.new = function()
local m = {}
for i = 1,4 do m[i] = {}
for j = 1,4 do m[i][j] = 0
end
end
return m
end
matrix.id = function()
local m = {}
for i = 1, 4 do m[i] = {}
for j = 1, 4 do
if i == j then
m[i][j] = 1
else
m[i][j] = 0
end
end
end
return m
end
matrix.mul = function(m1, m2)
local m = {}
for i = 1, 4 do m[i] = {}
for j = 1, 4 do
local num = 0
for n = 1, 4 do
num = num + m1[i][n] * m2[n][j]
end
m[i][j] = num
end
end
return m
end
matrix.orient = function(m, angle, axis)
local c = math.cos(angle)
local s = math.sin(angle)
local t = 1.0 - c
local tx = t * axis.x
local ty = t * axis.y
local tz = t * axis.z
local sx = s * axis.x
local sy = s * axis.y
local sz = s * axis.z
m[1][1] = tx * axis.x + c
m[1][2] = tx * axis.y + sz
m[1][3] = tx * axis.z - sy
m[2][1] = ty * axis.x - sz
m[2][2] = ty * axis.y + c
m[2][3] = ty * axis.z + sx
m[3][1] = tz * axis.x + sy
m[3][2] = tz * axis.y - sx
m[3][3] = tz * axis.z + c
return m
end
matrix.transpose = function (m, v)
local x = m[1][1] * v.x + m[2][1] * v.y + m[3][1] * v.z + m[4][1]
local y = m[1][2] * v.x + m[2][2] * v.y + m[3][2] * v.z + m[4][2]
local z = m[1][3] * v.x + m[2][3] * v.y + m[3][3] * v.z + m[4][3]
return vector.new(x,y,z)
end
Chinchow wrote:Is it possible to restrict an object so it can only be crafted by a certain surface for example
{}{}{} {}
thats the area but as you can see you could craft with the normal craft is there a way to stop that?
Aqua wrote:Chinchow wrote:Is it possible to restrict an object so it can only be crafted by a certain surface for example
{}{}{} {}
thats the area but as you can see you could craft with the normal craft is there a way to stop that?
Umm. Can you explain clearer?
Chinchow wrote:Aqua wrote:Chinchow wrote:Is it possible to restrict an object so it can only be crafted by a certain surface for example
{}{}{} {}
thats the area but as you can see you could craft with the normal craft is there a way to stop that?
Umm. Can you explain clearer?
Imagine the area I just showed
[] [] [] []
is the crafting area made with a special block
NNow objects crafted with this could also be made with the normal craft area
II would like to restrict certain objects so they can only be crafted with this.
minetest.register_abm({
nodenames = {"group:plant_wheat"},
neighbors = {"group:soil"},
interval = 90,
chance = 2,
action = function(pos, node)
-- return if already full grown
if minetest.get_item_group(node.name, "plant_wheat") == 8 then
return
end
Chinchow wrote:As you can see this code is merely the farming growth abm changed a little however when I run the mod it is because of the end portion it won't run. Does anyone know why?
minetest.register_abm({
nodenames = {"group:plant_wheat"},
neighbors = {"group:soil"},
interval = 90,
chance = 2,
action = function(pos, node)
-- return if already full grown
if minetest.get_item_group(node.name, "plant_wheat") == 8 then
return
end
end
aleksix wrote:Is it possible to generate nodes on the fly?
ElectricSolstice wrote:What dimensions are the chunks in minetest? (length, width, and height)
Nore wrote:aleksix wrote:Is it possible to generate nodes on the fly?
Yes, but they won't be visible on the client until it is disconnected and connected again (on a server)ElectricSolstice wrote:What dimensions are the chunks in minetest? (length, width, and height)
There are the blocks, which are 16x16x16 nodes, and the chunks (used for mapgen), which are 5x5x5 blocks.
Nore wrote:aleksix wrote:Is it possible to generate nodes on the fly?
Yes, but they won't be visible on the client until it is disconnected and connected again (on a server)
derpswa99 wrote:how do you use the range for tools thing
range = 10,Evergreen wrote:derpswa99 wrote:how do you use the range for tools thing
Just put this into the tool definition. (replace 10 with whatever range you want)Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
range = 10,
Evergreen wrote:derpswa99 wrote:how do you use the range for tools thing
Just put this into the tool definition. (replace 10 with whatever range you want)Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
range = 10,
Fine, if you say so. (You should know what things to replace in this code)derpswa99 wrote:Evergreen wrote:derpswa99 wrote:how do you use the range for tools thing
Just put this into the tool definition. (replace 10 with whatever range you want)Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
range = 10,
Sorry, but can I get an example
minetest.register_tool("default:pick_stone", {
description = "Stone Pickaxe",
inventory_image = "default_tool_stonepick.png",
range = 3,
tool_capabilities = {
full_punch_interval = 1.3,
max_drop_level=0,
groupcaps={
cracky = {times={[2]=2.0, [3]=1.20}, uses=20, maxlevel=1},
},
damage_groups = {fleshy=3},
},
})
minetest.register_tool("meteor:meteor_laser", {
description = "Meteor Laser Gun",
inventory_image = "meteor_tool_laser.png",
range = 15,
tool_capabilities = {
full_punch_interval = 0.1,
max_drop_level=1,
groupcaps={
cracky = {times={[1]=0.03, [2]=0.02, [3]=0.01}, uses=1000, maxlevel=1},
},
damage_groups = {fleshy=10},
},
})*sigh* Please post the full error from debug.txt. Also, please use the "code" tags instead of plain text.derpswa99 wrote:It doesnt work is there an error in my code becuse it's not working
here's the code, please post any problem you see
minetest.register_tool("meteor:meteor_laser", {
description = "Meteor Laser Gun",
inventory_image = "meteor_tool_laser.png",
range = 15,
tool_capabilities = {
full_punch_interval = 0.1,
max_drop_level=1,
groupcaps={
cracky = {times={[1]=0.03, [2]=0.02, [3]=0.01}, uses=1000, maxlevel=1},
},
damage_groups = {fleshy=10},
},
})
for c=1,2,3,4,5,6,7,8 dofor c=1,8 doEvergreen wrote:derpswa99 wrote:how do you use the range for tools thing
Just put this into the tool definition. (replace 10 with whatever range you want)Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
range = 10,
Users browsing this forum: No registered users and 6 guests