Skip to content

Commit

Permalink
Carcasses toss items that the player can't pick up. Fix towards #441
Browse files Browse the repository at this point in the history
  • Loading branch information
theastropath committed Aug 7, 2023
1 parent ad412de commit bef1840
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion DXRFixes/DeusEx/Classes/Carcass.uc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,22 @@ function Destroyed()
Super.Destroyed();
}

//Toss the item, but not very hard
function TossItem(Inventory inv, DeusExPlayer Frobber){
local float xVel,yVel;
local vector velocity;

DeleteInventory(inv);
class'DXRActorsBase'.static.ThrowItem(inv, 0.5);
inv.SetLocation( Location + vect(0,0,20));

velocity.X = ((FRand() - 0.5) * 2);
velocity.Y = ((FRand() - 0.5) * 2);
velocity.Z = 1;

inv.Velocity *= velocity;
}

// Frob stuff...
// ----------------------------------------------------------------------
// Frob()
Expand Down Expand Up @@ -256,9 +272,13 @@ function Frob(Actor Frobber, Inventory frobWith)
// and the player can't pickup this weapon, so the player at least knows
// if he empties some inventory he can get something potentially cooler
// than he already has.
if ((W == None) && (!player.FindInventorySlot(item, True)))
if ((W == None) && (!player.FindInventorySlot(item, True))){
P.ClientMessage(Sprintf(Player.InventoryFull, item.itemName));

//Also toss the item out of the carcass
TossItem(item,player);
}

// Only destroy the weapon if the player already has it.
if (W != None)
{
Expand Down Expand Up @@ -303,6 +323,8 @@ function Frob(Actor Frobber, Inventory frobWith)
else
{
P.ClientMessage(Sprintf(msgCannotPickup, invItem.itemName));
//Also toss the item out of the carcass
TossItem(item,player);
}
}
else
Expand Down Expand Up @@ -336,6 +358,8 @@ function Frob(Actor Frobber, Inventory frobWith)

P.ClientMessage(Item.PickupMessage @ Item.itemArticle @ Item.itemName, 'Pickup');
PlaySound(Item.PickupSound);
} else {
TossItem(item,player);
}
}
else
Expand Down

0 comments on commit bef1840

Please sign in to comment.