Merge pull request #1180 from CharonInferar/Fixes2

Fixed AI-consideration in command service
This commit is contained in:
CharonInferar
2014-08-17 14:39:32 +02:00
4 changed files with 23 additions and 19 deletions
+5 -5
View File
@@ -33,16 +33,16 @@ def addTemplate(core):
mobileTemplate.setTemplates(templates)
weaponTemplates = Vector()
#weapontemplate = WeaponTemplate('object/weapon/ranged/carbine/shared_carbine_dh17.iff', WeaponType.CARBINE, 0.6, 15, 'kinetic')
#weaponTemplates.add(weapontemplate)
#weapontemplate = WeaponTemplate('object/weapon/ranged/pistol/shared_pistol_dl44.iff', WeaponType.PISTOL, 0.4, 15, 'kinetic')
#weaponTemplates.add(weapontemplate)
weapontemplate = WeaponTemplate('object/weapon/ranged/carbine/shared_carbine_dh17.iff', WeaponType.CARBINE, 0.6, 15, 'kinetic')
weaponTemplates.add(weapontemplate)
weapontemplate = WeaponTemplate('object/weapon/ranged/pistol/shared_pistol_dl44.iff', WeaponType.PISTOL, 0.4, 15, 'kinetic')
weaponTemplates.add(weapontemplate)
weapontemplate = WeaponTemplate('object/weapon/ranged/rifle/shared_rifle_dlt20a.iff', WeaponType.RIFLE, 1.0, 24, 'kinetic')
weaponTemplates.add(weapontemplate)
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
attacks = Vector()
mobileTemplate.setDefaultAttack('rangedShotrifle')
mobileTemplate.setDefaultAttack('rangedShot')
mobileTemplate.setAttacks(attacks)
core.spawnService.addMobileTemplate('forage_goon', mobileTemplate)
+6 -6
View File
@@ -266,6 +266,12 @@ public class NGECore {
config = DefaultConfig.getConfig();
}
DevLogQueuer devLogQueuer = new DevLogQueuer();
CharonPacketLogger packetLogger;
if (PACKET_DEBUG)
packetLogger = new CharonPacketLogger();
options = new Config();
options.setFilePath("options.cfg");
if (!(options.loadConfigFile())) {
@@ -573,12 +579,6 @@ public class NGECore {
//battlefieldService = new BattlefieldService(this);
adminService = new AdminService(this);
DevLogQueuer devLogQueuer = new DevLogQueuer();
CharonPacketLogger packetLogger;
if (PACKET_DEBUG)
packetLogger = new CharonPacketLogger();
didServerCrash = false;
System.out.println("Started Server.");
cleanupCreatureODB();
-1
View File
@@ -262,7 +262,6 @@ public class AttackState extends AIState {
creature.setIntendedTarget(target.getObjectId());
if (attacks==null) {
//if(attacks.size() == 0) {
core.commandService.callCommand(creature, actor.getMobileTemplate().getDefaultAttack(), target, "");
} else {
Random rand = new Random();
+12 -7
View File
@@ -73,7 +73,7 @@ public class CommandService implements INetworkDispatch {
}
public boolean callCommand(CreatureObject actor, SWGObject target, BaseSWGCommand command, int actionCounter, String commandArgs) {
if (actor == null)
return false;
@@ -84,14 +84,17 @@ public class CommandService implements INetworkDispatch {
if (command == null)
return false;
if (command.getCharacterAbility().length() > 0 && !actor.hasAbility(command.getCharacterAbility()))
if (actor.isPlayer() && command.getCharacterAbility().length() > 0 && !actor.hasAbility(command.getCharacterAbility())){
return false;
}
if (command.isDisabled())
if (command.isDisabled()){
return false;
}
if (actor.hasCooldown(command.getCooldownGroup()) || actor.hasCooldown(command.getCommandName()))
if (actor.hasCooldown(command.getCooldownGroup()) || actor.hasCooldown(command.getCommandName())){
return false;
}
// Causes this service method to return with false after equipping a rifle, not allowing to unequip it anymore
@@ -299,7 +302,7 @@ public class CommandService implements INetworkDispatch {
default:
break;
}
if (command.shouldCallOnTarget()) {
if (target == null || !(target instanceof CreatureObject)) {
return false;
@@ -325,8 +328,9 @@ public class CommandService implements INetworkDispatch {
e.printStackTrace();
}
}
else
else {
processCommand(actor, target, command, actionCounter, commandArgs);
}
return true;
@@ -687,7 +691,7 @@ public class CommandService implements INetworkDispatch {
}
public void processCommand(CreatureObject actor, SWGObject target, BaseSWGCommand command, int actionCounter, String commandArgs) {
if (command.getGodLevel() > 0 || command.getCommandName().equals("setgodmode") || command.getCommandName().equals("server") || command.getCommandName().equals("teleport")
|| command.getCommandName().equals("teleportto") || command.getCommandName().equals("teleporttarget") ) {
String accessLevel = core.adminService.getAccessLevelFromDB(actor.getClient().getAccountId());
@@ -708,6 +712,7 @@ public class CommandService implements INetworkDispatch {
}
if (!levelHasCommand) {
System.out.println("I am an NPC and can't sendSystemMessages " + actor.getCustomName());
actor.sendSystemMessage(" \\#FE2EF7 [GM] \\#FFFFFF " + command.getCommandName() + ": You do not have permission to use this command.", (byte) 0);
return;
}