diff --git a/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/DefCore.txt b/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/DefCore.txt new file mode 100644 index 000000000..612adac81 --- /dev/null +++ b/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/DefCore.txt @@ -0,0 +1,15 @@ +[DefCore] +id=Sickle +Version=5,2,0,1 +Category=C4D_Object +Width=10 +Height=7 +Offset=-4,-8 +Vertices=2 +VertexX=-3,3 +VertexY=0,0 +VertexFriction=50,50 +Value=10 +Mass=20 +Components=Wood=1;Metal=1; +Rotate=1 \ No newline at end of file diff --git a/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/Graphics.mesh b/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/Graphics.mesh new file mode 100644 index 000000000..65b1a5405 Binary files /dev/null and b/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/Graphics.mesh differ diff --git a/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/Scene.material b/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/Scene.material new file mode 100644 index 000000000..53e1b42cb --- /dev/null +++ b/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/Scene.material @@ -0,0 +1,42 @@ +// sickle genrated by blender2ogre 0.5.8 + +material sickle +{ + receive_shadows on + + technique + { + pass sickle + { + ambient 0.800000011920929 0.800000011920929 0.800000011920929 1.0 + diffuse 0.6400000190734865 0.6400000190734865 0.6400000190734865 1.0 + specular 0.5 0.5 0.5 1.0 12.5 + emissive 0.0 0.0 0.0 1.0 + + alpha_to_coverage off + colour_write on + cull_hardware clockwise + depth_check on + depth_func less_equal + depth_write on + illumination_stage + light_clip_planes off + light_scissor off + lighting on + normalise_normals off + polygon_mode solid + scene_blend one zero + scene_blend_op add + shading gouraud + transparent_sorting on + + texture_unit + { + texture sickle.png + tex_address_mode wrap + scale 1.0 1.0 + colour_op modulate + } + } + } +} diff --git a/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/Script.c b/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/Script.c new file mode 100644 index 000000000..b16bd1f11 --- /dev/null +++ b/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/Script.c @@ -0,0 +1,64 @@ +/** + Sickle + Used for harvesting (wheat, cotton, ...) + + @author Clonkonaut +*/ + +private func Hit() +{ + Sound("WoodHit?"); +} + +public func GetCarryMode() { return CARRY_HandBack; } +public func GetCarryBone() { return "main"; } +public func GetCarryTransform() { return Trans_Rotate(270,0,1,0); } + +public func ControlUseStart(object clonk, int x, int y) +{ + // Can clonk use the sickle? + if (!clonk->IsWalking() && !clonk->IsJumping()) + return true; + + // If the clonk doesn't have an action where he can use it's hands do nothing + if (!clonk->HasHandAction()) + return true; + + var arm = "R"; + var carry_bone = "pos_hand2"; + if(clonk->GetHandPosByItemPos(clonk->GetItemPos(this)) == 1) + { + arm = "L"; + carry_bone = "pos_hand1"; + } + var animation = Format("SwordSlash2.%s", arm); + + // Figure out the kind of animation to use + var length=15; + if(clonk->IsJumping()) + animation = Format("SwordJump2.%s",arm); + + clonk->PlayAnimation(animation, 10, Anim_Linear(0, 0, clonk->GetAnimationLength(animation), length, ANIM_Remove), Anim_Const(1000)); + clonk->UpdateAttach(); + + // Search for harvestable plants + var crop = FindObject(Find_InRect(AbsX(clonk->GetX()-8), AbsY(clonk->GetY()-10), 16,20), Find_Func("IsHarvestable"), Find_Func("SickleHarvesting")); + if (crop) + crop->Harvest(); + + clonk->CancelUse(); + return true; +} + +public func IsTool() { return true; } +public func IsToolProduct() { return true; } + +func Definition(def) { + SetProperty("PictureTransformation", Trans_Mul(Trans_Rotate(15, 0, 1, 0), Trans_Rotate(320, 0,0,1)),def); +} + +local Collectible = 1; +local Name = "$Name$"; +local Description = "$Description$"; +local UsageHelp = "$UsageHelp$"; +local Rebuy = true; \ No newline at end of file diff --git a/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/Sickle.png b/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/Sickle.png new file mode 100644 index 000000000..1b45805be Binary files /dev/null and b/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/Sickle.png differ diff --git a/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/Sickle.skeleton b/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/Sickle.skeleton new file mode 100644 index 000000000..5bedd1bcc Binary files /dev/null and b/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/Sickle.skeleton differ diff --git a/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/StringTblDE.txt b/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/StringTblDE.txt new file mode 100644 index 000000000..631168e9a --- /dev/null +++ b/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/StringTblDE.txt @@ -0,0 +1,3 @@ +Name=Sichel +UsageHelp=Halte [Benutzen] gedrückt, um Pflanzen zu ernten. +Description=Die Sichel wird zum Ernten hartnäckiger Pflanzen (wie Weizen und Baumwolle) benötigt. \ No newline at end of file diff --git a/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/StringTblUS.txt b/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/StringTblUS.txt new file mode 100644 index 000000000..bce14e0f6 --- /dev/null +++ b/planet/Objects.ocd/Items.ocd/Tools.ocd/Sickle.ocd/StringTblUS.txt @@ -0,0 +1,3 @@ +Name=Sickle +UsageHelp=Hold down the [Use] key to harvest plants. +Description=Without a sickle even a clonk can't harvest especially stubborn plants (such as wheat or cotton). \ No newline at end of file diff --git a/planet/Objects.ocd/Libraries.ocd/Plant.ocd/Script.c b/planet/Objects.ocd/Libraries.ocd/Plant.ocd/Script.c index 4a6feb0e1..eeaad12b7 100644 --- a/planet/Objects.ocd/Libraries.ocd/Plant.ocd/Script.c +++ b/planet/Objects.ocd/Libraries.ocd/Plant.ocd/Script.c @@ -250,6 +250,15 @@ private func IsCrop() return false; } +/** Determines whether the plant can only be harvested when using a sickle. + These are very sturdy or economically important plants (like cotton or wheat). + @return \c true if the plant must be harvested with a sickle (default), \c false otherwise. +*/ +private func SickleHarvesting() +{ + return true; +} + /** Determines whether the plant is harvestable right now (i.e. is fully grown). @return \c true if the plant is ready to be harvested. */ @@ -260,7 +269,7 @@ public func IsHarvestable() public func IsInteractable(object clonk) { - return clonk->IsWalking() && IsCrop() && IsHarvestable() || _inherited(clonk); + return clonk->IsWalking() && IsCrop() && !SickleHarvesting() && (IsHarvestable() || _inherited(clonk)); } public func GetInteractionMetaInfo(object clonk) diff --git a/planet/Objects.ocd/Vegetation.ocd/Lichen.ocd/Script.c b/planet/Objects.ocd/Vegetation.ocd/Lichen.ocd/Script.c index fdb0ba309..530db4f0c 100644 --- a/planet/Objects.ocd/Vegetation.ocd/Lichen.ocd/Script.c +++ b/planet/Objects.ocd/Vegetation.ocd/Lichen.ocd/Script.c @@ -7,6 +7,7 @@ local grow_stage; private func SeedChance() { return 1000; } private func IsCrop() { return true; } +private func SickleHarvesting() { return false; } protected func Initialize() { diff --git a/planet/Objects.ocd/Vegetation.ocd/Mushroom.ocd/Script.c b/planet/Objects.ocd/Vegetation.ocd/Mushroom.ocd/Script.c index a2a6bbd05..979fdddb3 100644 --- a/planet/Objects.ocd/Vegetation.ocd/Mushroom.ocd/Script.c +++ b/planet/Objects.ocd/Vegetation.ocd/Mushroom.ocd/Script.c @@ -22,6 +22,7 @@ private func Initialize() /* Harvesting */ private func IsCrop() { return true; } +private func SickleHarvesting() { return false; } public func Harvest(object clonk) {