fix(工作台): 脚本保存补world_id(NOT NULL约束)——实体/场景级脚本归属游戏世界

This commit is contained in:
pipeline-agent 2026-08-30 15:36:10 +08:00
parent e6ed58c3d9
commit 4222635822

View File

@ -140,7 +140,8 @@
var s = state.sel;
if (!s) return null;
var p = {game_id: state.game.id, trigger_event: document.getElementById('event_sel').value};
if (s.type === 'world') p.world_id = s.id;
// 世界外键所有级别脚本都归属该游戏的世界world_id NOT NULL 约束)
if (state.data && state.data.world) p.world_id = state.data.world.id;
if (s.type === 'scene') p.scene_id = s.id;
if (s.type === 'entity') p.entity_id = s.id;
return p;