Crowbar
Small miscellaneous library for Airframe Ultra modding.Crowbar
Small miscellaneous library for Airframe Ultra modding.
Setup
- Download
Crowbar.dll(and optionallyCrowbar.xmlfor documentation) and place them in theModsfolder. - In Visual Studio, add it as a Shared Project Reference.
- Add this assembly attribute:
[assembly: MelonAdditionalDependencies("Crowbar")]
Features
ActionMenu
var option = new ActionMenu.Option(
// This function will run when the option is selected
() =>
{
LoggerInstance.Msg("Hello world!");
},
// Set default option label
"hello world"
);
// This function will run when options are being collected for the menu
ActionMenu.RegisterForCollection(
() =>
{
// Add option with default label
ActionMenu.AddOption(option);
// Add option with specified text
ActionMenu.AddOption(option, "foo");
// Add grayed out (unselectable) option with default label
ActionMenu.AddOption(option, false);
// Add grayed out (unselectable) option with specified text
ActionMenu.AddOption(option, "bar", false);
}
);
Command
var cmd = new Command(
// The unique identifier for the command; consider prepending your mod name or something
"myMod_myCommand",
// This function will run when the command is sent
// It executes for all players, including the caller
(Il2CppQuantum.Frame f) =>
{
LoggerInstance.Msg("AAAAHHHRGH!");
// For the caller specifically, this will run
// multiple times (on every predicted frame + the final verified one)
// If you don't want this, add a check for `f.IsVerified`
if (!f.IsVerified) return;
LoggerInstance.Msg("This line prints once");
}
);
// Execute the command for all players
// Returns `true` if successful
cmd.Send();
Packet
var packet = new Packet(
// The unique identifier for the packet; consider prepending your mod name or something
"myMod_myPacket",
// This function will run when the packet is received
// It executes for all clients excluding the sender
(Il2CppPhoton.Realtime.Player player, Dictionary<string, string> data) =>
{
LoggerInstance.Msg($"{data["abc"]}, {data["def"]}");
}
);
// Send the packet to all other clients
// Returns `true` if successful
packet.Send(
new Dictionary<string, string>
{
["abc"] = "123",
["def"] = "456",
}
);
Misc
// Returns the Humanoid_View belonging to the local player.
public static Humanoid_View GetLocalHumanoidView()
// Returns `true` if this client is the room host.
// Always `true` outside of an online room.
public static bool IsHost()
// Prints a list of components belonging to a Quantum entity.
public static void PrintComponentList(EntityRef r)
