func and airdrop

This commit is contained in:
Your Name
2020-08-17 10:46:56 -06:00
parent e143a65941
commit 86097d7d51
4 changed files with 67 additions and 21 deletions

View File

@ -126,6 +126,7 @@ init()
level thread fixGamemodes();
level thread onPlayerConnect();
level thread addNotifyOnAirdrops();
level thread handleBots();
}
@ -201,6 +202,38 @@ fixGamemodes()
}
}
addNotifyOnAirdrops()
{
for (;;)
{
wait 1;
dropCrates = getEntArray( "care_package", "targetname" );
for (i = dropCrates.size - 1; i >= 0; i--)
{
airdrop = dropCrates[i];
if (!isDefined(airdrop.owner))
continue;
if (isDefined(airdrop.doingPhysics))
continue;
airdrop.doingPhysics = true;
airdrop thread doNotifyOnAirdrop();
}
}
}
doNotifyOnAirdrop()
{
self endon( "death" );
self waittill( "physics_finished" );
self.doingPhysics = false;
self.owner notify("crate_physics_done");
}
/*
Thread when any player connects. Starts the threads needed.
*/