Code Monkey home page Code Monkey logo

prism's Introduction

Prism

Modding API for Terraria 1.3.* (Yet Another Mod To Make Mods, batteries not included and some assembly is required) (not a spying program, we promise!)

Prism files are placed in the My Games\Terraria\Prism\ folder (Located in Documents\ on windows, ~/.local/share/Terraria/ on Linux and ~/Library/Application Support/Terraria/ on OS X, but the Windows notation will be used here), so it doesn't mess with vanilla files.

Prism is licensed under the Artistic License WTFPL, because it is was is no longer in developement. (It is definitely very dead now).

For the latest release, see the master branch. The in-developement version can be found on the develop branch. The Terraria 1.3.0 version is on the v1-3-0 branch, and the 1.3.1 version is on the v1-3-1 one.

Binaries can be found here. Modest documentation is available here

Support

For help specifically with getting Prism to work as well as using it in your own mods, come chat with us on the #PrismAPI channel on irc.esper.net using your favorite IRC client or using this quick online one. The channel's as dead as Prism.

To chat with a variety of mod developers and veteran mod developers about general Terraria coding, come chat on the #tapi channel on irc.esper.net using your favorite IRC client or using this quick online one. This channel is also quite dead, as everyone moved to Discord anyway.

Building

Copy your Terraria.exe file into .\References before attempting to build.

  • Windows:
  • Install Visual Studio 2015 if you don't have it (You can get the Community version for free).
  • Open the solution in Visual Studio.
  • Click "Build Solution" (you may have to additionally click "Rebuild Solution" in order for it to build properly).
  • Prism can also be built using MSBuild from the command-line: msbuild /m Prism.sln /p:Configuration=DevBuild. (not including the /p switch will default to PreRelease instead of DevBuild).
  • OS X & Linux:
  • Install the Mono Platform if you don't have it (mono or mono-complete on most distros).
  • Execute xbuild Prism.sln /p:Configuration=DevBuild to build solution with XBuild. (not including the /p switch will default to PreRelease instead of DevBuild).
  • This should automatically load Terraria.exe, patch it, then create a Prism.Terraria.dll file for Prism.csproj to reference.
  • The Prism binaries as well as all other required files will be located in .\Bin\Debug:
  • Prism.exe / Prism.pdb - Prism
  • Prism.Injector.dll / Prism.Injector.pdb - Core injection lib used by Prism.TerrariaPatcher.csproj (and later by the installer).
  • Prism.Terraria.dll - The patched version of the Terraria.exe that was provided.
  • Prism.TerrariaPatcher.exe / Prism.TerrariaPatcher.pdb - The patcher (run when you build Prism.csproj)
  • Steamworks.NET.dll - Steamworks lib required by vanilla Terraria (and therefore by Prism as well).
  • Ionic.Zip.CF - Lib used by vanilla Terraria for compressing saves.
  • Newtonsoft.Json.dll - Lib used by vanilla Terraria for Json support (not to be confused with LitJson, which Prism uses).
  • dnlib.dll - Very powerful IL manipulation lib used by Prism.Injector.csproj
  • [Windows Only]: Microsoft.Xna.Framework.* The entire XNA Framework. For some reason you have to include the whole thing like this if you load an XNA assembly indirectly.
  • [OS X & Linux Only]: FNA.dll - This handy open platform version of XNA: https://github.com/flibitijibibo/FNA. It contains some custom patches, see References\FNA.patch and References\FNA.patch.readme.txt.

Launching Prism

  • On Windows, choose one of the following options:
  • Run Prism.exe directly from the build folder. You must copy Terraria's .\Content folder in order for the game to have access to the content (and therefore not crash immediately upon opening). Making a symlink works as well.
  • Copy all of the files from the Prism build folder into your Terraria installation's folder and do one of the following:
    • Run Prism.exe [Recommended, although there is a very small chance of Steam refusing to let you launch the game like this because of the DRM]
    • Rename your original Terraria.exe to something else (e.g. Terraria_Backup.exe), then rename Prism.exe to Terraria.exe, then launch Terraria from your Steam game library [not reccommended, as it's not as easy to go back to original Terraria if you wish]
    • Add Prism.exe to GameLauncher's App list and run it from there.
  • On OSX & Linux you have the same options except:
  • Run the game with Prism.sh (sets $LD_LIBRARY_PATH path and runs mono Prism.exe)
  • If you rename Prism.exe, open Prism.sh in a text editor and edit the mono Prism.exe line to reflect the change.
  • GameLauncher is Windows-only as far as we know.

Mods

Mods are loaded in the My Games\Terraria\Prism\Mods\ folder. Each individual mod is placed in its own folder.

Each mod folder must contain:

  • A manifest.json file, which contains these information fields:
  • "internalName" - The mod's internal name.
  • "displayName" - The mod's display name.
  • "author" - The mod's author (optional).
  • "version" - The mod's version (optional, as #.#.#.#).
  • "description" - The mod's description (optional).
  • "modDefTypeName" - Name of the class which extends ModDef in the mod's assembly.
  • "asmFileName" - The name of the mod's code assembly. (See ModDef, ModData, ModInfo and ModLoader for implementation details.)

Then, all resource files (any file that is not the manifest file, assembly file or any other file with an open file handle) are loaded into Prism (though it's recommended to make a specific folder for your resources, e.g. .\Resources). These can be accessed and deserialized using a predefined or custom deserializer. See the Prism.Mods.Resources namespace for more info.

When the ModDef implementation is instantiated, control is handed to it (as far as the Prism engine wants to). This includes loading item definitions.

See the example mod for... an example. The contents of its output folder should be put in its own folder with in the Mods folder, for example Mods\Prism.ExampleMod\ .

Note that on Windows, building Prism.ExampleMod.csproj will automatically copy the build output of the example mod into its own folder within the mod folder: Documents\My Games\Terraria\Prism\Mods\Prism.ExampleMod\.

prism's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prism's Issues

Problem Opening

So I opened Prism for the first time and got this message:

A fatal error occured:
System.TypeInitializationException: The type initializer for
'Terraria.Main' threw an exception. ---> System.NullReferenceException:
Object reference not set to an instance of an object.
at Terraria.NPC.RealSetDefaults(Int32 Type, Single scaleOverride)
at Terraria.NPC.SetDefaults(Int32 Type, Single scaleOverride)
at Terraria.NPC.RealSetDefaults(String Name)
at Terraria.Item.SetDefaults(String ItemName
at Terraria.Player..ctor()
at Terraria.Main..ctor() in C:\Users\Pieter\Documents\Visual Studio
2015\Projects\Prism\Prism\PrismLauncher.cs:line 87
at Prism.Program.Main(string[] args)in C:\Users\Pieter\Documents\Visual Studio
2015\Projects\Prism\Prism\Program.cs:line 35

did i do something wrong? i thought i followed all of the steps... maybe it's a glitch. please RASAP

Error? Is it just me? Did I do something wrong?

I tried following the instructions in the README.md file and even made a mod in visual studio (all using the latest build) I build the solution with the projects inside and have the Prism.Terraria.dll file in references as well as a copied over Terraria.exe.

This brings me to my problem. When I press start or start without debugging, I get an error within the first 5 seconds after pressing the button. This error basically says that the TileCracks.xnb file was not found. I have double checked and inside the Terraria/Conent/Images folder, the file is exactly where the error says it is not.

untitled

The error is above.

Am I doing something wrong? Is this a bug or something you guys know about? (And especially) Can this be fixed?

EDIT: I'm using Terraria V.1.3.0.6 BTW

I need help with TileCracks.xnb

I do not have Tilecracks.xnb in my Content/Images folder, I also don't have the Prism.exe file. When I try and open Terraria with Tmodloader it shows this.
capture

ApplyHotfixes() bug

I'm not at a point where I can merge back into the main project. But there is a bug in TMain.ApplyHotfixes() that causes some pretty gnarly performance hits.

The line foreach (Player p in from plr in player where plr.active = true select plr) plr.active is being set to true :D

Stuff TODO before hack can be merged back into develop

  • #24
  • Make Prism use a separate input profiles.json file, instead of vanilla's
  • A few hooks in Main
  • ./find-todos.sh
    • Proper WAV reading
    • Complete Projectile AIStyles
    • Complete NPC AIStyles
  • [ ] Reenable certain hooks They haven't been enabled for quite a while.
    • [ ] ItemBehaviour.CanUse
    • [ ] ItemBehaviour.UseItem
  • Replace as much if (dict.ContainsKey(foo)) DoStuff(dict[foo]); with TryGetValue
  • [ ] Make chest loading faster Seems to be as fast as I can get it to be...
  • Make ammo types not suck

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.