Compare commits
45 Commits
0.4.dev-20
...
0.4.dev-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e06d4555bf | ||
|
|
abd106bacb | ||
|
|
008de2fb8f | ||
|
|
2e67fa3e48 | ||
|
|
ea36951bc4 | ||
|
|
09c48b60bd | ||
|
|
4cc117ddf6 | ||
|
|
ceaf8edade | ||
|
|
520200d597 | ||
|
|
ab67985d21 | ||
|
|
bc5cc638fc | ||
|
|
bff8be8b76 | ||
|
|
3e95b8a158 | ||
|
|
e8539d4dae | ||
|
|
1907b31da7 | ||
|
|
6145a135bd | ||
|
|
97c3bc408b | ||
|
|
a00e908f52 | ||
|
|
4ad8891e05 | ||
|
|
2b8b2a4f30 | ||
|
|
5c24450e54 | ||
|
|
3a689a5c4f | ||
|
|
44e36d9aad | ||
|
|
62f7f72d20 | ||
|
|
829c632511 | ||
|
|
8730dfb1f9 | ||
|
|
6764365994 | ||
|
|
8addbc9655 | ||
|
|
658d1a7235 | ||
|
|
4b00d4d9d2 | ||
|
|
6a5829788e | ||
|
|
03074cd23e | ||
|
|
2620e8eada | ||
|
|
9b5e676ffa | ||
|
|
fd1ef11617 | ||
|
|
9fa567a6ce | ||
|
|
fc6c00cbe1 | ||
|
|
66f90a6101 | ||
|
|
1fe5c58d56 | ||
|
|
f23616acaf | ||
|
|
7d37913ea4 | ||
|
|
ac56053c74 | ||
|
|
d566ffaa5f | ||
|
|
d06d7cb9a4 | ||
|
|
e494b5d422 |
@@ -10,7 +10,7 @@ project(minetest)
|
||||
# Also remember to set PROTOCOL_VERSION in clientserver.h when releasing
|
||||
set(VERSION_MAJOR 0)
|
||||
set(VERSION_MINOR 4)
|
||||
set(VERSION_PATCH dev-20111203-3)
|
||||
set(VERSION_PATCH dev-20111209-1)
|
||||
set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
||||
|
||||
MESSAGE(STATUS "*** Will build version ${VERSION_STRING} ***")
|
||||
|
||||
@@ -97,7 +97,6 @@ minetest.register_nodedef_defaults({
|
||||
post_effect_color = {a=0, r=0, g=0, b=0},
|
||||
paramtype = "none",
|
||||
is_ground_content = false,
|
||||
light_propagates = false,
|
||||
sunlight_propagates = false,
|
||||
walkable = true,
|
||||
pointable = true,
|
||||
@@ -133,7 +132,6 @@ minetest.register_nodedef_defaults({
|
||||
minetest.register_node("air", {
|
||||
drawtype = "airlike",
|
||||
paramtype = "light",
|
||||
light_propagates = true,
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
@@ -145,7 +143,6 @@ minetest.register_node("air", {
|
||||
minetest.register_node("ignore", {
|
||||
drawtype = "airlike",
|
||||
paramtype = "none",
|
||||
light_propagates = false,
|
||||
sunlight_propagates = false,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
@@ -340,6 +337,77 @@ minetest.craftitem_eat = function(hp_change)
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
-- Default material types
|
||||
--
|
||||
|
||||
function minetest.digprop_constanttime(time)
|
||||
return {
|
||||
diggability = "constant",
|
||||
constant_time = time,
|
||||
}
|
||||
end
|
||||
|
||||
function minetest.digprop_stonelike(toughness)
|
||||
return {
|
||||
diggablity = "normal",
|
||||
weight = toughness * 5,
|
||||
crackiness = 1,
|
||||
crumbliness = -0.1,
|
||||
cuttability = -0.2,
|
||||
}
|
||||
end
|
||||
|
||||
function minetest.digprop_dirtlike(toughness)
|
||||
return {
|
||||
diggablity = "normal",
|
||||
weight = toughness * 1.2,
|
||||
crackiness = 0,
|
||||
crumbliness = 1.2,
|
||||
cuttability = -0.4,
|
||||
}
|
||||
end
|
||||
|
||||
function minetest.digprop_gravellike(toughness)
|
||||
return {
|
||||
diggablity = "normal",
|
||||
weight = toughness * 2,
|
||||
crackiness = 0.2,
|
||||
crumbliness = 1.5,
|
||||
cuttability = -1.0,
|
||||
}
|
||||
end
|
||||
|
||||
function minetest.digprop_woodlike(toughness)
|
||||
return {
|
||||
diggablity = "normal",
|
||||
weight = toughness * 1.0,
|
||||
crackiness = 0.75,
|
||||
crumbliness = -1.0,
|
||||
cuttability = 1.5,
|
||||
}
|
||||
end
|
||||
|
||||
function minetest.digprop_leaveslike(toughness)
|
||||
return {
|
||||
diggablity = "normal",
|
||||
weight = toughness * (-0.5),
|
||||
crackiness = 0,
|
||||
crumbliness = 0,
|
||||
cuttability = 2.0,
|
||||
}
|
||||
end
|
||||
|
||||
function minetest.digprop_glasslike(toughness)
|
||||
return {
|
||||
diggablity = "normal",
|
||||
weight = toughness * 0.1,
|
||||
crackiness = 2.0,
|
||||
crumbliness = -1.0,
|
||||
cuttability = -1.0,
|
||||
}
|
||||
end
|
||||
|
||||
--
|
||||
-- Creative inventory
|
||||
--
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
-- bucket (Minetest 0.4 mod)
|
||||
-- A bucket, which can pick up water and lava
|
||||
|
||||
minetest.alias_craftitem("bucket", "bucket:bucket_empty")
|
||||
minetest.alias_craftitem("bucket_water", "bucket:bucket_water")
|
||||
minetest.alias_craftitem("bucket_lava", "bucket:bucket_lava")
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'craft "bucket:bucket_empty" 1',
|
||||
recipe = {
|
||||
@@ -14,11 +21,11 @@ minetest.register_craftitem("bucket:bucket_empty", {
|
||||
on_use = function(item, player, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
n = minetest.env:get_node(pointed_thing.under)
|
||||
if n.name == "water_source" then
|
||||
if n.name == "default:water_source" then
|
||||
minetest.env:add_node(pointed_thing.under, {name="air"})
|
||||
player:add_to_inventory_later('craft "bucket:bucket_water" 1')
|
||||
return true
|
||||
elseif n.name == "lava_source" then
|
||||
elseif n.name == "default:lava_source" then
|
||||
minetest.env:add_node(pointed_thing.under, {name="air"})
|
||||
player:add_to_inventory_later('craft "bucket:bucket_lava" 1')
|
||||
return true
|
||||
@@ -29,19 +36,19 @@ minetest.register_craftitem("bucket:bucket_empty", {
|
||||
})
|
||||
|
||||
minetest.register_craftitem("bucket:bucket_water", {
|
||||
image = "bucket:bucket_water.png",
|
||||
image = "bucket_water.png",
|
||||
stack_max = 1,
|
||||
liquids_pointable = true,
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
on_use = function(item, player, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
n = minetest.env:get_node(pointed_thing.under)
|
||||
if n.name == "water_source" then
|
||||
if n.name == "default:water_source" then
|
||||
-- unchanged
|
||||
elseif n.name == "water_flowing" or n.name == "lava_source" or n.name == "lava_flowing" then
|
||||
minetest.env:add_node(pointed_thing.under, {name="water_source"})
|
||||
elseif n.name == "default:water_flowing" or n.name == "default:lava_source" or n.name == "default:lava_flowing" then
|
||||
minetest.env:add_node(pointed_thing.under, {name="default:water_source"})
|
||||
else
|
||||
minetest.env:add_node(pointed_thing.above, {name="water_source"})
|
||||
minetest.env:add_node(pointed_thing.above, {name="default:water_source"})
|
||||
end
|
||||
player:add_to_inventory_later('craft "bucket:bucket_empty" 1')
|
||||
return true
|
||||
@@ -51,19 +58,19 @@ minetest.register_craftitem("bucket:bucket_water", {
|
||||
})
|
||||
|
||||
minetest.register_craftitem("bucket:bucket_lava", {
|
||||
image = "bucket:bucket_lava.png",
|
||||
image = "bucket_lava.png",
|
||||
stack_max = 1,
|
||||
liquids_pointable = true,
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
on_use = function(item, player, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
n = minetest.env:get_node(pointed_thing.under)
|
||||
if n.name == "lava_source" then
|
||||
if n.name == "default:lava_source" then
|
||||
-- unchanged
|
||||
elseif n.name == "water_source" or n.name == "water_flowing" or n.name == "lava_flowing" then
|
||||
minetest.env:add_node(pointed_thing.under, {name="lava_source"})
|
||||
elseif n.name == "default:water_source" or n.name == "default:water_flowing" or n.name == "default:lava_flowing" then
|
||||
minetest.env:add_node(pointed_thing.under, {name="default:lava_source"})
|
||||
else
|
||||
minetest.env:add_node(pointed_thing.above, {name="lava_source"})
|
||||
minetest.env:add_node(pointed_thing.above, {name="default:lava_source"})
|
||||
end
|
||||
player:add_to_inventory_later('craft "bucket:bucket_empty" 1')
|
||||
return true
|
||||
|
||||
|
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 292 B After Width: | Height: | Size: 292 B |
|
Before Width: | Height: | Size: 597 B After Width: | Height: | Size: 597 B |
|
Before Width: | Height: | Size: 604 B After Width: | Height: | Size: 604 B |
|
Before Width: | Height: | Size: 279 B After Width: | Height: | Size: 279 B |
|
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 236 B |
|
Before Width: | Height: | Size: 167 B After Width: | Height: | Size: 167 B |
|
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 224 B |
|
Before Width: | Height: | Size: 151 B After Width: | Height: | Size: 151 B |
|
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 142 B |
|
Before Width: | Height: | Size: 613 B After Width: | Height: | Size: 613 B |
|
Before Width: | Height: | Size: 249 B After Width: | Height: | Size: 249 B |
|
Before Width: | Height: | Size: 210 B After Width: | Height: | Size: 210 B |
|
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 118 B |
|
Before Width: | Height: | Size: 933 B After Width: | Height: | Size: 933 B |
|
Before Width: | Height: | Size: 830 B After Width: | Height: | Size: 830 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 539 B After Width: | Height: | Size: 539 B |
|
Before Width: | Height: | Size: 246 B After Width: | Height: | Size: 246 B |
|
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 236 B |
|
Before Width: | Height: | Size: 978 B After Width: | Height: | Size: 978 B |
|
Before Width: | Height: | Size: 874 B After Width: | Height: | Size: 874 B |
|
Before Width: | Height: | Size: 856 B After Width: | Height: | Size: 856 B |
|
Before Width: | Height: | Size: 878 B After Width: | Height: | Size: 878 B |
|
Before Width: | Height: | Size: 591 B After Width: | Height: | Size: 591 B |
|
Before Width: | Height: | Size: 936 B After Width: | Height: | Size: 936 B |
|
Before Width: | Height: | Size: 672 B After Width: | Height: | Size: 672 B |
|
Before Width: | Height: | Size: 502 B After Width: | Height: | Size: 502 B |
|
Before Width: | Height: | Size: 507 B After Width: | Height: | Size: 507 B |
|
Before Width: | Height: | Size: 395 B After Width: | Height: | Size: 395 B |
|
Before Width: | Height: | Size: 357 B After Width: | Height: | Size: 357 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 965 B After Width: | Height: | Size: 965 B |
|
Before Width: | Height: | Size: 303 B After Width: | Height: | Size: 303 B |
|
Before Width: | Height: | Size: 410 B After Width: | Height: | Size: 410 B |
|
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 260 B After Width: | Height: | Size: 260 B |
|
Before Width: | Height: | Size: 242 B After Width: | Height: | Size: 242 B |
|
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 366 B |
|
Before Width: | Height: | Size: 507 B After Width: | Height: | Size: 507 B |
|
Before Width: | Height: | Size: 555 B After Width: | Height: | Size: 555 B |
|
Before Width: | Height: | Size: 545 B After Width: | Height: | Size: 545 B |
|
Before Width: | Height: | Size: 542 B After Width: | Height: | Size: 542 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 772 B After Width: | Height: | Size: 772 B |
|
Before Width: | Height: | Size: 502 B After Width: | Height: | Size: 502 B |
|
Before Width: | Height: | Size: 233 B After Width: | Height: | Size: 233 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 489 B After Width: | Height: | Size: 489 B |
|
Before Width: | Height: | Size: 219 B After Width: | Height: | Size: 219 B |
|
Before Width: | Height: | Size: 207 B After Width: | Height: | Size: 207 B |
|
Before Width: | Height: | Size: 182 B After Width: | Height: | Size: 182 B |
|
Before Width: | Height: | Size: 806 B After Width: | Height: | Size: 806 B |
|
Before Width: | Height: | Size: 161 B After Width: | Height: | Size: 161 B |
|
Before Width: | Height: | Size: 186 B After Width: | Height: | Size: 186 B |
|
Before Width: | Height: | Size: 264 B After Width: | Height: | Size: 264 B |
|
Before Width: | Height: | Size: 252 B After Width: | Height: | Size: 252 B |
|
Before Width: | Height: | Size: 927 B After Width: | Height: | Size: 927 B |
|
Before Width: | Height: | Size: 271 B After Width: | Height: | Size: 271 B |
|
Before Width: | Height: | Size: 216 B After Width: | Height: | Size: 216 B |
|
Before Width: | Height: | Size: 291 B After Width: | Height: | Size: 291 B |
|
Before Width: | Height: | Size: 931 B After Width: | Height: | Size: 931 B |
|
Before Width: | Height: | Size: 262 B After Width: | Height: | Size: 262 B |
|
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 301 B After Width: | Height: | Size: 301 B |
|
Before Width: | Height: | Size: 927 B After Width: | Height: | Size: 927 B |
|
Before Width: | Height: | Size: 245 B After Width: | Height: | Size: 245 B |
|
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 255 B |
|
Before Width: | Height: | Size: 925 B After Width: | Height: | Size: 925 B |
|
Before Width: | Height: | Size: 913 B After Width: | Height: | Size: 913 B |
|
Before Width: | Height: | Size: 917 B After Width: | Height: | Size: 917 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 518 B After Width: | Height: | Size: 518 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -5,26 +5,22 @@
|
||||
-- An example furnace-thing implemented in Lua
|
||||
|
||||
minetest.register_node("experimental:luafurnace", {
|
||||
tile_images = {"lava.png", "furnace_side.png", "furnace_side.png",
|
||||
"furnace_side.png", "furnace_side.png", "furnace_front.png"},
|
||||
tile_images = {"default_lava.png", "default_furnace_side.png",
|
||||
"default_furnace_side.png", "default_furnace_side.png",
|
||||
"default_furnace_side.png", "default_furnace_front.png"},
|
||||
--inventory_image = "furnace_front.png",
|
||||
inventory_image = minetest.inventorycube("furnace_front.png"),
|
||||
inventory_image = minetest.inventorycube("default_furnace_front.png"),
|
||||
paramtype = "facedir_simple",
|
||||
metadata_name = "generic",
|
||||
material = digprop_stonelike(3.0),
|
||||
material = minetest.digprop_stonelike(3.0),
|
||||
})
|
||||
|
||||
minetest.register_on_placenode(function(pos, newnode, placer)
|
||||
if newnode.name == "experimental:luafurnace" then
|
||||
print("get_meta");
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
print("inventory_set_list");
|
||||
meta:inventory_set_list("fuel", {""})
|
||||
print("inventory_set_list");
|
||||
meta:inventory_set_list("src", {""})
|
||||
print("inventory_set_list");
|
||||
meta:inventory_set_list("dst", {"","","",""})
|
||||
print("set_inventory_draw_spec");
|
||||
meta:set_inventory_draw_spec(
|
||||
"invsize[8,9;]"
|
||||
.."list[current_name;fuel;2,3;1,1;]"
|
||||
@@ -34,9 +30,7 @@ minetest.register_on_placenode(function(pos, newnode, placer)
|
||||
)
|
||||
|
||||
local total_cooked = 0;
|
||||
print("set_string")
|
||||
meta:set_string("total_cooked", total_cooked)
|
||||
print("set_infotext");
|
||||
meta:set_infotext("Lua Furnace: total cooked: "..total_cooked)
|
||||
end
|
||||
end)
|
||||
@@ -99,9 +93,9 @@ minetest.register_abm({
|
||||
minetest.register_craft({
|
||||
output = 'node "experimental:luafurnace" 1',
|
||||
recipe = {
|
||||
{'node "cobble"', 'node "cobble"', 'node "cobble"'},
|
||||
{'node "cobble"', 'node "cobble"', 'node "cobble"'},
|
||||
{'node "cobble"', 'node "cobble"', 'node "cobble"'},
|
||||
{'node "default:cobble"', 'node "default:cobble"', 'node "default:cobble"'},
|
||||
{'node "default:cobble"', 'node "default:steel_ingot"', 'node "default:cobble"'},
|
||||
{'node "default:cobble"', 'node "default:cobble"', 'node "default:cobble"'},
|
||||
}
|
||||
})
|
||||
|
||||
@@ -110,8 +104,8 @@ minetest.register_craft({
|
||||
--
|
||||
|
||||
--[[
|
||||
minetest.register_tool("horribletool", {
|
||||
image = "lava.png",
|
||||
minetest.register_tool("experimental:horribletool", {
|
||||
image = "default_lava.png",
|
||||
basetime = 2.0
|
||||
dt_weight = 0.2
|
||||
dt_crackiness = 0.2
|
||||
@@ -125,10 +119,10 @@ minetest.register_tool("horribletool", {
|
||||
})
|
||||
--]]
|
||||
|
||||
minetest.register_craft({
|
||||
--[[minetest.register_craft({
|
||||
output = 'node "somenode" 4',
|
||||
recipe = {
|
||||
{'craft "Stick" 1'},
|
||||
{'craft "default_tick" 1'},
|
||||
}
|
||||
})
|
||||
|
||||
@@ -145,7 +139,7 @@ minetest.register_node("experimental:somenode", {
|
||||
flammability = 0
|
||||
},
|
||||
metadata_name = "chest",
|
||||
})
|
||||
})]]
|
||||
|
||||
--
|
||||
-- TNT (not functional)
|
||||
@@ -154,15 +148,18 @@ minetest.register_node("experimental:somenode", {
|
||||
minetest.register_craft({
|
||||
output = 'node "experimental:tnt" 4',
|
||||
recipe = {
|
||||
{'node "wood" 1'},
|
||||
{'craft "lump_of_coal" 1'},
|
||||
{'node "wood" 1'}
|
||||
{'node "default:wood" 1'},
|
||||
{'craft "default:coal_lump" 1'},
|
||||
{'node "default:wood" 1'}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("experimental:tnt", {
|
||||
tile_images = {"tnt_top.png", "tnt_bottom.png", "tnt_side.png", "tnt_side.png", "tnt_side.png", "tnt_side.png"},
|
||||
inventory_image = "tnt_side.png",
|
||||
tile_images = {"default_tnt_top.png", "default_tnt_bottom.png",
|
||||
"default_tnt_side.png", "default_tnt_side.png",
|
||||
"default_tnt_side.png", "default_tnt_side.png"},
|
||||
inventory_image = minetest.inventorycube("default_tnt_top.png",
|
||||
"default_tnt_side.png", "default_tnt_side.png"),
|
||||
dug_item = '', -- Get nothing
|
||||
material = {
|
||||
diggability = "not",
|
||||
@@ -183,7 +180,9 @@ local TNT = {
|
||||
-- weight = 5,
|
||||
collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
|
||||
visual = "cube",
|
||||
textures = {"tnt_top.png","tnt_bottom.png","tnt_side.png","tnt_side.png","tnt_side.png","tnt_side.png"},
|
||||
textures = {"default_tnt_top.png", "default_tnt_bottom.png",
|
||||
"default_tnt_side.png", "default_tnt_side.png",
|
||||
"default_tnt_side.png", "default_tnt_side.png"},
|
||||
-- Initial value for our timer
|
||||
timer = 0,
|
||||
-- Number of punches required to defuse
|
||||
@@ -238,6 +237,9 @@ end
|
||||
--print("Registering TNT");
|
||||
minetest.register_entity("experimental:tnt", TNT)
|
||||
|
||||
-- Add TNT's old name also
|
||||
minetest.alias_node("TNT", "experimental:tnt")
|
||||
|
||||
--
|
||||
-- A test entity for testing animated and yaw-modulated sprites
|
||||
--
|
||||
@@ -288,8 +290,8 @@ minetest.register_on_generated(function(minp, maxp)
|
||||
end)
|
||||
|
||||
-- Example setting get
|
||||
print("setting max_users = " .. dump(minetest.setting_get("max_users")))
|
||||
print("setting asdf = " .. dump(minetest.setting_get("asdf")))
|
||||
--print("setting max_users = " .. dump(minetest.setting_get("max_users")))
|
||||
--print("setting asdf = " .. dump(minetest.setting_get("asdf")))
|
||||
|
||||
minetest.register_on_chat_message(function(name, message)
|
||||
--[[print("on_chat_message: name="..dump(name).." message="..dump(message))
|
||||
|
||||
2
data/mods/legacy/depends.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
default
|
||||
|
||||
101
data/mods/legacy/init.lua
Normal file
@@ -0,0 +1,101 @@
|
||||
-- legacy (Minetest 0.4 mod)
|
||||
-- Provides as much backwards-compatibility as feasible
|
||||
|
||||
--
|
||||
-- Aliases to support loading 0.3 and old 0.4 worlds and inventories
|
||||
--
|
||||
|
||||
minetest.alias_node("stone", "default:stone")
|
||||
minetest.alias_node("dirt_with_grass", "default:dirt_with_grass")
|
||||
minetest.alias_node("dirt_with_grass_footsteps", "default:dirt_with_grass_footsteps")
|
||||
minetest.alias_node("dirt", "default:dirt")
|
||||
minetest.alias_node("sand", "default:sand")
|
||||
minetest.alias_node("gravel", "default:gravel")
|
||||
minetest.alias_node("sandstone", "default:sandstone")
|
||||
minetest.alias_node("clay", "default:clay")
|
||||
minetest.alias_node("brick", "default:brick")
|
||||
minetest.alias_node("tree", "default:tree")
|
||||
minetest.alias_node("jungletree", "default:jungletree")
|
||||
minetest.alias_node("junglegrass", "default:junglegrass")
|
||||
minetest.alias_node("leaves", "default:leaves")
|
||||
minetest.alias_node("cactus", "default:cactus")
|
||||
minetest.alias_node("papyrus", "default:papyrus")
|
||||
minetest.alias_node("bookshelf", "default:bookshelf")
|
||||
minetest.alias_node("glass", "default:glass")
|
||||
minetest.alias_node("wooden_fence", "default:fence_wood")
|
||||
minetest.alias_node("rail", "default:rail")
|
||||
minetest.alias_node("ladder", "default:ladder")
|
||||
minetest.alias_node("wood", "default:wood")
|
||||
minetest.alias_node("mese", "default:mese")
|
||||
minetest.alias_node("cloud", "default:cloud")
|
||||
minetest.alias_node("water_flowing", "default:water_flowing")
|
||||
minetest.alias_node("water_source", "default:water_source")
|
||||
minetest.alias_node("lava_flowing", "default:lava_flowing")
|
||||
minetest.alias_node("lava_source", "default:lava_source")
|
||||
minetest.alias_node("torch", "default:torch")
|
||||
minetest.alias_node("sign_wall", "default:sign_wall")
|
||||
minetest.alias_node("furnace", "default:furnace")
|
||||
minetest.alias_node("chest", "default:chest")
|
||||
minetest.alias_node("locked_chest", "default:chest_locked")
|
||||
minetest.alias_node("cobble", "default:cobble")
|
||||
minetest.alias_node("mossycobble", "default:mossycobble")
|
||||
minetest.alias_node("steelblock", "default:steelblock")
|
||||
minetest.alias_node("nyancat", "default:nyancat")
|
||||
minetest.alias_node("nyancat_rainbow", "default:nyancat_rainbow")
|
||||
minetest.alias_node("sapling", "default:sapling")
|
||||
minetest.alias_node("apple", "default:apple")
|
||||
|
||||
minetest.alias_tool("WPick", "default:pick_wood")
|
||||
minetest.alias_tool("STPick", "default:pick_stone")
|
||||
minetest.alias_tool("SteelPick", "default:pick_steel")
|
||||
minetest.alias_tool("MesePick", "default:pick_mese")
|
||||
minetest.alias_tool("WShovel", "default:shovel_wood")
|
||||
minetest.alias_tool("STShovel", "default:shovel_stone")
|
||||
minetest.alias_tool("SteelShovel", "default:shovel_steel")
|
||||
minetest.alias_tool("WAxe", "default:axe_wood")
|
||||
minetest.alias_tool("STAxe", "default:axe_stone")
|
||||
minetest.alias_tool("SteelAxe", "default:axe_steel")
|
||||
minetest.alias_tool("WSword", "default:sword_wood")
|
||||
minetest.alias_tool("STSword", "default:sword_stone")
|
||||
minetest.alias_tool("SteelSword", "default:sword_steel")
|
||||
|
||||
minetest.alias_craftitem("Stick", "default:stick")
|
||||
minetest.alias_craftitem("paper", "default:paper")
|
||||
minetest.alias_craftitem("book", "default:book")
|
||||
minetest.alias_craftitem("lump_of_coal", "default:coal_lump")
|
||||
minetest.alias_craftitem("lump_of_iron", "default:iron_lump")
|
||||
minetest.alias_craftitem("lump_of_clay", "default:clay_lump")
|
||||
minetest.alias_craftitem("steel_ingot", "default:steel_ingot")
|
||||
minetest.alias_craftitem("clay_brick", "default:clay_brick")
|
||||
minetest.alias_craftitem("scorched_stuff", "default:scorched_stuff")
|
||||
minetest.alias_craftitem("apple", "default:apple")
|
||||
|
||||
--
|
||||
-- Old items
|
||||
--
|
||||
|
||||
minetest.register_craftitem(":rat", {
|
||||
image = "rat.png",
|
||||
cookresult_itemstring = 'craft "cooked_rat" 1',
|
||||
on_drop = function(item, dropper, pos)
|
||||
minetest.env:add_rat(pos)
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craftitem(":cooked_rat", {
|
||||
image = "cooked_rat.png",
|
||||
cookresult_itemstring = 'craft "scorched_stuff" 1',
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
on_use = minetest.craftitem_eat(6),
|
||||
})
|
||||
|
||||
minetest.register_craftitem(":firefly", {
|
||||
image = "firefly.png",
|
||||
on_drop = function(item, dropper, pos)
|
||||
minetest.env:add_firefly(pos)
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
-- END
|
||||
|
Before Width: | Height: | Size: 207 B After Width: | Height: | Size: 207 B |
|
Before Width: | Height: | Size: 239 B After Width: | Height: | Size: 239 B |
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 603 B After Width: | Height: | Size: 603 B |
|
Before Width: | Height: | Size: 116 B After Width: | Height: | Size: 116 B |
|
Before Width: | Height: | Size: 952 B After Width: | Height: | Size: 952 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 250 B After Width: | Height: | Size: 250 B |
|
Before Width: | Height: | Size: 341 B After Width: | Height: | Size: 341 B |
|
Before Width: | Height: | Size: 920 B After Width: | Height: | Size: 920 B |
@@ -158,7 +158,6 @@ endif()
|
||||
# Client sources
|
||||
set(minetest_SRCS
|
||||
${common_SRCS}
|
||||
MyBillboardSceneNode.cpp
|
||||
content_mapblock.cpp
|
||||
content_cao.cpp
|
||||
mesh.cpp
|
||||
|
||||
@@ -1,202 +0,0 @@
|
||||
// Copyright (C) 2002-2010 Nikolaus Gebhardt
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
#include "MyBillboardSceneNode.h"
|
||||
#include "IVideoDriver.h"
|
||||
#include "ISceneManager.h"
|
||||
#include "ICameraSceneNode.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace scene
|
||||
{
|
||||
|
||||
//! constructor
|
||||
MyBillboardSceneNode::MyBillboardSceneNode(ISceneNode* parent,
|
||||
ISceneManager* mgr, s32 id,
|
||||
const core::vector3df& position, const core::dimension2d<f32>& size)
|
||||
: IBillboardSceneNode(parent, mgr, id, position)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("MyBillboardSceneNode");
|
||||
#endif
|
||||
|
||||
setSize(size);
|
||||
|
||||
indices[0] = 0;
|
||||
indices[1] = 2;
|
||||
indices[2] = 1;
|
||||
indices[3] = 0;
|
||||
indices[4] = 3;
|
||||
indices[5] = 2;
|
||||
|
||||
video::SColor colorTop = video::SColor(0xFFFFFFFF);
|
||||
video::SColor colorBottom = video::SColor(0xFFFFFFFF);
|
||||
|
||||
vertices[0].TCoords.set(1.0f, 1.0f);
|
||||
vertices[0].Color = colorBottom;
|
||||
|
||||
vertices[1].TCoords.set(1.0f, 0.0f);
|
||||
vertices[1].Color = colorTop;
|
||||
|
||||
vertices[2].TCoords.set(0.0f, 0.0f);
|
||||
vertices[2].Color = colorTop;
|
||||
|
||||
vertices[3].TCoords.set(0.0f, 1.0f);
|
||||
vertices[3].Color = colorBottom;
|
||||
}
|
||||
|
||||
|
||||
//! pre render event
|
||||
void MyBillboardSceneNode::OnRegisterSceneNode()
|
||||
{
|
||||
if (IsVisible)
|
||||
SceneManager->registerNodeForRendering(this);
|
||||
|
||||
ISceneNode::OnRegisterSceneNode();
|
||||
}
|
||||
|
||||
|
||||
//! render
|
||||
void MyBillboardSceneNode::render()
|
||||
{
|
||||
video::IVideoDriver* driver = SceneManager->getVideoDriver();
|
||||
ICameraSceneNode* camera = SceneManager->getActiveCamera();
|
||||
|
||||
if (!camera || !driver)
|
||||
return;
|
||||
|
||||
// make billboard look to camera
|
||||
|
||||
core::vector3df pos = getAbsolutePosition();
|
||||
|
||||
core::vector3df campos = camera->getAbsolutePosition();
|
||||
core::vector3df target = camera->getTarget();
|
||||
core::vector3df up = camera->getUpVector();
|
||||
core::vector3df view = target - campos;
|
||||
view.normalize();
|
||||
|
||||
core::vector3df horizontal = up.crossProduct(view);
|
||||
if ( horizontal.getLength() == 0 )
|
||||
{
|
||||
horizontal.set(up.Y,up.X,up.Z);
|
||||
}
|
||||
horizontal.normalize();
|
||||
horizontal *= 0.5f * Size.Width;
|
||||
|
||||
core::vector3df vertical = horizontal.crossProduct(view);
|
||||
vertical.normalize();
|
||||
vertical *= 0.5f * Size.Height;
|
||||
|
||||
view *= -1.0f;
|
||||
|
||||
for (s32 i=0; i<4; ++i)
|
||||
vertices[i].Normal = view;
|
||||
|
||||
vertices[0].Pos = pos + horizontal + vertical;
|
||||
vertices[1].Pos = pos + horizontal - vertical;
|
||||
vertices[2].Pos = pos - horizontal - vertical;
|
||||
vertices[3].Pos = pos - horizontal + vertical;
|
||||
|
||||
// draw
|
||||
|
||||
if ( DebugDataVisible & scene::EDS_BBOX )
|
||||
{
|
||||
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
|
||||
video::SMaterial m;
|
||||
m.Lighting = false;
|
||||
driver->setMaterial(m);
|
||||
driver->draw3DBox(BBox, video::SColor(0,208,195,152));
|
||||
}
|
||||
|
||||
driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
|
||||
|
||||
driver->setMaterial(Material);
|
||||
|
||||
driver->drawIndexedTriangleList(vertices, 4, indices, 2);
|
||||
}
|
||||
|
||||
|
||||
//! returns the axis aligned bounding box of this node
|
||||
const core::aabbox3d<f32>& MyBillboardSceneNode::getBoundingBox() const
|
||||
{
|
||||
return BBox;
|
||||
}
|
||||
|
||||
|
||||
//! sets the size of the billboard
|
||||
void MyBillboardSceneNode::setSize(const core::dimension2d<f32>& size)
|
||||
{
|
||||
Size = size;
|
||||
|
||||
if (Size.Width == 0.0f)
|
||||
Size.Width = 1.0f;
|
||||
|
||||
if (Size.Height == 0.0f )
|
||||
Size.Height = 1.0f;
|
||||
|
||||
f32 avg = (size.Width + size.Height)/6;
|
||||
BBox.MinEdge.set(-avg,-avg,-avg);
|
||||
BBox.MaxEdge.set(avg,avg,avg);
|
||||
}
|
||||
|
||||
|
||||
video::SMaterial& MyBillboardSceneNode::getMaterial(u32 i)
|
||||
{
|
||||
return Material;
|
||||
}
|
||||
|
||||
|
||||
//! returns amount of materials used by this scene node.
|
||||
u32 MyBillboardSceneNode::getMaterialCount() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
//! gets the size of the billboard
|
||||
const core::dimension2d<f32>& MyBillboardSceneNode::getSize() const
|
||||
{
|
||||
return Size;
|
||||
}
|
||||
|
||||
|
||||
//! Set the color of all vertices of the billboard
|
||||
//! \param overallColor: the color to set
|
||||
void MyBillboardSceneNode::setColor(const video::SColor & overallColor)
|
||||
{
|
||||
for(u32 vertex = 0; vertex < 4; ++vertex)
|
||||
vertices[vertex].Color = overallColor;
|
||||
}
|
||||
|
||||
|
||||
//! Set the color of the top and bottom vertices of the billboard
|
||||
//! \param topColor: the color to set the top vertices
|
||||
//! \param bottomColor: the color to set the bottom vertices
|
||||
void MyBillboardSceneNode::setColor(const video::SColor & topColor, const video::SColor & bottomColor)
|
||||
{
|
||||
vertices[0].Color = bottomColor;
|
||||
vertices[1].Color = topColor;
|
||||
vertices[2].Color = topColor;
|
||||
vertices[3].Color = bottomColor;
|
||||
}
|
||||
|
||||
|
||||
//! Gets the color of the top and bottom vertices of the billboard
|
||||
//! \param[out] topColor: stores the color of the top vertices
|
||||
//! \param[out] bottomColor: stores the color of the bottom vertices
|
||||
void MyBillboardSceneNode::getColor(video::SColor & topColor, video::SColor & bottomColor) const
|
||||
{
|
||||
bottomColor = vertices[0].Color;
|
||||
topColor = vertices[1].Color;
|
||||
}
|
||||
|
||||
void MyBillboardSceneNode::setTCoords(u32 i, core::vector2d<f32> c)
|
||||
{
|
||||
vertices[i].TCoords = c;
|
||||
}
|
||||
|
||||
} // end namespace scene
|
||||
} // end namespace irr
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
// Copyright (C) 2002-2010 Nikolaus Gebhardt
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
#ifndef __C_BILLBOARD_SCENE_NODE_H_INCLUDED__
|
||||
#define __C_BILLBOARD_SCENE_NODE_H_INCLUDED__
|
||||
|
||||
#include "IBillboardSceneNode.h"
|
||||
#include "S3DVertex.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace scene
|
||||
{
|
||||
|
||||
//! Scene node which is a billboard. A billboard is like a 3d sprite: A 2d element,
|
||||
//! which always looks to the camera.
|
||||
class MyBillboardSceneNode : virtual public IBillboardSceneNode
|
||||
{
|
||||
public:
|
||||
|
||||
//! constructor
|
||||
MyBillboardSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
|
||||
const core::vector3df& position, const core::dimension2d<f32>& size);
|
||||
|
||||
//! pre render event
|
||||
virtual void OnRegisterSceneNode();
|
||||
|
||||
//! render
|
||||
virtual void render();
|
||||
|
||||
//! returns the axis aligned bounding box of this node
|
||||
virtual const core::aabbox3d<f32>& getBoundingBox() const;
|
||||
|
||||
//! sets the size of the billboard
|
||||
virtual void setSize(const core::dimension2d<f32>& size);
|
||||
|
||||
//! gets the size of the billboard
|
||||
virtual const core::dimension2d<f32>& getSize() const;
|
||||
|
||||
virtual video::SMaterial& getMaterial(u32 i);
|
||||
|
||||
//! returns amount of materials used by this scene node.
|
||||
virtual u32 getMaterialCount() const;
|
||||
|
||||
//! Set the color of all vertices of the billboard
|
||||
//! \param overallColor: the color to set
|
||||
virtual void setColor(const video::SColor & overallColor);
|
||||
|
||||
//! Set the color of the top and bottom vertices of the billboard
|
||||
//! \param topColor: the color to set the top vertices
|
||||
//! \param bottomColor: the color to set the bottom vertices
|
||||
virtual void setColor(const video::SColor & topColor, const video::SColor & bottomColor);
|
||||
|
||||
//! Gets the color of the top and bottom vertices of the billboard
|
||||
//! \param[out] topColor: stores the color of the top vertices
|
||||
//! \param[out] bottomColor: stores the color of the bottom vertices
|
||||
virtual void getColor(video::SColor& topColor, video::SColor& bottomColor) const;
|
||||
|
||||
virtual void setTCoords(u32 i, core::vector2d<f32> c);
|
||||
|
||||
private:
|
||||
|
||||
core::dimension2d<f32> Size;
|
||||
core::aabbox3d<f32> BBox;
|
||||
video::SMaterial Material;
|
||||
|
||||
video::S3DVertex vertices[4];
|
||||
u16 indices[6];
|
||||
};
|
||||
|
||||
|
||||
} // end namespace scene
|
||||
} // end namespace irr
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "settings.h"
|
||||
#include <ICameraSceneNode.h>
|
||||
#include <ITextSceneNode.h>
|
||||
#include <IBillboardSceneNode.h>
|
||||
#include "serialization.h" // For decompressZlib
|
||||
#include "gamedef.h"
|
||||
#include "clientobject.h"
|
||||
@@ -30,7 +31,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "mesh.h"
|
||||
#include "utility.h" // For IntervalLimiter
|
||||
class Settings;
|
||||
#include "MyBillboardSceneNode.h"
|
||||
|
||||
core::map<u16, ClientActiveObject::Factory> ClientActiveObject::m_types;
|
||||
|
||||
@@ -183,12 +183,16 @@ class ItemCAO : public ClientActiveObject
|
||||
{return &m_selection_box;}
|
||||
v3f getPosition()
|
||||
{return m_position;}
|
||||
|
||||
std::string infoText()
|
||||
{return m_infotext;}
|
||||
|
||||
private:
|
||||
core::aabbox3d<f32> m_selection_box;
|
||||
scene::IMeshSceneNode *m_node;
|
||||
v3f m_position;
|
||||
std::string m_inventorystring;
|
||||
std::string m_infotext;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -328,6 +332,15 @@ class FireflyCAO : public ClientActiveObject
|
||||
SmoothTranslator pos_translator;
|
||||
};
|
||||
|
||||
static void setBillboardTextureMatrix(scene::IBillboardSceneNode *bill,
|
||||
float txs, float tys, int col, int row)
|
||||
{
|
||||
video::SMaterial& material = bill->getMaterial(0);
|
||||
core::matrix4& matrix = material.getTextureMatrix(0);
|
||||
matrix.setTextureTranslate(txs*col, tys*row);
|
||||
matrix.setTextureScale(txs, tys);
|
||||
}
|
||||
|
||||
/*
|
||||
MobV2CAO
|
||||
*/
|
||||
@@ -373,7 +386,7 @@ class MobV2CAO : public ClientActiveObject
|
||||
|
||||
IntervalLimiter m_attack_interval;
|
||||
core::aabbox3d<f32> m_selection_box;
|
||||
scene::MyBillboardSceneNode *m_node;
|
||||
scene::IBillboardSceneNode *m_node;
|
||||
v3f m_position;
|
||||
std::string m_texture_name;
|
||||
float m_yaw;
|
||||
@@ -530,7 +543,10 @@ ItemCAO::ItemCAO(IGameDef *gamedef, ClientEnvironment *env):
|
||||
m_node(NULL),
|
||||
m_position(v3f(0,10*BS,0))
|
||||
{
|
||||
ClientActiveObject::registerType(getType(), create);
|
||||
if(!gamedef && !env)
|
||||
{
|
||||
ClientActiveObject::registerType(getType(), create);
|
||||
}
|
||||
}
|
||||
|
||||
ItemCAO::~ItemCAO()
|
||||
@@ -569,9 +585,8 @@ void ItemCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
|
||||
// Set material
|
||||
buf->getMaterial().setFlag(video::EMF_LIGHTING, false);
|
||||
buf->getMaterial().setFlag(video::EMF_BACK_FACE_CULLING, false);
|
||||
//buf->getMaterial().setTexture(0, NULL);
|
||||
// Initialize with the stick texture
|
||||
buf->getMaterial().setTexture(0, tsrc->getTextureRaw("stick.png"));
|
||||
// Initialize with a generated placeholder texture
|
||||
buf->getMaterial().setTexture(0, tsrc->getTextureRaw(""));
|
||||
buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, false);
|
||||
buf->getMaterial().setFlag(video::EMF_FOG_ENABLE, true);
|
||||
buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
|
||||
@@ -694,6 +709,23 @@ void ItemCAO::initialize(const std::string &data)
|
||||
}
|
||||
|
||||
updateNodePos();
|
||||
|
||||
/*
|
||||
Set infotext to item name if item cannot be deserialized
|
||||
*/
|
||||
try{
|
||||
InventoryItem *item = NULL;
|
||||
item = InventoryItem::deSerialize(m_inventorystring, m_gamedef);
|
||||
if(item){
|
||||
if(!item->isKnown())
|
||||
m_infotext = "Unknown item: '" + m_inventorystring + "'";
|
||||
}
|
||||
delete item;
|
||||
}
|
||||
catch(SerializationError &e)
|
||||
{
|
||||
m_infotext = "Unknown item: '" + m_inventorystring + "'";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1282,8 +1314,8 @@ void MobV2CAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
|
||||
std::string texture_string = m_texture_name +
|
||||
"^[makealpha:128,0,0^[makealpha:128,128,0";
|
||||
|
||||
scene::MyBillboardSceneNode *bill = new scene::MyBillboardSceneNode(
|
||||
smgr->getRootSceneNode(), smgr, -1, v3f(0,0,0), v2f(1,1));
|
||||
scene::IBillboardSceneNode *bill = smgr->addBillboardSceneNode(
|
||||
NULL, v2f(1, 1), v3f(0,0,0), -1);
|
||||
bill->setMaterialTexture(0, tsrc->getTextureRaw(texture_string));
|
||||
bill->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
bill->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
|
||||
@@ -1297,17 +1329,11 @@ void MobV2CAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
|
||||
const float txs = txp*32;
|
||||
const float typ = 1./240;
|
||||
const float tys = typ*48;
|
||||
bill->setTCoords(0, v2f(txs*1, tys*1));
|
||||
bill->setTCoords(1, v2f(txs*1, tys*0));
|
||||
bill->setTCoords(2, v2f(txs*0, tys*0));
|
||||
bill->setTCoords(3, v2f(txs*0, tys*1));
|
||||
setBillboardTextureMatrix(bill, txs, tys, 0, 0);
|
||||
} else if(m_sprite_type == "simple"){
|
||||
const float txs = 1.0;
|
||||
const float tys = 1.0 / m_simple_anim_frames;
|
||||
bill->setTCoords(0, v2f(txs*1, tys*1));
|
||||
bill->setTCoords(1, v2f(txs*1, tys*0));
|
||||
bill->setTCoords(2, v2f(txs*0, tys*0));
|
||||
bill->setTCoords(3, v2f(txs*0, tys*1));
|
||||
setBillboardTextureMatrix(bill, txs, tys, 0, 0);
|
||||
} else {
|
||||
infostream<<"MobV2CAO: Unknown sprite type \""<<m_sprite_type<<"\""
|
||||
<<std::endl;
|
||||
@@ -1323,7 +1349,6 @@ void MobV2CAO::removeFromScene()
|
||||
if(m_node == NULL)
|
||||
return;
|
||||
|
||||
m_node->drop();
|
||||
m_node->remove();
|
||||
m_node = NULL;
|
||||
}
|
||||
@@ -1371,7 +1396,7 @@ void MobV2CAO::updateNodePos()
|
||||
|
||||
void MobV2CAO::step(float dtime, ClientEnvironment *env)
|
||||
{
|
||||
scene::MyBillboardSceneNode *bill = m_node;
|
||||
scene::IBillboardSceneNode *bill = m_node;
|
||||
if(!bill)
|
||||
return;
|
||||
|
||||
@@ -1424,10 +1449,7 @@ void MobV2CAO::step(float dtime, ClientEnvironment *env)
|
||||
const float txs = txp*32;
|
||||
const float typ = 1./240;
|
||||
const float tys = typ*48;
|
||||
bill->setTCoords(0, v2f(txs*(1+col), tys*(1+row)));
|
||||
bill->setTCoords(1, v2f(txs*(1+col), tys*(0+row)));
|
||||
bill->setTCoords(2, v2f(txs*(0+col), tys*(0+row)));
|
||||
bill->setTCoords(3, v2f(txs*(0+col), tys*(1+row)));
|
||||
setBillboardTextureMatrix(bill, txs, tys, col, row);
|
||||
} else if(m_sprite_type == "simple"){
|
||||
m_walk_timer += dtime;
|
||||
if(m_walk_timer >= m_simple_anim_frametime){
|
||||
@@ -1438,10 +1460,7 @@ void MobV2CAO::step(float dtime, ClientEnvironment *env)
|
||||
int row = m_walk_frame;
|
||||
const float txs = 1.0;
|
||||
const float tys = 1.0 / m_simple_anim_frames;
|
||||
bill->setTCoords(0, v2f(txs*(1+col), tys*(1+row)));
|
||||
bill->setTCoords(1, v2f(txs*(1+col), tys*(0+row)));
|
||||
bill->setTCoords(2, v2f(txs*(0+col), tys*(0+row)));
|
||||
bill->setTCoords(3, v2f(txs*(0+col), tys*(1+row)));
|
||||
setBillboardTextureMatrix(bill, txs, tys, col, row);
|
||||
} else {
|
||||
infostream<<"MobV2CAO::step(): Unknown sprite type \""
|
||||
<<m_sprite_type<<"\""<<std::endl;
|
||||
@@ -1654,7 +1673,7 @@ class LuaEntityCAO : public ClientActiveObject
|
||||
private:
|
||||
core::aabbox3d<f32> m_selection_box;
|
||||
scene::IMeshSceneNode *m_meshnode;
|
||||
scene::MyBillboardSceneNode *m_spritenode;
|
||||
scene::IBillboardSceneNode *m_spritenode;
|
||||
v3f m_position;
|
||||
v3f m_velocity;
|
||||
v3f m_acceleration;
|
||||
@@ -1760,8 +1779,8 @@ class LuaEntityCAO : public ClientActiveObject
|
||||
|
||||
if(m_prop->visual == "sprite"){
|
||||
infostream<<"LuaEntityCAO::addToScene(): single_sprite"<<std::endl;
|
||||
m_spritenode = new scene::MyBillboardSceneNode(
|
||||
smgr->getRootSceneNode(), smgr, -1, v3f(0,0,0), v2f(1,1));
|
||||
m_spritenode = smgr->addBillboardSceneNode(
|
||||
NULL, v2f(1, 1), v3f(0,0,0), -1);
|
||||
m_spritenode->setMaterialTexture(0,
|
||||
tsrc->getTextureRaw("unknown_block.png"));
|
||||
m_spritenode->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
@@ -1774,71 +1793,15 @@ class LuaEntityCAO : public ClientActiveObject
|
||||
{
|
||||
const float txs = 1.0 / 1;
|
||||
const float tys = 1.0 / 1;
|
||||
m_spritenode->setTCoords(0, v2f(txs*1, tys*1));
|
||||
m_spritenode->setTCoords(1, v2f(txs*1, tys*0));
|
||||
m_spritenode->setTCoords(2, v2f(txs*0, tys*0));
|
||||
m_spritenode->setTCoords(3, v2f(txs*0, tys*1));
|
||||
setBillboardTextureMatrix(m_spritenode,
|
||||
txs, tys, 0, 0);
|
||||
}
|
||||
} else if(m_prop->visual == "cube"){
|
||||
infostream<<"LuaEntityCAO::addToScene(): cube"<<std::endl;
|
||||
video::SColor c(255,255,255,255);
|
||||
video::S3DVertex vertices[24] =
|
||||
{
|
||||
// Up
|
||||
video::S3DVertex(-0.5,+0.5,-0.5, 0,1,0, c, 0,1),
|
||||
video::S3DVertex(-0.5,+0.5,+0.5, 0,1,0, c, 0,0),
|
||||
video::S3DVertex(+0.5,+0.5,+0.5, 0,1,0, c, 1,0),
|
||||
video::S3DVertex(+0.5,+0.5,-0.5, 0,1,0, c, 1,1),
|
||||
// Down
|
||||
video::S3DVertex(-0.5,-0.5,-0.5, 0,-1,0, c, 0,0),
|
||||
video::S3DVertex(+0.5,-0.5,-0.5, 0,-1,0, c, 1,0),
|
||||
video::S3DVertex(+0.5,-0.5,+0.5, 0,-1,0, c, 1,1),
|
||||
video::S3DVertex(-0.5,-0.5,+0.5, 0,-1,0, c, 0,1),
|
||||
// Right
|
||||
video::S3DVertex(+0.5,-0.5,-0.5, 1,0,0, c, 0,1),
|
||||
video::S3DVertex(+0.5,+0.5,-0.5, 1,0,0, c, 0,0),
|
||||
video::S3DVertex(+0.5,+0.5,+0.5, 1,0,0, c, 1,0),
|
||||
video::S3DVertex(+0.5,-0.5,+0.5, 1,0,0, c, 1,1),
|
||||
// Left
|
||||
video::S3DVertex(-0.5,-0.5,-0.5, -1,0,0, c, 1,1),
|
||||
video::S3DVertex(-0.5,-0.5,+0.5, -1,0,0, c, 0,1),
|
||||
video::S3DVertex(-0.5,+0.5,+0.5, -1,0,0, c, 0,0),
|
||||
video::S3DVertex(-0.5,+0.5,-0.5, -1,0,0, c, 1,0),
|
||||
// Back
|
||||
video::S3DVertex(-0.5,-0.5,+0.5, 0,0,1, c, 1,1),
|
||||
video::S3DVertex(+0.5,-0.5,+0.5, 0,0,1, c, 0,1),
|
||||
video::S3DVertex(+0.5,+0.5,+0.5, 0,0,1, c, 0,0),
|
||||
video::S3DVertex(-0.5,+0.5,+0.5, 0,0,1, c, 1,0),
|
||||
// Front
|
||||
video::S3DVertex(-0.5,-0.5,-0.5, 0,0,-1, c, 0,1),
|
||||
video::S3DVertex(-0.5,+0.5,-0.5, 0,0,-1, c, 0,0),
|
||||
video::S3DVertex(+0.5,+0.5,-0.5, 0,0,-1, c, 1,0),
|
||||
video::S3DVertex(+0.5,-0.5,-0.5, 0,0,-1, c, 1,1),
|
||||
};
|
||||
|
||||
for(u32 i=0; i<24; ++i){
|
||||
vertices[i].Pos *= BS;
|
||||
vertices[i].Pos.Y *= m_prop->visual_size.Y;
|
||||
vertices[i].Pos.X *= m_prop->visual_size.X;
|
||||
vertices[i].Pos.Z *= m_prop->visual_size.X;
|
||||
}
|
||||
|
||||
u16 indices[6] = {0,1,2,2,3,0};
|
||||
|
||||
scene::SMesh* mesh = new scene::SMesh();
|
||||
for (u32 i=0; i<6; ++i)
|
||||
{
|
||||
scene::IMeshBuffer* buf = new scene::SMeshBuffer();
|
||||
buf->append(vertices + 4 * i, 4, indices, 6);
|
||||
buf->recalculateBoundingBox();
|
||||
mesh->addMeshBuffer(buf);
|
||||
buf->drop();
|
||||
}
|
||||
mesh->recalculateBoundingBox();
|
||||
|
||||
scene::IMesh *mesh = createCubeMesh(v3f(BS,BS,BS));
|
||||
m_meshnode = smgr->addMeshSceneNode(mesh, NULL);
|
||||
mesh->drop();
|
||||
|
||||
m_meshnode->setMesh(mesh);
|
||||
m_meshnode->setScale(v3f(1));
|
||||
// Will be shown when we know the brightness
|
||||
m_meshnode->setVisible(false);
|
||||
@@ -1976,10 +1939,8 @@ class LuaEntityCAO : public ClientActiveObject
|
||||
|
||||
float txs = m_tx_size.X;
|
||||
float tys = m_tx_size.Y;
|
||||
m_spritenode->setTCoords(0, v2f(txs*(1+col), tys*(1+row)));
|
||||
m_spritenode->setTCoords(1, v2f(txs*(1+col), tys*(0+row)));
|
||||
m_spritenode->setTCoords(2, v2f(txs*(0+col), tys*(0+row)));
|
||||
m_spritenode->setTCoords(3, v2f(txs*(0+col), tys*(1+row)));
|
||||
setBillboardTextureMatrix(m_spritenode,
|
||||
txs, tys, col, row);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1658,8 +1658,11 @@ std::string LuaEntitySAO::getStaticData()
|
||||
|
||||
void LuaEntitySAO::punch(ServerActiveObject *puncher, float time_from_last_punch)
|
||||
{
|
||||
if(!m_registered)
|
||||
if(!m_registered){
|
||||
// Delete unknown LuaEntities when punched
|
||||
m_removed = true;
|
||||
return;
|
||||
}
|
||||
lua_State *L = m_env->getLua();
|
||||
scriptapi_luaentity_punch(L, m_id, puncher, time_from_last_punch);
|
||||
}
|
||||
|
||||