//************************************************************************** //** //** ## ## ## ## ## #### #### ### ### //** ## ## ## ## ## ## ## ## ## ## #### #### //** ## ## ## ## ## ## ## ## ## ## ## ## ## ## //** ## ## ######## ## ## ## ## ## ## ## ### ## //** ### ## ## ### ## ## ## ## ## ## //** # ## ## # #### #### ## ## //** //** $Id: BasicArmorPickup.vc 2626 2007-08-11 16:08:53Z dj_jl $ //** //** Copyright (C) 1999-2006 Jānis Legzdiņš //** //** This program is free software; you can redistribute it and/or //** modify it under the terms of the GNU General Public License //** as published by the Free Software Foundation; either version 2 //** of the License, or (at your option) any later version. //** //** This program is distributed in the hope that it will be useful, //** but WITHOUT ANY WARRANTY; without even the implied warranty of //** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //** GNU General Public License for more details. //** //************************************************************************** class BasicArmorPickup : Armor abstract; int SaveAmount; float SavePercent; //========================================================================== // // CreateCopy // //========================================================================== Inventory CreateCopy(EntityEx Toucher) { BasicArmorPickup Copy = BasicArmorPickup(::CreateCopy(Toucher)); if (Copy) { Copy.SaveAmount = SaveAmount; Copy.SavePercent = SavePercent; } return Copy; } //========================================================================== // // Use // //========================================================================== bool Use(bool Pickup) { BasicArmor Armor = BasicArmor(EntityEx(Owner).FindInventory(BasicArmor)); if (!Armor) { Armor = Spawn(BasicArmor); Armor.AttachToOwner(EntityEx(Owner)); } else { // Can't use it if owner has more armor that is given by this one. if (Armor.Amount >= SaveAmount) { return false; } // Don't use if you are picking it up and already have some. if (Pickup && Armor.Amount > 0 && MaxAmount > 0) { return false; } } Armor.SavePercent = SavePercent; Armor.Amount = SaveAmount; return true; } defaultproperties { MaxAmount = 0; bAutoActivate = true; }