diff --git a/Classic/prefs/serverPrefs.cs b/Classic/prefs/serverPrefs.cs index 987858b..bee4996 100644 --- a/Classic/prefs/serverPrefs.cs +++ b/Classic/prefs/serverPrefs.cs @@ -8,8 +8,8 @@ $Host::AllowAdminStopVote = 1; $Host::AllowAdminStopVotes = 1; $Host::AllowAdminVotes = 1; $Host::AllowMapScript = "True"; -$Host::AllowPlayerTournamentModeVotekick = 0; $Host::AllowPlayerVoteChangeMission = 1; +$Host::AllowPlayerVoteNextMission = 1; $Host::AllowPlayerVoteSkipMission = 1; $Host::AllowPlayerVoteTeamDamage = 0; $Host::AllowPlayerVoteTimeLimit = 1; @@ -149,6 +149,8 @@ $Host::MaxPlayers = 30; $Host::MinBotDifficulty = 0; $Host::MinFlagRecordPlayerCount = 6; $Host::MissionType = "LakRabbit"; +$Host::MultipleMapRotation = 0; +$Host::MultipleMapRotationCount = 3; $Host::NoBaseRapeEnabled = 1; $Host::NoBaseRapePlayerCount = 14; $Host::NoSmurfs = 0; diff --git a/Classic/scripts/CTFGame.cs b/Classic/scripts/CTFGame.cs index db28732..6e5061a 100755 --- a/Classic/scripts/CTFGame.cs +++ b/Classic/scripts/CTFGame.cs @@ -2093,39 +2093,39 @@ function CTFGame::startFlagCollisionSearch(%game, %flag) // VOTING /////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////// -function CTFGame::sendGameVoteMenu(%game, %client, %key) -{ - DefaultGame::sendGameVoteMenu(%game, %client, %key); - if ( %game.scheduleVote $= "" ) - { - //if(%client.isAdmin) - //messageClient( %client, 'MsgVoteItem', "", %key, 'VoteAntiTurtleTime', 'change the anti turtle time to', 'Change Anti-Turtle time' ); - //else - // messageClient( %client, 'MsgVoteItem', "", %key, 'VoteAntiTurtleTime', 'change the anti turtle time to', 'Vote Anti-Turtle time' ); - } -} +// function CTFGame::sendGameVoteMenu(%game, %client, %key) +// { +// DefaultGame::sendGameVoteMenu(%game, %client, %key); +// if ( %game.scheduleVote $= "" ) +// { +// if(%client.isAdmin) +// messageClient( %client, 'MsgVoteItem', "", %key, 'VoteAntiTurtleTime', 'change the anti turtle time to', 'Change Anti-Turtle time' ); +// else +// messageClient( %client, 'MsgVoteItem', "", %key, 'VoteAntiTurtleTime', 'change the anti turtle time to', 'Vote Anti-Turtle time' ); +// } +// } -function CTFGame::evalVote(%game, %typeName, %admin, %arg1, %arg2, %arg3, %arg4) -{ - DefaultGame::evalVote(%game, %typeName, %admin, %arg1, %arg2, %arg3, %arg4); - switch$ (%typeName) - { - case "voteAntiTurtleTime": - %game.voteAntiTurtleTime(%admin, %arg1, %arg2, %arg3, %arg4); - } -} +// function CTFGame::evalVote(%game, %typeName, %admin, %arg1, %arg2, %arg3, %arg4) +// { +// DefaultGame::evalVote(%game, %typeName, %admin, %arg1, %arg2, %arg3, %arg4); +// switch$ (%typeName) +// { +// case "voteAntiTurtleTime": +// %game.voteAntiTurtleTime(%admin, %arg1, %arg2, %arg3, %arg4); +// } +// } -function CTFGame::sendAntiTurtleTimeList( %game, %client, %key ) -{ - messageClient( %client, 'MsgVoteItem', "", %key, 6, "", '6 minutes' ); - messageClient( %client, 'MsgVoteItem', "", %key, 8, "", '8 minutes' ); - messageClient( %client, 'MsgVoteItem', "", %key, 10, "", '10 minutes' ); - messageClient( %client, 'MsgVoteItem', "", %key, 12, "", '12 minutes' ); - messageClient( %client, 'MsgVoteItem', "", %key, 14, "", '14 minutes' ); - messageClient( %client, 'MsgVoteItem', "", %key, 16, "", '16 minutes' ); - messageClient( %client, 'MsgVoteItem', "", %key, 18, "", '18 minutes' ); - messageClient( %client, 'MsgVoteItem', "", %key, 200, "", 'Disable Anti Turtle' ); -} +// function CTFGame::sendAntiTurtleTimeList( %game, %client, %key ) +// { +// messageClient( %client, 'MsgVoteItem', "", %key, 6, "", '6 minutes' ); +// messageClient( %client, 'MsgVoteItem', "", %key, 8, "", '8 minutes' ); +// messageClient( %client, 'MsgVoteItem', "", %key, 10, "", '10 minutes' ); +// messageClient( %client, 'MsgVoteItem', "", %key, 12, "", '12 minutes' ); +// messageClient( %client, 'MsgVoteItem', "", %key, 14, "", '14 minutes' ); +// messageClient( %client, 'MsgVoteItem', "", %key, 16, "", '16 minutes' ); +// messageClient( %client, 'MsgVoteItem', "", %key, 18, "", '18 minutes' ); +// messageClient( %client, 'MsgVoteItem', "", %key, 200, "", 'Disable Anti Turtle' ); +// } function CTFGame::voteAntiTurtleTime(%game, %admin, %newLimit) { diff --git a/Classic/scripts/DMGame.cs b/Classic/scripts/DMGame.cs index b598b38..bb55248 100644 --- a/Classic/scripts/DMGame.cs +++ b/Classic/scripts/DMGame.cs @@ -40,7 +40,7 @@ function DMGame::setUpTeams(%game) %group = nameToID("MissionGroup/Teams"); if(%group == -1) return; - + // create a team0 if it does not exist %team = nameToID("MissionGroup/Teams/team0"); if(%team == -1) @@ -48,7 +48,7 @@ function DMGame::setUpTeams(%game) %team = new SimGroup("team0"); %group.add(%team); } - + // 'team0' is not counted as a team here %game.numTeams = 0; while(%team != -1) @@ -56,7 +56,7 @@ function DMGame::setUpTeams(%game) // create drop set and add all spawnsphere objects into it %dropSet = new SimSet("TeamDrops" @ %game.numTeams); MissionCleanup.add(%dropSet); - + %spawns = nameToID("MissionGroup/Teams/team" @ %game.numTeams @ "/SpawnSpheres"); if(%spawns != -1) { @@ -64,21 +64,21 @@ function DMGame::setUpTeams(%game) for(%i = 0; %i < %count; %i++) %dropSet.add(%spawns.getObject(%i)); } - + // set the 'team' field for all the objects in this team %team.setTeam(0); - + clearVehicleCount(%team+1); // get next group %team = nameToID("MissionGroup/Teams/team" @ %game.numTeams + 1); if (%team != -1) %game.numTeams++; } - + // set the number of sensor groups (including team0) that are processed setSensorGroupCount(%game.numTeams + 1); %game.numTeams = 1; - + // allow teams 1->31 to listen to each other (team 0 can only listen to self) for(%i = 1; %i < 32; %i++) setSensorGroupListenMask(%i, 0xfffffffe); @@ -106,7 +106,7 @@ function DMGame::equip(%game, %player) for(%i =0; %i<$InventoryHudCount; %i++) %player.client.setInventoryHudItem($InventoryHudData[%i, itemDataName], 0, 1); %player.client.clearBackpackIcon(); - + if( $Host::DMSLOnlyMode ) { %player.clearInventory(); @@ -122,7 +122,7 @@ function DMGame::equip(%game, %player) buyFavorites(%player.client); %player.setEnergyLevel(%player.getDataBlock().maxEnergy); %player.selectWeaponSlot( 0 ); - + // do we want to give players a disc launcher instead? GJL: Yes we do! %player.use("Disc"); } @@ -137,7 +137,7 @@ function DMGame::pickPlayerSpawn(%game, %client, %respawn) function DMGame::clientJoinTeam( %game, %client, %team, %respawn ) { %game.assignClientTeam( %client ); - + // Spawn the player: %game.spawnPlayer( %client, %respawn ); } @@ -146,7 +146,7 @@ function DMGame::assignClientTeam(%game, %client) { for(%i = 1; %i < 32; %i++) $DMTeamArray[%i] = false; - + %maxSensorGroup = 0; %count = ClientGroup.getCount(); for(%i = 0; %i < %count; %i++) @@ -159,7 +159,7 @@ function DMGame::assignClientTeam(%game, %client) %maxSensorGroup = %cl.team; } } - + //now loop through the team array, looking for an empty team for(%i = 1; %i < 32; %i++) { @@ -171,14 +171,14 @@ function DMGame::assignClientTeam(%game, %client) break; } } - + // set player's skin pref here setTargetSkin(%client.target, %client.skin); - + // Let everybody know you are no longer an observer: messageAll( 'MsgClientJoinTeam', '\c1%1 has joined the fray.', %client.name, "", %client, 1 ); updateCanListenState( %client ); - + //now set the max number of sensor groups... setSensorGroupCount(%maxSensorGroup + 1); } @@ -190,9 +190,9 @@ function DMGame::clientMissionDropReady(%game, %client) messageClient(%client, 'MsgDMPlayerDies', "", 0); messageClient(%client, 'MsgDMKill', "", 0); %game.resetScore(%client); - + messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName ); - + DefaultGame::clientMissionDropReady(%game, %client); } @@ -205,7 +205,7 @@ function DMGame::AIHasJoined(%game, %client) function DMGame::checkScoreLimit(%game, %client) { %scoreLimit = MissionGroup.DM_scoreLimit; - + if(%scoreLimit $= "") %scoreLimit = 25; if(%client.score >= %scoreLimit) @@ -215,7 +215,7 @@ function DMGame::checkScoreLimit(%game, %client) function DMGame::createPlayer(%game, %client, %spawnLoc, %respawn) { DefaultGame::createPlayer(%game, %client, %spawnLoc, %respawn); - + %client.setSensorGroup(%client.team); %client.isObserver = 0; } @@ -230,7 +230,7 @@ function DMGame::resetScore(%game, %client) %client.MidAir = 0; %client.Bonus = 0; %client.KillStreakBonus = 0; - + // not a score thing but needs to be reset %client.killCounter = 0; } @@ -244,35 +244,35 @@ function DMGame::forceObserver( %game, %client, %reason ) function DMGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLoc) { cancel(%clVictim.player.alertThread); - + DefaultGame::onClientKilled(%game, %clVictim, %clKiller, %damageType, %implement, %damageLoc); - + ProcessBonusDM(%game, %clVictim, %clKiller, %damageType, %implement, %damageLoc); } function ProcessBonusDM(%game, %clVictim, %clKiller, %damageType, %implement, %damageLoc) -{ +{ if(%clVictim.isMarked && $DMGame::mode) { if(%clKiller $= "" || %clVictim.killCounter < 3) return; - + if(%clVictim == %clKiller || %damageType == $DamageType::Suicide || %damageType == $DamageType::Lava || %damageType == $DamageType::OutOfBounds || %damageType == $DamageType::Ground || %damageType == $DamageType::Lightning) { messageAll('Msgding', '\c2%1\'s Kill Streak has ended. No bonus rewarded.', %clVictim.name, %clVictim.killCounter); %game.lastGuy = 0; } else if(%clVictim !$= %clKiller) - { + { %temprampage = mfloor((%clVictim.killCounter - $DMGame::wpKillCount) * %game.SCORE_PER_KILLSTREAKBONUS); %s = ""; //single bonus - if(%clVictim.killCounter < $DMGame::wpKillCountDoubleBonus) + if(%clVictim.killCounter < $DMGame::wpKillCountDoubleBonus) { - %clKiller.Bonus++; // stats rename to what ever + %clKiller.Bonus++; // stats rename to what ever %clKiller.scoreBonus++; - + //messageAll('Msgding', '\c1%1 receives a bonus for ending %2\'s %3x kill streak.~wfx/misc/flag_lost.wav',%clKiller.name,%clVictim.name, %clVictim.killCounter); messageAllExcept(%clVictim, -1, 'Msgding', '\c4%1 is rewarded with a bonus for ending %5\'s %6X Kill Streak!~wfx/misc/flag_lost.wav', %clKiller.name, "", %clVictim, 1, %clVictim.name, %clVictim.killCounter ); if(%temprampage > 0) @@ -284,11 +284,11 @@ function ProcessBonusDM(%game, %clVictim, %clKiller, %damageType, %implement, %d messageClient(%clVictim, 'Msgding', '\c2%1 has ended your %2X Kill Streak.~wfx/misc/flag_lost.wav', %clKiller.name, %clVictim.killCounter); } //double bonus - else + else { %clKiller.Bonus++; %clKiller.Bonus++; %clKiller.scoreBonus++; %clKiller.scoreBonus++; - + //messageAll('Msgding', '\c1%1 receives a double bonus for ending %2\'s %3x kill streak.~wfx/misc/flag_lost.wav',%clKiller.name,%clVictim.name, %clVictim.killCounter); messageAllExcept(%clVictim, -1, 'Msgding', '\c4%1 is rewarded with a double bonus for ending %5\'s %6X Kill Streak!~wfx/misc/flag_lost.wav', %clKiller.name, "", %clVictim, 1, %clVictim.name, %clVictim.killCounter ); if(%temprampage > 0) @@ -323,19 +323,19 @@ function ProcessBonusDM(%game, %clVictim, %clKiller, %damageType, %implement, %d } %clKiller.killCounter++; %clVictim.killCounter = 0; - + switch$($DMGame::mode) { - case 1: // player with the highest kill streak if they are above $DMGame::wpKillCount + case 1: // player with the highest kill streak if they are above $DMGame::wpKillCount %bonusClient = 0; for(%b = 0; %b < ClientGroup.getCount(); %b++) { %cl = ClientGroup.getObject(%b); if(%cl.killCounter >= $DMGame::wpKillCount && %cl.killCounter > %bonusClient.killCounter && !%cl.isObserver) { - %bonusClient = %cl;// we have a new + %bonusClient = %cl;// we have a new } - } + } if(%bonusClient !$= 0 && %clKiller == %bonusClient) { if(%bonusClient !$= %game.lastGuy) @@ -343,7 +343,7 @@ function ProcessBonusDM(%game, %clVictim, %clKiller, %damageType, %implement, %d for(%i = 0; %i < ClientGroup.getCount(); %i++) { %cl = ClientGroup.getObject(%i); - + hideTargetWaypoint(%cl,%game.lastGuy); if(%cl !$= %bonusClient) { @@ -352,13 +352,13 @@ function ProcessBonusDM(%game, %clVictim, %clKiller, %damageType, %implement, %d } messageAllExcept(%bonusClient, -1, 'MsgPingWaypoint', '\c2%1 is on a Kill Streak. Kill them for a bonus!~wgui/vote_nopass.wav', %bonusClient.name, "", %bonusClient, 1 ); messageClient(%bonusClient, 'MsgPingWaypoint', '\c2You\'re on a Kill Streak. Get more kills for extra points!~wfx/misc/target_waypoint.wav', %bonusClient.killCounter); - - %game.lastGuy.isMarked = 0; + + %game.lastGuy.isMarked = 0; %bonusClient.isMarked = 1; - %game.lastGuy = %bonusClient; + %game.lastGuy = %bonusClient; } - else if(%bonusClient == %game.lastGuy && %bonusClient.killCounter > 3) - { + else if(%bonusClient == %game.lastGuy && %bonusClient.killCounter > 3) + { //give waypointed player a kill bonus %bonusClient.KillStreakBonus++; %bonusClient.scoreKillStreakBonus++; @@ -375,7 +375,7 @@ function ProcessBonusDM(%game, %clVictim, %clKiller, %damageType, %implement, %d %bonusClient = %cl; } - } + } if(%bonusClient != 0 && %game.lastGuy != %bonusClient) { for(%i = 0; %i < ClientGroup.getCount(); %i++) @@ -423,7 +423,7 @@ function hideTargetWaypoint(%client,%clTarget) %visMask = getSensorGroupAlwaysVisMask(%clTarget.getSensorGroup()); %visMask &= ~(1 << %client.getSensorGroup()); setSensorGroupAlwaysVisMask(%clTarget.getSensorGroup(), %visMask); - removeClientTargetType(%client, "AssignedTask"); + removeClientTargetType(%client, "AssignedTask"); } } @@ -437,7 +437,7 @@ function DMGame::updateKillScores(%game, %clVictim, %clKiller, %damageType, %imp } else if (%game.testSuicide(%clVictim, %clKiller, %damageType)) //otherwise test for suicide %game.awardScoreSuicide(%clVictim); - + messageClient(%clVictim, 'MsgDMPlayerDies', "", %clVictim.deaths + %clVictim.suicides); } @@ -449,12 +449,12 @@ function DMGame::recalcScore(%game, %client) %BonusValue = %client.Bonus * %game.SCORE_PER_BONUS; %MidAirValue = %client.MidAir * %game.SCORE_PER_MIDAIR; %KillStreakBonusValue = %client.KillStreakBonus * %game.SCORE_PER_KILLSTREAKBONUS; - + if (%killValue - %deathValue == 0) %client.efficiency = %suicideValue; else %client.efficiency = ((%killValue * %killValue) / (%killValue - (%deathValue + %suicideValue))) + (%BonusValue + %MidAirValue + %KillStreakBonusValue); - + %client.score = mFloatLength(%client.efficiency, 1); messageClient(%client, 'MsgYourScoreIs', "", %client.score); %game.recalcTeamRanks(%client); @@ -479,12 +479,12 @@ function DMGame::gameOver(%game) { //call the default DefaultGame::gameOver(%game); - + messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.gameover.wav" ); - + cancel(%game.timeThread); messageAll('MsgClearObjHud', ""); - for(%i = 0; %i < ClientGroup.getCount(); %i ++) + for(%i = 0; %i < ClientGroup.getCount(); %i ++) { %client = ClientGroup.getObject(%i); %game.resetScore(%client); @@ -507,32 +507,32 @@ function plzBounceOffGrid(%obj, %bounceForce, %count) %boundsNorth = getWord(%bounds, 1); %boundsEast = %boundsWest + getWord(%bounds, 2); %boundsSouth = %boundsNorth + getWord(%bounds, 3); - + %shapePos = %obj.getPosition(); %shapex = firstWord(%shapePos); %shapey = getWord(%shapePos, 1); - + if( %shapex >= %boundsWest && %shapex <= %boundsEast && %shapey >= %boundsNorth && %shapey <= %boundsSouth) { // we don't need to bounce at all return; } - + if( %count == 8 ) { // just kill this retard %obj.scriptKill($DamageType::OutOfBounds); return; } - + if (%bounceForce $= "") %bounceForce = 65; - + %oldVel = %obj.getVelocity(); %obj.setVelocity("0 0 0"); - + %vecx = firstWord(%oldVel); %vecy = getWord(%oldVel, 1); %vecz = getWord(%oldVel, 2); - + // four cases, not two cases you fucktard kineticpoet // no wonder the trives of vengrances failed if(%shapex <= %boundsWest) { @@ -541,16 +541,16 @@ function plzBounceOffGrid(%obj, %bounceForce, %count) else if(%shapex >= %boundsEast) { %vecx = -mAbs(%vecx); } - + if(%shapey <= %boundsNorth) { %vecy = mAbs(%vecy); } else if(%shapey >= %boundsSouth) { %vecy = -mAbs(%vecy); } - + %vec = %vecx SPC %vecy SPC %vecz; - + // If the object's speed was pretty slow, give it a boost %oldSpeed = VectorLen(%oldVel); if (%oldSpeed < 25) @@ -560,11 +560,11 @@ function plzBounceOffGrid(%obj, %bounceForce, %count) } else %vec = VectorScale(%vec, 1.15); - + // apply the impulse to the object //%obj.applyImpulse(%obj.getWorldBoxCenter(), %vec); %obj.setVelocity(%vec); - + // repeat this bounce 4 times per second. if we're oob for 2 seconds, take action // don't do this with the flag because that has its own thread if( %obj.dataBlock !$= "Flag" ) { @@ -582,7 +582,7 @@ function isOutOfBounds(%position) %boundsNorth = getWord(%bounds, 1); %boundsEast = %boundsWest + getWord(%bounds, 2); %boundsSouth = %boundsNorth + getWord(%bounds, 3); - + return (%shapex < %boundsWest || %shapex > %boundsEast || %shapey < %boundsNorth || %shapey > %boundsSouth); } @@ -591,7 +591,7 @@ function DMGame::leaveMissionArea(%game, %playerData, %player) { if(%player.getState() $= "Dead") return; - + plzBounceOffGrid(%player, 65); } @@ -607,7 +607,7 @@ function DMGame::DMAlertPlayer(%game, %count, %player) function DMGame::MissionAreaDamage(%game, %player) { - if(%player.getState() !$= "Dead") + if(%player.getState() !$= "Dead") { %player.setDamageFlash(0.1); %prevHurt = %player.getDamageLevel(); @@ -622,27 +622,27 @@ function DMGame::updateScoreHud(%game, %client, %tag) { // Clear the header: messageClient( %client, 'SetScoreHudHeader', "", "" ); - + // Send the subheader: messageClient(%client, 'SetScoreHudSubheader', "", '\tPLAYER\tRATING\tKILLS\tDEATHS\tBONUS'); - + for (%index = 0; %index < $TeamRank[0, count]; %index++) { //get the client info %cl = $TeamRank[0, %index]; - + //get the score %clScore = %cl.score; - + %clKills = mFloatLength( %cl.kills, 0 ); %clDeaths = mFloatLength( %cl.deaths + %cl.suicides, 0 ); %clBonus = mFloor((%cl.Bonus * %game.SCORE_PER_BONUS) + (%cl.MidAir * %game.SCORE_PER_MIDAIR) + (%cl.KillStreakBonus * %game.SCORE_PER_KILLSTREAKBONUS )); - %clStyle = %cl == %client ? "" : ""; - + %clStyle = %cl == %client ? "" : ""; + //%BonusValue = %client.Bonus * %game.SCORE_PER_BONUS; //%MidAirValue = %client.MidAir * %game.SCORE_PER_MIDAIR; //%KillStreakBonusValue = %client.KillStreakBonus * %game.SCORE_PER_KILLSTREAKBONUS; - + //if the client is not an observer, send the message if (%client.team != 0) { // \%5\%1\%2\%3\tBG' @@ -656,7 +656,7 @@ function DMGame::updateScoreHud(%game, %client, %tag) %cl.name, %clScore, %clKills, %clDeaths, %clStyle, %cl, %clBonus); } } - + // Tack on the list of observers: %observerCount = 0; for (%i = 0; %i < ClientGroup.getCount(); %i++) @@ -665,7 +665,7 @@ function DMGame::updateScoreHud(%game, %client, %tag) if (%cl.team == 0) %observerCount++; } - + if (%observerCount > 0) { messageClient( %client, 'SetLineHud', "", %tag, %index, ""); @@ -686,7 +686,7 @@ function DMGame::updateScoreHud(%game, %client, %tag) } } } - + //clear the rest of Hud so we don't get old lines hanging around... messageClient( %client, 'ClearHud', "", %tag, %index ); } @@ -698,13 +698,13 @@ function DMGame::updateScoreHud(%game, %client, %tag) package DMGame { - + function deployMineCheck(%mineObj, %player) { // explode it vgc schedule(2000, %mineObj, "explodeMine", %mineObj, true); } - + //Take out anything vehicle related function Armor::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType, %momVec, %mineSC) { @@ -714,19 +714,19 @@ package DMGame { %amount *= 1.3; } - + if(%targetObject.client.armor $= "Heavy") { %amount *= 1.43; } - + //error("Armor::damageObject( "@%data@", "@%targetObject@", "@%sourceObject@", "@%position@", "@%amount@", "@%damageType@", "@%momVec@" )"); if(%targetObject.invincible || %targetObject.getState() $= "Dead") return; %targetClient = %targetObject.getOwnerClient(); if(isObject(%mineSC)) - %sourceClient = %mineSC; + %sourceClient = %mineSC; else %sourceClient = isObject(%sourceObject) ? %sourceObject.getOwnerClient() : 0; @@ -740,8 +740,8 @@ package DMGame //if (%sourceClient) // %sourceTeam = %sourceClient.getSensorGroup(); //else if(%damageType == $DamageType::Suicide) - // %sourceTeam = 0; - + // %sourceTeam = 0; + // if teamdamage is off, and both parties are on the same team // (but are not the same person), apply no damage //if(!$teamDamage && (%targetClient != %sourceClient) && (%targetTeam == %sourceTeam)) @@ -749,7 +749,7 @@ package DMGame if(%targetObject.isShielded && %damageType != $DamageType::Blaster) %amount = %data.checkShields(%targetObject, %position, %amount, %damageType); - + if(%amount == 0) return; @@ -757,11 +757,11 @@ package DMGame %damageScale = %data.damageScale[%damageType]; if(%damageScale !$= "") %amount *= %damageScale; - + %flash = %targetObject.getDamageFlash() + (%amount * 2); if (%flash > 0.75) %flash = 0.75; - + // Teratos: Originally from Eolk? Mine+Disc tracking/death message support. // No Schedules by DarkTiger Ver.2 %targetClient.mineDisc = false; @@ -770,17 +770,17 @@ package DMGame case $DamageType::Disc: if((getSimTime() - %targetClient.mdcTime1) < 256) %targetClient.mineDisc = true; - - %targetClient.mdcTime2 = getSimTime(); + + %targetClient.mdcTime2 = getSimTime(); case $DamageType::Mine: if((getSimTime() - %targetClient.mdcTime2) < 256) %targetClient.mineDisc = true; - - %targetClient.mdcTime1 = getSimTime(); + + %targetClient.mdcTime1 = getSimTime(); } // -- End Mine+Disc insert. - + %previousDamage = %targetObject.getDamagePercent(); %targetObject.setDamageFlash(%flash); %targetObject.applyDamage(%amount); @@ -788,76 +788,69 @@ package DMGame %targetClient.lastDamagedBy = %damagingClient; %targetClient.lastDamaged = getSimTime(); - - //now call the "onKilled" function if the client was... you know... + + //now call the "onKilled" function if the client was... you know... if(%targetObject.getState() $= "Dead") { // where did this guy get it? %damLoc = %targetObject.getDamageLocation(%position); - + // should this guy be blown apart? - if( %damageType == $DamageType::Explosion || - %damageType == $DamageType::Mortar || - %damageType == $DamageType::SatchelCharge || - %damageType == $DamageType::Missile ) + if( %damageType == $DamageType::Explosion || + %damageType == $DamageType::Mortar || + %damageType == $DamageType::SatchelCharge || + %damageType == $DamageType::Missile ) { if( %previousDamage >= 0.35 ) // only if <= 35 percent damage remaining { %targetObject.setMomentumVector(%momVec); - %targetObject.blowup(); + %targetObject.blowup(); } } - + // If we were killed, max out the flash %targetObject.setDamageFlash(0.75); - + %damLoc = %targetObject.getDamageLocation(%position); Game.onClientKilled(%targetClient, %sourceClient, %damageType, %sourceObject, %damLoc); } else if ( %amount > 0.1 ) - { + { if( %targetObject.station $= "" && %targetObject.isCloaked() ) { %targetObject.setCloaked( false ); - %targetObject.reCloak = %targetObject.schedule( 500, "setCloaked", true ); + %targetObject.reCloak = %targetObject.schedule( 500, "setCloaked", true ); } - + playPain( %targetObject ); } - } + } }; function DMGame::sendGameVoteMenu(%game, %client, %key) { parent::sendGameVoteMenu( %game, %client, %key ); - + %isAdmin = ( %client.isAdmin || %client.isSuperAdmin ); - + if(!%client.canVote && !%isAdmin) return; - - if ( %game.scheduleVote $= "" ) + + if(%game.scheduleVote $= "") { - if(!%client.isAdmin) + if(!%isAdmin || (%isAdmin && %client.ForceVote)) { if(!$Host::DMSLOnlyMode) - messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'Enable SL Only Mode', 'Vote to enable Shocklance Only Mode' ); + messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'Enable Shocklance Only Mode', 'Vote to enable Shocklance Only Mode' ); else - messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'Disable SL Only Mode', 'Vote to disable Shocklance Only Mode' ); - } - else if (%client.ForceVote > 0) - { - if(!$Host::DMSLOnlyMode) - messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'Enable SL Only Mode', 'Vote to enable Shocklance Only Mode' ); - else - messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'Disable SL Only Mode', 'Vote to disable Shocklance Only Mode' ); + messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'Disable Shocklance Only Mode', 'Vote to disable Shocklance Only Mode' ); } else { if(!$Host::DMSLOnlyMode) - messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'Enable SL Only Mode', 'Enable Shocklance Only Mode' ); + messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'Enable Shocklance Only Mode', 'Enable Shocklance Only Mode' ); else - messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'Disable SL Only Mode', 'Disable Shocklance Only Mode' ); + messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'Disable Shocklance Only Mode', 'Disable Shocklance Only Mode' ); } } } @@ -869,7 +862,7 @@ function DMGame::evalVote(%game, %typeName, %admin, %arg1, %arg2, %arg3, %arg4) case "DMSLOnlyMode": %game.DMSLOnlyMode(%admin, %arg1, %arg2, %arg3, %arg4); } - + parent::evalVote(%game, %typeName, %admin, %arg1, %arg2, %arg3, %arg4); } @@ -884,17 +877,17 @@ function DMGame::DMSLOnlyMode(%game, %admin, %arg1, %arg2, %arg3, %arg4) if(%admin) { killeveryone(); - + if( $Host::DMSLOnlyMode ) { messageAll('MsgAdminForce', '\c2The Admin has disabled Shocklance Only Mode.'); - + $Host::DMSLOnlyMode = false; } else { messageAll('MsgAdminForce', '\c2The Admin has enabled Shocklance Only Mode.'); - + $Host::DMSLOnlyMode = true; } } @@ -904,17 +897,17 @@ function DMGame::DMSLOnlyMode(%game, %admin, %arg1, %arg2, %arg3, %arg4) if(%totalVotes > 0 && (%game.totalVotesFor / ClientGroup.getCount()) > ($Host::VotePasspercent / 100)) { killeveryone(); - + if( $Host::DMSLOnlyMode ) { messageAll('MsgVotePassed', '\c2Shocklance Only Mode Disabled.'); - + $Host::DMSLOnlyMode = false; } else { messageAll('MsgVotePassed', '\c2Shocklance Only Mode Enabled.'); - + $Host::DMSLOnlyMode = true; } } @@ -932,13 +925,13 @@ function killEveryone(%ignore, %message) else messageAll('msgKillEveryone', %message); - for(%i = 0; %i < ClientGroup.getCount(); %i++) + for(%i = 0; %i < ClientGroup.getCount(); %i++) { %target = ClientGroup.getObject(%i); - + if(!%target.player || %target.player == %ignore) continue; - + %target.player.blowup(); %target.player.scriptKill(); } diff --git a/Classic/scripts/LakRabbitGame.cs b/Classic/scripts/LakRabbitGame.cs index cf86eba..43be16b 100755 --- a/Classic/scripts/LakRabbitGame.cs +++ b/Classic/scripts/LakRabbitGame.cs @@ -40,7 +40,6 @@ // // v3.34 Febuary 2019 // Armor::damageObject rework -// Added SetNextMission support // Indoor Spawning support // // v3.33 January 2019 @@ -732,6 +731,7 @@ function Armor::damageObject(%data, %targetObject, %sourceObject, %position, %am } else if(%points >= 100) { + blastFireworks(); messageAll('', '~wfx/Misc/Flair.wav'); } @@ -1051,6 +1051,58 @@ function missileEveryone(%attacker) if(Game.duelMode && %attacker.holdingFlag) %attacker.client.duelSeconds += 15; } + +function blastFireworks(%deezFireworks) +{ + if(!ClientGroup.getCount()) + return; + + // find a random client. + %client = ClientGroup.getObject(getRandom(ClientGroup.getCount() - 1)); + + if(isObject(%client.player) && isObject(Game)) + { + %distance = Sky.visibleDistance; + if(!%distance || %distance > 250) + %distance = 250; + + %position = %client.player.position; + // Vary by half of the visible distance. + %neg = getRandom(0, 1) - 1; + %x = getWord(%position, 0) + ((%distance - getRandom(%distance / 2)) * %neg); + %neg = getRandom(0, 1) - 1; // Randomize it again. + %y = getWord(%position, 1) + ((%distance - getRandom(%distance / 2)) * %neg); + %z = getWord(%position, 2) + (%distance - getRandom(%distance / 2)); + + %random = getRandom(1, $fireworkDatablockCount); + deezFireworksExplode(%x SPC %y SPC %z, %random); + } + + if(%deezFireworks <= 10) + { + %deezFireworks = %deezFireworks + 1; + $deezFireworksSchedule = schedule(getRandom(700), 0, "blastFireworks", %deezFireworks); + } +} + +function deezFireworksExplode(%position, %id) +{ + %emitter = new ParticleEmissionDummy() + { + position = %position; + rotation = "1 0 0 0"; + scale = "1 1 1"; + datablock = "defaultEmissionDummy"; + emitter = "FireworksEmitter" @ %id; + velocity = "1"; + }; + + //echo(%emitter.position); + //serverPlay3d(dtFireworksSound, %emitter.position); + MissionCleanup.add(%emitter); + %emitter.schedule(1250, "delete"); +} + function killEveryone(%ignore, %message) { if(!%message) @@ -1119,42 +1171,20 @@ function LakRabbitGame::sendGameVoteMenu( %game, %client, %key ) if( %game.scheduleVote $= "" ) { - if(!%isAdmin) + if(!%isAdmin || (%isAdmin && %client.ForceVote)) { if(!Game.duelMode) messageClient( %client, 'MsgVoteItem', "", %key, 'VoteDuelMode', 'Enable Duel Mode', 'Vote to enable Duel Mode' ); else messageClient( %client, 'MsgVoteItem', "", %key, 'VoteDuelMode', 'Disable Duel Mode', 'Vote to disable Duel Mode' ); - if(!Game.noSplashDamage) messageClient( %client, 'MsgVoteItem', "", %key, 'VoteSplashDamage', 'Disable Splash Damage', 'Vote to disable Splash Damage' ); else messageClient( %client, 'MsgVoteItem', "", %key, 'VoteSplashDamage', 'Enable Splash Damage', 'Vote to enable Splash Damage' ); - // DeVast - PubPro votes - if(!Game.PubPro) - messageClient( %client, 'MsgVoteItem', "", %key, 'VotePro', 'Enable Pro Mode', 'Vote to enable Pro Mode' ); + if(!Game.PubPro) // DeVast - PubPro votes + messageClient( %client, 'MsgVoteItem', "", %key, 'VotePro', 'Enable Pro Mode (Disc, Blaster, Plasma Only)', 'Vote to enable Pro Mode (Disc, Blaster, Plasma Only)' ); else - messageClient( %client, 'MsgVoteItem', "", %key, 'VotePro', 'Disable Pro Mode', 'Vote to disable Pro Mode' ); - } - //Added so lak vote items are properly displayed in evo adminvotemenu - //A lot of changes were added to admin.ovl in evo - //see footnotes below - else if (%client.ForceVote > 0) - { - if(!Game.duelMode) - messageClient( %client, 'MsgVoteItem', "", %key, 'VoteDuelMode', 'Enable Duel Mode', 'Vote to enable Duel Mode' ); - else - messageClient( %client, 'MsgVoteItem', "", %key, 'VoteDuelMode', 'Disable Duel Mode', 'Vote to disable Duel Mode' ); - - if(!Game.noSplashDamage) - messageClient( %client, 'MsgVoteItem', "", %key, 'VoteSplashDamage', 'Disable Splash Damage', 'Vote to disable Splash Damage' ); - else - messageClient( %client, 'MsgVoteItem', "", %key, 'VoteSplashDamage', 'Enable Splash Damage', 'Vote to enable Splash Damage' ); - // DeVast - PubPro votes - if(!Game.PubPro) - messageClient( %client, 'MsgVoteItem', "", %key, 'VotePro', 'Enable Pro Mode', 'Vote to enable Pro Mode' ); - else - messageClient( %client, 'MsgVoteItem', "", %key, 'VotePro', 'Disable Pro Mode', 'Vote to disable Pro Mode' ); + messageClient( %client, 'MsgVoteItem', "", %key, 'VotePro', 'Disable Pro Mode (Disc, Blaster, Plasma Only)', 'Vote to disable Pro Mode (Disc, Blaster, Plasma Only)' ); } else { @@ -1162,16 +1192,14 @@ function LakRabbitGame::sendGameVoteMenu( %game, %client, %key ) messageClient( %client, 'MsgVoteItem', "", %key, 'VoteDuelMode', 'Enable Duel Mode', 'Enable Duel Mode' ); else messageClient( %client, 'MsgVoteItem', "", %key, 'VoteDuelMode', 'Disable Duel Mode', 'Disable Duel Mode' ); - if(!Game.noSplashDamage) messageClient( %client, 'MsgVoteItem', "", %key, 'VoteSplashDamage', 'Disable Splash Damage', 'Disable Splash Damage' ); else messageClient( %client, 'MsgVoteItem', "", %key, 'VoteSplashDamage', 'Enable Splash Damage', 'Enable Splash Damage' ); - // DeVast - PubPro votes - if(!Game.PubPro) - messageClient( %client, 'MsgVoteItem', "", %key, 'VotePro', 'Enable Pro Mode', 'Enable Pro Mode' ); + if(!Game.PubPro) // DeVast - PubPro votes + messageClient( %client, 'MsgVoteItem', "", %key, 'VotePro', 'Enable Pro Mode (Disc, Blaster, Plasma Only)', 'Enable Pro Mode (Disc, Blaster, Plasma Only)' ); else - messageClient( %client, 'MsgVoteItem', "", %key, 'VotePro', 'Disable Pro Mode', 'Disable Pro Mode' ); + messageClient( %client, 'MsgVoteItem', "", %key, 'VotePro', 'Disable Pro Mode (Disc, Blaster, Plasma Only)', 'Disable Pro Mode (Disc, Blaster, Plasma Only)' ); } } } @@ -2018,11 +2046,7 @@ function LakRabbitGame::gameOver(%game) //call the default DefaultGame::gameOver(%game); - //send the message - messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.gameover.wav" ); - cancel(%game.rabbitWaypointThread); - messageAll('MsgClearObjHud', ""); for(%i = 0; %i < ClientGroup.getCount(); %i++) { %client = ClientGroup.getObject(%i); @@ -2039,6 +2063,18 @@ function LakRabbitGame::gameOver(%game) %client.team = 0; %client.lastTeam = 0; + + if(!%client.isAIControlled()) + { + //This is not a great way to do this...but...everything will be correct in all clients menus if its a change to ctf... + messageAll('MsgClientDrop', "", %client.name, %client); + messageAll('MsgClientJoin', "",%client.name, %client, %client.target,%client.isAIControlled(),%client.isAdmin,%client.isSuperAdmin,%client.isSmurf,%client.sendGuid); + messageClient(%client, 'MsgClientJoinTeam', "", %client.name, %game.getTeamName(0), %client, %client.team ); + } + + //send the message + messageClient(%client, 'MsgGameOver', "Match has ended.~wvoice/announcer/ann.gameover.wav" ); + messageClient(%client, 'MsgClearObjHud', ""); } // ilys -- cancel waypoint if not showing flag icon diff --git a/Classic/scripts/SCtFGame.cs b/Classic/scripts/SCtFGame.cs index 31ff31f..dd2a50a 100755 --- a/Classic/scripts/SCtFGame.cs +++ b/Classic/scripts/SCtFGame.cs @@ -452,7 +452,7 @@ function SCtFGame::missionLoadDone(%game) %game.campThread_1 = schedule( 1000, 0, "checkVehicleCamping", 1 ); %game.campThread_2 = schedule( 1000, 0, "checkVehicleCamping", 2 ); - deleteNonSCtFObjectsFromMap(); + deleteNonSCtFObjects(); } function SCtFGame::clientMissionDropReady(%game, %client) @@ -495,7 +495,7 @@ function SCtFGame::equip(%game, %player) { %player.clearInventory(); %player.setInventory(Disc,1); - %player.setInventory(Blaster,1); + %player.setInventory(Shocklance,1); %player.setInventory(GrenadeLauncher,1); %player.setInventory(DiscAmmo, %player.getDataBlock().max[DiscAmmo]); %player.setInventory(GrenadeLauncherAmmo, %player.getDataBlock().max[GrenadeLauncherAmmo]); @@ -2214,33 +2214,26 @@ function SCtFGame::sendGameVoteMenu(%game, %client, %key) if(!%client.canVote && !%isAdmin) return; - if ( %game.scheduleVote $= "" ) + if(%game.scheduleVote $= "") { - if(!%client.isAdmin) - { - //messageClient( %client, 'MsgVoteItem', "", %key, 'VoteArmorClass', 'change the armor class to', 'Vote to change the Armor class' ); - //messageClient( %client, 'MsgVoteItem', "", %key, 'VoteAntiTurtleTime', 'change the anti turtle time to', 'Vote Anti-Turtle time' ); - if(!$Host::SCtFProMode) - messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'Enable Pro Mode', 'Vote to enable Pro Mode' ); - else - messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'Disable Pro Mode', 'Vote to disable Pro Mode' ); - } - else if (%client.ForceVote > 0) - { - if(!$Host::SCtFProMode) - messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'Enable Pro Mode', 'Vote to enable Pro Mode' ); - else - messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'Disable Pro Mode', 'Vote to disable Pro Mode' ); - } - else - { - if(!$Host::SCtFProMode) - messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'Enable Pro Mode', 'Enable Pro Mode' ); - else - messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'Disable Pro Mode', 'Disable Pro Mode' ); - } - //messageClient( %client, 'MsgVoteItem', "", %key, 'VoteArmorClass', 'change the armor class to', 'Change the Armor class' ); - //messageClient( %client, 'MsgVoteItem', "", %key, 'VoteAntiTurtleTime', 'change the anti turtle time to', 'Change Anti-Turtle time' ); + if(!%isAdmin || (%isAdmin && %client.ForceVote)) + { + //messageClient( %client, 'MsgVoteItem', "", %key, 'VoteArmorClass', 'change the armor class to', 'Vote to change the Armor class' ); + //messageClient( %client, 'MsgVoteItem', "", %key, 'VoteAntiTurtleTime', 'change the anti turtle time to', 'Vote Anti-Turtle time' ); + if(!$Host::SCtFProMode) + messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'Enable Pro Mode (Disc, SL, GL Only)', 'Vote to enable Pro Mode (Disc, SL, GL Only)' ); + else + messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'Disable Pro Mode (Disc, SL, GL Only)', 'Vote to disable Pro Mode (Disc, SL, GL Only)' ); + } + else + { + if(!$Host::SCtFProMode) + messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'Enable Pro Mode (Disc, SL, GL Only)', 'Enable Pro Mode (Disc, SL, GL Only)' ); + else + messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'Disable Pro Mode (Disc, SL, GL Only)', 'Disable Pro Mode (Disc, SL, GL Only)' ); + } + //messageClient( %client, 'MsgVoteItem', "", %key, 'VoteArmorClass', 'change the armor class to', 'Change the Armor class' ); + //messageClient( %client, 'MsgVoteItem', "", %key, 'VoteAntiTurtleTime', 'change the anti turtle time to', 'Change Anti-Turtle time' ); } } @@ -2457,97 +2450,27 @@ function SCtFGame::SCtFProMode(%game, %admin, %arg1, %arg2, %arg3, %arg4) // playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); // } - -//--------------------------------DeleteObjects Code------------------------------- //AutoRemove assets, sensors, and turrets from non-LT maps -// -function getGroupObjectByName(%group, %name) +function deleteNonSCtFObjects() { - %numObjects = %group.getCount(); + %c = 0; + InitContainerRadiusSearch("0 0 0", 9999, $TypeMasks::ItemObjectType | + $TypeMasks::TurretObjectType | $TypeMasks::VehicleObjectType | $TypeMasks::StaticShapeObjectType); //For FF: $TypeMasks::ForceFieldObjectType + while ((%obj = containerSearchNext()) != 0) + { + if(%obj.Datablock !$= "flag" && %obj.Datablock !$= "RepairKit" && %obj.Datablock !$= "RepairPatch") //Dont delete these... + { + %deleteList[%c] = %obj; + %c++; + } - for(%i = 0; %i < %numObjects; %i++) - { - if (%group.getObject(%i).getClassName() $= %name) - return %group.getObject(%i); - } -} - -function deleteObjectsFromMapByType(%type) -{ - %teamsGroup = getGroupObjectByName(MissionGroup, "Teams"); - if (!isObject(%teamsGroup)) - { - return; - } - - %team1Group = getGroupObjectByName(%teamsGroup, "Team1"); - if (!isObject(%team1Group)) - { - return; - } - - %team2Group = getGroupObjectByName(%teamsGroup, "Team2"); - if (!isObject(%team2Group)) - { - return; - } - - %team1Base0Group = getGroupObjectByName(%team1Group, "Base0"); - if (!isObject(%team1Base0Group)) - { - return; - } - - %team2Base0Group = getGroupObjectByName(%team2Group, "Base1"); - if (!isObject(%team2Base0Group)) - { - return; - } - - - deleteObjectsFromGroupByType(%team1Base0Group, %type); - deleteObjectsFromGroupByType(%team2Base0Group, %type); -} - -function deleteObjectsFromGroupByType(%group, %type) -{ - %noObjectsLeft = 0; - - while (%noObjectsLeft == 0) - { - %i = 0; - %noObjectsLeft = 1; - %loop = 1; - %numObjects = %group.getCount(); - - while ((%loop == 1) && (%i < %numObjects)) - { - %obj = %group.getObject(%i); - - if (%obj.getClassName() $= "SimGroup") - deleteObjectsFromGroupByType(%obj, %type); - - if (%obj.getClassName() $= %type) - { - %obj.delete(); - %loop = 0; - %noObjectsLeft = 0; - } - else - %i++; - } - } -} - -function deleteNonSCtFObjectsFromMap() -{ - deleteObjectsFromGroupByType(MissionGroup, "Turret"); - deleteObjectsFromGroupByType(MissionGroup, "StaticShape"); - deleteObjectsFromGroupByType(MissionGroup, "FlyingVehicle"); - deleteObjectsFromGroupByType(MissionGroup, "WheeledVehicle"); - deleteObjectsFromGroupByType(MissionGroup, "HoverVehicle"); - deleteObjectsFromGroupByType(MissionGroup, "Waypoint"); - //deleteObjectsFromGroupByType(MissionGroup, "ForceFieldBare"); - //deleteObjectsFromGroupByType(MissionGroup, "Item"); -} + } + for(%i = 0; %i < %c; %i++) + { + %deleteList[%i].delete(); + } + //Delete all ForceField PhysicalZones (PZones) + // if(isObject(PZones)) + // PZones.schedule(1500,"delete"); +} \ No newline at end of file diff --git a/Classic/scripts/autoexec/MemPatches.cs b/Classic/scripts/autoexec/MemPatches.cs index 833db4d..14db81c 100644 --- a/Classic/scripts/autoexec/MemPatches.cs +++ b/Classic/scripts/autoexec/MemPatches.cs @@ -52,3 +52,6 @@ function serverCmd(%client) //Disable UE box on crash //Used if a clean crash is desired //memPatch("7dc7fc","90"); + +//Show Linux Icon in server list +//memPatch("5C9628","80CB05"); diff --git a/Classic/scripts/autoexec/MissionTypeOptions.cs b/Classic/scripts/autoexec/MissionTypeOptions.cs index baf682e..3bc6731 100644 --- a/Classic/scripts/autoexec/MissionTypeOptions.cs +++ b/Classic/scripts/autoexec/MissionTypeOptions.cs @@ -28,47 +28,54 @@ function loadMissionStage2() { if($Host::TournamentMode && $Host::PUGautoPassword) $Host::Password = $Host::PUGPassword; - else if(!$Host::TournamentMode) - { - if($Host::Password) - $Host::Password = ""; - if($LockedTeams) - $LockedTeams = 0; - } //Set server mode to SPEED - $Host::HiVisibility = "0"; + $Host::HiVisibility = 0; } else if($CurrentMissionType $= "LakRabbit") { - if($Host::Password) - $Host::Password = ""; - if($LockedTeams) - $LockedTeams = 0; if($Host::TournamentMode) $Host::TournamentMode = 0; //Set server mode to DISTANCE - $Host::HiVisibility = "1"; + $Host::HiVisibility = 1; } case 1: $Host::Password = $Host::PUGPassword; - $Host::HiVisibility = "0"; //always SPEED + $Host::HiVisibility = 0; //always SPEED } + if($Host::TournamentMode) + $Host::TimeLimit = 30; //TimeLimit Always 30 minutes in Tourney Mode + else + { + //Disable everything + if($Host::Password !$= "") + $Host::Password = ""; + if($LockedTeams) + $LockedTeams = 0; + if($RestrictedVoting) + $RestrictedVoting = 0; + if($Host::AllowAdmin2Admin) + $Host::AllowAdmin2Admin = 0; + } + if(isActivePackage(LockedTeams) && !$LockedTeams) + deactivatePackage(LockedTeams); + //Siege NoBaseRape Fix if($CurrentMissionType $= "Siege") $Host::NoBaseRapeEnabled = 0; else $Host::NoBaseRapeEnabled = 1; - if(isActivePackage(LockedTeams) && !$LockedTeams) - deactivatePackage(LockedTeams); - parent::loadMissionStage2(); + //Map Change Center Print. Used to advertise upcoming events if($Host::MapChangeMSG) centerPrintAll($Host::MapChangeMSGContent, 12, 3); + + //Set random seed + setRandomSeed(getrandom(1,200000)); } }; diff --git a/Classic/scripts/autoexec/ObserveFlag.cs b/Classic/scripts/autoexec/ObserveFlag.cs index 76bcf55..5ac0c19 100644 --- a/Classic/scripts/autoexec/ObserveFlag.cs +++ b/Classic/scripts/autoexec/ObserveFlag.cs @@ -53,7 +53,7 @@ function Observer::onTrigger(%data, %obj, %trigger, %state) } else return; - + // the flag isn't carried if(%otherFlag.carrier $= "") observeFlag(%client, %otherFlag, 1, %otherFlagTeam); @@ -121,7 +121,15 @@ function Observer::setMode(%data, %obj, %mode, %targetObj) default: Parent::setMode(%data, %obj, %mode, %targetObj); } - %obj.mode = %mode; + %obj.mode = %mode; +} + +function serverCmdObserveClient(%client, %target) +{ + %client.observeFlyClient = ""; + %client.observingFlag = false; + + parent::serverCmdObserveClient(%client, %target); } }; @@ -134,14 +142,14 @@ function serverCmdObserveFirstFlag(%client) { if(Game.class !$= CTFGame && Game.class !$= SCtFGame) return; - + // client must be an observer if(%client.team > 0 || !$Observers) //$Observers added; Serverside var; Needs to have value to work correctly return; - + // check if the flag is carried by someone %player = $TeamFlag[1].carrier; - + if($TeamFlag[1].isHome || %player $= "") observeFlag(%client, $TeamFlag[1], 1, 1); else @@ -152,14 +160,14 @@ function serverCmdObserveSecondFlag(%client) { if(Game.class !$= CTFGame && Game.class !$= SCtFGame) return; - + // client must be an observer if(%client.team > 0 || !$Observers) //$Observers added; Serverside var; Needs to have value to work correctly return; - + // check if the flag is carried by someone %player = $TeamFlag[2].carrier; - + if($TeamFlag[2].isHome || %player $= "") observeFlag(%client, $TeamFlag[2], 1, 2); else @@ -173,27 +181,27 @@ function observeFlag(%client, %target, %type, %flagTeam) { if(!isObject(%client) || !isObject(%target) || !isObject(%client.camera)) return; - + if(Game.class !$= CTFGame && Game.class !$= SCtFGame) return; - + if(%client.team > 0) return; - + // cancel any scheduled update if(isEventPending(%client.obsHudSchedule)) cancel(%client.obsHudSchedule); - + // must be an observer when observing other clients if(%client.getControlObject() != %client.camera) return; - + //can't observer yourself if(%client == %target) return; - + %count = ClientGroup.getCount(); - + //can't go into observer mode if you're the only client if(%count <= 1 && %type != 1) return; @@ -202,18 +210,18 @@ function observeFlag(%client, %target, %type, %flagTeam) { if(isObject(%client.player)) %client.player.scriptKill(0); // the player is still playing (this shouldn't be happen) - + %client.camera.getDataBlock().setMode(%client.camera, "followFlag", $TeamFlag[%flagTeam]); %client.setControlObject(%client.camera); clearBottomPrint(%client); - + // was the client observing a player before? if(%client.observeClient != -1) - { - observerFollowUpdate(%client, -1, false); - messageClient(%client.observeClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name); - %client.observeClient = -1; - } + { + observerFollowUpdate(%client, -1, false); + messageClient(%client.observeClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name); + %client.observeClient = -1; + } } else // Player { @@ -232,22 +240,23 @@ function observeFlag(%client, %target, %type, %flagTeam) if(!%found) return; } - + if(isObject(%client.player)) %client.player.scriptKill(0); // the player is still playing (this shouldn't be happen) - + observerFollowUpdate(%client, %target, true); displayObserverHud(%client, %target); messageClient(%target, 'Observer', '\c1%1 is now observing you.', %client.name); // was the client observing a player before? if(%client.observeClient != -1) - messageClient(%client.observeClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name); + messageClient(%client.observeClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name); + %client.camera.getDataBlock().setMode(%client.camera, "observerFollow", %target.player); %client.setControlObject(%client.camera); %client.observeClient = %target; } - + //clear the observer fly mode var... %client.observeFlyClient = -1; %client.observingFlag = true; diff --git a/Classic/scripts/autoexec/ObserverCooldown.cs b/Classic/scripts/autoexec/ObserverCooldown.cs index ac0b407..a0e071d 100644 --- a/Classic/scripts/autoexec/ObserverCooldown.cs +++ b/Classic/scripts/autoexec/ObserverCooldown.cs @@ -7,25 +7,27 @@ package ObserverTimeout { -function serverCmdClientMakeObserver( %client ) +function serverCmdClientMakeObserver(%client) { - //10 second cooldown on becoming an observer + //10 second cooldown on becoming an observer %timeDif = getSimTime() - %client.observerTimeout; %timeDif1 = getSimTime() - %client.observerMsg; if(%timeDif > 10000 || !%client.observerTimeout || %client.isAdmin) { - if ( isObject( Game ) && Game.kickClient != %client ) - Game.forceObserver( %client, "playerChoose" ); - %client.observerProtectStart = getSimTime(); %client.observerTimeout = getSimTime(); + + if (isObject(Game) && Game.kickClient != %client) + Game.forceObserver(%client, "playerChoose"); + if($Host::TournamentMode) //Added to clear FIRE centerPrint + ClearCenterPrint(%client); } //1 second cooldown on message else if((%timeDif1 > 1000 || !%client.observerMsg)) { %wait = mFloor((10000 - (getSimTime() - %client.observerProtectStart)) / 1000); messageClient(%client, 'MsgObserverCooldown', '\c3Observer Cooldown:\cr Please wait another %1 seconds.', %wait ); - + %client.observerMsg = getSimTime(); } } diff --git a/Classic/scripts/autoexec/TKwarn.cs b/Classic/scripts/autoexec/TKwarn.cs index d53b5a3..67ba339 100755 --- a/Classic/scripts/autoexec/TKwarn.cs +++ b/Classic/scripts/autoexec/TKwarn.cs @@ -5,17 +5,17 @@ package TKwarn // From Evo function DefaultGame::testTeamKill(%game, %victimID, %killerID, %damageType) -{ +{ if(!$countdownStarted && !$MatchStarted) return; - + %tk = Parent::testTeamKill(%game, %victimID, %killerID); - if(!%tk) + if(!%tk) return false; // is not a tk // No Bots //if(%killerID.isAIcontrolled() || %victimID.isAIcontrolled()) - // return true; + //return true; // Log TeamKill teamkillLog(%victimID, %killerID, %damageType); @@ -23,7 +23,7 @@ function DefaultGame::testTeamKill(%game, %victimID, %killerID, %damageType) //No warnings in tournament mode if($Host::TournamentMode) return true; - + // No Admins if(%killerID.isAdmin) return true; @@ -31,7 +31,7 @@ function DefaultGame::testTeamKill(%game, %victimID, %killerID, %damageType) // Ignore this map if($CurrentMission $= "Mac_FlagArena" || $CurrentMission $= "Machineeggs") return true; - + // warn the player of the imminent kick vote if((%killerID.teamkills == $Host::TKWarn1 - 1) && $Host::TKWarn1 != 0) centerprint(%killerID, "You are receiving this warning for inappropriate teamkilling.\nBehave or a vote to kick will be started.", 10, 2); @@ -61,7 +61,7 @@ if (!isActivePackage(TKwarn)) function TKkick( %client, %admin, %guid ) { messageAll( 'MsgAdminForce', '\c2%1 has been autokicked for teamkilling.', %client.name ); // z0dd - ZOD, 7/13/03. Tell who kicked - + messageClient(%client, 'onClientKicked', ""); messageAllExcept( %client, -1, 'MsgClientDrop', "", Game.kickClientName, %client ); @@ -87,12 +87,12 @@ function TKkick( %client, %admin, %guid ) %cl = ClientGroup.getObject( %i ); if( %cl.guid == %guid ) { - %found = true; + %found = true; // kill and delete this client, their done in this server. if( isObject( %cl.player ) ) %cl.player.scriptKill(0); - + if ( isObject( %cl ) ) { %client.setDisconnectReason( "You have been kicked out of the game for teamkilling." ); // z0dd - ZOD, 7/13/03. Tell who kicked @@ -100,17 +100,17 @@ function TKkick( %client, %admin, %guid ) } // ban by IP as well BanList::add( %guid, %client.getAddress(), $Host::KickBanTime ); - } + } } if( !%found ) - BanList::add( %guid, "0", $Host::KickBanTime ); // keep this guy out for a while since he left. + BanList::add( %guid, "0", $Host::KickBanTime ); // keep this guy out for a while since he left. } else // lan games { // kill and delete this client if( isObject( %client.player ) ) %client.player.scriptKill(0); - + if ( isObject( %client ) ) { %client.setDisconnectReason( "You have been kicked out of the game for teamkilling." ); @@ -124,7 +124,7 @@ function TKkick( %client, %admin, %guid ) // From Evo // Info: Auto start a new vote function TKvote(%typeName, %arg1, %arg2, %arg3, %arg4) -{ +{ // works only for kicking players if(%typeName !$= "VoteKickPlayer") return; @@ -132,38 +132,78 @@ function TKvote(%typeName, %arg1, %arg2, %arg3, %arg4) // only works for FFA mode if($Host::TournamentMode) return; - - // a vote is already running, cancel it - if(Game.scheduleVote !$= "") - stopCurrentVote(); - - %clientsVoting = 0; - + // admins can't be kicked if(%arg1.isAdmin) return; - + + //Stop current votes + if(Game.scheduleVote !$= "") + { + //Added for vote overtime + //Dont stop if under 90 secs left + %curTimeLeftMS = ($Host::TimeLimit * 60 * 1000) + $missionStartTime - getSimTime(); + if(%curTimeLeftMS <= 90000) + { + //log it + $tkvoteLog = formatTimeString("M-d") SPC formatTimeString("[hh:nn:a]") SPC "[Autovote Cancelled]" SPC %arg1.nameBase @ "(" @ %arg1.guid @ ")" SPC "Teamkill Autovote cancelled due insufficient time. #P[" @ $HostGamePlayerCount @ "]" SPC "CM[" @ $CurrentMission @ "]"; + if($Host::ClassicTeamKillLog) + { + %logpath = $Host::ClassicTeamKillLogPath; + export("$tkvoteLog", %logpath, true); + logEcho($tkvoteLog); + } + echo($tkvoteLog); + return; + } + else //Stop any current votes + { + //Notify clients the vote is being cancelled + for(%i = 0; %i < %count; %i++) + { + %cl = ClientGroup.getObject(%i); + if(%cl !$= %arg1) //dont notify the team killer + messageClient(%cl, 'VoteStarted', '\c2Vote has been cancelled due to teamkill autovote.'); + } + stopCurrentVote(); + } + } + + //notify any admins on the other team + for(%i = 0; %i < ClientGroup.getCount(); %i++) + { + %cl = ClientGroup.getObject(%i); + if (%cl.isAdmin == true) + { + if(%cl.team !$= %arg1.team) //Not on admins team + messageClient(%cl, '', '\c5[A]\c1%1 \c0Teamkill Autovote started to kick %2 on the other team.~wgui/objective_notification.wav', "Vote in Progress:", %arg1.nameBase); + } + } + echo(formatTimeString("M-d") SPC formatTimeString("[hh:nn:a]") SPC "Teamkill Autovote started for..." SPC %arg1.nameBase @ "(" @ %arg1.guid @ ")" SPC "#P[" @ $HostGamePlayerCount @ "]" SPC "CM[" @ $CurrentMission @ "]"); + + %clientsVoting = 0; + Game.kickClient = %arg1; Game.kickClientName = %arg1.name; Game.kickGuid = %arg1.guid; Game.kickTeam = %arg1.team; - + %count = ClientGroup.getCount(); for(%i = 0; %i < %count; %i++) { %cl = ClientGroup.getObject(%i); if(%cl.team == %arg1.team && !%cl.isAIControlled() && %cl !$= %arg1) - { + { messageClient(%cl, 'VoteStarted', '\c2Vote initiated to kick the teamkiller %1 with %2 teamkills.', %arg1.name, $Host::TKWarn2); %clientsVoting++; } } - + for(%i = 0; %i < %count; %i++) { %cl = ClientGroup.getObject(%i); if(%cl.team == %arg1.team && !%cl.isAIControlled() && %cl !$= %arg1) - messageClient(%cl, 'openVoteHud', "", %clientsVoting, ($Host::VotePassPercent / 100)); + messageClient(%cl, 'openVoteHud', "", %clientsVoting, ($Host::VotePassPercent / 100)); } clearVotes(); diff --git a/Classic/scripts/autoexec/TacoOverrides.cs b/Classic/scripts/autoexec/TacoOverrides.cs index a2d85c8..694b1a7 100755 --- a/Classic/scripts/autoexec/TacoOverrides.cs +++ b/Classic/scripts/autoexec/TacoOverrides.cs @@ -155,7 +155,7 @@ function stationTrigger::onEnterTrigger(%data, %obj, %colObj) function Armor::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType, %momVec, %mineSC) { //Takes 11 blaster shots to kill a heavy, 13 normal. - if(%targetObject.client.armor $= "Heavy" && %damageType $= $DamageType::Blaster) + if(%targetObject.client.armor $= "Heavy" && %damageType $= $DamageType::Blaster && !$Host::TournamentMode) //Free-for-all only %amount *= 1.15; Parent::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType, %momVec, %mineSC); @@ -298,6 +298,42 @@ function ConcussionGrenadeThrown::onThrow(%this, %gren) %gren.detThread = schedule(1800, %gren, "detonateGrenade", %gren); // Was 2000 } +//Attack LOS Sky Fix +function serverCmdSendTaskToClient(%client, %targetClient, %fromCmdMap) +{ + %obj = getTargetObject(%client.getTargetId()); + if(isObject(%obj)) + { + if(%obj.getClassName() $= "Player" && !%client.player.ccActive) + { + %vec = %client.player.getMuzzleVector(0); + %vec2 = vectorNormalize(vectorSub(%obj.getWorldBoxCenter(), %client.player.getMuzzlePoint(%slot))); + %dot = vectorDot(%vec, %vec2); + if(%dot < 0.9) + return; + } + } + + parent::serverCmdSendTaskToClient(%client, %targetClient, %fromCmdMap); +} + +function serverCmdScopeCommanderMap(%client, %scope) +{ + parent::serverCmdScopeCommanderMap(%client, %scope); + %client.player.ccActive = %scope; +} + +//Mortar Throw Reload Fix +function ShapeBase::throwWeapon(%this) +{ + if((%this.getMountedImage($WeaponSlot).getName() $= "MortarImage" || %this.getMountedImage($WeaponSlot).getName() $= "MissileLauncherImage" || %this.getMountedImage($WeaponSlot).getName() $= "ShockLanceImage") && + (%this.getImageState($WeaponSlot) $= "Reload" || %this.getImageState($WeaponSlot) $= "Fire")){ + return; + } + + parent::throwWeapon(%this); +} + }; // Prevent package from being activated if it is already diff --git a/Classic/scripts/autoexec/TeamManagement.cs b/Classic/scripts/autoexec/TeamManagement.cs index df67a8f..ae72f77 100644 --- a/Classic/scripts/autoexec/TeamManagement.cs +++ b/Classic/scripts/autoexec/TeamManagement.cs @@ -24,7 +24,7 @@ function CreateServer( %mission, %missionType ) //Call for a GetTeamCount update GetTeamCounts(%game); - // Prevent package from being activated if it is already + //Prevent package from being activated if it is already if (!isActivePackage(TeamCountsTriggers)) activatePackage(TeamCountsTriggers); } @@ -55,12 +55,15 @@ function GetTeamCounts(%game) if( !$Host::TournamentMode ) { - if( $CurrentMissionType $= "CTF" ) + if($CurrentMissionType $= "CTF") { NBRStatusNotify(%game); CheckAntiPack(%game); } - TeamBalanceNotify(%game); + else if($CurrentMissionType $= "DM") + CheckAntiPack(%game); + + TeamBalanceNotify(%game); //Has check for # teams } //Set so counter wont run when it doesnt need to. @@ -172,6 +175,9 @@ function GameConnection::onDrop(%client, %reason) // Called in GetTeamCounts function TeamBalanceNotify(%game) { + if(!$Host::EnableTeamBalanceNotify && !$Host::EnableAutobalance) + return; + if( Game.numTeams > 1 && $TotalTeamPlayerCount !$= 0 ) { //Uneven @@ -225,6 +231,9 @@ function NotifyUnbalanced( %game ) if(isEventPending($NotifySchedule)) cancel($NotifySchedule); + if(!$Host::EnableTeamBalanceNotify && !$Host::EnableAutobalance) + return; + if( $TBNStatus !$= "NOTIFY" ) //If Status has changed to EVEN or anything else (GameOver reset). return; @@ -357,6 +366,9 @@ function Autobalance( %game ) if(isEventPending($AutoBalanceSchedule)) cancel($AutoBalanceSchedule); + if(!$Host::EnableAutobalance) + return; + if($TBNStatus !$= "NOTIFY") //If Status has changed to EVEN or anything else (GameOver reset). return; diff --git a/Classic/scripts/autoexec/VoteMenu.cs b/Classic/scripts/autoexec/VoteMenu.cs index 7bf3357..08fb656 100644 --- a/Classic/scripts/autoexec/VoteMenu.cs +++ b/Classic/scripts/autoexec/VoteMenu.cs @@ -9,7 +9,7 @@ //$Host::AllowPlayerVoteTimeLimit = 1; //$Host::AllowPlayerVoteTournamentMode = 1; //$Host::AllowPlayerVoteTeamDamage = 0; -//$Host::AllowPlayerTournamentModeVotekick = 0; +//$Host::AllowPlayerVoteNextMission = 1; //Vote Delay //Delay the ability to vote (For everyone) at the beginning of the match @@ -26,15 +26,10 @@ function DefaultGame::evalVote(%game, %typeName, %admin, %arg1, %arg2, %arg3, %a { switch$ (%typeName) { - case "cancelMatchStart": + case "cancelMatchStart": %game.cancelMatchStart(%admin, %arg1, %arg2, %arg3, %arg4); - - case "passRunningVote": - %game.passRunningVote(%admin, %arg1, %arg2, %arg3, %arg4); - - case "stopRunningVote": - %game.stopRunningVote(%admin, %arg1, %arg2, %arg3, %arg4); - + case "VoteNextMission": + %game.setNextMission(%admin, %arg1, %arg2, %arg3, %arg4); default: Parent::evalVote(%game, %typeName, %admin, %arg1, %arg2, %arg3, %arg4); } @@ -42,202 +37,231 @@ function DefaultGame::evalVote(%game, %typeName, %admin, %arg1, %arg2, %arg3, %a function DefaultGame::sendGameVoteMenu(%game, %client, %key) { - %isAdmin = (%client.isAdmin || %client.isSuperAdmin); - %multipleTeams = %game.numTeams > 1; + %isAdmin = (%client.isAdmin || %client.isSuperAdmin); + %multipleTeams = %game.numTeams > 1; + %client.k = %key; //For set next mission - // ******************************************** - // Admin Vote For ... Submenu - // ******************************************** - if (!$Host::TournamentMode) - { - if (%client.ForceVote > 0) - %client.ForceVote = %client.ForceVote - 1; + if (%client.ForceVote > 0) + %client.ForceVote = %client.ForceVote - 1; - if (%client.ForceVote > 0) - { - 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, 'VoteChangeTimeLimit', 'change the time limit', 'Vote to Change the Time Limit'); - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteSkipMission', 'skip the mission to', 'Vote to Skip Mission' ); + //Admin Submenu + if (%client.ForceVote > 0) + { + 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(%multipleTeams) + { + if($teamDamage) + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'disable team damage', 'Vote to Disable Team Damage'); + else + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'enable team damage', 'Vote to Enable Team Damage'); + } + messageClient(%client, 'MsgVoteItem',"", %key, 'ForceVote', 'Cancel Force Vote', "Cancel 'Vote To...'"); + return; + } - if(%multipleTeams) - { - if($teamDamage) - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'disable team damage', 'Vote to Disable Team Damage'); - else - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'enable team damage', 'Vote to Enable Team Damage'); - } + //Pass Stop Menu + if(%client.isAdmin && %game.scheduleVote !$= "") + { + if(%client.isSuperAdmin || (%client.isAdmin && $Host::AllowAdminStopVote)) // allow admins to stop votes + messageClient( %client, 'MsgVoteItem', "", %key, 'stopRunningVote', 'stop current vote', 'Stop the Vote'); + if(%client.isSuperAdmin || (%client.isAdmin && $Host::AllowAdminPassVote)) // allow admins to pass votes + messageClient( %client, 'MsgVoteItem', "", %key, 'passRunningVote', 'pass current vote', 'Pass the Vote'); + return; + } - messageClient(%client, 'MsgVoteItem',"", %key, 'ForceVote', 'Cancel Force Vote', "Cancel 'Vote To...'"); - return; // Display no further vote options - } - } - - //Mission Info Header - Mission Name, Type, Caps to Win - if(%client.canVote) - { - switch$($CurrentMissionType) - { + //Mission Info Header - Mission Name, Type, Caps to Win + if(%client.canVote && %game.scheduleVote $= "") + { + switch$($CurrentMissionType) + { case CTF or SCtF: - 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"); - case LakRabbit: - %cap = "2000 Points to Win"; - messageClient(%client, 'MsgVoteItem', "", %key, '', $MissionDisplayName SPC "(" @ $MissionTypeDisplayName @ "):" SPC %cap, - $MissionDisplayName SPC "(" @ $MissionTypeDisplayName @ "):" SPC %cap); - case DM: - %cap = "25 Points to Win"; - messageClient(%client, 'MsgVoteItem', "", %key, '', $MissionDisplayName SPC "(" @ $MissionTypeDisplayName @ "):" SPC %cap, - $MissionDisplayName SPC "(" @ $MissionTypeDisplayName @ "):" SPC %cap); - } - } + if($Host::TournamentMode) + %showTL = " - Time Limit:" SPC $Host::TimeLimit SPC "Minutes"; + if($voteNext) + %showNM = " - Next Map:" SPC $HostMissionName[$voteNextMap] SPC "(" @ $HostTypeName[$voteNextType] @ ")"; + 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); + case DM: + %cap = "25 Points to Win"; + messageClient(%client, 'MsgVoteItem', "", %key, '', $MissionDisplayName SPC "(" @ $MissionTypeDisplayName @ "):" SPC %cap, + $MissionDisplayName SPC "(" @ $MissionTypeDisplayName @ "):" SPC %cap); + } + } - // TEAM OPTIONS - if(!$Host::TournamentMode) - { - if(%client.team != 0) // he isn't an observer - { - if(%multipleTeams) - messageClient(%client, 'MsgVoteItem', "", %key, 'ChooseTeam', "", 'Change your Team'); + // TEAM OPTIONS + if(%client.team != 0) //he isn't an observer + { + if(!%client.isAdmin && !$Host::TournamentMode) + { + if(%multipleTeams) + messageClient(%client, 'MsgVoteItem', "", %key, 'ChooseTeam', "", 'Change your Team'); + if($MatchStarted) + messageClient(%client, 'MsgVoteItem', "", %key, 'MakeObserver', "", 'Become an Observer'); + } + else if(%client.isAdmin) //only admins can change team during tournament mode + { + if(%multipleTeams) + messageClient(%client, 'MsgVoteItem', "", %key, 'ChooseTeam', "", 'Change your Team'); + messageClient(%client, 'MsgVoteItem', "", %key, 'MakeObserver', "", 'Become an Observer'); + } + } - if($MatchStarted) - messageClient(%client, 'MsgVoteItem', "", %key, 'MakeObserver', "", 'Become an Observer'); - } - } - else if(%client.isAdmin) // only admins can change team during tournament mode - { - if(%client.team != 0) // he isn't an observer - { - if(%multipleTeams) - messageClient(%client, 'MsgVoteItem', "", %key, 'ChooseTeam', "", 'Change your Team'); + //Beginning match Vote Delay + if(!%client.isAdmin && (getSimTime() - $VoteDelay) < ($Host::VoteDelayTime * 1000)) + return; - messageClient(%client, 'MsgVoteItem', "", %key, 'MakeObserver', "", 'Become an Observer'); - } - } + if(!%client.canVote && !%isAdmin) + return; - //Beginning match Vote Delay - if(!%client.isAdmin) - { - if((getSimTime() - $VoteDelay) < ($Host::VoteDelayTime * 1000)) - return; - } + //Standard Vote Options + if(%game.scheduleVote $= "") + { + //Start Match + if(!$MatchStarted && !$CountdownStarted && $Host::TournamentMode) + { + if(!%client.isAdmin) + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteMatchStart', 'Start Match', 'Vote to Start the Match'); + else + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteMatchStart', 'Start Match', 'Start Match'); + } + //Cancel Match Start + if(!$MatchStarted && $CountdownStarted && $Host::TournamentMode && %client.isAdmin) + messageClient(%client, 'MsgVoteItem', "", %key, 'cancelMatchStart', 'Cancel Match Start', 'Cancel Match Start'); + //Vote Free For All Mode + if($Host::TournamentMode) + { + if(!%client.isAdmin) + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteFFAMode', 'Change server to Free For All.', 'Vote Free For All Mode'); + else + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteFFAMode', 'Change server to Free For All.', 'Change FFA Mode'); + } + //Vote Tournament Mode + if(!$Host::TournamentMode) + { + if(!%client.isAdmin) + { + if($Host::AllowPlayerVoteTournamentMode && !$RestrictedVoting) + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTournamentMode', 'Change server to Tournament.', 'Vote Tournament Mode'); + } + else + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTournamentMode', 'Change server to Tournament.', 'Tournament Mode'); + } + //Vote Change Mission + if(!%client.isAdmin) + { + if($Host::AllowPlayerVoteChangeMission && !$RestrictedVoting) + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Vote to Change the Mission'); + } + else + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Change the Mission'); + //Vote Change Next Mission + if(!%client.isAdmin) + { + if($Host::AllowPlayerVoteNextMission && !$RestrictedVoting) + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteNextMission', 'set next mission to', 'Vote to Set the Next Mission'); + } + else + { + if(!$voteNext) + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteNextMission', 'set next mission to', 'Set the Next Mission'); + else + messageClient(%client, 'MsgVoteItem', "", %key, 'ClearNextMap', 'Clear Next Set Map', 'Clear Next Set Map'); + } + //Vote Change Time + if(!%client.isAdmin) + { + if($Host::AllowPlayerVoteTimeLimit && !$RestrictedVoting) + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Vote to Change the Time Limit'); + } + else + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Change the Time Limit'); + //Vote Skip Mission + if(!%client.isAdmin) + { + if($Host::AllowPlayerVoteSkipMission && !$RestrictedVoting) + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteSkipMission', 'skip the mission to', 'Vote to Skip Mission' ); + } + else + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteSkipMission', 'skip the mission to', 'Skip the Mission' ); + //Admin Vote Menu + if(%client.isAdmin && $Host::AllowAdminVotes) + messageClient(%client, 'MsgVoteItem', "", %key, 'ForceVote', 'Vote to ...', 'Vote to ...'); + //PUG Password + if(%client.isAdmin && $Host::TournamentMode) + { + if($Host::Password !$= "") + messageClient(%client, 'MsgVoteItem', "", %key, 'TogglePUGpassword', 'Disable PUG Password', 'Disable PUG Password'); + else + messageClient(%client, 'MsgVoteItem', "", %key, 'TogglePUGpassword', 'Enable PUG Password', 'Enable PUG Password'); + } + //Locked Teams + if(%client.isAdmin && $Host::TournamentMode) + { + if($LockedTeams) + messageClient(%client, 'MsgVoteItem', "", %key, 'ToggleLockedTeams', 'Disable Locked Teams', 'Disable Locked Teams'); + else + messageClient(%client, 'MsgVoteItem', "", %key, 'ToggleLockedTeams', 'Enable Locked Teams', 'Enable Locked Teams'); + } + //Restricted Voting + if(%client.isAdmin && $Host::TournamentMode) + { + if($RestrictedVoting) + messageClient(%client, 'MsgVoteItem', "", %key, 'ToggleRestrictedVoting', 'Disable Restricted Voting', 'Disable Restricted Voting'); + else + messageClient(%client, 'MsgVoteItem', "", %key, 'ToggleRestrictedVoting', 'Enable Restricted Voting', 'Enable Restricted Voting'); + } + //Vote Team Damage + if(%multipleTeams) + { + if(!%client.isAdmin) + { + if($Host::AllowPlayerVoteTeamDamage && !$RestrictedVoting) + { + if($teamDamage) + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'disable team damage', 'Vote to Disable Team Damage'); + else + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'enable team damage', 'Vote to Enable Team Damage'); + } + } + else + { + if($teamDamage) + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'disable team damage', 'Disable Team Damage'); + else + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'enable team damage', 'Enable Team Damage'); + } + } - if(!%client.canVote && !%isAdmin) - return; + //Super Admin Only + if(%client.isSuperAdmin) + { + if($Host::AllowAdmin2Admin) //Toggle Admin2Admin + messageClient( %client, 'MsgVoteItem', "", %key, 'Admins2Admin', 'Disable Admins to Admin', "Disable Admins to Admin" ); + else + messageClient( %client, 'MsgVoteItem', "", %key, 'Admins2Admin', 'Enable Admins to Admin', "Enable Admins to Admin" ); + } + //Disabled for now + // if(%client.isSuperAdmin) + // { + // if($Host::EnableNetTourneyClient) //Toggle Tournament Net Client + // messageClient( %client, 'MsgVoteItem', "", %key, 'ToggleTourneyNetClient', 'Disable Tournament Net Client', "Disable Tournament Net Client" ); + // else + // messageClient( %client, 'MsgVoteItem', "", %key, 'ToggleTourneyNetClient', 'Enable Tournament Net Client', "Enable Tournament Net Client" ); + // } - if(%game.scheduleVote $= "") - { - if(!%client.isAdmin) - { - if(!$Host::TournamentMode) - { - if($Host::AllowPlayerVoteChangeMission) - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Vote to Change the Mission'); - if($Host::AllowPlayerVoteTournamentMode) - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTournamentMode', 'Change server to Tournament.', 'Vote Tournament Mode'); - if($Host::AllowPlayerVoteTimeLimit) - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Vote to Change the Time Limit'); - if($Host::AllowPlayerVoteSkipMission) - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteSkipMission', 'skip the mission to', 'Vote to Skip Mission' ); - - if(%multipleTeams && $Host::AllowPlayerVoteTeamDamage) - { - if($teamDamage) - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'disable team damage', 'Vote to Disable Team Damage'); - else - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'enable team damage', 'Vote to Enable Team Damage'); - } - } - else - { - if(!$MatchStarted && !$CountdownStarted) - 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, 'VoteFFAMode', 'Change server to Free For All.', 'Vote Free For All Mode'); - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Vote to Change the Time Limit'); - - if(%multipleTeams && $Host::AllowPlayerVoteTeamDamage) - { - if($teamDamage) - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'disable team damage', 'Vote to Disable Team Damage'); - else - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'enable team damage', 'Vote to Enable Team Damage'); - } - } - } - else - { - if(!$Host::TournamentMode) - { - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTournamentMode', 'Change server to Tournament.', 'Tournament Mode'); - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Change the Mission'); - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteSkipMission', 'skip the mission to', 'Skip the Mission' ); - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Change the Time Limit'); - - if(%multipleTeams) - { - if($teamDamage) - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'disable team damage', 'Disable Team Damage'); - else - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'enable team damage', 'Enable Team Damage'); - } - - if( $Host::AllowAdminVotes ) - messageClient(%client, 'MsgVoteItem', "", %key, 'ForceVote', 'Vote to ...', 'Vote to ...'); - } - else - { - if(!$MatchStarted && !$CountdownStarted) - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteMatchStart', 'Start Match', 'Start Match'); - if(!$MatchStarted && $CountdownStarted) - messageClient(%client, 'MsgVoteItem', "", %key, 'cancelMatchStart', 'Cancel Match Start', 'Cancel Match Start'); - - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Change the Mission'); - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteFFAMode', 'Change server to Free For All.', 'Free For All Mode'); - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Change the Time Limit'); - - if($Host::Password !$= "") - messageClient(%client, 'MsgVoteItem', "", %key, 'TogglePUGpassword', 'Disable PUG Password', 'Disable PUG Password'); - else - messageClient(%client, 'MsgVoteItem', "", %key, 'TogglePUGpassword', 'Enable PUG Password', 'Enable PUG Password'); - - if($LockedTeams) - messageClient(%client, 'MsgVoteItem', "", %key, 'ToggleLockedTeams', 'Disable Locked Teams', 'Disable Locked Teams'); - else - messageClient(%client, 'MsgVoteItem', "", %key, 'ToggleLockedTeams', 'Enable Locked Teams', 'Enable Locked Teams'); - - if(%multipleTeams) - { - if($teamDamage) - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'disable team damage', 'Disable Team Damage'); - else - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'enable team damage', 'Enable Team Damage'); - } - } - - //Toggle Tournament Net Client - if(%client.isSuperAdmin) - { - if($Host::EnableNetTourneyClient) - messageClient( %client, 'MsgVoteItem', "", %key, 'ToggleTourneyNetClient', 'Disable Tournament Net Client', "Disable Tournament Net Client" ); - else - messageClient( %client, 'MsgVoteItem', "", %key, 'ToggleTourneyNetClient', 'Enable Tournament Net Client', "Enable Tournament Net Client" ); - } - - } - - if ($Host::ServerRules[1] !$= "" ) - messageClient( %client, 'MsgVoteItem', "", %key, 'showServerRules', 'show server rules', "Show Server Rules" ); - } - else - { - if(%client.isSuperAdmin || (%client.isAdmin && $Host::AllowAdminStopVote)) // allow admins to stop votes - messageClient( %client, 'MsgVoteItem', "", %key, 'stopRunningVote', 'stop current vote', 'Stop the Vote'); - - if(%client.isSuperAdmin || (%client.isAdmin && $Host::AllowAdminPassVote)) // allow admins to pass votes - messageClient( %client, 'MsgVoteItem', "", %key, 'passRunningVote', 'pass current vote', 'Pass the Vote'); - } + //Everyone + if ($Host::ServerRules[1] !$= "" ) + messageClient( %client, 'MsgVoteItem', "", %key, 'showServerRules', 'show server rules', "Show Server Rules" ); + } } // Eolk - completely re-wrote this. @@ -247,10 +271,10 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % if(!%client.canVote && !%isAdmin) return; - if(Game.scheduleVote !$= "" && (!%isAdmin || (%isAdmin && %client.adminVoteSet))) + if(Game.scheduleVote !$= "" && (!%isAdmin || (%isAdmin && %client.ForceVote))) { messageClient(%client, 'voteAlreadyRunning', "\c2A vote is already in progress."); - %client.adminVoteSet = 0; + %client.ForceVote = 0; return; } @@ -258,12 +282,6 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % switch$(%typeName) { case "VoteKickPlayer": - if($Host::TournamentMode && !$Host::AllowPlayerTournamentModeVotekick) // Dont allow Votekicks in Tournament Mode - { - messageClient(%client, "", "\c2No votekicks in Tournament Mode."); - return; - } - if(%client == %arg1) // client is trying to votekick himself return; // Use the leave button instead, pal. @@ -277,7 +295,13 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % } else // Player is voting to kick { - if(%arg1.isAdmin) // target is an admin + if($Host::TournamentMode && $RestrictedVoting) // Dont allow Votekicks in Tournament Mode + { + messageClient(%client, "", "\c2No votekicks in Tournament Mode at this time."); + return; + } + + if(%arg1.isAdmin) // target is an admin { messageClient(%client, "MsgClient", "\c2You cannot vote to kick "@%arg1.nameBase@", "@(%arg1.sex $= "Male" ? "he" : "she")@" is an admin!"); return; @@ -321,18 +345,18 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % if(%arg1.isAdmin) // target is already an admin return; // can't vote to admin an admin! - if(%client.isAdmin) // our pal is an admin - { - if(!%client.isSuperAdmin) // ... but not a super admin - return; // insufficient privileges - } - else // not an admin - { - if(!$host::allowadminplayervotes) // admin player votes are NOT enabled - return; // can't do that pal + if(%isAdmin) + { + if(!%client.isSuperAdmin && !$Host::AllowAdmin2Admin) + return; + } + else + { + if(!$host::allowadminplayervotes) // admin player votes are NOT enabled + return; // can't do that pal %msg = %client.nameBase @ " initiated a vote to admin player " @ %arg1.nameBase @ "."; - } + } case "BanPlayer": if(%client.isSuperAdmin && !%arg1.isSuperAdmin) // we're a super admin, and our target isn't a super admin @@ -395,12 +419,19 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % return; } - if($CurrentMissionType $= "Siege") // Can't change time in this one + if($CurrentMissionType $= "Siege") // Can't change time in this one { messageClient(%client, "", "\c2Cannot change the time limit in this gametype."); return; } + // 30 minutes Only in Tournament mode + if($Host::TournamentMode && %arg1 !$= "30") + { + messageClient(%client, "", "\c2Only 30 minute time limit allowed in tournament mode."); + return; + } + // Eolk - don't let votes/admins end the map immediately by switching the time limit below the elapsed time if((%arg1 * 60 * 1000) < (getSimTime() - $missionStartTime)) { @@ -416,13 +447,32 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % //If proposed time is lower than server set or higher than unlimited if(%arg1 < $Host::TimeLimit || %arg1 > 999) - { - messageClient(%client, "", "\c2Invalid time selection."); - return; - } + { + if(!%isAdmin) + { + messageClient(%client, "", "\c2Invalid time selection."); + return; + } + else //is an admin + { + if($Host::TournamentMode) //Admins still have the option to set the time to 30 minutes in Tourney Mode + { + if(%arg1 !$= "30") //30 minutes only + { + messageClient(%client, "", "\c2Invalid time selection."); + return; + } + } + else + { + messageClient(%client, "", "\c2Invalid time selection."); + return; + } + } + } //If proposed time is something other than what is selectable - if(%arg1 !$= "90" && %arg1 !$= "120" && %arg1 !$= "150" && %arg1 !$= "180" && %arg1 !$= "240" && %arg1 !$= "360" && %arg1 !$= "480" && %arg1 !$= "999") + if(%arg1 !$= "30" && %arg1 !$= "45" && %arg1 !$= "60" && %arg1 !$= "75" && %arg1 !$= "90" && %arg1 !$= "180" && %arg1 !$= "360" && %arg1 !$= "999") { messageClient(%client, "", "\c2Only selectable times allowed."); return; @@ -496,19 +546,244 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % case "passRunningVote": if (%client.isSuperAdmin || (%client.isAdmin && $Host::AllowAdminPassVote)) { - adminStartNewVote( %client, %typename, %arg1, %arg2, %arg3, %arg4); + passCurrentVote(%client); adminLog(%client, " passed the vote in progress."); + return; } case "stopRunningVote": - if($VOStatus !$="InProgress" || $Host::TournamentMode) //Dont allow a stop vote after time has expired, then no new time is set - VoteOverTime + if(%client.isSuperAdmin || (%client.isAdmin && $Host::AllowAdminStopVote)) + { + if($VOStatus $="InProgress") //Dont allow a stop vote after time has expired, then no new time is set - VoteOverTime + { + messageClient(%client, "", "\c2Can't stop time vote after time has expired."); + return; + } + + stopCurrentVote(%client); + adminLog(%client, " stopped the vote in progress."); + return; + } + + case "TogglePUGpassword": + if (%client.isAdmin && $Host::TournamentMode) { - if(%client.isSuperAdmin || (%client.isAdmin && $Host::AllowAdminStopVote)) + if($Host::Password !$= "") { - adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, " stopped the vote in progress."); + $Host::Password = ""; + messageAdmins('', %client.nameBase @ " has disabled the PUG password.~wfx/powered/vehicle_screen_on.wav"); + adminLog(%client, " has disabled PUG password." ); + } + else + { + $Host::Password = $Host::PUGPassword; + messageAdmins('', %client.nameBase @ " has enabled the PUG password (\"" @ $Host::PUGPassword @ "\").~wfx/powered/vehicle_screen_on.wav"); + adminLog(%client, " has enabled PUG password." ); } } + return; + + case "ToggleLockedTeams": + if (%client.isAdmin && $Host::TournamentMode) + { + if(!$LockedTeams) + { + if(!isActivePackage(LockedTeams)) + activatePackage(LockedTeams); + $LockedTeams = 1; + messageAdmins('', %client.nameBase @ " has enabled Locked Teams.~wfx/powered/vehicle_screen_on.wav" ); + adminLog(%client, " has enabled Locked Teams."); + } + else + { + if(isActivePackage(LockedTeams)) + deactivatePackage(LockedTeams); + $LockedTeams = 0; + messageAdmins('', %client.nameBase @ " has disabled Locked Teams.~wfx/powered/vehicle_screen_on.wav" ); + adminLog(%client, " has disabled Locked Teams."); + } + } + return; + + case "ToggleRestrictedVoting": + if(%client.isAdmin && $Host::TournamentMode) + { + if(!$RestrictedVoting) + { + $RestrictedVoting = 1; + messageAdmins('', %client.nameBase @ " has enabled restricted voting (No Map, Time, Kick, or Team Damage Votes).~wfx/powered/vehicle_screen_on.wav"); + adminLog(%client, " has enabled restricted voting." ); + } + else + { + $RestrictedVoting = 0; + messageAdmins('', %client.nameBase @ " has disabled restricted voting.~wfx/powered/vehicle_screen_on.wav" ); + adminLog(%client, " has disabled restricted voting." ); + } + } + return; + + case "Admins2Admin": + if(%client.isSuperAdmin) + { + if($Host::AllowAdmin2Admin) + { + $Host::AllowAdmin2Admin = 0; + + messageAdmins('', %client.nameBase @ " has disabled Admins to Admin.~wfx/powered/vehicle_screen_on.wav" ); + adminLog(%client, " has disabled Admins to Admin."); + } + else + { + $Host::AllowAdmin2Admin = 1; + + messageAdmins('', %client.nameBase @ " has enabled Admins to Admin.~wfx/powered/vehicle_screen_on.wav" ); + adminLog(%client, " has enabled Admins to Admin."); + } + } + return; + + case "ToggleTourneyNetClient": + if(%client.isSuperAdmin) + { + if($Host::EnableNetTourneyClient) + { + $Host::EnableNetTourneyClient = 0; + + if(isActivePackage(checkver)) + deactivatePackage(checkver); + + messageAdmins('', %client.nameBase @ " has disabled Net Tourney Client checking.~wfx/powered/vehicle_screen_on.wav" ); + adminLog(%client, " has disabled Net Tourney Client checking."); + } + else + { + $Host::EnableNetTourneyClient = 1; + + if(!isActivePackage(checkver)) + activatePackage(checkver); + + //Boot Offenders into Obs + CheckVerObserver(%client); + + messageAdmins('', %client.nameBase @ " has enabled Net Tourney Client checking.~wfx/powered/vehicle_screen_on.wav" ); + ResetGetCountsStatus(); + adminLog(%client, " has enabled Net Tourney Client checking."); + } + } + return; + + case "ForceVote": + if (!%client.isAdmin) + return; + + if(%client.isAdmin && !$Host::AllowAdminVotes) + return; + + if (%client.ForceVote) + { + %client.ForceVote = 0; + messageClient( %client, '', 'Vote to ... cancelled.' ); + } + else + { + %client.ForceVote = 2; + messageClient( %client, '', "Now select what to vote on, please." ); + } + + return; + + case "VoteNextMission": + if(!%client.isAdmin && $TotalTeamPlayerCount < 6) + { + messageClient( %client, '', "Need at least 6 players on teams to set the next map." ); + return; + } + + %foundMap = 0; + %client.lockVMenu = 1; + if(strpos(strlwr(%arg1),"next mission") != -1) + { + %key = %client.k++; + for ( %type = 0; %type < $HostTypeCount; %type++ ) + messageClient( %client, 'MsgVoteItem', "", %key, 'VoteNextMission', $HostTypeDisplayName[%type], $HostTypeDisplayName[%type], true ); + return; + } + %key = %client.k++; + for ( %type = 0; %type < $HostTypeCount; %type++ ) + { + if($HostTypeDisplayName[%type] $= %arg1) + { + $HostNextTypeIndex = %type; + + + for ( %i = $HostMissionCount[%type] - 1; %i >= 0; %i-- ) + { + %idx = $HostMission[%type, %i]; + // If we have bots, don't change to a mission that doesn't support bots: + if ( $HostGameBotCount > 0 ) + { + if( !$BotEnabled[%idx] ) + continue; + } + messageClient( %client, 'MsgVoteItem', "", %key,'VoteNextMission',$HostMissionName[%idx],$HostMissionName[%idx], true ); + } + return; + } + } + %type = $HostNextTypeIndex; + for ( %i = $HostMissionCount[%type] - 1; %i >= 0; %i-- ) + { + %idx = $HostMission[%type, %i]; + if ( $HostGameBotCount > 0 ) + { + if( !$BotEnabled[%idx] ) + continue; + } + if(%arg1 $= $HostMissionName[%idx]) + { + $hostNextMapIndex = %idx; + %foundMap = 1; + break; + } + } + //error("found map" SPC %foundMap SPC $HostNextTypeIndex SPC $hostNextMapIndex); + if(%foundMap) + { + %arg3 = $hostNextMapIndex; + %arg4 = $HostNextTypeIndex; + // Vote-spoof prevention right here + %arg1 = $HostMissionFile[%arg3]; + %arg2 = $HostTypeName[%arg4]; + if(!checkMapExist(%arg1, %arg2)) + return; + + // We passed the spoof check, give it the fancy label + %arg1 = $HostMissionName[%arg3]; + %arg2 = $HostTypeDisplayName[%arg4]; + %client.lockVMenu = 0; + if((!%isAdmin && $Host::AllowPlayerVoteNextMission) || (%isAdmin && %client.ForceVote)) // not admin + { + if($CMHasVoted[%client.guid] >= $Host::ClassicMaxVotes && !%isAdmin) // they've voted too many times + { + messageClient(%client, "", "\c2You have exhausted your voting rights for this mission."); + return; + } + %msg = %client.nameBase @ " initiated a vote to set the next mission to " @ %arg1 @ " (" @ %arg2 @ ")."; + $CMHasVoted[%client.guid]++; + } + } + + case "ClearNextMap": + if (%client.isAdmin && $voteNext) + { + messageAll('MsgAdminForce', "\c2The Admin " @ %client.nameBase @ " has cleared the next set mission."); + adminLog(%client, " has cleared" SPC $HostMissionFile[$voteNextMap] SPC "(" @ $HostTypeName[$voteNextType] @ ") from the next set mission."); + $voteNextType = 0; + $voteNextMap = 0; + $voteNext = 0; + } + return; // LakRabbit Stuff case "VoteDuelMode": @@ -532,6 +807,7 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % if(!%isAdmin || (%isAdmin && %client.ForceVote)) %msg = %client.nameBase @ " initiated a vote to " @ (Game.pubPro == 0 ? "enable" : "disable") @ " pro mode."; + //Deathmatch Stuff case "DMSLOnlyMode": if(!$CurrentMissionType $= "DM") return; @@ -539,6 +815,7 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % if(!%isAdmin || (%isAdmin && %client.ForceVote)) %msg = %client.nameBase @ " initiated a vote to " @ (Game.DMSLOnlyMode == 0 ? "enable" : "disable") @ " shocklance only mode."; + //LCTF Stuff case "SCtFProMode": if(!$CurrentMissionType $= "sctf") return; @@ -557,101 +834,18 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % %client.schedViewRules = schedule( 10000, %client, "resetViewSchedule", %client ); } return; - case "TogglePUGpassword": - if (%client.isAdmin) - { - if($Host::Password !$= "") - { - $Host::Password = ""; - messageClient( %client, '', "PUG password been disabled.~wfx/powered/vehicle_screen_on.wav" ); - adminLog(%client, " has disabled pug password." ); - } - else - { - $Host::Password = $Host::PUGPassword; - messageClient( %client, '', "PUG password been enabled.~wfx/powered/vehicle_screen_on.wav" ); - adminLog(%client, " has enabled pug password." ); - } - } - return; - case "ToggleLockedTeams": - if (%client.isAdmin) - { - if(!$LockedTeams) - { - if(!isActivePackage(LockedTeams)) - activatePackage(LockedTeams); - $LockedTeams = 1; - messageClient( %client, '', "Locked Teams has been enabled.~wfx/powered/vehicle_screen_on.wav" ); - adminLog(%client, " has enabled Locked Teams."); - } - else - { - if(isActivePackage(LockedTeams)) - deactivatePackage(LockedTeams); - $LockedTeams = 0; - messageClient( %client, '', "Locked Teams has been disabled.~wfx/powered/vehicle_screen_on.wav" ); - adminLog(%client, " has disabled Locked Teams."); - } - } - return; - case "ToggleTourneyNetClient": - if (%client.isAdmin) - { - if($Host::EnableNetTourneyClient) - { - $Host::EnableNetTourneyClient = 0; - - if(isActivePackage(checkver)) - deactivatePackage(checkver); - - messageClient( %client, '', "Tournament Net Client checking has been disabled.~wfx/powered/vehicle_screen_on.wav" ); - adminLog(%client, " has disabled Net Tourney Client checking."); - } - else - { - $Host::EnableNetTourneyClient = 1; - - if(!isActivePackage(checkver)) - activatePackage(checkver); - - //Boot Offenders into Obs - CheckVerObserver(%client); - - messageClient( %client, '', "Tournament Net Client checking has been enabled.~wfx/powered/vehicle_screen_on.wav" ); - ResetGetCountsStatus(); - adminLog(%client, " has enabled Net Tourney Client checking."); - } - } - return; - case "ForceVote": - if (%client.isAdmin && $Host::AllowAdminVotes) - { - if (%client.ForceVote) - { - %client.ForceVote = 0; - messageClient( %client, '', 'Vote to ... cancelled.' ); - } - else - { - %client.ForceVote = 2; - messageClient( %client, '', "Now select what to vote on, please." ); - } - } - return; default: return; } - if(%isAdmin && !%client.adminVoteSet && !%client.ForceVote) + if(%isAdmin && !%client.ForceVote) adminStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4); else playerStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %teamSpecific, %msg); } //exec("scripts/autoexec/VoteMenu.cs"); - function playerStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %teamSpecific, %msg) { %clientsVoting = 0; @@ -695,6 +889,8 @@ function playerStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %tea { case "VoteChangeMission": messageClient( %cl, 'VoteStarted', "\c2" @ %msg, %client.name, "change the mission to", %arg1, %arg2); + case "VoteNextMission": + messageClient( %cl, 'VoteStarted', "\c2" @ %msg, %client.name, "set next mission to", %arg1, %arg2); case "VoteSkipMission": messageClient( %cl, 'VoteStarted', "\c2" @ %msg, %client.name, "skip the mission"); case "VoteChangeTimeLimit": @@ -861,6 +1057,7 @@ function DefaultGame::voteChangeMission(%game, %admin, %missionDisplayName, %typ if(isObject(%admin)) { messageAll('MsgAdminChangeMission', '\c2The Admin %3 has changed the mission to %1 (%2).', %missionDisplayName, %typeDisplayName, %admin.name ); + $voteNext = 0; %game.gameOver(); loadMission( %mission, %missionType, false ); adminLog(%admin, " has changed the mission to " @ %missionDisplayName @ " (" @ %typeDisplayName @ ")"); @@ -879,6 +1076,7 @@ function DefaultGame::voteChangeMission(%game, %admin, %missionDisplayName, %typ //Show Vote % 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); + $voteNext = 0; %game.gameOver(); loadMission( %mission, %missionType, false ); } @@ -1308,12 +1506,12 @@ function DefaultGame::sendGamePlayerPopupMenu( %game, %client, %targetClient, %k messageClient( %client, 'MsgPlayerPopupItem', "", %key, "ChangeTeam", "", %str, %caseId ); } - // z0dd - ZOD, 7/11/03. Allow Super admins to force themselves to obs. - if( %isSuperAdmin ) - { - if(%isTargetSelf && !%isTargetObserver) - messageClient( %client, 'MsgPlayerPopupItem', "", %key, "ToObserver", "", 'Force observer', 5 ); - } + // z0dd - ZOD, 7/11/03. Allow Super admins to force themselves to obs. + if( %isSuperAdmin ) + { + if(%isTargetSelf && !%isTargetObserver) + messageClient( %client, 'MsgPlayerPopupItem', "", %key, "ToObserver", "", 'Force observer', 5 ); + } } else if ( %isTargetObserver ) { @@ -1324,27 +1522,6 @@ function DefaultGame::sendGamePlayerPopupMenu( %game, %client, %targetClient, %k } } -function DefaultGame::passRunningVote(%game, %admin, %arg1, %arg2, %arg3, %arg4) -{ - if ( %admin && Game.scheduleVote !$= "" ) - { - passCurrentVote(); - messageAll('MsgAdminForce', '\c2The Admin passed the vote.' ); - echo("The admin" SPC %admin.nameBase SPC "has passed the vote."); - } -} - -function DefaultGame::stopRunningVote(%game, %admin, %arg1, %arg2, %arg3, %arg4) -{ - %curTimeLeftMS = ($Host::TimeLimit * 60 * 1000) + $missionStartTime - getSimTime(); - if(%admin && Game.scheduleVote !$= "" && %curTimeLeftMS > 0) - { - stopCurrentVote(); - messageAll('MsgAdminForce', '\c2The Admin stopped the vote.'); - echo("The admin" SPC %admin.nameBase SPC "has stopped the vote."); - } -} - function adminStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4) { if ( Game.scheduleVote !$= "" && Game.voteType $= %typeName ) @@ -1363,6 +1540,44 @@ function adminStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4) Game.evalVote(%typeName, %client, %arg1, %arg2, %arg3, %arg4); } +function serverCmdGetVoteMenu( %client, %key ) +{ + if (isObject( Game ) && !%client.lockVMenu) + Game.sendGameVoteMenu( %client, %key ); + %client.lockVMenu = 0; +} + +function CycleMissions() +{ + if($voteNext) + { + %nextMission = $HostMissionFile[$voteNextMap]; + %type = $HostTypeName[$voteNextType]; + messageAll( 'MsgClient', 'Loading %1 (%2)...', %nextMission, $HostTypeDisplayName[$voteNextType] ); + loadMission( %nextMission, %type ); + $voteNextType = 0; + $voteNextMap = 0; + $voteNext = 0; + } + else + parent::CycleMissions(); +} + +//Reset Set next mission if everyone leaves +function GameConnection::onDrop(%client, %reason) +{ + Parent::onDrop(%client, %reason); + + //Reset SetNextMission + if($HostGamePlayerCount - $HostGameBotCount == 0 && $voteNext) + { + echo("No clients on the server. Set next mission reset..."); + $voteNextType = 0; + $voteNextMap = 0; + $voteNext = 0; + } +} + }; // checkMapExist(%missionName, %missionType) @@ -1392,28 +1607,29 @@ function checkMapExist(%missionName, %missionType) // passCurrentVote() // Info: passes a vote that is running. -function passCurrentVote() // Edit GG +// Eolk - Removed *** classic admin stuff. +function passCurrentVote(%admin) { if(Game.scheduleVote !$= "") { - messageAll('closeVoteHud', ""); - cancel(Game.scheduleVote); - Game.scheduleVote = ""; - Game.kickClient = ""; + messageAll('closeVoteHud', ""); + cancel(Game.scheduleVote); + Game.scheduleVote = ""; + Game.kickClient = ""; - if(Game.votingArgs[typeName] $= "VoteKickPlayer") // special case here - { - Game.votesFor[Game.kickTeam] = ClientGroup.getCount() - $HostGameBotCount; - Game.votesAgainst[Game.kickTeam] = 0; - } - else - { - Game.totalVotesFor = ClientGroup.getCount() - $HostGameBotCount; - Game.totalVotesAgainst = 0; - } + if(Game.votingArgs[typeName] $= "VoteKickPlayer") // special case here + { + Game.votesFor[Game.kickTeam] = ClientGroup.getCount() - $HostGameBotCount; + Game.votesAgainst[Game.kickTeam] = 0; + } + else + { + Game.totalVotesFor = ClientGroup.getCount() - $HostGameBotCount; + Game.totalVotesAgainst = 0; + } - Game.evalVote(Game.votingArgs[typeName], false, Game.votingArgs[arg1], Game.votingArgs[arg2], Game.votingArgs[arg3], Game.votingArgs[arg4]); - clearVotes(); + Game.evalVote(Game.votingArgs[typeName], false, Game.votingArgs[arg1], Game.votingArgs[arg2], Game.votingArgs[arg3], Game.votingArgs[arg4]); + clearVotes(); //Stop vote chimes for(%i = 0; %i < $Host::EnableVoteSoundReminders; %i++) @@ -1422,20 +1638,25 @@ function passCurrentVote() // Edit GG cancel(Game.voteReminder[%i]); Game.voteReminder[%i] = ""; } + + messageAll('MsgAdminForce', "\c2The Admin " @ getTaggedString(%admin.name) @ " has passed the vote."); } + else + messageClient(%admin, "MsgClient", "\c2There is no vote to pass..."); } // stopCurrentVote() // Info: stop a vote that is still running -function stopCurrentVote() +function stopCurrentVote(%admin) { - if(Game.scheduleVote !$= "") - { - messageAll('closeVoteHud', ""); - cancel(Game.scheduleVote); - Game.scheduleVote = ""; - Game.kickClient = ""; - clearVotes(); + if(Game.scheduleVote !$= "") + { + + messageAll('closeVoteHud', ""); + cancel(Game.scheduleVote); + Game.scheduleVote = ""; + Game.kickClient = ""; + clearVotes(); //Stop vote chimes for(%i = 0; %i < $Host::EnableVoteSoundReminders; %i++) @@ -1444,7 +1665,11 @@ function stopCurrentVote() cancel(Game.voteReminder[%i]); Game.voteReminder[%i] = ""; } - } + + messageAll('MsgAdminForce', "\c2The Admin " @ getTaggedString(%admin.name) @ " has cancelled the vote."); + } + else + messageClient(%admin, "MsgClient", "\c2There is no vote to stop..."); } // calcVotes(%typeName, %arg1, %arg2, %arg3, %arg4) @@ -1531,37 +1756,47 @@ function serverCmdClientJoinGame(%client) { if($LockedTeams) { - messageClient( %client, '', "Teams are locked. Ask an admin to set your team." ); + messageClient( %client, '', "Teams are locked. Wait to be assigned a team." ); return; } Parent::serverCmdClientJoinGame(%client); } +//exec("Scripts/autoexec/votemenu.cs"); function serverCmdClientPickedTeam(%client, %option) { - Parent::serverCmdClientPickedTeam(%client, %option); //Put first - if($LockedTeams) //Added - { - if($Host::TournamentMode && %client.team !$= 0) //Added - { - messageClient( %client, '', "Teams are locked. Ask an admin to set your team." ); - schedule(1000, 0, "ClearCenterPrint", %client); //So Press FIRE when ready is cleared, later down the pipe - serverCmdClientMakeObserver( %client ); - } - return; - } + if(!$Host::TournamentMode) + return; + + //All roads lead to observer + if( isObject(%client.player) ) + { + %client.player.scriptKill(0); + ClearBottomPrint(%client); + } + Game.forceObserver( %client, "playerChoose" ); + %client.observerMode = "observer"; + %client.notReady = false; + messageClient( %client, '', "Teams are locked. Wait to be assigned a team." ); + return; } function serverCmdClientTeamChange(%client, %option) { if($LockedTeams) { - messageClient( %client, '', "Teams are locked. Ask an admin to set your team." ); + messageClient( %client, '', "Teams are locked. Wait to be assigned a team." ); return; } Parent::serverCmdClientTeamChange(%client, %option); } +//No Pick Team PopUp Box when LockedTeams is enabled +function serverCmdPlayContentSet( %client ) +{ + //nothing +} + }; // VoteSound Script @@ -1607,3 +1842,43 @@ function VoteSound(%teamSpecific, %typename, %arg1, %arg2, %msg) } } } + + +function DefaultGame::setNextMission(%game, %client, %map, %type, %mapIndex, %typeIndex) +{ + if(%client.isAdmin || %client.isSuperAdmin) + { + $voteNext = 1; + $voteNextType = %typeIndex; + $voteNextMap = %mapIndex; + messageAll('MsgAdminChangeMission', '\c2The Admin %3 has set the next mission to %1 (%2).~wfx/misc/hunters_greed.wav', $HostMissionName[%mapIndex], $HostTypeDisplayName[%typeIndex], %client.name ); + adminLog(%client, " has set the next mission to" SPC $HostMissionName[%mapIndex] @ "(" @ $HostTypeDisplayName[%typeIndex] @ ")."); + } + else + { + %totalVotes = %game.totalVotesFor + %game.totalVotesAgainst; + // Added people who dont vote into the equation, now if you do not vote, it doesn't count as a no. - z0dd - ZOD + if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100)) + { + $voteNext = 1; + $voteNextType = %typeIndex; + $voteNextMap = %mapIndex; + messageAll('MsgVotePassed', '\c2Next mission set to %1 (%2) by vote.', $HostMissionName[%mapIndex], $HostTypeDisplayName[%typeIndex]); + + //Log Vote % - Must be before Game Over + %key = "Passed"; + votePercentLog(%missionDisplayName, %typeName, %key, %game.totalVotesFor, %game.totalVotesAgainst, %totalVotes, %game.totalVotesNone); + //Show Vote % + 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); + } + else + { + messageAll('MsgVoteFailed', '\c2Next mission vote did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100)); + //Log Vote % + %key = "Failed"; + votePercentLog(%missionDisplayName, %typeName, %key, %game.totalVotesFor, %game.totalVotesAgainst, %totalVotes, %game.totalVotesNone); + //Show Vote % + 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); + } + } +} diff --git a/Classic/scripts/autoexec/dtBanSystem.cs b/Classic/scripts/autoexec/dtBanSystem.cs old mode 100755 new mode 100644 index f899e39..66e9999 --- a/Classic/scripts/autoexec/dtBanSystem.cs +++ b/Classic/scripts/autoexec/dtBanSystem.cs @@ -11,12 +11,12 @@ //$dtBanList::GUID3555379 = "4\t2021\t18\t31\t518400"; //TO UNBAN SOMEONE WITHOUT RESTARTING THE SERVER -//unban(%guid,%ip); in console -//Example: unban(555555,"22.222.222.222"); put ip in quotes +//banList();in console +//unbanIndex(%index) %index is the number next to the players name from listBans(); +//Example: unbanold(555555,"22.222.222.222"); put ip in quotes package dtBan { - function ClassicLoadBanlist() { $ClassicPermaBans = 0; @@ -30,21 +30,43 @@ function BanList::add(%guid, %ipAddress, %time){ if(%time > 999999){ %time = "BAN"; } + %name = getClientBanName(%guid, %ipAddress); if (%guid > 0){ - $dtBanList::GUID[%guid] = dtBanMark() TAB %time; + $dtBanList::GUID[%guid] = dtBanMark() TAB %time TAB %name; } if (getSubStr(%ipAddress, 0, 3) $= "IP:"){ - // add IP ban %bareIP = getSubStr(%ipAddress, 3, strLen(%ipAddress)); %bareIP = getSubStr(%bareIP, 0, strstr(%bareIP, ":")); %bareIP = strReplace(%bareIP, ".", "_"); // variable access bug workaround - - $dtBanList::IP[%bareIP] = dtBanMark() TAB %time; - //error("ban" SPC %bareIP SPC $dtBanList::IP[%bareIP]); + // add IP ban + $dtBanList::IP[%bareIP] = dtBanMark() TAB %time TAB %name; } - - // write out the updated bans to the file - export("$dtBanList*", $Host::dtBanlist); + %found = 0; + %eIndex = -1; + for (%i = 0; %i < 100; %i++){ + if($dtBanList::NameList[%i] !$= ""){ + if(getField($dtBanList::NameList[%i], 0) $= %name){ + %found =1; + if(%guid > 0) + $dtBanList::NameList[%i] = setField($dtBanList::NameList[%i], 1, %guid); + if(getSubStr(%ipAddress, 0, 3) $= "IP:") + $dtBanList::NameList[%i] = setField($dtBanList::NameList[%i], 2, %bareIP); + break; + } + } + else if(%eIndex == -1){ + %eIndex = %i; + } + } + if(!%found){ + if($dtBanList::NameList[%eIndex] $= ""){ + $dtBanList::NameList[%eIndex] = %name TAB %guid TAB %bareIP; + } + else{ + error("Ban Index is not empty"); + } + } + saveBanList(); } function banList_checkIP(%client){ @@ -56,14 +78,21 @@ function banList_checkIP(%client){ %time = $dtBanList::IP[%ip]; if(%time $= "BAN") return 1; - if (%time !$= "" && %time != 0){ + if (getFieldCount(%time) > 0){ %delta = getBanCount(getField(%time,0), getField(%time,1),getField(%time,2),getField(%time,3)); if (%delta < getField(%time,4)) return 1; else{ + for (%i = 0; %i < 100; %i++){ + if($dtBanList::NameList[%i] !$= ""){ + if(getField($dtBanList::NameList[%i], 1) $= %guid){ + unbanIndex(%i); + break; + } + } + } $dtBanList::IP[%ip] = ""; - schedule(1000,0,"export","$dtBanList*", $Host::dtBanlist); - //export("$dtBanList*", "prefs/dtBanlist.cs"); + saveBanList(); } } return 0; @@ -73,14 +102,21 @@ function banList_checkGUID(%guid){ %time = $dtBanList::GUID[%guid]; if(%time $= "BAN") return 1; - if (%time !$= "" && %time != 0){ + if (getFieldCount(%time) > 0){ %delta = getBanCount(getField(%time,0), getField(%time,1),getField(%time,2),getField(%time,3)); if (%delta < getField(%time,4)) return 1; else{ - $dtBanList::GUID[%guid] = ""; - schedule(500,0,"export","$dtBanList*", $Host::dtBanlist); - //export("$dtBanList*", "prefs/dtBanlist.cs"); + for (%i = 0; %i < 100; %i++){ + if($dtBanList::NameList[%i] !$= ""){ + if(getField($dtBanList::NameList[%i], 1) $= %guid){ + unbanIndex(%i); + break; + } + } + } + $dtBanList::GUID[%guid] = ""; + saveBanList(); } } return 0; @@ -88,31 +124,63 @@ function banList_checkGUID(%guid){ }; -if (!isActivePackage(dtBan)) +if (!isActivePackage(dtBan)){ activatePackage(dtBan); +} +function saveBanList(){ + if(!isEventPending($banEvent)) + $banEvent = schedule(1000,0,"export","$dtBanList*", $Host::dtBanlist); +} +function getClientBanName(%guid, %ip){ + %found = 0; + for (%i = 0; %i < ClientGroup.getCount(); %i++){ + %client = ClientGroup.getObject(%i); + if(%guid > 0 && %client.guid $= %guid){ + %found = 1; + break; + } + else if(%client.getAddress() $= %ip){ + %found = 1; + break; + } + } + if(%found){ + %authInfo = %client.getAuthInfo(); + %realName = getField( %authInfo, 0 ); + if(%realName !$= "") + %name = %realName; + else + %name = stripChars( detag( getTaggedString( %client.name ) ), "\cp\co\c6\c7\c8\c9\c0" ); + return trim(%name); + } + return 0; +} function getBanCount(%d, %year, %h, %n){ - %dif = formattimestring("yy") - %year; - %days += 365 * (%dif-1); - %days += 365 - %d; - %days += dtBanDay(); - %ht = %nt = 0; - if(formattimestring("H") > %h){ - %ht = formattimestring("H") - %h; + if(%d && %year && %h && %n){ + %dif = formattimestring("yy") - %year; + %days += 365 * (%dif-1); + %days += 365 - %d; + %days += dtBanDay(); + %ht = %nt = 0; + if(formattimestring("H") > %h){ + %ht = formattimestring("H") - %h; + } + else if(formattimestring("H") < %h){ + %ht = 24 - %h; + %ht = formattimestring("H")+ %ht; + } + if(formattimestring("n") > %n){ + %nt = formattimestring("n") - %n; + } + else if(formattimestring("n") < %n){ + %nt = 60 - %n; + %nt = formattimestring("n") + %nt; + } + return mfloor((%days * 1440) + (%ht*60) + %nt); } - else if(formattimestring("H") < %h){ - %ht = 24 - %h; - %ht = formattimestring("H")+ %ht; - } - if(formattimestring("n") > %n){ - %nt = formattimestring("n") - %n; - } - else if(formattimestring("n") < %n){ - %nt = 60 - %n; - %nt = formattimestring("n") + %nt; - } - return mfloor((%days * 1440) + (%ht*60) + %nt); + return 0; //return mfloor((%days * 1440) + (%ht*60) + %nt) TAB (%days * 1440) TAB (%ht*60) TAB %nt; } @@ -146,15 +214,63 @@ function dtBanMark(){ return %count + %d TAB formattimestring("yy") TAB formattimestring("H") TAB formattimestring("n"); } -function unban(%guid,%ip){ +function banList(){ + %found = 0; + for (%i = 0; %i < 100; %i++){ + %fieldList = $dtBanList::NameList[%i]; + if($dtBanList::NameList[%i] !$= ""){ + %found = 1; + error("index:" @ %i SPC "Name:" @ getField(%fieldList,0) SPC "GUID:" @ getField(%fieldList,1) SPC "IP:" @ getField(%fieldList,2)); + } + } + if(%found){ + error("Use unbanIndex(%index); to unban user from the list "); + } + else{ + error("No bans, see" SPC $Host::dtBanlist SPC "for older entries"); + } +} + +function unbanIndex(%index){ + if( $dtBanList::NameList[%index] !$= ""){ + %fieldList = $dtBanList::NameList[%index]; + %name = getField(%fieldList, 0); + $dtBanList::NameList[%index] = ""; + error("Name" SPC getField(%fieldList,0) SPC "UNBANNED"); + %guid = getField(%fieldList,1); + if($dtBanList::GUID[%guid] !$= ""){ + $dtBanList::GUID[%guid] = ""; + error("GUID" SPC %guid SPC "UNBANNED"); + } + %ip = getField(%fieldList,2); + if($dtBanList::IP[%ip] !$= ""){ + $dtBanList::IP[%ip] = ""; + error("IP" SPC %ip SPC "UNBANNED"); + } + saveBanList(); + return %name; + } + return -1; +} + +//old method +function unbanold(%guid,%ip){ + %ip = strReplace(%ip, ".", "_"); + for (%i = 0; %i < 100; %i++){ + if($dtBanList::NameList[%i] !$= ""){ + if(getField($dtBanList::NameList[%i], 2) $= %ip || getField($dtBanList::NameList[%i], 1) $= %guid){ + unbanIndex(%i); + return; + } + } + } if($dtBanList::GUID[%guid] !$= ""){ $dtBanList::GUID[%guid] = ""; error("GUID" SPC %guid SPC "UNBANNED"); } - %ip = strReplace(%ip, ".", "_"); if($dtBanList::IP[%ip] !$= ""){ $dtBanList::IP[%ip] = ""; error("IP" SPC %ip SPC "UNBANNED"); } - export("$dtBanList*", $Host::dtBanlist); -} + saveBanList(); +} \ No newline at end of file diff --git a/Classic/scripts/autoexec/flagTunnelingFix.cs b/Classic/scripts/autoexec/flagTunnelingFix.cs new file mode 100644 index 0000000..822d5cc --- /dev/null +++ b/Classic/scripts/autoexec/flagTunnelingFix.cs @@ -0,0 +1,104 @@ +//Fixes for collision tunneling on flag objects note only in CTF type games +//Script By:DarkTiger +$ftEnable = 1; +$flagSimTime = 60;//note a higher the time, the larger the sweep scans will be +$flagCheckRadius = 50; +$playerBoxA = "-0.6 -0.6 0"; +$playerBoxB = "0.6 0.6 2.3"; + +package flagFix{ + function CTFGame::startFlagCollisionSearch(%game, %flag){ + parent::startFlagCollisionSearch(%game, %flag); + if((getSimTime() - %game.fcs) >= $flagSimTime && $ftEnable){ + %game.flagColTest(%flag); + %game.fcs = getSimTime(); + } + } + function SCtFGame::startFlagCollisionSearch(%game, %flag){ + parent::startFlagCollisionSearch(%game, %flag); + if((getSimTime() - %game.fcs) >= $flagSimTime && $ftEnable){ + %game.flagColTest(%flag); + %game.fcs = getSimTime(); + } + } + + function PracticeCTFGame::startFlagCollisionSearch(%game, %flag){ + parent::startFlagCollisionSearch(%game, %flag); + if((getSimTime() - %game.fcs) >= $flagSimTime && $ftEnable){ + %game.flagColTest(%flag); + %game.fcs = getSimTime(); + } + } + + function CTFGame::startMatch(%game){ + parent::startMatch(%game); + %game.setupFlagTrig(); + if(!isEventPending(Game.flagLoop)){ + %game.atHomeFlagLoop(); + } + } + + function SCtFGame::startMatch(%game){ + parent::startMatch(%game); + %game.setupFlagTrig(); + if(!isEventPending(Game.flagLoop)){ + %game.atHomeFlagLoop(); + } + %game.fcs = getSimTime(); + } + + function PracticeCTFGame::startMatch(%game){ + parent::startMatch(%game); + %game.setupFlagTrig(); + if(!isEventPending(Game.flagLoop)){ + %game.atHomeFlagLoop(); + } + %game.fcs = getSimTime(); + } +}; +activatePackage(flagFix); + +function DefaultGame::flagColTest(%game, %flag){ + %Box2 = %flag.getWorldBox(); + InitContainerRadiusSearch( %flag.getWorldBoxCenter(), $flagCheckRadius, $TypeMasks::PlayerObjectType); + while((%player = containerSearchNext()) != 0){ + %playerPos = %player.getPosition(); + if(%player.lastSim > 0 && (%player.getState() !$= "Dead")){// only check at speed + if((getSimTime() - %player.lastSim) <= 256){//make sure are last position is valid + %sweepCount = mFloor(vectorDist(%playerPos, %player.oldPos) + 1); + for(%i = 0; %i < %sweepCount; %i++){// sweep behind us to see if we should have hit something + %lerpPos = vectorLerp(%playerPos, %player.oldPos, (%i+1)/%sweepCount);//back sweep + %Box1 = vectorAdd($playerBoxA, %lerpPos) SPC vectorAdd($playerBoxB, %lerpPos); + if(boxIntersect(%Box1, %Box2)){ + %flag.getDataBlock().onCollision(%flag, %player); + break; + } + } + } + } + %player.oldPos = %playerPos; + %player.lastSim = getSimTime(); + } +} + +function vectorLerp(%point1, %point2, %t) { + return vectorAdd(%point1, vectorScale(vectorSub(%point2, %point1), %t)); +} + +function boxIntersect(%a, %b){ + return (getWord(%a, 0) <= getWord(%b, 3) && getWord(%a, 3) >= getWord(%b, 0)) && + (getWord(%a, 1) <= getWord(%b, 4) && getWord(%a, 4) >= getWord(%b, 1)) && + (getWord(%a, 2) <= getWord(%b, 5) && getWord(%a, 5) >= getWord(%b, 2)); +} + +function DefaultGame::atHomeFlagLoop(%game){ + if($TeamFlag[1].isHome ){ + %game.flagColTest($TeamFlag[1], 0); + } + if($TeamFlag[2].isHome){ + %game.flagColTest($TeamFlag[2], 0); + } + %speed = ($HostGamePlayerCount - $HostGameBotCount > 0) ? $flagSimTime : 30000; + if(isObject(Game) && $missionRunning && $ftEnable) + %game.flagLoop = %game.schedule(%speed, "atHomeFlagLoop"); +} diff --git a/Classic/scripts/autoexec/multipleMapRotation.cs b/Classic/scripts/autoexec/multipleMapRotation.cs index 4014961..c35740f 100644 --- a/Classic/scripts/autoexec/multipleMapRotation.cs +++ b/Classic/scripts/autoexec/multipleMapRotation.cs @@ -1,11 +1,11 @@ //$Host::ClassicRotationFile = "prefs/mapRotation1.cs"; //Enable/Disable -$EnableMultipleMapRotation = 0; +//$Host::MultipleMapRotation = 0; //How any mapRotation Files //Naming scheme mapRotation1.cs, mapRotation2.cs, mapRotation3.cs, etc -$mapRotationFilesCount = 3; +//$Host::MultipleMapRotationCount = 3; function multipleMapRotation() { @@ -15,7 +15,7 @@ function multipleMapRotation() if(%var) //If number exists proceed { - if(%var $= $mapRotationFilesCount) + if(%var $= $Host::MultipleMapRotationCount) %var = 1; else %var = %var + 1; @@ -34,5 +34,5 @@ function multipleMapRotationEcho() } //Run -if($EnableMultipleMapRotation) +if($Host::MultipleMapRotation) multipleMapRotation(); diff --git a/Classic/scripts/autoexec/zDebriefLoadingScreen.cs b/Classic/scripts/autoexec/zDebriefLoadingScreen.cs index c247a08..493d9fa 100755 --- a/Classic/scripts/autoexec/zDebriefLoadingScreen.cs +++ b/Classic/scripts/autoexec/zDebriefLoadingScreen.cs @@ -60,9 +60,9 @@ $dtLoadingScreen::Delay = 0; $dtLoadingScreen::ShowFullScreen = 0; // Enable/Disable Images $dtLoadingScreen::ShowImages = 0; -// Enable/Disable Server Logo -$dtLoadingScreen::ShowLogo = $Host::LoadScreenShowLogo; //$dtLoadingScreen::ShowLogo = 0; -$dtLoadingScreen::LogoName = $Host::LoadScreenShowLogoName; //$dtLoadingScreen::LogoName = "dpub/DPUB_logo"; +// Enable/Disable Server Logo +//$Host::LoadScreenShowLogo = 0; +//$Host::LoadScreenShowLogoName = "dpub/DPUB_logo"; // Color safetynet @@ -234,11 +234,11 @@ function ALTsendModInfoToClient(%client) $dtLoadingScreen::LoadScreenMessage[$dmlP++] = " "; $dtLoadingScreen::LoadScreenMessage[$dmlP++] = " "; } - else if($dtLoadingScreen::ShowLogo) + else if($Host::LoadScreenShowLogo) { if(%client.dmpVersion $=$DMP::Version) { - $dtLoadingScreen::LoadScreenMessage[$dmlP++] = ""; + $dtLoadingScreen::LoadScreenMessage[$dmlP++] = ""; $dtLoadingScreen::LoadScreenMessage[$dmlP++] = " "; $dtLoadingScreen::LoadScreenMessage[$dmlP++] = " "; diff --git a/Classic/scripts/autoexec/z_dtAFK.cs b/Classic/scripts/autoexec/z_dtAFK.cs index a96fe45..ccb0d97 100644 --- a/Classic/scripts/autoexec/z_dtAFK.cs +++ b/Classic/scripts/autoexec/z_dtAFK.cs @@ -2,31 +2,30 @@ // Script BY: DarkTiger // Worked on: ChocoTaco // If player is afk specific amount of time in minutes, force them into observer +deleteVariables("$dtVar::AFKList*"); +$AFKCount = 0; // Enable/Disable entire script $dtVar::AFKTimeout = 1; // 60000 * 2 is 2 minutes // 0 minutes disables -$dtVar::AFKtime = 60000 * 2; +$dtVar::AFKtime = 60000 * 1; // Run from List Only instead of All clients on the server. 1 is yes, 0 is no $dtVar::ListOnly = 1; // Add clients who are normally AFK $dtVar::AFKList[$AFKCount++] = ""; $dtVar::AFKList[$AFKCount++] = ""; + // Loop Check Timer // How often do you want a AFKLoop. 1000 * 30 is 30 seconds -$dtVar::AFKloop = 1000 * 30; - -//////////////////////////////////////////////////////////////////////////////// +$dtVar::AFKloop = 1000 * 15; // Set Status Var -if($dtVar::ListOnly) +if($dtVar::ListOnly || !$dtVar::AFKtime) $DT_AFKStatus = "IDLE"; else $DT_AFKStatus = "ACTIVE"; -//////////////////////////////////////////////////////////////////////////////// - package DT_AFKPackage { @@ -67,21 +66,19 @@ function GameConnection::onDrop(%client, %reason) }; -//////////////////////////////////////////////////////////////////////////////// - function DT_AFKStatusConnect(%client) { - if($dtVar::AFKtime != 0 && !$Host::TournamentMode) //0 minutes disables + if(!$dtVar::AFKtime || $Host::TournamentMode) + return; + + for(%x = 1; %x <= $AFKCount; %x++) { - for(%x = 1; %x <= $AFKCount; %x++) + %guid = $dtVar::AFKList[%x]; + if(%client.guid $= %guid && %guid !$= "") { - %guid = $dtVar::AFKList[%x]; - if(%client.guid $= %guid && %guid !$= "") - { - $DT_AFKStatus = "ACTIVE"; - $DT_AFKListCount++; - %client.dtAFK = 1; - } + $DT_AFKStatus = "ACTIVE"; + $DT_AFKListCount++; + %client.dtAFK = 1; } } } @@ -89,87 +86,72 @@ function DT_AFKStatusConnect(%client) function DT_AFKStatusDrop(%client) { if(%client.dtAFK) - $DT_AFKListCount = $DT_AFKListCount - 1; + $DT_AFKListCount--; - // for(%x = 1; %x <= $AFKCount; %x++) - // { - // %guid = $dtVar::AFKList[%x]; - // if(%client.guid $= %guid && %guid !$= "") - // $DT_AFKListCount = $DT_AFKListCount - 1; - // } - - if($DT_AFKListCount $= 0) //Wont set IDLE until all List Clients are off the server + //Reset + if($DT_AFKListCount $= 0) $DT_AFKStatus = "IDLE"; } -//////////////////////////////////////////////////////////////////////////////// - function DT_AFKtimeoutLoop() { - //echo($DT_AFKStatus); - - switch$($DT_AFKStatus) - { - case ACTIVE: - if($dtVar::AFKtime != 0 && !$Host::TournamentMode) //0 minutes disables - { - if($dtVar::ListOnly) - { - for(%i = 0; %i < ClientGroup.getCount(); %i ++) - { - %client = ClientGroup.getObject(%i); - if(%client.dtAFK) - { - if(!%client.isAIControlled() && isObject(%client.player) && %client.player.getState() !$= "Dead") - AFKChk(%client); - } - } - } - else - { - for(%i = 0; %i < ClientGroup.getCount(); %i ++) - { - %client = ClientGroup.getObject(%i); - if(!%client.isAIControlled() && isObject(%client.player) && %client.player.getState() !$= "Dead") - AFKChk(%client); - } - } - } - case IDLE: - //Do Nothing - } - if(isEventPending($dtVar::AFKloopSchedule)) cancel($dtVar::AFKloopSchedule); + //echo($DT_AFKStatus); + if($DT_AFKStatus $= "ACTIVE" && !$Host::TournamentMode) + { + if($dtVar::ListOnly) + { + for(%i = 0; %i < ClientGroup.getCount(); %i ++) + { + %client = ClientGroup.getObject(%i); + if(%client.dtAFK) + { + if(!%client.isAIControlled() && isObject(%client.player) && %client.player.getState() !$= "Dead") + CheckAFK(%client); + } + } + } + else + { + for(%i = 0; %i < ClientGroup.getCount(); %i ++) + { + %client = ClientGroup.getObject(%i); + if(!%client.isAIControlled() && isObject(%client.player) && %client.player.getState() !$= "Dead") + CheckAFK(%client); + } + } + } + + //Have another go? $dtVar::AFKloopSchedule = schedule($dtVar::AFKloop, 0, "DT_AFKtimeoutLoop"); } -//////////////////////////////////////////////////////////////////////////////// - -function AFKChk(%client) +function CheckAFK(%client) { - if(%client.player.curTransform $= %client.player.getTransform()) - {//checks to see if there position and rotation are the same. - %client.player.afkTimer += $dtVar::AFKloop; - if(%client.player.afkTimer >= $dtVar::AFKtime) - { - Game.AFKForceObserver(%client); - return; - } - } - else - { - %client.player.afkTimer = 0;//reset if moving - } + //checks to see if there position and rotation are the same. + if(%client.player.curTransform $= %client.player.getTransform()) + { + %client.player.afkTimer += $dtVar::AFKloop; + if(%client.player.afkTimer >= $dtVar::AFKtime) + { + Game.AFKForceObserver(%client); + return; + } + } + else + %client.player.afkTimer = 0; //reset if moving - %client.player.curTransform = %client.player.getTransform();//save current transform + //save current transform + %client.player.curTransform = %client.player.getTransform(); } -//////////////////////////////////////////////////////////////////////////////// - function DefaultGame::AFKForceObserver(%game, %client) { + if($Host::TournamentMode) + return; + //make sure we have a valid client... if (%client <= 0) return; @@ -196,23 +178,6 @@ function DefaultGame::AFKForceObserver(%game, %client) logEcho(%client.nameBase@" (cl "@%client@") was forced into observer mode due to inactivity"); %client.lastTeam = %client.team; - if($Host::TournamentMode) - { - if(!$matchStarted) - { - if(%client.camera.Mode $= "pickingTeam") - { - commandToClient( %client, 'processPickTeam'); - clearBottomPrint( %client ); - } - else - { - clearCenterPrint(%client); - %client.notReady = true; - } - } - } - // switch client to team 0 (observer) %client.team = 0; %client.player.team = 0; @@ -233,4 +198,4 @@ function DefaultGame::AFKForceObserver(%game, %client) // call the onEvent for this game type %game.onClientEnterObserverMode(%client); //Bounty uses this to remove this client from others' hit lists -} +} \ No newline at end of file diff --git a/Classic/scripts/autoexec/z_dtStats.cs b/Classic/scripts/autoexec/z_dtStats.cs index a5b03b9..72aba3f 100644 --- a/Classic/scripts/autoexec/z_dtStats.cs +++ b/Classic/scripts/autoexec/z_dtStats.cs @@ -1733,7 +1733,7 @@ package dtStats{ if($dtStats::Enable){ dtSaveServerVars(); dtScanForRepair(); - $mapID::gameID = addNum($mapID::gameID,1); + $mapID::gameID = formattimestring("mddyHHnnss"); if($dtStats::debugEchos) error("GAME ID" SPC $mapID::gameID SPC "//////////////////////////////"); } @@ -2206,7 +2206,7 @@ package dtStatsGame{ } function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %teamSpecific, %msg){ parent::serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %teamSpecific, %msg); - if($dtStats::Enable){ + if($dtStats::Enable && (!%client.isAdmin || (%client.isAdmin && %client.ForceVote))){ %client.dtStats.voteCount++; if(%typeName $= "VoteChangeMission"){ %mission = $HostMissionFile[%arg3]; @@ -4010,13 +4010,13 @@ function dtStatsMissionDropReady(%game, %client){ // called when client has fini } function dtStatsClientLeaveGame(%client){ $dtServerVars::lastPlayerCount = $HostGamePlayerCount - $HostGameBotCount; - + if(isGameRun()){// if they dc during game over dont count it $dtServer::mapDisconnects[cleanMapName($CurrentMission),Game.class]++; if(%client.score != 0) $dtServer::mapDisconnectsScore[cleanMapName($CurrentMission),Game.class]++; } - + if(isObject(%client.dtStats)){ %client.dtStats.clientLeft = 1; %client.dtStats.leftTime = getSimTime(); @@ -12647,7 +12647,7 @@ function startMonitor(){ } } -function dtSaveServerVars(){ +function dtSaveServerVars(){ $dtServerVars::lastSimTime = getSimTime(); $dtServerVars::lastDate = formattimestring("mm/dd/yy hh:nn:a"); $dtServerVars::lastMission = cleanMapName($CurrentMission); @@ -12995,4 +12995,4 @@ function testVarsRandomAll(%max){ // Server crash messsage fix // // 9.3 -// Stat format change for flag cap times, they now start at 0 \ No newline at end of file +// Stat format change for flag cap times, they now start at 0 \ No newline at end of file diff --git a/Classic/scripts/autoexec/zzDiscordBot.cs b/Classic/scripts/autoexec/zzDiscordBot.cs index 9e36c79..0c78cd9 100644 --- a/Classic/scripts/autoexec/zzDiscordBot.cs +++ b/Classic/scripts/autoexec/zzDiscordBot.cs @@ -5,7 +5,7 @@ //exec("scripts/autoexec/zzDiscordBot.cs"); //ip of the bot -$discordBot::IP = ""; +$discordBot::IP = "127.0.0.1:28003"; $discordBot::reconnectTimeout = 3 * 60000; //auto connect on start $discordBot::autoStart = 0; @@ -203,7 +203,6 @@ function discordBotProcess(%type, %var1, %var2, %var3, %var4, %var5, %var6) sendToDiscordEmote(%msg, $discordBot::serverFeed); } } - function sendToDiscord(%msg,%channel) { if(isObject(discord) && %msg !$= "") @@ -286,15 +285,14 @@ function discord::onLine(%this, %line){ switch$(%cmd){ //case "Discord": //messageAll( 'MsgDiscord', '\c3Discord: \c4%1 %2',getWord(%lineStrip,1),getWords(%lineStrip,2,getWordCount(%lineStrip) -1)); - case "PLOTSTOP": - $pathMaps::running = 0; - case "PLOTPLAYER": - startPlayerPlot(getWord(%lineStrip,1)); case "GETSTAT": - %var = getWord(%lineStrip,1); - %mon = getWord(%lineStrip,2); - %year = getWord(%lineStrip,3); + %mon = getWord(%lineStrip,1); + %year = getWord(%lineStrip,2); + %var = getWord(%lineStrip,3); %game = getWord(%lineStrip,4); + if(%game $= ""){// default if not valid + %game = "CTFGame"; + } %returnIndex = getWord(%lineStrip,5); %nameList = $lData::name[%var,%game,"month",%mon,%year]; %dataList = $lData::data[%var,%game,"month",%mon,%year]; @@ -307,8 +305,12 @@ function discord::onLine(%this, %line){ $genStatsLockout = 1; %month = getWord(%lineStrip,1); %year = getWord(%lineStrip,2); + %game = getWord(%lineStrip,3); + if(%game $= ""){// default if not valid + %game = "CTFGame"; + } if(%month > 0 && %year > 0){ - schedule(1000, 0, "sendLDATA", %month, %year, "CTFGame"); + schedule(1000, 0, "sendLDATA", %month, %year, %game); } } else{ @@ -317,9 +319,9 @@ function discord::onLine(%this, %line){ case "PING": discord.send("PONG" @ $discordBot::cmdSplit @ "\r\n"); case "PINGAVG": - %min = 10000; - %max = -10000; - %lowCount = %lowPing = 0; + %min = 10000; + %max = -10000; + %lowCount = %lowPing = 0; for(%i = 0; %i < ClientGroup.getCount(); %i++){ %cl = ClientGroup.getObject(%i); %ping = %cl.isAIControlled() ? 0 : %cl.getPing(); @@ -353,6 +355,32 @@ function discord::onLine(%this, %line){ discord.schedule((%i+1)*32,"send","PROCSTACK" @ $discordBot::cmdSplit @ ($discordBot::monitorChannel) @ $discordBot::cmdSplit @ "msgList" @ "\r\n"); } } + case "BANLIST": + %found = 0; + for (%i = 0; %i < 100; %i++){ + if($dtBanList::NameList[%i] !$= ""){ + %fieldList = $dtBanList::NameList[%i]; + %msg = "Index:" @ %i SPC "Name:" @ getField(%fieldList,0) SPC "GUID:" @ getField(%fieldList,1); + %found++; + discord.schedule(%found*32,"send","MSGSTACK" @ $discordBot::cmdSplit @ ($discordBot::monitorChannel) @ $discordBot::cmdSplit @ %msg @ "\r\n"); + } + } + if(%found > 0){ + discord.schedule((%found+1)*32,"send","PROCSTACK" @ $discordBot::cmdSplit @ ($discordBot::monitorChannel) @ $discordBot::cmdSplit @ "banList" @ "\r\n"); + } + else{ + sendToDiscord("No active bans, see ban file for manual/older entries", $discordBot::monitorChannel); + } + case "UNBANINDEX": + %var = getWord(%lineStrip,1); + if($dtBanList::NameList[%var] !$= ""){ + %name = unbanIndex(%var); + sendToDiscord("User:" @ %name SPC "has been unbanned", $discordBot::monitorChannel); + } + else{ + sendToDiscord("Invalid Index", $discordBot::monitorChannel); + } + default: error("Discord Bad Command" SPC %line); } @@ -361,7 +389,7 @@ if(!isObject(discord) && $discordBot::autoStart){ discordCon(); } -function sendLDATA(%month, %year, %type){ +function sendLDATA(%month, %year, %game){ %file = new FileObject(); RootGroup.add(%file); %folderPath = "serverStats/LData/*.cs"; @@ -370,18 +398,16 @@ function sendLDATA(%month, %year, %type){ for (%i = 0; %i < %count; %i++){ %filepath = findNextfile(%folderPath); %fieldPath =strreplace(%filePath,"-","\t"); - %game = getField(%fieldPath,1); + %g = getField(%fieldPath,1); %m = getField(%fieldPath,2); // 0 path / 1 game / 2 mon / 3 year / 4 type / 5 .cs %y = getField(%fieldPath,3); //%lType = getField(%fieldPath,4); - if(%month $= %m && %y $= %year && %game $= %type){ + //error(%g SPC %game SPC %m SPC %month SPC %y SPC %year); + if(%month $= %m && %y $= %year && %g $= %game){ %found = 1; break; } } - $dtSendDataMon = %month; - $dtSendDataYear = %year; - $dtSendDataType = %type; if(isFile(%filepath) && %found){ sendToDiscord("Building Big Stats", $discordBot::monitorChannel); %file.OpenForRead(%filepath); @@ -389,11 +415,11 @@ function sendLDATA(%month, %year, %type){ while(!%file.isEOF()){ %line = %file.readLine(); if(strPos(%line,"%tguid") == -1){ - discord.schedule((%i++)*32,"send","STATSDATA" @ "%c%" @ $dtSendDataMon @ "%c%" @ $dtSendDataType @ "%c%" @ %line @ "\r\n"); + discord.schedule((%i++)*32,"send","STATSDATA" @ "%c%" @ %month @ "%c%" @ %game @ "%c%" @ %line @ "\r\n"); } } - error("Sent LData To Discord" SPC %month SPC %year SPC %type SPC %i); - discord.schedule((%i++*32)+1000,"send","PROCSTACK" @ $discordBot::cmdSplit @ ($discordBot::monitorChannel) @ $discordBot::cmdSplit @ "buildStats" @ $discordBot::cmdSplit @ %month @ $discordBot::cmdSplit @ %year @ $discordBot::cmdSplit @ %type @ $discordBot::cmdSplit @ "\r\n"); + //error("Sent LData To Discord" SPC %month SPC %year SPC %game SPC %i); + discord.schedule((%i++*32)+1000,"send","PROCSTACK" @ $discordBot::cmdSplit @ ($discordBot::monitorChannel) @ $discordBot::cmdSplit @ "buildStats" @ $discordBot::cmdSplit @ %month @ $discordBot::cmdSplit @ %year @ $discordBot::cmdSplit @ %game @ $discordBot::cmdSplit @ "\r\n"); schedule((%i++*32)+1000, 0, "unlockStatGen"); } @@ -406,80 +432,4 @@ function sendLDATA(%month, %year, %type){ } function unlockStatGen(){ $genStatsLockout = 0; -} - -//////////////////////////////////////////////////////////////////////////////// -//Player Path Maps -//////////////////////////////////////////////////////////////////////////////// - -$pathMaps::maxCount = 32000;// default point count -$pathMaps::speed = 500; -function sendPrx(%x){ - for(%i = %x; %i < $prx::count && (%i - %x) < 50; %i++){ - %line = $prx::data[%i]; - %msg = "CDATA" @ "%c%" @ %i @ "%c%" @ %line @ "\r\n"; - if(isObject(discord)) - discord.send(%msg); - //discord.schedule(%i,"send",%msg); - } - if(%i < $prx::count) - schedule(128, 0, "sendPrx", %i); - else - discord.schedule(5000,"send","PROCSTACK" @ $discordBot::cmdSplit @ ($discordBot::monitorChannel) @ $discordBot::cmdSplit @ "buildprx" @ $discordBot::cmdSplit @ $prx::terFile @ $discordBot::cmdSplit @ $prx::misFile @ "\r\n"); -} - -function startPlayerPlot(%count){ - if(!$pathMaps::running && (($MatchStarted + $missionRunning) == 2)){ - if(%count > 1000){ - $pathMaps::maxCount = %count; - } - $prx::terFile = Terrain.terrainFile; - $prx::misFile = $missionName; - $prx::count = 0; - $pathMaps::running = 1; - pathMapData(); - sendToDiscord("Player Plot Started" SPC $pathMaps::maxCount, $discordBot::monitorChannel); - error("Player Plot Started"); - } - else{ - sendToDiscord("Game Has Not Started Yet", $discordBot::monitorChannel); - } -} -function floorVector(%vec){ - return mFloor(getWord(%vec,0)) SPC mFloor(getWord(%vec,1)) SPC mFloor(getWord(%vec,2)); -} -function pathDataPoint(%client){ - %player = %client.player; - if(isObject(%player)){ - %veh = (isObject(%client.vehicleMounted)) ? %client.vehicleMounted.getDataBlock().getName() : 0; - $prx::data[$prx::Count] = %client.nameBase @ "%c" @ %pos @ "%c" @ %client.team @ "%c" @ isObject(%player.holdingFlag) @ "%c" @ %veh @ "%c" @ getSimTime(); - $prx::count++; - } -} -function pathMapData(){ //loop to collect player position data - for(%x = 0; %x < ClientGroup.getCount(); %x++){ - %client = ClientGroup.getObject(%x); - %player = %client.player; - if(isObject(%player)){ - %pos = %player.getPosition(); - %fpos = floorVector(%pos); - if(%player.lpm !$= %fpos){ - %veh = (isObject(%client.vehicleMounted)) ? %client.vehicleMounted.getDataBlock().getName() : 0; - $prx::data[$prx::Count] = %client.nameBase @ "%c" @ %pos @ "%c" @ %client.team @ "%c" @ isObject(%player.holdingFlag) @ "%c" @ %veh @ "%c" @ getSimTime(); - $prx::count++; - } - %player.lpm = %fpos; - } - } - if(!($prx::eCount++ % 10)){error("pathMapData" SPC $prx::Count);} - - if($pathMaps::running && (($MatchStarted + $missionRunning) == 2) && $prx::Count < $pathMaps::maxCount){// note will stop at end of mission - schedule($pathMaps::speed, 0,"pathMapData"); - } - else{ - $pathMaps::running = 0; - sendToDiscord("Player Plot Processing", $discordBot::monitorChannel); - error("Player Plot Tracking Has Ended"); - sendPrx(0); - } } \ No newline at end of file diff --git a/Classic/scripts/camera.cs b/Classic/scripts/camera.cs new file mode 100644 index 0000000..ecde139 --- /dev/null +++ b/Classic/scripts/camera.cs @@ -0,0 +1,736 @@ +$Camera::movementSpeed = 40; + +datablock CameraData(Observer) +{ + mode = "observerStatic"; + firstPersonOnly = true; +}; + +datablock CameraData(CommanderCamera) +{ + mode = "observerStatic"; + firstPersonOnly = true; +}; + +function CommanderCamera::onTrigger( %data, %obj, %trigger, %state ) +{ + // no need to do anything here. +} + +function Observer::onTrigger(%data,%obj,%trigger,%state) +{ + // state = 0 means that a trigger key was released + if (%state == 0) + return; + + //first, give the game the opportunity to prevent the observer action + if (!Game.ObserverOnTrigger(%data, %obj, %trigger, %state)) + return; + + //now observer functions if you press the "throw" + if (%trigger >= 4) + return; + + //trigger types: 0:fire 1:altTrigger 2:jump 3:jet 4:throw + %client = %obj.getControllingClient(); + if (%client == 0) + return; + + switch$ (%obj.mode) + { + case "justJoined": + // z0dd - ZOD, 7/15/03. Don't need to waste CPU on a demo check + //if (isDemo()) + // clearCenterPrint(%client); + if (%trigger == 0) //press FIRE + { + // clear intro message + clearBottomPrint( %client ); + + //spawn the player + commandToClient(%client, 'setHudMode', 'Standard'); + Game.assignClientTeam(%client); + Game.spawnPlayer( %client, $MatchStarted ); + + if( $MatchStarted ) + { + %client.camera.setFlyMode(); + %client.setControlObject( %client.player ); + } + else + { + %client.camera.getDataBlock().setMode( %client.camera, "pre-game", %client.player ); + %client.setControlObject( %client.camera ); + } + } + else if (%trigger == 3) //press JET + { + //cycle throw the static observer spawn points + %markerObj = Game.pickObserverSpawn(%client, true); + %transform = %markerObj.getTransform(); + %obj.setTransform(%transform); + %obj.setFlyMode(); + } + else if (%trigger == 2) //press JUMP + { + //switch the observer mode to observing clients + if (isObject(%client.observeFlyClient)) + serverCmdObserveClient(%client, %client.observeFlyClient); + else + serverCmdObserveClient(%client, -1); + + displayObserverHud(%client, %client.observeClient); + if(!%client.isAdmin) // z0dd - ZOD, 7/15/03. Only warn them if it isn't an admin watching. + messageClient(%client.observeClient, 'Observer', '\c1%1 is now observing you.', %client.name); + } + + case "playerDeath": + // Attached to a dead player - spawn regardless of trigger type + if(!%client.waitRespawn && getSimTime() > %client.suicideRespawnTime) + { + commandToClient(%client, 'setHudMode', 'Standard'); + Game.spawnPlayer( %client, true ); + %client.camera.setFlyMode(); + %client.setControlObject(%client.player); + } + + case "PreviewMode": + if (%trigger == 0) + { + commandToClient(%client, 'setHudMode', 'Standard'); + if( %client.lastTeam ) + Game.clientJoinTeam( %client, %client.lastTeam ); + else + { + Game.assignClientTeam( %client, true ); + + // Spawn the player: + Game.spawnPlayer( %client, false ); + } + %client.camera.setFlyMode(); + %client.setControlObject( %client.player ); + } + + case "toggleCameraFly": + // this is the default camera mode + + case "observerFly": + // Free-flying observer camera + if (%trigger == 0) + { + if( !$Host::TournamentMode && $MatchStarted ) + { + // reset observer params + clearBottomPrint(%client); + commandToClient(%client, 'setHudMode', 'Standard'); + + if( %client.lastTeam !$= "" && %client.lastTeam != 0 && Game.numTeams > 1) + { + Game.clientJoinTeam( %client, %client.lastTeam, $MatchStarted ); + %client.camera.setFlyMode(); + %client.setControlObject( %client.player ); + } + else + { + Game.assignClientTeam( %client ); + + // Spawn the player: + Game.spawnPlayer( %client, true ); + %client.camera.setFlyMode(); + %client.setControlObject( %client.player ); + ClearBottomPrint( %client ); + } + } + else if( !$Host::TournamentMode ) + { + clearBottomPrint(%client); + Game.assignClientTeam( %client ); + + // Spawn the player: + Game.spawnPlayer( %client, false ); + %client.camera.getDataBlock().setMode( %client.camera, "pre-game", %client.player ); + %client.setControlObject( %client.camera ); + } + } + else if (%trigger == 3) //press JET + { + %markerObj = Game.pickObserverSpawn(%client, true); + %transform = %markerObj.getTransform(); + %obj.setTransform(%transform); + %obj.setFlyMode(); + } + else if (%trigger == 2) //press JUMP + { + //switch the observer mode to observing clients + if (isObject(%client.observeFlyClient)) + serverCmdObserveClient(%client, %client.observeFlyClient); + else + serverCmdObserveClient(%client, -1); + + observerFollowUpdate( %client, %client.observeClient, false ); + displayObserverHud(%client, %client.observeClient); + if(!%client.isAdmin) // z0dd - ZOD, 7/15/03. Only warn them if it isn't an admin watching. + messageClient(%client.observeClient, 'Observer', '\c1%1 is now observing you.', %client.name); + } + + case "observerStatic": + // Non-moving observer camera + %next = (%trigger == 3 ? true : false); + %markerObj = Game.pickObserverSpawn(%client, %next); + %transform = %markerObj.getTransform(); + %obj.setTransform(%transform); + %obj.setFlyMode(); + + case "observerStaticNoNext": + // Non-moving, non-cycling observer camera + + case "observerTimeout": + // Player didn't respawn quickly enough + if (%trigger == 0) + { + clearBottomPrint(%client); + commandToClient(%client, 'setHudMode', 'Standard'); + if( %client.lastTeam ) + Game.clientJoinTeam( %client, %client.lastTeam, true ); + else + { + Game.assignClientTeam( %client ); + + // Spawn the player: + Game.spawnPlayer( %client, true ); + } + %client.camera.setFlyMode(); + %client.setControlObject( %client.player ); + } + else if (%trigger == 3) //press JET + { + %markerObj = Game.pickObserverSpawn(%client, true); + %transform = %markerObj.getTransform(); + %obj.setTransform(%transform); + %obj.setFlyMode(); + } + else if (%trigger == 2) //press JUMP + { + //switch the observer mode to observing clients + if (isObject(%client.observeFlyClient)) + serverCmdObserveClient(%client, %client.observeFlyClient); + else + serverCmdObserveClient(%client, -1); + + // update the observer list for this client + observerFollowUpdate( %client, %client.observeClient, false ); + + displayObserverHud(%client, %client.observeClient); + if(!%client.isAdmin) // z0dd - ZOD, 7/15/03. Only warn them if it isn't an admin watching. + messageClient(%client.observeClient, 'Observer', '\c1%1 is now observing you.', %client.name); + } + + case "observerFollow": + // Observer attached to a moving object (assume player for now...) + //press FIRE - cycle to next client + if (%trigger == 0) + { + %nextClient = findNextObserveClient(%client); + %prevObsClient = %client.observeClient; + if (%nextClient > 0 && %nextClient != %client.observeClient) + { + // update the observer list for this client + observerFollowUpdate( %client, %nextClient, true ); + + //set the new object + %transform = %nextClient.player.getTransform(); + //if( !%nextClient.isMounted() ) z0dd - ZOD, 7/15/03. DUH! + if( !%nextClient.player.isMounted() ) + { + //z0dd - ZOD, 7/15/03. Use datablock of armor for observer params + %params = %nextClient.player.getDataBlock().observeParameters; + %obj.setOrbitMode(%nextClient.player, %transform, getWord( %params, 0 ), getWord( %params, 1 ), getWord( %params, 2 )); + //%obj.setOrbitMode(%nextClient.player, %transform, 0.5, 4.5, 4.5); + %client.observeClient = %nextClient; + } + else + { + %mount = %nextClient.player.getObjectMount(); + if( %mount.getDataBlock().observeParameters $= "" ) + %params = %transform; + else + %params = %mount.getDataBlock().observeParameters; + + %obj.setOrbitMode(%mount, %mount.getTransform(), getWord( %params, 0 ), getWord( %params, 1 ), getWord( %params, 2 )); + %client.observeClient = %nextClient; + } + + //send the message(s) + displayObserverHud(%client, %nextClient); + if(!%client.isAdmin) // z0dd - ZOD, 7/15/03. Only warn them if it isn't an admin watching. + { + messageClient(%nextClient, 'Observer', '\c1%1 is now observing you.', %client.name); + messageClient(%prevObsClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name); + } + } + } + else if (%trigger == 3) //press JET - cycle to prev client + { + %prevClient = findPrevObserveClient(%client); + %prevObsClient = %client.observeClient; + if (%prevClient > 0 && %prevClient != %client.observeClient) + { + // update the observer list for this client + observerFollowUpdate( %client, %prevClient, true ); + + //set the new object + %transform = %prevClient.player.getTransform(); + //if( !%prevClient.isMounted() ) z0dd - ZOD, 7/15/03. DUH! + if( !%prevClient.player.isMounted() ) + { + //z0dd - ZOD, 7/15/03. Use datablock of armor for observer params + %params = %prevClient.player.getDataBlock().observeParameters; + %obj.setOrbitMode(%prevClient.player, %transform, getWord( %params, 0 ), getWord( %params, 1 ), getWord( %params, 2 )); + //%obj.setOrbitMode(%prevClient.player, %transform, 0.5, 4.5, 4.5); + %client.observeClient = %prevClient; + } + else + { + %mount = %prevClient.player.getObjectMount(); + if( %mount.getDataBlock().observeParameters $= "" ) + %params = %transform; + else + %params = %mount.getDataBlock().observeParameters; + + %obj.setOrbitMode(%mount, %mount.getTransform(), getWord( %params, 0 ), getWord( %params, 1 ), getWord( %params, 2 )); + %client.observeClient = %prevClient; + } + //send the message(s) + displayObserverHud(%client, %prevClient); + if(!%client.isAdmin) // z0dd - ZOD, 7/15/03. Only warn them if it isn't an admin watching. + { + messageClient(%prevClient, 'Observer', '\c1%1 is now observing you.', %client.name); + messageClient(%prevObsClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name); + } + } + } + else if (%trigger == 2) //press JUMP + { + // update the observer list for this client + observerFollowUpdate( %client, -1, false ); + + //toggle back to observer fly mode + %obj.mode = "observerFly"; + %obj.setFlyMode(); + updateObserverFlyHud(%client); + if(!%client.isAdmin) // z0dd - ZOD, 7/15/03. Only warn them if it isn't an admin watching. + messageClient(%client.observeClient, 'ObserverEnd', '\c1%1 is no longer observing you.', %client.name); + } + + case "pre-game": + if(!$Host::TournamentMode || $CountdownStarted) + return; + + %readySpamDif = getSimTime() - %client.readySpam; + %readySpamDif1 = getSimTime() - %client.readySpamMsg; + if(%readySpamDif > 10000 || !%client.readySpam) + { + %client.readySpam = getSimTime(); + if(%client.notReady) + { + %client.notReady = ""; + MessageAll( 0, '\c1%1 is READY.', %client.name ); + if(%client.notReadyCount < 3) + centerprint( %client, "\nWaiting for match start (FIRE if not ready)", 0, 3); + else + centerprint( %client, "\nWaiting for match start", 0, 3); + } + else + { + %client.notReadyCount++; + if(%client.notReadyCount < 4) + { + %client.notReady = true; + MessageAll( 0, '\c1%1 is not READY.', %client.name ); + centerprint( %client, "\nPress FIRE when ready.", 0, 3 ); + } + return; + } + + CheckTourneyMatchStart(); + } + else if((%readySpamDif1 > 1000 || !%client.readySpamMsg) && %client.notReadyCount < 4) + { + %client.readySpamMsg = getSimTime(); + %wait = mFloor((10000 - (getSimTime() - %client.readySpam)) / 1000); + messageClient(%client, 'MsgObserverCooldown', '\c3Ready Cooldown:\cr Please wait another %1 seconds.', %wait ); + } + + } +} + +function Observer::setMode(%data, %obj, %mode, %targetObj) +{ + if(%mode $= "") + return; + %client = %obj.getControllingClient(); + switch$ (%mode) { + case "justJoined": + commandToClient(%client, 'setHudMode', 'Observer'); + %markerObj = Game.pickObserverSpawn(%client, true); + %transform = %markerObj.getTransform(); + %obj.setTransform(%transform); + %obj.setFlyMode(); + + case "pre-game": + commandToClient(%client, 'setHudMode', 'Observer'); + //z0dd - ZOD, 7/15/03. Use datablock of armor for observer params + %params = %targetObj.getDataBlock().observeParameters; + %obj.setOrbitMode(%targetObj, %targetObj.getTransform(), getWord( %params, 0 ), getWord( %params, 1 ), getWord( %params, 2 )); + //%obj.setOrbitMode( %targetObj, %targetObj.getTransform(), 0.5, 4.5, 4.5); + + case "observerFly": + // Free-flying observer camera + commandToClient(%client, 'setHudMode', 'Observer'); + %markerObj = Game.pickObserverSpawn(%client, true); + %transform = %markerObj.getTransform(); + %obj.setTransform(%transform); + %obj.setFlyMode(); + + case "observerStatic" or "observerStaticNoNext": + // Non-moving observer camera + %markerObj = Game.pickObserverSpawn(%client, true); + %transform = %markerObj.getTransform(); + %obj.setTransform(%transform); + + case "observerFollow": + // Observer attached to a moving object (assume player for now...) + %transform = %targetObj.getTransform(); + + if( !%targetObj.isMounted() ) + { + //z0dd - ZOD, 7/15/03. Use datablock of armor for observer params + %params = %targetObj.getDataBlock().observeParameters; + %obj.setOrbitMode(%targetObj, %transform, getWord( %params, 0 ), getWord( %params, 1 ), getWord( %params, 2 )); + //%obj.setOrbitMode(%targetObj, %transform, 0.5, 4.5, 4.5); + } + else + { + %mount = %targetObj.getObjectMount(); + if( %mount.getDataBlock().observeParameters $= "" ) + %params = %transform; + else + %params = %mount.getDataBlock().observeParameters; + + %obj.setOrbitMode(%mount, %mount.getTransform(), getWord( %params, 0 ), getWord( %params, 1 ), getWord( %params, 2 )); + } + + case "observerTimeout": + commandToClient(%client, 'setHudMode', 'Observer'); + %markerObj = Game.pickObserverSpawn(%client, true); + %transform = %markerObj.getTransform(); + %obj.setTransform(%transform); + %obj.setFlyMode(); + } + %obj.mode = %mode; +} + +function findNextObserveClient(%client) +{ + %index = -1; + %count = ClientGroup.getCount(); + if (%count <= 1) + return -1; + + for (%i = 0; %i < %count; %i++) + { + %cl = ClientGroup.getObject(%i); + if (%cl == %client.observeClient) + { + %index = %i; + break; + } + } + + //now find the next client (note, if not found, %index still == -1) + %index++; + if (%index >= %count) + %index = 0; + + %newClient = -1; + for (%i = %index; %i < %count; %i++) + { + %cl = ClientGroup.getObject(%i); + if (%cl != %client && %cl.player > 0) + { + %newClient = %cl; + break; + } + } + + //if we didn't find anyone, search from the beginning again + if (%newClient < 0) + { + for (%i = 0; %i < %count; %i++) + { + %cl = ClientGroup.getObject(%i); + if (%cl != %client && %cl.player > 0) + { + %newClient = %cl; + break; + } + } + } + + //if we still haven't found anyone (new), give up.. + if (%newClient < 0 || %newClient.player == %player) + return -1; +} + +function findPrevObserveClient(%client) +{ + %index = -1; + %count = ClientGroup.getCount(); + if (%count <= 1) + return -1; + + for (%i = 0; %i < %count; %i++) + { + %cl = ClientGroup.getObject(%i); + if (%cl == %client.observeClient) + { + %index = %i; + break; + } + } + + //now find the prev client + %index--; + if (%index < 0) + %index = %count - 1; + + %newClient = -1; + for (%i = %index; %i >= 0; %i--) + { + %cl = ClientGroup.getObject(%i); + if (%cl != %client && %cl.player > 0) + { + %newClient = %cl; + break; + } + } + + //if we didn't find anyone, search from the end again + if (%newClient < 0) + { + for (%i = %count - 1; %i >= 0; %i--) + { + %cl = ClientGroup.getObject(%i); + if (%cl != %client && %cl.player > 0) + { + %newClient = %cl; + break; + } + } + } + + //if we still haven't found anyone (new), give up.. + if (%newClient < 0 || %newClient.player == %player) + return -1; +} + +function observeClient(%client) +{ + if( $testcheats ) + { + //pass in -1 to choose any client... + commandToServer('observeClient', %client); + } +} + +function serverCmdObserveClient(%client, %target) +{ + //clear the observer fly mode var... + %client.observeFlyClient = -1; + + //cancel any scheduled update + cancel(%client.obsHudSchedule); + + // must be an observer when observing other clients + if( %client.getControlObject() != %client.camera) + return; + + //can't observer yourself + if (%client == %target) + return; + + %count = ClientGroup.getCount(); + + //can't go into observer mode if you're the only client + if (%count <= 1) + return; + + //make sure the target actually exists + if (%target > 0) + { + %found = false; + for (%i = 0; %i < %count; %i++) + { + %cl = ClientGroup.getObject(%i); + if (%cl == %target) + { + %found = true; + break; + } + } + + if (!%found) + return; + } + else + { + %client.observeClient = -1; + %target = findNextObserveClient(%client); + if (%target <= 0) + return; + } + + //send the message + if (%client.camera.mode !$= "observerFollow") + { + if (isObject(%client.player)) + %client.player.scriptKill(0); + + //messageAllExcept(%client, -1, 'ClientNowObserver', '\c1%1 is now an observer.', %client.name); + //messageClient(%client, 'YouNowObserver', '\c1You are now observing %1.', %target.name); + } + + %client.camera.getDataBlock().setMode(%client.camera, "observerFollow", %target.player); + %client.setControlObject(%client.camera); + + //tag is used if a client who is being observed dies... + %client.observeClient = %target; +} + +function observerFollowUpdate( %client, %nextClient, %cycle ) +{ + %Oclient = %client.observeClient; + if( %Oclient $= "" ) + return; + + // changed to observer fly... + if( %nextClient == -1 ) + { + // find us in their observer list and remove, then reshuffle the list... + for( %i = 0; %i < %Oclient.observeCount; %i++ ) + { + if( %Oclient.observers[%i] == %client ) + { + %Oclient.observeCount--; + %Oclient.observers[%i] = %Oclient.observers[%Oclient.observeCount]; + %Oclient.observers[%Oclient.observeCount] = ""; + break; + } + } + return; // were done.. + } + + // changed from observer fly to observer follow... + if( !%cycle && %nextClient != -1 ) + { + // if nobody is observing this guy, initialize their observer count... + if( %nextClient.observeCount $= "" ) + %nextClient.observeCount = 0; + + // add us to their list of observers... + %nextClient.observers[%nextClient.observeCount] = %client; + %nextClient.observeCount++; + return; // were done. + } + + if( %nextClient != -1 ) + { + // cycling to the next client... + for( %i = 0; %i < %Oclient.observeCount; %i++ ) + { + // first remove us from our prev client's list... + if( %Oclient.observers[%i] == %client ) + { + %Oclient.observeCount--; + %Oclient.observers[%i] = %Oclient.observers[%Oclient.observeCount]; + %Oclient.observers[%Oclient.observeCount] = ""; + break; // screw you guys, i'm goin home! + } + } + + // if nobody is observing this guy, initialize their observer count... + if( %nextClient.observeCount $= "" ) + %nextClient.observeCount = 0; + + // now add us to the new clients list... + %nextClient.observeCount++; + %nextClient.observers[%nextClient.observeCount - 1] = %client; + } +} + +function updateObserverFlyHud(%client) +{ + //just in case there are two threads going... + cancel(%client.obsHudSchedule); + %client.observeFlyClient = -1; + + //make sure the client is supposed to be in observer fly mode... + if (!isObject(%client) || %client.team != 0 || %client.getControlObject() != %client.camera || %client.camera.mode $= "observerFollow") + return; + + //get various info about the player's eye + %srcEyeTransform = %client.camera.getTransform(); + %srcEyePoint = firstWord(%srcEyeTransform) @ " " @ getWord(%srcEyeTransform, 1) @ " " @ getWord(%srcEyeTransform, 2); + + %srcEyeVector = MatrixMulVector("0 0 0 " @ getWords(%srcEyeTransform, 3, 6), "0 1 0"); + %srcEyeVector = VectorNormalize(%srcEyeVector); + + //see if there's an enemy near our defense location... + %clientCount = 0; + %count = ClientGroup.getCount(); + %viewedClient = -1; + %clientDot = -1; + for(%i = 0; %i < %count; %i++) + { + %cl = ClientGroup.getObject(%i); + + //make sure we find an AI who's alive and not the client + if (%cl != %client && isObject(%cl.player)) + { + //make sure the player is within range + %clPos = %cl.player.getWorldBoxCenter(); + %distance = VectorDist(%clPos, %srcEyePoint); + if (%distance <= 30) + { + //create the vector from the client to the client + %clVector = VectorNormalize(VectorSub(%clPos, %srcEyePoint)); + + //see if the dot product is greater than our current, and greater than 0.6 + %dot = VectorDot(%clVector, %srcEyeVector); + + if (%dot > 0.6 && %dot > %clientDot) + { + //make sure we're not looking through walls... + %mask = $TypeMasks::TerrainObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::StaticShapeObjectType; + %losResult = containerRayCast(%srcEyePoint, %clPos, %mask); + %losObject = GetWord(%losResult, 0); + if (!isObject(%losObject)) + { + %viewedClient = %cl; + %clientDot = %dot; + } + } + } + } + } + + if (isObject(%viewedClient)) + displayObserverHud(%client, 0, %viewedClient); + else + displayObserverHud(%client, 0); + + %client.observeFlyClient = %viewedClient; + + //schedule the next... + %client.obsHudSchedule = schedule(500, %client, updateObserverFlyHud, %client); +} diff --git a/Classic/scripts/defaultGame.cs b/Classic/scripts/defaultGame.cs index 0a12959..af2121d 100755 --- a/Classic/scripts/defaultGame.cs +++ b/Classic/scripts/defaultGame.cs @@ -1802,7 +1802,7 @@ function DefaultGame::clientMissionDropReady(%game, %client) %damMess = "DISABLED"; if(%game.numTeams > 1) - BottomPrint(%client, "Server is Running in Tournament Mode.\nPick a Team\nTeam Damage is " @ %damMess, 0, 3 ); + BottomPrint(%client, "Server is Running in Tournament Mode.\nGood luck and Have Fun!\nTeam Damage is " @ %damMess, 0, 3 ); } else { @@ -2973,13 +2973,13 @@ function DefaultGame::sendGameTeamList( %game, %client, %key ) //------------------------------------------------------------------------------ function DefaultGame::sendTimeLimitList( %game, %client, %key ) { + messageClient( %client, 'MsgVoteItem', "", %key, 30, "", '30 minutes' ); + messageClient( %client, 'MsgVoteItem', "", %key, 45, "", '45 minutes' ); + messageClient( %client, 'MsgVoteItem', "", %key, 60, "", '60 minutes' ); + messageClient( %client, 'MsgVoteItem', "", %key, 75, "", '75 minutes' ); messageClient( %client, 'MsgVoteItem', "", %key, 90, "", '90 minutes' ); - messageClient( %client, 'MsgVoteItem', "", %key, 120, "", '120 minutes' ); - messageClient( %client, 'MsgVoteItem', "", %key, 150, "", '150 minutes' ); messageClient( %client, 'MsgVoteItem', "", %key, 180, "", '180 minutes' ); - messageClient( %client, 'MsgVoteItem', "", %key, 240, "", '240 minutes' ); messageClient( %client, 'MsgVoteItem', "", %key, 360, "", '360 minutes' ); - messageClient( %client, 'MsgVoteItem', "", %key, 480, "", '480 minutes' ); messageClient( %client, 'MsgVoteItem', "", %key, 999, "", 'No time limit' ); } @@ -3385,9 +3385,10 @@ function DefaultGame::voteAdminPlayer(%game, %admin, %client) if (%admin) { - messageAll('MsgAdminAdminPlayer', '\c2The Admin %3 made %2 an admin.', %client, %client.name, $AdminCl.name); + messageAll('MsgAdminAdminPlayer', '\c2The Admin %3 made %2 an admin.', %client, %client.name, %admin.nameBase); %client.isAdmin = 1; %cause = "(admin)"; + adminLog(%admin, " has made" SPC %client.nameBase @ "(" @ %client.guid @ ") an admin."); } else { @@ -3402,6 +3403,7 @@ function DefaultGame::voteAdminPlayer(%game, %admin, %client) else messageAll('MsgVoteFailed', '\c2Vote to make %1 an admin did not pass.', %client.name); } + if(%cause !$= "") logEcho($AdminCl.nameBase @ ": " @ %client.nameBase@" (cl "@%client@") made admin "@%cause, 1); } @@ -3847,10 +3849,9 @@ function notifyMatchEnd(%time) { %seconds = mFloor(%time / 1000); - if (%seconds > 1) { + if(%seconds > 1) MessageAll('MsgMissionEnd', '\c2Match ends in %1 seconds.~wfx/misc/hunters_%1.wav', %seconds); - } - else if (%seconds == 1) + else if(%seconds == 1) MessageAll('MsgMissionEnd', '\c2Match ends in 1 second.~wfx/misc/hunters_1.wav'); UpdateClientTimes(%time); @@ -3860,9 +3861,15 @@ function notifyMatchEndMinutes(%time) { %seconds = mFloor(%time / 1000); - if (%seconds == 180) + if(%seconds == 900 && $Host::TournamentMode) + MessageAll('MsgMissionEndMinutes', '\c2Match ends in 15 minutes.~wfx/misc/flagself.wav'); + else if(%seconds == 600 && $Host::TournamentMode) + MessageAll('MsgMissionEndMinutes', '\c2Match ends in 10 minutes.~wfx/misc/flagself.wav'); + else if(%seconds == 300 && $Host::TournamentMode) + MessageAll('MsgMissionEndMinutes', '\c2Match ends in 5 minutes.~wfx/misc/flagself.wav'); + else if(%seconds == 180) MessageAll('MsgMissionEndMinutes', '\c2Match ends in 3 minutes.~wfx/misc/flagself.wav'); - else if (%seconds == 120) + else if(%seconds == 120) MessageAll('MsgMissionEndMinutes', '\c2Match ends in 2 minutes.~wfx/misc/flagself.wav'); UpdateClientTimes(%time); diff --git a/Classic/scripts/dtChatCmdGame.cs b/Classic/scripts/dtChatCmdGame.cs index 199456d..f517e33 100755 --- a/Classic/scripts/dtChatCmdGame.cs +++ b/Classic/scripts/dtChatCmdGame.cs @@ -955,7 +955,7 @@ function explodeFirework(%position, %id) }; //echo(%emitter.position); - serverPlay3d(dtFireworksSound, %emitter.position); + //serverPlay3d(dtFireworksSound, %emitter.position); MissionCleanup.add(%emitter); %emitter.schedule(1250, "delete"); } diff --git a/Classic/scripts/player.cs b/Classic/scripts/player.cs index fbebed0..84abb9f 100755 --- a/Classic/scripts/player.cs +++ b/Classic/scripts/player.cs @@ -187,7 +187,7 @@ datablock AudioProfile(CorpseLootingSound) preload = true; effect = CorpseLootingEffect; }; - + datablock AudioProfile(ArmorMoveBubblesSound) { filename = "fx/armor/bubbletrail2.wav"; @@ -1085,8 +1085,8 @@ datablock ParticleData(LightPuff) textureName = "particleTest"; colors[0] = "0.46 0.36 0.26 0.4"; colors[1] = "0.46 0.46 0.36 0.0"; - sizes[0] = 0.4; - sizes[1] = 1.0; + sizes[0] = 0.8; //was 0.4 + sizes[1] = 1.4; //was 1.0 }; datablock ParticleEmitterData(LightPuffEmitter) @@ -1123,9 +1123,9 @@ datablock ParticleData(LiftoffDust) colors[0] = "0.46 0.36 0.26 0.0"; colors[1] = "0.46 0.46 0.36 0.4"; colors[2] = "0.46 0.46 0.36 0.0"; - sizes[0] = 0.2; - sizes[1] = 0.6; - sizes[2] = 1.0; + sizes[0] = 0.6; //was 0.2 + sizes[1] = 1.0; //was 0.6 + sizes[2] = 1.4; //was 1.0 times[0] = 0.0; times[1] = 0.5; times[2] = 1.0; @@ -1193,11 +1193,11 @@ datablock DebrisData( PlayerDebris ) velocity = 18.0; velocityVariance = 12.0; -}; +}; // z0dd - ZOD, 4/21/02. Altered most of these properties datablock PlayerData(LightMaleHumanArmor) : LightPlayerDamageProfile -{ +{ emap = true; className = Armor; @@ -1316,8 +1316,8 @@ datablock PlayerData(LightMaleHumanArmor) : LightPlayerDamageProfile splashEmitter[0] = PlayerFoamDropletsEmitter; splashEmitter[1] = PlayerFoamEmitter; splashEmitter[2] = PlayerBubbleEmitter; - mediumSplashSoundVelocity = 10.0; - hardSplashSoundVelocity = 20.0; + mediumSplashSoundVelocity = 10.0; + hardSplashSoundVelocity = 20.0; exitSplashSoundVelocity = 5.0; // Controls over slope of runnable/jumpable surfaces @@ -1436,7 +1436,7 @@ datablock PlayerData(LightMaleHumanArmor) : LightPlayerDamageProfile observeParameters = "0.5 4.5 4.5"; shieldEffectScale = "0.7 0.7 1.0"; - + //Kills autopoints detectsUsingLOSEnemy[1] = true; detectsUsingLOSEnemy[2] = true; @@ -1453,7 +1453,7 @@ datablock DecalData(MediumMaleFootprint) // z0dd - ZOD, 4/21/02. Altered most of these properties datablock PlayerData(MediumMaleHumanArmor) : MediumPlayerDamageProfile -{ +{ emap = true; className = Armor; @@ -1574,7 +1574,7 @@ datablock PlayerData(MediumMaleHumanArmor) : MediumPlayerDamageProfile boxHeadRightPercentage = 1; boxHeadBackPercentage = 0; boxHeadFrontPercentage = 1; - + //Foot Prints decalData = MediumMaleFootprint; decalOffset = 0.35; @@ -1594,8 +1594,8 @@ datablock PlayerData(MediumMaleHumanArmor) : MediumPlayerDamageProfile splashEmitter[0] = PlayerFoamDropletsEmitter; splashEmitter[1] = PlayerFoamEmitter; splashEmitter[2] = PlayerBubbleEmitter; - mediumSplashSoundVelocity = 10.0; - hardSplashSoundVelocity = 20.0; + mediumSplashSoundVelocity = 10.0; + hardSplashSoundVelocity = 20.0; exitSplashSoundVelocity = 5.0; footstepSplashHeight = 0.35; @@ -1694,7 +1694,7 @@ datablock PlayerData(MediumMaleHumanArmor) : MediumPlayerDamageProfile observeParameters = "0.5 4.5 4.5"; shieldEffectScale = "0.7 0.7 1.0"; - + //Kills autopoints detectsUsingLOSEnemy[1] = true; detectsUsingLOSEnemy[2] = true; @@ -1761,7 +1761,7 @@ datablock PlayerData(HeavyMaleHumanArmor) : HeavyPlayerDamageProfile maxDamage = 1.32; maxEnergy = 110; repairRate = 0.0033; - + //Value changed halfway between base and classic. //Classic is 54, Base is 75 //Shield breaks right at two mine-disc @@ -1853,8 +1853,8 @@ datablock PlayerData(HeavyMaleHumanArmor) : HeavyPlayerDamageProfile splashEmitter[0] = PlayerFoamDropletsEmitter; splashEmitter[1] = PlayerFoamEmitter; splashEmitter[2] = PlayerBubbleEmitter; - mediumSplashSoundVelocity = 10.0; - hardSplashSoundVelocity = 20.0; + mediumSplashSoundVelocity = 10.0; + hardSplashSoundVelocity = 20.0; exitSplashSoundVelocity = 5.0; footstepSplashHeight = 0.35; @@ -1953,7 +1953,7 @@ datablock PlayerData(HeavyMaleHumanArmor) : HeavyPlayerDamageProfile observeParameters = "0.5 4.5 4.5"; shieldEffectScale = "0.7 0.7 1.0"; - + //Kills autopoints detectsUsingLOSEnemy[1] = true; detectsUsingLOSEnemy[2] = true; @@ -1998,7 +1998,7 @@ datablock PlayerData(LightMaleBiodermArmor) : LightMaleHumanArmor debrisShapeName = "bio_player_debris.dts"; - + //Foot Prints decalData = LightBiodermFootprint; decalOffset = 0.3; @@ -2023,7 +2023,7 @@ datablock PlayerData(MediumMaleBiodermArmor) : MediumMaleHumanArmor debrisShapeName = "bio_player_debris.dts"; //Foot Prints - decalData = MediumBiodermFootprint; + decalData = MediumBiodermFootprint; decalOffset = 0.35; waterBreathSound = WaterBreathBiodermSound; @@ -2049,7 +2049,7 @@ datablock PlayerData(HeavyMaleBiodermArmor) : HeavyMaleHumanArmor //Foot Prints decalData = HeavyBiodermFootprint; decalOffset = 0.4; - + waterBreathSound = WaterBreathBiodermSound; }; @@ -2122,17 +2122,17 @@ function Armor::onMount(%this,%obj,%vehicle,%node) if(!%obj.inStation) %obj.lastWeapon = (%obj.getMountedImage($WeaponSlot) == 0 ) ? "" : %obj.getMountedImage($WeaponSlot).item; - + %obj.unmountImage($WeaponSlot); - + if(!%obj.client.isAIControlled()) { %obj.setControlObject(%vehicle); %obj.client.setObjectActiveImage(%vehicle, 2); } - + //E3 respawn... - + if(%obj == %obj.lastVehicle.lastPilot && %obj.lastVehicle != %vehicle) { schedule(15000, %obj.lastVehicle,"vehicleAbandonTimeOut", %obj.lastVehicle); @@ -2140,14 +2140,14 @@ function Armor::onMount(%this,%obj,%vehicle,%node) } if(%vehicle.lastPilot !$= "" && %vehicle == %vehicle.lastPilot.lastVehicle) %vehicle.lastPilot.lastVehicle = ""; - + %vehicle.abandon = false; %vehicle.lastPilot = %obj; %obj.lastVehicle = %vehicle; // update the vehicle's team if((%vehicle.getTarget() != -1) && %vehicle.getDatablock().cantTeamSwitch $= "") - { + { setTargetSensorGroup(%vehicle.getTarget(), %obj.client.getSensorGroup()); if( %vehicle.turretObject > 0 ) setTargetSensorGroup(%vehicle.turretObject.getTarget(), %obj.client.getSensorGroup()); @@ -2207,9 +2207,9 @@ function Armor::onUnmount( %this, %obj, %vehicle, %node ) %obj.use(%obj.lastWeapon); else { - if(%obj.getMountedImage($WeaponSlot) == 0) + if(%obj.getMountedImage($WeaponSlot) == 0) %obj.selectWeaponSlot( 0 ); - } + } //Inform gunner position when pilot leaves... //if(%vehicle.getDataBlock().showPilotInfo !$= "") // if((%gunner = %vehicle.getMountNodeObject(1)) != 0) @@ -2271,7 +2271,7 @@ function Armor::onCollision(%this,%obj,%col,%forceVehicleNode) //to ensure they mount the turret before the passenger seat, regardless of where they collide... if (%obj.client.isAIControlled()) { - %transform = %col.getTransform(); + %transform = %col.getTransform(); //either the AI is *required* to pilot, or they'll pick the first available passenger seat if (%client.pilotVehicle) @@ -2312,7 +2312,7 @@ function Armor::onCollision(%this,%obj,%col,%forceVehicleNode) } if(%col.noEnemyControl && %obj.team != %col.team) return; - + commandToClient(%obj.client,'SetDefaultVehicleKeys', true); //If pilot or passenger then bind a few extra keys if(%node == 0) @@ -2329,7 +2329,7 @@ function Armor::onCollision(%this,%obj,%col,%forceVehicleNode) if (%obj.client.isAIControlled() && %node == 1 && (%type $= "BomberFlyer" || %type $= "AssaultVehicle")) { //%client.player.setActionThread(%col.getDataBlock().mountPose[0], true, true); - %client.player.setActionThread(sitting, true, true); + %client.player.setActionThread(sitting, true, true); } %col.mountObject(%obj,%node); @@ -2350,7 +2350,7 @@ function Armor::onCollision(%this,%obj,%col,%forceVehicleNode) %gotSomething = false; // it's corpse-looting time! // weapons -- don't pick up more than you are allowed to carry! - for(%i = 0; ( %obj.weaponCount < %obj.getDatablock().maxWeapons ) && $InvWeapon[%i] !$= ""; %i++) + for(%i = 0; ( %obj.weaponCount < %obj.getDatablock().maxWeapons ) && $InvWeapon[%i] !$= ""; %i++) { %weap = $NameToInv[$InvWeapon[%i]]; if ( %col.hasInventory( %weap ) ) @@ -2498,7 +2498,7 @@ function Player::resetFlagTossWait(%this) function Player::resetSitMessage(%obj) { - %obj.noSitMessage = false; + %obj.noSitMessage = false; } function Player::setInvincible(%this, %val) @@ -2508,9 +2508,9 @@ function Player::setInvincible(%this, %val) function Player::causedRecentDamage(%this, %val) { - %this.causedRecentDamage = %val; + %this.causedRecentDamage = %val; } - + function hasLargePack(%player) { %pack = %player.getMountedImage($BackpackSlot); @@ -2609,7 +2609,7 @@ function Armor::doDismount(%this, %obj, %forced) %obj.unmount(); if(%obj.mVehicle) %obj.mVehicle.getDataBlock().playerDismounted(%obj.mVehicle, %obj); - + // bots don't change their control objects when in vehicles if(!%obj.client.isAIControlled()) { @@ -2652,7 +2652,7 @@ function resetObserveFollow( %client, %dismount ) if ( %client.observers[%i].clientObserve != %client ) continue; - %client.observers[%i].camera.setOrbitMode( %client.player, %client.player.getTransform(), 0.5, 4.5, 4.5); + %client.observers[%i].camera.setOrbitMode( %client.player, %client.player.getTransform(), 0.5, 4.5, 4.5); } } else @@ -2666,7 +2666,7 @@ function resetObserveFollow( %client, %dismount ) %params = %client.player.getTransform(); else %params = %mount.getDataBlock().observeParameters; - + for( %i = 0; %i < %client.observeCount; %i++ ) { // z0dd - ZOD, 5/21/03. Make sure this client actually obs this client @@ -2675,7 +2675,7 @@ function resetObserveFollow( %client, %dismount ) %client.observers[%i].camera.setOrbitMode(%mount, %mount.getTransform(), getWord( %params, 0 ), getWord( %params, 1 ), getWord( %params, 2 )); } - } + } } @@ -2683,7 +2683,7 @@ function resetObserveFollow( %client, %dismount ) function Player::scriptKill(%player, %damageType) { - %player.scriptKilled = 1; + %player.scriptKilled = 1; %player.setInvincible(false); %player.damage(0, %player.getPosition(), 10000, %damageType); } @@ -2695,7 +2695,7 @@ function Armor::damageObject(%data, %targetObject, %sourceObject, %position, %am return; //---------------------------------------------------------------- - // z0dd - ZOD, 6/09/02. Check to see if this vehicle is destroyed, + // z0dd - ZOD, 6/09/02. Check to see if this vehicle is destroyed, // if it is do no damage. Fixes vehicle ghosting bug. We do not // check for isObject here, destroyed objects fail it even though // they exist as objects, go figure. @@ -2730,7 +2730,7 @@ function Armor::damageObject(%data, %targetObject, %sourceObject, %position, %am } else { - if(%damageType != $DamageType::Laser && %damageType != $DamageType::Bullet && %damageType != $DamageType::Blaster) + if(%damageType != $DamageType::Laser && %damageType != $DamageType::Bullet && %damageType != $DamageType::Blaster) return; } } @@ -2740,7 +2740,7 @@ function Armor::damageObject(%data, %targetObject, %sourceObject, %position, %am %targetClient = %targetObject.getOwnerClient(); if(isObject(%mineSC)) - %sourceClient = %mineSC; + %sourceClient = %mineSC; else %sourceClient = isObject(%sourceObject) ? %sourceObject.getOwnerClient() : 0; @@ -2754,7 +2754,7 @@ function Armor::damageObject(%data, %targetObject, %sourceObject, %position, %am else if(%damageType == $DamageType::Suicide) %sourceTeam = 0; //-------------------------------------------------------------------------------------------------------------------- - // z0dd - ZOD, 4/8/02. Check to see if this turret has a valid owner, if not clear the variable. + // z0dd - ZOD, 4/8/02. Check to see if this turret has a valid owner, if not clear the variable. else if(isObject(%sourceObject) && %sourceObject.getClassName() $= "Turret") { %sourceTeam = getTargetSensorGroup(%sourceObject.getTarget()); @@ -2794,11 +2794,11 @@ function Armor::damageObject(%data, %targetObject, %sourceObject, %position, %am %damageScale = %data.damageScale[%damageType]; if(%damageScale !$= "") %amount *= %damageScale; - + %flash = %targetObject.getDamageFlash() + (%amount * 2); if (%flash > 0.75) %flash = 0.75; - + // Teratos: Originally from Eolk? Mine+Disc tracking/death message support. // No Schedules by DarkTiger Ver.2 %targetClient.mineDisc = false; @@ -2807,17 +2807,17 @@ function Armor::damageObject(%data, %targetObject, %sourceObject, %position, %am case $DamageType::Disc: if((getSimTime() - %targetClient.mdcTime1) < 256) %targetClient.mineDisc = true; - - %targetClient.mdcTime2 = getSimTime(); + + %targetClient.mdcTime2 = getSimTime(); case $DamageType::Mine: if((getSimTime() - %targetClient.mdcTime2) < 256) %targetClient.mineDisc = true; - - %targetClient.mdcTime1 = getSimTime(); + + %targetClient.mdcTime1 = getSimTime(); } // -- End Mine+Disc insert. - + %previousDamage = %targetObject.getDamagePercent(); %targetObject.setDamageFlash(%flash); %targetObject.applyDamage(%amount); @@ -2826,49 +2826,49 @@ function Armor::damageObject(%data, %targetObject, %sourceObject, %position, %am %targetClient.lastDamagedBy = %damagingClient; %targetClient.lastDamaged = getSimTime(); - //now call the "onKilled" function if the client was... you know... + //now call the "onKilled" function if the client was... you know... if(%targetObject.getState() $= "Dead") { // where did this guy get it? %damLoc = %targetObject.getDamageLocation(%position); - + // should this guy be blown apart? - if( %damageType == $DamageType::Explosion || + if( %damageType == $DamageType::Explosion || %damageType == $DamageType::TankMortar || %damageType == $DamageType::Mortar || %damageType == $DamageType::MortarTurret || %damageType == $DamageType::BomberBombs || %damageType == $DamageType::SatchelCharge || - %damageType == $DamageType::Missile ) + %damageType == $DamageType::Missile ) { if( %previousDamage >= 0.35 ) // only if <= 35 percent damage remaining { %targetObject.setMomentumVector(%momVec); - %targetObject.blowup(); + %targetObject.blowup(); } } - + // this should be funny... if( %damageType == $DamageType::VehicleSpawn ) - { + { %targetObject.setMomentumVector("0 0 1"); %targetObject.blowup(); } - + // If we were killed, max out the flash %targetObject.setDamageFlash(0.75); - + %damLoc = %targetObject.getDamageLocation(%position); Game.onClientKilled(%targetClient, %sourceClient, %damageType, %sourceObject, %damLoc); } else if ( %amount > 0.1 ) - { + { if( %targetObject.station $= "" && %targetObject.isCloaked() ) { %targetObject.setCloaked( false ); - %targetObject.reCloak = %targetObject.schedule( 500, "setCloaked", true ); + %targetObject.reCloak = %targetObject.schedule( 500, "setCloaked", true ); } - + playPain( %targetObject ); } } @@ -2883,101 +2883,101 @@ function Armor::applyConcussion( %this, %dist, %radius, %sourceObject, %targetOb { %percentage = 1 - ( %dist / %radius ); %random = getRandom(); - + if( %sourceObject == %targetObject ) - { + { %flagChance = 1.0; %itemChance = 1.0; } else - { + { %flagChance = 0.75; - %itemChance = 0.75; + %itemChance = 0.75; } - + %probabilityFlag = %flagChance * %percentage; - %probabilityItem = %itemChance * %percentage; - + %probabilityItem = %itemChance * %percentage; + if( %random <= %probabilityFlag ) - Game.applyConcussion( %targetObject ); - + Game.applyConcussion( %targetObject ); + if( %random <= %probabilityItem ) { %player = %targetObject; %numWeapons = 0; - + // blaster 0 // plasma 1 // chain 2 - // disc 3 + // disc 3 // grenade 4 // snipe 5 // elf 6 // mortar 7 - + //get our inventory - if( %weaps[0] = %player.getInventory("Blaster") > 0 ) %numWeapons++; - if( %weaps[1] = %player.getInventory("Plasma") > 0 ) %numWeapons++; - if( %weaps[2] = %player.getInventory("Chaingun") > 0 ) %numWeapons++; - if( %weaps[3] = %player.getInventory("Disc") > 0 ) %numWeapons++; - if( %weaps[4] = %player.getInventory("GrenadeLauncher") > 0 ) %numWeapons++; + if( %weaps[0] = %player.getInventory("Blaster") > 0 ) %numWeapons++; + if( %weaps[1] = %player.getInventory("Plasma") > 0 ) %numWeapons++; + if( %weaps[2] = %player.getInventory("Chaingun") > 0 ) %numWeapons++; + if( %weaps[3] = %player.getInventory("Disc") > 0 ) %numWeapons++; + if( %weaps[4] = %player.getInventory("GrenadeLauncher") > 0 ) %numWeapons++; if( %weaps[5] = %player.getInventory("SniperRifle") > 0 ) %numWeapons++; if( %weaps[6] = %player.getInventory("ELFGun") > 0 ) %numWeapons++; if( %weaps[7] = %player.getInventory("Mortar") > 0 ) %numWeapons++; - + %foundWeapon = false; %attempts = 0; - - if( %numWeapons > 0 ) - { + + if( %numWeapons > 0 ) + { while( !%foundWeapon ) { %rand = mFloor( getRandom() * 8 ); if( %weaps[ %rand ] ) { %foundWeapon = true; - + switch ( %rand ) { case 0: - %player.use("Blaster"); + %player.use("Blaster"); case 1: - %player.use("Plasma"); + %player.use("Plasma"); case 2: - %player.use("Chaingun"); + %player.use("Chaingun"); case 3: - %player.use("Disc"); + %player.use("Disc"); case 4: - %player.use("GrenadeLauncher"); - case 5: - %player.use("SniperRifle"); + %player.use("GrenadeLauncher"); + case 5: + %player.use("SniperRifle"); case 6: - %player.use("ElfGun"); + %player.use("ElfGun"); case 7: - %player.use("Mortar"); + %player.use("Mortar"); } - + %image = %player.getMountedImage( $WeaponSlot ); %player.throw( %image.item ); %player.client.setWeaponsHudItem( %image.item, 0, 0 ); %player.throwPack(); } else - { + { %attempts++; if( %attempts > 10 ) %foundWeapon = true; - } + } } } else { %targetObject.throwPack(); %targetObject.throwWeapon(); - } + } } - -} + +} //---------------------------------------------------------------------------- @@ -3000,7 +3000,7 @@ function playPain( %obj ) %client = %obj.client; %random = getRandom(1) + 1; %desc = AudioClosest3d; - + playTargetAudio( %client.target, $PainCry[%random], %desc, false); } @@ -3050,8 +3050,8 @@ function Player::pickup(%this,%obj,%amount) %this.getMountedImage($BackpackSlot) != 0) return 0; // don't pick up a weapon (other than targeting laser) if player's at maxWeapons - else if(%data.className $= Weapon - && %data.getName() !$= "TargetingLaser" // Special case + else if(%data.className $= Weapon + && %data.getName() !$= "TargetingLaser" // Special case && %this.weaponCount >= %this.getDatablock().maxWeapons) return 0; // don't allow players to throw large packs at pilots (thanks Wizard) @@ -3067,7 +3067,7 @@ function Player::use( %this,%data ) return false; // Convert the word "Backpack" to whatever is in the backpack slot. - if ( %data $= "Backpack" ) + if ( %data $= "Backpack" ) { if ( %this.inStation ) return false; @@ -3082,17 +3082,17 @@ function Player::use( %this,%data ) messageClient( %this.client, 'MsgCantUsePack', '\c2You can\'t use your pack while in a weaponry position.~wfx/misc/misc.error.wav' ); return( false ); } - + %image = %this.getMountedImage( $BackpackSlot ); if ( %image ) %data = %image.item; } // Can't use some items when piloting or your a weapon operator - if ( %this.isPilot() || %this.isWeaponOperator() ) + if ( %this.isPilot() || %this.isWeaponOperator() ) if ( %data.getName() !$= "RepairKit" ) return false; - + return ShapeBase::use( %this, %data ); } @@ -3125,13 +3125,13 @@ function Player::isWeaponOperator(%this) } return( false ); -} +} function Player::liquidDamage(%obj, %data, %damageAmount, %damageType) { if(%obj.getState() !$= "Dead") { - %data.damageObject(%obj, 0, "0 0 0", %damageAmount, %damageType); + %data.damageObject(%obj, 0, "0 0 0", %damageAmount, %damageType); %obj.lDamageSchedule = %obj.schedule(50, "liquidDamage", %data, %damageAmount, %damageType); } else @@ -3160,7 +3160,7 @@ function Armor::onEnterLiquid(%data, %obj, %coverage, %type) case 5: //Hot Lava %obj.liquidDamage(%data, $DamageHotLava, $DamageType::Lava); - case 6: + case 6: //Crusty Lava %obj.liquidDamage(%data, $DamageCrustyLava, $DamageType::Lava); case 7: @@ -3281,46 +3281,46 @@ function playDeathAnimation(%player, %damageLocation, %type) { %vertPos = firstWord(%damageLocation); %quadrant = getWord(%damageLocation, 1); - + //echo("vert Pos: " @ %vertPos); //echo("quad: " @ %quadrant); - - if( %type == $DamageType::Explosion || %type == $DamageType::Mortar || %type == $DamageType::Grenade) + + if( %type == $DamageType::Explosion || %type == $DamageType::Mortar || %type == $DamageType::Grenade) { - if(%quadrant $= "front_left" || %quadrant $= "front_right") + if(%quadrant $= "front_left" || %quadrant $= "front_right") %curDie = $PlayerDeathAnim::ExplosionBlowBack; else %curDie = $PlayerDeathAnim::TorsoBackFallForward; } - else if(%vertPos $= "head") + else if(%vertPos $= "head") { - if(%quadrant $= "front_left" || %quadrant $= "front_right" ) + if(%quadrant $= "front_left" || %quadrant $= "front_right" ) %curDie = $PlayerDeathAnim::HeadFrontDirect; - else + else %curDie = $PlayerDeathAnim::HeadBackFallForward; } - else if(%vertPos $= "torso") + else if(%vertPos $= "torso") { - if(%quadrant $= "front_left" ) + if(%quadrant $= "front_left" ) %curDie = $PlayerDeathAnim::TorsoLeftSpinDeath; - else if(%quadrant $= "front_right") + else if(%quadrant $= "front_right") %curDie = $PlayerDeathAnim::TorsoRightSpinDeath; - else if(%quadrant $= "back_left" ) + else if(%quadrant $= "back_left" ) %curDie = $PlayerDeathAnim::TorsoBackFallForward; - else if(%quadrant $= "back_right") + else if(%quadrant $= "back_right") %curDie = $PlayerDeathAnim::TorsoBackFallForward; } - else if (%vertPos $= "legs") + else if (%vertPos $= "legs") { - if(%quadrant $= "front_left" || %quadrant $= "back_left") + if(%quadrant $= "front_left" || %quadrant $= "back_left") %curDie = $PlayerDeathAnim::LegsLeftGimp; - if(%quadrant $= "front_right" || %quadrant $= "back_right") + if(%quadrant $= "front_right" || %quadrant $= "back_right") %curDie = $PlayerDeathAnim::LegsRightGimp; } - + if(%curDie $= "" || %curDie < 1 || %curDie > 11) %curDie = 1; - + %player.setActionThread("Death" @ %curDie); } diff --git a/Classic/scripts/projectiles.cs b/Classic/scripts/projectiles.cs index 6624394..9f24021 100644 --- a/Classic/scripts/projectiles.cs +++ b/Classic/scripts/projectiles.cs @@ -11,7 +11,7 @@ // GrenadeProjectileData : ProjectileData // SeekerProjectileData : ProjectileData // SniperProjectileData : ProjectileData -// +// //-------------------------------------------------------------------------- //-------------------------------------- Default functions // @@ -33,12 +33,12 @@ function SniperProjectileData::onCollision(%data, %projectile, %targetObject, %m { %damLoc = firstWord(%targetObject.getDamageLocation(%position)); if(%damLoc $= "head") - { + { %targetObject.getOwnerClient().headShot = 1; %modifier = %data.rifleHeadMultiplier; } else - { + { %modifier = 1; %targetObject.getOwnerClient().headShot = 0; } @@ -72,10 +72,11 @@ function ShapeBaseImageData::onFire(%data, %obj, %slot) { %obj.cantFire = 1; %preventTime = %data.stateTimeoutValue[4]; + //%preventTime = (%data.stateTimeoutValue[4] + %data.stateTimeoutValue[3]) - 0.032; %obj.reloadSchedule = schedule(%preventTime * 1000, %obj, resetFire, %obj); } // --------------------------------------------------------------------------- - + %data.lightStart = getSimTime(); if( %obj.station $= "" && %obj.isCloaked() ) @@ -89,7 +90,7 @@ function ShapeBaseImageData::onFire(%data, %obj, %slot) else { // if( %obj.getEnergyLevel() > 20 ) - // { + // { // %obj.setCloaked( false ); // %obj.reCloak = %obj.schedule( 500, "setCloaked", true ); // } @@ -97,15 +98,15 @@ function ShapeBaseImageData::onFire(%data, %obj, %slot) //We check if the player is still cloaked now. So no need to limit to 20% energy for the cloak in/out animation %obj.setCloaked( false ); %obj.reCloak = schedule( 500, 0, "checkCloakState", %obj); - } + } } if( %obj.client > 0 ) - { + { %obj.setInvincibleMode(0 ,0.00); - %obj.setInvincible( false ); // fire your weapon and your invincibility goes away. + %obj.setInvincible( false ); // fire your weapon and your invincibility goes away. } - + %vehicle = 0; if(%data.usesEnergy) { @@ -119,11 +120,11 @@ function ShapeBaseImageData::onFire(%data, %obj, %slot) } else %energy = %obj.getEnergyLevel(); - + if(%data.useCapacitor && %data.usesEnergy) - { + { if( %useEnergyObj.turretObject.getCapacitorLevel() < %data.minEnergy ) - { + { return; } } @@ -164,7 +165,7 @@ function ShapeBaseImageData::onFire(%data, %obj, %slot) %obj.lastProjectile = %p; %obj.deleteLastProjectile = %data.deleteLastProjectile; MissionCleanup.add(%p); - + // AI hook if(%obj.client) %obj.client.projectile = %p; @@ -172,9 +173,9 @@ function ShapeBaseImageData::onFire(%data, %obj, %slot) if(%data.usesEnergy) { if(%data.useMountEnergy) - { + { if( %data.useCapacitor ) - { + { %vehicle.turretObject.setCapacitorLevel( %vehicle.turretObject.getCapacitorLevel() - %data.fireEnergy ); } else @@ -222,7 +223,7 @@ function MissileLauncherImage::onFire(%data,%obj,%slot) // z0dd - ZOD, 9/3/02. Anti rapid fire mortar/missile fix. if(!%p) { - return; + return; } //-------------------------------------------------------- MissileSet.add(%p); @@ -253,7 +254,7 @@ function MissileLauncherImage::onWetFire(%data, %obj, %slot) // z0dd - ZOD, 9/3/02. Anti rapid fire mortar/missile fix. if(!%p) { - return; + return; } //-------------------------------------------------------- MissileSet.add(%p); @@ -269,7 +270,7 @@ function MissileBarrelLarge::onFire(%data,%obj,%slot) // z0dd - ZOD, 9/3/02. Anti rapid fire mortar/missile fix. if(!%p) { - return; + return; } //-------------------------------------------------------- MissileSet.add(%p); // z0dd - ZOD, 8/10/03. Bots need this. @@ -298,7 +299,7 @@ function MortarImage::onFire(%data,%obj,%slot) // z0dd - ZOD, 9/3/02. Anti rapid fire mortar/missile fix. if(!%p) { - return; + return; } // z0dd - ZOD, 5/22/03, Spawn a mortar at the end of the projectiles lifetime. // Addresses long range mortar spam exploit. @@ -358,7 +359,7 @@ function SniperRifleImage::onFire(%data,%obj,%slot) %obj.lastProjectile = %p; MissionCleanup.add(%p); serverPlay3D(SniperRifleFireSound, %obj.getTransform()); - + // AI hook if(%obj.client) %obj.client.projectile = %p; @@ -375,7 +376,7 @@ function ElfGunImage::onFire(%data, %obj, %slot) // z0dd - ZOD, 9/3/02. Anti rapid fire mortar/missile fix. if(!%p) { - return; + return; } //-------------------------------------------------------- if(!%p.hasTarget()) @@ -389,7 +390,7 @@ function TargetingLaserImage::onFire(%data,%obj,%slot) // z0dd - ZOD, 9/3/02. Anti rapid fire mortar/missile fix. if(!%p) { - return; + return; } //-------------------------------------------------------- %p.setTarget(%obj.team); @@ -403,13 +404,14 @@ function ShockLanceImage::onFire(%this, %obj, %slot) %obj.setInvincibleMode(0, 0.00); %obj.setInvincible( false ); } - + // z0dd - ZOD, 4/10/04. ilys - Added rapidfire shocklance fix if(%obj.cantfire !$= "") return; %obj.cantfire = 1; %preventTime = %this.stateTimeoutValue[4]; + //%preventTime = (%data.stateTimeoutValue[4] + %data.stateTimeoutValue[3]) - 0.032; %obj.reloadSchedule = schedule(%preventTime * 1000, %obj, resetFire, %obj); if( %obj.getEnergyLevel() < %this.minEnergy ) // z0dd - ZOD, 5/22/03. Check energy level first @@ -427,7 +429,7 @@ function ShockLanceImage::onFire(%this, %obj, %slot) else { // if( %obj.getEnergyLevel() > 20 ) - // { + // { // %obj.setCloaked( false ); // %obj.reCloak = %obj.schedule( 500, "setCloaked", true ); // } @@ -435,7 +437,7 @@ function ShockLanceImage::onFire(%this, %obj, %slot) //We check if the player is still cloaked now. So no need to limit to 20% energy for the cloak in/out animation %obj.setCloaked( false ); %obj.reCloak = schedule( 500, 0, "checkCloakState", %obj); - } + } } %muzzlePos = %obj.getMuzzlePoint(%slot); @@ -482,7 +484,7 @@ function ShockLanceImage::onFire(%this, %obj, %slot) MissionCleanup.add(%p); %damageMultiplier = 1.0; - + if(%hitObj.getDataBlock().getClassName() $= "PlayerData") { // Now we see if we hit from behind... @@ -512,13 +514,13 @@ function ShockLanceImage::onFire(%this, %obj, %slot) } // -------------------------------------------------------------- } - + %totalDamage = %this.Projectile.DirectDamage * %damageMultiplier; %hitObj.getDataBlock().damageObject(%hitobj, %p.sourceObject, %hitpos, %totalDamage, $DamageType::ShockLance); %noDisplay = false; } - } + } if( %noDisplay ) { @@ -554,7 +556,7 @@ function ELFProjectileData::zapTarget(%data, %projectile, %target, %targeter) if( %target.teamDamageStateOnZap || !%teammates ) %target.setRechargeRate(%oldERate - %data.drainEnergy); else - %target.setRechargeRate(%oldERate); + %target.setRechargeRate(%oldERate); %projectile.checkELFStatus(%data, %target, %targeter); } @@ -705,7 +707,7 @@ function RadiusExplosion(%explosionSource, %position, %radius, %damage, %impulse //%amount = (1.0 - (%dist / %radius)) * %coverage * %damage; //error( "damage: " @ %amount @ " at distance: " @ %dist @ " radius: " @ %radius @ " maxDamage: " @ %damage ); - + %data = %targetObject.getDataBlock(); %className = %data.className; @@ -714,7 +716,7 @@ function RadiusExplosion(%explosionSource, %position, %radius, %damage, %impulse %p = %targetObject.getWorldBoxCenter(); %momVec = VectorSub(%p, %position); %momVec = VectorNormalize(%momVec); - + //------------------------------------------------------------------------------ // z0dd - ZOD, 7/08/02. More kick when player damages self with disc or mortar. // Stronger DJs and mortar jumps without impacting others (mainly HoFs) @@ -730,7 +732,7 @@ function RadiusExplosion(%explosionSource, %position, %radius, %damage, %impulse } } //------------------------------------------------------------------------------ - + %impulseVec = VectorScale(%momVec, %impulse * (1.0 - (%dist / %radius))); %doImpulse = true; } @@ -740,27 +742,27 @@ function RadiusExplosion(%explosionSource, %position, %radius, %damage, %impulse %momVec = VectorSub(%p, %position); %momVec = VectorNormalize(%momVec); %impulseVec = VectorScale(%momVec, %impulse * (1.0 - (%dist / %radius))); - + if( getWord( %momVec, 2 ) < -0.5 ) %momVec = "0 0 1"; - + // Add obj's velocity into the momentum vector %velocity = %targetObject.getVelocity(); //%momVec = VectorNormalize( vectorAdd( %momVec, %velocity) ); %doImpulse = true; } else - { + { %momVec = "0 0 1"; %doImpulse = false; } - + if(%amount > 0) %data.damageObject(%targetObject, %sourceObject, %position, %amount, %damageType, %momVec, %explosionSource.theClient, %explosionSource); else if( %explosionSource.getDataBlock().getName() $= "ConcussionGrenadeThrown" && %data.getClassName() $= "PlayerData" ) { %data.applyConcussion( %dist, %radius, %sourceObject, %targetObject ); - + if(!$teamDamage && %sourceObject != %targetObject && %sourceObject.client.team == %targetObject.client.team) { messageClient(%targetObject.client, 'msgTeamConcussionGrenade', '\c1You were hit by %1\'s concussion grenade.', getTaggedString(%sourceObject.client.name)); diff --git a/Classic/scripts/server.cs b/Classic/scripts/server.cs old mode 100755 new mode 100644 index d943d7f..de7b8b5 --- a/Classic/scripts/server.cs +++ b/Classic/scripts/server.cs @@ -861,7 +861,7 @@ function GameConnection::onConnect( %client, %name, %raceGender, %skin, %voice, messageClient(%client, 'MsgClientJoin', "", %recipient.name, %recipient, - %recipient.target, + "", %recipient.isAIControlled(), %recipient.isAdmin, %recipient.isSuperAdmin, @@ -879,15 +879,15 @@ function GameConnection::onConnect( %client, %name, %raceGender, %skin, %voice, if ( $CurrentMissionType !$= "SinglePlayer" ) { // z0dd - ZOD, 5/08/04. Send message of any gameplay changes -// messageClient( %client, 'MsgClassic', 'Classic \c2Sniper Mod: \c3%1.', ($Host::ClassicLoadSniperChanges ? 'Enabled' : 'Disabled') ); -// messageClient( %client, 'MsgClassic', 'Classic \c2Missile Mod: \c3%1.', ($Host::ClassicLoadMissileChanges ? 'Enabled' : 'Disabled') ); -// messageClient( %client, 'MsgClassic', 'Classic \c2Mortar Mod: \c3%1.', ($Host::ClassicLoadMortarChanges ? 'Enabled' : 'Disabled') ); -// messageClient( %client, 'MsgClassic', 'Classic \c2Blaster Mod: \c3%1.', ($Host::ClassicLoadBlasterChanges ? 'Enabled' : 'Disabled') ); -// messageClient( %client, 'MsgClassic', 'Classic \c2Plasma Turret Mod: \c3%1.', ($Host::ClassicLoadPlasmaTurretChanges ? 'Enabled' : 'Disabled') ); -// messageClient( %client, 'MsgClassic', 'Classic \c2Player Mod: \c3%1.', ($Host::ClassicLoadPlayerChanges ? 'Enabled' : 'Disabled') ); -// messageClient( %client, 'MsgClassic', 'Classic \c2Havoc Mod: \c3%1.', ($Host::ClassicLoadHavocChanges ? 'Enabled' : 'Disabled') ); -// messageClient( %client, 'MsgClassic', 'Classic \c2Mine Mod: \c3%1.', ($Host::ClassicLoadMineChanges ? 'Enabled' : 'Disabled') ); -// messageClient( %client, 'MsgClassic', 'Classic \c2V-Ramming Mod: \c3%1.', ($Host::ClassicLoadVRamChanges ? 'Enabled' : 'Disabled') ); + //messageClient( %client, 'MsgClassic', 'Classic \c2Sniper Mod: \c3%1.', ($Host::ClassicLoadSniperChanges ? 'Enabled' : 'Disabled') ); + //messageClient( %client, 'MsgClassic', 'Classic \c2Missile Mod: \c3%1.', ($Host::ClassicLoadMissileChanges ? 'Enabled' : 'Disabled') ); + //messageClient( %client, 'MsgClassic', 'Classic \c2Mortar Mod: \c3%1.', ($Host::ClassicLoadMortarChanges ? 'Enabled' : 'Disabled') ); + //messageClient( %client, 'MsgClassic', 'Classic \c2Blaster Mod: \c3%1.', ($Host::ClassicLoadBlasterChanges ? 'Enabled' : 'Disabled') ); + //messageClient( %client, 'MsgClassic', 'Classic \c2Plasma Turret Mod: \c3%1.', ($Host::ClassicLoadPlasmaTurretChanges ? 'Enabled' : 'Disabled') ); + //messageClient( %client, 'MsgClassic', 'Classic \c2Player Mod: \c3%1.', ($Host::ClassicLoadPlayerChanges ? 'Enabled' : 'Disabled') ); + //messageClient( %client, 'MsgClassic', 'Classic \c2Havoc Mod: \c3%1.', ($Host::ClassicLoadHavocChanges ? 'Enabled' : 'Disabled') ); + //messageClient( %client, 'MsgClassic', 'Classic \c2Mine Mod: \c3%1.', ($Host::ClassicLoadMineChanges ? 'Enabled' : 'Disabled') ); + //messageClient( %client, 'MsgClassic', 'Classic \c2V-Ramming Mod: \c3%1.', ($Host::ClassicLoadVRamChanges ? 'Enabled' : 'Disabled') ); // z0dd - ZOD, 9/29/02. Removed T2 demo code from here messageClient(%client, 'MsgClientJoin', 'Welcome to Tribes2 %1.', @@ -899,12 +899,12 @@ function GameConnection::onConnect( %client, %name, %raceGender, %skin, %voice, %client.isSuperAdmin, %client.isSmurf, %client.sendGuid ); - // z0dd - ZOD, 9/29/02. Removed T2 demo code from here + // z0dd - ZOD, 9/29/02. Removed T2 demo code from here messageAllExcept(%client, -1, 'MsgClientJoin', '\c1%1 joined the game.', %client.name, %client, - %client.target, + "", false, // isBot %client.isAdmin, %client.isSuperAdmin, @@ -1100,17 +1100,17 @@ function GameConnection::onDrop(%client, %reason) // reset the server if everyone has left the game if( $HostGamePlayerCount - $HostGameBotCount == 0 && $Host::EmptyServerReset && !$resettingServer && !$LoadingMission && $CurrentMissionType !$= $Host::MissionType ) { - // Timed Server Reset: $Host::EmptyServerReset = 1; --- Time in Minutes $Host::EmptyServerResetTime = 120; - if(isEventPending($EmptyServerResetSchedule)) - { - error(formatTimeString("HH:nn:ss") SPC "Previous Timed Server Reset schedule cancelled..." ); - cancel($EmptyServerResetSchedule); - } + // Timed Server Reset: $Host::EmptyServerReset = 1; --- Time in Minutes $Host::EmptyServerResetTime = 120; + if(isEventPending($EmptyServerResetSchedule)) + { + error(formatTimeString("HH:nn:ss") SPC "Previous Timed Server Reset schedule cancelled..." ); + cancel($EmptyServerResetSchedule); + } - %resettime = $Host::EmptyServerResetTime * 60000; - if(%resettime <= 0) %resettime = 1; - $EmptyServerResetSchedule = schedule(%resettime, 0, "ResetServerTimed"); - error(formatTimeString("HH:nn:ss") SPC "Timed Server Reset schedule started..." ); + %resettime = $Host::EmptyServerResetTime * 60000; + if(%resettime <= 0) %resettime = 1; + $EmptyServerResetSchedule = schedule(%resettime, 0, "ResetServerTimed"); + error(formatTimeString("HH:nn:ss") SPC "Timed Server Reset schedule started..." ); } } @@ -1764,8 +1764,13 @@ function serverCmdSAD(%client, %password) %client.isSuperAdmin = true; MessageAll( 'MsgSuperAdminPlayer', '\c2%2 has become a Super Admin by force.', %client, %name); %adminmsg = " has become a Super Admin by force."; - adminLog(%client, %adminmsg); - logEcho(%client.nameBase @ " has become a Super Admin by force."); + adminLog(%client, %adminmsg); + logEcho(%client.nameBase @ " has become a Super Admin by force."); + + //Update everyones client and put an SA by your name + messageAll( 'MsgClientDrop', "", %client.name, %client); + messageAll('MsgClientJoin', "",%client.name, %client, "",%client.isAIControlled(),%client.isAdmin,%client.isSuperAdmin,%client.isSmurf,%client.sendGuid); + messageAll('MsgClientJoinTeam', "", %client.name, %game.getTeamName(0), %client, %client.team ); } case $Host::AdminPassword: @@ -1780,8 +1785,13 @@ function serverCmdSAD(%client, %password) %client.isSuperAdmin = false; MessageAll( 'MsgAdminForce', '\c2%2 has become a Admin by force.', %client, %name); %adminmsg = " has become an Admin by force."; - adminLog(%client, %adminmsg); - logEcho(%client.nameBase @ " has become an Admin by force."); + adminLog(%client, %adminmsg); + logEcho(%client.nameBase @ " has become an Admin by force."); + + //Update everyones client and put an A by your name + messageAll( 'MsgClientDrop', "", %client.name, %client); + messageAll('MsgClientJoin', "",%client.name, %client, "",%client.isAIControlled(),%client.isAdmin,%client.isSuperAdmin,%client.isSmurf,%client.sendGuid); + messageAll('MsgClientJoinTeam', "", %client.name, %game.getTeamName(0), %client, %client.team ); } default: messageClient(%client, 'MsgPasswordFailed', '\c2Illegal SAD PW.'); @@ -2564,15 +2574,21 @@ function serverCmdStripAdmin(%client, %admin) %admin.isSuperAdmin = 0; messageClient(%admin, 'MsgStripAdminPlayer', 'You have stripped yourself of admin privledges.'); adminLog(%client, " stripped admin from " @ %admin.nameBase); + messageAll('MsgClientDrop', "", %client.name, %client); + messageAll('MsgClientJoin', "",%client.name, %client, "",%client.isAIControlled(),%client.isAdmin,%client.isSuperAdmin,%client.isSmurf,%client.sendGuid); + messageAll('MsgClientJoinTeam', "", %client.name, %game.getTeamName(0), %client, %client.team ); return; } else if(%client.isSuperAdmin) { - messageAll( 'MsgStripAdminPlayer', '\c2%1 removed %2\'s admin privledges.', %client.name, %admin.name, %admin ); + messageAll('MsgStripAdminPlayer', '\c2%1 removed %2\'s admin privledges.', %client.name, %admin.name, %admin ); messageClient(%admin, 'MsgStripAdminPlayer', 'You are being stripped of your admin privledges by %1.', %client.name); %admin.isAdmin = 0; %admin.isSuperAdmin = 0; adminLog(%client, " stripped admin from " @ %admin.nameBase); + messageAll( 'MsgClientDrop', "", %client.name, %client); + messageAll('MsgClientJoin', "",%client.name, %client, "",%client.isAIControlled(),%client.isAdmin,%client.isSuperAdmin,%client.isSmurf,%client.sendGuid); + messageAll('MsgClientJoinTeam', "", %client.name, %game.getTeamName(0), %client, %client.team ); } else messageClient(%client, 'MsgError', '\c2Only Super Admins can use this command.'); @@ -2910,7 +2926,10 @@ function startTourneyCountdown() } // lets get it on! - Countdown( 30 * 1000 ); + if($Host::warmupTime <= 30) + Countdown(30 * 1000); + else + Countdown($Host::warmupTime * 1000); //Follow warmupTime! } function checkTourneyMatchStart() @@ -2984,7 +3003,11 @@ function checkTourneyMatchStart() Game.scheduleVote = ""; } - Countdown(30 * 1000); + // lets get it on! + if($Host::warmupTime <= 30) + Countdown(30 * 1000); + else + Countdown($Host::warmupTime * 1000); //Follow warmupTime! } } @@ -3066,6 +3089,12 @@ function EndCountdown(%timeMS) else return; + if(%timeMS >= 900000 && $Host::TournamentMode) + Game.endfifteenminuteCount = schedule(%timeMS - 900000, Game, "notifyMatchEndMinutes", 900000); + if(%timeMS >= 600000 && $Host::TournamentMode) + Game.endtenminuteCount = schedule(%timeMS - 600000, Game, "notifyMatchEndMinutes", 600000); + if(%timeMS >= 300000 && $Host::TournamentMode) + Game.endfiveminuteCount = schedule(%timeMS - 300000, Game, "notifyMatchEndMinutes", 300000); if(%timeMS >= 180000) Game.endthreeminuteCount = schedule(%timeMS - 180000, Game, "notifyMatchEndMinutes", 180000); if(%timeMS >= 120000) diff --git a/Classic/scripts/serverDefaults.cs b/Classic/scripts/serverDefaults.cs index c4a395f..07d1e8c 100755 --- a/Classic/scripts/serverDefaults.cs +++ b/Classic/scripts/serverDefaults.cs @@ -188,7 +188,7 @@ $Host::AllowPlayerVoteSkipMission = 1; $Host::AllowPlayerVoteTimeLimit = 1; $Host::AllowPlayerVoteTournamentMode = 1; $Host::AllowPlayerVoteTeamDamage = 1; -$Host::AllowPlayerTournamentModeVotekick = 1; +$Host::AllowPlayerVoteNextMission = 1; $Host::NoBaseRapeEnabled = 1; //Enable or Disable No Base Rape $Host::NoBaseRapePlayerCount = 14; //Min number players the turn off No Base Rape $Host::AveragePings = 1; //Show Average ping in F2 menu @@ -212,6 +212,8 @@ $Host::LoadScreenShowLogo = 0; $Host::LoadScreenShowLogoName = "dpub/DPUB_logo"; //Logo location Filename $Host::MapChangeMSG = 0; //Center Print between mapchanges $Host::MapChangeMSGContent = "Pickup Night\nSaturday, March 5th\nJoin discord for details"; +$Host::MultipleMapRotation = 0; //Rotate thru multiple map rotation files 1,2,3, etc +$Host::MultipleMapRotationCount = 3; //How many multiple map rotation files (mapRotation1.cs, mapRotation2.cs, mapRotation3.cs, etc) //LakRabbit $Host::LakRabbitUnlimitedDJ = 1; //Unlimited disc-jumps if enabled