Welding tool, plasma cutter & misc item fixes/improvements
This commit is contained in:
@@ -356,7 +356,7 @@ namespace Subsurface
|
||||
/// <summary>
|
||||
/// Control the characte
|
||||
/// </summary>
|
||||
public void Control(Camera cam, bool forcePick=false)
|
||||
public void Control(float deltaTime, Camera cam, bool forcePick=false)
|
||||
{
|
||||
if (isDead) return;
|
||||
|
||||
@@ -383,15 +383,15 @@ namespace Subsurface
|
||||
if (selectedItems[i] == null) continue;
|
||||
if (i == 1 && selectedItems[0] == selectedItems[1]) continue;
|
||||
|
||||
if (actionKeyDown.State) selectedItems[i].Use(this);
|
||||
if (secondaryKeyDown.State && selectedItems[i] != null) selectedItems[i].SecondaryUse(this);
|
||||
if (actionKeyDown.State) selectedItems[i].Use(deltaTime, this);
|
||||
if (secondaryKeyDown.State && selectedItems[i] != null) selectedItems[i].SecondaryUse(deltaTime, this);
|
||||
|
||||
}
|
||||
|
||||
if (selectedConstruction != null)
|
||||
{
|
||||
if (actionKeyDown.State) selectedConstruction.Use(this);
|
||||
if (secondaryKeyDown.State) selectedConstruction.SecondaryUse(this);
|
||||
if (actionKeyDown.State) selectedConstruction.Use(deltaTime, this);
|
||||
if (secondaryKeyDown.State) selectedConstruction.SecondaryUse(deltaTime, this);
|
||||
}
|
||||
|
||||
if (IsNetworkPlayer)
|
||||
@@ -522,8 +522,8 @@ namespace Subsurface
|
||||
}
|
||||
|
||||
if (controlled == this) ControlLocalPlayer(cam);
|
||||
|
||||
Control(cam);
|
||||
|
||||
Control(deltaTime, cam);
|
||||
|
||||
UpdateSightRange();
|
||||
aiTarget.SoundRange = 0.0f;
|
||||
@@ -781,7 +781,7 @@ namespace Subsurface
|
||||
new NetworkEvent(NetworkEventType.KillCharacter, ID, false);
|
||||
}
|
||||
|
||||
if (Game1.GameSession.crewManager!=null)
|
||||
if (Game1.GameSession!=null && Game1.GameSession.crewManager != null)
|
||||
{
|
||||
Game1.GameSession.crewManager.KillCharacter(this);
|
||||
}
|
||||
|
||||
@@ -14,9 +14,7 @@ namespace Subsurface
|
||||
private Item item;
|
||||
|
||||
private Character character;
|
||||
|
||||
private Limb limb;
|
||||
|
||||
|
||||
public float Timer
|
||||
{
|
||||
get { return timer; }
|
||||
@@ -28,13 +26,12 @@ namespace Subsurface
|
||||
delay = ToolBox.GetAttributeFloat(element, "delay", 1.0f);
|
||||
}
|
||||
|
||||
public override void Apply(ActionType type, float deltaTime, Item item, Character character = null, Limb limb = null)
|
||||
public override void Apply(ActionType type, float deltaTime, Item item, Character character = null)
|
||||
{
|
||||
if (this.type != type) return;
|
||||
|
||||
this.item = item;
|
||||
this.character = character;
|
||||
this.limb = limb;
|
||||
|
||||
timer = delay;
|
||||
|
||||
@@ -47,7 +44,7 @@ namespace Subsurface
|
||||
|
||||
if (timer > 0.0f) return;
|
||||
|
||||
base.Apply(1.0f, character, item, limb);
|
||||
base.Apply(1.0f, character, item);
|
||||
list.Remove(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
@@ -10,7 +11,7 @@ namespace Subsurface
|
||||
[Flags]
|
||||
public enum Target
|
||||
{
|
||||
This = 1, Parent = 2, Character = 4, Contained = 8, Nearby = 16
|
||||
This = 1, Parent = 2, Character = 4, Contained = 8, Nearby = 16, UseTarget=32
|
||||
}
|
||||
|
||||
private Target targets;
|
||||
@@ -142,14 +143,34 @@ namespace Subsurface
|
||||
}
|
||||
|
||||
|
||||
public virtual void Apply(ActionType type, float deltaTime, Item item, Character character = null, Limb limb = null)
|
||||
public virtual void Apply(ActionType type, float deltaTime, Item item, Character character = null)
|
||||
{
|
||||
if (this.type == type) Apply(deltaTime, character, item);
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected virtual void Apply(float deltaTime, Character character, Item item, Limb limb = null)
|
||||
public virtual void Apply(ActionType type, float deltaTime, Vector2 position, IPropertyObject target)
|
||||
{
|
||||
if (!targetNames.Contains(target.Name)) return;
|
||||
if (this.type == type) Apply(deltaTime, position, target);
|
||||
}
|
||||
|
||||
protected virtual void Apply(float deltaTime, Vector2 position, IPropertyObject target)
|
||||
{
|
||||
if (explosion != null) explosion.Explode(position);
|
||||
|
||||
if (sound != null) sound.Play(1.0f, 1000.0f, position);
|
||||
|
||||
for (int i = 0; i < propertyNames.Count(); i++)
|
||||
{
|
||||
ObjectProperty property;
|
||||
if (target.ObjectProperties.TryGetValue(propertyNames[i], out property))
|
||||
{
|
||||
ApplyToProperty(property, propertyEffects[i], deltaTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Apply(float deltaTime, Character character, Item item)
|
||||
{
|
||||
if (explosion != null) explosion.Explode(item.SimPosition);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user