add armor specs to rainbow armor, add technic armor mod, add redef mod, add technic recycle mod
This commit is contained in:
parent
00106c85c6
commit
c1e648877d
138 changed files with 1321 additions and 4 deletions
31
mods/redef/redefinitions/3d_ladders.lua
Normal file
31
mods/redef/redefinitions/3d_ladders.lua
Normal file
|
@ -0,0 +1,31 @@
|
|||
local ladders = {
|
||||
{'ladder_wood', 'default_ladder_wood.png', 'default_wood.png'},
|
||||
{'ladder_steel', 'default_ladder_steel.png', 'default_steel_block.png'}
|
||||
}
|
||||
|
||||
|
||||
for l,def in pairs(ladders) do
|
||||
core.override_item('default:'..def[1], {
|
||||
tiles = { def[2], def[2], def[3], def[3], def[3], def[3] },
|
||||
use_texture_alpha = 'clip',
|
||||
drawtype = 'nodebox',
|
||||
paramtype = 'light',
|
||||
node_box = {
|
||||
type = 'fixed',
|
||||
fixed = {
|
||||
{-0.375, -0.5, -0.5, -0.25, -0.375, 0.5}, -- strut_1
|
||||
{0.25, -0.5, -0.5, 0.375, -0.375, 0.5}, -- strut_2
|
||||
{-0.4375, -0.5, 0.3125, 0.4375, -0.375, 0.4375}, -- rung_1
|
||||
{-0.4375, -0.5, 0.0625, 0.4375, -0.375, 0.1875}, -- rung_2
|
||||
{-0.4375, -0.5, -0.1875, 0.4375, -0.375, -0.0625}, -- rung_3
|
||||
{-0.4375, -0.5, -0.4375, 0.4375, -0.375, -0.3125} -- rung_4
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = 'wallmounted',
|
||||
wall_top = {-0.4375, 0.375, -0.5, 0.4375, 0.5, 0.5},
|
||||
wall_side = {-0.5, -0.5, -0.4375, -0.375, 0.5, 0.4375},
|
||||
wall_bottom = {-0.4375, -0.5, -0.5, 0.4375, -0.375, 0.5}
|
||||
}
|
||||
})
|
||||
end
|
29
mods/redef/redefinitions/aligned_textures.lua
Normal file
29
mods/redef/redefinitions/aligned_textures.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
for id,definition in pairs(core.registered_nodes) do
|
||||
local groups = definition.groups
|
||||
local origin = definition.mod_origin
|
||||
local circular_saw = id == 'moreblocks:circular_saw'
|
||||
|
||||
local stair_or_slab = groups.stair or groups.slab
|
||||
local moreblocks_object = origin == 'moreblocks' and not circular_saw
|
||||
|
||||
if stair_or_slab or moreblocks_object then
|
||||
local tiles = definition.tiles
|
||||
local target_tiles = {}
|
||||
|
||||
for index,_ in pairs(tiles) do
|
||||
if type(tiles[index]) == 'table' then
|
||||
tiles[index].align_style = 'world'
|
||||
target_tiles[index] = tiles[index]
|
||||
else
|
||||
target_tiles[index] = {
|
||||
name = tiles[index],
|
||||
align_style = 'world'
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
core.override_item(id, {
|
||||
tiles = target_tiles
|
||||
})
|
||||
end
|
||||
end
|
37
mods/redef/redefinitions/grass_box_height.lua
Normal file
37
mods/redef/redefinitions/grass_box_height.lua
Normal file
|
@ -0,0 +1,37 @@
|
|||
local height = core.settings:get('redef_grass_box_height') or '2'
|
||||
local target = -0.5 + (tonumber(height) * 0.0625)
|
||||
|
||||
|
||||
local grass_nodes = {
|
||||
'default:junglegrass',
|
||||
'default:dry_grass_1',
|
||||
'default:dry_grass_2',
|
||||
'default:dry_grass_3',
|
||||
'default:dry_grass_4',
|
||||
'default:dry_grass_5',
|
||||
'default:grass_1',
|
||||
'default:grass_2',
|
||||
'default:grass_3',
|
||||
'default:grass_4',
|
||||
'default:grass_5',
|
||||
}
|
||||
|
||||
|
||||
for _,grass in pairs(grass_nodes) do
|
||||
local current_box = core.registered_nodes[grass].selection_box.fixed
|
||||
if (current_box[5] > target) then
|
||||
core.override_item(grass, {
|
||||
selection_box = {
|
||||
type = 'fixed',
|
||||
fixed = {
|
||||
current_box[1],
|
||||
current_box[2],
|
||||
current_box[3],
|
||||
current_box[4],
|
||||
target,
|
||||
current_box[6]
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
24
mods/redef/redefinitions/maximum_stack_size.lua
Normal file
24
mods/redef/redefinitions/maximum_stack_size.lua
Normal file
|
@ -0,0 +1,24 @@
|
|||
local _stack_max = tonumber(core.settings:get('redef_stack_max') or 100)
|
||||
local all_objects = {}
|
||||
|
||||
-- Get the things that have to be altered.
|
||||
for w,what in pairs({'items', 'nodes', 'craftitems', 'tools'}) do
|
||||
for name,definition in pairs(core['registered_'..what]) do
|
||||
if definition.stack_max == 99 then
|
||||
table.insert(all_objects, name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Set stack size to the given value.
|
||||
for _,name in pairs(all_objects) do
|
||||
core.override_item(name, {
|
||||
stack_max = _stack_max
|
||||
})
|
||||
end
|
||||
|
||||
-- Set Luanti default values in case mods or something within the engine
|
||||
-- will use them after the above code ran.
|
||||
core.craftitemdef_default.stack_max = _stack_max
|
||||
core.nodedef_default.stack_max = _stack_max
|
||||
core.noneitemdef_default.stack_max = _stack_max
|
150
mods/redef/redefinitions/proper_rotation.lua
Normal file
150
mods/redef/redefinitions/proper_rotation.lua
Normal file
|
@ -0,0 +1,150 @@
|
|||
local override_item = core.override_item
|
||||
local pointed_thing_to_face_pos = core.pointed_thing_to_face_pos
|
||||
local dir_to_facedir = core.dir_to_facedir
|
||||
local is_creative_enabled = core.is_creative_enabled
|
||||
local item_place_node = core.item_place_node
|
||||
|
||||
local stairs = {}
|
||||
local slabs = {}
|
||||
local slopes = {}
|
||||
|
||||
|
||||
-- Correct stairs placement
|
||||
--
|
||||
-- Derived from the original stairs on_place function of Minetest Game.
|
||||
--
|
||||
-- @param itemstack An itemstack according to Luanti API
|
||||
-- @param placer A placer object according to Luanti API
|
||||
-- @param pointed_thing A pointed_thing according to Luanti API
|
||||
-- @return mixed itemstack and position according to Luanti API
|
||||
local properly_rotate = function (itemstack, placer, pointed_thing)
|
||||
local under = pointed_thing.under
|
||||
local above = pointed_thing.above
|
||||
local param2 = 0
|
||||
|
||||
if placer then
|
||||
local placer_pos = placer:get_pos()
|
||||
local finepos = pointed_thing_to_face_pos(placer, pointed_thing)
|
||||
local fpos = finepos.y % 1
|
||||
|
||||
local under_above = under.y - 1 == above.y
|
||||
local fpos_perimeter = (fpos > 0 and fpos < 0.5)
|
||||
local fpos_limit = (fpos < -0.5 and fpos > -0.999999999)
|
||||
|
||||
if placer_pos then
|
||||
param2 = dir_to_facedir(vector.subtract(above, placer_pos))
|
||||
end
|
||||
|
||||
if under_above or fpos_perimeter or fpos_limit then
|
||||
param2 = param2 + 20
|
||||
if param2 == 21 then
|
||||
param2 = 23
|
||||
elseif param2 == 23 then
|
||||
param2 = 21
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return core.item_place(itemstack, placer, pointed_thing, param2)
|
||||
end
|
||||
|
||||
|
||||
-- Correct slabs placement
|
||||
--
|
||||
-- Derived from the original stairs on_place function of Minetest Game.
|
||||
--
|
||||
-- @param itemstack An itemstack according to LuantI API
|
||||
-- @param placer A placer object according to Luanti API
|
||||
-- @param pointed_thing A pointed_thing according to Luanti API
|
||||
-- @return mixed itemstack and position according to Luanti API
|
||||
local on_place_slabs = function (itemstack, placer, pointed_thing)
|
||||
local under = core.get_node(pointed_thing.under)
|
||||
local wield_item = itemstack:get_name()
|
||||
local player_name = placer and placer:get_player_name() or ''
|
||||
|
||||
-- Special behavior if placed on a slab
|
||||
if under and under.name:find(':slab_') then
|
||||
local pt_above = pointed_thing.above
|
||||
local pt_under = pointed_thing.under
|
||||
local fdir = dir_to_facedir(vector.subtract(pt_above, pt_under), true)
|
||||
local p2 = under.param2
|
||||
|
||||
-- Slab placement based on upside-down slabs or below slabs
|
||||
--
|
||||
-- ┌────────┐
|
||||
-- │ │
|
||||
-- ┢━━━━━━━━┪ <-- Slab A (bottom half of the node seen sideways)
|
||||
-- ┃ ┃
|
||||
-- ┈┈┈┈┣━━━━━━━━┫┈┈┈┈
|
||||
-- ┃ ┃
|
||||
-- ┡━━━━━━━━┩ <-- Slab B (top half of the node, seen sideways)
|
||||
-- │ │
|
||||
-- └────────┘
|
||||
--
|
||||
-- Slabs A and B are rotated according slab B or A on placement so that
|
||||
-- slabs placed on regular slabs from below automatically become
|
||||
-- upside-down slabs and slabs placed on top of upside-down slabs are
|
||||
-- not rotated into the same position.
|
||||
if p2 >= 20 and fdir == 8 then p2 = p2 - 20 end -- Slab A rotation
|
||||
if p2 <= 3 and fdir == 4 then p2 = p2 + 20 end -- Slab B rotation
|
||||
|
||||
-- Place node usind the calculated rotation
|
||||
item_place_node(ItemStack(wield_item), placer, pointed_thing, p2)
|
||||
|
||||
-- Remove one item if not in creative and return the itemstack
|
||||
if not is_creative_enabled(player_name) then itemstack:take_item() end
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- When not placed on a slab just properly rotate the slab
|
||||
return properly_rotate(itemstack, placer, pointed_thing)
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- Determine all stairs and slabs and put them into the respective tables.
|
||||
for name,definition in pairs(core.registered_nodes) do
|
||||
local from_moreblocks = definition.mod_origin == 'moreblocks'
|
||||
local from_bakedclay = definition.mod_origin == 'bakedclay'
|
||||
local mod_origin = from_moreblocks or from_bakedclay
|
||||
|
||||
local stair = string.match(name, ':stair_') ~= nil
|
||||
local slab = string.match(name, ':slab_') ~= nil
|
||||
local slope = string.match(name, ':slope_') ~= nil
|
||||
|
||||
if stair and mod_origin then table.insert(stairs, name) end
|
||||
if slab and mod_origin then table.insert(slabs, name) end
|
||||
if slope and mod_origin then table.insert(slopes, name) end
|
||||
end
|
||||
|
||||
|
||||
-- Iterate over all stairs and override the broken on_place function.
|
||||
for _,name in pairs(stairs) do
|
||||
override_item(name, {
|
||||
on_place = function (itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then return itemstack end
|
||||
return properly_rotate(itemstack, placer, pointed_thing)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
-- Iterate over all slopes and override the broken on_place function.
|
||||
for _,name in pairs(slopes) do
|
||||
override_item(name, {
|
||||
on_place = function (itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then return itemstack end
|
||||
return properly_rotate(itemstack, placer, pointed_thing)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
-- Iterate over all slabs and override the broken on_place function.
|
||||
for _,name in pairs(slabs) do
|
||||
override_item(name, {
|
||||
on_place = function (itemstack, placer, pointed_thing)
|
||||
return on_place_slabs(itemstack, placer, pointed_thing)
|
||||
end
|
||||
})
|
||||
end
|
23
mods/redef/redefinitions/show_steps.lua
Normal file
23
mods/redef/redefinitions/show_steps.lua
Normal file
|
@ -0,0 +1,23 @@
|
|||
local override_item = core.override_item
|
||||
local registered_nodes = table.copy(core.registered_nodes)
|
||||
local relevant_nodes = {}
|
||||
|
||||
|
||||
-- Determine all stairs and slabs by their respective groups and add them to
|
||||
-- the table of nodes to handle.
|
||||
for name,definition in pairs(registered_nodes) do
|
||||
local groups = definition.groups or {}
|
||||
local relevant = ((groups.stair == 1) or (groups.slab == 1))
|
||||
if relevant then
|
||||
table.insert(relevant_nodes, name)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Iterate over all stairs and slabs and remove the not_in_creative_inventory
|
||||
-- group to show them in the creative inventory again.
|
||||
for _,name in pairs(relevant_nodes) do
|
||||
local groups = registered_nodes[name].groups
|
||||
groups.not_in_creative_inventory = nil
|
||||
override_item(name, { groups = groups })
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue