Skip to main content

DeathReportService

This item only works when running on the server. Server

Centralized death reporting service which can be used to track deaths. Builds reports from dying humanoids, records them in DeathReportDataService (which this service aliases) and replicates them to every client.

Properties​

NewDeathReport​

DeathReportService.NewDeathReport: Signal<DeathReport>

Fires with every [DeathReport] the server records. Same signal as DeathReportDataService.NewDeathReport.

Functions​

Init​

DeathReportService.Init(
serviceBag: ServiceBag
) → ()

Initializes the DeathReportService. Should be done via ServiceBag.

AddWeaponDataRetriever​

DeathReportService.AddWeaponDataRetriever(
getWeaponData: (humanoid: Humanoid) → WeaponData?
) → () → ()--

Removes the retriever

Registers a callback that resolves the weapon a humanoid died to. Retrievers are asked in registration order; the first non-nil answer wins.

FindWeaponData​

DeathReportService.FindWeaponData(
humanoid: Humanoid
) → WeaponData?

Asks the registered retrievers for the weapon the humanoid died to

ObservePlayerKillerReports​

DeathReportService.ObservePlayerKillerReports(
player: Player
) → Observable<DeathReport>

Observes killer reports for the given player

ObservePlayerDeathReports​

DeathReportService.ObservePlayerDeathReports(
player: Player
) → Observable<DeathReport>

Observes death reports for the given player

ObserveHumanoidKillerReports​

DeathReportService.ObserveHumanoidKillerReports(
humanoid: Humanoid
) → Observable<DeathReport>

Observes killer reports for the given humanoid

ObserveHumanoidDeathReports​

DeathReportService.ObserveHumanoidDeathReports(
humanoid: Humanoid
) → Observable<DeathReport>

Observes death reports for the given humanoid

ObserveCharacterKillerReports​

DeathReportService.ObserveCharacterKillerReports(
character: Model
) → Observable<DeathReport>

Observes killer reports for the given character

ObserveCharacterDeathReports​

DeathReportService.ObserveCharacterDeathReports(
character: Model
) → Observable<DeathReport>

Observes death reports for the given character

GetLastDeathReports​

DeathReportService.GetLastDeathReports(self: DeathReportService) → {DeathReport}

Gets the last recorded death reports, oldest first

ReportHumanoidDeath​

DeathReportService.ReportHumanoidDeath(
humanoid: Humanoid,--

Humanoid that died

weaponData: WeaponData?--

Weapon data to report

) → ()

Reports the death of a humanoid. This is called automatically by DeathTrackedHumanoid.

ReportDeathReport​

DeathReportService.ReportDeathReport(
deathReport: DeathReport
) → ()

Records a death report: fires DeathReportService.NewDeathReport, routes it to the observers, and replicates it to every client.

Show raw api
{
    "functions": [
        {
            "name": "Init",
            "desc": "Initializes the DeathReportService. Should be done via [ServiceBag].",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "DeathReportService"
                },
                {
                    "name": "serviceBag",
                    "desc": "",
                    "lua_type": "ServiceBag"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 47,
                "path": "src/deathreport/src/Server/DeathReportService.lua"
            }
        },
        {
            "name": "AddWeaponDataRetriever",
            "desc": "Registers a callback that resolves the weapon a humanoid died to. Retrievers are asked in\nregistration order; the first non-nil answer wins.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "DeathReportService"
                },
                {
                    "name": "getWeaponData",
                    "desc": "",
                    "lua_type": "(humanoid: Humanoid) -> WeaponData?"
                }
            ],
            "returns": [
                {
                    "desc": "Removes the retriever",
                    "lua_type": "() -> ()"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 83,
                "path": "src/deathreport/src/Server/DeathReportService.lua"
            }
        },
        {
            "name": "FindWeaponData",
            "desc": "Asks the registered retrievers for the weapon the humanoid died to",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "DeathReportService"
                },
                {
                    "name": "humanoid",
                    "desc": "",
                    "lua_type": "Humanoid"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "WeaponData?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 102,
                "path": "src/deathreport/src/Server/DeathReportService.lua"
            }
        },
        {
            "name": "ObservePlayerKillerReports",
            "desc": "Observes killer reports for the given player",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "DeathReportService"
                },
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<DeathReport>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 123,
                "path": "src/deathreport/src/Server/DeathReportService.lua"
            }
        },
        {
            "name": "ObservePlayerDeathReports",
            "desc": "Observes death reports for the given player",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "DeathReportService"
                },
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<DeathReport>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 136,
                "path": "src/deathreport/src/Server/DeathReportService.lua"
            }
        },
        {
            "name": "ObserveHumanoidKillerReports",
            "desc": "Observes killer reports for the given humanoid",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "DeathReportService"
                },
                {
                    "name": "humanoid",
                    "desc": "",
                    "lua_type": "Humanoid"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<DeathReport>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 149,
                "path": "src/deathreport/src/Server/DeathReportService.lua"
            }
        },
        {
            "name": "ObserveHumanoidDeathReports",
            "desc": "Observes death reports for the given humanoid",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "DeathReportService"
                },
                {
                    "name": "humanoid",
                    "desc": "",
                    "lua_type": "Humanoid"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<DeathReport>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 162,
                "path": "src/deathreport/src/Server/DeathReportService.lua"
            }
        },
        {
            "name": "ObserveCharacterKillerReports",
            "desc": "Observes killer reports for the given character",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "DeathReportService"
                },
                {
                    "name": "character",
                    "desc": "",
                    "lua_type": "Model"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<DeathReport>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 175,
                "path": "src/deathreport/src/Server/DeathReportService.lua"
            }
        },
        {
            "name": "ObserveCharacterDeathReports",
            "desc": "Observes death reports for the given character",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "DeathReportService"
                },
                {
                    "name": "character",
                    "desc": "",
                    "lua_type": "Model"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<DeathReport>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 188,
                "path": "src/deathreport/src/Server/DeathReportService.lua"
            }
        },
        {
            "name": "GetLastDeathReports",
            "desc": "Gets the last recorded death reports, oldest first",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "DeathReportService"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ DeathReport }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 199,
                "path": "src/deathreport/src/Server/DeathReportService.lua"
            }
        },
        {
            "name": "ReportHumanoidDeath",
            "desc": "Reports the death of a humanoid. This is called automatically\nby [DeathTrackedHumanoid].",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "DeathReportService"
                },
                {
                    "name": "humanoid",
                    "desc": "Humanoid that died",
                    "lua_type": "Humanoid"
                },
                {
                    "name": "weaponData",
                    "desc": "Weapon data to report",
                    "lua_type": "WeaponData?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 210,
                "path": "src/deathreport/src/Server/DeathReportService.lua"
            }
        },
        {
            "name": "ReportDeathReport",
            "desc": "Records a death report: fires [DeathReportService.NewDeathReport], routes it to the observers,\nand replicates it to every client.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "DeathReportService"
                },
                {
                    "name": "deathReport",
                    "desc": "",
                    "lua_type": "DeathReport"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 228,
                "path": "src/deathreport/src/Server/DeathReportService.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "NewDeathReport",
            "desc": "Fires with every [DeathReport] the server records. Same signal as\n[DeathReportDataService.NewDeathReport].",
            "lua_type": "Signal<DeathReport>",
            "source": {
                "line": 67,
                "path": "src/deathreport/src/Server/DeathReportService.lua"
            }
        }
    ],
    "types": [],
    "name": "DeathReportService",
    "desc": "Centralized death reporting service which can be used to track\ndeaths. Builds reports from dying humanoids, records them in\n[DeathReportDataService] (which this service aliases) and replicates them to\nevery client.",
    "realm": [
        "Server"
    ],
    "source": {
        "line": 11,
        "path": "src/deathreport/src/Server/DeathReportService.lua"
    }
}