rott/kf_sources/AcediaCore/Classes/EWeapon.uc
2026-07-14 20:27:09 +07:00

60 lines
2.1 KiB
Ucode

/**
* Author: dkanus
* Home repo: https://www.insultplayers.ru/git/AcediaFramework/AcediaCore
* License: GPL
* Copyright 2022-2024 Anton Tarasenko
*------------------------------------------------------------------------------
* This file is part of Acedia.
*
* Acedia 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, version 3 of the License, or
* (at your option) any later version.
*
* Acedia 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.
*
* You should have received a copy of the GNU General Public License
* along with Acedia. If not, see <https://www.gnu.org/licenses/>.
*/
class EWeapon extends EItem
abstract;
//! Represents the abstract interface for any type of weapon.
/// Retrieves an array of [`EAmmo`] items from the weapon owner's inventory that
/// are compatible with this weapon.
///
/// The returned array is guaranteed to contain valid references, with no `none`
/// values or nonexistent entities.
public function array<EAmmo> GetAvailableAmmo() {
local array<EAmmo> emptyArray;
return emptyArray;
}
/// Fills all compatible ammo items from the weapon owner's inventory for this
/// weapon in the order returned by [`GetAvailableAmmo()`].
///
/// The filling process relies on the implementation of [`GetAvailableAmmo()`]
/// to determine the order of items.
/// See [`EAmmo::Fill()`] for the specific filling logic.
///
/// Note: The filling order is not guaranteed to remain consistent across calls,
/// as it depends on the implementation of [`GetAvailableAmmo()`].
public final function FillAmmo() {
local int i;
local array<EAmmo> myAmmo;
myAmmo = GetAvailableAmmo();
for (i = 0; i < myAmmo.length; i += 1) {
myAmmo[i].Fill();
}
_.memory.FreeMany(myAmmo);
}
defaultproperties {
}