Summary
NPCPrefabBuilder.EnsureSmokeBreak fails to load base game cigarette prefab in its default case, instructing devs to use their own prefab or pass in the correct Resources path.
Game Version
Other (specify in Additional Context)
S1API Version
3.0.4
MelonLoader Version
0.7.2 Nightly
Runtime Environment
Mono (Alternate), IL2CPP (Regular)
Steps to Reproduce
- Create a NPC with a location based action spec with SmokeBreak behaviour.
- Observe warning in ML console.
Expected vs Actual Behavior
Expected: Smoke break behaviour loads and functions correctly.
Actual: S1API fails to configure the necessary prefab.
MelonLoader Log
[WARNING] [NPCPrefabBuilder] EnsureSmokeBreak: Could not load cigarette prefab. The base game may not expose it via Resources. Pass a Resources path to a cigarette prefab in your mod (e.g. EnsureSmokeBreak("MyMod/Cigarette_Lit")) or bundle one in your mod's Resources folder.
What Have You Tried?
- As expected, not using smoke breaks in the schedule prevents this issue from surfacing.
Also I tried fixing the issue, see Additional Context.
Additional Context
Game Version: 0.4.5f1
Prefab expected by the API no longer exists.
The API, as a fallback, attempts to search existing SmokeCigarette objects to access the prefab on CigarettePrefab, which was removed in 0.4.4f10.
Current approach seems to be to use equippables/cigarette/cigarette_tp prefab, of type TPEquippedItem. SmokeCigarette has a field _cigarrete of type EquippableData, which in turn has a field for TPEquippedItem.
We can use the existing EquippableData, as it seems to only be a holder for prefabs, or create our own if not found.
I tried doing that, which prevented the warning message, however the behaviour wasn't working as expected. NPC wouldn't start smoking per schedule, but it would correct on interaction. If forced to activate, the NPC wouldn't put away the cigarrete, even after the action should have ended and there was another behaviour on the schedule. Error invoking StaggeredInvoke error was observed in the Player.log, which could be related to the change.
Additionally on IL2CPP the game would crash on time change via console command (although the error message suggested another, unrelated mod) after this change.
This leads me to believe that the root cause of this weird behavior is SmokeBreakBehaviour, not necessarily my changes to the prefab instantiation.
It's also possible the prefab instantiation isn't required, since the NPC prefab used by S1API might already have the SmokeCigarette object.
Pre-submission Checklist
Summary
NPCPrefabBuilder.EnsureSmokeBreakfails to load base game cigarette prefab in its default case, instructing devs to use their own prefab or pass in the correct Resources path.Game Version
Other (specify in Additional Context)
S1API Version
3.0.4
MelonLoader Version
0.7.2 Nightly
Runtime Environment
Mono (Alternate), IL2CPP (Regular)
Steps to Reproduce
Expected vs Actual Behavior
Expected: Smoke break behaviour loads and functions correctly.
Actual: S1API fails to configure the necessary prefab.
MelonLoader Log
What Have You Tried?
Also I tried fixing the issue, see Additional Context.
Additional Context
Game Version: 0.4.5f1
Prefab expected by the API no longer exists.
The API, as a fallback, attempts to search existing
SmokeCigaretteobjects to access the prefab onCigarettePrefab, which was removed in 0.4.4f10.Current approach seems to be to use
equippables/cigarette/cigarette_tpprefab, of typeTPEquippedItem.SmokeCigarettehas a field_cigarreteof typeEquippableData, which in turn has a field forTPEquippedItem.We can use the existing
EquippableData, as it seems to only be a holder for prefabs, or create our own if not found.I tried doing that, which prevented the warning message, however the behaviour wasn't working as expected. NPC wouldn't start smoking per schedule, but it would correct on interaction. If forced to activate, the NPC wouldn't put away the cigarrete, even after the action should have ended and there was another behaviour on the schedule.
Error invoking StaggeredInvokeerror was observed in thePlayer.log, which could be related to the change.Additionally on IL2CPP the game would crash on time change via console command (although the error message suggested another, unrelated mod) after this change.
This leads me to believe that the root cause of this weird behavior is
SmokeBreakBehaviour, not necessarily my changes to the prefab instantiation.It's also possible the prefab instantiation isn't required, since the NPC prefab used by S1API might already have the
SmokeCigaretteobject.Pre-submission Checklist