Screen shot of the new system ?
- Fixed crash bug.
- Lowered durability for Demonite, Crimtane, and Hallowed tiers.
- Added manual durability adjustments for specific items via. config file.
- Added numeric display of durability.
Can the green bar be removed now that we name numbers ?
Not currently. I'll add that later.Can the green bar be removed now that we name numbers ?
GREATNot currently. I'll add that later.
Well, this is what I currently use in consideration of this:so far I really enjoy the mod but would it be possible if you could modify the durability to take into account the usetime? weapons that hit really fast just break so quickly
public void Use( Item item, int hits = 1, double scale_override = 0d ) {
if( !this.HasDurability( item ) || this.ConcurrentUses >= DurabilityItemInfo.MaxConcurrentUses ) { return; }
ConfigurationData data = DurabilityMod.Config.Data;
double wear = (double)hits * (double)data.WearMultiplier;
int max = DurabilityItemInfo.CalculateWearAndTear( item );
// If we're not using a pick, scale according to use time (supplements item.value)
if( scale_override == 0 ) {
if( ItemHelper.IsPenetratorMelee(item) ) {
scale_override = 1d;
} else {
scale_override = (double)ItemHelper.CalculateStandardUseTime( item ) / 16d;
scale_override = scale_override <= 0d ? 1d : scale_override;
}
}
wear *= scale_override;
this.WearAndTear += wear;
this.ConcurrentUses++;
this.RecentUseDisplayBarAnimate = 8;
if( this.WearAndTear >= max ) {
this.WearAndTear = max;
this.KillMe( item );
}
}
public static class ItemHelper {
// ...
private static IDictionary<int, int> ProjPene = new Dictionary<int, int>();
public static bool IsPenetratorMelee( Item item ) {
if( item.shoot <= 0 ) { return false; }
if( !ItemHelper.ProjPene.Keys.Contains( item.shoot ) ) {
var proj = new Projectile();
proj.SetDefaults( item.shoot );
ItemHelper.ProjPene[item.shoot] = proj.penetrate;
}
return ItemHelper.ProjPene[item.shoot] == -1 || ItemHelper.ProjPene[item.shoot] >= 3; // 3 seems fair?
}
public static int CalculateStandardUseTime( Item item ) {
int use_time;
// No exact science for this one
if( item.melee ) {
use_time = item.useAnimation;
} else {
use_time = item.useTime;
if( item.reuseDelay > 0 ) { use_time = (use_time + item.reuseDelay) / 2; }
if( item.useTime <= 0 || item.useTime == 100 ) { // 100 = default amount
if( item.useAnimation > 0 && item.useAnimation != 100 ) { // 100 = default amount
use_time = item.useAnimation;
}
}
}
return use_time;
}
}
never mind i just relized you can but a smithing hammer to fix armor...Well, this is what I currently use in consideration of this:
And:Code:public void Use( Item item, int hits = 1, double scale_override = 0d ) { if( !this.HasDurability( item ) || this.ConcurrentUses >= DurabilityItemInfo.MaxConcurrentUses ) { return; } ConfigurationData data = DurabilityMod.Config.Data; double wear = (double)hits * (double)data.WearMultiplier; int max = DurabilityItemInfo.CalculateWearAndTear( item ); // If we're not using a pick, scale according to use time (supplements item.value) if( scale_override == 0 ) { if( ItemHelper.IsPenetratorMelee(item) ) { scale_override = 1d; } else { scale_override = (double)ItemHelper.CalculateStandardUseTime( item ) / 16d; scale_override = scale_override <= 0d ? 1d : scale_override; } } wear *= scale_override; this.WearAndTear += wear; this.ConcurrentUses++; this.RecentUseDisplayBarAnimate = 8; if( this.WearAndTear >= max ) { this.WearAndTear = max; this.KillMe( item ); } }
Code:public static class ItemHelper { // ... private static IDictionary<int, int> ProjPene = new Dictionary<int, int>(); public static bool IsPenetratorMelee( Item item ) { if( item.shoot <= 0 ) { return false; } if( !ItemHelper.ProjPene.Keys.Contains( item.shoot ) ) { var proj = new Projectile(); proj.SetDefaults( item.shoot ); ItemHelper.ProjPene[item.shoot] = proj.penetrate; } return ItemHelper.ProjPene[item.shoot] == -1 || ItemHelper.ProjPene[item.shoot] >= 3; // 3 seems fair? } public static int CalculateStandardUseTime( Item item ) { int use_time; // No exact science for this one if( item.melee ) { use_time = item.useAnimation; } else { use_time = item.useTime; if( item.reuseDelay > 0 ) { use_time = (use_time + item.reuseDelay) / 2; } if( item.useTime <= 0 || item.useTime == 100 ) { // 100 = default amount if( item.useAnimation > 0 && item.useAnimation != 100 ) { // 100 = default amount use_time = item.useAnimation; } } } return use_time; } }
Reduce `RepairDegradationMultiplier` to whatever smaller amount you like (or 0, for none).How do I tweak the config so items still degrade but at a quite slow rate as the current one breaks items to quick for me
#AllModsNeedToBeOpenSourceSource code now available: https://github.com/hamstar0/tml-durability-mod
Of course , only if they all we're open source#AllModsNeedToBeOpenSource
#HamstarForPresident
#VoteNow
I try to keep all my mods open source, I wish every other modder did the same ;'(Of course , only if they all we're open source