]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/tests.qc
Add a networked entity to hold weapon state
[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, this.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     .entity weaponentity = weaponentities[0]; // TODO: unhardcode
29     W_GiveWeapon(it, wep.m_id);
30     W_SwitchWeapon_Force(it, wep, weaponentity);
31
32     it = b;
33     PHYS_INPUT_BUTTON_JUMP(it) = true;
34     it.enemy = a;
35
36     defer(it, wep.switchdelay_raise + 0.1, test_weapons_hurt);
37
38     SUCCEED();
39 }
40
41 TEST(Vehicles, Spawn)
42 {
43     entity it;
44
45     noref Client bot = it = NEW(Client, "Rider");
46     Client_Add(it, NUM_TEAM_1);
47     it.origin = '0 0 100';
48
49     noref entity v = it = new(vehicle);
50     Vehicle veh = VEH_BUMBLEBEE;
51     it.active = ACTIVE_NOT;
52     vehicle_initialize(it, veh, false);
53     it.nextthink = time;
54
55     SUCCEED();
56 }