@quenty/deathreport 3.26.0 → 3.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.27.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/deathreport@3.26.0...@quenty/deathreport@3.27.0) (2023-08-01)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add DeathReportServiceClient:ObserveCharacterKillerReports(character) and DeathReportServiceClient:ObserveCharacterDeathReports(character) ([1c1d32e](https://github.com/Quenty/NevermoreEngine/commit/1c1d32eb0bae543b11a06e022aa400a40b6be73f))
12
+
13
+
14
+
15
+
16
+
6
17
  # [3.26.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/deathreport@3.25.0...@quenty/deathreport@3.26.0) (2023-07-28)
7
18
 
8
19
  **Note:** Version bump only for package @quenty/deathreport
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/deathreport",
3
- "version": "3.26.0",
3
+ "version": "3.27.0",
4
4
  "description": "Death report service which will track the deaths of players",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -30,18 +30,18 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@quenty/baseobject": "^6.2.1",
33
- "@quenty/binder": "^8.23.0",
33
+ "@quenty/binder": "^8.24.0",
34
34
  "@quenty/characterutils": "^6.12.0",
35
35
  "@quenty/humanoidkillerutils": "^2.2.0",
36
36
  "@quenty/loader": "^6.2.1",
37
37
  "@quenty/maid": "^2.5.0",
38
- "@quenty/playerhumanoidbinder": "^8.23.0",
38
+ "@quenty/playerhumanoidbinder": "^8.24.0",
39
39
  "@quenty/remoting": "^6.9.0",
40
40
  "@quenty/rx": "^7.14.0",
41
- "@quenty/rxbinderutils": "^8.24.0",
41
+ "@quenty/rxbinderutils": "^8.25.0",
42
42
  "@quenty/servicebag": "^6.8.0",
43
43
  "@quenty/signal": "^2.4.0",
44
44
  "@quenty/table": "^3.2.0"
45
45
  },
46
- "gitHead": "539b6bcf1266fb18e143059d08381654cca200bd"
46
+ "gitHead": "839b4d929e4d6154aadf719f1ecfb9add4c8b247"
47
47
  }
@@ -60,6 +60,8 @@ end
60
60
  @return Observable<DeathReport>
61
61
  ]=]
62
62
  function DeathReportServiceClient:ObservePlayerKillerReports(player)
63
+ assert(typeof(player) == "Instance" and player:IsA("Player"), "Bad player")
64
+
63
65
  return self._reportProcessor:ObservePlayerKillerReports(player)
64
66
  end
65
67
 
@@ -70,6 +72,8 @@ end
70
72
  @return Observable<DeathReport>
71
73
  ]=]
72
74
  function DeathReportServiceClient:ObservePlayerDeathReports(player)
75
+ assert(typeof(player) == "Instance" and player:IsA("Player"), "Bad player")
76
+
73
77
  return self._reportProcessor:ObservePlayerDeathReports(player)
74
78
  end
75
79
 
@@ -80,6 +84,8 @@ end
80
84
  @return Observable<DeathReport>
81
85
  ]=]
82
86
  function DeathReportServiceClient:ObserveHumanoidKillerReports(humanoid)
87
+ assert(typeof(humanoid) == "Instance" and humanoid:IsA("Humanoid"), "Bad humanoid")
88
+
83
89
  return self._reportProcessor:ObserveHumanoidKillerReports(humanoid)
84
90
  end
85
91
 
@@ -90,9 +96,35 @@ end
90
96
  @return Observable<DeathReport>
91
97
  ]=]
92
98
  function DeathReportServiceClient:ObserveHumanoidDeathReports(humanoid)
99
+ assert(typeof(humanoid) == "Instance" and humanoid:IsA("Humanoid"), "Bad humanoid")
100
+
93
101
  return self._reportProcessor:ObserveHumanoidDeathReports(humanoid)
94
102
  end
95
103
 
104
+ --[=[
105
+ Observes killer reports for the given character
106
+
107
+ @param character Model
108
+ @return Observable<DeathReport>
109
+ ]=]
110
+ function DeathReportServiceClient:ObserveCharacterKillerReports(character)
111
+ assert(typeof(character) == "Instance" and character:IsA("Model"), "Bad character")
112
+
113
+ return self._reportProcessor:ObserveCharacterKillerReports(character)
114
+ end
115
+
116
+ --[=[
117
+ Observes killer reports for the given character
118
+
119
+ @param character Model
120
+ @return Observable<DeathReport>
121
+ ]=]
122
+ function DeathReportServiceClient:ObserveCharacterDeathReports(character)
123
+ assert(typeof(character) == "Instance" and character:IsA("Model"), "Bad character")
124
+
125
+ return self._reportProcessor:ObserveCharacterDeathReports(character)
126
+ end
127
+
96
128
  --[=[
97
129
  Gets the last recorded death reports
98
130
  @return { DeathReport }
@@ -75,6 +75,8 @@ end
75
75
  @return Observable<DeathReport>
76
76
  ]=]
77
77
  function DeathReportService:ObservePlayerKillerReports(player)
78
+ assert(typeof(player) == "Instance" and player:IsA("Player"), "Bad player")
79
+
78
80
  return self._reportProcessor:ObservePlayerKillerReports(player)
79
81
  end
80
82
 
@@ -85,6 +87,8 @@ end
85
87
  @return Observable<DeathReport>
86
88
  ]=]
87
89
  function DeathReportService:ObservePlayerDeathReports(player)
90
+ assert(typeof(player) == "Instance" and player:IsA("Player"), "Bad player")
91
+
88
92
  return self._reportProcessor:ObservePlayerDeathReports(player)
89
93
  end
90
94
 
@@ -95,6 +99,8 @@ end
95
99
  @return Observable<DeathReport>
96
100
  ]=]
97
101
  function DeathReportService:ObserveHumanoidKillerReports(humanoid)
102
+ assert(typeof(humanoid) == "Instance" and humanoid:IsA("Humanoid"), "Bad humanoid")
103
+
98
104
  return self._reportProcessor:ObserveHumanoidKillerReports(humanoid)
99
105
  end
100
106
 
@@ -105,9 +111,35 @@ end
105
111
  @return Observable<DeathReport>
106
112
  ]=]
107
113
  function DeathReportService:ObserveHumanoidDeathReports(humanoid)
114
+ assert(typeof(humanoid) == "Instance" and humanoid:IsA("Humanoid"), "Bad humanoid")
115
+
108
116
  return self._reportProcessor:ObserveHumanoidDeathReports(humanoid)
109
117
  end
110
118
 
119
+ --[=[
120
+ Observes killer reports for the given character
121
+
122
+ @param character Model
123
+ @return Observable<DeathReport>
124
+ ]=]
125
+ function DeathReportService:ObserveCharacterKillerReports(character)
126
+ assert(typeof(character) == "Instance" and character:IsA("Model"), "Bad character")
127
+
128
+ return self._reportProcessor:ObserveCharacterKillerReports(character)
129
+ end
130
+
131
+ --[=[
132
+ Observes killer reports for the given character
133
+
134
+ @param character Model
135
+ @return Observable<DeathReport>
136
+ ]=]
137
+ function DeathReportService:ObserveCharacterDeathReports(character)
138
+ assert(typeof(character) == "Instance" and character:IsA("Model"), "Bad character")
139
+
140
+ return self._reportProcessor:ObserveCharacterDeathReports(character)
141
+ end
142
+
111
143
  --[=[
112
144
  Reports the death of a humanoid. This is called automatically
113
145
  by [DeathTrackedHumanoid].
@@ -1,4 +1,6 @@
1
1
  --[=[
2
+ Handles shared observable subscription tables for the client and server
3
+
2
4
  @class DeathReportProcessor
3
5
  ]=]
4
6
 
@@ -29,6 +31,12 @@ function DeathReportProcessor.new()
29
31
  self._humanoidDeathSubTable = ObservableSubscriptionTable.new()
30
32
  self._maid:GiveTask(self._humanoidDeathSubTable)
31
33
 
34
+ self._characterKillerSubTable = ObservableSubscriptionTable.new()
35
+ self._maid:GiveTask(self._characterKillerSubTable)
36
+
37
+ self._characterDeathSubTable = ObservableSubscriptionTable.new()
38
+ self._maid:GiveTask(self._characterDeathSubTable)
39
+
32
40
  self._maid:GiveTask(Players.PlayerRemoving:Connect(function(player)
33
41
  self._playerKillerSubTable:Complete(player)
34
42
  self._playerDeathSubTable:Complete(player)
@@ -85,6 +93,31 @@ function DeathReportProcessor:ObserveHumanoidKillerReports(humanoid)
85
93
  return self._humanoidKillerSubTable:Observe(humanoid)
86
94
  end
87
95
 
96
+ --[=[
97
+ Observes killer reports for the given character
98
+
99
+ @param character Model
100
+ @return Observable<DeathReport>
101
+ ]=]
102
+ function DeathReportProcessor:ObserveCharacterKillerReports(character)
103
+ assert(typeof(character) == "Instance" and character:IsA("Model"), "Bad character")
104
+
105
+ return self._characterKillerSubTable:Observe(character)
106
+ end
107
+
108
+ --[=[
109
+ Observes killer reports for the given character
110
+
111
+ @param character Model
112
+ @return Observable<DeathReport>
113
+ ]=]
114
+ function DeathReportProcessor:ObserveCharacterDeathReports(character)
115
+ assert(typeof(character) == "Instance" and character:IsA("Model"), "Bad character")
116
+
117
+ return self._characterDeathSubTable:Observe(character)
118
+ end
119
+
120
+
88
121
  --[=[
89
122
  Handles the death report
90
123
 
@@ -99,6 +132,11 @@ function DeathReportProcessor:HandleDeathReport(deathReport)
99
132
 
100
133
  if deathReport.killerHumanoid then
101
134
  self._humanoidKillerSubTable:Fire(deathReport.killerHumanoid, deathReport)
135
+
136
+ local character = deathReport.killerHumanoid.Parent
137
+ if character then
138
+ self._characterKillerSubTable:Fire(character, deathReport)
139
+ end
102
140
  end
103
141
 
104
142
  if deathReport.player then
@@ -107,6 +145,11 @@ function DeathReportProcessor:HandleDeathReport(deathReport)
107
145
 
108
146
  if deathReport.humanoid then
109
147
  self._humanoidDeathSubTable:Fire(deathReport.humanoid, deathReport)
148
+
149
+ local character = deathReport.humanoid.Parent
150
+ if character then
151
+ self._characterDeathSubTable:Fire(character, deathReport)
152
+ end
110
153
  end
111
154
  end
112
155