Garry's Mod

Garry's Mod

91 hodnocení
Light Break
   
Ocenit
Přidat do oblíbených
Oblíbeno
Odebrat z oblíbených
Content Type: Addon
Addon Type: Tool
Addon Tags: Scenic, Realism
Velikost souboru
Přidáno
Aktualizováno
569.752 KB
9. led. 2022 v 20.13
9. led. 2022 v 21.48
Poznámky ke změnám (2) – zobrazit

Klikněte na „Odebírat“ pro stažení položky
Light Break

Popis
The closest approximation to breakable lights in this dinosaur of an engine
Either no one did this before or did it better but it never saw the light of day, but here's an attempt at making lights breakable. Not exactly breakable per se, but only an illusion by using entities (shootable_light especifically) and firing TurnOn/TurnOff inputs.

To make lights breakable, just type shootlight_setup in console and it'll set it up for you

Features
  • Hammer lights (light, light_dynamic and light_spot) can now be made breakable!
  • Gmod lights and lamps are also breakable!
  • Like... 8 convars
  • A lightweight map for testing the addon (light_break_testmap.bsp)
  • Future : Developer config file to add support for custom light entities

Problems (Developer Gobbledigook)
I didn't do this with some kind of super deep academic research mindset for other developers to solve these problems, but here are some (not necessarily bugs) that I encountered during the making of this :

  • If a map's light entity isn't dynamic and it isn't named, it won't register in the server's entity list, which means you can't fetch it through ents.GetAll(). Here's the doozy : Every. Single. ♥♥♥♥♥♥♥. Map. has 1 or 2 named lights at best and the rest is unnamed. Of course this is for peformance reasons, but it makes the addon nearly pointless unless a dark map with manually spawned lights or a custom suited map is used.
  • There is almost no way to circumvent these unregistered lights through scripts. I tried engine.LightStyle() but that messes up the whole map and most of the time doesn't work.

    I can only imagine being able to make a fully fledged breakable light system by abusing the absolute hell out of the render library or just straight up building a new engine

ConVars
If you forget what a convar does or was, just type its name and it will show you its helptext/default value

  • shootlight_mapents : Defines if light entities from the map (light, light_dynamic, etc) should be breakable
  • shootlight_ent_alpha : Defines shootable_light's visibility
  • shootlight_removeonbreak : Removes the shootable_light entity when the light breaks, not recommended unless peformance is bad (Make sure to refresh the map's lights with a cleanup/save if it was off and you turned it on again)
  • shootlight_ent_scale : Defines shootable_light's scale
  • shootlight_ent_model : Defines shootable_light's model
  • shootlight_ent_material : Defines shootable_light's material
  • shootlight_ent_hp : Defines shootable_light's minimum and maximum health, format : <min>,<max>
  • shootlight_debughalo : (DEBUG) Creates a blue halo around a shootable_light, admin-only (REQUIRES RESTART!)


Console Commands
  • shootlight_setup <arg1> : (Used in the video at the start) Creates shootable_light entities and connects them to compatible light entities, aka, makes them breakable. The optional first argument (arg1) can be either
    • clean : Only cleans up every shootable_light entity on the map
    • noclean : Creates shootable_light entities without cleaning existing ones first (Not recommended)
    Leaving arg1 blank will clean the map of shootable_lights and fill it up again with new ones

How long did this take you to do...?
One whole sunday :(

Credits
Code -Me
Map -Me
Populární diskuze Zobrazit vše (1)
2
24. led. 2022 v 16.21
PŘILEPENO: Bugs and Suggestions
SubwayJared
Počet komentářů: 10
dommygutman 2. kvě. 2023 v 7.21 
What are the supported maps?
wizard with a gun 22. pro. 2022 v 18.20 
aha, now i can make (almost) accurate rush
36R49 13. pro. 2022 v 1.59 
its okey, but steel thank you
SubwayJared  [autor] 12. pro. 2022 v 18.16 
@36R49 The problem is the Source Engine doesn't support the disabling of lights, especially static lights which are commonplace in 99% of maps. Sorry!
36R49 6. pro. 2022 v 4.45 
can you made tool what will be desable light on map or somthing close for that???
Marcus 23. srp. 2022 v 13.49 
Smooth gameplay
Kiralex 1. bře. 2022 v 11.25 
Niiiice
DukeyNukey 22. led. 2022 v 3.31 
weird how N64 games had breakable lights.
hawky_ 15. led. 2022 v 22.59 
showcase goes 1 fps
Yavuzhan 15. led. 2022 v 10.45 
Not bad. Good job mate!