[Mod] Farming [0.1.8]

User avatar
neko259
Member
 
Posts: 769
Joined: Sun Jun 19, 2011 06:51

by neko259 » Wed Jan 04, 2012 19:40

What custom data? You just need to change block when the time passes and all the conditions are acceptable.
Bitcoin donations: 18r66dJmUjwTmWRTFnorpGMzs8d4B8jzbw
 

sapier
Member
 
Posts: 763
Joined: Tue Aug 16, 2011 18:17

by sapier » Wed Jan 04, 2012 19:41

If you can tell me how to determin when time has passed for a specific node I'll gladly add it.
DON'T mention coding style!
(c) sapier all rights reserved
 

User avatar
Hackeridze
Member
 
Posts: 310
Joined: Thu Nov 03, 2011 13:35

by Hackeridze » Wed Jan 04, 2012 19:42

sapier wrote:because nodes don't have an fairly reasonable way to add custom data to it ;-)

@hackerized because no one supplied larger graphics and i aint a graphics guy ;-P

My corn's height is 4 meters, so...
Do you know something about METADATA?
My game: RTMG
GENTOO USER
 

User avatar
Hackeridze
Member
 
Posts: 310
Joined: Thu Nov 03, 2011 13:35

by Hackeridze » Wed Jan 04, 2012 19:43

sapier wrote:If you can tell me how to determin when time has passed for a specific node I'll gladly add it.

Like that? https://github.com/Hackeridze/ru-true_minetest_mods_pack/blob/master/src/hruschev/init.lua
My game: RTMG
GENTOO USER
 

User avatar
neko259
Member
 
Posts: 769
Joined: Sun Jun 19, 2011 06:51

by neko259 » Wed Jan 04, 2012 19:46

Hackeridze wrote:
sapier wrote:If you can tell me how to determin when time has passed for a specific node I'll gladly add it.

Like that? https://github.com/Hackeridze/ru-true_minetest_mods_pack/blob/master/src/hruschev/init.lua

Too much code. Past here the necessary part of it.
Bitcoin donations: 18r66dJmUjwTmWRTFnorpGMzs8d4B8jzbw
 

User avatar
Hackeridze
Member
 
Posts: 310
Joined: Thu Nov 03, 2011 13:35

by Hackeridze » Wed Jan 04, 2012 19:50

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
for i, state in ipairs(CORN_SPROUT_STATES) do
    minetest.register_abm({
        nodenames = {"hruschev:corn_sprout_" .. state,},
        interval = 60,
        chance = 2,
            action = function(pos, node, _, __)
                    minetest.env:remove_node(pos)
                    minetest.env:add_node(pos, {name = "hruschev:corn_sprout_" .. state + 1})
            end
    })
end


You should see the whole code to understand how my corn grows.
Last edited by Hackeridze on Wed Jan 04, 2012 19:52, edited 1 time in total.
My game: RTMG
GENTOO USER
 

sapier
Member
 
Posts: 763
Joined: Tue Aug 16, 2011 18:17

by sapier » Wed Jan 04, 2012 20:06

Your solution is at least as faulty as mine as you can't honor light changes with abms in 60 second intervals.

And in my opinion using abms for growing is simply logical wrong, growing isn't an action that is done by someone else to the plant but a generic characteristic of the plant itself.
I know this is a question of philosophy ;-).

Creating crops beeing 4m wouldn't be a large change at all but I just didn't want to add it (at least by now) ... contrary to you implementing each single crop as single mod i prefere creating mods handling things a little bit more generic. Having the ability to add new things easyly. While finding a bug will automaticaly fix it for ALL crops without having to modify much slightly modified copy n paste code.
Last edited by sapier on Wed Jan 04, 2012 20:07, edited 1 time in total.
DON'T mention coding style!
(c) sapier all rights reserved
 

User avatar
Hackeridze
Member
 
Posts: 310
Joined: Thu Nov 03, 2011 13:35

by Hackeridze » Wed Jan 04, 2012 20:11

sapier wrote:Your solution is at least as faulty as mine as you can't honor light changes with abms in 60 second intervals.

And in my opinion using abms for growing is simply logical wrong, growing isn't an action that is done by someone else to the plant but a generic characteristic of the plant itself.
I know this is a question of philosophy ;-).

Creating crops beeing 4m wouldn't be a large change at all but I just didn't want to add it (at least by now) ... contrary to you implementing each single crop as single mod i prefere creating mods handling things a little bit more generic. Having the ability to add new things easyly. While finding a bug will automaticaly fix it for ALL crops without having to modify much slightly modified copy n paste code.

Are you cancer?
My game: RTMG
GENTOO USER
 

sapier
Member
 
Posts: 763
Joined: Tue Aug 16, 2011 18:17

by sapier » Wed Jan 04, 2012 20:20

I tried to explain why the mod is like it is, I don't think I'll do that again in case of such inapropriate comments (at least to you)
DON'T mention coding style!
(c) sapier all rights reserved
 

User avatar
neko259
Member
 
Posts: 769
Joined: Sun Jun 19, 2011 06:51

by neko259 » Wed Jan 04, 2012 20:22

sapier wrote:I tried to explain why the mod is like it is, I don't think I'll do that again in case of such inapropriate comments (at least to you)

Explain it to me. Why making plants look so strange because of some philosophical causes? I think node+ABM is a great solution.
Bitcoin donations: 18r66dJmUjwTmWRTFnorpGMzs8d4B8jzbw
 

User avatar
Hackeridze
Member
 
Posts: 310
Joined: Thu Nov 03, 2011 13:35

by Hackeridze » Wed Jan 04, 2012 20:23

You hurt?
My game: RTMG
GENTOO USER
 

User avatar
neko259
Member
 
Posts: 769
Joined: Sun Jun 19, 2011 06:51

by neko259 » Wed Jan 04, 2012 20:24

Hackeridze wrote:You hurt?

Get lost, please. You're not helping.
Bitcoin donations: 18r66dJmUjwTmWRTFnorpGMzs8d4B8jzbw
 

sapier
Member
 
Posts: 763
Joined: Tue Aug 16, 2011 18:17

by sapier » Wed Jan 04, 2012 20:29

neko you don't have to use my mod ;-)

I've already shown a way how entities can look like plants. I'm going to ask this patch to be added to master but I do have other priorities by now. As long as it's not definitivly sure those changes won't go into master I'm not going to rewrite farming.

I don't want to start another competition with Hackeridze as well, I just didn't know about his ambitions to add crops when I started to write farming. Probably I wouldn't even have started writing it although I don't like his way of doing things.
DON'T mention coding style!
(c) sapier all rights reserved
 

User avatar
neko259
Member
 
Posts: 769
Joined: Sun Jun 19, 2011 06:51

by neko259 » Wed Jan 04, 2012 20:32

sapier wrote:neko you don't have to use my mod ;-)

That means you don't want to fix it? Ok, then I don't have any choice than using Hackeridze's variant.
Bitcoin donations: 18r66dJmUjwTmWRTFnorpGMzs8d4B8jzbw
 

sapier
Member
 
Posts: 763
Joined: Tue Aug 16, 2011 18:17

by sapier » Wed Jan 04, 2012 20:39

You already had chosen before asking ;-)

EDIT1:
By the way I'm not even convinced plantlike drawing does always look better. Looking top down is a mess with sprites but side view is even better in some cases than plantlike
Last edited by sapier on Wed Jan 04, 2012 20:43, edited 1 time in total.
DON'T mention coding style!
(c) sapier all rights reserved
 

User avatar
Hackeridze
Member
 
Posts: 310
Joined: Thu Nov 03, 2011 13:35

by Hackeridze » Wed Jan 04, 2012 20:42

sapier wrote:You already had chosen before asking ;-)

He had not. If he had, you can get my right arm. For real.
My game: RTMG
GENTOO USER
 

User avatar
neko259
Member
 
Posts: 769
Joined: Sun Jun 19, 2011 06:51

by neko259 » Wed Jan 04, 2012 20:42

sapier wrote:You already had chosen before asking ;-)

No I haven't. I just wanted to fix plant view and make farmland turn into dirt/grass when nothing is planted on it. If you'll fix that I'll use your plugin, because I already have it and don't know what to do with placed farms and gathered crops if I remove it.
Bitcoin donations: 18r66dJmUjwTmWRTFnorpGMzs8d4B8jzbw
 

sapier
Member
 
Posts: 763
Joined: Tue Aug 16, 2011 18:17

by sapier » Wed Jan 04, 2012 21:01

Fixing farmland won't be any problem. As I said it's going to be in the next version, athough this will be an abm.

Rewriting everything to use abm's would just mean recreate those mods Hackeridze wrote. I don't se any necesity to do this as it would contain the same design limitations. That doesn't mean using entities doesn't have design limitiations too.

But in my opinion what you don't like is a flaw in minetest. Having only two types of entities while having 6 or more draw types for nodes is a strong hint this beeing true.

Examples for other missing draw types for entitys are:
raillike
signlike
transparent blocks
plantlike

By the way farming was designed to be used by other mods. That's why its as simple as calling a single function to add a new crop. Crops existing are mostly just examples I needed to proof everything is working as expected.
DON'T mention coding style!
(c) sapier all rights reserved
 

User avatar
neko259
Member
 
Posts: 769
Joined: Sun Jun 19, 2011 06:51

by neko259 » Wed Jan 04, 2012 21:15

sapier wrote:Fixing farmland won't be any problem. As I said it's going to be in the next version, athough this will be an abm.

Okay, then I'll wait for the new version.
And yes, could you make a mese hoe too?
Bitcoin donations: 18r66dJmUjwTmWRTFnorpGMzs8d4B8jzbw
 

sapier
Member
 
Posts: 763
Joined: Tue Aug 16, 2011 18:17

by sapier » Wed Jan 04, 2012 22:16

Does anyone have an idea how to avoid abms taking place anytime from instant to specified abm interval?

It's ugly having plowed land in worst case revert instant to dirt. For now it's better than having it be farmland forever.
Last edited by sapier on Wed Jan 04, 2012 22:16, edited 1 time in total.
DON'T mention coding style!
(c) sapier all rights reserved
 

User avatar
neko259
Member
 
Posts: 769
Joined: Sun Jun 19, 2011 06:51

by neko259 » Wed Jan 04, 2012 22:18

sapier wrote:Does anyone have an idea how to avoid abms taking place anytime from instant to specified abm interval?

It's ugly having plowed land in worst case revert instant to dirt. For now it's better than having it be farmland forever.

I didn't understand what is bad. Can you say it in other words?
Bitcoin donations: 18r66dJmUjwTmWRTFnorpGMzs8d4B8jzbw
 

User avatar
Hackeridze
Member
 
Posts: 310
Joined: Thu Nov 03, 2011 13:35

by Hackeridze » Wed Jan 04, 2012 22:20

sapier wrote:Does anyone have an idea how to avoid abms taking place anytime from instant to specified abm interval?

It's ugly having plowed land in worst case revert instant to dirt. For now it's better than having it be farmland forever.

https://github.com/Hackeridze/ru-true_minetest_mods_pack/commit/4dc2818bcf8c37a36aa4a15211a18f58cef24c76

and

minetest.register_node("wheat:dirt_bed", {
tile_images = {"wheat_bed.png", "default_dirt.png"},
inventory_image = minetest.inventorycube("default_dirt.png"),
is_ground_content = true,
material = minetest.digprop_dirtlike(1.0),
dug_item = 'node "default:dirt" 1',
})
Last edited by Hackeridze on Wed Jan 04, 2012 22:21, edited 1 time in total.
My game: RTMG
GENTOO USER
 

sapier
Member
 
Posts: 763
Joined: Tue Aug 16, 2011 18:17

by sapier » Wed Jan 04, 2012 22:21

ABM's seem to run in fixed intervals starting at registration, no matter if there's a node or not. In case you plow (for example) exactly 1s before next scheduled abm call farmland will revert to dirt just as you plowed it.

Edit1:
@Hackeridze thanks but that's already in for some time
Last edited by sapier on Wed Jan 04, 2012 22:23, edited 1 time in total.
DON'T mention coding style!
(c) sapier all rights reserved
 

User avatar
neko259
Member
 
Posts: 769
Joined: Sun Jun 19, 2011 06:51

by neko259 » Wed Jan 04, 2012 22:23

sapier wrote:ABM's seem to run in fixed intervals starting at registration, no matter if there's a node or not. In case you plow (for example) exactly 1s before next scheduled abm call farmland will revert to dirt just as you plowed it.

Don't you register ABM after you've plowed?
Bitcoin donations: 18r66dJmUjwTmWRTFnorpGMzs8d4B8jzbw
 

sapier
Member
 
Posts: 763
Joined: Tue Aug 16, 2011 18:17

by sapier » Wed Jan 04, 2012 22:26

no an abm is a generic block modifier beeing registred once an doing things to all nodes of a specific type in specified intervals. There's some (configurable) chance it doesn't do anything to a node but that's not the problem.
Last edited by sapier on Wed Jan 04, 2012 22:26, edited 1 time in total.
DON'T mention coding style!
(c) sapier all rights reserved
 

User avatar
Hackeridze
Member
 
Posts: 310
Joined: Thu Nov 03, 2011 13:35

by Hackeridze » Wed Jan 04, 2012 22:27

sapier wrote:no an abm is a generic block modifier beeing registred once an doing things to all nodes of a specific type in specified intervals. There's some (configurable) chance it doesn't do anything to a node but that's not the problem.

Aaaaand?
My game: RTMG
GENTOO USER
 

sapier
Member
 
Posts: 763
Joined: Tue Aug 16, 2011 18:17

by sapier » Wed Jan 04, 2012 22:30

Having a plowed node reverting to dirt just after plowing isn't just what you expect it to do ;-)
DON'T mention coding style!
(c) sapier all rights reserved
 

User avatar
Hackeridze
Member
 
Posts: 310
Joined: Thu Nov 03, 2011 13:35

by Hackeridze » Wed Jan 04, 2012 22:31

sapier wrote:Having a plowed node reverting to dirt just after plowing isn't just what you expect it to do ;-)

40sec. Too little chance. And it is not a problem.
My game: RTMG
GENTOO USER
 

User avatar
neko259
Member
 
Posts: 769
Joined: Sun Jun 19, 2011 06:51

by neko259 » Wed Jan 04, 2012 22:32

Maybe use 2 ABMs to turn farmland to grass? After 1 ABM change some variable, after second turn to dirt.
Last edited by neko259 on Wed Jan 04, 2012 22:33, edited 1 time in total.
Bitcoin donations: 18r66dJmUjwTmWRTFnorpGMzs8d4B8jzbw
 

User avatar
Hackeridze
Member
 
Posts: 310
Joined: Thu Nov 03, 2011 13:35

by Hackeridze » Wed Jan 04, 2012 22:36

neko259 wrote:Maybe use 2 ABMs to turn farmland to grass? After 1 ABM change some variable, after second turn to dirt.

Just to use METADATA+timer and check in ABM, but this should eat more cpu every 40sec, so if chence is so small... Why should we do it?
My game: RTMG
GENTOO USER
 

PreviousNext

Return to Old Mods

Who is online

Users browsing this forum: No registered users and 11 guests

cron