From 11ac636583d045ed9dcb1fabef4f42d8494e1032 Mon Sep 17 00:00:00 2001 From: ChocoTaco Date: Sat, 26 Apr 2025 18:45:11 -0400 Subject: [PATCH] Added OneMine Added Admin vote to start Added default Header --- Classic/scripts/LCTFGame.cs | 108 +++++++++++++++++++++++++++ Classic/scripts/autoexec/VoteMenu.cs | 38 ++++++---- 2 files changed, 133 insertions(+), 13 deletions(-) diff --git a/Classic/scripts/LCTFGame.cs b/Classic/scripts/LCTFGame.cs index f3c2bc8..3d25335 100644 --- a/Classic/scripts/LCTFGame.cs +++ b/Classic/scripts/LCTFGame.cs @@ -500,6 +500,14 @@ function LCTFGame::missionLoadDone(%game) //%game.campThread_2 = schedule( 1000, 0, "checkVehicleCamping", 2 ); deleteNonLCTFObjects(); + + if($Host::LCTFOneMine){ + //Prevent package from being activated if it is already + if (!isActivePackage(LCTFOneMine)) + activatePackage(LCTFOneMine); + } + else if (isActivePackage(LCTFOneMine)) + deactivatePackage(LCTFOneMine); } function LCTFGame::clientMissionDropReady(%game, %client) @@ -648,6 +656,9 @@ function LCTFGame::gameOver(%game) } for(%j = 1; %j <= %game.numTeams; %j++) $TeamScore[%j] = 0; + + if (isActivePackage(LCTFOneMine)) + deactivatePackage(LCTFOneMine); } @@ -2282,6 +2293,21 @@ function LCTFGame::sendGameVoteMenu(%game, %client, %key) else messageClient( %client, 'MsgVoteItem', "", %key, 'LCTFProMode', 'Disable Pro Mode (Disc, SL, GL Only)', 'Disable Pro Mode (Disc, SL, GL Only)' ); } + + if(!%isAdmin || (%isAdmin && %client.ForceVote)) + { + if(!$Host::LCTFOneMine) + messageClient( %client, 'MsgVoteItem', "", %key, 'LCTFOneMine', 'Enable One Mine Inventory', 'Vote to enable One Mine Inventory' ); + else + messageClient( %client, 'MsgVoteItem', "", %key, 'LCTFOneMine', 'Disable One Mine Inventory', 'Vote to disable One Mine Inventory' ); + } + else + { + if(!$Host::LCTFOneMine) + messageClient( %client, 'MsgVoteItem', "", %key, 'LCTFOneMine', 'Enable One Mine Inventory', 'Enable One Mine Inventory' ); + else + messageClient( %client, 'MsgVoteItem', "", %key, 'LCTFOneMine', 'Disable One Mine Inventory', 'Disable One Mine Inventory' ); + } } } @@ -2320,6 +2346,8 @@ function LCTFGame::evalVote(%game, %typeName, %admin, %arg1, %arg2, %arg3, %arg4 //%game.VoteArmorClass(%admin, %arg1, %arg2, %arg3, %arg4); case "LCTFProMode": %game.LCTFProMode(%admin, %arg1, %arg2, %arg3, %arg4); + case "LCTFOneMine": + %game.LCTFOneMine(%admin, %arg1, %arg2, %arg3, %arg4); } parent::evalVote(%game, %typeName, %admin, %arg1, %arg2, %arg3, %arg4); @@ -2470,6 +2498,86 @@ function LCTFGame::LCTFProMode(%game, %admin, %arg1, %arg2, %arg3, %arg4) } } } + +//--------------------------------LCTFOneMine-------------------------------- +// +$VoteMessage["LCTFOneMine"] = "turn"; + +//Set Mine Max +package LCTFOneMine +{ + +//Set Mine Max +function Player::maxInventory(%this, %data){ + if(isObject(%data)){ + if(%data.getName() $= "Mine" && Game.class $= "LCTFGame"){ + return 1; + } + } + return ShapeBase::maxInventory(%this, %data); +} + +}; + +function LCTFGame::LCTFOneMine(%game, %admin, %arg1, %arg2, %arg3, %arg4) +{ + if( $countdownStarted && $MatchStarted ) + { + if(%admin) + { + killeveryone(); + + if($Host::LCTFOneMine) + { + messageAll('MsgAdminForce', '\c2The Admin has disabled One Mine Inventory.'); + + if (isActivePackage(LCTFOneMine)) + deactivatePackage(LCTFOneMine); + + $Host::LCTFOneMine = false; + } + else + { + messageAll('MsgAdminForce', '\c2The Admin has enabled One Mine Inventory.'); + + if (!isActivePackage(LCTFOneMine)) + activatePackage(LCTFOneMine); + + $Host::LCTFOneMine = true; + } + } + else + { + %totalVotes = %game.totalVotesFor + %game.totalVotesAgainst; + if(%totalVotes > 0 && (%game.totalVotesFor / ClientGroup.getCount()) > ($Host::VotePasspercent / 100)) + { + killeveryone(); + + if($Host::LCTFOneMine) + { + messageAll('MsgVotePassed', '\c2One Mine Inventory Disabled.'); + + if (isActivePackage(LCTFOneMine)) + deactivatePackage(LCTFOneMine); + + $Host::LCTFOneMine = false; + } + else + { + messageAll('MsgVotePassed', '\c2One Mine Inventory Enabled.'); + + if (!isActivePackage(LCTFOneMine)) + activatePackage(LCTFOneMine); + + $Host::LCTFOneMine = true; + } + } + else + messageAll('MsgVoteFailed', '\c2Mode change did not pass: %1 percent.', mFloor(%game.totalVotesFor/ClientGroup.getCount() * 100)); + } + } +} + // For voting to work properly - evo admin.ovl // // case "LCTFProMode": diff --git a/Classic/scripts/autoexec/VoteMenu.cs b/Classic/scripts/autoexec/VoteMenu.cs index 0cddec6..f8beadb 100644 --- a/Classic/scripts/autoexec/VoteMenu.cs +++ b/Classic/scripts/autoexec/VoteMenu.cs @@ -51,10 +51,12 @@ function DefaultGame::sendGameVoteMenu(%game, %client, %key) { if(!$Host::TournamentMode) messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTournamentMode', 'change server to Tournament.', 'Vote Tournament Mode'); - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Vote to Change the Mission'); - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteNextMission', 'set next mission to', 'Vote to Set the Next Mission'); - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Vote to Change the Time Limit'); - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteSkipMission', 'skip the mission to', 'Vote to Skip Mission' ); + if(!$MatchStarted && !$CountdownStarted && $Host::TournamentMode) + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteMatchStart', 'Start Match', 'Vote to Start the Match'); + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Vote to Change the Mission'); + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteNextMission', 'set next mission to', 'Vote to Set the Next Mission'); + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Vote to Change the Time Limit'); + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteSkipMission', 'skip the mission to', 'Vote to Skip Mission' ); if(%multipleTeams) { if($teamDamage) @@ -86,23 +88,26 @@ function DefaultGame::sendGameVoteMenu(%game, %client, %key) //Mission Info Header - Mission Name, Type, Caps to Win if(%client.canVote && %game.scheduleVote $= "") { + if($voteNext) + %showNM = " - Next Map:" SPC $HostMissionName[$voteNextMap] SPC "(" @ $HostTypeName[$voteNextType] @ ")"; + switch$($CurrentMissionType) { - case CTF or SCtF or LCTF: - if($Host::TournamentMode) - %showTL = " - Time Limit:" SPC $Host::TimeLimit SPC "Minutes"; - if($voteNext) - %showNM = " - Next Map:" SPC $HostMissionName[$voteNextMap] SPC "(" @ $HostTypeName[$voteNextType] @ ")"; + case CTF or SCtF or LCTF: + %showTL = " - Time Limit:" SPC $Host::TimeLimit SPC "Minutes"; messageClient(%client, 'MsgVoteItem', "", %key, '', $MissionDisplayName SPC "(" @ $MissionTypeDisplayName @ "):" SPC MissionGroup.CTF_scoreLimit SPC "Caps to Win", $MissionDisplayName SPC "(" @ $MissionTypeDisplayName @ "):" SPC MissionGroup.CTF_scoreLimit SPC "Caps to Win" @ %showTL @ %showNM); case LakRabbit: %cap = "2000 Points to Win"; messageClient(%client, 'MsgVoteItem', "", %key, '', $MissionDisplayName SPC "(" @ $MissionTypeDisplayName @ "):" SPC %cap, - $MissionDisplayName SPC "(" @ $MissionTypeDisplayName @ "):" SPC %cap); + $MissionDisplayName SPC "(" @ $MissionTypeDisplayName @ "):" SPC %cap @ %showNM); case DM: %cap = "25 Points to Win"; messageClient(%client, 'MsgVoteItem', "", %key, '', $MissionDisplayName SPC "(" @ $MissionTypeDisplayName @ "):" SPC %cap, - $MissionDisplayName SPC "(" @ $MissionTypeDisplayName @ "):" SPC %cap); + $MissionDisplayName SPC "(" @ $MissionTypeDisplayName @ "):" SPC %cap @ %showNM); + default: + messageClient(%client, 'MsgVoteItem', "", %key, '', $MissionDisplayName SPC "(" @ $MissionTypeDisplayName @ "):" SPC %cap, + $MissionDisplayName SPC "(" @ $MissionTypeDisplayName @ ")" @ %showNM); } } @@ -515,7 +520,7 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % } case "VoteMatchStart": - if(!%isAdmin) + if(!%isAdmin || (%isAdmin && %client.ForceVote)) { if($MatchStarted || $CountdownStarted) return; @@ -865,6 +870,13 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % if(!%isAdmin || (%isAdmin && %client.ForceVote)) %msg = %client.nameBase @ " initiated a vote to " @ (Game.LCTFProMode == 0 ? "enable" : "disable") @ " pro mode."; + case "LCTFOneMine": + if(!$CurrentMissionType $= "LCTF") + return; + + if(!%isAdmin || (%isAdmin && %client.ForceVote)) + %msg = %client.nameBase @ " initiated a vote to " @ (Game.LCTFOneMine == 0 ? "enable" : "disable") @ " one mine mode."; + case "showServerRules": if (($Host::ServerRules[1] !$= "") && (!%client.CantView)) { @@ -1923,4 +1935,4 @@ function DefaultGame::setNextMission(%game, %client, %map, %type, %mapIndex, %ty messageAll('', '\c1Vote %6: \c0Yea: %1 Nay: %2 Abstain: %7 Total: %3 [%4%5]', %game.totalVotesFor, %game.totalVotesAgainst, %totalVotes, mfloor((%game.totalVotesFor/(ClientGroup.getCount() - %game.totalVotesNone)) * 100), "%", %key, %game.totalVotesNone); } } -} +} \ No newline at end of file