Compare commits
19 Commits
9b7c44b453
...
pr_647_tec
Author | SHA1 | Date | |
---|---|---|---|
2454382e90 | |||
6731db14e5 | |||
a9079c49e0 | |||
f80372a0f8 | |||
80dee96dbe | |||
d65c4aadd2 | |||
98675a2ae9 | |||
ba2bdf8368 | |||
d5ff69d1d9 | |||
f47da0c045 | |||
a08ba2bb93 | |||
410e341da5 | |||
5826c2feaa | |||
b221d69717 | |||
a296446da1 | |||
49d4105a2b | |||
fda8a3d042 | |||
dfcf64c1d0 | |||
0921c326a8 |
@ -15,10 +15,10 @@ world. A few notable features:
|
|||||||
* Minetest 5.0.0 or newer
|
* Minetest 5.0.0 or newer
|
||||||
* [Minetest Game](https://github.com/minetest/minetest_game/)
|
* [Minetest Game](https://github.com/minetest/minetest_game/)
|
||||||
* [mesecons](https://github.com/minetest-mods/mesecons) -> signalling events
|
* [mesecons](https://github.com/minetest-mods/mesecons) -> signalling events
|
||||||
* [pipeworks](https://gitlab.com/VanessaE/pipeworks/) -> automation of item transport
|
* [pipeworks](https://github.com/mt-mods/pipeworks) -> automation of item transport
|
||||||
* [moreores](https://github.com/minetest-mods/moreores/) -> additional ores
|
* [moreores](https://github.com/minetest-mods/moreores/) -> additional ores
|
||||||
* [basic_materials](https://gitlab.com/VanessaE/basic_materials) -> basic craft items
|
* [basic_materials](https://github.com/mt-mods/basic_materials) -> basic craft items
|
||||||
* Supports [moretrees](https://gitlab.com/VanessaE/moretrees) -> rubber trees
|
* Supports [moretrees](https://github.com/mt-mods/moretrees) -> rubber trees
|
||||||
* Consult `depends.txt` or `mod.conf` of each mod for further dependency information.
|
* Consult `depends.txt` or `mod.conf` of each mod for further dependency information.
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,6 +27,12 @@ if minetest.get_modpath("moreblocks") then
|
|||||||
tiles={"technic_granite.png"},
|
tiles={"technic_granite.png"},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
stairsplus:register_all("technic", "granite_bricks", "technic:granite_bricks", {
|
||||||
|
description=S("Granite Bricks"),
|
||||||
|
groups={cracky=1, not_in_creative_inventory=1},
|
||||||
|
tiles={"technic_granite_bricks.png"},
|
||||||
|
})
|
||||||
|
|
||||||
stairsplus:register_all("technic", "concrete", "technic:concrete", {
|
stairsplus:register_all("technic", "concrete", "technic:concrete", {
|
||||||
description=S("Concrete"),
|
description=S("Concrete"),
|
||||||
groups={cracky=3, not_in_creative_inventory=1},
|
groups={cracky=3, not_in_creative_inventory=1},
|
||||||
|
9
settingtypes.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Safety feature for the chainsaw tool aimed to prevent cutting structures
|
||||||
|
# built by players.
|
||||||
|
#
|
||||||
|
# Trunk nodes generated by mapgen have a rotation of '0' whereas manually
|
||||||
|
# placed trunks usually have another value. However, some mods might generate
|
||||||
|
# trees with rotation != 0, which renders the chainsaw useless on them.
|
||||||
|
#
|
||||||
|
# Disabling this feature will sacrifice safety for convenience.
|
||||||
|
technic_safe_chainsaw (Chainsaw safety feature) bool true
|
@ -160,6 +160,11 @@ Unsorted functions:
|
|||||||
* If `technic.power_tools[itemstack:get_name()]` is `nil` (or `false`), this
|
* If `technic.power_tools[itemstack:get_name()]` is `nil` (or `false`), this
|
||||||
function does nothing, else that value is the maximum charge.
|
function does nothing, else that value is the maximum charge.
|
||||||
* The itemstack metadata is changed to contain the charge.
|
* The itemstack metadata is changed to contain the charge.
|
||||||
|
* `technic.get_charge(itemstack)`
|
||||||
|
* Returns the charge and max charge of the given itemstack.
|
||||||
|
* If the itemstack is not an RE chargeable item, both return values will be zero.
|
||||||
|
* `technic.set_charge(itemstack, charge)`
|
||||||
|
* Modifies the charge of the given itemstack.
|
||||||
|
|
||||||
### Node-specific
|
### Node-specific
|
||||||
* `technic.get_or_load_node(pos)`
|
* `technic.get_or_load_node(pos)`
|
||||||
|
@ -65,15 +65,26 @@ function technic.swap_node(pos, name)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Returns the meta of an item
|
||||||
|
-- Gets overridden when legacy.lua is loaded
|
||||||
|
function technic.get_stack_meta(itemstack)
|
||||||
|
return itemstack:get_meta()
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Same as technic.get_stack_meta for cans
|
||||||
|
function technic.get_stack_meta_cans(itemstack)
|
||||||
|
return itemstack:get_meta()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Fully charge RE chargeable item.
|
--- Fully charge RE chargeable item.
|
||||||
-- Must be defined early to reference in item definitions.
|
-- Must be defined early to reference in item definitions.
|
||||||
function technic.refill_RE_charge(stack)
|
function technic.refill_RE_charge(stack)
|
||||||
local max_charge = technic.power_tools[stack:get_name()]
|
local max_charge = technic.power_tools[stack:get_name()]
|
||||||
if not max_charge then return stack end
|
if not max_charge then return stack end
|
||||||
|
local meta = technic.get_stack_meta(stack)
|
||||||
|
meta:set_int("technic:charge", max_charge)
|
||||||
technic.set_RE_wear(stack, max_charge, max_charge)
|
technic.set_RE_wear(stack, max_charge, max_charge)
|
||||||
local meta = minetest.deserialize(stack:get_metadata()) or {}
|
|
||||||
meta.charge = max_charge
|
|
||||||
stack:set_metadata(minetest.serialize(meta))
|
|
||||||
return stack
|
return stack
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -39,3 +39,40 @@ for i = 0, 64 do
|
|||||||
minetest.register_alias("technic:lv_cable"..i, "technic:lv_cable")
|
minetest.register_alias("technic:lv_cable"..i, "technic:lv_cable")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Item meta
|
||||||
|
|
||||||
|
-- Meta keys that have changed
|
||||||
|
technic.legacy_meta_keys = {
|
||||||
|
["charge"] = "technic:charge",
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Converts legacy itemstack metadata string to itemstack meta and returns the ItemStackMetaRef
|
||||||
|
function technic.get_stack_meta(itemstack)
|
||||||
|
local meta = itemstack:get_meta()
|
||||||
|
local legacy_string = meta:get("") -- Get deprecated metadata
|
||||||
|
if legacy_string then
|
||||||
|
local legacy_table = minetest.deserialize(legacy_string)
|
||||||
|
if legacy_table then
|
||||||
|
local table = meta:to_table()
|
||||||
|
for k, v in pairs(legacy_table) do
|
||||||
|
table.fields[technic.legacy_meta_keys[k] or k] = v
|
||||||
|
end
|
||||||
|
meta:from_table(table)
|
||||||
|
end
|
||||||
|
meta:set_string("", "") -- Remove deprecated metadata
|
||||||
|
end
|
||||||
|
return meta
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Same as technic.get_stack_meta for cans.
|
||||||
|
-- (Cans didn't store a serialized table in the legacy metadata string, but just a number.)
|
||||||
|
function technic.get_stack_meta_cans(itemstack)
|
||||||
|
local meta = itemstack:get_meta()
|
||||||
|
local legacy_string = meta:get("") -- Get deprecated metadata
|
||||||
|
if legacy_string then
|
||||||
|
meta:set_string("can_level", legacy_string)
|
||||||
|
meta:set_string("", "") -- Remove deprecated metadata
|
||||||
|
return meta
|
||||||
|
end
|
||||||
|
return meta
|
||||||
|
end
|
||||||
|
@ -31,24 +31,26 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
local function make_reactor_formspec(meta)
|
local function make_reactor_formspec(meta)
|
||||||
local f = "size[8,9]"..
|
local f =
|
||||||
"label[0,0;"..S("Nuclear Reactor Rod Compartment").."]"..
|
"formspec_version[4]"..
|
||||||
"list[current_name;src;2,1;3,2;]"..
|
"size[10.75,10.75]"..
|
||||||
"list[current_player;main;0,5;8,4;]"..
|
"label[0.2,0.4;"..S("Nuclear Reactor Rod Compartment").."]"..
|
||||||
"listring[]"..
|
"list[current_name;src;1.5,1;3,2;]"..
|
||||||
"button[5.5,1.5;2,1;start;Start]"..
|
"list[current_player;main;0.5,5.5;8,4;]"..
|
||||||
"checkbox[5.5,2.5;autostart;automatic Start;"..meta:get_string("autostart").."]"
|
"listring[]"..
|
||||||
|
"button[5.7,1;2,1;start;Start]"..
|
||||||
|
"checkbox[5.7,2.75;autostart;automatic Start;"..meta:get_string("autostart").."]"
|
||||||
if not digiline_remote_path then
|
if not digiline_remote_path then
|
||||||
return f
|
return f
|
||||||
end
|
end
|
||||||
local digiline_enabled = meta:get_string("enable_digiline")
|
local digiline_enabled = meta:get_string("enable_digiline")
|
||||||
f = f.."checkbox[0.5,2.8;enable_digiline;Enable Digiline;"..digiline_enabled.."]"
|
f = f.."checkbox[1.5,3.75;enable_digiline;Enable Digiline channel;"..digiline_enabled.."]"
|
||||||
if digiline_enabled ~= "true" then
|
if digiline_enabled ~= "true" then
|
||||||
return f
|
return f
|
||||||
end
|
end
|
||||||
return f..
|
return f..
|
||||||
"button_exit[4.6,3.69;2,1;save;Save]"..
|
"field[2,4.2;4.25,1;remote_channel;;${remote_channel}]" ..
|
||||||
"field[1,4;4,1;remote_channel;Digiline Remote Channel;${remote_channel}]"
|
"button_exit[6.5,4.2;2,1;save;Save]"
|
||||||
end
|
end
|
||||||
|
|
||||||
local SS_OFF = 0
|
local SS_OFF = 0
|
||||||
@ -140,8 +142,11 @@ of a lead layer it will be converted to a lead layer.
|
|||||||
--]]
|
--]]
|
||||||
local function reactor_structure_badness(pos)
|
local function reactor_structure_badness(pos)
|
||||||
local vm = VoxelManip()
|
local vm = VoxelManip()
|
||||||
|
|
||||||
|
-- Blast-resistant Concrete Block layer outer positions
|
||||||
local pos1 = vector.subtract(pos, 3)
|
local pos1 = vector.subtract(pos, 3)
|
||||||
local pos2 = vector.add(pos, 3)
|
local pos2 = vector.add(pos, 3)
|
||||||
|
|
||||||
local MinEdge, MaxEdge = vm:read_from_map(pos1, pos2)
|
local MinEdge, MaxEdge = vm:read_from_map(pos1, pos2)
|
||||||
local data = vm:get_data()
|
local data = vm:get_data()
|
||||||
local area = VoxelArea:new({MinEdge=MinEdge, MaxEdge=MaxEdge})
|
local area = VoxelArea:new({MinEdge=MinEdge, MaxEdge=MaxEdge})
|
||||||
@ -157,16 +162,19 @@ local function reactor_structure_badness(pos)
|
|||||||
for z = pos1.z, pos2.z do
|
for z = pos1.z, pos2.z do
|
||||||
for y = pos1.y, pos2.y do
|
for y = pos1.y, pos2.y do
|
||||||
for x = pos1.x, pos2.x do
|
for x = pos1.x, pos2.x do
|
||||||
|
-- In the entire volume, make sure there is:
|
||||||
local cid = data[area:index(x, y, z)]
|
local cid = data[area:index(x, y, z)]
|
||||||
if x == pos1.x or x == pos2.x or
|
if x == pos1.x or x == pos2.x or
|
||||||
y == pos1.y or y == pos2.y or
|
y == pos1.y or y == pos2.y or
|
||||||
z == pos1.z or z == pos2.z then
|
z == pos1.z or z == pos2.z then
|
||||||
|
-- r=3 : Blast-resistant Concrete Block shell
|
||||||
if cid == c_blast_concrete then
|
if cid == c_blast_concrete then
|
||||||
blast_layer = blast_layer + 1
|
blast_layer = blast_layer + 1
|
||||||
end
|
end
|
||||||
elseif x == pos1.x+1 or x == pos2.x-1 or
|
elseif x == pos1.x+1 or x == pos2.x-1 or
|
||||||
y == pos1.y+1 or y == pos2.y-1 or
|
y == pos1.y+1 or y == pos2.y-1 or
|
||||||
z == pos1.z+1 or z == pos2.z-1 then
|
z == pos1.z+1 or z == pos2.z-1 then
|
||||||
|
-- r=2 : Lead Block shell
|
||||||
if cid == c_lead then
|
if cid == c_lead then
|
||||||
lead_layer = lead_layer + 1
|
lead_layer = lead_layer + 1
|
||||||
elseif cid == c_steel then
|
elseif cid == c_steel then
|
||||||
@ -175,6 +183,7 @@ local function reactor_structure_badness(pos)
|
|||||||
elseif x == pos1.x+2 or x == pos2.x-2 or
|
elseif x == pos1.x+2 or x == pos2.x-2 or
|
||||||
y == pos1.y+2 or y == pos2.y-2 or
|
y == pos1.y+2 or y == pos2.y-2 or
|
||||||
z == pos1.z+2 or z == pos2.z-2 then
|
z == pos1.z+2 or z == pos2.z-2 then
|
||||||
|
-- r=1 : Water cooling
|
||||||
if cid == c_water_source or cid == c_water_flowing then
|
if cid == c_water_source or cid == c_water_flowing then
|
||||||
water_layer = water_layer + 1
|
water_layer = water_layer + 1
|
||||||
end
|
end
|
||||||
@ -184,6 +193,8 @@ local function reactor_structure_badness(pos)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if steel_layer >= 96 then
|
if steel_layer >= 96 then
|
||||||
|
-- Legacy: convert stainless steel to lead
|
||||||
|
-- Why don't we accept both without conversion?
|
||||||
for z = pos1.z+1, pos2.z-1 do
|
for z = pos1.z+1, pos2.z-1 do
|
||||||
for y = pos1.y+1, pos2.y-1 do
|
for y = pos1.y+1, pos2.y-1 do
|
||||||
for x = pos1.x+1, pos2.x-1 do
|
for x = pos1.x+1, pos2.x-1 do
|
||||||
@ -206,6 +217,7 @@ local function reactor_structure_badness(pos)
|
|||||||
if water_layer > 25 then water_layer = 25 end
|
if water_layer > 25 then water_layer = 25 end
|
||||||
if lead_layer > 96 then lead_layer = 96 end
|
if lead_layer > 96 then lead_layer = 96 end
|
||||||
if blast_layer > 216 then blast_layer = 216 end
|
if blast_layer > 216 then blast_layer = 216 end
|
||||||
|
-- Amount of missing blocks
|
||||||
return (25 - water_layer) + (96 - lead_layer) + (216 - blast_layer)
|
return (25 - water_layer) + (96 - lead_layer) + (216 - blast_layer)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -297,7 +309,7 @@ local function run(pos, node)
|
|||||||
end
|
end
|
||||||
meta:set_int("HV_EU_supply", 0)
|
meta:set_int("HV_EU_supply", 0)
|
||||||
meta:set_int("burn_time", 0)
|
meta:set_int("burn_time", 0)
|
||||||
meta:set_string("infotext", S("%s Idle"):format(reactor_desc))
|
meta:set_string("infotext", S("@1 Idle", reactor_desc))
|
||||||
technic.swap_node(pos, "technic:hv_nuclear_reactor_core")
|
technic.swap_node(pos, "technic:hv_nuclear_reactor_core")
|
||||||
meta:set_int("structure_accumulated_badness", 0)
|
meta:set_int("structure_accumulated_badness", 0)
|
||||||
siren_clear(pos, meta)
|
siren_clear(pos, meta)
|
||||||
|
@ -110,6 +110,40 @@ local function quarry_handle_purge(pos)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Determines whether the quarry can dig the node at "pos"
|
||||||
|
-- "startpos" is located a few nodes above the quarry in South West direction (X-, Z-)
|
||||||
|
-- Returns the node to dig (to avoid double minetest.get_node lookup)
|
||||||
|
local function quarry_can_dig_node(startpos, pos, quarry_owner)
|
||||||
|
if minetest.is_protected(pos, quarry_owner) then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local node = technic.get_or_load_node(pos) or minetest.get_node(pos)
|
||||||
|
local def = minetest.registered_nodes[node.name] or {diggable=false}
|
||||||
|
-- doors mod among other thing does NOT like a nil digger...
|
||||||
|
local fakedigger = pipeworks.create_fake_player({
|
||||||
|
name = quarry_owner
|
||||||
|
})
|
||||||
|
if not def.diggable or (def.can_dig and not def.can_dig(pos, fakedigger)) then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Find airlike nodes on top of the current node. The entire Y column must be free.
|
||||||
|
for ay = pos.y+1, startpos.y do
|
||||||
|
local checkpos = {x=pos.x, y=ay, z=pos.z}
|
||||||
|
local checknode = technic.get_or_load_node(checkpos) or minetest.get_node(checkpos)
|
||||||
|
|
||||||
|
local cdef = minetest.registered_nodes[checknode.name] or {}
|
||||||
|
local is_kind_of_gas = cdef.buildable_to and cdef.sunlight_propagates and not cdef.walkable
|
||||||
|
and not cdef.diggable and (cdef.drawtype == "airlike" or cdef.drawtype == "glasslike")
|
||||||
|
if not is_kind_of_gas then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return node
|
||||||
|
end
|
||||||
|
|
||||||
local function quarry_run(pos, node)
|
local function quarry_run(pos, node)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -153,35 +187,11 @@ local function quarry_run(pos, node)
|
|||||||
vector.new(0, -ry, 0)),
|
vector.new(0, -ry, 0)),
|
||||||
vector.multiply(pdir, rp)),
|
vector.multiply(pdir, rp)),
|
||||||
vector.multiply(qdir, rq))
|
vector.multiply(qdir, rq))
|
||||||
local can_dig = true
|
|
||||||
if can_dig and minetest.is_protected and minetest.is_protected(digpos, owner) then
|
|
||||||
can_dig = false
|
|
||||||
end
|
|
||||||
local dignode
|
|
||||||
if can_dig then
|
|
||||||
dignode = technic.get_or_load_node(digpos) or minetest.get_node(digpos)
|
|
||||||
local dignodedef = minetest.registered_nodes[dignode.name] or {diggable=false}
|
|
||||||
-- doors mod among other thing does NOT like a nil digger...
|
|
||||||
local fakedigger = pipeworks.create_fake_player({
|
|
||||||
name = owner
|
|
||||||
})
|
|
||||||
if not dignodedef.diggable or (dignodedef.can_dig and not dignodedef.can_dig(digpos, fakedigger)) then
|
|
||||||
can_dig = false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if can_dig then
|
|
||||||
for ay = startpos.y, digpos.y+1, -1 do
|
|
||||||
local checkpos = {x=digpos.x, y=ay, z=digpos.z}
|
|
||||||
local checknode = technic.get_or_load_node(checkpos) or minetest.get_node(checkpos)
|
|
||||||
if checknode.name ~= "air" then
|
|
||||||
can_dig = false
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
nd = nd + 1
|
nd = nd + 1
|
||||||
if can_dig then
|
|
||||||
|
local dignode = quarry_can_dig_node(startpos, digpos, owner)
|
||||||
|
if dignode then
|
||||||
minetest.remove_node(digpos)
|
minetest.remove_node(digpos)
|
||||||
local drops = minetest.get_node_drops(dignode.name, "")
|
local drops = minetest.get_node_drops(dignode.name, "")
|
||||||
for _, dropped_item in ipairs(drops) do
|
for _, dropped_item in ipairs(drops) do
|
||||||
|
@ -9,5 +9,25 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (minetest.get_modpath('everness')) then
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'technic:lv_grinder',
|
||||||
|
recipe = {
|
||||||
|
{'everness:coral_desert_stone', 'default:diamond', 'everness:coral_desert_stone'},
|
||||||
|
{'everness:coral_desert_stone', 'technic:machine_casing', 'everness:coral_desert_stone'},
|
||||||
|
{'technic:granite', 'technic:lv_cable', 'technic:granite'},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'technic:lv_grinder',
|
||||||
|
recipe = {
|
||||||
|
{'everness:forsaken_desert_stone', 'default:diamond', 'everness:forsaken_desert_stone'},
|
||||||
|
{'everness:forsaken_desert_stone', 'technic:machine_casing', 'everness:forsaken_desert_stone'},
|
||||||
|
{'technic:granite', 'technic:lv_cable', 'technic:granite'},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
technic.register_grinder({tier="LV", demand={200}, speed=1})
|
technic.register_grinder({tier="LV", demand={200}, speed=1})
|
||||||
|
|
||||||
|
@ -324,6 +324,7 @@ for zp = 0, 1 do
|
|||||||
|
|
||||||
on_rightclick = function(pos, node, placer, itemstack, pointed_thing)
|
on_rightclick = function(pos, node, placer, itemstack, pointed_thing)
|
||||||
if is_supported_node(itemstack:get_name()) then
|
if is_supported_node(itemstack:get_name()) then
|
||||||
|
-- Stripped down version of "core.item_place_node"
|
||||||
if minetest.is_protected(pos, placer:get_player_name()) then
|
if minetest.is_protected(pos, placer:get_player_name()) then
|
||||||
minetest.log("action", placer:get_player_name()
|
minetest.log("action", placer:get_player_name()
|
||||||
.. " tried to place " .. itemstack:get_name()
|
.. " tried to place " .. itemstack:get_name()
|
||||||
@ -347,8 +348,7 @@ for zp = 0, 1 do
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Run script hook
|
-- Run script hook
|
||||||
local callback = nil
|
for _, callback in ipairs(minetest.registered_on_placenodes) do
|
||||||
for _, _ in ipairs(minetest.registered_on_placenodes) do
|
|
||||||
-- Copy pos and node because callback can modify them
|
-- Copy pos and node because callback can modify them
|
||||||
local pos_copy = { x = pos.x, y = pos.y, z = pos.z }
|
local pos_copy = { x = pos.x, y = pos.y, z = pos.z }
|
||||||
local newnode_copy = { name = def.name, param1 = 0, param2 = 0 }
|
local newnode_copy = { name = def.name, param1 = 0, param2 = 0 }
|
||||||
|
@ -409,28 +409,23 @@ minetest.register_on_player_receive_fields(
|
|||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
local function default_get_charge(itemstack)
|
function technic.get_charge(itemstack)
|
||||||
-- check if is chargable
|
-- check if is chargable
|
||||||
local tool_name = itemstack:get_name()
|
local tool_name = itemstack:get_name()
|
||||||
if not technic.power_tools[tool_name] then
|
if not technic.power_tools[tool_name] then
|
||||||
return 0, 0
|
return 0, 0
|
||||||
end
|
end
|
||||||
-- Set meta data for the tool if it didn't do it itself
|
local item_meta = technic.get_stack_meta(itemstack)
|
||||||
local item_meta = minetest.deserialize(itemstack:get_metadata()) or {}
|
return item_meta:get_int("technic:charge"), technic.power_tools[tool_name]
|
||||||
if not item_meta.charge then
|
|
||||||
item_meta.charge = 0
|
|
||||||
end
|
|
||||||
return item_meta.charge, technic.power_tools[tool_name]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function default_set_charge(itemstack, charge)
|
function technic.set_charge(itemstack, charge)
|
||||||
local tool_name = itemstack:get_name()
|
local tool_name = itemstack:get_name()
|
||||||
if technic.power_tools[tool_name] then
|
if technic.power_tools[tool_name] then
|
||||||
technic.set_RE_wear(itemstack, charge, technic.power_tools[tool_name])
|
technic.set_RE_wear(itemstack, charge, technic.power_tools[tool_name])
|
||||||
end
|
end
|
||||||
local item_meta = minetest.deserialize(itemstack:get_metadata()) or {}
|
local item_meta = technic.get_stack_meta(itemstack)
|
||||||
item_meta.charge = charge
|
item_meta:set_int("technic:charge", charge)
|
||||||
itemstack:set_metadata(minetest.serialize(item_meta))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function technic.charge_tools(meta, batt_charge, charge_step)
|
function technic.charge_tools(meta, batt_charge, charge_step)
|
||||||
@ -442,8 +437,8 @@ function technic.charge_tools(meta, batt_charge, charge_step)
|
|||||||
|
|
||||||
-- get callbacks
|
-- get callbacks
|
||||||
local src_def = src_stack:get_definition()
|
local src_def = src_stack:get_definition()
|
||||||
local technic_get_charge = src_def.technic_get_charge or default_get_charge
|
local technic_get_charge = src_def.technic_get_charge or technic.get_charge
|
||||||
local technic_set_charge = src_def.technic_set_charge or default_set_charge
|
local technic_set_charge = src_def.technic_set_charge or technic.set_charge
|
||||||
|
|
||||||
-- get tool charge
|
-- get tool charge
|
||||||
local tool_charge, item_max_charge = technic_get_charge(src_stack)
|
local tool_charge, item_max_charge = technic_get_charge(src_stack)
|
||||||
@ -476,8 +471,8 @@ function technic.discharge_tools(meta, batt_charge, charge_step, max_charge)
|
|||||||
|
|
||||||
-- get callbacks
|
-- get callbacks
|
||||||
local src_def = src_stack:get_definition()
|
local src_def = src_stack:get_definition()
|
||||||
local technic_get_charge = src_def.technic_get_charge or default_get_charge
|
local technic_get_charge = src_def.technic_get_charge or technic.get_charge
|
||||||
local technic_set_charge = src_def.technic_set_charge or default_set_charge
|
local technic_set_charge = src_def.technic_set_charge or technic.set_charge
|
||||||
|
|
||||||
-- get tool charge
|
-- get tool charge
|
||||||
local tool_charge, item_max_charge = technic_get_charge(src_stack)
|
local tool_charge, item_max_charge = technic_get_charge(src_stack)
|
||||||
|
@ -8,6 +8,71 @@ function technic.register_compressor_recipe(data)
|
|||||||
technic.register_recipe("compressing", data)
|
technic.register_recipe("compressing", data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Defuse the default recipes, since we have
|
||||||
|
-- the compressor to take over in a more realistic manner.
|
||||||
|
local crafts_to_clear = {
|
||||||
|
"default:desert_sand",
|
||||||
|
"default:sand",
|
||||||
|
"default:silver_sand",
|
||||||
|
}
|
||||||
|
|
||||||
|
local dependent_crafts_to_clear = {
|
||||||
|
everness = {
|
||||||
|
"everness:coral_sand",
|
||||||
|
"everness:coral_forest_deep_ocean_sand",
|
||||||
|
"everness:coral_white_sand",
|
||||||
|
"everness:crystal_sand",
|
||||||
|
"everness:cursed_sand",
|
||||||
|
"everness:cursed_lands_deep_ocean_sand",
|
||||||
|
"everness:crystal_forest_deep_ocean_sand",
|
||||||
|
"everness:mineral_sand",
|
||||||
|
},
|
||||||
|
nether = {
|
||||||
|
"nether:brick",
|
||||||
|
"nether:brick_compressed",
|
||||||
|
"nether:rack",
|
||||||
|
"nether:rack_deep",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Add dependent recipes to main collection of
|
||||||
|
-- recipes to be cleared if their mods are used.
|
||||||
|
for dependency, crafts in pairs(dependent_crafts_to_clear) do
|
||||||
|
if minetest.get_modpath(dependency) then
|
||||||
|
for _, craft_entry in ipairs(crafts) do
|
||||||
|
table.insert(crafts_to_clear, craft_entry)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Clear recipes
|
||||||
|
for _, craft_name in ipairs(crafts_to_clear) do
|
||||||
|
-- Regular bricks are 2x2 shaped, nether bricks are 3x3 shaped (irregular)
|
||||||
|
local is_regular = string.sub(craft_name, 1, 12) ~= "nether:brick"
|
||||||
|
local shaped_recipe
|
||||||
|
|
||||||
|
if is_regular then
|
||||||
|
shaped_recipe = {
|
||||||
|
{craft_name, craft_name},
|
||||||
|
{craft_name, craft_name},
|
||||||
|
}
|
||||||
|
else
|
||||||
|
shaped_recipe = {
|
||||||
|
{craft_name, craft_name, craft_name},
|
||||||
|
{craft_name, craft_name, craft_name},
|
||||||
|
{craft_name, craft_name, craft_name},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.clear_craft({
|
||||||
|
type = "shaped",
|
||||||
|
recipe = shaped_recipe,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Compile compressor recipes
|
||||||
|
--
|
||||||
local recipes = {
|
local recipes = {
|
||||||
{"default:snowblock", "default:ice"},
|
{"default:snowblock", "default:ice"},
|
||||||
{"default:sand 2", "default:sandstone"},
|
{"default:sand 2", "default:sandstone"},
|
||||||
@ -21,27 +86,36 @@ local recipes = {
|
|||||||
{"technic:uranium35_ingot 5", "technic:uranium_fuel"},
|
{"technic:uranium35_ingot 5", "technic:uranium_fuel"},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- defuse the default sandstone recipe, since we have the compressor to take over in a more realistic manner
|
local dependent_recipes = {
|
||||||
minetest.clear_craft({
|
everness = {
|
||||||
recipe = {
|
{"everness:coral_deep_ocean_sand 2", "everness:coral_deep_ocean_sandstone_block"},
|
||||||
{"default:sand", "default:sand"},
|
{"everness:coral_sand 2", "everness:coral_sandstone"},
|
||||||
{"default:sand", "default:sand"},
|
{"everness:coral_white_sand 2", "everness:coral_white_sandstone"},
|
||||||
|
{"everness:crystal_forest_deep_ocean_sand 2", "everness:crystal_forest_deep_ocean_sandstone_block"},
|
||||||
|
{"everness:crystal_sand 2", "everness:crystal_sandstone"},
|
||||||
|
{"everness:cursed_lands_deep_ocean_sand 2", "everness:cursed_lands_deep_ocean_sandstone_block"},
|
||||||
|
{"everness:cursed_sand 2", "everness:cursed_sandstone_block"},
|
||||||
|
{"everness:mineral_sand 2", "everness:mineral_sandstone"},
|
||||||
},
|
},
|
||||||
})
|
nether = {
|
||||||
minetest.clear_craft({
|
{"nether:brick 9", "nether:brick_compressed"},
|
||||||
recipe = {
|
{"nether:brick_compressed 9", "nether:nether_lump"},
|
||||||
{"default:desert_sand", "default:desert_sand"},
|
{"nether:rack", "nether:brick",},
|
||||||
{"default:desert_sand", "default:desert_sand"},
|
{"nether:rack_deep", "nether:brick_deep"},
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
minetest.clear_craft({
|
|
||||||
recipe = {
|
|
||||||
{"default:silver_sand", "default:silver_sand"},
|
|
||||||
{"default:silver_sand", "default:silver_sand"},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
|
-- Add dependent recipes to main recipe collection
|
||||||
|
-- if their mods are used.
|
||||||
|
for dependency, recipes_to_add in pairs(dependent_recipes) do
|
||||||
|
if minetest.get_modpath(dependency) then
|
||||||
|
for _, recipe_entry in ipairs(recipes_to_add) do
|
||||||
|
table.insert(recipes, recipe_entry)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Register compressor recipes
|
||||||
for _, data in pairs(recipes) do
|
for _, data in pairs(recipes) do
|
||||||
technic.register_compressor_recipe({input = {data[1]}, output = data[2]})
|
technic.register_compressor_recipe({input = {data[1]}, output = data[2]})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -36,49 +36,73 @@ local recipes = {
|
|||||||
{"default:ice", "default:snowblock"},
|
{"default:ice", "default:snowblock"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local dependent_recipes = {
|
||||||
|
-- Sandstones
|
||||||
|
everness = {
|
||||||
|
{"everness:coral_deep_ocean_sandstone_block", "everness:coral_deep_ocean_sand 2"},
|
||||||
|
{"everness:coral_sandstone", "everness:coral_sand 2"},
|
||||||
|
{"everness:coral_white_sandstone", "everness:coral_white_sand 2"},
|
||||||
|
{"everness:crystal_forest_deep_ocean_sandstone_block", "everness:crystal_forest_deep_ocean_sand 2"},
|
||||||
|
{"everness:crystal_sandstone", "everness:crystal_sand 2"},
|
||||||
|
{"everness:cursed_lands_deep_ocean_sandstone_block", "everness:cursed_lands_deep_ocean_sand 2"},
|
||||||
|
{"everness:cursed_sandstone_block", "everness:cursed_sand 2"},
|
||||||
|
{"everness:mineral_sandstone", "everness:mineral_sand 2"},
|
||||||
|
-- Lumps and wheat
|
||||||
|
{"everness:pyrite_lump", "technic:pyrite_dust 2"},
|
||||||
|
},
|
||||||
|
farming = {
|
||||||
|
{"farming:seed_wheat", "farming:flour 1"},
|
||||||
|
},
|
||||||
|
gloopores = {
|
||||||
|
{"gloopores:alatro_lump", "technic:alatro_dust 2"},
|
||||||
|
{"gloopores:kalite_lump", "technic:kalite_dust 2"},
|
||||||
|
{"gloopores:arol_lump", "technic:arol_dust 2"},
|
||||||
|
{"gloopores:talinite_lump", "technic:talinite_dust 2"},
|
||||||
|
{"gloopores:akalin_lump", "technic:akalin_dust 2"},
|
||||||
|
},
|
||||||
|
homedecor = {
|
||||||
|
{"home_decor:brass_ingot", "technic:brass_dust 1"},
|
||||||
|
},
|
||||||
|
moreores = {
|
||||||
|
{"moreores:mithril_lump", "technic:mithril_dust 2"},
|
||||||
|
{"moreores:silver_lump", "technic:silver_dust 2"},
|
||||||
|
},
|
||||||
|
nether = {
|
||||||
|
{"nether:nether_lump", "technic:nether_dust 2"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for dependency, materials_to_add in pairs(dependent_recipes) do
|
||||||
|
if minetest.get_modpath(dependency) then
|
||||||
|
for _, material_entry in ipairs(materials_to_add) do
|
||||||
|
table.insert(recipes, material_entry)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- defuse the sandstone -> 4 sand recipe to avoid infinite sand bugs (also consult the inverse compressor recipe)
|
-- defuse the sandstone -> 4 sand recipe to avoid infinite sand bugs (also consult the inverse compressor recipe)
|
||||||
minetest.clear_craft({
|
minetest.clear_craft({
|
||||||
recipe = {
|
recipe = {{"default:sandstone"}},
|
||||||
{"default:sandstone"}
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
minetest.clear_craft({
|
minetest.clear_craft({
|
||||||
recipe = {
|
recipe = {{"default:desert_sandstone"}},
|
||||||
{"default:desert_sandstone"}
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
minetest.clear_craft({
|
minetest.clear_craft({
|
||||||
recipe = {
|
recipe = {{"default:silver_sandstone"}},
|
||||||
{"default:silver_sandstone"}
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if minetest.get_modpath("farming") then
|
if minetest.get_modpath("everness") then
|
||||||
table.insert(recipes, {"farming:seed_wheat", "farming:flour 1"})
|
minetest.clear_craft({
|
||||||
|
recipe = {{"everness:mineral_sandstone"}},
|
||||||
|
})
|
||||||
|
-- Currently (2024-03-09), there seem to be no reverse recipes for any of the other everness sandstones.
|
||||||
end
|
end
|
||||||
|
|
||||||
if minetest.get_modpath("moreores") then
|
for _, data in ipairs(recipes) do
|
||||||
table.insert(recipes, {"moreores:mithril_lump", "technic:mithril_dust 2"})
|
|
||||||
table.insert(recipes, {"moreores:silver_lump", "technic:silver_dust 2"})
|
|
||||||
end
|
|
||||||
|
|
||||||
if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then
|
|
||||||
table.insert(recipes, {"gloopores:alatro_lump", "technic:alatro_dust 2"})
|
|
||||||
table.insert(recipes, {"gloopores:kalite_lump", "technic:kalite_dust 2"})
|
|
||||||
table.insert(recipes, {"gloopores:arol_lump", "technic:arol_dust 2"})
|
|
||||||
table.insert(recipes, {"gloopores:talinite_lump", "technic:talinite_dust 2"})
|
|
||||||
table.insert(recipes, {"gloopores:akalin_lump", "technic:akalin_dust 2"})
|
|
||||||
end
|
|
||||||
|
|
||||||
if minetest.get_modpath("homedecor") then
|
|
||||||
table.insert(recipes, {"home_decor:brass_ingot", "technic:brass_dust 1"})
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, data in pairs(recipes) do
|
|
||||||
technic.register_grinder_recipe({input = {data[1]}, output = data[2]})
|
technic.register_grinder_recipe({input = {data[1]}, output = data[2]})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- dusts
|
-- Dusts
|
||||||
local function register_dust(name, ingot)
|
local function register_dust(name, ingot)
|
||||||
local lname = string.lower(name)
|
local lname = string.lower(name)
|
||||||
lname = string.gsub(lname, ' ', '_')
|
lname = string.gsub(lname, ' ', '_')
|
||||||
@ -96,33 +120,57 @@ local function register_dust(name, ingot)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Sorted alphibeticaly
|
-- Sorted alphabetically
|
||||||
register_dust("Brass", "basic_materials:brass_ingot")
|
local dusts = {
|
||||||
register_dust("Bronze", "default:bronze_ingot")
|
{"Brass", "basic_materials:brass_ingot"},
|
||||||
register_dust("Carbon Steel", "technic:carbon_steel_ingot")
|
{"Bronze", "default:bronze_ingot"},
|
||||||
register_dust("Cast Iron", "technic:cast_iron_ingot")
|
{"Carbon Steel", "technic:carbon_steel_ingot"},
|
||||||
register_dust("Chernobylite", "technic:chernobylite_block")
|
{"Cast Iron", "technic:cast_iron_ingot"},
|
||||||
register_dust("Chromium", "technic:chromium_ingot")
|
{"Chernobylite", "technic:chernobylite_block"},
|
||||||
register_dust("Coal", nil)
|
{"Chromium", "technic:chromium_ingot"},
|
||||||
register_dust("Copper", "default:copper_ingot")
|
{"Coal", nil},
|
||||||
register_dust("Lead", "technic:lead_ingot")
|
{"Copper", "default:copper_ingot"},
|
||||||
register_dust("Gold", "default:gold_ingot")
|
{"Lead", "technic:lead_ingot"},
|
||||||
register_dust("Mithril", "moreores:mithril_ingot")
|
{"Gold", "default:gold_ingot"},
|
||||||
register_dust("Silver", "moreores:silver_ingot")
|
{"Mithril", "moreores:mithril_ingot"},
|
||||||
register_dust("Stainless Steel", "technic:stainless_steel_ingot")
|
{"Silver", "moreores:silver_ingot"},
|
||||||
register_dust("Stone", "default:stone")
|
{"Stainless Steel", "technic:stainless_steel_ingot"},
|
||||||
register_dust("Sulfur", nil)
|
{"Stone", "default:stone"},
|
||||||
register_dust("Tin", "default:tin_ingot")
|
{"Sulfur", nil},
|
||||||
register_dust("Wrought Iron", "technic:wrought_iron_ingot")
|
{"Tin", "default:tin_ingot"},
|
||||||
register_dust("Zinc", "technic:zinc_ingot")
|
{"Wrought Iron", "technic:wrought_iron_ingot"},
|
||||||
if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then
|
{"Zinc", "technic:zinc_ingot"},
|
||||||
register_dust("Akalin", "glooptest:akalin_ingot")
|
}
|
||||||
register_dust("Alatro", "glooptest:alatro_ingot")
|
|
||||||
register_dust("Arol", "glooptest:arol_ingot")
|
local dependent_dusts = {
|
||||||
register_dust("Kalite", nil)
|
everness = {
|
||||||
register_dust("Talinite", "glooptest:talinite_ingot")
|
{"Pyrite", "everness:pyrite_ingot"},
|
||||||
|
},
|
||||||
|
gloopores = {
|
||||||
|
{"Akalin", "glooptest:akalin_ingot"},
|
||||||
|
{"Alatro", "glooptest:alatro_ingot"},
|
||||||
|
{"Arol", "glooptest:arol_ingot"},
|
||||||
|
{"Kalite", nil},
|
||||||
|
{"Talinite", "glooptest:talinite_ingot"},
|
||||||
|
},
|
||||||
|
nether = {
|
||||||
|
{"Nether", "nether:nether_ingot"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for dependency, dusts_to_add in pairs(dependent_dusts) do
|
||||||
|
if minetest.get_modpath(dependency) then
|
||||||
|
for _, dust_entry in pairs(dusts_to_add) do
|
||||||
|
table.insert(dusts, dust_entry)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for _, data in ipairs(dusts) do
|
||||||
|
register_dust(data[1], data[2])
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Uranium
|
||||||
for p = 0, 35 do
|
for p = 0, 35 do
|
||||||
local nici = (p ~= 0 and p ~= 7 and p ~= 35) and 1 or nil
|
local nici = (p ~= 0 and p ~= 7 and p ~= 35) and 1 or nil
|
||||||
local psuffix = p == 7 and "" or p
|
local psuffix = p == 7 and "" or p
|
||||||
@ -158,6 +206,7 @@ for pa = 0, 34 do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Fuels
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "technic:coal_dust",
|
recipe = "technic:coal_dust",
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
name = technic
|
name = technic
|
||||||
depends = default, pipeworks, technic_worldgen, basic_materials
|
depends = default, pipeworks, technic_worldgen, basic_materials
|
||||||
optional_depends = bucket, screwdriver, mesecons, mesecons_mvps, digilines, digiline_remote, intllib, unified_inventory, vector_extras, dye, craftguide,i3
|
optional_depends = bucket, screwdriver, mesecons, mesecons_mvps, digilines, digiline_remote, intllib, unified_inventory, vector_extras, dye, craftguide, i3, everness, nether
|
||||||
|
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 675 B |
Before Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 405 B |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 275 B |
Before Width: | Height: | Size: 736 B |
Before Width: | Height: | Size: 670 B |
Before Width: | Height: | Size: 523 B |
Before Width: | Height: | Size: 778 B |
Before Width: | Height: | Size: 778 B |
Before Width: | Height: | Size: 772 B |
Before Width: | Height: | Size: 743 B |
Before Width: | Height: | Size: 181 B After Width: | Height: | Size: 181 B |
Before Width: | Height: | Size: 251 B After Width: | Height: | Size: 251 B |
Before Width: | Height: | Size: 168 B After Width: | Height: | Size: 168 B |
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 194 B |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.2 KiB |
BIN
technic/textures/technic_nether_dust.png
Normal file
After Width: | Height: | Size: 207 B |
Before Width: | Height: | Size: 533 B |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 457 B |
Before Width: | Height: | Size: 450 B |
Before Width: | Height: | Size: 551 B |
Before Width: | Height: | Size: 501 B |
Before Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 517 B |
Before Width: | Height: | Size: 511 B |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 507 B |
Before Width: | Height: | Size: 499 B |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 457 B |
Before Width: | Height: | Size: 459 B |
Before Width: | Height: | Size: 220 B |
Before Width: | Height: | Size: 407 B |
BIN
technic/textures/technic_pyrite_dust.png
Normal file
After Width: | Height: | Size: 451 B |
Before Width: | Height: | Size: 682 B |
Before Width: | Height: | Size: 245 B |
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 660 B |
Before Width: | Height: | Size: 653 B |
Before Width: | Height: | Size: 646 B |
Before Width: | Height: | Size: 763 B |
Before Width: | Height: | Size: 674 B |
Before Width: | Height: | Size: 453 B |
Before Width: | Height: | Size: 79 B |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.6 KiB |
BIN
technic/textures/technicx32/technic_pyrite_dust.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 483 B |
Before Width: | Height: | Size: 213 B |
Before Width: | Height: | Size: 663 B |
Before Width: | Height: | Size: 701 B |
Before Width: | Height: | Size: 807 B |
@ -12,14 +12,6 @@ local function set_can_wear(itemstack, level, max_level)
|
|||||||
itemstack:set_wear(temp)
|
itemstack:set_wear(temp)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_can_level(itemstack)
|
|
||||||
if itemstack:get_metadata() == "" then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return tonumber(itemstack:get_metadata())
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function technic.register_can(d)
|
function technic.register_can(d)
|
||||||
local data = {}
|
local data = {}
|
||||||
for k, v in pairs(d) do data[k] = v end
|
for k, v in pairs(d) do data[k] = v end
|
||||||
@ -33,7 +25,8 @@ function technic.register_can(d)
|
|||||||
if pointed_thing.type ~= "node" then return end
|
if pointed_thing.type ~= "node" then return end
|
||||||
local node = minetest.get_node(pointed_thing.under)
|
local node = minetest.get_node(pointed_thing.under)
|
||||||
if node.name ~= data.liquid_source_name then return end
|
if node.name ~= data.liquid_source_name then return end
|
||||||
local charge = get_can_level(itemstack)
|
local meta = technic.get_stack_meta_cans(itemstack)
|
||||||
|
local charge = meta:get_int("can_level")
|
||||||
if charge == data.can_capacity then return end
|
if charge == data.can_capacity then return end
|
||||||
if minetest.is_protected(pointed_thing.under, user:get_player_name()) then
|
if minetest.is_protected(pointed_thing.under, user:get_player_name()) then
|
||||||
minetest.log("action", user:get_player_name()..
|
minetest.log("action", user:get_player_name()..
|
||||||
@ -44,7 +37,7 @@ function technic.register_can(d)
|
|||||||
end
|
end
|
||||||
minetest.remove_node(pointed_thing.under)
|
minetest.remove_node(pointed_thing.under)
|
||||||
charge = charge + 1
|
charge = charge + 1
|
||||||
itemstack:set_metadata(tostring(charge))
|
meta:set_int("can_level", charge)
|
||||||
set_can_wear(itemstack, charge, data.can_capacity)
|
set_can_wear(itemstack, charge, data.can_capacity)
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
@ -63,7 +56,8 @@ function technic.register_can(d)
|
|||||||
-- Try to place node above the pointed source, or abort.
|
-- Try to place node above the pointed source, or abort.
|
||||||
if not def.buildable_to or node_name == data.liquid_source_name then return end
|
if not def.buildable_to or node_name == data.liquid_source_name then return end
|
||||||
end
|
end
|
||||||
local charge = get_can_level(itemstack)
|
local meta = technic.get_stack_meta_cans(itemstack)
|
||||||
|
local charge = meta:get_int("can_level")
|
||||||
if charge == 0 then return end
|
if charge == 0 then return end
|
||||||
if minetest.is_protected(pos, user:get_player_name()) then
|
if minetest.is_protected(pos, user:get_player_name()) then
|
||||||
minetest.log("action", user:get_player_name()..
|
minetest.log("action", user:get_player_name()..
|
||||||
@ -74,12 +68,13 @@ function technic.register_can(d)
|
|||||||
end
|
end
|
||||||
minetest.set_node(pos, {name=data.liquid_source_name})
|
minetest.set_node(pos, {name=data.liquid_source_name})
|
||||||
charge = charge - 1
|
charge = charge - 1
|
||||||
itemstack:set_metadata(tostring(charge))
|
meta:set_int("can_level", charge)
|
||||||
set_can_wear(itemstack, charge, data.can_capacity)
|
set_can_wear(itemstack, charge, data.can_capacity)
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
on_refill = function(stack)
|
on_refill = function(stack)
|
||||||
stack:set_metadata(tostring(data.can_capacity))
|
local meta = technic.get_stack_meta_cans(stack)
|
||||||
|
meta:set_int("can_level", data.can_capacity)
|
||||||
set_can_wear(stack, data.can_capacity, data.can_capacity)
|
set_can_wear(stack, data.can_capacity, data.can_capacity)
|
||||||
return stack
|
return stack
|
||||||
end,
|
end,
|
||||||
|
@ -5,9 +5,9 @@ local chainsaw_max_charge = 30000 -- Maximum charge of the saw
|
|||||||
-- if this is disabled.
|
-- if this is disabled.
|
||||||
local chainsaw_leaves = true
|
local chainsaw_leaves = true
|
||||||
|
|
||||||
local chainsaw_efficiency = 0.95 -- Drops less items
|
local chainsaw_efficiency = 0.92 -- Drops less items
|
||||||
|
|
||||||
-- Maximal dimensions of the tree to cut
|
-- Maximal dimensions of the tree to cut (giant sequoia)
|
||||||
local tree_max_radius = 10
|
local tree_max_radius = 10
|
||||||
local tree_max_height = 70
|
local tree_max_height = 70
|
||||||
|
|
||||||
@ -39,12 +39,16 @@ local tree_nodes = {
|
|||||||
["ethereal:bamboo"] = -1,
|
["ethereal:bamboo"] = -1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local tree_nodes_by_cid = {
|
||||||
|
-- content ID indexed table, data populated on mod load.
|
||||||
|
-- Format: [node_name] = cost_number
|
||||||
|
}
|
||||||
|
|
||||||
-- Function to decide whether or not to cut a certain node (and at which energy cost)
|
-- Function to decide whether or not to cut a certain node (and at which energy cost)
|
||||||
local function populate_costs(name, def)
|
local function populate_costs(name, def)
|
||||||
repeat
|
repeat
|
||||||
if tree_nodes[name] == -1 then
|
if tree_nodes[name] then
|
||||||
tree_nodes[name] = nil
|
break -- Manually specified node to chop
|
||||||
break -- Manually added, but need updating
|
|
||||||
end
|
end
|
||||||
if (def.groups.tree or 0) > 0 then
|
if (def.groups.tree or 0) > 0 then
|
||||||
break -- Tree node
|
break -- Tree node
|
||||||
@ -61,17 +65,18 @@ local function populate_costs(name, def)
|
|||||||
until 1
|
until 1
|
||||||
-- luacheck: pop
|
-- luacheck: pop
|
||||||
|
|
||||||
-- Function did not return! --> add content ID to the digging table
|
-- Add the node cost to the content ID indexed table
|
||||||
local content_id = minetest.get_content_id(name)
|
local content_id = minetest.get_content_id(name)
|
||||||
|
|
||||||
-- Get 12 in average
|
-- Make it so that the giant sequoia can be cut with a full charge
|
||||||
local cost = 0
|
local cost = tree_nodes[name] or 0
|
||||||
if def.groups.choppy then
|
if def.groups.choppy then
|
||||||
cost = def.groups.choppy * 5 -- trunks (usually 3 * 5)
|
cost = math.max(cost, def.groups.choppy * 14) -- trunks (usually 3 * 14)
|
||||||
elseif def.groups.snappy then
|
|
||||||
cost = def.groups.snappy * 2 -- leaves
|
|
||||||
end
|
end
|
||||||
tree_nodes[content_id] = math.max(4, cost)
|
if def.groups.snappy then
|
||||||
|
cost = math.max(cost, def.groups.snappy * 2) -- leaves
|
||||||
|
end
|
||||||
|
tree_nodes_by_cid[content_id] = math.max(4, cost)
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_on_mods_loaded(function()
|
minetest.register_on_mods_loaded(function()
|
||||||
@ -111,6 +116,7 @@ local cutter = {
|
|||||||
-- See function cut_tree()
|
-- See function cut_tree()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local safe_cut = minetest.settings:get_bool("technic_safe_chainsaw") ~= false
|
||||||
local c_air = minetest.get_content_id("air")
|
local c_air = minetest.get_content_id("air")
|
||||||
local function dig_recursive(x, y, z)
|
local function dig_recursive(x, y, z)
|
||||||
local i = cutter.area:index(x, y, z)
|
local i = cutter.area:index(x, y, z)
|
||||||
@ -119,13 +125,14 @@ local function dig_recursive(x, y, z)
|
|||||||
end
|
end
|
||||||
cutter.seen[i] = 1 -- Mark as visited
|
cutter.seen[i] = 1 -- Mark as visited
|
||||||
|
|
||||||
if cutter.param2[i] ~= 0 then
|
if safe_cut and cutter.param2[i] ~= 0 then
|
||||||
-- Do not dig manually placed nodes
|
-- Do not dig manually placed nodes
|
||||||
|
-- Problem: moretrees' generated jungle trees use param2 = 2
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local c_id = cutter.data[i]
|
local c_id = cutter.data[i]
|
||||||
local cost = tree_nodes[c_id]
|
local cost = tree_nodes_by_cid[c_id]
|
||||||
if not cost or cost > cutter.charge then
|
if not cost or cost > cutter.charge then
|
||||||
return -- Cannot dig this node
|
return -- Cannot dig this node
|
||||||
end
|
end
|
||||||
@ -306,10 +313,8 @@ minetest.register_tool("technic:chainsaw", {
|
|||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
local meta = minetest.deserialize(itemstack:get_metadata())
|
local meta = technic.get_stack_meta(itemstack)
|
||||||
if not meta or not meta.charge then
|
local charge = meta:get_int("technic:charge")
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local name = user:get_player_name()
|
local name = user:get_player_name()
|
||||||
if minetest.is_protected(pointed_thing.under, name) then
|
if minetest.is_protected(pointed_thing.under, name) then
|
||||||
@ -319,14 +324,14 @@ minetest.register_tool("technic:chainsaw", {
|
|||||||
|
|
||||||
-- Send current charge to digging function so that the
|
-- Send current charge to digging function so that the
|
||||||
-- chainsaw will stop after digging a number of nodes
|
-- chainsaw will stop after digging a number of nodes
|
||||||
chainsaw_dig(user, pointed_thing.under, meta.charge)
|
chainsaw_dig(user, pointed_thing.under, charge)
|
||||||
meta.charge = cutter.charge
|
charge = cutter.charge
|
||||||
|
|
||||||
cutter = {} -- Free RAM
|
cutter = {} -- Free RAM
|
||||||
|
|
||||||
if not technic.creative_mode then
|
if not technic.creative_mode then
|
||||||
technic.set_RE_wear(itemstack, meta.charge, chainsaw_max_charge)
|
meta:set_int("technic:charge", charge)
|
||||||
itemstack:set_metadata(minetest.serialize(meta))
|
technic.set_RE_wear(itemstack, charge, chainsaw_max_charge)
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
|
@ -38,12 +38,13 @@ local function check_for_flashlight(player)
|
|||||||
local hotbar = inv:get_list("main")
|
local hotbar = inv:get_list("main")
|
||||||
for i = 1, 8 do
|
for i = 1, 8 do
|
||||||
if hotbar[i]:get_name() == "technic:flashlight" then
|
if hotbar[i]:get_name() == "technic:flashlight" then
|
||||||
local meta = minetest.deserialize(hotbar[i]:get_metadata())
|
local meta = technic.get_stack_meta(hotbar[i])
|
||||||
if meta and meta.charge and meta.charge >= 2 then
|
local charge = meta:get_int("technic:charge")
|
||||||
|
if charge >= 2 then
|
||||||
if not technic.creative_mode then
|
if not technic.creative_mode then
|
||||||
meta.charge = meta.charge - 2;
|
charge = charge - 2;
|
||||||
technic.set_RE_wear(hotbar[i], meta.charge, flashlight_max_charge)
|
meta:set_int("technic:charge", charge)
|
||||||
hotbar[i]:set_metadata(minetest.serialize(meta))
|
technic.set_RE_wear(hotbar[i], charge, flashlight_max_charge)
|
||||||
inv:set_stack("main", i, hotbar[i])
|
inv:set_stack("main", i, hotbar[i])
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
|