switch to stylua
parent
a0cc26549a
commit
0d2d7cd883
15
.lua-format
15
.lua-format
|
@ -1,15 +0,0 @@
|
|||
column_limit: 120
|
||||
use_tab: true
|
||||
indent_width: 1
|
||||
continuation_indent_width: 1
|
||||
keep_simple_function_one_line: false
|
||||
keep_simple_control_block_one_line: false
|
||||
align_args: false
|
||||
align_parameter: false
|
||||
align_table_field: false
|
||||
chop_down_table: true
|
||||
chop_down_parameter: true
|
||||
break_before_table_rb: true
|
||||
break_after_table_lb: true
|
||||
extra_sep_at_table_end: true
|
||||
single_quote_to_double_quote: true
|
|
@ -0,0 +1 @@
|
|||
column_width = 100
|
|
@ -0,0 +1,3 @@
|
|||
lambda/
|
||||
mobkit/
|
||||
behaviors2override.lua
|
|
@ -6,8 +6,7 @@ By submitting additions or changes of any form to this project, you agree to abi
|
|||
* You must add a `Portions Copyright (C) <year> <name>` entree to the LICENSE file (or append to an existing entree) which contains your name (or a pseudonym), the year of your contribution's creation (or a range of years if applicable), and optionally your email address for ease of contact
|
||||
|
||||
# Source Code Formatting Guidelines
|
||||
All source code submitted to this project should have the `format.sh` script run before committing.
|
||||
This script uses the [LuaFormatter](https://github.com/Koihik/LuaFormatter) project.
|
||||
All source code submitted to this project should be formatted using [StyLua](https://github.com/JohnnyMorganz/StyLua) before committing.
|
||||
|
||||
# Texture Creation Guidelines
|
||||
All textures submitted to this project are to abide by the following guidelines whenever applicable, unless waived by a project maintainer:
|
||||
|
|
|
@ -55,7 +55,7 @@ do -- Misc Utility Stuff --
|
|||
end
|
||||
|
||||
function ikea.debug(...)
|
||||
print(dump({...}))
|
||||
print(dump({ ... }))
|
||||
return ...
|
||||
end
|
||||
end
|
||||
|
@ -64,7 +64,7 @@ do -- Nodes --
|
|||
minetest.register_node("ikea:error", {
|
||||
drawtype = "mesh",
|
||||
mesh = "error.obj",
|
||||
tiles = {"unknown_node.png^[colorize:#ff0000:255"},
|
||||
tiles = { "unknown_node.png^[colorize:#ff0000:255" },
|
||||
pointable = false,
|
||||
walkable = false,
|
||||
})
|
||||
|
@ -102,7 +102,7 @@ do -- Extra stdlib functions --
|
|||
|
||||
function table.merge(t1, t2, ...)
|
||||
if ... then
|
||||
local ts = {t2, ...}
|
||||
local ts = { t2, ... }
|
||||
for i = 1, #ts do
|
||||
for k, v in pairs(ts[i]) do
|
||||
t1[k] = v
|
||||
|
@ -126,13 +126,13 @@ do -- Test table.equals --
|
|||
Test Results: %s
|
||||
]]
|
||||
|
||||
local test_table = {"a", "b", c = false, e = {"f", "g", "h", {"h"}}}
|
||||
local test_table = { "a", "b", c = false, e = { "f", "g", "h", { "h" } } }
|
||||
table.insert(test_table, test_table)
|
||||
local results = table.equals(test_table, test_table)
|
||||
local error = error_message:format("table.equals", "true", tostring(results))
|
||||
assert(results, error)
|
||||
|
||||
local results2 = not table.equals({a = 1}, {a = 2})
|
||||
local results2 = not table.equals({ a = 1 }, { a = 2 })
|
||||
local error2 = error_message:format("table.equals", "false", tostring(results2))
|
||||
assert(results2, error2)
|
||||
end
|
||||
|
|
|
@ -1,15 +1,45 @@
|
|||
-- Power Down Sound --
|
||||
ikea.register_on_tod(ikea.closing_time, function()
|
||||
minetest.sound_play({name = "ikea_power_down", gain = 0.15, pitch = 1.0})
|
||||
minetest.sound_play({ name = "ikea_power_down", gain = 0.15, pitch = 1.0 })
|
||||
end)
|
||||
|
||||
do -- Music --
|
||||
local tracks = {
|
||||
{name = "jahzzar_cddc_aisles", length = 216, title = "Aisles", author = "Jahzzar", license = "CC-BY-SA"},
|
||||
{name = "jahzzar_cddc_deadpanned", length = 274, title = "Deadpanned", author = "Jahzzar", license = "CC-BY-SA"},
|
||||
{name = "jahzzar_cddc_mantra", length = 176, title = "Mantra", author = "Jahzzar", license = "CC-BY-SA"},
|
||||
{name = "jahzzar_cddc_pure", length = 246, title = "Pure", author = "Jahzzar", license = "CC-BY-SA"},
|
||||
{name = "jahzzar_cddc_siste_viator", length = 118, title = "Siste Viator", author = "Jahzzar", license = "CC-BY-SA"},
|
||||
{
|
||||
name = "jahzzar_cddc_aisles",
|
||||
length = 216,
|
||||
title = "Aisles",
|
||||
author = "Jahzzar",
|
||||
license = "CC-BY-SA",
|
||||
},
|
||||
{
|
||||
name = "jahzzar_cddc_deadpanned",
|
||||
length = 274,
|
||||
title = "Deadpanned",
|
||||
author = "Jahzzar",
|
||||
license = "CC-BY-SA",
|
||||
},
|
||||
{
|
||||
name = "jahzzar_cddc_mantra",
|
||||
length = 176,
|
||||
title = "Mantra",
|
||||
author = "Jahzzar",
|
||||
license = "CC-BY-SA",
|
||||
},
|
||||
{
|
||||
name = "jahzzar_cddc_pure",
|
||||
length = 246,
|
||||
title = "Pure",
|
||||
author = "Jahzzar",
|
||||
license = "CC-BY-SA",
|
||||
},
|
||||
{
|
||||
name = "jahzzar_cddc_siste_viator",
|
||||
length = 118,
|
||||
title = "Siste Viator",
|
||||
author = "Jahzzar",
|
||||
license = "CC-BY-SA",
|
||||
},
|
||||
}
|
||||
|
||||
local music_gain = 0.1
|
||||
|
|
|
@ -9,12 +9,12 @@ minetest.register_node("ikea_facsimile:container", {
|
|||
paramtype2 = "none",
|
||||
is_ground_content = true,
|
||||
sunlight_propagates = true,
|
||||
groups = {static = 1},
|
||||
groups = { static = 1 },
|
||||
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
local name = ikea_facsimile.facsimiles[itemstack:get_name()]
|
||||
|
||||
if itemstack:is_empty() or (not name) then
|
||||
if itemstack:is_empty() or not name then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
|
@ -26,7 +26,7 @@ minetest.register_node("ikea_facsimile:container", {
|
|||
})
|
||||
|
||||
minetest.register_on_mods_loaded(function()
|
||||
for _, name in ipairs(ikea.get_nodes_by_groups({facsimile = 1})) do
|
||||
for _, name in ipairs(ikea.get_nodes_by_groups({ facsimile = 1 })) do
|
||||
local def = minetest.registered_nodes[name]
|
||||
local fax_name = string.format("ikea_facsimile:%s__%s", name:match("([A-z_]+):([A-z_]+)"))
|
||||
ikea_facsimile.facsimiles[name] = fax_name
|
||||
|
@ -41,7 +41,7 @@ minetest.register_on_mods_loaded(function()
|
|||
paramtype = "light",
|
||||
paramtype2 = def.paramtype2,
|
||||
light_source = def.light_source,
|
||||
groups = {carryable = 1},
|
||||
groups = { carryable = 1 },
|
||||
drop = name,
|
||||
|
||||
after_dig_node = function(pos, node, oldmetadata, digger)
|
||||
|
|
|
@ -1,18 +1,27 @@
|
|||
local malm_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.875, 0.5, 1.4375, 0.875, -0.5, 1.5}, -- Headboard
|
||||
{-0.875, 0.0, 1.4375, 0.8125, -0.5, -0.6875}, -- Everything Else
|
||||
{ -0.875, 0.5, 1.4375, 0.875, -0.5, 1.5 }, -- Headboard
|
||||
{ -0.875, 0.0, 1.4375, 0.8125, -0.5, -0.6875 }, -- Everything Else
|
||||
},
|
||||
}
|
||||
|
||||
minetest.register_node("ikea_furniture:malm", table.merge(ikea.default_mesh(), {
|
||||
description = "Malm Bed",
|
||||
mesh = "ikea_beds_malm.obj",
|
||||
tiles = {"ikea_beds_malm.png"},
|
||||
use_texture_alpha = "clip",
|
||||
selection_box = malm_box,
|
||||
collision_box = malm_box,
|
||||
groups = table.merge(ikea_furniture.default_groups(), {size_x = 2, size_z = 2, bed = 1, bedroom = 1}),
|
||||
tool_capabilities = {full_punch_interval = 15, damage_groups = {fleshy = 30}},
|
||||
}))
|
||||
minetest.register_node(
|
||||
"ikea_furniture:malm",
|
||||
table.merge(ikea.default_mesh(), {
|
||||
description = "Malm Bed",
|
||||
mesh = "ikea_beds_malm.obj",
|
||||
tiles = { "ikea_beds_malm.png" },
|
||||
use_texture_alpha = "clip",
|
||||
selection_box = malm_box,
|
||||
collision_box = malm_box,
|
||||
groups = table.merge(
|
||||
ikea_furniture.default_groups(),
|
||||
{ size_x = 2, size_z = 2, bed = 1, bedroom = 1 }
|
||||
),
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 15,
|
||||
damage_groups = { fleshy = 30 },
|
||||
},
|
||||
})
|
||||
)
|
||||
|
|
|
@ -1,41 +1,55 @@
|
|||
local vedbo_nodebox = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-7 / 16, -8 / 16, -7 / 16, 7 / 16, 2 / 16, 7 / 16}, -- Bottom
|
||||
{-7 / 16, 2 / 16, 6 / 16, 7 / 16, 16 / 16, 7 / 16}, -- Back
|
||||
{-7 / 16, 2 / 16, -7 / 16, -5 / 16, 4 / 16, 6 / 16}, -- Right Armrest
|
||||
{5 / 16, 2 / 16, -7 / 16, 7 / 16, 4 / 16, 6 / 16}, -- Left Armrest
|
||||
{ -7 / 16, -8 / 16, -7 / 16, 7 / 16, 2 / 16, 7 / 16 }, -- Bottom
|
||||
{ -7 / 16, 2 / 16, 6 / 16, 7 / 16, 16 / 16, 7 / 16 }, -- Back
|
||||
{ -7 / 16, 2 / 16, -7 / 16, -5 / 16, 4 / 16, 6 / 16 }, -- Right Armrest
|
||||
{ 5 / 16, 2 / 16, -7 / 16, 7 / 16, 4 / 16, 6 / 16 }, -- Left Armrest
|
||||
},
|
||||
}
|
||||
|
||||
minetest.register_node("ikea_furniture:vedbo", table.merge(ikea.default_mesh(), {
|
||||
description = "Vedbo Chair (Pink)",
|
||||
mesh = "ikea_chairs_vedbo.obj",
|
||||
tiles = {"ikea_chairs_vedbo.png"},
|
||||
use_texture_alpha = "clip",
|
||||
selection_box = vedbo_nodebox,
|
||||
collision_box = vedbo_nodebox,
|
||||
groups = table.merge(ikea_furniture.default_groups(), ikea_furniture.default_groups_rack(), {chair = 1, lounge = 1}),
|
||||
tool_capabilities = {full_punch_interval = 4, damage_groups = {fleshy = 10}},
|
||||
}))
|
||||
minetest.register_node(
|
||||
"ikea_furniture:vedbo",
|
||||
table.merge(ikea.default_mesh(), {
|
||||
description = "Vedbo Chair (Pink)",
|
||||
mesh = "ikea_chairs_vedbo.obj",
|
||||
tiles = { "ikea_chairs_vedbo.png" },
|
||||
use_texture_alpha = "clip",
|
||||
selection_box = vedbo_nodebox,
|
||||
collision_box = vedbo_nodebox,
|
||||
groups = table.merge(
|
||||
ikea_furniture.default_groups(),
|
||||
ikea_furniture.default_groups_rack(),
|
||||
{ chair = 1, lounge = 1 }
|
||||
),
|
||||
tool_capabilities = { full_punch_interval = 4, damage_groups = { fleshy = 10 } },
|
||||
})
|
||||
)
|
||||
|
||||
local svenbertil_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.437484, 0.937491, 0.313884, 0.437516, 0.124991, 0.376384}, -- Back
|
||||
{-0.437484, 0.124991, -0.436116, 0.437516, 0.062491, 0.376384}, -- Seat
|
||||
{-0.374984, 0.062491, -0.373616, -0.312484, -0.500009, 0.313884}, -- Left
|
||||
{0.312516, 0.062491, -0.373616, 0.375016, -0.500009, 0.313884}, -- Right
|
||||
{ -0.437484, 0.937491, 0.313884, 0.437516, 0.124991, 0.376384 }, -- Back
|
||||
{ -0.437484, 0.124991, -0.436116, 0.437516, 0.062491, 0.376384 }, -- Seat
|
||||
{ -0.374984, 0.062491, -0.373616, -0.312484, -0.500009, 0.313884 }, -- Left
|
||||
{ 0.312516, 0.062491, -0.373616, 0.375016, -0.500009, 0.313884 }, -- Right
|
||||
},
|
||||
}
|
||||
|
||||
minetest.register_node("ikea_furniture:svenbertil", table.merge(ikea.default_mesh(), {
|
||||
description = "Svenbertil Chair",
|
||||
mesh = "ikea_chairs_svenbertil.obj",
|
||||
tiles = {"ikea_chairs_svenbertil.png"},
|
||||
use_texture_alpha = "clip",
|
||||
selection_box = svenbertil_box,
|
||||
collision_box = svenbertil_box,
|
||||
groups = table.merge(ikea_furniture.default_groups(), ikea_furniture.default_groups_rack(), {chair = 1, kitchen = 1}),
|
||||
tool_capabilities = {full_punch_interval = 4, damage_groups = {fleshy = 10}},
|
||||
}))
|
||||
minetest.register_node(
|
||||
"ikea_furniture:svenbertil",
|
||||
table.merge(ikea.default_mesh(), {
|
||||
description = "Svenbertil Chair",
|
||||
mesh = "ikea_chairs_svenbertil.obj",
|
||||
tiles = { "ikea_chairs_svenbertil.png" },
|
||||
use_texture_alpha = "clip",
|
||||
selection_box = svenbertil_box,
|
||||
collision_box = svenbertil_box,
|
||||
groups = table.merge(
|
||||
ikea_furniture.default_groups(),
|
||||
ikea_furniture.default_groups_rack(),
|
||||
{ chair = 1, kitchen = 1 }
|
||||
),
|
||||
tool_capabilities = { full_punch_interval = 4, damage_groups = { fleshy = 10 } },
|
||||
})
|
||||
)
|
||||
|
|
|
@ -4,11 +4,11 @@ ikea_furniture = {}
|
|||
local error_node = minetest.registered_nodes["ikea:error"]
|
||||
|
||||
function ikea_furniture.default_groups()
|
||||
return {carryable = 1, ikea_furniture = 1, size_x = 1, size_y = 1, size_z = 1}
|
||||
return { carryable = 1, ikea_furniture = 1, size_x = 1, size_y = 1, size_z = 1 }
|
||||
end
|
||||
|
||||
function ikea_furniture.default_groups_rack()
|
||||
return {facsimile = 1, spawn_on_rack = 1}
|
||||
return { facsimile = 1, spawn_on_rack = 1 }
|
||||
end
|
||||
|
||||
local modpath = minetest.get_modpath(minetest.get_current_modname()) .. "/"
|
||||
|
@ -17,4 +17,3 @@ dofile(modpath .. "tables.lua")
|
|||
dofile(modpath .. "sofas.lua")
|
||||
dofile(modpath .. "beds.lua")
|
||||
dofile(modpath .. "nightstands.lua")
|
||||
|
||||
|
|
|
@ -1,13 +1,22 @@
|
|||
local hemnes_box = {type = "fixed", fixed = {{-0.25, 0.25, -0.1875, 0.25, -0.5, 0.1875}}}
|
||||
local hemnes_box = {
|
||||
type = "fixed",
|
||||
fixed = { { -0.25, 0.25, -0.1875, 0.25, -0.5, 0.1875 } },
|
||||
}
|
||||
|
||||
minetest.register_node("ikea_furniture:hemnes", table.merge(ikea.default_mesh(), {
|
||||
description = "Hemnes Nightstand",
|
||||
mesh = "ikea_nightstands_hemnes.obj",
|
||||
tiles = {"ikea_nightstands_hemnes.png"},
|
||||
use_texture_alpha = "clip",
|
||||
selection_box = hemnes_box,
|
||||
collision_box = hemnes_box,
|
||||
groups = table.merge(ikea_furniture.default_groups(), ikea_furniture.default_groups_rack(),
|
||||
{nightstand = 1, bedroom = 1}),
|
||||
tool_capabilities = {full_punch_interval = 1, damage_groups = {fleshy = 5}},
|
||||
}))
|
||||
minetest.register_node(
|
||||
"ikea_furniture:hemnes",
|
||||
table.merge(ikea.default_mesh(), {
|
||||
description = "Hemnes Nightstand",
|
||||
mesh = "ikea_nightstands_hemnes.obj",
|
||||
tiles = { "ikea_nightstands_hemnes.png" },
|
||||
use_texture_alpha = "clip",
|
||||
selection_box = hemnes_box,
|
||||
collision_box = hemnes_box,
|
||||
groups = table.merge(
|
||||
ikea_furniture.default_groups(),
|
||||
ikea_furniture.default_groups_rack(),
|
||||
{ nightstand = 1, bedroom = 1 }
|
||||
),
|
||||
tool_capabilities = { full_punch_interval = 1, damage_groups = { fleshy = 5 } },
|
||||
})
|
||||
)
|
||||
|
|
|
@ -1,22 +1,28 @@
|
|||
local landskrona_nodebox = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{24 / 16, -6 / 16, 6 / 16, 22 / 16, 5 / 16, -8 / 16}, -- Left Armrest
|
||||
{-6 / 16, -6 / 16, 6 / 16, -8 / 16, 5 / 16, -8 / 16}, -- Right Armrest
|
||||
{22 / 16, -3 / 16, 3 / 16, -6 / 16, 0 / 16, -9 / 16}, -- Seat Cussion
|
||||
{22 / 16, 8 / 16, 3 / 16, -6 / 16, 0 / 16, 6 / 16}, -- Back Cussion
|
||||
{24 / 16, -6 / 16, -8 / 16, -8 / 16, -3 / 16, -8 / 16}, -- Bottom
|
||||
{24 / 16, -6 / 16, 6 / 16, -8 / 16, 5 / 16, 8 / 16}, -- Back
|
||||
{ 24 / 16, -6 / 16, 6 / 16, 22 / 16, 5 / 16, -8 / 16 }, -- Left Armrest
|
||||
{ -6 / 16, -6 / 16, 6 / 16, -8 / 16, 5 / 16, -8 / 16 }, -- Right Armrest
|
||||
{ 22 / 16, -3 / 16, 3 / 16, -6 / 16, 0 / 16, -9 / 16 }, -- Seat Cussion
|
||||
{ 22 / 16, 8 / 16, 3 / 16, -6 / 16, 0 / 16, 6 / 16 }, -- Back Cussion
|
||||
{ 24 / 16, -6 / 16, -8 / 16, -8 / 16, -3 / 16, -8 / 16 }, -- Bottom
|
||||
{ 24 / 16, -6 / 16, 6 / 16, -8 / 16, 5 / 16, 8 / 16 }, -- Back
|
||||
},
|
||||
}
|
||||
|
||||
minetest.register_node("ikea_furniture:landskrona", table.merge(ikea.default_mesh(), {
|
||||
description = "Landskrona Sofa (Blue)",
|
||||
mesh = "ikea_sofas_landskrona.obj",
|
||||
tiles = {"ikea_sofas_landskrona.png"},
|
||||
use_texture_alpha = "clip",
|
||||
selection_box = landskrona_nodebox,
|
||||
collision_box = landskrona_nodebox,
|
||||
groups = table.merge(ikea_furniture.default_groups(), {size_x = 2, sofa = 1, lounge = 1}),
|
||||
tool_capabilities = {full_punch_interval = 8, damage_groups = {whacking = 20}},
|
||||
}))
|
||||
minetest.register_node(
|
||||
"ikea_furniture:landskrona",
|
||||
table.merge(ikea.default_mesh(), {
|
||||
description = "Landskrona Sofa (Blue)",
|
||||
mesh = "ikea_sofas_landskrona.obj",
|
||||
tiles = { "ikea_sofas_landskrona.png" },
|
||||
use_texture_alpha = "clip",
|
||||
selection_box = landskrona_nodebox,
|
||||
collision_box = landskrona_nodebox,
|
||||
groups = table.merge(ikea_furniture.default_groups(), { size_x = 2, sofa = 1, lounge = 1 }),
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 8,
|
||||
damage_groups = { whacking = 20 },
|
||||
},
|
||||
})
|
||||
)
|
||||
|
|
|
@ -1,42 +1,54 @@
|
|||
local listerby_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.25, 0.00125, -0.3125, 1.25, -0.06125, 0.3125}, -- Tabletop
|
||||
{-0.0625, -0.06125, -0.25, 0.0, -0.49875, 0.25}, -- Left
|
||||
{1.0, -0.06125, -0.25, 1.0625, -0.49875, 0.25}, -- Right
|
||||
{0.0, -0.31125, -0.25, 1.0, -0.37375, 0.25}, -- Shelf
|
||||
{ -0.25, 0.00125, -0.3125, 1.25, -0.06125, 0.3125 }, -- Tabletop
|
||||
{ -0.0625, -0.06125, -0.25, 0.0, -0.49875, 0.25 }, -- Left
|
||||
{ 1.0, -0.06125, -0.25, 1.0625, -0.49875, 0.25 }, -- Right
|
||||
{ 0.0, -0.31125, -0.25, 1.0, -0.37375, 0.25 }, -- Shelf
|
||||
},
|
||||
}
|
||||
|
||||
minetest.register_node("ikea_furniture:listerby", table.merge(ikea.default_mesh(), {
|
||||
description = "Listerby Table",
|
||||
mesh = "ikea_tables_listerby.obj",
|
||||
tiles = {"ikea_tables_listerby.png"},
|
||||
use_texture_alpha = "clip",
|
||||
selection_box = listerby_box,
|
||||
collision_box = listerby_box,
|
||||
groups = table.merge(ikea_furniture.default_groups(), {size_x = 2, table = 1, lounge = 1}),
|
||||
tool_capabilities = {full_punch_interval = 6, damage_groups = {fleshy = 15}},
|
||||
}))
|
||||
minetest.register_node(
|
||||
"ikea_furniture:listerby",
|
||||
table.merge(ikea.default_mesh(), {
|
||||
description = "Listerby Table",
|
||||
mesh = "ikea_tables_listerby.obj",
|
||||
tiles = { "ikea_tables_listerby.png" },
|
||||
use_texture_alpha = "clip",
|
||||
selection_box = listerby_box,
|
||||
collision_box = listerby_box,
|
||||
groups = table.merge(
|
||||
ikea_furniture.default_groups(),
|
||||
{ size_x = 2, table = 1, lounge = 1 }
|
||||
),
|
||||
tool_capabilities = { full_punch_interval = 6, damage_groups = { fleshy = 15 } },
|
||||
})
|
||||
)
|
||||
|
||||
local lisabo_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.625, 0.5, -0.5625, 1.625, 0.4375, 0.5625}, -- Tabletop
|
||||
{-0.5625, 0.4375, -0.5, 1.5625, 0.375, 0.5}, -- Lower Tabletop
|
||||
{1.4375, 0.375, -0.4375, 1.5, -0.5, -0.375}, -- Front Right Leg
|
||||
{1.4375, 0.375, 0.375, 1.5, -0.5, 0.4375}, -- Back Right Leg
|
||||
{-0.5, 0.375, -0.4375, -0.4375, -0.5, -0.375}, -- Front Left Leg
|
||||
{-0.5, 0.375, 0.375, -0.4375, -0.5, 0.4375}, -- Back Left Leg
|
||||
{ -0.625, 0.5, -0.5625, 1.625, 0.4375, 0.5625 }, -- Tabletop
|
||||
{ -0.5625, 0.4375, -0.5, 1.5625, 0.375, 0.5 }, -- Lower Tabletop
|
||||
{ 1.4375, 0.375, -0.4375, 1.5, -0.5, -0.375 }, -- Front Right Leg
|
||||
{ 1.4375, 0.375, 0.375, 1.5, -0.5, 0.4375 }, -- Back Right Leg
|
||||
{ -0.5, 0.375, -0.4375, -0.4375, -0.5, -0.375 }, -- Front Left Leg
|
||||
{ -0.5, 0.375, 0.375, -0.4375, -0.5, 0.4375 }, -- Back Left Leg
|
||||
},
|
||||
}
|
||||
|
||||
minetest.register_node("ikea_furniture:lisabo", table.merge(ikea.default_mesh(), {
|
||||
description = "Lisabo Table",
|
||||
mesh = "ikea_tables_lisabo.obj",
|
||||
tiles = {"ikea_tables_lisabo.png"},
|
||||
selection_box = lisabo_box,
|
||||
collision_box = lisabo_box,
|
||||
groups = table.merge(ikea_furniture.default_groups(), {size_x = 2, table = 1, kitchen = 1}),
|
||||
tool_capabilities = {full_punch_interval = 6, damage_groups = {fleshy = 15}},
|
||||
}))
|
||||
minetest.register_node(
|
||||
"ikea_furniture:lisabo",
|
||||
table.merge(ikea.default_mesh(), {
|
||||
description = "Lisabo Table",
|
||||
mesh = "ikea_tables_lisabo.obj",
|
||||
tiles = { "ikea_tables_lisabo.png" },
|
||||
selection_box = lisabo_box,
|
||||
collision_box = lisabo_box,
|
||||
groups = table.merge(
|
||||
ikea_furniture.default_groups(),
|
||||
{ size_x = 2, table = 1, kitchen = 1 }
|
||||
),
|
||||
tool_capabilities = { full_punch_interval = 6, damage_groups = { fleshy = 15 } },
|
||||
})
|
||||
)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-- Dust Particles --
|
||||
minetest.register_abm({
|
||||
nodenames = {"group:ikea_fx_dust"},
|
||||
nodenames = { "group:ikea_fx_dust" },
|
||||
interval = 4.00,
|
||||
chance = 1,
|
||||
catch_up = false,
|
||||
|
@ -19,12 +19,20 @@ minetest.register_abm({
|
|||
minetest.add_particlespawner({
|
||||
amount = amount,
|
||||
time = 4,
|
||||
minpos = {x = pos.x - radius, y = center_y - (height / 2), z = pos.z - radius},
|
||||
maxpos = {x = pos.x + radius, y = center_y + (height / 2), z = pos.z + radius},
|
||||
minvel = {x = 0.05, y = 0.00, z = 0.05},
|
||||
maxvel = {x = 0.1, y = 0.01, z = 0.01},
|
||||
minacc = {x = 0, y = 0, z = 0},
|
||||
maxacc = {x = 0, y = 0, z = 0},
|
||||
minpos = {
|
||||
x = pos.x - radius,
|
||||
y = center_y - (height / 2),
|
||||
z = pos.z - radius,
|
||||
},
|
||||
maxpos = {
|
||||
x = pos.x + radius,
|
||||
y = center_y + (height / 2),
|
||||
z = pos.z + radius,
|
||||
},
|
||||
minvel = { x = 0.05, y = 0.00, z = 0.05 },
|
||||
maxvel = { x = 0.1, y = 0.01, z = 0.01 },
|
||||
minacc = { x = 0, y = 0, z = 0 },
|
||||
maxacc = { x = 0, y = 0, z = 0 },
|
||||
minexptime = 8,
|
||||
maxexptime = 32,
|
||||
minsize = 0.1,
|
||||
|
@ -48,7 +56,7 @@ local function toggle_light(pos, node, play_sound)
|
|||
local swap_node = minetest.registered_nodes[node.name].ikea_light_swap_node or "air"
|
||||
|
||||
if is_on ~= is_open then
|
||||
minetest.swap_node(pos, {name = swap_node, param2 = node.param2})
|
||||
minetest.swap_node(pos, { name = swap_node, param2 = node.param2 })
|
||||
if play_sound then
|
||||
minetest.sound_play({
|
||||
name = "ikea_light_toggle",
|
||||
|
@ -67,7 +75,7 @@ local function toggle_light(pos, node, play_sound)
|
|||
end
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"group:ikea_light"},
|
||||
nodenames = { "group:ikea_light" },
|
||||
interval = 1.00,
|
||||
chance = 2,
|
||||
catch_up = false,
|
||||
|
@ -80,7 +88,7 @@ minetest.register_abm({
|
|||
minetest.register_lbm({
|
||||
label = "Light Updater LBM",
|
||||
name = "ikea_fx:light_toggle",
|
||||
nodenames = {"group:ikea_light"},
|
||||
nodenames = { "group:ikea_light" },
|
||||
run_at_every_load = true,
|
||||
|
||||
action = function(pos, node)
|
||||
|
@ -88,4 +96,3 @@ minetest.register_lbm({
|
|||
toggle_light(pos, node, false)
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ local v_sort = vector.sort
|
|||
minetest.register_node("ikea_mapgen:ceiling", {
|
||||
description = "Ceiling node (you hacker you!)",
|
||||
paramtype = "light",
|
||||
tiles = {{name = "ikea_ceiling.png", scale = 16, align_style = "world"}},
|
||||
groups = {static = 1},
|
||||
tiles = { { name = "ikea_ceiling.png", scale = 16, align_style = "world" } },
|
||||
groups = { static = 1 },
|
||||
sunlight_propagates = true,
|
||||
})
|
||||
|
||||
|
@ -22,8 +22,8 @@ minetest.register_node("ikea_mapgen:skylight", {
|
|||
drawtype = "glasslike_framed",
|
||||
paramtype = "light",
|
||||
paramtype2 = "glasslikeliquidlevel",
|
||||
tiles = {"ikea_skylight.png", "ikea_skylight_detail.png"},
|
||||
groups = {static = 1, ikea_fx_dust = 1},
|
||||
tiles = { "ikea_skylight.png", "ikea_skylight_detail.png" },
|
||||
groups = { static = 1, ikea_fx_dust = 1 },
|
||||
sunlight_propagates = true,
|
||||
light_source = 2,
|
||||
pointable = false,
|
||||
|
@ -38,8 +38,7 @@ local department_defaults = {
|
|||
set_data = function(data, param2s, va, x, z, edges)
|
||||
data[1] = get_content_id("ikea:error")
|
||||
end,
|
||||
on_place = function(context, vm, x, z)
|
||||
end,
|
||||
on_place = function(context, vm, x, z) end,
|
||||
}
|
||||
|
||||
local function register_department(def_raw)
|
||||
|
@ -56,11 +55,11 @@ end
|
|||
-- Utility Functions --
|
||||
local function node_or_ignore(node)
|
||||
if type(node) == "string" then
|
||||
return {name = node}
|
||||
return { name = node }
|
||||
elseif type(node) == "table" then
|
||||
return node
|
||||
else
|
||||
return {name = "ignore"}
|
||||
return { name = "ignore" }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -79,7 +78,7 @@ end
|
|||
|
||||
-- Returns The Decimal Places Of A Random Number
|
||||
local function tail_perlin(Perlin, x, y, z)
|
||||
local num = Perlin:get_3d({x = x, y = y, z = z})
|
||||
local num = Perlin:get_3d({ x = x, y = y, z = z })
|
||||
return num - m_floor(num)
|
||||
end
|
||||
|
||||
|
@ -124,7 +123,7 @@ do -- Map Generation --
|
|||
Perlin = minetest.get_perlin({
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x = 1, y = 1, z = 1},
|
||||
spread = { x = 1, y = 1, z = 1 },
|
||||
seed = 42,
|
||||
octaves = 1,
|
||||
persistence = 0,
|
||||
|
@ -135,8 +134,8 @@ do -- Map Generation --
|
|||
max_depth = max_depth,
|
||||
min_depth = min_depth,
|
||||
k = 2,
|
||||
min_pos = {-mapgen_block_limit, -mapgen_block_limit},
|
||||
max_pos = {mapgen_block_limit, mapgen_block_limit},
|
||||
min_pos = { -mapgen_block_limit, -mapgen_block_limit },
|
||||
max_pos = { mapgen_block_limit, mapgen_block_limit },
|
||||
})
|
||||
end)
|
||||
|
||||
|
@ -157,14 +156,20 @@ do -- Map Generation --
|
|||
end
|
||||
end
|
||||
|
||||
return applicable_departments[bound_perlin(Perlin, #applicable_departments, median[1], 42, median[2]) or 1]
|
||||
return applicable_departments[bound_perlin(
|
||||
Perlin,
|
||||
#applicable_departments,
|
||||
median[1],
|
||||
42,
|
||||
median[2]
|
||||
) or 1]
|
||||
end
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||
local data = vm:get_data()
|
||||
local param2s = vm:get_param2_data()
|
||||
local va = VoxelArea:new{MinEdge = emin, MaxEdge = emax}
|
||||
local va = VoxelArea:new({ MinEdge = emin, MaxEdge = emax })
|
||||
|
||||
for z = minp.z, maxp.z, 16 do
|
||||
for x = minp.x, maxp.x, 16 do
|
||||
|
@ -172,7 +177,10 @@ do -- Map Generation --
|
|||
local mapblock_x = x / 16
|
||||
local mapblock_z = z / 16
|
||||
|
||||
local node_depth, node_median, node_min, node_max = kd:get_node({mapblock_x, mapblock_z})
|
||||
local node_depth, node_median, node_min, node_max = kd:get_node({
|
||||
mapblock_x,
|
||||
mapblock_z,
|
||||
})
|
||||
|
||||
local department = get_department(node_depth, node_median)
|
||||
|
||||
|
@ -185,10 +193,10 @@ do -- Map Generation --
|
|||
}
|
||||
|
||||
for k, v in pairs({
|
||||
n = {mapblock_x, mapblock_z + 1},
|
||||
s = {mapblock_x, mapblock_z - 1},
|
||||
e = {mapblock_x + 1, mapblock_z},
|
||||
w = {mapblock_x - 1, mapblock_z},
|
||||
n = { mapblock_x, mapblock_z + 1 },
|
||||
s = { mapblock_x, mapblock_z - 1 },
|
||||
e = { mapblock_x + 1, mapblock_z },
|
||||
w = { mapblock_x - 1, mapblock_z },
|
||||
}) do
|
||||
if edges[k] then
|
||||
local neighbor_depth, neighbor_median, _, _ = kd:get_node(v)
|
||||
|
@ -199,11 +207,22 @@ do -- Map Generation --
|
|||
|
||||
department.set_data(data, param2s, va, x, z, edges, node_min, node_max)
|
||||
|
||||
fill_vmanip_area(data, va, v_new(x, ceiling_height, z), v_new(x + 15, ceiling_height, z + 15), c_ceiling)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x, ceiling_height, z),
|
||||
v_new(x + 15, ceiling_height, z + 15),
|
||||
c_ceiling
|
||||
)
|
||||
|
||||
if bound_perlin(Perlin, 8, mapblock_x, 42, mapblock_z) == 1 then
|
||||
fill_vmanip_area(data, va, v_new(x + 4, ceiling_height, z + 1), v_new(x + 15 - 4, ceiling_height, z + 15 - 1),
|
||||
c_skylight)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x + 4, ceiling_height, z + 1),
|
||||
v_new(x + 15 - 4, ceiling_height, z + 15 - 1),
|
||||
c_skylight
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -26,7 +26,7 @@ end
|
|||
|
||||
function kd_tree:get_node(pos)
|
||||
local k, Perlin = self.k, self.Perlin
|
||||
local min, max = {unpack(self.min_pos)}, {unpack(self.max_pos)}
|
||||
local min, max = { unpack(self.min_pos) }, { unpack(self.max_pos) }
|
||||
local min_depth, max_depth = self.min_depth, self.max_depth
|
||||
local depth = 0
|
||||
|
||||
|
@ -42,14 +42,15 @@ function kd_tree:get_node(pos)
|
|||
if depth < min_depth then
|
||||
should_split = true
|
||||
elseif depth < max_depth then
|
||||
should_split = bound_perlin(Perlin, 2, median[1], median[2] or depth, median[3] or 0) == 1
|
||||
should_split = bound_perlin(Perlin, 2, median[1], median[2] or depth, median[3] or 0)
|
||||
== 1
|
||||
end
|
||||
|
||||
if not should_split then
|
||||
return depth, median, min, max
|
||||
end
|
||||
|
||||
local axis = ((depth) % k) + 1
|
||||
local axis = (depth % k) + 1
|
||||
|
||||
if pos[axis] < median[axis] then
|
||||
-- closer to child node A (left side)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
local player_data = {}
|
||||
|
||||
--[[ Player Setup ]] --
|
||||
-- Player Setup --
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
-- Initialize Data --
|
||||
local name = player:get_player_name()
|
||||
|
@ -15,28 +15,39 @@ minetest.register_on_joinplayer(function(player)
|
|||
inv:set_stack("main", 1, ItemStack("ikea_tools:flashlight_off"))
|
||||
|
||||
-- Physics --
|
||||
player:set_physics_override({speed = 1, jump = 0, sneak = false, sneak_glitch = false, new_move = true})
|
||||
player:set_properties({stepheight = 0})
|
||||
player:set_physics_override({
|
||||
speed = 1,
|
||||
jump = 0,
|
||||
sneak = false,
|
||||
sneak_glitch = false,
|
||||
new_move = true,
|
||||
})
|
||||
player:set_properties({ stepheight = 0 })
|
||||
|
||||
-- Skybox --
|
||||
player:set_sky({
|
||||
type = "regular",
|
||||
sky_color = {day_horizon = "#414141", dawn_horizon = "#303030", night_horizon = "#303030", indoors = "#303030"},
|
||||
sky_color = {
|
||||
day_horizon = "#414141",
|
||||
dawn_horizon = "#303030",
|
||||
night_horizon = "#303030",
|
||||
indoors = "#303030",
|
||||
},
|
||||
})
|
||||
|
||||
-- Status Vignette --
|
||||
player:hud_set_flags({healthbar = false})
|
||||
player:hud_set_flags({ healthbar = false })
|
||||
player_data[name].vign_id = player:hud_add({
|
||||
name = "Player Status Vignette",
|
||||
hud_elem_type = "image",
|
||||
alignment = {x = 1, y = 1},
|
||||
scale = {x = -100, y = -100},
|
||||
alignment = { x = 1, y = 1 },
|
||||
scale = { x = -100, y = -100 },
|
||||
text = "ikea_player_vignette.png^[opacity:0",
|
||||
z_index = -400,
|
||||
})
|
||||
end)
|
||||
|
||||
--[[ Player Updates ]] --
|
||||
-- Player Updates --
|
||||
local timer = 0
|
||||
local hp_timer = 0
|
||||
|
||||
|
@ -63,9 +74,9 @@ minetest.register_globalstep(function(dtime)
|
|||
end
|
||||
|
||||
-- Satus Vignette --
|
||||
if (not data.hp_last) or (hp ~= data.hp_last) then
|
||||
local vign_texture = "(ikea_player_vignette.png^[multiply:#5c3d41)^[opacity:" ..
|
||||
tostring((1 - (hp / props.hp_max)) * 255)
|
||||
if not data.hp_last or (hp ~= data.hp_last) then
|
||||
local vign_texture = "(ikea_player_vignette.png^[multiply:#5c3d41)^[opacity:"
|
||||
.. tostring((1 - (hp / props.hp_max)) * 255)
|
||||
|
||||
if not data.vign_id then
|
||||
error("Player Vignette ID Not Set!")
|
||||
|
@ -85,32 +96,33 @@ minetest.register_on_leaveplayer(function(player)
|
|||
player_data[name] = nil
|
||||
end)
|
||||
|
||||
--[[ Hand ]] --
|
||||
local STATIC_GROUPCAP --
|
||||
-- Hand --
|
||||
local STATIC_GROUPCAP
|
||||
if DEBUG then
|
||||
STATIC_GROUPCAP = {times = {[1] = 1.00}, uses = 0}
|
||||
STATIC_GROUPCAP = { times = { [1] = 1.00 }, uses = 0 }
|
||||
end
|
||||
|
||||
minetest.register_item(":", {
|
||||
type = "none",
|
||||
wield_image = "wieldhand.png",
|
||||
wield_scale = {x = 1, y = 1, z = 3},
|
||||
wield_scale = { x = 1, y = 1, z = 3 },
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 0.5,
|
||||
max_drop_level = 0,
|
||||
groupcaps = {
|
||||
static = STATIC_GROUPCAP,
|
||||
|
||||
oddly_breakable_by_hand = {times = {[1] = 1.00}, uses = 0},
|
||||
oddly_breakable_by_hand = { times = { [1] = 1.00 }, uses = 0 },
|
||||
|
||||
carryable = {times = {[1] = 1.00}, uses = 0},
|
||||
carryable = { times = { [1] = 1.00 }, uses = 0 },
|
||||
},
|
||||
damage_groups = {fleshy = 2},
|
||||
damage_groups = { fleshy = 2 },
|
||||
},
|
||||
})
|
||||
|
||||
--[[ General Behavior ]] --
|
||||
-- Disable Item Dropping --
|
||||
-- General Behavior --
|
||||
|
||||
-- Disable Item Dropping
|
||||
function minetest.item_drop(itemstack, user, pointed_thing)
|
||||
return -- Nothing!
|
||||
return
|
||||
end
|
||||
|
|
|
@ -48,8 +48,8 @@ ikea_mapgen.register_department({
|
|||
-- The mapblock position for +X and +Z will be short
|
||||
-- of the actual edge when converting to section coords
|
||||
-- so we have to add to compensate
|
||||
max_pos = {(kd_node_max[1] * 2) + 1, (kd_node_max[2] * 2) + 1},
|
||||
min_pos = {kd_node_min[1] * 2, kd_node_min[2] * 2},
|
||||
max_pos = { (kd_node_max[1] * 2) + 1, (kd_node_max[2] * 2) + 1 },
|
||||
min_pos = { kd_node_min[1] * 2, kd_node_min[2] * 2 },
|
||||
})
|
||||
|
||||
local x_max = x + 15
|
||||
|
@ -69,33 +69,86 @@ ikea_mapgen.register_department({
|
|||
-- Sections --
|
||||
for x2 = x, x_max, 8 do
|
||||
for z2 = z, z_max, 8 do
|
||||
local depth, median, min, max = kd:get_node({x2 / 8, z2 / 8})
|
||||
local depth, median, min, max = kd:get_node({ x2 / 8, z2 / 8 })
|
||||
local section = bound_perlin(Perlin, 3, median[1], 0, median[2])
|
||||
min = {min[1] * 8, min[2] * 8}
|
||||
max = {max[1] * 8, max[2] * 8}
|
||||
min = { min[1] * 8, min[2] * 8 }
|
||||
max = { max[1] * 8, max[2] * 8 }
|
||||
|
||||
local x2_max = x2 + 7
|
||||
local z2_max = z2 + 7
|
||||
|
||||
local section_edges = {w = x2 == min[1], e = x2 == max[1], s = z2 == min[2], n = z2 == max[2]}
|
||||
local section_edges = {
|
||||
w = x2 == min[1],
|
||||
e = x2 == max[1],
|
||||
s = z2 == min[2],
|
||||
n = z2 == max[2],
|
||||
}
|
||||
|
||||
if section <= 2 then -- Sitting Area --
|
||||
-- Seperators --
|
||||
if section_edges.w and (edges.w and not edges.inner.w) then
|
||||
fill_vmanip_area(data, va, v_new(x2, 1, z2 + 1), v_new(x2, 1, z2 + 3), c_seperator_z)
|
||||
fill_vmanip_area(data, va, v_new(x2, 1, z2_max - 1), v_new(x2, 1, z2_max - 3), c_seperator_z)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x2, 1, z2 + 1),
|
||||
v_new(x2, 1, z2 + 3),
|
||||
c_seperator_z
|
||||
)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x2, 1, z2_max - 1),
|
||||
v_new(x2, 1, z2_max - 3),
|
||||
c_seperator_z
|
||||
)
|
||||
end
|
||||
if section_edges.e and (edges.e and not edges.inner.e) then
|
||||
fill_vmanip_area(data, va, v_new(x2_max, 1, z2 + 1), v_new(x2_max, 1, z2 + 3), c_seperator_z)
|
||||
fill_vmanip_area(data, va, v_new(x2_max, 1, z2_max - 1), v_new(x2_max, 1, z2_max - 3), c_seperator_z)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x2_max, 1, z2 + 1),
|
||||
v_new(x2_max, 1, z2 + 3),
|
||||
c_seperator_z
|
||||
)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x2_max, 1, z2_max - 1),
|
||||
v_new(x2_max, 1, z2_max - 3),
|
||||
c_seperator_z
|
||||
)
|
||||
end
|
||||
if section_edges.s and (edges.s and not edges.inner.s) then
|
||||
fill_vmanip_area(data, va, v_new(x2 + 1, 1, z2), v_new(x2 + 3, 1, z2), c_seperator_x)
|
||||
fill_vmanip_area(data, va, v_new(x2_max - 1, 1, z2), v_new(x2_max - 3, 1, z2), c_seperator_x)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x2 + 1, 1, z2),
|
||||
v_new(x2 + 3, 1, z2),
|
||||
c_seperator_x
|
||||
)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x2_max - 1, 1, z2),
|
||||
v_new(x2_max - 3, 1, z2),
|
||||
c_seperator_x
|
||||
)
|
||||
end
|
||||
if section_edges.n then
|
||||
fill_vmanip_area(data, va, v_new(x2 + 1, 1, z2_max), v_new(x2 + 3, 1, z2_max), c_seperator_x)
|
||||
fill_vmanip_area(data, va, v_new(x2_max - 1, 1, z2_max), v_new(x2_max - 3, 1, z2_max), c_seperator_x)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x2 + 1, 1, z2_max),
|
||||
v_new(x2 + 3, 1, z2_max),
|
||||
c_seperator_x
|
||||
)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x2_max - 1, 1, z2_max),
|
||||
v_new(x2_max - 3, 1, z2_max),
|
||||
c_seperator_x
|
||||
)
|
||||
end
|
||||
|
||||
-- Tables and Chairs --
|
||||
|
@ -124,27 +177,75 @@ ikea_mapgen.register_department({
|
|||
end
|
||||
|
||||
if section_edges.w then
|
||||
fill_vmanip_area(data, va, v_new(x2 + offset_w, 1, z2), v_new(x2 + offset_w, 3, z2_max), c_kitchen_wall)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x2 + offset_w, 1, z2),
|
||||
v_new(x2 + offset_w, 3, z2_max),
|
||||
c_kitchen_wall
|
||||
)
|
||||
end
|
||||
if section_edges.e then
|
||||
fill_vmanip_area(data, va, v_new(x2_max + offset_e, 1, z2), v_new(x2_max + offset_e, 3, z2_max), c_kitchen_wall)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x2_max + offset_e, 1, z2),
|
||||
v_new(x2_max + offset_e, 3, z2_max),
|
||||
c_kitchen_wall
|
||||
)
|
||||
end
|
||||
if section_edges.s then
|
||||
if section_edges.e then
|
||||
fill_vmanip_area(data, va, v_new(x2, 1, z2), v_new(x2_max + offset_e, 3, z2), c_kitchen_wall)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x2, 1, z2),
|
||||
v_new(x2_max + offset_e, 3, z2),
|
||||
c_kitchen_wall
|
||||
)
|
||||
elseif section_edges.w then
|
||||
fill_vmanip_area(data, va, v_new(x2 + offset_w, 1, z2), v_new(x2_max, 3, z2), c_kitchen_wall)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x2 + offset_w, 1, z2),
|
||||
v_new(x2_max, 3, z2),
|
||||
c_kitchen_wall
|
||||
)
|
||||
else
|
||||
fill_vmanip_area(data, va, v_new(x2, 1, z2), v_new(x2_max, 3, z2), c_kitchen_wall)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x2, 1, z2),
|
||||
v_new(x2_max, 3, z2),
|
||||
c_kitchen_wall
|
||||
)
|
||||
end
|
||||
end
|
||||
if section_edges.n then
|
||||
if section_edges.e then
|
||||
fill_vmanip_area(data, va, v_new(x2, 1, z2_max), v_new(x2_max + offset_e, 3, z2_max), c_kitchen_wall)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x2, 1, z2_max),
|
||||
v_new(x2_max + offset_e, 3, z2_max),
|
||||
c_kitchen_wall
|
||||
)
|
||||
elseif section_edges.w then
|
||||
fill_vmanip_area(data, va, v_new(x2 + offset_w, 1, z2_max), v_new(x2_max, 3, z2_max), c_kitchen_wall)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x2 + offset_w, 1, z2_max),
|
||||
v_new(x2_max, 3, z2_max),
|
||||
c_kitchen_wall
|
||||
)
|
||||
else
|
||||
fill_vmanip_area(data, va, v_new(x2, 1, z2_max), v_new(x2_max, 3, z2_max), c_kitchen_wall)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x2, 1, z2_max),
|
||||
v_new(x2_max, 3, z2_max),
|
||||
c_kitchen_wall
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
minetest.register_node("ikea_restaurant:floor", {
|
||||
description = "Restaurant Floor (you hacker you!)",
|
||||
drawtype = "normal",
|
||||
tiles = {{name = "ikea_restaurant_floor.png", align_style = "world", scale = 16}},
|
||||
tiles = {
|
||||
{ name = "ikea_restaurant_floor.png", align_style = "world", scale = 16 },
|
||||
},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
groups = {static = 1},
|
||||
groups = { static = 1 },
|
||||
})
|
||||
|
||||
minetest.register_node("ikea_restaurant:ceiling_decor", {
|
||||
description = "Restaurant Ceiling Decor (you hacker you!)",
|
||||
drawtype = "mesh",
|
||||
mesh = "ikea_restaurant_ceiling_decor.obj",
|
||||
tiles = {{name = "ikea_restaurant_ceiling_decor.png", backface_culled = false}},
|
||||
tiles = {
|
||||
{ name = "ikea_restaurant_ceiling_decor.png", backface_culled = false },
|
||||
},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
groups = {static = 1},
|
||||
groups = { static = 1 },
|
||||
})
|
||||
|
||||
minetest.register_node("ikea_restaurant:seperator_x", {
|
||||
|
@ -22,23 +26,39 @@ minetest.register_node("ikea_restaurant:seperator_x", {
|
|||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "connected",
|
||||
fixed = {-8 / 16, -8 / 16, -4 / 16, 8 / 16, 8 / 16, 4 / 16},
|
||||
disconnected_left = {-8 / 16, -8 / 16, -4 / 16, -12 / 16, 8 / 16, 4 / 16},
|
||||
disconnected_right = {8 / 16, -8 / 16, -4 / 16, 12 / 16, 8 / 16, 4 / 16},
|
||||
fixed = { -8 / 16, -8 / 16, -4 / 16, 8 / 16, 8 / 16, 4 / 16 },
|
||||
disconnected_left = { -8 / 16, -8 / 16, -4 / 16, -12 / 16, 8 / 16, 4 / 16 },
|
||||
disconnected_right = { 8 / 16, -8 / 16, -4 / 16, 12 / 16, 8 / 16, 4 / 16 },
|
||||
},
|
||||
connect_sides = {"left", "right"},
|
||||
connects_to = {"ikea_restaurant:seperator_x"},
|
||||
connect_sides = { "left", "right" },
|
||||
connects_to = { "ikea_restaurant:seperator_x" },
|
||||
tiles = {
|
||||
{name = "ikea_restaurant_seperator_top.png", align_style = "world", scale = 1},
|
||||
{name = "ikea_restaurant_seperator_top.png", align_style = "world", scale = 1},
|
||||
{name = "ikea_restaurant_seperator_side.png"},
|
||||
{name = "ikea_restaurant_seperator_side.png"},
|
||||
{name = "ikea_restaurant_seperator_front.png", align_style = "world", scale = 1},
|
||||
{name = "ikea_restaurant_seperator_front.png", align_style = "world", scale = 1},
|
||||
{
|
||||
name = "ikea_restaurant_seperator_top.png",
|
||||
align_style = "world",
|
||||
scale = 1,
|
||||
},
|
||||
{
|
||||
name = "ikea_restaurant_seperator_top.png",
|
||||
align_style = "world",
|
||||
scale = 1,
|
||||
},
|
||||
{ name = "ikea_restaurant_seperator_side.png" },
|
||||
{ name = "ikea_restaurant_seperator_side.png" },
|
||||
{
|
||||
name = "ikea_restaurant_seperator_front.png",
|
||||
align_style = "world",
|
||||
scale = 1,
|
||||
},
|
||||
{
|
||||
name = "ikea_restaurant_seperator_front.png",
|
||||
align_style = "world",
|
||||
scale = 1,
|
||||
},
|
||||
},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
groups = {static = 1},
|
||||
groups = { static = 1 },
|
||||
})
|
||||
|
||||
minetest.register_node("ikea_restaurant:seperator_z", {
|
||||
|
@ -46,23 +66,39 @@ minetest.register_node("ikea_restaurant:seperator_z", {
|
|||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "connected",
|
||||
fixed = {-4 / 16, -8 / 16, -8 / 16, 4 / 16, 8 / 16, 8 / 16},
|
||||
disconnected_front = {-4 / 16, -8 / 16, -8 / 16, 4 / 16, 8 / 16, -12 / 16},
|
||||
disconnected_back = {-4 / 16, -8 / 16, 8 / 16, 4 / 16, 8 / 16, 12 / 16},
|
||||
fixed = { -4 / 16, -8 / 16, -8 / 16, 4 / 16, 8 / 16, 8 / 16 },
|
||||
disconnected_front = { -4 / 16, -8 / 16, -8 / 16, 4 / 16, 8 / 16, -12 / 16 },
|
||||
disconnected_back = { -4 / 16, -8 / 16, 8 / 16, 4 / 16, 8 / 16, 12 / 16 },
|
||||
},
|
||||
connect_sides = {"front", "back"},
|
||||
connects_to = {"ikea_restaurant:seperator_z"},
|
||||
connect_sides = { "front", "back" },
|
||||
connects_to = { "ikea_restaurant:seperator_z" },
|
||||
tiles = {
|
||||
{name = "ikea_restaurant_seperator_top.png^[transformR90", align_style = "world", scale = 1},
|
||||
{name = "ikea_restaurant_seperator_top.png^[transformR90", align_style = "world", scale = 1},
|
||||
{name = "ikea_restaurant_seperator_front.png", align_style = "world", scale = 1},
|
||||
{name = "ikea_restaurant_seperator_front.png", align_style = "world", scale = 1},
|
||||
{name = "ikea_restaurant_seperator_side.png"},
|
||||
{name = "ikea_restaurant_seperator_side.png"},
|
||||
{
|
||||
name = "ikea_restaurant_seperator_top.png^[transformR90",
|
||||
align_style = "world",
|
||||
scale = 1,
|
||||
},
|
||||
{
|
||||
name = "ikea_restaurant_seperator_top.png^[transformR90",
|
||||
align_style = "world",
|
||||
scale = 1,
|
||||
},
|
||||
{
|
||||
name = "ikea_restaurant_seperator_front.png",
|
||||
align_style = "world",
|
||||
scale = 1,
|
||||
},
|
||||
{
|
||||
name = "ikea_restaurant_seperator_front.png",
|
||||
align_style = "world",
|
||||
scale = 1,
|
||||
},
|
||||
{ name = "ikea_restaurant_seperator_side.png" },
|
||||
{ name = "ikea_restaurant_seperator_side.png" },
|
||||
},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
groups = {static = 1},
|
||||
groups = { static = 1 },
|
||||
})
|
||||
|
||||
minetest.register_node("ikea_restaurant:table_and_chairs", {
|
||||
|
@ -70,13 +106,13 @@ minetest.register_node("ikea_restaurant:table_and_chairs", {
|
|||
drawtype = "mesh",
|
||||
mesh = "ikea_restaurant_table_and_chairs.obj",
|
||||
paramtype = "light",
|
||||
groups = {static = 1},
|
||||
groups = { static = 1 },
|
||||
})
|
||||
|
||||
minetest.register_node("ikea_restaurant:kitchen_wall", {
|
||||
description = "Restaurant Table and Chairs (you hacker you!)",
|
||||
drawtype = "normal",
|
||||
tiles = {{name = "ikea_restaurant_kitchen_wall.png"}},
|
||||
tiles = { { name = "ikea_restaurant_kitchen_wall.png" } },
|
||||
paramtype = "light",
|
||||
groups = {static = 1},
|
||||
groups = { static = 1 },
|
||||
})
|
||||
|
|
|
@ -1,23 +1,29 @@
|
|||
local table_and_chairs = {
|
||||
name = "Table and Chairs",
|
||||
nodes = {
|
||||
{pos = {x = 1, y = 0, z = 2}, type = "chair"},
|
||||
{pos = {x = 2, y = 0, z = 2}, type = "chair"},
|
||||
{pos = {x = 1, y = 0, z = 1}, type = "table"},
|
||||
{ pos = { x = 1, y = 0, z = 2 }, type = "chair" },
|
||||
{ pos = { x = 2, y = 0, z = 2 }, type = "chair" },
|
||||
{ pos = { x = 1, y = 0, z = 1 }, type = "table" },
|
||||
},
|
||||
}
|
||||
|
||||
local sofa_and_chairs = {
|
||||
name = "Sofa and Chairs",
|
||||
nodes = {{pos = {x = 1, y = 0, z = 2}, type = "sofa"}, {pos = {x = 1, y = 0, z = 1}, type = "table"}},
|
||||
nodes = {
|
||||
{ pos = { x = 1, y = 0, z = 2 }, type = "sofa" },
|
||||
{ pos = { x = 1, y = 0, z = 1 }, type = "table" },
|
||||
},
|
||||
}
|
||||
|
||||
local bed = {name = "Bed", nodes = {{pos = {x = 2, y = 0, z = 1}, type = "bed"}}}
|
||||
local bed = {
|
||||
name = "Bed",
|
||||
nodes = { { pos = { x = 2, y = 0, z = 1 }, type = "bed" } },
|
||||
}
|
||||
|
||||
local rooms = {"kitchen", "lounge", "bedroom"}
|
||||
local rooms = { "kitchen", "lounge", "bedroom" }
|
||||
local displays = {}
|
||||
displays.bedroom = {bed}
|
||||
displays.lounge = {table_and_chairs, sofa_and_chairs}
|
||||
displays.kitchen = {table_and_chairs}
|
||||
displays.bedroom = { bed }
|
||||
displays.lounge = { table_and_chairs, sofa_and_chairs }
|
||||
displays.kitchen = { table_and_chairs }
|
||||
|
||||
return rooms, displays
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
-- Files
|
||||
-- Files --
|
||||
local modpath = minetest.get_modpath("ikea_showroom")
|
||||
dofile(modpath .. "/nodes.lua")
|
||||
local rooms, displays = dofile(modpath .. "/displays.lua")
|
||||
|
||||
-- Local function aliases
|
||||
-- Local function aliases --
|
||||
local fill_vmanip_area = ikea_mapgen.fill_vmanip_area
|
||||
local bound_perlin = ikea_mapgen.bound_perlin
|
||||
local v_new = vector.new
|
||||
|
||||
-- Settings
|
||||
-- Settings --
|
||||
local place_opening = ikea_mapgen.every_n_mapblocks(4)
|
||||
local wall_height = 10
|
||||
local Perlin = PerlinNoise({
|
||||
|
@ -22,7 +22,7 @@ local Perlin = PerlinNoise({
|
|||
flags = "defaults, absvalue",
|
||||
})
|
||||
|
||||
-- Content IDs
|
||||
-- Content IDs --
|
||||
local c_wall = minetest.get_content_id("ikea_showroom:wall")
|
||||
local c_floor = minetest.get_content_id("ikea_showroom:floor")
|
||||
local c_trolley = minetest.get_content_id("ikea_trolley:flatbed")
|
||||
|
@ -43,7 +43,7 @@ ikea_mapgen.register_department({
|
|||
local corner_nwt = v_new(x + 0, wall_height, z + 15)
|
||||
local corner_net = v_new(x + 15, wall_height, z + 15)
|
||||
|
||||
-- Walls
|
||||
-- Walls --
|
||||
if edges.s then
|
||||
fill_vmanip_area(data, va, corner_swb, corner_set, c_wall)
|
||||
end
|
||||
|
@ -57,7 +57,7 @@ ikea_mapgen.register_department({
|
|||
fill_vmanip_area(data, va, corner_swb, corner_nwt, c_wall)
|
||||
end
|
||||
|
||||
-- Inner Walls
|
||||
-- Inner Walls --
|
||||
if (bound_perlin(Perlin, 10, x, 5, z) > 3) and not place_opening(x) then
|
||||
fill_vmanip_area(data, va, v_new(x, 0, z), v_new(x, wall_height, z + 15), c_wall)
|
||||
end
|
||||
|
@ -65,20 +65,44 @@ ikea_mapgen.register_department({
|
|||
fill_vmanip_area(data, va, v_new(x, 0, z), v_new(x + 15, wall_height, z), c_wall)
|
||||
end
|
||||
|
||||
-- Doorways
|
||||
-- Doorways --
|
||||
if place_opening(x) then
|
||||
if edges.s then
|
||||
if edges.inner.s then
|
||||
fill_vmanip_area(data, va, v_new(x + 3, 0, z + 0), v_new(x + 12, 4, z + 0), minetest.CONTENT_AIR)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x + 3, 0, z + 0),
|
||||
v_new(x + 12, 4, z + 0),
|
||||
minetest.CONTENT_AIR
|
||||
)
|
||||
else
|
||||
fill_vmanip_area(data, va, v_new(x + 6, 0, z + 0), v_new(x + 9, 4, z + 0), minetest.CONTENT_AIR)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x + 6, 0, z + 0),
|
||||
v_new(x + 9, 4, z + 0),
|
||||
minetest.CONTENT_AIR
|
||||
)
|
||||
end
|
||||
end
|
||||
if edges.n then
|
||||
if edges.inner.n then
|
||||
fill_vmanip_area(data, va, v_new(x + 3, 0, z + 15), v_new(x + 12, 4, z + 15), minetest.CONTENT_AIR)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x + 3, 0, z + 15),
|
||||
v_new(x + 12, 4, z + 15),
|
||||
minetest.CONTENT_AIR
|
||||
)
|
||||
else
|
||||
fill_vmanip_area(data, va, v_new(x + 6, 0, z + 15), v_new(x + 9, 4, z + 15), minetest.CONTENT_AIR)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x + 6, 0, z + 15),
|
||||
v_new(x + 9, 4, z + 15),
|
||||
minetest.CONTENT_AIR
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -86,22 +110,51 @@ ikea_mapgen.register_department({
|
|||
if place_opening(z) then
|
||||
if edges.e then
|
||||
if edges.inner.e then
|
||||
fill_vmanip_area(data, va, v_new(x + 15, 0, z + 1), v_new(x + 15, 4, z + 10), minetest.CONTENT_AIR)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x + 15, 0, z + 1),
|
||||
v_new(x + 15, 4, z + 10),
|
||||
minetest.CONTENT_AIR
|
||||
)
|
||||
else
|
||||
fill_vmanip_area(data, va, v_new(x + 15, 0, z + 3), v_new(x + 15, 4, z + 6), minetest.CONTENT_AIR)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x + 15, 0, z + 3),
|
||||
v_new(x + 15, 4, z + 6),
|
||||
minetest.CONTENT_AIR
|
||||
)
|
||||
end
|
||||
end
|
||||
if edges.w then
|
||||
if edges.inner.w then
|
||||
fill_vmanip_area(data, va, v_new(x + 0, 0, z + 1), v_new(x + 0, 4, z + 10), minetest.CONTENT_AIR)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x + 0, 0, z + 1),
|
||||
v_new(x + 0, 4, z + 10),
|
||||
minetest.CONTENT_AIR
|
||||
)
|
||||
else
|
||||
fill_vmanip_area(data, va, v_new(x + 0, 0, z + 3), v_new(x + 0, 4, z + 6), minetest.CONTENT_AIR)
|
||||
fill_vmanip_area(
|
||||
data,
|
||||
va,
|
||||
v_new(x + 0, 0, z + 3),
|
||||
v_new(x + 0, 4, z + 6),
|
||||
minetest.CONTENT_AIR
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Furniture
|
||||
if not (((edges.n or edges.s) and place_opening(x)) or ((edges.e or edges.w) and place_opening(z))) then
|
||||
-- Furniture --
|
||||
if
|
||||
not (
|
||||
((edges.n or edges.s) and place_opening(x))
|
||||
or ((edges.e or edges.w) and place_opening(z))
|
||||
)
|
||||
then
|
||||
local room_name = rooms[bound_perlin(Perlin, #rooms, x, 0, z)]
|
||||
|
||||
for x2 = x + 2, x + 13, 4 do
|
||||
|
@ -109,7 +162,7 @@ ikea_mapgen.register_department({
|
|||
local display_id = bound_perlin(Perlin, #displays[room_name], x2, 1, z2)
|
||||
|
||||
for _, v in ipairs(displays[room_name][display_id].nodes) do
|
||||
local groups = {ikea_furniture = 1}
|
||||
local groups = { ikea_furniture = 1 }
|
||||
groups[v.type] = 1
|
||||
groups[room_name] = 1
|
||||
local applicable_furniture = ikea.get_nodes_by_groups(groups)
|
||||
|
@ -120,7 +173,7 @@ ikea_mapgen.register_department({
|
|||
end
|
||||
end
|
||||
end
|
||||
-- Trolleys
|
||||
-- Trolleys --
|
||||
elseif bound_perlin(Perlin, 8, x, 10, z) == 1 then
|
||||
local index = va:index(x + 7, 1, z + 5)
|
||||
data[index] = c_trolley
|
||||
|
@ -135,4 +188,3 @@ ikea_mapgen.register_department({
|
|||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
minetest.register_node("ikea_showroom:floor", {
|
||||
paramtype = "light",
|
||||
description = "Base Floor Node, Do Not Place (You Hacker!)",
|
||||
tiles = {{name = "ikea_showroom_concrete.png"}},
|
||||
groups = {static = 1},
|
||||
tiles = { { name = "ikea_showroom_concrete.png" } },
|
||||
groups = { static = 1 },
|
||||
sunlight_propagates = true,
|
||||
})
|
||||
|
||||
minetest.register_node("ikea_showroom:wall", {
|
||||
paramtype = "light",
|
||||
description = "Base Wall Node, Do Not Place (You Hacker!)",
|
||||
tiles = {{name = "ikea_showroom_wall.png"}},
|
||||
groups = {static = 1},
|
||||
tiles = { { name = "ikea_showroom_wall.png" } },
|
||||
groups = { static = 1 },
|
||||
sunlight_propagates = true,
|
||||
})
|
||||
|
||||
|
|
|
@ -16,19 +16,20 @@ local dbg = minetest.chat_send_all
|
|||
local abr = tonumber(minetest.get_mapgen_setting("active_block_range")) or 3
|
||||
|
||||
local neighbors = {
|
||||
{x = 1, z = 0},
|
||||
{x = 1, z = 1},
|
||||
{x = 0, z = 1},
|
||||
{x = -1, z = 1},
|
||||
{x = -1, z = 0},
|
||||
{x = -1, z = -1},
|
||||
{x = 0, z = -1},
|
||||
{x = 1, z = -1},
|
||||
{ x = 1, z = 0 },
|
||||
{ x = 1, z = 1 },
|
||||
{ x = 0, z = 1 },
|
||||
{ x = -1, z = 1 },
|
||||
{ x = -1, z = 0 },
|
||||
{ x = -1, z = -1 },
|
||||
{ x = 0, z = -1 },
|
||||
{ x = 1, z = -1 },
|
||||
}
|
||||
|
||||
--[[ Movement ]] --
|
||||
-- Movement --
|
||||
function behaviors.lq_yeet(self, tpos)
|
||||
local timer = (self.animation.attack.range.y - self.animation.attack.range.x) / self.animation.attack.speed
|
||||
local timer = (self.animation.attack.range.y - self.animation.attack.range.x)
|
||||
/ self.animation.attack.speed
|
||||
local stage = 1
|
||||
local func = function(self)
|
||||
if stage == 1 then
|
||||
|
@ -56,7 +57,7 @@ function behaviors.lq_yeet(self, tpos)
|
|||
end
|
||||
end
|
||||
timer = timer - self.dtime
|
||||
if (timer < 0) then
|
||||
if timer < 0 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
@ -78,13 +79,16 @@ function behaviors.lq_dumbwalk(self, dest, speed_factor)
|
|||
|
||||
if mobkit.is_there_yet2d(pos, minetest.yaw_to_dir(self.object:get_yaw()), dest) then
|
||||
if not self.isonground or abs(dest.y - pos.y) > 0.1 then -- prevent uncontrolled fall when velocity too high
|
||||
self.object:set_velocity({x = 0, y = y, z = 0})
|
||||
self.object:set_velocity({ x = 0, y = y, z = 0 })
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
if self.isonground then
|
||||
local dir = vector.direction({x = pos.x, y = 0, z = pos.z}, {x = dest.x, y = 0, z = dest.z})
|
||||
local dir = vector.direction(
|
||||
{ x = pos.x, y = 0, z = pos.z },
|
||||
{ x = dest.x, y = 0, z = dest.z }
|
||||
)
|
||||
dir = vector.multiply(dir, self.max_speed * speed_factor)
|
||||
mobkit.turn2yaw(self, minetest.dir_to_yaw(dir))
|
||||
dir.y = y
|
||||
|
@ -129,9 +133,10 @@ function behaviors.goto_next_waypoint(self, tpos)
|
|||
return true
|
||||
end
|
||||
|
||||
--[[ Death ]] --
|
||||
-- Death --
|
||||
function behaviors.lq_fallover(self)
|
||||
local timer = (self.animation.fallover.range.y - self.animation.fallover.range.x) / self.animation.fallover.speed
|
||||
local timer = (self.animation.fallover.range.y - self.animation.fallover.range.x)
|
||||
/ self.animation.fallover.speed
|
||||
local init = true
|
||||
local func = function(self)
|
||||
if init then
|
||||
|
@ -141,11 +146,15 @@ function behaviors.lq_fallover(self)
|
|||
mobkit.turn2yaw(self, yaw, 10)
|
||||
mobkit.animate(self, "fallover")
|
||||
|
||||
self.object:set_pos({x = math.floor(pos.x + 0.5), y = pos.y, z = math.floor(pos.z + 0.5)})
|
||||
self.object:set_velocity({x = 0, y = 0, z = 0})
|
||||
self.object:set_pos({
|
||||
x = math.floor(pos.x + 0.5),
|
||||
y = pos.y,
|
||||
z = math.floor(pos.z + 0.5),
|
||||
})
|
||||
self.object:set_velocity({ x = 0, y = 0, z = 0 })
|
||||
end
|
||||
timer = timer - self.dtime
|
||||
if (timer >= 0) then
|
||||
if timer >= 0 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
@ -153,13 +162,13 @@ function behaviors.lq_fallover(self)
|
|||
end
|
||||
|
||||
function behaviors.hq_die(self)
|
||||
local timer = (self.animation.fallover.range.y - self.animation.fallover.range.x) / self.animation.fallover.speed
|
||||
local timer = (self.animation.fallover.range.y - self.animation.fallover.range.x)
|
||||
/ self.animation.fallover.speed
|
||||
local start = true
|
||||
local func = function(self)
|
||||
if start then
|
||||
behaviors.lq_fallover(self)
|
||||
self.logic = function(self)
|
||||
end -- brain dead as well
|
||||
self.logic = function(self) end -- brain dead as well
|
||||
start = false
|
||||
end
|
||||
timer = timer - self.dtime
|
||||
|
@ -168,7 +177,10 @@ function behaviors.hq_die(self)
|
|||
local height = mobkit.get_terrain_height(pos)
|
||||
local npos = vector.offset(self.object:get_pos(), 0, height, 0)
|
||||
local yaw = self.object:get_yaw()
|
||||
minetest.set_node(npos, {name = "ikea_staff:corpse", param2 = minetest.dir_to_facedir(minetest.yaw_to_dir(yaw))})
|
||||
minetest.set_node(npos, {
|
||||
name = "ikea_staff:corpse",
|
||||
param2 = minetest.dir_to_facedir(minetest.yaw_to_dir(yaw)),
|
||||
})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ local helpers = {}
|
|||
function helpers.randompos(pos, radius)
|
||||
local t = 2 * math.pi * math.random()
|
||||
local r = math.sqrt(math.random()) * radius
|
||||
return {x = pos.x + r * math.cos(t), y = pos.y, z = pos.z + r * math.sin(t)}
|
||||
return { x = pos.x + r * math.cos(t), y = pos.y, z = pos.z + r * math.sin(t) }
|
||||
end
|
||||
|
||||
function helpers.is_visible(pos, height, range)
|
||||
|
@ -15,12 +15,12 @@ function helpers.is_visible(pos, height, range)
|
|||
local eye = table.copy(ppos)
|
||||
eye.y = eye.y + player:get_properties().eye_height
|
||||
local look = player:get_look_dir()
|
||||
local dir = vector.direction(ppos, {x = pos.x, y = pos.y + height, z = pos.z})
|
||||
local dir = vector.direction(ppos, { x = pos.x, y = pos.y + height, z = pos.z })
|
||||
-- Only worry about players facing us
|
||||
if vector.dot(look, dir) > 0 then
|
||||
-- Check all visible parts
|
||||
for i = 0, height do
|
||||
if not Raycast(eye, vector.add(pos, {x = 0, y = i, z = 0}), false):next() then
|
||||
if not Raycast(eye, vector.add(pos, { x = 0, y = i, z = 0 }), false):next() then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
-- SCP-3008-2 IKEA Staff --
|
||||
-- By GreenXenith --
|
||||
-- (Mostly Rewritten By Benrob0329) --
|
||||
-- By GreenXenith
|
||||
-- (Mostly Rewritten By Benrob0329)
|
||||
local PATH = minetest.get_modpath(minetest.get_current_modname()) .. "/"
|
||||
local helpers = dofile(PATH .. "helpers.lua")
|
||||
local behaviors = dofile(PATH .. "behaviors.lua")
|
||||
|
||||
local RANGE = 100
|
||||
|
||||
--[[ Debug Entities ]] --
|
||||
-- Debug Entities --
|
||||
minetest.register_entity("ikea_staff:debug", {
|
||||
visual = "sprite",
|
||||
textures = {"blank.png^[invert:a^[colorize:red"},
|
||||
visual_size = {x = 0.3, y = 0.3},
|
||||
textures = { "blank.png^[invert:a^[colorize:red" },
|
||||
visual_size = { x = 0.3, y = 0.3 },
|
||||
on_activate = function(self, data)
|
||||
self.object:set_nametag_attributes({text = data})
|
||||
self.object:set_nametag_attributes({ text = data })
|
||||
minetest.after(5, function()
|
||||
if self.object then
|
||||
self.object:remove()
|
||||
|
@ -25,7 +25,7 @@ minetest.register_entity("ikea_staff:debug", {
|
|||
end,
|
||||
})
|
||||
|
||||
do --[[ Staff Entity ]] --
|
||||
do -- Staff Entity --
|
||||
-- Global Memory --
|
||||
local player_sightings = {}
|
||||
|
||||
|
@ -36,27 +36,24 @@ do --[[ Staff Entity ]] --
|
|||
collide_with_objects = true,
|
||||
visual = "mesh",
|
||||
mesh = "ikea_staff_member.b3d",
|
||||
textures = {"ikea_staff_member.png"},
|
||||
collisionbox = {-0.45, 0, -0.45, 0.45, 3.1, 0.45},
|
||||
selectionbox = {-0.45, 0, -0.45, 0.45, 3.1, 0.45},
|
||||
textures = { "ikea_staff_member.png" },
|
||||
collisionbox = { -0.45, 0, -0.45, 0.45, 3.1, 0.45 },
|
||||
selectionbox = { -0.45, 0, -0.45, 0.45, 3.1, 0.45 },
|
||||
},
|
||||
|
||||
animation = {
|
||||
stand = {range = {x = 0, y = 140}, speed = 15},
|
||||
walk = {range = {x = 141, y = 181}, speed = 80},
|
||||
attack = {range = {x = 204, y = 244}, speed = 45},
|
||||
fallover = {range = {x = 182, y = 202}, speed = 10, loop = false},
|
||||
},
|
||||
|
||||
-- Stats --
|
||||
armor_groups = {fleshy = 100},
|
||||
stand = { range = { x = 0, y = 140 }, speed = 15 },
|
||||
walk = { range = { x = 141, y = 181 }, speed = 80 },
|
||||
attack = { range = { x = 204, y = 244 }, speed = 45 },
|
||||
fallover = { range = { x = 182, y = 202 }, speed = 10, loop = false },
|
||||
}, -- Stats --
|
||||
armor_groups = { fleshy = 100 },
|
||||
max_hp = 20,
|
||||
timeout = 0,
|
||||
buoyancy = 0,
|
||||
max_speed = 4.5,
|
||||
jump_height = 1,
|
||||
view_range = RANGE,
|
||||
attack = {range = 1, damage_groups = {fleshy = 5}},
|
||||
attack = { range = 1, damage_groups = { fleshy = 5 } },
|
||||
|
||||
-- Base Mobkit Functions --
|
||||
on_activate = mobkit.actfunc,
|
||||
|
@ -67,7 +64,6 @@ do --[[ Staff Entity ]] --
|
|||
self.moveresult = moveresult
|
||||
mobkit.stepfunc(self, dtime)
|
||||
end,
|
||||
|
||||
logic = function(self)
|
||||
if mobkit.timer(self, 1) then
|
||||
-- Vitals and Death
|
||||
|
@ -117,10 +113,12 @@ do --[[ Staff Entity ]] --
|
|||
mobkit.remember(self, "is_open", is_open)
|
||||
end
|
||||
end,
|
||||
|
||||
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage)
|
||||
if mobkit.is_alive(self) then
|
||||
if time_from_last_punch and (time_from_last_punch > tool_capabilities.full_punch_interval) then
|
||||
if
|
||||
time_from_last_punch
|
||||
and (time_from_last_punch > tool_capabilities.full_punch_interval)
|
||||
then
|
||||
local dmg = tool_capabilities.damage_groups.fleshy or 0
|
||||
dir = vector.multiply(dir, dmg)
|
||||
self.object:set_velocity(vector.new(dir.x, 2, dir.y))
|
||||
|
@ -133,47 +131,50 @@ do --[[ Staff Entity ]] --
|
|||
})
|
||||
end
|
||||
|
||||
do --[[ Corpse ]] --
|
||||
do -- Corpse --
|
||||
local function randtime()
|
||||
return math.random(5, 120)
|
||||
end
|
||||
|
||||
minetest.register_node("ikea_staff:corpse", table.merge(ikea.default_mesh(), {
|
||||
description = "SCP-3008-2 (Deceased)",
|
||||
mesh = "ikea_staff_member_dead.obj",
|
||||
tiles = {"ikea_staff_member.png"},
|
||||
selection_box = {type = "fixed", fixed = {-0.5, -0.5, 0, 0.5, 0, 3}},
|
||||
collision_box = {type = "fixed", fixed = {-0.5, -0.5, 0, 0.5, 0, 3}},
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
groups = {carryable = 1, falling_node = 1, facsimile = 1},
|
||||
minetest.register_node(
|
||||
"ikea_staff:corpse",
|
||||
table.merge(ikea.default_mesh(), {
|
||||
description = "SCP-3008-2 (Deceased)",
|
||||
mesh = "ikea_staff_member_dead.obj",
|
||||
tiles = { "ikea_staff_member.png" },
|
||||
selection_box = { type = "fixed", fixed = { -0.5, -0.5, 0, 0.5, 0, 3 } },
|
||||
collision_box = { type = "fixed", fixed = { -0.5, -0.5, 0, 0.5, 0, 3 } },
|
||||
walkable = false,
|
||||
sunlight_propagates = true,
|
||||
groups = { carryable = 1, falling_node = 1, facsimile = 1 },
|
||||
|
||||
-- Corpse Mob Spawner --
|
||||
on_timer = function(pos, elapsed)
|
||||
if not helpers.is_visible(pos, 3, RANGE) then
|
||||
local spawnpos = helpers.randompos(pos, 5)
|
||||
local height = mobkit.get_terrain_height(spawnpos)
|
||||
if height then
|
||||
spawnpos = vector.offset(spawnpos, 0, height, 0)
|
||||
minetest.add_entity(spawnpos, "ikea_staff:member")
|
||||
-- Corpse Mob Spawner --
|
||||
on_timer = function(pos, elapsed)
|
||||
if not helpers.is_visible(pos, 3, RANGE) then
|
||||
local spawnpos = helpers.randompos(pos, 5)
|
||||
local height = mobkit.get_terrain_height(spawnpos)
|
||||
if height then
|
||||
spawnpos = vector.offset(spawnpos, 0, height, 0)
|
||||
minetest.add_entity(spawnpos, "ikea_staff:member")
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.get_node_timer(pos):start(randtime())
|
||||
return false
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(randtime())
|
||||
end,
|
||||
}))
|
||||
minetest.get_node_timer(pos):start(randtime())
|
||||
return false
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(randtime())
|
||||
end,
|
||||
})
|
||||
)
|
||||
end
|
||||
|
||||
do --[[ Rare "Thin Air" Spawning ]] --
|
||||
do -- Rare "Thin Air" Spawning --
|
||||
local TRIES = 5 -- How many times to try finding a valid spawn point before giving up
|
||||
local timer = 0
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
timer = timer + dtime
|
||||
if timer >= (60) then
|
||||
if timer >= 60 then
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local pos = player:get_pos()
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ local function flashlight_update(name, last_light_pos)
|
|||
local player = minetest.get_player_by_name(name)
|
||||
if not player then
|
||||
if last_light_pos then
|
||||
minetest.swap_node(last_light_pos, {name = "air"})
|
||||
minetest.swap_node(last_light_pos, { name = "air" })
|
||||
end
|
||||
return
|
||||
end
|
||||
|
@ -23,7 +23,7 @@ local function flashlight_update(name, last_light_pos)
|
|||
local inv = player:get_inventory()
|
||||
inv:set_stack("main", 1, ItemStack("ikea_tools:flashlight_off"))
|
||||
if last_light_pos then
|
||||
minetest.swap_node(last_light_pos, {name = "air"})
|
||||
minetest.swap_node(last_light_pos, { name = "air" })
|
||||
end
|
||||
return
|
||||
end
|
||||
|
@ -35,7 +35,7 @@ local function flashlight_update(name, last_light_pos)
|
|||
local light_pos
|
||||
for pointed_thing in Raycast(pos, pos + (look_dir * 150), true, true) do
|
||||
if (pointed_thing.type == "object") and (pointed_thing.ref ~= player) then
|
||||
light_pos = pointed_thing.ref:get_pos() + {x = 0, y = 1, z = 0}
|
||||
light_pos = pointed_thing.ref:get_pos() + { x = 0, y = 1, z = 0 }
|
||||
break
|
||||
elseif pointed_thing.type == "node" then
|
||||
light_pos = pointed_thing.above
|
||||
|
@ -47,13 +47,12 @@ local function flashlight_update(name, last_light_pos)
|
|||
local node_name = minetest.get_node(light_pos).name
|
||||
|
||||
if node_name == "air" then
|
||||
minetest.swap_node(light_pos, {name = "ikea_tools:flashlight_light"})
|
||||
minetest.swap_node(light_pos, { name = "ikea_tools:flashlight_light" })
|
||||
|
||||
if last_light_pos then
|
||||
minetest.swap_node(last_light_pos, {name = "air"})
|
||||
minetest.swap_node(last_light_pos, { name = "air" })
|
||||
end
|
||||
last_light_pos = light_pos
|
||||
|
||||
elseif node_name == "ikea_tools:flashlight_light" then
|
||||
-- Do nothing, the light already exists
|
||||
else
|
||||
|
@ -62,16 +61,16 @@ local function flashlight_update(name, last_light_pos)
|
|||
light_pos = light_pos - vector.round(look_dir)
|
||||
node_name = minetest.get_node(light_pos).name
|
||||
if node_name == "air" then
|
||||
minetest.swap_node(light_pos, {name = "ikea_tools:flashlight_light"})
|
||||
minetest.swap_node(light_pos, { name = "ikea_tools:flashlight_light" })
|
||||
if last_light_pos then
|
||||
minetest.swap_node(last_light_pos, {name = "air"})
|
||||
minetest.swap_node(last_light_pos, { name = "air" })
|
||||
end
|
||||
last_light_pos = light_pos
|
||||
end
|
||||
end
|
||||
else
|
||||
if last_light_pos then
|
||||
minetest.swap_node(last_light_pos, {name = "air"})
|
||||
minetest.swap_node(last_light_pos, { name = "air" })
|
||||
end
|
||||
last_light_pos = false
|
||||
end
|
||||
|
@ -83,7 +82,7 @@ minetest.register_node("ikea_tools:flashlight_off", {
|
|||
description = "Flashlight (off)",
|
||||
drawtype = "mesh",
|
||||
mesh = "ikea_tools_flashlight_off.obj",
|
||||
tiles = {"ikea_tools_flashlight_off.png"},
|
||||
tiles = { "ikea_tools_flashlight_off.png" },
|
||||
range = 0,
|
||||
|
||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
||||
|
@ -97,7 +96,7 @@ minetest.register_node("ikea_tools:flashlight_on", {
|
|||
description = "Flashlight (on)",
|
||||
drawtype = "mesh",
|
||||
mesh = "ikea_tools_flashlight_on.obj",
|
||||
tiles = {"ikea_tools_flashlight_on.png"},
|
||||
tiles = { "ikea_tools_flashlight_on.png" },
|
||||
range = 0,
|
||||
|
||||
on_secondary_use = function(itemstack, user, pointed_thing)
|
||||
|
|
|
@ -7,7 +7,6 @@ local item_positions = {
|
|||
vector.new(0, 0, 3),
|
||||
vector.new(1, 0, 3),
|
||||
},
|
||||
|
||||
[1] = {
|
||||
vector.new(1, 0, -1),
|
||||
vector.new(1, 0, 0),
|
||||
|
@ -16,7 +15,6 @@ local item_positions = {
|
|||
vector.new(3, 0, -1),
|
||||
vector.new(3, 0, 0),
|
||||
},
|
||||
|
||||
[2] = {
|
||||
vector.new(-1, 0, -1),
|
||||
vector.new(0, 0, -1),
|
||||
|
@ -25,7 +23,6 @@ local item_positions = {
|
|||
vector.new(-1, 0, -3),
|
||||
vector.new(0, 0, -3),
|
||||
},
|
||||
|
||||
[3] = {
|
||||
vector.new(-1, 0, 0),
|
||||
vector.new(-1, 0, 1),
|
||||
|
@ -46,87 +43,94 @@ end
|
|||
local trolley_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.250543, -0.5, 1.5, -0.500882, 3.5},
|
||||
{-0.5, 1.25088, -0.5, -0.375, -0.250543, 0.25},
|
||||
{1.375, 1.25088, -0.5, 1.5, -0.250543, 0.25},
|
||||
{ -0.5, -0.250543, -0.5, 1.5, -0.500882, 3.5 },
|
||||
{ -0.5, 1.25088, -0.5, -0.375, -0.250543, 0.25 },
|
||||
{ 1.375, 1.25088, -0.5, 1.5, -0.250543, 0.25 },
|
||||
},
|
||||
}
|
||||
|
||||
minetest.register_node("ikea_trolley:flatbed", table.merge(ikea.default_mesh(), {
|
||||
description = "Flatbed Trolley",
|
||||
mesh = "ikea_trolley_flatbed_node.obj",
|
||||
tiles = {"ikea_trolley_flatbed.png"},
|
||||
selection_box = trolley_box,
|
||||
collision_box = trolley_box,
|
||||
wield_scale = vector.new(0, 0, 0),
|
||||
node_placement_prediction = "",
|
||||
groups = {carryable = 1},
|
||||
minetest.register_node(
|
||||
"ikea_trolley:flatbed",
|
||||
table.merge(ikea.default_mesh(), {
|
||||
description = "Flatbed Trolley",
|
||||
mesh = "ikea_trolley_flatbed_node.obj",
|
||||
tiles = { "ikea_trolley_flatbed.png" },
|
||||
selection_box = trolley_box,
|
||||
collision_box = trolley_box,
|
||||
wield_scale = vector.new(0, 0, 0),
|
||||
node_placement_prediction = "",
|
||||
groups = { carryable = 1 },
|
||||
|
||||
preserve_metadata = function(pos, oldnode, oldmeta, drops)
|
||||
local meta = drops[1]:get_meta()
|
||||
do_on_trolley_container_positions(pos, oldnode.param2, function(c_pos, i)
|
||||
local item = minetest.get_node(c_pos)
|
||||
local item_name = ikea_facsimile.actuals[item.name]
|
||||
if not item_name then
|
||||
preserve_metadata = function(pos, oldnode, oldmeta, drops)
|
||||
local meta = drops[1]:get_meta()
|
||||
do_on_trolley_container_positions(pos, oldnode.param2, function(c_pos, i)
|
||||
local item = minetest.get_node(c_pos)
|
||||
local item_name = ikea_facsimile.actuals[item.name]
|
||||
if not item_name then
|
||||
return
|
||||
end
|
||||
|
||||
meta:set_string(i, item_name)
|
||||
end)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
local obj = minetest.add_entity(pos, "ikea_trolley:flatbed", digger:get_player_name())
|
||||
if not obj then
|
||||
return
|
||||
end
|
||||
obj:set_attach(digger, "", vector.new(0, 5, 10), vector.new(0, 0, 0), true)
|
||||
|
||||
meta:set_string(i, item_name)
|
||||
end)
|
||||
end,
|
||||
do_on_trolley_container_positions(pos, oldnode.param2, function(c_pos, i)
|
||||
local item = minetest.get_node(c_pos)
|
||||
minetest.remove_node(c_pos)
|
||||
local item_name = ikea_facsimile.actuals[item.name]
|
||||
if not item_name then
|
||||
return
|
||||
end
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
local obj = minetest.add_entity(pos, "ikea_trolley:flatbed", digger:get_player_name())
|
||||
if not obj then
|
||||
return
|
||||
end
|
||||
obj:set_attach(digger, "", vector.new(0, 5, 10), vector.new(0, 0, 0), true)
|
||||
|
||||
do_on_trolley_container_positions(pos, oldnode.param2, function(c_pos, i)
|
||||
local item = minetest.get_node(c_pos)
|
||||
minetest.remove_node(c_pos)
|
||||
local item_name = ikea_facsimile.actuals[item.name]
|
||||
if not item_name then
|
||||
local item_obj = minetest.add_entity(pos, "ikea_trolley:item", item_name)
|
||||
if item_obj then
|
||||
item_obj:set_attach(
|
||||
obj,
|
||||
"",
|
||||
vector.offset(item_positions[0][i] * 10, -5, 0, 0),
|
||||
vector.new(0, 180, 0),
|
||||
true
|
||||
)
|
||||
end
|
||||
end)
|
||||
end,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if not placer then
|
||||
return
|
||||
end
|
||||
local pos = pointed_thing.above
|
||||
local param2 = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
|
||||
local item_obj = minetest.add_entity(pos, "ikea_trolley:item", item_name)
|
||||
if item_obj then
|
||||
item_obj:set_attach(obj, "", vector.offset(item_positions[0][i] * 10, -5, 0, 0), vector.new(0, 180, 0), true)
|
||||
local can_place = true
|
||||
do_on_trolley_container_positions(pos, param2, function(c_pos, i)
|
||||
if minetest.get_node(c_pos).name ~= "air" then
|
||||
can_place = false
|
||||
end
|
||||
end)
|
||||
|
||||
if can_place then
|
||||
return minetest.item_place(itemstack, placer, pointed_thing)
|
||||
end
|
||||
end)
|
||||
end,
|
||||
end,
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
local meta = itemstack:get_meta()
|
||||
local trolley_node = minetest.get_node(pos)
|
||||
do_on_trolley_container_positions(pos, trolley_node.param2, function(c_pos, i)
|
||||
local name = ikea_facsimile.facsimiles[meta:get_string(i)]
|
||||
or "ikea_facsimile:container"
|
||||
local param2 = (trolley_node.param2 + 2) % 4 -- Flip the rotation by 180°
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if not placer then
|
||||
return
|
||||
end
|
||||
local pos = pointed_thing.above
|
||||
local param2 = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
|
||||
local can_place = true
|
||||
do_on_trolley_container_positions(pos, param2, function(c_pos, i)
|
||||
if minetest.get_node(c_pos).name ~= "air" then
|
||||
can_place = false
|
||||
end
|
||||
end)
|
||||
|
||||
if can_place then
|
||||
return minetest.item_place(itemstack, placer, pointed_thing)
|
||||
end
|
||||
end,
|
||||
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
local meta = itemstack:get_meta()
|
||||
local trolley_node = minetest.get_node(pos)
|
||||
do_on_trolley_container_positions(pos, trolley_node.param2, function(c_pos, i)
|
||||
local name = ikea_facsimile.facsimiles[meta:get_string(i)] or "ikea_facsimile:container"
|
||||
local param2 = (trolley_node.param2 + 2) % 4 -- Flip the rotation by 180°
|
||||
|
||||
minetest.set_node(c_pos, {name = name, param2 = param2})
|
||||
end)
|
||||
end,
|
||||
}))
|
||||
minetest.set_node(c_pos, { name = name, param2 = param2 })
|
||||
end)
|
||||
end,
|
||||
})
|
||||
)
|
||||
|
||||
minetest.register_entity("ikea_trolley:item", {
|
||||
initial_properties = {
|
||||
|
@ -136,13 +140,11 @@ minetest.register_entity("ikea_trolley:item", {
|
|||
collide_with_objects = false,
|
||||
pointable = false,
|
||||
},
|
||||
|
||||
on_activate = function(self, staticdata, dtime_s)
|
||||
local props = self.object:get_properties()
|
||||
props.wield_item = staticdata
|
||||
self.object:set_properties(props)
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime, moveresult)
|
||||
self._timer = (self._timer or 0) + dtime
|
||||
if self._timer < 0.1 then
|
||||
|
@ -161,16 +163,14 @@ minetest.register_entity("ikea_trolley:flatbed", {
|
|||
initial_properties = {
|
||||
visual = "mesh",
|
||||
mesh = "ikea_trolley_flatbed_entity.obj",
|
||||
textures = {"ikea_trolley_flatbed.png"},
|
||||
textures = { "ikea_trolley_flatbed.png" },
|
||||
physical = false,
|
||||
collide_with_objects = false,
|
||||
pointable = false,
|
||||
},
|
||||
|
||||
on_activate = function(self, staticdata, dtime_s)
|
||||
self._playername = staticdata
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime, moveresult)
|
||||
self._timer = (self._timer or 0) + dtime
|
||||
if self._timer < 0.2 then
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
-- Files
|
||||
-- Files --
|
||||
local modpath = minetest.get_modpath("ikea_warehouse")
|
||||
dofile(modpath .. "/nodes.lua")
|
||||
|
||||
-- Local Function Aliases
|
||||
-- Local Function Aliases --
|
||||
local bound_perlin = ikea_mapgen.bound_perlin
|
||||
local fill_vmanip_area = ikea_mapgen.fill_vmanip_area
|
||||
local v_new = vector.new
|
||||
local get_content_id = minetest.get_content_id
|
||||
|
||||
-- Settings
|
||||
-- Settings --
|
||||
local should_place_aisle = ikea_mapgen.every_n_mapblocks(4)
|
||||
local Perlin = PerlinNoise({
|
||||
offset = 0,
|
||||
|
@ -21,7 +21,7 @@ local Perlin = PerlinNoise({
|
|||
flags = "defaults, absvalue",
|
||||
})
|
||||
|
||||
-- Content IDs
|
||||
-- Content IDs --
|
||||
local c_iw = get_content_id("ikea:invisible_wall")
|
||||
local c_floor = get_content_id("ikea_warehouse:floor")
|
||||
local c_rack = get_content_id("ikea_warehouse:rack")
|
||||
|
@ -32,11 +32,11 @@ local c_sign = get_content_id("ikea_warehouse:row_sign")
|
|||
-- We need to find these after everything else has been registered
|
||||
local applicable_furniture, c_box
|
||||
minetest.after(0, function()
|
||||
applicable_furniture = ikea.get_nodes_by_groups({spawn_on_rack = 1})
|
||||
applicable_furniture = ikea.get_nodes_by_groups({ spawn_on_rack = 1 })
|
||||
c_box = get_content_id(ikea_facsimile.facsimiles["ikea_warehouse:box"])
|
||||
end)
|
||||
|
||||
--[[ Mapgen Functions ]] --
|
||||
-- Mapgen Functions --
|
||||
local function place_racks(data, va, x, z, num)
|
||||
for i = 0, num - 1 do
|
||||
local x2 = x + (4 * i)
|
||||
|
@ -56,7 +56,9 @@ local function place_rack_contents(data, param2s, va, x, z, rotate)
|
|||
|
||||
for x2 = x, x + 15 do
|
||||
local furniture_id = bound_perlin(Perlin, #applicable_furniture, x2, 0, z)
|
||||
local c_furniture = get_content_id(ikea_facsimile.facsimiles[applicable_furniture[furniture_id]])
|
||||
local c_furniture = get_content_id(
|
||||
ikea_facsimile.facsimiles[applicable_furniture[furniture_id]]
|
||||
)
|
||||
|
||||
local loop_i = 1
|
||||
for i in va:iter(x2, 1, z, x2, 7, z) do
|
||||
|
@ -81,39 +83,39 @@ ikea_mapgen.register_department({
|
|||
max_depth = 21,
|
||||
|
||||
set_data = function(data, param2s, va, x, z, edges)
|
||||
-- Place Floor
|
||||
-- Place Floor --
|
||||
fill_vmanip_area(data, va, v_new(x, 0, z), v_new(x + 15, 0, z + 15), c_floor)
|
||||
|
||||
-- Place Aisles
|
||||
-- Place Aisles --
|
||||
if should_place_aisle(x) and not (edges.e or edges.w) then
|
||||
data[va:index(x + 2, 10, z + 8)] = c_lamp
|
||||
data[va:index(x + 2, 9, z + 8)] = c_lamp_light
|
||||
data[va:index(x + 13, 10, z + 8)] = c_lamp
|
||||
data[va:index(x + 13, 9, z + 8)] = c_lamp_light
|
||||
|
||||
if (edges.n and edges.inner.n) or (not edges.n) then
|
||||
if (edges.e and edges.inner.e) or (not edges.e) then
|
||||
if (edges.n and edges.inner.n) or not edges.n then
|
||||
if (edges.e and edges.inner.e) or not edges.e then
|
||||
place_row_signs(data, va, x + 15, z + 8)
|
||||
place_row_signs(data, va, x + 15, z + 9)
|
||||
end
|
||||
if (edges.w and edges.inner.w) or (not edges.w) then
|
||||
if (edges.w and edges.inner.w) or not edges.w then
|
||||
place_row_signs(data, va, x, z + 8)
|
||||
place_row_signs(data, va, x, z + 9)
|
||||
end
|
||||
end
|
||||
if (edges.s and edges.inner.s) or (not edges.s) then
|
||||
if (edges.e and edges.inner.e) or (not edges.e) then
|
||||
if (edges.s and edges.inner.s) or not edges.s then
|
||||
if (edges.e and edges.inner.e) or not edges.e then
|
||||
place_row_signs(data, va, x + 15, z + 0)
|
||||
place_row_signs(data, va, x + 15, z + 1)
|
||||
end
|
||||
if (edges.w and edges.inner.w) or (not edges.w) then
|
||||
if (edges.w and edges.inner.w) or not edges.w then
|
||||
place_row_signs(data, va, x, z + 0)
|
||||
place_row_signs(data, va, x, z + 1)
|
||||
end
|
||||
end
|
||||
-- Place Racks
|
||||
-- Place Racks --
|
||||
else
|
||||
if (edges.n and edges.inner.n) or (not edges.n) then
|
||||
if (edges.n and edges.inner.n) or not edges.n then
|
||||
local light_index2 = va:index(x + 8, 10, z + 12)
|
||||
data[light_index2] = c_lamp
|
||||
param2s[light_index2] = 1
|
||||
|
@ -126,7 +128,7 @@ ikea_mapgen.register_department({
|
|||
place_rack_contents(data, param2s, va, x, z + 8, false)
|
||||
place_rack_contents(data, param2s, va, x, z + 9, true)
|
||||
end
|
||||
if (edges.s and edges.inner.s) or (not edges.s) then
|
||||
if (edges.s and edges.inner.s) or not edges.s then
|
||||
local light_index = va:index(x + 8, 10, z + 3)
|
||||
data[light_index] = c_lamp
|
||||
param2s[light_index] = 1
|
||||
|
@ -142,4 +144,3 @@ ikea_mapgen.register_department({
|
|||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
|
@ -1,21 +1,26 @@
|
|||
minetest.register_node("ikea_warehouse:floor", {
|
||||
description = "Base floor node (you hacker you!)",
|
||||
paramtype = "light",
|
||||
tiles = {{name = "ikea_warehouse_concrete.png", scale = 16, align_style = "world"}},
|
||||
tiles = {
|
||||
{ name = "ikea_warehouse_concrete.png", scale = 16, align_style = "world" },
|
||||
},
|
||||
is_ground_content = true,
|
||||
sunlight_propagates = true,
|
||||
groups = {static = 1},
|
||||
groups = { static = 1 },
|
||||
})
|
||||
|
||||
minetest.register_node("ikea_warehouse:rack", table.merge(ikea.default_mesh(), {
|
||||
description = "Racks, or big metal shelves that hold boxes (you hacker you!)",
|
||||
mesh = "ikea_warehouse_rack.obj",
|
||||
tiles = {name = "ikea_warehouse_rack.png"},
|
||||
paramtype2 = "none",
|
||||
is_ground_content = true,
|
||||
sunlight_propagates = true,
|
||||
groups = {static = 1},
|
||||
}))
|
||||
minetest.register_node(
|
||||
"ikea_warehouse:rack",
|
||||
table.merge(ikea.default_mesh(), {
|
||||
description = "Racks, or big metal shelves that hold boxes (you hacker you!)",
|
||||
mesh = "ikea_warehouse_rack.obj",
|
||||
tiles = { name = "ikea_warehouse_rack.png" },
|
||||
paramtype2 = "none",
|
||||
is_ground_content = true,
|
||||
sunlight_propagates = true,
|
||||
groups = { static = 1 },
|
||||
})
|
||||
)
|
||||
|
||||
minetest.register_node("ikea_warehouse:lamp_light", {
|
||||
description = "Lights That Light The Warehouse",
|
||||
|
@ -24,7 +29,7 @@ minetest.register_node("ikea_warehouse:lamp_light", {
|
|||
light_source = minetest.LIGHT_MAX,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
groups = {static = 1, ikea_light = 1, ikea_fx_dust = 1},
|
||||
groups = { static = 1, ikea_light = 1, ikea_fx_dust = 1 },
|
||||
ikea_light_swap_node = "ikea_warehouse:lamp_light_off",
|
||||
ikea_fx_dust_amount = 1,
|
||||
ikea_fx_dust_spawner_chance = 1,
|
||||
|
@ -37,52 +42,79 @@ minetest.register_node("ikea_warehouse:lamp_light_off", {
|
|||
walkable = false,
|
||||
pointable = false,
|
||||
ikea_light_swap_node = "ikea_warehouse:lamp_light",
|
||||
groups = {static = 1, ikea_light = 2},
|
||||
groups = { static = 1, ikea_light = 2 },
|
||||
})
|
||||
|
||||
minetest.register_node("ikea_warehouse:lamp", table.merge(ikea.default_mesh(), {
|
||||
description = "Lights That Light The Warehouse",
|
||||
mesh = "ikea_warehouse_light.obj",
|
||||
tiles = {{name = "ikea_warehouse_light.png"}},
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
groups = {static = 1},
|
||||
}))
|
||||
minetest.register_node(
|
||||
"ikea_warehouse:lamp",
|
||||
table.merge(ikea.default_mesh(), {
|
||||
description = "Lights That Light The Warehouse",
|
||||
mesh = "ikea_warehouse_light.obj",
|
||||
tiles = { { name = "ikea_warehouse_light.png" } },
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
groups = { static = 1 },
|
||||
})
|
||||
)
|
||||
|
||||
minetest.register_node("ikea_warehouse:row_sign", {
|
||||
description = "Signs To \"Mark\" Each Row",
|
||||
description = 'Signs To "Mark" Each Row',
|
||||
drawtype = "nodebox",
|
||||
node_box = {type = "fixed", fixed = {{-4 / 16, -8 / 16, -4 / 16, 4 / 16, 8 / 16, 4 / 16}}},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { { -4 / 16, -8 / 16, -4 / 16, 4 / 16, 8 / 16, 4 / 16 } },
|
||||
},
|
||||
tiles = {
|
||||
{name = "ikea_warehouse_row_sign_top.png"},
|
||||
{name = "ikea_warehouse_row_sign_top.png"},
|
||||
{name = "ikea_warehouse_row_sign_side.png", scale = 16, align_style = "world"},
|
||||
{name = "ikea_warehouse_row_sign_side.png", scale = 16, align_style = "world"},
|
||||
{name = "ikea_warehouse_row_sign_side.png", scale = 16, align_style = "world"},
|
||||
{name = "ikea_warehouse_row_sign_side.png", scale = 16, align_style = "world"},
|
||||
{ name = "ikea_warehouse_row_sign_top.png" },
|
||||
{ name = "ikea_warehouse_row_sign_top.png" },
|
||||
{
|
||||
name = "ikea_warehouse_row_sign_side.png",
|
||||
scale = 16,
|
||||
align_style = "world",
|
||||
},
|
||||
{
|
||||
name = "ikea_warehouse_row_sign_side.png",
|
||||
scale = 16,
|
||||
align_style = "world",
|
||||
},
|
||||
{
|
||||
name = "ikea_warehouse_row_sign_side.png",
|
||||
scale = 16,
|
||||
align_style = "world",
|
||||
},
|
||||
{
|
||||
name = "ikea_warehouse_row_sign_side.png",
|
||||
scale = 16,
|
||||
align_style = "world",
|
||||
},
|
||||
},
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
is_ground_content = true,
|
||||
sunlight_propagates = true,
|
||||
groups = {static = 1},
|
||||
groups = { static = 1 },
|
||||
})
|
||||
|
||||
minetest.register_node("ikea_warehouse:box", {
|
||||
description = "Cardboard Box",
|
||||
drawtype = "nodebox",
|
||||
node_box = {type = "fixed", fixed = {{-7.999 / 16, -7.999 / 16, -7.999 / 16, 7.999 / 16, 7.999 / 16, 7.999 / 16}}},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -7.999 / 16, -7.999 / 16, -7.999 / 16, 7.999 / 16, 7.999 / 16, 7.999 / 16 },
|
||||
},
|
||||
},
|
||||
tiles = {
|
||||
{name = "ikea_warehouse_box_top.png", backface_culling = false},
|
||||
{name = "ikea_warehouse_box_bottom.png", backface_culling = false},
|
||||
{name = "ikea_warehouse_box_side.png", backface_culling = false},
|
||||
{name = "ikea_warehouse_box_side.png", backface_culling = false},
|
||||
{name = "ikea_warehouse_box_front.png", backface_culling = false},
|
||||
{name = "ikea_warehouse_box_front.png", backface_culling = false},
|
||||
{ name = "ikea_warehouse_box_top.png", backface_culling = false },
|
||||
{ name = "ikea_warehouse_box_bottom.png", backface_culling = false },
|
||||
{ name = "ikea_warehouse_box_side.png", backface_culling = false },
|
||||
{ name = "ikea_warehouse_box_side.png", backface_culling = false },
|
||||
{ name = "ikea_warehouse_box_front.png", backface_culling = false },
|
||||
{ name = "ikea_warehouse_box_front.png", backface_culling = false },
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
use_texture_alpha = "clip",
|
||||
groups = {falling_node = 1, carryable = 1, facsimile = 1},
|
||||
groups = { falling_node = 1, carryable = 1, facsimile = 1 },
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue