-
Notifications
You must be signed in to change notification settings - Fork 5
Style Guide
Here's a basic Style Guide when working on this project:
Please log any relevant information to the RagePluginHook.log file using this code:
Game.LogTrivial("YOBBINCALLOUTS: <message to log>.");
Please comment liberally.
So, when I started coding, I never used CamelCase. Therefore, most of the code simply capitalizes each word in an identifier (i.e., CamelCase
).
This is bad. I apologize. Personally, I don't really care, however would prefer if you keep it consistent.
For methods that either are only used a handfull of times in one Callout, or require significant changes depending on the callout, feel free to make helper methods within the callout itself.
For methods that could have siginficant utility in other callouts with minimal changes, consider creating a helper function in CallHandler.cs
. Check out the guide to Helper Functions for more info.
- In the
CalloutInfo
attribute at the start of each callout, the name should be typed out with spaces and proper capitalization. Example:[CalloutInfo("Hospital Emergency", CalloutProbability.High)]
- In the Class Name, the callout should be typed out as one word with each word being capitalized.
Example: HospitalEmergency
- In
Config.cs
, Callouts should be placed in theCallouts
section. - The name of the variable should be the same as the name of the class.
- The description of the Callout (as it appears in the INI File) should be the same as the name in the CalloutInfo attribute.
- All callouts should be set to
true
by default.
Example: public static readonly bool HospitalEmergency = INIFile.ReadBoolean("Callouts", "Hospital Emergency", true);
- In
Main.cs
, Callouts should be registered by LSPDFR in theRegisterCallouts()
method.
Example: if (Config.HospitalEmergency || !Config.INIFile.Exists()) Functions.RegisterCallout(typeof(Callouts.HospitalEmergency));
Please refer to the Callout Template.
Colors should be assigned via the following conventions:
- Red - active suspects or emergencies.
- Blue -victims, witnesses, bystanders, civillians.
- Yellow -general locations (i.e. search areas).
- Orange -search locations for suspects, evidence, or other "red" items.
- Green - the player.
- Purple - any other special items of interest/objects, not covered above.
Messages meant to guide the player (assuming they've never used the callouts) are encouraged. Please use the color conventions.
Additionally, optional messages, for example help messages that may be obvious to someone who has been playing lspdfr for a while, should be indicated using the Config.DisplayHelp
parameter in the Config File.
For example, if(Config.DisplayHelp) Game.DisplayHelp("A Help Message");
would display the help message if Config.DisplayHelp
is set to true
by the user. Advanced users and streamers will often disable this.
If displaying a help messaage with a key binding, please highlight the key in Yellow.
Additionally, please make these keys dynamic by using the parameters in the Config.cs
file. Such keys include:
-
Config.MainInteractionKey
- Main Interaction Key for advancing dialogue, interacting with stuff -
Config.CalloutEndKey
- to end the callout. -
Config.Key1
&Config.Key2
- keys for decisions - options 1 & 2 respectively.
All subtitles should follow the color conventions.
The person speaking (including the player) should also be displayed as shown below.
In general, the duration
parameter is optional, I recommend keeping it as default unless you find there is a more appropriate duration for the situation.
Example: Game.DisplaySubtitle("~r~Suspect:~w~ <text>");
Dialogue can be easily played using the CallHandler.Dialgoue
helper function. This will play dialogue in a list<string>
format, advancing when the user presses the Config.MainInteractionKey
. The ped speaking (unless it is the player) should be specified and will assume a speaking animation unless otherwise specified.
Example:
CallHandler.Dialogue(ExampleDialogue, Victim)
Please store the dialogue in individual lists for each conversation, at the start of the plugin where local variables are declared.
Example:
private readonly List<string> ExampleDialogue = new List<string>() { "~b~Victim:~w~ Hey Officer, Over Here!!", "~g~You:~w~ What's going on? Are you okay?", };