Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hatmatty committed Nov 2, 2021
1 parent e786457 commit e335b97
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 7 deletions.
Binary file modified build.rbxl
Binary file not shown.
3 changes: 2 additions & 1 deletion src/client/controllers/SpringCam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class SpringCamera implements OnInit {
return head.Position;
}

return root.Position.add(new Vector3(0, neck.C0.Y, 0));
return root.Position.add(new Vector3(0, neck.C0.Y + 1, 0));
}

/**
Expand Down Expand Up @@ -173,6 +173,7 @@ export class SpringCamera implements OnInit {
rootPart.CFrame = CFrame.lookAt(rootPart.Position, rootPart.Position.add(lookXZ));
}
}
Camera.FieldOfView = 85;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/client/modules/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ export class Toolbar extends Roact.Component<props> {
const Elements: Roact.Element[] = [];

const ids = Object.keys(this.props);
this.total = ids.size() - 1; // because 1 of them is Roact.Children and another "ToggledStatus"
this.total = ids.size(); // because 1 of them is Roact.Children and another "ToggledStatus"

for (const id of ids) {
if (id === Roact.Children || id === "ToggledStatus") {
if (id === Roact.Children) {
return;
}

Expand Down
9 changes: 8 additions & 1 deletion src/server/components/Bow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class Bow extends Essential<ToolAttributes, RangedInstance> {
this.Behavior.RaycastParams = this.CastParams;
this.Behavior.CosmeticBulletProvider = this.Provider;
this.Behavior.AutoIgnoreContainer = true;
this.Behavior.Acceleration = new Vector3(0, -game.Workspace.Gravity / 2, 0);
this.Behavior.Acceleration = new Vector3(0, -game.Workspace.Gravity / 6, 0);

this.InputInfo.Enabled.Begin = {
MouseButton1: {
Expand Down Expand Up @@ -264,6 +264,7 @@ export class Bow extends Essential<ToolAttributes, RangedInstance> {
this.ToggleArrow("Enable");
const [Player, Char] = this.GetCharPlayer();
this.ActiveAnimation = playAnim(Char, anims.Shoot, { Fade: 0.4 });
this.ActiveAnimation.Priority = Enum.AnimationPriority.Action;
this.NotMoving = 0;

Events.ToggleRangedGUI(Player, true);
Expand All @@ -279,6 +280,12 @@ export class Bow extends Essential<ToolAttributes, RangedInstance> {
error("");
}

const PrevWalkSpeed = Humanoid.WalkSpeed;
Humanoid.WalkSpeed = PrevWalkSpeed / 1.5;
janitor.Add(() => {
Humanoid.WalkSpeed = PrevWalkSpeed;
});

let WillNotMove = false;
janitor.Add(
RunService.Heartbeat.Connect(() => {
Expand Down
3 changes: 2 additions & 1 deletion src/server/components/Essential.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ export abstract class Essential<A extends ToolAttributes, I extends ToolInstance
this.ManageStatusAttribute();

task.defer(() => {
print(this.instance.GetChildren());
const BodyAttach = this.instance.FindFirstChild(this.AttachName);
if (!BodyAttach || !BodyAttach.IsA("BasePart")) {
error(`AttachName is not ${this.AttachName}`);
error(`AttachName is not ${this.AttachName}, got ${BodyAttach}`);
}

this.BodyAttach = BodyAttach;
Expand Down
27 changes: 27 additions & 0 deletions src/server/components/Spear.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Component } from "@flamework/components";
import Config from "shared/Config";
import { CharacterLimb, Directions } from "shared/Types";
import { ToolAttributes, ToolInstance } from "./Tool";
import { Weapon } from "./Weapon";

const anims = Config.Animations.Spear;

@Component({
tag: "Spear",
defaults: {
BUTTON_TOGGLE: "One",
},
})
export class Spear extends Weapon {
AttachName = "SpearAttach";
EnableAnimation = anims.Equip;
DisableAnimation = anims.Holster;
EnabledLimb = "RightHand" as CharacterLimb;
DisabledLimb = "UpperTorso" as CharacterLimb;
AttackAnimations = {
UP: anims.Upper,
DOWN: anims.Lower,
RIGHT: anims.Lower,
LEFT: anims.Lower,
};
}
6 changes: 5 additions & 1 deletion src/server/components/Tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,11 @@ export abstract class Tool<A extends ToolAttributes, I extends ToolInstance>
}

private Input(state: string, input: { Input: string; State: string }) {
this.RequirePlayer();
const [Player, Char] = this.GetCharPlayer();
const Humanoid = Char.FindFirstChildOfClass("Humanoid");
if (!Humanoid || Humanoid.Health <= 0) {
return;
}
const ActionInfo = this.GetActionInfo(state, input);
if (ActionInfo === undefined) {
return;
Expand Down
3 changes: 2 additions & 1 deletion src/server/components/Weapon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export abstract class Weapon extends Essential<ToolAttributes, WeaponInstance> {
this.setState("Drawing");

this.ActiveAnimation = playAnim(this.Player, this.AttackAnimations[this.Direction], { Fade: 0.1 });
this.ActiveAnimation.Priority = Enum.AnimationPriority.Action;

janitor.Add(
this.ActiveAnimation.GetMarkerReachedSignal("DrawEnd").Connect(() => {
Expand Down Expand Up @@ -227,7 +228,7 @@ export abstract class Weapon extends Essential<ToolAttributes, WeaponInstance> {
this.Hitbox.HitStop();
});

task.wait(this.ActiveAnimation.Length - ReleasePosition - 0.1);
task.wait(this.ActiveAnimation.Length - ReleasePosition + 0.1);
if (this.Actions.Release.Status === "ENDED") {
return;
}
Expand Down
5 changes: 5 additions & 0 deletions src/server/modules/IncompatibleTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { CollectionService } from "@rbxts/services";
import { Bow } from "server/components/Bow";
import { Essential } from "server/components/Essential";
import { Shield } from "server/components/Shield";
import { Spear } from "server/components/Spear";
import { Sword } from "server/components/Sword";
import { ToolAttributes, ToolInstance } from "server/components/Tool";
import { playAnim } from "./AnimPlayer";
Expand All @@ -28,6 +29,10 @@ function FixAnims(tag: string, instance: Instance) {
Component = components.getComponent<Bow>(instance);
break;
}
case "Spear": {
Component = components.getComponent<Spear>(instance);
break;
}
default: {
return warn(`implementation needed for new tool ${tag}`);
}
Expand Down
9 changes: 9 additions & 0 deletions src/shared/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ const Config = {
Equip: 7873049583,
},

Spear: {
Upper: 7881904050,
Lower: 7881980633,

Holster: 7881452961,
Equip: 7881948776,
},

Shield: {
Block: 7872966176,
Holster: 7872995363,
Expand Down Expand Up @@ -58,6 +66,7 @@ const Config = {
Sparta: "Shield",
Athens: "Shield",
Bow: "Bow",
Dory: "Spear",
},
};

Expand Down

0 comments on commit e335b97

Please sign in to comment.