feat(combat): 노드 타입별 몬스터 그룹 (일반/엘리트/보스) #31
@@ -36,6 +36,13 @@
|
||||
"Attributes": [],
|
||||
"Name": "EnemyId"
|
||||
},
|
||||
{
|
||||
"Type": "string",
|
||||
"DefaultValue": "\"combat\"",
|
||||
"SyncDirection": 0,
|
||||
"Attributes": [],
|
||||
"Name": "Group"
|
||||
},
|
||||
{
|
||||
"Type": "number",
|
||||
"DefaultValue": "0",
|
||||
@@ -54,7 +61,7 @@
|
||||
"Name": null
|
||||
},
|
||||
"Arguments": [],
|
||||
"Code": "self.RegTries = 0\nlocal eventId = 0\nlocal function reg()\n\tself.RegTries = self.RegTries + 1\n\tlocal c = _EntityService:GetEntityByPath(\"/common\")\n\tif c ~= nil and c.SlayDeckController ~= nil then\n\t\tc.SlayDeckController:RegisterMonster(self.Entity, self.EnemyId)\n\t\t_TimerService:ClearTimer(eventId)\n\telseif self.RegTries > 50 then\n\t\t_TimerService:ClearTimer(eventId)\n\tend\nend\neventId = _TimerService:SetTimerRepeat(reg, 0.1)",
|
||||
"Code": "self.RegTries = 0\nlocal eventId = 0\nlocal function reg()\n\tself.RegTries = self.RegTries + 1\n\tlocal c = _EntityService:GetEntityByPath(\"/common\")\n\tif c ~= nil and c.SlayDeckController ~= nil then\n\t\tc.SlayDeckController:RegisterMonster(self.Entity, self.EnemyId, self.Group)\n\t\t_TimerService:ClearTimer(eventId)\n\telseif self.RegTries > 50 then\n\t\t_TimerService:ClearTimer(eventId)\n\tend\nend\neventId = _TimerService:SetTimerRepeat(reg, 0.1)",
|
||||
"Scope": 2,
|
||||
"ExecSpace": 6,
|
||||
"Attributes": [],
|
||||
|
||||
@@ -6510,7 +6510,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
@@ -6651,7 +6652,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
@@ -6792,7 +6794,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
|
||||
@@ -6510,7 +6510,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
@@ -6663,7 +6664,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
|
||||
@@ -6510,7 +6510,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
@@ -6663,7 +6664,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
|
||||
@@ -6510,7 +6510,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
@@ -6663,7 +6664,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
|
||||
@@ -6510,7 +6510,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
@@ -6663,7 +6664,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
|
||||
@@ -6510,7 +6510,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
@@ -6663,7 +6664,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
|
||||
@@ -6510,7 +6510,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
@@ -6663,7 +6664,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
|
||||
@@ -6510,7 +6510,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
@@ -6663,7 +6664,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
|
||||
@@ -6510,7 +6510,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
@@ -6663,7 +6664,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
|
||||
@@ -6510,7 +6510,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
@@ -6663,7 +6664,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
|
||||
@@ -6510,7 +6510,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
@@ -6663,7 +6664,8 @@
|
||||
{
|
||||
"@type": "script.CombatMonster",
|
||||
"Enable": true,
|
||||
"EnemyId": "orange_mushroom"
|
||||
"EnemyId": "orange_mushroom",
|
||||
"Group": "combat"
|
||||
}
|
||||
],
|
||||
"@version": 1
|
||||
|
||||
@@ -23,7 +23,7 @@ function writeCodeblock() {
|
||||
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('number', 'RegTries', '0')],
|
||||
Properties: [prop('string', 'EnemyId', '""'), prop('string', 'Group', '"combat"'), prop('number', 'RegTries', '0')],
|
||||
Methods: [
|
||||
method('OnBeginPlay', `self.RegTries = 0
|
||||
local eventId = 0
|
||||
@@ -31,7 +31,7 @@ local function reg()
|
||||
self.RegTries = self.RegTries + 1
|
||||
local c = _EntityService:GetEntityByPath("/common")
|
||||
if c ~= nil and c.SlayDeckController ~= nil then
|
||||
c.SlayDeckController:RegisterMonster(self.Entity, self.EnemyId)
|
||||
c.SlayDeckController:RegisterMonster(self.Entity, self.EnemyId, self.Group)
|
||||
_TimerService:ClearTimer(eventId)
|
||||
elseif self.RegTries > 50 then
|
||||
_TimerService:ClearTimer(eventId)
|
||||
@@ -51,7 +51,7 @@ function patchMap(nn) {
|
||||
const tag = String(nn).padStart(2, '0');
|
||||
const file = `map/map${tag}.map`;
|
||||
const map = JSON.parse(readFileSync(file, 'utf8'));
|
||||
let count = 0;
|
||||
let added = 0, kept = 0;
|
||||
for (const e of map.ContentProto.Entities.filter(isMonster)) {
|
||||
const comps = e.jsonString && e.jsonString['@components'];
|
||||
if (!Array.isArray(comps)) {
|
||||
@@ -59,16 +59,23 @@ function patchMap(nn) {
|
||||
continue;
|
||||
}
|
||||
const name = (e.jsonString && e.jsonString.name) || '';
|
||||
const enemyId = NAME_TO_ENEMY[name] || DEFAULT_ENEMY;
|
||||
e.jsonString['@components'] = comps.filter((c) => c['@type'] !== 'script.CombatMonster');
|
||||
e.jsonString['@components'].push({ '@type': 'script.CombatMonster', Enable: true, EnemyId: enemyId });
|
||||
const existing = comps.find((c) => c['@type'] === 'script.CombatMonster');
|
||||
if (existing) {
|
||||
// 사용자가 메이커에서 설정한 값 보존 — 누락된 키만 기본값 채움
|
||||
if (existing.Enable === undefined) existing.Enable = true;
|
||||
if (existing.EnemyId === undefined) existing.EnemyId = NAME_TO_ENEMY[name] || DEFAULT_ENEMY;
|
||||
if (existing.Group === undefined) existing.Group = 'combat';
|
||||
kept++;
|
||||
} else {
|
||||
comps.push({ '@type': 'script.CombatMonster', Enable: true, EnemyId: NAME_TO_ENEMY[name] || DEFAULT_ENEMY, Group: 'combat' });
|
||||
added++;
|
||||
}
|
||||
const names = (e.componentNames || '').split(',').filter((s) => s && s !== 'script.CombatMonster');
|
||||
names.push('script.CombatMonster');
|
||||
e.componentNames = names.join(',');
|
||||
count++;
|
||||
}
|
||||
writeFileSync(file, JSON.stringify(map, null, 2), 'utf8');
|
||||
return `map${tag}(${count})`;
|
||||
return `map${tag}(+${added}/keep${kept})`;
|
||||
}
|
||||
|
||||
writeCodeblock();
|
||||
|
||||
Reference in New Issue
Block a user