diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md deleted file mode 100644 index c203cef..0000000 --- a/.github/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,74 +0,0 @@ -# Contributor Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of experience, -education, socio-economic status, nationality, personal appearance, race, -religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or - advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team in the discord at https://discord.gg/Z6Whda5hHA. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html - -[homepage]: https://www.contributor-covenant.org - diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml deleted file mode 100644 index 8c98487..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Bug report -description: Create a report to help us improve or fix something -labels: ['bug', 'need repro'] -body: - - type: markdown - attributes: - value: | - Thank you for taking the time to fill out a bug report! - Please use our Discord Server to ask questions and receive support: https://discord.gg/PtA9rvvR7T - - type: input - id: summary - attributes: - label: Summary - description: Write a short and concise description of your bug. - validations: - required: true - - type: textarea - id: repro - attributes: - label: Reproduction - description: What did you do to make this happen? - placeholder: | - 1. Using ... - 2. Do ... - 3. Then use ... - 4. See error - validations: - required: true - - type: textarea - id: expected - attributes: - label: Expected behavior - description: What did you expect to happen? - validations: - required: true - - type: textarea - id: actual - attributes: - label: Actual behavior - description: What actually happened? - validations: - required: true - - type: textarea - id: additional - attributes: - label: Additional context - description: If you have any other context about the problem such as screenshots or videos, add them here. - - type: input - id: updated - attributes: - label: Last Updated - description: When have you last updated? - placeholder: e.g. last week, today - validations: - required: true - - type: input - id: renamed - attributes: - label: Resource Rename - description: Have you renamed this resource from `Renewed-` to something custom? - validations: - required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 2af68fe..0000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,5 +0,0 @@ -blank_issues_enabled: false -contact_links: - - name: Renewed Scripts - url: https://discord.gg/PtA9rvvR7T - about: Ask questions, receive support, and discuss with the community in our Discord server. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml deleted file mode 100644 index a93fac5..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Feature request -description: Suggest an idea for Renewed Weathersync -labels: enhancement -body: - - type: markdown - attributes: - value: | - Please use our Discord Server to ask questions and receive support: https://discord.gg/PtA9rvvR7T - - type: textarea - id: problem - attributes: - label: The problem - description: A clear and concise description of what the problem is, or what feature you want to be implemented. - placeholder: | - Some examples: - I'm frustrated that ... - It would be nice if ... - validations: - required: true - - type: textarea - id: solution - attributes: - label: Ideal solution - description: A clear and concise description of what you want to happen, with as much detail as possible. - validations: - required: true - - type: textarea - id: alternatives - attributes: - label: Alternative solutions - description: A clear and concise description of any alternative solutions or features you've considered. - - type: textarea - id: additional - attributes: - label: Additional context - description: If you have any other context about the problem such as screenshots or videos, add them here. diff --git a/.github/actions/bump-manifest-version.js b/.github/actions/bump-manifest-version.js deleted file mode 100644 index 1082831..0000000 --- a/.github/actions/bump-manifest-version.js +++ /dev/null @@ -1,11 +0,0 @@ -// Based off of https://github.com/overextended/ox_lib/blob/master/.github/actions/bump-manifest-version.js -const fs = require('fs') - -const version = process.env.TGT_RELEASE_VERSION -const newVersion = version.replace('v', '') - -const manifestFile = fs.readFileSync('fxmanifest.lua', {encoding: 'utf8'}) - -const newFileContent = manifestFile.replace(/\bversion\s+(.*)$/gm, `version '${newVersion}'`) - -fs.writeFileSync('fxmanifest.lua', newFileContent) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index ea17d2e..0000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,9 +0,0 @@ -## Description - - - -## Checklist - - - -- [ ] I have personally checked if the code does not break anything in the resource. diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 21c3969..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Lint -on: [push, pull_request_target] -jobs: - lint: - name: Lint Resource - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - ref: ${{ github.event.pull_request.head.sha }} - - name: Lint - uses: iLLeniumStudios/fivem-lua-lint-action@v2 - with: - capture: "junit.xml" - args: "-t --formatter JUnit" - extra_libs: ox_lib - - name: Generate Lint Report - if: always() - uses: mikepenz/action-junit-report@v3 - with: - report_paths: "**/junit.xml" - check_name: Linting Report - fail_on_failure: false diff --git a/.github/workflows/release-action.yml b/.github/workflows/release-action.yml deleted file mode 100644 index 9ded315..0000000 --- a/.github/workflows/release-action.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: "Release Action" - -on: - workflow_run: - workflows: [Create New Release] - types: - - completed - -jobs: - release-action: - name: "Create Release" - runs-on: "ubuntu-latest" - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: ${{ github.event.repository.default_branch }} - - - name: Get the latest tag - id: get_tag - run: | - echo "LATEST_TAG=$(git tag --sort=-creatordate | head -n 1)" >> $GITHUB_ENV - - - name: Install ZIP - run: sudo apt install zip - - - name: Bundle files - run: | - shopt -s extglob - mkdir -p ./temp/${{ github.event.repository.name }} - cp ./{README.md,LICENSE,fxmanifest.lua} ./temp/${{ github.event.repository.name }} - cp -r ./{client,compatability,config,server} ./temp/${{ github.event.repository.name }} - cd ./temp && zip -r ../${{ github.event.repository.name }}.zip ./${{ github.event.repository.name }} - - - name: Update CHANGELOG - id: changelog - uses: requarks/changelog-action@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ env.LATEST_TAG }} - writeToFile: false - - - name: Create Release - uses: ncipollo/release-action@v1.14.0 - with: - allowUpdates: true - draft: false - makeLatest: true - name: ${{ env.LATEST_TAG }} - tag: ${{ env.LATEST_TAG }} - body: ${{ steps.changelog.outputs.changes }} - artifacts: ${{ github.event.repository.name }}.zip - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index f1c8a21..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Create New Release - -on: - workflow_dispatch: - inputs: - version: - required: true - -jobs: - create-release: - name: Create New Release - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Setup node - uses: actions/setup-node@v4 - with: - node-version: 20.x - - - name: Bump manifest version - run: node .github/actions/bump-manifest-version.js - env: - TGT_RELEASE_VERSION: ${{ inputs.version }} - - - name: Push manifest change - uses: EndBug/add-and-commit@v9 - with: - add: fxmanifest.lua - push: true - message: 'chore: bump manifest version to ${{ inputs.version }}' - tag: ${{ inputs.version }} diff --git a/classes/weather.lua b/classes/weather.lua deleted file mode 100644 index 6165d1e..0000000 --- a/classes/weather.lua +++ /dev/null @@ -1,58 +0,0 @@ - ----@class renewed_weather : OxClass ----@field weather string ----@field time number ----@field windSpeed? number ----@field windDirection? number ----@field isRain boolean -local weather_class = lib.class('renewed_weather') - ----@class renewed_weather_payload ----@field weather string ----@field time number ----@field isRain boolean ----@field windSpeed? number ----@field windDirection? number - ----@param payload {weather: string, time: number, windSpeed?: number, windDirection?: number} -function weather_class:constructor(payload) - self.weather = payload.weather - self.time = payload.time - self.windSpeed = payload.windSpeed or 0.0 - self.windDirection = payload.windDirection or 0.0 - - self.isRain = self:IsRain() -end - ----Checks weather or not the current weather contains rain ----@return boolean -function weather_class:IsRain() - return self.weather == 'RAIN' or self.weather == 'THUNDER' -end - ----Sets the weather time to the given value. ----@param time number -function weather_class:SetEventTime(time) - self.time = time -end - ----Sets the weather to the given value. ----@param weather string -function weather_class:SetWeather(weather) - self.weather = weather - self.isRain = self:IsRain() -end - ----Gets the weather data of the current weather event for the GlobalState ----@return renewed_weather_payload -function weather_class:GetWeatherData() - return { - weather = self.weather, - time = self.time, - windSpeed = self.windSpeed, - windDirection = self.windDirection, - isRain = self.isRain - } -end - -return weather_class \ No newline at end of file diff --git a/client/admin.lua b/client/admin.lua index 7536390..6edd0a7 100644 --- a/client/admin.lua +++ b/client/admin.lua @@ -56,6 +56,10 @@ local weatherTypes = { label = 'Xmas', value = 'XMAS' }, + { + label = 'Halloween', + value = 'HALLOWEEN' + }, } local function viewWeatherEvent(index, weatherEvent, isQueued) diff --git a/config/time.lua b/config/time.lua index 55b5134..1c548fd 100644 --- a/config/time.lua +++ b/config/time.lua @@ -1,5 +1,5 @@ return { - timeScale = 4000, -- How many milliseconds per minute in GTA time (2000ms is normal for a 48 minute day) + timeScale = 2000, -- How many milliseconds per minute in GTA time (2000ms is normal for a 48 minute day) useNightScale = false, -- If true, the server will use timeScaleNight to alter the time during night timeScaleNight = 8000, -- How many milliseconds per minute in GTA time DURING NIGHT diff --git a/config/weather.lua b/config/weather.lua index 40219e0..dd9593a 100644 --- a/config/weather.lua +++ b/config/weather.lua @@ -1,8 +1,8 @@ return { - useScheduledWeather = true, -- Do you want txAdmin to schedule custom rain and thunder near restart? + useScheduledWeather = false, -- Do you want txAdmin to schedule custom rain and thunder near restart? serverDuration = 14, -- How many hours will the server run before restarting?, if a server restarts every 8 hours put this to 9 etc. - weatherCycletimer = 30, -- How many minutes between weather changes + weatherCycletimer = 10, -- How many minutes between weather changes timeBetweenRain = 180, -- How many minutes between rain events rainAfterRestart = 60, -- How many minutes AFTER a server restart before rain will start to show? @@ -24,7 +24,8 @@ return { ['SNOW'] = 0.0, ['SNOWLIGHT'] = 0.0, ['THUNDER'] = 0.1, - ['XMAS'] = 0.0 + ['XMAS'] = 0.0 , + ['HALLOWEEN'] = 0.0 }, useWeatherSequences = true, diff --git a/server/weather.lua b/server/weather.lua index 97994ec..8d5f1e7 100644 --- a/server/weather.lua +++ b/server/weather.lua @@ -1,9 +1,6 @@ local buildWeatherList = require 'server.weatherbuilder' local useScheduledWeather = lib.load('config.weather').useScheduledWeather - - ----@type renewed_weather[] local weatherList = buildWeatherList() local overrideWeather = false @@ -13,7 +10,7 @@ local function executeCurrentWeather() local weather = weatherList[1] if weather then - GlobalState.weather = weather:GetWeatherData() + GlobalState.weather = weather end return weather @@ -49,13 +46,13 @@ end) lib.callback.register('Renewed-Weathersync:server:setWeatherType', function(source, index, weatherType) if IsPlayerAceAllowed(source, 'command.weather') and weatherList[index] then - local weatherEvent = weatherList[index] - - weatherEvent:SetWeather(weatherType) - + weatherList[index].weather = weatherType if index == 1 then - GlobalState.weather = weatherEvent:GetWeatherData() + local currentWeather = weatherList[1] + currentWeather.weather = weatherType + + GlobalState.weather = currentWeather end return weatherType @@ -68,7 +65,7 @@ lib.callback.register('Renewed-Weathersync:server:setEventTime', function(source local weatherEvent = weatherList[index] if IsPlayerAceAllowed(source, 'command.weather') and weatherEvent then - weatherEvent:SetEventTime(eventTime) + weatherEvent.time = eventTime return eventTime end @@ -83,13 +80,6 @@ lib.addCommand('weather', { TriggerClientEvent('Renewed-Weather:client:viewWeatherInfo', source, weatherList) end) -lib.addCommand('blackout', { - help = 'Enable or disable the power blackout', - restricted = 'group.admin', -}, function() - GlobalState.blackOut = not GlobalState.blackOut -end) - -- Scheduled restart -- if useScheduledWeather then AddEventHandler('txAdmin:events:scheduledRestart', function(eventData) diff --git a/server/weatherbuilder.lua b/server/weatherbuilder.lua index f0a2479..90e7f93 100644 --- a/server/weatherbuilder.lua +++ b/server/weatherbuilder.lua @@ -1,9 +1,5 @@ local Config = lib.load('config.weather') --- Holy shit I had cancer when I wrote this dogshit not even gonna try and save this spaghetti mess rn - -local weather_class = require 'classes.weather' - local currentMonth = tonumber(os.date('%m')) local cycleTimer = Config.weatherCycletimer @@ -33,8 +29,7 @@ end local function insertEvents(events, weatherList) local timeUsed = 0 for j = 1, #events do - ---@diagnostic disable-next-line: invisible - local weather = weather_class:new(events[j]) + local weather = events[j] weatherList[#weatherList+1] = weather timeUsed += weather.time @@ -139,8 +134,7 @@ return function() local hasRain = rainFilter[weather] if isWeatherEventAllowed(chance, hasRain, minutesSinceRain, timeBeforeRain, weather, weatherList, weatherCount) then weatherCount += 1 - ---@diagnostic disable-next-line: invisible - weatherList[weatherCount] = weather_class:new(getWeatherEvent(weather)) + weatherList[weatherCount] = getWeatherEvent(weather) minutesSinceRain = hasRain and 0 or minutesSinceRain + cycleTimer timeBeforeRain = not hasRain and timeBeforeRain - cycleTimer or timeBeforeRain minutesLeft -= cycleTimer