mirror of
https://github.com/JezuzLizard/BO2-Reimagined.git
synced 2025-06-07 21:59:49 -05:00
Optimize wallbuy spawn code
_zm_reimagined::add_wallbuy uses new wallbuy code Works correctly with Claymores Works correctly with melee weapon hint icons
This commit is contained in:
parent
ed026cc530
commit
8b5e47bcf2
@ -156,7 +156,7 @@ builddynamicwallbuy( location, weaponname )
|
||||
model hide();
|
||||
|
||||
chalk_fx = weaponname + "_fx";
|
||||
thread scripts/zm/_zm_reimagined::playchalkfx( chalk_fx, origin, wallbuy.angles );
|
||||
thread scripts/zm/replaced/utility::playchalkfx( chalk_fx, origin, wallbuy.angles );
|
||||
}
|
||||
|
||||
maps/mp/zombies/_zm_weapons::add_dynamic_wallbuy( weaponname, wallbuy.targetname, 1 );
|
||||
|
@ -2044,116 +2044,7 @@ add_wallbuy( name )
|
||||
return;
|
||||
}
|
||||
|
||||
target_struct = getstruct( struct.target, "targetname" );
|
||||
unitrigger_stub = spawnstruct();
|
||||
unitrigger_stub.origin = struct.origin;
|
||||
unitrigger_stub.angles = struct.angles;
|
||||
|
||||
tempmodel = spawn( "script_model", ( 0, 0, 0 ) );
|
||||
tempmodel setmodel( target_struct.model );
|
||||
tempmodel useweaponhidetags( struct.zombie_weapon_upgrade );
|
||||
mins = tempmodel getmins();
|
||||
maxs = tempmodel getmaxs();
|
||||
absmins = tempmodel getabsmins();
|
||||
absmaxs = tempmodel getabsmaxs();
|
||||
bounds = absmaxs - absmins;
|
||||
tempmodel delete();
|
||||
unitrigger_stub.script_length = 64;
|
||||
unitrigger_stub.script_width = bounds[1];
|
||||
unitrigger_stub.script_height = bounds[2];
|
||||
|
||||
unitrigger_stub.origin -= anglesToRight( unitrigger_stub.angles ) * ( ( bounds[0] * 0.25 ) * 0.4 );
|
||||
unitrigger_stub.target = struct.target;
|
||||
unitrigger_stub.targetname = struct.targetname;
|
||||
unitrigger_stub.cursor_hint = "HINT_NOICON";
|
||||
if ( struct.targetname == "weapon_upgrade" )
|
||||
{
|
||||
unitrigger_stub.cost = maps/mp/zombies/_zm_weapons::get_weapon_cost( struct.zombie_weapon_upgrade );
|
||||
if ( isDefined( level.monolingustic_prompt_format ) && !level.monolingustic_prompt_format )
|
||||
{
|
||||
unitrigger_stub.hint_string = maps/mp/zombies/_zm_weapons::get_weapon_hint( struct.zombie_weapon_upgrade );
|
||||
unitrigger_stub.hint_parm1 = unitrigger_stub.cost;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
unitrigger_stub.hint_parm1 = maps/mp/zombies/_zm_weapons::get_weapon_display_name( struct.zombie_weapon_upgrade );
|
||||
if ( isDefined( unitrigger_stub.hint_parm1 ) || unitrigger_stub.hint_parm1 == "" && unitrigger_stub.hint_parm1 == "none" )
|
||||
{
|
||||
unitrigger_stub.hint_parm1 = "missing weapon name " + struct.zombie_weapon_upgrade;
|
||||
}
|
||||
unitrigger_stub.hint_parm2 = unitrigger_stub.cost;
|
||||
unitrigger_stub.hint_string = &"ZOMBIE_WEAPONCOSTONLY";
|
||||
}
|
||||
}
|
||||
unitrigger_stub.weapon_upgrade = struct.zombie_weapon_upgrade;
|
||||
unitrigger_stub.script_unitrigger_type = "unitrigger_box_use";
|
||||
unitrigger_stub.require_look_at = 1;
|
||||
if ( isDefined( struct.require_look_from ) && struct.require_look_from )
|
||||
{
|
||||
unitrigger_stub.require_look_from = 1;
|
||||
}
|
||||
unitrigger_stub.zombie_weapon_upgrade = struct.zombie_weapon_upgrade;
|
||||
|
||||
model = spawn_weapon_model( struct.zombie_weapon_upgrade, undefined, target_struct.origin, target_struct.angles );
|
||||
model.targetname = struct.target;
|
||||
model setmodel( target_struct.model );
|
||||
model useweaponhidetags( struct.zombie_weapon_upgrade );
|
||||
model hide();
|
||||
|
||||
maps/mp/zombies/_zm_unitrigger::unitrigger_force_per_player_triggers( unitrigger_stub, 1 );
|
||||
if ( unitrigger_stub.zombie_weapon_upgrade == "bowie_knife_zm" )
|
||||
{
|
||||
unitrigger_stub.cost = 3000;
|
||||
unitrigger_stub.weapon_name = "bowie_knife_zm";
|
||||
unitrigger_stub.vo_dialog_id = "bowie";
|
||||
unitrigger_stub.flourish_weapon_name = "zombie_bowie_flourish";
|
||||
unitrigger_stub.ballistic_weapon_name = "knife_ballistic_bowie_zm";
|
||||
unitrigger_stub.ballistic_upgraded_weapon_name = "knife_ballistic_bowie_upgraded_zm";
|
||||
unitrigger_stub.prompt_and_visibility_func = ::bowie_knife_update_prompt;
|
||||
maps/mp/zombies/_zm_unitrigger::register_static_unitrigger( unitrigger_stub, maps/mp/zombies/_zm_melee_weapon::melee_weapon_think );
|
||||
|
||||
}
|
||||
else if ( unitrigger_stub.zombie_weapon_upgrade == "claymore_zm" )
|
||||
{
|
||||
model.script_int = -90; // fix for model sliding right to left
|
||||
unitrigger_stub.prompt_and_visibility_func = maps/mp/zombies/_zm_weap_claymore::claymore_unitrigger_update_prompt;
|
||||
maps/mp/zombies/_zm_unitrigger::register_static_unitrigger( unitrigger_stub, maps/mp/zombies/_zm_weap_claymore::buy_claymores );
|
||||
}
|
||||
else
|
||||
{
|
||||
unitrigger_stub.prompt_and_visibility_func = maps/mp/zombies/_zm_weapons::wall_weapon_update_prompt;
|
||||
maps/mp/zombies/_zm_unitrigger::register_static_unitrigger( unitrigger_stub, maps/mp/zombies/_zm_weapons::weapon_spawn_think );
|
||||
}
|
||||
struct.trigger_stub = unitrigger_stub;
|
||||
|
||||
chalk_fx = name + "_fx";
|
||||
thread playchalkfx( chalk_fx, struct.origin, struct.angles );
|
||||
}
|
||||
|
||||
playchalkfx( effect, origin, angles )
|
||||
{
|
||||
while ( 1 )
|
||||
{
|
||||
fx = SpawnFX( level._effect[ effect ], origin, AnglesToForward( angles ), AnglesToUp( angles ) );
|
||||
TriggerFX( fx );
|
||||
level waittill( "connected", player );
|
||||
fx Delete();
|
||||
}
|
||||
}
|
||||
|
||||
bowie_knife_update_prompt(player)
|
||||
{
|
||||
if(player get_player_melee_weapon() == self.stub.weapon_name)
|
||||
{
|
||||
self sethintstring("");
|
||||
self setcursorhint("HINT_NOICON");
|
||||
return 0;
|
||||
}
|
||||
|
||||
self sethintstring(&"ZOMBIE_WEAPON_BOWIE_BUY", self.stub.cost);
|
||||
self setcursorhint("HINT_WEAPON", self.stub.weapon_name);
|
||||
return 1;
|
||||
scripts/zm/replaced/utility::wallbuy( name, struct.target, struct.targetname, struct.origin, struct.angles );
|
||||
}
|
||||
|
||||
wallbuy_cost_changes()
|
||||
|
@ -172,30 +172,38 @@ register_map_initial_spawnpoint( origin, angles, team_num )
|
||||
wallbuy( weapon_name, target, targetname, origin, angles )
|
||||
{
|
||||
precachemodel( getweaponmodel( weapon_name ) );
|
||||
|
||||
unitrigger_stub = spawnstruct();
|
||||
unitrigger_stub.origin = origin;
|
||||
unitrigger_stub.angles = angles;
|
||||
// move model foreward so it always shows in front of chalk
|
||||
wallmodel = spawn_weapon_model( weapon_name, undefined, origin + anglesToRight(angles) * -0.4, angles );
|
||||
|
||||
model_name = undefined;
|
||||
if ( weapon_name == "claymore_zm" )
|
||||
{
|
||||
model_name = "t6_wpn_claymore_world"; // getWeaponModel for claymore is wrong model
|
||||
}
|
||||
|
||||
wallmodel = spawn_weapon_model( weapon_name, model_name, origin, angles );
|
||||
wallmodel.targetname = target;
|
||||
mins = undefined;
|
||||
maxs = undefined;
|
||||
absmins = undefined;
|
||||
absmaxs = undefined;
|
||||
wallmodel setmodel( getweaponmodel( weapon_name ) );
|
||||
wallmodel useweaponhidetags( weapon_name );
|
||||
mins = wallmodel getmins();
|
||||
maxs = wallmodel getmaxs();
|
||||
wallmodel hide();
|
||||
|
||||
absmins = wallmodel getabsmins();
|
||||
absmaxs = wallmodel getabsmaxs();
|
||||
bounds = absmaxs - absmins;
|
||||
unitrigger_stub.script_length = bounds[ 0 ] * 0.25;
|
||||
|
||||
unitrigger_stub.script_length = 64;
|
||||
unitrigger_stub.script_width = bounds[ 1 ];
|
||||
unitrigger_stub.script_height = bounds[ 2 ];
|
||||
unitrigger_stub.origin -= anglesToRight( unitrigger_stub.angles ) * ( unitrigger_stub.script_length * 0.4 );
|
||||
unitrigger_stub.target = target;
|
||||
unitrigger_stub.targetname = targetname;
|
||||
unitrigger_stub.cursor_hint = "HINT_NOICON";
|
||||
|
||||
// move model foreward so it always shows in front of chalk
|
||||
move_amount = anglesToRight( wallmodel.angles ) * -0.3;
|
||||
wallmodel.origin += move_amount;
|
||||
unitrigger_stub.origin += move_amount;
|
||||
|
||||
if ( unitrigger_stub.targetname == "weapon_upgrade" )
|
||||
{
|
||||
unitrigger_stub.cost = get_weapon_cost( weapon_name );
|
||||
@ -215,12 +223,14 @@ wallbuy( weapon_name, target, targetname, origin, angles )
|
||||
unitrigger_stub.hint_string = &"ZOMBIE_WEAPONCOSTONLY";
|
||||
}
|
||||
}
|
||||
|
||||
unitrigger_stub.weapon_upgrade = weapon_name;
|
||||
unitrigger_stub.script_unitrigger_type = "unitrigger_box_use";
|
||||
unitrigger_stub.require_look_at = 1;
|
||||
unitrigger_stub.require_look_from = 0;
|
||||
unitrigger_stub.zombie_weapon_upgrade = weapon_name;
|
||||
maps/mp/zombies/_zm_unitrigger::unitrigger_force_per_player_triggers( unitrigger_stub, 1 );
|
||||
|
||||
if ( is_melee_weapon( weapon_name ) )
|
||||
{
|
||||
melee_weapon = undefined;
|
||||
@ -242,6 +252,17 @@ wallbuy( weapon_name, target, targetname, origin, angles )
|
||||
unitrigger_stub.ballistic_upgraded_weapon_name = melee_weapon.ballistic_upgraded_weapon_name;
|
||||
unitrigger_stub.vo_dialog_id = melee_weapon.vo_dialog_id;
|
||||
unitrigger_stub.flourish_fn = melee_weapon.flourish_fn;
|
||||
|
||||
if(is_true(level.disable_melee_wallbuy_icons))
|
||||
{
|
||||
unitrigger_stub.cursor_hint = "HINT_NOICON";
|
||||
unitrigger_stub.cursor_hint_weapon = undefined;
|
||||
}
|
||||
else
|
||||
{
|
||||
unitrigger_stub.cursor_hint = "HINT_WEAPON";
|
||||
unitrigger_stub.cursor_hint_weapon = melee_weapon.weapon_name;
|
||||
}
|
||||
}
|
||||
|
||||
if(weapon_name == "tazer_knuckles_zm")
|
||||
@ -256,6 +277,9 @@ wallbuy( weapon_name, target, targetname, origin, angles )
|
||||
}
|
||||
else if ( weapon_name == "claymore_zm" )
|
||||
{
|
||||
wallmodel.angles += (0, 90, 0);
|
||||
wallmodel.script_int = 90; // fix for model sliding right to left
|
||||
|
||||
unitrigger_stub.prompt_and_visibility_func = ::claymore_unitrigger_update_prompt;
|
||||
maps/mp/zombies/_zm_unitrigger::register_static_unitrigger( unitrigger_stub, ::buy_claymores );
|
||||
}
|
||||
@ -264,7 +288,7 @@ wallbuy( weapon_name, target, targetname, origin, angles )
|
||||
unitrigger_stub.prompt_and_visibility_func = ::wall_weapon_update_prompt;
|
||||
maps/mp/zombies/_zm_unitrigger::register_static_unitrigger( unitrigger_stub, ::weapon_spawn_think );
|
||||
}
|
||||
wallmodel hide();
|
||||
|
||||
chalk_fx = weapon_name + "_fx";
|
||||
level thread playchalkfx( chalk_fx, origin, angles );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user