mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-12 02:13:48 -04:00
Added teleport admin/GM commands
Commands added: /teleport /teleporttarget /telportto
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import sys
|
||||
from engine.resources.scene import Point3D
|
||||
|
||||
def setup():
|
||||
return
|
||||
|
||||
def run(core, actor, target, commandString):
|
||||
playerObject = actor.getSlottedObject('ghost')
|
||||
|
||||
if not playerObject:
|
||||
return
|
||||
|
||||
commandArgs = commandString.split(' ')
|
||||
arg4 = None
|
||||
if len(commandArgs) > 0:
|
||||
arg1 = commandArgs[0]
|
||||
if len(commandArgs) > 1:
|
||||
arg2 = commandArgs[1]
|
||||
if len(commandArgs) > 2:
|
||||
arg3 = commandArgs[2]
|
||||
if len(commandArgs) > 3:
|
||||
arg4 = commandArgs[3]
|
||||
|
||||
if arg1 and arg2 and arg3 and arg4 is not None:
|
||||
try:
|
||||
actor.sendSystemMessage('Teleporting...', 0)
|
||||
position = Point3D(float(arg1), float(arg2), float(arg3))
|
||||
core.simulationService.transferToPlanet(actor, core.terrainService.getPlanetByName(arg4), position, actor.getOrientation(), None)
|
||||
except:
|
||||
actor.sendSystemMessage('Invalid Syntax. Syntax is: /teleport <x> <z> [<y>] <planet>', 0)
|
||||
return
|
||||
return
|
||||
|
||||
elif arg1 and arg2 and arg3:
|
||||
try:
|
||||
actor.sendSystemMessage('Teleporting...', 0)
|
||||
position = Point3D(float(arg1), 0, float(arg2))
|
||||
core.simulationService.transferToPlanet(actor, core.terrainService.getPlanetByName(arg3), position, actor.getOrientation(), None)
|
||||
except:
|
||||
actor.sendSystemMessage('Invalid Syntax. Syntax is: /teleport <x> <z> [<y>] <planet>', 0)
|
||||
return
|
||||
|
||||
else:
|
||||
actor.sendSystemMessage('Invalid Syntax. Syntax is: /teleport <x> <z> [<y>] <planet>', 0)
|
||||
return
|
||||
return
|
||||
@@ -5,25 +5,18 @@ def setup():
|
||||
return
|
||||
|
||||
def run(core, actor, target, commandString):
|
||||
|
||||
|
||||
playerObject = actor.getSlottedObject('ghost')
|
||||
|
||||
if not playerObject:
|
||||
return
|
||||
|
||||
commandArgs = commandString.split(' ')
|
||||
if len(commandArgs) > 0:
|
||||
arg1 = commandArgs[0]
|
||||
if len(commandArgs) > 1:
|
||||
arg2 = commandArgs[1]
|
||||
if len(commandArgs) > 2:
|
||||
arg3 = commandArgs[2]
|
||||
if len(commandArgs) > 3:
|
||||
arg4 = commandArgs[3]
|
||||
|
||||
if arg1 and arg2 and arg3 and arg4 target:
|
||||
position = Point3D(float(arg2), float(arg3), float(arg4))
|
||||
core.simulationService.transferToPlanet(target, core.terrainService.getPlanetByName(arg1), position, actor.getOrientation(), None)
|
||||
|
||||
if target and target.getSlottedObject('ghost') is not None:
|
||||
actor.sendSystemMessage('Teleporting ' + target.getCustomName() + ' to you...', 0)
|
||||
core.simulationService.teleport(target, actor.getPosition(), actor.getOrientation(), 0)
|
||||
return
|
||||
|
||||
else:
|
||||
actor.sendSystemMessage('Invalid Syntax. Syntax is: /teleporttarget <HoverTarget>', 0)
|
||||
return
|
||||
return
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import sys
|
||||
from engine.resources.scene import Point3D
|
||||
|
||||
def setup():
|
||||
return
|
||||
|
||||
def run(core, actor, target, commandString):
|
||||
|
||||
playerObject = actor.getSlottedObject('ghost')
|
||||
|
||||
if not playerObject:
|
||||
return
|
||||
|
||||
if target is None:
|
||||
target = core.objectService.getObjectByFirstName(commandString)
|
||||
|
||||
if target and target.getSlottedObject('ghost') is not None:
|
||||
actor.sendSystemMessage('Teleporting you to ' + target.getCustomName() + '...', 0)
|
||||
if target.getPlanetId() == actor.getPlanetId():
|
||||
core.simulationService.teleport(actor, target.getPosition(), target.getOrientation(), target.getParentId())
|
||||
else:
|
||||
if target.getParentId() == 0:
|
||||
core.simulationService.transferToPlanet(actor, core.terrainService.getPlanetById(target.getPlanetId()), target.getPosition(), target.getOrientation(), None)
|
||||
else:
|
||||
core.simulationService.transferToPlanet(actor, core.terrainService.getPlanetById(target.getPlanetId()), target.getPosition(), target.getOrientation(), core.objectService.getObject(target.getParentId()))
|
||||
return
|
||||
else:
|
||||
actor.sendSystemMessage('Invalid Syntax. Syntax is: /teleportto <playerName>', 0)
|
||||
return
|
||||
return
|
||||
@@ -1150,6 +1150,14 @@ public class SimulationService implements INetworkDispatch {
|
||||
|
||||
public void teleport(SWGObject obj, Point3D position, Quaternion orientation, long cellId) {
|
||||
|
||||
if (obj.getPosition().getDistance2D(position) > 150) {
|
||||
if (cellId != 0)
|
||||
transferToPlanet(obj, obj.getPlanet(), position, orientation, core.objectService.getObject(cellId));
|
||||
else
|
||||
transferToPlanet(obj, obj.getPlanet(), position, orientation, null);
|
||||
return;
|
||||
}
|
||||
|
||||
if(cellId == 0) {
|
||||
if(position.x >= -8192 && position.x <= 8192 && position.z >= -8192 && position.z <= 8192) {
|
||||
obj.setMovementCounter(obj.getMovementCounter() + 1);
|
||||
@@ -1165,6 +1173,8 @@ public class SimulationService implements INetworkDispatch {
|
||||
|
||||
obj.setPosition(position);
|
||||
obj.setOrientation(orientation);
|
||||
|
||||
// Shouldn't the parent be set?
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user