Blowing up the reactor sets karma to 0, all jobs except assistant require a certain karma level
This commit is contained in:
@@ -1565,7 +1565,7 @@ namespace Barotrauma
|
||||
public virtual AttackResult AddDamage(IDamageable attacker, Vector2 worldPosition, Attack attack, float deltaTime, bool playSound = false)
|
||||
{
|
||||
Limb limbHit = null;
|
||||
var attackResult = AddDamage(worldPosition, attack.DamageType, attack.GetDamage(deltaTime), attack.GetBleedingDamage(deltaTime), attack.Stun, playSound, attack.TargetForce, out limbHit);
|
||||
var attackResult = AddDamage(worldPosition, attack.DamageType, attack.GetDamage(deltaTime), attack.GetBleedingDamage(deltaTime), attack.Stun, playSound, attack.TargetForce, out limbHit, attacker);
|
||||
if (limbHit == null) return new AttackResult();
|
||||
|
||||
var attackingCharacter = attacker as Character;
|
||||
@@ -1612,7 +1612,7 @@ namespace Barotrauma
|
||||
return AddDamage(worldPosition, damageType, amount, bleedingAmount, stun, playSound, attackForce, out temp);
|
||||
}
|
||||
|
||||
public AttackResult AddDamage(Vector2 worldPosition, DamageType damageType, float amount, float bleedingAmount, float stun, bool playSound, float attackForce, out Limb hitLimb)
|
||||
public AttackResult AddDamage(Vector2 worldPosition, DamageType damageType, float amount, float bleedingAmount, float stun, bool playSound, float attackForce, out Limb hitLimb,IDamageable attacker=null)
|
||||
{
|
||||
hitLimb = null;
|
||||
|
||||
@@ -1640,7 +1640,7 @@ namespace Barotrauma
|
||||
|
||||
AttackResult attackResult = hitLimb.AddDamage(worldPosition, damageType, amount, bleedingAmount, playSound);
|
||||
|
||||
AddDamage(damageType == DamageType.Burn ? CauseOfDeath.Burn : causeOfDeath, attackResult.Damage, null);
|
||||
AddDamage(damageType == DamageType.Burn ? CauseOfDeath.Burn : causeOfDeath, attackResult.Damage, attacker);
|
||||
|
||||
if (DoesBleed)
|
||||
{
|
||||
|
||||
@@ -47,6 +47,12 @@ namespace Barotrauma
|
||||
private set;
|
||||
}
|
||||
|
||||
public float MinKarma
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public float Commonness
|
||||
{
|
||||
get;
|
||||
@@ -61,6 +67,7 @@ namespace Barotrauma
|
||||
|
||||
MinNumber = element.GetAttributeInt("minnumber", 0);
|
||||
MaxNumber = element.GetAttributeInt("maxnumber", 10);
|
||||
MinKarma = element.GetAttributeFloat("minkarma", 0.0f);
|
||||
|
||||
Commonness = element.GetAttributeInt("commonness", 10);
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ namespace Barotrauma.Items.Components
|
||||
if (progressBar != null) progressBar.Size = new Vector2(60.0f, 20.0f);
|
||||
#endif
|
||||
|
||||
targetStructure.AddDamage(sectionIndex, -StructureFixAmount * degreeOfSuccess);
|
||||
targetStructure.AddDamage(sectionIndex, -StructureFixAmount * degreeOfSuccess,user);
|
||||
|
||||
//if the next section is small enough, apply the effect to it as well
|
||||
//(to make it easier to fix a small "left-over" section)
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private float temperature;
|
||||
|
||||
private Client BlameOnBroken;
|
||||
|
||||
//is automatic temperature control on
|
||||
//(adjusts the cooling rate automatically to keep the
|
||||
//amount of power generated balanced with the load)
|
||||
@@ -326,6 +328,14 @@ namespace Barotrauma.Items.Components
|
||||
if (containedItem == null) continue;
|
||||
containedItem.Condition = 0.0f;
|
||||
}
|
||||
|
||||
if (GameMain.Server != null)
|
||||
{
|
||||
if (GameMain.Server.ConnectedClients.Contains(BlameOnBroken))
|
||||
{
|
||||
BlameOnBroken.Karma = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Pick(Character picker)
|
||||
@@ -387,8 +397,12 @@ namespace Barotrauma.Items.Components
|
||||
float coolingRate = msg.ReadRangedSingle(0.0f, 100.0f, 8);
|
||||
float fissionRate = msg.ReadRangedSingle(0.0f, 100.0f, 8);
|
||||
|
||||
if (!item.CanClientAccess(c)) return;
|
||||
if (!item.CanClientAccess(c)) return;
|
||||
|
||||
if (!autoTemp && AutoTemp) BlameOnBroken = c;
|
||||
if (shutDownTemp > ShutDownTemp) BlameOnBroken = c;
|
||||
if (fissionRate > FissionRate) BlameOnBroken = c;
|
||||
|
||||
AutoTemp = autoTemp;
|
||||
ShutDownTemp = shutDownTemp;
|
||||
|
||||
|
||||
@@ -1329,6 +1329,8 @@ namespace Barotrauma
|
||||
Condition = prefab.Health;
|
||||
}
|
||||
|
||||
c.Karma += 0.4f;
|
||||
|
||||
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
||||
|
||||
break;
|
||||
|
||||
@@ -709,7 +709,7 @@ namespace Barotrauma
|
||||
gapRect.Height += 20;
|
||||
sections[sectionIndex].gap = new Gap(gapRect, !isHorizontal, Submarine);
|
||||
sections[sectionIndex].gap.ConnectedWall = this;
|
||||
AdjustKarma(attacker, 300);
|
||||
//AdjustKarma(attacker, 300);
|
||||
#if CLIENT
|
||||
if(CastShadow) GenerateConvexHull();
|
||||
#endif
|
||||
|
||||
@@ -2082,7 +2082,7 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
//the maximum number of players that can have this job hasn't been reached yet
|
||||
// -> assign it to the client
|
||||
if (assignedClientCount[preferredJob] < preferredJob.MaxNumber)
|
||||
if (assignedClientCount[preferredJob] < preferredJob.MaxNumber && c.Karma >= preferredJob.MinKarma)
|
||||
{
|
||||
c.AssignedJob = preferredJob;
|
||||
assignedClientCount[preferredJob]++;
|
||||
@@ -2092,13 +2092,22 @@ namespace Barotrauma.Networking
|
||||
else if (preferredJob == c.JobPreferences.Last())
|
||||
{
|
||||
//find all jobs that are still available
|
||||
var remainingJobs = JobPrefab.List.FindAll(jp => assignedClientCount[preferredJob] < jp.MaxNumber);
|
||||
var remainingJobs = JobPrefab.List.FindAll(jp => assignedClientCount[preferredJob] < jp.MaxNumber && c.Karma >= jp.MinKarma);
|
||||
|
||||
//all jobs taken, give a random job
|
||||
if (remainingJobs.Count == 0)
|
||||
{
|
||||
DebugConsole.ThrowError("Failed to assign a suitable job for \"" + c.Name + "\" (all jobs already have the maximum numbers of players). Assigning a random job...");
|
||||
c.AssignedJob = JobPrefab.List[Rand.Range(0, JobPrefab.List.Count)];
|
||||
int jobIndex = Rand.Range(0,JobPrefab.List.Count);
|
||||
int skips = 0;
|
||||
while (c.Karma < JobPrefab.List[jobIndex].MinKarma)
|
||||
{
|
||||
jobIndex++;
|
||||
skips++;
|
||||
if (jobIndex >= JobPrefab.List.Count) jobIndex -= JobPrefab.List.Count;
|
||||
if (skips >= JobPrefab.List.Count) break;
|
||||
}
|
||||
c.AssignedJob = JobPrefab.List[jobIndex];
|
||||
assignedClientCount[c.AssignedJob]++;
|
||||
}
|
||||
else //some jobs still left, choose one of them by random
|
||||
@@ -2117,6 +2126,7 @@ namespace Barotrauma.Networking
|
||||
Client preferredClient = null;
|
||||
foreach (Client c in clients)
|
||||
{
|
||||
if (c.Karma < job.MinKarma) continue;
|
||||
int index = c.JobPreferences.IndexOf(job);
|
||||
if (index == -1) index = 1000;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user