Xonotic
|
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 | |
float | GetResource (entity e, Resource res_type) |
Returns the current amount of resource the given entity has. More... | |
float | GetResourceLimit (entity e, Resource res_type) |
Returns the maximum amount of the given resource. More... | |
void | GiveResource (entity receiver, Resource res_type, float amount) |
Gives an entity some resource. More... | |
void | GiveResourceWithLimit (entity receiver, Resource res_type, float amount, float limit) |
Gives an entity some resource but not more than a limit. More... | |
void | SetResource (entity e, Resource res_type, float amount) |
Sets the current amount of resource the given entity will have. More... | |
bool | SetResourceExplicit (entity e, Resource res_type, float amount) |
Sets the resource amount of an entity without calling any hooks. More... | |
void | TakeResource (entity receiver, Resource res_type, float amount) |
Takes an entity some resource. More... | |
void | TakeResourceWithLimit (entity receiver, Resource res_type, float amount, float limit) |
Takes an entity some resource but not less than a limit. More... | |
Source file that contains implementation of the resource system.
Definition in file sv_resources.qc.
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 76 of file sv_resources.qc.
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, error(), g_pickup_cells_max, g_pickup_nails_max, g_pickup_plasma_max, g_pickup_rockets_max, g_pickup_shells_max, GetResourceLimit(), IS_PLAYER, M_ARGV, MUTATOR_CALLHOOK, RES_AMOUNT_HARD_LIMIT, RES_HEALTH, and RES_LIMIT_NONE.
Referenced by GetResourceLimit(), 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 120 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_HEALTH, SetResource(), and time.
Referenced by GiveRandomWeapons(), GiveResource(), GiveResourceWithLimit(), Monster_Miniboss_Check(), 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 164 of file sv_resources.qc.
References entity(), GetResource(), GiveResource(), GiveResourceWithLimit(), M_ARGV, MUTATOR_CALLHOOK, and RES_LIMIT_NONE.
Referenced by destructible_heal(), GiveResourceWithLimit(), Item_GiveAmmoTo(), Monster_Heal(), ons_ControlPoint_Icon_Heal(), ons_ControlPoint_Icon_Think(), ons_GeneratorHeal(), PlayerHeal(), and vehicles_heal().
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 92 of file sv_resources.qc.
References entity(), GetResourceLimit(), M_ARGV, MUTATOR_CALLHOOK, RES_LIMIT_NONE, 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 81 of file sv_resources.qc.
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 190 of file sv_resources.qc.
References entity(), GetResource(), M_ARGV, MUTATOR_CALLHOOK, and SetResource().
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 210 of file sv_resources.qc.
References entity(), GetResource(), M_ARGV, MUTATOR_CALLHOOK, and TakeResource().