MONSTER_VARIANTS 랜덤 외형 제거(외형=enemies.json appearance로 정체성 고정). buildMonsterInstance로 종별 모델(monster-<id>) 인스턴스 배치, 준비도 가드로 appearance 미보유 로스터 맵은 보존(Task 2 RUID 수확 후 재생성). gen-combat-monster는 codeblock 생성만(맵 부착은 encounters 생성기로 흡수). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011xhLoQbJvQYL65kBtDNDTy
52 lines
2.1 KiB
JavaScript
52 lines
2.1 KiB
JavaScript
import { writeFileSync } from 'node:fs';
|
|
|
|
// 카드 전투용 자기등록 마커 codeblock(CombatMonster) 생성.
|
|
// BeginPlay 시 /common 컨트롤러에 자기등록해 인카운터를 구성한다.
|
|
// 맵 부착 값(EnemyId/Group)은 gen-map-encounters.mjs가 인스턴스에 직접 기록한다.
|
|
|
|
function prop(Type, Name, DefaultValue = 'nil') {
|
|
return { Type, DefaultValue, SyncDirection: 0, Attributes: [], Name };
|
|
}
|
|
function method(Name, Code, Arguments = [], ExecSpace = 6) {
|
|
return {
|
|
Return: { Type: 'void', DefaultValue: null, SyncDirection: 0, Attributes: [], Name: null },
|
|
Arguments, Code, Scope: 2, ExecSpace, Attributes: [], Name,
|
|
};
|
|
}
|
|
|
|
function writeCodeblock() {
|
|
const cb = {
|
|
Id: '', GameId: '', EntryKey: 'codeblock://combatmonster', 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: 'CombatMonster', Language: 1, Name: 'CombatMonster', Type: 1, Source: 0, Target: null,
|
|
Properties: [prop('string', 'EnemyId', '""'), prop('string', 'Group', '"combat"'), prop('number', 'RegTries', '0')],
|
|
Methods: [
|
|
method('OnBeginPlay', `self.RegTries = 0
|
|
local eventId = 0
|
|
local function reg()
|
|
self.RegTries = self.RegTries + 1
|
|
local c = _EntityService:GetEntityByPath("/common")
|
|
if c ~= nil and c.SlayDeckController ~= nil then
|
|
local mapName = ""
|
|
if self.Entity.CurrentMapName ~= nil then
|
|
mapName = self.Entity.CurrentMapName
|
|
end
|
|
c.SlayDeckController:RegisterMonster(self.Entity, self.EnemyId, self.Group, mapName)
|
|
_TimerService:ClearTimer(eventId)
|
|
elseif self.RegTries > 50 then
|
|
_TimerService:ClearTimer(eventId)
|
|
end
|
|
end
|
|
eventId = _TimerService:SetTimerRepeat(reg, 0.1)`),
|
|
],
|
|
EntityEventHandlers: [],
|
|
} },
|
|
};
|
|
writeFileSync('RootDesk/MyDesk/CombatMonster.codeblock', JSON.stringify(cb, null, 2) + '\n', 'utf8');
|
|
}
|
|
|
|
writeCodeblock();
|
|
console.log('CombatMonster codeblock written.');
|