Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using System.Collections.Generic;
- using Microsoft.Xna.Framework;
- using Terraria;
- using Terraria.ID;
- using Terraria.DataStructures;
- using Terraria.Localization;
- using Terraria.ModLoader;
- using Terraria.ModLoader.IO;
- namespace SGAmod
- {
- public class SGAWorld: ModWorld
- {
- //Setting up variables for invasion
- public static bool customInvasionUp = false;
- public static bool downedCustomInvasion = false;
- public static bool downedSPinky = false;
- public static bool downedTPD = false;
- //Initialize all variables to their default values
- public override void Initialize()
- {
- Main.invasionSize = 0;
- customInvasionUp = false;
- downedCustomInvasion = false;
- downedSPinky = false;
- downedTPD = false;
- }
- //Save downed data
- public override TagCompound Save()
- {
- var downed = new List<string>();
- if (downedCustomInvasion) downed.Add("customInvasion");
- if (downedSPinky) downed.Add("downedSPinky");
- if (downedTPD) downed.Add("downedTPD");
- return new TagCompound {
- {"downed", downed}
- };
- }
- //Load downed data
- public override void Load(TagCompound tag)
- {
- var downed = tag.GetList<string>("downed");
- downedCustomInvasion = downed.Contains("customInvasion");
- downedSPinky=downed.Contains("downedSPinky");
- downedTPD=downed.Contains("downedTPD");
- }
- //Sync downed data
- public override void NetSend(BinaryWriter writer)
- {
- BitsByte flags = new BitsByte();
- flags[0] = downedCustomInvasion;
- flags[1] = downedSPinky;
- flags[2] = downedTPD;
- writer.Write(flags);
- }
- //Sync downed data
- public override void NetReceive(BinaryReader reader)
- {
- BitsByte flags = reader.ReadByte();
- downedCustomInvasion = flags[0];
- downedSPinky = flags[1];
- downedTPD = flags[2];
- }
- public static void Shattershots(Vector2 here,Vector2 there,Vector2 widthheight,int type,int damage,float Speed,float spread,int count,bool centershot,float globalangularoffset,bool tilecollidez,int timeleft){
- //if (Main.netMode!=1){
- Vector2 vector8 = new Vector2(here.X + (0), here.Y + (0));
- //int type = mod.ProjectileType("EnkiduWind");
- //Main.PlaySound(2, (int)here.X, (int)here.Y, 12);
- float rotation = (float)Math.Atan2(vector8.Y - (there.Y + (widthheight.X * 0.5f)), vector8.X - (there.X + (widthheight.Y * 0.5f)));
- spread = spread * (0.0174f);
- float baseSpeed = (float)Math.Sqrt((float)((Math.Cos(rotation) * Speed) * -1) * (float)((Math.Cos(rotation) * Speed) * -1) + (float)((Math.Sin(rotation) * Speed) * -1) * (float)((Math.Sin(rotation) * Speed) * -1));
- double startAngle = Math.Atan2((float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1));
- double deltaAngle = spread/count;
- double offsetAngle;
- int i;
- for (i = 0; i < count;i++ )
- {
- offsetAngle = (startAngle+globalangularoffset) + deltaAngle * i;
- double offsetAngle2 = (startAngle+globalangularoffset) - (deltaAngle * i);
- if (centershot==true || i>0){
- int proj=Projectile.NewProjectile(vector8.X, vector8.Y, baseSpeed*(float)Math.Sin(offsetAngle), baseSpeed*(float)Math.Cos(offsetAngle), type, damage, Speed, 0);
- Main.projectile[proj].friendly=false;
- Main.projectile[proj].hostile=true;
- Main.projectile[proj].tileCollide = tilecollidez;
- Main.projectile[proj].timeLeft = timeleft;
- }
- if (i>0){
- int proj2=Projectile.NewProjectile(vector8.X, vector8.Y, baseSpeed*(float)Math.Sin(offsetAngle2), baseSpeed*(float)Math.Cos(offsetAngle2), type, damage, Speed, 0);
- Main.projectile[proj2].friendly=false;
- Main.projectile[proj2].hostile=true;
- Main.projectile[proj2].tileCollide = tilecollidez;
- Main.projectile[proj2].timeLeft = timeleft;
- }
- }
- //}
- }
- //end of function
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement