Messaging - PULSAR-Modders/pulsar-mod-loader GitHub Wiki
PulsarModLoader provides tools to easily access various messaging systems from the game. The class for these can be found at PulsarModLoader.Utilities.Messaging
.
Notification
The notification method adds a timed message on the left side of the user's screen. PML provides 3 overrides which differ by using a PLPlayer, PhotonPlayer, and PhotonTarget respectively. The only argument required to use a notification is the message string, all other arguments are optional.
Optional Arguments:
- PLPlayer/PhotonPlayer/PhotonTargets is used to select a target for the notification. Not specifying a target will send the message to the local player.
- subjectPlayerID is used to set the message color as the player's class color.
- durationMS is how long the notification will stay on screen.
- addToShipLog adds the message to the ship log.
Notification(string message, PLPlayer recipient = null, int subjectPlayerId = 0, int durationMs = 6000, bool addToShipLog = false)
Notification(string message, PhotonPlayer recipient, int subjectPlayerId = 0, int durationMs = 6000, bool addToShipLog = false)
Notification(string message, PhotonTargets targets, int subjectPlayerId = 0, int durationMs = 6000, bool addToShipLog = false)
ChatMessage
The ChatMessage method is used to add messages to in-game chat prefixed with a player name. It requires a target player/photontarget, and a message to send. The sendingPlayerID is the name of the player inserted at the beginning of the message. -1 defaults as the local player.
ChatMessage(PLPlayer recipient, string message, int sendingPlayerId = -1)
ChatMessage(PhotonPlayer recipient, string message, int sendingPlayerId = -1)
ChatMessage(PhotonTargets targets, string message, int sendingPlayerId = -1)
Echo
Similar to ChatMessage()
messages, this adds messages to in game chat. There is no prefix.
Echo(PLPlayer recipient, string message)
Echo(PhotonPlayer recipient, string message)
Echo(PhotonTargets targets, string message)
Centerprint
Sends a message at the top of the screen, similar to those used for leveling up or increasing chaos. Centerprints always add to the ship log.
Optional Arguments:
- tag - the 3 digit tag for the ship log.
- color - the color for the message, uses a UnityEngine Color object.
- type - EWarningType, affects the sound effect and duration of the message.
Centerprint(string message, PLPlayer recipient, string tag = "msg", Color color = new Color(), EWarningType type = EWarningType.E_NORMAL)
Centerprint(string message, PhotonPlayer recipient, string tag = "msg", Color color = new Color(), EWarningType type = EWarningType.E_NORMAL)
Centerprint(string message, PhotonTargets targets, string tag = "msg", Color color = new Color(), EWarningType type = EWarningType.E_NORMAL)
ShipLog
Adds a message to the ship log.
Optional Arguments:
- tag - 3 digit code for the log
- color - UnityEngine Color
- addOnlyLocally - Adds log to other clients if method invoker is host.
- source - Probably used for damage messages.
- destination - Probably used for damage messages.
- turetID - Probably used for damage messages.
- damage - Probably used for damage messages.
ShipLog(string message, string tag = "msg", Color color = new Color(), bool addOnlyLocally = false, PLShipInfoBase source = null, PLShipInfoBase destination = null, int turretID = -1, int damage = 0)