]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/tests.qc
Merge branch 'master' into Mario/weaponorder
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / tests.qc
1 #include "tests.qh"
2
3 void test_weapons_hurt(entity this)
4 {
5     EXPECT_NE(100, GetResource(this, RES_HEALTH));
6     delete(this.enemy);
7     delete(this);
8 }
9
10 TEST(Weapons, Hurt)
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);
29     W_SwitchWeapon_Force(it, wep, weaponentities[0]);
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
40 TEST(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 }