Merge pull request #307 from KoffeinFlummi/setup-script

Add setup script and CBA includes
This commit is contained in:
Felix Wiegand 2015-04-05 14:36:49 +02:00
commit 46dadd2fa6
3 changed files with 1483 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,99 @@
/////////////////////////////////////////////////////////////////////////////////
// MACRO: EXTENDED_EVENTHANDLERS
// XEH uses all existing event handlers
/////////////////////////////////////////////////////////////////////////////////
#define EXTENDED_EVENTHANDLERS init = QUOTE(if(isNil'SLX_XEH_MACHINE')then{call compile preProcessFileLineNumbers '\x\cba\addons\xeh\init_pre.sqf'};_this call SLX_XEH_EH_Init); \
fired = "_this call SLX_XEH_EH_Fired"; \
animChanged = "_this call SLX_XEH_EH_AnimChanged"; \
animDone = "_this call SLX_XEH_EH_AnimDone"; \
animStateChanged = "_this call SLX_XEH_EH_AnimStateChanged"; \
containerClosed = "_this call SLX_XEH_EH_ContainerClosed"; \
containerOpened = "_this call SLX_XEH_EH_ContainerOpened"; \
controlsShifted = "_this call SLX_XEH_EH_ControlsShifted"; \
dammaged = "_this call SLX_XEH_EH_Dammaged"; \
engine = "_this call SLX_XEH_EH_Engine"; \
epeContact = "_this call SLX_XEH_EH_EpeContact"; \
epeContactEnd = "_this call SLX_XEH_EH_EpeContactEnd"; \
epeContactStart = "_this call SLX_XEH_EH_EpeContactStart"; \
explosion = "_this call SLX_XEH_EH_Explosion"; \
firedNear = "_this call SLX_XEH_EH_FiredNear"; \
fuel = "_this call SLX_XEH_EH_Fuel"; \
gear = "_this call SLX_XEH_EH_Gear"; \
getIn = "_this call SLX_XEH_EH_GetIn"; \
getOut = "_this call SLX_XEH_EH_GetOut"; \
handleHeal = "_this call SLX_XEH_EH_HandleHeal"; \
hit = "_this call SLX_XEH_EH_Hit"; \
hitPart = "_this call SLX_XEH_EH_HitPart"; \
incomingMissile = "_this call SLX_XEH_EH_IncomingMissile"; \
inventoryClosed = "_this call SLX_XEH_EH_InventoryClosed"; \
inventoryOpened = "_this call SLX_XEH_EH_InventoryOpened"; \
killed = "_this call SLX_XEH_EH_Killed"; \
landedTouchDown = "_this call SLX_XEH_EH_LandedTouchDown"; \
landedStopped = "_this call SLX_XEH_EH_LandedStopped"; \
local = "_this call SLX_XEH_EH_Local"; \
respawn = "_this call SLX_XEH_EH_Respawn"; \
put = "_this call SLX_XEH_EH_Put"; \
take = "_this call SLX_XEH_EH_Take"; \
soundPlayed = "_this call SLX_XEH_EH_SoundPlayed"; \
weaponAssembled = "_this call SLX_XEH_EH_WeaponAssembled"; \
weaponDisAssembled = "_this call SLX_XEH_EH_WeaponDisassembled";
//handleDamage = "_this call SLX_XEH_EH_HandleDamage"; \
//mpHit = "_this call SLX_XEH_EH_MPHit"; \
//mpKilled = "_this call SLX_XEH_EH_MPKilled"; \
//mpRespawn = "_this call SLX_XEH_EH_MPRespawn";
/////////////////////////////////////////////////////////////////////////////////
// MACRO: DELETE_EVENTHANDLERS
//
// Example:
//
// class DefaultEventhandlers;
// class Car_F;
// class MRAP_01_base_F: Car_F {
// class EventHandlers;
// };
// class B_MRAP_01_F: MRAP_01_base_F {
// class Eventhandlers: EventHandlers {
// DELETE_EVENTHANDLERS
// };
// };
/////////////////////////////////////////////////////////////////////////////////
#define DELETE_EVENTHANDLERS delete init; \
delete fired; \
delete animChanged; \
delete animDone; \
delete animStateChanged; \
delete containerClosed; \
delete containerOpened; \
delete controlsShifted; \
delete dammaged; \
delete engine; \
delete epeContact; \
delete epeContactEnd; \
delete epeContactStart; \
delete explosion; \
delete firedNear; \
delete fuel; \
delete gear; \
delete getIn; \
delete getOut; \
delete handleHeal; \
delete hit; \
delete hitPart; \
delete incomingMissile; \
delete inventoryClosed; \
delete inventoryOpened; \
delete killed; \
delete landedTouchDown; \
delete landedStopped; \
delete local; \
delete respawn; \
delete put; \
delete take; \
delete soundPlayed; \
delete weaponAssembled; \
delete weaponDisAssembled;

118
tools/setup.py Normal file
View File

@ -0,0 +1,118 @@
#!/usr/bin/env python3
#######################
# ACE3 Setup Script #
#######################
import os
import sys
import shutil
import platform
import subprocess
import winreg
def main():
print("""
######################################
# ACE3 Development Environment Setup #
######################################
This script will create your ACE3 dev environment for you.
Before you run this, you should already have:
- The Arma 3 Tools installed properly via Steam
- A properly set up P-drive
If you have not done those things yet, please abort this script in the next step and do so first.
This script will create two hard links on your system, both pointing to your ACE3 project folder:
[Arma 3 installation directory]\\z\\ace => ACE3 project folder
P:\\z\\ace => ACE3 project folder
It will also copy the required CBA includes to P:\\x\\cba, if you do not have the CBA source code already.""")
print("\n")
try:
reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
key = winreg.OpenKey(reg,
r"SOFTWARE\Wow6432Node\bohemia interactive\arma 3")
armapath = winreg.EnumValue(key,1)[1]
except:
print("Failed to determine Arma 3 Path.")
return 1
if not os.path.exists("P:\\"):
print("No P-drive detected.")
return 2
scriptpath = os.path.realpath(__file__)
projectpath = os.path.dirname(os.path.dirname(scriptpath))
print("# Detected Paths:")
print(" Arma Path: {}".format(armapath))
print(" Project Path: {}".format(projectpath))
repl = input("\nAre these correct? (y/n): ")
if repl.lower() != "y":
return 3
print("\n# Creating links ...")
if os.path.exists("P:\\z\\ace"):
print("Link on P: already exists. Please finish the setup manually.")
return 4
if os.path.exists(os.path.join(armapath, "z", "ace")):
print("Link in Arma directory already exists. Please finish the setup manually.")
return 5
try:
if not os.path.exists("P:\\z"):
os.mkdir("P:\\z")
if not os.path.exists(os.path.join(armapath, "z")):
os.mkdir(os.path.join(armapath, "z"))
if platform.win32_ver()[0] == "7":
subprocess.call(["cmd", "/c", "mklink", "/D", "P:\\z\\ace", projectpath])
subprocess.call(["cmd", "/c", "mklink", "/D", os.path.join(armapath, "z", "ace"), projectpath])
else:
subprocess.call(["cmd", "/c", "mklink", "/D", "/J", "P:\\z\\ace", projectpath])
subprocess.call(["cmd", "/c", "mklink", "/D", "/J", os.path.join(armapath, "z", "ace"), projectpath])
except:
raise
print("Something went wrong during the link creation. Please finish the setup manually.")
return 6
print("# Links created successfully.")
print("\n# Copying required CBA includes ...")
if os.path.exists("P:\\x\\cba"):
print("P:\\x\\cba already exists, skipping.")
return -1
try:
shutil.copytree(os.path.join(projectpath, "tools", "cba"), "P:\\x\\cba")
except:
raise
print("Something went wrong while copying CBA includes. Please copy tools\\cba to P:\\x\\cba manually.")
return 7
print("# CBA includes copied successfully to P:\\x\\cba.")
return 0
if __name__ == "__main__":
exitcode = main()
if exitcode > 0:
print("\nSomething went wrong during the setup. Make sure you run this script as administrator. If these issues persist, please follow the instructions on the ACE3 wiki to perform the setup manually.")
else:
print("\nSetup successfully completed.")
input("\nPress enter to exit ...")
sys.exit(exitcode)