v0.2: iteminventory sync bugfix, meleeweapon "reload time", spears can be picked even if they're stuck inside a wall, tutorial bugfixes, "submarine godmode", removed round duration, drag character sync, reliable structure damage messages, job assignment bugfixes, some extra sounds

This commit is contained in:
Regalis
2015-10-17 16:01:42 +03:00
parent 838022fcd5
commit 3c1a66078c
51 changed files with 457 additions and 213 deletions
+6 -1
View File
@@ -747,7 +747,9 @@
<Content Include="Content\waterbump.png"> <Content Include="Content\waterbump.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Data\ContentPackages\Vanilla 0.1.3.xml" /> <Content Include="Data\ContentPackages\Vanilla 0.2.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Icon.ico" /> <Content Include="Icon.ico" />
<Content Include="OpenAL32.dll"> <Content Include="OpenAL32.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -884,6 +886,9 @@
<None Include="Content\Items\Weapons\railgun.ogg"> <None Include="Content\Items\Weapons\railgun.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Content\Items\Weapons\smack.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Items\Weapons\stunbaton.ogg"> <None Include="Content\Items\Weapons\stunbaton.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
@@ -46,15 +46,15 @@
<joint limb1="0" limb1anchor="112,77" limb2="1" limb2anchor="0,-190" lowerlimit="-180" upperlimit="-90"/> <joint limb1="0" limb1anchor="112,77" limb2="1" limb2anchor="0,-190" lowerlimit="-180" upperlimit="-90"/>
<joint limb1="1" limb1anchor="0,190" limb2="2" limb2anchor="0,-100" lowerlimit="-50" upperlimit="0"/> <joint limb1="1" limb1anchor="0,190" limb2="2" limb2anchor="0,-100" lowerlimit="-50" upperlimit="0"/>
<joint limb1="2" limb1anchor="0,120" limb2="3" limb2anchor="-15,-250" lowerlimit="-50" upperlimit="0"/> <joint limb1="2" limb1anchor="0,120" limb2="3" limb2anchor="15,-250" lowerlimit="-50" upperlimit="0"/>
<joint limb1="0" limb1anchor="0,0" limb2="4" limb2anchor="0,-190" lowerlimit="-180" upperlimit="-90"/> <joint limb1="0" limb1anchor="0,0" limb2="4" limb2anchor="0,-190" lowerlimit="-180" upperlimit="-90"/>
<joint limb1="4" limb1anchor="0,190" limb2="5" limb2anchor="0,-100" lowerlimit="-50" upperlimit="0"/> <joint limb1="4" limb1anchor="0,190" limb2="5" limb2anchor="0,-100" lowerlimit="-50" upperlimit="0"/>
<joint limb1="5" limb1anchor="0,120" limb2="6" limb2anchor="-15,-250" lowerlimit="-50" upperlimit="0"/> <joint limb1="5" limb1anchor="0,120" limb2="6" limb2anchor="15,-250" lowerlimit="-50" upperlimit="0"/>
<joint limb1="0" limb1anchor="-53,-164" limb2="7" limb2anchor="0,-190" lowerlimit="-180" upperlimit="-90"/> <joint limb1="0" limb1anchor="-53,-164" limb2="7" limb2anchor="0,-190" lowerlimit="-180" upperlimit="-90"/>
<joint limb1="7" limb1anchor="0,190" limb2="8" limb2anchor="0,-100" lowerlimit="-50" upperlimit="0"/> <joint limb1="7" limb1anchor="0,190" limb2="8" limb2anchor="0,-100" lowerlimit="-50" upperlimit="0"/>
<joint limb1="8" limb1anchor="0,120" limb2="9" limb2anchor="-15,-250" lowerlimit="-50" upperlimit="0"/> <joint limb1="8" limb1anchor="0,120" limb2="9" limb2anchor="15,-250" lowerlimit="-50" upperlimit="0"/>
</ragdoll> </ragdoll>
+1 -1
View File
@@ -53,7 +53,7 @@
</Item> </Item>
<Item <Item
name="Body Armour" name="Body Armor"
pickdistance="150" pickdistance="150"
tags="smallitem"> tags="smallitem">
@@ -27,7 +27,7 @@
name="Vent" name="Vent"
linkable="true"> linkable="true">
<Sprite texture ="vent.png" depth="0.85"/> <Sprite texture ="vent.png" depth="0.91"/>
<Vent> <Vent>
<sound file="ventilation.ogg" type="OnActive" range="600.0" volume="OxygenFlow" volumemultiplier="0.001f" loop="true"/> <sound file="ventilation.ogg" type="OnActive" range="600.0" volume="OxygenFlow" volumemultiplier="0.001f" loop="true"/>
+2 -1
View File
@@ -50,7 +50,8 @@
<Item <Item
name="Fuel Rod" name="Fuel Rod"
Tags="smallitem" Tags="smallitem"
pickdistance="150"> pickdistance="150"
price="200">
<Sprite texture ="fuelrod.png"/> <Sprite texture ="fuelrod.png"/>
Binary file not shown.
+9 -7
View File
@@ -4,6 +4,7 @@
<Item <Item
name="Spear" name="Spear"
pickdistance="200" pickdistance="200"
pickthroughwalls="true"
price="50"> price="50">
<Sprite texture ="spear.png" depth="0.55"/> <Sprite texture ="spear.png" depth="0.55"/>
@@ -67,10 +68,10 @@
<Body width="90" height="30" density="10"/> <Body width="90" height="30" density="10"/>
<MeleeWeapon slots="Any,RightHand,LeftHand" <MeleeWeapon slots="Any,RightHand,LeftHand"
aimpos="50,0" handle1="-15,-6" holdangle="100"> aimpos="50,0" handle1="-15,-6" holdangle="100" reload="1.0">
<RequiredItems name="Battery Cell" type="Contained" msg="Loaded Battery Cell required"/> <Attack damage="2" stun="0.2" damagetype="Blunt" sound="Content/Items/Weapons/smack.ogg"/>
<Attack stun="10.0" sound="Content/Items/Electricity/zap1.ogg"/> <StatusEffect type="OnUse" target="Contained,Character" Condition="-25.0" stun="10.0" disabledeltatime="true" sound="Content/Items/Weapons/stunbaton.ogg">
<StatusEffect type="OnUse" target="Contained" Condition="-25.0" disabledeltatime="true" sound="Content/Items/Weapons/stunbaton.ogg"> <RequiredItem name="Battery Cell" type="Contained" msg="Loaded Battery Cell required"/>
<Explosion range="100.0" force="0.1" shockwave="false" flames="false" camerashake="5.0"/> <Explosion range="100.0" force="0.1" shockwave="false" flames="false" camerashake="5.0"/>
</StatusEffect> </StatusEffect>
</MeleeWeapon> </MeleeWeapon>
@@ -81,9 +82,10 @@
</Item> </Item>
<Item <Item
name="Battery Cell" name="Battery Cell"
pickdistance="150" pickdistance="150"
tags="smallitem,loadable"> tags="smallitem,loadable"
price="50">
<Sprite texture ="stunbaton.png" sourcerect="0,0,20,9" depth="0.8"/> <Sprite texture ="stunbaton.png" sourcerect="0,0,20,9" depth="0.8"/>
+4 -2
View File
@@ -41,9 +41,11 @@
<Skill name="Construction" level="10,20"/> <Skill name="Construction" level="10,20"/>
<Skill name="Electrical Engineering" level="10,20"/> <Skill name="Electrical Engineering" level="10,20"/>
</Skills> </Skills>
<Item name="ID Card"/>
<Item name="Stun Baton"/> <Item name="Stun Baton"/>
<Item name="Body Armor"/> <Item name="Battery Cell"/>
<Item name="Ballistic Helmet"/> <Item name="Body Armor" equip="true"/>
<Item name="Ballistic Helmet" equip="true"/>
</Job> </Job>
<Job name="Assistant" description="Assistants don't have any specific responsibilities or areas of expertise. This job is a good choice for newcomers who want to get a hang of working on board the submarine without taking up tasks that they aren't qualified for." allowalways="true"> <Job name="Assistant" description="Assistants don't have any specific responsibilities or areas of expertise. This job is a good choice for newcomers who want to get a hang of working on board the submarine without taking up tasks that they aren't qualified for." allowalways="true">
+3 -3
View File
@@ -48,9 +48,6 @@
<topwall sprite="Content/Map/testroom.png" sourcerect="144,464,496,32" depth ="0.06" castshadow="true" <topwall sprite="Content/Map/testroom.png" sourcerect="144,464,496,32" depth ="0.06" castshadow="true"
width = "64" height ="32" resizehorizontal="true" body="true" health="500"/> width = "64" height ="32" resizehorizontal="true" body="true" health="500"/>
<bottomwall sprite="Content/Map/testroom.png" flipvertical ="true" sourcerect="144,496,640,32" depth ="0.06" castshadow="true"
width = "64" height ="32" resizehorizontal="true" body="true" health="500"/>
<topwindow sprite="Content/Map/testroom.png" sourcerect="208,352,128,80" depth ="0.05" <topwindow sprite="Content/Map/testroom.png" sourcerect="208,352,128,80" depth ="0.05"
width = "128" height ="80" body="true" health="100"/> width = "128" height ="80" body="true" health="100"/>
@@ -81,4 +78,7 @@
<stairsleft sprite="Content/Map/testroom.png" fliphorizontal="true" sourcerect="0,704,256,320" <stairsleft sprite="Content/Map/testroom.png" fliphorizontal="true" sourcerect="0,704,256,320"
width="256" height="320" depth = "0.1" stairdirection="Left"/> width="256" height="320" depth = "0.1" stairdirection="Left"/>
<bunk sprite="Content/Map/testroom.png" fliphorizontal="true" sourcerect="0,546,173,129"
width="173" height="129" depth = "0.9"/>
</prefabs> </prefabs>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 684 KiB

After

Width:  |  Height:  |  Size: 695 KiB

+1 -1
View File
@@ -7,7 +7,7 @@
reward="1000" reward="1000"
radarlabel="Infrasonic signal" radarlabel="Infrasonic signal"
failuremessage="Retrieving the artifact failed" failuremessage="Retrieving the artifact failed"
successmessage="The artifact has been succesfully retrived" successmessage="The artifact has been succesfully retrieved"
itemname="Skyholder Artifact"> itemname="Skyholder Artifact">
</SalvageQuest> </SalvageQuest>
+2 -2
View File
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.3.2")] [assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("0.1.3.2")] [assembly: AssemblyFileVersion("0.2.0.0")]
+3 -1
View File
@@ -131,7 +131,9 @@ namespace Barotrauma
public override void ReadNetworkData(NetworkEventType type, NetIncomingMessage message) public override void ReadNetworkData(NetworkEventType type, NetIncomingMessage message)
{ {
if (type == NetworkEventType.KillCharacter) Enabled = true;
if (type == NetworkEventType.KillCharacter)
{ {
Kill(true); Kill(true);
return; return;
+44 -15
View File
@@ -112,7 +112,7 @@ namespace Barotrauma
{ {
get get
{ {
return SpeciesName; return (info != null && !string.IsNullOrWhiteSpace(info.Name)) ? info.Name : SpeciesName;
} }
} }
@@ -604,20 +604,30 @@ namespace Barotrauma
return closestCharacter; return closestCharacter;
} }
private void ToggleSelectedCharacter(Character selected) private void SelectCharacter(Character character, bool createNetworkEvent = true)
{ {
if (selectedCharacter != null) if (character == null) return;
selectedCharacter = character;
if (createNetworkEvent)
new NetworkEvent(NetworkEventType.SelectCharacter, ID, true, selectedCharacter.ID);
}
private void DeselectCharacter(bool createNetworkEvent = true)
{
if (selectedCharacter == null) return;
foreach (Limb limb in selectedCharacter.AnimController.Limbs)
{ {
foreach (Limb limb in selectedCharacter.AnimController.Limbs) limb.pullJoint.Enabled = false;
{
limb.pullJoint.Enabled = false;
}
selectedCharacter = null;
}
else
{
selectedCharacter = selected;
} }
selectedCharacter = null;
if (createNetworkEvent)
new NetworkEvent(NetworkEventType.SelectCharacter, ID, true, -1);
} }
/// <summary> /// <summary>
@@ -724,7 +734,7 @@ namespace Barotrauma
if (Vector2.Distance(selectedCharacter.SimPosition, SimPosition) > 2.0f || if (Vector2.Distance(selectedCharacter.SimPosition, SimPosition) > 2.0f ||
(!selectedCharacter.isDead && selectedCharacter.Stun <= 0.0f)) (!selectedCharacter.isDead && selectedCharacter.Stun <= 0.0f))
{ {
ToggleSelectedCharacter(selectedCharacter); DeselectCharacter();
} }
} }
@@ -732,12 +742,12 @@ namespace Barotrauma
{ {
if (selectedCharacter != null) if (selectedCharacter != null)
{ {
ToggleSelectedCharacter(selectedCharacter); DeselectCharacter();
} }
else if (closestCharacter != null && closestCharacter.IsHumanoid && else if (closestCharacter != null && closestCharacter.IsHumanoid &&
(closestCharacter.isDead || closestCharacter.AnimController.StunTimer > 0.0f)) (closestCharacter.isDead || closestCharacter.AnimController.StunTimer > 0.0f))
{ {
selectedCharacter = closestCharacter; SelectCharacter(closestCharacter);
} }
} }
@@ -1081,6 +1091,11 @@ namespace Barotrauma
message.Write((int)data); message.Write((int)data);
return; return;
} }
else if (type== NetworkEventType.SelectCharacter)
{
message.Write((int)data);
return;
}
else if (type == NetworkEventType.KillCharacter) else if (type == NetworkEventType.KillCharacter)
{ {
return; return;
@@ -1177,6 +1192,20 @@ namespace Barotrauma
return; return;
} }
else if (type == NetworkEventType.SelectCharacter)
{
int characterId = message.ReadInt32();
if (characterId==-1)
{
DeselectCharacter(false);
}
else
{
Character character = FindEntityByID(characterId) as Character;
if (character != null) SelectCharacter(character, false);
}
return;
}
else if (type == NetworkEventType.KillCharacter) else if (type == NetworkEventType.KillCharacter)
{ {
Kill(true); Kill(true);
+37 -3
View File
@@ -18,6 +18,8 @@ namespace Barotrauma
private TargetType targetTypes; private TargetType targetTypes;
private string[] targetNames; private string[] targetNames;
private List<RelatedItem> requiredItems;
public string[] propertyNames; public string[] propertyNames;
private object[] propertyEffects; private object[] propertyEffects;
@@ -62,10 +64,11 @@ namespace Barotrauma
protected StatusEffect(XElement element) protected StatusEffect(XElement element)
{ {
requiredItems = new List<RelatedItem>();
IEnumerable<XAttribute> attributes = element.Attributes(); IEnumerable<XAttribute> attributes = element.Attributes();
List<XAttribute> propertyAttributes = new List<XAttribute>(); List<XAttribute> propertyAttributes = new List<XAttribute>();
foreach (XAttribute attribute in attributes) foreach (XAttribute attribute in attributes)
{ {
switch (attribute.Name.ToString()) switch (attribute.Name.ToString())
@@ -140,6 +143,14 @@ namespace Barotrauma
case "explosion": case "explosion":
explosion = new Explosion(subElement); explosion = new Explosion(subElement);
break; break;
case "requireditem":
case "requireditems":
RelatedItem newRequiredItem = RelatedItem.Load(subElement);
if (newRequiredItem == null) continue;
requiredItems.Add(newRequiredItem);
break;
} }
} }
@@ -156,19 +167,42 @@ namespace Barotrauma
// if (this.type == type) Apply(deltaTime, character, item); // if (this.type == type) Apply(deltaTime, character, item);
//} //}
private bool HasRequiredItems(Entity entity)
{
if (requiredItems == null) return true;
foreach (RelatedItem requiredItem in requiredItems)
{
Item item = entity as Item;
if (item != null)
{
if (!requiredItem.CheckRequirements(null, item)) return false;
}
Character character = entity as Character;
if (character != null)
{
if (!requiredItem.CheckRequirements(character, null)) return false;
}
}
return true;
}
public virtual void Apply(ActionType type, float deltaTime, Entity entity, IPropertyObject target) public virtual void Apply(ActionType type, float deltaTime, Entity entity, IPropertyObject target)
{ {
if (this.type != type || !HasRequiredItems(entity)) return;
if (targetNames != null && !targetNames.Contains(target.Name)) return; if (targetNames != null && !targetNames.Contains(target.Name)) return;
List<IPropertyObject> targets = new List<IPropertyObject>(); List<IPropertyObject> targets = new List<IPropertyObject>();
targets.Add(target); targets.Add(target);
if (this.type == type) Apply(deltaTime, entity, targets); Apply(deltaTime, entity, targets);
} }
public virtual void Apply(ActionType type, float deltaTime, Entity entity, List<IPropertyObject> targets) public virtual void Apply(ActionType type, float deltaTime, Entity entity, List<IPropertyObject> targets)
{ {
if (this.type == type) Apply(deltaTime, entity, targets); if (this.type != type || !HasRequiredItems(entity)) return;
Apply(deltaTime, entity, targets);
} }
protected virtual void Apply(float deltaTime, Entity entity, List<IPropertyObject> targets) protected virtual void Apply(float deltaTime, Entity entity, List<IPropertyObject> targets)
-3
View File
@@ -95,10 +95,7 @@ namespace Barotrauma
{ {
timer -= deltaTime; timer -= deltaTime;
return timer<=0.0f; return timer<=0.0f;
} }
} }
+3 -1
View File
@@ -273,7 +273,7 @@ namespace Barotrauma
} }
break; break;
case "tutorial": case "tutorial":
TutorialMode.Start(); TutorialMode.StartTutorial();
break; break;
case "lobbyscreen": case "lobbyscreen":
case "lobby": case "lobby":
@@ -281,6 +281,7 @@ namespace Barotrauma
break; break;
case "savemap": case "savemap":
case "savesub": case "savesub":
case "save":
if (commands.Length < 2) break; if (commands.Length < 2) break;
string fileName = string.Join(" ", commands.Skip(1)); string fileName = string.Join(" ", commands.Skip(1));
@@ -294,6 +295,7 @@ namespace Barotrauma
break; break;
case "loadmap": case "loadmap":
case "loadsub": case "loadsub":
case "load":
if (commands.Length < 2) break; if (commands.Length < 2) break;
Submarine.Load(string.Join(" ", commands.Skip(1))); Submarine.Load(string.Join(" ", commands.Skip(1)));
break; break;
@@ -37,7 +37,7 @@ namespace Barotrauma
public override void Start(Level level) public override void Start(Level level)
{ {
Vector2 position = level.PositionsOfInterest[Rand.Int(level.PositionsOfInterest.Count)]; Vector2 position = level.PositionsOfInterest[Rand.Int(level.PositionsOfInterest.Count, false)];
item = new Item(itemPrefab, position + level.Position); item = new Item(itemPrefab, position + level.Position);
item.MoveWithLevel = true; item.MoveWithLevel = true;
+2
View File
@@ -268,6 +268,8 @@ namespace Barotrauma
if (hasLoaded && !titleScreenOpen) if (hasLoaded && !titleScreenOpen)
{ {
AmbientSoundManager.Update();
if (PlayerInput.KeyHit(Keys.Escape)) GUI.TogglePauseMenu(); if (PlayerInput.KeyHit(Keys.Escape)) GUI.TogglePauseMenu();
DebugConsole.Update(this, (float)deltaTime); DebugConsole.Update(this, (float)deltaTime);
@@ -10,14 +10,10 @@ namespace Barotrauma
{ {
public static List<GameModePreset> PresetList = new List<GameModePreset>(); public static List<GameModePreset> PresetList = new List<GameModePreset>();
TimeSpan duration;
protected DateTime startTime; protected DateTime startTime;
protected DateTime endTime;
//public readonly bool IsSinglePlayer; //public readonly bool IsSinglePlayer;
private GUIProgressBar timerBar;
protected bool isRunning; protected bool isRunning;
//protected string name; //protected string name;
@@ -31,16 +27,6 @@ namespace Barotrauma
get { return null; } get { return null; }
} }
public DateTime StartTime
{
get { return startTime; }
}
public DateTime EndTime
{
get { return endTime; }
}
public bool IsRunning public bool IsRunning
{ {
get { return isRunning; } get { return isRunning; }
@@ -68,19 +54,19 @@ namespace Barotrauma
public virtual void Draw(SpriteBatch spriteBatch) public virtual void Draw(SpriteBatch spriteBatch)
{ {
if (timerBar != null) timerBar.Draw(spriteBatch); //if (timerBar != null) timerBar.Draw(spriteBatch);
} }
public virtual void Start(TimeSpan duration) public virtual void Start()
{ {
startTime = DateTime.Now; startTime = DateTime.Now;
if (duration!=TimeSpan.Zero) //if (duration!=TimeSpan.Zero)
{ //{
endTime = startTime + duration; // endTime = startTime + duration;
this.duration = duration; // this.duration = duration;
timerBar = new GUIProgressBar(new Rectangle(GameMain.GraphicsWidth - 120, 20, 100, 25), Color.Gold, 0.0f, null); // timerBar = new GUIProgressBar(new Rectangle(GameMain.GraphicsWidth - 120, 20, 100, 25), Color.Gold, 0.0f, null);
} //}
endMessage = "The round has ended!"; endMessage = "The round has ended!";
@@ -89,13 +75,13 @@ namespace Barotrauma
public virtual void Update(float deltaTime) public virtual void Update(float deltaTime)
{ {
if (!isRunning) return; //if (!isRunning) return;
if (duration != TimeSpan.Zero) //if (duration != TimeSpan.Zero)
{ //{
double elapsedTime = (DateTime.Now - startTime).TotalSeconds; // double elapsedTime = (DateTime.Now - startTime).TotalSeconds;
timerBar.BarSize = (float)(elapsedTime / duration.TotalSeconds); // timerBar.BarSize = (float)(elapsedTime / duration.TotalSeconds);
} //}
//if (DateTime.Now >= endTime) //if (DateTime.Now >= endTime)
//{ //{
// End(endMessage); // End(endMessage);
@@ -32,9 +32,9 @@ namespace Barotrauma
quest = Quest.LoadRandom(locations, rand); quest = Quest.LoadRandom(locations, rand);
} }
public override void Start(TimeSpan duration) public override void Start()
{ {
base.Start(duration); base.Start();
new GUIMessageBox(quest.Name, quest.Description, 400, 400); new GUIMessageBox(quest.Name, quest.Description, 400, 400);
@@ -88,6 +88,8 @@ namespace Barotrauma
CrewManager = new CrewManager(subElement); CrewManager = new CrewManager(subElement);
} }
savedOnStart = true;
} }
public void GenerateMap(string seed) public void GenerateMap(string seed)
@@ -95,7 +97,7 @@ namespace Barotrauma
Map = new Map(seed, 500); Map = new Map(seed, 500);
} }
public override void Start(TimeSpan duration) public override void Start()
{ {
CargoManager.CreateItems(); CargoManager.CreateItems();
@@ -181,6 +183,8 @@ namespace Barotrauma
isRunning = false; isRunning = false;
GameMain.GameSession.EndShift("");
//if (endMessage != "" || this.endMessage == null) this.endMessage = endMessage; //if (endMessage != "" || this.endMessage == null) this.endMessage = endMessage;
@@ -226,8 +230,7 @@ namespace Barotrauma
Character.CharacterList[i].Remove(); Character.CharacterList[i].Remove();
} }
GameMain.GameSession.EndShift(""); Submarine.Unload();
} }
private bool EndShift(GUIButton button, object obj) private bool EndShift(GUIButton button, object obj)
@@ -15,9 +15,9 @@ namespace Barotrauma
} }
public override void Start(TimeSpan duration) public override void Start()
{ {
base.Start(duration); base.Start();
traitor = null; traitor = null;
target = null; target = null;
@@ -56,7 +56,7 @@ namespace Barotrauma
{ {
string endMessage = traitor.character.Info.Name + " was a traitor! "; string endMessage = traitor.character.Info.Name + " was a traitor! ";
endMessage += (traitor.character.Info.Gender == Gender.Male) ? "His" : "Her"; endMessage += (traitor.character.Info.Gender == Gender.Male) ? "His" : "Her";
endMessage += " task was to assassinate " + target.character.Info.Name + ". The task was succesful."; endMessage += " task was to assassinate " + target.character.Info.Name + ". The task was successful.";
End(endMessage); End(endMessage);
} }
else if (traitor.character.IsDead) else if (traitor.character.IsDead)
@@ -79,14 +79,6 @@ namespace Barotrauma
End(endMessage); End(endMessage);
return; return;
} }
else if (DateTime.Now >= endTime)
{
string endMessage = traitor.character.Info.Name + " was a traitor! ";
endMessage += (traitor.character.Info.Gender == Gender.Male) ? "His" : "Her";
endMessage += " task was to assassinate " + target.character.Info.Name + ". The task was unsuccesful.";
End(endMessage);
return;
}
} }
} }
@@ -15,13 +15,13 @@ namespace Barotrauma
private GUIComponent infoBox; private GUIComponent infoBox;
public static void Start() public static void StartTutorial()
{ {
Submarine.Load("Content/Map/TutorialSub.sub", ""); Submarine.Load("Content/Map/TutorialSub.sub", "");
GameMain.GameSession = new GameSession(Submarine.Loaded, "", GameModePreset.list.Find(gm => gm.Name.ToLower()=="tutorial")); GameMain.GameSession = new GameSession(Submarine.Loaded, "", GameModePreset.list.Find(gm => gm.Name.ToLower()=="tutorial"));
GameMain.GameSession.StartShift(TimeSpan.Zero, "tutorial"); GameMain.GameSession.StartShift("tutorial");
GameMain.GameSession.taskManager.Tasks.Clear(); GameMain.GameSession.taskManager.Tasks.Clear();
@@ -34,9 +34,9 @@ namespace Barotrauma
CrewManager = new CrewManager(); CrewManager = new CrewManager();
} }
public override void Start(TimeSpan duration) public override void Start()
{ {
base.Start(duration); base.Start();
WayPoint wayPoint = WayPoint.GetRandom(SpawnType.Cargo, null); WayPoint wayPoint = WayPoint.GetRandom(SpawnType.Cargo, null);
if (wayPoint==null) if (wayPoint==null)
@@ -273,8 +273,15 @@ namespace Barotrauma
yield return new WaitForSeconds(2.0f); yield return new WaitForSeconds(2.0f);
infoBox = CreateInfoFrame("You can now move the other end of the wire around, and attach it on the wall by left clicking or " infoBox = CreateInfoFrame("You can now move the other end of the wire around, and attach it on the wall by left clicking or "
+ "remove the previous attachment by right clicking. Or you can just run the wire straight to the junction box and attach it " + "remove the previous attachment by right clicking. Or if you don't care for neatly laid out wiring, you can just "
+ " the same way you did to the navigation terminal."); +"run it straight to the junction box.");
while (Character.Controlled.SelectedConstruction == null || Character.Controlled.SelectedConstruction.GetComponent<PowerTransfer>()==null)
{
yield return CoroutineStatus.Running;
}
infoBox = CreateInfoFrame("Connect the wire to the junction box by pulling it to the power connection, the same way you did with the navigation terminal.");
while (radar.Voltage<0.1f) while (radar.Voltage<0.1f)
{ {
@@ -346,10 +353,10 @@ namespace Barotrauma
Vector2 steeringDir = windows[0].Position - moloch.Position; Vector2 steeringDir = windows[0].Position - moloch.Position;
if (steeringDir != Vector2.Zero) steeringDir = Vector2.Normalize(steeringDir); if (steeringDir != Vector2.Zero) steeringDir = Vector2.Normalize(steeringDir);
foreach (Limb limb in moloch.AnimController.Limbs) //foreach (Limb limb in moloch.AnimController.Limbs)
{ //{
limb.body.LinearVelocity = new Vector2(limb.LinearVelocity.X*2.0f, limb.LinearVelocity.Y + steeringDir.Y*10.0f); // limb.body.LinearVelocity = new Vector2(limb.LinearVelocity.X*2.0f, limb.LinearVelocity.Y + steeringDir.Y*10.0f);
} //}
moloch.AIController.Steering = steeringDir; moloch.AIController.Steering = steeringDir;
@@ -365,11 +372,12 @@ namespace Barotrauma
} }
yield return new WaitForSeconds(1.0f); yield return new WaitForSeconds(0.1f);
} while (!broken); } while (!broken);
yield return new WaitForSeconds(0.5f); yield return new WaitForSeconds(0.5f);
Submarine.Loaded.GodMode = true;
var capacitor1 = Item.itemList.Find(i => i.HasTag("capacitor1")).GetComponent<PowerContainer>(); var capacitor1 = Item.itemList.Find(i => i.HasTag("capacitor1")).GetComponent<PowerContainer>();
var capacitor2 = Item.itemList.Find(i => i.HasTag("capacitor1")).GetComponent<PowerContainer>(); var capacitor2 = Item.itemList.Find(i => i.HasTag("capacitor1")).GetComponent<PowerContainer>();
@@ -470,6 +478,8 @@ namespace Barotrauma
yield return CoroutineStatus.Running; yield return CoroutineStatus.Running;
} }
Submarine.Loaded.GodMode = false;
infoBox = CreateInfoFrame("The creature has died. Now you should fix the damages in the control room: "+ infoBox = CreateInfoFrame("The creature has died. Now you should fix the damages in the control room: "+
"Grab a welding tool from the closet in the railgun room."); "Grab a welding tool from the closet in the railgun room.");
@@ -584,7 +594,7 @@ namespace Barotrauma
private bool Restart(GUIButton button, object obj) private bool Restart(GUIButton button, object obj)
{ {
TutorialMode.Start(); TutorialMode.StartTutorial();
return true; return true;
} }
+5 -5
View File
@@ -98,14 +98,14 @@ namespace Barotrauma
} }
} }
public void StartShift(TimeSpan duration, string levelSeed) public void StartShift(string levelSeed)
{ {
Level level = Level.CreateRandom(levelSeed); Level level = Level.CreateRandom(levelSeed);
StartShift(duration, level); StartShift(level);
} }
public void StartShift(TimeSpan duration, Level level, bool reloadSub = true) public void StartShift(Level level, bool reloadSub = true)
{ {
GameMain.LightManager.LosEnabled = (GameMain.Server==null || GameMain.Server.CharacterInfo!=null); GameMain.LightManager.LosEnabled = (GameMain.Server==null || GameMain.Server.CharacterInfo!=null);
@@ -129,7 +129,7 @@ namespace Barotrauma
if (Quest!=null) Quest.Start(Level.Loaded); if (Quest!=null) Quest.Start(Level.Loaded);
if (gameMode!=null) gameMode.Start(duration); if (gameMode!=null) gameMode.Start();
taskManager.StartShift(level); taskManager.StartShift(level);
} }
@@ -145,7 +145,7 @@ namespace Barotrauma
} }
else if (GameMain.Client==null) else if (GameMain.Client==null)
{ {
Submarine.Unload(); //Submarine.Unload();
GameMain.LobbyScreen.Select(); GameMain.LobbyScreen.Select();
} }
+11 -4
View File
@@ -1,4 +1,5 @@
using System; using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -73,10 +74,16 @@ namespace Barotrauma
} }
XElement graphicsMode = doc.Root.Element("graphicsmode"); XElement graphicsMode = doc.Root.Element("graphicsmode");
GraphicsWidth = int.Parse(graphicsMode.Attribute("width").Value); GraphicsWidth = ToolBox.GetAttributeInt(graphicsMode, "width", 0);
GraphicsHeight = int.Parse(graphicsMode.Attribute("height").Value); GraphicsHeight = ToolBox.GetAttributeInt(graphicsMode, "height", 0);
FullScreenEnabled = graphicsMode.Attribute("fullscreen").Value == "true"; if (GraphicsWidth==0 || GraphicsHeight==0)
{
GraphicsWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
GraphicsHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
}
FullScreenEnabled = ToolBox.GetAttributeBool(graphicsMode, "fullscreen", true);
MasterServerUrl = ToolBox.GetAttributeString(doc.Root, "masterserverurl", ""); MasterServerUrl = ToolBox.GetAttributeString(doc.Root, "masterserverurl", "");
@@ -155,7 +155,12 @@ namespace Barotrauma
if (items[i].Combine(item)) if (items[i].Combine(item))
{ {
//PutItem(items[i], i, false, false); //PutItem(items[i], i, false, false);
new Networking.NetworkEvent(Networking.NetworkEventType.InventoryUpdate, items[i].ID, true); Inventory otherInventory = items[i].inventory;
if (otherInventory!=null)
{
new Networking.NetworkEvent(Networking.NetworkEventType.InventoryUpdate, otherInventory.ID, true);
}
combined = true; combined = true;
} }
@@ -2,6 +2,7 @@
using FarseerPhysics.Dynamics; using FarseerPhysics.Dynamics;
using FarseerPhysics.Dynamics.Contacts; using FarseerPhysics.Dynamics.Contacts;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using System;
using System.Xml.Linq; using System.Xml.Linq;
namespace Barotrauma.Items.Components namespace Barotrauma.Items.Components
@@ -18,6 +19,10 @@ namespace Barotrauma.Items.Components
private Character user; private Character user;
private float reload;
private float reloadTimer;
[HasDefaultValue(0.0f, false)] [HasDefaultValue(0.0f, false)]
public float Range public float Range
{ {
@@ -25,6 +30,13 @@ namespace Barotrauma.Items.Components
set { range = ConvertUnits.ToSimUnits(value); } set { range = ConvertUnits.ToSimUnits(value); }
} }
[HasDefaultValue(0.5f, false)]
public float Reload
{
get { return reload; }
set { reload = Math.Max(0.0f, value); }
}
public MeleeWeapon(Item item, XElement element) public MeleeWeapon(Item item, XElement element)
: base(item, element) : base(item, element)
{ {
@@ -35,22 +47,19 @@ namespace Barotrauma.Items.Components
if (subElement.Name.ToString().ToLower() != "attack") continue; if (subElement.Name.ToString().ToLower() != "attack") continue;
attack = new Attack(subElement); attack = new Attack(subElement);
} }
if (attack==null)
{
DebugConsole.ThrowError("Item ''"+item.Name+"'' doesn't have an attack configured");
}
} }
public override bool Use(float deltaTime, Character character = null) public override bool Use(float deltaTime, Character character = null)
{ {
if (character == null) return false; if (character == null || reloadTimer>0.0f) return false;
if (!character.GetInputState(InputType.SecondaryHeld) || hitting) return false; if (!character.GetInputState(InputType.SecondaryHeld) || hitting) return false;
user = character; user = character;
if (hitPos < MathHelper.Pi * 0.69f) return false; if (hitPos < MathHelper.Pi * 0.69f) return false;
reloadTimer = reload;
item.body.FarseerBody.CollisionCategories = Physics.CollisionProjectile; item.body.FarseerBody.CollisionCategories = Physics.CollisionProjectile;
item.body.FarseerBody.CollidesWith = Physics.CollisionCharacter | Physics.CollisionWall; item.body.FarseerBody.CollidesWith = Physics.CollisionCharacter | Physics.CollisionWall;
item.body.FarseerBody.OnCollision += OnCollision; item.body.FarseerBody.OnCollision += OnCollision;
@@ -95,6 +104,8 @@ namespace Barotrauma.Items.Components
if (!item.body.Enabled) return; if (!item.body.Enabled) return;
if (!picker.HasSelectedItem(item)) IsActive = false; if (!picker.HasSelectedItem(item)) IsActive = false;
reloadTimer -= deltaTime;
if (!picker.GetInputState(InputType.SecondaryHeld) && !hitting) hitPos = 0.0f; if (!picker.GetInputState(InputType.SecondaryHeld) && !hitting) hitPos = 0.0f;
ApplyStatusEffects(ActionType.OnActive, deltaTime, picker); ApplyStatusEffects(ActionType.OnActive, deltaTime, picker);
@@ -117,8 +128,6 @@ namespace Barotrauma.Items.Components
{ {
ac.HoldItem(deltaTime, item, handlePos, new Vector2(hitPos, 0.0f), aimPos, false, 0.0f); ac.HoldItem(deltaTime, item, handlePos, new Vector2(hitPos, 0.0f), aimPos, false, 0.0f);
} }
} }
else else
{ {
@@ -174,20 +183,24 @@ namespace Barotrauma.Items.Components
if (limb.character == picker) return false; if (limb.character == picker) return false;
target = limb.character; target = limb.character;
} }
else
{
return false;
}
if (target==null) if (target == null)
{ {
target = f2.Body.UserData as IDamageable; target = f2.Body.UserData as IDamageable;
} }
if (target == null) return false; if (target == null) return false;
attack.DoDamage(user, target, item.Position, 1.0f); if (attack!=null) attack.DoDamage(user, target, item.Position, 1.0f);
RestoreCollision(); RestoreCollision();
hitting = false; hitting = false;
ApplyStatusEffects(ActionType.OnUse, 1.0f, picker); ApplyStatusEffects(ActionType.OnUse, 1.0f, limb.character);
return true; return true;
} }
@@ -20,15 +20,15 @@ namespace Barotrauma.Items.Components
float powerPerForce; float powerPerForce;
[Editable, HasDefaultValue(1.0f, true)] //[Editable, HasDefaultValue(1.0f, true)]
public float PowerPerForce //public float PowerPerForce
{ //{
get { return powerPerForce; } // get { return powerPerForce; }
set // set
{ // {
powerPerForce = Math.Max(0.0f, value); // powerPerForce = Math.Max(0.0f, value);
} // }
} //}
[Editable, HasDefaultValue(2000.0f, true)] [Editable, HasDefaultValue(2000.0f, true)]
public float MaxForce public float MaxForce
@@ -61,7 +61,7 @@ namespace Barotrauma.Items.Components
{ {
base.Update(deltaTime, cam); base.Update(deltaTime, cam);
currPowerConsumption = Math.Abs(targetForce) * powerPerForce; currPowerConsumption = Math.Abs(targetForce)/100.0f * powerConsumption;
Force = MathHelper.Lerp(force, (voltage < minVoltage) ? 0.0f : targetForce, 0.1f); Force = MathHelper.Lerp(force, (voltage < minVoltage) ? 0.0f : targetForce, 0.1f);
if (Force != 0.0f) if (Force != 0.0f)
@@ -14,10 +14,14 @@ namespace Barotrauma.Items.Components
IsActive = true; IsActive = true;
} }
bool hasPower;
public override void Update(float deltaTime, Camera cam) public override void Update(float deltaTime, Camera cam)
{ {
currPowerConsumption = powerConsumption; currPowerConsumption = powerConsumption;
hasPower = voltage > minVoltage;
voltage = 0.0f; voltage = 0.0f;
} }
@@ -38,6 +42,8 @@ namespace Barotrauma.Items.Components
GuiFrame.Draw(spriteBatch); GuiFrame.Draw(spriteBatch);
if (!hasPower) return;
//GUI.DrawRectangle(spriteBatch, new Rectangle(x,y,width,height), Color.Black, true); //GUI.DrawRectangle(spriteBatch, new Rectangle(x,y,width,height), Color.Black, true);
Rectangle miniMap = new Rectangle(x + 20, y + 40, width - 40, height - 60); Rectangle miniMap = new Rectangle(x + 20, y + 40, width - 40, height - 60);
@@ -1,4 +1,5 @@
using System; using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Xml.Linq; using System.Xml.Linq;
@@ -12,6 +13,8 @@ namespace Barotrauma.Items.Components
bool running; bool running;
private float generatedAmount;
List<Vent> ventList; List<Vent> ventList;
public bool IsRunning() public bool IsRunning()
@@ -25,6 +28,13 @@ namespace Barotrauma.Items.Components
private set; private set;
} }
[Editable, HasDefaultValue(100.0f, true)]
public float GeneratedAmount
{
get { return generatedAmount; }
set { generatedAmount = MathHelper.Clamp(value, -10000.0f, 10000.0f); }
}
public OxygenGenerator(Item item, XElement element) public OxygenGenerator(Item item, XElement element)
: base(item, element) : base(item, element)
{ {
@@ -64,7 +74,7 @@ namespace Barotrauma.Items.Components
running = true; running = true;
CurrFlow = Math.Min(voltage, 1.0f) * 50000.0f; CurrFlow = Math.Min(voltage, 1.0f) * generatedAmount * 1000.0f;
item.CurrentHull.Oxygen += CurrFlow * deltaTime; item.CurrentHull.Oxygen += CurrFlow * deltaTime;
UpdateVents(CurrFlow); UpdateVents(CurrFlow);
+5 -2
View File
@@ -816,8 +816,11 @@ namespace Barotrauma
if (item.prefab.PickDistance == 0.0f) continue; if (item.prefab.PickDistance == 0.0f) continue;
if (Vector2.Distance(position, item.SimPosition) > item.prefab.PickDistance) continue; if (Vector2.Distance(position, item.SimPosition) > item.prefab.PickDistance) continue;
Body body = Submarine.CheckVisibility(position, item.SimPosition); if (!item.prefab.PickThroughWalls)
if (body != null && body.UserData as Item != item) continue; {
Body body = Submarine.CheckVisibility(position, item.SimPosition);
if (body != null && body.UserData as Item != item) continue;
}
dist = Vector2.Distance(pickPosition, item.SimPosition); dist = Vector2.Distance(pickPosition, item.SimPosition);
if (dist < item.prefab.PickDistance && (closest == null || dist < closestDist)) if (dist < item.prefab.PickDistance && (closest == null || dist < closestDist))
+8
View File
@@ -25,6 +25,8 @@ namespace Barotrauma
//how close the character has to be to the item to pick it up //how close the character has to be to the item to pick it up
private float pickDistance; private float pickDistance;
private bool pickThroughWalls;
//an area next to the construction //an area next to the construction
//the construction can be Activated() by a character inside the area //the construction can be Activated() by a character inside the area
public List<Rectangle> Triggers; public List<Rectangle> Triggers;
@@ -39,6 +41,11 @@ namespace Barotrauma
get { return pickDistance; } get { return pickDistance; }
} }
public bool PickThroughWalls
{
get { return pickThroughWalls; }
}
public override bool IsLinkable public override bool IsLinkable
{ {
@@ -146,6 +153,7 @@ namespace Barotrauma
name = ToolBox.GetAttributeString(element, "name", ""); name = ToolBox.GetAttributeString(element, "name", "");
if (name == "") DebugConsole.ThrowError("Unnamed item in "+filePath+"!"); if (name == "") DebugConsole.ThrowError("Unnamed item in "+filePath+"!");
pickThroughWalls = ToolBox.GetAttributeBool(element, "pickthroughwalls", false);
pickDistance = ConvertUnits.ToSimUnits(ToolBox.GetAttributeFloat(element, "pickdistance", 0.0f)); pickDistance = ConvertUnits.ToSimUnits(ToolBox.GetAttributeFloat(element, "pickdistance", 0.0f));
isLinkable = ToolBox.GetAttributeBool(element, "linkable", false); isLinkable = ToolBox.GetAttributeBool(element, "linkable", false);
+36
View File
@@ -71,6 +71,42 @@ namespace Barotrauma
statusEffects = new List<StatusEffect>(); statusEffects = new List<StatusEffect>();
} }
public bool CheckRequirements(Character character, Item parentItem)
{
switch (type)
{
case RelationType.Contained:
if (parentItem == null) return false;
foreach (Item contained in parentItem.ContainedItems)
{
if (contained.Condition>0.0f && MatchesItem(contained)) return true;
}
break;
case RelationType.Equipped:
if (character == null) return false;
foreach (Item equippedItem in character.SelectedItems)
{
if (equippedItem == null) continue;
if (equippedItem.Condition>0.0f && MatchesItem(equippedItem)) return true;
}
break;
case RelationType.Picked:
if (character == null || character.Inventory==null) return false;
foreach (Item pickedItem in character.Inventory.items)
{
if (pickedItem == null) continue;
if (MatchesItem(pickedItem)) return true;
}
break;
default:
return true;
}
return false;
}
public void Save(XElement element) public void Save(XElement element)
{ {
element.Add( element.Add(
+1 -1
View File
@@ -745,7 +745,7 @@ int currentTargetIndex = 1;
} }
AtStartPosition = Vector2.Distance(startPosition, -Position) < ExitDistance; AtStartPosition = Vector2.Distance(startPosition, -Position) < ExitDistance;
AtEndPosition = Vector2.Distance(endPosition, -Position) < ExitDistance; AtEndPosition = Vector2.Distance(endPosition, -Position) < ExitDistance;
prevVelocity = simVelocity; prevVelocity = simVelocity;
} }
+3 -2
View File
@@ -423,6 +423,7 @@ namespace Barotrauma
public AttackResult AddDamage(IDamageable attacker, Vector2 position, Attack attack, float deltaTime, bool playSound = false) public AttackResult AddDamage(IDamageable attacker, Vector2 position, Attack attack, float deltaTime, bool playSound = false)
{ {
if (Submarine.Loaded != null && Submarine.Loaded.GodMode) return new AttackResult(0.0f, 0.0f);
if (!prefab.HasBody || prefab.IsPlatform) return new AttackResult(0.0f, 0.0f); if (!prefab.HasBody || prefab.IsPlatform) return new AttackResult(0.0f, 0.0f);
int i = FindSectionIndex(ConvertUnits.ToDisplayUnits(position)); int i = FindSectionIndex(ConvertUnits.ToDisplayUnits(position));
@@ -445,13 +446,13 @@ namespace Barotrauma
private void SetDamage(int sectionIndex, float damage) private void SetDamage(int sectionIndex, float damage)
{ {
if (Submarine.Loaded != null && Submarine.Loaded.GodMode) return;
if (!prefab.HasBody) return; if (!prefab.HasBody) return;
if (damage != sections[sectionIndex].damage && Math.Abs(sections[sectionIndex].lastSentDamage - damage)>5.0f) if (damage != sections[sectionIndex].damage && Math.Abs(sections[sectionIndex].lastSentDamage - damage)>5.0f)
{ {
new NetworkEvent(NetworkEventType.UpdateEntity, ID, false, sectionIndex); new NetworkEvent(NetworkEventType.WallDamage, ID, false, sectionIndex);
sections[sectionIndex].lastSentDamage = damage; sections[sectionIndex].lastSentDamage = damage;
} }
if (damage < prefab.MaxHealth*0.5f) if (damage < prefab.MaxHealth*0.5f)
+6
View File
@@ -61,6 +61,12 @@ namespace Barotrauma
get { return lastPickedFraction; } get { return lastPickedFraction; }
} }
public bool GodMode
{
get;
set;
}
public Md5Hash MD5Hash public Md5Hash MD5Hash
{ {
get get
+9 -8
View File
@@ -247,12 +247,15 @@ namespace Barotrauma.Networking
if (connectionStatus != NetConnectionStatus.Connected) if (connectionStatus != NetConnectionStatus.Connected)
{ {
string denyMessage = inc.ReadString(); string denyMessage = inc.ReadString();
DebugConsole.ThrowError(denyMessage);
new GUIMessageBox("Couldn't connect to server", denyMessage);
connectCanceled = true;
} }
break; break;
default: default:
Console.WriteLine(inc.ReadString() + " Strange message"); Console.WriteLine(inc.ReadString() + " Strange message");
connectCanceled = true;
break; break;
} }
} }
@@ -457,9 +460,6 @@ namespace Barotrauma.Networking
yield return CoroutineStatus.Running; yield return CoroutineStatus.Running;
double durationMinutes = inc.ReadDouble();
TimeSpan duration = new TimeSpan(0, (int)durationMinutes, 0);
Rand.SetSyncedSeed(seed); Rand.SetSyncedSeed(seed);
//int gameModeIndex = inc.ReadInt32(); //int gameModeIndex = inc.ReadInt32();
@@ -467,7 +467,7 @@ namespace Barotrauma.Networking
yield return CoroutineStatus.Running; yield return CoroutineStatus.Running;
GameMain.GameSession.StartShift(duration, levelSeed); GameMain.GameSession.StartShift(levelSeed);
yield return CoroutineStatus.Running; yield return CoroutineStatus.Running;
@@ -501,9 +501,10 @@ namespace Barotrauma.Networking
public IEnumerable<object> EndGame(string endMessage) public IEnumerable<object> EndGame(string endMessage)
{ {
gameStarted = false; var messageBox = new GUIMessageBox("The round has ended", endMessage, 400, 300);
var messageBox = new GUIMessageBox("The round has ended", endMessage); if (!gameStarted) yield return CoroutineStatus.Success;
gameStarted = false;
Character.Controlled = null; Character.Controlled = null;
GameMain.LightManager.LosEnabled = false; GameMain.LightManager.LosEnabled = false;
@@ -529,7 +530,7 @@ namespace Barotrauma.Networking
yield return CoroutineStatus.Running; yield return CoroutineStatus.Running;
} while (secondsLeft > 0.0f); } while (secondsLeft > 0.0f);
messageBox.Text = endMessage; messageBox.Close(null,null);
Submarine.Unload(); Submarine.Unload();
+16 -12
View File
@@ -601,7 +601,7 @@ namespace Barotrauma.Networking
int seed = DateTime.Now.Millisecond; int seed = DateTime.Now.Millisecond;
Rand.SetSyncedSeed(seed); Rand.SetSyncedSeed(seed);
GameMain.GameSession = new GameSession(selectedSub, "", GameMain.NetLobbyScreen.SelectedMode); GameMain.GameSession = new GameSession(selectedSub, "", GameMain.NetLobbyScreen.SelectedMode);
GameMain.GameSession.StartShift(GameMain.NetLobbyScreen.GameDuration, GameMain.NetLobbyScreen.LevelSeed); GameMain.GameSession.StartShift(GameMain.NetLobbyScreen.LevelSeed);
yield return CoroutineStatus.Running; yield return CoroutineStatus.Running;
@@ -662,7 +662,7 @@ namespace Barotrauma.Networking
msg.Write(GameMain.NetLobbyScreen.SelectedMode.Name); msg.Write(GameMain.NetLobbyScreen.SelectedMode.Name);
msg.Write(GameMain.NetLobbyScreen.GameDuration.TotalMinutes); //msg.Write(GameMain.NetLobbyScreen.GameDuration.TotalMinutes);
msg.Write((myCharacter == null) ? connectedClients.Count : connectedClients.Count + 1); msg.Write((myCharacter == null) ? connectedClients.Count : connectedClients.Count + 1);
foreach (Client client in connectedClients) foreach (Client client in connectedClients)
@@ -703,8 +703,7 @@ namespace Barotrauma.Networking
public IEnumerable<object> EndGame(string endMessage) public IEnumerable<object> EndGame(string endMessage)
{ {
var messageBox = new GUIMessageBox("The round has ended", endMessage, 400, 300);
var messageBox = new GUIMessageBox("The round has ended", endMessage);
Character.Controlled = null; Character.Controlled = null;
GameMain.GameScreen.Cam.TargetPos = Vector2.Zero; GameMain.GameScreen.Cam.TargetPos = Vector2.Zero;
@@ -754,6 +753,8 @@ namespace Barotrauma.Networking
Submarine.Unload(); Submarine.Unload();
messageBox.Close(null, null);
GameMain.NetLobbyScreen.Select(); GameMain.NetLobbyScreen.Select();
yield return CoroutineStatus.Success; yield return CoroutineStatus.Success;
@@ -1003,17 +1004,18 @@ namespace Barotrauma.Networking
} }
//share the rest of the jobs according to the ''commonness'' of the job //share the rest of the jobs according to the ''commonness'' of the job
float totalCommonness = 0.0f; //float totalCommonness = 0.0f;
for (int i = 0; i < JobPrefab.List.Count; i++) //for (int i = 0; i < JobPrefab.List.Count; i++)
{ //{
if (JobPrefab.List[i].AllowAlways || JobPrefab.List[i].MaxNumber == 0) continue; // if (JobPrefab.List[i].AllowAlways || JobPrefab.List[i].MaxNumber == 0) continue;
totalCommonness += JobPrefab.List[i].Commonness; // totalCommonness += JobPrefab.List[i].Commonness;
} //}
for (int preferenceIndex = 0; preferenceIndex < 3; preferenceIndex++) //find a suitable job for the rest of the players
for (int i = unassigned.Count - 1; i >= 0; i--)
{ {
for (int i = unassigned.Count - 1; i >= 0; i--) for (int preferenceIndex = 0; preferenceIndex < 3; preferenceIndex++)
{ {
int jobIndex = JobPrefab.List.FindIndex(jp => jp == unassigned[i].jobPreferences[preferenceIndex]); int jobIndex = JobPrefab.List.FindIndex(jp => jp == unassigned[i].jobPreferences[preferenceIndex]);
@@ -1024,6 +1026,7 @@ namespace Barotrauma.Networking
assignedClientCount[jobIndex]++; assignedClientCount[jobIndex]++;
unassigned.RemoveAt(i); unassigned.RemoveAt(i);
break;
} }
} }
@@ -1038,6 +1041,7 @@ namespace Barotrauma.Networking
foreach (Client c in clients) foreach (Client c in clients)
{ {
int index = c.jobPreferences.FindIndex(jp => jp == job); int index = c.jobPreferences.FindIndex(jp => jp == job);
if (index == -1) index = 1000;
if (preferredClient == null || index < bestPreference) if (preferredClient == null || index < bestPreference)
{ {
bestPreference = index; bestPreference = index;
+6 -3
View File
@@ -11,14 +11,17 @@ namespace Barotrauma.Networking
DropItem = 3, DropItem = 3,
InventoryUpdate = 4, InventoryUpdate = 4,
PickItem = 5, PickItem = 5,
UpdateProperty = 6 UpdateProperty = 6,
WallDamage = 7,
SelectCharacter = 8
} }
class NetworkEvent class NetworkEvent
{ {
public static List<NetworkEvent> events = new List<NetworkEvent>(); public static List<NetworkEvent> events = new List<NetworkEvent>();
private static bool[] isImportant = { false, true, false, true, true, true, true }; private static bool[] isImportant = { false, true, false, true, true, true, true, true, true };
private static bool[] overridePrevious = { true, false, true, false, false, false, true, true, true };
private int id; private int id;
@@ -68,7 +71,7 @@ namespace Barotrauma.Networking
eventType = type; eventType = type;
if (!isImportant[(int)type]) if (overridePrevious[(int)type])
{ {
if (events.Find(e => e.id == id && e.eventType == type) != null) return; if (events.Find(e => e.id == id && e.eventType == type) != null) return;
} }
-2
View File
@@ -65,8 +65,6 @@ namespace Barotrauma
//http://gafferongames.com/game-physics/fix-your-timestep/ //http://gafferongames.com/game-physics/fix-your-timestep/
Physics.accumulator += deltaTime; Physics.accumulator += deltaTime;
AmbientSoundManager.Update();
#if DEBUG #if DEBUG
if (GameMain.GameSession != null && GameMain.GameSession.Level != null && GameMain.GameSession.Submarine != null) if (GameMain.GameSession != null && GameMain.GameSession.Level != null && GameMain.GameSession.Submarine != null)
{ {
+2 -2
View File
@@ -447,7 +447,7 @@ namespace Barotrauma
private bool StartShift(GUIButton button, object selection) private bool StartShift(GUIButton button, object selection)
{ {
//GameMain.ShowLoading(ShiftLoading()); //GameMain.ShowLoading(ShiftLoading());
GameMain.GameSession.StartShift(TimeSpan.Zero, selectedLevel, false); GameMain.GameSession.StartShift(selectedLevel, false);
GameMain.GameScreen.Select(); GameMain.GameScreen.Select();
return true; return true;
@@ -455,7 +455,7 @@ namespace Barotrauma
private IEnumerable<object> ShiftLoading() private IEnumerable<object> ShiftLoading()
{ {
GameMain.GameSession.StartShift(TimeSpan.Zero, selectedLevel, false); GameMain.GameSession.StartShift(selectedLevel, false);
GameMain.GameScreen.Select(); GameMain.GameScreen.Select();
yield return CoroutineStatus.Success; yield return CoroutineStatus.Success;
+1 -1
View File
@@ -196,7 +196,7 @@ namespace Barotrauma
private bool TutorialButtonClicked(GUIButton button, object obj) private bool TutorialButtonClicked(GUIButton button, object obj)
{ {
TutorialMode.Start(); TutorialMode.StartTutorial();
return true; return true;
} }
+18 -29
View File
@@ -23,7 +23,7 @@ namespace Barotrauma
private GUITextBox textBox, seedBox; private GUITextBox textBox, seedBox;
private GUIScrollBar durationBar; //private GUIScrollBar durationBar;
private GUIFrame playerFrame; private GUIFrame playerFrame;
@@ -61,15 +61,6 @@ namespace Barotrauma
return ServerMessage; return ServerMessage;
} }
public TimeSpan GameDuration
{
get
{
int minutes = (int)(durationBar.BarScroll* 60.0f);
return new TimeSpan(0, minutes, 0);
}
}
public List<JobPrefab> JobPreferences public List<JobPrefab> JobPreferences
{ {
get get
@@ -100,10 +91,10 @@ namespace Barotrauma
} }
} }
public string DurationText() //public string DurationText()
{ //{
return "Duration: " + GameDuration.TotalMinutes + " min"; // return "Duration: " + GameDuration.TotalMinutes + " min";
} //}
public NetLobbyScreen() public NetLobbyScreen()
{ {
@@ -214,20 +205,20 @@ namespace Barotrauma
//duration ------------------------------------------------------------------ //duration ------------------------------------------------------------------
GUITextBlock durationText = new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 20), //GUITextBlock durationText = new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 20),
"Duration: ", GUI.Style, Alignment.Left, Alignment.TopLeft, infoFrame); // "Duration: ", GUI.Style, Alignment.Left, Alignment.TopLeft, infoFrame);
durationText.TextGetter = DurationText; //durationText.TextGetter = DurationText;
durationBar = new GUIScrollBar(new Rectangle(columnX, 150, columnWidth, 20), //durationBar = new GUIScrollBar(new Rectangle(columnX, 150, columnWidth, 20),
GUI.Style, 0.1f, infoFrame); // GUI.Style, 0.1f, infoFrame);
durationBar.BarSize = 0.1f; //durationBar.BarSize = 0.1f;
//seed ------------------------------------------------------------------ //seed ------------------------------------------------------------------
new GUITextBlock(new Rectangle(columnX, 190, columnWidth, 20), new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 20),
"Level Seed: ", GUI.Style, Alignment.Left, Alignment.TopLeft, infoFrame); "Level Seed: ", GUI.Style, Alignment.Left, Alignment.TopLeft, infoFrame);
seedBox = new GUITextBox(new Rectangle(columnX, 220, columnWidth, 20), seedBox = new GUITextBox(new Rectangle(columnX, 150, columnWidth, 20),
Alignment.TopLeft, GUI.Style, infoFrame); Alignment.TopLeft, GUI.Style, infoFrame);
seedBox.OnTextChanged = SelectSeed; seedBox.OnTextChanged = SelectSeed;
LevelSeed = ToolBox.RandomSeed(8); LevelSeed = ToolBox.RandomSeed(8);
@@ -263,7 +254,6 @@ namespace Barotrauma
subList.Enabled = GameMain.Server != null; subList.Enabled = GameMain.Server != null;
modeList.Enabled = GameMain.Server != null; modeList.Enabled = GameMain.Server != null;
durationBar.Enabled = GameMain.Server != null;
seedBox.Enabled = GameMain.Server != null; seedBox.Enabled = GameMain.Server != null;
serverMessage.Enabled = GameMain.Server != null; serverMessage.Enabled = GameMain.Server != null;
ServerName = (GameMain.Server==null) ? "Server" : GameMain.Server.Name; ServerName = (GameMain.Server==null) ? "Server" : GameMain.Server.Name;
@@ -280,7 +270,6 @@ namespace Barotrauma
//mapList.OnSelected = new GUIListBox.OnSelectedHandler(Game1.server.UpdateNetLobby); //mapList.OnSelected = new GUIListBox.OnSelectedHandler(Game1.server.UpdateNetLobby);
modeList.OnSelected += GameMain.Server.UpdateNetLobby; modeList.OnSelected += GameMain.Server.UpdateNetLobby;
durationBar.OnMoved = GameMain.Server.UpdateNetLobby;
if (subList.CountChildren > 0 && subList.Selected == null) subList.Select(-1); if (subList.CountChildren > 0 && subList.Selected == null) subList.Select(-1);
if (GameModePreset.list.Count > 0 && modeList.Selected == null) modeList.Select(-1); if (GameModePreset.list.Count > 0 && modeList.Selected == null) modeList.Select(-1);
@@ -702,10 +691,10 @@ namespace Barotrauma
msg.Write(ServerMessage); msg.Write(ServerMessage);
msg.Write(modeList.SelectedIndex-1); msg.Write(modeList.SelectedIndex-1);
msg.Write(durationBar.BarScroll); //msg.Write(durationBar.BarScroll);
msg.Write(LevelSeed); msg.Write(LevelSeed);
msg.Write((byte)(playerList.CountChildren - 1)); msg.Write((byte)(playerList.CountChildren));
for (int i = 0; i < playerList.CountChildren; i++) for (int i = 0; i < playerList.CountChildren; i++)
{ {
string clientName = playerList.children[i].UserData as string; string clientName = playerList.children[i].UserData as string;
@@ -721,7 +710,7 @@ namespace Barotrauma
string mapName="", md5Hash=""; string mapName="", md5Hash="";
int modeIndex = 0; int modeIndex = 0;
float durationScroll = 0.0f; //float durationScroll = 0.0f;
string levelSeed = ""; string levelSeed = "";
try try
@@ -734,7 +723,7 @@ namespace Barotrauma
modeIndex = msg.ReadInt32(); modeIndex = msg.ReadInt32();
durationScroll = msg.ReadFloat(); //durationScroll = msg.ReadFloat();
levelSeed = msg.ReadString(); levelSeed = msg.ReadString();
@@ -756,7 +745,7 @@ namespace Barotrauma
modeList.Select(modeIndex); modeList.Select(modeIndex);
durationBar.BarScroll = durationScroll; //durationBar.BarScroll = durationScroll;
LevelSeed = levelSeed; LevelSeed = levelSeed;
} }
@@ -42,6 +42,7 @@ namespace Barotrauma
Rectangle panelRect = new Rectangle(0, 0, width, height); Rectangle panelRect = new Rectangle(0, 0, width, height);
menu = new GUIFrame(panelRect, null, Alignment.Center, GUI.Style); menu = new GUIFrame(panelRect, null, Alignment.Center, GUI.Style);
menu.Padding = new Vector4(40.0f, 40.0f, 40.0f, 20.0f);
new GUITextBlock(new Rectangle(0, -25, 0, 30), "Join Server", GUI.Style, Alignment.CenterX, Alignment.CenterX, menu, false, GUI.LargeFont); new GUITextBlock(new Rectangle(0, -25, 0, 30), "Join Server", GUI.Style, Alignment.CenterX, Alignment.CenterX, menu, false, GUI.LargeFont);
@@ -53,7 +54,7 @@ namespace Barotrauma
int middleX = (int)(width * 0.4f); int middleX = (int)(width * 0.4f);
serverList = new GUIListBox(new Rectangle(middleX,60,0,(int)(height*0.7f)), GUI.Style, menu); serverList = new GUIListBox(new Rectangle(middleX,60,0,height-160), GUI.Style, menu);
serverList.OnSelected = SelectServer; serverList.OnSelected = SelectServer;
float[] columnRelativeX = new float[] { 0.15f, 0.55f, 0.15f, 0.15f }; float[] columnRelativeX = new float[] { 0.15f, 0.55f, 0.15f, 0.15f };
@@ -161,6 +161,22 @@ namespace Barotrauma
startDrone = null; startDrone = null;
} }
if (Submarine.Loaded==null)
{
if (waterAmbienceIndexes[0] > 0)
{
SoundManager.Stop(waterAmbienceIndexes[0]);
SoundManager.Stop(waterAmbienceIndexes[1]);
waterAmbienceIndexes[0] = 0;
waterAmbienceIndexes[1] = 0;
}
return;
}
float ambienceVolume = 0.8f; float ambienceVolume = 0.8f;
float lowpassHFGain = 1.0f; float lowpassHFGain = 1.0f;
if (Character.Controlled != null) if (Character.Controlled != null)
+8 -1
View File
@@ -529,7 +529,14 @@ namespace Barotrauma.Sounds
for (int i = 0; i < tempBuffers.Length; i++) for (int i = 0; i < tempBuffers.Length; i++)
{ {
finished |= FillBuffer(stream, tempBuffers[i]); try
{
finished |= FillBuffer(stream, tempBuffers[i]);
}
catch
{
continue;
}
if (finished) if (finished)
{ {
+3 -3
View File
@@ -130,7 +130,7 @@ namespace Barotrauma
return files; return files;
} }
public static string CreateSavePath(string fileName="save") public static string CreateSavePath(string fileName="Save")
{ {
if (!Directory.Exists(SaveFolder)) if (!Directory.Exists(SaveFolder))
{ {
@@ -142,12 +142,12 @@ namespace Barotrauma
string pathWithoutExtension = Path.Combine(SaveFolder, fileName); string pathWithoutExtension = Path.Combine(SaveFolder, fileName);
int i = 0; int i = 0;
while (File.Exists(pathWithoutExtension + i + extension)) while (File.Exists(pathWithoutExtension + " " + i + extension))
{ {
i++; i++;
} }
return fileName + i; return fileName + " " + i;
} }
public static void CompressStringToFile(string fileName, string value) public static void CompressStringToFile(string fileName, string value)
+63
View File
@@ -1,4 +1,67 @@
---------------------------------------------------------------------------------------------------------
v0.2
---------------------------------------------------------------------------------------------------------
Multiplayer:
- major optimization and much better lag compensation
- tons of bugfixes that should fix most of the syncing issues
- admins can play on their own server without launching another instance of the game
- setting the job preferences actually does something now
- reconnecting to a server if the connection is temporarily lost works much better now
- proper error messages if UPnP port forwarding fails
Items:
- security guard gear: ballistic vest, helmet & stun baton
- wifi components that can be used for transmitting signals between devices
- wall labels with a configurable text
- a bunch of new sprites and sounds
- wearing a diving suit slows the characters down
- supercapacitors
- attempting to fire the railgun when there are no shells loaded doesn't consume power anymore
Submarine:
- improved version of Aegir
- a new submarine, "Vellamo"
- nuclear reactors overheat much more slowly and there are warning signals for overheating and a remote
shutdown button in both of the default subs
- ambient sounds change according to the speed of the sub
- fixed parts of the submarine getting stuck in the level on collision
- the autopilot is a much better driver now (although it may still crash at very tight spots)
Crew:
- aiming underwater is much easier
- improved humanoid animations
- stunned/dead characters can be dragged
- all characters can now use plasma cutters and welders regardless of their skills, but insufficient
skill level will make them flicker and work much less efficiently
- same for the harpoon gun, anyone can shoot but lower levels will make the gun less accurate
- rewiring devices may cause electric shocks if the electrical engineering level is too low
Creatures:
- some random "prop fish" swimming in the background
- a new hostile creature
Misc:
- a tutorial going through all the basic tasks and game mechanics (more in-depth tutorials will be
added in future versions, including one for making custom subs)
- an auto-updater in the launcher
- the game generates a detailed report if it crashes
- physics optimization (i.e. using simplified physics & animation for off-screen characters and
disabling them entirely if they're far enough)
- lighting optimization (caching the lights/shadows if a light source hasn't moved instead of
recalculating them every frame)
- two new background music tracks
- better looking explosions
- better looking water particle effects
- minor UI improvements
- better UI scaling on different resolutions
- health/oxygen bar improvements and status icons for bleeding and water pressure
- gap-hull connections are visible in the sub editor
- pumps don't have to be manually connected to a hull in the editor anymore, they automatically
empty/fill the hull they're inside
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------
v0.1.3.2 v0.1.3.2
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------
Binary file not shown.