Skip to content

Corruption Runtime Functions

Timothy Barela edited this page Feb 22, 2018 · 2 revisions

Corruption Runtime Functions

Corruption is a collection of useful functions for interacting with Terraria and TShock. These previously lived in "utils.lua", but have now been converted to C#, and separated into a new dll. These functions are callable from within your scripts, other plugins, and other assemblies.

Notes:

  • These functions can probably be reorganized/matched with certain modules better, but since it doesn't affect anything atm, its being left as is.
  • The function signatures are not any particular language, but instead shown in a simple C# like format.
  • CustomNpc specific functions will be left in CustomNpc's, not moved to Corruption.

NpcFunctions

  • Broadcast(string,Color)
  • Ban(TSPlayer,string,string)
  • CreateCombatText(string,Color,Vector2)
  • FindCustomNpcs(string) : CustomNpc[] -- Staying in CustomNpcs
  • FindNpcs(string) : NPC[]
  • RandomDouble() : double
  • RandomInt(int,int) : int
  • SpawnCustomNpc(string,Vector2) : CustomNpc --- Staying in CustomNpcs
  • SpawnNpc(string,Vector2) : NPC
  • IsType(NPC,int) : bool

ProjectileFunctions

  • SpawnCustomProjectile(int owner, string name, float x, float y, float xSpeed, float ySpeed) : CustomProjectile -- Staying in CustomNPcs

AreaFunctions

  • GetRegion(string name) : Region
  • AroundRegion(float x, float y, string name) : bool
  • AtCavernLevel(TSPlayer player) : bool
  • AtSkyLevel(TSPlayer player) : bool
  • AtSurfaceLevel(TSPlayer player) : bool
  • AtUndergroundLevel(TSPlayer player) : bool
  • AtUnderworldLevel(TSPlayer player) : bool
  • InAndAroundRegion(TSPlayer player, float x, float y, string name) : bool
  • InBeach(TSPlayer player) : bool
  • InCorruption(TSPlayer player) : bool
  • InCrimson(TSPlayer player) : bool
  • InDesert(TSPlayer player) : bool
  • InDungeon(TSPlayer player) : bool
  • InForest(TSPlayer player) : bool
  • InGlowshroom(TSPlayer player) : bool
  • InHallow(TSPlayer player) : bool
  • InIce(TSPlayer player) : bool
  • InRegion(TSPlayer player, string name) : bool
  • InJungle(TSPlayer player) : bool
  • InMeteor(TSPlayer player) : bool
  • InWater(float x, float y) : bool

TimeFunctions

  • AfterAnyMechBoss() : bool
  • AfterGolem() : bool
  • AfterMoonLord() : bool
  • AfterPlantera() : bool
  • DuringTime(string min, string max) : bool
  • DuringDay() : bool
  • DuringNight() : bool
  • DuringBloodMoon() : bool
  • DuringFrostMoon() : bool
  • DuringEclipse() : bool
  • DuringMoonPhase(int phase) : bool
  • DuringHardmode() : bool
  • DuringPumpkinMoon() : bool
  • DuringRain() : bool
  • DuringSlimeRain() : bool

TileFunctions

  • GetTile(int x, int y) : ITile
  • SetTile(int column, int row, int type)
  • RadialSetTile(int x, int y, int radius, int type)
  • KillTile(int column, int row)
  • RadialKillTile(int x, int y, int radius)
  • IsSolidTile(int column, int row) : bool
  • IsSolidOrSlopedTile(int column, int row) : bool
  • IsWallTile(int column, int row) : bool
  • IsLiquidTile(int column, int row) : bool
  • TileX(float worldX) : int
  • TileY(float worldY) : int
  • WorldX(int tileX) : int
  • WorldY(int tileY) : int

PlayerFunctions

  • HurtPlayer(TSPlayer player, int damage, bool critical, string deathReason)
  • KillPlayer(TSPlayer player, string deathReason)
  • RadialHurtPlayer(int x, int y, int radius, int damage, float falloff, string deathReason)
  • PlayerAmountInRegion(string regionName, int minAmount) : bool
  • PlayerAmountConnected(int minAmount) : bool
  • PlayerHasPermission(TSPlayer player, params string[] permissions) : bool
  • PlayerHasGroup(TSPlayer player, params string[] groups) : bool

PlayerCommandFunctions

  • ExecuteCommand(TSPlayer player, string text) : bool

Clone this wiki locally