|
Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
|
|
Source file that contains implementation of the resource system. More...
#include "sv_resources.qh"#include <common/resources/resources.qh>#include <server/mutators/_mod.qh>#include <server/world.qh>Go to the source code of this file.
Functions | |
| int | GetAmmoConsumption (entity wpn) |
| Returns ammo consumed per shot by the primary/default fire mode. | |
| float | GetResource (entity e, Resource res_type) |
| Returns the current amount of resource the given entity has. | |
| float | GetResourceLimit (entity e, Resource res_type) |
| Returns the maximum amount of the given resource. | |
| void | GiveResource (entity receiver, Resource res_type, float amount) |
| Gives an entity some resource. | |
| void | GiveResourceWithLimit (entity receiver, Resource res_type, float amount, float limit) |
| Gives an entity some resource but not more than a limit. | |
| void | SetResource (entity e, Resource res_type, float amount) |
| Sets the current amount of resource the given entity will have. | |
| bool | SetResourceExplicit (entity e, Resource res_type, float amount) |
| Sets the resource amount of an entity without calling any hooks. | |
| void | TakeResource (entity receiver, Resource res_type, float amount) |
| Takes an entity some resource. | |
| void | TakeResourceWithLimit (entity receiver, Resource res_type, float amount, float limit) |
| Takes an entity some resource but not less than a limit. | |
Source file that contains implementation of the resource system.
Definition in file sv_resources.qc.
Returns ammo consumed per shot by the primary/default fire mode.
| [in] | wpn | Weapon entity |
Definition at line 231 of file sv_resources.qc.
References ammo, entity(), WEP_CVAR, and WEP_CVAR_PRI.
Referenced by weapon_defaultspawnfunc().
Returns the current amount of resource the given entity has.
| [in] | e | Entity to check. |
| [in] | res_type | Type of the resource (a RES_* constant). |
Definition at line 71 of file sv_resources.qc.
References entity().
Referenced by GiveResource(), GiveResourceWithLimit(), TakeResource(), and TakeResourceWithLimit().
Returns the maximum amount of the given resource.
| [in] | e | Entity to check. |
| [in] | res_type | Type of the resource (a RES_* constant). |
Definition at line 12 of file sv_resources.qc.
References autocvar_g_balance_armor_limit, autocvar_g_balance_fuel_limit, autocvar_g_balance_health_limit, autocvar_g_pickup_cells_max, autocvar_g_pickup_nails_max, autocvar_g_pickup_rockets_max, autocvar_g_pickup_shells_max, entity(), error, GetResourceLimit(), IS_PLAYER, M_ARGV, MUTATOR_CALLHOOK, RES_AMOUNT_HARD_LIMIT, RES_ARMOR, and RES_LIMIT_NONE.
Referenced by ammo_pickupevalfunc(), GetResourceLimit(), MUTATOR_HOOKABLE(), RotRegen(), and SetResource().
Gives an entity some resource.
| [in,out] | receiver | Entity to give resource to. |
| [in] | res_type | Type of the resource (a RES_* constant). |
| [in] | amount | Amount of resource to give. |
Definition at line 115 of file sv_resources.qc.
References autocvar_g_balance_pause_armor_rot, autocvar_g_balance_pause_fuel_rot, autocvar_g_balance_pause_health_rot, entity(), GetResource(), GiveResource(), M_ARGV, max(), MUTATOR_CALLHOOK, RES_ARMOR, SetResource(), and time.
Referenced by GiveRandomWeapons(), GiveResource(), GiveResourceWithLimit(), Monster_Miniboss_Setup(), MUTATOR_HOOKABLE(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), NIX_GiveCurrentWeapon(), ons_ControlPoint_Icon_BuildThink(), and W_ThrowNewWeapon().
Gives an entity some resource but not more than a limit.
| [in,out] | receiver | Entity to give resource to. |
| [in] | res_type | Type of the resource (a RES_* constant). |
| [in] | amount | Amount of resource to give. |
| [in] | limit | Limit of resources to give. |
Definition at line 159 of file sv_resources.qc.
References entity(), GetResource(), GiveResource(), GiveResourceWithLimit(), M_ARGV, MUTATOR_CALLHOOK, and RES_LIMIT_NONE.
Referenced by bumblebee_pilot_frame(), destructible_heal(), GiveResourceWithLimit(), Item_GiveAmmoTo(), M_Mage_Defend_Heal(), Monster_Heal(), MUTATOR_HOOKABLE(), nade_heal_touch(), ons_ControlPoint_Icon_Heal(), ons_ControlPoint_Icon_Think(), ons_GeneratorHeal(), PlayerHeal(), turret_heal(), vehicles_heal(), and W_Arc_Beam_Think().
Sets the current amount of resource the given entity will have.
Sets the current amount of resource the given entity will have but limited to the max amount allowed for the resource type.
| [in,out] | e | Entity to adjust. |
| [in] | res_type | Type of the resource (a RES_* constant). |
| [in] | amount | Amount of resource to set. |
Definition at line 87 of file sv_resources.qc.
References entity(), GetResourceLimit(), M_ARGV, MUTATOR_CALLHOOK, RES_LIMIT_NONE, SetResource(), and SetResourceExplicit().
Referenced by GiveResource(), and TakeResource().
Sets the resource amount of an entity without calling any hooks.
| [in,out] | e | Entity to adjust. |
| [in] | res_type | Type of the resource (a RES_* constant). |
| [in] | amount | Amount of resource to set. |
Definition at line 76 of file sv_resources.qc.
References entity(), and GetResourceField().
Referenced by SetResource().
Takes an entity some resource.
| [in,out] | receiver | Entity to take resource from. |
| [in] | res_type | Type of the resource (a RES_* constant). |
| [in] | amount | Amount of resource to take. |
Definition at line 185 of file sv_resources.qc.
References entity(), GetResource(), M_ARGV, MUTATOR_CALLHOOK, SetResource(), and TakeResource().
Referenced by TakeResourceWithLimit().
Takes an entity some resource but not less than a limit.
| [in,out] | receiver | Entity to take resource from. |
| [in] | res_type | Type of the resource (a RES_* constant). |
| [in] | amount | Amount of resource to take. |
| [in] | limit | Limit of resources to take. |
Definition at line 205 of file sv_resources.qc.
References entity(), GetResource(), M_ARGV, MUTATOR_CALLHOOK, TakeResource(), and TakeResourceWithLimit().