Skip to content

Commit

Permalink
Base snowball
Browse files Browse the repository at this point in the history
Ajout annimation snowball

Ajout annimation snowball

modification weapons.meta

modification weapons.meta

modification damage

modification des damage
  • Loading branch information
Thomysr authored and Kedrihan committed Oct 12, 2023
1 parent d8db879 commit 5493def
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 1 deletion.
33 changes: 32 additions & 1 deletion resources/[soz]/soz-core/src/client/weapon/weapon.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { Control } from '@public/shared/input';
import { Vector3 } from '@public/shared/polyzone/vector';
import { getRandomItem } from '@public/shared/random';

import { ClientEvent, GameEvent, ServerEvent } from '../../shared/event';
import { InventoryItem } from '../../shared/item';
import { RpcServerEvent } from '../../shared/rpc';
import { ExplosionMessage, GlobalWeaponConfig, GunShotMessage, WeaponName } from '../../shared/weapons/weapon';
Expand All @@ -20,6 +19,7 @@ import { VoipRadioProvider } from '../voip/voip.radio.provider';
import { WeaponDrawingProvider } from './weapon.drawing.provider';
import { WeaponHolsterProvider } from './weapon.holster.provider';
import { WeaponService } from './weapon.service';
import { ClientEvent, GameEvent, ServerEvent } from '@public/shared/event';

const messageExcludeGroups = [
GetHashKey('GROUP_FIREEXTINGUISHER'),
Expand Down Expand Up @@ -165,6 +165,37 @@ export class WeaponProvider {
}
}

@OnEvent(ClientEvent.WEAPON_PICK_SNOWBALL)
public async onSnowPickup() {
const playerPedId = PlayerPedId();
const playerId = PlayerId();
if (
IsPedInAnyVehicle(playerPedId, true) ||
IsPlayerFreeAiming(playerId) ||
IsPedSwimming(playerPedId) ||
IsPedSwimmingUnderWater(playerPedId) ||
IsPedRagdoll(playerPedId) ||
IsPedFalling(playerPedId) ||
IsPedRunning(playerPedId) ||
IsPedSprinting(playerPedId) ||
GetInteriorFromEntity(playerPedId) ||
IsPedShooting(playerPedId) ||
IsPedUsingAnyScenario(playerPedId) ||
IsPedInCover(playerPedId, false)
) {
return;
}

const { completed } = await this.progressService.progress('snow', 'Ramassage de neige...', 2000, {
dictionary: 'anim@mp_snowball',
name: 'pickup_snowball',
});

if (completed) {
TriggerServerEvent(ServerEvent.GET_SNOW);
}
}

@Tick(TickInterval.EVERY_FRAME)
async onTick() {
const player = PlayerPedId();
Expand Down
7 changes: 7 additions & 0 deletions resources/[soz]/soz-core/src/config/animation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11076,6 +11076,13 @@ export const Animations: AnimationConfigList = [
},
],
},
{
type: 'event',
name: 'Ramasser une boule de neige',
rightLabel: null,
icon: '❄️',
event: 'soz-core:client:weapon:pick-snowball',
},
{
type: 'animation',
name: 'Départ de course',
Expand Down
17 changes: 17 additions & 0 deletions resources/[soz]/soz-core/src/server/weapon/weapon.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,23 @@ export class WeaponProvider {
return this.inventoryManager.getSlot(source, weaponSlot);
}

@OnEvent(ServerEvent.GET_SNOW)
public snow(source: number) {
const weapon = this.inventoryManager.getFirstItemInventory(source, 'weapon_snowball');
if (weapon) {
if (weapon.metadata.ammo >= 10) {
this.notifier.notify(source, 'Tu as trop de boules de neige sur toi !', 'error');
return;
}
this.inventoryManager.updateMetadata(source, weapon.slot, {
ammo: weapon.metadata.ammo + 1,
});
} else {
this.inventoryManager.addItemToInventory(source, 'weapon_snowball', 1, { ammo: 1 });
}
this.notifier.notify(source, 'Tu as ramassé une boule de neige');
}

@Once(OnceStep.Start)
public onStart() {
this.item.setItemUseCallback('ammo_01', this.useAmmo.bind(this));
Expand Down
3 changes: 3 additions & 0 deletions resources/[soz]/soz-core/src/shared/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ export enum ServerEvent {

AFK_KICK = 'soz-core:server:afk:kick',

GET_SNOW = 'soz-core:server:snowball',

// not core

BANKING_TRANSFER_MONEY = 'banking:server:TransferMoney',
Expand Down Expand Up @@ -505,6 +507,7 @@ export enum ClientEvent {
WEAPON_OPEN_GUNSMITH = 'soz-core:client:weapon:open-gunsmith',
WEAPON_EXPLOSION = 'soz-core:client:weapon:explosion',
WEAPON_CLEAR_WEAPON = 'soz-core:client:weapon:clear',
WEAPON_PICK_SNOWBALL = 'soz-core:client:weapon:pick-snowball',

MDR_USE_TICKET = 'soz-core:client:mdr:use-ticket',
HEIST_GUARD = 'soz-core:client:heist:guard',
Expand Down
68 changes: 68 additions & 0 deletions resources/[weapon]/soz-weapon-metaconfig/stream/weapons.meta
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,74 @@
<ThrownForce value="0.000000" />
<ThrownForceFromVehicle value="5.000000" />
</Item>

<Item type="CAmmoThrownInfo">
<Name>AMMO_SNOWBALL</Name>
<Model>w_ex_snowball</Model>
<Audio />
<Slot />
<AmmoMax value="10" />
<AmmoMax50 value="10" />
<AmmoMax100 value="10" />
<AmmoMaxMP value="10" />
<AmmoMax50MP value="10" />
<AmmoMax100MP value="10" />
<AmmoFlags>FixedAfterExplosion</AmmoFlags>
<Damage value="0.000000" />
<LifeTime value="10.000000" />
<FromVehicleLifeTime value="2.500000" />
<LifeTimeAfterImpact value="0.001000" />
<LifeTimeAfterExplosion value="0.000000" />
<ExplosionTime value="0.250000" />
<LaunchSpeed value="25.000000" />
<SeparationTime value="0.000000" />
<TimeToReachTarget value="0.000000" />
<Damping value="0.050000" />
<GravityFactor value="1.000000" />
<RicochetTolerance value="0.000000" />
<PedRicochetTolerance value="0.000000" />
<VehicleRicochetTolerance value="0.000000" />
<Explosion>
<Default>EXP_TAG_SNOWBALL</Default>
<HitCar>DONTCARE</HitCar>
<HitTruck>DONTCARE</HitTruck>
<HitBike>DONTCARE</HitBike>
<HitBoat>DONTCARE</HitBoat>
<HitPlane>DONTCARE</HitPlane>
</Explosion>
<FuseFx>proj_snowball_fuse</FuseFx>
<FuseFxFP />
<TrailFx>proj_snowball_trail</TrailFx>
<TrailFxUnderWater />
<TrailFxFadeInTime value="0.000000" />
<TrailFxFadeOutTime value="0.000000" />
<PrimedFx />
<DisturbFxDefault />
<DisturbFxSand />
<DisturbFxWater />
<DisturbFxDirt />
<DisturbFxFoliage />
<DisturbFxProbeDist value="0.000000" />
<DisturbFxScale value="0.000000" />
<LightOnlyActiveWhenStuck value="false" />
<LightFlickers value="false" />
<LightBone />
<LightColour x="0.000000" y="0.000000" z="0.000000" />
<LightIntensity value="0.000000" />
<LightRange value="0.000000" />
<LightFalloffExp value="0.000000" />
<LightFrequency value="0.000000" />
<LightPower value="0.000000" />
<CoronaSize value="0.000000" />
<CoronaIntensity value="0.000000" />
<CoronaZBias value="0.000000" />
<ProjectileFlags>DestroyOnImpact ProcessImpacts NoPullPin DoubleDamping ApplyDamageOnImpact DontFireAnyEvents</ProjectileFlags>
<ThrownForce value="0.000000" />
<ThrownForceFromVehicle value="5.000000" />
</Item>



<Item type="CAmmoThrownInfo">
<Name>AMMO_BALL</Name>
<Model>w_am_baseball</Model>
Expand Down

0 comments on commit 5493def

Please sign in to comment.