#3465: Improved code for disabling minimap and design screen when no HQs are
present.
-------------------------+-------------------------------------------------
        Reporter:        |       Type:  patch (an actual patch, not a
  Shadow Wolf TJC        |  request for one)
          Status:  new   |   Priority:  normal
       Milestone:        |  Component:  Data: Scripts (MultiPlayer)
  unspecified            |   Keywords:
         Version:  3.1   |   Blocking:
  and master             |
      Blocked By:        |
Operating System:  All   |
  /Non-Specific          |
-------------------------+-------------------------------------------------
 I've managed to write up a new piece of code in rules.js that would allow
 modders to afford to allow players to have more than 1 HQ present at any
 given time. It replaces this piece of code:

 {{{
 function eventDestroyed(victim)
 {
         if (victim.player == selectedPlayer && victim.type == STRUCTURE &&
 victim.stattype == HQ)
         {
                 setMiniMap(false); // hide minimap if HQ is destroyed
                 setDesign(false); // and disallow design
         }
 }
 }}}
 ...with this piece of code:

 {{{
 function eventDestroyed(victim)
 {
         if (victim.player == selectedPlayer && victim.type == STRUCTURE &&
 victim.stattype == HQ)
         {
                 var HQs = enumStruct(selectedPlayer,HQ).length;

                 if (HQs < 1)
                 {
                         setMiniMap(false); // hide minimap if HQ is
 destroyed
                         setDesign(false); // and disallow design
                 }
         }
 }
 }}}
 What this does is that, instead of disabling the minimap and design screen
 whenever ANY of the player's HQs are destroyed (even if the player had a
 spare HQ on the map), it'll only disable them if the player has no HQs on
 the field.

-- 
Ticket URL: <http://developer.wz2100.net/ticket/3465>
Warzone 2100 Trac <http://developer.wz2100.net/>
The Warzone 2100 Project
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Warzone2100-project mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/warzone2100-project

Reply via email to