mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-01-19 16:14:44 +00:00
Flag Ceiling fix
This commit is contained in:
parent
e93efa685c
commit
9e87ca02a0
|
|
@ -5,7 +5,7 @@ $flagSimTime = 60;//note a higher the time, the larger the sweep scans will be
|
|||
$flagCheckRadius = 50;
|
||||
$playerBoxA = "-0.6 -0.6 0";
|
||||
$playerBoxB = "0.6 0.6 2.3";
|
||||
|
||||
$flagStuckTime = 1000;
|
||||
package flagFix{
|
||||
function CTFGame::startFlagCollisionSearch(%game, %flag){
|
||||
parent::startFlagCollisionSearch(%game, %flag);
|
||||
|
|
@ -35,6 +35,7 @@ package flagFix{
|
|||
if(!isEventPending(Game.flagLoop)){
|
||||
%game.atHomeFlagLoop();
|
||||
}
|
||||
%game.fcs = getSimTime();
|
||||
}
|
||||
|
||||
function SCtFGame::startMatch(%game){
|
||||
|
|
@ -56,6 +57,19 @@ package flagFix{
|
|||
activatePackage(flagFix);
|
||||
|
||||
function DefaultGame::flagColTest(%game, %flag){
|
||||
if( !%flag.isHome ){// keeps flags from getting stuck in ceilings
|
||||
%flag.stuckChkTimer += $flagSimTime;
|
||||
if(%flag.stuckChkTimer > $flagStuckTime){
|
||||
%fpos = %flag.getPosition();
|
||||
%upRay = containerRayCast(%fpos, vectorAdd(%fpos,"0 0 2.4"), $TypeMasks::InteriorObjectType | $TypeMasks::StaticObjectType | $TypeMasks::ForceFieldObjectType, %flag);
|
||||
if(%upRay){
|
||||
%dist = vectorDist(%fpos,getWords(%upRay,1,3));
|
||||
//error(%dist);
|
||||
%flag.setPosition(vectorSub(%fpos,"0 0" SPC (2.5 - %dist)));
|
||||
}
|
||||
%flag.stuckChkTimer = 0;
|
||||
}
|
||||
}
|
||||
%Box2 = %flag.getWorldBox();
|
||||
InitContainerRadiusSearch( %flag.getWorldBoxCenter(), $flagCheckRadius, $TypeMasks::PlayerObjectType);
|
||||
while((%player = containerSearchNext()) != 0){
|
||||
|
|
|
|||
|
|
@ -319,3 +319,7 @@ function TSStatic::onTrigger(%this, %triggerId, %on){
|
|||
function TSStatic::onTriggerTick(%this, %triggerId){
|
||||
//anti console spam
|
||||
}
|
||||
|
||||
function SimObject::setPosition(%obj, %pos){
|
||||
%obj.setTransform(%pos SPC getWords(%obj.getTransform(), 3, 6));
|
||||
}
|
||||
Loading…
Reference in a new issue