Upload from upload_mods.ps1
This commit is contained in:
235
Scripts/ItemAction/ItemActionThrownWeaponRebirth.cs
Normal file
235
Scripts/ItemAction/ItemActionThrownWeaponRebirth.cs
Normal file
@@ -0,0 +1,235 @@
|
||||
using Audio;
|
||||
using System.Globalization;
|
||||
|
||||
public class ItemActionThrownWeaponRebirth : ItemActionThrownWeapon
|
||||
{
|
||||
public new ExplosionData Explosion { get; set; }
|
||||
|
||||
public new int Velocity { get; set; }
|
||||
|
||||
public new float FlyTime { get; set; }
|
||||
|
||||
public new float LifeTime { get; set; }
|
||||
|
||||
public new float CollisionRadius { get; set; }
|
||||
|
||||
public float Gravity { get; set; }
|
||||
|
||||
public override void ReadFrom(DynamicProperties _props)
|
||||
{
|
||||
base.ReadFrom(_props);
|
||||
this.Explosion = new ExplosionData(this.Properties);
|
||||
if (this.Properties.Values.ContainsKey("Velocity"))
|
||||
{
|
||||
this.Velocity = (int)StringParsers.ParseFloat(this.Properties.Values["Velocity"], 0, -1, NumberStyles.Any);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Velocity = 1;
|
||||
}
|
||||
if (this.Properties.Values.ContainsKey("FlyTime"))
|
||||
{
|
||||
this.FlyTime = StringParsers.ParseFloat(this.Properties.Values["FlyTime"], 0, -1, NumberStyles.Any);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.FlyTime = 20f;
|
||||
}
|
||||
if (this.Properties.Values.ContainsKey("LifeTime"))
|
||||
{
|
||||
this.LifeTime = StringParsers.ParseFloat(this.Properties.Values["LifeTime"], 0, -1, NumberStyles.Any);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.LifeTime = 100f;
|
||||
}
|
||||
if (this.Properties.Values.ContainsKey("CollisionRadius"))
|
||||
{
|
||||
this.CollisionRadius = StringParsers.ParseFloat(this.Properties.Values["CollisionRadius"], 0, -1, NumberStyles.Any);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.CollisionRadius = 0.05f;
|
||||
}
|
||||
if (this.Properties.Values.ContainsKey("Gravity"))
|
||||
{
|
||||
this.Gravity = StringParsers.ParseFloat(this.Properties.Values["Gravity"], 0, -1, NumberStyles.Any);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Gravity = -9.81f;
|
||||
}
|
||||
if (_props.Values.ContainsKey("DamageEntity"))
|
||||
{
|
||||
this.damageEntity = StringParsers.ParseFloat(_props.Values["DamageEntity"], 0, -1, NumberStyles.Any);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.damageEntity = 0f;
|
||||
}
|
||||
if (_props.Values.ContainsKey("DamageBlock"))
|
||||
{
|
||||
this.damageBlock = StringParsers.ParseFloat(_props.Values["DamageBlock"], 0, -1, NumberStyles.Any);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.damageBlock = 0f;
|
||||
}
|
||||
if (_props.Values.ContainsKey("Hitmask_override"))
|
||||
{
|
||||
if (_props.Values["Hitmask_override"].Equals("Melee"))
|
||||
{
|
||||
this.hitmaskOverride = 128;
|
||||
return;
|
||||
}
|
||||
if (_props.Values["Hitmask_override"].Equals("Arrow"))
|
||||
{
|
||||
this.hitmaskOverride = 32;
|
||||
return;
|
||||
}
|
||||
if (_props.Values["Hitmask_override"].Equals("Bullet"))
|
||||
{
|
||||
this.hitmaskOverride = 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsActionRunning(ItemActionData _actionData)
|
||||
{
|
||||
//Log.Out("IsActionRunning");
|
||||
return ((ItemActionThrowAway.MyInventoryData)_actionData).m_bActivated;
|
||||
}
|
||||
|
||||
public override void StartHolding(ItemActionData _actionData)
|
||||
{
|
||||
//Log.Out("StartHolding");
|
||||
base.StartHolding(_actionData);
|
||||
ItemActionThrowAway.MyInventoryData myInventoryData = (ItemActionThrowAway.MyInventoryData)_actionData;
|
||||
myInventoryData.m_bActivated = false;
|
||||
myInventoryData.m_ActivateTime = 0f;
|
||||
myInventoryData.m_LastThrowTime = 0f;
|
||||
}
|
||||
|
||||
public override void OnHoldingUpdate(ItemActionData _actionData)
|
||||
{
|
||||
ItemActionThrowAway.MyInventoryData myInventoryData = (ItemActionThrowAway.MyInventoryData)_actionData;
|
||||
float num = SingletonMonoBehaviour<ConnectionManager>.Instance.IsClient ? 0.1f : AnimationDelayData.AnimationDelay[myInventoryData.invData.item.HoldType.Value].RayCast;
|
||||
if (myInventoryData.m_LastThrowTime <= 0f || Time.time - myInventoryData.m_LastThrowTime < num)
|
||||
{
|
||||
return;
|
||||
}
|
||||
GameManager.Instance.ItemActionEffectsServer(myInventoryData.invData.holdingEntity.entityId, myInventoryData.invData.slotIdx, myInventoryData.indexInEntityOfAction, 0, Vector3.zero, Vector3.zero, 0);
|
||||
EntityPlayer primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
|
||||
primaryPlayer.inventory.ForceHoldingItemUpdate();
|
||||
//Log.Out("OnHoldingUpdate");
|
||||
}
|
||||
|
||||
public override void ItemActionEffects(GameManager _gameManager, ItemActionData _actionData, int _firingState, Vector3 _startPos, Vector3 _direction, int _userData = 0)
|
||||
{
|
||||
//Log.Out("ItemActionEffects");
|
||||
_actionData.invData.holdingEntity.emodel.avatarController.TriggerEvent("WeaponFire");
|
||||
(_actionData as ItemActionThrowAway.MyInventoryData).m_LastThrowTime = 0f;
|
||||
if (!_actionData.invData.holdingEntity.isEntityRemote)
|
||||
{
|
||||
this.throwAway(_actionData as ItemActionThrowAway.MyInventoryData);
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExecuteAction(ItemActionData _actionData, bool _bReleased)
|
||||
{
|
||||
//Log.Out("EXECUTEACTION 1");
|
||||
ItemActionThrowAway.MyInventoryData myInventoryData = (ItemActionThrowAway.MyInventoryData)_actionData;
|
||||
if (!myInventoryData.m_bActivated && Time.time - myInventoryData.m_LastThrowTime < this.Delay)
|
||||
{
|
||||
//Log.Out("EXECUTEACTION 1a");
|
||||
return;
|
||||
}
|
||||
//Log.Out("EXECUTEACTION 2");
|
||||
if (_actionData.invData.itemValue.PercentUsesLeft == 0f)
|
||||
{
|
||||
//Log.Out("EXECUTEACTION 2a");
|
||||
if (_bReleased)
|
||||
{
|
||||
EntityPlayerLocal player = _actionData.invData.holdingEntity as EntityPlayerLocal;
|
||||
//Log.Out("EXECUTEACTION 2b");
|
||||
if (this.item.Properties.Values.ContainsKey(ItemClass.PropSoundJammed))
|
||||
{
|
||||
//Log.Out("EXECUTEACTION 2c");
|
||||
Manager.PlayInsidePlayerHead(this.item.Properties.Values[ItemClass.PropSoundJammed], -1, 0f, false);
|
||||
}
|
||||
GameManager.ShowTooltip(player, "ttItemNeedsRepair");
|
||||
}
|
||||
return;
|
||||
}
|
||||
//Log.Out("EXECUTEACTION 3");
|
||||
if (!_bReleased)
|
||||
{
|
||||
//Log.Out("EXECUTEACTION 3a");
|
||||
if (!myInventoryData.m_bActivated && !myInventoryData.m_bCanceled)
|
||||
{
|
||||
//Log.Out("EXECUTEACTION 3b");
|
||||
myInventoryData.m_bActivated = true;
|
||||
myInventoryData.m_ActivateTime = Time.time;
|
||||
}
|
||||
return;
|
||||
}
|
||||
//Log.Out("EXECUTEACTION 4");
|
||||
if (myInventoryData.m_bCanceled)
|
||||
{
|
||||
//Log.Out("EXECUTEACTION 4a");
|
||||
myInventoryData.m_bCanceled = false;
|
||||
return;
|
||||
}
|
||||
//Log.Out("EXECUTEACTION 5");
|
||||
if (!myInventoryData.m_bActivated)
|
||||
{
|
||||
//Log.Out("EXECUTEACTION 5a");
|
||||
return;
|
||||
}
|
||||
|
||||
//Log.Out("EXECUTEACTION 6");
|
||||
myInventoryData.m_ThrowStrength = Mathf.Min(this.maxStrainTime, Time.time - myInventoryData.m_ActivateTime) / this.maxStrainTime * this.maxThrowStrength;
|
||||
myInventoryData.m_LastThrowTime = Time.time;
|
||||
myInventoryData.m_bActivated = false;
|
||||
if (!myInventoryData.invData.holdingEntity.isEntityRemote)
|
||||
{
|
||||
//Log.Out("EXECUTEACTION 6a");
|
||||
EntityPlayer primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
|
||||
|
||||
int itemIndex = primaryPlayer.inventory.GetFocusedItemIdx();
|
||||
|
||||
ItemValue itemKunai = ItemClass.GetItem("FuriousRamsayKnife004_FR", false);
|
||||
ItemClass itemClassKunai = itemKunai.ItemClass;
|
||||
int itemCountKunai = 0;
|
||||
|
||||
if (itemClassKunai != null)
|
||||
{
|
||||
itemCountKunai = primaryPlayer.inventory.GetItemCount(itemKunai, false, -1, -1);
|
||||
if (itemCountKunai > 1)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
//Log.Out("EXECUTEACTION 7");
|
||||
if (this.soundStart != null)
|
||||
{
|
||||
//Log.Out("EXECUTEACTION 7a");
|
||||
myInventoryData.invData.holdingEntity.PlayOneShot(this.soundStart, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void CancelAction(ItemActionData _actionData)
|
||||
{
|
||||
//Log.Out("CancelAction");
|
||||
ItemActionThrowAway.MyInventoryData myInventoryData = (ItemActionThrowAway.MyInventoryData)_actionData;
|
||||
myInventoryData.invData.holdingEntity.emodel.avatarController.TriggerEvent("WeaponPreFireCancel");
|
||||
myInventoryData.m_bActivated = false;
|
||||
myInventoryData.m_bCanceled = true;
|
||||
myInventoryData.m_ActivateTime = 0f;
|
||||
myInventoryData.m_LastThrowTime = 0f;
|
||||
}
|
||||
|
||||
private FastTags<TagGroup.Global> usePassedInTransformTag = FastTags<TagGroup.Global>.Parse("usePassedInTransform");
|
||||
private FastTags<TagGroup.Global> tmpTag;
|
||||
}
|
||||
Reference in New Issue
Block a user