//***************************************************************************** // initialization //***************************************************************************** void init_persistent(void) { p_to_save = newList(); auxiliariesInstall("persistent_data", newAuxiliaryFuncs(AUXILIARY_TYPE_ROOM, newPersistentData, deletePersistentData, persistentDataCopyTo, persistentDataCopy, persistentDataStore,persistentDataRead)); // start our flushing of persistent rooms that need to be saved start_update(NULL, 1, flush_persistent_rooms_event, NULL,NULL,NULL); // // disabled until a better implementation is written. // // start_update(NULL, 1, close_unused_rooms_event, NULL,NULL,NULL); // listen for objects and characters entering // or leaving rooms. Update those rooms' statuses hookAdd("char_to_room", update_persistent_char_to_room); hookAdd("char_from_room", update_persistent_char_from_room); hookAdd("obj_to_room", update_persistent_obj_to_room); hookAdd("obj_from_room", update_persistent_obj_from_room); hookAdd("obj_from_obj", update_persistent_obj_from_obj); hookAdd("obj_to_obj", update_persistent_obj_to_obj); hookAdd("room_from_game", update_persistent_room_from_game); hookAdd("room_change", update_persistent_room_change); // add accessibility to Python /* PyRoom_addMethod("add_activity", PyRoom_addActivity, METH_NOARGS, NULL); PyRoom_addMethod("rem_activity", PyRoom_remActivity, METH_NOARGS, NULL); */ PyRoom_addMethod("dirty", PyRoom_dirtyPersistence, METH_NOARGS,NULL); PyRoom_addMethod("unload", PyRoom_unloadPersistence, METH_NOARGS,NULL); PyRoom_addGetSetter("persistent", PyRoom_getpersistent, PyRoom_setpersistent, NULL); }
//***************************************************************************** // implementation of scripts.h - triggers portion in triggers.c //***************************************************************************** void init_scripts(void) { // create our locale stack locale_stack = newList(); // initialize python Py_Initialize(); // initialize all of our modules written in C init_PyMudSys(); init_PyAuxiliary(); init_PyEvent(); init_PyStorage(); init_PyAccount(); init_PyChar(); init_PyRoom(); init_PyExit(); init_PySocket(); init_PyObj(); init_PyMud(); init_PyHooks(); init_PyOLC(); // initialize all of our modules written in Python init_pyplugs(); // initialize the other parts to this module init_script_editor(); init_trighooks(); // so triggers can be saved to/loaded from disk worldAddType(gameworld, "trigger", triggerRead, triggerStore, deleteTrigger, triggerSetKey); // deal with auxiliary data auxiliariesInstall("trigger_data", newAuxiliaryFuncs(AUXILIARY_TYPE_CHAR|AUXILIARY_TYPE_ROOM | AUXILIARY_TYPE_OBJ|AUXILIARY_TYPE_SOCKET| AUXILIARY_TYPE_ACCOUNT, newTriggerAuxData, deleteTriggerAuxData, triggerAuxDataCopyTo, triggerAuxDataCopy, triggerAuxDataStore,triggerAuxDataRead)); // add in some hooks for preprocessing scripts embedded in descs hookAdd("preprocess_room_desc", expand_room_dynamic_descs); hookAdd("preprocess_char_desc", expand_char_dynamic_descs); hookAdd("preprocess_obj_desc", expand_obj_dynamic_descs); hookAdd("preprocess_exit_desc", expand_exit_dynamic_descs); hookAdd("shutdown", finalize_scripts_hook); /* // add new player commands add_cmd("trun", NULL, cmd_scrun, "builder", FALSE); */ extern COMMAND(cmd_tedit); // define the command add_cmd("attach", NULL, cmd_attach, "scripter", FALSE); add_cmd("detach", NULL, cmd_detach, "scripter", FALSE); add_cmd("tedit", NULL, cmd_tedit, "scripter", TRUE); add_cmd("tstat", NULL, cmd_tstat, "scripter", FALSE); add_cmd("tlist", NULL, cmd_tlist, "scripter", FALSE); add_cmd("tdelete", NULL, cmd_tdelete,"scripter",FALSE); add_cmd("trename", NULL, cmd_trename,"scripter", FALSE); }