Farmhouse_Basement_Revised/ScienceHouse.cs
/// <summary>
/// Checks the given action. Currently does not work as Game2.getHook() does not work.
/// </summary>
/// <param name="tileLocation">Tile location to check action on.</param>
/// <param name="viewport">Current viewport</param>
/// <param name="who">Which Farmer</param>
/// <returns>true if checkaction works correctly.</returns>
Checks the given action. Currently does not work as Game2.getHook() does not work.
Checks the given action . Currently does not work as Game2 . getHook () does not work .
public override bool checkAction(Location tileLocation, Rectangle viewport, Farmer who)
        {
            if (Game1.player.houseUpgradeLevel > 2 ) {
                if (mod != null)
                    mod.Monitor.Log("Successfully intercepted checkAction.", LogLevel.Debug);
                return Game2.getHook().OnGameLocation_CheckAction(this, tileLocation, viewport, who, delegate {
                    if (who.IsLocalPlayer && who.currentUpgrade != null && name.Equals("Farm") && tileLocation.Equals(new Location((int)(who.currentUpgrade.positionOfCarpenter.X + 32f) / 64, (int)(who.currentUpgrade.positionOfCarpenter.Y + 32f) / 64))) {
                        if (who.currentUpgrade.daysLeftTillUpgradeDone == 1) {
                            Game1.drawDialogue(Game1.getCharacterFromName("Robin", false), Game1.content.LoadString("Data\\ExtraDialogue:Farm_RobinWorking_ReadyTomorrow"));
                        } else {
                            Game1.drawDialogue(Game1.getCharacterFromName("Robin", false), Game1.content.LoadString("Data\\ExtraDialogue:Farm_RobinWorking" + (Game1.random.Next(2) + 1)));
                        }
                    }
                    Microsoft.Xna.Framework.Vector2 vector = new Microsoft.Xna.Framework.Vector2((float)tileLocation.X, (float)tileLocation.Y);
                    xTile.ObjectModel.PropertyValue propertyValue = null;
                    xTile.Tiles.Tile tile = map.GetLayer("Buildings").PickTile(new Location(tileLocation.X * 64, tileLocation.Y * 64), viewport.Size);
                    tile?.Properties.TryGetValue("Action", out propertyValue);
                    if (propertyValue != null && (currentEvent != null || isCharacterAtTile(vector + new Microsoft.Xna.Framework.Vector2(0f, 1f)) == null)) {
                        return this.performAction(propertyValue, who, tileLocation);
                    }
                    return false;
                });
            }
            return base.checkAction(tileLocation, viewport, who);
        }
public override bool checkAction ( Location tileLocation , Rectangle viewport , Farmer who ) { if ( Game1 . player . houseUpgradeLevel > 2 ) { if ( mod != null ) mod . Monitor . Log ( " " , LogLevel . Debug ) ; return Game2 . getHook ( ) . OnGameLocation_CheckAction ( this , tileLocation , viewport , who , delegate { if ( who . IsLocalPlayer && who . currentUpgrade != null && name . Equals ( " " ) && tileLocation . Equals ( new Location ( ( int ) ( who . currentUpgrade . positionOfCarpenter . X + 32f ) / 64 , ( int ) ( who . currentUpgrade . positionOfCarpenter . Y + 32f ) / 64 ) ) ) { if ( who . currentUpgrade . daysLeftTillUpgradeDone == 1 ) { Game1 . drawDialogue ( Game1 . getCharacterFromName ( " " , false ) , Game1 . content . LoadString ( " \\ " ) ) ; } else { Game1 . drawDialogue ( Game1 . getCharacterFromName ( " " , false ) , Game1 . content . LoadString ( " \\ " + ( Game1 . random . Next ( 2 ) + 1 ) ) ) ; } } Microsoft . Xna . Framework . Vector2 vector = new Microsoft . Xna . Framework . Vector2 ( ( float ) tileLocation . X , ( float ) tileLocation . Y ) ; xTile . ObjectModel . PropertyValue propertyValue = null ; xTile . Tiles . Tile tile = map . GetLayer ( " " ) . PickTile ( new Location ( tileLocation . X * 64 , tileLocation . Y * 64 ) , viewport . Size ) ; tile ? . Properties . TryGetValue ( " " , out propertyValue ) ; if ( propertyValue != null && ( currentEvent != null || isCharacterAtTile ( vector + new Microsoft . Xna . Framework . Vector2 ( 0f , 1f ) ) == null ) ) { return this . performAction ( propertyValue , who , tileLocation ) ; } return false ; } ) ; } return base . checkAction ( tileLocation , viewport , who ) ; }
Checks the given action.
Checks the given action .
// @TODO: Fix Game2.getHook()
true if checkaction works correctly.
true if checkaction works correctly .
tileLocation
Location
Tile location to check action on.
Tile location to check action on .
viewport
Rectangle
None
who
Farmer
None