diff options
Diffstat (limited to 'data')
-rw-r--r-- | data/chest_front.png | bin | 0 -> 167 bytes | |||
-rw-r--r-- | data/chest_side.png | bin | 0 -> 151 bytes | |||
-rw-r--r-- | data/chest_top.png | bin | 0 -> 142 bytes | |||
-rw-r--r-- | data/cobble.png | bin | 0 -> 830 bytes | |||
-rw-r--r-- | data/furnace_front.png | bin | 0 -> 246 bytes | |||
-rw-r--r-- | data/furnace_side.png | bin | 0 -> 236 bytes | |||
-rw-r--r-- | data/glass.png | bin | 0 -> 1309 bytes | |||
-rw-r--r-- | data/grass.png | bin | 744 -> 874 bytes | |||
-rw-r--r-- | data/grass_side.png | bin | 391 -> 878 bytes | |||
-rw-r--r-- | data/heart.png | bin | 0 -> 220 bytes | |||
-rw-r--r-- | data/item_fence.png (renamed from data/tool_stpick.png) | bin | 990 -> 1264 bytes | |||
-rw-r--r-- | data/menulogo.png | bin | 0 -> 498 bytes | |||
-rw-r--r-- | data/oerkki1.png | bin | 0 -> 212 bytes | |||
-rw-r--r-- | data/scripts/objects/test/client.lua | 137 | ||||
-rw-r--r-- | data/scripts/objects/test/server.lua | 322 | ||||
-rw-r--r-- | data/sign_wall.png | bin | 0 -> 489 bytes | |||
-rw-r--r-- | data/skybox1.png | bin | 0 -> 236 bytes | |||
-rw-r--r-- | data/skybox1_dawn.png | bin | 0 -> 598 bytes | |||
-rw-r--r-- | data/skybox1_night.png | bin | 0 -> 2247 bytes | |||
-rw-r--r-- | data/skybox2.png | bin | 0 -> 231 bytes | |||
-rw-r--r-- | data/skybox2_dawn.png | bin | 0 -> 199 bytes | |||
-rw-r--r-- | data/skybox2_night.png | bin | 0 -> 2583 bytes | |||
-rw-r--r-- | data/skybox3.png | bin | 0 -> 190 bytes | |||
-rw-r--r-- | data/skybox3_dawn.png | bin | 0 -> 190 bytes | |||
-rw-r--r-- | data/skybox3_night.png | bin | 0 -> 190 bytes | |||
-rw-r--r-- | data/steel_block.png | bin | 0 -> 219 bytes | |||
-rw-r--r-- | data/steel_ingot.png | bin | 0 -> 207 bytes | |||
-rw-r--r-- | data/stick.png | bin | 947 -> 182 bytes | |||
-rw-r--r-- | data/stone.png | bin | 846 -> 806 bytes | |||
-rw-r--r-- | data/tool_mesepick.png | bin | 990 -> 252 bytes | |||
-rw-r--r-- | data/tool_steelaxe.png | bin | 0 -> 209 bytes | |||
-rw-r--r-- | data/tool_steelpick.png | bin | 0 -> 271 bytes | |||
-rw-r--r-- | data/tool_steelshovel.png | bin | 0 -> 216 bytes | |||
-rw-r--r-- | data/tool_stoneaxe.png | bin | 0 -> 193 bytes | |||
-rw-r--r-- | data/tool_stonepick.png | bin | 0 -> 262 bytes | |||
-rw-r--r-- | data/tool_stoneshovel.png | bin | 0 -> 203 bytes | |||
-rw-r--r-- | data/tool_woodaxe.png | bin | 0 -> 190 bytes | |||
-rw-r--r-- | data/tool_woodpick.png | bin | 0 -> 245 bytes | |||
-rw-r--r-- | data/tool_woodshovel.png | bin | 0 -> 203 bytes | |||
-rw-r--r-- | data/tool_wpick.png | bin | 989 -> 0 bytes | |||
-rw-r--r-- | data/water.png | bin | 1033 -> 518 bytes |
41 files changed, 0 insertions, 459 deletions
diff --git a/data/chest_front.png b/data/chest_front.png Binary files differnew file mode 100644 index 000000000..c5628af94 --- /dev/null +++ b/data/chest_front.png diff --git a/data/chest_side.png b/data/chest_side.png Binary files differnew file mode 100644 index 000000000..916dd784d --- /dev/null +++ b/data/chest_side.png diff --git a/data/chest_top.png b/data/chest_top.png Binary files differnew file mode 100644 index 000000000..58c79674d --- /dev/null +++ b/data/chest_top.png diff --git a/data/cobble.png b/data/cobble.png Binary files differnew file mode 100644 index 000000000..7d0447419 --- /dev/null +++ b/data/cobble.png diff --git a/data/furnace_front.png b/data/furnace_front.png Binary files differnew file mode 100644 index 000000000..1620a27c3 --- /dev/null +++ b/data/furnace_front.png diff --git a/data/furnace_side.png b/data/furnace_side.png Binary files differnew file mode 100644 index 000000000..63cb162fe --- /dev/null +++ b/data/furnace_side.png diff --git a/data/glass.png b/data/glass.png Binary files differnew file mode 100644 index 000000000..8598ce670 --- /dev/null +++ b/data/glass.png diff --git a/data/grass.png b/data/grass.png Binary files differindex a8071b501..3610bb2bc 100644 --- a/data/grass.png +++ b/data/grass.png diff --git a/data/grass_side.png b/data/grass_side.png Binary files differindex 3971aaf8d..4f4f680be 100644 --- a/data/grass_side.png +++ b/data/grass_side.png diff --git a/data/heart.png b/data/heart.png Binary files differnew file mode 100644 index 000000000..ddd273dd2 --- /dev/null +++ b/data/heart.png diff --git a/data/tool_stpick.png b/data/item_fence.png Binary files differindex 9ca3a5e03..76a461878 100644 --- a/data/tool_stpick.png +++ b/data/item_fence.png diff --git a/data/menulogo.png b/data/menulogo.png Binary files differnew file mode 100644 index 000000000..76595c48d --- /dev/null +++ b/data/menulogo.png diff --git a/data/oerkki1.png b/data/oerkki1.png Binary files differnew file mode 100644 index 000000000..c32fb99db --- /dev/null +++ b/data/oerkki1.png diff --git a/data/scripts/objects/test/client.lua b/data/scripts/objects/test/client.lua deleted file mode 100644 index a685721a1..000000000 --- a/data/scripts/objects/test/client.lua +++ /dev/null @@ -1,137 +0,0 @@ --- Client-side code of the test lua object - --- --- Some helper functions and classes --- - -function split(str, pat) - local t = {} -- NOTE: use {n = 0} in Lua-5.0 - local fpat = "(.-)" .. pat - local last_end = 1 - local s, e, cap = str:find(fpat, 1) - while s do - if s ~= 1 or cap ~= "" then - table.insert(t,cap) - end - last_end = e+1 - s, e, cap = str:find(fpat, last_end) - end - if last_end <= #str then - cap = str:sub(last_end) - table.insert(t, cap) - end - return t -end - --- For debugging -function dump(o) - if type(o) == 'table' then - local s = '{ ' - for k,v in pairs(o) do - if type(k) ~= 'number' then k = '"'..k..'"' end - s = s .. '['..k..'] = ' .. dump(v) .. ',' - end - return s .. '} ' - else - return tostring(o) - end -end - -function vector_subtract(a, b) - return {X=a.X-b.X, Y=a.Y-b.Y, Z=a.Z-b.Z} -end - -function vector_add(a, b) - return {X=a.X+b.X, Y=a.Y+b.Y, Z=a.Z+b.Z} -end - -function vector_multiply(a, d) - return {X=a.X*d, Y=a.Y*d, Z=a.Z*d} -end - -SmoothTranslator = {} -SmoothTranslator.__index = SmoothTranslator - -function SmoothTranslator.create() - local obj = {} - setmetatable(obj, SmoothTranslator) - obj.vect_old = {X=0, Y=0, Z=0} - obj.anim_counter = 0 - obj.anim_time = 0 - obj.anim_time_counter = 0 - obj.vect_show = {X=0, Y=0, Z=0} - obj.vect_aim = {X=0, Y=0, Z=0} - return obj -end - -function SmoothTranslator:update(vect_new) - self.vect_old = self.vect_show - self.vect_aim = vect_new - if self.anim_time < 0.001 or self.anim_time > 1.0 then - self.anim_time = self.anim_time_counter - else - self.anim_time = self.anim_time * 0.9 + self.anim_time_counter * 0.1 - end - self.anim_time_counter = 0 - self.anim_counter = 0 -end - -function SmoothTranslator:translate(dtime) - self.anim_time_counter = self.anim_time_counter + dtime - self.anim_counter = self.anim_counter + dtime - vect_move = vector_subtract(self.vect_aim, self.vect_old) - moveratio = 1.0 - if self.anim_time > 0.001 then - moveratio = self.anim_time_counter / self.anim_time - end - -- Move a bit less than should, to avoid oscillation - moveratio = moveratio * 0.8 - if moveratio > 1.5 then - moveratio = 1.5 - end - self.vect_show = vector_add(self.vect_old, vector_multiply(vect_move, moveratio)) -end - --- --- Actual code --- - -pos_trans = SmoothTranslator.create() -rot_trans = SmoothTranslator.create() - --- Callback functions - -function on_step(self, dtime) - pos_trans:translate(dtime) - rot_trans:translate(dtime) - object_set_position(self, pos_trans.vect_show) - object_set_rotation(self, rot_trans.vect_show) -end - -function on_process_message(self, data) - --print("client got message: " .. data) - - -- Receive our custom messages - - sp = split(data, " ") - if sp[1] == "pos" then - pos_trans:update({X=sp[2], Y=sp[3], Z=sp[4]}) - end - if sp[1] == "rot" then - rot_trans:update({X=sp[2], Y=sp[3], Z=sp[4]}) - end -end - -function on_initialize(self, data) - print("client object got initialization: " .. data) - - corners = { - {-1/2,-1/2, 0}, - { 1/2,-1/2, 0}, - { 1/2, 0, 0}, - {-1/2, 0, 0}, - } - object_add_to_mesh(self, "rat.png", corners, false) - -end - diff --git a/data/scripts/objects/test/server.lua b/data/scripts/objects/test/server.lua deleted file mode 100644 index 1213e2fe6..000000000 --- a/data/scripts/objects/test/server.lua +++ /dev/null @@ -1,322 +0,0 @@ --- Server-side code of the test lua object - --- --- Some helper functions and classes --- - --- For debugging -function dump(o) - if type(o) == 'table' then - local s = '{ ' - for k,v in pairs(o) do - if type(k) ~= 'number' then k = '"'..k..'"' end - s = s .. '['..k..'] = ' .. dump(v) .. ',' - end - return s .. '} ' - else - return tostring(o) - end -end - -function table.copy(t) - local t2 = {} - for k,v in pairs(t) do - t2[k] = v - end - return t2 -end - -function vector_zero() - return {X=0,Y=0,Z=0} -end - -function vector_subtract(a, b) - return {X=a.X-b.X, Y=a.Y-b.Y, Z=a.Z-b.Z} -end - -function vector_add(a, b) - return {X=a.X+b.X, Y=a.Y+b.Y, Z=a.Z+b.Z} -end - -function vector_multiply(a, d) - return {X=a.X*d, Y=a.Y*d, Z=a.Z*d} -end - -function vector_copy(a) - return {X=a.X, Y=a.Y, Z=a.Z} -end - -function vector_length(a) - return math.sqrt(a.X*a.X + a.Y*a.Y + a.Z*a.Z) -end - -function vector_eq(a, b) - return (a.X==b.X and a.Y==b.Y and a.Z==b.Z) -end - -function round(num, idp) - local mult = 10^(idp or 0) - return math.floor(num * mult + 0.5) / mult -end - -function vector_snap(a) - return {X=round(a.X, 0), Y=round(a.Y, 0), Z=round(a.Z, 0)} -end - --- --- Actual code --- - -CONTENT_STONE = 0 - -is_digger = false -counter = 0 -counter2 = 0 -counter3 = 0 -counter4 = 0 -counter_move = 0 -death_counter = 0 --- This is set in on_initialize() -position = {X=0,Y=0,Z=0} -starting_position = {X=0,Y=0,Z=0} -rotation = {X=0, Y=math.random(0,360), Z=0} -y_dir = 1 -temp1 = 0 -speed = 1.5 -main_dir = {X=0,Y=0,Z=0} - -function dir_goodness(env, pos, dir) - if vector_eq(dir, vector_zero()) then - return -1 - end - p = vector_add(pos, dir) - n = env_get_node(env, p) - f = get_content_features(n.content) - if f.walkable then - p.Y = p.Y + 1 - n = env_get_node(env, p) - f = get_content_features(n.content) - if f.walkable then - -- Too high - return -1 - end - -- Hill - return 2 - end - p.Y = p.Y - 1 - n = env_get_node(env, p) - f = get_content_features(n.content) - if f.walkable then - -- Flat - return 1 - end - -- Drop - return 0 -end - -function on_step(self, dtime) - -- Limit step to a sane value; it jumps a lot while the map generator - -- is in action - if dtime > 0.5 then - dtime = 0.5 - end - - env = object_get_environment(self) - - --[[ - -- Returned value has these fields: - -- * int content - -- * int param1 - -- * int param2 - p = {X=position.X, Y=position.Y-0.35, Z=position.Z} - n = env_get_node(env, p) - f = get_content_features(n.content) - if f.walkable then - y_dir = 1 - else - y_dir = -1 - end - -- Keep the object approximately at ground level - position.Y = position.Y + dtime * 2.0 * y_dir - - -- Move the object around - position.X = position.X + math.cos(math.pi+rotation.Y/180*math.pi) - * dtime * speed - position.Z = position.Z + math.sin(math.pi+rotation.Y/180*math.pi) - * dtime * speed - - -- Rotate the object if it is too far from the starting point - counter3 = counter3 - dtime - if counter3 < 0 then - counter3 = counter3 + 1 - diff = vector_subtract(position, starting_position) - d = vector_length(diff) - --print("pos="..dump(position).." starting="..dump(starting_position)) - --print("diff=" .. dump(diff)) - --print("d=" .. d) - if d > 3 then - rotation.Y = rotation.Y + 90 - --rotation.Y = rotation.Y + math.random(-180, 180) - end - end - - -- This value has to be set; it determines to which player the - -- object is near to and such - object_set_base_position(self, position) - - counter4 = counter4 - dtime - if counter4 < 0 then - --counter4 = counter4 + math.random(0.5,8) - counter4 = counter4 + 0.6/speed - -- Mess around with the map - if is_digger == true then - np = vector_add(position, {X=0,Y=-0.6,Z=0}) - env_dig_node(env, np) - else - np = vector_add(position, {X=0,Y=0,Z=0}) - env_place_node(env, np, {content=0}) - end - end - --]] - - counter_move = counter_move - dtime - if counter_move < 0 then - counter_move = counter_move + 1/speed - if counter_move < 0 then counter_move = 0 end - - old_position = vector_copy(position) - - dirs = { - {X=1, Y=0, Z=0}, - {X=-1, Y=0, Z=0}, - {X=0, Y=0, Z=1}, - {X=0, Y=0, Z=-1} - } - - best_dir = main_dir - best_goodness = dir_goodness(env, position, main_dir) - - for k,v in ipairs(dirs) do - -- Don't go directly backwards - if not vector_eq(vector_subtract(vector_zero(), v), main_dir) then - goodness = dir_goodness(env, position, v) - if goodness > best_goodness then - best_dir = v - goodness = best_goodness - end - end - end - - -- Place stone block when dir changed - if not vector_eq(main_dir, best_dir) then - np = vector_add(position, {X=0,Y=0,Z=0}) - env_place_node(env, np, {content=CONTENT_STONE}) - end - - main_dir = best_dir - - position = vector_add(position, main_dir) - - pos_diff = vector_subtract(position, old_position) - rotation.Y = math.atan2(pos_diff.Z, pos_diff.X)/math.pi*180-180 - - -- Returned value has these fields: - -- * int content - -- * int param1 - -- * int param2 - p = {X=position.X, Y=position.Y, Z=position.Z} - n = env_get_node(env, p) - f = get_content_features(n.content) - if f.walkable then - position.Y = position.Y + 1 - end - p = {X=position.X, Y=position.Y-1, Z=position.Z} - n = env_get_node(env, p) - f = get_content_features(n.content) - if not f.walkable then - position.Y = position.Y - 1 - end - - -- Center in the middle of the node - position = vector_snap(position) - end - - -- This value has to be set; it determines to which player the - -- object is near to and such - object_set_base_position(self, position) - - --[[ - counter4 = counter4 - dtime - if counter4 < 0 then - --counter4 = counter4 + math.random(0.5,8) - counter4 = counter4 + 0.6/speed - -- Mess around with the map - if is_digger == true then - np = vector_add(position, {X=0,Y=-0.6,Z=0}) - env_dig_node(env, np) - else - np = vector_add(position, {X=0,Y=0,Z=0}) - env_place_node(env, np, {content=0}) - end - end - --]] - - ---[[ - -- Send some custom messages at a custom interval - - counter = counter - dtime - if counter < 0 then - counter = counter + 0.25 - if counter < 0 then - counter = 0 - end - - message = "pos " .. position.X .. " " .. position.Y .. " " .. position.Z - object_add_message(self, message) - - message = "rot " .. rotation.X .. " " .. rotation.Y .. " " .. rotation.Z - object_add_message(self, message) - end - --]] - - -- Remove the object after some time - death_counter = death_counter + dtime - if death_counter > 40 then - object_remove(self) - end - -end - --- This stuff is passed to a newly created client-side counterpart of this object -function on_get_client_init_data(self) - -- Just return some data for testing - return "result of get_client_init_data" -end - --- This should return some data that mostly saves the state of this object --- Not completely implemented yet -function on_get_server_init_data(self) - -- Just return some data for testing - return "result of get_server_init_data" -end - --- When the object is loaded from scratch, this is called before the first --- on_step(). Data is an empty string or the output of an object spawner --- hook, but such things are not yet implemented. --- --- At reload time, the last output of get_server_init_data is passed as data. --- --- This should initialize the position of the object to the value returned --- by object_get_base_position(self) --- --- Not completely implemented yet --- -function on_initialize(self, data) - print("server object got initialization: " .. data) - position = object_get_base_position(self) - starting_position = vector_copy(position); - if math.random() < 0.5 then - is_digger = true - end -end - diff --git a/data/sign_wall.png b/data/sign_wall.png Binary files differnew file mode 100644 index 000000000..06eac1ee9 --- /dev/null +++ b/data/sign_wall.png diff --git a/data/skybox1.png b/data/skybox1.png Binary files differnew file mode 100644 index 000000000..9801d5f4f --- /dev/null +++ b/data/skybox1.png diff --git a/data/skybox1_dawn.png b/data/skybox1_dawn.png Binary files differnew file mode 100644 index 000000000..9711c4781 --- /dev/null +++ b/data/skybox1_dawn.png diff --git a/data/skybox1_night.png b/data/skybox1_night.png Binary files differnew file mode 100644 index 000000000..32e43a63e --- /dev/null +++ b/data/skybox1_night.png diff --git a/data/skybox2.png b/data/skybox2.png Binary files differnew file mode 100644 index 000000000..a8c94b4d2 --- /dev/null +++ b/data/skybox2.png diff --git a/data/skybox2_dawn.png b/data/skybox2_dawn.png Binary files differnew file mode 100644 index 000000000..a761dff2d --- /dev/null +++ b/data/skybox2_dawn.png diff --git a/data/skybox2_night.png b/data/skybox2_night.png Binary files differnew file mode 100644 index 000000000..beb07a9cf --- /dev/null +++ b/data/skybox2_night.png diff --git a/data/skybox3.png b/data/skybox3.png Binary files differnew file mode 100644 index 000000000..2776ec712 --- /dev/null +++ b/data/skybox3.png diff --git a/data/skybox3_dawn.png b/data/skybox3_dawn.png Binary files differnew file mode 100644 index 000000000..22c8cbef5 --- /dev/null +++ b/data/skybox3_dawn.png diff --git a/data/skybox3_night.png b/data/skybox3_night.png Binary files differnew file mode 100644 index 000000000..bb509789b --- /dev/null +++ b/data/skybox3_night.png diff --git a/data/steel_block.png b/data/steel_block.png Binary files differnew file mode 100644 index 000000000..8e2020081 --- /dev/null +++ b/data/steel_block.png diff --git a/data/steel_ingot.png b/data/steel_ingot.png Binary files differnew file mode 100644 index 000000000..f6c9414e7 --- /dev/null +++ b/data/steel_ingot.png diff --git a/data/stick.png b/data/stick.png Binary files differindex 7a4663cc3..2d31797f0 100644 --- a/data/stick.png +++ b/data/stick.png diff --git a/data/stone.png b/data/stone.png Binary files differindex d085cb8dd..cad0dbe2b 100644 --- a/data/stone.png +++ b/data/stone.png diff --git a/data/tool_mesepick.png b/data/tool_mesepick.png Binary files differindex 886f4b21c..a1f3812e0 100644 --- a/data/tool_mesepick.png +++ b/data/tool_mesepick.png diff --git a/data/tool_steelaxe.png b/data/tool_steelaxe.png Binary files differnew file mode 100644 index 000000000..390dbb087 --- /dev/null +++ b/data/tool_steelaxe.png diff --git a/data/tool_steelpick.png b/data/tool_steelpick.png Binary files differnew file mode 100644 index 000000000..7982dafeb --- /dev/null +++ b/data/tool_steelpick.png diff --git a/data/tool_steelshovel.png b/data/tool_steelshovel.png Binary files differnew file mode 100644 index 000000000..ed8413846 --- /dev/null +++ b/data/tool_steelshovel.png diff --git a/data/tool_stoneaxe.png b/data/tool_stoneaxe.png Binary files differnew file mode 100644 index 000000000..0c5414af5 --- /dev/null +++ b/data/tool_stoneaxe.png diff --git a/data/tool_stonepick.png b/data/tool_stonepick.png Binary files differnew file mode 100644 index 000000000..b34de6f32 --- /dev/null +++ b/data/tool_stonepick.png diff --git a/data/tool_stoneshovel.png b/data/tool_stoneshovel.png Binary files differnew file mode 100644 index 000000000..ba5243101 --- /dev/null +++ b/data/tool_stoneshovel.png diff --git a/data/tool_woodaxe.png b/data/tool_woodaxe.png Binary files differnew file mode 100644 index 000000000..34f54eff9 --- /dev/null +++ b/data/tool_woodaxe.png diff --git a/data/tool_woodpick.png b/data/tool_woodpick.png Binary files differnew file mode 100644 index 000000000..ea728cca3 --- /dev/null +++ b/data/tool_woodpick.png diff --git a/data/tool_woodshovel.png b/data/tool_woodshovel.png Binary files differnew file mode 100644 index 000000000..649ab4c38 --- /dev/null +++ b/data/tool_woodshovel.png diff --git a/data/tool_wpick.png b/data/tool_wpick.png Binary files differdeleted file mode 100644 index 359249515..000000000 --- a/data/tool_wpick.png +++ /dev/null diff --git a/data/water.png b/data/water.png Binary files differindex a304059e3..e5f8cdc25 100644 --- a/data/water.png +++ b/data/water.png |