Distributor models (2)
This commit is contained in:
parent
fc63935d37
commit
5d1fb50aa4
@ -4,9 +4,8 @@ local INVENTORY_BUFFER = 32
|
||||
local DEFAULT_INVENTORY_SIZE = 32
|
||||
local LABEL_BUFFER = 48
|
||||
|
||||
|
||||
local item_lists = {
|
||||
{ 'machine:conveyor_mono', 'terrain:grass_teal', 'terrain:stone_mountain' },
|
||||
{ 'machine:conveyor_mono', 'machine:distributor' },
|
||||
{ 'machine:mining_drill' },
|
||||
{ 'wall:bottom_cobalt', 'wall:bottom_titanium', 'wall:bottom_copper', 'wall:ladder' },
|
||||
{ 'wall:bottom_copper', 'terrain:grass_teal' },
|
||||
@ -21,9 +20,9 @@ minetest.register_craftitem('hud:item_placeholder', {
|
||||
inventory_image = 'hud_item_placeholder.png',
|
||||
on_place = function(_, player, target)
|
||||
local name = player:get_player_name()
|
||||
local hud = hud_status[name]
|
||||
local menu = hud.state[name].menu_state
|
||||
local inv = player:get_inventory()
|
||||
local item = inv:get_stack('game_category_' .. hud.selected._, hud.selected[hud.selected._])
|
||||
local item = inv:get_stack('menu_category_' .. menu.selected._, menu.selected[menu.selected._])
|
||||
local def = minetest.registered_items[item:get_name()]
|
||||
if def.on_place then
|
||||
def.on_place(item, player, target)
|
||||
|
@ -17,8 +17,8 @@ local last_status = nil
|
||||
local status = {
|
||||
wave = 1,
|
||||
wave_max = 10,
|
||||
wait = 15,
|
||||
wait_max = 15,
|
||||
wait = 180,
|
||||
wait_max = 180,
|
||||
enemies = 10,
|
||||
enemies_max = 10
|
||||
}
|
||||
|
@ -1,2 +1,3 @@
|
||||
dofile(minetest.get_modpath('machine') .. '/script/conveyor.lua')
|
||||
dofile(minetest.get_modpath('machine') .. '/script/distributor.lua')
|
||||
dofile(minetest.get_modpath('machine') .. '/script/mining_drill.lua')
|
||||
|
BIN
mods/machine/models/_Blender/machine_distributor.blend
Normal file
BIN
mods/machine/models/_Blender/machine_distributor.blend
Normal file
Binary file not shown.
BIN
mods/machine/models/_Blender/machine_distributor.blend1
Normal file
BIN
mods/machine/models/_Blender/machine_distributor.blend1
Normal file
Binary file not shown.
BIN
mods/machine/models/_Blender/machine_distributor_2.blend
Normal file
BIN
mods/machine/models/_Blender/machine_distributor_2.blend
Normal file
Binary file not shown.
BIN
mods/machine/models/_Blender/machine_distributor_2.blend1
Normal file
BIN
mods/machine/models/_Blender/machine_distributor_2.blend1
Normal file
Binary file not shown.
BIN
mods/machine/models/_Blender/machine_splitter.blend1
Normal file
BIN
mods/machine/models/_Blender/machine_splitter.blend1
Normal file
Binary file not shown.
BIN
mods/machine/models/machine_distributor_2.b3d
Normal file
BIN
mods/machine/models/machine_distributor_2.b3d
Normal file
Binary file not shown.
BIN
mods/machine/models/machine_distributor_entity.b3d
Normal file
BIN
mods/machine/models/machine_distributor_entity.b3d
Normal file
Binary file not shown.
BIN
mods/machine/models/machine_distributor_node.b3d
Normal file
BIN
mods/machine/models/machine_distributor_node.b3d
Normal file
Binary file not shown.
@ -137,8 +137,9 @@ for _, type in ipairs({ 'horizontal_start', 'horizontal_mid', 'horizontal_end',
|
||||
aspect_h = 8,
|
||||
length = 0.25
|
||||
} }, 'machine_conveyor_frame.png' },
|
||||
description = type == 'mono' and 'Conveyor Belt' or nil,
|
||||
_cost = type == 'mono' and { copper = 1 } or nil,
|
||||
description = 'Belt',
|
||||
_cost = { copper = 2 },
|
||||
inventory_image = 'machine_conveyor_belt_inventory.png',
|
||||
selection_box = {
|
||||
type = 'fixed',
|
||||
fixed = selection_box
|
||||
@ -151,8 +152,8 @@ for _, type in ipairs({ 'horizontal_start', 'horizontal_mid', 'horizontal_end',
|
||||
paramtype2 = 'facedir',
|
||||
sunlight_propagates = true,
|
||||
groups = {
|
||||
creative_dig = 1,
|
||||
conveyor = type:match('vertical') and 2 or 1,
|
||||
oddly_breakable_by_hand = 3,
|
||||
not_in_creative_inventory = type ~= 'mono' and 1 or 0
|
||||
},
|
||||
drop = '',
|
||||
|
103
mods/machine/script/distributor.lua
Normal file
103
mods/machine/script/distributor.lua
Normal file
@ -0,0 +1,103 @@
|
||||
local dir_to_adj = {
|
||||
[1] = { x = 1, y = 0, z = 0 },
|
||||
[2] = { x = 0, y = 0, z = 1 },
|
||||
[3] = { x = -1, y = 0, z = 0 },
|
||||
[4] = { x = 0, y = 0, z = -1 }
|
||||
}
|
||||
|
||||
-- minetest.register_entity('machine:distributor_entity', {
|
||||
-- visual = 'mesh',
|
||||
-- visual_size = vector.new(10, 10, 10),
|
||||
-- mesh = 'machine_distributor_entity.b3d',
|
||||
-- pointable = false,
|
||||
-- on_activate = function(self, static_data)
|
||||
-- self.node_pos = (minetest.deserialize(static_data) or {}).node_pos
|
||||
-- self.dir = 0
|
||||
-- self.delta = 0
|
||||
-- self.till_next = 1
|
||||
-- end,
|
||||
-- on_step = function(self, delta)
|
||||
-- self.delta = self.delta + delta
|
||||
|
||||
-- if self.till_next <= 0 then
|
||||
-- local next = nil
|
||||
-- for i = self.dir + 7, self.dir + 1, -1 do
|
||||
-- local dir = (i - 1) % 4 + 1
|
||||
-- local adj = vector.add(self.node_pos, dir_to_adj[dir])
|
||||
-- local node = minetest.get_node(adj)
|
||||
-- local is_conveyor = ((minetest.registered_nodes[node.name] or {}).groups or {}).conveyor
|
||||
|
||||
-- if is_conveyor then
|
||||
-- next = dir
|
||||
-- break
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- if next then self.dir = next end
|
||||
-- self.till_next = 1
|
||||
-- self.object:set_rotation({ x = 0, y = math.rad((next + 2) * 90), z = 0 })
|
||||
-- else
|
||||
-- self.till_next = self.till_next - delta
|
||||
-- end
|
||||
|
||||
-- self.object:set_properties({
|
||||
-- textures = {
|
||||
-- '[combine:14x8:0,' .. (-(math.floor(self.delta * 20) % 4) * 8) .. '=machine_distributor_belt.png',
|
||||
-- 'machine_distributor_frame_entity.png'
|
||||
-- }
|
||||
-- })
|
||||
|
||||
-- -- local rot = math.floor(self.delta / 3) % 4
|
||||
-- -- if not self.last_rot or rot ~= self.last_rot then
|
||||
-- -- self.object:set_rotation({ x = 0, y = math.rad(rot * 90), z = 0 })
|
||||
-- -- self.last_rot = rot
|
||||
-- -- end
|
||||
-- end,
|
||||
-- get_staticdata = function(self)
|
||||
-- return minetest.serialize({ node_pos = self.node_pos })
|
||||
-- end
|
||||
-- })
|
||||
|
||||
minetest.register_node('machine:distributor', {
|
||||
description = 'Distributor',
|
||||
_cost = { copper = 5 },
|
||||
drawtype = 'mesh',
|
||||
use_texture_alpha = 'clip',
|
||||
mesh = 'machine_distributor_2.b3d',
|
||||
inventory_image = 'machine_distributor_inventory.png',
|
||||
tiles = { 'machine_distributor_2.png' },
|
||||
use_texture_alpha = 'opaque',
|
||||
-- tiles = { 'machine_distributor_frame.png', 'machine_conveyor_belt_strip.png' },
|
||||
selection_box = {
|
||||
type = 'fixed',
|
||||
fixed = {
|
||||
{ -8/16, -2/16, -8/16, 8/16, 8/16, 8/16 },
|
||||
{ -10/16, -8/16, -10/16, 10/16, -2/16, 10/16 }
|
||||
}
|
||||
},
|
||||
collision_box = {
|
||||
type = 'fixed',
|
||||
fixed = { -8/16, -8/16, -8/16, 8/16, 8/16, 8/16 }
|
||||
},
|
||||
paramtype = 'light',
|
||||
paramtype2 = 'facedir',
|
||||
sunlight_propagates = true,
|
||||
groups = {
|
||||
conveyor = 3,
|
||||
creative_dig = 1,
|
||||
},
|
||||
drop = '',
|
||||
on_construct = function(pos)
|
||||
-- minetest.add_entity(pos, 'machine:distributor_entity', minetest.serialize({ node_pos = pos }))
|
||||
end,
|
||||
after_destruct = function(pos)
|
||||
local entities = minetest.get_objects_in_area(pos, pos)
|
||||
for _, entity in ipairs(entities) do
|
||||
local lua_entity = entity:get_luaentity()
|
||||
if lua_entity and lua_entity.node_pos.x == pos.x and lua_entity.node_pos.y == pos.y
|
||||
and lua_entity.node_pos.z == pos.z then
|
||||
entity:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
BIN
mods/machine/textures/machine_conveyor_belt_inventory.png
Normal file
BIN
mods/machine/textures/machine_conveyor_belt_inventory.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
BIN
mods/machine/textures/machine_distributor_2.png
Normal file
BIN
mods/machine/textures/machine_distributor_2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
mods/machine/textures/machine_distributor_belt.png
Normal file
BIN
mods/machine/textures/machine_distributor_belt.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
BIN
mods/machine/textures/machine_distributor_frame.png
Normal file
BIN
mods/machine/textures/machine_distributor_frame.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
BIN
mods/machine/textures/machine_distributor_frame_entity.png
Normal file
BIN
mods/machine/textures/machine_distributor_frame_entity.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
BIN
mods/machine/textures/machine_distributor_inventory.png
Normal file
BIN
mods/machine/textures/machine_distributor_inventory.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
Loading…
x
Reference in New Issue
Block a user