-- Named groups selected from a completed floor-name capture, two per heartbeat. -- This only reads configuration; graph paths are serialized, never executed. do local input=__ENTRANCE_ROW__ local targets=__GROUP_IDS__ local function log(v)CS.UnityEngine.Debug.Log('[GAC_CW_NAMED_GROUPS] '..tostring(v))end _G.__gacCwNamedGroups3=_G.__gacCwNamedGroups3 or {index=1} local state=_G.__gacCwNamedGroups3 if not state.done then local ok,err=pcall(function() if not state.floor then state.floor=CS.RPG.GameCore.GameCoreConfigLoader.LoadRtLevelFloorInfo(CS.RPG.Client.MapDef.GetRtFloorInfoPath(input.PlaneID,input.FloorID)) log('BEGIN '..#targets) for i=0,math.min(state.floor.DimensionList.Length-1,3)do log('SAVED '..CS.Newtonsoft.Json.JsonConvert.SerializeObject(state.floor.DimensionList[i].SavedValues)) end end for j=state.index,math.min(state.index+1,#targets)do local found=false for i=0,state.floor.GroupInstanceList.Length-1 do local g=state.floor.GroupInstanceList[i] if g.ID==targets[j] then found=true local r=CS.RPG.GameCore.GameCoreConfigLoader.LoadRtLevelGroupInfo(g.GroupPath) local function json(v)return CS.Newtonsoft.Json.JsonConvert.SerializeObject(v)end local props={} if r.PropList then for k=0,r.PropList.Length-1 do local p=r.PropList[k] local yaw=g.RotY*math.pi/180 local pos=string.format('{"x":%d,"y":%d,"z":%d}',math.floor((g.PosX+p.PosX*math.cos(yaw)+p.PosZ*math.sin(yaw))*1000+0.5),math.floor((g.PosY+p.PosY)*1000+0.5),math.floor((g.PosZ-p.PosX*math.sin(yaw)+p.PosZ*math.cos(yaw))*1000+0.5)) local rot=string.format('{"x":0,"y":%d,"z":0}',math.floor((g.RotY+p.RotY)*1000+0.5)) props[#props+1]='{"id":'..p.ID..',"prop_id":'..p.PropID..',"state":'..CS.System.Convert.ToUInt32(p.State)..',"pos":'..pos..',"rot":'..rot..',"deleted":'..tostring(p.IsDelete)..',"client_only":'..tostring(p.IsClientOnly)..',"initial":'..tostring(p.LoadOnInitial)..',"state_configs":'..json(p.StateConfigs)..',"value_source":'..json(p.ValueSource)..',"init_graph":'..json(p.InitLevelGraph)..'}' end end log('GROUP '..g.ID..' {"name":'..json(r.GroupName)..',"initial":'..tostring(r.LoadOnInitial)..',"load_condition":'..json(r.LoadCondition)..',"unload_condition":'..json(r.UnloadCondition)..',"saved_value_condition":'..json(r.SavedValueCondition)..',"system_unlock_condition":'..json(r.SystemUnlockCondition)..',"properties":'..json(r.GroupPropertyMap)..',"graph":'..json(r.LevelGraph)..',"tags":'..json(r.TagContainer)..',"props":['..table.concat(props,',')..']}') break end end if not found then error('Named group missing: '..targets[j])end end state.index=state.index+2 if state.index>#targets then state.done=true;log('END')end end) if not ok then state.done=true;log('ERROR '..tostring(err))end end end