From bfa6a093c478754e6c4ff108b37b2dca0d66e7ac Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Tue, 19 Mar 2019 11:40:19 +0200 Subject: [PATCH] 3d76e16...b52f40e commit b52f40e6bb736069c945dd0028b39f39722ad0f5 Author: Joonas Rikkonen Date: Tue Mar 19 11:33:57 2019 +0200 Fixed non-radio chat/VOIP having an unlimited distance. Closes #1291 commit 5e3bafed4528d36dd05968300aa01531377355f8 Author: Joonas Rikkonen Date: Tue Mar 19 00:19:11 2019 +0200 Modifications to the private->public merge script --- .../Source/Networking/Voip/VoipServer.cs | 1 + .../Source/Networking/ChatMessage.cs | 6 ++--- git-strip-merge | 24 ++++++++++++++----- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Barotrauma/BarotraumaServer/Source/Networking/Voip/VoipServer.cs b/Barotrauma/BarotraumaServer/Source/Networking/Voip/VoipServer.cs index 7432cf88f..b282901ce 100644 --- a/Barotrauma/BarotraumaServer/Source/Networking/Voip/VoipServer.cs +++ b/Barotrauma/BarotraumaServer/Source/Networking/Voip/VoipServer.cs @@ -78,6 +78,7 @@ namespace Barotrauma.Networking bool senderSpectating = sender.Character == null || sender.Character.IsDead; //spectators cannot speak with in-game players or vice versa + //TODO: allow spectators to hear the voice chat if close enough to the speaker? if (recipientSpectating != senderSpectating) { return false; } //both spectating, no need to do radio/distance checks diff --git a/Barotrauma/BarotraumaShared/Source/Networking/ChatMessage.cs b/Barotrauma/BarotraumaShared/Source/Networking/ChatMessage.cs index 2876896aa..e40d6c714 100644 --- a/Barotrauma/BarotraumaShared/Source/Networking/ChatMessage.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/ChatMessage.cs @@ -129,10 +129,10 @@ namespace Barotrauma.Networking if (listener.WorldPosition == sender.WorldPosition) { return 0.0f; } float dist = Vector2.Distance(listener.WorldPosition, sender.WorldPosition); - if (dist > range) { return 0.0f; } + if (dist > range) { return 1.0f; } if (Submarine.CheckVisibility(listener.SimPosition, sender.SimPosition) != null) dist = (dist + 100f) * obstructionmult; - if (dist > range) { return 0.0f; } + if (dist > range) { return 1.0f; } return dist / range; } @@ -152,7 +152,7 @@ namespace Barotrauma.Networking public static string ApplyDistanceEffect(string text, float garbleAmount) { if (garbleAmount < 0.3f) return text; - if (garbleAmount > 1.0f) return ""; + if (garbleAmount >= 1.0f) return ""; int startIndex = Math.Max(text.IndexOf(':') + 1, 1); diff --git a/git-strip-merge b/git-strip-merge index 318a93d46..3bae2789e 100644 --- a/git-strip-merge +++ b/git-strip-merge @@ -120,8 +120,21 @@ gitbranch() { original=$(gitbranch HEAD) branchsha=$(gitsha "$branch") +branchshortsha="${branchsha:0:7}" -logmsg="$(git log .."$branchsha")" +#get the hash of the last merged remote commit from the latest commit msg in this repo +#assumes that the commit message starts with hash1...hash2 +prevcommitmsg="$(git log -1 --pretty=%B)" +prevcommitsha="${prevcommitmsg:10:7}" + +#create a commit message for out new "merge commit" +# hash1...hash2 + logs of the merged commits +logmsg="$prevcommitsha" +logmsg+="..." +logmsg+="$branchshortsha" +logmsg+=" + +$(git log "$prevcommitsha"..."$branchsha")" trap 'git checkout --quiet "$original"' EXIT @@ -130,11 +143,10 @@ git rm -rf -r "${files[@]}" "${quiet[@]}" && git commit -m "$msgcommit" "${quiet[@]}" && newsha=$(gitsha HEAD) && git checkout "$original" "${quiet[@]}" && -#original -#git merge -m "$msgmerge" "${mergeopts[@]}" "$newsha" -#baro additions -git merge -m "$msgmerge" "--squash" "$newsha" +git merge -m "$msgmerge" -X theirs "--squash" "$newsha" +git checkout HEAD .gitignore git commit -m "$logmsg" -#./git-strip-merge --no-commit --no-ff barotrauma-development/dev -f Barotrauma/BarotraumaShared/Content/* +#example usage +#./git-strip-merge barotrauma-development/dev -f Barotrauma/BarotraumaShared/Content/*