iw5: test guns #4

Merged
Future merged 3 commits from iw5/test-guns into main 2024-05-31 09:59:14 +00:00
5 changed files with 41 additions and 4 deletions
Showing only changes of commit d10cea3ed5 - Show all commits

View File

@ -4,6 +4,7 @@ def erase_commented_lines(filename, out):
with open(filename, 'r') as file: with open(filename, 'r') as file:
lines = file.readlines() lines = file.readlines()
# gcc leaves these "comments" at the start of the file
lines = [line for line in lines if not line.startswith('#')] lines = [line for line in lines if not line.startswith('#')]
with open(out, 'w') as file: with open(out, 'w') as file:

View File

@ -15,7 +15,7 @@ jobs:
- name: Create release - name: Create release
run: | run: |
bash -e .gitea/scripts/ci.sh ./.gitea/scripts/ci.sh
- name: Upload release - name: Upload release
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3

View File

@ -3,6 +3,7 @@
init() init()
{ {
setDvar( "bg_bounces", 1 ); setDvar( "bg_bounces", 1 );
setDvar( "player_sustainAmmo", 1 ); // Requires sv_cheats
thread onPlayerConnect(); thread onPlayerConnect();
} }
@ -33,7 +34,7 @@ onPlayerSpawned()
{ {
self endon( "disconnect" ); self endon( "disconnect" );
for ( ;; ) while ( true )
{ {
self waittill( "spawned_player" ); self waittill( "spawned_player" );
@ -57,7 +58,7 @@ onWeaponFired()
level endon( "game_ended" ); level endon( "game_ended" );
self endon( "disconnected" ); self endon( "disconnected" );
for ( ;; ) while ( true )
{ {
self waittill( "weapon_fired", weapon ); self waittill( "weapon_fired", weapon );
@ -92,7 +93,7 @@ displaySpeed()
if ( isDefined( self.last_rpg_shot ) && self.last_rpg_shot != 0 ) if ( isDefined( self.last_rpg_shot ) && self.last_rpg_shot != 0 )
{ {
late = getTime() - self.last_rpg_shot; late = getTime() - self.last_rpg_shot;
if (late < 500) if (late <= 500)
{ {
iPrintLn( "Late RPG (+" + (late) + ")" ); iPrintLn( "Late RPG (+" + (late) + ")" );
} }

View File

@ -19,6 +19,7 @@ _ON_PLAYER_CNCT_BEGIN
PLAYER_NOTIFY_CMD( player, "save_pos", "+reload" ); PLAYER_NOTIFY_CMD( player, "save_pos", "+reload" );
PLAYER_NOTIFY_CMD( player, "load_saved_pos", "+activate" ); PLAYER_NOTIFY_CMD( player, "load_saved_pos", "+activate" );
player thread onWeaponFired();
player thread jumper(); player thread jumper();
player thread displaySpeed(); player thread displaySpeed();
@ -26,6 +27,21 @@ _ON_PLAYER_CNCT_BEGIN
_ON_PLAYER_CNCT_END _ON_PLAYER_CNCT_END
onWeaponFired()
{
GENERIC_COROUTINE_END
while ( true )
{
self waittill( "weapon_fired", weapon );
if (weapon == "rpg_mp")
{
self.last_rpg_shot = getTime();
}
}
}
displaySpeed() displaySpeed()
{ {
GENERIC_COROUTINE_END; GENERIC_COROUTINE_END;
@ -36,12 +52,30 @@ displaySpeed()
self.speed_text.label = &""; self.speed_text.label = &"";
self.last_speed_sample = 0; self.last_speed_sample = 0;
self.last_z_coordinate = 0.0;
while ( true ) while ( true )
{ {
player_speed = distance( ZERO_VEC3, self getvelocity() ); player_speed = distance( ZERO_VEC3, self getvelocity() );
current_speed = int( player_speed ); current_speed = int( player_speed );
if ( self.origin[2] > self.last_z_coordinate )
{
// We should be going up
if ( isDefined( self.last_rpg_shot ) && self.last_rpg_shot != 0 )
{
late = getTime() - self.last_rpg_shot;
if (late <= 500)
{
iPrintLn( "Late RPG (+" + (late) + ")" );
}
self.last_rpg_shot = 0;
}
}
self.last_z_coordinate = self.origin[2];
if ( self.last_speed_sample == current_speed ) if ( self.last_speed_sample == current_speed )
{ {
// White // White

View File

@ -48,6 +48,7 @@
init() \ init() \
{ \ { \
setDvar( BOUNCES_DVAR, 1 ); \ setDvar( BOUNCES_DVAR, 1 ); \
setDvar( "player_sustainAmmo", 1 ); \
thread onPlayerConnect(); \ thread onPlayerConnect(); \
} }