Skip to content

Commit

Permalink
Action system seems more or less complete; starting on power-ups and …
Browse files Browse the repository at this point in the history
…characters
  • Loading branch information
floral-qua-floral committed Dec 18, 2024
1 parent 86d0aa7 commit be6972d
Show file tree
Hide file tree
Showing 78 changed files with 1,111 additions and 235 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.fqf.mario_qua_mario.definitions;

import net.minecraft.util.Identifier;
import org.jetbrains.annotations.NotNull;

public interface StompTypeDefinition {
@NotNull Identifier getID();
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fqf.mario_qua_mario.definitions;
package com.fqf.mario_qua_mario.definitions.states;

import com.fqf.mario_qua_mario.mariodata.IMarioClientData;
import com.fqf.mario_qua_mario.mariodata.IMarioData;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.fqf.mario_qua_mario.definitions.states;

import net.minecraft.util.Identifier;

public interface CharacterDefinition extends StatAlteringStateDefinition {
Identifier getInitialAction();
Identifier getInitialPowerUp();
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fqf.mario_qua_mario.definitions;
package com.fqf.mario_qua_mario.definitions.states;

import com.fqf.mario_qua_mario.mariodata.IMarioAuthoritativeData;
import com.fqf.mario_qua_mario.mariodata.IMarioClientData;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.fqf.mario_qua_mario.definitions.states;

import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public interface PowerUpDefinition extends StatAlteringStateDefinition, AttackInterceptingStateDefinition {
@Nullable Identifier getReversionTarget();
int getValue();

@Nullable SoundEvent getAcquisitionSound();
float getVoicePitch();

@NotNull PowerHeart getPowerHeart(PowerHeartHelper helper);

interface PowerHeartHelper {
PowerHeart auto();

PowerHeart standard(String namespace, String folder);

PowerHeart fromRoot(Identifier root);
}

record PowerHeart(
Identifier fullTexture, Identifier fullBlinkingTexture,
Identifier halfTexture, Identifier halfBlinkingTexture,
Identifier hardcoreFullTexture, Identifier hardcoreFullBlinkingTexture,
Identifier hardcoreHalfTexture, Identifier hardcoreHalfBlinkingTexture,
Identifier containerTexture, Identifier containerBlinkingTexture
) {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.fqf.mario_qua_mario.definitions.states;

import com.fqf.mario_qua_mario.util.StatCategory;

import java.util.Set;

public interface StatAlteringStateDefinition extends MarioStateDefinition {
float getWidthFactor();
float getHeightFactor();

int getBumpStrengthModifier();

Set<String> getPowers();

Set<StatModifier> getStatModifiers();

record StatModifier(
Set<StatCategory> match,
StatOperation operation
) {
public StatModifier(Set<StatCategory> match, double factor) {
this(match, (base, categories) -> base * factor);
}

@FunctionalInterface public interface StatOperation {
double modify(double base, Set<StatCategory> categories);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.fqf.mario_qua_mario.definitions.actions;
package com.fqf.mario_qua_mario.definitions.states.actions;

import com.fqf.mario_qua_mario.definitions.actions.util.IncompleteActionDefinition;
import com.fqf.mario_qua_mario.definitions.actions.util.TransitionDefinition;
import com.fqf.mario_qua_mario.definitions.states.actions.util.IncompleteActionDefinition;
import com.fqf.mario_qua_mario.definitions.states.actions.util.TransitionDefinition;
import com.fqf.mario_qua_mario.mariodata.IMarioTravelData;
import com.fqf.mario_qua_mario.util.CharaStat;
import org.jetbrains.annotations.NotNull;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.fqf.mario_qua_mario.definitions.actions;
package com.fqf.mario_qua_mario.definitions.states.actions;

import com.fqf.mario_qua_mario.definitions.actions.util.IncompleteActionDefinition;
import com.fqf.mario_qua_mario.definitions.actions.util.TransitionDefinition;
import com.fqf.mario_qua_mario.definitions.states.actions.util.IncompleteActionDefinition;
import com.fqf.mario_qua_mario.definitions.states.actions.util.TransitionDefinition;
import com.fqf.mario_qua_mario.mariodata.IMarioTravelData;
import com.fqf.mario_qua_mario.util.CharaStat;
import org.jetbrains.annotations.NotNull;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.fqf.mario_qua_mario.definitions.actions;
package com.fqf.mario_qua_mario.definitions.states.actions;

import com.fqf.mario_qua_mario.definitions.actions.util.IncompleteActionDefinition;
import com.fqf.mario_qua_mario.definitions.actions.util.TransitionDefinition;
import com.fqf.mario_qua_mario.definitions.states.actions.util.IncompleteActionDefinition;
import com.fqf.mario_qua_mario.definitions.states.actions.util.TransitionDefinition;
import com.fqf.mario_qua_mario.mariodata.IMarioTravelData;
import org.jetbrains.annotations.NotNull;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.fqf.mario_qua_mario.definitions.actions;
package com.fqf.mario_qua_mario.definitions.states.actions;

import com.fqf.mario_qua_mario.definitions.actions.util.IncompleteActionDefinition;
import com.fqf.mario_qua_mario.definitions.actions.util.TransitionDefinition;
import com.fqf.mario_qua_mario.definitions.states.actions.util.IncompleteActionDefinition;
import com.fqf.mario_qua_mario.definitions.states.actions.util.TransitionDefinition;
import com.fqf.mario_qua_mario.mariodata.IMarioTravelData;
import com.fqf.mario_qua_mario.util.CharaStat;
import org.jetbrains.annotations.NotNull;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.fqf.mario_qua_mario.definitions.actions;
package com.fqf.mario_qua_mario.definitions.states.actions;

import com.fqf.mario_qua_mario.definitions.actions.util.IncompleteActionDefinition;
import com.fqf.mario_qua_mario.definitions.actions.util.TransitionDefinition;
import com.fqf.mario_qua_mario.definitions.states.actions.util.IncompleteActionDefinition;
import com.fqf.mario_qua_mario.definitions.states.actions.util.TransitionDefinition;
import com.fqf.mario_qua_mario.mariodata.IMarioReadableMotionData;
import com.fqf.mario_qua_mario.mariodata.IMarioTravelData;
import com.fqf.mario_qua_mario.util.CharaStat;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fqf.mario_qua_mario.definitions.actions.util;
package com.fqf.mario_qua_mario.definitions.states.actions.util;

import com.fqf.mario_qua_mario.util.CharaStat;
import com.fqf.mario_qua_mario.util.StatCategory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fqf.mario_qua_mario.definitions.actions.util;
package com.fqf.mario_qua_mario.definitions.states.actions.util;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fqf.mario_qua_mario.definitions.actions.util;
package com.fqf.mario_qua_mario.definitions.states.actions.util;

public enum EvaluatorEnvironment {
CLIENT_ONLY,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fqf.mario_qua_mario.definitions.actions.util;
package com.fqf.mario_qua_mario.definitions.states.actions.util;

import com.fqf.mario_qua_mario.definitions.AttackInterceptingStateDefinition;
import com.fqf.mario_qua_mario.definitions.states.AttackInterceptingStateDefinition;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fqf.mario_qua_mario.definitions.actions.util;
package com.fqf.mario_qua_mario.definitions.states.actions.util;

/**
* Affects whether Mario plays footstep sounds and whether view-bobbing occurs.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.fqf.mario_qua_mario.definitions.states.actions.util;

public enum SneakingRule {
ALLOW,
PROHIBIT,
SLIP,
FORCE
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.fqf.mario_qua_mario.definitions.states.actions.util;

public enum SprintingRule {
ALLOW,
PROHIBIT
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fqf.mario_qua_mario.definitions.actions.util;
package com.fqf.mario_qua_mario.definitions.states.actions.util;

import com.fqf.mario_qua_mario.mariodata.IMarioClientData;
import com.fqf.mario_qua_mario.mariodata.IMarioReadableMotionData;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fqf.mario_qua_mario.definitions.actions.util;
package com.fqf.mario_qua_mario.definitions.states.actions.util;

import net.minecraft.util.Identifier;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,21 @@ public interface IMarioAuthoritativeData extends IMarioData {

void setEnabled(boolean enable);

boolean setAction(Identifier actionID);
boolean setAction(String actionID);
boolean transitionToAction(Identifier actionID);
boolean transitionToAction(String actionID);

void setActionTransitionless(Identifier actionID);
void setActionTransitionless(String actionID);
void assignAction(Identifier actionID);
void assignAction(String actionID);

void setPowerUp(Identifier powerUpID);
void setPowerUp(String powerUpID);
void empowerTo(Identifier powerUpID);
void empowerTo(String powerUpID);

void setCharacter(Identifier characterID);
void setCharacter(String characterID);
void revertTo(Identifier powerUpID);
void revertTo(String powerUpID);

void assignPowerUp(Identifier powerUpID);
void assignPowerUp(String powerUpID);

void assignCharacter(Identifier characterID);
void assignCharacter(String characterID);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public interface IMarioData {
Identifier getPowerUpID();
Identifier getCharacterID();

boolean hasPower(String power);

double getStat(CharaStat stat);
double getStatMultiplier(CharaStat stat);
int getBumpStrengthModifier();
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.fqf.mario_qua_mario.actions.generic;

import com.fqf.mario_qua_mario.MarioQuaMarioContent;
import com.fqf.mario_qua_mario.definitions.actions.GenericActionDefinition;
import com.fqf.mario_qua_mario.definitions.actions.util.*;
import com.fqf.mario_qua_mario.definitions.states.actions.GenericActionDefinition;
import com.fqf.mario_qua_mario.definitions.states.actions.util.*;
import com.fqf.mario_qua_mario.mariodata.IMarioAuthoritativeData;
import com.fqf.mario_qua_mario.mariodata.IMarioClientData;
import com.fqf.mario_qua_mario.mariodata.IMarioTravelData;
Expand Down Expand Up @@ -50,7 +50,6 @@ public class Debug implements GenericActionDefinition {

}
@Override public void travelHook(IMarioTravelData data) {
MarioQuaMarioContent.LOGGER.info("Debug travelHook uwu! >.<");
data.getTimers().actionTimer++;
data.setForwardStrafeVel(data.getInputs().getForwardInput() * 0.5, data.getInputs().getStrafeInput() * 0.5);
data.setYVel(data.getInputs().JUMP.isHeld() ? 0.4 : (data.getInputs().DUCK.isHeld() ? -0.4 : (0.03 * Math.sin((double) data.getTimers().actionTimer++ / 16))));
Expand All @@ -60,7 +59,7 @@ public class Debug implements GenericActionDefinition {
return List.of(
new TransitionDefinition(
MarioQuaMarioContent.makeID("debug_sprint"),
data -> data.getMario().isSprinting(), EvaluatorEnvironment.CLIENT_ONLY,
data -> data.getMario().isSprinting(), EvaluatorEnvironment.COMMON,
null,
(data, isSelf, seed) -> data.playSound(SoundEvents.ENTITY_VEX_CHARGE, seed)
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.fqf.mario_qua_mario.actions.generic;

import com.fqf.mario_qua_mario.MarioQuaMarioContent;
import com.fqf.mario_qua_mario.definitions.actions.util.EvaluatorEnvironment;
import com.fqf.mario_qua_mario.definitions.actions.util.TransitionDefinition;
import com.fqf.mario_qua_mario.definitions.states.actions.util.EvaluatorEnvironment;
import com.fqf.mario_qua_mario.definitions.states.actions.util.TransitionDefinition;
import com.fqf.mario_qua_mario.mariodata.IMarioTravelData;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Identifier;
Expand All @@ -27,7 +27,7 @@ public class DebugSprint extends Debug {
return List.of(
new TransitionDefinition(
MarioQuaMarioContent.makeID("debug"),
data -> !data.getMario().isSprinting(), EvaluatorEnvironment.CLIENT_ONLY,
data -> !data.getMario().isSprinting(), EvaluatorEnvironment.SERVER_ONLY,
null,
(data, isSelf, seed) -> data.playSound(SoundEvents.ENTITY_ALLAY_AMBIENT_WITH_ITEM, seed)
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.fqf.mario_qua_mario.actions.grounded;

import com.fqf.mario_qua_mario.MarioQuaMarioContent;
import com.fqf.mario_qua_mario.definitions.actions.GroundedActionDefinition;
import com.fqf.mario_qua_mario.definitions.actions.util.*;
import com.fqf.mario_qua_mario.definitions.states.actions.GroundedActionDefinition;
import com.fqf.mario_qua_mario.definitions.states.actions.util.*;
import com.fqf.mario_qua_mario.mariodata.IMarioAuthoritativeData;
import com.fqf.mario_qua_mario.mariodata.IMarioClientData;
import com.fqf.mario_qua_mario.mariodata.IMarioTravelData;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.fqf.mario_qua_mario.characters;

import com.fqf.mario_qua_mario.MarioQuaMarioContent;
import com.fqf.mario_qua_mario.definitions.states.CharacterDefinition;
import com.fqf.mario_qua_mario.mariodata.IMarioAuthoritativeData;
import com.fqf.mario_qua_mario.mariodata.IMarioClientData;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.NotNull;

import java.util.Set;

public class Mario implements CharacterDefinition {
@Override public @NotNull Identifier getID() {
return MarioQuaMarioContent.makeID("mario");
}

@Override public Identifier getInitialAction() {
return MarioQuaMarioContent.makeID("debug");
}
@Override public Identifier getInitialPowerUp() {
return MarioQuaMarioContent.makeID("small");
}

@Override public float getWidthFactor() {
return 1;
}
@Override public float getHeightFactor() {
return 1;
}

@Override public int getBumpStrengthModifier() {
return 0;
}

@Override public Set<String> getPowers() {
return Set.of();
}

@Override public Set<StatModifier> getStatModifiers() {
return Set.of();
}

@Override public void clientTick(IMarioClientData data, boolean isSelf) {

}

@Override public void serverTick(IMarioAuthoritativeData data) {

}
}
Loading

0 comments on commit be6972d

Please sign in to comment.