forked from 0ad/0ad
# - Housekeeping
# - Territory restriction rules for buildings. This was SVN commit r4206.
This commit is contained in:
parent
235ad34669
commit
fce69aaa7f
@ -32,6 +32,7 @@
|
|||||||
#include "simulation/EntityFormation.h"
|
#include "simulation/EntityFormation.h"
|
||||||
#include "simulation/EntityManager.h"
|
#include "simulation/EntityManager.h"
|
||||||
#include "simulation/FormationManager.h"
|
#include "simulation/FormationManager.h"
|
||||||
|
#include "simulation/TerritoryManager.h"
|
||||||
#include "simulation/Simulation.h"
|
#include "simulation/Simulation.h"
|
||||||
|
|
||||||
#include "ps/CLogger.h"
|
#include "ps/CLogger.h"
|
||||||
@ -1350,7 +1351,7 @@ bool CBuildingPlacer::activate(CStrW& templateName)
|
|||||||
|
|
||||||
std::set<CStr8> selections;
|
std::set<CStr8> selections;
|
||||||
m_actor = g_UnitMan.CreateUnit( actorName, 0, selections );
|
m_actor = g_UnitMan.CreateUnit( actorName, 0, selections );
|
||||||
m_actor->SetPlayerID(g_Game->GetLocalPlayer()->GetPlayerID());
|
m_actor->SetPlayerID( g_Game->GetLocalPlayer()->GetPlayerID() );
|
||||||
|
|
||||||
// m_bounds
|
// m_bounds
|
||||||
if( m_template->m_bound_type == CBoundingObject::BOUND_CIRCLE )
|
if( m_template->m_bound_type == CBoundingObject::BOUND_CIRCLE )
|
||||||
@ -1480,9 +1481,25 @@ void CBuildingPlacer::update( float timeStep )
|
|||||||
// socketted object, we check that we are in fact on a socket, using onSocket.
|
// socketted object, we check that we are in fact on a socket, using onSocket.
|
||||||
|
|
||||||
CTerrain *pTerrain=g_Game->GetWorld()->GetTerrain();
|
CTerrain *pTerrain=g_Game->GetWorld()->GetTerrain();
|
||||||
m_valid = pTerrain->isOnMap( pos.X, pos.Z )
|
|
||||||
&& ( m_template->m_socket == L"" || onSocket )
|
if( pTerrain->isOnMap( pos.X, pos.Z ) )
|
||||||
|
{
|
||||||
|
m_valid = ( m_template->m_socket == L"" || onSocket )
|
||||||
&& ( getCollisionObject( m_bounds, 0, &m_template->m_socket ) == 0 );
|
&& ( getCollisionObject( m_bounds, 0, &m_template->m_socket ) == 0 );
|
||||||
|
|
||||||
|
// Check that we are being placed in a valid territory; currently, m_territoryRestriction
|
||||||
|
// can be either "Allied" for placing in allied territories, or nothing. Since there's no
|
||||||
|
// diplomacy yet, "allied" just means "owned by us" for now.
|
||||||
|
CTerritory* territory = g_Game->GetWorld()->GetTerritoryManager()->GetTerritory( pos.X, pos.Z );
|
||||||
|
if( m_template->m_territoryRestriction == L"Allied" && territory->owner != g_Game->GetLocalPlayer() )
|
||||||
|
{
|
||||||
|
m_valid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_valid = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Flash our actor red if the position is invalid.
|
// Flash our actor red if the position is invalid.
|
||||||
|
|
||||||
|
@ -49,7 +49,6 @@ CEntity* GetCollisionObject( float x, float y )
|
|||||||
CBoundingObject* getCollisionObject( CBoundingObject* bounds, CPlayer* player, const CStrW* ignoreClass )
|
CBoundingObject* getCollisionObject( CBoundingObject* bounds, CPlayer* player, const CStrW* ignoreClass )
|
||||||
{
|
{
|
||||||
std::vector<CEntity*> entities;
|
std::vector<CEntity*> entities;
|
||||||
entities.reserve(8);
|
|
||||||
g_EntityManager.GetInRange( bounds->m_pos.x, bounds->m_pos.y, COLLISION_RANGE, entities );
|
g_EntityManager.GetInRange( bounds->m_pos.x, bounds->m_pos.y, COLLISION_RANGE, entities );
|
||||||
std::vector<CEntity*>::iterator it;
|
std::vector<CEntity*>::iterator it;
|
||||||
|
|
||||||
@ -60,7 +59,7 @@ CBoundingObject* getCollisionObject( CBoundingObject* bounds, CPlayer* player, c
|
|||||||
|
|
||||||
/* If the unit is marked to ignore ally collisions, and the player parameter
|
/* If the unit is marked to ignore ally collisions, and the player parameter
|
||||||
is passed in and the same player as the unit, then ignore the (potential) collision */
|
is passed in and the same player as the unit, then ignore the (potential) collision */
|
||||||
if( player && (*it)->m_passThroughAllies && (*it)->m_player == player ) continue;
|
if( player && (*it)->m_base->m_passThroughAllies && (*it)->m_player == player ) continue;
|
||||||
|
|
||||||
if( ignoreClass && (*it)->m_classes.IsMember( *ignoreClass ) ) continue;
|
if( ignoreClass && (*it)->m_classes.IsMember( *ignoreClass ) ) continue;
|
||||||
|
|
||||||
@ -77,7 +76,6 @@ CBoundingObject* getCollisionObject( CBoundingObject* bounds, CPlayer* player, c
|
|||||||
CEntity* getCollisionEntity( CBoundingObject* bounds, CPlayer* player, const CStrW* ignoreClass )
|
CEntity* getCollisionEntity( CBoundingObject* bounds, CPlayer* player, const CStrW* ignoreClass )
|
||||||
{
|
{
|
||||||
std::vector<CEntity*> entities;
|
std::vector<CEntity*> entities;
|
||||||
entities.reserve(8);
|
|
||||||
g_EntityManager.GetInRange( bounds->m_pos.x, bounds->m_pos.y, COLLISION_RANGE, entities );
|
g_EntityManager.GetInRange( bounds->m_pos.x, bounds->m_pos.y, COLLISION_RANGE, entities );
|
||||||
std::vector<CEntity*>::iterator it;
|
std::vector<CEntity*>::iterator it;
|
||||||
|
|
||||||
@ -88,7 +86,7 @@ CEntity* getCollisionEntity( CBoundingObject* bounds, CPlayer* player, const CSt
|
|||||||
|
|
||||||
/* If the unit is marked to ignore ally collisions, and the player parameter
|
/* If the unit is marked to ignore ally collisions, and the player parameter
|
||||||
is passed in and the same player as the unit, then ignore the (potential) collision */
|
is passed in and the same player as the unit, then ignore the (potential) collision */
|
||||||
if( player && (*it)->m_passThroughAllies && (*it)->m_player == player ) continue;
|
if( player && (*it)->m_base->m_passThroughAllies && (*it)->m_player == player ) continue;
|
||||||
|
|
||||||
if( ignoreClass && (*it)->m_classes.IsMember( *ignoreClass ) ) continue;
|
if( ignoreClass && (*it)->m_classes.IsMember( *ignoreClass ) ) continue;
|
||||||
|
|
||||||
@ -110,7 +108,6 @@ HEntity getCollisionObject( CEntity* entity )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::vector<CEntity*> entities;
|
std::vector<CEntity*> entities;
|
||||||
entities.reserve(8);
|
|
||||||
g_EntityManager.GetInRange( entity->m_position.X, entity->m_position.Z, COLLISION_RANGE, entities );
|
g_EntityManager.GetInRange( entity->m_position.X, entity->m_position.Z, COLLISION_RANGE, entities );
|
||||||
std::vector<CEntity*>::iterator it;
|
std::vector<CEntity*>::iterator it;
|
||||||
|
|
||||||
|
@ -1345,7 +1345,7 @@ void CEntity::renderRallyPoint()
|
|||||||
if( !m_visible )
|
if( !m_visible )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( !entf_get(ENTF_HAS_RALLY_POINT) || g_Selection.m_unitUITextures.find(m_rallyTexture) ==
|
if ( !entf_get(ENTF_HAS_RALLY_POINT) || g_Selection.m_unitUITextures.find(m_base->m_rallyName) ==
|
||||||
g_Selection.m_unitUITextures.end() )
|
g_Selection.m_unitUITextures.end() )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -1362,10 +1362,10 @@ void CEntity::renderRallyPoint()
|
|||||||
|
|
||||||
CSprite sprite;
|
CSprite sprite;
|
||||||
CTexture tex;
|
CTexture tex;
|
||||||
tex.SetHandle( g_Selection.m_unitUITextures[m_rallyTexture] );
|
tex.SetHandle( g_Selection.m_unitUITextures[m_base->m_rallyName] );
|
||||||
sprite.SetTexture(&tex);
|
sprite.SetTexture(&tex);
|
||||||
CVector3D rally = m_rallyPoint;
|
CVector3D rally = m_rallyPoint;
|
||||||
rally.Y += m_rallyHeight/2.f + .1f;
|
rally.Y += m_base->m_rallyHeight/2.f + .1f;
|
||||||
sprite.SetTranslation(rally);
|
sprite.SetTranslation(rally);
|
||||||
sprite.Render();
|
sprite.Render();
|
||||||
}
|
}
|
||||||
@ -1457,13 +1457,12 @@ void CEntity::ScriptingInit()
|
|||||||
|
|
||||||
/* Any inherited property MUST be added to EntityTemplate.cpp as well */
|
/* Any inherited property MUST be added to EntityTemplate.cpp as well */
|
||||||
|
|
||||||
AddClassProperty( L"actions.move.speed_curr", &CEntity::m_speed );
|
AddClassProperty( L"actions.move.speedCurr", &CEntity::m_speed );
|
||||||
AddClassProperty( L"actions.move.run.speed", &CEntity::m_runSpeed );
|
AddClassProperty( L"actions.move.run.speed", &CEntity::m_runSpeed );
|
||||||
AddClassProperty( L"actions.move.run.rangemin", &CEntity::m_runMinRange );
|
AddClassProperty( L"actions.move.run.rangemin", &CEntity::m_runMinRange );
|
||||||
AddClassProperty( L"actions.move.run.range", &CEntity::m_runMaxRange );
|
AddClassProperty( L"actions.move.run.range", &CEntity::m_runMaxRange );
|
||||||
AddClassProperty( L"actions.move.run.regen_rate", &CEntity::m_runRegenRate );
|
AddClassProperty( L"actions.move.run.regenRate", &CEntity::m_runRegenRate );
|
||||||
AddClassProperty( L"actions.move.run.decay_rate", &CEntity::m_runDecayRate );
|
AddClassProperty( L"actions.move.run.decayRate", &CEntity::m_runDecayRate );
|
||||||
AddClassProperty( L"actions.move.pass_through_allies", &CEntity::m_passThroughAllies );
|
|
||||||
AddClassProperty( L"selected", &CEntity::m_selected, false, (NotifyFn)&CEntity::checkSelection );
|
AddClassProperty( L"selected", &CEntity::m_selected, false, (NotifyFn)&CEntity::checkSelection );
|
||||||
AddClassProperty( L"group", &CEntity::m_grouped, false, (NotifyFn)&CEntity::checkGroup );
|
AddClassProperty( L"group", &CEntity::m_grouped, false, (NotifyFn)&CEntity::checkGroup );
|
||||||
AddClassProperty( L"traits.extant", &CEntity::m_extant );
|
AddClassProperty( L"traits.extant", &CEntity::m_extant );
|
||||||
@ -1473,23 +1472,18 @@ void CEntity::ScriptingInit()
|
|||||||
AddClassProperty( L"player", (GetFn)&CEntity::JSI_GetPlayer, (SetFn)&CEntity::JSI_SetPlayer );
|
AddClassProperty( L"player", (GetFn)&CEntity::JSI_GetPlayer, (SetFn)&CEntity::JSI_SetPlayer );
|
||||||
AddClassProperty( L"traits.health.curr", &CEntity::m_healthCurr );
|
AddClassProperty( L"traits.health.curr", &CEntity::m_healthCurr );
|
||||||
AddClassProperty( L"traits.health.max", &CEntity::m_healthMax );
|
AddClassProperty( L"traits.health.max", &CEntity::m_healthMax );
|
||||||
AddClassProperty( L"traits.health.regen_rate", &CEntity::m_healthRegenRate );
|
AddClassProperty( L"traits.health.regenRate", &CEntity::m_healthRegenRate );
|
||||||
AddClassProperty( L"traits.health.regen_start", &CEntity::m_healthRegenStart );
|
AddClassProperty( L"traits.health.regenStart", &CEntity::m_healthRegenStart );
|
||||||
AddClassProperty( L"traits.health.decay_rate", &CEntity::m_healthDecayRate );
|
AddClassProperty( L"traits.health.decayRate", &CEntity::m_healthDecayRate );
|
||||||
AddClassProperty( L"traits.stamina.curr", &CEntity::m_staminaCurr );
|
AddClassProperty( L"traits.stamina.curr", &CEntity::m_staminaCurr );
|
||||||
AddClassProperty( L"traits.stamina.max", &CEntity::m_staminaMax );
|
AddClassProperty( L"traits.stamina.max", &CEntity::m_staminaMax );
|
||||||
AddClassProperty( L"traits.rally.name", &CEntity::m_rallyTexture );
|
|
||||||
AddClassProperty( L"traits.rally.width", &CEntity::m_rallyWidth );
|
|
||||||
AddClassProperty( L"traits.rally.height", &CEntity::m_rallyHeight );
|
|
||||||
AddClassProperty( L"traits.rank.name", &CEntity::m_rankName );
|
AddClassProperty( L"traits.rank.name", &CEntity::m_rankName );
|
||||||
AddClassProperty( L"traits.vision.los", &CEntity::m_los );
|
AddClassProperty( L"traits.vision.los", &CEntity::m_los );
|
||||||
AddClassProperty( L"traits.vision.permanent", &CEntity::m_permanent );
|
AddClassProperty( L"lastCombatTime", &CEntity::m_lastCombatTime );
|
||||||
AddClassProperty( L"traits.is_territory_centre", &CEntity::m_isTerritoryCentre );
|
AddClassProperty( L"lastRunTime", &CEntity::m_lastRunTime );
|
||||||
AddClassProperty( L"last_combat_time", &CEntity::m_lastCombatTime );
|
|
||||||
AddClassProperty( L"last_run_time", &CEntity::m_lastRunTime );
|
|
||||||
AddClassProperty( L"building", &CEntity::m_building );
|
AddClassProperty( L"building", &CEntity::m_building );
|
||||||
AddClassProperty( L"visible", &CEntity::m_visible );
|
AddClassProperty( L"visible", &CEntity::m_visible );
|
||||||
AddClassProperty( L"production_queue", &CEntity::m_productionQueue );
|
AddClassProperty( L"productionQueue", &CEntity::m_productionQueue );
|
||||||
|
|
||||||
CJSComplex<CEntity>::ScriptingInit( "Entity", Construct, 2 );
|
CJSComplex<CEntity>::ScriptingInit( "Entity", Construct, 2 );
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,6 @@ public:
|
|||||||
float m_runSpeed;
|
float m_runSpeed;
|
||||||
float m_runRegenRate;
|
float m_runRegenRate;
|
||||||
float m_runDecayRate;
|
float m_runDecayRate;
|
||||||
bool m_passThroughAllies;
|
|
||||||
|
|
||||||
float m_maxActorPitch;
|
float m_maxActorPitch;
|
||||||
float m_minActorPitch;
|
float m_minActorPitch;
|
||||||
@ -163,17 +162,9 @@ public:
|
|||||||
|
|
||||||
//Rank properties
|
//Rank properties
|
||||||
CStr m_rankName;
|
CStr m_rankName;
|
||||||
//Rally texture
|
|
||||||
CStr m_rallyTexture;
|
|
||||||
float m_rallyWidth;
|
|
||||||
float m_rallyHeight;
|
|
||||||
|
|
||||||
// LOS
|
// LOS
|
||||||
int m_los;
|
int m_los;
|
||||||
bool m_permanent;
|
|
||||||
|
|
||||||
// Is this object a territory centre? (e.g. Settlements in 0AD)
|
|
||||||
bool m_isTerritoryCentre;
|
|
||||||
|
|
||||||
// If the object is a territory centre, this points to its territory
|
// If the object is a territory centre, this points to its territory
|
||||||
CTerritory* m_associatedTerritory;
|
CTerritory* m_associatedTerritory;
|
||||||
@ -235,45 +226,6 @@ public:
|
|||||||
|
|
||||||
std::vector<bool> m_sectorValues;
|
std::vector<bool> m_sectorValues;
|
||||||
|
|
||||||
/* JW: these have all been 'moved' (1) into EntityTemplate:
|
|
||||||
1: were already present there, just removed from here
|
|
||||||
int m_sectorDivs;
|
|
||||||
|
|
||||||
int m_pitchDivs;
|
|
||||||
|
|
||||||
float m_staminaBarHeight;
|
|
||||||
int m_staminaBarSize;
|
|
||||||
float m_staminaBarWidth;
|
|
||||||
|
|
||||||
float m_healthBarHeight;
|
|
||||||
int m_healthBarSize;
|
|
||||||
float m_healthBarWidth;
|
|
||||||
|
|
||||||
int m_staminaBorderWidth;
|
|
||||||
int m_staminaBorderHeight;
|
|
||||||
CStr m_staminaBorderName;
|
|
||||||
|
|
||||||
float m_rankHeight;
|
|
||||||
float m_rankWidth;
|
|
||||||
|
|
||||||
// Minimap properties
|
|
||||||
CStrW m_minimapType;
|
|
||||||
int m_minimapR;
|
|
||||||
int m_minimapG;
|
|
||||||
int m_minimapB;
|
|
||||||
|
|
||||||
// Y anchor
|
|
||||||
CStrW m_anchorType;
|
|
||||||
float m_anchorConformX;
|
|
||||||
float m_anchorConformZ;
|
|
||||||
|
|
||||||
int m_healthBorderWidth;
|
|
||||||
int m_healthBorderHeight;
|
|
||||||
CStr m_healthBorderName;
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CEntity( CEntityTemplate* base, CVector3D position, float orientation, const std::set<CStr8>& actorSelections, const CStrW* building = 0 );
|
CEntity( CEntityTemplate* base, CVector3D position, float orientation, const std::set<CStr8>& actorSelections, const CStrW* building = 0 );
|
||||||
|
|
||||||
|
@ -470,6 +470,7 @@ bool CEntity::processContactActionNoPathing( CEntityOrder* current, size_t times
|
|||||||
case ALREADY_AT_DESTINATION:
|
case ALREADY_AT_DESTINATION:
|
||||||
case REACHED_DESTINATION:
|
case REACHED_DESTINATION:
|
||||||
case COLLISION_WITH_DESTINATION:
|
case COLLISION_WITH_DESTINATION:
|
||||||
|
case WOULD_LEAVE_MAP:
|
||||||
// Not too far any more...
|
// Not too far any more...
|
||||||
break;
|
break;
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
|
@ -391,36 +391,36 @@ void CEntityTemplate::ScriptingInit()
|
|||||||
|
|
||||||
AddClassProperty( L"traits.id.classes", (GetFn)&CEntityTemplate::getClassSet, (SetFn)&CEntityTemplate::setClassSet );
|
AddClassProperty( L"traits.id.classes", (GetFn)&CEntityTemplate::getClassSet, (SetFn)&CEntityTemplate::setClassSet );
|
||||||
|
|
||||||
AddClassProperty( L"actions.move.speed_curr", &CEntityTemplate::m_speed );
|
AddClassProperty( L"actions.move.speedCurr", &CEntityTemplate::m_speed );
|
||||||
AddClassProperty( L"actions.move.turningRadius", &CEntityTemplate::m_turningRadius );
|
AddClassProperty( L"actions.move.turningRadius", &CEntityTemplate::m_turningRadius );
|
||||||
AddClassProperty( L"actions.move.run.speed", &CEntityTemplate::m_runSpeed );
|
AddClassProperty( L"actions.move.run.speed", &CEntityTemplate::m_runSpeed );
|
||||||
AddClassProperty( L"actions.move.run.rangeMin", &CEntityTemplate::m_runMinRange );
|
AddClassProperty( L"actions.move.run.rangeMin", &CEntityTemplate::m_runMinRange );
|
||||||
AddClassProperty( L"actions.move.run.range", &CEntityTemplate::m_runMaxRange );
|
AddClassProperty( L"actions.move.run.range", &CEntityTemplate::m_runMaxRange );
|
||||||
AddClassProperty( L"actions.move.run.regen_rate", &CEntityTemplate::m_runRegenRate );
|
AddClassProperty( L"actions.move.run.regenRate", &CEntityTemplate::m_runRegenRate );
|
||||||
AddClassProperty( L"actions.move.run.decay_rate", &CEntityTemplate::m_runDecayRate );
|
AddClassProperty( L"actions.move.run.decayRate", &CEntityTemplate::m_runDecayRate );
|
||||||
AddClassProperty( L"actions.move.pass_through_allies", &CEntityTemplate::m_passThroughAllies );
|
AddClassProperty( L"actions.move.passThroughAllies", &CEntityTemplate::m_passThroughAllies );
|
||||||
AddClassProperty( L"actor", &CEntityTemplate::m_actorName );
|
AddClassProperty( L"actor", &CEntityTemplate::m_actorName );
|
||||||
AddClassProperty( L"traits.health.max", &CEntityTemplate::m_healthMax );
|
AddClassProperty( L"traits.health.max", &CEntityTemplate::m_healthMax );
|
||||||
AddClassProperty( L"traits.health.bar_height", &CEntityTemplate::m_healthBarHeight );
|
AddClassProperty( L"traits.health.barHeight", &CEntityTemplate::m_healthBarHeight );
|
||||||
AddClassProperty( L"traits.health.bar_size", &CEntityTemplate::m_healthBarSize );
|
AddClassProperty( L"traits.health.barSize", &CEntityTemplate::m_healthBarSize );
|
||||||
AddClassProperty( L"traits.health.bar_width", &CEntityTemplate::m_healthBarWidth );
|
AddClassProperty( L"traits.health.barWidth", &CEntityTemplate::m_healthBarWidth );
|
||||||
AddClassProperty( L"traits.health.border_height", &CEntityTemplate::m_healthBorderHeight);
|
AddClassProperty( L"traits.health.borderHeight", &CEntityTemplate::m_healthBorderHeight);
|
||||||
AddClassProperty( L"traits.health.border_width", &CEntityTemplate::m_healthBorderWidth );
|
AddClassProperty( L"traits.health.borderWidth", &CEntityTemplate::m_healthBorderWidth );
|
||||||
AddClassProperty( L"traits.health.border_name", &CEntityTemplate::m_healthBorderName );
|
AddClassProperty( L"traits.health.borderName", &CEntityTemplate::m_healthBorderName );
|
||||||
AddClassProperty( L"traits.health.regen_rate", &CEntityTemplate::m_healthRegenRate );
|
AddClassProperty( L"traits.health.regenRate", &CEntityTemplate::m_healthRegenRate );
|
||||||
AddClassProperty( L"traits.health.regen_start", &CEntityTemplate::m_healthRegenStart );
|
AddClassProperty( L"traits.health.regenStart", &CEntityTemplate::m_healthRegenStart );
|
||||||
AddClassProperty( L"traits.health.decay_rate", &CEntityTemplate::m_healthDecayRate );
|
AddClassProperty( L"traits.health.decayRate", &CEntityTemplate::m_healthDecayRate );
|
||||||
AddClassProperty( L"traits.stamina.max", &CEntityTemplate::m_staminaMax );
|
AddClassProperty( L"traits.stamina.max", &CEntityTemplate::m_staminaMax );
|
||||||
AddClassProperty( L"traits.stamina.bar_height", &CEntityTemplate::m_staminaBarHeight );
|
AddClassProperty( L"traits.stamina.barHeight", &CEntityTemplate::m_staminaBarHeight );
|
||||||
AddClassProperty( L"traits.stamina.bar_size", &CEntityTemplate::m_staminaBarSize );
|
AddClassProperty( L"traits.stamina.barSize", &CEntityTemplate::m_staminaBarSize );
|
||||||
AddClassProperty( L"traits.stamina.bar_width", &CEntityTemplate::m_staminaBarWidth );
|
AddClassProperty( L"traits.stamina.barWidth", &CEntityTemplate::m_staminaBarWidth );
|
||||||
AddClassProperty( L"traits.stamina.border_height", &CEntityTemplate::m_staminaBorderHeight);
|
AddClassProperty( L"traits.stamina.borderHeight", &CEntityTemplate::m_staminaBorderHeight);
|
||||||
AddClassProperty( L"traits.stamina.border_width", &CEntityTemplate::m_staminaBorderWidth );
|
AddClassProperty( L"traits.stamina.borderWidth", &CEntityTemplate::m_staminaBorderWidth );
|
||||||
AddClassProperty( L"traits.stamina.border_name", &CEntityTemplate::m_staminaBorderName );
|
AddClassProperty( L"traits.stamina.borderName", &CEntityTemplate::m_staminaBorderName );
|
||||||
AddClassProperty( L"traits.rally.name", &CEntityTemplate::m_rallyName );
|
AddClassProperty( L"traits.rally.name", &CEntityTemplate::m_rallyName );
|
||||||
AddClassProperty( L"traits.rally.width", &CEntityTemplate::m_rallyWidth );
|
AddClassProperty( L"traits.rally.width", &CEntityTemplate::m_rallyWidth );
|
||||||
AddClassProperty( L"traits.rally.height", &CEntityTemplate::m_rallyHeight );
|
AddClassProperty( L"traits.rally.height", &CEntityTemplate::m_rallyHeight );
|
||||||
AddClassProperty( L"traits.flank_penalty.sectors", &CEntityTemplate::m_sectorDivs );
|
AddClassProperty( L"traits.flankPenalty.sectors", &CEntityTemplate::m_sectorDivs );
|
||||||
AddClassProperty( L"traits.pitch.sectors", &CEntityTemplate::m_pitchDivs );
|
AddClassProperty( L"traits.pitch.sectors", &CEntityTemplate::m_pitchDivs );
|
||||||
AddClassProperty( L"traits.rank.width", &CEntityTemplate::m_rankWidth );
|
AddClassProperty( L"traits.rank.width", &CEntityTemplate::m_rankWidth );
|
||||||
AddClassProperty( L"traits.rank.height", &CEntityTemplate::m_rankHeight );
|
AddClassProperty( L"traits.rank.height", &CEntityTemplate::m_rankHeight );
|
||||||
@ -433,16 +433,17 @@ void CEntityTemplate::ScriptingInit()
|
|||||||
AddClassProperty( L"traits.anchor.conformX", &CEntityTemplate::m_anchorConformX );
|
AddClassProperty( L"traits.anchor.conformX", &CEntityTemplate::m_anchorConformX );
|
||||||
AddClassProperty( L"traits.anchor.conformZ", &CEntityTemplate::m_anchorConformZ );
|
AddClassProperty( L"traits.anchor.conformZ", &CEntityTemplate::m_anchorConformZ );
|
||||||
AddClassProperty( L"traits.vision.los", &CEntityTemplate::m_los );
|
AddClassProperty( L"traits.vision.los", &CEntityTemplate::m_los );
|
||||||
AddClassProperty( L"traits.vision.permanent", &CEntityTemplate::m_permanent );
|
AddClassProperty( L"traits.vision.permanent", &CEntityTemplate::m_visionPermanent );
|
||||||
AddClassProperty( L"traits.display.bars.enabled", &CEntityTemplate::m_barsEnabled );
|
AddClassProperty( L"traits.display.bars.enabled", &CEntityTemplate::m_barsEnabled );
|
||||||
AddClassProperty( L"traits.display.bars.offset", &CEntityTemplate::m_barOffset );
|
AddClassProperty( L"traits.display.bars.offset", &CEntityTemplate::m_barOffset );
|
||||||
AddClassProperty( L"traits.display.bars.height", &CEntityTemplate::m_barHeight );
|
AddClassProperty( L"traits.display.bars.height", &CEntityTemplate::m_barHeight );
|
||||||
AddClassProperty( L"traits.display.bars.width", &CEntityTemplate::m_barWidth );
|
AddClassProperty( L"traits.display.bars.width", &CEntityTemplate::m_barWidth );
|
||||||
AddClassProperty( L"traits.display.bars.border", &CEntityTemplate::m_barBorder );
|
AddClassProperty( L"traits.display.bars.border", &CEntityTemplate::m_barBorder );
|
||||||
AddClassProperty( L"traits.display.bars.border_size", &CEntityTemplate::m_barBorderSize );
|
AddClassProperty( L"traits.display.bars.borderSize", &CEntityTemplate::m_barBorderSize );
|
||||||
AddClassProperty( L"traits.is_territory_centre", &CEntityTemplate::m_isTerritoryCentre );
|
AddClassProperty( L"traits.isTerritoryCentre", &CEntityTemplate::m_isTerritoryCentre );
|
||||||
AddClassProperty( L"traits.foundation", &CEntityTemplate::m_foundation );
|
AddClassProperty( L"traits.creation.foundation", &CEntityTemplate::m_foundation );
|
||||||
AddClassProperty( L"traits.socket", &CEntityTemplate::m_socket );
|
AddClassProperty( L"traits.creation.socket", &CEntityTemplate::m_socket );
|
||||||
|
AddClassProperty( L"traits.creation.territoryRestriction", &CEntityTemplate::m_territoryRestriction );
|
||||||
|
|
||||||
CJSComplex<CEntityTemplate>::ScriptingInit( "EntityTemplate" );
|
CJSComplex<CEntityTemplate>::ScriptingInit( "EntityTemplate" );
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ public:
|
|||||||
|
|
||||||
// LOS
|
// LOS
|
||||||
int m_los;
|
int m_los;
|
||||||
bool m_permanent;
|
bool m_visionPermanent;
|
||||||
|
|
||||||
// Is this object a territory centre? (e.g. Settlements in 0AD)
|
// Is this object a territory centre? (e.g. Settlements in 0AD)
|
||||||
bool m_isTerritoryCentre;
|
bool m_isTerritoryCentre;
|
||||||
@ -129,6 +129,9 @@ public:
|
|||||||
// Socket entity that we can be built on, or "" for free placement
|
// Socket entity that we can be built on, or "" for free placement
|
||||||
CStrW m_socket;
|
CStrW m_socket;
|
||||||
|
|
||||||
|
// Can be "allied" to allow placement only in allied territories, or "" or "all" for all territories
|
||||||
|
CStrW m_territoryRestriction;
|
||||||
|
|
||||||
float m_speed;
|
float m_speed;
|
||||||
float m_runSpeed;
|
float m_runSpeed;
|
||||||
float m_runRegenRate;
|
float m_runRegenRate;
|
||||||
|
@ -217,7 +217,7 @@ EUnitLOSStatus CLOSManager::GetUnitStatus(CUnit* unit, CPlayer* player)
|
|||||||
|
|
||||||
if(status & LOS_EXPLORED)
|
if(status & LOS_EXPLORED)
|
||||||
{
|
{
|
||||||
if(unit->GetEntity() == 0 || unit->GetEntity()->m_permanent)
|
if(unit->GetEntity() == 0 || unit->GetEntity()->m_base->m_visionPermanent)
|
||||||
{
|
{
|
||||||
// both actors (which are usually for decoration) and units with the
|
// both actors (which are usually for decoration) and units with the
|
||||||
// permanent flag should be remembered
|
// permanent flag should be remembered
|
||||||
|
@ -62,7 +62,7 @@ void CTerritoryManager::Recalculate()
|
|||||||
g_EntityManager.GetExtant(entities);
|
g_EntityManager.GetExtant(entities);
|
||||||
for( size_t i=0; i<entities.size(); i++ )
|
for( size_t i=0; i<entities.size(); i++ )
|
||||||
{
|
{
|
||||||
if( entities[i]->m_isTerritoryCentre )
|
if( entities[i]->m_base->m_isTerritoryCentre )
|
||||||
centres.push_back(entities[i]);
|
centres.push_back(entities[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user