Merge branch 'fixes' into main/gingo-test
[ryzomcore.git] / ryzom / common / data_common / r2 / r2_actions.lua
blob8a7222e186e44c8ae703bee577027ccde50f6896
1 -- if not r2.Actions then r2.Actions={} end
3 -- obsolete
4 r2._obsolete_Actions_createActionWithCondition = function(name, conditions, actions)
5 assert(name)
6 assert(type(conditions) == "table")
7 assert(actions)
9 local first = nil
10 local previous = nil
12 local k, condition = next(conditions, nil)
13 while condition do
14 local condition_if = r2.newComponent("RtNpcEventHandlerAction")
15 condition_if.Action = "condition_if"
16 condition_if.Parameters = condition
17 if (previous) then table.insert(previous, condition_if) end
18 if (first == nil) then first = condition_if end
19 previous = condition_if.Children
20 k, condition = next(conditions, k)
21 end
24 local multi_actions = r2.newComponent("RtNpcEventHandlerAction")
25 multi_actions.Action = "multi_actions"
26 multi_actions.Parameters = ""
27 multi_actions.Children = actions
28 assert(multi_actions)
29 if (previous) then table.insert(previous, multi_actions) end
30 if (first == nil) then first = multi_actions end
31 end
33 -- table.insert(multi_actions.Children, actions)
34 return first
35 end
40 --debugInfo("actions ok!!")