Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation #53

Open
10 of 12 tasks
BuckarooBanzay opened this issue Jun 4, 2020 · 6 comments
Open
10 of 12 tasks

Documentation #53

BuckarooBanzay opened this issue Jun 4, 2020 · 6 comments
Milestone

Comments

@BuckarooBanzay
Copy link
Member

BuckarooBanzay commented Jun 4, 2020

There are already some docs in the upstream wiki, but some of the local customizations
should have documentation too:

A simple markdown documentation should suffice

@BuckarooBanzay BuckarooBanzay added the Enhancement New feature or request label Jun 4, 2020
BuckarooBanzay added a commit that referenced this issue Jun 18, 2020
BuckarooBanzay added a commit that referenced this issue Jun 19, 2020
…-wiki only has minor edits since 2017)

related: #53
@OgelGames OgelGames mentioned this issue Dec 13, 2020
3 tasks
@OgelGames OgelGames added Documentation and removed Enhancement New feature or request labels Dec 22, 2020
S-S-X pushed a commit that referenced this issue Oct 20, 2021
S-S-X pushed a commit that referenced this issue Oct 20, 2021
…-wiki only has minor edits since 2017)

related: #53
@S-S-X S-S-X added this to the 2.0.0 milestone Oct 30, 2021
@S-S-X
Copy link
Member

S-S-X commented Oct 30, 2021

Linked to 2.0 release milestone and added API changes to documentation task list.

@S-S-X
Copy link
Member

S-S-X commented Nov 5, 2021

I think it is better to keep deprecated stuff (that is still available) away from documentation, and remove if present.
If still somehow relevant like deprecated function or table moved to compat/whteveritwas.lua then include deprecation warnings using Minetest logging facilities.

If something should be removed it might be good to consider moving it to compat directory and throwing clean error(message) about situation instead of just removing said function.

(not sure if we want to do that but this also allows I_do_not _care_about_deprecation = true configuration for some stuff).

@S-S-X
Copy link
Member

S-S-X commented Nov 5, 2021

There are already some docs in the upstream wiki

This documentation is already pretty much irrelevant and becomes even less relevant all the time because so much has changed, probably just confusing:

  • Whole network and switching works differently
  • Registrations for tools / machines / cables are about change
  • Some machines work different way and have different features
  • API and especially internal working is generally very different
  • Commands are different
  • I am sure there's a lot more that could be added to this list

@OgelGames
Copy link
Contributor

Yeah, I had a look at the wiki, and there is nothing of use there, and one page is just plain incorrect (for both versions): https://github.com/minetest-mods/technic/wiki/Chests

@mase76
Copy link

mase76 commented Sep 8, 2022

I don't get any answer, not even an event when sending commands to the chest. Can you give a small example for the count_item command?

@S-S-X
Copy link
Member

S-S-X commented Sep 8, 2022

I don't get any answer, not even an event when sending commands to the chest. Can you give a small example for the count_item command?

{
  command = "count_item",
  item = "default:dirt"
}

Here's code handling commands:

function technic.chests.digiline_effector(pos, _, channel, msg)
local meta = minetest.get_meta(pos)
local set_channel = meta:get_string("channel")
if channel ~= set_channel then
return
end
if type(msg) ~= "table" or not msg.command then
return
end
local inv = meta:get_inventory()
if msg.command == "sort" then
technic.chests.sort_inv(inv, meta:get_int("sort_mode"))
elseif msg.command == "is_empty" then
local empty = inv:is_empty("main")
digilines.receptor_send(pos, digilines.rules.default, set_channel, empty)
elseif msg.command == "get_list" then
local inv_table = {}
local list = inv:get_list("main")
if list then
for _,stack in ipairs(list) do
if not stack:is_empty() then
table.insert(inv_table, stack:get_name().." "..stack:get_count())
else
table.insert(inv_table, "")
end
end
end
digilines.receptor_send(pos, digilines.rules.default, set_channel, inv_table)
elseif msg.command == "get_stack" and type(msg.index) == "number" then
local stack = inv:get_stack("main", msg.index)
local item = stack:to_table()
if item then
-- item available at that slot
local def = minetest.registered_items[stack:get_name()]
item.groups = def and table.copy(def.groups) or {}
digilines.receptor_send(pos, digilines.rules.default, set_channel, item)
else
-- nothing there, return nil
digilines.receptor_send(pos, digilines.rules.default, set_channel, nil)
end
elseif msg.command == "contains_item" and (type(msg.item) == "string" or type(msg.item) == "table") then
local contains = inv:contains_item("main", msg.item)
digilines.receptor_send(pos, digilines.rules.default, set_channel, contains)
elseif msg.command == "room_for_item" and (type(msg.item) == "string" or type(msg.item) == "table") then
local room = inv:room_for_item("main", msg.item)
digilines.receptor_send(pos, digilines.rules.default, set_channel, room)
elseif msg.command == "count_item" and (type(msg.item) == "string" or type(msg.item) == "table") then
local count = 0
local list = inv:get_list("main")
if list then
if type(msg.item) == "string" then
local itemstack = ItemStack(msg.item)
msg.item = {
name = itemstack:get_name(),
count = itemstack:get_count(),
wear = string.match(msg.item, "%S*:%S*%s%d%s(%d)") and itemstack:get_wear(),
metadata = string.match(msg.item, "%S*:%S*%s%d%s%d(%s.*)") and itemstack:get_meta():get_string("")
}
end
for _,stack in pairs(list) do
if not stack:is_empty() and item_matches(msg.item, stack) then
count = count + stack:get_count()
end
end
if msg.item.count and type(msg.item.count) == "number" and msg.item.count > 1 then
count = math.floor(count / msg.item.count)
end
end
digilines.receptor_send(pos, digilines.rules.default, set_channel, count)
end
end

@Athozus Athozus mentioned this issue Jul 22, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants