Caves of Qud

Caves of Qud

48 ratings
More Modding Goodies!
   
Award
Favorite
Favorited
Unfavorite
Branch: Stable
File Size
Posted
Updated
1.240 MB
9 Jan @ 8:28am
5 May @ 10:18am
52 Change Notes ( view )

Subscribe to download
More Modding Goodies!

In 1 collection by Tyrir
Tyrir's Mods
18 items
Description
This is a mod library. It also includes bug fixes and wishes geared towards modders.

Bug Fixes
  • Deployed turrets had more ammo than they were given.
  • Turrets could be disarmed or unequipped as if they were an NPC holding a gun. (disabled by default)
  • In the inventory screen, no gamepad keybinding for 'tooltip' was displayed.

Wishes
lastwish
Use lw or lastwish to retrieve any of your prior wishes. Press Esc to traverse backwards in history.

c#
You can wish using C# incantations, if you know the language! Wish cs --help for the in-game help manual.

c# Wish Usage
Use cs or c# and one of the following.
  • an expression e.g.
    cs The.Player.DisplayName
  • statements e.g.
    cs var newName = "bob"; The.Player.DisplayName = newName; return The.Player.DisplayName;
  • a file containing an expression, statements, or full C# source that includes Main(string[] args), placed in either the Wishes directory in Configuration Files[wiki.cavesofqud.com] or the Wishes directory in a mod folder. Then, use -f with its filename to run the wish file. String arguments can be passed to the wish by adding them after the filename e.g.
    cs -f filename arg1 arg2
c# Wish Files
The following wish files are contained in this mod:
  • pick: Picks any GameObject on the screen. You can run code on the picked object by chaining (-c) the wish e.g.
    cs -f pick -c c0.DisplayName = "Jim"
  • pickbodypart, removebodypart: Picks or removes a BodyPart.
  • pickskill, removeskill: Picks or removes a BaseSkill.
  • pickability, removeability: Picks or removes an ActivatedAbilityEntry.
  • pickpart, removepart: Picks or removes an IPart.
  • addpart: Creates and adds the specified IPart to a GameObject e.g.
    cs -f addpart Brain
  • nunit: Run NUnit tests. A sample test suite file is provided:
    cs -l nunitsampletest -f nunit
  • logcalls: Logs each call of a method or constructor to Player.log, including its parameters, instance, return value, and exceptions.
    cs -f logcalls XRL.World.GameObject:ProcessEnterCell
  • dumphistoryspice: Prints the merged history spice json to Player.log.
  • dumpblueprints: Prints the merged xml for every blueprint to Player.log.
  • dumppopulationtables: Prints the merged population tables to Player.log.

APIs
Events
These events use IModEventHandler. For usage, see code examples.
Ranged Combat Events
  • GetIsSkilledWithMissileWeaponEvent: Determines whether a creature is skilled with a MissileWeapon e.g. for adding a new ranged weapon skill tree.
  • GetCombatMissileEnergyCostEvent: Determines the energy cost of firing a MissileWeapon.
  • GetMagazineAmmoLoaderReloadEnergyCostEvent: Determines the energy cost of reloading a weapon with the MagazineAmmoLoader part.
  • AttackerProjectileHitEvent: Raised when an attacker hits a target with a projectile.
  • ActorShotMissileWeaponCompletingEvent: Raised when an actor is completing an attack with a MissileWeapon.
  • ActorShotMissileWeaponCompletedEvent: Raised when an actor has completed an attack with a MissileWeapon.

Action Events
  • TurnStartEvent: Raised before the beginning of the turn for each actor. This event occurs before an action is taken.
  • PlayerTurnStartEvent: Same as above, but only raised for the player.
  • GetEquipItemEnergyCostEvent: Determines the energy cost of equipping an object.

MoreCombat
  • FireMissileWeapon: Equivalent to Combat.FireMissileWeapon, except that it accepts 2 additional parameters, WeaponSelection and WeaponSelectionByPart, to select which weapons to fire.
  • Dismember: Equivalent to Axe_Dismember.Dismember() but has additional parameters and is more amenable to ranged attacks, including appropriate player messaging.
  • PerformCleave: Similar to Axe_Cleave.PerformCleave() but has additional parameters and bug fixes. The base amount of the cleave is parameterized.

MoreOutput
  • Popup: Displays a popup to the player.
  • Message: Adds a message to the player's sidebar.
  • Notification: Displays a notification to the user that disappears after several seconds.
  • LoadAndDisplayMessage: Show the animated loading message at the bottom of the screen, with your mod's name ascribed. Useful for long-running tasks such as parsing files.

Logging APIs
These logging APIs include fixes for various issues and inconsistencies in vanilla Qud's logging APIs.
  • Error: Always provides stack trace. Filename and line numbers are always provided where available. Color code markup is escaped from stack trace output. Provides an optional short message to the player that an error occurred. Copies error to clipboard, and provides user a button to open the mod on the Steam Workshop.
  • CallerError: This method will assign the error to the mod that called your method. This is useful if other mods, for example, pass invalid parameters to your code.
  • Warn
  • CallerWarn
  • Info
  • Debug : This log level is disabled by default.
  • Options to control log verbosity (including popups, player messages, enable/disable debug level) are in Options -> Debug.

MoreOptions
  • TryParseOption(name, out result, default): Parses string, bool, and int Options.xml options, providing the specified default value if the option is invalid or missing.

ToDebugString
  • ToDebugString is an extension method for pretty printing any object, including printing its fields and structure recursively.
  • This is used to pretty print return values from C# Wishes.
  • Verbosity options in Options -> Debug.

Attributes
  • [RequiredGameSystem]: Attribute for IScribedSystem / IGameSystem to simplify the initialization complexities. It initializes your System whether in a new game, old game, or a savegame that added your mod mid-save. For any custom initialization, OnGameStart(GameObject player) will be called when the game starts.

Misc
  • ScribedBaseSkill: Similar to BaseSkill, but improved save game compatibility if adding/removing class fields.
  • ScribedActivePart: Same as above, but for IActivePart.
  • ScribedPoweredPart: Same as above, but for IPoweredPart.

Usage
To use this library in your mod,
  1. add it as a Required Item to your mod's steam workshop page, and
  2. add it as a Dependency to your mod's manifest.json.
See Documentation for detailed instructions.

Code Examples
See Documentation for more code examples.
Popular Discussions View All (3)
13
7 May @ 10:55am
PINNED: Questions, Issues, Feedback
Tyrir
4
29 Apr @ 11:33am
PINNED: Documentation
Tyrir
0
28 Apr @ 9:58am
PINNED: Dump Errors and Bug reports here
Tyrir
21 Comments
ncd22 23 Jul @ 6:46am 
I've recently come across a problem where the "You Pass By..." and "You're not a dromad" mod have stopped working. I've tried unsubscribing/resubscribing, verifying files, and deleting the mods from the manage properties window. The only other mods I use are "Let me wiki that" and "Zone Loot List". Any help/advice would be appreciated!
Pimpin Pippin 18 Jul @ 12:31am 
Thanks!
Could you please consider a mod for two optional QoLife improvements:
- Hostile enemies no longer do that "refuses to speak with you" when you click on them in combat.
- Meaningless popups like when Basking (Photosynth Skin) and "Whipping up a Meal" from campfire now appear in only the message log (not as annoying whole screen popups that require multiple space button presses).
Tyrir  [author] 29 May @ 12:13pm 
@Pimpin Pippin

Maybe try the following wish?

cs The.Player.PermuteRandomMutationBuys()
Pimpin Pippin 25 May @ 4:57am 
Thank you for the mods!
If you can please explain, i heard it is possible to reset the "random mutation buy seed" with this mod, similar to how the Nectar item does it?
Tyrir  [author] 28 Mar @ 7:44am 
@zaptrap
Thanks for letting me know! Updated with a fix. Hopefully now I tracked down all the ways Qud's code does a check for unequipping :)
zaptrap 27 Mar @ 5:38pm 
I found another way to disarm turrets! If you use a ganglionic teleprojector to dominate the turret, they can unequip the weapon and drop it :slugcatdead:
ZenithTheWolf 25 Mar @ 3:45pm 
Oh, wow, thanks for telling me and leaving an option for it! You patched what I thought was a feature. Lol :Annoyed_Wolf:
Tyrir  [author] 25 Mar @ 3:10pm 
I should also add that while you can't disarm a turret (because if a turret were disarmed, it wouldn't be a turret any longer!), you can Undeploy Turrets!
Tyrir  [author] 25 Mar @ 3:01pm 
@ZenithTheWolf
This mod applies a bug fix to address the known Qud issue where turrets are disarmable, as if they were some watervine farmer holding a vinereaper. :p

You can disable the bug fix in Options -> Debug if you prefer though.
ZenithTheWolf 25 Mar @ 2:49pm 
Wait, I see something related to disarming but I may have missed something- Does this mod cause an issue with disarming turrets? Ever since updating my game to 1.0 (and thus enabling this mod) I have been unable to Swipe+Dueling Stance disarm turrets- SPECIFICALLY turrets. Is this a known issue?