Implements skirmish maps, based on patch by sanderd17, fixes #1198. Skirmish maps are like scenarios, except the player can choose their civ during match setup. To create a skirmish map: place some skirmish entities for each player in Atlas (see templates/skirmish/* for examples), uncheck the player's civ in Atlas' player panel if desired, and save in the maps/skirmishes directory. The map will appear in match setup under the "Skirmish" match type.
Implements custom, VFS-based map load/save dialogs for Atlas (replaces
broken native file dialogs), fixes #631, #889.
Fixes map loading/saving to handle arbitrary subdirectories for better
organization.
Adds default settings to Atlas player panel, fixes #1872. Each setting
now has a checkbox to choose whether it should be saved with the map
(avoids writing lots of useless default data for each map).
Adds map preview setting to Atlas, refs #1745.
Cleans up and simplifies some duplicate code.
Fixes optional serialization performance test.
This was SVN commit r13938.
2013-10-04 04:29:16 +02:00
function SkirmishReplacer ( ) { }
2013-10-05 19:54:41 +02:00
SkirmishReplacer . prototype . Schema =
"<optional>" +
"<oneOrMore>" +
"<element a:help='Replacement template for the civ which this element is named after or general. If no element is defined for a civ the general element is used instead. If this element is empty the entity is just deleted. The general element gets used if no civ specific element is present and replaces {civ} with the civ code.'>" +
"<anyName/>" +
"<interleave>" +
"<text/>" +
"</interleave>" +
Implements skirmish maps, based on patch by sanderd17, fixes #1198. Skirmish maps are like scenarios, except the player can choose their civ during match setup. To create a skirmish map: place some skirmish entities for each player in Atlas (see templates/skirmish/* for examples), uncheck the player's civ in Atlas' player panel if desired, and save in the maps/skirmishes directory. The map will appear in match setup under the "Skirmish" match type.
Implements custom, VFS-based map load/save dialogs for Atlas (replaces
broken native file dialogs), fixes #631, #889.
Fixes map loading/saving to handle arbitrary subdirectories for better
organization.
Adds default settings to Atlas player panel, fixes #1872. Each setting
now has a checkbox to choose whether it should be saved with the map
(avoids writing lots of useless default data for each map).
Adds map preview setting to Atlas, refs #1745.
Cleans up and simplifies some duplicate code.
Fixes optional serialization performance test.
This was SVN commit r13938.
2013-10-04 04:29:16 +02:00
"</element>" +
2013-10-05 19:54:41 +02:00
"</oneOrMore>" +
"</optional>" ;
Implements skirmish maps, based on patch by sanderd17, fixes #1198. Skirmish maps are like scenarios, except the player can choose their civ during match setup. To create a skirmish map: place some skirmish entities for each player in Atlas (see templates/skirmish/* for examples), uncheck the player's civ in Atlas' player panel if desired, and save in the maps/skirmishes directory. The map will appear in match setup under the "Skirmish" match type.
Implements custom, VFS-based map load/save dialogs for Atlas (replaces
broken native file dialogs), fixes #631, #889.
Fixes map loading/saving to handle arbitrary subdirectories for better
organization.
Adds default settings to Atlas player panel, fixes #1872. Each setting
now has a checkbox to choose whether it should be saved with the map
(avoids writing lots of useless default data for each map).
Adds map preview setting to Atlas, refs #1745.
Cleans up and simplifies some duplicate code.
Fixes optional serialization performance test.
This was SVN commit r13938.
2013-10-04 04:29:16 +02:00
SkirmishReplacer . prototype . Init = function ( )
{
} ;
SkirmishReplacer . prototype . OnOwnershipChanged = function ( msg )
{
if ( msg . to == 0 )
warn ( "Skirmish map elements can only be owned by regular players. Please delete entity " + this . entity + " or change the ownership to a non-gaia player." ) ;
} ;
2013-12-04 17:52:44 +01:00
SkirmishReplacer . prototype . ReplaceEntities = function ( )
Implements skirmish maps, based on patch by sanderd17, fixes #1198. Skirmish maps are like scenarios, except the player can choose their civ during match setup. To create a skirmish map: place some skirmish entities for each player in Atlas (see templates/skirmish/* for examples), uncheck the player's civ in Atlas' player panel if desired, and save in the maps/skirmishes directory. The map will appear in match setup under the "Skirmish" match type.
Implements custom, VFS-based map load/save dialogs for Atlas (replaces
broken native file dialogs), fixes #631, #889.
Fixes map loading/saving to handle arbitrary subdirectories for better
organization.
Adds default settings to Atlas player panel, fixes #1872. Each setting
now has a checkbox to choose whether it should be saved with the map
(avoids writing lots of useless default data for each map).
Adds map preview setting to Atlas, refs #1745.
Cleans up and simplifies some duplicate code.
Fixes optional serialization performance test.
This was SVN commit r13938.
2013-10-04 04:29:16 +02:00
{
var cmpPlayer = QueryOwnerInterface ( this . entity , IID _Player ) ;
var civ = cmpPlayer . GetCiv ( ) ;
var templateName = "" ;
if ( civ in this . template )
templateName = this . template [ civ ] ;
else if ( "general" in this . template )
templateName = this . template . general ;
if ( ! templateName || civ == "gaia" )
{
Engine . DestroyEntity ( this . entity ) ;
return ;
}
templateName = templateName . replace ( /\{civ\}/g , civ ) ;
var cmpCurPosition = Engine . QueryInterface ( this . entity , IID _Position ) ;
var replacement = Engine . AddEntity ( templateName ) ;
var cmpReplacementPosition = Engine . QueryInterface ( replacement , IID _Position )
var pos = cmpCurPosition . GetPosition2D ( ) ;
cmpReplacementPosition . JumpTo ( pos . x , pos . y ) ;
var rot = cmpCurPosition . GetRotation ( ) ;
cmpReplacementPosition . SetYRotation ( rot . y ) ;
var cmpCurOwnership = Engine . QueryInterface ( this . entity , IID _Ownership ) ;
var cmpReplacementOwnership = Engine . QueryInterface ( replacement , IID _Ownership ) ;
cmpReplacementOwnership . SetOwner ( cmpCurOwnership . GetOwner ( ) ) ;
2013-12-04 17:52:44 +01:00
Engine . BroadcastMessage ( MT _EntityRenamed , { entity : this . entity , newentity : replacement } ) ;
Implements skirmish maps, based on patch by sanderd17, fixes #1198. Skirmish maps are like scenarios, except the player can choose their civ during match setup. To create a skirmish map: place some skirmish entities for each player in Atlas (see templates/skirmish/* for examples), uncheck the player's civ in Atlas' player panel if desired, and save in the maps/skirmishes directory. The map will appear in match setup under the "Skirmish" match type.
Implements custom, VFS-based map load/save dialogs for Atlas (replaces
broken native file dialogs), fixes #631, #889.
Fixes map loading/saving to handle arbitrary subdirectories for better
organization.
Adds default settings to Atlas player panel, fixes #1872. Each setting
now has a checkbox to choose whether it should be saved with the map
(avoids writing lots of useless default data for each map).
Adds map preview setting to Atlas, refs #1745.
Cleans up and simplifies some duplicate code.
Fixes optional serialization performance test.
This was SVN commit r13938.
2013-10-04 04:29:16 +02:00
Engine . DestroyEntity ( this . entity ) ;
} ;
2013-12-04 17:52:44 +01:00
/ * *
* Replace this entity with a civ - specific entity
* Message is sent right before InitGame ( ) is called , in InitGame . js
* Replacement needs to happen early on real games to not confuse the AI
* /
SkirmishReplacer . prototype . OnSkirmishReplace = function ( msg )
{
this . ReplaceEntities ( ) ;
} ;
/ * *
* Replace this entity with a civ - specific entity
* This is needed for Atlas , when the entity isn ' t replaced before the game starts ,
* so it needs to be replaced on the first turn .
* /
SkirmishReplacer . prototype . OnUpdate = function ( msg )
{
this . ReplaceEntities ( ) ;
} ;
Implements skirmish maps, based on patch by sanderd17, fixes #1198. Skirmish maps are like scenarios, except the player can choose their civ during match setup. To create a skirmish map: place some skirmish entities for each player in Atlas (see templates/skirmish/* for examples), uncheck the player's civ in Atlas' player panel if desired, and save in the maps/skirmishes directory. The map will appear in match setup under the "Skirmish" match type.
Implements custom, VFS-based map load/save dialogs for Atlas (replaces
broken native file dialogs), fixes #631, #889.
Fixes map loading/saving to handle arbitrary subdirectories for better
organization.
Adds default settings to Atlas player panel, fixes #1872. Each setting
now has a checkbox to choose whether it should be saved with the map
(avoids writing lots of useless default data for each map).
Adds map preview setting to Atlas, refs #1745.
Cleans up and simplifies some duplicate code.
Fixes optional serialization performance test.
This was SVN commit r13938.
2013-10-04 04:29:16 +02:00
Engine . RegisterComponentType ( IID _SkirmishReplacer , "SkirmishReplacer" , SkirmishReplacer ) ;