Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
plantlife_modpack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
plantlife_modpack
Commits
e3a9d058
Commit
e3a9d058
authored
12 years ago
by
Vanessa Ezekowitz
Browse files
Options
Downloads
Patches
Plain Diff
Fixed a bug in the placement of seaweed, fixing it extends the API slightly.
Updated API.txt accordingly.
parent
13534d16
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
API.txt
+7
-1
7 additions, 1 deletion
API.txt
plants/init.lua
+11
-7
11 additions, 7 deletions
plants/init.lua
plants/init.lua~
+5
-4
5 additions, 4 deletions
plants/init.lua~
with
23 additions
and
12 deletions
API.txt
+
7
−
1
View file @
e3a9d058
...
...
@@ -17,7 +17,8 @@ The first of these, spawn_on_surfaces() is defined with quite a large number
of variables:
spawn_on_surfaces = function(sdelay, splant, sradius, schance, ssurface,
savoid, seed_diff, lightmin, lightmax, nneighbors, ocount)
savoid, seed_diff, lightmin, lightmax, nneighbors,
ocount, facedir)
The first several of these are all required, and are from the last version of
the flowers mod, so this part of the API should be the same as before.
...
...
@@ -63,6 +64,8 @@ nneighbors: Table with a list of neighboring nodes, passed to the ABM as the
ocount: There must be at least this many of the above neighbors around the
node the plant is about to spawn on for it to happen. Defaults to
0.
facedir: The value passed to the param2 variable when adding the plant node
to the map. Defaults to 0 if left out or set to nil.
-----
The second function, grow_plants() is defined like so:
...
...
@@ -89,6 +92,9 @@ grow_nodes: This node must be under the plant in order for it to grow at
{"default:dirt_with_grass","default:sand"}. This is so that
the plant can be manually placed on something like a flower
pot or something without it growing and eventually dieing.
facedir: Same as with spawning a plant. If supplied, this value is
passed to the param2 variable when changing the plant. If nil
or left out, no new param2 value is applied.
-----
plant_valid_wall() expects only a single parameter, "pos", which is a table
...
...
This diff is collapsed.
Click to expand it.
plants/init.lua
+
11
−
7
View file @
e3a9d058
...
...
@@ -90,7 +90,7 @@ end
-- The spawning ABM
spawn_on_surfaces
=
function
(
sdelay
,
splant
,
sradius
,
schance
,
ssurface
,
savoid
,
seed_diff
,
lightmin
,
lightmax
,
nneighbors
,
ocount
)
spawn_on_surfaces
=
function
(
sdelay
,
splant
,
sradius
,
schance
,
ssurface
,
savoid
,
seed_diff
,
lightmin
,
lightmax
,
nneighbors
,
ocount
,
facedir
)
if
seed_diff
==
nil
then
seed_diff
=
0
end
if
lightmin
==
nil
then
lightmin
=
0
end
if
lightmax
==
nil
then
lightmax
=
LIGHT_MAX
end
...
...
@@ -120,7 +120,7 @@ spawn_on_surfaces = function(sdelay, splant, sradius, schance, ssurface, savoid,
minetest
.
env
:
add_node
(
p_top
,
{
name
=
"poisonivy:climbing"
,
param2
=
walldir
})
else
dbg
(
"Spawn: "
..
splant
..
" at "
..
dump
(
p_top
)
..
" on "
..
ssurface
)
minetest
.
env
:
add_node
(
p_top
,
{
name
=
splant
})
minetest
.
env
:
add_node
(
p_top
,
{
name
=
splant
,
param2
=
facedir
})
end
end
end
...
...
@@ -130,7 +130,7 @@ end
-- The growing ABM
grow_plants
=
function
(
gdelay
,
gchance
,
gplant
,
gresult
,
dry_early_node
,
grow_nodes
)
grow_plants
=
function
(
gdelay
,
gchance
,
gplant
,
gresult
,
dry_early_node
,
grow_nodes
,
facedir
)
minetest
.
register_abm
({
nodenames
=
{
gplant
},
interval
=
gdelay
,
...
...
@@ -161,7 +161,11 @@ grow_plants = function(gdelay, gchance, gplant, gresult, dry_early_node, grow_no
elseif
gresult
~=
nil
then
dbg
(
"Grow: "
..
gplant
..
" -> "
..
gresult
..
" at ("
..
dump
(
pos
)
..
")"
)
minetest
.
env
:
add_node
(
pos
,
{
name
=
gresult
})
if
facedir
==
nil
then
minetest
.
env
:
add_node
(
pos
,
{
name
=
gresult
})
else
minetest
.
env
:
add_node
(
pos
,
{
name
=
gresult
,
param2
=
facedir
})
end
else
dbg
(
"Die: "
..
gplant
..
" at ("
..
dump
(
pos
)
..
")"
)
minetest
.
env
:
remove_node
(
pos
)
...
...
@@ -288,9 +292,9 @@ if enable_flowers then
})
spawn_on_surfaces
(
spawn_delay
/
2
,
"flowers:flower_waterlily"
,
15
,
spawn_chance
*
3
,
"default:water_source"
,
{
"group:flower"
},
flowers_seed_diff
,
10
)
spawn_on_surfaces
(
spawn_delay
*
2
,
"flowers:flower_seaweed"
,
0
.
1
,
spawn_chance
*
2
,
"default:water_source"
,
{
"group:flower"
},
flowers_seed_diff
,
4
,
10
,
{
"default:dirt_with_grass"
},
0
)
spawn_on_surfaces
(
spawn_delay
*
2
,
"flowers:flower_seaweed"
,
0
.
1
,
spawn_chance
*
2
,
"default:dirt_with_grass"
,
{
"group:flower"
},
flowers_seed_diff
,
4
,
10
,
{
"default:water_source"
}
,
1
)
spawn_on_surfaces
(
spawn_delay
*
2
,
"flowers:flower_seaweed"
,
0
.
1
,
spawn_chance
*
2
,
"default:stone"
,
{
"group:flower"
},
flowers_seed_diff
,
4
,
10
,
{
"default:water_source"
}
,
6
)
spawn_on_surfaces
(
spawn_delay
*
2
,
"flowers:flower_seaweed"
,
0
.
1
,
spawn_chance
*
2
,
"default:water_source"
,
{
"group:flower"
},
flowers_seed_diff
,
4
,
10
,
{
"default:dirt_with_grass"
},
0
,
1
)
spawn_on_surfaces
(
spawn_delay
*
2
,
"flowers:flower_seaweed"
,
0
.
1
,
spawn_chance
*
2
,
"default:dirt_with_grass"
,
{
"group:flower"
},
flowers_seed_diff
,
4
,
10
,
{
"default:water_source"
}
,
1
,
1
)
spawn_on_surfaces
(
spawn_delay
*
2
,
"flowers:flower_seaweed"
,
0
.
1
,
spawn_chance
*
2
,
"default:stone"
,
{
"group:flower"
},
flowers_seed_diff
,
4
,
10
,
{
"default:water_source"
}
,
6
,
1
)
minetest
.
register_craftitem
(
":flowers:flower_pot"
,
{
...
...
This diff is collapsed.
Click to expand it.
plants/init.lua~
+
5
−
4
View file @
e3a9d058
...
...
@@ -90,7 +90,8 @@ end
-- The spawning ABM
spawn_on_surfaces = function(sdelay, splant, sradius, schance, ssurface, savoid, seed_diff, lightmin, lightmax, nneighbors, ocount)
spawn_on_surfaces = function(sdelay, splant, sradius, schance, ssurface, savoid, seed_diff, lightmin, lightmax, nneighbors, ocount, facedir)
if seed_diff == nil then seed_diff = 0 end
if lightmin == nil then lightmin = 0 end
if lightmax == nil then lightmax = LIGHT_MAX end
if nneighbors == nil then nneighbors = ssurface end
...
...
@@ -119,7 +120,7 @@ spawn_on_surfaces = function(sdelay, splant, sradius, schance, ssurface, savoid,
minetest.env:add_node(p_top, { name = "poisonivy:climbing", param2 = walldir })
else
dbg("Spawn: "..splant.." at "..dump(p_top).." on "..ssurface)
minetest.env:add_node(p_top, { name = splant })
minetest.env:add_node(p_top, { name = splant
, param2 = facedir
})
end
end
end
...
...
@@ -129,7 +130,7 @@ end
-- The growing ABM
grow_plants = function(gdelay, gchance, gplant, gresult, dry_early_node, grow_nodes)
grow_plants = function(gdelay, gchance, gplant, gresult, dry_early_node, grow_nodes
, facedir
)
minetest.register_abm({
nodenames = { gplant },
interval = gdelay,
...
...
@@ -160,7 +161,7 @@ grow_plants = function(gdelay, gchance, gplant, gresult, dry_early_node, grow_no
elseif gresult ~= nil then
dbg("Grow: "..gplant.." -> "..gresult.." at ("..dump(pos)..")")
minetest.env:add_node(pos, { name = gresult })
minetest.env:add_node(pos, { name = gresult
, param2 = facedir
})
else
dbg("Die: "..gplant.." at ("..dump(pos)..")")
minetest.env:remove_node(pos)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment