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 Feature: Modulus and Is Even commands #976

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

Arylos07
Copy link
Contributor

@Arylos07 Arylos07 commented Jun 1, 2021

Description

Added 2 new Math commands that can be useful for some operations.

  • Modulus Int - Performs a modulus math operation on 2 integers and puts the result in a Flowchart variable.
  • Modulus Float - Performs a modulus math operation on 2 floats and puts the result in a Flowchart variable.
  • Is Even - A conditional command that takes a number (float or integer) and checks if it's even.

What is the current behavior?

There is no behaviour for this right now. The current best solution is to do something like this.
Weird maths

What is the new behavior?

  • Modulus Int/Float - You can now input a float/int and get a remainder from it using a modulus operation. Due to casting issues, there are 2 versions of the command; float and int. Float takes 2 float inputs and Int takes 2 integer inputs. The result is the same, however and both will output to a float or integer variable, so you can take 2 ints and output a float, if needed.
    Screenshot_189
    Screenshot_190

  • Is Even - Here you can take either a float or int variable and check if it's even. There is no numerical input since, let's be real here, you're going to check using a variable.
    Screenshot_188

Important Notes

  • My change require modifcations or additions to documentation
  • My change modifies the workflow/editing of flowcharts/blocks/commands etc.
  • The only one user with a breaking change made by this is @breadnone since they have a Modulus command that is actually Is Even. They will need to delete that command and replace it with the Is Even command in this PR. Sadly, there's no real way to do this easily besides deleting all of your Modulus commands and replacing them with Is Even by hand (Sorry mate)

Other information

Important: because I did a silly, this PR includes changes from PR #934 which contains an optional boolean to Writer Audio. When merging this branch, 934 can be deleted as this already contains it.

Future updates could include having specific say commands ignore the text limits, just in case your Say Dialog is using Best Fit and you want just a couple commands to be a little longer than the rest, if such a feature is not added prior to merging this PR.

Arylos07 and others added 5 commits December 28, 2020 02:18
This issue seemed simple to tackle and the feature would be nice to add depending on what audio you use. The dopplering effect is minor with the built-in sound clips, but amplified with things like typewriters.

* Added a Lerp Writer Audio bool.
  * When enabled (default), the WriterAudio uses the default behaviour of using MoveTowards for volume.
  * When disabled, the WriterAudio sets the audio volume to the target volume while writing, removing the lerp effect.

This setting is enabled by default on the say dialogue prefab Fungus spawns by default and therefore cannot be set at runtime.
* The Modulus command runs the same operation as x % y == z. This will allow checking whole numbers and other such fun operations like checking list indexes.

* Added an Is Even conditional command that checks an inputted variable and returns true if the number is even.
* Changed IsEven and Modulus command input variable names to input, this way it's more concise.

* Fixed Modulus' summary displaying Fungus.FloatData when a variable was not set.
* Changed from one Modulus to Modulus int and modulus float. This prevents some random issues with having different variable types. Alas, you cannot modulo a int and a float together.
@Arylos07 Arylos07 changed the title Modulus command New Feature: Modulus and Is Even commands Jun 1, 2021
@stevehalliwell stevehalliwell added this to the 3.14 milestone Jun 4, 2021
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.

2 participants