robotex140 / Hydrocraft

25 stars 38 forks source link

recipe Discard Broken Weapon #77

Open HugoQwerty opened 1 year ago

HugoQwerty commented 1 year ago

Wrote this for myself, feel free to add to HC.

Lets you discard broken weapons, good for spears / stone axes etc - saves you having to look for a body to put them on.

recipe Discard Broken Weapon
{
    [Recipe.GetItemTypes.Weapon],
    Result:Twigs,
    RemoveResultItem: true,
    Time:1,
    OnTest: OnTest.WeaponIsBroken,
    Category:Survivalist,
    AllowDestroyedItem: true,
    IsHidden: true,
    CanBeDoneFromFloor: true,
    StopOnWalk: false,
    StopOnRun: false,
}

function Recipe.GetItemTypes.Weapon(scriptItems) local all = getScriptManager():getAllItems() for i=0, all:size()-1 do local item = all:get(i) local typeString = item:getTypeString() if typeString == "Weapon" and item:getConditionMax() > 0 then scriptItems:add( item ) end end end

function OnTest.WeaponIsBroken(item) if item:IsWeapon() and item:getCondition() == 0 then return true end return false end

ttr commented 1 year ago

also you can use: Vanilla - put item into trashcan (that You can move so have one in your base) and 'delete all' HC - "bury trash" recipe.

I'll say adding on this is to add to HC ability to build trash can (small wooden box, like scale-down composer)