38f1ddb...178a853: v0.8.9.1, removed content folder
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Barotrauma.Networking;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Barotrauma.Networking;
|
||||
#if CLIENT
|
||||
using Barotrauma.Sounds;
|
||||
using Barotrauma.Lights;
|
||||
using Barotrauma.Particles;
|
||||
#endif
|
||||
@@ -13,9 +14,7 @@ namespace Barotrauma
|
||||
{
|
||||
const float OxygenConsumption = 50.0f;
|
||||
const float GrowSpeed = 5.0f;
|
||||
|
||||
private int basicSoundIndex, largeSoundIndex;
|
||||
|
||||
|
||||
private Hull hull;
|
||||
|
||||
private Vector2 position;
|
||||
@@ -40,7 +39,7 @@ namespace Barotrauma
|
||||
|
||||
public Vector2 WorldPosition
|
||||
{
|
||||
get { return Submarine.Position + position; }
|
||||
get { return Submarine == null ? position : Submarine.Position + position; }
|
||||
}
|
||||
|
||||
public Vector2 Size
|
||||
@@ -71,24 +70,21 @@ namespace Barotrauma
|
||||
public FireSource(Vector2 worldPosition, Hull spawningHull = null, bool isNetworkMessage = false)
|
||||
{
|
||||
hull = Hull.FindHull(worldPosition, spawningHull);
|
||||
if (hull == null) return;
|
||||
if (hull == null || worldPosition.Y < hull.WorldSurface) return;
|
||||
|
||||
if (!isNetworkMessage && GameMain.Client != null) return;
|
||||
|
||||
hull.AddFireSource(this);
|
||||
|
||||
Submarine = hull.Submarine;
|
||||
|
||||
this.position = worldPosition - new Vector2(-5.0f, 5.0f) - Submarine.Position;
|
||||
|
||||
#if CLIENT
|
||||
if (fireSoundBasic == null)
|
||||
|
||||
position = worldPosition - new Vector2(-5.0f, 5.0f);
|
||||
if (hull.Submarine != null)
|
||||
{
|
||||
fireSoundBasic = Sound.Load("Content/Sounds/fire.ogg", false);
|
||||
fireSoundLarge = Sound.Load("Content/Sounds/firelarge.ogg", false);
|
||||
Submarine = hull.Submarine;
|
||||
position -= Submarine.Position;
|
||||
}
|
||||
|
||||
lightSource = new LightSource(this.position, 50.0f, new Color(1.0f, 0.9f, 0.7f), hull == null ? null : hull.Submarine);
|
||||
#if CLIENT
|
||||
lightSource = new LightSource(this.position, 50.0f, new Color(1.0f, 0.9f, 0.7f), hull?.Submarine);
|
||||
#endif
|
||||
|
||||
size = new Vector2(10.0f, 10.0f);
|
||||
@@ -154,7 +150,7 @@ namespace Barotrauma
|
||||
DamageCharacters(deltaTime);
|
||||
DamageItems(deltaTime);
|
||||
|
||||
if (hull.WaterVolume > 0.0f) HullWaterExtinquish(deltaTime);
|
||||
if (hull.WaterVolume > 0.0f) HullWaterExtinguish(deltaTime);
|
||||
|
||||
hull.Oxygen -= size.X * deltaTime * OxygenConsumption;
|
||||
|
||||
@@ -203,8 +199,10 @@ namespace Barotrauma
|
||||
float dmg = (float)Math.Sqrt(size.X) * deltaTime / c.AnimController.Limbs.Length;
|
||||
foreach (Limb limb in c.AnimController.Limbs)
|
||||
{
|
||||
c.AddDamage(limb.SimPosition, DamageType.Burn, dmg, 0, 0, false);
|
||||
c.LastDamageSource = null;
|
||||
c.DamageLimb(WorldPosition, limb, new List<Affliction>() { AfflictionPrefab.Burn.Instantiate(dmg) }, 0.0f, false, 0.0f);
|
||||
}
|
||||
c.ApplyStatusEffects(ActionType.OnFire, deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,15 +251,15 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private void HullWaterExtinquish(float deltaTime)
|
||||
private void HullWaterExtinguish(float deltaTime)
|
||||
{
|
||||
//the higher the surface of the water is relative to the firesource, the faster it puts out the fire
|
||||
float extinquishAmount = (hull.Surface - (position.Y - size.Y)) * deltaTime;
|
||||
float extinguishAmount = (hull.Surface - (position.Y - size.Y)) * deltaTime;
|
||||
|
||||
if (extinquishAmount < 0.0f) return;
|
||||
if (extinguishAmount < 0.0f) return;
|
||||
|
||||
#if CLIENT
|
||||
float steamCount = Rand.Range(-5.0f, Math.Min(extinquishAmount * 100.0f, 10));
|
||||
float steamCount = Rand.Range(-5.0f, Math.Min(extinguishAmount * 100.0f, 10));
|
||||
for (int i = 0; i < steamCount; i++)
|
||||
{
|
||||
Vector2 spawnPos = new Vector2(
|
||||
@@ -272,18 +270,14 @@ namespace Barotrauma
|
||||
|
||||
var particle = GameMain.ParticleManager.CreateParticle("steam",
|
||||
spawnPos, speed, 0.0f, hull);
|
||||
|
||||
if (particle == null) continue;
|
||||
|
||||
particle.Size *= MathHelper.Clamp(size.X / 10.0f, 0.5f, 3.0f);
|
||||
}
|
||||
#endif
|
||||
|
||||
position.X += extinquishAmount / 2.0f;
|
||||
size.X -= extinquishAmount;
|
||||
position.X += extinguishAmount / 2.0f;
|
||||
size.X -= extinguishAmount;
|
||||
|
||||
//evaporate some of the water
|
||||
hull.WaterVolume -= extinquishAmount;
|
||||
hull.WaterVolume -= extinguishAmount;
|
||||
|
||||
if (GameMain.Client != null) return;
|
||||
|
||||
@@ -292,7 +286,7 @@ namespace Barotrauma
|
||||
|
||||
public void Extinguish(float deltaTime, float amount)
|
||||
{
|
||||
float extinquishAmount = amount * deltaTime;
|
||||
float extinguishAmount = amount * deltaTime;
|
||||
|
||||
#if CLIENT
|
||||
float steamCount = Rand.Range(-5.0f, (float)Math.Sqrt(amount));
|
||||
@@ -304,17 +298,13 @@ namespace Barotrauma
|
||||
|
||||
var particle = GameMain.ParticleManager.CreateParticle("steam",
|
||||
spawnPos, speed, 0.0f, hull);
|
||||
|
||||
if (particle == null) continue;
|
||||
|
||||
particle.Size *= MathHelper.Clamp(size.X / 10.0f, 0.5f, 3.0f);
|
||||
}
|
||||
#endif
|
||||
|
||||
position.X += extinquishAmount / 2.0f;
|
||||
size.X -= extinquishAmount;
|
||||
position.X += extinguishAmount / 2.0f;
|
||||
size.X -= extinguishAmount;
|
||||
|
||||
hull.WaterVolume -= extinquishAmount;
|
||||
hull.WaterVolume -= extinguishAmount;
|
||||
|
||||
if (GameMain.Client != null) return;
|
||||
|
||||
@@ -330,18 +320,7 @@ namespace Barotrauma
|
||||
{
|
||||
#if CLIENT
|
||||
lightSource.Remove();
|
||||
|
||||
if (basicSoundIndex > 0)
|
||||
{
|
||||
Sounds.SoundManager.Stop(basicSoundIndex);
|
||||
basicSoundIndex = -1;
|
||||
}
|
||||
if (largeSoundIndex > 0)
|
||||
{
|
||||
Sounds.SoundManager.Stop(largeSoundIndex);
|
||||
largeSoundIndex = -1;
|
||||
}
|
||||
|
||||
|
||||
foreach (Decal d in burnDecals)
|
||||
{
|
||||
d.StopFadeIn();
|
||||
|
||||
Reference in New Issue
Block a user