diff --git a/wwwroot/workbench/workbench.js b/wwwroot/workbench/workbench.js index c537f24..c48eff1 100644 --- a/wwwroot/workbench/workbench.js +++ b/wwwroot/workbench/workbench.js @@ -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;