OSDN Git Service

Added Teleport command
authorryan <>
Sun, 8 Jan 2017 00:15:29 +0000 (00:15 +0000)
committerryan <>
Sun, 8 Jan 2017 00:15:29 +0000 (00:15 +0000)
designguide.html
src/frontend/script_commands.cpp

index 35075a5..053d43e 100644 (file)
@@ -3589,6 +3589,15 @@ ShowPlayingSounds</strong> - show the sounds currently playing in the sound syst
 
 <p style="text-align:left;margin-left:0;margin-right:auto;"></p>
 
+<p style="text-align:left;margin-left:0;margin-right:auto;"><strong>bd.
+Teleport</strong> - warps the user to the specified location. This command is
+normally used after a building has loaded.<br>
+Syntax: <font face="Courier New, Courier, mono" size="2">Teleport
+<em>X, Y, Z</em></font><br>
+Example: <font face="Courier New, Courier, mono" size="2">Teleport 3, 5, 10</font></p>
+
+<p style="text-align:left;margin-left:0;margin-right:auto;"></p>
+
 <p></p>
 
 <p align="left"> </p>
index fce3340..9b9d30b 100644 (file)
@@ -1804,6 +1804,33 @@ int ScriptProcessor::CommandsSection::Run(std::string &LineData)
                return sNextLine;
        }
 
+       //Teleport command
+       if (linecheck.substr(0, 8) == "teleport")
+       {
+               //get data
+               int params = SplitData(LineData, 9);
+
+               if (params != 3)
+                       return ScriptError("Incorrect number of parameters");
+
+               //check numeric values
+               for (int i = 0; i <= 2; i++)
+               {
+                       if (!IsNumeric(tempdata[i]))
+                               return ScriptError("Invalid value: " + tempdata[i]);
+               }
+
+               Ogre::Vector3 destination;
+               destination.x = ToFloat(tempdata[0]);
+               destination.y = ToFloat(tempdata[1]);
+               destination.z = ToFloat(tempdata[2]);
+
+               Simcore->camera->GotoFloor(Simcore->GetFloorNumber(destination.y));
+               Simcore->camera->SetPosition(destination);
+
+               return sNextLine;
+       }
+
        //GotoFloor command
        if (linecheck.substr(0, 9) == "gotofloor")
        {