mirror of
https://old.git.ood.ovh/eco/server-config.git
synced 2025-07-01 18:46:42 +02:00
File with matutiry
This commit is contained in:
parent
1e928bee81
commit
27919d7e28
74 changed files with 7480 additions and 0 deletions
57
Mods/Organisms/Animal/BighornSheep.cs
Normal file
57
Mods/Organisms/Animal/BighornSheep.cs
Normal file
|
@ -0,0 +1,57 @@
|
|||
namespace Eco.Mods.Organisms
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Eco.Gameplay.Animals;
|
||||
using Eco.Mods.TechTree;
|
||||
using Eco.Shared.Localization;
|
||||
using Eco.Shared.Math;
|
||||
using Eco.Simulation.Agents;
|
||||
using Eco.Simulation.Types;
|
||||
|
||||
public class BighornSheep : AnimalEntity
|
||||
{
|
||||
public BighornSheep(Animal parent, Vector3 pos, bool corpse = false) : base(parent, pos, species, corpse) { }
|
||||
static AnimalSpecies species;
|
||||
public class BighornSheepSpecies : AnimalSpecies
|
||||
{
|
||||
public BighornSheepSpecies() : base()
|
||||
{
|
||||
species = this;
|
||||
this.InstanceType = typeof(BighornSheep);
|
||||
|
||||
// Info
|
||||
this.Name = "BighornSheep";
|
||||
this.DisplayName = Localizer.DoStr("BighornSheep");
|
||||
// Lifetime
|
||||
this.MaturityAgeDays = 1f;
|
||||
// Food
|
||||
this.FoodSources = new List<System.Type>() {typeof(DwarfWillow), typeof(PricklyPear), typeof(Agave), typeof(Sagebrush)};
|
||||
this.CalorieValue = 100f;
|
||||
// Movement
|
||||
this.Flying = false;
|
||||
this.Swimming = false;
|
||||
// Resources
|
||||
this.ResourceList = new List<SpeciesResource>()
|
||||
{
|
||||
new SpeciesResource(typeof(BighornCarcassItem), new Range(1f, 1f)),
|
||||
};
|
||||
this.ResourceBonusAtGrowth = 0.9f;
|
||||
// Behavior
|
||||
this.BrainType = typeof(HerdAnimalBrain);
|
||||
this.WanderingSpeed = 1f;
|
||||
this.Speed = 5.5f;
|
||||
this.Health = 3.2f;
|
||||
this.Damage = 1f;
|
||||
this.DelayBetweenAttacksRangeSec = new Range(0.8f, 2.5f);
|
||||
this.FearFactor = 1f;
|
||||
this.FleePlayers = true;
|
||||
this.AttackRange = 1f;
|
||||
this.HeadDistance = 0.9f;
|
||||
this.TimeLayToStand = 2.5f;
|
||||
// Climate
|
||||
this.ReleasesCO2ppmPerDay = 0f;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
65
Mods/Organisms/Animal/Bison.cs
Normal file
65
Mods/Organisms/Animal/Bison.cs
Normal file
|
@ -0,0 +1,65 @@
|
|||
namespace Eco.Mods.Organisms
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Eco.Gameplay.Animals;
|
||||
using Eco.Mods.Organisms.Behaviors;
|
||||
using Eco.Mods.TechTree;
|
||||
using Eco.Shared.Localization;
|
||||
using Eco.Shared.Math;
|
||||
using Eco.Simulation.Agents;
|
||||
using Eco.Simulation.Types;
|
||||
|
||||
public class Bison : AnimalEntity
|
||||
{
|
||||
public Bison(Animal parent, Vector3 pos, bool corpse = false) : base(parent, pos, species, corpse) { }
|
||||
static AnimalSpecies species;
|
||||
public class BisonSpecies : AnimalSpecies
|
||||
{
|
||||
public BisonSpecies() : base()
|
||||
{
|
||||
species = this;
|
||||
this.InstanceType = typeof(Bison);
|
||||
|
||||
// Info
|
||||
this.Name = "Bison";
|
||||
this.DisplayName = Localizer.DoStr("Bison");
|
||||
// Lifetime
|
||||
this.MaturityAgeDays = 1f;
|
||||
// Food
|
||||
this.FoodSources = new List<System.Type>() { typeof(CommonGrass), typeof(Bunchgrass), typeof(Wheat), typeof(BigBluestem), typeof(Switchgrass) };
|
||||
this.CalorieValue = 500f;
|
||||
// Movement
|
||||
this.Flying = false;
|
||||
this.Swimming = false;
|
||||
// Resources
|
||||
this.ResourceList = new List<SpeciesResource>()
|
||||
{
|
||||
new SpeciesResource(typeof(BisonCarcassItem), new Range(1f, 1f)),
|
||||
};
|
||||
this.ResourceBonusAtGrowth = 0.9f;
|
||||
// Behavior
|
||||
this.BrainType = typeof(HerdAnimalBrain);
|
||||
this.WanderingSpeed = 0.8f;
|
||||
this.Speed = 4f;
|
||||
this.Health = 7f;
|
||||
this.Damage = 1f;
|
||||
this.DelayBetweenAttacksRangeSec = new Range(0.8f, 2.5f);
|
||||
this.FearFactor = 0.6f;
|
||||
this.FleePlayers = true;
|
||||
this.AttackRange = 1f;
|
||||
this.HeadDistance = 1f;
|
||||
this.TimeLayToStand = 4f;
|
||||
this.TimeStandToLay = 3f;
|
||||
// Climate
|
||||
this.ReleasesCO2ppmPerDay = 0f;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public override void FleeFrom(Vector3 position)
|
||||
{
|
||||
base.FleeFrom(position);
|
||||
GroupBehaviors.SyncFleePosition(this);
|
||||
}
|
||||
}
|
||||
}
|
64
Mods/Organisms/Animal/Deer.cs
Normal file
64
Mods/Organisms/Animal/Deer.cs
Normal file
|
@ -0,0 +1,64 @@
|
|||
namespace Eco.Mods.Organisms
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Eco.Gameplay.Animals;
|
||||
using Eco.Mods.Organisms.Behaviors;
|
||||
using Eco.Mods.TechTree;
|
||||
using Eco.Shared.Localization;
|
||||
using Eco.Shared.Math;
|
||||
using Eco.Simulation.Agents;
|
||||
using Eco.Simulation.Types;
|
||||
|
||||
public class Deer : AnimalEntity
|
||||
{
|
||||
public Deer(Animal parent, Vector3 pos, bool corpse = false) : base(parent, pos, species, corpse) { }
|
||||
static AnimalSpecies species;
|
||||
public class DeerSpecies : AnimalSpecies
|
||||
{
|
||||
public DeerSpecies() : base()
|
||||
{
|
||||
species = this;
|
||||
this.InstanceType = typeof(Deer);
|
||||
|
||||
// Info
|
||||
this.Name = "Deer";
|
||||
this.DisplayName = Localizer.DoStr("Deer");
|
||||
// Lifetime
|
||||
this.MaturityAgeDays = 1f;
|
||||
// Food
|
||||
this.FoodSources = new List<System.Type>() {typeof(Huckleberry), typeof(Fern), typeof(Beans), typeof(Salal), typeof(Corn), typeof(Bunchgrass), typeof(Wheat)};
|
||||
this.CalorieValue = 200f;
|
||||
// Movement
|
||||
this.Flying = false;
|
||||
this.Swimming = false;
|
||||
// Resources
|
||||
this.ResourceList = new List<SpeciesResource>()
|
||||
{
|
||||
new SpeciesResource(typeof(DeerCarcassItem), new Range(1f, 1f)),
|
||||
};
|
||||
this.ResourceBonusAtGrowth = 0.9f;
|
||||
// Behavior
|
||||
this.BrainType = typeof(LandAnimalBrain);
|
||||
this.WanderingSpeed = 1f;
|
||||
this.Speed = 5.5f;
|
||||
this.Health = 3.2f;
|
||||
this.Damage = 1f;
|
||||
this.DelayBetweenAttacksRangeSec = new Range(0.8f, 2.5f);
|
||||
this.FearFactor = 1f;
|
||||
this.FleePlayers = true;
|
||||
this.AttackRange = 1f;
|
||||
this.HeadDistance = 1f;
|
||||
this.TimeLayToStand = 2.5f;
|
||||
// Climate
|
||||
this.ReleasesCO2ppmPerDay = 0f;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public override void FleeFrom(Vector3 position)
|
||||
{
|
||||
base.FleeFrom(position);
|
||||
GroupBehaviors.SyncFleePosition(this);
|
||||
}
|
||||
}
|
||||
}
|
57
Mods/Organisms/Animal/Elk.cs
Normal file
57
Mods/Organisms/Animal/Elk.cs
Normal file
|
@ -0,0 +1,57 @@
|
|||
namespace Eco.Mods.Organisms
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Eco.Gameplay.Animals;
|
||||
using Eco.Mods.TechTree;
|
||||
using Eco.Shared.Localization;
|
||||
using Eco.Shared.Math;
|
||||
using Eco.Simulation.Agents;
|
||||
using Eco.Simulation.Types;
|
||||
|
||||
public class Elk : AnimalEntity
|
||||
{
|
||||
public Elk(Animal parent, Vector3 pos, bool corpse = false) : base(parent, pos, species, corpse) { }
|
||||
static AnimalSpecies species;
|
||||
public class ElkSpecies : AnimalSpecies
|
||||
{
|
||||
public ElkSpecies() : base()
|
||||
{
|
||||
species = this;
|
||||
this.InstanceType = typeof(Elk);
|
||||
|
||||
// Info
|
||||
this.Name = "Elk";
|
||||
this.DisplayName = Localizer.DoStr("Elk");
|
||||
// Lifetime
|
||||
this.MaturityAgeDays = 1f;
|
||||
// Food
|
||||
this.FoodSources = new List<System.Type>() {typeof(Huckleberry), typeof(Fern), typeof(Beans), typeof(Salal)};
|
||||
this.CalorieValue = 200f;
|
||||
// Movement
|
||||
this.Flying = false;
|
||||
this.Swimming = false;
|
||||
// Resources
|
||||
this.ResourceList = new List<SpeciesResource>()
|
||||
{
|
||||
new SpeciesResource(typeof(ElkCarcassItem), new Range(1f, 1f)),
|
||||
};
|
||||
this.ResourceBonusAtGrowth = 0.9f;
|
||||
// Behavior
|
||||
this.BrainType = typeof(LandAnimalBrain);
|
||||
this.WanderingSpeed = 1f;
|
||||
this.Speed = 5.5f;
|
||||
this.Health = 3.2f;
|
||||
this.Damage = 1f;
|
||||
this.DelayBetweenAttacksRangeSec = new Range(0.8f, 2.5f);
|
||||
this.FearFactor = 1f;
|
||||
this.FleePlayers = true;
|
||||
this.AttackRange = 1f;
|
||||
this.HeadDistance = 1f;
|
||||
this.TimeLayToStand = 2.5f;
|
||||
// Climate
|
||||
this.ReleasesCO2ppmPerDay = 0f;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
56
Mods/Organisms/Animal/Fox.cs
Normal file
56
Mods/Organisms/Animal/Fox.cs
Normal file
|
@ -0,0 +1,56 @@
|
|||
namespace Eco.Mods.Organisms
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Eco.Gameplay.Animals;
|
||||
using Eco.Mods.TechTree;
|
||||
using Eco.Shared.Localization;
|
||||
using Eco.Shared.Math;
|
||||
using Eco.Simulation.Agents;
|
||||
using Eco.Simulation.Types;
|
||||
|
||||
public class Fox : AnimalEntity
|
||||
{
|
||||
public Fox(Animal parent, Vector3 pos, bool corpse = false) : base(parent, pos, species, corpse) { }
|
||||
static AnimalSpecies species;
|
||||
public class FoxSpecies : AnimalSpecies
|
||||
{
|
||||
public FoxSpecies() : base()
|
||||
{
|
||||
species = this;
|
||||
this.InstanceType = typeof(Fox);
|
||||
|
||||
// Info
|
||||
this.Name = "Fox";
|
||||
this.DisplayName = Localizer.DoStr("Fox");
|
||||
// Lifetime
|
||||
this.MaturityAgeDays = 1f;
|
||||
// Food
|
||||
this.FoodSources = new List<System.Type>() {typeof(Hare), typeof(Turkey)};
|
||||
this.CalorieValue = 100f;
|
||||
// Movement
|
||||
this.Flying = false;
|
||||
this.Swimming = false;
|
||||
// Resources
|
||||
this.ResourceList = new List<SpeciesResource>()
|
||||
{
|
||||
new SpeciesResource(typeof(FoxCarcassItem), new Range(1f, 1f)),
|
||||
};
|
||||
this.ResourceBonusAtGrowth = 0.9f;
|
||||
// Behavior
|
||||
this.BrainType = typeof(LandPredatorBrain);
|
||||
this.WanderingSpeed = 1.5f;
|
||||
this.Speed = 5f;
|
||||
this.Health = 2f;
|
||||
this.Damage = 1f;
|
||||
this.DelayBetweenAttacksRangeSec = new Range(0.8f, 2.5f);
|
||||
this.FearFactor = 0.9f;
|
||||
this.FleePlayers = true;
|
||||
this.AttackRange = 1f;
|
||||
this.TimeLayToStand = 2.5f;
|
||||
// Climate
|
||||
this.ReleasesCO2ppmPerDay = 0f;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
55
Mods/Organisms/Animal/Hare.cs
Normal file
55
Mods/Organisms/Animal/Hare.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
namespace Eco.Mods.Organisms
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Eco.Gameplay.Animals;
|
||||
using Eco.Mods.TechTree;
|
||||
using Eco.Shared.Localization;
|
||||
using Eco.Shared.Math;
|
||||
using Eco.Simulation.Agents;
|
||||
using Eco.Simulation.Types;
|
||||
|
||||
public class Hare : AnimalEntity
|
||||
{
|
||||
public Hare(Animal parent, Vector3 pos, bool corpse = false) : base(parent, pos, species, corpse) { }
|
||||
static AnimalSpecies species;
|
||||
public class HareSpecies : AnimalSpecies
|
||||
{
|
||||
public HareSpecies() : base()
|
||||
{
|
||||
species = this;
|
||||
this.InstanceType = typeof(Hare);
|
||||
|
||||
// Info
|
||||
this.Name = "Hare";
|
||||
this.DisplayName = Localizer.DoStr("Hare");
|
||||
// Lifetime
|
||||
this.MaturityAgeDays = 1f;
|
||||
// Food
|
||||
this.FoodSources = new List<System.Type>() {typeof(Camas), typeof(Wheat), typeof(Bunchgrass), typeof(Sagebrush), typeof(Corn), typeof(Huckleberry), typeof(BigBluestem)};
|
||||
this.CalorieValue = 50f;
|
||||
// Movement
|
||||
this.Flying = false;
|
||||
this.Swimming = false;
|
||||
// Resources
|
||||
this.ResourceList = new List<SpeciesResource>()
|
||||
{
|
||||
new SpeciesResource(typeof(HareCarcassItem), new Range(1f, 1f)),
|
||||
};
|
||||
this.ResourceBonusAtGrowth = 0.9f;
|
||||
// Behavior
|
||||
this.BrainType = typeof(HerdAnimalBrain);
|
||||
this.WanderingSpeed = 1f;
|
||||
this.Speed = 5f;
|
||||
this.Health = 1f;
|
||||
this.Damage = 1f;
|
||||
this.DelayBetweenAttacksRangeSec = new Range(0.8f, 2.5f);
|
||||
this.FearFactor = 0.8f;
|
||||
this.FleePlayers = true;
|
||||
this.AttackRange = 1f;
|
||||
// Climate
|
||||
this.ReleasesCO2ppmPerDay = 0f;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
64
Mods/Organisms/Animal/MountainGoat.cs
Normal file
64
Mods/Organisms/Animal/MountainGoat.cs
Normal file
|
@ -0,0 +1,64 @@
|
|||
namespace Eco.Mods.Organisms
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Eco.Gameplay.Animals;
|
||||
using Eco.Mods.Organisms.Behaviors;
|
||||
using Eco.Mods.TechTree;
|
||||
using Eco.Shared.Localization;
|
||||
using Eco.Shared.Math;
|
||||
using Eco.Simulation.Agents;
|
||||
using Eco.Simulation.Types;
|
||||
|
||||
public class MountainGoat : AnimalEntity
|
||||
{
|
||||
public MountainGoat(Animal parent, Vector3 pos, bool corpse = false) : base(parent, pos, species, corpse) { }
|
||||
static AnimalSpecies species;
|
||||
public class MountainGoatSpecies : AnimalSpecies
|
||||
{
|
||||
public MountainGoatSpecies() : base()
|
||||
{
|
||||
species = this;
|
||||
this.InstanceType = typeof(MountainGoat);
|
||||
|
||||
// Info
|
||||
this.Name = "MountainGoat";
|
||||
this.DisplayName = Localizer.DoStr("MountainGoat");
|
||||
// Lifetime
|
||||
this.MaturityAgeDays = 1f;
|
||||
// Food
|
||||
this.FoodSources = new List<System.Type>() {typeof(PeatMoss), typeof(Saxifrage), typeof(Lupine), typeof(Fireweed), typeof(DwarfWillow), typeof(ArcticWillow)};
|
||||
this.CalorieValue = 100f;
|
||||
// Movement
|
||||
this.Flying = false;
|
||||
this.Swimming = false;
|
||||
// Resources
|
||||
this.ResourceList = new List<SpeciesResource>()
|
||||
{
|
||||
new SpeciesResource(typeof(MountainGoatCarcassItem), new Range(1f, 1f)),
|
||||
};
|
||||
this.ResourceBonusAtGrowth = 0.9f;
|
||||
// Behavior
|
||||
this.BrainType = typeof(HerdAnimalBrain);
|
||||
this.WanderingSpeed = 1.2f;
|
||||
this.Speed = 5.5f;
|
||||
this.Health = 3.2f;
|
||||
this.Damage = 1f;
|
||||
this.DelayBetweenAttacksRangeSec = new Range(0.8f, 2.5f);
|
||||
this.FearFactor = 1f;
|
||||
this.FleePlayers = true;
|
||||
this.AttackRange = 1f;
|
||||
this.HeadDistance = 0.75f;
|
||||
this.TimeLayToStand = 2.5f;
|
||||
// Climate
|
||||
this.ReleasesCO2ppmPerDay = 0f;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public override void FleeFrom(Vector3 position)
|
||||
{
|
||||
base.FleeFrom(position);
|
||||
GroupBehaviors.SyncFleePosition(this);
|
||||
}
|
||||
}
|
||||
}
|
140
Mods/Organisms/Animal/Otter.cs
Normal file
140
Mods/Organisms/Animal/Otter.cs
Normal file
|
@ -0,0 +1,140 @@
|
|||
namespace Eco.Mods.Organisms
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Eco.Mods.Organisms.Behaviors;
|
||||
using Eco.Gameplay.Animals;
|
||||
using Eco.Shared.Localization;
|
||||
using Eco.Shared.Math;
|
||||
using Eco.Shared.States;
|
||||
using Eco.Shared.Utils;
|
||||
using Eco.Simulation.Agents;
|
||||
using Eco.Simulation.Agents.AI;
|
||||
using Eco.Simulation.Types;
|
||||
using Eco.Simulation.WorldLayers;
|
||||
using Eco.Mods.TechTree;
|
||||
|
||||
public class Otter : AnimalEntity
|
||||
{
|
||||
public Otter(Animal parent, Vector3 pos, bool corpse = false) : base(parent, pos, species, corpse) { }
|
||||
static AnimalSpecies species;
|
||||
public class OtterSpecies : AnimalSpecies
|
||||
{
|
||||
public OtterSpecies() : base()
|
||||
{
|
||||
species = this;
|
||||
this.InstanceType = typeof(Otter);
|
||||
|
||||
// Info
|
||||
this.Name = "Otter";
|
||||
this.DisplayName = Localizer.DoStr("Otter");
|
||||
// Lifetime
|
||||
this.MaturityAgeDays = 1f;
|
||||
// Food
|
||||
this.FoodSources = new List<System.Type>() {typeof(Clam), typeof(Urchin), typeof(Tuna), typeof(Salmon), typeof(Trout)};
|
||||
this.CalorieValue = 50f;
|
||||
// Movement
|
||||
this.Flying = false;
|
||||
this.Swimming = true;
|
||||
// Resources
|
||||
this.ResourceList = new List<SpeciesResource>()
|
||||
{
|
||||
new SpeciesResource(typeof(OtterCarcassItem), new Range(1f, 1f)),
|
||||
};
|
||||
this.ResourceBonusAtGrowth = 0.9f;
|
||||
// Behavior
|
||||
this.BrainType = typeof(Brain<Otter>);
|
||||
this.WanderingSpeed = 1f;
|
||||
this.Speed = 2f;
|
||||
this.Health = 1f;
|
||||
this.Damage = 1f;
|
||||
this.DelayBetweenAttacksRangeSec = new Range(0.8f, 2.5f);
|
||||
this.FearFactor = 1f;
|
||||
this.FleePlayers = true;
|
||||
this.AttackRange = 1f;
|
||||
// Climate
|
||||
this.ReleasesCO2ppmPerDay = 0f;
|
||||
|
||||
}
|
||||
|
||||
// Otters can spawn on land or water
|
||||
public override bool IsValidSpawnPosition(Vector3i pos) { return true; }
|
||||
}
|
||||
|
||||
// Otter specific behavior
|
||||
private bool floating;
|
||||
private class BT : FunctionalBehaviorTree<Otter> { }
|
||||
public static readonly Func<Otter, BTStatus> OtterTreeRoot;
|
||||
public static readonly Func<Otter, BTStatus> OtterLandTree;
|
||||
public static readonly Func<Otter, BTStatus> OtterFloatingTree;
|
||||
public static readonly Func<Otter, BTStatus> OtterDivingTree;
|
||||
static Otter()
|
||||
{
|
||||
const float MinIdleTime = 3f;
|
||||
const float MaxIdleTime = 10f;
|
||||
const float MinFloatIdleTime = 10f;
|
||||
const float MaxFloatIdleTime = 20f;
|
||||
const float ChanceToIdle = 0.3f;
|
||||
const float ChanceToSurface = 0.3f;
|
||||
const float ChanceToDive = 0.1f;
|
||||
const float TimeToStopFloating = 2f;
|
||||
const float DiveAlertness = 200;
|
||||
const float MaxHeightAboveSeaLevel = 5;
|
||||
|
||||
OtterLandTree =
|
||||
BT.If(x => !World.World.IsUnderwater(x.Position.WorldPosition3i),
|
||||
BT.Selector(
|
||||
MovementBehaviors.AmphibiousFlee,
|
||||
BT.If(x => RandomUtil.Chance(ChanceToIdle),
|
||||
Brain.PlayAnimation(AnimalAnimationState.Idle, _ => RandomUtil.Range(MinIdleTime, MaxIdleTime))),
|
||||
BT.If(x => x.Position.y > WorldLayerManager.ClimateSim.State.SeaLevel + MaxHeightAboveSeaLevel,
|
||||
x => MovementBehaviors.RouteToWater(x, x.Species.WanderingSpeed, AnimalAnimationState.Wander)),
|
||||
BT.If(MovementBehaviors.ShouldReturnHome,
|
||||
MovementBehaviors.AmphibiousWanderHome),
|
||||
MovementBehaviors.AmphibiousWander));
|
||||
|
||||
OtterFloatingTree =
|
||||
BT.If(x => x.floating,
|
||||
BT.Selector(
|
||||
BT.If(x => x.AnimationState == AnimalAnimationState.FloatingIdle,
|
||||
// floating otters need time to flip back over before doing other things
|
||||
Brain.PlayFixedTimeAnimation(AnimalAnimationState.SurfaceSwimming, TimeToStopFloating)),
|
||||
BT.If(x => x.Alertness > DiveAlertness,
|
||||
// dive when scared
|
||||
BT.Success(x => x.floating = false),
|
||||
BT.Selector(MovementBehaviors.SwimFlee, MovementBehaviors.SwimWander)),
|
||||
MovementBehaviors.AmphibiousFlee,
|
||||
BT.If(x => RandomUtil.Chance(ChanceToDive),
|
||||
BT.Success(x => x.floating = false),
|
||||
MovementBehaviors.SwimWander),
|
||||
BT.If(MovementBehaviors.ShouldReturnHome,
|
||||
MovementBehaviors.AmphibiousWanderHome),
|
||||
BT.If(x => RandomUtil.Chance(ChanceToIdle),
|
||||
Brain.PlayAnimation(AnimalAnimationState.FloatingIdle, _ => RandomUtil.Range(MinFloatIdleTime, MaxFloatIdleTime))),
|
||||
MovementBehaviors.AmphibiousWander));
|
||||
|
||||
OtterDivingTree =
|
||||
BT.Selector(
|
||||
MovementBehaviors.SwimFlee,
|
||||
BT.If(MovementBehaviors.ShouldReturnHome,
|
||||
BT.Success(x => x.floating = true),
|
||||
MovementBehaviors.SwimWanderHomeSurface),
|
||||
BT.If(x => x.Alertness < DiveAlertness && RandomUtil.Chance(ChanceToSurface),
|
||||
BT.Success(x => x.floating = true),
|
||||
MovementBehaviors.SwimWanderSurface),
|
||||
BT.If(x => RandomUtil.Chance(1 - ChanceToIdle),
|
||||
MovementBehaviors.SwimWander),
|
||||
Brain.PlayAnimation(AnimalAnimationState.SwimmingIdle, _ => RandomUtil.Range(MinIdleTime, MaxIdleTime)));
|
||||
|
||||
OtterTreeRoot =
|
||||
BT.Selector(
|
||||
OtterLandTree,
|
||||
// TODO: dive for food & eat on surface (need tummy eating animation)
|
||||
OtterFloatingTree,
|
||||
OtterDivingTree
|
||||
);
|
||||
|
||||
Brain<Otter>.SharedBehavior = OtterTreeRoot;
|
||||
}
|
||||
}
|
||||
}
|
55
Mods/Organisms/Animal/Salmon.cs
Normal file
55
Mods/Organisms/Animal/Salmon.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
namespace Eco.Mods.Organisms
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Eco.Gameplay.Animals;
|
||||
using Eco.Mods.TechTree;
|
||||
using Eco.Shared.Localization;
|
||||
using Eco.Shared.Math;
|
||||
using Eco.Simulation.Agents;
|
||||
using Eco.Simulation.Types;
|
||||
|
||||
public class Salmon : AnimalEntity
|
||||
{
|
||||
public Salmon(Animal parent, Vector3 pos, bool corpse = false) : base(parent, pos, species, corpse) { }
|
||||
static AnimalSpecies species;
|
||||
public class SalmonSpecies : AnimalSpecies
|
||||
{
|
||||
public SalmonSpecies() : base()
|
||||
{
|
||||
species = this;
|
||||
this.InstanceType = typeof(Salmon);
|
||||
|
||||
// Info
|
||||
this.Name = "Salmon";
|
||||
this.DisplayName = Localizer.DoStr("Salmon");
|
||||
// Lifetime
|
||||
this.MaturityAgeDays = 1f;
|
||||
// Food
|
||||
this.FoodSources = new List<System.Type>() {typeof(Waterweed)};
|
||||
this.CalorieValue = 50f;
|
||||
// Movement
|
||||
this.Flying = false;
|
||||
this.Swimming = true;
|
||||
// Resources
|
||||
this.ResourceList = new List<SpeciesResource>()
|
||||
{
|
||||
new SpeciesResource(typeof(SalmonItem), new Range(1f, 1f)),
|
||||
};
|
||||
this.ResourceBonusAtGrowth = 0.9f;
|
||||
// Behavior
|
||||
this.BrainType = typeof(FishBrain);
|
||||
this.WanderingSpeed = 1f;
|
||||
this.Speed = 2f;
|
||||
this.Health = 1f;
|
||||
this.Damage = 1f;
|
||||
this.DelayBetweenAttacksRangeSec = new Range(0.8f, 2.5f);
|
||||
this.FearFactor = 1f;
|
||||
this.FleePlayers = true;
|
||||
this.AttackRange = 1f;
|
||||
// Climate
|
||||
this.ReleasesCO2ppmPerDay = 0f;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
85
Mods/Organisms/Animal/Tortoise.cs
Normal file
85
Mods/Organisms/Animal/Tortoise.cs
Normal file
|
@ -0,0 +1,85 @@
|
|||
namespace Eco.Mods.Organisms
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Eco.Gameplay.Animals;
|
||||
using Eco.Gameplay.Interactions;
|
||||
using Eco.Mods.TechTree;
|
||||
using Eco.Shared.Localization;
|
||||
using Eco.Shared.Math;
|
||||
using Eco.Shared.Networking;
|
||||
using Eco.Shared.States;
|
||||
using Eco.Shared.Utils;
|
||||
using Eco.Simulation.Agents;
|
||||
using Eco.Simulation.Agents.AI;
|
||||
using Eco.Simulation.Types;
|
||||
|
||||
public class Tortoise : AnimalEntity
|
||||
{
|
||||
public Tortoise(Animal parent, Vector3 pos, bool corpse = false) : base(parent, pos, species, corpse) { }
|
||||
static AnimalSpecies species;
|
||||
public class TortoiseSpecies : AnimalSpecies
|
||||
{
|
||||
public TortoiseSpecies() : base()
|
||||
{
|
||||
species = this;
|
||||
this.InstanceType = typeof(Tortoise);
|
||||
|
||||
// Info
|
||||
this.Name = "Tortoise";
|
||||
this.DisplayName = Localizer.DoStr("Tortoise");
|
||||
// Lifetime
|
||||
this.MaturityAgeDays = 2f;
|
||||
// Food
|
||||
this.FoodSources = new List<System.Type>() { typeof(Sagebrush), typeof(CreosoteBush), typeof(PricklyPear), typeof(Agave) };
|
||||
this.CalorieValue = 10f;
|
||||
// Movement
|
||||
this.Flying = false;
|
||||
this.Swimming = false;
|
||||
// Resources
|
||||
this.ResourceList = new List<SpeciesResource>()
|
||||
{
|
||||
new SpeciesResource(typeof(RawMeatItem), new Range(1f, 2f)),
|
||||
};
|
||||
this.ResourceBonusAtGrowth = 0.9f;
|
||||
// Behavior
|
||||
this.BrainType = typeof(Brain<Tortoise>);
|
||||
this.WanderingSpeed = 0.1f;
|
||||
this.Speed = 0.2f;
|
||||
this.Health = 1f;
|
||||
this.Damage = 1f;
|
||||
this.DelayBetweenAttacksRangeSec = new Range(0.8f, 2.5f);
|
||||
this.FearFactor = 1f;
|
||||
this.FleePlayers = true;
|
||||
this.AttackRange = 1f;
|
||||
// Climate
|
||||
this.ReleasesCO2ppmPerDay = 0f;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// tortoise behavior
|
||||
private class BT : FunctionalBehaviorTree<Tortoise> { }
|
||||
public static readonly Func<Tortoise, BTStatus> TortoiseTreeRoot;
|
||||
static Tortoise()
|
||||
{
|
||||
const float MinHidingTime = 5f;
|
||||
const float MaxHidingTime = 10f;
|
||||
|
||||
TortoiseTreeRoot =
|
||||
BT.Selector(
|
||||
// Tortoise hide instead of fleeing, fixed time to block pointless flee interruptions
|
||||
BT.If(x => x.Alertness > Animal.FleeThreshold,
|
||||
Brain.PlayFixedTimeAnimation(AnimalAnimationState.Hiding, _ => RandomUtil.Range(MinHidingTime, MaxHidingTime))),
|
||||
LandAnimalBrain.LandAnimalTreeRoot);
|
||||
|
||||
Brain<Tortoise>.SharedBehavior = TortoiseTreeRoot;
|
||||
}
|
||||
|
||||
public override bool TryApplyDamage(INetObject damager, float damage, InteractionContext context, Type damageDealer = null)
|
||||
{
|
||||
// turtle power! (or uhh tortoise power!)
|
||||
return base.TryApplyDamage(damager, this.AnimationState == AnimalAnimationState.Hiding ? damage / 4 : damage, context, damageDealer);
|
||||
}
|
||||
}
|
||||
}
|
55
Mods/Organisms/Animal/Trout.cs
Normal file
55
Mods/Organisms/Animal/Trout.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
namespace Eco.Mods.Organisms
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Eco.Gameplay.Animals;
|
||||
using Eco.Mods.TechTree;
|
||||
using Eco.Shared.Localization;
|
||||
using Eco.Shared.Math;
|
||||
using Eco.Simulation.Agents;
|
||||
using Eco.Simulation.Types;
|
||||
|
||||
public class Trout : AnimalEntity
|
||||
{
|
||||
public Trout(Animal parent, Vector3 pos, bool corpse = false) : base(parent, pos, species, corpse) { }
|
||||
static AnimalSpecies species;
|
||||
public class TroutSpecies : AnimalSpecies
|
||||
{
|
||||
public TroutSpecies() : base()
|
||||
{
|
||||
species = this;
|
||||
this.InstanceType = typeof(Trout);
|
||||
|
||||
// Info
|
||||
this.Name = "Trout";
|
||||
this.DisplayName = Localizer.DoStr("Trout");
|
||||
// Lifetime
|
||||
this.MaturityAgeDays = 1f;
|
||||
// Food
|
||||
this.FoodSources = new List<System.Type>() {typeof(Waterweed)};
|
||||
this.CalorieValue = 25f;
|
||||
// Movement
|
||||
this.Flying = false;
|
||||
this.Swimming = true;
|
||||
// Resources
|
||||
this.ResourceList = new List<SpeciesResource>()
|
||||
{
|
||||
new SpeciesResource(typeof(TroutItem), new Range(1f, 1f)),
|
||||
};
|
||||
this.ResourceBonusAtGrowth = 0.9f;
|
||||
// Behavior
|
||||
this.BrainType = typeof(FishBrain);
|
||||
this.WanderingSpeed = 1f;
|
||||
this.Speed = 2f;
|
||||
this.Health = 1f;
|
||||
this.Damage = 1f;
|
||||
this.DelayBetweenAttacksRangeSec = new Range(0.8f, 2.5f);
|
||||
this.FearFactor = 1f;
|
||||
this.FleePlayers = true;
|
||||
this.AttackRange = 1f;
|
||||
// Climate
|
||||
this.ReleasesCO2ppmPerDay = 0f;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
55
Mods/Organisms/Animal/Tuna.cs
Normal file
55
Mods/Organisms/Animal/Tuna.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
namespace Eco.Mods.Organisms
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Eco.Gameplay.Animals;
|
||||
using Eco.Mods.TechTree;
|
||||
using Eco.Shared.Localization;
|
||||
using Eco.Shared.Math;
|
||||
using Eco.Simulation.Agents;
|
||||
using Eco.Simulation.Types;
|
||||
|
||||
public class Tuna : AnimalEntity
|
||||
{
|
||||
public Tuna(Animal parent, Vector3 pos, bool corpse = false) : base(parent, pos, species, corpse) { }
|
||||
static AnimalSpecies species;
|
||||
public class TunaSpecies : AnimalSpecies
|
||||
{
|
||||
public TunaSpecies() : base()
|
||||
{
|
||||
species = this;
|
||||
this.InstanceType = typeof(Tuna);
|
||||
|
||||
// Info
|
||||
this.Name = "Tuna";
|
||||
this.DisplayName = Localizer.DoStr("Tuna");
|
||||
// Lifetime
|
||||
this.MaturityAgeDays = 1f;
|
||||
// Food
|
||||
this.FoodSources = new List<System.Type>() { typeof(Kelp), typeof(Seagrass) };
|
||||
this.CalorieValue = 100f;
|
||||
// Movement
|
||||
this.Flying = false;
|
||||
this.Swimming = true;
|
||||
// Resources
|
||||
this.ResourceList = new List<SpeciesResource>()
|
||||
{
|
||||
new SpeciesResource(typeof(TunaItem), new Range(1f, 1f)),
|
||||
};
|
||||
this.ResourceBonusAtGrowth = 0.9f;
|
||||
// Behavior
|
||||
this.BrainType = typeof(FishBrain);
|
||||
this.WanderingSpeed = 1f;
|
||||
this.Speed = 2f;
|
||||
this.Health = 1f;
|
||||
this.Damage = 1f;
|
||||
this.DelayBetweenAttacksRangeSec = new Range(0.8f, 2.5f);
|
||||
this.FearFactor = 1f;
|
||||
this.FleePlayers = true;
|
||||
this.AttackRange = 1f;
|
||||
// Climate
|
||||
this.ReleasesCO2ppmPerDay = 0f;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
56
Mods/Organisms/Animal/Turkey.cs
Normal file
56
Mods/Organisms/Animal/Turkey.cs
Normal file
|
@ -0,0 +1,56 @@
|
|||
namespace Eco.Mods.Organisms
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Eco.Gameplay.Animals;
|
||||
using Eco.Mods.TechTree;
|
||||
using Eco.Shared.Localization;
|
||||
using Eco.Shared.Math;
|
||||
using Eco.Simulation.Agents;
|
||||
using Eco.Simulation.Types;
|
||||
|
||||
public class Turkey : AnimalEntity
|
||||
{
|
||||
public Turkey(Animal parent, Vector3 pos, bool corpse = false) : base(parent, pos, species, corpse) { }
|
||||
static AnimalSpecies species;
|
||||
public class TurkeySpecies : AnimalSpecies
|
||||
{
|
||||
public TurkeySpecies() : base()
|
||||
{
|
||||
species = this;
|
||||
this.InstanceType = typeof(Turkey);
|
||||
|
||||
// Info
|
||||
this.Name = "Turkey";
|
||||
this.DisplayName = Localizer.DoStr("Turkey");
|
||||
// Lifetime
|
||||
this.MaturityAgeDays = 1f;
|
||||
// Food
|
||||
this.FoodSources = new List<System.Type>() { typeof(Bunchgrass), typeof(Camas) };
|
||||
this.CalorieValue = 75f;
|
||||
// Movement
|
||||
this.Flying = false;
|
||||
this.Swimming = false;
|
||||
// Resources
|
||||
this.ResourceList = new List<SpeciesResource>()
|
||||
{
|
||||
new SpeciesResource(typeof(TurkeyCarcassItem), new Range(1f, 1f)),
|
||||
};
|
||||
this.ResourceBonusAtGrowth = 0.9f;
|
||||
// Behavior
|
||||
this.BrainType = typeof(LandAnimalBrain);
|
||||
this.WanderingSpeed = 1f;
|
||||
this.Speed = 3.5f;
|
||||
this.Health = 1.8f;
|
||||
this.Damage = 1f;
|
||||
this.DelayBetweenAttacksRangeSec = new Range(0.8f, 2.5f);
|
||||
this.FearFactor = 0.5f;
|
||||
this.FleePlayers = true;
|
||||
this.AttackRange = 1f;
|
||||
this.TimeLayToStand = 3.5f;
|
||||
// Climate
|
||||
this.ReleasesCO2ppmPerDay = 0f;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
60
Mods/Organisms/Animal/Wolf.cs
Normal file
60
Mods/Organisms/Animal/Wolf.cs
Normal file
|
@ -0,0 +1,60 @@
|
|||
namespace Eco.Mods.Organisms
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Eco.Gameplay.Animals;
|
||||
using Eco.Mods.TechTree;
|
||||
using Eco.Shared.Localization;
|
||||
using Eco.Shared.Math;
|
||||
using Eco.Simulation.Agents;
|
||||
using Eco.Simulation.Time;
|
||||
using Eco.Simulation.Types;
|
||||
|
||||
public class Wolf : AnimalEntity
|
||||
{
|
||||
public Wolf(Animal parent, Vector3 pos, bool corpse = false) : base(parent, pos, species, corpse) { }
|
||||
static AnimalSpecies species;
|
||||
public class WolfSpecies : AnimalSpecies
|
||||
{
|
||||
public WolfSpecies() : base()
|
||||
{
|
||||
species = this;
|
||||
this.InstanceType = typeof(Wolf);
|
||||
|
||||
// Info
|
||||
this.Name = "Wolf";
|
||||
this.DisplayName = Localizer.DoStr("Wolf");
|
||||
// Lifetime
|
||||
this.MaturityAgeDays = 1f;
|
||||
// Food
|
||||
this.FoodSources = new List<System.Type>() {typeof(Hare), typeof(Elk), typeof(MountainGoat), typeof(Deer)};
|
||||
this.CalorieValue = 100f;
|
||||
// Movement
|
||||
this.Flying = false;
|
||||
this.Swimming = false;
|
||||
// Resources
|
||||
this.ResourceList = new List<SpeciesResource>()
|
||||
{
|
||||
new SpeciesResource(typeof(WolfCarcassItem), new Range(1f, 1f)),
|
||||
};
|
||||
this.ResourceBonusAtGrowth = 0.9f;
|
||||
// Behavior
|
||||
this.BrainType = typeof(LandPredatorBrain);
|
||||
this.WanderingSpeed = 0.7f;
|
||||
this.Speed = 5.5f;
|
||||
this.Health = 1.5f;
|
||||
this.Damage = 1f;
|
||||
this.DelayBetweenAttacksRangeSec = new Range(0.8f, 2.5f);
|
||||
this.FearFactor = 0.5f;
|
||||
this.FleePlayers = true;
|
||||
this.AttackRange = 1f;
|
||||
this.HeadDistance = 0.8f;
|
||||
this.TimeLayToStand = 4f;
|
||||
// Climate
|
||||
this.ReleasesCO2ppmPerDay = 0f;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ShouldSleep { get { return !WorldTime.IsNight(); } }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue