Example #1
0
 public override Ini.Property GetIniProperty(int txOrigin, int tyOrigin)
 {
     // For example: nil=kgtRocketVehicle,side,38,120,0,100,knAggressivenessPitbull,{knGuardAreaAction,2}
     Ini.Property prp = base.GetIniProperty(txOrigin, tyOrigin);
     prp.Value += ",knAggressiveness" + m_aggr.ToString();
     if (m_cab != null)
     {
         prp.Value += ",{" + m_cab.ToSaveString() + "}";
     }
     return(prp);
 }
Example #2
0
        public void AddIniProperties(Ini.Section sec)
        {
            // Save Name

            sec.Add(new Ini.Property("Name", Name));

            // Save Side

            sec.Add(new Ini.Property("Side", "k" + m_side.ToString()));

            // Save Aggressiveness

            sec.Add(new Ini.Property("Aggressiveness", "knAggressiveness" + m_aggr.ToString()));

            // Save flags

            sec.Add(new Ini.Property("LoopForever", m_fLoopForever ? "1" : "0"));
            sec.Add(new Ini.Property("CreateAtLevelLoad", m_fCreateAtLevelLoad ? "1" : "0"));
            sec.Add(new Ini.Property("RandomGroup", m_fRandomGroup ? "1" : "0"));
            sec.Add(new Ini.Property("Spawn", m_fSpawn ? "1" : "0"));
            sec.Add(new Ini.Property("ReplaceGroup", m_fReplaceDestroyedGroup ? "1" : "0"));

            // Save SpawnArea

            int nSpawnArea = CaTypeArea.GetArea(m_strSpawnArea);

            if (nSpawnArea != -1)
            {
                sec.Add(new Ini.Property("SpawnArea", nSpawnArea.ToString()));
            }

            // Save Health

            sec.Add(new Ini.Property("Health", Health.ToString()));

            // Save unit list

            if (m_alsUnitTypeAndCounts.Count > 0)
            {
                // Write total # of units

                int cTotalUnits = 0;
                foreach (UnitTypeAndCount utc in m_alsUnitTypeAndCounts)
                {
                    cTotalUnits += utc.c;
                }
                string str = cTotalUnits.ToString();

                // Write unit/count pairs

                foreach (UnitTypeAndCount utc in m_alsUnitTypeAndCounts)
                {
                    str += "," + utc.ToSaveString();
                }

                sec.Add(new Ini.Property("Units", str));
            }

            // Save actions

            foreach (CaBase cab in m_alsActions)
            {
                if (!(cab is CommentUnitGroupAction))
                {
                    sec.Add(new Ini.Property("A", cab.ToSaveString()));
                }
            }
        }