commit 2027680ce12525e54bf194fd6097b51fe9edf61e Author: Yuzu Date: Mon Jul 18 22:04:22 2022 +0700 First upload diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..88e7f16 --- /dev/null +++ b/.gitignore @@ -0,0 +1,401 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml + +# Build +*.rmod \ No newline at end of file diff --git a/RaftHostUtils.sln b/RaftHostUtils.sln new file mode 100644 index 0000000..1897783 --- /dev/null +++ b/RaftHostUtils.sln @@ -0,0 +1,24 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29411.108 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RaftHostUtils", "RaftHostUtils\RaftHostUtils.csproj", "{41D2BDD7-E52C-4470-AC81-5F4B496CC559}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {41D2BDD7-E52C-4470-AC81-5F4B496CC559}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {41D2BDD7-E52C-4470-AC81-5F4B496CC559}.Debug|Any CPU.Build.0 = Debug|Any CPU + {41D2BDD7-E52C-4470-AC81-5F4B496CC559}.Release|Any CPU.ActiveCfg = Debug|Any CPU + {41D2BDD7-E52C-4470-AC81-5F4B496CC559}.Release|Any CPU.Build.0 = Debug|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1513B1BC-AF36-42E5-94C4-A1575DADF180} + EndGlobalSection +EndGlobal diff --git a/RaftHostUtils/.gitignore b/RaftHostUtils/.gitignore new file mode 100644 index 0000000..a9c98e2 --- /dev/null +++ b/RaftHostUtils/.gitignore @@ -0,0 +1,401 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml + +# Build +*.rmod diff --git a/RaftHostUtils/RaftHostUtils.cs b/RaftHostUtils/RaftHostUtils.cs new file mode 100644 index 0000000..e78c697 --- /dev/null +++ b/RaftHostUtils/RaftHostUtils.cs @@ -0,0 +1,212 @@ +using HarmonyLib; +using System.Collections.Generic; +using System.Reflection; +using UnityEngine; +using UnityEngine.AzureSky; + +public class RaftHostUtils : Mod +{ + Harmony harmonyInstance; + private string harmonyId = "cafe.kirameki.rafthostutils"; + + private bool isEnabled = false; + private Network_Player hostPlayer = null; + private float originalDayLength = 20; // Default value of raft, 20 minutes + + public void Start() + { + harmonyInstance = new Harmony(harmonyId); + harmonyInstance.PatchAll(Assembly.GetExecutingAssembly()); + + setWorldVariables(); + + Debug.Log("Mod RaftHostUtils has been loaded!"); + } + + public void OnModUnload() + { + harmonyInstance.UnpatchAll(harmonyId); + + if (isEnabled) + { + anchorRaft(false); + setDayCycle(originalDayLength); + disablePassiveMobs(); + Debug.Log("Host mode disabled"); + } + + Debug.Log("Mod RaftHostUtils has been unloaded!"); + } + + public override void WorldEvent_WorldLoaded() + { + setWorldVariables(); + } + + public void Update() + { + if (!LoadSceneManager.IsGameSceneLoaded) { + if (isEnabled) + { + isEnabled = false; + originalDayLength = 20; + } + return; + } + + if (hostPlayer) + { + hostPlayer.Stats.stat_thirst.Normal.Value = 100; + hostPlayer.Stats.stat_hunger.Normal.Value = 100; + hostPlayer.Stats.stat_health.Value = 100; + hostPlayer.Stats.stat_oxygen.Value = 100; + } + + int onlinePlayers = getOnlinePlayers(); + if (onlinePlayers == 0) + { + if (isEnabled) return; + + anchorRaft(true); + setDayCycle(0); + enablePassiveMobs(); + isEnabled = true; + Debug.Log("Host mode enabled"); + } + else { + if (!isEnabled) return; + + anchorRaft(false); + setDayCycle(originalDayLength); + disablePassiveMobs(); + isEnabled = false; + Debug.Log("Host mode disabled"); + } + } + + [HarmonyPatch(typeof(AI_State_Attack_Block), "FindBlockToAttack")] + public static class AI_State_Attack_Block_Patch + { + private static void Postfix(ref Block __result) + { + if (getOnlinePlayers() == 0) + __result = null; + } + } + + [HarmonyPatch(typeof(AI_State_Attack_Block_Shark), "FindBlockToAttack")] + public static class AI_State_Attack_Block_Shark_Patch + { + private static void Postfix(ref Block __result) + { + if (getOnlinePlayers() == 0) + __result = null; + } + } + + public void setWorldVariables() { + AzureSkyController skyController = FindObjectOfType(); + if (skyController) + originalDayLength = skyController.timeOfDay.dayCycle; + + Network_Player player = RAPI.GetLocalPlayer(); + if (player) + hostPlayer = player; + } + + public static int getOnlinePlayers() + { + if (RAPI.GetLocalPlayer() == null) + return 0; + + List currentPlayers = new List(); + + var players = FindObjectsOfType(); + var localPlayer = RAPI.GetLocalPlayer(); + foreach (var player in players) + { + if (player != localPlayer) + currentPlayers.Add(player); + } + + return currentPlayers.Count; + } + + public static void anchorRaft(bool status) + { + Raft raft = ComponentManager.Value; + if (!raft) return; + + if (status) + raft.AddAnchor(false, null); + else + raft.RemoveAnchor(10); + } + + public static void setDayCycle(float cycle) + { + AzureSkyController skyController = FindObjectOfType(); + if (skyController) { + skyController.timeOfDay.dayCycle = cycle; + Traverse.Create(skyController).Field("m_timeProgression").Value = skyController.timeOfDay.GetDayLength(); + } + } + + public static void enablePassiveMobs() + { + SO_GameModeValue gameModeValue = GameModeValueManager.GetCurrentGameModeValue(); + if (!gameModeValue) return; + + bool isCreative = GameModeValueManager.GetCurrentGameModeValue().Equals(GameMode.Creative); + if (isCreative) return; + + gameModeValue.sharkVariables.isTame = true; + + gameModeValue.seagullVariables.isTame = true; + gameModeValue.seagullVariables.attacksCrops = false; + gameModeValue.stonebirdVariables.isTame = true; + + gameModeValue.bearVariables.isTame = true; + gameModeValue.boarVariables.isTame = true; + + gameModeValue.pigVariables.isTame = true; + gameModeValue.ratVariables.isTame = true; + gameModeValue.hyenaVariables.isTame = true; + + gameModeValue.pufferfishVariables.isTame = true; + gameModeValue.anglerFishVariables.isTame = true; + + gameModeValue.butlerBotVariables.isTame = true; + + gameModeValue.varunaBossVariables.isTame = true; + gameModeValue.utopiaBossVariables.isTame = true; + } + + public static void disablePassiveMobs() + { + SO_GameModeValue gameModeValue = GameModeValueManager.GetCurrentGameModeValue(); + if (!gameModeValue) return; + + bool isCreative = GameModeValueManager.GetCurrentGameModeValue().Equals(GameMode.Creative); + gameModeValue.sharkVariables.isTame = isCreative; + + gameModeValue.seagullVariables.isTame = isCreative; + gameModeValue.seagullVariables.attacksCrops = isCreative; + gameModeValue.stonebirdVariables.isTame = isCreative; + + gameModeValue.bearVariables.isTame = isCreative; + gameModeValue.boarVariables.isTame = isCreative; + + gameModeValue.pigVariables.isTame = isCreative; + gameModeValue.ratVariables.isTame = isCreative; + gameModeValue.hyenaVariables.isTame = isCreative; + + gameModeValue.pufferfishVariables.isTame = isCreative; + gameModeValue.anglerFishVariables.isTame = isCreative; + + gameModeValue.butlerBotVariables.isTame = isCreative; + + gameModeValue.varunaBossVariables.isTame = isCreative; + gameModeValue.utopiaBossVariables.isTame = isCreative; + } +} \ No newline at end of file diff --git a/RaftHostUtils/RaftHostUtils.csproj b/RaftHostUtils/RaftHostUtils.csproj new file mode 100644 index 0000000..ba20ed1 --- /dev/null +++ b/RaftHostUtils/RaftHostUtils.csproj @@ -0,0 +1,157 @@ + + + + + 7.3 + {41D2BDD7-E52C-4470-AC81-5F4B496CC559} + + + Debug + AnyCPU + {41D2BDD7-E52C-4470-AC81-5F4B496CC559} + Library + Properties + RaftHostUtils + RaftHostUtils + v4.8 + 512 + true + + + true + full + false + bin + DEBUG;TRACE + prompt + 4 + Off + + + pdbonly + true + bin + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + call cd $(SolutionDir) +call build.bat +echo 🔰 =============== 🔰 MOD BUILD SCRIPT 🔰 =============== 🔰 +echo ✔️ Mod successfully built as $(SolutionDir)$(ProjectName).rmod ✔️ +echo =========================================================== + + + \ No newline at end of file diff --git a/RaftHostUtils/banner.jpg b/RaftHostUtils/banner.jpg new file mode 100644 index 0000000..7622f0f Binary files /dev/null and b/RaftHostUtils/banner.jpg differ diff --git a/RaftHostUtils/icon.png b/RaftHostUtils/icon.png new file mode 100644 index 0000000..dc4c18b Binary files /dev/null and b/RaftHostUtils/icon.png differ diff --git a/RaftHostUtils/modinfo.json b/RaftHostUtils/modinfo.json new file mode 100644 index 0000000..94c7a97 --- /dev/null +++ b/RaftHostUtils/modinfo.json @@ -0,0 +1,14 @@ +{ + "name": "RaftHostUtils", + "author": "", + "description": "", + "version": "1.0", + "license": "", + "icon": "icon.png", + "banner": "banner.jpg", + "gameVersion": "1.0", + "requiredByAllPlayers": false, + "updateUrl": "", + "isModPermanent": false, + "excludedFiles": [] +} \ No newline at end of file diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..b7267b7 --- /dev/null +++ b/build.bat @@ -0,0 +1,20 @@ +:: RML Mod Build Script by TeKGameR + +:: Disabling echoing +@echo off +:: Defining the window title +title RML Mod Build Script +:: Retrieving the current folder name +for %%* in (.) do set foldername=%%~n* +:: Creating a folder to contain temporary files for the build +mkdir "build" +:: Copying the solution directory in the "build" folder except ".csproj, .rmod" files and "bin, obj" folders. +robocopy "%foldername%" "build" /E /XF *.csproj *.rmod /XD bin obj +:: Checking if a .rmod with the same name already exists and if it does, delete it. +if exist "%foldername%.rmod" ( del "%foldername%.rmod" ) +:: Zipping the "build" folder. (.rmod are just zipped files) +powershell "[System.Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem');[System.IO.Compression.ZipFile]::CreateFromDirectory(\"build\", \"%foldername%.rmod\", 0, 0)" +:: Deleting the "build" folder +rmdir /s /q "build" +:: Build succeeded! +EXIT \ No newline at end of file