dont quit building when you click on wrong place - Page 2

dont quit building when you click on wrong place

Requests for features in the spring code.

Moderator: Moderators

Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: dont quit building when you click on wrong place

Post by Google_Frog »

but every mod has to include these widgets... my point is we should be able to make standard mod without knowing how to program the whole game yourself...
Then include it in BA so people can mod BA.
Regret
Posts: 2086
Joined: 18 Aug 2007, 19:04

Re: dont quit building when you click on wrong place

Post by Regret »

The deselection is a bug. Period.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: dont quit building when you click on wrong place

Post by smoth »

TradeMark wrote:but every mod has to include these widgets... my point is we should be able to make standard mod without knowing how to program the whole game yourself...
spring is an ENGINE. You kinda need to do it this way, even modern game mods require SOME programing knowledge.
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Re: dont quit building when you click on wrong place

Post by TradeMark »

my point is we should have basic functionalities for the UI

instead of coding all those yourself

Regret wrote:The deselection is a bug. Period.
+1111
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: dont quit building when you click on wrong place

Post by smoth »

depends on what you consider correct.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: dont quit building when you click on wrong place

Post by AF »

The whole selection code should be widgetized to begin with.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: dont quit building when you click on wrong place

Post by smoth »

AF wrote:The whole selection code should be gadgetized to begin with.
-fixed
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: dont quit building when you click on wrong place

Post by CarRepairer »

Argh wrote:Use AllowCommand(), get the command ID, and check if command ID cooresponds to a UnitDef (factories it's -unitDefID, IIRC it's positive with Units that aren't factories, but whatever).

Params should give XYZ. Check validity of that command with Spring.TestBuildOrder().

If it fails, then play an alert sound locally to the end-user, and have the command return false.

IOW, go read the Wiki, so that that all makes sense... and you're done.
AllowCommand is luarules, can't be in widget. But I'm sure there's still a way.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: dont quit building when you click on wrong place

Post by Argh »

Yes, you're right. That said, a Gadget's not a big deal, other than requiring an update release of whatever project's using it. I wrote a solution in about an hour, including re-selecting the Unit who went awry.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: dont quit building when you click on wrong place

Post by zwzsg »

zwzsg wrote:
smoth wrote:
AF wrote:The whole engine code is getting gadgetized to begin with.
-fixed
-fixed
It's quite concerning the engine is falling apart and we're told to patch it from gadgets.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: dont quit building when you click on wrong place

Post by smoth »

zwzsg wrote:It's quite concerning the engine is falling apart
explain?
User avatar
TheFatController
Balanced Annihilation Developer
Posts: 1177
Joined: 10 Dec 2006, 18:46

Re: dont quit building when you click on wrong place

Post by TheFatController »

I wrote this in 10 minutes and it doesn't work but if someone can unbug it (should be easy) it should block mouse clicks for invalid orders.

Code: Select all

function widget:MousePress(x, y, button)
  if button==1 and select(1,Spring.GetActiveCommand()) < 0 then
    local _,coords = Spring.TraceScreenRay(x,y,true,true)
    local dx,dz = coords[1],coords[3]
    if dx and dz and (not Spring.TestBuildOrder((select(1,Spring.GetActiveCommand())*-1),dx,0,dz)) then
	  return true
    end
  end
  return false
end
mongus
Posts: 1463
Joined: 15 Apr 2005, 18:52

Re: dont quit building when you click on wrong place

Post by mongus »

User avatar
Tribulex
A.N.T.S. Developer
Posts: 1894
Joined: 26 Sep 2009, 21:26

Re: dont quit building when you click on wrong place

Post by Tribulex »

mongus wrote:NOOBS!!
you are an asshole. Help you if you are going to use this word please.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: dont quit building when you click on wrong place

Post by Argh »

Hey, TFC, I am pretty sure that this has to be a Gadget. In the case of this error, the Command has already been "sent", the problem for the end-user is that it was not sent as they'd prefer. You want to catch the problem in AllowCommand(), basically.
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: dont quit building when you click on wrong place

Post by aegis »

no argh, his method really would work. he's blocking it at a mouse click level before the command is sent.

that'd make a nice addition to my widget mouse handler (unreleased but basic demo/example here) ^_^
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Re: dont quit building when you click on wrong place

Post by TradeMark »

So much about the easyness...
Argh wrote:Easy Widget.
Argh wrote:But my point is that it's very easy to write a Widget to solve this problem. I.E., this is a great, "my first Widget" project for somebody.
Argh wrote:Seriously, though, this really is a "my first project" thingie. If you don't want to write it, then request it in the Lua forum, this is pretty trivial.
Argh wrote:but this really is a very simple Widget project, so maybe follow that link and start working on it?
Argh wrote:I am sure you can figure it out, it's an easy one. Just use AllowCommand(), and go from there. Easy, really.
Easy, really...

smoth wrote:depends on what you consider correct.
Im sure we would win if we voted about it. you would be the only one with your -1 vote, gtfo noob.
mongus
Posts: 1463
Joined: 15 Apr 2005, 18:52

Re: dont quit building when you click on wrong place

Post by mongus »

d_b wrote:you are an asshole. Help you if you are going to use this word please.
Use invqueuekey, its an alternative that already does what is requested.
(and the coloured text is a wiki link to how to use it.)
So at least im an informative asshole.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: dont quit building when you click on wrong place

Post by Argh »

Easy, really...
Well, yeah. I guess that means nobody got one working by now?

When I get done working on what I am currently messing with (buncha Photoshop stuff for a friend of mine, we're scanning and resizing some 1950's children's stories tonight), I will release some source.
zerver
Spring Developer
Posts: 1358
Joined: 16 Dec 2006, 20:59

Re: dont quit building when you click on wrong place

Post by zerver »

If no one is working on fixing this in the engine, I can give it a try.
Post Reply

Return to “Feature Requests”