Upload from upload_mods.ps1
This commit is contained in:
74
Score/Other/AvatarController.cs
Normal file
74
Score/Other/AvatarController.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Harmony.AvatarControllerPatch
|
||||
{
|
||||
public class AvatarControllerSetTrig
|
||||
{
|
||||
[HarmonyPatch(typeof(AvatarController))]
|
||||
[HarmonyPatch("SetCrouching")]
|
||||
public class AvatarControllerSetCrouching
|
||||
{
|
||||
private static readonly int IsCrouchingHash = Animator.StringToHash("IsCrouching");
|
||||
public static bool Prefix(global::AvatarController __instance, Animator ___anim, bool _bEnable, Dictionary<int, AnimParamData> ___ChangedAnimationParameters, global::EntityAlive ___entity)
|
||||
{
|
||||
if (___anim == null || ___anim.GetBool(IsCrouchingHash) == _bEnable) return true;
|
||||
___anim.SetBool(IsCrouchingHash, _bEnable);
|
||||
if (IsCrouchingHash == AvatarController.isFPVHash)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (!___entity.isEntityRemote)
|
||||
{
|
||||
___ChangedAnimationParameters[IsCrouchingHash] = new AnimParamData(IsCrouchingHash, AnimParamData.ValueTypes.Bool, _bEnable);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AvatarZombieController))]
|
||||
[HarmonyPatch("FindBodyParts")]
|
||||
public class AvatarControllerFindBodyParts
|
||||
{
|
||||
public static void Postfix(global::AvatarZombieController __instance, global::EntityAlive ___entity, Transform ___bipedT, ref Transform ___rightHandT)
|
||||
{
|
||||
if (___entity is not EntityAliveV2 entityAlive) return;
|
||||
|
||||
// Since we allow weapon switching, the right hand transform may change depending on the weapon.
|
||||
// Re-read the right hand transform, which will give it the option to specify another one through a property entry on the item.
|
||||
___rightHandT = ___bipedT.FindInChilds(entityAlive.GetRightHandTransformName(), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HarmonyPatch(typeof(AvatarZombieController))]
|
||||
[HarmonyPatch("Update")]
|
||||
public class AvatarControllerUpdate
|
||||
{
|
||||
public static void Postfix(global::AvatarZombieController __instance, global::EntityAlive ___entity)
|
||||
{
|
||||
if (___entity == null) return;
|
||||
if (___entity is not EntityAliveV2) return;
|
||||
if (___entity.IsFlyMode.Value) return;
|
||||
|
||||
|
||||
__instance.TryGetFloat(AvatarController.forwardHash, out var num);
|
||||
__instance.TryGetFloat(AvatarController.strafeHash, out var num2);
|
||||
|
||||
if (num < 0.01)
|
||||
{
|
||||
__instance.UpdateFloat(AvatarController.forwardHash, 0f, false);
|
||||
}
|
||||
|
||||
if (num2 < 0.01)
|
||||
{
|
||||
__instance.UpdateFloat(AvatarController.strafeHash, 0f, false);
|
||||
}
|
||||
|
||||
if (num < 0.01f || num2 < 0.01f)
|
||||
{
|
||||
__instance.UpdateBool(AvatarController.isMovingHash, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
67
Score/Other/DialogClose.cs
Normal file
67
Score/Other/DialogClose.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
namespace Harmony.Dialog
|
||||
{
|
||||
|
||||
// Removes the custom IsBusy bool, which pauses custom NPCs in their activities, allowing the player to talk to them.
|
||||
[HarmonyPatch(typeof(XUiC_DialogWindowGroup))]
|
||||
[HarmonyPatch("OnClose")]
|
||||
public class OnClose
|
||||
{
|
||||
public static bool Prefix(XUiC_DialogWindowGroup __instance)
|
||||
{
|
||||
//if (!__instance.xui.playerUI.entityPlayer.Buffs.HasCustomVar("CurrentNPC")) return true;
|
||||
int entityID = RebirthVariables.talkingToNPC; // (int)__instance.xui.playerUI.entityPlayer.Buffs.GetCustomVar("CurrentNPC");
|
||||
global::EntityAliveV2 myEntity = __instance.xui.playerUI.entityPlayer.world.GetEntity(entityID) as global::EntityAliveV2;
|
||||
if (myEntity == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
myEntity.Buffs.RemoveBuff("buffTalkingTo");
|
||||
myEntity.Buffs.SetCustomVar("CurrentPlayer", 0f);
|
||||
myEntity.emodel.avatarController.UpdateBool("IsBusy", false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Removes the custom IsBusy bool, which pauses custom NPCs in their activities, allowing the player to talk to them.
|
||||
[HarmonyPatch(typeof(XUiC_DialogWindowGroup))]
|
||||
[HarmonyPatch("OnOpen")]
|
||||
public class OnOpen
|
||||
{
|
||||
public static bool Prefix(XUiC_DialogWindowGroup __instance)
|
||||
{
|
||||
//if (!__instance.xui.playerUI.entityPlayer.Buffs.HasCustomVar("CurrentNPC")) return true;
|
||||
int entityID = RebirthVariables.talkingToNPC; // (int)__instance.xui.playerUI.entityPlayer.Buffs.GetCustomVar("CurrentNPC");
|
||||
global::EntityAliveV2 myEntity = __instance.xui.playerUI.entityPlayer.world.GetEntity(entityID) as global::EntityAliveV2;
|
||||
if (myEntity == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
myEntity.Buffs.AddBuff("buffTalkingTo");
|
||||
myEntity.emodel.avatarController.UpdateBool("IsBusy", true);
|
||||
myEntity.RotateTo(__instance.xui.playerUI.entityPlayer, 360f, 360f);
|
||||
myEntity.SetLookPosition(__instance.xui.playerUI.entityPlayer.getHeadPosition());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(XUiC_LootWindowGroup))]
|
||||
[HarmonyPatch("OnClose")]
|
||||
public class XUiC_LootWindowGroupOnClose
|
||||
{
|
||||
public static bool Prefix(XUiC_DialogWindowGroup __instance)
|
||||
{
|
||||
if (!__instance.xui.playerUI.entityPlayer.Buffs.HasCustomVar("CurrentNPC")) return true;
|
||||
int entityID = (int)__instance.xui.playerUI.entityPlayer.Buffs.GetCustomVar("CurrentNPC");
|
||||
global::EntityAliveV2 myEntity = __instance.xui.playerUI.entityPlayer.world.GetEntity(entityID) as global::EntityAliveV2;
|
||||
if (myEntity == null) return true;
|
||||
myEntity.UpdateWeapon();
|
||||
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
|
||||
{
|
||||
//myEntity.SendSyncData();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
50
Score/Other/DialogRequirementHasBuffSDX.cs
Normal file
50
Score/Other/DialogRequirementHasBuffSDX.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Match at least one of these buffs, by default.
|
||||
* <requirement type="HasBuffSDX, SCore" requirementtype="Hide" value="buffCursed,buffGodMode,buffImagination" />
|
||||
|
||||
* Do not have these buffs
|
||||
* <requirement type="HasBuffSDX, SCore" requirementtype="Hide" value="!buffCursed" " />
|
||||
*/
|
||||
|
||||
using System.Linq;
|
||||
|
||||
public class DialogRequirementHasBuffSDX : BaseDialogRequirement
|
||||
{
|
||||
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
|
||||
{
|
||||
var matches = -1;
|
||||
|
||||
// If there's more than one buff listed, loop around, recording how many we match.
|
||||
string[] array = Value.Split(new char[]
|
||||
{
|
||||
','
|
||||
});
|
||||
if (Value.Contains(","))
|
||||
{
|
||||
matches = array.Count(t => player.Buffs.HasBuff(t));
|
||||
if (matches > 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reverse condition on the buff.
|
||||
if (Value.StartsWith("!"))
|
||||
{
|
||||
var tempBuff = Value.Replace("!", "");
|
||||
if (!player.Buffs.HasBuff(tempBuff))
|
||||
return true;
|
||||
}
|
||||
// If no operator, just check if we have it
|
||||
if (player.Buffs.HasBuff(Value))
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
30
Score/Other/ItemActionLauncherSDX.cs
Normal file
30
Score/Other/ItemActionLauncherSDX.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
class ItemActionLauncherSDX : ItemActionLauncher
|
||||
{
|
||||
public override void StartHolding(ItemActionData _action)
|
||||
{
|
||||
// Launchers being held by NPCs don't appear to be loading their ammo properly on spawn in, so they are just shooting blanks.
|
||||
if (_action.invData.itemValue.Meta == 0)
|
||||
_action.invData.itemValue.Meta = 1;
|
||||
base.StartHolding(_action);
|
||||
}
|
||||
|
||||
public override void ItemActionEffects(GameManager _gameManager, ItemActionData _actionData, int _firingState, Vector3 _startPos, Vector3 _direction, int _userData = 0)
|
||||
{
|
||||
base.ItemActionEffects(_gameManager, _actionData, _firingState, _startPos, _direction, _userData);
|
||||
ItemActionRanged.ItemActionDataRanged itemActionDataRanged = (ItemActionRanged.ItemActionDataRanged)_actionData;
|
||||
itemActionDataRanged.invData.itemValue.Meta = 0;
|
||||
}
|
||||
|
||||
public override void ExecuteAction(ItemActionData _actionData, bool _bReleased)
|
||||
{
|
||||
base.ExecuteAction(_actionData, _bReleased);
|
||||
if (_bReleased)
|
||||
return;
|
||||
var itemActionDataRanged = (ItemActionRanged.ItemActionDataRanged)_actionData;
|
||||
if (itemActionDataRanged.isReloading)
|
||||
return;
|
||||
|
||||
// We were having trouble getting the NPCs to properly reload, so here we go!
|
||||
StartHolding(_actionData);
|
||||
}
|
||||
}
|
||||
71
Score/Other/ItemActionMeleeSDX.cs
Normal file
71
Score/Other/ItemActionMeleeSDX.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
class ItemActionMeleeSDX : ItemActionMelee
|
||||
{
|
||||
// This is a copy of the GetExecuteActionTarget() minus the EntityEnemy check on the line 32 (holdingEntity.IsBreakingBlocks)
|
||||
public override WorldRayHitInfo GetExecuteActionTarget(ItemActionData _actionData)
|
||||
{
|
||||
ItemActionMelee.InventoryDataMelee inventoryDataMelee = (ItemActionMelee.InventoryDataMelee)_actionData;
|
||||
EntityAlive holdingEntity = inventoryDataMelee.invData.holdingEntity;
|
||||
inventoryDataMelee.ray = holdingEntity.GetLookRay();
|
||||
if (holdingEntity.IsBreakingBlocks)
|
||||
{
|
||||
if (inventoryDataMelee.ray.direction.y < 0f)
|
||||
{
|
||||
inventoryDataMelee.ray.direction = new Vector3(inventoryDataMelee.ray.direction.x, 0f, inventoryDataMelee.ray.direction.z);
|
||||
ItemActionMelee.InventoryDataMelee inventoryDataMelee2 = inventoryDataMelee;
|
||||
inventoryDataMelee2.ray.origin = inventoryDataMelee2.ray.origin + new Vector3(0f, -0.7f, 0f);
|
||||
}
|
||||
}
|
||||
else if (holdingEntity.GetAttackTarget() != null)
|
||||
{
|
||||
Vector3 direction = holdingEntity.GetAttackTargetHitPosition() - inventoryDataMelee.ray.origin;
|
||||
inventoryDataMelee.ray = new Ray(inventoryDataMelee.ray.origin, direction);
|
||||
}
|
||||
ItemActionMelee.InventoryDataMelee inventoryDataMelee3 = inventoryDataMelee;
|
||||
inventoryDataMelee3.ray.origin = inventoryDataMelee3.ray.origin - 0.15f * inventoryDataMelee.ray.direction;
|
||||
int modelLayer = holdingEntity.GetModelLayer();
|
||||
holdingEntity.SetModelLayer(2, false);
|
||||
float distance = Utils.FastMax(this.Range, this.BlockRange) + 0.15f;
|
||||
if (holdingEntity.IsBreakingBlocks)
|
||||
{
|
||||
Voxel.Raycast(inventoryDataMelee.invData.world, inventoryDataMelee.ray, distance, 1073807360, 128, 0.4f);
|
||||
}
|
||||
else
|
||||
{
|
||||
EntityAlive x = null;
|
||||
int layerMask = -538767381;
|
||||
if (Voxel.Raycast(inventoryDataMelee.invData.world, inventoryDataMelee.ray, distance, layerMask, 128, this.SphereRadius))
|
||||
{
|
||||
x = (ItemActionAttack.GetEntityFromHit(Voxel.voxelRayHitInfo) as EntityAlive);
|
||||
}
|
||||
if (x == null)
|
||||
{
|
||||
Voxel.Raycast(inventoryDataMelee.invData.world, inventoryDataMelee.ray, distance, -538488837, 128, this.SphereRadius);
|
||||
}
|
||||
}
|
||||
holdingEntity.SetModelLayer(modelLayer, false);
|
||||
return _actionData.GetUpdatedHitInfo();
|
||||
}
|
||||
|
||||
/*public override void hitTheTarget(
|
||||
ItemActionMelee.InventoryDataMelee _actionData,
|
||||
WorldRayHitInfo hitInfo,
|
||||
float damageScale)
|
||||
{
|
||||
EntityAlive holdingEntity = _actionData.invData.holdingEntity;
|
||||
ItemValue itemValue = _actionData.invData.itemValue;
|
||||
float _weaponCondition = 1f;
|
||||
if (itemValue.MaxUseTimes > 0)
|
||||
_weaponCondition = ((float)itemValue.MaxUseTimes - itemValue.UseTimes) / (float)itemValue.MaxUseTimes;
|
||||
float _originalValue = Mathf.Clamp01(_actionData.invData.item.CritChance.Value * (holdingEntity.Stamina / holdingEntity.Stats.Stamina.Max));
|
||||
float _criticalHitChanceOLD = EffectManager.GetValue(PassiveEffects.CriticalChance, itemValue, _originalValue, holdingEntity);
|
||||
_actionData.attackDetails.WeaponTypeTag = ItemActionAttack.MeleeTag;
|
||||
int _flags = 1;
|
||||
if (this.bUseParticleHarvesting && (this.particleHarvestingCategory == null || this.particleHarvestingCategory == this.item.MadeOfMaterial.id))
|
||||
_flags |= 4;
|
||||
float _blockDamage = this.GetDamageBlock(itemValue, ItemActionAttack.GetBlockHit(_actionData.invData.world, hitInfo), holdingEntity, _actionData.indexInEntityOfAction) * damageScale;
|
||||
float damageEntity = this.GetDamageEntity(itemValue, holdingEntity, _actionData.indexInEntityOfAction);
|
||||
|
||||
ItemActionAttack.Hit(hitInfo, holdingEntity.entityId, this.DamageType == EnumDamageTypes.None ? EnumDamageTypes.Bashing : this.DamageType, _blockDamage, damageEntity, holdingEntity.Stats.Stamina.ValuePercent, _weaponCondition, _criticalHitChanceOLD, ItemAction.GetDismemberChance((ItemActionData)_actionData, hitInfo), this.item.MadeOfMaterial.SurfaceCategory, this.damageMultiplier, this.getBuffActions((ItemActionData)_actionData), _actionData.attackDetails, _flags, this.ActionExp, this.ActionExpBonusMultiplier, (ItemActionAttack)this, this.ToolBonuses, _actionData.bHarvesting ? ItemActionAttack.EnumAttackMode.RealAndHarvesting : ItemActionAttack.EnumAttackMode.RealNoHarvesting);
|
||||
GameUtils.HarvestOnAttack((ItemActionData)_actionData, this.ToolBonuses);
|
||||
}*/
|
||||
}
|
||||
53
Score/Other/MinEventActionAnimatorSetIntSDX.cs
Normal file
53
Score/Other/MinEventActionAnimatorSetIntSDX.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System.Globalization;
|
||||
using System.Xml.Linq;
|
||||
|
||||
public class MinEventActionAnimatorSetIntSDX : MinEventActionTargetedBase
|
||||
{
|
||||
private string _property;
|
||||
private float _value;
|
||||
private bool _cvarRef;
|
||||
private string _refCvarName = string.Empty;
|
||||
|
||||
public override void Execute(MinEventParams @params)
|
||||
{
|
||||
for (var i = 0; i < targets.Count; i++)
|
||||
{
|
||||
if (targets[i].emodel == null || this.targets[i].emodel.avatarController == null) continue;
|
||||
if (_cvarRef)
|
||||
{
|
||||
_value = targets[i].Buffs.GetCustomVar(_refCvarName, 0f);
|
||||
}
|
||||
|
||||
targets[i].emodel.avatarController.UpdateInt(_property, (int)_value, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ParseXmlAttribute(XAttribute attribute)
|
||||
{
|
||||
var flag = base.ParseXmlAttribute(attribute);
|
||||
if (flag) return true;
|
||||
var localName = attribute.Name.LocalName;
|
||||
switch (localName)
|
||||
{
|
||||
case "property":
|
||||
_property = attribute.Value;
|
||||
return true;
|
||||
case "value":
|
||||
{
|
||||
if (attribute.Value.StartsWith("@"))
|
||||
{
|
||||
_cvarRef = true;
|
||||
_refCvarName = attribute.Value.Substring(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_value = StringParsers.ParseFloat(attribute.Value, 0, -1, NumberStyles.Any);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
53
Score/Other/NetPackageWeaponSwap.cs
Normal file
53
Score/Other/NetPackageWeaponSwap.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
public class NetPackageWeaponSwap : NetPackage
|
||||
{
|
||||
private int entityId;
|
||||
private string item;
|
||||
|
||||
public NetPackageWeaponSwap Setup(EntityAlive _entity, string _item)
|
||||
{
|
||||
entityId = _entity.entityId;
|
||||
item = _item;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
entityId = _reader.ReadInt32();
|
||||
item = _reader.ReadString();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
_writer.Write(entityId);
|
||||
_writer.Write(item);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
if (_world == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// If you are the server, send it out to the clients.
|
||||
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
|
||||
{
|
||||
var entity = _world.GetEntity(entityId) as EntityAlive;
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(
|
||||
NetPackageManager.GetPackage<NetPackageWeaponSwap>().Setup(entity, item), false, -1,
|
||||
base.Sender.entityId, -1, null, 192);
|
||||
return;
|
||||
}
|
||||
|
||||
var entityAlive = _world.GetEntity(entityId) as EntityAliveV2;
|
||||
if (!entityAlive) return;
|
||||
var itemValue = ItemClass.GetItem(item);
|
||||
//entityAlive.UpdateWeapon(itemValue);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user