Upload from upload_mods.ps1

This commit is contained in:
Nathaniel Cosford
2025-06-04 16:44:53 +09:30
commit f1fbbe67bb
1722 changed files with 165268 additions and 0 deletions

View File

@@ -0,0 +1,81 @@
using JetBrains.Annotations;
using System.Threading.Tasks;
using System.Xml.Linq;
/// <summary>
/// Set's a single block on fire.
/// </summary>
/// <remarks>
/// This effect will set a block on fire, using the target's position, and the range. There is an optional delay time, which will delay the fire from starting.
/// Example:
/// <triggered_effect trigger="onSelfDamagedBlock" action="AddFireDamage, SCore" target="positionAOE" range="5" delayTime="10" />
/// </remarks>
[UsedImplicitly]
public class MinEventActionAddFireDamage : MinEventActionRemoveBuff
{
private static readonly string AdvFeatureClass = "FireManagement";
private float _delayTime;
public override void Execute(MinEventParams @params)
{
if (FireManager.Instance == null) return;
if (FireManager.Instance.Enabled == false) return;
var position = @params.Position;
if (targetType != TargetTypes.positionAOE)
{
if (Voxel.voxelRayHitInfo.bHitValid)
{
var hitInfo = Voxel.voxelRayHitInfo;
if (hitInfo == null) return;
// modification from FuriousRamsay to fix issue where the lookray is behind a door, which is setting fire to blocks on the other side of metal doors.
var itemAction = @params.Self.inventory.holdingItemData.item.Actions[0];
if (itemAction is ItemActionMelee)
{
float blockRange = 0;
if (itemAction.Properties.Values.ContainsKey("Block_range"))
{
blockRange = StringParsers.ParseFloat(itemAction.Properties.Values["Block_range"]);
}
if ((blockRange > 0) && (Vector3.Distance(hitInfo.hit.blockPos, @params.Position) > blockRange))
{
return;
}
}
position = hitInfo.hit.blockPos;
}
}
//AdvLogging.DisplayLog(AdvFeatureClass, $"Executing AddFireDamage() at {position} Self: {@params.Self.position} Range: {maxRange} Delay: {_delayTime}");
Task.Delay((int)_delayTime)
.ContinueWith(_ => AddFire(position));
}
private void AddFire(Vector3 position)
{
var range = (int)maxRange;
for (var x = -range; x <= range; x++)
{
for (var z = -range; z <= range; z++)
{
for (var y = -range; y <= range; y++)
{
var vector = new Vector3i(position.x + x, position.y + y, position.z + z);
FireManager.Instance.Add(vector);
}
}
}
}
public override bool ParseXmlAttribute(XAttribute attribute)
{
var flag = base.ParseXmlAttribute(attribute);
if (flag) return true;
var name = attribute.Name.LocalName;
if (name != "delayTime") return false;
_delayTime = StringParsers.ParseFloat(attribute.Value);
return true;
}
}

View File

@@ -0,0 +1,99 @@
using JetBrains.Annotations;
using System.Xml.Linq;
/// <summary>
/// Spreads fire over a wider area than a single block.
/// </summary>
/// <remarks>
/// This effect can allow fire to spread to to surrounding blocks. You can set up a filter based on the type of blocks you wanted affected.
/// Example:
/// <!-- The same type of block -->
/// <triggered_effect trigger="onSelfDamagedBlock" action="AddFireDamageCascade, SCore" range="4" filter="Type" />
///
/// <!-- Shares the same material -->
/// <triggered_effect trigger="onSelfDamagedBlock" action="AddFireDamageCascade, SCore" range="4" filter="Material" />
///
/// <!-- Shares the same material damage classification -->
/// <triggered_effect trigger="onSelfDamagedBlock" action="AddFireDamageCascade, SCore" range="4" filter="MaterialDamage" />
///
/// <!-- Shares the same material surface classification -->
/// <triggered_effect trigger="onSelfDamagedBlock" action="AddFireDamageCascade, SCore" range="4" filter="MaterialSurface" />
/// </remarks>
[UsedImplicitly]
public class MinEventActionAddFireDamageCascade : MinEventActionRemoveBuff
{
private enum FilterTypeCascade
{
Type,
Material,
MaterialDamage,
MaterialSurface
}
private FilterTypeCascade _filterType = FilterTypeCascade.Type;
public override void Execute(MinEventParams @params)
{
var position = @params.Position;
if (targetType != TargetTypes.positionAOE)
{
if (Voxel.voxelRayHitInfo.bHitValid)
{
var hitInfo = Voxel.voxelRayHitInfo;
if (hitInfo == null) return;
position = hitInfo.hit.blockPos;
}
}
SpreadFire(position);
}
private void SpreadFire(Vector3 position)
{
var targetBlock = GameManager.Instance.World.GetBlock(new Vector3i(position));
var range = (int)maxRange;
for (var x = -range; x <= range; x++)
{
for (var z = -range; z <= range; z++)
{
for (var y = -range; y <= range; y++)
{
var vector = new Vector3i(position.x + x, position.y + y, position.z + z);
var neighborBlock = GameManager.Instance.World.GetBlock(vector);
switch (_filterType)
{
case FilterTypeCascade.Type:
if (neighborBlock.type == targetBlock.type)
FireManager.Instance.Add(vector);
break;
case FilterTypeCascade.Material:
if (neighborBlock.Block.blockMaterial.id == targetBlock.Block.blockMaterial.id)
FireManager.Instance.Add(vector);
break;
case FilterTypeCascade.MaterialDamage:
if (neighborBlock.Block.blockMaterial.DamageCategory ==
targetBlock.Block.blockMaterial.DamageCategory)
FireManager.Instance.Add(vector);
break;
case FilterTypeCascade.MaterialSurface:
if (neighborBlock.Block.blockMaterial.SurfaceCategory ==
targetBlock.Block.blockMaterial.SurfaceCategory)
FireManager.Instance.Add(vector);
break;
}
}
}
}
}
public override bool ParseXmlAttribute(XAttribute attribute)
{
var flag = base.ParseXmlAttribute(attribute);
if (flag) return true;
var name = attribute.Name.LocalName;
if (name != "filter") return false;
_filterType = EnumUtils.Parse<FilterTypeCascade>(attribute.Value, true);
return true;
}
}

View File

@@ -0,0 +1,42 @@
using JetBrains.Annotations;
using System.Xml.Linq;
/// <summary>
/// Checks to see if there's any fire blocks within the specified range, using the player's position as center.
/// </summary>
/// <remarks>
/// Example:
///
/// The cvar specified, by default _closeFires, will contain the number of burning blocks in the range.
/// <triggered_effect trigger="onSelfBuffUpdate" action="CheckFireProximity, SCore" range="5" cvar="_closeFires" />
/// </remarks>
[UsedImplicitly]
public class MinEventActionCheckFireProximity : MinEventActionRemoveBuff
{
string cvar = "_closeFires";
public override void Execute(MinEventParams @params)
{
if (FireManager.Instance.Enabled == false) return;
var position = new Vector3i(@params.Self.position);
var count = FireManager.Instance.CloseFires(position, (int)maxRange);
if (count == 0)
count = -1;
@params.Self.Buffs.SetCustomVar(cvar, count);
}
public override bool ParseXmlAttribute(XAttribute attribute)
{
var flag = base.ParseXmlAttribute(attribute);
if (flag) return true;
var name = attribute.Name.LocalName;
if (name != "cvar") return false;
cvar = attribute.Value;
return true;
}
}

View File

@@ -0,0 +1,46 @@
using JetBrains.Annotations;
/// <summary>
/// Remove Fire within the specified range, using the specified target.
/// </summary>
/// <remarks>
/// Example:
/// This will remove fire from all blocks with a range of 5 from the position of the target.
/// <triggered_effect trigger="onSelfDamagedBlock" action="RemoveFire, SCore" target="positionAOE" range="5"/>
/// </remarks>
[UsedImplicitly]
public class MinEventActionRemoveFire : MinEventActionRemoveBuff
{
private static readonly string AdvFeatureClass = "FireManagement";
public override void Execute(MinEventParams @params)
{
if (FireManager.Instance == null) return;
if (FireManager.Instance.Enabled == false) return;
var position = @params.Position;
if (targetType != TargetTypes.positionAOE)
{
if (Voxel.voxelRayHitInfo.bHitValid)
{
var hitInfo = Voxel.voxelRayHitInfo;
if (hitInfo == null) return;
position = hitInfo.hit.blockPos;
}
}
var range = (int)maxRange;
for (var x = -range; x <= range; x++)
{
for (var z = -range; z <= range; z++)
{
for (var y = -range; y <= range; y++)
{
var vector = new Vector3i(position.x + x, position.y + y, position.z + z);
if (!FireManager.IsBurning(vector)) continue;
FireManager.Instance.Extinguish(vector);
}
}
}
}
}