mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-08-04 05:16:21 -04:00
Fixed several AI bugs, listed in description
Fixed #0000061 : Houses can now be destroyed, even when not redeeding - Added AI action regeneration when in combat - Fixed NPC self-buffing null pointer exception
This commit is contained in:
@@ -68,6 +68,7 @@ import services.sui.SUIWindow.SUICallback;
|
||||
import services.sui.SUIWindow.Trigger;
|
||||
import tools.DevLog;
|
||||
import main.NGECore;
|
||||
import engine.clients.Client;
|
||||
import engine.resources.common.CRC;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.scene.Point3D;
|
||||
@@ -1371,7 +1372,20 @@ public class CombatService implements INetworkDispatch {
|
||||
if(!applySpecialCost(creature, weapon, command))
|
||||
success = false;
|
||||
|
||||
if(!success && creature.getClient() != null) {
|
||||
// Quick Hotfix for AI NPCs buffing themselves
|
||||
Client client = null;
|
||||
if(creature.getClient() == null) {
|
||||
if (creature.getAttachment("AI")!=null){
|
||||
AIActor aiActor = (AIActor) creature.getAttachment("AI");
|
||||
CreatureObject target = aiActor.getFollowObject();
|
||||
if (target.getClient()!=null)
|
||||
client = target.getClient(); // Use player's client reference that is in combat with that NPC
|
||||
}
|
||||
} else {
|
||||
client = creature.getClient();
|
||||
}
|
||||
|
||||
if(!success && client != null) {
|
||||
IoSession session = creature.getClient().getSession();
|
||||
CommandEnqueueRemove commandRemove = new CommandEnqueueRemove(creature.getObjectId(), actionCounter);
|
||||
session.write(new ObjControllerMessage(0x0B, commandRemove).serialize());
|
||||
@@ -1380,6 +1394,9 @@ public class CombatService implements INetworkDispatch {
|
||||
return;
|
||||
}
|
||||
|
||||
if (client == null)
|
||||
return;
|
||||
|
||||
if (creature.hasBuff("co_position_secured"))
|
||||
core.buffService.removeBuffFromCreatureByName(creature, "co_position_secured");
|
||||
else
|
||||
@@ -1387,11 +1404,11 @@ public class CombatService implements INetworkDispatch {
|
||||
|
||||
StartTask startTask = new StartTask(actionCounter, creature.getObjectID(), command.getCommandCRC(), CRC.StringtoCRC(command.getCooldownGroup()), command.getCooldown());
|
||||
ObjControllerMessage objController2 = new ObjControllerMessage(0x0B, startTask);
|
||||
creature.getClient().getSession().write(objController2.serialize());
|
||||
client.getSession().write(objController2.serialize());
|
||||
|
||||
CommandEnqueueRemove commandRemove = new CommandEnqueueRemove(creature.getObjectID(), actionCounter);
|
||||
ObjControllerMessage objController3 = new ObjControllerMessage(0x0B, commandRemove);
|
||||
creature.getClient().getSession().write(objController3.serialize());
|
||||
client.getSession().write(objController3.serialize());
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user