Please?
And before you even think of posting, AF, I asked Maelstrom if he could write a lua script for it. He said he could intercept the self-d commands and remove them, but that it would be far more efficient to do it engine-side and disallow the command to be sent in the first place.
Canselfdestruct=0/1
Moderator: Moderators
The impossibly high self-destruct time is what we currently use, but it's not exactly ideal. We need it for our flags: it's lame if the defender self-destructs the flag before the enemy captures it just so they have to manually waste time to re-cap the point (because the entire point of the capturing system we had Maelstrom code is to get rid of the rebuilding part). The high self-destruct time is a somewhat hacky workaround.
How would we go about doing it in Luarules, if the situation has changed regarding my small text in my previous post?
How would we go about doing it in Luarules, if the situation has changed regarding my small text in my previous post?
Is the tiny text supposed to be cute? If you have something to
say, say it; don't waste everyone's time by obfuscating it.
You can edit the unit command descriptions to remove the
self-d command as well as blocking the commands themselves.
P.S. It would be an easy feature to add to the engine
To save others the bother:
say, say it; don't waste everyone's time by obfuscating it.
You can edit the unit command descriptions to remove the
self-d command as well as blocking the commands themselves.
P.S. It would be an easy feature to add to the engine

To save others the bother:
Gnome wrote:And before you even think of posting, AF, I asked Maelstrom if he could
write a lua script for it. He said he could intercept the self-d commands
and remove them, but that it would be far more efficient to do it
engine-side and disallow the command to be sent in the first place
Last edited by trepan on 19 Nov 2007, 01:21, edited 1 time in total.
I added it a minute ago, just need to test it. It's a oneliner... :P
http://spring.clan-sy.com/mantis/view.php?id=687
http://spring.clan-sy.com/mantis/view.php?id=687
*_*
Now I did have a 1 line answer, the same answer I've been trying to hammer in the last month or two, that trepan also seems to be saying 20 times a month.
However maybe I should give an analogy anyway as you decided to be so rude? As trepan rightly said small text is not good, and it doesn't hide derogatory comments very well.
Anyways there're lots of requests that can be done there and then with a single line of lua code using the method trepan suggests.
feel free anyone to correct my code which would block any self destruct command regardles of the unit.
Even better:
That would remove the self destruct command from any metal extractor built.
Now I did have a 1 line answer, the same answer I've been trying to hammer in the last month or two, that trepan also seems to be saying 20 times a month.
However maybe I should give an analogy anyway as you decided to be so rude? As trepan rightly said small text is not good, and it doesn't hide derogatory comments very well.
Anyways there're lots of requests that can be done there and then with a single line of lua code using the method trepan suggests.
Code: Select all
function gadget:AllowCommand(unitID, unitDefID, teamID,
cmdID, cmdParams, cmdOptions)
if (cmdID == CMD.SELFD) then
return false -- command was blocked
end
return true
end
Even better:
Code: Select all
local function SetCommand(unitID, CommandId, isdisabled)
local editID = FindUnitCmdDesc(unitID, CommandId)
if(editID) then
Spring.EditUnitCmdDesc(unitID, editID, {disabled=isdisabled})
end
end
function gadget:UnitCreated(unitID, unitDefID)
local ud = UnitDefs[unitDefID]
if (ud.name == 'armmex') then
SetCommand(unitID,CMD.SELFD,true);
end
end
A Lua way of doing it is definately possible, I know. Gnome stated that i knew how. I was just wondering, why cant this be an engine thing? We have canAttack, canBuild, canMove, canEverythingElse, but not canSelfDestruct. It just seems slightly unnecessary to have yet another Lua gadget running to block this command, when every other command can be blocked engine side...
Why disable the CmdDesc? AFAIK a unit doesn't need a CmdDesc to receive an order anyway. When I introduced special abilities into KP Div0 I had to attach a safeguard that only the proper units can get the command, selecting a terminal and a crapload of bits would make every selected unit launch a bomber instead of only the terminal (which was the only one with the CmdDesc)