Skip to content

Commit

Permalink
Modify
Browse files Browse the repository at this point in the history
新增自訂含式庫-progressbar 倒數進度條
額外使維修站提供維修周邊載具的選項
調整RHS美軍建造清單,將 BI 火箭車更換回 RHS 海馬斯
更改生成 IED 的種類為一般反人員地雷,以避免爆炸威力過大破壞房屋導致的遊戲體驗低落
  • Loading branch information
peckcat committed Jun 16, 2024
1 parent e98b6a0 commit 8a3b9e8
Show file tree
Hide file tree
Showing 8 changed files with 155 additions and 6 deletions.
1 change: 1 addition & 0 deletions Missionframework/PCAT_Libs/cfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ class PCAT
file = "PCAT_Libs\ui";
requiredAddons[] = {"cba_ai","cba_common"};
class parachutingDialog {};
class progressBar {};
};
};
97 changes: 97 additions & 0 deletions Missionframework/PCAT_Libs/ui/fn_progressBar.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
PCAT_fnc_progressBar
Parameter: (全可選,非必要)
_endTime: 結束時間,預設倒數 15 秒
_text: 顯示文字
_endCode: 結束後執行的腳本
_args: 腳本參數
Example:
[
10,
"<t size='0.8' align='center'>維修中,剩餘%1秒</t>",
{
params ["_extra_string"];
hint format ["維修完成,%1", _extra_string];
[] spawn {
sleep 3;
hint "";
};
},
["結束腳本參數"]
] call PCAT_fnc_progressBar;
*/

params [
["_endTime", time + 15],
["_text",""],
["_endCode", {}],
["_args", nil]
];

if( _endTime < time ) then{
_endTime = time + _endTime;
};
try{
with uiNamespace do {
IS_PCAT_PROGRESS_BAR_ACTIVE = uiNamespace getVariable ["IS_PCAT_PROGRESS_BAR_ACTIVE", false];

if( IS_PCAT_PROGRESS_BAR_ACTIVE ) exitWith { false };

IS_PCAT_PROGRESS_BAR_ACTIVE = true;

private _position_and_size = [
0.400 * safezoneW + safezoneX,
0.150 * safezoneH + safezoneY,
0.200 * safezoneW,
0.025 * safezoneH
];

PCAT_progressBar_background = findDisplay 46 ctrlCreate ["RscText", -1];
PCAT_progressBar_background ctrlSetPosition _position_and_size;
PCAT_progressBar_background ctrlSetBackgroundColor [0.2,0.2,0.2,0.7];
PCAT_progressBar_background ctrlCommit 0;

PCAT_progressBar = findDisplay 46 ctrlCreate ["RscProgress", -1];
PCAT_progressBar ctrlSetPosition _position_and_size;
PCAT_progressBar progressSetPosition 0;
PCAT_progressBar ctrlCommit 0;

PCAT_progressBar_text = findDisplay 46 ctrlCreate ["RscStructuredText", -1];
PCAT_progressBar_text ctrlSetPosition _position_and_size;
PCAT_progressBar_text ctrlSetBackgroundColor [0,0,0,0];
PCAT_progressBar_text ctrlSetTextColor [1,1,1,1];
PCAT_progressBar_text ctrlCommit 0;

[
"PCAT_PROGRESS_BAR",
"onEachFrame",
{
params[ "_start", "_end", "_text", "_endCode", "_args" ];
_progress = linearConversion[ _start, _end, time, 0, 1 ];

private _progress_text = parseText format[_text, round(_end - time)];
(uiNamespace getVariable "PCAT_progressBar_text") ctrlSetStructuredText _progress_text;
(uiNamespace getVariable "PCAT_progressBar") progressSetPosition _progress;

if ( _progress > 1 ) then {
ctrlDelete (uiNamespace getVariable "PCAT_progressBar_text");
ctrlDelete (uiNamespace getVariable "PCAT_progressBar");
ctrlDelete (uiNamespace getVariable "PCAT_progressBar_background");

_args call _endCode;

uiNamespace setVariable ["IS_PCAT_PROGRESS_BAR_ACTIVE", false];
[ "PCAT_PROGRESS_BAR", "onEachFrame" ] call BIS_fnc_removeStackedEventHandler;
};
},
[ time, _endTime, _text, _endCode, _args]
] call BIS_fnc_addStackedEventHandler;
true
};
} catch {
ctrlDelete (uiNamespace getVariable "PCAT_progressBar_text");
ctrlDelete (uiNamespace getVariable "PCAT_progressBar");
ctrlDelete (uiNamespace getVariable "PCAT_progressBar_background");
uiNamespace setVariable ["IS_PCAT_PROGRESS_BAR_ACTIVE", false];
};
38 changes: 36 additions & 2 deletions Missionframework/kp_objectInits.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,44 @@
*/

KPLIB_objectInits = [
[ // 使回收站兼具维修设施功能, 可以使用滾輪選單, 直接完整維修周圍載具
[KP_liberation_recycle_building],
{
_this addAction [
"<t color='#FFFF00'>-- 維修周遭載具 </t> <img size='2' image='\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\repair_ca.paa'/>",
{
params ["_target", "_caller", "_actionId", "_arguments"]; // script
private _radius = 20;
private _vehicles = _target nearEntities [["Car","Tank","Air","Ship"], _radius];

[
30,
"<t size='0.8' align='center'>維修中,剩餘 %1 秒 ...</t>",
{
params ["_vehicles"];
_vehicles = [ [_vehicles] , _vehicles ] select (_vehicles isEqualType []);
{
if (alive _x) then {
_x setDamage 0;
};
} forEach _vehicles;
},
[_vehicles]
] call PCAT_fnc_progressBar;
},
nil, // arguments
-890, // priority
false, // showWindow
true, // hideOnUse
"", // shortcut
"build_confirmed == 0 && ((_this distance2D _target) < veh_action_distance) && (vehicle player == player)"
];
}
],
[
["RHS_su25_base"],
{
if ( (side _this) isEqualTo OPFOR ) then {
if ( (side _this) isEqualTo OPFOR ) then {
_this setPylonLoadout [1, "rhs_mag_b8m1_s8t"];
_this setPylonLoadout [2, "rhs_mag_b8m1_s8t"];
_this setPylonLoadout [3, "rhs_mag_b8m1_s8df"];
Expand All @@ -46,7 +80,7 @@ KPLIB_objectInits = [
[
["rhs_mig29s_base"],
{
if ( (side _this) isEqualTo OPFOR ) then {
if ( (side _this) isEqualTo OPFOR ) then {
_this setPylonLoadout [1, "rhs_mag_R77M_AKU170_MIG29"];
_this setPylonLoadout [2, "rhs_mag_R77M_AKU170_MIG29"];
_this setPylonLoadout [3, "rhs_mag_b8m1_bd3_umk2a_s8df"];
Expand Down
3 changes: 2 additions & 1 deletion Missionframework/presets/blufor/custom_west_desert.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ heavy_vehicles = [
["B_MBT_01_TUSK_F",550,450,300], // M2A4 Slammer UP (Merkava City)
["B_AFV_Wheeled_01_up_cannon_F",550,550,250], // Rhino MGS UP
["rhsusf_m109d_usarmy",600,1250,300], // M109A6
["B_MBT_01_mlrs_F",600,1800,250] // M5 Sandstorm MLRS
["rhsusf_M142_usarmy_D",600,1800,250] // M5 Sandstorm MLRS
];

air_vehicles = [
Expand Down Expand Up @@ -453,6 +453,7 @@ elite_vehicles = [
"rhsusf_m1a2sep1tuskiid_usarmy", // M1A2SEPv1 (Tusk II)
"B_MBT_01_cannon_F", // M2A1 Slammer (Merkava)
"B_MBT_01_TUSK_F", // M2A4 Slammer UP (Merkava City)
"rhsusf_M142_usarmy_D",
"rhsusf_m1a2sep2d_usarmy",
"rhsusf_m109d_usarmy", // M109A6
"rhsusf_M142_usarmy_D",
Expand Down
3 changes: 2 additions & 1 deletion Missionframework/presets/blufor/custom_west_woodland.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ heavy_vehicles = [
["B_T_MBT_01_TUSK_F",550,450,300], // M2A4 Slammer UP (Merkava City)
["B_T_AFV_Wheeled_01_up_cannon_F",550,550,250], // Rhino MGS UP
["rhsusf_m109_usarmy",600,1250,300], // M109A6
["B_MBT_01_mlrs_F",600,1800,250] // M5 Sandstorm MLRS
["rhsusf_M142_usarmy_WD",600,1800,250] // M5 Sandstorm MLRS
];

air_vehicles = [
Expand Down Expand Up @@ -443,6 +443,7 @@ elite_vehicles = [
"rhsusf_mkvsoc", // Mk.V SOCOM
"rhsusf_m1a1aim_tuski_wd", // M1A1SA (Tusk I)
"rhsusf_m1a2sep1tuskiiwd_usarmy", // M1A2SEPv1 (Tusk II)
"rhsusf_M142_usarmy_WD",
"B_T_MBT_01_cannon_F", // M2A1 Slammer (Merkava)
"B_T_MBT_01_TUSK_F", // M2A4 Slammer UP (Merkava City)
"rhsusf_m1a2sep2wd_usarmy",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ private _activation_radius_vehicles = 10;
private _spread = 7;
private _infantry_trigger = 1 + (ceil (random 2));
private _vehicle_trigger = 1;
private _ied_type = selectRandom ["IEDLandBig_F","IEDLandSmall_F","IEDUrbanBig_F","IEDUrbanSmall_F"];
private _ied_type = selectRandom ["Claymore_F", "APERSMine", "APERSBoundingMine"];
private _ied_obj = objNull;
private _roadobj = [(markerPos (_sector) getPos [random (200), random (360)]), 200, []] call BIS_fnc_nearestRoad;
private _goes_boom = false;
Expand Down
4 changes: 3 additions & 1 deletion Missionframework/scripts/server/sector/ied_manager.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ if (random 100 < 12) then {
_ultra_strong = true;
};
private _vehicle_trigger = 1;
private _ied_type = selectRandom ["IEDLandBig_F","IEDLandSmall_F","IEDUrbanBig_F","IEDUrbanSmall_F"];
// private _ied_type = selectRandom ["IEDLandBig_F","IEDLandSmall_F","IEDUrbanBig_F","IEDUrbanSmall_F"];
private _ied_type = selectRandom ["Claymore_F", "APERSMine", "APERSBoundingMine"];

private _ied_obj = objNull;
private _roadobj = [(markerPos _sector) getPos [random _radius, random 360], _radius, []] call BIS_fnc_nearestRoad;
private _goes_boom = false;
Expand Down
13 changes: 13 additions & 0 deletions _tools/_presets.json
Original file line number Diff line number Diff line change
Expand Up @@ -350,5 +350,18 @@
"KP_liberation_preset_resistance" : 0,
"KP_liberation_arsenal" : 19
}
},
{
"sourceFolder": "kp_liberation.UMB_Colombia",
"missionName": "PCAT-Liberation-(UMB_Colombia)-US_Civil_War",
"map": "UMB_Colombia",
"mapDisplay": "Colombia",
"configFile": "kp_liberation_config.sqf",
"variables": {
"KP_liberation_preset_blufor" : 31,
"KP_liberation_preset_opfor" : 32,
"KP_liberation_preset_resistance" : 9,
"KP_liberation_arsenal" : 17
}
}
]

0 comments on commit 8a3b9e8

Please sign in to comment.