[MOD] Retro-Frame
Posted: Sat Jan 27, 2024 8:04 pm
Nexus.
The source code is available on Github.
This mod:
This feature, coupled with the error log viewer, is particularly useful for testing mods.
You could create a testing mod and register custom hotkey handlers to create enemies, modify character status, etc., then activate your mod whenever you want to test other mods you are developing.
Here is some explanatory sample code for a test mod:
Update: Added the ability for other mods to grab and modify the content panel. See the github Readme for details.
Hey all, just dropped the Retro-Frame UI mod over on The source code is available on Github.
This mod:
- moves HUD info to the unused edges of the screen
- Adds hotkey functionality, including custom actions supplied by other mods
- adds an error log indicator and display
This feature, coupled with the error log viewer, is particularly useful for testing mods.
You could create a testing mod and register custom hotkey handlers to create enemies, modify character status, etc., then activate your mod whenever you want to test other mods you are developing.
Here is some explanatory sample code for a test mod:
Code: Select all
void Start()
{
Debug.Log("Start(): MyTestingMod");
Mod retroFrame = ModManager.Instance.GetMod("Retro-Frame");
const string registerHotkey = "registerCustomHotkeyHandler";
retroFrame.MessageReceiver(registerHotkey, ("Disease", Texture2D.redTexture), Inflict);
retroFrame.MessageReceiver(registerHotkey, ("Poison", Texture2D.redTexture), Inflict);
retroFrame.MessageReceiver(registerHotkey, ("Vampirism", Texture2D.redTexture), Inflict);
retroFrame.MessageReceiver(registerHotkey, ("Lycanthrope", Texture2D.redTexture), Inflict);
retroFrame.MessageReceiver(registerHotkey, ("Mage", Texture2D.redTexture), CreateEnemy);
retroFrame.MessageReceiver(registerHotkey, ("Skeleton", Texture2D.redTexture), CreateEnemy);
Debug.Log("Finished Start(): MyTestingMod");
}
void Inflict(string description, object hotkeyIndex)
{
PlayerEntity player = GameManager.Instance.PlayerEntity;
EntityEffectBundle bundle;
switch (description.ToLower())
{
case "poison":
FormulaHelper.InflictPoison(player, player, DaggerfallWorkshop.Game.Items.Poisons.Moonseed, true);
break;
case "disease":
FormulaHelper.InflictDisease(player, player, new Diseases[] { Diseases.BloodRot });
break;
case "vampirism":
bundle = GameManager.Instance.PlayerEffectManager.CreateVampirismDisease();
GameManager.Instance.PlayerEffectManager.AssignBundle(bundle, AssignBundleFlags.SpecialInfection);
break;
case "lycanthrope":
bundle = GameManager.Instance.PlayerEffectManager.CreateLycanthropyDisease(LycanthropyTypes.Werewolf);
GameManager.Instance.PlayerEffectManager.AssignBundle(bundle, AssignBundleFlags.SpecialInfection);
break;
default:
break;
}
}
void CreateEnemy(string description, object hotkeyIndex)
{
MobileTypes mobileType;
switch (description.ToLower())
{
case "mage":
mobileType = MobileTypes.Mage;
break;
case "skeleton":
mobileType = MobileTypes.SkeletalWarrior;
break;
default:
mobileType = MobileTypes.Rat;
break;
}
Transform parent = GameObjectHelper.GetBestParent();
Vector3 location = GameManager.Instance.PlayerObject.transform.position;
location += GameManager.Instance.PlayerObject.transform.forward * 2;
string name = mobileType.ToString();
GameObject go = GameObjectHelper.InstantiatePrefab(DaggerfallUnity.Instance.Option_EnemyPrefab.gameObject, name, parent, location);
SetupDemoEnemy setupEnemy = go.GetComponent<SetupDemoEnemy>();
setupEnemy.ApplyEnemySettings(mobileType, MobileReactions.Hostile, MobileGender.Female, 0, false);
GameManager.Instance.RaiseOnEnemySpawnEvent(go);
DaggerfallEntityBehaviour behaviour = setupEnemy.GetComponent<DaggerfallEntityBehaviour>();
EnemyEntity enemy = behaviour.Entity as EnemyEntity;
DaggerfallUI.AddHUDText($"Spawned {enemy.Name}({name})");
DaggerfallEnemy dfEnemy = behaviour.GetComponent<DaggerfallEnemy>();
dfEnemy.LoadID = DaggerfallUnity.NextUID;
}
Update: Added the ability for other mods to grab and modify the content panel. See the github Readme for details.