Skip to content

Commit

Permalink
v0.2: iteminventory sync bugfix, meleeweapon "reload time", spears ca…
Browse files Browse the repository at this point in the history
…n be picked even if they're stuck inside a wall, tutorial bugfixes, "submarine godmode", removed round duration, drag character sync, reliable structure damage messages, job assignment bugfixes, some extra sounds
  • Loading branch information
Regalis committed Oct 17, 2015
1 parent 838022f commit 3c1a660
Show file tree
Hide file tree
Showing 51 changed files with 457 additions and 213 deletions.
7 changes: 6 additions & 1 deletion Subsurface/Barotrauma.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,9 @@
<Content Include="Content\waterbump.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Data\ContentPackages\Vanilla 0.1.3.xml" />
<Content Include="Data\ContentPackages\Vanilla 0.2.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Icon.ico" />
<Content Include="OpenAL32.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down Expand Up @@ -884,6 +886,9 @@
<None Include="Content\Items\Weapons\railgun.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Items\Weapons\smack.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Items\Weapons\stunbaton.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
6 changes: 3 additions & 3 deletions Subsurface/Content/Characters/Moloch/moloch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@

<joint limb1="0" limb1anchor="112,77" limb2="1" limb2anchor="0,-190" lowerlimit="-180" upperlimit="-90"/>
<joint limb1="1" limb1anchor="0,190" limb2="2" limb2anchor="0,-100" lowerlimit="-50" upperlimit="0"/>
<joint limb1="2" limb1anchor="0,120" limb2="3" limb2anchor="-15,-250" lowerlimit="-50" upperlimit="0"/>
<joint limb1="2" limb1anchor="0,120" limb2="3" limb2anchor="15,-250" lowerlimit="-50" upperlimit="0"/>

<joint limb1="0" limb1anchor="0,0" limb2="4" limb2anchor="0,-190" lowerlimit="-180" upperlimit="-90"/>
<joint limb1="4" limb1anchor="0,190" limb2="5" limb2anchor="0,-100" lowerlimit="-50" upperlimit="0"/>
<joint limb1="5" limb1anchor="0,120" limb2="6" limb2anchor="-15,-250" lowerlimit="-50" upperlimit="0"/>
<joint limb1="5" limb1anchor="0,120" limb2="6" limb2anchor="15,-250" lowerlimit="-50" upperlimit="0"/>

<joint limb1="0" limb1anchor="-53,-164" limb2="7" limb2anchor="0,-190" lowerlimit="-180" upperlimit="-90"/>
<joint limb1="7" limb1anchor="0,190" limb2="8" limb2anchor="0,-100" lowerlimit="-50" upperlimit="0"/>
<joint limb1="8" limb1anchor="0,120" limb2="9" limb2anchor="-15,-250" lowerlimit="-50" upperlimit="0"/>
<joint limb1="8" limb1anchor="0,120" limb2="9" limb2anchor="15,-250" lowerlimit="-50" upperlimit="0"/>

</ragdoll>

Expand Down
2 changes: 1 addition & 1 deletion Subsurface/Content/Items/Clothes/clothes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</Item>

<Item
name="Body Armour"
name="Body Armor"
pickdistance="150"
tags="smallitem">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
name="Vent"
linkable="true">

<Sprite texture ="vent.png" depth="0.85"/>
<Sprite texture ="vent.png" depth="0.91"/>

<Vent>
<sound file="ventilation.ogg" type="OnActive" range="600.0" volume="OxygenFlow" volumemultiplier="0.001f" loop="true"/>
Expand Down
3 changes: 2 additions & 1 deletion Subsurface/Content/Items/Reactor/reactor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
<Item
name="Fuel Rod"
Tags="smallitem"
pickdistance="150">
pickdistance="150"
price="200">

<Sprite texture ="fuelrod.png"/>

Expand Down
Binary file added Subsurface/Content/Items/Weapons/smack.ogg
Binary file not shown.
18 changes: 10 additions & 8 deletions Subsurface/Content/Items/Weapons/weapons.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<Item
name="Spear"
pickdistance="200"
pickthroughwalls="true"
price="50">

<Sprite texture ="spear.png" depth="0.55"/>
Expand Down Expand Up @@ -67,12 +68,12 @@
<Body width="90" height="30" density="10"/>

<MeleeWeapon slots="Any,RightHand,LeftHand"
aimpos="50,0" handle1="-15,-6" holdangle="100">
<RequiredItems name="Battery Cell" type="Contained" msg="Loaded Battery Cell required"/>
<Attack stun="10.0" sound="Content/Items/Electricity/zap1.ogg"/>
<StatusEffect type="OnUse" target="Contained" Condition="-25.0" disabledeltatime="true" sound="Content/Items/Weapons/stunbaton.ogg">
aimpos="50,0" handle1="-15,-6" holdangle="100" reload="1.0">
<Attack damage="2" stun="0.2" damagetype="Blunt" sound="Content/Items/Weapons/smack.ogg"/>
<StatusEffect type="OnUse" target="Contained,Character" Condition="-25.0" stun="10.0" disabledeltatime="true" sound="Content/Items/Weapons/stunbaton.ogg">
<RequiredItem name="Battery Cell" type="Contained" msg="Loaded Battery Cell required"/>
<Explosion range="100.0" force="0.1" shockwave="false" flames="false" camerashake="5.0"/>
</StatusEffect>
</StatusEffect>
</MeleeWeapon>

<ItemContainer capacity="1" hideitems="true">
Expand All @@ -81,9 +82,10 @@
</Item>

<Item
name="Battery Cell"
pickdistance="150"
tags="smallitem,loadable">
name="Battery Cell"
pickdistance="150"
tags="smallitem,loadable"
price="50">

<Sprite texture ="stunbaton.png" sourcerect="0,0,20,9" depth="0.8"/>

Expand Down
10 changes: 6 additions & 4 deletions Subsurface/Content/Jobs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<Item name="Captain's Cap" equip="true"/>
<Item name="Captain's Jacket" equip="true"/>
<Item name="Captain's Trousers" equip="true"/>

<Skills>
<Skill name="Weapons" level="50,60"/>
<Skill name="Construction" level="20,30"/>
<Skill name="Electrical Engineering" level="20,30"/>
</Skills>
</Job>

<Job name="Engineer" description="Engineers have above-average construction and mechanic skills, but fixing complex mechanical devices is still usually out of their skill set. They are competent at fixing electrical devices however, and are the ones to turn to when the power grid starts failing." minnumber="1">
<Skills>
<Skill name="Weapons" level="10,30"/>
Expand Down Expand Up @@ -41,9 +41,11 @@
<Skill name="Construction" level="10,20"/>
<Skill name="Electrical Engineering" level="10,20"/>
</Skills>
<Item name="ID Card"/>
<Item name="Stun Baton"/>
<Item name="Body Armor"/>
<Item name="Ballistic Helmet"/>
<Item name="Battery Cell"/>
<Item name="Body Armor" equip="true"/>
<Item name="Ballistic Helmet" equip="true"/>
</Job>

<Job name="Assistant" description="Assistants don't have any specific responsibilities or areas of expertise. This job is a good choice for newcomers who want to get a hang of working on board the submarine without taking up tasks that they aren't qualified for." allowalways="true">
Expand Down
6 changes: 3 additions & 3 deletions Subsurface/Content/Map/StructurePrefabs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
<topwall sprite="Content/Map/testroom.png" sourcerect="144,464,496,32" depth ="0.06" castshadow="true"
width = "64" height ="32" resizehorizontal="true" body="true" health="500"/>

<bottomwall sprite="Content/Map/testroom.png" flipvertical ="true" sourcerect="144,496,640,32" depth ="0.06" castshadow="true"
width = "64" height ="32" resizehorizontal="true" body="true" health="500"/>

<topwindow sprite="Content/Map/testroom.png" sourcerect="208,352,128,80" depth ="0.05"
width = "128" height ="80" body="true" health="100"/>

Expand Down Expand Up @@ -81,4 +78,7 @@
<stairsleft sprite="Content/Map/testroom.png" fliphorizontal="true" sourcerect="0,704,256,320"
width="256" height="320" depth = "0.1" stairdirection="Left"/>

<bunk sprite="Content/Map/testroom.png" fliphorizontal="true" sourcerect="0,546,173,129"
width="173" height="129" depth = "0.9"/>

</prefabs>
Binary file modified Subsurface/Content/Map/testroom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Subsurface/Content/Quests.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
reward="1000"
radarlabel="Infrasonic signal"
failuremessage="Retrieving the artifact failed"
successmessage="The artifact has been succesfully retrived"
successmessage="The artifact has been succesfully retrieved"
itemname="Skyholder Artifact">
</SalvageQuest>

Expand Down
4 changes: 2 additions & 2 deletions Subsurface/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// 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.1.3.2")]
[assembly: AssemblyFileVersion("0.1.3.2")]
[assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("0.2.0.0")]
4 changes: 3 additions & 1 deletion Subsurface/Source/Characters/AICharacter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ public override void FillNetworkData(NetworkEventType type, NetOutgoingMessage m

public override void ReadNetworkData(NetworkEventType type, NetIncomingMessage message)
{
if (type == NetworkEventType.KillCharacter)
Enabled = true;

if (type == NetworkEventType.KillCharacter)
{
Kill(true);
return;
Expand Down
59 changes: 44 additions & 15 deletions Subsurface/Source/Characters/Character.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public string Name
{
get
{
return SpeciesName;
return (info != null && !string.IsNullOrWhiteSpace(info.Name)) ? info.Name : SpeciesName;
}
}

Expand Down Expand Up @@ -604,20 +604,30 @@ private Character FindClosestCharacter(Vector2 mouseSimPos, float maxDist = 150.
return closestCharacter;
}

private void ToggleSelectedCharacter(Character selected)
private void SelectCharacter(Character character, bool createNetworkEvent = true)
{
if (selectedCharacter != null)
{
foreach (Limb limb in selectedCharacter.AnimController.Limbs)
{
limb.pullJoint.Enabled = false;
}
selectedCharacter = null;
}
else
if (character == null) return;

selectedCharacter = character;

if (createNetworkEvent)
new NetworkEvent(NetworkEventType.SelectCharacter, ID, true, selectedCharacter.ID);

}

private void DeselectCharacter(bool createNetworkEvent = true)
{
if (selectedCharacter == null) return;

foreach (Limb limb in selectedCharacter.AnimController.Limbs)
{
selectedCharacter = selected;
limb.pullJoint.Enabled = false;
}

selectedCharacter = null;

if (createNetworkEvent)
new NetworkEvent(NetworkEventType.SelectCharacter, ID, true, -1);
}

/// <summary>
Expand Down Expand Up @@ -724,20 +734,20 @@ public void ControlLocalPlayer(float deltaTime, Camera cam, bool moveCam = true)
if (Vector2.Distance(selectedCharacter.SimPosition, SimPosition) > 2.0f ||
(!selectedCharacter.isDead && selectedCharacter.Stun <= 0.0f))
{
ToggleSelectedCharacter(selectedCharacter);
DeselectCharacter();
}
}

if (GetInputState(InputType.Select))
{
if (selectedCharacter != null)
{
ToggleSelectedCharacter(selectedCharacter);
DeselectCharacter();
}
else if (closestCharacter != null && closestCharacter.IsHumanoid &&
(closestCharacter.isDead || closestCharacter.AnimController.StunTimer > 0.0f))
{
selectedCharacter = closestCharacter;
SelectCharacter(closestCharacter);
}
}

Expand Down Expand Up @@ -1081,6 +1091,11 @@ public override void FillNetworkData(NetworkEventType type, NetOutgoingMessage m
message.Write((int)data);
return;
}
else if (type== NetworkEventType.SelectCharacter)
{
message.Write((int)data);
return;
}
else if (type == NetworkEventType.KillCharacter)
{
return;
Expand Down Expand Up @@ -1177,6 +1192,20 @@ public override void ReadNetworkData(NetworkEventType type, NetIncomingMessage m

return;
}
else if (type == NetworkEventType.SelectCharacter)
{
int characterId = message.ReadInt32();
if (characterId==-1)
{
DeselectCharacter(false);
}
else
{
Character character = FindEntityByID(characterId) as Character;
if (character != null) SelectCharacter(character, false);
}
return;
}
else if (type == NetworkEventType.KillCharacter)
{
Kill(true);
Expand Down
42 changes: 38 additions & 4 deletions Subsurface/Source/Characters/StatusEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public enum TargetType
private TargetType targetTypes;
private string[] targetNames;

private List<RelatedItem> requiredItems;

public string[] propertyNames;
private object[] propertyEffects;

Expand Down Expand Up @@ -62,10 +64,11 @@ public static StatusEffect Load(XElement element)

protected StatusEffect(XElement element)
{
requiredItems = new List<RelatedItem>();

IEnumerable<XAttribute> attributes = element.Attributes();
List<XAttribute> propertyAttributes = new List<XAttribute>();



foreach (XAttribute attribute in attributes)
{
switch (attribute.Name.ToString())
Expand Down Expand Up @@ -140,6 +143,14 @@ protected StatusEffect(XElement element)
case "explosion":
explosion = new Explosion(subElement);
break;
case "requireditem":
case "requireditems":
RelatedItem newRequiredItem = RelatedItem.Load(subElement);

if (newRequiredItem == null) continue;

requiredItems.Add(newRequiredItem);
break;
}
}

Expand All @@ -156,19 +167,42 @@ protected StatusEffect(XElement element)
// if (this.type == type) Apply(deltaTime, character, item);
//}

private bool HasRequiredItems(Entity entity)
{
if (requiredItems == null) return true;
foreach (RelatedItem requiredItem in requiredItems)
{
Item item = entity as Item;
if (item != null)
{
if (!requiredItem.CheckRequirements(null, item)) return false;
}
Character character = entity as Character;
if (character != null)
{
if (!requiredItem.CheckRequirements(character, null)) return false;
}
}
return true;
}

public virtual void Apply(ActionType type, float deltaTime, Entity entity, IPropertyObject target)
{
if (this.type != type || !HasRequiredItems(entity)) return;

if (targetNames != null && !targetNames.Contains(target.Name)) return;

List<IPropertyObject> targets = new List<IPropertyObject>();
targets.Add(target);

if (this.type == type) Apply(deltaTime, entity, targets);
Apply(deltaTime, entity, targets);
}

public virtual void Apply(ActionType type, float deltaTime, Entity entity, List<IPropertyObject> targets)
{
if (this.type == type) Apply(deltaTime, entity, targets);
if (this.type != type || !HasRequiredItems(entity)) return;

Apply(deltaTime, entity, targets);
}

protected virtual void Apply(float deltaTime, Entity entity, List<IPropertyObject> targets)
Expand Down
3 changes: 0 additions & 3 deletions Subsurface/Source/CoroutineManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,7 @@ public bool CheckFinished(float deltaTime)
{
timer -= deltaTime;
return timer<=0.0f;

}


}


Expand Down
Loading

0 comments on commit 3c1a660

Please sign in to comment.