Skip to content

Commit 01da295

Browse files
committed
feat: Make halonotes red
1 parent 718c9ff commit 01da295

1 file changed

Lines changed: 21 additions & 17 deletions

File tree

  • src/media/lua/server/AoqiaCarwannaExtendedServer

src/media/lua/server/AoqiaCarwannaExtendedServer/commands.lua

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ function commands.spawn_vehicle(player, args)
4040
-- The engine is limited to only spawning vehicles on Z-level 0.
4141
if z > 0 then
4242
logger:info_server("Failed to spawn vehicle as the player is not on Z-level 0.")
43-
player:setHaloNote(getText(("IGUI_%s_HaloNote_NotOnGround"):format(mod_constants.MOD_ID)),
44-
(128.0 * 2))
43+
player:setHaloNote(
44+
getText(("IGUI_%s_HaloNote_NotOnGround"):format(mod_constants.MOD_ID)),
45+
255.0,
46+
0.0,
47+
0.0,
48+
(128.0 * 2)) --- @diagnostic disable-line: redundant-parameter
4549

4650
return
4751
end
@@ -50,30 +54,29 @@ function commands.spawn_vehicle(player, args)
5054
if ScriptManager:getVehicle(args.FullType) == nil then
5155
logger:warn_server(
5256
"Failed to spawn vehicle as the vehicle does not exist.")
53-
player:setHaloNote(getText(("IGUI_%s_HaloNote_NilVehicle"):format(mod_constants.MOD_ID)),
54-
(128.0 * 2))
57+
player:setHaloNote(
58+
getText(("IGUI_%s_HaloNote_NilVehicle"):format(mod_constants.MOD_ID)),
59+
255.0,
60+
0.0,
61+
0.0,
62+
(128.0 * 2)) --- @diagnostic disable-line: redundant-parameter
5563

5664
return
5765
end
5866

59-
-- Check if player has AutoForm
60-
if player:getAccessLevel() ~= "Admin"
61-
and player:getInventory():containsTypeRecurse("AutoForm") == false then
62-
logger:info_server(
63-
"Failed to spawn vehicle as the player does not have an AutoForm.")
64-
player:setHaloNote(getText(("IGUI_%s_HaloNote_NoAutoForm"):format(mod_constants.MOD_ID)),
65-
(128.0 * 2))
66-
67-
return
68-
end
67+
-- NOTE: Don't check for autoform here as it's impossible on the server.
68+
-- It's done on the client anyway.
6969

7070
-- Check if vehicle is already in that position.
7171
if square:isVehicleIntersecting() then
7272
logger:info_server(
7373
"Failed to spawn vehicle, there is already a vehicle spawned there.")
7474
player:setHaloNote(
7575
getText(("IGUI_%s_HaloNote_VehicleIntersecting"):format(mod_constants.MOD_ID)),
76-
(128.0 * 2))
76+
255.0,
77+
0.0,
78+
0.0,
79+
(128.0 * 2)) --- @diagnostic disable-line: redundant-parameter
7780

7881
return
7982
end
@@ -195,8 +198,9 @@ function commands.spawn_vehicle(player, args)
195198
})
196199
end
197200

198-
-- Give the player the autoform back if sandbox option is on
199-
if sbvars.DoKeepAutoForm then
201+
-- Give the player the autoform back if sandbox option is on.
202+
-- Check that it's not generated to prevent buffer underflow.
203+
if sbvars.DoKeepAutoForm and args.Parts then
200204
--- @diagnostic disable-next-line: redundant-parameter
201205
player:sendObjectChange("addItem", { item = InventoryItemFactory.CreateItem("AutoForm") })
202206
end

0 commit comments

Comments
 (0)