Add technic.register_cable_tier(name, tier)
(#294)
Co-authored-by: BuckarooBanzay <BuckarooBanzay@users.noreply.github.com>
This commit is contained in:
parent
c1cf1d0c37
commit
ebba32ad25
@ -27,6 +27,10 @@ Helper functions
|
|||||||
* Tells whether the node `nodename` is the cable of the tier `tier`.
|
* Tells whether the node `nodename` is the cable of the tier `tier`.
|
||||||
* `technic.get_cable_tier(nodename)`
|
* `technic.get_cable_tier(nodename)`
|
||||||
* Returns the tier of the cable `nodename` or `nil`.
|
* Returns the tier of the cable `nodename` or `nil`.
|
||||||
|
* `technic.register_cable_tier(nodename, tier)`
|
||||||
|
* Register user defined cable to list of known tier cables.
|
||||||
|
* `nodename`: string, name of the node
|
||||||
|
* `tier`: string, tier name
|
||||||
* `technic.trace_node_ray(pos, dir, range)`
|
* `technic.trace_node_ray(pos, dir, range)`
|
||||||
* Returns an iteration function (usable in the for loop) to iterate over the
|
* Returns an iteration function (usable in the for loop) to iterate over the
|
||||||
node positions along the specified ray.
|
node positions along the specified ray.
|
||||||
|
@ -9,6 +9,13 @@ function technic.get_cable_tier(nodename)
|
|||||||
return cable_tier[nodename]
|
return cable_tier[nodename]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function technic.register_cable_tier(name, tier)
|
||||||
|
assert(technic.machines[tier], "Tier does not exist")
|
||||||
|
assert(type(name) == "string", "Invalid node name")
|
||||||
|
|
||||||
|
cable_tier[name] = tier
|
||||||
|
end
|
||||||
|
|
||||||
local function item_place_override_node(itemstack, placer, pointed, node)
|
local function item_place_override_node(itemstack, placer, pointed, node)
|
||||||
-- Call the default on_place function with a fake itemstack
|
-- Call the default on_place function with a fake itemstack
|
||||||
local temp_itemstack = ItemStack(itemstack)
|
local temp_itemstack = ItemStack(itemstack)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user