|
static string | NewWorld (const char *sWorldName, const char *sBaseWorldName) |
| created a new empty world based on a given world. More...
|
|
static const char * | NewWorld_ (const char *sWorldName, const char *sBaseWorldName) |
| solely used for exporting
|
|
static void | DeleteWorld (const char *sWorldName) |
| delete a given world. More...
|
|
static string | NewEmptyWorld (const char *sWorldName=NULL, float fTileSize=533.3333f, int nTileDimension=64) |
| Create an empty world, with flat land. More...
|
|
static bool | CreateRawTerrainFile (const char *sFilename, float fHeight=0.f, int nDimension=129) |
| create a raw terrain file
|
|
static const char * | NewEmptyWorld_ (const char *sWorldName=NULL, float fTileSize=533.3333f, int nTileDimension=64) |
| solely used for exporting
|
|
static void | SetEnablePathEncoding (bool bEnable) |
| set whether we will encode world related files. More...
|
|
static bool | GetEnablePathEncoding () |
| get whether we will encode world related files. More...
|
|
static ParaDataProvider | GetNpcDB () |
| get the current NPC data provider. More...
|
|
static void | GetNpcDB_ (ParaDataProvider *out) |
| solely used for exporting
|
|
static void | SetNpcDB (const char *sConnectionstring) |
| set the global NPC data base to a new database file. More...
|
|
static ParaDataProvider | GetAttributeProvider () |
| get the current attribute data provider. More...
|
|
static void | GetAttributeProvider_ (ParaDataProvider *out) |
| solely used for exporting
|
|
static void | SetAttributeProvider (const char *sConnectionstring) |
| set the current attribute data base to a new database file. More...
|
|
static void | SetWorldDB (const char *sConnectionstring) |
| set world database. More...
|
|
static string | GetStringbyID (int ID) |
| Get string from ID. More...
|
|
static int | InsertString (const char *strEN, const char *strCN) |
| Insert the new string table entry to StringTable_DB. More...
|
|
static void | SetServerState (int nState) |
| set the current server state. More...
|
|
static int | GetServerState () |
|
static bool | SendTerrainUpdate (const char *sDestination, float center_x, float center_y, float center_z, float fRadius, float fResolution) |
| Call this function to send a copy of the local terrain to a destination world at a given resolution. More...
|
|
static string | GetWorldName () |
| get current world name
|
|
static string | GetWorldDirectory () |
| get world root path. More...
|
|
static void | SetScriptSandBox (const object &SandboxNeuronFile) |
| Paraworld is told to execute in the given sandbox. More...
|
|
static const char * | GetScriptSandBox () |
| please see SetScriptSandBox() More...
|
|
world creation functions.
bool ParaScripting::ParaWorld::GetEnablePathEncoding |
( |
| ) |
|
|
static |
get whether we will encode world related files.
default to true. By enabling path encoding, world related files like "worlddir/worldfile.txt" will be saved as "%WORLD%/worldfile.txt", thus even the entire world directory changes, the world files can still be found using path variables. Path encoding needs to be disabled when you are creating a template world.
string ParaWorld::NewWorld |
( |
const char * |
sWorldName, |
|
|
const char * |
sBaseWorldName |
|
) |
| |
|
static |
created a new empty world based on a given world.
This is like class inheritance in C++ another world could derive from a given world, overriding certain terrain tile contents as it evolves. One can immediately create the new world which is identical to the base world. Every changes made to the new world will be saved in the new world folder and will not affect the base world. in reality, we just copy the base world's world config file to the new world using the new world's name. e.g
local sConfigFileName = ParaWorld.NewWorld("__TmpWorld", "sample/worldconfig.txt");
if(sConfigFileName ~= "") then
ParaScene.CreateWorld("", 32000, sConfigFileName);
end
NOTE: if the sWorldName is the same as sBaseWorldName, the sBaseWorldName itself will be overridden
- Parameters
-
sWorldName | world name, a directory with the same name will be created containing the world config file. |
sBaseWorldName | any valid world config file. |
- Returns
- : return the world config file. if failed, return ""
void ParaScripting::ParaWorld::SetEnablePathEncoding |
( |
bool |
bEnable | ) |
|
|
static |
set whether we will encode world related files.
default to true. By enabling path encoding, world related files like "worlddir/worldfile.txt" will be saved as "%WORLD%/worldfile.txt", thus even the entire world directory changes, the world files can still be found using path variables. Path encoding needs to be disabled when you are creating a template world.
void ParaScripting::ParaWorld::SetScriptSandBox |
( |
const object & |
SandboxNeuronFile | ) |
|
|
static |
Paraworld is told to execute in the given sandbox.
(1) ParaWorld namespace supports a sandbox mode, which can be turned on and off on demand. Once turned on, all scripts from the current game world will be executed in a separate and newly created script runtime environment. (2) Sandbox mode is an isolated mode that does not have any link with the glia file environment. (3) The world scripts protected by the sandbox runtime environment includes: terrain tile onload script, biped event handler scripts, such as character onload, onclick events. (4) The sandbox environment includes the following functions that could be used: ParaScene, ParaUI namespace functions. It also explicitly disabled the following functions: a) Dofile() b) Io, ParaIO, Exec c) Require(),NPL.load, NPL.activate, NPL.download: cut off any way to manually load a file. It adds d) Log e) Download some file to replace local file. f) Changing the Enter sand box function or almost any function to some fake function. (5) The following attack methods should be prevented by the sandbox environment a) Execute or load any external application b) Write to any file, including log file c) Compromise data or functions in the glia file environment. Such as, changing and hooking the string method d) Compromise the sandbox itself and then affect in the next sandbox entity. (6) glia file environment does not have a sandbox mode. Because I found that any global sandbox mode implementation has a way to hack in, and I give up any measure of protecting the glia file environment. Sandbox protection for the world file is enough because that is the only source file that may not be provided by ParaEngine. In order to run any other code not provided by the ParaEngine, the user should have been well informed of the danger. But so far, there is no need to have a world that should inform the user. Because most world functions are supported in the world sandbox.
- Parameters
-
sNeuronFileName | script file name. Use NPL.CreateNeuronFile() to create a sandbox neuron file if you do not want to use a sandbox, please specify NULL or "". |