10 #include "../api_function.h" 11 #include "../api_class.h" 12 #include "../script.h" 13 #include "../../../squirrel/sq_extensions.h" 14 #include "../../tool/simtool.h" 16 namespace script_api {
21 if (!t.is_selected()) {
24 return t.is_selected();
30 return t.is_selected();
34 using namespace script_api;
36 SQInteger
sleep(HSQUIRRELVM vm)
38 if (
const char* blocker = sq_get_suspend_blocker(vm)) {
39 return sq_raise_error(vm,
"Cannot call sleep from within `%s'.", blocker);
41 return sq_suspendvm(vm);
44 SQInteger set_pause_on_error(HSQUIRRELVM vm)
46 if (script_vm_t *script = (script_vm_t*)sq_getforeignptr(vm)) {
47 bool poe = param<bool>::get(vm, 2);
48 script->pause_on_error = poe;
55 void export_control(HSQUIRRELVM vm)
65 register_function(vm,
sleep,
"sleep", 1,
".");
70 register_function<int(*)()>(vm, sq_get_ops_total,
"get_ops_total");
75 register_function<int(*)()>(vm, sq_get_ops_remaing,
"get_ops_remaining");
78 begin_class(vm,
"debug");
83 STATIC register_method(vm, &pause_game,
"pause",
false,
true);
90 STATIC register_method(vm, &is_game_paused,
"is_paused",
false,
true);
97 STATIC register_function<void(*)(bool)>(vm, set_pause_on_error,
"set_pause_on_error",
true);