5d2c9f2...bdbcef4
commit bdbcef41bfbc42beeb2d942e7db431b8ab627f1c Author: itchyOwl <lauri.harkanen@gmail.com> Date: Thu Mar 7 13:31:02 2019 +0200 Simplify the sprite related commands. commit 49c8e1cd01953ae31cff99bf35432ab887b45d62 Author: itchyOwl <lauri.harkanen@gmail.com> Date: Thu Mar 7 13:05:20 2019 +0200 Rename "Reload Texture" button as "Reload Sprite", because it actually reloads both the xml and the texture. Add the button text into the localization file. commit 84f58d9e0bb46f29412f936d569348e46227c9d5 Author: itchyOwl <lauri.harkanen@gmail.com> Date: Thu Mar 7 12:50:51 2019 +0200 Add the option to reload xml/texture/both for items when they are hovered over with the mouse. dry. commit 732084c044e6a2c220cee8d5c1d9b5e4ce05587d Author: itchyOwl <lauri.harkanen@gmail.com> Date: Thu Mar 7 12:48:49 2019 +0200 Fix the sprite name of the right hand in the assistant job gear. commit 30344369d7e87a17312cc839f195c36c77c4a3b2 Author: itchyOwl <lauri.harkanen@gmail.com> Date: Thu Mar 7 12:26:20 2019 +0200 Fix ReloadXML failing when multiple source elements are found. commit ddb6fb48b6e0789b18a1ea889dcdf408fcbb5b12 Author: itchyOwl <lauri.harkanen@gmail.com> Date: Thu Mar 7 11:47:13 2019 +0200 Fix damagemodifier multiplier not applied on particles if no sound is played. commit 41206013be41d240b12dad48f4ddaba9b072742b Author: itchyOwl <lauri.harkanen@gmail.com> Date: Thu Mar 7 11:46:22 2019 +0200 Fix engigear lower arm sprite name. commit 8ce938305206ca65aeb00515639e799d9f2fd526 Merge: e6166d2ef 61703e8af Author: itchyOwl <lauri.harkanen@gmail.com> Date: Wed Mar 6 18:53:36 2019 +0200 Merge branch 'dev' of https://github.com/Regalis11/Barotrauma into dev commit e6166d2ef24489bac6f217211849884013dbf4e6 Author: itchyOwl <lauri.harkanen@gmail.com> Date: Wed Mar 6 18:53:30 2019 +0200 Implement husk sprite overlays as wearables. Add new husk injector (wip). commit 367c4f5b3784c65c3c26807dd6c10e837960c6bb Author: itchyOwl <lauri.harkanen@gmail.com> Date: Wed Mar 6 18:52:15 2019 +0200 Add console commands for changing the gender and race of the character. commit 61703e8af274c8f5d9e05575ebaf13c9bde8855f Author: Iiro Enges <iiro@fakefish.fi> Date: Wed Mar 6 17:47:09 2019 +0200 Refined environment item scales and colors
This commit is contained in:
@@ -795,15 +795,12 @@ namespace Barotrauma
|
||||
}
|
||||
partial void InitProjSpecific(XDocument doc);
|
||||
|
||||
public void ReloadHead(int? headId = null, int? hairIndex = null, int? beardIndex = null, int? moustacheIndex = null, int? faceAttachmentIndex = null)
|
||||
public void ReloadHead(int? headId = null, int hairIndex = -1, int beardIndex = -1, int moustacheIndex = -1, int faceAttachmentIndex = -1)
|
||||
{
|
||||
if (Info == null) { return; }
|
||||
var head = AnimController.GetLimb(LimbType.Head);
|
||||
if (head == null) { return; }
|
||||
if (headId.HasValue)
|
||||
{
|
||||
Info.RecreateHead(headId.Value, Info.Race, Info.Gender, hairIndex ?? -1, beardIndex ?? -1, moustacheIndex ?? -1, faceAttachmentIndex ?? -1);
|
||||
}
|
||||
Info.RecreateHead(headId ?? Info.HeadSpriteId, Info.Race, Info.Gender, hairIndex, beardIndex, moustacheIndex, faceAttachmentIndex);
|
||||
#if CLIENT
|
||||
head.RecreateSprite();
|
||||
#endif
|
||||
@@ -828,6 +825,10 @@ namespace Barotrauma
|
||||
Info.MoustacheElement?.Elements("sprite").ForEach(s => head.OtherWearables.Add(new WearableSprite(s, WearableType.Moustache)));
|
||||
if (info.HairElement == null) { info.HairIndex = 0; }
|
||||
Info.HairElement?.Elements("sprite").ForEach(s => head.OtherWearables.Add(new WearableSprite(s, WearableType.Hair)));
|
||||
|
||||
#if CLIENT
|
||||
head.LoadHuskSprite();
|
||||
#endif
|
||||
}
|
||||
|
||||
private static string humanConfigFile;
|
||||
|
||||
@@ -462,7 +462,7 @@ namespace Barotrauma
|
||||
private List<XElement> faceAttachments;
|
||||
|
||||
private IEnumerable<XElement> wearables;
|
||||
private IEnumerable<XElement> Wearables
|
||||
public IEnumerable<XElement> Wearables
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -478,7 +478,18 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<XElement> FilterElementsByGenderAndRace(IEnumerable<XElement> elements)
|
||||
public IEnumerable<XElement> FilterByTypeAndHeadID(IEnumerable<XElement> elements, WearableType targetType)
|
||||
{
|
||||
return elements.Where(e =>
|
||||
{
|
||||
if (Enum.TryParse(e.GetAttributeString("type", ""), true, out WearableType type) && type != targetType) { return false; }
|
||||
int headId = e.GetAttributeInt("headid", -1);
|
||||
// if the head id is less than 1, the id is not valid and the condition is ignored.
|
||||
return headId < 1 || headId == Head.HeadSpriteId;
|
||||
});
|
||||
}
|
||||
|
||||
public IEnumerable<XElement> FilterElementsByGenderAndRace(IEnumerable<XElement> elements)
|
||||
{
|
||||
if (elements == null) { return elements; }
|
||||
return elements.Where(w =>
|
||||
@@ -669,17 +680,6 @@ namespace Barotrauma
|
||||
return element == null || element.Name == "Empty" ? null : element;
|
||||
}
|
||||
|
||||
IEnumerable<XElement> FilterByTypeAndHeadID(IEnumerable<XElement> elements, WearableType targetType)
|
||||
{
|
||||
return elements.Where(e =>
|
||||
{
|
||||
if (Enum.TryParse(e.GetAttributeString("type", ""), true, out WearableType type) && type != targetType) { return false; }
|
||||
int headId = e.GetAttributeInt("headid", -1);
|
||||
// if the head id is less than 1, the id is not valid and the condition is ignored.
|
||||
return headId < 1 || headId == Head.HeadSpriteId;
|
||||
});
|
||||
}
|
||||
|
||||
bool IsWearableAllowed(XElement element)
|
||||
{
|
||||
string spriteName = element.Element("sprite").GetAttributeString("name", string.Empty);
|
||||
|
||||
@@ -257,6 +257,11 @@ namespace Barotrauma
|
||||
return null;
|
||||
}
|
||||
|
||||
public T GetAffliction<T>(string afflictionType, bool allowLimbAfflictions = true) where T : Affliction
|
||||
{
|
||||
return GetAffliction(afflictionType, allowLimbAfflictions) as T;
|
||||
}
|
||||
|
||||
public Affliction GetAffliction(string afflictionType, Limb limb)
|
||||
{
|
||||
foreach (Affliction affliction in limbHealths[limb.HealthIndex].Afflictions)
|
||||
|
||||
@@ -985,7 +985,57 @@ namespace Barotrauma
|
||||
Submarine.MainSub?.FlipX();
|
||||
}));
|
||||
|
||||
commands.Add(new Command("loadhead", "Load head sprite(s). Required argument: head id. Optional arguments: hair index, beard index, moustache index, face attachment index.", args =>
|
||||
commands.Add(new Command("gender", "Set the gender of the controlled character. Allowed parameters: Male, Female, None.", args =>
|
||||
{
|
||||
var character = Character.Controlled;
|
||||
if (character == null)
|
||||
{
|
||||
ThrowError("Not controlling any character!");
|
||||
return;
|
||||
}
|
||||
if (args.Length == 0)
|
||||
{
|
||||
ThrowError("No parameters provided!");
|
||||
return;
|
||||
}
|
||||
if (Enum.TryParse(args[0], true, out Gender gender))
|
||||
{
|
||||
character.Info.Gender = gender;
|
||||
character.ReloadHead();
|
||||
foreach (var limb in character.AnimController.Limbs)
|
||||
{
|
||||
foreach (var wearable in limb.WearingItems)
|
||||
{
|
||||
if (wearable.Gender != Gender.None && wearable.Gender != gender)
|
||||
{
|
||||
wearable.Gender = gender;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
commands.Add(new Command("race", "Set race of the controlled character. Allowed parameters: White, Black, Asian, None.", args =>
|
||||
{
|
||||
var character = Character.Controlled;
|
||||
if (character == null)
|
||||
{
|
||||
ThrowError("Not controlling any character!");
|
||||
return;
|
||||
}
|
||||
if (args.Length == 0)
|
||||
{
|
||||
ThrowError("No parameters provided!");
|
||||
return;
|
||||
}
|
||||
if (Enum.TryParse(args[0], true, out Race race))
|
||||
{
|
||||
character.Info.Race = race;
|
||||
character.ReloadHead();
|
||||
}
|
||||
}));
|
||||
|
||||
commands.Add(new Command("loadhead|head", "Load head sprite(s). Required argument: head id. Optional arguments: hair index, beard index, moustache index, face attachment index.", args =>
|
||||
{
|
||||
var character = Character.Controlled;
|
||||
if (character == null)
|
||||
|
||||
@@ -67,6 +67,8 @@ namespace Barotrauma
|
||||
|
||||
public int ParticleLimit { get; set; }
|
||||
|
||||
public int ParticleLimit { get; set; }
|
||||
|
||||
public float LightMapScale { get; set; }
|
||||
public bool SpecularityEnabled { get; set; }
|
||||
public bool ChromaticAberrationEnabled { get; set; }
|
||||
@@ -542,34 +544,6 @@ namespace Barotrauma
|
||||
|
||||
TextManager.LoadTextPacks(SelectedContentPackages);
|
||||
|
||||
//display error messages after all content packages have been loaded
|
||||
//to make sure the package that contains text files has been loaded before we attempt to use TextManager
|
||||
foreach (string missingPackagePath in missingPackagePaths)
|
||||
{
|
||||
DebugConsole.ThrowError(TextManager.Get("ContentPackageNotFound").Replace("[packagepath]", missingPackagePath));
|
||||
}
|
||||
foreach (ContentPackage incompatiblePackage in incompatiblePackages)
|
||||
{
|
||||
DebugConsole.ThrowError(TextManager.Get(incompatiblePackage.GameVersion <= new Version(0, 0, 0, 0) ? "IncompatibleContentPackageUnknownVersion" : "IncompatibleContentPackage")
|
||||
.Replace("[packagename]", incompatiblePackage.Name)
|
||||
.Replace("[packageversion]", incompatiblePackage.GameVersion.ToString())
|
||||
.Replace("[gameversion]", GameMain.Version.ToString()));
|
||||
}
|
||||
foreach (ContentPackage contentPackage in SelectedContentPackages)
|
||||
{
|
||||
foreach (ContentFile file in contentPackage.Files)
|
||||
{
|
||||
if (!System.IO.File.Exists(file.Path))
|
||||
{
|
||||
DebugConsole.ThrowError("Error in content package \"" + contentPackage.Name + "\" - file \"" + file.Path + "\" not found.");
|
||||
continue;
|
||||
}
|
||||
ToolBox.IsProperFilenameCase(file.Path);
|
||||
}
|
||||
}
|
||||
|
||||
TextManager.LoadTextPacks(SelectedContentPackages);
|
||||
|
||||
//display error messages after all content packages have been loaded
|
||||
//to make sure the package that contains text files has been loaded before we attempt to use TextManager
|
||||
foreach (string missingPackagePath in missingPackagePaths)
|
||||
@@ -1226,6 +1200,32 @@ namespace Barotrauma
|
||||
NewLineOnAttributes = true
|
||||
};
|
||||
|
||||
#if CLIENT
|
||||
if (Tutorial.Tutorials != null)
|
||||
{
|
||||
foreach (Tutorial tutorial in Tutorial.Tutorials)
|
||||
{
|
||||
if (tutorial.Completed && !CompletedTutorialNames.Contains(tutorial.Name))
|
||||
{
|
||||
CompletedTutorialNames.Add(tutorial.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
var tutorialElement = new XElement("tutorials");
|
||||
foreach (string tutorialName in CompletedTutorialNames)
|
||||
{
|
||||
tutorialElement.Add(new XElement("Tutorial", new XAttribute("name", tutorialName)));
|
||||
}
|
||||
doc.Root.Add(tutorialElement);
|
||||
|
||||
XmlWriterSettings settings = new XmlWriterSettings
|
||||
{
|
||||
Indent = true,
|
||||
OmitXmlDeclaration = true,
|
||||
NewLineOnAttributes = true
|
||||
};
|
||||
|
||||
#if CLIENT
|
||||
if (Tutorial.Tutorials != null)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,8 @@ namespace Barotrauma
|
||||
Beard,
|
||||
Moustache,
|
||||
FaceAttachment,
|
||||
JobIndicator
|
||||
JobIndicator,
|
||||
Husk
|
||||
}
|
||||
|
||||
class WearableSprite
|
||||
@@ -86,7 +87,7 @@ namespace Barotrauma
|
||||
{
|
||||
Type = type;
|
||||
SourceElement = subElement;
|
||||
SpritePath = subElement.Attribute("texture").Value;
|
||||
SpritePath = subElement.GetAttributeString("texture", string.Empty);
|
||||
Init();
|
||||
switch (type)
|
||||
{
|
||||
@@ -95,6 +96,7 @@ namespace Barotrauma
|
||||
case WearableType.Moustache:
|
||||
case WearableType.FaceAttachment:
|
||||
case WearableType.JobIndicator:
|
||||
case WearableType.Husk:
|
||||
Limb = LimbType.Head;
|
||||
HideLimb = false;
|
||||
HideOtherWearables = false;
|
||||
|
||||
@@ -430,6 +430,13 @@ namespace Barotrauma
|
||||
}
|
||||
CurrentLocation.SelectedMissionIndex = missionIndex;
|
||||
|
||||
//the destination must be the same as the destination of the mission
|
||||
if (CurrentLocation.SelectedMission != null &&
|
||||
CurrentLocation.SelectedMission.Locations[1] != SelectedLocation)
|
||||
{
|
||||
SelectLocation(CurrentLocation.SelectedMission.Locations[1]);
|
||||
}
|
||||
|
||||
SelectedLocation = location;
|
||||
SelectedConnection = connections.Find(c => c.Locations.Contains(CurrentLocation) && c.Locations.Contains(SelectedLocation));
|
||||
OnLocationSelected?.Invoke(SelectedLocation, SelectedConnection);
|
||||
|
||||
@@ -160,6 +160,16 @@ namespace Barotrauma
|
||||
}
|
||||
#endif
|
||||
|
||||
public void SetState()
|
||||
{
|
||||
hit = binding.IsHit();
|
||||
if (hit) hitQueue = true;
|
||||
|
||||
held = binding.IsDown();
|
||||
if (held) heldQueue = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
public bool Hit
|
||||
{
|
||||
get
|
||||
|
||||
@@ -238,7 +238,7 @@ namespace Barotrauma
|
||||
}
|
||||
if (sourceElements.Multiple())
|
||||
{
|
||||
DebugConsole.NewMessage($"[Sprite] Multiple matching elements found by name ({Name}) or identifier ({EntityID})! Cannot reload the xml for sprite element \"{SourceElement.ToString()}\"!", Color.Yellow);
|
||||
DebugConsole.NewMessage($"[Sprite] Multiple matching elements found by name ({Name}) or identifier ({EntityID})!: {SourceElement.ToString()}", Color.Yellow);
|
||||
}
|
||||
else if (sourceElements.None())
|
||||
{
|
||||
@@ -247,6 +247,9 @@ namespace Barotrauma
|
||||
else
|
||||
{
|
||||
SourceElement = sourceElements.Single();
|
||||
}
|
||||
if (SourceElement != null)
|
||||
{
|
||||
Vector4 sourceVector = SourceElement.GetAttributeVector4("sourcerect", Vector4.Zero);
|
||||
sourceRect = new Rectangle((int)sourceVector.X, (int)sourceVector.Y, (int)sourceVector.Z, (int)sourceVector.W);
|
||||
size = SourceElement.GetAttributeVector2("size", Vector2.One);
|
||||
|
||||
Reference in New Issue
Block a user