mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-10 23:54:14 +01:00
21b4095dfd
Upstream 04/17/2026 fixes https://github.com/Bubberstation/Bubberstation/issues/5549 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com> Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com> Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Co-authored-by: Rhials <28870487+Rhials@users.noreply.github.com> Co-authored-by: rageguy505 <54517726+rageguy505@users.noreply.github.com> Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Co-authored-by: Aliceee2ch <160794176+Aliceee2ch@users.noreply.github.com> Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com> Co-authored-by: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com> Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Co-authored-by: Maxipat <108554989+Maxipat112@users.noreply.github.com> Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com> Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com> Co-authored-by: loganuk <fakeemail123@aol.com> Co-authored-by: Leland Kemble <70413276+lelandkemble@users.noreply.github.com> Co-authored-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com> Co-authored-by: Roxy <75404941+TealSeer@users.noreply.github.com> Co-authored-by: Lucy <lucy@absolucy.moe> Co-authored-by: siliconOpossum <138069572+siliconOpossum@users.noreply.github.com> Co-authored-by: Isratosh <Isratosh@hotmail.com> Co-authored-by: TheRyeGuyWhoWillNowDie <70169560+TheRyeGuyWhoWillNowDie@users.noreply.github.com> Co-authored-by: Neocloudy <88008002+Neocloudy@users.noreply.github.com> Co-authored-by: Alexander V. <volas@ya.ru> Co-authored-by: ElGitificador <168473461+ElGitificador@users.noreply.github.com> Co-authored-by: Twaticus <46540570+Twaticus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> Co-authored-by: Cameron Lennox <killer65311@gmail.com> Co-authored-by: Tim <timothymtorres@gmail.com> Co-authored-by: Iamgoofball <iamgoofball@gmail.com> Co-authored-by: Layzu666 <121319428+Layzu666@users.noreply.github.com> Co-authored-by: Arturlang <24881678+Arturlang@users.noreply.github.com> Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com> Co-authored-by: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com> Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com> Co-authored-by: John F. Kennedy <54908920+MacaroniCritter@users.noreply.github.com> Co-authored-by: Cursor <102828457+theselfish@users.noreply.github.com> Co-authored-by: Josh <josh.adam.powell@gmail.com> Co-authored-by: Josh Powell <josh.powell@softwire.com> Co-authored-by: Yobrocharlie <Charliemiller5617@gmail.com> Co-authored-by: Hardly3D <66234359+Hardly3D@users.noreply.github.com> Co-authored-by: shayoki <96078776+shayoki@users.noreply.github.com> Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
178 lines
5.7 KiB
Plaintext
178 lines
5.7 KiB
Plaintext
/obj/item/gun/magic
|
|
name = "staff of nothing"
|
|
desc = "This staff is boring to watch because even though it came first you've seen everything it can do in other staves for years."
|
|
icon = 'icons/obj/weapons/guns/magic.dmi'
|
|
icon_state = "staffofnothing"
|
|
inhand_icon_state = "staff"
|
|
lefthand_file = 'icons/mob/inhands/weapons/staves_lefthand.dmi' //not really a gun and some toys use these inhands
|
|
righthand_file = 'icons/mob/inhands/weapons/staves_righthand.dmi'
|
|
fire_sound = 'sound/items/weapons/emitter.ogg'
|
|
obj_flags = CONDUCTS_ELECTRICITY
|
|
w_class = WEIGHT_CLASS_HUGE
|
|
can_muzzle_flash = FALSE
|
|
clumsy_check = FALSE
|
|
trigger_guard = TRIGGER_GUARD_ALLOW_ALL // Has no trigger at all, uses magic instead
|
|
pin = /obj/item/firing_pin/magic
|
|
about_to_shoot_inside_mail_text = "It's humming with energy!"
|
|
/// If true, our fire sound gets lower as our charges decrease
|
|
var/pitch_with_charges = TRUE
|
|
/// What kind of magic is this
|
|
var/school = SCHOOL_EVOCATION
|
|
/// What kind of antimagic resists this
|
|
var/antimagic_flags = MAGIC_RESISTANCE
|
|
/// How many charges can we hold at most
|
|
var/max_charges = 6
|
|
/// How many charges do we currently have
|
|
var/charges = 0
|
|
/// How fast do we recharge charges? In seconds
|
|
var/recharge_rate = 8
|
|
/// How much have we currently recharged?
|
|
var/charge_timer = 0
|
|
/// Whether this wand/staff recharges on its own over time.
|
|
var/self_charging = TRUE
|
|
/// What kind of projectile do we fire?
|
|
var/ammo_type
|
|
/// If set to TRUE, wizards can't use this until they leave home
|
|
var/no_den_usage = FALSE
|
|
|
|
/obj/item/gun/magic/Initialize(mapload)
|
|
. = ..()
|
|
RegisterSignal(src, COMSIG_ITEM_MAGICALLY_CHARGED, PROC_REF(on_magic_charge))
|
|
|
|
/obj/item/gun/magic/apply_fantasy_bonuses(bonus)
|
|
. = ..()
|
|
recharge_rate = modify_fantasy_variable("recharge_rate", recharge_rate, -bonus, minimum = 1)
|
|
max_charges = modify_fantasy_variable("max_charges", max_charges, bonus)
|
|
charges = modify_fantasy_variable("charges", charges, bonus)
|
|
|
|
/obj/item/gun/magic/remove_fantasy_bonuses(bonus)
|
|
recharge_rate = reset_fantasy_variable("recharge_rate", recharge_rate)
|
|
max_charges = reset_fantasy_variable("max_charges", max_charges)
|
|
charges = reset_fantasy_variable("charges", charges)
|
|
return ..()
|
|
|
|
/obj/item/gun/magic/fire_sounds()
|
|
var/pitch_to_use = 1
|
|
|
|
if (pitch_with_charges && max_charges > 1)
|
|
pitch_to_use = LERP(1, 0.4, (1 - (charges/max_charges)) ** 2)
|
|
|
|
var/sound/playing_sound = sound(suppressed ? suppressed_sound : fire_sound)
|
|
playing_sound.pitch = pitch_to_use
|
|
|
|
if(suppressed)
|
|
playsound(src, playing_sound, suppressed_volume, vary_fire_sound, ignore_walls = FALSE, extrarange = SILENCED_SOUND_EXTRARANGE, falloff_distance = 0)
|
|
else
|
|
playsound(src, playing_sound, fire_sound_volume, vary_fire_sound)
|
|
|
|
/**
|
|
* Signal proc for [COMSIG_ITEM_MAGICALLY_CHARGED]
|
|
*
|
|
* Adds uses to wands or staffs.
|
|
*/
|
|
/obj/item/gun/magic/proc/on_magic_charge(datum/source, datum/action/cooldown/spell/charge/spell, mob/living/caster)
|
|
SIGNAL_HANDLER
|
|
|
|
. = COMPONENT_ITEM_CHARGED
|
|
|
|
// Non-self charging staves and wands can potentially expire
|
|
if(!self_charging && max_charges && prob(80))
|
|
max_charges--
|
|
|
|
if(max_charges <= 0)
|
|
max_charges = 0
|
|
. |= COMPONENT_ITEM_BURNT_OUT
|
|
|
|
charges = max_charges
|
|
update_appearance(UPDATE_ICON_STATE)
|
|
recharge_newshot()
|
|
|
|
return .
|
|
|
|
/obj/item/gun/magic/process_fire(atom/target, mob/living/user, message, params, zone_override, bonus_spread)
|
|
if(no_den_usage)
|
|
var/area/A = get_area(user)
|
|
if(istype(A, /area/centcom/wizard_station))
|
|
add_fingerprint(user)
|
|
to_chat(user, span_warning("You know better than to violate the security of The Den, best wait until you leave to use [src]."))
|
|
return
|
|
else
|
|
no_den_usage = FALSE // Well you're probably not going back
|
|
if(!user.can_cast_magic(antimagic_flags))
|
|
add_fingerprint(user)
|
|
return
|
|
return ..()
|
|
|
|
/obj/item/gun/magic/can_shoot()
|
|
return charges
|
|
|
|
/obj/item/gun/magic/recharge_newshot()
|
|
if (!charges || !chambered || chambered.loaded_projectile)
|
|
return
|
|
chambered.newshot()
|
|
return ..()
|
|
|
|
/obj/item/gun/magic/handle_chamber()
|
|
if(chambered && !chambered.loaded_projectile) //if BB is null, i.e the shot has been fired...
|
|
charges--//... drain a charge
|
|
recharge_newshot()
|
|
|
|
/obj/item/gun/magic/Initialize(mapload)
|
|
. = ..()
|
|
charges = max_charges
|
|
if(ammo_type)
|
|
chambered = new ammo_type(src)
|
|
if(self_charging)
|
|
START_PROCESSING(SSobj, src)
|
|
RegisterSignal(src, COMSIG_ITEM_RECHARGED, PROC_REF(instant_recharge))
|
|
|
|
/obj/item/gun/magic/Destroy()
|
|
if(self_charging)
|
|
STOP_PROCESSING(SSobj, src)
|
|
return ..()
|
|
|
|
/obj/item/gun/magic/process(seconds_per_tick)
|
|
if (charges >= max_charges)
|
|
charge_timer = 0
|
|
return
|
|
charge_timer += seconds_per_tick
|
|
if(charge_timer < recharge_rate)
|
|
return 0
|
|
charge_timer = 0
|
|
charges++
|
|
if(charges == 1)
|
|
recharge_newshot()
|
|
return 1
|
|
|
|
/obj/item/gun/magic/shoot_with_empty_chamber(mob/living/user as mob|obj)
|
|
to_chat(user, span_warning("\The [src] whizzles quietly."))
|
|
|
|
/obj/item/gun/magic/suicide_act(mob/living/user)
|
|
user.visible_message(span_suicide("[user] is twisting [src] above [user.p_their()] head, releasing a magical blast! It looks like [user.p_theyre()] trying to commit suicide!"))
|
|
if (can_user_shoot(user))
|
|
charges--
|
|
return do_suicide(user)
|
|
user.visible_message(span_suicide("...but nothing happens."))
|
|
return SHAME
|
|
|
|
/// Extend to do something funny
|
|
/obj/item/gun/magic/proc/do_suicide(mob/living/user)
|
|
playsound(loc, fire_sound, 50, TRUE, -1)
|
|
return FIRELOSS
|
|
|
|
/// Returns true if specified mob can fire this weapon
|
|
/obj/item/gun/magic/proc/can_user_shoot(mob/living/user)
|
|
return can_shoot() && user.can_cast_magic(antimagic_flags)
|
|
|
|
/obj/item/gun/magic/vv_edit_var(var_name, var_value)
|
|
. = ..()
|
|
switch(var_name)
|
|
if(NAMEOF(src, charges))
|
|
recharge_newshot()
|
|
|
|
/obj/item/gun/magic/proc/instant_recharge()
|
|
SIGNAL_HANDLER
|
|
charges = max_charges
|
|
recharge_newshot()
|
|
update_appearance()
|