mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
op_create_spatial: fix spatial object having no scriptIndex upon creation
This commit is contained in:
@@ -198,7 +198,10 @@ void op_create_spatial(OpcodeContext& ctx) {
|
|||||||
// this will load appropriate script program and link it to the script instance we just created:
|
// this will load appropriate script program and link it to the script instance we just created:
|
||||||
exec_script_proc(scriptId, start);
|
exec_script_proc(scriptId, start);
|
||||||
|
|
||||||
ctx.setReturn(fo::func::scr_find_obj_from_program(scriptPtr->program));
|
fo::GameObject* obj = fo::func::scr_find_obj_from_program(scriptPtr->program);
|
||||||
|
// set script index because scr_find_obj_from_program() doesn't do it when creating a hidden "spatial" object
|
||||||
|
obj->scriptIndex = scriptIndex - 1;
|
||||||
|
ctx.setReturn(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef exec_script_proc
|
#undef exec_script_proc
|
||||||
|
|||||||
Reference in New Issue
Block a user