Merge pull request #2396 from hea3ven/6.3.x

fix docking stations staying linked when changing a robot's main link
This commit is contained in:
Adrian Siekierka 2015-01-18 14:30:37 +01:00
commit 3e5a2ae062
2 changed files with 3 additions and 5 deletions

View file

@ -137,10 +137,7 @@ public class DockingStation implements IDockingStation {
public void release(EntityRobotBase robot) { public void release(EntityRobotBase robot) {
if (robotTaking == robot && !linkIsMain) { if (robotTaking == robot && !linkIsMain) {
linkIsMain = false; unsafeRelease(robot);
robotTaking = null;
robotTakingId = EntityRobotBase.NULL_ROBOT_ID;
getPipe().scheduleRenderUpdate();
RobotRegistry.getRegistry(world).markDirty(); RobotRegistry.getRegistry(world).markDirty();
RobotRegistry.getRegistry(world).release(this, robot.getRobotId()); RobotRegistry.getRegistry(world).release(this, robot.getRobotId());
} }
@ -152,6 +149,7 @@ public class DockingStation implements IDockingStation {
*/ */
public void unsafeRelease(EntityRobotBase robot) { public void unsafeRelease(EntityRobotBase robot) {
if (robotTaking == robot) { if (robotTaking == robot) {
linkIsMain = false;
robotTaking = null; robotTaking = null;
robotTakingId = EntityRobotBase.NULL_ROBOT_ID; robotTakingId = EntityRobotBase.NULL_ROBOT_ID;
getPipe().scheduleRenderUpdate(); getPipe().scheduleRenderUpdate();

View file

@ -582,7 +582,7 @@ public class EntityRobot extends EntityRobotBase implements
DockingStation station = (DockingStation) iStation; DockingStation station = (DockingStation) iStation;
if (linkedDockingStation != null && linkedDockingStation != station) { if (linkedDockingStation != null && linkedDockingStation != station) {
((DockingStation) linkedDockingStation).release(this); ((DockingStation) linkedDockingStation).unsafeRelease(this);
} }
linkedDockingStation = station; linkedDockingStation = station;