Alangara_PRC8/_module/nss/farm_mod_load.nss
Jaysyn904 86feb9ca6f Initial commit
Initial commit.
2024-06-05 21:21:06 -04:00

53 lines
1.5 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Name: farm_mod_load
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
OnModuleLoad script.
This script will loop through each farm,
creating all the crops that have been
planted over time (persistency).
*/
//:://////////////////////////////////////////////
//:: Created By: Adam Walenga
//:: Created On: September 4th, 2004
//:://////////////////////////////////////////////
#include "farm_include"
#include "eds_include"
#include "mn_i_calendar"
void Farm_BuildCrops (int iFarmNumber)
{
int iCount = 1;
int iMaxPlant = Farm_GetMaxPlantNumber (iFarmNumber);
object oPlant;
for (; iCount <= iMaxPlant; iCount++)
{
oPlant = CreateObject (OBJECT_TYPE_PLACEABLE, Farm_GetPlantResRef
(iFarmNumber, iCount), Farm_GetPlantLocation (iFarmNumber, iCount),
FALSE, IntToString (iFarmNumber) + "_" + IntToString (iCount));
//Allow plant to be looted.
EDS_SetDelay (oPlant, "Is_Lootable", IntToFloat (GetMaxHitPoints
(oPlant) * 60));
}
}
void main()
{
// Restore stored time
LoadCalendar();
int iFarm = 1;
int iMaxFarm = Farm_GetMaxFarm();
object oModule = GetModule();
//Loop through each farm and build all the crops.
// Note: We use AssignCommand on the module to prevent TMI errors.
for (; iFarm <= iMaxFarm; iFarm++)
AssignCommand (oModule, Farm_BuildCrops (iFarm));
}