Remove the 10 seconds autoquit when playing alone

Remove the 10 seconds autoquit when playing alone

Requests for features in the spring code.

Moderator: Moderators

Post Reply
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Remove the 10 seconds autoquit when playing alone

Post by TradeMark »

Could you please remove it? Its hard to notice when its loaded when you are doing something else at same time
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Remove the 10 seconds autoquit when playing alone

Post by lurker »

Isn't this forum for engine feature requests? Add a single line to the widget that gets the player count and submit to the mods that use it. Were you not aware it was a widget?
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Remove the 10 seconds autoquit when playing alone

Post by Google_Frog »

Code: Select all

----------------------------------------------------------------
-- global variables
----------------------------------------------------------------
local versionNumber = "v1.2"
local delay = 5
local endTime
local mx,my

----------------------------------------------------------------
-- speedups
----------------------------------------------------------------
local DiffTimers = Spring.DiffTimers
local GetTimer = Spring.GetTimer
local SendCommands = Spring.SendCommands
local Echo = Spring.Echo
local GetMouseState = Spring.GetMouseState

----------------------------------------------------------------
-- callins
----------------------------------------------------------------

function widget:GetInfo()
  return {
    name      = "Autoquit L",
    desc      = versionNumber .. " Automatically quits "..delay.."s after the game ends. Move mouse to cancel.",
    author    = "Evil4Zerggin & zwzsg",
    date      = "25 December 2008",
    license   = "GNU LGPL, v2.1 or later",
    layer     = 0,
    enabled   = true  --  loaded by default?
  }
end

function widget:Initialize()

  local plist = Spring.GetPlayerList()
  if (#plist == 1) then
    widgetHandler:RemoveWidget()
  end
  endTime = false
end

function widget:GameOver()
  endTime = GetTimer()
  mx,my = GetMouseState()
  Echo("<autoquit> Automatically exiting in " .. delay .. " seconds. Move mouse to cancel.")
end

function widget:Update(dt)
  if endTime then
    local nmx,nmy = GetMouseState()
    if nmx~=mx or nmy~=my then
      Echo("<autoquit> Autoquit canceled.")
      endTime = false
      -- widgetHandler:RemoveWidget()
    elseif DiffTimers(GetTimer(), endTime) > delay then
      Echo("<autoquit> Autoquit sending quit command.")
      SendCommands("quit")
    end
  end
end
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Re: Remove the 10 seconds autoquit when playing alone

Post by TradeMark »

oh it was widget, i thought it was some new feature lol
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Remove the 10 seconds autoquit when playing alone

Post by Forboding Angel »

A new feature built into spring that jsut magically arrived when you downloaded a widget without needing to update spring?
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Remove the 10 seconds autoquit when playing alone

Post by lurker »

Why do you think he downloaded the widget?

You're telling me you notice the exact second a feature shows up?
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Remove the 10 seconds autoquit when playing alone

Post by Forboding Angel »

How else would he have gotten it? SD doesn't just auto DL widgets also I thought it was funny cause you would thing that the big AUTOQUIT in f11 and widgets dir would be a clue.

And mainly, because this thread made me laugh.
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Re: Remove the 10 seconds autoquit when playing alone

Post by TradeMark »

i havent downloaded any widgets, perhaps its new BA feature
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Remove the 10 seconds autoquit when playing alone

Post by lurker »

The tiny 'autoquit' in the menu that is rarely used, and a widget that's probably in a mod file. Don't be so mocking.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Remove the 10 seconds autoquit when playing alone

Post by Forboding Angel »

BA Changelog wrote:- Added Evil4Zerggin & zwzsg's autoquit widget (exits spring at game end if no mousemove after 10 seconds).
Post Reply

Return to “Feature Requests”