Add weapon speed setting to ranged weapons

alut-include-path
Sven Eberhardt 2017-03-04 22:46:58 -05:00
parent d2e57dd318
commit 1c7ee21903
8 changed files with 99 additions and 14 deletions

View File

@ -6,6 +6,7 @@
*/
#include Library_HasExtraSlot
#include Library_RangedWeapon
local is_aiming;
local animation_set;
@ -13,10 +14,15 @@ local loaded;
local holding;
local musk_up, musk_front, musk_down, musk_offset;
// Default timing values for animation set
// (Adjusted for speeed multiplier and stored in animation set by Library_RangedWeapon)
local DefaultLoadTime = 80;
local DefaultShootTime = 20;
/*-- Engine Callbacks --*/
public func Initialize()
public func Initialize(...)
{
// Tweaking options
musk_up = 12;
@ -31,12 +37,12 @@ public func Initialize()
AimMode = AIM_Position, // The aiming animation is done by adjusting the animation position to fit the angle.
AnimationAim = "MusketAimArms",
AnimationLoad = "MusketLoadArms",
LoadTime = 80,
AnimationShoot = nil,
ShootTime = 20,
WalkSpeed = 84,
WalkBack = 56,
};
return _inherited(...);
}
public func Hit()
@ -225,6 +231,7 @@ public func GetCarryTransform()
public func Definition(def)
{
SetProperty("PictureTransformation", Trans_Mul(Trans_Translate(1500, 0, -1500), Trans_Rotate(170, 0, 1, 0), Trans_Rotate(30, 0, 0, 1)), def);
return _inherited(def, ...);
}

View File

@ -6,6 +6,7 @@
*/
#include Library_HasExtraSlot
#include Library_RangedWeapon
local fAiming;
local iArrowMesh;
@ -13,16 +14,20 @@ local animation_set;
/*-- Engine Callbacks --*/
func Initialize()
// Default timing values for animation set
// (Adjusted for speeed multiplier and stored in animation set by Library_RangedWeapon)
local DefaultLoadTime = 30;
local DefaultLoadTime2 = 5*30/20;
local DefaultShootTime = 20;
local DefaultShootTime2 = nil;
func Initialize(...)
{
animation_set = {
AimMode = AIM_Position, // The aiming animation is done by adjusting the animation position to fit the angle
AnimationAim = "BowAimArms",
AnimationLoad = "BowLoadArms",
LoadTime = 30,
LoadTime2 = 5*30/20,
AnimationShoot = nil,
ShootTime = 20,
TurnType = 1,
WalkSpeed = 84,
WalkBack = 56,
@ -34,6 +39,7 @@ func Initialize()
["KneelDown", "BowKneel"]
],
};
return _inherited(...);
}
func Hit()
@ -229,6 +235,7 @@ public func GetCarrySpecial(clonk)
func Definition(def)
{
def.PictureTransformation = Trans_Mul(Trans_Translate(-4000,-2000,4000),Trans_Rotate(180,0,1,0),Trans_Rotate(-45,0,0,1));
return _inherited(def, ...);
}
/*-- Properties --*/

View File

@ -6,6 +6,12 @@
*/
#include Library_HasExtraSlot
#include Library_RangedWeapon
// Default timing values for animation set
// (Adjusted for speeed multiplier and stored in animation set by Library_RangedWeapon)
local DefaultLoadTime = 80;
local DefaultShootTime = 20;
local is_aiming;
local animation_set;
@ -20,7 +26,7 @@ local MuzzleUp; local MuzzleFront; local MuzzleDown; local MuzzleOffset;
/*-- Engine Callbacks --*/
func Initialize()
func Initialize(...)
{
//Tweaking options
MuzzleUp = 12;
@ -35,12 +41,12 @@ func Initialize()
AimMode = AIM_Position, // The aiming animation is done by adjusting the animation position to fit the angle
AnimationAim = "MusketAimArms",
AnimationLoad = "MusketLoadArms",
LoadTime = 80,
AnimationShoot = nil,
ShootTime = 20,
WalkSpeed = 84,
WalkBack = 56,
};
return _inherited(...);
}
func Hit()
@ -244,6 +250,7 @@ public func GetCarryTransform(object clonk, bool idle, bool nohand, bool second_
func Definition(def)
{
def.PictureTransformation = Trans_Mul(Trans_Translate(-3000, 1000, 1500),Trans_Rotate(170,0,1,0),Trans_Rotate(30,0,0,1));
return _inherited(def, ...);
}
/*-- Properties --*/

View File

@ -6,13 +6,19 @@
--*/
#include Library_Stackable
#include Library_RangedWeapon
// Default timing values for animation set
// (Adjusted for speeed multiplier and stored in animation set by Library_RangedWeapon)
local DefaultShootTime = 16;
local DefaultShootTime2 = 8;
local animation_set;
local aiming;
/*-- Engine Callbacks --*/
func Initialize()
func Initialize(...)
{
animation_set = {
AimMode = AIM_Position, // The aiming animation is done by adjusting the animation position to fit the angle
@ -20,10 +26,9 @@ func Initialize()
AnimationShoot = "SpearThrowArms",
AnimationShoot2 = "SpearThrow2Arms",
AnimationShoot3 = "SpearThrow3Arms",
ShootTime = 16,
ShootTime2 = 8,
WalkBack = 0,
};
return _inherited(...);
}
func Hit()
@ -261,8 +266,9 @@ public func GetCarryTransform()
if(aiming == 1) return Trans_Rotate(180, 0, 0, 1);
}
func Definition(def) {
func Definition(def, ...) {
SetProperty("PictureTransformation", Trans_Mul(Trans_Rotate(40,0,0,1),Trans_Rotate(-10,1,0,0)),def);
return _inherited(def, ...);
}
/*-- Properties --*/

View File

@ -0,0 +1,4 @@
[DefCore]
id=Library_RangedWeapon
Version=8,0
Category=C4D_StaticBack

View File

@ -0,0 +1,50 @@
/**
Library_RangedWeapon
Adds functionality to overload weapon speed
@author: Sven2
*/
local animation_set;
local speed_multiplier = 100;
// To be overloaded by weapon
local DefaultLoadTime = nil;
local DefaultLoadTime2 = nil;
local DefaultShootTime = nil;
local DefaultShootTime2 = nil;
public func Initialize(...)
{
// Set initial animation speeds
if (!animation_set) animation_set = {};
SetSpeedMultiplier(speed_multiplier);
return _inherited(...);
}
public func SetSpeedMultiplier(int new_multiplier)
{
// Updates the weapon speed
if (GetType(DefaultLoadTime2)) animation_set.LoadTime2 = Max(1, DefaultLoadTime2 * 100 / new_multiplier);
if (GetType(DefaultLoadTime)) animation_set.LoadTime = Max(1+animation_set.LoadTime2, DefaultLoadTime * 100 / new_multiplier);
if (GetType(DefaultShootTime2)) animation_set.ShootTime2 = Max(1, DefaultShootTime2 * 100 / new_multiplier);
if (GetType(DefaultShootTime)) animation_set.ShootTime = Max(1+animation_set.ShootTime2, DefaultShootTime * 100 / new_multiplier);
// Remember setting
this.speed_multiplier = new_multiplier;
}
public func Definition(def, ...)
{
// Editor + Scenario saving
_inherited(def, ...);
if (!def.EditorProps) def.EditorProps = {};
def.EditorProps.speed_multiplier = {
Name = "$SpeedMult$",
EditorHelp = "$SpeedMultHelp$",
Set = "SetSpeedMultiplier",
Type = "int",
Min = 1,
Max = 20000,
Save = "SpeedMultiplier",
};
}

View File

@ -0,0 +1,2 @@
SpeedMult=Geschwindigkeit
SpeedMultHelp=Anpassung der Schuss- und Nachladegeschwindigkeit in Prozent des Standardwertes. Grosse Werte bedeuten schnelleres Schiessen und Nachladen.

View File

@ -0,0 +1,2 @@
SpeedMult=Speed
SpeedMultHelp=Adjustment of shoot and reload speed in percent of the default value. Large values mean faster shooting and reloading.