1
0
forked from 0ad/0ad

XML/JS fixes to movement and terrain conformance.

This was SVN commit r4338.
This commit is contained in:
Matei 2006-09-16 20:11:42 +00:00
parent b0e7085fb9
commit cd792eeb8e
7 changed files with 15 additions and 25 deletions

View File

@ -6,7 +6,7 @@
<Anchor>
<Type>Ground</Type>
<!-- If negative or > 90.0, entity will always conform to terrain (assuming traits.pitch allows it) -->
<ConformX>0</ConformX>
<ConformX>3.141592</ConformX>
<ConformZ>3.141592</ConformZ>
</Anchor>
</Traits>

View File

@ -6,7 +6,7 @@
<Anchor>
<Type>Ground</Type>
<!-- If negative or > 90.0, entity will always conform to terrain (assuming traits.pitch allows it) -->
<ConformX>0</ConformX>
<ConformX>3.141592</ConformX>
<ConformZ>3.141592</ConformZ>
</Anchor>
</Traits>

View File

@ -71,7 +71,7 @@
<Pitch>
<Sectors>7</Sectors>
<Value>.1</Value>
<Value>0.2</Value>
</Pitch>
<IsTerritoryCentre>false</IsTerritoryCentre>

View File

@ -22,7 +22,6 @@
<Event On="Notification" Function="entityEventNotification" />
<Event On="Formation" Function="entityEventFormation" />
<Event On="Idle" Function="entityEventIdle" />
<Event On="Movement" Function="entityEventMovement" />
<Event On="Death" Function="entityDestroyed" />
<Event On="Initialize" Function="entityInit" />
</Entity>

View File

@ -46,6 +46,11 @@
<Promotion>
<Req>900</Req>
</Promotion>
<Anchor>
<ConformX>3.141592</ConformX>
<ConformZ>3.141592</ConformZ>
</Anchor>
</Traits>
<Actions>

View File

@ -15,6 +15,11 @@
</Id>
<Anchor>
<ConformX>3.141592</ConformX>
<ConformZ>3.141592</ConformZ>
</Anchor>
</Traits>
</Entity>

View File

@ -1049,33 +1049,14 @@ function entityComplete()
{
console.write( this + " is finished building." );
}
//=====================================================================
function entityEventIdle( evt )
{
//Use our own data for target; we aren't affecting anyone, so listeners want to know about us
this.forceCheckListeners( NOTIFY_IDLE, this );
}
//=====================================================================
function entityEventMovement( evt )
{
var divs = this.traits.pitch.sectors;
var sector = this.findSector( divs, evt.slope, 3.141592, true );
if ( divs % 2 )
{
sector += ((divs+1)/2 - sector)*2;
sector -= (divs+1)/2;
this.actions.move.speedCurr = this.actions.move.speed;
this.actions.move.speedCurr += this.actions.move.speed*this.traits.pitch.value*sector;
}
else
{
sector += ((divs)/2 - sector)*2;
sector -= (divs)/2;
this.actions.move.speedCurr = this.actions.move.speed;
this.actions.move.speedCurr += this.actions.move.speed*this.traits.pitch.value*sector;
}
}
// ====================================================================