mirror of
https://github.com/Bjanski/ExAd.git
synced 2024-08-30 16:52:14 +00:00
Implemented Grinding
This commit is contained in:
parent
020b43c865
commit
b86f73d767
1
@ExileServer/addons/exad_grinding/$PREFIX$
Normal file
1
@ExileServer/addons/exad_grinding/$PREFIX$
Normal file
@ -0,0 +1 @@
|
|||||||
|
exad_grinding
|
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
fn_grindProgress.sqf
|
||||||
|
|
||||||
|
Copyright 2016 Jan Babor
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_object","_databaseID"];
|
||||||
|
|
||||||
|
_object = objectFromNetId ([_this, 0, "",[""]] call BIS_fnc_param);
|
||||||
|
|
||||||
|
if(isNull _object)exitWith{false};
|
||||||
|
|
||||||
|
if((_object getVariable ["ExAd_Grinding_progress", 0]) >= ExAd_GRINDING_OBJECT_MAX)then{
|
||||||
|
_object setVariable ["ExileAccessCode", nil];
|
||||||
|
_object setVariable ["ExileIsLocked", nil, true];
|
||||||
|
|
||||||
|
_databaseID = _object getVariable ["ExileDatabaseID",0];
|
||||||
|
format ["addDoorLock:%1:%2","000000",_databaseID] call ExileServer_system_database_query_fireAndForget;
|
||||||
|
};
|
||||||
|
|
||||||
|
_object setVariable ["ExAd_Grinding_progress", (_object getVariable ["ExAd_Grinding_progress", 0]) + ExAd_GRINDING_PROGRESS, true];
|
||||||
|
|
||||||
|
true
|
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
fn_restoreLock.sqf
|
||||||
|
|
||||||
|
Copyright 2016 Jan Babor
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ["_object","_databaseID"];
|
||||||
|
|
||||||
|
_object = objectFromNetId ([_this, 0, "",[""]] call BIS_fnc_param);
|
||||||
|
|
||||||
|
if(isNull _object)exitWith{false};
|
||||||
|
|
||||||
|
_object setVariable ["ExAd_Grinding_progress", 0, true];
|
||||||
|
|
||||||
|
true
|
1
@ExileServer/addons/exad_grinding/PboPrefix.txt
Normal file
1
@ExileServer/addons/exad_grinding/PboPrefix.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
exad_grinding
|
46
@ExileServer/addons/exad_grinding/config.cpp
Normal file
46
@ExileServer/addons/exad_grinding/config.cpp
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
config.cpp
|
||||||
|
|
||||||
|
Copyright 2016 Jan Babor
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class CfgPatches {
|
||||||
|
class ExAd_Grinding {
|
||||||
|
requiredVersion = 0.1;
|
||||||
|
requiredAddons[] = {"ExAd_Core"};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class CfgFunctions {
|
||||||
|
class ExAdServer {
|
||||||
|
class Grinding {
|
||||||
|
file = "exad_grinding\Functions";
|
||||||
|
class grindProgress {};
|
||||||
|
class restoreLock {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class CfgNetworkMessages
|
||||||
|
{
|
||||||
|
class grindProgress
|
||||||
|
{
|
||||||
|
parameters[] = {"STRING"};
|
||||||
|
};
|
||||||
|
class restoreLock
|
||||||
|
{
|
||||||
|
parameters[] = {"STRING"};
|
||||||
|
};
|
||||||
|
};
|
10
mpmissions/Exile.Altis/ExAdClient/Grinding/CHANGELOG.md
Normal file
10
mpmissions/Exile.Altis/ExAdClient/Grinding/CHANGELOG.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#VirtualGarage
|
||||||
|
## Changelog:
|
||||||
|
|
||||||
|
### 160502 23:15 . v0.6.0
|
||||||
|
#### Fixed
|
||||||
|
|
||||||
|
#### Added
|
||||||
|
* Grinding introduced
|
||||||
|
|
||||||
|
#### Deleted
|
26
mpmissions/Exile.Altis/ExAdClient/Grinding/CfgFunctions.cpp
Normal file
26
mpmissions/Exile.Altis/ExAdClient/Grinding/CfgFunctions.cpp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
CfgFunctions.cpp
|
||||||
|
|
||||||
|
Copyright 2016 Jan Babor
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
class VirtualGarage
|
||||||
|
{
|
||||||
|
file = "ExAdClient\Grinding\Functions";
|
||||||
|
class grindLock {};
|
||||||
|
class restoreLock {};
|
||||||
|
class postInit {file = "ExAdClient\Grinding\postInit.sqf"; postInit = 1;};
|
||||||
|
};
|
@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
fn_grindLock.sqf
|
||||||
|
|
||||||
|
Copyright 2016 Jan Babor
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
private ["_soundSrc","_ticker"];
|
||||||
|
|
||||||
|
if(vehicle player != player)exitWith{false};
|
||||||
|
|
||||||
|
ExAd_GRINDING_OBJECT = _this select 0;
|
||||||
|
ExAd_GRINDING = true;
|
||||||
|
call ExileClient_gui_interactionMenu_unhook;
|
||||||
|
_soundSrc = createSoundSource ["Sound_Factory10", position ExAd_GRINDING_OBJECT, [], 0];
|
||||||
|
player playActionNow "medicStart";
|
||||||
|
|
||||||
|
|
||||||
|
ExAd_DRAW3D_HANDLER = addMissionEventHandler ["Draw3D", {
|
||||||
|
private ["_object","_progress"];
|
||||||
|
|
||||||
|
_object = if(isNil "ExAd_GRINDING_OBJECT")then{cursorTarget}else{ExAd_GRINDING_OBJECT};
|
||||||
|
_progress = 1 min ((_object getVariable ["EXO_Grinding_progress", 1]) / ExAd_GRINDING_OBJECT_MAX);
|
||||||
|
|
||||||
|
drawLine3D [cursorTarget modelToWorld [-0.5, -0.15, 1], cursorTarget modelToWorld [0.5, -0.15, 1], [0,0,0,1]];
|
||||||
|
drawLine3D [cursorTarget modelToWorld [-0.5, -0.15, 0.95], cursorTarget modelToWorld [0.5, -0.15, 0.95], [0,0,0,1]];
|
||||||
|
drawLine3D [cursorTarget modelToWorld [-0.5, 0.15, 1], cursorTarget modelToWorld [0.5, 0.15, 1], [0,0,0,1]];
|
||||||
|
drawLine3D [cursorTarget modelToWorld [-0.5, 0.15, 0.95], cursorTarget modelToWorld [0.5, 0.15, 0.95], [0,0,0,1]];
|
||||||
|
|
||||||
|
drawLine3D [cursorTarget modelToWorld [-0.5, -0.15, 1], cursorTarget modelToWorld [-0.5, -0.15, 0.95], [0,0,0,1]];
|
||||||
|
drawLine3D [cursorTarget modelToWorld [0.5, -0.15, 1], cursorTarget modelToWorld [0.5, -0.15, 0.95], [0,0,0,1]];
|
||||||
|
drawLine3D [cursorTarget modelToWorld [-0.5, 0.15, 1], cursorTarget modelToWorld [-0.5, 0.15, 0.95], [0,0,0,1]];
|
||||||
|
drawLine3D [cursorTarget modelToWorld [0.5, -0.15, 1], cursorTarget modelToWorld [0.5, -0.15, 0.95], [0,0,0,1]];
|
||||||
|
|
||||||
|
for "_i" from 1 to 49 do {
|
||||||
|
drawLine3D [cursorTarget modelToWorld [-0.5, -0.15, 1 - (0.001 * _i)], cursorTarget modelToWorld [((-0.5) + _progress), -0.15, 1 - (0.001 * _i)], [1,0.482,0,1]];
|
||||||
|
drawLine3D [cursorTarget modelToWorld [0.5, 0.15, 1 - (0.001 * _i)], cursorTarget modelToWorld [((0.5) - _progress), 0.15, 1 - (0.001 * _i)], [1,0.482,0,1]];
|
||||||
|
|
||||||
|
drawLine3D [cursorTarget modelToWorld [0.5, -0.15, 1 - (0.001 * _i)], cursorTarget modelToWorld [((-0.5) + _progress), -0.15, 1 - (0.001 * _i)], [0.55,0.55,0.55,1]];
|
||||||
|
drawLine3D [cursorTarget modelToWorld [-0.5, 0.15, 1 - (0.001 * _i)], cursorTarget modelToWorld [((0.5) - _progress), 0.15, 1 - (0.001 * _i)], [0.55,0.55,0.55,1]];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
|
||||||
|
_ticker = 1;
|
||||||
|
while{(ExAd_GRINDING_OBJECT == cursorTarget) && ExAd_GRINDING}do{
|
||||||
|
UISleep 1;
|
||||||
|
if(random[0,50,100] < 1)exitWith{
|
||||||
|
player removeItem "Exile_Item_Grinder";
|
||||||
|
['Whoops', [STR_ExAd_GRINDING_NOTI_BROKE]] call ExileClient_gui_notification_event_addNotification;
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
|
if!("Exile_Magazine_Battery" in (magazines player))exitWith{
|
||||||
|
['Whoops', [STR_ExAd_GRINDING_NOTI_EMPTY_BAT]] call ExileClient_gui_notification_event_addNotification;
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
|
if((_ticker % ExAd_GRINDING_PROGRESS_INTERVALL) == 0)then{
|
||||||
|
player removeItem "Exile_Magazine_Battery";
|
||||||
|
|
||||||
|
["grindProgress", [netId ExAd_GRINDING_OBJECT]] call ExAd_fnc_serverDispatch;
|
||||||
|
['Whoops', [STR_ExAd_GRINDING_NOTI_PROGRESS]] call ExileClient_gui_notification_event_addNotification;
|
||||||
|
|
||||||
|
player playActionNow "medicStart";
|
||||||
|
};
|
||||||
|
|
||||||
|
if(ExAd_GRINDING_OBJECT getVariable ["ExAd_Grinding_progress", 0] > ExAd_GRINDING_OBJECT_MAX)exitWith{
|
||||||
|
UISleep 2;
|
||||||
|
['Whoops', [STR_ExAd_GRINDING_NOTI_FINISHED]] call ExileClient_gui_notification_event_addNotification;
|
||||||
|
};
|
||||||
|
_ticker = _ticker + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
deleteVehicle _soundSrc;
|
||||||
|
player playActionNow "medicStop";
|
||||||
|
removeMissionEventHandler ["Draw3D",ExAd_DRAW3D_HANDLER];
|
||||||
|
|
||||||
|
ExAd_GRINDING_OBJECT = nil;
|
||||||
|
ExAd_GRINDING = false;
|
||||||
|
call ExileClient_gui_interactionMenu_unhook;
|
||||||
|
|
||||||
|
true
|
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
fn_restoreLock.sqf
|
||||||
|
|
||||||
|
Copyright 2016 Jan Babor
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
params["_object"];
|
||||||
|
|
||||||
|
if(vehicle player != player)exitWith{false};
|
||||||
|
|
||||||
|
call ExileClient_gui_interactionMenu_unhook;
|
||||||
|
player playActionNow "medic";
|
||||||
|
|
||||||
|
UISleep 5;
|
||||||
|
player removeItem "Exile_Item_Codelock";
|
||||||
|
['Whoops', [STR_ExAd_GRINDING_NOTI_RESTORED]] call ExileClient_gui_notification_event_addNotification;
|
||||||
|
|
||||||
|
["restoreLock", [netId _object]] call ExAd_fnc_serverDispatch;
|
||||||
|
|
||||||
|
call ExileClient_gui_interactionMenu_unhook;
|
||||||
|
|
||||||
|
true
|
5
mpmissions/Exile.Altis/ExAdClient/Grinding/UPDATE.md
Normal file
5
mpmissions/Exile.Altis/ExAdClient/Grinding/UPDATE.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#VirtualGarage
|
||||||
|
## Instructions:
|
||||||
|
|
||||||
|
### 160502 23:15 . v0.6.0
|
||||||
|
#### Full installation
|
23
mpmissions/Exile.Altis/ExAdClient/Grinding/customize.sqf
Normal file
23
mpmissions/Exile.Altis/ExAdClient/Grinding/customize.sqf
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
customize.sqf
|
||||||
|
|
||||||
|
Copyright 2016 Jan Babor
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
ExAd_GRINDING_OBJECT_MAX = 900; //SCALAR - Code lock sustainability.
|
||||||
|
|
||||||
|
ExAd_GRINDING_PROGRESS_INTERVALL = 60; //SCALAR - Damage each finished interval will take from the code lock.
|
||||||
|
|
||||||
|
ExAd_GRINDING_PROGRESS = 60; //SCALAR - Time each interval will take measured in seconds.
|
30
mpmissions/Exile.Altis/ExAdClient/Grinding/postInit.sqf
Normal file
30
mpmissions/Exile.Altis/ExAdClient/Grinding/postInit.sqf
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
postInit.sqf
|
||||||
|
|
||||||
|
Copyright 2016 Jan Babor
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
execVM "ExAdClient\Grinding\customize.sqf";
|
||||||
|
|
||||||
|
STR_ExAd_GRINDING_NOTI_BROKE = if(isLocalized "STR_ExAd_GRINDING_NOTI_BROKE")then{localize "STR_ExAd_GRINDING_NOTI_BROKE"}else{"Your grinder broke, get a new one before you can continue."};
|
||||||
|
|
||||||
|
STR_ExAd_GRINDING_NOTI_EMPTY_BAT = if(isLocalized "STR_ExAd_GRINDING_NOTI_EMPTY_BAT")then{localize "STR_ExAd_GRINDING_NOTI_EMPTY_BAT"}else{"Find some batteries to get the grinder to work."};
|
||||||
|
|
||||||
|
STR_ExAd_GRINDING_NOTI_PROGRESS = if(isLocalized "STR_ExAd_GRINDING_NOTI_PROGRESS")then{localize "STR_ExAd_GRINDING_NOTI_PROGRESS"}else{"Your grinder broke, get a new one before you can continue."};
|
||||||
|
|
||||||
|
STR_ExAd_GRINDING_NOTI_FINISHED = if(isLocalized "STR_ExAd_GRINDING_NOTI_FINISHED")then{localize "STR_ExAd_GRINDING_NOTI_FINISHED"}else{"You have broken the code lock."};
|
||||||
|
|
||||||
|
STR_ExAd_GRINDING_NOTI_RESTORED = if(isLocalized "STR_ExAd_GRINDING_NOTI_RESTORED")then{localize "STR_ExAd_GRINDING_NOTI_RESTORED"}else{"You've changed the look"};
|
@ -25,4 +25,23 @@
|
|||||||
</Key>
|
</Key>
|
||||||
</Container>
|
</Container>
|
||||||
</Package>
|
</Package>
|
||||||
|
<Package name="Grinding">
|
||||||
|
<Container name="Notifications">
|
||||||
|
<Key ID="STR_ExAd_GRINDING_NOTI_BROKE">
|
||||||
|
<Original>Your grinder broke, get a new one before you can continue.</Original>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ExAd_GRINDING_NOTI_EMPTY_BAT">
|
||||||
|
<Original>Find some batteries to get the grinder to work.</Original>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ExAd_GRINDING_NOTI_PROGRESS">
|
||||||
|
<Original>I think I'm getting through.</Original>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ExAd_GRINDING_NOTI_FINISHED">
|
||||||
|
<Original>You have broken the code lock.</Original>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ExAd_GRINDING_NOTI_RESTORED">
|
||||||
|
<Original>You've changed the look</Original>
|
||||||
|
</Key>
|
||||||
|
</Container>
|
||||||
|
</Package>
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user