This repository has been archived by the owner on Dec 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patho_statecreate.lua
72 lines (65 loc) · 2.73 KB
/
o_statecreate.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
function oStart(self)
self:SetVar("AiDisabled", false)
-- ////////////////////////////////////////////////////////////////////////////
-- Aggro
if self:GetVar('Set.Aggression') == "Aggressive" then
self:SetProximityRadius { radius = self:GetVar("Set.aggroRadius") , name = "aggroRadius" }
--if self:GetVar('Set.UseAggroFOV') then
-- self:SetProximityRadius { radius = self:GetVar("Set.aggroFOVRadius") , name = "aggroFOVRadius" }
--end
end
self:UseStateMachine{}
-- Create States
-- ////////////////////////////////////////////////////////////////////////////
-- Basic State
addState(Dead, "Dead", "Dead", self)
addState(Idle, "Idle", "Idle", self)
addState(tether, "tether", "tether", self)
addState(GoHome, "GoHome" , "GoHome", self)
addState(AiDisable, "AiDisable" , "AiDisable", self)
addState(AiEnable, "AiEnable" , "AiEnable", self)
addState(combat, "combat" , "combat" , self)
if (onTemplateCustomStateEnter) or (onTemplateCustomStateArrived) then
addState(customState, "customState" , "customState", self)
end
-- Wander
if self:GetVar("Set.SuspendLuaMovementAI") == nil or self:GetVar("Set.SuspendLuaMovementAI") == false then
if self:GetVar("Set.MovementType") == "Wander" then
addState(Meander, "Meander", "Meander", self)
addState(aggro, "aggro", "aggro", self)
if self:GetVar("Set.FollowActive") then
addState(Follow, "Follow", "Follow", self)
end
beginStateMachine("Meander", self)
end
-- Guard
if self:GetVar("Set.MovementType") == "Guard" then
addState(aggro, "aggro", "aggro", self)
if self:GetVar("Set.FollowActive") then
addState(Follow, "Follow", "Follow", self)
end
beginStateMachine("Idle", self)
Idle.onEnter(self)
end
else
beginStateMachine("Idle", self)
Idle.onEnter(self)
end -- end suspend movement AI
-- Guard
if self:GetVar("Set.MovementType") == "Frozen" then
addState(aggro, "aggro", "aggro", self)
addSubState(attack, "attack", "attack", self)
beginStateMachine("Idle", self)
Idle.onEnter(self)
end
-- Way Point Event ---
if self:GetVar("Set.WayPointSet") ~= nil or self:GetVar("attached_path") ~= nil or self:GetVar("groupID") ~= nil then
if self:GetVar("Set.SuspendLuaMovementAI") == true then
return
end
addState(WayPointEvent, "WayPointEvent", "WayPointEvent", self)
if self:GetVar("groupID") == nil then
self:FollowWaypoints()
end
end
end