Barotrauma Resets to false each time the MoveCamera method is called. How long does it take for the ai target to fade out if not kept alive. Should be reset to false each frame and kept indetectable by e.g. a status effect. Does the AI target do something that requires Update() to be called (e.g. static targets don't need to be updated) Enable the character to attack the outposts and the characters inside them. Disabled by default in normal levels, enabled in outpost levels. The monster won't try to damage these submarines How long do we hold on to the current state after losing a target before we reset back to the original state. In other words, how long do we have to idle before the original state is restored. Resets the target's state to the original value defined in the xml. Temporarily changes the predefined state for a target. Eg. Idle -> Attack. Note: does not change the current AIState! Resets each frame How far other characters can hear reports done by this character (e.g. reports for fires, intruders). Defaults to infinity. List of previous attacks done to this character Returns true when the safety is stale Check whether the character has a diving suit in usable condition plus some oxygen. Check whether the character has a diving mask in usable condition plus some oxygen. Note: uses a single list for matching items. The item is reused each time when the method is called. So if you use the method twice, and then refer to the first items, you'll actually get the second. To solve this, create a copy of the collection or change the code so that you first handle the first items and only after that query for the next items. Updates the hull safety for all ai characters in the team. The idea is that the crew communicates (magically) via radio about the threads. The safety levels need to be calculated for each bot individually, because the formula takes into account things like current orders. There's now a cached value per each hull, which should prevent too frequent calculations. Can there be multiple objective instaces of the same type? Run the main objective with all subobjectives concurrently? If false, the main objective will continue only when all the subobjectives have been removed (done). There's a separate property for diving suit and mask: KeepDivingGearOn. Final priority value after all calculations. When true, the objective is never completed, unless CanBeCompleted returns false. Aborts the objective when this condition is true. A single shot event. Automatically cleared after launching. Use OnCompleted method for implementing (internal) persistent behavior. A single shot event. Automatically cleared after launching. Use OnAbandoned method for implementing (internal) persistent behavior. A single shot event. Automatically cleared after launching. Use OnSelected method for implementing (internal) persistent behavior. A single shot event. Automatically cleared after launching. Use OnDeselected method for implementing (internal) persistent behavior. Makes the character act according to the objective, or according to any subobjectives that need to be completed before this one This method allows multiple subobjectives of same type. Use with caution. Call this only when the priority needs to be recalculated. Use the cached Priority property when you don't need to recalculate. Checks if the subobjectives in the given collection are removed from the subobjectives. And if so, removes it also from the dictionary. Checks if the objective already is created and added in subobjectives. If not, creates it. Handles objectives that cannot be completed. If the objective has been removed form the subobjectives, a null value is assigned to the reference. Returns true if the objective was created and successfully added. Inversed draw order, which is used for drawing the limbs in 3d (deformable sprites). Offset added to the default draw depth of the character's limbs. For example, climbing on ladders affects the depth of the character to get it to render behind the ladders. Maximum damage per impact (0.1 = 10% of the character's maximum health) In sim units. Joint scale applied. Call this to create the ragdoll from the RagdollParams. Saves all serializable data in the currently selected ragdoll params. This method should properly handle character flipping. Resets the serializable data to the currently selected ragdoll params. Force reloading always loads the xml stored on the disk. Resets the current joint values to the serialized joint params. Resets the current limb values to the serialized limb params. if false, force is applied to the position of pullJoint How long has the ragdoll stayed motionless Get the position of the surface of water at the position of the character, in display units (taking into account connected hulls above the hull the character is in) Get the position of the surface of water and the ceiling (= upper edge of the hull) at the position of the character, in display units (taking into account connected hulls above the hull the character is in). Note that if there are multiple limbs of the same type, only the first (valid) limb is returned. Used for multiplying all the damage. Used for multiplying all the ranges. Used for multiplying the physics forces. Legacy support. Use Afflictions. Only affects ai decision making. All the conditionals has to be met in order to select the attack. TODO: allow to define conditionals using any (implemented in StatusEffect -> move from there to PropertyConditional?) Is the character currently visible on the camera. Refresh the value by calling DoVisibilityCheck. Can be used by status effects Can be used to set camera shake from status effects Control the Character according to player input Finds the front (lowest depth) interactable item at a position. "Interactable" in this case means that the character can "reach" the item. The Character who is looking for the interactable item, only items that are close enough to this character are returned The item at the simPosition, with the lowest depth, is returned If this is true and an item cannot be found at simPosition then a nearest item will be returned if possible If a hull is specified, only items within that hull are returned Creates a progress bar that's "linked" to the specified object (or updates an existing one if there's one already linked to the object) The progress bar will automatically fade out after 1 sec if the method hasn't been called during that time Note that when a predicate is provided, the random option uses Linq.Where() extension method, which creates a new collection. MonsterEvents disable monsters (which includes removing them from the character list, so they essentially "don't exist") until they're ready to spawn Is the character controlled remotely (either by another player, or a server-side AIController) Is the character controlled by another human player (should always be false in single player) Is the character player or does it have an active ship command manager (an AI controlled sub)? Bots in the player team are not treated as commanders. Prevents the character from interacting with items or characters Prevents the character from highlighting items or characters with the cursor, meaning it can't interact with anything but the things it has currently selected/equipped Items the character has in their hand slots. Doesn't return nulls and only returns items held in both hands once. Can be used by status effects to check whether the characters is in a high-pressure environment Can be used by status effects Was the character in full health at the beginning of the frame? Current speed of the character's collider. Can be used by status effects to check if the character is moving. The primary selected item. It can be any device that character interacts with. This excludes items like ladders and chairs which are assigned to . The secondary selected item. It's an item other than a device (see ), e.g. a ladder or a chair. Has the characters selected a primary or a secondary item? Is the item either the primary or the secondary selected item? Create a new character The name, gender, config file, etc of the character. Position in display units. RNG seed to use if the character config has randomizable parameters. Is the character controlled by a remote player. Is the character controlled by AI. Ragdoll configuration file. If null, will select the default. Create a new character Name of the species (or the path to the config file) Position in display units. RNG seed to use if the character config has randomizable parameters. The name, gender, etc of the character. Only used for humans, and if the parameter is not given, a random CharacterInfo is generated. ID to assign to the character. If set to 0, automatically find an available ID. Is the character controlled by a remote player. Is the character controlled by AI. Should clients receive a network event about the creation of this character? Ragdoll configuration file. If null, will select the default. Can be used to modify the character's speed via StatusEffects Can be used to modify the speed at which Propulsion ItemComponents move the character via StatusEffects (e.g. heavy suit can slow down underwater scooters) Can be used to modify the character's health via StatusEffects Health multiplier of the human prefab this character is an instance of (if any) Speed reduction from the current limb specific damage. Min 0, max 1. Values lower than this seem to cause constantious flipping when the mouse is near the player and the player is running, because the root collider moves after flipping. A simple check if the character Dir is towards the target or not. Uses the world coordinates. Finds the closest item seeking by identifiers or tags from the world. Ignores items that are outside or in another team's submarine or in a submarine that is not connected to this submarine. Also ignores non-interactable items and items that are taken by someone else. The method is run in steps for performance reasons. So you'll have to provide the reference to the itemIndex. Returns false while running and true when done. Set an action that's invoked when another character interacts with this one. Action invoked when another character interacts with this one. T1 = this character, T2 = the interacting character Displayed on the character when highlighted. How far the character is from the closest human player (including spectators) How far the character is from the closest human player (including spectators) Force an order to be set for the character, bypassing hearing checks Apply the specified attack to this character. If the targetLimb is not specified, the limb closest to worldPosition will receive the damage. Is the character knocked down regardless whether the technical state is dead, unconcious, paralyzed, or stunned. With stunning, the parameter uses an one second delay before the character is treated as knocked down. The purpose of this is to ignore minor stunning. If you don't want to to ignore any stun, use the Stun property. Calls using 'Inventory' and 'Info.InventoryData' Returns hulls that are visible to the player, including the current hull. Can be heavy if used every frame. Is the character currently protected from the pressure by immunity/ability or a status effect (e.g. from a diving suit). Check if the character is in the same room Room and hull differ in that a room can consist of multiple linked hulls Shows visual notification of money gained by the specific player. Useful for mid-mission monetary gains. This dictionary is used for stats that are required very frequently. Not very performant, but easier to develop with for now. If necessary, the approach of using a dictionary could be replaced by an encapsulated class that contains the stats as attributes. A dictionary with temporary values, updated when the character equips/unequips wearables. Used to reduce unnecessary inventory checking. ID of the last inputs the server has processed Override the distance-based alpha value with the iconAlpha parameter value Note: Can be null. Endocrine boosters can unlock talents outside the user's talent tree. This method is used to cull them from the selection Returns unlocked talents that aren't part of the character's talent tree (which can be unlocked e.g. with an endocrine booster) Can be used to disable displaying the job in any info panels Unique ID given to character infos in MP. Non-persistent. Used by clients to identify which infos are the same to prevent duplicate characters in round summary. Returns a presumably (not guaranteed) unique hash using the (current) Name, appearence, and job. So unless there's another character with the exactly same name, job, and appearance, the hash should be unique. Returns a presumably (not guaranteed) unique hash using the OriginalName, appearence, and job. So unless there's another character with the exactly same name, job, and appearance, the hash should be unique. Reloads the head sprite and the attachment sprites. Save current orders to the parameter element Save current orders to Reloads the attachment xml elements according to the indices. Doesn't reload the sprites. Container for the icons above the health bar Container for passive afflictions that have been hidden from afflictionIconContainer Maximum vitality without talent- or job-based modifiers Was the character in full health at the beginning of the frame? Get the total strength of the afflictions of a specific type attached to a specific limb Type of the affliction The limb the affliction is attached to Does the affliction have to be attached to only the specific limb. Most monsters for example don't have separate healths for different limbs, essentially meaning that every affliction is applied to every limb. 0-1. How much vitality the affliction reduces, taking into account the effects of vitality modifiers on the limb the affliction is on (if limb-based) Get the identifiers of the items that can be used to treat the character. Takes into account all the afflictions the character has, and negative treatment suitabilities (e.g. a medicine that causes oxygen loss may not be suitable if the character is already suffocating) A dictionary where the key is the identifier of the item and the value the suitability If true, the suitability values are normalized between 0 and 1. If not, they're arbitrary values defined in the medical item XML, where negative values are unsuitable, and positive ones suitable. If above 0, the method will take into account how much currently active status effects while affect the afflictions in the next x seconds. Automatically filters out buffs. Returns true if the type or the identifier matches the defined types/identifiers. Tag -> priority. Note that different limbs can share the same deformations. Use ragdoll.SpriteDeformations for a collection that cannot have duplicates. Get the full path of a limb sprite, taking into account tags, gender and head id Note that during the limb initialization, character.AnimController returns null, whereas this field is already assigned. Returns true if the attack successfully hit something. If the distance is not given, it will be calculated. Attach the limb to a target with WeldJoints. Uses sim units. A class used for handling special key actions in chat boxes. For example tab completion or up/down arrow key history. Keep track of the registered fields so we don't register them twice I couldn't figure out where to register this in where it wouldn't register twice It's probably not the most optimal way of doing this so feel free to change this where I'm utilizing this Registers special input actions to the selected input field GUI Element we want to register Instance Call this function whenever we should stop doing special stuff and return normal behavior. For example when you deselect the chat box. Scroll up or down on the message history and return a message Direction we want to scroll the stack Leftover text that is in the chat box when we override it A message or null Prefer FromPath<T> when possible, this just exists for cases where the type can only be decided at runtime Class dedicated to transitioning away from the old, shitty Mods + Submarines folders to the new LocalMods folder Executed when a client uses the command. If not set, the command is relayed to the server as-is. Using a command that's considered a cheat disables achievements Use this constructor to create a command that executes the same action regardless of whether it's executed by a client or the server. Other events can't trigger conversations if some other event has triggered one within this time. Intended to prevent multiple events from triggering conversations at the same time. Registers the exhaustible events in the level as exhausted, and adds the current events to the event history Finds all actions in a ScriptedEvent Get the entity that should be used in determining how far the player has progressed in the level. = The submarine or player character that has progressed the furthest. The list order is important. It defines the order in which we "override" in case no valid position types are found in the level when generating them in . Percentage. Value between 0 and 1. Is the mission at a state at which the only thing left to do is to reach the end of the level? Is the mission at a state at which the mission cannot be completed anymore? Returns the amount of marks you get from the reward (e.g. "3,000 mk") Returns the full reward text of the mission (e.g. "Reward: 2,000 mk" or "Reward: 500 mk x 2 (out of max 5) = 1,000 mk") The reward that was actually given from completing the mission, taking any talent bonuses into account (some of which may not be possible to determine in advance) Where was this mission received from? Affects which faction we give reputation for if the mission is configured to give reputation for the faction that gave the mission. Defaults to Locations[0] Triggers the event or adds it to the delayedTriggerEvents it if it has a delay Triggers the event immediately, ignoring any delays End the mission and give a reward if it was completed successfully Get the final reward, taking talent bonuses into account if the mission has concluded and the talents modified the reward accordingly. Calculates the final reward after talent bonuses have been applied. Note that this triggers talent effects of the type OnGainMissionMoney, and should only be called once when the mission is completed! If enabled, locations this mission takes place in cannot change their type The mission can only be received when travelling from a location of the first type to a location of the second type The mission can only be received in these location types Show entities belonging to these sub categories when the mission starts Note that the integer values matter here: the state of the target can't go back to a smaller value, and a larger or equal value than the RequiredRetrievalState means the item counts as retrieved (if the item needs to be picked up to be considered retrieved, it's also considered retrieved if it's in the sub) Does the target need to be picked up or brought to the sub for mission to be considered successful. If None, the target has no effect on the completion of the mission. Status effects executed on the target item when the mission starts. A random effect is chosen from each child list. Renders the font into at least one texture atlas, which is simply a collection of all glyphs in the ranges defined by charRanges. Don't call this too often or with very large sizes. Graphics device, required to create textures. Character ranges between each even element with their corresponding odd element. Default is 0x20 to 0xFFFF. Texture dimensions. Default is 512x512. Base character used to shift all other characters downwards when rendering. Defaults to T. Wraps a string of text to fit within a given width. Optionally returns the caret position of a certain character, or all of them. No attempt to contact the consent server has been made An error occurred while attempting to retrieve consent status The consent status was not saved on the remote database The user explicitly denied consent The user explicitly granted consent Sets the consent status. This method cannot be called to set the status to Consent.Yes; only a positive response from the database or the user accepting via the privacy policy prompt should enable it. Implementation of the bulk of SetConsent. DO NOT CALL THIS UNLESS NEEDED. Adds an error event to GameAnalytics if an event with the same identifier has not been added yet. Doesn't automatically enable los or bot AI or do anything like that. Probably not fully implemented. Allows the game to perform any initialization it needs to before starting to run. This is where it can query for any required services and load any non-graphic related content. Calling base.Initialize will enumerate through any components and initialize them as well. LoadContent will be called once per game and is the place to load all of your content. UnloadContent will be called once per game and is the place to unload all content. Allows the game to run logic such as updating the world, checking for collisions, gathering input, and playing audio. Provides a snapshot of timing values. This is called when the game should draw itself. Entity sold in SP. Or, entity sold by client and confirmed by server in MP. Entity sold by client in MP. Client has received at least one update from server after selling, but this entity wasn't yet confirmed. Entity sold by client in MP. Client hasn't yet received an update from server after selling. Present only in single player games. In multiplayer. The chatbox is found from GameSession.Client. This property stores the preference in settings. Don't use for automatic logic. Use AutoShowCrewList(), AutoHideCrewList(), and ResetCrewList(). Add character to the list without actually adding it to the crew Sets which character is selected in the crew UI (highlight effect etc) Adds the message to the single player chatbox. Sets the character's current order (if it's close enough to receive messages from orderGiver) and displays the order in the crew UI Displays the specified order in the crew UI next to the character. node.Color = node.HighlightColor * nodeColorMultiplier The order giver doesn't need to be set for the Order instances as it will be set when the node button is clicked. Create order nodes based on the item context The order giver doesn't need to be set for the Order instances as it will be set when the node button is clicked. Use a negative value (e.g. -1) if there should be no hotkey associated with the node Create node icon with a fixed absolute size Enables/disables report buttons when needed Remove info of a selected character. The character will not be visible in any menus or the round summary. Remove the character from the crew (and crew menus). The character to remove If the character info is also removed, the character will not be visible in the round summary. Gets the current personal wallet In singleplayer this is the campaign bank and in multiplayer this is the personal wallet There is a server-side implementation of the method in The location that's displayed as the "current one" in the map screen. Normally the current outpost or the location at the start of the level, but when selecting the next destination at the end of the level at an uninhabited location we use the location at the end Automatically cleared after triggering -> no need to unregister Load the first level and start the round after loading a save file Which type of transition between levels is currently possible (if any) Which submarine is at a position where it can leave the level and enter another one (if any). Updates store stock before saving the game Returns a random faction based on their ControlledOutpostPercentage If true, the method can return null if the sum of the factions ControlledOutpostPercentage is less than 100% Returns a random faction based on their SecondaryControlledOutpostPercentage If true, the method can return null if the sum of the factions SecondaryControlledOutpostPercentage is less than 100% Also serializes the current sub. Loads the campaign from an XML element. Creates the map if it hasn't been created yet, otherwise updates the state of the map. Instantiates a new single player campaign Loads a previously saved single player campaign from XML Start a completely new single player campaign Load a previously saved single player campaign from xml Start a new GameSession. Will be saved to the specified save path (if playing a game mode that can be saved). Start a new GameSession with a specific pre-selected mission. Load a game session from the specified XML document. The session will be saved to the specified path. Switch to another submarine. The sub is loaded when the next round starts. Returns a list of crew characters currently in the game with a given filter. Character type filter In singleplayer mode the CharacterType.Player returns the currently controlled player. Hints that have already been shown this round and shouldn't be shown shown again until the next round Seconds before any reminders can be shown Seconds before another reminder can be shown Create the objective list that holds the objectives (called on start and on resolution change) Stops content running and adds the active segment to the objective list Adds the segment to the objective list This class handles all upgrade logic. Storing, applying, checking and validation of upgrades. Upgrades are applied per item basis meaning each item has their own set of slots for upgrades. The store applies upgrades globally to categories of items so the purpose of this class is to keep those individual "upgrade slots" in sync. The target level of an upgrade is stored in the metadata and is what the store displays and modifies while this class will make sure that the upgrades on the items match the values stored in the metadata. This one toggles whether or not connected submarines get upgraded too. Could probably be removed, I just didn't like magic numbers. This is used by the client in multiplayer, acts like a secondary PendingUpgrades list but is not affected by server messages. Not used in singleplayer. This is used by the client to notify the server which upgrades are yet to be paid for. In singleplayer this does nothing. Purchases an upgrade and handles logic for deducting the credit. Purchased upgrades are temporarily stored in and they are applied after the next round starts similarly how items are spawned in the stowage room after the round starts. Purchases an item swap and handles logic for deducting the credit. Cancels the currently pending item swap, or uninstalls the item if there's no swap pending Applies all our pending upgrades to the submarine. Upgrades are applied similarly to how items on the submarine are spawned at the start of the round. Upgrades should be applied at the start of the round and after the round ends they are written into the submarine save and saved there. Because of the difficulty of accessing the actual Submarine object from and outpost or when the campaign UI is created we modify levels that are shown on the store interface using campaign metadata. This method should be called by both the client and the server during level generation. Makes the NPC talk or if no NPC has been specified find the upgrade NPC and make it talk. Optional NPC to make talk, if null tries to find one at the outpost. This might seem a bit spaghetti but it's the only way I could figure out how to do this and make it work in both multiplayer and singleplayer because in multiplayer the client doesn't have access to SubmarineInfo.OutpostNPCs list so we cannot find the upgrade NPC using that and the client cannot use Character.Speak anyways in multiplayer so the alternative is to send network packages when interacting with the NPC. Validates that upgrade values stored in CampaignMetadata matches the values on the submarine and fixes any inconsistencies. Should be called after every round start right after Applies an upgrade on the submarine, should be called by when the round starts. New level that was applied, -1 if no upgrades were applied. Gets the progress that is shown on the store interface. Includes values stored in the metadata and , and takes submarine tier and class restrictions into account Submarine used to determine the upgrade limit. If not defined, will default to the current sub. Gets the level of the upgrade that is stored in the metadata. May be higher than the apparent level on the current sub if the player has switched to a lower-tier sub Gets the level of the upgrade that is stored in the metadata. Takes into account the limits of the provided submarine. Stores the target upgrade level in the campaign metadata. Used to sync the pending upgrades list in multiplayer. Notify the server of crew changes When set to true will tell the server to update the pending hires When not null tell the server to rename this character. Item1 is the character to rename, Item2 is the new name, Item3 indicates whether the renamed character is already a part of the crew. When not null tell the server to fire this character When set to true will tell the server to validate pending hires A horizontal scaling factor for low aspect ratios (small width relative to height) Has the selected Screen changed since the last time the GUI was drawn. By default, all the gui elements are drawn automatically in the same order they appear on the update list. Adds the component on the addition queue. Note: does not automatically add children, because we might want to enforce a custom order for them. Adds the component on the removal queue. Removal list is evaluated last, and thus any item on both lists are not added to update list. Updated automatically before updating the elements on the update list. Set the cursor to an hourglass. Will automatically revert after 10 seconds or when is called. Should the indicator move based on the camera position? Override the distance-based alpha value with the specified alpha value Draws a bezier curve with dots. Creates multiple buttons with relative size and positions them automatically. Creates multiple buttons with absolute size and positions them automatically. Creates multiple elements with relative size and positions them automatically. Creates multiple elements with absolute size and positions them automatically. Attempts to move a set of UI elements further from each other to prevent them from overlapping UI elements to move Areas the UI elements are not allowed to overlap with (ignored if null) The elements will not be moved outside this area. If the parameter is not given, the elements are kept inside the window. Displays a message at the center of the screen, automatically preventing overlapping with other centered messages. TODO: Allow to show messages at the middle of the screen (instead of the top center). Returns all child elements in the hierarchy. Currently only used for the fade effect in GUIListBox, should be set to the same value as Color but only assigned once This is the new constructor. Only GUI should call this method. Auto updating follows the order of GUI update list. This order can be tweaked by changing the UpdateOrder property. By default, all the gui elements are updated automatically in the same order they appear on the update list. Updates all the children manually. Only GUI should call this method. Auto drawing follows the order of GUI update list. This order can be tweaked by changing the UpdateOrder property. By default, all the gui elements are drawn automatically in the same order they appear on the update list. Draws all the children manually. Creates and draws a tooltip. Creates a context menu. This constructor does not make the context menu active. Use to make right click context menus. Position at which to create the context menu Header text Background style list of context menu options Inflates a point by the size of the text Pint to resize String whose size to inflate by What font to use The size of the text Checks if the mouse cursor is over this context menu or any of its sub menus GUIComponent that can be used to render custom content on the UI Finds the component after which the listbox should be drawn //(= the component highest in the hierarchy, to get the listbox //to be rendered on top of all of it's children) Note that stretching cannot be undone, because the previous child sizes are not stored. A frame drawn behind the content of the listbox A frame that contains the contents of the listbox. The frame itself is not rendered. Scrolls the list smoothly Whether to only allow scrolling from one element to the next when smooth scrolling is enabled When set to true elements at the bottom of the list are gradually faded Adds enough extra padding to the bottom so the end of the scroll will only contain the last element When set to true always selects the topmost item on the list true if mouse down should select elements instead of mouse up Disables the scroll bar without hiding it. Automatically hides the scroll bar when the content fits in. Setting this to true and CanBeFocused to false allows the list background to be unfocusable while the elements can still be interacted with. For horizontal listbox, default side is on the bottom. For vertical, it's on the right. Scrolls the list to the specific element. Close the message box automatically after enough time has passed () Close the message box automatically if the condition is met Use to create a message box of Hint type Parent does not matter. It's overridden. If enabled, the value wraps around to Max when you go below Min, and vice versa Calculates one percent between the range as the increment/decrement. This value is rounded so that the bigger it is, the less decimals are used (min 0, max 3). Return value is clamped between 0.1f and 1000. Get the area the slider should be drawn inside 0 = empty, 1 = full ListBoxes with lots of content in them clamp the size of the scrollbar above a certain minimum size; this is the relative bar size without the clamping applied. General green color used for elements whose colors are set from code General red color used for elements whose colors are set from code General red color used for elements whose colors are set from code General blue color used for elements whose colors are set from code General yellow color used for elements whose colors are set from code Color to display the name of modded servers in the server list. When enabled, the text is automatically scaled down to fit the textblock horizontally. When enabled, the text is automatically scaled down to fit the textblock vertically. This is the new constructor. If the rectT height is set 0, the height is calculated from the text. Overrides the color for all the states. Set the text scale of the GUITextBlocks so that they all use the same scale and can fit the text within the block. Set the text scale of the GUITextBlocks so that they all use the same scale and can fit the text within the block. Set the text scale of the GUITextBlocks so that they all use the same scale and can fit the text within the block. Don't set the Text property on delegates that register to this event, because modifying the Text will launch this event -> stack overflow. If the event launches, the text should already be up to date! Triplet.first = filepath, Triplet.second = resolution, Triplet.third = audio gain Uses Linq queries. Don't use too frequently or reimplement. Should be assigned only by GUIComponent. Note that RectTransform is created first and the GUIComponent after that. This means the GUIComponent is not set before the GUIComponent is initialized. Relative to the parent rect. Min size in pixels. Does not affect scaling. Max size in pixels. Does not affect scaling. Size before scale multiplications. Size after scale multiplications. Applied to all RectTransforms. The elements are not automatically resized, if the global scale changes. You have to manually call RecalculateScale() for all elements after changing the global scale. This is because there is currently no easy way to inform all the elements without having a reference to them. Having a reference (static list, or event) is problematic, because deconstructing the elements is not handled manually. This means that the uncleared references would bloat the memory. We could recalculate the scale each time it's needed, but in that case the calculation would need to be very lightweight and garbage free, which it currently is not. Defined as portions of the parent size. Also the direction of the offset is relative, calculated away from the anchor point. Absolute in pixels but relative to the anchor point. Calculated away from the anchor point, like a padding. Use RelativeOffset to set an amount relative to the parent size. Screen space offset. From top left corner. In pixels. Calculated from the selected pivot. In pixels. Screen space point in pixels. Does not automatically calculate children. Note also that if you change the pivot point with this property, the pivot does not automatically match the anchor. You can use SetPosition to change everything automatcally or MatchPivotToAnchor to match the pivot to anchor. Does not automatically calculate children. Note also that if you change the anchor point with this property, the pivot does not automatically match the anchor. You can use SetPosition to change everything automatically or MatchPivotToAnchor to match the pivot to anchor. The element provided as the argument is the changed child. It may be new in the hierarchy or just repositioned. By default, elements defined with an absolute size (in pixels) will scale with the parent. This can be changed by setting IsFixedSize to true. If false, the element will resize if the parent is resized (with the children). If true, the element will resize only when explicitly resized. Note that scaling always affects the elements. Currently this needs to be manually called only when the global scale changes. If the local scale changes, the scale is automatically recalculated. Manipulates ScreenSpaceOffset. If you want to manipulate some other offset, access the property setters directly. Returns all parent elements in the hierarchy. Returns all child elements in the hierarchy. Converts the offset so that the direction is always away from the anchor point. The elements are not automatically resized, if the global scale changes. You have to manually call RecalculateScale() for all elements after changing the global scale. This is because there is currently no easy way to inform all the elements without having a reference to them. Having a reference (static list, or event) is problematic, because deconstructing the elements is not handled manually. This means that the uncleared references would bloat the memory. We could recalculate the scale each time it's needed, but in that case the calculation would need to be very lightweight and garbage free, which it currently is not. Sprite batch extensions for drawing primitive shapes Modified from: https://github.com/craftworkgames/MonoGame.Extended/blob/develop/Source/MonoGame.Extended/ShapeExtensions.cs Draws a closed polygon from a shape Draws a closed polygon from an array of points Draws a closed polygon from an array of points Draws a line from point1 to point2 with an offset Draws a line from point1 to point2 with an offset Draws a line from point1 to point2 with an offset Draws a point at the specified x, y position. The center of the point will be at the position. Draws a point at the specified position. The center of the point will be at the position. Original source: https://github.com/craftworkgames/MonoGame.Extended/blob/develop/Source/MonoGame.Extended/Shapes/Polygon.cs Can be null when there are no deals at the current location Can be null when there are no deals at the current location Can be null when there are no deals at the current location Buy items from the store Sell items from the character inventory Sell items from the sub Select an element from CrewListFrame The size of fixed area around the slice area How much the borders of a sliced sprite are allowed to scale You may for example want to prevent a 1-pixel border from scaling down (and disappearing) on small resolutions How much the borders of a sliced sprite are allowed to scale You may for example want to prevent a 1-pixel border from scaling down (and disappearing) on small resolutions Get the scale of the sliced sprite's borders when it's draw inside an area of a specific size While set to true any call to will cause the buy button to be disabled and to not update the prices. This is to prevent us from buying another upgrade before the server has given us the new prices and causing potential syncing issues. Creates vertices for the submarine border that we use to draw it and check mouse collision Most of this code is copied from the status terminal but instead of drawing a line from X to Y we create a rotated rectangle instead and store the 4 corners into the array. Gets all "points of interest" GUIFrames on the upgrade preview interface that match the corresponding upgrade category. Used only for circles. Currently used only for rectangles. Flash the slots the item is allowed to go in (not taking into account whether there's already something in those slots) Can the inventory be accessed when the character is still alive Can the inventory be accessed by the character itself when the character is still alive (only has an effect if AccessibleWhenAlive false) If there is no room in the generic inventory (InvSlotType.Any), check if the item can be auto-equipped into its respective limbslot If there is room, puts the item in the inventory and returns true, otherwise returns false Discharge coil only draws power when charging Updates plant's state to fully grown or dead depending on its conditions. True if the plant has finished growing. The base class for components holding the different functionalities of the item Overload this method and implement. The method is automatically called when the resolution changes. Launches when the parent of the GuiFrame is changed. Which sound should be played when manual sound selection type is selected? Not [Editable] because we don't want this visible in the editor for every component. Can be used by status effects or conditionals to the speed of the item a Character has picked the item a Character has dropped the item true if the operation was completed Remove the component so that it doesn't appear to exist in the game world (stop sounds, remove bodies etc) but don't reset anything that's required for cloning the item Returns 0.0f-1.0f based on how well the Character can use the itemcomponent 0.5f if all the skills meet the skill requirements exactly, 1.0f if they're way above and 0.0f if way less Returns 0.0f-1.0f based on how well the Character can use the itemcomponent 0.5f if all the skills meet the skill requirements exactly, 1.0f if they're way above and 0.0f if way less Only checks if any of the Picked requirements are matched (used for checking id card(s)). Much simpler and a bit different than HasRequiredItems. Called when all items have been loaded. Use to initialize connections between items. Called when all the components of the item have been loaded. Use to initialize connections between components and such. Can be used to set the sprite depth individually for each contained item Depth at which the contained sprites are drawn. If not set, the original depth of the item sprites is used. The capacity of the main container without taking the sub containers into account. Only differs when there's a sub container defined for the component. Can be used by status effects to lock the inventory Returns the index of the first slot whose restrictions match the specified tag or identifier The current multiplier for the light color (usually equal to , but in the case of e.g. blinking lights the multiplier doesn't go to 0 when the light turns off, because otherwise it'd take a while for it turn back on based on the lightBrightness which is interpolated towards the current voltage). Reset client-side prediction of the light's state to the last known state sent by the server after resetPredictionTimer runs out The current brightness of the light source, affected by powerconsumption/voltage Move items towards the last slot in the inventory if there's free slots Power consumption of the engine. Only consume power when active and adjust consumption based on condition and target force. When grid is resolved update the previous voltage Power consumption of the fabricator. Only consume power when active and adjust consumption based on condition. Move the items required for fabrication into the input container. The method assumes that all the required ingredients are available either in the input container or linked containers. Power consumption of the MiniMap. Only consume power when active and adjust consumption based on condition. Power consumption of the Pump. Only consume power when active and adjust consumption based on condition. Returns a negative value (indicating the reactor generates power) when querying the power output connection. Min and Max power output of the reactor based on tolerance Determine how much power to output based on the load. The load is divided between reactors according to their maximum output in multi-reactor setups. Do we need more fuel to generate enough power to match the current load. How low we allow the output/load ratio to go before loading more fuel. 1.0 = always load more fuel when maximum output is too low, 0.5 = load more if max output is 50% of the load Can be null if the property HasMineralScanner is false Based largely on existing CheckBlipVisibility() code Accessed through event actions. Do not remove even if there are no references in code. Power consumption of the sonar. Only consume power when active and adjust the consumption based on the sonar mode. Can be used by status effects to disable all the UI controls Makes the sonar view CustomComponent render the steering HUD, preventing it from being drawn behing the sonar How fast the steering vector adjusts when the nav terminal is operated by something else than a character (= signals) Get optimal velocity for moving towards a position Position to steer towards to How heavily the sub slows down when approaching the target Attempts to harvest a fully grown plant or removes a decayed plant if any The character who gets the produce or null if they should drop on the floor. Returns the power consumption if checking the powerIn connection, or a negative value if the output can provide power when checking powerOut. Power consumption is proportional to set recharge speed and if there is less than max charge. Minimum and maximum output for the queried connection. Powerin min max equals CurrPowerConsumption as its abnormal for there to be power out. PowerOut min power out is zero and max is the maxout unless below 10% charge where the output is scaled relative to the 10% charge. Connection being queried Current grid load Minimum and maximum power output for the connection Finalized power out from the container for the connection, provided the given grid information Output power based on the maxpower all batteries can output. So all batteries can equally share powerout based on their output capabilities. When the corresponding grid connection is resolved, adjust the container's charge. List of all powered ItemComponents The amount of power currently consumed by the item. Negative values mean that the item is providing power to connected items Current voltage of the item (load / power) The minimum voltage required for the item to work The maximum amount of power the item can draw from connected items Maximum voltage factor when the device is being overvolted. I.e. how many times more effectively the device can function when it's being overvolted Essentially Voltage / MinVoltage (= how much of the minimum required voltage has been satisfied), clamped between 0 and 1. Can be used by status effects or sounds to check if the item has enough power to run Allocate electrical devices into their grids based on connections Use previous grids and change in connections Update the power calculations of all devices and grids Updates grids in the order of ConnCurrConsumption - Get load of device/ flag it as an outputting connection -- If outputting power -- MinMaxPower - Minimum and Maximum power output of the connection for devices to coordinate ConnPowerOut - Final power output based on the sum of the MinMaxPower -- Finally -- GridResolved - Indicate that a connection's grid has been finished being calculated Power outputting devices are calculated in stages based on their priority Reactors will output first, followed by relays then batteries. Current power consumption of the device (or amount of generated power if negative) Connection to calculate power consumption for. Minimum and maximum power the connection can provide Connection being queried about its power capabilities Load of the connected grid Finalize how much power the device will be outputting to the connection Connection being queried Current grid power Current load on the grid Power pushed to the grid Can be overridden to perform updates for the device after the connected grid has resolved its power calculations, i.e. storing voltage for later updates Returns the amount of power that can be supplied by batteries directly connected to the item Returns a list of batteries directly connected to the item Additional load coming from somewhere else than the devices connected to the junction box (e.g. ballast flora or piezo crystals). Goes back to zero automatically if you stop setting the value. The item that launched this projectile (if any) Should the collision with the target submarine be ignored (e.g. did the projectile collide with the wall behind the turret when being launched) Fixture the projectile hit Contact between the projectile and the target True if the target isn't a submarine or if the collision happened behind the launch position of the projectile Get a random quality for an item spawning in some sub, taking into account the type of the submarine and the difficulty of the current level (high-quality items become more common as difficulty increases) Check if the character manages to succesfully repair the item Should the progress bar be displayed. Use when AlwaysDisplayProgressBar is set to false. Wires that have been disconnected from the panel, but not removed completely (visible at the bottom of the connection panel). Allows rewiring the connection panel despite rewiring being disabled on a server Check if the character manages to succesfully rewire the panel, and if not, apply OnFailure effects Pass the parent component to the constructor to access the serializable properties for elements which change property values. Can be used to display messages on the terminal via status effects Returns the wifi components that can receive signals from this one Returns the wifi components that can transmit signals to this one Effects applied to entities inside the trigger Attacks applied to entities inside the trigger Returns correct angle between -2PI and +2PI Turret doesn't consume grid power, directly takes from the batteries on its grid instead. Can be used by status effects Automatically cleared after docking -> no need to unregister Automatically cleared after undocking -> no need to unregister Returns a random side that is not occupied. There is probably a much better way of doing this than allocating memory with an array but this felt like the most reliable approach I could come up with. Defines items that boost the weapon functionality, like battery cell for stun batons. Activate sleeping ragdolls that are close enough to hit with the weapon (otherwise the collision will not be registered) The extents of the sprites or other graphics this component needs to draw. Used to determine which items are visible on the screen. Power consumption of the Oxygen Generator. Only consume power when active and adjust consumption based on condition. Order in which power sources will provide to a grid, lower number is higher priority Used by reactors to communicate their maximum output to each other so they can divide the grid load between each other in a sensible way Relay power consumption. Load consumption is based on the internal buffer. This allows for the relay to react to demand and find equilibrium in loop configurations. Minimum and maximum power out for the relay. Max out is adjusted to allow for other relays to compensate if this relay is undervolted. Power out for the relay connection. Relay will output the necessary power to the grid based on maximum power output of other relays and will undervolt and overvolt the grid following its supply grid. Power outputted to the grid Connection's grid resolved, determine the difference to be added to the buffer. Ensure the prevVoltage voltage is updated once both grids are resolved. Moves the current border highlight animation (if one is running) to the new slot If set, the inventory is automatically positioned inside the rect Check if the mouse is hovering on top of the slot The desired slot we want to check True if our mouse is hover on the slot, false otherwise Refresh the value of IsMouseOnInventory Is the mouse on any inventory element (slot, equip button, subinventory...) Defaults to if null Removes one item from the slot Removes all items from the slot All items contained in the inventory. Stacked items are returned as individual instances. DO NOT modify the contents of the inventory while enumerating this list. All items contained in the inventory. Allows modifying the contents of the inventory while being enumerated. Is the item contained in this inventory. Does not recursively check items inside items. Return the first item in the inventory, or null if the inventory is empty. Return the last item in the inventory, or null if the inventory is empty. Get the item stored in the specified inventory slot. If the slot contains a stack of items, returns the first item in the stack. Get all the item stored in the specified inventory slot. Can return more than one item if the slot contains a stack of items. Find the index of the first slot the item is contained in. Find the indices of all the slots the item is contained in (two-hand items for example can be in multiple slots). Note that this method instantiates a new list. Returns true if the item owns any of the parent inventories. Can the item be put in the inventory (i.e. is there a suitable free slot or a stack the item can be put in). Can the item be put in the specified slot. If there is room, puts the item in the inventory and returns true, otherwise returns false Is there room to put more items in the inventory. Doesn't take stacking into account by default. If true, the inventory is not considered full if all the stacks are not full. Forces an item to a specific slot. Doesn't remove the item from existing slots/inventories or do any other sanity checks, use with caution! Removes an item from a specific slot. Doesn't do any sanity checks, use with caution! Deletes all items inside the inventory (and also recursively all items inside the items) Reposition currently active item interfaces to make sure they don't overlap with each other Items that have one more more Repairable component Items that may potentially need to be cleaned up (pickable, not attached to a wall, and not inside a valid container) Components that are Active or need to be updated for some other reason (status effects, sounds) Removes the override value -> falls back to using the original value defined in the xml. Unscaled rect Use to also check Checks both and Returns interactibility based on whether the character is on a player team Can be used by status effects or conditionals to check what item this item is contained inside Can be used by status effects or conditionals to check whether the item is contained inside something Can be used by status effects or conditionals to the speed of the item Can be used by status effects or conditionals to check if the physics body of the item is active Should the item's Use method be called with the "Use" or with the "Shoot" key? If true, the user has to hold the "aim" key before use is registered. False by default. If true, the user has to hold the "aim" key before secondary use is registered. True by default. Return true if the condition of this item increased within the last second. Per-instance value - if not set, the value of the prefab is used. A list of connections the last signal sent by this item went through Can be used to move the item from XML (e.g. to correct the positions of items whose sprite origin has been changed) Can be used to move the item from XML (e.g. to correct the positions of items whose sprite origin has been changed) Creates a new item Should the OnItemLoaded methods of the ItemComponents be called. Use false if the item needs additional initialization before it can be considered fully loaded (e.g. when loading an item from a sub file or cloning an item). Is dropping the item allowed when trying to swap it with the other item Recheck if the item needs to be included in the list of cleanable items goes through every item and re-checks which hull they are in Recalculates the item's maximum condition, condition percentage and whether it's in full condition. You generally never need to call this manually - done automatically when any of the factors that affect the values change. Applies buoyancy, drag and angular drag caused by water Note: This function generates garbage and might be a bit too heavy to be used once per frame. Note: This function generates garbage and might be a bit too heavy to be used once per frame. Character who dropped the item Should clients be notified of the item being dropped Should the transform of the physics body be updated. Only disable this if you're moving the item somewhere else / calling SetTransform manually immediately after dropping! Instantiate a new item and load its data from the XML element. The element containing the data of the item The submarine to spawn the item in (can be null) Should an EntitySpawner event be created to notify clients about the item being created. Remove the item so that it doesn't appear to exist in the game world (stop sounds, remove bodies etc) but don't reset anything that's required for cloning the item Any item with a Price element in the definition can be sold everywhere. Defines areas where the item can be interacted with. If RequireBodyInsideTrigger is set to true, the character has to be within the trigger to interact. If it's set to false, having the cursor within the trigger is enough. Is this prefab overriding a prefab in another content package How likely it is for the item to spawn in a level of a given type. Can the item be chosen as extra cargo in multiplayer. If not set, the item is available if it can be bought from outposts in the campaign. Update which branches are currently in range of fires Create a body for a branch which works as the hitbox for flamer Decorative branches that grow around the root How far from the root this branch is Returns a dictionary where the keys are the structures that took damage and the values are the amount of damage taken "Diagonal" gaps are used on sloped walls to allow characters to pass through them either horizontally or vertically. Water still flows through them only horizontally or vertically Inherited flags from outpost generation. Approximate distance from this hull to the target hull, moving through open gaps without passing through walls. Uses a greedy algo and may not use the most optimal path. Returns float.MaxValue if no path is found. Returns the hull which contains the point (or null if it isn't inside any) The position to check This hull is checked first: if the current hull is known, this can be used as an optimization Should world coordinates or the sub's local coordinates be used? Does being exactly at the edge of the hull count as being inside? Returns the hull which contains the point (or null if it isn't inside any). The difference to FindHull is that this method goes through all hulls without trying to first find the sub the point is inside and checking the hulls in that sub. = This is slower, use with caution in situations where the sub's extents or hulls may have changed after it was loaded. Is this hull or any of the items inside it tagged as "airlock"? Does this hull have any doors leading outside? Used to check if this character has access to the door leading outside Overrides the commonness of the object in a specific level type. Key = name of the level type, value = commonness in that level type. Makes the cell rounder by subdividing the edges and offsetting them at the middle How small the individual subdivided edges can be (smaller values produce rounder shapes, but require more geometry) How far outside the boundaries of the level the water current that pushes subs towards the level starts How far outside the boundaries of the level the strength of the current starts to increase exponentially How far outside the boundaries of the level the current stops submarines entirely The level generator won't try to adjust the width of the main path above this limit. The crush depth of a non-upgraded submarine in in-game coordinates. Note that this can be above the top of the level! The crush depth of a non-upgraded submarine in "real world units" (meters from the surface of Europa). Note that this can be above the top of the level! Random integers generated during the level generation. If these values differ between clients/server, it means the levels aren't identical for some reason and there will most likely be major ID mismatches. Is there a loaded level set and is it an outpost? Is there a loaded level set, and is it a friendly outpost (FriendlyNPC or Team1) Can be null unless initialized in constructor List is initialized only when specified, otherwise will be null Used by clients to set the rotation for the resources Calculate the "real" depth in meters from the surface of Europa Checks which level objects are in camera view and adds them to the visibleObjects lists Draw the objects behind the level walls Draw the objects in front of the level walls, but behind characters Draw the objects in front of the level walls and characters Only used for editing sprite deformation parameters. The actual LevelObjects use separate SpriteDeformation instances. Which sides of a wall the object can appear on. Overrides the commonness of the object in a specific level type. Key = name of the level type, value = commonness in that level type. A list of prefabs whose properties override this one's properties when a trigger is active. E.g. if a trigger in the index 1 of the trigger list is active, the properties in index 1 in this list are used (unless it's null) Effects applied to entities that are inside the trigger Attacks applied to entities that are inside the trigger How long the trigger stays in the triggered state after triggerers have left does the force diminish by distance Stop applying forces to objects if they're moving faster than this Are there any active contacts between the physics body and the target entity Another trigger was triggered, check if this one should react to it Applies attacks to a damageable. Applies attacks to structures. The elapsed gametime when the vertices of this hull last changed Returns the segments that are facing towards viewPosition How many light sources are allowed to recalculate their light volumes per frame. Pending calculations will be done on subsequent frames, starting from the light sources that have been waiting for a recalculation the longest. If zoomed further out than this, characters no longer obstruct lights behind them. Improves performance, and isn't very noticeable if we do it after zoomed far out enough. Background lights are drawn behind submarines and they don't cast shadows. Update the contents of ConvexHullList and check if we need to recalculate vertices Recheck which convex hulls are in range (if needed), and check if we need to recalculate vertices due to changes in the convex hulls Draws the optional "light sprite", just a simple sprite with no shadows Used for undo/redo to determine what this item has been replaced with A method that modifies the draw depth to prevent z-fighting between entities with the same sprite depth Update the selection logic in submarine editor Updates the logic that runs the highlight box when the mouse is sitting still. true to give items tooltip showing their connection Draw the "selection rectangle" and outlines of entities that are being dragged (if any) Copy the selected entities to the "clipboard" (copiedList) Copy the entities to the "clipboard" (copiedList) and delete them copies a list of entities to the "clipboard" (copiedList) Find entities whose rect intersects with the "selection rect" List of upgrades this item has The index of the outpost module this entity originally spawned in (-1 if not an outpost item) Adds a new upgrade to the item Remove the entity from the entity list without removing links to other entities Call Update() on every object in Entity.list Flip the entity horizontally Should the entity be flipped across the y-axis of the sub it's inside Flip the entity vertically Should the entity be flipped across the x-axis of the sub it's inside Update the linkedTo-lists of the entities based on the linkedToID-lists Has to be done after all the entities have been loaded (an entity can't be linked to some other entity that hasn't been loaded yet) Gets all linked entities of specific type. Gets all linked entities of specific type. Find a matching map entity prefab The name of the item (can be omitted when searching based on identifier) The identifier of the item (if null, the identifier is ignored and the search is done only based on the name) Find a matching map entity prefab A predicate that returns true on the desired prefab. Links defined to identifiers. Check if the name or any of the aliases of this prefab match the given name. Initial zoom (0 - 1, from min zoom to max) Initial zoom (0 - 1, from min zoom to max) Resets and forces crush depth to be calculated again for icon displaying purposes From -> To Load a previously saved campaign map from XML Generate a new campaign map from the seed Get the shortest distance from the start location to another location that satisfies the specified criteria. The distance to a matching location, or int.MaxValue if none are found. Load a previously saved map from an xml element Load the state of an existing map from xml (current state of locations, where the crew is now, etc). Advances the progress of the radiation. Unscaled rect In radians, takes flipping into account Offset of the physics body from the center of the structure. Takes flipping into account. Checks if there's a structure items can be attached to at the given position and returns it. Sections that are leaking have a gap placed on them If null, the orientation is determined automatically based on the dimensions of the structure instances Interval at which we force culled entites to be updated, regardless if the camera has moved Margin applied around the view area when culling entities (i.e. entities that are this far outside the view are still considered visible) Update entity culling when any corner of the view has moved more than this Extents of the solid items/structures (ones with a physics body) and hulls Extents of all the visible items/structures/hulls (including ones without a physics body) How deep down the sub is from the surface of Europa in meters (affected by level type, does not correspond to "actual" coordinate systems) Creates an AI that operates all the turrets on a sub, same as Thalamus but only operates the turrets. Returns a rect that contains the borders of this sub and all subs docked to it, excluding outposts Don't use this directly, because the list is updated only when GetConnectedSubs() is called. The method is called so frequently that we don't want to create new list here. Returns a list of all submarines that are connected to this one via docking ports, including this sub. Attempt to find a spawn position close to the specified position where the sub doesn't collide with walls/ruins Returns a list of physics bodies the ray intersects with, sorted according to distance (the closest body is at the beginning of the list). Can be used to filter the bodies based on some condition. If the predicate returns false, the body isignored. Should fixtures that the start of the ray is inside be returned check visibility between two points (in sim units) a physics body that was between the points (or null) If has value, the sub must match the team type. Returns true if the sub is same as the other. Finds the sub whose borders contain the position Permanently disables obstructed waypoints obstructed by the level. Temporarily disables waypoints obstructed by the other sub. Only affects temporarily disabled waypoints. Extents of the solid items/structures (ones with a physics body) and hulls Extents of all the visible items/structures/hulls (including ones without a physics body) Moves away any character that is inside the bounding box of the sub (but not inside the sub) The translation that was applied to the sub before doing the displacement (used for determining where to push the characters) A random int that gets assigned when saving the sub. Used in mp campaign to verify that sub files match Note: Refreshed for loaded submarines when they are saved, when they are loaded, and on round end. If you need to refresh it, please use Submarine.CheckFuel() method! Calculated from . Can be used when the sub hasn't been loaded and we can't access . Only called by a Gap when the state changes. So in practice used like an event callback, although technically just a method (It would be cleaner to use an actual event in Gap.cs, but event registering and unregistering might cause an extra hassle) How much messages sent by should get garbled. Takes the distance between the entities and optionally the obstructions between them into account (see ). Values greater than or equal to 1 cause the message to get garbled more heavily when there's some obstruction between the characters. Values smaller than 1 mean the garbling only depends on distance. An ID for this client for the current session. THIS IS NOT A PERSISTENT VALUE. DO NOT STORE THIS LONG-TERM. IT CANNOT BE USED TO IDENTIFY PLAYERS ACROSS SESSIONS. The ID of the account used to authenticate this session. This value can be used as a persistent value to identify players in the banlist and campaign saves. Data that we've ignored because we're waiting for some earlier data. Key = byte offset, value = the actual data Fires when the ClientPeer gets disconnected from the server. Does not necessarily mean the client is shutting down, we may still be able to reconnect. Tell the server to start the round (permission required) Tell the server to select a submarine (permission required) Tell the server to select a mode (permission required) Tell the server to end the round (permission required) Read the events from the message, ignoring ones we've already received. Returns false if reading the events fails. Clears events generated by the current client, used when resynchronizing with the server after a timeout. Used when the order targets a wall Same as calling , but the text parameter is set using How much skills drop towards the job's default skill levels when dying When will the shuttle be dispatched with respawned characters When will the sub start heading back out of the level Have some of the properties listed in the server list changed A list of int pairs that represent the ranges of UTF-16 codes allowed in client names The "near" range of the voice chat (a percentage of either SpeakRange or radio range), further than this the volume starts to diminish Interface for entities that the clients can send events to the server Interface for entities that the server can send events to the clients Interface for entities that handle ServerNetObject.ENTITY_POSITION How long the server waits for the clients to get in sync after the round has started before kicking them How long the server keeps events that everyone currently synced has received If a client hasn't received an event that has been succesfully sent to someone within this time, they get kicked If a client hasn't received an event after this time, they get kicked Interpolates the positional error of a physics body towards zero. Interpolates the rotational error of a physics body towards zero. Interpolates the cursor position error towards zero. Write the events to the outgoing message. The recipient parameter is only needed for ServerEntityEventManager Helper class for dealing with 16-bit IDs that wrap around ushort.MaxValue Is newID more recent than oldID, i.e. newId > oldId accounting for ushort rollover newId >= oldId accounting for ushort rollover (newer or equals) Returns some ID that is older than the input ID. There are no guarantees regarding its relation to values other than the input. Is the current ID valid given the previous ID and latest possible ID (not smaller than the previous ID or larger than the latest ID) Check if the two version are compatible (= if they can play together in multiplayer). Based on information found here: https://developer.valvesoftware.com/wiki/SteamID ------------------------------------------------------------------------------------ A SteamID is a 64-bit value (16 hexadecimal digits) that's broken up as follows: | a | b | c | d | Most significant - | 01 | 1 | 00001 | 0546779D | - Least significant a) 8 bits representing the universe the account belongs to. b) 4 bits representing the type of account. Typically 1. c) 20 bits representing the instance of the account. Typically 1. d) 32 bits representing the account number. The account number is additionally broken up as follows: | e | f | Most significant - | 0000010101000110011101111001110 | 1 | - Least significant e) These are the 31 most significant bits of the account number. f) This is the least significant bit of the account number, discriminated under the name Y for some reason. Barotrauma supports two textual representations of SteamIDs: 1. STEAM40: Given this name as it represents 40 of the 64 bits in the ID. The account type and instance both have an implied value of 1. The format is "STEAM_{universe}:{Y}:{restOfAccountNumber}". 2. STEAM64: If STEAM40 does not suffice to represent an ID (i.e. the account type or instance were different from 1), we use "STEAM64_{fullId}" where fullId is the 64-bit decimal representation of the full ID. The primary ID for a given user Other user IDs that this user might be closely tied to, such as the owner of the current copy of Barotrauma Utility struct for writing Singles Value as a 32 bit float Value as an unsigned 32 bit integer This exists because Lidgren is a piece of shit and doesn't readily support sending anything other than a string through a disconnect packet, so this thing needs a sufficiently nasty string representation that can be decoded with some certainty that it won't get mangled by user input. Are there any entities in the spawn queue that match the given predicate How many entities in the spawn queue match the given predicate Method is invoked via reflection, see Returns true if the given data is valid for the given vote type, returns false otherwise. If it returns false, the message must be discarded or reset by the caller, as it is now malformed :) Takes flipping (Dir) into account. Ignore rotation calls for the rest of this and the next update. Automatically disabled after that. Used for temporarily suppressing the SmoothRotate calls to prevent conflicting or unitentionally amplified rotations. Returns the farthest point towards the forward of the body. For capsules and circles, the front is at the top. For horizontal capsules, the front is at the right-most point. For rectangles, the front is either at the top or at the right, depending on which one of the two is greater: width or height. The rotation is in radians. Apply an impulse to the body without increasing it's velocity above a specific limit. Apply an impulse to the body without increasing it's velocity above a specific limit. Applies buoyancy, drag and angular drag caused by water Rotate the body towards the target rotation in the "shortest direction", taking into account the current angular velocity to prevent overshooting. Desired rotation in radians How fast the body should be rotated. Does not represent any real unit, you may want to experiment with different values to get the desired effect. Should the angles be wrapped. Set to false if it makes a difference whether the angle of the body is 0.0f or 360.0f. The main class. The main entry point for the application. Computes sample weightings and texture coordinate offsets for one pass of a separable gaussian blur filter. Evaluates a single point on the gaussian falloff curve. Used for setting up the blur filter weightings. Fps independent mouse input. The draw method is called multiple times per frame. Creates a new joint using the limb IDs. Removes all selected joints and limbs in the params level (-> serializable). The method also recreates the ids and names, when required. Allows the game to run logic such as updating the world, checking for collisions, gathering input, and playing audio. By default, creates a new frame for the screen and adds all elements to the gui update list. Prefab used for dragging from the item catalog into inventories Currently opened hand-held item container like crates When opening an item we save the location of it so we can teleport the dummy character there Global undo/redo state for the sub editor and a selector index for it Coroutine that waits 5 minutes and then runs itself recursively again to save the submarine into a temporary file Saves the current main sub into a temporary file outside of the Submarines/ folder The saving is ran in another thread to avoid lag spikes Loads an item assembly and only returns items which are not inside other inventories. This is to prevent us from trying to place for example Oxygen Tanks inside an inventory when it's already inside a diving suit. Recovers the auto saved submarine Tries to open an item container in the submarine editor using the dummy character The item we want to open Close the currently opened item Teleports the dummy character to the specified position The desired position GUI.MouseOn doesn't get updated while holding primary mouse and we need it to Allows the game to run logic such as updating the world, checking for collisions, gathering input, and playing audio. This is called when the game should draw itself. Holds the references to the input fields. Sets common shared properties to all selected map entities in sub editor. Only works client side while in the sub editor and when parentObject is ItemComponent, Item or Structure. The function has the same parameters as Implement this interface to insert extra entires to the text pickers created for the SerializableEntityEditors of the entity How many instances of the same sound clip can be playing at the same time Represents a biquad-filter. The a0 value. The a1 value. The a2 value. The b1 value. The b2 value. The q value. The gain value in dB. The z1 value. The z2 value. Gets or sets the frequency. value;The samplerate has to be bigger than 2 * frequency. Gets the sample rate. The q value. Gets or sets the gain value in dB. Initializes a new instance of the class. The sample rate. The frequency. sampleRate or frequency or q Initializes a new instance of the class. The sample rate. The frequency. The q. sampleRate or frequency or q Processes a single sample and returns the result. The input sample to process. The result of the processed sample. Processes multiple samples. The input samples to process. The result of the calculation gets stored within the array. Calculates all coefficients. Used to apply a lowpass-filter to a signal. Initializes a new instance of the class. The sample rate. The filter's corner frequency. Calculates all coefficients. Used to apply a highpass-filter to a signal. Initializes a new instance of the class. The sample rate. The filter's corner frequency. Calculates all coefficients. Used to apply a bandpass-filter to a signal. Initializes a new instance of the class. The sample rate. The filter's corner frequency. Calculates all coefficients. Used to apply a notch-filter to a signal. Initializes a new instance of the class. The sample rate. The filter's corner frequency. Calculates all coefficients. Used to apply a lowshelf-filter to a signal. Initializes a new instance of the class. The sample rate. The filter's corner frequency. Gain value in dB. Calculates all coefficients. Used to apply a highshelf-filter to a signal. Initializes a new instance of the class. The sample rate. The filter's corner frequency. Gain value in dB. Calculates all coefficients. Used to apply an peak-filter to a signal. Gets or sets the bandwidth. Initializes a new instance of the class. The sampleRate of the audio data to process. The center frequency to adjust. The bandWidth. The gain value in dB. Calculates all coefficients. Play a sound defined in a sound xml file without any positional effects. Play a sound defined in a sound xml file. If the volume or range parameters are omitted, the volume and range defined in the sound xml are used. If > 0, only one sprite of the same group is used (chosen randomly) The sprite is only drawn if these conditions are fulfilled The sprite is only animated if these conditions are fulfilled Deform the vertices of the sprite using an arbitrary function. The in-parameter of the function is the normalized position of the vertex (i.e. 0,0 = top-left corner of the sprite, 1,1 = bottom-right) and the output is the amount of deformation. Does a rotational deformations around pivot points at the edges of the sprite. 0 = no falloff, the entire sprite is stretched 1 = stretching the center of the sprite has no effect at the edges Maximum stretch per vertex (1 = the size of the sprite) How fast the sprite reacts to being stretched How fast the sprite returns back to normal after stretching ends Stretch a position in the deformable sprite to some direction A negative value means that the deformation is used only by one sprite only (default). A positive value means that this deformation is or could be used for multiple sprites. This behaviour is not automatic, and has to be implemented for any particular case separately (currently only used in Limbs). Only used if UseMovementSine is enabled. Multiplier for Pi. Defined in the shader. Creates a silhouette for the sprite (or outline if the sprite is rendered on top of it) Reference to the xml element from where the sprite was created. Can be null if the sprite was not defined in xml! In pixels 0 - 1 Identifier of the Map Entity so that we can link the sprite to its owner. Creates a supposedly unique identifier from the parent element. If the parent element is not found, uses the sprite element. TODO: If there are multiple elements with exactly the same data, the ids will fail. -> Is there a better way to identify the sprites? ALSO TODO: delete :) Works only if there is a name attribute defined for the sprite. For items and structures, the entity id or name is used if the sprite's name attribute is not defined. Each new sound overrides the existing sounds that were launched with this status effect, meaning the old sound will be faded out and disposed and the new sound will be played instead of the old. Normally the call to play the sound is ignored if there's an existing sound playing when the effect triggers. Used for example for ensuring that rapid playing sounds restart playing even when the previous clip(s) have not yet stopped. Use with caution. Should the item spawn even if the container can't contain items of this type The maximum amount of creatures of the same species in the same team that are allowed to be spawned via this status effect. Also the creatures spawned by other means are counted in the check. Index of the slot the target must be in when targeting a Contained item Always do the conditional checks for the duration/delay. If false, only check conditional on apply. Only valid if the effect has a duration or delay. Can the effect be applied on the same target(s)s if the effect is already being applied? The interval at which the effect is executed. The difference between delay and interval is that effects with a delay find the targets, check the conditions, etc immediately when Apply is called, but don't apply the effects until the delay has passed. Effects with an interval check if the interval has passed when Apply is called and apply the effects if it has, otherwise they do nothing. Can the StatusEffect be applied when the item applying it is broken Which type of afflictions the target must receive for the StatusEffect to be applied. Only valid when the type of the effect is OnDamaged. Fetches a Workshop item's metadata. This is batched to minimize Steamworks API calls. The description of the returned item is truncated to save bandwidth. Workshop Item ID Fetches a Workshop item's metadata in its own API call instead of batching. This minimizes delay but needs to be used with caution to prevent rate limiting. Workshop Item ID If true, ask for the item's entire description, otherwise it'll be truncated. This class creates a file called ".copying" that serves to keep mod copy operations in the same directory from overlapping. This class serves the purpose of preventing more than 10 mod install tasks from proceeding at the same time. Implementation of the Command pattern. Created by Markus Isberg on 11th of March 2020 for the submarine editor. "Implementing a global undo and redo with Memento pattern proved too difficult of a task for me so I implemented it with this pattern instead." A method that should apply a new state on an object or perform an action A method that should revert Execute() method's actions State no longer exists, clean up the lingering garbage A command for setting and reverting a MapEntity rectangle A command for setting and reverting a MapEntity rectangle Entities whose rectangle has been altered The new rectangle that is or will be applied to the map entity Old rectangle the map entity had before If the transform was resized or not All lists should be equal in length, for every receiver there should be a corresponding entry at the same position in newData and oldData. A command that removes and unremoves map entities Creates a command where all entities share the same state. Entities that were deleted or added Whether or not all entities are or are going to be deleted Ignore item inventories when set to false, workaround for pasting A command that places or drops items out of inventories A command that sets item properties A command that sets item properties Affected entities Real property name, not all lowercase A command that moves items around in inventories Maximum upgrade level without taking submarine tier or class restrictions into account Returns the maximum upgrade level for the current sub, taking tier and class restrictions into account Returns the maximum upgrade level for the specified sub, taking tier and class restrictions into account Parse a integer value from a string that is formatted like a percentage increase / decrease. String to parse What XML attribute the value originates from, only used for warning formatting. What XMLElement the value originates from, only used for warning formatting. Whether or not to suppress warnings if both "attribute" and "sourceElement" are defined. This sample returns -15 as an integer. XElement element = new XElement("change", new XAttribute("increase", "-15%")); ParsePercentage(element.GetAttributeString("increase", string.Empty)); Based on http://jakepoz.com/jake_poznanski__background_load_xna.html Checks if point is inside of a polygon Additional check to see if the point is within the bounding box before doing more complex math Note that the bounding box check can be more expensive than the vertex calculations in some cases. Reference Convert a RGB value into a HSV value. Reference Vector3 where X is the hue (0-360 or NaN) Y is the saturation (0-1) Z is the value (0-1) a method for changing inputtypes with old names to the new ones to ensure backwards compatibility with older subs Convert a HSV value into a RGB value. Value between 0 and 360 Value between 0 and 1 Value between 0 and 1 Reference Returns either a green [x] or a red [o] Turn the object into a string and give it rich color based on the object type Calculates the minimum number of single-character edits (i.e. insertions, deletions or substitutions) required to change one string into the other Reads a number of bits from the buffer and inserts them to a new NetBuffer instance Returns a new instance of the class with all properties and fields copied. Copies the values of the source to the destination. May not work, if the source is of higher inheritance class than the destination. Does not work with virtual properties. Cleans up a path by replacing backslashes with forward slashes, and optionally corrects the casing of the path. Recommended when serializing paths to a human-readable file to force case correction on all platforms. Also useful when working with paths to files that currently don't exist, i.e. case cannot be corrected. Path to clean up Should the case be corrected to match the filesystem? Directories that the path should be found in, not returned. Path with corrected slashes, and corrected case if requested. Cleans up a path by replacing backslashes with forward slashes, and corrects the casing of the path on non-Windows platforms. Recommended when loading a path from a file, to make sure that it is found on all platforms when attempting to open it. Path to clean up Path with corrected slashes, and corrected case if required by the platform. Extends % and + characters to color tags in talent name tooltips to make them look nicer. This obviously does not work in languages like French where a non breaking space is used so it's just a a bit extra for the languages it works with. An arbitrary identifier that can be used to determine what kind of a message this is and prevent characters from saying the same kind of line too often. Returns true if any node in the path is in stairs Seeks the ladder from the next and next + 1 nodes. Don't start using a weapon if this condition is true Seeks for more ammunition. Creates a new subobjective. Reloads the ammunition found in the inventory. If seekAmmo is true, tries to get find the ammo elsewhere. Only remove existing items when the contain target can't be put in the inventory If true drops the item when containing the item fails. In both cases abandons the objective. Note that has no effect if the target container was not defined (always drops) -> completes when the item is dropped. 0-1 based on the horizontal size of all of the fires in the hull. Diving gear that's suitable for wearing indoors (-> the bots don't try to unequip it when they don't need diving gear) Tries to find the best (safe, nearby) hull the character can find a path to. Checks one hull at a time, and returns HullSearchStatus.Finished when all potential hulls have been checked. Is the character allowed to take the item from somewhere else than their own sub (e.g. an outpost) Are variants of the specified item allowed Returns the "best" item to spawn when using and there's multiple suitable items. Best in this context is the one that's sold at the lowest price in stores (usually the most "basic" item) Does not reset the ignored items list Doesn't allow the objective to complete if this condition is false Which event action created this objective (if any) Display units If true, the distance to the destination is calculated from the character's AimSourcePos (= shoulder) instead of the collider's position List of all possible items of the specified type. Used for filtering the removed objectives. Excluding the current order. When set above zero, the character will stand still doing nothing until the timer runs out. Does not affect orders, find safety or combat. The AIObjective in with the highest Returns the last active objective of the specific type. Returns all active objectives of the specific type. Creates a new collection -> don't use too frequently. If undefined, a default filter will be used. If set, only fix items where required skill matches this. Name that can be used with the contextual version of the order If defined, the order can only be quick-assigned to characters with these jobs. Or if it's a report, the icon will only be displayed to characters with these jobs. Can the order be turned into a non-entity-targeting one if it was originally created with a target entity. Note: if MustSetTarget is true, CanBeGeneralized will always be false. If defined, the order will be quick-assigned to characters with these jobs before characters with other jobs. Should the order icon be drawn when the order target is inside a container Affects how high on the order list the order will be placed (i.e. the manual priority order when it's given) when it's first given. Manually rearranging orders will override this priority. Get the target item component based on the target item type Only returns items which are interactable for this character Only returns items which are interactable for this character Used to create the order option for the Dismiss order to know which order it targets The order to target with the dismiss order Create an Order instance with a null target Note this property doesn't return the follow target of the Follow objective, as expected! Constructor for orders with the target type OrderTargetType.Entity Constructor for orders with the target type OrderTargetType.Entity Constructor for orders with the target type OrderTargetType.Position Constructor for orders with the target type OrderTargetType.Position Constructor for orders with the target type OrderTargetType.WallSection Constructor for orders with the target type OrderTargetType.WallSection Constructor for orders with the target type OrderTargetType.Entity Constructor for orders with the target type OrderTargetType.Position Constructor for orders with the target type OrderTargetType.WallSection Get the target item component based on the target item type Only returns items which are interactable for this character Only returns items which are interactable for this character Used to create the order option for the Dismiss order to know which order it targets The order to target with the dismiss order Note: Presupposes that the slow speed is lower than the high speed. Otherwise will give invalid results. Note: creates a new list every time, because the params might have changed. If there is a need to access the property frequently, change the implementation to an array, where the slot is updated when the param is updated(?) Currently it's not simple to implement, since the properties are not implemented here, but in the derived classes. Would require to change the params virtual and to call the base property getter/setter or something. Which character gave this affliction Copy properties here instead of using SerializableProperties (with reflection). Use this method to skip clamping and additional logic of the setters. Ideally we would keep this private, but doing so would require too much refactoring. Prevents AfflictionHusks with the specified identifier(s) from transforming the character into an AI-controlled character Bots will not try to treat the affliction if the character has any of these afflictions The affliction is automatically removed after this time. 0 = unlimited An arbitrary modifier that affects how much medical skill is increased when you apply the affliction on a target. If the affliction causes damage or is of type poison or paralysis, the skill is increased only when the target is hostile. If the affliction is of type buff, the skill is increased only when the target is friendly. An arbitrary modifier that affects how much weapons skill is increased when you apply the affliction on a target. The skill is increased only when the target is hostile. Creates a character info from the human prefab. If there are custom character infos defined, those are used, otherwise a randomized info is generated. How much this skill affects characters' hiring cost allAnimations[speciesName][fileName] In degrees. In degrees. Selects a random filepath from multiple paths, matching the specified animation type. Selects all file paths that match the specified animation type. If the file name is left null, default file is selected. If fails, will select the default file. Note: Use the filename without the extensions, don't use the full path! If a custom folder is used, it's defined in the character info file. Note: Overrides old animations, if found! The angle of the collider when standing (i.e. out of water). In degrees. Key = limb id, value = angle in radians In degrees. Key = limb id, value = angle in radians In degrees. In degrees. In degrees. Contains character data that should be editable in the character editor. key1: Species name key2: File path value: Ragdoll parameters If the file name is left null, default file is selected. If fails, will select the default file. Note: Use the filename without the extensions, don't use the full path! If a custom folder is used, it's defined in the character info file. Creates a default ragdoll for the species using a predefined configuration. Note: Use only to create ragdolls for new characters, because this overrides the old ragdoll! Applies the current properties to the xml definition without saving to file. Resets the current properties to the xml (stored in memory). Force reload reloads the file from disk. Should be converted to sim units. Should be converted to sim units. In degrees. In degrees. The orientation of the sprite as drawn on the sprite sheet (in radians). Some conditions rely on specific ability data that is integrally connected to the AbilityEffectType. This is done in order to avoid having to create duplicate ability behavior, such as if an ability needs to trigger a common ability effect but in specific circumstances. These conditions could also be partially replaced by more explicit AbilityEffectType enums, but this would introduce bloat and overhead to integral game logic when instead said logic can be made to only run when required using these conditions. These conditions will return an error if used outside their limited intended use. Used primarily for StatusEffects. Default to constant outside interval abilities. List of abilities that are triggered by this group. Fallback abilities are triggered if the conditional fails List of abilities that are triggered by this group. Fallback abilities are triggered if the conditional fails Talent identifiers of all the talents in this tree How many talents need to be unlocked to consider this tree completed How many talents can be unlocked in total When specified the talent option will show talent with this identifier and clicking on it will expand the talent option to show the talents Base class for content file types, which are loaded from filelist.xml via reflection. PLEASE AVOID INHERITING FROM THIS CLASS DIRECTLY. Inheriting from GenericPrefabFile<T> is likely what you want. Errors that occurred when loading this content package. Currently, all errors are considered fatal and the game will refuse to load a content package that has any errors. An error that occurred when trying to enable this mod. This field doesn't directly affect whether or not this mod can be enabled, but if it's been set to anything other than Option.None then the game has already refused to enable it at least once. Does the content package include some content that needs to match between all players in multiplayer. Has the action finished. If null or empty, the event moves to the next action. Otherwise it moves to the specified label. Rich test to display in debugdraw public override string ToDebugString() { return $"{ToolBox.GetDebugSymbol(isFinished)} SomeAction -> "(someInfo: {info.ColorizeObject()})"; } 'Exhaustible' sets won't appear in the same level until after one world step (~10 min, see Map.ProgressWorld) has passed. If true, events from this set can only occur once in the level. Used to force an event set based on how many other locations have been discovered before this. (Used for campaign tutorial event sets.) Used to force an event set based on how many other outposts have been visited before this. (Used for campaign tutorial event sets.) Randomizes the collection (using OrderBy) and returns it. Randomizes the list in place without creating a new collection, using a Fisher-Yates-based algorithm. Gets a random element of a list using one of the synced random number generators. It's recommended that you guarantee a deterministic order of the elements of the input list via sorting. List to pick a random element from Which RNG to use A random item from the list. Return value should match between clients and the server, if applicable. Executes an action that modifies the collection on each element (such as removing items from the list). Creates a temporary list, unless the collection is empty. Generic version of List.ForEach. Performs the specified action on each element of the collection (short hand for a foreach loop). Iterates over all elements in a given enumerable and discards the result. Shorthand for !source.Any(predicate) -> i.e. not any. Returns whether a given collection has at least a certain amount of elements for which the predicate returns true. Input collection How many elements to match before stopping Predicate used to evaluate the elements Returns the maximum element in a given enumerable, or null if there aren't any elements in the input. Input collection Maximum element or null Same as FirstOrDefault but will always return null instead of default(T) when no element is found Negates the X and Y components. Flips the X and Y components. Like the XNA method, but treats the y-coordinate so that up is greater and down is lower. Like the XNA method, but treats the y-coordinate so that up is greater and down is lower. Like the XNA method, but treats the y-coordinate so that up is greater and down is lower. Unity's Angle implementation without the conversion to degrees. Returns the angle in radians between two vectors. 0 - Pi. Creates a forward pointing vector based on the rotation (in radians). Creates a backward pointing vector based on the rotation (in radians). Creates a forward pointing vector based on the rotation (in radians). TODO: remove when the implications have been neutralized Creates a backward pointing vector based on the rotation (in radians). TODO: remove when the implications have been neutralized Creates a normalized perpendicular vector to the right from a forward vector. Creates a normalized perpendicular vector to the left from a forward vector. Transforms a vector relative to the given up vector. Flips the x and y components. Returns the sum of the x and y components. Capitalises the first letter (invariant) and forces the rest to lower case (invariant). Adds spaces into a CamelCase string. Spawns the items defined in the start item set in the specified sub. Get what kind of affiliation this faction has towards the player depending on who they chose to side with via talents How low the reputation can drop on this faction Maximum reputation level you can gain on this faction What reputation does this faction start with Reputation value normalized to the range of 0-1 Network message for the server to update wallet values to clients Network message for the client to transfer money between wallets Network message for the client to set the salary of someone Represents the difference in balance and salary when a wallet gets updated Not really used right now but could be used for notifications when receiving funds similar to how talents do it Represents an update that changed the amount of money or salary of the wallet Does the wearable inherit all the scalings of the wearer? Also the wearable's own scale is used! None = Any/Not Defined -> no effect. Changing the gender forces re-initialization, because the textures can be different for male and female characters. Note: this constructor cannot initialize automatically, because the gender is unknown at this point. We only know it when the item is equipped. Should broken (0 condition) items be excluded Should full condition (100%) items be excluded Index of the slot the target must be in when targeting a Contained item Overrides the position defined in ItemContainer. Only affects when ItemContainer.hideItems is false. Doesn't override the value. Additive sets of items spawned only at the start of the game. The order in which the sets are displayed in menus Mod initialization Error or client exit This function should be used whenever a new assembly is created. Wrapper to allow more complicated setup later if need be. This function should be used whenever a new assembly is about to be destroyed/unloaded. Wrapper to allow more complicated setup later if need be. Assembly to remove Puts a type on the stack, as a object instead of a runtime type token. The IL emitter. The type to put on the stack. Converts the value on the stack to . The IL emitter. The type of the value on the stack. Deferences the value on stack if the provided type is ByRef. The IL emitter. The type to check if ByRef. Deferences the value on stack if the provided type is ByRef. The IL emitter. The type to check if ByRef. Loads a local variable and casts it to the target type. The IL emitter. The value to cast. Must be of type . The type to cast into. Emits a call to . The IL emitter. The string format. The local variables passed to string.Format. Emits a call to . The IL emitter. The message to print. Emits a call to , using the string on the stack. The IL emitter. Emits a foreach loop that iterates over an local variable. The type of elements in the enumerable. The IL emitter. The enumerable. The body of code to run on each iteration. Emits a foreach loop that iterates over an local variable. The type of elements in the enumerable. The IL emitter. The enumerator. The body of code to run on each iteration. Emits a branch that only executes if the last value on the stack is truthy (e.g. non-null references, 1, etc). The IL emitter. The body of code to run if the value is truthy. Emits a branch that only executes if the last value on the stack is falsy (e.g. null references, 0, etc). The IL emitter. The body of code to run if the value is falsy. Emits two branches that diverge based on a condition -- analogous to an if-else statement. If either or are omitted, it behaves the same as and . The IL emitter. The body of code to run if the value is truthy. The body of code to run if the value is falsy. See . Lua value to convert and wrap in a userdata. Descriptor of the type of the object to convert the Lua value to. Uses MoonSharp ScriptToClr converters. A userdata that wraps the Lua value converted to an object of the desired type as described by . Converts a Lua value to a CLR object of a desired type and wraps it in a userdata. If the type is not registered, then a new will be created and used. The goal of this method is to allow Lua scripts to create userdata to wrap certain data without having to register types. Wrapping the value in a userdata preserves the original type during script-to-CLR conversions.A Lua script needs to pass a List`1 to a CLR method expecting System.Object, MoonSharp gets in the way by converting the List`1 to a MoonSharp.Interpreter.Table and breaking everything. Registering the List`1 type can break other scripts relying on default converters, so instead it is better to manually wrap the List`1 object into a userdata. Lua value to convert and wrap in a userdata. Type describing the CLR type of the object to convert the Lua value to. A userdata that wraps the Lua value converted to an object of the desired type. Unique, but non-persistent identifier. Stays the same if the entities are created in the exactly same order, but doesn't persist e.g. between the rounds. Finds a contiguous block of free IDs of at least the given size The first ID in the found block, or zero if none are found Find an entity based on the ID Removes the entity from the entity dictionary and frees up the ID it was using. Overrides the commonness of the object in a specific level type. Key = name of the level type, value = commonness in that level type. Minimum difficulty of the level before hunting grounds can appear. Probability of hunting grounds appearing in 100% difficulty levels. The depth at which the level starts at, in in-game coordinates. E.g. if this was set to 100 000 (= 1000 m), the nav terminal would display the depth as 1000 meters at the top of the level. Determined during level generation based on the size of the submarine. Null if the level hasn't been generated. Events that have previously triggered in this level. Used for making events the player hasn't seen yet more likely to trigger when re-entering the level. Has a maximum size of . Events that have already triggered in this level and can never trigger again. . 'Exhaustible' sets won't appear in the same level until after one world step (~10 min, see Map.ProgressWorld) has passed. . The crush depth of a non-upgraded submarine in in-game coordinates. Note that this can be above the top of the level! The crush depth of a non-upgraded submarine in "real world units" (meters from the surface of Europa). Note that this can be above the top of the level! Instantiates level data using the properties of the connection (seed, size, difficulty) Instantiates level data using the properties of the location Is some mission blocking this location from changing its type? In percentages. Larger values make buying more expensive and selling less profitable, and vice versa. Create new StoreInfo Load previously saved StoreInfo If null, item.GetPriceInfo() will be used to get it. /// If false, the price won't be affected by If null, item.GetPriceInfo() will be used to get it. If false, the price won't be affected by How many map progress steps it takes before the discounts should be updated. Create a location from save data Removes all unlocked missions from the location Mark the items that have been taken from the outpost to prevent them from spawning when re-entering the outpost Mark the characters who have been killed to prevent them from spawning when re-entering the outpost If true, the stores will be recreated if they already exists. Can this location type be used in the random, non-campaign levels that don't take place in any specific zone If set to true, only event sets that explicitly define this location type in can be selected at this location. Defaults to false. In percentages The change can only happen if there's at least one of the given types of locations near this one How close the location needs to be to one of the RequiredLocations for the change to occur Base probability per turn for the location to change if near one of the RequiredLocations How close the location needs to be to one of the RequiredLocations for the probability to increase How much the probability increases per turn if within RequiredProximityForProbabilityIncrease steps of RequiredLocations Does there need to be a beacon station within RequiredProximity Does there need to be hunting grounds within RequiredProximity Base probability per turn for the location to change if near one of the RequiredLocations The change can't happen if there's one or more of the given types of locations near this one How close the location needs to be to one of the DisallowedAdjacentLocations for the change to be disabled The location can't change it's type for this many turns after this location type changes occurs Identifiers of the location types this outpost can appear in. If empty, can appear in all types of locations. Info of this outpost module Which module is this one attached to The position of this module's gap that attaches to the previous module Select the number and types of the modules to use in the outpost Attaches additional modules to all the available gaps of the given module, and continues recursively through the attached modules until all the pending module types have been placed. The module to attach to Which modules we can choose from Which types of modules we still need in the outpost The modules we've already selected to be used in the outpost. Attaches a new random module to one side of the given module The module to attach to Which side of the module to attach the new module to Which modules we can choose from Which types of modules we still need in the outpost The modules we've already selected to be used in the outpost. Check if any of the modules in modules1 overlap with modules in modules2 Check if the modules overlap, taking their Offsets and MoveOffsets into account Check if any of the modules overlaps with a connection between 2 other modules Attempt to find a way to move the modules in a way that stops the 2 specific modules from overlapping. Done by iterating through the modules and testing how much the subsequent modules (i.e. modules that are further from the initial outpost) would need to be moved further to solve the overlap. The solution that requires moving the modules the least is chosen. The set of modules the method is allowed to move Module overlapping with module2 Module overlapping with module1 All generated modules The solution to the overlap (if any). Key = placed module, value = distance to move the module Was a solution found for resolving the overlap. Get the modules that are further from the initial module than the startModule. StartModule is also included in the list. Can the item be a Daily Special or a Requested Good The item isn't available in stores unless the level's difficulty is above this value The cost of item when sold by the store. Higher modifier means the item costs more to buy from the store. Used when both and are set to 0. Minimum reputation needed to buy the item (Key = faction ID, Value = min rep) Support for the old style of determining item prices when there were individual Price elements for each location type where the item was for sale. Marks fields and properties as to be serialized and deserialized by . Also contains settings for some types like maximum and minimum values for numbers to reduce bits used. struct NetPurchasedItem : INetSerializableStruct { [NetworkSerialize] public string Identifier; [NetworkSerialize(ArrayMaxSize = 16)] public string[] Tags; [NetworkSerialize(MinValueInt = 0, MaxValueInt = 8)] public int Amount; } Using the attribute on the struct will make all fields and properties serialized Static class that contains serialize and deserialize functions for different types used in The type that the behavior handles The type that will be used as the generic parameter for the read/write methods The read method. It must have a generic parameter. The return type must be such that if the generic parameter is replaced with funcGenericParam, you get behaviorGenericParam. The write method. The first parameter's type must be the same as readFunc's return type. Ideally the least specific type possible, because it's replaced by behaviorGenericParam A ReadWriteBehavior<behaviorGenericParam> Interface that allows the creation of automatically serializable and deserializable structs.

public enum PurchaseResult { Unknown, Completed, Declined } [NetworkSerialize] struct NetStoreTransaction : INetSerializableStruct { public long Timestamp { get; set; } public PurchaseResult Result { get; set; } public NetPurchasedItem? PurchasedItem { get; set; } } [NetworkSerialize] struct NetPurchasedItem : INetSerializableStruct { public string Identifier; public string[] Tags; public int Amount; } Supported types are:
bool
byte
ushort
short
uint
int
ulong
long
float
double
string




In addition arrays, enums, and are supported.
Using or will make the field or property optional.
Deserializes a network message into a struct. public void ClientRead(IReadMessage inc) { NetStoreTransaction transaction = INetSerializableStruct.Read<NetStoreTransaction>(inc); if (transaction.Result == PurchaseResult.Declined) { Console.WriteLine("Purchase declined!"); return; } if (transaction.PurchasedItem is { } item) { // Purchased 3x Wrench with tags: smallitem, mechanical, tool Console.WriteLine($"Purchased {item.Amount}x {item.Identifier} with tags: {string.Join(", ", item.Tags)}"); } } Incoming network message Type of the struct that implements A new struct of type T with fields and properties deserialized Serializes the struct into a network message public void ServerWrite(IWriteMessage msg) { INetSerializableStruct transaction = new NetStoreTransaction { Result = PurchaseResult.Completed, Timestamp = DateTimeOffset.Now.ToUnixTimeSeconds(), PurchasedItem = new NetPurchasedItem { Identifier = "Wrench", Amount = 3, Tags = new []{ "smallitem", "mechanical", "tool" } } }; transaction.Write(msg); } Outgoing network message Default constructor. Constructor with OnAdd and OnRemove callbacks provided. Constructor with only the OnSort callback provided. Method to be called when calling Add(T prefab, bool override). If provided, the method is called only if Add succeeds. Method to be called when calling Remove(T prefab). If provided, the method is called before success or failure can be determined within the body of Remove. Method to be called when calling SortAll(). Method to be called when calling AddOverrideFile(ContentFile file). Method to be called when calling RemoveOverrideFile(ContentFile file). Dictionary containing all prefabs of the same type. Key is the identifier. Value is a list of prefabs that share the same identifier, where the first element is the "base" prefab, i.e. the only prefab that's loaded when override tags are not defined. This first element can be null, if only overrides are defined. The last element of the list is the prefab that is effectively used (hereby called "active prefab") Collection of content files that override all previous prefabs i.e. anything set to load before these effectively doesn't exist AllPrefabs exposes all prefabs instead of just the active ones. Returns the active prefab with the given identifier. Prefab identifier Active prefab with the given identifier Returns true if a prefab with the identifier exists, false otherwise. Prefab identifier The matching prefab (if one is found) Whether a prefab with the identifier exists or not Finds the first active prefab that returns true given the predicate, or null if no such prefab is found. Predicate to perform the search with. Returns true if a prefab with the given identifier exists, false otherwise. Prefab identifier Whether a prefab with the given identifier exists or not Determines whether a prefab is implemented as an override or not. Prefab in this collection Whether a prefab is implemented as an override or not Add a prefab to the collection. If not marked as an override, fail if a prefab with the same identifier already exists. Otherwise, add to the corresponding list, without making any changes to the base prefab. Prefab Is marked as override Removes a prefab from the collection. Prefab Removes all prefabs that were loaded from a certain file. Adds an override file to the collection. Removes an override file from the collection. Sorts all prefabs in the collection based on the content package load order. GetEnumerator implementation to enable foreach IEnumerator GetEnumerator implementation to enable foreach IEnumerator Prefab that has a property serves as a deterministic hash of a prefab's identifier. This member is filled automatically by PrefabCollection.Add. Required for GetRandom to work on arbitrary Prefab enumerables, recommended for network synchronization. Sample a pre-generated perlin noise map. Faster than calculating the noise on the fly. Normalized x position. The noise map starts repeating after x > 1 Normalized y position. The noise map starts repeating after y > 1 A noise value between 0.0f and 1.0f Labels of the components of a vector property (defaults to x,y,z,w) If a translation can't be found for the property name, this tag is used instead Currently implemented only for int and bool fields. TODO: implement the remaining types (SerializableEntityEditor) If set to true, the instance values saved in a submarine file will always override the prefab values, even if using a mod that normally overrides instance values. Try getting the values of some commonly used properties directly without reflection Try getting the values of some commonly used properties directly without reflection Try getting the values of some commonly used properties directly without reflection Try getting the values of some commonly used properties directly without reflection Try setting the values of some commonly used properties directly without reflection Try setting the values of some commonly used properties directly without reflection Upgrade the properties of an entity saved with an older version of the game. Properties that should be upgraded are defined using "Upgrade" elements in the config file. for example, would force the scale of the entity to 0.5 if it was saved with a version prior to 0.9.2.0. The entity to upgrade The XML element to get the upgrade instructions from (e.g. the config of an item prefab) The game version the entity was saved with Returns the first child element that matches the name using the provided comparison method. Returns all child elements that match the name using the provided comparison method. Resets every round. Keeps track of things that have happened during the round Check if the currently selected language is available, and switch to English if not Maximum FPS (0 = unlimited). Calculate the new value of the property level of the upgrade Sets the OriginalValue to a value stored in the save XML element Recursively apply a percentage to a value certain amount of times original value percentage increase/decrease how many times to apply the percentage change Finds saved properties in the XML element and resets properties that are not managed by the upgrade anymore to their default values XML save element Find an item component matching the XML element Target item XML ItemComponent element Array of matching ItemComponents or null Applies the upgrade to the target item and components This method should be called every time a new upgrade is added unless you set the original values of PropertyReference manually. Do note that calls this method automatically. List of homoglyphs taken from https://github.com/codebox/homoglyph/ wrap the angle between 0.0f and 2pi wrap the angle between -pi and pi Returns the angle between the two angles, where the direction matters. solves the angle opposite to side a (parameters: lengths of each side) check whether line from a to b is intersecting with line from c to b Get the intersections between a line (either infinite or a line segment) and a circle Center of the circle Radius of the circle 1st point on the line 2nd point on the line Is the line a segment or infinite The number of intersections Get a point on a circle's circumference Center of the circle Radius of the circle Angle (in radians) from the center Get a specific number of evenly distributed points on a circle's circumference Center of the circle Radius of the circle Number of points to calculate Angle (in radians) of the first point from the center divide a convex hull into triangles List of triangle vertices (sorted counter-clockwise) Float comparison. Note that may still fail in some cases. Float comparison. Note that may still fail in some cases. Returns a position in a curve. Converts the alignment to a vector where -1,-1 is the top-left corner, 0,0 the center and 1,1 bottom-right Rotates a point in 2d space around another point. Modified from: http://www.gamefromscratch.com/post/2012/11/24/GameDev-math-recipes-Rotating-one-point-around-another-point.aspx Rotates a point in 2d space around the origin Returns the corners of an imaginary rectangle. Unlike the XNA rectangle, this can be rotated with the up parameter. Returns the corners of an imaginary rectangle. Unlike the XNA Rectangle, this can be rotated with the up parameter. Check if a point is inside a rectangle. Unlike the XNA Rectangle, this rectangle might have been rotated. For XNA Rectangles, use the Contains instance method. Check if a point is inside a rectangle. Unlike the XNA Rectangle, this rectangle might have been rotated. For XNA Rectangles, use the Contains instance method. Slightly modified from https://gamedev.stackexchange.com/questions/110229/how-do-i-efficiently-check-if-a-point-is-inside-a-rotated-rectangle Returns a scalar t from a value v between a range from min to max. Clamped between 0 and 1. Mersenne Twister based random Constructor with randomized seed Constructor with provided 32 bit seed (Re)initialize this instance with provided 32 bit seed Generates a random value from UInt32.MinValue to UInt32.MaxValue, inclusively Generates a random value that is greater or equal than 0 and less than Int32.MaxValue Returns a random value is greater or equal than 0 and less than maxValue Generates a random value greater or equal than 0 and less or equal than Int32.MaxValue (inclusively) Returns random value larger or equal to 0.0 and less than 1.0 Min inclusive, Max exclusive! Random float between 0 and 1. Adds an assembly's Non-Abstract Types to the cache for Barotrauma's Type lookup. Assembly to be added Whether or not to overwrite an entry if the assembly already exists within it. Removes an assembly from the cache for Barotrauma's Type lookup. Assembly to remove. Skips validation for as long as the returned object remains in scope (remember to use using) When set to true, the game is allowed to modify the vanilla content in debug builds. Has no effect in non-debug builds. Returns file name characters that are invalid on any of our supported platforms (essentially the list of invalid characters on Windows) Diff from UTC DateTime wrapper that tries to offer a reliable string representation that's also human-friendly Event raised when a Character has been entered. Event raised when a key has been pressed down. May fire multiple times due to keyboard repeat. Event raised when a key has been released. Raised when the user is editing text and IME is in progress. Initialize the TextInput with the given GameWindow. The XNA window to which text input should be linked. Description of Voronoi. @param xValuesIn Array of X values for each site. @param yValuesIn Array of Y values for each site. Must be identical length to yValuesIn @param minX The minimum X of the bounding box around the voronoi @param maxX The maximum X of the bounding box around the voronoi @param minY The minimum Y of the bounding box around the voronoi @param maxY The maximum Y of the bounding box around the voronoi @return Executed when the cell is destroyed (only applies to destructible level walls) Returns the normal of the edge that points outwards from the specified cell