Released Simple Weapon Racks Mod

Discussion in 'Released Mods' started by arkoth, Dec 9, 2012.

  1. arkoth

    arkoth Green Slime

    Hi everyone. This is a very simple tConfig mod (and my first) that adds weapon racks to the game.

    Bow Rack Small.png
    Bow Rack Small
    Recipe: 15 Wood, 2 Iron Bar

    Bow Rack.png
    Bow Rack
    Recipe: 15 Wood, 2 Iron Bar

    Weapon Rack Axes.png
    Weapon Rack Axes
    Recipe: 15 Wood, 10 Iron Bar

    Weapon Rack Polearms.png

    Weapon Rack Polearms
    Recipe: 15 Wood, 10 Iron Bar

    Weapon Rack Swords.png

    Weapon Rack Swords
    Recipe: 15 Wood, 10 Iron Bar

    Weapon Rack.png

    Weapon Rack
    Recipe: 15 Wood, 10 Iron Bar

    Source: source is attached as .zip file to this post

    Obj: Functional (like chests) - has multiplayer issues; see post below's Terraria Mods/Weapon Racks.obj

    Obj: Decorative only - no issues's Terraria Mods/Weapon Racks Decorative.obj

    Copy the .obj into your ModPacks folder in \My Documents\My Games\Terraria\ModPacks

    I've seen lots of requests for this so I went ahead and made them. They function like chest, not like mannequins, so... sorry to get hopes up for those that want that feature (above me atm).

    I made these because I'm making a map that I wanted to use these in to have it look more 'authentic'.

    All the sprites are reworks of original Terraria sprites with the exception of the Polearms Rack. The Iron Polearm sprite used comes from Omnirs Melee Weapons mod

    I am not a coder or a spriter, I'm a sound guy. So if you don't like the sprites, please let me know what I could do to make them better, or take it in your own hands and post some sprites and I can add them to the mod. Variations are always welcome.

    Special thanks to Surfpup for tConfig.

    Thanks all, enjoy the mod.

    Attached Files:

  2. lunicuss

    lunicuss Eskimo Zombie

    arkoth likes this.
  3. Cavious

    Cavious Demon Eye

    does this mod work well in mp?
  4. arkoth

    arkoth Green Slime

    Unfortunately, the chest function of the racks does not work in multiplayer. I have no idea why, but here are my findings after some testing:

    Single player:
    - works as intended, saves item in racks like chests, have not run into any problems single player

    - only truly functions as decoration. cannot open (does not show contents, though you hear the click noise as if it was being opened) however items that have been stored in the rack (from single player) WILL be saved, just don't break the rack or they will be destroyed

    - will function as a chest IF CREATED in multiplayer session, but WILL NOT open on next session (does not seem to open in MP if rack is already placed in world) I do not recommend storing items in multiplayer until this is fixed as you wont be able to access the rack in MP

    - creating the tile in MP and then placing something inside WILL NOT SAVE. avoid using as a chest in multiplayer period.

    Summary: Items from single player will not be lost as long as you don't break the racks, but are inaccessible in multiplayer. Items placed in multiplayer WILL BE DESTROYED

    This is the code I used in the .cs for the racks:

    public static void PlaceTile(int x, int y) {
    while(Main.tile[x,y].frameX>0) x--;
    while(Main.tile[x,y].frameY>0) y--;
    int ID = Chest.CreateChest(x, y);
    public void UseTile(Player player, int x, int y) {
    while(Main.tile[x,y].frameX>0) x--; // && Main.tile[x-1,y].type==type
    while(Main.tile[x,y].frameY>0) y--; // && Main.tile[x,y-1].type==type
    Main.chestText = "Chest";
    int ID= Chest.FindChest(x, y);
    Main.player[Main.myPlayer].chest = ID;
    Main.playerInventory = true;
    Main.PlaySound(12, -1, -1, 1);
    Main.player[Main.myPlayer].chestX = x;
    Main.player[Main.myPlayer].chestY = y;
    public bool CanDestroyTile(int x, int y) {
    while(Main.tile[x,y].frameX>0) x--;
    while(Main.tile[x,y].frameY>0) y--;
    int ID= Chest.FindChest(x, y);
    if(ID==-1) return true;
    for(int i=0;i<Chest.maxItems;i++) {
    if(Main.chest[ID].item.type > 0) return false;
    return true; //If there are no items in the chest, then let it be destroyed
    public void DestroyTile(int x, int y) {
    while(Main.tile[x,y].frameX>0) x--;
    while(Main.tile[x,y].frameY>0) y--;
    Chest.DestroyChest(x, y);
    If someone can let me know how to fix these issues for multiplayer that would be most appreciated. I have no idea what could be wrong. Thanks!


    EDIT: after a bit more digging around, I think this might be a tConfig bug. Might not be able to fix this after all. :( I'll post a decorative only version in a bit (delete the .cs files in Tile folder).
    FreyModder likes this.
  5. Modder35342

    Modder35342 Bunny

    Thanks for the warning. Storage is usually not a problem, so the decorative only version suits me almost just as fine.
  6. LeoMav

    LeoMav Squirrel

    Cool!!!! ) Nice idea)
    How u thinking about upgrade your mod? On the similarity of the mannequin, when you can hang weapon on it
    arkoth likes this.
  7. arkoth

    arkoth Green Slime

    Hey -no problem. Trying to stave off the ER MER GERD YER MOD ATE MY ITERMS, lol. I'm glad I put up the decorative only version.

    Thanks LeoMav! The idea has been around for a long time but nothing really came of it and I reaally wanted some fitting weapon racks for the castle map I'm making.

    Regarding the mannequin style racks - I don't know enough coding to actually get this working. For one, I believe there are issues regarding normal mannequins and mod armors crashing the game and unless someone can work out a mannequin cs that works, this will not be possible. There are also the cosmetic issues. Armors are easier because they all fitted to be worn by players. Weapons are totally different in that they come in all sorts of shapes and sizes and working out how the rack would visually display them would take a lot of work. I just think it would look bad if the same weapon graphic in your inventory was placed on racks unless they were super long width racks to accommodate for all the weapon variation.

    Anyhow, thanks for supporting the mod. I hope you enjoy it. :)

  8. FreyModder

    FreyModder Yellow Slime

    Awesome mod :D I will try it out.
    arkoth likes this.

Share This Page