Don't initiate pathing unless driver needs one.
This commit is contained in:
parent
9ff4807f96
commit
54cb86d208
6
init.lua
6
init.lua
@ -252,7 +252,7 @@ entity_ai.register_driver("roam", {
|
|||||||
|
|
||||||
self.path = Path(self)
|
self.path = Path(self)
|
||||||
if not self.path:find() then
|
if not self.path:find() then
|
||||||
print("Unable to calculate path")
|
--print("Unable to calculate path")
|
||||||
self.driver:switch("idle")
|
self.driver:switch("idle")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -492,7 +492,7 @@ entity_ai.register_driver("flee", {
|
|||||||
else
|
else
|
||||||
self.path = Path(self)
|
self.path = Path(self)
|
||||||
if not self.path:find() then
|
if not self.path:find() then
|
||||||
print("Unable to calculate path")
|
--print("Unable to calculate path")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -587,12 +587,14 @@ local function entity_ai_on_activate(self, staticdata)
|
|||||||
self.driver = Driver(self, driver)
|
self.driver = Driver(self, driver)
|
||||||
|
|
||||||
-- path class
|
-- path class
|
||||||
|
if self.script[driver].finders then
|
||||||
if state.path_save then
|
if state.path_save then
|
||||||
self.path = Path(self, state.path_save.target)
|
self.path = Path(self, state.path_save.target)
|
||||||
self.path:set_config(state.path_save.config)
|
self.path:set_config(state.path_save.config)
|
||||||
self.path:find()
|
self.path:find()
|
||||||
state.path_save = {}
|
state.path_save = {}
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--print("loaded: " .. self.name .. ", driver=" .. driver )
|
--print("loaded: " .. self.name .. ", driver=" .. driver )
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user