public string Save(bool saveOnlyIfActive = true) { if (Player == null) { return(""); } if (saveOnlyIfActive) { if (!Player.IsActive()) { DebugLogger.DebugOnlyDialogLog("PLAYER " + Player.Name + " NOT BEING SAVED BECAUSE HE WASN'T ACTIVE"); return(""); } } if (Player.Name.Contains("Unnamed")) { DebugLogger.DebugOnlyDialogLog("PLAYER NOT BEING SAVED BECAUSE HE IS CALLED 'Unnamed'"); return(""); } string data = Player.Save(); for (int i = 0; i < Equipment.Count; i++) { data += Equipment[i].ToString(); if (i == Equipment.Count - 1) { data += ";"; } else { data += ":"; } } return(data); }
public void CallReinforcement(TPlayer player) { Area area = GlobalGame.GetCameraArea(); for (int i = 0; i < PlayerList.Count; i++) { TPlayer pl = PlayerList[i]; if (pl != null && pl.IsActive() && pl != player && pl.Team == player.Team && !pl.IsAlive()) { float x = GlobalRandom.Next((int)(area.Left + area.Width / 5), (int)(area.Right - area.Width / 5)); float y = WorldTop + 50; IObject crate = GlobalGame.CreateObject("SupplyCrate00", new Vector2(x, y)); IObject platf = GlobalGame.CreateObject("Lift00A", new Vector2(x, y - 10)); IObject leftBorder = GlobalGame.CreateObject("Lift00A", new Vector2(x - 10, y), (float)Math.PI / -2); IObject rightBorder = GlobalGame.CreateObject("Lift00A", new Vector2(x + 10, y), (float)Math.PI / 2); leftBorder.SetBodyType(BodyType.Dynamic); rightBorder.SetBodyType(BodyType.Dynamic); IObjectDestroyTargets destroy = (IObjectDestroyTargets)GlobalGame.CreateObject("DestroyTargets", new Vector2(x, y)); platf.SetMass(1e-3f); leftBorder.SetMass(1e-3f); rightBorder.SetMass(1e-3f); IObjectWeldJoint joint = (IObjectWeldJoint)GlobalGame.CreateObject("WeldJoint", new Vector2(x, y)); joint.AddTargetObject(crate); joint.AddTargetObject(platf); joint.AddTargetObject(rightBorder); joint.AddTargetObject(leftBorder); destroy.AddTriggerDestroyObject(crate); destroy.AddObjectToDestroy(joint); destroy.AddObjectToDestroy(platf); destroy.AddObjectToDestroy(leftBorder); destroy.AddObjectToDestroy(rightBorder); ObjectsToRemove.Add(destroy); ObjectsToRemove.Add(platf); ObjectsToRemove.Add(joint); ObjectsToRemove.Add(leftBorder); ObjectsToRemove.Add(rightBorder); pl.Equipment.Clear(); pl.Armor.SetId(0); pl.Revive(100, false, true, x, y); player.AddExp(5, 5); } } }