tAPI [Discontinued] tAPI - A Mod To Make Mods

Status
Not open for further replies.

Yoraiz0r

Lead Developer
Re-Logic

iZPRXZZ.png
XO1AOto.gif




DISCLAIMER
  • The following is not official and is in no way licensed or related to Re-Logic. It is for recreational uses only.
  • This is not an official tool/application. Re-Logic is not at fault for any and all complications that may arise from using this program.
  • While a developer of Terraria is involved in the team of this mod, this mod is first and foremost community made.
  • This mod is dicontinued as of the Terraria 1.3 update and will not be updated to support it.

top
kdcROYP.png




Introduction

tAPI is a standalone mod for Terraria, allowing creation, management and handling (playing) of multiple mods at once.
This mod is a continuation to the old, beloved and discontinued tConfig mod, improved drastically in terms of performance and capabilities.
tAPI works by creating manageable mod files which can be loaded as the user wishes, with an in-game menu for controlling load order and mod options.
With tAPI you can create mods covering many different sections of the game, adding new items, monsters, tiles, buffs, interfaces, prefixes, events and more with relative ease compared to working on a standalone mod.
tAPI supports making multiplayer content and joining tAPI servers with a tAPI client will automatically synchronize the mods the server uses to the joining player.

tAPI is developed by its team using its members free time and is non-profit, we hope you will all enjoy all enjoyed it!
Right now the team includes: Yoraiz0r, Shockah, Grox The Great, zetaPRIME, and Arkhalis.

If you have any questions, feel free to reply in this thread or talk to us on our EsperNet #tapi IRC!
You can see all the latest changes and get nightly updates using the IRC bot in #tAPI, we're also very friendly towards people who don't tend to act negatively so we highly encourage you to stay and talk with us!
(if you have your own IRC client: server = irc.esper.net, port = 6667, channel = #tapi)

top
kdcROYP.png




Features

Play multiple mods at once
tAPI currently supports making & playing mods for Terraria 1.2.4.1, and comes with a variety of tools to assist players & modders.
tAPI is a standalone executable program (not injected) that launches a modified version of Terraria designed to load and handle mods created by tAPI users.
tAPI automatically assigns IDs to the game content in mods so that you can load up multiple mods which would otherwise conflict each other, simultanously.
This feature even extends to multiple mods having contents of the same name, both being non-intrusive to each others code.

In-Game Mods Menu
tAPI's main menu is completely modified to use menu layers that modders can edit at will, and contains a "mods" button leading to a mod management menu.
tAPI lets the user manage mods via an in-game mod management menu, that allows enabling, ordering, disabling and customizing mods if they have the options for it.

Mod Storage
tAPI does not support porting "vanilla" (unedited official Terraria) created worlds, players or options because the file structures are different.
tAPI uses its own folder to store all of those files, found in Terraria's documents folder as a folder called "tAPI".
In the tAPI documents folder you will find a "Mods" folder, which contains 2 other folders: "Local" & "Sources", these contain your mods and sources respectively.
The "Local" folder contains ".tapi" files, those are mods which store the content people make.
(Its just a .zip renamed, you can open it regularly with any archive explorer, it will contain the mod's source code as well as the compiled mod data)

Mod Building
tAPI comes with a tool to compile mod sources into .tapi format files, called "tAPI Builder"
The tAPI Builder is a friendly tool that can attempt to build a mod from any folder in the "Sources" folder.
tAPI Builder can help diagnose issues in the mod compilation & file packing, and allows building multiple mod sources at once too.
(You can doubleclick a mod's name to build it, no need to spam the "build" button!)

Simplified Mod Creation
tAPI uses .json and .cs files to build mods, those files are to store object data, and C# code for every mod that would need it.
Using .json files, you can create items, projectiles, npcs, tiles, walls, buffs, and prefixes.
Using .cs files you can make a lot of other things such as events, interfaces, unique AIs, and more.
Read more about creating a mod in the Documentation section.

Simplified Modded Multiplayer
If you launch a tAPI server with mods on, all players joining the server will be forced to use those exact mods and nothing more.
If the players who join your server do not have a mod the server owns, that mod will be sent to the player and activated.

top
kdcROYP.png




Documentation

Detailed Documentation Site
The tAPI team has created a tAPI documentation site with quick finding and detailed information of all the things you can do with tAPI's file management.
*Note that this is still in development but we will eventually make it so everything is in there.
*If you want to know anything about it quickly / specifically feel free to drop a reply and we'll answer when we can.
http://tapi.axxim.net/docs/

Creating mods
To create a mod in tAPI start by navigating to your tAPI documents folder and creating a folder for your mod content to be stored in.
Afterwards, open the tAPI Builder/refresh its mod list, your empty new folder should appear, build that empty folder (doubleclick / marking + "build" button)
Check inside your empty folder, it will now contain a default mod info file for you to edit with your mod's summary and internalName.
(please pick a unique internalName that is longer than 5 letters)
In your mod's folder, create an "Items", "Projectiles", "Tiles", "Walls", "NPCs", "Prefixes", or "Buffs" folders depending on what you wish to create, those folders will contain the json files for the simple game content.

Documentation is not finished yet, this section will expand as we continue!
tAPI is discontinued and thus no further documentation will be included...

top
kdcROYP.png




End User License Agreement
  1. This license agreement is a legal agreement between you and the tAPI team.
  2. By installing or otherwise using tAPI you agree to be bound by this agreement. If you do not agree to the terms of this Agreement, you may not install or use tAPI.
  3. The tAPI team specifically disclaims all warranties, expressed, implied or by any means. In no event shall the tAPI team be liable for any damage either from the direct use of tAPI or as a consequence of the use of tAPI.
  4. You may not violate any of the rules presented in the Player-Created Game Enhancements: Rules & Guidelines thread.
  5. You may not use tAPI in actions which infringe the rights of any person or entity.
  6. You may disassemble and reverse engineer any part of tAPI, although you are not allowed to redistribute said disassembled or reverse engineered tAPI contents.
  7. You acknowledge that tAPI is provided as "FREEWARE" and "AS IS", that you are not guaranteed support by the tAPI team, and that your saves & mods may break as tAPI updates.
  8. Above all, and in summary, use this at your own risk. Only you are reliable for any and all damages from you using tAPI.

top
kdcROYP.png




Download


top
kdcROYP.png




Release Changelog (current: r16)
  • Fixed infinite recursion in Utils.RotateRandom method
  • Fixed bug where no classes used ParseName for the file names
  • Fixed bug where Player.statManaMax2 was limited to 400
  • Fixed bug where tileCountWorld was not being cleared in clearWorld method
  • Fixed lighting issues
  • Fixed bug where hotbar numbers in hotbar slots wouldn't draw if there's no item inside the slot
  • Fixed Netplay.Init crashing the game on reload mods if you have joined a server at least once
  • Fixed platforms drawing strangely when sloped
  • Fixed Main.blockKey getting stuck under certain circumstances
  • Fixed bug regarding npc music being null
  • Fixed bug where you could spawn gore while the game is paused
  • Fixed inconsistencies with playerlayerdata.colorItem when LayerHeldItem is disabled
  • Fixed Town NPCs spawning indefinitely
  • Fixed issue where WireTrip would trip the tile it starts in (disabling timers when you use them)
  • Fixed buff code not resetting if a player dies
  • Fixed chests not having hover tooltips if the selected hotbar slot was blank
  • Fixed crash if a lootrule has no code or item List
  • Fixed catching NPCs not syncing properly
  • Fixed bug with new mod's options not being initialized
  • Fixed presents and goodie bags not dropping at surface level
  • Fixed bug where underground crimson music wouldn't play
  • Fixed bug when leaving custom crafting stations the 'nearby tiles' dont update immediately
  • Fixed bugs regarding sticky glowsticks
  • Fixed some bugs with the tAPI installer
  • Fixed some bugs with the tAPI uninstaller
  • Fixed some issues regarding mod syncing with the server not disabling your current mods
  • Added some mod logging
  • r10 tAPI mods will now be renamed to "<modname>.tapi.bad" when you try to load them (they're not supported / need a rebuild so this prevents them from causing issues until you do so)
  • write the code to place / open /destroy the chest object yourself, this just blocks the invalidation of the chest anchor)
  • Mods now show the amount of loaded items / projectiles / NPCs / buffs / tiles & more while in the mods menu, you can hold CTRL to see even more info about your mods now
  • Made most of NPC.cs's values public instead of private
  • Added support for importing vanilla players into tAPI
  • Added Tile boolean json field "grass" (default false) , makes the tile frame as grass does (make sure your sprite sheet matches it, to make the tile merge with things other than dirt just use the tileMerge field rather than mergeDirt)
  • Added Tile Property Player.tileTarget (returns Main.tile[tileTargetX, tileTargetY])
  • Added Tile boolean json field "chest", used for the purpose of allowing the tile to act as a chest object (you still need to
  • Added new modworld hook public override void ExtractinatorResult(int x, int y, Item item, List<LootRule> rules), you can use this to add new items to the extractinator or modify the existing ones
  • Added Tile boolean json field "explosionResistant" (default false), you can set this to true to make the tile immune to explosives
  • Added new modtiletype hook public override bool? ExplosionResistant(int tileX,int tileY,int x,int y, int radius, object source) , you can use this to make your tiles resistant to explosions based on what is attempting to blow them up


  • Fixed infinite recursion in Utils.RotateRandom method
  • Fixed bug where no classes used ParseName for the file names
  • Fixed bug where Player.statManaMax2 was limited to 400
  • Fixed bug where tileCountWorld was not being cleared in clearWorld method
  • Fixed lighting issues
  • Fixed bug where hotbar numbers in hotbar slots wouldn't draw if there's no item inside the slot
  • Fixed Netplay.Init crashing the game on reload mods if you have joined a server at least once
  • Fixed platforms drawing strangely when sloped
  • Fixed Main.blockKey getting stuck under certain circumstances
  • Fixed bug regarding npc music being null
  • Fixed bug where you could spawn gore while the game is paused
  • Fixed inconsistencies with playerlayerdata.colorItem when LayerHeldItem is disabled
  • Fixed Town NPCs spawning indefinitely
  • Fixed issue where WireTrip would trip the tile it starts in (disabling timers when you use them)
  • Fixed buff code not resetting if a player dies
  • Fixed chests not having hover tooltips if the selected hotbar slot was blank
  • Fixed crash if a lootrule has no code or item List
  • Fixed catching NPCs not syncing properly
  • Fixed bug with new mod's options not being initialized
  • Fixed presents and goodie bags not dropping at surface level
  • Fixed bug where underground crimson music wouldn't play
  • Fixed bug when leaving custom crafting stations the 'nearby tiles' dont update immediately
  • Fixed bugs regarding sticky glowsticks
  • Fixed some bugs with the tAPI installer
  • Fixed some bugs with the tAPI uninstaller
  • Fixed some issues regarding mod syncing with the server not disabling your current mods
  • Added some mod logging
  • r10 tAPI mods will now be renamed to "<modname>.tapi.bad" when you try to load them (they're not supported / need a rebuild so this prevents them from causing issues until you do so)
  • write the code to place / open /destroy the chest object yourself, this just blocks the invalidation of the chest anchor)
  • Mods now show the amount of loaded items / projectiles / NPCs / buffs / tiles & more while in the mods menu, you can hold CTRL to see even more info about your mods now
  • Made most of NPC.cs's values public instead of private
  • Added support for importing vanilla players into tAPI
  • Added Tile boolean json field "grass" (default false) , makes the tile frame as grass does (make sure your sprite sheet matches it, to make the tile merge with things other than dirt just use the tileMerge field rather than mergeDirt)
  • Added Tile Property Player.tileTarget (returns Main.tile[tileTargetX, tileTargetY])
  • Added Tile boolean json field "chest", used for the purpose of allowing the tile to act as a chest object (you still need to
  • Added new modworld hook public override void ExtractinatorResult(int x, int y, Item item, List<LootRule> rules), you can use this to add new items to the extractinator or modify the existing ones
  • Added Tile boolean json field "explosionResistant" (default false), you can set this to true to make the tile immune to explosives
  • Added new modtiletype hook public override bool? ExplosionResistant(int tileX,int tileY,int x,int y, int radius, object source) , you can use this to make your tiles resistant to explosions based on what is attempting to blow them up


  • Fixed Town NPCs spawning cauing a crash
  • Fixed Item.WriteCustomData / ReadCustomData crashing when no mods are installed
  • Fixed tileCountWorld being reset for every new X coord
  • Fixed issue where loaded worlds didnt count tiles
  • Fixed certain walls and fences not having reverse recipes
  • Fixed issue where ModBase.OnModCall would return its exception instead of throwing it
  • Wiring class members are now all public
  • Wiring on the original tiles now calls HitWire / PreHitWire

  • Added public static bool Mods.IsModEnabled(string internalName), can be used to check if a mod is loaded and enabled
  • Def classes now store their relevant JsonData in def.json (walls and tiles use TileDef.wallJson and TileDef.json dictionaries respectively)
  • tAPI mods now put all the source files into a folder in the tAPI file instead of the root folder of it
  • Added "displayTexture" string field for item group jsons (default null), if pointing to a texture the group will use it when displayed in crafting
  • Added "slopable" Boolean field for tile jsons (default null), if false it prevents the tile from being sloped.
  • Added "largeFrames" Boolean field for tile jsons (default false), if true the tile will frame in large brick patterns
  • Added "largeFrames" Boolean field for wall jsons (default false), works the same as the above
  • Added "noFail" Boolean field for tile jsons (default false), if true the tile will break immediately on the first attempt of removal
  • Added "pile" Boolean field for tile jsons (default false), if true the tile will merge with other "pile" tiles (e.g. coin tiles piles)
  • Added "obsidianKill" Boolean field for tile jsons (default false), if true the tile will be destroyed when obsidian attempts to spawn on it

  • Added ModBase public override void PreScreenClear(SpriteBatch sb)

  • Added NPC LootRule system!
  • Added ModNPC public override void SetupLootRules(NPC npc)
  • Added ModNPC public override void ItemsDropped(List<Item> items)
  • Added Player.lootLuck float field (default 1f), npcs dying near the closest player have affected drop rates via that player's lootLuck

  • Fixed bug where NPCs could error silently without the error being handled by tAPI
  • hopefully fixed previous implementation of making all error messages appear in English
  • Improved error message displays
  • All error messages are now logged to files under Documents/My Games/Terraria/tAPI/Logs
  • Hopefully every unhandled exception will now be handled properly
  • Made mod includePDB automatic, hopefully this will help modders get better error feedback when making their mods

  • Fixed bug where conflicting biomes (hallow / crimson / corruption) affected each other twice instead of once
  • Fixed bug where Palm Wood wasn't in the generic wood crafting group
  • Fixed bug where worms didn't gore properly
  • Fixed bug where you could try to activate mods without their mod references being activated as well
  • Fixed bug where resolution change buttons wouldn't change resolution until you restart the Games (only applies to fullscreen now)
  • Fixed bug where items dropped by mediumcore and hardcore players never appeared nearby
  • Fixed bug where music didn't stop if you set music volume to 0
  • Fixed bug where Sluggish prefix made items faster instead of slower
  • Fixed numerous bugs with mods menu buttons
  • Fixed numerous bugs with SendModData / Netreceive
  • Fixed numerous bugs with letting BinBuffers overread data
  • Fixed bug regarding some bosses displaying full name when dying
  • Fixed bug where certain biome dependent NPCs would desync horribly online
  • Fixed bug where town NPCs didnt make the town safe
  • Fixed bug where NPCs and Projectiles had a missing ID entry where items have the unloaded item (entry was removed)
  • Hopefully fixed bugs regarding town npc spawning
  • Fixed bug where zombies were very loud in comparison to other things
  • Fixed bug where Pinky did not call OnSpawn and Initialize properly (poor thing)
  • Fixed bug where smart cursor was broken
  • Re-added tAPI's 1.2.2 Update checker
  • Added Mod Options "Apply" button, will apply the options when you click it rather than when you leave the mod options menu (still saves and applies them on leaving menu as usual)
  • you can now type "localhost" in the IP bar to connect and it will work (however empty box is 127.0.0.1 which is the same thing so don't bother...)
  • Added "platform" Boolean field for tile jsons, makes the tile act as a platform and frame as one.
  • Added ModTileType public override bool Slope(int x,int y) called when the tile is being slopes.
  • Added new ModNPC hook - public override void OnSpawn() - called in NPC.NewNPC after the NPC has been set to appear
  • Added Projectile.OnSpawn() , same idea as the above

  • Disabled error ignorance, expect all hell to break loose*

  • Tile json placementOrigin is now clamped in the are beween 0,0 to tilewidth,tileheight
  • Fixed GetSpawnCoords method not working properly
  • Fixed issues revolving around building mods without cs files (hopefully)
  • Fixed issue where NPCs require a cs file to work
  • Fixed SaveModState method crashing if you have a fresh ModState file
  • Fixed selling and buying items removing their prefix and code instances
  • Fixed recent server list being erased
  • Fixed servers crashing if you had mod items with code loaded
  • Fixed issue where NPC.Initialize() was not called on negative netID NPCs
  • Fixed issue where NPC.Initialize() was called twice
  • We would like to thank Re-Logic for allowing us to let modders use some of Terraria's awesome generic methods included in this update
  • Wiring.TripWire is now public and width and height parameters were made optional
  • BuffDef & TileDef dictionaries now go by the convention of others (BuffDef.type[name] -> BuffDef.byName[name] , BuffDef.name[type] -> BuffDef.byType[type] , etc)
  • ModNPC ProjectileDamageNPC & ProjectileDealtNPC hooks were renamed to DamageNPC & DealtNPC , parameters stayed the same
  • ModItem.OnAffixName is now called even if the item has no prefix (for globals etc)
  • ItemSlots for equipment and accessories were renamed to show which one they are. ("EquipAccessory" / "EquipArmor" / "EquipArmorVanity" / "EquipAccessoryVanity")
  • ModNet.NetReceive now takes MessageBuffer argument (NetReceive(BinBuffer bb,int messageID) -> NetReceive(BinBuffer bb,int messageID, MessageBuffer buffer))
  • Added ModBase.modIndex (default -1) gets set to the mod's activation index when loaded and fixes a bug in sending custom mod messages
  • NPCDef definitions now contain modNPCTemplate field (an instance of the NPC's ModNPC)

  • Player.defaultItemGrabRange, Player.itemGrabSpeed, Player.itemGrabSpeedMax, Player.jumpHeight, Player.jumpSpeed are now public
  • Added player.itemGrabRange (int), acts as a per-player item grab range (restored to defaultItemGrabRange every frame)
  • Added Player.CheckAndSetSpawn(int x,int y) , simplifies setting up spawn points for players

  • Tile json
  • Added boolean field: "checkWalls" (default false) if set to true the tile will check frame whenever walls behind it get removed (necessary for picture frame tiles etc)
  • Added boolean field: "spawn" (default false) if set to true the tile will allow respawning on (required for custom beds)
  • Added int array "spawnAt" (default 0,0) (if set to anything else it will offset the spawning of the player on the tile by the offset)
  • Added boolean field: "directional" (default false) if set to true the tile will check for player's direction , if player looks to the right, placeStyle will increase by 1. (useful for making directional furniture)
  • added array field: "adjTile" (default empty array, accepts strings and ints) (tile IDs and names written here would be detected as nearby if you are near this tile)
  • placementConditions now accepts an array and combines them into a string if you use one

  • Added JsonPrettyPrinter class to ease writing json files via code
  • Improved Json Validation a bit , should fix lack of array support in some things that were documented as supporting those
  • Prettied up ModState.json / ModInfo.json generation
  • Hopefully fixed issue where some users require an empty .cs file for mods to compile
  • Added a big fat try all over Main.Draw , should not crash now if you tackle an error (will still take you to main menu and display error)
  • Added code to make game's culture English so error reports will be easier for us to understand and easier for those who got the errors to look it up

  • Fixed issue where chest "loot all" would be added twice / crash
  • Fixed issue where item slot clicks could get messed up
  • Fixed issue where some game properties didn't get reset properly on mods reload
  • Fixed bug where mod options did not save and loaded
  • Fixed issue where tiles which are not for housing would act as valid for housing
  • Fixed ModNPC.CanSpawn not being called
  • Fixed crashes when Main.dayRate is set to 0
  • Fixed custom tile frameWidth and frameHeight not being set to 16 by default

  • Added Utils.PlotLine(Point p0, Point p1, PerLinePoint plot, bool jump = true)
  • Added Utils.PlotLine(int x0, int y0, int x1, int y1, PerLinePoint plot, bool jump = true)
  • Added Util.Swap<T>(ref t1,ref t2) , basically replaces 2 objects.

  • Extensions
  • Added Color.Multiply(Color color2) (returns multiplied color)
  • Added Color.Premultiply() (returns premultiplied color)
  • Added Rectangle.Contains(Vector2 v) (returns true if v is within the rectangle, false otherwise)
  • Added Int32.Times(Action code) (executes code as many times as the int was , minimum 0)
  • Added Int32.Times(Action<int> code) (executes code(i) as many times as int was , minimum 0)
  • Added Bool.ToInt() (returns 1 if true , otherwise 0)
  • Added Bool.ToIntDirection() (returns 1 if true, otherwise -1)
  • Added Float.RotateLerp(float target,float lerpValue) (rotates the float towards target by lerpValue multiplier, wraps angles)
  • Added Float.RotateClamp(float target, float clampValue) (rotates the float towards target , but can't rotate more than clampValue, wraps angles)
  • Added Random.NextFloat() (returns a float between 0 and 1)
  • Added Random.NextVector2(float minimum,float maximum) (returns a Vector2 between (float minimum,float minimum) and (maximum,maximum))
  • Added Random.NextVector2Round(float minimumRadius,float maximumRadius) (returns a new round Vector2 with length between minimumRadius and maximumRadius)
  • Added Vector2.RotateRandom(double maxRadians) (returns the rotated Vector2 by a random angle between -maxRadians and maxRadians)
  • TCF release!


Thread Changelog (current: v9)
  • Updated download links & added a download for tAPI r16 (latest already linked to this, but there was no numbered link)
  • Added notes of discontinue :(
  • Updated download links & added a download for tAPI r15
  • Updated credits to include MiraiMai and Bawr as currently active members
  • Updated download links & added a download for tAPI r14a
  • Updated download links & added a download for tAPI r14
  • Updated download links & added a download for tAPI r13a
  • Updated download links & added a download for tAPI r13
  • Updated download links & added a download for tAPI r12
  • Thanking Re-Logic a bunch for allowing modders to use some of Terraria's awesome codes
  • Updated download links & added a download for tAPI r10
  • Updated tAPI logo to not have grainy edges
  • TCF release!


top
kdcROYP.png




Tutorials & Example mods

Grox The Great's Template Mod - contains various examples of tAPI features including items, projectiles, tiles and more

For those getting started with C#For those getting started with XNA

top
kdcROYP.png




Credits

top
kdcROYP.png




Final Notes

tAPI is dicontinued as of the Terraria 1.3 update and will not be updated to support it.
For further information check Shockah's post.
If you'd like to make mods for Terraria 1.3+, there are alternative modding APIs, please check some of them below!I'd also like to personally apologize for the lack of communication and the delayed update of the thread, and I hope you have all enjoyed tAPI while it lasted!

top
kdcROYP.png

 
Last edited:
Just a couple hours ago I decided to start using mods, but decided against it because I wanted them for the new version. Wasn't a long wait :dryadgrin:
Keep in mind there will likely be a short waiting period while people update their mods to r11 - It was a prerelease before so we made some fundamental changes that will require a port for most every mod.
 
Please note that this is still very much a beta. While it is functional, there may be things missing that we missed or need to rename and as such, for a while things are subject to change. Luckily, for the most part, they should not be large changes.

If you DO find something missing, feel free to tell us at the IRC linked in the OP or in this thread.
 
Status
Not open for further replies.
Back
Top Bottom