Gitlab to Gitea Migration
This commit is contained in:
59
Tools/AxeItem.cs
Normal file
59
Tools/AxeItem.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
// Copyright (c) Strange Loop Games. All rights reserved.
|
||||
// See LICENSE file in the project root for full license information.
|
||||
namespace Eco.Mods.TechTree
|
||||
{
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using Eco.Gameplay.DynamicValues;
|
||||
using Eco.Gameplay.Interactions;
|
||||
using Eco.Gameplay.Items;
|
||||
using Eco.World;
|
||||
using Eco.World.Blocks;
|
||||
using Gameplay.Systems.TextLinks;
|
||||
using Eco.Shared.Localization;
|
||||
using Kirthos.Mods;
|
||||
|
||||
[Category("Hidden")]
|
||||
public partial class AxeItem
|
||||
{
|
||||
private static SkillModifiedValue caloriesBurn;
|
||||
private static SkillModifiedValue damage;
|
||||
static AxeItem()
|
||||
{
|
||||
string axeUiLink = new AxeItem().UILink();
|
||||
caloriesBurn = CreateCalorieValue(20, typeof(LoggingSkill), typeof(AxeItem), new LocString(axeUiLink));
|
||||
damage = CreateDamageValue(1, typeof(LoggingSkill), typeof(AxeItem), new LocString(axeUiLink));
|
||||
}
|
||||
private static IDynamicValue skilledRepairCost = new ConstantValue(1);
|
||||
public override IDynamicValue SkilledRepairCost { get { return skilledRepairCost; } }
|
||||
|
||||
public override IDynamicValue CaloriesBurn { get { return caloriesBurn; } }
|
||||
public override SkillModifiedValue Damage { get { return damage; } }
|
||||
|
||||
public override string LeftActionDescription { get { return "Chop"; } }
|
||||
|
||||
public override InteractResult OnActLeft(InteractionContext context)
|
||||
{
|
||||
if (context.HasBlock)
|
||||
{
|
||||
var block = World.GetBlock(context.BlockPosition.Value);
|
||||
if (block.Is<TreeDebris>())
|
||||
{
|
||||
InventoryChangeSet changes = new InventoryChangeSet(context.Player.User.Inventory, context.Player.User);
|
||||
changes.AddItems<WoodPulpItem>(5);
|
||||
TreeUtils.GetPulpAroundPoint(context.Player.User, context.BlockPosition.Value, 1 + SkillsUtil.GetSkillLevel(context.Player.User, typeof(WoodPulpCleanerSkill)));
|
||||
return (InteractResult)this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false, 3, null, changes);
|
||||
}
|
||||
else
|
||||
return InteractResult.NoOp;
|
||||
}
|
||||
else
|
||||
return base.OnActLeft(context);
|
||||
}
|
||||
|
||||
public override bool ShouldHighlight(Type block)
|
||||
{
|
||||
return Block.Is<TreeDebris>(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
61
Tools/HammerItem.cs
Normal file
61
Tools/HammerItem.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
// Copyright (c) Strange Loop Games. All rights reserved.
|
||||
// See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using Eco.Gameplay.DynamicValues;
|
||||
using Eco.Gameplay.Interactions;
|
||||
using Eco.Gameplay.Items;
|
||||
using Eco.Gameplay.Objects;
|
||||
using Eco.Shared.Items;
|
||||
using Eco.Shared.Serialization;
|
||||
using Eco.World;
|
||||
using Eco.World.Blocks;
|
||||
|
||||
[Serialized]
|
||||
[Category("Hidden")]
|
||||
[CanMakeBlockForm(new[] {"Wall", "Floor", "Roof", "Stairs", "Window", "Fence", "Aqueduct", "Cube", "Column"})]
|
||||
public class HammerItem : ToolItem
|
||||
{
|
||||
public override string Description { get { return "Destroys constructed materials."; } }
|
||||
public override string FriendlyName { get { return "Hammer"; } }
|
||||
|
||||
private static IDynamicValue skilledRepairCost = new ConstantValue(1);
|
||||
public override IDynamicValue SkilledRepairCost { get { return skilledRepairCost; } }
|
||||
|
||||
public override ClientPredictedBlockAction LeftAction { get { return ClientPredictedBlockAction.PickupBlock; } }
|
||||
public override string LeftActionDescription { get { return "Pick Up"; } }
|
||||
|
||||
public override InteractResult OnActLeft(InteractionContext context)
|
||||
{
|
||||
if (context.HasBlock)
|
||||
{
|
||||
if (context.Block.Is<Constructed>())
|
||||
return (InteractResult)this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, true, 1);
|
||||
else if (context.Block is WorldObjectBlock)
|
||||
{
|
||||
((WorldObjectBlock)context.Block).WorldObjectHandle.Object.PickUp(context.Player);
|
||||
this.BurnCalories(context.Player);
|
||||
return InteractResult.Success;
|
||||
}
|
||||
else
|
||||
return InteractResult.NoOp;
|
||||
}
|
||||
else if (context.Target is WorldObject)
|
||||
{
|
||||
(context.Target as WorldObject).PickUp(context.Player);
|
||||
this.BurnCalories(context.Player);
|
||||
return InteractResult.Success;
|
||||
}
|
||||
else
|
||||
return InteractResult.NoOp;
|
||||
}
|
||||
|
||||
static IDynamicValue caloriesBurn = new ConstantValue(1);
|
||||
public override IDynamicValue CaloriesBurn { get { return caloriesBurn; } }
|
||||
|
||||
public override bool ShouldHighlight(Type block)
|
||||
{
|
||||
return Block.Is<Constructed>(block);
|
||||
}
|
||||
}
|
||||
58
Tools/HoeItem.cs
Normal file
58
Tools/HoeItem.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
// Copyright (c) Strange Loop Games. All rights reserved.
|
||||
// See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using Eco.Core.Utils;
|
||||
using Eco.Gameplay.DynamicValues;
|
||||
using Eco.Gameplay.Interactions;
|
||||
using Eco.Gameplay.Items;
|
||||
using Eco.Shared.Math;
|
||||
using Eco.Shared.Serialization;
|
||||
using Eco.Simulation;
|
||||
using Eco.World;
|
||||
using Eco.World.Blocks;
|
||||
|
||||
[Serialized]
|
||||
[Category("Hidden")]
|
||||
[Hoer]
|
||||
public class HoeItem : ToolItem
|
||||
{
|
||||
public override string FriendlyName { get { return "Hoe"; } }
|
||||
public override string Description { get { return "Used to till soil and prepare it for planting."; } }
|
||||
|
||||
private static IDynamicValue skilledRepairCost = new ConstantValue(1);
|
||||
public override IDynamicValue SkilledRepairCost { get { return skilledRepairCost; } }
|
||||
|
||||
public override InteractResult OnActLeft(InteractionContext context)
|
||||
{
|
||||
if (context.HasBlock)
|
||||
{
|
||||
var abovePos = context.BlockPosition.Value + Vector3i.Up;
|
||||
var aboveBlock = World.GetBlock(abovePos);
|
||||
if (!aboveBlock.Is<Solid>() && context.Block.Is<Tillable>())
|
||||
{
|
||||
Result result = this.PlayerPlaceBlock<TilledDirtBlock>(context.BlockPosition.Value, context.Player, true);
|
||||
if (result.Success)
|
||||
{
|
||||
var plant = EcoSim.PlantSim.GetPlant(abovePos);
|
||||
if (plant != null)
|
||||
EcoSim.PlantSim.DestroyPlant(plant, DeathType.Harvesting);
|
||||
}
|
||||
|
||||
return (InteractResult)result;
|
||||
}
|
||||
|
||||
return InteractResult.NoOp;
|
||||
}
|
||||
|
||||
return base.OnActLeft(context);
|
||||
}
|
||||
static IDynamicValue caloriesBurn = new ConstantValue(1);
|
||||
public override IDynamicValue CaloriesBurn { get { return caloriesBurn; } }
|
||||
|
||||
public override bool ShouldHighlight(Type block)
|
||||
{
|
||||
return Block.Is<Tillable>(block);
|
||||
}
|
||||
}
|
||||
81
Tools/PickaxeItem.cs
Normal file
81
Tools/PickaxeItem.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
// Copyright (c) Strange Loop Games. All rights reserved.
|
||||
// See LICENSE file in the project root for full license information.
|
||||
namespace Eco.Mods.TechTree
|
||||
{
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using Core.Utils;
|
||||
using Eco.Gameplay.DynamicValues;
|
||||
using Eco.Gameplay.Interactions;
|
||||
using Eco.Gameplay.Items;
|
||||
using Eco.Gameplay.Players;
|
||||
using Eco.Gameplay.Systems.TextLinks;
|
||||
using Eco.Shared.Items;
|
||||
using Eco.World;
|
||||
using Eco.World.Blocks;
|
||||
using Gameplay.Objects;
|
||||
using Kirthos.Mods;
|
||||
|
||||
[Category("Hidden")]
|
||||
public partial class PickaxeItem : ToolItem
|
||||
{
|
||||
private static SkillModifiedValue caloriesBurn = CreateCalorieValue(20, typeof(MiningSkill), typeof(PickaxeItem), new PickaxeItem().UILink());
|
||||
static PickaxeItem() { }
|
||||
|
||||
public override IDynamicValue CaloriesBurn { get { return caloriesBurn; } }
|
||||
|
||||
public override ClientPredictedBlockAction LeftAction { get { return ClientPredictedBlockAction.DestroyBlock; } }
|
||||
public override string LeftActionDescription { get { return "Mine"; } }
|
||||
|
||||
private static IDynamicValue skilledRepairCost = new ConstantValue(1);
|
||||
public override IDynamicValue SkilledRepairCost { get { return skilledRepairCost; } }
|
||||
|
||||
public override InteractResult OnActLeft(InteractionContext context)
|
||||
{
|
||||
if (context.HasBlock && context.Block.Is<Minable>())
|
||||
{
|
||||
Result result = this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false, 1);
|
||||
if (result.Success)
|
||||
if (RubbleObject.TrySpawnFromBlock(context.Block.GetType(), context.BlockPosition.Value))
|
||||
{
|
||||
RubbleUtils.BreakBigRubble(context.BlockPosition.Value, 20 * SkillsUtil.GetSkillLevel(context.Player.User, typeof(StrongMiningSkill)));
|
||||
context.Player.User.UserUI.OnCreateRubble.Invoke();
|
||||
}
|
||||
return (InteractResult)result;
|
||||
}
|
||||
else if (context.Target is RubbleObject)
|
||||
{
|
||||
var rubble = (RubbleObject)context.Target;
|
||||
if (rubble.IsBreakable)
|
||||
{
|
||||
rubble.Breakup();
|
||||
BurnCalories(context.Player);
|
||||
return InteractResult.Success;
|
||||
}
|
||||
else
|
||||
return InteractResult.NoOp;
|
||||
}
|
||||
else
|
||||
return InteractResult.NoOp;
|
||||
}
|
||||
|
||||
public override bool ShouldHighlight(Type block)
|
||||
{
|
||||
return Block.Is<Minable>(block);
|
||||
}
|
||||
|
||||
public override InteractResult OnActRight(InteractionContext context)
|
||||
{
|
||||
User user = context.Player.User;
|
||||
if (context.HasBlock == false || user.Inventory.Carried.IsEmpty)
|
||||
{
|
||||
if (SkillsUtil.HasSkillLevel(user, typeof(MiningPickupAmountSkill), 1))
|
||||
{
|
||||
RubbleUtils.PickUpRubble(user, 2 + (2 * SkillsUtil.GetSkillLevel(user, typeof(MiningPickupRangeSkill))), (4 * SkillsUtil.GetSkillLevel(user, typeof(MiningPickupAmountSkill))));
|
||||
return InteractResult.Success;
|
||||
}
|
||||
}
|
||||
return InteractResult.NoOp;
|
||||
}
|
||||
}
|
||||
}
|
||||
67
Tools/ScytheItem.cs
Normal file
67
Tools/ScytheItem.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
// Copyright (c) Strange Loop Games. All rights reserved.
|
||||
// See LICENSE file in the project root for full license information.
|
||||
namespace Eco.Mods.TechTree
|
||||
{
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using Core.Utils;
|
||||
using Eco.Gameplay.DynamicValues;
|
||||
using Eco.Gameplay.Interactions;
|
||||
using Eco.Gameplay.Items;
|
||||
using Eco.Gameplay.Plants;
|
||||
using Eco.Gameplay.Systems.TextLinks;
|
||||
using Eco.Shared.Items;
|
||||
using Eco.Shared.Utils;
|
||||
using Eco.Simulation;
|
||||
using Eco.World;
|
||||
|
||||
[Category("Hidden")]
|
||||
[Mower]
|
||||
public partial class ScytheItem : ToolItem
|
||||
{
|
||||
private static SkillModifiedValue caloriesBurn = CreateCalorieValue(20, typeof(FarmingSkill), typeof(ScytheItem), new ScytheItem().UILink());
|
||||
static ScytheItem() { }
|
||||
|
||||
public override IDynamicValue CaloriesBurn { get { return caloriesBurn; } }
|
||||
|
||||
public override ClientPredictedBlockAction LeftAction { get { return ClientPredictedBlockAction.Harvest; } }
|
||||
public override string LeftActionDescription { get { return "Reap"; } }
|
||||
|
||||
private static IDynamicValue skilledRepairCost = new ConstantValue(1);
|
||||
public override IDynamicValue SkilledRepairCost { get { return skilledRepairCost; } }
|
||||
|
||||
public override InteractResult OnActLeft(InteractionContext context)
|
||||
{
|
||||
if (!context.HasBlock || !context.Block.Is<Reapable>())
|
||||
return InteractResult.NoOp;
|
||||
|
||||
var plant = EcoSim.PlantSim.GetPlant(context.BlockPosition.Value);
|
||||
if (plant != null && plant is IHarvestable)
|
||||
{
|
||||
if (plant.Dead)
|
||||
{
|
||||
EcoSim.PlantSim.DestroyPlant(plant, DeathType.Harvesting);
|
||||
return InteractResult.Success;
|
||||
}
|
||||
else
|
||||
{
|
||||
Result result = (plant as IHarvestable).TryHarvest(context.Player, true);
|
||||
if (result.Success)
|
||||
{
|
||||
this.BurnCalories(context.Player);
|
||||
context.Player.SpawnBlockEffect(context.BlockPosition.Value, context.Block.GetType(), BlockEffect.Harvest);
|
||||
}
|
||||
|
||||
return (InteractResult)result;
|
||||
}
|
||||
}
|
||||
else
|
||||
return (InteractResult)this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false);
|
||||
}
|
||||
|
||||
public override bool ShouldHighlight(Type block)
|
||||
{
|
||||
return Block.Is<Reapable>(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
83
Tools/ShovelItem.cs
Normal file
83
Tools/ShovelItem.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
// Copyright (c) Strange Loop Games. All rights reserved.
|
||||
// See LICENSE file in the project root for full license information.
|
||||
namespace Eco.Mods.TechTree
|
||||
{
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using Core.Utils;
|
||||
using Eco.Gameplay.DynamicValues;
|
||||
using Eco.Gameplay.Interactions;
|
||||
using Eco.Gameplay.Items;
|
||||
using Eco.Gameplay.Plants;
|
||||
using Eco.Gameplay.Systems.TextLinks;
|
||||
using Eco.Shared.Items;
|
||||
using Eco.Shared.Math;
|
||||
using Eco.Simulation;
|
||||
using Eco.World;
|
||||
using Eco.World.Blocks;
|
||||
|
||||
[Category("Hidden")]
|
||||
public partial class ShovelItem : ToolItem
|
||||
{
|
||||
private static SkillModifiedValue caloriesBurn = CreateCalorieValue(20, typeof(ShovelEfficiencySkill), typeof(ShovelItem), new ShovelItem().UILink());
|
||||
public override IDynamicValue CaloriesBurn { get { return caloriesBurn; } }
|
||||
|
||||
public override ClientPredictedBlockAction LeftAction { get { return ClientPredictedBlockAction.PickupBlock; } }
|
||||
public override string LeftActionDescription { get { return "Dig"; } }
|
||||
|
||||
private static IDynamicValue skilledRepairCost = new ConstantValue(1);
|
||||
public override IDynamicValue SkilledRepairCost { get { return skilledRepairCost; } }
|
||||
|
||||
public override InteractResult OnActLeft(InteractionContext context)
|
||||
{
|
||||
if (context.HasBlock)
|
||||
{
|
||||
if (context.Block is PlantBlock)
|
||||
{
|
||||
var plant = EcoSim.PlantSim.GetPlant(context.BlockPosition.Value);
|
||||
if (plant != null && plant is IHarvestable)
|
||||
{
|
||||
IHarvestable harvestable = (IHarvestable)plant;
|
||||
|
||||
if (plant.Dead)
|
||||
{
|
||||
EcoSim.PlantSim.DestroyPlant(plant, DeathType.Harvesting);
|
||||
return InteractResult.Success;
|
||||
}
|
||||
else
|
||||
{
|
||||
Result result = harvestable.TryHarvest(context.Player, false);
|
||||
if (result.Success)
|
||||
this.BurnCalories(context.Player);
|
||||
return (InteractResult)result;
|
||||
}
|
||||
}
|
||||
else
|
||||
return (InteractResult)this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false);
|
||||
}
|
||||
else if (context.Block.Is<Diggable>())
|
||||
{
|
||||
if (TreeEntity.TreeRootsBlockDigging(context))
|
||||
return InteractResult.FailureLocStr("You attempt to dig up the soil, but the roots are too strong!");
|
||||
|
||||
Result result = this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, true, 1, new DirtItem());
|
||||
if (result.Success)
|
||||
{
|
||||
var plant = EcoSim.PlantSim.GetPlant(context.BlockPosition.Value + Vector3i.Up);
|
||||
if (plant != null)
|
||||
EcoSim.PlantSim.DestroyPlant(plant, DeathType.Harvesting);
|
||||
}
|
||||
|
||||
return (InteractResult)result;
|
||||
}
|
||||
else
|
||||
return InteractResult.NoOp;
|
||||
}
|
||||
else
|
||||
return InteractResult.NoOp;
|
||||
}
|
||||
|
||||
public override int MaxTake { get { return 1; } }
|
||||
public override bool ShouldHighlight(Type block) { return Block.Is<Diggable>(block);}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user