Crates, some new chemicals, statuseffects that are triggered on impact, explosions can trigger "OnFire" statuseffects, applying impulses to items (and not just characters) when the submarine hits something

This commit is contained in:
Regalis
2016-04-16 15:33:28 +03:00
parent c6df095a8b
commit 6876bdc481
18 changed files with 271 additions and 74 deletions
+9 -3
View File
@@ -515,7 +515,10 @@
<Content Include="Content\Items\itemlabel.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\Lockers\cabinets.png">
<Content Include="Content\Items\Containers\cabinets.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\Containers\crates.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\machines.png">
@@ -585,6 +588,7 @@
</Content>
<Content Include="Content\Items\Jobgear\misc.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<SubType>Designer</SubType>
</Content>
<Content Include="Content\Items\connector.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -600,6 +604,7 @@
</Content>
<Content Include="Content\Items\Engine\engine.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<SubType>Designer</SubType>
</Content>
<Content Include="Content\Items\Engine\pingCircle.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -611,10 +616,10 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<SubType>Designer</SubType>
</Content>
<Content Include="Content\Items\Lockers\locker.png">
<Content Include="Content\Items\Containers\locker.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\Lockers\lockers.xml">
<Content Include="Content\Items\Containers\containers.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Items\Electricity\lightsprite.png">
@@ -885,6 +890,7 @@
</Content>
<Content Include="Content\Missions.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<SubType>Designer</SubType>
</Content>
<Content Include="Content\UI\uiIcons.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

@@ -0,0 +1,89 @@
<Items>
<Item
name="Steel Cabinet"
linkable="true"
pickdistance ="150">
<Sprite texture ="locker.png" depth="0.85"/>
<ItemContainer capacity="20" canbeselected="true" hideitems="true">
<Containable name="smallitem"/>
</ItemContainer>
</Item>
<Item
name="Medicine Cabinet"
linkable="true"
pickdistance ="150">
<Sprite texture ="cabinets.png" depth="0.85" sourcerect="0,0,48,64"/>
<ItemContainer capacity="20" canbeselected="true" hideitems="true">
<Containable name="chem"/>
<Containable name="medical"/>
</ItemContainer>
</Item>
<Item
name="Toxic Cabinet"
linkable="true"
pickdistance ="150">
<Sprite texture ="cabinets.png" depth="0.85" sourcerect="0,64,48,64"/>
<ItemContainer capacity="20" canbeselected="true" hideitems="true">
<Containable name="chem"/>
<Containable name="medical"/>
</ItemContainer>
</Item>
<Item
name="Metal Crate"
linkable="true"
pickdistance ="150">
<Sprite texture ="crates.png" depth="0.54" sourcerect="0,0,79,35"/>
<Body width="77" height="34" density="50"/>
<Holdable slots="RightHand+LeftHand" holdpos="0,-80" handle1="-30,14" handle2="30,14" aimable="false"/>
<ItemContainer capacity="20" canbeselected="true" hideitems="true">
<Containable name="smallitem"/>
</ItemContainer>
</Item>
<Item
name="Explosive Crate"
linkable="true"
pickdistance ="150">
<Sprite texture ="crates.png" depth="0.54" sourcerect="81,0,47,42"/>
<Body width="45" height="41" density="50"/>
<Holdable slots="RightHand+LeftHand" holdpos="0,-80" handle1="-20,14" handle2="20,14" aimable="false"/>
<ItemContainer capacity="10" canbeselected="true" hideitems="true">
<Containable name="smallitem"/>
</ItemContainer>
</Item>
<Item
name="Chemical Crate"
linkable="true"
pickdistance ="150">
<Sprite texture ="crates.png" depth="0.54" sourcerect="1,36,47,42"/>
<Body width="45" height="41" density="50"/>
<Holdable slots="RightHand+LeftHand" holdpos="0,-80" handle1="-20,14" handle2="20,14" aimable="false"/>
<ItemContainer capacity="10" canbeselected="true" hideitems="true">
<Containable name="smallitem"/>
</ItemContainer>
</Item>
</Items>
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

+16
View File
@@ -1,4 +1,20 @@
<Items>
<Item
name="Clown Mask"
category="Equipment"
pickdistance="150"
tags="smallitem"
description="Praise the honkmother.">
<Sprite texture ="clownmask.png" depth="0.6"/>
<Body radius="8" density="10"/>
<Wearable limbtype="Head" slots="Any,Head">
<sprite texture="clownmask.png" limb="Head" origin="0.5,0.5"/>
</Wearable>
</Item>
<Item
name="Clown Costume"
category="Equipment"
@@ -1,40 +0,0 @@
<Items>
<Item
name="Steel Cabinet"
linkable="true"
pickdistance ="150">
<Sprite texture ="locker.png" depth="0.85"/>
<ItemContainer capacity="20" canbeselected="true" hideitems="true">
<Containable name="smallitem"/>
</ItemContainer>
</Item>
<Item
name="Medicine Cabinet"
linkable="true"
pickdistance ="150">
<Sprite texture ="cabinets.png" depth="0.85" sourcerect="0,0,48,64"/>
<ItemContainer capacity="20" canbeselected="true" hideitems="true">
<Containable name="chem"/>
<Containable name="medical"/>
</ItemContainer>
</Item>
<Item
name="Toxic Cabinet"
linkable="true"
pickdistance ="150">
<Sprite texture ="cabinets.png" depth="0.85" sourcerect="0,64,48,64"/>
<ItemContainer capacity="20" canbeselected="true" hideitems="true">
<Containable name="chem"/>
<Containable name="medical"/>
</ItemContainer>
</Item>
</Items>
+20 -1
View File
@@ -290,6 +290,7 @@
<Body width="25" height="5" density="10"/>
<Holdable slots="Any,RightHand,LeftHand">
<StatusEffect type="OnFire" target="this" condition="-50"/>
<StatusEffect type="OnBroken" target="This" Condition="-100.0" sound="Content/Items/Reactor/explosion.ogg">
<Explosion range="500" damage="5" stun="3" force="0.1"/>
</StatusEffect>
@@ -349,7 +350,25 @@
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
</Holdable>
</Item>
</Item>
<Item
name="Morbusine"
category="Material"
spritecolor="0.0,0.0,0.0,1.0"
Tags="smallitem,chem,medical"
pickdistance="150">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
<Body width="25" height="5" density="10"/>
<Holdable slots="Any,RightHand,LeftHand">
<StatusEffect type="OnUse" target="Character" Health="-20.0" duration="60.0">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
</Holdable>
</Item>
</Items>
@@ -29,6 +29,26 @@
<Body width="16" height="7"/>
<Pickable slots="Any">
<StatusEffect type="OnFire" target="This" Condition="-50.0"/>
<StatusEffect type="OnBroken" target="This" Condition="-100.0" sound="Content/Items/Reactor/explosion.ogg">
<Explosion range="600.0" structuredamage="150" damage="300" stun="5" force="20.0"/>
</StatusEffect>
</Pickable>
</Item>
<Item
name="Volatile Compound N"
category="Equipment"
Tags="smallitem,explosive"
pickdistance="150">
<Sprite texture="weapons.png" depth="0.8" sourcerect="112,0,16,7"/>
<Body width="16" height="7"/>
<Pickable slots="Any">
<StatusEffect type="Always" target="This" Condition="-0.35"/>
<StatusEffect type="OnFire" target="This" Condition="-50.0"/>
<StatusEffect type="OnBroken" target="This" Condition="-100.0" sound="Content/Items/Reactor/explosion.ogg">
<Explosion range="600.0" structuredamage="150" damage="300" stun="5" force="20.0"/>
</StatusEffect>
@@ -47,6 +67,7 @@
<Body width="16" height="7"/>
<Pickable slots="Any">
<StatusEffect type="OnFire" target="This" Condition="-50.0"/>
<StatusEffect type="OnBroken" target="This" Condition="-100.0" sound="Content/Items/Reactor/explosion.ogg">
<Explosion range="500.0" structuredamage="50" damage="300" stun="5" force="20.0"/>
<Fire size="500"/>
@@ -81,4 +102,31 @@
</input>
</ConnectionPanel>
</Item>
<Item
name="Nitroglyserine"
category="Material"
description="A highly unstable liquid that may explode when subjected to heat or physical shock."
spritecolor="1.0,1.0,1.0,1.0"
Tags="smallitem,chem,medical"
pickdistance="150"
impacttolerance="10">
<Sprite texture ="Content/Items/Medical/med.png" sourcerect="24,16,8,16" depth="0.6"/>
<Body width="25" height="5" density="10"/>
<Holdable slots="Any,RightHand,LeftHand">
<StatusEffect type="OnImpact" target="This" Condition="0.0" setvalue="true"/>
<StatusEffect type="OnFire" target="This" Condition="-50.0"/>
<StatusEffect type="OnBroken" target="This" Condition="-100.0" sound="Content/Items/Reactor/explosion.ogg">
<Explosion range="600.0" structuredamage="400" damage="300" stun="5" force="20.0"/>
</StatusEffect>
<StatusEffect type="OnUse" target="Character" Health="-0.5" Oxygen="5.0" duration="10.0">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
</Holdable>
</Item>
</Items>
+1 -1
View File
@@ -172,7 +172,7 @@
category="Equipment"
pickdistance="200"
price="500"
tags="weapon"
tags="weapon,smallitem"
description="HONK">
<Sprite texture="Content/Items/Jobgear/clownshirt.png" sourcerect="32,50,32,14" depth="0.5"/>
@@ -4,6 +4,7 @@
<Item file="Content/Items/itemlabel.xml" />
<Item file="Content/Items/Artifacts/artifacts.xml" />
<Item file="Content/Items/Button/button.xml" />
<Item file="Content/Items/Containers/containers.xml" />
<Item file="Content/Items/Jobgear/captaingear.xml" />
<Item file="Content/Items/Jobgear/doctorgear.xml" />
<Item file="Content/Items/Jobgear/engigear.xml" />
@@ -19,7 +20,6 @@
<Item file="Content/Items/Fabricators/fabricators.xml" />
<Item file="Content/Items/Fabricators/materials.xml" />
<Item file="Content/Items/Ladder/ladder.xml" />
<Item file="Content/Items/Lockers/lockers.xml" />
<Item file="Content/Items/Medical/medical.xml" />
<Item file="Content/Items/MiniMap/item.xml" />
<Item file="Content/Items/OxygenGenerator/oxygengenerator.xml" />
@@ -179,9 +179,6 @@ namespace Barotrauma
public void DrawSprites(SpriteBatch spriteBatch, Camera cam)
{
Stopwatch sw = new Stopwatch();
sw.Start();
Rectangle indices = Rectangle.Empty;
indices.X = (int)Math.Floor(cam.WorldView.X / (float)GridSize) - 1;
if (indices.X >= sprites.GetLength(0)) return;
@@ -189,7 +186,6 @@ namespace Barotrauma
indices.Y = (int)Math.Floor((cam.WorldView.Y - cam.WorldView.Height) / (float)GridSize) - 1;
if (indices.Y >= sprites.GetLength(1)) return;
indices.Width = (int)Math.Ceiling(cam.WorldView.Right / (float)GridSize) + 1;
if (indices.Width < 0) return;
indices.Height = (int)Math.Ceiling(cam.WorldView.Y / (float)GridSize) + 1;
@@ -212,9 +208,6 @@ namespace Barotrauma
}
}
}
sw.Stop();
Debug.WriteLine(sw.ElapsedMilliseconds + " - "+sw.ElapsedTicks);
}
private BackgroundSpritePrefab GetRandomPrefab()
+10 -12
View File
@@ -219,17 +219,7 @@ namespace Barotrauma
}
protected void Apply(float deltaTime, Entity entity, List<IPropertyObject> targets)
{
if (explosion != null) explosion.Explode(entity.WorldPosition);
if (FireSize > 0.0f)
{
var fire = new FireSource(entity.WorldPosition);
fire.Size = new Vector2(FireSize, fire.Size.Y);
}
{
if (sound != null) sound.Play(1.0f, 1000.0f, entity.WorldPosition);
if (useItem)
@@ -259,8 +249,16 @@ namespace Barotrauma
ApplyToProperty(property, propertyEffects[i], deltaTime);
}
}
}
if (explosion != null) explosion.Explode(entity.WorldPosition);
if (FireSize > 0.0f)
{
var fire = new FireSource(entity.WorldPosition);
fire.Size = new Vector2(FireSize, fire.Size.Y);
}
}
private IEnumerable<object> ApplyToPropertyOverDuration(float duration, ObjectProperty property, object value)
+38 -1
View File
@@ -12,13 +12,18 @@ using Barotrauma.Items.Components;
using System.ComponentModel;
using System.Collections.ObjectModel;
using FarseerPhysics.Dynamics;
using FarseerPhysics.Dynamics.Contacts;
namespace Barotrauma
{
public enum ActionType
{
Always, OnPicked, OnWearing, OnContaining, OnContained, OnActive, OnUse, OnFailure, OnBroken, OnFire, InWater
Always, OnPicked, OnUse,
OnWearing, OnContaining, OnContained,
OnActive, OnFailure, OnBroken,
OnFire, InWater,
OnImpact
}
class Item : MapEntity, IDamageable, IPropertyObject
@@ -109,6 +114,11 @@ namespace Barotrauma
get { return prefab.Description; }
}
public float ImpactTolerance
{
get { return prefab.ImpactTolerance; }
}
public override Sprite Sprite
{
get { return prefab.sprite; }
@@ -383,6 +393,12 @@ namespace Barotrauma
}
}
//containers need to handle collision events to notify items inside them about the impact
if (ImpactTolerance > 0.0f || GetComponent<ItemContainer>() != null)
{
if (body != null) body.FarseerBody.OnCollision += OnCollision;
}
InsertToList();
ItemList.Add(this);
}
@@ -729,6 +745,27 @@ namespace Barotrauma
body.ApplyTorque(body.AngularVelocity * volume * -0.05f);
}
private bool OnCollision(Fixture f1, Fixture f2, Contact contact)
{
Vector2 normal = contact.Manifold.LocalNormal;
float impact = Vector2.Dot(f1.Body.LinearVelocity, -normal);
if (ImpactTolerance > 0.0f && impact > ImpactTolerance) ApplyStatusEffects(ActionType.OnImpact, 1.0f);
var containedItems = ContainedItems;
if (containedItems != null)
{
foreach (Item contained in containedItems)
{
if (contained.body == null) continue;
contained.OnCollision(f1, f2, contact);
}
}
return true;
}
public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true)
{
Color color = (isSelected && editing) ? color = Color.Red : spriteColor;
+12 -1
View File
@@ -45,6 +45,8 @@ namespace Barotrauma
public readonly bool FireProof;
private float impactTolerance;
public string ConfigFile
{
get { return configFile; }
@@ -87,6 +89,13 @@ namespace Barotrauma
get { return offsetOnSelected; }
}
public float ImpactTolerance
{
get { return impactTolerance; }
set { impactTolerance = Math.Max(value, 0.0f); }
}
public bool CanUseOnSelf
{
get;
@@ -213,7 +222,9 @@ namespace Barotrauma
CanUseOnSelf = ToolBox.GetAttributeBool(element, "canuseonself", false);
FireProof = ToolBox.GetAttributeBool(element, "fireproof", false);
FireProof = ToolBox.GetAttributeBool(element, "fireproof", false);
ImpactTolerance = ToolBox.GetAttributeFloat(element, "impacttolerance", 0.0f);
string categoriesStr = ToolBox.GetAttributeString(element, "category", "Misc");
+15 -2
View File
@@ -39,8 +39,6 @@ namespace Barotrauma
{
GameMain.ParticleManager.CreateParticle("shockwave", worldPosition,
Vector2.Zero, 0.0f, hull);
}
for (int i = 0; i < attack.Range * 0.1f; i++)
@@ -79,6 +77,21 @@ namespace Barotrauma
ApplyExplosionForces(worldPosition, attack.Range, force, attack.GetDamage(1.0f), attack.Stun);
if (flames)
{
foreach (Item item in Item.ItemList)
{
if (item.CurrentHull != hull || item.FireProof || item.Condition <= 0.0f) continue;
//if (item.ParentInventory != null) return;
if (Vector2.Distance(item.WorldPosition, worldPosition) > attack.Range * 0.1f) continue;
//item.Condition -= (float)Math.Sqrt(size.X) * deltaTime;
item.ApplyStatusEffects(ActionType.OnFire, 1.0f);
}
}
}
private IEnumerable<object> DimLight()
+1 -1
View File
@@ -250,7 +250,7 @@ namespace Barotrauma
foreach (Item item in Item.ItemList)
{
if (item.CurrentHull != hull || item.FireProof || item.Condition <= 0.0f) continue;
if (item.ParentInventory != null) return;
//if (item.ParentInventory != null) return;
float range = (float)Math.Sqrt(size.X) * 10.0f;
if (item.Position.X < position.X - range || item.Position.X > position.X + size.X + range) continue;
+11 -4
View File
@@ -492,10 +492,10 @@ namespace Barotrauma
SoundPlayer.PlayDamageSound(DamageSoundType.StructureBlunt, impact * 10.0f, ConvertUnits.ToDisplayUnits(lastContactPoint));
GameMain.GameScreen.Cam.Shake = impact * 2.0f;
Vector2 limbForce = direction * impact * 0.5f;
Vector2 impulse = direction * impact * 0.5f;
float length = limbForce.Length();
if (length > 5.0f) limbForce = (limbForce / length) * 5.0f;
float length = impulse.Length();
if (length > 5.0f) impulse = (impulse / length) * 5.0f;
foreach (Character c in Character.CharacterList)
{
@@ -506,10 +506,17 @@ namespace Barotrauma
foreach (Limb limb in c.AnimController.Limbs)
{
if (c.AnimController.LowestLimb == limb) continue;
limb.body.ApplyLinearImpulse(limb.Mass * limbForce);
limb.body.ApplyLinearImpulse(limb.Mass * impulse);
}
}
foreach (Item item in Item.ItemList)
{
if (item.Submarine != submarine || item.CurrentHull == null || item.body == null) continue;
item.body.ApplyLinearImpulse(item.body.Mass * impulse);
}
Explosion.RangedStructureDamage(ConvertUnits.ToDisplayUnits(lastContactPoint), impact * 50.0f, impact * DamageMultiplier);
}