Tconfig & terraria question

Discussion in 'Released Mods' started by GallantJR, Jan 7, 2013.

  1. GallantJR

    GallantJR Green Slime

    Hi everyone !

    I got 2 issue when creating mods !

    How can you determine if a tile is a shadow chest or a golden chest ?
    They both have the same id : 21 ...
    [​IMG] Chest 21
    [​IMG] Gold Chest 21 (2)
    [​IMG] Locked Gold Chest 21 (3)
    [​IMG] Shadow Chest 21 (4)
    [​IMG] Shadow Chest 21 (5)
    [​IMG] Barrel 21 (6)
    [​IMG] Trash Can 21 (7)

    Is there anyway to know which type of chest ?

    My second issue is when im doing a for through Main.player to acquire the players locations !
    If i do it like 10 time in a second , the framerate of the game is going down to 20 FPS.

    Is there another way to get players position wihout dropping this much FPS ?

  2. Empio

    Empio Blazing Wheel

    Checking the frameX/Y of the tile can help you determine the type of chest.

    As for the player issue. If you're only after the current player, you can use Main.player[Main.myPlayer].
    Otherwise, try using a for (int) instead of a foreach(Player).
    GallantJR likes this.
  3. GallantJR

    GallantJR Green Slime

    Thanks Empio for the chest info !

    and for Main.Player ... Im actually using a for(int)... because using foreach is actually worst :p

    I did a test :
    without calling any Main.player : 54 FPS
    Calling 20 time a second Main.player[Main.myPlayer].position : 48 FPS
    Using 20 time a second a loop through Main.player[i].position : 16 FPS
    Im using this in PreDrawInterface(Spritebatch sb) maybe i could update player position in another place ?
  4. Empio

    Empio Blazing Wheel

    If you're getting 54 fps without doing anything, there's something wrong with your terraria.

    PreDrawInterface is sort of an unofficial place for updating local information.
    It won't run on clients and the server (if it isn't dedicated).

    You could put the code into UpdateWorld() I guess, but it doesn't run on multiplayer clients.
    GallantJR likes this.
  5. GallantJR

    GallantJR Green Slime

    Thanks again Empio !

    This has resolve my issue ! Did put my code in updateWorld().

    And i did keep interfaces Drawing in preDraw by specifying that only client need to run it !

Share This Page