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

new crafting bugs: extract poison and "fire sparks" #554

Closed
AquariusPower opened this issue Mar 19, 2019 · 5 comments
Closed

new crafting bugs: extract poison and "fire sparks" #554

AquariusPower opened this issue Mar 19, 2019 · 5 comments

Comments

@AquariusPower
Copy link
Contributor

AquariusPower commented Mar 19, 2019

are these happening for you too? if they aren't, it could be specific to my current char/savegame or the way I tried to use'm.

  1. Something changed on crafting and now the anvil soft explosions are big and quickly destroy the very anvil.

  2. Extracting poison stopped working, apparently the potion that would be spawned is considered as not craftable, may be an exception could be added to it? I got this ABORT()

Main/Source/cmdcraft.cpp-3094-  if(!craftcore::canBeCrafted(itSpawn)){
Main/Source/cmdcraft.cpp-3095-    ABORT(
Main/Source/cmdcraft.cpp:3096:      "Dear developer, for the sake of balance and challenge do not create recipes for:\n"

I had only empty bottles and used a small spider corpse, but I think that makes no diff.

@jakwings
Copy link
Member

jakwings commented Mar 20, 2019

The only related change is #538 : containers are auto-emptied so bottles (not vials) can pass the first craftcore::canBeCrafted check.

re (1): What are you crafting? The related code for explosion power is in crafthandle::CheckIngredients.

re (2): Can the code be reorganized so a second craftcore::canBeCrafted check is unnecessary? This doesn't seem to be a too-messy-to-control condition as most operations are done in that single file.

@AquariusPower
Copy link
Contributor Author

sparks explosion

crafting: a pickaxe;
craftSkill: 11.2;
using: stick of fungiwood with 400cm3 and a copper ingot 225cm3;

crafthandle::CheckFumble()

I monitored the debug log with this script: ivanDbgmsg.sh <filter>

and the strongest xplosion was "4":

2019/03/23-20:42:49(224417) cmdcraft.cpp:3309:CheckFumble:{rpd.xplodStr}="4";{rpd.dbgInfo().CStr()}="rc.IsCanBeSuspended()=1; itToolID=88386; itTool2ID=0; itSpawnCfg=0; itSpawnMatMainCfg=4099; itSpawnMatMainVol=225; itSpawnMatSecCfg=4226; itSpawnMatSecVol=400; otSpawnCfg=0; otSpawnMatMainCfg=0; otSpawnMatMainVol=0; otSpawnMatSecCfg=0; otSpawnMatSecVol=0; fsItemSpawnSearchPrototype=pickaxe; fsCraftInfo=create an item, started at Underwater Tunnel II; v2AnvilLocation=140,6; v2ForgeLocation=143,8; v2WorkbenchLocation=0,0; v2PlaceAt=0,0; v2PlayerCraftingAt=141,7; ";

this means the explosion value is correct!

something else is turning it into a big one.

may be adding a debug log (or a break point using a debugger like nemiver or a better one) showing the stack DBGSTK for every explosion and it's strength at level::Explosion() could hint what could be happening more precisely (but my guess is something is making it big even with small values now), the explosion size (sparks) should not be bigger than one square (anvil's one)

PS.: catched also a glitch that we can craft being far away from the anvil making it quite a safe action (when shouldnt be). the anvil should be on a nearby square to allow crafting!

extract poison (possible insta fix see at the end)

from netbeans search:

cmdcraft.cpp
  struct srpForgeItem : public recipe{
    virtual bool work(recipedata& rpd){DBGLN;
      2184:  if(craftcore::canBeCrafted(itSpawn)){
    item* crafthandle::SpawnItem(recipedata& rpd, festring& fsCreated)
      3094:  if(!craftcore::canBeCrafted(itSpawn)){
    void crafthandle::CheckIngredients(recipedata& rpd){
      3340:  if(!craftcore::canBeCrafted(it)){ //basically contains some kind of magic

canBeCrafted()
1st - a loop when the user is trying to create an item
2nd - the extra essential check after the item is created when not using the user loop (1st chk). Intended for direct recipes/functionalities like the poison extraction spawing a bottle/vial, but could be any other thing one day.
3rd - a simple check to increase explosion size

but, I think that moving this "if"
if(it->GetCategory()==POTION)
to before this one
if(game::IsQuestItem(it) ||
at craftcore::canBeCrafted()
could be enough, just needs testing/compile/etc to confirm that xD

but I think the best could be to move
if(game::IsQuestItem(it) ||
to the very end, as last check, to grant it wont mess other simpler checks :)

@AquariusPower
Copy link
Contributor Author

AquariusPower commented Mar 29, 2019

I got this stack:

#0  level::Explosion(this = 0x27ee460, Terrorist = 0x2dfcf80, DeathMsg = , Pos = , Strength = 17, HurtNeutrals = false, FireOnly = false) at Main/Source/level.cpp:1029
#1  craft::Handle(this = 0x2ab1050) at Main/Source/actions.cpp:351
#2  character::Be(this = 0x2dfcf80) at Main/Source/char.cpp:1064
#3  pool::Be() at Main/Source/pool.cpp:31
#4  game::Run() at Main/Source/game.cpp:1115
#5  main(argc = 1, argv = 0x7ffffffc2b98) at Main/Source/main.cpp:164

Strength = 17 (rpdBkp.xplodStr), so at craft::Handle is this: game::GetCurrentLevel()->Explosion(..., rpdBkp.v2XplodAt, rpdBkp.xplodStr, false, false);

void crafthandle::CheckFumble(recipedata& rpd,bool bChangeTurns)
{
  rpd.rc.integrityCheck();
//  if(!v2XplodAt.Is0()){DBGSV2(v2XplodAt);
  if(rpd.fDifficulty>1.0){
    int xplodXtra=0;
    for(int i=0;i<rpd.iStrongerXplod;i++)
      xplodXtra+=clock()%5;

it appears that xplodXtra may be becoming too big, based on rpd.iStrongerXplod loops,
but I still dont understand what changes could lead to that? from ingredient enchantment makes no sense as it was not enchanted (the stick and the ingot)

I am also having trouble to debug with nemiver as I cant see most of the variables/fields values, or may be I just dont know how to use it well...

Obs.: to be only one square, the explosion strength would have to be <= 10, but if the ingredients are enchanted (wonder if that test case will ever happen) the explosion may be larger ( > 10 ) and that would be ok (if ever happens).

PS.: I would like to know if anyone else is having that problem, otherwise I upload my savegame as testcase.

@AquariusPower
Copy link
Contributor Author

created a new game, and the problem happened again.
a workaround would be to limit the value of rpdBkp.xplodStr just before
game::GetCurrentLevel()->Explosion(...) is called at craft::Handle until someone findout why it is getting so big.
I suggest if it is >=10 make it =9 and I think the explosion will be limited to 1 square.

@AquariusPower
Copy link
Contributor Author

AquariusPower commented Apr 6, 2019

ah.. finally got some time to look on it:

  • Fixed extracting fluids: I think the problem may not be directly related to new changes as I couldnt link it to'em. I just dont understand why it didnt happen before.
  • fixed anvil sparks strength (just limited it)
  • fixed anvil proximity requirement
  • fixed random bug at humanoid::SetEquipment() when item is passed as NULL as param.
  • added crafting hiteffect (another fancy idea :))

See latest changes on commit log (check also the changed code specific to this issue) at Apr 5, 2019.
https://github.com/AquariusPower/ivan/commits/AutoPickupRegex

I wont be able to test any more than what I already did tho sorry :(
feel free to create and maintain a PR of that code :)

red-kangaroo added a commit to red-kangaroo/ivan that referenced this issue Nov 6, 2019
Merge changes and bugfixes from @AquariusPower. Should fix Attnam#554

Squashed because of large number of commits:

* WIP: added auto-pickup list currently 'kiwi|wand|dagger', easy to become an user cfg option later;
Fix for when entering a new area/map/dungeon, will create the map note for stairs and try to pick things there;

* Fixed: help F1 in case of wide lines, hard limit 80 chars for now;
AutoPickUpMatching user option added with detailed help;

* autopickup: fix for owned rooms;

* autopickup: ignore spoiling;

* autopickUp: complex perl regex working with initial example;
iosystem - global AlertConfirmMsg();

* autoPickUp: fixed default regex example;

* autopickup: improved default regex;

* autoPickUp: improved default regex;

* more useful default pickup regex match

* Doc/HelperScripts/ivanDbgmsg.sh: helper to monitor dbgmsg logs;

* craft: limit firesparks to one square
craft: re-allow craftable poison/sulphuricacid

* craft: added dbg msgs and better abort on craft denial

* craft: validate crafted only after it is completely ready;
humanoid::SetEquipment: check if item is not null prior to ResetFlyingThrownStep;

* craft: now anvil must be on adjacent square;

* hiteffectSetup: better/granted init fields;
craft: hiteffects when creating items/building;

* craft: check craftability b4 being "broken";

* craft: hiteffect fix to check for tools and arms;

* craft: workbench should be damaged w/o explosions (that are area effect of fire/forge);
AutoPickUp: improved default;

* craft: craftcore::canBeCrafted() always allows sticks now (happens when splitting one in many);

* crafting: easier carving, most common bladed weapons can be used now;

* craft: restored capability to craft the simple chests;

* fixed old crash when Terra is being asked for lycanthropy cure at crystal cave;

* Main/Include/definesvalidator.h: recreated using (ctrl+`) console command DefVal, also revalidated w/o errors!;

* crafthandle::SpawnItem() fixed (workaround) a crash when the final message gets too big

* fix Terra when player has the seedling and she wouldn't cure anymore

* changed auto-pickup to "thrown weapons" only (never made much sense about other items)

* crafted chests now come unlocked;
wizard autoplay will be auto disabled to let the read command work again;

* commandsystem::IsForRegionListItem() and ::IsForRegionSilhouette() properly implemented now to compare with the command's linked function pointer (instead of the hard to maintain description);
auto map note for fountains;
deprecated: Doc/HelperScripts/prepareCmdsDescrCode.sh;

* auto map note for chair and doublebed;

* craft: lowered annoyance to access new craftings by hitting space;

* craft: changed flow to let resume/cancel be the first craft option;

* craft: nice(?) chosen action message;

* fixed: pet stay put at CheckForEnemies() if MayMoveRandomly=true;
craft: cleared missing tool msg;

* fix glitch that lets steal just sold weapons from shop using weaponswap command key;
added bugtrack breakpoint (debug mode only) when showing the map, and also a workaround to prevent crash;

* crafting: shows suspended total;

* sfx: skips chat messages now;

* "Show god info" option changed context:
- now F1 shows god's description for coherency
- and extra info is now last remembered player's offer god's reaction (much more useful)
- v133 (at least) savegames will be imported automatically

* items now have DescriptiveInfo that will be shown by pressing F1

* craft: sticks are now "dismantable" into lumps, to easify the melting code;

* chat now is easier with previous NPC (as long it dont move)

* craft: better carving fail message and failToolMsg();
auto-pickup: wont do it to items auto marked with #d when dropped (but cleared on pickup);
auto-pickup: improved default regex;

* auto-pickup: better help info;
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

No branches or pull requests

2 participants