Skip to content

Commit

Permalink
Merge pull request #1 from bodsch/feature/add-more-maps
Browse files Browse the repository at this point in the history
change map handling
  • Loading branch information
bodsch authored Apr 30, 2021
2 parents 44a26a2 + b72cba5 commit 1270e14
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 21 deletions.
28 changes: 14 additions & 14 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,6 @@ urbanterror_admin_password: s3cr3T-are-p0ssiBL3
urbanterror_start_map: ut4_riyadh
urbanterror_game_type: CaptureTheFlag

# Game types for urban terror
urbanterror_game_type_map:
FreeForAll: 0
LastManStanding: 1
TeamDeathMatch: 3
TeamSurvivor: 4
FollowTheLeader: 5
CaptureAndHold: 6
CaptureTheFlag: 7
BombMode: 8
JumpTraining: 9
FreezeTag: 10
GunGame: 11

urbanterror_bind_ip: "{{ ansible_default_ipv4.address }}"
urbanterror_bind_port: 27960

Expand All @@ -27,4 +13,18 @@ urbanterror_binary: "Quake3-UrT-Ded.{{ ansible_machine }}"

urbanterror_directory: /opt/urbanterror

urbanterror_maps:
- ut4_abbey
- ut4_mandolin
- ut4_uptown
- ut4_algiers
- ut4_austria
- ut4_oildepot

urbanterror_custom_maps:
- name: ut_park_avenue_fix
src: http://downloads.urban-zone.org/maps/q3ut4/ut_park_avenue_fix.pk3
- name: ut_maya_beta3
src: http://downloads.urban-zone.org/maps/q3ut4/ut_maya_beta3.pk3

...
2 changes: 1 addition & 1 deletion files/updater.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function doManifest ()
-X POST \
-H "Content-Type: application/x-www-form-urlencoded;charset=utf-8" \
-d "platform=${PLATFORM}" \
-d "query=$1" \
-d "query=${1}" \
-d "password=${PASSWORD}" \
-d "version=${CURRENTVERSION}" \
-d "engine=${GAMEENGINE}" \
Expand Down
12 changes: 12 additions & 0 deletions tasks/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@
dest: "{{ urbanterror_directory }}/server.sh"
mode: 0750

- name: get custom maps
get_url:
url: "{{ item.src }}"
dest: "{{ urbanterror_directory }}/q3ut4/"
register: _download_archive
until: _download_archive is succeeded
retries: 5
delay: 2
loop: "{{ urbanterror_custom_maps }}"
loop_control:
label: "{{ item.name }}"

- name: create server config -> {{ urbanterror_directory }}/q3ut4/server.cfg
template:
src: server.cfg.j2
Expand Down
1 change: 1 addition & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- include_tasks: prepare.yaml
- include_tasks: install.yaml
- include_tasks: service.yaml
- include_tasks: write_facts.yaml

...

11 changes: 11 additions & 0 deletions tasks/write_facts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---

- name: create custom fact file
template:
src: facts.d/urbanterror.fact.j2
dest: /etc/ansible/facts.d/urbanterror.fact
owner: root
group: root
mode: 0755

...
8 changes: 8 additions & 0 deletions templates/facts.d/urbanterror.fact.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
cat <<EOF
{
"current_version": "{{ urbanterror_current_version }}",
"download_server": "{{ urbanterror_download_server }}",
"game_engine": "{{ urbanterror_game_engine }}"
}
EOF
16 changes: 10 additions & 6 deletions templates/mapcycle.txt.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{{ urbanterror_start_map }}
ut4_abbey
ut4_mandolin
ut4_uptown
ut4_algiers
ut4_austria
ut4_oildepot
{% if urbanterror_maps is defined %}
{% for map in urbanterror_maps %}
{{ map }}
{% endfor %}
{% endif %}
{% if urbanterror_custom_maps is defined %}
{% for k in urbanterror_custom_maps %}
{{ k.name }}
{% endfor %}
{% endif %}
18 changes: 18 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,23 @@ urbanterror_dependencies:

urbanterror_server_config: "{{ urbanterror_install_path }}/q3ut4/server.cfg"

# Game types for urban terror
urbanterror_game_type_map:
FreeForAll: 0
LastManStanding: 1
TeamDeathMatch: 3
TeamSurvivor: 4
FollowTheLeader: 5
CaptureAndHold: 6
CaptureTheFlag: 7
BombMode: 8
JumpTraining: 9
FreezeTag: 10
GunGame: 11

urbanterror_current_version: ''
urbanterror_download_server: ''
urbanterror_game_engine: ''

...

0 comments on commit 1270e14

Please sign in to comment.