aww yiss, freaking entity torches (right click them to give them a mesh

master
Jordach 2015-01-03 15:20:01 +00:00
parent 0fad664199
commit d2c5fe1be0
13 changed files with 120 additions and 15 deletions

View File

@ -169,20 +169,16 @@ end
minetest.register_node("deco:torch", {
description = "Torch",
drawtype = "torchlike",
tiles = {
{name="deco_torch_floor.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}},
{name="deco_torch_ceiling.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}},
{name="deco_torch.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}
},
inventory_image = "deco_torch_wield.png",
wield_image = "deco_torch_wield.png",
drawtype = "airlike",
tiles = {"xfences_space.png"},
inventory_image = "deco_torch_ng_wield.png",
wield_image = "deco_torch_ng_wield.png",
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
is_ground_content = false,
walkable = false,
light_source = 13,
light_source = 15,
selection_box = {
type = "wallmounted",
wall_top = {-0.1, 0.5-0.6, -0.1, 0.1, 0.5, 0.1},
@ -192,6 +188,98 @@ minetest.register_node("deco:torch", {
groups = {choppy=2,dig_immediate=3,flammable=1,attached_node=1,hot=2},
legacy_wallmounted = true,
sounds = default.node_sound_defaults(),
after_place_node = function(pos, placer)
--print (minetest.get_node(pos).param2)
local entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
if entity_remove[1] == nil then
if minetest.get_node(pos).param2 == 4 then --done
--list of rad to 90 degree: 3.142/2 = 90; 3.142 = 180; 3*3.142 = 270
minetest.add_entity({x=pos.x, y=pos.y, z=pos.z}, "deco:mesh_torch_w") --+(0.0625*10)
entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
entity_remove[1]:setyaw(3.142)
elseif minetest.get_node(pos).param2 == 2 then --done
minetest.add_entity({x=pos.x, y=pos.y, z=pos.z}, "deco:mesh_torch_w") --+(0.0625*10)
entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
entity_remove[1]:setyaw(3.142/2)
elseif minetest.get_node(pos).param2 == 3 then -- done
minetest.add_entity({x=pos.x, y=pos.y, z=pos.z}, "deco:mesh_torch_w") --+(0.0625*10)
entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
entity_remove[1]:setyaw(-3.142/2)
elseif minetest.get_node(pos).param2 == 5 then --done
minetest.add_entity({x=pos.x, y=pos.y, z=pos.z}, "deco:mesh_torch_w") --+(0.0625*10)
entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
entity_remove[1]:setyaw(0)
elseif minetest.get_node(pos).param2 == 0 then
minetest.add_entity({x=pos.x, y=pos.y, z=pos.z}, "deco:mesh_torch_c") --+(0.0625*10)
entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
entity_remove[1]:setyaw(0)
else
minetest.add_entity({x=pos.x, y=pos.y, z=pos.z}, "deco:mesh_torch_f") --+(0.0625*10)
entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
entity_remove[1]:setyaw(0)
end
end
end,
on_rightclick = function(pos, node)
local entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
if entity_remove[1] == nil then
if minetest.get_node(pos).param2 == 4 then --done
--list of rad to 90 degree: 3.142/2 = 90; 3.142 = 180; 3*3.142 = 270
minetest.add_entity({x=pos.x, y=pos.y, z=pos.z}, "deco:mesh_torch_w") --+(0.0625*10)
entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
entity_remove[1]:setyaw(3.142)
elseif minetest.get_node(pos).param2 == 2 then --done
minetest.add_entity({x=pos.x, y=pos.y, z=pos.z}, "deco:mesh_torch_w") --+(0.0625*10)
entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
entity_remove[1]:setyaw(3.142/2)
elseif minetest.get_node(pos).param2 == 3 then -- done
minetest.add_entity({x=pos.x, y=pos.y, z=pos.z}, "deco:mesh_torch_w") --+(0.0625*10)
entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
entity_remove[1]:setyaw(-3.142/2)
elseif minetest.get_node(pos).param2 == 5 then --done
minetest.add_entity({x=pos.x, y=pos.y, z=pos.z}, "deco:mesh_torch_w") --+(0.0625*10)
entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
entity_remove[1]:setyaw(0)
elseif minetest.get_node(pos).param2 == 0 then
minetest.add_entity({x=pos.x, y=pos.y, z=pos.z}, "deco:mesh_torch_c") --+(0.0625*10)
entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
entity_remove[1]:setyaw(0)
else
minetest.add_entity({x=pos.x, y=pos.y, z=pos.z}, "deco:mesh_torch_f") --+(0.0625*10)
entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
entity_remove[1]:setyaw(0)
end
end
end,
after_dig_node = function(pos)
local entity_remove = minetest.get_objects_inside_radius(pos, 0.1)
entity_remove[1]:remove()
end,
})
minetest.register_entity("deco:mesh_torch_f", {
collisionbox = { 0, 0, 0, 0, 0, 0 },
visual = "mesh",
mesh = "TorchNG_Floor.b3d",
textures = {"deco_torch_ng.png"},
visual_size = {x=20, y=20},
})
minetest.register_entity("deco:mesh_torch_c", {
collisionbox = { 0, 0, 0, 0, 0, 0 },
visual = "mesh",
mesh = "TorchNG_Ceiling.b3d",
textures = {"deco_torch_ng.png"},
visual_size = {x=20, y=20},
})
minetest.register_entity("deco:mesh_torch_w", {
collisionbox = { 0, 0, 0, 0, 0, 0 },
visual = "mesh",
mesh = "TorchNG_Wall.b3d",
textures = {"deco_torch_ng.png"},
visual_size = {x=20, y=20},
})
minetest.register_craft({

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 B

View File

@ -436,7 +436,7 @@ minetest.register_decoration({
sidelen = 8,
fill_ratio = 0.047,
decoration = {"mapgen:long_grass_1", "mapgen:long_grass_2", "mapgen:long_grass_3", "mapgen:long_grass_4", "mapgen:long_grass_5"},
biomes = {"grassy_plains"},
biomes = {"grassy_plains", "v6_forest"},
height = 1,
})
@ -488,7 +488,7 @@ minetest.register_decoration({
schematic = minetest.get_modpath("mapgen").."/schematics/mapgen_oak_tree.mts",
sidelen = 8,
fill_ratio = 0.034,
biomes = {"oak_forest", "floral_oak_forest", "floral_oakg_forest"},
biomes = {"oak_forest", "floral_oak_forest", "floral_oakg_forest", "v6_forest"},
flags = "place_center_x, place_center_z",
replacements = {["base:leaves"] = "mapgen:oak_leaves", ["base:tree"] = "mapgen:oak_log_tree", ["base:dirt"] = "mapgen:dirt"},
})
@ -499,7 +499,7 @@ minetest.register_decoration({
schematic = minetest.get_modpath("mapgen").."/schematics/mapgen_oak_tree.mts",
sidelen = 8,
fill_ratio = 0.034,
biomes = {"cherry_blossom_forest"},
biomes = {"cherry_blossom_forest", "v6_forest"},
flags = "place_center_x, place_center_z",
replacements = {["base:leaves"] = "mapgen:cherry_blossom_leaves", ["base:tree"] = "mapgen:cherry_tree", ["base:dirt"] = "mapgen:dirt"},
})
@ -521,7 +521,7 @@ minetest.register_decoration({
schematic = minetest.get_modpath("mapgen").."/schematics/mapgen_evergreen.mts",
sidelen = 8,
fill_ratio = 0.061,
biomes = {"evergreens_forest"},
biomes = {"evergreens_forest", "v6_forest"},
flags = "place_center_x, place_center_z",
replacements = {["base:leaves"] = "mapgen:evergreen_leaves", ["base:tree"] = "mapgen:evergreen_tree", ["base:dirt"] = "mapgen:dirt"},
})
@ -541,7 +541,7 @@ minetest.register_decoration({
place_on = {"mapgen:edens_grass", "mapgen:grass"},
sidelen = 8,
fill_ratio = 0.08,
biomes = {"edens_garden", "floral_plains", "floral_oak_forest", "floral_oakg_forest", "cherry_blossom_forest_floral", "birch_forest_floral"},
biomes = {"edens_garden", "floral_plains", "floral_oak_forest", "floral_oakg_forest", "cherry_blossom_forest_floral", "birch_forest_floral", "v6_forest"},
height = 1,
decoration = {"flowers:dandelion_white", "flowers:dandelion_yellow", "flowers:geranium", "flowers:rose", "flowers:tulip", "flowers:viola", "mapgen:long_grass_1", "mapgen:long_grass_2", "mapgen:long_grass_3", "mapgen:long_grass_4", "mapgen:long_grass_5"},
})
@ -552,7 +552,7 @@ minetest.register_decoration({
schematic = minetest.get_modpath("mapgen").."/schematics/mapgen_oak_tree.mts",
sidelen = 8,
fill_ratio = 0.030,
biomes = {"birch_forest", "birch_forest_floral", "birch_forest_grassy"},
biomes = {"birch_forest", "birch_forest_floral", "birch_forest_grassy", "v6_forest"},
flags = "place_center_x, place_center_z",
replacements = {["base:leaves"] = "mapgen:birch_leaves", ["base:tree"] = "mapgen:birch_tree", ["base:dirt"] = "mapgen:dirt"},
})
@ -623,4 +623,21 @@ minetest.register_ore({
clust_size = 4,
height_max = 16385,
height_min = -16385,
})
-- V6 styled biome
minetest.register_biome({
name = "v6_forest",
node_top = "mapgen:grass",
depth_top = 1,
node_filler = "mapgen:dirt",
depth_filler = 4,
node_dust = "air",
node_underwater = "mapgen:dirt",
y_min = -31000,
y_max = 31000,
node_shore_filler = "mapgen:sand",
heat_point = 35,
humidity_point = 55,
})