Skip to content

Commit

Permalink
The Honkgiver [Ready for Review] (#37136)
Browse files Browse the repository at this point in the history
* initial commit. alot more needs to be done

* some more progress.

* alot added. most big stuff is done. ammo and sounds need tweak

* a bunch of stuff added to converting Lawgivers towards Honkgivers

* magazines tweak

* lawgivers into honkgiver and vice-versa

* readds radstorm remote to dme

* Delete code/modules./projectiles/ammunition/magazines.dm

* removes changes to projectile.dm

* Update projectile.dm

* fixed linter warning and disappeared icons

* better warning fix

* changes misleading description on honkgiver mag

* custom suicides for most honkgiver shots

* some more tweaks and cleaning up

* Finishing touches, bugfixes, ready for review

* adds / to a proc to fix error

* Recharging Doomlazor & speedup on scream shot

* longer recharge and makeSkeleton on doomlazor

* fixed error

---------

Co-authored-by: realestestate <>
  • Loading branch information
RealestEstate authored Sep 25, 2024
1 parent 66d5e46 commit 00353a6
Show file tree
Hide file tree
Showing 18 changed files with 557 additions and 39 deletions.
92 changes: 81 additions & 11 deletions code/modules/projectiles/ammunition/magazines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -319,14 +319,14 @@
..()
var/list/new_ammo_counters = list()
for(var/datum/lawgiver_mode/mode in lawgiver_modes[compatible_gun_type])
new_ammo_counters[mode] = LAWGIVER_MAX_AMMO * mode.ammo_per_shot
new_ammo_counters[mode] = mode.ammo_per_shot
ammo_counters = new_ammo_counters
update_icon()

/obj/item/ammo_storage/magazine/lawgiver/proc/generate_description()
. = list("<span class='info'>")
for(var/datum/lawgiver_mode/mode in ammo_counters)
var/ammo_left = ammo_counters[mode] / mode.ammo_per_shot
var/ammo_left = ammo_counters[mode]
switch(mode.kind)
if(LAWGIVER_MODE_KIND_ENERGY)
. += "It has enough energy for [ammo_left] [mode.firing_mode] shot[ammo_left != 1 ? "s" : ""] left.\n"
Expand All @@ -341,16 +341,13 @@

/obj/item/ammo_storage/magazine/lawgiver/update_icon()
overlays.len = 0
// We only have 5 overlays but potentially more
// than 5 ammo types. Ammo types after the 5th don't
// get an overlay.
var/static/list/available_overlays = list(
var/static/list/available_overlays = list( //five ammo types get overlays
"stun", "laser", "rapid", "flare", "ricochet",
)
for(var/i in 1 to min(available_overlays.len, ammo_counters.len))
var/datum/lawgiver_mode/mode = ammo_counters[i]
var/ammo_left = ammo_counters[mode] / mode.ammo_per_shot
overlays += image('icons/obj/ammo.dmi', src, "[initial(icon_state)]-[available_overlays[i]]-[ammo_left]")
var/ammo_left = ceil(5-((mode.ammo_per_shot-ammo_counters[mode])/(mode.ammo_per_shot/5))) //takes the number of shots left compared to the max and makes it a ratio of five since there are 5 states for each overlay.
overlays += image('icons/obj/ammo.dmi', src, "lawgiver-[available_overlays[i]]-[ammo_left]")

/obj/item/ammo_storage/magazine/lawgiver/proc/isEmpty()
for(var/datum/lawgiver_mode/mode in ammo_counters)
Expand All @@ -360,7 +357,7 @@

/obj/item/ammo_storage/magazine/lawgiver/proc/isFull()
for(var/datum/lawgiver_mode/mode in ammo_counters)
if(ammo_counters[mode] != LAWGIVER_MAX_AMMO * mode.ammo_per_shot)
if(ammo_counters[mode] != mode.ammo_per_shot)
return FALSE
return TRUE

Expand All @@ -374,18 +371,91 @@

var/charged_amount = 0
for(var/datum/lawgiver_mode/mode in ammo_counters)
if(ammo_counters[mode] == LAWGIVER_MAX_AMMO * mode.ammo_per_shot)
if(ammo_counters[mode] == mode.ammo_per_shot)
continue
charged_amount += mode.ammo_per_shot * charger.charging_speed_modifier
ammo_counters[mode] = min(ammo_counters[mode] + charged_amount, LAWGIVER_MAX_AMMO * mode.ammo_per_shot)
ammo_counters[mode] = min(ammo_counters[mode] + charged_amount, mode.ammo_per_shot)

charger.try_use_power(100 * charger.charging_speed_modifier + 100 * charger.charging_speed_modifier * charger.efficiency_modifier)
charger.update_icon()

/obj/item/ammo_storage/magazine/lawgiver/attackby(var/atom/A, var/mob/user)
if(istype(A,/obj/item/toy/crayon/rainbow)&& !istype(src,/obj/item/ammo_storage/magazine/lawgiver/honkgiver))
var/obj/item/ammo_storage/magazine/lawgiver/honkgiver/HGM = new /obj/item/ammo_storage/magazine/lawgiver/honkgiver(loc)
honkgiver_ammo_conversion(HGM)
HGM.original_type = type
transfer_fingerprints(src,HGM)
qdel(src)
else
..()

/obj/item/ammo_storage/magazine/lawgiver/proc/honkgiver_ammo_conversion(var/obj/item/ammo_storage/magazine/lawgiver/honkgiver/HGM)
var/i = 1
for(var/datum/lawgiver_mode/mode in HGM.ammo_counters)
if(i<=ammo_counters.len)
var/datum/lawgiver_mode/modeOther = ammo_counters[i]
HGM.ammo_counters[mode] = floor(ammo_counters[modeOther] * mode.ammo_per_shot/modeOther.ammo_per_shot)
i++
return


/obj/item/ammo_storage/magazine/lawgiver/demolition
desc = "State-of-the-art bluespace technology allows this magazine to generate new rounds from energy, requiring only a power source to refill the full suite of ammunition types. This model is outfitted with high-explosive rounds."
compatible_gun_type = /obj/item/weapon/gun/lawgiver/demolition

/obj/item/ammo_storage/magazine/lawgiver/honkgiver
desc = "State-of-the-HONK clownspace technology allows this magazine to generate honkmunitions by converting recharger power. The DOOMLAZOR module recharges slowly on its own. Just don't let security catch you."
compatible_gun_type = /obj/item/weapon/gun/lawgiver/honkgiver
icon_state = "honkgiver"
var/obj/item/ammo_storage/magazine/lawgiver/original_type = null //stores original type for deconversion
var/charge_tick = 0 //for automatically recharging the doomlazor
var/doomlazorposition = 0 //stores position of doomlazor for recharging

/obj/item/ammo_storage/magazine/lawgiver/honkgiver/New()
..()
processing_objects.Add(src)
var/i=1
for(var/datum/lawgiver_mode/mode in ammo_counters)
if(istype(mode,/datum/lawgiver_mode/doomlazor))
doomlazorposition = i
break
i++

/obj/item/ammo_storage/magazine/lawgiver/honkgiver/decontaminate()
..()
if(original_type)
var/obj/item/ammo_storage/magazine/lawgiver/LGM = new original_type(loc)
honkgiver_ammo_conversion(LGM)
transfer_fingerprints(src,LGM)
qdel(src)
else
visible_message("<span class='notice'>\The [src] resists your efforts to declownify it! It must truly be a timeless relic of clownliness...</span>")

/obj/item/ammo_storage/magazine/lawgiver/honkgiver/process() //recharges the doomlazor when at zero
if(doomlazorposition && (ammo_counters[ammo_counters[doomlazorposition]] == 0))
charge_tick++
if(charge_tick < 8)
return 0
ammo_counters[ammo_counters[doomlazorposition]] ++
charge_tick=0
return 1
return 0

/obj/item/ammo_storage/magazine/lawgiver/honkgiver/Destroy()
processing_objects.Remove(src)
..()

/obj/item/ammo_storage/magazine/lawgiver/honkgiver/ultimate

/obj/item/ammo_storage/magazine/lawgiver/honkgiver/ultimate/New()
..()
for(var/datum/lawgiver_mode/mode in ammo_counters)
ammo_counters[mode] = 9999999
update_icon()

/obj/item/ammo_storage/magazine/lawgiver/honkgiver/ultimate/process()
return 0

/obj/item/ammo_storage/magazine/invisible
desc = "Reading how many shots you had left just got a lot more difficult."
ammo_type = "/obj/item/ammo_casing/invisible"
Expand Down
4 changes: 3 additions & 1 deletion code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,9 @@
playsound(user, in_chamber.fire_sound, fire_volume, 1)
in_chamber.firer = M
in_chamber.on_hit(M)
if (!in_chamber.nodamage)
if(in_chamber.has_special_suicide)
in_chamber.custom_mouthshot(user)
else if (!in_chamber.nodamage)
user.apply_damage(in_chamber.damage*2.5, in_chamber.damage_type, LIMB_HEAD, used_weapon = "Point blank shot in the mouth with \a [in_chamber]")
user.death()
var/suicidesound = pick('sound/misc/suicide/suicide1.ogg','sound/misc/suicide/suicide2.ogg','sound/misc/suicide/suicide3.ogg','sound/misc/suicide/suicide4.ogg','sound/misc/suicide/suicide5.ogg','sound/misc/suicide/suicide6.ogg')
Expand Down
Loading

0 comments on commit 00353a6

Please sign in to comment.