Skip to content

Commit

Permalink
Merge branch 'sm-0.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
TechnologicNick committed Jun 4, 2022
2 parents ec869b9 + d1c0e2f commit 4c83dc6
Show file tree
Hide file tree
Showing 17 changed files with 204 additions and 166 deletions.
7 changes: 5 additions & 2 deletions .build/buildexclude
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
.git
Gamefilemod_src
.github
Cache
GamefileMod_src
.gitattributes
.gitignore
.build
dist
Build.bat
Workshop description.bb
description_build.json
description.json
preview source.xcf
install.log
2 changes: 1 addition & 1 deletion .build/merge_tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
$addObject = json_decode(file_get_contents($addJson), true);
$newObject = array_merge_recursive($oldObject, $addObject);

$newJson = json_encode($newObject, JSON_PRETTY_PRINT);
$newJson = json_encode($newObject, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);

file_put_contents(__DIR__.'/../Gamefilemod/Data/Tools/ToolSets/core.json', $newJson);

Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Publish

on:
release:
types: [published]

jobs:
build:
name: Push to Steam Workshop
runs-on: ubuntu-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Copy to /dist
run: rsync -av --exclude-from="./.build/buildexclude" . ./dist

- name: Add files to Github release
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: |
echo '{"version": "${{ github.event.release.tag_name }}"}' > ./dist/version.json
(cd ./dist && zip -r ../release.zip .)
echo "$GITHUB_CONTEXT"
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./release.zip
asset_name: ${{ github.event.repository.name }}-release.zip
asset_content_type: application/zip

# Upload to Steam Workshop
- name: Upload to Steam Workshop
uses: arma-actions/workshop-upload@v1
with:
appId: '387990'
itemId: '2143988698' # Id of item to update
contentPath: 'dist'
changelog: "[b]${{ github.event.release.name }}[/b] (${{ github.event.release.tag_name }})\n\n${{ github.event.release.body }}\n\n${{ github.event.release.html_url }}"
env:
STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }}
STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@

Cache/
install.log
dist/
Binary file modified GamefileMod/Data/Gui/IconMap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions GamefileMod/Data/Gui/IconMap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -530,25 +530,25 @@
<Index name="bb443a05-b5b9-4fad-90fc-5e04aa90fd8f">
<Frame point="576 768"/>
</Index>
<Index name="5cc12f03-275e-4c8e-b013-79fc0f913e1b">
<Index name="448f7c93-699d-47b4-8e3e-296971067ef4">
<Frame point="672 768"/>
</Index>
<Index name="ed185725-ea12-43fc-9cd7-4295d0dbf88b">
<Index name="3384010e-bc1c-42bb-83ef-dbc78a1f9636">
<Frame point="768 768"/>
</Index>
<Index name="8c7efc37-cd7c-4262-976e-39585f8527bf">
<Index name="c60b9627-fc2b-4319-97c5-05921cb976c6">
<Frame point="864 768"/>
</Index>
<Index name="c60b9627-fc2b-4319-97c5-05921cb976c6">
<Index name="8c7efc37-cd7c-4262-976e-39585f8527bf">
<Frame point="960 768"/>
</Index>
<Index name="fdb8b8be-96e7-4de0-85c7-d2f42e4f33ce">
<Index name="5cc12f03-275e-4c8e-b013-79fc0f913e1b">
<Frame point="1056 768"/>
</Index>
<Index name="3384010e-bc1c-42bb-83ef-dbc78a1f9636">
<Index name="ed185725-ea12-43fc-9cd7-4295d0dbf88b">
<Frame point="1152 768"/>
</Index>
<Index name="448f7c93-699d-47b4-8e3e-296971067ef4">
<Index name="fdb8b8be-96e7-4de0-85c7-d2f42e4f33ce">
<Frame point="1248 768"/>
</Index>
<Index name="e74ff990-adac-434f-9967-bf9833d0bd69"><Frame point="1344 768"/></Index></Group>
Expand Down
67 changes: 61 additions & 6 deletions GamefileMod/Data/Scripts/game/CreativeGame.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,43 @@
dofile( "$SURVIVAL_DATA/Scripts/game/managers/EffectManager.lua" )
dofile( "$SURVIVAL_DATA/Scripts/game/managers/UnitManager.lua" )
dofile( "$SURVIVAL_DATA/Scripts/game/util/recipes.lua" )
dofile( "$SURVIVAL_DATA/Scripts/game/survival_projectiles.lua" )
dofile( "$SURVIVAL_DATA/Scripts/game/survival_meleeattacks.lua" )

CreativeGame = class( nil )
CreativeGame.enableLimitedInventory = false
CreativeGame.enableRestrictions = true
CreativeGame.enableFuelConsumption = false
CreativeGame.enableAmmoConsumption = false
CreativeGame.enableUpgradeCost = true

g_godMode = true
g_disableScrapHarvest = true
CreativeGame.enableUpgrade = true

function CreativeGame.server_onCreate( self )
g_unitManager = UnitManager()
g_unitManager:sv_onCreate( nil, { aggroCreations = true } )

self.sv = {}
self.sv.saved = self.storage:load()


if self.sv.saved == nil then
local legacyCreativeWorld = sm.world.getLegacyCreativeWorld()
if legacyCreativeWorld then
self.sv.saved = {}
self.sv.saved.data = self.data
self.sv.saved.world = legacyCreativeWorld
self.storage:save( self.sv.saved )
else
self.sv.saved = {}
self.sv.saved.data = self.data
self.sv.saved.world = sm.world.createWorld( self.worldScriptFilename, self.worldScriptClass, { worldFile = self.data.worldFile }, self.data.seed )
self.storage:save( self.sv.saved )
end
end

if not sm.exists( self.sv.saved.world ) then
sm.world.loadWorld( self.sv.saved.world )
end

local time = sm.storage.load( STORAGE_CHANNEL_TIME )
if time then
print( "Loaded timeData:" )
Expand All @@ -28,6 +51,9 @@ function CreativeGame.server_onCreate( self )
self.network:setClientData( { time = time.timeOfDay } )

self:loadCraftingRecipes()
g_godMode = true
g_disableScrapHarvest = true

end

function CreativeGame.loadCraftingRecipes( self )
Expand All @@ -41,7 +67,17 @@ function CreativeGame.server_onFixedUpdate( self, timeStep )
end

function CreativeGame.server_onPlayerJoined( self, player, newPlayer )
g_unitManager:sv_onPlayerJoined( player )
if newPlayer then
self.sv.saved.world:loadCell( 0, 0, player, "sv_createNewPlayer" )
else
g_unitManager:sv_onPlayerJoined( player )
end

end

function CreativeGame.sv_createNewPlayer( self, world, x, y, player )
local params = { player = player, x = x, y = y }
sm.event.sendToWorld( self.sv.saved.world, "sv_e_spawnNewCharacter", params )
end

function CreativeGame.client_onCreate( self )
Expand Down Expand Up @@ -72,6 +108,9 @@ function CreativeGame.client_onCreate( self )
g_unitManager = UnitManager()
end
g_unitManager:cl_onCreate()

g_effectManager = EffectManager()
g_effectManager:cl_onCreate()
end

function CreativeGame.client_onClientDataUpdate( self, clientData )
Expand Down Expand Up @@ -179,5 +218,21 @@ function CreativeGame.sv_n_onChatCommand( self, params, player )
end
end
end
sm.interopGamefileModVersion = 4

CreativeFlatGame = class( CreativeGame )
CreativeFlatGame.worldScriptFilename = "$GAME_DATA/Scripts/game/worlds/CreativeFlatWorld.lua";
CreativeFlatGame.worldScriptClass = "CreativeFlatWorld";

ClassicCreativeGame = class( CreativeGame )
ClassicCreativeGame.worldScriptFilename = "$GAME_DATA/Scripts/game/worlds/ClassicCreativeTerrainWorld.lua";
ClassicCreativeGame.worldScriptClass = "ClassicCreativeTerrainWorld";

CreativeCustomGame = class( CreativeGame )
CreativeCustomGame.worldScriptFilename = "$GAME_DATA/Scripts/game/worlds/CreativeCustomWorld.lua";
CreativeCustomGame.worldScriptClass = "CreativeCustomWorld";

CreativeTerrainGame = class( CreativeGame )
CreativeTerrainGame.worldScriptFilename = "$GAME_DATA/Scripts/game/worlds/CreativeTerrainWorld.lua";
CreativeTerrainGame.worldScriptClass = "CreativeTerrainWorld";
sm.interopGamefileModVersion = 5
dofile '$CONTENT_e94ac99f-393e-4816-abe3-353435a1edf4/Scripts/Overrides/CreativeGame.lua'
96 changes: 2 additions & 94 deletions GamefileMod/Data/Scripts/game/CreativePlayer.lua
Original file line number Diff line number Diff line change
@@ -1,96 +1,4 @@
dofile( "$GAME_DATA/Scripts/game/BasePlayer.lua" )

CreativePlayer = class( nil )

function CreativePlayer.server_onCreate( self )
self.sv = {}
self:sv_init()
end

function CreativePlayer.server_onRefresh( self )
self:sv_init()
end

function CreativePlayer.sv_init( self ) end

function CreativePlayer.server_onDestroy( self ) end

function CreativePlayer.client_onCreate( self )
self.cl = {}
self:cl_init()
end

function CreativePlayer.client_onRefresh( self )
self:cl_init()
end

function CreativePlayer.cl_init(self) end

function CreativePlayer.client_onUpdate( self, dt ) end

function CreativePlayer.client_onInteract( self, character, state ) end

function CreativePlayer.server_onFixedUpdate( self, dt ) end

function CreativePlayer.server_onProjectile( self, hitPos, hitTime, hitVelocity, projectileName, attacker, damage ) end

function CreativePlayer.server_onMelee( self, hitPos, attacker, damage, power )
if not sm.exists( attacker ) then
return
end

if self.player.character and attacker.character then
local attackDirection = ( hitPos - attacker.character.worldPosition ):normalize()
-- Melee impulse
if attacker then
ApplyKnockback( self.player.character, attackDirection, power )
end
end
end

function CreativePlayer.server_onExplosion( self, center, destructionLevel ) end

function CreativePlayer.server_onCollision( self, other, collisionPosition, selfPointVelocity, otherPointVelocity, collisionNormal ) end

function CreativePlayer.sv_e_staminaSpend( self, stamina ) end

function CreativePlayer.sv_e_receiveDamage( self, damageData ) end

function CreativePlayer.sv_e_respawn( self ) end

function CreativePlayer.sv_e_debug( self, params ) end

function CreativePlayer.sv_e_eat( self, edibleParams ) end

function CreativePlayer.sv_e_feed( self, params ) end

function CreativePlayer.sv_e_setRefiningState( self, params )
local userPlayer = params.user:getPlayer()
if userPlayer then
if params.state == true then
userPlayer:sendCharacterEvent( "refine" )
else
userPlayer:sendCharacterEvent( "refineEnd" )
end
end
end

function CreativePlayer.sv_e_onLoot( self, params ) end

function CreativePlayer.sv_e_onStayPesticide( self ) end

function CreativePlayer.sv_e_onEnterFire( self ) end

function CreativePlayer.sv_e_onStayFire( self ) end

function CreativePlayer.sv_e_onEnterChemical( self ) end

function CreativePlayer.sv_e_onStayChemical( self ) end

function CreativePlayer.sv_e_startLocalCutscene( self, cutsceneInfoName ) end

function CreativePlayer.client_onCancel( self ) end

function CreativePlayer.client_onReload( self ) end

function CreativePlayer.server_onShapeRemoved( self, removedShapes ) end
CreativePlayer = class( BasePlayer )
dofile '$CONTENT_e94ac99f-393e-4816-abe3-353435a1edf4/Scripts/Overrides/CreativePlayer.lua'
Loading

0 comments on commit 4c83dc6

Please sign in to comment.