Skip to content

Locutus1119/open-source-plantcontroller

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 

Repository files navigation

Athena Framework - PlantController

Fichier 29mdpi Fichier 30mdpi

Have you always wanted to be a weed gardener? This is your chance!

This plugin for the Athena Framework allows you to grow different strains with different times! The harvest of your plant is freely determinable, depending on how long your plant needs to grow.

Features

  • Different varieties with different adjustable yields!
  • Sow, fertilize, water and harvest your plants!
  • Adjustable according to your wishes!
  • Create as many plant spots as you like!
  • Custom animations for sowing, fertilizing, watering and harvesting!

Setup & Imports

  • Create a new folder called "AthenaPlantController" and drop stuff from this branch there.
  • Since this is an serverside plugin we just need to import the index.ts file.
  • Database and default items will be created on the first bootup of the Athena Framework.
// src/core/plugins/import.ts ->
import './AthenaPlantController/index';

Setup Items

  • Be careful that you'll need same type & variety!
  • Seeds need to be in Toolbar
export const seeds: Array<Item> = [
    {
        name: 'Lemon Haze Seeds',
        description: `PlantController - Some Description to show for debugging purposes.`,
        icon: 'crate',
        quantity: 1,
        behavior:
            ITEM_TYPE.CAN_DROP | ITEM_TYPE.CAN_TRADE | ITEM_TYPE.CAN_STACK | ITEM_TYPE.IS_TOOLBAR,
        data: {
            type: 'Sativa',
            variety: 'Lemon Haze'
        },
        rarity: 0,
        dbName: `PlantController-Lemon-Haze-Seeds`,
        version: 1,
    }
]

export const buds: Array<Item> = [
    {
        name: 'Lemon Haze Buds',
        description: `PlantController - Some Description to show for debugging purposes.`,
        icon: 'crate',
        quantity: 1,
        behavior:
            ITEM_TYPE.CAN_DROP | ITEM_TYPE.CAN_TRADE | ITEM_TYPE.CAN_STACK,
        data: {
            type: 'Sativa',
            variety: 'Lemon Haze',
        },
        rarity: 0,
        dbName: `PlantController-Lemon-Haze-Buds`,
        version: 1,
    }
]

Default Settings

export const ATHENA_PLANTCONTROLLER = {
    name: 'PlantController',
    version: 'v1.0',
    useDiscordLogs: false,
    discordChannel: 'someChannelId',
};

export const PLANTCONTROLLER_DATABASE = {
    collectionName: 'plants', // Change me before booting if you need to.
};

export const PLANTCONTROLLER_SETTINGS = {
    smallPot: 'bkr_prop_weed_01_small_01a', // LEAVE ME ALONE
    mediumPot: 'bkr_prop_weed_med_01a', // LEAVE ME ALONE
    largePot: 'bkr_prop_weed_lrg_01a', // LEAVE ME ALONE
    updateInterval: 3000, // Used to set the timer's update Interval.
    distanceToSpot: 10,
    interactionRange: 1,
    textLabelDistance: 3,
};

// use 'default' to skip animations.
// Example ->
// seedingAnimName: 'default',
// seedingAnimDict: 'default',
export const PLANTCONTROLLER_ANIMATIONS = {
    seedingAnimName: 'base',
    seedingAnimDict: 'amb@world_human_gardener_plant@male@base',
    seedingAnimDuration: 3000,

    fertilizingAnimName: 'base',
    fertilizingAnimDict: 'amb@world_human_gardener_plant@male@base',
    fertilizingAnimDuration: 3000,

    waterAnimName: 'base',
    waterAnimDict: 'amb@world_human_gardener_plant@male@base',
    waterAnimDuration: 3000,

    harvestAnimName: 'base',
    harvestAnimDict: 'amb@world_human_gardener_plant@male@base',
    harvestAnimDuration: 3000,
};

/**
* The `PLANTCONTROLLER_SPOTS` array contains the locations of the spots where the plants
can be placed.
*/
export const PLANTCONTROLLER_SPOTS: alt.Vector3[] = [
    { x: -1625.6290283203125, y: 3165.891357421875, z: 29.933713912963867 } as alt.Vector3,
    { x: 3705.656982421875, y: 3079.053955078125, z: 13.06076717376709 } as alt.Vector3,
    { x: 3693.6142578125, y: 4932.6845703125, z: 18.710264205932617 } as alt.Vector3,
    { x: 2505.236328125, y: -2110.73095703125, z: 30.00033950805664 } as alt.Vector3,
];

/**
 * The `PLANTCONTROLLER_TRANSLATIONS` enum is used to store the text that will be displayed in the
 * UI when the player interacts with a plant.
 */
export enum PLANTCONTROLLER_TRANSLATIONS {
    // Related to general
    notInRange = 'Not in range of a valid plant spot!',
    // Related to Interaction Controllers.
    seedsRequired = 'Requires Seeds.',
    fertilizerRequired = 'Requires Fertilizer.',
    waterRequired = `Requires Water.`,
    seedingInteraction = 'Plant Seeds',
    fertilizingInteraction = 'Fertilize',
    waterInteraction = 'Water Plant',
    harvestable = 'Harvestable',
}

Scripting Example

alt.on('PlantController:Server:CreatePot', (player: alt.Player, data: Item) => {
    PlantController.addPlant(player, {
        model: PLANTCONTROLLER_SETTINGS.smallPot,
        shaIdentifier: PlantController.generateShaId(player),
        data: {
            owner: player.data.name,
            variety: '',
            type: '',
            seeds: false,
            fertilized: false,
            state: PLANTCONTROLLER_TRANSLATIONS.seedsRequired,
            remaining: 1337, // Don't touch. Different Times for Different Seeds? ;)
            startTime: 1337, // Don't touch.
            water: 0,
            harvestable: false,
        },
        position: { x: player.pos.x + 1, y: player.pos.y, z: player.pos.z - 1 } as alt.Vector3,
    });
});

Issues

  • A few left i guess ;)

Images

image

image

image

image

Join the plugin Discord -> https://discord.gg/swBPcKdzzy

About

The most configurable Open Source PlantController for the Athena Framework by Stuyk.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%