From b1e77fa2601e6ad76c0f495e4f5a9b647e73dc5f Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 16 Dec 2017 16:04:32 -0500 Subject: [PATCH] createitem: fix an issue with items teleporting to the location of another unit This was due to moveToGround() being called twice, first with the location of world.units.active[0], which caused the item to teleport to that location later. Fixes #1198 --- plugins/createitem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/createitem.cpp b/plugins/createitem.cpp index e65d19793..18ce7674a 100644 --- a/plugins/createitem.cpp +++ b/plugins/createitem.cpp @@ -114,10 +114,10 @@ bool makeItem (df::reaction_product_itemst *prod, df::unit *unit, bool second_it if (!Items::moveToBuilding(mc, out_items[i], (df::building_actual *)building, 0)) out_items[i]->moveToGround(building->centerx, building->centery, building->z); } - if (on_ground) - out_items[i]->moveToGround(unit->pos.x, unit->pos.y, unit->pos.z); if (move_to_cursor) out_items[i]->moveToGround(cursor->x, cursor->y, cursor->z); + else if (on_ground) + out_items[i]->moveToGround(unit->pos.x, unit->pos.y, unit->pos.z); if (is_gloves) { // if the reaction creates gloves without handedness, then create 2 sets (left and right)