Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
tests.qc
Go to the documentation of this file.
1#include "tests.qh"
2
4{
5 EXPECT_NE(100, GetResource(this, RES_HEALTH));
6 delete(this.enemy);
7 delete(this);
8}
9
11{
12 entity it;
13
14 noref Client a = it = NEW(Client, "A");
15 WITH(float, autocvar_g_spawnshieldtime, 0, Client_Add(it, NUM_TEAM_1));
16 it.origin = '-100 0 0';
17 it.angles = '0 0 0';
18
19 noref Client b = it = NEW(Client, "B");
20 WITH(float, autocvar_g_spawnshieldtime, 0, Client_Add(it, NUM_TEAM_2));
21 it.origin = '100 0 0';
22 it.angles = '0 180 0';
23
24 it = a;
25 PHYS_INPUT_BUTTON_ATCK(it) = true;
26 it.items |= IT_UNLIMITED_AMMO;
27 Weapon wep = WEP_VORTEX;
28 W_GiveWeapon(it, wep.m_id);
30
31 it = b;
32 PHYS_INPUT_BUTTON_JUMP(it) = true;
33 it.enemy = a;
34
35 defer(it, wep.switchdelay_raise + 0.1, test_weapons_hurt);
36
37 SUCCEED();
38}
39
40TEST(Vehicles, Spawn)
41{
42 entity it;
43
44 noref Client bot = it = NEW(Client, "Rider");
45 Client_Add(it, NUM_TEAM_1);
46 it.origin = '0 0 100';
47
48 noref entity v = it = new(vehicle);
49 Vehicle veh = VEH_BUMBLEBEE;
50 it.active = ACTIVE_NOT;
51 vehicle_initialize(it, veh, false);
52 it.nextthink = time;
53
54 SUCCEED();
55}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
Definition weapon.qh:44
int m_id
Definition weapon.qh:45
const int IT_UNLIMITED_AMMO
Definition item.qh:23
#define PHYS_INPUT_BUTTON_JUMP(s)
Definition player.qh:151
#define PHYS_INPUT_BUTTON_ATCK(s)
Definition player.qh:150
float time
void W_SwitchWeapon_Force(Player this, Weapon w,.entity weaponentity)
Definition selection.qc:246
void defer(entity this, float fdelay, void(entity) func)
Execute func() after time + fdelay.
Definition defer.qh:29
const int ACTIVE_NOT
Definition defs.qh:36
Weapons
Definition guide.qh:113
#define WITH(type, name, value, block)
Definition misc.qh:37
#define NEW(cname,...)
Definition oo.qh:117
float autocvar_g_spawnshieldtime
Definition player.qh:3
void W_GiveWeapon(entity e, int wep)
Definition common.qc:33
entity enemy
Definition sv_ctf.qh:153
bool vehicle_initialize(entity this, Vehicle info, bool nodrop)
entity vehicle
Entity to disply the shild effect on damage.
const int NUM_TEAM_2
Definition teams.qh:14
const int NUM_TEAM_1
Definition teams.qh:13
#define TEST(suite, test)
Use UpperCamelCase for suite and test only.
Definition test.qh:6
#define EXPECT_NE(val1, val2)
Definition test.qh:52
#define SUCCEED()
Must be present at the end of a test.
Definition test.qh:15
void test_weapons_hurt(entity this)
Definition tests.qc:3
entity weaponentities[MAX_WEAPONSLOTS]
Definition weapon.qh:17