LobbyNpc: 거리 폴링→머리위 마크 토글, TouchEvent/UpArrow→Interact→컨트롤러 OnLobbyNpcInteract. LobbyMobility: 진입 시 pc.Enable·WalkAcceleration=0.7 복원(정찰 확정). 공격 키는 컨트롤러에서 처리. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
90 lines
3.0 KiB
Plaintext
90 lines
3.0 KiB
Plaintext
{
|
|
"Id": "",
|
|
"GameId": "",
|
|
"EntryKey": "codeblock://lobbynpc",
|
|
"ContentType": "x-mod/codeblock",
|
|
"Content": "",
|
|
"Usage": 0,
|
|
"UsePublish": 1,
|
|
"UseService": 0,
|
|
"CoreVersion": "26.5.0.0",
|
|
"StudioVersion": "",
|
|
"DynamicLoading": 0,
|
|
"ContentProto": {
|
|
"Use": "Json",
|
|
"Json": {
|
|
"CoreVersion": {
|
|
"Major": 0,
|
|
"Minor": 2
|
|
},
|
|
"ScriptVersion": {
|
|
"Major": 1,
|
|
"Minor": 0
|
|
},
|
|
"Description": "",
|
|
"Id": "LobbyNpc",
|
|
"Language": 1,
|
|
"Name": "LobbyNpc",
|
|
"Type": 1,
|
|
"Source": 0,
|
|
"Target": null,
|
|
"Properties": [
|
|
{
|
|
"Type": "string",
|
|
"DefaultValue": "\"\"",
|
|
"SyncDirection": 0,
|
|
"Attributes": [],
|
|
"Name": "NpcId"
|
|
},
|
|
{
|
|
"Type": "string",
|
|
"DefaultValue": "\"\"",
|
|
"SyncDirection": 0,
|
|
"Attributes": [],
|
|
"Name": "MarkName"
|
|
},
|
|
{
|
|
"Type": "boolean",
|
|
"DefaultValue": "false",
|
|
"SyncDirection": 0,
|
|
"Attributes": [],
|
|
"Name": "InRange"
|
|
}
|
|
],
|
|
"Methods": [
|
|
{
|
|
"Return": {
|
|
"Type": "void",
|
|
"DefaultValue": null,
|
|
"SyncDirection": 0,
|
|
"Attributes": [],
|
|
"Name": null
|
|
},
|
|
"Arguments": [],
|
|
"Code": "self.InRange = false\nlocal mark = _EntityService:GetEntityByPath(\"/maps/lobby/\" .. self.MarkName)\nif mark ~= nil then mark:SetVisible(false) end\nself.Entity:ConnectEvent(TouchEvent, function(e)\n\tself:Interact()\nend)\n_InputService:ConnectEvent(KeyDownEvent, function(e)\n\tif self.InRange and e.key == KeyboardKey.UpArrow then\n\t\tself:Interact()\n\tend\nend)\nlocal eventId = 0\nlocal function tick()\n\tlocal lp = _UserService.LocalPlayer\n\tif lp == nil then return end\n\tif mark == nil then mark = _EntityService:GetEntityByPath(\"/maps/lobby/\" .. self.MarkName) end\n\tlocal a = lp.TransformComponent.WorldPosition\n\tlocal b = self.Entity.TransformComponent.WorldPosition\n\tlocal d = Vector2.Distance(Vector2(a.x, a.y), Vector2(b.x, b.y))\n\tlocal near = d < 1.2\n\tif near ~= self.InRange then\n\t\tself.InRange = near\n\t\tif mark ~= nil then mark:SetVisible(near) end\n\tend\nend\neventId = _TimerService:SetTimerRepeat(tick, 0.15)",
|
|
"Scope": 2,
|
|
"ExecSpace": 6,
|
|
"Attributes": [],
|
|
"Name": "OnBeginPlay"
|
|
},
|
|
{
|
|
"Return": {
|
|
"Type": "void",
|
|
"DefaultValue": null,
|
|
"SyncDirection": 0,
|
|
"Attributes": [],
|
|
"Name": null
|
|
},
|
|
"Arguments": [],
|
|
"Code": "local c = _EntityService:GetEntityByPath(\"/common\")\nif c ~= nil and c.SlayDeckController ~= nil then\n\tc.SlayDeckController:OnLobbyNpcInteract(self.NpcId)\nend",
|
|
"Scope": 2,
|
|
"ExecSpace": 6,
|
|
"Attributes": [],
|
|
"Name": "Interact"
|
|
}
|
|
],
|
|
"EntityEventHandlers": []
|
|
}
|
|
}
|
|
}
|