This commit is contained in:
root 2021-08-02 20:41:22 +02:00
parent d0a0373ec6
commit 19be5362ee
7 changed files with 36 additions and 4 deletions

View file

@ -21,6 +21,7 @@ not_luadoc = true
boilerplate = false boilerplate = false
wrap = false wrap = false
style = true style = true
favicon = "https://www.minetest.net/media/icon.svg"
file = { file = {
"3d_armor/api.lua", "3d_armor/api.lua",

View file

@ -8,7 +8,7 @@ local use_cmi = minetest.global_exists("cmi")
mobs = { mobs = {
mod = "redo", mod = "redo",
version = "20210731", version = "20210801",
intllib = S, intllib = S,
invis = minetest.global_exists("invisibility") and invisibility or {} invis = minetest.global_exists("invisibility") and invisibility or {}
} }
@ -2703,6 +2703,12 @@ function mob_class:do_states(dtime)
local obj = minetest.add_entity(p, self.arrow) local obj = minetest.add_entity(p, self.arrow)
local ent = obj:get_luaentity() local ent = obj:get_luaentity()
local amount = (vec.x * vec.x + vec.y * vec.y + vec.z * vec.z) ^ 0.5 local amount = (vec.x * vec.x + vec.y * vec.y + vec.z * vec.z) ^ 0.5
-- check for custom override for arrow
if self.arrow_override then
self.arrow_override(ent)
end
local v = ent.velocity or 1 -- or set to default local v = ent.velocity or 1 -- or set to default
ent.switch = 1 ent.switch = 1
@ -3573,6 +3579,7 @@ minetest.register_entity(name, setmetatable({
armor = def.armor, armor = def.armor,
on_rightclick = def.on_rightclick, on_rightclick = def.on_rightclick,
arrow = def.arrow, arrow = def.arrow,
arrow_override = def.arrow_override,
shoot_interval = def.shoot_interval, shoot_interval = def.shoot_interval,
sounds = def.sounds, sounds = def.sounds,
animation = def.animation, animation = def.animation,

View file

@ -123,6 +123,8 @@ functions needed for the mob to work properly which contains the following:
continue chasing. continue chasing.
'arrow' holds the pre-defined arrow object to shoot when 'arrow' holds the pre-defined arrow object to shoot when
attacking. attacking.
'arrow_override' function that allows tweaking of arrow entity from
inside mob definition (self) passed to function.
'dogshoot_switch' allows switching between attack types by using timers 'dogshoot_switch' allows switching between attack types by using timers
(1 for shoot, 2 for dogfight) (1 for shoot, 2 for dogfight)
'dogshoot_count_max' contains how many seconds before switching from 'dogshoot_count_max' contains how many seconds before switching from

View file

@ -23,6 +23,7 @@ Lucky Blocks: 9
Changelog: Changelog:
- 1.56 - Added arrow_override function to mob definition to tweak arrow entity settings, tamed monsters no longer despawn when outside loaded map area.
- 1.55 - Add 'peaceful_player' privelage and setting so mobs don't attack specific players (thanks sfence), add support for MarkBu's pathfinder mod, remove need for default mod - 1.55 - Add 'peaceful_player' privelage and setting so mobs don't attack specific players (thanks sfence), add support for MarkBu's pathfinder mod, remove need for default mod
- 1.54 - Simplified animal breeding function, added editable settings (thanks Wuzzy), Child mobs now take 20 mins to grow up, reverted to simple mob spawning with setting to use area checks, on_flop added, air_damage added. - 1.54 - Simplified animal breeding function, added editable settings (thanks Wuzzy), Child mobs now take 20 mins to grow up, reverted to simple mob spawning with setting to use area checks, on_flop added, air_damage added.
- 1.53 - Added 'on_map_load' settings to mobs:spawn so that mobs will only spawn when new areas of map are loaded. - 1.53 - Added 'on_map_load' settings to mobs:spawn so that mobs will only spawn when new areas of map are loaded.

View file

@ -151,7 +151,14 @@ tubelib.register_node("tubelib_addons3:chest", {}, {
end, end,
on_push_item = function(pos, side, item) on_push_item = function(pos, side, item)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
return tubelib.put_item(meta, "main", item) local res = tubelib.put_item(meta, "main", item)
if res == false then
local inv = meta:get_inventory()
local leftover = inv:add_item("main", item)
item:set_count(leftover:get_count())
return false
end
return true
end, end,
on_unpull_item = function(pos, side, item) on_unpull_item = function(pos, side, item)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)

View file

@ -244,6 +244,12 @@ local function distributing(pos, meta)
rearrange_table(kvFilterItemNames[name]) rearrange_table(kvFilterItemNames[name])
busy = true busy = true
break break
elseif num ~= stack:get_count() then
local color = Side2Color[side]
counter[color] = counter[color] + stack:get_count()
rearrange_table(kvFilterItemNames[name])
busy = true
break
end end
end end
@ -257,6 +263,10 @@ local function distributing(pos, meta)
counter[color] = counter[color] + num counter[color] = counter[color] + num
busy = true busy = true
end end
elseif num ~= stack:get_count() then
local color = Side2Color[side]
counter[color] = counter[color] + stack:get_count()
busy = true
end end
end end
end end

View file

@ -42,11 +42,15 @@ local function pushing(pos, meta)
local player_name = meta:get_string("player_name") local player_name = meta:get_string("player_name")
local items = tubelib.pull_stack(pos, "L", player_name) local items = tubelib.pull_stack(pos, "L", player_name)
if items ~= nil then if items ~= nil then
local count = items:get_count()
if tubelib.push_items(pos, "R", items, player_name) == false then if tubelib.push_items(pos, "R", items, player_name) == false then
-- place item back -- place item back
tubelib.unpull_items(pos, "L", items, player_name) tubelib.unpull_items(pos, "L", items, player_name)
State:blocked(pos, meta) -- Complete stack rejected
return if count == items:get_count() then
State:blocked(pos, meta)
return
end
end end
if State.get_state(pos, meta) ~= tubelib.STOPPED then if State.get_state(pos, meta) ~= tubelib.STOPPED then
State:keep_running(pos, meta, COUNTDOWN_TICKS, 1) State:keep_running(pos, meta, COUNTDOWN_TICKS, 1)