From dd464554b7d5e3fcfd1bd6a62b78ed3317a823f1 Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Sun, 3 Jul 2022 00:27:01 +0700 Subject: [PATCH] Fix trader command always opening trader on select --- sources/Commands/ACommandTrader.uc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sources/Commands/ACommandTrader.uc b/sources/Commands/ACommandTrader.uc index 6bc4252..638ba0b 100644 --- a/sources/Commands/ACommandTrader.uc +++ b/sources/Commands/ACommandTrader.uc @@ -313,11 +313,12 @@ protected function HandleTraderSwap( ETrader oldTrader, ETrader newTrader) { - local bool closeOldTrader; + local bool closeOldTrader, openNewTrader; if (oldTrader == none) return; if (oldTrader.SameAs(newTrader)) return; - closeOldTrader = newTrader == none || !newTrader.IsOpen(); + closeOldTrader = newTrader == none || !newTrader.IsOpen(); + openNewTrader = oldTrader.IsOpen(); if (closeOldTrader) { if (!result.options.HasKey(T(TIGNORE_DOORS))) { @@ -327,7 +328,7 @@ protected function HandleTraderSwap( oldTrader.BootPlayers(); } } - if (newTrader != none) { + if (openNewTrader && newTrader != none) { newTrader.Open(); } }