Gitlab to Gitea Migration
This commit is contained in:
Binary file not shown.
51
KirthosMods/BetterLoggingProfession/LoggingsSkill.cs
Normal file
51
KirthosMods/BetterLoggingProfession/LoggingsSkill.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using Eco.Gameplay.Skills;
|
||||
using Eco.Mods.TechTree;
|
||||
using Eco.Shared.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Kirthos.Mods
|
||||
{
|
||||
[Serialized]
|
||||
[RequiresSkill(typeof(LoggingSkill), 1)]
|
||||
public partial class WoodPulpCleanerSkill : Skill
|
||||
{
|
||||
public override string FriendlyName { get { return "Wood pulp cleaner"; } }
|
||||
public override string Description { get { return "When break a wood pulp, break others wood pulp around. Levels increase range."; } }
|
||||
|
||||
public static int[] SkillPointCost = { 5, 10, 20, 30, 40 };
|
||||
public override int RequiredPoint { get { return this.Level < this.MaxLevel ? SkillPointCost[this.Level] : 0; } }
|
||||
public override int PrevRequiredPoint { get { return this.Level - 1 >= 0 && this.Level - 1 < this.MaxLevel ? SkillPointCost[this.Level - 1] : 0; } }
|
||||
public override int MaxLevel { get { return 5; } }
|
||||
}
|
||||
//*
|
||||
[Serialized]
|
||||
[RequiresSkill(typeof(WoodPulpCleanerSkill), 1)]
|
||||
public partial class StumpCleanerSkill : Skill
|
||||
{
|
||||
public override string FriendlyName { get { return "Stump cleaner"; } }
|
||||
public override string Description { get { return "Break tree stump in one hit."; } }
|
||||
|
||||
public static int[] SkillPointCost = { 75};
|
||||
public override int RequiredPoint { get { return this.Level < this.MaxLevel ? SkillPointCost[this.Level] : 0; } }
|
||||
public override int PrevRequiredPoint { get { return this.Level - 1 >= 0 && this.Level - 1 < this.MaxLevel ? SkillPointCost[this.Level - 1] : 0; } }
|
||||
public override int MaxLevel { get { return 1; } }
|
||||
}
|
||||
//*/
|
||||
[Serialized]
|
||||
[RequiresSkill(typeof(LoggingSkill), 1)]
|
||||
public partial class ExpertLumbererSkill : Skill
|
||||
{
|
||||
public override string FriendlyName { get { return "Expert lumberer"; } }
|
||||
public override string Description { get { return "Cut the tree trunk, ready to harvest."; } }
|
||||
|
||||
public static int[] SkillPointCost = { 80 };
|
||||
public override int RequiredPoint { get { return this.Level < this.MaxLevel ? SkillPointCost[this.Level] : 0; } }
|
||||
public override int PrevRequiredPoint { get { return this.Level - 1 >= 0 && this.Level - 1 < this.MaxLevel ? SkillPointCost[this.Level - 1] : 0; } }
|
||||
public override int MaxLevel { get { return 1; } }
|
||||
}
|
||||
|
||||
}
|
||||
BIN
KirthosMods/BetterMining/BetterMining.unity3d
Normal file
BIN
KirthosMods/BetterMining/BetterMining.unity3d
Normal file
Binary file not shown.
52
KirthosMods/BetterMining/MiningSkills.cs
Normal file
52
KirthosMods/BetterMining/MiningSkills.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using Eco.Gameplay.DynamicValues;
|
||||
using Eco.Gameplay.Players;
|
||||
using Eco.Gameplay.Skills;
|
||||
using Eco.Mods.TechTree;
|
||||
using Eco.Shared.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Kirthos.Mods
|
||||
{
|
||||
[Serialized]
|
||||
[RequiresSkill(typeof(MiningSkill), 1)]
|
||||
public partial class MiningPickupAmountSkill : Skill
|
||||
{
|
||||
public override string FriendlyName { get { return "Mining Pickup amount"; } }
|
||||
public override string Description { get { return "Pickup near rubble when right-click rubble with pickaxe. Levels increase max amount."; } }
|
||||
|
||||
public static int[] SkillPointCost = { 5, 7, 14, 22, 30 };
|
||||
public override int RequiredPoint { get { return this.Level < this.MaxLevel ? SkillPointCost[this.Level] : 0; } }
|
||||
public override int PrevRequiredPoint { get { return this.Level - 1 >= 0 && this.Level - 1 < this.MaxLevel ? SkillPointCost[this.Level - 1] : 0; } }
|
||||
public override int MaxLevel { get { return 5; } }
|
||||
}
|
||||
|
||||
[Serialized]
|
||||
[RequiresSkill(typeof(MiningPickupAmountSkill), 1)]
|
||||
public partial class MiningPickupRangeSkill : Skill
|
||||
{
|
||||
public override string FriendlyName { get { return "Mining Pickup range"; } }
|
||||
public override string Description { get { return "Increase the range of the mining pickup."; } }
|
||||
|
||||
public static int[] SkillPointCost = { 5, 7, 14, 22, 30 };
|
||||
public override int RequiredPoint { get { return this.Level < this.MaxLevel ? SkillPointCost[this.Level] : 0; } }
|
||||
public override int PrevRequiredPoint { get { return this.Level - 1 >= 0 && this.Level - 1 < this.MaxLevel ? SkillPointCost[this.Level - 1] : 0; } }
|
||||
public override int MaxLevel { get { return 5; } }
|
||||
}
|
||||
|
||||
[Serialized]
|
||||
[RequiresSkill(typeof(MiningSkill), 1)]
|
||||
public partial class StrongMiningSkill : Skill
|
||||
{
|
||||
public override string FriendlyName { get { return "Strong Mining"; } }
|
||||
public override string Description { get { return "Have chance to break directly big rubble when mine blocks. (20% chance per level)"; } }
|
||||
|
||||
public static int[] SkillPointCost = { 5, 7, 14, 22, 30 };
|
||||
public override int RequiredPoint { get { return this.Level < this.MaxLevel ? SkillPointCost[this.Level] : 0; } }
|
||||
public override int PrevRequiredPoint { get { return this.Level - 1 >= 0 && this.Level - 1 < this.MaxLevel ? SkillPointCost[this.Level - 1] : 0; } }
|
||||
public override int MaxLevel { get { return 5; } }
|
||||
}
|
||||
}
|
||||
154
KirthosMods/Utils/RubbleUtils.cs
Normal file
154
KirthosMods/Utils/RubbleUtils.cs
Normal file
@@ -0,0 +1,154 @@
|
||||
using Eco.Gameplay.Interactions;
|
||||
using Eco.Gameplay.Items;
|
||||
using Eco.Gameplay.Objects;
|
||||
using Eco.Gameplay.Players;
|
||||
using Eco.Gameplay.Systems.Chat;
|
||||
using Eco.Mods.TechTree;
|
||||
using Eco.Shared.Math;
|
||||
using Eco.Shared.Networking;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Kirthos.Mods
|
||||
{
|
||||
class RubbleUtils
|
||||
{
|
||||
public static void PickUpRubble(User user, int range = 10, int qty = 20)
|
||||
{
|
||||
try
|
||||
{
|
||||
VerifyCarry(user.Inventory.Carried, user, range, qty);
|
||||
}
|
||||
catch(Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static void PickRubble<T>(User user, int range, int qty) where T : RubbleObject
|
||||
{
|
||||
Type firstItemGet = null;
|
||||
Type itemType = null;
|
||||
int count = user.Inventory.Carried.Stacks.First<ItemStack>().Quantity;
|
||||
if (count >= qty)
|
||||
return;
|
||||
foreach (RubbleObject obj in NetObjectManager.GetObjectsOfType<T>())
|
||||
{
|
||||
if (obj.IsBreakable)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (Vector3.Distance(user.Position, obj.Position) < range)
|
||||
{
|
||||
if (firstItemGet == null)
|
||||
{
|
||||
firstItemGet = obj.GetType();
|
||||
if (firstItemGet.ToString().Contains("StoneRubbleSet"))
|
||||
{
|
||||
itemType = typeof(StoneItem);
|
||||
}
|
||||
else if (firstItemGet.ToString().Contains("CoalRubbleSet"))
|
||||
{
|
||||
itemType = typeof(CoalItem);
|
||||
}
|
||||
else if (firstItemGet.ToString().Contains("CopperOreRubbleSet"))
|
||||
{
|
||||
itemType = typeof(CopperOreItem);
|
||||
}
|
||||
else if (firstItemGet.ToString().Contains("GoldOreRubbleSet"))
|
||||
{
|
||||
itemType = typeof(GoldOreItem);
|
||||
}
|
||||
else if (firstItemGet.ToString().Contains("IronOreRubbleSet"))
|
||||
{
|
||||
itemType = typeof(IronOreItem);
|
||||
}
|
||||
}
|
||||
if (itemType == typeof(StoneItem) && !obj.GetType().ToString().Contains("StoneRubbleSet"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (itemType == typeof(CoalItem) && !obj.GetType().ToString().Contains("CoalRubbleSet"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (itemType == typeof(CopperOreItem) && !obj.GetType().ToString().Contains("CopperOreRubbleSet"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (itemType == typeof(GoldOreItem) && !obj.GetType().ToString().Contains("GoldOreRubbleSet"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (itemType == typeof(IronOreItem) && !obj.GetType().ToString().Contains("IronOreRubbleSet"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (obj.AuthorizedToInteract(user))
|
||||
{
|
||||
if (obj.TryPickup(user.Inventory).IsSuccess)
|
||||
{
|
||||
count++;
|
||||
if (count >= qty)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void VerifyCarry(LimitedInventory carry, User user, int range, int qty)
|
||||
{
|
||||
if (carry.IsEmpty)
|
||||
{
|
||||
PickRubble<RubbleObject>(user, range, qty);
|
||||
}
|
||||
else
|
||||
{
|
||||
Item itemCarried = carry.Stacks.First<ItemStack>().Item;
|
||||
if (itemCarried is StoneItem)
|
||||
{
|
||||
PickRubble<RubbleObject<StoneItem>>(user, range, qty);
|
||||
}
|
||||
else if (itemCarried is CoalItem)
|
||||
{
|
||||
PickRubble<RubbleObject<CoalItem>>(user, range, qty);
|
||||
}
|
||||
else if (itemCarried is CopperOreItem)
|
||||
{
|
||||
PickRubble<RubbleObject<CopperOreItem>>(user, range, qty);
|
||||
}
|
||||
else if (itemCarried is GoldOreItem)
|
||||
{
|
||||
PickRubble<RubbleObject<GoldOreItem>>(user, range, qty);
|
||||
}
|
||||
else if (itemCarried is IronOreItem)
|
||||
{
|
||||
PickRubble<RubbleObject<IronOreItem>>(user, range, qty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void BreakBigRubble(Vector3i blockPosition, int percent)
|
||||
{
|
||||
Random rng = new Random();
|
||||
if (rng.Next(100) < percent)
|
||||
{
|
||||
foreach (RubbleObject obj in NetObjectManager.GetObjectsOfType<RubbleObject>())
|
||||
{
|
||||
if (!obj.IsBreakable)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (Vector3.Distance(blockPosition, obj.Position) < 1)
|
||||
{
|
||||
obj.Breakup();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
40
KirthosMods/Utils/SkillsUtil.cs
Normal file
40
KirthosMods/Utils/SkillsUtil.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Eco.Gameplay.Players;
|
||||
using Eco.Gameplay.Skills;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Kirthos.Mods
|
||||
{
|
||||
class SkillsUtil
|
||||
{
|
||||
public static bool HasSkillLevel(User user, Type skillType, int level)
|
||||
{
|
||||
foreach(Skill skill in user.Skillset.Skills)
|
||||
{
|
||||
if (skill.Type == skillType)
|
||||
{
|
||||
if (skill.Level >= level)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int GetSkillLevel(User user, Type skillType)
|
||||
{
|
||||
foreach (Skill skill in user.Skillset.Skills)
|
||||
{
|
||||
if (skill.Type == skillType)
|
||||
{
|
||||
return skill.Level;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
47
KirthosMods/Utils/TreeUtils.cs
Normal file
47
KirthosMods/Utils/TreeUtils.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using Eco.Gameplay.Items;
|
||||
using Eco.Gameplay.Players;
|
||||
using Eco.Mods.TechTree;
|
||||
using Eco.Shared.Math;
|
||||
using Eco.World;
|
||||
using Eco.World.Blocks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Kirthos.Mods
|
||||
{
|
||||
class TreeUtils
|
||||
{
|
||||
public static void GetPulpAroundPoint(User user, Vector3i position, int range)
|
||||
{
|
||||
try
|
||||
{
|
||||
for (int i = -range; i < range; i++)
|
||||
{
|
||||
for (int j = -range; j < range; j++)
|
||||
{
|
||||
if (i == 0 && j == 0) continue;
|
||||
Vector3i positionAbove = World.GetTopPos(new Vector2i(position.x + i, position.z + j)) + Vector3i.Up;
|
||||
Block blockAbove = World.GetBlockProbablyTop(positionAbove);
|
||||
if (blockAbove.Is<TreeDebris>())
|
||||
{
|
||||
if (positionAbove != position && Vector3i.Distance(positionAbove, position) < range)
|
||||
{
|
||||
if (user.Inventory.TryAddItems<WoodPulpItem>(5))
|
||||
{
|
||||
World.DeleteBlock(positionAbove);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user