Aquaterion Posted March 9, 2016 Share Posted March 9, 2016 (edited) I don't wanna spam the forums with threads so im just gonna post all my questions here... 1. Can you get where the player is looking(North/south/east or west)? 2. Is there anything I can do to check if spawned prefab spawns over water? Say I wanna spawn something at random coords, it has a chance of spawning over water, which I want to avoid.. 3. Are Animated equipped items/inventory items possible? I feel like this would be possible by code but I don't know about using an actual animation done in .scml 4. Is it possible to make an equip item modify only the eyes? 5. Is there a way to test the client-side version of the mod without having 2 steam accounts or 2 computers? 6. I've seen people say you can change the priority of when your mod is loaded, but I can't find an example.. anyone know how? 7. Can you resize text for the item name in a recipe? Long names seem to just get cut off. If you know the answer to any of these, put the number of the question on your reply or something Edited March 15, 2016 by Aquaterion Link to comment Share on other sites More sharing options...
Muche Posted March 9, 2016 Share Posted March 9, 2016 (edited) 1. widgets/hudcompass.lua|GetCompassHeading() is using TheCamera:GetHeading(). 2. consolecommands.lua|c_tile() and components/map.lua are using TheWorld.Map:GetTileAtPoint(point). 5. I routinely test client-side of a mod by starting my local dedicated server (via Steam/Tools/DST Dedicated server; same account, same PC). This does require more powerful computer than just running the client. Also some things could be more tricky to test: e.g. non-admin functionality, or interaction between two players. Edited March 9, 2016 by Muche Link to comment Share on other sites More sharing options...
Aquaterion Posted March 9, 2016 Author Share Posted March 9, 2016 8 minutes ago, Muche said: 1. widgets/hudcompass.lua|GetCompassHeading() is using TheCamera:GetHeading(). 2. consolecommands.lua|c_tile() and components/map.lua are using TheWorld.Map:GetTileAtPoint(point). 5. I routinely test client-side of a mod by starting my local dedicated server (via Steam/Tools/DST Dedicated server; same account, same PC). This does require more powerful computer than just running the client. Also some things could be more tricky to test: e.g. non-admin functionality, or interaction between two players. I'll check out 1 and 2 when I can, as for 5, do dedicated servers support non workshop mods? or do I have to keep uploading the new versions? Link to comment Share on other sites More sharing options...
Muche Posted March 9, 2016 Share Posted March 9, 2016 Since it is running on my local machine, I can do whatever I want with it, including enabling non-workshop mods. Just make sure that server and client have the same version of the tested mod, otherwise you could be trying to investigate bugs that at the first sight make no sense whatsoever. Link to comment Share on other sites More sharing options...
Muche Posted March 9, 2016 Share Posted March 9, 2016 Mine is at Documents/Klei/DoNotStarveTogetherDedicated/Cluster_1/cluster_token.txt, as the server_log states it is loading it from there. Link to comment Share on other sites More sharing options...
Aquaterion Posted March 11, 2016 Author Share Posted March 11, 2016 On 3/9/2016 at 8:47 PM, Muche said: 1. widgets/hudcompass.lua|GetCompassHeading() is using TheCamera:GetHeading(). 2. consolecommands.lua|c_tile() and components/map.lua are using TheWorld.Map:GetTileAtPoint(point). As for 2. It worked great thanks, but for 1, while I haven't tried it yet, I feel that would only get the rotation of the camera(when you press Q and E) and not where the player is actually looking, so i need to also get the player rotation.. hmm tricky Link to comment Share on other sites More sharing options...
Muche Posted March 11, 2016 Share Posted March 11, 2016 components/locomotor.lua|RunInDirection() is using inst.Transform:SetRotation(); there is indeed inst.Transform:GetRotation(), also accessible via inst:GetRotation(). Link to comment Share on other sites More sharing options...
Aquaterion Posted March 11, 2016 Author Share Posted March 11, 2016 1 minute ago, Muche said: components/locomotor.lua|RunInDirection() is using inst.Transform:SetRotation(); there is indeed inst.Transform:GetRotation(), also accessible via inst:GetRotation(). ye that's what i meant by player rotation, but I thought i will have to do some math with camera and rotation, but that's not that case, however, turning the camera doesn't update your rotation, only moving does Link to comment Share on other sites More sharing options...
Kzisor Posted March 12, 2016 Share Posted March 12, 2016 7 hours ago, Aquaterion said: ye that's what i meant by player rotation, but I thought i will have to do some math with camera and rotation, but that's not that case, however, turning the camera doesn't update your rotation, only moving does if not TheCamera:GetHeading() == ThePlayer:GetRotation then -- use camera heading else -- use player rotation end Link to comment Share on other sites More sharing options...
Aquaterion Posted March 15, 2016 Author Share Posted March 15, 2016 Added 2 more questions Link to comment Share on other sites More sharing options...
Muche Posted March 15, 2016 Share Posted March 15, 2016 6. Set priority variable in modinfo. Higher number (i.e. positive) means earlier loading, lower number (i.e. negative) means later loading. I'd suggest adding a comment next to it with an explanation what mod is this reference to. 7. You can try something like AddClassPostConstruct("widgets/recipepopup", function (self) local old_Refresh = self.Refresh function self:Refresh() old_Refresh(self) local len = #self.name:GetString() if len > 20 then self.name:SetHorizontalSqueeze(20/len) else self.name:SetHorizontalSqueeze(1) end end end) @V2C, is is somehow possible to reset the RegionSize property of TextWidget, so subsequent call of text:GetRegionSize() returns true length of the text, that is, so following examples return the same sizes? local Text = require "widgets/text" local t1 = Text(DEFAULTFONT, 24, "Foobar", WHITE) local w1, h1 = t1:GetRegionSize() print(string.format("w1=%d, h1=%d", w1, h1)) local t2 = Text(DEFAULTFONT, 24, "Foobar", WHITE) local w2a, h2a = t2:GetRegionSize() t2:SetRegionSize(20, 20) -- t2:SetRegionSize(nil, nil) -- example local w2, h2 = t2:GetRegionSize() print(string.format("w2a=%d, h2a=%d, w2=%d, h2=%d", w2a, h2a, w2, h2)) Link to comment Share on other sites More sharing options...
Aquaterion Posted March 15, 2016 Author Share Posted March 15, 2016 2 hours ago, Muche said: 6. Set priority variable in modinfo. Higher number (i.e. positive) means earlier loading, lower number (i.e. negative) means later loading. I'd suggest adding a comment next to it with an explanation what mod is this reference to. 7. You can try something like AddClassPostConstruct("widgets/recipepopup", function (self) local old_Refresh = self.Refresh function self:Refresh() old_Refresh(self) local len = #self.name:GetString() if len > 20 then self.name:SetHorizontalSqueeze(20/len) else self.name:SetHorizontalSqueeze(1) end end end) Thanks that worked, while very long names are barely readable, I only have 1 really long name which I can probably shorten, so ye thanks Link to comment Share on other sites More sharing options...
Developer V2C Posted March 15, 2016 Developer Share Posted March 15, 2016 5 hours ago, Muche said: @V2C, is is somehow possible to reset the RegionSize property of TextWidget, so subsequent call of text:GetRegionSize() returns true length of the text, that is, so following examples return the same sizes? Unfortunately that does not work in our code, as you will see we've worked around that in many of our screens as well. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now