Page 7 of 7

Re: Mood is a thing for

Posted: 21 Mar 2015, 22:53
by zoggop
Updating this thing to work in 98, and thought i'd try to make the worm eating animation actually grab the unit and bring it down. Spring.UnitScript.AttachUnit is working, but the attached unit disappears once it's attached. I can still select the attached unit, and see its selection box (so I can see that it's moving the way it ought to), but there's no unit rendered. Anyone have an idea why this might be?

here's the worm's unit script

Code: Select all

return {
	sworm = {
		blocking = false,
		buildPic = "sworm.png",
		canMove = true,
		description = "Giant hungry beast.",
		footprintX = 6,
		footprintZ = 6,
		holdSteady = true,
		iconType = "sworm",
		isFirePlatform = true,
		isTransport = true,
		levelGround = false,
		loadingRadius = 256,
		maxDamage = 9999,
		name = "Sand Worm",
		objectName = "swormOpenMouth-180_50out-r45.s3o",
		script = [[sWormOpenMouth.lua]],
		stealth = true,
		transmaxunits = [[10]],
		transportCapacity = 1000,
  		transportMass = 500000,
 		transportSize = 100000,
		customParams = {
 			ignoreplacementrestriction = true,
		},
	},
}

Re: Mood is a thing for

Posted: 21 Mar 2015, 23:20
by FLOZi
That's the unitdef, please post script (do you attach to '-1' piece?)

Re: Mood is a thing for

Posted: 21 Mar 2015, 23:41
by zoggop
https://github.com/zoggop/cattle-and-lo ... nMouth.lua

did a quick echo, the piece ("foodmagnet") is 10

Re: Mood is a thing for

Posted: 22 Mar 2015, 01:48
by Jools
We have sandworms in Spring? Cool. Very cool!

Re: Mood is a thing for

Posted: 22 Mar 2015, 14:51
by 8611
The Spring.UnitScript.AttachUnit things still works in 98, so seems to be something with that script/model/mod.
There was too much other error spam to test the map.
The sync/unsynced seperation got changed a bit and requires "stricter" use of if gadgetHandler:IsSyncedCode() then ... else...
I assume you know what else to fix etc. ;)


Try to attach the unit but do not move the piece around. Then move piece around but only above ground, then try underground,...
Press alt+v or type /DebugColVol to see units hitbox, maybe more detailed than looking at selectionbox.
With /wiremap you can track what units do under the terrain..

If the attached unit can still be selected that already means it is not attached to piecenumber -1 because "in this state it will never be be selectable"
https://github.com/spring/spring/blob/d ... g.txt#L525

Unrelated, do not pack as solid archives.

Re: Mood is a thing for

Posted: 22 Mar 2015, 17:49
by zoggop
thank you so much for taking a look!
8611 wrote:There was too much other error spam to test the map.
The sync/unsynced seperation got changed a bit and requires "stricter" use of if gadgetHandler:IsSyncedCode() then ... else...
ya, loading up the map for the first time in a while and getting all this error spam is what made me realize i need to update it. i've resolved all the sync/unsync problems in the version on github.
Press alt+v or type /DebugColVol
ooo, v. helpful

Re: Mood is a thing for

Posted: 23 Mar 2015, 05:42
by zoggop
okay, now all the worm unit script does is:

Code: Select all

function script.Create()
local x,y,z = Spring.GetUnitPosition (unitID)
if (x and y and z) then
	local nearunits=Spring.GetUnitsInSphere  (x,y,z, 32) or "nothing"
	if (nearunits~="nothing") then		
		for _, nearunitid in ipairs (nearunits) do
			if (nearunitid~=unitID) then
				-- SwallowTest(nearunitid)
				AttachUnit(foodmagnet, nearunitid)
				Sleep(3000)
				DropUnit(nearunitid)
				break
			end
		end
	end
end
end
(where AttachUnit = Spring.UnitScript.AttachUnit, and DropUnit = Spring.UnitScript.DropUnit)

result? worm appears. nearby unit disappears for three seconds. nearby unit reappears and drops to the ground.

Re: Mood is a thing for

Posted: 23 Mar 2015, 06:00
by zoggop
okay, the whole problem was

Code: Select all

holdSteady = true,
in the unit def

Re: Mood is a thing for

Posted: 23 Mar 2015, 06:54
by zoggop

Re: Mood is a thing for

Posted: 23 Mar 2015, 07:25
by 8611
It it eating an energy storage? (try with a mobile unit?)

holdSteady=true/false should just change how passenger's orientation behaves...
From those pictures I see no reason why passenger should be invisible. Engine bug?
Here holdSteady does things with vectors:
https://github.com/spring/spring/blob/d ... it.cpp#L67
Drawing problems in https://springrts.com/mantis/view.php?id=2376 & https://springrts.com/mantis/view.php?id=2222 were related to vector things too, maybe it is similiar...?

Re: Mood is a thing for

Posted: 23 Mar 2015, 11:32
by zoggop
8611 wrote:It it eating an energy storage? (try with a mobile unit?)
ah, no that's a peewee, its colvol is just a cylinder apparently.
8611 wrote:holdSteady=true/false should just change how passenger's orientation behaves...
From those pictures I see no reason why passenger should be invisible
agreed. i would say it's this particular piece's fault, b/c it's tiny & not visible itself, but i tried attaching to other pieces too with same result.
8611 wrote:Engine bug?
I guess the question is, are there any examples of using holdSteady successfully?

Re: Mood is a thing for

Posted: 24 Mar 2015, 21:09
by qray
Thanks for updating, it's great to have the worms back! :-)

Always liked this map (looks great, and the different play due to worms is a cool variety of game play).

Re: Mood is a thing for

Posted: 25 Mar 2015, 18:07
by FLOZi
zoggop wrote: I guess the question is, are there any examples of using holdSteady successfully?
MCL uses holdsteady on the dropships which deploy upgrades, was working last I checked (but that was some time ago)

Re: Mood is a thing for

Posted: 03 Jun 2015, 08:22
by Forboding Angel
Sandworms confirmed.

https://youtu.be/i0YkVp-Kv_k