Item record, tried to fix swapping
This commit is contained in:
parent
92fb49191b
commit
f3aee6cb84
6 changed files with 1142 additions and 906 deletions
|
|
@ -102,6 +102,10 @@ public class GameCore implements GameLogic {
|
|||
List<MaterialData> MusketMat = ModelLoader.LoadMaterials("resources/models/musket/musket_mat.json");
|
||||
RevolverData = ModelLoader.LoadModel("resources/models/Revolver/Revolver.json");
|
||||
List<MaterialData> RevolverMat = ModelLoader.LoadMaterials("resources/models/Revolver/Revolver_mat.json");
|
||||
Item MusketItem = new Item(MusketData.ID(), 1.0f, 8);
|
||||
Item RevolverItem = new Item(RevolverData.ID(), 2.0f, 6);
|
||||
scene.MusketItem = MusketItem;
|
||||
scene.RevolverItem = RevolverItem;
|
||||
boolean createOfflinePlayer = !PrimaryRuntime.Server && !ClientConnectionThread.Connected;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class Actor{
|
|||
public static final Map<String, Actor> Actors = new HashMap<>();
|
||||
public static final List<String> ActorNames = new ArrayList<>();
|
||||
protected final String ID;
|
||||
protected final String ModelID;
|
||||
protected String ModelID;
|
||||
protected final Matrix4f ModelMatrix;
|
||||
protected final Vector3f Position;
|
||||
protected final Vector3f PositionOffset;
|
||||
|
|
@ -273,6 +273,7 @@ public class Actor{
|
|||
|
||||
public String GetID(){return ID;}
|
||||
public String GetModelID(){return ModelID;}
|
||||
public void SetModelID(String ModelID) { this.ModelID = ModelID; }
|
||||
public Matrix4f GetModelMatrix(){return ModelMatrix;}
|
||||
public Vector3f GetPosition(){ return Position;}
|
||||
public Quaternionf GetRotation(){return Rotation;}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
package net.halbear.Terrain4J.EngineCore.Main.Scene;
|
||||
|
||||
public record Item(String ModelID, float FireRate, int MagazineCapacity) {
|
||||
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@ import net.halbear.Terrain4J.EngineCore.Threads.ClientConnectionThread;
|
|||
import net.halbear.Terrain4J.EngineCore.Threads.RenderThread;
|
||||
import net.halbear.Terrain4J.EngineCore.Vulkan.Rendering.DynamicMesh.DynamicTerrainMesh;
|
||||
import net.halbear.Terrain4J.EngineCore.Vulkan.Rendering.Projection.Project3D;
|
||||
import net.halbear.Terrain4J.EngineCore.Main.Scene.Item;
|
||||
import org.joml.Vector2f;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
|
|
@ -62,8 +63,8 @@ public class Scene implements IScene {
|
|||
public PlayerActor CurrentWeapon;
|
||||
public PlayerActor Musket;
|
||||
public PlayerActor Revolver;
|
||||
private final StartMenu startMenu = new StartMenu();
|
||||
public boolean StartMenuActive = true;
|
||||
public Item MusketItem;
|
||||
public Item RevolverItem;
|
||||
|
||||
public List<String> ActiveGUIs = new ArrayList<>();
|
||||
public Map<String, GUIOverlay> GUIReg = new HashMap<>();
|
||||
|
|
@ -265,6 +266,7 @@ public class Scene implements IScene {
|
|||
parent.SetPlayerActorID(Revolver.GetID());
|
||||
Musket.AttachedCameraID = "NULL";
|
||||
Revolver.AttachedCameraID = "DebugCamera";
|
||||
Revolver.SetModelID(MusketItem.ModelID());
|
||||
|
||||
}
|
||||
if (input.keySinglePress(GLFW_KEY_M) && CurrentWeapon != Musket) {
|
||||
|
|
@ -276,6 +278,7 @@ public class Scene implements IScene {
|
|||
parent.SetPlayerActorID(Musket.GetID());
|
||||
Musket.AttachedCameraID = "DebugCamera";
|
||||
Revolver.AttachedCameraID = "NULL";
|
||||
Musket.SetModelID(RevolverItem.ModelID());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -286,9 +289,9 @@ public class Scene implements IScene {
|
|||
}
|
||||
MouseListener mouseListener = window.getMouseInput();
|
||||
if (mouseListener.isRightButtonPressed()) {
|
||||
CurrentWeapon.SetPositionOffset(new Vector3f(0f,1.0f,-1.25f)); // centered = aiming
|
||||
CurrentWeapon.SetPositionOffset(new Vector3f(0f,1.0f,-1.25f));
|
||||
} else {
|
||||
CurrentWeapon.SetPositionOffset(new Vector3f(0.5f,1.0f,-1.25f)); // hip-fire default
|
||||
CurrentWeapon.SetPositionOffset(new Vector3f(0.5f,1.0f,-1.25f));
|
||||
}
|
||||
if(input.keyPressed(GLFW_KEY_1)) {
|
||||
Gimbal.universalType = Gimbal.GimbalType.Move;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue