Xonotic
|
#include "items.qh"
#include <common/constants.qh>
#include <common/deathtypes/all.qh>
#include <common/gamemodes/gamemode/cts/cts.qh>
#include <common/items/_mod.qh>
#include <common/mapobjects/subs.qh>
#include <common/mapobjects/triggers.qh>
#include <common/monsters/_mod.qh>
#include <common/mutators/mutator/buffs/buffs.qh>
#include <common/mutators/mutator/buffs/sv_buffs.qh>
#include <common/mutators/mutator/powerups/_mod.qh>
#include <common/mutators/mutator/status_effects/_mod.qh>
#include <common/notifications/all.qh>
#include <common/resources/resources.qh>
#include <common/util.qh>
#include <common/weapons/_all.qh>
#include <common/wepent.qh>
#include <lib/warpzone/common.qh>
#include <lib/warpzone/util_server.qh>
#include <server/bot/api.qh>
#include <server/command/vote.qh>
#include <server/damage.qh>
#include <server/mutators/_mod.qh>
#include <server/teamplay.qh>
#include <server/weapons/common.qh>
#include <server/weapons/selection.qh>
#include <server/weapons/weaponsystem.qh>
#include <server/world.qh>
Go to the source code of this file.
Macros | |
#define | IS_SMALL(def) ((def.instanceOfHealth && def == ITEM_HealthSmall) || (def.instanceOfArmor && def == ITEM_ArmorSmall)) |
Functions | |
void | _StartItem (entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter) |
float | adjust_respawntime (float normal_respawntime) |
Adjust respawn time according to the number of players. More... | |
float | ammo_pickupevalfunc (entity player, entity item) |
AUTOCVAR (g_pickup_respawntime_scaling_reciprocal, float, 0.0, "Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of players, takes effect with 2 or more players present, `reciprocal` (with `offset` and `linear` set to 0) can be used to achieve a constant number of items spawned *per player*") | |
AUTOCVAR (g_pickup_respawntime_scaling_offset, float, 0.0, "Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of players, takes effect with 2 or more players present, `offset` offsets the curve left or right - the results are not intuitive and I recommend plotting the respawn time and the number of items per player to see what's happening") | |
AUTOCVAR (g_pickup_respawntime_scaling_linear, float, 1.0, "Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of players, takes effect with 2 or more players present, `linear` can be used to simply scale the respawn time linearly") | |
AUTOCVAR (g_pickup_respawntime_initial_random, int, 1, "For items that don't start spawned: 0: spawn after their normal respawntime; 1: spawn after `random * respawntime` with the *same* random; 2: same as 1 but each item has separate random") | |
float | generic_pickupevalfunc (entity player, entity item) |
bool | GiveBuff (entity e, Buff thebuff, int op, int val) |
float | GiveItems (entity e, float beginarg, float endarg) |
void | GiveRandomWeapons (entity receiver, int num_weapons, string weapon_names, entity ammo_entity) |
Give several random weapons and ammo to the entity. More... | |
bool | GiveResourceValue (entity e, Resource res_type, int op, int val) |
void | GiveRot (entity e, float v0, float v1,.float rotfield, float rottime,.float regenfield, float regentime) |
void | GiveSound (entity e, float v0, float v1, float t, Sound snd_incr, Sound snd_decr) |
bool | GiveStatusEffect (entity e, StatusEffects this, int op, float val) |
float | GiveWeapon (entity e, float wpn, float op, float val) |
bool | have_pickup_item (entity this) |
float | healtharmor_pickupevalfunc (entity player, entity item) |
void | Item_Damage (entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force) |
void | Item_FindTeam (entity this) |
bool | Item_GiveAmmoTo (entity item, entity player, Resource res_type, float ammomax) |
bool | Item_GiveTo (entity item, entity player) |
bool | Item_ItemsTime_Allow (GameItem it) |
void | Item_ItemsTime_SetTime (entity e, float t) |
void | Item_ItemsTime_SetTimesForAllPlayers () |
bool | Item_ItemsTime_SpectatorOnly (GameItem it) |
float | Item_ItemsTime_UpdateTime (entity e, float t) |
void | Item_Reset (entity this) |
void | Item_Respawn (entity this) |
void | Item_RespawnCountdown (entity this) |
void | Item_RespawnThink (entity this) |
void | Item_ScheduleInitialRespawn (entity e) |
void | Item_ScheduleRespawn (entity e) |
void | Item_ScheduleRespawnIn (entity e, float t) |
void | Item_Show (entity e, int mode) |
void | Item_Think (entity this) |
void | Item_Touch (entity this, entity toucher) |
void | item_use (entity this, entity actor, entity trigger) |
bool | ItemSend (entity this, entity to, int sf) |
void | ItemUpdate (entity this) |
void | RemoveItem (entity this) |
void | setItemGroup (entity this) |
void | setItemGroupCount () |
spawnfunc (target_items) | |
void | StartItem (entity this, GameItem def) |
void | target_items_use (entity this, entity actor, entity trigger) |
void | UpdateItemAfterTeleport (entity this) |
float | weapon_pickupevalfunc (entity player, entity item) |
Variables | |
int | group_count = 1 |
#define IS_SMALL | ( | def | ) | ((def.instanceOfHealth && def == ITEM_HealthSmall) || (def.instanceOfArmor && def == ITEM_ArmorSmall)) |
Definition at line 1168 of file items.qc.
Referenced by setItemGroup(), and setItemGroupCount().
void _StartItem | ( | entity | this, |
entity | def, | ||
float | defaultrespawntime, | ||
float | defaultrespawntimejitter | ||
) |
Definition at line 925 of file items.qc.
References angles, autocvar_g_items_dropped_lifetime, autocvar_g_items_maxdist, autocvar_g_items_mindist, autocvar_spawn_debug, bot_pickup, bot_pickupbasevalue, cnt, colormap, DAMAGE_YES, DPCONTENTS_NODROP, droptofloor, EF_NODRAW, effects, entity(), fade_end, fade_start, FL_ITEM, flags, float(), g_items, GetResource(), glowmod, gravity, have_pickup_item(), IL_PUSH(), InitializeEntity(), is_item, IT_KEY1, IT_KEY2, Item_Damage(), Item_FindTeam(), Item_IsExpiring(), Item_IsLoot(), Item_ItemsTime_SetTime(), item_model_ent, item_pickupsound, item_pickupsound_ent, Item_Reset(), Item_Touch(), item_use(), items, ItemSend(), max(), model, MOVE_NORMAL, MOVETYPE_NONE, MOVETYPE_TOSS, MUTATOR_CALLHOOK, netname, nextthink, noalign, origin, pickup_anyway, pos1, precache_sound(), REGISTRY_GET, RemoveItem(), RES_HEALTH, respawntime, respawntimejitter, set_movetype(), setItemGroup(), setmodel, setorigin(), setthink, skin, spawnflags, startitem_failed, state, strzone(), superweapons_finished, takedamage, target, targetname, team, time, trace_dpstartcontents, use, waypoint_spawnforitem(), weapon, and WepSet_FromWeapon.
Referenced by StartItem(), and weapon_defaultspawnfunc().
Adjust respawn time according to the number of players.
Definition at line 323 of file items.qc.
References entity(), NULL, NUM_TEAMS, players, TeamBalance_CheckAllowedTeams(), TeamBalance_Destroy(), TeamBalance_GetNumberOfPlayers(), TeamBalance_GetTeamCounts(), and TeamBalance_IsTeamAllowed().
Referenced by Item_ScheduleRespawn().
Definition at line 821 of file items.qc.
References ammo, entity(), FOREACH, g_pickup_cells_max, g_pickup_fuel_max, g_pickup_nails_max, g_pickup_plasma_max, g_pickup_rockets_max, g_pickup_shells_max, GetResource(), max(), min(), and NULL.
Referenced by weapon_pickupevalfunc().
AUTOCVAR | ( | g_pickup_respawntime_scaling_reciprocal | , |
float | , | ||
0. | 0, | ||
"Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of | players, | ||
takes effect with 2 or more players | present, | ||
`reciprocal`(with `offset` and `linear` set to 0) can be used to achieve a constant number of items spawned *per player *" | |||
) |
Referenced by Item_ScheduleRespawn(), and Item_ScheduleRespawnIn().
AUTOCVAR | ( | g_pickup_respawntime_scaling_offset | , |
float | , | ||
0. | 0, | ||
"Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of | players, | ||
takes effect with 2 or more players | present, | ||
`offset` offsets the curve left or right - the results are not intuitive and I recommend plotting the respawn time and the number of items per player to see what 's happening" | |||
) |
AUTOCVAR | ( | g_pickup_respawntime_scaling_linear | , |
float | , | ||
1. | 0, | ||
"Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of | players, | ||
takes effect with 2 or more players | present, | ||
`linear` can be used to simply scale the respawn time linearly" | |||
) |
AUTOCVAR | ( | g_pickup_respawntime_initial_random | , |
int | , | ||
1 | , | ||
"For items that don't start spawned: 0: spawn after their normal respawntime; 1: spawn after `random * respawntime` with the *same* random; 2: same as 1 but each item has separate random" | |||
) |
Definition at line 797 of file items.qc.
Referenced by buff_Init().
Definition at line 1395 of file items.qc.
References buff_RemoveAll(), max(), min(), OP_MAX, OP_MIN, OP_MINUS, OP_PLUS, OP_SET, STATUSEFFECT_REMOVE_CLEAR, and STATUSEFFECT_REMOVE_NORMAL.
Definition at line 1504 of file items.qc.
References argv(), autocvar_g_balance_pause_armor_rot, autocvar_g_balance_pause_fuel_regen, autocvar_g_balance_pause_fuel_rot, autocvar_g_balance_pause_health_regen, autocvar_g_balance_pause_health_rot, autocvar_g_balance_superweapons_time, BIT, buff_Available(), Buff_UndeprecateName(), cmd(), CS_CVAR, FOREACH, g_weaponarena, GiveBit(), GiveResourceValue(), GiveStatusEffect(), GiveWeapon(), items, GameItem::m_id, max(), MAX_WEAPONSLOTS, OP_MAX, OP_MIN, OP_MINUS, OP_PLUS, OP_SET, pauseregen_finished, pauserotarmor_finished, pauserotfuel_finished, pauserothealth_finished, POSTGIVE_BIT, POSTGIVE_RES_ROT, POSTGIVE_RESOURCE, POSTGIVE_STATUSEFFECT, POSTGIVE_WEAPON, PREGIVE, PREGIVE_RESOURCE, PREGIVE_STATUSEFFECT, PREGIVE_WEAPONS, RES_HEALTH, stof(), time, w_getbestweapon, W_SwitchWeapon_Force(), W_UndeprecateName(), weaponentities, WEP_FLAG_MUTATORBLOCKED, WEP_FLAG_SPECIALATTACK, WepSet_FromWeapon, and WEPSET_SUPERWEAPONS.
Referenced by CheatCommand(), and target_items_use().
void GiveRandomWeapons | ( | entity | receiver, |
int | num_weapons, | ||
string | weapon_names, | ||
entity | ammo_entity | ||
) |
Give several random weapons and ammo to the entity.
[in,out] | receiver | Entity to give weapons to. |
[in] | num_weapons | Number of weapons to give. |
[in] | weapon_names | Names of weapons to give separated by spaces. |
[in] | ammo | Entity containing the ammo amount for each possible weapon. |
Definition at line 406 of file items.qc.
References argv(), FOREACH, GetResource(), GiveResource(), NULL, RandomSelection_chosen_ent, RandomSelection_Init(), tokenize_console, and weapon.
Referenced by PutPlayerInServer().
Definition at line 1454 of file items.qc.
References GetResource(), max(), min(), OP_MAX, OP_MIN, OP_MINUS, OP_PLUS, OP_SET, and SetResourceExplicit().
Referenced by GiveItems().
void GiveRot | ( | entity | e, |
float | v0, | ||
float | v1, | ||
.float | rotfield, | ||
float | rottime, | ||
.float | regenfield, | ||
float | regentime | ||
) |
Definition at line 1431 of file items.qc.
References ATTEN_NORM, CH_TRIGGER, CH_TRIGGER_SINGLE, NULL, sound, and VOL_BASE.
bool GiveStatusEffect | ( | entity | e, |
StatusEffects | this, | ||
int | op, | ||
float | val | ||
) |
Definition at line 1471 of file items.qc.
References max(), min(), OP_MAX, OP_MIN, OP_MINUS, OP_PLUS, OP_SET, and STATUSEFFECT_REMOVE_NORMAL.
Referenced by GiveItems().
Definition at line 1364 of file items.qc.
References OP_MAX, OP_MIN, OP_MINUS, OP_PLUS, OP_SET, REGISTRY_GET, and WepSet_FromWeapon.
Referenced by GiveItems().
Definition at line 98 of file items.qc.
References autocvar_g_pickup_items, autocvar_g_powerups, g_weaponarena, and itemdef.
Referenced by _StartItem().
Definition at line 889 of file items.qc.
References GetResource(), max(), min(), and RES_HEALTH.
void Item_Damage | ( | entity | this, |
entity | inflictor, | ||
entity | attacker, | ||
float | damage, | ||
int | deathtype, | ||
.entity | weaponentity, | ||
vector | hitloc, | ||
vector | force | ||
) |
Definition at line 913 of file items.qc.
References ITEM_DAMAGE_NEEDKILL, and RemoveItem().
Referenced by _StartItem().
Definition at line 749 of file items.qc.
References EF_NODRAW, effects, entity(), ftos(), g_items, IL_EACH, LOG_TRACE, RandomSelection_chosen_ent, RandomSelection_Init(), and team.
Referenced by _StartItem().
Definition at line 451 of file items.qc.
References g_weapon_stay, GetResource(), GiveResourceWithLimit(), min(), and TakeResourceWithLimit().
Referenced by Item_GiveTo().
Definition at line 479 of file items.qc.
References autocvar_g_powerups_stack, BIT, CS_CVAR, FOREACH, g_cts, g_pickup_cells_max, g_pickup_fuel_max, g_pickup_nails_max, g_pickup_plasma_max, g_pickup_rockets_max, g_pickup_shells_max, Item_GiveAmmoTo(), GameItem::m_id, max(), MAX_WEAPONSLOTS, REGISTRY_GET, RES_HEALTH, time, w_getbestweapon, W_GiveWeapon(), W_SwitchWeapon_Force(), weaponentities, and WepSet_FromWeapon.
Referenced by WeaponPickup::WeaponPickup ::WeaponPickup().
Definition at line 64 of file itemstime.qc.
References autocvar__hud_configure, autocvar_hud_progressbar_alpha, blink(), bound(), CBC_ORDER_LAST, ceil(), ClientConnect(), color, count, DRAWFLAG_NORMAL, drawpic_aspect_skin, drawpic_aspect_skin_expanding(), drawstring_aspect(), entity(), eX, floor(), FOREACH, FOREACH_CLIENT, ftos(), g_items, hud_configure_menu_open, HUD_GetRowCount(), HUD_ItemsTime(), HUD_Panel_DrawBg, HUD_Panel_DrawProgressBar(), HUD_Panel_LoadCvars(), HUD_Scale_Enable(), HUD_Write_Cvar, if(), IL_EACH, IS_PLAYER, IS_REAL_CLIENT, Item_ItemsTime_Allow(), Item_ItemsTime_SetTime(), Item_ItemsTime_SetTimesForAllPlayers(), Item_ItemsTime_SpectatorOnly(), Item_ItemsTime_UpdateTime(), M_ARGV, GameItem::m_id, max(), MUTATOR_HOOKFUNCTION, panel_bg_padding, panel_fg_alpha, panel_pos, panel_size, precache_pic(), REGISTRY_MAX, spectatee_status, STATIC_INIT, time, vec2, vector(), warmup_stage, and WEPSET_SUPERWEAPONS.
Referenced by Item_ItemsTime_Allow(), Item_Respawn(), Item_ScheduleRespawnIn(), and Item_Think().
Referenced by _StartItem(), Item_ItemsTime_Allow(), Item_Respawn(), Item_ScheduleRespawnIn(), and Item_Think().
void Item_ItemsTime_SetTimesForAllPlayers | ( | ) |
Referenced by Item_ItemsTime_Allow(), Item_Respawn(), Item_ScheduleRespawnIn(), and Item_Think().
Definition at line 56 of file itemstime.qc.
References hud_panel_itemstime_hidebig.
Referenced by Item_ItemsTime_Allow(), Item_RespawnCountdown(), and Item_Think().
Referenced by Item_ItemsTime_Allow(), Item_Respawn(), Item_ScheduleRespawnIn(), and Item_Think().
Definition at line 728 of file items.qc.
References Item_IsLoot(), Item_ScheduleInitialRespawn(), Item_Show(), Item_Think(), itemdef, nextthink, origin, setorigin(), setthink, state, time, and WEPSET_SUPERWEAPONS.
Referenced by _StartItem().
Definition at line 198 of file items.qc.
References ATTEN_NORM, CENTER_OR_VIEWOFS, CH_TRIGGER, Item_ItemsTime_Allow(), Item_ItemsTime_SetTime(), Item_ItemsTime_SetTimesForAllPlayers(), Item_ItemsTime_UpdateTime(), Item_Show(), Item_Think(), itemdef, nextthink, origin, setorigin(), setthink, sound, time, VOL_BASE, and WEPSET_SUPERWEAPONS.
Referenced by Item_RespawnCountdown(), and Item_RespawnThink().
Definition at line 218 of file items.qc.
References ATTEN_NORM, CH_TRIGGER, entity(), FOREACH_CLIENT, IS_REAL_CLIENT, Item_ItemsTime_SpectatorOnly(), Item_Respawn(), ITEM_RESPAWN_TICKS, Item_RespawnCountdown(), item_respawncounter, itemdef, msg_entity, MSG_ONE, MUTATOR_CALLHOOK, nextthink, NULL, REGISTRY_GET, SND, SPRITERULE_SPECTATOR, time, VOL_BASE, and weapon.
Referenced by Item_RespawnCountdown(), and Item_ScheduleRespawnIn().
Definition at line 276 of file items.qc.
References Item_Respawn(), ItemUpdate(), nextthink, oldorigin, origin, time, and wait.
Referenced by Item_ScheduleRespawnIn().
Definition at line 371 of file items.qc.
References floor(), ITEM_RESPAWN_TICKS, Item_ScheduleRespawnIn(), Item_Show(), max(), random(), and time.
Referenced by Item_Reset().
Definition at line 351 of file items.qc.
References adjust_respawntime(), AUTOCVAR(), crandom, Item_ScheduleRespawnIn(), and Item_Show().
Referenced by Item_ScheduleRespawnIn(), Item_Touch(), and MUTATOR_HOOKFUNCTION().
Definition at line 286 of file items.qc.
References AUTOCVAR(), Item_ItemsTime_Allow(), Item_ItemsTime_SetTime(), Item_ItemsTime_SetTimesForAllPlayers(), Item_ItemsTime_UpdateTime(), ITEM_RESPAWN_TICKS, Item_RespawnCountdown(), Item_RespawnThink(), Item_ScheduleRespawn(), max(), MUTATOR_CALLHOOK, setthink, time, and WEPSET_SUPERWEAPONS.
Referenced by Item_ScheduleInitialRespawn(), and Item_ScheduleRespawn().
Definition at line 120 of file items.qc.
References autocvar_g_fullbrightitems, autocvar_g_nodepthtestitems, autocvar_sv_simple_items, EF_ADDITIVE, EF_FULLBRIGHT, EF_NODEPTHTEST, EF_STARDUST, entity(), g_weapon_stay, setorigin(), SOLID_NOT, SOLID_TRIGGER, string_null, and WEPSET_SUPERWEAPONS.
Referenced by Item_Reset(), Item_Respawn(), Item_ScheduleInitialRespawn(), Item_ScheduleRespawn(), and Item_Touch().
Definition at line 185 of file items.qc.
References entity(), Item_ItemsTime_Allow(), Item_ItemsTime_SetTime(), Item_ItemsTime_SetTimesForAllPlayers(), Item_ItemsTime_SpectatorOnly(), Item_ItemsTime_UpdateTime(), ItemUpdate(), nextthink, oldorigin, origin, and time.
Referenced by Item_Reset(), and Item_Respawn().
Definition at line 631 of file items.qc.
References _sound, ATTEN_NORM, CENTER_OR_VIEWOFS, CH_TRIGGER, CH_TRIGGER_SINGLE, entity(), g_items, IL_EACH, IS_DEAD, ITEM_HANDLE, Item_IsExpiring(), Item_IsLoot(), item_pickupsound_ent, Item_ScheduleRespawn(), Item_Show(), item_spawnshieldtime, ITEM_TOUCH_NEEDKILL, itemdef, LABEL, M_ARGV, max(), MUT_ITEMTOUCH_PICKUP, MUT_ITEMTOUCH_RETURN, MUTATOR_CALLHOOK, NULL, owner, RandomSelection_chosen_ent, RandomSelection_Init(), solid, SOLID_TRIGGER, Sound_fixpath, spawnshieldtime, SUB_UseTargets(), superweapons_finished, target, team, time, and VOL_BASE.
Referenced by _StartItem().
Definition at line 919 of file items.qc.
Referenced by _StartItem().
Definition at line 31 of file items.qc.
References angles, bound(), classname, colormap, fade_end, fade_start, glowmod, gravity, LOG_TRACE, origin, skin, velocity, WriteByte(), WriteShort(), and WriteString().
Referenced by _StartItem(), UpdateCSQCProjectile(), and UpdateItemAfterTeleport().
Definition at line 86 of file items.qc.
References oldorigin, and origin.
Referenced by Item_RespawnThink(), Item_Think(), UpdateCSQCProjectile(), and UpdateItemAfterTeleport().
Definition at line 787 of file items.qc.
References CENTER_OR_VIEWOFS.
Referenced by _StartItem(), and Item_Damage().
Definition at line 1171 of file items.qc.
References IS_SMALL, Item_IsLoot(), itemdef, and origin.
Referenced by _StartItem().
void setItemGroupCount | ( | ) |
spawnfunc | ( | target_items | ) |
Definition at line 1242 of file items.qc.
References argv(), argv_end_index, argv_start_index, autocvar_g_balance_superweapons_time, error(), FOREACH, GetResource(), items, max(), netname, RES_HEALTH, spawnflags, string_null, strzone(), substring(), superweapons_finished, target_items_use(), tokenize_console, use, and W_UndeprecateName().
Definition at line 1148 of file items.qc.
References _StartItem(), classname, ITEM_FLAG_MUTATORBLOCKED, and itemdef.
Referenced by instagib_extralife(), instagib_invisibility(), instagib_speed(), lms_extralife(), and monster_dropitem().
Definition at line 1216 of file items.qc.
References centerprint(), EXACTTRIGGER_TOUCH, g_items, GiveItems(), IL_EACH, IS_DEAD, IS_PLAYER, Item_IsLoot(), message, netname, SOLID_TRIGGER, and tokenize_console.
Referenced by spawnfunc().
Definition at line 92 of file items.qc.
References getSendEntity, ItemSend(), and ItemUpdate().
Referenced by TeleportPlayer(), and WarpZone_PostTeleportPlayer_Callback().
Definition at line 799 of file items.qc.
References ammo_pickupevalfunc(), bound(), and FOREACH.
int group_count = 1 |
Definition at line 1169 of file items.qc.
Referenced by setItemGroupCount().