Files
LonaRPG-Online-Games/ModScripts/_Mods/LonaCraft/docs/RPS_INTEGRATION.md
T

203 lines
18 KiB
Markdown
Raw Normal View History

2026-10-29 21:59:06 +04:00
# R1: LonaCraft beside RolePlayS (RPS 0.7.8.8, LonaRPG B.0.10.8.26)
Research only. No mod file was changed. Paths: `RPS/` = `ModScripts/_Mods/RolePlayS/`,
`LC/` = `ModScripts/_Mods/LonaCraft/`, `Game/` = `Data/Scripts/` unless a path says otherwise.
## Summary
| # | Finding | Severity |
|---|---|---|
| 1 | The current order (LonaCraft 1, RolePlayS 2) drops LonaCraft Hide/Bone on boars and rabbits. The RPS quest skin still drops. | breaks owner rule |
| 2 | The current order crashes RPS's Assessment skill: LonaCraft's `show_npc_info` wrapper passes 4 args to the game's 3-arg method. | crash |
| 3 | With RPS first, both drops happen on the same kill and nothing in this report breaks. | fix |
| 4 | Item ids, tier variants and RPS map ids all depend on load order. The current LonaCraft-only saves would shift LonaCraft item ids by +39 once RPS loads first. | save migration |
| 5 | No same item_name, no same display name, and no same redirected script between the two mods. | none |
**Recommended order: RolePlayS before LonaCraft** (lower LoadOrder number). This is what LonaCraft
already expects (`LC/Scripts/0_Core.rb:95-96`, `LC/README.md:430-441`, `LC/loader.rb:3-4`).
## How load order works (`Game/Frames/RVscript/730_Mod_InGameUI_mod_manager.rb`)
| Fact | Evidence |
|---|---|
| `GameMods.ini` LoadOrder is sorted ascending: the lower number loads first. Ties go by mod id, and "LonaCraft" < "RolePlayS". | 730:208-215 |
| Each enabled mod's entry script runs in that order. | 730:70-74, 710_Mod_InGameUI_ClassMod.rb:97-108 |
| Every mod script is evaluated before the database loads. `DataManager.load_mod_database` runs at the end of `load_normal_database`. | 5_DataManager.rb:127, 182, 224-226 |
| A mod that loads later wraps `load_mod_database` around the earlier ones. The later mod calls the earlier one's version first and then runs its own body, so the later mod's data writes win. | RPS 0_CORE.rb:84-86; LC 0_Core.rb:261-268 |
| `$mod_load_script` is a plain hash, so the last writer wins. `load_script` redirects through it once per call. | 5_GLOBAL_SETTING.rb:19; 102_ScriptImport.rb:63 |
| `extra_map_register` assigns id = highest current id + 1. | 5_DataManager.rb:390-399 |
| New items get `id = $data_items.length`, and saves store party items as `{id => n}`. | RPS 0_CORE.rb:337-345; LC 0_Core.rb:175-178; 29_Game_Party.rb:351-358 |
| `"before": [X]` in mod M means "M loads before X". It is auto-sorted. | 730:141-152, 94-107; 710:33 |
| `"requires"` disables the mod when the required mod is missing or off, through `error=`, which sets `enabled=false`. | 730:166-182; 710:65-68 |
| On every start the INI LoadOrder is rewritten to 0..n. | 730:232-238 |
## Q1. RPS quest skins and LonaCraft Hide/Bone
### How RPS drops the quest item
| Step | Evidence |
|---|---|
| Quests "WildBoarSkin" (4 x Wild Boar Skin) and "RabbitSkins" (10 x Rabbit Skin) are taken at the guild board. | RPS/HCGframes/event/NoerTavernQuestBoard.rb:15-16, 65-74 |
| Accepting sets `$story_stats["QuProg<name>"] = 1`. | RPS/HCGframes/event/NoerTavernGuildEmpolyee.rb:334-335 |
| The items `AnimalSkinWildBoar` and `AnimalSkinRabbit` are Key items, used only for the turn-in. | RPS/Item/AnimalSkinWildBoar.json:2-8, AnimalSkinRabbit.json:2-8 |
| RPS overrides the NPCs and sets their `death_event`. **The drop_list is not used.** WildBoar and WildBoarF get `EffectWildBoarDed`; WildRabbit gets `EffectWildRabbitDed`. | RPS/NPC/WildBoar.json:17, WildBoarF.json:17, WildRabbit.json:17 |
| The death events, in the RPS EventLib `RPS/MapObject.rvdata2` (events 22 and 23), run `if $story_stats["QuProgWildBoarSkin"] == 1` and then `reserve_summon_event("AnimalSkinWildBoar")`; the rabbit event does the same. | decoded with rubymarshal |
| The pickup events, in `RPS/QuestObject.rvdata2` (events 1 and 2), delete themselves once Lona holds 4 boar skins or 10 rabbit skins, then call `optain_item`. | decoded |
| The turn-in takes every skin. | RPS/HCGframes/event/NoerTavernGuildEmpolyee.rb:257-265, 280-288 |
| The NPC objects are replaced wholesale: `$data_npcs[name] = <new object>`. | RPS/Scripts/0_CORE.rb:160-163 |
### How a kill drops
| Step | Evidence |
|---|---|
| `setup_dead_npc` calls `setup_drop_item` (the drop_list rolls) and **then** `summon_death_event`. The two calls are independent. | Game/Frames/39_Game_Event.rb:843, 847 |
| Each kill rolls `rand(max+1)+min` times from the bag. | 281_Game_NonPlayerCharacter.rb:974-981, 1089-1101 |
| The death event is summoned when `npc.death_event` is set. | 281_Game_NonPlayerCharacter.rb:843-846 |
| LonaCraft adds Hide/Bone copies to `$data_npcs[n].drop_list` for 10 animals. | LC/Scripts/0_Core.rb:67-78, 225-243 (called at :127 from the wrapper at :261-268) |
### Result per load order
| NPC (in HUNTING_DROPS) | RPS overrides | LC -> RPS (today's ini) | RPS -> LC |
|---|---|---|---|
| WildBoar | yes | LC Hide/Bone **lost**; quest skin drops | both drop |
| WildBoarF | yes | LC Hide/Bone **lost**; quest skin drops | both drop |
| WildRabbit | yes (also drop_amt 2-4 becomes 1-2, RPS/NPC/WildRabbit.json:77-78) | LC Hide/Bone **lost**; quest skin drops | both drop; about half the rabbit Hide (about 0.3 instead of 0.6 per kill) |
| WildAlphaPig, WildDog, WildDireWolf, WildHorse, WildApeM, WildApeF, WildApeF_Sneak | no | LC drops | LC drops |
Why: in LC -> RPS, RPS's wrapper runs LonaCraft's merge first and then replaces 3 NPC objects
(0_CORE.rb:160-163), which drops the merged lists. In RPS -> LC, LonaCraft merges into RPS's objects,
which keep `death_event`. The quest item and Hide never share a code path, an item name or an EventLib
event, so they cannot block each other. A boar kill with the quest active (fewer than 4 held) gives
1 skin plus about 9 rolls at 12% Hide and 6% Bone.
### Options
| Option | Change | Covers | Cost |
|---|---|---|---|
| **A (PROPOSED, recommended)** | In `UserData/GameMods.ini`, set RolePlayS below LonaCraft (e.g. RolePlayS 1, LonaCraft 2) and RolePlayS `Banned = 0`. Do not use equal numbers. | Q1, plus #2 and #4 below | no code; see the save note under Q3 |
| B (PROPOSED, hardening) | Also call `LonaCraft.merge_hunting_drops` from a `DataManager.load_normal_database` wrapper, after the original. That runs after every mod's `load_mod_database` in either order (5_DataManager.rb:127, 182). The merge is already idempotent (0_Core.rb:237). About 10 lines in LC/Scripts/0_Core.rb. | Q1 in both orders | fixes only the drop, not #2 or #4 |
| C (PROPOSED) | Alias `Game_Event#setup_drop_item` to roll Hide/Bone by NPC name at the kill. | Q1 in both orders | more code; the drop math moves out of drop_list |
| D | Add Hide/Bone to RPS/NPC/*.json. | Q1 | edits RPS; rejected |
Recommendation: **A**. B is optional insurance, worth it only if players might ignore the load-order warning.
## Q2. Every other collision
### (a) Items
| Check | Count | Evidence |
|---|---|---|
| Same `item_name` (LC 66 items vs RPS 360 Item/Weapon/Armor/Skill jsons) | 0 | all LC names start `ItemLonaCraft` (LC/Scripts/0_Core.rb:35-49) |
| Same English display name (LC 66 vs RPS 181) | 0 | LC/Text/ENG/Items.txt, Furniture.txt vs RPS/Text/ENG/DataItem.txt, DataEquip.txt |
| Overlapping meaning | 2 | "Hide" (LC/Text/ENG/Items.txt:11-12) vs "Wild Boar Skin" and "Rabbit Skin" (RPS/Text/ENG/DataItem.txt:236-244). Separate items, which is what the owner wants. |
| Shared id space (both append to `$data_items`, `$data_weapons`, `$data_armors`) | 1 | RPS appends 39 Items, 37 Weapons and 15 Armors (0_CORE.rb:316-349); LC appends 66 Items plus tier variants (0_Core.rb:163-182, 50_Tiers.rb:21-23) |
| Shared shop (both append to `NoerBlackSmithShopTrader`) | 1, harmless | RPS 0_CORE.rb:529-537, LC 0_Core.rb:86-93, 246-258 |
Item ids per session (game Items.rvdata2 has 306 entries):
| Session | LC items | RPS new items |
|---|---|---|
| LC only (current saves) | 306-371 | none |
| LC -> RPS | 306-371 | 372-410 |
| RPS -> LC | 345-410 | 306-344 |
### (b) Script redirects (`$mod_load_script`)
| Mod | Redirects | Evidence |
|---|---|---|
| LC | 3: NoerBankMaani.rb, NoerTavernWaifu.rb, NoerTavern_Nap.rb (the Command_DarkPot.rb -> Command_PotStation.rb redirect was removed in R2, 2026-10-06: pots are vanilla again) | 100_Homes.rb:100-107, 183, 954-972, 1033 |
| RPS | 39: 28 replaced game event scripts, 6 new event scripts, 2 replaced HCGframes (Command_AreaNap.rb, OverEvent_RebirthCheck.rb), 3 replaced Batch scripts | RPS/Scripts/0_CORE.rb:1707-1721; folders RPS/HCGframes, RPS/HCGframes/event, RPS/Batch |
| Same key in both | **0** | |
| Indirect, harmless | 2 | (1) LC beds run `Data/HCGframes/Command_AreaNap.rb` (LC/Scripts/90_Furniture.rb:163, 1063), which RPS redirects. The RPS copy differs from the game's only by a commented-out Save choice and a `save_tavern` flag. (2) The RPS mining node `StaticCrystalOre` (RPS/MapObject.rvdata2 event 98) loads `RPS/HCGframes/event/Mining_Mineral.rb`, and LC's check for `"/Mining_"` matches it (LC/Scripts/40_Mining.rb:57-65), so mining by-products still drop. |
The full RPS event list: CommonCatchMovingFish, CommonRockCrab, CommonSandBoxSetup, CommonTree,
CommonTreeApple, CommonTreeArecaNut, CommonTreeBanana, CommonTreeNoble, CommonTreeNuts,
CommonWildAnimalRattus, CompCommon, CompCommonBack*, CompElfArcher, CompFireMage*, CompMusketeer,
CompNinjaKiller, CompOrkindSlayer*, CompWarSister, DoomFortressInnCompHumanScout, Mining_Mineral*,
Mining_Phosphorus, Mining_Saltpeter, NoerMarketLisa, NoerTavernCompFireMage, NoerTavernCompHumanBow,
NoerTavernCompHumanExplorer, NoerTavernCompHumanWarrior, NoerTavernGuildEmpolyee, NoerTavernQuestBoard,
NorthFL_INN_CompMusketeer, PirateBaneInnCompHumanSpear, PlayerDryadGuard*, SewerSkipTutorial*,
SouthFL_INNCompWarSister. A `*` marks a script that is new rather than a replacement. RPS also maps
`CompDireWolf.rb` to CompCommon (0_CORE.rb:1721).
### (c) Maps
| Map | RPS | LC | Collision |
|---|---|---|---|
| OvermapMain (Map002) | Summons GroveIdlenessPath at (43,68) on every overmap (0_CORE.rb:1155-1159). Adds lines to `-point-NoerTavern` (33,100) (0_CORE.rb:1184-1201). | Doors at (23,100) and (31,100) (100_Homes.rb:146, 192) | none: different tiles and events |
| NoerTavern (Map059) | Adds lines to `-point-GuildEmpolyee` at (31,44) (0_CORE.rb:1166-1183). Overrides NPC UniqueGrayRat (`-point-UniqueGrayRat` at 29,40). | Room cleared inside (30..35, 27..33) plus (31,28) (100_Homes.rb:163-188, 1206-1258); no station any more (the tavern Carpentry Bench was removed 2026-10-06) | none: (31,44) and (29,40) are outside both areas |
| NoerBlackSmithShop (Map043), NoerMarket (Map062) | not touched (only NPC scripts and barter adds) | stations (90_Furniture.rb:147-149) | none |
| MinerPrison | Tag replaced by RPS/MinerPrison.rvdata2 (0_CORE.rb:138-139) | LC mining also catches the vanilla Map050 call (40_Mining.rb:13-17, 41) | none: the RPS mine uses Mining_Mineral.rb, which LC catches |
| New RPS maps: GrId_Path, GrId_Top, TitleHalloween, r1_PlainField4, r4_RainFroest4, r11_RoadPlain4, MinerPrison (7) | `extra_map_register` = highest id + 1 (0_CORE.rb:99-155) | LC houses at fixed ids 9001 and 9003 (100_Homes.rb:90, 546-573) | **1 (id allocation)**: in LC -> RPS, RPS maps get ids 9004-9010; in RPS -> LC they get 213-219, the same as RPS alone. Saves store the current map id. |
| Tilesets | 2 new names, ACJ_GroveI and GroveIdleness (RPS/Tilesets.rvdata2, keyed by name, 5_DataManager.rb:487-504) | uses the game tilesets | none |
| RPS/temp/NoerTavern.rvdata2 | not loaded (registration commented out, 0_CORE.rb:141-145) | | none |
### (d) Methods both mods hook or redefine
| Method | RPS | LC | Result |
|---|---|---|---|
| `GIM_ADDON#show_npc_info` | Redefined with a 4th parameter `access` (RPS/Scripts/29_Skill_Assessment.rb:120); called with 4 args at :106 | Aliased at **class** Game_Interpreter (100_Homes.rb:1497-1510) | **LC -> RPS: crash.** LC's class method captures the game's 3-parameter version (Game/Editables/29_Functions_417_Interpreter.rb:455) and hides RPS's module method, so the 4-arg call raises ArgumentError and every other call loses the RPS look. **RPS -> LC: works.** |
| `DataManager.load_mod_database` | alias, 0_CORE.rb:84 | alias, 0_Core.rb:263; 100_Homes.rb:1040 | Both chains work. The data order causes Q1 and (a)/(c). |
| `DataManager.make_save_contents` / `extract_save_contents` | alias, 10_Class_and_History.rb:76, 86 (`:hero_class_lona`) | alias, 70_Save.rb:164, 177 (`:lonacraft`) | harmless in both orders |
| `Game_Map#setup` | alias, 0_CORE.rb:1154 | alias, 90_Furniture.rb:899; 100_Homes.rb:1306 | harmless |
| `Game_Map#setup_event_hack` | alias, 0_CORE.rb:1163 | alias, 90_Furniture.rb:887; 100_Homes.rb:1286 | harmless (see (c)) |
| `Scene_Map#update` | alias, 102_00_Scene_Map.rb:8 (F5/F6 quick save) | alias, 100_Homes.rb:1107; 95_Debug.rb:101 | harmless |
| `Game_Interpreter#darkPot_translate_recipe` | redefined, 0_CORE.rb:930-1138 | called by salvage, 20_Station.rb:70 | Harmless in both orders. The only change runs postProcess keys that start with "_" as code, and LC/Salvage has none. |
| `Menu_Items#process_item_use` | redefined, Frames/191_menu_07items.rb:210-246 | furniture use relies on `check_common_event` (90_Furniture.rb:24-31) | harmless: the same calls, only the sound changes |
| `Window_Base#initialize`, `System_Settings::FONT_*` | redefined, Frames/53_Window_Base.rb:8-17; 0_CORE.rb:796-861 (RPS skin and pixel fonts) | LC windows inherit them (80_CraftScene.rb:344-720) | cosmetic: the craft screen fonts and skin change; needs a screenshot run |
| `Window_ItemList#draw_item` | redefined, Frames/63_Window_ItemList.rb:8-23 | salvage and chest boxes use Scene_ItemStorage | cosmetic |
| `Window_ChoiceList` | `create_contents`, Frames/80_Window_ChoiceList.rb:8 | `draw_selected_item` alias, 100_Homes.rb:1127 | different methods, harmless |
| `ItemConfigs#load_lona_effect_from_hash` | alias, 0_CORE.rb:874-880 | Tiers rebuild through it, 50_Tiers.rb:275-277 | already handled by LC |
RPS does not touch these LonaCraft hooks: `Game_Party#has_item?` and `lose_item`, `Game_Date#shift`,
`addDays` and `oneDayForward`, `Game_Map#reserve_summon_event`, `Cache.system`, `Text#[]`, and
`Game_Interpreter#call_msg` and `load_script`. That was checked against every script RPS/loader.rb
loads (its 2_LonaBitmapChanger, 2_PersistentCache and 999_tmp_CORE are not loaded).
### (e) Save data
| Key | RPS | LC | Collision |
|---|---|---|---|
| Save contents hash | `:hero_class_lona` | `:lonacraft` | 0 |
| `$game_system` | none | `@lonacraft` (60_Skill.rb:20-25) | 0 |
| `$story_stats` | many custom keys (`QuProg*`, `Guild*`, `TitleHalloweenON`) | game keys only: `HiddenOPT0` (temporary), `LastOverMapX/Y` | 0 |
| Box ids | the game's 65533/65535 and `STORAGE_*` (25_Skills.rb:598-603) | 65901-65903 and 66000+ (20_Station.rb:30) | 0 |
| Item and map ids inside the save | not remapped | only tier variants are remapped (70_Save.rb:1-27, 34-45) | see (a) and (c) |
### (f) RPS crafting next to LonaCraft
| Overlap | Evidence | Effect |
|---|---|---|
| RPS adds 4 alchemy files at index 0 of `$data_AlchemyRecipes` in a `load_normal_database` wrapper, so the effect does not depend on order. | RPS/Scripts/0_CORE.rb:596-609; RPS/Alchemy/*.json | "Cook" at the pot (LC passes it through, 20_Station.rb:160) also runs RPS recipes. |
| LC materials carry pot tags that RPS recipes use: Plank = Wood, Stone Block and Rough Stone = Rock, Cloth Bolt and Rope = Cloth. | LC/Item/*.json `pot_data`; RPS/Alchemy/400_darkPot_Arrows.json (Wood+Rock, Wood+Rock+Oil), 500_darkPot_Weapon.json (Wood+Cloth), 8000_darkPot_Bombs.json (Cloth) | Cooking LC materials can turn them into arrows, a club or bombs. Vanilla recipes already use Wood (Data/Effects/Alchemy/3000_*, 6000_*). Low impact. |
| Tier variants are chosen from the gear loaded before LC. | LC/Scripts/50_Tiers.rb:8-12, 168-209 | LC -> RPS: RPS's 52 new weapons and armor never get tiers, and the 76 game items RPS changes (36 weapons, 40 armors) are cloned before RPS changes them, so the tiers keep vanilla stats. RPS -> LC: consistent. |
| 29_ChestLoot.rb, 600_Items_for_Containers.rb, reward_item_roster | RPS/Scripts/29_ChestLoot.rb, 600_Items_for_Containers.rb; 0_CORE.rb:1283-1349 | Loot tables with RPS and game items only. No LC materials, no overlap. |
## Q3. Load order and `_ModInfo.json`
| Option | What | Verdict |
|---|---|---|
| **A (PROPOSED, recommended)** | RPS before LC in GameMods.ini. LC already warns when the order is wrong (0_Core.rb:144-160, text in LC/Text/ENG/Info.txt:8-9). | Fixes Q1, the (d) crash, the (c) map ids and the (f) tiers. |
| B (PROPOSED, owner's call) | Add `"before": ["LonaCraft"]` to **RolePlayS**/_ModInfo.json. It is auto-enforced (730:141-152) and harmless when LC is absent or off. | It edits the other mod, so it needs owner consent. |
| C | LC `_ModInfo.json` `"before"` | cannot say "after RPS". LC/_ModInfo.json:11 stays `[]`. |
| D | LC `"requires": {"RolePlayS": ...}` | Rejected: it disables LonaCraft when RPS is off (730:178-182, 710:65-68). |
RPS/_ModInfo.json (`requires LonaRPG >= 1.07518`, with a trailing comma) passes. The game version
reads as about 1.106 (150_check_OSVER.rb:14-31), and the JSON decoder accepts trailing commas
(101_jsonEnDecoder.rb:232-253). Both files use LF line endings, which the decoder needs (it does not
skip `\r`, 101_jsonEnDecoder.rb:178).
### Save note for option A (PROPOSED)
| Option | Change | Note |
|---|---|---|
| **E1 (recommended)** | Extend `LC/Scripts/70_Save.rb` so the save registry also covers the 12 materials and 54 furniture items (name to id) and `@items` in the party and boxes is remapped, as tier variants already are. | From then on, any order change is safe for LC items. |
| E2 | Start a new test save after switching the order. | The existing LonaCraft-only saves hold LC items at 306-371; with RPS first those ids belong to RPS items 306-344 and shifted LC items. Without E1, those saves come out wrong. |
Recommendation: **E1 and a fresh save**. Old saves have no item registry to remap from.
## Side note (not a LonaCraft collision)
RPS's `EffectWildBoarDed` and `EffectWildRabbitDed` copy the game's `EffectCharDed` without the line
`check_cannibalDrop(user.actor.race)` (game `-lib-MapObject` Map001, EffectCharDed). For these
"Others"-race animals the effect was not verified.