Dump unused boat code

This commit is contained in:
Wuzzy 2017-06-12 23:23:14 +02:00
parent df3062f86f
commit 3c0eade540

View file

@ -54,36 +54,6 @@ local boat = {
removed = false
}
--[[
--###################
--################### BOAT
--###################
mobs:register_mob("amc:81boat", {
type = "animal",
passive = true,
runaway = true,
stepheight = 1.2,
hp_min = 30,
hp_max = 60,
armor = 150,
collisionbox = {-0.35, -0.01, -0.35, 0.35, 2, 0.35},
rotate = -180,
visual = "mesh",
mesh = "boat.b3d",
textures = {{"boat.png"},{"boat1.png"},{"boat2.png"},{"boat3.png"},{"boat4.png"},{"boat5.png"},{"boat6.png"},},
visual_size = {x=3, y=3},
walk_velocity = 0.6,
run_velocity = 2,
jump = true,
animation = {
speed_normal = 25, speed_run = 50,
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 40,
run_start = 0, run_end = 40,
},
})
]]
function boat.on_rightclick(self, clicker)
if not clicker or not clicker:is_player() then
return
@ -251,151 +221,6 @@ function boat.on_step(self, dtime)
self.object:setacceleration(new_acce)
end
--mc2code
--[[
--
-- Helper functions
--
local init = os.clock()
local function is_water(pos)
local nn = minetest.get_node(pos).name
return minetest.get_item_group(nn, "water") ~= 0
end
local function get_velocity(v, yaw, y)
local x = -math.sin(yaw)*v
local z = math.cos(yaw)*v
return {x=x, y=y, z=z}
end
--
-- boat entity
--
local boat = {
physical = true,
--collisionbox = {-1,-0.5,-1, 1,0.5,1},
collisionbox = {-0.5, -0.35, -0.5, 0.5, 0.3, 0.5},
visual = "mesh",
--mesh = "mcl_boats_base.x",
mesh = "boats_boat.obj",
--textures = {"mcl_boats_texture.png"},
textures = {"default_wood.png"},
_driver = nil,
_v = 0,
_stepcount = 0,
_unattended = 0
}
function boat.on_rightclick(self, clicker)
if not clicker or not clicker:is_player() then
return
end
if self._driver and clicker == self._driver then
self._driver = nil
clicker:set_detach()
elseif not self._driver then
self._driver = clicker
clicker:set_attach(self.object, "", {x=0,y=5,z=0}, {x=0,y=0,z=0})
self.object:setyaw(clicker:get_look_yaw())
end
end
function boat.on_activate(self, staticdata, dtime_s)
self.object:set_armor_groups({immortal=1})
if staticdata then
self._v = tonumber(staticdata)
end
end
function boat.get_staticdata(self)
return tostring(self._v)
end
function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, direction)
if self._driver then
self._driver:set_detach()
self._driver = nil
if puncher and puncher:is_player() and (not minetest.setting_getbool("creative_mode")) then
puncher:get_inventory():add_item("main", "mcl_boats:boat")
end
self.object:remove()
else
if puncher and puncher:is_player() and (not minetest.setting_getbool("creative_mode")) then
puncher:get_inventory():add_item("main", "mcl_boats:boat")
end
self.object:remove()
end
end
function boat.on_step(self, dtime)
self._stepcount=self._stepcount+1
if self._stepcount>9 then
self._stepcount=0
if self._driver then
local ctrl = self._driver:get_player_control()
self._unattended=0
local yaw = self.object:getyaw()
if ctrl.up and self._v<6 then --was3
self._v = self._v + 1
end
if ctrl.down and self._v>=-1 then
self._v = self._v - 1
end
if ctrl.left then
if ctrl.down then
self.object:setyaw(yaw-math.pi/12-dtime*math.pi/12)
else
self.object:setyaw(yaw+math.pi/12+dtime*math.pi/12)
end
end
if ctrl.right then
if ctrl.down then
self.object:setyaw(yaw+math.pi/12+dtime*math.pi/12)
else
self.object:setyaw(yaw-math.pi/12-dtime*math.pi/12)
end
end
end
local tmp_velocity = get_velocity(self._v, self.object:getyaw(), 0)
local tmp_pos = self.object:getpos()
tmp_velocity.y=0
if is_water(tmp_pos) then
tmp_velocity.y=2
end
tmp_pos.y=tmp_pos.y-0.5
if minetest.get_node(tmp_pos).name=="air" then
tmp_velocity.y=-2
end
self.object:setvelocity(tmp_velocity)
end
end
]]
local boat_ids = { "boat", "boat_spruce", "boat_birch", "boat_jungle", "boat_acacia", "boat_dark_oak" }
local names = { "Oak Boat", "Spruce Boat", "Birch Boat", "Jungle Boat", "Acacia Boat", "Dark Oak Boat" }
local craftstuffs = { "mcl_core:wood", "mcl_core:sprucewood", "mcl_core:birchwood", "mcl_core:junglewood", "mcl_core:acaciawood", "mcl_core:darkwood" }