-
Notifications
You must be signed in to change notification settings - Fork 6
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
Buildings can now (ideally) only last 2 hours max #41
base: development
Are you sure you want to change the base?
Changes from 4 commits
f059cff
d01e591
1951bb4
faf07b2
121a289
64ef442
c20cd5c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,6 +95,23 @@ if (_resupplyType == "MULTISANDBAG" && _supplyType == "BuildingSupplies") then { | |
//No supplies, no point continuing execution. | ||
if (_supplies == 0) exitWith {}; | ||
|
||
private _currentSupplies = _supplySource getVariable ["para_g_current_supplies", 0]; | ||
private _supplyConsumptionRate = _supplySource getVariable ["para_g_supply_consumption_rate", 1]; | ||
|
||
private _proposedSuppliesSum = _currentSupplies + _supplies; | ||
private _proposedRemainingTimeSeconds = _proposedSuppliesSum / _supplyConsumptionRate; | ||
private _maxTimeLimit = 7200; // max time limit a building can have, 2 hours in seconds | ||
|
||
// Check if the current lifetime would exceed the time limit | ||
if ( _proposedRemainingTimeSeconds >= _maxTimeLimit) then { | ||
// if the supplies that are being added will exceed 2 hours for the building, trim the supplies so that it only reaches 2 hours max. This will still consume the item!!! | ||
_supplies = (_maxTimeLimit * _supplyConsumptionRate) - _currentSupplies; | ||
|
||
// notify players that time limit has been reached and item was still consumed | ||
["TaskFailed",["",localize "STR_para_build_maxtimereached"]] call para_c_fnc_show_notification; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will probably need remoteExec-ing for the specific player, which means we need to pass the player object into the args for this script. On player-hosted local development this will work because the server IS the player. But probably won't work on dedicated server. I think. On phone so bit limited in what I can check easily. Also, there's a notifications config here https://github.com/Bro-Nation/Paradigm/blob/development/client/configs/notifications.hpp But that's for "client" functions and this is a "server" function. Hmmm. I Need to think about this/have a look at the rest of the code path. I wonder if we can do the "too long, are your supplies" notification on whatever script calls this on the client? Because the interaction overlay already shows how much time is left for supplies, so that value is already available to clients. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was copying how they did notifications for adding a crate.
Last line, they call a notification in a very similar way so, I think, it ought work, I do see what you mean though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Classic viewing a PR on my phone, I missed the fact // executes the notification on the client of the specific player who has done the resupply
[["TaskFailed",["",localize "STR_para_build_maxtimereached"]]] remoteExecCall ["para_c_fnc_show_notification", _player]; It probably won't work on player hosted (local development), but it will work on dedicated server. See I need to refactor a thing because I was lazy note below REhandlerMostly a note so we're both aware of what's going on. At the top: //THIS IS A REHANDLER FUNCTION
//It can only be called from rehandler, as it relies on having _player defined. script --> fn_rehandler.sqf I need to refactor a thing because I was lazyI'll need to add this in paradigm (it should really be here in
If you change the line to match the above, I'll do a PR after and switch it to that... or .... you can copy the having both There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Tally, seems like it's just one of those paradigm things. That's all fine then. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
So it does or does not need to change from:
to:
?? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry, to clarify
this was specifically about
yep, will need the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I see what you mean, but how does the notification on the resupply_with_crate/sandbag working then?
|
||
}; | ||
|
||
|
||
[_building, -_supplies, true] call para_s_fnc_building_consume_supplies; | ||
|
||
_supplySource getVariable "para_g_current_supplies" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
split comment over two lines please cos it's quite long, we like to try and keep line length below 100 characters for readability and maintenance purposes
Example PR comment