Unstable 0.1500.5.0 (almost forgor edition 💀)
This commit is contained in:
@@ -12,6 +12,7 @@ namespace Barotrauma
|
||||
|
||||
partial void OnSkillChanged(string skillIdentifier, float prevLevel, float newLevel, Vector2 textPopupPos)
|
||||
{
|
||||
if (Character == null || Character.Removed) { return; }
|
||||
if (!prevSentSkill.ContainsKey(skillIdentifier))
|
||||
{
|
||||
prevSentSkill[skillIdentifier] = prevLevel;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using Barotrauma.Networking;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
partial class AlienRuinMission : Mission
|
||||
{
|
||||
public override void ServerWriteInitial(IWriteMessage msg, Client c)
|
||||
{
|
||||
msg.Write((ushort)existingTargets.Count);
|
||||
foreach (var t in existingTargets)
|
||||
{
|
||||
msg.Write(t != null ? t.ID : Entity.NullEntityID);
|
||||
}
|
||||
msg.Write((ushort)spawnedTargets.Count);
|
||||
foreach (var t in spawnedTargets)
|
||||
{
|
||||
t.WriteSpawnData(msg, t.ID, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,5 +17,10 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
public abstract void ServerWriteInitial(IWriteMessage msg, Client c);
|
||||
|
||||
public virtual void ServerWrite(IWriteMessage msg)
|
||||
{
|
||||
msg.Write((ushort)State);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using Barotrauma.Networking;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
partial class ScanMission : Mission
|
||||
{
|
||||
public override void ServerWriteInitial(IWriteMessage msg, Client c)
|
||||
{
|
||||
msg.Write((ushort)startingItems.Count);
|
||||
foreach (var item in startingItems)
|
||||
{
|
||||
item.WriteSpawnData(msg,
|
||||
item.ID,
|
||||
parentInventoryIDs.ContainsKey(item) ? parentInventoryIDs[item] : Entity.NullEntityID,
|
||||
parentItemContainerIndices.ContainsKey(item) ? parentItemContainerIndices[item] : (byte)0);
|
||||
}
|
||||
ServerWriteScanTargetStatus(msg);
|
||||
}
|
||||
|
||||
public override void ServerWrite(IWriteMessage msg)
|
||||
{
|
||||
base.ServerWrite(msg);
|
||||
ServerWriteScanTargetStatus(msg);
|
||||
}
|
||||
|
||||
private void ServerWriteScanTargetStatus(IWriteMessage msg)
|
||||
{
|
||||
msg.Write((byte)scanTargets.Count);
|
||||
foreach (var kvp in scanTargets)
|
||||
{
|
||||
msg.Write(kvp.Key != null ? kvp.Key.ID : Entity.NullEntityID);
|
||||
msg.Write(kvp.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using Barotrauma.Networking;
|
||||
|
||||
namespace Barotrauma.Items.Components
|
||||
{
|
||||
partial class Scanner : ItemComponent, IServerSerializable
|
||||
{
|
||||
private float LastSentScanTimer { get; set; }
|
||||
|
||||
public void ServerWrite(IWriteMessage msg, Client c, object[] extraData = null)
|
||||
{
|
||||
msg.Write(scanTimer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using Barotrauma.Networking;
|
||||
|
||||
namespace Barotrauma.Items.Components
|
||||
{
|
||||
partial class ButtonTerminal : ItemComponent, IClientSerializable, IServerSerializable
|
||||
{
|
||||
public void ServerRead(ClientNetObject type, IReadMessage msg, Client c)
|
||||
{
|
||||
int signalIndex = msg.ReadRangedInteger(0, Signals.Length - 1);
|
||||
if (!item.CanClientAccess(c)) { return; }
|
||||
if (!SendSignal(signalIndex)) { return; }
|
||||
GameServer.Log($"{GameServer.CharacterLogName(c.Character)} sent a signal \"{Signals[signalIndex]}\" from {item.Name}", ServerLog.MessageType.ItemInteraction);
|
||||
item.CreateServerEvent(this, new object[] { signalIndex });
|
||||
}
|
||||
|
||||
public void ServerWrite(IWriteMessage msg, Client c, object[] extraData = null)
|
||||
{
|
||||
Write(msg, extraData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3791,7 +3791,7 @@ namespace Barotrauma.Networking
|
||||
return preferredClient;
|
||||
}
|
||||
|
||||
public void UpdateMissionState(Mission mission, int state)
|
||||
public void UpdateMissionState(Mission mission)
|
||||
{
|
||||
foreach (var client in connectedClients)
|
||||
{
|
||||
@@ -3799,7 +3799,7 @@ namespace Barotrauma.Networking
|
||||
msg.Write((byte)ServerPacketHeader.MISSION);
|
||||
int missionIndex = GameMain.GameSession.GetMissionIndex(mission);
|
||||
msg.Write((byte)(missionIndex == -1 ? 255: missionIndex));
|
||||
msg.Write((ushort)state);
|
||||
mission?.ServerWrite(msg);
|
||||
serverPeer.Send(msg, client.Connection, DeliveryMethod.Reliable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,11 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
partial class RespawnManager : Entity, IServerSerializable
|
||||
{
|
||||
/// <summary>
|
||||
/// How much skills drop towards the job's default skill levels when respawning midround in the campaign
|
||||
/// </summary>
|
||||
const float SkillReductionOnCampaignMidroundRespawn = 0.5f;
|
||||
|
||||
private DateTime despawnTime;
|
||||
|
||||
private float shuttleEmptyTimer;
|
||||
@@ -361,9 +366,21 @@ namespace Barotrauma.Networking
|
||||
if (!bot && campaign != null)
|
||||
{
|
||||
var matchingData = campaign?.GetClientCharacterData(clients[i]);
|
||||
if (matchingData != null && !matchingData.HasSpawned)
|
||||
if (matchingData != null)
|
||||
{
|
||||
forceSpawnInMainSub = true;
|
||||
if (!matchingData.HasSpawned)
|
||||
{
|
||||
forceSpawnInMainSub = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (Skill skill in characterInfos[i].Job.Skills)
|
||||
{
|
||||
var skillPrefab = characterInfos[i].Job.Prefab.Skills.Find(s => skill.Prefab == s);
|
||||
if (skillPrefab == null) { continue; }
|
||||
skill.Level = MathHelper.Lerp(skill.Level, skillPrefab.LevelRange.X, SkillReductionOnCampaignMidroundRespawn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user