Closed Miniontoby closed 4 years ago
Hey, thanks for the requests!
Out of the 2, I'm not entirely sure what your intention for this one is. Is it the same as the //mix
command from WorldEdit? //mix
is like //set
, but allows you to define multiple nodes with weightings as you describe:
//mix stone 5 sand 3 cobble 1
The above replaces all nodes with a random mix of stone, sand, and cobble in the ratio 5:3:1.
If I recall correctly, I was the one who contributed the weighting system there. Personally I think it's easier to work with than percentages, as you don't have to do as much mental maths :P
I dont think it is like //mix
And I updated the post so you can see what I exact want because the <> wont get viewed because it is code
Hey, thanks for the update @Miniontoby. Unfortunately, I'm still confused. The Param
there in the above doesn't appear to match the example further down. You mention a from-block
, but that doesn't appear to be present in the example command.
Also, you can get <
and >
to show up in a GitHub comment, you just need use Markdown :-)
Check out this guide: https://guides.github.com/features/mastering-markdown/
Specifically it's the "Inline Code" and the code blocks in the "Syntax Highlighting" sections that might be of interest.
I assume //replacenear 50% air 20%stone,80%cobblestone is to be read like this: Somewhere near (a defined radius or something?), take 50% of all present air nodes and replace them with the following list: 20% stone, 80% cobblestone. So that in the area in question 50% of all the air nodes have a 20% chance to become stone and an 80% chance to become cobblestone.
It is similar to the //mix command, but with a more selective approach.
replaceNEAR implies the use of a radius rather than an area. Not sure, but I feel like a user should either be able to set this radius in the command, or the command should make use of the usual WE points set by //1 and //2, thus making it not replaceNEAR, but replaceINarea.
Ah, I see - that makes much more sense @Miniontoby. However, I do feel that we need to develop the syntax a bit more. I'd be inclined to use areas at first as opposed to a radius (though the latter isn't out of the question for later perhaps). Currently, WorldEdit has the following 3 related commands:
Command | Meaning |
---|---|
//set <replace_node> |
Set every node to <replace_node> |
//replace <a> <b> |
Replace <a> with <b> |
//mix <a> <chance_a> <b> <chance_b> … |
Like set, but with multiple weighted nodes |
To this end, we could implement a //replacemix
command. It would replace a given node with a mix of other nodes. The syntax would look like this:
//replacemix <target_node> [<chance>] <replace_node_a> [<chance_a>] [<replace_node_N> [<chance_N>]] […]
Where:
<target_node>
is the node to replace<chance>
(optional) is the 1-in-<chance>
chance to replace an instance of <target_node>
<replace_node_a>
is the first node to replace <target_node>
with<chance_a>
(optional) is the weighting for <replace_node_a>
(in other words the chance that <replace_node_a>
will be chosen to replace <target_node>
, would function the same way as //mix
[<replace_node_N> [<chance_N>]] […]
works just like specifying multiple nodes like in //mix
.Example invocations:
//replacemix dirt stone
- just like the regular //replace
//replacemix dirt 2 stone
- replace only 50% of dirt nodes with stone//replacemix dirt stone sand
- replace all dirt nodes with an even mix of stone and sand nodes//replacemix dirt stone 3 sand 2
- replace all dirt nodes with stone and sand nodes in the ratio 3:2//replacemix dirt 4 stone 10 sand 1
- replace 65% of dirt nodes with stone and sand nodes in the ratio 10:1What do you think? Does this look good to you?
I like the idea of replacing in an area, as that's what //set
, //mix
, and //replace
currently do. You can always use the //multi
command if you want to assign this to a brush (e.g. //multi //1 //2 //outset 5 //replacemix dirt 0.5 stone 3 sand 2
).
My biggest question is about the <chance>
in the above. Which format feels most natural to you?
<chance>
chance to replace a given node50%
)0.5
)Personally, I like 1-in-<chance>
, because it's the same as the <chance>
value of the //bonemeal
command I implemented the other day, and consistency is important in order to make it easy toremember how all the different commands work :P
I more like the (chance) to be percentage and the cmd needs to be //replace (just overwriting) (And please also the //replacenear but with no area selection, but that you can do //setnear
but you can do both: "percentages and the 1-in-(change)". (with recognizing an % for percentage)
I more like the (chance) to be percentage
but you can do both: "percentages and the 1-in-(change)". (with recognizing an % for percentage)
Yep, that's a great idea! Supporting both shouldn't be too hard.
the cmd needs to be //replace (just overwriting)
I don't think I can reliably replace an existing command, sadly :-/
And please also the //replacenear but with no area selection, but that you can do //setnear and then it replaces from your position in all direction the setted range count blocks
I think radius area-based commands are a separate feature. For now, I'm going to class that as out-of-scope of the initial implementation.
I've just finished implementing a new //replacemix
command - see the README docs here: https://github.com/sbrl/Minetest-WorldEditAdditions/#replacemix-target_node-chance-replace_node_a-chance_a-replace_node_b-chance_b-replace_node_n-chance_n-
It doesn't currently support that percentage syntax yet, but I'm not sure whether that's even a good idea, since percentage syntax isn't used anywhere else in worldedit or worldeditadditions.
I'm going to call this complete now and close this issue. For those other command requests, please open new issues. I'm not opposed to implementing them, but they are separate requests, and I'd prefer it if they had their own issues.
Please make a new cmd
Name: replacenear Command: //replacenear Param: (size [in % or all]) (from-block) (to-pattern) Function: Replace all (from-block) nearby to pattern. Pattern: (number)%(block1),(number)%(block2),...
Example: //replacenear 50% air 20%stone,80%cobblestone