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,7 +27,11 @@ Helper functions
|
||||
* Tells whether the node `nodename` is the cable of the tier `tier`.
|
||||
* `technic.get_cable_tier(nodename)`
|
||||
* Returns the tier of the cable `nodename` or `nil`.
|
||||
* `technic.trace_node_ray(pos, dir, range)`
|
||||
* `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)`
|
||||
* Returns an iteration function (usable in the for loop) to iterate over the
|
||||
node positions along the specified ray.
|
||||
* The returned positions will not include the starting position `pos`.
|
||||
|
@ -9,6 +9,13 @@ function technic.get_cable_tier(nodename)
|
||||
return cable_tier[nodename]
|
||||
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)
|
||||
-- Call the default on_place function with a fake itemstack
|
||||
local temp_itemstack = ItemStack(itemstack)
|
||||
|
Loading…
x
Reference in New Issue
Block a user