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

fix 188 : make sure to spawn vehicles *on* the street #189

Open
wants to merge 2 commits into
base: main
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
4 changes: 3 additions & 1 deletion addons/lifecycle/functions/fnc_findSpawnPosition.sqf
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "..\script_component.hpp"

ISNILS(GVAR(minRoadSpawnManSpawnDistance), 20);

/**

returns false or HashMap of {
Expand Down Expand Up @@ -55,7 +57,7 @@ private _result = {
case "road": {
// for each position, get a road position close by
private _road = selectRandom (_refPos nearRoads _halfSectorWidth);
if (count (_road nearEntities ["Man", 100]) == 0) then {
if (count (_road nearEntities ["Man", GVAR(minRoadSpawnManSpawnDistance)]) == 0) then {
_road
} else {
objNull
Expand Down
4 changes: 3 additions & 1 deletion addons/voyage/functions/fnc_addCarCrew.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ if (_spawnPositionRoad isEqualTo false) exitWith {
private _segment = _spawnPositionRoad get "road";
(getRoadInfo _segment) params ["", "_width", "", "", "", "", "_begPos", "_endPos"];

// spawn on road side, but *not* on the curb, as we'd have to check for buildings/other obstacles.
private _vehicleWidth= 2; // TODO: get real vehicle width
private _dir = _begPos getDir _endPos;
private _lateralOffset = 0 max (_width - 2); // TODO: refactor to use real vehicle's boundingBox to put veh not too far out on the curb
private _lateralOffset = 0 max (_width/2 - _vehicleWidth);
private _roadSidePos = (getPos _segment) vectorAdd ((vectorNormalized ((getPos _segment) vectorCrossProduct [0, 0, -1])) vectorMultiply _lateralOffset);

[
Expand Down