Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename GetVehicleSeat to GetVehicleSeatIndex #115

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions code/server/src/core/builtins/human.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace MafiaMP::Scripting {
return Vehicle(-1);
}

int Human::GetVehicleSeat() const {
int Human::GetVehicleSeatIndex() const {
const auto updateData = _ent.get<MafiaMP::Shared::Modules::HumanSync::UpdateData>();
const auto carEnt = flecs::entity(_ent.world(), updateData->carPassenger.carId);
if (carEnt.is_valid() && carEnt.is_alive()) {
Expand All @@ -52,11 +52,11 @@ namespace MafiaMP::Scripting {
}

void Human::Register(sol::state &luaEngine) {
sol::usertype<Human> cls = luaEngine.new_usertype<Human>("Human", sol::constructors<Human(uint64_t)>(), sol::base_classes, sol::bases<Entity>());
cls["addWeapon"] = &Human::AddWeapon;
cls["getHealth"] = &Human::GetHealth;
cls["setHealth"] = &Human::SetHealth;
cls["getVehicle"] = &Human::GetVehicle;
cls["getVehicleSeat"] = &Human::GetVehicleSeat;
sol::usertype<Human> cls = luaEngine.new_usertype<Human>("Human", sol::constructors<Human(uint64_t)>(), sol::base_classes, sol::bases<Entity>());
cls["addWeapon"] = &Human::AddWeapon;
cls["getHealth"] = &Human::GetHealth;
cls["setHealth"] = &Human::SetHealth;
cls["getVehicle"] = &Human::GetVehicle;
cls["getVehicleSeatIndex"] = &Human::GetVehicleSeatIndex;
}
} // namespace MafiaMP::Scripting
2 changes: 1 addition & 1 deletion code/server/src/core/builtins/human.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace MafiaMP::Scripting {

Vehicle GetVehicle() const;

int GetVehicleSeat() const;
int GetVehicleSeatIndex() const;

static void Register(sol::state &luaEngine);
};
Expand Down
11 changes: 8 additions & 3 deletions gamemode/server/debug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (CONFIG.ENABLE_DEBUG) then
Console.log("[DEBUG][onVehiclePlayerEnter] vehicle id: ", vehicle.id, " | type: ", type(vehicle.id))
Console.log("[DEBUG][onVehiclePlayerEnter] vehicle name: ", vehicle.name, " | type: ", type(vehicle.name))
Console.log("[DEBUG][onVehiclePlayerEnter] vehicle nickname: ", vehicle.nickname, " | type: ", type(vehicle.nickname))
Console.log("[DEBUG][onVehiclePlayerEnter] vehicle player seat: ", seatIndex, " | type: ", type(seatIndex))
Console.log("[DEBUG][onVehiclePlayerEnter] vehicle player seat index: ", seatIndex, " | type: ", type(seatIndex))
Console.log("[DEBUG][onVehiclePlayerEnter] player id: ", player.id, " | type: ", type(player.id))
Console.log("[DEBUG][onPlayerConnected] vehicle modelHash: ",
vehicle:getModelHash(),
Expand All @@ -46,7 +46,12 @@ if (CONFIG.ENABLE_DEBUG) then
Console.log("[DEBUG][onChatCommand] owner: " .. player.nickname)
Console.log("[DEBUG][onChatCommand] message: " .. message)
Console.log("[DEBUG][onChatCommand] command: " .. command)
Console.log("[DEBUG][onChatCommand] args: " .. table.concat(args, ", "), " | type: ", type(args), " | length: ",
#args)
Console.log(
"[DEBUG][onChatCommand] args: " .. table.concat(args, ", "),
" | type: ",
type(args),
" | length: ",
#args
)
end)
end
6 changes: 3 additions & 3 deletions gamemode/server/sdk.server.d.lua
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ function Human:getHealth () end
---@return Vehicle # The vehicle the Human is in.
function Human:getVehicle () end

---Retrieves the seat the Human occupies in the vehicle.
---@return integer # The seat ID the Human occupies. Returns -1 if the Human is not in a vehicle.
function Human:getVehicleSeat () end
---Retrieves the seat index the Human occupies in the vehicle.
---@return integer # The seat index the Human occupies. Returns -1 if the Human is not in a vehicle.
function Human:getVehicleSeatIndex () end

---@class Player: Human
Player = {}
Expand Down
Loading