fix controller autoasignment script

the navmesh editor will try and bolt on an aicontroller initially referencing a datablock.aiControllerData for any given thing clicked on.
make sure if you saved a file with one still referenced, it wont try to use the old one
This commit is contained in:
AzaezelX 2025-05-14 10:17:55 -05:00
parent 5e2e82bf7a
commit 9b2ccb8bd5

View file

@ -459,7 +459,7 @@ function NavEditorGui::onLinkSelected(%this, %flags)
function NavEditorGui::onPlayerSelected(%this, %flags) function NavEditorGui::onPlayerSelected(%this, %flags)
{ {
if (!isObject(%this.getPlayer().aiController) && (!(%this.getPlayer().isMemberOfClass("AIPlayer")))) if (!isObject(%this.getPlayer().aiController) || (isObject(%this.getPlayer().aiController) && !(%this.getPlayer().isMemberOfClass("AIPlayer"))))
{ {
%this.getPlayer().aiController = new AIController(){ ControllerData = %this.getPlayer().getDatablock().aiControllerData; }; %this.getPlayer().aiController = new AIController(){ ControllerData = %this.getPlayer().getDatablock().aiControllerData; };
%this.getPlayer().setAIController(%this.getPlayer().aiController); %this.getPlayer().setAIController(%this.getPlayer().aiController);