Fixed missing clientpermissions.xml preventing hosting

Fixed double-clicking items in corpses putting them in their hands instead of your inventory
Fixed game over/round end music not playing in multiplayer
Added Item Combinations for things like chemicals, etc. - this transfers condition from one item to another
Added game over text to multiplayer round summary
This commit is contained in:
Alex Noir
2017-12-23 16:59:08 +03:00
parent 402bcb5d66
commit 60329fb0d1
8 changed files with 104 additions and 34 deletions

View File

@@ -26,7 +26,7 @@ namespace Barotrauma
{
bool singleplayer = GameMain.NetworkMember == null;
bool gameOver = gameSession.CrewManager.GetCharacters().All(c => c.IsDead);
bool gameOver = gameSession.CrewManager.GetCharacters().All(c => c.IsDead || c.IsUnconscious);
bool progress = Submarine.MainSub.AtEndPosition;
GUIFrame frame = new GUIFrame(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * 0.8f, null);
@@ -36,15 +36,18 @@ namespace Barotrauma
int y = 0;
if (singleplayer)
if (!singleplayer)
{
string summaryText = InfoTextManager.GetInfoText(gameOver ? "gameover" :
(progress ? "progress" : "return"));
var infoText = new GUITextBlock(new Rectangle(0, y, 0, 50), summaryText, "", innerFrame, true);
y += infoText.Rect.Height;
//Game over if everyone dead or didn't progress
gameOver = gameOver || !progress;
SoundPlayer.OverrideMusicType = gameOver ? "crewdead" : "endround";
}
string summaryText = InfoTextManager.GetInfoText(gameOver ? "gameover" :
(progress ? "progress" : "return"));
var infoText = new GUITextBlock(new Rectangle(0, y, 0, 50), summaryText, "", innerFrame, true);
y += infoText.Rect.Height;
if (!string.IsNullOrWhiteSpace(endMessage))
{

View File

@@ -142,6 +142,10 @@ namespace Barotrauma
{
wasPut = character.SelectedCharacter.Inventory.TryPutItem(doubleClickedItem, Character.Controlled, doubleClickedItem.AllowedSlots, true);
}
else if (character.SelectedBy != null && Character.Controlled == character.SelectedBy && character.SelectedBy.Inventory != null)
{
wasPut = character.SelectedBy.Inventory.TryPutItem(doubleClickedItem, Character.Controlled, doubleClickedItem.AllowedSlots, true);
}
else //doubleclicked and no other inventory is selected
{
//not equipped -> attempt to equip

View File

@@ -742,6 +742,9 @@
<Content Include="$(MSBuildThisFileDirectory)Content\waterbump.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Data\clientpermissions.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Data\ContentPackages\Vanilla 0.7.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

View File

@@ -49,7 +49,7 @@
<Body width="11" height="16" density="20"/>
<MeleeWeapon slots="Any,RightHand,LeftHand"
<MeleeWeapon canBeCombined="true" slots="Any,RightHand,LeftHand"
aimpos="5,0" handle1="-5,0" holdangle="10" reload="1.0">
<StatusEffect type="OnUse" target="This" Condition="-25.0" disabledeltatime="true"/>
<StatusEffect type="OnUse" target="This, Character" bleeding="-0.1" duration="5.0">
@@ -69,7 +69,7 @@
<Body width="8" height="16" density="40"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnUse" target="Character" Health="-2" duration="10">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
@@ -93,7 +93,7 @@
<StatusEffect type="OnUse" target="This" Condition="-25.0" disabledeltatime="true"/>
</ItemComponent>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnUse" target="Character" Health="0.3" Oxygen="0.3" duration="10">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
@@ -111,7 +111,7 @@
<Body width="8" height="17" density="10"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnUse" target="Character" Health="-0.1" duration="20.0">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
@@ -135,7 +135,7 @@
<Body width="8" height="7" density="10"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnUse" target="Character" SpeedMultiplier="0.8" setvalue="true" duration="20.0">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
@@ -153,7 +153,7 @@
<Body width="8" height="16" density="10"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnUse" target="Character" Health="-5.0" disabledeltatime="true">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
@@ -171,7 +171,7 @@
<Body width="8" height="16" density="10"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnUse" target="Character" Health="-5.0" disabledeltatime="true">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
@@ -193,7 +193,7 @@
<Body width="8" height="16" density="10"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnUse" target="Character" Health="-5.0" disabledeltatime="true">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
@@ -214,7 +214,7 @@
<Body width="8" height="16" density="20"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnUse" target="Character" Health="-0.3" Oxygen="2.0" duration="10">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
@@ -239,7 +239,7 @@
<StatusEffect type="OnUse" target="This" Condition="-25.0" disabledeltatime="true"/>
</ItemComponent>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnUse" target="Character" Health="0.3" Bleeding="-0.2" duration="5.0">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
@@ -265,7 +265,7 @@
<StatusEffect type="OnUse" target="Character, This" Health="-0.5" duration="10"/>
</ItemComponent>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnUse" target="Character" Health="3.0" duration="5.0">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
@@ -285,7 +285,7 @@
<Body width="8" height="16" density="20"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnUse" target="Character" Health="0.5" Oxygen="0.5" Bleeding="-0.025" duration="60.0">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
@@ -304,7 +304,7 @@
<Body width="8" height="16" density="15"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnUse" target="Character" SpeedMultiplier="1.5" setvalue="true" duration="60.0">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
@@ -323,7 +323,7 @@
<Body width="8" height="16" density="10"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnUse" target="Character" HuskInfectionState="-0.2" setvalue="true">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
@@ -336,14 +336,13 @@
spritecolor="0.6,0.8,1.0,1.0"
Tags="smallitem,chem,medical"
impacttolerance="8"
canuseonself="true"
description="A mildy toxic solution that slowly releases oxygen into the bloodstream when injected.">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6" />
<Body width="8" height="16" density="20"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnUse" target="Character" Health="-0.5" Oxygen="10.0" duration="60">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
@@ -367,7 +366,7 @@
<Body width="8" height="16" density="10"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnImpact" target="This" Condition="0.0" setvalue="true"/>
<StatusEffect type="OnFire" target="this" condition="-50"/>
<StatusEffect type="OnBroken" target="This" Condition="-100.0">
@@ -388,7 +387,7 @@
<Body width="8" height="17" density="10"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnUse" target="Character" Health="-5.0" Stun="10" disabledeltatime="true">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
@@ -406,7 +405,7 @@
<Body width="8" height="17" density="10"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnUse" target="Character" Health="-1.0" duration="30.0">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
@@ -424,7 +423,7 @@
<Body width="8" height="16" density="25"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnUse" target="Character" bleeding="0.1" duration="60.0">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
@@ -443,7 +442,7 @@
<Body width="8" height="16" density="10"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnUse" target="Character" HuskInfectionState="0.01">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
@@ -462,7 +461,7 @@
<Body width="8" height="16" density="10"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnUse" target="Character" Health="-5.0" duration="60.0">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
@@ -481,7 +480,7 @@
<Body width="25" height="5" density="10"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnImpact" target="This" Condition="0.0" setvalue="true"/>
<StatusEffect type="OnFire" target="This" Condition="-50.0"/>
@@ -508,7 +507,7 @@
<Body width="8" height="16" density="10"/>
<Throwable slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<Throwable canBeCombined="true" slots="Any,RightHand,LeftHand" throwforce="4.0" aimpos="35,-10">
<StatusEffect type="OnUse" target="Character" Oxygen="-15.0" Health="-5.0">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<Permissions>
</Permissions>

View File

@@ -30,6 +30,8 @@ namespace Barotrauma.Items.Components
protected bool canBePicked;
protected bool canBeSelected;
protected bool canBeCombined;
protected bool removeOnCombined;
public bool WasUsed;
@@ -124,6 +126,22 @@ namespace Barotrauma.Items.Components
set { canBeSelected = value; }
}
//Transfer conditions between same prefab items
[Serialize(false, false)]
public bool CanBeCombined
{
get { return canBeCombined; }
set { canBeCombined = value; }
}
//Remove item if combination results in 0 condition
[Serialize(false, false)]
public bool RemoveOnCombined
{
get { return removeOnCombined; }
set { removeOnCombined = value; }
}
public InputType PickKey
{
get;
@@ -323,6 +341,43 @@ namespace Barotrauma.Items.Components
public virtual bool Combine(Item item)
{
if (canBeCombined && this.item.Prefab == item.Prefab && item.Condition > 0.0f && this.item.Condition > 0.0f)
{
float transferAmount = 0.0f;
if (this.Item.Condition <= item.Condition)
transferAmount = Math.Min(item.Condition, this.item.Prefab.Health - this.item.Condition);
else
transferAmount = -Math.Min(this.item.Condition, item.Prefab.Health - item.Condition);
if (transferAmount == 0.0f)
return false;
this.Item.Condition += transferAmount;
item.Condition -= transferAmount;
if (removeOnCombined)
{
if (item.Condition <= 0.0f)
{
if (item.ParentInventory != null)
{
Character owner = (Character)item.ParentInventory.Owner;
if (owner != null && owner.HasSelectedItem(item)) item.Unequip(owner);
item.ParentInventory.RemoveItem(item);
}
Entity.Spawner.AddToRemoveQueue(item);
}
if (this.Item.Condition <= 0.0f)
{
if (this.Item.ParentInventory != null)
{
Character owner = (Character)this.Item.ParentInventory.Owner;
if (owner != null && owner.HasSelectedItem(this.Item)) this.Item.Unequip(owner);
this.Item.ParentInventory.RemoveItem(this.Item);
}
Entity.Spawner.AddToRemoveQueue(this.Item);
}
}
return true;
}
return false;
}

View File

@@ -170,7 +170,7 @@ namespace Barotrauma.Items.Components
if (effect.Targets.HasFlag(StatusEffect.TargetType.This))
effect.Apply(ActionType.OnContaining, deltaTime, item, item.AllPropertyObjects);
if (effect.Targets.HasFlag(StatusEffect.TargetType.Contained))
effect.Apply(ActionType.OnContaining, deltaTime, item, contained.AllPropertyObjects);
effect.Apply(ActionType.OnContaining, deltaTime, item, contained.AllPropertyObjects);
}
}
@@ -192,7 +192,7 @@ namespace Barotrauma.Items.Components
return true;
}
return false;
return false;
}
public override void OnMapLoaded()

View File

@@ -1509,7 +1509,9 @@ namespace Barotrauma.Networking
yield return CoroutineStatus.Running;
} while (cinematic.Running);//(secondsLeft > 0.0f);
#if CLIENT
SoundPlayer.OverrideMusicType = null;
#endif
Submarine.Unload();
entityEventManager.Clear();