Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add quadruped armors #1849

Merged
merged 4 commits into from
Sep 18, 2022

Conversation

leoCottret
Copy link
Collaborator

@leoCottret leoCottret commented Sep 11, 2022

Summary

[Content] "add armors for small and medium quadrupeds"

Purpose of change

Add generic armors for quadrupeds to reduce the inventory/crafting menu clutter. It will also help for code maintability and if more quadrupeds becomes tameable. As a side effect, every tameable quadrupeds can now wear some kind of armor.

Describe the solution

  • Changed all monsters with a bodytype of dog or horse to quadruped. The min_pet_vol, max_pet_vol and the weight values of the armor defines which armor size a quadruped should wear. Some examples: A cat can only wear the lighest small armors, a medium dog can wear all small armors, a horse can wear all medium sized armor.
  • Refactored the horse/dog armor. They were very different, probably for some historic reasons (not made by the same persons). I used the horse armors as a base for medium quadrupeds, and made smaller versions for small quadrupeds.
  • Add medium quadruped superalloy armor, as a kind of rare, non craftable, efficient armor. They spawn where the small version spawn(ed).
  • Add a cpp fix from CDDA experimental so that pet armors can have environmental protection (until then it was always 0, even if a value was set in JSON files)
  • Balanced the armors protection values, some didn't quite make sense. Now the armors using stronger/rarer materials give a better protection
  • Buffed small quadruped armors. Before they gave close to useless defense values. Now they have roughly 75% of the protection value of medium armors.

Describe alternatives you've considered

  • Changing the bear and elephant bodytype to quadrupeds too. But an elephant using the same armor as a cow might be too much.

Testing

  • I used all the mods that referenced the old dog/horse armors, to fix loading errors
  • I spawned all the armors, and equipped most of them on several quadrupeds (horse, cow, dog, cat).
  • I also tried to see how good the armors were now. Now mid-late game medium sized armors (kevlar/superalloy) give roughly the same protection level as a heavy survivor gear, so it's quite high but animals can still be easily killed by mid to late game enemies, and enemies that do non physical damages.
  • Suggestion: I replaced the references to the dog/horse armors by their small/medium armor counterparts. This will cause problems for save compatibility. Should I keep the dog/horse armors and set them as obsolete?

Additional context

@olanti-p
Copy link
Contributor

Well that's a curious random failure, don't think I've seen this one yet. Restarted tests.

https://github.com/cataclysmbnteam/Cataclysm-BN/runs/8294199148?check_suite_focus=true

18:09:12.398 INFO : Randomness seeded to: 1662919752

 . . .

18:24:41.784 ERROR DEBUGMSG : src/npc.cpp:766 [void npc::place_on_map()] (error message will follow backtrace)
    ./tests/cata_test(__interceptor_backtrace+0x5b) [0x20ebb6b]
    ./tests/cata_test(_Z21debug_write_backtraceRSo+0x15b) [0x356ec9d]
    ./tests/cata_test(_ZN6detail12realDebugLogE2DL2DCPKcS3_S3_+0x42f) [0x356b9a9]
    ./tests/cata_test(_Z12realDebugmsgPKcS0_S0_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x1b8) [0x356af79]
    ./tests/cata_test(_ZN3npc12place_on_mapEv+0xb05) [0x4c0a4e7]
    ./tests/cata_test(_ZN4game9load_npcsEv+0x8b5) [0x37f6b7b]
    ./tests/cata_test(_Z10clear_npcsv+0xd9) [0x27081f8]
    ./tests/cata_test(_Z9clear_mapv+0x29) [0x2709155]
    ./tests/cata_test() [0x2e0be32]
    ./tests/cata_test() [0x2e07703]
    ./tests/cata_test() [0x2e06b83]
    ./tests/cata_test() [0x2e05ac9]
    ./tests/cata_test(_ZN5Catch10RunContext20invokeActiveTestCaseEv+0x18f) [0x2c03de1]
    ./tests/cata_test(_ZN5Catch10RunContext14runCurrentTestERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_+0x7ba) [0x2bfd3b4]
    ./tests/cata_test(_ZN5Catch10RunContext7runTestERKNS_8TestCaseE+0x80d) [0x2bfb395]
    ./tests/cata_test(_ZN5Catch7Session11runInternalEv+0x100f) [0x2c0b563]
    ./tests/cata_test(_ZN5Catch7Session3runEv+0x17b) [0x2c0a315]
    ./tests/cata_test(main+0x99c) [0x2c4853a]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7f54849b8083]
    ./tests/cata_test(_start+0x2e) [0x20b483e]

    Attempting to repeat stack trace using debug symbols…
    __interceptor_backtrace
    ??:?
    debug_write_backtrace(std::ostream&)
    ??:?
    detail::realDebugLog(DL, DC, char const*, char const*, char const*)
    ??:?
    realDebugmsg(char const*, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
    ??:?
    npc::place_on_map()
    ??:?
    game::load_npcs()
    ??:?
    clear_npcs()
    ??:?
    clear_map()
    ??:?
    clear_game_and_set_ramp(int, bool, bool)
    vehicle_ramp_test.cpp:?
    ramp_transition_angled(string_id<vehicle_prototype> const&, units::quantity<double, units::angle_in_radians_tag>, int, bool, bool)
    vehicle_ramp_test.cpp:?
    test_ramp(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)
    vehicle_ramp_test.cpp:?
    C_A_T_C_H_T_E_S_T_12()
    vehicle_ramp_test.cpp:?
    Catch::RunContext::invokeActiveTestCase()
    ??:?
    Catch::RunContext::runCurrentTest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)
    ??:?
    Catch::RunContext::runTest(Catch::TestCase const&)
    ??:?
    Catch::Session::runInternal()
    ??:?
    Catch::Session::run()
    ??:?
    main
    ??:?
    __libc_start_main
    ??:?
    _start
    ??:?
Backtrace emission took 4 seconds.
Failed to place NPC in a valid location near (43,6,-1)
18:24:45.031 ERROR DEBUGMSG : src/npc.cpp:766 [void npc::place_on_map()] Failed to place NPC in a valid location near (45,5,-1)
18:24:45.031 ERROR DEBUGMSG : src/npc.cpp:766 [void npc::place_on_map()] Failed to place NPC in a valid location near (45,4,-1)
18:24:45.032 ERROR DEBUGMSG : src/npc.cpp:766 [void npc::place_on_map()] Failed to place NPC in a valid location near (41,6,-1)
18:24:45.032 ERROR DEBUGMSG : src/npc.cpp:766 [void npc::place_on_map()] Failed to place NPC in a valid location near (43,2,-1)
18:24:45.033 ERROR DEBUGMSG : src/npc.cpp:766 [void npc::place_on_map()] Failed to place NPC in a valid location near (19,6,-1)
18:24:45.034 ERROR DEBUGMSG : src/npc.cpp:766 [void npc::place_on_map()] Failed to place NPC in a valid location near (21,5,-1)
18:24:45.034 ERROR DEBUGMSG : src/npc.cpp:766 [void npc::place_on_map()] Failed to place NPC in a valid location near (21,4,-1)
18:24:45.035 ERROR DEBUGMSG : src/npc.cpp:766 [void npc::place_on_map()] Failed to place NPC in a valid location near (17,6,-1)
18:24:45.036 ERROR DEBUGMSG : src/npc.cpp:766 [void npc::place_on_map()] Failed to place NPC in a valid location near (19,2,-1)

@Coolthulhu Coolthulhu self-assigned this Sep 15, 2022
@@ -1,6 +1,6 @@
[
{
"result": "acidchitin_harness_dog",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those recipes should get an "obsolete" copy, otherwise players who know the replaced recipes will get warnings on load.

For each recipe changed to a new id, you should add an entry in data/json/obsoletion/recipes.json. The entry should have only type, id, and a "obsolete": true tag.

"storage": "25 L",
"min_pet_vol": "20000 ml"
}
]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For compatibility, you should add a migration entry for each of those armors, so that they can be changed into the new ones.

Migration entries are located in data/json/items/migration.json and have a structure like:

{
    "id": "old_item_id_here",
    "type": "MIGRATION",
    "replace": "new_item_id_here"
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok it should be good, I spawned all items, learned all recipes in a save created in current experimental and could load it on this branch without error

@Coolthulhu Coolthulhu merged commit b14f838 into cataclysmbnteam:upload Sep 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants