Skip to content

Commit

Permalink
Microfusion Energy Guns (#9638)
Browse files Browse the repository at this point in the history
* RELOADING!

* Update skillchip.dm

* a

* Update master.dm

* Update master.dm

* Part one

* E

* E

* EOR

* Oops

* EEEH

* Fixes.

* begone oldcode from old times

* fixes

* cell attatchments

* haha u cant spell

* Gun attachments!

* Fastest gun in the west

* Update multi_cell_charger.dm

* ESA

* Stability

* phase emitters

* foixes

* More fixes

* Update microfusion_gun_attachments.dm

* Update microfusion_gun_attachments.dm

* eee

* Intermediate interactions.

* Update microfusion_energy_master.dm

* wooh

* EEE

* Update microfusion_cell.dm

* Map edits

* Merge branch 'master' into gun_reloads

* E

* attachment removal

* Update _basemap.dm

* proper parent gun interactions

* Update code/game/machinery/recharger.dm

Co-authored-by: Tom <[email protected]>

* E

* Update modular_skyrat/modules/gunsgalore/code/guns/ballistic_master.dm

Co-authored-by: Tom <[email protected]>

* Update modular_skyrat/modules/microfusion/code/microfusion_cell.dm

Co-authored-by: Tom <[email protected]>

* Update modular_skyrat/modules/microfusion/code/microfusion_cell.dm

Co-authored-by: Tom <[email protected]>

* Review comments pt2

* review comments pt2

* review part 3

* review part 4

* review 4.1

* review fixes

* Update microfusion_designs.dm

* ffs

* Update code/__DEFINES/~skyrat_defines/traits.dm

Co-authored-by: GoldenAlpharex <[email protected]>

* Nearly there

* final review commit

* Update multi_cell_charger.dm

* Update microfusion_energy_master.dm

* E

* insight

* Fixes, rgb, remove instability on cells

* de epic

* Update _basemap.dm

* TGUI in the houise

* Update MicrofusionGunControl.js

* FULL STEAM AHEAD CHOO CHOO (Adds zooming)

* FUU bayonets and flights

* e

* Nearly

* microCHANGES

* Update gun.dm

* Minidate.

- Shooting the gun while it's overheating can cause it to [REDACTED].
- Shooting the gun while it's overheating will burn your hand!
- Some cells will now notify you when they're empty using an alarm sound.
- Gun barrel attachments now change the sound of the laser!
- An overheating emitter slows down!
- Emitters now control fire time more!

* 0

* owo

* FFF

* Update code/game/machinery/recharger.dm

Co-authored-by: GoldenAlpharex <[email protected]>

* Update modular_skyrat/modules/gunhud/code/gun_hud_component.dm

Co-authored-by: GoldenAlpharex <[email protected]>

* no spolsion

* Generally we want the cell in our hands

* 0

* Update microfusion_gun_attachments.dm

* E

* E

* FINAL

* superheater

* Update projectiles.dm

* Update microfusion_energy_master.dm

* Update projectiles.dm

* Update microfusion_gun40x32.dmi

* Update laser_1.ogg

* E

* whoop

* Cargo crates!

* Review plus material updates

* Update microfusion_designs.dm

* E

* E

* E

* E

* EEEE

* Update gun_spawns.dm

* Some fine tuining

* Update gun_spawns.dm

* Update recharger.dm

* E

* Update microfusion_gun_attachments.dm

* E

* E

* Update microfusion_gun_attachments.dmi

* Update code/game/machinery/recharger.dm

Co-authored-by: Tom <[email protected]>

* E

* You can now actually insert different cells into advanced guns!

* 0

* E

* Update microfusion_gun_attachments.dm

* Update microfusion_energy_master.dm

* Update modular_skyrat/modules/microfusion/code/microfusion_cell.dm

Co-authored-by: GoldenAlpharex <[email protected]>

* Update modular_skyrat/modules/microfusion/code/microfusion_cell.dm

Co-authored-by: GoldenAlpharex <[email protected]>

* E

* Update microfusion_energy_master.dm

* Update microfusion_gun_attachments.dm

Co-Authored-By: Tom <[email protected]>
Co-Authored-By: GoldenAlpharex <[email protected]>
  • Loading branch information
3 people committed Jan 15, 2024
1 parent 582cd05 commit c54b2b7
Show file tree
Hide file tree
Showing 43 changed files with 4,678 additions and 75 deletions.
29 changes: 28 additions & 1 deletion code/__DEFINES/inventory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,31 @@

//Allowed equipment lists for security vests.

GLOBAL_LIST_INIT(detective_vest_allowed, list(
GLOBAL_LIST_INIT(advanced_hardsuit_allowed, typecacheof(list(
/obj/item/ammo_box,
/obj/item/ammo_casing,
/obj/item/flashlight,
/obj/item/gun,
/obj/item/melee/baton,
/obj/item/reagent_containers/spray/pepper,
/obj/item/restraints/handcuffs,
/obj/item/tank/internals,
)))

GLOBAL_LIST_INIT(security_hardsuit_allowed, typecacheof(list(
/obj/item/ammo_box,
/obj/item/ammo_casing,
/obj/item/flashlight,
/obj/item/gun/ballistic,
/obj/item/gun/energy,
/obj/item/melee/baton,
/obj/item/reagent_containers/spray/pepper,
/obj/item/restraints/handcuffs,
/obj/item/tank/internals,
/obj/item/gun/microfusion, //SKYRAT EDIT ADDITION
)))

GLOBAL_LIST_INIT(detective_vest_allowed, typecacheof(list(
/obj/item/ammo_box,
/obj/item/ammo_casing,
/obj/item/detective_scanner,
Expand All @@ -182,6 +206,7 @@ GLOBAL_LIST_INIT(detective_vest_allowed, list(
/obj/item/tank/internals/plasmaman,
/obj/item/storage/belt/holster/detective,
/obj/item/storage/belt/holster/nukie,
/obj/item/gun/microfusion, //SKYRAT EDIT ADDITION
/obj/item/storage/belt/holster/energy,
))

Expand All @@ -199,6 +224,7 @@ GLOBAL_LIST_INIT(security_vest_allowed, list(
/obj/item/tank/internals/plasmaman,
/obj/item/storage/belt/holster/detective,
/obj/item/storage/belt/holster/nukie,
/obj/item/gun/microfusion, //SKYRAT EDIT ADDITION
/obj/item/storage/belt/holster/energy,
/obj/item/clothing/mask/breath/sec_bandana
))
Expand All @@ -213,6 +239,7 @@ GLOBAL_LIST_INIT(security_wintercoat_allowed, list(
/obj/item/restraints/handcuffs,
/obj/item/storage/belt/holster/detective,
/obj/item/storage/belt/holster/nukie,
/obj/item/gun/microfusion, //SKYRAT EDIT ADDITION
/obj/item/storage/belt/holster/energy,
))

Expand Down
63 changes: 63 additions & 0 deletions code/__DEFINES/~skyrat_defines/traits.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Defines for some extra traits

Check failure on line 1 in code/__DEFINES/~skyrat_defines/traits.dm

View workflow job for this annotation

GitHub Actions / Run Linters

DME Validator

File is not included
#define TRAIT_NO_HUSK "no_husk"
#define TRAIT_NORUNNING "norunning" // You walk!
#define TRAIT_EXCITABLE "wagwag" //Will wag when patted!
#define TRAIT_OXYIMMUNE "oxyimmune" // Immune to oxygen damage, ideally give this to all non-breathing species or bad stuff will happen
#define TRAIT_IRONASS "ironass"
#define TRAIT_MOOD_NOEXAMINE "mood_noexamine" // Can't assess your own mood
#define TRAIT_DNR "cant_revive" //You just can't be revived without supernatural means
#define TRAIT_HARD_SOLES "hard_soles" // No step on glass
#define TRAIT_SENSITIVESNOUT "sensitive_snout" // Snout hurts when booped
#define TRAIT_DETECTIVE "detective_ability" //Given to the detective, if they have this, they can see syndicate special descriptions.
#define TRAIT_FREE_GHOST "free_ghost" // Can ghost and return freely with this trait
#define QUIRK_LINGUIST "Linguist" // Extra language point.
#define GLUED_ITEM_TRAIT "glued-item" // This is for glued items, undroppable. Syndie glue applies this.
#define TRAIT_STICKY_FINGERS "sticky_fingers" //This is so a mob can strip items faster and picks them up after
/// This makes trait makes it so that the person cannot be infected by the zombie virus.
#define TRAIT_MUTANT_IMMUNE "mutant_immune"

//AdditionalEmotes *turf traits
#define TRAIT_WATER_ASPECT "water_aspect"
#define TRAIT_WEBBING_ASPECT "webbing_aspect"
#define TRAIT_FLORAL_ASPECT "floral_aspect"
#define TRAIT_ASH_ASPECT "ash_aspect"
#define TRAIT_SPARKLE_ASPECT "sparkle_aspect"

/// Allows the user to instantly reload.
#define TRAIT_INSTANT_RELOAD "instant_reload"

// Trait sources
#define GHOSTROLE_TRAIT "ghostrole" // SKYRAT EDIT ADDITION -- Ghost Cafe Traits

/// One can breath under water, you get me?
#define TRAIT_WATER_BREATHING "water_breathing"

/// Under the effect of a numbling agent, such as morphine, for surgery.
#define TRAIT_NUMBED "numbed"

// felinid traits
#define TRAIT_FELINE "feline_aspect"

// chameleon mutation
#define TRAIT_CHAMELEON_SKIN "chameleon_skin"

//Makes sure that people cant be cult sacrificed twice.
#define TRAIT_SACRIFICED "sacrificed"

//Adds 2 seconds to the Goliath tentacle stun timer.
#define TRAIT_GOLIATH_STUN "goliath_stun"

//to determine if someone is a fishing master, or not
#define TRAIT_FISHING_MASTER "fishing_master"

//to determine if someone is a ceramics master, or not
#define TRAIT_CERAMIC_MASTER "ceramic_master"

//to determine if someone is a glassblowing master, or not
#define TRAIT_GLASSBLOWING_MASTER "glassblowing_master"

/// The trait that determines if someone has the oversized quirk.
#define TRAIT_OVERSIZED "trait_oversized"

/// Caninid trait
#define TRAIT_CANINE "trait_canine"
7 changes: 6 additions & 1 deletion code/game/machinery/cell_charger.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@
if(charging)
to_chat(user, span_warning("There is already a cell in the charger!"))
return
//SKYRAT EDIT ADDITION
var/obj/item/stock_parts/cell/inserting_cell = W
if(inserting_cell.chargerate <= 0)
to_chat(user, span_warning("[inserting_cell] cannot be recharged!"))
return
//SKYRAT EDIT END
else
var/area/a = loc.loc // Gets our locations location, like a dream within a dream
if(!isarea(a))
Expand Down Expand Up @@ -133,7 +139,6 @@
/obj/machinery/cell_charger/process(seconds_per_tick)
if(!charging || !anchored || (machine_stat & (BROKEN|NOPOWER)))
return

if(charging.percent() >= 100)
return

Expand Down
15 changes: 15 additions & 0 deletions code/game/machinery/recharger.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
var/finished_recharging = FALSE

var/static/list/allowed_devices = typecacheof(list(
/obj/item/stock_parts/cell/microfusion, //SKYRAT EDIT ADDITION
/obj/item/gun/microfusion, // SKYRAT EDIT ADDITION
/obj/item/gun/energy,
/obj/item/melee/baton/security,
/obj/item/ammo_box/magazine/recharge,
Expand Down Expand Up @@ -85,6 +87,19 @@
to_chat(user, span_notice("Your gun has no external power connector."))
return 1

//SKYRAT EDIT ADDITION
if (istype(G, /obj/item/gun/microfusion))
var/obj/item/gun/microfusion/microfusion_gun = G
if(microfusion_gun.cell?.chargerate <= 0)
to_chat(user, span_notice("[microfusion_gun] cannot be recharged!"))
return TRUE

if(istype(G, /obj/item/stock_parts/cell/microfusion))
var/obj/item/stock_parts/cell/microfusion/inserting_cell = G
if(inserting_cell.chargerate <= 0)
to_chat(user, span_notice("[inserting_cell] cannot be recharged!"))
return TRUE
//SKYRAT EDIT END
if(!user.transferItemToLoc(G, src))
return 1
setCharging(G)
Expand Down
3 changes: 2 additions & 1 deletion code/game/objects/items/storage/belt.dm
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@
/obj/item/reagent_containers/spray/pepper,
/obj/item/restraints/handcuffs,
/obj/item/restraints/legcuffs/bola,
/obj/item/food/spaghetti/security, //monkestation change: tactical belt spaghetti
/obj/item/food/spaghetti/security, //monkestation change: tactical belt spaghetti,
/obj/item/stock_parts/cell/microfusion, //SKYRAT EDIT ADDITION
))

/obj/item/storage/belt/security/full/PopulateContents()
Expand Down
64 changes: 13 additions & 51 deletions code/modules/power/cell.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,44 +51,11 @@
create_reagents(5, INJECTABLE | DRAINABLE)
if (override_maxcharge)
maxcharge = override_maxcharge
rating = max(round(maxcharge / 10000, 1), 1)
if(!charge)
charge = maxcharge
if(empty)
charge = 0
if(ratingdesc)
desc += " This one has a rating of [display_energy(maxcharge)][prob(10) ? ", and you should not swallow it" : ""]." //joke works better if it's not on every cell
update_appearance()

RegisterSignal(src, COMSIG_ITEM_MAGICALLY_CHARGED, PROC_REF(on_magic_charge))
var/static/list/loc_connections = list(
COMSIG_ITEM_MAGICALLY_CHARGED = PROC_REF(on_magic_charge),
)
AddElement(/datum/element/connect_loc, loc_connections)

/**
* Signal proc for [COMSIG_ITEM_MAGICALLY_CHARGED]
*
* If we, or the item we're located in, is subject to the charge spell, gain some charge back
*/
/obj/item/stock_parts/cell/proc/on_magic_charge(datum/source, datum/action/cooldown/spell/charge/spell, mob/living/caster)
SIGNAL_HANDLER

// This shouldn't be running if we're not being held by a mob,
// or if we're not within an object being held by a mob, but just in case...
if(!ismovable(loc))
return

. = COMPONENT_ITEM_CHARGED

if(prob(80))
maxcharge -= 200

if(maxcharge <= 1) // Div by 0 protection
maxcharge = 1
. |= COMPONENT_ITEM_BURNT_OUT

charge = maxcharge
/* SKYRAT EDIT REMOVAL
if(ratingdesc)
desc += " This one has a rating of [display_energy(maxcharge)], and you should not swallow it."
*/ // SKYRAT EDIT END
update_appearance()

// Guns need to process their chamber when we've been charged
Expand Down Expand Up @@ -119,20 +86,7 @@
. += mutable_appearance('icons/obj/power.dmi', "grown_wires")
if((charge < 0.01) || !charge_light_type)
return
. += mutable_appearance('icons/obj/power.dmi', "cell-[charge_light_type]-o[(percent() >= 99.5) ? 2 : 1]")

/obj/item/stock_parts/cell/vv_edit_var(vname, vval)
if(vname == NAMEOF(src, charge))
charge = clamp(vval, 0, maxcharge)
return TRUE
if(vname == NAMEOF(src, maxcharge))
if(charge > vval)
charge = vval
if(vname == NAMEOF(src, corrupted) && vval && !corrupted)
corrupt(TRUE)
return TRUE
return ..()

. += mutable_appearance(charge_overlay_icon, "cell-o[((charge / maxcharge) >= 0.995) ? 2 : 1]") //SKYRAT EDIT CHANGE

/obj/item/stock_parts/cell/proc/percent() // return % charge of cell
return 100 * charge / maxcharge
Expand Down Expand Up @@ -162,8 +116,16 @@

/obj/item/stock_parts/cell/examine(mob/user)
. = ..()
// SKYRAT EDIT ADDITION
if(ratingdesc && !microfusion_readout)
. += "This one has a rating of [display_energy(maxcharge)], and you should not swallow it."
// SKYRAT EDIT END
if(rigged)
. += span_danger("This power cell seems to be faulty!")
// SKYRAT EDIT ADDITION
else if(microfusion_readout)
. += "The charge meter reads [charge]/[maxcharge] MF."
// SKYRAT EDIT END
else
. += "The charge meter reads [CEILING(percent(), 0.1)]%." //so it doesn't say 0% charge when the overlay indicates it still has charge

Expand Down
23 changes: 2 additions & 21 deletions code/modules/projectiles/guns/energy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,6 @@
///set to true so the gun is given an empty cell
var/dead_cell = FALSE

/obj/item/gun/energy/fire_sounds()
// What frequency the energy gun's sound will make
var/frequency_to_use

var/obj/item/ammo_casing/energy/shot = ammo_type[select]
// What percentage of the full battery a shot will expend
var/shot_cost_percent = round(clamp(shot.e_cost / cell.maxcharge, 0, 1) * 100)
// Ignore this on oversized/infinite cells or ammo without cost
if(shot_cost_percent > 0)
// The total amount of shots the fully charged energy gun can fire before running out
var/max_shots = round(100/shot_cost_percent)
// How many shots left before the energy gun's current battery runs out of energy
var/shots_left = round((round(clamp(cell.charge / cell.maxcharge, 0, 1) * 100))/shot_cost_percent)
frequency_to_use = sin((90/max_shots) * shots_left)

if(suppressed)
playsound(src, suppressed_sound, suppressed_volume, vary_fire_sound, ignore_walls = FALSE, extrarange = SILENCED_SOUND_EXTRARANGE, falloff_distance = 0, frequency = frequency_to_use)
else
playsound(src, fire_sound, fire_sound_volume, vary_fire_sound, frequency = frequency_to_use)

/obj/item/gun/energy/emp_act(severity)
. = ..()
if(!(. & EMP_PROTECT_CONTENTS))
Expand Down Expand Up @@ -121,6 +101,7 @@
ammo_type[i] = shot
shot = ammo_type[select]
fire_sound = shot.fire_sound
fire_sound_volume = shot.fire_sound_volume //SKYRAT EDIT ADDITION
fire_delay = shot.delay

/obj/item/gun/energy/Destroy()
Expand Down Expand Up @@ -202,6 +183,7 @@
select = 1
var/obj/item/ammo_casing/energy/shot = ammo_type[select]
fire_sound = shot.fire_sound
fire_sound_volume = shot.fire_sound_volume //SKYRAT EDIT ADDITION
fire_delay = shot.delay
if (shot.select_name && user)
balloon_alert(user, "set to [shot.select_name]")
Expand Down Expand Up @@ -229,7 +211,6 @@
worn_icon_state = temp_icon_to_use
return ..()


/obj/item/gun/energy/update_overlays()
. = ..()
if(!automatic_charge_overlays)
Expand Down
Loading

0 comments on commit c54b2b7

Please sign in to comment.