From 3a0e4b29fabdf5ce69fe5fe7cfd77b3aba6d6dfa Mon Sep 17 00:00:00 2001 From: Deltin Date: Wed, 3 Jul 2019 22:44:59 -0400 Subject: [PATCH] Updated version and examples --- Deltinteger/Deltinteger/Program.cs | 2 +- Examples/Death Spheres.del | 2 +- Examples/Murder Mystery.del | 2 +- Examples/hitscan_spheres.del | 35 ------------------------------ Examples/methods.del | 22 +++++++------------ 5 files changed, 11 insertions(+), 52 deletions(-) delete mode 100644 Examples/hitscan_spheres.del diff --git a/Deltinteger/Deltinteger/Program.cs b/Deltinteger/Deltinteger/Program.cs index 80fa0bf0a..3481423a9 100644 --- a/Deltinteger/Deltinteger/Program.cs +++ b/Deltinteger/Deltinteger/Program.cs @@ -13,7 +13,7 @@ namespace Deltin.Deltinteger { public class Program { - public const string VERSION = "v0.3.8"; + public const string VERSION = "v0.3.9"; static Log Log = new Log(":"); static Log ParseLog = new Log("Parse"); diff --git a/Examples/Death Spheres.del b/Examples/Death Spheres.del index 87f72b440..c22e6a731 100644 --- a/Examples/Death Spheres.del +++ b/Examples/Death Spheres.del @@ -27,7 +27,7 @@ if (IsAlive()) if (DistanceBetween(EventPlayer(), loc) < radius) { deathCount += 1; - SmallMessage(EventPlayer(), <"Danger! ... dead, try again and survive! sudden death: <0>", deathCount>); + SmallMessage(EventPlayer(), <"Danger! ... dead, try_again and survive! sudden_death: <0>", deathCount>); Kill(); } } diff --git a/Examples/Murder Mystery.del b/Examples/Murder Mystery.del index d472dfde7..459df3197 100644 --- a/Examples/Murder Mystery.del +++ b/Examples/Murder Mystery.del @@ -247,7 +247,7 @@ Event.OngoingPlayer if (isInitialized) if (role == Observer) { - CreateHudText(EventPlayer(), <"Ability -> Build in view, Crouch and ability -> go in view">, + CreateHudText(EventPlayer(), <"Ability -> Build in_view, Crouch and ability -> go in_view">, null, null, Location.Top, 0, Color.Green); roleHud = LastTextID(); } diff --git a/Examples/hitscan_spheres.del b/Examples/hitscan_spheres.del deleted file mode 100644 index 49ed1ca9a..000000000 --- a/Examples/hitscan_spheres.del +++ /dev/null @@ -1,35 +0,0 @@ -usevar globalvar A; -usevar playervar A; - -define playervar isInLOS; -define playervar loc; -define playervar radius; - -rule: "Setup" -Event.Ongoing_EachPlayer -{ - loc = Vector(83.52, 14.18, -84.29); - radius = 1; - - CreateHudText(EventPlayer(), isInLOS); - CreateEffect(EventPlayer(), Effects.Sphere, Color.Red, loc, radius / 0.98472); -} - -rule: "Update" -Event.Ongoing_EachPlayer -{ - isInLOS = IsSphereInView(loc, radius, EventPlayer()); - Wait(); - Loop(); -} - -method IsSphereInView(center, rad, player) -{ - define eyePos = EyePosition(player); - define facing = FacingDirectionOf(player); - define what = eyePos + (AbsoluteValue(DotProduct(center - eyePos), facing) * facing); - - return DistanceBetween(Vector(0, 0, 0), center - what) <= rad - & IsInLineOfSight(what, eyePos) - & DistanceBetween(what, eyePos) <= 999; -} \ No newline at end of file diff --git a/Examples/methods.del b/Examples/methods.del index ab761bdbe..581a0d752 100644 --- a/Examples/methods.del +++ b/Examples/methods.del @@ -8,10 +8,10 @@ if (IsButtonHeld(EventPlayer(), Button.Interact)) // Iterate through all players to check if they are an AI. foreach (define player in AllPlayers()) { - define isAI = IsAI(AllPlayers()[player]); + define isAI = IsAI(player); // Send the message. - SmallMessage(EventPlayer(), <"<0>: <1>", AllPlayers()[player], isAI>); + SmallMessage(EventPlayer(), <"<0>: <1>", player, isAI>); Wait(2); } @@ -20,27 +20,21 @@ if (IsButtonHeld(EventPlayer(), Button.Interact)) method IsAI(player) { define currentHero = HeroOf(player); - define heroSwap = HeroVar(Hero.Ana); - define isAI; + define heroSwap = Hero.Ana; /* Swap a player to Ana (Bastion if they are Ana), check if they are the new hero, then swap them back. Possible improvements: Swap to a hero that isnt an option for AI. */ - if (currentHero == HeroVar(Hero.Ana)) + if (currentHero == Hero.Ana) { - heroSwap = HeroVar(Hero.Bastion); + heroSwap = Hero.Bastion; } ForcePlayerHero(player, heroSwap); - if (HeroOf(player) == currentHero) - { - isAI = true; - } - else - { - isAI = false; - } + + define isAI = HeroOf(player) == currentHero; + ForcePlayerHero(player, currentHero); StopForcingHero(player);