public bool UseItem(Humanoid user, ItemDrop.ItemData item) { if (item.m_shared.m_buildPieces) { //Build tool return(false); } if (Player.m_localPlayer.InPlaceMode()) { return(false); } string seedName = item.m_shared.m_name; if (!seedPrefabMap.ContainsKey(seedName)) { if (GetRestrict() != "") { //Unrestrict seedName = ""; user.Message(MessageHud.MessageType.Center, "$message_seed_totem_unrestricted"); } else { user.Message(MessageHud.MessageType.Center, "$message_seed_totem_not_a_seed"); return(false); } } logger.LogDebug("Restricting to " + seedName); m_nview.InvokeRPC("Restrict", seedName); return(true); }
public bool UseItem(Humanoid user, ItemDrop.ItemData item) { Debug.Log("Using item " + item.m_shared.m_name); if (AcceptItem(item)) { if (!HasRoom(item)) { if (item.m_shared.m_name == "$" + coreSlotKey) { user.Message(MessageHud.MessageType.Center, "$" + maxSlotsReached); return(true); } else { if (MaximumSlotsReached()) { user.Message(MessageHud.MessageType.Center, "$" + noSlotsAvailable_maxSlots); return(true); } else { user.Message(MessageHud.MessageType.Center, "$" + noSlotsAvailable_addSlots); return(true); } } } m_nview.InvokeRPC("AddCore", item.m_shared.m_name); user.GetInventory().RemoveOneItem(item); return(true); } return(false); }
void OnTriggerEnter(Collider other) { FPSPlayer player = other.GetComponent <FPSPlayer> (); if (player != null && InRange(triggerDistance, player.transform)) { if (CheckVisibility(player, triggerDistance * 1.2f)) { Explode(); } else { // Player is in range but behind an object playerInRange = player; } } Humanoid humanoid = player; HitBox hitbox = other.GetComponent <HitBox> (); if (hitbox != null) { humanoid = hitbox.Enemy; } if (humanoid != null && !inRangeHumanoids.Contains(humanoid)) { inRangeHumanoids.Add(humanoid); } }
public static bool SetupVisEquipment_Prefix(Humanoid __instance, VisEquipment visEq, bool isRagdoll) { if (!isRagdoll) { visEq.SetLeftItem(__instance.m_leftItem != null ? __instance.m_leftItem?.m_dropPrefab?.name : "", __instance.m_leftItem?.m_variant ?? 0); visEq.SetRightItem(__instance.m_rightItem != null ? __instance.m_rightItem?.m_dropPrefab?.name : ""); if (__instance.IsPlayer()) { visEq.SetLeftBackItem(__instance.m_hiddenLeftItem != null ? __instance.m_hiddenLeftItem.m_dropPrefab?.name : "", __instance.m_hiddenLeftItem?.m_variant ?? 0); visEq.SetRightBackItem(__instance.m_hiddenRightItem != null ? __instance.m_hiddenRightItem.m_dropPrefab?.name : ""); } } visEq.SetChestItem(__instance.m_chestItem != null ? __instance.m_chestItem?.m_dropPrefab?.name : ""); visEq.SetLegItem(__instance.m_legItem != null ? __instance.m_legItem?.m_dropPrefab?.name : ""); visEq.SetHelmetItem(__instance.m_helmetItem != null ? __instance.m_helmetItem?.m_dropPrefab?.name : ""); visEq.SetShoulderItem(__instance.m_shoulderItem != null ? __instance.m_shoulderItem?.m_dropPrefab?.name : "", __instance.m_shoulderItem?.m_variant ?? 0); visEq.SetUtilityItem(__instance.m_utilityItem != null ? __instance.m_utilityItem?.m_dropPrefab?.name : ""); if (!__instance.IsPlayer()) { return(false); } visEq.SetBeardItem(__instance.m_beardItem); visEq.SetHairItem(__instance.m_hairItem); return(false); }
void Start() { PlayerHumanoid = new Humanoid(new List <Hobgoblin.Model.Item>(), 10, 1000, 2); _commandManager = new CommandManager(null); ServiceLocator.Instance.AddService(_commandManager); GameObject.FindGameObjectWithTag("Player").GetComponent <Player>(); }
protected void explode() { //Booooom StartCoroutine(LightEffect()); GetComponent <SpriteRenderer>().enabled = false; GetComponent <AudioSource>().Stop(); GetComponent <AudioSource>().PlayOneShot(explosion); explo.Play(); explo2.Play(); fuse.Stop(); sparks.Stop(); float radius = transform.GetComponent <CircleCollider2D>().radius; Collider2D[] col = Physics2D.OverlapCircleAll(transform.position, radius); foreach (Collider2D c in col) { if (c.tag == "Enemy" || c.tag == "Player") { Humanoid h = (Humanoid)c.gameObject.GetComponent <Humanoid>(); float distance = Vector3.Distance(transform.position, h.transform.position); h.controlHitPoints(Mathf.CeilToInt(damage * (1 / distance))); } } playerCamera.shakeCamera(0.3f, 0.5f); exploded = true; }
// Token: 0x06000C72 RID: 3186 RVA: 0x00059310 File Offset: 0x00057510 public bool Interact(Humanoid character, bool repeat) { if (repeat) { return(false); } if (!PrivateArea.CheckAccess(base.transform.position, 0f, true, false)) { return(true); } if (this.GetHoneyLevel() > 0) { this.Extract(); } else { if (!this.CheckBiome()) { character.Message(MessageHud.MessageType.Center, "$piece_beehive_area", 0, null); return(true); } if (!this.HaveFreeSpace()) { character.Message(MessageHud.MessageType.Center, "$piece_beehive_freespace", 0, null); return(true); } if (!EnvMan.instance.IsDaylight()) { character.Message(MessageHud.MessageType.Center, "$piece_beehive_sleep", 0, null); return(true); } character.Message(MessageHud.MessageType.Center, "$piece_beehive_happy", 0, null); } return(true); }
private Humanoid ChooseNewTarget() { Humanoid newTarget = null; if (targets.Count > 0) { float minDistance = Mathf.Infinity; foreach (Humanoid t in targets) { if (!t.GetIncapacitated()) { print(t); float testDistance = Vector3.Distance(transform.position, t.GetPosition()); if (testDistance < minDistance) { minDistance = testDistance; newTarget = t; } } // else // { // targets.Remove(t); // } } } return(newTarget); }
private static bool Prefix(Humanoid __instance) { if (!Configuration.Current.Player.IsEnabled || !Configuration.Current.Player.reequipItemsAfterSwimming) { return(true); } if (__instance.IsPlayer() && __instance.IsSwiming() && !__instance.IsOnGround()) { // The above is only enough to know we will eventually exit swimming, but we still don't know if the items were visible prior or not. // We only want to re-show them if they were shown to begin with, so we need to check. // This is also why this must be a prefix patch; in a postfix patch, the items are already hidden, and we don't know // if they were hidden by UpdateEquipment or by the user far earlier. if (__instance.m_leftItem != null || __instance.m_rightItem != null) { UpdateEquipmentState.shouldReequipItemsAfterSwimming = true; } } else if (__instance.IsPlayer() && !__instance.IsSwiming() && __instance.IsOnGround() && UpdateEquipmentState.shouldReequipItemsAfterSwimming) { __instance.ShowHandItems(); UpdateEquipmentState.shouldReequipItemsAfterSwimming = false; } return(true); }
static void Postfix(Humanoid __instance, ItemDrop.ItemData item, bool __result) { if (__result) { Longship.Instance.EventManager.DispatchEvent(new HumanoidEquipItemEvent(__instance, item)); } }
//Hooks for Harmony patches public List <Inventory> GetInventories(Humanoid player) { //List to support extended inventory from Equipment & Quick Slots return(new List <Inventory> { player.GetInventory() }); }
public static void Prefix(Humanoid __instance, ItemDrop.ItemData item) { if (__instance is Player player) { Reset(player); } }
public void GenerateInhabitants(float PopulationBillions) { _Population = (int)(PopulationBillions * 1000000); _Members = new Entity[_Population]; for (int l = 0; l < _Population; l++) { string[] name = { "Larry", "DeBarry" }; Humanoid add = new Humanoid(1234567890, name, Entity.CanSell.buy); _Members[0] = add; if (l == (int)(_Population * 0.25)) { Console.WriteLine("25%..." + (_Population * 0.25) + " / " + _Population); } else if (l == (int)(_Population * 0.5)) { Console.WriteLine("50%..." + (_Population * 0.5) + " / " + _Population); } else if (l == (int)(_Population * 0.75)) { Console.WriteLine("75%..." + (_Population * 0.75) + " / " + _Population); } } Console.WriteLine("100%..." + (_Population * 1) + " / " + _Population); }
// Token: 0x06000F27 RID: 3879 RVA: 0x0006C3A0 File Offset: 0x0006A5A0 private bool OnAddOre(Switch sw, Humanoid user, ItemDrop.ItemData item) { if (item == null) { item = this.FindCookableItem(user.GetInventory()); if (item == null) { user.Message(MessageHud.MessageType.Center, "$msg_noprocessableitems", 0, null); return(false); } } if (!this.IsItemAllowed(item.m_dropPrefab.name)) { user.Message(MessageHud.MessageType.Center, "$msg_wontwork", 0, null); return(false); } ZLog.Log("trying to add " + item.m_shared.m_name); if (this.GetQueueSize() >= this.m_maxOre) { user.Message(MessageHud.MessageType.Center, "$msg_itsfull", 0, null); return(false); } user.Message(MessageHud.MessageType.Center, "$msg_added " + item.m_shared.m_name, 0, null); user.GetInventory().RemoveItem(item, 1); this.m_nview.InvokeRPC("AddOre", new object[] { item.m_dropPrefab.name }); return(true); }
public bool UseItem(Humanoid user, ItemDrop.ItemData item) { Debug.Log($"Using item {item.m_shared.m_name}:{item.m_shared.m_itemType}"); if (equipmentSlotManager.hasQueuedItem()) { // stop clicking so fast return(false); } if (!this.CanAttach(item)) { user.Message(MessageHud.MessageType.Center, "$ceko_piece_armorstand_cantattach", 0, (Sprite)null); return(true); } if (!this.m_nview.IsOwner()) { this.m_nview.InvokeRPC("RequestOwn", (object[])Array.Empty <object>()); } equipmentSlotManager.queuedItem = item; this.CancelInvoke("UpdateAttach"); this.InvokeRepeating("UpdateAttach", 0.0f, 0.1f); return(true); }
public bool Interact(Humanoid user, bool hold) { if (hold) { return(false); } if (Input.GetKey(KeyCode.LeftShift)) { if (!this.m_nview.IsOwner()) { this.m_nview.InvokeRPC("RequestOwn", (object[])Array.Empty <object>()); } poseManager.setNextPose(); return(true); } else { if (this.HaveAttachment() && this.m_canBeRemoved) { this.m_nview.InvokeRPC("DropItems"); return(true); } } return(false); }
public override bool UseItem(Humanoid user, ItemDrop.ItemData item) { var name = item.m_dropPrefab.name; if (GoodsList.ContainsKey(name)) { var gd = GoodsList[name]; if (item.m_stack >= gd.Value) { var goodItemData = OdinItem.GetItemData(gd.Good); if (user.GetInventory().AddItem(goodItemData)) { user.GetInventory().RemoveItem(item, gd.Value); Say(goodItemData.m_shared.m_description); return(true); } DBG.InfoCT("$op_inventory_full"); return(true); } Say("$op_shaman_notenough"); return(true); } Say("$op_shaman_no"); return(true); }
protected override void OnHit(Vector3 direction, float damageValue, Humanoid predator) { if(GameController.Instance.OnPlayerHPChanged != null) { GameController.Instance.OnPlayerHPChanged(); } }
static bool Prefix(out Vector3 spawnPoint, out Vector3 aimDir, Humanoid ___m_character) { spawnPoint = Vector3.zero; aimDir = Vector3.zero; if (___m_character != Player.m_localPlayer || !VHVRConfig.UseVrControls()) { return(true); } if (EquipScript.getLeft() == EquipType.Bow) { spawnPoint = BowLocalManager.spawnPoint; aimDir = BowLocalManager.aimDir; return(false); } switch (EquipScript.getRight()) { case EquipType.Fishing: spawnPoint = FishingManager.spawnPoint; aimDir = FishingManager.aimDir; return(false); case EquipType.Spear: case EquipType.SpearChitin: spawnPoint = SpearManager.spawnPoint; aimDir = SpearManager.aimDir; return(false); } return(true); }
// Token: 0x0600028A RID: 650 RVA: 0x0001494C File Offset: 0x00012B4C public bool Interact(Humanoid user, bool hold) { if (hold) { return(false); } if (!this.m_nview.IsValid()) { return(false); } string hoverName = this.m_character.GetHoverName(); if (!this.m_character.IsTamed()) { return(false); } if (Time.time - this.m_lastPetTime > 1f) { this.m_lastPetTime = Time.time; this.m_petEffect.Create(this.m_character.GetCenterPoint(), Quaternion.identity, null, 1f); if (this.m_commandable) { this.Command(user); } else { user.Message(MessageHud.MessageType.Center, hoverName + " $hud_tamelove", 0, null); } return(true); } return(false); }
private void Start() { Humanoid hm = GetComponent <Humanoid>(); isFlying = hm.IsFlying; //isFlying is a protected var inside of SteeringBehaviour _target = hm.Target; }
public bool UseItem(Humanoid user, ItemDrop.ItemData item) { foreach (Requirement req in originalPiece.m_resources) { if (req.m_resItem.m_itemData.m_shared.m_name != item.m_shared.m_name) { continue; } string resourceName = GetResourceName(req); if (!PlayerHaveResource(user, resourceName)) { continue; } int currentCount = GetResourceCount(resourceName); int remaining = req.m_amount - currentCount; if (remaining > 0) { m_nView.InvokeRPC("AddResource", resourceName, 1); PlayerRemoveResource(user, resourceName, 1); UpdateHoverText(); return(true); } } return(false); }
// Token: 0x0600028F RID: 655 RVA: 0x00014BA0 File Offset: 0x00012DA0 private void Command(Humanoid user) { this.m_nview.InvokeRPC("Command", new object[] { user.GetZDOID() }); }
public static void Postfix(Humanoid __instance, ItemDrop.ItemData item) { if (EquipmentAndQuickSlots.EquipmentSlotsEnabled.Value && AllowMove && !DoingEquip && __instance != null && __instance.IsPlayer() && __instance.m_nview.IsValid() && item != null) { RefreshEquipmentInSlots(__instance as Player); } }
public static bool Prefix(Humanoid __instance, ItemDrop.ItemData item) { if (!EquipmentAndQuickSlots.EquipmentSlotsEnabled.Value) { return(true); } if (_dropping) { return(false); } if (!__instance.IsPlayer()) { return(true); } _shouldDrop = false; if (item != null && EquipmentAndQuickSlots.IsSlotEquippable(item)) { if (__instance.m_inventory.HaveEmptySlot()) { var correctInventorySlot = __instance.m_inventory.FindEmptySlot(false); //__instance.m_inventory.MoveItemToThis((__instance as Player).GetEquipmentSlotInventory(), item, item.m_stack, correctInventorySlot.x, correctInventorySlot.y); } else { _shouldDrop = true; } } return(true); }
static void Prefix(Humanoid __instance, ref float __state, ItemDrop.ItemData ___m_leftItem) { if (modEnabled.Value && __instance.IsPlayer() && ___m_leftItem != null) { __state = ___m_leftItem.m_durability; } }
static void Postfix(Humanoid __instance, float[] __state, ref ItemDrop.ItemData ___m_chestItem, ref ItemDrop.ItemData ___m_legItem, ref ItemDrop.ItemData ___m_shoulderItem, ref ItemDrop.ItemData ___m_helmetItem) { if (modEnabled.Value && __instance.IsPlayer()) { if (___m_chestItem != null && __state[0] > ___m_chestItem.m_durability) { Dbgl($"chest old {__state[0]} new {___m_chestItem.m_durability} final {__state[0] - (__state[0] - ___m_chestItem.m_durability) * armorDurabilityLossMult.Value}"); ___m_chestItem.m_durability = Mathf.Max(0, __state[0] - (__state[0] - ___m_chestItem.m_durability) * armorDurabilityLossMult.Value); } if (___m_legItem != null && __state[1] > ___m_legItem.m_durability) { Dbgl($"leg old {__state[1]} new {___m_legItem.m_durability} final {__state[1] - (__state[1] - ___m_legItem.m_durability) * armorDurabilityLossMult.Value}"); ___m_legItem.m_durability = Mathf.Max(0, __state[1] - (__state[1] - ___m_legItem.m_durability) * armorDurabilityLossMult.Value); } if (___m_shoulderItem != null && __state[2] > ___m_shoulderItem.m_durability) { Dbgl($"shoulder old {__state[2]} new {___m_shoulderItem.m_durability} final {__state[2] - (__state[2] - ___m_shoulderItem.m_durability) * armorDurabilityLossMult.Value}"); ___m_shoulderItem.m_durability = __state[2] - (__state[2] - ___m_shoulderItem.m_durability) * armorDurabilityLossMult.Value; } if (___m_helmetItem != null && __state[3] > ___m_helmetItem.m_durability) { Dbgl($"helmet old {__state[3]} new {___m_helmetItem.m_durability} final {__state[3] - (__state[3] - ___m_helmetItem.m_durability) * armorDurabilityLossMult.Value}"); ___m_helmetItem.m_durability = __state[3] - (__state[3] - ___m_helmetItem.m_durability) * armorDurabilityLossMult.Value; } } }
void OnTriggerEnter(Collider col) { if ( col.gameObject.tag == tagEnemmy ) { this.hitEnemmy = true; this.victime = col.gameObject.GetComponent<Humanoid>(); } }
void OnTriggerExit(Collider col) { if ( col.gameObject.tag == tagEnemmy ) { this.hitEnemmy = false; this.victime = null; } }
public override void NewTurn(Humanoid activeCharacter) { base.NewTurn(activeCharacter); // TODO:- Need this? winningAction = DecideAction(); Debug.Log("AI winning state: " + winningAction.action.ToString()); NewDelay(); // To Slow stuff Down }
public override bool Interact(Humanoid user, bool hold) { if (hold) { return(false); } return(true); }
static void Postfix(Humanoid __instance, ItemDrop.ItemData item, ref bool __result) { if (!modEnabled.Value || !__instance.IsPlayer() || __result || item.m_shared.m_itemType != ItemDrop.ItemData.ItemType.Utility) { return; } __result = item.m_equiped; }
protected override void OnHit(Vector3 direction, float damageValue, Humanoid predator) { //Loose score if(predator.IsPlayer) { PlayerState.Instance.SubstractScore(ScoreToLoose); } }
public void Shoot(Vector3 InDirection) { if(_playerHumanoidScript == null) { _playerHumanoidScript = GameController.Instance.Player.GetComponent<Humanoid>(); } _myBody.velocity = InDirection * Speed; }
public new bool Interact(Humanoid user, bool hold) { if (!m_ship) { return(false); } return(base.Interact(user, hold)); }
protected void setCible(Humanoid cible) { if (!cible.isAlive()) { this.navAgent.destination = cible.transform.position; return ; } this.navAgent.destination = cible.GetComponent<NavMeshAgent>().transform.position; this.target = cible; }
public void Hit(Vector3 direction, float damageValue, Humanoid predator) { if(_isDead) { return; } HP -= damageValue; if(HP < 0.0f) { HP = 0.0f; } OnHit(direction, damageValue, predator); if(HP <= 0.0f) { Die(); } }
public bool SetTarget(Humanoid target) { if(_target != null && !_target.IsDead && _target.gameObject.layer == LayerMask.NameToLayer("Damagable")) { return false; } _target = target; if(_target == null) { _target = GameController.Instance.Player.GetComponent<Humanoid>(); if(Vector3.Distance(_target.transform.position, transform.position) < 2.5f) { ChangeState(State.ATTACK); } return false; } ChangeState(State.MOVE_TO_TARGET); return true; }
protected override void OnHit(Vector3 direction, float damageValue, Humanoid predator) { _isHit = true; _myPosition = transform.position; _targetPosition = transform.position + direction * damageValue * HitImpactMultiplier; _hitTimer = 0.0f; _hitMultiplier = 5.0f; }
protected abstract void OnHit(Vector3 direction, float damageValue, Humanoid predator);
protected void setDestination(Vector3 dest) { this.navAgent.destination = dest; if (this.target != null && this.target.tag == "Ennemy") { if ( this.target.GetComponent<Zombie>() != null ) this.target.GetComponent<Zombie>().hideUI(); else if (this.target.GetComponent<ZombieBoss>() != null) this.target.GetComponent<ZombieBoss>().hideUI(); } this.target = null; }
protected void updateWeapons() { if (this.target != null && this.target.isAlive() == false) { this.gainXP(this.target.level * 40 + 40); if (this.target.tag == "Ennemy") { if (this.target.GetComponent<Zombie>() != null) this.target.GetComponent<Zombie>().hideUI(); else if (this.target.GetComponent<ZombieBoss>() != null) this.target.GetComponent<ZombieBoss>().hideUI(); } this.target = null; } if (!canAttack()) return; foreach (Weapon weapon in weapons) { if (weapon.hitSomeone()) { int hit = 75 + AGI - weapon.getVictime().AGI; if ( Random.Range (0, 101) < hit) { int damageW = 0; foreach (Weapon w in weapons) damageW += w.damage; weapon.getVictime().receiveDamage( Random.Range (Mindamage, Maxdamage) + damageW); } weapon.disableDoubleHit(); } } }
public void disableDoubleHit() { this.hitEnemmy = false; this.victime = null; }
void Start() { _speed = UnityEngine.Random.Range(MinSpeed, MaxSpeed); _target = GameController.Instance.Player.GetComponent<Humanoid>(); //InvokeRepeating("Attack", 1.0f, 1.0f); }