Changeset 4c8d4a8ac38ae7518a40cf0419baec26131a59c1

Show
Ignore:
Timestamp:
01/20/08 12:29:46 (10 months ago)
Author:
Christopher Jung <bktheg@web.de>
git-committer:
Christopher Jung <bktheg@web.de> 1200828586 +0100
git-parent:

[1f46047d6f0c3ccab05898494cd999c59617b3a9]

git-author:
Christopher Jung <bktheg@web.de> 1200828586 +0100
Message:

ScriptParser?: Action-Funktion SHIPMOVE auf ShipUtils? umgestellt

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/net/driftingsouls/ds2/server/scripting/dsscript/ActionFunctions.java

    r177e8e0 r4c8d4a8  
    1919package net.driftingsouls.ds2.server.scripting.dsscript; 
    2020 
    21 import java.util.List; 
    22  
    2321import net.driftingsouls.ds2.server.ContextCommon; 
    2422import net.driftingsouls.ds2.server.Location; 
     
    3129import net.driftingsouls.ds2.server.framework.Common; 
    3230import net.driftingsouls.ds2.server.framework.ContextMap; 
     31import net.driftingsouls.ds2.server.scripting.ShipUtils; 
    3332import net.driftingsouls.ds2.server.scripting.transfer.TransferStrategy; 
    3433import net.driftingsouls.ds2.server.scripting.transfer.TransferStrategyFactory; 
     
    8483                        } 
    8584                         
    86                         // TODO maxcount wird beim Flug durch EMP-Nebel falsch interpretiert 
    87                          
    88                         int oldMaxCount = maxcount; 
    89                         Ship.MovementStatus result = Ship.MovementStatus.SUCCESS; 
    90                          
    91                         while( true ) { 
    92                                 int deltax = target.getX()-ship.getX(); 
    93                                 int deltay = target.getY()-ship.getY(); 
    94                                  
    95                                 if( (deltax == 0) && (deltay == 0) ) { 
    96                                         scriptparser.log("Zielposition bereits erreicht!\n\n"); 
    97                                         return CONTINUE; 
    98                                 } 
    99                                                          
    100                                 if( ship.getHeat() > 100 ) { 
    101                                         scriptparser.log("Ausfuehrung bis zum naechsten Tick angehalten\n\n"); 
    102                                         return STOP; 
    103                                 } 
    104                                  
    105                                 RouteFactory router = new RouteFactory(); 
    106                                 List<Waypoint> route = router.findRoute(ship.getLocation(), target, maxcount); 
    107                                  
    108                                 result = ship.move(route, true, false);  
    109                                 scriptparser.log(Common._stripHTML(Ship.MESSAGE.getMessage())); 
    110                                 scriptparser.setShip(ship); 
    111                                  
    112                                 if( result == Ship.MovementStatus.BLOCKED_BY_EMP ) { 
    113                                         maxcount = 1; 
    114                                         continue; 
    115                                 } 
    116                                 else if( result != Ship.MovementStatus.SUCCESS ) { 
    117                                         scriptparser.log("Ausfuehrung bis zum naechsten Tick angehalten\n\n"); 
    118                                         return STOP; 
    119                                 } 
    120                                 // Nach einem Flug durch einen EMP-Nebel den Flug normal weiterfuehren 
    121                                 else if( oldMaxCount != maxcount ) { 
    122                                         maxcount = oldMaxCount; 
    123                                          
    124                                         continue; 
    125                                 } 
    126                                 else { 
    127                                         break; 
    128                                 } 
    129                         } 
    130                          
    131                         if( !ship.getLocation().equals(target) ) { 
    132                                 scriptparser.log("Position nicht korrekt - Ausfuehrung bis zum naechsten Tick angehalten\n\n"); 
    133                                 return STOP; 
    134                         } 
     85                        if( !ShipUtils.move(ship, target, maxcount) ) { 
     86                                scriptparser.log(ShipUtils.MESSAGE.getMessage()); 
     87                                return STOP; 
     88                        } 
     89                         
     90                        scriptparser.log(ShipUtils.MESSAGE.getMessage()); 
    13591                         
    13692                        return CONTINUE;