feat(node-groups): CombatMonster 에 Group + 생성기 값 보존(no-clobber)
This commit is contained in:
@@ -36,6 +36,13 @@
|
|||||||
"Attributes": [],
|
"Attributes": [],
|
||||||
"Name": "EnemyId"
|
"Name": "EnemyId"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Type": "string",
|
||||||
|
"DefaultValue": "\"combat\"",
|
||||||
|
"SyncDirection": 0,
|
||||||
|
"Attributes": [],
|
||||||
|
"Name": "Group"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"Type": "number",
|
"Type": "number",
|
||||||
"DefaultValue": "0",
|
"DefaultValue": "0",
|
||||||
@@ -54,7 +61,7 @@
|
|||||||
"Name": null
|
"Name": null
|
||||||
},
|
},
|
||||||
"Arguments": [],
|
"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,
|
"Scope": 2,
|
||||||
"ExecSpace": 6,
|
"ExecSpace": 6,
|
||||||
"Attributes": [],
|
"Attributes": [],
|
||||||
|
|||||||
@@ -6510,7 +6510,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
@@ -6651,7 +6652,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
@@ -6792,7 +6794,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
|
|||||||
@@ -6510,7 +6510,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
@@ -6663,7 +6664,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
|
|||||||
@@ -6510,7 +6510,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
@@ -6663,7 +6664,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
|
|||||||
@@ -6510,7 +6510,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
@@ -6663,7 +6664,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
|
|||||||
@@ -6510,7 +6510,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
@@ -6663,7 +6664,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
|
|||||||
@@ -6510,7 +6510,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
@@ -6663,7 +6664,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
|
|||||||
@@ -6510,7 +6510,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
@@ -6663,7 +6664,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
|
|||||||
@@ -6510,7 +6510,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
@@ -6663,7 +6664,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
|
|||||||
@@ -6510,7 +6510,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
@@ -6663,7 +6664,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
|
|||||||
@@ -6510,7 +6510,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
@@ -6663,7 +6664,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
|
|||||||
@@ -6510,7 +6510,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
@@ -6663,7 +6664,8 @@
|
|||||||
{
|
{
|
||||||
"@type": "script.CombatMonster",
|
"@type": "script.CombatMonster",
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
"EnemyId": "orange_mushroom"
|
"EnemyId": "orange_mushroom",
|
||||||
|
"Group": "combat"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@version": 1
|
"@version": 1
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ function writeCodeblock() {
|
|||||||
ContentProto: { Use: 'Json', Json: {
|
ContentProto: { Use: 'Json', Json: {
|
||||||
CoreVersion: { Major: 0, Minor: 2 }, ScriptVersion: { Major: 1, Minor: 0 },
|
CoreVersion: { Major: 0, Minor: 2 }, ScriptVersion: { Major: 1, Minor: 0 },
|
||||||
Description: '', Id: 'CombatMonster', Language: 1, Name: 'CombatMonster', Type: 1, Source: 0, Target: null,
|
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: [
|
Methods: [
|
||||||
method('OnBeginPlay', `self.RegTries = 0
|
method('OnBeginPlay', `self.RegTries = 0
|
||||||
local eventId = 0
|
local eventId = 0
|
||||||
@@ -31,7 +31,7 @@ local function reg()
|
|||||||
self.RegTries = self.RegTries + 1
|
self.RegTries = self.RegTries + 1
|
||||||
local c = _EntityService:GetEntityByPath("/common")
|
local c = _EntityService:GetEntityByPath("/common")
|
||||||
if c ~= nil and c.SlayDeckController ~= nil then
|
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)
|
_TimerService:ClearTimer(eventId)
|
||||||
elseif self.RegTries > 50 then
|
elseif self.RegTries > 50 then
|
||||||
_TimerService:ClearTimer(eventId)
|
_TimerService:ClearTimer(eventId)
|
||||||
@@ -51,7 +51,7 @@ function patchMap(nn) {
|
|||||||
const tag = String(nn).padStart(2, '0');
|
const tag = String(nn).padStart(2, '0');
|
||||||
const file = `map/map${tag}.map`;
|
const file = `map/map${tag}.map`;
|
||||||
const map = JSON.parse(readFileSync(file, 'utf8'));
|
const map = JSON.parse(readFileSync(file, 'utf8'));
|
||||||
let count = 0;
|
let added = 0, kept = 0;
|
||||||
for (const e of map.ContentProto.Entities.filter(isMonster)) {
|
for (const e of map.ContentProto.Entities.filter(isMonster)) {
|
||||||
const comps = e.jsonString && e.jsonString['@components'];
|
const comps = e.jsonString && e.jsonString['@components'];
|
||||||
if (!Array.isArray(comps)) {
|
if (!Array.isArray(comps)) {
|
||||||
@@ -59,16 +59,23 @@ function patchMap(nn) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const name = (e.jsonString && e.jsonString.name) || '';
|
const name = (e.jsonString && e.jsonString.name) || '';
|
||||||
const enemyId = NAME_TO_ENEMY[name] || DEFAULT_ENEMY;
|
const existing = comps.find((c) => c['@type'] === 'script.CombatMonster');
|
||||||
e.jsonString['@components'] = comps.filter((c) => c['@type'] !== 'script.CombatMonster');
|
if (existing) {
|
||||||
e.jsonString['@components'].push({ '@type': 'script.CombatMonster', Enable: true, EnemyId: enemyId });
|
// 사용자가 메이커에서 설정한 값 보존 — 누락된 키만 기본값 채움
|
||||||
|
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');
|
const names = (e.componentNames || '').split(',').filter((s) => s && s !== 'script.CombatMonster');
|
||||||
names.push('script.CombatMonster');
|
names.push('script.CombatMonster');
|
||||||
e.componentNames = names.join(',');
|
e.componentNames = names.join(',');
|
||||||
count++;
|
|
||||||
}
|
}
|
||||||
writeFileSync(file, JSON.stringify(map, null, 2), 'utf8');
|
writeFileSync(file, JSON.stringify(map, null, 2), 'utf8');
|
||||||
return `map${tag}(${count})`;
|
return `map${tag}(+${added}/keep${kept})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
writeCodeblock();
|
writeCodeblock();
|
||||||
|
|||||||
Reference in New Issue
Block a user