Permalink
Browse files

Merge branch 'master' into slots

Conflicts:
	dat/outfit.xml
	dat/ship.xml
	src/board.c
	src/dev_uniedit.c
	src/equipment.c
	src/map.c
	src/nlua_naev.c
	src/options.c
	src/outfit.c
	src/pilot.c
	src/pilot.h
	src/pilot_ew.c
	src/pilot_outfit.c
	src/pilot_weapon.c
	src/pilot_weapon.h
	src/player_autonav.c
	src/ship.c
  • Loading branch information...
2 parents 45be87f + cc02759 commit 94ef1390ca742afabda59535b10dc4be58eb4a8a BTAxis committed Mar 1, 2012
Showing 1,214 changed files with 31,180 additions and 28,534 deletions.
View
@@ -11,6 +11,7 @@ appicondir = $(datadir)/pixmaps
appicon_DATA = extras/logos/naev.png
Graphicsdir = $(datadir)/applications
Graphics_DATA = naev.desktop
+dist_pkgdata_DATA = naev-confupdate.sh
dist_man6_MANS = naev.6
dist_doc_DATA = AUTHORS README TODO LICENSE
@@ -48,14 +49,14 @@ $(MKSPR):
$(DATA_ARCHIVE): $(PACK) VERSION
@echo " PACK $(DATA_ARCHIVE)"
cd "$(top_srcdir)" && \
- $(abs_top_builddir)/$(PACK) "$(abs_top_builddir)/$(DATA_ARCHIVE)" \
- AUTHORS VERSION \
- $$(find ai -type f -name '*.lua'; \
- find gfx -type f -name '*.png'; \
+ (find AUTHORS VERSION naev-confupdate.sh -print0; \
+ find ai -type f -name '*.lua' -print0; \
+ find gfx -type f -name '*.png' -print0; \
find snd -type f \
- \( -name '*.ogg' -o -name '*.wav' -o -name '*.lua' \); \
- find scripts -type f -name '*.lua'; \
- find dat -type f);
+ \( -name '*.ogg' -o -name '*.wav' -o -name '*.lua' \) -print0; \
+ find scripts -type f -name '*.lua' -print0; \
+ find dat -type f -print0) | xargs -0 \
+ $(abs_top_builddir)/$(PACK) "$(abs_top_builddir)/$(DATA_ARCHIVE)";
else
utils:
View
@@ -0,0 +1,224 @@
+--[[This file contains the attack profiles by ship type.
+--commonly used range and condition-based attack patterns are found in another file
+--Think functions for determining who to attack are found in another file
+--]]
+
+-- Initializes the drone
+function atk_drone_init ()
+ mem.atk_think = atk_drone_think
+ mem.atk = atk_drone
+end
+
+
+--[[
+-- Mainly targets small drones.
+--]]
+function atk_drone_think ()
+ local target = ai.target()
+
+ -- Stop attacking if it doesn't exist
+ if not ai.exists(target) then
+ ai.poptask()
+ return
+ end
+
+ local enemy = ai.getenemy_size(0, 200) -- find a small ship to attack
+ local nearest_enemy = ai.getenemy()
+ local dist = 0
+ local sizedist = 0
+
+ if enemy ~= nil then
+ sizedist = ai.dist(enemy)
+ end
+ if nearest_enemy ~= nil then
+ dist = ai.dist(nearest_enemy)
+ end
+
+ local range = ai.getweaprange(3, 0)
+ -- Get new target if it's closer
+ --prioritize targets within the size limit
+ if enemy ~= target and enemy ~= nil then
+ -- Shouldn't switch targets if close
+ if sizedist > range * mem.atk_changetarget then
+ ai.pushtask("attack", enemy )
+ end
+
+ elseif nearest_enemy ~= target and nearest_enemy ~= nil then
+ -- Shouldn't switch targets if close
+ if dist > range * mem.atk_changetarget then
+ ai.pushtask("attack", nearest_enemy )
+ end
+ end
+end
+
+
+--[[
+-- Enters ranged combat with the target - modified version for drones
+--]]
+function _atk_drone_ranged( target, dist )
+ --local dir = ai.face(target) -- Normal face the target
+ local dir = ai.aim(target) -- Aim for the target
+ -- TODO: should modify this line
+
+ -- Check if in range
+ if dist < ai.getweaprange( 4 ) and dir < 30 then
+ ai.weapset( 4 )
+ end
+
+ -- Always launch fighters
+ ai.weapset( 5 )
+
+ -- Approach for melee
+ if dir < 10 then
+ ai.accel()
+ end
+end
+
+--[[
+-- Main control function for drone behavior.
+--]]
+function atk_drone ()
+ local target = _atk_com_think()
+ if target == nil then return end
+
+ -- Targeting stuff
+ ai.hostile(target) -- Mark as hostile
+ ai.settarget(target)
+
+ -- Get stats about enemy
+ local dist = ai.dist( target ) -- get distance
+ local range = ai.getweaprange(3, 0) -- get my weapon range (?)
+
+ -- We first bias towards range
+ if dist > range * mem.atk_approach then
+ _atk_drone_ranged( target, dist ) -- Use generic ranged function
+
+ -- Otherwise melee
+ else
+ if ai.shipmass(target) < 200 then
+ _atk_d_space_sup( target, dist )
+ else
+ _atk_d_flyby( target, dist )
+ end
+ end
+end
+
+
+--[[
+-- Execute a sequence of close-in flyby attacks
+-- Uses a combination of facing and distance to determine what action to take
+-- This version is slightly less aggressive and cruises by the target
+--]]
+function _atk_d_flyby( target, dist )
+ local range = ai.getweaprange(3)
+ local dir = 0
+ ai.weapset( 3 ) -- Forward/turrets
+
+ -- Far away, must approach
+ if dist > (3 * range) then
+ dir = ai.idir(target)
+ if dir < 10 and dir > -10 then
+ --_atk_keep_distance()
+ atk_spiral_approach(target, dist) -- mod
+ ai.accel()
+ else
+ dir = ai.iface(target)
+ end
+
+ -- Midrange
+ elseif dist > (0.75 * range) then
+
+ --dir = ai.idir(target)
+ dir = ai.aim(target) -- drones need to aim more to avoid circling
+ --test if we're facing the target. If we are, keep approaching
+ if dir <= 30 and dir > -30 then
+ ai.iface(target)
+ if dir < 10 and dir > -10 then
+ ai.accel()
+ end
+ elseif dir > 30 and dir < 180 then
+ ai.turn(1)
+ ai.accel()
+ else
+ ai.turn(-1)
+ ai.accel()
+ end
+
+ --otherwise we're close to the target and should attack until we start to zip away
+ else
+
+ dir = ai.aim(target)
+ --not accellerating here is the only difference between the aggression levels. This can probably be an aggression AI parameter
+ if mem.aggressive == true then
+ ai.accel()
+ end
+
+ -- Shoot if should be shooting.
+ if dir < 10 then
+ ai.shoot()
+ end
+ ai.shoot(true)
+
+ end
+end
+
+
+--[[
+-- Attack Profile for a maneuverable ship engaging a maneuverable target
+--
+--This is designed for drones engaging other drones
+--]]
+function _atk_d_space_sup( target, dist )
+ local range = ai.getweaprange(3)
+ local dir = 0
+ ai.weapset( 3 ) -- Forward/turrets
+
+ --if we're far away from the target, then turn and approach
+ if dist > (1.1*range) then
+ dir = ai.idir(target)
+ if dir < 10 and dir > -10 then
+ _atk_keep_distance()
+ ai.accel()
+ else
+ dir = ai.iface(target)
+ ai.accel()
+ end
+
+ elseif dist > 0.8* range then
+ --drifting away from target, so emphasize intercept
+ --course facing and accelerate to close
+ --dir = ai.iface(target)
+ dir = ai.aim(target)
+ if dir < 15 and dir > -15 and ai.relvel(target) > -10 then
+ ai.accel()
+ end
+
+ --within close range; aim and blast away with everything
+ elseif dist > 0.4*range then
+ dir = ai.aim(target)
+ local dir2 = ai.idir(target)
+
+ --accelerate and try to close
+ --but only accel if it will be productive
+ if dir2 < 15 and dir2 > -15 and ai.relvel(target) > -10 then
+ ai.accel()
+ end
+
+ -- Shoot if should be shooting.
+ if dir < 10 then
+ ai.shoot()
+ end
+ ai.shoot(true)
+
+ --within really close range (?); aim and blast away with everything
+ else
+ dir = ai.aim(target)
+ -- Shoot if should be shooting.
+ if dir < 15 then -- mod: was 10
+ ai.shoot()
+ end
+ ai.shoot(true)
+ end
+end
+
+
View
@@ -20,6 +20,7 @@ include("ai/include/atk_corvette.lua")
include("ai/include/atk_capital.lua")
--include("ai/include/atk_cruiser.lua")
--include("ai/include/atk_carrier.lua")
+include("ai/include/atk_drone.lua")
-- Set attack variables
mem.atk_changetarget = 2 -- Distance at which target changes
@@ -77,9 +78,12 @@ function attack_choose ()
if class == "Bomber" then
atk_bomber_init()
- elseif class == "Fighter" or class == "Drone" then
+ elseif class == "Fighter" then
atk_fighter_init()
+ elseif class == "Drone" then
+ atk_drone_init()
+
-- Medium ships
elseif class == "Corvette" then
atk_corvette_init()
View
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.61])
-AC_INIT([naev], [0.5.0], [bobbens@gmail.com])
+AC_INIT([naev], [0.5.1], [bobbens@gmail.com])
AC_CONFIG_SRCDIR([src/naev.c])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_MACRO_DIR([m4])
@@ -229,20 +229,6 @@ AS_IF([test -z "$ndata_path" || test "$ndata_path" = "yes"], [
])
AC_SUBST([ndata_path])
-# --with-preferences-dir
-prefsdir=".$PACKAGE_NAME"
-expand_variable prefsdir
-
-AC_MSG_CHECKING([for preferences directory])
-AC_ARG_WITH([preferences-dir],
- AC_HELP_STRING([--with-preferences-dir=DIR], [preferences directory]),
- [prefsdir="$withval"], [])
-AC_MSG_RESULT([$prefsdir])
-AS_IF([test -z "$prefsdir" || test "$prefsdir" = "yes"], [
- AC_ERROR([The preferences directory must be explicitly specified])
-])
-AC_SUBST([prefsdir])
-
#
# Checks for libraries.
#
@@ -543,7 +529,7 @@ case "$host" in
AC_DEFINE([FREEBSD], 1, [Define to 1 if running on FreeBSD])
;;
*-mingw*)
- AC_CHECK_TOOL(WINDRES, windres)
+ AC_CHECK_TOOL(WINDRES, windres)
AC_DEFINE([WIN32], 1, [Define to 1 if running on Windows])
;;
*-darwin*)
@@ -555,10 +541,6 @@ esac
AC_DEFINE_UNQUOTED([NDATA_DEF], ["$ndata_path"],
[Define to the path to the data file])
-# PREFSDIR_DEF
-AC_DEFINE_UNQUOTED([PREFSDIR_DEF], ["$prefsdir"],
- [Define to preferences directory])
-
# GIT_COMMIT
AS_IF([test -n "$GIT_COMMIT"], [
AC_DEFINE_UNQUOTED([GIT_COMMIT], ["$GIT_COMMIT"],
@@ -608,7 +590,6 @@ AC_OUTPUT
echo
AC_MSG_NOTICE([prefix: $prefix])
AC_MSG_NOTICE([ndata: $ndata_path])
-AC_MSG_NOTICE([prefsdir: $prefsdir])
echo
AC_MSG_NOTICE([sound backends:])
AC_MSG_NOTICE([ OpenAL: $have_openal])
Oops, something went wrong.

0 comments on commit 94ef139

Please sign in to comment.