[Modpack] TechPack [techpack]

sangeet
Member
Posts: 49
Joined: Sat Feb 13, 2021 12:15

Re: [Modpack] TechPack [techpack]

by sangeet » Post

Ok, i have a new issue. :)

When automatic gravel sieve is defect, players are able to take ores and gravel from it even on protected territory. And the are also able to repair it.

TeckPack is up to date.

0siribix
Member
Posts: 123
Joined: Tue Nov 17, 2020 20:54
GitHub: 0siribix
In-game: 0siribix

Re: [Modpack] TechPack [techpack]

by 0siribix » Post

Submitted pull request to fix a protection bug with Gravel Sieve

User avatar
joe7575
Member
Posts: 850
Joined: Mon Apr 24, 2017 20:38
GitHub: joe7575
In-game: JoSto wuffi
Location: Germany, in the deep south

Re: [Modpack] TechPack [techpack]

by joe7575 » Post

I merged the pull request from 0siribix.
Many thanks to 0siribix!
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

0siribix
Member
Posts: 123
Joined: Tue Nov 17, 2020 20:54
GitHub: 0siribix
In-game: 0siribix

Re: [Modpack] TechPack [techpack]

by 0siribix » Post

I've run into the issue where if using a pushing node that pushes a stack, if there isn't room for the full stack, then it returns false and the pusher stops with "blocked" state. Ideally, the pushing node would try to push a partial stack and "unpull" the leftover. I have two ideas on how to accomplish this without breaking backward compatibility.

The first (and I think probably the better option) is to add a 5th (optional) parameter to "[node].on_push_item" called leftover. If leftover isn't nil then push the leftover back to the source node. Maybe it should also note in the api.md to check tubelib version before using that function?

The second idea (already did this locally and it tested successful), is to have the client mod change the item count. The pusher node then checks to see if the count has changed and if so then "unpull" the remainder back to the source

Code: Select all

-- client mod
-- on_push_item(pos, side, item, player_name)
-- at this point, inventory has no empty slots and the item we want to maximize is not full
local num_allowed = item:get_stack_max() - item:get_count()
if num_allowed > 0 then
	item:set_count(num_allowed)
	return tubelib.put_item(meta, "main", item)
end

Code: Select all

-- \techpack\tubelib_addons3\pusher.lua
local function pushing(pos, meta)
...
	if items ~= nil then
		local count = items:get_count() -- get current stack size
...
	if State.get_state(pos, meta) ~= tubelib.STOPPED then
		State:keep_running(pos, meta, COUNTDOWN_TICKS, 1)
	end
	if items:get_count() < count then -- count changed by client mod
		items:set_count(count - items:get_count()) -- calculate leftover
		tubelib.unpull_items(pos, "L", items, player_name)
	end
My question is which of these (or another way I haven't thought of) would be best to keep backward compatibility?

0siribix
Member
Posts: 123
Joined: Tue Nov 17, 2020 20:54
GitHub: 0siribix
In-game: 0siribix

Re: [Modpack] TechPack [techpack]

by 0siribix » Post

Oh, maybe I could do this?

Code: Select all

local leftover
if num_allowed < item:get_count() then leftover = item:get_count() - num_allowed
if tubelib.put_item(meta, "main", item) then return false end
return true, leftover
Then in the pushing node I can do this

Code: Select all

local result, leftover = tubelib.push_items(pos, "R", items, player_name)
if result == false then -- unpull_items
...
if leftover then -- unpull just the leftover
Currently I think this is the best solution

0siribix
Member
Posts: 123
Joined: Tue Nov 17, 2020 20:54
GitHub: 0siribix
In-game: 0siribix

Re: [Modpack] TechPack [techpack]

by 0siribix » Post

I believe I have completed support for refilling a stack even if the inventory is full. What I mean is if you have a High Perf Pusher putting stacks of dirt into a chest and that chest has all slots full but you have some dirt in the chest that is not a full stack, then the pusher will fill that stack and return the leftover. This is fully backward compatible because to use the refill function you have to pass an additional 'true' to tubelib.put_item.

Code: Select all

return tubelib.put_item(meta, "main", item, tubelib.allow_refill)
If it is missing or nil then it will behave as usual. Leftover stack is added as an additional return from "tubelib.on_push_item

Code: Select all

return true, leftover
Currently I added this behavior for all included items on the "tubelib.put_item" function but not for "tubelib.unpull_item". I wonder if it should be added to unpull as well? Seems to me that unpull should always return a stack that was sent but maybe I don't understand the full scope?

Also, there are some places that I skipped because I don't fully understand the purpose, e.g. in tubelib_addons1\harvester.lua in function check_fuel: I don't understand the purpose of this

Code: Select all

		if not tubelib.is_fuel(fuel_item) then
			tubelib.put_item(meta, "fuel", fuel_item)
			return false
		end
so I'm not sure if this should allow refill?

code is here
https://github.com/0siribix/techpack

User avatar
joe7575
Member
Posts: 850
Joined: Mon Apr 24, 2017 20:38
GitHub: joe7575
In-game: JoSto wuffi
Location: Germany, in the deep south

Re: [Modpack] TechPack [techpack]

by joe7575 » Post

I don't see any real reason why the behaviour of the pusher should be changed.

So far this has never been a problem, and Techage works according to the same scheme. Surely you could have done the whole thing differently at the beginning. In order to change the behaviour of the pusher and thus of entire tubelib systems, there must be an important reason. But I don't see anyone there.

Why is that a problem when an inventory may not be completely filled? Inventory should never completely fill up. At the latest with the next push there is a backlog of items and thus an undesirable behaviour of the complete system.
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

0siribix
Member
Posts: 123
Joined: Tue Nov 17, 2020 20:54
GitHub: 0siribix
In-game: 0siribix

Re: [Modpack] TechPack [techpack]

by 0siribix » Post

This isn't a major issue and probably would only affect few scenarios. But as an example, if I have items pushing into 4 chests and each has a partial stack of the item trying to push, the pushing node would stop where with this update, it will fill those stacks and possibly eliminate the stack from the source

0siribix
Member
Posts: 123
Joined: Tue Nov 17, 2020 20:54
GitHub: 0siribix
In-game: 0siribix

Re: [Modpack] TechPack [techpack]

by 0siribix » Post

To be clear: tubelib.put_item still works as is so existing mods are not required to change for the new refill feature. If an existing mod wants to use the refill feature then they would just need to add true (or tubelib.allow_refill) to the function call and return true, leftover (where leftover is a stack). At this point the tubelib.put_item will unpull the leftover to the source

FWIW, this feature is less useful for chests or regular containers and more useful for something like drawers or maybe warehouse boxes where you have specific slots dedicated to certain items. This is also useful for a high perf pusher/distributor pushing fuel to a harvester or quarry for example.

User avatar
joe7575
Member
Posts: 850
Joined: Mon Apr 24, 2017 20:38
GitHub: joe7575
In-game: JoSto wuffi
Location: Germany, in the deep south

Re: [Modpack] TechPack [techpack]

by joe7575 » Post

I changed the high performance pusher and chest so that partial stacks can also be moved.
I used the possibility that the parameter item is passed by reference and therefore can be changed by the called function on_push_item.

This was the "minimally invasive" solution and should allow the same implementation for drawers.
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

0siribix
Member
Posts: 123
Joined: Tue Nov 17, 2020 20:54
GitHub: 0siribix
In-game: 0siribix

Re: [Modpack] TechPack [techpack]

by 0siribix » Post

This is great news 😊
I used this method previously but I changed it and now I can't remember why 🤷
I will test other stack pushing blocks and if something doesn't work as expected, I'll submit a PR

User avatar
joe7575
Member
Posts: 850
Joined: Mon Apr 24, 2017 20:38
GitHub: joe7575
In-game: JoSto wuffi
Location: Germany, in the deep south

Re: [Modpack] TechPack [techpack]

by joe7575 » Post

0siribix wrote:
Sun Aug 01, 2021 15:08
I will test other stack pushing blocks and if something doesn't work as expected, I'll submit a PR
But not in TechPack please. Normal pushing nodes only push single items. This function is only useful for the HP pusher and should be limited to it.
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

0siribix
Member
Posts: 123
Joined: Tue Nov 17, 2020 20:54
GitHub: 0siribix
In-game: 0siribix

Re: [Modpack] TechPack [techpack]

by 0siribix » Post

I understand. I believe HP Distributor was the other pushing block that needed change. I previously decided to modify put_item to give universal compatibility. I am currently looking to make an add-on that will override these functions so maybe I can do that without modifying the original mod if you find this acceptable

User avatar
joe7575
Member
Posts: 850
Joined: Mon Apr 24, 2017 20:38
GitHub: joe7575
In-game: JoSto wuffi
Location: Germany, in the deep south

Re: [Modpack] TechPack [techpack]

by joe7575 » Post

You are right, HP Distributor is also affected, I will change it, too
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

0siribix
Member
Posts: 123
Joined: Tue Nov 17, 2020 20:54
GitHub: 0siribix
In-game: 0siribix

Re: [Modpack] TechPack [techpack]

by 0siribix » Post

I must apologize, I think it's broken now :-/
I have a default:chest that is full of partial stacks. HP pusher looks like it's pushing and never shows blocked but nothing moves (not pulled, not pushed).

If you prefer to reset back to 786cc85 I believe I can add this functionality as an add-on for techpack. This way original code is unchanged and you don't have to try to support the changes.

User avatar
joe7575
Member
Posts: 850
Joined: Mon Apr 24, 2017 20:38
GitHub: joe7575
In-game: JoSto wuffi
Location: Germany, in the deep south

Re: [Modpack] TechPack [techpack]

by joe7575 » Post

It works perfectly on my side. I have tested different constellations of chests and pushers.
How does your setup look like?
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

0siribix
Member
Posts: 123
Joined: Tue Nov 17, 2020 20:54
GitHub: 0siribix
In-game: 0siribix

Re: [Modpack] TechPack [techpack]

by 0siribix » Post

I'll perform a clean pull and test again with no other mods as soon as I get a moment

0siribix
Member
Posts: 123
Joined: Tue Nov 17, 2020 20:54
GitHub: 0siribix
In-game: 0siribix

Re: [Modpack] TechPack [techpack]

by 0siribix » Post

My apologies, it is working as expected

User avatar
Ghaydn
Member
Posts: 54
Joined: Sat Sep 26, 2020 11:58
In-game: ghaydn
Location: Moscow, Russia

Re: [Modpack] TechPack [techpack]

by Ghaydn » Post

Please add support for illumination mod. It's a simpler alternative to wielded_light. Support it would be very simple, just change

Code: Select all

if minetest.global_exists("wielded_light") then
to

Code: Select all

if minetest.global_exists("wielded_light") or minetest.global_exists("illumination") then
TA don't use wielded_light api, so there will be no difference.
Why? Illumination behaves different than wielded light, for example, on ladders. That's why.
Nobody understands me... — вРН БШ ЯЙЮГЮКХ?

User avatar
joe7575
Member
Posts: 850
Joined: Mon Apr 24, 2017 20:38
GitHub: joe7575
In-game: JoSto wuffi
Location: Germany, in the deep south

Re: [Modpack] TechPack [techpack]

by joe7575 » Post

Ghaydn wrote:
Thu Aug 05, 2021 15:28
Please add support for illumination mod.
Added, will be in the next release.
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

LadyK
New member
Posts: 2
Joined: Sat Sep 29, 2018 13:51
GitHub: LadyK
IRC: LadyK
In-game: LadyK

Re: [Modpack] TechPack [techpack]

by LadyK » Post

Can you please update harvester to harvest the new crops from farming redo mod? Also, would you add the option to keep seeds from plants that produce crops and seeds? Some servers have recipes that use the seeds and it would be nice to harvest those as well. Thanks! This is a great mod btw! I'm enjoying it on Avalon.
You can find me playing many servers! See you in game!

Mineminer
Member
Posts: 325
Joined: Mon Mar 05, 2018 04:05

Re: [Modpack] TechPack [techpack]

by Mineminer » Post

LadyK wrote:
Fri Aug 20, 2021 14:33
Can you please update harvester to harvest the new crops from farming redo mod? Also, would you add the option to keep seeds from plants that produce crops and seeds? Some servers have recipes that use the seeds and it would be nice to harvest those as well. Thanks! This is a great mod btw! I'm enjoying it on Avalon.
Umm it already supports the latest Farming Redo, we have it running on play.deafblindminetestgaming.com just fine.

But you are right it should feature an option/upgrade for "extras" seeds' harvesting.

User avatar
joe7575
Member
Posts: 850
Joined: Mon Apr 24, 2017 20:38
GitHub: joe7575
In-game: JoSto wuffi
Location: Germany, in the deep south

Re: [Modpack] TechPack [techpack]

by joe7575 » Post

I saw that LadyK made a PR on GitHub. 8 crop types were missing. Thank you, very much.
I merged the PR already.
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

LadyK
New member
Posts: 2
Joined: Sat Sep 29, 2018 13:51
GitHub: LadyK
IRC: LadyK
In-game: LadyK

Re: [Modpack] TechPack [techpack]

by LadyK » Post

Thanks! ^_^ You responded so fast! Sorry for alphabetizing the list.
You can find me playing many servers! See you in game!

0siribix
Member
Posts: 123
Joined: Tue Nov 17, 2020 20:54
GitHub: 0siribix
In-game: 0siribix

Re: [Modpack] TechPack [techpack]

by 0siribix » Post

LadyK wrote:
Fri Aug 20, 2021 18:38
Sorry for alphabetizing the list.
🤣🤣🤣

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 15 guests