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

JSON-ify hallucinations #69919

Merged
merged 14 commits into from
Dec 5, 2023

Conversation

MNG-cataclysm
Copy link
Contributor

@MNG-cataclysm MNG-cataclysm commented Dec 2, 2023

Summary

Infrastructure "JSON-ify hallucinations"

Purpose of change

Hallucinations are interesting, and something that could be developed some more. The big issues with that are the barrier to entry on their codebase, as few people here know enough C++ to do something like that. This will also implement #68846.

Describe the solution

Currently, there's a lot of work to do on this:

  • Add the different levels of hallucinations
  • Implement minor auditory, mental, and ocular hallucinations.
  • Implement intermediate effects, like olfactory and tactile hallucinations that cause the character to do something.
  • Add larger hallucinations, like seeing full-on monsters and NPCs, or nonexistent extraplanar entities (unrelated to portal shenanigans)
  • Add extreme forms of hallucinations: panic attacks, full-body sensations, and other things of that nature.
  • Divide these tiers up based on effects: drinking and mushrooms should not cause more extreme forms, Kaluptic Psychosis should, etc.
  • Allow these to be blocked or managed by antipsychotics.
  • Delete the old C++ after cross-referencing is finished.

The basic work is done with this, though I would like to expand it some more.

Describe alternatives you've considered

Not doing this.

Testing

Everything works quite well, no observable issues.

Additional context

I've been trying to locate the C++ that controls hallucinations for Kaluptic Psychosis and related effects, but I can't find it yet. Thanks to @GuardianDll for pointing me to the right file.

There's more I'd like to do with this, but this PR is already quite large in and of itself. So, that will have to wait.

Also, should hallucinations stemming from portal-related issues get worse during portal storms?

@github-actions github-actions bot added [JSON] Changes (can be) made in JSON EOC: Effects On Condition Anything concerning Effects On Condition Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Dec 2, 2023
@GuardianDll
Copy link
Member

my apologies as i misguided you, the effect for kaluptic psychosis are stored in suffer::from_schizophrenia
https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/suffer.cpp#L551

@MNG-cataclysm
Copy link
Contributor Author

my apologies as i misguided you, the effect for kaluptic psychosis are stored in suffer::from_schizophrenia

https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/suffer.cpp#L551

Thank you, and there's no need to apologize. Mistakes happen.

@github-actions github-actions bot added the Lore Game lore, in-game communication. Also the Lore tab. label Dec 3, 2023
@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` and removed BasicBuildPassed This PR builds correctly, label assigned by github actions labels Dec 3, 2023
@MNG-cataclysm
Copy link
Contributor Author

I would like to implement weapon dropping, but the effect for it doesn't currently work. See #69902.

@MNG-cataclysm MNG-cataclysm marked this pull request as ready for review December 3, 2023 01:22
@MNG-cataclysm MNG-cataclysm changed the title [WIP] JSON-ify hallucinations JSON-ify hallucinations Dec 3, 2023
@github-actions github-actions bot removed the astyled astyled PR, label is assigned by github actions label Dec 3, 2023
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot added the astyled astyled PR, label is assigned by github actions label Dec 3, 2023
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Dec 3, 2023
@Maleclypse
Copy link
Member

Maleclypse commented Dec 3, 2023

I'm going to have to keep trying to test this because for some reason it's failed to compile two times in a row on my computer.

edit: hahaha figured out why it wasn't compiling. it pulled in changes from another PR I was working on.

@MNG-cataclysm
Copy link
Contributor Author

In that case, do you think this is good to go?

@Maleclypse
Copy link
Member

In that case, do you think this is good to go?

Yeah bleed isn't referenced by anything else in suffer than the things you pulled over weirdly. I'm testing kaluptic right now wish me luck :)

@Maleclypse
Copy link
Member

Ok I managed to experience all of the effects except the weapon talking from bleeding so this is close to ready. :) Thank you for doing this!

@Maleclypse
Copy link
Member

Weapon talk bug
Found a bug in the weapon talk snippets.

@MNG-cataclysm
Copy link
Contributor Author

Ok I managed to experience all of the effects except the weapon talking from bleeding so this is close to ready. :) Thank you for doing this!

Quite welcome. I think that weapon bleed talking might have something to do with the global book being defined, it was working when I tested it for development stuff. I'll figure out something for it.

@MNG-cataclysm
Copy link
Contributor Author

Weapon talk bug

Found a bug in the weapon talk snippets.

Do you know of any way to get a name of something, and save it as a string of some form of variable for dialogue with JSON? If not, could the old get.name C++ be hooked up to JSON stuff to make that happen? If it's not possible right now, I'll just use vaguer terms in place of #%$! for now.

@GuardianDll
Copy link
Member

There is no such thing in EoC. Potential solution might be if run_inv_eocs would be able to store found item in variable, but it can't do this at this moment

@Maleclypse
Copy link
Member

There is no such thing in EoC. Potential solution might be if run_inv_eocs would be able to store found item in variable, but it can't do this at this moment

Would #69857 make that possible?

@GuardianDll
Copy link
Member

no, this one just allow to pass custom variable for run_eocs/queue_eocs, it doesn't modify run_inv_eocs

@MNG-cataclysm
Copy link
Contributor Author

I guess I could put in a feature request for that.

@MNG-cataclysm
Copy link
Contributor Author

Alright, that should fix all of the bugs.

@github-actions github-actions bot removed the json-styled JSON lint passed, label assigned by github actions label Dec 4, 2023
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot added the json-styled JSON lint passed, label assigned by github actions label Dec 4, 2023
@Maleclypse Maleclypse merged commit 95930d9 into CleverRaven:master Dec 5, 2023
24 of 25 checks passed
@MNG-cataclysm MNG-cataclysm deleted the hallucination_jsonify branch December 5, 2023 16:51
GuardianDll pushed a commit to GuardianDll/Cataclysm-DDA that referenced this pull request Dec 7, 2023
* WIP part 1

* WIP part 2

* WIP part 3

* Delete old C++

* Oops

* Bugfix 1

* Bugfix 2

* Bugfix 3

* Update src/player_hardcoded_effects.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Bugfix 4

* Un-inline the EOCs, separate

* Fix bleed EOCs and symbol messup

* Update hallucination_eocs.json

* Update hallucination_eocs.json

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Comment on lines -1193 to -1215
if( u.has_trait( trait_SCHIZOPHRENIC ) && !u.has_effect( effect_took_thorazine ) &&
one_in( 43200 ) && u.is_avatar() ) {
if( one_in( 2 ) ) {
u.sound_hallu();
} else {
int max_count = rng( 1, 3 );
int count = 0;
for( const tripoint &mp : here.points_in_radius( u.pos(), 1 ) ) {
if( mp == u.pos() ) {
continue;
}
if( here.has_flag( ter_furn_flag::TFLAG_FLAT, mp ) &&
here.pl_sees( mp, 2 ) ) {
g->spawn_hallucination( mp );
if( ++count > max_count ) {
break;
}
}
}
}
it.set_duration( 0_turns );
woke_up = true;
}
Copy link
Member

Choose a reason for hiding this comment

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

was this part ported to json, because i can't find anything that can spawn hallucinations in the hallucination_eocs.json

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't port this to JSON, I just used the hallucinating effect to do that.

Copy link
Member

@GuardianDll GuardianDll Jan 4, 2024

Choose a reason for hiding this comment

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

isn't hallucination effect is what was jsonified here?
i just tested, applied hallu, and got no hallucinations (aka hallucination of monsters that tries to attack you) at all, and i assume this piece of code respond for it
(i want to expand it a bit, hence the quesion)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style EOC: Effects On Condition Anything concerning Effects On Condition [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Lore Game lore, in-game communication. Also the Lore tab.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants