mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-07-31 01:15:57 -04:00
fixed #337 and removed some lock contention
This commit is contained in:
@@ -23,6 +23,8 @@ def run(core, actor, target, commandString):
|
||||
arg3 = commandArgs[3]
|
||||
if len(commandArgs) > 4:
|
||||
arg4 = commandArgs[4]
|
||||
if len(commandArgs) > 5:
|
||||
arg5 = commandArgs[5]
|
||||
|
||||
if not command:
|
||||
return
|
||||
@@ -41,7 +43,14 @@ def run(core, actor, target, commandString):
|
||||
elif command == 'teleport' and arg2 and arg3 and arg4:
|
||||
position = Point3D(float(arg2), float(arg3), float(arg4))
|
||||
core.simulationService.transferToPlanet(actor, core.terrainService.getPlanetByName(arg1), position, actor.getOrientation(), None)
|
||||
|
||||
|
||||
elif command == 'teleportplayer' and arg1 and arg2 and arg3 and arg4 and arg5:
|
||||
player = core.chatService.getObjectByFirstName(arg1)
|
||||
if player:
|
||||
position = Point3D(float(arg3), float(arg4), float(arg5))
|
||||
core.simulationService.transferToPlanet(player, core.terrainService.getPlanetByName(arg2), position, player.getOrientation(), None)
|
||||
|
||||
|
||||
elif command == 'credits' and arg1:
|
||||
actor.setCashCredits(actor.getCashCredits() + int(arg1))
|
||||
actor.sendSystemMessage('The Galactic Empire has transferred ' + arg1 + ' credits to you for your service.', 0)
|
||||
|
||||
@@ -13,7 +13,7 @@ def run(core, actor, target, commandString):
|
||||
return
|
||||
|
||||
|
||||
if target.getPosition().getDistance2D(actor.getWorldPosition()) > float(20):
|
||||
if target.getWorldPosition().getDistance2D(actor.getWorldPosition()) > float(20):
|
||||
actor.sendSystemMessage(target.getCustomName() + ' is too far away to watch.', 0)
|
||||
return
|
||||
|
||||
|
||||
@@ -1225,9 +1225,9 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
setHamListCounter(getHamListCounter() + 1);
|
||||
delta = messageBuilder.buildHealthDelta(health);
|
||||
|
||||
notifyObservers(delta, true);
|
||||
this.health = health;
|
||||
}
|
||||
notifyObservers(delta, true);
|
||||
|
||||
}
|
||||
|
||||
@@ -1249,9 +1249,10 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
}
|
||||
setHamListCounter(getHamListCounter() + 1);
|
||||
delta = messageBuilder.buildActionDelta(action);
|
||||
notifyObservers(delta, true);
|
||||
this.action = action;
|
||||
}
|
||||
}
|
||||
notifyObservers(delta, true);
|
||||
|
||||
}
|
||||
|
||||
public int getHamListCounter() {
|
||||
|
||||
@@ -123,21 +123,17 @@ public class PlayerService implements INetworkDispatch {
|
||||
}, 30, 30, TimeUnit.SECONDS);
|
||||
|
||||
scheduler.scheduleAtFixedRate(() -> {
|
||||
synchronized(creature.getMutex()) {
|
||||
if(creature.getAction() < creature.getMaxAction() && creature.getPosture() != 14) {
|
||||
if(creature.getCombatFlag() == 0)
|
||||
creature.setAction(creature.getAction() + (15 + creature.getLevel() * 5));
|
||||
else
|
||||
creature.setAction(creature.getAction() + ((15 + creature.getLevel() * 5) / 2));
|
||||
}
|
||||
if(creature.getAction() < creature.getMaxAction() && creature.getPosture() != 14) {
|
||||
if(creature.getCombatFlag() == 0)
|
||||
creature.setAction(creature.getAction() + (15 + creature.getLevel() * 5));
|
||||
else
|
||||
creature.setAction(creature.getAction() + ((15 + creature.getLevel() * 5) / 2));
|
||||
}
|
||||
}, 0, 1000, TimeUnit.MILLISECONDS);
|
||||
|
||||
scheduler.scheduleAtFixedRate(() -> {
|
||||
synchronized(creature.getMutex()) {
|
||||
if(creature.getHealth() < creature.getMaxHealth() && creature.getCombatFlag() == 0 && creature.getPosture() != 13 && creature.getPosture() != 14)
|
||||
creature.setHealth(creature.getHealth() + (36 + creature.getLevel() * 4));
|
||||
}
|
||||
if(creature.getHealth() < creature.getMaxHealth() && creature.getCombatFlag() == 0 && creature.getPosture() != 13 && creature.getPosture() != 14)
|
||||
creature.setHealth(creature.getHealth() + (36 + creature.getLevel() * 4));
|
||||
}, 0, 1000, TimeUnit.MILLISECONDS);
|
||||
|
||||
/*final PlayerObject ghost = (PlayerObject) creature.getSlottedObject("ghost");
|
||||
|
||||
Reference in New Issue
Block a user