private void OnGhostBoo(EntityUid uid, PoweredLightComponent light, GhostBooEvent args) { if (light.IgnoreGhostsBoo) { return; } // check cooldown first to prevent abuse var time = _gameTiming.CurTime; if (light.LastGhostBlink != null) { if (time <= light.LastGhostBlink + light.GhostBlinkingCooldown) { return; } } light.LastGhostBlink = time; ToggleBlinkingLight(light, true); light.Owner.SpawnTimer(light.GhostBlinkingTime, () => { ToggleBlinkingLight(light, false); }); args.Handled = true; }
private void OnActionPerform(EntityUid uid, GhostComponent component, BooActionEvent args) { if (args.Handled) { return; } var ents = _lookup.GetEntitiesInRange(args.Performer, component.BooRadius); var booCounter = 0; foreach (var ent in ents) { var ghostBoo = new GhostBooEvent(); RaiseLocalEvent(ent, ghostBoo, true); if (ghostBoo.Handled) { booCounter++; } if (booCounter >= component.BooMaxTargets) { break; } } args.Handled = true; }
public void DoInstantAction(InstantActionEventArgs args) { if (!args.Performer.TryGetComponent <SharedActionsComponent>(out var actions)) { return; } // find all IGhostBooAffected nearby and do boo on them var ents = IoCManager.Resolve <IEntityLookup>().GetEntitiesInRange(args.Performer, _radius); var booCounter = 0; foreach (var ent in ents) { var ghostBoo = new GhostBooEvent(); ent.EntityManager.EventBus.RaiseLocalEvent(ent.Uid, ghostBoo); if (ghostBoo.Handled) { booCounter++; } if (booCounter >= _maxTargets) { break; } } actions.Cooldown(args.ActionType, Cooldowns.SecondsFromNow(_cooldown)); }