refactor(cb): lib/codeblock.mjs로 헬퍼·상수 추출 (codeblock 바이트 동일)

This commit is contained in:
2026-06-16 07:58:55 +09:00
parent 9f7713267c
commit 42eb33b579
2 changed files with 61 additions and 58 deletions

View File

@@ -0,0 +1,60 @@
function prop(Type, Name, DefaultValue = 'nil') {
return { Type, DefaultValue, SyncDirection: 0, Attributes: [], Name };
}
function method(Name, Code, Arguments = [], ExecSpace = 0, ReturnType = 'void') {
return {
Return: { Type: ReturnType, DefaultValue: null, SyncDirection: 0, Attributes: [], Name: null },
Arguments,
Code,
Scope: 2,
ExecSpace,
Attributes: [],
Name,
};
}
function codeblock(id, name, properties, methods) {
return {
Id: '',
GameId: '',
EntryKey: `codeblock://${id}`,
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: id,
Language: 1,
Name: name,
Type: 1,
Source: 0,
Target: null,
Properties: properties,
Methods: methods,
EntityEventHandlers: [],
},
},
};
}
const RUN_LENGTH = 5;
const GOLD_PER_WIN = 25;
const CARD_PRICE = 30;
const REST_HEAL = 30;
const RELIC_PRICE = 60;
const ACT_COUNT = 5;
const ACT_MAPS = ['map01', 'map02', 'map03', 'map04', 'map05'];
const LOBBY_MAP = 'lobby';
const LOBBY_SPAWN = 'Vector3(-5, 0.03, 0)'; // 정찰: map01 지면 좌측
export { prop, method, codeblock, RUN_LENGTH, GOLD_PER_WIN, CARD_PRICE, REST_HEAL, RELIC_PRICE, ACT_COUNT, ACT_MAPS, LOBBY_MAP, LOBBY_SPAWN };