Hello dear, mb you add Developer Hooks?
1. Check BuildingUpgradeActivate (BasePlayer player) retrun bool
2. Call Deactive BuildingUpgradeDeactivate(BasePlayer player) Clear timer and other options for use this plugin
3. Set grade BuildingUpgradeSet(BasePlayer player, grade)
And other Hooks, myb you have more idea :)
And optimise Data file, if user change active timer add this player to data file, if not use default time upgrade. Data file have for all players one timer.
( If this possible :) )
Developer HooksSuggestion
regarding data file, changes to it are already planned and it will become lagless once I get to update the plugin. thanks for the hook suggestions
I'm glad you found these ideas useful.
Merged post
This is purely a suggestion
private static bool IsRepair(BaseEntity ent) => ent != null && (ent?.ShortPrefabName == "wall.external" || ent?.ShortPrefabName == "wall.ice.wall" || ent?.ShortPrefabName == "wall.external.high.ice" || ent?.ShortPrefabName == "ect");
Change this in OnHammerHit
var block = info.HitEntity as BuildingBlock;
if (block == null)
{
return null;
}To
if (block == null || IsRepair(info.HitEntity) || block.health < block.MaxHealth())
{
player.IPlayer.Reply("Switching to Repair mode");
PluginData.Preference.Get(player.UserIDString).SetGrade(BuildingGrade.Enum.None);
return null;
}And add command Enable autoswitch to repair mode
Merged post
if (block == null)
{
if(info != null && IsRepair(info.HitEntity)) {
player.IPlayer.Reply("Switching to repair mode");
PluginData.Preference.Get(player.UserIDString).SetGrade(BuildingGrade.Enum.None);
}
return null;
}
if(block.health < block.MaxHealth())
{
player.IPlayer.Reply("Switching to repair mode");
PluginData.Preference.Get(player.UserIDString).SetGrade(BuildingGrade.Enum.None);
return null;
} Remembered, need add this to lang
Change this
Player.IPlayer.Message(GetMsg("Grade: Changed", Player.IPlayer.Id).Replace("{grade}", Grade.ToString()));To
Player.IPlayer.Message(GetMsg("Grade: Changed", Player.IPlayer.Id).Replace("{grade}", GetMsg(Grade.ToString(), Player.IPlayer.Id)));And add to -> lang.RegisterMessages
{"Wood", "Wood"},
{"Stone", "Stone"},
{"Metal", "Metal"},
{"TopTier", "TopTier"},
{"None", "Default"}