logic error in code for fertile soil

Various development-related discussions
Post Reply
User avatar
bushtail
Tech Support
Posts: 40
Joined: Thu Aug 11, 2022 11:43 pm
Location: Snow Mexico
Been thanked: 4 times
Contact:

logic error in code for fertile soil

Post by bushtail »

So it's allowing me to fertilize the soil despite the patch being weedy. for some reason, the return does not actually return. Anyone spot anything?

Code: Select all

    private fun fertileSoil(player: Player, target: Scenery) {
        if (target.id == 7808) {
            sendMessage(player, "No, that would be silly.")
            return
        } else {
            val fPatch = FarmingPatch.forObject(target)
            if(fPatch == null) {
                sendMessage(player, "Um... I don't want to fertilize that! peepee poopoo")
                return
            } else {
                val patch = fPatch.getPatchFor(player)
                if(patch.isWeedy()) {
                    return
                } else if(patch.isFertilized()) {
                    sendMessage(player, "This patch has already been composted.")
                    return
                } else if(patch.isGrown()) {
                    sendMessage(player, "Composting isn't going to make it get any bigger.")
                    return
                } else {
                    visualizeSpell(player, FERTILE_SOIL_ANIM, FERTILE_SOIL_GFX, 2891)
                    patch.compost = CompostType.SUPER
                    sendMessage(player, "You fertilize the soil.")
                    addXP(player, 87.0)
                }
            }
        }
    }
Image
Resident chad Winblows user
User avatar
Ceikry
Site Admin
Posts: 577
Joined: Wed Aug 10, 2022 11:48 pm
Location: Draynor Village
Has thanked: 81 times
Been thanked: 93 times

Re: logic error in code for fertile soil

Post by Ceikry »

You can fertilize a weedy patch anyways. I was just being sarcastic on discord.
Nerds
User avatar
bushtail
Tech Support
Posts: 40
Joined: Thu Aug 11, 2022 11:43 pm
Location: Snow Mexico
Been thanked: 4 times
Contact:

Re: logic error in code for fertile soil

Post by bushtail »

my knowledge of rs is extremely limited no booli
Image
Resident chad Winblows user
Post Reply