添加配置表

This commit is contained in:
flswld
2022-11-30 00:00:20 +08:00
parent f70a890338
commit d7f3f3b866
33382 changed files with 8476601 additions and 0 deletions

View File

@@ -0,0 +1,92 @@
--[[
电桩玩法 黑盒
]]--
local extraTriggers={
{ config_id = 8000001, name = "GROUP_LOAD", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0 },
{ config_id = 8000003,name = "LEAVE_REGION", event = EventType.EVENT_LEAVE_REGION, source = "", condition = "", action = "action_EVENT_LEAVE_REGION", forbid_guest = false, trigger_count = 0 },
--{ config_id = 8000004, name = "SELECT_OPTION", event = EventType.EVENT_SELECT_OPTION, source = "", condition = "", action = "action_EVENT_SELECT_OPTION", trigger_count = 0,forbid_guest = false }
{config_id = 8000005, name = "GadgetStateChange", event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "", action = "action_Gadget_State_Change", trigger_count = 0 },
}
function LF_Initialize_Group(triggers, suites)
for i=1,#extraTriggers do
table.insert(triggers, extraTriggers[i])
table.insert(suites[init_config.suite].triggers,extraTriggers[i].name)
end
table.insert(variables,{ config_id=50000001,name = "successed", value = 0, no_refresh = true})
--初始化
end
function action_Gadget_State_Change(context, evt)
ScriptLib.PrintContextLog(context, "物件状态发生变化"..evt.param1..evt.param2)
if evt.param2==defs.gadget_1 and evt.param1==202 and ScriptLib.GetGroupVariableValue(context, "successed")~=1 then
ScriptLib.PrintContextLog(context, "挑战已经完成")
ScriptLib.SetGroupVariableValue(context, "successed", 1)
ScriptLib.AddExtraGroupSuite(context, defs.group_ID, 3)
end
return 0
end
function action_group_load(context, evt)
if ScriptLib.GetGroupVariableValue(context, "successed")==1 then
RemoveAllRepeater(context)
ScriptLib.AddExtraGroupSuite(context, defs.group_ID, 3)
ScriptLib.SetGroupGadgetStateByConfigId(context, defs.group_ID, defs.gadget_1, 202)
for i=1,#gadgets do
if gadgets[i].gadget_id == 70950068 then
ScriptLib.SetGroupGadgetStateByConfigId(context, defs.group_ID, gadgets[i].config_id, 901)
end
end
return 0
end
ScriptLib.AddExtraGroupSuite(context, defs.group_ID, 2)
return 0
end
--拾取时给按钮充能
function action_EVENT_SELECT_OPTION(context, evt)
for i=1,#defs.relayPost do
ScriptLib.PrintContextLog(context, "成功触发交互"..context.uid..defs.relayPost[i]..evt.param1)
if evt.param1==defs.relayPost[i] then
if evt.param2==57 then
ScriptLib.PrintContextLog(context, "成功触发交互中继器"..context.uid)
ScriptLib.AddTeamEntityGlobalFloatValue(context, {context.uid},"AVATAR_Electric_Stake_Play", 1)
end
return 0
end
end
return 0
end
--退出区域关闭挑战
function action_EVENT_LEAVE_REGION(context, evt)
if evt.param1 ~= defs.trigger_playRegion then
return 0
end
if ScriptLib.GetGroupVariableValue(context, "successed")==1 then
RemoveAllRepeater(context)
return 0
end
ScriptLib.RefreshGroup(context,{group_id=defs.group_Id,suite=1})
ScriptLib.AddExtraGroupSuite(context, defs.group_ID, 2)
return 0
end
function RemoveAllRepeater(context)
for i=1,#gadgets do
if gadgets[i].gadget_id == 70950069 then
ScriptLib.RemoveEntityByConfigId(context, defs.group_ID, EntityType.GADGET, gadgets[i].config_id)
end
end
return 0
end
function Electric_Stake_Explain(context)
ScriptLib.MarkPlayerAction(context, 7003, 3, 1)
return 0
end
LF_Initialize_Group(triggers, suites)

View File

@@ -0,0 +1,251 @@
---
--- Generated by Luanalysis
--- Created by binghong.shen.
--- DateTime: 2022/5/6 15:52
---
--[[======================================
|| filename: DesertEnergySpark
|| owner: binghong.shen
|| description: 元能火种
|| LogName: DesertEnergySpark
|| Protection: [Protection]
=======================================]]
local fireTable = {
[1]={fireID = defs.gadget_fire1,fireBaseID = defs.gadget_fireBase1},
[2]={fireID = defs.gadget_fire2,fireBaseID = defs.gadget_fireBase2},
[3]={fireID = defs.gadget_fire3,fireBaseID = defs.gadget_fireBase3},
[4]={fireID = defs.gadget_fire4,fireBaseID = defs.gadget_fireBase4},
}
local extraTriggers={
{ config_id = 8000002, name = "Select_Option", event = EventType.EVENT_SELECT_OPTION, source = "", condition = "", action = "action_SelectOption", trigger_count = 0 },
{ config_id = 8000003, name = "Fire_Reach_Point", event= EventType.EVENT_PLATFORM_ARRIVAL, source = "", condition = "", action = "action_PlatReachPoint", trigger_count = 0 },
{ config_id = 8000004, name = "Gadget_Create", event= EventType.EVENT_GADGET_CREATE, source = "", condition = "", action = "action_OnGadgetCreate", trigger_count = 0 },
{ config_id = 8000005, name = "Gadget_Die", event= EventType.EVENT_ANY_GADGET_DIE, source = "", condition = "", action = "action_OnAnyGadgetDie", trigger_count = 0 },
{ config_id = 8000006, name = "Avatar_Near_Platform", event= EventType.EVENT_AVATAR_NEAR_PLATFORM, source = "", condition = "", action = "action_AvatarNearPlatform", trigger_count = 0 },
{ config_id = 8000007, name = "GadgetStateChange", event= EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "", action = "action_GadgetStateChange", trigger_count = 0 },
{ config_id = 8000008, name = "OnGroupLoad", event= EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_OnGroupLoad", trigger_count = 0 },
}
function action_OnGroupLoad(context)
for _,v in pairs(fireTable) do
if(v.fireID and v.fireID~=0)then
ScriptLib.KillEntityByConfigId(context, { config_id = v.fireID })
end
end
local moveIndex = ScriptLib.GetGroupVariableValue(context, "recordMoveIndex")
for k,v in pairs(fireTable) do
if(v.fireBaseID and v.fireBaseID~=0)then
local baseState = ScriptLib.GetGadgetStateByConfigId(context, base_info.group_id, v.fireBaseID)
if(baseState == 0 or baseState == 201)then
if(k==moveIndex)then
ScriptLib.SetGadgetStateByConfigId(context,v.fireBaseID , 201)
else
ScriptLib.SetGadgetStateByConfigId(context,v.fireBaseID , 0)
end
end
end
end
return 0
end
function SLC_EngineerMark( context )
local eid = context.source_entity_id
ScriptLib.MarkGroupLuaAction(context, "getengineer", "", {group_id = base_info.group_id ,config_id = ScriptLib.GetGadgetConfigId(context, { gadget_eid = eid }) })
return 0
end
function LF_Initialize_Group(triggers, suites)
for i=1,#extraTriggers do
table.insert(triggers, extraTriggers[i])
table.insert(suites[init_config.suite].triggers,extraTriggers[i].name)
end
--初始化
table.insert(variables,{ config_id=50000001,name = "recordMoveIndex", value = 1 , no_refresh = true})
end
--初始化一些按键
function action_OnGadgetCreate(context,evt )
-- 设置操作台选项
local isFireBase = false
local gadgetID = evt.param1
for _,v in pairs(fireTable) do
if(v.fireBaseID==gadgetID)then
isFireBase = true
break
end
end
if(isFireBase == false)then
return -1
end
if GadgetState.GearStart == ScriptLib.GetGadgetStateByConfigId(context, base_info.group_id, gadgetID) then
ScriptLib.PrintContextLog(context, "@@ DesertEnergySpark : energySpark SetOption")
ScriptLib.SetWorktopOptionsByGroupId(context, base_info.group_id, gadgetID, {defs.interactOptionID})
else
ScriptLib.SetWorktopOptionsByGroupId(context, base_info.group_id, gadgetID, {})
end
return 0
end
--基座状态改变需要增删按钮
function action_GadgetStateChange( context,evt )
local isFireBase = false
local gadgetState = evt.param1
local gadgetID = evt.param2
for _,v in pairs(fireTable) do
if(v.fireBaseID==gadgetID)then
isFireBase = true
break
end
end
if(isFireBase == false)then
return -1
end
if GadgetState.GearStart == gadgetState then
ScriptLib.PrintContextLog(context, "@@ DesertEnergySpark : energySpark SetOption")
ScriptLib.SetWorktopOptionsByGroupId(context, base_info.group_id, gadgetID, {defs.interactOptionID})
else
ScriptLib.SetWorktopOptionsByGroupId(context, base_info.group_id, gadgetID, {})
end
return 0
end
--按下按键召唤火种
function action_SelectOption( context,evt )
local gadgetID = evt.param1
local optionID = evt.param2
if(optionID ~= defs.interactOptionID)then
return -1
end
local moveIndex = 1
for k,v in ipairs(fireTable)do
if(v.fireBaseID==gadgetID)then
moveIndex = k
break
end
end
local nextIndex = moveIndex + 1
local nextFireBase = 0
if(fireTable[nextIndex]~=nil and fireTable[nextIndex].fireBaseID~=0)then
nextFireBase = fireTable[nextIndex].fireBaseID
local entityID = ScriptLib.GetEntityIdByConfigId(context, nextFireBase)
if ScriptLib.GetGadgetIdByEntityId(context, entityID) == 70330313 then
local nextGadgetState = ScriptLib.GetGadgetStateByConfigId(context, base_info.group_id, nextFireBase)
if nextGadgetState == 204 then
ScriptLib.ShowReminder(context, 33010249)
return 0
end
end
end
--ScriptLib.SetGroupTempValue(context, "CurMoveIndex", moveIndex, {})
ScriptLib.SetGadgetStateByConfigId(context, fireTable[moveIndex].fireBaseID, 0)
ScriptLib.SetWorktopOptionsByGroupId(context, base_info.group_id, gadgetID, {})
ScriptLib.CreateGadget(context, { config_id = fireTable[moveIndex].fireID })
return 0
end
--角色靠近火种能推动它
function action_AvatarNearPlatform( context,evt )
local gadgetID = evt.param1
--判断是否是火种
local moveIndex = -1
for k,v in ipairs(fireTable)do
if(v.fireID==gadgetID)then
moveIndex = k
break
end
end
if(moveIndex==-1)then
return -1
end
ScriptLib.StartPlatform(context, gadgetID)
return 0
end
--火种被风扇吹散
function action_OnAnyGadgetDie( context,evt )
local gadgetID = evt.param1
--判断是否是火种
local moveIndex = -1
for k,v in ipairs(fireTable)do
if(v.fireID==gadgetID)then
moveIndex = k
break
end
end
if(moveIndex==-1)then
return -1
end
local nextIndex = moveIndex + 1
local nextFireBase = 0
if(fireTable[nextIndex]==nil or fireTable[nextIndex].fireBaseID==0)then
nextFireBase = defs.gadget_fireTorch
else
nextFireBase = fireTable[nextIndex].fireBaseID
end
local gadgetState = ScriptLib.GetGadgetStateByConfigId(context, base_info.group_id, nextFireBase)
--下一个gadget还没被点亮所以是被风吹灭的需要把上一个基座恢复
if(gadgetState==0)then
ScriptLib.SetGadgetStateByConfigId(context, fireTable[moveIndex].fireBaseID, 201)
end
return 0
end
--火种到达目的地
function action_PlatReachPoint( context,evt )
local gadgetID = evt.param1
local moveIndex = -1
for k,v in ipairs(fireTable)do
if(v.fireID==gadgetID)then
moveIndex = k
break
end
end
if(moveIndex==-1)then
return -1
end
local nextIndex = moveIndex+1
if(fireTable[nextIndex]==nil or fireTable[nextIndex].fireBaseID==0)then
--到达了终点
ScriptLib.SetGadgetStateByConfigId(context, defs.gadget_fireTorch, 201)
ScriptLib.SetGadgetStateByConfigId(context,gadgetID , 201)
else
ScriptLib.SetGadgetStateByConfigId(context,fireTable[nextIndex].fireBaseID , 201)
ScriptLib.KillEntityByConfigId(context, { config_id = gadgetID })
end
ScriptLib.SetGroupVariableValue(context, "recordMoveIndex", nextIndex)
return 0
end
LF_Initialize_Group(triggers, suites)

View File

@@ -0,0 +1,212 @@
--[[
一笔画固定5x5版本
]]--
local matrix =
{
{defs.gadget_11,defs.gadget_12,defs.gadget_13,defs.gadget_14,defs.gadget_15},
{defs.gadget_21,defs.gadget_22,defs.gadget_23,defs.gadget_24,defs.gadget_25},
{defs.gadget_31,defs.gadget_32,defs.gadget_33,defs.gadget_34,defs.gadget_35},
{defs.gadget_41,defs.gadget_42,defs.gadget_43,defs.gadget_44,defs.gadget_45},
{defs.gadget_51,defs.gadget_52,defs.gadget_53,defs.gadget_54,defs.gadget_55}}
local extraTriggers={
{config_id = 8000001, name = "GadgetStateChange", event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "", action = "action_Gadget_State_Change", trigger_count = 0 },
{config_id = 8000002,name = "LEAVE_REGION", event = EventType.EVENT_LEAVE_REGION, source = "", condition = "", action = "action_EVENT_LEAVE_REGION", forbid_guest = false, trigger_count = 0 },
--{ config_id = 8000003, name = "GADGET_CREATE", event = EventType.EVENT_GADGET_CREATE, source = "", condition = "", action = "action_gadget_create", trigger_count = 0 },
{ config_id = 8000004, name = "GROUP_LOAD", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0 },
}
function LF_Initialize_Group(triggers, suites)
for i=1,#extraTriggers do
table.insert(triggers, extraTriggers[i])
table.insert(suites[init_config.suite].triggers,extraTriggers[i].name)
end
table.insert(variables,{ config_id=50000001,name = "successed", value = 0, no_refresh = true})
--challenge_state 0-等待开始 1-正在进行 2-完成 3-失败流程中
table.insert(variables,{ config_id=50000002,name = "challenge_state", value = 0})
table.insert(variables,{ config_id=50000003,name = "current_stone", value = 0})
--这个GV用于GadgetLua
table.insert(variables,{ config_id=50000004,name = "starter_id", value = 0})
--初始化
end
function action_group_load(context, evt)
ScriptLib.AddExtraGroupSuite(context, defs.group_ID, 2)
ScriptLib.SetGroupVariableValue(context, "starter_id",defs.gadget_starter)
return 0
end
--处理失败逻辑
function FaildProcess(context,str)
--Faild process start
ScriptLib.PrintContextLog(context,"Faild Process Start : "..str)
ScriptLib.SetGroupVariableValue(context, "challenge_state", 3)
for k,v in pairs(matrix) do
for ik,iv in pairs(v) do
local tempGadgeState = ScriptLib.GetGadgetStateByConfigId(context, defs.group_ID, iv)
--除了禁用格和起始格,全部格子下降
if tempGadgeState ~= 903 then
if iv ~= defs.gadget_starter then
ScriptLib.SetGadgetStateByConfigId(context, iv, 102)
else
ScriptLib.SetGadgetStateByConfigId(context, iv, 201)
end
end
end
end
ScriptLib.PrintContextLog(context,"Faild Process End : "..str)
ScriptLib.SetGroupVariableValue(context, "challenge_state", 0)
end
function LuaCallFail(context)
--物件调用
--如果踩到禁用格,且正在挑战中,则走一下失败流程
if ScriptLib.GetGroupVariableValue(context, "challenge_state")==1 then
FaildProcess(context,"踩到空方块")
end
return 0
end
function action_Gadget_State_Change(context, evt)
if evt.param1==202 and evt.param3==204 and ScriptLib.GetGroupVariableValue(context, "challenge_state")==1 then
--先检查是不是从相邻的格子踩进终点格
CheckTwoGadgetIsAdjacent(context,ScriptLib.GetGroupVariableValue(context, "current_stone"),evt.param2)
--再算分
CheckIsSuccess(context)
if ScriptLib.GetGroupVariableValue(context, "successed")~=1 then
FaildProcess(context,"提前踩到终点")
end
return 0
end
--如果挑战状态是未开始challenge_state=0且被交互的是起始格则开始挑战
if ScriptLib.GetGroupVariableValue(context, "challenge_state")==0 and
evt.param1==202 and evt.param2== defs.gadget_starter then
ScriptLib.PrintContextLog(context,"StartChallenge ")
ScriptLib.SetGroupVariableValue(context, "challenge_state", 1)
--先把终点格子切到State 204
if defs.gadget_ender==0 then
ScriptLib.PrintContextLog(context,"一笔画终点石板没配,使用自由模式")
else
ScriptLib.SetGadgetStateByConfigId(context, defs.gadget_ender, 204)
end
--然后除了禁用格、起始格、终点格,全部格子升起
for i=1,#matrix do
for j=1,#matrix[i] do
if ScriptLib.GetGadgetStateByConfigId(context, defs.group_ID, matrix[i][j]) ~= 903 then
if matrix[i][j] ~= defs.gadget_starter and matrix[i][j] ~= defs.gadget_ender then
ScriptLib.SetGadgetStateByConfigId(context, matrix[i][j], 101)
end
end
--设置当前在哪个方块
if matrix[i][j]==evt.param2 then
ScriptLib.SetGroupVariableValue(context, "current_stone", i*10+j)
end
end
end
return 0
end
--如果挑战状态是已开始challenge_state=1则检查格子有效性
if ScriptLib.GetGroupVariableValue(context, "challenge_state")==1 then
if evt.param1==202 then
CheckTwoGadgetIsAdjacent(context,ScriptLib.GetGroupVariableValue(context, "current_stone"),evt.param2)
end
if evt.param1==201 and evt.param3==202 then
local current_idx=ScriptLib.GetGroupVariableValue(context, "current_stone")
local config_one=matrix[math.floor(current_idx/10)][current_idx%10]
if config_one==evt.param2 then
ScriptLib.SetGadgetStateByConfigId(context, evt.param2, 202)
else
FaildProcess(context,"踩错")
end
end
CheckIsSuccess(context)
return 0
end
return 0
end
function action_EVENT_LEAVE_REGION(context, evt)
--解谜成功、解谜未开始 不算出圈
if evt.param1~=defs.trigger_boarder or
ScriptLib.GetGroupVariableValue(context, "successed")==1 or
ScriptLib.GetGroupVariableValue(context, "challenge_state")==0 then
ScriptLib.PrintContextLog(context, "Safe LEAVE REGION")
return 0
else
FaildProcess(context,"出圈")
end
return 0
end
--检测玩法是否成功
function CheckIsSuccess(context)
local score=0
local state=nil
for i=1,#matrix do
for j=1,#matrix[i] do
state=ScriptLib.GetGadgetStateByConfigId(context, defs.group_ID,matrix[i][j])
if state==202 or state==903 then
score=score+1
end
end
end
if score>=25 then
for i=1,#matrix do
for j=1,#matrix[i] do
if ScriptLib.GetGadgetStateByConfigId(context, defs.group_ID,matrix[i][j]) ~= 903 then
ScriptLib.SetGadgetStateByConfigId(context, matrix[i][j], 901)
end
end
end
ScriptLib.SetGroupVariableValue(context, "challenge_state", 2)
ScriptLib.GoToGroupSuite(context, defs.group_ID, 3)
ScriptLib.SetGroupVariableValue(context, "successed", 1)
end
return 0
end
--检测两个方块是否是相邻方块
function CheckTwoGadgetIsAdjacent(context,current_idx,config_two)
local x=math.floor(current_idx/10)
local y=current_idx%10
if matrix[x][y]==config_two then
return 0
end
if y>1 then
if matrix[x][y-1]==config_two then
ScriptLib.SetGroupVariableValue(context, "current_stone", x*10+y-1)
return 0
end
end
if y< #matrix[x] then
if matrix[x][y+1]==config_two then
ScriptLib.SetGroupVariableValue(context, "current_stone", x*10+y+1)
return 0
end
end
if x>1 then
if matrix[x-1][y]==config_two then
ScriptLib.SetGroupVariableValue(context, "current_stone", (x-1)*10+y)
return 0
end
end
if x < #matrix then
if matrix[x+1][y]==config_two then
ScriptLib.SetGroupVariableValue(context, "current_stone", (x+1)*10+y)
return 0
end
end
FaildProcess(context,"踩错")
return 0
end
LF_Initialize_Group(triggers, suites)

View File

@@ -0,0 +1,201 @@
--[[
一笔画黑盒 适用性优化版本
1.LD布设时只需要将起点格设成GearStart禁用格、终点格等特殊格子不需要设GadgetState
2.矩阵只要保证是矩形即可原黑盒是固定5*5
]]--
local extraTriggers={
{config_id = 8000001, name = "GadgetStateChange", event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "", action = "action_Gadget_State_Change", trigger_count = 0 },
{config_id = 8000002,name = "LEAVE_REGION", event = EventType.EVENT_LEAVE_REGION, source = "", condition = "", action = "action_EVENT_LEAVE_REGION", forbid_guest = false, trigger_count = 0 },
--{ config_id = 8000003, name = "GADGET_CREATE", event = EventType.EVENT_GADGET_CREATE, source = "", condition = "", action = "action_gadget_create", trigger_count = 0 },
{ config_id = 8000004, name = "GROUP_LOAD", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0 },
}
function LF_Initialize_Group(triggers, suites)
for i=1,#extraTriggers do
table.insert(triggers, extraTriggers[i])
table.insert(suites[init_config.suite].triggers,extraTriggers[i].name)
end
table.insert(variables,{ config_id=50000001,name = "successed", value = 0, no_refresh = true})
--challenge_state 0-等待开始 1-正在进行 2-完成 3-失败流程中
table.insert(variables,{ config_id=50000002,name = "challenge_state", value = 0})
table.insert(variables,{ config_id=50000003,name = "current_stone", value = 0})
--这个GV用于GadgetLua
table.insert(variables,{ config_id=50000004,name = "starter_id", value = 0})
--初始化
end
function action_group_load(context, evt)
ScriptLib.AddExtraGroupSuite(context, defs.group_ID, 2)
ScriptLib.SetGroupVariableValue(context, "starter_id",defs.gadget_starter)
return 0
end
--处理失败逻辑
function FaildProcess(context,str)
--Faild process start
ScriptLib.PrintContextLog(context,"Faild Process Start : "..str)
ScriptLib.SetGroupVariableValue(context, "challenge_state", 3)
for k,v in pairs(matrix) do
for ik,iv in pairs(v) do
local tempGadgeState = ScriptLib.GetGadgetStateByConfigId(context, defs.group_ID, iv)
--除了禁用格和起始格,全部格子下降
if tempGadgeState ~= 903 then
if iv ~= defs.gadget_starter then
ScriptLib.SetGadgetStateByConfigId(context, iv, 102)
else
ScriptLib.SetGadgetStateByConfigId(context, iv, 201)
end
end
end
end
ScriptLib.PrintContextLog(context,"Faild Process End : "..str)
ScriptLib.SetGroupVariableValue(context, "challenge_state", 0)
end
function LuaCallFail(context)
--物件调用
--如果踩到禁用格,且正在挑战中,则走一下失败流程
if ScriptLib.GetGroupVariableValue(context, "challenge_state")==1 then
FaildProcess(context,"踩到空方块")
end
return 0
end
function action_Gadget_State_Change(context, evt)
if evt.param1==202 and evt.param3==204 and ScriptLib.GetGroupVariableValue(context, "challenge_state")==1 then
--先检查是不是从相邻的格子踩进终点格
CheckTwoGadgetIsAdjacent(context,ScriptLib.GetGroupVariableValue(context, "current_stone"),evt.param2)
--再算分
CheckIsSuccess(context)
if ScriptLib.GetGroupVariableValue(context, "successed")~=1 then
FaildProcess(context,"提前踩到终点")
end
return 0
end
--如果挑战状态是未开始challenge_state=0且被交互的是起始格则开始挑战
if ScriptLib.GetGroupVariableValue(context, "challenge_state")==0 and
evt.param1==202 and evt.param2== defs.gadget_starter then
ScriptLib.SetGroupVariableValue(context, "challenge_state", 1)
--先把终点格子切到State 204
ScriptLib.SetGadgetStateByConfigId(context, defs.gadget_ender, 204)
--然后除了禁用格、起始格、终点格,全部格子升起
for i=1,#matrix do
for j=1,#matrix[i] do
if ScriptLib.GetGadgetStateByConfigId(context, defs.group_ID, matrix[i][j]) ~= 903 then
if matrix[i][j] ~= defs.gadget_starter and matrix[i][j] ~= defs.gadget_ender then
ScriptLib.SetGadgetStateByConfigId(context, matrix[i][j], 101)
end
end
--设置当前在哪个方块
if matrix[i][j]==evt.param2 then
ScriptLib.SetGroupVariableValue(context, "current_stone", i*10+j)
end
end
end
return 0
end
--如果挑战状态是已开始challenge_state=1则检查格子有效性
if ScriptLib.GetGroupVariableValue(context, "challenge_state")==1 then
if evt.param1==202 then
CheckTwoGadgetIsAdjacent(context,ScriptLib.GetGroupVariableValue(context, "current_stone"),evt.param2)
end
if evt.param1==201 and evt.param3==202 then
local current_idx=ScriptLib.GetGroupVariableValue(context, "current_stone")
local config_one=matrix[math.floor(current_idx/10)][current_idx%10]
if config_one==evt.param2 then
ScriptLib.SetGadgetStateByConfigId(context, evt.param2, 202)
else
FaildProcess(context,"踩错")
end
end
CheckIsSuccess(context)
return 0
end
return 0
end
function action_EVENT_LEAVE_REGION(context, evt)
--解谜成功、解谜未开始 不算出圈
if evt.param1~=defs.trigger_boarder or
ScriptLib.GetGroupVariableValue(context, "successed")==1 or
ScriptLib.GetGroupVariableValue(context, "challenge_state")==0 then
ScriptLib.PrintContextLog(context, "Safe LEAVE REGION")
return 0
else
FaildProcess(context,"出圈")
end
return 0
end
--检测玩法是否成功
function CheckIsSuccess(context)
local score=0
local state=nil
local maxscore = #matrix * #matrix[1]
for i=1,#matrix do
for j=1,#matrix[i] do
state=ScriptLib.GetGadgetStateByConfigId(context, defs.group_ID,matrix[i][j])
if state==202 or state==903 then
score=score+1
end
end
end
if score>= maxscore then
for i=1,#matrix do
for j=1,#matrix[i] do
if ScriptLib.GetGadgetStateByConfigId(context, defs.group_ID,matrix[i][j]) ~= 903 then
ScriptLib.SetGadgetStateByConfigId(context, matrix[i][j], 901)
end
end
end
ScriptLib.SetGroupVariableValue(context, "challenge_state", 2)
--ScriptLib.AddExtraGroupSuite(context, defs.group_ID, 3)
ScriptLib.GoToGroupSuite(context, defs.group_ID, 3)
ScriptLib.SetGroupVariableValue(context, "successed", 1)
end
return 0
end
--检测两个方块是否是相邻方块
function CheckTwoGadgetIsAdjacent(context,current_idx,config_two)
local x=math.floor(current_idx/10)
local y=current_idx%10
if matrix[x][y]==config_two then
return 0
end
if y>1 then
if matrix[x][y-1]==config_two then
ScriptLib.SetGroupVariableValue(context, "current_stone", x*10+y-1)
return 0
end
end
if y< #matrix[x] then
if matrix[x][y+1]==config_two then
ScriptLib.SetGroupVariableValue(context, "current_stone", x*10+y+1)
return 0
end
end
if x>1 then
if matrix[x-1][y]==config_two then
ScriptLib.SetGroupVariableValue(context, "current_stone", (x-1)*10+y)
return 0
end
end
if x < #matrix then
if matrix[x+1][y]==config_two then
ScriptLib.SetGroupVariableValue(context, "current_stone", (x+1)*10+y)
return 0
end
end
FaildProcess(context,"踩错")
return 0
end
LF_Initialize_Group(triggers, suites)

View File

@@ -0,0 +1,147 @@
--[[
雷导立方
ServerUploadTool Save to [/root/env/data/lua/common/BlackBoxPlay]
square={
[1]={config_id=115001,rotation=0},
[2]={config_id=115002,rotation=90},
[3]={config_id=115003,rotation=180},
[4]={config_id=115004,rotation=270},
[5]={config_id=115005,rotation=0},
}
]]--
local stateChain={
{101,102,103,104},
{201,202,203,204},
{301,302,303,304},
}
local extraTriggers={
--{ config_id = 8000001, name = "group_load", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0 },
--{ config_id = 8000002, name = "PLATFORM_REACH_POINT", event = EventType.EVENT_PLATFORM_REACH_POINT, source = "", condition = "", action = "action_EVENT_PLATFORM_REACH_POINT", trigger_count = 0 },
{ config_id = 8000003, name = "GADGET_CREATE", event = EventType.EVENT_GADGET_CREATE, source = "", condition = "", action = "action_gadget_create", trigger_count = 0 },
{ config_id = 8000004, name = "SELECT_OPTION", event = EventType.EVENT_SELECT_OPTION, source = "", condition = "", action = "action_EVENT_SELECT_OPTION", trigger_count = 0,forbid_guest = false },
{ config_id = 8000005, name = "Gadget_State_Change", event = EventType.EVENT_GADGET_STATE_CHANGE, source = "", condition = "", action = "action_GADGET_STATE_CHANGE", trigger_count = 0}
}
function LF_Initialize_Group(triggers, suites)
for i=1,#extraTriggers do
table.insert(triggers, extraTriggers[i])
table.insert(suites[init_config.suite].triggers,extraTriggers[i].name)
end
for i=1,#defs.repeater do
local time_trigger={ config_id = 8000000+defs.repeater[i], name = tostring(defs.repeater[i]), event = EventType.EVENT_TIMER_EVENT, source = tostring(defs.repeater[i]), condition = "", action = "action_Time_Event", trigger_count = 0}
table.insert(triggers, time_trigger)
table.insert(suites[1].triggers, time_trigger.name)
end
table.insert(variables, { config_id=50000001,name = "ShootTrigger", value = 0})
--初始化
end
function action_Time_Event(context,evt)
ScriptLib.PrintContextLog(context, "##反射装置TimeEvent"..defs.groupID.."|"..evt.source_name.."|"..evt.param3)
local temp_id=tonumber(evt.source_name)
ScriptLib.PrintContextLog(context, "temp_id##"..temp_id)
ScriptLib.SetWorktopOptionsByGroupId(context, defs.groupID, temp_id, {54,55})
return 0
end
function action_GADGET_STATE_CHANGE(context,evt)
for i=1,#defs.repeater do
if evt.param2==defs.repeater[i] then
if evt.param3==0 and evt.param1~=0 then
ScriptLib.CreateGroupTimerEvent(context, defs.groupID, tostring(evt.param2), 3)
end
return 0
end
end
return 0
end
function action_gadget_create(context, evt)
for i=1,#defs.repeater do
if evt.param1==defs.repeater[i] then
if ScriptLib.GetGadgetStateByConfigId(context, defs.groupID, evt.param1) ~= 0 then
ScriptLib.CreateGroupTimerEvent(context, defs.groupID, tostring(evt.param1), 3)
end
return 0
end
end
return 0
end
--54转向 55仰角
function action_EVENT_SELECT_OPTION(context, evt)
for i=1,#defs.repeater do
if evt.param1==defs.repeater[i] then
if evt.param2==54 then
ChangeGadgetState(context,evt.param1,54)
ScriptLib.DelWorktopOptionByGroupId(context, defs.groupID, evt.param1, 54)
ScriptLib.DelWorktopOptionByGroupId(context, defs.groupID, evt.param1, 55)
ScriptLib.CreateGroupTimerEvent(context, defs.groupID, tostring(evt.param1), 3)
elseif evt.param2==55 then
ChangeGadgetState(context,evt.param1,55)
ScriptLib.DelWorktopOptionByGroupId(context, defs.groupID, evt.param1, 54)
ScriptLib.DelWorktopOptionByGroupId(context, defs.groupID, evt.param1, 55)
ScriptLib.CreateGroupTimerEvent(context, defs.groupID, tostring(evt.param1), 3)
end
return 0
end
end
return 0
end
function ChangeGadgetState(context,config_id,option_id)
local stateID=ScriptLib.GetGadgetStateByConfigId(context, defs.groupID, config_id)
for i=1,#stateChain do
for j=1,#stateChain[i] do
if stateID==stateChain[i][j] then
if option_id==54 then
if j==#stateChain[i] then
ScriptLib.SetGroupGadgetStateByConfigId(context, defs.groupID, config_id, stateChain[i][1])
return 0
else
ScriptLib.SetGroupGadgetStateByConfigId(context, defs.groupID, config_id, stateChain[i][j+1])
return 0
end
end
if option_id==55 then
if i==#stateChain then
ScriptLib.SetGroupGadgetStateByConfigId(context, defs.groupID, config_id, stateChain[1][j])
return 0
else
ScriptLib.SetGroupGadgetStateByConfigId(context, defs.groupID, config_id, stateChain[i+1][j])
return 0
end
end
end
end
end
return 0
end
function CutSceneTrigger(context)
local variable=ScriptLib.GetGroupVariableValue(context, "ShootTrigger")
variable=variable+1
ScriptLib.SetGroupVariableValue(context, "ShootTrigger", variable)
return 0
end
function CheckOroSealDie(context)
if CheckSuccess02(context)==true then
for i=1,#gadgets do
if gadgets[i].gadget_id==70900385 or gadgets[i].gadget_id==70950143 then
ScriptLib.PrintContextLog(context, "找到摧毁物了"..gadgets[i].config_id)
ScriptLib.KillEntityByConfigId(context, { config_id = gadgets[i].config_id })
end
end
else
ScriptLib.PrintContextLog(context, "成功与否判断没过")
end
return 0
end
LF_Initialize_Group(triggers, suites)

View File

@@ -0,0 +1,130 @@
--[[
雷共鸣石黑河玩法
]]--
local light_stones_initial={
[1]=defs.gadget_1,
[2]=defs.gadget_2,
[3]=defs.gadget_3,
[4]=defs.gadget_4,
[5]=defs.gadget_5
}
local extraTriggers={
{ config_id = 8000001, name = "GROUP_LOAD", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0 },
}
function LF_Initialize_Group(triggers, suites)
for i=1,#extraTriggers do
table.insert(triggers, extraTriggers[i])
table.insert(suites[init_config.suite].triggers,extraTriggers[i].name)
end
table.insert(variables,{ config_id=50000001,name = "successed", value = 0, no_refresh = true})
--初始化
end
function action_group_load(context, evt)
if ScriptLib.GetGroupVariableValue(context,"successed")~=0 then
for i=1,#light_stones_initial do
if light_stones_initial[i] ~= 0 then
ScriptLib.SetGadgetStateByConfigId(context, light_stones_initial[i], GadgetState.GearAction2)
end
end
ScriptLib.AddExtraGroupSuite(context, defs.group_ID, 2)
return 0
end
return 0
end
function Generate_Table(light_stones_initial)
local outTable={}
for i=1,#light_stones_initial do
if light_stones_initial[i]~=0 then
table.insert(outTable,light_stones_initial[i])
end
end
return outTable
end
function Stone_Behit(context)
local light_stones=Generate_Table(light_stones_initial)
ScriptLib.PrintContextLog(context, "target_entity_id="..context.target_entity_id.." source_entity_id="..context.source_entity_id)
if ScriptLib.GetGroupVariableValue(context,"successed") ~=0 then
return 0
end
for i=1,#light_stones do
if context.target_entity_id==ScriptLib.GetEntityIdByConfigId(context,light_stones[i]) then
gadget_level_change(context,light_stones[i])
--非循环模式
if defs.loop_mode==0 then
if i-1>=1 then
gadget_level_change(context,light_stones[i-1])
end
if i+1 <= #light_stones then
gadget_level_change(context,light_stones[i+1])
end
end
--循环模式
if defs.loop_mode==1 then
if i-1<1 then
gadget_level_change(context,light_stones[#light_stones])
else
gadget_level_change(context,light_stones[i-1])
end
if i+1 > #light_stones then
gadget_level_change(context,light_stones[1])
else
gadget_level_change(context,light_stones[i+1])
end
end
break
end
end
if check_success(context,light_stones)==true then
for i=1,#light_stones do
if GadgetState.Action01 == ScriptLib.GetGadgetStateByConfigId(context, defs.group_ID, light_stones[i]) then
ScriptLib.SetGadgetStateByConfigId(context, light_stones[i], 9010)
elseif GadgetState.Action02 == ScriptLib.GetGadgetStateByConfigId(context, defs.group_ID, light_stones[i]) then
ScriptLib.SetGadgetStateByConfigId(context, light_stones[i], 9020)
elseif GadgetState.Action03 == ScriptLib.GetGadgetStateByConfigId(context, defs.group_ID, light_stones[i]) then
ScriptLib.SetGadgetStateByConfigId(context, light_stones[i], 9030)
end
end
ScriptLib.SetGroupVariableValue(context, "successed",1)
ScriptLib.AddExtraGroupSuite(context, defs.group_ID, 2)
end
return 0
end
--检测是否达成目标
function check_success(context,light_stones)
if #light_stones<=1 then
return true
end
for i=1,#light_stones-1 do
if ScriptLib.GetGadgetStateByConfigId(context, defs.group_ID, light_stones[i])~=ScriptLib.GetGadgetStateByConfigId(context, defs.group_ID, light_stones[i+1]) then
return false
end
end
return true
end
--处理共鸣石的状态变化
function gadget_level_change(context,config_id)
if config_id==nil then
return 0
end
ScriptLib.PrintContextLog(context, "##config_id is "..config_id)
if GadgetState.Default == ScriptLib.GetGadgetStateByConfigId(context, defs.group_ID, config_id) then
ScriptLib.SetGadgetStateByConfigId(context, config_id, GadgetState.Action01)
elseif GadgetState.Action01 == ScriptLib.GetGadgetStateByConfigId(context, defs.group_ID, config_id) then
ScriptLib.SetGadgetStateByConfigId(context, config_id, GadgetState.Action02)
elseif GadgetState.Action02 == ScriptLib.GetGadgetStateByConfigId(context, defs.group_ID, config_id) then
ScriptLib.SetGadgetStateByConfigId(context, config_id, GadgetState.Action03)
elseif GadgetState.Action03 == ScriptLib.GetGadgetStateByConfigId(context, defs.group_ID, config_id) then
ScriptLib.SetGadgetStateByConfigId(context, config_id, GadgetState.Action01)
end
return 0
end
LF_Initialize_Group(triggers, suites)

View File

@@ -0,0 +1,225 @@
--[[
雷导立方
square={
[1]={config_id=115001,rotation=0},
[2]={config_id=115002,rotation=90},
[3]={config_id=115003,rotation=180},
[4]={config_id=115004,rotation=270},
[5]={config_id=115005,rotation=0},
}
]]--
local square={
{config_id=defs.gadget_1,rotation=defs.rotation_1},
{config_id=defs.gadget_2,rotation=defs.rotation_2},
{config_id=defs.gadget_3,rotation=defs.rotation_3},
{config_id=defs.gadget_4,rotation=defs.rotation_4},
{config_id=defs.gadget_5,rotation=defs.rotation_5},
}
local connectRelation={
[defs.gadget_1]=defs.gadget_connect1,
[defs.gadget_2]=defs.gadget_connect2,
[defs.gadget_3]=defs.gadget_connect3,
[defs.gadget_4]=defs.gadget_connect4,
[defs.gadget_5]=defs.gadget_connect5,
}
local extraTriggers={
{ config_id = 8000001, name = "group_load", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0 },
{ config_id = 8000002, name = "PLATFORM_REACH_POINT", event = EventType.EVENT_PLATFORM_REACH_POINT, source = "", condition = "", action = "action_EVENT_PLATFORM_REACH_POINT", trigger_count = 0 },
}
function LF_Initialize_Group(triggers, suites)
for i=1,#extraTriggers do
table.insert(triggers, extraTriggers[i])
table.insert(suites[init_config.suite].triggers,extraTriggers[i].name)
end
table.insert(variables,{ config_id=50000001,name = "successed", value = 0, no_refresh = true})
for i=1,#square do
if square[i].config_id ~= 0 then
table.insert(variables,{ config_id=50000000+square[i].config_id,name = square[i].config_id.."isrotating", value = 0})
table.insert(variables,{ config_id=51000000+square[i].config_id,name = square[i].config_id.."rotation", value = square[i].rotation})
end
end
--初始化
end
function SquareBeHit(context)
if ScriptLib.GetGroupVariableValue(context,"successed")~=0 then
return 0
end
for i=1,#square do
if square[i].config_id ~= 0 then
if context.target_entity_id == ScriptLib.GetEntityIdByConfigId(context, square[i].config_id) or context.source_entity_id== ScriptLib.GetEntityIdByConfigId(context, square[i].config_id) then
if CheckAllRotationDone(context) then
--if ScriptLib.GetGroupVariableValue(context,square[i].config_id.."isrotating") ==0 then
--ScriptLib.SetGroupVariableValue(context, square[i].config_id.."isrotating", 1)
--ScriptLib.SetPlatformPointArray(context, square[i].config_id, 322000031, { 1 }, { route_type = 0,turn_mode=true })
--local angle=ScriptLib.GetGroupVariableValue(context,square[i].config_id.."rotation")
--angle=(angle+90)%360
--ScriptLib.SetGroupVariableValue(context, square[i].config_id.."rotation",angle)
RotateGadget(context,square[i].config_id)
for j=1,#connectRelation[square[i].config_id] do
RotateGadget(context,connectRelation[square[i].config_id][j])
end
end
end
end
end
return 0
end
function RotateGadget(context,config_id)
ScriptLib.SetGroupVariableValue(context, config_id.."isrotating", 1)
ScriptLib.SetPlatformPointArray(context, config_id, 322000031, { 1 }, { route_type = 0,turn_mode=true })
local angle=ScriptLib.GetGroupVariableValue(context,config_id.."rotation")
angle=(angle+90)%360
ScriptLib.SetGroupVariableValue(context, config_id.."rotation",angle)
ScriptLib.SetGadgetStateByConfigId(context, config_id, 201) -- gadget旋转过程特效
return 0
end
-- 底座物件表现
function RootGadgetEffect(context)
for i=1,#gadgets do
if ScriptLib.GetEntityIdByConfigId(context,gadgets[i].config_id) == 70330084 then
ScriptLib.SetGadgetStateByConfigId(context, gadgets[i].config_id, 201)
end
end
return 0
end
function CheckAllRotationDone(context)
for i=1,#square do
if ScriptLib.GetGroupVariableValue(context,square[i].config_id.."isrotating") ~=0 then
return false
end
end
return true
end
function action_EVENT_PLATFORM_REACH_POINT(context,evt)
ScriptLib.SetGroupVariableValue(context, evt.param1.."isrotating", 0)
CheckIsSuccess(context)
return 0
end
function action_group_load(context,evt)
if ScriptLib.GetGroupVariableValue(context,"successed")~=0 then
for i=1,#square do
if square[i].config_id ~= 0 then
ScriptLib.SetGadgetStateByConfigId(context, square[i].config_id, 901)
end
end
ScriptLib.AddExtraGroupSuite(context, defs.group_ID, 2)
return 0
end
--groupload重置variable
for i=1,#square do
if square[i].config_id ~= 0 then
ScriptLib.SetGroupVariableValue(context, square[i].config_id.."rotation", square[i].rotation)
ScriptLib.SetGroupVariableValue(context, square[i].config_id.."isrotating", 0)
end
end
for i=1,#square do
if square[i].config_id ~= 0 then
if square[i].rotation==90 then
ScriptLib.SetPlatformPointArray(context, square[i].config_id, 322000031, { 1 }, { route_type = 0,turn_mode=true })
ScriptLib.SetGroupVariableValue(context, square[i].config_id.."isrotating", 1)
end
if square[i].rotation==180 then
ScriptLib.SetPlatformPointArray(context, square[i].config_id, 322000031, { 2 }, { route_type = 0,turn_mode=true })
ScriptLib.SetGroupVariableValue(context, square[i].config_id.."isrotating", 1)
end
if square[i].rotation==270 then
ScriptLib.SetPlatformPointArray(context, square[i].config_id, 322000031, { 3 }, { route_type = 0,turn_mode=true })
ScriptLib.SetGroupVariableValue(context, square[i].config_id.."isrotating", 1)
end
end
end
return 0
end
function CheckIsSuccess(context)
local table0={}
local table90={}
local table180={}
local table270={}
local angle=999
local exitCount=0
for i=1,#square do
if square[i].config_id ~= 0 then
exitCount=exitCount+1
angle=ScriptLib.GetGroupVariableValue(context,square[i].config_id.."rotation")
if angle==0 then
table.insert(table0,square[i].config_id)
elseif angle==90 then
table.insert(table90,square[i].config_id)
elseif angle==180 then
table.insert(table180,square[i].config_id)
elseif angle==270 then
table.insert(table270,square[i].config_id)
end
end
end
if #table0>=exitCount or #table90>=exitCount or #table180>=exitCount or #table270>=exitCount then
for i=1,#square do
if square[i].config_id ~= 0 then
ScriptLib.SetGadgetStateByConfigId(context, square[i].config_id, 901)
end
end
ScriptLib.SetGroupVariableValue(context, "successed", 1)
ScriptLib.AddExtraGroupSuite(context, defs.group_ID, 2)
RootGadgetEffect(context)
return 0
end
if #table0>1 then
for i=1,#table0 do
ScriptLib.SetGadgetStateByConfigId(context, table0[i], 902)
end
else
for i=1,#table0 do
ScriptLib.SetGadgetStateByConfigId(context, table0[i], 0)
end
end
if #table90>1 then
for i=1,#table90 do
ScriptLib.SetGadgetStateByConfigId(context, table90[i], 902)
end
else
for i=1,#table90 do
ScriptLib.SetGadgetStateByConfigId(context, table90[i], 0)
end
end
if #table180>1 then
for i=1,#table180 do
ScriptLib.SetGadgetStateByConfigId(context, table180[i], 902)
end
else
for i=1,#table180 do
ScriptLib.SetGadgetStateByConfigId(context, table180[i], 0)
end
end
if #table270>1 then
for i=1,#table270 do
ScriptLib.SetGadgetStateByConfigId(context, table270[i], 902)
end
else
for i=1,#table270 do
ScriptLib.SetGadgetStateByConfigId(context, table270[i], 0)
end
end
return 0
end
--local square=InitialData()
LF_Initialize_Group(triggers, suites)

View File

@@ -0,0 +1,225 @@
--[[
雷导立方
square={
[1]={config_id=115001,rotation=0},
[2]={config_id=115002,rotation=90},
[3]={config_id=115003,rotation=180},
[4]={config_id=115004,rotation=270},
[5]={config_id=115005,rotation=0},
}
]]--
local square={
{config_id=defs.gadget_1,rotation=defs.rotation_1},
{config_id=defs.gadget_2,rotation=defs.rotation_2},
{config_id=defs.gadget_3,rotation=defs.rotation_3},
{config_id=defs.gadget_4,rotation=defs.rotation_4},
{config_id=defs.gadget_5,rotation=defs.rotation_5},
}
local connectRelation={
[defs.gadget_1]=defs.gadget_connect1,
[defs.gadget_2]=defs.gadget_connect2,
[defs.gadget_3]=defs.gadget_connect3,
[defs.gadget_4]=defs.gadget_connect4,
[defs.gadget_5]=defs.gadget_connect5,
}
local extraTriggers={
{ config_id = 8000001, name = "group_load", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0 },
{ config_id = 8000002, name = "PLATFORM_REACH_POINT", event = EventType.EVENT_PLATFORM_REACH_POINT, source = "", condition = "", action = "action_EVENT_PLATFORM_REACH_POINT", trigger_count = 0 },
{ config_id = 8000003, name = "GADGET_CREATE", event = EventType.EVENT_GADGET_CREATE, source = "", condition = "", action = "action_EVENT_GADGET_CREATE", trigger_count = 0 },
}
function LF_Initialize_Group(triggers, suites)
for i=1,#extraTriggers do
table.insert(triggers, extraTriggers[i])
table.insert(suites[init_config.suite].triggers,extraTriggers[i].name)
end
table.insert(variables,{ config_id=50000001,name = "successed", value = 0, no_refresh = true})
for i=1,#square do
if square[i].config_id ~= 0 then
table.insert(variables,{ config_id=50000000+square[i].config_id,name = square[i].config_id.."isrotating", value = 0})
table.insert(variables,{ config_id=51000000+square[i].config_id,name = square[i].config_id.."rotation", value = square[i].rotation})
end
end
--初始化
end
function SquareBeHit(context)
if ScriptLib.GetGroupVariableValue(context,"successed")~=0 then
return 0
end
for i=1,#square do
if square[i].config_id ~= 0 then
if context.target_entity_id == ScriptLib.GetEntityIdByConfigId(context, square[i].config_id) or context.source_entity_id== ScriptLib.GetEntityIdByConfigId(context, square[i].config_id) then
if CheckAllRotationDone(context) then
RotateGadget(context,square[i].config_id)
for j=1,#connectRelation[square[i].config_id] do
RotateGadget(context,connectRelation[square[i].config_id][j])
end
end
end
end
end
return 0
end
function RotateGadget(context,config_id)
ScriptLib.SetGroupVariableValue(context, config_id.."isrotating", 1)
ScriptLib.SetPlatformPointArray(context, config_id, 322000031, { 1 }, { route_type = 0,turn_mode=true })
local angle=ScriptLib.GetGroupVariableValue(context,config_id.."rotation")
angle=(angle+90)%360
ScriptLib.SetGroupVariableValue(context, config_id.."rotation",angle)
ScriptLib.SetGadgetStateByConfigId(context, config_id, 201) -- gadget旋转过程特效
return 0
end
-- 底座物件表现
function RootGadgetEffect(context)
for i=1,#gadgets do
if ScriptLib.GetEntityIdByConfigId(context,gadgets[i].config_id) == 70330084 then
ScriptLib.SetGadgetStateByConfigId(context, gadgets[i].config_id, 201)
end
end
return 0
end
function CheckAllRotationDone(context)
for i=1,#square do
if ScriptLib.GetGroupVariableValue(context,square[i].config_id.."isrotating") ~=0 then
return false
end
end
return true
end
function action_EVENT_PLATFORM_REACH_POINT(context,evt)
ScriptLib.SetGroupVariableValue(context, evt.param1.."isrotating", 0)
CheckIsSuccess(context)
return 0
end
function action_group_load(context,evt)
if ScriptLib.GetGroupVariableValue(context,"successed")~=0 then
for i=1,#square do
if square[i].config_id ~= 0 then
ScriptLib.SetGadgetStateByConfigId(context, square[i].config_id, 901)
end
end
ScriptLib.AddExtraGroupSuite(context, defs.group_ID, 2)
return 0
end
--groupload重置variable
for i=1,#square do
if square[i].config_id ~= 0 then
ScriptLib.SetGroupVariableValue(context, square[i].config_id.."rotation", square[i].rotation)
ScriptLib.SetGroupVariableValue(context, square[i].config_id.."isrotating", 0)
end
end
return 0
end
function action_EVENT_GADGET_CREATE(context,evt)
for i=1,#square do
if square[i].config_id==evt.param1 then
ScriptLib.SetGroupVariableValue(context, square[i].config_id.."isrotating", 0)
if square[i].rotation==90 then
ScriptLib.SetPlatformPointArray(context, square[i].config_id, 322000031, { 1 }, { route_type = 0,turn_mode=true })
ScriptLib.SetGroupVariableValue(context, square[i].config_id.."isrotating", 1)
end
if square[i].rotation==180 then
ScriptLib.SetPlatformPointArray(context, square[i].config_id, 322000031, { 2 }, { route_type = 0,turn_mode=true })
ScriptLib.SetGroupVariableValue(context, square[i].config_id.."isrotating", 1)
end
if square[i].rotation==270 then
ScriptLib.SetPlatformPointArray(context, square[i].config_id, 322000031, { 3 }, { route_type = 0,turn_mode=true })
ScriptLib.SetGroupVariableValue(context, square[i].config_id.."isrotating", 1)
end
end
end
return 0
end
function CheckIsSuccess(context)
local table0={}
local table90={}
local table180={}
local table270={}
local angle=999
local exitCount=0
for i=1,#square do
if square[i].config_id ~= 0 then
exitCount=exitCount+1
angle=ScriptLib.GetGroupVariableValue(context,square[i].config_id.."rotation")
if angle==0 then
table.insert(table0,square[i].config_id)
elseif angle==90 then
table.insert(table90,square[i].config_id)
elseif angle==180 then
table.insert(table180,square[i].config_id)
elseif angle==270 then
table.insert(table270,square[i].config_id)
end
end
end
if #table0>=exitCount or #table90>=exitCount or #table180>=exitCount or #table270>=exitCount then
for i=1,#square do
if square[i].config_id ~= 0 then
ScriptLib.SetGadgetStateByConfigId(context, square[i].config_id, 901)
end
end
ScriptLib.SetGroupVariableValue(context, "successed", 1)
ScriptLib.AddExtraGroupSuite(context, defs.group_ID, 2)
RootGadgetEffect(context)
return 0
end
if #table0>1 then
for i=1,#table0 do
ScriptLib.SetGadgetStateByConfigId(context, table0[i], 902)
end
else
for i=1,#table0 do
ScriptLib.SetGadgetStateByConfigId(context, table0[i], 0)
end
end
if #table90>1 then
for i=1,#table90 do
ScriptLib.SetGadgetStateByConfigId(context, table90[i], 902)
end
else
for i=1,#table90 do
ScriptLib.SetGadgetStateByConfigId(context, table90[i], 0)
end
end
if #table180>1 then
for i=1,#table180 do
ScriptLib.SetGadgetStateByConfigId(context, table180[i], 902)
end
else
for i=1,#table180 do
ScriptLib.SetGadgetStateByConfigId(context, table180[i], 0)
end
end
if #table270>1 then
for i=1,#table270 do
ScriptLib.SetGadgetStateByConfigId(context, table270[i], 902)
end
else
for i=1,#table270 do
ScriptLib.SetGadgetStateByConfigId(context, table270[i], 0)
end
end
return 0
end
--local square=InitialData()
LF_Initialize_Group(triggers, suites)

View File

@@ -0,0 +1,108 @@
--[[
磁力机关 黑盒
ServerUploadTool Save to [/root/env/data/lua/common/BlackBoxPlay]
]]--
local fundations={
[1]=defs.gadget_fundation01,
[2]=defs.gadget_fundation02,
[3]=defs.gadget_fundation03,
[4]=defs.gadget_fundation04,
[5]=defs.gadget_fundation05,
}
local hands={
[1]=defs.gadget_hand01,
[2]=defs.gadget_hand02,
[3]=defs.gadget_hand03,
[4]=defs.gadget_hand04,
[5]=defs.gadget_hand05,
}
local extraTriggers={
{ config_id = 8000001, name = "GROUP_LOAD", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_group_load", trigger_count = 0 },
{ config_id = 8000002, name = "TIME_AXIS", event = EventType.EVENT_TIME_AXIS_PASS, source = "checkSuccess", condition = "", action = "action_time_axis_pass", trigger_count = 0 },
}
function LF_Initialize_Group(triggers, suites)
for i=1,#extraTriggers do
table.insert(triggers, extraTriggers[i])
table.insert(suites[init_config.suite].triggers,extraTriggers[i].name)
end
table.insert(variables,{ config_id=50000001,name = "successed", value = 0, no_refresh = true})
--初始化
end
function NormalizationAngles(input)
local output=input
return math.abs(180-(180-output)%360)
end
function action_group_load(context, evt)
if ScriptLib.GetGroupVariableValue(context, "successed")~=1 then
ScriptLib.InitTimeAxis(context, "checkSuccess", {1}, true)
return 0
end
ScriptLib.AddExtraGroupSuite(context, defs.group_ID, 2)
--ScriptLib.PrintContextLog(context, "挑战已经完成")
local pos={}
local rot={}
for i=1,5 do
if hands[i] ~= 0 then
ScriptLib.RemoveEntityByConfigId(context, defs.group_ID, EntityType.GADGET, hands[i])
for j=1,#gadgets do
if gadgets[j].config_id==hands[i] then
pos=gadgets[j].pos
end
if gadgets[j].config_id==fundations[i] then
rot=gadgets[j].rot
end
end
--ScriptLib.PrintContextLog(context, "位置"..pos.x.." "..pos.y.." "..pos.z.." "..rot.x.." "..rot.y.." "..rot.z)
ScriptLib.CreateGadgetByConfigIdByPos(context, hands[i], pos, rot)
ScriptLib.SetGadgetStateByConfigId(context, hands[i], 201)
ScriptLib.SetGadgetStateByConfigId(context, fundations[i], 201)
end
end
return 0
end
function action_time_axis_pass(context, evt)
local count=0
local y1=0
local y2=0
for i=1,5 do
if fundations[i]~=0 then
y1=ScriptLib.GetRotationByEntityId(context, ScriptLib.GetEntityIdByConfigId(context, fundations[i])).y
y2=ScriptLib.GetRotationByEntityId(context, ScriptLib.GetEntityIdByConfigId(context, hands[i])).y
if y1<0 or y1>360 or y2<0 or y2>360 then
return 0
end
end
if fundations[i]==0 then
count=count+1
elseif NormalizationAngles(y1-y2) <= defs.minDiscrapancy then
count=count+1
ScriptLib.SetGadgetStateByConfigId(context, fundations[i], 201)
else
ScriptLib.SetGadgetStateByConfigId(context, fundations[i], 0)
end
end
--ScriptLib.PrintContextLog(context, "count is "..count)
if count>=5 then
ScriptLib.AddExtraGroupSuite(context, defs.group_ID, 2)
for i=1,5 do
if hands[i] ~= 0 then
ScriptLib.SetGadgetStateByConfigId(context, hands[i], 201)
end
end
ScriptLib.PauseTimeAxis(context, "checkSuccess")
ScriptLib.SetGroupVariableValue(context, "successed", 1)
end
return 0
end
LF_Initialize_Group(triggers, suites)

View File

@@ -0,0 +1,394 @@
--[[
对位传送门 黑盒
]]--
local extraTriggers={
{ config_id = 1154013, name = "GROUP_LOAD_154013", event = EventType.EVENT_GROUP_LOAD, source = "", condition = "", action = "action_EVENT_GROUP_LOAD_154013", trigger_count = 0 },
{ config_id = 1154014, name = "SELECT_OPTION_154014", event = EventType.EVENT_SELECT_OPTION, source = "", condition = "condition_EVENT_SELECT_OPTION_154014", action = "action_EVENT_SELECT_OPTION_154014", trigger_count = 0 },
{ config_id = 1154015, name = "PLATFORM_REACH_POINT_154015", event = EventType.EVENT_PLATFORM_REACH_POINT, source = "", condition = "condition_EVENT_PLATFORM_REACH_POINT_154015", action = "action_EVENT_PLATFORM_REACH_POINT_154015", trigger_count = 0 },
{ config_id = 1154016, name = "TIME_AXIS_PASS_15016", event = EventType.EVENT_TIME_AXIS_PASS, source = "InitialEnding", condition = "", action = "action_EVENT_TIME_AXIS_PASS_15016", trigger_count = 0 }
}
local extralVariables={
{ config_id=50000001,name = "gadget_Teleport_1_isActive", value = 0, no_refresh = true },
{ config_id=50000002,name = "gadget_Teleport_2_isActive", value = 0, no_refresh = true },
{ config_id=50000003,name = "gadget_Teleport_3_isActive", value = 0, no_refresh = true },
{ config_id=50000004,name = "gadget_Teleport_4_isActive", value = 0, no_refresh = true },
{ config_id=50000005,name = "gadget_Teleport_1_state", value = 0, no_refresh = true },
{ config_id=50000006,name = "gadget_Teleport_2_state", value = 0, no_refresh = true },
{ config_id=50000007,name = "gadget_Teleport_3_state", value = 0, no_refresh = true },
{ config_id=50000008,name = "gadget_Teleport_4_state", value = 0, no_refresh = true },
{ config_id=50000009,name = "isInitial", value = 1, no_refresh = false }
}
function LF_Initialize_Group(triggers,suites,variables)
for i=1,#extraTriggers do
table.insert(triggers, extraTriggers[i])
table.insert(suites[init_config.suite].triggers,extraTriggers[i].name)
end
for i=1,#extralVariables do
table.insert(variables, extralVariables[i])
end
--初始化
end
----Misc----
TeleportOwnerShip =
{
{defs.gadget_TeleportOperator_1, defs.gadget_Teleport_1},
{defs.gadget_TeleportOperator_2, defs.gadget_Teleport_2},
{defs.gadget_TeleportOperator_3, defs.gadget_Teleport_3},
{defs.gadget_TeleportOperator_4, defs.gadget_Teleport_4}
}
staticForwardSet = {1,2,3,4,5,6,7,8,9,10}
staticBackwardSet = {10,9,8,7,6,5,4,3,2,1}
function GetTeleportNameByConfigID(context, config_id)
for k,v in pairs(defs) do
if v == config_id then
return k
end
end
end
function InitialTeleportRotationY(context)
local rot
local name
local localtarget
ScriptLib.PrintLog("Initial starting...")
ScriptLib.SetGroupVariableValue(context,"isInitial",1)
for i=1,4 do
localtarget = TeleportOwnerShip[i][2]
if isTeleportValid(context,localtarget)==true then
ScriptLib.PrintLog("Initial localtarget = "..localtarget)
if localtarget ~= 0 then
name = GetTeleportNameByConfigID(context,localtarget).."_state"
rot = ScriptLib.GetGroupVariableValue(context,name)
ScriptLib.PrintLog("Initial gadgetName = "..name .. " , Rot = "..rot)
if rot == 90 then
ScriptLib.SetPlatformPointArray(context, localtarget, defs.pointarray_Rotate, { 1 }, { route_type = 0,turn_mode=true })
elseif rot == 180 then
ScriptLib.SetPlatformPointArray(context, localtarget, defs.pointarray_Rotate, { 2 }, { route_type = 0,turn_mode=true })
elseif rot == 270 then
ScriptLib.SetPlatformPointArray(context, localtarget, defs.pointarray_Rotate, { 3 }, { route_type = 0,turn_mode=true })
end
end
end
end
ScriptLib.PrintLog("Initial ending...")
end
function InitialTeleportState(context)
local tempname
local localtarget
for i=1,4 do
tempname = "gadget_Teleport_"..i.."_isActive"
localtarget = TeleportOwnerShip[i][2]
if isTeleportValid(context,localtarget)==true then
if ScriptLib.GetGroupVariableValue(context,tempname) == 1 then
ScriptLib.SetGadgetStateByConfigId(context, TeleportOwnerShip[i][2], GadgetState.GearStart)
else
ScriptLib.SetGadgetStateByConfigId(context, TeleportOwnerShip[i][2], GadgetState.Default)
end
end
end
end
function isTeleportValid(context,teleportID)
local result = false
local state = ScriptLib.GetGadgetStateByConfigId(context, defs.group_ID, teleportID)
if state ~= -1 then
result = true
end
--[[ local suiteindex = ScriptLib.GetGroupSuite(context, defs.group_ID)
for i=1, #suites[suiteindex].gadgets do
if teleportID == suites[suiteindex].gadgets[i] then
result = true
return result
end
end ]]
return result
end
function CheckIsConnected(context,teleport_aID,teleport_bID)
if not (isTeleportValid(context,teleport_aID)) or not (isTeleportValid(context,teleport_bID)) then
return false
end
--获取角度
ScriptLib.PrintLog("CheckConnected from "..teleport_aID .. " to "..teleport_bID)
local yrotation_a = ScriptLib.GetRotationByEntityId(context, ScriptLib.GetEntityIdByConfigId(context,teleport_aID)).y
local yrotation_b = ScriptLib.GetRotationByEntityId(context, ScriptLib.GetEntityIdByConfigId(context,teleport_bID)).y
ScriptLib.PrintLog("yrotation_a = "..yrotation_a .. "| yrotation_a = "..yrotation_b)
--转换为弧度
local yrad_a = math.rad(yrotation_a)
local yrad_b = math.rad(yrotation_b)
ScriptLib.PrintLog("yrad_a = "..yrad_a .. "| yrad_b = "..yrad_b)
--编辑器中的XZ和运行下的对应关系是反的,所以这里XZ左边调换了一下
local dir_a = {x = math.sin(yrad_a), y = 0, z = math.cos(yrad_a)}
local dir_b = {x = math.sin(yrad_b), y = 0, z = math.cos(yrad_b)}
ScriptLib.PrintLog("dir_a : x = "..dir_a.x.." , y = "..dir_a.y.." , z = "..dir_a.z)
ScriptLib.PrintLog("dir_b : x = "..dir_b.x.." , y = "..dir_b.y.." , z = "..dir_b.z)
--获取两个点位置
local pos_a = ScriptLib.GetPosByEntityId(context, ScriptLib.GetEntityIdByConfigId(context,teleport_aID))
ScriptLib.PrintLog("pos_a : x = "..pos_a.x.." , y = "..pos_a.y.." , z = "..pos_a.z)
local pos_b = ScriptLib.GetPosByEntityId(context, ScriptLib.GetEntityIdByConfigId(context,teleport_bID))
ScriptLib.PrintLog("pos_b : x = "..pos_b.x.." , y = "..pos_b.y.." , z = "..pos_b.z)
--计算两个点之间的方向,并且Normalize
local diratob = {x = pos_b.x - pos_a.x,y = 0,z = pos_b.z - pos_a.z}
local norDirAtoB = Normalize({x = pos_b.x - pos_a.x,y = 0,z = pos_b.z - pos_a.z})
ScriptLib.PrintLog("norDirAtoB : x = "..norDirAtoB.x.." , y = "..norDirAtoB.y.." , z = "..norDirAtoB.z)
local dirbtoa = {x = pos_a.x - pos_b.x,y = 0,z = pos_a.z - pos_b.z}
local norDirBtoA = Normalize({x = pos_a.x - pos_b.x,y = 0,z = pos_a.z - pos_b.z})
ScriptLib.PrintLog("norDirBtoA : x = "..norDirBtoA.x.." , y = "..norDirBtoA.y.." , z = "..norDirBtoA.z)
--计算两个点的点乘结果
local dotvalue_a = dir_a.x * norDirAtoB.x + dir_a.y * norDirAtoB.y + dir_a.z * norDirAtoB.z
local dotvalue_b = dir_b.x * norDirBtoA.x + dir_b.y * norDirBtoA.y + dir_b.z * norDirBtoA.z
ScriptLib.PrintLog("dotvalue_a "..dotvalue_a)
ScriptLib.PrintLog("dotvalue_b "..dotvalue_b)
--判断点乘结果是否大于0.5,也就是正负 45度范围
if dotvalue_a >= 0.5 and dotvalue_b >= 0.5 then
return true
end
ScriptLib.PrintLog("invalid cos = ".. dotvalue_a)
return false
end
--获取所有关联的传送点
function FindRelatedTargets(context,teleport_ID)
local relatedtarget ={}
for i=1,#connectInfo do
if connectInfo[i][1] == teleport_ID or connectInfo[i][2] == teleport_ID then
if connectInfo[i][1] == teleport_ID then
--链接的Gadget ID, 对应的点阵ID, 点阵的indexArray, 速度
table.insert(relatedtarget,{connectInfo[i][2],connectInfo[i][3],staticForwardSet,connectInfo[i][4]})
elseif connectInfo[i][2] == teleport_ID then
table.insert(relatedtarget,{connectInfo[i][1],connectInfo[i][3],staticBackwardSet,connectInfo[i][4]})
end
end
end
return relatedtarget
end
--在所有关联传送点中找到激活链接的,如果没有则返回nil
function GetConnectedTeleport(context,teleport_id)
local related
related = FindRelatedTargets(context,teleport_id)
for i=1,#related do
if CheckIsConnected(context,teleport_id,related[i][1]) == true then
return related[i]
end
end
return nil
end
--数学计算归一化
function Normalize(vet)
local magnitude = math.sqrt(vet.x * vet.x + vet.y * vet.y + vet.z * vet.z)
local newvect = {x = vet.x/magnitude, y = vet.y / magnitude, z = vet.z / magnitude}
return newvect
end
--更新所有传送门的状态表现
function UpdateTeleportState(context)
local teleportname
for i=1,4 do
local connect = GetConnectedTeleport(context,TeleportOwnerShip[i][2])
if connect == nil then
ScriptLib.SetGadgetStateByConfigId(context, TeleportOwnerShip[i][2], GadgetState.Default)
teleportname = GetTeleportNameByConfigID(context, TeleportOwnerShip[i][2])
teleportname = teleportname.."_isActive"
ScriptLib.SetGroupVariableValue(context, teleportname, 0)
ScriptLib.PrintLog("connect nothing : "..i)
else
--ScriptLib.PrintLog("connect count = "..#connect)
--ScriptLib.PrintLog("connect{"..connect[1].." , "..connect[2].." , "..connect[3].."}")
ScriptLib.SetGadgetStateByConfigId(context, TeleportOwnerShip[i][2], GadgetState.GearStart)
teleportname = GetTeleportNameByConfigID(context, TeleportOwnerShip[i][2])
teleportname = teleportname.."_isActive"
ScriptLib.SetGroupVariableValue(context, teleportname, 1)
ScriptLib.PrintLog("connect something = "..i)
end
end
end
--传送玩家, 只要给到对应的Teleportid就可以
function TeleportAction(context,teleport_id)
local related = FindRelatedTargets(context, teleport_id)
for i=1,#related do
if CheckIsConnected(context,teleport_id,related[i][1]) == true then
ScriptLib.MoveAvatarByPointArray(context, context.uid, related[i][2], related[i][3], {speed=related[i][4]}, "{\"MarkType\":1}")
return 0
end
end
end
----ActionFunction---
function action_EVENT_GROUP_LOAD_154013(context, evt)
InitialTeleportRotationY(context)
InitialTeleportState(context)
ScriptLib.InitTimeAxis(context, "InitialEnding", {1}, false)
return 0
end
function action_EVENT_TIME_AXIS_PASS_15016(context, evt)
UpdateTeleportState(context)
if defs.gadget_TeleportOperator_1 ~= 0 then
ScriptLib.SetWorktopOptionsByGroupId(context, defs.group_ID, defs.gadget_TeleportOperator_1, {31})
end
if defs.gadget_TeleportOperator_2 ~= 0 then
ScriptLib.SetWorktopOptionsByGroupId(context, defs.group_ID, defs.gadget_TeleportOperator_2, {31})
end
if defs.gadget_TeleportOperator_3 ~= 0 then
ScriptLib.SetWorktopOptionsByGroupId(context, defs.group_ID, defs.gadget_TeleportOperator_3, {31})
end
if defs.gadget_TeleportOperator_4 ~= 0 then
ScriptLib.SetWorktopOptionsByGroupId(context, defs.group_ID, defs.gadget_TeleportOperator_4, {31})
end
return 0
end
function condition_EVENT_SELECT_OPTION_154014(context, evt)
-- 判断是gadgetid 124006 option_id 31
if defs.gadget_TeleportOperator_1 ~= evt.param1 and
defs.gadget_TeleportOperator_2 ~= evt.param1 and
defs.gadget_TeleportOperator_3 ~= evt.param1 and
defs.gadget_TeleportOperator_4 ~= evt.param1 then
return false
end
if 31 ~= evt.param2 then
return false
end
return true
end
-- 触发操作
function action_EVENT_SELECT_OPTION_154014(context, evt)
local localtarget
local localoption
for i=1,4 do
if TeleportOwnerShip[i][1] == evt.param1 then
localtarget = TeleportOwnerShip[i][2]
localoption = TeleportOwnerShip[i][1]
end
end
--旋转时取消所有的Option
if defs.gadget_TeleportOperator_1 ~= 0 then
ScriptLib.DelWorktopOptionByGroupId(context, defs.group_ID, defs.gadget_TeleportOperator_1, 31)
end
if defs.gadget_TeleportOperator_2 ~= 0 then
ScriptLib.DelWorktopOptionByGroupId(context, defs.group_ID, defs.gadget_TeleportOperator_2, 31)
end
if defs.gadget_TeleportOperator_3 ~= 0 then
ScriptLib.DelWorktopOptionByGroupId(context, defs.group_ID, defs.gadget_TeleportOperator_3, 31)
end
if defs.gadget_TeleportOperator_4 ~= 0 then
ScriptLib.DelWorktopOptionByGroupId(context, defs.group_ID, defs.gadget_TeleportOperator_4, 31)
end
ScriptLib.SetGroupVariableValue(context,"isInitial",0)
ScriptLib.PrintLog("evt.gadgetid = "..evt.param1)
ScriptLib.PrintLog("localtarget = "..localtarget)
ScriptLib.SetPlatformPointArray(context, localtarget, defs.pointarray_Rotate, { 1 }, { route_type = 0,turn_mode=true })
ScriptLib.MarkPlayerAction(context, 7004, 3, 1)
return 0
end
function condition_EVENT_PLATFORM_REACH_POINT_154015(context, evt)
-- 判断是gadgetid 124006 option_id 31
ScriptLib.PrintLog("Reachpoint_condition : "..evt.param1)
if defs.gadget_Teleport_1 ~= evt.param1 and
defs.gadget_Teleport_2 ~= evt.param1 and
defs.gadget_Teleport_3 ~= evt.param1 and
defs.gadget_Teleport_4 ~= evt.param1 then
return false
end
if ScriptLib.GetGroupVariableValue(context,"isInitial") ~= 0 then
return false
end
return true
end
-- 触发操作
function action_EVENT_PLATFORM_REACH_POINT_154015(context, evt)
-- 判断是gadgetid 124006 option_id 31
ScriptLib.PrintLog("Reachpoint_action : "..evt.param1)
--旋转完成后再重新加回所有的Option
if defs.gadget_TeleportOperator_1 ~= 0 then
ScriptLib.SetWorktopOptionsByGroupId(context, defs.group_ID, defs.gadget_TeleportOperator_1, {31})
end
if defs.gadget_TeleportOperator_2 ~= 0 then
ScriptLib.SetWorktopOptionsByGroupId(context, defs.group_ID, defs.gadget_TeleportOperator_2, {31})
end
if defs.gadget_TeleportOperator_3 ~= 0 then
ScriptLib.SetWorktopOptionsByGroupId(context, defs.group_ID, defs.gadget_TeleportOperator_3, {31})
end
if defs.gadget_TeleportOperator_4 ~= 0 then
ScriptLib.SetWorktopOptionsByGroupId(context, defs.group_ID, defs.gadget_TeleportOperator_4, {31})
end
UpdateTeleportState(context)
-- set teleprot rotation and save to group variable
local name = GetTeleportNameByConfigID(context,evt.param1).."_state"
ScriptLib.PrintLog("gadgetname = "..name)
local prerot = ScriptLib.GetGroupVariableValue(context,name)
ScriptLib.PrintLog("prerot = ".. prerot)
prerot = prerot + defs.rotStep
if prerot >= 360 then
prerot = 0
end
ScriptLib.PrintLog("prerot ++ = ".. prerot)
ScriptLib.SetGroupVariableValue(context,name,prerot)
return 0
end
LF_Initialize_Group(triggers, suites, variables)