Remove AI feature from entity system replacing it with simple options that alter it's behaviour
This commit is contained in:
parent
27254354e5
commit
7b342531b0
@ -148,7 +148,6 @@ end
|
||||
|
||||
PyuTest.make_mob = function(name, properties, options)
|
||||
local default_options = {
|
||||
ai = "dummy",
|
||||
max_jump = 1,
|
||||
max_drop = 8,
|
||||
speed = 3,
|
||||
@ -157,6 +156,7 @@ PyuTest.make_mob = function(name, properties, options)
|
||||
gravity = true,
|
||||
gravity_multiplier = 1,
|
||||
health_regen = true,
|
||||
follow_player = false,
|
||||
|
||||
sounds = {
|
||||
hurt = "pyutest-entity-hurt"
|
||||
@ -202,7 +202,6 @@ PyuTest.make_mob = function(name, properties, options)
|
||||
self.dtime = dtime
|
||||
self.moveresult = moveresult
|
||||
|
||||
local ai = self.options.ai
|
||||
local obj = self.object
|
||||
local p = obj:get_properties()
|
||||
|
||||
@ -219,13 +218,9 @@ PyuTest.make_mob = function(name, properties, options)
|
||||
p.infotext = string.format("Mob Health: %d/%d", obj:get_hp(), p.hp_max)
|
||||
obj:set_properties(p)
|
||||
|
||||
if ai == nil or ai == "dummy" then
|
||||
return
|
||||
end
|
||||
|
||||
self:do_physics()
|
||||
|
||||
if ai == "follownearest" then
|
||||
if self.options.follow_player then
|
||||
self:path_find_nearest_entity(false)
|
||||
end
|
||||
end,
|
||||
|
@ -10,7 +10,7 @@ PyuTest.make_mob("pyutest_entities:test_follower", {
|
||||
},
|
||||
nametag = "Test Follower",
|
||||
}, {
|
||||
ai = "follownearest",
|
||||
follow_player = true,
|
||||
max_jump = 1,
|
||||
max_drop = 50,
|
||||
view_range = 3,
|
||||
|
Loading…
x
Reference in New Issue
Block a user