pandorabox-io / pandorabox.io

Pandorabox infrastructure code
https://pandorabox.io
31 stars 4 forks source link

Fence connections #433

Open thomasrudin opened 4 years ago

thomasrudin commented 4 years ago

@JRPete2020

Discussion

can we just limit it to stone, stone brick blocks(stone, silver, desert) & cobblestone?
there wouldn't be a need to connect to everything in the fence_connect.conf
that list is really insane!

--Original message follows--
Hey, i checked that out,
my problem is that this mod modifies a *lot* of the builtin nodes... :/

---- Original message ----
Mod allows fence to connect to other blocks as fence connects to wood based nodes.

https://github.com/zing269/fence_connect
S-S-X commented 4 years ago

limit it to stone, stone brick blocks(stone, silver, desert) & cobblestone

Would it be okay to have option to connect / disconnect fences to/from any nearby solid (walkable or not buildable?) nodes other than fences (which would be always connected) with right click?

I'd like to have fences that connect to wood for example and those are used in some buildings.

S-S-X commented 4 years ago

fyi I tested this ^ and seems to work okay without any modifications to other nodes. only adding more stuff for fences. just tried what would happen as I wanted to learn a bit more mt api, I still dont know much of it so might be that approach I've used while testing is not good at all.

Basically I have 2 additional fence nodes (params copied from default fence) and can select how fences connect: only to other fences, default connections or extended connections with few other mod blocks to connect to.

So I've cloned default fences and changed few params for clones.

Question: would it be bad to have few more fence nodes to allow different connections? And maybe allow screwdriver ot something to swap those nodes (just regular fences in inventory)

thomasrudin commented 4 years ago

So I've cloned default fences and changed few params for clones.

Do we really need to fork this? i think overriding the connects_to field of the fence-node should be sufficient...

Basically I have 2 additional fence nodes (params copied from default fence) and can select how fences connect: only to other fences, default connections or extended connections with few other mod blocks to connect to.

How does this look like?

S-S-X commented 4 years ago

Do we really need to fork this? i think overriding the connects_to field of the fence-node should be sufficient...

Exactly, that's what I am doing. Cloned just for multiple choices for connections as I wanted to test how it would work on minetest.

How does this look like?

https://github.com/S-S-X/fence_connect to be clear: this is not mod that can be just grabbed from there, it is simple test and low quality code

image

If you know that I've done something there that should not be done. Also there's too much meta stuff in my test thing and it would require some cleanup + maybe even some tool (screwdriver?) if it looks like okayish approach. Would also really like to hear if you see any possible problems there.

edit. Well actually that looks pretty similar to https://github.com/zing269/fence_connect with only difference being that I've collected nodes and some groups for fences instead of adding new group for other nodes. And also that I did not know about minetest.override_item which seems to be a lot better way to do things.

S-S-X commented 4 years ago

Do we really need to fork this?

Also no, I don't think this needs to be another mod or needs to be forked, Could be simply in customization. Also I've not forked anything, just did some tests around how it works and shared results of my tests.

I am not telling that there should be another mod, what I said that I tested how this works without modifying other nodes at all but only fences. It just happened that I wanted to also try if I could configure fences so that they only connect where I want them to connect.

What I am telling is that I think it would be nice to have more connections and that it would be even nicer to have configurable connections.

thomasrudin commented 4 years ago

Also no, I don't think this needs to be another mod or needs to be forked, Could be simply in customization. Also I've not forked anything, just did some tests around how it works and shared results of my tests.

I meant forking part of the minetest game... forking another abandoned mod is ok i guess.

What I am telling is that I think it would be nice to have more connections and that it would be even nicer to have configurable connections.

yes, those really look good :+1: , haven't had time to test it myself though...

I used minetest.override_item() on a few nodes to extend functionality: https://github.com/pandorabox-io/pandorabox_custom/blob/master/hacks.lua#L56-L58

If you know that I've done something there that should not be done. Also there's too much meta stuff in my test thing and it would require some cleanup + maybe even some tool (screwdriver?) if it looks like okayish approach.

The meta thing looks weird, but i have seen worse :smile: I don't know if you need a screwdriver for that (it would be ok though) because there is no rightclick-action bound to the fences. Using it for this purpose "feels" ok...

JRPete2020 commented 3 years ago

Do we really need to fork this? i think overriding the connects_to field of the fence-node should be sufficient...

Exactly, that's what I am doing. Cloned just for multiple choices for connections as I wanted to test how it would work on minetest.

How does this look like?

https://github.com/S-S-X/fence_connect to be clear: this is not mod that can be just grabbed from there, it is simple test and low quality code

image

If you know that I've done something there that should not be done. Also there's too much meta stuff in my test thing and it would require some cleanup + maybe even some tool (screwdriver?) if it looks like okayish approach. Would also really like to hear if you see any possible problems there.

edit. Well actually that looks pretty similar to https://github.com/zing269/fence_connect with only difference being that I've collected nodes and some groups for fences instead of adding new group for other nodes. And also that I did not know about minetest.override_item which seems to be a lot better way to do things.

So the only code needed would be something like this:

local def = {} local connects_to = {}

for name, _ in pairs(minetest.registered_nodes) do if minetest.get_item_group(name, "fence") ~= 0 then def = minetest.registered_nodes[name] connects_to = table.copy(def.connects_to) table.insert(connects_to,"group:cracky") table.insert(connects_to,"group:crumbly") table.insert(connects_to,"group:wool") minetest.override_item(name, { connects_to=connects_to }) end end