Improved level generation algorithm, fixed invisible hulls, turret projectile fix, fabricators work in mp
This commit is contained in:
@@ -331,6 +331,16 @@
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Characters\Husk\DivingSuit.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Characters\Husk\head1.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Characters\Husk\husk.xml">
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Characters\Human\damagedhead.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@@ -397,6 +407,9 @@
|
||||
<Content Include="Content\Characters\Human\torso.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Characters\Husk\legs.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Characters\TigerThresher\damagedtigerthresher.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
name="Skyholder Artifact"
|
||||
pickdistance="150">
|
||||
|
||||
<Sprite texture="artifact.png" depth="0.8" sourcerect="0,0,38,60"/>
|
||||
<Sprite texture="artifact.png" depth="0.7" sourcerect="0,0,38,60"/>
|
||||
|
||||
<Deconstruct time="30">
|
||||
<Item name="Steel Bar"/>
|
||||
@@ -23,7 +23,7 @@
|
||||
name="Thermal Artifact"
|
||||
pickdistance="150">
|
||||
|
||||
<Sprite texture="artifact.png" depth="0.8" sourcerect="74,0,44,61"/>
|
||||
<Sprite texture="artifact.png" depth="0.7" sourcerect="74,0,44,61"/>
|
||||
|
||||
<Deconstruct time="30">
|
||||
<Item name="Steel Bar"/>
|
||||
@@ -45,7 +45,7 @@
|
||||
name="Faraday Artifact"
|
||||
pickdistance="150">
|
||||
|
||||
<Sprite texture="artifact.png" depth="0.8" sourcerect="40,0,33,61"/>
|
||||
<Sprite texture="artifact.png" depth="0.7" sourcerect="40,0,33,61"/>
|
||||
|
||||
<Deconstruct time="30">
|
||||
<Item name="Steel Bar"/>
|
||||
|
||||
@@ -16,10 +16,13 @@
|
||||
<sound file="fabricator.ogg" type="OnActive" range="1000.0" loop="true"/>
|
||||
|
||||
<fabricableitem name="Harpoon Gun" requireditems="Steel Bar, Polycarbonate Bar" requiredtime="20"/>
|
||||
<fabricableitem name="Spear" requireditems="Steel Bar" requiredtime="10"/>
|
||||
|
||||
<fabricableitem name="Plasma Cutter" requireditems="Steel Bar, Polycarbonate Bar" requiredtime="20"/>
|
||||
<fabricableitem name="Welding Tool" requireditems="Steel Bar, Polycarbonate Bar" requiredtime="20"/>
|
||||
|
||||
<fabricableitem name="Railgun Shell" requireditems="Steel Bar, Steel Bar, Polycarbonate Bar" requiredtime="20"/>
|
||||
<fabricableitem name="Nuclear Shell" requireditems="Steel Bar, Steel Bar, Uranium Bar, Polycarbonate Bar" requiredtime="30"/>
|
||||
|
||||
<fabricableitem name="And Component" requireditems="Steel Bar, FPGA Circuit" requiredtime="10"/>
|
||||
<fabricableitem name="Or Component" requireditems="Steel Bar, FPGA Circuit" requiredtime="10"/>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<Sprite texture ="oxygengenerator.png" depth="0.8"/>
|
||||
|
||||
<OxygenGenerator powerconsumption="1000.0" minvoltage="0.5" canbeselected = "true">
|
||||
<StatusEffect type="OnActive" target="Contained" targetnames="Oxygen Tank" Condition="2.0"/>
|
||||
<StatusEffect type="OnActive" target="Contained" targetnames="Oxygen Tank" Condition="0.5"/>
|
||||
<sound file="oxygengenerator.ogg" type="OnActive" range="1000.0" volume="CurrFlow" volumemultiplier="0.001f" loop="true"/>
|
||||
</OxygenGenerator>
|
||||
|
||||
|
||||
@@ -57,6 +57,11 @@
|
||||
pickdistance="150"
|
||||
price="200">
|
||||
|
||||
<Deconstruct time="10">
|
||||
<Item name="Steel Bar"/>
|
||||
<Item name="Uranium Bar"/>
|
||||
</Deconstruct>
|
||||
|
||||
<Sprite texture ="fuelrod.png"/>
|
||||
|
||||
<Body radius="6" height="22" density="5"/>
|
||||
@@ -71,6 +76,11 @@
|
||||
pickdistance="150"
|
||||
spritecolor="0.5,0.0,0.0,1.0">
|
||||
|
||||
<Deconstruct time="10">
|
||||
<Item name="Steel Bar"/>
|
||||
<Item name="Incendium Bar"/>
|
||||
</Deconstruct>
|
||||
|
||||
<Sprite texture ="fuelrod.png"/>
|
||||
|
||||
<Body radius="6" height="22" density="5"/>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<sound file="weldingTool.ogg" type="OnUse" range="500.0" loop="true"/>
|
||||
|
||||
<!-- when using, the contained welding fuel tank will detoriate (= lose fuel) -->
|
||||
<StatusEffect type="OnUse" target="Contained" targetnames="Welding Fuel Tank" Condition="-0.7"/>
|
||||
<StatusEffect type="OnUse" target="Contained" targetnames="Welding Fuel Tank" Condition="-1.0"/>
|
||||
|
||||
<!-- welding a door, it will get stuck after a while -->
|
||||
<StatusEffect type="OnUse" target="UseTarget" targetnames="Door,Windowed Door" Stuck="20.0" Condition="3.0"/>
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
<RepairTool structurefixamount="-2.0" limbfixamount="-0.5" range="100" barrelpos="28,8" particles="plasma">
|
||||
<RequiredItems name="Oxygen Tank" type="Contained" msg="Oxygen tank required"/>
|
||||
<StatusEffect type="OnUse" target="Contained" targetnames="Oxygen Tank" Condition="-0.7"/>
|
||||
<StatusEffect type="OnUse" target="Contained" targetnames="Oxygen Tank" Condition="-1.0"/>
|
||||
<StatusEffect type="OnUse" target="UseTarget" targetnames="Door,Windowed Door" Stuck="-20.0" Condition="-3.0"/>
|
||||
|
||||
<sound file="plasmaCutter.ogg" type="OnUse" range="500.0" loop="true"/>
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
|
||||
<ItemContainer hideitems="false" drawinventory="true" capacity="6" slotsperrow="6" itempos="24,-75" iteminterval="26,0" itemrotation="90" canbeselected = "true">
|
||||
<Containable name="Railgun Shell"/>
|
||||
<Containable name="Nuclear Shell"/>
|
||||
</ItemContainer>
|
||||
|
||||
</Item>
|
||||
@@ -88,5 +89,37 @@
|
||||
<Containable name="smallitem"/>
|
||||
</ItemContainer>
|
||||
</Item>
|
||||
|
||||
<Item
|
||||
name="Nuclear Shell"
|
||||
category="Misc"
|
||||
pickdistance="200"
|
||||
price="100">
|
||||
|
||||
<Deconstruct time="10">
|
||||
<Item name="Steel Bar"/>
|
||||
<Item name="Steel Bar"/>
|
||||
<Item name="Uranium Bar"/>
|
||||
<Item name="Polycarbonate Bar"/>
|
||||
</Deconstruct>
|
||||
|
||||
<Sprite texture="weapons.png" sourcerect="0,77,88,20" depth ="0.5"/>
|
||||
|
||||
<Body width="87" height="18"/>
|
||||
|
||||
<Holdable slots="RightHand+LeftHand" holdpos="0,-50" handle1="-10,0" handle2="10,0" aimable="false"/>
|
||||
|
||||
<Projectile launchimpulse="80.0">
|
||||
<Attack damage="100" bleedingdamage="10" structuredamage="200" damagetype="Blunt"/>
|
||||
<StatusEffect type="OnUse" Condition="-100.0" stun="10.0" disabledeltatime="true" sound="Content/Items/Reactor/explosion.ogg">
|
||||
<Explosion range="1000.0" structuredamage="1000" damage="1000" stun="10" force="50.0"/>
|
||||
</StatusEffect>
|
||||
</Projectile>
|
||||
|
||||
<ItemContainer hideitems="true" capacity="1" canbeselected = "true">
|
||||
<Containable name="smallitem"/>
|
||||
</ItemContainer>
|
||||
</Item>
|
||||
|
||||
</Items>
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 11 KiB |
@@ -102,7 +102,7 @@
|
||||
<Item name="Polycarbonate Bar"/>
|
||||
</Deconstruct>
|
||||
|
||||
<Sprite texture="weapons.png" sourcerect="20,0,77,23" depth="0.5"/>
|
||||
<Sprite texture="weapons.png" sourcerect="21,0,77,22" depth="0.5"/>
|
||||
|
||||
<Body width="90" height="30" density="10"/>
|
||||
|
||||
|
||||
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.3.1.0")]
|
||||
[assembly: AssemblyFileVersion("0.3.1.0")]
|
||||
[assembly: AssemblyVersion("0.3.1.1")]
|
||||
[assembly: AssemblyFileVersion("0.3.1.1")]
|
||||
|
||||
@@ -789,6 +789,8 @@ namespace Barotrauma
|
||||
|
||||
public override void DragCharacter(Character target)
|
||||
{
|
||||
if (target == null) return;
|
||||
|
||||
Limb leftHand = GetLimb(LimbType.LeftHand);
|
||||
Limb rightHand = GetLimb(LimbType.RightHand);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Barotrauma
|
||||
|
||||
public Vector2 SimPosition
|
||||
{
|
||||
get { return position; }
|
||||
get { return FarseerPhysics.ConvertUnits.ToSimUnits(position); }
|
||||
}
|
||||
|
||||
public Vector2 Velocity
|
||||
@@ -81,29 +81,51 @@ namespace Barotrauma
|
||||
depth = MathHelper.Clamp(depth + velocity.Z * deltaTime, 0.0f, MaxDepth);
|
||||
|
||||
checkWallsTimer -= deltaTime;
|
||||
if (checkWallsTimer<=0.0f && Level.Loaded!=null)
|
||||
if (checkWallsTimer <= 0.0f && Level.Loaded != null)
|
||||
{
|
||||
checkWallsTimer = CheckWallsInterval;
|
||||
|
||||
obstacleDiff = Vector2.Zero;
|
||||
|
||||
var cells = Level.Loaded.GetCells(position, 1);
|
||||
if (cells.Count > 0)
|
||||
if (position.Y > Level.Loaded.Size.Y)
|
||||
{
|
||||
|
||||
foreach (Voronoi2.VoronoiCell cell in cells)
|
||||
{
|
||||
obstacleDiff += cell.Center - position;
|
||||
}
|
||||
|
||||
obstacleDiff = Vector2.Normalize(obstacleDiff) * prefab.Speed;
|
||||
obstacleDiff = Vector2.UnitY;
|
||||
}
|
||||
}
|
||||
else if (position.Y < 0.0f)
|
||||
{
|
||||
obstacleDiff = -Vector2.UnitY;
|
||||
}
|
||||
else if (position.X < 0.0f)
|
||||
{
|
||||
obstacleDiff = Vector2.UnitX;
|
||||
}
|
||||
else if (position.X > Level.Loaded.Size.X)
|
||||
{
|
||||
obstacleDiff = -Vector2.UnitX;
|
||||
}
|
||||
else
|
||||
{
|
||||
var cells = Level.Loaded.GetCells(position, 1);
|
||||
if (cells.Count > 0)
|
||||
{
|
||||
|
||||
foreach (Voronoi2.VoronoiCell cell in cells)
|
||||
{
|
||||
obstacleDiff += cell.Center - position;
|
||||
}
|
||||
obstacleDiff /= cells.Count;
|
||||
|
||||
obstacleDiff = Vector2.Normalize(obstacleDiff) * prefab.Speed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (Swarm!=null)
|
||||
{
|
||||
Vector2 midPoint = Swarm.MidPoint();
|
||||
float midPointDist = Vector2.Distance(position, midPoint);
|
||||
float midPointDist = Vector2.Distance(SimPosition, midPoint);
|
||||
|
||||
if (midPointDist > Swarm.MaxDistance)
|
||||
{
|
||||
@@ -116,9 +138,12 @@ namespace Barotrauma
|
||||
steeringManager.SteeringWander(prefab.Speed);
|
||||
}
|
||||
|
||||
//Level.Loaded.Size
|
||||
|
||||
|
||||
if (obstacleDiff != Vector2.Zero)
|
||||
{
|
||||
steeringManager.SteeringSeek(-obstacleDiff, prefab.Speed);
|
||||
steeringManager.SteeringSeek(SimPosition-obstacleDiff, prefab.Speed*2.0f);
|
||||
}
|
||||
|
||||
steeringManager.Update(prefab.Speed);
|
||||
|
||||
@@ -918,10 +918,10 @@ namespace Barotrauma
|
||||
if (!(AnimController is FishAnimController))
|
||||
{
|
||||
bool protectedFromPressure = PressureProtection > 0.0f;
|
||||
|
||||
if (Submarine.Loaded!=null && Level.Loaded !=null)
|
||||
|
||||
if (Submarine.Loaded != null && Level.Loaded != null)
|
||||
{
|
||||
protectedFromPressure = protectedFromPressure && Position.Y > SubmarineBody.DamageDepth;
|
||||
protectedFromPressure = protectedFromPressure && WorldPosition.Y > SubmarineBody.DamageDepth;
|
||||
}
|
||||
|
||||
if (!protectedFromPressure &&
|
||||
|
||||
@@ -532,6 +532,7 @@ namespace Barotrauma
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
spriteBatch.Draw(
|
||||
bodyShapeTexture,
|
||||
new Vector2(body.DrawPosition.X, -body.DrawPosition.Y),
|
||||
@@ -546,7 +547,14 @@ namespace Barotrauma
|
||||
{
|
||||
sprite.Remove();
|
||||
body.Remove();
|
||||
if (hitSound!=null) hitSound.Remove();
|
||||
|
||||
if (bodyShapeTexture != null)
|
||||
{
|
||||
bodyShapeTexture.Dispose();
|
||||
}
|
||||
|
||||
|
||||
if (hitSound != null) hitSound.Remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Barotrauma
|
||||
|
||||
public override void Start(Level level)
|
||||
{
|
||||
Vector2 position = level.PositionsOfInterest[Rand.Int(level.PositionsOfInterest.Count, false)];
|
||||
Vector2 position = level.GetRandomInterestingPosition(monster.Mass > 500.0f, true);
|
||||
|
||||
monster = Character.Create(monsterFile, position);
|
||||
monster.Enabled = false;
|
||||
|
||||
@@ -314,6 +314,7 @@ namespace Barotrauma
|
||||
|
||||
characters.Clear();
|
||||
listBox.ClearChildren();
|
||||
orderListBox.ClearChildren();
|
||||
}
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch)
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Barotrauma.Items.Components
|
||||
[HasDefaultValue(false, true)]
|
||||
public bool Attached
|
||||
{
|
||||
get { return attached; }
|
||||
get { return attached && item.Inventory == null; }
|
||||
set { attached = value; }
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Barotrauma.Items.Components
|
||||
Msg = "";
|
||||
}
|
||||
|
||||
if (attachedByDefault || (Screen.Selected == GameMain.EditMapScreen && Submarine.Loaded!=null)) Use(1.0f);
|
||||
if (attachedByDefault || (Screen.Selected == GameMain.EditMapScreen && Submarine.Loaded!=null)) Use(1.0f);
|
||||
|
||||
|
||||
//holdAngle = ToolBox.GetAttributeFloat(element, "holdangle", 0.0f);
|
||||
@@ -259,12 +259,22 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
//prevRequiredItems = new List<RelatedItem>(requiredItems);
|
||||
|
||||
if (attached)
|
||||
if (Attached)
|
||||
{
|
||||
Use(1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if (item.Inventory!=null)
|
||||
{
|
||||
if (body != null)
|
||||
{
|
||||
item.body = body;
|
||||
body.Enabled = false;
|
||||
}
|
||||
attached = false;
|
||||
}
|
||||
|
||||
requiredItems.Clear();
|
||||
Msg = "";
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
class ItemContainer : ItemComponent
|
||||
{
|
||||
public const int MaxInventoryCount = 4;
|
||||
|
||||
List<RelatedItem> containableItems;
|
||||
public ItemInventory Inventory;
|
||||
|
||||
|
||||
@@ -301,6 +301,10 @@ namespace Barotrauma.Items.Components
|
||||
int itemIndex = fabricatedItem == null ? -1 : fabricableItems.IndexOf(fabricatedItem);
|
||||
|
||||
message.WriteRangedInteger(-1, fabricableItems.Count-1, itemIndex);
|
||||
|
||||
var containers = item.GetComponents<ItemContainer>();
|
||||
containers[0].Inventory.FillNetworkData(type, message, null);
|
||||
containers[1].Inventory.FillNetworkData(type, message, null);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -311,6 +315,10 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
int itemIndex = message.ReadRangedInteger(-1, fabricableItems.Count-1);
|
||||
|
||||
var containers = item.GetComponents<ItemContainer>();
|
||||
containers[0].Inventory.ReadNetworkData(type, message, sendingTime);
|
||||
containers[1].Inventory.ReadNetworkData(type, message, sendingTime);
|
||||
|
||||
if (itemIndex == -1)
|
||||
{
|
||||
CancelFabricating();
|
||||
@@ -324,7 +332,6 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
SelectItem(null, fabricableItems[itemIndex]);
|
||||
StartFabricating(fabricableItems[itemIndex]);
|
||||
timeUntilReady -= sendingTime - (float)Lidgren.Network.NetTime.Now;
|
||||
}
|
||||
|
||||
lastNetworkUpdate = sendingTime;
|
||||
|
||||
@@ -177,6 +177,8 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
ApplyStatusEffects(ActionType.OnUse, 1.0f, null);
|
||||
|
||||
item.body.FarseerBody.OnCollision -= OnProjectileCollision;
|
||||
|
||||
item.body.FarseerBody.IsBullet = false;
|
||||
|
||||
@@ -172,6 +172,8 @@ namespace Barotrauma.Items.Components
|
||||
projectile.body.ResetDynamics();
|
||||
projectile.body.Enabled = true;
|
||||
projectile.SetTransform(ConvertUnits.ToSimUnits(new Vector2(item.WorldRect.X + barrelPos.X, item.WorldRect.Y - barrelPos.Y)), -rotation);
|
||||
projectile.FindHull();
|
||||
projectile.Submarine = projectile.body.Submarine;
|
||||
|
||||
projectiles[0].Use(deltaTime);
|
||||
projectiles[0].User = character;
|
||||
|
||||
@@ -1370,9 +1370,16 @@ namespace Barotrauma
|
||||
message.Write(requirementIndex);
|
||||
break;
|
||||
case NetworkEventType.InventoryUpdate:
|
||||
var itemContainer = GetComponent<ItemContainer>();
|
||||
if (itemContainer == null || itemContainer.Inventory == null) return false;
|
||||
return itemContainer.Inventory.FillNetworkData(NetworkEventType.InventoryUpdate, message, data);
|
||||
var itemContainers = GetComponents<ItemContainer>();
|
||||
if (itemContainers == null || !itemContainers.Any()) return false;
|
||||
|
||||
message.WriteRangedInteger(1, ItemContainer.MaxInventoryCount, itemContainers.Count);
|
||||
foreach (ItemContainer container in itemContainers)
|
||||
{
|
||||
container.Inventory.FillNetworkData(NetworkEventType.InventoryUpdate, message, data);
|
||||
}
|
||||
|
||||
return true;
|
||||
case NetworkEventType.ComponentUpdate:
|
||||
case NetworkEventType.ImportantComponentUpdate:
|
||||
|
||||
@@ -1434,7 +1441,7 @@ namespace Barotrauma
|
||||
{
|
||||
case NetworkEventType.DropItem:
|
||||
Vector2 newSimPos = Vector2.Zero;
|
||||
newSimPos = new Vector2(message.ReadFloat(), message.ReadFloat());
|
||||
newSimPos = new Vector2(message.ReadFloat(), message.ReadFloat());
|
||||
SetTransform(newSimPos, body.Rotation);
|
||||
Drop(null, false);
|
||||
break;
|
||||
@@ -1443,15 +1450,20 @@ namespace Barotrauma
|
||||
byte requirementIndex = message.ReadByte();
|
||||
data = requirementIndex;
|
||||
|
||||
if (requirementIndex>=FixRequirements.Count) return;
|
||||
if (requirementIndex >= FixRequirements.Count) return;
|
||||
|
||||
FixRequirements[requirementIndex].Fixed = true;
|
||||
break;
|
||||
case NetworkEventType.InventoryUpdate:
|
||||
var itemContainers = GetComponents<ItemContainer>();
|
||||
if (itemContainers == null || !itemContainers.Any()) return;
|
||||
|
||||
int containerCount = message.ReadRangedInteger(1, ItemContainer.MaxInventoryCount);
|
||||
for (int i = 0; i < containerCount;i++ )
|
||||
{
|
||||
itemContainers[i].Inventory.ReadNetworkData(type, message, sendingTime);
|
||||
}
|
||||
|
||||
var itemContainer = GetComponent<ItemContainer>();
|
||||
if (itemContainer == null || itemContainer.Inventory == null) return;
|
||||
itemContainer.Inventory.ReadNetworkData(NetworkEventType.DropItem, message, sendingTime);
|
||||
break;
|
||||
case NetworkEventType.ComponentUpdate:
|
||||
case NetworkEventType.ImportantComponentUpdate:
|
||||
|
||||
@@ -41,10 +41,16 @@ namespace Barotrauma
|
||||
{
|
||||
GameMain.ParticleManager.CreateParticle("shockwave", worldPosition,
|
||||
Vector2.Zero, 0.0f, hull);
|
||||
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < attack.Range * 0.1f; i++)
|
||||
{
|
||||
Vector2 bubblePos = Rand.Vector(attack.Range * 0.5f);
|
||||
GameMain.ParticleManager.CreateParticle("bubbles", worldPosition+bubblePos,
|
||||
bubblePos, 0.0f, hull);
|
||||
|
||||
if (sparks)
|
||||
{
|
||||
GameMain.ParticleManager.CreateParticle("spark", worldPosition,
|
||||
@@ -75,16 +81,17 @@ namespace Barotrauma
|
||||
|
||||
foreach (Character c in Character.CharacterList)
|
||||
{
|
||||
float dist = Vector2.Distance(c.WorldPosition, worldPosition);
|
||||
|
||||
if (dist > attack.Range) continue;
|
||||
|
||||
float distFactor = 1.0f - dist / attack.Range;
|
||||
|
||||
foreach (Limb limb in c.AnimController.Limbs)
|
||||
{
|
||||
float dist = Vector2.Distance(limb.WorldPosition, worldPosition);
|
||||
|
||||
if (dist > attack.Range) continue;
|
||||
|
||||
float distFactor = 1.0f - dist / attack.Range;
|
||||
|
||||
if (limb.WorldPosition == worldPosition) continue;
|
||||
distFactor = 1.0f - Vector2.Distance(limb.WorldPosition, worldPosition)/attack.Range;
|
||||
|
||||
c.AddDamage(limb.SimPosition, DamageType.None,
|
||||
attack.GetDamage(1.0f) / c.AnimController.Limbs.Length * distFactor, 0.0f, attack.Stun * distFactor, false);
|
||||
|
||||
@@ -407,7 +407,7 @@ namespace Barotrauma
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true)
|
||||
{
|
||||
if (back) return;
|
||||
//if (back) return;
|
||||
|
||||
if (!ShowHulls && !GameMain.DebugDraw) return;
|
||||
|
||||
|
||||
@@ -13,12 +13,25 @@ using Voronoi2;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
|
||||
class Level
|
||||
{
|
||||
public static Level Loaded
|
||||
{
|
||||
get { return loaded; }
|
||||
}
|
||||
|
||||
struct InterestingPosition
|
||||
{
|
||||
public readonly Vector2 Position;
|
||||
public readonly bool IsLarge;
|
||||
|
||||
public InterestingPosition(Vector2 position, bool isLarge)
|
||||
{
|
||||
Position = position;
|
||||
IsLarge = isLarge;
|
||||
}
|
||||
}
|
||||
|
||||
static Level loaded;
|
||||
|
||||
@@ -49,7 +62,7 @@ namespace Barotrauma
|
||||
|
||||
private List<Body> bodies;
|
||||
|
||||
private List<Vector2> positionsOfInterest;
|
||||
private List<InterestingPosition> positionsOfInterest;
|
||||
|
||||
public Vector2 StartPosition
|
||||
{
|
||||
@@ -65,12 +78,7 @@ namespace Barotrauma
|
||||
{
|
||||
get { return endPosition; }
|
||||
}
|
||||
|
||||
public List<Vector2> PositionsOfInterest
|
||||
{
|
||||
get { return positionsOfInterest; }
|
||||
}
|
||||
|
||||
|
||||
public WrappingWall[,] WrappingWalls
|
||||
{
|
||||
get { return wrappingWalls; }
|
||||
@@ -101,7 +109,7 @@ namespace Barotrauma
|
||||
|
||||
this.Difficulty = difficulty;
|
||||
|
||||
positionsOfInterest = new List<Vector2>();
|
||||
positionsOfInterest = new List<InterestingPosition>();
|
||||
|
||||
borders = new Rectangle(0, 0, width, height);
|
||||
}
|
||||
@@ -109,7 +117,7 @@ namespace Barotrauma
|
||||
public static Level CreateRandom(LocationConnection locationConnection)
|
||||
{
|
||||
string seed = locationConnection.Locations[0].Name + locationConnection.Locations[1].Name;
|
||||
return new Level(seed, locationConnection.Difficulty, 100000, 40000, 2000);
|
||||
return new Level(seed, locationConnection.Difficulty, 100000, 50000, 2000);
|
||||
}
|
||||
|
||||
public static Level CreateRandom(string seed = "")
|
||||
@@ -118,7 +126,7 @@ namespace Barotrauma
|
||||
{
|
||||
seed = Rand.Range(0, int.MaxValue, false).ToString();
|
||||
}
|
||||
return new Level(seed, Rand.Range(30.0f,80.0f,false), 100000, 40000, 2000);
|
||||
return new Level(seed, Rand.Range(30.0f,80.0f,false), 100000, 50000, 2000);
|
||||
}
|
||||
|
||||
public void Generate(bool mirror=false)
|
||||
@@ -140,6 +148,63 @@ namespace Barotrauma
|
||||
|
||||
Rand.SetSyncedSeed(ToolBox.StringToInt(seed));
|
||||
|
||||
float minWidth = Submarine.Loaded == null ? 3000.0f : Math.Max(Submarine.Borders.Width, Submarine.Borders.Height);
|
||||
|
||||
startPosition = new Vector2(minWidth * 2, borders.Height);
|
||||
endPosition = new Vector2(borders.Width - minWidth * 2, borders.Height);
|
||||
|
||||
|
||||
List<Vector2> pathNodes = new List<Vector2>();
|
||||
Rectangle pathBorders = borders;// new Rectangle((int)minWidth, (int)minWidth, borders.Width - (int)minWidth * 2, borders.Height - (int)minWidth);
|
||||
pathBorders.Inflate(-minWidth*2, -minWidth*2);
|
||||
|
||||
pathNodes.Add(startPosition);
|
||||
//pathNodes.Add(new Vector2(minWidth * 3, Rand.Range(minWidth * 2, borders.Height - minWidth * 2, false)));
|
||||
|
||||
for (float x = startPosition.X; x < endPosition.X; x += Rand.Range(2000.0f, 10000.0f, false))
|
||||
{
|
||||
pathNodes.Add(new Vector2(x, Rand.Range(pathBorders.Y, pathBorders.Bottom, false)));
|
||||
|
||||
//if (x > borders.Center.X)
|
||||
//{
|
||||
// positionsOfInterest.Add(pathNodes.Last());
|
||||
//}
|
||||
}
|
||||
|
||||
//pathNodes.Add(new Vector2(borders.Width - minWidth * 3, borders.Height / 2));
|
||||
pathNodes.Add(endPosition);
|
||||
|
||||
int smallTunnelCount = 5;
|
||||
|
||||
List<List<Vector2>> smallTunnels = new List<List<Vector2>>();
|
||||
|
||||
for (int i = 0; i < smallTunnelCount; i++)
|
||||
{
|
||||
var tunnelStartPos = pathNodes[Rand.Range(2, pathNodes.Count - 2, false)];
|
||||
tunnelStartPos.X = MathHelper.Clamp(tunnelStartPos.X, pathBorders.X, pathBorders.Right);
|
||||
|
||||
float tunnelLength = Rand.Range(5000.0f, 10000.0f, false);
|
||||
|
||||
var tunnelNodes = MathUtils.GenerateJaggedLine(tunnelStartPos, tunnelStartPos + Rand.Vector(tunnelLength,false) + Vector2.UnitY*5000.0f, 3, 1000.0f);
|
||||
|
||||
List<Vector2> tunnel = new List<Vector2>();
|
||||
foreach (Vector2[] tunnelNode in tunnelNodes)
|
||||
{
|
||||
if (!pathBorders.Contains(tunnelNode[0])) break;
|
||||
tunnel.Add(tunnelNode[0]);
|
||||
}
|
||||
|
||||
if (tunnel.Any())
|
||||
{
|
||||
smallTunnels.Add(tunnel);
|
||||
positionsOfInterest.Add(new InterestingPosition(tunnel.Last(), false));
|
||||
|
||||
if (tunnel.Count() > 4) positionsOfInterest.Add(new InterestingPosition(tunnel[tunnel.Count()/2], false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
float siteVariance = siteInterval * 0.4f;
|
||||
for (int x = siteInterval / 2; x < borders.Width; x += siteInterval)
|
||||
{
|
||||
@@ -147,6 +212,13 @@ namespace Barotrauma
|
||||
{
|
||||
Vector2 site = new Vector2(x, y) + Rand.Vector(siteVariance, false);
|
||||
|
||||
if (smallTunnels.Any(t => t.Any(node => Vector2.Distance(node, site) < siteInterval)))
|
||||
{
|
||||
if (x < borders.Width - siteInterval) sites.Add(new Vector2(x, y) + Vector2.UnitX * siteInterval * 0.2f);
|
||||
if (y < borders.Height - siteInterval) sites.Add(new Vector2(x, y) + Vector2.UnitY * siteInterval * 0.2f);
|
||||
if (x < borders.Width - siteInterval && y < borders.Height - siteInterval) sites.Add(new Vector2(x, y) + Vector2.One * siteInterval * 0.2f);
|
||||
}
|
||||
|
||||
if (mirror) site.X = borders.Width - site.X;
|
||||
|
||||
sites.Add(site);
|
||||
@@ -205,68 +277,63 @@ namespace Barotrauma
|
||||
Debug.WriteLine("find cells: " + sw2.ElapsedMilliseconds + " ms");
|
||||
sw2.Restart();
|
||||
|
||||
float minWidth = Submarine.Loaded == null ? 3000.0f : Math.Max(Submarine.Borders.Width, Submarine.Borders.Height);
|
||||
|
||||
//generate a path from the left edge of the map to right edge
|
||||
Rectangle pathBorders = new Rectangle(
|
||||
borders.X + (int)minWidth * 2, borders.Y + (int)minWidth * 2,
|
||||
borders.Right - (int)minWidth * 4, borders.Y + borders.Height - (int)minWidth * 4);
|
||||
|
||||
List<Vector2> pathNodes = new List<Vector2>();
|
||||
|
||||
startPosition = new Vector2((int)minWidth * 2, Rand.Range((int)minWidth * 2, borders.Height - (int)minWidth * 2, false));
|
||||
endPosition = new Vector2(borders.Width - (int)minWidth * 2, Rand.Range((int)minWidth * 2, borders.Height - (int)minWidth * 2, false));
|
||||
|
||||
pathNodes.Add(new Vector2(startPosition.X, borders.Height));
|
||||
pathNodes.Add(startPosition);
|
||||
pathNodes.Add(endPosition);
|
||||
pathNodes.Add(new Vector2(endPosition.X, borders.Height));
|
||||
|
||||
if (mirror)
|
||||
{
|
||||
pathNodes.Reverse();
|
||||
}
|
||||
//if (mirror)
|
||||
//{
|
||||
// pathNodes.Reverse();
|
||||
//}
|
||||
|
||||
List<VoronoiCell> pathCells = GeneratePath(pathNodes, cells, pathBorders, minWidth, 0.3f, mirror, true);
|
||||
|
||||
//place some enemy spawnpoints at random points in the path
|
||||
for (int i = 0; i <3 ; i++ )
|
||||
foreach (InterestingPosition positionOfInterest in positionsOfInterest)
|
||||
{
|
||||
Vector2 position = pathCells[Rand.Range((int)(pathCells.Count * 0.5f), pathCells.Count - 2, false)].Center;
|
||||
WayPoint wayPoint = new WayPoint(new Rectangle((int)position.X, (int)position.Y, 10, 10), null);
|
||||
WayPoint wayPoint = new WayPoint(positionOfInterest.Position, SpawnType.Enemy, null);
|
||||
wayPoint.MoveWithLevel = true;
|
||||
wayPoint.SpawnType = SpawnType.Enemy;
|
||||
}
|
||||
|
||||
startPosition = pathCells[0].Center;
|
||||
endPosition = pathCells[pathCells.Count - 1].Center;
|
||||
|
||||
//generate a couple of random paths
|
||||
for (int i = 0; i <= Rand.Range(1,4,false); i++)
|
||||
foreach (List<Vector2> tunnel in smallTunnels)
|
||||
{
|
||||
//pathBorders = new Rectangle(
|
||||
//borders.X + siteInterval * 2, borders.Y - siteInterval * 2,
|
||||
//borders.Right - siteInterval * 2, borders.Y + borders.Height - siteInterval * 2);
|
||||
if (tunnel.Count<2) continue;
|
||||
|
||||
Vector2 start = pathCells[Rand.Range(1, pathCells.Count - 2,false)].Center;
|
||||
var newPathCells = GeneratePath(tunnel, cells, pathBorders, 0.0f, 0.0f);
|
||||
|
||||
float x = pathBorders.X + Rand.Range(0, pathBorders.Right - pathBorders.X, false);
|
||||
float y = pathBorders.Y + Rand.Range(0,pathBorders.Bottom - pathBorders.Y, false);
|
||||
|
||||
if (mirror) x = borders.Width - x;
|
||||
|
||||
Vector2 end = new Vector2(x, y);
|
||||
|
||||
var newPathCells = GeneratePath(new List<Vector2> { start, end }, cells, pathBorders, 0.0f, 0.8f, mirror);
|
||||
|
||||
for (int n = 0; n < newPathCells.Count; n += 5)
|
||||
{
|
||||
positionsOfInterest.Add(newPathCells[n].Center);
|
||||
}
|
||||
//for (int n = 0; n < newPathCells.Count; n += 5)
|
||||
//{
|
||||
// positionsOfInterest.Add(newPathCells[n].Center);
|
||||
//}
|
||||
|
||||
pathCells.AddRange(newPathCells);
|
||||
}
|
||||
|
||||
////generate a couple of random paths
|
||||
//for (int i = 0; i <= Rand.Range(1,4,false); i++)
|
||||
//{
|
||||
// //pathBorders = new Rectangle(
|
||||
// //borders.X + siteInterval * 2, borders.Y - siteInterval * 2,
|
||||
// //borders.Right - siteInterval * 2, borders.Y + borders.Height - siteInterval * 2);
|
||||
|
||||
// Vector2 start = pathCells[Rand.Range(1, pathCells.Count - 2,false)].Center;
|
||||
|
||||
// float x = pathBorders.X + Rand.Range(0, pathBorders.Right - pathBorders.X, false);
|
||||
// float y = pathBorders.Y + Rand.Range(0,pathBorders.Bottom - pathBorders.Y, false);
|
||||
|
||||
// if (mirror) x = borders.Width - x;
|
||||
|
||||
// Vector2 end = new Vector2(x, y);
|
||||
|
||||
// var newPathCells = GeneratePath(new List<Vector2> { start, end }, cells, pathBorders, 0.0f, 0.8f, mirror);
|
||||
|
||||
// for (int n = 0; n < newPathCells.Count; n += 5)
|
||||
// {
|
||||
// positionsOfInterest.Add(newPathCells[n].Center);
|
||||
// }
|
||||
|
||||
// pathCells.AddRange(newPathCells);
|
||||
//}
|
||||
|
||||
Debug.WriteLine("path: " + sw2.ElapsedMilliseconds + " ms");
|
||||
sw2.Restart();
|
||||
|
||||
@@ -282,9 +349,9 @@ namespace Barotrauma
|
||||
|
||||
cells = CleanCells(pathCells);
|
||||
|
||||
pathCells.AddRange(CreateBottomHoles(0.8f, new Rectangle(
|
||||
pathCells.AddRange(CreateBottomHoles(Rand.Range(0.2f,0.8f, false), new Rectangle(
|
||||
(int)(borders.Width * 0.2f), 0,
|
||||
(int)(borders.Width * 0.6f), (int)(borders.Height * 0.5f))));
|
||||
(int)(borders.Width * 0.6f), (int)(borders.Height * 0.3f))));
|
||||
|
||||
foreach (VoronoiCell cell in pathCells)
|
||||
{
|
||||
@@ -345,7 +412,11 @@ namespace Barotrauma
|
||||
ShaftBodies[i] = BodyFactory.CreateRectangle(GameMain.World, 100.0f, 10.0f, 5.0f);
|
||||
ShaftBodies[i].BodyType = BodyType.Static;
|
||||
ShaftBodies[i].CollisionCategories = Physics.CollisionLevel;
|
||||
ShaftBodies[i].SetTransform(ConvertUnits.ToSimUnits((i == 0) ? startPosition : endPosition), 0.0f);
|
||||
|
||||
Vector2 shaftPos = (i == 0) ? startPosition : endPosition;
|
||||
shaftPos.Y = borders.Height;
|
||||
|
||||
ShaftBodies[i].SetTransform(ConvertUnits.ToSimUnits(shaftPos), 0.0f);
|
||||
bodies.Add(ShaftBodies[i]);
|
||||
}
|
||||
|
||||
@@ -403,7 +474,9 @@ namespace Barotrauma
|
||||
VoronoiCell currentCell = targetCells[0];
|
||||
pathCells.Add(currentCell);
|
||||
|
||||
int currentTargetIndex = 1;
|
||||
int currentTargetIndex = 1;
|
||||
|
||||
wanderAmount = 0.0f;
|
||||
|
||||
do
|
||||
{
|
||||
@@ -416,7 +489,7 @@ namespace Barotrauma
|
||||
|
||||
allowedEdges.Add(edge);
|
||||
}
|
||||
|
||||
|
||||
//steer towards target
|
||||
if (Rand.Range(0.0f, 1.0f, false) > wanderAmount || allowedEdges.Count == 0)
|
||||
{
|
||||
@@ -544,22 +617,31 @@ namespace Barotrauma
|
||||
minDistance *= 0.5f;
|
||||
do
|
||||
{
|
||||
for (int x = -1; x <= 1; x++)
|
||||
{
|
||||
for (int y = -1; y <= 1; y++)
|
||||
{
|
||||
if (x == 0 && y == 0) continue;
|
||||
Vector2 cornerPos = position + new Vector2(x * minDistance, y * minDistance);
|
||||
var closeCells = GetCells(position, 2);
|
||||
|
||||
int cellIndex = FindCellIndex(cornerPos);
|
||||
if (cellIndex == -1) continue;
|
||||
if (!tooCloseCells.Contains(cells[cellIndex]))
|
||||
{
|
||||
tooCloseCells.Add(cells[cellIndex]);
|
||||
}
|
||||
}
|
||||
foreach (VoronoiCell cell in closeCells)
|
||||
{
|
||||
if (!cell.edges.Any(e => Vector2.Distance(position, e.point1) < minDistance || Vector2.Distance(position, e.point2) < minDistance)) continue;
|
||||
|
||||
if (!tooCloseCells.Contains(cell)) tooCloseCells.Add(cell);
|
||||
}
|
||||
|
||||
//for (int x = -1; x <= 1; x++)
|
||||
//{
|
||||
// for (int y = -1; y <= 1; y++)
|
||||
// {
|
||||
// if (x == 0 && y == 0) continue;
|
||||
// Vector2 cornerPos = position + new Vector2(x * minDistance, y * minDistance);
|
||||
|
||||
// int cellIndex = FindCellIndex(cornerPos);
|
||||
// if (cellIndex == -1) continue;
|
||||
// if (!tooCloseCells.Contains(cells[cellIndex]))
|
||||
// {
|
||||
// tooCloseCells.Add(cells[cellIndex]);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
position += Vector2.Normalize(emptyCells[targetCellIndex].Center - position) * step;
|
||||
|
||||
if (Vector2.Distance(emptyCells[targetCellIndex].Center, position) < step * 2.0f) targetCellIndex++;
|
||||
@@ -771,6 +853,15 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
|
||||
if (!leftNormal.IsValid())
|
||||
{
|
||||
#if DEBUG
|
||||
DebugConsole.ThrowError("Invalid right normal");
|
||||
#endif
|
||||
leftNormal = Vector2.UnitX;
|
||||
}
|
||||
|
||||
|
||||
if (rightEdge == null)
|
||||
{
|
||||
rightNormal = GetEdgeNormal(edge, cell);
|
||||
@@ -782,6 +873,14 @@ namespace Barotrauma
|
||||
Vector2.Normalize(rightEdge.Center - edge.point2);
|
||||
}
|
||||
|
||||
if (!rightNormal.IsValid())
|
||||
{
|
||||
#if DEBUG
|
||||
DebugConsole.ThrowError("Invalid right normal");
|
||||
#endif
|
||||
rightNormal = Vector2.UnitX;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -856,6 +955,8 @@ namespace Barotrauma
|
||||
|
||||
public Vector2 GetRandomItemPos(float offsetFromWall = 10.0f)
|
||||
{
|
||||
if (!positionsOfInterest.Any()) return Size*0.5f;
|
||||
|
||||
Vector2 position = Vector2.Zero;
|
||||
|
||||
offsetFromWall = ConvertUnits.ToSimUnits(offsetFromWall);
|
||||
@@ -863,7 +964,7 @@ namespace Barotrauma
|
||||
int tries = 0;
|
||||
do
|
||||
{
|
||||
Vector2 startPos = ConvertUnits.ToSimUnits(PositionsOfInterest[Rand.Int(PositionsOfInterest.Count, false)]);
|
||||
Vector2 startPos = ConvertUnits.ToSimUnits(positionsOfInterest[Rand.Int(positionsOfInterest.Count, false)].Position);
|
||||
|
||||
Vector2 endPos = startPos - ConvertUnits.ToSimUnits(Vector2.UnitY * Size.Y);
|
||||
|
||||
@@ -888,6 +989,23 @@ namespace Barotrauma
|
||||
return position;
|
||||
}
|
||||
|
||||
public Vector2 GetRandomInterestingPosition(bool requireSpace, bool useSyncedRand)
|
||||
{
|
||||
if (!positionsOfInterest.Any()) return Size * 0.5f;
|
||||
|
||||
if (requireSpace)
|
||||
{
|
||||
var positionsWithSpace = positionsOfInterest.FindAll(p => p.IsLarge);
|
||||
if (!positionsWithSpace.Any()) return Size * 0.5f;
|
||||
|
||||
return positionsWithSpace[Rand.Int(positionsOfInterest.Count, !useSyncedRand)].Position;
|
||||
}
|
||||
else
|
||||
{
|
||||
return positionsOfInterest[Rand.Int(positionsOfInterest.Count, !useSyncedRand)].Position;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update (float deltaTime)
|
||||
{
|
||||
if (Submarine.Loaded!=null)
|
||||
@@ -902,6 +1020,14 @@ namespace Barotrauma
|
||||
{
|
||||
if (renderer == null) return;
|
||||
renderer.Draw(spriteBatch);
|
||||
|
||||
if (GameMain.DebugDraw)
|
||||
{
|
||||
foreach (InterestingPosition pos in positionsOfInterest)
|
||||
{
|
||||
GUI.DrawRectangle(spriteBatch, new Vector2(pos.Position.X-15.0f, -pos.Position.Y-15.0f), new Vector2(30.0f, 30.0f), Color.Gold, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawBack(SpriteBatch spriteBatch, Camera cam, BackgroundCreatureManager backgroundSpriteManager = null)
|
||||
@@ -934,10 +1060,14 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
if (wrappingWalls == null) return cells;
|
||||
|
||||
for (int side = 0; side < 2; side++)
|
||||
{
|
||||
for (int n = 0; n < 2; n++)
|
||||
{
|
||||
if (wrappingWalls[side, n] == null) continue;
|
||||
|
||||
if (Vector2.Distance(wrappingWalls[side, n].MidPos, pos) > WrappingWall.WallWidth) continue;
|
||||
|
||||
foreach (VoronoiCell cell in wrappingWalls[side, n].Cells)
|
||||
@@ -1015,6 +1145,7 @@ namespace Barotrauma
|
||||
|
||||
private void Unload()
|
||||
{
|
||||
|
||||
renderer.Dispose();
|
||||
renderer = null;
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace Barotrauma
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
Vector2 pos = new Vector2(0.0f, -level.StartPosition.Y);// level.EndPosition;
|
||||
Vector2 pos = new Vector2(0.0f, -level.Size.Y);// level.EndPosition;
|
||||
|
||||
if (GameMain.GameScreen.Cam.WorldView.Y < -pos.Y - 512) return;
|
||||
|
||||
@@ -232,8 +232,8 @@ namespace Barotrauma
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
wallVertices.Dispose();
|
||||
bodyVertices.Dispose();
|
||||
if (wallVertices!=null) wallVertices.Dispose();
|
||||
if (bodyVertices != null) bodyVertices.Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -198,8 +198,8 @@ namespace Barotrauma
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
wallVertices.Dispose();
|
||||
bodyVertices.Dispose();
|
||||
if (wallVertices!=null) wallVertices.Dispose();
|
||||
if (bodyVertices!=null) bodyVertices.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ namespace Barotrauma
|
||||
Vector2 start = connection.Locations[0].MapPosition;
|
||||
Vector2 end = connection.Locations[1].MapPosition;
|
||||
int generations = (int)(Math.Sqrt(Vector2.Distance(start, end) / 10.0f));
|
||||
connection.CrackSegments = GenerateCrack(start, end, generations);
|
||||
connection.CrackSegments = MathUtils.GenerateJaggedLine(start, end, generations, 5.0f);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -200,39 +200,6 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private List<Vector2[]> GenerateCrack(Vector2 start, Vector2 end, int generations)
|
||||
{
|
||||
List<Vector2[]> segments = new List<Vector2[]>();
|
||||
|
||||
segments.Add(new Vector2[] {start, end});
|
||||
|
||||
float offsetAmount = 5.0f;
|
||||
|
||||
for (int n = 0; n < generations; n++)
|
||||
{
|
||||
for (int i = 0; i < segments.Count; i++)
|
||||
{
|
||||
Vector2 startSegment = segments[i][0];
|
||||
Vector2 endSegment = segments[i][1];
|
||||
|
||||
segments.RemoveAt(i);
|
||||
|
||||
Vector2 midPoint = (startSegment + endSegment) / 2.0f;
|
||||
|
||||
Vector2 normal = Vector2.Normalize(endSegment - startSegment);
|
||||
normal = new Vector2(-normal.Y, normal.X);
|
||||
midPoint += normal * Rand.Range(-offsetAmount, offsetAmount, false);
|
||||
|
||||
segments.Insert(i, new Vector2[] { startSegment, midPoint });
|
||||
segments.Insert(i+1, new Vector2[] { midPoint, endSegment });
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return segments;
|
||||
}
|
||||
|
||||
public void MoveToNextLocation()
|
||||
{
|
||||
currentLocation = selectedLocation;
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Barotrauma
|
||||
{
|
||||
file = ToolBox.GetAttributeString(element, "texture", "");
|
||||
}
|
||||
|
||||
|
||||
if (file == "")
|
||||
{
|
||||
DebugConsole.ThrowError("Sprite " + element + " doesn't have a texture specified!");
|
||||
|
||||
@@ -242,6 +242,37 @@ namespace Barotrauma
|
||||
|
||||
return triangles;
|
||||
}
|
||||
|
||||
public static List<Vector2[]> GenerateJaggedLine(Vector2 start, Vector2 end, int generations, float offsetAmount)
|
||||
{
|
||||
List<Vector2[]> segments = new List<Vector2[]>();
|
||||
|
||||
segments.Add(new Vector2[] { start, end });
|
||||
|
||||
for (int n = 0; n < generations; n++)
|
||||
{
|
||||
for (int i = 0; i < segments.Count; i++)
|
||||
{
|
||||
Vector2 startSegment = segments[i][0];
|
||||
Vector2 endSegment = segments[i][1];
|
||||
|
||||
segments.RemoveAt(i);
|
||||
|
||||
Vector2 midPoint = (startSegment + endSegment) / 2.0f;
|
||||
|
||||
Vector2 normal = Vector2.Normalize(endSegment - startSegment);
|
||||
normal = new Vector2(-normal.Y, normal.X);
|
||||
midPoint += normal * Rand.Range(-offsetAmount, offsetAmount, false);
|
||||
|
||||
segments.Insert(i, new Vector2[] { startSegment, midPoint });
|
||||
segments.Insert(i + 1, new Vector2[] { midPoint, endSegment });
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return segments;
|
||||
}
|
||||
}
|
||||
|
||||
class CompareCCW : IComparer<Vector2>
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
---------------------------------------------------------------------------------------------------------
|
||||
v0.3.1.1
|
||||
---------------------------------------------------------------------------------------------------------
|
||||
|
||||
- fixed a major bug that caused item/monster ID mismatches between the server and the clients, which
|
||||
accounted for many of the monster/inventory/item syncing issues
|
||||
- improved player position syncing
|
||||
|
||||
---------------------------------------------------------------------------------------------------------
|
||||
v0.3.1.0
|
||||
---------------------------------------------------------------------------------------------------------
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user