Compare commits
5 Commits
47b65a761f
...
2843875531
Author | SHA1 | Date |
---|---|---|
|
2843875531 | |
|
d9eddcc2fe | |
|
4e551ae828 | |
|
60c1de9121 | |
|
48b4ac39c3 |
2
TODO.txt
2
TODO.txt
|
@ -2,7 +2,7 @@
|
|||
TODO:
|
||||
- add debugging messages for missing required fields at registration
|
||||
- fix playing default hit sound on last hit when entity dies
|
||||
- only spawn if players are nearby
|
||||
- only spawn if players are nearby (maybe not necessary if ABMs only active near players)
|
||||
- add secondary hostile flag for mobs that don't use def.stats.hostile but still "attack" players
|
||||
- use following settings for compatibility with mobs mod:
|
||||
- mobs_spawn
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-05-25 21:52:58 </i>
|
||||
<i style="float:right;">Last updated 2021-06-01 20:03:03 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
|
|
@ -244,7 +244,7 @@
|
|||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-05-25 21:52:58 </i>
|
||||
<i style="float:right;">Last updated 2021-06-01 20:03:03 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-05-25 21:52:58 </i>
|
||||
<i style="float:right;">Last updated 2021-06-01 20:03:03 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
|
|
@ -780,11 +780,13 @@
|
|||
</li>
|
||||
<li><span class="parameter">abm_interval</span>
|
||||
<span class="types"><span class="type">int</span></span>
|
||||
Time in seconds until Minetest tries to find a node with set specs.
|
||||
Time in seconds until Minetest tries to find a node with set specs (default: 44).
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
<li><span class="parameter">abm_chance</span>
|
||||
<span class="types"><span class="type">int</span></span>
|
||||
Chance is 1/<chance>.
|
||||
Chance is 1/<chance> (default: 7000).
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
<li><span class="parameter">max_number</span>
|
||||
<span class="types"><span class="type">int</span></span>
|
||||
|
@ -840,7 +842,8 @@
|
|||
</li>
|
||||
<li><span class="parameter">neighbors</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.6">table</a></span>
|
||||
List of nodes that should be neighbors where mob can spawn. Can be nil or table as above. "air" is forced always as neighbor.
|
||||
List of nodes that should be neighbors where mob can spawn. Can be nil or table as above (default: {"air"}).
|
||||
(<em>optional</em>)
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
@ -1119,7 +1122,7 @@
|
|||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-05-25 21:52:58 </i>
|
||||
<i style="float:right;">Last updated 2021-06-01 20:03:03 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
|
|
@ -58,18 +58,6 @@
|
|||
|
||||
<h2><a href="#Settings">Settings</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" ><a href="#only_peaceful_mobs">only_peaceful_mobs</a></td>
|
||||
<td class="summary">Disables attacking players.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" ><a href="#enable_damage">enable_damage</a></td>
|
||||
<td class="summary">Enables damage.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" ><a href="#creative_mode">creative_mode</a></td>
|
||||
<td class="summary">Enables creative mode.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" ><a href="#mobs.particles">mobs.particles</a></td>
|
||||
<td class="summary">Enables particles when swimming.</td>
|
||||
|
@ -82,6 +70,22 @@
|
|||
<td class="name" ><a href="#mobs.grief_owned">mobs.grief_owned</a></td>
|
||||
<td class="summary">Determines if owned entities can be killed by non-owners.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" ><a href="#only_peaceful_mobs">only_peaceful_mobs</a></td>
|
||||
<td class="summary">Disables attacking players.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" ><a href="#debug_mods">debug_mods</a></td>
|
||||
<td class="summary">Print extra debugging messages.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" ><a href="#creative_mode">creative_mode</a></td>
|
||||
<td class="summary">Enables creative mode.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" ><a href="#enable_damage">enable_damage</a></td>
|
||||
<td class="summary">Enables damage.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
|
@ -91,76 +95,6 @@
|
|||
<h2 class="section-header "><a name="Settings"></a>Settings</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "only_peaceful_mobs"></a>
|
||||
<strong>only_peaceful_mobs</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Disables attacking players.
|
||||
|
||||
<h3>Type:</h3>
|
||||
<ul>
|
||||
bool
|
||||
</ul>
|
||||
<h3>Default value:</h3>
|
||||
<ul>
|
||||
false
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "enable_damage"></a>
|
||||
<strong>enable_damage</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Enables damage. </p>
|
||||
|
||||
<p> Global setting.
|
||||
|
||||
<h3>Type:</h3>
|
||||
<ul>
|
||||
bool
|
||||
</ul>
|
||||
<h3>Default value:</h3>
|
||||
<ul>
|
||||
false
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "creative_mode"></a>
|
||||
<strong>creative_mode</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Enables creative mode. </p>
|
||||
|
||||
<p> Global setting.
|
||||
|
||||
<h3>Type:</h3>
|
||||
<ul>
|
||||
bool
|
||||
</ul>
|
||||
<h3>Default value:</h3>
|
||||
<ul>
|
||||
false
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "mobs.particles"></a>
|
||||
<strong>mobs.particles</strong>
|
||||
|
@ -226,6 +160,94 @@
|
|||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "only_peaceful_mobs"></a>
|
||||
<strong>only_peaceful_mobs</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Disables attacking players.
|
||||
|
||||
<h3>Type:</h3>
|
||||
<ul>
|
||||
bool
|
||||
</ul>
|
||||
<h3>Default value:</h3>
|
||||
<ul>
|
||||
false
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "debug_mods"></a>
|
||||
<strong>debug_mods</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Print extra debugging messages.
|
||||
|
||||
<h3>Type:</h3>
|
||||
<ul>
|
||||
bool
|
||||
</ul>
|
||||
<h3>Default value:</h3>
|
||||
<ul>
|
||||
false
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "creative_mode"></a>
|
||||
<strong>creative_mode</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Enables creative mode.
|
||||
|
||||
<h3>Type:</h3>
|
||||
<ul>
|
||||
bool
|
||||
</ul>
|
||||
<h3>Default value:</h3>
|
||||
<ul>
|
||||
false
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "enable_damage"></a>
|
||||
<strong>enable_damage</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Enables damage.
|
||||
|
||||
<h3>Type:</h3>
|
||||
<ul>
|
||||
bool
|
||||
</ul>
|
||||
<h3>Default value:</h3>
|
||||
<ul>
|
||||
false
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
@ -234,7 +256,7 @@
|
|||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2021-05-25 21:52:58 </i>
|
||||
<i style="float:right;">Last updated 2021-06-01 20:03:03 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
|
|
22
register.lua
22
register.lua
|
@ -347,12 +347,18 @@ local function groupSpawn(pos, mob, group, nodes, range, max_loops)
|
|||
p.y = p.y + 1
|
||||
if checkSpace(p, mob.size) == true then
|
||||
cnt = cnt + 1
|
||||
core.add_entity(p, mob.name)
|
||||
if not core.add_entity(p, mob.name) then
|
||||
cmer.log("error", "could not spawn entity: " .. tostring(mob.name))
|
||||
elseif cmer.debug then
|
||||
print("Spawned entity: " .. tostring(mob.name) .. " number " .. tostring(cnt))
|
||||
end
|
||||
end
|
||||
end
|
||||
if cnt < group then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function cmer.register_spawn(spawn_def)
|
||||
|
@ -369,6 +375,12 @@ function cmer.register_spawn(spawn_def)
|
|||
table.insert(spawn_def.abm_nodes.neighbors, "air")
|
||||
end
|
||||
|
||||
local mob_name = translate_name(spawn_def.mob_name)
|
||||
|
||||
if cmer.debug then
|
||||
print("\nregistering spawn for: " .. tostring(mob_name))
|
||||
end
|
||||
|
||||
core.register_abm({
|
||||
nodenames = spawn_def.abm_nodes.spawn_on,
|
||||
neighbors = spawn_def.abm_nodes.neighbors,
|
||||
|
@ -381,8 +393,6 @@ function cmer.register_spawn(spawn_def)
|
|||
return
|
||||
end
|
||||
|
||||
local mob_name = translate_name(spawn_def.mob_name)
|
||||
|
||||
if cmer.debug then
|
||||
print("ABM reached: " .. tostring(mob_name))
|
||||
end
|
||||
|
@ -815,8 +825,8 @@ end
|
|||
--
|
||||
-- @table SpawnDef
|
||||
-- @tfield ABMNodesDef abm_nodes On what nodes mob can spawn.
|
||||
-- @tfield int abm_interval Time in seconds until Minetest tries to find a node with set specs.
|
||||
-- @tfield int abm_chance Chance is 1/<chance>.
|
||||
-- @tfield[opt] int abm_interval Time in seconds until Minetest tries to find a node with set specs (default: 44).
|
||||
-- @tfield[opt] int abm_chance Chance is 1/<chance> (default: 7000).
|
||||
-- @tfield int max_number Maximum mobs of this kind per mapblock (16x16x16).
|
||||
-- @tfield int number How many mobs are spawned if found suitable spawn position. Can be `int` or `table`: number = {min=<value>, max=<value>}
|
||||
-- @tfield[opt] table time_range Time range in time of day format (0-24000) (table with *min* & *max* values).
|
||||
|
@ -828,7 +838,7 @@ end
|
|||
--
|
||||
-- @table ABMNodesDef
|
||||
-- @tfield[opt] table spawn_on List of nodes on which the mob can spawn.
|
||||
-- @tfield table neighbors List of nodes that should be neighbors where mob can spawn. Can be nil or table as above. "air" is forced always as neighbor.
|
||||
-- @tfield[opt] table neighbors List of nodes that should be neighbors where mob can spawn. Can be nil or table as above (default: {"air"}).
|
||||
|
||||
--- Spawner definition table.
|
||||
--
|
||||
|
|
Loading…
Reference in New Issue