Merge remote-tracking branch 'barotrauma/master' into new-netcode

# Conflicts:
#	Subsurface/Source/Characters/Character.cs
#	Subsurface/Source/Items/Components/Machines/Steering.cs
#	Subsurface/Source/Map/Structure.cs
#	Subsurface/Source/Networking/GameClient.cs
#	Subsurface/Source/Networking/GameServer.cs
This commit is contained in:
juanjp600
2016-11-05 18:09:44 -03:00
42 changed files with 431 additions and 177 deletions

View File

@@ -13,7 +13,7 @@
</limb>
<!-- lower yaw -->
<limb id = "1" radius="70" height="100" impacttolerance="50.0">
<limb id = "1" radius="70" height="100">
<sprite texture="Content/Characters/Charybdis/charybdis.png" sourcerect="416,0,192,256" depth="0.025" origin="0.65,0.5"/>
<attack range="300" duration="0.5" damage="5.00" bleedingdamage="50" structuredamage="500" damagetype="slash" torque="200" targetforce="-50"/>
</limb>

View File

@@ -10,12 +10,12 @@
<collider radius ="50"/>
<!-- head -->
<limb id = "0" radius="50" height="270" type="Head" steerforce="1.0" impacttolerance="50.0">
<limb id = "0" radius="50" height="270" type="Head" steerforce="1.0">
<sprite texture="Content/Characters/Coelanth/coelanth.png" sourcerect="267,171,162,392" depth="0.02" origin ="0.5,0.5"/>
</limb>
<!-- lower yaw -->
<limb id = "1" radius="20" height="240" impacttolerance="50.0">
<limb id = "1" radius="20" height="240">
<sprite texture="Content/Characters/Coelanth/coelanth.png" sourcerect="425,1,101,309" depth="0.025" origin="0.5,0.5"/>
<attack range="300" duration="0.5" damage="200" bleedingdamage="50" structuredamage="150" damagetype="slash" torque="100" targetforce="-50"/>
</limb>

View File

@@ -16,7 +16,7 @@
<collider width="45" radius="22"/>
<!-- head -->
<limb id = "0" radius="22" height="45" type="Head" flip="true" steerforce="1.0" armorsector="0.0,180.0" armorvalue="30.0" impacttolerance="50.0">
<limb id = "0" radius="22" height="45" type="Head" flip="true" steerforce="1.0" armorsector="0.0,180.0" armorvalue="30.0">
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="0,0,51,121" depth="0.02" origin="0.45,0.63"/>
</limb>
@@ -30,7 +30,7 @@
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="6,141,60,95" depth="0.022" origin="0.37,0.43"/>
</limb>
<limb id = "3" width="13" height="45" ignorecollisions="true" flip="true" impacttolerance="50.0">
<limb id = "3" width="13" height="45" ignorecollisions="true" flip="true">
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="65,131,36,50" depth="0.15" origin="0.4,0.5"/>
<attack range="120" duration="0.5" damage="30" stun="0.1" bleedingdamage="3" structuredamage="50" damagetype="slash" force="20" torque="-20" targetforce="-30"/>
</limb>
@@ -38,7 +38,7 @@
<limb id = "4" width="11" height="34" type="RightLeg" flip="true">
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="82,83,11,34" depth="0.03" origin="0.5,0.5"/>
</limb>
<limb id = "5" width="5" height="40" type="RightFoot" flip="true" pullpos="0.0,15.0" refjoint="3" stepoffset="20.0,0.0" impacttolerance="50.0">
<limb id = "5" width="5" height="40" type="RightFoot" flip="true" pullpos="0.0,15.0" refjoint="3" stepoffset="20.0,0.0">
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="59,78,19,43" depth="0.03" origin="0.5,0.5"/>
<sound file ="Content/Sounds/stepMetal.ogg"/>
</limb>
@@ -46,7 +46,7 @@
<limb id = "6" width="13" height="35" type="LeftLeg" flip="true">
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="82,83,11,34" depth="0.03" origin="0.5,0.5"/>
</limb>
<limb id = "7" width="5" height="40" type="LeftFoot" flip="true" pullpos="0.0,15.0" refjoint="5" stepoffset="20.0,0.0" impacttolerance="50.0">
<limb id = "7" width="5" height="40" type="LeftFoot" flip="true" pullpos="0.0,15.0" refjoint="5" stepoffset="20.0,0.0">
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="59,78,19,43" depth="0.03" origin="0.5,0.5"/>
<sound file ="Content/Sounds/stepMetal.ogg"/>
</limb>
@@ -54,7 +54,7 @@
<limb id = "8" width="13" height="35" type="RightLeg" flip="true">
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="82,83,11,34" depth="0.03" origin="0.5,0.5"/>
</limb>
<limb id = "9" width="5" height="40" type="RightFoot" flip="true" pullpos="0.0,15.0" refjoint="7" stepoffset="20.0,0.0" impacttolerance="50.0">
<limb id = "9" width="5" height="40" type="RightFoot" flip="true" pullpos="0.0,15.0" refjoint="7" stepoffset="20.0,0.0">
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="59,78,19,43" depth="0.03" origin="0.5,0.5"/>
<sound file ="Content/Sounds/stepMetal.ogg"/>
</limb>

View File

@@ -44,12 +44,12 @@
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="704,0,320,400" depth="0.07" origin="0.5,0.5"/>
</limb>
<limb id = "8" width="50" height="320" impacttolerance="100.0">
<limb id = "8" width="50" height="320">
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="755,552,137,470" depth="0.08" origin="0.5,0.5"/>
<attack range="800" duration="0.5" damage="30" stun="5.0" torque="-100" structuredamage="500" damagetype="slash"/>
</limb>
<limb id = "9" width="50" height="320" impacttolerance="100.0">
<limb id = "9" width="50" height="320">
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="892,552,137,470" depth="0.08" origin="0.6,0.5"/>
<attack range="800" duration="0.5" damage="30" stun="5.0" torque="100" structuredamage="500" damagetype="slash"/>
</limb>

View File

@@ -8,31 +8,31 @@
<collider radius="50"/>
<!-- head -->
<limb id = "0" radius="65" type="Head" steerforce="3.0" impacttolerance="100">
<limb id = "0" radius="65" type="Head" steerforce="3.0">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="0,0,129,128" depth="0.04"/>
<attack type="Hit" range="120" duration="0.2" damage="50" stun="2" force="10" damagetype="blunt" targetforce="80"/>
</limb>
<!-- body -->
<limb id = "1" radius="50" type="Torso" impacttolerance="100">
<limb id = "1" radius="50">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="0,125,108,105" depth="0.03" origin="0.5,0.5"/>
</limb>
<!-- body -->
<limb id = "2" radius="45" height="75" type="Torso" impacttolerance="100">
<limb id = "2" radius="45" height="75">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="0,239,90,136" depth="0.02" origin="0.5,0.5"/>
</limb>
<limb id = "3" width="30" height="175" type="Tail" impacttolerance="100">
<limb id = "3" width="30" height="175" type="Tail">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="131,0,36,175" depth="0.01" origin="0.5,0.5"/>
</limb>
<limb id = "4" width="30" height="239" impacttolerance="100.0">
<limb id = "4" width="30" height="239">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="183,0,53,238" depth="0.05" origin="0.5,0.5"/>
<attack range="150" duration="0.5" damage="30" stun="1.0" torque="-150" damagetype="slash"/>
</limb>
<limb id = "5" width="30" height="239" impacttolerance="100.0">
<limb id = "5" width="30" height="239">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="236,0,53,238" size="-1,1" depth="0.05" origin="0.5,0.5"/>
<attack range="150" duration="0.5" damage="30" stun="1.0" torque="150" damagetype="slash"/>
</limb>

View File

@@ -9,25 +9,25 @@
<collider radius="80" height="30"/>
<!-- head -->
<limb id = "0" radius="80" height="30" type="Head" steerforce="3.0" impacttolerance="100">
<limb id = "0" radius="80" height="30" type="Head" steerforce="3.0">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="299,0,171,208" depth="0.05"/>
<attack type="Hit" range="120" duration="0.2" damage="50" stun="2" force="10" damagetype="blunt" targetforce="100"/>
</limb>
<limb id = "1" width="30" height="178" impacttolerance="100.0">
<limb id = "1" width="30" height="178">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="183,60,53,178" depth="0.08" origin="0.5,0.5"/>
</limb>
<limb id = "2" width="30" height="175" impacttolerance="100">
<limb id = "2" width="30" height="175">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="131,0,36,175" depth="0.1" origin="0.5,0.5"/>
<attack range="150" duration="0.5" damage="30" stun="1.0" torque="150" damagetype="slash"/>
</limb>
<limb id = "3" width="30" height="178" impacttolerance="100.0">
<limb id = "3" width="30" height="178">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="236,60,53,178" size="-1,1" depth="0.08" origin="0.5,0.5"/>
</limb>
<limb id = "4" width="30" height="175" impacttolerance="100">
<limb id = "4" width="30" height="175">
<sprite texture="Content/Characters/Fractalguardian/fractalguardian.png" sourcerect="131,0,36,175" depth="0.1" origin="0.5,0.5"/>
<attack range="150" duration="0.5" damage="30" stun="1.0" torque="-150" damagetype="slash"/>
</limb>

View File

@@ -10,21 +10,22 @@
legtorque="15.0"
thightorque="-5.0"
walkspeed="1.5"
swimspeed="2.0">
swimspeed="2.0"
impacttolerance="7.5">
<collider height="100" radius="15"/>
<!-- head -->
<limb id = "0" radius="13" mass = "6" type="Head" attackpriority="2" impacttolerance="5.0">
<limb id = "0" radius="13" mass = "6" type="Head" attackpriority="2">
<sprite texture="Content/Characters/Human/[GENDER]head[HEADID].png" sourcerect="1,1,37,38" depth="0.04" origin="0.5,0.5"/>
<damagedsprite texture="Content/Characters/Human/damagedhead.png" sourcerect="1,1,37,38" origin="0.5,0.5"/>
</limb>
<!-- body -->
<limb id = "1" radius="14" height="21" mass = "20" type="Torso" attackpriority="3" impacttolerance="10.0">
<limb id = "1" radius="14" height="21" mass = "20" type="Torso" attackpriority="3">
<sprite texture="Content/Characters/Human/[GENDER]torso.png" sourcerect="0,0,29,58" depth="0.05" origin="0.5,0.6"/>
<damagedsprite texture="Content/Characters/Human/damagedtorso.png" sourcerect="0,0,29,58" origin="0.5,0.6"/>
</limb>
<limb id = "12" radius="13" mass = "20" type="Waist" impacttolerance="10.0">
<limb id = "12" radius="13" mass = "20" type="Waist">
<sprite texture="Content/Characters/Human/[GENDER]legs.png" sourcerect="0,0,32,29" depth="0.045" origin="0.5,0.5"/>
<damagedsprite texture="Content/Characters/Human/damagedlegs.png" sourcerect="0,0,32,29" origin="0.5,0.5"/>
</limb>

View File

@@ -13,16 +13,16 @@
swimspeed="2.0">
<!-- head -->
<limb id = "0" radius="13" mass = "6" type="Head" attackpriority="2" impacttolerance="5.0">
<limb id = "0" radius="13" mass = "6" type="Head" attackpriority="2">
<sprite texture="Content/Characters/Human/[GENDER]head[HEADID].png" sourcerect="1,1,37,38" depth="0.04" origin="0.5,0.5"/>
<damagedsprite texture="Content/Characters/Human/damagedhead.png" sourcerect="1,1,37,38" origin="0.5,0.5"/>
</limb>
<!-- body -->
<limb id = "1" radius="14" height="21" mass = "20" type="Torso" attackpriority="3" impacttolerance="10.0">
<limb id = "1" radius="14" height="21" mass = "20" type="Torso" attackpriority="3">
<sprite texture="Content/Characters/Human/[GENDER]torso.png" sourcerect="0,0,29,58" depth="0.05" origin="0.5,0.6"/>
<damagedsprite texture="Content/Characters/Human/damagedtorso.png" sourcerect="0,0,29,58" origin="0.5,0.6"/>
</limb>
<limb id = "12" radius="13" mass = "20" type="Waist" impacttolerance="10.0">
<limb id = "12" radius="13" mass = "20" type="Waist">
<sprite texture="Content/Characters/Human/[GENDER]legs.png" sourcerect="0,0,32,29" depth="0.045" origin="0.5,0.5"/>
<damagedsprite texture="Content/Characters/Human/damagedlegs.png" sourcerect="0,0,32,29" origin="0.5,0.5"/>
</limb>
@@ -78,7 +78,7 @@
</limb>
<limb id = "13" width="10" height="30" mass = "6" attackpriority="2" flip="true" impacttolerance="5.0" pullpos="0.0,25.0">
<limb id = "13" width="10" height="30" mass = "6" attackpriority="2" flip="true" pullpos="0.0,25.0">
<sprite texture="Content/Characters/Husk/DivingSuit.png" sourcerect="110,76,18,52" depth="0.5" origin="0.5,0.5"/>
<attack range="70" duration="0.1" bleedingdamage="3" damage="10" stun="0.5" torque="-50" damagetype="slash" targetforce="10">
<StatusEffect type="OnUse" target="Character" HuskInfectionState="0.01" disabledeltatime="true"/>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<huskappendage>
<!-- spike/tentacle thingy -->
<limb id = "13" width="10" height="30" mass = "6" attackpriority="2" flip="true" impacttolerance="5.0" pullpos="0.0,25.0">
<limb id = "13" width="10" height="30" mass = "6" attackpriority="2" flip="true" pullpos="0.0,25.0">
<sprite texture="Content/Characters/Husk/DivingSuit.png" sourcerect="110,76,18,52" depth="0.5" origin="0.5,0.5"/>
<attack range="70" duration="0.1" bleedingdamage="0.5" damage="10" stun="0.5" torque="-50" damagetype="slash" targetforce="10">
<StatusEffect type="OnUse" target="Character" HuskInfectionState="0.01"/>

View File

@@ -17,13 +17,13 @@
<collider height="100" radius="15"/>
<!-- head -->
<limb id = "0" radius="13" mass = "6" type="Head" attackpriority="2" impacttolerance="5.0">
<limb id = "0" radius="13" mass = "6" type="Head" attackpriority="2">
<sprite texture="Content/Characters/Husk/DivingSuit.png" sourcerect="95,0,33,25" depth="0.04" origin="0.5,0.5"/>
</limb>
<!-- spike/tentacle thingy -->
<limb id = "13" width="10" height="30" mass = "6" attackpriority="2" impacttolerance="5.0" flip="true" pullpos="0.0,25.0">
<limb id = "13" width="10" height="30" mass = "6" attackpriority="2" flip="true" pullpos="0.0,25.0">
<sprite texture="Content/Characters/Husk/DivingSuit.png" sourcerect="110,76,18,52" depth="0.05" origin="0.5,0.5"/>
<attack range="70" duration="0.2" bleedingdamage="0.5" damage="10" stun="0.5" torque="-50" damagetype="slash" targetforce="10">
<StatusEffect type="OnUse" target="Character" HuskInfectionState="0.01" disabledeltatime="true"/>
@@ -32,10 +32,10 @@
</limb>
<!-- body -->
<limb id = "1" radius="14" height="21" mass = "20" type="Torso" attackpriority="3" impacttolerance="10.0">
<limb id = "1" radius="14" height="21" mass = "20" type="Torso" attackpriority="3">
<sprite texture="Content/Characters/Husk/DivingSuit.png" limb="Torso" sourcerect="41,1,42,96" origin="0.5,0.55"/>
</limb>
<limb id = "12" radius="13" mass = "20" type="Waist" impacttolerance="10.0">
<limb id = "12" radius="13" mass = "20" type="Waist">
<sprite texture="Content/Characters/Husk/DivingSuit.png" sourcerect="0,0,1,1" depth="0.045" origin="0.5,0.5"/>
</limb>

View File

@@ -11,7 +11,7 @@
<collider radius ="230"/>
<!-- head -->
<limb id = "0" radius="230" height="500" type="Head" steerforce="1.0" flip="true" armorsector="0.0,180.0" armorvalue="100.0" impacttolerance="100">
<limb id = "0" radius="230" height="500" type="Head" steerforce="1.0" flip="true" armorsector="0.0,180.0" armorvalue="100.0">
<sprite texture="Content/Characters/Moloch/moloch.png" sourcerect="0,0,628,1024" depth="0.02" origin ="0.4,0.5"/>
<attack range="700" duration="0.05" damage="200" stun="5" force="20" damagetype="blunt" targetforce="100"/>
</limb>

View File

@@ -10,13 +10,13 @@
<collider radius="50" height="320"/>
<!-- head -->
<limb id = "0" radius="12" height="100" type="Head" steerforce="1.0" impacttolerance="50.0">
<limb id = "0" radius="12" height="100" type="Head" steerforce="1.0">
<sprite texture="Content/Characters/TigerThresher/tigerthresher.png" sourcerect="371,15,66,136" depth="0.02" origin ="0.5,0.5"/>
<damagedsprite texture="Content/Characters/TigerThresher/damagedtigerthresher.png" sourcerect="371,15,66,136" origin ="0.5,0.5"/>
</limb>
<!-- lower yaw -->
<limb id = "1" width="16" height="103" impacttolerance="50.0">
<limb id = "1" width="16" height="103">
<sprite texture="Content/Characters/TigerThresher/tigerthresher.png" sourcerect="391,169,28,110" depth="0.025" origin="0.5,0.5"/>
<damagedsprite texture="Content/Characters/TigerThresher/damagedtigerthresher.png" sourcerect="391,169,28,110" origin="0.5,0.5"/>
<attack range="200" duration="0.5" damage="150" bleedingdamage="10" structuredamage="200" damagetype="slash" torque="80" targetforce="-50"/>

View File

@@ -118,7 +118,7 @@
<Item name="Fulgurium Bar"/>
</Deconstruct>
<Sprite texture ="alientools.png" depth="0.5" sourcerect="0,0,95,50" origin="0.5,0.4"/>
<Sprite texture ="alientools.png" depth="0.55" sourcerect="0,0,95,50" origin="0.5,0.4"/>
<Body width="85" height="40" density="15"/>

View File

@@ -11,7 +11,7 @@
<Item name="Steel Bar"/>
</Deconstruct>
<Sprite texture ="Content/Items/Tools/tools.png" sourcerect="39,31,12,33" depth="0.5"/>
<Sprite texture ="Content/Items/Tools/tools.png" sourcerect="39,31,12,33" depth="0.55"/>
<Body width="12" height="33" density="5"/>
@@ -34,7 +34,7 @@
<Item name="Polycarbonate Bar"/>
</Deconstruct>
<Sprite texture ="DivingMask.png" depth="0.5"/>
<Sprite texture ="DivingMask.png" depth="0.55"/>
<Body radius="18" density="15"/>
@@ -123,7 +123,7 @@
<Item name="Polycarbonate Bar"/>
</Deconstruct>
<Sprite texture ="DivingSuit.png" depth="0.5" sourcerect="22,98,59,32" origin="0.6,0.66"/>
<Sprite texture ="DivingSuit.png" depth="0.55" sourcerect="22,98,59,32" origin="0.6,0.66"/>
<Body width="55" height="30" density="15"/>

View File

@@ -102,6 +102,10 @@
<fabricableitem name="Compound N" requireditems="Aluminium, Potassium, Sulphuric Acid" requiredtime="20">
<RequiredSkill name="Medical" level="60"/>
</fabricableitem>
<fabricableitem name="Volatile Compound N" requireditems="Compound N, Flash Powder" requiredtime="20">
<RequiredSkill name="Medical" level="40"/>
</fabricableitem>
<fabricableitem name="Corrigodone" requireditems="Stabilozine, Chloral Hydrate" requiredtime="20">
<RequiredSkill name="Medical" level="50"/>
@@ -134,7 +138,11 @@
<fabricableitem name="Calyxanide" requireditems="Velonaceps Calyx Eggs, Corrigodone" requiredtime="30">
<RequiredSkill name="Medical" level="60"/>
</fabricableitem>
</fabricableitem>
<fabricableitem name="Liquid Oxygenite" requireditems="Stabilozine, Oxygenite Shard" requiredtime="30">
<RequiredSkill name="Medical" level="60"/>
</fabricableitem>
</Fabricator>
<ConnectionPanel selectkey="Action" canbeselected = "true">

View File

@@ -437,7 +437,26 @@
</StatusEffect>
</Holdable>
</Item>
<Item
name="Liquid Oxygenite"
category="Material"
spritecolor="0.6,0.8,1.0,1.0"
Tags="smallitem,chem,medical"
pickdistance="150"
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"/>
<Holdable slots="Any,RightHand,LeftHand">
<StatusEffect type="OnUse" target="Character" Health="-0.1" Oxygen="10.0" duration="60">
<RequiredItem name="Medical Syringe" type="Container"/>
</StatusEffect>
</Holdable>
</Item>
</Items>

View File

@@ -8,7 +8,7 @@
price="100"
description="One of the most crucial tools on board the submarine. Also works underwater.">
<Sprite texture ="tools.png" sourcerect="0,17,41,17" depth="0.5"/>
<Sprite texture ="tools.png" sourcerect="0,17,41,17" depth="0.55"/>
<!-- the item takes 10 seconds to break down in a deconstructor and turns into a polycarbonate bar and a steel bar -->
<Deconstruct time="10">
@@ -70,7 +70,7 @@
<Item name="Aluminium"/>
</Deconstruct>
<Sprite texture ="tools.png" sourcerect="0,0,41,16" depth="0.5"/>
<Sprite texture ="tools.png" sourcerect="0,0,41,16" depth="0.55"/>
<Body width="41" height="16" density="40"/>
@@ -112,7 +112,7 @@
<Item name="Steel Bar"/>
</Deconstruct>
<Sprite texture ="tools.png" sourcerect="52,31,12,33" depth="0.5"/>
<Sprite texture ="tools.png" sourcerect="52,31,12,33" depth="0.55"/>
<Body width="12" height="33" density="5"/>
@@ -136,7 +136,7 @@
<Item name="Steel Bar"/>
</Deconstruct>
<Sprite texture ="extinguisher.png" depth="0.5" sourcerect="0,0,34,64" origin="0.4,0.5"/>
<Sprite texture ="extinguisher.png" depth="0.55" sourcerect="0,0,34,64" origin="0.4,0.5"/>
<Body radius="10" height="45" density="5"/>
@@ -159,7 +159,7 @@
pickdistance="200"
price="10">
<Sprite texture ="tools.png" sourcerect="0,58,31,6" depth="0.5"/>
<Sprite texture ="tools.png" sourcerect="0,58,31,6" depth="0.55"/>
<Body width="31" height="6" density="50"/>
@@ -174,7 +174,7 @@
pickdistance="200"
price="10">
<Sprite texture ="tools.png" sourcerect="0,50,26,7" depth="0.5"/>
<Sprite texture ="tools.png" sourcerect="0,50,26,7" depth="0.55"/>
<Body width="30" height="7" density="50"/>
@@ -191,7 +191,7 @@
pickdistance="200"
price="10">
<Sprite texture ="tools.png" sourcerect="42,0,22,9" depth="0.5"/>
<Sprite texture ="tools.png" sourcerect="42,0,22,9" depth="0.55"/>
<Body width="31" height="6" density="40"/>
@@ -225,7 +225,7 @@
<Item name="Polycarbonate Bar"/>
</Deconstruct>
<Sprite texture ="tools.png" sourcerect="0,36,27,11" depth="0.5"/>
<Sprite texture ="tools.png" sourcerect="0,36,27,11" depth="0.55"/>
<Body width="27" height="10" density="15"/>
@@ -259,7 +259,7 @@
</Deconstruct>
<Sprite texture ="tools.png" sourcerect="0,38,21,7" depth="0.5"/>
<Sprite texture ="tools.png" sourcerect="0,38,21,7" depth="0.55"/>
<Body width="21" height="7" density="12"/>

View File

@@ -74,7 +74,7 @@
<Item name="Uranium Bar"/>
</Deconstruct>
<Sprite texture="railgunetc.png" sourcerect="187,210,68,47" depth="0.5"/>
<Sprite texture="railgunetc.png" sourcerect="187,210,68,47" depth="0.55"/>
<Body width="68" height="47" density="30"/>

View File

@@ -35,7 +35,7 @@
<Item name="Polycarbonate Bar"/>
</Deconstruct>
<Sprite texture="weapons.png" sourcerect="0,25,98,25" depth="0.5"/>
<Sprite texture="weapons.png" sourcerect="0,25,98,25" depth="0.55"/>
<Body width="90" height="30" density="50"/>
@@ -61,7 +61,7 @@
price="200"
tags="smallitem,weapon">
<Sprite texture="weapons.png" sourcerect="98,0,11,24" depth="0.5"/>
<Sprite texture="weapons.png" sourcerect="98,0,11,24" depth="0.55"/>
<Body width="11" height="24" density="30"/>
@@ -78,7 +78,7 @@
pickdistance="200"
tags="smallitem,weapon">
<Sprite texture="weapons.png" sourcerect="98,0,11,24" depth="0.5"/>
<Sprite texture="weapons.png" sourcerect="98,0,11,24" depth="0.55"/>
<Body width="11" height="24" density="30"/>
@@ -103,7 +103,7 @@
<Item name="Polycarbonate Bar"/>
</Deconstruct>
<Sprite texture="weapons.png" sourcerect="21,0,77,22" depth="0.5"/>
<Sprite texture="weapons.png" sourcerect="21,0,77,22" depth="0.55"/>
<Body width="90" height="30" density="30"/>
@@ -174,7 +174,7 @@
tags="weapon,smallitem"
description="HONK">
<Sprite texture="Content/Items/Jobgear/clownshirt.png" sourcerect="32,50,32,14" depth="0.5"/>
<Sprite texture="Content/Items/Jobgear/clownshirt.png" sourcerect="32,50,32,14" depth="0.55"/>
<Body width="30" height="10" density="10"/>

View File

@@ -185,6 +185,11 @@ namespace Barotrauma
new Vector2(pathSteering.CurrentPath.Nodes[i].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i].DrawPosition.Y),
new Vector2(pathSteering.CurrentPath.Nodes[i - 1].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i - 1].DrawPosition.Y),
Color.LightGreen);
spriteBatch.DrawString(GUI.SmallFont,
pathSteering.CurrentPath.Nodes[i].ID.ToString(),
new Vector2(pathSteering.CurrentPath.Nodes[i].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i].DrawPosition.Y - 10),
Color.LightGreen);
}
}
}

View File

@@ -97,7 +97,7 @@ namespace Barotrauma
diff.Y = 0.0f;
}
if (diff == Vector2.Zero) return -host.Steering;
if (diff.Length() < 0.01) return -host.Steering;
return Vector2.Normalize(diff) * speed;
}
@@ -258,6 +258,12 @@ namespace Barotrauma
if (closestButton != null)
{
if (!closestButton.HasRequiredItems(character, false) && shouldBeOpen)
{
currentPath.Unreachable = true;
return;
}
closestButton.Item.Pick(character, false, true);
break;
}

View File

@@ -172,7 +172,12 @@ namespace Barotrauma
start, node.Waypoint.SimPosition, null,
Physics.CollisionWall | Physics.CollisionLevel | Physics.CollisionStairs | Physics.CollisionPlatform);
if (body != null && body.UserData is Structure && !((Structure)body.UserData).IsPlatform) continue;
if (body != null)
{
if (body.UserData is Structure && !((Structure)body.UserData).IsPlatform) continue;
if (body.UserData is Item && body.FixtureList[0].CollisionCategories.HasFlag(Physics.CollisionWall)) continue;
}
}
closestDist = dist;

View File

@@ -13,10 +13,7 @@ namespace Barotrauma
protected Character character;
protected float walkSpeed, swimSpeed;
//how large impacts the Character can take before being stunned
//protected float impactTolerance;
protected float stunTimer;
protected float walkPos;
@@ -47,14 +44,7 @@ namespace Barotrauma
walkSpeed = ToolBox.GetAttributeFloat(element, "walkspeed", 1.0f);
swimSpeed = ToolBox.GetAttributeFloat(element, "swimspeed", 1.0f);
//stepOffset = ToolBox.GetAttributeVector2(element, "stepoffset", Vector2.One);
//stepOffset = ConvertUnits.ToSimUnits(stepOffset);
//impactTolerance = ToolBox.GetAttributeFloat(element, "impacttolerance", 10.0f);
legTorque = ToolBox.GetAttributeFloat(element, "legtorque", 0.0f);
}
public virtual void UpdateAnim(float deltaTime) { }

View File

@@ -224,6 +224,12 @@ namespace Barotrauma
}
}
public float ImpactTolerance
{
get;
private set;
}
public float StrongestImpact
{
get { return strongestImpact; }
@@ -257,6 +263,8 @@ namespace Barotrauma
torsoPosition = ConvertUnits.ToSimUnits(torsoPosition);
torsoAngle = MathHelper.ToRadians(ToolBox.GetAttributeFloat(element, "torsoangle", 0.0f));
ImpactTolerance = ToolBox.GetAttributeFloat(element, "impacttolerance", 50.0f);
CanEnterSubmarine = ToolBox.GetAttributeBool(element, "canentersubmarine", true);
foreach (XElement subElement in element.Elements())
@@ -471,11 +479,11 @@ namespace Barotrauma
{
if (!character.IsRemotePlayer || GameMain.Server != null)
{
if (impact > 8.0f)
if (impact > ImpactTolerance)
{
character.AddDamage(CauseOfDeath.Damage, impact - 8.0f, null);
character.AddDamage(CauseOfDeath.Damage, impact - ImpactTolerance, null);
SoundPlayer.PlayDamageSound(DamageSoundType.LimbBlunt, strongestImpact, collider);
strongestImpact = Math.Max(strongestImpact, impact - 8.0f);
strongestImpact = Math.Max(strongestImpact, impact - ImpactTolerance);
}
}
@@ -852,7 +860,6 @@ namespace Barotrauma
//limb.body.ApplyLinearImpulse(impulse);
int n = (int)((limb.Position.X - limbHull.Rect.X) / Hull.WaveWidth);
limbHull.WaveVel[n] = Math.Min(impulse.Y * 1.0f, 5.0f);
StrongestImpact = ((impulse.Length() * 0.5f) - limb.impactTolerance);
}
}
}

View File

@@ -212,9 +212,7 @@ namespace Barotrauma
body.CollisionCategories = Physics.CollisionCharacter;
body.CollidesWith = Physics.CollisionAll & ~Physics.CollisionCharacter & ~Physics.CollisionItem;
}
impactTolerance = ToolBox.GetAttributeFloat(element, "impacttolerance", 10.0f);
body.UserData = this;
refJointIndex = -1;

View File

@@ -43,7 +43,7 @@ namespace Barotrauma
return successMessage
.Replace("[loser]", teamNames[1 - winner])
.Replace("[winner]", teamNames[winner]);
.Replace("[winner]", teamNames[winner]);
}
}
@@ -57,11 +57,11 @@ namespace Barotrauma
ToolBox.GetAttributeString(element, "description2", "")
};
for (int i = 0; i < descriptions.Length; i++ )
for (int i = 0; i < descriptions.Length; i++)
{
for (int n = 0; n < 2;n++ )
for (int n = 0; n < 2; n++)
{
descriptions[i] = descriptions[i].Replace("[location" + (n + 1) + "]", Locations[n]);
descriptions[i] = descriptions[i].Replace("[location" + (n + 1) + "]", locations[n].Name);
}
}
@@ -69,7 +69,7 @@ namespace Barotrauma
{
ToolBox.GetAttributeString(element, "teamname1", "Team A"),
ToolBox.GetAttributeString(element, "teamname2", "Team B")
};
};
}
public static string GetTeamName(int teamID)
@@ -136,10 +136,7 @@ namespace Barotrauma
DebugConsole.ThrowError("Combat missions cannot be played in the single player mode.");
return;
}
Items.Components.Radar.StartMarker = Locations[0];
Items.Components.Radar.EndMarker = Locations[1];
subs = new Submarine[] { Submarine.MainSubs[0], Submarine.MainSubs[1] };
subs[1].SetPosition(Level.Loaded.EndPosition - new Vector2(0.0f, 2000.0f));
subs[1].FlipX();

View File

@@ -26,9 +26,7 @@ namespace Barotrauma
protected List<string> messages;
private int reward;
protected string[] Locations = new string[2];
public string Name
{
get { return name; }
@@ -47,6 +45,7 @@ namespace Barotrauma
public bool Completed
{
get { return completed; }
set { completed = value; }
}
public virtual string RadarLabel
@@ -111,11 +110,9 @@ namespace Barotrauma
headers.Add(ToolBox.GetAttributeString(subElement, "header", ""));
messages.Add(ToolBox.GetAttributeString(subElement, "text", ""));
}
for (int n = 0; n < 2; n++)
{
Locations[n] = locations[n].Name;
description = description.Replace("[location" + (n + 1) + "]", locations[n].Name);
successMessage = successMessage.Replace("[location" + (n + 1) + "]", locations[n].Name);
@@ -227,7 +224,12 @@ namespace Barotrauma
public virtual void Update(float deltaTime) { }
public virtual bool AssignTeamIDs(List<Networking.Client> clients,out int hostTeam) { clients.ForEach(client => { client.TeamID = 1; }); hostTeam = 1; return false; }
public virtual bool AssignTeamIDs(List<Networking.Client> clients, out int hostTeam)
{
clients.ForEach(c => c.TeamID = 1);
hostTeam = 1;
return false;
}
public void ShowMessage(int index)
{

View File

@@ -17,15 +17,9 @@ namespace Barotrauma
public MissionMode(GameModePreset preset, object param)
: base(preset, param)
{
Location[] locations = new Location[2];
Location[] locations = { GameMain.GameSession.StartLocation, GameMain.GameSession.EndLocation };
MTRandom rand = new MTRandom(ToolBox.StringToInt(GameMain.NetLobbyScreen.LevelSeed));
for (int i = 0; i < 2; i++)
{
locations[i] = Location.CreateRandom(new Vector2((float)rand.NextDouble() * 10000.0f, (float)rand.NextDouble() * 10000.0f));
}
mission = Mission.LoadRandom(locations, rand, param as string);
}

View File

@@ -197,13 +197,13 @@ namespace Barotrauma
}
else if (leavingSub.AtEndPosition)
{
endShiftButton.Text = "Enter " + Map.SelectedLocation.Name;
endShiftButton.Text = ToolBox.LimitString("Enter " + Map.SelectedLocation.Name, endShiftButton.Font, endShiftButton.Rect.Width - 5);
endShiftButton.UserData = leavingSub;
endShiftButton.Visible = true;
}
else if (leavingSub.AtStartPosition)
{
endShiftButton.Text = "Enter " + Map.CurrentLocation.Name;
endShiftButton.Text = ToolBox.LimitString("Enter " + Map.CurrentLocation.Name, endShiftButton.Font, endShiftButton.Rect.Width - 5);
endShiftButton.UserData = leavingSub;
endShiftButton.Visible = true;
}

View File

@@ -13,6 +13,9 @@ namespace Barotrauma
public readonly GameMode gameMode;
//two locations used as the start and end in the MP mode
private Location[] dummyLocations;
private InfoFrameTab selectedTab;
private GUIButton infoButton;
private GUIFrame infoFrame;
@@ -50,7 +53,37 @@ namespace Barotrauma
return (mode == null) ? null : mode.Map;
}
}
public Location StartLocation
{
get
{
if (Map != null) return Map.CurrentLocation;
if (dummyLocations==null)
{
CreateDummyLocations();
}
return dummyLocations[0];
}
}
public Location EndLocation
{
get
{
if (Map != null) return Map.SelectedLocation;
if (dummyLocations == null)
{
CreateDummyLocations();
}
return dummyLocations[1];
}
}
public Submarine Submarine
{
get { return submarine; }
@@ -81,12 +114,10 @@ namespace Barotrauma
this.saveFile = saveFile;
//guiRoot = new GUIFrame(new Rectangle(0,0,GameMain.GraphicsWidth,GameMain.GraphicsWidth), Color.Transparent);
infoButton = new GUIButton(new Rectangle(10, 10, 100, 20), "Info", GUI.Style, null);
infoButton.OnClicked = ToggleInfoFrame;
if (gameModePreset!=null) gameMode = gameModePreset.Instantiate(missionType);
if (gameModePreset != null) gameMode = gameModePreset.Instantiate(missionType);
this.submarine = submarine;
}
@@ -109,6 +140,17 @@ namespace Barotrauma
}
}
private void CreateDummyLocations()
{
dummyLocations = new Location[2];
MTRandom rand = new MTRandom(ToolBox.StringToInt(GameMain.NetLobbyScreen.LevelSeed));
for (int i = 0; i < 2; i++)
{
dummyLocations[i] = Location.CreateRandom(new Vector2((float)rand.NextDouble() * 10000.0f, (float)rand.NextDouble() * 10000.0f));
}
}
public void StartShift(string levelSeed, bool loadSecondSub = true)
{
Level level = Level.CreateRandom(levelSeed);
@@ -166,8 +208,6 @@ namespace Barotrauma
if (gameMode!=null) gameMode.Start();
Items.Components.Radar.StartMarker = "Start";
Items.Components.Radar.EndMarker = "End";
if (gameMode.Mission != null) Mission.Start(Level.Loaded);
TaskManager.StartShift(level);

View File

@@ -58,10 +58,9 @@ namespace Barotrauma
}
if (Submarine.MainSub != null) text = text.Replace("[sub]", Submarine.MainSub.Name);
if (GameMain.GameSession != null && GameMain.GameSession.Map != null)
if (GameMain.GameSession != null && GameMain.GameSession.StartLocation != null)
{
if (GameMain.GameSession.Map.CurrentLocation!=null)
text = text.Replace("[location]", GameMain.GameSession.Map.CurrentLocation.Name);
text = text.Replace("[location]", GameMain.GameSession.StartLocation.Name);
}
return text;

View File

@@ -15,8 +15,8 @@ namespace Barotrauma
{
this.gameSession = gameSession;
startLocation = gameSession.Map==null ? null : gameSession.Map.CurrentLocation;
endLocation = gameSession.Map==null ? null : gameSession.Map.SelectedLocation;
startLocation = gameSession.StartLocation;
endLocation = gameSession.EndLocation;
selectedMission = gameSession.Mission;
}

View File

@@ -22,7 +22,7 @@ namespace Barotrauma.Items.Components
public Deconstructor(Item item, XElement element)
: base(item, element)
{
progressBar = new GUIProgressBar(new Rectangle(0,0,200,20), Color.Green, 0.0f, Alignment.BottomCenter, GuiFrame);
progressBar = new GUIProgressBar(new Rectangle(0,0,200,20), Color.Green, GUI.Style, 0.0f, Alignment.BottomCenter, GuiFrame);
activateButton = new GUIButton(new Rectangle(0, 0, 200, 20), "Deconstruct", Alignment.TopCenter, GUI.Style, GuiFrame);
activateButton.OnClicked = ToggleActive;

View File

@@ -91,6 +91,10 @@ namespace Barotrauma.Items.Components
private FabricableItem fabricatedItem;
private float timeUntilReady;
//used for checking if contained items have changed
//(in which case we need to recheck which items can be fabricated)
private Item[] prevContainedItems;
private float lastNetworkUpdate;
public Fabricator(Item item, XElement element)
@@ -110,7 +114,6 @@ namespace Barotrauma.Items.Components
itemList = new GUIListBox(new Rectangle(0,0,GuiFrame.Rect.Width/2-20,0), GUI.Style, GuiFrame);
itemList.OnSelected = SelectItem;
//structureList.CheckSelected = MapEntityPrefab.GetSelected;
foreach (FabricableItem fi in fabricableItems)
{
@@ -131,6 +134,7 @@ namespace Barotrauma.Items.Components
Color.Transparent, Color.White,
Alignment.Left, Alignment.Left,
null, frame);
textBlock.ToolTip = fi.TargetItem.Description;
textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f);
if (fi.TargetItem.sprite != null)
@@ -138,6 +142,7 @@ namespace Barotrauma.Items.Components
GUIImage img = new GUIImage(new Rectangle(0, 0, 40, 40), fi.TargetItem.sprite, Alignment.Left, frame);
img.Scale = Math.Min(Math.Min(40.0f / img.SourceRect.Width, 40.0f / img.SourceRect.Height), 1.0f);
img.Color = fi.TargetItem.SpriteColor;
img.ToolTip = fi.TargetItem.Description;
}
}
@@ -151,7 +156,7 @@ namespace Barotrauma.Items.Components
if (selectedItemFrame != null) GuiFrame.RemoveChild(selectedItemFrame);
//int width = 200, height = 150;
selectedItemFrame = new GUIFrame(new Rectangle(0, 0, (int)(GuiFrame.Rect.Width * 0.4f), 250), Color.Black * 0.8f, Alignment.CenterY | Alignment.Right, null, GuiFrame);
selectedItemFrame = new GUIFrame(new Rectangle(0, 0, (int)(GuiFrame.Rect.Width * 0.4f), 300), Color.Black * 0.8f, Alignment.CenterY | Alignment.Right, null, GuiFrame);
selectedItemFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
@@ -160,6 +165,8 @@ namespace Barotrauma.Items.Components
if (targetItem.TargetItem.sprite != null)
{
int y = 0;
GUIImage img = new GUIImage(new Rectangle(10, 0, 40, 40), targetItem.TargetItem.sprite, Alignment.TopLeft, selectedItemFrame);
img.Scale = Math.Min(Math.Min(40.0f / img.SourceRect.Width, 40.0f / img.SourceRect.Height), 1.0f);
img.Color = targetItem.TargetItem.SpriteColor;
@@ -172,12 +179,24 @@ namespace Barotrauma.Items.Components
Alignment.TopLeft, null,
selectedItemFrame, true);
y += 40;
if (!string.IsNullOrWhiteSpace(targetItem.TargetItem.Description))
{
var description = new GUITextBlock(
new Rectangle(0, y, 0, 0),
targetItem.TargetItem.Description,
GUI.Style, Alignment.TopLeft, Alignment.TopLeft,
selectedItemFrame, true, GUI.SmallFont);
y += description.Rect.Height + 10;
}
List<Skill> inadequateSkills = new List<Skill>();
if (Character.Controlled != null)
{
inadequateSkills = targetItem.RequiredSkills.FindAll(skill => Character.Controlled.GetSkillLevel(skill.Name) < skill.Level);
}
@@ -204,7 +223,7 @@ namespace Barotrauma.Items.Components
}
new GUITextBlock(
new Rectangle(0, 50, 0, 25),
new Rectangle(0, y, 0, 25),
text,
Color.Transparent, textColor,
Alignment.TopLeft,
@@ -222,11 +241,13 @@ namespace Barotrauma.Items.Components
public override bool Select(Character character)
{
CheckFabricableItems(character);
if (itemList.Selected != null)
{
SelectItem(itemList.Selected, itemList.Selected.UserData);
SelectItem(itemList.Selected, itemList.Selected.UserData);
}
return base.Select(character);
}
@@ -235,6 +256,30 @@ namespace Barotrauma.Items.Components
return (picker != null);
}
/// <summary>
/// check which of the items can be fabricated by the character
/// and update the text colors of the item list accordingly
/// </summary>
private void CheckFabricableItems(Character character)
{
foreach (GUIComponent child in itemList.children)
{
var itemPrefab = child.UserData as FabricableItem;
if (itemPrefab == null) continue;
bool canBeFabricated = CanBeFabricated(itemPrefab, character);
child.GetChild<GUITextBlock>().TextColor = Color.White * (canBeFabricated ? 1.0f : 0.5f);
child.GetChild<GUIImage>().Color = itemPrefab.TargetItem.SpriteColor * (canBeFabricated ? 1.0f : 0.5f);
}
var itemContainer = item.GetComponent<ItemContainer>();
prevContainedItems = new Item[itemContainer.Inventory.Items.Length];
itemContainer.Inventory.Items.CopyTo(prevContainedItems, 0);
}
private bool StartButtonClicked(GUIButton button, object obj)
{
if (fabricatedItem == null)
@@ -344,6 +389,30 @@ namespace Barotrauma.Items.Components
activateButton.Enabled = CanBeFabricated(targetItem, character);
}
if (character != null)
{
bool itemsChanged = false;
if (prevContainedItems == null)
{
itemsChanged = true;
}
else
{
var itemContainer = item.GetComponent<ItemContainer>();
for (int i = 0; i < itemContainer.Inventory.Items.Length; i++)
{
if (prevContainedItems[i] != itemContainer.Inventory.Items[i])
{
itemsChanged = true;
break;
}
}
}
if (itemsChanged) CheckFabricableItems(character);
}
GuiFrame.Update((float)Timing.Step);
}

View File

@@ -20,10 +20,7 @@ namespace Barotrauma.Items.Components
private List<RadarBlip> radarBlips;
private float prevPingRadius;
public static string StartMarker = "Start";
public static string EndMarker = "End";
[HasDefaultValue(10000.0f, false)]
public float Range
{
@@ -265,11 +262,11 @@ namespace Barotrauma.Items.Components
DrawMarker(spriteBatch,
(GameMain.GameSession.Map == null) ? StartMarker : GameMain.GameSession.Map.CurrentLocation.Name,
GameMain.GameSession.StartLocation.Name,
(Level.Loaded.StartPosition - item.WorldPosition), displayScale, center, (rect.Width * 0.5f));
DrawMarker(spriteBatch,
(GameMain.GameSession.Map == null) ? EndMarker : GameMain.GameSession.Map.SelectedLocation.Name,
GameMain.GameSession.EndLocation.Name,
(Level.Loaded.EndPosition - item.WorldPosition), displayScale, center, (rect.Width * 0.5f));
if (GameMain.GameSession.Mission != null)
@@ -397,12 +394,15 @@ namespace Barotrauma.Items.Components
if (dir.X < 0.0f) markerPos.X -= GUI.SmallFont.MeasureString(label).X+10;
GUI.DrawString(spriteBatch, new Vector2(markerPos.X + 10, markerPos.Y), label, Color.LightGreen * textAlpha, Color.Black * textAlpha*0.5f, 2, GUI.SmallFont);
string wrappedLabel = ToolBox.WrapText(label, 150, GUI.SmallFont);
GUI.DrawString(spriteBatch, new Vector2(markerPos.X + 10, markerPos.Y + 15), (int)(dist * Physics.DisplayToRealWorldRatio) + " m",
Color.LightGreen * textAlpha,
Color.Black * textAlpha, 2, GUI.SmallFont);
wrappedLabel += "\n"+((int)(dist * Physics.DisplayToRealWorldRatio) + " m");
GUI.DrawString(spriteBatch,
new Vector2(markerPos.X + 10, markerPos.Y),
wrappedLabel,
Color.LightGreen * textAlpha, Color.Black * textAlpha * 0.5f,
2, GUI.SmallFont);
}
protected override void RemoveComponentSpecific()

View File

@@ -19,7 +19,8 @@ namespace Barotrauma.Items.Components
private Vector2 targetVelocity;
private GUITickBox autopilotTickBox, maintainPosTickBox;
private GUITickBox levelEndTickBox, levelStartTickBox;
private bool autoPilot;
private Vector2? posToMaintain;
@@ -47,21 +48,23 @@ namespace Barotrauma.Items.Components
if (value == autoPilot) return;
autoPilot = value;
autopilotTickBox.Selected = value;
maintainPosTickBox.Enabled = autoPilot;
levelEndTickBox.Enabled = autoPilot;
levelStartTickBox.Enabled = autoPilot;
if (autoPilot)
{
if (pathFinder==null) pathFinder = new PathFinder(WayPoint.WayPointList, false);
steeringPath = pathFinder.FindPath(
ConvertUnits.ToSimUnits(item.WorldPosition),
TargetPosition == null ? ConvertUnits.ToSimUnits(Level.Loaded.EndPosition) : (Vector2)TargetPosition);
if (pathFinder == null) pathFinder = new PathFinder(WayPoint.WayPointList, false);
ToggleMaintainPosition(maintainPosTickBox);
}
else
{
maintainPosTickBox.Selected = false;
levelEndTickBox.Selected = false;
levelStartTickBox.Selected = false;
posToMaintain = null;
}
}
@@ -114,15 +117,28 @@ namespace Barotrauma.Items.Components
return true;
};
maintainPosTickBox = new GUITickBox(new Rectangle(0, 50, 20, 20), "Maintain position", Alignment.TopLeft, GuiFrame);
maintainPosTickBox = new GUITickBox(new Rectangle(5, 50, 15, 15), "Maintain position", Alignment.TopLeft, GUI.SmallFont, GuiFrame);
maintainPosTickBox.Enabled = false;
maintainPosTickBox.OnSelected = ToggleMaintainPosition;
levelStartTickBox = new GUITickBox(
new Rectangle(5, 70, 15, 15),
GameMain.GameSession == null ? "" : ToolBox.LimitString(GameMain.GameSession.StartLocation.Name, 20),
Alignment.TopLeft, GUI.SmallFont, GuiFrame);
levelStartTickBox.Enabled = false;
levelStartTickBox.OnSelected = SelectDestination;
levelEndTickBox = new GUITickBox(
new Rectangle(5, 90, 15, 15),
GameMain.GameSession == null ? "" : ToolBox.LimitString(GameMain.GameSession.StartLocation.Name, 20),
Alignment.TopLeft, GUI.SmallFont, GuiFrame);
levelEndTickBox.Enabled = false;
levelEndTickBox.OnSelected = SelectDestination;
}
public override void Update(float deltaTime, Camera cam)
{
//base.Update(deltaTime, cam);
if (valueChanged)
{
networkUpdateTimer -= deltaTime;
@@ -331,6 +347,28 @@ namespace Barotrauma.Items.Components
}
private void UpdatePath()
{
Vector2 target;
if (TargetPosition != null)
{
target = (Vector2)TargetPosition;
}
else
{
if (levelEndTickBox.Selected)
{
target = ConvertUnits.ToSimUnits(Level.Loaded.EndPosition);
}
else
{
target = ConvertUnits.ToSimUnits(Level.Loaded.StartPosition);
}
}
steeringPath = pathFinder.FindPath(ConvertUnits.ToSimUnits(item.WorldPosition), target);
}
private void SteerTowardsPosition(Vector2 worldPosition)
{
float prediction = 10.0f;
@@ -345,7 +383,7 @@ namespace Barotrauma.Items.Components
}
else
{
TargetVelocity = targetSpeed/5.0f;
TargetVelocity = targetSpeed / 5.0f;
}
}
@@ -353,21 +391,42 @@ namespace Barotrauma.Items.Components
{
valueChanged = true;
if (tickBox.Selected)
{
if (item.Submarine == null)
{
posToMaintain = null;
}
else
{
posToMaintain = item.Submarine.WorldPosition;
}
}
else
levelStartTickBox.Selected = false;
levelEndTickBox.Selected = false;
if (item.Submarine == null)
{
posToMaintain = null;
}
else
{
posToMaintain = item.Submarine.WorldPosition;
}
tickBox.Selected = true;
return true;
}
private bool SelectDestination(GUITickBox tickBox)
{
valueChanged = true;
if (tickBox == levelStartTickBox)
{
levelEndTickBox.Selected = false;
}
else
{
levelStartTickBox.Selected = false;
}
maintainPosTickBox.Selected = false;
posToMaintain = null;
UpdatePath();
tickBox.Selected = true;
return true;
}
@@ -397,6 +456,16 @@ namespace Barotrauma.Items.Components
else
{
msg.Write(posToMaintain != null);
message.Write(posToMaintain != null);
if (posToMaintain != null)
{
message.Write(((Vector2)posToMaintain).X);
message.Write(((Vector2)posToMaintain).Y);
}
else
{
message.Write(levelStartTickBox.Selected);
}
}
}
@@ -420,6 +489,17 @@ namespace Barotrauma.Items.Components
{
posToMaintain = null;
maintainPosTickBox.Selected = false;
bool maintainPos = message.ReadBoolean();
if (maintainPos)
{
newPosToMaintain = new Vector2(
message.ReadFloat(),
message.ReadFloat());
}
else
{
headingToStart = message.ReadBoolean();
}
}
}
}
@@ -467,6 +547,22 @@ namespace Barotrauma.Items.Components
maintainPosTickBox.Selected = false;
}
}
maintainPosTickBox.Selected = newPosToMaintain != null;
posToMaintain = newPosToMaintain;
if (posToMaintain == null && autoPilot)
{
levelStartTickBox.Selected = headingToStart;
levelEndTickBox.Selected = !headingToStart;
UpdatePath();
}
else
{
levelStartTickBox.Selected = false;
levelEndTickBox.Selected = false;
}
}
}
}

View File

@@ -126,21 +126,32 @@ namespace Barotrauma
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.BackToFront,
BlendState.Additive,
SamplerState.LinearWrap, DepthStencilState.Default, null, null,
cam.Transform);
for (int i = 1; i < 2; i++)
for (int i = 1; i < 4; i++)
{
Vector2 offset = new Vector2(cam.WorldView.X, cam.WorldView.Y);
float scale = 1.0f - i * 0.2f;
dustParticles.SourceRect = new Rectangle((int)(offset.X), (int)(-offset.Y), (int)(1024), (int)(1024));
//alpha goes from 1.0 to 0.0 when scale is in the range of 0.2-0.1
float alpha = (cam.Zoom * scale) < 0.2f ? (cam.Zoom * scale - 0.1f) * 10.0f : 1.0f;
if (alpha <= 0.0f) continue;
Vector2 offset = (new Vector2(cam.WorldViewCenter.X, cam.WorldViewCenter.Y) + dustOffset) * scale;
Vector3 origin = new Vector3(cam.WorldView.Width, cam.WorldView.Height, 0.0f) * 0.5f;
dustParticles.DrawTiled(spriteBatch, new Vector2(cam.WorldView.X, -cam.WorldView.Y),
new Vector2(cam.WorldView.Width, cam.WorldView.Height),
Vector2.Zero, Color.White);
dustParticles.SourceRect = new Rectangle(
(int)((offset.X - origin.X + (i * 256)) / scale),
(int)((-offset.Y - origin.Y + (i * 256)) / scale),
(int)((cam.WorldView.Width) / scale),
(int)((cam.WorldView.Height) / scale));
spriteBatch.Draw(dustParticles.Texture,
new Vector2(cam.WorldViewCenter.X, -cam.WorldViewCenter.Y),
dustParticles.SourceRect, Color.White * alpha, 0.0f,
new Vector2(cam.WorldView.Width, cam.WorldView.Height) * 0.5f / scale, scale, SpriteEffects.None, 0);
}
spriteBatch.End();

View File

@@ -437,11 +437,11 @@ namespace Barotrauma
WayPoint[] stairPoints = new WayPoint[2];
stairPoints[0] = new WayPoint(
new Vector2(stairs.Rect.X - 75.0f,
new Vector2(stairs.Rect.X - 32.0f,
stairs.Rect.Y - (stairs.StairDirection == Direction.Left ? 80 : stairs.Rect.Height) + heightFromFloor), SpawnType.Path, submarine);
stairPoints[1] = new WayPoint(
new Vector2(stairs.Rect.Right + 75.0f,
new Vector2(stairs.Rect.Right + 32.0f,
stairs.Rect.Y - (stairs.StairDirection == Direction.Left ? stairs.Rect.Height : 80) + heightFromFloor), SpawnType.Path, submarine);
for (int i = 0; i < 2; i++ )
@@ -536,11 +536,11 @@ namespace Barotrauma
//ladderPoints[0].ConnectTo(ladderPoints[1]);
}
foreach (Gap gap in Gap.GapList)
{
if (!gap.isHorizontal) continue;
//too small to walk through
if (gap.Rect.Height < 150.0f) continue;
@@ -550,9 +550,15 @@ namespace Barotrauma
for (int dir = -1; dir <= 1; dir += 2)
{
float tolerance = gap.IsRoomToRoom ? 50.0f : outSideWaypointInterval / 2.0f;
WayPoint closest = wayPoint.FindClosest(dir, true, new Vector2(-tolerance, tolerance));
if (closest == null) continue;
wayPoint.ConnectTo(closest);
WayPoint closest = wayPoint.FindClosest(
dir, true, new Vector2(-tolerance, tolerance),
gap.ConnectedDoor == null ? null : gap.ConnectedDoor.Body.FarseerBody);
if (closest != null)
{
wayPoint.ConnectTo(closest);
}
}
}
@@ -582,7 +588,7 @@ namespace Barotrauma
}
}
private WayPoint FindClosest(int dir, bool horizontalSearch, Vector2 tolerance)
private WayPoint FindClosest(int dir, bool horizontalSearch, Vector2 tolerance, Body ignoredBody = null)
{
if (dir != -1 && dir != 1) return null;
@@ -614,9 +620,9 @@ namespace Barotrauma
if (closest == null || dist < closestDist)
{
var body = Submarine.CheckVisibility(SimPosition, wp.SimPosition, true);
if (body != null)
if (body != null && body != ignoredBody && !(body.UserData is Submarine))
{
if (body.UserData is Structure) continue;
if (body.UserData is Structure || body.FixtureList[0].CollisionCategories.HasFlag(Physics.CollisionWall)) continue;
}
closestDist = dist;

View File

@@ -975,6 +975,7 @@ namespace Barotrauma.Networking
endMessage += TraitorManager.GetEndMessage();
}
Mission mission = GameMain.GameSession.Mission;
GameMain.GameSession.gameMode.End(endMessage);
if (autoRestart) AutoRestartTimer = AutoRestartInterval;

View File

@@ -233,7 +233,7 @@ namespace Barotrauma
public PhysicsBody(Body farseerBody)
{
body = farseerBody;
body.UserData = this;
if (body.UserData == null) body.UserData = this;
LastSentPosition = body.Position;

View File

@@ -12,6 +12,8 @@ namespace Barotrauma
{
Camera cam;
Color waterColor = new Color(0.75f, 0.8f, 0.9f, 1.0f);
readonly RenderTarget2D renderTargetBackground;
readonly RenderTarget2D renderTarget;
readonly RenderTarget2D renderTargetWater;
@@ -270,7 +272,7 @@ namespace Barotrauma
spriteBatch.Begin(SpriteSortMode.Deferred,
BlendState.Opaque);
spriteBatch.Draw(renderTarget, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), new Color(0.75f, 0.8f, 0.9f, 1.0f));
spriteBatch.Draw(renderTarget, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), waterColor);
spriteBatch.End();
#if LINUX
@@ -406,7 +408,7 @@ namespace Barotrauma
float r = Math.Min(CharacterHUD.damageOverlayTimer * 0.5f, 0.5f);
spriteBatch.Draw(renderTarget, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight),
Color.Lerp(new Color(0.1f, 0.1f, 0.1f), Color.Red, r));
Color.Lerp(GameMain.LightManager.AmbientLight*0.5f, Color.Red, r));
spriteBatch.End();
}

View File

@@ -343,8 +343,6 @@ namespace Barotrauma
{
if (maxWidth <= 0 || string.IsNullOrWhiteSpace(str)) return "";
StringBuilder sb = new StringBuilder();
float currWidth = font.MeasureString("...").X;
for (int i = 0; i < str.Length; i++ )
{
@@ -352,7 +350,7 @@ namespace Barotrauma
if (currWidth > maxWidth)
{
return str.Substring(0, i + 1) + "...";
return str.Substring(0, Math.Max(i - 2, 1)) + "...";
}
}