From 5cf6e5d8aea73479de3e4adb48a252103f334394 Mon Sep 17 00:00:00 2001 From: UnknownPerson-cmd Date: Sun, 17 Aug 2025 02:14:41 +0000 Subject: [PATCH] scythe_update --- packages/junon-common/protocol/enum.proto | 1 + .../junon-io/client/assets/images/scythe.png | Bin 0 -> 1987 bytes .../src/entities/equipments/hand/scythe.js | 58 ++++++++++++++++++ .../client/src/entities/equipments/index.js | 1 + packages/junon-io/common/constants.json | 19 ++++++ .../server/entities/equipments/index.js | 1 + .../server/entities/equipments/scythe.js | 58 ++++++++++++++++++ 7 files changed, 138 insertions(+) create mode 100644 packages/junon-io/client/assets/images/scythe.png create mode 100644 packages/junon-io/client/src/entities/equipments/hand/scythe.js create mode 100644 packages/junon-io/server/entities/equipments/scythe.js diff --git a/packages/junon-common/protocol/enum.proto b/packages/junon-common/protocol/enum.proto index e619ca4e..e33c2a8a 100644 --- a/packages/junon-common/protocol/enum.proto +++ b/packages/junon-common/protocol/enum.proto @@ -266,6 +266,7 @@ enum BuildingType { UnbreakableWall = 270; Dynamite = 271; MiasmaGate = 272; + Scythe = 273; } enum TerrainType { diff --git a/packages/junon-io/client/assets/images/scythe.png b/packages/junon-io/client/assets/images/scythe.png new file mode 100644 index 0000000000000000000000000000000000000000..0dd3edac503b4ca9947df60d2b6c548f254bc296 GIT binary patch literal 1987 zcmV;!2R!(RP)pF8FWQhbW?9;ba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ@H12T(~w zK~!jg<(ge=TW1-^e~*u2$Bt{qX-L|p7lgvJnCrA`QqA-JGI zAR!?E69{p^1rnNugb+8}Fg89UuFxt5TEr?r%hpv@Q?=dFWcAWCwc|Mci0$+7aB)6* zk~(R&c3n>ROO_rz$It8Y^ZWU{?<=axdXb3q06zmJfj_9~>>Vq6J%Iv<$Y$UbU^nnG z@I3IMs+zY|u&S=R53mKe2&nhD1Uw1E-gB8BG}J1v9|opFunN2ed~!p9da$EFdl_sS z_@+Yq20>~{f8Boex3&z>;wpMajVmJ_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Rg2sWL05#l|R&|;E58zYr zcpS^J!f}hhUx1GQn}Bbq>ZuR%MwsC4yB-3*3j6~1HfITUZvW;gv7ZApmG04}p8mGx za=rd-vWvidk+~v=d*N}@D$mCN-L?BZ{piPbh9OtHGPmyT>)uKtav1p6GPeaBR@MKk z6c?p*%-0V?b`AGF!@a9P!aBTxy_!Vie%xeW8W-?4YfTEG2Ko%{O6~ { + if (!tile) return + + const crop = tile.getBuilding && tile.getBuilding() + + if (crop && crop.isCrop && crop.isCrop() && crop.isFullyGrown && crop.isFullyGrown()) { + if (crop.interact) { + crop.interact(player) + } else if (crop.breakBuilding) { + crop.breakBuilding(player) + } + } + }) + } +} + +module.exports = Pitchfork \ No newline at end of file diff --git a/packages/junon-io/client/src/entities/equipments/index.js b/packages/junon-io/client/src/entities/equipments/index.js index 7eceb89a..38530352 100644 --- a/packages/junon-io/client/src/entities/equipments/index.js +++ b/packages/junon-io/client/src/entities/equipments/index.js @@ -22,6 +22,7 @@ Equipments.BloodBottle = require("./hand/blood_bottle") Equipments.WaterBottle = require("./hand/water_bottle") Equipments.Disinfectant = require("./hand/disinfectant") Equipments.Lighter = require("./hand/lighter") +Equipments.Scythe = require("./hand/scythe") Equipments.Wrench = require("./hand/wrench") Equipments.SurvivalTool = require("./hand/survival_tool") Equipments.Drill = require("./hand/drill") diff --git a/packages/junon-io/common/constants.json b/packages/junon-io/common/constants.json index 9cc3fd55..3078db74 100644 --- a/packages/junon-io/common/constants.json +++ b/packages/junon-io/common/constants.json @@ -3912,6 +3912,25 @@ "cost": { "gold": 1000 }, + "Scythe": { + "parent": "Equipments.MeleeEquipment", + "isWeapon": true, + "cost": { + "gold": 350 + }, + "categories": {"melee_damage": true}, + "isAnimatable": true, + "stats": { + "damage": 12, + "range": 55, + "meleeRange": 55 + }, + "requirements": { + "IronBar": 30, + "Wood":10 + }, + "description": "Farms crops to left and right. Can be seconded as a weapon" + }, "categories": {"melee_damage": true}, "isAnimatable": true, "stats": { diff --git a/packages/junon-io/server/entities/equipments/index.js b/packages/junon-io/server/entities/equipments/index.js index 1e4c55f6..6f5cf799 100644 --- a/packages/junon-io/server/entities/equipments/index.js +++ b/packages/junon-io/server/entities/equipments/index.js @@ -13,6 +13,7 @@ Equipments.FireExtinguisher = require("./hand/fire_extinguisher") Equipments.Syringe = require("./hand/syringe") Equipments.FlameThrower = require("./hand/flame_thrower") Equipments.Mop = require("./hand/mop") +Equipments.Scythe = require("./hand/scythe") Equipments.Bottle = require("./hand/bottle") Equipments.BloodBottle = require("./hand/blood_bottle") Equipments.WaterBottle = require("./hand/water_bottle") diff --git a/packages/junon-io/server/entities/equipments/scythe.js b/packages/junon-io/server/entities/equipments/scythe.js new file mode 100644 index 00000000..a62ea31e --- /dev/null +++ b/packages/junon-io/server/entities/equipments/scythe.js @@ -0,0 +1,58 @@ +const MeleeEquipment = require("./melee_equipment") +const Protocol = require('../../../../common/util/protocol') +const Constants = require("../../../../common/constants.json") + +class Scythe extends MeleeEquipment { + + getType() { + return Protocol.definition().BuildingType.Scythe + } + + getConstantsTable() { + return "Equipments.Scythe" + } + + use(player, targetEntity) { + if (targetEntity && targetEntity.isCrop && targetEntity.isCrop()) { + // interact with the crop (harvest/destroy fully grown) + if (targetEntity.isFullyGrown && targetEntity.isFullyGrown()) { + targetEntity.interact(player) + + // destroy left and right fully grown crops + this._destroyNeighbors(player, targetEntity) + } + } else { + // fallback to normal melee use + super.use(player, targetEntity) + } + } + + _destroyNeighbors(player, target) { + const x = target.getX() + const y = target.getY() + const room = target.room + + if (!room) return + + const neighbors = [ + room.getTile(x - 1, y), + room.getTile(x + 1, y) + ] + + neighbors.forEach(tile => { + if (!tile) return + + const crop = tile.getBuilding && tile.getBuilding() + + if (crop && crop.isCrop && crop.isCrop() && crop.isFullyGrown && crop.isFullyGrown()) { + if (crop.interact) { + crop.interact(player) + } else if (crop.breakBuilding) { + crop.breakBuilding(player) + } + } + }) + } +} + +module.exports = Scythe \ No newline at end of file