Files
LuaCsForBarotraumaEP/Barotrauma/BarotraumaShared/Source/GameSession/GameModes/CampaignMode.cs
T
Joonas Rikkonen 9114ae658f - Modified item buying logic: selected items are purchased immediately without having to click the "buy" button, and they stay in the list of purchased items until the round is started. (-> It's possible to see which items have been purchased and cancel purchases).
- Clients can be given a permission to manage the campaign (atm selecting which location to head towards and buying items).
- Syncing cargomanager state with clients.
- Misc fixes.
2017-09-17 15:55:24 +03:00

63 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Xml.Linq;
namespace Barotrauma
{
abstract class CampaignMode : GameMode
{
public readonly CargoManager CargoManager;
const int InitialMoney = 10000;
protected Map map;
public Map Map
{
get { return map; }
}
public override Mission Mission
{
get
{
return Map.SelectedConnection.Mission;
}
}
private int money;
public int Money
{
get { return money; }
set { money = Math.Max(value, 0); }
}
public CampaignMode(GameModePreset preset, object param)
: base(preset, param)
{
Money = InitialMoney;
CargoManager = new CargoManager(this);
}
public void GenerateMap(string seed)
{
map = new Map(seed, 1000);
}
protected List<Submarine> GetSubsToLeaveBehind(Submarine leavingSub)
{
//leave subs behind if they're not docked to the leaving sub and not at the same exit
return Submarine.Loaded.FindAll(s =>
s != leavingSub &&
!leavingSub.DockedTo.Contains(s) &&
(s.AtEndPosition != leavingSub.AtEndPosition || s.AtStartPosition != leavingSub.AtStartPosition));
}
public override void End(string endMessage = "")
{
base.End(endMessage);
}
public abstract void Save(XElement element);
}
}