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

Improve loading zone spawning #35

Open
wants to merge 4 commits into
base: v1.1.1
Choose a base branch
from
Open
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
12 changes: 5 additions & 7 deletions KP-Cratefiller/KPCF/fnc/fn_spawnCrate.sqf
Original file line number Diff line number Diff line change
@@ -2,6 +2,8 @@
Killah Potatoes Cratefiller v1.1.0
Author: Dubjunk - https://github.com/KillahPotatoes
Edited by Mildly_Interested - https://github.com/MildlyInterested
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Description:
@@ -30,20 +32,16 @@ if (_crateIndex == -1) exitWith {
// Crate selection
private _crateType = _ctrlCrate lbData _crateIndex;

private _checkSpawn = false;

// Check if spawnpoint is clear
if (KPCF_activeSpawn != KPCF_activeBase) then {
_checkSpawn = true;
};
private _spawnPosition = (getPos KPCF_activeSpawn) findEmptyPosition [0, KPCF_spawnRadius, _crateType]

if ((!(((getPos KPCF_activeSpawn) nearEntities 5) isEqualTo [])) && _checkSpawn) exitWith {
if (_spawnPosition isEqualTo []) exitWith {
hint localize "STR_KPCF_HINTZONE";
[{hintSilent "";}, [], 3] call CBA_fnc_waitAndExecute;
};

// Spawn crate
private _crate = createVehicle [_crateType, ((getPos KPCF_activeSpawn) findEmptyPosition [0, 10, _crateType]), [], 0, "NONE"];
private _crate = createVehicle [_crateType, _spawnPosition, [], 0, "NONE"];

// Clear the storage
clearWeaponCargoGlobal _crate;
4 changes: 2 additions & 2 deletions KP-Cratefiller/KPCF_config.sqf
Original file line number Diff line number Diff line change
@@ -22,11 +22,11 @@ KPCF_canSpawnAndDelete = true;
// If set to "true" the item lists will be generated from the config
KPCF_generateLists = true;

// These variable defines the range where inventories can be edited
// These variable defines the range where inventories can be edited and spawned in
// Example: With an setting of 10 all objects in a radius of 10m from the center of the spawn object can be edited
KPCF_spawnRadius = 10;

// Defines the distance for the interaction (addAction / ACE)
// Defines the distance for the scrollwheel interaction
KPCF_interactRadius = 5;

// Defines the available crates