Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
I have temporarily removed controller support to fix the right click issues, If you still have issues double check that your mod is up to date, then be sure to let me know! But everything should be fully functional again. (aside from the controller support.)
Anything that can be opened by right clicking cannot be opened, such as bookshelves
Also I added controller support! (About time)
Anyone who had previously had issues with not being able to stop sitting, try the latest update and let me know if the issue is fixed for you and tell me if anything feels "off" about it.
As you had mentioned doing things in that way causes the spawn code to run twice, and my AddPrefabPostInitAny running twice on one object causes problems when the prefab is removed. But the core of the problem is that your test mod is running the spawn code twice on one object which is unrelated to "Sit On Anything" and is likely to cause issues with almost any mod that uses "PrefabPostInit"s and after looking at the code, it seems to be caused by that you are both using SpawnPrefab (Which itself will run the spawn code for the given object) but then also returning that spawned prefab as if it were "inst". (which will then also cause it to run the spawn code) I would suggest keeping "inst" and the object it spawns separate to avoid this.
name [it just a test mod]
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3113503378
local function fn()
local inst = SpawnPrefab("log")
return inst
end
return Prefab("log2",fn)
it not init the inst by CreateEntity() , and use SpawnPrefab("log"),
it will cause call AddPrefabPostInitAny twice .
if you postinit any called twice.
inst._OnRemoveEntity will be change to your function
eq,
inst.OnRemoveEntity = function(...) return inst.OnRemoveEntity end
it will loop!!!
Also, I have some doubts for your suggested fix. While admittedly I have not tried it in practice yet, from what I can tell the only change you made was making the backuped remove function a local function instead of it being stored in the prefab's data and I don't see how that would make any functional difference.
. eq code
return Prefab("log2",function() return SpawnPrefab("log") end)
it can repair this :
edited modmain line 76-82
local _OnRemoveEntity = inst.OnRemoveEntity
inst.OnRemoveEntity = function(i)
Facings[i.Transform] = nil
if _OnRemoveEntity then
_OnRemoveEntity(i)
end
end