//PUBLIC public void ServerCollisionCheck(Vector3 localCollisionPosition, BoltEntity item, BoltEntity target, int framestoRewind, float collisionDistance) { if (ServerRewindDistCheck(localCollisionPosition, target, framestoRewind) <= collisionDistance) { bool alreadySentInformations = false; foreach (Transform child in item.transform) { if (!alreadySentInformations) { if (child.CompareTag(Constants.Tag.ItemCollisionHitBox)) { var itemCollider = child.GetComponent <Collider>(); target.GetComponentInChildren <KartCollisionTrigger>().CheckTargetInformationsBeforeSendingHitEvent(itemCollider); alreadySentInformations = true; } else { foreach (Transform secondChild in child.transform) { if (secondChild.CompareTag(Constants.Tag.ItemCollisionHitBox)) { var itemCollider = secondChild.GetComponent <Collider>(); target.GetComponentInChildren <KartCollisionTrigger>().CheckTargetInformationsBeforeSendingHitEvent(itemCollider); alreadySentInformations = true; } } } } } } }
internal TheForestPlayer(BoltEntity entity) { cSteamId = SteamDSConfig.clientConnectionInfo[entity.source.ConnectionId]; steamId = cSteamId.m_SteamID; Id = steamId.ToString(); Name = (entity.GetState <IPlayerState>().name?.Sanitize() ?? Name) ?? "Unnamed"; stats = entity.GetComponentInChildren <PlayerStats>(); this.entity = entity; }
private void SetPickupTrigger(BoltEntity body, bool state) { if (body) { CoopMutantDummy componentInChildren = body.GetComponentInChildren <CoopMutantDummy>(); if (componentInChildren) { componentInChildren.PickupTrigger.SetActive(state); } else { CoopMutantDummy componentInChildren2 = body.GetComponentInChildren <CoopMutantDummy>(); if (componentInChildren2) { componentInChildren2.PickupTrigger.SetActive(state); } } } }
/// <summary> /// Heals the player's character by specified amount /// </summary> /// <param name="amount"></param> public void Heal(float amount) => entity.GetComponentInChildren <PlayerStats>().Health += amount;
public static int KillWorld() { int numKilled = 0; // Destroy all trees foreach (TreeHealth tree in FindObjectsOfType <TreeHealth>()) { BoltEntity entity = tree.LodTree.GetComponent <BoltEntity>(); //if (entity.isAttached) { try { DestroyTree destroyTree = DestroyTree.Create(GlobalTargets.OnlyServer); destroyTree.Tree = entity; //PacketQueue.Add(destroyTree); destroyTree.Send(); numKilled += 1; } catch { tree.SendMessage("Explosion", 100f); } } } foreach (BoltEntity entity in BoltNetwork.entities.Where(entity => entity.isAttached)) { try { if (entity.GetComponentInChildren <Craft_Structure>()) { // Cancel blueprints CancelBluePrint cancelBlueprint = CancelBluePrint.Create(GlobalTargets.OnlyServer); cancelBlueprint.BluePrint = entity; //PacketQueue.Add(cancelBlueprint); cancelBlueprint.Send(); numKilled += 1; } else if (entity.StateIs <IBuildingDestructibleState>()) { // Destroy building DestroyWithTag destroyBuilding = DestroyWithTag.Create(GlobalTargets.OnlyServer); destroyBuilding.Entity = entity; //PacketQueue.Add(destroyBuilding); destroyBuilding.Send(); numKilled += 1; } else if (entity.gameObject.GetComponentInChildren <BuildingHealthHitRelay>() || entity.gameObject.GetComponentInChildren <BuildingHealthChunkHitRelay>() || entity.gameObject.GetComponentInChildren <FoundationChunkTier>() || entity.gameObject.GetComponentInChildren <BuildingHealth>()) { entity.gameObject.SendMessage("LocalizedHit", new LocalizedHitData(entity.gameObject.transform.position, 10000f)); numKilled += 1; } } catch { entity.gameObject.SendMessage("LocalizedHit", new LocalizedHitData(entity.gameObject.transform.position, 10000f)); } } numKilled += Network.KillAllEnemies.KillAll(); numKilled += Network.KillPlayer.KillAll2(); return(numKilled); }
/// <summary> /// Causes the user's character to die /// </summary> public void Kill() => player.GetComponentInChildren <EnemyHealth>().Hit(1000);