Core/Scripts: Reworked scripts. More to come.

This commit is contained in:
hondacrx
2021-02-18 11:57:11 -05:00
parent 1e2b303b35
commit 03456fb574
19 changed files with 2158 additions and 704 deletions
+18
View File
@@ -340,6 +340,24 @@ namespace Game.Scripting
public virtual CreatureAI GetAI(Creature creature) { return null; }
}
public class GenericGameObjectScript<AI> : GameObjectScript where AI : GameObjectAI
{
public GenericGameObjectScript(string name, object[] args) : base(name)
{
_args = args;
}
public override GameObjectAI GetAI(GameObject me)
{
if (me.GetInstanceScript() != null)
return GetInstanceAI<AI>(me);
else
return (AI)Activator.CreateInstance(typeof(AI), new object[] { me }.Combine(_args));
}
object[] _args;
}
public class GameObjectScript : ScriptObject
{
public GameObjectScript(string name) : base(name)