[Game] MineClone2 [0.86]

Nicu
Member
Posts: 98
Joined: Sun Feb 16, 2020 15:21
GitHub: kneekoo

Re: [Game] MineClone 2 [0.68.0]

by Nicu » Post

How did you try to have MineClone2 on your server? It should work.

User avatar
goats
Member
Posts: 212
Joined: Thu Nov 21, 2019 05:29

Re: [Game] MineClone 2 [0.68.0]

by goats » Post

K1llawolf wrote:
Wed Nov 25, 2020 21:42
I loved the concept. but currently, when it is added to a new or existing world - it makes the world unable to enter as it causes the world to crash the game until you remove it. Loved the idea of it though
What does this even mean? Can you clarify please?

How can you remove the mineclone 2 game from... a game of mineclone 2?

If you mean "add the game to a world", one can never do this. You create the world after choosing the game. (You also cannot load random mods with this game, they need to be mcl2-compatible.)

This is a game, not a mod. It must be installed and started as such.

These are all the things i can think of at this point. :D

K1llawolf
New member
Posts: 2
Joined: Wed Nov 25, 2020 19:18
GitHub: k1llawolf
In-game: k1llawolf

Re: [Game] MineClone 2 [0.68.0]

by K1llawolf » Post

goats wrote:
Wed Nov 25, 2020 23:26
K1llawolf wrote:
Wed Nov 25, 2020 21:42
I loved the concept. but currently, when it is added to a new or existing world - it makes the world unable to enter as it causes the world to crash the game until you remove it. Loved the idea of it though
What does this even mean? Can you clarify please?

How can you remove the mineclone 2 game from... a game of mineclone 2?

If you mean "add the game to a world", one can never do this. You create the world after choosing the game. (You also cannot load random mods with this game, they need to be mcl2-compatible.)

This is a game, not a mod. It must be installed and started as such.

These are all the things I can think of at this point. :D
After realization upon posting a reply. the situation was misunderstood and taken care of quickly, sorry for the misunderstanding, I hope you do understand

User avatar
Wuzzy
Member
Posts: 4786
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Game] MineClone 2 [0.68.0]

by Wuzzy » Post

What do you mean, "when it is added to a new or existing world?".

What exactly did you do to make the game crash?

User avatar
goats
Member
Posts: 212
Joined: Thu Nov 21, 2019 05:29

Re: [Game] MineClone 2 [0.68.0]

by goats » Post

Indeed, apologies for not understanding a thing are not necessary, but i am curious what did happen. :)
(Maybe it could be helpful to someone else in the future also.)

User avatar
AFCM
Member
Posts: 36
Joined: Tue Jun 30, 2020 12:21
GitHub: AFCMS
IRC: AFCM
In-game: AFCM
Location: France
Contact:

Re: [Game] MineClone 2 [0.68.0]

by AFCM » Post

Hey,
When creating a formspec, I wanted to show the player inventory, so I used mcl_formspec.get_itemslot_bg().
But I get an ugly result:
Image
Can everyone help me ?

User avatar
goats
Member
Posts: 212
Joined: Thu Nov 21, 2019 05:29

Re: [Game] MineClone 2 [0.68.0]

by goats » Post

You need to define your formspec spacing / padding. It's in the API doc. Make sure you use the reference for the engine version you are using.

Also this doesn't look like mcl2... If it is, don't be using a dev version of the engine against the game.

User avatar
AFCM
Member
Posts: 36
Joined: Tue Jun 30, 2020 12:21
GitHub: AFCMS
IRC: AFCM
In-game: AFCM
Location: France
Contact:

Re: [Game] MineClone 2 [0.68.0]

by AFCM » Post

@goats can you explain ? Is it a mcl setting or a minetest formspec setting ? I haven't see any setting in the inventory code of MCL.
I use the 5.3 stable version of minetest with the MTG4MCL2 texture pack.

User avatar
goats
Member
Posts: 212
Joined: Thu Nov 21, 2019 05:29

Re: [Game] MineClone 2 [0.68.0]

by goats » Post

e.g. mcl2 chests in v68: /mods/ITEMS/mcl_chests/init.lua line 239, 377, 517, 713

lua_api.txt is in the /docs directory, or here https://github.com/minetest/minetest/bl ... ua_api.txt
or nicely accessible here https://rubenwardy.com/minetest_modding ... specs.html
this will help you understand padding and spacing.

Depending on what else you may be doing here, see API.md in the root of the mineclone 2 folder. mcl2 does not operate like mtg and many respects. (Obviously you know this as you are calling formspec the mcl way :) as in /mods/HUD/mcl_formspec/ .)

I can't offer a lot more. I just know that padding/spacing makes a huge difference to what is readable/usable. I've fixed issues in some old mods before. However, i am not a coder, to say the least, lol.

User avatar
AFCM
Member
Posts: 36
Joined: Tue Jun 30, 2020 12:21
GitHub: AFCMS
IRC: AFCM
In-game: AFCM
Location: France
Contact:

Re: [Game] MineClone 2 [0.68.0]

by AFCM » Post

@goats I used viewtopic.php?f=14&t=24130 to design my formspec, and this editor used the real coordinate system.
If I use real_coordinate[false], inventory slots are correctly shown, but the layout is messed up.
Does mcl_inventory forces the use of legacity_coordinates?
I will see the code of mcl_chest tomorow.

User avatar
goats
Member
Posts: 212
Joined: Thu Nov 21, 2019 05:29

Re: [Game] MineClone 2 [0.68.0]

by goats » Post

I have absolutely no idea if mcl2 uses the legacy coord system. It would seem like this is so, given your test. It may be a thing that is not yet updated due to heavy work on all the things. But also note that mcl2 does not show inventory + hotbar like MT default anyway, as it is mimicking some other piece of software...

[edit: you should see the interaction between mcl2 and the protected chest formspec in protector-redo on Kay's server lol.]

Wow, i didn't know there was a formspec generator. I've only read the API and whatever code i was hacking up. That might have saved time in game loading, if it handled that formspec and the rather outdated code.

User avatar
AFCM
Member
Posts: 36
Joined: Tue Jun 30, 2020 12:21
GitHub: AFCMS
IRC: AFCM
In-game: AFCM
Location: France
Contact:

Re: [Game] MineClone 2 [0.68.0]

by AFCM » Post

@goats After looking at the code of mcl_chest, I saw that chests inventories use real_coordinate.
So, I can't understand why mcl_inventory don't work with my formspec.
My code:

Code: Select all

local form = table.concat({
	"formspec_version[3]",
	"size[10.5,11]",
	"real_coordinates[false]",
	mcl_formspec.get_itemslot_bg(0.5, 0.5, 1, 1),
	"list[current_player;craftpreview;0.5,0.5;1,1;0]",
	mcl_formspec.get_itemslot_bg(0.5, 3, 9, 4),
	"list[current_player;main;0.5,3;9,4;0]",
})
Formspec with legacity_coordinate:
Image
With real_coordinate (the layout of inventory slots is exactly that I designed with the formspec editor, but their border are messed up):
Image

The formspec is not the one I post later, but the problem is the same.

WarHawk
Member
Posts: 37
Joined: Thu May 30, 2019 10:45

Re: [Game] MineClone 2 [0.68.0]

by WarHawk » Post

is their a height limit at which mobs stop spawning or spawn less? mobs like spiders, creepers, skeletons, zombies ect.

Follpvosten
New member
Posts: 3
Joined: Tue Dec 01, 2020 12:06
GitHub: Follpvosten
IRC: Follpvosten[m]
In-game: Waltar Follpvosten

Re: [Game] MineClone 2 [0.68.0]

by Follpvosten » Post

Hi!
I would like to contribute something to this game, but it's probably more of a personal interest of me, so before just sending a patch, I wanted to ask.
I'm working on various bridges from the minetest chat to other chat networks (mostly telegram at the moment). Bridging messages and events like server starting or stopping is easy; however now I want to announce deaths over the bridge as well (in Mineclone specifically, as that's what we're currently playing).
I've looked at the mcl_death_messages mod and it pretty much does all of what I want, except I can't use it because it doesn't expose a public API to build these death messages.

Now I'd like to send in a small patch which adds such an API; option one is a simple

Code: Select all

mcl_death_messages.format(player, reason)
(function name up for debate) so anyone can call it from any on_dieplayer observer. This function would of course also be used internally to generate the message. I have a patch of this approach ready, the downside is that it would be called once for each mod that uses it in on_dieplayer.

Option two would be less simple, but possibly more efficient: adding a custom event emitter to mcl_death_messages where other mods can register a callback. That way the internal logic can stay in the event handler and obversers only get notified when there's actually a valid death message.

Of course these options are not mutually exclusive, exposing both would be a possibility as well.

Now the question is: Is such a feature (which is mostly for mod devs) welcome in Mineclone? And which approach would be preferred?

User avatar
Wuzzy
Member
Posts: 4786
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Game] MineClone 2 [0.68.0]

by Wuzzy » Post

First of all, thanks. I would prefer the latter idea, the observer pattern. I believe you mean with that a "register" function like those countless "register" functions in the official Minetest Lua API. Right? If yes, then I'm fine with that.

Follpvosten
New member
Posts: 3
Joined: Tue Dec 01, 2020 12:06
GitHub: Follpvosten
IRC: Follpvosten[m]
In-game: Waltar Follpvosten

Re: [Game] MineClone 2 [0.68.0]

by Follpvosten » Post

Yes, exactly; the observer-style API would look something like this:

Code: Select all

mcl_death_messages.register_on_death_message(function(msg) end)
Thanks for your feedback! I will get right to implementing it this way. Should I send you a patch via email or just paste it into a spoiler + code block here? Could also upload and share a file, depending on what you'd prefer. I'll default to email.

User avatar
Wuzzy
Member
Posts: 4786
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Game] MineClone 2 [0.68.0]

by Wuzzy » Post

Just post it here unless it's a very large patch.

Follpvosten
New member
Posts: 3
Joined: Tue Dec 01, 2020 12:06
GitHub: Follpvosten
IRC: Follpvosten[m]
In-game: Waltar Follpvosten

Re: [Game] MineClone 2 [0.68.0]

by Follpvosten » Post

Alriiight, I spent way too much time finding a way to actually use the translated string that the API gives me now; after finding `minetest.get_translated_string()`, I'm satisfied.
Here's my patch:

Code: Select all

From b6622666855b23493b5d565b1bf281b19d68cb45 Mon Sep 17 00:00:00 2001
From: Follpvosten <wolfi@karpador.xyz>
Date: Tue, 1 Dec 2020 16:16:59 +0100
Subject: [PATCH] add observer api for death messages

---
 mods/HUD/mcl_death_messages/init.lua | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/mods/HUD/mcl_death_messages/init.lua b/mods/HUD/mcl_death_messages/init.lua
index dfc5191a..a18dee5c 100644
--- a/mods/HUD/mcl_death_messages/init.lua
+++ b/mods/HUD/mcl_death_messages/init.lua
@@ -3,6 +3,16 @@ local N = function(s) return s end
 
 mcl_death_messages = {}
 
+-- Allow mods to register observers for death messages
+mcl_death_messages.registered_on_death_message = {}
+-- Registers a function which will be called whenever a death message is
+-- successfully rendered.
+-- Note: This string passed to the callback is a translated message, so it can
+-- only be used to display it client-side or with minetest.get_translated_string()
+function mcl_death_messages.register_on_death_message(func)
+	table.insert(mcl_death_messages.registered_on_death_message, func)
+end
+
 -- Death messages
 local msgs = {
 	["arrow"] = {
@@ -252,6 +262,10 @@ minetest.register_on_dieplayer(function(player, reason)
 			msg = dmsg("other", name)
 		end
 		minetest.chat_send_all(msg)
+		-- Notify all death message observers
+		for i=1, #mcl_death_messages.registered_on_death_message do
+			mcl_death_messages.registered_on_death_message[i](msg)
+		end
 		last_damages[name] = nil
 	end
 end)
-- 
2.25.1

User avatar
goats
Member
Posts: 212
Joined: Thu Nov 21, 2019 05:29

Re: [Game] MineClone 2 [0.68.0]

by goats » Post

Some flowing water code to possibly mull over:
viewtopic.php?p=385053#p385053


WarHawk wrote:
Mon Nov 30, 2020 11:33
is their a height limit at which mobs stop spawning or spawn less? mobs like spiders, creepers, skeletons, zombies ect.
Probably not. If there are appropriate nodes on which they can spawn, and a correct light-level range if applicable, they should spawn.

AFCM: If you can't understand it, i almost certainly cannot. I might try to learn something here, but by the time i get anything (if i get it at all), it would be far too late to be useful. Especially since 5.4.0 will add more new formspec stuff which may affect such inventories.

User avatar
Grigor
Member
Posts: 49
Joined: Sun Dec 01, 2019 05:55

Re: [Game] MineClone 2 [0.68.0]

by Grigor » Post

@Warhawk, re mobs spawning at / below specific altitudes, see my previous post:
Grigor wrote:
Sun Nov 15, 2020 01:25
...most of the mob creature .lua files (in ENTITIES/mobs_mc) has a line toward the end like this:

mobs:spawn_specific("mobs_mc:chicken", mobs_mc.spawn.grassland, {"air"}, 9, minetest.LIGHT_MAX+1, 90, 9000, 3, mobs_mc.spawn_height.overworld_min, 90)

- which I've modified to prevent chickens appearing above 90m altitude (last number in the line). ...
Other numbers on the line refer to rarity of spawning and max. number of entities (in this case chickens) appearing per map block. I would do a copy of the .lua file and just fool around with the numbers, preferably in a flat and empty map, and observe the results.

User avatar
Grigor
Member
Posts: 49
Joined: Sun Dec 01, 2019 05:55

Re: [Game] MineClone 2 [0.68.0]

by Grigor » Post

@Wuzzy, I'm presently fooling around with temperature / humidity numbers in mcl_weather/weather_core.lua to stop it from snowing / raining in deserts. Presently I'm putting the check in the same line as the if (mcl_weather.is_underwater(player) or not mcl_worlds.has_weather(player:get_pos()) check in rain.lua and snow.lua, unless you can tell me a better place to check it from.

Right now I'm running around different biomes to make sure it works when it's supposed to... Will send you the code when I'm sure of it.

meise21
Member
Posts: 31
Joined: Sun Feb 03, 2019 13:33

Re: [Game] MineClone 2 [0.68.0]

by meise21 » Post

Hi,
today we tried to build a railway switch in our mineclone world. I don't know/have the original Minecraft but from looking at some online tutorials I thought this can be done with a lever besides the T-shaped track. However the track didn't change its direction when we operated the lever. Is this supposed to work (or did we just build it the wrong way)?
Bye
Markus

User avatar
LMD
Member
Posts: 1386
Joined: Sat Apr 08, 2017 08:16
GitHub: appgurueu
IRC: appguru[eu]
In-game: LMD
Location: Germany
Contact:

Re: [Game] MineClone 2 [0.68.0]

by LMD » Post

goats wrote:
Thu Dec 03, 2020 03:36
Some flowing water code to possibly mull over:
viewtopic.php?p=385053#p385053
I think there is a far better solution. It looks like this:

Code: Select all

liquid_level_max = 8
--+ Calculates the flow direction of a flowingliquid node
--# as returned by `minetest.get_node`
--> 4 corner levels from 0 to 1 as list
function get_liquid_corner_levels(pos, node)
    local def = minetest.registered_nodes[node.name]
    if not (def and def.drawtype == "flowingliquid") then return pointed_thing end
    local source, flowing = def.liquid_alternative_source, node.name
    local range = def.liquid_range or liquid_level_max
    local neighbors = {}
    for x = -1, 1 do
        neighbors[x] = {}
        for z = -1, 1 do
            local neighbor_pos = {x = pos.x + x, y = pos.y, z = pos.z + z}
            local neighbor_node = minetest.get_node(neighbor_pos)
            local level
            if neighbor_node.name == source then
                level = 1
            elseif neighbor_node.name == flowing then
                local neighbor_level = neighbor_node.param2 % 8
                level = (math.max(0, neighbor_level - liquid_level_max + range) + 0.5) / range
            end
            neighbor_pos.y = neighbor_pos.y + 1
            local node_above = minetest.get_node(neighbor_pos)
            neighbors[x][z] = {
                air = neighbor_node.name == "air",
                level = level,
                above_is_same_liquid = node_above.name == flowing or node_above.name == source
            }
        end
    end
    local function get_corner_level(x, z)
        local air_neighbor
        local levels = 0
        local neighbor_count = 0
        for nx = x - 1, x do
            for nz = z - 1, z do
                local neighbor = neighbors[nx][nz]
                if neighbor.above_is_same_liquid then
                    return 1
                end
                local level = neighbor.level
                if level then
                    if level == 1 then
                        return 1
                    end
                    levels = levels + level
                    neighbor_count = neighbor_count + 1
                elseif neighbor.air then
                    if air_neighbor then
                        return 0.02
                    end
                    air_neighbor = true
                end
            end
        end
        if neighbor_count == 0 then
            return 0
        end
        return levels / neighbor_count
    end
    local corner_levels = {
        {x = 0, z = 0},
        {x = 1, z = 0},
        {x = 1, z = 1},
        {x = 0, z = 1}
    }
    for _, corner_level in pairs(corner_levels) do
        corner_level.y = get_corner_level(corner_level.x, corner_level.z)
    end
    return corner_levels
end

flowing_downwards = vector.new(0, -1, 0)
--+ Calculates the flow direction of a flowingliquid node
--# as returned by `minetest.get_node`
--> `modlib.minetest.flowing_downwards = vector.new(0, -1, 0)` if only flowing downwards
--> surface direction as `vector` else
function get_liquid_flow_direction(pos, node)
    local corner_levels = get_liquid_corner_levels(pos, node)
    local max_level = corner_levels[1].y
    for index = 2, 4 do
        local level = corner_levels[index].y
        if level > max_level then
            max_level = level
        end
    end
    local dir = vector.new(0, 0, 0)
    local count = 0
    for max_level_index, corner_level in pairs(corner_levels) do
        if corner_level.y == max_level then
            for offset = 1, 3 do
                local index = (max_level_index + offset - 1) % 4 + 1
                local diff = vector.subtract(corner_level, corner_levels[index])
                if diff.y ~= 0 then
                    diff.x = diff.x * diff.y
                    diff.z = diff.z * diff.y
                    if offset == 3 then
                        diff = vector.divide(diff, math.sqrt(2))
                    end
                    dir = vector.add(dir, diff)
                    count = count + 1
                end
            end
        end
    end
    if count ~= 0 then
        dir = vector.divide(dir, count)
    end
    if vector.equals(dir, vector.new(0, 0, 0)) then
        if node.param2 % 32 > 7 then
            return flowing_downwards
        end
    end
    return dir
end
My stuff: Projects - Mods - Website

User avatar
goats
Member
Posts: 212
Joined: Thu Nov 21, 2019 05:29

Re: [Game] MineClone 2 [0.68.0]

by goats » Post

LMD wrote:
Sun Dec 06, 2020 18:34

I think there is a far better solution. It looks like this:
I wouldn't complain about better. :) It's definitely a thing that would add the feel and functionality of the original to the clone.

User avatar
goats
Member
Posts: 212
Joined: Thu Nov 21, 2019 05:29

Re: [Game] MineClone 2 [0.68.0]

by goats » Post

meise21 wrote:
Sun Dec 06, 2020 12:20
I thought this can be done with a lever besides the T-shaped track.
https://minecraft.gamepedia.com/Rail It would work in mc if done properly. I don't know about mcl2 at this point, but overall it has a fair way to go to exit an alpha state, so it's probably on the list.

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests