Page 1 of 1
Am I forgetting something?
Posted: Sun Jan 19, 2014 1:19 pm
by ficolas
Im making a new mod to test some stuff ("player animations")
But the mod doesnt seem to work (seems to be ignored by the game)
http://www.mediafire.com/download/lk61j ... wimmod.zip
The download.
Im sure im forgetting something really basic but that I have only done once so I dont remember...
Re: Am I forgetting something?
Posted: Sun Jan 19, 2014 1:55 pm
by FreeER
ficolas wrote:Im sure im forgetting something really basic
The folder is called 'swimmod' the "name" field in the info is 'Swim mod', you've switched the name and title info. also Factorio complains about a character-clothes-run-mask.png and from looking at the code the player might 'glitch' back and forth from player to player-swimming when in water (though I couldn't test). This will also lead to the player losing their inventory...
I used this function to swap inventory with the illness prototype mod I did recently
Code: Select all
function transferPlayerItems(old, new)
if new==nil then game.player.print("new is nil!") return end
local inv = {}
inv[1] = old.getinventory(defines.inventory.playerquickbar).getcontents()
inv[2] = old.getinventory(defines.inventory.playermain).getcontents()
inv[3] = old.getinventory(defines.inventory.playerguns).getcontents()
inv[4] = old.getinventory(defines.inventory.playertools).getcontents()
inv[5] = old.getinventory(defines.inventory.playerammo).getcontents()
inv[6] = old.getinventory(defines.inventory.playerarmor).getcontents()
for _,table in ipairs (inv) do
for name, count in pairs(table) do
new.insert{name=name,count=count}
end
end
game.player.character=new
old.destroy()
end
Re: Am I forgetting something?
Posted: Sun Jan 19, 2014 2:08 pm
by ficolas
Just remembered, second time I post the same question... but the first time was months ago... or maybe almost a year ago.
Yea I know the player looses his inventory and health, I was just testing with this code
Also water is still "solid" and why would character switch between one and the other when in water?
Re: Am I forgetting something?
Posted: Sun Jan 19, 2014 2:15 pm
by FreeER
It's an easy thing to forget...hm I believe I entirely forgot about player health when doing that illness mod, shame on me
I also just realized it'd be quite easy to tweak that function to loop from 1 to 10 (arbitrary number) and get all possible inventories so it could be used with more than just the player (and if the player got additional inventories in the future).
Re: Am I forgetting something?
Posted: Sun Jan 19, 2014 2:17 pm
by ficolas
Also does that function work with the toolbar?
Re: Am I forgetting something?
Posted: Sun Jan 19, 2014 2:23 pm
by FreeER
ficolas wrote:Also does that function work with the toolbar?
The toolbar is defines.inventory.playerquickbar, so yes.
edit: ah, hm, not sure if that works with the secondary quickbar due to how it's coded in C++ (simply switching secondary quickbar to be the primary). Would have to test to find out but if it doesn't you'd have to talk to the devs about changing how the source implements it.
edit: Also water is still "solid" and why would character switch between one and the other when in water?, hm took another look at the code and it seems I read it wrong there
ignore that comment lol
Re: Am I forgetting something?
Posted: Sun Jan 19, 2014 2:29 pm
by ficolas
The mod works really derpy xD
sometimes the player walks on water (jesus! D:), biters can also walk on water (quite ob) and when the player goes in water, biters stop following him, and will never ever moar follow him.
Re: Am I forgetting something?
Posted: Sun Jan 19, 2014 2:35 pm
by FreeER
Well, now just give me the power to throw fireballs and cause earthquakes by clicking and I'll be a happy player