You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
testing.expectEqual(vfs.type(handle), 'closed file', 'File should be closed')
262
263
end
263
264
265
+
localfunctiontestCommitCrime()
266
+
initPlayer()
267
+
localplayer=world.players[1]
268
+
testing.expectEqual(player==nil, false, 'A viable player reference should exist to run `testCommitCrime`')
269
+
testing.expectEqual(I.Crimes==nil, false, 'Crimes interface should be available in global contexts')
270
+
271
+
-- Reset crime level to have a clean slate
272
+
types.Player.setCrimeLevel(player, 0)
273
+
testing.expectEqual(I.Crimes.commitCrime(player, { type=types.Player.OFFENSE_TYPE.Theft, victim=player, arg=100}).wasCrimeSeen, false, "Running the crime with the player as the victim should not result in a seen crime")
274
+
testing.expectEqual(I.Crimes.commitCrime(player, { type=types.Player.OFFENSE_TYPE.Theft, arg=50 }).wasCrimeSeen, false, "Running the crime with no victim and a type shouldn't raise errors")
275
+
testing.expectEqual(I.Crimes.commitCrime(player, { type=types.Player.OFFENSE_TYPE.Murder }).wasCrimeSeen, false, "Running a murder crime should work even without a victim")
-- Reset crime level for testing with a valid victim
283
+
types.Player.setCrimeLevel(player, 0)
284
+
testing.expectEqual(I.Crimes.commitCrime(player, { victim=victim, type=types.Player.OFFENSE_TYPE.Theft, arg=50 }).wasCrimeSeen, true, "Running a crime with a valid victim should notify them when the player is not sneaking, even if it's not explicitly passed in")
285
+
testing.expectEqual(types.Player.getCrimeLevel(player), 0, "Crime level should not change if the victim's alarm value is low and there's no other witnesses")
286
+
end
287
+
264
288
tests= {
265
289
{'timers', testTimers},
266
290
{'rotating player with controls.yawChange should change rotation', function()
0 commit comments