mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-12 02:13:48 -04:00
Merge pull request #1180 from CharonInferar/Fixes2
Fixed AI-consideration in command service
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user