Skip to content

Commit

Permalink
hooks: rewrite so dct initializes from hooks
Browse files Browse the repository at this point in the history
It seems DCS has several bugs where scripts in the .miz might be run by
the client. To fix this remove the requirement to have mission designers
apply the `dct-mission-init.lua` script as a do-script-from-file mission
start trigger. It is expected only servers will have the hooks installed
and so this should avoid the client side issues.

As part of the rewrite the dct hooks dropped support for exporting data
about the server. There are several other third-party server monitoring
tools/hooks out there that provide far greater capability than the dct
hook could provide.
  • Loading branch information
jtoppins committed Mar 20, 2023
1 parent fdf6933 commit f72a743
Show file tree
Hide file tree
Showing 10 changed files with 652 additions and 785 deletions.
53 changes: 21 additions & 32 deletions .github/workflows/check-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,32 @@ name: check pull request
on:
pull_request:
branches:
- master
- master
push:
branches:
- master
- master

env:
PACKAGES: lua5.1 lua-md5 lua-filesystem lua-check
PACKAGES: lua5.1 lua-md5 lua-filesystem lua-check make

jobs:
luacheck:
make-check:
runs-on: ubuntu-latest
steps:
- name: Install Packages
run: sudo apt-get install $PACKAGES

- name: Checkout DCT
uses: actions/checkout@v2

- name: Run luacheck
run: luacheck hooks mission scripts src tests

runtests:
runs-on: ubuntu-latest
steps:
- name: Install Packages
run: sudo apt-get install $PACKAGES

- name: Checkout DCT
uses: actions/checkout@v2
with:
path: dct

- name: Checkout lua-libs
uses: actions/checkout@v2
with:
repository: jtoppins/lua-libs
path: lua-libs

- name: Run Tests
run: ./dct/tests/runtests
- name: Install Packages
run: sudo apt-get install $PACKAGES

- name: Checkout DCT
uses: actions/checkout@v2
with:
path: dct

- name: Checkout lua-libs
uses: actions/checkout@v2
with:
repository: jtoppins/lua-libs
path: lua-libs

- name: Run Tests
run: make check
working-directory: dct
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ LUALIBSDIR := lua-libs-$(LUALIBSVER)

.PHONY: check build
check:
luacheck -q hooks mission scripts src tests
luacheck -q hooks scripts src tests
rm -f "$(SRCPATH)"/data/*.state
@$(MAKE) -C tests

build:
mkdir -p "$(BUILDPATH)"/Mods/Tech/DCT/lua
cp -a "$(SRCPATH)"/src/dct.lua "$(SRCPATH)"/src/dct/ "$(BUILDPATH)"/Mods/Tech/DCT/lua
cp -a "$(SRCPATH)"/src/dct/ "$(SRCPATH)"/src/dcthooks.lua \
"$(BUILDPATH)"/Mods/Tech/DCT/lua
sed -e "s:%VERSION%:$(VERSION):" "$(SRCPATH)"/entry.lua.tpl > \
"$(BUILDPATH)"/Mods/Tech/DCT/entry.lua
sed -e "s:%VERSION%:$(VERSION):" "$(SRCPATH)"/src/dct.lua > \
"$(BUILDPATH)"/Mods/Tech/DCT/lua/dct.lua
mkdir -p "$(BUILDPATH)"/Scripts/Hooks
cp -a "$(SRCPATH)"/mission/* "$(BUILDPATH)"/Scripts/
cp -a "$(SRCPATH)"/hooks/* "$(BUILDPATH)"/Scripts/Hooks/
mkdir -p "$(BUILDPATH)"/Config/
cp -a "$(SRCPATH)"/data/Config/dct.cfg "$(BUILDPATH)"/Config/dct.cfg
Expand All @@ -32,7 +32,6 @@ build:
(mkdir -p "$(BUILDPATH)"/demomiz; \
cd "$(BUILDPATH)"/demomiz; \
cp -a "$(SRCPATH)"/data/mission/* .; \
cp "$(SRCPATH)"/mission/* l10n/DEFAULT/; \
zip -r "../Missions/dct-demo-mission.miz" .)
cp "$(SRCPATH)"/README.md "$(BUILDPATH)"/
mkdir -p "$(BUILDPATH)"/temp
Expand Down
Loading

0 comments on commit f72a743

Please sign in to comment.